diff --git a/dq-financial-crms/src/main/resources/bootstrap.properties b/dq-financial-crms/src/main/resources/bootstrap.properties index 9bb75d5f..6cccc927 100644 --- a/dq-financial-crms/src/main/resources/bootstrap.properties +++ b/dq-financial-crms/src/main/resources/bootstrap.properties @@ -1,59 +1,59 @@ # 开发和测试环境(dev) #服务名称 -#spring.application.name=dq-financial-crms -##配置中心地址 -#spring.cloud.nacos.config.server-addr=192.168.31.142:8848 -#spring.cloud.nacos.config.namespace=1f69d47e-0aeb-4a1e-8ab4-0e84dfb86354 -##spring.cloud.nacos.config.group=prod -# -#spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml -#spring.cloud.nacos.config.ext-config[0].group=dev -#spring.cloud.nacos.config.ext-config[0].refresh=true -# -#spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml -#spring.cloud.nacos.config.ext-config[1].group=dev -#spring.cloud.nacos.config.ext-config[1].refresh=true -# -#spring.cloud.nacos.config.ext-config[2].data-id=other.yml -#spring.cloud.nacos.config.ext-config[2].group=dev -#spring.cloud.nacos.config.ext-config[2].refresh=true -# -#spring.redis.host=127.0.0.1 -#spring.redis.port=6379 -#spring.redis.password=123456 -#spring.redis.database=0 -#spring.redis.timeout=30000 -#spring.redis.jedis.pool.max-active=8 -#spring.redis.jedis.pool.max-wait=-1 -#spring.redis.jedis.pool.max-idle=8 -#spring.redis.jedis.pool.min-idle=0 - -# 正式环境(prod) -#服务名称 spring.application.name=dq-financial-crms #配置中心地址 -spring.cloud.nacos.config.server-addr=120.78.127.12:8848 -spring.cloud.nacos.config.namespace=25ce05e2-a0eb-4842-92e4-d8b550a489dd +spring.cloud.nacos.config.server-addr=192.168.31.142:8848 +spring.cloud.nacos.config.namespace=1f69d47e-0aeb-4a1e-8ab4-0e84dfb86354 #spring.cloud.nacos.config.group=prod spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml -spring.cloud.nacos.config.ext-config[0].group=prod +spring.cloud.nacos.config.ext-config[0].group=dev spring.cloud.nacos.config.ext-config[0].refresh=true spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml -spring.cloud.nacos.config.ext-config[1].group=prod +spring.cloud.nacos.config.ext-config[1].group=dev spring.cloud.nacos.config.ext-config[1].refresh=true spring.cloud.nacos.config.ext-config[2].data-id=other.yml -spring.cloud.nacos.config.ext-config[2].group=prod +spring.cloud.nacos.config.ext-config[2].group=dev spring.cloud.nacos.config.ext-config[2].refresh=true spring.redis.host=127.0.0.1 spring.redis.port=6379 -spring.redis.password=dq123456 +spring.redis.password=123456 spring.redis.database=0 spring.redis.timeout=30000 spring.redis.jedis.pool.max-active=8 spring.redis.jedis.pool.max-wait=-1 spring.redis.jedis.pool.max-idle=8 -spring.redis.jedis.pool.min-idle=0 \ No newline at end of file +spring.redis.jedis.pool.min-idle=0 + +# 正式环境(prod) +#服务名称 +#spring.application.name=dq-financial-crms +##配置中心地址 +#spring.cloud.nacos.config.server-addr=120.78.127.12:8848 +#spring.cloud.nacos.config.namespace=25ce05e2-a0eb-4842-92e4-d8b550a489dd +##spring.cloud.nacos.config.group=prod +# +#spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml +#spring.cloud.nacos.config.ext-config[0].group=prod +#spring.cloud.nacos.config.ext-config[0].refresh=true +# +#spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml +#spring.cloud.nacos.config.ext-config[1].group=prod +#spring.cloud.nacos.config.ext-config[1].refresh=true +# +#spring.cloud.nacos.config.ext-config[2].data-id=other.yml +#spring.cloud.nacos.config.ext-config[2].group=prod +#spring.cloud.nacos.config.ext-config[2].refresh=true +# +#spring.redis.host=127.0.0.1 +#spring.redis.port=6379 +#spring.redis.password=dq123456 +#spring.redis.database=0 +#spring.redis.timeout=30000 +#spring.redis.jedis.pool.max-active=8 +#spring.redis.jedis.pool.max-wait=-1 +#spring.redis.jedis.pool.max-idle=8 +#spring.redis.jedis.pool.min-idle=0 \ No newline at end of file diff --git a/dq-financial-hrms-auth/src/main/resources/bootstrap.properties b/dq-financial-hrms-auth/src/main/resources/bootstrap.properties index 537460dc..5c6e276b 100644 --- a/dq-financial-hrms-auth/src/main/resources/bootstrap.properties +++ b/dq-financial-hrms-auth/src/main/resources/bootstrap.properties @@ -1,58 +1,58 @@ # 开发和测试环境(dev) -#spring.application.name=dq-financial-hrms-auth -# -#spring.cloud.nacos.config.server-addr=192.168.31.142:8848 -#spring.cloud.nacos.config.namespace=7632bdaa-3381-4669-b3f9-2fc73be451e8 -##spring.cloud.nacos.config.group=prod -# -#spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml -#spring.cloud.nacos.config.ext-config[0].group=dev -#spring.cloud.nacos.config.ext-config[0].refresh=true -# -#spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml -#spring.cloud.nacos.config.ext-config[1].group=dev -#spring.cloud.nacos.config.ext-config[1].refresh=true -# -#spring.cloud.nacos.config.ext-config[2].data-id=other.yml -#spring.cloud.nacos.config.ext-config[2].group=dev -#spring.cloud.nacos.config.ext-config[2].refresh=true -# -#spring.redis.host=127.0.0.1 -#spring.redis.port=6379 -#spring.redis.password=123456 -#spring.redis.database=0 -#spring.redis.timeout=30000 -#spring.redis.jedis.pool.max-active=8 -#spring.redis.jedis.pool.max-wait=-1 -#spring.redis.jedis.pool.max-idle=8 -#spring.redis.jedis.pool.min-idle=0 - - -#正式环境(prod) spring.application.name=dq-financial-hrms-auth -spring.cloud.nacos.config.server-addr=120.78.127.12:8848 -spring.cloud.nacos.config.namespace=b590c830-7ada-44b7-968f-e8d0c81990c4 +spring.cloud.nacos.config.server-addr=192.168.31.142:8848 +spring.cloud.nacos.config.namespace=7632bdaa-3381-4669-b3f9-2fc73be451e8 #spring.cloud.nacos.config.group=prod spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml -spring.cloud.nacos.config.ext-config[0].group=prod +spring.cloud.nacos.config.ext-config[0].group=dev spring.cloud.nacos.config.ext-config[0].refresh=true spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml -spring.cloud.nacos.config.ext-config[1].group=prod +spring.cloud.nacos.config.ext-config[1].group=dev spring.cloud.nacos.config.ext-config[1].refresh=true spring.cloud.nacos.config.ext-config[2].data-id=other.yml -spring.cloud.nacos.config.ext-config[2].group=prod +spring.cloud.nacos.config.ext-config[2].group=dev spring.cloud.nacos.config.ext-config[2].refresh=true spring.redis.host=127.0.0.1 spring.redis.port=6379 -spring.redis.password=dq123456 +spring.redis.password=123456 spring.redis.database=0 spring.redis.timeout=30000 spring.redis.jedis.pool.max-active=8 spring.redis.jedis.pool.max-wait=-1 spring.redis.jedis.pool.max-idle=8 -spring.redis.jedis.pool.min-idle=0 \ No newline at end of file +spring.redis.jedis.pool.min-idle=0 + + +#正式环境(prod) +#spring.application.name=dq-financial-hrms-auth +# +#spring.cloud.nacos.config.server-addr=120.78.127.12:8848 +#spring.cloud.nacos.config.namespace=b590c830-7ada-44b7-968f-e8d0c81990c4 +##spring.cloud.nacos.config.group=prod +# +#spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml +#spring.cloud.nacos.config.ext-config[0].group=prod +#spring.cloud.nacos.config.ext-config[0].refresh=true +# +#spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml +#spring.cloud.nacos.config.ext-config[1].group=prod +#spring.cloud.nacos.config.ext-config[1].refresh=true +# +#spring.cloud.nacos.config.ext-config[2].data-id=other.yml +#spring.cloud.nacos.config.ext-config[2].group=prod +#spring.cloud.nacos.config.ext-config[2].refresh=true +# +#spring.redis.host=127.0.0.1 +#spring.redis.port=6379 +#spring.redis.password=dq123456 +#spring.redis.database=0 +#spring.redis.timeout=30000 +#spring.redis.jedis.pool.max-active=8 +#spring.redis.jedis.pool.max-wait=-1 +#spring.redis.jedis.pool.max-idle=8 +#spring.redis.jedis.pool.min-idle=0 \ No newline at end of file diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java index 38c1367d..f59ff69d 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java @@ -89,7 +89,8 @@ public class EmployeeController implements EmployeeControllerApi { */ @PostMapping("/save") //@RequiresPermissions("hrms:employee:save") - public ResponseResult save(@RequestBody EmployeeInfoVO employeeInfoVO) { + public ResponseResult save(@RequestBody @Valid EmployeeInfoVO employeeInfoVO) { + Boolean result = employeeService.save(employeeInfoVO); return result ? ResponseResult.SUCCESS() : new ResponseResult(CommonCode.SAVE_FAIL); diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java index d8ecfa27..84ab5a47 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java @@ -81,4 +81,9 @@ public interface EmployeeDao extends BaseMapper { Boolean updateEmployeeAndUser(EmployeeEntity employeeEntity); + Integer employeeNameCount(String name); + + Integer userAccountCount(String account); + + Integer employeeJobNumberCount(String jobNumber); } diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java index 003871a2..e6430403 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java @@ -273,6 +273,28 @@ public class EmployeeServiceImpl extends ServiceImpl 0){ + ExceptionCast.cast(HrmsCode.EMPLOYEE_JOB_NUMBER_EXIST); + } + Integer accountCount = this.getBaseMapper().userAccountCount(employeeInfoVO.getAccount()); + if (accountCount > 0){ + ExceptionCast.cast(HrmsCode.EMPLOYEE_USER_ACCOUNT_EXIST); + } + String name = employeeInfoVO.getName(); + for (int i = 0;i < PromptSuccess.LETTERS.length;i++){ + Integer nameCount = this.getBaseMapper().employeeNameCount(name); + if (nameCount > 0){ + name = employeeInfoVO.getName() + PromptSuccess.LETTERS[i]; + }else { + employeeInfoVO.setName(name); + break; + } + if (i == PromptSuccess.LETTERS.length - 1){ + ExceptionCast.cast(HrmsCode.EMPLOYEE_REPETITION_EXCEED); + } + } String account = employeeInfoVO.getAccount(); EmployeeEntity employee = new EmployeeEntity(); BeanUtils.copyProperties(employeeInfoVO, employee); @@ -303,10 +325,41 @@ public class EmployeeServiceImpl extends ServiceImpl 0){ + ExceptionCast.cast(HrmsCode.EMPLOYEE_JOB_NUMBER_EXIST); + } + Integer accountCount = this.getBaseMapper().userAccountCount(employeeInfoVO.getAccount()); + if (accountCount > 0){ + ExceptionCast.cast(HrmsCode.EMPLOYEE_USER_ACCOUNT_EXIST); + } + String name = employeeInfoVO.getName(); + for (int i = 0;i < PromptSuccess.LETTERS.length;i++){ + Integer nameCount = this.getBaseMapper().employeeNameCount(name); + if (nameCount > 0){ + name = employeeInfoVO.getName() + PromptSuccess.LETTERS[i]; + }else { + employeeInfoVO.setName(name); + break; + } + if (i == PromptSuccess.LETTERS.length - 1){ + ExceptionCast.cast(HrmsCode.EMPLOYEE_REPETITION_EXCEED); + } + } + // 员工对应的用户信息 UserEntity user = new UserEntity(); user.setAccount(employeeInfoVO.getAccount()); user.setCreateTime(new Date()); user.setMotifyTime(new Date()); + user.setPhoneAccount(employeeInfoVO.getPhone()); Boolean result1 = this.getBaseMapper().insertUser(user); EmployeeEntity employee = new EmployeeEntity(); if (result1) { @@ -382,15 +435,38 @@ public class EmployeeServiceImpl extends ServiceImpl 0){ + ExceptionCast.cast(HrmsCode.EMPLOYEE_JOB_NUMBER_EXIST); + } + Integer accountCount = this.getBaseMapper().userAccountCount(employeeExcelImport.getAccount()); + if (accountCount > 0){ + ExceptionCast.cast(HrmsCode.EMPLOYEE_USER_ACCOUNT_EXIST); + } + String name = employeeExcelImport.getName(); + for (int i = 0;i < PromptSuccess.LETTERS.length;i++){ + Integer nameCount = this.getBaseMapper().employeeNameCount(name); + if (nameCount > 0){ + name = employeeExcelImport.getName() + PromptSuccess.LETTERS[i]; + }else { + employeeExcelImport.setName(name); + break; + } + if (i == PromptSuccess.LETTERS.length - 1){ + ExceptionCast.cast(HrmsCode.EMPLOYEE_REPETITION_EXCEED); + } } user.setAccount(employeeExcelImport.getAccount()); user.setCreateTime(new Date()); @@ -400,6 +476,8 @@ public class EmployeeServiceImpl extends ServiceImpl - INSERT INTO hrms_user (account,create_time,motify_time) VALUES (#{account},#{createTime},#{motifyTime}) + INSERT INTO hrms_user (account,phone_account,create_time,motify_time) VALUES (#{account},#{phoneAccount},#{createTime},#{motifyTime}) + SELECT COUNT(e.id) + FROM hrms_employee e + LEFT JOIN hrms_user u + ON e.user_id = u.id + WHERE u.del_or_not = 0 + AND e.name = #{name} + + + + + + \ No newline at end of file diff --git a/dq-framework-common/src/main/java/com/daqing/framework/model/response/PromptSuccess.java b/dq-framework-common/src/main/java/com/daqing/framework/model/response/PromptSuccess.java index 9f0e3daa..11be7832 100644 --- a/dq-framework-common/src/main/java/com/daqing/framework/model/response/PromptSuccess.java +++ b/dq-framework-common/src/main/java/com/daqing/framework/model/response/PromptSuccess.java @@ -14,23 +14,25 @@ public class PromptSuccess { public static final String NOT_BEING = "该员工已不存在"; - public static final Integer STOP_STATUS = 1; + public static final Integer STOP_STATUS = 1; // 已禁用 - public static final Integer START_STATUS = 0; + public static final Integer START_STATUS = 0; // 开启 - public static final Integer UPCOMING_STOP_STATUS = 2; + public static final Integer UPCOMING_STOP_STATUS = 2; // 即将禁用 - public static final String RESET_PASSWORD = "666666"; + public static final String RESET_PASSWORD = "Aa1234"; // 初始密码 - public static final String MATCHES_STRING = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d]{6,}$"; + public static final String MATCHES_STRING = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d]{6,}$"; // 密码正则(必须包含一个大写一个小写加数字,且不小于六位) - public static final Long OVERDUE_TIME = 70L; // 过期时间,单位为秒 + public static final Long OVERDUE_TIME = 70L; // 验证码过期时间,单位为秒 public static final String QR_CODE_FAIL = "1"; // 微信没绑定 public static final String QR_CODE_BINDING_SUCCESS = "0"; // 微信已绑定 - public static final String UPLOAD_FILE_PATH = "//usr//local//nginx//html//admin//headImg//"; + public static final String UPLOAD_FILE_PATH = "//usr//local//nginx//html//admin//headImg//"; // linux图片存放路径 - public static final String IMAGE_URL_PATH = "http://www.huorantech.cn/headImg/"; + public static final String IMAGE_URL_PATH = "http://www.huorantech.cn/headImg/"; // 数据库/预加载图片路径 + + public static final String[] LETTERS = {"A","B","C","D","E"}; // 员工姓名重复时自动加的字母,可再添加 } diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.java index 44d514e6..c32b47c0 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.java @@ -25,7 +25,7 @@ public enum HrmsCode implements ResultCode { EMPLOYEE_IS_NULL(false,44001,"当前员工已不存在!"), EMPLOYEE_NAME_IS_NULL(false,44002,"请完善员工姓名!"), EMPLOYEE_ACCOUNT_IS_NULL(false,44003,"请完善员工账号!"), - EMPLOYEE_JOBNUMBER_IS_NULL(false,44004,"请完善员工工号!"), + EMPLOYEE_JOB_NUMBER_IS_NULL(false,44004,"请完善员工工号!"), EMPLOYEE_DEPARTMENT_IS_NULL(false,44005,"请完善员工部门!"), EMPLOYEE_POSITION_IS_NULL(false,44006,"请完善员工职位!"), EMPLOYEE_ROLE_IS_NULL(false,44007,"请完善员工角色!"), @@ -35,6 +35,9 @@ public enum HrmsCode implements ResultCode { EMPLOYEE_DISABLE_TIME_ERROR(false,44011,"禁用失败,当前禁用开始时间可能大于或等于结束时间!"), EMPLOYEE_USER_IS_NULL(false,44012,"当前员工的用户信息已不存在!"), EMPLOYEE_INFO_NOT_NULL(false,44013,"姓名、账号、手机号、公司邮箱、工号不能为空,请正确填写!"), + EMPLOYEE_JOB_NUMBER_EXIST(false,44014,"员工工号已存在,请重新输入!"), + EMPLOYEE_USER_ACCOUNT_EXIST(false,44015,"员工账号已存在,请重新输入!"), + EMPLOYEE_REPETITION_EXCEED(false,44016,"员工姓名重复过多,请重新输入!"), POSITION_NOT_NULL(false,55001,"职位不能为空!"), diff --git a/dq-govern-gateway/src/main/resources/bootstrap.properties b/dq-govern-gateway/src/main/resources/bootstrap.properties index 1df5635b..3e8a92f5 100644 --- a/dq-govern-gateway/src/main/resources/bootstrap.properties +++ b/dq-govern-gateway/src/main/resources/bootstrap.properties @@ -1,40 +1,40 @@ +服务名称 +spring.application.name=dq-govern-gateway +#配置中心地址 +spring.cloud.nacos.config.server-addr=192.168.31.142:8848 +spring.cloud.nacos.config.namespace=772e2607-b929-4246-9671-ee5a36d74d25 + +spring.cloud.nacos.config.ext-config[0].data-id=dq-govern-gateway.yml +spring.cloud.nacos.config.ext-config[0].group=dev +spring.cloud.nacos.config.ext-config[0].refresh=true + +spring.redis.host=127.0.0.1 +spring.redis.port=6379 +spring.redis.password=123456 +spring.redis.database=0 +spring.redis.timeout=30000 +spring.redis.jedis.pool.max-active=8 +spring.redis.jedis.pool.max-wait=-1 +spring.redis.jedis.pool.max-idle=8 +spring.redis.jedis.pool.min-idle=0 + +# 正式环境(prod) #服务名称 #spring.application.name=dq-govern-gateway ##配置中心地址 -#spring.cloud.nacos.config.server-addr=192.168.31.142:8848 -#spring.cloud.nacos.config.namespace=772e2607-b929-4246-9671-ee5a36d74d25 +#spring.cloud.nacos.config.server-addr=120.78.127.12:8848 +#spring.cloud.nacos.config.namespace=68738215-903f-426c-8658-2dcd99b20009 # #spring.cloud.nacos.config.ext-config[0].data-id=dq-govern-gateway.yml -#spring.cloud.nacos.config.ext-config[0].group=dev +#spring.cloud.nacos.config.ext-config[0].group=prod #spring.cloud.nacos.config.ext-config[0].refresh=true # #spring.redis.host=127.0.0.1 #spring.redis.port=6379 -#spring.redis.password=123456 +#spring.redis.password=dq123456 #spring.redis.database=0 #spring.redis.timeout=30000 #spring.redis.jedis.pool.max-active=8 #spring.redis.jedis.pool.max-wait=-1 #spring.redis.jedis.pool.max-idle=8 -#spring.redis.jedis.pool.min-idle=0 - -# 正式环境(prod) -#服务名称 -spring.application.name=dq-govern-gateway -#配置中心地址 -spring.cloud.nacos.config.server-addr=120.78.127.12:8848 -spring.cloud.nacos.config.namespace=68738215-903f-426c-8658-2dcd99b20009 - -spring.cloud.nacos.config.ext-config[0].data-id=dq-govern-gateway.yml -spring.cloud.nacos.config.ext-config[0].group=prod -spring.cloud.nacos.config.ext-config[0].refresh=true - -spring.redis.host=127.0.0.1 -spring.redis.port=6379 -spring.redis.password=dq123456 -spring.redis.database=0 -spring.redis.timeout=30000 -spring.redis.jedis.pool.max-active=8 -spring.redis.jedis.pool.max-wait=-1 -spring.redis.jedis.pool.max-idle=8 -spring.redis.jedis.pool.min-idle=0 \ No newline at end of file +#spring.redis.jedis.pool.min-idle=0 \ No newline at end of file diff --git a/dq-govern-gateway/src/main/resources/jwt.properties b/dq-govern-gateway/src/main/resources/jwt.properties index 1f2c276a..c4f46e52 100644 --- a/dq-govern-gateway/src/main/resources/jwt.properties +++ b/dq-govern-gateway/src/main/resources/jwt.properties @@ -9,7 +9,6 @@ jwt.ignoreUrlList=/apiHrmsAuth/hrms/auth/userlogin/getBackPwd,\ /api-crms/crms/customer/excelImport,\ /api-hrms/hrms/employee/excelExport,\ /api-hrms/hrms/employee/excelTemplate,\ - /api-hrms/hrms/employee/excelImport,\ /apiHrmsAuth/hrms/auth/userlogin/bindPhoneAndOpenId,\ /apiHrmsAuth/hrms/auth/userlogin/sendCode,\ /apiHrmsAuth/hrms/auth/userlogin/isPhoneExist