Commit b20b65c8 authored by hezhuozhi's avatar hezhuozhi

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

parents 8970090b a42afe0a
......@@ -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")
......
......@@ -70,7 +70,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
......
......@@ -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;
......@@ -23,6 +24,7 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.*;
import com.yeejoin.amos.boot.module.hygf.api.service.IHygfPreparationMoneyAuditingService;
import com.yeejoin.amos.boot.module.hygf.api.service.IPreparationMoneyService;
import com.yeejoin.amos.boot.module.hygf.api.util.NumberUtil;
import com.yeejoin.amos.boot.module.hygf.biz.feign.WorkflowFeignClient;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
......@@ -33,7 +35,7 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -46,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;
/**
* 发货单服务实现类
......@@ -92,6 +95,8 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
private HygfPreparationMoneyAuditingServiceImpl hygfPreparationMoneyAuditingService;
@Autowired
private HygfReplenishmentMapper hygfReplenishmentMapper;
@Autowired
private WorkflowFeignClient workflowFeignClient;
private static final String regionRedis = "app_region_redis";
private static final String PROCESSKEY = "DeliveryManagement";
......@@ -185,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;
}
......@@ -212,13 +232,45 @@ 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);
if (CollectionUtil.isNotEmpty(hygfPreparationMoneyAuditings) && hygfPreparationMoneyAuditings.size()>0 ){
if (!StringUtils.isEmpty(hygfPreparationMoneyAuditings.get(0).getInstanceId())) {
try {
Map<String, Object> flowLoggerMap = workflowFeignClient.getFlowLogger(hygfPreparationMoneyAuditings.get(0).getInstanceId()).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);
map.put("orderTracking",loggerDto);
} catch (Exception e) {
e.printStackTrace();
}
}
}
LambdaUpdateWrapper<DocumentStation> q = new LambdaUpdateWrapper<>();
q.eq(DocumentStation::getPreparationMoneyId, sequenceNbr);
List<DocumentStation> lih = documentStationMapper.selectList(q);
......@@ -267,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);
......@@ -561,12 +631,6 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
//更新电站施工状态
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
List<DocumentStation> idsk = model.getPeasantHouseholdId();
List<Long> idsH = new ArrayList<>();
for (DocumentStation documentStation : idsk) {
idsH.add(documentStation.getStationId());
}
up.in(PeasantHousehold::getSequenceNbr, idsH);
preparationMoneyMapper.insert(model);
List<DocumentStation> ids = model.getPeasantHouseholdId();
if (isSubmit.equals("0")) {
......@@ -606,18 +670,23 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
up.set(PeasantHousehold::getPreparationMoneyState, DeliveryStateeEnum.暂存发货.getCode());
model.setOrderStatus(DeliveryStateeEnum.待提交.getName());
}
peasantHouseholdMapper.update(null, up);
preparationMoneyMapper.updateById(model);
//电站信息存储
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);
peasantHouseholdMapper.update(null, up);
documentStationService.saveBatch(listDocumentStation);
}
preparationMoneyMapper.updateById(model);
} else {
......@@ -690,21 +759,34 @@ 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<>();
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);
peasantHouseholdMapper.update(null, up);
documentStationService.saveBatch(listDocumentStation);
}
}
return model;
......@@ -1016,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();
//电站信息存储
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);
}
return model;
}
......
......@@ -88,6 +88,8 @@ public class SurveyInformationServiceImpl
@Autowired
IPowerStationService powerStationService;
@Autowired
PowerStationMapper powerStationMapper;
@Autowired
ToDoTasksMapper toDoTasksMapper;
@Autowired
UserMessageMapper userMessageMapper;
......@@ -170,10 +172,19 @@ public class SurveyInformationServiceImpl
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());
......@@ -187,7 +198,7 @@ public class SurveyInformationServiceImpl
// 避免生成多份数据
extendedInformationService.saveOrUpdate(extendedInformation, new LambdaQueryWrapper<ExtendedInformation>()
.eq(ExtendedInformation::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//extendedInformationService.saveOrUpdate(extendedInformation);
// extendedInformationService.saveOrUpdate(extendedInformation);
// 更新勘察明细信息
SurveyDetailsDto oldSurveyDetails = surveyInfoAllDto.getSurveyDetails();
......@@ -196,7 +207,7 @@ public class SurveyInformationServiceImpl
// 避免生成多份数据
surveyDetailsService.saveOrUpdate(surveyDetails, new LambdaQueryWrapper<SurveyDetails>()
.eq(SurveyDetails::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//surveyDetailsService.saveOrUpdate(surveyDetails);
// surveyDetailsService.saveOrUpdate(surveyDetails);
// 更新商务信息
CommercialDto oldCommercial = surveyInfoAllDto.getCommercial();
......@@ -215,11 +226,14 @@ public class SurveyInformationServiceImpl
// 避免生成多份数据
commercialService.saveOrUpdate(commercial, new LambdaQueryWrapper<Commercial>()
.eq(Commercial::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//commercialService.saveOrUpdate(commercial);
// commercialService.saveOrUpdate(commercial);
// 勘察后,更新状态
// QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
// peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformation.getSequenceNbr());
// PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper()
// QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new
// QueryWrapper<>();
// peasantHouseholdQueryWrapper.eq("survey_information_id",
// surveyInformation.getSequenceNbr());
// PeasantHousehold peasantHousehold =
// peasantHouseholdServiceImpl.getBaseMapper()
// .selectOne(peasantHouseholdQueryWrapper);
// 更新资料归档信息
......@@ -238,7 +252,7 @@ public class SurveyInformationServiceImpl
// 避免生成多份数据
informationService.saveOrUpdate(information, new LambdaQueryWrapper<Information>()
.eq(Information::getSurveyInformationId, surveyInformation.getSequenceNbr()));
//informationService.saveOrUpdate(information);
// informationService.saveOrUpdate(information);
peasantHousehold.setOwnersName(surveyInfoAllDto.getSurveyInformation().getOwnersName());
peasantHousehold.setTelephone(surveyInfoAllDto.getSurveyInformation().getTelephone());
......
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