|
@@ -40,12 +40,14 @@ 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.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.SysDeptSub;
|
|
import com.qunzhixinxi.hnqz.admin.entity.dto.CommonUserDTO;
|
|
import com.qunzhixinxi.hnqz.admin.entity.dto.CommonUserDTO;
|
|
import com.qunzhixinxi.hnqz.admin.entity.input.UserCertificationInput;
|
|
import com.qunzhixinxi.hnqz.admin.entity.input.UserCertificationInput;
|
|
import com.qunzhixinxi.hnqz.admin.entity.model.excel.CommonUserExcelModel;
|
|
import com.qunzhixinxi.hnqz.admin.entity.model.excel.CommonUserExcelModel;
|
|
import com.qunzhixinxi.hnqz.admin.enums.SubjectTypeEnum;
|
|
import com.qunzhixinxi.hnqz.admin.enums.SubjectTypeEnum;
|
|
import com.qunzhixinxi.hnqz.admin.mapper.*;
|
|
import com.qunzhixinxi.hnqz.admin.mapper.*;
|
|
import com.qunzhixinxi.hnqz.admin.service.SysDeptService;
|
|
import com.qunzhixinxi.hnqz.admin.service.SysDeptService;
|
|
|
|
+import com.qunzhixinxi.hnqz.admin.service.SysDeptSubService;
|
|
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;
|
|
@@ -90,17 +92,10 @@ public class SysUserController {
|
|
|
|
|
|
private final SysUserService userService;
|
|
private final SysUserService userService;
|
|
private final SysDeptService sysDeptService;
|
|
private final SysDeptService sysDeptService;
|
|
- private final SysDeptMapper sysDeptMapper;
|
|
|
|
|
|
+ private final SysDeptSubService sysDeptSubService;
|
|
private final SysUserMapper sysUserMapper;
|
|
private final SysUserMapper sysUserMapper;
|
|
private final RedisTemplate redisTemplate;
|
|
private final RedisTemplate redisTemplate;
|
|
- private final DingService dingService;
|
|
|
|
- private final UpmsConfig upmsConfig;
|
|
|
|
private final SysUserRoleMapper sysUserRoleMapper;
|
|
private final SysUserRoleMapper sysUserRoleMapper;
|
|
- private final SysRoleMapper sysRoleMapper;
|
|
|
|
- private final TaxHelperService taxHelperService;
|
|
|
|
- private final WmDaAgentService wmDaAgentService;
|
|
|
|
- private final WmDaDrugEntService wmDaDrugEntService;
|
|
|
|
- private final SysCertResultRecordMapper sysCertResultRecordMapper;
|
|
|
|
private final QccService qccService;
|
|
private final QccService qccService;
|
|
|
|
|
|
|
|
|
|
@@ -301,7 +296,7 @@ public class SysUserController {
|
|
* @Version: v2021.4.16
|
|
* @Version: v2021.4.16
|
|
* @Author: ryz
|
|
* @Author: ryz
|
|
* @Date: 2021/5/6
|
|
* @Date: 2021/5/6
|
|
- */
|
|
|
|
|
|
+ */
|
|
if (userDto.getRole().contains(6) || userDto.getRole().contains(10)) {
|
|
if (userDto.getRole().contains(6) || userDto.getRole().contains(10)) {
|
|
Map<String, String> params = new HashMap<>();
|
|
Map<String, String> params = new HashMap<>();
|
|
params.put("searchKey", sysDept.getName());
|
|
params.put("searchKey", sysDept.getName());
|
|
@@ -311,15 +306,15 @@ public class SysUserController {
|
|
if (qccRes.isSuccess()) {
|
|
if (qccRes.isSuccess()) {
|
|
for (EmployeeGetListDataItem item : qccRes.getResult()) {
|
|
for (EmployeeGetListDataItem item : qccRes.getResult()) {
|
|
if (userDto.getRealname().equals(item.getName())) {
|
|
if (userDto.getRealname().equals(item.getName())) {
|
|
- if(userDto.getRole().contains(10)){
|
|
|
|
- return R.failed(String.format("%s为该公司%s,不能为兼职CRC",item.getName(),item.getJob()));
|
|
|
|
- }else{
|
|
|
|
- return R.failed(String.format("%s为该公司%s,不能为兼职学术推广员",item.getName(),item.getJob()));
|
|
|
|
|
|
+ if (userDto.getRole().contains(10)) {
|
|
|
|
+ return R.failed(String.format("%s为该公司%s,不能为兼职CRC", item.getName(), item.getJob()));
|
|
|
|
+ } else {
|
|
|
|
+ return R.failed(String.format("%s为该公司%s,不能为兼职学术推广员", item.getName(), item.getJob()));
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(null != qccRes.getPaging()){
|
|
|
|
|
|
+ if (null != qccRes.getPaging()) {
|
|
PageInfo qccPage = qccRes.getPaging();
|
|
PageInfo qccPage = qccRes.getPaging();
|
|
// 需要分页查询
|
|
// 需要分页查询
|
|
if (qccPage.getTotalRecords() > qccPage.getPageIndex() * qccPage.getPageSize()) {
|
|
if (qccPage.getTotalRecords() > qccPage.getPageIndex() * qccPage.getPageSize()) {
|
|
@@ -331,10 +326,10 @@ public class SysUserController {
|
|
if (qccRes.isSuccess()) {
|
|
if (qccRes.isSuccess()) {
|
|
for (EmployeeGetListDataItem item : qccRes.getResult()) {
|
|
for (EmployeeGetListDataItem item : qccRes.getResult()) {
|
|
if (userDto.getRealname().equals(item.getName())) {
|
|
if (userDto.getRealname().equals(item.getName())) {
|
|
- if(userDto.getRole().contains(10)){
|
|
|
|
- return R.failed(String.format("%s为该公司%s,不能为兼职CRC",item.getName(),item.getJob()));
|
|
|
|
- }else{
|
|
|
|
- return R.failed(String.format("%s为该公司%s,不能为兼职学术推广员",item.getName(),item.getJob()));
|
|
|
|
|
|
+ if (userDto.getRole().contains(10)) {
|
|
|
|
+ return R.failed(String.format("%s为该公司%s,不能为兼职CRC", item.getName(), item.getJob()));
|
|
|
|
+ } else {
|
|
|
|
+ return R.failed(String.format("%s为该公司%s,不能为兼职学术推广员", item.getName(), item.getJob()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -348,7 +343,7 @@ public class SysUserController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- 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());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -606,7 +601,7 @@ public class SysUserController {
|
|
@SysLog("批量导入用户")
|
|
@SysLog("批量导入用户")
|
|
@PostMapping(value = "/batch")
|
|
@PostMapping(value = "/batch")
|
|
@PreAuthorize("@pms.hasPermission('sys_user_add')")
|
|
@PreAuthorize("@pms.hasPermission('sys_user_add')")
|
|
- public R batchUser(@RequestExcel List<CommonUserExcelModel> commonUserExcelModelList){
|
|
|
|
|
|
+ public R batchUser(@RequestExcel List<CommonUserExcelModel> commonUserExcelModelList) {
|
|
|
|
|
|
// 参数校验
|
|
// 参数校验
|
|
if (CollectionUtils.isEmpty(commonUserExcelModelList)) {
|
|
if (CollectionUtils.isEmpty(commonUserExcelModelList)) {
|
|
@@ -1157,15 +1152,15 @@ public class SysUserController {
|
|
if (qccRes.isSuccess()) {
|
|
if (qccRes.isSuccess()) {
|
|
for (EmployeeGetListDataItem item : qccRes.getResult()) {
|
|
for (EmployeeGetListDataItem item : qccRes.getResult()) {
|
|
if (userDto.getRealname().equals(item.getName())) {
|
|
if (userDto.getRealname().equals(item.getName())) {
|
|
- if(userDto.getRole().contains(10)){
|
|
|
|
- return R.failed(String.format("%s为该公司%s,不能为兼职CRC",item.getName(),item.getJob()));
|
|
|
|
- }else{
|
|
|
|
- return R.failed(String.format("%s为该公司%s,不能为兼职学术推广员",item.getName(),item.getJob()));
|
|
|
|
|
|
+ if (userDto.getRole().contains(10)) {
|
|
|
|
+ return R.failed(String.format("%s为该公司%s,不能为兼职CRC", item.getName(), item.getJob()));
|
|
|
|
+ } else {
|
|
|
|
+ return R.failed(String.format("%s为该公司%s,不能为兼职学术推广员", item.getName(), item.getJob()));
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(null != qccRes.getPaging()){
|
|
|
|
|
|
+ if (null != qccRes.getPaging()) {
|
|
PageInfo qccPage = qccRes.getPaging();
|
|
PageInfo qccPage = qccRes.getPaging();
|
|
// 需要分页查询
|
|
// 需要分页查询
|
|
if (qccPage.getTotalRecords() > qccPage.getPageIndex() * qccPage.getPageSize()) {
|
|
if (qccPage.getTotalRecords() > qccPage.getPageIndex() * qccPage.getPageSize()) {
|
|
@@ -1176,10 +1171,10 @@ public class SysUserController {
|
|
qccRes = qccService.getList(params);
|
|
qccRes = qccService.getList(params);
|
|
if (qccRes.isSuccess()) {
|
|
if (qccRes.isSuccess()) {
|
|
for (EmployeeGetListDataItem item : qccRes.getResult()) {
|
|
for (EmployeeGetListDataItem item : qccRes.getResult()) {
|
|
- if(userDto.getRole().contains(10)){
|
|
|
|
- return R.failed(String.format("%s为该公司%s,不能为兼职CRC",item.getName(),item.getJob()));
|
|
|
|
- }else{
|
|
|
|
- return R.failed(String.format("%s为该公司%s,不能为兼职学术推广员",item.getName(),item.getJob()));
|
|
|
|
|
|
+ if (userDto.getRole().contains(10)) {
|
|
|
|
+ return R.failed(String.format("%s为该公司%s,不能为兼职CRC", item.getName(), item.getJob()));
|
|
|
|
+ } else {
|
|
|
|
+ return R.failed(String.format("%s为该公司%s,不能为兼职学术推广员", item.getName(), item.getJob()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -1299,10 +1294,10 @@ public class SysUserController {
|
|
if (sysRole.getRoleId() == 3) {
|
|
if (sysRole.getRoleId() == 3) {
|
|
return R.failed("用户不能同时为药企管理员和经销商管理员");
|
|
return R.failed("用户不能同时为药企管理员和经销商管理员");
|
|
}
|
|
}
|
|
- if(!userDto.getUserId().equals(userVO.getUserId()) && sysRole.getRoleId() == 4){
|
|
|
|
|
|
+ if (!userDto.getUserId().equals(userVO.getUserId()) && sysRole.getRoleId() == 4) {
|
|
return R.failed("用户已存在CSO管理员角色,不能维护为其他经销商组织的CSO管理员角色");
|
|
return R.failed("用户已存在CSO管理员角色,不能维护为其他经销商组织的CSO管理员角色");
|
|
}
|
|
}
|
|
- if(!userDto.getUserId().equals(userVO.getUserId()) && sysRole.getRoleId() == 9){
|
|
|
|
|
|
+ if (!userDto.getUserId().equals(userVO.getUserId()) && sysRole.getRoleId() == 9) {
|
|
return R.failed("用户已存在CRO管理员角色,不能维护为其他经销商组织的CSO管理员角色");
|
|
return R.failed("用户已存在CRO管理员角色,不能维护为其他经销商组织的CSO管理员角色");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1326,10 +1321,10 @@ public class SysUserController {
|
|
if (sysRole.getRoleId() == 3) {
|
|
if (sysRole.getRoleId() == 3) {
|
|
return R.failed("用户不能同时为药企管理员和CRO管理员");
|
|
return R.failed("用户不能同时为药企管理员和CRO管理员");
|
|
}
|
|
}
|
|
- if(!userDto.getUserId().equals(userVO.getUserId()) && sysRole.getRoleId() == 4){
|
|
|
|
|
|
+ if (!userDto.getUserId().equals(userVO.getUserId()) && sysRole.getRoleId() == 4) {
|
|
return R.failed("用户已存在CSO管理员角色,不能维护为其他经销商组织的CRO管理员角色");
|
|
return R.failed("用户已存在CSO管理员角色,不能维护为其他经销商组织的CRO管理员角色");
|
|
}
|
|
}
|
|
- if(!userDto.getUserId().equals(userVO.getUserId()) && sysRole.getRoleId() == 9){
|
|
|
|
|
|
+ if (!userDto.getUserId().equals(userVO.getUserId()) && sysRole.getRoleId() == 9) {
|
|
return R.failed("用户已存在CRO管理员角色,不能维护为其他经销商组织的CRO管理员角色");
|
|
return R.failed("用户已存在CRO管理员角色,不能维护为其他经销商组织的CRO管理员角色");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1337,7 +1332,7 @@ public class SysUserController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- }else if (userDto.getRole().contains(6)) {
|
|
|
|
|
|
+ } else if (userDto.getRole().contains(6)) {
|
|
UserDTO userDTO = new UserDTO();
|
|
UserDTO userDTO = new UserDTO();
|
|
userDTO.setPlatId(userDto.getUsername());
|
|
userDTO.setPlatId(userDto.getUsername());
|
|
userDTO.setDelFlag("0");
|
|
userDTO.setDelFlag("0");
|
|
@@ -1433,19 +1428,31 @@ public class SysUserController {
|
|
*/
|
|
*/
|
|
@GetMapping("/selectUserList")
|
|
@GetMapping("/selectUserList")
|
|
public R selectUserList(Page page, UserDTO userDTO) {
|
|
public R selectUserList(Page page, UserDTO userDTO) {
|
|
- if(!"0".equals(userDTO.getSubType()) && !"1".equals(userDTO.getSubType())){
|
|
|
|
|
|
+ if (!"0".equals(userDTO.getSubType()) && !"1".equals(userDTO.getSubType())) {
|
|
userDTO.setSubType(null);
|
|
userDTO.setSubType(null);
|
|
}
|
|
}
|
|
|
|
|
|
IPage<UserVO> userVosPage = userService.selectUserList(page, userDTO);
|
|
IPage<UserVO> userVosPage = userService.selectUserList(page, userDTO);
|
|
- if("0".equals(userDTO.getSubType())){
|
|
|
|
- List<UserVO> userDTOList = userVosPage.getRecords();
|
|
|
|
- userDTOList.forEach(item->item.setCertStatus(null));
|
|
|
|
- }
|
|
|
|
- if("1".equals(userDTO.getSubType())){
|
|
|
|
- List<UserVO> userDTOList = userVosPage.getRecords();
|
|
|
|
- userDTOList.forEach(item->item.setRljCertStatus(null));
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ // 封装结算通道
|
|
|
|
+ Set<Integer> deptIds = userVosPage.getRecords().stream().map(UserVO::getDeptId).collect(Collectors.toSet());
|
|
|
|
+
|
|
|
|
+ Map<Integer, Map<String, Integer>> coll = sysDeptSubService.list(Wrappers.<SysDeptSub>lambdaQuery().in(SysDeptSub::getDeptId, deptIds))
|
|
|
|
+ .stream()
|
|
|
|
+ .collect(Collectors.groupingBy(SysDeptSub::getDeptId, Collectors.toMap(SysDeptSub::getSubjectType, SysDeptSub::getSubjectChannel)));
|
|
|
|
+
|
|
|
|
+ userVosPage.getRecords().forEach(item -> {
|
|
|
|
+ if ("0".equals(userDTO.getSubType())) {
|
|
|
|
+ item.setCertStatus(null);
|
|
|
|
+ } else if ("1".equals(userDTO.getSubType())) {
|
|
|
|
+ item.setRljCertStatus(null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ item.setSubjectTypeAndChannel(coll.get(item.getDeptId()));
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
return R.ok(userVosPage);
|
|
return R.ok(userVosPage);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1612,7 +1619,7 @@ public class SysUserController {
|
|
public R listNoScopeAll(Page page, UserDTO userDTO) {
|
|
public R listNoScopeAll(Page page, UserDTO userDTO) {
|
|
page.setSize(10000);
|
|
page.setSize(10000);
|
|
QueryWrapper<SysUser> queryWrapper = null;
|
|
QueryWrapper<SysUser> queryWrapper = null;
|
|
- if (userDTO.getDeptId() != null){
|
|
|
|
|
|
+ if (userDTO.getDeptId() != null) {
|
|
SysUser sysUser = new SysUser();
|
|
SysUser sysUser = new SysUser();
|
|
sysUser.setDeptId(userDTO.getDeptId());
|
|
sysUser.setDeptId(userDTO.getDeptId());
|
|
queryWrapper = Wrappers.query(sysUser);
|
|
queryWrapper = Wrappers.query(sysUser);
|