Commit 827c2930 authored by wujiang's avatar wujiang

电站管理添加筛选

parent 6779394b
...@@ -32,6 +32,9 @@ public class PowerStationDto extends BaseDto { ...@@ -32,6 +32,9 @@ public class PowerStationDto extends BaseDto {
@ApiModelProperty(value = "服务代理商") @ApiModelProperty(value = "服务代理商")
private String serviceAgent; private String serviceAgent;
@ApiModelProperty(value = "区域公司")
private String regionalCompaniesName;
@ApiModelProperty(value = "电站类型") @ApiModelProperty(value = "电站类型")
private String powerStationType; private String powerStationType;
......
...@@ -19,5 +19,6 @@ public interface PowerStationMapper extends BaseMapper<PowerStation> { ...@@ -19,5 +19,6 @@ public interface PowerStationMapper extends BaseMapper<PowerStation> {
@UserEmpower(field ={"regional_companies_code"} ,dealerField={"a.developer_code","a.regional_companies_code","a.developer_user_id"} ,fieldConditions ={"in","in","in"}, relationship="and") @UserEmpower(field ={"regional_companies_code"} ,dealerField={"a.developer_code","a.regional_companies_code","a.developer_user_id"} ,fieldConditions ={"in","in","in"}, relationship="and")
List<PowerStationDto> queryPage(@Param("powerStationCode") String powerStationCode, List<PowerStationDto> queryPage(@Param("powerStationCode") String powerStationCode,
@Param("ownersName")String ownersName, @Param("ownersName")String ownersName,
@Param("serviceAgent")String serviceAgent); @Param("serviceAgent")String serviceAgent,
@Param("regionalCompaniesName")String regionalCompaniesName);
} }
...@@ -100,12 +100,14 @@ public class PowerStationController extends BaseController { ...@@ -100,12 +100,14 @@ public class PowerStationController extends BaseController {
public ResponseModel<Page<PowerStationDto>> queryForPage(@RequestParam(value = "current") int current, public ResponseModel<Page<PowerStationDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, @RequestParam(value = "size") int size,
@RequestParam(value = "powerStationCode",required = false)String powerStationCode, @RequestParam(value = "powerStationCode",required = false)String powerStationCode,
@RequestParam(value = "ownersName",required = false)String ownersName) { @RequestParam(value = "ownersName",required = false)String ownersName,
@RequestParam(value = "serviceAgent",required = false)String serviceAgent,
@RequestParam(value = "regionalCompaniesName",required = false)String regionalCompaniesName) {
Page<PowerStationDto> page = new Page<PowerStationDto>(); Page<PowerStationDto> page = new Page<PowerStationDto>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
AgencyUserModel userInfo = getUserInfo(); AgencyUserModel userInfo = getUserInfo();
return ResponseHelper.buildResponse(powerStationServiceImpl.queryForPowerStationUserRoles(page,powerStationCode,ownersName,userInfo)); return ResponseHelper.buildResponse(powerStationServiceImpl.queryForPowerStationUserRoles(page,powerStationCode,ownersName,userInfo,serviceAgent,regionalCompaniesName));
} }
/** /**
......
...@@ -25,6 +25,7 @@ import org.apache.poi.ss.formula.functions.T; ...@@ -25,6 +25,7 @@ import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; 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.foundation.exception.BaseException; import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.rdbms.annotation.Condition; import org.typroject.tyboot.core.rdbms.annotation.Condition;
...@@ -45,47 +46,48 @@ import java.util.stream.Collectors; ...@@ -45,47 +46,48 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
@Slf4j @Slf4j
public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerStation, PowerStationMapper> implements IPowerStationService { public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerStation, PowerStationMapper>
implements IPowerStationService {
@Autowired
IdxFeginService idxFeginService; @Autowired
IdxFeginService idxFeginService;
@Autowired
IPowerStationService powerStationService; @Autowired
@Autowired IPowerStationService powerStationService;
DesignInformationMapper designInformationMapper; @Autowired
@Autowired DesignInformationMapper designInformationMapper;
DesignInformationServiceImpl designInformationService; @Autowired
@Autowired DesignInformationServiceImpl designInformationService;
PeasantHouseholdServiceImpl peasantHouseholdService; @Autowired
PeasantHouseholdServiceImpl peasantHouseholdService;
private static final String IDX_REQUEST_STATE="200";
private static final String VERIFY_RESULT_YES="0"; private static final String IDX_REQUEST_STATE = "200";
private static final String VERIFY_RESULT_NO="1"; private static final String VERIFY_RESULT_YES = "0";
private static final String VERIFY_RESULT_NO = "1";
@Autowired
WorkflowFeignClient workflowFeignClient; @Autowired
@Autowired WorkflowFeignClient workflowFeignClient;
HouseholdContractServiceImpl householdContractServiceImpl; @Autowired
@Autowired HouseholdContractServiceImpl householdContractServiceImpl;
PersonnelBusinessMapper personnelBusinessMapper; @Autowired
@Autowired PersonnelBusinessMapper personnelBusinessMapper;
ToDoTasksMapper toDoTasksMapper; @Autowired
@Autowired ToDoTasksMapper toDoTasksMapper;
protected EmqKeeper emqKeeper; @Autowired
@Autowired protected EmqKeeper emqKeeper;
ToDoTasksServiceImpl toDoTasksServiceImpl; @Autowired
@Autowired ToDoTasksServiceImpl toDoTasksServiceImpl;
UserMessageMapper userMessageMapper; @Autowired
@Autowired UserMessageMapper userMessageMapper;
PowerStationMapper powerStationMapper; @Autowired
@Autowired PowerStationMapper powerStationMapper;
AmosRequestContext requestContext; @Autowired
@Autowired AmosRequestContext requestContext;
WorkflowImpl workflow; @Autowired
WorkflowImpl workflow;
public Page<PowerStationDto> queryForPowerStationUserRoles(Page<PowerStationDto> page, String powerStationCode, String ownersName, AgencyUserModel userInfo){
String serviceAgent =null; public Page<PowerStationDto> queryForPowerStationUserRoles(Page<PowerStationDto> page, String powerStationCode,
String ownersName, AgencyUserModel userInfo, String serviceAgent, String regionalCompaniesName) {
// Map<Long, List<RoleModel>> orgRoles = userInfo.getOrgRoles(); // Map<Long, List<RoleModel>> orgRoles = userInfo.getOrgRoles();
// Collection<List<RoleModel>> roleModels = orgRoles.values(); // Collection<List<RoleModel>> roleModels = orgRoles.values();
// if(roleModels !=null){ // if(roleModels !=null){
...@@ -100,58 +102,57 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -100,58 +102,57 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
// } // }
// } // }
//获取用户所在经销商单位 // 获取用户所在经销商单位
// UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto(userInfo.getUserId()); // UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto(userInfo.getUserId());
// //
// if(userUnitInformationDto!=null&&userUnitInformationDto.getAmosDealerName()!=null){ // if(userUnitInformationDto!=null&&userUnitInformationDto.getAmosDealerName()!=null){
// serviceAgent=userUnitInformationDto.getAmosDealerName(); // serviceAgent=userUnitInformationDto.getAmosDealerName();
// } // }
//return this.queryForPowerStationPage(page,powerStationCode,ownersName,serviceAgent); // return
return this.queryPage((int) page.getCurrent(), (int) page.getSize(),powerStationCode,ownersName,serviceAgent); // this.queryForPowerStationPage(page,powerStationCode,ownersName,serviceAgent);
} return this.queryPage((int) page.getCurrent(), (int) page.getSize(), powerStationCode, ownersName,
serviceAgent,regionalCompaniesName);
//查询电站审核记录 }
public Page<PowerStationDto> queryPage(int current, int size,
String powerStationCode, // 查询电站审核记录
String ownersName,String serviceAgent) { public Page<PowerStationDto> queryPage(int current, int size, String powerStationCode, String ownersName,
String serviceAgent,String regionalCompaniesName) {
PageHelper.startPage(current, size);
List<PowerStationDto> list= powerStationMapper.queryPage(powerStationCode,ownersName,serviceAgent); PageHelper.startPage(current, size);
List<PowerStationDto> list = powerStationMapper.queryPage(powerStationCode, ownersName, serviceAgent,regionalCompaniesName);
PageInfo<PowerStationDto> pages = new PageInfo(list); PageInfo<PowerStationDto> pages = new PageInfo(list);
com.baomidou.mybatisplus.extension.plugins.pagination.Page<PowerStationDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<PowerStationDto>(); com.baomidou.mybatisplus.extension.plugins.pagination.Page<PowerStationDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<PowerStationDto>();
pagenew.setCurrent(current); pagenew.setCurrent(current);
pagenew.setTotal(pages.getTotal()); pagenew.setTotal(pages.getTotal());
pagenew.setSize(size); pagenew.setSize(size);
pagenew.setRecords(pages.getList()); pagenew.setRecords(pages.getList());
return pagenew; return pagenew;
} }
/**
* 分页查询
/** */
* 分页查询 public Page<PowerStationDto> queryForPowerStationPage(Page<PowerStationDto> page,
*/ @Condition(Operator.like) String powerStationCode, @Condition(Operator.like) String ownersName,
public Page<PowerStationDto> queryForPowerStationPage(Page<PowerStationDto> page,@Condition(Operator.like) String powerStationCode,@Condition(Operator.like) String ownersName,String serviceAgent) { String serviceAgent) {
return this.queryForPage(page, "rec_date", false,powerStationCode,ownersName,serviceAgent); return this.queryForPage(page, "rec_date", false, powerStationCode, ownersName, serviceAgent);
} }
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<PowerStationDto> queryForPowerStationList() { public List<PowerStationDto> queryForPowerStationList() {
return this.queryForList("" , false); return this.queryForList("", false);
} }
@Override
@Override @Transactional
@Transactional public boolean savePowerStation(PowerStation powerStation, boolean flag, String name, String meg) {
public boolean savePowerStation(PowerStation powerStation, boolean flag,String name,String meg) { try {
try{ // 流程节点code
//流程节点code
// if (flag) { // if (flag) {
// String flowTaskIdnext = this.getTaskNoAuth(powerStation.getProcessInstanceId()); // String flowTaskIdnext = this.getTaskNoAuth(powerStation.getProcessInstanceId());
// WorkDto workDto=this.getNodeInfoCode(flowTaskIdnext); // WorkDto workDto=this.getNodeInfoCode(flowTaskIdnext);
...@@ -160,122 +161,135 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -160,122 +161,135 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
// powerStation.setNodeRouting(workDto.getNodeRouting()); // powerStation.setNodeRouting(workDto.getNodeRouting());
// } // }
powerStation.setRecDate(new Date()); powerStation.setRecDate(new Date());
Boolean fl= this.saveOrUpdate(powerStation); Boolean fl = this.saveOrUpdate(powerStation);
PowerStationNodeEnum powerStationNodeEnum= PowerStationNodeEnum.getNodeByCode(powerStation.getNextProcessNode()); PowerStationNodeEnum powerStationNodeEnum = PowerStationNodeEnum
.getNodeByCode(powerStation.getNextProcessNode());
if (flag){
if (flag) {
ToDoTasks toDoTasks=null;
if(PowerStationNodeEnum.经销商上传图纸.getCode().equals(powerStationNodeEnum.getCode())||PowerStationNodeEnum.经销商审核.getCode().equals(powerStationNodeEnum.getCode())){ ToDoTasks toDoTasks = null;
//获取经销商orgcode if (PowerStationNodeEnum.经销商上传图纸.getCode().equals(powerStationNodeEnum.getCode())
PeasantHousehold peasantHouseholdd= peasantHouseholdService.getById(powerStation.getPeasantHouseholdId()); || PowerStationNodeEnum.经销商审核.getCode().equals(powerStationNodeEnum.getCode())) {
toDoTasks= new ToDoTasks ( TaskTypeStationEnum.电站审核.getCode(), powerStation.getSequenceNbr(), "用户"+name+"电站勘察待"+powerStationNodeEnum.getName(),peasantHouseholdd.getDeveloperCode()); // 获取经销商orgcode
if(PowerStationNodeEnum.经销商审核.getCode().equals(powerStationNodeEnum.getCode())){ PeasantHousehold peasantHouseholdd = peasantHouseholdService
toDoTasksServiceImpl.addToDoTasksByUserId(peasantHouseholdd.getDeveloperUserId(),toDoTasks,meg); .getById(powerStation.getPeasantHouseholdId());
}else{ toDoTasks = new ToDoTasks(TaskTypeStationEnum.电站审核.getCode(), powerStation.getSequenceNbr(),
toDoTasksServiceImpl.addToDoTasksByRole(powerStation.getNodeRole(),toDoTasks,meg); "用户" + name + "电站勘察待" + powerStationNodeEnum.getName(),
} peasantHouseholdd.getDeveloperCode());
}else{ if (PowerStationNodeEnum.经销商审核.getCode().equals(powerStationNodeEnum.getCode())) {
toDoTasks= new ToDoTasks ( TaskTypeStationEnum.电站审核.getCode(), powerStation.getSequenceNbr(), "用户"+name+"电站勘察待"+powerStationNodeEnum.getName(),null); toDoTasksServiceImpl.addToDoTasksByUserId(peasantHouseholdd.getDeveloperUserId(), toDoTasks,
toDoTasksServiceImpl.addToDoTasksByRole(powerStation.getNodeRole(),toDoTasks,meg); meg);
} } else {
}else{ toDoTasksServiceImpl.addToDoTasksByRole(powerStation.getNodeRole(), toDoTasks, meg);
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>(); }
wrapper.eq(ToDoTasks::getType, TaskTypeStationEnum.电站审核.getCode()); } else {
wrapper.eq(ToDoTasks::getState, "待办"); toDoTasks = new ToDoTasks(TaskTypeStationEnum.电站审核.getCode(), powerStation.getSequenceNbr(),
wrapper.eq(ToDoTasks::getBusinessId, powerStation.getSequenceNbr()); "用户" + name + "电站勘察待" + powerStationNodeEnum.getName(), null);
ToDoTasks doTasks= toDoTasksMapper.selectOne(wrapper); toDoTasksServiceImpl.addToDoTasksByRole(powerStation.getNodeRole(), toDoTasks, meg);
if(doTasks!=null){ }
doTasks.setState("已办"); } else {
doTasks.setCompleteTime(new Date()); LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ToDoTasks::getType, TaskTypeStationEnum.电站审核.getCode());
toDoTasksMapper.updateById(doTasks); wrapper.eq(ToDoTasks::getState, "待办");
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(doTasks).getBytes(), 2 ,false); wrapper.eq(ToDoTasks::getBusinessId, powerStation.getSequenceNbr());
ToDoTasks doTasks = toDoTasksMapper.selectOne(wrapper);
UserMessage userMessage= new UserMessage( doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName()+"已完成."+meg, doTasks.getAmosOrgCode()); if (doTasks != null) {
userMessageMapper.insert(userMessage); doTasks.setState("已办");
emqKeeper.getMqttClient().publish("MY_MESSAGE" , JSON.toJSONString(userMessage).getBytes(), 2 ,false); doTasks.setCompleteTime(new Date());
} toDoTasksMapper.updateById(doTasks);
} emqKeeper.getMqttClient().publish("TASK_MESSAGE", JSON.toJSONString(doTasks).getBytes(), 2, false);
return fl; UserMessage userMessage = new UserMessage(doTasks.getType(), doTasks.getBusinessId(),
}catch (Exception e){ doTasks.getAmosUserId(), new Date(), doTasks.getTaskName() + "已完成." + meg,
e.printStackTrace(); doTasks.getAmosOrgCode());
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!"); userMessageMapper.insert(userMessage);
} emqKeeper.getMqttClient().publish("MY_MESSAGE", JSON.toJSONString(userMessage).getBytes(), 2,
} false);
@Override }
public PowerStation getObjByNhId(String id, String state) { }
LambdaQueryWrapper<PowerStation> wrapper = new LambdaQueryWrapper<>();
wrapper.ne(PowerStation::getProcessStatus, state); return fl;
wrapper.eq(PowerStation::getPeasantHouseholdId, id); } catch (Exception e) {
return this.baseMapper.selectOne(wrapper); e.printStackTrace();
} throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!");
}
@Override }
@Transactional
public String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId, String planInstanceId, Map<String, Object> kv) { @Override
String meg=""; public PowerStation getObjByNhId(String id, String state) {
// 1. 业务相关数据落表 LambdaQueryWrapper<PowerStation> wrapper = new LambdaQueryWrapper<>();
PowerStation powerStation = this.baseMapper.selectById(stationId); wrapper.ne(PowerStation::getProcessStatus, state);
PowerStationNodeEnum nodeByCode = PowerStationNodeEnum.getNodeByCode(nodeCode); wrapper.eq(PowerStation::getPeasantHouseholdId, id);
String result = String.valueOf(kv.get("approvalStatus")); return this.baseMapper.selectOne(wrapper);
boolean flag = true; }
if (PowerStationNodeEnum.设计上传图纸.getCode().equals(nodeCode)||PowerStationNodeEnum.经销商上传图纸.getCode().equals(nodeCode)) {
@Override
powerStation.setProcessStatus(PowerStationProcessStateEnum.进行中.getName()); @Transactional
public String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId,
this.updateSeve(nodeCode,powerStation.getPeasantHouseholdId(),kv); String planInstanceId, Map<String, Object> kv) {
} else { String meg = "";
// 1. 业务相关数据落表
if (VERIFY_RESULT_NO.equals(result)) { PowerStation powerStation = this.baseMapper.selectById(stationId);
powerStation.setProcessStatus(PowerStationProcessStateEnum.不通过.getName()); PowerStationNodeEnum nodeByCode = PowerStationNodeEnum.getNodeByCode(nodeCode);
} String result = String.valueOf(kv.get("approvalStatus"));
PowerStationProcessStateEnum resultObj = PowerStationProcessStateEnum.getStateByResult(result); boolean flag = true;
switch (nodeByCode) { if (PowerStationNodeEnum.设计上传图纸.getCode().equals(nodeCode)
case 设计审核: || PowerStationNodeEnum.经销商上传图纸.getCode().equals(nodeCode)) {
powerStation.setTechnologyStatus(resultObj.getName());
break; powerStation.setProcessStatus(PowerStationProcessStateEnum.进行中.getName());
case 投融审核:
powerStation.setDesignStatus(resultObj.getName()); this.updateSeve(nodeCode, powerStation.getPeasantHouseholdId(), kv);
break; } else {
case 法务审核:
powerStation.setBusinessStatus(resultObj.getName()); if (VERIFY_RESULT_NO.equals(result)) {
powerStation.setProcessStatus(PowerStationProcessStateEnum.不通过.getName());
if (VERIFY_RESULT_YES.equals(result)) { }
LambdaUpdateWrapper<HouseholdContract> lambdaUw = new LambdaUpdateWrapper<>(); PowerStationProcessStateEnum resultObj = PowerStationProcessStateEnum.getStateByResult(result);
lambdaUw.eq(HouseholdContract::getPeasantHouseholdId, powerStation.getPeasantHouseholdId()); switch (nodeByCode) {
lambdaUw.set(HouseholdContract::getSurveyStatus, HouseholdContractEnum.勘察状态_已勘察.getCode()); case 设计审核:
householdContractServiceImpl.update(lambdaUw); powerStation.setTechnologyStatus(resultObj.getName());
} break;
case 投融审核:
break; powerStation.setDesignStatus(resultObj.getName());
case 文件审核: break;
if (VERIFY_RESULT_YES.equals(result)) { case 法务审核:
flag = false; powerStation.setBusinessStatus(resultObj.getName());
powerStation.setProcessStatus(PowerStationProcessStateEnum.完成.getName());
} if (VERIFY_RESULT_YES.equals(result)) {
powerStation.setDrawingReview(resultObj.getName()); LambdaUpdateWrapper<HouseholdContract> lambdaUw = new LambdaUpdateWrapper<>();
break; lambdaUw.eq(HouseholdContract::getPeasantHouseholdId, powerStation.getPeasantHouseholdId());
default: lambdaUw.set(HouseholdContract::getSurveyStatus, HouseholdContractEnum.勘察状态_已勘察.getCode());
break; householdContractServiceImpl.update(lambdaUw);
} }
}
meg="任务明细:"+nodeByCode+(VERIFY_RESULT_YES.equals(result)?"通过":"不通过"); break;
// 2. 更新流程状态 case 文件审核:
String code = null; if (VERIFY_RESULT_YES.equals(result)) {
try{ flag = false;
// 3. 工作流执行 powerStation.setProcessStatus(PowerStationProcessStateEnum.完成.getName());
// FeignClientResult<String> submit = idxFeginService.submit(pageId, taskId, planInstanceId, null, null, null, kv); }
// if (IDX_REQUEST_STATE.equals(String.valueOf(submit.getStatus()))) { powerStation.setDrawingReview(resultObj.getName());
// code = submit.getResult(); break;
// log.info("流程执行成功:{}", code); default:
// 获取流程信息 break;
}
}
meg = "任务明细:" + nodeByCode + (VERIFY_RESULT_YES.equals(result) ? "通过" : "不通过");
// 2. 更新流程状态
String code = null;
try {
// 3. 工作流执行
// FeignClientResult<String> submit = idxFeginService.submit(pageId, taskId,
// planInstanceId, null, null, null, kv);
// if (IDX_REQUEST_STATE.equals(String.valueOf(submit.getStatus()))) {
// code = submit.getResult();
// log.info("流程执行成功:{}", code);
// 获取流程信息
// FeignClientResult<JSONObject> record = idxFeginService.getRecord(code); // FeignClientResult<JSONObject> record = idxFeginService.getRecord(code);
// if (IDX_REQUEST_STATE.equals(String.valueOf(record.getStatus()))) { // if (IDX_REQUEST_STATE.equals(String.valueOf(record.getStatus()))) {
// JSONObject resultObj = record.getResult(); // JSONObject resultObj = record.getResult();
...@@ -283,63 +297,62 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -283,63 +297,62 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
// //
// } // }
// 执行工作流
//执行工作流 BasicGridAcceptance basicGridAcceptance = new BasicGridAcceptance();
BasicGridAcceptance basicGridAcceptance=new BasicGridAcceptance(); StandardDto standardDto = new StandardDto();
StandardDto standardDto = new StandardDto(); if (PowerStationNodeEnum.设计上传图纸.getCode().equals(nodeCode)
if (PowerStationNodeEnum.设计上传图纸.getCode().equals(nodeCode)||PowerStationNodeEnum.经销商上传图纸.getCode().equals(nodeCode)) { || PowerStationNodeEnum.经销商上传图纸.getCode().equals(nodeCode)) {
standardDto.setComment(kv.get("approvalInfo")!=null?String.valueOf(kv.get("approvalInfo")):""); standardDto.setComment(kv.get("approvalInfo") != null ? String.valueOf(kv.get("approvalInfo")) : "");
standardDto.setResult("0"); standardDto.setResult("0");
standardDto.setTaskId(powerStation.getFlowTaskId()); standardDto.setTaskId(powerStation.getFlowTaskId());
VariableDto variable = new VariableDto(); VariableDto variable = new VariableDto();
variable.setApprovalStatus("0"); variable.setApprovalStatus("0");
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(""); variable.setOperator("");
standardDto.setVariable(variable); standardDto.setVariable(variable);
}else{ } else {
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(powerStation.getFlowTaskId()); standardDto.setTaskId(powerStation.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,
BasicGridAcceptance workBasicGridAcceptance = workflow.standard(basicGridAcceptance, standardDto, requestContext.getUserId()); requestContext.getUserId());
powerStation.setFlowTaskId(basicGridAcceptance.getNextTaskId()); powerStation.setFlowTaskId(basicGridAcceptance.getNextTaskId());
powerStation.setNodeRole(basicGridAcceptance.getNextExecutorIds()); powerStation.setNodeRole(basicGridAcceptance.getNextExecutorIds());
powerStation.setNodeRouting(basicGridAcceptance.getNextNodeKey()!=null?PowerStationEnum.getNodeByKey(basicGridAcceptance.getNextNodeKey()):""); powerStation.setNodeRouting(basicGridAcceptance.getNextNodeKey() != null
powerStation.setNextProcessNode(basicGridAcceptance.getNextNodeKey()); ? PowerStationEnum.getNodeByKey(basicGridAcceptance.getNextNodeKey())
powerStation.setPromoter(basicGridAcceptance.getPromoter()); : "");
powerStation.setNextExecuteUserIds(basicGridAcceptance.getNextExecuteUserIds()); powerStation.setNextProcessNode(basicGridAcceptance.getNextNodeKey());
powerStation.setNextNodeName(basicGridAcceptance.getNextNodeName()); powerStation.setPromoter(basicGridAcceptance.getPromoter());
powerStation.setNextExecuteUserIds(basicGridAcceptance.getNextExecuteUserIds());
powerStationService.savePowerStation(powerStation, flag,powerStation.getOwnersName(),meg); powerStation.setNextNodeName(basicGridAcceptance.getNextNodeName());
if(!flag){
//更新农户状态 powerStationService.savePowerStation(powerStation, flag, powerStation.getOwnersName(), meg);
String peasantHouseholdId = powerStation.getPeasantHouseholdId(); if (!flag) {
PeasantHousehold peasantHousehold = peasantHouseholdService.getBaseMapper().selectById(Long.valueOf(peasantHouseholdId)); // 更新农户状态
peasantHousehold.setSurveyOrNot(3); String peasantHouseholdId = powerStation.getPeasantHouseholdId();
peasantHousehold.setConstructionState(ArrivalStateeEnum.勘察完成.getCode()); PeasantHousehold peasantHousehold = peasantHouseholdService.getBaseMapper()
peasantHouseholdService.saveOrUpdate(peasantHousehold); .selectById(Long.valueOf(peasantHouseholdId));
} peasantHousehold.setSurveyOrNot(3);
//} peasantHousehold.setConstructionState(ArrivalStateeEnum.勘察完成.getCode());
}catch (Exception e){ peasantHouseholdService.saveOrUpdate(peasantHousehold);
e.printStackTrace(); }
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!"); // }
} catch (Exception e) {
} e.printStackTrace();
return code; throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!");
}
return code;
// String meg=""; // String meg="";
// // 1. 业务相关数据落表 // // 1. 业务相关数据落表
...@@ -417,118 +430,115 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -417,118 +430,115 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
// //
// } // }
// return code; // return code;
} }
public WorkDto getNodeInfoCode(String flowTaskId) {
public WorkDto getNodeInfoCode(String flowTaskId){ WorkDto workDto = null;
WorkDto workDto=null; try {
try{ FeignClientResult<JSONObject> jSONObject = workflowFeignClient.getNodeInfo(flowTaskId);
FeignClientResult<JSONObject> jSONObject= workflowFeignClient.getNodeInfo(flowTaskId); if (IDX_REQUEST_STATE.equals(String.valueOf(jSONObject.getStatus()))) {
if(IDX_REQUEST_STATE.equals(String.valueOf(jSONObject.getStatus()))){ JSONObject js = jSONObject.getResult();
JSONObject js=jSONObject.getResult(); if (js == null) {
if(js==null){ throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!");
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!"); }
} LinkedHashMap taskInfo = js.get("taskInfo") != null ? (LinkedHashMap) js.get("taskInfo") : null;
LinkedHashMap taskInfo= js.get("taskInfo")!=null?(LinkedHashMap)js.get("taskInfo"):null; String nextProcessNode = taskInfo != null ? taskInfo.get("taskDefinitionKey").toString() : null;
String nextProcessNode=taskInfo!=null?taskInfo.get("taskDefinitionKey").toString():null; List<LinkedHashMap> executor = js.get("executor") != null ? (List<LinkedHashMap>) js.get("executor")
List<LinkedHashMap> executor= js.get("executor")!=null?( List<LinkedHashMap>)js.get("executor"):null; : null;
String nodeRole=null; String nodeRole = null;
if(!executor.isEmpty()){ if (!executor.isEmpty()) {
List<String> idList = executor.stream().map(e->e.get("groupId").toString()).collect(Collectors.toList()); List<String> idList = executor.stream().map(e -> e.get("groupId").toString())
nodeRole=StringUtils.join(idList,","); .collect(Collectors.toList());
} nodeRole = StringUtils.join(idList, ",");
}
LinkedHashMap extensionInfo= js.get("extensionInfo")!=null?(LinkedHashMap)js.get("extensionInfo"):null;
String nodeRouting=extensionInfo!=null?extensionInfo.get("nodeRole").toString():null; LinkedHashMap extensionInfo = js.get("extensionInfo") != null ? (LinkedHashMap) js.get("extensionInfo")
workDto=new WorkDto(nodeRouting, nodeRole, nextProcessNode); : null;
} String nodeRouting = extensionInfo != null ? extensionInfo.get("nodeRole").toString() : null;
workDto = new WorkDto(nodeRouting, nodeRole, nextProcessNode);
return workDto; }
}catch (Exception e){
e.printStackTrace(); return workDto;
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!"); } catch (Exception e) {
e.printStackTrace();
} throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!");
}
}
public String getTaskNoAuth(String processInstanceId){ }
String flowTaskId=null;
try{ public String getTaskNoAuth(String processInstanceId) {
JSONObject jSONObject= workflowFeignClient.getTaskNoAuth(processInstanceId); String flowTaskId = null;
if(IDX_REQUEST_STATE.equals(String.valueOf(jSONObject.get("code")))){ try {
LinkedHashMap jsd= jSONObject.get("data")!=null?(LinkedHashMap)jSONObject.get("data"):null; JSONObject jSONObject = workflowFeignClient.getTaskNoAuth(processInstanceId);
flowTaskId=jsd!=null?jsd.get("id").toString():null; if (IDX_REQUEST_STATE.equals(String.valueOf(jSONObject.get("code")))) {
} LinkedHashMap jsd = jSONObject.get("data") != null ? (LinkedHashMap) jSONObject.get("data") : null;
if(flowTaskId==null){ flowTaskId = jsd != null ? jsd.get("id").toString() : null;
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!"); }
} if (flowTaskId == null) {
return flowTaskId; throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!");
}catch (Exception e){ }
e.printStackTrace(); return flowTaskId;
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!"); } catch (Exception e) {
e.printStackTrace();
} throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!");
}
}
// 设计信息填充 }
// 设计信息填充
public void updateSeve(String nodeCode,String peasantHouseholdId, Map<String, Object> kv ){
LambdaQueryWrapper<DesignInformation> wrapper = new LambdaQueryWrapper<>(); public void updateSeve(String nodeCode, String peasantHouseholdId, Map<String, Object> kv) {
wrapper.eq(DesignInformation::getPeasantHouseholdId, peasantHouseholdId); LambdaQueryWrapper<DesignInformation> wrapper = new LambdaQueryWrapper<>();
DesignInformation designInformation=designInformationMapper.selectOne(wrapper); wrapper.eq(DesignInformation::getPeasantHouseholdId, peasantHouseholdId);
if(designInformation!=null){ DesignInformation designInformation = designInformationMapper.selectOne(wrapper);
DesignInformation designInformationnew=this.mapToBean(kv,DesignInformation.class); if (designInformation != null) {
DesignInformation designInformationnew = this.mapToBean(kv, DesignInformation.class);
if (PowerStationNodeEnum.经销商上传图纸.getCode().equals(nodeCode)) {
if (PowerStationNodeEnum.经销商上传图纸.getCode().equals(nodeCode)) { designInformation.setPeasantHouseholdId(peasantHouseholdId);
designInformation.setPeasantHouseholdId(peasantHouseholdId); designInformation.setComponentLayout(designInformationnew.getComponentLayout());
designInformation.setComponentLayout(designInformationnew.getComponentLayout()); designInformation.setComponentBracket(designInformationnew.getComponentBracket());
designInformation.setComponentBracket(designInformationnew.getComponentBracket()); designInformation.setConnectionLine(designInformationnew.getConnectionLine());
designInformation.setConnectionLine(designInformationnew.getConnectionLine()); designInformation.setOnceLine(designInformationnew.getOnceLine());
designInformation.setOnceLine(designInformationnew.getOnceLine()); designInformationMapper.updateById(designInformation);
designInformationMapper.updateById(designInformation); } else {
}else{ // designInformationnew.setTypicalDiagram(designInformationnew.getTypicalDiagram());
// designInformationnew.setTypicalDiagram(designInformationnew.getTypicalDiagram()); designInformationnew.setPeasantHouseholdId(peasantHouseholdId);
designInformationnew.setPeasantHouseholdId(peasantHouseholdId); designInformationnew.setComponentLayout(designInformation.getComponentLayout());
designInformationnew.setComponentLayout(designInformation.getComponentLayout()); designInformationnew.setComponentBracket(designInformation.getComponentBracket());
designInformationnew.setComponentBracket(designInformation.getComponentBracket()); designInformationnew.setConnectionLine(designInformation.getConnectionLine());
designInformationnew.setConnectionLine(designInformation.getConnectionLine()); designInformationnew.setOnceLine(designInformation.getOnceLine());
designInformationnew.setOnceLine(designInformation.getOnceLine()); designInformationnew.setSequenceNbr(designInformation.getSequenceNbr());
designInformationnew.setSequenceNbr(designInformation.getSequenceNbr()); designInformationnew.setRecDate(designInformation.getRecDate());
designInformationnew.setRecDate(designInformation.getRecDate()); designInformationnew.setRecUserId(designInformation.getRecUserId());
designInformationnew.setRecUserId(designInformation.getRecUserId()); designInformationnew.setRecUserName(designInformation.getRecUserName());
designInformationnew.setRecUserName(designInformation.getRecUserName()); designInformationnew.setIsDelete(designInformation.getIsDelete());
designInformationnew.setIsDelete(designInformation.getIsDelete()); designInformationnew.setCable(designInformation.getCable());
designInformationnew.setCable(designInformation.getCable()); designInformationMapper.updateById(designInformationnew);
designInformationMapper.updateById(designInformationnew); }
} } else {
}else{ DesignInformation designInformationnew = this.mapToBean(kv, DesignInformation.class);
DesignInformation designInformationnew=this.mapToBean(kv,DesignInformation.class); designInformationnew.setTypicalDiagram((List<Object>) kv.get("typicalDiagram"));
designInformationnew.setTypicalDiagram((List<Object>)kv.get("typicalDiagram")) ; designInformationnew.setPeasantHouseholdId(peasantHouseholdId);
designInformationnew.setPeasantHouseholdId(peasantHouseholdId); designInformationMapper.insert(designInformationnew);
designInformationMapper.insert(designInformationnew);
}
}
}
}
public <T> T mapToBean(Map<String, Object> map, Class<T> clazz) {
ObjectMapper objectMapper = new ObjectMapper();
public <T> T mapToBean(Map<String, Object> map, Class<T> clazz) {
ObjectMapper objectMapper= new ObjectMapper(); T bean = null;
try {
T bean =null; bean = clazz.newInstance();
try { bean = objectMapper.convertValue(map, clazz);
bean = clazz.newInstance();
bean = objectMapper.convertValue(map,clazz); } catch (Exception e) {
throw new BaseException(" 数据转化异常!", "400", "数据转化异常!");
}catch (Exception e){ }
throw new BaseException(" 数据转化异常!","400","数据转化异常!"); return bean;
} }
return bean;
}
// private CollectionToList(Collection<? extends E> c){ // private CollectionToList(Collection<? extends E> c){
// Object[] objects = c.toArray(); // Object[] objects = c.toArray();
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.biz.Enum.SmartAnalyseEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO; import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallInfoDTO; import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallInfoDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel;
...@@ -35,366 +36,437 @@ import static com.yeejoin.amos.boot.module.jxiop.biz.kafka.Constant.*; ...@@ -35,366 +36,437 @@ import static com.yeejoin.amos.boot.module.jxiop.biz.kafka.Constant.*;
@RequestMapping(value = "/kafkaAnalyse") @RequestMapping(value = "/kafkaAnalyse")
public class KafkaAnalyseController { public class KafkaAnalyseController {
public final DecimalFormat df = new DecimalFormat("0.0"); public final DecimalFormat df = new DecimalFormat("0.0");
@Autowired @Autowired
FanConditionVariablesMessage fanConditionVariablesMessage; FanConditionVariablesMessage fanConditionVariablesMessage;
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
@Autowired @Autowired
IPermissionService permissionService; IPermissionService permissionService;
@Autowired @Autowired
IdxBizFanHealthLevelMapper idxBizFanHealthLevelMapper; IdxBizFanHealthLevelMapper idxBizFanHealthLevelMapper;
@Autowired @Autowired
IdxBizPvHealthLevelMapper idxBizPvHealthLevelMapper; IdxBizPvHealthLevelMapper idxBizPvHealthLevelMapper;
@Autowired @Autowired
IndicatorDataMapper indicatorDataMapper; IndicatorDataMapper indicatorDataMapper;
@Autowired @Autowired
IdxBizFanHealthIndexMapper idxBizFanHealthIndexMapper; IdxBizFanHealthIndexMapper idxBizFanHealthIndexMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getFanConditionVariables") @ApiOperation(httpMethod = "GET", value = "获取执行结果", notes = "获取执行结果")
@ApiOperation(httpMethod = "POST", value = "计算相关性分析 - 风机 - 新", notes = "计算相关性分析 - 风机 - 新") @GetMapping(value = "/isRun")
public ResponseModel<Object> getFanConditionVariables() { public ResponseModel<String> isRun(@RequestParam(required = true) String key) {
if (redisUtils.hasKey(kafkaTopicConsumer)) { String result = "非法key值";
return ResponseHelper.buildResponse("计算中"); if (kafkaTopicConsumer.equals(key) || kafkaTopicConsumerPv.equals(key) || kafkaTopicConsumerGKHFFan.equals(key)
} || kafkaTopicConsumerGKHFPv.equals(key) || kafkaTopicConsumerZXZFan.equals(key)
fanConditionVariablesMessage.getFanConditionVariables(); || kafkaTopicConsumerZXZPv.equals(key)) {
redisUtils.set(kafkaTopicConsumer, RequestContext.getTraceId(), 300); if (redisUtils.hasKey(key)) {
return ResponseHelper.buildResponse("开始计算"); result = "正在计算中";
} } else {
result = "未计算";
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) }
@PostMapping(value = "/getPvConditionVariables") }
@ApiOperation(httpMethod = "POST", value = "计算相关性分析 - 光伏 - 新", notes = "计算相关性分析 - 光伏 - 新") return ResponseHelper.buildResponse(result);
public ResponseModel<Object> getPvConditionVariables() { }
if (redisUtils.hasKey(kafkaTopicConsumerPv)) {
return ResponseHelper.buildResponse("计算中"); @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
} @ApiOperation(httpMethod = "GET", value = "获取执行结果", notes = "获取执行结果")
fanConditionVariablesMessage.getPvConditionVariables(); @GetMapping(value = "/start")
redisUtils.set(kafkaTopicConsumerPv, RequestContext.getTraceId(), 300); public ResponseModel<Object> start(@RequestParam(required = true) String key) {
return ResponseHelper.buildResponse("开始计算"); String result = "非法key值";
} if (kafkaTopicConsumer.equals(key)) {
return getFanConditionVariables();
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) } else if (kafkaTopicConsumerPv.equals(key)) {
@PostMapping(value = "/getFanConditionVariablesGKHF") return getPvConditionVariables();
@ApiOperation(httpMethod = "POST", value = "工况划分 - 风电 - 新", notes = "工况划分 - 风电 - 新") } else if (kafkaTopicConsumerGKHFFan.equals(key)) {
public ResponseModel<Object> getFanConditionVariablesGKHF() { return getFanConditionVariablesGKHF();
if (redisUtils.hasKey(kafkaTopicConsumerGKHFFan)) { } else if (kafkaTopicConsumerGKHFPv.equals(key)) {
return ResponseHelper.buildResponse("计算中"); return getPvConditionVariablesPvGKFX();
} } else if (kafkaTopicConsumerZXZFan.equals(key)) {
fanConditionVariablesMessage.getFanConditionVariablesGKHF(); return getFanConditionVariablesZXZ();
redisUtils.set(kafkaTopicConsumerGKHFFan, RequestContext.getTraceId(), 300); } else if (kafkaTopicConsumerZXZPv.equals(key)) {
return ResponseHelper.buildResponse("开始计算"); return getPvConditionVariablesZXZ();
} }
return ResponseHelper.buildResponse(result);
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) }
@PostMapping(value = "/getPvConditionVariablesPvGKHF")
@ApiOperation(httpMethod = "POST", value = "工况划分 - 光伏 - 新", notes = "工况划分 - 光伏 - 新") @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
public ResponseModel<Object> getPvConditionVariablesPvGKFX() { @PostMapping(value = "/getFanConditionVariables")
if (redisUtils.hasKey(kafkaTopicConsumerGKHFPv)) { @ApiOperation(httpMethod = "POST", value = "计算相关性分析 - 风机 - 新", notes = "计算相关性分析 - 风机 - 新")
return ResponseHelper.buildResponse("计算中"); public ResponseModel<Object> getFanConditionVariables() {
} if (redisUtils.hasKey(kafkaTopicConsumer)) {
fanConditionVariablesMessage.getPvConditionVariablesPvGKFX(); return ResponseHelper.buildResponse("计算中");
redisUtils.set(kafkaTopicConsumerGKHFPv, RequestContext.getTraceId(), 300); }
return ResponseHelper.buildResponse("开始计算"); fanConditionVariablesMessage.getFanConditionVariables();
} redisUtils.set(kafkaTopicConsumer, RequestContext.getTraceId(), 300);
return ResponseHelper.buildResponse("开始计算");
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) }
@PostMapping(value = "/getFanConditionVariablesZXZ")
@ApiOperation(httpMethod = "POST", value = "中心值 - 风电 - 新", notes = "中心值 - 风电 - 新") @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
public ResponseModel<Object> getFanConditionVariablesZXZ() { @PostMapping(value = "/getPvConditionVariables")
if (redisUtils.hasKey(kafkaTopicConsumerZXZFan)) { @ApiOperation(httpMethod = "POST", value = "计算相关性分析 - 光伏 - 新", notes = "计算相关性分析 - 光伏 - 新")
public ResponseModel<Object> getPvConditionVariables() {
if (redisUtils.hasKey(kafkaTopicConsumerPv)) {
return ResponseHelper.buildResponse("计算中");
}
fanConditionVariablesMessage.getPvConditionVariables();
redisUtils.set(kafkaTopicConsumerPv, RequestContext.getTraceId(), 300);
return ResponseHelper.buildResponse("开始计算");
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getFanConditionVariablesGKHF")
@ApiOperation(httpMethod = "POST", value = "工况划分 - 风电 - 新", notes = "工况划分 - 风电 - 新")
public ResponseModel<Object> getFanConditionVariablesGKHF() {
if (redisUtils.hasKey(kafkaTopicConsumerGKHFFan)) {
return ResponseHelper.buildResponse("计算中");
}
fanConditionVariablesMessage.getFanConditionVariablesGKHF();
redisUtils.set(kafkaTopicConsumerGKHFFan, RequestContext.getTraceId(), 300);
return ResponseHelper.buildResponse("开始计算");
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getPvConditionVariablesPvGKHF")
@ApiOperation(httpMethod = "POST", value = "工况划分 - 光伏 - 新", notes = "工况划分 - 光伏 - 新")
public ResponseModel<Object> getPvConditionVariablesPvGKFX() {
if (redisUtils.hasKey(kafkaTopicConsumerGKHFPv)) {
return ResponseHelper.buildResponse("计算中");
}
fanConditionVariablesMessage.getPvConditionVariablesPvGKFX();
redisUtils.set(kafkaTopicConsumerGKHFPv, RequestContext.getTraceId(), 300);
return ResponseHelper.buildResponse("开始计算");
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getFanConditionVariablesZXZ")
@ApiOperation(httpMethod = "POST", value = "中心值 - 风电 - 新", notes = "中心值 - 风电 - 新")
public ResponseModel<Object> getFanConditionVariablesZXZ() {
if (redisUtils.hasKey(kafkaTopicConsumerZXZFan)) {
// redisUtils.del(kafkaTopicConsumerZXZFan); // redisUtils.del(kafkaTopicConsumerZXZFan);
// redisUtils.getExpire(kafkaTopicConsumerZXZFan); // redisUtils.getExpire(kafkaTopicConsumerZXZFan);
return ResponseHelper.buildResponse("计算中"); return ResponseHelper.buildResponse("计算中");
} }
fanConditionVariablesMessage.getFanConditionVariablesZXZ(); fanConditionVariablesMessage.getFanConditionVariablesZXZ();
redisUtils.set(kafkaTopicConsumerZXZFan, RequestContext.getTraceId(), 300); redisUtils.set(kafkaTopicConsumerZXZFan, RequestContext.getTraceId(), 300);
return ResponseHelper.buildResponse("开始计算"); return ResponseHelper.buildResponse("开始计算");
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getPvConditionVariablesZXZ") @PostMapping(value = "/getPvConditionVariablesZXZ")
@ApiOperation(httpMethod = "POST", value = "中心值 - 光伏 - 新", notes = "工况划分 - 光伏 - 新") @ApiOperation(httpMethod = "POST", value = "中心值 - 光伏 - 新", notes = "工况划分 - 光伏 - 新")
public ResponseModel<Object> getPvConditionVariablesZXZ() { public ResponseModel<Object> getPvConditionVariablesZXZ() {
if (redisUtils.hasKey(kafkaTopicConsumerZXZPv)) { if (redisUtils.hasKey(kafkaTopicConsumerZXZPv)) {
// redisUtils.del(kafkaTopicConsumerZXZPv); // redisUtils.del(kafkaTopicConsumerZXZPv);
return ResponseHelper.buildResponse("计算中"); return ResponseHelper.buildResponse("计算中");
} }
fanConditionVariablesMessage.getPvConditionVariablesZXZ(); fanConditionVariablesMessage.getPvConditionVariablesZXZ();
redisUtils.set(kafkaTopicConsumerZXZPv, RequestContext.getTraceId(), 300); redisUtils.set(kafkaTopicConsumerZXZPv, RequestContext.getTraceId(), 300);
return ResponseHelper.buildResponse("开始计算"); return ResponseHelper.buildResponse("开始计算");
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getAddressInfo") @GetMapping(value = "/getAddressInfo")
@ApiOperation(httpMethod = "GET", value = "getAddressInfo", notes = "getAddressInfo") @ApiOperation(httpMethod = "GET", value = "getAddressInfo", notes = "getAddressInfo")
public ResponseModel<List<IndicatorData>> getAddressInfo() { public ResponseModel<List<IndicatorData>> getAddressInfo() {
List<String> addressInfo = idxBizFanHealthIndexMapper.getAddressInfo(); List<String> addressInfo = idxBizFanHealthIndexMapper.getAddressInfo();
String join = String.join(",", addressInfo); String join = String.join(",", addressInfo);
List<IndicatorData> indicatorData = indicatorDataMapper.selectByAddresses(join, "1668801435891929089"); List<IndicatorData> indicatorData = indicatorDataMapper.selectByAddresses(join, "1668801435891929089");
return ResponseHelper.buildResponse(indicatorData); return ResponseHelper.buildResponse(indicatorData);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "全景诊断回溯") @ApiOperation(value = "全景诊断回溯")
@GetMapping("/getFullViewRecall") @GetMapping("/getFullViewRecall")
public ResponseModel<List<FullViewRecallInfoDTO>> getFullViewRecall(@RequestParam(required = false, value = "analysisType") String analysisType) { public ResponseModel<List<FullViewRecallInfoDTO>> getFullViewRecall(
List<String> gatewayIds = this.getGatewayIds(); @RequestParam(required = false, value = "analysisType") String analysisType) {
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfoByParam(analysisType, gatewayIds); List<String> gatewayIds = this.getGatewayIds();
Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors.toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfoByParam(analysisType,
gatewayIds);
Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors
List<Map<String, Object>> equipmentIndexInfo = idxBizFanHealthIndexMapper.getEquipmentIndexInfoByParam(analysisType, gatewayIds); .toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
Map<String, Double> equipmentIndexInfoMap = equipmentIndexInfo.stream().collect(Collectors.toMap(t -> t.get("equipmentName").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> equipmentIndexInfo = idxBizFanHealthIndexMapper
.getEquipmentIndexInfoByParam(analysisType, gatewayIds);
List<Map<String, Object>> subSystemIndexInfo = idxBizFanHealthIndexMapper.getSubSystemIndexInfoByParam(analysisType, gatewayIds); Map<String, Double> equipmentIndexInfoMap = equipmentIndexInfo.stream().collect(Collectors.toMap(
Map<String, Double> subSystemIndexInfoMap = subSystemIndexInfo.stream().collect(Collectors.toMap(t -> t.get("subSystem").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); t -> t.get("equipmentName").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> subSystemIndexInfo = idxBizFanHealthIndexMapper
List<Map<String, Object>> pointNameIndexInfo = idxBizFanHealthIndexMapper.getPointNameIndexInfoByParam(analysisType, gatewayIds); .getSubSystemIndexInfoByParam(analysisType, gatewayIds);
Map<String, Double> pointNameIndexInfoMap = pointNameIndexInfo.stream().collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); Map<String, Double> subSystemIndexInfoMap = subSystemIndexInfo.stream().collect(Collectors
.toMap(t -> t.get("subSystem").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList(gatewayIds); List<Map<String, Object>> pointNameIndexInfo = idxBizFanHealthIndexMapper
.getPointNameIndexInfoByParam(analysisType, gatewayIds);
List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall(gatewayIds); Map<String, Double> pointNameIndexInfoMap = pointNameIndexInfo.stream()
Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list.stream() .collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(),
.collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea, t -> Double.parseDouble(t.get("healthIndex").toString())));
Collectors.groupingBy(FullViewRecallDataDTO::getStation,
Collectors.groupingBy(FullViewRecallDataDTO::getEquipmentName, List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList(gatewayIds);
Collectors.groupingBy(FullViewRecallDataDTO::getSubSystem,
Collectors.groupingBy(FullViewRecallDataDTO::getPointName)))))); List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall(gatewayIds);
int areaInt = 1; Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list
int pointNameInt = 1; .stream()
int stationInt = 1; .collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea,
int equipmentInt = 1; Collectors.groupingBy(FullViewRecallDataDTO::getStation,
int subSystemInt = 1; Collectors.groupingBy(FullViewRecallDataDTO::getEquipmentName,
Double healthScoreInfo = idxBizFanHealthIndexMapper.getHealthScoreInfoByParam(null, null, analysisType).doubleValue(); Collectors.groupingBy(FullViewRecallDataDTO::getSubSystem,
Collectors.groupingBy(FullViewRecallDataDTO::getPointName))))));
healthScoreInfo = Double.parseDouble(df.format(healthScoreInfo)); int areaInt = 1;
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>(); int pointNameInt = 1;
query.isNull(IdxBizFanHealthLevel::getStatus); int stationInt = 1;
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "全域"); int equipmentInt = 1;
query.lt(IdxBizFanHealthLevel::getGroupLowerLimit, healthScoreInfo); int subSystemInt = 1;
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, healthScoreInfo); Double healthScoreInfo = idxBizFanHealthIndexMapper.getHealthScoreInfoByParam(null, null, analysisType)
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query); .doubleValue();
FullViewRecallInfoDTO allMapDto = new FullViewRecallInfoDTO(); healthScoreInfo = Double.parseDouble(df.format(healthScoreInfo));
allMapDto.setKey("0"); LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
allMapDto.setName("全域设备健康状态指数"); query.isNull(IdxBizFanHealthLevel::getStatus);
allMapDto.setScoreRange(""); query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "全域");
allMapDto.setStatus(idxBizFanHealthLevel.getHealthLevel()); query.lt(IdxBizFanHealthLevel::getGroupLowerLimit, healthScoreInfo);
allMapDto.setScore(healthScoreInfo); query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, healthScoreInfo);
allMapDto.setIsRoot(true); IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
allMapDto.setCategory("category");
allMapDto.setChildren(new ArrayList<>()); FullViewRecallInfoDTO allMapDto = new FullViewRecallInfoDTO();
allMapDto.setParentKey("0"); allMapDto.setKey("0");
allMapDto.setName("全域设备健康状态指数");
for (Map.Entry<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> areaMap : resultMap.entrySet()) { allMapDto.setScoreRange("");
Double areaLowScore = null; allMapDto.setStatus(idxBizFanHealthLevel.getHealthLevel());
Double areaHighScore = null; allMapDto.setScore(healthScoreInfo);
allMapDto.setIsRoot(true);
Double areaHealthScoreInfo = idxBizFanHealthIndexMapper.getHealthScoreInfoByParam(areaMap.getKey(), null, analysisType).doubleValue(); allMapDto.setCategory("category");
areaHealthScoreInfo = Double.parseDouble(df.format(areaHealthScoreInfo)); allMapDto.setChildren(new ArrayList<>());
LambdaQueryWrapper<IdxBizFanHealthLevel> areaQuery = new LambdaQueryWrapper<>(); allMapDto.setParentKey("0");
areaQuery.isNull(IdxBizFanHealthLevel::getStatus);
areaQuery.eq(IdxBizFanHealthLevel::getAnalysisObjType, "片区"); for (Map.Entry<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> areaMap : resultMap
areaQuery.lt(IdxBizFanHealthLevel::getGroupLowerLimit, areaHealthScoreInfo); .entrySet()) {
areaQuery.ge(IdxBizFanHealthLevel::getGroupUpperLimit, areaHealthScoreInfo); Double areaLowScore = null;
IdxBizFanHealthLevel areaIdxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(areaQuery); Double areaHighScore = null;
FullViewRecallInfoDTO areaMapDto = new FullViewRecallInfoDTO(); Double areaHealthScoreInfo = idxBizFanHealthIndexMapper
areaMapDto.setKey("0-" + areaInt); .getHealthScoreInfoByParam(areaMap.getKey(), null, analysisType).doubleValue();
areaMapDto.setName(areaMap.getKey()); areaHealthScoreInfo = Double.parseDouble(df.format(areaHealthScoreInfo));
areaMapDto.setStatus(areaIdxBizFanHealthLevel.getHealthLevel()); LambdaQueryWrapper<IdxBizFanHealthLevel> areaQuery = new LambdaQueryWrapper<>();
areaMapDto.setScore(areaHealthScoreInfo); areaQuery.isNull(IdxBizFanHealthLevel::getStatus);
areaMapDto.setParentKey(allMapDto.getKey()); areaQuery.eq(IdxBizFanHealthLevel::getAnalysisObjType, "片区");
allMapDto.getChildren().add(areaMapDto); areaQuery.lt(IdxBizFanHealthLevel::getGroupLowerLimit, areaHealthScoreInfo);
areaInt++; areaQuery.ge(IdxBizFanHealthLevel::getGroupUpperLimit, areaHealthScoreInfo);
List<FullViewRecallInfoDTO> areaMapList = new ArrayList<>(); IdxBizFanHealthLevel areaIdxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(areaQuery);
for (Map.Entry<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>> stationMap : areaMap.getValue().entrySet()) {
Double stationLowScore = null; FullViewRecallInfoDTO areaMapDto = new FullViewRecallInfoDTO();
Double stationHighScore = null; areaMapDto.setKey("0-" + areaInt);
if (areaLowScore == null && areaHighScore == null) { areaMapDto.setName(areaMap.getKey());
areaLowScore = stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0); areaMapDto.setStatus(areaIdxBizFanHealthLevel.getHealthLevel());
areaHighScore = stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0); areaMapDto.setScore(areaHealthScoreInfo);
} else { areaMapDto.setParentKey(allMapDto.getKey());
if (stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0) < areaLowScore) { allMapDto.getChildren().add(areaMapDto);
areaLowScore = stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0); areaInt++;
} List<FullViewRecallInfoDTO> areaMapList = new ArrayList<>();
if (stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0) > areaHighScore) { for (Map.Entry<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>> stationMap : areaMap
areaHighScore = stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0); .getValue().entrySet()) {
} Double stationLowScore = null;
} Double stationHighScore = null;
if (areaLowScore == null && areaHighScore == null) {
FullViewRecallInfoDTO stationDto = new FullViewRecallInfoDTO(); areaLowScore = stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0);
stationDto.setKey(areaMapDto.getKey() + "-" + stationInt); areaHighScore = stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0);
stationDto.setName(stationMap.getKey()); } else {
if (stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0) < areaLowScore) {
stationDto.setStatus(""); areaLowScore = stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0);
stationDto.setScore(stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0)); }
LambdaQueryWrapper<IdxBizFanHealthLevel> stationQuery = new LambdaQueryWrapper<>(); if (stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0) > areaHighScore) {
stationQuery.like(IdxBizFanHealthLevel::getStatus, stationMap.getKey()); areaHighScore = stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0);
stationQuery.eq(IdxBizFanHealthLevel::getAnalysisObjType, "场站"); }
stationQuery.lt(IdxBizFanHealthLevel::getGroupLowerLimit, stationDto.getScore()); }
stationQuery.ge(IdxBizFanHealthLevel::getGroupUpperLimit, stationDto.getScore());
IdxBizFanHealthLevel stationLevel = idxBizFanHealthLevelMapper.selectOne(stationQuery); FullViewRecallInfoDTO stationDto = new FullViewRecallInfoDTO();
stationDto.setStatus(ObjectUtils.isNotEmpty(stationLevel) ? stationLevel.getHealthLevel() : ""); stationDto.setKey(areaMapDto.getKey() + "-" + stationInt);
if (ObjectUtils.isEmpty(stationLevel)) { stationDto.setName(stationMap.getKey());
LambdaQueryWrapper<IdxBizPvHealthLevel> stationPvQuery = new LambdaQueryWrapper<>();
stationPvQuery.like(IdxBizPvHealthLevel::getStatus, stationMap.getKey()); stationDto.setStatus("");
stationPvQuery.eq(IdxBizPvHealthLevel::getAnalysisObjType, "场站"); stationDto.setScore(stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0));
stationPvQuery.lt(IdxBizPvHealthLevel::getGroupLowerLimit, stationDto.getScore()); LambdaQueryWrapper<IdxBizFanHealthLevel> stationQuery = new LambdaQueryWrapper<>();
stationPvQuery.ge(IdxBizPvHealthLevel::getGroupUpperLimit, stationDto.getScore()); stationQuery.like(IdxBizFanHealthLevel::getStatus, stationMap.getKey());
IdxBizPvHealthLevel stationPvLevel = idxBizPvHealthLevelMapper.selectOne(stationPvQuery); stationQuery.eq(IdxBizFanHealthLevel::getAnalysisObjType, "场站");
if (ObjectUtils.isNotEmpty(stationPvLevel)) { stationQuery.lt(IdxBizFanHealthLevel::getGroupLowerLimit, stationDto.getScore());
stationDto.setStatus(stationPvLevel.getHealthLevel()); stationQuery.ge(IdxBizFanHealthLevel::getGroupUpperLimit, stationDto.getScore());
} IdxBizFanHealthLevel stationLevel = idxBizFanHealthLevelMapper.selectOne(stationQuery);
} stationDto.setStatus(ObjectUtils.isNotEmpty(stationLevel) ? stationLevel.getHealthLevel() : "");
stationDto.setParentKey(areaMapDto.getKey()); if (ObjectUtils.isEmpty(stationLevel)) {
areaMapDto.getChildren().add(stationDto); LambdaQueryWrapper<IdxBizPvHealthLevel> stationPvQuery = new LambdaQueryWrapper<>();
stationInt++; stationPvQuery.like(IdxBizPvHealthLevel::getStatus, stationMap.getKey());
for (Map.Entry<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>> equipmentMap : stationMap.getValue().entrySet()) { stationPvQuery.eq(IdxBizPvHealthLevel::getAnalysisObjType, "场站");
stationPvQuery.lt(IdxBizPvHealthLevel::getGroupLowerLimit, stationDto.getScore());
stationPvQuery.ge(IdxBizPvHealthLevel::getGroupUpperLimit, stationDto.getScore());
if (stationLowScore == null && stationHighScore == null) { IdxBizPvHealthLevel stationPvLevel = idxBizPvHealthLevelMapper.selectOne(stationPvQuery);
stationLowScore = equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0); if (ObjectUtils.isNotEmpty(stationPvLevel)) {
stationHighScore = equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0); stationDto.setStatus(stationPvLevel.getHealthLevel());
} else { }
if (equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0) < stationLowScore) { }
stationLowScore = equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0); stationDto.setParentKey(areaMapDto.getKey());
} areaMapDto.getChildren().add(stationDto);
if (equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0) > stationHighScore) { stationInt++;
stationHighScore = equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0); for (Map.Entry<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>> equipmentMap : stationMap
} .getValue().entrySet()) {
}
if (stationLowScore == null && stationHighScore == null) {
FullViewRecallInfoDTO equipmentMapDto = new FullViewRecallInfoDTO(); stationLowScore = equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0);
equipmentMapDto.setKey(stationDto.getKey() + "-" + equipmentInt); stationHighScore = equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0);
equipmentMapDto.setName(equipmentMap.getKey()); } else {
equipmentMapDto.setScoreRange(""); if (equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0) < stationLowScore) {
IdxBizFanHealthLevel levelInfo = getHealthLevelByScore(healthLevelInfoList, stationMap.getKey(), "设备", equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0)); stationLowScore = equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0);
equipmentMapDto.setStatus(levelInfo.getHealthLevel()); }
equipmentMapDto.setScore(equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0)); if (equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0) > stationHighScore) {
equipmentMapDto.setParentKey(stationDto.getKey()); stationHighScore = equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0);
stationDto.getChildren().add(equipmentMapDto); }
equipmentInt++; }
for (Map.Entry<String, Map<String, List<FullViewRecallDataDTO>>> subSystemMap : equipmentMap.getValue().entrySet()) {
FullViewRecallInfoDTO subSystemMapDto = new FullViewRecallInfoDTO(); FullViewRecallInfoDTO equipmentMapDto = new FullViewRecallInfoDTO();
subSystemMapDto.setKey(equipmentMapDto.getKey() + "-" + subSystemInt); equipmentMapDto.setKey(stationDto.getKey() + "-" + equipmentInt);
subSystemMapDto.setName(subSystemMap.getKey()); equipmentMapDto.setName(equipmentMap.getKey());
subSystemMapDto.setScoreRange(""); equipmentMapDto.setScoreRange("");
IdxBizFanHealthLevel levelInfo = getHealthLevelByScore(healthLevelInfoList, stationMap.getKey(),
"设备", equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0));
equipmentMapDto.setStatus(levelInfo.getHealthLevel());
equipmentMapDto.setScore(equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0));
equipmentMapDto.setParentKey(stationDto.getKey());
stationDto.getChildren().add(equipmentMapDto);
equipmentInt++;
for (Map.Entry<String, Map<String, List<FullViewRecallDataDTO>>> subSystemMap : equipmentMap
.getValue().entrySet()) {
FullViewRecallInfoDTO subSystemMapDto = new FullViewRecallInfoDTO();
subSystemMapDto.setKey(equipmentMapDto.getKey() + "-" + subSystemInt);
subSystemMapDto.setName(subSystemMap.getKey());
subSystemMapDto.setScoreRange("");
// subSystemMapDto.setStatus(null); // subSystemMapDto.setStatus(null);
IdxBizFanHealthLevel levelInfoZxt = getHealthLevelByScore(healthLevelInfoList, stationMap.getKey(), "子系统", subSystemIndexInfoMap.getOrDefault(subSystemMap.getKey(), 100.0)); IdxBizFanHealthLevel levelInfoZxt = getHealthLevelByScore(healthLevelInfoList,
subSystemMapDto.setStatus(levelInfoZxt.getHealthLevel()); stationMap.getKey(), "子系统",
subSystemIndexInfoMap.getOrDefault(subSystemMap.getKey(), 100.0));
subSystemMapDto.setScore(subSystemIndexInfoMap.getOrDefault(subSystemMap.getKey(), 100.0)); subSystemMapDto.setStatus(levelInfoZxt.getHealthLevel());
subSystemMapDto.setParentKey(equipmentMapDto.getKey());
equipmentMapDto.getChildren().add(subSystemMapDto); subSystemMapDto.setScore(subSystemIndexInfoMap.getOrDefault(subSystemMap.getKey(), 100.0));
subSystemInt++; subSystemMapDto.setParentKey(equipmentMapDto.getKey());
for (Map.Entry<String, List<FullViewRecallDataDTO>> pointNameMap : subSystemMap.getValue().entrySet()) { equipmentMapDto.getChildren().add(subSystemMapDto);
FullViewRecallInfoDTO pointNameMapDto = new FullViewRecallInfoDTO(); subSystemInt++;
pointNameMapDto.setKey(subSystemMapDto.getKey() + "-" + pointNameInt); for (Map.Entry<String, List<FullViewRecallDataDTO>> pointNameMap : subSystemMap.getValue()
pointNameMapDto.setName(pointNameMap.getKey()); .entrySet()) {
FullViewRecallInfoDTO pointNameMapDto = new FullViewRecallInfoDTO();
FullViewRecallDataDTO fullViewRecallDataDTO = pointNameMap.getValue().get(0); pointNameMapDto.setKey(subSystemMapDto.getKey() + "-" + pointNameInt);
pointNameMapDto.setName(pointNameMap.getKey());
pointNameMapDto.setScoreRange("");
FullViewRecallDataDTO fullViewRecallDataDTO = pointNameMap.getValue().get(0);
IdxBizFanHealthLevel levelInfoBL = getHealthLevelByScore(healthLevelInfoList, stationMap.getKey(), "测点", pointNameIndexInfoMap.getOrDefault(fullViewRecallDataDTO.getStation() + "_" + fullViewRecallDataDTO.getIndexAddress(), 100.0));
pointNameMapDto.setStatus(levelInfoBL.getHealthLevel()); pointNameMapDto.setScoreRange("");
pointNameMapDto.setScore(pointNameIndexInfoMap.getOrDefault(fullViewRecallDataDTO.getStation() + "_" + fullViewRecallDataDTO.getIndexAddress(), 100.0)); IdxBizFanHealthLevel levelInfoBL = getHealthLevelByScore(healthLevelInfoList,
pointNameMapDto.setParentKey(subSystemMapDto.getKey()); stationMap.getKey(), "测点",
subSystemMapDto.getChildren().add(pointNameMapDto); pointNameIndexInfoMap.getOrDefault(fullViewRecallDataDTO.getStation() + "_"
+ fullViewRecallDataDTO.getIndexAddress(), 100.0));
pointNameInt++; pointNameMapDto.setStatus(levelInfoBL.getHealthLevel());
}
} pointNameMapDto.setScore(pointNameIndexInfoMap.getOrDefault(
} fullViewRecallDataDTO.getStation() + "_" + fullViewRecallDataDTO.getIndexAddress(),
stationDto.setScoreRange("(最低:" + stationLowScore + "分, 最高:" + stationHighScore + "分)"); 100.0));
} pointNameMapDto.setParentKey(subSystemMapDto.getKey());
subSystemMapDto.getChildren().add(pointNameMapDto);
areaMapDto.setScoreRange("(最低:" + areaLowScore + "分, 最高:" + areaHighScore + "分)");
} pointNameInt++;
List<FullViewRecallInfoDTO> resultList = new ArrayList<>(); }
resultList.add(allMapDto); }
resultList = getFullViewRecallResultByCurrentUser(resultList); }
return ResponseHelper.buildResponse(resultList); stationDto.setScoreRange("(最低:" + stationLowScore + "分, 最高:" + stationHighScore + "分)");
} }
areaMapDto.setScoreRange("(最低:" + areaLowScore + "分, 最高:" + areaHighScore + "分)");
private IdxBizFanHealthLevel getHealthLevelByScore(List<IdxBizFanHealthLevel> healthLevelInfoList, String station, String type, Double score) { }
List<FullViewRecallInfoDTO> resultList = new ArrayList<>();
IdxBizFanHealthLevel resultDto = new IdxBizFanHealthLevel(); resultList.add(allMapDto);
resultList = getFullViewRecallResultByCurrentUser(resultList);
String stationType = "风电站"; return ResponseHelper.buildResponse(resultList);
List<IdxBizFanHealthLevel> collect = healthLevelInfoList.stream().filter(item -> item.getAnalysisObjType().contains(station)).collect(Collectors.toList()); }
for (IdxBizFanHealthLevel item : collect) {
if (item.getAnalysisObjType().contains("子阵")) { private IdxBizFanHealthLevel getHealthLevelByScore(List<IdxBizFanHealthLevel> healthLevelInfoList, String station,
stationType = "光伏站"; String type, Double score) {
break;
} IdxBizFanHealthLevel resultDto = new IdxBizFanHealthLevel();
}
for (IdxBizFanHealthLevel item : collect) { String stationType = "风电站";
if (type.equals("设备") && stationType.equals("风电站") && item.getAnalysisObjType().contains(type) && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit()) { List<IdxBizFanHealthLevel> collect = healthLevelInfoList.stream()
resultDto = item; .filter(item -> item.getAnalysisObjType().contains(station)).collect(Collectors.toList());
break; for (IdxBizFanHealthLevel item : collect) {
} if (item.getAnalysisObjType().contains("子阵")) {
if (type.equals("子系统") && stationType.equals("风电站") && item.getAnalysisObjType().contains(type) && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit()) { stationType = "光伏站";
resultDto = item; break;
break; }
} }
if (type.equals("测点") && item.getAnalysisObjType().contains(type) && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit()) { for (IdxBizFanHealthLevel item : collect) {
resultDto = item; if (type.equals("设备") && stationType.equals("风电站") && item.getAnalysisObjType().contains(type)
break; && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit()) {
} resultDto = item;
if (type.equals("设备") && stationType.equals("光伏站") && item.getAnalysisObjType().contains("子阵") && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit()) { break;
resultDto = item; }
break; if (type.equals("子系统") && stationType.equals("风电站") && item.getAnalysisObjType().contains(type)
} && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit()) {
if (type.equals("子系统") && stationType.equals("光伏站") && item.getAnalysisObjType().contains("设备") && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit()) { resultDto = item;
resultDto = item; break;
break; }
} if (type.equals("测点") && item.getAnalysisObjType().contains(type) && score >= item.getGroupLowerLimit()
} && score <= item.getGroupUpperLimit()) {
return resultDto; resultDto = item;
} break;
}
private List<String> getGatewayIds() { if (type.equals("设备") && stationType.equals("光伏站") && item.getAnalysisObjType().contains("子阵")
List<String> permissions = permissionService.getCurrentUserPermissions(); && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit()) {
if (Objects.isNull(permissions)) { resultDto = item;
permissions = Collections.emptyList(); break;
} }
return permissions; if (type.equals("子系统") && stationType.equals("光伏站") && item.getAnalysisObjType().contains("设备")
} && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit()) {
resultDto = item;
private List<FullViewRecallInfoDTO> getFullViewRecallResultByCurrentUser(List<FullViewRecallInfoDTO> fullViewRecallInfoDTOS) { break;
List<FullViewRecallInfoDTO> result = new ArrayList<>(); }
if (fullViewRecallInfoDTOS.size() > 0) { }
String rootNodeName = permissionService.getCurrentUserPersmissions(); return resultDto;
if (rootNodeName.equals("all")) { }
return fullViewRecallInfoDTOS;
} else { private List<String> getGatewayIds() {
List<String> stringList = Arrays.asList(rootNodeName,rootNodeName.replace("片区","区域"),rootNodeName.replace("区域","片区"),rootNodeName.replace("电站","电场"),rootNodeName.replace("电场","电站")); List<String> permissions = permissionService.getCurrentUserPermissions();
List<FullViewRecallInfoDTO> fullViewRecallInfoDTOS1 = fullViewRecallInfoDTOS.get(0).getChildren().stream().filter(item -> stringList.contains(item.getName())).collect(Collectors.toList()); if (Objects.isNull(permissions)) {
if (fullViewRecallInfoDTOS1.size() > 0) { permissions = Collections.emptyList();
return fullViewRecallInfoDTOS1; }
} else { return permissions;
List<FullViewRecallInfoDTO> fullViewRecallInfoDTOS2 = fullViewRecallInfoDTOS.get(0).getChildren(); }
for (FullViewRecallInfoDTO fullViewRecallInfoDTO : fullViewRecallInfoDTOS2) {
List<FullViewRecallInfoDTO> fullViewRecallInfoDTOS3=fullViewRecallInfoDTO.getChildren().stream().filter(item -> stringList.contains(item.getName())).collect(Collectors.toList()); private List<FullViewRecallInfoDTO> getFullViewRecallResultByCurrentUser(
if (fullViewRecallInfoDTOS3.size()>0){ List<FullViewRecallInfoDTO> fullViewRecallInfoDTOS) {
return fullViewRecallInfoDTOS3; List<FullViewRecallInfoDTO> result = new ArrayList<>();
} if (fullViewRecallInfoDTOS.size() > 0) {
} String rootNodeName = permissionService.getCurrentUserPersmissions();
} if (rootNodeName.equals("all")) {
} return fullViewRecallInfoDTOS;
} } else {
return result; List<String> stringList = Arrays.asList(rootNodeName, rootNodeName.replace("片区", "区域"),
} rootNodeName.replace("区域", "片区"), rootNodeName.replace("电站", "电场"),
rootNodeName.replace("电场", "电站"));
List<FullViewRecallInfoDTO> fullViewRecallInfoDTOS1 = fullViewRecallInfoDTOS.get(0).getChildren()
.stream().filter(item -> stringList.contains(item.getName())).collect(Collectors.toList());
if (fullViewRecallInfoDTOS1.size() > 0) {
return fullViewRecallInfoDTOS1;
} else {
List<FullViewRecallInfoDTO> fullViewRecallInfoDTOS2 = fullViewRecallInfoDTOS.get(0).getChildren();
for (FullViewRecallInfoDTO fullViewRecallInfoDTO : fullViewRecallInfoDTOS2) {
List<FullViewRecallInfoDTO> fullViewRecallInfoDTOS3 = fullViewRecallInfoDTO.getChildren()
.stream().filter(item -> stringList.contains(item.getName()))
.collect(Collectors.toList());
if (fullViewRecallInfoDTOS3.size() > 0) {
return fullViewRecallInfoDTOS3;
}
}
}
}
}
return result;
}
} }
...@@ -13,20 +13,21 @@ import java.util.Date; ...@@ -13,20 +13,21 @@ import java.util.Date;
public interface Constant { public interface Constant {
// 风电相关性消费者 // 风电相关性消费者
String kafkaTopicConsumer = "FanConditionVariables"; String kafkaTopicConsumer = "FAN_XGX";
// 光伏相关性消费者 // 光伏相关性消费者
String kafkaTopicConsumerPv = "PvConditionVariables"; String kafkaTopicConsumerPv = "PV_XGX";
// 风电 工况区间划分 // 风电 工况区间划分
String kafkaTopicConsumerGKHFFan = "FanConditionVariablesGKHF"; String kafkaTopicConsumerGKHFFan = "FAN_QJHF";
// 光伏 工况区间划分 // 光伏 工况区间划分
String kafkaTopicConsumerGKHFPv = "PvConditionVariablesGKHF"; String kafkaTopicConsumerGKHFPv = "PV_QJHF";
// 风电 中心值计算 // 风电 中心值计算
String kafkaTopicConsumerZXZFan = "FanConditionVariablesGZXZ"; String kafkaTopicConsumerZXZFan = "FAN_ZXZ";
// 光伏 中心值计算 // 光伏 中心值计算
String kafkaTopicConsumerZXZPv = "PvConditionVariablesZXZ"; String kafkaTopicConsumerZXZPv = "PV_ZXZ";
} }
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.core.util.DesensitizedUtil; import cn.hutool.core.util.DesensitizedUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -63,331 +62,331 @@ import java.util.stream.Collectors; ...@@ -63,331 +62,331 @@ import java.util.stream.Collectors;
*/ */
@Slf4j @Slf4j
@Service @Service
public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBasic, PersonBasicMapper> implements IPersonBasicService { public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBasic, PersonBasicMapper>
implements IPersonBasicService {
@Autowired
PersonBasicMapper personBasicMapper; @Autowired
PersonBasicMapper personBasicMapper;
//人员账号信息service // 人员账号信息service
@Autowired @Autowired
PersonAccountServiceImpl personAccountService; PersonAccountServiceImpl personAccountService;
//人员归属信息service // 人员归属信息service
@Autowired @Autowired
PersonAscriptionServiceImpl personAscriptionService; PersonAscriptionServiceImpl personAscriptionService;
//人员资质信息service // 人员资质信息service
@Autowired @Autowired
PersonCertificateServiceImpl personCertificateService; PersonCertificateServiceImpl personCertificateService;
//人员教育信息 // 人员教育信息
@Autowired @Autowired
PersonSkillEducationServiceImpl personSkillEducationService; PersonSkillEducationServiceImpl personSkillEducationService;
@Value("${amos.secret.key}") @Value("${amos.secret.key}")
String secretKey; String secretKey;
@Autowired @Autowired
QuerueProduce querueProduce; QuerueProduce querueProduce;
@Autowired @Autowired
private AmosFeignService amosFeignService; private AmosFeignService amosFeignService;
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Autowired @Autowired
protected EmqKeeper emqKeeper; protected EmqKeeper emqKeeper;
@Autowired
@Autowired private AgencyuserFeign agencyuserFeign;
private AgencyuserFeign agencyuserFeign;
@Autowired
@Autowired private UserEmpowerMapper userEmpowerMapper;
private UserEmpowerMapper userEmpowerMapper;
/**
/** * 人员赋码触发风险模型
* 人员赋码触发风险模型 */
*/ public static final String RYFM_DATA_MQTT_TOPIC = "ryfm/data/analysis";
public static final String RYFM_DATA_MQTT_TOPIC = "ryfm/data/analysis";
/**
* 人员红黄码恢复为绿码
/** */
* 人员红黄码恢复为绿码 public static final String RYFM_GREEN = "ryfm/person/green";
*/
public static final String RYFM_GREEN = "ryfm/person/green"; private String UPDATE = "UPDATE";
private String INSERT = "INSERT";
@Autowired
PersonAccountFedMapper personAccountFedMapper;
private String UPDATE="UPDATE";
private String INSERT="INSERT"; /**
@Autowired * 分页查询
PersonAccountFedMapper personAccountFedMapper; */
/** public Page<PersonBasicDto> queryForPersonBasicPage(Page<PersonBasicDto> page) {
* 分页查询 return this.queryForPage(page, null, false);
*/ }
public Page<PersonBasicDto> queryForPersonBasicPage(Page<PersonBasicDto> page) {
return this.queryForPage(page, null, false); /**
} * 列表查询 示例
*/
/** public List<PersonBasicDto> queryForPersonBasicList() {
* 列表查询 示例 return this.queryForList("", false);
*/ }
public List<PersonBasicDto> queryForPersonBasicList() {
return this.queryForList("", false); public void addRedisPostAndCerInfo() {
} List<DictionarieValueModel> elevatorCategory = null;
try {
public void addRedisPostAndCerInfo() { elevatorCategory = amosFeignService.listDictionaryByDictCode("YGZYJNJDZS");
List<DictionarieValueModel> elevatorCategory = null; } catch (Exception e) {
try { e.printStackTrace();
elevatorCategory = amosFeignService.listDictionaryByDictCode("YGZYJNJDZS"); }
} catch (Exception e) { Map<String, String> collect = elevatorCategory.stream().collect(
e.printStackTrace(); Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataDesc));
} redisUtils.set(Constants.JXIOP_DICT_POST, collect);
Map<String, String> collect = elevatorCategory.stream().collect(Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataDesc));
redisUtils.set(Constants.JXIOP_DICT_POST, collect); List<DictionarieValueModel> elevator = null;
try {
List<DictionarieValueModel> elevator = null; elevator = amosFeignService.listDictionaryByDictCode("岗位资质鉴定证书");
try { } catch (Exception e) {
elevator = amosFeignService.listDictionaryByDictCode("岗位资质鉴定证书"); e.printStackTrace();
} catch (Exception e) { }
e.printStackTrace(); Map<String, String> collect2 = elevator.stream().collect(
} Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataDesc));
Map<String, String> collect2 = elevator.stream().collect(Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataDesc)); redisUtils.set(Constants.JXIOP_DICT_CERTIFICATES, collect2);
redisUtils.set(Constants.JXIOP_DICT_CERTIFICATES, collect2); }
}
public RiskBizInfoVo fetchData(PersonBasic personBasic, PersonAccount personAccount, String content) {
RiskBizInfoVo riskBizInfoVo = new RiskBizInfoVo();
public RiskBizInfoVo fetchData(PersonBasic personBasic, PersonAccount personAccount, String content) { riskBizInfoVo.setWarningObjectName(
RiskBizInfoVo riskBizInfoVo = new RiskBizInfoVo(); personAccount.getProjectName() + personBasic.getPostName() + personAccount.getName());
riskBizInfoVo.setWarningObjectName(personAccount.getProjectName() + personBasic.getPostName() + personAccount.getName()); riskBizInfoVo.setWarningObjectCode(String.valueOf(personBasic.getSequenceNbr()));
riskBizInfoVo.setWarningObjectCode(String.valueOf(personBasic.getSequenceNbr())); riskBizInfoVo.setSourceAttribution(personBasic.getProjectOrgCode());
riskBizInfoVo.setSourceAttribution(personBasic.getProjectOrgCode()); riskBizInfoVo.setSourceAttributionDesc(personAccount.getProjectName());
riskBizInfoVo.setSourceAttributionDesc(personAccount.getProjectName()); riskBizInfoVo.setWarningObjectType("RYFM");
riskBizInfoVo.setWarningObjectType("RYFM"); List<RiskDynamicDetailsVo> detailsVos = new ArrayList<>();
List<RiskDynamicDetailsVo> detailsVos = new ArrayList<>(); RiskDynamicDetailsVo dynamicDetailsVo = new RiskDynamicDetailsVo();
RiskDynamicDetailsVo dynamicDetailsVo = new RiskDynamicDetailsVo(); dynamicDetailsVo.setTabName("预警详情");
dynamicDetailsVo.setTabName("预警详情"); detailsVos.add(dynamicDetailsVo);
detailsVos.add(dynamicDetailsVo); riskBizInfoVo.setDynamicDetails(detailsVos);
riskBizInfoVo.setDynamicDetails(detailsVos); CustomizeItems customizeItems = new CustomizeItems();
CustomizeItems customizeItems = new CustomizeItems(); customizeItems.setWarningContent(content);
customizeItems.setWarningContent(content); riskBizInfoVo.setCustomizeItems(customizeItems);
riskBizInfoVo.setCustomizeItems(customizeItems); return riskBizInfoVo;
return riskBizInfoVo; }
}
/**
* 新增
/** */
* 新增 @Transactional
*/ public void addPerson(PersonDto model, HttpServletRequest httpServletRequest) throws Exception {
@Transactional if (!redisUtils.hasKey(Constants.JXIOP_DICT_POST) || !redisUtils.hasKey(Constants.JXIOP_DICT_CERTIFICATES)) {
public void addPerson(PersonDto model, HttpServletRequest httpServletRequest) throws Exception { addRedisPostAndCerInfo();
if (!redisUtils.hasKey(Constants.JXIOP_DICT_POST) || !redisUtils.hasKey(Constants.JXIOP_DICT_CERTIFICATES)) { }
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();
//获取人员账号信息 personUser.setPhone(personAccount.getPhoneNum());
PersonAccount personAccount = model.getPersonAccount(); // 人员基础信息
personUser.setPhone(personAccount.getPhoneNum()); PersonBasic personBasic = new PersonBasic();
//人员基础信息 BeanUtils.copyProperties(personUser, personBasic);
PersonBasic personBasic = new PersonBasic(); // 默认红码
BeanUtils.copyProperties(personUser, personBasic); personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
//默认红码 personBasic.setQrcodeDesc("证书不全");
personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode()); // 该岗位应获得的证书
personBasic.setQrcodeDesc("证书不全"); List<String> list2 = new ArrayList<>();
// 该岗位应获得的证书 if (StringUtils.isNotEmpty(personUser.getPostName())) {
List<String> list2 = new ArrayList<>(); String certificates = postNameMap.get(personUser.getPostName());
if (StringUtils.isNotEmpty(personUser.getPostName())) { if (!StringUtils.isEmpty(certificates)) {
String certificates = postNameMap.get(personUser.getPostName()); list2 = Arrays.asList(certificates.split(","));
if (!StringUtils.isEmpty(certificates)) { }
list2 = Arrays.asList(certificates.split(",")); }
} List<String> list = new ArrayList(list2);
} // 人员资质信息
List<String> list = new ArrayList(list2); Integer isInMonth = 0;
//人员资质信息 Integer isOver = 0;
Integer isInMonth = 0; CertificationInfo personCertificate = model.getPersonCertificate();
Integer isOver = 0;
CertificationInfo personCertificate = model.getPersonCertificate(); // 过期的证书
List<String> overCertificateList = new ArrayList<>();
// 过期的证书 // 临期证书
List<String> overCertificateList = new ArrayList<>(); List<String> inMonthCertificateList = new ArrayList<>();
// 临期证书 if (CollectionUtils.isNotEmpty(personCertificate.getCertificationInfo())) {
List<String> inMonthCertificateList = new ArrayList<>(); for (PersonCertificate item : personCertificate.getCertificationInfo()) {
if (CollectionUtils.isNotEmpty(personCertificate.getCertificationInfo())) { if (StringUtils.isNotEmpty(item.getValidPeriod()) && !Objects.isNull(item.getCertificateTime())) {
for (PersonCertificate item : personCertificate.getCertificationInfo()) { int validPeriod = StringUtils.isEmpty(item.getValidPeriod()) ? 3
if (StringUtils.isNotEmpty(item.getValidPeriod()) && !Objects.isNull(item.getCertificateTime())) { : Integer.parseInt(item.getValidPeriod());
int validPeriod = StringUtils.isEmpty(item.getValidPeriod()) ? 3 : 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()) && isOver = 1;
DateUtils.dateCompare(date, new Date()) == -1) { overCertificateList.add(item.getCertificateName());
isOver = 1; }
overCertificateList.add(item.getCertificateName()); if (list.contains(item.getCertificateName())
} && DateUtils.dateBetweenIncludeToday(new Date(), date) < Integer
if (list.contains(item.getCertificateName()) && .valueOf(certificatesMap.get(item.getCertificateName()))
DateUtils.dateBetweenIncludeToday(new Date(), date) < Integer.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()); }
} }
} 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); }
} personBasic.setMissingCertificate(join);
personBasic.setMissingCertificate(join);
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()); }
} CompanyModel companyModel = new CompanyModel();
CompanyModel companyModel = new CompanyModel(); // 单位
//单位 companyModel = this.getCompanyModel(personAccount.getProjectId());
companyModel = this.getCompanyModel(personAccount.getProjectId()); personBasic.setProjectOrgCode(companyModel.getOrgCode());
personBasic.setProjectOrgCode(companyModel.getOrgCode());
if (personUser.getNativePlace() != null) {
personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace()));
if (personUser.getNativePlace()!=null) { }
personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace())); this.baseMapper.insert(personBasic);
}
this.baseMapper.insert(personBasic); if ("证书不全".equals(personBasic.getQrcodeDesc()) || "证书临期".equals(personBasic.getQrcodeDesc())) {
personBasic.setProjectOrgCode(companyModel.getOrgCode());
if ("证书不全".equals(personBasic.getQrcodeDesc()) || "证书临期".equals(personBasic.getQrcodeDesc())) { personAccount.setProjectName(companyModel.getCompanyName());
personBasic.setProjectOrgCode(companyModel.getOrgCode()); BizMessage bizMessage = new BizMessage();
personAccount.setProjectName(companyModel.getCompanyName()); bizMessage.setIndexKey("RYFM");
BizMessage bizMessage = new BizMessage(); bizMessage.setIndexValue(personBasic.getPostName() + personBasic.getQrcodeDesc());
bizMessage.setIndexKey("RYFM"); RiskBizInfoVo riskBizInfoVo = fetchData(personBasic, personAccount, join);
bizMessage.setIndexValue(personBasic.getPostName() + personBasic.getQrcodeDesc()); bizMessage.setBizInfo(riskBizInfoVo);
RiskBizInfoVo riskBizInfoVo = fetchData(personBasic, personAccount, join); bizMessage.setTraceId(String.valueOf(personBasic.getSequenceNbr()));
bizMessage.setBizInfo(riskBizInfoVo); try {
bizMessage.setTraceId(String.valueOf(personBasic.getSequenceNbr())); emqKeeper.getMqttClient().publish(RYFM_DATA_MQTT_TOPIC,
try { JSON.toJSONString(bizMessage).getBytes(StandardCharsets.UTF_8), 2, false);
emqKeeper.getMqttClient().publish(RYFM_DATA_MQTT_TOPIC, JSON.toJSONString(bizMessage).getBytes(StandardCharsets.UTF_8), 2, false); } catch (MqttException e) {
} catch (MqttException e) { e.printStackTrace();
e.printStackTrace(); }
} }
} if (CollectionUtils.isNotEmpty(personCertificate.getCertificationInfo())) {
if (CollectionUtils.isNotEmpty(personCertificate.getCertificationInfo())) { personCertificate.getCertificationInfo().forEach(item -> {
personCertificate.getCertificationInfo().forEach(item -> { item.setPersonId(personBasic.getSequenceNbr());
item.setPersonId(personBasic.getSequenceNbr()); personCertificateService.save(item);
personCertificateService.save(item); });
}); }
} // 人员技能学历信息
//人员技能学历信息 PersonSkillEducation personSkillEducation = new PersonSkillEducation();
PersonSkillEducation personSkillEducation = new PersonSkillEducation(); BeanUtils.copyProperties(personUser, personSkillEducation);
BeanUtils.copyProperties(personUser, personSkillEducation); personSkillEducation.setPersonId(personBasic.getSequenceNbr());
personSkillEducation.setPersonId(personBasic.getSequenceNbr()); personSkillEducationService.save(personSkillEducation);
personSkillEducationService.save(personSkillEducation);
// 人员账号信息
//人员账号信息 personAccount.setPersonId(personBasic.getSequenceNbr());
personAccount.setPersonId(personBasic.getSequenceNbr()); 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)); personAccountService.save(personAccount);
personAccountService.save(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");
//新增平台用户 // 新增平台用户
AgencyUserModel agencyUserModel = this.setcreateUser(usd); AgencyUserModel agencyUserModel = this.setcreateUser(usd);
//设置userID // 设置userID
usd.setUserId(agencyUserModel.getUserId()); usd.setUserId(agencyUserModel.getUserId());
//设置工号 // 设置工号
usd.setUserName(personAccount.getJobNumber()); usd.setUserName(personAccount.getJobNumber());
//创建支持工号登录 // 创建支持工号登录
this.createLoginInfo(usd); this.createLoginInfo(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());
} }
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.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());
...@@ -398,278 +397,275 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -398,278 +397,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();
BeanUtils.copyProperties(personAccount, personAccountFed);
personAccountFed.setSyncState(0);
personAccountFed.setSyncDate(new Date());
personAccountFedMapper.insert(personAccountFed);
//----------------------------权限表中新增数据-----------------------------
PersonAccountFed personAccountFed = new PersonAccountFed(); Map<String, Object> data = new HashMap<>();
BeanUtils.copyProperties(personAccount, personAccountFed); data.put("SEQUENCE_NBR", agencyUserModel.getSequenceNbr());
personAccountFed.setSyncState(0); ProduceMsg produceMsg = new ProduceMsg(data, INSERT, agencyUserModel.getUserId());
personAccountFed.setSyncDate(new Date()); querueProduce.produceMsg(JSON.toJSONString(produceMsg));
personAccountFedMapper.insert(personAccountFed);
}
Map<String, Object> data=new HashMap<>();
data.put("SEQUENCE_NBR",agencyUserModel.getSequenceNbr()); @Transactional
ProduceMsg produceMsg= new ProduceMsg(data, INSERT,agencyUserModel.getUserId()); public PersonDto updatePerson(PersonDto model, HttpServletRequest httpServletRequest, Long sequenceNbr)
querueProduce.produceMsg(JSON.toJSONString(produceMsg)); throws ParseException {
} if (!redisUtils.hasKey(Constants.JXIOP_DICT_POST) || !redisUtils.hasKey(Constants.JXIOP_DICT_CERTIFICATES)) {
addRedisPostAndCerInfo();
}
@Transactional // 岗位所需证书信息
public PersonDto updatePerson(PersonDto model, HttpServletRequest httpServletRequest, Long sequenceNbr) throws ParseException { Map<String, String> postNameMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_POST);
// 证书临期信息
if (!redisUtils.hasKey(Constants.JXIOP_DICT_POST) || !redisUtils.hasKey(Constants.JXIOP_DICT_CERTIFICATES)) { Map<String, String> certificatesMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_CERTIFICATES);
addRedisPostAndCerInfo();
} // 获取人员基本信息数据
// 岗位所需证书信息 PersonUser personUser = model.getPersonUser();
Map<String, String> postNameMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_POST); // 获取人员账号信息
// 证书临期信息 PersonAccount personAccount = model.getPersonAccount();
Map<String, String> certificatesMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_CERTIFICATES); PersonAccount oldpersonAccount = new PersonAccount();
personUser.setPhone(personAccount.getPhoneNum());
//获取人员基本信息数据
PersonUser personUser = model.getPersonUser(); // 人员基础信息
//获取人员账号信息 PersonBasic personBasic = personBasicMapper.selectById(sequenceNbr);
PersonAccount personAccount = model.getPersonAccount(); personBasic.setSequenceNbr(sequenceNbr);
PersonAccount oldpersonAccount = new PersonAccount(); personAccount.setPassword(DesUtil.encode(personAccount.getPassword(), secretKey));
personUser.setPhone(personAccount.getPhoneNum()); personAccount.setSecondaryPassword(DesUtil.encode(personAccount.getSecondaryPassword(), secretKey));
//人员基础信息 // 人员归属信息
PersonBasic personBasic = personBasicMapper.selectById(sequenceNbr); PersonSkillEducation personSkillEducation = new PersonSkillEducation();
personBasic.setSequenceNbr(sequenceNbr); BeanUtils.copyProperties(personUser, personSkillEducation);
personAccount.setPassword(DesUtil.encode(personAccount.getPassword(), secretKey)); personSkillEducation.setPersonId(personBasic.getSequenceNbr());
personAccount.setSecondaryPassword(DesUtil.encode(personAccount.getSecondaryPassword(), secretKey)); PersonSkillEducation personSkillEducationd = personSkillEducationService
.getOne(new QueryWrapper<PersonSkillEducation>().eq("person_id", personBasic.getSequenceNbr()));
//人员归属信息 personSkillEducation.setSequenceNbr(personSkillEducationd.getSequenceNbr());
PersonSkillEducation personSkillEducation = new PersonSkillEducation(); personSkillEducationService.updateById(personSkillEducation);
BeanUtils.copyProperties(personUser, personSkillEducation);
personSkillEducation.setPersonId(personBasic.getSequenceNbr()); // 获取人员资质信息
PersonSkillEducation personSkillEducationd = personSkillEducationService.getOne(new QueryWrapper<PersonSkillEducation>().eq("person_id", personBasic.getSequenceNbr())); CertificationInfo personCertificate = model.getPersonCertificate();
personSkillEducation.setSequenceNbr(personSkillEducationd.getSequenceNbr());
personSkillEducationService.updateById(personSkillEducation); LambdaUpdateWrapper<PersonCertificate> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(PersonCertificate::getPersonId, personBasic.getSequenceNbr());
//获取人员资质信息 personCertificateService.remove(wrapper);
CertificationInfo personCertificate = model.getPersonCertificate();
// 默认红码
LambdaUpdateWrapper<PersonCertificate> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(PersonCertificate::getPersonId, personBasic.getSequenceNbr());
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 : Integer.parseInt(item.getValidPeriod()); int validPeriod = StringUtils.isEmpty(item.getValidPeriod()) ? 3
Date date = DateUtils.dateAddYears(item.getCertificateTime(), validPeriod); : Integer.parseInt(item.getValidPeriod());
if (list.contains(item.getCertificateName()) && Date date = DateUtils.dateAddYears(item.getCertificateTime(), validPeriod);
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.valueOf(certificatesMap.get(item.getCertificateName())) && && DateUtils.dateBetweenIncludeToday(new Date(), date) < Integer
DateUtils.dateCompare(date, new Date()) == 1) { .valueOf(certificatesMap.get(item.getCertificateName()))
isInMonth = 1; && DateUtils.dateCompare(date, new Date()) == 1) {
inMonthCertificateList.add(item.getCertificateName()); isInMonth = 1;
} inMonthCertificateList.add(item.getCertificateName());
item.setPersonId(personBasic.getSequenceNbr()); }
personCertificateService.save(item); item.setPersonId(personBasic.getSequenceNbr());
} 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<>();
if (CollectionUtils.isNotEmpty(overCertificateList)) { List<String> strings = new ArrayList<>();
strings.add("过期证书:" + String.join("," , overCertificateList)); if (CollectionUtils.isNotEmpty(overCertificateList)) {
} strings.add("过期证书:" + String.join(",", overCertificateList));
if (CollectionUtils.isNotEmpty(inMonthCertificateList)) { }
strings.add("临期证书:" + String.join("," , inMonthCertificateList)); if (CollectionUtils.isNotEmpty(inMonthCertificateList)) {
} strings.add("临期证书:" + String.join(",", inMonthCertificateList));
if (CollectionUtils.isNotEmpty(noCertificateList)) { }
strings.add("缺少证书:" + String.join("," , noCertificateList)); if (CollectionUtils.isNotEmpty(noCertificateList)) {
} strings.add("缺少证书:" + String.join(",", noCertificateList));
}
String join = "";
if (CollectionUtils.isNotEmpty(strings)) { String join = "";
join = String.join(";", strings); if (CollectionUtils.isNotEmpty(strings)) {
} join = String.join(";", strings);
String missingCertificateOld = personBasic.getMissingCertificate(); }
personBasic.setMissingCertificate(join); String missingCertificateOld = personBasic.getMissingCertificate();
CompanyModel companyModel = new CompanyModel(); personBasic.setMissingCertificate(join);
//单位 CompanyModel companyModel = new CompanyModel();
companyModel = this.getCompanyModel(personAccount.getProjectId()); // 单位
companyModel = this.getCompanyModel(personAccount.getProjectId());
String qrcodeColorOld = personBasic.getQrcodeColor();
if (CollectionUtils.isEmpty(list) && isInMonth == 0 && isOver == 0) { String qrcodeColorOld = personBasic.getQrcodeColor();
personBasic.setQrcodeColor(QrcodeColorEnum.GREEN.getCode()); if (CollectionUtils.isEmpty(list) && isInMonth == 0 && isOver == 0) {
personBasic.setQrcodeDesc("证书齐全"); personBasic.setQrcodeColor(QrcodeColorEnum.GREEN.getCode());
personBasic.setQrcodeDate(new Date()); personBasic.setQrcodeDesc("证书齐全");
} else if ((CollectionUtils.isEmpty(list) && isOver == 1) || (CollectionUtils.isNotEmpty(list))) { personBasic.setQrcodeDate(new Date());
personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode()); } else if ((CollectionUtils.isEmpty(list) && isOver == 1) || (CollectionUtils.isNotEmpty(list))) {
personBasic.setQrcodeDesc("证书不全"); personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
personBasic.setQrcodeDate(new Date()); personBasic.setQrcodeDesc("证书不全");
} else if (CollectionUtils.isEmpty(list) && isOver == 0 && isInMonth == 1) { personBasic.setQrcodeDate(new Date());
personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode()); } else if (CollectionUtils.isEmpty(list) && isOver == 0 && isInMonth == 1) {
personBasic.setQrcodeDesc("证书临期"); personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode());
personBasic.setQrcodeDate(new Date()); personBasic.setQrcodeDesc("证书临期");
} personBasic.setQrcodeDate(new Date());
personBasic.setProjectOrgCode(companyModel.getOrgCode()); }
personAccount.setProjectName(companyModel.getCompanyName()); personBasic.setProjectOrgCode(companyModel.getOrgCode());
personAccount.setProjectName(companyModel.getCompanyName());
// 人员账号信息
personAccount.setPersonId(sequenceNbr);
//人员账号信息 oldpersonAccount = personAccountService.getById(personAccount.getSequenceNbr());
personAccount.setPersonId(sequenceNbr); personAccountService.updateById(personAccount);
oldpersonAccount=personAccountService.getById(personAccount.getSequenceNbr()); // 新增平台账号
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<>();
//角色 List<Long> cdids = personAccount.getRoles().stream().map(s -> Long.parseLong(s.trim()))
Map<Long, List<Long>> map = new HashMap<>(); .collect(Collectors.toList()); // 测点数组
List<Long> cdids = personAccount.getRoles().stream().map(s -> Long.parseLong(s.trim())).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()) || BizMessage bizMessage = new BizMessage();
"证书临期".equals(personBasic.getQrcodeDesc()))) { bizMessage.setIndexKey("RYFM");
BizMessage bizMessage = new BizMessage(); bizMessage.setIndexValue(personBasic.getPostName() + personBasic.getQrcodeDesc());
bizMessage.setIndexKey("RYFM"); RiskBizInfoVo riskBizInfoVo = fetchData(personBasic, personAccount, join);
bizMessage.setIndexValue(personBasic.getPostName() + personBasic.getQrcodeDesc()); bizMessage.setBizInfo(riskBizInfoVo);
RiskBizInfoVo riskBizInfoVo = fetchData(personBasic, personAccount, join); bizMessage.setDataSource("人员赋码");
bizMessage.setBizInfo(riskBizInfoVo); try {
bizMessage.setDataSource("人员赋码"); emqKeeper.getMqttClient().publish(PersonBasicServiceImpl.RYFM_DATA_MQTT_TOPIC,
try { JSON.toJSONString(bizMessage).getBytes(StandardCharsets.UTF_8), 2, false);
emqKeeper.getMqttClient().publish(PersonBasicServiceImpl.RYFM_DATA_MQTT_TOPIC, 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>().eq("amos_user_id", personAccount.getPuserId()).eq("permission_type", "YTH")); StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>()
if(ObjectUtils.isEmpty(stdUserEmpower)){ .eq("amos_user_id", personAccount.getPuserId()).eq("permission_type", "YTH"));
stdUserEmpower = new StdUserEmpower(); if (ObjectUtils.isEmpty(stdUserEmpower)) {
stdUserEmpower.setRecDate(new Date()); stdUserEmpower = new StdUserEmpower();
stdUserEmpower.setPermissionType("YTH"); stdUserEmpower.setRecDate(new Date());
stdUserEmpower.setAmosOrgCode(Arrays.asList(personAccount.getYthPermission())); stdUserEmpower.setPermissionType("YTH");
stdUserEmpower.setAmosUserId(personAccount.getPuserId()); stdUserEmpower.setAmosOrgCode(Arrays.asList(personAccount.getYthPermission()));
userEmpowerMapper.insert(stdUserEmpower); stdUserEmpower.setAmosUserId(personAccount.getPuserId());
}else { userEmpowerMapper.insert(stdUserEmpower);
stdUserEmpower.setAmosOrgCode(Arrays.asList(personAccount.getYthPermission())); } else {
stdUserEmpower.setRecDate(new Date()); stdUserEmpower.setAmosOrgCode(Arrays.asList(personAccount.getYthPermission()));
userEmpowerMapper.updateById(stdUserEmpower); stdUserEmpower.setRecDate(new Date());
} userEmpowerMapper.updateById(stdUserEmpower);
//户用角色权限 }
// 户用角色权限
StdUserEmpower stdUserEmpowerhygf = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", personAccount.getPuserId()).eq("permission_type", "HYGF"));
if(ObjectUtils.isEmpty(stdUserEmpowerhygf)){ StdUserEmpower stdUserEmpowerhygf = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>()
stdUserEmpowerhygf=new StdUserEmpower(); .eq("amos_user_id", personAccount.getPuserId()).eq("permission_type", "HYGF"));
List<CompanyModel> co= userEmpowerMapper.getCompanyBoList("region",null,null); if (ObjectUtils.isEmpty(stdUserEmpowerhygf)) {
List<String> re= personAccount.getRegionalCompaniesSeq(); stdUserEmpowerhygf = new StdUserEmpower();
String flag=personAccount.getRegionalCompaniesSeqFlag(); List<CompanyModel> co = userEmpowerMapper.getCompanyBoList("region", null, null);
if(flag!=null&&!flag.isEmpty()){ List<String> re = personAccount.getRegionalCompaniesSeq();
if(flag.equals("all")){ String flag = personAccount.getRegionalCompaniesSeqFlag();
List<String> all=new ArrayList<>(); if (flag != null && !flag.isEmpty()) {
all.add("all"); if (flag.equals("all")) {
stdUserEmpowerhygf.setAmosOrgCode(all); List<String> all = new ArrayList<>();
}else{ all.add("all");
stdUserEmpowerhygf.setAmosOrgCode(re); stdUserEmpowerhygf.setAmosOrgCode(all);
} } else {
} 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());
...@@ -680,27 +676,27 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -680,27 +676,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());
...@@ -711,260 +707,268 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -711,260 +707,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>().eq("amos_user_id", personAccount.getPuserId()).eq("permission_type", "YTH")); StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>()
if(!ObjectUtils.isEmpty(stdUserEmpower)){ .eq("amos_user_id", personAccount.getPuserId()).eq("permission_type", "YTH"));
personAccount.setYthPermission(stdUserEmpower.getAmosOrgCode().get(0)); if (!ObjectUtils.isEmpty(stdUserEmpower)) {
} 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&&stdUserEmpowerhygf.getAmosOrgCode().get(0).equals("all")){ } else if (stdUserEmpowerhygf.getAmosOrgCode().size() == 1
&& 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.delete(new QueryWrapper<StdUserEmpower>().in("amos_user_id", userid).eq("permission_type", "YTH")); userEmpowerMapper
return deleteResult; .delete(new QueryWrapper<StdUserEmpower>().in("amos_user_id", userid).eq("permission_type", "YTH"));
} return deleteResult;
}
//新增平台用户
private AgencyUserModel setcreateUser(AgencyUserModel userDto) { // 新增平台用户
FeignClientResult<AgencyUserModel> amosUser = Privilege.agencyUserClient.create(userDto); private AgencyUserModel setcreateUser(AgencyUserModel userDto) {
FeignClientResult<AgencyUserModel> amosUser = Privilege.agencyUserClient.create(userDto);
AgencyUserModel user = new AgencyUserModel();
AgencyUserModel user = new AgencyUserModel();
if (!ObjectUtils.isEmpty(amosUser)) {
if (amosUser.getStatus() == 200) { if (!ObjectUtils.isEmpty(amosUser)) {
user = amosUser.getResult(); if (amosUser.getStatus() == 200) {
} else { user = amosUser.getResult();
throw new RuntimeException(amosUser.getMessage()); } else {
} throw new RuntimeException(amosUser.getMessage());
} }
return user; }
} return user;
private LoginInfoModel createLoginInfo(AgencyUserModel userDto) { }
FeignClientResult<LoginInfoModel> amosLoginfo = null;
try { private LoginInfoModel createLoginInfo(AgencyUserModel userDto) {
amosLoginfo = Privilege.agencyUserClient.createLoginInfo(userDto); FeignClientResult<LoginInfoModel> amosLoginfo = null;
} catch (Exception e) { try {
FeignClientResult<List<String>> cResult = Privilege.agencyUserClient.multDeleteUser(userDto.getUserId(),true); amosLoginfo = Privilege.agencyUserClient.createLoginInfo(userDto);
throw new RuntimeException(e); } catch (Exception e) {
} FeignClientResult<List<String>> cResult = Privilege.agencyUserClient.multDeleteUser(userDto.getUserId(),
return amosLoginfo.getResult(); true);
} throw new RuntimeException(e);
}
//修改平台用户 return amosLoginfo.getResult();
private AgencyUserModel updateuser(String userId, AgencyUserModel userDto) { }
FeignClientResult<AgencyUserModel> amosUser = Privilege.agencyUserClient.update(userDto, userId);
FeignClientResult<AgencyUserModel> amosUser1 = Privilege.agencyUserClient.modifyPassword(userId,userDto); // 修改平台用户
AgencyUserModel user = new AgencyUserModel(); private AgencyUserModel updateuser(String userId, AgencyUserModel userDto) {
if (!ObjectUtils.isEmpty(amosUser)) { FeignClientResult<AgencyUserModel> amosUser = null;
if (amosUser.getStatus() == 200) { FeignClientResult<AgencyUserModel> amosUser1 = null;
user = amosUser.getResult(); try {
} else { amosUser = Privilege.agencyUserClient.update(userDto, userId);
throw new RuntimeException(amosUser.getMessage()); amosUser1 = Privilege.agencyUserClient.modifyPassword(userId, userDto);
} } catch (Exception e) {
} e.printStackTrace();
if (!ObjectUtils.isEmpty(amosUser1)) { }
if (amosUser1.getStatus() == 200) {
user = amosUser1.getResult(); AgencyUserModel user = new AgencyUserModel();
} else { if (!ObjectUtils.isEmpty(amosUser)) {
throw new RuntimeException(amosUser1.getMessage()); if (amosUser.getStatus() == 200) {
} user = amosUser.getResult();
} } else {
return user; throw new RuntimeException(amosUser.getMessage());
} }
private LoginInfoModel updateLoginInfo(String loginId,AgencyUserModel userDto) { }
FeignClientResult<LoginInfoModel> amosLoginfo = null; if (!ObjectUtils.isEmpty(amosUser1)) {
try { if (amosUser1.getStatus() == 200) {
amosLoginfo = Privilege.agencyUserClient.updateLoginInfo(userDto,loginId); user = amosUser1.getResult();
//amosLoginfo = agencyuserFeign.updateLoginInfo(userDto, loginId); } else {
} catch (Exception e) { throw new RuntimeException(amosUser1.getMessage());
throw new RuntimeException(e); }
} }
return amosLoginfo.getResult(); return user;
} }
private DepartmentModel getdepartmentModel(Long departmentId) {
FeignClientResult<DepartmentModel> de = Privilege.departmentClient.seleteOne(departmentId); private LoginInfoModel updateLoginInfo(String loginId, AgencyUserModel userDto) {
FeignClientResult<LoginInfoModel> amosLoginfo = null;
DepartmentModel departmentModel = new DepartmentModel(); try {
amosLoginfo = Privilege.agencyUserClient.updateLoginInfo(userDto, loginId);
if (!ObjectUtils.isEmpty(de)) { // amosLoginfo = agencyuserFeign.updateLoginInfo(userDto, loginId);
if (de.getStatus() == 200) { } catch (Exception e) {
departmentModel = de.getResult(); throw new RuntimeException(e);
} else { }
throw new RuntimeException(de.getMessage()); return amosLoginfo.getResult();
} }
}
return departmentModel; private DepartmentModel getdepartmentModel(Long departmentId) {
} FeignClientResult<DepartmentModel> de = Privilege.departmentClient.seleteOne(departmentId);
public CompanyModel getCompanyModel(Long projectId) { DepartmentModel departmentModel = new DepartmentModel();
FeignClientResult<CompanyModel> cResult = Privilege.companyClient.seleteOne(projectId);
CompanyModel companyModel = new CompanyModel(); if (!ObjectUtils.isEmpty(de)) {
if (de.getStatus() == 200) {
if (!ObjectUtils.isEmpty(cResult)) { departmentModel = de.getResult();
if (cResult.getStatus() == 200) { } else {
companyModel = cResult.getResult(); throw new RuntimeException(de.getMessage());
} else { }
throw new RuntimeException(cResult.getMessage()); }
} return departmentModel;
} }
return companyModel;
} public CompanyModel getCompanyModel(Long projectId) {
FeignClientResult<CompanyModel> cResult = Privilege.companyClient.seleteOne(projectId);
private void deleuser(String userid) { CompanyModel companyModel = new CompanyModel();
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) { companyModel = cResult.getResult();
throw new RuntimeException(cResult.getMessage()); } else {
} throw new RuntimeException(cResult.getMessage());
} }
} }
return companyModel;
private String deleteLoginInfo(String loginId) { }
FeignClientResult<String> amosLoginfo = null;
try { private void deleuser(String userid) {
amosLoginfo = Privilege.agencyUserClient.deleteLoginInfo(loginId); FeignClientResult<List<String>> cResult = Privilege.agencyUserClient.multDeleteUser(userid, true);
} catch (Exception e) {
throw new RuntimeException(e); if (!ObjectUtils.isEmpty(cResult)) {
} if (cResult.getStatus() != 200) {
return amosLoginfo.getResult(); throw new RuntimeException(cResult.getMessage());
} }
/** }
* 分页查询 }
*/
public Page<UserMapperDto> queryPage(Page<UserMapperDto> page, private String deleteLoginInfo(String loginId) {
String name, FeignClientResult<String> amosLoginfo = null;
String accountName, try {
String projectName, String orgCode) { amosLoginfo = Privilege.agencyUserClient.deleteLoginInfo(loginId);
} catch (Exception e) {
List<UserMapperDto> list = personBasicMapper.queryPage((page.getCurrent() - 1) * page.getSize(), page.getSize(), name, throw new RuntimeException(e);
accountName, }
projectName, orgCode); return amosLoginfo.getResult();
List<UserMapperDto> listcount = personBasicMapper.queryPagecount(name, }
accountName,
projectName, orgCode); /**
page.setTotal(listcount.size()); * 分页查询
page.setRecords(list); */
return page; public Page<UserMapperDto> queryPage(Page<UserMapperDto> page, String name, String accountName, String projectName,
} String orgCode) {
public List<Map<String, Object>> getPersonYardStatistics(String parentCode) { List<UserMapperDto> list = personBasicMapper.queryPage((page.getCurrent() - 1) * page.getSize(), page.getSize(),
List<Map<String, Object>> resultList = personBasicMapper.getPersonYardStatistics(parentCode); name, accountName, projectName, orgCode);
resultList.forEach(item -> { List<UserMapperDto> listcount = personBasicMapper.queryPagecount(name, accountName, projectName, orgCode);
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor"))); page.setTotal(listcount.size());
item.put("name", name); page.setRecords(list);
item.put("value", Integer.parseInt(item.get("value").toString())); return page;
}); }
return resultList;
} public List<Map<String, Object>> getPersonYardStatistics(String parentCode) {
List<Map<String, Object>> resultList = personBasicMapper.getPersonYardStatistics(parentCode);
resultList.forEach(item -> {
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
item.put("name", name);
item.put("value", Integer.parseInt(item.get("value").toString()));
});
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