Commit 1584322f authored by suhuiguang's avatar suhuiguang

1.增加操作日志

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