Commit eab39c97 authored by suhuiguang's avatar suhuiguang

reafact(jyjc): 压力管道管道长度

1.压力管道管道长度调整为字符串/分隔开 2.手工录入结果适配调整 3.系统对接时管道长度适配
parent 0f9103d4
...@@ -34,6 +34,7 @@ import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum; ...@@ -34,6 +34,7 @@ import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.common.biz.refresh.cm.RefreshCmService; import com.yeejoin.amos.boot.module.common.biz.refresh.cm.RefreshCmService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.EsSearchServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.EsSearchServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.utils.RefreshDataUtils; import com.yeejoin.amos.boot.module.common.biz.utils.RefreshDataUtils;
import com.yeejoin.amos.boot.module.jg.api.common.BizCommonConstant;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeEqDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeEqDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto;
import com.yeejoin.amos.boot.module.jg.api.dto.PieLineEquipContraptionDto; import com.yeejoin.amos.boot.module.jg.api.dto.PieLineEquipContraptionDto;
...@@ -2542,8 +2543,8 @@ public class DataHandlerServiceImpl { ...@@ -2542,8 +2543,8 @@ public class DataHandlerServiceImpl {
JSONArray jsonArray = jsonObject.getJSONArray("deviceList"); JSONArray jsonArray = jsonObject.getJSONArray("deviceList");
List<JSONObject> pipelines = jsonArray.stream().map(e->{ List<JSONObject> pipelines = jsonArray.stream().map(e->{
JSONObject pipeline = JSONObject.parseObject(e.toString()); JSONObject pipeline = JSONObject.parseObject(e.toString());
if(!pipeline.containsKey("pipeLengthText")){ if(!pipeline.containsKey(BizCommonConstant.PIPE_LENGTH)){
pipeline.put("pipeLengthText", pipeline.get("pipeLength")); pipeline.put(BizCommonConstant.PIPE_LENGTH, pipeline.get("pipeLength"));
} }
return pipeline; return pipeline;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
...@@ -2572,8 +2573,8 @@ public class DataHandlerServiceImpl { ...@@ -2572,8 +2573,8 @@ public class DataHandlerServiceImpl {
Optional.ofNullable(jsonArray).ifPresent(d->{ Optional.ofNullable(jsonArray).ifPresent(d->{
List<JSONObject> pipelines = d.stream().map(e->{ List<JSONObject> pipelines = d.stream().map(e->{
JSONObject pipeline = JSONObject.parseObject(e.toString()); JSONObject pipeline = JSONObject.parseObject(e.toString());
if(!pipeline.containsKey("pipeLengthText")){ if(!pipeline.containsKey(BizCommonConstant.PIPE_LENGTH)){
pipeline.put("pipeLengthText", pipeline.get("pipeLength")); pipeline.put(BizCommonConstant.PIPE_LENGTH, pipeline.get("pipeLength"));
} }
return pipeline; return pipeline;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
...@@ -2597,8 +2598,8 @@ public class DataHandlerServiceImpl { ...@@ -2597,8 +2598,8 @@ public class DataHandlerServiceImpl {
Optional.ofNullable(jsonArray).ifPresent(d->{ Optional.ofNullable(jsonArray).ifPresent(d->{
List<JSONObject> pipelines = d.stream().map(e->{ List<JSONObject> pipelines = d.stream().map(e->{
JSONObject pipeline = JSONObject.parseObject(e.toString()); JSONObject pipeline = JSONObject.parseObject(e.toString());
if(!pipeline.containsKey("pipeLengthText")){ if(!pipeline.containsKey(BizCommonConstant.PIPE_LENGTH)){
pipeline.put("pipeLengthText", pipeline.get("pipeLength")); pipeline.put(BizCommonConstant.PIPE_LENGTH, pipeline.get("pipeLength"));
} }
return pipeline; return pipeline;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
...@@ -2622,8 +2623,8 @@ public class DataHandlerServiceImpl { ...@@ -2622,8 +2623,8 @@ public class DataHandlerServiceImpl {
Optional.ofNullable(jsonArray).ifPresent(d->{ Optional.ofNullable(jsonArray).ifPresent(d->{
List<JSONObject> pipelines = d.stream().map(e->{ List<JSONObject> pipelines = d.stream().map(e->{
JSONObject pipeline = JSONObject.parseObject(e.toString()); JSONObject pipeline = JSONObject.parseObject(e.toString());
if(!pipeline.containsKey("pipeLengthText")){ if(!pipeline.containsKey(BizCommonConstant.PIPE_LENGTH)){
pipeline.put("pipeLengthText", pipeline.get("pipeLength")); pipeline.put(BizCommonConstant.PIPE_LENGTH, pipeline.get("pipeLength"));
} }
return pipeline; return pipeline;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
......
...@@ -37,4 +37,11 @@ public class HisDataHandlerController { ...@@ -37,4 +37,11 @@ public class HisDataHandlerController {
hisDataHandlerService.openDataHandlerV1(); hisDataHandlerService.openDataHandlerV1();
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/fixPipeLen")
@ApiOperation(httpMethod = "PUT", value = "压力管道报检结果管道长度补充", notes = "压力管道报检结果管道长度补充")
public ResponseModel<Long> pipeLenFix() {
return ResponseHelper.buildResponse(hisDataHandlerService.pipeLenFix());
}
} }
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl; package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import cn.hutool.core.date.StopWatch;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.module.common.api.dto.BaseEnterpriseCertDto; import com.yeejoin.amos.boot.module.common.api.dto.BaseEnterpriseCertDto;
import com.yeejoin.amos.boot.module.common.api.entity.BaseEnterpriseCert; import com.yeejoin.amos.boot.module.common.api.entity.BaseEnterpriseCert;
import com.yeejoin.amos.boot.module.common.biz.service.impl.BaseEnterpriseCertServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.BaseEnterpriseCertServiceImpl;
import com.yeejoin.amos.boot.module.jyjc.api.common.BizCommonConstant; import com.yeejoin.amos.boot.module.jyjc.api.common.BizCommonConstant;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication; import com.yeejoin.amos.boot.module.jyjc.api.entity.*;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationEquip;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionHistory;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationEquipMapper; import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationEquipMapper;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationMapper; import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationMapper;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionResultParamMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity; import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
@Slf4j @Slf4j
...@@ -40,6 +44,12 @@ public class HisDataHandlerServiceImpl { ...@@ -40,6 +44,12 @@ public class HisDataHandlerServiceImpl {
@Resource @Resource
private BaseEnterpriseCertServiceImpl enterpriseCertService; private BaseEnterpriseCertServiceImpl enterpriseCertService;
@Resource
private JyjcInspectionResultParamMapper jyjcInspectionResultParamMapper;
@Resource
private ObjectMapper objectMapper;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void pieLineDataHandlerV1() { public void pieLineDataHandlerV1() {
List<JyjcInspectionApplicationEquip> applicationEquips = jyjcInspectionApplicationEquipMapper.queryWaitFlushData(); List<JyjcInspectionApplicationEquip> applicationEquips = jyjcInspectionApplicationEquipMapper.queryWaitFlushData();
...@@ -81,4 +91,37 @@ public class HisDataHandlerServiceImpl { ...@@ -81,4 +91,37 @@ public class HisDataHandlerServiceImpl {
enterpriseCertService.update(null, updateWrapperCert); enterpriseCertService.update(null, updateWrapperCert);
}); });
} }
public Long pipeLenFix() {
StopWatch watch = new StopWatch();
watch.start();
List<JyjcInspectionResultParam> resultParams = jyjcInspectionResultParamMapper.selectList(new LambdaQueryWrapper<JyjcInspectionResultParam>().eq(JyjcInspectionResultParam::getParamType, "IdxBizJgTechParamsPipeline"));
resultParams.parallelStream().forEach(c -> {
JSONObject paramObj = JSON.parseObject(c.getParamJson());
if(paramObj != null){
try {
List<Map<String, Object>> equips = objectMapper.readValue(
objectMapper.writeValueAsString(paramObj.get("equip")),
new TypeReference<ArrayList<Map<String, Object>>>() {
}
);
equips.forEach(equip -> {
if (!equip.containsKey(com.yeejoin.amos.boot.module.jg.api.common.BizCommonConstant.PIPE_LENGTH)) {
equip.put(com.yeejoin.amos.boot.module.jg.api.common.BizCommonConstant.PIPE_LENGTH, equip.get("pipeLength"));
}
});
paramObj.put("equip", equips);
LambdaUpdateWrapper<JyjcInspectionResultParam> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(JyjcInspectionResultParam::getParamJson, JSON.toJSONString(paramObj));
updateWrapper.eq(BaseEntity::getSequenceNbr, c.getSequenceNbr());
jyjcInspectionResultParamMapper.update(null, updateWrapper);
} catch (Exception e) {
log.error(e.getMessage());
}
}
});
watch.stop();
log.info("压力管道检验技术参数补充字段pipeLengthText,总处理数量:{}, 耗时信息:{}", resultParams.size(), watch.getTotalTimeSeconds());
return (long) resultParams.size();
}
} }
...@@ -98,9 +98,10 @@ public class IdxBizJgTechParamsPipeline extends TzsBaseEntity { ...@@ -98,9 +98,10 @@ public class IdxBizJgTechParamsPipeline extends TzsBaseEntity {
/** /**
* *
*/ */
@TableField(value = "\"PIPE_LENGTH\"", fill = FieldFill.INSERT_UPDATE) @TableField(value = "\"PIPE_LENGTH\"")
private String pipeLength; private String pipeLength;
/** /**
* *
*/ */
...@@ -172,7 +173,7 @@ public class IdxBizJgTechParamsPipeline extends TzsBaseEntity { ...@@ -172,7 +173,7 @@ public class IdxBizJgTechParamsPipeline extends TzsBaseEntity {
/** /**
* 管道长度斜线分隔多段表示用:数字或者 / 分割的数字,如2.1/6.3 * 管道长度斜线分隔多段表示用:数字或者 / 分割的数字,如2.1/6.3
*/ */
@TableField("\"PIPE_LENGTH_TEXT\"") @TableField(value = "\"PIPE_LENGTH_TEXT\"", fill = FieldFill.INSERT_UPDATE)
private String pipeLengthText; private String pipeLengthText;
} }
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