From 21800c12d864abe7c14446e542ee196449e2f797 Mon Sep 17 00:00:00 2001 From: dengjun Date: Mon, 25 Dec 2023 13:53:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rtosc/query/ExportInCheckQuery.java | 8 ++-- .../rtosc/handler/DepartureHandler.java | 6 +++ .../rtosc/handler/ExportInHandler.java | 37 +++++++++++++++---- .../rtosc/handler/ExportLoadHandler.java | 6 +++ 4 files changed, 45 insertions(+), 12 deletions(-) diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInCheckQuery.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInCheckQuery.java index 23bc64a..50e004c 100644 --- a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInCheckQuery.java +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInCheckQuery.java @@ -47,22 +47,22 @@ public class ExportInCheckQuery extends BaseQuery { @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "开始申请时间") @DbQuery(field = "applyTime", symbol = SqlSymbol.GTE) - private Date beginApplyTime; + private Date beginEnterTime; @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "结束申请时间") @DbQuery(field = "applyTime", symbol = SqlSymbol.LTE) - private Date endApplyTime; + private Date endEnterTime; @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "开始进场时间") @DbQuery(field = "beginEnterTime", symbol = SqlSymbol.GTE) - private Date beginEnterTime; + private Date beginApplyTime; @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "结束进场时间") @DbQuery(field = "endEnterTime", symbol = SqlSymbol.LTE) - private Date endEnterTime; + private Date endApplyTime; @ApiModelProperty(value = "贸易类型") private String tradType; diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/DepartureHandler.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/DepartureHandler.java index 732902d..1de96df 100644 --- a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/DepartureHandler.java +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/DepartureHandler.java @@ -290,6 +290,12 @@ public class DepartureHandler implements BaseHandler { public Result submitCheckReverse(@RequestBody @NotNull(message = "请传入要审核的提离港区ID") @Size(min = 1, message = "ID列表不能为空") List ids) { + // 是否除提交审核的其它状态 + Long count = departureService.lambdaQuery().in(CustomerDeparture::getId, ids).ne(CustomerDeparture::getCheckStatus, AuditEnum.AUDIT).count(); + if (count > 0) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "有非待审核状态数据,不能撤销"); + } + departureService.lambdaUpdate().set(CustomerDeparture::getCheckStatus, AuditEnum.SUBMIT) .set(CustomerDeparture::getCheckResult, null).in(CustomerDeparture::getId, ids).update(); return ResultUtil.success("success"); diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportInHandler.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportInHandler.java index 9f9535e..4fdf4c9 100644 --- a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportInHandler.java +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportInHandler.java @@ -311,28 +311,44 @@ public class ExportInHandler implements BaseHandler { // if (query.getCheckStatus() == null) { // query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); // } -// String vin = query.getVin(); -// if (StringUtils.isNotEmpty(vin)) { -// query.setVin(null); -// } + String vin = query.getVin(); + if (StringUtils.isNotEmpty(vin)) { + query.setVin(null); + } - query.setBillNum(null); +// query.setBillNum(null); query.setCheckStatus(AuditEnum.AUDIT_PASS); + // 条件过滤查询 QueryWrapper queryWrapper = (QueryWrapper) new WrapperKit() { }.changeBaseQueryToWrapper(CustomerExportIn.class, query); queryWrapper.select("sum(quantity) as quantity, port_area_id, ship_id, voyage_id, max(update_date) as update_date"); queryWrapper.groupBy("port_area_id, ship_id, voyage_id"); -// if (StringUtils.isNotEmpty(vin)) { -// queryWrapper.exists("select id from customer_export_in_cargo where customer_export_in_cargo.export_in_id=customer_export_in.id and customer_export_in_cargo.vin={0}", vin); -// } + if (StringUtils.isNotEmpty(vin)) { + queryWrapper.exists("select id from customer_export_in_cargo where customer_export_in_cargo.export_in_id=customer_export_in.id and customer_export_in_cargo.vin={0}", vin); + } Page page = customerExportInService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); customerService.wrapperEntity(page.getRecords()); + + // 总量查询 + if (CollectionUtils.isNotEmpty(page.getRecords())) { + QueryWrapper q = new QueryWrapper<>(); + q.in("voyage_id", page.getRecords().stream().map(item -> item.getVoyageId()).collect(Collectors.toList())); + q.select("sum(quantity) as quantity, port_area_id, ship_id, voyage_id"); + q.groupBy("port_area_id, ship_id, voyage_id"); + + List list = customerExportInService.list(q); + Map map = list.stream().collect(Collectors.toMap(item -> StringUtils.joinWith("@", item.getPortAreaId(), item.getShipId(), item.getVoyageId()), item -> item.getQuantity())); + page.getRecords().stream().forEach(item -> { + item.setQuantity(map.get(StringUtils.joinWith("@", item.getPortAreaId(), item.getShipId(), item.getVoyageId()))); + }); + + } return ResultUtil.success(page); } @@ -683,6 +699,11 @@ public class ExportInHandler implements BaseHandler { public Result submitCheckReverse(@RequestBody @NotNull(message = "请传入要审核的出口进场ID") @Size(min = 1, message = "ID列表不能为空") List ids) { + // 是否除提交审核的其它状态 + Long count = customerExportInService.lambdaQuery().in(CustomerExportIn::getId, ids).ne(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT).count(); + if (count > 0) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "有非待审核状态数据,不能撤销"); + } customerExportInService.lambdaUpdate().set(CustomerExportIn::getCheckStatus, AuditEnum.SUBMIT) .set(CustomerExportIn::getCheckResult, null) .in(CustomerExportIn::getId, ids).update(); diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportLoadHandler.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportLoadHandler.java index 3016c14..ed9643a 100644 --- a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportLoadHandler.java +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportLoadHandler.java @@ -414,6 +414,12 @@ public class ExportLoadHandler implements BaseHandler { public Result submitCheckReverse(@RequestBody @NotNull(message = "请传入要审核的出口装船ID") @Size(min = 1, message = "ID列表不能为空") List ids) { + // 是否除提交审核的其它状态 + Long count = customerExportLoadService.lambdaQuery().in(CustomerExportLoad::getId, ids).ne(CustomerExportLoad::getCheckStatus, AuditEnum.AUDIT).count(); + if (count > 0) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "有非待审核状态数据,不能撤销"); + } + customerExportLoadService.lambdaUpdate().set(CustomerExportLoad::getCheckStatus, AuditEnum.SUBMIT) .set(CustomerExportLoad::getCheckResult, null).in(CustomerExportLoad::getId, ids).update(); return ResultUtil.success("success");