Commit 5c5a665e authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_pipeline' into develop_tzs_register

parents 83f1b480 0449e324
package com.yeejoin.amos.boot.biz.common.annotation;
import java.lang.annotation.*;
/**
* @author DELL
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Documented
public @interface PipeLengthField {
String sourceField() default "pipeLengthText";
String targetField() default "pipeLength";
}
package com.yeejoin.amos.boot.biz.common.entity; package com.yeejoin.amos.boot.biz.common.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
...@@ -22,7 +23,7 @@ public class TzsBaseEntity implements Serializable{ ...@@ -22,7 +23,7 @@ public class TzsBaseEntity implements Serializable{
protected String sequenceNbr; protected String sequenceNbr;
@TableField("\"REC_DATE\"") @TableField("\"REC_DATE\"")
protected Date recDate; protected Date recDate;
@TableField("\"REC_USER_ID\"") @TableField(value = "\"REC_USER_ID\"", fill = FieldFill.INSERT_UPDATE)
protected String recUserId; protected String recUserId;
/** /**
......
...@@ -2,7 +2,9 @@ package com.yeejoin.amos.boot.biz.config; ...@@ -2,7 +2,9 @@ package com.yeejoin.amos.boot.biz.config;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.yeejoin.amos.boot.biz.common.annotation.FillCommonUserField; import com.yeejoin.amos.boot.biz.common.annotation.FillCommonUserField;
import com.yeejoin.amos.boot.biz.common.annotation.PipeLengthField;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
...@@ -15,7 +17,12 @@ import org.springframework.util.ObjectUtils; ...@@ -15,7 +17,12 @@ import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.Map;
import java.util.Objects;
/** /**
* @author Dell * @author Dell
...@@ -42,17 +49,89 @@ public class MetaHandler implements MetaObjectHandler { ...@@ -42,17 +49,89 @@ public class MetaHandler implements MetaObjectHandler {
@Override @Override
public void insertFill(MetaObject metaObject) { public void insertFill(MetaObject metaObject) {
Date currentDate = new Date(); Date currentDate = new Date();
Class clazz = metaObject.getOriginalObject().getClass(); Object originalObj = metaObject.getOriginalObject();
FillCommonUserField annotation = (FillCommonUserField) clazz.getAnnotation(FillCommonUserField.class); Class<?> clazz = originalObj.getClass();
// 处理 Map 封装的情况(update(entity, wrapper) 方式)
if (originalObj instanceof Map) {
Map<?,?> map = (Map<?,?>) originalObj;
Object et = map.get(Constants.ENTITY); // MyBatis-Plus 的实体key
clazz = (et != null) ? et.getClass() : clazz;
}
FillCommonUserField annotation = clazz.getAnnotation(FillCommonUserField.class);
if (annotation == null || annotation.isAutoFill()) { if (annotation == null || annotation.isAutoFill()) {
autoFillUser(metaObject, metaObject.getOriginalObject()); autoFillUser(metaObject, metaObject.getOriginalObject());
} }
//如果有上传创建时间,不需要修改 PipeLengthField pipeLengthField = clazz.getAnnotation(PipeLengthField.class);
// if(metaObject.getValue("createDate")==null){ if(pipeLengthField != null){
// } processAutoFill(metaObject, pipeLengthField);
}
this.setFieldValByName("createDate", currentDate, metaObject); this.setFieldValByName("createDate", currentDate, metaObject);
} }
private void processAutoFill(MetaObject metaObject, PipeLengthField pipeLengthField) {
// 1. 防御性校验
if (metaObject == null || pipeLengthField == null) {
return;
}
if (StringUtils.isBlank(pipeLengthField.sourceField()) ||
StringUtils.isBlank(pipeLengthField.targetField())) {
return;
}
// 2. 获取实际要操作的对象(处理Map封装情况)
Object operationObj = getOperationObject(metaObject);
if (operationObj == null) {
return;
}
// 3. 重新基于实际对象创建MetaObject
MetaObject targetMetaObject = metaObject.hasGetter(Constants.ENTITY)
? MetaObject.forObject(operationObj, metaObject.getObjectFactory(), metaObject.getObjectWrapperFactory(), metaObject.getReflectorFactory())
: metaObject;
// 4. 安全取值
if (!targetMetaObject.hasGetter(pipeLengthField.sourceField())) {
return;
}
Object sourceValue = targetMetaObject.getValue(pipeLengthField.sourceField());
if (sourceValue == null) {
return;
}
// 5. 转换并设值
Object convertedValue = convertValue(sourceValue, pipeLengthField);
this.setFieldValByName(pipeLengthField.targetField(), convertedValue, targetMetaObject);
}
/**
* 处理Map类型的参数封装
*/
private Object getOperationObject(MetaObject metaObject) {
Object original = metaObject.getOriginalObject();
// 处理update(entity, wrapper)产生的Map封装
if (original instanceof Map) {
Map<?, ?> map = (Map<?, ?>) original;
// MyBatis-Plus的标准实体key
return map.get(Constants.ENTITY) == null ? original : map.get(Constants.ENTITY);
}
return original;
}
private Object convertValue(Object sourceValue, PipeLengthField pipeLengthField) {
// 示例:针对pipeLength的特殊处理
if ("pipeLengthText".equals(pipeLengthField.sourceField())) {
return Arrays.stream(sourceValue.toString().split("/")).filter(Objects::nonNull)
.map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(3, RoundingMode.HALF_UP).stripTrailingZeros().toPlainString();
}
// 可扩展其他转换规则
return sourceValue;
}
private void autoFillUser(MetaObject metaObject, Object entity) { private void autoFillUser(MetaObject metaObject, Object entity) {
//获取用户信息 以及当前用户登录公司部门,角色 //获取用户信息 以及当前用户登录公司部门,角色
String userId = RequestContext.getExeUserId(); String userId = RequestContext.getExeUserId();
...@@ -152,7 +231,14 @@ public class MetaHandler implements MetaObjectHandler { ...@@ -152,7 +231,14 @@ public class MetaHandler implements MetaObjectHandler {
*/ */
@Override @Override
public void updateFill(MetaObject metaObject) { public void updateFill(MetaObject metaObject) {
Class<?> clazz = metaObject.getOriginalObject().getClass(); Object originalObj = metaObject.getOriginalObject();
Class<?> clazz = originalObj.getClass();
// 处理 Map 封装的情况(update(entity, wrapper) 方式)
if (originalObj instanceof Map) {
Map<?,?> map = (Map<?,?>) originalObj;
Object et = map.get(Constants.ENTITY); // MyBatis-Plus 的实体key
clazz = (et != null) ? et.getClass() : clazz;
}
FillCommonUserField annotation = clazz.getAnnotation(FillCommonUserField.class); FillCommonUserField annotation = clazz.getAnnotation(FillCommonUserField.class);
if (annotation == null || annotation.isAutoFill()) { if (annotation == null || annotation.isAutoFill()) {
String userId = RequestContext.getExeUserId(); String userId = RequestContext.getExeUserId();
...@@ -165,5 +251,9 @@ public class MetaHandler implements MetaObjectHandler { ...@@ -165,5 +251,9 @@ public class MetaHandler implements MetaObjectHandler {
AgencyUserModel agencyUserModel = reginParams.getUserModel(); AgencyUserModel agencyUserModel = reginParams.getUserModel();
recInfoUpdate(metaObject, agencyUserModel); recInfoUpdate(metaObject, agencyUserModel);
} }
PipeLengthField pipeLengthField = clazz.getAnnotation(PipeLengthField.class);
if(pipeLengthField != null){
processAutoFill(metaObject, pipeLengthField);
}
} }
} }
\ No newline at end of file
...@@ -98,7 +98,7 @@ public class TechParamUtil { ...@@ -98,7 +98,7 @@ public class TechParamUtil {
return subClass; return subClass;
} }
} }
throw new RuntimeException("not found equListCode " + equListCode + "clazz"); throw new RuntimeException("not found equListCode:{ " + equListCode + "} clazz");
} }
} }
...@@ -13,4 +13,8 @@ public interface BizCommonConstant { ...@@ -13,4 +13,8 @@ public interface BizCommonConstant {
String COMPANY_TREE_REDIS_KEY = "REGULATOR_UNIT_TREE"; String COMPANY_TREE_REDIS_KEY = "REGULATOR_UNIT_TREE";
String EQU_CATEGORY_CYLINDER = "2300"; String EQU_CATEGORY_CYLINDER = "2300";
String PIPE_LENGTH = "pipeLengthText";
String PIPE_LENGTH_SPILT = "/";
} }
...@@ -40,8 +40,8 @@ public class DataDockTemplateVersionUtils { ...@@ -40,8 +40,8 @@ public class DataDockTemplateVersionUtils {
public static final Map<String, String> VERSION_MAP = new HashMap<>(); public static final Map<String, String> VERSION_MAP = new HashMap<>();
static { static {
VERSION_MAP.put("工业管道设备", "V1.0.0"); VERSION_MAP.put("工业管道设备", "V1.0.1");
VERSION_MAP.put("公用管道设备", "V1.0.0"); VERSION_MAP.put("公用管道设备", "V1.0.1");
VERSION_MAP.put("历史无证_压力容器设备_氧舱", "V1.0.1"); VERSION_MAP.put("历史无证_压力容器设备_氧舱", "V1.0.1");
VERSION_MAP.put("历史无证设备_场内机动车辆", "V1.0.1"); VERSION_MAP.put("历史无证设备_场内机动车辆", "V1.0.1");
VERSION_MAP.put("历史无证设备_电梯设备", "V1.0.1"); VERSION_MAP.put("历史无证设备_电梯设备", "V1.0.1");
...@@ -64,7 +64,7 @@ public class DataDockTemplateVersionUtils { ...@@ -64,7 +64,7 @@ public class DataDockTemplateVersionUtils {
VERSION_MAP.put("历史有证_游乐设施设备", "V1.0.0"); VERSION_MAP.put("历史有证_游乐设施设备", "V1.0.0");
VERSION_MAP.put("新设备_场内机动车辆", "V1.0.0"); VERSION_MAP.put("新设备_场内机动车辆", "V1.0.0");
VERSION_MAP.put("新设备_电梯设备", "V1.0.1"); VERSION_MAP.put("新设备_电梯设备", "V1.0.1");
VERSION_MAP.put("新设备_管道设备", "V1.0.0"); VERSION_MAP.put("新设备_管道设备", "V1.0.1");
VERSION_MAP.put("新设备_锅炉设备", "V1.0.0"); VERSION_MAP.put("新设备_锅炉设备", "V1.0.0");
VERSION_MAP.put("新设备_起重机械设备", "V1.0.0"); VERSION_MAP.put("新设备_起重机械设备", "V1.0.0");
VERSION_MAP.put("新设备_索道设备", "V1.0.0"); VERSION_MAP.put("新设备_索道设备", "V1.0.0");
......
package com.yeejoin.amos.boot.module.jg.api.common;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.util.StringUtil;
import com.yeejoin.amos.boot.module.jg.api.dto.PipingExcelDto;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import static com.yeejoin.amos.boot.module.jg.api.common.BizCommonConstant.PIPE_LENGTH;
import static com.yeejoin.amos.boot.module.jg.api.common.BizCommonConstant.PIPE_LENGTH_SPILT;
/**
* 管道长度计算公共类-便于统一维护口
*/
public final class PipLenCalUtils {
public static double getPipLen(JSONArray oldPipData) {
return oldPipData.stream()
.map(p -> JSON.parseObject(p.toString()))
.filter(s -> StringUtil.isNotEmpty(s.getString(PIPE_LENGTH)))
.map(d ->
Arrays.stream(d.getString(PIPE_LENGTH).split(PIPE_LENGTH_SPILT)) // 分割字符串
.map(BigDecimal::new) // 转 BigDecimal
.reduce(BigDecimal.ZERO, BigDecimal::add) // 分段求和
)
.reduce(BigDecimal.ZERO, BigDecimal::add).stripTrailingZeros() // 全局求和
.doubleValue();
}
public static double getPipLen(List<PipingExcelDto> equLists) {
return equLists.stream()
.map(PipingExcelDto::getPipeLength)
.filter(StringUtil::isNotEmpty)
.map(d ->
Arrays.stream(d.split(PIPE_LENGTH_SPILT)) // 分割字符串
.map(BigDecimal::new) // 转 BigDecimal
.reduce(BigDecimal.ZERO, BigDecimal::add) // 分段求和
)
.reduce(BigDecimal.ZERO, BigDecimal::add).stripTrailingZeros() // 全局求和
.doubleValue();
}
public static String cal(String pipeLengthText) {
return Optional.ofNullable(pipeLengthText).filter(StringUtils::isNotEmpty).map(l -> Arrays.stream(l.split(PIPE_LENGTH_SPILT)).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add)).orElse(BigDecimal.ZERO).stripTrailingZeros().toPlainString();
}
public static BigDecimal calBigDecimal(String pipeLengthText) {
return Optional.ofNullable(pipeLengthText).filter(StringUtils::isNotEmpty).map(l -> Arrays.stream(l.split(PIPE_LENGTH_SPILT)).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add)).orElse(BigDecimal.ZERO).setScale(3, RoundingMode.HALF_UP);
}
}
...@@ -31,7 +31,7 @@ public class TechParamsPipelineChangeFieldDto extends BaseTechParamsFieldDto { ...@@ -31,7 +31,7 @@ public class TechParamsPipelineChangeFieldDto extends BaseTechParamsFieldDto {
private String pipelineNumber; private String pipelineNumber;
@FieldDisplayDefine(value = "管道级别", typeHandler ="pieLineLevelTypeHandler" ) @FieldDisplayDefine(value = "管道级别", typeHandler ="pieLineLevelTypeHandler")
private String deviceLevel; private String deviceLevel;
...@@ -44,7 +44,11 @@ public class TechParamsPipelineChangeFieldDto extends BaseTechParamsFieldDto { ...@@ -44,7 +44,11 @@ public class TechParamsPipelineChangeFieldDto extends BaseTechParamsFieldDto {
@FieldDisplayDefine(value = "管道长度") @FieldDisplayDefine(value = "管道长度")
private Double pipeLength; private String pipeLengthText;
@FieldDisplayDefine(value = "管道长度", isRepeatColumn = true)
private String pipeLength;
@FieldDisplayDefine(value = "设计压力") @FieldDisplayDefine(value = "设计压力")
......
...@@ -379,6 +379,7 @@ ...@@ -379,6 +379,7 @@
pp."NOMINAL_DIAMETER" nominalDiameter, pp."NOMINAL_DIAMETER" nominalDiameter,
pp."WALL_THICKNESS" wallThickness, pp."WALL_THICKNESS" wallThickness,
pp."PIPE_LENGTH" pipeLength, pp."PIPE_LENGTH" pipeLength,
pp."PIPE_LENGTH_TEXT" AS pipeLengthText,
pp."PRESSURE" pressure, pp."PRESSURE" pressure,
pp."TEMPERATURE" temperature, pp."TEMPERATURE" temperature,
pp."MEDIUM" medium, pp."MEDIUM" medium,
......
...@@ -260,6 +260,7 @@ ...@@ -260,6 +260,7 @@
pp."NOMINAL_DIAMETER" nominalDiameter, pp."NOMINAL_DIAMETER" nominalDiameter,
pp."WALL_THICKNESS" wallThickness, pp."WALL_THICKNESS" wallThickness,
pp."PIPE_LENGTH" pipeLength, pp."PIPE_LENGTH" pipeLength,
pp."PIPE_LENGTH_TEXT" AS pipeLengthText,
pp."PRESSURE" pressure, pp."PRESSURE" pressure,
pp."TEMPERATURE" temperature, pp."TEMPERATURE" temperature,
pp."MEDIUM" medium, pp."MEDIUM" medium,
......
...@@ -1120,6 +1120,7 @@ ...@@ -1120,6 +1120,7 @@
pp."NOMINAL_DIAMETER" nominalDiameter, pp."NOMINAL_DIAMETER" nominalDiameter,
pp."WALL_THICKNESS" wallThickness, pp."WALL_THICKNESS" wallThickness,
pp."PIPE_LENGTH" pipeLength, pp."PIPE_LENGTH" pipeLength,
pp."PIPE_LENGTH_TEXT" AS pipeLengthText,
pp."PRESSURE" pressure, pp."PRESSURE" pressure,
pp."TEMPERATURE" temperature, pp."TEMPERATURE" temperature,
pp."MEDIUM" medium, pp."MEDIUM" medium,
...@@ -1190,6 +1191,7 @@ ...@@ -1190,6 +1191,7 @@
ibjtpp."NOMINAL_DIAMETER" AS nominalDiameter, ibjtpp."NOMINAL_DIAMETER" AS nominalDiameter,
ibjtpp."WALL_THICKNESS" AS wallThickness, ibjtpp."WALL_THICKNESS" AS wallThickness,
ibjtpp."PIPE_LENGTH" AS pipeLength, ibjtpp."PIPE_LENGTH" AS pipeLength,
ibjtpp."PIPE_LENGTH_TEXT" AS pipeLengthText,
ibjtpp."PRESSURE" AS pressure, ibjtpp."PRESSURE" AS pressure,
ibjtpp."TEMPERATURE" AS temperature, ibjtpp."TEMPERATURE" AS temperature,
ibjtpp."MEDIUM" AS medium, ibjtpp."MEDIUM" AS medium,
......
...@@ -398,4 +398,11 @@ public class DataHandlerController extends BaseController { ...@@ -398,4 +398,11 @@ public class DataHandlerController extends BaseController {
return ResponseHelper.buildResponse(dataHandlerService.equDefineChangeFix()); return ResponseHelper.buildResponse(dataHandlerService.equDefineChangeFix());
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/fixPipeLen")
@ApiOperation(httpMethod = "PUT", value = "压力管道单据的管道长度补充", notes = "压力管道单据的管道长度补充")
public ResponseModel<Long> pipeLenFix(){
return ResponseHelper.buildResponse(dataHandlerService.pipeLenFix());
}
} }
\ No newline at end of file
...@@ -35,7 +35,7 @@ public class NewProjectEditUpdateService { ...@@ -35,7 +35,7 @@ public class NewProjectEditUpdateService {
.eq(IdxBizJgUseInfo::getProjectContraptionId, projectContraptionId) .eq(IdxBizJgUseInfo::getProjectContraptionId, projectContraptionId)
//.eq(IdxBizJgUseInfo::getIsIntoManagement, false)修改已纳管管道编辑使用登记证号,不更新bug //.eq(IdxBizJgUseInfo::getIsIntoManagement, false)修改已纳管管道编辑使用登记证号,不更新bug
.select(IdxBizJgUseInfo::getRecord, TzsBaseEntity::getSequenceNbr)); .select(IdxBizJgUseInfo::getRecord, TzsBaseEntity::getSequenceNbr));
useInfos.parallelStream().forEach(e -> { useInfos.forEach(e -> {
commonEquipDataProcessService.setNewPipelineUseState(e, projectContraption.getUseRegistrationCode()); commonEquipDataProcessService.setNewPipelineUseState(e, projectContraption.getUseRegistrationCode());
commonEquipDataProcessService.updateUseOrgCode2NewPipeline(e, projectContraption.getUseRegistrationCode()); commonEquipDataProcessService.updateUseOrgCode2NewPipeline(e, projectContraption.getUseRegistrationCode());
}); });
......
...@@ -36,6 +36,7 @@ import com.yeejoin.amos.boot.module.jg.biz.edit.typeHandler.RegionCodeTypeHandle ...@@ -36,6 +36,7 @@ import com.yeejoin.amos.boot.module.jg.biz.edit.typeHandler.RegionCodeTypeHandle
import com.yeejoin.amos.boot.module.jg.biz.edit.utils.DiffUtils; import com.yeejoin.amos.boot.module.jg.biz.edit.utils.DiffUtils;
import com.yeejoin.amos.boot.module.jg.biz.service.*; import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.*; import com.yeejoin.amos.boot.module.jg.biz.service.impl.*;
import com.yeejoin.amos.boot.module.jg.api.common.PipLenCalUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum; 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.EquipmentClassifityEnum;
...@@ -527,6 +528,7 @@ public class CommonEquipDataProcessService { ...@@ -527,6 +528,7 @@ public class CommonEquipDataProcessService {
} }
public void savePieLineTechParam(String record, List<FieldChangeMeta> allChange, TechParamsPipelineChangeFieldDto newPipeline) { public void savePieLineTechParam(String record, List<FieldChangeMeta> allChange, TechParamsPipelineChangeFieldDto newPipeline) {
this.calPipelineLength(newPipeline);
IdxBizJgTechParamsPipeline techParamsPipeline = iIdxBizJgTechParamsPipelineService.getOneData(record); IdxBizJgTechParamsPipeline techParamsPipeline = iIdxBizJgTechParamsPipelineService.getOneData(record);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉 // 技术参数对象转换为全部技术参数 ,其他无用字段去掉
TechParamsPipelineChangeFieldDto oldPipeline = techParamsPipeline != null ? BeanUtil.copyProperties(techParamsPipeline, TechParamsPipelineChangeFieldDto.class) : new TechParamsPipelineChangeFieldDto(); TechParamsPipelineChangeFieldDto oldPipeline = techParamsPipeline != null ? BeanUtil.copyProperties(techParamsPipeline, TechParamsPipelineChangeFieldDto.class) : new TechParamsPipelineChangeFieldDto();
...@@ -541,6 +543,12 @@ public class CommonEquipDataProcessService { ...@@ -541,6 +543,12 @@ public class CommonEquipDataProcessService {
allChange.addAll(pipelineChangeFields); allChange.addAll(pipelineChangeFields);
} }
private void calPipelineLength(TechParamsPipelineChangeFieldDto newPipeline) {
if(newPipeline != null){
newPipeline.setPipeLength(PipLenCalUtils.cal(newPipeline.getPipeLengthText()));
}
}
public List<FieldChangeMeta> convertBeanField2Column2(Object beanData, String changeId) { public List<FieldChangeMeta> convertBeanField2Column2(Object beanData, String changeId) {
List<FieldChangeMeta> changeData = new ArrayList<>(); List<FieldChangeMeta> changeData = new ArrayList<>();
Group group = beanData.getClass().getAnnotation(Group.class); Group group = beanData.getClass().getAnnotation(Group.class);
...@@ -1154,7 +1162,7 @@ public class CommonEquipDataProcessService { ...@@ -1154,7 +1162,7 @@ public class CommonEquipDataProcessService {
.eq(IdxBizJgUseInfo::getProjectContraptionId, projectContraptionId) .eq(IdxBizJgUseInfo::getProjectContraptionId, projectContraptionId)
.eq(IdxBizJgUseInfo::getIsIntoManagement, false) .eq(IdxBizJgUseInfo::getIsIntoManagement, false)
.select(TzsBaseEntity::getSequenceNbr, IdxBizJgUseInfo::getRecord)); .select(TzsBaseEntity::getSequenceNbr, IdxBizJgUseInfo::getRecord));
useInfos.parallelStream().forEach(e -> { useInfos.forEach(e -> {
this.setNewPipelineUseState(e, useRegistrationCode); this.setNewPipelineUseState(e, useRegistrationCode);
this.updateUseOrgCode2NewPipeline(e, useRegistrationCode); this.updateUseOrgCode2NewPipeline(e, useRegistrationCode);
}); });
......
...@@ -260,6 +260,8 @@ public class PieLineDataChangeServiceImpl { ...@@ -260,6 +260,8 @@ public class PieLineDataChangeServiceImpl {
pipelineInfo.setSequenceNbr(null); pipelineInfo.setSequenceNbr(null);
} }
idxBizJgTechParamsPipelineService.save(pipelineInfo); idxBizJgTechParamsPipelineService.save(pipelineInfo);
// todo 上方代码通过填充器,自动会填充pipeLength,如下设置是为了返回业务使用
newPieLine.setPipeLength(pipelineInfo.getPipeLength());
registerInfo.setProductName(pipelineInfo.getPipeName()); registerInfo.setProductName(pipelineInfo.getPipeName());
commonEquipDataProcessService.getJgRegisterInfoService().save(registerInfo); commonEquipDataProcessService.getJgRegisterInfoService().save(registerInfo);
...@@ -339,7 +341,6 @@ public class PieLineDataChangeServiceImpl { ...@@ -339,7 +341,6 @@ public class PieLineDataChangeServiceImpl {
wrapper.eq(BaseEntity::getSequenceNbr, projectContraptionId); wrapper.eq(BaseEntity::getSequenceNbr, projectContraptionId);
wrapper.set(IdxBizJgProjectContraption::getPipelineLength, this.calTotalPieLineLength(projectContraptionId)); wrapper.set(IdxBizJgProjectContraption::getPipelineLength, this.calTotalPieLineLength(projectContraptionId));
idxBizJgProjectContraptionServiceImpl.update(wrapper); idxBizJgProjectContraptionServiceImpl.update(wrapper);
} }
private Double calTotalPieLineLength(String projectContraptionId) { private Double calTotalPieLineLength(String projectContraptionId) {
...@@ -349,13 +350,13 @@ public class PieLineDataChangeServiceImpl { ...@@ -349,13 +350,13 @@ public class PieLineDataChangeServiceImpl {
List<IdxBizJgTechParamsPipeline> techParamsPipelines = idxBizJgTechParamsPipelineService.list(new LambdaQueryWrapper<IdxBizJgTechParamsPipeline>().in(IdxBizJgTechParamsPipeline::getRecord, records).select(IdxBizJgTechParamsPipeline::getRecord, IdxBizJgTechParamsPipeline::getPipeLength)); List<IdxBizJgTechParamsPipeline> techParamsPipelines = idxBizJgTechParamsPipelineService.list(new LambdaQueryWrapper<IdxBizJgTechParamsPipeline>().in(IdxBizJgTechParamsPipeline::getRecord, records).select(IdxBizJgTechParamsPipeline::getRecord, IdxBizJgTechParamsPipeline::getPipeLength));
return techParamsPipelines.stream().filter(i -> i.getPipeLength() != null).map(e -> new BigDecimal(e.getPipeLength())) return techParamsPipelines.stream().filter(i -> i.getPipeLength() != null).map(e -> new BigDecimal(e.getPipeLength()))
.reduce(BigDecimal.ZERO, BigDecimal::add) .reduce(BigDecimal.ZERO, BigDecimal::add)
.setScale(3, RoundingMode.HALF_UP).doubleValue(); .setScale(3, RoundingMode.HALF_UP).stripTrailingZeros().doubleValue();
} }
public String calPipelineLength(Map<String, List<PipelineChangeItemDto>> pipelineChangeItemMap) { public String calPipelineLength(Map<String, List<PipelineChangeItemDto>> pipelineChangeItemMap) {
List<PipelineChangeItemDto> newPipelines = pipelineChangeItemMap.get(EditConstant.NEW_PIPELINES); List<PipelineChangeItemDto> newPipelines = pipelineChangeItemMap.get(EditConstant.NEW_PIPELINES);
List<PipelineChangeItemDto> updPipelines = pipelineChangeItemMap.get(EditConstant.UPDATE_PIPELINES); List<PipelineChangeItemDto> updPipelines = pipelineChangeItemMap.get(EditConstant.UPDATE_PIPELINES);
return Stream.concat(newPipelines.stream(), updPipelines.stream()).filter(i -> i.getPipeLength() != null).map(e -> new BigDecimal(String.valueOf(e.getPipeLength()))).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(3, RoundingMode.HALF_UP).toPlainString(); return Stream.concat(newPipelines.stream(), updPipelines.stream()).filter(i -> i.getPipeLength() != null).map(e -> new BigDecimal(e.getPipeLength())).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(3, RoundingMode.HALF_UP).toPlainString();
} }
} }
...@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -10,6 +10,7 @@ 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.yeejoin.amos.boot.biz.common.bo.CompanyBo; import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.module.jg.api.common.PipLenCalUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.biz.edit.constant.EditConstant; import com.yeejoin.amos.boot.module.jg.biz.edit.constant.EditConstant;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.service.EsUpdateService; import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.service.EsUpdateService;
...@@ -90,6 +91,8 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS ...@@ -90,6 +91,8 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS
} else { // 更新管道逻辑 } else { // 更新管道逻辑
if (isRequireTemporarySave) {// 记录变化流水 if (isRequireTemporarySave) {// 记录变化流水
PipelineChangeItemDto pipelineOld = oldRecordPipelineMap.get(record); PipelineChangeItemDto pipelineOld = oldRecordPipelineMap.get(record);
// json时手工计算求和管道长度
pipelineNew.setPipeLength(PipLenCalUtils.cal(pipelineNew.getPipeLengthText()));
// 安装信息变更日志 // 安装信息变更日志
this.buildConstructionInfoChangeLog(record, pipelineNew, pipelineOld, projectContraptionChangeDataDto, allChangeColumns); this.buildConstructionInfoChangeLog(record, pipelineNew, pipelineOld, projectContraptionChangeDataDto, allChangeColumns);
// 检验信息变更日志 // 检验信息变更日志
...@@ -111,6 +114,8 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS ...@@ -111,6 +114,8 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS
pieLineDataChangeService.saveDesignForPieLine(record, allChangeColumns, pipelineNew); pieLineDataChangeService.saveDesignForPieLine(record, allChangeColumns, pipelineNew);
// 技术参数入库保存 // 技术参数入库保存
TechParamsPipelineChangeFieldDto paramsPipelineChangeFieldDto = new TechParamsPipelineChangeFieldDto(); TechParamsPipelineChangeFieldDto paramsPipelineChangeFieldDto = new TechParamsPipelineChangeFieldDto();
// 手工计算求和管道长度业务使用
pipelineNew.setPipeLength(PipLenCalUtils.cal(pipelineNew.getPipeLengthText()));
BeanUtil.copyProperties(pipelineNew, paramsPipelineChangeFieldDto, true); BeanUtil.copyProperties(pipelineNew, paramsPipelineChangeFieldDto, true);
commonEquipDataProcessService.savePieLineTechParam(record, allChangeColumns, paramsPipelineChangeFieldDto); commonEquipDataProcessService.savePieLineTechParam(record, allChangeColumns, paramsPipelineChangeFieldDto);
} }
......
...@@ -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;
...@@ -54,6 +55,7 @@ import com.yeejoin.amos.boot.module.ymt.api.dto.ProjectWaitRefreshDataQualitySco ...@@ -54,6 +55,7 @@ import com.yeejoin.amos.boot.module.ymt.api.dto.ProjectWaitRefreshDataQualitySco
import com.yeejoin.amos.boot.module.ymt.api.dto.RefreshDataDto; import com.yeejoin.amos.boot.module.ymt.api.dto.RefreshDataDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum; 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.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*; import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -102,7 +104,7 @@ import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNot ...@@ -102,7 +104,7 @@ import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNot
@Slf4j @Slf4j
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class DataHandlerServiceImpl { public class DataHandlerServiceImpl {
public static final String IDX_BIZ_VIEW_JG_ALL = "idx_biz_view_jg_all"; public static final String IDX_BIZ_VIEW_JG_ALL = "idx_biz_view_jg_all";
public static final String IDX_BIZ_EQUIPMENT_INFO = "idx_biz_equipment_info"; public static final String IDX_BIZ_EQUIPMENT_INFO = "idx_biz_equipment_info";
public static final String STATUS = "STATUS"; public static final String STATUS = "STATUS";
...@@ -145,6 +147,9 @@ public class DataHandlerServiceImpl { ...@@ -145,6 +147,9 @@ public class DataHandlerServiceImpl {
private final JgChangeVehicleRegistrationUnitMapper jgChangeVehicleRegistrationUnitMapper; private final JgChangeVehicleRegistrationUnitMapper jgChangeVehicleRegistrationUnitMapper;
private final JgChangeRegistrationTransferMapper jgChangeRegistrationTransferMapper; private final JgChangeRegistrationTransferMapper jgChangeRegistrationTransferMapper;
private final JgUseRegistrationManageServiceImpl jgUseRegistrationManageServiceImpl; private final JgUseRegistrationManageServiceImpl jgUseRegistrationManageServiceImpl;
private final JgChangeRegistrationReformMapper jgChangeRegistrationReformMapper;
private final JgReformNoticeMapper jgReformNoticeMapper;
private final EsBaseEnterpriseInfoDao enterpriseInfoDao; private final EsBaseEnterpriseInfoDao enterpriseInfoDao;
...@@ -185,6 +190,8 @@ public class DataHandlerServiceImpl { ...@@ -185,6 +190,8 @@ public class DataHandlerServiceImpl {
private EventPublisher eventPublisher; private EventPublisher eventPublisher;
@Autowired @Autowired
private JgUseRegistrationManageMapper jgUseRegistrationManageMapper; private JgUseRegistrationManageMapper jgUseRegistrationManageMapper;
@Autowired
private CommonServiceImpl commonServiceImpl;
/** /**
* 安装告知压力管道历史数据修复-详情中的设备列表修改为汇总表格式 * 安装告知压力管道历史数据修复-详情中的设备列表修改为汇总表格式
...@@ -2485,4 +2492,120 @@ public class DataHandlerServiceImpl { ...@@ -2485,4 +2492,120 @@ public class DataHandlerServiceImpl {
}); });
return Boolean.TRUE; return Boolean.TRUE;
} }
/**
* 压力管道-已完成及作废状态的单据的历史数据管道长度补充
* @return 是否成功
*/
public Long pipeLenFix() {
cn.hutool.core.date.StopWatch watch = new cn.hutool.core.date.StopWatch();
// 1.已完成及作废状态的安装告知
List<JgInstallationNotice> notices = installationNoticeService.list(new LambdaQueryWrapper<JgInstallationNotice>()
.and(w->w.eq(JgInstallationNotice::getNoticeStatus, FlowStatusEnum.TO_BE_FINISHED.getCode() + "")
.or().eq(JgInstallationNotice::getNoticeStatus, FlowStatusEnum.TO_BE_DISCARD.getCode() +""))
.eq(JgInstallationNotice::getEquListCode, EquipmentClassifityEnum.YLGD.getCode())
.select(BaseEntity::getSequenceNbr)
);
watch.start("安装告知" + notices.size());
notices.parallelStream().forEach(n->{
JSONObject jsonObject = commonServiceImpl.queryHistoryData(n.getSequenceNbr());
if(jsonObject != null){
JSONArray jsonArray = jsonObject.getJSONArray("deviceList");
List<JSONObject> pipelines = jsonArray.stream().map(e->{
JSONObject pipeline = JSONObject.parseObject(e.toString());
if(!pipeline.containsKey(BizCommonConstant.PIPE_LENGTH)){
pipeline.put(BizCommonConstant.PIPE_LENGTH, pipeline.get("pipeLength"));
}
return pipeline;
}).collect(Collectors.toList());
jsonObject.put("deviceList", pipelines);
commonServiceImpl.saveOrUpdateHistory(null, jsonObject, null, n.getSequenceNbr() + "" );
}
});
watch.stop();
// 2.已完成及作废状态的使用登记
List<JgUseRegistration> useRegistrations = useRegistrationService.list(new LambdaQueryWrapper<JgUseRegistration>()
.and(w->w.eq(JgUseRegistration::getStatus, FlowStatusEnum.TO_BE_FINISHED.getName()).or()
.eq(JgUseRegistration::getStatus, FlowStatusEnum.TO_BE_DISCARD.getName()))
.ne(JgUseRegistration::getProjectContraptionId, "")
.select(BaseEntity::getSequenceNbr));
watch.start("使用登记" + useRegistrations.size() );
useRegistrations.parallelStream().forEach(u->{
JSONObject jsonObject = commonServiceImpl.queryHistoryData(u.getSequenceNbr());
if(jsonObject != null){
String pipelistKey;
if(jsonObject.containsKey("equipmentLists")){
pipelistKey = "equipmentLists";
} else {
pipelistKey = "pipelineList";
}
JSONArray jsonArray = jsonObject.getJSONArray(pipelistKey);
Optional.ofNullable(jsonArray).ifPresent(d->{
List<JSONObject> pipelines = d.stream().map(e->{
JSONObject pipeline = JSONObject.parseObject(e.toString());
if(!pipeline.containsKey(BizCommonConstant.PIPE_LENGTH)){
pipeline.put(BizCommonConstant.PIPE_LENGTH, pipeline.get("pipeLength"));
}
return pipeline;
}).collect(Collectors.toList());
jsonObject.put(pipelistKey, pipelines);
commonServiceImpl.saveOrUpdateHistory(null, jsonObject, null, u.getSequenceNbr() + "" );
});
}
});
watch.stop();
// 3.已完成及作废状态的改造变更登记
List<JgChangeRegistrationReform> changeRegistrationReforms = jgChangeRegistrationReformMapper.selectList(new LambdaQueryWrapper<JgChangeRegistrationReform>()
.and(w->w.eq(JgChangeRegistrationReform::getStatus, FlowStatusEnum.TO_BE_FINISHED.getName()).or()
.eq(JgChangeRegistrationReform::getStatus, FlowStatusEnum.TO_BE_DISCARD.getName()))
.ne(JgChangeRegistrationReform::getProjectContraptionId, "")
.select(JgChangeRegistrationReform::getApplyNo));
watch.start("改造变更登记" + changeRegistrationReforms.size());
changeRegistrationReforms.parallelStream().forEach(u->{
JSONObject jsonObject = commonServiceImpl.queryHistoryData(u.getApplyNo());
if(jsonObject != null){
JSONArray jsonArray = jsonObject.getJSONArray("equipmentLists");
Optional.ofNullable(jsonArray).ifPresent(d->{
List<JSONObject> pipelines = d.stream().map(e->{
JSONObject pipeline = JSONObject.parseObject(e.toString());
if(!pipeline.containsKey(BizCommonConstant.PIPE_LENGTH)){
pipeline.put(BizCommonConstant.PIPE_LENGTH, pipeline.get("pipeLength"));
}
return pipeline;
}).collect(Collectors.toList());
jsonObject.put("equipmentLists", pipelines);
commonServiceImpl.saveOrUpdateHistory(null, jsonObject, null, u.getApplyNo());
});
}
});
watch.stop();
// 4.已完成及作废状态的改造告知
List<JgReformNotice> reformNotices = jgReformNoticeMapper.selectList(new LambdaQueryWrapper<JgReformNotice>()
.and(w->w.eq(JgReformNotice::getNoticeStatus, FlowStatusEnum.TO_BE_FINISHED.getCode() + "").or()
.eq(JgReformNotice::getNoticeStatus, FlowStatusEnum.TO_BE_DISCARD.getCode() + ""))
.ne(JgReformNotice::getProjectContraptionId, "")
.select(BaseEntity::getSequenceNbr));
watch.start("改造告知" + reformNotices.size());
reformNotices.parallelStream().forEach(u->{
JSONObject jsonObject = commonServiceImpl.queryHistoryData(u.getSequenceNbr());
if(jsonObject != null){
JSONArray jsonArray = jsonObject.getJSONArray("deviceList");
Optional.ofNullable(jsonArray).ifPresent(d->{
List<JSONObject> pipelines = d.stream().map(e->{
JSONObject pipeline = JSONObject.parseObject(e.toString());
if(!pipeline.containsKey(BizCommonConstant.PIPE_LENGTH)){
pipeline.put(BizCommonConstant.PIPE_LENGTH, pipeline.get("pipeLength"));
}
return pipeline;
}).collect(Collectors.toList());
jsonObject.put("deviceList", pipelines);
commonServiceImpl.saveOrUpdateHistory(null, jsonObject, null, u.getSequenceNbr() + "" );
});
}
});
watch.stop();
int num = notices.size() + useRegistrations.size() + reformNotices.size() + changeRegistrationReforms.size();
log.info("压力管道业务单据补充字段pipeLengthText,总处理数量:{}, 耗时信息:{}",num, watch.prettyPrint(TimeUnit.SECONDS));
return (long) (num);
}
} }
...@@ -732,7 +732,7 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ ...@@ -732,7 +732,7 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
public void pressurePipeEquData(Map<String, Object> exportParamsMap, List<Map<String, Object>> equData, int current, int size) { public void pressurePipeEquData(Map<String, Object> exportParamsMap, List<Map<String, Object>> equData, int current, int size) {
String[] fieldNames = {"productName", "pipelineNumber", "deviceLevel", "designUnitName", "uscUnitName", String[] fieldNames = {"productName", "pipelineNumber", "deviceLevel", "designUnitName", "uscUnitName",
"uscDate", "useDate", "nominalDiameter", "wallThickness", "pipeLength", "pressure", "temperature", "uscDate", "useDate", "nominalDiameter", "wallThickness", "pipeLengthText", "pressure", "temperature",
"medium", "inspectConclusion", "inspectOrgName", "nextInspectDate", "remarks"}; "medium", "inspectConclusion", "inspectOrgName", "nextInspectDate", "remarks"};
// 填充有效数据 // 填充有效数据
for (int curr = 0; curr < equData.size(); curr++) { for (int curr = 0; curr < equData.size(); curr++) {
......
...@@ -24,6 +24,7 @@ import com.yeejoin.amos.boot.biz.common.bo.CompanyBo; ...@@ -24,6 +24,7 @@ import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.dto.CountDto; import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.*; import com.yeejoin.amos.boot.biz.common.utils.*;
...@@ -842,6 +843,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -842,6 +843,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
iIdxBizJgInspectionDetectionInfoService.saveOrUpdateBatch(inspectionDetectionInfoList); iIdxBizJgInspectionDetectionInfoService.saveOrUpdateBatch(inspectionDetectionInfoList);
iIdxBizJgTechParamsPipelineService.saveOrUpdateBatch(paramsPipelineList); iIdxBizJgTechParamsPipelineService.saveOrUpdateBatch(paramsPipelineList);
esEquipmentCategory.saveAll(esEquipmentCategoryList); esEquipmentCategory.saveAll(esEquipmentCategoryList);
// 更新管道长度
updatePipelineLength(projectContraption, paramsPipelineList);
if(OPERATESAVE.equals(operateType)){ if(OPERATESAVE.equals(operateType)){
// 记录设备创建履历 // 记录设备创建履历
this.createResumePipeline(sequenceNbr, String.format(pipelineRoutePath, sequenceNbr + ""), company); this.createResumePipeline(sequenceNbr, String.format(pipelineRoutePath, sequenceNbr + ""), company);
...@@ -849,6 +852,22 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -849,6 +852,22 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return sequenceNbr; return sequenceNbr;
} }
private void updatePipelineLength(IdxBizJgProjectContraption projectContraption, List<IdxBizJgTechParamsPipeline> paramsPipelineList) {
projectContraption.setPipelineLength(
paramsPipelineList.stream()
.map(IdxBizJgTechParamsPipeline::getPipeLength)
.filter(Objects::nonNull)
.map(BigDecimal::new)
.reduce(BigDecimal.ZERO, BigDecimal::add)
.setScale(2, RoundingMode.HALF_UP)
.doubleValue()
);
LambdaUpdateWrapper<IdxBizJgProjectContraption> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(IdxBizJgProjectContraption::getPipelineLength, projectContraption.getPipelineLength());
updateWrapper.eq(BaseEntity::getSequenceNbr, projectContraption.getSequenceNbr());
idxBizJgProjectContraptionService.update(updateWrapper);
}
private void createResumePipeline(Long sequenceNbr, String routePath, CompanyBo company) { private void createResumePipeline(Long sequenceNbr, String routePath, CompanyBo company) {
jgResumeInfoService.saveBatchResume(Collections.singletonList(JgResumeInfoDto.builder() jgResumeInfoService.saveBatchResume(Collections.singletonList(JgResumeInfoDto.builder()
.businessType(BusinessTypeEnum.JG_NEW_PROJECT.getName()) .businessType(BusinessTypeEnum.JG_NEW_PROJECT.getName())
......
...@@ -35,6 +35,7 @@ import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext ...@@ -35,6 +35,7 @@ import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext; import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
import com.yeejoin.amos.boot.module.jg.biz.edit.permission.FillingEditPermForCurrentUser; import com.yeejoin.amos.boot.module.jg.biz.edit.permission.FillingEditPermForCurrentUser;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.changeRegistrationReform.ChangeRegisterReformBackupManager; import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.changeRegistrationReform.ChangeRegisterReformBackupManager;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.PieLineDataChangeServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher; import com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient; import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.*; import com.yeejoin.amos.boot.module.jg.biz.service.*;
...@@ -199,6 +200,9 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -199,6 +200,9 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
@Autowired @Autowired
JgResumeInfoServiceImpl jgResumeInfoService; JgResumeInfoServiceImpl jgResumeInfoService;
@Autowired
private PieLineDataChangeServiceImpl pieLineDataChangeService;
/*** /***
* @deprecated 根据查询调教获取分页对象 * @deprecated 根据查询调教获取分页对象
* @param dto 查询的dto对象 * @param dto 查询的dto对象
...@@ -847,7 +851,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -847,7 +851,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
pipeline.setWorkMedium(item.getString("workMedium")); pipeline.setWorkMedium(item.getString("workMedium"));
pipeline.setWorkPressure(item.getString("workPressure")); pipeline.setWorkPressure(item.getString("workPressure"));
pipeline.setWorkTemperature(item.getString("workTemperature")); pipeline.setWorkTemperature(item.getString("workTemperature"));
pipeline.setPipeLength(item.getString("pipeLength")); pipeline.setPipeLengthText(item.getString("pipeLengthText"));
LambdaUpdateWrapper<IdxBizJgTechParamsPipeline> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<IdxBizJgTechParamsPipeline> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgTechParamsPipeline::getRecord, item.getString("record")); updateWrapper.eq(IdxBizJgTechParamsPipeline::getRecord, item.getString("record"));
// 技术参数更新 // 技术参数更新
...@@ -867,6 +871,8 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -867,6 +871,8 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
useInfoLambdaUpdateWrapper.set(IdxBizJgUseInfo::getIsIntoManagement, true); useInfoLambdaUpdateWrapper.set(IdxBizJgUseInfo::getIsIntoManagement, true);
idxBizJgUseInfoService.update(useInfoLambdaUpdateWrapper); idxBizJgUseInfoService.update(useInfoLambdaUpdateWrapper);
} }
// 更新装置的汇总的管道长度
pieLineDataChangeService.updatePipelineLength(jgChangeRegistrationReform.getProjectContraptionId());
return paramsPipelines; return paramsPipelines;
} }
......
...@@ -40,6 +40,7 @@ import com.yeejoin.amos.boot.module.jg.biz.event.CancellationEvent; ...@@ -40,6 +40,7 @@ import com.yeejoin.amos.boot.module.jg.biz.event.CancellationEvent;
import com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher; import com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient; import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.*; import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.jg.api.common.PipLenCalUtils;
import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils; import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
...@@ -96,7 +97,6 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -96,7 +97,6 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
private static final String PROCESS_DEFINITION_KEY = "renovationNoticeNew"; private static final String PROCESS_DEFINITION_KEY = "renovationNoticeNew";
private static final String TABLE_PAGE_ID = "reformNoticeAdd"; private static final String TABLE_PAGE_ID = "reformNoticeAdd";
public static final String DEVICE_LIST = "deviceList"; public static final String DEVICE_LIST = "deviceList";
public static final String PIPE_LENGTH = "pipeLength";
public static final String RECORD = "record"; public static final String RECORD = "record";
public static final String SEQUENCE_NBR = "SEQUENCE_NBR"; public static final String SEQUENCE_NBR = "SEQUENCE_NBR";
public static final String PROJECT_CONTRAPTION = "projectContraption"; public static final String PROJECT_CONTRAPTION = "projectContraption";
...@@ -651,12 +651,14 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -651,12 +651,14 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
* @return 管道长度变化,正值为增长,负值为减少 * @return 管道长度变化,正值为增长,负值为减少
*/ */
private String calculatePipeLengthChange(JSONArray oldPipData, JSONArray newPipData) { private String calculatePipeLengthChange(JSONArray oldPipData, JSONArray newPipData) {
double oldPipLen = oldPipData.stream().mapToDouble(item -> JSONObject.parseObject(item.toString()).getDoubleValue(PIPE_LENGTH)).sum(); double oldPipLen = PipLenCalUtils.getPipLen(oldPipData); ;
double newPipLen = newPipData.stream().mapToDouble(item -> JSONObject.parseObject(item.toString()).getDoubleValue(PIPE_LENGTH)).sum(); double newPipLen = PipLenCalUtils.getPipLen(newPipData);
double change = newPipLen - oldPipLen; double change = newPipLen - oldPipLen;
return change == 0 ? "0" : String.format("%+.2f", change); return change == 0 ? "0" : String.format("%+.2f", change);
} }
private JSONObject getNowPipJsonData(String projectContraptionId) { private JSONObject getNowPipJsonData(String projectContraptionId) {
return new JSONObject(Optional.ofNullable(idxBizJgProjectContraptionMapper.getDetail(projectContraptionId)) return new JSONObject(Optional.ofNullable(idxBizJgProjectContraptionMapper.getDetail(projectContraptionId))
.map(map -> { .map(map -> {
...@@ -1120,7 +1122,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1120,7 +1122,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
// 产品质量合格证明 PRODUCT_QUALIFICATION_CERTIFICATE 其他附件 OTHER_ACCESSORIES 管道总长度 // 产品质量合格证明 PRODUCT_QUALIFICATION_CERTIFICATE 其他附件 OTHER_ACCESSORIES 管道总长度
// String productQualificationCertificate = JSON.toJSONString(newData.get(PRODUCT_QUALIFICATION_CERTIFICATE)); // String productQualificationCertificate = JSON.toJSONString(newData.get(PRODUCT_QUALIFICATION_CERTIFICATE));
// String otherAccessories = JSON.toJSONString(newData.get(OTHER_ACCESSORIES)); // String otherAccessories = JSON.toJSONString(newData.get(OTHER_ACCESSORIES));
double pipLengthLastSum = newPipData.stream().mapToDouble(item -> JSONObject.parseObject(item.toString()).getDoubleValue(PIPE_LENGTH)).sum(); double pipLengthLastSum = PipLenCalUtils.getPipLen(newPipData); // 最终转 double
LambdaUpdateWrapper<IdxBizJgProjectContraption> updateWrapper = new LambdaUpdateWrapper<IdxBizJgProjectContraption>() LambdaUpdateWrapper<IdxBizJgProjectContraption> updateWrapper = new LambdaUpdateWrapper<IdxBizJgProjectContraption>()
.eq(IdxBizJgProjectContraption::getSequenceNbr, notice.getProjectContraptionId()) .eq(IdxBizJgProjectContraption::getSequenceNbr, notice.getProjectContraptionId())
// .set(IdxBizJgProjectContraption::getProductQualificationCertificate, productQualificationCertificate) // .set(IdxBizJgProjectContraption::getProductQualificationCertificate, productQualificationCertificate)
...@@ -1151,7 +1153,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1151,7 +1153,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
String deviceLevel = pipData.getString("deviceLevel"); String deviceLevel = pipData.getString("deviceLevel");
String nominalDiameter = pipData.getString("nominalDiameter"); String nominalDiameter = pipData.getString("nominalDiameter");
String wallThickness = pipData.getString("wallThickness"); String wallThickness = pipData.getString("wallThickness");
String pipeLength = pipData.getString("pipeLength"); String pipeLengthText = pipData.getString("pipeLengthText");
String pressure = pipData.getString("pressure"); String pressure = pipData.getString("pressure");
String temperature = pipData.getString("temperature"); String temperature = pipData.getString("temperature");
String medium = pipData.getString("medium"); String medium = pipData.getString("medium");
...@@ -1165,7 +1167,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1165,7 +1167,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
.set(IdxBizJgTechParamsPipeline::getDeviceLevel, deviceLevel) .set(IdxBizJgTechParamsPipeline::getDeviceLevel, deviceLevel)
.set(IdxBizJgTechParamsPipeline::getNominalDiameter, nominalDiameter) .set(IdxBizJgTechParamsPipeline::getNominalDiameter, nominalDiameter)
.set(IdxBizJgTechParamsPipeline::getWallThickness, wallThickness) .set(IdxBizJgTechParamsPipeline::getWallThickness, wallThickness)
.set(IdxBizJgTechParamsPipeline::getPipeLength, pipeLength) .set(IdxBizJgTechParamsPipeline::getPipeLengthText, pipeLengthText)
.set(IdxBizJgTechParamsPipeline::getPipeLength, PipLenCalUtils.cal(pipeLengthText))
.set(IdxBizJgTechParamsPipeline::getPressure, pressure) .set(IdxBizJgTechParamsPipeline::getPressure, pressure)
.set(IdxBizJgTechParamsPipeline::getTemperature, temperature) .set(IdxBizJgTechParamsPipeline::getTemperature, temperature)
.set(IdxBizJgTechParamsPipeline::getMedium, medium) .set(IdxBizJgTechParamsPipeline::getMedium, medium)
...@@ -1462,7 +1465,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1462,7 +1465,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
JSONArray alreadyDelPipData = Optional.ofNullable(JSONArray.parseArray(newData.getString(DEL_DEVICE_LIST))).orElse(new JSONArray()); JSONArray alreadyDelPipData = Optional.ofNullable(JSONArray.parseArray(newData.getString(DEL_DEVICE_LIST))).orElse(new JSONArray());
JSONObject oldData = Optional.ofNullable(JSONObject.parseObject(registrationHistory.getOldData())).orElse(new JSONObject()); JSONObject oldData = Optional.ofNullable(JSONObject.parseObject(registrationHistory.getOldData())).orElse(new JSONObject());
JSONArray oldPipData = Optional.ofNullable(JSONArray.parseArray(oldData.getString(DEVICE_LIST))).orElse(new JSONArray()); JSONArray oldPipData = Optional.ofNullable(JSONArray.parseArray(oldData.getString(DEVICE_LIST))).orElse(new JSONArray());
double oldPipLength = oldPipData.stream().mapToDouble(item -> JSON.parseObject(item.toString()).getDoubleValue(PIPE_LENGTH)).sum(); double oldPipLength = PipLenCalUtils.getPipLen(oldPipData);
List<String> oldPipDataRecords = oldPipData.stream().map(item -> JSON.parseObject(item.toString()).getString(RECORD)).collect(Collectors.toList()); List<String> oldPipDataRecords = oldPipData.stream().map(item -> JSON.parseObject(item.toString()).getString(RECORD)).collect(Collectors.toList());
List<String> nowPipDataRecords = idxBizJgProjectContraptionMapper.selectEquipList(notice.getProjectContraptionId()).stream().map(item -> String.valueOf(item.get("record"))).collect(Collectors.toList()); List<String> nowPipDataRecords = idxBizJgProjectContraptionMapper.selectEquipList(notice.getProjectContraptionId()).stream().map(item -> String.valueOf(item.get("record"))).collect(Collectors.toList());
List<JSONObject> toAddPipData = alreadyDelPipData.stream().map(item -> JSON.parseObject(item.toString())).collect(Collectors.toList()); List<JSONObject> toAddPipData = alreadyDelPipData.stream().map(item -> JSON.parseObject(item.toString())).collect(Collectors.toList());
......
...@@ -35,6 +35,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto; ...@@ -35,6 +35,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo; import com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum; import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.JYJCResultEnum; import com.yeejoin.amos.boot.module.common.api.enums.JYJCResultEnum;
import com.yeejoin.amos.boot.module.jg.api.common.PipLenCalUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.*; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.*; import com.yeejoin.amos.boot.module.jg.api.enums.*;
...@@ -1438,7 +1439,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -1438,7 +1439,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
pipeline.setWorkMedium(item.getString("workMedium")); pipeline.setWorkMedium(item.getString("workMedium"));
pipeline.setWorkPressure(item.getString("workPressure")); pipeline.setWorkPressure(item.getString("workPressure"));
pipeline.setWorkTemperature(item.getString("workTemperature")); pipeline.setWorkTemperature(item.getString("workTemperature"));
pipeline.setPipeLength(item.getString("pipeLength")); pipeline.setPipeLengthText(item.getString("pipeLengthText"));
pipeline.setPipeLength(PipLenCalUtils.cal(item.getString("pipeLengthText")));
LambdaUpdateWrapper<IdxBizJgTechParamsPipeline> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<IdxBizJgTechParamsPipeline> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgTechParamsPipeline::getRecord, item.getString("record")); updateWrapper.eq(IdxBizJgTechParamsPipeline::getRecord, item.getString("record"));
// 技术参数修改 // 技术参数修改
...@@ -3181,7 +3183,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -3181,7 +3183,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
public void pressurePipeEquData(Map<String, Object> exportParamsMap, List<Object> equData, int current, int size) { public void pressurePipeEquData(Map<String, Object> exportParamsMap, List<Object> equData, int current, int size) {
String[] fieldNames = {"productName", "pipelineNumber", "deviceLevel", "designUnitName", "uscUnitName", String[] fieldNames = {"productName", "pipelineNumber", "deviceLevel", "designUnitName", "uscUnitName",
"uscDate", "useDate", "nominalDiameter", "wallThickness", "pipeLength", "pressure", "temperature", "uscDate", "useDate", "nominalDiameter", "wallThickness", "pipeLengthText", "pressure", "temperature",
"medium", "inspectConclusion", "inspectOrgName", "nextInspectDate", "remarks"}; "medium", "inspectConclusion", "inspectOrgName", "nextInspectDate", "remarks"};
// 填充有效数据 // 填充有效数据
for (int curr = 0; curr < equData.size(); curr++) { for (int curr = 0; curr < equData.size(); curr++) {
......
...@@ -11,6 +11,8 @@ import java.util.regex.Pattern; ...@@ -11,6 +11,8 @@ import java.util.regex.Pattern;
* @Date: 2022/8/4 9:08 * @Date: 2022/8/4 9:08
*/ */
public class StringUtils { public class StringUtils {
private final static String regex = "^(?:[1-9]\\d*(?:\\.\\d*)?|0(?:\\.\\d+)?)(?:/(?:[1-9]\\d*(?:\\.\\d*)?|0(?:\\.\\d+)?))*$";
public static StringJoiner getWhereSql(String operator, Map<String, String> map){ public static StringJoiner getWhereSql(String operator, Map<String, String> map){
StringJoiner stringJoiner = new StringJoiner(" " + operator +" "); StringJoiner stringJoiner = new StringJoiner(" " + operator +" ");
...@@ -31,4 +33,11 @@ public class StringUtils { ...@@ -31,4 +33,11 @@ public class StringUtils {
} }
return ""; return "";
} }
public static Boolean isValidMultiSlash(String str){
if (str == null) {
return false;
}
return Pattern.compile(regex).matcher(str).matches();
}
} }
...@@ -1988,7 +1988,7 @@ ...@@ -1988,7 +1988,7 @@
<w:sz w:val="14"/> <w:sz w:val="14"/>
<w:szCs w:val="14"/> <w:szCs w:val="14"/>
</w:rPr> </w:rPr>
<w:t>${pipeLength1}</w:t> <w:t>${pipeLengthText1!"/"}</w:t>
</w:r> </w:r>
</w:p> </w:p>
</w:tc> </w:tc>
...@@ -2385,7 +2385,7 @@ ...@@ -2385,7 +2385,7 @@
<w:sz w:val="14"/> <w:sz w:val="14"/>
<w:szCs w:val="14"/> <w:szCs w:val="14"/>
</w:rPr> </w:rPr>
<w:t>${pipeLength2}</w:t> <w:t>${pipeLengthText2!"/"}</w:t>
</w:r> </w:r>
</w:p> </w:p>
</w:tc> </w:tc>
...@@ -2782,7 +2782,7 @@ ...@@ -2782,7 +2782,7 @@
<w:sz w:val="14"/> <w:sz w:val="14"/>
<w:szCs w:val="14"/> <w:szCs w:val="14"/>
</w:rPr> </w:rPr>
<w:t>${pipeLength3}</w:t> <w:t>${pipeLengthText3!"/"}</w:t>
</w:r> </w:r>
</w:p> </w:p>
</w:tc> </w:tc>
...@@ -3179,7 +3179,7 @@ ...@@ -3179,7 +3179,7 @@
<w:sz w:val="14"/> <w:sz w:val="14"/>
<w:szCs w:val="14"/> <w:szCs w:val="14"/>
</w:rPr> </w:rPr>
<w:t>${pipeLength4}</w:t> <w:t>${pipeLengthText4!"/"}</w:t>
</w:r> </w:r>
</w:p> </w:p>
</w:tc> </w:tc>
...@@ -3576,7 +3576,7 @@ ...@@ -3576,7 +3576,7 @@
<w:sz w:val="14"/> <w:sz w:val="14"/>
<w:szCs w:val="14"/> <w:szCs w:val="14"/>
</w:rPr> </w:rPr>
<w:t>${pipeLength5}</w:t> <w:t>${pipeLengthText5!"/"}</w:t>
</w:r> </w:r>
</w:p> </w:p>
</w:tc> </w:tc>
...@@ -3973,7 +3973,7 @@ ...@@ -3973,7 +3973,7 @@
<w:sz w:val="14"/> <w:sz w:val="14"/>
<w:szCs w:val="14"/> <w:szCs w:val="14"/>
</w:rPr> </w:rPr>
<w:t>${pipeLength6}</w:t> <w:t>${pipeLengthText6!"/"}</w:t>
</w:r> </w:r>
</w:p> </w:p>
</w:tc> </w:tc>
...@@ -4370,7 +4370,7 @@ ...@@ -4370,7 +4370,7 @@
<w:sz w:val="14"/> <w:sz w:val="14"/>
<w:szCs w:val="14"/> <w:szCs w:val="14"/>
</w:rPr> </w:rPr>
<w:t>${pipeLength7}</w:t> <w:t>${pipeLengthText7!"/"}</w:t>
</w:r> </w:r>
</w:p> </w:p>
</w:tc> </w:tc>
...@@ -4767,7 +4767,7 @@ ...@@ -4767,7 +4767,7 @@
<w:sz w:val="14"/> <w:sz w:val="14"/>
<w:szCs w:val="14"/> <w:szCs w:val="14"/>
</w:rPr> </w:rPr>
<w:t>${pipeLength8}</w:t> <w:t>${pipeLengthText8!"/"}</w:t>
</w:r> </w:r>
</w:p> </w:p>
</w:tc> </w:tc>
...@@ -5164,7 +5164,7 @@ ...@@ -5164,7 +5164,7 @@
<w:sz w:val="14"/> <w:sz w:val="14"/>
<w:szCs w:val="14"/> <w:szCs w:val="14"/>
</w:rPr> </w:rPr>
<w:t>${pipeLength9}</w:t> <w:t>${pipeLengthText9!"/"}</w:t>
</w:r> </w:r>
</w:p> </w:p>
</w:tc> </w:tc>
...@@ -5561,7 +5561,7 @@ ...@@ -5561,7 +5561,7 @@
<w:sz w:val="14"/> <w:sz w:val="14"/>
<w:szCs w:val="14"/> <w:szCs w:val="14"/>
</w:rPr> </w:rPr>
<w:t>${pipeLength10}</w:t> <w:t>${pipeLengthText10!"/"}</w:t>
</w:r> </w:r>
</w:p> </w:p>
</w:tc> </w:tc>
......
...@@ -728,6 +728,7 @@ ...@@ -728,6 +728,7 @@
pp."NOMINAL_DIAMETER" nominalDiameter, pp."NOMINAL_DIAMETER" nominalDiameter,
pp."WALL_THICKNESS" wallThickness, pp."WALL_THICKNESS" wallThickness,
pp."PIPE_LENGTH" pipeLength, pp."PIPE_LENGTH" pipeLength,
pp."PIPE_LENGTH_TEXT" AS pipeLengthText,
pp."PRESSURE" pressure, pp."PRESSURE" pressure,
pp."TEMPERATURE" temperature, pp."TEMPERATURE" temperature,
pp."MEDIUM" medium, pp."MEDIUM" medium,
...@@ -775,6 +776,7 @@ ...@@ -775,6 +776,7 @@
pp."NOMINAL_DIAMETER" nominalDiameter, pp."NOMINAL_DIAMETER" nominalDiameter,
pp."WALL_THICKNESS" wallThickness, pp."WALL_THICKNESS" wallThickness,
pp."PIPE_LENGTH" pipeLength, pp."PIPE_LENGTH" pipeLength,
pp."PIPE_LENGTH_TEXT" AS pipeLengthText,
pp."PRESSURE" pressure, pp."PRESSURE" pressure,
pp."TEMPERATURE" temperature, pp."TEMPERATURE" temperature,
pp."MEDIUM" medium, pp."MEDIUM" medium,
......
...@@ -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.result.processor; package com.yeejoin.amos.boot.module.jyjc.biz.result.processor;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON; 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;
...@@ -8,9 +9,9 @@ import com.fasterxml.jackson.core.JsonProcessingException; ...@@ -8,9 +9,9 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil; import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.common.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.jg.api.common.PipLenCalUtils;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultAttachment; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultAttachment;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam;
...@@ -20,7 +21,6 @@ import com.yeejoin.amos.boot.module.jyjc.biz.result.factory.support.SupportableR ...@@ -20,7 +21,6 @@ import com.yeejoin.amos.boot.module.jyjc.biz.result.factory.support.SupportableR
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.CommonServiceImpl; import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionResultServiceImpl; import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionResultServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsPipeline; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsPipeline;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgInspectionDetectionInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgInspectionDetectionInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper;
...@@ -31,8 +31,6 @@ import org.springframework.stereotype.Component; ...@@ -31,8 +31,6 @@ import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
@Component @Component
...@@ -114,33 +112,34 @@ public class BatchEquipResultDataProcessor implements SupportableResultDataProce ...@@ -114,33 +112,34 @@ public class BatchEquipResultDataProcessor implements SupportableResultDataProce
throw new RuntimeException(e); throw new RuntimeException(e);
} }
// 5.新计算管道长度 // 5.新计算管道长度
calAndWriteTotalPipelineLength(jyjcInspectionResult); inspectionResultService.calAndWriteTotalPipelineLength(jyjcInspectionResult.getEquipUnicode());
// 6.发送数据刷新消息 // 6.发送数据刷新消息
inspectionResultService.sendDataRefreshMsg(records); inspectionResultService.sendDataRefreshMsg(records);
} }
} }
private void calAndWriteTotalPipelineLength(JyjcInspectionResult jyjcInspectionResult) { private void updateTechParams(Map<String, Object> e, String record) {
List<IdxBizJgTechParamsPipeline> allPipeLines = idxBizJgProjectContraptionMapper.selectPipelineListByProjectContraptionId(jyjcInspectionResult.getEquipUnicode()); this.doUpdatePipelineTechParams(e, record, techParamPipelineMapper);
Double totalPipelineLength = allPipeLines.stream().map(IdxBizJgTechParamsPipeline::getPipeLength).filter(Objects::nonNull).map(this::parseToBigDecimal)
.reduce(BigDecimal.ZERO, BigDecimal::add)
.setScale(3, RoundingMode.HALF_UP).doubleValue();
LambdaUpdateWrapper<IdxBizJgProjectContraption> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(BaseEntity::getSequenceNbr, jyjcInspectionResult.getEquipUnicode());
updateWrapper.set(IdxBizJgProjectContraption::getPipelineLength, totalPipelineLength);
idxBizJgProjectContraptionMapper.update(null, updateWrapper);
}
private BigDecimal parseToBigDecimal(String value) {
try {
return new BigDecimal(value);
} catch (NumberFormatException e) {
return BigDecimal.ZERO;
}
} }
private void updateTechParams(Map<String, Object> e, String record) { private void doUpdatePipelineTechParams(Map<String, Object> e, String record, IdxBizJgTechParamsPipelineMapper techParamPipelineMapper) {
JyjcInspectionResultServiceImpl.doUpdatePipelineTechParams(e, record, techParamPipelineMapper); IdxBizJgTechParamsPipeline techParamPipeline = new IdxBizJgTechParamsPipeline();
BeanUtil.copyProperties(e, techParamPipeline, true);
LambdaUpdateWrapper<IdxBizJgTechParamsPipeline> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgTechParamsPipeline::getRecord, record);
updateWrapper.set(IdxBizJgTechParamsPipeline::getNominalDiameter, techParamPipeline.getNominalDiameter());
updateWrapper.set(IdxBizJgTechParamsPipeline::getWallThickness, techParamPipeline.getWallThickness());
// TODO 此处注意由于pipeLength字段在检验对接时使用,未不修改对接文档字段,只修改数据类型由之前的浮点型调整为文本型,减少对接文档的调整,故如此
updateWrapper.set(IdxBizJgTechParamsPipeline::getPipeLengthText, techParamPipeline.getPipeLength());
updateWrapper.set(IdxBizJgTechParamsPipeline::getPipeLength, PipLenCalUtils.cal(techParamPipeline.getPipeLength()));
updateWrapper.set(IdxBizJgTechParamsPipeline::getPressure, techParamPipeline.getPressure());
updateWrapper.set(IdxBizJgTechParamsPipeline::getTemperature, techParamPipeline.getTemperature());
updateWrapper.set(IdxBizJgTechParamsPipeline::getMedium, techParamPipeline.getMedium());
updateWrapper.set(IdxBizJgTechParamsPipeline::getWorkMedium, techParamPipeline.getWorkMedium());
updateWrapper.set(IdxBizJgTechParamsPipeline::getWorkPressure, techParamPipeline.getWorkPressure());
updateWrapper.set(IdxBizJgTechParamsPipeline::getWorkTemperature, techParamPipeline.getWorkTemperature());
updateWrapper.set(IdxBizJgTechParamsPipeline::getRemarks, techParamPipeline.getRemarks());
techParamPipelineMapper.update(null, updateWrapper);
} }
} }
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();
}
} }
...@@ -22,6 +22,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; ...@@ -22,6 +22,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil; import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant; import com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent; import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
import com.yeejoin.amos.boot.module.jg.api.common.PipLenCalUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.DynamicColumnDto; import com.yeejoin.amos.boot.module.jg.api.dto.DynamicColumnDto;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo; import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
...@@ -46,14 +47,12 @@ import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.EventPublisher; ...@@ -46,14 +47,12 @@ import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.feign.TzsServiceFeignClient; import com.yeejoin.amos.boot.module.jyjc.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jyjc.biz.util.JsonUtils; import com.yeejoin.amos.boot.module.jyjc.biz.util.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsPipeline; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsPipeline;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgInspectionDetectionInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgTechParamsPipelineMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.UseInfoMapper;
import com.yeejoin.amos.feign.systemctl.model.DictionarieModel; import com.yeejoin.amos.feign.systemctl.model.DictionarieModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -77,6 +76,8 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -77,6 +76,8 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -141,10 +142,6 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -141,10 +142,6 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
BizEmqPublisher bizEmqPublisher; BizEmqPublisher bizEmqPublisher;
@Autowired @Autowired
@Lazy
JyjcInspectionApplicationServiceImpl inspectionApplicationService;
@Autowired
private CommonMapper jgCommonMapper; private CommonMapper jgCommonMapper;
@Autowired @Autowired
...@@ -168,6 +165,9 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -168,6 +165,9 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
@Autowired @Autowired
private EmqKeeper emqKeeper; private EmqKeeper emqKeeper;
@javax.annotation.Resource
private IdxBizJgProjectContraptionMapper idxBizJgProjectContraptionMapper;
/** /**
* 检验检测单位分页查询 * 检验检测单位分页查询
...@@ -373,6 +373,8 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -373,6 +373,8 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
// 4.更新es下次检验日期 // 4.更新es下次检验日期
commonService.updateEquipNextInspectDate(model, record); commonService.updateEquipNextInspectDate(model, record);
}); });
// 更新装置的汇总的管道长度
calAndWriteTotalPipelineLength(model.getEquipUnicode());
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
...@@ -408,6 +410,26 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -408,6 +410,26 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
return records; return records;
} }
public void calAndWriteTotalPipelineLength(String projectContraptionId) {
List<IdxBizJgTechParamsPipeline> allPipeLines = idxBizJgProjectContraptionMapper.selectPipelineListByProjectContraptionId(projectContraptionId);
Double totalPipelineLength = allPipeLines.stream().map(IdxBizJgTechParamsPipeline::getPipeLength).filter(Objects::nonNull).map(this::parseToBigDecimal)
.reduce(BigDecimal.ZERO, BigDecimal::add)
.setScale(3, RoundingMode.HALF_UP).stripTrailingZeros().doubleValue();
LambdaUpdateWrapper<IdxBizJgProjectContraption> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(com.yeejoin.amos.boot.biz.common.entity.BaseEntity::getSequenceNbr, projectContraptionId);
updateWrapper.set(IdxBizJgProjectContraption::getPipelineLength, totalPipelineLength);
idxBizJgProjectContraptionMapper.update(null, updateWrapper);
}
private BigDecimal parseToBigDecimal(String value) {
try {
return new BigDecimal(value);
} catch (NumberFormatException e) {
return BigDecimal.ZERO;
}
}
public void updateTechParam(Long resultSeq, String record) { public void updateTechParam(Long resultSeq, String record) {
List<DynamicColumnDto> columns = new ArrayList<>(); List<DynamicColumnDto> columns = new ArrayList<>();
JyjcInspectionResultParam param = iJyjcInspectionResultParamService.getOneParamByResultSeq(resultSeq); JyjcInspectionResultParam param = iJyjcInspectionResultParamService.getOneParamByResultSeq(resultSeq);
...@@ -1071,7 +1093,8 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -1071,7 +1093,8 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
updateWrapper.eq(IdxBizJgTechParamsPipeline::getRecord, record); updateWrapper.eq(IdxBizJgTechParamsPipeline::getRecord, record);
updateWrapper.set(IdxBizJgTechParamsPipeline::getNominalDiameter, techParamPipeline.getNominalDiameter()); updateWrapper.set(IdxBizJgTechParamsPipeline::getNominalDiameter, techParamPipeline.getNominalDiameter());
updateWrapper.set(IdxBizJgTechParamsPipeline::getWallThickness, techParamPipeline.getWallThickness()); updateWrapper.set(IdxBizJgTechParamsPipeline::getWallThickness, techParamPipeline.getWallThickness());
updateWrapper.set(IdxBizJgTechParamsPipeline::getPipeLength, techParamPipeline.getPipeLength()); updateWrapper.set(IdxBizJgTechParamsPipeline::getPipeLengthText, techParamPipeline.getPipeLengthText());
updateWrapper.set(IdxBizJgTechParamsPipeline::getPipeLength, PipLenCalUtils.cal(techParamPipeline.getPipeLengthText()));
updateWrapper.set(IdxBizJgTechParamsPipeline::getPressure, techParamPipeline.getPressure()); updateWrapper.set(IdxBizJgTechParamsPipeline::getPressure, techParamPipeline.getPressure());
updateWrapper.set(IdxBizJgTechParamsPipeline::getTemperature, techParamPipeline.getTemperature()); updateWrapper.set(IdxBizJgTechParamsPipeline::getTemperature, techParamPipeline.getTemperature());
updateWrapper.set(IdxBizJgTechParamsPipeline::getMedium, techParamPipeline.getMedium()); updateWrapper.set(IdxBizJgTechParamsPipeline::getMedium, techParamPipeline.getMedium());
......
package com.yeejoin.amos.boot.module.ymt.api.entity; package com.yeejoin.amos.boot.module.ymt.api.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.annotation.Group; import com.yeejoin.amos.boot.biz.common.annotation.PipeLengthField;
import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity; import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
...@@ -18,6 +19,7 @@ import lombok.experimental.Accessors; ...@@ -18,6 +19,7 @@ import lombok.experimental.Accessors;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Accessors(chain = true) @Accessors(chain = true)
@TableName("idx_biz_jg_tech_params_pipeline") @TableName("idx_biz_jg_tech_params_pipeline")
@PipeLengthField
public class IdxBizJgTechParamsPipeline extends TzsBaseEntity { public class IdxBizJgTechParamsPipeline extends TzsBaseEntity {
...@@ -96,9 +98,10 @@ public class IdxBizJgTechParamsPipeline extends TzsBaseEntity { ...@@ -96,9 +98,10 @@ public class IdxBizJgTechParamsPipeline extends TzsBaseEntity {
/** /**
* *
*/ */
@TableField("\"PIPE_LENGTH\"") @TableField(value = "\"PIPE_LENGTH\"", fill = FieldFill.INSERT_UPDATE)
private String pipeLength; private String pipeLength;
/** /**
* *
*/ */
...@@ -124,7 +127,7 @@ public class IdxBizJgTechParamsPipeline extends TzsBaseEntity { ...@@ -124,7 +127,7 @@ public class IdxBizJgTechParamsPipeline extends TzsBaseEntity {
private String temperature; private String temperature;
/** /**
* 设计-介质 * 设计-介质
*/ */
@TableField("\"MEDIUM\"") @TableField("\"MEDIUM\"")
private String medium; private String medium;
...@@ -167,4 +170,10 @@ public class IdxBizJgTechParamsPipeline extends TzsBaseEntity { ...@@ -167,4 +170,10 @@ public class IdxBizJgTechParamsPipeline extends TzsBaseEntity {
@TableField(value = "\"WORK_REMARKS\"") @TableField(value = "\"WORK_REMARKS\"")
private String workRemarks; private String workRemarks;
/**
* 管道长度斜线分隔多段表示用:数字或者 / 分割的数字,如2.1/6.3
*/
@TableField(value = "\"PIPE_LENGTH_TEXT\"")
private String pipeLengthText;
} }
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"NOMINAL_DIAMETER", "NOMINAL_DIAMETER",
"WALL_THICKNESS", "WALL_THICKNESS",
"PIPE_LENGTH", "PIPE_LENGTH",
"PIPE_LENGTH_TEXT",
"PRESSURE", "PRESSURE",
"TEMPERATURE", "TEMPERATURE",
"MEDIUM", "MEDIUM",
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
ibjtpp."NOMINAL_DIAMETER" AS nominalDiameter, ibjtpp."NOMINAL_DIAMETER" AS nominalDiameter,
ibjtpp."WALL_THICKNESS" AS wallThickness, ibjtpp."WALL_THICKNESS" AS wallThickness,
ibjtpp."PIPE_LENGTH" AS pipeLength, ibjtpp."PIPE_LENGTH" AS pipeLength,
ibjtpp."PIPE_LENGTH_TEXT" AS pipeLengthText,
ibjtpp."PRESSURE" AS pressure, ibjtpp."PRESSURE" AS pressure,
ibjtpp."TEMPERATURE" AS temperature, ibjtpp."TEMPERATURE" AS temperature,
ibjtpp."MEDIUM" AS medium, ibjtpp."MEDIUM" AS medium,
...@@ -171,6 +172,7 @@ ...@@ -171,6 +172,7 @@
ibjtpp."NOMINAL_DIAMETER" AS nominalDiameter, ibjtpp."NOMINAL_DIAMETER" AS nominalDiameter,
ibjtpp."WALL_THICKNESS" AS wallThickness, ibjtpp."WALL_THICKNESS" AS wallThickness,
ibjtpp."PIPE_LENGTH" AS pipeLength, ibjtpp."PIPE_LENGTH" AS pipeLength,
ibjtpp."PIPE_LENGTH_TEXT" AS pipeLengthText,
ibjtpp."PRESSURE" AS pressure, ibjtpp."PRESSURE" AS pressure,
ibjtpp."TEMPERATURE" AS temperature, ibjtpp."TEMPERATURE" AS temperature,
ibjtpp."MEDIUM" AS medium, ibjtpp."MEDIUM" AS medium,
...@@ -316,6 +318,7 @@ ...@@ -316,6 +318,7 @@
ibjtpp."NOMINAL_DIAMETER" AS nominalDiameter, ibjtpp."NOMINAL_DIAMETER" AS nominalDiameter,
ibjtpp."WALL_THICKNESS" AS wallThickness, ibjtpp."WALL_THICKNESS" AS wallThickness,
ibjtpp."PIPE_LENGTH" AS pipeLength, ibjtpp."PIPE_LENGTH" AS pipeLength,
ibjtpp."PIPE_LENGTH_TEXT" AS pipeLengthText,
ibjtpp."PRESSURE" AS pressure, ibjtpp."PRESSURE" AS pressure,
ibjtpp."TEMPERATURE" AS temperature, ibjtpp."TEMPERATURE" AS temperature,
ibjtpp."MEDIUM" AS medium, ibjtpp."MEDIUM" AS medium,
......
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