Commit 6eda483f authored by 刘林's avatar 刘林

fix(jg):设备走过登记,再次登记时提示语需要更新

parent 02d3c60c
......@@ -183,5 +183,12 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
Page<Map<String,Object>> countBizFinishedNumForDPListDQJY(@Param("page") Page<Map<String,Object>> page, @Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto dpFilterParamForDetailDto);
Page<Map<String,Object>> countBizFinishedNumForDPListBGDJ(@Param("page") Page<Map<String,Object>> page, @Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto dpFilterParamForDetailDto);
Page<Map<String,Object>> countBizFinishedNumForDPListZXBX(@Param("page") Page<Map<String,Object>> page, @Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto dpFilterParamForDetailDto);
/**
* 当前设备在流程中的申请单号
* @param record 设备id
* @return 申请单号
*/
List<String> findEquipInUseService(@Param("record") String record);
}
......@@ -279,6 +279,143 @@
and (a.status <![CDATA[ <> ]]> '使用单位待提交' and a.status <![CDATA[ <> ]]> '一级受理已驳回' and a.status <![CDATA[ <> ]]> '使用单位已撤回' and a.status <![CDATA[ <> ]]> '已作废')
)
</select>
<select id="findEquipInUseService" resultType="java.lang.String">
select
apply_no
from (
select
apply_no
from
tzs_jg_use_registration a,
tzs_jg_use_registration_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and a.is_delete = 0
and ( a.status <![CDATA[ <> ]]> '已作废' OR a.status <![CDATA[ <> ]]> '已完成')
UNION
select
apply_no
from
tzs_jg_change_registration_reform a,
tzs_jg_change_registration_reform_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and ( a.audit_status <![CDATA[ <> ]]> '已作废' OR a.audit_status <![CDATA[ <> ]]> '已完成')
UNION
select
apply_no
from
tzs_jg_change_registration_transfer a,
tzs_jg_change_registration_transfer_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.audit_status <![CDATA[ <> ]]> '已作废' OR a.audit_status <![CDATA[ <> ]]> '已完成')
UNION
select
apply_no
from
tzs_jg_change_registration_unit a,
tzs_jg_change_registration_unit_eq b
where
a.sequence_nbr = b.unit_change_registration_id
and b.equ_id = #{record}
and (a.status <![CDATA[ <> ]]> '已作废' OR a.status <![CDATA[ <> ]]> '已完成')
UNION
select
apply_no
from
tzs_jg_enable_disable a,
tzs_jg_enable_disable_eq b
where
a.sequence_nbr = b.enable_disable_apply_id
and b.equ_id = #{record}
and (a.audit_status <![CDATA[ <> ]]> '已作废' OR a.audit_status <![CDATA[ <> ]]> '已完成')
UNION
select
apply_no
from
tzs_jg_installation_notice a,
tzs_jg_installation_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.notice_status <![CDATA[ <> ]]> '6617' or a.notice_status <![CDATA[ <> ]]> '6616')
UNION
select
apply_no
from
tzs_jg_maintain_notice a,
tzs_jg_maintain_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.notice_status <![CDATA[ <> ]]> '6617' or a.notice_status <![CDATA[ <> ]]> '6616')
UNION
select
apply_no
from
tzs_jg_maintenance_contract a,
tzs_jg_maintenance_contract_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.status <![CDATA[ <> ]]> '已作废' OR a.status <![CDATA[ <> ]]> '已完成')
UNION
select
apply_no
from
tzs_jg_reform_notice a,
tzs_jg_reform_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.notice_status <![CDATA[ <> ]]> '6617' or a.notice_status <![CDATA[ <> ]]> '6616')
UNION
select
apply_no
from
tzs_jg_scrap_cancel a,
tzs_jg_scrap_cancel_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.audit_status <![CDATA[ <> ]]> '已作废' OR a.status <![CDATA[ <> ]]> '已完成')
UNION
select
apply_no
from
tzs_jg_transfer_notice a,
tzs_jg_transfer_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.notice_status <![CDATA[ <> ]]> '6617' or a.notice_status <![CDATA[ <> ]]> '6616')
UNION
select
apply_no
from
tzs_jg_vehicle_information a,
tzs_jg_vehicle_information_eq b
where
a.sequence_nbr = b.vehicle_id
and b.equ_id = #{record}
and (a.status <![CDATA[ <> ]]> '已作废' OR a.status <![CDATA[ <> ]]> '已完成')
UNION
select
apply_no
from
tzs_jg_change_vehicle_registration_unit a,
tzs_jg_change_vehicle_registration_unit_eq b
where
a.sequence_nbr = b.unit_change_id
and b.equ_id = #{record}
and (a.status <![CDATA[ <> ]]> '已作废' OR a.status <![CDATA[ <> ]]> '已完成')
)
</select>
<select id="refreshTheDetailsDataOfCompletedUsageRegistration" resultType="java.lang.String">
SELECT sequence_nbr
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.yeejoin.amos.boot.module.jg.api.dto.FlowingEquipRedisKeyDTO;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IEquipUsedCheck;
import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RBucket;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.Collections;
import java.util.List;
import java.util.Set;
......@@ -22,6 +23,8 @@ import java.util.stream.Collectors;
@Slf4j
public abstract class BaseEquipUsedCheckService implements IEquipUsedCheck {
@Autowired
CommonMapper commonMapper;
/**
* 并发校验(页面同时提交或者页面同时打开多个时,某些设备都是为使用状态)校验设备流程在用状态及更新不在用为再使用状态
......@@ -40,8 +43,12 @@ public abstract class BaseEquipUsedCheckService implements IEquipUsedCheck {
}
RBucket<Set<String>> RBucket = getRedisClient().getBucket(this.getFlowingEquipRedisKey(companyCode, getApplyBizType()));
Set<String> equipListOfUsed = RBucket.get();
// 查询当前设备在流程中的申请单号列表
List<String> equipInUseList = commonMapper.findEquipInUseService(record);
if (equipListOfUsed != null && equipListOfUsed.contains(record)) {
throw new BadRequest("设备已被其他流程使用,不允许重复提交!");
String joinedEquipInUse = String.join(",", equipInUseList);
log.error("设备已被其他流程使用,不允许重复提交,设备ID:{},在流程中申请单:{}", record, joinedEquipInUse);
throw new BadRequest("设备已被其他流程使用,不允许重复提交!,设备ID: " + record +" ,在流程中申请单:" + joinedEquipInUse + ",请联系管理员!");
}
if (equipListOfUsed == null || equipListOfUsed.isEmpty()) {
equipListOfUsed = new TreeSet<>();
......@@ -68,8 +75,12 @@ public abstract class BaseEquipUsedCheckService implements IEquipUsedCheck {
}
RBucket<Set<String>> RBucket = getRedisClient().getBucket(this.getFlowingEquipRedisKey(companyCode, getApplyBizType()));
Set<String> equipListOfUsed = RBucket.get();
// 查询当前设备在用的申请单号列表
List<String> equipInUseList = commonMapper.findEquipInUseService(record);
if (equipListOfUsed != null && equipListOfUsed.contains(record)) {
throw new BadRequest("使用登记证已被其他流程使用,不允许重复提交!");
String joinedEquipInUse = String.join(",", equipInUseList);
log.error("使用登记证已被其他流程使用,不允许重复提交,设备ID:{},在流程中申请单:{}", record, joinedEquipInUse);
throw new BadRequest("使用登记证已被其他流程使用,不允许重复提交!,设备ID: " + record +" ,在流程中申请单:" + joinedEquipInUse + ",请联系管理员!");
}
if (equipListOfUsed == null || equipListOfUsed.isEmpty()) {
equipListOfUsed = new TreeSet<>();
......
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