Commit 85e85860 authored by 韩桐桐's avatar 韩桐桐

feat(jg):新增加接口,将已办理的使用单位单位办理的压力管道中的管道长度数值从mm变成m

parent d651ab28
......@@ -386,7 +386,7 @@
pp."PIPELINE_NUMBER" pipelineNumber,
pp."NOMINAL_DIAMETER" nominalDiameter,
pp."WALL_THICKNESS" wallThickness,
ROUND(pp."PIPE_LENGTH" / 1000.0, 4) pipeLength,
pp."PIPE_LENGTH" pipeLength,
pp."PRESSURE" pressure,
pp."TEMPERATURE" temperature,
pp."MEDIUM" medium,
......
......@@ -575,4 +575,12 @@ public class CommonController extends BaseController {
commonService.updateUnitTypeCache(getSelectedOrgInfo(), unitType, selectedRoleSeqs);
return ResponseHelper.buildResponse("success");
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/historicalDataProcessingOfPressurePipeline")
@ApiOperation(httpMethod = "GET", value = "更新压力管道按照单位办理的使用登记历史单子中,管道长度从mm变成m", notes = "更新压力管道按照单位办理的使用登记历史单子中,管道长度从mm变成m")
public ResponseModel<String> historicalDataProcessingOfPressurePipeline(){
commonService.historicalDataProcessingOfPressurePipeline();
return ResponseHelper.buildResponse("success");
}
}
......@@ -210,4 +210,6 @@ public interface ICommonService {
* @param unitType 单位类型
*/
void updateUnitTypeCache(ReginParams reginParams, String unitType, String selectedRoleSeqs);
void historicalDataProcessingOfPressurePipeline();
}
......@@ -27,6 +27,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistration;
import com.yeejoin.amos.boot.module.jg.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationTransferService;
......@@ -43,10 +44,12 @@ import com.yeejoin.amos.boot.module.jg.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils;
import com.yeejoin.amos.boot.module.jg.flc.api.fegin.PrivilegeFeginService;
import com.yeejoin.amos.boot.module.jg.flc.api.fegin.TaskV2FeignService;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipTechParamPipeline;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.api.entity.RegistrationInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipTechParamPipelineMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgSupervisionInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper;
......@@ -90,6 +93,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.util.*;
......@@ -232,6 +236,8 @@ public class CommonServiceImpl implements ICommonService {
private TaskV2FeignService taskV2FeignService;
@Autowired
private Configuration configuration;
@Autowired
EquipTechParamPipelineMapper equipTechParamPipelineMapper;
public static byte[] file2byte(File file) {
try {
......@@ -1988,4 +1994,42 @@ public class CommonServiceImpl implements ICommonService {
redisUtils.set(getSelectedRoleRedisKey(), selectedRoleSeqs, redisRegionTimeSecond);
redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParams), redisRegionTimeSecond);
}
@Override
public void historicalDataProcessingOfPressurePipeline() {
LambdaQueryWrapper<JgUseRegistration> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgUseRegistration::getManageType, "unit");
queryWrapper.eq(JgUseRegistration::getIsDelete, 0);
List<JgUseRegistration> jgUseRegistrations = jgUseRegistrationServiceImpl.getBaseMapper().selectList(queryWrapper);
// 对应的历史表
jgUseRegistrations.forEach(x->{
LambdaQueryWrapper<JgRegistrationHistory> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(JgRegistrationHistory::getCurrentDocumentId, x.getSequenceNbr());
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.getBaseMapper().selectOne(wrapper);
try{
if (jgRegistrationHistory.getChangeData().contains("8300")){
JSONObject mapData = JSONObject.parseObject(jgRegistrationHistory.getChangeData());
if (!ValidationUtil.isEmpty(mapData.get("equipmentLists"))){
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) mapData.get("equipmentLists");
// 遍历 equipmentLists,将 pipeLength 从毫米转换为米
equipmentLists.forEach(equ -> {
String record =(String) equ.get("record");
EquipTechParamPipeline equipTechParamPipeline = equipTechParamPipelineMapper.queryTechParamInUse(record);
BigDecimal pipeLengthInM = Optional.ofNullable(equipTechParamPipeline)
.map(EquipTechParamPipeline::getPipeLength)
.orElse(new BigDecimal("0"));
equ.put("pipeLength", pipeLengthInM);
});
}
jgRegistrationHistory.setChangeData(JSONObject.toJSONString(mapData));
jgRegistrationHistoryService.getBaseMapper().updateById(jgRegistrationHistory);
}
}catch (Exception e){
log.error("更新压力管道出现错误:{}",e.getMessage());
e.printStackTrace();
}
});
}
}
\ No newline at end of file
......@@ -89,7 +89,7 @@ public class EquipTechParamPipeline extends AbstractEquipBaseEntity {
@TableField(value = "\"WALL_THICKNESS\"")
private BigDecimal wallThickness;
/**
* * 管道长度
* * 管道长度 (单位:m)
*/
@TableField(value = "\"PIPE_LENGTH\"")
......
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