Commit c597bc22 authored by yangyang's avatar yangyang

Merge remote-tracking branch 'origin/developer' into developer

parents f8a6473a 528f434d
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
*
......@@ -28,6 +29,6 @@ public class HygfReplenishmentDto extends BaseDto {
private String comment;
@ApiModelProperty(value = "补货文件")
private String file;
private List<Object> file;
}
......@@ -41,6 +41,6 @@ public class HygfReplenishment extends BaseEntity {
* 补货文件
*/
@TableField(value = "file" , typeHandler = FastjsonTypeHandler.class)
private List<Object> file;
private String file;
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.hygf.api.dto.HygfReplenishmentDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......@@ -150,6 +151,9 @@ public class PreparationMoney extends BaseEntity {
private List<PreparationMoneyLog> preparationMoneyLog; //发货单流水
@TableField(exist = false)
private List<HygfReplenishmentDto> files; //发货单流水
@TableField(exist = false)
private String instanceId; //发货单流水
//订单状态
@TableField("order_status")
......
......@@ -11,13 +11,11 @@ and hygf_peasant_household.developer_id=#{developerId}
and hygf_peasant_household.regional_companies_seq=#{regionalCompaniesSeq}
and hygf_peasant_household.survey_or_not=3 and hygf_peasant_household.sequence_nbr not in
(select hygf_document_station.station_id from hygf_preparation_money RIGHT JOIN hygf_document_station
on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nbr where hygf_preparation_money.order_status ='待发货'
on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nbr where
hygf_document_station.station_id is not null
<if test="ids!=null and ids !=''">
and hygf_document_station.preparation_money_id !=#{ids}
</if>
and hygf_document_station.station_id is not null
)
</if>)
<if test="peasantHouseholdNo!=null and peasantHouseholdNo !=''">
and hygf_peasant_household.peasant_household_no like concat(concat("%",#{peasantHouseholdNo}),"%")
</if>
......@@ -70,7 +68,7 @@ and hygf_document_station.station_id is not null
<if test="developerCode!=null and developerCode !=''">
and developer_code = #{developerCode}
</if>
ORDER BY rec_date DESC
ORDER BY creation_time DESC
</select>
<select id="selectUserIsHouse" resultType="java.util.Map">
SELECT
......
......@@ -108,17 +108,22 @@ public class QiyuesuoController extends BaseController {
@PostMapping(value = "/getContractTokengz/{sequenceNbr}")
public ResponseModel<Object> getContractSdkResponseSequenceNbr(@RequestBody ContractMiniappTicketRequest request,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
QueryWrapper<SealDictionary> queryWrapper = new QueryWrapper();
queryWrapper.eq("amos_company_seq", sequenceNbr);
List<SealDictionary> sealDictionaryList = sealDictionaryMapper.selectList(queryWrapper);
if(CollectionUtils.isNotEmpty(sealDictionaryList)){
request.setUser(new User(sealDictionaryList.get(0).getSealedPhone(), "MOBILE"));
}
SealDictionary sealDictionary = sealDictionaryMapper.selectById(sequenceNbr);
request.setUser(new User(sealDictionary.getSealedPhone(), "MOBILE"));
SdkResponse<MiniappTicketResult> result = qiyuesuoService.getContractSdkResponse(request);
return ResponseHelper.buildResponse(result.getResult());
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "获取所有盖章人员", notes = "获取所有盖章人员")
@GetMapping(value = "/getAllUserByCompanySeq")
public ResponseModel<List<SealDictionary>> getAll(@RequestParam(value = "companySeq") Long companySeq) {
QueryWrapper<SealDictionary> queryWrapper = new QueryWrapper();
queryWrapper.eq("amos_company_seq", companySeq);
return ResponseHelper.buildResponse(sealDictionaryMapper.selectList(queryWrapper));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "获取合同浏览令牌", notes = "获取合同浏览令牌")
@GetMapping(value = "/getContractTokenTicket/{sequenceNbr}")
public ResponseModel<Object> getContractTokenTicket(@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
......
......@@ -119,12 +119,13 @@ public class SurveyInformationController extends BaseController {
* 勘察信息数据提交
*
* @return
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "勘察信息数据提交", notes = "勘察信息数据提交")
@PostMapping(value = "/surveySubmit")
public ResponseModel<SurveyInfoAllDto> surveySubmit(@RequestBody SurveyInfoAllDto surveyInfoAllDto,
@RequestParam(value = "operationType") String operationType) {
@RequestParam(value = "operationType") String operationType) throws Exception {
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.saveSurveyInfo(surveyInfoAllDto,operationType);
return ResponseHelper.buildResponse(returnDto);
}
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -47,6 +48,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* 发货单服务实现类
......@@ -188,6 +190,21 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
List<DocumentStation> li = documentStationMapper.selectList(q);
preparationMoney.setPeasantHouseholdId(li);
LambdaQueryWrapper<HygfReplenishment> h = new LambdaQueryWrapper<>();
h.eq(HygfReplenishment::getPreparationMoneyId,sequenceNbr);
List<HygfReplenishment> hygfReplenishments = hygfReplenishmentMapper.selectList(h);
List<HygfReplenishmentDto> hygfReplenishmentDtos = new ArrayList<>();
if (CollectionUtil.isNotEmpty(hygfReplenishments) && !hygfReplenishments.isEmpty() ){
hygfReplenishments.forEach(e->{
HygfReplenishmentDto hygfReplenishmentDto = new HygfReplenishmentDto();
BeanUtils.copyProperties(e,hygfReplenishmentDto);
hygfReplenishmentDto.setFile(JSON.parseArray(e.getFile()));
hygfReplenishmentDtos.add(hygfReplenishmentDto);
});
preparationMoney.setFiles(hygfReplenishmentDtos);
}
return preparationMoney;
}
......@@ -215,12 +232,6 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
qu.eq(PreparationMoney::getSequenceNbr, sequenceNbr);
PreparationMoney preparationMoney = preparationMoneyMapper.selectOne(qu);
LambdaUpdateWrapper<HygfReplenishment> h = new LambdaUpdateWrapper<>();
h.eq(HygfReplenishment::getPreparationMoneyId,sequenceNbr);
List<HygfReplenishment> hygfReplenishments = hygfReplenishmentMapper.selectList(h);
if (CollectionUtil.isNotEmpty(hygfReplenishments) && hygfReplenishments.size()>0 ){
map.put("files",hygfReplenishments);
}
LambdaUpdateWrapper<HygfPreparationMoneyAuditing> audit = new LambdaUpdateWrapper<>();
audit.eq(HygfPreparationMoneyAuditing::getPreparationMoneyId,sequenceNbr);
List<HygfPreparationMoneyAuditing> hygfPreparationMoneyAuditings = hygfPreparationMoneyAuditingService.getBaseMapper().selectList(audit);
......@@ -308,7 +319,25 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
designInformation.setInverter(inverter);
designInformation.setElectricityMeter(electricityMeter);
designInformation.setCable(cable);
map.put("preparationMoney", preparationMoney);
Map<String, Object> map2 = Bean.BeantoMap(preparationMoney);
LambdaUpdateWrapper<HygfReplenishment> h = new LambdaUpdateWrapper<>();
h.eq(HygfReplenishment::getPreparationMoneyId,sequenceNbr);
List<HygfReplenishment> hygfReplenishments = hygfReplenishmentMapper.selectList(h);
List<HygfReplenishmentDto> hygfReplenishmentDtos = new ArrayList<>();
if (CollectionUtil.isNotEmpty(hygfReplenishments) && !hygfReplenishments.isEmpty() ){
hygfReplenishments.forEach(e->{
HygfReplenishmentDto hygfReplenishmentDto = new HygfReplenishmentDto();
BeanUtils.copyProperties(e,hygfReplenishmentDto);
hygfReplenishmentDto.setFile(JSON.parseArray(e.getFile()));
hygfReplenishmentDtos.add(hygfReplenishmentDto);
});
map2.put("files",hygfReplenishmentDtos);
}
map.put("preparationMoney", map2);
map.put("designInformation", designInformation);
Map<String, Object> map1 = new HashMap<>();
map1.put("preparationMoneyLog", liD);
......@@ -602,8 +631,6 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
//更新电站施工状态
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
List<DocumentStation> idsk = model.getPeasantHouseholdId();
preparationMoneyMapper.insert(model);
List<DocumentStation> ids = model.getPeasantHouseholdId();
if (isSubmit.equals("0")) {
......@@ -655,9 +682,9 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
listDocumentStation.add(documentStation);
}
up.in(PeasantHousehold::getSequenceNbr, idsH);
peasantHouseholdMapper.update(null, up);
documentStationService.saveBatch(listDocumentStation);
}
peasantHouseholdMapper.update(null, up);
preparationMoneyMapper.updateById(model);
......@@ -732,10 +759,20 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
preparationMoneyMapper.updateById(model);
//电站信息存储
LambdaQueryWrapper<DocumentStation> query1 = new LambdaQueryWrapper<>();
query1.eq(DocumentStation::getPreparationMoneyId, model.getSequenceNbr());
List<Long> oldIds = documentStationMapper.selectList(query1).stream().map(DocumentStation::getStationId).collect(Collectors.toList());
LambdaUpdateWrapper<PeasantHousehold> up1 = new LambdaUpdateWrapper<>();
up1.in(BaseEntity::getSequenceNbr,oldIds);
up1.set(PeasantHousehold::getPreparationMoneyState, DeliveryStateeEnum.待发货.getCode());
up1.set(PeasantHousehold::getConstructionState, "勘察完成");
peasantHouseholdMapper.update(null, up1);
LambdaUpdateWrapper<DocumentStation> up3 = new LambdaUpdateWrapper();
up3.eq(DocumentStation::getPreparationMoneyId, model.getSequenceNbr());
documentStationMapper.delete(up3);
//电站信息存储
if (CollectionUtil.isNotEmpty(ids) && ids.size()>0){
List<DocumentStation> listDocumentStation = new ArrayList<>();
......@@ -1061,29 +1098,55 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
if ("1".equals(isSubmit)){
preparationMoneyMapper.updateById(model);
}else {
if (CollectionUtil.isEmpty(model.getPeasantHouseholdId())){
throw new BadRequest("提交时选择电站不可为空");
}
if (CollectionUtil.isEmpty(model.getDeliveryFile())){
throw new BadRequest("提交时发货单不可为空");
}
//isSubmit = 0 表示提交 也对应工作流表达式 可直接使用
model.setOrderStatus(DeliveryStateeEnum.待确认.getCode());
preparationMoneyMapper.updateById(model);
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getPreparationMoneyState, DeliveryStateeEnum.待补货.getName());
up.set(PeasantHousehold::getConstructionState, DeliveryStateeEnum.待补货.getName());
peasantHouseholdMapper.update(null,up);
this.wofkflowExcute(instanceId,isSubmit,"");
}
List<DocumentStation> ids = model.getPeasantHouseholdId();
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
//电站信息存储
LambdaQueryWrapper<DocumentStation> query1 = new LambdaQueryWrapper<>();
query1.eq(DocumentStation::getPreparationMoneyId, model.getSequenceNbr());
List<Long> oldIds = documentStationMapper.selectList(query1).stream().map(DocumentStation::getStationId).collect(Collectors.toList());
LambdaUpdateWrapper<PeasantHousehold> up1 = new LambdaUpdateWrapper<>();
up1.in(BaseEntity::getSequenceNbr,oldIds);
up1.set(PeasantHousehold::getPreparationMoneyState, DeliveryStateeEnum.待发货.getCode());
up1.set(PeasantHousehold::getConstructionState, "勘察完成");
peasantHouseholdMapper.update(null, up1);
LambdaUpdateWrapper<DocumentStation> up3 = new LambdaUpdateWrapper();
up3.eq(DocumentStation::getPreparationMoneyId, model.getSequenceNbr());
documentStationMapper.delete(up3);
List<DocumentStation> ids = model.getPeasantHouseholdId();
List<DocumentStation> listDocumentStation = new ArrayList<>();
for (DocumentStation documentStation : ids) {
documentStation.setPreparationMoneyId(model.getSequenceNbr());
listDocumentStation.add(documentStation);
//电站信息存储
if (CollectionUtil.isNotEmpty(ids) && ids.size()>0){
List<DocumentStation> listDocumentStation = new ArrayList<>();
List<Long> idsH = new ArrayList<>();
for (DocumentStation documentStation : ids) {
documentStation.setPreparationMoneyId(model.getSequenceNbr());
documentStation.setSequenceNbr(null);
idsH.add(documentStation.getStationId());
listDocumentStation.add(documentStation);
}
up.in(PeasantHousehold::getSequenceNbr, idsH);
up.set(PeasantHousehold::getPreparationMoneyState, DeliveryStateeEnum.待补货.getName());
up.set(PeasantHousehold::getConstructionState, DeliveryStateeEnum.待补货.getName());
peasantHouseholdMapper.update(null, up);
documentStationService.saveBatch(listDocumentStation);
}
documentStationService.saveBatch(listDocumentStation);
return model;
}
......
......@@ -54,350 +54,364 @@ import java.util.stream.Stream;
@Service
@Slf4j
public class SurveyInformationServiceImpl
extends BaseService<SurveyInformationDto, SurveyInformation, SurveyInformationMapper>
implements ISurveyInformationService {
@Autowired
SurveyDetailsServiceImpl surveyDetailsService;
@Autowired
InformationServiceImpl informationService;
@Autowired
ExtendedInformationServiceImpl extendedInformationService;
@Autowired
CommercialServiceImpl commercialService;
@Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired
DesignInformationServiceImpl designInformationService;
@Autowired
WorkflowFeignClient workflowFeignClient;
@Autowired
RedisUtils redisUtils;
@Autowired
IdxFeginService idxFeginService;
@Autowired
RegionalCompaniesMapper regionalCompaniesMapper;
@Autowired
IPowerStationService powerStationService;
@Autowired
ToDoTasksMapper toDoTasksMapper;
@Autowired
UserMessageMapper userMessageMapper;
@Value("${power.station.examine.pageId}")
private long pageId;
@Autowired
protected EmqKeeper emqKeeper;
@Value("${power.station.examine.planId}")
private String planId;
private static final String regionRedis = "app_region_redis";
private static final String OPERATION_TYPE_SUBMIT = "submit";
private static final String OPERATION_TYPE_APPLY = "apply";
private static final String IDX_REQUEST_STATE = "200";
@Autowired
PersonnelBusinessMapper personnelBusinessMapper;
@Autowired
PeasantHouseholdMapper peasantHouseholdMapper;
@Autowired
WorkOrderMapper workOrderMapper;
@Autowired
HygfOnGridMapper hygfOnGridMapper;
@Autowired
ConstructionRecordsServiceImpl constructionRecordsServiceImpl;
@Autowired
ConstructionRecordsMapper constructionRecordsMapper;
@Autowired
BasicGridAcceptanceMapper basicGridAcceptanceMapper;
@Autowired
SurveyInformationMapper surveyInformationMapper;
@Autowired
PowerStationConstructionDataMapper powerStationConstructionDataMapper;
@Autowired
PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper;
@Autowired
WorkOrderPowerStationMapper workOrderPowerStationMapper;
@Autowired
AmosRequestContext requestContext;
@Resource(type = RedisLockUtil.class)
private RedisLockUtil redisLockUtil;
@Autowired
WorkflowImpl workflow;
/**
* 分页查询
*/
public Page<SurveyInformationDto> queryForSurveyInformationPage(Page<SurveyInformationDto> page) {
return this.queryForPage(page, "rec_date", false);
}
/**
* 列表查询 示例
*/
public List<SurveyInformationDto> queryForSurveyInformationList() {
return this.queryForList("", false);
}
@GlobalTransactional
public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto, String operationType) {
String lockName = null;
try {
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
// 更新勘察基本信息
SurveyInformation surveyInformation = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyInformation(),
SurveyInformation.class);
lockName = String.format("LockName:saveSurveyInfo:%s", surveyInformation.getSequenceNbr());
Boolean isLocked = redisLockUtil.tryLock(lockName, lockName, 10, 1);
if (BooleanUtils.isNotTrue(isLocked)) {
throw new BadRequest("其他用户正在操作,请刷新后再试!");
}
QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformation.getSequenceNbr());
PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper()
.selectOne(peasantHouseholdQueryWrapper);
if (ArrivalStateeEnum.勘察中.getCode().equals(peasantHousehold.getConstructionState())) {
throw new BadRequest("勘察中,请稍后再试!");
}
surveyInformation.setReview(0);
if (OPERATION_TYPE_APPLY.equals(operationType) && null == surveyInformation.getCreatorTime()) {
surveyInformation.setCreatorTime(new Date());
}
this.saveOrUpdate(surveyInformation);
// 更新扩展信息
ExtendedInformation extendedInformation = BeanDtoUtils.convert(surveyInfoAllDto.getExtendedInformation(),
ExtendedInformation.class);
extendedInformation.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
extendedInformationService.saveOrUpdate(extendedInformation, new LambdaQueryWrapper<ExtendedInformation>()
.eq(ExtendedInformation::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//extendedInformationService.saveOrUpdate(extendedInformation);
// 更新勘察明细信息
SurveyDetailsDto oldSurveyDetails = surveyInfoAllDto.getSurveyDetails();
SurveyDetails surveyDetails = BeanDtoUtils.convert(oldSurveyDetails, SurveyDetails.class);
surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
surveyDetailsService.saveOrUpdate(surveyDetails, new LambdaQueryWrapper<SurveyDetails>()
.eq(SurveyDetails::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//surveyDetailsService.saveOrUpdate(surveyDetails);
// 更新商务信息
CommercialDto oldCommercial = surveyInfoAllDto.getCommercial();
Commercial commercial = BeanDtoUtils.convert(oldCommercial, Commercial.class);
// 处理省市县
String paddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
paddressName = paddressName + re.getRegionName() + "/";
}
}
}
commercial.setProjectAddressName(paddressName.substring(0, paddressName.length() - 1));
commercial.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
commercialService.saveOrUpdate(commercial, new LambdaQueryWrapper<Commercial>()
.eq(Commercial::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//commercialService.saveOrUpdate(commercial);
// 勘察后,更新状态
// QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
// peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformation.getSequenceNbr());
// PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper()
// .selectOne(peasantHouseholdQueryWrapper);
// 更新资料归档信息
Information information = BeanDtoUtils.convert(surveyInfoAllDto.getInformation(), Information.class);
information.setHouseProve(null == commercial ? 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
.setArchivesNumber(this.getNo(CodeEnum.档案.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
information.setFileNumber(this.getNo(CodeEnum.文件.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
information.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
informationService.saveOrUpdate(information, new LambdaQueryWrapper<Information>()
.eq(Information::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//informationService.saveOrUpdate(information);
peasantHousehold.setOwnersName(surveyInfoAllDto.getSurveyInformation().getOwnersName());
peasantHousehold.setTelephone(surveyInfoAllDto.getSurveyInformation().getTelephone());
peasantHousehold.setIdCard(surveyInfoAllDto.getSurveyInformation().getIdCard());
peasantHousehold.setMailbox(surveyInfoAllDto.getSurveyInformation().getMailbox());
peasantHousehold.setProjectAddress(surveyInfoAllDto.getSurveyInformation().getProjectAddress());
peasantHousehold.setProjectAddressDetail(surveyInfoAllDto.getSurveyInformation().getProjectAddressDetail());
peasantHousehold.setPermanentAddress(surveyInfoAllDto.getSurveyInformation().getPermanentAddress());
peasantHousehold
.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
peasantHousehold
.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
// 处理项目地址
String projectAddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
projectAddressName = projectAddressName + re.getRegionName() + "/";
}
}
}
peasantHousehold.setProjectAddressName(projectAddressName.substring(0, projectAddressName.length() - 1));
// 常住地址
String permanentAddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getPermanentAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
permanentAddressName = permanentAddressName + re.getRegionName() + "/";
}
}
}
peasantHousehold
.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1));
if (OPERATION_TYPE_SUBMIT.equals(operationType)) {
// peasantHousehold.setSurveyOrNot(1);
} else if (OPERATION_TYPE_APPLY.equals(operationType)) {
// 提交审核
submitExamine(peasantHousehold);
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ToDoTasks::getType, TaskTypeStationEnum.电站勘察.getCode());
wrapper.eq(ToDoTasks::getState, "待办");
wrapper.eq(ToDoTasks::getBusinessId, peasantHousehold.getSequenceNbr());
ToDoTasks doTasks = toDoTasksMapper.selectOne(wrapper);
if (doTasks != null) {
doTasks.setState("已办");
doTasks.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTasks);
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());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE", JSON.toJSONString(userMessage).getBytes(), 2,
false);
}
}
peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (StringUtils.isNotEmpty(lockName)) {
redisLockUtil.releaseLock(lockName);
}
}
return surveyInfoAllDto;
}
public String getNo(String type, Long sequenceNbr) {
RegionalCompanies da = regionalCompaniesMapper.selectRegionName(sequenceNbr);
if (da.getCompanyCode() == null || da.getCompanyCode().isEmpty()) {
throw new BadRequest("区域公司编号为空, 请设置编号");
}
if (da.getRegionalAddress() == null || da.getRegionalAddress().isEmpty()) {
throw new BadRequest("区域公司省市区为空, 请设置省市区");
}
String code = NumberUtil.getCode(type, da.getCompanyCode(), da.getRegionalAddress());
return code;
}
private void submitExamine(PeasantHousehold peasantHousehold) {
PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()),
PowerStationProcessStateEnum.作废.getCode());
String taskId = null;
Map<String, Object> objectMap = new HashMap<>(1);
objectMap.put("describe", "经销商已上传信息");
// 保存并审核
try {
BasicGridAcceptance basicGridAcceptance = new BasicGridAcceptance();
if (ObjectUtils.isNotEmpty(powerStation)) {
// 工作流执行一步
// taskId = powerStation.getTaskId();
StandardDto standardDto = new StandardDto();
standardDto.setResult("0");
standardDto.setTaskId(powerStation.getFlowTaskId());
VariableDto variable = new VariableDto();
variable.setApprovalStatus("0");
standardDto.setVariable(variable);
workflow.standard(basicGridAcceptance, standardDto, requestContext.getUserId());
} else {
// 第一步启动工作流
// 发起工作流
// 调用工作流执行第一个节点
ProcessDto processDto = new ProcessDto();
processDto.setBusinessKey(String.valueOf(peasantHousehold.getSequenceNbr()));
processDto.setProcessDefinitionKey("hygf_10001");
StartProcessDto startProcessDto = new StartProcessDto();
List<ProcessDto> process = new ArrayList<>();
process.add(processDto);
startProcessDto.setProcess(process);
workflow.startProcess(basicGridAcceptance, startProcessDto, requestContext.getUserId());
powerStation = new PowerStation();
}
peasantHousehold.setSurveyOrNot(2);
peasantHousehold.setReview(1);
// 插入记录表
powerStation.setPlanInstanceId(planId);
powerStation.setPowerStationCode(peasantHousehold.getPeasantHouseholdNo());
powerStation.setOwnersName(peasantHousehold.getOwnersName());
powerStation.setProjectAddress(peasantHousehold.getProjectAddressName());
powerStation.setPeasantHouseholdId(String.valueOf(peasantHousehold.getSequenceNbr()));
powerStation.setProcessStatus(PowerStationProcessStateEnum.进行中.getName());
powerStation.setServiceAgent(peasantHousehold.getDeveloperName());
// 获取流程信息
powerStation.setTaskId(basicGridAcceptance.getNextTaskId());
powerStation.setProcessInstanceId(basicGridAcceptance.getInstanceId());
powerStation.setFlowTaskId(basicGridAcceptance.getNextTaskId());
powerStation.setNodeRole(basicGridAcceptance.getNextExecutorIds());
powerStation.setNodeRouting(PowerStationEnum.getNodeByKey(basicGridAcceptance.getNextNodeKey()));
powerStation.setNextProcessNode(PowerStationNodeEnum.设计审核.getCode());
powerStation.setPromoter(basicGridAcceptance.getPromoter());
powerStation.setNextExecuteUserIds(basicGridAcceptance.getNextExecuteUserIds());
powerStation.setNextNodeName(basicGridAcceptance.getNextNodeName());
powerStation.setTechnologyStatus("");
powerStation.setDesignStatus("");
powerStation.setBusinessStatus("");
powerStationService.savePowerStation(powerStation, true, powerStation.getOwnersName(), "");
//
peasantHousehold.setConstructionState(ArrivalStateeEnum.勘察中.getCode());
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.勘察中.getCode());
long idsk = peasantHousehold.getSequenceNbr();
up.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up);
} catch (Exception e) {
e.printStackTrace();
log.error("submitExamine error:", e);
}
extends BaseService<SurveyInformationDto, SurveyInformation, SurveyInformationMapper>
implements ISurveyInformationService {
@Autowired
SurveyDetailsServiceImpl surveyDetailsService;
@Autowired
InformationServiceImpl informationService;
@Autowired
ExtendedInformationServiceImpl extendedInformationService;
@Autowired
CommercialServiceImpl commercialService;
@Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired
DesignInformationServiceImpl designInformationService;
@Autowired
WorkflowFeignClient workflowFeignClient;
@Autowired
RedisUtils redisUtils;
@Autowired
IdxFeginService idxFeginService;
@Autowired
RegionalCompaniesMapper regionalCompaniesMapper;
@Autowired
IPowerStationService powerStationService;
@Autowired
PowerStationMapper powerStationMapper;
@Autowired
ToDoTasksMapper toDoTasksMapper;
@Autowired
UserMessageMapper userMessageMapper;
@Value("${power.station.examine.pageId}")
private long pageId;
@Autowired
protected EmqKeeper emqKeeper;
@Value("${power.station.examine.planId}")
private String planId;
private static final String regionRedis = "app_region_redis";
private static final String OPERATION_TYPE_SUBMIT = "submit";
private static final String OPERATION_TYPE_APPLY = "apply";
private static final String IDX_REQUEST_STATE = "200";
@Autowired
PersonnelBusinessMapper personnelBusinessMapper;
@Autowired
PeasantHouseholdMapper peasantHouseholdMapper;
@Autowired
WorkOrderMapper workOrderMapper;
@Autowired
HygfOnGridMapper hygfOnGridMapper;
@Autowired
ConstructionRecordsServiceImpl constructionRecordsServiceImpl;
@Autowired
ConstructionRecordsMapper constructionRecordsMapper;
@Autowired
BasicGridAcceptanceMapper basicGridAcceptanceMapper;
@Autowired
SurveyInformationMapper surveyInformationMapper;
@Autowired
PowerStationConstructionDataMapper powerStationConstructionDataMapper;
@Autowired
PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper;
@Autowired
WorkOrderPowerStationMapper workOrderPowerStationMapper;
@Autowired
AmosRequestContext requestContext;
@Resource(type = RedisLockUtil.class)
private RedisLockUtil redisLockUtil;
@Autowired
WorkflowImpl workflow;
/**
* 分页查询
*/
public Page<SurveyInformationDto> queryForSurveyInformationPage(Page<SurveyInformationDto> page) {
return this.queryForPage(page, "rec_date", false);
}
/**
* 列表查询 示例
*/
public List<SurveyInformationDto> queryForSurveyInformationList() {
return this.queryForList("", false);
}
@GlobalTransactional
public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto, String operationType) {
String lockName = null;
try {
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
// 更新勘察基本信息
SurveyInformation surveyInformation = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyInformation(),
SurveyInformation.class);
lockName = String.format("LockName:saveSurveyInfo:%s", surveyInformation.getSequenceNbr());
Boolean isLocked = redisLockUtil.tryLock(lockName, lockName, 10, 1);
if (BooleanUtils.isNotTrue(isLocked)) {
throw new BadRequest("其他用户正在操作,请刷新后再试!");
}
QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformation.getSequenceNbr());
PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper()
.selectOne(peasantHouseholdQueryWrapper);
PowerStation powerStation = powerStationMapper.selectOne(new LambdaQueryWrapper<PowerStation>()
.eq(PowerStation::getPeasantHouseholdId, peasantHousehold.getSequenceNbr()));
if (ArrivalStateeEnum.勘察中.getCode().equals(peasantHousehold.getConstructionState())) {
// 驳回后重新提交是勘察中->勘察中导致此逻辑有问题,所以去掉这种情况
if (powerStation != null
&& PowerStationProcessStateEnum.不通过.getName().equals(powerStation.getProcessStatus())) {
} else {
throw new BadRequest("勘察中,请稍后再试!");
}
}
surveyInformation.setReview(0);
if (OPERATION_TYPE_APPLY.equals(operationType) && null == surveyInformation.getCreatorTime()) {
surveyInformation.setCreatorTime(new Date());
}
this.saveOrUpdate(surveyInformation);
// 更新扩展信息
ExtendedInformation extendedInformation = BeanDtoUtils.convert(surveyInfoAllDto.getExtendedInformation(),
ExtendedInformation.class);
extendedInformation.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
extendedInformationService.saveOrUpdate(extendedInformation, new LambdaQueryWrapper<ExtendedInformation>()
.eq(ExtendedInformation::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// extendedInformationService.saveOrUpdate(extendedInformation);
// 更新勘察明细信息
SurveyDetailsDto oldSurveyDetails = surveyInfoAllDto.getSurveyDetails();
SurveyDetails surveyDetails = BeanDtoUtils.convert(oldSurveyDetails, SurveyDetails.class);
surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
surveyDetailsService.saveOrUpdate(surveyDetails, new LambdaQueryWrapper<SurveyDetails>()
.eq(SurveyDetails::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// surveyDetailsService.saveOrUpdate(surveyDetails);
// 更新商务信息
CommercialDto oldCommercial = surveyInfoAllDto.getCommercial();
Commercial commercial = BeanDtoUtils.convert(oldCommercial, Commercial.class);
// 处理省市县
String paddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
paddressName = paddressName + re.getRegionName() + "/";
}
}
}
commercial.setProjectAddressName(paddressName.substring(0, paddressName.length() - 1));
commercial.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
commercialService.saveOrUpdate(commercial, new LambdaQueryWrapper<Commercial>()
.eq(Commercial::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// commercialService.saveOrUpdate(commercial);
// 勘察后,更新状态
// QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new
// QueryWrapper<>();
// peasantHouseholdQueryWrapper.eq("survey_information_id",
// surveyInformation.getSequenceNbr());
// PeasantHousehold peasantHousehold =
// peasantHouseholdServiceImpl.getBaseMapper()
// .selectOne(peasantHouseholdQueryWrapper);
// 更新资料归档信息
Information information = BeanDtoUtils.convert(surveyInfoAllDto.getInformation(), Information.class);
information.setHouseProve(null == commercial ? 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
.setArchivesNumber(this.getNo(CodeEnum.档案.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
information.setFileNumber(this.getNo(CodeEnum.文件.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
information.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
informationService.saveOrUpdate(information, new LambdaQueryWrapper<Information>()
.eq(Information::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// informationService.saveOrUpdate(information);
peasantHousehold.setOwnersName(surveyInfoAllDto.getSurveyInformation().getOwnersName());
peasantHousehold.setTelephone(surveyInfoAllDto.getSurveyInformation().getTelephone());
peasantHousehold.setIdCard(surveyInfoAllDto.getSurveyInformation().getIdCard());
peasantHousehold.setMailbox(surveyInfoAllDto.getSurveyInformation().getMailbox());
peasantHousehold.setProjectAddress(surveyInfoAllDto.getSurveyInformation().getProjectAddress());
peasantHousehold.setProjectAddressDetail(surveyInfoAllDto.getSurveyInformation().getProjectAddressDetail());
peasantHousehold.setPermanentAddress(surveyInfoAllDto.getSurveyInformation().getPermanentAddress());
peasantHousehold
.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
peasantHousehold
.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
// 处理项目地址
String projectAddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
projectAddressName = projectAddressName + re.getRegionName() + "/";
}
}
}
peasantHousehold.setProjectAddressName(projectAddressName.substring(0, projectAddressName.length() - 1));
// 常住地址
String permanentAddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getPermanentAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
permanentAddressName = permanentAddressName + re.getRegionName() + "/";
}
}
}
peasantHousehold
.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1));
if (OPERATION_TYPE_SUBMIT.equals(operationType)) {
// peasantHousehold.setSurveyOrNot(1);
} else if (OPERATION_TYPE_APPLY.equals(operationType)) {
// 提交审核
submitExamine(peasantHousehold);
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ToDoTasks::getType, TaskTypeStationEnum.电站勘察.getCode());
wrapper.eq(ToDoTasks::getState, "待办");
wrapper.eq(ToDoTasks::getBusinessId, peasantHousehold.getSequenceNbr());
ToDoTasks doTasks = toDoTasksMapper.selectOne(wrapper);
if (doTasks != null) {
doTasks.setState("已办");
doTasks.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTasks);
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());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE", JSON.toJSONString(userMessage).getBytes(), 2,
false);
}
}
peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (StringUtils.isNotEmpty(lockName)) {
redisLockUtil.releaseLock(lockName);
}
}
return surveyInfoAllDto;
}
public String getNo(String type, Long sequenceNbr) {
RegionalCompanies da = regionalCompaniesMapper.selectRegionName(sequenceNbr);
if (da.getCompanyCode() == null || da.getCompanyCode().isEmpty()) {
throw new BadRequest("区域公司编号为空, 请设置编号");
}
if (da.getRegionalAddress() == null || da.getRegionalAddress().isEmpty()) {
throw new BadRequest("区域公司省市区为空, 请设置省市区");
}
String code = NumberUtil.getCode(type, da.getCompanyCode(), da.getRegionalAddress());
return code;
}
private void submitExamine(PeasantHousehold peasantHousehold) {
PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()),
PowerStationProcessStateEnum.作废.getCode());
String taskId = null;
Map<String, Object> objectMap = new HashMap<>(1);
objectMap.put("describe", "经销商已上传信息");
// 保存并审核
try {
BasicGridAcceptance basicGridAcceptance = new BasicGridAcceptance();
if (ObjectUtils.isNotEmpty(powerStation)) {
// 工作流执行一步
// taskId = powerStation.getTaskId();
StandardDto standardDto = new StandardDto();
standardDto.setResult("0");
standardDto.setTaskId(powerStation.getFlowTaskId());
VariableDto variable = new VariableDto();
variable.setApprovalStatus("0");
standardDto.setVariable(variable);
workflow.standard(basicGridAcceptance, standardDto, requestContext.getUserId());
} else {
// 第一步启动工作流
// 发起工作流
// 调用工作流执行第一个节点
ProcessDto processDto = new ProcessDto();
processDto.setBusinessKey(String.valueOf(peasantHousehold.getSequenceNbr()));
processDto.setProcessDefinitionKey("hygf_10001");
StartProcessDto startProcessDto = new StartProcessDto();
List<ProcessDto> process = new ArrayList<>();
process.add(processDto);
startProcessDto.setProcess(process);
workflow.startProcess(basicGridAcceptance, startProcessDto, requestContext.getUserId());
powerStation = new PowerStation();
}
peasantHousehold.setSurveyOrNot(2);
peasantHousehold.setReview(1);
// 插入记录表
powerStation.setPlanInstanceId(planId);
powerStation.setPowerStationCode(peasantHousehold.getPeasantHouseholdNo());
powerStation.setOwnersName(peasantHousehold.getOwnersName());
powerStation.setProjectAddress(peasantHousehold.getProjectAddressName());
powerStation.setPeasantHouseholdId(String.valueOf(peasantHousehold.getSequenceNbr()));
powerStation.setProcessStatus(PowerStationProcessStateEnum.进行中.getName());
powerStation.setServiceAgent(peasantHousehold.getDeveloperName());
// 获取流程信息
powerStation.setTaskId(basicGridAcceptance.getNextTaskId());
powerStation.setProcessInstanceId(basicGridAcceptance.getInstanceId());
powerStation.setFlowTaskId(basicGridAcceptance.getNextTaskId());
powerStation.setNodeRole(basicGridAcceptance.getNextExecutorIds());
powerStation.setNodeRouting(PowerStationEnum.getNodeByKey(basicGridAcceptance.getNextNodeKey()));
powerStation.setNextProcessNode(PowerStationNodeEnum.设计审核.getCode());
powerStation.setPromoter(basicGridAcceptance.getPromoter());
powerStation.setNextExecuteUserIds(basicGridAcceptance.getNextExecuteUserIds());
powerStation.setNextNodeName(basicGridAcceptance.getNextNodeName());
powerStation.setTechnologyStatus("");
powerStation.setDesignStatus("");
powerStation.setBusinessStatus("");
powerStationService.savePowerStation(powerStation, true, powerStation.getOwnersName(), "");
//
peasantHousehold.setConstructionState(ArrivalStateeEnum.勘察中.getCode());
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.勘察中.getCode());
long idsk = peasantHousehold.getSequenceNbr();
up.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up);
} catch (Exception e) {
e.printStackTrace();
log.error("submitExamine error:", e);
}
// PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()), PowerStationProcessStateEnum.作废.getCode());
//
......@@ -445,285 +459,285 @@ public class SurveyInformationServiceImpl
// e.printStackTrace();
// throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!");
// }
}
public SurveyInfoAllDto querySurveyInfo(String surveyInformationId, String peasantHouseholdId,
String processInstanceId, AgencyUserModel userInfo) {
SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
PeasantHousehold peasantHousehold = new PeasantHousehold();
if (!StringUtils.isEmpty(peasantHouseholdId)) {
LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>();
peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper);
surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId());
} else {
QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformationId);
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper);
}
// 勘察基本信息
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
SurveyInformation surveyInformation = this.baseMapper.selectOne(queryWrapper);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
// 农户信息
// 获取用户所在经销商单位
UserUnitInformationDto userUnitInformationDto = personnelBusinessMapper
.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName());
surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode());
surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId());
if (surveyInfoAllDto.getSurveyInformation().getSalesmanId() == null) {
surveyInfoAllDto.getSurveyInformation().setSalesmanId(peasantHousehold.getDeveloperUserId());
surveyInfoAllDto.getSurveyInformation().setSalesman(peasantHousehold.getDeveloper());
surveyInfoAllDto.getSurveyInformation().setCreator(peasantHousehold.getDeveloper());
}
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation()
.setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
}
if (!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())) {
surveyInfoAllDto.getSurveyInformation()
.setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
}
if (peasantHousehold.getPermanentAddress() == null) {
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
}
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
// 制单时间
surveyInfoAllDto.getSurveyInformation().setCreatorTime(surveyInformation.getCreatorTime());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
if (surveyDetails == null) {
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
} else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
}
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
informationQueryWrapper.eq("survey_information_id", surveyInformationId);
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
commercialQueryWrapper.eq("survey_information_id", surveyInformationId);
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
if (commercial == null) {
commercial = new Commercial();
}
if (information == null) {
surveyInfoAllDto.setInformation(new InformationDto());
} else {
information.setHouseProve(null == commercial ? 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));
}
commercial.setApplicant(peasantHousehold.getOwnersName());
commercial.setIdCard(peasantHousehold.getIdCard());
commercial.setTelephone(peasantHousehold.getTelephone());
commercial.setProjectAddress(peasantHousehold.getProjectAddress());
commercial.setProjectAddressName(peasantHousehold.getProjectAddressName());
commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail());
commercial.setLegalContactTelephone(peasantHousehold.getTelephone());
List<Object> list = new ArrayList<>();
if (null != surveyDetails) {
if (CollectionUtil.isNotEmpty(surveyDetails.getSurroundingHouseSurvey())) {
list.addAll(surveyDetails.getSurroundingHouseSurvey());
}
if (CollectionUtil.isNotEmpty(surveyDetails.getOverallHousingSurvey())) {
list.addAll(surveyDetails.getOverallHousingSurvey());
}
if (CollectionUtil.isNotEmpty(surveyDetails.getPanoramaSurvey())) {
list.addAll(surveyDetails.getPanoramaSurvey());
}
if (CollectionUtil.isNotEmpty(surveyDetails.getPlanSketchSurvey())) {
list.addAll(surveyDetails.getPlanSketchSurvey());
}
if (CollectionUtil.isNotEmpty(surveyDetails.getAzimuthSurvey())) {
list.addAll(surveyDetails.getAzimuthSurvey());
}
}
commercial.setSurveyPhotosWeb(list);
if (information == null) {
CommercialDto commercialDto = BeanDtoUtils.convert(commercial, CommercialDto.class);
commercialDto.setType("zrr");
commercialDto.setLegalType("zjdnhw");
surveyInfoAllDto.setCommercial(commercialDto);
} else {
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
if (commercial != null && !StringUtils.isEmpty(commercial.getProjectAddressName())) {
surveyInfoAllDto.getCommercial()
.setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
}
}
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper()
.selectOne(extendedInformationQueryWrapper);
if (information == null) {
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
} else {
surveyInfoAllDto
.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
}
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.eq("peasant_household_id", peasantHousehold.getSequenceNbr());
DesignInformation designInformation = designInformationService.getBaseMapper()
.selectOne(designInformationQueryWrapper);
if (designInformation == null) {
surveyInfoAllDto.setDesignInformation(new DesignInformationDto());
} else {
surveyInfoAllDto.setDesignInformation(BeanDtoUtils.convert(designInformation, DesignInformationDto.class));
}
LambdaQueryWrapper<WorkOrderPowerStation> up1 = new LambdaQueryWrapper();
up1.eq(WorkOrderPowerStation::getPeasantHouseholdId, peasantHouseholdId);
WorkOrderPowerStation workOrderPowerStation = workOrderPowerStationMapper.selectOne(up1);
if (workOrderPowerStation != null) {
Long workOrderId = workOrderPowerStation.getWorkOrderId();
Long workOrderPowerStationId = workOrderPowerStation.getSequenceNbr();
// 派工单信息
LambdaQueryWrapper<WorkOrder> upl = new LambdaQueryWrapper();
upl.eq(WorkOrder::getSequenceNbr, workOrderId);
WorkOrder workOrder = workOrderMapper.selectOne(upl);
// 施工信息
LambdaQueryWrapper<PowerStationConstructionData> up2 = new LambdaQueryWrapper();
up2.eq(PowerStationConstructionData::getWorkOrderId, workOrderId);
up2.eq(PowerStationConstructionData::getWorkOrderPowerStationId, workOrderPowerStationId);
PowerStationConstructionData powerStationConstructionData = powerStationConstructionDataMapper
.selectOne(up2);
// 工程信息
LambdaQueryWrapper<PowerStationEngineeringInfo> up3 = new LambdaQueryWrapper();
up3.eq(PowerStationEngineeringInfo::getWorkOrderId, workOrderId);
up3.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId, workOrderPowerStationId);
PowerStationEngineeringInfo powerStationEngineeringInfo = powerStationEngineeringInfoMapper.selectOne(up3);
if (powerStationConstructionData != null) {
powerStationEngineeringInfo = powerStationEngineeringInfo != null ? powerStationEngineeringInfo
: new PowerStationEngineeringInfo();
powerStationEngineeringInfo
.setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo());
powerStationEngineeringInfo
.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
powerStationEngineeringInfo.setConstructionCollectorBoxInfo(
powerStationConstructionData.getConstructionCollectorBoxInfo());
powerStationEngineeringInfo
.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager());
powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone());
powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager());
powerStationEngineeringInfo
.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone());
}
// 并网信息
LambdaQueryWrapper<HygfOnGrid> up4 = new LambdaQueryWrapper();
up4.eq(HygfOnGrid::getWorkOrderId, workOrderId);
up4.eq(HygfOnGrid::getWorkOrderPowerStationId, workOrderPowerStationId);
HygfOnGrid hygfOnGrid = hygfOnGridMapper.selectOne(up4);
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid != null ? hygfOnGrid : new HygfOnGrid());
surveyInfoAllDto
.setPowerStationConstructionData(powerStationConstructionData != null ? powerStationConstructionData
: new PowerStationConstructionData());
surveyInfoAllDto
.setPowerStationEngineeringInfo(powerStationEngineeringInfo != null ? powerStationEngineeringInfo
: new PowerStationEngineeringInfo());
surveyInfoAllDto.setWorkOrder(workOrder != null ? workOrder : new WorkOrder());
} else {
surveyInfoAllDto.setHygfOnGrid(new HygfOnGrid());
surveyInfoAllDto.setPowerStationConstructionData(new PowerStationConstructionData());
surveyInfoAllDto.setPowerStationEngineeringInfo(new PowerStationEngineeringInfo());
surveyInfoAllDto.setWorkOrder(new WorkOrder());
}
if (!StringUtils.isEmpty(processInstanceId)) {
try {
Map<String, Object> flowLoggerMap = workflowFeignClient.getFlowLogger(processInstanceId).getResult();
List<LinkedHashMap> flowLogger = (List<LinkedHashMap>) flowLoggerMap.get("flowLogger");
if (flowLogger.size() > 0) {
Collections.reverse(flowLogger);
}
List<LinkedHashMap> flowLoggernew = new ArrayList<>();
for (LinkedHashMap linkedHashMap : flowLogger) {
if (linkedHashMap.get("operateDate") != null
&& !linkedHashMap.get("operateDate").toString().isEmpty()) {
LinkedHashMap linke = new LinkedHashMap();
linke.put("approvalStatue", linkedHashMap.get("approvalStatue").toString());
// 审核意见
List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>) linkedHashMap
.get("approvalSuggestion");
if (approvalSuggestion != null && !approvalSuggestion.isEmpty()) {
linke.put("approvalSuggestion", approvalSuggestion.get(0).get("message"));
}
linke.put("taskName", linkedHashMap.get("taskName").toString());
linke.put("operator", linkedHashMap.get("operator").toString());
linke.put("operateDate", linkedHashMap.get("operateDate").toString());
flowLoggernew.add(linke);
}
}
LoggerDto loggerDto = new LoggerDto();
loggerDto.setLogger(flowLoggernew);
surveyInfoAllDto.setOrderTracking(loggerDto);
} catch (Exception e) {
e.printStackTrace();
}
}
return surveyInfoAllDto;
}
public JSONArray getRegionName() {
JSONArray jsonArray = new JSONArray();
if (redisUtils.hasKey(regionRedis)) {
jsonArray = JSONArray.parseArray(redisUtils.get(regionRedis).toString());
} else {
Collection<RegionModel> regionChild = new ArrayList<>();
RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient
.queryForTreeParent(610000L);
Collection<RegionModel> result = collectionFeignClientResult.getResult();
for (RegionModel regionModel : result) {
if (regionModel.getChildren() != null && !regionModel.getChildren().isEmpty()) {
for (RegionModel child : regionModel.getChildren()) {
if (child.getChildren() != null && !child.getChildren().isEmpty()) {
for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild);
}
child.setChildren(regionChild);
jsonArray.add(child);
}
}
}
regionModel.setChildren(regionChild);
jsonArray.add(regionModel);
}
redisUtils.set(regionRedis, jsonArray);
}
return jsonArray;
}
}
public SurveyInfoAllDto querySurveyInfo(String surveyInformationId, String peasantHouseholdId,
String processInstanceId, AgencyUserModel userInfo) {
SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
PeasantHousehold peasantHousehold = new PeasantHousehold();
if (!StringUtils.isEmpty(peasantHouseholdId)) {
LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>();
peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper);
surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId());
} else {
QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformationId);
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper);
}
// 勘察基本信息
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
SurveyInformation surveyInformation = this.baseMapper.selectOne(queryWrapper);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
// 农户信息
// 获取用户所在经销商单位
UserUnitInformationDto userUnitInformationDto = personnelBusinessMapper
.getUserUnitInformationDto(peasantHousehold.getDeveloperUserId());
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userUnitInformationDto.getAmosDealerName());
surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userUnitInformationDto.getAmosDealerOrgCode());
surveyInfoAllDto.getSurveyInformation().setDeveloperId(userUnitInformationDto.getAmosDealerId());
if (surveyInfoAllDto.getSurveyInformation().getSalesmanId() == null) {
surveyInfoAllDto.getSurveyInformation().setSalesmanId(peasantHousehold.getDeveloperUserId());
surveyInfoAllDto.getSurveyInformation().setSalesman(peasantHousehold.getDeveloper());
surveyInfoAllDto.getSurveyInformation().setCreator(peasantHousehold.getDeveloper());
}
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation()
.setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
}
if (!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())) {
surveyInfoAllDto.getSurveyInformation()
.setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
}
if (peasantHousehold.getPermanentAddress() == null) {
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
}
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
// 制单时间
surveyInfoAllDto.getSurveyInformation().setCreatorTime(surveyInformation.getCreatorTime());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
if (surveyDetails == null) {
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
} else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
}
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
informationQueryWrapper.eq("survey_information_id", surveyInformationId);
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
commercialQueryWrapper.eq("survey_information_id", surveyInformationId);
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
if (commercial == null) {
commercial = new Commercial();
}
if (information == null) {
surveyInfoAllDto.setInformation(new InformationDto());
} else {
information.setHouseProve(null == commercial ? 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));
}
commercial.setApplicant(peasantHousehold.getOwnersName());
commercial.setIdCard(peasantHousehold.getIdCard());
commercial.setTelephone(peasantHousehold.getTelephone());
commercial.setProjectAddress(peasantHousehold.getProjectAddress());
commercial.setProjectAddressName(peasantHousehold.getProjectAddressName());
commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail());
commercial.setLegalContactTelephone(peasantHousehold.getTelephone());
List<Object> list = new ArrayList<>();
if (null != surveyDetails) {
if (CollectionUtil.isNotEmpty(surveyDetails.getSurroundingHouseSurvey())) {
list.addAll(surveyDetails.getSurroundingHouseSurvey());
}
if (CollectionUtil.isNotEmpty(surveyDetails.getOverallHousingSurvey())) {
list.addAll(surveyDetails.getOverallHousingSurvey());
}
if (CollectionUtil.isNotEmpty(surveyDetails.getPanoramaSurvey())) {
list.addAll(surveyDetails.getPanoramaSurvey());
}
if (CollectionUtil.isNotEmpty(surveyDetails.getPlanSketchSurvey())) {
list.addAll(surveyDetails.getPlanSketchSurvey());
}
if (CollectionUtil.isNotEmpty(surveyDetails.getAzimuthSurvey())) {
list.addAll(surveyDetails.getAzimuthSurvey());
}
}
commercial.setSurveyPhotosWeb(list);
if (information == null) {
CommercialDto commercialDto = BeanDtoUtils.convert(commercial, CommercialDto.class);
commercialDto.setType("zrr");
commercialDto.setLegalType("zjdnhw");
surveyInfoAllDto.setCommercial(commercialDto);
} else {
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
if (commercial != null && !StringUtils.isEmpty(commercial.getProjectAddressName())) {
surveyInfoAllDto.getCommercial()
.setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
}
}
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper()
.selectOne(extendedInformationQueryWrapper);
if (information == null) {
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
} else {
surveyInfoAllDto
.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
}
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.eq("peasant_household_id", peasantHousehold.getSequenceNbr());
DesignInformation designInformation = designInformationService.getBaseMapper()
.selectOne(designInformationQueryWrapper);
if (designInformation == null) {
surveyInfoAllDto.setDesignInformation(new DesignInformationDto());
} else {
surveyInfoAllDto.setDesignInformation(BeanDtoUtils.convert(designInformation, DesignInformationDto.class));
}
LambdaQueryWrapper<WorkOrderPowerStation> up1 = new LambdaQueryWrapper();
up1.eq(WorkOrderPowerStation::getPeasantHouseholdId, peasantHouseholdId);
WorkOrderPowerStation workOrderPowerStation = workOrderPowerStationMapper.selectOne(up1);
if (workOrderPowerStation != null) {
Long workOrderId = workOrderPowerStation.getWorkOrderId();
Long workOrderPowerStationId = workOrderPowerStation.getSequenceNbr();
// 派工单信息
LambdaQueryWrapper<WorkOrder> upl = new LambdaQueryWrapper();
upl.eq(WorkOrder::getSequenceNbr, workOrderId);
WorkOrder workOrder = workOrderMapper.selectOne(upl);
// 施工信息
LambdaQueryWrapper<PowerStationConstructionData> up2 = new LambdaQueryWrapper();
up2.eq(PowerStationConstructionData::getWorkOrderId, workOrderId);
up2.eq(PowerStationConstructionData::getWorkOrderPowerStationId, workOrderPowerStationId);
PowerStationConstructionData powerStationConstructionData = powerStationConstructionDataMapper
.selectOne(up2);
// 工程信息
LambdaQueryWrapper<PowerStationEngineeringInfo> up3 = new LambdaQueryWrapper();
up3.eq(PowerStationEngineeringInfo::getWorkOrderId, workOrderId);
up3.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId, workOrderPowerStationId);
PowerStationEngineeringInfo powerStationEngineeringInfo = powerStationEngineeringInfoMapper.selectOne(up3);
if (powerStationConstructionData != null) {
powerStationEngineeringInfo = powerStationEngineeringInfo != null ? powerStationEngineeringInfo
: new PowerStationEngineeringInfo();
powerStationEngineeringInfo
.setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo());
powerStationEngineeringInfo
.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
powerStationEngineeringInfo.setConstructionCollectorBoxInfo(
powerStationConstructionData.getConstructionCollectorBoxInfo());
powerStationEngineeringInfo
.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
powerStationEngineeringInfo.setProjectRegionManager(workOrder.getProjectRegionManager());
powerStationEngineeringInfo.setProjectRegionManagerPhone(workOrder.getProjectRegionManagerPhone());
powerStationEngineeringInfo.setConstructionRegionManager(workOrder.getConstructionRegionManager());
powerStationEngineeringInfo
.setConstructionRegionManagerPhone(workOrder.getConstructionRegionManagerPhone());
}
// 并网信息
LambdaQueryWrapper<HygfOnGrid> up4 = new LambdaQueryWrapper();
up4.eq(HygfOnGrid::getWorkOrderId, workOrderId);
up4.eq(HygfOnGrid::getWorkOrderPowerStationId, workOrderPowerStationId);
HygfOnGrid hygfOnGrid = hygfOnGridMapper.selectOne(up4);
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid != null ? hygfOnGrid : new HygfOnGrid());
surveyInfoAllDto
.setPowerStationConstructionData(powerStationConstructionData != null ? powerStationConstructionData
: new PowerStationConstructionData());
surveyInfoAllDto
.setPowerStationEngineeringInfo(powerStationEngineeringInfo != null ? powerStationEngineeringInfo
: new PowerStationEngineeringInfo());
surveyInfoAllDto.setWorkOrder(workOrder != null ? workOrder : new WorkOrder());
} else {
surveyInfoAllDto.setHygfOnGrid(new HygfOnGrid());
surveyInfoAllDto.setPowerStationConstructionData(new PowerStationConstructionData());
surveyInfoAllDto.setPowerStationEngineeringInfo(new PowerStationEngineeringInfo());
surveyInfoAllDto.setWorkOrder(new WorkOrder());
}
if (!StringUtils.isEmpty(processInstanceId)) {
try {
Map<String, Object> flowLoggerMap = workflowFeignClient.getFlowLogger(processInstanceId).getResult();
List<LinkedHashMap> flowLogger = (List<LinkedHashMap>) flowLoggerMap.get("flowLogger");
if (flowLogger.size() > 0) {
Collections.reverse(flowLogger);
}
List<LinkedHashMap> flowLoggernew = new ArrayList<>();
for (LinkedHashMap linkedHashMap : flowLogger) {
if (linkedHashMap.get("operateDate") != null
&& !linkedHashMap.get("operateDate").toString().isEmpty()) {
LinkedHashMap linke = new LinkedHashMap();
linke.put("approvalStatue", linkedHashMap.get("approvalStatue").toString());
// 审核意见
List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>) linkedHashMap
.get("approvalSuggestion");
if (approvalSuggestion != null && !approvalSuggestion.isEmpty()) {
linke.put("approvalSuggestion", approvalSuggestion.get(0).get("message"));
}
linke.put("taskName", linkedHashMap.get("taskName").toString());
linke.put("operator", linkedHashMap.get("operator").toString());
linke.put("operateDate", linkedHashMap.get("operateDate").toString());
flowLoggernew.add(linke);
}
}
LoggerDto loggerDto = new LoggerDto();
loggerDto.setLogger(flowLoggernew);
surveyInfoAllDto.setOrderTracking(loggerDto);
} catch (Exception e) {
e.printStackTrace();
}
}
return surveyInfoAllDto;
}
public JSONArray getRegionName() {
JSONArray jsonArray = new JSONArray();
if (redisUtils.hasKey(regionRedis)) {
jsonArray = JSONArray.parseArray(redisUtils.get(regionRedis).toString());
} else {
Collection<RegionModel> regionChild = new ArrayList<>();
RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient
.queryForTreeParent(610000L);
Collection<RegionModel> result = collectionFeignClientResult.getResult();
for (RegionModel regionModel : result) {
if (regionModel.getChildren() != null && !regionModel.getChildren().isEmpty()) {
for (RegionModel child : regionModel.getChildren()) {
if (child.getChildren() != null && !child.getChildren().isEmpty()) {
for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild);
}
child.setChildren(regionChild);
jsonArray.add(child);
}
}
}
regionModel.setChildren(regionChild);
jsonArray.add(regionModel);
}
redisUtils.set(regionRedis, jsonArray);
}
return jsonArray;
}
}
\ No newline at end of file
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