lwhhszx 2 лет назад
Родитель
Сommit
9dadceeafe

+ 4 - 8
pom.xml

@@ -90,6 +90,10 @@
             <scope>runtime</scope>
         </dependency>
         <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <dependency>
             <groupId>com.mchange</groupId>
             <artifactId>c3p0</artifactId>
             <version>0.9.5.2</version>
@@ -138,14 +142,6 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
-            <!--            <plugin>-->
-            <!--                <groupId>org.apache.maven.plugins</groupId>-->
-            <!--                <artifactId>maven-compiler-plugin</artifactId>-->
-            <!--                <configuration>-->
-            <!--                    <source>16</source>-->
-            <!--                    <target>16</target>-->
-            <!--                </configuration>-->
-            <!--            </plugin>-->
         </plugins>
     </build>
 

+ 20 - 0
src/main/java/com/example/demo/base/RedisConf.java

@@ -0,0 +1,20 @@
+package com.example.demo.base;
+
+
+/**
+ * Redis常量类
+ */
+public class RedisConf {
+
+    public static final String SYMBOL_COLON = ":";
+    public static final String SYMBOL_LINE = "-";
+    public final static String COMMON_DATA = "common-data";
+    public final static String LOGIN_USER = "login-user";
+    public final static String VERIFY_CODE = "verify-code";
+    public final static String SELECT_PATENT = "select-patent";
+    public final static String ANALYSIS_COUNT = "analysis-count";
+    public final static String AREA_LIST = "area-list";
+    public final static String USER_FIELD = "user-field";
+    public final static String FIELD_ORDER = "field-order";
+    public final static String USER_IMPORT = "user-import";
+}

+ 3 - 0
src/main/java/com/example/demo/controller/QuartzTaskController.java

@@ -34,6 +34,9 @@ public class QuartzTaskController {
     public String addTask(@RequestBody QrtzTaskAddNewDTO qrtzTaskAddNewDTO) throws SchedulerException {
         //添加任务
         QrtzTask qrtzTask = qrTaskService.addQuartzTask(qrtzTaskAddNewDTO);
+        if(qrtzTask==null){
+            return Response.error("未配置网站登录信息");
+        }
         //任务添加完,判断是定时任务则任务调度添加该定时任务
         if (qrtzTask.getTaskType() == 1) {
             jobService.addJob(qrtzTask);

+ 31 - 0
src/main/java/com/example/demo/controller/WebConfigController.java

@@ -1,15 +1,21 @@
 package com.example.demo.controller;
 
 import com.example.demo.base.Constants;
+import com.example.demo.domain.dto.ConfigDTO;
+import com.example.demo.model.vo.QueryConfigVO;
 import com.example.demo.service.WebConfigCellService;
 import com.example.demo.service.WebConfigService;
+import com.example.demo.service.WebLoginConfigService;
 import com.example.demo.util.Response;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 
 @RestController
 @Tag(name = "网站配置接口")
@@ -18,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
 public class WebConfigController {
     private final WebConfigService webConfigService;
     private final WebConfigCellService webConfigCellService;
+    private final WebLoginConfigService webLoginConfigService;
 
     //获得所有配置
     @Operation(summary = "获得所有配置")
@@ -33,4 +40,28 @@ public class WebConfigController {
     public String getConfigCell(Integer type) {
         return Response.success(webConfigCellService.getConfigCell(type));
     }
+    //根据配置类型获得配置元素
+    @Operation(summary = "添加配置")
+    @PostMapping ("/addLoginConfig")
+    public String addLoginConfig(@RequestBody ConfigDTO configDTO) {
+        webLoginConfigService.addLoginConfig(configDTO);
+        return Response.success();
+    }
+    //查找配置
+    @Operation(summary = "查找配置")
+    @PostMapping ("/queryLoginConfig")
+    public String queryLoginConfig(@RequestBody QueryConfigVO queryConfigVO) {
+
+        return Response.success(webLoginConfigService.queryLoginConfig(queryConfigVO));
+    }
+    //批量删除配置
+    @Operation(summary = "删除配置")
+    @PostMapping ("/deleteConfig")
+    public String deleteConfig(@RequestBody List<Integer> ids) {
+   Boolean flag =    webLoginConfigService.deleteConfig(ids);
+   if(!flag){
+       Response.error("删除失败");
+   }
+        return Response.success("删除成功");
+    }
 }

+ 20 - 0
src/main/java/com/example/demo/domain/dto/ConfigDTO.java

@@ -0,0 +1,20 @@
+package com.example.demo.domain.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+@Data
+public class ConfigDTO {
+
+    private String loginAccount;
+
+    private String loginPassword;
+
+    private Integer tenantId;
+
+    private Integer webId;
+
+
+}

+ 2 - 0
src/main/java/com/example/demo/domain/entity/QrtzTask.java

@@ -71,6 +71,8 @@ public class QrtzTask extends BaseEntity<QrtzTask>{
      */
     @TableField(value = "create_person_name")
     private String createPersonName;
+    @TableField(value = "tenant_id")
+    private Integer tenantId;
     /**
      * 创建时间
      */

+ 7 - 1
src/main/java/com/example/demo/mapper/WebLoginConfigMapper.java

@@ -2,9 +2,15 @@ package com.example.demo.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.demo.domain.dto.ConfigDTO;
 import com.example.demo.domain.entity.WebConfig;
 import com.example.demo.domain.entity.WebLoginConfig;
+import com.example.demo.model.vo.ConfigVO;
+import com.example.demo.model.vo.QueryConfigVO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
 * @author admin
@@ -14,7 +20,7 @@ import org.apache.ibatis.annotations.Mapper;
 */
 @Mapper
 public interface WebLoginConfigMapper extends BaseMapper<WebLoginConfig> {
-
+    IPage<ConfigVO> getPageList(Page<ConfigVO> page, @Param("params") QueryConfigVO params);
 }
 
 

+ 30 - 0
src/main/java/com/example/demo/model/vo/BaseVO.java

@@ -0,0 +1,30 @@
+package com.example.demo.model.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * @author 沈永艺
+ * @date 2022-8-3
+ * @description VO基类
+ */
+
+@Data
+@Accessors(chain = true)
+public class BaseVO {
+    /**
+     * 每页条数
+     */
+    private Integer size;
+
+    /**
+     * 当前页数
+     */
+    private Integer current;
+
+    /**
+     * 数据总数
+     */
+    private Integer total;
+
+}

+ 17 - 0
src/main/java/com/example/demo/model/vo/ConfigVO.java

@@ -0,0 +1,17 @@
+package com.example.demo.model.vo;
+
+import lombok.Data;
+
+@Data
+public class ConfigVO {
+
+    private String loginAccount;
+
+    private String loginPassword;
+
+    private String webAddress;
+
+    private String webName;
+    private Integer id;
+    private Integer webId;
+}

+ 167 - 0
src/main/java/com/example/demo/model/vo/PersonnelVO.java

@@ -0,0 +1,167 @@
+package com.example.demo.model.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * @author 沈永艺
+ * @date 2022-8-4
+ * @description 人员类 前台对应实体
+ */
+
+@Data
+@Accessors(chain = true)
+public class PersonnelVO {
+    /**
+     * ID
+     */
+    private Integer id;
+
+    /**
+     * Front:姓名
+     * Back:人员名称
+     */
+    private String name;
+
+    /**
+     * Front:性别
+     * Back:人员性别
+     */
+    private Integer gender;
+
+    /**
+     * Front:邮箱
+     * Back:人员邮箱
+     */
+    private String email;
+
+    /**
+     * Front:联系方式
+     * Back:人员联系电话
+     */
+    private String mobile;
+
+    /**
+     * Front:所属租户
+     * Back:租户ID
+     */
+    private Integer tenant;
+
+    /**
+     * Front:状态
+     * Back:人员账号状态(1启用0停用)
+     */
+    private Integer state;
+
+    /**
+     * Front:账号
+     * Back:人员账号
+     */
+    private String username;
+
+    /**
+     * Front:密码
+     * Back:人员密码
+     */
+    private String password;
+
+    /**
+     * Front:备注
+     * Back:人员描述
+     */
+    private String remark;
+
+    /**
+     * Front:QQ号
+     * Back:人员QQ号
+     */
+    private String qqNumber;
+
+    /**
+     * Front:微信号
+     * Back:人员微信号
+     */
+    private String wechat;
+
+    /**
+     * Front:钉钉号
+     * Back:人员钉钉号
+     */
+    private String nail;
+
+    /**
+     * Front:
+     * Back:租户名称
+     */
+    private String tenantName;
+
+    /**
+     * Front:
+     * Back:租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 登陆成功后生成的Token
+     */
+    private String token;
+
+    /**
+     * 角色List
+     */
+    private List<PerRole> rList;
+
+    /**
+     * 部门职位List
+     */
+    private List<DP> dpList;
+    /**
+     * 角色类型(是否为管理角色)
+     */
+    private Integer roleType;
+    /**
+     * 租户类型
+     */
+    private String tenantType;
+
+    /**
+     * 部门职位绑定关系
+     */
+    @Data
+    public static class DP {
+        /**
+         * 部门名称
+         */
+        private String departmentName;
+        /**
+         * 部门ID
+         */
+        private Integer departmentId;
+        /**
+         * 职位名称
+         */
+        private String positionName;
+        /**
+         * 职位ID
+         */
+        private Integer positionId;
+    }
+
+    /**
+     * 角色信息
+     */
+    @Data
+    public static class PerRole {
+        /**
+         * 角色名称
+         */
+        private String roleName;
+        /**
+         * 角色ID
+         */
+        private Integer roleId;
+    }
+
+}

+ 19 - 0
src/main/java/com/example/demo/model/vo/QueryConfigVO.java

@@ -0,0 +1,19 @@
+package com.example.demo.model.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * @author 沈永艺
+ * @date 2022-8-3
+ * @description VO基类
+ */
+
+@Data
+@Accessors(chain = true)
+public class QueryConfigVO extends BaseVO {
+    private Integer tenantId;
+    private Integer webId;
+    private String loginAccount;
+
+}

+ 15 - 3
src/main/java/com/example/demo/service/QrTaskService.java

@@ -11,7 +11,10 @@ import com.example.demo.domain.dto.QueryPageDTO;
 import com.example.demo.domain.dto.QueryTaskDetailsDTO;
 import com.example.demo.domain.entity.QrtzTask;
 import com.example.demo.domain.entity.QrtzTaskDetail;
+import com.example.demo.domain.entity.WebLoginConfig;
 import com.example.demo.mapper.QrtzTaskMapper;
+import com.example.demo.model.vo.PersonnelVO;
+import com.example.demo.util.LoginUtils;
 import com.example.demo.util.Response;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -38,7 +41,8 @@ import java.util.regex.Pattern;
 public class QrTaskService extends ServiceImpl<QrtzTaskMapper, QrtzTask> {
     private final JobService jobService;
     private final QrTaskDetailService qrTaskDetailService;
-
+    private final LoginUtils loginUtils;
+    private final WebLoginConfigService webLoginConfigService;
     /**
      * 新增任务
      *
@@ -46,11 +50,16 @@ public class QrTaskService extends ServiceImpl<QrtzTaskMapper, QrtzTask> {
      */
     public QrtzTask addQuartzTask(QrtzTaskAddNewDTO qrtzTaskAddNewDTO) {
         log.info("开始处理【新增任务条件】的业务,参数为:{}", qrtzTaskAddNewDTO);
-
+         Integer webId =   qrtzTaskAddNewDTO.getConfigId();
+         //根据网站id获得配置
+       WebLoginConfig webLoginConfig = webLoginConfigService.getLoginConfig(webId);
+       if(webLoginConfig==null){
+           return  null;
+       }
         //DTO数据赋值给任务条件实体类
         QrtzTask qrtzTask = new QrtzTask();
         BeanUtils.copyProperties(qrtzTaskAddNewDTO, qrtzTask);
-
+        qrtzTask.setCreatePersonId(loginUtils.getId());
         List<String> cells = qrtzTaskAddNewDTO.getConfigCells();
         if (cells == null) {
             qrtzTask.setConfigCells("");
@@ -116,6 +125,9 @@ public class QrTaskService extends ServiceImpl<QrtzTaskMapper, QrtzTask> {
             List<QrtzTaskDetail> qrtzTaskDetails =qrTaskDetailService.list(queryWrapper);
             if(qrtzTaskDetails.size()==0){
                 Boolean flag = this.removeById(qrtzTask.getId());
+                LambdaQueryWrapper<QrtzTaskDetail> deleteWrapper =new LambdaQueryWrapper<>();
+                queryWrapper.eq(QrtzTaskDetail::getTaskId,qrtzTask.getId());
+                qrTaskDetailService.removeById(deleteWrapper);
                 if (!flag) {
                     reIds.add(qrtzTask.getId());
                 }

+ 14 - 6
src/main/java/com/example/demo/service/UploadFromWebService.java

@@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.example.demo.base.Constants;
 import com.example.demo.domain.dto.UploadFileDTO;
-import com.example.demo.domain.entity.PatentCell;
-import com.example.demo.domain.entity.QrtzTask;
-import com.example.demo.domain.entity.QrtzTaskDetail;
-import com.example.demo.domain.entity.WebConfig;
+import com.example.demo.domain.entity.*;
 import com.example.demo.model.dto.TaskWebSocketDTO;
 import com.example.demo.model.dto.WebQueryDTO;
 import com.example.demo.util.*;
@@ -47,6 +44,7 @@ public class UploadFromWebService {
     private final WebConfigService webConfigService;
     private final QrTaskService qrTaskService;
     private final QrTaskDetailService qrTaskDetailService;
+    private final WebLoginConfigService webLoginConfigService;
     @Value("${driverUrl}")
     private  String url;
 
@@ -68,6 +66,16 @@ public class UploadFromWebService {
             //conditions = this.formatConditions(conditions);
             //根据id 获得网站配置
             WebConfig webConfig = webConfigService.getConfigById(id);
+            //根据网站id和用户的租户获得登录信息
+           WebLoginConfig webLoginConfig = webLoginConfigService.getLoginConfig(webConfig.getId());
+           if(webConfig==null){
+               qrtzTaskDetail.setTaskDetailState(3);
+               qrtzTaskDetail.setSuccessNum(successNum);
+               qrtzTaskDetail.setDefaultNum(qrtzTaskDetail.getAllNum() - successNum);
+               qrtzTaskDetail.setFailure("未配置登录信息");
+               qrtzTaskDetail.setEndTime(new Date());
+               qrtzTaskDetail.updateById();
+           }
             //1.获得驱动
           //  System.setProperty("webdriver.chrome.driver", "D:\\driver\\chromedriver.exe");
             System.setProperty("webdriver.chrome.driver", url);
@@ -89,8 +97,8 @@ public class UploadFromWebService {
             wait1.until(ExpectedConditions.presenceOfElementLocated(By.id("loginname")));
             WebElement loginName = driver.findElement(By.id("loginname"));
             WebElement password = driver.findElement(By.id("password"));
-            loginName.sendKeys(webConfig.getWebAccount());
-            password.sendKeys(webConfig.getWebPassword());
+            loginName.sendKeys(webLoginConfig.getLoginAccount());
+            password.sendKeys(webLoginConfig.getLoginPassword());
             WebElement loginButton = driver.findElement(By.id("login"));
             loginButton.click();
             TimeUnit.MILLISECONDS.sleep(5000);//毫秒

+ 51 - 2
src/main/java/com/example/demo/service/WebLoginConfigService.java

@@ -1,10 +1,20 @@
 package com.example.demo.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.example.demo.domain.dto.ConfigDTO;
 import com.example.demo.domain.entity.WebConfig;
 import com.example.demo.domain.entity.WebLoginConfig;
 import com.example.demo.mapper.WebConfigMapper;
 import com.example.demo.mapper.WebLoginConfigMapper;
+import com.example.demo.model.vo.BaseVO;
+import com.example.demo.model.vo.ConfigVO;
+import com.example.demo.model.vo.PersonnelVO;
+import com.example.demo.model.vo.QueryConfigVO;
+import com.example.demo.util.CacheUtils;
+import com.example.demo.util.LoginUtils;
 import lombok.RequiredArgsConstructor;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
@@ -19,10 +29,49 @@ import java.util.List;
 @Service
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class WebLoginConfigService extends ServiceImpl<WebLoginConfigMapper, WebLoginConfig> {
+    private final CacheUtils cacheUtils ;
+    private final LoginUtils  loginUtils;
 //添加配置
-    public addConfig(){
-
+    public void addLoginConfig(ConfigDTO configDTO){
+        PersonnelVO personnelVO = cacheUtils.getLoginUserPersonnel(loginUtils.getId());
+        LambdaQueryWrapper<WebLoginConfig> wrapper =new LambdaQueryWrapper<>();
+        wrapper.eq(WebLoginConfig::getWebId,configDTO.getWebId())
+                .eq(WebLoginConfig::getTenantId,personnelVO.getTenantId());
+        List<WebLoginConfig> configs =this.list(wrapper);
+        WebLoginConfig config =new WebLoginConfig();
+        if(configs.size()>0){
+            config =configs.get(0);
+        }
+       config.setWebId(configDTO.getWebId());
+       config.setTenantId(personnelVO.getTenantId());
+       config.setLoginAccount(configDTO.getLoginAccount());
+       config.setLoginPassword(configDTO.getLoginPassword());
+       this.saveOrUpdate(config);
+    }
+    public WebLoginConfig getLoginConfig(Integer webId){
+        PersonnelVO personnelVO = cacheUtils.getLoginUserPersonnel(loginUtils.getId());
+        LambdaQueryWrapper<WebLoginConfig> wrapper =new LambdaQueryWrapper<>();
+        wrapper.eq(WebLoginConfig::getWebId,webId)
+                .eq(WebLoginConfig::getTenantId,personnelVO.getTenantId());
+        List<WebLoginConfig> configs =this.list(wrapper);
+        WebLoginConfig config =new WebLoginConfig();
+        if(configs.size()>0){
+            config =configs.get(0);
+        }
+        else {
+            config=null;
+        }
+      return config;
+    }
 
+   public IPage<ConfigVO> queryLoginConfig(QueryConfigVO queryConfigVO){
+        PersonnelVO personnelVO = cacheUtils.getLoginUserPersonnel(loginUtils.getId());
+        queryConfigVO.setTenantId(personnelVO.getTenantId());
+        IPage<ConfigVO> dataPage = baseMapper.getPageList(new Page<>(queryConfigVO.getCurrent(), queryConfigVO.getSize()), queryConfigVO);
+        return dataPage;
+    }
+    public Boolean deleteConfig(List<Integer> ids){
+      return   this.removeByIds(ids);
     }
 
 }

+ 41 - 0
src/main/java/com/example/demo/util/CacheUtils.java

@@ -0,0 +1,41 @@
+package com.example.demo.util;
+
+
+import cn.hutool.core.lang.tree.Tree;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.crypto.SecureUtil;
+import com.example.demo.base.RedisConf;
+import com.example.demo.model.vo.PersonnelVO;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+@Component
+public class CacheUtils {
+
+    @Resource
+    private RedisUtil redisUtil;
+
+    public PersonnelVO getLoginUser(Object userId) {
+        String json = redisUtil.get(RedisConf.LOGIN_USER + RedisConf.SYMBOL_COLON + userId);
+        if (StringUtils.isEmpty(json)) {
+            throw new RuntimeException("未找到用户");
+        } else {
+            return com.alibaba.fastjson2.JSONObject.parseObject(json, PersonnelVO.class);
+        }
+    }
+
+    public  PersonnelVO getLoginUserPersonnel(Object userId) {
+        String json = redisUtil.get(RedisConf.LOGIN_USER + RedisConf.SYMBOL_COLON + userId);
+        if (StringUtils.isEmpty(json)) {
+            throw new RuntimeException("未找到用户");
+        } else {
+            return com.alibaba.fastjson2.JSONObject.parseObject(json, PersonnelVO.class);
+        }
+    }
+
+}

+ 38 - 0
src/main/java/com/example/demo/util/LoginUtils.java

@@ -0,0 +1,38 @@
+package com.example.demo.util;
+
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+@Component
+public class LoginUtils {
+    @Resource
+    private RedisUtil redisUtil;
+
+    public static String getToken() {
+        RequestAttributes ra = RequestContextHolder.getRequestAttributes();
+        ServletRequestAttributes sra = (ServletRequestAttributes) ra;
+        HttpServletRequest httpRequest = sra.getRequest();
+        String tem = httpRequest.getHeader("Cookie");
+        List<String> lst = StringUtils.changeStringToString(tem, ";");
+        final String[] token = {null};
+        lst.forEach(item -> {
+            if (item.contains("token")) {
+                token[0] = item;
+            }
+        });
+        return token[0].replaceAll(" ", "");
+    }
+
+    public Integer getId() {
+        String oriToken = LoginUtils.getToken();
+        String q = "token:login:" + oriToken.replace("=", ":");
+        String IdS = redisUtil.get(q);
+        return Integer.parseInt(IdS);
+    }
+}

Разница между файлами не показана из-за своего большого размера
+ 1325 - 0
src/main/java/com/example/demo/util/RedisUtil.java


+ 504 - 0
src/main/java/com/example/demo/util/StringUtils.java

@@ -0,0 +1,504 @@
+package com.example.demo.util;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+
+@Slf4j
+public class StringUtils {
+
+    private final static int NUM_32 = 32;
+    //集群号
+    private static int machineId = 1;
+    /**
+     * 下划线
+     */
+    private static final char SEPARATOR = '_';
+
+    /**
+     * 下划线转驼峰命名
+     */
+    public static String toUnderScoreCase(String str) {
+        if (str == null) {
+            return null;
+        }
+        StringBuilder sb = new StringBuilder();
+        // 前置字符是否大写
+        boolean preCharIsUpperCase = true;
+        // 当前字符是否大写
+        boolean curreCharIsUpperCase = true;
+        // 下一字符是否大写
+        boolean nexteCharIsUpperCase = true;
+        for (int i = 0; i < str.length(); i++) {
+            char c = str.charAt(i);
+            if (i > 0) {
+                preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1));
+            } else {
+                preCharIsUpperCase = false;
+            }
+
+            curreCharIsUpperCase = Character.isUpperCase(c);
+
+            if (i < (str.length() - 1)) {
+                nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1));
+            }
+
+            if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) {
+                sb.append(SEPARATOR);
+            } else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) {
+                sb.append(SEPARATOR);
+            }
+            sb.append(Character.toLowerCase(c));
+        }
+
+        return sb.toString();
+    }
+
+    /**
+     * * 判断一个对象是否非空
+     *
+     * @param object Object
+     * @return true:非空 false:空
+     */
+    public static boolean isNotNull(Object object) {
+        return !isNull(object);
+    }
+
+    public static boolean isNull(Object object) {
+        return object == null;
+    }
+
+
+    /**
+     * 把String 转换为 long
+     *
+     * @param str
+     * @param defaultData
+     * @return
+     */
+    public static long getLong(String str, Long defaultData) {
+        Long lnum = defaultData;
+
+        if (isEmpty(str)) {
+            return lnum;
+        }
+        try {
+            lnum = Long.valueOf(str.trim()).longValue();
+        } catch (NumberFormatException e) {
+            log.warn("把String 转换为 long======== " + str);
+        }
+        return lnum;
+
+    }
+
+    /**
+     * 转换成Boolean类型
+     *
+     * @param str
+     * @param defaultData
+     * @return
+     */
+    public static Boolean getBoolean(String str, Boolean defaultData) {
+        Boolean lnum = defaultData;
+
+        if (isEmpty(str)) {
+            return lnum;
+        }
+        try {
+            lnum = Boolean.valueOf(str.trim()).booleanValue();
+        } catch (NumberFormatException e) {
+            log.warn("把String 转换为 long======== " + str);
+        }
+        return lnum;
+
+    }
+
+    /**
+     * 把String转换成int数据
+     *
+     * @param str
+     * @param defaultData
+     * @return
+     */
+    public static int getInt(String str, Integer defaultData) {
+        int inum = defaultData;
+        if (isEmpty(str)) {
+            return inum;
+        }
+        try {
+            inum = Integer.valueOf(str.trim()).intValue();
+        } catch (NumberFormatException e) {
+            log.warn("把String转换成int数据========== " + str);
+        }
+        return inum;
+    }
+
+    /**
+     * 把String转换成double数据
+     *
+     * @param str
+     * @param defaultData
+     * @return
+     */
+    public static double getDouble(String str, Double defaultData) {
+        double dnum = defaultData;
+        if (isEmpty(str)) {
+            return dnum;
+        }
+        try {
+            dnum = Double.valueOf(str.trim()).doubleValue();
+        } catch (NumberFormatException e) {
+            log.error("把String转换成double数据: {}", str);
+        }
+        return dnum;
+    }
+
+    /**
+     * 把String转换成float数据
+     *
+     * @param str
+     * @param defaultData
+     * @return
+     */
+    public static float getFloat(String str, Float defaultData) {
+        float dnum = defaultData;
+        if (isEmpty(str)) {
+            return dnum;
+        }
+        try {
+            dnum = Float.valueOf(str.trim()).floatValue();
+        } catch (NumberFormatException e) {
+            log.error("把String转换成float数据: {}", str);
+        }
+        return dnum;
+    }
+
+    /**
+     * 判断字符串是否为空
+     *
+     * @param s
+     * @return
+     */
+    public static Boolean isEmpty(String s) {
+        if (s == null || s.length() <= 0) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 判断字符串是否为空
+     *
+     * @param str
+     * @return
+     */
+    public static boolean isNotEmpty(String str) {
+        return !StringUtils.isEmpty(str);
+    }
+
+    /**
+     * 按code截取字符串
+     *
+     * @return
+     */
+    public static String[] split(String str, String code) {
+        String[] split;
+        if (isEmpty(str)) {
+            split = null;
+        } else {
+            split = str.split(code);
+        }
+        return split;
+    }
+
+    /**
+     * 把字符串按code 转换为List<Long>
+     *
+     * @param str
+     * @return
+     */
+    public static List<Long> changeStringToLong(String str, String code) {
+        String[] split = split(str, code);
+        List<Long> lnums = new ArrayList<>();
+        for (String s : split) {
+            if (!isEmpty(s)) {
+                long lnum = getLong(s, 0L);
+                lnums.add(lnum);
+            }
+
+        }
+        return lnums;
+    }
+
+    /**
+     * 把字符串按code 转换为List<String>
+     *
+     * @param str
+     * @return
+     */
+    public static List<String> changeStringToString(String str, String code) {
+        String[] split = split(str, code);
+        List<String> lnums = new ArrayList<>();
+        for (String s : split) {
+            String trim = s.trim();
+            lnums.add(trim);
+        }
+        return lnums;
+    }
+
+    /**
+     * 把字符串按code 转换为List<Long>
+     *
+     * @param str
+     * @return
+     */
+    public static List<Integer> changeStringToInteger(String str, String code) {
+        if (isEmpty(str)) {
+            return new ArrayList<>();
+        }
+        String[] split = split(str, code);
+        List<Integer> inums = new ArrayList<>();
+        for (String s : split) {
+            int inum = getInt(s, 0);
+            inums.add(inum);
+        }
+        return inums;
+    }
+
+
+    /**
+     * 生成唯一订单号
+     *
+     * @return
+     */
+    public static String getOrderNumberByUUID() {
+
+        int hashCodeV = UUID.randomUUID().toString().hashCode();
+        //有可能是负数
+        if (hashCodeV < 0) {
+            hashCodeV = -hashCodeV;
+        }
+        String orderNumber = machineId + String.format("%015d", hashCodeV);
+        return orderNumber;
+    }
+
+    /**
+     * 生成唯一商户退款单号
+     *
+     * @return
+     */
+    public static String getOutRefundNoByUUID() {
+
+        int hashCodeV = UUID.randomUUID().toString().hashCode();
+        //有可能是负数
+        if (hashCodeV < 0) {
+            hashCodeV = -hashCodeV;
+        }
+        String out_refund_no = "BACK" + machineId + String.format("%015d", hashCodeV);
+        return out_refund_no;
+
+    }
+
+    /**
+     * 获取UUID,去掉了-
+     *
+     * @return
+     */
+    public static String getUUID() {
+        String uuid = UUID.randomUUID().toString().replaceAll("-", "");
+        log.debug("获取32位的UUID的调试日志-->>" + uuid);
+        return uuid;
+    }
+
+    /**
+     * 获取雪花UID
+     *
+     * @return
+     */
+//    public static Long getSnowflakeId() {
+//        SnowflakeIdWorker snowflakeIdWorker = new SnowflakeIdWorker(0, 0);
+//        return snowflakeIdWorker.nextId();
+//    }
+
+    /**
+     * list小于0的数据就过滤了
+     * 把list的数组变成1,3,4,5,6
+     *
+     * @param list
+     * @param code
+     * @return
+     */
+    public static String listToString(List<Long> list, String code) {
+        String s = "";
+        if (list == null || list.size() <= 0) {
+            return s;
+        }
+        for (Long l : list) {
+            if (l.longValue() > 0) {
+                s = s + l + code;
+            }
+        }
+        return s;
+    }
+
+    /**
+     * 按code把list的数组转换成字符串
+     *
+     * @param list
+     * @param code
+     * @return
+     */
+    public static String listTranformString(List<String> list, String code) {
+        String s = "";
+        if (list == null || list.size() <= 0) {
+            return s;
+        }
+        s = String.join(code, list);
+        return s;
+    }
+
+    /**
+     * 判断是否为非空字符串
+     *
+     * @param str
+     * @return
+     */
+    public static boolean isNotBlank(String str) {
+        return !StringUtils.isBlank(str);
+    }
+
+    /**
+     * 校验uid列表,检查里面元素是否满足限定长度为32
+     *
+     * @param collection
+     * @return
+     */
+    public static boolean checkUidList(Collection<String> collection) {
+        if (collection.size() == 0) {
+            return false;
+        }
+        for (String uid : collection) {
+            if (uid.trim().length() != NUM_32) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * 判断是否为空字符串
+     *
+     * @param str
+     * @return
+     */
+    public static boolean isBlank(String str) {
+        int strLen;
+        if (str == null || (strLen = str.length()) == 0) {
+            return true;
+        }
+        for (int i = 0; i < strLen; i++) {
+            if ((Character.isWhitespace(str.charAt(i)) == false)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * 判断一个字符串是否为数字
+     *
+     * @param str
+     * @return
+     */
+    public static boolean isNumeric(String str) {
+        try {
+            //把字符串强制转换为数字
+            Integer.valueOf(str);
+            //如果是数字,返回True
+            return true;
+        } catch (Exception e) {
+            //如果抛出异常,返回False
+            return false;
+        }
+    }
+
+    /**
+     * 某个子串是否在字符串内
+     *
+     * @param str
+     * @param searchChar
+     * @return
+     */
+    public static boolean contains(String str, String searchChar) {
+        if (isEmpty(str)) {
+            return false;
+        }
+        return str.indexOf(searchChar) >= 0;
+    }
+
+    /**
+     * 切割字符串
+     *
+     * @param str
+     * @param start
+     * @return
+     */
+    public static String substring(String str, int start) {
+        if (str == null) {
+            return null;
+        }
+        // handle negatives, which means last n characters
+        if (start < 0) {
+            start = str.length() + start;
+        }
+        if (start < 0) {
+            start = 0;
+        }
+        if (start > str.length()) {
+            return "";
+        }
+        return str.substring(start);
+    }
+
+    /**
+     * 判断评论是否为垃圾评论(仅通过单一字符重复出现来判断,以后可以扩展更多的检测方法)
+     *
+     * @param content
+     * @return
+     */
+    public static Boolean isCommentSpam(String content) {
+        if (content == null) {
+            return true;
+        }
+        char[] chars = content.toCharArray();
+        // 最大重复次数
+        Integer maxCount = 4;
+        for (int a = 0; a < chars.length; a++) {
+            Integer count = 1;
+            for (int b = a; b < chars.length - 1; b++) {
+                if (chars[b + 1] == chars[b]) {
+                    count++;
+                    // 判断字符重复的次数是否大于阈值
+                    if (count >= maxCount) {
+                        return true;
+                    }
+                    continue;
+                } else {
+                    break;
+                }
+            }
+        }
+        return false;
+    }
+
+    public static <T> String join(List<T> list, String separator) {
+        return org.apache.commons.lang3.StringUtils.join(list, separator);
+    }
+
+    public static <T> String join(String[] list, String separator) {
+        return org.apache.commons.lang3.StringUtils.join(list, separator);
+    }
+}

+ 66 - 0
src/main/resources/application-dev.yml

@@ -0,0 +1,66 @@
+
+spring:
+  redis:
+    host: 192.168.1.24
+    port: 6379
+    database: 3
+    password: Xx0GWxdWQJxx6Swe
+    lettuce:
+      pool:
+        max-active: 20
+        max-idle: 20
+        min-idle: 0
+        max-wait: -1ms
+    timeout: 2000ms
+  datasource:
+    url: jdbc:mysql://192.168.1.24:3306/pas?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
+    username: root
+    password: rrzTwWAYX8Gxh5JH
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    type: com.alibaba.druid.pool.DruidDataSource
+    druid:
+      stat-view-servlet:
+        login-username: admin
+        login-password: 123456
+      web-stat-filter:
+        exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
+  quartz:
+    #相关属性配置
+    properties:
+      org:
+        quartz:
+          scheduler:
+            instanceName: DefaultQuartzScheduler
+            instanceId: AUTO
+          jobStore:
+            class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
+            driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
+            tablePrefix: QRTZ_
+            isClustered: false
+            clusterCheckinInterval: 10000
+            useProperties: false
+          threadPool:
+            class: org.quartz.simpl.SimpleThreadPool
+            threadCount: 10
+            threadPriority: 5
+            threadsInheritContextClassLoaderOfInitializingThread: true
+          dataSource:
+            default:
+              URL: jdbc:mysql://192.168.1.24:3306/pas?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
+              user: root
+              password: rrzTwWAYX8Gxh5JH
+              driver: com.mysql.jdbc.Driver
+
+    #数据库方式
+    job-store-type: jdbc
+    #初始化表结构
+    jdbc:
+      initialize-schema: never
+PCSUrl: http://localhost:8879
+PASUrl: http://localhost:8877
+mybatis-plus:
+  mapper-locations: classpath:mapper/*.xml
+logging:
+  level:
+    com.example.demo: debug
+driverUrl: /opt/google/chrome/chromedriver

+ 36 - 50
src/main/resources/application.yml

@@ -3,55 +3,41 @@ server:
     context-path: /
   port: 8111
 
+#  sa-token:
+#  activity-timeout: 18000
+#  token-name: token
+#  token-style: tik
 spring:
-  datasource:
-    url: jdbc:mysql://192.168.1.24:3306/pas?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
-    username: root
-    password: rrzTwWAYX8Gxh5JH
-    driver-class-name: com.mysql.cj.jdbc.Driver
-    type: com.alibaba.druid.pool.DruidDataSource
-    druid:
-      stat-view-servlet:
-        login-username: admin
-        login-password: 123456
-      web-stat-filter:
-        exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
-  quartz:
-    #相关属性配置
-    properties:
-      org:
-        quartz:
-          scheduler:
-            instanceName: DefaultQuartzScheduler
-            instanceId: AUTO
-          jobStore:
-            class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
-            driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
-            tablePrefix: QRTZ_
-            isClustered: false
-            clusterCheckinInterval: 10000
-            useProperties: false
-          threadPool:
-            class: org.quartz.simpl.SimpleThreadPool
-            threadCount: 10
-            threadPriority: 5
-            threadsInheritContextClassLoaderOfInitializingThread: true
-          dataSource:
-            default:
-              URL: jdbc:mysql://192.168.1.24:3306/pas?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
-              user: root
-              password: rrzTwWAYX8Gxh5JH
-              driver: com.mysql.jdbc.Driver
-
-    #数据库方式
-    job-store-type: jdbc
-    #初始化表结构
-    jdbc:
-      initialize-schema: never
-PCSUrl: http://localhost:8871
-PASUrl: http://localhost:8877
+  thymeleaf:
+    cache: false
+    mode: HTML5
+  aop:
+    auto: true
+    proxy-target-class: true
+  application:
+    name: pas
+  servlet:
+    multipart:
+      max-file-size: 1000MB
+      max-request-size: 1000MB
+  profiles:
+    active: dev
+  jackson:
+    default-property-inclusion: non_null
+    serialization:
+      INDENT_OUTPUT: true
+    date-format: yyyy-MM-dd HH:mm:ss
+    time-zone: Asia/Shanghai
+#mybatis
 mybatis-plus:
-  mapper-locations: classpath:mapper/*.xml
-logging:
-  level:
-    com.example.demo: debug
+  typeAliasesPackage: cn.cslg.pas.domain
+  global-config:
+    db-config:
+      id-type: AUTO
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+  configuration:
+    #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+  mapper-locations: classpath:mapper/*.xml

+ 23 - 0
src/main/resources/mapper/WebLoginConfigMapper.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.example.demo.mapper.WebLoginConfigMapper">
+    <select id="getPageList" parameterType="com.example.demo.model.vo.QueryConfigVO"
+            resultType="com.example.demo.model.vo.ConfigVO">
+        select web_name as webName,web_address as webAddress ,login_account as loginAccount ,login_password as
+        loginPassword,b.id as id
+        ,a.id as webId
+        from pas.web_config a
+        left join pas.web_login_config b
+        on a.id=b.web_id
+        <where>
+            b.tenant_id=#{params.tenantId}
+            <if test="params.webId !=null">
+                and a.id =#{params.webId}
+            </if>
+            <if test="params.loginAccount!=null and params.loginAccount!='' ">
+                and b.login_account like concat('%',#{params.loginAccount}, '%')
+            </if>
+        </where>
+    </select>
+</mapper>