Commit 33c2e1d9 authored by 王果's avatar 王果

21052 更名变更登记校验设备是否在流程中

parent 4b46bb57
package com.yeejoin.amos.boot.module.jg.api.mapper; package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationNameDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationNameDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationName; import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationName;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -30,4 +31,6 @@ public interface JgChangeRegistrationNameMapper extends BaseMapper<JgChangeRegis ...@@ -30,4 +31,6 @@ public interface JgChangeRegistrationNameMapper extends BaseMapper<JgChangeRegis
@Param("roleIds") List<String> roleIds, @Param("roleIds") List<String> roleIds,
@Param("companyCode") String companyCode, @Param("companyCode") String companyCode,
@Param("currentUserId") String exeUserId); @Param("currentUserId") String exeUserId);
List<CompanyEquipCountDto> queryForFlowingEquipList();
} }
...@@ -16,6 +16,13 @@ public interface IEquipUsedCheck { ...@@ -16,6 +16,13 @@ public interface IEquipUsedCheck {
void equipRepeatUsedCheck(String record, String companyCode); void equipRepeatUsedCheck(String record, String companyCode);
/** /**
* 并发校验(页面同时提交或者页面同时打开多个时,某些使用登记证都是为使用状态)校验使用登记证流程在用状态及更新不在用为再使用状态
* @param record 设备唯一标识
* @param companyCode 登录人的公司代码
*/
void registrationRepeatUsedCheck(String record, String companyCode);
/**
* 删除流程中的数据,释放redis空间(异常处理及驳回到发起节点、撤回到发起节点、完成时时进行) * 删除流程中的数据,释放redis空间(异常处理及驳回到发起节点、撤回到发起节点、完成时时进行)
* @param records 设备唯一标识 * @param records 设备唯一标识
* @param companyCode 登录人的公司代码 * @param companyCode 登录人的公司代码
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationNameMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationNameMapper">
<select id="getEquipInfoByOrgCode" resultType="java.util.Map">
<select id="getEquipInfoByOrgCode" resultType="java.util.Map"> SELECT u.RECORD AS equipId,
SELECT o.SUPERVISORY_CODE AS supervisoryCode,
u.RECORD AS equipId, b.USE_ORG_CODE AS useOrgCode
o.SUPERVISORY_CODE AS supervisoryCode, FROM idx_biz_jg_use_info u
b.USE_ORG_CODE AS useOrgCode LEFT JOIN idx_biz_jg_register_info b ON u.RECORD = b.RECORD
FROM LEFT JOIN idx_biz_jg_other_info o ON u.RECORD = o.RECORD
idx_biz_jg_use_info u WHERE USE_UNIT_CREDIT_CODE = #{code}
LEFT JOIN idx_biz_jg_register_info b ON u.RECORD = b.RECORD
LEFT JOIN idx_biz_jg_other_info o ON u.RECORD = o.RECORD
WHERE
USE_UNIT_CREDIT_CODE = #{code}
</select> </select>
<delete id="deleteByChangeRegistrationId"> <delete id="deleteByChangeRegistrationId">
delete from tzs_jg_change_registration_name_eq where name_change_registration_id = #{changeRegistrationId} delete
from tzs_jg_change_registration_name_eq
where name_change_registration_id = #{changeRegistrationId}
</delete> </delete>
<select id="getListPage" resultType="java.util.Map"> <select id="getListPage" resultType="java.util.Map">
select ur.sequence_nbr as sequenceNbr, select ur.sequence_nbr as sequenceNbr,
ur.instance_id as instanceId, ur.instance_id as instanceId,
ur.audit_status as auditStatus, ur.audit_status as auditStatus,
ur.apply_no as applyNo, ur.apply_no as applyNo,
DATE_FORMAT(ur.rec_date,'%Y-%m-%d') as recDate, DATE_FORMAT(ur.rec_date,'%Y-%m-%d') as recDate,
DATE_FORMAT(ur.create_date,'%Y-%m-%d') as createDate, DATE_FORMAT(ur.create_date,'%Y-%m-%d') as createDate,
DATE_FORMAT(ur.audit_pass_date,'%Y-%m-%d') as auditPassDate, DATE_FORMAT(ur.audit_pass_date,'%Y-%m-%d') as auditPassDate,
ur.receive_org_code as receiveOrgCode, ur.receive_org_code as receiveOrgCode,
ur.receive_org_name as receiveOrgName, ur.receive_org_name as receiveOrgName,
ur.receive_company_code as receiveCompanyCode, ur.receive_company_code as receiveCompanyCode,
ur.use_unit_name as useUnitName, ur.use_unit_name as useUnitName,
ur.new_use_unit_name AS newUseUnitName, ur.new_use_unit_name AS newUseUnitName,
ur.promoter, ur.promoter,
ur.create_user_id as createUserId, ur.create_user_id as createUserId,
ur.next_executor_ids as nextExecutorIds, ur.next_executor_ids as nextExecutorIds,
ur.next_execute_user_ids as nextExecuteUserIds, ur.next_execute_user_ids as nextExecuteUserIds,
ur.next_task_id as nextTaskId, ur.next_task_id as nextTaskId,
(SELECT group_concat(use_registration_code) from tzs_jg_use_registration_manage where sequence_nbr in (SELECT (SELECT group_concat(use_registration_code) from tzs_jg_use_registration_manage where sequence_nbr in (SELECT
certificate_seq from tzs_jg_change_registration_name_eq where name_change_registration_id = ur.sequence_nbr)) as certificateCodes certificate_seq from tzs_jg_change_registration_name_eq where name_change_registration_id = ur.sequence_nbr)) as
from tzs_jg_change_registration_name ur certificateCodes
<where> from tzs_jg_change_registration_name ur
and ur.is_delete = 0 <where>
<if test="dto.auditStatus != null and dto.auditStatus != ''"> and ur.is_delete = 0
and ur.audit_status = #{dto.auditStatus} <if test="dto.auditStatus != null and dto.auditStatus != ''">
</if> and ur.audit_status = #{dto.auditStatus}
<if test="dto.useUnitName != null and dto.useUnitName != ''"> </if>
and ur.use_unit_name like concat('%',#{dto.useUnitName}, '%') <if test="dto.useUnitName != null and dto.useUnitName != ''">
</if> and ur.use_unit_name like concat('%',#{dto.useUnitName}, '%')
<if test="dto.newUseUnitName != null and dto.newUseUnitName != ''"> </if>
and ur.new_use_unit_name like concat('%',#{dto.newUseUnitName}, '%') <if test="dto.newUseUnitName != null and dto.newUseUnitName != ''">
</if> and ur.new_use_unit_name like concat('%',#{dto.newUseUnitName}, '%')
<if test="dto.applyNo != null and dto.applyNo != ''"> </if>
and ur.apply_no like concat('%',#{dto.applyNo},'%') <if test="dto.applyNo != null and dto.applyNo != ''">
</if> and ur.apply_no like concat('%',#{dto.applyNo},'%')
<if test="dto.applicationDate != null"> </if>
AND ur.create_date like concat('%',DATE_FORMAT(#{dto.applicationDate},'%Y-%m-%d'),'%') <if test="dto.applicationDate != null">
AND ur.create_date like concat('%',DATE_FORMAT(#{dto.applicationDate},'%Y-%m-%d'),'%')
</if>
<if test="dto.receiveOrgCode != null and dto.receiveOrgCode != ''">
AND ur.receive_org_code = #{dto.receiveOrgCode}
</if>
<if test="roleIds != null and dto.type == 'supervision'">
<foreach collection='roleIds' item='role' open='and (' close=')' separator='or'>
ur.instance_status like concat('%',#{role},'%')
</foreach>
</if>
<if test="dto.type == 'supervision'">
AND (ur.receive_company_code = #{companyCode} or ur.transfer_to_user_ids LIKE concat ('%',
#{currentUserId}, '%'))
AND ur.instance_id is not null
</if>
<if test="dto.type == 'company'">
and (ur.use_unit_credit_code = #{dto.useUnitCreditCode} or ur.transfer_to_user_ids LIKE concat ('%',
#{currentUserId}, '%'))
</if>
</where>
order by
<if test="sort != null">
ur.${sort.field} ${sort.sortType},
</if> </if>
<if test="dto.receiveOrgCode != null and dto.receiveOrgCode != ''">
AND ur.receive_org_code = #{dto.receiveOrgCode}
</if>
<if test="roleIds != null and dto.type == 'supervision'">
<foreach collection='roleIds' item='role' open='and (' close=')' separator='or'>
ur.instance_status like concat('%',#{role},'%')
</foreach>
</if>
<if test="dto.type == 'supervision'">
AND (ur.receive_company_code = #{companyCode} or ur.transfer_to_user_ids LIKE concat ('%', #{currentUserId}, '%'))
AND ur.instance_id is not null
</if>
<if test="dto.type == 'company'">
and (ur.use_unit_credit_code = #{dto.useUnitCreditCode} or ur.transfer_to_user_ids LIKE concat ('%', #{currentUserId}, '%'))
</if>
</where>
order by
<if test="sort != null">
ur.${sort.field} ${sort.sortType},
</if>
ur.rec_date desc ur.rec_date desc
</select> </select>
<delete id="deleteHistoryInfoById"> <delete id="deleteHistoryInfoById">
delete from tzs_jg_registration_history where current_document_id = #{code} delete
from tzs_jg_registration_history
where current_document_id = #{code}
</delete> </delete>
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
select a.use_unit_credit_code as companyCode,
group_concat(b.certificate_seq) as records
from tzs_jg_change_registration_name a,
tzs_jg_change_registration_name_eq b
where a.sequence_nbr = b.name_change_registration_id
and a.audit_status in ('三级待受理', '二级待受理', '一级待受理')
GROUP BY a.use_unit_credit_code
</select>
</mapper> </mapper>
...@@ -36,12 +36,40 @@ public abstract class BaseEquipUsedCheckService implements IEquipUsedCheck { ...@@ -36,12 +36,40 @@ public abstract class BaseEquipUsedCheckService implements IEquipUsedCheck {
boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS); boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS);
if (!isLocked) { if (!isLocked) {
log.error("设备:{}在被其他业务使用,加锁失败", record); log.error("设备:{}在被其他业务使用,加锁失败", record);
throw new BadRequest("存在其他业务在使用设备,请刷新后重试!"); throw new BadRequest("设备已被其他流程使用,请刷新后重试!");
} }
RBucket<Set<String>> RBucket = getRedisClient().getBucket(this.getFlowingEquipRedisKey(companyCode, getApplyBizType())); RBucket<Set<String>> RBucket = getRedisClient().getBucket(this.getFlowingEquipRedisKey(companyCode, getApplyBizType()));
Set<String> equipListOfUsed = RBucket.get(); Set<String> equipListOfUsed = RBucket.get();
if (equipListOfUsed != null && equipListOfUsed.contains(record)) { if (equipListOfUsed != null && equipListOfUsed.contains(record)) {
throw new BadRequest("存在设备正在被其他流程使用,不允许重复提交!"); throw new BadRequest("设备已被其他流程使用,不允许重复提交!");
}
if (equipListOfUsed == null || equipListOfUsed.isEmpty()) {
equipListOfUsed = new TreeSet<>();
}
equipListOfUsed.add(record);
getRedisClient().getBucket(this.getFlowingEquipRedisKey(companyCode, getApplyBizType())).set(equipListOfUsed);
FlowingEquipRedisContext.setRedisKeyInfo(new FlowingEquipRedisKeyDTO(this.getFlowingEquipRedisKey(companyCode, getApplyBizType()), Collections.singletonList(record)));
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
if (lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
}
@Override
public void registrationRepeatUsedCheck(String record, String companyCode) {
RLock lock = getRedisClient().getLock(this.getRepeatUsedCheckLockKey(companyCode, getApplyBizType(), record));
try {
boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS);
if (!isLocked) {
log.error("使用登记证:{}在被其他业务使用,加锁失败", record);
throw new BadRequest("使用登记证已被其他流程使用,请刷新后重试!");
}
RBucket<Set<String>> RBucket = getRedisClient().getBucket(this.getFlowingEquipRedisKey(companyCode, getApplyBizType()));
Set<String> equipListOfUsed = RBucket.get();
if (equipListOfUsed != null && equipListOfUsed.contains(record)) {
throw new BadRequest("使用登记证已被其他流程使用,不允许重复提交!");
} }
if (equipListOfUsed == null || equipListOfUsed.isEmpty()) { if (equipListOfUsed == null || equipListOfUsed.isEmpty()) {
equipListOfUsed = new TreeSet<>(); equipListOfUsed = new TreeSet<>();
......
...@@ -1363,17 +1363,17 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -1363,17 +1363,17 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
String queryType = map.getString("QUERY_TYPE"); String queryType = map.getString("QUERY_TYPE");
if (!ObjectUtils.isEmpty(queryType)) { if (!ObjectUtils.isEmpty(queryType)) {
// 查询 安装告知【可告知设备列表】【USE_UNIT_CREDIT_CODE=== null || ""】 // 查询 安装告知【可告知设备列表】【USE_UNIT_CREDIT_CODE=== null || ""】
if (ValidationUtil.equals(queryType, "AZ")) { if (ValidationUtil.equals(queryType, "AZ")) {//安装
BoolQueryBuilder nullOrEmptyQuery = QueryBuilders.boolQuery() BoolQueryBuilder nullOrEmptyQuery = QueryBuilders.boolQuery()
.mustNot(QueryBuilders.wildcardQuery("USE_UNIT_CREDIT_CODE", "*")); .mustNot(QueryBuilders.wildcardQuery("USE_UNIT_CREDIT_CODE", "*"));
boolMust.must(nullOrEmptyQuery); boolMust.must(nullOrEmptyQuery);
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "installNotice"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "installNotice");
} else if (ValidationUtil.equals(queryType, "WB")) { } else if (ValidationUtil.equals(queryType, "WB")) {//维保
// 查询 维保备案【可绑定设备列表】【(EQU_STATE=== null || "")】 // 查询 维保备案【可绑定设备列表】【(EQU_STATE=== null || "")】
BoolQueryBuilder wbBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder wbBuilder = QueryBuilders.boolQuery();
wbBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE")); wbBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE"));
boolMust.must(wbBuilder); boolMust.must(wbBuilder);
} else if (ValidationUtil.equals(queryType, "SY")) { } else if (ValidationUtil.equals(queryType, "SY")) {//使用
// 查询 使用登记【可选设备列表】【(EQU_STATUS=== null || "" ) && (USE_ORG_CODE(使用登记证编号) ==="" || null)】 // 查询 使用登记【可选设备列表】【(EQU_STATUS=== null || "" ) && (USE_ORG_CODE(使用登记证编号) ==="" || null)】
BoolQueryBuilder syBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder syBuilder = QueryBuilders.boolQuery();
syBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE")); syBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE"));
...@@ -1393,6 +1393,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -1393,6 +1393,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
syBuilder.must(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*")); syBuilder.must(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*"));
boolMust.must(syBuilder); boolMust.must(syBuilder);
} }
// this.setRepeatUsedCheckFilterByType(boolMust,companyCode,queryType);
} }
// 通用匹配规则,其他条件构建 // 通用匹配规则,其他条件构建
...@@ -1635,6 +1636,44 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -1635,6 +1636,44 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
return result; return result;
} }
private void setRepeatUsedCheckFilterByType(BoolQueryBuilder boolMust, String companyCode, String queryType) {
if("AZ".equals(queryType)){//安装告知
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "installNotice");
}else if("GZ_GZ".equals(queryType)){//改造告知
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "renovationNoticeNew");
}else if("GZ_WX".equals(queryType)){//维修告知
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "maintainInfo");
}else if("GZ_YZ".equals(queryType)){//移装告知
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "transferNotice");
}else if("SY".equals(queryType)){//使用登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "useRegister");
}else if("DJ_GZ".equals(queryType)){//改造变更登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "changeRegistration");
}else if("DJ_YZ".equals(queryType)){//移装变更登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "changeRegistrationTransfer");
}else if("DJ_DW".equals(queryType)){//单位变更登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "unitChange");
}else if("DJ_GM".equals(queryType)){//更名变更登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "changeName");
}else if("BF_YZ".equals(queryType)){//注销
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "");
}else if("BF_ZX".equals(queryType)){//报废
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "");
}else if("SB_QY".equals(queryType)){//启用
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "");
}else if("SB_TY".equals(queryType)){//停用
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "");
}else if("WB_BA".equals(queryType)){//维保备案
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "maintenanceFiling");
}else if("SB_YJ".equals(queryType)){//设备移交
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "equipmentHandover");
}else if("QP_BG".equals(queryType)){//车用气瓶变更
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "vehicleGasCylinderChange");
}else if("QP_DJ".equals(queryType)){//车用气瓶登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "vehicleInformation");
}
}
/** /**
* 设备注册信息分页查询 * 设备注册信息分页查询
* *
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationNameMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationUnitMapper;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author Administrator
*/
@Component
@Slf4j
public class JgChangeRegistrationNameRegistrationUsedCheckImpl extends BaseEquipUsedCheckService {
private RedissonClient redissonClient;
private String bizType = "changeName";
private JgChangeRegistrationNameMapper mapper;
public JgChangeRegistrationNameRegistrationUsedCheckImpl(RedissonClient redissonClient, JgChangeRegistrationNameMapper mapper) {
this.redissonClient = redissonClient;
this.mapper = mapper;
}
@Override
public RedissonClient getRedisClient() {
return redissonClient;
}
@Override
public String getApplyBizType() {
return bizType;
}
@Override
public void init() {
// 初始化在流程中设备数据
List<CompanyEquipCountDto> companyEquipCountDtos = mapper.queryForFlowingEquipList();
companyEquipCountDtos.forEach(c -> {
RBucket<Set<String>> rBucket = redissonClient.getBucket(getFlowingEquipRedisKey(c.getCompanyCode(), bizType));
rBucket.set(Arrays.stream(c.getRecords().split(",")).collect(Collectors.toSet()));
});
}
}
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -17,22 +16,20 @@ import com.yeejoin.amos.boot.module.jg.api.entity.*; ...@@ -17,22 +16,20 @@ import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum; import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.*; import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.api.service.IJgCertificateChangeRecordEqService;
import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationNameService; import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationNameService;
import com.yeejoin.amos.boot.module.jg.api.service.IJgRegistrationHistoryService;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo; import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
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.feign.TzsServiceFeignClient; import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService; import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService;
import com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService; import com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService;
import com.yeejoin.amos.boot.module.ymt.api.common.DateUtils;
import com.yeejoin.amos.boot.module.ymt.api.common.StringUtil; import com.yeejoin.amos.boot.module.ymt.api.common.StringUtil;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.UseInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.UseInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum; 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.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.UseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.UseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.flc.api.entity.RegUnitInfo; import com.yeejoin.amos.boot.module.ymt.flc.api.entity.RegUnitInfo;
import com.yeejoin.amos.boot.module.ymt.flc.api.feign.AccessFeignService; import com.yeejoin.amos.boot.module.ymt.flc.api.feign.AccessFeignService;
...@@ -56,7 +53,6 @@ import org.springframework.util.CollectionUtils; ...@@ -56,7 +53,6 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...@@ -92,18 +88,6 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -92,18 +88,6 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
WorkFlowFeignService workFlowFeignService; WorkFlowFeignService workFlowFeignService;
@Autowired @Autowired
private JgChangeRegistrationReformEqMapper jgChangeRegistrationReformEqMapper;
@Autowired
private JgChangeRegistrationTransferEqMapper jgChangeRegistrationTransferEqMapper;
@Autowired
private JgUseRegistrationEqMapper jgUseRegistrationEqMapper;
@Autowired
private JgChangeRegistrationUnitEqMapper jgChangeRegistrationUnitEqMapper;
@Autowired
private JgChangeRegistrationNameEqMapper jgChangeRegistrationNameEqMapper; private JgChangeRegistrationNameEqMapper jgChangeRegistrationNameEqMapper;
@Autowired @Autowired
...@@ -127,9 +111,11 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -127,9 +111,11 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
@Autowired @Autowired
TzBaseEnterpriseInfoMapper baseEnterpriseInfoMapper; TzBaseEnterpriseInfoMapper baseEnterpriseInfoMapper;
public final static String CHANGE_NAME = "更名变更"; public final static String CHANGE_NAME = "更名变更";
public final static String CHANGE_NAME_KEY = "changeName";
private final List<String> NOT_FLOWING_STATE = Arrays.asList("使用单位待提交", "一级受理已驳回", "使用单位已撤回", "已作废", "已完成");
public static String JG_COMAPNY_TYPE = "监管机构"; public static String JG_COMAPNY_TYPE = "监管机构";
private static String template = "发起【更名变更登记】业务申请,【申请单号:%s】"; private static String template = "发起【更名变更登记】业务申请,【申请单号:%s】";
@Autowired @Autowired
private JgRegistrationHistoryMapper jgRegistrationHistoryMapper; private JgRegistrationHistoryMapper jgRegistrationHistoryMapper;
...@@ -169,7 +155,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -169,7 +155,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
jgChangeRegistrationNameEq.setCreateUserId(reginParams.getUserModel().getUserId()); jgChangeRegistrationNameEq.setCreateUserId(reginParams.getUserModel().getUserId());
jgChangeRegistrationNameEq.setCreateUserName(reginParams.getUserModel().getRealName()); jgChangeRegistrationNameEq.setCreateUserName(reginParams.getUserModel().getRealName());
jgChangeRegistrationNameEq.setCertificateSeq(item.getSequenceNbr().toString()); jgChangeRegistrationNameEq.setCertificateSeq(item.getSequenceNbr().toString());
List<JSONObject> equipInfo = jsonObjects.stream().filter(a -> item.getUseRegistrationCode().equals(a.get("USE_ORG_CODE"))).collect(Collectors.toList()); List<JSONObject> equipInfo = jsonObjects.stream().filter(a -> a.get("USE_ORG_CODE").equals(item.getUseRegistrationCode())).collect(Collectors.toList());
jgChangeRegistrationNameEq.setEquipInfo(JSONObject.toJSONString(equipInfo)); jgChangeRegistrationNameEq.setEquipInfo(JSONObject.toJSONString(equipInfo));
jgChangeRegistrationNameEq.setIsInvalid("0"); jgChangeRegistrationNameEq.setIsInvalid("0");
jgChangeRegistrationNameEqs.add(jgChangeRegistrationNameEq); jgChangeRegistrationNameEqs.add(jgChangeRegistrationNameEq);
...@@ -216,83 +202,131 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -216,83 +202,131 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) @GlobalTransactional(rollbackFor = Exception.class)
public JgChangeRegistrationName save(String submitType, Map<String, JSONObject> jgRegistrationInfoMap) { public JgChangeRegistrationName save(String submitType, Map<String, JSONObject> jgRegistrationInfoMap) {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); try {
String[] taskName = new String[]{"流程结束"}; ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
JSONObject jgRegistrationInfo = jgRegistrationInfoMap.get("jgRegistrationInfo"); String[] taskName = new String[]{"流程结束"};
JgChangeRegistrationNameDto model = JSON.parseObject(jgRegistrationInfo.toJSONString(), JgChangeRegistrationNameDto.class); JSONObject jgRegistrationInfo = jgRegistrationInfoMap.get("jgRegistrationInfo");
// 获取告知单号 JgChangeRegistrationNameDto model = JSON.parseObject(jgRegistrationInfo.toJSONString(), JgChangeRegistrationNameDto.class);
ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.GMBG.getCode(), 1); // 获取告知单号
if (!ObjectUtils.isEmpty(listResponseModel) && listResponseModel.getStatus() != HttpStatus.OK.value()) { ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.GMBG.getCode(), 1);
log.error(" 获取告知单号失败"); if (!ObjectUtils.isEmpty(listResponseModel) && listResponseModel.getStatus() != HttpStatus.OK.value()) {
throw new RuntimeException(); log.error(" 获取告知单号失败");
} throw new RuntimeException();
List<String> applyNoList = listResponseModel.getResult(); }
if (CollectionUtils.isEmpty(applyNoList)) { List<String> applyNoList = listResponseModel.getResult();
return null; if (CollectionUtils.isEmpty(applyNoList)) {
} return null;
List<ProcessTaskDTO> processTasks = new ArrayList<>(); }
// 判断当前是否为提交 if ("1".equals(submitType)) {
String instanceId = ""; JSONArray objects = JSONObject.parseArray(jgRegistrationInfo.get("dataList").toString());
String nextTaskId = ""; List<Map<String, Object>> equipList = new ArrayList<>();
List<String> roleListNext = new ArrayList<>(); for (Object object : objects) {
List<String> roleListAll = new ArrayList<>(); JSONObject jsonObject = JSON.parseObject(object.toString());
String applyNo = applyNoList.get(0); Map<String, Object> map = new HashMap<>();
String nextUserIds = ""; map.put("SEQUENCE_NBR", jsonObject.get("sequenceNbr"));
if ("1".equals(submitType)) { equipList.add(map);
// 发起流程 }
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO(); this.repeatUsedEquipCheck(equipList, reginParams.getCompany().getCompanyCode());
List<ActWorkflowStartDTO> list = new ArrayList<>(); }
ActWorkflowStartDTO dto = new ActWorkflowStartDTO(); List<ProcessTaskDTO> processTasks = new ArrayList<>();
dto.setProcessDefinitionKey("unitRename"); // 判断当前是否为提交
dto.setBusinessKey(applyNo); String instanceId = "";
dto.setCompleteFirstTask(true); String nextTaskId = "";
// 启动并执行下一步人单位传接收单位的code List<String> roleListNext = new ArrayList<>();
dto.setNextExecuteUserCompanyCode(this.getReceiveCompanyCode(model)); List<String> roleListAll = new ArrayList<>();
list.add(dto); String applyNo = applyNoList.get(0);
actWorkflowBatchDTO.setProcess(list); String nextUserIds = "";
processTasks = cmWorkflowService.startBatch(actWorkflowBatchDTO); if ("1".equals(submitType)) {
this.buildRoleList(processTasks, roleListNext, roleListAll); // 发起流程
instanceId = processTasks.get(0).getProcessInstance().getId(); ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
nextTaskId = processTasks.get(0).getNextTask().get(0).getId(); List<ActWorkflowStartDTO> list = new ArrayList<>();
taskName[0] = processTasks.get(0).getNextTask().get(0).getName(); ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
List<WorkflowResultDto> workflowResultDtos = commonService.buildWorkFlowInfo(processTasks); dto.setProcessDefinitionKey("unitRename");
nextUserIds = workflowResultDtos.get(0).getNextExecutorUserIds(); dto.setBusinessKey(applyNo);
} dto.setCompleteFirstTask(true);
JgChangeRegistrationName dto = new JgChangeRegistrationName(); // 启动并执行下一步人单位传接收单位的code
// 字段转换 dto.setNextExecuteUserCompanyCode(this.getReceiveCompanyCode(model));
convertField(model); list.add(dto);
BeanUtils.copyProperties(model, dto); actWorkflowBatchDTO.setProcess(list);
dto.setApplyNo(applyNo); processTasks = cmWorkflowService.startBatch(actWorkflowBatchDTO);
dto.setCreateDate(new Date()); this.buildRoleList(processTasks, roleListNext, roleListAll);
dto.setNextExecutorIds(String.join(",", roleListNext)); instanceId = processTasks.get(0).getProcessInstance().getId();
dto.setInstanceStatus(String.join(",", roleListAll)); nextTaskId = processTasks.get(0).getNextTask().get(0).getId();
dto.setPromoter(reginParams.getUserModel().getUserId()); taskName[0] = processTasks.get(0).getNextTask().get(0).getName();
if (!StringUtils.isEmpty(instanceId)) { List<WorkflowResultDto> workflowResultDtos = commonService.buildWorkFlowInfo(processTasks);
dto.setInstanceId(instanceId); nextUserIds = workflowResultDtos.get(0).getNextExecutorUserIds();
dto.setNextTaskId(nextTaskId); }
dto.setNextExecuteUserIds(nextUserIds); JgChangeRegistrationName dto = new JgChangeRegistrationName();
dto.setAuditStatus(String.valueOf(WorkFlowStatusEnum.UNIT_RENAME_RECEIVE.getPass())); // 字段转换
dto.setApplyDate(new Date()); convertField(model);
} else { BeanUtils.copyProperties(model, dto);
dto.setAuditStatus(String.valueOf(WorkFlowStatusEnum.UNIT_RENAME_SUBMIT.getPass())); dto.setApplyNo(applyNo);
} dto.setCreateDate(new Date());
dto.setUseUnitCreditCode(reginParams.getCompany().getCompanyCode()); dto.setNextExecutorIds(String.join(",", roleListNext));
dto.setUseUnitName(reginParams.getCompany().getCompanyName()); dto.setInstanceStatus(String.join(",", roleListAll));
dto.setCreateUserId(RequestContext.getExeUserId()); dto.setPromoter(reginParams.getUserModel().getUserId());
dto.setCreateUserName(reginParams.getUserModel().getRealName()); if (!StringUtils.isEmpty(instanceId)) {
this.save(dto); dto.setInstanceId(instanceId);
// 新增业务关联设备表 dto.setNextTaskId(nextTaskId);
if (!ObjectUtils.isEmpty(jgRegistrationInfo) && !ObjectUtils.isEmpty(jgRegistrationInfo.get("dataList"))) { dto.setNextExecuteUserIds(nextUserIds);
saveJgChangeRegistrationNameEq(dto.getSequenceNbr(), jgRegistrationInfo.get("dataList"), reginParams); dto.setAuditStatus(String.valueOf(WorkFlowStatusEnum.UNIT_RENAME_RECEIVE.getPass()));
dto.setApplyDate(new Date());
} else {
dto.setAuditStatus(String.valueOf(WorkFlowStatusEnum.UNIT_RENAME_SUBMIT.getPass()));
}
dto.setUseUnitCreditCode(reginParams.getCompany().getCompanyCode());
dto.setUseUnitName(reginParams.getCompany().getCompanyName());
dto.setCreateUserId(RequestContext.getExeUserId());
dto.setCreateUserName(reginParams.getUserModel().getRealName());
this.save(dto);
// 新增业务关联设备表
if (!ObjectUtils.isEmpty(jgRegistrationInfo) && !ObjectUtils.isEmpty(jgRegistrationInfo.get("dataList"))) {
saveJgChangeRegistrationNameEq(dto.getSequenceNbr(), jgRegistrationInfo.get("dataList"), reginParams);
}
// 保存历史数据
updateHistory(jgRegistrationInfoMap, dto.getSequenceNbr().toString());
// 创建代办
this.createTaskModel(dto, taskName[0], submitType, nextUserIds);
if (StringUtil.isNotEmpty(dto.getInstanceId())) {
commonService.saveExecuteFlowData2Redis(dto.getInstanceId(), this.buildInstanceRuntimeData(dto));
}
return dto;
} catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw e;
} catch (Exception e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw new BadRequest("保存失败!");
} finally {
FlowingEquipRedisContext.clean();
} }
// 保存历史数据 }
updateHistory(jgRegistrationInfoMap, dto.getSequenceNbr().toString());
// 创建代办 private void repeatUsedEquipCheck(List<Map<String, Object>> equipList, String companyCode) {
this.createTaskModel(dto, taskName[0], submitType, nextUserIds); equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(CHANGE_NAME_KEY)
if(StringUtil.isNotEmpty(dto.getInstanceId())){ .registrationRepeatUsedCheck(String.valueOf(equipMap.get("SEQUENCE_NBR")), companyCode));
commonService.saveExecuteFlowData2Redis(dto.getInstanceId(), this.buildInstanceRuntimeData(dto)); }
/**
* 删除 redis校验重复引用设备的数据
*/
private void delRepeatUseEquipData(JgChangeRegistrationName notice) {
if (NOT_FLOWING_STATE.contains(notice.getAuditStatus())) {
LambdaQueryWrapper<JgChangeRegistrationNameEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgChangeRegistrationNameEq::getNameChangeRegistrationId, notice.getSequenceNbr());
List<JgChangeRegistrationNameEq> noticeEqList = jgChangeRegistrationNameEqMapper.selectList(queryWrapper);
noticeEqList.forEach(noticeEq -> EquipUsedCheckStrategyContext.getUsedStrategy(CHANGE_NAME_KEY)
.delDataForCheckEquipRepeatUsed(Collections.singletonList(noticeEq.getCertificateSeq()), notice.getUseUnitCreditCode())
);
} }
return dto; }
private void rollBackForDelRedisData() {
FlowingEquipRedisContext.getContext().forEach(
e -> EquipUsedCheckStrategyContext.getUsedStrategy(CHANGE_NAME_KEY)
.delDataForCheckWithKey(e.getData(), e.getRedisKey()));
} }
private String getReceiveCompanyCode(JgChangeRegistrationNameDto model) { private String getReceiveCompanyCode(JgChangeRegistrationNameDto model) {
...@@ -396,10 +430,23 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -396,10 +430,23 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
List<String> roleListAll = new ArrayList<>(); List<String> roleListAll = new ArrayList<>();
JgChangeRegistrationName jgChangeRegistrationName = this.getById(jgChangeRegistrationNameDto.getSequenceNbr()); JgChangeRegistrationName jgChangeRegistrationName = this.getById(jgChangeRegistrationNameDto.getSequenceNbr());
BeanUtil.copyProperties(jgChangeRegistrationNameDto, jgChangeRegistrationName); BeanUtil.copyProperties(jgChangeRegistrationNameDto, jgChangeRegistrationName);
if ("1".equals(submitType)) {
LambdaQueryWrapper<JgChangeRegistrationNameEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgChangeRegistrationNameEq::getNameChangeRegistrationId, jgChangeRegistrationNameDto.getSequenceNbr());
List<JgChangeRegistrationNameEq> noticeEqList = jgChangeRegistrationNameEqMapper.selectList(queryWrapper);
List<Map<String, Object>> equipList = new ArrayList<>();
for (JgChangeRegistrationNameEq eq : noticeEqList) {
Map<String, Object> map = new HashMap<>();
map.put("SEQUENCE_NBR", eq.getCertificateSeq());
equipList.add(map);
}
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
this.repeatUsedEquipCheck(equipList, reginParams.getCompany().getCompanyCode());
}
if ("1".equals(submitType)) { if ("1".equals(submitType)) {
//发起流程 //发起流程
if (!StringUtils.hasText(jgChangeRegistrationName.getInstanceId())) { if (!StringUtils.hasText(jgChangeRegistrationName.getInstanceId())) {
List<ProcessTaskDTO> processTasks = new ArrayList<>(); List<ProcessTaskDTO> processTasks = new ArrayList<>();
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO(); ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
List<ActWorkflowStartDTO> list = new ArrayList<>(); List<ActWorkflowStartDTO> list = new ArrayList<>();
...@@ -545,7 +592,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -545,7 +592,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
for (Long seq : ids) { for (Long seq : ids) {
JgChangeRegistrationName jgChangeRegistrationName = this.baseMapper.selectById(seq); JgChangeRegistrationName jgChangeRegistrationName = this.baseMapper.selectById(seq);
// 删除代办 + 中止流程 // 删除代办 + 中止流程
commonService.deleteTaskModel(String.valueOf(seq),jgChangeRegistrationName.getInstanceId()); commonService.deleteTaskModel(String.valueOf(seq), jgChangeRegistrationName.getInstanceId());
// 删除单子 // 删除单子
this.baseMapper.deleteById(seq); this.baseMapper.deleteById(seq);
// 删除单子对应eq // 删除单子对应eq
...@@ -565,7 +612,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -565,7 +612,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
try { try {
boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS); boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回) // 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回)
if(!isLocked){ if (!isLocked) {
throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!"); throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!");
} }
commonService.checkForRevocationFlow(taskId, instanceId); commonService.checkForRevocationFlow(taskId, instanceId);
...@@ -606,10 +653,11 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -606,10 +653,11 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
// 保存redis最新流程数据 // 保存redis最新流程数据
commonService.saveExecuteFlowData2Redis(jgChangeRegistrationName.getInstanceId(), this.buildInstanceRuntimeData(jgChangeRegistrationName)); commonService.saveExecuteFlowData2Redis(jgChangeRegistrationName.getInstanceId(), this.buildInstanceRuntimeData(jgChangeRegistrationName));
this.delRepeatUseEquipData(jgChangeRegistrationName);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if(lock.isHeldByCurrentThread()){ if (lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }
...@@ -637,7 +685,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -637,7 +685,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
try { try {
boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS); boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回) // 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回)
if(!isLocked){ if (!isLocked) {
throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!"); throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!");
} }
// 流程执行时,状态及权限校验 // 流程执行时,状态及权限校验
...@@ -663,17 +711,17 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -663,17 +711,17 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
ProcessTaskDTO processTaskDTO = cmWorkflowService.completeOrReject(taskId, dto, operate); ProcessTaskDTO processTaskDTO = cmWorkflowService.completeOrReject(taskId, dto, operate);
// 更新下一步执行人、创建待办 // 更新下一步执行人、创建待办
updateExecuteIds(instanceId, id, operate, processTaskDTO); updateExecuteIds(instanceId, id, operate, processTaskDTO);
this.delRepeatUseEquipData(jgChangeRegistrationName);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if(lock.isHeldByCurrentThread()){ if (lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }
} }
private String getNextUserOrgCode(String operate, JgChangeRegistrationName jgChangeRegistrationName) { private String getNextUserOrgCode(String operate, JgChangeRegistrationName jgChangeRegistrationName) {
if ("0".equals(operate)) { if ("0".equals(operate)) {
// 执行通过节点,单位code为接收机构单位信息 // 执行通过节点,单位code为接收机构单位信息
...@@ -849,7 +897,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -849,7 +897,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
} }
// 修改证管理信息 // 修改证管理信息
List<String> collect = list.stream().map(JgChangeRegistrationNameEq::getCertificateSeq).collect(Collectors.toList()); List<String> collect = list.stream().map(JgChangeRegistrationNameEq::getCertificateSeq).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(collect)){ if (!ObjectUtils.isEmpty(collect)) {
LambdaQueryWrapper<JgUseRegistrationManage> lambda = new QueryWrapper<JgUseRegistrationManage>().lambda(); LambdaQueryWrapper<JgUseRegistrationManage> lambda = new QueryWrapper<JgUseRegistrationManage>().lambda();
lambda.in(JgUseRegistrationManage::getSequenceNbr, collect); lambda.in(JgUseRegistrationManage::getSequenceNbr, collect);
JgUseRegistrationManage jgUseRegistrationManage = new JgUseRegistrationManage(); JgUseRegistrationManage jgUseRegistrationManage = new JgUseRegistrationManage();
...@@ -943,7 +991,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -943,7 +991,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
jgChangeRegistrationName = this.baseMapper.selectById(sequenceNbr); jgChangeRegistrationName = this.baseMapper.selectById(sequenceNbr);
jgChangeRegistrationName.setReceiveOrgCode(jgChangeRegistrationName.getReceiveCompanyCode() + "_" + jgChangeRegistrationName.getReceiveOrgName()); jgChangeRegistrationName.setReceiveOrgCode(jgChangeRegistrationName.getReceiveCompanyCode() + "_" + jgChangeRegistrationName.getReceiveOrgName());
// 页面可编辑(当前登录人是发起人)且符合这个 监管机构 false // 页面可编辑(当前登录人是发起人)且符合这个 监管机构 false
if(!JG_COMAPNY_TYPE.equals(reginParams.getCompany().getCompanyType())){ if (!JG_COMAPNY_TYPE.equals(reginParams.getCompany().getCompanyType())) {
dtoMap.put("isInProvince", this.justIsInProvince(reginParams.getCompany().getCompanyCode())); dtoMap.put("isInProvince", this.justIsInProvince(reginParams.getCompany().getCompanyCode()));
} else { } else {
dtoMap.put("isInProvince", false); dtoMap.put("isInProvince", false);
...@@ -969,22 +1017,22 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -969,22 +1017,22 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
return map; return map;
} }
private Boolean justIsInProvince(String companyCode){ private Boolean justIsInProvince(String companyCode) {
TzBaseEnterpriseInfo baseEnterpriseInfo = baseEnterpriseInfoMapper.selectOne(new LambdaQueryWrapper<TzBaseEnterpriseInfo>().eq(TzBaseEnterpriseInfo::getUseCode, companyCode)); TzBaseEnterpriseInfo baseEnterpriseInfo = baseEnterpriseInfoMapper.selectOne(new LambdaQueryWrapper<TzBaseEnterpriseInfo>().eq(TzBaseEnterpriseInfo::getUseCode, companyCode));
if(baseEnterpriseInfo == null ){ if (baseEnterpriseInfo == null) {
log.warn(companyCode + "无企业信息"); log.warn(companyCode + "无企业信息");
return false; return false;
} }
String dataSource = baseEnterpriseInfo.getDataSources(); String dataSource = baseEnterpriseInfo.getDataSources();
String registerType = baseEnterpriseInfo.getRegisterType(); String registerType = baseEnterpriseInfo.getRegisterType();
String[] disabledDataSource = {"企业注册", "陕西省内企业"}; String[] disabledDataSource = {"企业注册", "陕西省内企业"};
String[] disabledRegisterType = {"企业单位"}; String[] disabledRegisterType = {"企业单位"};
// 省内的企业且类型为企业时 // 省内的企业且类型为企业时
return Arrays.asList(disabledDataSource).contains(dataSource) && Arrays.asList(disabledRegisterType).contains(registerType); return Arrays.asList(disabledDataSource).contains(dataSource) && Arrays.asList(disabledRegisterType).contains(registerType);
} }
public Page<Map<String, Object>> getList(JgChangeRegistrationNameDto dto,String sort, Page<Map<String, Object>> page, List<String> roleIds, String companyCode) { public Page<Map<String, Object>> getList(JgChangeRegistrationNameDto dto, String sort, Page<Map<String, Object>> page, List<String> roleIds, String companyCode) {
if (org.apache.commons.lang3.StringUtils.isNotBlank(dto.getReceiveOrgCode())) { if (org.apache.commons.lang3.StringUtils.isNotBlank(dto.getReceiveOrgCode())) {
String[] receiveOrgIdList = dto.getReceiveOrgCode().split("_"); String[] receiveOrgIdList = dto.getReceiveOrgCode().split("_");
if (receiveOrgIdList.length > 1) { if (receiveOrgIdList.length > 1) {
...@@ -993,6 +1041,6 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -993,6 +1041,6 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
} }
} }
SortVo sortMap = commonService.sortFieldConversion(sort); SortVo sortMap = commonService.sortFieldConversion(sort);
return this.baseMapper.getListPage(page,sortMap, dto, roleIds, companyCode, RequestContext.getExeUserId()); return this.baseMapper.getListPage(page, sortMap, dto, roleIds, companyCode, RequestContext.getExeUserId());
} }
} }
\ No newline at end of file
...@@ -322,7 +322,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -322,7 +322,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("使用登记保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
......
...@@ -421,7 +421,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -421,7 +421,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
...@@ -642,7 +642,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -642,7 +642,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
......
...@@ -353,7 +353,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -353,7 +353,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
...@@ -538,7 +538,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -538,7 +538,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
......
...@@ -268,7 +268,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -268,7 +268,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("改造告知保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
...@@ -471,7 +471,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -471,7 +471,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("知保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
......
...@@ -404,7 +404,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -404,7 +404,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
...@@ -483,7 +483,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -483,7 +483,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
......
...@@ -607,7 +607,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -607,7 +607,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("使用登记保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
...@@ -814,7 +814,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -814,7 +814,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("使用登记保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
...@@ -2796,7 +2796,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -2796,7 +2796,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("使用登记保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
......
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