Commit a1161683 authored by suhuiguang's avatar suhuiguang

1.使用登记单据变更功能,联调自测修改

parent 33c54647
......@@ -19,6 +19,11 @@ public class EquipRegisterChangeDataDto extends BaseChangeDataDto {
@FieldDisplayDefine(value = "设备代码")
private String equCode;
/**
* 1-手工输入、2-系统自动生成
*/
@FieldDisplayDefine(value = "设备代码类型" ,isExist = false)
private String equCodeType;
@FieldDisplayDefine(value = "设备品种")
private String equDefine;
......
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine;
import com.yeejoin.amos.boot.biz.common.annotation.Group;
import lombok.Data;
......@@ -41,7 +42,7 @@ public class TechParamsPipelineChangeFieldDto extends BaseTechParamsFieldDto {
private String pipeLength;
@FieldDisplayDefine(value = "起/始位置")
@FieldDisplayDefine(value = "起/始位置", type = JSON.class)
private String startePosition;
......
package com.yeejoin.amos.boot.module.jg.api.service;
import java.util.List;
import java.util.Map;
public interface IBizDataChangeHandleStrategy {
......@@ -20,7 +19,7 @@ public interface IBizDataChangeHandleStrategy {
* @param bizId 设备record
* @return 变更信息详情
*/
Map<String, ?> getChangeDetail(String applyNo, ModelType model, String bizId);
Map<String, ?> getDetail(String applyNo, ModelType model, String bizId);
/**
* 保存
......
......@@ -159,7 +159,7 @@ public class PressureVesselListener extends AnalysisEventListener<EquipInfoCylin
private void checkEquCodeUniqueness(String equCode) {
// 根据设备代码检查唯一性
Integer count = idxBizJgRegisterInfoMapper.selectByEquCodeAndClaimStatus(equCode,"");
Integer count = idxBizJgRegisterInfoMapper.selectByEquCodeAndClaimStatus(equCode,"",null);
if (count > 0) {
result.append("设备代码系统中已存在");
}
......
......@@ -5,9 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.MultiChangeItemData;
import com.yeejoin.amos.boot.module.jg.api.dto.RequestChangeData;
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.CylinderTypeEnum;
......@@ -38,13 +36,13 @@ public class BatchDataChangeProcessStrategy implements IChangeDataProcessStrateg
private final JgUseRegistrationMapper jgUseRegistrationMapper;
private final SingleDataChangeProcessStrategy singleDataChangeProcessStrategy;
private final CommonEquipDataProcessService commonEquipDataProcessService;
public BatchDataChangeProcessStrategy(JgUseRegistrationServiceImpl useRegistrationService, JgRegistrationHistoryServiceImpl jgRegistrationHistoryService, JgUseRegistrationMapper jgUseRegistrationMapper, SingleDataChangeProcessStrategy singleDataChangeProcessStrategy) {
public BatchDataChangeProcessStrategy(JgUseRegistrationServiceImpl useRegistrationService, JgRegistrationHistoryServiceImpl jgRegistrationHistoryService, JgUseRegistrationMapper jgUseRegistrationMapper, CommonEquipDataProcessService commonEquipDataProcessService) {
this.useRegistrationService = useRegistrationService;
this.jgRegistrationHistoryService = jgRegistrationHistoryService;
this.jgUseRegistrationMapper = jgUseRegistrationMapper;
this.singleDataChangeProcessStrategy = singleDataChangeProcessStrategy;
this.commonEquipDataProcessService = commonEquipDataProcessService;
}
@Override
......@@ -53,17 +51,42 @@ public class BatchDataChangeProcessStrategy implements IChangeDataProcessStrateg
JSONArray equips = data.getJSONArray(RequestChangeData.multiDataKey);
List<MultiChangeItemData> items = equips.toJavaList(MultiChangeItemData.class);
List<ChangeDataDto> allChangeColumns = new ArrayList<>();
// 校验
items.forEach(item -> {
String record = item.getRecord();
Map<String, Object> itemData = item.getDetail();
if(itemData != null){
List<ChangeDataDto> oneEquipChangeColumns = singleDataChangeProcessStrategy.handleOne(itemData, record);
allChangeColumns.addAll(oneEquipChangeColumns);
if (itemData != null) {
EquipRegisterChangeDataDto registerChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipRegisterChangeDataDto.class);
EquipFactoryChangeDataDto factoryChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipFactoryChangeDataDto.class);
EquipDesignChangeDataDto designChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipDesignChangeDataDto.class);
// 前置检验
commonEquipDataProcessService.checkValidField(record, registerChangeDataDto, null, null, null);
commonEquipDataProcessService.checkValidField(record, factoryChangeDataDto, registerChangeDataDto.getEquList(), registerChangeDataDto.getEquCategory(), registerChangeDataDto.getEquDefine());
commonEquipDataProcessService.checkValidField(record, designChangeDataDto, registerChangeDataDto.getEquList(), registerChangeDataDto.getEquCategory(), registerChangeDataDto.getEquDefine());
}
});
// 入库
items.forEach(item -> {
String record = item.getRecord();
Map<String, Object> itemData = item.getDetail();
if (itemData != null) {
EquipRegisterChangeDataDto registerChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipRegisterChangeDataDto.class);
EquipFactoryChangeDataDto factoryChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipFactoryChangeDataDto.class);
EquipDesignChangeDataDto designChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipDesignChangeDataDto.class);
commonEquipDataProcessService.buildChangeFields(record, designChangeDataDto, factoryChangeDataDto, registerChangeDataDto, allChangeColumns);
// 设备制造、设计、注册信息业务处理落库
commonEquipDataProcessService.dealBizDataForEquip(record, registerChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, factoryChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, designChangeDataDto);
// 设备技术参数入库处理
commonEquipDataProcessService.updateTechParamInfo(registerChangeDataDto, record, itemData, allChangeColumns);
}
});
// 单位办理不能修改设备品种,如果修改无法保证单据下的所有设备都一致
return allChangeColumns;
}
@Override
public Map<String, List<Map<String, Object>>> getDetail(String applyNo, String bizId) {
Map<String, List<Map<String, Object>>> result = new HashMap<>();
......
......@@ -4,8 +4,8 @@ import com.yeejoin.amos.boot.module.jg.api.dto.RequestChangeData;
import com.yeejoin.amos.boot.module.jg.biz.context.BizDataHandleStrategyContext;
import com.yeejoin.amos.boot.module.jg.api.service.IBizDataChangeHandleStrategy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@Service
......@@ -18,6 +18,7 @@ public class BizDataChangeServiceImpl {
* @param bizType 业务类型
* @param changeData 变化后的数据
*/
@Transactional(rollbackFor = Exception.class)
public void save(String applyNo,
String bizType,
RequestChangeData changeData) {
......@@ -28,6 +29,6 @@ public class BizDataChangeServiceImpl {
public Map<String, ?> queryDetail(String applyNo, String bizType, IBizDataChangeHandleStrategy.ModelType model, String bizId) {
IBizDataChangeHandleStrategy handleStrategy = BizDataHandleStrategyContext.getStrategy(bizType);
return handleStrategy.getChangeDetail(applyNo, model, bizId);
return handleStrategy.getDetail(applyNo, model, bizId);
}
}
......@@ -439,7 +439,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 根据设备代码检查唯一性
String equCode = (String) equipmentInfoForm.get(EQU_CODE);
String sequenceNbr = (String) equipmentInfoForm.get(SEQUENCE_NBR);
List<Integer> results = Stream.of(idxBizJgRegisterInfoMapper.selectByEquCodeAndClaimStatus(equCode, sequenceNbr),
List<Integer> results = Stream.of(idxBizJgRegisterInfoMapper.selectByEquCodeAndClaimStatus(equCode, sequenceNbr, null),
idxBizJgRegisterInfoMapper.selectInstallNoticeEqByEquCode(equCode, sequenceNbr)
).collect(Collectors.toList());
......@@ -3464,7 +3464,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private void checkEquCodeUniqueness(String equCode, StringBuilder result) {
// 根据设备代码检查唯一性
Integer count = idxBizJgRegisterInfoMapper.selectByEquCodeAndClaimStatus(equCode, "");
Integer count = idxBizJgRegisterInfoMapper.selectByEquCodeAndClaimStatus(equCode, "", null);
if (count > 0) {
result.append("设备代码系统中已存在;");
}
......
......@@ -68,7 +68,7 @@ public class UseRegisterDataChangeHandleImpl implements IBizDataChangeHandleStra
@Override
public Map<String, ?> getChangeDetail(String applyNo, ModelType model, String bizId) {
public Map<String, ?> getDetail(String applyNo, ModelType model, String bizId) {
IChangeDataProcessStrategy dataProcessor = DataProcessStrategyContext.getStrategy(model);
// 兼容:台套类打开变更详情(使用applyNo) 和 单位办理批量时选择单个设备打开详情(使用record)
return dataProcessor.getDetail(applyNo, bizId);
......
......@@ -57,7 +57,7 @@ public interface IdxBizJgRegisterInfoMapper extends BaseMapper<IdxBizJgRegisterI
*/
Boolean updateCylinderCategoryByEquCodeBatch(@Param("cylinderCategory") String cylinderCategory, @Param("equCodeList") List<String> equCodeList);
Integer selectByEquCodeAndClaimStatus(@Param("equCode") String equCode, @Param("sequenceNbr") String sequenceNbr);
Integer selectByEquCodeAndClaimStatus(@Param("equCode") String equCode, @Param("sequenceNbr") String sequenceNbr, @Param("record") String record);
Integer selectInstallNoticeEqByEquCode(@Param("equCode") String equCode, @Param("sequenceNbr") String sequenceNbr);
}
......@@ -26,6 +26,9 @@
<if test="sequenceNbr != null and sequenceNbr != ''">
AND jri.sequence_nbr != #{sequenceNbr}
</if>
<if test="record != null and record != ''">
AND jri.record != #{record}
</if>
AND joi.claim_status = '已认领'
</select>
......
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