Commit c05bc689 authored by hezhuozhi's avatar hezhuozhi

Merge branch 'wofkflow0620' of…

Merge branch 'wofkflow0620' of http://36.40.66.175:5000/moa/jxdj_zx/amos-boot-zx-biz into wofkflow0620
parents 7c2e8f65 fbd64cc4
...@@ -35,12 +35,15 @@ ...@@ -35,12 +35,15 @@
<if test="params.type == 3 "> <if test="params.type == 3 ">
and info.status in ('待整改','整改未完成') and info.status in ('待整改','整改未完成')
</if> </if>
<if test="params.status != null and params.status != ''">
and info.status = #{params.status}
</if>
</where> </where>
ORDER BY ORDER BY
info.rec_date DESC ,hph.sequence_nbr ASC ) as sta info.rec_date DESC ,hph.sequence_nbr ASC ) as sta
<where>
<if test="params.status != null and params.status != ''">
and sta.status = #{params.status}
</if>
</where>
</select> </select>
<select id="selectDataInfo" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.FinancingInfoDto"> <select id="selectDataInfo" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.FinancingInfoDto">
SELECT SELECT
......
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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;
...@@ -8,10 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -8,10 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.Enum.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.DealerReviewEnum; import com.yeejoin.amos.boot.module.hygf.api.Enum.DealerReviewEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.FlowStatusEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.TaskStatusEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.*; import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.*; import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.fegin.IdxFeginService; import com.yeejoin.amos.boot.module.hygf.api.fegin.IdxFeginService;
...@@ -29,7 +28,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel; ...@@ -29,7 +28,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import io.seata.spring.annotation.GlobalTransactional; import com.yeejoin.amos.feign.systemctl.model.SmsRecordModel;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -54,21 +53,22 @@ import java.util.stream.Stream; ...@@ -54,21 +53,22 @@ import java.util.stream.Stream;
* @date 2023-07-07 * @date 2023-07-07
*/ */
@Service @Service
public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, UnitInfoMapper> implements IUnitInfoService { public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitInfoMapper> implements IUnitInfoService {
private static final String regionRedis = "app_region_redis";
private static final String OPERATION_TYPE_SUBMIT = "submit";
private static final String OPERATION_TYPE_APPLY = "apply";
private static final String IDX_REQUEST_STATE = "200";
private static final String VERIFY_RESULT_YES = "0";
private static final String VERIFY_RESULT_NO = "1";
private static final String SMSTEMPCODENO = "SMS_HYGF_0003";
private static final String SMSTEMPCODEYES = "SMS_HYGF_0004";
String COMPANY_TREE_REDIS_KEY = "REGULATOR_UNIT_TREE"; String COMPANY_TREE_REDIS_KEY = "REGULATOR_UNIT_TREE";
@Value("${regulator.unit.code}")
private String code;
@Value("${dealer.appcode}")
private String appCodes;
@Autowired @Autowired
RedisUtils redisUtil; RedisUtils redisUtil;
@Autowired @Autowired
PrivilegeFeginService privilegeFeginService; PrivilegeFeginService privilegeFeginService;
@Autowired @Autowired
CommerceInfoServiceImpl commerceInfoService; CommerceInfoServiceImpl commerceInfoService;
@Autowired @Autowired
...@@ -85,67 +85,67 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -85,67 +85,67 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
PublicAgencyUserMapper publicAgencyUserMapper; PublicAgencyUserMapper publicAgencyUserMapper;
@Autowired @Autowired
IDealerReviewService dealerReviewService; IDealerReviewService dealerReviewService;
@Autowired
IdxFeginService idxFeginService;
@Autowired
DealerReviewMapper dealerReviewMapper;
@Autowired
AmosRequestContext requestContext;
@Autowired
PersonnelBusinessMapper personnelBusinessMapper;
@Autowired
WorkflowImpl workflow;
@Autowired
UserEmpowerMapper userEmpowerMapper;
@Value("${regulator.unit.code}")
private String code;
@Value("${dealer.appcode}")
private String appCodes;
@Value("${hygf.user.group.id}") @Value("${hygf.user.group.id}")
private long userGroupId; private long userGroupId;
@Value("${regionalCompanies.company.seq}") @Value("${regionalCompanies.company.seq}")
private Long regionalCompanies; private Long regionalCompanies;
@Autowired
IdxFeginService idxFeginService;
private static final String regionRedis="app_region_redis";
private static final String OPERATION_TYPE_SUBMIT="submit";
private static final String OPERATION_TYPE_APPLY="apply";
private static final String IDX_REQUEST_STATE="200";
private static final String VERIFY_RESULT_YES="0";
private static final String VERIFY_RESULT_NO="1";
@Autowired
DealerReviewMapper dealerReviewMapper;
@Value("${power.station.examine.pageId}") @Value("${power.station.examine.pageId}")
private long pageId; private long pageId;
@Autowired
AmosRequestContext requestContext;
@Value("${unitInfo.station.examine.planId}") @Value("${unitInfo.station.examine.planId}")
private String planId; private String planId;
@Value("${amos.system.user.product}") @Value("${amos.system.user.product}")
private String AMOS_STUDIO_WEB; private String AMOS_STUDIO_WEB;
@Value("${amos.system.user.app-key}") @Value("${amos.system.user.app-key}")
private String AMOS_STUDIO; private String AMOS_STUDIO;
@Value("${hygf.sms.tempCodeJXS}") @Value("${hygf.sms.tempCodeJXS}")
private String smsTempCode; private String smsTempCode;
@Value("${dealer.managementUnitId}") @Value("${dealer.managementUnitId}")
private String managementUnitId; private String managementUnitId;
@Value("${dealer.roleId}") @Value("${dealer.roleId}")
private String roleId; private String roleId;
@Autowired @Autowired
private CommonServiceImpl commonService; PersonnelBusinessMapper personnelBusinessMapper;
private static List<LinkedHashMap> findNodesByCondition(List<LinkedHashMap> nodes, String conditionName, @Autowired
String condition, String childName) { WorkflowImpl workflow;
return nodes.stream()
.flatMap(node -> Stream.concat( @Autowired
node.get(conditionName).equals(condition) ? Stream.of(node) : Stream.empty(), UserEmpowerMapper userEmpowerMapper;
node.get(childName) != null ? findNodesByCondition((List<LinkedHashMap>) node.get(childName),
conditionName, condition, condition).stream() : private static final String SMSTEMPCODENO="SMS_HYGF_0003";
Stream.empty()
))
.collect(Collectors.toList());
}
private static final String SMSTEMPCODEYES="SMS_HYGF_0004";
/** /**
* 分页查询 * 分页查询
*/ */
public Page<UnitInfoDto> queryForUnitInfoPage(Page<UnitInfoDto> page) { public Page<UnitInfoDto> queryForUnitInfoPage(Page<UnitInfoDto> page) {
return this.queryForPage(page, null, false); return this.queryForPage(page, null, false);
} }
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<UnitInfoDto> queryForUnitInfoList() { public List<UnitInfoDto> queryForUnitInfoList() {
return this.queryForList("", false); return this.queryForList("" , false);
} }
@Override @Override
...@@ -162,7 +162,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -162,7 +162,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
} }
@Override @Override
@GlobalTransactional @Transactional
public UnitRegisterDto registerUnit(UnitRegisterDto model) { public UnitRegisterDto registerUnit(UnitRegisterDto model) {
UnitInfoDto regUnitInfo = model.getUnitInfoDto(); UnitInfoDto regUnitInfo = model.getUnitInfoDto();
...@@ -171,15 +171,15 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -171,15 +171,15 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
regUnitInfo.setManagementUnit("经销商"); regUnitInfo.setManagementUnit("经销商");
try { try {
// 1. 调用平台进行创建单位、用户信息 // 1. 调用平台进行创建单位、用户信息
// this.createCompanyAndUser(regUnitInfo); // this.createCompanyAndUser(regUnitInfo);
// 2.插入单位表 // 2.插入单位表
// regUnitInfo = this.createWithModel(regUnitInfo); // regUnitInfo = this.createWithModel(regUnitInfo);
regUnitInfo = this.createWithModelnew(regUnitInfo); regUnitInfo = this.createWithModelnew(regUnitInfo);
CommerceInfoDto commerceInfo = model.getCommerceInfoDto(); CommerceInfoDto commerceInfo = model.getCommerceInfoDto();
commerceInfo.setUnitSeq(regUnitInfo.getSequenceNbr()); commerceInfo.setUnitSeq(regUnitInfo.getSequenceNbr());
commerceInfo = commerceInfoService.createWithModel(commerceInfo); commerceInfo = commerceInfoService.createWithModel(commerceInfo);
List<RegionalCompanies> regionalCompanies = regUnitInfo.getRegionalCompanies(); List<RegionalCompanies> regionalCompanies= regUnitInfo.getRegionalCompanies();
for (RegionalCompanies regionalCompany : regionalCompanies) { for (RegionalCompanies regionalCompany : regionalCompanies) {
regionalCompany.setUnitId(regUnitInfo.getAmosCompanySeq()); regionalCompany.setUnitId(regUnitInfo.getAmosCompanySeq());
regionalCompany.setUnitInfoId(regUnitInfo.getSequenceNbr()); regionalCompany.setUnitInfoId(regUnitInfo.getSequenceNbr());
...@@ -231,8 +231,20 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -231,8 +231,20 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
return model; return model;
} }
private static List<LinkedHashMap> findNodesByCondition(List<LinkedHashMap> nodes, String conditionName,
String condition, String childName) {
return nodes.stream()
.flatMap(node -> Stream.concat(
node.get(conditionName).equals(condition) ? Stream.of(node) : Stream.empty(),
node.get(childName) != null ? findNodesByCondition((List<LinkedHashMap>) node.get(childName),
conditionName, condition, condition).stream() :
Stream.empty()
))
.collect(Collectors.toList());
}
private List<LinkedHashMap> creatTree() { private List<LinkedHashMap> creatTree() {
FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct()); FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(),RequestContext.getAppKey(),RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult(); List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> treeData = deleteRegulatorTreeData(result); List<LinkedHashMap> treeData = deleteRegulatorTreeData(result);
List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList()); List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList());
...@@ -308,8 +320,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -308,8 +320,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
companyInfo.setLandlinePhone(regUnitInfo.getHeadPhone()); companyInfo.setLandlinePhone(regUnitInfo.getHeadPhone());
FeignClientResult<CompanyModel> companyResult = Privilege.companyClient.create(companyInfo); FeignClientResult<CompanyModel> companyResult = Privilege.companyClient.create(companyInfo);
if (companyResult == null || companyResult.getStatus() != 200) { if (companyResult == null || companyResult.getStatus()!=200) {
throw new BadRequest("单位注册失败!" + companyResult.getDevMessage()); throw new BadRequest("单位注册失败!"+companyResult.getDevMessage());
} }
String adminUserName = regUnitInfo.getAdminUserName(); String adminUserName = regUnitInfo.getAdminUserName();
...@@ -345,8 +357,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -345,8 +357,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
agencyUserModel.setOrgRoleSeqs(roleSeqMap); agencyUserModel.setOrgRoleSeqs(roleSeqMap);
userResult = Privilege.agencyUserClient.create(agencyUserModel); userResult = Privilege.agencyUserClient.create(agencyUserModel);
if (userResult == null || userResult.getStatus() != 200) { if (userResult == null || userResult.getStatus()!=200) {
throw new BadRequest("单位注册失败!" + userResult.getDevMessage()); throw new BadRequest("单位注册失败!"+userResult.getDevMessage());
} }
regUnitInfo.setAdminUserId(userResult.getResult().getUserId()); regUnitInfo.setAdminUserId(userResult.getResult().getUserId());
regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr()); regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr());
...@@ -376,7 +388,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -376,7 +388,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
FeignClientResult<AgencyUserModel> userResult = null; FeignClientResult<AgencyUserModel> userResult = null;
try { try {
//FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null, null); //FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null, null);
// List<RoleModel> allRoleList = roleListResult.getResult(); // List<RoleModel> allRoleList = roleListResult.getResult();
List<RoleModel> userRoleList = new ArrayList<>(); List<RoleModel> userRoleList = new ArrayList<>();
List<Long> roleIds = new ArrayList<>(); List<Long> roleIds = new ArrayList<>();
// 1创建公司 // 1创建公司
...@@ -385,14 +397,14 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -385,14 +397,14 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
companyInfo.setParentId(Long.parseLong(regUnitInfo.getManagementUnitId())); companyInfo.setParentId(Long.parseLong(regUnitInfo.getManagementUnitId()));
companyInfo.setLevel("station"); companyInfo.setLevel("station");
companyInfo.setCompanyName(regUnitInfo.getName()); companyInfo.setCompanyName(regUnitInfo.getName());
// companyInfo.setCompanyCode(regUnitInfo.getUnitType()); // companyInfo.setCompanyCode(regUnitInfo.getUnitType());
companyInfo.setContact(regUnitInfo.getHeadName()); companyInfo.setContact(regUnitInfo.getHeadName());
companyInfo.setCompanyType(regUnitInfo.getUnitType()); companyInfo.setCompanyType(regUnitInfo.getUnitType());
companyInfo.setLandlinePhone(regUnitInfo.getHeadPhone()); companyInfo.setLandlinePhone(regUnitInfo.getHeadPhone());
FeignClientResult<CompanyModel> companyResult = Privilege.companyClient.create(companyInfo); FeignClientResult<CompanyModel> companyResult = Privilege.companyClient.create(companyInfo);
if (companyResult == null || companyResult.getStatus() != 200) { if (companyResult == null || companyResult.getStatus()!=200) {
throw new BadRequest("单位注册失败!" + companyResult.getDevMessage()); throw new BadRequest("单位注册失败!"+companyResult.getDevMessage());
} }
String adminUserName = regUnitInfo.getAdminUserName(); String adminUserName = regUnitInfo.getAdminUserName();
...@@ -419,7 +431,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -419,7 +431,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
// roleIds.add(r.getSequenceNbr()); // roleIds.add(r.getSequenceNbr());
// } // }
// }); // });
// roleIds.add(Long.valueOf(regUnitInfo.getRoleId())); // roleIds.add(Long.valueOf(regUnitInfo.getRoleId()));
roleIds.add(userGroupId); roleIds.add(userGroupId);
roleSeqMap.put(companyInfo.getSequenceNbr(), roleIds); roleSeqMap.put(companyInfo.getSequenceNbr(), roleIds);
...@@ -428,8 +440,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -428,8 +440,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
agencyUserModel.setOrgRoleSeqs(roleSeqMap); agencyUserModel.setOrgRoleSeqs(roleSeqMap);
userResult = Privilege.agencyUserClient.create(agencyUserModel); userResult = Privilege.agencyUserClient.create(agencyUserModel);
if (userResult == null || userResult.getStatus() != 200) { if (userResult == null || userResult.getStatus()!=200) {
throw new BadRequest("单位注册失败!" + userResult.getDevMessage()); throw new BadRequest("单位注册失败!"+userResult.getDevMessage());
} }
regUnitInfo.setAdminUserId(userResult.getResult().getUserId()); regUnitInfo.setAdminUserId(userResult.getResult().getUserId());
regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr()); regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr());
...@@ -453,17 +465,18 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -453,17 +465,18 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
} }
public UnitInfoDto createWithModelnew(UnitInfoDto regUnitInfo) { public UnitInfoDto createWithModelnew(UnitInfoDto regUnitInfo){
regUnitInfo.setBlacklist(1); regUnitInfo.setBlacklist(1);
regUnitInfo.setAuditStatus(1); regUnitInfo.setAuditStatus(1);
regUnitInfo.setManagementUnit("经销商事业部"); regUnitInfo.setManagementUnit("经销商事业部");
regUnitInfo = this.createWithModel(regUnitInfo); regUnitInfo= this.createWithModel(regUnitInfo);
this.submitExamine(regUnitInfo); this.submitExamine(regUnitInfo);
return regUnitInfo; return regUnitInfo;
} }
private void submitExamine(UnitInfoDto regUnitInfo) { private void submitExamine( UnitInfoDto regUnitInfo) {
String taskId = null; String taskId = null;
...@@ -480,11 +493,11 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -480,11 +493,11 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
processDto.setBusinessKey(String.valueOf(regUnitInfo.getSequenceNbr())); processDto.setBusinessKey(String.valueOf(regUnitInfo.getSequenceNbr()));
processDto.setProcessDefinitionKey("JXS_SH"); processDto.setProcessDefinitionKey("JXS_SH");
StartProcessDto startProcessDto = new StartProcessDto(); StartProcessDto startProcessDto = new StartProcessDto();
List<ProcessDto> process = new ArrayList<>(); List<ProcessDto> process=new ArrayList<>();
process.add(processDto); process.add(processDto);
startProcessDto.setProcess(process); startProcessDto.setProcess(process);
BasicGridAcceptance basicGridAcceptance = new BasicGridAcceptance(); BasicGridAcceptance basicGridAcceptance=new BasicGridAcceptance();
workflow.startProcessnew(AMOS_STUDIO, AMOS_STUDIO_WEB, requestContext.getToken(), basicGridAcceptance, startProcessDto, requestContext.getUserId()); workflow.startProcessnew(AMOS_STUDIO, AMOS_STUDIO_WEB,requestContext.getToken(),basicGridAcceptance, startProcessDto,requestContext.getUserId());
// 插入记录表 // 插入记录表
dealerReview.setPlanInstanceId(planId); dealerReview.setPlanInstanceId(planId);
dealerReview.setUnitInfoId(regUnitInfo.getSequenceNbr()); dealerReview.setUnitInfoId(regUnitInfo.getSequenceNbr());
...@@ -493,15 +506,15 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -493,15 +506,15 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
dealerReview.setFlowTaskId(basicGridAcceptance.getNextTaskId()); dealerReview.setFlowTaskId(basicGridAcceptance.getNextTaskId());
dealerReview.setNodeRole(basicGridAcceptance.getNextExecutorIds()); dealerReview.setNodeRole(basicGridAcceptance.getNextExecutorIds());
dealerReview.setNextProcessNode(DealerReviewEnum.经销商管理员审核.getCode()); dealerReview.setNextProcessNode(DealerReviewEnum.经销商管理员审核.getCode());
dealerReviewService.saveDealerReview(dealerReview, true, false, regUnitInfo.getName(), "任务明细:经销商已上传信息"); dealerReviewService.saveDealerReview(dealerReview,true,false,regUnitInfo.getName(),"任务明细:经销商已上传信息");
//发起待办 } catch (Exception e){
// commonService.buildTaskModel(buildJXSSHTaskModel(regUnitInfo, basicGridAcceptance)); throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!");
} catch (Exception e) {
throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!");
} }
// //
// String taskId = null; // String taskId = null;
// Map<String, Object> objectMap = new HashMap<>(1); // Map<String, Object> objectMap = new HashMap<>(1);
...@@ -540,53 +553,19 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -540,53 +553,19 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
// } // }
} }
/**
*
* @param regUnitInfo
* @param basicGridAcceptance
*/
private List<TaskModelDto> buildJXSSHTaskModel(UnitInfoDto regUnitInfo, BasicGridAcceptance basicGridAcceptance) {
List<TaskModelDto> taskModelDtoList = new ArrayList<>();
TaskModelDto taskModelDto = new TaskModelDto();
taskModelDto.setFlowCode(basicGridAcceptance.getNextTaskId());
taskModelDto.setFlowCreateDate(new Date());
taskModelDto.setFlowStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode());
taskModelDto.setFlowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
taskModelDto.setPageType(null);
taskModelDto.setExecuteUserIds(basicGridAcceptance.getNextExecuteUserIds());
taskModelDto.setModel(regUnitInfo);
taskModelDto.setRelationId(basicGridAcceptance.getInstanceId());
taskModelDto.setRoutePath(null);
taskModelDto.setStartUserId(basicGridAcceptance.getRecUserId());
taskModelDto.setStartUser(basicGridAcceptance.getRecUserName());
taskModelDto.setStartDate(basicGridAcceptance.getRecDate());
taskModelDto.setStartUserCompanyName(regUnitInfo.getRegionalCompaniesName());
taskModelDto.setTaskName(basicGridAcceptance.getNextNodeName());
taskModelDto.setTaskCode(String.valueOf(basicGridAcceptance.getWorkOrderId()));
taskModelDto.setTaskType(BusinessTypeEnum.HYGF_JXS_SH.getCode());
taskModelDto.setTaskTypeLabel(BusinessTypeEnum.HYGF_JXS_SH.getName());
taskModelDto.setTaskStatus(TaskStatusEnum.UNDERWAY.getValue());
taskModelDto.setTaskStatusLabel(TaskStatusEnum.UNDERWAY.getName());
// taskModelDto.setTaskDesc();
// taskModelDto.setTaskContent();
taskModelDto.setNextExecuteUser(basicGridAcceptance.getNextExecutorIds());
taskModelDtoList.add(taskModelDto);
return taskModelDtoList;
}
@Override @Override
@GlobalTransactional @Transactional
public String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId, String planInstanceId, Map<String, Object> kv) { public String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId, String planInstanceId, Map<String, Object> kv) {
// 2.更新审核记录表 // 2.更新审核记录表
UnitInfo unitInfo = null; UnitInfo unitInfo=null;
try { try{
DealerReview dealerReview = dealerReviewMapper.selectOne(new QueryWrapper<DealerReview>().eq("unit_info_id", stationId)); DealerReview dealerReview= dealerReviewMapper.selectOne(new QueryWrapper<DealerReview>().eq("unit_info_id", stationId));
unitInfo = this.getById(stationId); unitInfo= this.getById(stationId);
DealerReviewEnum nodeByCode = DealerReviewEnum.getNodeByCode(nodeCode); DealerReviewEnum nodeByCode = DealerReviewEnum.getNodeByCode(nodeCode);
String approvalStatue = ""; String approvalStatue="";
if (DealerReviewEnum.经销商管理员审核.getCode().equals(nodeCode)) { if (DealerReviewEnum.经销商管理员审核.getCode().equals(nodeCode)) {
String result = String.valueOf(kv.get("approvalStatus")); String result = String.valueOf(kv.get("approvalStatus"));
if (VERIFY_RESULT_NO.equals(result)) { if (VERIFY_RESULT_NO.equals(result)) {
...@@ -595,41 +574,41 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -595,41 +574,41 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
//发送断线 //发送断线
Boolean flag = true; Boolean flag = true;
HashMap<String, String> params = new HashMap<>(3); HashMap<String, String> params = new HashMap<>(3);
String meg = String.valueOf(kv.get("approveInfo")); String meg= String.valueOf(kv.get("approveInfo"));
params.put("code", "不通过"); params.put("code","不通过");
params.put("mobile", unitInfo.getAdminPhone()); params.put("mobile",unitInfo.getAdminPhone());
params.put("smsCode", SMSTEMPCODENO); params.put("smsCode", SMSTEMPCODENO);
approvalStatue = "任务明细:" + DealerReviewEnum.经销商管理员审核.getName() + "审核不通过"; approvalStatue="任务明细:"+DealerReviewEnum.经销商管理员审核.getName()+"审核不通过";
// FeignClientResult<SmsRecordModel> date= Systemctl.smsClient.sendCommonSms(params); // FeignClientResult<SmsRecordModel> date= Systemctl.smsClient.sendCommonSms(params);
// System.out.println("短信通知============================"+JSON.toJSONString(date)); // System.out.println("短信通知============================"+JSON.toJSONString(date));
} else { }else{
// 1. 更新经销商状态 // 1. 更新经销商状态
unitInfo.setAuditStatus(2); unitInfo.setAuditStatus(2);
unitInfo.setBlacklist(0); unitInfo.setBlacklist(0);
this.createCompanyAndUsernew(unitInfo); this.createCompanyAndUsernew(unitInfo);
PublicAgencyUser publicAgencyUser = new PublicAgencyUser(); PublicAgencyUser publicAgencyUser=new PublicAgencyUser();
publicAgencyUser.setAmosUserId(unitInfo.getAdminUserId()); publicAgencyUser.setAmosUserId(unitInfo.getAdminUserId());
publicAgencyUser.setAmosUserName(unitInfo.getAdminLoginName()); publicAgencyUser.setAmosUserName(unitInfo.getAdminLoginName());
publicAgencyUser.setRealName(unitInfo.getAdminLoginName()); publicAgencyUser.setRealName(unitInfo.getAdminLoginName());
publicAgencyUser.setRole("[" + unitInfo.getRoleId() + "]"); publicAgencyUser.setRole("["+unitInfo.getRoleId()+"]");
publicAgencyUser.setEmergencyTelephone(unitInfo.getAdminPhone()); publicAgencyUser.setEmergencyTelephone(unitInfo.getAdminPhone());
publicAgencyUser.setLockStatus("UNLOCK"); publicAgencyUser.setLockStatus("UNLOCK");
publicAgencyUserMapper.insert(publicAgencyUser); publicAgencyUserMapper.insert(publicAgencyUser);
List<String> lis = new ArrayList<>(); List<String> lis=new ArrayList<>();
// lis.add(unitInfo.getAmosCompanyCode()); // lis.add(unitInfo.getAmosCompanyCode());
LambdaQueryWrapper<RegionalCompanies> queryWrapper = new LambdaQueryWrapper<RegionalCompanies>(); LambdaQueryWrapper<RegionalCompanies> queryWrapper = new LambdaQueryWrapper<RegionalCompanies>();
queryWrapper.eq(RegionalCompanies::getUnitInfoId, unitInfo.getSequenceNbr()); queryWrapper.eq(RegionalCompanies::getUnitInfoId, unitInfo.getSequenceNbr());
List<RegionalCompanies> list = regionalCompaniesMapper.selectList(queryWrapper); List<RegionalCompanies> list= regionalCompaniesMapper.selectList(queryWrapper);
for (RegionalCompanies companies : list) { for (RegionalCompanies companies : list) {
companies.setUnitId(unitInfo.getAmosCompanySeq()); companies.setUnitId(unitInfo.getAmosCompanySeq());
lis.add(companies.getRegionalCompaniesCode()); lis.add(companies.getRegionalCompaniesCode());
} }
regionalCompaniesService.saveOrUpdateBatch(list); regionalCompaniesService.saveOrUpdateBatch(list);
PersonnelBusiness re = new PersonnelBusiness(); PersonnelBusiness re=new PersonnelBusiness();
re.setAmosDealerId(unitInfo.getAmosCompanySeq()); re.setAmosDealerId(unitInfo.getAmosCompanySeq());
re.setAmosUnitId(unitInfo.getAmosCompanySeq()); re.setAmosUnitId(unitInfo.getAmosCompanySeq());
re.setAmosUnitName(unitInfo.getName()); re.setAmosUnitName(unitInfo.getName());
...@@ -639,14 +618,14 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -639,14 +618,14 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
personnelBusinessMapper.insert(re); personnelBusinessMapper.insert(re);
//管理员绑定角色权限 //管理员绑定角色权限
StdUserEmpower stdUserEmpower = new StdUserEmpower(); StdUserEmpower stdUserEmpower=new StdUserEmpower();
stdUserEmpower.setAmosUserId(unitInfo.getAdminUserId()); stdUserEmpower.setAmosUserId(unitInfo.getAdminUserId());
stdUserEmpower.setAmosOrgCode(lis); stdUserEmpower.setAmosOrgCode(lis);
stdUserEmpower.setPermissionType("HYGF"); stdUserEmpower.setPermissionType("HYGF");
userEmpowerMapper.insert(stdUserEmpower); userEmpowerMapper.insert(stdUserEmpower);
// Privilege.agencyUserClient.unlockUsers(unitInfo.getAdminUserId()); // Privilege.agencyUserClient.unlockUsers(unitInfo.getAdminUserId());
approvalStatue = "任务明细:" + DealerReviewEnum.经销商管理员审核.getName() + "审核通过"; approvalStatue="任务明细:"+DealerReviewEnum.经销商管理员审核.getName()+"审核通过";
// HashMap<String, String> params = new HashMap<>(3); // HashMap<String, String> params = new HashMap<>(3);
// params.put("code","通过"); // params.put("code","通过");
// params.put("mobile",unitInfo.getAdminPhone()); // params.put("mobile",unitInfo.getAdminPhone());
...@@ -661,27 +640,29 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -661,27 +640,29 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
// 3. 工作流执行 // 3. 工作流执行
//执行工作流 //执行工作流
BasicGridAcceptance basicGridAcceptance = new BasicGridAcceptance(); BasicGridAcceptance basicGridAcceptance=new BasicGridAcceptance();
StandardDto standardDto = new StandardDto(); StandardDto standardDto = new StandardDto();
standardDto.setComment(kv.get("approvalInfo") != null ? String.valueOf(kv.get("approvalInfo")) : ""); standardDto.setComment(kv.get("approvalInfo")!=null?String.valueOf(kv.get("approvalInfo")):"");
standardDto.setResult(String.valueOf(kv.get("approvalStatus"))); standardDto.setResult(String.valueOf(kv.get("approvalStatus")));
standardDto.setTaskId(dealerReview.getFlowTaskId()); standardDto.setTaskId(dealerReview.getFlowTaskId());
VariableDto variable = new VariableDto(); VariableDto variable = new VariableDto();
variable.setApprovalStatus(String.valueOf(kv.get("approvalStatus"))); variable.setApprovalStatus(String.valueOf(kv.get("approvalStatus")));
variable.setComment(kv.get("approvalInfo") != null ? String.valueOf(kv.get("approvalInfo")) : ""); variable.setComment(kv.get("approvalInfo")!=null?String.valueOf(kv.get("approvalInfo")):"");
variable.setOperationTime(String.valueOf(kv.get("approveDate"))); variable.setOperationTime(String.valueOf(kv.get("approveDate")));
variable.setOperator(String.valueOf(kv.get("approveName"))); variable.setOperator(String.valueOf(kv.get("approveName")));
standardDto.setVariable(variable); standardDto.setVariable(variable);
BasicGridAcceptance workBasicGridAcceptance = workflow.standard(basicGridAcceptance, standardDto, requestContext.getUserId()); BasicGridAcceptance workBasicGridAcceptance = workflow.standard(basicGridAcceptance, standardDto, requestContext.getUserId());
dealerReview.setFlowTaskId(basicGridAcceptance.getNextTaskId()); dealerReview.setFlowTaskId(basicGridAcceptance.getNextTaskId());
dealerReviewService.saveDealerReview(dealerReview, false, true, unitInfo.getName(), approvalStatue); dealerReviewService.saveDealerReview(dealerReview,false,true,unitInfo.getName(),approvalStatue);
this.saveOrUpdate(unitInfo); this.saveOrUpdate(unitInfo);
//更新待办 //更新待办
// commonService.updateTaskModelNew(buildJXSSHUpdateTaskModel(basicGridAcceptance, unitInfo, kv)); // commonService.updateTaskModelNew(buildJXSSHUpdateTaskModel(basicGridAcceptance, unitInfo, kv));
} catch (Exception e) {
}catch (Exception e){
if (!ObjectUtils.isEmpty(unitInfo.getAmosCompanySeq())) { if (!ObjectUtils.isEmpty(unitInfo.getAmosCompanySeq())) {
FeignClientResult<CompanyModel> feignClientResult = Privilege.companyClient FeignClientResult<CompanyModel> feignClientResult = Privilege.companyClient
...@@ -700,13 +681,15 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -700,13 +681,15 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
} }
e.printStackTrace(); e.printStackTrace();
throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!"); throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!");
} }
// // 2.更新审核记录表 // // 2.更新审核记录表
// UnitInfo unitInfo=null; // UnitInfo unitInfo=null;
// try{ // try{
...@@ -838,7 +821,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -838,7 +821,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
@Override @Override
public IPage<CompanyDto> getCompanyDto(CompanyDto dto) { public IPage<CompanyDto> getCompanyDto(CompanyDto dto) {
//列表数据组装 //列表数据组装
IPage<CompanyDto> pag = unitInfoMapper.getCompanyDto(dto); IPage<CompanyDto> pag = unitInfoMapper.getCompanyDto( dto);
// List<CompanyDto> pag = unitInfoMapper.getCompanyDto( (page.getCurrent()-1)*page.getSize(),page.getSize(),dto); // List<CompanyDto> pag = unitInfoMapper.getCompanyDto( (page.getCurrent()-1)*page.getSize(),page.getSize(),dto);
//// Map<String,Integer> count = unitInfoMapper.getCompanyDtoCount(dto); //// Map<String,Integer> count = unitInfoMapper.getCompanyDtoCount(dto);
//// page.setTotal(count.get("num")); //// page.setTotal(count.get("num"));
...@@ -847,115 +830,119 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -847,115 +830,119 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
} }
//单位详情 //单位详情
public UnitDataDto getUnitDataDto(Long id) { public UnitDataDto getUnitDataDto(Long id){
LambdaQueryWrapper<UnitInfo> queryWrapper = new LambdaQueryWrapper<UnitInfo>(); LambdaQueryWrapper<UnitInfo> queryWrapper = new LambdaQueryWrapper<UnitInfo>();
queryWrapper.eq(UnitInfo::getAmosCompanySeq, id); queryWrapper.eq(UnitInfo::getAmosCompanySeq, id);
UnitInfo unitInfo = unitInfoMapper.selectOne(queryWrapper); UnitInfo unitInfo= unitInfoMapper.selectOne(queryWrapper);
LambdaQueryWrapper<CommerceInfo> queryWrapper1 = new LambdaQueryWrapper<CommerceInfo>(); LambdaQueryWrapper<CommerceInfo> queryWrapper1 = new LambdaQueryWrapper<CommerceInfo>();
queryWrapper1.eq(CommerceInfo::getUnitSeq, unitInfo.getSequenceNbr()); queryWrapper1.eq(CommerceInfo::getUnitSeq, unitInfo.getSequenceNbr());
CommerceInfo commerceInfo = commerceInfoMapper.selectOne(queryWrapper1); CommerceInfo commerceInfo= commerceInfoMapper.selectOne(queryWrapper1);
//单位管理 //单位管理
UnitInformation unitInformation = new UnitInformation(); UnitInformation unitInformation=new UnitInformation();
//工商信息 //工商信息
CommerceDto commerceDto = new CommerceDto(); CommerceDto commerceDto=new CommerceDto();
//管理员账号 //管理员账号
Account cccount = new Account(); Account cccount=new Account();
BeanUtils.copyProperties(unitInfo, unitInformation); BeanUtils.copyProperties(unitInfo,unitInformation);
unitInformation.setHeadCardPhotoBack(unitInformation.getHeadCardPhotoBack()); unitInformation.setHeadCardPhotoBack(unitInformation.getHeadCardPhotoBack());
unitInformation.setHeadCardPhotoFront(unitInformation.getHeadCardPhotoFront()); unitInformation.setHeadCardPhotoFront(unitInformation.getHeadCardPhotoFront());
unitInformation.setRegisterPcdCode((unitInformation.getRegisterPcdCode() != null && !"".equals(unitInformation.getRegisterPcdCode())) ? unitInformation.getRegisterPcdCode() : null); unitInformation.setRegisterPcdCode((unitInformation.getRegisterPcdCode()!=null&&!"".equals(unitInformation.getRegisterPcdCode()))?unitInformation.getRegisterPcdCode():null);
unitInformation.setWorkPcdCode((unitInformation.getWorkPcdCode() != null && !"".equals(unitInformation.getWorkPcdCode())) ? unitInformation.getWorkPcdCode() : null); unitInformation.setWorkPcdCode((unitInformation.getWorkPcdCode()!=null&&!"".equals(unitInformation.getWorkPcdCode()))?unitInformation.getWorkPcdCode():null);
BeanUtils.copyProperties(commerceInfo, commerceDto); BeanUtils.copyProperties(commerceInfo,commerceDto);
commerceDto.setBusinessLicensePhoto(commerceDto.getBusinessLicensePhoto()); commerceDto.setBusinessLicensePhoto(commerceDto.getBusinessLicensePhoto());
commerceDto.setLegalPersonCardPhotoBack(commerceDto.getLegalPersonCardPhotoBack()); commerceDto.setLegalPersonCardPhotoBack(commerceDto.getLegalPersonCardPhotoBack());
commerceDto.setLegalPersonCardPhotoFront(commerceDto.getLegalPersonCardPhotoFront()); commerceDto.setLegalPersonCardPhotoFront(commerceDto.getLegalPersonCardPhotoFront());
BeanUtils.copyProperties(unitInfo, cccount); BeanUtils.copyProperties(unitInfo,cccount);
UnitDataDto unitDataDt = new UnitDataDto(unitInformation, commerceDto, cccount); UnitDataDto unitDataDt = new UnitDataDto(unitInformation,commerceDto,cccount);
return unitDataDt; return unitDataDt;
} }
@Transactional
public Boolean updateUnitDataDto(UnitDataDto unitDataDto) {
//验证二维码
UnitInfo unitInfo = new UnitInfo();
unitInfo = unitInfoMapper.selectById(unitDataDto.getUnitInformation().getSequenceNbr());
List<String> lisk = new ArrayList<>();
UnitInformation unitInformation = unitDataDto.getUnitInformation();
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
List<Integer> regist = unitInformation.getRegisterPcdCodeList();
List<Integer> workP = unitInformation.getWorkPcdCodeList();
//注册地址
if (regist != null && !regist.isEmpty()) {
StringBuilder codenameRegi = new StringBuilder();
for (int i = 0, len = regist.size(); i < len; i++) {
for (RegionModel regionModel : list) {
if (regionModel.getRegionCode().intValue() == regist.get(i).intValue()) {
codenameRegi.append(regionModel.getRegionName());
if (i != len - 1) {
codenameRegi.append("-");
}
}
}
}
unitInformation.setRegisterPcd(codenameRegi != null && !"".equals(codenameRegi.toString()) ? codenameRegi.toString() : null);
}
//办公地址
if (workP != null && !workP.isEmpty()) {
StringBuilder codenamework = new StringBuilder();
;
for (int i = 0, len = workP.size(); i < len; i++) {
for (RegionModel regionModel : list) {
if (regionModel.getRegionCode().intValue() == workP.get(i).intValue()) {
codenamework.append(regionModel.getRegionName());
if (i != len - 1) {
codenamework.append("-");
}
}
}
}
unitInformation.setWorkPcd(codenamework != null && !"".equals(codenamework.toString()) ? codenamework.toString() : null);
}
unitInformation.setHeadCardPhotoBackUrl(unitInformation.getHeadCardPhotoBackUrl());
unitInformation.setHeadCardPhotoFrontUrl(unitInformation.getHeadCardPhotoFrontUrl());
unitInformation.setRegisterPcdCodeList(unitInformation.getRegisterPcdCodeList());
unitInformation.setWorkPcdCodeList(unitInformation.getWorkPcdCodeList());
List<Long> dis = unitInformation.getRegionalCompaniesSeq();
List<String> disST = dis.stream().map(x -> x + "").collect(Collectors.toList());
BeanUtils.copyProperties(unitInformation, unitInfo);
CommerceInfo commerceInfo = new CommerceInfo();
commerceInfo = commerceInfoMapper.selectById(unitDataDto.getCommerceDto().getSequenceNbr());
CommerceDto commerceDto = unitDataDto.getCommerceDto();
commerceDto.setBusinessLicensePhotoUrl(commerceDto.getBusinessLicensePhotoUrl());
commerceDto.setLegalPersonCardPhotoBackUrl(commerceDto.getLegalPersonCardPhotoBackUrl());
commerceDto.setLegalPersonCardPhotoFrontUrl(commerceDto.getLegalPersonCardPhotoFrontUrl());
BeanUtils.copyProperties(commerceDto, commerceInfo);
unitInfo.setRegionalCompaniesSeq(disST);
unitInfoMapper.updateById(unitInfo);
commerceInfoMapper.updateById(commerceInfo);
@Transactional(rollbackFor = Exception.class)
public Boolean updateUnitDataDto(UnitDataDto unitDataDto){
//验证二维码
UnitInfo unitInfo=new UnitInfo();
unitInfo= unitInfoMapper.selectById(unitDataDto.getUnitInformation().getSequenceNbr());
UnitInformation unitInformation= unitDataDto.getUnitInformation();
List<Long> dis= unitInformation.getRegionalCompaniesSeq();
//区域公司 //区域公司
LambdaQueryWrapper<RegionalCompanies> qu=new LambdaQueryWrapper<>(); LambdaQueryWrapper<RegionalCompanies> qu=new LambdaQueryWrapper<>();
qu.eq(RegionalCompanies::getUnitId,unitInfo.getAmosCompanySeq()); qu.eq(RegionalCompanies::getUnitId,unitInfo.getAmosCompanySeq());
List<RegionalCompanies> oldList = regionalCompaniesMapper.selectList(qu); List<RegionalCompanies> oldList = regionalCompaniesMapper.selectList(qu);
regionalCompaniesMapper.delete(qu);
List<String> oldDisString = oldList.stream().map((regionalCompanies) -> regionalCompanies.getRegionalCompaniesSeq().toString()).collect(Collectors.toList()); List<String> oldDisString = oldList.stream().map((regionalCompanies) -> regionalCompanies.getRegionalCompaniesSeq().toString()).collect(Collectors.toList());
List<String> newDisString = dis.stream().map((regionalCompaniesSeq) -> regionalCompaniesSeq.toString()).collect(Collectors.toList()); List<String> newDisString = dis.stream().map((regionalCompaniesSeq) -> regionalCompaniesSeq.toString()).collect(Collectors.toList());
for(String item:oldDisString){ for(String item:oldDisString){
if(!newDisString.contains(item)){ if(!newDisString.contains(item)){
throw new BadRequest("所属区域公司只能增加, 不能删除"); throw new BadRequest("所属区域公司只能增加, 不能删除");
} }
} }
List<String> lisk=new ArrayList<>();
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
List<Integer> regist= unitInformation.getRegisterPcdCodeList();
List<Integer> workP= unitInformation.getWorkPcdCodeList();
//注册地址
if(regist!=null&&!regist.isEmpty()){
StringBuilder codenameRegi=new StringBuilder();
for (int i = 0, len = regist.size(); i < len; i++) {
for (RegionModel regionModel : list) {
if (regionModel.getRegionCode().intValue() == regist.get(i).intValue()) {
codenameRegi.append(regionModel.getRegionName());
if (i != len - 1) {
codenameRegi.append("-");
}
}
}
}
unitInformation.setRegisterPcd(codenameRegi!=null&&!"".equals(codenameRegi.toString())?codenameRegi.toString():null);
}
//办公地址
if(workP!=null&&!workP.isEmpty()){
StringBuilder codenamework= new StringBuilder();;
for (int i = 0, len = workP.size(); i < len; i++) {
for (RegionModel regionModel : list) {
if (regionModel.getRegionCode().intValue() == workP.get(i).intValue()) {
codenamework.append(regionModel.getRegionName());
if (i != len - 1) {
codenamework.append("-");
}
}
}
}
unitInformation.setWorkPcd(codenamework!=null&&!"".equals(codenamework.toString())?codenamework.toString():null);
}
unitInformation.setHeadCardPhotoBackUrl(unitInformation.getHeadCardPhotoBackUrl());
unitInformation.setHeadCardPhotoFrontUrl(unitInformation.getHeadCardPhotoFrontUrl());
unitInformation.setRegisterPcdCodeList(unitInformation.getRegisterPcdCodeList());
unitInformation.setWorkPcdCodeList(unitInformation.getWorkPcdCodeList());
List<String> disST= dis.stream().map(x->x+"").collect(Collectors.toList());
BeanUtils.copyProperties(unitInformation,unitInfo);
CommerceInfo commerceInfo=new CommerceInfo();
commerceInfo= commerceInfoMapper.selectById(unitDataDto.getCommerceDto().getSequenceNbr());
CommerceDto commerceDto= unitDataDto.getCommerceDto();
commerceDto.setBusinessLicensePhotoUrl(commerceDto.getBusinessLicensePhotoUrl());
commerceDto.setLegalPersonCardPhotoBackUrl(commerceDto.getLegalPersonCardPhotoBackUrl());
commerceDto.setLegalPersonCardPhotoFrontUrl(commerceDto.getLegalPersonCardPhotoFrontUrl());
BeanUtils.copyProperties(commerceDto,commerceInfo);
unitInfo.setRegionalCompaniesSeq(disST);
unitInfoMapper.updateById(unitInfo);
commerceInfoMapper.updateById(commerceInfo);
regionalCompaniesMapper.delete(qu);
List<RegionalCompanies> regionalComp= new ArrayList<>(); List<RegionalCompanies> regionalComp= new ArrayList<>();
FeignClientResult<Collection<CompanyModel>> feignClientResult= Privilege.companyClient.querySubAgencyTree(regionalCompanies); FeignClientResult<Collection<CompanyModel>> feignClientResult= Privilege.companyClient.querySubAgencyTree(regionalCompanies);
...@@ -1009,25 +996,26 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -1009,25 +996,26 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
userEmpowerMapper.insert(stdUserEmpower); userEmpowerMapper.insert(stdUserEmpower);
} }
return true; return true;
} }
public JSONArray getRegionName() {
public JSONArray getRegionName(){
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
if (redisUtil.hasKey(regionRedis)) { if (redisUtil.hasKey(regionRedis)) {
jsonArray = JSONArray.parseArray(redisUtil.get(regionRedis).toString()); jsonArray= JSONArray.parseArray(redisUtil.get(regionRedis).toString());
} else { }else {
Collection<RegionModel> regionChild = new ArrayList<>(); Collection<RegionModel> regionChild = new ArrayList<>();
RegionModel regionModel1 = new RegionModel(); RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1); regionChild.add(regionModel1);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L); FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L);
Collection<RegionModel> result = collectionFeignClientResult.getResult(); Collection<RegionModel> result = collectionFeignClientResult.getResult();
for (RegionModel regionModel : result) { for (RegionModel regionModel : result) {
if (null != regionModel && null != regionModel.getChildren()) { if(null != regionModel && null != regionModel.getChildren()) {
for (RegionModel child : regionModel.getChildren()) { for (RegionModel child : regionModel.getChildren()) {
if (null != child && null != child.getChildren()) { if(null != child && null != child.getChildren()) {
for (RegionModel childChild : child.getChildren()) { for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild); jsonArray.add(childChild);
} }
...@@ -1040,22 +1028,23 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -1040,22 +1028,23 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
} }
} }
redisUtil.set(regionRedis, jsonArray); redisUtil.set(regionRedis,jsonArray);
} }
return jsonArray; return jsonArray;
} }
public Page<PeasantHousehold> getPeasantHouseholdData(Long unitInfoId,
Long regionalCompaniesSeq, public Page<PeasantHousehold> getPeasantHouseholdData( Long unitInfoId,
int pageNum, Long regionalCompaniesSeq,
int pageSize, int pageNum,
String peasantHouseholdNo, int pageSize,
String ownersName, String peasantHouseholdNo,
String ids) { String ownersName,
UnitInfo unitInfo = unitInfoMapper.selectById(unitInfoId); String ids){
UnitInfo unitInfo=unitInfoMapper.selectById(unitInfoId);
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
List<PeasantHousehold> list = peasantHouseholdMapper.selectPeasantHouseholdList(unitInfo.getAmosCompanySeq(), regionalCompaniesSeq, peasantHouseholdNo, ownersName, ids); List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdList(unitInfo.getAmosCompanySeq(),regionalCompaniesSeq,peasantHouseholdNo,ownersName,ids);
PageInfo<PeasantHousehold> page = new PageInfo(list); PageInfo<PeasantHousehold> page = new PageInfo(list);
Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>(); Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>();
pagenew.setCurrent(pageNum); pagenew.setCurrent(pageNum);
...@@ -1064,16 +1053,15 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -1064,16 +1053,15 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
pagenew.setRecords(page.getList()); pagenew.setRecords(page.getList());
return pagenew; return pagenew;
} }
public Page<PeasantHousehold> selectPeasantHouseholdListsg( Long unitInfoId,
public Page<PeasantHousehold> selectPeasantHouseholdListsg(Long unitInfoId, Long regionalCompaniesSeq,
Long regionalCompaniesSeq, int pageNum,
int pageNum, int pageSize,
int pageSize, String peasantHouseholdNo,
String peasantHouseholdNo, String ownersName,
String ownersName, String ids){
String ids) {
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
List<PeasantHousehold> list = peasantHouseholdMapper.selectPeasantHouseholdListsg(unitInfoId, regionalCompaniesSeq, peasantHouseholdNo, ownersName, ids); List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdListsg(unitInfoId,regionalCompaniesSeq,peasantHouseholdNo,ownersName,ids);
PageInfo<PeasantHousehold> page = new PageInfo(list); PageInfo<PeasantHousehold> page = new PageInfo(list);
Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>(); Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>();
pagenew.setCurrent(pageNum); pagenew.setCurrent(pageNum);
......
package com.yeejoin.amos.boot.module.jxiop.api.mapper; package com.yeejoin.amos.boot.module.jxiop.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.api.dto.EXPersonUser; import com.yeejoin.amos.boot.module.jxiop.api.dto.EXPersonUser;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationBasicDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.UserMapperDto; import com.yeejoin.amos.boot.module.jxiop.api.dto.UserMapperDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonBasic; import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonBasic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationQrCodeStatistics; import com.yeejoin.amos.boot.module.jxiop.api.entity.StationQrCodeStatistics;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -21,47 +19,53 @@ import java.util.Map; ...@@ -21,47 +19,53 @@ import java.util.Map;
public interface PersonBasicMapper extends BaseMapper<PersonBasic> { public interface PersonBasicMapper extends BaseMapper<PersonBasic> {
List<UserMapperDto> queryPage(@Param("current") Long current, @Param("size") Long size, List<UserMapperDto> queryPage(@Param("current") Long current, @Param("size") Long size,
@Param("name") String name, @Param("name") String name,
@Param("accountName") String accountName, @Param("accountName") String accountName,
@Param("projectName") String projectName, @Param("projectName") String projectName,
@Param("orgCode") String orgCode); @Param("orgCode") String orgCode);
List<UserMapperDto> queryPagecount( List<UserMapperDto> queryPagecount(
@Param("name") String name, @Param("name") String name,
@Param("accountName") String accountName, @Param("accountName") String accountName,
@Param("projectName") String projectName, @Param("projectName") String projectName,
@Param("orgCode") String orgCode); @Param("orgCode") String orgCode);
int deleteList(String[] ids); int deleteList(String[] ids);
List<EXPersonUser> getEXPersonUser(@Param("name") String name, List<EXPersonUser> getEXPersonUser(@Param("name") String name,
@Param("accountName") String accountName, @Param("accountName") String accountName,
@Param("projectName") String projectName, @Param("projectName") String projectName,
@Param("orgCode") String orgCode); @Param("orgCode") String orgCode);
List<EXPersonUser> getEXPersonUserAll(@Param("name") String name, List<EXPersonUser> getEXPersonUserAll(@Param("name") String name,
@Param("accountName") String accountName, @Param("accountName") String accountName,
@Param("projectName") String projectName, @Param("projectName") String projectName,
@Param("orgCode") String orgCode, @Param("orgCode") String orgCode,
@Param("ids") String [] ids @Param("ids") String[] ids
); );
List<Map<String, Object>> getPersonYardStatistics(@Param("parentCode") String parentCode); List<Map<String, Object>> getPersonYardStatistics(@Param("parentCode") String parentCode,
@Param("areaCode") String areaCode,
@Param("platformStationId") String platformStationId);
List<Map<String, Object>> getPersonYardByPage(@Param("current") Integer current, List<Map<String, Object>> getPersonYardByPage(@Param("current") Integer current,
@Param("size") Integer size, @Param("size") Integer size,
@Param("parentCode") String parentCode, @Param("parentCode") String parentCode,
@Param("date") String date, @Param("date") String date,
@Param("qrCodeColor") String qrCodeColor, @Param("qrCodeColor") String qrCodeColor,
@Param("ne") String ne); @Param("ne") String ne,
@Param("areaCode") String areaCode,
@Param("platformStationId") String platformStationId);
Integer getPersonYardByPageCount(@Param("parentCode") String parentCode, Integer getPersonYardByPageCount(@Param("parentCode") String parentCode,
@Param("date") String date, @Param("date") String date,
@Param("qrCodeColor") String qrCodeColor, @Param("qrCodeColor") String qrCodeColor,
@Param("ne") String ne); @Param("ne") String ne,
@Param("areaCode") String areaCode,
@Param("platformStationId") String platformStationId);
List<StationQrCodeStatistics> getPersonStatistics(); List<StationQrCodeStatistics> getPersonStatistics();
......
...@@ -205,6 +205,12 @@ ...@@ -205,6 +205,12 @@
<if test="parentCode != null and parentCode != ''"> <if test="parentCode != null and parentCode != ''">
AND a.project_org_code like concat(#{parentCode},'%') AND a.project_org_code like concat(#{parentCode},'%')
</if> </if>
<if test="platformStationId != null and platformStationId != ''">
AND c.platform_station_id = #{platformStationId}
</if>
<if test="areaCode != null and areaCode != ''">
AND c.area_code = #{areaCode}
</if>
</where> </where>
GROUP BY GROUP BY
a.qrcode_color a.qrcode_color
...@@ -240,6 +246,12 @@ ...@@ -240,6 +246,12 @@
<if test="ne != null and ne != ''"> <if test="ne != null and ne != ''">
AND a.qrcode_color != #{ne} AND a.qrcode_color != #{ne}
</if> </if>
<if test="platformStationId != null and platformStationId != ''">
AND c.platform_station_id = #{platformStationId}
</if>
<if test="areaCode != null and areaCode != ''">
AND c.area_code = #{areaCode}
</if>
</where> </where>
ORDER BY sort asc,a.rec_date DESC ORDER BY sort asc,a.rec_date DESC
limit #{current},#{size} limit #{current},#{size}
...@@ -266,6 +278,12 @@ ...@@ -266,6 +278,12 @@
<if test="ne != null and ne != ''"> <if test="ne != null and ne != ''">
AND a.qrcode_color != #{ne} AND a.qrcode_color != #{ne}
</if> </if>
<if test="platformStationId != null and platformStationId != ''">
AND c.platform_station_id = #{platformStationId}
</if>
<if test="areaCode != null and areaCode != ''">
AND c.area_code = #{areaCode}
</if>
</where> </where>
</select> </select>
......
...@@ -1129,7 +1129,7 @@ public class MonitorFanIdxController extends BaseController { ...@@ -1129,7 +1129,7 @@ public class MonitorFanIdxController extends BaseController {
@ApiOperation(value = "运维数据 ") @ApiOperation(value = "运维数据 ")
@GetMapping("/operationData") @GetMapping("/operationData")
public ResponseModel<IPage<Map<String, Object>>> operationData(@RequestParam(value = "areaCode", required = false) String areaCode, public ResponseModel<IPage<Map<String, Object>>> operationData(@RequestParam(value = "areaCode", required = false) String areaCode,
@RequestParam(value = "stationId", required = false) String stationId) { @RequestParam(value = "platformStationId", required = false) String platformStationId) {
// List<StationCacheInfoDto> list = commonServiceImpl.getListStationCacheInfoDto(); // List<StationCacheInfoDto> list = commonServiceImpl.getListStationCacheInfoDto();
...@@ -1153,14 +1153,14 @@ public class MonitorFanIdxController extends BaseController { ...@@ -1153,14 +1153,14 @@ public class MonitorFanIdxController extends BaseController {
// result.setRecords(mapList); // result.setRecords(mapList);
// result.setCurrent(1); // result.setCurrent(1);
// result.setTotal(mapList.size()); // result.setTotal(mapList.size());
return ResponseHelper.buildResponse(monitorService.operationData(areaCode,stationId)); return ResponseHelper.buildResponse(monitorService.operationData(areaCode,platformStationId));
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "全国新能源接入情况 ") @ApiOperation(value = "全国新能源接入情况 ")
@GetMapping("/getAccessSituation") @GetMapping("/getAccessSituation")
public ResponseModel<Map<String, Object>> getAccessSituation(@RequestParam(value = "areaCode", required = false) String areaCode, public ResponseModel<Map<String, Object>> getAccessSituation(@RequestParam(value = "areaCode", required = false) String areaCode,
@RequestParam(value = "stationId", required = false) String stationId) { @RequestParam(value = "platformStationId", required = false) String platformStationId) {
return ResponseHelper.buildResponse(monitorService.getAccessSituation(areaCode,stationId)); return ResponseHelper.buildResponse(monitorService.getAccessSituation(areaCode,platformStationId));
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......
...@@ -68,12 +68,14 @@ public class PersonQrCodeController extends BaseController { ...@@ -68,12 +68,14 @@ public class PersonQrCodeController extends BaseController {
@GetMapping(value = "/getPersonYardStatistics") @GetMapping(value = "/getPersonYardStatistics")
@ApiOperation(httpMethod = "GET", value = "评估大屏 - 人员赋码环形图查询", notes = "评估大屏 - 人员赋码环形图查询") @ApiOperation(httpMethod = "GET", value = "评估大屏 - 人员赋码环形图查询", notes = "评估大屏 - 人员赋码环形图查询")
public ResponseModel<List<Map<String, Object>>> getPersonYardStatistics(@RequestParam(required = false, value = "parentCode") String parentCode, public ResponseModel<List<Map<String, Object>>> getPersonYardStatistics(@RequestParam(required = false, value = "parentCode") String parentCode,
@RequestParam(required = false, value = "dataType") String dataType) { @RequestParam(required = false, value = "dataType") String dataType,
@RequestParam(value = "areaCode", required = false) String areaCode,
@RequestParam(value = "platformStationId", required = false) String platformStationId) {
List<Map<String, Object>> resultList = new ArrayList<>(); List<Map<String, Object>> resultList = new ArrayList<>();
if (StringUtils.isNotEmpty(dataType) && dataType.equals("person")) { if (StringUtils.isNotEmpty(dataType) && dataType.equals("person")) {
resultList = personBasicMapper.getPersonYardStatistics(parentCode); resultList = personBasicMapper.getPersonYardStatistics(parentCode, areaCode, platformStationId);
} else if (StringUtils.isNotEmpty(dataType) && dataType.equals("equip")) { } else if (StringUtils.isNotEmpty(dataType) && dataType.equals("equip")) {
resultList = sjglZsjZsbtzMapper.getEquipYardStatistics(parentCode); resultList = sjglZsjZsbtzMapper.getEquipYardStatistics(parentCode);
} else if (StringUtils.isNotEmpty(dataType) && dataType.equals("job")) { } else if (StringUtils.isNotEmpty(dataType) && dataType.equals("job")) {
...@@ -104,11 +106,13 @@ public class PersonQrCodeController extends BaseController { ...@@ -104,11 +106,13 @@ public class PersonQrCodeController extends BaseController {
@RequestParam(value = "size") Integer size, @RequestParam(value = "size") Integer size,
@RequestParam(required = false, value = "dataType") String dataType, @RequestParam(required = false, value = "dataType") String dataType,
@RequestParam(required = false) String date, @RequestParam(required = false) String date,
@RequestParam(required = false) String qrCodeColor) { @RequestParam(required = false) String qrCodeColor,
@RequestParam(value = "areaCode", required = false) String areaCode,
@RequestParam(value = "platformStationId", required = false) String platformStationId) {
Page<Map<String, Object>> resultList = new Page<>(); Page<Map<String, Object>> resultList = new Page<>();
if ("person".equals(dataType)) { if ("person".equals(dataType)) {
resultList = personBasicServiceImpl.getPersonYardByPage(parentCode, current, size, date, qrCodeColor, null, null); resultList = personBasicServiceImpl.getPersonYardByPage(parentCode, current, size, date, qrCodeColor, null, null, areaCode, platformStationId);
} else if ("equip".equals(dataType)) { } else if ("equip".equals(dataType)) {
List<Map<String, Object>> equipYardByPage = sjglZsjZsbtzMapper.getEquipYardByPage((current - 1) * size, size, parentCode, date, qrCodeColor, null); List<Map<String, Object>> equipYardByPage = sjglZsjZsbtzMapper.getEquipYardByPage((current - 1) * size, size, parentCode, date, qrCodeColor, null);
Integer equipYardByPageCount = sjglZsjZsbtzMapper.getEquipYardByPageCount(parentCode, date, qrCodeColor, null); Integer equipYardByPageCount = sjglZsjZsbtzMapper.getEquipYardByPageCount(parentCode, date, qrCodeColor, null);
...@@ -144,7 +148,9 @@ public class PersonQrCodeController extends BaseController { ...@@ -144,7 +148,9 @@ public class PersonQrCodeController extends BaseController {
@GetMapping(value = "/getQrCodeCount") @GetMapping(value = "/getQrCodeCount")
@ApiOperation(httpMethod = "GET", value = "评估大屏 - 人员赋码数量等统计", notes = "评估大屏 - 人员赋码数量等统计") @ApiOperation(httpMethod = "GET", value = "评估大屏 - 人员赋码数量等统计", notes = "评估大屏 - 人员赋码数量等统计")
public ResponseModel<Map<String, Object>> getQrCodeCount(@RequestParam(required = false, value = "parentCode") String parentCode, public ResponseModel<Map<String, Object>> getQrCodeCount(@RequestParam(required = false, value = "parentCode") String parentCode,
@RequestParam(required = false, value = "dataType") String dataType) { @RequestParam(required = false, value = "dataType") String dataType,
@RequestParam(value = "areaCode", required = false) String areaCode,
@RequestParam(value = "platformStationId", required = false) String platformStationId) {
FeignClientResult<Map<String, Object>> sevenEntity = null; FeignClientResult<Map<String, Object>> sevenEntity = null;
try { try {
...@@ -160,7 +166,7 @@ public class PersonQrCodeController extends BaseController { ...@@ -160,7 +166,7 @@ public class PersonQrCodeController extends BaseController {
String yellowToGreen = result.get("yellowToGreen").toString(); String yellowToGreen = result.get("yellowToGreen").toString();
Integer countAll = 0; Integer countAll = 0;
if ("RYFM".equals(dataType) || "person".equals(dataType)) { if ("RYFM".equals(dataType) || "person".equals(dataType)) {
countAll = personBasicMapper.getPersonYardByPageCount(parentCode, null, null, null); countAll = personBasicMapper.getPersonYardByPageCount(parentCode, null, null, null,areaCode,platformStationId);
} else if ("equip".equals(dataType)) { } else if ("equip".equals(dataType)) {
countAll = sjglZsjZsbtzMapper.getEquipYardByPageCount(parentCode, null, null, null); countAll = sjglZsjZsbtzMapper.getEquipYardByPageCount(parentCode, null, null, null);
} else if ("job".equals(dataType)) { } else if ("job".equals(dataType)) {
...@@ -186,7 +192,7 @@ public class PersonQrCodeController extends BaseController { ...@@ -186,7 +192,7 @@ public class PersonQrCodeController extends BaseController {
@GetMapping(value = "/getQrCodeCountByStation") @GetMapping(value = "/getQrCodeCountByStation")
@ApiOperation(httpMethod = "GET", value = "评估大屏 - 场站 人员赋码数量等统计 【折线图】", notes = "评估大屏 - 场站 人员赋码数量等统计 【折线图】") @ApiOperation(httpMethod = "GET", value = "评估大屏 - 场站 人员赋码数量等统计 【折线图】", notes = "评估大屏 - 场站 人员赋码数量等统计 【折线图】")
public ResponseModel<Map<String, Object>> getQrCodeCountByStation(@RequestParam(required = false, value = "parentCode") String parentCode, public ResponseModel<Map<String, Object>> getQrCodeCountByStation(@RequestParam(required = false, value = "parentCode") String parentCode,
@RequestParam(required = false, value = "dataType") String dataType) { @RequestParam(required = false, value = "dataType") String dataType) {
List<Map<String, Object>> qrCodeCountByStation = stationQrCodeStatisticsMapper.getQrCodeCountByStation(parentCode, dataType); List<Map<String, Object>> qrCodeCountByStation = stationQrCodeStatisticsMapper.getQrCodeCountByStation(parentCode, dataType);
List<Object> redNum = qrCodeCountByStation.stream().map(t -> t.get("redNum")).collect(Collectors.toList()); List<Object> redNum = qrCodeCountByStation.stream().map(t -> t.get("redNum")).collect(Collectors.toList());
...@@ -273,10 +279,12 @@ public class PersonQrCodeController extends BaseController { ...@@ -273,10 +279,12 @@ public class PersonQrCodeController extends BaseController {
@RequestParam(required = false, value = "score") BigDecimal score, @RequestParam(required = false, value = "score") BigDecimal score,
@RequestParam(value = "current") Integer current, @RequestParam(value = "current") Integer current,
@RequestParam(value = "size") Integer size, @RequestParam(value = "size") Integer size,
@RequestParam(required = false, value = "date") String date) { @RequestParam(required = false, value = "date") String date,
@RequestParam(value = "areaCode", required = false) String areaCode,
@RequestParam(value = "platformStationId", required = false) String platformStationId) {
Page<Map<String, Object>> resultList = new Page<>(); Page<Map<String, Object>> resultList = new Page<>();
if ("V1".equals(column)) { if ("V1".equals(column)) {
resultList = personBasicServiceImpl.getPersonYardByPage(parentCode, current, size, date, null, "green", score); resultList = personBasicServiceImpl.getPersonYardByPage(parentCode, current, size, date, null, "green", score, areaCode, platformStationId);
} else if ("S1".equals(column)) { } else if ("S1".equals(column)) {
List<Map<String, Object>> equipYardByPage = sjglZsjZsbtzMapper.getEquipYardByPage((current - 1) * size, size, parentCode, date, null, "green"); List<Map<String, Object>> equipYardByPage = sjglZsjZsbtzMapper.getEquipYardByPage((current - 1) * size, size, parentCode, date, null, "green");
Integer equipYardByPageCount = sjglZsjZsbtzMapper.getEquipYardByPageCount(parentCode, date, null, "green"); Integer equipYardByPageCount = sjglZsjZsbtzMapper.getEquipYardByPageCount(parentCode, date, null, "green");
...@@ -330,8 +338,8 @@ public class PersonQrCodeController extends BaseController { ...@@ -330,8 +338,8 @@ public class PersonQrCodeController extends BaseController {
if ("V1".equals(column)) { if ("V1".equals(column)) {
resultMap = personBasicServiceImpl.getPersonDetailInfoByObjectId(objectId); resultMap = personBasicServiceImpl.getPersonDetailInfoByObjectId(objectId);
if (resultMap.get("recDate").equals("")){ if (resultMap.get("recDate").equals("")) {
resultMap.put("recDate",resultMap.get("qrcodeDate")); resultMap.put("recDate", resultMap.get("qrcodeDate"));
} }
} else if ("S1".equals(column)) { } else if ("S1".equals(column)) {
resultMap = sjglZsjZsbtzMapper.getEquipDetailInfoByObjectId(objectId); resultMap = sjglZsjZsbtzMapper.getEquipDetailInfoByObjectId(objectId);
......
...@@ -9,6 +9,8 @@ public class StationCacheInfoDto implements Serializable { ...@@ -9,6 +9,8 @@ public class StationCacheInfoDto implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
//场站id //场站id
private String stationId; private String stationId;
//平台场站id
private String platformStationId;
//场站名称 //场站名称
private String stationName; private String stationName;
//场站类型 //场站类型
......
...@@ -15,11 +15,11 @@ import java.util.Map; ...@@ -15,11 +15,11 @@ import java.util.Map;
public interface MonitorService { public interface MonitorService {
/** /**
* @param areaCode 区域编码 * @param areaCode 区域编码
* @param stationId 场站id * @param platformStationId 场站id
* @return 全国运维数据 * @return 全国运维数据
* @Description 根据区域编码动态运维数据 * @Description 根据区域编码动态运维数据
*/ */
IPage<Map<String, Object>> operationData(String areaCode,String stationId); IPage<Map<String, Object>> operationData(String areaCode,String platformStationId);
/** /**
* @return Map<String, Object> * @return Map<String, Object>
...@@ -123,8 +123,8 @@ public interface MonitorService { ...@@ -123,8 +123,8 @@ public interface MonitorService {
/** /**
* 获取接入情况 * 获取接入情况
* @param areaCode * @param areaCode
* @param stationId * @param platformStationId
* @return * @return
*/ */
Map<String, Object> getAccessSituation(String areaCode,String stationId); Map<String, Object> getAccessSituation(String areaCode,String platformStationId);
} }
...@@ -61,13 +61,13 @@ public class MonitorServiceImpl implements MonitorService { ...@@ -61,13 +61,13 @@ public class MonitorServiceImpl implements MonitorService {
private Resource overviewGF; private Resource overviewGF;
@Override @Override
public IPage<Map<String, Object>> operationData(String areaCode,String stationId) { public IPage<Map<String, Object>> operationData(String areaCode,String platformStationId) {
List<StationCacheInfoDto> list = getListStationCacheInfoDto(); List<StationCacheInfoDto> list = getListStationCacheInfoDto();
if (null != areaCode) { if (null != areaCode) {
list = list.stream().filter(e -> e.getAreaCode().toUpperCase(Locale.ROOT).equals(areaCode.toUpperCase(Locale.ROOT))).collect(Collectors.toList()); list = list.stream().filter(e -> e.getAreaCode().toUpperCase(Locale.ROOT).equals(areaCode.toUpperCase(Locale.ROOT))).collect(Collectors.toList());
} }
if (!StringUtils.isEmpty(stationId)) { if (!StringUtils.isEmpty(platformStationId)) {
list = list.stream().filter(e -> e.getStationId().toUpperCase(Locale.ROOT).equals(stationId.toUpperCase(Locale.ROOT))).collect(Collectors.toList()); list = list.stream().filter(e -> e.getPlatformStationId().toUpperCase(Locale.ROOT).equals(platformStationId.toUpperCase(Locale.ROOT))).collect(Collectors.toList());
} }
List<Map<String, Object>> mapList = new ArrayList<>(); List<Map<String, Object>> mapList = new ArrayList<>();
Map<String, List<StationCacheInfoDto>> listMap = list.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getStationType, Collectors.toList())); Map<String, List<StationCacheInfoDto>> listMap = list.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getStationType, Collectors.toList()));
...@@ -160,6 +160,7 @@ public class MonitorServiceImpl implements MonitorService { ...@@ -160,6 +160,7 @@ public class MonitorServiceImpl implements MonitorService {
stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId()); stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId());
stationCacheInfoDto.setBoosterCoreName(stationBasic.getBoosterCoreName()); stationCacheInfoDto.setBoosterCoreName(stationBasic.getBoosterCoreName());
stationCacheInfoDto.setStationCoreName(stationBasic.getStationCoreName()); stationCacheInfoDto.setStationCoreName(stationBasic.getStationCoreName());
stationCacheInfoDto.setPlatformStationId(stationBasic.getPlatformStationId());
stationCacheInfoDtos.add(stationCacheInfoDto); stationCacheInfoDtos.add(stationCacheInfoDto);
} }
...@@ -948,8 +949,8 @@ public class MonitorServiceImpl implements MonitorService { ...@@ -948,8 +949,8 @@ public class MonitorServiceImpl implements MonitorService {
} }
@Override @Override
public Map<String, Object> getAccessSituation(String areaCode, String stationId) { public Map<String, Object> getAccessSituation(String areaCode, String platformStationId) {
IPage<Map<String, Object>> page = operationData(areaCode,stationId); IPage<Map<String, Object>> page = operationData(areaCode,platformStationId);
List<Map<String, Object>> records = page.getRecords(); List<Map<String, Object>> records = page.getRecords();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if (!CollectionUtils.isEmpty(records)) { if (!CollectionUtils.isEmpty(records)) {
......
...@@ -124,9 +124,11 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -124,9 +124,11 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
String date, String date,
String qrCodeColor, String qrCodeColor,
String ne, String ne,
BigDecimal score) { BigDecimal score,
List<Map<String, Object>> resultList = personBasicMapper.getPersonYardByPage((current - 1) * size, size , parentCode, date, qrCodeColor, ne); String areaCode,
Integer count = personBasicMapper.getPersonYardByPageCount(parentCode, date, qrCodeColor, ne); String platformStationId) {
List<Map<String, Object>> resultList = personBasicMapper.getPersonYardByPage((current - 1) * size, size , parentCode, date, qrCodeColor, ne,areaCode,platformStationId);
Integer count = personBasicMapper.getPersonYardByPageCount(parentCode, date, qrCodeColor, ne,areaCode,platformStationId);
resultList.forEach(item -> { resultList.forEach(item -> {
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor"))); String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
......
...@@ -7,14 +7,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -7,14 +7,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.fasterxml.jackson.core.type.TypeReference; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.biz.common.feign.AmosFeignService; import com.yeejoin.amos.boot.biz.common.feign.AmosFeignService;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.api.Enum.QrcodeColorEnum; import com.yeejoin.amos.boot.module.jxiop.api.Enum.QrcodeColorEnum;
import com.yeejoin.amos.boot.module.jxiop.api.dto.*; import com.yeejoin.amos.boot.module.jxiop.api.dto.*;
import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonBasic;
import com.yeejoin.amos.boot.module.jxiop.api.entity.*; import com.yeejoin.amos.boot.module.jxiop.api.entity.*;
import com.yeejoin.amos.boot.module.jxiop.api.feign.AgencyuserFeign; import com.yeejoin.amos.boot.module.jxiop.api.feign.AgencyuserFeign;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountFedMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountFedMapper;
...@@ -36,19 +34,15 @@ import lombok.extern.slf4j.Slf4j; ...@@ -36,19 +34,15 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import springfox.documentation.spring.web.json.Json;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.ParseException; import java.text.ParseException;
import java.util.*; import java.util.*;
...@@ -63,330 +57,321 @@ import java.util.stream.Collectors; ...@@ -63,330 +57,321 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
@Service @Service
public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBasic, PersonBasicMapper> public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBasic, PersonBasicMapper>
implements IPersonBasicService { implements IPersonBasicService {
@Autowired /**
PersonBasicMapper personBasicMapper; * 人员赋码触发风险模型
*/
// 人员账号信息service public static final String RYFM_DATA_MQTT_TOPIC = "ryfm/data/analysis";
@Autowired /**
PersonAccountServiceImpl personAccountService; * 人员红黄码恢复为绿码
// 人员归属信息service */
@Autowired public static final String RYFM_GREEN = "ryfm/person/green";
PersonAscriptionServiceImpl personAscriptionService; @Autowired
// 人员资质信息service protected EmqKeeper emqKeeper;
@Autowired @Autowired
PersonCertificateServiceImpl personCertificateService; PersonBasicMapper personBasicMapper;
// 人员教育信息 // 人员账号信息service
@Autowired @Autowired
PersonSkillEducationServiceImpl personSkillEducationService; PersonAccountServiceImpl personAccountService;
@Value("${amos.secret.key}") // 人员归属信息service
String secretKey; @Autowired
@Autowired PersonAscriptionServiceImpl personAscriptionService;
QuerueProduce querueProduce; // 人员资质信息service
@Autowired
@Autowired PersonCertificateServiceImpl personCertificateService;
private AmosFeignService amosFeignService; // 人员教育信息
@Autowired
@Autowired PersonSkillEducationServiceImpl personSkillEducationService;
private RedisUtils redisUtils; @Value("${amos.secret.key}")
String secretKey;
@Autowired @Autowired
protected EmqKeeper emqKeeper; QuerueProduce querueProduce;
@Autowired
@Autowired PersonAccountFedMapper personAccountFedMapper;
private AgencyuserFeign agencyuserFeign; @Autowired
private AmosFeignService amosFeignService;
@Autowired @Autowired
private UserEmpowerMapper userEmpowerMapper; private RedisUtils redisUtils;
@Autowired
/** private AgencyuserFeign agencyuserFeign;
* 人员赋码触发风险模型 @Autowired
*/ private UserEmpowerMapper userEmpowerMapper;
public static final String RYFM_DATA_MQTT_TOPIC = "ryfm/data/analysis"; private String UPDATE = "UPDATE";
private String INSERT = "INSERT";
/**
* 人员红黄码恢复为绿码 /**
*/ * 分页查询
public static final String RYFM_GREEN = "ryfm/person/green"; */
public Page<PersonBasicDto> queryForPersonBasicPage(Page<PersonBasicDto> page) {
private String UPDATE = "UPDATE"; return this.queryForPage(page, null, false);
private String INSERT = "INSERT"; }
@Autowired
PersonAccountFedMapper personAccountFedMapper; /**
* 列表查询 示例
/** */
* 分页查询 public List<PersonBasicDto> queryForPersonBasicList() {
*/ return this.queryForList("", false);
public Page<PersonBasicDto> queryForPersonBasicPage(Page<PersonBasicDto> page) { }
return this.queryForPage(page, null, false);
} public void addRedisPostAndCerInfo() {
List<DictionarieValueModel> elevatorCategory = null;
/** try {
* 列表查询 示例 elevatorCategory = amosFeignService.listDictionaryByDictCode("YGZYJNJDZS");
*/ } catch (Exception e) {
public List<PersonBasicDto> queryForPersonBasicList() { e.printStackTrace();
return this.queryForList("", false); }
} Map<String, String> collect = elevatorCategory.stream().collect(
Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataDesc));
public void addRedisPostAndCerInfo() { redisUtils.set(Constants.JXIOP_DICT_POST, collect);
List<DictionarieValueModel> elevatorCategory = null;
try { List<DictionarieValueModel> elevator = null;
elevatorCategory = amosFeignService.listDictionaryByDictCode("YGZYJNJDZS"); try {
} catch (Exception e) { elevator = amosFeignService.listDictionaryByDictCode("岗位资质鉴定证书");
e.printStackTrace(); } catch (Exception e) {
} e.printStackTrace();
Map<String, String> collect = elevatorCategory.stream().collect( }
Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataDesc)); Map<String, String> collect2 = elevator.stream().collect(
redisUtils.set(Constants.JXIOP_DICT_POST, collect); Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataDesc));
redisUtils.set(Constants.JXIOP_DICT_CERTIFICATES, collect2);
List<DictionarieValueModel> elevator = null; }
try {
elevator = amosFeignService.listDictionaryByDictCode("岗位资质鉴定证书"); public RiskBizInfoVo fetchData(PersonBasic personBasic, PersonAccount personAccount, String content) {
} catch (Exception e) { RiskBizInfoVo riskBizInfoVo = new RiskBizInfoVo();
e.printStackTrace(); riskBizInfoVo.setWarningObjectName(
} personAccount.getProjectName() + personBasic.getPostName() + personAccount.getName());
Map<String, String> collect2 = elevator.stream().collect( riskBizInfoVo.setWarningObjectCode(String.valueOf(personBasic.getSequenceNbr()));
Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataDesc)); riskBizInfoVo.setSourceAttribution(personBasic.getProjectOrgCode());
redisUtils.set(Constants.JXIOP_DICT_CERTIFICATES, collect2); riskBizInfoVo.setSourceAttributionDesc(personAccount.getProjectName());
} riskBizInfoVo.setWarningObjectType("RYFM");
List<RiskDynamicDetailsVo> detailsVos = new ArrayList<>();
public RiskBizInfoVo fetchData(PersonBasic personBasic, PersonAccount personAccount, String content) { RiskDynamicDetailsVo dynamicDetailsVo = new RiskDynamicDetailsVo();
RiskBizInfoVo riskBizInfoVo = new RiskBizInfoVo(); dynamicDetailsVo.setTabName("预警详情");
riskBizInfoVo.setWarningObjectName( detailsVos.add(dynamicDetailsVo);
personAccount.getProjectName() + personBasic.getPostName() + personAccount.getName()); riskBizInfoVo.setDynamicDetails(detailsVos);
riskBizInfoVo.setWarningObjectCode(String.valueOf(personBasic.getSequenceNbr())); CustomizeItems customizeItems = new CustomizeItems();
riskBizInfoVo.setSourceAttribution(personBasic.getProjectOrgCode()); customizeItems.setWarningContent(content);
riskBizInfoVo.setSourceAttributionDesc(personAccount.getProjectName()); riskBizInfoVo.setCustomizeItems(customizeItems);
riskBizInfoVo.setWarningObjectType("RYFM"); return riskBizInfoVo;
List<RiskDynamicDetailsVo> detailsVos = new ArrayList<>(); }
RiskDynamicDetailsVo dynamicDetailsVo = new RiskDynamicDetailsVo();
dynamicDetailsVo.setTabName("预警详情"); /**
detailsVos.add(dynamicDetailsVo); * 新增
riskBizInfoVo.setDynamicDetails(detailsVos); */
CustomizeItems customizeItems = new CustomizeItems(); @Transactional
customizeItems.setWarningContent(content); public void addPerson(PersonDto model, HttpServletRequest httpServletRequest) throws Exception {
riskBizInfoVo.setCustomizeItems(customizeItems); if (!redisUtils.hasKey(Constants.JXIOP_DICT_POST) || !redisUtils.hasKey(Constants.JXIOP_DICT_CERTIFICATES)) {
return riskBizInfoVo; addRedisPostAndCerInfo();
} }
// 岗位所需证书信息
/** Map<String, String> postNameMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_POST);
* 新增 // 证书临期信息
*/ Map<String, String> certificatesMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_CERTIFICATES);
@Transactional
public void addPerson(PersonDto model, HttpServletRequest httpServletRequest) throws Exception { // 获取人员基本信息数据
if (!redisUtils.hasKey(Constants.JXIOP_DICT_POST) || !redisUtils.hasKey(Constants.JXIOP_DICT_CERTIFICATES)) { PersonUser personUser = model.getPersonUser();
addRedisPostAndCerInfo(); // 获取人员账号信息
} PersonAccount personAccount = model.getPersonAccount();
// 岗位所需证书信息 personUser.setPhone(personAccount.getPhoneNum());
Map<String, String> postNameMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_POST); // 人员基础信息
// 证书临期信息 PersonBasic personBasic = new PersonBasic();
Map<String, String> certificatesMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_CERTIFICATES); BeanUtils.copyProperties(personUser, personBasic);
// 默认红码
// 获取人员基本信息数据 personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
PersonUser personUser = model.getPersonUser(); personBasic.setQrcodeDesc("证书不全");
// 获取人员账号信息 // 该岗位应获得的证书
PersonAccount personAccount = model.getPersonAccount(); List<String> list2 = new ArrayList<>();
personUser.setPhone(personAccount.getPhoneNum()); if (StringUtils.isNotEmpty(personUser.getPostName())) {
// 人员基础信息 String certificates = postNameMap.get(personUser.getPostName());
PersonBasic personBasic = new PersonBasic(); if (!StringUtils.isEmpty(certificates)) {
BeanUtils.copyProperties(personUser, personBasic); list2 = Arrays.asList(certificates.split(","));
// 默认红码 }
personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode()); }
personBasic.setQrcodeDesc("证书不全"); List<String> list = new ArrayList(list2);
// 该岗位应获得的证书 // 人员资质信息
List<String> list2 = new ArrayList<>(); Integer isInMonth = 0;
if (StringUtils.isNotEmpty(personUser.getPostName())) { Integer isOver = 0;
String certificates = postNameMap.get(personUser.getPostName()); CertificationInfo personCertificate = model.getPersonCertificate();
if (!StringUtils.isEmpty(certificates)) {
list2 = Arrays.asList(certificates.split(",")); // 过期的证书
} List<String> overCertificateList = new ArrayList<>();
} // 临期证书
List<String> list = new ArrayList(list2); List<String> inMonthCertificateList = new ArrayList<>();
// 人员资质信息 if (CollectionUtils.isNotEmpty(personCertificate.getCertificationInfo())) {
Integer isInMonth = 0; for (PersonCertificate item : personCertificate.getCertificationInfo()) {
Integer isOver = 0; if (StringUtils.isNotEmpty(item.getValidPeriod()) && !Objects.isNull(item.getCertificateTime())) {
CertificationInfo personCertificate = model.getPersonCertificate(); int validPeriod = StringUtils.isEmpty(item.getValidPeriod()) ? 3
: Integer.parseInt(item.getValidPeriod());
// 过期的证书 Date date = DateUtils.dateAddYears(item.getCertificateTime(), validPeriod);
List<String> overCertificateList = new ArrayList<>(); if (list.contains(item.getCertificateName()) && DateUtils.dateCompare(date, new Date()) == -1) {
// 临期证书 isOver = 1;
List<String> inMonthCertificateList = new ArrayList<>(); overCertificateList.add(item.getCertificateName());
if (CollectionUtils.isNotEmpty(personCertificate.getCertificationInfo())) { }
for (PersonCertificate item : personCertificate.getCertificationInfo()) { if (list.contains(item.getCertificateName())
if (StringUtils.isNotEmpty(item.getValidPeriod()) && !Objects.isNull(item.getCertificateTime())) { && DateUtils.dateBetweenIncludeToday(new Date(), date) < Integer
int validPeriod = StringUtils.isEmpty(item.getValidPeriod()) ? 3 .valueOf(certificatesMap.get(item.getCertificateName()))
: Integer.parseInt(item.getValidPeriod()); && DateUtils.dateCompare(date, new Date()) == 1) {
Date date = DateUtils.dateAddYears(item.getCertificateTime(), validPeriod); isInMonth = 1;
if (list.contains(item.getCertificateName()) && DateUtils.dateCompare(date, new Date()) == -1) { inMonthCertificateList.add(item.getCertificateName());
isOver = 1; }
overCertificateList.add(item.getCertificateName()); }
} list.remove(item.getCertificateName());
if (list.contains(item.getCertificateName()) }
&& DateUtils.dateBetweenIncludeToday(new Date(), date) < Integer }
.valueOf(certificatesMap.get(item.getCertificateName())) // 缺证
&& DateUtils.dateCompare(date, new Date()) == 1) { List<String> noCertificateList = new ArrayList<>(list);
isInMonth = 1; List<String> strings = new ArrayList<>();
inMonthCertificateList.add(item.getCertificateName()); if (CollectionUtils.isNotEmpty(overCertificateList)) {
} strings.add("过期证书:" + String.join(",", overCertificateList));
} }
list.remove(item.getCertificateName()); if (CollectionUtils.isNotEmpty(inMonthCertificateList)) {
} strings.add("临期证书:" + String.join(",", inMonthCertificateList));
} }
// 缺证 if (CollectionUtils.isNotEmpty(noCertificateList)) {
List<String> noCertificateList = new ArrayList<>(list); strings.add("缺少证书:" + String.join(",", noCertificateList));
List<String> strings = new ArrayList<>(); }
if (CollectionUtils.isNotEmpty(overCertificateList)) { String join = "";
strings.add("过期证书:" + String.join(",", overCertificateList)); if (CollectionUtils.isNotEmpty(strings)) {
} join = String.join(";", strings);
if (CollectionUtils.isNotEmpty(inMonthCertificateList)) { }
strings.add("临期证书:" + String.join(",", inMonthCertificateList)); personBasic.setMissingCertificate(join);
}
if (CollectionUtils.isNotEmpty(noCertificateList)) { if (CollectionUtils.isEmpty(list) && isInMonth == 0 && isOver == 0) {
strings.add("缺少证书:" + String.join(",", noCertificateList)); personBasic.setQrcodeColor(QrcodeColorEnum.GREEN.getCode());
} personBasic.setQrcodeDesc("证书齐全");
String join = ""; personBasic.setQrcodeDate(new Date());
if (CollectionUtils.isNotEmpty(strings)) { } else if ((CollectionUtils.isEmpty(list) && isOver == 1) || (CollectionUtils.isNotEmpty(list))) {
join = String.join(";", strings); personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
} personBasic.setQrcodeDesc("证书不全");
personBasic.setMissingCertificate(join); personBasic.setQrcodeDate(new Date());
} else if (CollectionUtils.isEmpty(list) && isOver == 0 && isInMonth == 1) {
if (CollectionUtils.isEmpty(list) && isInMonth == 0 && isOver == 0) { personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode());
personBasic.setQrcodeColor(QrcodeColorEnum.GREEN.getCode()); personBasic.setQrcodeDesc("证书临期");
personBasic.setQrcodeDesc("证书齐全"); personBasic.setQrcodeDate(new Date());
personBasic.setQrcodeDate(new Date()); }
} else if ((CollectionUtils.isEmpty(list) && isOver == 1) || (CollectionUtils.isNotEmpty(list))) { CompanyModel companyModel = new CompanyModel();
personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode()); // 单位
personBasic.setQrcodeDesc("证书不全"); companyModel = this.getCompanyModel(personAccount.getProjectId());
personBasic.setQrcodeDate(new Date()); personBasic.setProjectOrgCode(companyModel.getOrgCode());
} else if (CollectionUtils.isEmpty(list) && isOver == 0 && isInMonth == 1) {
personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode()); if (personUser.getNativePlace() != null) {
personBasic.setQrcodeDesc("证书临期"); personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace()));
personBasic.setQrcodeDate(new Date()); }
} this.baseMapper.insert(personBasic);
CompanyModel companyModel = new CompanyModel();
// 单位 if ("证书不全".equals(personBasic.getQrcodeDesc()) || "证书临期".equals(personBasic.getQrcodeDesc())) {
companyModel = this.getCompanyModel(personAccount.getProjectId()); personBasic.setProjectOrgCode(companyModel.getOrgCode());
personBasic.setProjectOrgCode(companyModel.getOrgCode()); personAccount.setProjectName(companyModel.getCompanyName());
BizMessage bizMessage = new BizMessage();
if (personUser.getNativePlace() != null) { bizMessage.setIndexKey("RYFM");
personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace())); bizMessage.setIndexValue(personBasic.getPostName() + personBasic.getQrcodeDesc());
} RiskBizInfoVo riskBizInfoVo = fetchData(personBasic, personAccount, join);
this.baseMapper.insert(personBasic); bizMessage.setBizInfo(riskBizInfoVo);
bizMessage.setTraceId(String.valueOf(personBasic.getSequenceNbr()));
if ("证书不全".equals(personBasic.getQrcodeDesc()) || "证书临期".equals(personBasic.getQrcodeDesc())) { try {
personBasic.setProjectOrgCode(companyModel.getOrgCode()); emqKeeper.getMqttClient().publish(RYFM_DATA_MQTT_TOPIC,
personAccount.setProjectName(companyModel.getCompanyName()); JSON.toJSONString(bizMessage).getBytes(StandardCharsets.UTF_8), 2, false);
BizMessage bizMessage = new BizMessage(); } catch (MqttException e) {
bizMessage.setIndexKey("RYFM"); e.printStackTrace();
bizMessage.setIndexValue(personBasic.getPostName() + personBasic.getQrcodeDesc()); }
RiskBizInfoVo riskBizInfoVo = fetchData(personBasic, personAccount, join); }
bizMessage.setBizInfo(riskBizInfoVo); if (CollectionUtils.isNotEmpty(personCertificate.getCertificationInfo())) {
bizMessage.setTraceId(String.valueOf(personBasic.getSequenceNbr())); personCertificate.getCertificationInfo().forEach(item -> {
try { item.setPersonId(personBasic.getSequenceNbr());
emqKeeper.getMqttClient().publish(RYFM_DATA_MQTT_TOPIC, personCertificateService.save(item);
JSON.toJSONString(bizMessage).getBytes(StandardCharsets.UTF_8), 2, false); });
} catch (MqttException e) { }
e.printStackTrace(); // 人员技能学历信息
} PersonSkillEducation personSkillEducation = new PersonSkillEducation();
} BeanUtils.copyProperties(personUser, personSkillEducation);
if (CollectionUtils.isNotEmpty(personCertificate.getCertificationInfo())) { personSkillEducation.setPersonId(personBasic.getSequenceNbr());
personCertificate.getCertificationInfo().forEach(item -> { personSkillEducationService.save(personSkillEducation);
item.setPersonId(personBasic.getSequenceNbr());
personCertificateService.save(item); // 人员账号信息
}); personAccount.setPersonId(personBasic.getSequenceNbr());
} personAccount.setPassword(DesUtil.encode(personAccount.getPassword(), secretKey));
// 人员技能学历信息 personAccount.setSecondaryPassword(DesUtil.encode(personAccount.getSecondaryPassword(), secretKey));
PersonSkillEducation personSkillEducation = new PersonSkillEducation(); personAccountService.save(personAccount);
BeanUtils.copyProperties(personUser, personSkillEducation); // 新增平台账号
personSkillEducation.setPersonId(personBasic.getSequenceNbr()); // 组装数据
personSkillEducationService.save(personSkillEducation); AgencyUserModel usd = new AgencyUserModel();
// 应用
// 人员账号信息 usd.setAppCodes(personAccount.getApplication());
personAccount.setPersonId(personBasic.getSequenceNbr()); // 手机号
personAccount.setPassword(DesUtil.encode(personAccount.getPassword(), secretKey)); usd.setMobile(personUser.getPhone());
personAccount.setSecondaryPassword(DesUtil.encode(personAccount.getSecondaryPassword(), secretKey)); // 角色
personAccountService.save(personAccount); Map<Long, List<Long>> map = new HashMap<>();
// 新增平台账号 List<Long> cdids = personAccount.getRoles().stream().map(s -> Long.parseLong(s.trim()))
// 组装数据 .collect(Collectors.toList()); // 测点数组
AgencyUserModel usd = new AgencyUserModel(); if (personAccount.getDepartmentId() != null) {
// 应用
usd.setAppCodes(personAccount.getApplication()); map.put(personAccount.getDepartmentId(), cdids);
// 手机号 } else {
usd.setMobile(personUser.getPhone()); map.put(personAccount.getProjectId(), cdids);
// 角色 }
Map<Long, List<Long>> map = new HashMap<>(); usd.setOrgRoleSeqs(map);
List<Long> cdids = personAccount.getRoles().stream().map(s -> Long.parseLong(s.trim())) // 密码
.collect(Collectors.toList()); // 测点数组 usd.setPassword(personAccount.getPassword());
if (personAccount.getDepartmentId() != null) { // 二次密码
usd.setRePassword(personAccount.getSecondaryPassword());
map.put(personAccount.getDepartmentId(), cdids); // 用户名
} else { usd.setRealName(personAccount.getName());
map.put(personAccount.getProjectId(), cdids); // 账号
} usd.setUserName(personAccount.getAccountName());
usd.setOrgRoleSeqs(map); usd.setLockStatus("UNLOCK");
// 密码 // 新增平台用户
usd.setPassword(personAccount.getPassword()); AgencyUserModel agencyUserModel = this.setcreateUser(usd);
// 二次密码 // 设置userID
usd.setRePassword(personAccount.getSecondaryPassword()); usd.setUserId(agencyUserModel.getUserId());
// 用户名 // 设置工号
usd.setRealName(personAccount.getName()); usd.setUserName(personAccount.getJobNumber());
// 账号 // 创建支持工号登录
usd.setUserName(personAccount.getAccountName()); this.createLoginInfo(usd);
usd.setLockStatus("UNLOCK"); // 查询部门
// 新增平台用户 DepartmentModel departmentModel = null;
AgencyUserModel agencyUserModel = this.setcreateUser(usd); if (personAccount.getDepartmentId() != null) {
// 设置userID departmentModel = this.getdepartmentModel(personAccount.getDepartmentId());
usd.setUserId(agencyUserModel.getUserId()); }
// 设置工号
usd.setUserName(personAccount.getJobNumber()); if (departmentModel != null) {
// 创建支持工号登录 // personBasic.setProjectOrgCode(departmentModel.getOrgCode());
this.createLoginInfo(usd); personAccount.setProjectDepartmentName(departmentModel.getDepartmentName());
// 查询部门 }
DepartmentModel departmentModel = null;
if (personAccount.getDepartmentId() != null) {
departmentModel = this.getdepartmentModel(personAccount.getDepartmentId());
}
if (departmentModel != null) {
// personBasic.setProjectOrgCode(departmentModel.getOrgCode());
personAccount.setProjectDepartmentName(departmentModel.getDepartmentName());
}
// personBasic.setProjectOrgCode(companyModel.getOrgCode()); // personBasic.setProjectOrgCode(companyModel.getOrgCode());
// //
// //
// if (personUser.getNativePlace()!=null) { // if (personUser.getNativePlace()!=null) {
// personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace())); // personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace()));
// } // }
personAccount.setPuserId(agencyUserModel.getUserId()); personAccount.setPuserId(agencyUserModel.getUserId());
personAccount.setProjectName(companyModel.getCompanyName()); personAccount.setProjectName(companyModel.getCompanyName());
// this.personBasicMapper.updateById(personBasic); // this.personBasicMapper.updateById(personBasic);
this.personAccountService.updateById(personAccount); this.personAccountService.updateById(personAccount);
// ----------------------------权限表中新增数据----------------------------- // ----------------------------权限表中新增数据-----------------------------
StdUserEmpower stdUserEmpower = new StdUserEmpower(); StdUserEmpower stdUserEmpower = new StdUserEmpower();
stdUserEmpower.setPermissionType("YTH"); stdUserEmpower.setPermissionType("YTH");
stdUserEmpower.setRecDate(new Date()); stdUserEmpower.setRecDate(new Date());
stdUserEmpower.setAmosOrgCode(Arrays.asList(personAccount.getYthPermission())); stdUserEmpower.setAmosOrgCode(Arrays.asList(personAccount.getYthPermission()));
stdUserEmpower.setAmosUserId(personAccount.getPuserId()); stdUserEmpower.setAmosUserId(personAccount.getPuserId());
userEmpowerMapper.insert(stdUserEmpower); userEmpowerMapper.insert(stdUserEmpower);
// ----------------------------户用管理端区域公司--------------------------- // ----------------------------户用管理端区域公司---------------------------
StdUserEmpower stdUserEmpowerhygf = new StdUserEmpower(); StdUserEmpower stdUserEmpowerhygf = new StdUserEmpower();
List<CompanyModel> co = userEmpowerMapper.getCompanyBoList("region", null, null); List<CompanyModel> co = userEmpowerMapper.getCompanyBoList("region", null, null);
List<String> re = personAccount.getRegionalCompaniesSeq(); List<String> re = personAccount.getRegionalCompaniesSeq();
String flag = personAccount.getRegionalCompaniesSeqFlag(); String flag = personAccount.getRegionalCompaniesSeqFlag();
if (flag != null && !flag.isEmpty()) { if (flag != null && !flag.isEmpty()) {
if (flag.equals("all")) { if (flag.equals("all")) {
List<String> all = new ArrayList<>(); List<String> all = new ArrayList<>();
all.add("all"); all.add("all");
stdUserEmpowerhygf.setAmosOrgCode(all); stdUserEmpowerhygf.setAmosOrgCode(all);
} else { } else {
stdUserEmpowerhygf.setAmosOrgCode(re); stdUserEmpowerhygf.setAmosOrgCode(re);
} }
} }
List<String> exre = personAccount.getExternalRegionalCompaniesSeq(); List<String> exre = personAccount.getExternalRegionalCompaniesSeq();
// if(exre!=null&&!exre.isEmpty()){ // if(exre!=null&&!exre.isEmpty()){
// List<String> pexre=new ArrayList<>(); // List<String> pexre=new ArrayList<>();
// List<CompanyModel> exreco = co.stream().filter(product -> !"area".equals(product.getLevel())).collect(Collectors.toList()); // List<CompanyModel> exreco = co.stream().filter(product -> !"area".equals(product.getLevel())).collect(Collectors.toList());
...@@ -397,275 +382,275 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -397,275 +382,275 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
// } // }
// stdUserEmpowerhygf.setEliminateAmosOrgCode(pexre); // stdUserEmpowerhygf.setEliminateAmosOrgCode(pexre);
// } // }
stdUserEmpowerhygf.setEliminateAmosOrgCode(exre); stdUserEmpowerhygf.setEliminateAmosOrgCode(exre);
stdUserEmpowerhygf.setPermissionType("HYGF"); stdUserEmpowerhygf.setPermissionType("HYGF");
stdUserEmpowerhygf.setRecDate(new Date()); stdUserEmpowerhygf.setRecDate(new Date());
stdUserEmpowerhygf.setAmosUserId(personAccount.getPuserId()); stdUserEmpowerhygf.setAmosUserId(personAccount.getPuserId());
userEmpowerMapper.insert(stdUserEmpowerhygf); userEmpowerMapper.insert(stdUserEmpowerhygf);
// ----------------------------权限表中新增数据----------------------------- // ----------------------------权限表中新增数据-----------------------------
PersonAccountFed personAccountFed = new PersonAccountFed(); PersonAccountFed personAccountFed = new PersonAccountFed();
BeanUtils.copyProperties(personAccount, personAccountFed); BeanUtils.copyProperties(personAccount, personAccountFed);
personAccountFed.setSyncState(0); personAccountFed.setSyncState(0);
personAccountFed.setSyncDate(new Date()); personAccountFed.setSyncDate(new Date());
personAccountFedMapper.insert(personAccountFed); personAccountFedMapper.insert(personAccountFed);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("SEQUENCE_NBR", agencyUserModel.getSequenceNbr()); data.put("SEQUENCE_NBR", agencyUserModel.getSequenceNbr());
ProduceMsg produceMsg = new ProduceMsg(data, INSERT, agencyUserModel.getUserId()); ProduceMsg produceMsg = new ProduceMsg(data, INSERT, agencyUserModel.getUserId());
querueProduce.produceMsg(JSON.toJSONString(produceMsg)); querueProduce.produceMsg(JSON.toJSONString(produceMsg));
} }
@Transactional @Transactional
public PersonDto updatePerson(PersonDto model, HttpServletRequest httpServletRequest, Long sequenceNbr) public PersonDto updatePerson(PersonDto model, HttpServletRequest httpServletRequest, Long sequenceNbr)
throws ParseException { throws ParseException {
if (!redisUtils.hasKey(Constants.JXIOP_DICT_POST) || !redisUtils.hasKey(Constants.JXIOP_DICT_CERTIFICATES)) { if (!redisUtils.hasKey(Constants.JXIOP_DICT_POST) || !redisUtils.hasKey(Constants.JXIOP_DICT_CERTIFICATES)) {
addRedisPostAndCerInfo(); addRedisPostAndCerInfo();
} }
// 岗位所需证书信息 // 岗位所需证书信息
Map<String, String> postNameMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_POST); Map<String, String> postNameMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_POST);
// 证书临期信息 // 证书临期信息
Map<String, String> certificatesMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_CERTIFICATES); Map<String, String> certificatesMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_CERTIFICATES);
// 获取人员基本信息数据 // 获取人员基本信息数据
PersonUser personUser = model.getPersonUser(); PersonUser personUser = model.getPersonUser();
// 获取人员账号信息 // 获取人员账号信息
PersonAccount personAccount = model.getPersonAccount(); PersonAccount personAccount = model.getPersonAccount();
PersonAccount oldpersonAccount = new PersonAccount(); PersonAccount oldpersonAccount = new PersonAccount();
personUser.setPhone(personAccount.getPhoneNum()); personUser.setPhone(personAccount.getPhoneNum());
// 人员基础信息 // 人员基础信息
PersonBasic personBasic = personBasicMapper.selectById(sequenceNbr); PersonBasic personBasic = personBasicMapper.selectById(sequenceNbr);
personBasic.setSequenceNbr(sequenceNbr); personBasic.setSequenceNbr(sequenceNbr);
personAccount.setPassword(DesUtil.encode(personAccount.getPassword(), secretKey)); personAccount.setPassword(DesUtil.encode(personAccount.getPassword(), secretKey));
personAccount.setSecondaryPassword(DesUtil.encode(personAccount.getSecondaryPassword(), secretKey)); personAccount.setSecondaryPassword(DesUtil.encode(personAccount.getSecondaryPassword(), secretKey));
// 人员归属信息 // 人员归属信息
PersonSkillEducation personSkillEducation = new PersonSkillEducation(); PersonSkillEducation personSkillEducation = new PersonSkillEducation();
BeanUtils.copyProperties(personUser, personSkillEducation); BeanUtils.copyProperties(personUser, personSkillEducation);
personSkillEducation.setPersonId(personBasic.getSequenceNbr()); personSkillEducation.setPersonId(personBasic.getSequenceNbr());
PersonSkillEducation personSkillEducationd = personSkillEducationService PersonSkillEducation personSkillEducationd = personSkillEducationService
.getOne(new QueryWrapper<PersonSkillEducation>().eq("person_id", personBasic.getSequenceNbr())); .getOne(new QueryWrapper<PersonSkillEducation>().eq("person_id", personBasic.getSequenceNbr()));
personSkillEducation.setSequenceNbr(personSkillEducationd.getSequenceNbr()); personSkillEducation.setSequenceNbr(personSkillEducationd.getSequenceNbr());
personSkillEducationService.updateById(personSkillEducation); personSkillEducationService.updateById(personSkillEducation);
// 获取人员资质信息 // 获取人员资质信息
CertificationInfo personCertificate = model.getPersonCertificate(); CertificationInfo personCertificate = model.getPersonCertificate();
LambdaUpdateWrapper<PersonCertificate> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<PersonCertificate> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(PersonCertificate::getPersonId, personBasic.getSequenceNbr()); wrapper.eq(PersonCertificate::getPersonId, personBasic.getSequenceNbr());
personCertificateService.remove(wrapper); personCertificateService.remove(wrapper);
// 默认红码 // 默认红码
// personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode()); // personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
// 该岗位应获得的证书 // 该岗位应获得的证书
List<String> list2 = new ArrayList<>(); List<String> list2 = new ArrayList<>();
if (StringUtils.isNotEmpty(personUser.getPostName())) { if (StringUtils.isNotEmpty(personUser.getPostName())) {
String certificates = String.valueOf(postNameMap.get(personUser.getPostName())); String certificates = String.valueOf(postNameMap.get(personUser.getPostName()));
if (!StringUtils.isEmpty(certificates)) { if (!StringUtils.isEmpty(certificates)) {
list2 = Arrays.asList(certificates.split(",")); list2 = Arrays.asList(certificates.split(","));
} }
} }
List<String> list = new ArrayList(list2); List<String> list = new ArrayList(list2);
// 人员资质信息 // 人员资质信息
Integer isInMonth = 0; Integer isInMonth = 0;
Integer isOver = 0; Integer isOver = 0;
// 过期的证书 // 过期的证书
List<String> overCertificateList = new ArrayList<>(); List<String> overCertificateList = new ArrayList<>();
// 临期证书 // 临期证书
List<String> inMonthCertificateList = new ArrayList<>(); List<String> inMonthCertificateList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(personCertificate.getCertificationInfo())) { if (CollectionUtils.isNotEmpty(personCertificate.getCertificationInfo())) {
for (PersonCertificate item : personCertificate.getCertificationInfo()) { for (PersonCertificate item : personCertificate.getCertificationInfo()) {
if (StringUtils.isNotEmpty(item.getValidPeriod()) && !Objects.isNull(item.getCertificateTime())) { if (StringUtils.isNotEmpty(item.getValidPeriod()) && !Objects.isNull(item.getCertificateTime())) {
int validPeriod = StringUtils.isEmpty(item.getValidPeriod()) ? 3 int validPeriod = StringUtils.isEmpty(item.getValidPeriod()) ? 3
: Integer.parseInt(item.getValidPeriod()); : Integer.parseInt(item.getValidPeriod());
Date date = DateUtils.dateAddYears(item.getCertificateTime(), validPeriod); Date date = DateUtils.dateAddYears(item.getCertificateTime(), validPeriod);
if (list.contains(item.getCertificateName()) && DateUtils.dateCompare(date, new Date()) == -1) { if (list.contains(item.getCertificateName()) && DateUtils.dateCompare(date, new Date()) == -1) {
isOver = 1; isOver = 1;
overCertificateList.add(item.getCertificateName()); overCertificateList.add(item.getCertificateName());
} }
if (list.contains(item.getCertificateName()) if (list.contains(item.getCertificateName())
&& DateUtils.dateBetweenIncludeToday(new Date(), date) < Integer && DateUtils.dateBetweenIncludeToday(new Date(), date) < Integer
.valueOf(certificatesMap.get(item.getCertificateName())) .valueOf(certificatesMap.get(item.getCertificateName()))
&& DateUtils.dateCompare(date, new Date()) == 1) { && DateUtils.dateCompare(date, new Date()) == 1) {
isInMonth = 1; isInMonth = 1;
inMonthCertificateList.add(item.getCertificateName()); inMonthCertificateList.add(item.getCertificateName());
} }
item.setPersonId(personBasic.getSequenceNbr()); item.setPersonId(personBasic.getSequenceNbr());
personCertificateService.save(item); personCertificateService.save(item);
} }
list.remove(item.getCertificateName()); list.remove(item.getCertificateName());
} }
} }
// 缺证 // 缺证
List<String> noCertificateList = new ArrayList<>(list); List<String> noCertificateList = new ArrayList<>(list);
List<String> strings = new ArrayList<>(); List<String> strings = new ArrayList<>();
if (CollectionUtils.isNotEmpty(overCertificateList)) { if (CollectionUtils.isNotEmpty(overCertificateList)) {
strings.add("过期证书:" + String.join(",", overCertificateList)); strings.add("过期证书:" + String.join(",", overCertificateList));
} }
if (CollectionUtils.isNotEmpty(inMonthCertificateList)) { if (CollectionUtils.isNotEmpty(inMonthCertificateList)) {
strings.add("临期证书:" + String.join(",", inMonthCertificateList)); strings.add("临期证书:" + String.join(",", inMonthCertificateList));
} }
if (CollectionUtils.isNotEmpty(noCertificateList)) { if (CollectionUtils.isNotEmpty(noCertificateList)) {
strings.add("缺少证书:" + String.join(",", noCertificateList)); strings.add("缺少证书:" + String.join(",", noCertificateList));
} }
String join = ""; String join = "";
if (CollectionUtils.isNotEmpty(strings)) { if (CollectionUtils.isNotEmpty(strings)) {
join = String.join(";", strings); join = String.join(";", strings);
} }
String missingCertificateOld = personBasic.getMissingCertificate(); String missingCertificateOld = personBasic.getMissingCertificate();
personBasic.setMissingCertificate(join); personBasic.setMissingCertificate(join);
CompanyModel companyModel = new CompanyModel(); CompanyModel companyModel = new CompanyModel();
// 单位 // 单位
companyModel = this.getCompanyModel(personAccount.getProjectId()); companyModel = this.getCompanyModel(personAccount.getProjectId());
String qrcodeColorOld = personBasic.getQrcodeColor(); String qrcodeColorOld = personBasic.getQrcodeColor();
if (CollectionUtils.isEmpty(list) && isInMonth == 0 && isOver == 0) { if (CollectionUtils.isEmpty(list) && isInMonth == 0 && isOver == 0) {
personBasic.setQrcodeColor(QrcodeColorEnum.GREEN.getCode()); personBasic.setQrcodeColor(QrcodeColorEnum.GREEN.getCode());
personBasic.setQrcodeDesc("证书齐全"); personBasic.setQrcodeDesc("证书齐全");
personBasic.setQrcodeDate(new Date()); personBasic.setQrcodeDate(new Date());
} else if ((CollectionUtils.isEmpty(list) && isOver == 1) || (CollectionUtils.isNotEmpty(list))) { } else if ((CollectionUtils.isEmpty(list) && isOver == 1) || (CollectionUtils.isNotEmpty(list))) {
personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode()); personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
personBasic.setQrcodeDesc("证书不全"); personBasic.setQrcodeDesc("证书不全");
personBasic.setQrcodeDate(new Date()); personBasic.setQrcodeDate(new Date());
} else if (CollectionUtils.isEmpty(list) && isOver == 0 && isInMonth == 1) { } else if (CollectionUtils.isEmpty(list) && isOver == 0 && isInMonth == 1) {
personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode()); personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode());
personBasic.setQrcodeDesc("证书临期"); personBasic.setQrcodeDesc("证书临期");
personBasic.setQrcodeDate(new Date()); personBasic.setQrcodeDate(new Date());
} }
personBasic.setProjectOrgCode(companyModel.getOrgCode()); personBasic.setProjectOrgCode(companyModel.getOrgCode());
personAccount.setProjectName(companyModel.getCompanyName()); personAccount.setProjectName(companyModel.getCompanyName());
// 人员账号信息 // 人员账号信息
personAccount.setPersonId(sequenceNbr); personAccount.setPersonId(sequenceNbr);
oldpersonAccount = personAccountService.getById(personAccount.getSequenceNbr()); oldpersonAccount = personAccountService.getById(personAccount.getSequenceNbr());
personAccountService.updateById(personAccount); personAccountService.updateById(personAccount);
// 新增平台账号 // 新增平台账号
// 组装数据 // 组装数据
AgencyUserModel usd = new AgencyUserModel(); AgencyUserModel usd = new AgencyUserModel();
// 应用 // 应用
usd.setAppCodes(personAccount.getApplication()); usd.setAppCodes(personAccount.getApplication());
// 手机号 // 手机号
usd.setMobile(personUser.getPhone()); usd.setMobile(personUser.getPhone());
// 角色 // 角色
Map<Long, List<Long>> map = new HashMap<>(); Map<Long, List<Long>> map = new HashMap<>();
List<Long> cdids = personAccount.getRoles().stream().map(s -> Long.parseLong(s.trim())) List<Long> cdids = personAccount.getRoles().stream().map(s -> Long.parseLong(s.trim()))
.collect(Collectors.toList()); // 测点数组 .collect(Collectors.toList()); // 测点数组
if (personAccount.getDepartmentId() != null) { if (personAccount.getDepartmentId() != null) {
map.put(personAccount.getDepartmentId(), cdids); map.put(personAccount.getDepartmentId(), cdids);
} else { } else {
map.put(personAccount.getProjectId(), cdids); map.put(personAccount.getProjectId(), cdids);
} }
usd.setOrgRoleSeqs(map); usd.setOrgRoleSeqs(map);
// 密码 // 密码
usd.setPassword(personAccount.getPassword()); usd.setPassword(personAccount.getPassword());
// 二次密码 // 二次密码
usd.setRePassword(personAccount.getSecondaryPassword()); usd.setRePassword(personAccount.getSecondaryPassword());
// 用户名 // 用户名
usd.setRealName(personAccount.getName()); usd.setRealName(personAccount.getName());
// 账号 // 账号
usd.setUserName(personAccount.getAccountName()); usd.setUserName(personAccount.getAccountName());
usd.setLockStatus("UNLOCK"); usd.setLockStatus("UNLOCK");
usd.setUserId(personAccount.getPuserId()); usd.setUserId(personAccount.getPuserId());
usd.setOriginalPassword(oldpersonAccount.getPassword()); usd.setOriginalPassword(oldpersonAccount.getPassword());
// 新增平台用户 // 新增平台用户
AgencyUserModel agencyUserModel = this.updateuser(personAccount.getPuserId(), usd); AgencyUserModel agencyUserModel = this.updateuser(personAccount.getPuserId(), usd);
log.info("更新平台账户信息::" + JSONObject.toJSONString(usd)); log.info("更新平台账户信息::" + JSONObject.toJSONString(usd));
// 设置userID // 设置userID
usd.setUserId(agencyUserModel.getUserId()); usd.setUserId(agencyUserModel.getUserId());
// 设置工号 // 设置工号
usd.setUserName(personAccount.getJobNumber()); usd.setUserName(personAccount.getJobNumber());
// 创建支持工号登录 // 创建支持工号登录
this.updateLoginInfo(oldpersonAccount.getJobNumber(), usd); this.updateLoginInfo(oldpersonAccount.getJobNumber(), usd);
// 查询部门 // 查询部门
DepartmentModel departmentModel = null; DepartmentModel departmentModel = null;
if (personAccount.getDepartmentId() != null) { if (personAccount.getDepartmentId() != null) {
departmentModel = this.getdepartmentModel(personAccount.getDepartmentId()); departmentModel = this.getdepartmentModel(personAccount.getDepartmentId());
} }
BeanUtils.copyProperties(personUser, personBasic, "qrcodeDesc", "qrcodeColor"); BeanUtils.copyProperties(personUser, personBasic, "qrcodeDesc", "qrcodeColor");
if (departmentModel != null) { if (departmentModel != null) {
// personBasic.setProjectOrgCode(departmentModel.getOrgCode()); // personBasic.setProjectOrgCode(departmentModel.getOrgCode());
personAccount.setProjectDepartmentName(departmentModel.getDepartmentName()); personAccount.setProjectDepartmentName(departmentModel.getDepartmentName());
} }
personBasic.setProjectOrgCode(companyModel.getOrgCode()); personBasic.setProjectOrgCode(companyModel.getOrgCode());
if (personUser.getNativePlace() != null) { if (personUser.getNativePlace() != null) {
personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace())); personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace()));
} }
personAccount.setProjectName(companyModel.getCompanyName()); personAccount.setProjectName(companyModel.getCompanyName());
if (!join.equals(missingCertificateOld)) { if (!join.equals(missingCertificateOld)) {
personBasic.setRecDate(new Date()); personBasic.setRecDate(new Date());
this.personBasicMapper.updateById(personBasic); this.personBasicMapper.updateById(personBasic);
if (("证书不全".equals(personBasic.getQrcodeDesc()) || "证书临期".equals(personBasic.getQrcodeDesc()))) { if (("证书不全".equals(personBasic.getQrcodeDesc()) || "证书临期".equals(personBasic.getQrcodeDesc()))) {
BizMessage bizMessage = new BizMessage(); BizMessage bizMessage = new BizMessage();
bizMessage.setIndexKey("RYFM"); bizMessage.setIndexKey("RYFM");
bizMessage.setIndexValue(personBasic.getPostName() + personBasic.getQrcodeDesc()); bizMessage.setIndexValue(personBasic.getPostName() + personBasic.getQrcodeDesc());
RiskBizInfoVo riskBizInfoVo = fetchData(personBasic, personAccount, join); RiskBizInfoVo riskBizInfoVo = fetchData(personBasic, personAccount, join);
bizMessage.setBizInfo(riskBizInfoVo); bizMessage.setBizInfo(riskBizInfoVo);
bizMessage.setDataSource("人员赋码"); bizMessage.setDataSource("人员赋码");
try { try {
emqKeeper.getMqttClient().publish(PersonBasicServiceImpl.RYFM_DATA_MQTT_TOPIC, emqKeeper.getMqttClient().publish(PersonBasicServiceImpl.RYFM_DATA_MQTT_TOPIC,
JSON.toJSONString(bizMessage).getBytes(StandardCharsets.UTF_8), 2, false); JSON.toJSONString(bizMessage).getBytes(StandardCharsets.UTF_8), 2, false);
} catch (MqttException e) { } catch (MqttException e) {
e.printStackTrace(); e.printStackTrace();
} }
} else if ("证书齐全".equals(personBasic.getQrcodeDesc())) { } else if ("证书齐全".equals(personBasic.getQrcodeDesc())) {
HashMap<String, String> personMap = new HashMap<>(); HashMap<String, String> personMap = new HashMap<>();
personMap.put("objectId", String.valueOf(personBasic.getSequenceNbr())); personMap.put("objectId", String.valueOf(personBasic.getSequenceNbr()));
personMap.put("qrCodeColor", qrcodeColorOld); personMap.put("qrCodeColor", qrcodeColorOld);
personMap.put("warningObjectType", "RYFM"); personMap.put("warningObjectType", "RYFM");
personMap.put("sourceAttribution", personBasic.getProjectOrgCode()); personMap.put("sourceAttribution", personBasic.getProjectOrgCode());
personMap.put("sourceAttributionDesc", personAccount.getProjectName()); personMap.put("sourceAttributionDesc", personAccount.getProjectName());
personMap.put("warningSourceType", "人员赋码"); personMap.put("warningSourceType", "人员赋码");
try { try {
emqKeeper.getMqttClient().publish(PersonBasicServiceImpl.RYFM_GREEN, emqKeeper.getMqttClient().publish(PersonBasicServiceImpl.RYFM_GREEN,
JSON.toJSONString(personMap).getBytes(StandardCharsets.UTF_8), 2, false); JSON.toJSONString(personMap).getBytes(StandardCharsets.UTF_8), 2, false);
} catch (MqttException e) { } catch (MqttException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} else { } else {
this.personBasicMapper.updateById(personBasic); this.personBasicMapper.updateById(personBasic);
} }
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>() StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>()
.eq("amos_user_id", personAccount.getPuserId()).eq("permission_type", "YTH")); .eq("amos_user_id", personAccount.getPuserId()).eq("permission_type", "YTH"));
if (ObjectUtils.isEmpty(stdUserEmpower)) { if (ObjectUtils.isEmpty(stdUserEmpower)) {
stdUserEmpower = new StdUserEmpower(); stdUserEmpower = new StdUserEmpower();
stdUserEmpower.setRecDate(new Date()); stdUserEmpower.setRecDate(new Date());
stdUserEmpower.setPermissionType("YTH"); stdUserEmpower.setPermissionType("YTH");
stdUserEmpower.setAmosOrgCode(Arrays.asList(personAccount.getYthPermission())); stdUserEmpower.setAmosOrgCode(Arrays.asList(personAccount.getYthPermission()));
stdUserEmpower.setAmosUserId(personAccount.getPuserId()); stdUserEmpower.setAmosUserId(personAccount.getPuserId());
userEmpowerMapper.insert(stdUserEmpower); userEmpowerMapper.insert(stdUserEmpower);
} else { } else {
stdUserEmpower.setAmosOrgCode(Arrays.asList(personAccount.getYthPermission())); stdUserEmpower.setAmosOrgCode(Arrays.asList(personAccount.getYthPermission()));
stdUserEmpower.setRecDate(new Date()); stdUserEmpower.setRecDate(new Date());
userEmpowerMapper.updateById(stdUserEmpower); userEmpowerMapper.updateById(stdUserEmpower);
} }
// 户用角色权限 // 户用角色权限
StdUserEmpower stdUserEmpowerhygf = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>() StdUserEmpower stdUserEmpowerhygf = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>()
.eq("amos_user_id", personAccount.getPuserId()).eq("permission_type", "HYGF")); .eq("amos_user_id", personAccount.getPuserId()).eq("permission_type", "HYGF"));
if (ObjectUtils.isEmpty(stdUserEmpowerhygf)) { if (ObjectUtils.isEmpty(stdUserEmpowerhygf)) {
stdUserEmpowerhygf = new StdUserEmpower(); stdUserEmpowerhygf = new StdUserEmpower();
List<CompanyModel> co = userEmpowerMapper.getCompanyBoList("region", null, null); List<CompanyModel> co = userEmpowerMapper.getCompanyBoList("region", null, null);
List<String> re = personAccount.getRegionalCompaniesSeq(); List<String> re = personAccount.getRegionalCompaniesSeq();
String flag = personAccount.getRegionalCompaniesSeqFlag(); String flag = personAccount.getRegionalCompaniesSeqFlag();
if (flag != null && !flag.isEmpty()) { if (flag != null && !flag.isEmpty()) {
if (flag.equals("all")) { if (flag.equals("all")) {
List<String> all = new ArrayList<>(); List<String> all = new ArrayList<>();
all.add("all"); all.add("all");
stdUserEmpowerhygf.setAmosOrgCode(all); stdUserEmpowerhygf.setAmosOrgCode(all);
} else { } else {
stdUserEmpowerhygf.setAmosOrgCode(re); stdUserEmpowerhygf.setAmosOrgCode(re);
} }
} }
List<String> exre = personAccount.getExternalRegionalCompaniesSeq(); List<String> exre = personAccount.getExternalRegionalCompaniesSeq();
// if(exre!=null&&!exre.isEmpty()){ // if(exre!=null&&!exre.isEmpty()){
// List<String> pexre=new ArrayList<>(); // List<String> pexre=new ArrayList<>();
// List<CompanyModel> exreco = co.stream().filter(product -> !"area".equals(product.getLevel())).collect(Collectors.toList()); // List<CompanyModel> exreco = co.stream().filter(product -> !"area".equals(product.getLevel())).collect(Collectors.toList());
...@@ -676,27 +661,27 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -676,27 +661,27 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
// } // }
// stdUserEmpowerhygf.setEliminateAmosOrgCode(pexre); // stdUserEmpowerhygf.setEliminateAmosOrgCode(pexre);
// } // }
stdUserEmpowerhygf.setEliminateAmosOrgCode(exre); stdUserEmpowerhygf.setEliminateAmosOrgCode(exre);
stdUserEmpowerhygf.setPermissionType("HYGF"); stdUserEmpowerhygf.setPermissionType("HYGF");
stdUserEmpowerhygf.setRecDate(new Date()); stdUserEmpowerhygf.setRecDate(new Date());
stdUserEmpowerhygf.setAmosUserId(personAccount.getPuserId()); stdUserEmpowerhygf.setAmosUserId(personAccount.getPuserId());
userEmpowerMapper.insert(stdUserEmpowerhygf); userEmpowerMapper.insert(stdUserEmpowerhygf);
} else { } else {
// List<CompanyModel> co= userEmpowerMapper.getCompanyBoList("region",null,null); // List<CompanyModel> co= userEmpowerMapper.getCompanyBoList("region",null,null);
List<String> re = personAccount.getRegionalCompaniesSeq(); List<String> re = personAccount.getRegionalCompaniesSeq();
String flag = personAccount.getRegionalCompaniesSeqFlag(); String flag = personAccount.getRegionalCompaniesSeqFlag();
if (flag != null && !flag.isEmpty()) { if (flag != null && !flag.isEmpty()) {
if (flag.equals("all")) { if (flag.equals("all")) {
List<String> all = new ArrayList<>(); List<String> all = new ArrayList<>();
all.add("all"); all.add("all");
stdUserEmpowerhygf.setAmosOrgCode(all); stdUserEmpowerhygf.setAmosOrgCode(all);
} else { } else {
stdUserEmpowerhygf.setAmosOrgCode(re); stdUserEmpowerhygf.setAmosOrgCode(re);
} }
} else { } else {
stdUserEmpowerhygf.setAmosOrgCode(re); stdUserEmpowerhygf.setAmosOrgCode(re);
} }
List<String> exre = personAccount.getExternalRegionalCompaniesSeq(); List<String> exre = personAccount.getExternalRegionalCompaniesSeq();
// if(exre!=null&&!exre.isEmpty()){ // if(exre!=null&&!exre.isEmpty()){
// List<String> pexre=new ArrayList<>(); // List<String> pexre=new ArrayList<>();
// List<CompanyModel> exreco = co.stream().filter(product -> !"area".equals(product.getLevel())).collect(Collectors.toList()); // List<CompanyModel> exreco = co.stream().filter(product -> !"area".equals(product.getLevel())).collect(Collectors.toList());
...@@ -707,268 +692,268 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -707,268 +692,268 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
// } // }
// stdUserEmpowerhygf.setEliminateAmosOrgCode(pexre); // stdUserEmpowerhygf.setEliminateAmosOrgCode(pexre);
// } // }
stdUserEmpowerhygf.setEliminateAmosOrgCode(exre); stdUserEmpowerhygf.setEliminateAmosOrgCode(exre);
stdUserEmpowerhygf.setPermissionType("HYGF"); stdUserEmpowerhygf.setPermissionType("HYGF");
stdUserEmpowerhygf.setRecDate(new Date()); stdUserEmpowerhygf.setRecDate(new Date());
stdUserEmpowerhygf.setAmosUserId(personAccount.getPuserId()); stdUserEmpowerhygf.setAmosUserId(personAccount.getPuserId());
userEmpowerMapper.updateById(stdUserEmpowerhygf); userEmpowerMapper.updateById(stdUserEmpowerhygf);
} }
personAccountService.updateById(personAccount); personAccountService.updateById(personAccount);
PersonAccountFed personAccountFed = new PersonAccountFed(); PersonAccountFed personAccountFed = new PersonAccountFed();
BeanUtils.copyProperties(personAccount, personAccountFed); BeanUtils.copyProperties(personAccount, personAccountFed);
personAccountFed.setSyncState(1); personAccountFed.setSyncState(1);
personAccountFed.setSyncDate(new Date()); personAccountFed.setSyncDate(new Date());
personAccountFedMapper.updateById(personAccountFed); personAccountFedMapper.updateById(personAccountFed);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("SEQUENCE_NBR", agencyUserModel.getSequenceNbr()); data.put("SEQUENCE_NBR", agencyUserModel.getSequenceNbr());
ProduceMsg produceMsg = new ProduceMsg(data, UPDATE, agencyUserModel.getUserId()); ProduceMsg produceMsg = new ProduceMsg(data, UPDATE, agencyUserModel.getUserId());
querueProduce.produceMsg(JSON.toJSONString(produceMsg)); querueProduce.produceMsg(JSON.toJSONString(produceMsg));
return model; return model;
} }
@Transactional @Transactional
public PersonDto getPerson(Long sequenceNbr, String type) { public PersonDto getPerson(Long sequenceNbr, String type) {
PersonDto personDto = new PersonDto(); PersonDto personDto = new PersonDto();
PersonUser personUser = new PersonUser(); PersonUser personUser = new PersonUser();
QueryWrapper<PersonBasic> wrapper1 = new QueryWrapper(); QueryWrapper<PersonBasic> wrapper1 = new QueryWrapper();
wrapper1.eq("sequence_nbr", sequenceNbr); wrapper1.eq("sequence_nbr", sequenceNbr);
wrapper1.eq("is_delete", 0); wrapper1.eq("is_delete", 0);
// 人员基础信息 // 人员基础信息
PersonBasic personBasic = this.getOne(wrapper1); PersonBasic personBasic = this.getOne(wrapper1);
BeanUtils.copyProperties(personBasic, personUser); BeanUtils.copyProperties(personBasic, personUser);
// 人员技能学历信息 // 人员技能学历信息
QueryWrapper<PersonSkillEducation> wrapper2 = new QueryWrapper(); QueryWrapper<PersonSkillEducation> wrapper2 = new QueryWrapper();
wrapper2.eq("person_id", sequenceNbr); wrapper2.eq("person_id", sequenceNbr);
PersonSkillEducation personSkillEducation = personSkillEducationService.getOne(wrapper2); PersonSkillEducation personSkillEducation = personSkillEducationService.getOne(wrapper2);
BeanUtils.copyProperties(personSkillEducation, personUser); BeanUtils.copyProperties(personSkillEducation, personUser);
// 人员资质信息 // 人员资质信息
LambdaQueryWrapper<PersonCertificate> personCertificateLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PersonCertificate> personCertificateLambdaQueryWrapper = new LambdaQueryWrapper<>();
personCertificateLambdaQueryWrapper.eq(PersonCertificate::getPersonId, sequenceNbr); personCertificateLambdaQueryWrapper.eq(PersonCertificate::getPersonId, sequenceNbr);
List<PersonCertificate> list = personCertificateService.list(personCertificateLambdaQueryWrapper); List<PersonCertificate> list = personCertificateService.list(personCertificateLambdaQueryWrapper);
CertificationInfo certificationInfo = new CertificationInfo(); CertificationInfo certificationInfo = new CertificationInfo();
certificationInfo.setCertificationInfo(list); certificationInfo.setCertificationInfo(list);
QueryWrapper<PersonAccount> wrapper4 = new QueryWrapper(); QueryWrapper<PersonAccount> wrapper4 = new QueryWrapper();
wrapper4.eq("person_id", sequenceNbr); wrapper4.eq("person_id", sequenceNbr);
// 人员账号信息 // 人员账号信息
PersonAccount personAccount = personAccountService.getOne(wrapper4); PersonAccount personAccount = personAccountService.getOne(wrapper4);
personAccount.setPhoneNum(personBasic.getPhone()); personAccount.setPhoneNum(personBasic.getPhone());
// 对于密码进行解密 // 对于密码进行解密
if ("look".equals(type)) { if ("look".equals(type)) {
personAccount.setIdNumber(DesensitizedUtil.idCardNum(personAccount.getIdNumber(), 0, 4)); personAccount.setIdNumber(DesensitizedUtil.idCardNum(personAccount.getIdNumber(), 0, 4));
} else { } else {
personAccount.setPassword(DesUtil.decode(personAccount.getPassword(), secretKey)); personAccount.setPassword(DesUtil.decode(personAccount.getPassword(), secretKey));
personAccount.setSecondaryPassword(DesUtil.decode(personAccount.getSecondaryPassword(), secretKey)); personAccount.setSecondaryPassword(DesUtil.decode(personAccount.getSecondaryPassword(), secretKey));
} }
if (personBasic.getNativePlace() != null) { if (personBasic.getNativePlace() != null) {
personUser.setNativePlace(JSON.parseArray(personBasic.getNativePlace(), Integer.class)); personUser.setNativePlace(JSON.parseArray(personBasic.getNativePlace(), Integer.class));
} }
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>() StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>()
.eq("amos_user_id", personAccount.getPuserId()).eq("permission_type", "YTH")); .eq("amos_user_id", personAccount.getPuserId()).eq("permission_type", "YTH"));
if (!ObjectUtils.isEmpty(stdUserEmpower)) { if (!ObjectUtils.isEmpty(stdUserEmpower)) {
personAccount.setYthPermission(stdUserEmpower.getAmosOrgCode().get(0)); personAccount.setYthPermission(stdUserEmpower.getAmosOrgCode().get(0));
} }
StdUserEmpower stdUserEmpowerhygf = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>() StdUserEmpower stdUserEmpowerhygf = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>()
.eq("amos_user_id", personAccount.getPuserId()).eq("permission_type", "HYGF")); .eq("amos_user_id", personAccount.getPuserId()).eq("permission_type", "HYGF"));
if (!ObjectUtils.isEmpty(stdUserEmpowerhygf)) { if (!ObjectUtils.isEmpty(stdUserEmpowerhygf)) {
if (stdUserEmpowerhygf.getAmosOrgCode() == null || stdUserEmpowerhygf.getAmosOrgCode().size() == 0) { if (stdUserEmpowerhygf.getAmosOrgCode() == null || stdUserEmpowerhygf.getAmosOrgCode().size() == 0) {
// List<String> list2 = new ArrayList<>(); // List<String> list2 = new ArrayList<>();
// list2.add("all"); // list2.add("all");
personAccount.setRegionalCompaniesSeq(null); personAccount.setRegionalCompaniesSeq(null);
} else if (stdUserEmpowerhygf.getAmosOrgCode().size() == 1 } else if (stdUserEmpowerhygf.getAmosOrgCode().size() == 1
&& stdUserEmpowerhygf.getAmosOrgCode().get(0).equals("all")) { && stdUserEmpowerhygf.getAmosOrgCode().get(0).equals("all")) {
personAccount.setRegionalCompaniesSeqFlag("all"); personAccount.setRegionalCompaniesSeqFlag("all");
personAccount.setRegionalCompaniesSeq(null); personAccount.setRegionalCompaniesSeq(null);
} else { } else {
personAccount.setRegionalCompaniesSeqFlag("no"); personAccount.setRegionalCompaniesSeqFlag("no");
personAccount.setRegionalCompaniesSeq(stdUserEmpowerhygf.getAmosOrgCode()); personAccount.setRegionalCompaniesSeq(stdUserEmpowerhygf.getAmosOrgCode());
} }
personAccount.setExternalRegionalCompaniesSeq(stdUserEmpowerhygf.getEliminateAmosOrgCode()); personAccount.setExternalRegionalCompaniesSeq(stdUserEmpowerhygf.getEliminateAmosOrgCode());
} }
personDto.setPersonUser(personUser); personDto.setPersonUser(personUser);
personDto.setPersonCertificate(certificationInfo); personDto.setPersonCertificate(certificationInfo);
personDto.setPersonAccount(personAccount); personDto.setPersonAccount(personAccount);
return personDto; return personDto;
} }
@Transactional @Transactional
public int deletePerson(String[] ids) { public int deletePerson(String[] ids) {
// 查询所有平台用户 // 查询所有平台用户
QueryWrapper<PersonAccount> wrapper = new QueryWrapper(); QueryWrapper<PersonAccount> wrapper = new QueryWrapper();
wrapper.in("person_id", ids); wrapper.in("person_id", ids);
List<PersonAccount> list = personAccountService.list(wrapper); List<PersonAccount> list = personAccountService.list(wrapper);
List<String> userid = new ArrayList<>(); List<String> userid = new ArrayList<>();
// List<String> loginId = new ArrayList<>(); // List<String> loginId = new ArrayList<>();
for (PersonAccount personAccount : list) { for (PersonAccount personAccount : list) {
userid.add(personAccount.getPuserId()); userid.add(personAccount.getPuserId());
// loginId.add(personAccount.getJobNumber()); // loginId.add(personAccount.getJobNumber());
} }
// 删除平台 // 删除平台
int deleteResult = personBasicMapper.deleteList(ids); int deleteResult = personBasicMapper.deleteList(ids);
this.deleuser(String.join(",", userid)); this.deleuser(String.join(",", userid));
//// this.deleteLoginInfo(String.join(",", loginId)); //// this.deleteLoginInfo(String.join(",", loginId));
// this.deleteLoginInfo(loginId.get(1)); // this.deleteLoginInfo(loginId.get(1));
QueryWrapper<PersonAccountFed> wrapper1 = new QueryWrapper(); QueryWrapper<PersonAccountFed> wrapper1 = new QueryWrapper();
wrapper1.in("person_id", ids); wrapper1.in("person_id", ids);
personAccountFedMapper.delete(wrapper1); personAccountFedMapper.delete(wrapper1);
userEmpowerMapper userEmpowerMapper
.delete(new QueryWrapper<StdUserEmpower>().in("amos_user_id", userid).eq("permission_type", "YTH")); .delete(new QueryWrapper<StdUserEmpower>().in("amos_user_id", userid).eq("permission_type", "YTH"));
return deleteResult; return deleteResult;
} }
// 新增平台用户 // 新增平台用户
private AgencyUserModel setcreateUser(AgencyUserModel userDto) { private AgencyUserModel setcreateUser(AgencyUserModel userDto) {
FeignClientResult<AgencyUserModel> amosUser = Privilege.agencyUserClient.create(userDto); FeignClientResult<AgencyUserModel> amosUser = Privilege.agencyUserClient.create(userDto);
AgencyUserModel user = new AgencyUserModel(); AgencyUserModel user = new AgencyUserModel();
if (!ObjectUtils.isEmpty(amosUser)) { if (!ObjectUtils.isEmpty(amosUser)) {
if (amosUser.getStatus() == 200) { if (amosUser.getStatus() == 200) {
user = amosUser.getResult(); user = amosUser.getResult();
} else { } else {
throw new RuntimeException(amosUser.getMessage()); throw new RuntimeException(amosUser.getMessage());
} }
} }
return user; return user;
} }
private LoginInfoModel createLoginInfo(AgencyUserModel userDto) { private LoginInfoModel createLoginInfo(AgencyUserModel userDto) {
FeignClientResult<LoginInfoModel> amosLoginfo = null; FeignClientResult<LoginInfoModel> amosLoginfo = null;
try { try {
amosLoginfo = Privilege.agencyUserClient.createLoginInfo(userDto); amosLoginfo = Privilege.agencyUserClient.createLoginInfo(userDto);
} catch (Exception e) { } catch (Exception e) {
FeignClientResult<List<String>> cResult = Privilege.agencyUserClient.multDeleteUser(userDto.getUserId(), FeignClientResult<List<String>> cResult = Privilege.agencyUserClient.multDeleteUser(userDto.getUserId(),
true); true);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
return amosLoginfo.getResult(); return amosLoginfo.getResult();
} }
// 修改平台用户 // 修改平台用户
private AgencyUserModel updateuser(String userId, AgencyUserModel userDto) { private AgencyUserModel updateuser(String userId, AgencyUserModel userDto) {
FeignClientResult<AgencyUserModel> amosUser = null; FeignClientResult<AgencyUserModel> amosUser = null;
FeignClientResult<AgencyUserModel> amosUser1 = null; FeignClientResult<AgencyUserModel> amosUser1 = null;
try { try {
amosUser = Privilege.agencyUserClient.update(userDto, userId); amosUser = Privilege.agencyUserClient.update(userDto, userId);
amosUser1 = Privilege.agencyUserClient.modifyPassword(userId, userDto); amosUser1 = Privilege.agencyUserClient.modifyPassword(userId, userDto);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
AgencyUserModel user = new AgencyUserModel(); AgencyUserModel user = new AgencyUserModel();
if (!ObjectUtils.isEmpty(amosUser)) { if (!ObjectUtils.isEmpty(amosUser)) {
if (amosUser.getStatus() == 200) { if (amosUser.getStatus() == 200) {
user = amosUser.getResult(); user = amosUser.getResult();
} else { } else {
throw new RuntimeException(amosUser.getMessage()); throw new RuntimeException(amosUser.getMessage());
} }
} }
if (!ObjectUtils.isEmpty(amosUser1)) { if (!ObjectUtils.isEmpty(amosUser1)) {
if (amosUser1.getStatus() == 200) { if (amosUser1.getStatus() == 200) {
user = amosUser1.getResult(); user = amosUser1.getResult();
} else { } else {
throw new RuntimeException(amosUser1.getMessage()); throw new RuntimeException(amosUser1.getMessage());
} }
} }
return user; return user;
} }
private LoginInfoModel updateLoginInfo(String loginId, AgencyUserModel userDto) { private LoginInfoModel updateLoginInfo(String loginId, AgencyUserModel userDto) {
FeignClientResult<LoginInfoModel> amosLoginfo = null; FeignClientResult<LoginInfoModel> amosLoginfo = null;
try { try {
amosLoginfo = Privilege.agencyUserClient.updateLoginInfo(userDto, loginId); amosLoginfo = Privilege.agencyUserClient.updateLoginInfo(userDto, loginId);
// amosLoginfo = agencyuserFeign.updateLoginInfo(userDto, loginId); // amosLoginfo = agencyuserFeign.updateLoginInfo(userDto, loginId);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
return amosLoginfo.getResult(); return amosLoginfo.getResult();
} }
private DepartmentModel getdepartmentModel(Long departmentId) { private DepartmentModel getdepartmentModel(Long departmentId) {
FeignClientResult<DepartmentModel> de = Privilege.departmentClient.seleteOne(departmentId); FeignClientResult<DepartmentModel> de = Privilege.departmentClient.seleteOne(departmentId);
DepartmentModel departmentModel = new DepartmentModel(); DepartmentModel departmentModel = new DepartmentModel();
if (!ObjectUtils.isEmpty(de)) { if (!ObjectUtils.isEmpty(de)) {
if (de.getStatus() == 200) { if (de.getStatus() == 200) {
departmentModel = de.getResult(); departmentModel = de.getResult();
} else { } else {
throw new RuntimeException(de.getMessage()); throw new RuntimeException(de.getMessage());
} }
} }
return departmentModel; return departmentModel;
} }
public CompanyModel getCompanyModel(Long projectId) { public CompanyModel getCompanyModel(Long projectId) {
FeignClientResult<CompanyModel> cResult = Privilege.companyClient.seleteOne(projectId); FeignClientResult<CompanyModel> cResult = Privilege.companyClient.seleteOne(projectId);
CompanyModel companyModel = new CompanyModel(); CompanyModel companyModel = new CompanyModel();
if (!ObjectUtils.isEmpty(cResult)) { if (!ObjectUtils.isEmpty(cResult)) {
if (cResult.getStatus() == 200) { if (cResult.getStatus() == 200) {
companyModel = cResult.getResult(); companyModel = cResult.getResult();
} else { } else {
throw new RuntimeException(cResult.getMessage()); throw new RuntimeException(cResult.getMessage());
} }
} }
return companyModel; return companyModel;
} }
private void deleuser(String userid) { private void deleuser(String userid) {
FeignClientResult<List<String>> cResult = Privilege.agencyUserClient.multDeleteUser(userid, true); FeignClientResult<List<String>> cResult = Privilege.agencyUserClient.multDeleteUser(userid, true);
if (!ObjectUtils.isEmpty(cResult)) { if (!ObjectUtils.isEmpty(cResult)) {
if (cResult.getStatus() != 200) { if (cResult.getStatus() != 200) {
throw new RuntimeException(cResult.getMessage()); throw new RuntimeException(cResult.getMessage());
} }
} }
} }
private String deleteLoginInfo(String loginId) { private String deleteLoginInfo(String loginId) {
FeignClientResult<String> amosLoginfo = null; FeignClientResult<String> amosLoginfo = null;
try { try {
amosLoginfo = Privilege.agencyUserClient.deleteLoginInfo(loginId); amosLoginfo = Privilege.agencyUserClient.deleteLoginInfo(loginId);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
return amosLoginfo.getResult(); return amosLoginfo.getResult();
} }
/** /**
* 分页查询 * 分页查询
*/ */
public Page<UserMapperDto> queryPage(Page<UserMapperDto> page, String name, String accountName, String projectName, public Page<UserMapperDto> queryPage(Page<UserMapperDto> page, String name, String accountName, String projectName,
String orgCode) { String orgCode) {
List<UserMapperDto> list = personBasicMapper.queryPage((page.getCurrent() - 1) * page.getSize(), page.getSize(), List<UserMapperDto> list = personBasicMapper.queryPage((page.getCurrent() - 1) * page.getSize(), page.getSize(),
name, accountName, projectName, orgCode); name, accountName, projectName, orgCode);
List<UserMapperDto> listcount = personBasicMapper.queryPagecount(name, accountName, projectName, orgCode); List<UserMapperDto> listcount = personBasicMapper.queryPagecount(name, accountName, projectName, orgCode);
page.setTotal(listcount.size()); page.setTotal(listcount.size());
page.setRecords(list); page.setRecords(list);
return page; return page;
} }
public List<Map<String, Object>> getPersonYardStatistics(String parentCode) { public List<Map<String, Object>> getPersonYardStatistics(String parentCode, String areaCode, String platformStationId) {
List<Map<String, Object>> resultList = personBasicMapper.getPersonYardStatistics(parentCode); List<Map<String, Object>> resultList = personBasicMapper.getPersonYardStatistics(parentCode,areaCode,platformStationId);
resultList.forEach(item -> { resultList.forEach(item -> {
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor"))); String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
item.put("name", name); item.put("name", name);
item.put("value", Integer.parseInt(item.get("value").toString())); item.put("value", Integer.parseInt(item.get("value").toString()));
}); });
return resultList; return resultList;
} }
// public Page<Map<String, Object>> getPersonYardByPage(String parentCode, // public Page<Map<String, Object>> getPersonYardByPage(String parentCode,
// Integer current, // Integer current,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment