|
@@ -19,11 +19,11 @@
|
|
|
|
|
|
package com.qunzhixinxi.hnqz.admin.controller;
|
|
package com.qunzhixinxi.hnqz.admin.controller;
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.IdcardUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
-import com.alibaba.csp.sentinel.util.StringUtil;
|
|
|
|
import com.alibaba.nacos.common.utils.Md5Utils;
|
|
import com.alibaba.nacos.common.utils.Md5Utils;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -37,7 +37,6 @@ import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysRole;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysRole;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysUser;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysUser;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysUserRole;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysUserRole;
|
|
-import com.qunzhixinxi.hnqz.admin.api.vo.ErrorInfoVo;
|
|
|
|
import com.qunzhixinxi.hnqz.admin.api.vo.UserVO;
|
|
import com.qunzhixinxi.hnqz.admin.api.vo.UserVO;
|
|
import com.qunzhixinxi.hnqz.admin.config.UpmsConfig;
|
|
import com.qunzhixinxi.hnqz.admin.config.UpmsConfig;
|
|
import com.qunzhixinxi.hnqz.admin.entity.dto.CommonUserDTO;
|
|
import com.qunzhixinxi.hnqz.admin.entity.dto.CommonUserDTO;
|
|
@@ -49,7 +48,6 @@ import com.qunzhixinxi.hnqz.admin.service.SysDeptService;
|
|
import com.qunzhixinxi.hnqz.admin.service.SysUserService;
|
|
import com.qunzhixinxi.hnqz.admin.service.SysUserService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmDaAgentService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmDaAgentService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmDaDrugEntService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmDaDrugEntService;
|
|
-import com.qunzhixinxi.hnqz.admin.util.ValidateUtils;
|
|
|
|
import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
import com.qunzhixinxi.hnqz.common.ding.service.DingService;
|
|
import com.qunzhixinxi.hnqz.common.ding.service.DingService;
|
|
import com.qunzhixinxi.hnqz.common.log.annotation.SysLog;
|
|
import com.qunzhixinxi.hnqz.common.log.annotation.SysLog;
|
|
@@ -58,7 +56,6 @@ import com.qunzhixinxi.hnqz.common.qcc.entity.EmployeeGetListResponse;
|
|
import com.qunzhixinxi.hnqz.common.qcc.entity.PageInfo;
|
|
import com.qunzhixinxi.hnqz.common.qcc.entity.PageInfo;
|
|
import com.qunzhixinxi.hnqz.common.qcc.service.QccService;
|
|
import com.qunzhixinxi.hnqz.common.qcc.service.QccService;
|
|
import com.qunzhixinxi.hnqz.common.security.annotation.Inner;
|
|
import com.qunzhixinxi.hnqz.common.security.annotation.Inner;
|
|
-import com.qunzhixinxi.hnqz.common.security.service.HnqzUser;
|
|
|
|
import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
|
|
import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.enums.TaxHelperCertStatus;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.enums.TaxHelperCertStatus;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.service.TaxHelperService;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.service.TaxHelperService;
|
|
@@ -68,22 +65,13 @@ import io.swagger.annotations.ApiOperation;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
-import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
-import org.apache.poi.ss.usermodel.CellType;
|
|
|
|
-import org.apache.poi.ss.usermodel.Row;
|
|
|
|
-import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
-import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
-import java.io.InputStream;
|
|
|
|
-import java.time.LocalDateTime;
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -303,8 +291,6 @@ public class SysUserController {
|
|
// 姓名去除空格(包括字符之间的所有空格都会去除)
|
|
// 姓名去除空格(包括字符之间的所有空格都会去除)
|
|
userDto.setRealname(StrUtil.cleanBlank(userDto.getRealname()));
|
|
userDto.setRealname(StrUtil.cleanBlank(userDto.getRealname()));
|
|
|
|
|
|
- // if (SecurityUtils.getRoles().contains(2) ||
|
|
|
|
- // SecurityUtils.getRoles().contains(1)) {
|
|
|
|
SysDept sysDept = sysDeptService.getById(userDto.getDeptId());
|
|
SysDept sysDept = sysDeptService.getById(userDto.getDeptId());
|
|
|
|
|
|
// TODO qcc调用企查查查询是否为主要人员
|
|
// TODO qcc调用企查查查询是否为主要人员
|
|
@@ -360,19 +346,9 @@ public class SysUserController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // 根据结算主体类型设置用户类型
|
|
|
|
-// if ("1".equals(sysDept.getSubjectType())) {
|
|
|
|
-// userDto.setUserType("1");
|
|
|
|
-// userDto.setCertStatus(TaxHelperCertStatus.UN_CERT.getCode());
|
|
|
|
-// } else {
|
|
|
|
-// userDto.setUserType("0");
|
|
|
|
-// }
|
|
|
|
if(ArrayUtils.contains(sysDept.getSubjectType(),SubjectTypeEnum.TYPE_SHUIBANGYUN.getCode())){
|
|
if(ArrayUtils.contains(sysDept.getSubjectType(),SubjectTypeEnum.TYPE_SHUIBANGYUN.getCode())){
|
|
userDto.setCertStatus(TaxHelperCertStatus.UN_CERT.getCode());
|
|
userDto.setCertStatus(TaxHelperCertStatus.UN_CERT.getCode());
|
|
}
|
|
}
|
|
-// if(ArrayUtils.contains(sysDept.getSubjectType(),SubjectTypeEnum.TYPE_RENLIJIA.getCode())){
|
|
|
|
-// userDto.setRljCertStatus(DingEnum.CER_STATUS_4.getType());
|
|
|
|
-// }
|
|
|
|
|
|
|
|
|
|
|
|
if (userDto.getRole().contains(2)) {
|
|
if (userDto.getRole().contains(2)) {
|
|
@@ -481,7 +457,6 @@ public class SysUserController {
|
|
if (sysRole.getRoleId() == 2) {
|
|
if (sysRole.getRoleId() == 2) {
|
|
return R.failed("用户已存在平台管理员,不能同时为财务管理员");
|
|
return R.failed("用户已存在平台管理员,不能同时为财务管理员");
|
|
}
|
|
}
|
|
-// SysDept sysDept = sysDeptService.getById(userDto.getDeptId());
|
|
|
|
if (sysDept.getLevel() == 3 || sysDept.getLevel() == 4) {
|
|
if (sysDept.getLevel() == 3 || sysDept.getLevel() == 4) {
|
|
if (sysRole.getRoleId() == 3) {
|
|
if (sysRole.getRoleId() == 3) {
|
|
return R.failed("用户已存在药企管理员,不能同时为CSO机构财务管理员");
|
|
return R.failed("用户已存在药企管理员,不能同时为CSO机构财务管理员");
|
|
@@ -505,13 +480,11 @@ public class SysUserController {
|
|
return R.failed("用户已存在平台管理员,不能同时为全职学术推广员");
|
|
return R.failed("用户已存在平台管理员,不能同时为全职学术推广员");
|
|
}
|
|
}
|
|
if (sysRole.getRoleId() == 3) {
|
|
if (sysRole.getRoleId() == 3) {
|
|
-// SysDept sysDept = sysDeptService.getById(userDto.getDeptId());
|
|
|
|
if (sysDept.getLevel() == 3 || sysDept.getLevel() == 4) {
|
|
if (sysDept.getLevel() == 3 || sysDept.getLevel() == 4) {
|
|
return R.failed("用户已存在药企管理员,不能为CSO的全职学术推广员");
|
|
return R.failed("用户已存在药企管理员,不能为CSO的全职学术推广员");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (sysRole.getRoleId() == 4) {
|
|
if (sysRole.getRoleId() == 4) {
|
|
-// SysDept sysDept = sysDeptService.getById(userDto.getDeptId());
|
|
|
|
if (sysDept.getLevel() == 3 || sysDept.getLevel() == 4) {
|
|
if (sysDept.getLevel() == 3 || sysDept.getLevel() == 4) {
|
|
return R.failed("用户已存在CSO管理员,不能为其他CSO的全职学术推广员");
|
|
return R.failed("用户已存在CSO管理员,不能为其他CSO的全职学术推广员");
|
|
}
|
|
}
|
|
@@ -579,7 +552,6 @@ public class SysUserController {
|
|
|
|
|
|
}
|
|
}
|
|
if (userDto.getRole().contains(3)) {
|
|
if (userDto.getRole().contains(3)) {
|
|
-// SysDept sysDept = sysDeptService.getById(userDto.getDeptId());
|
|
|
|
if (sysDept.getLevel() != 2) {
|
|
if (sysDept.getLevel() != 2) {
|
|
return R.failed("角色选为药企管理员时,组织架构必须为药企");
|
|
return R.failed("角色选为药企管理员时,组织架构必须为药企");
|
|
}
|
|
}
|
|
@@ -593,282 +565,24 @@ public class SysUserController {
|
|
SysUser query = new SysUser();
|
|
SysUser query = new SysUser();
|
|
query.setUsername(userDto.getUsername());
|
|
query.setUsername(userDto.getUsername());
|
|
query.setDeptId(userDto.getDeptId());
|
|
query.setDeptId(userDto.getDeptId());
|
|
-// SysUser sysUser = sysUserMapper.selectUserByName(query);
|
|
|
|
Integer count = sysUserMapper.selectCount(Wrappers.query(query));
|
|
Integer count = sysUserMapper.selectCount(Wrappers.query(query));
|
|
// TODO 用户是否存在
|
|
// TODO 用户是否存在
|
|
if (count != 0) {
|
|
if (count != 0) {
|
|
return R.failed("当前机构已存在该账号");
|
|
return R.failed("当前机构已存在该账号");
|
|
}
|
|
}
|
|
|
|
|
|
-// if (sysUser != null) {
|
|
|
|
-// SysUserRole sysUserRole = new SysUserRole();
|
|
|
|
-// sysUserRole.setUserId(sysUser.getUserId());
|
|
|
|
-// List<SysUserRole> sysUserRoleList = sysUserRoleMapper.selectById(sysUserRole);
|
|
|
|
-// List<Integer> list = sysUserRoleList.stream().map(p -> p.getRoleId()).collect(Collectors.toList());
|
|
|
|
-// for (Integer id : list) {
|
|
|
|
-// if (userDto.getRole().contains(3)) {
|
|
|
|
-//// SysDept sysDept = sysDeptService.getById(sysUser.getDeptId());
|
|
|
|
-// if (sysDept.getLevel() != 2) {
|
|
|
|
-// return R.failed("此账号已存在管理员角色");
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(2)) {
|
|
|
|
-// return R.failed("用户已存在平台管理员管理员角色,不能同时为CSO管理员角色");
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(3)) {
|
|
|
|
-// return R.failed("用户存在药企管理员角色");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// if (userDto.getRole().contains(4)) {
|
|
|
|
-// if (id.equals(3) || id.equals(4)) {
|
|
|
|
-// return R.failed("用户已存在管理员角色");
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(2)) {
|
|
|
|
-// return R.failed("用户已存在平台管理员管理员角色,不能同时为CSO管理员角色");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// if (userDto.getRole().contains(5)) {
|
|
|
|
-// if (id.equals(3)) {
|
|
|
|
-//// SysDept sysDept = sysDeptService.getById(userDto.getDeptId());
|
|
|
|
-// if (sysDept.getLevel() == 3 || sysDept.getLevel() == 4) {
|
|
|
|
-// return R.failed("用户存在药企管理员角色,不能维护为经销商组织的全职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(5)) {
|
|
|
|
-// return R.failed("用户已存在全职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(2)) {
|
|
|
|
-// return R.failed("用户已存在平台管理员管理员角色,不能同时为全职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(6)) {
|
|
|
|
-// return R.failed("用户已存在兼职学术推广员角色,不能同时为全职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(4)) {
|
|
|
|
-// if (!userDto.getDeptId().equals(sysUser.getDeptId())) {
|
|
|
|
-// return R.failed("用户已存在CSO管理员角色,不能维护为其他经销商组织的全职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// if (userDto.getRole().contains(6)) {
|
|
|
|
-// if (id.equals(3)) {
|
|
|
|
-// return R.failed("用户已存在药企管理员角色,不能同时为兼职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(6)) {
|
|
|
|
-// return R.failed("用户已存在兼职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(2)) {
|
|
|
|
-// return R.failed("用户已存在平台管理员管理员角色,不能同时为兼职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(4)) {
|
|
|
|
-// return R.failed("用户不能同时为CSO管理员角色和兼职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(5)) {
|
|
|
|
-// return R.failed("用户已存在全职学术推广员角色,用户不能同时为兼职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(7)) {
|
|
|
|
-// if (!userDto.getDeptId().equals(sysUser.getDeptId())) {
|
|
|
|
-// return R.failed("用户已存在财务管理员角色,用户不能同时为兼职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// if (userDto.getRole().contains(7)) {
|
|
|
|
-// if (id.equals(6)) {
|
|
|
|
-// return R.failed("用户不能同时为财务管理员角色和兼职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(4)) {
|
|
|
|
-// return R.failed("用户存在本机构CSO管理员角色,不能为兼职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(3)) {
|
|
|
|
-// return R.failed("用户存在本机构药企管理员角色,不能为兼职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// if (id.equals(2)) {
|
|
|
|
-// return R.failed("用户已存在平台管理员管理员角色,不能同时为兼职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// if (userDto.getRole().contains(9)) {
|
|
|
|
-// if (id.equals(9)) {
|
|
|
|
-// return R.failed("用户在本机构已存在CRO管理员角色");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// if (userDto.getRole().contains(10)) {
|
|
|
|
-// if (id.equals(10)) {
|
|
|
|
-// return R.failed("用户在本机构已存在兼职CRC角色");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// List<Integer> list2 = userDto.getRole();
|
|
|
|
-// for (Integer id : list2) {
|
|
|
|
-// sysUserRole.setRoleId(id);
|
|
|
|
-// sysUserRoleMapper.insert(sysUserRole);
|
|
|
|
-// }
|
|
|
|
-// return R.ok();
|
|
|
|
-// }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
- * @Modify: start
|
|
|
|
- * @Version: v2021.4.16
|
|
|
|
- * @Author: ryz
|
|
|
|
- * @Date: 2021/4/29
|
|
|
|
- * 去掉认证
|
|
|
|
- */
|
|
|
|
-// if (null != userDto.getDeptId() && StringUtils.isNotEmpty(userDto.getIdCardNumber())) {
|
|
|
|
-//// SysDept sysDept = sysDeptService.getById(userDto.getDeptId());
|
|
|
|
-// if (null != sysDept && StringUtils.isNotEmpty(sysDept.getAppId())) {
|
|
|
|
-// if ("1".equals(userDto.getUserType())) {
|
|
|
|
-// TaxHelperConfig config = new TaxHelperConfig();
|
|
|
|
-// config.setAppId(sysDept.getAppId());
|
|
|
|
-// config.setAppSecrete(sysDept.getAppSecret());
|
|
|
|
-// config.setQueryUrl(sysDept.getQueryUrl());
|
|
|
|
-//
|
|
|
|
-// TaxHelperAddMemberModel model = new TaxHelperAddMemberModel(config);
|
|
|
|
-// model.setIdCard(userDto.getIdCardNumber());
|
|
|
|
-// model.setPhone(userDto.getUsername());
|
|
|
|
-// model.setName(userDto.getRealname());
|
|
|
|
-// model.setNotifyUrl("http://localhost:8808");
|
|
|
|
-// String entCode = null;
|
|
|
|
-//// switch (sysDept.getLevel()) {
|
|
|
|
-//// case 1:
|
|
|
|
-//// entCode = sysDeptService.selectEntCodeByLevelId(sysDept.getLevel1Id(), 1);
|
|
|
|
-//// break;
|
|
|
|
-//// case 2:
|
|
|
|
-//// entCode = sysDeptService.selectEntCodeByLevelId(sysDept.getLevel2Id(), 2);
|
|
|
|
-//// break;
|
|
|
|
-//// case 3:
|
|
|
|
-//// entCode = sysDeptService.selectEntCodeByLevelId(sysDept.getLevel3Id(), 3);
|
|
|
|
-//// break;
|
|
|
|
-//// }
|
|
|
|
-//// model.setEnterpriseCode(entCode);
|
|
|
|
-//
|
|
|
|
-// WmDaAgent agent = wmDaAgentService.selectByDeptId(sysDept.getDeptId());
|
|
|
|
-// WmDaDrugEnt drugEnt = wmDaDrugEntService.selectByDeptId(sysDept.getDeptId());
|
|
|
|
-// if (null != agent) {
|
|
|
|
-// model.setEnterpriseCode(agent.getZjNumber());
|
|
|
|
-// } else {
|
|
|
|
-// model.setEnterpriseCode(drugEnt.getEntcode());
|
|
|
|
-// }
|
|
|
|
-// if (StringUtils.isEmpty(model.getEnterpriseCode())) {
|
|
|
|
-// return R.failed("未配置企业的统一社会信用代码");
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// TaxHelperAddMemberRequest request = new TaxHelperAddMemberRequest(model);
|
|
|
|
-// TaxHelperResponse response = taxHelperService.addMembers(request);
|
|
|
|
-//
|
|
|
|
-// // 记录认证结果
|
|
|
|
-// SysCertResultRecord record = new SysCertResultRecord();
|
|
|
|
-// record.setCode(response.getCode());
|
|
|
|
-// record.setCreateTime(LocalDateTime.now());
|
|
|
|
-// record.setDeptId(sysDept.getDeptId());
|
|
|
|
-// record.setMessage(StringUtils.isNotEmpty(response.getMessage())?response.getMessage():"无");
|
|
|
|
-// record.setStatus(null);
|
|
|
|
-// record.setSubjectType(1);
|
|
|
|
-// record.setMethod("增员");
|
|
|
|
-// record.setUserId(sysUser.getUserId());
|
|
|
|
-// sysCertResultRecordMapper.insert(record);
|
|
|
|
-//
|
|
|
|
-// if (response.success()) {
|
|
|
|
-// userDto.setCertStatus(TaxHelperCertStatus.ADD_MEMBER.getCode());
|
|
|
|
-// } else {
|
|
|
|
-// log.info("税邦云增员失败:{},{},原因是:{}", userDto.getRealname(), userDto.getUsername(),
|
|
|
|
-// response.getMessage());
|
|
|
|
-// userDto.setIdCardNumber(null);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// } else {
|
|
|
|
-// DingConfig config = new DingConfig();
|
|
|
|
-// config.setAppId(sysDept.getAppId());
|
|
|
|
-// config.setAppSecret(sysDept.getAppSecret());
|
|
|
|
-// config.setQueryUrl(sysDept.getQueryUrl());
|
|
|
|
-//
|
|
|
|
-// Map map = new HashMap();
|
|
|
|
-// map.put("name", userDto.getRealname());
|
|
|
|
-// map.put("mobile", userDto.getUsername());
|
|
|
|
-// map.put("idCard", userDto.getIdCardNumber());
|
|
|
|
-// map.put("idType", "1");
|
|
|
|
-// List rzlist = new ArrayList();
|
|
|
|
-// rzlist.add(map);
|
|
|
|
-//
|
|
|
|
-// EmployCheckResponse response = dingService.check(config, rzlist);
|
|
|
|
-// if (!response.isSuccess()) {
|
|
|
|
-// return R.failed("人力家接口调用失败");
|
|
|
|
-// }
|
|
|
|
-// // 接口请求成功,但是接口返回的状态还需区分checkStatus,1:验证通过,状态改成已提交,2:验证不通过,状态改成认证失败
|
|
|
|
-// List<EmployCheckResultItem> freelancesResult = response.getData().getFreelancesResult();
|
|
|
|
-// if (CollectionUtils.isNotEmpty(freelancesResult)) {
|
|
|
|
-// for (EmployCheckResultItem employCheckResultItem : freelancesResult) {
|
|
|
|
-// if (employCheckResultItem.getIdCard().equals(userDto.getIdCardNumber())) {
|
|
|
|
-// if (employCheckResultItem.getCheckStatus() == 1) {// 验证通过
|
|
|
|
-// userDto.setCertStatus(DingEnum.CER_STATUS_3.getType());
|
|
|
|
-// continue;
|
|
|
|
-// } else {// 验证不通过
|
|
|
|
-// if ("1014".equals(employCheckResultItem.getCheckRemark())) {
|
|
|
|
-// log.info("认证返回1014按成功处理:{},{}", userDto.getRealname(), userDto.getUsername());
|
|
|
|
-// userDto.setCertStatus(DingEnum.CER_STATUS_3.getType());
|
|
|
|
-// continue;
|
|
|
|
-// }
|
|
|
|
-// if ("1018".equals(employCheckResultItem.getCheckRemark())) {
|
|
|
|
-// log.info("认证返回1018按处理中处理:{},{}", userDto.getRealname(), userDto.getUsername());
|
|
|
|
-// userDto.setCertStatus(DingEnum.CER_STATUS_3.getType());
|
|
|
|
-// continue;
|
|
|
|
-// }
|
|
|
|
-// if ("1019".equals(employCheckResultItem.getCheckRemark())) {
|
|
|
|
-// log.info("认证返回1019按成功处理:{},{}", userDto.getRealname(), userDto.getUsername());
|
|
|
|
-// userDto.setCertStatus(DingEnum.CER_STATUS_1.getType());
|
|
|
|
-// continue;
|
|
|
|
-// }
|
|
|
|
-// if ("1020".equals(employCheckResultItem.getCheckRemark())) {
|
|
|
|
-// log.info("认证返回1020按认证失败处理:{},{}", userDto.getRealname(), userDto.getUsername());
|
|
|
|
-// userDto.setCertStatus(DingEnum.CER_STATUS_2.getType());
|
|
|
|
-// continue;
|
|
|
|
-// }
|
|
|
|
-// userDto.setCertStatus(DingEnum.CER_STATUS_2.getType());
|
|
|
|
-// log.info("认证失败:" + employCheckResultItem.getCheckRemark());
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// } else {
|
|
|
|
-// userDto.setCertStatus(DingEnum.CER_STATUS_2.getType());
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
- //TODO 身份证年龄
|
|
|
|
- if (userDto.getIdCardNumber().length() > 0) {
|
|
|
|
- String str = userDto.getIdCardNumber();
|
|
|
|
- str = str.substring(6, 10);
|
|
|
|
- String str1 = userDto.getIdCardNumber();
|
|
|
|
- str1 = str1.substring(10, 12);
|
|
|
|
- String str2 = userDto.getIdCardNumber();
|
|
|
|
- str2 = str2.substring(12, 14);
|
|
|
|
- int i = Integer.parseInt(str);
|
|
|
|
- int i1 = Integer.parseInt(str1) - 1;
|
|
|
|
- int i2 = Integer.parseInt(str2);
|
|
|
|
-
|
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
|
- calendar.setTime(new Date());//放入Date类型数据
|
|
|
|
-
|
|
|
|
- int year = calendar.get(Calendar.YEAR);//获取年份
|
|
|
|
- int month = calendar.get(Calendar.MONTH);//获取月份
|
|
|
|
- int day = calendar.get(Calendar.DATE);//获取日
|
|
|
|
-
|
|
|
|
- if (year - i < 18) {
|
|
|
|
- return R.failed("年龄未满十八");
|
|
|
|
- } else if (year - i == 18) {
|
|
|
|
- if (month > i1) {
|
|
|
|
|
|
+ // 校验身份证上的年龄
|
|
|
|
+ if (StringUtils.isNotEmpty(userDto.getIdCardNumber())) {
|
|
|
|
+ // 获取更新操作的用户角色
|
|
|
|
+ List<Integer> roles = userDto.getRole();
|
|
|
|
+ // 如果角色中包含全职和兼职就需要校验身份证年龄
|
|
|
|
+ if (roles.contains(5) || roles.contains(6)) {
|
|
|
|
+ int ageByIdCard = IdcardUtil.getAgeByIdCard(userDto.getIdCardNumber());
|
|
|
|
+ if (ageByIdCard < 18) {
|
|
return R.failed("年龄未满十八");
|
|
return R.failed("年龄未满十八");
|
|
- } else if (month == i1) {
|
|
|
|
- if (day < i2) {
|
|
|
|
- return R.failed("年龄未满十八");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else if (year - i > 65) {
|
|
|
|
- return R.failed("年龄已超过六十五");
|
|
|
|
- } else if (year - i == 65) {
|
|
|
|
- if (month > i1) {
|
|
|
|
|
|
+ } else if (ageByIdCard > 65) {
|
|
return R.failed("年龄已超过六十五");
|
|
return R.failed("年龄已超过六十五");
|
|
- } else if (month == i1) {
|
|
|
|
- if (day >= i2) {
|
|
|
|
- return R.failed("年龄已超过六十五");
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1511,138 +1225,6 @@ public class SysUserController {
|
|
return R.failed("用户认证通过或正在认证,暂不能修改身份证号");
|
|
return R.failed("用户认证通过或正在认证,暂不能修改身份证号");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-// if (null != oldData.getCertStatus() && cetList.contains(oldData.getCertStatus())) {
|
|
|
|
-// if (!userDto.getRealname().equals(oldData.getRealname())) {
|
|
|
|
-// return R.failed("用户认证通过或正在认证,暂不能修改姓名");
|
|
|
|
-// }
|
|
|
|
-// if (!userDto.getIdCardNumber().equals(oldData.getIdCardNumber())) {
|
|
|
|
-// return R.failed("用户认证通过或正在认证,暂不能修改身份证号");
|
|
|
|
-// }
|
|
|
|
-// } else {
|
|
|
|
-// if (null != userDto.getDeptId() && StringUtils.isNotEmpty(userDto.getIdCardNumber())) {
|
|
|
|
-// SysDept sysDept = sysDeptService.getById(userDto.getDeptId());
|
|
|
|
-// if (null != sysDept && StringUtils.isNotEmpty(sysDept.getAppId())) {
|
|
|
|
-// if ("1".equals(oldData.getUserType())) {
|
|
|
|
-// TaxHelperConfig config = new TaxHelperConfig();
|
|
|
|
-// config.setAppId(sysDept.getAppId());
|
|
|
|
-// config.setAppSecrete(sysDept.getAppSecret());
|
|
|
|
-// config.setQueryUrl(sysDept.getQueryUrl());
|
|
|
|
-//
|
|
|
|
-// TaxHelperAddMemberModel model = new TaxHelperAddMemberModel(config);
|
|
|
|
-// model.setIdCard(userDto.getIdCardNumber());
|
|
|
|
-// model.setPhone(userDto.getUsername());
|
|
|
|
-// model.setName(userDto.getRealname());
|
|
|
|
-// model.setNotifyUrl("http://localhost:8808");
|
|
|
|
-// String entCode = null;
|
|
|
|
-//// switch (sysDept.getLevel()) {
|
|
|
|
-//// case 1:
|
|
|
|
-//// entCode = sysDeptService.selectEntCodeByLevelId(sysDept.getLevel1Id(), 1);
|
|
|
|
-//// break;
|
|
|
|
-//// case 2:
|
|
|
|
-//// entCode = sysDeptService.selectEntCodeByLevelId(sysDept.getLevel2Id(), 2);
|
|
|
|
-//// break;
|
|
|
|
-//// case 3:
|
|
|
|
-//// entCode = sysDeptService.selectEntCodeByLevelId(sysDept.getLevel3Id(), 3);
|
|
|
|
-//// break;
|
|
|
|
-//// }
|
|
|
|
-//
|
|
|
|
-// WmDaAgent agent = wmDaAgentService.selectByDeptId(sysDept.getDeptId());
|
|
|
|
-// WmDaDrugEnt drugEnt = wmDaDrugEntService.selectByDeptId(sysDept.getDeptId());
|
|
|
|
-// if (null != agent) {
|
|
|
|
-// model.setEnterpriseCode(agent.getZjNumber());
|
|
|
|
-// } else {
|
|
|
|
-// model.setEnterpriseCode(drugEnt.getEntcode());
|
|
|
|
-// }
|
|
|
|
-// if (StringUtils.isEmpty(model.getEnterpriseCode())) {
|
|
|
|
-// return R.failed("未配置企业的统一社会信用代码");
|
|
|
|
-// }
|
|
|
|
-// TaxHelperAddMemberRequest request = new TaxHelperAddMemberRequest(model);
|
|
|
|
-// TaxHelperResponse response = taxHelperService.addMembers(request);
|
|
|
|
-//
|
|
|
|
-// // 记录认证结果
|
|
|
|
-// SysCertResultRecord record = new SysCertResultRecord();
|
|
|
|
-// record.setCode(response.getCode());
|
|
|
|
-// record.setCreateTime(LocalDateTime.now());
|
|
|
|
-// record.setDeptId(sysDept.getDeptId());
|
|
|
|
-// record.setMessage(StringUtils.isNotEmpty(response.getMessage())?response.getMessage():"无");
|
|
|
|
-// record.setStatus(null);
|
|
|
|
-// record.setSubjectType(1);
|
|
|
|
-// record.setMethod("增员");
|
|
|
|
-// record.setUserId(oldData.getUserId());
|
|
|
|
-// sysCertResultRecordMapper.insert(record);
|
|
|
|
-//
|
|
|
|
-// if (response.success()) {
|
|
|
|
-// userDto.setCertStatus(TaxHelperCertStatus.ADD_MEMBER.getCode());
|
|
|
|
-// } else {
|
|
|
|
-// log.info("税邦云增员失败:{},{},原因是:{}", userDto.getRealname(), userDto.getUsername(),
|
|
|
|
-// response.getMessage());
|
|
|
|
-// userDto.setIdCardNumber(null);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// } else {
|
|
|
|
-// DingConfig config = new DingConfig();
|
|
|
|
-// config.setAppId(sysDept.getAppId());
|
|
|
|
-// config.setAppSecret(sysDept.getAppSecret());
|
|
|
|
-// config.setQueryUrl(sysDept.getQueryUrl());
|
|
|
|
-//
|
|
|
|
-// Map map = new HashMap();
|
|
|
|
-// map.put("name", userDto.getRealname());
|
|
|
|
-// map.put("mobile", userDto.getUsername());
|
|
|
|
-// map.put("idCard", userDto.getIdCardNumber());
|
|
|
|
-// map.put("idType", "1");
|
|
|
|
-// List rzlist = new ArrayList();
|
|
|
|
-// rzlist.add(map);
|
|
|
|
-//
|
|
|
|
-// EmployCheckResponse response = dingService.check(config, rzlist);
|
|
|
|
-// if (!response.isSuccess()) {
|
|
|
|
-// return R.failed("人力家接口调用失败");
|
|
|
|
-// }
|
|
|
|
-// // 接口请求成功,但是接口返回的状态还需区分checkStatus,1:验证通过,状态改成已提交,2:验证不通过,状态改成认证失败
|
|
|
|
-// List<EmployCheckResultItem> freelancesResult = response.getData().getFreelancesResult();
|
|
|
|
-// if (CollectionUtils.isNotEmpty(freelancesResult)) {
|
|
|
|
-// for (EmployCheckResultItem employCheckResultItem : freelancesResult) {
|
|
|
|
-// if (employCheckResultItem.getIdCard().equals(userDto.getIdCardNumber())) {
|
|
|
|
-// if (employCheckResultItem.getCheckStatus() == 1) {// 验证通过
|
|
|
|
-// userDto.setCertStatus(DingEnum.CER_STATUS_3.getType());
|
|
|
|
-// continue;
|
|
|
|
-// } else {// 验证不通过
|
|
|
|
-// if ("1014".equals(employCheckResultItem.getCheckRemark())) {
|
|
|
|
-// log.info("认证返回1014按成功处理:{},{}", userDto.getRealname(),
|
|
|
|
-// userDto.getUsername());
|
|
|
|
-// userDto.setCertStatus(DingEnum.CER_STATUS_3.getType());
|
|
|
|
-// continue;
|
|
|
|
-// }
|
|
|
|
-// if ("1018".equals(employCheckResultItem.getCheckRemark())) {
|
|
|
|
-// log.info("认证返回1018按处理中处理:{},{}", userDto.getRealname(),
|
|
|
|
-// userDto.getUsername());
|
|
|
|
-// userDto.setCertStatus(DingEnum.CER_STATUS_3.getType());
|
|
|
|
-// continue;
|
|
|
|
-// }
|
|
|
|
-// if ("1019".equals(employCheckResultItem.getCheckRemark())) {
|
|
|
|
-// log.info("认证返回1019按成功处理:{},{}", userDto.getRealname(),
|
|
|
|
-// userDto.getUsername());
|
|
|
|
-// userDto.setCertStatus(DingEnum.CER_STATUS_1.getType());
|
|
|
|
-// continue;
|
|
|
|
-// }
|
|
|
|
-// if ("1020".equals(employCheckResultItem.getCheckRemark())) {
|
|
|
|
-// log.info("认证返回1020按认证失败处理:{},{}", userDto.getRealname(),
|
|
|
|
-// userDto.getUsername());
|
|
|
|
-// userDto.setCertStatus(DingEnum.CER_STATUS_2.getType());
|
|
|
|
-// continue;
|
|
|
|
-// }
|
|
|
|
-// userDto.setCertStatus(DingEnum.CER_STATUS_2.getType());
|
|
|
|
-// log.info("认证失败:" + employCheckResultItem.getCheckRemark());
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// } else {
|
|
|
|
-// userDto.setCertStatus(DingEnum.CER_STATUS_2.getType());
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if (SecurityUtils.getRoles().contains(2) || SecurityUtils.getRoles().contains(1)) {
|
|
if (SecurityUtils.getRoles().contains(2) || SecurityUtils.getRoles().contains(1)) {
|
|
@@ -1689,7 +1271,6 @@ public class SysUserController {
|
|
query.setDeptId(userDto.getDeptId());
|
|
query.setDeptId(userDto.getDeptId());
|
|
SysUser sysUser = sysUserMapper.selectUserByName(query);
|
|
SysUser sysUser = sysUserMapper.selectUserByName(query);
|
|
if (sysUser != null) {
|
|
if (sysUser != null) {
|
|
-// SysDept sysDept = sysDeptService.getById(sysUser.getDeptId());
|
|
|
|
if (sysDept.getLevel() != 2) {
|
|
if (sysDept.getLevel() != 2) {
|
|
return R.failed("角色选为药企管理员时,组织架构必须为药企");
|
|
return R.failed("角色选为药企管理员时,组织架构必须为药企");
|
|
}
|
|
}
|
|
@@ -1772,15 +1353,6 @@ public class SysUserController {
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
} else {
|
|
- // SysUser sysUser = new SysUser();
|
|
|
|
- //// SysDept sysDept = sysDeptService.getById(userDto.getDeptId());
|
|
|
|
- //// sysUser.setDeptId(sysDept.getDeptId());
|
|
|
|
- //// sysUser.setUsername(userDto.getUsername());
|
|
|
|
- ////
|
|
|
|
- //// List<SysUser> sysUserList = userService.list(Wrappers.query(sysUser));
|
|
|
|
- //// if (sysUserList.size() > 1) {
|
|
|
|
- //// return R.failed("用户信息已存在");
|
|
|
|
- //// }
|
|
|
|
if (!userDto.getDeptId().equals(SecurityUtils.getUser().getDeptId())) {
|
|
if (!userDto.getDeptId().equals(SecurityUtils.getUser().getDeptId())) {
|
|
if (userDto.getRole().contains(5) || userDto.getRole().contains(6)) {
|
|
if (userDto.getRole().contains(5) || userDto.getRole().contains(6)) {
|
|
return R.failed("不能跨机构维护学术推广员");
|
|
return R.failed("不能跨机构维护学术推广员");
|
|
@@ -1789,15 +1361,6 @@ public class SysUserController {
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
} else {
|
|
- // SysUser sysUser = new SysUser();
|
|
|
|
- // SysDept sysDept = sysDeptService.getById(userDto.getDeptId());
|
|
|
|
- // sysUser.setDeptId(sysDept.getDeptId());
|
|
|
|
- // sysUser.setUsername(userDto.getUsername());
|
|
|
|
- //
|
|
|
|
- // List<SysUser> sysUserList = userService.list(Wrappers.query(sysUser));
|
|
|
|
- // if (sysUserList.size() > 1) {
|
|
|
|
- // return R.failed("用户信息已存在");
|
|
|
|
- // }
|
|
|
|
if (!userDto.getDeptId().equals(SecurityUtils.getUser().getDeptId())) {
|
|
if (!userDto.getDeptId().equals(SecurityUtils.getUser().getDeptId())) {
|
|
if (userDto.getRole().contains(5) || userDto.getRole().contains(6)) {
|
|
if (userDto.getRole().contains(5) || userDto.getRole().contains(6)) {
|
|
return R.failed("不能跨机构维护学术推广员");
|
|
return R.failed("不能跨机构维护学术推广员");
|
|
@@ -1812,58 +1375,28 @@ public class SysUserController {
|
|
if (userDto.getRole().contains(6) && userDto.getRole().contains(4)) {
|
|
if (userDto.getRole().contains(6) && userDto.getRole().contains(4)) {
|
|
return R.failed("用户不能同时为经销商管理员角色和兼职学术推广员角色");
|
|
return R.failed("用户不能同时为经销商管理员角色和兼职学术推广员角色");
|
|
}
|
|
}
|
|
-// if (userDto.getRole().contains(7) && userDto.getRole().contains(5)) {
|
|
|
|
-// return R.failed("用户不能同时为财务管理员角色和全职学术推广员角色");
|
|
|
|
-// }
|
|
|
|
if (userDto.getRole().contains(7) && userDto.getRole().contains(6)) {
|
|
if (userDto.getRole().contains(7) && userDto.getRole().contains(6)) {
|
|
return R.failed("用户不能同时为财务管理员角色和兼职学术推广员角色");
|
|
return R.failed("用户不能同时为财务管理员角色和兼职学术推广员角色");
|
|
}
|
|
}
|
|
if (userDto.getRole().contains(3)) {
|
|
if (userDto.getRole().contains(3)) {
|
|
-// SysDept sysDept = sysDeptService.getById(sysUser.getDeptId());
|
|
|
|
if (sysDept.getLevel() != 2) {
|
|
if (sysDept.getLevel() != 2) {
|
|
return R.failed("角色选为药企管理员时,组织架构必须为药企");
|
|
return R.failed("角色选为药企管理员时,组织架构必须为药企");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //TODO 身份证年龄
|
|
|
|
|
|
+
|
|
|
|
+ // 校验身份证上的年龄
|
|
if (StringUtils.isNotEmpty(userDto.getIdCardNumber())) {
|
|
if (StringUtils.isNotEmpty(userDto.getIdCardNumber())) {
|
|
- String str = userDto.getIdCardNumber();
|
|
|
|
- str = str.substring(6, 10);
|
|
|
|
- String str1 = userDto.getIdCardNumber();
|
|
|
|
- str1 = str1.substring(10, 12);
|
|
|
|
- String str2 = userDto.getIdCardNumber();
|
|
|
|
- str2 = str2.substring(12, 14);
|
|
|
|
- int i = Integer.parseInt(str);
|
|
|
|
- int i1 = Integer.parseInt(str1) - 1;
|
|
|
|
- int i2 = Integer.parseInt(str2);
|
|
|
|
-
|
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
|
- calendar.setTime(new Date());//放入Date类型数据
|
|
|
|
-
|
|
|
|
- int year = calendar.get(Calendar.YEAR);//获取年份
|
|
|
|
- int month = calendar.get(Calendar.MONTH);//获取月份
|
|
|
|
- int day = calendar.get(Calendar.DATE);//获取日
|
|
|
|
-
|
|
|
|
- if (year - i < 18) {
|
|
|
|
- return R.failed("年龄未满十八");
|
|
|
|
- } else if (year - i == 18) {
|
|
|
|
- if (month > i1) {
|
|
|
|
|
|
+ // 获取更新操作的用户角色
|
|
|
|
+ List<Integer> roles = userDto.getRole();
|
|
|
|
+ // 如果角色中包含全职和兼职就需要校验身份证年龄
|
|
|
|
+ if (roles.contains(5) || roles.contains(6)) {
|
|
|
|
+ int ageByIdCard = IdcardUtil.getAgeByIdCard(userDto.getIdCardNumber());
|
|
|
|
+ if (ageByIdCard < 18) {
|
|
return R.failed("年龄未满十八");
|
|
return R.failed("年龄未满十八");
|
|
- } else if (month == i1) {
|
|
|
|
- if (day < i2) {
|
|
|
|
- return R.failed("年龄未满十八");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else if (year - i > 65) {
|
|
|
|
- return R.failed("年龄已超过六十五");
|
|
|
|
- } else if (year - i == 65) {
|
|
|
|
- if (month > i1) {
|
|
|
|
|
|
+ } else if (ageByIdCard > 65) {
|
|
return R.failed("年龄已超过六十五");
|
|
return R.failed("年龄已超过六十五");
|
|
- } else if (month == i1) {
|
|
|
|
- if (day >= i2) {
|
|
|
|
- return R.failed("年龄已超过六十五");
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|