Commit b008bb61 authored by chenzhao's avatar chenzhao

修改报检申请删除接口

parent 20a52dcf
...@@ -11,6 +11,6 @@ import java.util.List; ...@@ -11,6 +11,6 @@ import java.util.List;
* @date 2023-12-14 * @date 2023-12-14
*/ */
public interface IJyjcInspectionApplicationService { public interface IJyjcInspectionApplicationService {
void deleteBatchData(List<Long> sequenceNbr); Boolean deleteBatchData(List<Long> sequenceNbr);
} }
...@@ -94,12 +94,9 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -94,12 +94,9 @@ public class JyjcInspectionApplicationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/deleteBatch") @DeleteMapping(value = "/deleteBatch")
@ApiOperation(httpMethod = "DELETE", value = "批量删除", notes = "批量删除") @ApiOperation(httpMethod = "DELETE", value = "批量删除", notes = "批量删除")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, List<Long>sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @RequestParam List<Long>sequenceNbr){
jyjcInspectionApplicationServiceImpl.deleteBatchData(sequenceNbr); return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.deleteBatchData(sequenceNbr));
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.deleteBatchSeq(sequenceNbr));
} }
/** /**
......
...@@ -148,6 +148,8 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -148,6 +148,8 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
model.setPromoter(reginParams.getUserModel().getUserId()); model.setPromoter(reginParams.getUserModel().getUserId());
jyjcInspectionApplicationEquipService.getBaseMapper().deleteByApplicationSeq(model.getSequenceNbr());
List<JyjcInspectionApplicationEquip> equipInfos = new ArrayList<>(); List<JyjcInspectionApplicationEquip> equipInfos = new ArrayList<>();
if (null != model.getEquip() && model.getEquip().size() > 0) { if (null != model.getEquip() && model.getEquip().size() > 0) {
List<JyjcInspectionApplicationEquipDto> equips = JSONObject.parseArray(JSON.toJSONString(model.getEquip()), JyjcInspectionApplicationEquipDto.class); List<JyjcInspectionApplicationEquipDto> equips = JSONObject.parseArray(JSON.toJSONString(model.getEquip()), JyjcInspectionApplicationEquipDto.class);
...@@ -172,7 +174,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -172,7 +174,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
} }
jyjcInspectionApplicationEquipService.getBaseMapper().deleteByApplicationSeq(model.getSequenceNbr());
//保存报检装备监管码 //保存报检装备监管码
for (JyjcInspectionApplicationEquip equipInfo : equipInfos) { for (JyjcInspectionApplicationEquip equipInfo : equipInfos) {
equipInfo.setApplicationSeq(model.getSequenceNbr()); equipInfo.setApplicationSeq(model.getSequenceNbr());
...@@ -252,13 +254,16 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -252,13 +254,16 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
} }
public void deleteBatchData(List<Long> sequenceNbr) { public Boolean deleteBatchData(List<Long> sequenceNbr) {
List<JyjcInspectionApplication> jyjcInspectionApplications = this.getBaseMapper().selectBatchIds(sequenceNbr); List<JyjcInspectionApplication> jyjcInspectionApplications = this.getBaseMapper().selectBatchIds(sequenceNbr);
long count = jyjcInspectionApplications.stream().filter(e -> !e.getStatus().equals("已撤销") && !e.getStatus().equals("已撤回")).count(); long count = jyjcInspectionApplications.stream().filter(e ->
e.getStatus().equals(FlowStatusEnum.TO_BE_FINISHED.getCode())
|| e.getStatus().equals(FlowStatusEnum.TO_SUBMITTED.getCode())
).count();
if (count > 0) { if (count > 0) {
throw new BadRequest("存在 非已撤销、已退回状态的报检单 不可删除!"); throw new BadRequest("存在 已完成、待受理状态的报检单 不可删除!");
} }
...@@ -268,7 +273,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -268,7 +273,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
jyjcInspectionApplicationAttachmentService.getBaseMapper().deleteByApplicationSeq(seq); jyjcInspectionApplicationAttachmentService.getBaseMapper().deleteByApplicationSeq(seq);
jyjcInspectionApplicationPushLogService.getBaseMapper().deleteByApplicationSeq(seq); jyjcInspectionApplicationPushLogService.getBaseMapper().deleteByApplicationSeq(seq);
} }
return true;
} }
......
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