Commit 7cbce420 authored by 韩桐桐's avatar 韩桐桐

业务作废,设备回归未纳管问题处理,添加log

parent 42443e24
......@@ -2353,6 +2353,7 @@
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and a.is_delete = 0
and ( a.audit_status <![CDATA[ <> ]]> '已作废')
UNION
select
......@@ -2363,6 +2364,7 @@
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and a.is_delete = 0
and (a.audit_status <![CDATA[ <> ]]> '已作废')
UNION
select
......@@ -2373,6 +2375,7 @@
where
a.sequence_nbr = b.unit_change_registration_id
and b.equ_id = #{record}
and a.is_delete = 0
and (a.status <![CDATA[ <> ]]> '已作废')
UNION
select
......@@ -2383,6 +2386,7 @@
where
a.sequence_nbr = b.enable_disable_apply_id
and b.equ_id = #{record}
and a.is_delete = 0
and (a.audit_status <![CDATA[ <> ]]> '已作废')
UNION
select
......@@ -2393,6 +2397,7 @@
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and a.is_delete = 0
and (a.notice_status <![CDATA[ <> ]]> '6617')
UNION
select
......@@ -2403,6 +2408,7 @@
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and a.is_delete = 0
and (a.notice_status <![CDATA[ <> ]]> '6617')
UNION
select
......@@ -2413,6 +2419,7 @@
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and a.is_delete = 0
and (a.status <![CDATA[ <> ]]> '已作废')
UNION
select
......@@ -2423,6 +2430,7 @@
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and a.is_delete = 0
and (a.notice_status <![CDATA[ <> ]]> '6617')
UNION
select
......@@ -2433,6 +2441,7 @@
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and a.is_delete = 0
and (a.audit_status <![CDATA[ <> ]]> '已作废')
UNION
select
......@@ -2443,6 +2452,7 @@
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and a.is_delete = 0
and ( a.notice_status <![CDATA[ <> ]]> '6617')
UNION
select
......@@ -2453,6 +2463,7 @@
where
a.sequence_nbr = b.vehicle_id
and b.equ_id = #{record}
and a.is_delete = 0
and (a.status <![CDATA[ <> ]]> '已作废')
UNION
select
......@@ -2463,7 +2474,19 @@
where
a.sequence_nbr = b.unit_change_id
and b.equ_id = #{record}
and a.is_delete = 0
and (a.status <![CDATA[ <> ]]> '已作废')
UNION
select
count(1) as inUseNumber
from
tzs_jg_certificate_replenish a,
tzs_jg_certificate_replenish_eq b
where
a.sequence_nbr = b.certificate_replenish_id
and b.equ_id = #{record}
and a.is_delete = 0
and (a.apply_status <![CDATA[ <> ]]> '6617')
)
</select>
<update id="updateTechParamDynamic">
......
package com.yeejoin.amos.boot.module.jg.biz.event.listener;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.jg.biz.event.CancellationEvent;
......@@ -10,8 +9,6 @@ import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServ
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
......@@ -77,28 +74,33 @@ public class CancellationEventListener {
Boolean inUsed = commonService.checkEquipIsUsed(record);
// 无引用则进行修改纳管状态为未纳管
if (!inUsed) {
// 更新已纳管为未纳管 - 数据库
idxBizJgUseInfoService.lambdaUpdate()
.eq(IdxBizJgUseInfo::getRecord, record)
.set(IdxBizJgUseInfo::getIsIntoManagement, false)
.update();
log.info("进行设备作废处理:{}", record);
try {
// 更新已纳管为未纳管 - 数据库
idxBizJgUseInfoService.lambdaUpdate()
.eq(IdxBizJgUseInfo::getRecord, record)
.set(IdxBizJgUseInfo::getIsIntoManagement, false)
.update();
// 清除系统自动生成的设备代码`equCode`
boolean isRegisterUpdated = idxBizJgRegisterInfoService.lambdaUpdate()
.eq(IdxBizJgRegisterInfo::getRecord, record)
.eq(IdxBizJgRegisterInfo::getEquCodeType, "2")
.set(IdxBizJgRegisterInfo::getEquCode, null)
.update();
// 清除系统自动生成的设备代码`equCode`
boolean isRegisterUpdated = idxBizJgRegisterInfoService.lambdaUpdate()
.eq(IdxBizJgRegisterInfo::getRecord, record)
.eq(IdxBizJgRegisterInfo::getEquCodeType, "2")
.set(IdxBizJgRegisterInfo::getEquCode, null)
.update();
// 同步修改ES数据
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategoryDao.findById(record);
optional.ifPresent(esEquipmentCategoryDto -> {
esEquipmentCategoryDto.setIS_INTO_MANAGEMENT(false);
if (isRegisterUpdated) {
esEquipmentCategoryDto.setEQU_CODE(null);
}
esEquipmentCategoryDao.save(esEquipmentCategoryDto);
});
// 同步修改ES数据
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategoryDao.findById(record);
optional.ifPresent(esEquipmentCategoryDto -> {
esEquipmentCategoryDto.setIS_INTO_MANAGEMENT(false);
if (isRegisterUpdated) {
esEquipmentCategoryDto.setEQU_CODE(null);
}
esEquipmentCategoryDao.save(esEquipmentCategoryDto);
});
} catch (Exception e) {
log.error("设备作废异常:{}", e.getMessage());
}
}
}
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.event.publisher;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
......@@ -9,11 +10,12 @@ import org.springframework.stereotype.Component;
* @author Administrator
*/
@Component
public class EventPublisher {
public class EventPublisher implements ApplicationEventPublisherAware {
private ApplicationEventPublisher publisher;
public EventPublisher(ApplicationEventPublisher publisher) {
this.publisher = publisher;
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.publisher = applicationEventPublisher;
}
@Async
......
......@@ -95,6 +95,7 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.PostConstruct;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
......@@ -2153,6 +2154,7 @@ public class CommonServiceImpl implements ICommonService {
@Override
public Boolean checkEquipIsUsed(String record) {
Integer useTime = commonMapper.countEquipInUseTimesWithOutZF(record);
log.info("检查设备是否被使用,设备:{},业务数:{}", record, useTime);
return useTime > 0;
}
......
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