Merge remote-tracking branch 'origin/master'

master
river 4 years ago
commit cc9c3d5b05
  1. 28
      dq-financial-api/dq-financial-api.iml
  2. 4
      dq-financial-api/pom.xml
  3. 6
      dq-financial-api/src/main/java/com/daqing/financial/config/SwaggerConfig.java
  4. 10
      dq-financial-api/src/main/java/com/daqing/financial/crms/CustomerControllerApi.java
  5. 18
      dq-financial-api/src/main/java/com/daqing/financial/hrms/DeptControllerApi.java
  6. 47
      dq-financial-crms-auth/src/main/resources/logback-spring.xml
  7. 47
      dq-financial-crms/src/main/resources/logback-spring.xml
  8. 47
      dq-financial-guarantee/src/main/resources/logback-spring.xml
  9. 47
      dq-financial-hrms-auth/src/main/resources/logback-spring.xml
  10. 6
      dq-financial-hrms/pom.xml
  11. 2
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/DqFinancialHrmsApplication.java
  12. 43
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/DeptController.java
  13. 3
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/DeptService.java
  14. 64
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/DeptServiceImpl.java
  15. 47
      dq-financial-hrms/src/main/resources/logback-spring.xml
  16. 47
      dq-financial-workflow/src/main/resources/logback-spring.xml
  17. 13
      dq-framework-common/src/main/java/com/daqing/framework/config/MybatisPlusConfig.java
  18. 14
      dq-framework-common/src/main/java/com/daqing/framework/exception/CustomException.java
  19. 6
      dq-framework-common/src/main/java/com/daqing/framework/exception/ExceptionCast.java
  20. 19
      dq-framework-common/src/main/java/com/daqing/framework/exception/ExceptionCatch.java
  21. 11
      dq-framework-common/src/main/java/com/daqing/framework/model/Constant.java
  22. 19
      dq-framework-common/src/main/java/com/daqing/framework/model/response/CommonCode.java
  23. 12
      dq-framework-common/src/main/java/com/daqing/framework/model/response/ResponseResult.java
  24. 37
      dq-framework-common/src/main/java/com/daqing/framework/model/response/ResultCode.java
  25. 4
      dq-framework-common/src/main/java/com/daqing/framework/xss/SQLFilter.java
  26. 3
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/CompanyCustomerEntity.java
  27. 3
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/CustomerEntity.java
  28. 3
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/PersonalCustomerEntity.java
  29. 5
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/DeptEntity.java
  30. 3
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeeDeptEntity.java
  31. 3
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeeEntity.java
  32. 3
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeePositionEntity.java
  33. 3
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeeRoleEntity.java
  34. 3
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/PermissionEntity.java
  35. 3
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/PositionEntity.java
  36. 3
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/RoleEntity.java
  37. 3
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/RolePermissionEntity.java
  38. 3
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/UserEntity.java
  39. 32
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/DeptAddRequest.java
  40. 51
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/DeptCode.java
  41. 17
      dq-framework-utils/src/main/java/com/daqing/framework/utils/SnowflakeIdUtils.java

@ -128,21 +128,23 @@
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.20" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.20" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.5" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-core:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.9.2" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.7.0" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.13" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.13" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.5" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.7.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-core:2.7.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.7.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.7.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.7.0" level="project" />
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.11" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.2.0.Final" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:2.9.2" level="project" />
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.1.0.Final" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:2.7.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.1.8.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.1.8.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.1.8.RELEASE" level="project" />

@ -33,12 +33,12 @@
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

@ -11,6 +11,12 @@ import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* @Author: gongsj.
* @Description: swagger2配置类
* @Date:Created in 2020/09/09 14:33.
* @Modified By:
*/
@Configuration
@EnableSwagger2
//@Profile({"dev","test"})

@ -6,13 +6,19 @@ import io.swagger.annotations.ApiOperation;
import java.util.Map;
@Api(value = "客户相关操作", tags = "提供用户测评信息增删改查等相关方法")
/**
* @Author: gongsj.
* @Description: 客户资源管理controllerApi定义
* @Date:Created in 2020/09/09 14:33.
* @Modified By:
*/
@Api(value = "客户资源管理", tags = "提供客户信息增删改查等相关方法")
public interface CustomerControllerApi {
/**
* 列表展示
*/
@ApiOperation(value = "列表展示", notes = "列表展示")
@ApiOperation(value = "客户信息列表展示", notes = "客户信息列表展示")
ResponseResult list(Map<String, Object> params);
}

@ -1,4 +1,22 @@
package com.daqing.financial.hrms;
import com.daqing.framework.domain.hrms.request.DeptAddRequest;
import com.daqing.framework.model.response.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* @Author: gongsj.
* @Description: 部门管理controllerApi定义
* @Date:Created in 2020/09/07 11:33.
* @Modified By:
*/
@Api(value = "部门管理相关操作", tags = "提供部门信息增删改查等相关方法")
public interface DeptControllerApi {
/**
* 新增一条部门信息
*/
@ApiOperation(value = "新增一条部门信息", notes = "新增一条部门信息")
ResponseResult save(DeptAddRequest deptAddRequest);
}

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--定义日志文件的存储地址,使用绝对路径-->
<property name="LOG_HOME" value="d:/logs/daqing/crms_auth"/>
<!-- Console 输出设置 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<fileNamePattern>${LOG_HOME}/crms_auth.%d{yyyy-MM-dd}.log</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- 异步输出 -->
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>512</queueSize>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="FILE"/>
</appender>
<logger name="org.apache.ibatis.cache.decorators.LoggingCache" level="DEBUG" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.boot" level="DEBUG"/>
<root level="info">
<!--<appender-ref ref="ASYNC"/>-->
<appender-ref ref="FILE"/>
<appender-ref ref="CONSOLE"/>
</root>
</configuration>

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--定义日志文件的存储地址,使用绝对路径-->
<property name="LOG_HOME" value="d:/logs/daqing/crms"/>
<!-- Console 输出设置 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<fileNamePattern>${LOG_HOME}/crms.%d{yyyy-MM-dd}.log</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- 异步输出 -->
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>512</queueSize>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="FILE"/>
</appender>
<logger name="org.apache.ibatis.cache.decorators.LoggingCache" level="DEBUG" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.boot" level="DEBUG"/>
<root level="info">
<!--<appender-ref ref="ASYNC"/>-->
<appender-ref ref="FILE"/>
<appender-ref ref="CONSOLE"/>
</root>
</configuration>

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--定义日志文件的存储地址,使用绝对路径-->
<property name="LOG_HOME" value="d:/logs/daqing/guarantee"/>
<!-- Console 输出设置 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<fileNamePattern>${LOG_HOME}/guarantee.%d{yyyy-MM-dd}.log</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- 异步输出 -->
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>512</queueSize>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="FILE"/>
</appender>
<logger name="org.apache.ibatis.cache.decorators.LoggingCache" level="DEBUG" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.boot" level="DEBUG"/>
<root level="info">
<!--<appender-ref ref="ASYNC"/>-->
<appender-ref ref="FILE"/>
<appender-ref ref="CONSOLE"/>
</root>
</configuration>

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--定义日志文件的存储地址,使用绝对路径-->
<property name="LOG_HOME" value="d:/logs/daqing/hrms_auth"/>
<!-- Console 输出设置 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<fileNamePattern>${LOG_HOME}/hrms_auth.%d{yyyy-MM-dd}.log</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- 异步输出 -->
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>512</queueSize>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="FILE"/>
</appender>
<logger name="org.apache.ibatis.cache.decorators.LoggingCache" level="DEBUG" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.boot" level="DEBUG"/>
<root level="info">
<!--<appender-ref ref="ASYNC"/>-->
<appender-ref ref="FILE"/>
<appender-ref ref="CONSOLE"/>
</root>
</configuration>

@ -35,6 +35,12 @@
<artifactId>dq-framework-utils</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.daqing.financial</groupId>
<artifactId>dq-financial-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>

@ -4,10 +4,12 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
@EnableFeignClients(basePackages = "com.daqing.financial.hrms.feign")
@EnableDiscoveryClient
@SpringBootApplication
@ComponentScan(basePackages = "com.daqing.financial")
public class DqFinancialHrmsApplication {
public static void main(String[] args) {

@ -1,17 +1,18 @@
package com.daqing.financial.hrms.controller;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import com.daqing.financial.hrms.DeptControllerApi;
import com.daqing.financial.hrms.feign.CrmsFeignService;
import com.daqing.financial.hrms.service.DeptService;
import com.daqing.framework.domain.hrms.DeptEntity;
import com.daqing.framework.domain.hrms.request.DeptAddRequest;
import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.daqing.framework.domain.hrms.DeptEntity;
import com.daqing.financial.hrms.service.DeptService;
import com.daqing.framework.utils.PageUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* 记录部门信息
@ -22,7 +23,7 @@ import com.daqing.framework.utils.PageUtils;
*/
@RestController
@RequestMapping("hrms/dept")
public class DeptController {
public class DeptController implements DeptControllerApi {
@Autowired
private DeptService deptService;
@ -30,6 +31,20 @@ public class DeptController {
@Autowired
private CrmsFeignService crmsFeignService;
/**
* 保存一条部门信息
*
* @param deptAddRequest 新增部门请求体对象
* @return 统一响应对象
*/
@Override
@PostMapping("/save")
public ResponseResult save(@RequestBody DeptAddRequest deptAddRequest) {
boolean result = deptService.saveDept(deptAddRequest);
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
}
/**
* 测试远程调用
*/
@ -62,17 +77,6 @@ public class DeptController {
return ResponseResult.SUCCESS();
}
/**
* 保存
*/
@PostMapping("/save")
//@RequiresPermissions("hrms:dept:save")
public ResponseResult save(@RequestBody DeptEntity dept){
deptService.save(dept);
return ResponseResult.SUCCESS();
}
/**
* 修改
*/
@ -94,5 +98,4 @@ public class DeptController {
return ResponseResult.SUCCESS();
}
}

@ -1,6 +1,7 @@
package com.daqing.financial.hrms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.daqing.framework.domain.hrms.request.DeptAddRequest;
import com.daqing.framework.utils.PageUtils;
import com.daqing.framework.domain.hrms.DeptEntity;
@ -16,5 +17,7 @@ import java.util.Map;
public interface DeptService extends IService<DeptEntity> {
PageUtils queryPage(Map<String, Object> params);
boolean saveDept(DeptAddRequest deptAddRequest);
}

@ -6,10 +6,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.daqing.financial.hrms.dao.DeptDao;
import com.daqing.financial.hrms.service.DeptService;
import com.daqing.framework.domain.hrms.DeptEntity;
import com.daqing.framework.domain.hrms.request.DeptAddRequest;
import com.daqing.framework.domain.hrms.response.DeptCode;
import com.daqing.framework.exception.ExceptionCast;
import com.daqing.framework.utils.PageUtils;
import com.daqing.framework.utils.Query;
import com.daqing.framework.utils.SnowflakeIdUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Map;
@ -26,4 +33,61 @@ public class DeptServiceImpl extends ServiceImpl<DeptDao, DeptEntity> implements
return new PageUtils(page);
}
/**
* 保存一条部门信息
*
* @param deptAddRequest 新增部门请求体对象
* @return 保存成功或失败
*/
@Override
public boolean saveDept(DeptAddRequest deptAddRequest) {
//1、校验部门名称是否合法(为空与是否已存在)
String deptName = deptAddRequest.getName();
if (StringUtils.isEmpty(deptName)) {
//抛出部门名称非法异常
ExceptionCast.cast(DeptCode.DEPT_NAME_ILLEGAL);
}
//根据name查询数据条数,如果条数大于0,说明数据库中已经存在此部门名称
int countByName = this.count(new QueryWrapper<DeptEntity>().eq("name", deptName));
if (countByName > 0) {
//抛出部门名称非法异常
ExceptionCast.cast(DeptCode.DEPT_NAME_ILLEGAL);
}
//实体类
DeptEntity deptEntity = new DeptEntity();
//设置id
deptEntity.setId(SnowflakeIdUtils.getRandomid());
//属性拷贝,将上级部门id(如果有)、部门名称、排序(如果有)设置到实体类
BeanUtils.copyProperties(deptAddRequest, deptEntity);
//2、判断部门上级id是否为空,为空则此部门是一级部门,否则查询并计算部门层级,并判断部门层级是否大于5级或小于1级
//得到上级部门id
Long parentId = deptAddRequest.getParentId();
if (parentId == null) {
//说明是添加一级部门
//设置层级为1
deptEntity.setLevel(1);
//设置上级部门id为0
deptEntity.setParentId(0L);
} else {
//添加非一级部门
//根据上级部门id查询上级部门信息
DeptEntity byId = this.getById(parentId);
if (byId == null) {
//抛出部门id不存在异常
ExceptionCast.cast(DeptCode.DEPT_ID_NOT_EXSIT);
}
//根据上级部门层级计算当前部门层级
int level = byId.getLevel() + 1;
if (level > 5 || level < 1) {
ExceptionCast.cast(DeptCode.DEPT_LEVEL_ILLEGAL);
}
deptEntity.setLevel(level);
}
//设置创建时间和修改时间
deptEntity.setCreateTime(new Date());
deptEntity.setMotifyTime(new Date());
//3、保存部门信息到数据库
return this.save(deptEntity);
}
}

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--定义日志文件的存储地址,使用绝对路径-->
<property name="LOG_HOME" value="d:/logs/daqing/hrms"/>
<!-- Console 输出设置 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<fileNamePattern>${LOG_HOME}/hrms.%d{yyyy-MM-dd}.log</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- 异步输出 -->
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>512</queueSize>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="FILE"/>
</appender>
<logger name="org.apache.ibatis.cache.decorators.LoggingCache" level="DEBUG" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.boot" level="DEBUG"/>
<root level="info">
<!--<appender-ref ref="ASYNC"/>-->
<appender-ref ref="FILE"/>
<appender-ref ref="CONSOLE"/>
</root>
</configuration>

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--定义日志文件的存储地址,使用绝对路径-->
<property name="LOG_HOME" value="d:/logs/daqing/workflow"/>
<!-- Console 输出设置 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<fileNamePattern>${LOG_HOME}/workflow.%d{yyyy-MM-dd}.log</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- 异步输出 -->
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>512</queueSize>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="FILE"/>
</appender>
<logger name="org.apache.ibatis.cache.decorators.LoggingCache" level="DEBUG" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.boot" level="DEBUG"/>
<root level="info">
<!--<appender-ref ref="ASYNC"/>-->
<appender-ref ref="FILE"/>
<appender-ref ref="CONSOLE"/>
</root>
</configuration>

@ -4,15 +4,16 @@ import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MybatisPlusConfig {
/**
* mybatis-plus分页插件
* @Author: gongsj.
* @Description: 分页拦截器注入到spring中
* @Date:Created in 2020/09/09 11:33.
* @Modified By:
*/
@Configuration
public class MybatisPlusConfig {
@Bean
public PaginationInterceptor paginationInterceptor(){
PaginationInterceptor page = new PaginationInterceptor();
page.setDialectType("mysql");
return page;
return new PaginationInterceptor();
}
}

@ -1,6 +1,6 @@
package com.daqing.framework.exception;
import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.model.response.ResultCode;
/**
* @Author: gongsj.
@ -9,15 +9,15 @@ import com.daqing.framework.model.response.ResponseResult;
* @Modified By:
*/
public class CustomException extends RuntimeException {
private ResponseResult responseResult;
private ResultCode resultCode;
public CustomException(ResponseResult responseResult) {
public CustomException(ResultCode resultCode) {
//异常信息为错误码+异常信息
super("错误码:" + responseResult.getCode() + "错误信息:" + responseResult.getMessage());
this.responseResult = responseResult;
super("错误码:" + resultCode.code() + "错误信息:" + resultCode.message());
this.resultCode = resultCode;
}
public ResponseResult getResultCode() {
return this.responseResult;
public ResultCode getResultCode() {
return this.resultCode;
}
}

@ -1,6 +1,6 @@
package com.daqing.framework.exception;
import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.model.response.ResultCode;
/**
* @Author: gongsj.
@ -10,7 +10,7 @@ import com.daqing.framework.model.response.ResponseResult;
*/
public class ExceptionCast {
//使用此静态方法抛出自定义异常
public static void cast(ResponseResult responseResult) {
throw new CustomException(responseResult);
public static void cast(ResultCode resultCode) {
throw new CustomException(resultCode);
}
}

@ -2,6 +2,7 @@ package com.daqing.framework.exception;
import com.daqing.framework.model.response.CommonCode;
import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.model.response.ResultCode;
import com.google.common.collect.ImmutableMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -22,13 +23,12 @@ public class ExceptionCatch {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionCatch.class);
//定义Map,配置异常类型所对应的错误代码,使用 ImmutableMap 一旦写入数据,就无法更改,只读并且线程安全
private static ImmutableMap<Class<? extends Throwable>, ResponseResult> EXCEPTIONS;
private static ImmutableMap<Class<? extends Throwable>, ResultCode> EXCEPTIONS;
//定义map的builder对象,去构建ImmutableMap
protected static ImmutableMap.Builder<Class<? extends Throwable>, ResponseResult> builder = ImmutableMap.builder();
protected static ImmutableMap.Builder<Class<? extends Throwable>, ResultCode> builder = ImmutableMap.builder();
@ResponseBody
@ExceptionHandler(Exception.class)
@ResponseBody
public ResponseResult exception(Exception exception) {
exception.printStackTrace();
//记录日志
@ -37,9 +37,9 @@ public class ExceptionCatch {
EXCEPTIONS = builder.build();//EXCEPTION构建成功
}
//从EXCEPTIONS中找到异常类型所对应的错误代码,如果找到了,将错误代码相应给用户,如果找不到则给用户相应99999
ResponseResult responseResult = EXCEPTIONS.get(exception.getClass());
if (responseResult != null) {
return responseResult;
ResultCode resultCode = EXCEPTIONS.get(exception.getClass());
if (resultCode != null) {
return new ResponseResult(resultCode);
}
//返回99999异常
return new ResponseResult(CommonCode.SERVER_ERROR);
@ -47,7 +47,7 @@ public class ExceptionCatch {
static {
//定义异常类型所对应的错误代码
builder.put(HttpMessageNotReadableException.class, new ResponseResult(CommonCode.INVALID_PARAM));
builder.put(HttpMessageNotReadableException.class, CommonCode.INVALID_PARAM);
}
@ExceptionHandler(CustomException.class)//捕获CustomException类型异常
@ -57,6 +57,7 @@ public class ExceptionCatch {
//记录日志
LOGGER.error("catch exception:{}", customException.getMessage());
return customException.getResultCode();
ResultCode resultCode = customException.getResultCode();
return new ResponseResult(resultCode);
}
}

@ -1,11 +1,3 @@
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.daqing.framework.model;
/**
@ -15,8 +7,6 @@ package com.daqing.framework.model;
* @Modified By:
*/
public class Constant {
/** 超级管理员ID */
public static final int SUPER_ADMIN = 1;
/**
* 当前页码
*/
@ -124,5 +114,4 @@ public class Constant {
return value;
}
}
}

@ -2,6 +2,7 @@ package com.daqing.framework.model.response;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
/**
* @Author: gongsj.
@ -9,8 +10,9 @@ import lombok.Getter;
* @Date:Created in 2020/09/07 11:35.
* @Modified By:
*/
@ToString
@AllArgsConstructor
public enum CommonCode {
public enum CommonCode implements ResultCode {
SUCCESS(true, 10000, "操作成功!"),
FAIL(false, 11111, "操作失败!"),
@ -36,4 +38,19 @@ public enum CommonCode {
*/
@Getter
private String message;
@Override
public boolean success() {
return this.success;
}
@Override
public int code() {
return this.code;
}
@Override
public String message() {
return this.message;
}
}

@ -42,10 +42,10 @@ public class ResponseResult<T> {
this.message = message;
}
public ResponseResult(CommonCode commonCode) {
this.success = commonCode.isSuccess();
this.code = commonCode.getCode();
this.message = commonCode.getMessage();
public ResponseResult(ResultCode resultCode) {
this.success = resultCode.success();
this.code = resultCode.code();
this.message = resultCode.message();
}
public static ResponseResult SUCCESS() {
@ -55,8 +55,4 @@ public class ResponseResult<T> {
public static ResponseResult FAIL() {
return new ResponseResult(CommonCode.FAIL);
}
public static ResponseResult FAIL(String message) {
return new ResponseResult(false, 500, message);
}
}

@ -0,0 +1,37 @@
package com.daqing.framework.model.response;
/**
* @Author: gongsj.
* @Description: 系统操作状态集接口
* @Date:Created in 2020/09/09 15:35.
* @Modified By:
* 10000-- 通用错误码
* 22000-- 人资管理系统错误码
* 23000-- 人资管理系统认证系统错误码
* 24000-- 客户管理系统错误码
* 25000-- 客户管理系统认证系统错误码
* 26000-- 工作流程管理系统错误码
* 27000-- 担保业务系统错误码
*/
public interface ResultCode {
/**
* 操作是否成功
*
* @return true为成功false操作失败
*/
boolean success();
/**
* 操作码
*
* @return 操作码
*/
int code();
/**
* 提示信息
*
* @return 提示信息
*/
String message();
}

@ -9,7 +9,7 @@
package com.daqing.framework.xss;
import com.daqing.framework.exception.ExceptionCast;
import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.model.response.CommonCode;
import org.apache.commons.lang.StringUtils;
/**
@ -44,7 +44,7 @@ public class SQLFilter {
for (String keyword : keywords) {
//if (str.indexOf(keyword) != -1)
if (str.contains(keyword)) {
ExceptionCast.cast(ResponseResult.FAIL("包含非法字符"));
ExceptionCast.cast(CommonCode.INVALID_PARAM);
}
}
return str;

@ -1,5 +1,6 @@
package com.daqing.framework.domain.crms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -22,7 +23,7 @@ public class CompanyCustomerEntity implements Serializable {
/**
* 主键
*/
@TableId
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 注册资金

@ -1,5 +1,6 @@
package com.daqing.framework.domain.crms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -22,7 +23,7 @@ public class CustomerEntity implements Serializable {
/**
* 主键
*/
@TableId
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 客户编号

@ -1,5 +1,6 @@
package com.daqing.framework.domain.crms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -22,7 +23,7 @@ public class PersonalCustomerEntity implements Serializable {
/**
* 主键
*/
@TableId
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 客户基本信息表id

@ -1,11 +1,12 @@
package com.daqing.framework.domain.hrms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 记录部门信息
@ -22,7 +23,7 @@ public class DeptEntity implements Serializable {
/**
* 主键
*/
@TableId
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 部门名称

@ -1,5 +1,6 @@
package com.daqing.framework.domain.hrms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -22,7 +23,7 @@ public class EmployeeDeptEntity implements Serializable {
/**
* 主键
*/
@TableId
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 员工id

@ -1,5 +1,6 @@
package com.daqing.framework.domain.hrms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -22,7 +23,7 @@ public class EmployeeEntity implements Serializable {
/**
* 主键
*/
@TableId
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 姓名

@ -1,5 +1,6 @@
package com.daqing.framework.domain.hrms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -22,7 +23,7 @@ public class EmployeePositionEntity implements Serializable {
/**
* 主键
*/
@TableId
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 员工id

@ -1,5 +1,6 @@
package com.daqing.framework.domain.hrms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -22,7 +23,7 @@ public class EmployeeRoleEntity implements Serializable {
/**
* 主键
*/
@TableId
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 用户id

@ -1,5 +1,6 @@
package com.daqing.framework.domain.hrms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -22,7 +23,7 @@ public class PermissionEntity implements Serializable {
/**
* 主键
*/
@TableId
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 权限标识符

@ -1,5 +1,6 @@
package com.daqing.framework.domain.hrms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -22,7 +23,7 @@ public class PositionEntity implements Serializable {
/**
* 主键
*/
@TableId
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 部门id

@ -1,5 +1,6 @@
package com.daqing.framework.domain.hrms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -22,7 +23,7 @@ public class RoleEntity implements Serializable {
/**
* 主键
*/
@TableId
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 角色名称

@ -1,5 +1,6 @@
package com.daqing.framework.domain.hrms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -22,7 +23,7 @@ public class RolePermissionEntity implements Serializable {
/**
* 主键
*/
@TableId
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 角色id

@ -1,5 +1,6 @@
package com.daqing.framework.domain.hrms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -22,7 +23,7 @@ public class UserEntity implements Serializable {
/**
* 主键
*/
@TableId
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 用于登录的账号必填

@ -0,0 +1,32 @@
package com.daqing.framework.domain.hrms.request;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 新增部门请求体对象
*
* @author gongsj
* @email gongsj@gmail.com
* @date 2020-09-07 17:12:14
*/
@Data
public class DeptAddRequest implements Serializable {
/**
* 部门名称
*/
private String name;
/**
* 上级部门id
*/
private Long parentId;
/**
* 排序
*/
private Integer sort;
}

@ -0,0 +1,51 @@
package com.daqing.framework.domain.hrms.response;
import com.daqing.framework.model.response.ResultCode;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
/**
* @Author: gongsj.
* @Description: 部门相关操作状态集
* @Date:Created in 2020/09/09 15:35.
* @Modified By:
*/
@ToString
@AllArgsConstructor
public enum DeptCode implements ResultCode {
DEPT_NAME_ILLEGAL(false, 22001, "部门名称为空或已存在!"),
DEPT_ID_NOT_EXSIT(false, 22002, "部门id不存在!"),
DEPT_LEVEL_ILLEGAL(false, 22003, "部门层级不可超出5级!");
/**
* 操作是否成功
*/
@Getter
private boolean success;
/**
* 状态码
*/
@Getter
private int code;
/**
* 提示信息
*/
@Getter
private String message;
public boolean success() {
return this.success;
}
public int code() {
return this.code;
}
public String message() {
return this.message;
}
}

@ -1,12 +1,10 @@
package com.daqing.framework.utils;
import java.util.HashSet;
import java.util.Set;
/**
* @Author JCccc
* @Description
* @Description 雪花算法生成id工具类
* @Date created in 15:31 2019/6/12
* @Modified By: gongsj. 修改为单例模式 modified in 11:50 2020/09/09
*/
public class SnowflakeIdUtils {
// ==============================Fields===========================================
@ -191,10 +189,11 @@ public class SnowflakeIdUtils {
// }
// System.out.println(set2.size());
//
Set<Long> set = new HashSet<>();
for (int i = 0; i < 1000000; i++) {
set.add(SnowflakeIdUtils.getRandomid());
}
System.out.println(set.size());
// Set<Long> set = new HashSet<>();
// for (int i = 0; i < 1000000; i++) {
// set.add(SnowflakeIdUtils.getRandomid());
// }
// System.out.println(set.size());
System.out.println((SnowflakeIdUtils.getRandomid() + "").length());
}
}
Loading…
Cancel
Save