Commit 5ea1d03e authored by 麻笑宇's avatar 麻笑宇

21048 新建维修/改造/移装告知前应先完成使用登记(增加校验)

parent 54663138
......@@ -118,6 +118,8 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
private JgRegistrationHistoryMapper jgRegistrationHistoryMapper;
@Autowired
private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
@Autowired
private IdxBizJgUseInfoMapper idxBizJgUseInfoMapper;
/**
* 根据sequenceNbr查询
*
......@@ -406,6 +408,12 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
if (CollectionUtils.isEmpty(deviceList)) {
throw new BadRequest("请选择设备");
}
List<String> sequenceNbrList = deviceList.stream().map(t -> (String) t.get("SEQUENCE_NBR")).collect(Collectors.toList());
int equipCount = idxBizJgUseInfoMapper.countByRecords(sequenceNbrList);
if(sequenceNbrList.size() != equipCount){
throw new BadRequest("请先完成使用登记");
}
// 获取告知单号
ResponseModel<List<String>> applyNoResult = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.WXGZ.getCode(), deviceList.size());
......
......@@ -28,10 +28,7 @@ import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils;
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.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.OtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.SupervisoryCodeInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
......@@ -109,7 +106,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
private RedissonClient redissonClient;
@Autowired
private JgRegistrationHistoryMapper jgRegistrationHistoryMapper;
@Autowired
private IdxBizJgUseInfoMapper idxBizJgUseInfoMapper;
/**
* 根据sequenceNbr查询
*
......@@ -364,7 +362,11 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
if (CollectionUtils.isEmpty(deviceList)) {
throw new BadRequest("请选择设备!");
}
List<String> sequenceNbrList = deviceList.stream().map(t -> (String) t.get("SEQUENCE_NBR")).collect(Collectors.toList());
int equipCount = idxBizJgUseInfoMapper.countByRecords(sequenceNbrList);
if(sequenceNbrList.size() != equipCount){
throw new BadRequest("请先完成使用登记");
}
// 获取告知单号
ResponseModel<List<String>> codeResult = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.GZGZ.getCode(), deviceList.size());
List<String> applyNoList = null;
......
......@@ -396,6 +396,11 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
if (CollectionUtils.isEmpty(deviceList)) {
return new ArrayList<>();
}
List<String> sequenceNbrList = deviceList.stream().map(t -> (String) t.get("SEQUENCE_NBR")).collect(Collectors.toList());
int equipCount = idxBizJgUseInfoMapper.countByRecords(sequenceNbrList);
if(sequenceNbrList.size() != equipCount){
throw new BadRequest("请先完成使用登记");
}
// 获取告知单号
ResponseModel<List<String>> responseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.YZGZ.getCode(), deviceList.size());
if (CollectionUtils.isEmpty(responseModel.getResult())) {
......
......@@ -13,4 +13,6 @@ import java.util.List;
*/
public interface IdxBizJgUseInfoMapper extends BaseMapper<IdxBizJgUseInfo> {
void batchUpdateUseInfo(@Param("records") List<String> records, Integer code);
int countByRecords(@Param("sequenceNbrList") List<String> sequenceNbrList);
}
......@@ -8,4 +8,10 @@
#{record}
</foreach>
</update>
<select id="countByRecords" resultType="java.lang.Integer">
SELECT COUNT(1) FROM idx_biz_jg_use_info WHERE "RECORD" IN
<foreach collection="sequenceNbrList" separator="," item="record" open="(" close=")">
#{record}
</foreach>
</select>
</mapper>
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