Commit 523aef3a authored by wujiang's avatar wujiang

修改防止生成多分数据

parent 9c2109b8
...@@ -163,7 +163,10 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -163,7 +163,10 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
powerStation.setRecDate(new Date()); powerStation.setRecDate(new Date());
Boolean fl = this.saveOrUpdate(powerStation); //Boolean fl = this.saveOrUpdate(powerStation);
// 避免生成多份数据
Boolean fl = this.saveOrUpdate(powerStation,new LambdaQueryWrapper<PowerStation>()
.eq(PowerStation::getPeasantHouseholdId,powerStation.getPeasantHouseholdId()));
PowerStationNodeEnum powerStationNodeEnum = PowerStationNodeEnum PowerStationNodeEnum powerStationNodeEnum = PowerStationNodeEnum
.getNodeByCode(powerStation.getNextProcessNode()); .getNodeByCode(powerStation.getNextProcessNode());
......
...@@ -215,6 +215,7 @@ public class QiyuesuoServiceImpl { ...@@ -215,6 +215,7 @@ public class QiyuesuoServiceImpl {
List<Stamper> stampers = new ArrayList<>(); List<Stamper> stampers = new ArrayList<>();
stampers.add(stamper); stampers.add(stamper);
stampers.add(stamper2); stampers.add(stamper2);
//发起合同
SdkResponse<Object> data = this.getSdkResponse(result.getId(), stampers); SdkResponse<Object> data = this.getSdkResponse(result.getId(), stampers);
return result.getId(); return result.getId();
} }
......
...@@ -49,312 +49,327 @@ import java.util.stream.Stream; ...@@ -49,312 +49,327 @@ import java.util.stream.Stream;
*/ */
@Service @Service
@Slf4j @Slf4j
public class SurveyInformationServiceImpl extends BaseService<SurveyInformationDto,SurveyInformation,SurveyInformationMapper> implements ISurveyInformationService { public class SurveyInformationServiceImpl
extends BaseService<SurveyInformationDto, SurveyInformation, SurveyInformationMapper>
implements ISurveyInformationService {
@Autowired
SurveyDetailsServiceImpl surveyDetailsService; @Autowired
SurveyDetailsServiceImpl surveyDetailsService;
@Autowired
InformationServiceImpl informationService; @Autowired
InformationServiceImpl informationService;
@Autowired
ExtendedInformationServiceImpl extendedInformationService; @Autowired
ExtendedInformationServiceImpl extendedInformationService;
@Autowired
CommercialServiceImpl commercialService; @Autowired
CommercialServiceImpl commercialService;
@Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl; @Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired
DesignInformationServiceImpl designInformationService; @Autowired
DesignInformationServiceImpl designInformationService;
@Autowired
WorkflowFeignClient workflowFeignClient; @Autowired
WorkflowFeignClient workflowFeignClient;
@Autowired
RedisUtils redisUtils; @Autowired
RedisUtils redisUtils;
@Autowired
IdxFeginService idxFeginService; @Autowired
@Autowired IdxFeginService idxFeginService;
RegionalCompaniesMapper regionalCompaniesMapper; @Autowired
@Autowired RegionalCompaniesMapper regionalCompaniesMapper;
IPowerStationService powerStationService; @Autowired
@Autowired IPowerStationService powerStationService;
ToDoTasksMapper toDoTasksMapper; @Autowired
@Autowired ToDoTasksMapper toDoTasksMapper;
UserMessageMapper userMessageMapper; @Autowired
@Value("${power.station.examine.pageId}") UserMessageMapper userMessageMapper;
private long pageId; @Value("${power.station.examine.pageId}")
@Autowired private long pageId;
protected EmqKeeper emqKeeper; @Autowired
@Value("${power.station.examine.planId}") protected EmqKeeper emqKeeper;
private String planId; @Value("${power.station.examine.planId}")
private String planId;
private static final String regionRedis="app_region_redis";
private static final String OPERATION_TYPE_SUBMIT="submit"; private static final String regionRedis = "app_region_redis";
private static final String OPERATION_TYPE_APPLY="apply"; private static final String OPERATION_TYPE_SUBMIT = "submit";
private static final String IDX_REQUEST_STATE="200"; private static final String OPERATION_TYPE_APPLY = "apply";
@Autowired private static final String IDX_REQUEST_STATE = "200";
PersonnelBusinessMapper personnelBusinessMapper; @Autowired
@Autowired PersonnelBusinessMapper personnelBusinessMapper;
PeasantHouseholdMapper peasantHouseholdMapper; @Autowired
PeasantHouseholdMapper peasantHouseholdMapper;
@Autowired
WorkOrderMapper workOrderMapper; @Autowired
@Autowired WorkOrderMapper workOrderMapper;
HygfOnGridMapper hygfOnGridMapper; @Autowired
@Autowired HygfOnGridMapper hygfOnGridMapper;
ConstructionRecordsServiceImpl constructionRecordsServiceImpl; @Autowired
@Autowired ConstructionRecordsServiceImpl constructionRecordsServiceImpl;
ConstructionRecordsMapper constructionRecordsMapper; @Autowired
@Autowired ConstructionRecordsMapper constructionRecordsMapper;
BasicGridAcceptanceMapper basicGridAcceptanceMapper; @Autowired
BasicGridAcceptanceMapper basicGridAcceptanceMapper;
@Autowired
SurveyInformationMapper surveyInformationMapper; @Autowired
@Autowired SurveyInformationMapper surveyInformationMapper;
PowerStationConstructionDataMapper powerStationConstructionDataMapper; @Autowired
@Autowired PowerStationConstructionDataMapper powerStationConstructionDataMapper;
PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper; @Autowired
@Autowired PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper;
WorkOrderPowerStationMapper workOrderPowerStationMapper; @Autowired
@Autowired WorkOrderPowerStationMapper workOrderPowerStationMapper;
AmosRequestContext requestContext; @Autowired
AmosRequestContext requestContext;
@Autowired
WorkflowImpl workflow; @Autowired
WorkflowImpl workflow;
/**
* 分页查询 /**
*/ * 分页查询
public Page<SurveyInformationDto> queryForSurveyInformationPage(Page<SurveyInformationDto> page) { */
return this.queryForPage(page, "rec_date", false); public Page<SurveyInformationDto> queryForSurveyInformationPage(Page<SurveyInformationDto> page) {
} return this.queryForPage(page, "rec_date", false);
}
/**
* 列表查询 示例 /**
*/ * 列表查询 示例
public List<SurveyInformationDto> queryForSurveyInformationList() { */
return this.queryForList("" , false); public List<SurveyInformationDto> queryForSurveyInformationList() {
} return this.queryForList("", false);
}
@Transactional
public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto,String operationType) { @Transactional
try { public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto, String operationType) {
try {
JSONArray regionName = getRegionName(); JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class); List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
// 更新勘察基本信息
//更新勘察基本信息 SurveyInformation surveyInformation = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyInformation(),
SurveyInformation surveyInformation = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyInformation(), SurveyInformation.class); SurveyInformation.class);
surveyInformation.setReview(0); surveyInformation.setReview(0);
if(OPERATION_TYPE_APPLY.equals(operationType) && null == surveyInformation.getCreatorTime()){ if (OPERATION_TYPE_APPLY.equals(operationType) && null == surveyInformation.getCreatorTime()) {
surveyInformation.setCreatorTime(new Date()); surveyInformation.setCreatorTime(new Date());
} }
this.saveOrUpdate(surveyInformation); this.saveOrUpdate(surveyInformation);
//更新扩展信息 // 更新扩展信息
ExtendedInformation extendedInformation = BeanDtoUtils.convert(surveyInfoAllDto.getExtendedInformation(), ExtendedInformation.class); ExtendedInformation extendedInformation = BeanDtoUtils.convert(surveyInfoAllDto.getExtendedInformation(),
extendedInformation.setSurveyInformationId(surveyInformation.getSequenceNbr()); ExtendedInformation.class);
extendedInformationService.saveOrUpdate(extendedInformation); extendedInformation.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
//更新勘察明细信息 extendedInformationService.saveOrUpdate(extendedInformation, new LambdaQueryWrapper<ExtendedInformation>()
SurveyDetailsDto oldSurveyDetails = surveyInfoAllDto.getSurveyDetails(); .eq(ExtendedInformation::getSurveyInformationId, surveyInformation.getSequenceNbr()));
SurveyDetails surveyDetails = BeanDtoUtils.convert(oldSurveyDetails, SurveyDetails.class); //extendedInformationService.saveOrUpdate(extendedInformation);
surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr());
surveyDetailsService.saveOrUpdate(surveyDetails); // 更新勘察明细信息
SurveyDetailsDto oldSurveyDetails = surveyInfoAllDto.getSurveyDetails();
//更新商务信息 SurveyDetails surveyDetails = BeanDtoUtils.convert(oldSurveyDetails, SurveyDetails.class);
CommercialDto oldCommercial = surveyInfoAllDto.getCommercial(); surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr());
Commercial commercial = BeanDtoUtils.convert(oldCommercial, Commercial.class); // 避免生成多份数据
// 处理省市县 surveyDetailsService.saveOrUpdate(surveyDetails, new LambdaQueryWrapper<SurveyDetails>()
String paddressName = ""; .eq(SurveyDetails::getSurveyInformationId, surveyInformation.getSequenceNbr()));
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) { //surveyDetailsService.saveOrUpdate(surveyDetails);
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) { // 更新商务信息
paddressName = paddressName + re.getRegionName() + "/"; CommercialDto oldCommercial = surveyInfoAllDto.getCommercial();
} Commercial commercial = BeanDtoUtils.convert(oldCommercial, Commercial.class);
} // 处理省市县
} String paddressName = "";
commercial.setProjectAddressName(paddressName.substring(0, paddressName.length() - 1)); for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
commercial.setSurveyInformationId(surveyInformation.getSequenceNbr()); for (RegionModel re : list) {
commercialService.saveOrUpdate(commercial); if (re.getRegionCode().equals(Integer.valueOf(reg))) {
//勘察后,更新状态 paddressName = paddressName + re.getRegionName() + "/";
QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>(); }
peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformation.getSequenceNbr()); }
PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper); }
commercial.setProjectAddressName(paddressName.substring(0, paddressName.length() - 1));
//更新资料归档信息 commercial.setSurveyInformationId(surveyInformation.getSequenceNbr());
Information information = BeanDtoUtils.convert(surveyInfoAllDto.getInformation(), Information.class); // 避免生成多份数据
information.setHouseProve(null == commercial ?null :(CollectionUtil.isNotEmpty(commercial.getRealEstateLegal())? commercial.getRealEstateLegal():null)); commercialService.saveOrUpdate(commercial, new LambdaQueryWrapper<Commercial>()
information.setCardFile( null == commercial ?null:(CollectionUtil.isNotEmpty(commercial.getIdCardCredit())? commercial.getIdCardCredit():null)); .eq(Commercial::getSurveyInformationId, surveyInformation.getSequenceNbr()));
information.setCardFile(commercial.getAgentLegal()); //commercialService.saveOrUpdate(commercial);
information.setArchivesNumber(this.getNo(CodeEnum.档案.getCode(),peasantHousehold.getRegionalCompaniesSeq())); // 勘察后,更新状态
information.setFileNumber(this.getNo(CodeEnum.文件.getCode(),peasantHousehold.getRegionalCompaniesSeq())); QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
information.setSurveyInformationId(surveyInformation.getSequenceNbr()); peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformation.getSequenceNbr());
informationService.saveOrUpdate(information); PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper()
.selectOne(peasantHouseholdQueryWrapper);
peasantHousehold.setOwnersName(surveyInfoAllDto.getSurveyInformation().getOwnersName()); // 更新资料归档信息
peasantHousehold.setTelephone(surveyInfoAllDto.getSurveyInformation().getTelephone()); Information information = BeanDtoUtils.convert(surveyInfoAllDto.getInformation(), Information.class);
peasantHousehold.setIdCard(surveyInfoAllDto.getSurveyInformation().getIdCard()); information.setHouseProve(null == commercial ? null
peasantHousehold.setMailbox(surveyInfoAllDto.getSurveyInformation().getMailbox()); : (CollectionUtil.isNotEmpty(commercial.getRealEstateLegal()) ? commercial.getRealEstateLegal()
peasantHousehold.setProjectAddress(surveyInfoAllDto.getSurveyInformation().getProjectAddress()); : null));
peasantHousehold.setProjectAddressDetail(surveyInfoAllDto.getSurveyInformation().getProjectAddressDetail()); information.setCardFile(null == commercial ? null
peasantHousehold.setPermanentAddress(surveyInfoAllDto.getSurveyInformation().getPermanentAddress()); : (CollectionUtil.isNotEmpty(commercial.getIdCardCredit()) ? commercial.getIdCardCredit() : null));
peasantHousehold.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail()); information.setCardFile(commercial.getAgentLegal());
peasantHousehold.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail()); information
.setArchivesNumber(this.getNo(CodeEnum.档案.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
// 处理项目地址 information.setFileNumber(this.getNo(CodeEnum.文件.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
String projectAddressName = ""; information.setSurveyInformationId(surveyInformation.getSequenceNbr());
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
for (RegionModel re : list) { // 避免生成多份数据
if (re.getRegionCode().equals(Integer.valueOf(reg))) { informationService.saveOrUpdate(information, new LambdaQueryWrapper<Information>()
projectAddressName = projectAddressName + re.getRegionName() + "/"; .eq(Information::getSurveyInformationId, surveyInformation.getSequenceNbr()));
} //informationService.saveOrUpdate(information);
}
} peasantHousehold.setOwnersName(surveyInfoAllDto.getSurveyInformation().getOwnersName());
peasantHousehold.setProjectAddressName(projectAddressName.substring(0, projectAddressName.length() - 1)); peasantHousehold.setTelephone(surveyInfoAllDto.getSurveyInformation().getTelephone());
//常住地址 peasantHousehold.setIdCard(surveyInfoAllDto.getSurveyInformation().getIdCard());
String permanentAddressName = ""; peasantHousehold.setMailbox(surveyInfoAllDto.getSurveyInformation().getMailbox());
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getPermanentAddress()) { peasantHousehold.setProjectAddress(surveyInfoAllDto.getSurveyInformation().getProjectAddress());
for (RegionModel re : list) { peasantHousehold.setProjectAddressDetail(surveyInfoAllDto.getSurveyInformation().getProjectAddressDetail());
if (re.getRegionCode().equals(Integer.valueOf(reg))) { peasantHousehold.setPermanentAddress(surveyInfoAllDto.getSurveyInformation().getPermanentAddress());
permanentAddressName = permanentAddressName + re.getRegionName() + "/"; peasantHousehold
} .setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
} peasantHousehold
} .setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
peasantHousehold.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1));
// 处理项目地址
if(OPERATION_TYPE_SUBMIT.equals(operationType)){ String projectAddressName = "";
// peasantHousehold.setSurveyOrNot(1); for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
}else if(OPERATION_TYPE_APPLY.equals(operationType)){ for (RegionModel re : list) {
// 提交审核 if (re.getRegionCode().equals(Integer.valueOf(reg))) {
submitExamine(peasantHousehold); projectAddressName = projectAddressName + re.getRegionName() + "/";
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>(); }
wrapper.eq(ToDoTasks::getType, TaskTypeStationEnum.电站勘察.getCode()); }
wrapper.eq(ToDoTasks::getState, "待办"); }
wrapper.eq(ToDoTasks::getBusinessId, peasantHousehold.getSequenceNbr()); peasantHousehold.setProjectAddressName(projectAddressName.substring(0, projectAddressName.length() - 1));
ToDoTasks doTasks= toDoTasksMapper.selectOne(wrapper); // 常住地址
if(doTasks!=null){ String permanentAddressName = "";
doTasks.setState("已办"); for (Integer reg : surveyInfoAllDto.getSurveyInformation().getPermanentAddress()) {
doTasks.setCompleteTime(new Date()); for (RegionModel re : list) {
toDoTasksMapper.updateById(doTasks); if (re.getRegionCode().equals(Integer.valueOf(reg))) {
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(doTasks).getBytes(), 2 ,false); permanentAddressName = permanentAddressName + re.getRegionName() + "/";
}
UserMessage userMessage= new UserMessage( doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName()+"已完成", doTasks.getAmosOrgCode()); }
userMessageMapper.insert(userMessage); }
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false); peasantHousehold
.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1));
}
} if (OPERATION_TYPE_SUBMIT.equals(operationType)) {
peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold); // peasantHousehold.setSurveyOrNot(1);
} else if (OPERATION_TYPE_APPLY.equals(operationType)) {
// 提交审核
submitExamine(peasantHousehold);
}catch (Exception e){ LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
e.printStackTrace(); wrapper.eq(ToDoTasks::getType, TaskTypeStationEnum.电站勘察.getCode());
throw new BadRequest("系统异常"); wrapper.eq(ToDoTasks::getState, "待办");
} wrapper.eq(ToDoTasks::getBusinessId, peasantHousehold.getSequenceNbr());
ToDoTasks doTasks = toDoTasksMapper.selectOne(wrapper);
return surveyInfoAllDto; if (doTasks != null) {
} doTasks.setState("已办");
doTasks.setCompleteTime(new Date());
public String getNo(String type,Long sequenceNbr) { toDoTasksMapper.updateById(doTasks);
RegionalCompanies da= regionalCompaniesMapper.selectRegionName(sequenceNbr); emqKeeper.getMqttClient().publish("TASK_MESSAGE", JSON.toJSONString(doTasks).getBytes(), 2, false);
if(da.getCompanyCode()==null||da.getCompanyCode().isEmpty()){
throw new BadRequest("区域公司编号为空, 请设置编号"); UserMessage userMessage = new UserMessage(doTasks.getType(), doTasks.getBusinessId(),
} doTasks.getAmosUserId(), new Date(), doTasks.getTaskName() + "已完成",
if(da.getRegionalAddress()==null||da.getRegionalAddress().isEmpty()){ doTasks.getAmosOrgCode());
throw new BadRequest("区域公司省市区为空, 请设置省市区"); userMessageMapper.insert(userMessage);
} emqKeeper.getMqttClient().publish("MY_MESSAGE", JSON.toJSONString(userMessage).getBytes(), 2,
String code= NumberUtil.getCode(type,da.getCompanyCode(),da.getRegionalAddress()); false);
return code;
} }
}
private void submitExamine(PeasantHousehold peasantHousehold) { peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold);
} catch (Exception e) {
e.printStackTrace();
throw new BadRequest("系统异常");
PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()), PowerStationProcessStateEnum.作废.getCode()); }
String taskId = null; return surveyInfoAllDto;
Map<String, Object> objectMap = new HashMap<>(1); }
objectMap.put("describe", "经销商已上传信息");
public String getNo(String type, Long sequenceNbr) {
// 保存并审核 RegionalCompanies da = regionalCompaniesMapper.selectRegionName(sequenceNbr);
try { if (da.getCompanyCode() == null || da.getCompanyCode().isEmpty()) {
throw new BadRequest("区域公司编号为空, 请设置编号");
}
BasicGridAcceptance basicGridAcceptance=new BasicGridAcceptance(); if (da.getRegionalAddress() == null || da.getRegionalAddress().isEmpty()) {
if (ObjectUtils.isNotEmpty(powerStation)) { throw new BadRequest("区域公司省市区为空, 请设置省市区");
// 工作流执行一步 }
// taskId = powerStation.getTaskId(); String code = NumberUtil.getCode(type, da.getCompanyCode(), da.getRegionalAddress());
StandardDto standardDto = new StandardDto(); return code;
standardDto.setResult("0"); }
standardDto.setTaskId(powerStation.getFlowTaskId());
VariableDto variable = new VariableDto(); private void submitExamine(PeasantHousehold peasantHousehold) {
variable.setApprovalStatus("0");
standardDto.setVariable(variable); PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()),
workflow.standard(basicGridAcceptance, standardDto, requestContext.getUserId()); PowerStationProcessStateEnum.作废.getCode());
} else {
// 第一步启动工作流 String taskId = null;
//发起工作流 Map<String, Object> objectMap = new HashMap<>(1);
// 调用工作流执行第一个节点 objectMap.put("describe", "经销商已上传信息");
ProcessDto processDto = new ProcessDto();
processDto.setBusinessKey(String.valueOf(peasantHousehold.getSequenceNbr())); // 保存并审核
processDto.setProcessDefinitionKey("hygf_10001"); try {
StartProcessDto startProcessDto = new StartProcessDto();
List<ProcessDto> process=new ArrayList<>(); BasicGridAcceptance basicGridAcceptance = new BasicGridAcceptance();
process.add(processDto); if (ObjectUtils.isNotEmpty(powerStation)) {
startProcessDto.setProcess(process); // 工作流执行一步
workflow.startProcess(basicGridAcceptance, startProcessDto,requestContext.getUserId()); // taskId = powerStation.getTaskId();
powerStation=new PowerStation(); StandardDto standardDto = new StandardDto();
} standardDto.setResult("0");
peasantHousehold.setSurveyOrNot(2); standardDto.setTaskId(powerStation.getFlowTaskId());
peasantHousehold.setReview(1); VariableDto variable = new VariableDto();
// 插入记录表 variable.setApprovalStatus("0");
powerStation.setPlanInstanceId(planId); standardDto.setVariable(variable);
powerStation.setPowerStationCode(peasantHousehold.getPeasantHouseholdNo()); workflow.standard(basicGridAcceptance, standardDto, requestContext.getUserId());
powerStation.setOwnersName(peasantHousehold.getOwnersName()); } else {
powerStation.setProjectAddress(peasantHousehold.getProjectAddressName()); // 第一步启动工作流
powerStation.setPeasantHouseholdId(String.valueOf(peasantHousehold.getSequenceNbr())); // 发起工作流
powerStation.setProcessStatus(PowerStationProcessStateEnum.进行中.getName()); // 调用工作流执行第一个节点
powerStation.setServiceAgent(peasantHousehold.getDeveloperName()); ProcessDto processDto = new ProcessDto();
// 获取流程信息 processDto.setBusinessKey(String.valueOf(peasantHousehold.getSequenceNbr()));
powerStation.setTaskId(basicGridAcceptance.getNextTaskId()); processDto.setProcessDefinitionKey("hygf_10001");
powerStation.setProcessInstanceId(basicGridAcceptance.getInstanceId()); StartProcessDto startProcessDto = new StartProcessDto();
powerStation.setFlowTaskId(basicGridAcceptance.getNextTaskId()); List<ProcessDto> process = new ArrayList<>();
powerStation.setNodeRole(basicGridAcceptance.getNextExecutorIds()); process.add(processDto);
powerStation.setNodeRouting(PowerStationEnum.getNodeByKey(basicGridAcceptance.getNextNodeKey())); startProcessDto.setProcess(process);
powerStation.setNextProcessNode(PowerStationNodeEnum.设计审核.getCode()); workflow.startProcess(basicGridAcceptance, startProcessDto, requestContext.getUserId());
powerStation.setPromoter(basicGridAcceptance.getPromoter()); powerStation = new PowerStation();
powerStation.setNextExecuteUserIds(basicGridAcceptance.getNextExecuteUserIds()); }
powerStation.setNextNodeName(basicGridAcceptance.getNextNodeName()); peasantHousehold.setSurveyOrNot(2);
peasantHousehold.setReview(1);
powerStationService.savePowerStation(powerStation, true,powerStation.getOwnersName(),""); // 插入记录表
// powerStation.setPlanInstanceId(planId);
peasantHousehold.setConstructionState(ArrivalStateeEnum.勘察中.getCode()); powerStation.setPowerStationCode(peasantHousehold.getPeasantHouseholdNo());
LambdaUpdateWrapper<PeasantHousehold> up =new LambdaUpdateWrapper<>(); powerStation.setOwnersName(peasantHousehold.getOwnersName());
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.勘察中.getCode()); powerStation.setProjectAddress(peasantHousehold.getProjectAddressName());
long idsk= peasantHousehold.getSequenceNbr(); powerStation.setPeasantHouseholdId(String.valueOf(peasantHousehold.getSequenceNbr()));
up.eq(PeasantHousehold::getSequenceNbr,idsk); powerStation.setProcessStatus(PowerStationProcessStateEnum.进行中.getName());
peasantHouseholdMapper.update(null,up); powerStation.setServiceAgent(peasantHousehold.getDeveloperName());
// 获取流程信息
powerStation.setTaskId(basicGridAcceptance.getNextTaskId());
powerStation.setProcessInstanceId(basicGridAcceptance.getInstanceId());
} catch (Exception e){ powerStation.setFlowTaskId(basicGridAcceptance.getNextTaskId());
e.printStackTrace(); powerStation.setNodeRole(basicGridAcceptance.getNextExecutorIds());
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!"); powerStation.setNodeRouting(PowerStationEnum.getNodeByKey(basicGridAcceptance.getNextNodeKey()));
} powerStation.setNextProcessNode(PowerStationNodeEnum.设计审核.getCode());
powerStation.setPromoter(basicGridAcceptance.getPromoter());
powerStation.setNextExecuteUserIds(basicGridAcceptance.getNextExecuteUserIds());
powerStation.setNextNodeName(basicGridAcceptance.getNextNodeName());
powerStationService.savePowerStation(powerStation, true, powerStation.getOwnersName(), "");
//
peasantHousehold.setConstructionState(ArrivalStateeEnum.勘察中.getCode());
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.勘察中.getCode());
long idsk = peasantHousehold.getSequenceNbr();
up.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up);
} catch (Exception e) {
e.printStackTrace();
throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!");
}
// PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()), PowerStationProcessStateEnum.作废.getCode()); // PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()), PowerStationProcessStateEnum.作废.getCode());
// //
...@@ -402,266 +417,285 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -402,266 +417,285 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
// e.printStackTrace(); // e.printStackTrace();
// throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!"); // throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!");
// } // }
} }
public SurveyInfoAllDto querySurveyInfo(String surveyInformationId,String peasantHouseholdId,String processInstanceId,AgencyUserModel userInfo) { public SurveyInfoAllDto querySurveyInfo(String surveyInformationId, String peasantHouseholdId,
String processInstanceId, AgencyUserModel userInfo) {
SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
PeasantHousehold peasantHousehold = new PeasantHousehold(); SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
if(!StringUtils.isEmpty(peasantHouseholdId)){ PeasantHousehold peasantHousehold = new PeasantHousehold();
LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>(); if (!StringUtils.isEmpty(peasantHouseholdId)) {
peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId); LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>();
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper); peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId()); peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper);
}else { surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId());
QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>(); } else {
peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformationId); QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper); peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformationId);
} peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper);
//勘察基本信息 }
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>(); // 勘察基本信息
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId); LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
SurveyInformation surveyInformation = this.baseMapper.selectOne(queryWrapper); queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class)); SurveyInformation surveyInformation = this.baseMapper.selectOne(queryWrapper);
//农户信息 surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
// 农户信息
//获取用户所在经销商单位 // 获取用户所在经销商单位
UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId()); UserUnitInformationDto userUnitInformationDto = personnelBusinessMapper
.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName()); BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode()); surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName());
surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId()); surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode());
if(surveyInfoAllDto.getSurveyInformation().getSalesmanId()==null){ surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId());
surveyInfoAllDto.getSurveyInformation().setSalesmanId(peasantHousehold.getDeveloperUserId()); if (surveyInfoAllDto.getSurveyInformation().getSalesmanId() == null) {
surveyInfoAllDto.getSurveyInformation().setSalesman(peasantHousehold.getDeveloper()); surveyInfoAllDto.getSurveyInformation().setSalesmanId(peasantHousehold.getDeveloperUserId());
surveyInfoAllDto.getSurveyInformation().setCreator(peasantHousehold.getDeveloper()); surveyInfoAllDto.getSurveyInformation().setSalesman(peasantHousehold.getDeveloper());
} surveyInfoAllDto.getSurveyInformation().setCreator(peasantHousehold.getDeveloper());
}
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation().setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/"))); if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
} surveyInfoAllDto.getSurveyInformation()
if(!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())){ .setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
surveyInfoAllDto.getSurveyInformation().setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/"))); }
} if (!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())) {
surveyInfoAllDto.getSurveyInformation()
if(peasantHousehold.getPermanentAddress() ==null){ .setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress()); }
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
} if (peasantHousehold.getPermanentAddress() == null) {
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr()); }
//制单时间
surveyInfoAllDto.getSurveyInformation().setCreatorTime(surveyInformation.getCreatorTime()); surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
// 制单时间
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>(); surveyInfoAllDto.getSurveyInformation().setCreatorTime(surveyInformation.getCreatorTime());
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper); QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
if(surveyDetails == null){ SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
}else { if (surveyDetails == null) {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class)); surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
} } else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>(); }
informationQueryWrapper.eq("survey_information_id", surveyInformationId);
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper); QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
informationQueryWrapper.eq("survey_information_id", surveyInformationId);
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>(); Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
commercialQueryWrapper.eq("survey_information_id", surveyInformationId);
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper); QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
if(commercial==null){ commercialQueryWrapper.eq("survey_information_id", surveyInformationId);
commercial=new Commercial(); Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
} if (commercial == null) {
commercial = new Commercial();
if(information == null){ }
surveyInfoAllDto.setInformation(new InformationDto());
}else { if (information == null) {
information.setHouseProve(null == commercial ?new ArrayList<>() :(CollectionUtil.isNotEmpty(commercial.getRealEstateLegal())? commercial.getRealEstateLegal():new ArrayList<>())); surveyInfoAllDto.setInformation(new InformationDto());
information.setCardFile( null == commercial ?new ArrayList<>() :(CollectionUtil.isNotEmpty(commercial.getIdCardCredit())? commercial.getIdCardCredit():new ArrayList<>())); } else {
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class)); information.setHouseProve(null == commercial ? new ArrayList<>()
} : (CollectionUtil.isNotEmpty(commercial.getRealEstateLegal()) ? commercial.getRealEstateLegal()
: new ArrayList<>()));
commercial.setApplicant(peasantHousehold.getOwnersName()); information.setCardFile(null == commercial ? new ArrayList<>()
commercial.setIdCard(peasantHousehold.getIdCard()); : (CollectionUtil.isNotEmpty(commercial.getIdCardCredit()) ? commercial.getIdCardCredit()
commercial.setTelephone(peasantHousehold.getTelephone()); : new ArrayList<>()));
commercial.setProjectAddress(peasantHousehold.getProjectAddress()); surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
commercial.setProjectAddressName(peasantHousehold.getProjectAddressName()); }
commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail());
commercial.setLegalContactTelephone(peasantHousehold.getTelephone()); commercial.setApplicant(peasantHousehold.getOwnersName());
commercial.setIdCard(peasantHousehold.getIdCard());
List<Object> list = new ArrayList<>(); commercial.setTelephone(peasantHousehold.getTelephone());
if (null != surveyDetails){ commercial.setProjectAddress(peasantHousehold.getProjectAddress());
if (CollectionUtil.isNotEmpty(surveyDetails.getSurroundingHouseSurvey())){ commercial.setProjectAddressName(peasantHousehold.getProjectAddressName());
list.addAll(surveyDetails.getSurroundingHouseSurvey()); commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail());
} commercial.setLegalContactTelephone(peasantHousehold.getTelephone());
if (CollectionUtil.isNotEmpty(surveyDetails.getOverallHousingSurvey())){
list.addAll(surveyDetails.getOverallHousingSurvey()); List<Object> list = new ArrayList<>();
} if (null != surveyDetails) {
if (CollectionUtil.isNotEmpty(surveyDetails.getPanoramaSurvey())){ if (CollectionUtil.isNotEmpty(surveyDetails.getSurroundingHouseSurvey())) {
list.addAll(surveyDetails.getPanoramaSurvey()); list.addAll(surveyDetails.getSurroundingHouseSurvey());
} }
if (CollectionUtil.isNotEmpty(surveyDetails.getPlanSketchSurvey())){ if (CollectionUtil.isNotEmpty(surveyDetails.getOverallHousingSurvey())) {
list.addAll(surveyDetails.getPlanSketchSurvey()); list.addAll(surveyDetails.getOverallHousingSurvey());
} }
if (CollectionUtil.isNotEmpty(surveyDetails.getAzimuthSurvey())){ if (CollectionUtil.isNotEmpty(surveyDetails.getPanoramaSurvey())) {
list.addAll(surveyDetails.getAzimuthSurvey()); list.addAll(surveyDetails.getPanoramaSurvey());
} }
} if (CollectionUtil.isNotEmpty(surveyDetails.getPlanSketchSurvey())) {
commercial.setSurveyPhotosWeb(list); list.addAll(surveyDetails.getPlanSketchSurvey());
}
if (CollectionUtil.isNotEmpty(surveyDetails.getAzimuthSurvey())) {
if(information == null){ list.addAll(surveyDetails.getAzimuthSurvey());
CommercialDto commercialDto = BeanDtoUtils.convert(commercial, CommercialDto.class); }
commercialDto.setType("zrr"); }
commercialDto.setLegalType("zjdnhw"); commercial.setSurveyPhotosWeb(list);
surveyInfoAllDto.setCommercial(commercialDto);
}else { if (information == null) {
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class)); CommercialDto commercialDto = BeanDtoUtils.convert(commercial, CommercialDto.class);
if(commercial !=null && !StringUtils.isEmpty(commercial.getProjectAddressName())){ commercialDto.setType("zrr");
surveyInfoAllDto.getCommercial().setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/"))); commercialDto.setLegalType("zjdnhw");
} surveyInfoAllDto.setCommercial(commercialDto);
} } else {
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>(); if (commercial != null && !StringUtils.isEmpty(commercial.getProjectAddressName())) {
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId); surveyInfoAllDto.getCommercial()
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper().selectOne(extendedInformationQueryWrapper); .setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
if(information == null){ }
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto()); }
}else {
surveyInfoAllDto.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class)); QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
} extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper()
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>(); .selectOne(extendedInformationQueryWrapper);
designInformationQueryWrapper.eq("peasant_household_id", peasantHousehold.getSequenceNbr()); if (information == null) {
DesignInformation designInformation = designInformationService.getBaseMapper().selectOne(designInformationQueryWrapper); surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
if(designInformation == null){ } else {
surveyInfoAllDto.setDesignInformation(new DesignInformationDto()); surveyInfoAllDto
}else { .setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
surveyInfoAllDto.setDesignInformation(BeanDtoUtils.convert(designInformation, DesignInformationDto.class)); }
}
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.eq("peasant_household_id", peasantHousehold.getSequenceNbr());
LambdaQueryWrapper<WorkOrderPowerStation> up1=new LambdaQueryWrapper(); DesignInformation designInformation = designInformationService.getBaseMapper()
up1.eq(WorkOrderPowerStation::getPeasantHouseholdId,peasantHouseholdId); .selectOne(designInformationQueryWrapper);
WorkOrderPowerStation workOrderPowerStation= workOrderPowerStationMapper.selectOne(up1); if (designInformation == null) {
if(workOrderPowerStation!=null){ surveyInfoAllDto.setDesignInformation(new DesignInformationDto());
Long workOrderId=workOrderPowerStation.getWorkOrderId(); } else {
Long workOrderPowerStationId=workOrderPowerStation.getSequenceNbr(); surveyInfoAllDto.setDesignInformation(BeanDtoUtils.convert(designInformation, DesignInformationDto.class));
}
//派工单信息
LambdaQueryWrapper<WorkOrder> upl=new LambdaQueryWrapper(); LambdaQueryWrapper<WorkOrderPowerStation> up1 = new LambdaQueryWrapper();
upl.eq(WorkOrder::getSequenceNbr,workOrderId); up1.eq(WorkOrderPowerStation::getPeasantHouseholdId, peasantHouseholdId);
WorkOrder workOrder= workOrderMapper.selectOne(upl); WorkOrderPowerStation workOrderPowerStation = workOrderPowerStationMapper.selectOne(up1);
if (workOrderPowerStation != null) {
//施工信息 Long workOrderId = workOrderPowerStation.getWorkOrderId();
LambdaQueryWrapper<PowerStationConstructionData> up2=new LambdaQueryWrapper(); Long workOrderPowerStationId = workOrderPowerStation.getSequenceNbr();
up2.eq(PowerStationConstructionData::getWorkOrderId,workOrderId);
up2.eq(PowerStationConstructionData::getWorkOrderPowerStationId,workOrderPowerStationId); // 派工单信息
PowerStationConstructionData powerStationConstructionData=powerStationConstructionDataMapper.selectOne(up2); LambdaQueryWrapper<WorkOrder> upl = new LambdaQueryWrapper();
upl.eq(WorkOrder::getSequenceNbr, workOrderId);
//工程信息 WorkOrder workOrder = workOrderMapper.selectOne(upl);
LambdaQueryWrapper<PowerStationEngineeringInfo> up3=new LambdaQueryWrapper(); // 施工信息
up3.eq(PowerStationEngineeringInfo::getWorkOrderId,workOrderId); LambdaQueryWrapper<PowerStationConstructionData> up2 = new LambdaQueryWrapper();
up3.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId,workOrderPowerStationId); up2.eq(PowerStationConstructionData::getWorkOrderId, workOrderId);
PowerStationEngineeringInfo powerStationEngineeringInfo=powerStationEngineeringInfoMapper.selectOne(up3); up2.eq(PowerStationConstructionData::getWorkOrderPowerStationId, workOrderPowerStationId);
if(powerStationConstructionData!=null){ PowerStationConstructionData powerStationConstructionData = powerStationConstructionDataMapper
powerStationEngineeringInfo=powerStationEngineeringInfo!=null?powerStationEngineeringInfo:new PowerStationEngineeringInfo(); .selectOne(up2);
powerStationEngineeringInfo.setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo());
powerStationEngineeringInfo.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo()); // 工程信息
powerStationEngineeringInfo.setConstructionCollectorBoxInfo(powerStationConstructionData.getConstructionCollectorBoxInfo());
powerStationEngineeringInfo.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo()); LambdaQueryWrapper<PowerStationEngineeringInfo> up3 = new LambdaQueryWrapper();
powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager()); up3.eq(PowerStationEngineeringInfo::getWorkOrderId, workOrderId);
powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone()); up3.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId, workOrderPowerStationId);
powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager()); PowerStationEngineeringInfo powerStationEngineeringInfo = powerStationEngineeringInfoMapper.selectOne(up3);
powerStationEngineeringInfo.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone()); if (powerStationConstructionData != null) {
} powerStationEngineeringInfo = powerStationEngineeringInfo != null ? powerStationEngineeringInfo
//并网信息 : new PowerStationEngineeringInfo();
LambdaQueryWrapper<HygfOnGrid> up4=new LambdaQueryWrapper(); powerStationEngineeringInfo
up4.eq(HygfOnGrid::getWorkOrderId,workOrderId); .setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo());
up4.eq(HygfOnGrid::getWorkOrderPowerStationId,workOrderPowerStationId); powerStationEngineeringInfo
HygfOnGrid hygfOnGrid=hygfOnGridMapper.selectOne(up4); .setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid!=null?hygfOnGrid:new HygfOnGrid()); powerStationEngineeringInfo.setConstructionCollectorBoxInfo(
surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData!=null?powerStationConstructionData:new PowerStationConstructionData()); powerStationConstructionData.getConstructionCollectorBoxInfo());
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo!=null?powerStationEngineeringInfo:new PowerStationEngineeringInfo()); powerStationEngineeringInfo
surveyInfoAllDto.setWorkOrder(workOrder!=null?workOrder:new WorkOrder()); .setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
}else{ powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager());
surveyInfoAllDto.setHygfOnGrid(new HygfOnGrid()); powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone());
surveyInfoAllDto.setPowerStationConstructionData(new PowerStationConstructionData()); powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager());
surveyInfoAllDto.setPowerStationEngineeringInfo(new PowerStationEngineeringInfo()); powerStationEngineeringInfo
surveyInfoAllDto.setWorkOrder(new WorkOrder()); .setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone());
} }
// 并网信息
LambdaQueryWrapper<HygfOnGrid> up4 = new LambdaQueryWrapper();
up4.eq(HygfOnGrid::getWorkOrderId, workOrderId);
if(!StringUtils.isEmpty(processInstanceId)){ up4.eq(HygfOnGrid::getWorkOrderPowerStationId, workOrderPowerStationId);
try { HygfOnGrid hygfOnGrid = hygfOnGridMapper.selectOne(up4);
Map<String, Object> flowLoggerMap = workflowFeignClient.getFlowLogger(processInstanceId).getResult(); surveyInfoAllDto.setHygfOnGrid(hygfOnGrid != null ? hygfOnGrid : new HygfOnGrid());
List<LinkedHashMap> flowLogger = (List<LinkedHashMap>) flowLoggerMap.get("flowLogger"); surveyInfoAllDto
if (flowLogger.size() > 0 ){ .setPowerStationConstructionData(powerStationConstructionData != null ? powerStationConstructionData
Collections.reverse(flowLogger); : new PowerStationConstructionData());
} surveyInfoAllDto
List<LinkedHashMap> flowLoggernew =new ArrayList<>(); .setPowerStationEngineeringInfo(powerStationEngineeringInfo != null ? powerStationEngineeringInfo
for (LinkedHashMap linkedHashMap : flowLogger) { : new PowerStationEngineeringInfo());
if(linkedHashMap.get("operateDate")!=null&&!linkedHashMap.get("operateDate").toString().isEmpty()){ surveyInfoAllDto.setWorkOrder(workOrder != null ? workOrder : new WorkOrder());
LinkedHashMap linke=new LinkedHashMap(); } else {
linke.put("approvalStatue",linkedHashMap.get("approvalStatue").toString()); surveyInfoAllDto.setHygfOnGrid(new HygfOnGrid());
//审核意见 surveyInfoAllDto.setPowerStationConstructionData(new PowerStationConstructionData());
List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>)linkedHashMap.get("approvalSuggestion"); surveyInfoAllDto.setPowerStationEngineeringInfo(new PowerStationEngineeringInfo());
if(approvalSuggestion!=null&&!approvalSuggestion.isEmpty()){ surveyInfoAllDto.setWorkOrder(new WorkOrder());
linke.put("approvalSuggestion",approvalSuggestion.get(0).get("message")); }
}
linke.put("taskName",linkedHashMap.get("taskName").toString()); if (!StringUtils.isEmpty(processInstanceId)) {
linke.put("operator",linkedHashMap.get("operator").toString()); try {
linke.put("operateDate",linkedHashMap.get("operateDate").toString()); Map<String, Object> flowLoggerMap = workflowFeignClient.getFlowLogger(processInstanceId).getResult();
flowLoggernew.add(linke); List<LinkedHashMap> flowLogger = (List<LinkedHashMap>) flowLoggerMap.get("flowLogger");
} if (flowLogger.size() > 0) {
} Collections.reverse(flowLogger);
LoggerDto loggerDto =new LoggerDto(); }
loggerDto.setLogger(flowLoggernew); List<LinkedHashMap> flowLoggernew = new ArrayList<>();
surveyInfoAllDto.setOrderTracking(loggerDto); for (LinkedHashMap linkedHashMap : flowLogger) {
} catch (Exception e){ if (linkedHashMap.get("operateDate") != null
e.printStackTrace(); && !linkedHashMap.get("operateDate").toString().isEmpty()) {
} LinkedHashMap linke = new LinkedHashMap();
} linke.put("approvalStatue", linkedHashMap.get("approvalStatue").toString());
return surveyInfoAllDto; // 审核意见
} List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>) linkedHashMap
.get("approvalSuggestion");
if (approvalSuggestion != null && !approvalSuggestion.isEmpty()) {
public JSONArray getRegionName(){ linke.put("approvalSuggestion", approvalSuggestion.get(0).get("message"));
JSONArray jsonArray = new JSONArray(); }
if (redisUtils.hasKey(regionRedis)) { linke.put("taskName", linkedHashMap.get("taskName").toString());
jsonArray= JSONArray.parseArray(redisUtils.get(regionRedis).toString()); linke.put("operator", linkedHashMap.get("operator").toString());
}else { linke.put("operateDate", linkedHashMap.get("operateDate").toString());
Collection<RegionModel> regionChild = new ArrayList<>(); flowLoggernew.add(linke);
RegionModel regionModel1 = new RegionModel(); }
regionChild.add(regionModel1); }
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L); LoggerDto loggerDto = new LoggerDto();
Collection<RegionModel> result = collectionFeignClientResult.getResult(); loggerDto.setLogger(flowLoggernew);
for (RegionModel regionModel : result) { surveyInfoAllDto.setOrderTracking(loggerDto);
if(regionModel.getChildren()!=null&&!regionModel.getChildren().isEmpty()){ } catch (Exception e) {
for (RegionModel child : regionModel.getChildren()) { e.printStackTrace();
if(child.getChildren()!=null&&!child.getChildren().isEmpty()){ }
for (RegionModel childChild : child.getChildren()) { }
jsonArray.add(childChild); return surveyInfoAllDto;
} }
child.setChildren(regionChild);
jsonArray.add(child); public JSONArray getRegionName() {
} JSONArray jsonArray = new JSONArray();
if (redisUtils.hasKey(regionRedis)) {
} jsonArray = JSONArray.parseArray(redisUtils.get(regionRedis).toString());
} } else {
Collection<RegionModel> regionChild = new ArrayList<>();
regionModel.setChildren(regionChild); RegionModel regionModel1 = new RegionModel();
jsonArray.add(regionModel); regionChild.add(regionModel1);
} FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient
.queryForTreeParent(610000L);
redisUtils.set(regionRedis,jsonArray); Collection<RegionModel> result = collectionFeignClientResult.getResult();
} for (RegionModel regionModel : result) {
return jsonArray; if (regionModel.getChildren() != null && !regionModel.getChildren().isEmpty()) {
} for (RegionModel child : regionModel.getChildren()) {
if (child.getChildren() != null && !child.getChildren().isEmpty()) {
for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild);
}
child.setChildren(regionChild);
jsonArray.add(child);
}
}
}
regionModel.setChildren(regionChild);
jsonArray.add(regionModel);
}
redisUtils.set(regionRedis, jsonArray);
}
return jsonArray;
}
} }
\ No newline at end of file
...@@ -33,322 +33,281 @@ import java.util.*; ...@@ -33,322 +33,281 @@ import java.util.*;
* @date 2024-01-02 * @date 2024-01-02
*/ */
@Service @Service
public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,WorkOrderMapper> implements IWorkOrderService { public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, WorkOrderMapper>
implements IWorkOrderService {
@Autowired
RegionalCompaniesMapper regionalCompaniesMapper; @Autowired
RegionalCompaniesMapper regionalCompaniesMapper;
@Autowired
WorkOrderMapper workOrderMapper; @Autowired
@Autowired WorkOrderMapper workOrderMapper;
WorkOrderPowerStationServiceImpl workOrderPowerStationServiceImpl; @Autowired
WorkOrderPowerStationServiceImpl workOrderPowerStationServiceImpl;
@Autowired
WorkOrderPowerStationMapper workOrderPowerStationMapper; @Autowired
@Autowired WorkOrderPowerStationMapper workOrderPowerStationMapper;
DesignInformationMapper designInformationMapper; @Autowired
@Autowired DesignInformationMapper designInformationMapper;
PowerStationConstructionDataServiceImpl powerStationConstructionDataService; @Autowired
PowerStationConstructionDataServiceImpl powerStationConstructionDataService;
@Autowired @Autowired
SurveyDetailsServiceImpl surveyDetailsService; SurveyDetailsServiceImpl surveyDetailsService;
@Autowired @Autowired
InformationServiceImpl informationService; InformationServiceImpl informationService;
@Autowired @Autowired
ExtendedInformationServiceImpl extendedInformationService; ExtendedInformationServiceImpl extendedInformationService;
@Autowired @Autowired
CommercialServiceImpl commercialService; CommercialServiceImpl commercialService;
@Autowired @Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl; PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired @Autowired
DesignInformationServiceImpl designInformationService; DesignInformationServiceImpl designInformationService;
@Autowired @Autowired
PersonnelBusinessMapper personnelBusinessMapper; PersonnelBusinessMapper personnelBusinessMapper;
@Autowired @Autowired
SurveyInformationMapper surveyInformationMapper; SurveyInformationMapper surveyInformationMapper;
@Autowired @Autowired
PowerStationConstructionDataMapper powerStationConstructionDataMapper; PowerStationConstructionDataMapper powerStationConstructionDataMapper;
@Autowired @Autowired
PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper; PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper;
@Autowired @Autowired
PowerStationEngineeringInfoServiceImpl powerStationEngineeringInfoService; PowerStationEngineeringInfoServiceImpl powerStationEngineeringInfoService;
@Autowired @Autowired
HygfOnGridMapper hygfOnGridMapper; HygfOnGridMapper hygfOnGridMapper;
@Autowired @Autowired
ConstructionRecordsServiceImpl constructionRecordsServiceImpl; ConstructionRecordsServiceImpl constructionRecordsServiceImpl;
@Autowired @Autowired
ConstructionRecordsMapper constructionRecordsMapper; ConstructionRecordsMapper constructionRecordsMapper;
@Autowired @Autowired
BasicGridAcceptanceMapper basicGridAcceptanceMapper; BasicGridAcceptanceMapper basicGridAcceptanceMapper;
@Autowired @Autowired
WorkflowFeignClient workflowFeignClient; WorkflowFeignClient workflowFeignClient;
@Autowired
@Autowired PeasantHouseholdMapper peasantHouseholdMapper;
PeasantHouseholdMapper peasantHouseholdMapper;
/**
/** * 分页查询
* 分页查询 */
*/ public Page<WorkOrderDto> queryForWorkOrderPage(Page<WorkOrderDto> page) {
public Page<WorkOrderDto> queryForWorkOrderPage(Page<WorkOrderDto> page) { return this.queryForPage(page, null, false);
return this.queryForPage(page, null, false); }
}
/**
/** * 列表查询 示例
* 列表查询 示例 */
*/ public List<WorkOrderDto> queryForWorkOrderList() {
public List<WorkOrderDto> queryForWorkOrderList() { return this.queryForList("", false);
return this.queryForList("" , false); }
}
@Transactional
public WorkOrder saveWorkOrder(WorkOrder model, UserUnitInformationDto userUnitInformationDto) {
// 保存派工单
RegionalCompanies regionalCompanies = regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId());
@Transactional String code = NumberUtil.getCode(CodeEnum.派工单.getCode(), regionalCompanies.getCompanyCode(),
public WorkOrder saveWorkOrder (WorkOrder model, UserUnitInformationDto userUnitInformationDto) { regionalCompanies.getRegionalAddress());
//保存派工单 model.setWorkOrderNum(code);
RegionalCompanies regionalCompanies= regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId()); model.setRegionCompanyName(regionalCompanies.getRegionalCompaniesName());
String code= NumberUtil.getCode(CodeEnum.派工单.getCode(),regionalCompanies.getCompanyCode(),regionalCompanies.getRegionalAddress()); model.setRegionCode(regionalCompanies.getRegionalCompaniesCode());
model.setWorkOrderNum(code); model.setWorkOrderStatus(WorkOrderEnum.待施工.getCode());
model.setRegionCompanyName(regionalCompanies.getRegionalCompaniesName()); model.setRegionAddress(regionalCompanies.getRegionalAddress());
model.setRegionCode(regionalCompanies.getRegionalCompaniesCode()); // 获取经销商单位信息
model.setWorkOrderStatus(WorkOrderEnum.待施工.getCode()); model.setAmosDealerId(userUnitInformationDto.getAmosDealerId());
model.setRegionAddress(regionalCompanies.getRegionalAddress()); model.setAmosDealerName(userUnitInformationDto.getAmosDealerName());
//获取经销商单位信息 model.setAmosDealerOrgCode(userUnitInformationDto.getAmosDealerOrgCode());
model.setAmosDealerId(userUnitInformationDto.getAmosDealerId());
model.setAmosDealerName(userUnitInformationDto.getAmosDealerName()); workOrderMapper.insert(model);
model.setAmosDealerOrgCode(userUnitInformationDto.getAmosDealerOrgCode()); // 保存派工单 电站信息
List<PeasantHousehold> peasantHouseholdId = model.getPeasantHouseholdId();
workOrderMapper.insert(model);
//保存派工单 电站信息 List<ConstructionRecords> constructionRecordlist = new ArrayList<>();
List<PeasantHousehold> peasantHouseholdId=model.getPeasantHouseholdId(); List<WorkOrderPowerStation> li = new ArrayList<>();
for (PeasantHousehold peasantHousehold : peasantHouseholdId) {
List<ConstructionRecords> constructionRecordlist=new ArrayList<>(); WorkOrderPowerStation workOrderPowerStation = new WorkOrderPowerStation();
List<WorkOrderPowerStation> li=new ArrayList<>(); workOrderPowerStation.setPeasantHouseholdId(peasantHousehold.getSequenceNbr());
for (PeasantHousehold peasantHousehold : peasantHouseholdId) { workOrderPowerStation.setWorkOrderId(model.getSequenceNbr());
WorkOrderPowerStation workOrderPowerStation=new WorkOrderPowerStation(); workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待施工.getCode());
workOrderPowerStation.setPeasantHouseholdId(peasantHousehold.getSequenceNbr()); li.add(workOrderPowerStation);
workOrderPowerStation.setWorkOrderId(model.getSequenceNbr());
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待施工.getCode()); }
li.add(workOrderPowerStation); workOrderPowerStationServiceImpl.saveBatch(li);
} for (WorkOrderPowerStation workOrderPowerStation : li) {
workOrderPowerStationServiceImpl.saveBatch(li); // 增加操作日志
ConstructionRecords da = new ConstructionRecords(workOrderPowerStation.getRecUserName(), "新建派工单",
for (WorkOrderPowerStation workOrderPowerStation : li) { new Date(), "", workOrderPowerStation.getWorkOrderId(), workOrderPowerStation.getSequenceNbr(),
//增加操作日志 workOrderPowerStation.getPeasantHouseholdId(), "");
ConstructionRecords da=new ConstructionRecords( constructionRecordlist.add(da);
workOrderPowerStation.getRecUserName(),
"新建派工单", }
new Date(), constructionRecordsServiceImpl.saveBatch(constructionRecordlist);
"",
workOrderPowerStation.getWorkOrderId(), return model;
workOrderPowerStation.getSequenceNbr(), }
workOrderPowerStation.getPeasantHouseholdId(),
""); @Transactional
constructionRecordlist.add(da); public WorkOrder updateWorkOrder(WorkOrder model, UserUnitInformationDto userUnitInformationDto) {
// 保存派工单
} RegionalCompanies regionalCompanies = regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId());
constructionRecordsServiceImpl.saveBatch(constructionRecordlist); model.setRegionCompanyName(regionalCompanies.getRegionalCompaniesName());
model.setRegionCode(regionalCompanies.getRegionalCompaniesCode());
model.setWorkOrderStatus(WorkOrderEnum.待施工.getCode());
return model; model.setRegionAddress(regionalCompanies.getRegionalAddress());
} // 获取经销商单位信息
@Transactional model.setAmosDealerId(userUnitInformationDto.getAmosDealerId());
public WorkOrder updateWorkOrder (WorkOrder model, UserUnitInformationDto userUnitInformationDto) { model.setAmosDealerName(userUnitInformationDto.getAmosDealerName());
//保存派工单 model.setAmosDealerOrgCode(userUnitInformationDto.getAmosDealerOrgCode());
RegionalCompanies regionalCompanies= regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId()); workOrderMapper.updateById(model);
model.setRegionCompanyName(regionalCompanies.getRegionalCompaniesName()); LambdaQueryWrapper<WorkOrderPowerStation> up = new LambdaQueryWrapper();
model.setRegionCode(regionalCompanies.getRegionalCompaniesCode()); up.eq(WorkOrderPowerStation::getWorkOrderId, model.getSequenceNbr());
model.setWorkOrderStatus(WorkOrderEnum.待施工.getCode()); workOrderPowerStationMapper.delete(up);
model.setRegionAddress(regionalCompanies.getRegionalAddress()); // 保存派工单 电站信息
//获取经销商单位信息 List<PeasantHousehold> peasantHouseholdId = model.getPeasantHouseholdId();
model.setAmosDealerId(userUnitInformationDto.getAmosDealerId()); List<WorkOrderPowerStation> li = new ArrayList<>();
model.setAmosDealerName(userUnitInformationDto.getAmosDealerName()); for (PeasantHousehold peasantHousehold : peasantHouseholdId) {
model.setAmosDealerOrgCode(userUnitInformationDto.getAmosDealerOrgCode()); WorkOrderPowerStation workOrderPowerStation = new WorkOrderPowerStation();
workOrderMapper.updateById(model); workOrderPowerStation.setPeasantHouseholdId(peasantHousehold.getSequenceNbr());
LambdaQueryWrapper<WorkOrderPowerStation> up=new LambdaQueryWrapper(); workOrderPowerStation.setWorkOrderId(model.getSequenceNbr());
up.eq(WorkOrderPowerStation::getWorkOrderId,model.getSequenceNbr()); workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待施工.getCode());
workOrderPowerStationMapper.delete(up); li.add(workOrderPowerStation);
//保存派工单 电站信息 }
List<PeasantHousehold> peasantHouseholdId=model.getPeasantHouseholdId(); workOrderPowerStationServiceImpl.saveBatch(li);
List<WorkOrderPowerStation> li=new ArrayList<>();
for (PeasantHousehold peasantHousehold : peasantHouseholdId) { List<ConstructionRecords> constructionRecordlist = new ArrayList<>();
WorkOrderPowerStation workOrderPowerStation=new WorkOrderPowerStation(); for (WorkOrderPowerStation workOrderPowerStation : li) {
workOrderPowerStation.setPeasantHouseholdId(peasantHousehold.getSequenceNbr()); // 增加操作日志
workOrderPowerStation.setWorkOrderId(model.getSequenceNbr()); ConstructionRecords da = new ConstructionRecords(workOrderPowerStation.getRecUserName(), "编辑派工单",
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待施工.getCode()); new Date(), "", workOrderPowerStation.getWorkOrderId(), workOrderPowerStation.getSequenceNbr(),
li.add(workOrderPowerStation); workOrderPowerStation.getPeasantHouseholdId(), "");
} constructionRecordlist.add(da);
workOrderPowerStationServiceImpl.saveBatch(li);
}
List<ConstructionRecords> constructionRecordlist=new ArrayList<>(); constructionRecordsServiceImpl.saveBatch(constructionRecordlist);
for (WorkOrderPowerStation workOrderPowerStation : li) {
//增加操作日志 return model;
ConstructionRecords da=new ConstructionRecords( }
workOrderPowerStation.getRecUserName(),
"编辑派工单", public WorkOrder selectOne(Long sequenceNbr) {
new Date(), WorkOrder model = workOrderMapper.selectById(sequenceNbr);
"", List<PeasantHousehold> li = workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr, null);
workOrderPowerStation.getWorkOrderId(), model.setPeasantHouseholdId(li);
workOrderPowerStation.getSequenceNbr(), return model;
workOrderPowerStation.getPeasantHouseholdId(), }
"");
constructionRecordlist.add(da); public Map<String, Object> selectOneall(Long sequenceNbr) {
WorkOrder model = workOrderMapper.selectById(sequenceNbr);
} List<PeasantHousehold> lih = workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr, null);
constructionRecordsServiceImpl.saveBatch(constructionRecordlist);
// 获取所有电站Bom,分组合并,暂时不相加
List<Long> ids = new ArrayList<>();
return model; for (PeasantHousehold documentStation : lih) {
} ids.add(documentStation.getSequenceNbr());
}
public WorkOrder selectOne(Long sequenceNbr) { QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
WorkOrder model= workOrderMapper.selectById(sequenceNbr); designInformationQueryWrapper.in("peasant_household_id", ids);
List<PeasantHousehold> li=workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr,null); List<DesignInformation> li = designInformationMapper.selectList(designInformationQueryWrapper);
model.setPeasantHouseholdId(li); DesignInformation designInformation = new DesignInformation();
return model; // 组件
} List<Object> assembly = new ArrayList<>();
// 逆变器
public Map<String,Object> selectOneall(Long sequenceNbr) { List<Object> inverter = new ArrayList<>();
WorkOrder model= workOrderMapper.selectById(sequenceNbr); // 电表箱
List<PeasantHousehold> lih=workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr,null); List<Object> electricityMeter = new ArrayList<>();
// 电缆
List<Object> cable = new ArrayList<>();
for (DesignInformation des : li) {
//获取所有电站Bom,分组合并,暂时不相加 if (des.getAssembly() != null && !des.getAssembly().isEmpty()) {
List<Long> ids=new ArrayList<>(); assembly.addAll(des.getAssembly());
for (PeasantHousehold documentStation : lih) { }
ids.add(documentStation.getSequenceNbr()); if (des.getInverter() != null && !des.getInverter().isEmpty()) {
} inverter.addAll(des.getInverter());
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>(); }
designInformationQueryWrapper.in("peasant_household_id", ids); if (des.getElectricityMeter() != null && !des.getElectricityMeter().isEmpty()) {
List<DesignInformation> li = designInformationMapper.selectList(designInformationQueryWrapper); electricityMeter.addAll(des.getElectricityMeter());
DesignInformation designInformation=new DesignInformation(); }
//组件 if (des.getCable() != null && !des.getCable().isEmpty()) {
List<Object> assembly=new ArrayList<>(); cable.addAll(des.getCable());
//逆变器 }
List<Object> inverter=new ArrayList<>(); }
//电表箱 List<PeasantHousehold> list = workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr, null);
List<Object> electricityMeter=new ArrayList<>(); Map<String, Object> map = new HashMap<>();
//电缆 designInformation.setAssembly(assembly);
List<Object> cable=new ArrayList<>(); designInformation.setInverter(inverter);
for (DesignInformation des : li) { designInformation.setElectricityMeter(electricityMeter);
if(des.getAssembly()!=null&&!des.getAssembly().isEmpty()){ designInformation.setCable(cable);
assembly.addAll(des.getAssembly()); map.put("workOrder", model);
} map.put("designInformation", designInformation);
if(des.getInverter()!=null&&!des.getInverter().isEmpty()){ map.put("peasantHousehold", list);
inverter.addAll(des.getInverter());
} return map;
if(des.getElectricityMeter()!=null&&!des.getElectricityMeter().isEmpty()){
electricityMeter.addAll(des.getElectricityMeter()); }
}
if(des.getCable()!=null&&!des.getCable().isEmpty()){ @Transactional
cable.addAll(des.getCable()); public PowerStationConstructionData addOrUpdate(PowerStationConstructionData powerStationConstructionData) {
}
}
List<PeasantHousehold> list=workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr,null);
Map<String,Object> map =new HashMap<>();
designInformation.setAssembly(assembly);
designInformation.setInverter(inverter);
designInformation.setElectricityMeter(electricityMeter);
designInformation.setCable(cable);
map.put("workOrder",model);
map.put("designInformation",designInformation);
map.put("peasantHousehold",list);
return map;
}
@Transactional
public PowerStationConstructionData addOrUpdate(PowerStationConstructionData powerStationConstructionData){
// if(powerStationConstructionData.getSequenceNbr()!=null){ // if(powerStationConstructionData.getSequenceNbr()!=null){
//修改施工电站状态 // 修改施工电站状态
LambdaUpdateWrapper<WorkOrderPowerStation> up=new LambdaUpdateWrapper(); LambdaUpdateWrapper<WorkOrderPowerStation> up = new LambdaUpdateWrapper();
up.eq(WorkOrderPowerStation::getSequenceNbr,powerStationConstructionData.getWorkOrderPowerStationId()); up.eq(WorkOrderPowerStation::getSequenceNbr, powerStationConstructionData.getWorkOrderPowerStationId());
if(powerStationConstructionData.getConstructionStatus().equals("未完成")){ if (powerStationConstructionData.getConstructionStatus().equals("未完成")) {
up.set(WorkOrderPowerStation::getPowerStationConstructionStatus,WorkOrderEnum.施工中.getCode()); up.set(WorkOrderPowerStation::getPowerStationConstructionStatus, WorkOrderEnum.施工中.getCode());
}else{ } else {
up.set(WorkOrderPowerStation::getPowerStationConstructionStatus,WorkOrderEnum.待登记.getCode()); up.set(WorkOrderPowerStation::getPowerStationConstructionStatus, WorkOrderEnum.待登记.getCode());
WorkOrderPowerStation basicGridAcceptanc= workOrderPowerStationMapper.selectById(powerStationConstructionData.getWorkOrderPowerStationId()); WorkOrderPowerStation basicGridAcceptanc = workOrderPowerStationMapper
//施工完成 .selectById(powerStationConstructionData.getWorkOrderPowerStationId());
LambdaUpdateWrapper<PeasantHousehold> up1 =new LambdaUpdateWrapper<>(); // 施工完成
up1.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.并网完成.getCode()); LambdaUpdateWrapper<PeasantHousehold> up1 = new LambdaUpdateWrapper<>();
long idsk= basicGridAcceptanc.getPeasantHouseholdId(); up1.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.并网完成.getCode());
up1.eq(PeasantHousehold::getSequenceNbr,idsk); long idsk = basicGridAcceptanc.getPeasantHouseholdId();
peasantHouseholdMapper.update(null,up1); up1.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up1);
}
workOrderPowerStationMapper.update(null,up); }
//修改派工单状态 workOrderPowerStationMapper.update(null, up);
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper(); // 修改派工单状态
qu.eq(WorkOrderPowerStation::getWorkOrderId,powerStationConstructionData.getWorkOrderId()); LambdaQueryWrapper<WorkOrderPowerStation> qu = new LambdaQueryWrapper();
List<String> d=new ArrayList<>(); qu.eq(WorkOrderPowerStation::getWorkOrderId, powerStationConstructionData.getWorkOrderId());
d.add(WorkOrderEnum.施工中.getCode()); List<String> d = new ArrayList<>();
d.add(WorkOrderEnum.待施工.getCode()); d.add(WorkOrderEnum.施工中.getCode());
qu.in(WorkOrderPowerStation::getPowerStationConstructionStatus,d); d.add(WorkOrderEnum.待施工.getCode());
List<WorkOrderPowerStation> list=workOrderPowerStationMapper.selectList(qu); qu.in(WorkOrderPowerStation::getPowerStationConstructionStatus, d);
List<WorkOrderPowerStation> list = workOrderPowerStationMapper.selectList(qu);
LambdaUpdateWrapper<WorkOrder> upq=new LambdaUpdateWrapper(); LambdaUpdateWrapper<WorkOrder> upq = new LambdaUpdateWrapper();
upq.eq(WorkOrder::getSequenceNbr,powerStationConstructionData.getWorkOrderId()); upq.eq(WorkOrder::getSequenceNbr, powerStationConstructionData.getWorkOrderId());
if(list!=null&&!list.isEmpty()){ if (list != null && !list.isEmpty()) {
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.施工中.getCode()); upq.set(WorkOrder::getWorkOrderStatus, WorkOrderEnum.施工中.getCode());
}else{ } else {
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.登记中.getCode()); upq.set(WorkOrder::getWorkOrderStatus, WorkOrderEnum.登记中.getCode());
} }
workOrderMapper.update(null,upq); workOrderMapper.update(null, upq);
//新增施工信息 // 新增施工信息
powerStationConstructionDataService.saveOrUpdate(powerStationConstructionData); powerStationConstructionDataService.saveOrUpdate(powerStationConstructionData);
// 增加操作日志
if (powerStationConstructionData.getSequenceNbr() != null) {
//增加操作日志 ConstructionRecords da = new ConstructionRecords(powerStationConstructionData.getRecUserName(), "编辑施工资料",
if(powerStationConstructionData.getSequenceNbr()!=null){ new Date(), "", powerStationConstructionData.getWorkOrderId(),
ConstructionRecords da=new ConstructionRecords( powerStationConstructionData.getWorkOrderPowerStationId(), null, "");
powerStationConstructionData.getRecUserName(), constructionRecordsServiceImpl.save(da);
"编辑施工资料",
new Date(), } else {
"", ConstructionRecords da = new ConstructionRecords(powerStationConstructionData.getRecUserName(), "新增施工资料",
powerStationConstructionData.getWorkOrderId(), new Date(), "", powerStationConstructionData.getWorkOrderId(),
powerStationConstructionData.getWorkOrderPowerStationId(), powerStationConstructionData.getWorkOrderPowerStationId(), null, "");
null, constructionRecordsServiceImpl.save(da);
""); }
constructionRecordsServiceImpl.save(da);
}else{
ConstructionRecords da=new ConstructionRecords(
powerStationConstructionData.getRecUserName(),
"新增施工资料",
new Date(),
"",
powerStationConstructionData.getWorkOrderId(),
powerStationConstructionData.getWorkOrderPowerStationId(),
null,
"");
constructionRecordsServiceImpl.save(da);
}
// }else{ // }else{
// //修改施工电站状态 // //修改施工电站状态
...@@ -380,387 +339,399 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -380,387 +339,399 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
// //
// } // }
return powerStationConstructionData;
return powerStationConstructionData; }
}
public Page<WorkOrder> selectPage(int pageNum, int pageSize, WorkOrder workOrder) {
PageHelper.startPage(pageNum, pageSize);
List<WorkOrder> list = workOrderMapper.selectWorkOrderList(workOrder);
PageInfo<WorkOrder> page = new PageInfo(list);
Page<WorkOrder> pagenew = new Page<WorkOrder>();
public Page<WorkOrder> selectPage( int pageNum,int pageSize, WorkOrder workOrder){ pagenew.setCurrent(pageNum);
PageHelper.startPage(pageNum, pageSize); pagenew.setTotal(page.getTotal());
List<WorkOrder> list=workOrderMapper.selectWorkOrderList(workOrder); pagenew.setSize(pageSize);
PageInfo<WorkOrder> page = new PageInfo(list); pagenew.setRecords(page.getList());
Page<WorkOrder> pagenew = new Page<WorkOrder>(); return pagenew;
pagenew.setCurrent(pageNum); }
pagenew.setTotal(page.getTotal());
pagenew.setSize(pageSize); public Page<WorkOrderPage> queryForwgpage(int pageNum, int pageSize, WorkOrderPage workOrder) {
pagenew.setRecords(page.getList()); PageHelper.startPage(pageNum, pageSize);
return pagenew; List<WorkOrderPage> list = workOrderMapper.queryForwgpage(workOrder);
} PageInfo<WorkOrderPage> page = new PageInfo(list);
Page<WorkOrderPage> pagenew = new Page<WorkOrderPage>();
pagenew.setCurrent(pageNum);
public Page<WorkOrderPage> queryForwgpage( int pageNum,int pageSize, WorkOrderPage workOrder){ pagenew.setTotal(page.getTotal());
PageHelper.startPage(pageNum, pageSize); pagenew.setSize(pageSize);
List<WorkOrderPage> list=workOrderMapper.queryForwgpage(workOrder); pagenew.setRecords(page.getList());
PageInfo<WorkOrderPage> page = new PageInfo(list); return pagenew;
Page<WorkOrderPage> pagenew = new Page<WorkOrderPage>(); }
pagenew.setCurrent(pageNum);
pagenew.setTotal(page.getTotal()); public SurveyInfoAllDto getsurveyQueryxq(Long peasantHouseholdId, Long workOrderId, Long workOrderPowerStationId) {
pagenew.setSize(pageSize);
pagenew.setRecords(page.getList()); SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
return pagenew; PeasantHousehold peasantHousehold = new PeasantHousehold();
}
LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>();
peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
public SurveyInfoAllDto getsurveyQueryxq(Long peasantHouseholdId,Long workOrderId,Long workOrderPowerStationId) { peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper);
String surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId());
SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
PeasantHousehold peasantHousehold = new PeasantHousehold(); // 勘察基本信息
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId); SurveyInformation surveyInformation = surveyInformationMapper.selectOne(queryWrapper);
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper); surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
String surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId()); // 农户信息
//勘察基本信息 // 获取用户所在经销商单位
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>(); UserUnitInformationDto userUnitInformationDto = personnelBusinessMapper
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId); .getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
SurveyInformation surveyInformation = surveyInformationMapper.selectOne(queryWrapper); BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class)); surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName());
//农户信息 surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode());
surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId());
//获取用户所在经销商单位
UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId()); if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation()); surveyInfoAllDto.getSurveyInformation()
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName()); .setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode()); }
surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId()); if (!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())) {
surveyInfoAllDto.getSurveyInformation()
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) { .setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
surveyInfoAllDto.getSurveyInformation().setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/"))); }
} if (peasantHousehold.getPermanentAddress() == null) {
if(!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())){ surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
surveyInfoAllDto.getSurveyInformation().setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/"))); surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
} }
if(peasantHousehold.getPermanentAddress() ==null){ surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress()); QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1"); surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
} SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>(); if (surveyDetails == null) {
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId); surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper); } else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
if(surveyDetails == null){ }
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto()); QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
}else { informationQueryWrapper.eq("survey_information_id", surveyInformationId);
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class)); Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
} if (information == null) {
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>(); surveyInfoAllDto.setInformation(new InformationDto());
informationQueryWrapper.eq("survey_information_id", surveyInformationId); } else {
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper); surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
if(information == null){ }
surveyInfoAllDto.setInformation(new InformationDto()); QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
}else { commercialQueryWrapper.eq("survey_information_id", surveyInformationId);
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class)); Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
} if (commercial == null) {
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>(); commercial = new Commercial();
commercialQueryWrapper.eq("survey_information_id", surveyInformationId); }
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper); commercial.setApplicant(peasantHousehold.getOwnersName());
if(commercial==null){ commercial.setIdCard(peasantHousehold.getIdCard());
commercial=new Commercial(); commercial.setTelephone(peasantHousehold.getTelephone());
} commercial.setProjectAddress(peasantHousehold.getProjectAddress());
commercial.setApplicant(peasantHousehold.getOwnersName()); commercial.setProjectAddressName(peasantHousehold.getProjectAddressName());
commercial.setIdCard(peasantHousehold.getIdCard()); commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail());
commercial.setTelephone(peasantHousehold.getTelephone()); commercial.setLegalContactTelephone(peasantHousehold.getTelephone());
commercial.setProjectAddress(peasantHousehold.getProjectAddress()); if (information == null) {
commercial.setProjectAddressName(peasantHousehold.getProjectAddressName()); CommercialDto commercialDto = BeanDtoUtils.convert(commercial, CommercialDto.class);
commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail()); commercialDto.setType("zrr");
commercial.setLegalContactTelephone(peasantHousehold.getTelephone()); commercialDto.setLegalType("zjdnhw");
if(information == null){ surveyInfoAllDto.setCommercial(commercialDto);
CommercialDto commercialDto = BeanDtoUtils.convert(commercial, CommercialDto.class); } else {
commercialDto.setType("zrr"); surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
commercialDto.setLegalType("zjdnhw"); if (commercial != null && !StringUtils.isEmpty(commercial.getProjectAddressName())) {
surveyInfoAllDto.setCommercial(commercialDto); surveyInfoAllDto.getCommercial()
}else { .setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class)); }
if(commercial !=null && !StringUtils.isEmpty(commercial.getProjectAddressName())){ }
surveyInfoAllDto.getCommercial().setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/"))); QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
} extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
} ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper()
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>(); .selectOne(extendedInformationQueryWrapper);
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId); if (information == null) {
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper().selectOne(extendedInformationQueryWrapper); surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
if(information == null){ } else {
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto()); surveyInfoAllDto
}else { .setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
surveyInfoAllDto.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class)); }
} QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>(); designInformationQueryWrapper.eq("peasant_household_id", peasantHousehold.getSequenceNbr());
designInformationQueryWrapper.eq("peasant_household_id", peasantHousehold.getSequenceNbr()); DesignInformation designInformation = designInformationService.getBaseMapper()
DesignInformation designInformation = designInformationService.getBaseMapper().selectOne(designInformationQueryWrapper); .selectOne(designInformationQueryWrapper);
if(designInformation == null){ if (designInformation == null) {
surveyInfoAllDto.setDesignInformation(new DesignInformationDto()); surveyInfoAllDto.setDesignInformation(new DesignInformationDto());
}else { } else {
surveyInfoAllDto.setDesignInformation(BeanDtoUtils.convert(designInformation, DesignInformationDto.class)); surveyInfoAllDto.setDesignInformation(BeanDtoUtils.convert(designInformation, DesignInformationDto.class));
} }
//派工单信息 // 派工单信息
LambdaQueryWrapper<WorkOrder> upl=new LambdaQueryWrapper(); LambdaQueryWrapper<WorkOrder> upl = new LambdaQueryWrapper();
upl.eq(WorkOrder::getSequenceNbr,workOrderId); upl.eq(WorkOrder::getSequenceNbr, workOrderId);
WorkOrder workOrder= workOrderMapper.selectOne(upl); WorkOrder workOrder = workOrderMapper.selectOne(upl);
//施工信息 // 施工信息
LambdaQueryWrapper<PowerStationConstructionData> up2=new LambdaQueryWrapper(); LambdaQueryWrapper<PowerStationConstructionData> up2 = new LambdaQueryWrapper();
up2.eq(PowerStationConstructionData::getWorkOrderId,workOrderId); up2.eq(PowerStationConstructionData::getWorkOrderId, workOrderId);
up2.eq(PowerStationConstructionData::getWorkOrderPowerStationId,workOrderPowerStationId); up2.eq(PowerStationConstructionData::getWorkOrderPowerStationId, workOrderPowerStationId);
PowerStationConstructionData powerStationConstructionData=powerStationConstructionDataMapper.selectOne(up2); PowerStationConstructionData powerStationConstructionData = powerStationConstructionDataMapper.selectOne(up2);
//工程信息 // 工程信息
LambdaQueryWrapper<PowerStationEngineeringInfo> up3=new LambdaQueryWrapper(); LambdaQueryWrapper<PowerStationEngineeringInfo> up3 = new LambdaQueryWrapper();
up3.eq(PowerStationEngineeringInfo::getWorkOrderId,workOrderId); up3.eq(PowerStationEngineeringInfo::getWorkOrderId, workOrderId);
up3.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId,workOrderPowerStationId); up3.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId, workOrderPowerStationId);
PowerStationEngineeringInfo powerStationEngineeringInfo=powerStationEngineeringInfoMapper.selectOne(up3); PowerStationEngineeringInfo powerStationEngineeringInfo = powerStationEngineeringInfoMapper.selectOne(up3);
if(powerStationConstructionData!=null){ if (powerStationConstructionData != null) {
powerStationEngineeringInfo=powerStationEngineeringInfo!=null?powerStationEngineeringInfo:new PowerStationEngineeringInfo(); powerStationEngineeringInfo = powerStationEngineeringInfo != null ? powerStationEngineeringInfo
powerStationEngineeringInfo.setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo()); : new PowerStationEngineeringInfo();
powerStationEngineeringInfo.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo()); powerStationEngineeringInfo
powerStationEngineeringInfo.setConstructionCollectorBoxInfo(powerStationConstructionData.getConstructionCollectorBoxInfo()); .setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo());
powerStationEngineeringInfo.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo()); powerStationEngineeringInfo
powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager()); .setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone()); powerStationEngineeringInfo
powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager()); .setConstructionCollectorBoxInfo(powerStationConstructionData.getConstructionCollectorBoxInfo());
powerStationEngineeringInfo.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone()); powerStationEngineeringInfo
} .setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager());
powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone());
powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager());
//施工自审 powerStationEngineeringInfo
LambdaQueryWrapper<ConstructionRecords> up5=new LambdaQueryWrapper(); .setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone());
up5.eq(ConstructionRecords::getWorkOrderId,workOrderId); }
up5.eq(ConstructionRecords::getWorkOrderPowerStationId,workOrderPowerStationId);
up5.orderByAsc(ConstructionRecords::getRecDate); // 施工自审
List<ConstructionRecords> li=constructionRecordsMapper.selectList(up5); LambdaQueryWrapper<ConstructionRecords> up5 = new LambdaQueryWrapper();
ConstructionRecords data=new ConstructionRecords(); up5.eq(ConstructionRecords::getWorkOrderId, workOrderId);
data.setConstructionRecordsList(li); up5.eq(ConstructionRecords::getWorkOrderPowerStationId, workOrderPowerStationId);
surveyInfoAllDto.setConstructionRecords(data); up5.orderByAsc(ConstructionRecords::getRecDate);
List<ConstructionRecords> li = constructionRecordsMapper.selectList(up5);
ConstructionRecords data = new ConstructionRecords();
data.setConstructionRecordsList(li);
//并网信息 surveyInfoAllDto.setConstructionRecords(data);
LambdaQueryWrapper<HygfOnGrid> up4=new LambdaQueryWrapper();
up4.eq(HygfOnGrid::getWorkOrderId,workOrderId); // 并网信息
up4.eq(HygfOnGrid::getWorkOrderPowerStationId,workOrderPowerStationId); LambdaQueryWrapper<HygfOnGrid> up4 = new LambdaQueryWrapper();
HygfOnGrid hygfOnGrid=hygfOnGridMapper.selectOne(up4); up4.eq(HygfOnGrid::getWorkOrderId, workOrderId);
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid!=null?hygfOnGrid:new HygfOnGrid()); up4.eq(HygfOnGrid::getWorkOrderPowerStationId, workOrderPowerStationId);
surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData); HygfOnGrid hygfOnGrid = hygfOnGridMapper.selectOne(up4);
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo); surveyInfoAllDto.setHygfOnGrid(hygfOnGrid != null ? hygfOnGrid : new HygfOnGrid());
surveyInfoAllDto.setWorkOrder(workOrder); surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData);
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo);
return surveyInfoAllDto; surveyInfoAllDto.setWorkOrder(workOrder);
}
return surveyInfoAllDto;
public PowerStationEngineeringInfoAllDto getPowerStationEngineeringInfo(Long workOrderPowerStationId) { }
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper(); public PowerStationEngineeringInfoAllDto getPowerStationEngineeringInfo(Long workOrderPowerStationId) {
qu.eq(WorkOrderPowerStation::getSequenceNbr,workOrderPowerStationId);
WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu); LambdaQueryWrapper<WorkOrderPowerStation> qu = new LambdaQueryWrapper();
Long peasantHouseholdId=workOrderPowerStation.getPeasantHouseholdId(); qu.eq(WorkOrderPowerStation::getSequenceNbr, workOrderPowerStationId);
Long workOrderId=workOrderPowerStation.getWorkOrderId(); WorkOrderPowerStation workOrderPowerStation = workOrderPowerStationMapper.selectOne(qu);
Long peasantHouseholdId = workOrderPowerStation.getPeasantHouseholdId();
PowerStationEngineeringInfoAllDto surveyInfoAllDto = new PowerStationEngineeringInfoAllDto(); Long workOrderId = workOrderPowerStation.getWorkOrderId();
PeasantHousehold peasantHousehold = new PeasantHousehold();
PowerStationEngineeringInfoAllDto surveyInfoAllDto = new PowerStationEngineeringInfoAllDto();
LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>(); PeasantHousehold peasantHousehold = new PeasantHousehold();
peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper); LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>();
String surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId()); peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper);
//勘察基本信息 String surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId());
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId); // 勘察基本信息
SurveyInformation surveyInformation = surveyInformationMapper.selectOne(queryWrapper); LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class)); queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
//农户信息 SurveyInformation surveyInformation = surveyInformationMapper.selectOne(queryWrapper);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
//获取用户所在经销商单位 // 农户信息
UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation()); // 获取用户所在经销商单位
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName()); UserUnitInformationDto userUnitInformationDto = personnelBusinessMapper
surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode()); .getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId()); BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName());
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) { surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode());
surveyInfoAllDto.getSurveyInformation().setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/"))); surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId());
}
if(!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())){ if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation().setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/"))); surveyInfoAllDto.getSurveyInformation()
} .setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
if(peasantHousehold.getPermanentAddress() ==null){ }
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress()); if (!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())) {
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1"); surveyInfoAllDto.getSurveyInformation()
} .setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr()); }
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>(); if (peasantHousehold.getPermanentAddress() == null) {
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId); surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper); surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
}
if(surveyDetails == null){ surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto()); QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
}else { surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class)); SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
}
if (surveyDetails == null) {
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
} else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
}
// 商务信息 // 商务信息
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>(); QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
commercialQueryWrapper.eq("survey_information_id", surveyInformationId); commercialQueryWrapper.eq("survey_information_id", surveyInformationId);
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper); Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
if(commercial==null){ if (commercial == null) {
commercial=new Commercial(); commercial = new Commercial();
} }
commercial.setApplicant(peasantHousehold.getOwnersName()); commercial.setApplicant(peasantHousehold.getOwnersName());
commercial.setIdCard(peasantHousehold.getIdCard()); commercial.setIdCard(peasantHousehold.getIdCard());
commercial.setTelephone(peasantHousehold.getTelephone()); commercial.setTelephone(peasantHousehold.getTelephone());
commercial.setProjectAddress(peasantHousehold.getProjectAddress()); commercial.setProjectAddress(peasantHousehold.getProjectAddress());
commercial.setProjectAddressName(peasantHousehold.getProjectAddressName()); commercial.setProjectAddressName(peasantHousehold.getProjectAddressName());
commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail()); commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail());
commercial.setLegalContactTelephone(peasantHousehold.getTelephone()); commercial.setLegalContactTelephone(peasantHousehold.getTelephone());
// 资料归档 // 资料归档
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>(); QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
informationQueryWrapper.eq("survey_information_id", surveyInformationId); informationQueryWrapper.eq("survey_information_id", surveyInformationId);
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper); Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
if(information == null){ if (information == null) {
surveyInfoAllDto.setInformation(new InformationDto()); surveyInfoAllDto.setInformation(new InformationDto());
}else { } else {
// 将商务信息的房产证明文件数据赋值给资料归档的房产证明文件 // 将商务信息的房产证明文件数据赋值给资料归档的房产证明文件
information.setCardFile(commercial.getIdCardCredit()); information.setCardFile(commercial.getIdCardCredit());
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class)); surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
} }
if (information == null) {
if(information == null){ CommercialDto commercialDto = BeanDtoUtils.convert(commercial, CommercialDto.class);
CommercialDto commercialDto = BeanDtoUtils.convert(commercial, CommercialDto.class); commercialDto.setType("zrr");
commercialDto.setType("zrr"); commercialDto.setLegalType("zjdnhw");
commercialDto.setLegalType("zjdnhw"); surveyInfoAllDto.setCommercial(commercialDto);
surveyInfoAllDto.setCommercial(commercialDto); } else {
}else { surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class)); if (commercial != null && !StringUtils.isEmpty(commercial.getProjectAddressName())) {
if(commercial !=null && !StringUtils.isEmpty(commercial.getProjectAddressName())){ surveyInfoAllDto.getCommercial()
surveyInfoAllDto.getCommercial().setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/"))); .setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
} }
} }
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>(); QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId); extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper().selectOne(extendedInformationQueryWrapper); ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper()
if(information == null){ .selectOne(extendedInformationQueryWrapper);
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto()); if (information == null) {
}else { surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
surveyInfoAllDto.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class)); } else {
} surveyInfoAllDto
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>(); .setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
designInformationQueryWrapper.eq("peasant_household_id", peasantHousehold.getSequenceNbr()); }
DesignInformation designInformation = designInformationService.getBaseMapper().selectOne(designInformationQueryWrapper); QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
if(designInformation == null){ designInformationQueryWrapper.eq("peasant_household_id", peasantHousehold.getSequenceNbr());
surveyInfoAllDto.setDesignInformation(new DesignInformationDto()); DesignInformation designInformation = designInformationService.getBaseMapper()
}else { .selectOne(designInformationQueryWrapper);
surveyInfoAllDto.setDesignInformation(BeanDtoUtils.convert(designInformation, DesignInformationDto.class)); if (designInformation == null) {
} surveyInfoAllDto.setDesignInformation(new DesignInformationDto());
} else {
//派工单信息 surveyInfoAllDto.setDesignInformation(BeanDtoUtils.convert(designInformation, DesignInformationDto.class));
LambdaQueryWrapper<WorkOrder> upl=new LambdaQueryWrapper(); }
upl.eq(WorkOrder::getSequenceNbr,workOrderId);
WorkOrder workOrder= workOrderMapper.selectOne(upl); // 派工单信息
LambdaQueryWrapper<WorkOrder> upl = new LambdaQueryWrapper();
//施工信息 upl.eq(WorkOrder::getSequenceNbr, workOrderId);
LambdaQueryWrapper<PowerStationConstructionData> up2=new LambdaQueryWrapper(); WorkOrder workOrder = workOrderMapper.selectOne(upl);
up2.eq(PowerStationConstructionData::getWorkOrderId,workOrderId);
up2.eq(PowerStationConstructionData::getWorkOrderPowerStationId,workOrderPowerStationId); // 施工信息
PowerStationConstructionData powerStationConstructionData=powerStationConstructionDataMapper.selectOne(up2); LambdaQueryWrapper<PowerStationConstructionData> up2 = new LambdaQueryWrapper();
up2.eq(PowerStationConstructionData::getWorkOrderId, workOrderId);
//工程信息 up2.eq(PowerStationConstructionData::getWorkOrderPowerStationId, workOrderPowerStationId);
PowerStationConstructionData powerStationConstructionData = powerStationConstructionDataMapper.selectOne(up2);
LambdaQueryWrapper<PowerStationEngineeringInfo> up3=new LambdaQueryWrapper();
up3.eq(PowerStationEngineeringInfo::getWorkOrderId,workOrderId); // 工程信息
up3.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId,workOrderPowerStationId);
PowerStationEngineeringInfo powerStationEngineeringInfo=powerStationEngineeringInfoMapper.selectOne(up3); LambdaQueryWrapper<PowerStationEngineeringInfo> up3 = new LambdaQueryWrapper();
if(powerStationConstructionData!=null){ up3.eq(PowerStationEngineeringInfo::getWorkOrderId, workOrderId);
powerStationEngineeringInfo=powerStationEngineeringInfo!=null?powerStationEngineeringInfo:new PowerStationEngineeringInfo(); up3.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId, workOrderPowerStationId);
powerStationEngineeringInfo.setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo()); PowerStationEngineeringInfo powerStationEngineeringInfo = powerStationEngineeringInfoMapper.selectOne(up3);
powerStationEngineeringInfo.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo()); if (powerStationConstructionData != null) {
powerStationEngineeringInfo.setConstructionCollectorBoxInfo(powerStationConstructionData.getConstructionCollectorBoxInfo()); powerStationEngineeringInfo = powerStationEngineeringInfo != null ? powerStationEngineeringInfo
powerStationEngineeringInfo.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo()); : new PowerStationEngineeringInfo();
powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager()); powerStationEngineeringInfo
powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone()); .setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo());
powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager()); powerStationEngineeringInfo
powerStationEngineeringInfo.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone()); .setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
} powerStationEngineeringInfo
//并网信息 .setConstructionCollectorBoxInfo(powerStationConstructionData.getConstructionCollectorBoxInfo());
LambdaQueryWrapper<HygfOnGrid> up4=new LambdaQueryWrapper(); powerStationEngineeringInfo
up4.eq(HygfOnGrid::getWorkOrderId,workOrderId); .setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
up4.eq(HygfOnGrid::getWorkOrderPowerStationId,workOrderPowerStationId); powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager());
HygfOnGrid hygfOnGrid=hygfOnGridMapper.selectOne(up4); powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone());
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid!=null?hygfOnGrid:new HygfOnGrid()); powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager());
surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData); powerStationEngineeringInfo
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo); .setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone());
surveyInfoAllDto.setWorkOrder(workOrder); }
// 并网信息
//施工自审 LambdaQueryWrapper<HygfOnGrid> up4 = new LambdaQueryWrapper();
LambdaQueryWrapper<ConstructionRecords> up5=new LambdaQueryWrapper(); up4.eq(HygfOnGrid::getWorkOrderId, workOrderId);
up5.eq(ConstructionRecords::getWorkOrderId,workOrderId); up4.eq(HygfOnGrid::getWorkOrderPowerStationId, workOrderPowerStationId);
up5.eq(ConstructionRecords::getWorkOrderPowerStationId,workOrderPowerStationId); HygfOnGrid hygfOnGrid = hygfOnGridMapper.selectOne(up4);
up5.orderByAsc(ConstructionRecords::getRecDate); surveyInfoAllDto.setHygfOnGrid(hygfOnGrid != null ? hygfOnGrid : new HygfOnGrid());
List<ConstructionRecords> li=constructionRecordsMapper.selectList(up5); surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData);
ConstructionRecords data=new ConstructionRecords(); surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo);
data.setConstructionRecordsList(li); surveyInfoAllDto.setWorkOrder(workOrder);
surveyInfoAllDto.setConstructionRecords(data);
// 施工自审
LambdaQueryWrapper<ConstructionRecords> up5 = new LambdaQueryWrapper();
up5.eq(ConstructionRecords::getWorkOrderId, workOrderId);
LambdaQueryWrapper<BasicGridAcceptance> quv=new LambdaQueryWrapper(); up5.eq(ConstructionRecords::getWorkOrderPowerStationId, workOrderPowerStationId);
quv.eq(BasicGridAcceptance::getPeasantHouseholdId,peasantHouseholdId); up5.orderByAsc(ConstructionRecords::getRecDate);
BasicGridAcceptance basicGridAcceptance= basicGridAcceptanceMapper.selectOne(quv); List<ConstructionRecords> li = constructionRecordsMapper.selectList(up5);
ConstructionRecords data = new ConstructionRecords();
//审核意见 data.setConstructionRecordsList(li);
if(Objects.nonNull(basicGridAcceptance) && !StringUtils.isEmpty(basicGridAcceptance.getInstanceId())){ surveyInfoAllDto.setConstructionRecords(data);
try {
Map<String, Object> flowLoggerMap = workflowFeignClient.getFlowLogger(basicGridAcceptance.getInstanceId()).getResult(); LambdaQueryWrapper<BasicGridAcceptance> quv = new LambdaQueryWrapper();
List<LinkedHashMap> flowLogger = (List<LinkedHashMap>) flowLoggerMap.get("flowLogger"); quv.eq(BasicGridAcceptance::getPeasantHouseholdId, peasantHouseholdId);
if (flowLogger.size() > 0 ){ BasicGridAcceptance basicGridAcceptance = basicGridAcceptanceMapper.selectOne(quv);
Collections.reverse(flowLogger);
} // 审核意见
List<LinkedHashMap> flowLoggernew =new ArrayList<>(); if (Objects.nonNull(basicGridAcceptance) && !StringUtils.isEmpty(basicGridAcceptance.getInstanceId())) {
for (LinkedHashMap linkedHashMap : flowLogger) { try {
if(linkedHashMap.get("operateDate")!=null&&!linkedHashMap.get("operateDate").toString().isEmpty()){ Map<String, Object> flowLoggerMap = workflowFeignClient
LinkedHashMap linke=new LinkedHashMap(); .getFlowLogger(basicGridAcceptance.getInstanceId()).getResult();
linke.put("approvalStatue",linkedHashMap.get("approvalStatue").toString()); List<LinkedHashMap> flowLogger = (List<LinkedHashMap>) flowLoggerMap.get("flowLogger");
//审核意见 if (flowLogger.size() > 0) {
List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>)linkedHashMap.get("approvalSuggestion"); Collections.reverse(flowLogger);
if(approvalSuggestion!=null&&!approvalSuggestion.isEmpty()){ }
linke.put("approvalSuggestion",approvalSuggestion.get(0).get("message")); List<LinkedHashMap> flowLoggernew = new ArrayList<>();
} for (LinkedHashMap linkedHashMap : flowLogger) {
linke.put("taskName",linkedHashMap.get("taskName").toString()); if (linkedHashMap.get("operateDate") != null
linke.put("operator",linkedHashMap.get("operator").toString()); && !linkedHashMap.get("operateDate").toString().isEmpty()) {
linke.put("operateDate",linkedHashMap.get("operateDate").toString()); LinkedHashMap linke = new LinkedHashMap();
flowLoggernew.add(linke); linke.put("approvalStatue", linkedHashMap.get("approvalStatue").toString());
} // 审核意见
} List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>) linkedHashMap
LoggerDto loggerDto =new LoggerDto(); .get("approvalSuggestion");
loggerDto.setLogger(flowLoggernew); if (approvalSuggestion != null && !approvalSuggestion.isEmpty()) {
surveyInfoAllDto.setLoggerDto(loggerDto); linke.put("approvalSuggestion", approvalSuggestion.get(0).get("message"));
} catch (Exception e){ }
e.printStackTrace(); linke.put("taskName", linkedHashMap.get("taskName").toString());
} linke.put("operator", linkedHashMap.get("operator").toString());
} linke.put("operateDate", linkedHashMap.get("operateDate").toString());
flowLoggernew.add(linke);
}
}
LoggerDto loggerDto = new LoggerDto();
return surveyInfoAllDto; loggerDto.setLogger(flowLoggernew);
surveyInfoAllDto.setLoggerDto(loggerDto);
} catch (Exception e) {
e.printStackTrace();
}
}
return surveyInfoAllDto;
// LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>();
// peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId); // peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
// peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper); // peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper);
...@@ -826,137 +797,140 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -826,137 +797,140 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
// surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo); // surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo);
// return surveyInfoAllDto; // return surveyInfoAllDto;
} }
@Transactional(isolation = Isolation.REPEATABLE_READ)
public PowerStationEngineeringInfoAllDto addPowerStationEngineeringInfo(PowerStationEngineeringInfoAllDto powerStationEngineeringInfoAllDto){ @Transactional(isolation = Isolation.REPEATABLE_READ)
public PowerStationEngineeringInfoAllDto addPowerStationEngineeringInfo(
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper(); PowerStationEngineeringInfoAllDto powerStationEngineeringInfoAllDto) {
qu.eq(WorkOrderPowerStation::getSequenceNbr,powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId());
WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu); LambdaQueryWrapper<WorkOrderPowerStation> qu = new LambdaQueryWrapper();
//修改电站状态 qu.eq(WorkOrderPowerStation::getSequenceNbr, powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId());
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待审核.getCode()); WorkOrderPowerStation workOrderPowerStation = workOrderPowerStationMapper.selectOne(qu);
workOrderPowerStationMapper.updateById(workOrderPowerStation); // 修改电站状态
//修改派工单状态PowerStationEngineeringInfo workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待审核.getCode());
LambdaQueryWrapper<WorkOrderPowerStation> qu1=new LambdaQueryWrapper(); workOrderPowerStationMapper.updateById(workOrderPowerStation);
qu1.eq(WorkOrderPowerStation::getWorkOrderId,workOrderPowerStation.getWorkOrderId()); // 修改派工单状态PowerStationEngineeringInfo
List<String> d=new ArrayList<>(); LambdaQueryWrapper<WorkOrderPowerStation> qu1 = new LambdaQueryWrapper();
d.add(WorkOrderEnum.施工中.getCode()); qu1.eq(WorkOrderPowerStation::getWorkOrderId, workOrderPowerStation.getWorkOrderId());
d.add(WorkOrderEnum.待施工.getCode()); List<String> d = new ArrayList<>();
d.add(WorkOrderEnum.待登记.getCode()); d.add(WorkOrderEnum.施工中.getCode());
qu1.in(WorkOrderPowerStation::getPowerStationConstructionStatus,d); d.add(WorkOrderEnum.待施工.getCode());
List<WorkOrderPowerStation> list=workOrderPowerStationMapper.selectList(qu1); d.add(WorkOrderEnum.待登记.getCode());
LambdaUpdateWrapper<WorkOrder> upq=new LambdaUpdateWrapper(); qu1.in(WorkOrderPowerStation::getPowerStationConstructionStatus, d);
upq.eq(WorkOrder::getSequenceNbr,workOrderPowerStation.getWorkOrderId()); List<WorkOrderPowerStation> list = workOrderPowerStationMapper.selectList(qu1);
if(list==null||list.isEmpty()){ LambdaUpdateWrapper<WorkOrder> upq = new LambdaUpdateWrapper();
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.审核中.getCode()); upq.eq(WorkOrder::getSequenceNbr, workOrderPowerStation.getWorkOrderId());
workOrderMapper.update(null,upq); if (list == null || list.isEmpty()) {
} upq.set(WorkOrder::getWorkOrderStatus, WorkOrderEnum.审核中.getCode());
//新增完工登记 workOrderMapper.update(null, upq);
PowerStationEngineeringInfo powerStationEngineeringInfo= powerStationEngineeringInfoAllDto.getPowerStationEngineeringInfo(); }
powerStationEngineeringInfo.setWorkOrderId(workOrderPowerStation.getWorkOrderId()); // 新增完工登记
powerStationEngineeringInfo.setWorkOrderPowerStationId(powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId()); PowerStationEngineeringInfo powerStationEngineeringInfo = powerStationEngineeringInfoAllDto
powerStationEngineeringInfoService.saveOrUpdate(powerStationEngineeringInfo); .getPowerStationEngineeringInfo();
//增加操作日志 powerStationEngineeringInfo.setWorkOrderId(workOrderPowerStation.getWorkOrderId());
ConstructionRecords da=new ConstructionRecords( powerStationEngineeringInfo
powerStationEngineeringInfo.getRecUserName(), .setWorkOrderPowerStationId(powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId());
"完工登记", powerStationEngineeringInfoService.saveOrUpdate(powerStationEngineeringInfo);
new Date(), // 增加操作日志
"", ConstructionRecords da = new ConstructionRecords(powerStationEngineeringInfo.getRecUserName(), "完工登记",
workOrderPowerStation.getWorkOrderId(), new Date(), "", workOrderPowerStation.getWorkOrderId(), workOrderPowerStation.getSequenceNbr(),
workOrderPowerStation.getSequenceNbr(), workOrderPowerStation.getPeasantHouseholdId(), "");
workOrderPowerStation.getPeasantHouseholdId(), constructionRecordsServiceImpl.save(da);
""); return powerStationEngineeringInfoAllDto;
constructionRecordsServiceImpl.save(da); }
return powerStationEngineeringInfoAllDto;
} public PowerStationEngineeringInfoAllDto getConstructionRecords(Long workOrderPowerStationId, String rename) {
LambdaQueryWrapper<WorkOrderPowerStation> qu = new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getSequenceNbr, workOrderPowerStationId);
public PowerStationEngineeringInfoAllDto getConstructionRecords(Long workOrderPowerStationId,String rename) { WorkOrderPowerStation workOrderPowerStation = workOrderPowerStationMapper.selectOne(qu);
Long peasantHouseholdId = workOrderPowerStation.getPeasantHouseholdId();
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper(); Long workOrderId = workOrderPowerStation.getWorkOrderId();
qu.eq(WorkOrderPowerStation::getSequenceNbr,workOrderPowerStationId); PowerStationEngineeringInfoAllDto surveyInfoAllDto = new PowerStationEngineeringInfoAllDto();
WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu); // 施工自审
Long peasantHouseholdId=workOrderPowerStation.getPeasantHouseholdId(); LambdaQueryWrapper<ConstructionRecords> up5 = new LambdaQueryWrapper();
Long workOrderId=workOrderPowerStation.getWorkOrderId(); up5.eq(ConstructionRecords::getWorkOrderId, workOrderId);
PowerStationEngineeringInfoAllDto surveyInfoAllDto = new PowerStationEngineeringInfoAllDto(); up5.eq(ConstructionRecords::getWorkOrderPowerStationId, workOrderPowerStationId);
//施工自审 up5.orderByDesc(ConstructionRecords::getRecDate);
LambdaQueryWrapper<ConstructionRecords> up5=new LambdaQueryWrapper(); List<ConstructionRecords> li = constructionRecordsMapper.selectList(up5);
up5.eq(ConstructionRecords::getWorkOrderId,workOrderId); ConstructionRecords data = new ConstructionRecords();
up5.eq(ConstructionRecords::getWorkOrderPowerStationId,workOrderPowerStationId); data.setConstructionRecordsList(li);
up5.orderByDesc(ConstructionRecords::getRecDate); data.setOperationTime(new Date());
List<ConstructionRecords> li=constructionRecordsMapper.selectList(up5); data.setOperator(rename);
ConstructionRecords data=new ConstructionRecords(); surveyInfoAllDto.setConstructionRecords(data);
data.setConstructionRecordsList(li); return surveyInfoAllDto;
data.setOperationTime(new Date());
data.setOperator(rename); }
surveyInfoAllDto.setConstructionRecords(data);
return surveyInfoAllDto; @Transactional(isolation = Isolation.REPEATABLE_READ)
}
@Transactional(isolation = Isolation.REPEATABLE_READ)
public ConstructionRecords addConstructionRecords(ConstructionRecords constructionRecords){ public ConstructionRecords addConstructionRecords(ConstructionRecords constructionRecords){
synchronized (constructionRecords.getPeasantHouseholdId()) {
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper();
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper(); qu.eq(WorkOrderPowerStation::getSequenceNbr,constructionRecords.getWorkOrderPowerStationId());
qu.eq(WorkOrderPowerStation::getSequenceNbr,constructionRecords.getWorkOrderPowerStationId()); WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu);
WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu);
if(constructionRecords.getOperationResults().equals("通过")){
if(constructionRecords.getOperationResults().equals("通过")){ //修改电站状态
//修改电站状态 workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.已完工.getCode());
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.已完工.getCode());
//修改完工时间
//修改完工时间 LambdaUpdateWrapper<PowerStationEngineeringInfo> upq1=new LambdaUpdateWrapper();
LambdaUpdateWrapper<PowerStationEngineeringInfo> upq1=new LambdaUpdateWrapper(); upq1.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId,workOrderPowerStation.getSequenceNbr());
upq1.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId,workOrderPowerStation.getSequenceNbr()); upq1.set(PowerStationEngineeringInfo::getCompletionDate,new Date());
upq1.set(PowerStationEngineeringInfo::getCompletionDate,new Date()); powerStationEngineeringInfoMapper.update(null,upq1);
powerStationEngineeringInfoMapper.update(null,upq1);
BasicGridAcceptance dat=new BasicGridAcceptance();
BasicGridAcceptance dat=new BasicGridAcceptance(); dat.setWorkOrderId(workOrderPowerStation.getWorkOrderId());
dat.setWorkOrderId(workOrderPowerStation.getWorkOrderId()); dat.setWorkOrderPowerStationId(workOrderPowerStation.getSequenceNbr());
dat.setWorkOrderPowerStationId(workOrderPowerStation.getSequenceNbr()); dat.setPeasantHouseholdId(workOrderPowerStation.getPeasantHouseholdId());
dat.setPeasantHouseholdId(workOrderPowerStation.getPeasantHouseholdId()); dat.setGridStatus("1");
dat.setGridStatus("1");
//新增并网记录 //新增并网记录
basicGridAcceptanceMapper.insert(dat); LambdaQueryWrapper<BasicGridAcceptance> bga = new LambdaQueryWrapper<>();
workOrderPowerStationMapper.updateById(workOrderPowerStation); bga.eq(BasicGridAcceptance::getPeasantHouseholdId, workOrderPowerStation.getPeasantHouseholdId());
//修改派工单状态 BasicGridAcceptance b = basicGridAcceptanceMapper.selectOne(bga);
LambdaQueryWrapper<WorkOrderPowerStation> qu1=new LambdaQueryWrapper(); //防止重复增加
qu1.eq(WorkOrderPowerStation::getWorkOrderId,workOrderPowerStation.getWorkOrderId()); if(b==null)
List<String> d=new ArrayList<>(); {
d.add(WorkOrderEnum.施工中.getCode()); basicGridAcceptanceMapper.insert(dat);
d.add(WorkOrderEnum.待施工.getCode()); }
d.add(WorkOrderEnum.待登记.getCode()); workOrderPowerStationMapper.updateById(workOrderPowerStation);
d.add(WorkOrderEnum.待审核.getCode()); //修改派工单状态
qu1.in(WorkOrderPowerStation::getPowerStationConstructionStatus,d); LambdaQueryWrapper<WorkOrderPowerStation> qu1=new LambdaQueryWrapper();
List<WorkOrderPowerStation> list=workOrderPowerStationMapper.selectList(qu1); qu1.eq(WorkOrderPowerStation::getWorkOrderId,workOrderPowerStation.getWorkOrderId());
LambdaUpdateWrapper<WorkOrder> upq=new LambdaUpdateWrapper(); List<String> d=new ArrayList<>();
upq.eq(WorkOrder::getSequenceNbr,workOrderPowerStation.getWorkOrderId()); d.add(WorkOrderEnum.施工中.getCode());
if(list==null||list.isEmpty()){ d.add(WorkOrderEnum.待施工.getCode());
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.已完工.getCode()); d.add(WorkOrderEnum.待登记.getCode());
workOrderMapper.update(null,upq); d.add(WorkOrderEnum.待审核.getCode());
} qu1.in(WorkOrderPowerStation::getPowerStationConstructionStatus,d);
List<WorkOrderPowerStation> list=workOrderPowerStationMapper.selectList(qu1);
}else{ LambdaUpdateWrapper<WorkOrder> upq=new LambdaUpdateWrapper();
//修改电站状态 upq.eq(WorkOrder::getSequenceNbr,workOrderPowerStation.getWorkOrderId());
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.未通过.getCode()); if(list==null||list.isEmpty()){
workOrderPowerStationMapper.updateById(workOrderPowerStation); upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.已完工.getCode());
LambdaUpdateWrapper<WorkOrder> upq=new LambdaUpdateWrapper(); workOrderMapper.update(null,upq);
upq.eq(WorkOrder::getSequenceNbr,workOrderPowerStation.getWorkOrderId()); }
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.未通过
.getCode()); }else{
workOrderMapper.update(null,upq); //修改电站状态
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.未通过.getCode());
} workOrderPowerStationMapper.updateById(workOrderPowerStation);
LambdaUpdateWrapper<WorkOrder> upq=new LambdaUpdateWrapper();
//增加操作日志 upq.eq(WorkOrder::getSequenceNbr,workOrderPowerStation.getWorkOrderId());
constructionRecords.setWorkOrderId(workOrderPowerStation.getWorkOrderId()); upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.未通过
constructionRecords.setOperationContent("完工自审-"+constructionRecords.getOperationResults()); .getCode());
constructionRecords.setWorkOrderPowerStationId(workOrderPowerStation.getSequenceNbr()); workOrderMapper.update(null,upq);
constructionRecords.setPeasantHouseholdId(workOrderPowerStation.getPeasantHouseholdId());
constructionRecordsServiceImpl.save(constructionRecords); }
//增加操作日志
constructionRecords.setWorkOrderId(workOrderPowerStation.getWorkOrderId());
constructionRecords.setOperationContent("完工自审-"+constructionRecords.getOperationResults());
constructionRecords.setWorkOrderPowerStationId(workOrderPowerStation.getSequenceNbr());
constructionRecords.setPeasantHouseholdId(workOrderPowerStation.getPeasantHouseholdId());
constructionRecordsServiceImpl.save(constructionRecords);
}
return constructionRecords; return constructionRecords;
} }
......
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