Commit 6c1e8dcf authored by tianbo's avatar tianbo

Merge branch 'develop_tzs_test' into develop_tzs_register

parents 1d5955d2 5f4c7438
......@@ -119,10 +119,10 @@ public class DataDictionaryController extends BaseController {
* @param extend
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getDictByExtendAndTypePage", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据extend、Type、name模糊查询字典", notes = "根据extend、Type、name模糊查询字典")
public ResponseModel<IPage<DataDictionary>> getDictByExtendAndTypePage(@RequestParam("extend") String extend,
public ResponseModel<IPage<DataDictionary>> getDictByExtendAndTypePage(@RequestParam(value = "extend", required = false) String extend,
@RequestParam("type") String type,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "current") int current,
......
......@@ -29,10 +29,14 @@ import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.common.api.service.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationManageMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgVehicleInformationService;
import com.yeejoin.amos.boot.module.jg.api.vo.JgVehicleInformationVo;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
......@@ -47,7 +51,6 @@ import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.feign.WorkFlowFeignService;
import com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent;
import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService;
import com.yeejoin.amos.boot.module.common.api.service.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil;
import com.yeejoin.amos.boot.module.jg.biz.utils.FileExporter;
import com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils;
......@@ -104,7 +107,6 @@ import java.util.stream.Stream;
import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XIAN_YANG;
import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XI_XIAN;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl.DB_BATCH_SIZE;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl.getAuditPassedDate;
/**
......@@ -220,12 +222,14 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
exportParamsMap.put("day", today.getDayOfMonth());
}
/**
* 新增(提交)车用气瓶
*
* @param map map
* @return list
*/
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class)
public List<JgVehicleInformation> save(String submit, JSONObject map) {
try {
......@@ -513,14 +517,37 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
* 删除 redis校验重复引用设备的数据
*/
private void delRepeatUseEquipData(JgVehicleInformation notice) {
log.info("status = {}", notice.getStatus());
log.info("【车用气瓶-撤回校验开始】applyNo={}, status={}, useUnitCreditCode={}",
notice.getApplyNo(), notice.getStatus(), notice.getUseUnitCreditCode());
if (NOT_FLOWING_STATE.contains(notice.getStatus())) {
LambdaQueryWrapper<JgVehicleInformationEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgVehicleInformationEq::getVehicleId, notice.getSequenceNbr());
List<JgVehicleInformationEq> noticeEqList = jgVehicleInformationEqService.list(queryWrapper);
noticeEqList.forEach(noticeEq -> EquipUsedCheckStrategyContext.getUsedStrategy(DEFINITION_KEY)
.delDataForCheckEquipRepeatUsed(Collections.singletonList(noticeEq.getEquId()), notice.getUseUnitCreditCode()));
log.info("【车用气瓶-查询设备】applyNo={}, 查询到设备数量={}",
notice.getApplyNo(),
noticeEqList == null ? 0 : noticeEqList.size());
if (noticeEqList != null && !noticeEqList.isEmpty()) {
noticeEqList.forEach(noticeEq -> {
log.info("【车用气瓶-删除重复使用校验】applyNo={}, equId={}, useUnitCreditCode={}",
notice.getApplyNo(),
noticeEq.getEquId(),
notice.getUseUnitCreditCode());
EquipUsedCheckStrategyContext
.getUsedStrategy(DEFINITION_KEY)
.delDataForCheckEquipRepeatUsed(
Collections.singletonList(noticeEq.getEquId()),
notice.getUseUnitCreditCode()
);
});
} else {
log.info("【车用气瓶-删除重复使用校验】applyNo={} 未查询到设备信息,无需处理",
notice.getApplyNo());
}
} else {
log.info("【车用气瓶-驳回校验跳过】applyNo={}, status={} 不在撤回处理状态范围",
notice.getApplyNo(), notice.getStatus());
}
log.info("【车用气瓶-撤回校验结束】applyNo={}", notice.getApplyNo());
}
private List<String> getEquList(JgVehicleInformation notice) {
......@@ -543,6 +570,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
* @param instanceId instanceId
* @param _nextTaskId nextTaskId
*/
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class)
public void cancel(String instanceId, String _nextTaskId) {
String lockKey = CommonServiceImpl.buildJgExecuteLockKey(instanceId);
......@@ -826,6 +854,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
* @param comment 意见
* @param nextTaskId nextTaskId
*/
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class)
public void flowExecute(Long sequenceNbr, String instanceId, String operate, String comment, String nextTaskId, String equDefineCode) {
String lockKey = CommonServiceImpl.buildJgExecuteLockKey(instanceId);
......@@ -1534,6 +1563,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
}
}
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 6000000)
public JgVehicleInformation cancelApplication(Long sequenceNbr, String cancelReason) {
JgVehicleInformation vehicleInformation = this.getById(sequenceNbr);
......@@ -1929,6 +1959,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
* @param map map
* @return list
*/
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class)
@EnableEsRollback
public List<JgVehicleInformation> saveOrUpdateHisData(JSONObject map) {
......@@ -2302,6 +2333,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
* @param map map
* @return list
*/
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class)
@FieldMapping({
@FieldMapping.FieldMap(
......
......@@ -51,4 +51,5 @@ public interface JyjcOpeningApplicationMapper extends BaseMapper<JyjcOpeningAppl
*/
List<String> selectUnitCodeListByAgencyClassify(@Param("agencyClassifies") List<String> agencyClassifies);
List<String> selectOpeningSeqInEnterpriseCertSeq(@Param("enterpriseCertSeqs") List<String> enterpriseCertSeqs);
}
......@@ -143,4 +143,38 @@
#{agencyClassify}
</foreach>
</select>
<select id="selectOpeningSeqInEnterpriseCertSeq" resultType="java.lang.String">
SELECT
distinct t.sequence_nbr
FROM
tz_base_enterprise_cert ec
LEFT JOIN (
SELECT
oa.sequence_nbr,
oa.unit_code,
oa.open_biz_type,
his.history_data -> 'baseUnitLicences' -> 0 ->> 'agencyType' AS agency_type
FROM
"tz_jyjc_opening_application" oa
LEFT JOIN tz_jyjc_inspection_history his ON his.s_seq = oa.sequence_nbr
WHERE oa.status = '已完成'
) t ON t.unit_code = ec.unit_code
AND
CASE
WHEN t.open_biz_type = 'jy' THEN
'检验机构'
WHEN t.open_biz_type = 'jc' THEN
'检测机构'
WHEN t.open_biz_type = 'jc-sydw' THEN
'使用单位'
WHEN t.open_biz_type = 'jc-agw' THEN
'安装改造维修单位'
END = ec.unit_type
AND t.agency_type = ec.agency_type
WHERE ec.sequence_nbr in
<foreach collection="enterpriseCertSeqs" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
</mapper>
......@@ -304,7 +304,9 @@ public class RuleActionHandler {
// 需要匹配核准项目时,将符合核准项目要求的单位code和指定的单位code取交集,否则直接符合指定的机构
List<String> designatedUnitMatch = isMatchItem ? Arrays.stream(defaultInspectionCode.split(",")).filter(unitCodes::contains).collect(Collectors.toList()) : Arrays.asList(defaultInspectionCode.split(","));
if(!designatedUnitMatch.isEmpty()){
matchEnterpriseInfos = tzBaseEnterpriseInfoMapper.getInspectionUnitListByCodeNoZjjg(designatedUnitMatch, areaCode, openBizType);
// 查询证对应开通业务ID
List<String> certOpeningSeqs = this.getOpeningSeqs(designatedUnitMatch, unitLicenceList);
matchEnterpriseInfos = tzBaseEnterpriseInfoMapper.getInspectionUnitListByCodeNoZjjg(designatedUnitMatch, areaCode, openBizType, certOpeningSeqs);
// 返回下一步是否可不予返回,供下一节点审核时显示判断是否显示不予受理按钮,在提交时数据会写入到主表:true-必须处理,false-可不予受理
this.setIsCanNoAccept(matchEnterpriseInfos, isMustAccept);
}
......@@ -316,6 +318,19 @@ public class RuleActionHandler {
return matchEnterpriseInfos;
}
/**
* 获取指定单位开通的检验机构
*
* @param useCodes
* @param unitLicenceList
*/
private List<String> getOpeningSeqs(List<String> useCodes, List<TzBaseUnitLicence> unitLicenceList) {
// 所有符合资质对应证ID
List<String> enterpriseCertSeqs = unitLicenceList.stream().filter(unitLicence -> useCodes.contains(unitLicence.getUnitCode())).map(TzBaseUnitLicence::getEnterpriseCertSeq).collect(Collectors.toList());
// 正对应开通ID
return openingApplicationMapper.selectOpeningSeqInEnterpriseCertSeq(enterpriseCertSeqs);
}
private List<TzBaseEnterpriseInfoDto> getInspectionUnitListForLegal(Boolean isMatchItem, List<TzBaseUnitLicence> unitLicenceList, Boolean isMatchArea, InspectionEquipInfo inspectionEquipInfo, String openBizType, String defaultInspectionCode, String legalInspectionCodes, Boolean isCanNoAccept) {
// 是否进行属地过滤
......@@ -331,7 +346,9 @@ public class RuleActionHandler {
List<TzBaseEnterpriseInfoDto> matchEnterpriseInfos = new ArrayList<>();
// 按照资质 + areaCode,进行设备单位的筛选
if (!legalUnitCodes.isEmpty()) {
matchEnterpriseInfos = tzBaseEnterpriseInfoMapper.getInspectionUnitListByCodeNoZjjg(legalUnitCodes, areaCode, openBizType);
// 查询证对应开通业务ID
List<String> certOpeningSeqs = this.getOpeningSeqs(legalUnitCodes, unitLicenceList);
matchEnterpriseInfos = tzBaseEnterpriseInfoMapper.getInspectionUnitListByCodeNoZjjg(legalUnitCodes, areaCode, openBizType, certOpeningSeqs);
// 返回下一步是否可不予返回,供下一节点审核时显示判断是否显示不予受理按钮,在提交时数据会写入
this.setIsCanNoAccept(matchEnterpriseInfos, isCanNoAccept);
}
......@@ -347,8 +364,10 @@ public class RuleActionHandler {
String areaCode = isMatchArea ? inspectionEquipInfo.getAreaCode() : "";
// 所有符合单位的code
Set<String> unitCodes = unitLicenceList.stream().map(TzBaseUnitLicence::getUnitCode).collect(Collectors.toSet());
// 查询证对应开通业务ID
List<String> certOpeningSeqs = this.getOpeningSeqs(new ArrayList<>(unitCodes), unitLicenceList);
// 不匹配核准项目时,不按照符合资质过滤,默认开通状态
List<TzBaseEnterpriseInfoDto> matchEnterpriseInfos = tzBaseEnterpriseInfoMapper.getInspectionUnitListByCodeNoZjjg(isMatchItem ? new ArrayList<>(unitCodes) : null, areaCode, openBizType);
List<TzBaseEnterpriseInfoDto> matchEnterpriseInfos = tzBaseEnterpriseInfoMapper.getInspectionUnitListByCodeNoZjjg(isMatchItem ? new ArrayList<>(unitCodes) : null, areaCode, openBizType, certOpeningSeqs);
// 返回下一步是否可不予返回,供下一节点审核时显示判断是否显示不予受理按钮,在提交时数据会写入到主表:true-必须处理,false-可不予受理
this.setIsCanNoAccept(matchEnterpriseInfos, isCanNoAccept);
return matchEnterpriseInfos;
......
......@@ -71,12 +71,14 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
/**
* 查询非自检机构的单位
* @param codes 单位code
* @param city 开通区县
*
* @param codes 单位code
* @param city 开通区县
* @param openBizType 开通业务类型
* @param certOpeningSeqs 证对应开通ID
* @return 非自检机构开通的单位
*/
List<TzBaseEnterpriseInfoDto> getInspectionUnitListByCodeNoZjjg(@Param("list") List<String> codes, @Param("city") String city, @Param("openBizType") String openBizType);
List<TzBaseEnterpriseInfoDto> getInspectionUnitListByCodeNoZjjg(@Param("list") List<String> codes, @Param("city") String city, @Param("openBizType") String openBizType, @Param("certOpeningSeqs") List<String> certOpeningSeqs);
/**
* 根据ID查找企业详情信息
......
......@@ -304,6 +304,12 @@
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="certOpeningSeqs != null and certOpeningSeqs.size()>0">
AND tjoa.sequence_nbr in
<foreach collection="certOpeningSeqs" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</if>
<if test="city != null and city != ''">
and tjoa.detection_region like concat('%',#{city},'%')
......
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