Commit 753869a7 authored by suhuiguang's avatar suhuiguang

feat(jg): 压力管道后续业务

1.压力管道改造告知适配 2.改造变更登记适配
parent 7e7e2322
......@@ -35,9 +35,7 @@ import java.util.Map;
@RequestMapping(value = "/idx-biz-jg-project-contraption")
public class IdxBizJgProjectContraptionController extends BaseController {
// 设备基本信息表单id
private static final String EQUIP_INFO_FORM_ID = "equipInfo";
public static final String PIPELINE_LIST = "pipelineList";
public static final String DEVICE_LIST = "deviceList";
public static final String USE_UNIT_CREDIT_CODE = "USE_UNIT_CREDIT_CODE";
public static final String USE_UNIT_NAME = "USE_UNIT_NAME";
@Autowired
......@@ -133,26 +131,6 @@ public class IdxBizJgProjectContraptionController extends BaseController {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.details(sequenceNbr));
}
/**
* 根据sequenceNbr查询详情-不包裹设备表单Id
*
* @param sequenceNbr 主键
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/detailsNotFormId")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个管道工程装置表", notes = "根据sequenceNbr查询单个管道工程装置表")
@ResultFieldMapping({
@ResultFieldMapping.ResultFieldMap(sourceField = "result.useUnitCreditCode", targetField = "result.useUnitSeq", serviceClass = CommonServiceImpl.class, queryMethod = "queryUnitInfoByCreditCode")
})
// 传record的原因是前端组件内部写死了,此处是工程装置表seq
public ResponseModel<Object> detailsNotFormId(@RequestParam("record") String sequenceNbr) {
Map<String, Object> objectMap = idxBizJgProjectContraptionServiceImpl.details(sequenceNbr).get(EQUIP_INFO_FORM_ID);
Object pipelineListObj = objectMap.remove(PIPELINE_LIST);
objectMap.put(DEVICE_LIST, pipelineListObj);
objectMap.put("useUnitCreditCode", objectMap.get(USE_UNIT_CREDIT_CODE) + "_" + objectMap.get(USE_UNIT_NAME));
return ResponseHelper.buildResponse(objectMap);
}
/**
* 根据sequenceNbr分页查询管道信息
......
package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.annotation.ResultFieldMapping;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jg.api.dto.JgReformNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgReformNotice;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgReformNoticeServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -56,7 +58,7 @@ public class JgReformNoticeController extends BaseController {
* 更新
*
* @param submitType 更新或提交
* @param installationInfo 改造告知信息
* @param noticeMap 改造告知信息
* @param op 参数
* @return JgReformNoticeDto
*/
......@@ -150,4 +152,23 @@ public class JgReformNoticeController extends BaseController {
JgReformNotice result = jgReformNoticeService.cancelApplication(dto.getSequenceNbr(), dto.getCancelReason());
return ResponseHelper.buildResponse(result);
}
/**
* 根据sequenceNbr查询详情-不包裹设备表单Id
*
* @param sequenceNbr 主键
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/detailsNotFormId")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个管道工程装置表", notes = "根据sequenceNbr查询单个管道工程装置表")
@ResultFieldMapping({
@ResultFieldMapping.ResultFieldMap(sourceField = "result.useUnitCreditCode", targetField = "result.useUnitSeq", serviceClass = CommonServiceImpl.class, queryMethod = "queryUnitInfoByCreditCode")
})
// 传record的原因是前端组件内部写死了,此处是工程装置表seq
public ResponseModel<Object> detailsNotFormId(@RequestParam("record") String sequenceNbr) {
Map<String, Object> objectMap = jgReformNoticeService.detailsForReformNotice(sequenceNbr);
return ResponseHelper.buildResponse(objectMap);
}
}
......@@ -336,6 +336,7 @@ public class PieLineDataChangeServiceImpl {
}).collect(Collectors.toList());
}
public void updatePipelineLength(String projectContraptionId) {
LambdaUpdateWrapper<IdxBizJgProjectContraption> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(BaseEntity::getSequenceNbr, projectContraptionId);
......@@ -348,7 +349,7 @@ public class PieLineDataChangeServiceImpl {
* @param projectContraptionId 装置id
* @return 长度
*/
private Double calTotalPieLineLength(String projectContraptionId) {
public Double calTotalPieLineLength(String projectContraptionId) {
List<String> records = useInfoService.list(new LambdaQueryWrapper<IdxBizJgUseInfo>()
.eq(IdxBizJgUseInfo::getProjectContraptionId, projectContraptionId).and(wrapper -> wrapper.isNull(IdxBizJgUseInfo::getEquState).or().ne(IdxBizJgUseInfo::getEquState, EquipmentEnum.BAOFEI.getCode()))
.select(IdxBizJgUseInfo::getRecord)).stream()
......
......@@ -608,6 +608,48 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
return resultMap;
}
public Map<String, Object> detailsForReformNotice(String sequenceNbr) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())) + "", ReginParams.class);
CompanyBo company = reginParams.getCompany();
Map<String, Object> resultMap = new HashMap<>();
if (ObjectUtils.isEmpty(sequenceNbr)) {
return resultMap;
}
var baseMapper = this.getBaseMapper();
return Optional.ofNullable(baseMapper.getDetail(sequenceNbr))
.map(map -> {
commonService.convertStringToJsonobject(map, jsonFields);
map.put("unitType", company.getCompanyType());
map.put("pipelineList", this.getPipelineListWithBf(sequenceNbr));
return map;
})
.orElse(Collections.emptyMap());
}
/**
* 查询非作废状态的管道
* @param sequenceNbr 装置id
* @return 非作废状态的管道列表
*/
private List<Map<String, Object>> getPipelineListWithBf(String sequenceNbr) {
List<Map<String, Object>> pipelineList = baseMapper.selectEquipListWithOutBf(sequenceNbr);
pipelineList.forEach(p -> {
try {
p.put("equStateName",
Optional.ofNullable(p.get("equState"))
.map(Object::toString)
.filter(org.apache.commons.lang3.StringUtils::isNotEmpty)
.map(Integer::parseInt)
.map(EquipmentEnum.getName::get)
.orElse("待用")
);
} catch (NumberFormatException e) {
p.put("equStateName", "待用");
}
});
return pipelineList;
}
private List<Map<String, Object>> getPipelineList(String sequenceNbr) {
List<Map<String, Object>> pipelineList = baseMapper.selectEquipList(sequenceNbr);
pipelineList.forEach(p -> {
......
......@@ -867,6 +867,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
LambdaUpdateWrapper<IdxBizJgUseInfo> useInfoLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
useInfoLambdaUpdateWrapper.eq(IdxBizJgUseInfo::getRecord, item.getString("record"));
useInfoLambdaUpdateWrapper.set(IdxBizJgUseInfo::getIsIntoManagement, true);
useInfoLambdaUpdateWrapper.set(IdxBizJgUseInfo::getEquState, EquipmentEnum.ZAIYONG.getCode());
idxBizJgUseInfoService.update(useInfoLambdaUpdateWrapper);
}
// 更新装置的汇总的管道长度-非报废状态的
......
......@@ -37,6 +37,7 @@ import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
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.edit.permission.FillingEditPermForCurrentUser;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.PieLineDataChangeServiceImpl;
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.feign.TzsServiceFeignClient;
......@@ -82,6 +83,7 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.toJSONString;
import static com.yeejoin.amos.boot.module.jg.biz.controller.IdxBizJgProjectContraptionController.*;
/**
* 改造告知服务实现类
......@@ -104,22 +106,16 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
public static final String PROJECT_CONTRAPTION = "projectContraption";
public static final String EQU_LIST_CODE = "EQU_LIST_CODE";
public static final String EQU_CATEGORY_CODE = "EQU_CATEGORY_CODE";
public static final String EQUIP_INFO = "equipInfo";
public static final String PROJECT_CONTRAPTION_ID = "projectContraptionId";
public static final String PRODUCT_PHOTO = "PRODUCT_PHOTO";
public static final String PRODUCT_QUALIFICATION_CERTIFICATE = "PRODUCT_QUALIFICATION_CERTIFICATE";
public static final String OTHER_ACCESSORIES = "OTHER_ACCESSORIES";
private final PieLineDataChangeServiceImpl pieLineDataChangeService;
public static final String DEL_DEVICE_LIST = "delDeviceList";
private final List<String> NOT_FLOWING_STATE = Arrays.asList("6610", "6614", "6615", "6617", "6616");
// 西安行政区划code
private static final String XIAN = "610100";
// 咸阳行政区划code
private static final String XIAN_YANG = "610400";
private final EquipmentCategoryMapper equipmentCategoryMapper;
private final JgReformNoticeEqMapper jgReformNoticeEqMapper;
private final JgReformNoticeEqServiceImpl jgReformNoticeEqService;
private final RegistrationInfoMapper tzsJgRegistrationInfoMapper;
private final OtherInfoMapper otherInfoMapper;
private final TzsServiceFeignClient tzsServiceFeignClient;
private final IdxBizJgProjectContraptionMapper idxBizJgProjectContraptionMapper;
private final RedisUtils redisUtils;
......@@ -152,6 +148,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
@Autowired
private CodeUtil codeUtil;
@Autowired
private IdxBizJgProjectContraptionServiceImplService idxBizJgProjectContraptionServiceImplService;
@ResultFieldMapping({
......@@ -1105,8 +1103,6 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
JSONObject newData = JSONObject.parseObject(registrationHistory.getChangeData());
JSONArray newPipData = Optional.ofNullable(JSONArray.parseArray(newData.getString(DEVICE_LIST))).orElse(new JSONArray());
JSONArray delPipData = Optional.ofNullable(JSONArray.parseArray(newData.getString(DEL_DEVICE_LIST))).orElse(new JSONArray());
// JSONObject oldData = JSONObject.parseObject(registrationHistory.getOldData());
// JSONArray oldPipData = JSONArray.parseArray(oldData.getString(DEVICE_LIST));
// 1.1更新工程装置中的【管道信息】增加减少或修改管道信息
List<JSONObject> toUpdatePipData = newPipData.stream().filter(item -> !StringUtils.isEmpty(JSON.parseObject(item.toString()).getString(RECORD))).map(item -> JSON.parseObject(item.toString())).collect(Collectors.toList());
List<JSONObject> toAddPipData = newPipData.stream().filter(item -> StringUtils.isEmpty(JSON.parseObject(item.toString()).getString(RECORD))).map(item -> JSON.parseObject(item.toString())).collect(Collectors.toList());
......@@ -1114,25 +1110,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
this.addPipDataWithFlowPass(toAddPipData, notice);
this.updatePipDataWithFlowPass(toUpdatePipData);
this.delPipDataWithFlowPass(toDeletePipRecords);
// 1.2更新工程装置中的【基本信息】 + 【使用信息】 + 管道长度等
// List<String> lastAllRecords = new ArrayList<>();
// lastAllRecords.addAll(toUpdatePipRecords);
// lastAllRecords.addAll(toAddPipDataRecords);
// lastAllRecords.forEach(record -> {
// 产品照片 PRODUCT_PHOTO
// String productPhoto = JSON.toJSONString(newData.get(PRODUCT_PHOTO));
// idxBizJgRegisterInfoService.update(new LambdaUpdateWrapper<IdxBizJgRegisterInfo>().set(IdxBizJgRegisterInfo::getProductPhoto, productPhoto).eq(IdxBizJgRegisterInfo::getRecord, record));
// });
// 产品质量合格证明 PRODUCT_QUALIFICATION_CERTIFICATE 其他附件 OTHER_ACCESSORIES 管道总长度
// String productQualificationCertificate = JSON.toJSONString(newData.get(PRODUCT_QUALIFICATION_CERTIFICATE));
// String otherAccessories = JSON.toJSONString(newData.get(OTHER_ACCESSORIES));
double pipLengthLastSum = PipLenCalUtils.getPipLen(newPipData); // 最终转 double
// 1.2更新工程装置中的管道长度
LambdaUpdateWrapper<IdxBizJgProjectContraption> updateWrapper = new LambdaUpdateWrapper<IdxBizJgProjectContraption>()
.eq(IdxBizJgProjectContraption::getSequenceNbr, notice.getProjectContraptionId())
// .set(IdxBizJgProjectContraption::getProductQualificationCertificate, productQualificationCertificate)
// .set(IdxBizJgProjectContraption::getOtherAccessories, otherAccessories)
.set(IdxBizJgProjectContraption::getPipelineLength, pipLengthLastSum)
.set(IdxBizJgProjectContraption::getPipelineLength, pieLineDataChangeService.calTotalPieLineLength(notice.getProjectContraptionId()))
.set(IdxBizJgProjectContraption::getPipeLengthChanged, notice.getPipeLengthChanged());
idxBizJgProjectContraptionMapper.update(null, updateWrapper);
}
......@@ -1561,4 +1542,11 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
return idxBizJgConstructionInfo;
}
public Map<String, Object> detailsForReformNotice(String sequenceNbr) {
Map<String, Object> res = idxBizJgProjectContraptionServiceImplService.detailsForReformNotice(sequenceNbr);
Object pipelineListObj = res.remove(PIPELINE_LIST);
res.put(DEVICE_LIST, pipelineListObj);
res.put("useUnitCreditCode", res.get(USE_UNIT_CREDIT_CODE) + "_" + res.get(USE_UNIT_NAME));
return res;
}
}
\ No newline at end of file
......@@ -125,4 +125,6 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro
* @return 被引用次数 > 0 则设备不可删除
*/
List<CountDto> countContraptionInUseTimesForDeleteBatch(@Param("projectContraptionIdList") List<String> projectContraptionIdList);
List<Map<String, Object>> selectEquipListWithOutBf(String sequenceNbr);
}
\ No newline at end of file
......@@ -54,7 +54,7 @@
ibjpc.SEQUENCE_NBR = #{sequenceNbr}
</select>
<select id="selectEquipList" resultType="java.util.Map">
<sql id="equip-list" >
SELECT ibjtpp."PIPE_NAME" AS pipeName,
ibjtpp."PIPELINE_NUMBER" AS pipelineNumber,
ibjtpp."DEVICE_LEVEL" AS deviceLevel,
......@@ -80,12 +80,23 @@
ibjui."EQU_STATE" as equState,
ibjui.project_contraption_id AS projectContraptionId
FROM idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD
LEFT JOIN idx_biz_jg_design_info ibjdi ON ibjui.RECORD = ibjdi.RECORD
LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD
LEFT JOIN idx_biz_jg_design_info ibjdi ON ibjui.RECORD = ibjdi.RECORD
</sql>
<select id="selectEquipList" resultType="java.util.Map">
<include refid="equip-list"></include>
WHERE ibjui.project_contraption_id = #{sequenceNbr}
ORDER BY ibjtpp.REC_DATE ASC
</select>
<select id="selectEquipListWithOutBf" resultType="java.util.Map">
<include refid="equip-list"></include>
WHERE ibjui.project_contraption_id = #{sequenceNbr}
and (ibjui."EQU_STATE" is null or ibjui."EQU_STATE" <![CDATA[ <> ]]> '3')
ORDER BY ibjtpp.REC_DATE ASC
</select>
<resultMap id="projectContraptionResultMap" type="java.util.Map">
<result property="project_contraption_id" column="project_contraption_id"/>
<result property="inUseNumber" column="inUseNumber" javaType="java.lang.Integer"/>
......
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