Commit 03cac481 authored by 刘林's avatar 刘林

Merge branch 'refs/heads/develop_tzs_bugfix' into develop_tzs_register

parents 6a507e4f cfa77872
......@@ -872,7 +872,7 @@ public class CommonController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "使用登记表生成", notes = "使用登记表生成")
@PostMapping(value = "/getRegistrationFormUrl")
@FieldMapping({@FieldMapping.FieldMap(sourceField = "formData.estateUnitSeq", targetField = "formData.estateUnitName", serviceClass = CommonServiceImpl.class, queryMethod = "queryUnitCreditInfoBySeq", overrideSource = true)})
@FieldMapping({@FieldMapping.FieldMap(sourceField = "formData.estateUnitSeq", targetField = "formData.estateUnitName", serviceClass = CommonServiceImpl.class, queryMethod = "queryUnitCreditInfoBySeq")})
public ResponseModel<Map<String, Object>> getRegistrationFormUrl(@RequestBody JSONObject map) {
JSONObject formData = JSONObject.parseObject(JSONObject.toJSONString(map.get("formData")));
String manageType = String.valueOf(map.get("manageType"));
......
......@@ -38,7 +38,7 @@ public class DataDockController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/xi-an/saveEquipmentData")
@ApiOperation(httpMethod = "POST", value = "西安数据对接-设备批量导入", notes = "西安数据对接-导入多个设备的数据文件")
public ResponseModel<?> saveEquipmentData(@RequestBody List<Map<String, Object>> equLists) throws Exception {
public ResponseModel<?> saveEquipmentData(@RequestBody List<Map<String, Object>> equLists) {
return ResponseHelper.buildResponse(dataDockService.xiAnSaveEquipmentData(equLists));
}
......@@ -130,14 +130,14 @@ public class DataDockController extends BaseController {
}
/**
* 气瓶批量保存
* 台套类设备,气瓶,新管道都使用此方法
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/saveSetEquipImportData")
@ApiOperation(httpMethod = "POST", value = "台套类设备导入字段保存", notes = "台套类设备导入字段保存")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<?> saveSetEquipImportData(@RequestBody Map<String, Object> paramMap) {
return ResponseHelper.buildResponse(dataDockService.saveSetEquipImportData(paramMap));
public ResponseModel<?> saveEquipImportData(@RequestBody Map<String, Object> paramMap) {
return ResponseHelper.buildResponse(dataDockService.saveEquipImportData(paramMap));
}
/**
......
......@@ -100,4 +100,17 @@ public class JgEnableDisableController extends BaseController {
public ResponseModel<Object> detail(@RequestParam("sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(jgEnableDisableServiceImpl.getDetail(sequenceNbr, getSelectedOrgInfo().getCompany()));
}
/**
* 处理设备启用停用流程结束,业务未结束单子问题
* @param applyNo 申请单号
* @return s
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/handleEnableDisableWrongData")
@ApiOperation(httpMethod = "POST", value = "处理设备启用停用流程结束,业务未结束单子问题", notes = "处理设备启用停用流程结束,业务未结束单子问题")
public ResponseModel<Object> handleEnableDisableWrongData(@RequestParam("applyNo") String applyNo) {
jgEnableDisableServiceImpl.handleEnableDisableWrongData(applyNo);
return ResponseHelper.buildResponse("ok");
}
}
......@@ -161,7 +161,7 @@ public class JgScrapCancelController extends BaseController {
* @return s
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/handleNoticeWrongData")
@PostMapping(value = "/handleScrapCancelWrongData")
@ApiOperation(httpMethod = "POST", value = "处理设备报废注销流程结束,业务未结束单子问题", notes = "处理设备报废注销流程结束,业务未结束单子问题")
public ResponseModel<Object> handleScrapCancelWrongData(@RequestParam("applyNo") String applyNo) {
jgScrapCancelService.handleScrapCancelWrongData(applyNo);
......
......@@ -290,11 +290,16 @@ public class JgUseRegistrationController extends BaseController {
return ResponseHelper.buildResponse(result);
}
/**
* 处理使用登记流程结束,业务未结束单子问题
* @param applyNoList 申请单号集合
* @return s
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/yunWei/yuLin")
@ApiOperation(httpMethod = "POST", value = "榆林使用登记错误数据处理", notes = "榆林使用登记错误数据处理")
public ResponseModel<Object> yunWeiRegistrationWrongData(@RequestBody List<String> applayNoList) {
jgUseRegistrationServiceImpl.correctWrongData(applayNoList);
@PostMapping(value = "/yunWei/handleRegistrationWrongData")
@ApiOperation(httpMethod = "POST", value = "处理使用登记流程结束,业务未结束单子问题", notes = "处理使用登记流程结束,业务未结束单子问题")
public ResponseModel<Object> yunWeiRegistrationWrongData(@RequestBody List<String> applyNoList) {
jgUseRegistrationServiceImpl.correctWrongData(applyNoList);
return ResponseHelper.buildResponse("ok");
}
......
......@@ -117,6 +117,7 @@ import java.io.*;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
......@@ -2511,11 +2512,7 @@ public class CommonServiceImpl implements ICommonService {
if (manageType.equals(UNIT) && !CollectionUtils.isEmpty(equips)) {
//管道计算的是管道长度
if ("8000".equals(formData.getString("equListCode")) || "8000".equals(formData.getString("EQU_LIST_CODE"))) {
double pipeLength = equips.stream().filter(Objects::nonNull)
.filter(map -> map.containsKey("pipeLength") && StringUtils.isNotEmpty((String) map.get("pipeLength")))
.mapToDouble(map -> Double.parseDouble((String) map.get("pipeLength")))
.sum();
formData.put("equNum", pipeLength + "(m)");
formData.put("equNum", calTotalLength(equips) + "(m)");
} else {
//设备数量
formData.put("equNum", equipmentLists.size());
......@@ -2615,6 +2612,12 @@ public class CommonServiceImpl implements ICommonService {
return formData;
}
public static String calTotalLength(List<Map<String, Object>> equList) {
double pipeLengthSum = equList.stream().map(r -> r.get("pipeLength")).filter(Objects::nonNull).mapToDouble(l -> Double.parseDouble(String.valueOf(l))).sum();
BigDecimal pipeLengthSumBig = new BigDecimal(String.valueOf(pipeLengthSum)).setScale(3, RoundingMode.HALF_UP);
return pipeLengthSumBig.toPlainString();
}
public List<JSONObject> buildFileForOverDesign(JSONObject jsonObject) {
List<JSONObject> formDataList = new ArrayList<>();
if (jsonObject.containsKey("equipmentLists")) {
......
......@@ -74,6 +74,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -303,7 +304,7 @@ public class DataDockServiceImpl {
.list().stream().findFirst().orElse(null);
}
projectContraption.setRecDate(new Date());
projectContraption.setDataQualityScore("1");
projectContraption.setDataQualityScore("3");
if (ObjectUtils.isEmpty(oldContraption) ) { // save
sequenceNbr = sequence.nextId();
projectContraption.setSequenceNbr(sequenceNbr);
......@@ -323,7 +324,7 @@ public class DataDockServiceImpl {
projectContraption.setEquCategoryName(EquCategoryConverter.getKeyByValue((String) equ.get("equCategory")));
projectContraption.setEquDefine((String) equ.get("equDefine"));
projectContraption.setEquDefineName(EquDefineConverter.getKeyByValue((String) equ.get("equDefine")));
projectContraption.setPipelineLength(Double.parseDouble((String) equ.get("pipeLength")));
projectContraption.setPipelineLength(new BigDecimal(Objects.toString(equ.get("totalPipeLength"), "0")).doubleValue());
projectContraption.setUseRegistrationCode((String) equ.get("useOrgCode"));
projectContraption.setIsIntoManagement(Boolean.FALSE);
projectContraption.setDataSource(dataSource);
......@@ -1564,7 +1565,16 @@ public class DataDockServiceImpl {
}
Set<String> recordSet = new HashSet<>();
Set<String> projectContraptionSet = new HashSet<>();
Map<String, Long> projectContraptionMap = new HashMap<>(); // 循环外声明
Map<String, Long> projectContraptionMap = new HashMap<>();
Map<String, BigDecimal> pipeLengthMap = equipInfoExcelDtos.stream()
.collect(Collectors.groupingBy(
e -> Objects.toString(e.getProjectContraptionNo(), "").trim(),
Collectors.mapping(
e -> new BigDecimal(Objects.toString(e.getPipeLength(), "0")),
Collectors.reducing(BigDecimal.ZERO, BigDecimal::add)
)
));
Set<String> projectContraptionIdSet = new HashSet<>();
for (EquipInfoExcelDto equ : equipInfoExcelDtos) {
List<Map<String, Object>> fileDataList = (List<Map<String, Object>>) equ.getFileData();
Map<String, Object> equMap = (Map<String, Object>) JSON.parseObject(toJSONString(equ), Map.class);
......@@ -1579,26 +1589,30 @@ public class DataDockServiceImpl {
String projectContraptionNo = Objects.toString(equMap.get("projectContraptionNo"), "").trim();
Long projectContraptionId;
if (!projectContraptionSet.contains(projectContraptionNo)) {
projectContraptionId = saveProjectContraption(equMap, equList, company, dataSource);
BigDecimal totalPipeLength = pipeLengthMap.getOrDefault(projectContraptionNo, BigDecimal.ZERO);
equMap.put("totalPipeLength",totalPipeLength);
projectContraptionId = this.saveProjectContraption(equMap, equList, company, dataSource);
projectContraptionSet.add(projectContraptionNo);
projectContraptionMap.put(projectContraptionNo, projectContraptionId);
} else {
projectContraptionId = projectContraptionMap.get(projectContraptionNo);
}
equMap.put("projectContraptionId", projectContraptionId);
String record = saveEquipmentDataInTransaction(equMap, dataSource, remark);
if (projectContraptionId != null) {
projectContraptionIdSet.add(String.valueOf(projectContraptionId));
equMap.put("projectContraptionId", projectContraptionId);
}
String record = this.saveEquipmentDataInTransaction(equMap, dataSource, remark);
recordSet.add(record);
}
this.createResumeBatch(recordSet,dataSource, equipRoutePath, company);
eventPublisher.publish(new EquipCreateOrEditEvent(
this,
BusinessTypeEnum.JG_NEW_EQUIP.name(),
recordSet,
EquipCreateOrEditEvent.EquipType.equip
));
if (EquipmentClassifityEnum.YLGD.getCode().equals(equList)) {
this.createResumePipelineBatch(projectContraptionIdSet, String.format(pipelineRoutePath, projectContraptionIdSet), company);
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_PROJECT.name(), projectContraptionIdSet, EquipCreateOrEditEvent.EquipType.project));
}else{
this.createResumeBatch(recordSet,dataSource, equipRoutePath, company);
eventPublisher.publish(new EquipCreateOrEditEvent(this,BusinessTypeEnum.JG_NEW_EQUIP.name(),recordSet, EquipCreateOrEditEvent.EquipType.equip));
}
}
private void createResumeBatch(Set<String> records, String dataSource, String routePath, CompanyBo company) {
jgResumeInfoService.saveBatchResume(records.stream().map(record->JgResumeInfoDto.builder()
.businessType(BusinessTypeEnum.JG_NEW_EQUIP.getName())
......@@ -1613,6 +1627,20 @@ public class DataDockServiceImpl {
);
}
private void createResumePipelineBatch(Set<String> projectContraptionIdSet, String routePath, CompanyBo company) {
jgResumeInfoService.saveBatchResume(projectContraptionIdSet.stream().map(projectContraptionId ->JgResumeInfoDto.builder()
.businessType(BusinessTypeEnum.JG_NEW_PROJECT.getName())
.businessId(projectContraptionId)
.equId(projectContraptionId)
.status("正常")
.approvalUnitCode(company.getCompanyCode())
.approvalUnit(company.getCompanyName())
.changeContent(BusinessTypeEnum.JG_NEW_PROJECT.getName() + "业务办理")
.routePath(routePath)
.build()).collect(Collectors.toList())
);
}
/**
* 批量异步保存设备数据
*
......@@ -1770,7 +1798,7 @@ public class DataDockServiceImpl {
}
@Transactional(rollbackFor = Exception.class)
public Object saveSetEquipImportData(Map<String, Object> paramMap) {
public Object saveEquipImportData(Map<String, Object> paramMap) {
if (paramMap == null) {
throw new IllegalArgumentException("参数Map不能为空");
}
......
......@@ -3959,7 +3959,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private String getDataSource(String operateType, LinkedHashMap equipmentInfoForm) {
// 数据来源 历史数据his 新数据new
String equipSource = String.valueOf(equipmentInfoForm.get(DATA_SOURCE));
return "new".equals(equipSource) ? "jg" : "his".equals(equipSource) ? "jg_his" : "jg_his_black";
return "new".equals(equipSource) ? "jg"
: "his".equals(equipSource) ? "jg_his"
: "jg_pl".equals(equipSource) ? "jg_pl"
: "jg_his_black";
}
public void checkEsData(String id) {
......
......@@ -13,10 +13,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisable;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisableEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
......@@ -858,4 +855,41 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
commonService.saveExecuteFlowData2Redis(jgEnableDisable.getInstanceId(), this.buildInstanceRuntimeData(jgEnableDisable));
}
public void handleEnableDisableWrongData(String applyNo) {
JgEnableDisable jgEnableDisable = this.baseMapper.selectOne(new LambdaQueryWrapper<JgEnableDisable>()
.eq(JgEnableDisable::getApplyNo, applyNo)
.eq(JgEnableDisable::getIsDelete, 0));
WorkflowResultDto workflowResultDto = new WorkflowResultDto();
workflowResultDto.setNextTaskCode("已完成");
workflowResultDto.setNextTaskId(jgEnableDisable.getNextTaskId());
workflowResultDto.setNextExecutorUserIds(jgEnableDisable.getNextExecuteUserIds());
if (StringUtils.isEmpty(workflowResultDto.getNextExecutorRoleIds())) {
jgEnableDisable.setPromoter("");
jgEnableDisable.setAuditPassDate(new Date());
jgEnableDisable.setAuditStatus(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getName()));
// 上个代办改为已办
HashMap<String, Object> taskMap = new HashMap<>();
taskMap.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
taskMap.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
taskMap.put("relationId", jgEnableDisable.getInstanceId());
taskMap.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
taskMap.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtils.copyProperties(jgEnableDisable, taskMessageDto);
taskMap.put("model", jgEnableDisable);
// 更新业务数据
updateInfoOther(jgEnableDisable);
TaskV2Model taskV2Model1 = commonService.updateTaskModel(taskMap);
// 完成后发送数据刷新消息
this.sendDataRefreshMsg(jgEnableDisable);
// 创建设备履历
this.createResume(jgEnableDisable, taskV2Model1.getRoutePath());
}
jgEnableDisable.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
jgEnableDisable.setNextTaskId(workflowResultDto.getNextTaskId());
this.baseMapper.updateById(jgEnableDisable);
// redis流程实时数据更新
commonService.saveExecuteFlowData2Redis(jgEnableDisable.getInstanceId(), this.buildInstanceRuntimeData(jgEnableDisable));
this.delRepeatUseEquipData(jgEnableDisable);
}
}
\ No newline at end of file
......@@ -38,7 +38,6 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.SuperviseInfoMapper;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
......@@ -1156,5 +1155,6 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
this.sendDataRefreshMsg(jgScrapCancel);
// 创建设备履历
this.createResume(jgScrapCancel, taskV2Model.getRoutePath());
this.getBaseMapper().updateById(jgScrapCancel);
}
}
......@@ -3983,8 +3983,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
commonServiceImpl.updateTaskModel(taskMap);
}
public void correctWrongData(List<String> applayNoList) {
List<JgUseRegistration> jgUseRegistrationList = jgUseRegistrationMapper.selectList(new LambdaQueryWrapper<JgUseRegistration>().in(JgUseRegistration::getApplyNo, applayNoList));
public void correctWrongData(List<String> applyNoList) {
List<JgUseRegistration> jgUseRegistrationList = jgUseRegistrationMapper.selectList(new LambdaQueryWrapper<JgUseRegistration>().in(JgUseRegistration::getApplyNo, applyNoList));
jgUseRegistrationList.forEach(jgUseRegistration -> {
WorkflowResultDto workflowResultDto = new WorkflowResultDto();
workflowResultDto.setNextExecutorRoleIds(jgUseRegistration.getNextExecuteIds());
......
......@@ -251,7 +251,7 @@
FROM (
SELECT "RECORD", project_contraption_id
FROM idx_biz_jg_use_info
WHERE project_contraption_id != null
WHERE project_contraption_id is not null
AND project_contraption_id = ANY(
ARRAY[
<foreach collection="projectContraptionIdList" item="id" index="index" separator=",">
......
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