Commit 1584322f authored by suhuiguang's avatar suhuiguang

1.增加操作日志

2.修改bug设备的删除控制没判定单据的作废状态
parent 01821f11
...@@ -26,7 +26,7 @@ public class OperateLogRestEventHandler extends RestEventHandler { ...@@ -26,7 +26,7 @@ public class OperateLogRestEventHandler extends RestEventHandler {
@Value("${spring.application.name}") @Value("${spring.application.name}")
private String applicationName; private String applicationName;
private ESUserOperateLogDao esUserOperateLogDao; private final ESUserOperateLogDao esUserOperateLogDao;
public OperateLogRestEventHandler(ESUserOperateLogDao esUserOperateLogDao) { public OperateLogRestEventHandler(ESUserOperateLogDao esUserOperateLogDao) {
this.esUserOperateLogDao = esUserOperateLogDao; this.esUserOperateLogDao = esUserOperateLogDao;
......
...@@ -59,13 +59,6 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> { ...@@ -59,13 +59,6 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
/** /**
* 统计设备被引用的次数(只有存在就算引用)
* @param record 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除
*/
Integer countEquipInUseTimesForDel(String record);
/**
* 统计设备被引用的次数(只有存在就算引用-作废除外) * 统计设备被引用的次数(只有存在就算引用-作废除外)
* @param record 设备唯一标识 * @param record 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除 * @return 被引用次数 > 0 则设备不可删除
......
...@@ -281,109 +281,6 @@ ...@@ -281,109 +281,6 @@
and (a.status <![CDATA[ <> ]]> '使用单位待提交' and a.status <![CDATA[ <> ]]> '一级受理已驳回' and a.status <![CDATA[ <> ]]> '使用单位已撤回' and a.status <![CDATA[ <> ]]> '已作废') and (a.status <![CDATA[ <> ]]> '使用单位待提交' and a.status <![CDATA[ <> ]]> '一级受理已驳回' and a.status <![CDATA[ <> ]]> '使用单位已撤回' and a.status <![CDATA[ <> ]]> '已作废')
) )
</select> </select>
<select id="countEquipInUseTimesForDel" resultType="java.lang.Integer">
select
sum(inUseNumber)
from (
select
count(1) as inUseNumber
from
tzs_jg_use_registration_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_change_registration_reform_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_change_registration_transfer_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_change_registration_unit_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_enable_disable_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_equip_transfer_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_installation_notice_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_maintain_notice_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_maintenance_contract_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_reform_notice_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_scrap_cancel_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_transfer_notice_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_vehicle_information_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_change_vehicle_registration_unit_eq b
where
b.equ_id = #{record}
)
</select>
<select id="refreshTheDetailsDataOfCompletedUsageRegistration" resultType="java.lang.String"> <select id="refreshTheDetailsDataOfCompletedUsageRegistration" resultType="java.lang.String">
SELECT sequence_nbr SELECT sequence_nbr
...@@ -2282,6 +2179,7 @@ ...@@ -2282,6 +2179,7 @@
a.sequence_nbr = b.equip_transfer_id a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record} and b.equ_id = #{record}
and ( a.status <![CDATA[ <> ]]> '已作废') and ( a.status <![CDATA[ <> ]]> '已作废')
and a.is_delete = false
UNION UNION
select select
count(1) as inUseNumber count(1) as inUseNumber
......
...@@ -13,6 +13,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -13,6 +13,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...@@ -166,7 +167,8 @@ public class JgChangeVehicleRegistrationUnitController extends BaseController { ...@@ -166,7 +167,8 @@ public class JgChangeVehicleRegistrationUnitController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/withdraw") @PostMapping(value = "/withdraw")
@ApiOperation(httpMethod = "POST", value = "撤回", notes = "撤回") @ApiOperation(httpMethod = "POST", value = "车用气瓶单位变更登记撤回", notes = "撤回")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Object> withdraw(@RequestBody JSONObject map) { public ResponseModel<Object> withdraw(@RequestBody JSONObject map) {
jgChangeVehicleRegistrationUnitServiceImpl.withdraw(String.valueOf(map.get("instanceId")), String.valueOf(map.get("nextTaskId"))); jgChangeVehicleRegistrationUnitServiceImpl.withdraw(String.valueOf(map.get("instanceId")), String.valueOf(map.get("nextTaskId")));
return ResponseHelper.buildResponse("ok"); return ResponseHelper.buildResponse("ok");
...@@ -174,14 +176,16 @@ public class JgChangeVehicleRegistrationUnitController extends BaseController { ...@@ -174,14 +176,16 @@ public class JgChangeVehicleRegistrationUnitController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/delete") @DeleteMapping(value = "/delete")
@ApiOperation(httpMethod = "DELETE", value = "删除", notes = "删除") @ApiOperation(httpMethod = "DELETE", value = "车用气瓶单位变更删除", notes = "删除")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Object> withdraw(@RequestParam(value = "sequenceNbr") String sequenceNbr) { public ResponseModel<Object> withdraw(@RequestParam(value = "sequenceNbr") String sequenceNbr) {
jgChangeVehicleRegistrationUnitServiceImpl.deleteMessage(sequenceNbr); jgChangeVehicleRegistrationUnitServiceImpl.deleteMessage(sequenceNbr);
return ResponseHelper.buildResponse("ok"); return ResponseHelper.buildResponse("ok");
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/flowExecute") @PostMapping(value = "/flowExecute")
@ApiOperation(httpMethod = "POST", value = "执行流程", notes = "执行流程") @ApiOperation(httpMethod = "POST", value = "车用气瓶单位变更执行流程", notes = "执行流程")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Object> flowExecute(@RequestBody JSONObject map) { public ResponseModel<Object> flowExecute(@RequestBody JSONObject map) {
jgChangeVehicleRegistrationUnitServiceImpl.flowExecute(Long.valueOf(String.valueOf(map.get("sequenceNbr"))), jgChangeVehicleRegistrationUnitServiceImpl.flowExecute(Long.valueOf(String.valueOf(map.get("sequenceNbr"))),
String.valueOf(map.get("instanceId")), String.valueOf(map.get("instanceId")),
......
...@@ -156,6 +156,7 @@ public class JgInstallationNoticeController extends BaseController { ...@@ -156,6 +156,7 @@ public class JgInstallationNoticeController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "安装告知单个作废", notes = "安装告知单个作废") @ApiOperation(httpMethod = "PUT", value = "安装告知单个作废", notes = "安装告知单个作废")
@PutMapping(value = "/cancel/application") @PutMapping(value = "/cancel/application")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<JgInstallationNotice> cancelApplication(@RequestBody JgInstallationNoticeDto jgInstallationNoticeDto) { public ResponseModel<JgInstallationNotice> cancelApplication(@RequestBody JgInstallationNoticeDto jgInstallationNoticeDto) {
JgInstallationNotice result = iJgInstallationNoticeService.cancelApplication(jgInstallationNoticeDto.getSequenceNbr(), jgInstallationNoticeDto.getCancelReason()); JgInstallationNotice result = iJgInstallationNoticeService.cancelApplication(jgInstallationNoticeDto.getSequenceNbr(), jgInstallationNoticeDto.getCancelReason());
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
......
...@@ -16,6 +16,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -16,6 +16,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...@@ -49,6 +50,7 @@ public class JgMaintenanceContractController extends BaseController { ...@@ -49,6 +50,7 @@ public class JgMaintenanceContractController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/saveOrSubmit") @PostMapping(value = "/saveOrSubmit")
@ApiOperation(httpMethod = "POST", value = "新增维保合同备案", notes = "新增维保合同备案") @ApiOperation(httpMethod = "POST", value = "新增维保合同备案", notes = "新增维保合同备案")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Object> save(@RequestBody Map<String, Object> model, public ResponseModel<Object> save(@RequestBody Map<String, Object> model,
@RequestParam(value = "submit") String submit) { @RequestParam(value = "submit") String submit) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
...@@ -64,6 +66,7 @@ public class JgMaintenanceContractController extends BaseController { ...@@ -64,6 +66,7 @@ public class JgMaintenanceContractController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/revocation") @PostMapping(value = "/revocation")
@ApiOperation(httpMethod = "POST", value = "维保合同撤回", notes = "维保合同撤回") @ApiOperation(httpMethod = "POST", value = "维保合同撤回", notes = "维保合同撤回")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Object> revocation(@RequestBody JSONObject map) { public ResponseModel<Object> revocation(@RequestBody JSONObject map) {
jgMaintenanceContractServiceImpl.revocation(String.valueOf(map.get("instanceId")), String.valueOf(map.get("nextTaskId"))); jgMaintenanceContractServiceImpl.revocation(String.valueOf(map.get("instanceId")), String.valueOf(map.get("nextTaskId")));
return ResponseHelper.buildResponse("ok"); return ResponseHelper.buildResponse("ok");
...@@ -110,7 +113,8 @@ public class JgMaintenanceContractController extends BaseController { ...@@ -110,7 +113,8 @@ public class JgMaintenanceContractController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/flowExecute") @PostMapping(value = "/flowExecute")
@ApiOperation(httpMethod = "POST", value = "执行流程", notes = "执行流程") @ApiOperation(httpMethod = "POST", value = "维保备案执行流程", notes = "执行流程")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Object> flowExecute(@RequestBody JSONObject map) { public ResponseModel<Object> flowExecute(@RequestBody JSONObject map) {
jgMaintenanceContractServiceImpl.flowExecute(Long.valueOf(String.valueOf(map.get("sequenceNbr"))), jgMaintenanceContractServiceImpl.flowExecute(Long.valueOf(String.valueOf(map.get("sequenceNbr"))),
String.valueOf(map.get("instanceId")), String.valueOf(map.get("instanceId")),
...@@ -175,6 +179,7 @@ public class JgMaintenanceContractController extends BaseController { ...@@ -175,6 +179,7 @@ public class JgMaintenanceContractController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/cancelApplication") @PostMapping(value = "/cancelApplication")
@ApiOperation(httpMethod = "POST", value = "维保备案作废", notes = "维保备案作废") @ApiOperation(httpMethod = "POST", value = "维保备案作废", notes = "维保备案作废")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<JgMaintenanceContract> cancelApplication(@RequestBody JgMaintenanceContractDto dto) { public ResponseModel<JgMaintenanceContract> cancelApplication(@RequestBody JgMaintenanceContractDto dto) {
JgMaintenanceContract result = jgMaintenanceContractServiceImpl.cancelApplication(dto.getSequenceNbr(), dto.getCancelReason()); JgMaintenanceContract result = jgMaintenanceContractServiceImpl.cancelApplication(dto.getSequenceNbr(), dto.getCancelReason());
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
......
...@@ -44,7 +44,7 @@ public class JgUseRegistrationController extends BaseController { ...@@ -44,7 +44,7 @@ public class JgUseRegistrationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增") @ApiOperation(httpMethod = "POST", value = "使用登记新增", notes = "新增")
@RestEventTrigger(value = "operateLogRestEventHandler") @RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Object> save(@RequestBody JSONObject map) { public ResponseModel<Object> save(@RequestBody JSONObject map) {
return ResponseHelper.buildResponse(jgUseRegistrationServiceImpl.save(map)); return ResponseHelper.buildResponse(jgUseRegistrationServiceImpl.save(map));
...@@ -52,7 +52,7 @@ public class JgUseRegistrationController extends BaseController { ...@@ -52,7 +52,7 @@ public class JgUseRegistrationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/flowExecute") @PostMapping(value = "/flowExecute")
@ApiOperation(httpMethod = "POST", value = "执行流程", notes = "执行流程") @ApiOperation(httpMethod = "POST", value = "使用登记执行流程", notes = "执行流程")
@RestEventTrigger(value = "operateLogRestEventHandler") @RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Object> flowExecute(@RequestBody JSONObject map) { public ResponseModel<Object> flowExecute(@RequestBody JSONObject map) {
jgUseRegistrationServiceImpl.flowExecute(Long.valueOf(String.valueOf(map.get("sequenceNbr"))), jgUseRegistrationServiceImpl.flowExecute(Long.valueOf(String.valueOf(map.get("sequenceNbr"))),
...@@ -68,7 +68,7 @@ public class JgUseRegistrationController extends BaseController { ...@@ -68,7 +68,7 @@ public class JgUseRegistrationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/withdraw") @PostMapping(value = "/withdraw")
@ApiOperation(httpMethod = "POST", value = "撤回", notes = "撤回") @ApiOperation(httpMethod = "POST", value = "使用登记撤回", notes = "撤回")
@RestEventTrigger(value = "operateLogRestEventHandler") @RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Object> withdraw(@RequestBody JSONObject map) { public ResponseModel<Object> withdraw(@RequestBody JSONObject map) {
jgUseRegistrationServiceImpl.withdraw(String.valueOf(map.get("instanceId")), String.valueOf(map.get("nextTaskId")), jgUseRegistrationServiceImpl.withdraw(String.valueOf(map.get("instanceId")), String.valueOf(map.get("nextTaskId")),
......
...@@ -13,6 +13,7 @@ import java.util.Arrays; ...@@ -13,6 +13,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgVehicleInformationServiceImpl; import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgVehicleInformationServiceImpl;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -57,7 +58,8 @@ public class JgVehicleInformationController extends BaseController { ...@@ -57,7 +58,8 @@ public class JgVehicleInformationController extends BaseController {
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/flowExecute") @PostMapping(value = "/flowExecute")
@ApiOperation(httpMethod = "POST", value = "执行流程", notes = "执行流程") @ApiOperation(httpMethod = "POST", value = "车用气瓶登记执行流程", notes = "执行流程")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Object> flowExecute(@RequestBody JSONObject map) { public ResponseModel<Object> flowExecute(@RequestBody JSONObject map) {
jgVehicleInformationServiceImpl.flowExecute(Long.valueOf(String.valueOf(map.get("sequenceNbr"))), jgVehicleInformationServiceImpl.flowExecute(Long.valueOf(String.valueOf(map.get("sequenceNbr"))),
String.valueOf(map.get("instanceId")), String.valueOf(map.get("instanceId")),
...@@ -76,6 +78,7 @@ public class JgVehicleInformationController extends BaseController { ...@@ -76,6 +78,7 @@ public class JgVehicleInformationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/cancel") @PostMapping(value = "/cancel")
@ApiOperation(httpMethod = "POST", value = "车用气瓶撤回", notes = "车用气瓶撤回") @ApiOperation(httpMethod = "POST", value = "车用气瓶撤回", notes = "车用气瓶撤回")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Object> cancel(@RequestBody JSONObject map) { public ResponseModel<Object> cancel(@RequestBody JSONObject map) {
jgVehicleInformationServiceImpl.cancel(String.valueOf(map.get("instanceId")), String.valueOf(map.get("nextTaskId"))); jgVehicleInformationServiceImpl.cancel(String.valueOf(map.get("instanceId")), String.valueOf(map.get("nextTaskId")));
return ResponseHelper.buildResponse("ok"); return ResponseHelper.buildResponse("ok");
...@@ -202,6 +205,7 @@ public class JgVehicleInformationController extends BaseController { ...@@ -202,6 +205,7 @@ public class JgVehicleInformationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "车用气瓶使用登记单条作废", notes = "车用气瓶使用登记单条作废") @ApiOperation(httpMethod = "PUT", value = "车用气瓶使用登记单条作废", notes = "车用气瓶使用登记单条作废")
@PutMapping(value = "/cancel/application") @PutMapping(value = "/cancel/application")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<JgVehicleInformation> cancelApplication(@RequestBody JgVehicleInformationDto vehicleInformationDto) { public ResponseModel<JgVehicleInformation> cancelApplication(@RequestBody JgVehicleInformationDto vehicleInformationDto) {
JgVehicleInformation result = jgVehicleInformationServiceImpl.cancelApplication(vehicleInformationDto.getSequenceNbr(), vehicleInformationDto.getCancelReason()); JgVehicleInformation result = jgVehicleInformationServiceImpl.cancelApplication(vehicleInformationDto.getSequenceNbr(), vehicleInformationDto.getCancelReason());
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
......
...@@ -4,8 +4,8 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,8 +4,8 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; 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.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto; import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.biz.event.CancellationEvent; import com.yeejoin.amos.boot.module.jg.biz.event.CancellationEvent;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -31,7 +31,7 @@ public class CancellationEventListener { ...@@ -31,7 +31,7 @@ public class CancellationEventListener {
@Value("${cancellation.deal.thread.number:1}") @Value("${cancellation.deal.thread.number:1}")
private int threadNumber; private int threadNumber;
private CommonMapper commonMapper; private ICommonService commonService;
private ESEquipmentCategory esEquipmentCategoryDao; private ESEquipmentCategory esEquipmentCategoryDao;
...@@ -39,8 +39,8 @@ public class CancellationEventListener { ...@@ -39,8 +39,8 @@ public class CancellationEventListener {
private BlockingQueue<String> queue = new LinkedBlockingQueue<>(); private BlockingQueue<String> queue = new LinkedBlockingQueue<>();
public CancellationEventListener(CommonMapper commonMapper, ESEquipmentCategory esEquipmentCategoryDao, IdxBizJgUseInfoMapper idxBizJgUseInfoMapper) { public CancellationEventListener(ICommonService commonService, ESEquipmentCategory esEquipmentCategoryDao, IdxBizJgUseInfoMapper idxBizJgUseInfoMapper) {
this.commonMapper = commonMapper; this.commonService = commonService;
this.esEquipmentCategoryDao = esEquipmentCategoryDao; this.esEquipmentCategoryDao = esEquipmentCategoryDao;
this.idxBizJgUseInfoMapper = idxBizJgUseInfoMapper; this.idxBizJgUseInfoMapper = idxBizJgUseInfoMapper;
} }
...@@ -52,11 +52,6 @@ public class CancellationEventListener { ...@@ -52,11 +52,6 @@ public class CancellationEventListener {
queue.addAll(records); queue.addAll(records);
} }
private Boolean checkEquipIsUsed(String record) {
Integer useTime = commonMapper.countEquipInUseTimesWithOutZF(record);
return useTime > 0;
}
@PostConstruct @PostConstruct
public void init() { public void init() {
ExecutorService executorService = Executors.newFixedThreadPool(threadNumber); ExecutorService executorService = Executors.newFixedThreadPool(threadNumber);
...@@ -76,8 +71,8 @@ public class CancellationEventListener { ...@@ -76,8 +71,8 @@ public class CancellationEventListener {
} }
private void dealData(String record) { private void dealData(String record) {
// 所有业务单据(除去作废状态单据),有在引用设备的则不修改设备纳管状态 // 所有业务单据(除去作废、删除状态单据),有在引用设备的则不修改设备纳管状态
Boolean inUsed = this.checkEquipIsUsed(record); Boolean inUsed = commonService.checkEquipIsUsed(record);
// 无引用则进行修改纳管状态为未纳管 // 无引用则进行修改纳管状态为未纳管
if (!inUsed) { if (!inUsed) {
// 更新已纳管为未纳管-数据库 // 更新已纳管为未纳管-数据库
......
...@@ -171,12 +171,12 @@ public interface ICommonService { ...@@ -171,12 +171,12 @@ public interface ICommonService {
/** /**
* 统计设备被引用的次数(只有存在就算引用 * 统计设备是否被引用(只有存在就算引用,作废及删除的单据除外
* *
* @param record 设备唯一标识 * @param record 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除 * @return 被引用次数
*/ */
Integer countEquipInUseTimesForDel(String record); Boolean checkEquipIsUsed(String record);
/** /**
* 设备分类 * 设备分类
......
...@@ -1933,8 +1933,9 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1933,8 +1933,9 @@ public class CommonServiceImpl implements ICommonService {
} }
@Override @Override
public Integer countEquipInUseTimesForDel(String record) { public Boolean checkEquipIsUsed(String record) {
return commonMapper.countEquipInUseTimesForDel(record); Integer useTime = commonMapper.countEquipInUseTimesWithOutZF(record);
return useTime > 0;
} }
/** /**
......
...@@ -532,8 +532,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -532,8 +532,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private void checkForDelete(List<String> records) { private void checkForDelete(List<String> records) {
for (String record : records) { for (String record : records) {
Integer useTime = commonService.countEquipInUseTimesForDel(record); Boolean isUsed = commonService.checkEquipIsUsed(record);
if (useTime > 0) { if (isUsed) {
String msg = getTipMsgString(record); String msg = getTipMsgString(record);
throw new BadRequest(msg); throw new BadRequest(msg);
} }
...@@ -542,8 +542,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -542,8 +542,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
private Boolean checkEquipIsCanDelete(String record) { private Boolean checkEquipIsCanDelete(String record) {
Integer useTime = commonService.countEquipInUseTimesForDel(record); // 无使用(已作废也算未使用)则可删除
return useTime <= 0; return !commonService.checkEquipIsUsed(record);
} }
private String getTipMsgString(String record) { private String getTipMsgString(String record) {
......
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