|
|
@@ -2,6 +2,7 @@ package com.jzg.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
@@ -27,6 +28,8 @@ import com.jzg.commons.util.StringUtils;
|
|
|
import com.jzg.commons.util.idgen.IdGenerate;
|
|
|
import com.jzg.mapper.*;
|
|
|
import com.jzg.service.*;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
@@ -45,6 +48,7 @@ import java.util.stream.Collectors;
|
|
|
public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem>
|
|
|
implements SysSystemService {
|
|
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(SysSystemServiceImpl.class);
|
|
|
@Autowired
|
|
|
private SysRolePermsMapper sysRolePermsMapper;
|
|
|
@Autowired
|
|
|
@@ -104,7 +108,7 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
wrapper.eq(SysRolePerms::getRoleId,roles.get(0).getId());
|
|
|
sysRolePermsMapper.delete(wrapper);
|
|
|
|
|
|
- List<SysSystemPermsVo.PermsVo> permsList = JSON.parseArray(permsStr,SysSystemPermsVo.PermsVo.class);;
|
|
|
+ List<SysSystemPermsVo.PermsVo> permsList = JSON.parseArray(permsStr,SysSystemPermsVo.PermsVo.class);
|
|
|
return this.savePerms(permsList, roles.get(0).getId());
|
|
|
}
|
|
|
|
|
|
@@ -161,8 +165,7 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
.like(SysRole::getName,"管理员");
|
|
|
List<SysRole> roles = sysRoleMapper.selectList(queryWrapper);
|
|
|
List<SysRolePerms> sysSystemPerms = sysRolePermsMapper.getByRoleId(roles.get(0).getId());
|
|
|
- List<String> permsIds = sysSystemPerms.stream().map(SysRolePerms::getPermsId).collect(Collectors.toList());
|
|
|
- return permsIds;
|
|
|
+ return sysSystemPerms.stream().map(SysRolePerms::getPermsId).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -268,8 +271,7 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
|
|
|
@Override
|
|
|
public List<SysSystemVo> queryList(SysSystemParam param) {
|
|
|
- List<SysSystemVo> sysList = baseMapper.queryList(param);
|
|
|
- return sysList;
|
|
|
+ return baseMapper.queryList(param);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -379,7 +381,7 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
.eq(SysConfig::getSystemCode, SystemConstants.SYSTEM_PLATFORM.getCode()));
|
|
|
this.saveConfig(configs.get(0), sysSystem.getSysCode());
|
|
|
|
|
|
- List<SysSystemPermsVo.PermsVo> permsList = JSON.parseArray(configs.get(0).getSysPerms(),SysSystemPermsVo.PermsVo.class);;
|
|
|
+ List<SysSystemPermsVo.PermsVo> permsList = JSON.parseArray(configs.get(0).getSysPerms(),SysSystemPermsVo.PermsVo.class);
|
|
|
|
|
|
this.savePerms(permsList, role.getId());
|
|
|
// 租户绑定管理员信息
|
|
|
@@ -488,13 +490,9 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void upAndDown(UpAndDownVo upAndDownVo) {
|
|
|
if(YesNoEnum.YES.equals(upAndDownVo.getOpType())) {
|
|
|
- upAndDownVo.getIds().forEach(id->{
|
|
|
- reDeploy(Convert.toStr(id));
|
|
|
- });
|
|
|
+ upAndDownVo.getIds().forEach(id-> reDeploy(Convert.toStr(id)));
|
|
|
} else {
|
|
|
- upAndDownVo.getIds().forEach(id->{
|
|
|
- unDeploy(Convert.toStr(id));
|
|
|
- });
|
|
|
+ upAndDownVo.getIds().forEach(id-> unDeploy(Convert.toStr(id)));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -571,9 +569,7 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
sysSystemBusPermsLinkMapper.delete(new LambdaQueryWrapper<SysSystemBusPermsLink>()
|
|
|
.eq(SysSystemBusPermsLink::getPermsId, sysSystemBusPermsVo.getId())
|
|
|
);
|
|
|
- sysSystemBusPermsLink.forEach(link->{
|
|
|
- link.setPermsId(sysSystemBusPerms.getId());
|
|
|
- });
|
|
|
+ sysSystemBusPermsLink.forEach(link-> link.setPermsId(sysSystemBusPerms.getId()));
|
|
|
sysSystemBusPermsLinkMapper.insert(sysSystemBusPermsLink);
|
|
|
return true;
|
|
|
}
|
|
|
@@ -588,15 +584,18 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
|
|
|
List<SysSystemBusPermsLink> sysSystemBusPermsLinks = sysSystemBusPermsLinkMapper.selectList(new LambdaQueryWrapper<SysSystemBusPermsLink>()
|
|
|
.eq(SysSystemBusPermsLink::getPermsId, sysSystemBusPerms.getId()));
|
|
|
-
|
|
|
- SysSystemBusPermsVo sysSystemBusPermsVo = new SysSystemBusPermsVo(sysSystemBusPerms,sysSystemBusPermsLinks);
|
|
|
-
|
|
|
- return sysSystemBusPermsVo;
|
|
|
+ return new SysSystemBusPermsVo(sysSystemBusPerms,sysSystemBusPermsLinks);
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
|
SysUserJzgInfoService sysUserJzgInfoService;
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据租户获取保司信息
|
|
|
+ * @param systemCode 租户代码
|
|
|
+ * @author lipf
|
|
|
+ * @date 2026/3/25 17:07
|
|
|
+ */
|
|
|
@Override
|
|
|
public List<EsmInsCompany> getUserCompany(String systemCode) {
|
|
|
SysSystemBusPermsVo busPerms = getBusPerms(systemCode);
|
|
|
@@ -605,31 +604,34 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
companyIds = busPerms.getQuoteCompanyList();
|
|
|
}
|
|
|
List<EsmInsCompany> companyList = new ArrayList<>();
|
|
|
-// if(!companyIds.isEmpty()) {
|
|
|
companyList = baseMapper.getCompanyList(companyIds);
|
|
|
-// }
|
|
|
- System.out.printf("------------------------------------------------------------1");
|
|
|
+ log.info("租户代码[{}]匹配到保险公司[{}]个。",systemCode, CollUtil.size(companyList));
|
|
|
+ //log.debug("匹配到的保险公司分别是[{}]", JSONUtil.toJsonStr(companyList));
|
|
|
// 根据用户权限获取 可使用的协议
|
|
|
- List<String> companyIdList = companyList.stream().map(x -> x.getId()).collect(Collectors.toList());
|
|
|
+ List<String> companyIdList = companyList.stream().map(EsmInsCompany::getId).collect(Collectors.toList());
|
|
|
String userDeptId = baseController.getUserDeptId();
|
|
|
if (StringUtils.isEmpty(userDeptId)){
|
|
|
SysUserJzgInfo userByUserId = sysUserJzgInfoService.getUserByUserId(baseController.getUserId(), systemCode);
|
|
|
userDeptId = userByUserId.getDeptId();
|
|
|
}
|
|
|
- System.out.printf("------------------------------------------------------------2");
|
|
|
List<PtlAgreement> userAgreement = ptlAgreementService.getUserAgreementByCompanyIds(userDeptId, companyIdList);
|
|
|
+ log.info("租户[{}],userDeptId= [{}] 匹配保险公司的协议[{}]个", systemCode, userDeptId, CollUtil.size(userAgreement));
|
|
|
|
|
|
Map<String, List<PtlAgreement>> groupedMap = userAgreement.stream()
|
|
|
.collect(Collectors.groupingBy(PtlAgreement::getCompanyId));
|
|
|
- System.out.printf("------------------------------------------------------------3");
|
|
|
+ log.info("租户[{}]匹配到的协议按照保司分类,分为[{}]个", systemCode, CollUtil.size(groupedMap));
|
|
|
+ log.info("groupedMap.keys = [{}]", JSONUtil.toJsonPrettyStr(groupedMap.keySet()));
|
|
|
+ var ids = companyList.stream().map(EsmInsCompany::getId).toList();
|
|
|
+ log.info("ids=[{}]",JSONUtil.toJsonStr(ids));
|
|
|
companyList.forEach(company->{
|
|
|
if(groupedMap.containsKey(company.getId())){
|
|
|
company.setAgreements(groupedMap.get(company.getId()));
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- companyList = companyList.stream().filter(x -> Objects.nonNull(x.getAgreements()) && x.getAgreements().size() > 0).collect(Collectors.toList());
|
|
|
+ companyList = companyList.stream().filter(x -> Objects.nonNull(x.getAgreements()) && !x.getAgreements().isEmpty()).collect(Collectors.toList());
|
|
|
|
|
|
+ log.info("租户匹配到的保司个数[{}]",CollUtil.size(companyList));
|
|
|
return companyList;
|
|
|
}
|
|
|
|