Commit 444b8037 authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into…

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into develop_tzs_register_to_0715
parents 75c40a85 eeb29b0e
package com.yeejoin.amos.boot.module.jg.api.mapper;
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.JgChangeVehicleRegistrationUnitDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeVehicleRegistrationUnit;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -25,4 +26,6 @@ public interface JgChangeVehicleRegistrationUnitMapper extends BaseMapper<JgChan
@Param("orgCode") String orgCode,
@Param("currentUserId") String currentUserId,
@Param("roleIds") List<String> roleIds);
List<CompanyEquipCountDto> queryForFlowingEquipList();
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
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.JgVehicleInformationDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgVehicleInformation;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
......@@ -39,4 +40,6 @@ public interface JgVehicleInformationMapper extends BaseMapper<JgVehicleInformat
@Select("select name from tz_equipment_category where code=#{code}")
String getEquCategoryNameByCode(String code);
List<CompanyEquipCountDto> queryForFlowingEquipList();
}
......@@ -96,5 +96,14 @@
order by cru.rec_date desc
</select>
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
select a.use_unit_credit_code as companyCode,
group_concat(b.equ_id) as records
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 a.status in ('三级待受理', '二级待受理', '一级待受理')
GROUP BY a.use_unit_credit_code
</select>
</mapper>
......@@ -192,23 +192,24 @@
ORDER BY INSPECT_DATE desc LIMIT 1
</select>
<select id="getUseDetail" resultType="java.util.Map">
SELECT USE_UNIT_NAME as useUnitName,
USE_UNIT_CREDIT_CODE as useUnitCreditCode,
USE_PLACE as usePlace,
SAFETY_MANAGER as safetyManager,
SAFETY_MANAGER_CODE as safetyManagerCode,
PHONE as phone,
concat(ESTATE_UNIT_CREDIT_CODE, '_', ESTATE_UNIT_NAME) as estateUnitName,
SELECT ibjui.USE_UNIT_NAME as useUnitName,
ibjui.USE_UNIT_CREDIT_CODE as useUnitCreditCode,
ibjui.USE_PLACE as usePlace,
ibjui.SAFETY_MANAGER as safetyManager,
ibjui.SAFETY_MANAGER_CODE as safetyManagerCode,
concat(tzi.sequence_nbr,'_',SAFETY_MANAGER) as safetyManagerSeq,
ibjui."PHONE" as phone,
concat(ibjui.ESTATE_UNIT_CREDIT_CODE, '_', ibjui.ESTATE_UNIT_NAME) as estateUnitName,
-- ESTATE_UNIT_NAME as estateUnitName,
-- ESTATE_UNIT_CREDIT_CODE as estateUnitCreditCode,
ADDRESS as address,
PROVINCE as province,
CITY as city,
COUNTY as county,
USE_INNER_CODE as useInnerCode,
LONGITUDE_LATITUDE as longitudeLatitude,
FACTORY_USE_SITE_STREET as factoryUseSiteStreet
FROM "idx_biz_jg_use_info" where RECORD = #{id}
ibjui.ADDRESS as address,
ibjui.PROVINCE as province,
ibjui.CITY as city,
ibjui.COUNTY as county,
ibjui.USE_INNER_CODE as useInnerCode,
ibjui.LONGITUDE_LATITUDE as longitudeLatitude,
ibjui.FACTORY_USE_SITE_STREET as factoryUseSiteStreet
FROM "idx_biz_jg_use_info" ibjui left join tzs_user_info tzi on ibjui."PHONE" = tzi."phone" where RECORD = #{id}
</select>
<select id="getEquipListPage" resultType="java.util.Map">
SELECT jri.EQU_CODE as equCode,
......
......@@ -261,5 +261,13 @@
</foreach>
ORDER BY ui.REC_DATE DESC
</select>
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
select a.use_unit_credit_code as companyCode,
group_concat(b.equ_id) as records
from tzs_jg_vehicle_information a,
tzs_jg_vehicle_information_eq b
where a.sequence_nbr = b.vehicle_id
and a.status in ('三级待受理', '二级待受理', '一级待受理')
GROUP BY a.use_unit_credit_code
</select>
</mapper>
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.JgChangeVehicleRegistrationUnitMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
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 JgChangeVehicleRegistrationUnitEquipUsedCheckImpl extends BaseEquipUsedCheckService {
private RedissonClient redissonClient;
private String bizType = "vehicleGasCylinderChange";
private JgChangeVehicleRegistrationUnitMapper mapper;
public JgChangeVehicleRegistrationUnitEquipUsedCheckImpl(RedissonClient redissonClient, JgChangeVehicleRegistrationUnitMapper 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()));
});
}
}
......@@ -17,6 +17,9 @@ import com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeVehicleRegistrationUnitMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeVehicleRegistrationUnitService;
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.service.ICommonService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
......@@ -43,10 +46,12 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
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;
......@@ -60,6 +65,7 @@ import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XI_XI
public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgChangeVehicleRegistrationUnitDto, JgChangeVehicleRegistrationUnit, JgChangeVehicleRegistrationUnitMapper> implements IJgChangeVehicleRegistrationUnitService {
private static final String SUBMIT_TYPE_FLOW = "1";
private static final String PROCESS_DEFINITION_KEY = "vehicleGasCylinderChange";
private final List<String> NOT_FLOWING_STATE = Arrays.asList("使用单位待提交", "一级受理已驳回", "使用单位已撤回", "已作废", "已完成");
private static final String BUSINESS_NAME = "车用气瓶变更";
private static final String template = "发起【车用气瓶变更登记】业务申请,【申请单号:%s】";
@Autowired
......@@ -125,7 +131,21 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 600000)
public List<JgChangeVehicleRegistrationUnit> saveMessage(JSONObject map, ReginParams reginParams) {
try {
JgChangeVehicleRegistrationUnit dto = new JgChangeVehicleRegistrationUnit();
if (!ObjectUtils.isEmpty(map.get("submit")) && SUBMIT_TYPE_FLOW.equals(map.get("submit").toString())) {
if (map.containsKey("dataList")) {
List<Map<String, Object>> equipList = new ArrayList<>();
JSONArray objects = JSONObject.parseArray(JSON.toJSONString(map.get("dataList")));
objects.forEach(data -> {
Map<String, Object> equ = new HashMap<>();
JSONObject object = JSONObject.parseObject(data.toString());
equ.put("record", object.get("record"));
equipList.add(equ);
});
this.repeatUsedEquipCheck(equipList, reginParams.getCompany().getCompanyCode());
}
}
if (!map.containsKey("sequenceNbr")) {
// 新增
BeanUtil.copyProperties(map, dto);
......@@ -209,9 +229,47 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
}
}
return Collections.singletonList(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();
}
}
private void repeatUsedEquipCheck(List<Map<String, Object>> equipList, String companyCode) {
equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.equipRepeatUsedCheck(String.valueOf(equipMap.get("record")), companyCode));
}
/**
* 删除 redis校验重复引用设备的数据
*/
private void delRepeatUseEquipData(JgChangeVehicleRegistrationUnit notice) {
if (NOT_FLOWING_STATE.contains(notice.getStatus())) {
LambdaQueryWrapper<JgChangeVehicleRegistrationUnitEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgChangeVehicleRegistrationUnitEq::getUnitChangeId, notice.getSequenceNbr());
List<JgChangeVehicleRegistrationUnitEq> noticeEqList = jgChangeVehicleRegistrationUnitEqService.list(queryWrapper);
noticeEqList.forEach(noticeEq -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.delDataForCheckEquipRepeatUsed(Collections.singletonList(noticeEq.getEquId()), notice.getNewUseUnitCreditCode()));
}
}
private void rollBackForDelRedisData() {
FlowingEquipRedisContext.getContext().forEach(e -> {
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.delDataForCheckWithKey(e.getData(), e.getRedisKey());
});
}
public Page<Map<String, Object>> getPage(Page<JgChangeVehicleRegistrationUnit> page, JgChangeVehicleRegistrationUnitDto dto, String type, ReginParams reginParams) {
public Page<Map<String, Object>> getPage
(Page<JgChangeVehicleRegistrationUnit> page, JgChangeVehicleRegistrationUnitDto dto, String type, ReginParams
reginParams) {
String orgCode = reginParams.getCompany().getCompanyCode();
String currentUserId = reginParams.getUserModel().getUserId();
return this.getBaseMapper().getPage(page, dto, type, orgCode, currentUserId, dto.getRoleIds());
......@@ -257,6 +315,7 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
WorkflowResultDto workflowResultDto = resultDto.get(0);
updateData(jgChangeVehicleRegistrationUnit.getSequenceNbr(), operate, workflowResultDto, Boolean.FALSE);
}
this.delRepeatUseEquipData(jgChangeVehicleRegistrationUnit);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
......@@ -267,7 +326,8 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
}
public JgChangeVehicleRegistrationUnit updateData(Long sequenceNbr, String operate, WorkflowResultDto workflowResultDto, Boolean isFirst) {
public JgChangeVehicleRegistrationUnit updateData(Long sequenceNbr, String operate, WorkflowResultDto
workflowResultDto, Boolean isFirst) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String role = workflowResultDto.getNextExecutorRoleIds();
String taskCode = FlowStatusEnum.TO_BE_FINISHED.getName();
......@@ -351,7 +411,8 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
return jgChangeVehicleRegistrationUnit;
}
public void updateEsData(List<String> ids, JgChangeVehicleRegistrationUnit jgChangeVehicleRegistrationUnit, String useRegistCode) {
public void updateEsData(List<String> ids, JgChangeVehicleRegistrationUnit
jgChangeVehicleRegistrationUnit, String useRegistCode) {
// 更新es
HashMap<String, Map<String, Object>> objMap = new HashMap<>();
ids.forEach(item -> {
......@@ -452,7 +513,8 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
/**
* 生成监管码
*/
public void createCode(JgChangeVehicleRegistrationUnit jgChangeVehicleRegistrationUnit, String equCategory, String record) {
public void createCode(JgChangeVehicleRegistrationUnit jgChangeVehicleRegistrationUnit, String
equCategory, String record) {
Map<String, Object> map = new HashMap<>();
map.put("cityCode", XI_XIAN.getCode().equals(jgChangeVehicleRegistrationUnit.getVehicleApanage()) ? XIAN_YANG.getCode() : jgChangeVehicleRegistrationUnit.getVehicleApanage());
map.put("isXiXian", XI_XIAN.getCode().equals(jgChangeVehicleRegistrationUnit.getVehicleApanage()) ? "1" : "0");
......@@ -487,7 +549,8 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
return stringResponseModel.getResult();
}
public InstanceRuntimeData buildInstanceRuntimeData(JgChangeVehicleRegistrationUnit jgChangeVehicleRegistrationUnit) {
public InstanceRuntimeData buildInstanceRuntimeData(JgChangeVehicleRegistrationUnit
jgChangeVehicleRegistrationUnit) {
return InstanceRuntimeData.builder()
.nextExecuteUserIds(jgChangeVehicleRegistrationUnit.getNextExecuteUserIds())
.promoter(jgChangeVehicleRegistrationUnit.getPromoter())
......@@ -509,7 +572,8 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
return commonServiceImpl.updateTaskModel(params);
}
public void buildTask(JgChangeVehicleRegistrationUnit jgChangeVehicleRegistrationUnit, WorkflowResultDto workflowResultDto) {
public void buildTask(JgChangeVehicleRegistrationUnit jgChangeVehicleRegistrationUnit, WorkflowResultDto
workflowResultDto) {
// 代办消息
ArrayList<TaskModelDto> list = new ArrayList<>();
TaskModelDto dto = new TaskModelDto();
......@@ -588,7 +652,8 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
/**
* 分页查询
*/
public Page<JgChangeVehicleRegistrationUnitDto> queryForJgChangeVehicleRegistrationUnitPage(Page<JgChangeVehicleRegistrationUnitDto> page) {
public Page<JgChangeVehicleRegistrationUnitDto> queryForJgChangeVehicleRegistrationUnitPage
(Page<JgChangeVehicleRegistrationUnitDto> page) {
return this.queryForPage(page, null, false);
}
......@@ -714,6 +779,7 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
commonServiceImpl.rollbackTask(instanceId, jsonObject);
// redis流程实时数据更新
commonServiceImpl.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(data));
this.delRepeatUseEquipData(data);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
......
......@@ -1696,6 +1696,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
detail.putAll(inspectDetail);
}
if (!ObjectUtils.isEmpty(useDetail)) {
useDetail.put("safetyManager", useDetail.get("safetyManagerSeq"));
detail.putAll(useDetail);
}
if (!ObjectUtils.isEmpty(desDetail)) {
......
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.JgMaintainNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
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 JgVehicleInformationEquipUsedCheckImpl extends BaseEquipUsedCheckService {
private RedissonClient redissonClient;
private String bizType = "vehicleInformation";
private JgVehicleInformationMapper mapper;
public JgVehicleInformationEquipUsedCheckImpl(RedissonClient redissonClient, JgVehicleInformationMapper 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()));
});
}
}
......@@ -27,6 +27,8 @@ 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;
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.service.ICmWorkflowService;
import com.yeejoin.amos.boot.module.jg.biz.utils.FileExporter;
......@@ -96,6 +98,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
"equipCode", "equipCategory", "useInnerCode", "factoryNum", "giveOutYear",
"giveOutMonth", "giveOutDay"
};
private final List<String> NOT_FLOWING_STATE = Arrays.asList("使用单位待提交", "一级受理已驳回", "使用单位已撤回", "已作废", "已完成");
@Autowired
private RedissonClient redissonClient;
@Autowired
......@@ -123,8 +127,6 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
@Autowired
private IdxBizJgSupervisionInfoMapper idxBizJgSupervisionInfoMapper;
@Autowired
private InspectionDetectionInfoMapper inspectionDetectionInfoMapper;
@Autowired
private DataDictionaryServiceImpl iDataDictionaryService;
@Autowired
private TzsServiceFeignClient tzsServiceFeignClient;
......@@ -181,6 +183,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class)
public List<JgVehicleInformation> save(String submit, JSONObject map) {
try {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())) + "", ReginParams.class);
JgVehicleInformationDto vehicleInfoDto = JSON.parseObject(JSON.toJSONString(map), JgVehicleInformationDto.class);
......@@ -189,7 +192,9 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
equipmentLists.stream().map(v -> (String) v.get("chargingMedium")).distinct().count() != 1) {
throw new BadRequest(CollectionUtils.isEmpty(equipmentLists) ? "请选择设备信息!" : "请选择相同充装介质设备!");
}
if (SUBMIT_TYPE_FLOW.equals(submit)) {
this.repeatUsedEquipCheck(equipmentLists, reginParams.getCompany().getCompanyCode());
}
List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = idxBizJgInspectionDetectionInfoService.checkInspectionInfo(
equipmentLists.stream()
.map(v -> (String) v.get("record"))
......@@ -394,6 +399,42 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
// 设备数据存历史数据,在流程完成时使用
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName(), JSON.parseArray(JSON.toJSONString(equipmentLists)), null, vehicleInformation.getSequenceNbr() + "");
return Collections.singletonList(vehicleInformation);
} 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();
}
}
private void repeatUsedEquipCheck(List<Map<String, Object>> equipList, String companyCode) {
equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(DEFINITION_KEY)
.equipRepeatUsedCheck(String.valueOf(equipMap.get("record")), companyCode));
}
/**
* 删除 redis校验重复引用设备的数据
*/
private void delRepeatUseEquipData(JgVehicleInformation notice) {
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()));
}
}
private void rollBackForDelRedisData() {
FlowingEquipRedisContext.getContext().forEach(e -> {
EquipUsedCheckStrategyContext.getUsedStrategy(DEFINITION_KEY)
.delDataForCheckWithKey(e.getData(), e.getRedisKey());
});
}
/**
......@@ -451,6 +492,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
// redis流程实时数据更新
commonService.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(vehicleInfo));
this.delRepeatUseEquipData(vehicleInfo);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
......@@ -535,7 +577,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
if (useCodeResult != null) {
String result = dto.getEstateUnitCreditCode() + "_" + dto.getEstateUnitName() + ("个人主体".equals(useCodeResult.getUnitType())
? "_" + dto.getEstateUnitCreditCode().substring(dto.getEstateUnitCreditCode().length() - 4): "");
? "_" + dto.getEstateUnitCreditCode().substring(dto.getEstateUnitCreditCode().length() - 4) : "");
vo.setEstateUnitName(result);
}
vo.setIdCardFront(ObjectUtils.isEmpty(dto.getIdCardFront()) ? null : JSON.parseArray(dto.getIdCardFront()));
......@@ -642,6 +684,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
WorkflowResultDto workflowResultDto = resultDto.get(0);
this.updateData(jgVehicleInformation.getSequenceNbr(), operate, workflowResultDto, Boolean.FALSE, equDefineCode);
}
this.delRepeatUseEquipData(jgVehicleInformation);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
......@@ -749,7 +792,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
JSONArray jsonArray = JSONArray.parseArray(jsonData);
// 登记证记录主键
Long changeRecordId= sequence.nextId();
Long changeRecordId = sequence.nextId();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject mapData = jsonArray.getJSONObject(i);
......@@ -816,10 +859,10 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoMapper.selectOne(lambdaReg);
// 生成证书管理表记录
generateRegistrationManage(jgVehicleInformation,registerInfo);
generateRegistrationManage(jgVehicleInformation, registerInfo);
// 生成一条tzs_jg_certificate_change_record记录
generateCertificateChangeRecord(jgVehicleInformation,registerInfo,changeRecordId,taskV2Model);
generateCertificateChangeRecord(jgVehicleInformation, registerInfo, changeRecordId, taskV2Model);
}
this.getBaseMapper().updateById(jgVehicleInformation);
commonService.saveExecuteFlowData2Redis(jgVehicleInformation.getInstanceId(), this.buildInstanceRuntimeData(jgVehicleInformation));
......@@ -880,14 +923,13 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
/**
* 批量删除
*
*/
@Transactional(rollbackFor = Exception.class)
public void deleteBatch(List<Long> ids) {
ids.forEach(id -> {
JgVehicleInformation vehicleInformation = this.baseMapper.selectById(id);
// 删除代办 + 中止流程
commonService.deleteTaskModel(String.valueOf(id),vehicleInformation.getInstanceId());
commonService.deleteTaskModel(String.valueOf(id), vehicleInformation.getInstanceId());
// 删除单子
this.deleteBySeq(id);
// 删除单子对应设备
......@@ -901,7 +943,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
public Page<Map<String, Object>> getPageList(JgVehicleInformationDto dto, String sort, Page<Map<String, Object>> page, List<String> roleIds) {
SortVo sortMap = commonService.sortFieldConversion(sort);
return this.baseMapper.getListPage(page,sortMap, dto, roleIds);
return this.baseMapper.getListPage(page, sortMap, dto, roleIds);
}
private void updateEquipMessage(JgVehicleInformation jgVehicleInformation, JSONObject map, IdxBizJgRegisterInfo registerInfo, IdxBizJgOtherInfo otherInfo) {
......@@ -1296,6 +1338,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
this.finishedTask(vehicleInformation);
// 2.终止流程-工作流报错暂时注释掉
cmWorkflowService.stopProcess(vehicleInformation.getInstanceId(), vehicleInformation.getCancelReason());
// 3.释放流程占用的设备
this.delRepeatUseEquipData(vehicleInformation);
}
}
......@@ -1342,6 +1386,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
/**
* 作废的证变更内容
*
* @param obj JgVehicleInformation
* @return result
*/
......@@ -1458,14 +1503,14 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
}
private void generateCertificateChangeRecord(JgVehicleInformation jgVehicleInformation, IdxBizJgRegisterInfo registerInfo, Long changeRecordId,TaskV2Model taskV2Model) {
private void generateCertificateChangeRecord(JgVehicleInformation jgVehicleInformation, IdxBizJgRegisterInfo registerInfo, Long changeRecordId, TaskV2Model taskV2Model) {
Map<String, String> equType = new HashMap<>();
equType.put("equList",this.baseMapper.getEquCategoryNameByCode(registerInfo.getEquList()));
equType.put("equListCode",registerInfo.getEquList());
equType.put("equCategory",this.baseMapper.getEquCategoryNameByCode(registerInfo.getEquCategory()));
equType.put("equCategoryCode",registerInfo.getEquCategory());
equType.put("equDefine",this.baseMapper.getEquCategoryNameByCode(registerInfo.getEquDefine()));
equType.put("equDefineCode",registerInfo.getEquDefine());
equType.put("equList", this.baseMapper.getEquCategoryNameByCode(registerInfo.getEquList()));
equType.put("equListCode", registerInfo.getEquList());
equType.put("equCategory", this.baseMapper.getEquCategoryNameByCode(registerInfo.getEquCategory()));
equType.put("equCategoryCode", registerInfo.getEquCategory());
equType.put("equDefine", this.baseMapper.getEquCategoryNameByCode(registerInfo.getEquDefine()));
equType.put("equDefineCode", registerInfo.getEquDefine());
JgCertificateChangeRecord changeRecord = new JgCertificateChangeRecord();
changeRecord.setApplyNo(jgVehicleInformation.getApplyNo());
changeRecord.setReceiveOrgName(jgVehicleInformation.getReceiveOrgName());
......@@ -1475,7 +1520,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
changeRecord.setChangeContent(this.buildRecordContent(jgVehicleInformation));//变更内容
changeRecord.setUseRegistrationCode(jgVehicleInformation.getUseRegistrationCode());//使用登记编号
changeRecord.setReceiveCompanyCode(jgVehicleInformation.getReceiveCompanyCode());//接收机构公司代码
changeRecord.setCertificateNo(commonService.generateCertificateNo(equType,new Date(),jgVehicleInformation.getReceiveCompanyCode()));//登记证书唯一码
changeRecord.setCertificateNo(commonService.generateCertificateNo(equType, new Date(), jgVehicleInformation.getReceiveCompanyCode()));//登记证书唯一码
changeRecord.setUseUnitCreditCode(jgVehicleInformation.getUseUnitCreditCode());//使用单位统一信用代码
changeRecord.setUseUnitName(jgVehicleInformation.getUseUnitName());//使用单位名称
changeRecord.setEquCategory(registerInfo.getEquCategory());//设备类别编码
......@@ -1485,17 +1530,17 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
certificateChangeRecordService.save(changeRecord);
}
private void generateRegistrationManage(JgVehicleInformation jgVehicleInformation,IdxBizJgRegisterInfo registerInfo) {
private void generateRegistrationManage(JgVehicleInformation jgVehicleInformation, IdxBizJgRegisterInfo registerInfo) {
// 使用单位信息
Map<String, Object> enterpriseInfo = commonService.getEnterpriseInfo(jgVehicleInformation.getUseUnitCreditCode());
//
Map<String, String> equType = new HashMap<>();
equType.put("equList",this.baseMapper.getEquCategoryNameByCode(registerInfo.getEquList()));
equType.put("equListCode",registerInfo.getEquList());
equType.put("equCategory",this.baseMapper.getEquCategoryNameByCode(registerInfo.getEquCategory()));
equType.put("equCategoryCode",registerInfo.getEquCategory());
equType.put("equDefine",this.baseMapper.getEquCategoryNameByCode(registerInfo.getEquDefine()));
equType.put("equDefineCode",registerInfo.getEquDefine());
equType.put("equList", this.baseMapper.getEquCategoryNameByCode(registerInfo.getEquList()));
equType.put("equListCode", registerInfo.getEquList());
equType.put("equCategory", this.baseMapper.getEquCategoryNameByCode(registerInfo.getEquCategory()));
equType.put("equCategoryCode", registerInfo.getEquCategory());
equType.put("equDefine", this.baseMapper.getEquCategoryNameByCode(registerInfo.getEquDefine()));
equType.put("equDefineCode", registerInfo.getEquDefine());
JgUseRegistrationManage jgUseRegistrationManage = new JgUseRegistrationManage();
jgUseRegistrationManage.setUseUnitName(jgVehicleInformation.getUseUnitName());
jgUseRegistrationManage.setApplyNo(jgVehicleInformation.getApplyNo());
......@@ -1523,14 +1568,14 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
jgUseRegistrationManage.setUseUnitCreditCode(jgVehicleInformation.getUseUnitCreditCode());
jgUseRegistrationManage.setReceiveCompanyCode(jgVehicleInformation.getReceiveCompanyCode());
jgUseRegistrationManage.setCarNumber(jgVehicleInformation.getCarNumber());
jgUseRegistrationManage.setCertificateNo(commonService.generateCertificateNo(equType,new Date(),jgVehicleInformation.getReceiveCompanyCode()));
jgUseRegistrationManage.setCertificateNo(commonService.generateCertificateNo(equType, new Date(), jgVehicleInformation.getReceiveCompanyCode()));
jgUseRegistrationManageService.save(jgUseRegistrationManage);
}
private String buildRecordContent(JgVehicleInformation obj) {
//张三办理了【单位变更】 ,单号【DWBG202407050001】,办理日期2024-07-05
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
return obj.getRecUserName() + "办理了【"+BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName()+"】," +
return obj.getRecUserName() + "办理了【" + BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName() + "】," +
"单号【" + obj.getApplyNo() + "】,申请日期" + simpleDateFormat.format(obj.getRecDate());
}
......@@ -1742,7 +1787,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
vehicleInformation.setAuditPassDate(new Date());
// 登记证记录表主键
Long changeRecordId= sequence.nextId();
Long changeRecordId = sequence.nextId();
//新增
if (StringUtils.isEmpty(vehicleInfoDto.getSequenceNbr())) {
ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.SYDJ.getCode(), 1);
......@@ -1761,7 +1806,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
lambdaReg.eq(IdxBizJgRegisterInfo::getRecord, String.valueOf(equipmentLists.get(0).get("record")));
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoMapper.selectOne(lambdaReg);
// 生成证书管理表记录
generateRegistrationManage(vehicleInformation,registerInfo);
generateRegistrationManage(vehicleInformation, registerInfo);
// 生成一条tzs_jg_certificate_change_record记录
generateCertificateChangeRecord(vehicleInformation, registerInfo, changeRecordId, null);
} else {
......@@ -1845,6 +1890,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
/**
* 系统类型的code 自动生成设备代码
*
* @param lambda lambda
* @param registerInfo 注册信息
* @param receiveCompanyCode 接收机构行政区划代码
......@@ -1893,7 +1939,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
this.createCode(jgVehicleInformation, registerInfo, otherInfo);
}
private void updateEquipEsData(JgVehicleInformation jgVehicleInformation, IdxBizJgOtherInfo otherInfo, IdxBizJgRegisterInfo registerInfo,String equId) {
private void updateEquipEsData(JgVehicleInformation jgVehicleInformation, IdxBizJgOtherInfo otherInfo, IdxBizJgRegisterInfo registerInfo, String equId) {
// 更新es
HashMap<String, Map<String, Object>> objMap = new HashMap<>();
HashMap<String, Object> param = new HashMap<>();
......
......@@ -326,7 +326,7 @@ public class DPSubServiceImpl {
mergedArray.stream().forEach(x -> {
Object fieldKey = JsonValueUtils.getValueByKey(x, "visualParams", "visualParams.fieldKey");
if (!ValidationUtil.isEmpty(fieldKey)) {
this.processWidgets(tab, datas, x, fieldKey.toString(), result, matinfo);
this.processWidgets(tab, datas, x, null, fieldKey.toString(), result, matinfo);
}
});
map.put("datas", datas);
......@@ -343,7 +343,8 @@ public class DPSubServiceImpl {
JSONObject subObj = new JSONObject();
subObj.put("key", "key" + i);
subObj.put("displayName", JsonValueUtils.getValueByKey(yObj, "visualParams", "visualParams.title"));
Object displayName = JsonValueUtils.getValueByKey(yObj, "visualParams", "visualParams.title");
subObj.put("displayName", displayName);
subObj.put("renderType", "basic");
subObj.put("columns", columnsArray.size());
......@@ -351,7 +352,7 @@ public class DPSubServiceImpl {
mergedArray.stream().forEach(x -> {
Object fieldKey = JsonValueUtils.getValueByKey(x, "visualParams", "visualParams.fieldKey");
if (!ValidationUtil.isEmpty(fieldKey)) {
this.processWidgets(tab, datas, x, fieldKey.toString(), JSONObject.parseObject(apiResult.toString()), matinfo);
this.processWidgets(tab, datas, x, displayName, fieldKey.toString(), JSONObject.parseObject(apiResult.toString()), matinfo);
subObj.put("datas", datas);
}
});
......@@ -368,7 +369,7 @@ public class DPSubServiceImpl {
* @param apiResult
* @return
*/
public JSONArray processWidgets(JSONObject tab, JSONArray datas, Object x, String fieldKey, JSONObject apiResult, JSONObject matinfo) {
public JSONArray processWidgets(JSONObject tab, JSONArray datas, Object x, Object displayName, String fieldKey, JSONObject apiResult, JSONObject matinfo) {
JSONObject jsonObject = new JSONObject();
JSONObject xObj = (JSONObject) x;
......@@ -380,10 +381,8 @@ public class DPSubServiceImpl {
JSONObject param = tab.getJSONObject("param");
jsonObject.put("type", "text");
jsonObject.put("value", value);
if (!ValidationUtil.isEmpty(paramFieldKeys)){
if (((JSONArray) paramFieldKeys).contains(fieldKey)){
if (!ValidationUtil.isEmpty(paramFieldKeys) && ((JSONArray) paramFieldKeys).contains(fieldKey)){
jsonObject.put("value", param.getString(fieldKey));
}
} else {
if ("upload".equals(xObj.getString("componentKey"))) {
jsonObject.put("type", "img");
......@@ -395,15 +394,17 @@ public class DPSubServiceImpl {
if (!ValidationUtil.isEmpty(value)) {
JSONObject attachmentUploadDatasObj = new JSONObject();
attachmentUploadDatasObj.put("value", value);
String accept = JsonValueUtils.getValueByKey(xObj, "visualParams", "visualParams.accept").toString();
if (accept.contains("doc") || accept.contains("docx") || accept.contains("pdf") || accept.contains("xls") || accept.contains("xlsx")) {
attachmentUploadDatasObj.put("label", "附件");
String accept = visualParams.getString("accept");
String label = visualParams.getString("label");
if (!ValidationUtil.isEmpty(displayName) && ("附件".equals(label) || "其他附件".equals(label))){
label = label + "(" + displayName + ")";
}
attachmentUploadDatasObj.put("label", label);
if (accept.equals(".*") || accept.contains("doc") || accept.contains("docx") || accept.contains("pdf") || accept.contains("xls") || accept.contains("xlsx")){
attachmentUploadDatasObj.put("type", "file");
} else if (accept.contains("png") || accept.contains("img")) {
attachmentUploadDatasObj.put("label", "证照");
} else if(accept.contains("png") || accept.contains("img")){
attachmentUploadDatasObj.put("type", "img");
} else if (accept.contains("mp4") || accept.contains("flv")) {
attachmentUploadDatasObj.put("label", "视频");
} else if(accept.contains("mp4") || accept.contains("flv")){
attachmentUploadDatasObj.put("type", "video");
}
attachmentUploadDatas.add(attachmentUploadDatasObj);
......@@ -430,7 +431,9 @@ public class DPSubServiceImpl {
}
}
}
if (!"attachmentUpload".equals(xObj.getString("componentKey"))){
datas.add(jsonObject);
}
return datas;
}
......
{
"name": "检验检测机构模板",
"name": "企业模板",
"tabs": [
{
"key": "basic",
......
......@@ -74,7 +74,7 @@
}
},
"visualParams": {
"rowKey": "key",
"rowKey": "sequenceNbr",
"columns": [
{"dataRenderingMode": "defaultText","dataIndex": "sourceType","width": 150,"align": "left","title": "问题主体类型","key": "58E0E2F7-4F34-4C01-9AD6-777CABC1672F"},
{"dataRenderingMode": "imageText","dataIndex": "problemType","width": 150,"align": "left","title": "问题类型","key": "8ACDE41E-CAE3-4A27-82EF-8F7452164A66","imageAttributeName": "problemTypePic"},
......
......@@ -74,7 +74,7 @@
}
},
"visualParams": {
"rowKey": "key",
"rowKey": "sequenceNbr",
"columns": [
{"dataRenderingMode": "defaultText","dataIndex": "sourceType","width": 150,"align": "left","title": "问题主体类型","key": "58E0E2F7-4F34-4C01-9AD6-777CABC1672F"},
{"dataRenderingMode": "imageText","dataIndex": "problemType","width": 150,"align": "left","title": "问题类型","key": "8ACDE41E-CAE3-4A27-82EF-8F7452164A66","imageAttributeName": "problemTypePic"},
......
......@@ -74,7 +74,7 @@
}
},
"visualParams": {
"rowKey": "key",
"rowKey": "sequenceNbr",
"columns": [
{"dataRenderingMode": "defaultText","dataIndex": "sourceType","width": 150,"align": "left","title": "问题主体类型","key": "58E0E2F7-4F34-4C01-9AD6-777CABC1672F"},
{"dataRenderingMode": "imageText","dataIndex": "problemType","width": 150,"align": "left","title": "问题类型","key": "8ACDE41E-CAE3-4A27-82EF-8F7452164A66","imageAttributeName": "problemTypePic"},
......
......@@ -74,7 +74,7 @@
}
},
"visualParams": {
"rowKey": "key",
"rowKey": "sequenceNbr",
"columns": [
{"dataRenderingMode": "defaultText","dataIndex": "sourceType","width": 150,"align": "left","title": "问题主体类型","key": "58E0E2F7-4F34-4C01-9AD6-777CABC1672F"},
{"dataRenderingMode": "imageText","dataIndex": "problemType","width": 150,"align": "left","title": "问题类型","key": "8ACDE41E-CAE3-4A27-82EF-8F7452164A66","imageAttributeName": "problemTypePic"},
......
......@@ -74,7 +74,7 @@
}
},
"visualParams": {
"rowKey": "key",
"rowKey": "sequenceNbr",
"columns": [
{"dataRenderingMode": "defaultText","dataIndex": "sourceType","width": 150,"align": "left","title": "问题主体类型","key": "58E0E2F7-4F34-4C01-9AD6-777CABC1672F"},
{"dataRenderingMode": "imageText","dataIndex": "problemType","width": 150,"align": "left","title": "问题类型","key": "8ACDE41E-CAE3-4A27-82EF-8F7452164A66","imageAttributeName": "problemTypePic"},
......
......@@ -74,7 +74,7 @@
}
},
"visualParams": {
"rowKey": "key",
"rowKey": "sequenceNbr",
"columns": [
{"dataRenderingMode": "defaultText","dataIndex": "sourceType","width": 150,"align": "left","title": "问题主体类型","key": "58E0E2F7-4F34-4C01-9AD6-777CABC1672F"},
{"dataRenderingMode": "imageText","dataIndex": "problemType","width": 150,"align": "left","title": "问题类型","key": "8ACDE41E-CAE3-4A27-82EF-8F7452164A66","imageAttributeName": "problemTypePic"},
......
......@@ -74,7 +74,7 @@
}
},
"visualParams": {
"rowKey": "key",
"rowKey": "sequenceNbr",
"columns": [
{"dataRenderingMode": "defaultText","dataIndex": "sourceType","width": 150,"align": "left","title": "问题主体类型","key": "58E0E2F7-4F34-4C01-9AD6-777CABC1672F"},
{"dataRenderingMode": "imageText","dataIndex": "problemType","width": 150,"align": "left","title": "问题类型","key": "8ACDE41E-CAE3-4A27-82EF-8F7452164A66","imageAttributeName": "problemTypePic"},
......
......@@ -74,7 +74,7 @@
}
},
"visualParams": {
"rowKey": "key",
"rowKey": "sequenceNbr",
"columns": [
{"dataRenderingMode": "defaultText","dataIndex": "sourceType","width": 150,"align": "left","title": "问题主体类型","key": "58E0E2F7-4F34-4C01-9AD6-777CABC1672F"},
{"dataRenderingMode": "imageText","dataIndex": "problemType","width": 150,"align": "left","title": "问题类型","key": "8ACDE41E-CAE3-4A27-82EF-8F7452164A66","imageAttributeName": "problemTypePic"},
......
......@@ -19,5 +19,5 @@ public interface EquipTechParamPipelineMapper extends BaseMapper<EquipTechParamP
* @param orgCode 区域code对应的管辖机构
* @return 数量
*/
String sumPipeLengthByOrgCode(String orgCode);
String sumPipeLengthByOrgCode(@Param("orgCode") String orgCode);
}
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