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,8 +49,9 @@ import java.util.stream.Stream; ...@@ -49,8 +49,9 @@ 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 @Autowired
SurveyDetailsServiceImpl surveyDetailsService; SurveyDetailsServiceImpl surveyDetailsService;
...@@ -93,10 +94,10 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -93,10 +94,10 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
@Value("${power.station.examine.planId}") @Value("${power.station.examine.planId}")
private String planId; private String planId;
private static final String regionRedis="app_region_redis"; private static final String regionRedis = "app_region_redis";
private static final String OPERATION_TYPE_SUBMIT="submit"; private static final String OPERATION_TYPE_SUBMIT = "submit";
private static final String OPERATION_TYPE_APPLY="apply"; private static final String OPERATION_TYPE_APPLY = "apply";
private static final String IDX_REQUEST_STATE="200"; private static final String IDX_REQUEST_STATE = "200";
@Autowired @Autowired
PersonnelBusinessMapper personnelBusinessMapper; PersonnelBusinessMapper personnelBusinessMapper;
@Autowired @Autowired
...@@ -138,38 +139,44 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -138,38 +139,44 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
* 列表查询 示例 * 列表查询 示例
*/ */
public List<SurveyInformationDto> queryForSurveyInformationList() { public List<SurveyInformationDto> queryForSurveyInformationList() {
return this.queryForList("" , false); return this.queryForList("", false);
} }
@Transactional @Transactional
public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto,String operationType) { public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto, String operationType) {
try { 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.class);
extendedInformation.setSurveyInformationId(surveyInformation.getSequenceNbr()); extendedInformation.setSurveyInformationId(surveyInformation.getSequenceNbr());
extendedInformationService.saveOrUpdate(extendedInformation); // 避免生成多份数据
extendedInformationService.saveOrUpdate(extendedInformation, new LambdaQueryWrapper<ExtendedInformation>()
.eq(ExtendedInformation::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//extendedInformationService.saveOrUpdate(extendedInformation);
//更新勘察明细信息 // 更新勘察明细信息
SurveyDetailsDto oldSurveyDetails = surveyInfoAllDto.getSurveyDetails(); SurveyDetailsDto oldSurveyDetails = surveyInfoAllDto.getSurveyDetails();
SurveyDetails surveyDetails = BeanDtoUtils.convert(oldSurveyDetails, SurveyDetails.class); SurveyDetails surveyDetails = BeanDtoUtils.convert(oldSurveyDetails, SurveyDetails.class);
surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr()); surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr());
surveyDetailsService.saveOrUpdate(surveyDetails); // 避免生成多份数据
surveyDetailsService.saveOrUpdate(surveyDetails, new LambdaQueryWrapper<SurveyDetails>()
.eq(SurveyDetails::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//surveyDetailsService.saveOrUpdate(surveyDetails);
//更新商务信息 // 更新商务信息
CommercialDto oldCommercial = surveyInfoAllDto.getCommercial(); CommercialDto oldCommercial = surveyInfoAllDto.getCommercial();
Commercial commercial = BeanDtoUtils.convert(oldCommercial, Commercial.class); Commercial commercial = BeanDtoUtils.convert(oldCommercial, Commercial.class);
// 处理省市县 // 处理省市县
...@@ -183,22 +190,33 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -183,22 +190,33 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
} }
commercial.setProjectAddressName(paddressName.substring(0, paddressName.length() - 1)); commercial.setProjectAddressName(paddressName.substring(0, paddressName.length() - 1));
commercial.setSurveyInformationId(surveyInformation.getSequenceNbr()); commercial.setSurveyInformationId(surveyInformation.getSequenceNbr());
commercialService.saveOrUpdate(commercial); // 避免生成多份数据
//勘察后,更新状态 commercialService.saveOrUpdate(commercial, new LambdaQueryWrapper<Commercial>()
.eq(Commercial::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//commercialService.saveOrUpdate(commercial);
// 勘察后,更新状态
QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>(); QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformation.getSequenceNbr()); peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformation.getSequenceNbr());
PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper); PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper()
.selectOne(peasantHouseholdQueryWrapper);
//更新资料归档信息 // 更新资料归档信息
Information information = BeanDtoUtils.convert(surveyInfoAllDto.getInformation(), Information.class); Information information = BeanDtoUtils.convert(surveyInfoAllDto.getInformation(), Information.class);
information.setHouseProve(null == commercial ?null :(CollectionUtil.isNotEmpty(commercial.getRealEstateLegal())? commercial.getRealEstateLegal():null)); information.setHouseProve(null == commercial ? null
information.setCardFile( null == commercial ?null:(CollectionUtil.isNotEmpty(commercial.getIdCardCredit())? commercial.getIdCardCredit():null)); : (CollectionUtil.isNotEmpty(commercial.getRealEstateLegal()) ? commercial.getRealEstateLegal()
: null));
information.setCardFile(null == commercial ? null
: (CollectionUtil.isNotEmpty(commercial.getIdCardCredit()) ? commercial.getIdCardCredit() : null));
information.setCardFile(commercial.getAgentLegal()); information.setCardFile(commercial.getAgentLegal());
information.setArchivesNumber(this.getNo(CodeEnum.档案.getCode(),peasantHousehold.getRegionalCompaniesSeq())); information
information.setFileNumber(this.getNo(CodeEnum.文件.getCode(),peasantHousehold.getRegionalCompaniesSeq())); .setArchivesNumber(this.getNo(CodeEnum.档案.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
information.setFileNumber(this.getNo(CodeEnum.文件.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
information.setSurveyInformationId(surveyInformation.getSequenceNbr()); information.setSurveyInformationId(surveyInformation.getSequenceNbr());
informationService.saveOrUpdate(information);
// 避免生成多份数据
informationService.saveOrUpdate(information, new LambdaQueryWrapper<Information>()
.eq(Information::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//informationService.saveOrUpdate(information);
peasantHousehold.setOwnersName(surveyInfoAllDto.getSurveyInformation().getOwnersName()); peasantHousehold.setOwnersName(surveyInfoAllDto.getSurveyInformation().getOwnersName());
peasantHousehold.setTelephone(surveyInfoAllDto.getSurveyInformation().getTelephone()); peasantHousehold.setTelephone(surveyInfoAllDto.getSurveyInformation().getTelephone());
...@@ -207,8 +225,10 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -207,8 +225,10 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
peasantHousehold.setProjectAddress(surveyInfoAllDto.getSurveyInformation().getProjectAddress()); peasantHousehold.setProjectAddress(surveyInfoAllDto.getSurveyInformation().getProjectAddress());
peasantHousehold.setProjectAddressDetail(surveyInfoAllDto.getSurveyInformation().getProjectAddressDetail()); peasantHousehold.setProjectAddressDetail(surveyInfoAllDto.getSurveyInformation().getProjectAddressDetail());
peasantHousehold.setPermanentAddress(surveyInfoAllDto.getSurveyInformation().getPermanentAddress()); peasantHousehold.setPermanentAddress(surveyInfoAllDto.getSurveyInformation().getPermanentAddress());
peasantHousehold.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail()); peasantHousehold
peasantHousehold.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail()); .setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
peasantHousehold
.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
// 处理项目地址 // 处理项目地址
String projectAddressName = ""; String projectAddressName = "";
...@@ -220,7 +240,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -220,7 +240,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
} }
} }
peasantHousehold.setProjectAddressName(projectAddressName.substring(0, projectAddressName.length() - 1)); peasantHousehold.setProjectAddressName(projectAddressName.substring(0, projectAddressName.length() - 1));
//常住地址 // 常住地址
String permanentAddressName = ""; String permanentAddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getPermanentAddress()) { for (Integer reg : surveyInfoAllDto.getSurveyInformation().getPermanentAddress()) {
for (RegionModel re : list) { for (RegionModel re : list) {
...@@ -229,35 +249,37 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -229,35 +249,37 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
} }
} }
} }
peasantHousehold.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1)); peasantHousehold
.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1));
if(OPERATION_TYPE_SUBMIT.equals(operationType)){ if (OPERATION_TYPE_SUBMIT.equals(operationType)) {
// peasantHousehold.setSurveyOrNot(1); // peasantHousehold.setSurveyOrNot(1);
}else if(OPERATION_TYPE_APPLY.equals(operationType)){ } else if (OPERATION_TYPE_APPLY.equals(operationType)) {
// 提交审核 // 提交审核
submitExamine(peasantHousehold); submitExamine(peasantHousehold);
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ToDoTasks::getType, TaskTypeStationEnum.电站勘察.getCode()); wrapper.eq(ToDoTasks::getType, TaskTypeStationEnum.电站勘察.getCode());
wrapper.eq(ToDoTasks::getState, "待办"); wrapper.eq(ToDoTasks::getState, "待办");
wrapper.eq(ToDoTasks::getBusinessId, peasantHousehold.getSequenceNbr()); wrapper.eq(ToDoTasks::getBusinessId, peasantHousehold.getSequenceNbr());
ToDoTasks doTasks= toDoTasksMapper.selectOne(wrapper); ToDoTasks doTasks = toDoTasksMapper.selectOne(wrapper);
if(doTasks!=null){ if (doTasks != null) {
doTasks.setState("已办"); doTasks.setState("已办");
doTasks.setCompleteTime(new Date()); doTasks.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTasks); toDoTasksMapper.updateById(doTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(doTasks).getBytes(), 2 ,false); emqKeeper.getMqttClient().publish("TASK_MESSAGE", JSON.toJSONString(doTasks).getBytes(), 2, false);
UserMessage userMessage= new UserMessage( doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName()+"已完成", doTasks.getAmosOrgCode()); UserMessage userMessage = new UserMessage(doTasks.getType(), doTasks.getBusinessId(),
doTasks.getAmosUserId(), new Date(), doTasks.getTaskName() + "已完成",
doTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage); userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false); emqKeeper.getMqttClient().publish("MY_MESSAGE", JSON.toJSONString(userMessage).getBytes(), 2,
false);
} }
} }
peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold); peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold);
} catch (Exception e) {
}catch (Exception e){
e.printStackTrace(); e.printStackTrace();
throw new BadRequest("系统异常"); throw new BadRequest("系统异常");
} }
...@@ -265,24 +287,22 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -265,24 +287,22 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
return surveyInfoAllDto; return surveyInfoAllDto;
} }
public String getNo(String type,Long sequenceNbr) { public String getNo(String type, Long sequenceNbr) {
RegionalCompanies da= regionalCompaniesMapper.selectRegionName(sequenceNbr); RegionalCompanies da = regionalCompaniesMapper.selectRegionName(sequenceNbr);
if(da.getCompanyCode()==null||da.getCompanyCode().isEmpty()){ if (da.getCompanyCode() == null || da.getCompanyCode().isEmpty()) {
throw new BadRequest("区域公司编号为空, 请设置编号"); throw new BadRequest("区域公司编号为空, 请设置编号");
} }
if(da.getRegionalAddress()==null||da.getRegionalAddress().isEmpty()){ if (da.getRegionalAddress() == null || da.getRegionalAddress().isEmpty()) {
throw new BadRequest("区域公司省市区为空, 请设置省市区"); throw new BadRequest("区域公司省市区为空, 请设置省市区");
} }
String code= NumberUtil.getCode(type,da.getCompanyCode(),da.getRegionalAddress()); String code = NumberUtil.getCode(type, da.getCompanyCode(), da.getRegionalAddress());
return code; return code;
} }
private void submitExamine(PeasantHousehold peasantHousehold) { private void submitExamine(PeasantHousehold peasantHousehold) {
PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()),
PowerStationProcessStateEnum.作废.getCode());
PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()), PowerStationProcessStateEnum.作废.getCode());
String taskId = null; String taskId = null;
Map<String, Object> objectMap = new HashMap<>(1); Map<String, Object> objectMap = new HashMap<>(1);
...@@ -291,8 +311,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -291,8 +311,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
// 保存并审核 // 保存并审核
try { try {
BasicGridAcceptance basicGridAcceptance = new BasicGridAcceptance();
BasicGridAcceptance basicGridAcceptance=new BasicGridAcceptance();
if (ObjectUtils.isNotEmpty(powerStation)) { if (ObjectUtils.isNotEmpty(powerStation)) {
// 工作流执行一步 // 工作流执行一步
// taskId = powerStation.getTaskId(); // taskId = powerStation.getTaskId();
...@@ -305,17 +324,17 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -305,17 +324,17 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
workflow.standard(basicGridAcceptance, standardDto, requestContext.getUserId()); workflow.standard(basicGridAcceptance, standardDto, requestContext.getUserId());
} else { } else {
// 第一步启动工作流 // 第一步启动工作流
//发起工作流 // 发起工作流
// 调用工作流执行第一个节点 // 调用工作流执行第一个节点
ProcessDto processDto = new ProcessDto(); ProcessDto processDto = new ProcessDto();
processDto.setBusinessKey(String.valueOf(peasantHousehold.getSequenceNbr())); processDto.setBusinessKey(String.valueOf(peasantHousehold.getSequenceNbr()));
processDto.setProcessDefinitionKey("hygf_10001"); processDto.setProcessDefinitionKey("hygf_10001");
StartProcessDto startProcessDto = new StartProcessDto(); StartProcessDto startProcessDto = new StartProcessDto();
List<ProcessDto> process=new ArrayList<>(); List<ProcessDto> process = new ArrayList<>();
process.add(processDto); process.add(processDto);
startProcessDto.setProcess(process); startProcessDto.setProcess(process);
workflow.startProcess(basicGridAcceptance, startProcessDto,requestContext.getUserId()); workflow.startProcess(basicGridAcceptance, startProcessDto, requestContext.getUserId());
powerStation=new PowerStation(); powerStation = new PowerStation();
} }
peasantHousehold.setSurveyOrNot(2); peasantHousehold.setSurveyOrNot(2);
peasantHousehold.setReview(1); peasantHousehold.setReview(1);
...@@ -338,24 +357,20 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -338,24 +357,20 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
powerStation.setNextExecuteUserIds(basicGridAcceptance.getNextExecuteUserIds()); powerStation.setNextExecuteUserIds(basicGridAcceptance.getNextExecuteUserIds());
powerStation.setNextNodeName(basicGridAcceptance.getNextNodeName()); powerStation.setNextNodeName(basicGridAcceptance.getNextNodeName());
powerStationService.savePowerStation(powerStation, true,powerStation.getOwnersName(),""); powerStationService.savePowerStation(powerStation, true, powerStation.getOwnersName(), "");
// //
peasantHousehold.setConstructionState(ArrivalStateeEnum.勘察中.getCode()); peasantHousehold.setConstructionState(ArrivalStateeEnum.勘察中.getCode());
LambdaUpdateWrapper<PeasantHousehold> up =new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.勘察中.getCode()); up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.勘察中.getCode());
long idsk= peasantHousehold.getSequenceNbr(); long idsk = peasantHousehold.getSequenceNbr();
up.eq(PeasantHousehold::getSequenceNbr,idsk); up.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null,up); peasantHouseholdMapper.update(null, up);
} catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!"); throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!");
} }
// PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()), PowerStationProcessStateEnum.作废.getCode()); // PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()), PowerStationProcessStateEnum.作废.getCode());
// //
// String taskId = null; // String taskId = null;
...@@ -404,65 +419,67 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -404,65 +419,67 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
// } // }
} }
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(); SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
PeasantHousehold peasantHousehold = new PeasantHousehold(); PeasantHousehold peasantHousehold = new PeasantHousehold();
if(!StringUtils.isEmpty(peasantHouseholdId)){ if (!StringUtils.isEmpty(peasantHouseholdId)) {
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);
surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId()); surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId());
}else { } else {
QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>(); QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformationId); peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformationId);
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper); peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper);
} }
//勘察基本信息 // 勘察基本信息
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId); queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
SurveyInformation surveyInformation = this.baseMapper.selectOne(queryWrapper); SurveyInformation surveyInformation = this.baseMapper.selectOne(queryWrapper);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class)); surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
//农户信息 // 农户信息
// 获取用户所在经销商单位
//获取用户所在经销商单位 UserUnitInformationDto userUnitInformationDto = personnelBusinessMapper
UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId()); .getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation()); BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName()); surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName());
surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode()); surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode());
surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId()); surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId());
if(surveyInfoAllDto.getSurveyInformation().getSalesmanId()==null){ if (surveyInfoAllDto.getSurveyInformation().getSalesmanId() == null) {
surveyInfoAllDto.getSurveyInformation().setSalesmanId(peasantHousehold.getDeveloperUserId()); surveyInfoAllDto.getSurveyInformation().setSalesmanId(peasantHousehold.getDeveloperUserId());
surveyInfoAllDto.getSurveyInformation().setSalesman(peasantHousehold.getDeveloper()); surveyInfoAllDto.getSurveyInformation().setSalesman(peasantHousehold.getDeveloper());
surveyInfoAllDto.getSurveyInformation().setCreator(peasantHousehold.getDeveloper()); surveyInfoAllDto.getSurveyInformation().setCreator(peasantHousehold.getDeveloper());
} }
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) { if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation().setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/"))); surveyInfoAllDto.getSurveyInformation()
.setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
} }
if(!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())){ if (!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())) {
surveyInfoAllDto.getSurveyInformation().setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/"))); surveyInfoAllDto.getSurveyInformation()
.setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
} }
if(peasantHousehold.getPermanentAddress() ==null){ if (peasantHousehold.getPermanentAddress() == null) {
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress()); surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1"); surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
} }
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr()); surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
//制单时间 // 制单时间
surveyInfoAllDto.getSurveyInformation().setCreatorTime(surveyInformation.getCreatorTime()); surveyInfoAllDto.getSurveyInformation().setCreatorTime(surveyInformation.getCreatorTime());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>(); QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId); surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper); SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
if(surveyDetails == null){ if (surveyDetails == null) {
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto()); surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
}else { } else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class)); surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
} }
...@@ -473,15 +490,19 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -473,15 +490,19 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
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();
} }
if(information == null){ if (information == null) {
surveyInfoAllDto.setInformation(new InformationDto()); surveyInfoAllDto.setInformation(new InformationDto());
}else { } else {
information.setHouseProve(null == commercial ?new ArrayList<>() :(CollectionUtil.isNotEmpty(commercial.getRealEstateLegal())? commercial.getRealEstateLegal():new ArrayList<>())); information.setHouseProve(null == commercial ? new ArrayList<>()
information.setCardFile( null == commercial ?new ArrayList<>() :(CollectionUtil.isNotEmpty(commercial.getIdCardCredit())? commercial.getIdCardCredit():new ArrayList<>())); : (CollectionUtil.isNotEmpty(commercial.getRealEstateLegal()) ? commercial.getRealEstateLegal()
: new ArrayList<>()));
information.setCardFile(null == commercial ? new ArrayList<>()
: (CollectionUtil.isNotEmpty(commercial.getIdCardCredit()) ? commercial.getIdCardCredit()
: new ArrayList<>()));
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class)); surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
} }
...@@ -494,158 +515,171 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -494,158 +515,171 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
commercial.setLegalContactTelephone(peasantHousehold.getTelephone()); commercial.setLegalContactTelephone(peasantHousehold.getTelephone());
List<Object> list = new ArrayList<>(); List<Object> list = new ArrayList<>();
if (null != surveyDetails){ if (null != surveyDetails) {
if (CollectionUtil.isNotEmpty(surveyDetails.getSurroundingHouseSurvey())){ if (CollectionUtil.isNotEmpty(surveyDetails.getSurroundingHouseSurvey())) {
list.addAll(surveyDetails.getSurroundingHouseSurvey()); list.addAll(surveyDetails.getSurroundingHouseSurvey());
} }
if (CollectionUtil.isNotEmpty(surveyDetails.getOverallHousingSurvey())){ if (CollectionUtil.isNotEmpty(surveyDetails.getOverallHousingSurvey())) {
list.addAll(surveyDetails.getOverallHousingSurvey()); list.addAll(surveyDetails.getOverallHousingSurvey());
} }
if (CollectionUtil.isNotEmpty(surveyDetails.getPanoramaSurvey())){ if (CollectionUtil.isNotEmpty(surveyDetails.getPanoramaSurvey())) {
list.addAll(surveyDetails.getPanoramaSurvey()); list.addAll(surveyDetails.getPanoramaSurvey());
} }
if (CollectionUtil.isNotEmpty(surveyDetails.getPlanSketchSurvey())){ if (CollectionUtil.isNotEmpty(surveyDetails.getPlanSketchSurvey())) {
list.addAll(surveyDetails.getPlanSketchSurvey()); list.addAll(surveyDetails.getPlanSketchSurvey());
} }
if (CollectionUtil.isNotEmpty(surveyDetails.getAzimuthSurvey())){ if (CollectionUtil.isNotEmpty(surveyDetails.getAzimuthSurvey())) {
list.addAll(surveyDetails.getAzimuthSurvey()); list.addAll(surveyDetails.getAzimuthSurvey());
} }
} }
commercial.setSurveyPhotosWeb(list); commercial.setSurveyPhotosWeb(list);
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().setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/"))); surveyInfoAllDto.getCommercial()
.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);
if (information == null) {
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto()); surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
}else { } else {
surveyInfoAllDto.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().selectOne(designInformationQueryWrapper); DesignInformation designInformation = designInformationService.getBaseMapper()
if(designInformation == null){ .selectOne(designInformationQueryWrapper);
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<WorkOrderPowerStation> up1 = new LambdaQueryWrapper();
LambdaQueryWrapper<WorkOrderPowerStation> up1=new LambdaQueryWrapper(); up1.eq(WorkOrderPowerStation::getPeasantHouseholdId, peasantHouseholdId);
up1.eq(WorkOrderPowerStation::getPeasantHouseholdId,peasantHouseholdId); WorkOrderPowerStation workOrderPowerStation = workOrderPowerStationMapper.selectOne(up1);
WorkOrderPowerStation workOrderPowerStation= workOrderPowerStationMapper.selectOne(up1); if (workOrderPowerStation != null) {
if(workOrderPowerStation!=null){ Long workOrderId = workOrderPowerStation.getWorkOrderId();
Long workOrderId=workOrderPowerStation.getWorkOrderId(); Long workOrderPowerStationId = workOrderPowerStation.getSequenceNbr();
Long workOrderPowerStationId=workOrderPowerStation.getSequenceNbr();
// 派工单信息
//派工单信息 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
PowerStationConstructionData powerStationConstructionData=powerStationConstructionDataMapper.selectOne(up2); .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
.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
powerStationEngineeringInfo.setConstructionCollectorBoxInfo(
powerStationConstructionData.getConstructionCollectorBoxInfo());
powerStationEngineeringInfo
.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager()); powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager());
powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone()); powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone());
powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager()); powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager());
powerStationEngineeringInfo.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone()); powerStationEngineeringInfo
} .setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone());
//并网信息 }
LambdaQueryWrapper<HygfOnGrid> up4=new LambdaQueryWrapper(); // 并网信息
up4.eq(HygfOnGrid::getWorkOrderId,workOrderId); LambdaQueryWrapper<HygfOnGrid> up4 = new LambdaQueryWrapper();
up4.eq(HygfOnGrid::getWorkOrderPowerStationId,workOrderPowerStationId); up4.eq(HygfOnGrid::getWorkOrderId, workOrderId);
HygfOnGrid hygfOnGrid=hygfOnGridMapper.selectOne(up4); up4.eq(HygfOnGrid::getWorkOrderPowerStationId, workOrderPowerStationId);
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid!=null?hygfOnGrid:new HygfOnGrid()); HygfOnGrid hygfOnGrid = hygfOnGridMapper.selectOne(up4);
surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData!=null?powerStationConstructionData:new PowerStationConstructionData()); surveyInfoAllDto.setHygfOnGrid(hygfOnGrid != null ? hygfOnGrid : new HygfOnGrid());
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo!=null?powerStationEngineeringInfo:new PowerStationEngineeringInfo()); surveyInfoAllDto
surveyInfoAllDto.setWorkOrder(workOrder!=null?workOrder:new WorkOrder()); .setPowerStationConstructionData(powerStationConstructionData != null ? powerStationConstructionData
}else{ : new PowerStationConstructionData());
surveyInfoAllDto
.setPowerStationEngineeringInfo(powerStationEngineeringInfo != null ? powerStationEngineeringInfo
: new PowerStationEngineeringInfo());
surveyInfoAllDto.setWorkOrder(workOrder != null ? workOrder : new WorkOrder());
} else {
surveyInfoAllDto.setHygfOnGrid(new HygfOnGrid()); surveyInfoAllDto.setHygfOnGrid(new HygfOnGrid());
surveyInfoAllDto.setPowerStationConstructionData(new PowerStationConstructionData()); surveyInfoAllDto.setPowerStationConstructionData(new PowerStationConstructionData());
surveyInfoAllDto.setPowerStationEngineeringInfo(new PowerStationEngineeringInfo()); surveyInfoAllDto.setPowerStationEngineeringInfo(new PowerStationEngineeringInfo());
surveyInfoAllDto.setWorkOrder(new WorkOrder()); surveyInfoAllDto.setWorkOrder(new WorkOrder());
} }
if (!StringUtils.isEmpty(processInstanceId)) {
if(!StringUtils.isEmpty(processInstanceId)){
try { try {
Map<String, Object> flowLoggerMap = workflowFeignClient.getFlowLogger(processInstanceId).getResult(); Map<String, Object> flowLoggerMap = workflowFeignClient.getFlowLogger(processInstanceId).getResult();
List<LinkedHashMap> flowLogger = (List<LinkedHashMap>) flowLoggerMap.get("flowLogger"); List<LinkedHashMap> flowLogger = (List<LinkedHashMap>) flowLoggerMap.get("flowLogger");
if (flowLogger.size() > 0 ){ if (flowLogger.size() > 0) {
Collections.reverse(flowLogger); Collections.reverse(flowLogger);
} }
List<LinkedHashMap> flowLoggernew =new ArrayList<>(); List<LinkedHashMap> flowLoggernew = new ArrayList<>();
for (LinkedHashMap linkedHashMap : flowLogger) { for (LinkedHashMap linkedHashMap : flowLogger) {
if(linkedHashMap.get("operateDate")!=null&&!linkedHashMap.get("operateDate").toString().isEmpty()){ if (linkedHashMap.get("operateDate") != null
LinkedHashMap linke=new LinkedHashMap(); && !linkedHashMap.get("operateDate").toString().isEmpty()) {
linke.put("approvalStatue",linkedHashMap.get("approvalStatue").toString()); LinkedHashMap linke = new LinkedHashMap();
//审核意见 linke.put("approvalStatue", linkedHashMap.get("approvalStatue").toString());
List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>)linkedHashMap.get("approvalSuggestion"); // 审核意见
if(approvalSuggestion!=null&&!approvalSuggestion.isEmpty()){ List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>) linkedHashMap
linke.put("approvalSuggestion",approvalSuggestion.get(0).get("message")); .get("approvalSuggestion");
} if (approvalSuggestion != null && !approvalSuggestion.isEmpty()) {
linke.put("taskName",linkedHashMap.get("taskName").toString()); linke.put("approvalSuggestion", approvalSuggestion.get(0).get("message"));
linke.put("operator",linkedHashMap.get("operator").toString()); }
linke.put("operateDate",linkedHashMap.get("operateDate").toString()); linke.put("taskName", linkedHashMap.get("taskName").toString());
linke.put("operator", linkedHashMap.get("operator").toString());
linke.put("operateDate", linkedHashMap.get("operateDate").toString());
flowLoggernew.add(linke); flowLoggernew.add(linke);
} }
} }
LoggerDto loggerDto =new LoggerDto(); LoggerDto loggerDto = new LoggerDto();
loggerDto.setLogger(flowLoggernew); loggerDto.setLogger(flowLoggernew);
surveyInfoAllDto.setOrderTracking(loggerDto); surveyInfoAllDto.setOrderTracking(loggerDto);
} catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
return surveyInfoAllDto; return surveyInfoAllDto;
} }
public JSONArray getRegionName() {
public JSONArray getRegionName(){
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
if (redisUtils.hasKey(regionRedis)) { if (redisUtils.hasKey(regionRedis)) {
jsonArray= JSONArray.parseArray(redisUtils.get(regionRedis).toString()); jsonArray = JSONArray.parseArray(redisUtils.get(regionRedis).toString());
}else { } else {
Collection<RegionModel> regionChild = new ArrayList<>(); Collection<RegionModel> regionChild = new ArrayList<>();
RegionModel regionModel1 = new RegionModel(); RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1); regionChild.add(regionModel1);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L); FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient
.queryForTreeParent(610000L);
Collection<RegionModel> result = collectionFeignClientResult.getResult(); Collection<RegionModel> result = collectionFeignClientResult.getResult();
for (RegionModel regionModel : result) { for (RegionModel regionModel : result) {
if(regionModel.getChildren()!=null&&!regionModel.getChildren().isEmpty()){ if (regionModel.getChildren() != null && !regionModel.getChildren().isEmpty()) {
for (RegionModel child : regionModel.getChildren()) { for (RegionModel child : regionModel.getChildren()) {
if(child.getChildren()!=null&&!child.getChildren().isEmpty()){ if (child.getChildren() != null && !child.getChildren().isEmpty()) {
for (RegionModel childChild : child.getChildren()) { for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild); jsonArray.add(childChild);
} }
...@@ -660,7 +694,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -660,7 +694,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
jsonArray.add(regionModel); jsonArray.add(regionModel);
} }
redisUtils.set(regionRedis,jsonArray); redisUtils.set(regionRedis, jsonArray);
} }
return jsonArray; return jsonArray;
} }
......
...@@ -33,7 +33,8 @@ import java.util.*; ...@@ -33,7 +33,8 @@ 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 @Autowired
RegionalCompaniesMapper regionalCompaniesMapper; RegionalCompaniesMapper regionalCompaniesMapper;
...@@ -50,7 +51,6 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -50,7 +51,6 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
@Autowired @Autowired
PowerStationConstructionDataServiceImpl powerStationConstructionDataService; PowerStationConstructionDataServiceImpl powerStationConstructionDataService;
@Autowired @Autowired
SurveyDetailsServiceImpl surveyDetailsService; SurveyDetailsServiceImpl surveyDetailsService;
...@@ -92,7 +92,6 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -92,7 +92,6 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
@Autowired @Autowired
WorkflowFeignClient workflowFeignClient; WorkflowFeignClient workflowFeignClient;
@Autowired @Autowired
PeasantHouseholdMapper peasantHouseholdMapper; PeasantHouseholdMapper peasantHouseholdMapper;
...@@ -107,35 +106,33 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -107,35 +106,33 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
* 列表查询 示例 * 列表查询 示例
*/ */
public List<WorkOrderDto> queryForWorkOrderList() { public List<WorkOrderDto> queryForWorkOrderList() {
return this.queryForList("" , false); return this.queryForList("", false);
} }
@Transactional @Transactional
public WorkOrder saveWorkOrder (WorkOrder model, UserUnitInformationDto userUnitInformationDto) { public WorkOrder saveWorkOrder(WorkOrder model, UserUnitInformationDto userUnitInformationDto) {
//保存派工单 // 保存派工单
RegionalCompanies regionalCompanies= regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId()); RegionalCompanies regionalCompanies = regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId());
String code= NumberUtil.getCode(CodeEnum.派工单.getCode(),regionalCompanies.getCompanyCode(),regionalCompanies.getRegionalAddress()); String code = NumberUtil.getCode(CodeEnum.派工单.getCode(), regionalCompanies.getCompanyCode(),
regionalCompanies.getRegionalAddress());
model.setWorkOrderNum(code); model.setWorkOrderNum(code);
model.setRegionCompanyName(regionalCompanies.getRegionalCompaniesName()); model.setRegionCompanyName(regionalCompanies.getRegionalCompaniesName());
model.setRegionCode(regionalCompanies.getRegionalCompaniesCode()); model.setRegionCode(regionalCompanies.getRegionalCompaniesCode());
model.setWorkOrderStatus(WorkOrderEnum.待施工.getCode()); model.setWorkOrderStatus(WorkOrderEnum.待施工.getCode());
model.setRegionAddress(regionalCompanies.getRegionalAddress()); model.setRegionAddress(regionalCompanies.getRegionalAddress());
//获取经销商单位信息 // 获取经销商单位信息
model.setAmosDealerId(userUnitInformationDto.getAmosDealerId()); model.setAmosDealerId(userUnitInformationDto.getAmosDealerId());
model.setAmosDealerName(userUnitInformationDto.getAmosDealerName()); model.setAmosDealerName(userUnitInformationDto.getAmosDealerName());
model.setAmosDealerOrgCode(userUnitInformationDto.getAmosDealerOrgCode()); model.setAmosDealerOrgCode(userUnitInformationDto.getAmosDealerOrgCode());
workOrderMapper.insert(model); workOrderMapper.insert(model);
//保存派工单 电站信息 // 保存派工单 电站信息
List<PeasantHousehold> peasantHouseholdId=model.getPeasantHouseholdId(); List<PeasantHousehold> peasantHouseholdId = model.getPeasantHouseholdId();
List<ConstructionRecords> constructionRecordlist=new ArrayList<>(); List<ConstructionRecords> constructionRecordlist = new ArrayList<>();
List<WorkOrderPowerStation> li=new ArrayList<>(); List<WorkOrderPowerStation> li = new ArrayList<>();
for (PeasantHousehold peasantHousehold : peasantHouseholdId) { for (PeasantHousehold peasantHousehold : peasantHouseholdId) {
WorkOrderPowerStation workOrderPowerStation=new WorkOrderPowerStation(); WorkOrderPowerStation workOrderPowerStation = new WorkOrderPowerStation();
workOrderPowerStation.setPeasantHouseholdId(peasantHousehold.getSequenceNbr()); workOrderPowerStation.setPeasantHouseholdId(peasantHousehold.getSequenceNbr());
workOrderPowerStation.setWorkOrderId(model.getSequenceNbr()); workOrderPowerStation.setWorkOrderId(model.getSequenceNbr());
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待施工.getCode()); workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待施工.getCode());
...@@ -145,45 +142,39 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -145,45 +142,39 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
workOrderPowerStationServiceImpl.saveBatch(li); workOrderPowerStationServiceImpl.saveBatch(li);
for (WorkOrderPowerStation workOrderPowerStation : li) { for (WorkOrderPowerStation workOrderPowerStation : li) {
//增加操作日志 // 增加操作日志
ConstructionRecords da=new ConstructionRecords( ConstructionRecords da = new ConstructionRecords(workOrderPowerStation.getRecUserName(), "新建派工单",
workOrderPowerStation.getRecUserName(), new Date(), "", workOrderPowerStation.getWorkOrderId(), workOrderPowerStation.getSequenceNbr(),
"新建派工单", workOrderPowerStation.getPeasantHouseholdId(), "");
new Date(),
"",
workOrderPowerStation.getWorkOrderId(),
workOrderPowerStation.getSequenceNbr(),
workOrderPowerStation.getPeasantHouseholdId(),
"");
constructionRecordlist.add(da); constructionRecordlist.add(da);
} }
constructionRecordsServiceImpl.saveBatch(constructionRecordlist); constructionRecordsServiceImpl.saveBatch(constructionRecordlist);
return model; return model;
} }
@Transactional @Transactional
public WorkOrder updateWorkOrder (WorkOrder model, UserUnitInformationDto userUnitInformationDto) { public WorkOrder updateWorkOrder(WorkOrder model, UserUnitInformationDto userUnitInformationDto) {
//保存派工单 // 保存派工单
RegionalCompanies regionalCompanies= regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId()); RegionalCompanies regionalCompanies = regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId());
model.setRegionCompanyName(regionalCompanies.getRegionalCompaniesName()); model.setRegionCompanyName(regionalCompanies.getRegionalCompaniesName());
model.setRegionCode(regionalCompanies.getRegionalCompaniesCode()); model.setRegionCode(regionalCompanies.getRegionalCompaniesCode());
model.setWorkOrderStatus(WorkOrderEnum.待施工.getCode()); model.setWorkOrderStatus(WorkOrderEnum.待施工.getCode());
model.setRegionAddress(regionalCompanies.getRegionalAddress()); model.setRegionAddress(regionalCompanies.getRegionalAddress());
//获取经销商单位信息 // 获取经销商单位信息
model.setAmosDealerId(userUnitInformationDto.getAmosDealerId()); model.setAmosDealerId(userUnitInformationDto.getAmosDealerId());
model.setAmosDealerName(userUnitInformationDto.getAmosDealerName()); model.setAmosDealerName(userUnitInformationDto.getAmosDealerName());
model.setAmosDealerOrgCode(userUnitInformationDto.getAmosDealerOrgCode()); model.setAmosDealerOrgCode(userUnitInformationDto.getAmosDealerOrgCode());
workOrderMapper.updateById(model); workOrderMapper.updateById(model);
LambdaQueryWrapper<WorkOrderPowerStation> up=new LambdaQueryWrapper(); LambdaQueryWrapper<WorkOrderPowerStation> up = new LambdaQueryWrapper();
up.eq(WorkOrderPowerStation::getWorkOrderId,model.getSequenceNbr()); up.eq(WorkOrderPowerStation::getWorkOrderId, model.getSequenceNbr());
workOrderPowerStationMapper.delete(up); workOrderPowerStationMapper.delete(up);
//保存派工单 电站信息 // 保存派工单 电站信息
List<PeasantHousehold> peasantHouseholdId=model.getPeasantHouseholdId(); List<PeasantHousehold> peasantHouseholdId = model.getPeasantHouseholdId();
List<WorkOrderPowerStation> li=new ArrayList<>(); List<WorkOrderPowerStation> li = new ArrayList<>();
for (PeasantHousehold peasantHousehold : peasantHouseholdId) { for (PeasantHousehold peasantHousehold : peasantHouseholdId) {
WorkOrderPowerStation workOrderPowerStation=new WorkOrderPowerStation(); WorkOrderPowerStation workOrderPowerStation = new WorkOrderPowerStation();
workOrderPowerStation.setPeasantHouseholdId(peasantHousehold.getSequenceNbr()); workOrderPowerStation.setPeasantHouseholdId(peasantHousehold.getSequenceNbr());
workOrderPowerStation.setWorkOrderId(model.getSequenceNbr()); workOrderPowerStation.setWorkOrderId(model.getSequenceNbr());
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待施工.getCode()); workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待施工.getCode());
...@@ -191,165 +182,133 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -191,165 +182,133 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
} }
workOrderPowerStationServiceImpl.saveBatch(li); workOrderPowerStationServiceImpl.saveBatch(li);
List<ConstructionRecords> constructionRecordlist=new ArrayList<>(); List<ConstructionRecords> constructionRecordlist = new ArrayList<>();
for (WorkOrderPowerStation workOrderPowerStation : li) { for (WorkOrderPowerStation workOrderPowerStation : li) {
//增加操作日志 // 增加操作日志
ConstructionRecords da=new ConstructionRecords( ConstructionRecords da = new ConstructionRecords(workOrderPowerStation.getRecUserName(), "编辑派工单",
workOrderPowerStation.getRecUserName(), new Date(), "", workOrderPowerStation.getWorkOrderId(), workOrderPowerStation.getSequenceNbr(),
"编辑派工单", workOrderPowerStation.getPeasantHouseholdId(), "");
new Date(),
"",
workOrderPowerStation.getWorkOrderId(),
workOrderPowerStation.getSequenceNbr(),
workOrderPowerStation.getPeasantHouseholdId(),
"");
constructionRecordlist.add(da); constructionRecordlist.add(da);
} }
constructionRecordsServiceImpl.saveBatch(constructionRecordlist); constructionRecordsServiceImpl.saveBatch(constructionRecordlist);
return model; return model;
} }
public WorkOrder selectOne(Long sequenceNbr) { public WorkOrder selectOne(Long sequenceNbr) {
WorkOrder model= workOrderMapper.selectById(sequenceNbr); WorkOrder model = workOrderMapper.selectById(sequenceNbr);
List<PeasantHousehold> li=workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr,null); List<PeasantHousehold> li = workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr, null);
model.setPeasantHouseholdId(li); model.setPeasantHouseholdId(li);
return model; return model;
} }
public Map<String,Object> selectOneall(Long sequenceNbr) { public Map<String, Object> selectOneall(Long sequenceNbr) {
WorkOrder model= workOrderMapper.selectById(sequenceNbr); WorkOrder model = workOrderMapper.selectById(sequenceNbr);
List<PeasantHousehold> lih=workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr,null); List<PeasantHousehold> lih = workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr, null);
// 获取所有电站Bom,分组合并,暂时不相加
List<Long> ids = new ArrayList<>();
//获取所有电站Bom,分组合并,暂时不相加
List<Long> ids=new ArrayList<>();
for (PeasantHousehold documentStation : lih) { for (PeasantHousehold documentStation : lih) {
ids.add(documentStation.getSequenceNbr()); ids.add(documentStation.getSequenceNbr());
} }
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>(); QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.in("peasant_household_id", ids); designInformationQueryWrapper.in("peasant_household_id", ids);
List<DesignInformation> li = designInformationMapper.selectList(designInformationQueryWrapper); List<DesignInformation> li = designInformationMapper.selectList(designInformationQueryWrapper);
DesignInformation designInformation=new DesignInformation(); DesignInformation designInformation = new DesignInformation();
//组件 // 组件
List<Object> assembly=new ArrayList<>(); List<Object> assembly = new ArrayList<>();
//逆变器 // 逆变器
List<Object> inverter=new ArrayList<>(); List<Object> inverter = new ArrayList<>();
//电表箱 // 电表箱
List<Object> electricityMeter=new ArrayList<>(); List<Object> electricityMeter = new ArrayList<>();
//电缆 // 电缆
List<Object> cable=new ArrayList<>(); List<Object> cable = new ArrayList<>();
for (DesignInformation des : li) { for (DesignInformation des : li) {
if(des.getAssembly()!=null&&!des.getAssembly().isEmpty()){ if (des.getAssembly() != null && !des.getAssembly().isEmpty()) {
assembly.addAll(des.getAssembly()); assembly.addAll(des.getAssembly());
} }
if(des.getInverter()!=null&&!des.getInverter().isEmpty()){ if (des.getInverter() != null && !des.getInverter().isEmpty()) {
inverter.addAll(des.getInverter()); inverter.addAll(des.getInverter());
} }
if(des.getElectricityMeter()!=null&&!des.getElectricityMeter().isEmpty()){ if (des.getElectricityMeter() != null && !des.getElectricityMeter().isEmpty()) {
electricityMeter.addAll(des.getElectricityMeter()); electricityMeter.addAll(des.getElectricityMeter());
} }
if(des.getCable()!=null&&!des.getCable().isEmpty()){ if (des.getCable() != null && !des.getCable().isEmpty()) {
cable.addAll(des.getCable()); cable.addAll(des.getCable());
} }
} }
List<PeasantHousehold> list=workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr,null); List<PeasantHousehold> list = workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr, null);
Map<String,Object> map =new HashMap<>(); Map<String, Object> map = new HashMap<>();
designInformation.setAssembly(assembly); designInformation.setAssembly(assembly);
designInformation.setInverter(inverter); designInformation.setInverter(inverter);
designInformation.setElectricityMeter(electricityMeter); designInformation.setElectricityMeter(electricityMeter);
designInformation.setCable(cable); designInformation.setCable(cable);
map.put("workOrder",model); map.put("workOrder", model);
map.put("designInformation",designInformation); map.put("designInformation", designInformation);
map.put("peasantHousehold",list); map.put("peasantHousehold", list);
return map; return map;
} }
@Transactional @Transactional
public PowerStationConstructionData addOrUpdate(PowerStationConstructionData powerStationConstructionData){ 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<>(); // 施工完成
LambdaUpdateWrapper<PeasantHousehold> up1 = new LambdaUpdateWrapper<>();
up1.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.并网完成.getCode()); up1.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.并网完成.getCode());
long idsk= basicGridAcceptanc.getPeasantHouseholdId(); long idsk = basicGridAcceptanc.getPeasantHouseholdId();
up1.eq(PeasantHousehold::getSequenceNbr,idsk); up1.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null,up1); peasantHouseholdMapper.update(null, up1);
} }
workOrderPowerStationMapper.update(null,up); workOrderPowerStationMapper.update(null, up);
//修改派工单状态 // 修改派工单状态
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper(); LambdaQueryWrapper<WorkOrderPowerStation> qu = new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getWorkOrderId,powerStationConstructionData.getWorkOrderId()); qu.eq(WorkOrderPowerStation::getWorkOrderId, powerStationConstructionData.getWorkOrderId());
List<String> d=new ArrayList<>(); List<String> d = new ArrayList<>();
d.add(WorkOrderEnum.施工中.getCode()); d.add(WorkOrderEnum.施工中.getCode());
d.add(WorkOrderEnum.待施工.getCode()); d.add(WorkOrderEnum.待施工.getCode());
qu.in(WorkOrderPowerStation::getPowerStationConstructionStatus,d); qu.in(WorkOrderPowerStation::getPowerStationConstructionStatus, d);
List<WorkOrderPowerStation> list=workOrderPowerStationMapper.selectList(qu); 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(),
"编辑施工资料",
new Date(),
"",
powerStationConstructionData.getWorkOrderId(),
powerStationConstructionData.getWorkOrderPowerStationId(),
null,
"");
constructionRecordsServiceImpl.save(da); constructionRecordsServiceImpl.save(da);
} else {
}else{ ConstructionRecords da = new ConstructionRecords(powerStationConstructionData.getRecUserName(), "新增施工资料",
ConstructionRecords da=new ConstructionRecords( new Date(), "", powerStationConstructionData.getWorkOrderId(),
powerStationConstructionData.getRecUserName(), powerStationConstructionData.getWorkOrderPowerStationId(), null, "");
"新增施工资料",
new Date(),
"",
powerStationConstructionData.getWorkOrderId(),
powerStationConstructionData.getWorkOrderPowerStationId(),
null,
"");
constructionRecordsServiceImpl.save(da); constructionRecordsServiceImpl.save(da);
} }
// }else{ // }else{
// //修改施工电站状态 // //修改施工电站状态
// LambdaUpdateWrapper<WorkOrderPowerStation> up=new LambdaUpdateWrapper(); // LambdaUpdateWrapper<WorkOrderPowerStation> up=new LambdaUpdateWrapper();
...@@ -380,17 +339,12 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -380,17 +339,12 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
// //
// } // }
return powerStationConstructionData; return powerStationConstructionData;
} }
public Page<WorkOrder> selectPage(int pageNum, int pageSize, WorkOrder workOrder) {
public Page<WorkOrder> selectPage( int pageNum,int pageSize, WorkOrder workOrder){
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
List<WorkOrder> list=workOrderMapper.selectWorkOrderList(workOrder); List<WorkOrder> list = workOrderMapper.selectWorkOrderList(workOrder);
PageInfo<WorkOrder> page = new PageInfo(list); PageInfo<WorkOrder> page = new PageInfo(list);
Page<WorkOrder> pagenew = new Page<WorkOrder>(); Page<WorkOrder> pagenew = new Page<WorkOrder>();
pagenew.setCurrent(pageNum); pagenew.setCurrent(pageNum);
...@@ -400,10 +354,9 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -400,10 +354,9 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
return pagenew; return pagenew;
} }
public Page<WorkOrderPage> queryForwgpage(int pageNum, int pageSize, WorkOrderPage workOrder) {
public Page<WorkOrderPage> queryForwgpage( int pageNum,int pageSize, WorkOrderPage workOrder){
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
List<WorkOrderPage> list=workOrderMapper.queryForwgpage(workOrder); List<WorkOrderPage> list = workOrderMapper.queryForwgpage(workOrder);
PageInfo<WorkOrderPage> page = new PageInfo(list); PageInfo<WorkOrderPage> page = new PageInfo(list);
Page<WorkOrderPage> pagenew = new Page<WorkOrderPage>(); Page<WorkOrderPage> pagenew = new Page<WorkOrderPage>();
pagenew.setCurrent(pageNum); pagenew.setCurrent(pageNum);
...@@ -413,8 +366,7 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -413,8 +366,7 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
return pagenew; return pagenew;
} }
public SurveyInfoAllDto getsurveyQueryxq(Long peasantHouseholdId, Long workOrderId, Long workOrderPowerStationId) {
public SurveyInfoAllDto getsurveyQueryxq(Long peasantHouseholdId,Long workOrderId,Long workOrderPowerStationId) {
SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto(); SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
PeasantHousehold peasantHousehold = new PeasantHousehold(); PeasantHousehold peasantHousehold = new PeasantHousehold();
...@@ -424,27 +376,30 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -424,27 +376,30 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper); peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper);
String surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId()); String surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId());
//勘察基本信息 // 勘察基本信息
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId); queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
SurveyInformation surveyInformation = surveyInformationMapper.selectOne(queryWrapper); SurveyInformation surveyInformation = surveyInformationMapper.selectOne(queryWrapper);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class)); surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
//农户信息 // 农户信息
//获取用户所在经销商单位 // 获取用户所在经销商单位
UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId()); UserUnitInformationDto userUnitInformationDto = personnelBusinessMapper
.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation()); BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName()); surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName());
surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode()); surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode());
surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId()); surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId());
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) { if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation().setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/"))); surveyInfoAllDto.getSurveyInformation()
.setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
} }
if(!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())){ if (!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())) {
surveyInfoAllDto.getSurveyInformation().setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/"))); surveyInfoAllDto.getSurveyInformation()
.setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
} }
if(peasantHousehold.getPermanentAddress() ==null){ if (peasantHousehold.getPermanentAddress() == null) {
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress()); surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1"); surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
} }
...@@ -453,24 +408,24 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -453,24 +408,24 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId); surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper); SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
if(surveyDetails == null){ if (surveyDetails == null) {
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto()); surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
}else { } else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class)); surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
} }
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 {
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class)); surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.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());
...@@ -479,83 +434,89 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -479,83 +434,89 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
commercial.setProjectAddressName(peasantHousehold.getProjectAddressName()); commercial.setProjectAddressName(peasantHousehold.getProjectAddressName());
commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail()); commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail());
commercial.setLegalContactTelephone(peasantHousehold.getTelephone()); commercial.setLegalContactTelephone(peasantHousehold.getTelephone());
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().setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/"))); surveyInfoAllDto.getCommercial()
.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);
if (information == null) {
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto()); surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
}else { } else {
surveyInfoAllDto.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().selectOne(designInformationQueryWrapper); DesignInformation designInformation = designInformationService.getBaseMapper()
if(designInformation == null){ .selectOne(designInformationQueryWrapper);
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
.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
powerStationEngineeringInfo
.setConstructionCollectorBoxInfo(powerStationConstructionData.getConstructionCollectorBoxInfo());
powerStationEngineeringInfo
.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager()); powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager());
powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone()); powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone());
powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager()); powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager());
powerStationEngineeringInfo.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone()); powerStationEngineeringInfo
.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone());
} }
// 施工自审
LambdaQueryWrapper<ConstructionRecords> up5 = new LambdaQueryWrapper();
//施工自审 up5.eq(ConstructionRecords::getWorkOrderId, workOrderId);
LambdaQueryWrapper<ConstructionRecords> up5=new LambdaQueryWrapper(); up5.eq(ConstructionRecords::getWorkOrderPowerStationId, workOrderPowerStationId);
up5.eq(ConstructionRecords::getWorkOrderId,workOrderId);
up5.eq(ConstructionRecords::getWorkOrderPowerStationId,workOrderPowerStationId);
up5.orderByAsc(ConstructionRecords::getRecDate); up5.orderByAsc(ConstructionRecords::getRecDate);
List<ConstructionRecords> li=constructionRecordsMapper.selectList(up5); List<ConstructionRecords> li = constructionRecordsMapper.selectList(up5);
ConstructionRecords data=new ConstructionRecords(); ConstructionRecords data = new ConstructionRecords();
data.setConstructionRecordsList(li); data.setConstructionRecordsList(li);
surveyInfoAllDto.setConstructionRecords(data); surveyInfoAllDto.setConstructionRecords(data);
// 并网信息
LambdaQueryWrapper<HygfOnGrid> up4 = new LambdaQueryWrapper();
//并网信息 up4.eq(HygfOnGrid::getWorkOrderId, workOrderId);
LambdaQueryWrapper<HygfOnGrid> up4=new LambdaQueryWrapper(); up4.eq(HygfOnGrid::getWorkOrderPowerStationId, workOrderPowerStationId);
up4.eq(HygfOnGrid::getWorkOrderId,workOrderId); HygfOnGrid hygfOnGrid = hygfOnGridMapper.selectOne(up4);
up4.eq(HygfOnGrid::getWorkOrderPowerStationId,workOrderPowerStationId); surveyInfoAllDto.setHygfOnGrid(hygfOnGrid != null ? hygfOnGrid : new HygfOnGrid());
HygfOnGrid hygfOnGrid=hygfOnGridMapper.selectOne(up4);
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid!=null?hygfOnGrid:new HygfOnGrid());
surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData); surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData);
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo); surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo);
surveyInfoAllDto.setWorkOrder(workOrder); surveyInfoAllDto.setWorkOrder(workOrder);
...@@ -565,11 +526,11 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -565,11 +526,11 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
public PowerStationEngineeringInfoAllDto getPowerStationEngineeringInfo(Long workOrderPowerStationId) { public PowerStationEngineeringInfoAllDto getPowerStationEngineeringInfo(Long workOrderPowerStationId) {
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper(); LambdaQueryWrapper<WorkOrderPowerStation> qu = new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getSequenceNbr,workOrderPowerStationId); qu.eq(WorkOrderPowerStation::getSequenceNbr, workOrderPowerStationId);
WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu); WorkOrderPowerStation workOrderPowerStation = workOrderPowerStationMapper.selectOne(qu);
Long peasantHouseholdId=workOrderPowerStation.getPeasantHouseholdId(); Long peasantHouseholdId = workOrderPowerStation.getPeasantHouseholdId();
Long workOrderId=workOrderPowerStation.getWorkOrderId(); Long workOrderId = workOrderPowerStation.getWorkOrderId();
PowerStationEngineeringInfoAllDto surveyInfoAllDto = new PowerStationEngineeringInfoAllDto(); PowerStationEngineeringInfoAllDto surveyInfoAllDto = new PowerStationEngineeringInfoAllDto();
PeasantHousehold peasantHousehold = new PeasantHousehold(); PeasantHousehold peasantHousehold = new PeasantHousehold();
...@@ -579,27 +540,30 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -579,27 +540,30 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper); peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper);
String surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId()); String surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId());
//勘察基本信息 // 勘察基本信息
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId); queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
SurveyInformation surveyInformation = surveyInformationMapper.selectOne(queryWrapper); SurveyInformation surveyInformation = surveyInformationMapper.selectOne(queryWrapper);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class)); surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
//农户信息 // 农户信息
//获取用户所在经销商单位 // 获取用户所在经销商单位
UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId()); UserUnitInformationDto userUnitInformationDto = personnelBusinessMapper
.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation()); BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName()); surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName());
surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode()); surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode());
surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId()); surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId());
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) { if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation().setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/"))); surveyInfoAllDto.getSurveyInformation()
.setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
} }
if(!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())){ if (!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())) {
surveyInfoAllDto.getSurveyInformation().setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/"))); surveyInfoAllDto.getSurveyInformation()
.setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
} }
if(peasantHousehold.getPermanentAddress() ==null){ if (peasantHousehold.getPermanentAddress() == null) {
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress()); surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1"); surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
} }
...@@ -608,9 +572,9 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -608,9 +572,9 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId); surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper); SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
if(surveyDetails == null){ if (surveyDetails == null) {
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto()); surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
}else { } else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class)); surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
} }
...@@ -618,8 +582,8 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -618,8 +582,8 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
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());
...@@ -634,132 +598,139 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -634,132 +598,139 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
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().setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/"))); surveyInfoAllDto.getCommercial()
.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);
if (information == null) {
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto()); surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
}else { } else {
surveyInfoAllDto.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().selectOne(designInformationQueryWrapper); DesignInformation designInformation = designInformationService.getBaseMapper()
if(designInformation == null){ .selectOne(designInformationQueryWrapper);
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
.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
powerStationEngineeringInfo
.setConstructionCollectorBoxInfo(powerStationConstructionData.getConstructionCollectorBoxInfo());
powerStationEngineeringInfo
.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager()); powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager());
powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone()); powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone());
powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager()); powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager());
powerStationEngineeringInfo.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone()); powerStationEngineeringInfo
} .setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone());
//并网信息 }
LambdaQueryWrapper<HygfOnGrid> up4=new LambdaQueryWrapper(); // 并网信息
up4.eq(HygfOnGrid::getWorkOrderId,workOrderId); LambdaQueryWrapper<HygfOnGrid> up4 = new LambdaQueryWrapper();
up4.eq(HygfOnGrid::getWorkOrderPowerStationId,workOrderPowerStationId); up4.eq(HygfOnGrid::getWorkOrderId, workOrderId);
HygfOnGrid hygfOnGrid=hygfOnGridMapper.selectOne(up4); up4.eq(HygfOnGrid::getWorkOrderPowerStationId, workOrderPowerStationId);
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid!=null?hygfOnGrid:new HygfOnGrid()); HygfOnGrid hygfOnGrid = hygfOnGridMapper.selectOne(up4);
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid != null ? hygfOnGrid : new HygfOnGrid());
surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData); surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData);
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo); surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo);
surveyInfoAllDto.setWorkOrder(workOrder); surveyInfoAllDto.setWorkOrder(workOrder);
//施工自审 // 施工自审
LambdaQueryWrapper<ConstructionRecords> up5=new LambdaQueryWrapper(); LambdaQueryWrapper<ConstructionRecords> up5 = new LambdaQueryWrapper();
up5.eq(ConstructionRecords::getWorkOrderId,workOrderId); up5.eq(ConstructionRecords::getWorkOrderId, workOrderId);
up5.eq(ConstructionRecords::getWorkOrderPowerStationId,workOrderPowerStationId); up5.eq(ConstructionRecords::getWorkOrderPowerStationId, workOrderPowerStationId);
up5.orderByAsc(ConstructionRecords::getRecDate); up5.orderByAsc(ConstructionRecords::getRecDate);
List<ConstructionRecords> li=constructionRecordsMapper.selectList(up5); List<ConstructionRecords> li = constructionRecordsMapper.selectList(up5);
ConstructionRecords data=new ConstructionRecords(); ConstructionRecords data = new ConstructionRecords();
data.setConstructionRecordsList(li); data.setConstructionRecordsList(li);
surveyInfoAllDto.setConstructionRecords(data); surveyInfoAllDto.setConstructionRecords(data);
LambdaQueryWrapper<BasicGridAcceptance> quv = new LambdaQueryWrapper();
quv.eq(BasicGridAcceptance::getPeasantHouseholdId, peasantHouseholdId);
BasicGridAcceptance basicGridAcceptance = basicGridAcceptanceMapper.selectOne(quv);
// 审核意见
LambdaQueryWrapper<BasicGridAcceptance> quv=new LambdaQueryWrapper(); if (Objects.nonNull(basicGridAcceptance) && !StringUtils.isEmpty(basicGridAcceptance.getInstanceId())) {
quv.eq(BasicGridAcceptance::getPeasantHouseholdId,peasantHouseholdId);
BasicGridAcceptance basicGridAcceptance= basicGridAcceptanceMapper.selectOne(quv);
//审核意见
if(Objects.nonNull(basicGridAcceptance) && !StringUtils.isEmpty(basicGridAcceptance.getInstanceId())){
try { try {
Map<String, Object> flowLoggerMap = workflowFeignClient.getFlowLogger(basicGridAcceptance.getInstanceId()).getResult(); Map<String, Object> flowLoggerMap = workflowFeignClient
.getFlowLogger(basicGridAcceptance.getInstanceId()).getResult();
List<LinkedHashMap> flowLogger = (List<LinkedHashMap>) flowLoggerMap.get("flowLogger"); List<LinkedHashMap> flowLogger = (List<LinkedHashMap>) flowLoggerMap.get("flowLogger");
if (flowLogger.size() > 0 ){ if (flowLogger.size() > 0) {
Collections.reverse(flowLogger); Collections.reverse(flowLogger);
} }
List<LinkedHashMap> flowLoggernew =new ArrayList<>(); List<LinkedHashMap> flowLoggernew = new ArrayList<>();
for (LinkedHashMap linkedHashMap : flowLogger) { for (LinkedHashMap linkedHashMap : flowLogger) {
if(linkedHashMap.get("operateDate")!=null&&!linkedHashMap.get("operateDate").toString().isEmpty()){ if (linkedHashMap.get("operateDate") != null
LinkedHashMap linke=new LinkedHashMap(); && !linkedHashMap.get("operateDate").toString().isEmpty()) {
linke.put("approvalStatue",linkedHashMap.get("approvalStatue").toString()); LinkedHashMap linke = new LinkedHashMap();
//审核意见 linke.put("approvalStatue", linkedHashMap.get("approvalStatue").toString());
List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>)linkedHashMap.get("approvalSuggestion"); // 审核意见
if(approvalSuggestion!=null&&!approvalSuggestion.isEmpty()){ List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>) linkedHashMap
linke.put("approvalSuggestion",approvalSuggestion.get(0).get("message")); .get("approvalSuggestion");
} if (approvalSuggestion != null && !approvalSuggestion.isEmpty()) {
linke.put("taskName",linkedHashMap.get("taskName").toString()); linke.put("approvalSuggestion", approvalSuggestion.get(0).get("message"));
linke.put("operator",linkedHashMap.get("operator").toString()); }
linke.put("operateDate",linkedHashMap.get("operateDate").toString()); linke.put("taskName", linkedHashMap.get("taskName").toString());
linke.put("operator", linkedHashMap.get("operator").toString());
linke.put("operateDate", linkedHashMap.get("operateDate").toString());
flowLoggernew.add(linke); flowLoggernew.add(linke);
} }
} }
LoggerDto loggerDto =new LoggerDto(); LoggerDto loggerDto = new LoggerDto();
loggerDto.setLogger(flowLoggernew); loggerDto.setLogger(flowLoggernew);
surveyInfoAllDto.setLoggerDto(loggerDto); surveyInfoAllDto.setLoggerDto(loggerDto);
} catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
return surveyInfoAllDto; return surveyInfoAllDto;
// LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>();
// peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId); // peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
...@@ -827,66 +798,62 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -827,66 +798,62 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
// return surveyInfoAllDto; // return surveyInfoAllDto;
} }
@Transactional(isolation = Isolation.REPEATABLE_READ) @Transactional(isolation = Isolation.REPEATABLE_READ)
public PowerStationEngineeringInfoAllDto addPowerStationEngineeringInfo(PowerStationEngineeringInfoAllDto powerStationEngineeringInfoAllDto){ public PowerStationEngineeringInfoAllDto addPowerStationEngineeringInfo(
PowerStationEngineeringInfoAllDto powerStationEngineeringInfoAllDto) {
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper(); LambdaQueryWrapper<WorkOrderPowerStation> qu = new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getSequenceNbr,powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId()); qu.eq(WorkOrderPowerStation::getSequenceNbr, powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId());
WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu); WorkOrderPowerStation workOrderPowerStation = workOrderPowerStationMapper.selectOne(qu);
//修改电站状态 // 修改电站状态
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待审核.getCode()); workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待审核.getCode());
workOrderPowerStationMapper.updateById(workOrderPowerStation); workOrderPowerStationMapper.updateById(workOrderPowerStation);
//修改派工单状态PowerStationEngineeringInfo // 修改派工单状态PowerStationEngineeringInfo
LambdaQueryWrapper<WorkOrderPowerStation> qu1=new LambdaQueryWrapper(); LambdaQueryWrapper<WorkOrderPowerStation> qu1 = new LambdaQueryWrapper();
qu1.eq(WorkOrderPowerStation::getWorkOrderId,workOrderPowerStation.getWorkOrderId()); qu1.eq(WorkOrderPowerStation::getWorkOrderId, workOrderPowerStation.getWorkOrderId());
List<String> d=new ArrayList<>(); List<String> d = new ArrayList<>();
d.add(WorkOrderEnum.施工中.getCode()); d.add(WorkOrderEnum.施工中.getCode());
d.add(WorkOrderEnum.待施工.getCode()); d.add(WorkOrderEnum.待施工.getCode());
d.add(WorkOrderEnum.待登记.getCode()); d.add(WorkOrderEnum.待登记.getCode());
qu1.in(WorkOrderPowerStation::getPowerStationConstructionStatus,d); qu1.in(WorkOrderPowerStation::getPowerStationConstructionStatus, d);
List<WorkOrderPowerStation> list=workOrderPowerStationMapper.selectList(qu1); List<WorkOrderPowerStation> list = workOrderPowerStationMapper.selectList(qu1);
LambdaUpdateWrapper<WorkOrder> upq=new LambdaUpdateWrapper(); LambdaUpdateWrapper<WorkOrder> upq = new LambdaUpdateWrapper();
upq.eq(WorkOrder::getSequenceNbr,workOrderPowerStation.getWorkOrderId()); upq.eq(WorkOrder::getSequenceNbr, workOrderPowerStation.getWorkOrderId());
if(list==null||list.isEmpty()){ if (list == null || list.isEmpty()) {
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.审核中.getCode()); upq.set(WorkOrder::getWorkOrderStatus, WorkOrderEnum.审核中.getCode());
workOrderMapper.update(null,upq); workOrderMapper.update(null, upq);
} }
//新增完工登记 // 新增完工登记
PowerStationEngineeringInfo powerStationEngineeringInfo= powerStationEngineeringInfoAllDto.getPowerStationEngineeringInfo(); PowerStationEngineeringInfo powerStationEngineeringInfo = powerStationEngineeringInfoAllDto
.getPowerStationEngineeringInfo();
powerStationEngineeringInfo.setWorkOrderId(workOrderPowerStation.getWorkOrderId()); powerStationEngineeringInfo.setWorkOrderId(workOrderPowerStation.getWorkOrderId());
powerStationEngineeringInfo.setWorkOrderPowerStationId(powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId()); powerStationEngineeringInfo
.setWorkOrderPowerStationId(powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId());
powerStationEngineeringInfoService.saveOrUpdate(powerStationEngineeringInfo); powerStationEngineeringInfoService.saveOrUpdate(powerStationEngineeringInfo);
//增加操作日志 // 增加操作日志
ConstructionRecords da=new ConstructionRecords( ConstructionRecords da = new ConstructionRecords(powerStationEngineeringInfo.getRecUserName(), "完工登记",
powerStationEngineeringInfo.getRecUserName(), new Date(), "", workOrderPowerStation.getWorkOrderId(), workOrderPowerStation.getSequenceNbr(),
"完工登记", workOrderPowerStation.getPeasantHouseholdId(), "");
new Date(),
"",
workOrderPowerStation.getWorkOrderId(),
workOrderPowerStation.getSequenceNbr(),
workOrderPowerStation.getPeasantHouseholdId(),
"");
constructionRecordsServiceImpl.save(da); constructionRecordsServiceImpl.save(da);
return powerStationEngineeringInfoAllDto; return powerStationEngineeringInfoAllDto;
} }
public PowerStationEngineeringInfoAllDto getConstructionRecords(Long workOrderPowerStationId, String rename) {
LambdaQueryWrapper<WorkOrderPowerStation> qu = new LambdaQueryWrapper();
public PowerStationEngineeringInfoAllDto getConstructionRecords(Long workOrderPowerStationId,String rename) { 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();
Long workOrderId=workOrderPowerStation.getWorkOrderId();
PowerStationEngineeringInfoAllDto surveyInfoAllDto = new PowerStationEngineeringInfoAllDto(); PowerStationEngineeringInfoAllDto surveyInfoAllDto = new PowerStationEngineeringInfoAllDto();
//施工自审 // 施工自审
LambdaQueryWrapper<ConstructionRecords> up5=new LambdaQueryWrapper(); LambdaQueryWrapper<ConstructionRecords> up5 = new LambdaQueryWrapper();
up5.eq(ConstructionRecords::getWorkOrderId,workOrderId); up5.eq(ConstructionRecords::getWorkOrderId, workOrderId);
up5.eq(ConstructionRecords::getWorkOrderPowerStationId,workOrderPowerStationId); up5.eq(ConstructionRecords::getWorkOrderPowerStationId, workOrderPowerStationId);
up5.orderByDesc(ConstructionRecords::getRecDate); up5.orderByDesc(ConstructionRecords::getRecDate);
List<ConstructionRecords> li=constructionRecordsMapper.selectList(up5); List<ConstructionRecords> li = constructionRecordsMapper.selectList(up5);
ConstructionRecords data=new ConstructionRecords(); ConstructionRecords data = new ConstructionRecords();
data.setConstructionRecordsList(li); data.setConstructionRecordsList(li);
data.setOperationTime(new Date()); data.setOperationTime(new Date());
data.setOperator(rename); data.setOperator(rename);
...@@ -895,11 +862,9 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -895,11 +862,9 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
} }
@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);
...@@ -919,8 +884,16 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -919,8 +884,16 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
dat.setWorkOrderPowerStationId(workOrderPowerStation.getSequenceNbr()); dat.setWorkOrderPowerStationId(workOrderPowerStation.getSequenceNbr());
dat.setPeasantHouseholdId(workOrderPowerStation.getPeasantHouseholdId()); dat.setPeasantHouseholdId(workOrderPowerStation.getPeasantHouseholdId());
dat.setGridStatus("1"); dat.setGridStatus("1");
//新增并网记录 //新增并网记录
LambdaQueryWrapper<BasicGridAcceptance> bga = new LambdaQueryWrapper<>();
bga.eq(BasicGridAcceptance::getPeasantHouseholdId, workOrderPowerStation.getPeasantHouseholdId());
BasicGridAcceptance b = basicGridAcceptanceMapper.selectOne(bga);
//防止重复增加
if(b==null)
{
basicGridAcceptanceMapper.insert(dat); basicGridAcceptanceMapper.insert(dat);
}
workOrderPowerStationMapper.updateById(workOrderPowerStation); workOrderPowerStationMapper.updateById(workOrderPowerStation);
//修改派工单状态 //修改派工单状态
LambdaQueryWrapper<WorkOrderPowerStation> qu1=new LambdaQueryWrapper(); LambdaQueryWrapper<WorkOrderPowerStation> qu1=new LambdaQueryWrapper();
...@@ -957,6 +930,7 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -957,6 +930,7 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
constructionRecords.setWorkOrderPowerStationId(workOrderPowerStation.getSequenceNbr()); constructionRecords.setWorkOrderPowerStationId(workOrderPowerStation.getSequenceNbr());
constructionRecords.setPeasantHouseholdId(workOrderPowerStation.getPeasantHouseholdId()); constructionRecords.setPeasantHouseholdId(workOrderPowerStation.getPeasantHouseholdId());
constructionRecordsServiceImpl.save(constructionRecords); 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