diff --git a/.gitignore b/.gitignore index 6797ac6..f4f2415 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /.idea/ /logs/ /nuzar-customer-repository/nuzar-customer-repository.iml +/nuzar-customer-proxy/nuzar-customer-proxy.iml diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureCargoVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureCargoVo.java index 0bf64be..d7b7d83 100644 --- a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureCargoVo.java +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureCargoVo.java @@ -24,7 +24,7 @@ public class DepartureCargoVo implements Serializable { /** * 提单号 */ - @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "提单号不能为空") +// @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "提单号不能为空") @ApiModelProperty(value = "提单号", required = true) private String billNo; @@ -45,8 +45,8 @@ public class DepartureCargoVo implements Serializable { /** * 货物类型 */ - @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "货物类型不能为空") - @ApiModelProperty(value = "货物类型", required = true) +// @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车型不能为空") + @ApiModelProperty(value = "车型", required = true) private String cargoType; /** @@ -71,6 +71,8 @@ public class DepartureCargoVo implements Serializable { @ApiModelProperty(value = "是否退关", required = true) private Integer isShutout; + @ApiModelProperty(value = "车辆状态") + private String vinStatus; @ApiModelProperty(value = "版本号") private Integer version; diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureVo.java index e4a32fa..c50b044 100644 --- a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureVo.java +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureVo.java @@ -84,7 +84,7 @@ public class DepartureVo implements Serializable { * 贸易类型 */ @ApiModelProperty(value = "贸易类型", required = true) - @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "贸易类型不能为空") +// @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "贸易类型不能为空") private String tradType; /** diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInVo.java index 18f187a..f196a90 100644 --- a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInVo.java +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInVo.java @@ -329,8 +329,8 @@ public class ExportInVo implements Serializable { /** * 是否是二手车 */ - @ApiModelProperty(value = "是否是二手车,1是二手车,0不是二手车") - private Integer secondHand; + @ApiModelProperty(value = "是否是二手车") + private String secondHand; /** * 备注 diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportInPlanExcel.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportInPlanExcel.java index f9a34f3..38527d6 100644 --- a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportInPlanExcel.java +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportInPlanExcel.java @@ -94,19 +94,25 @@ public class ExportInPlanExcel { @NotBlank(message = "运输方式不能为空") private String transportWay; + @ExcelProperty("*进场开始日期") + @NotBlank(message = "进场开始日期不能为空") + private String beginEnterTime; + + @ExcelProperty("*进场结束日期") + @NotBlank(message = "进场结束日期不能为空") + private String endEnterTime; + /** * 进场时间 */ // @DateTimeFormat("yyyy-MM-dd HH:mm") @ExcelProperty("进场时间") - @NotNull(message = "进场时间不能为空") private String enterTime; /** * 进场数量 */ @ExcelProperty("进场数量") - @NotNull(message = "进场数量不能为空") private Integer enterQuantity; /** 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 bbaaaac..23bc64a 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 @@ -23,6 +23,10 @@ public class ExportInCheckQuery extends BaseQuery { @ApiModelProperty(value = "船Id") private String shipId; + @ApiModelProperty(value = "批量船Id") + @DbQuery(field = "shipId", symbol = SqlSymbol.IN) + private List shipIds; + @ApiModelProperty(value = "航次ID") private String voyageId; @@ -41,13 +45,23 @@ public class ExportInCheckQuery extends BaseQuery { private List pamIds; @JsonFormat(pattern = "yyyy-MM-dd") - @ApiModelProperty(value = "开始进场时间") + @ApiModelProperty(value = "开始申请时间") @DbQuery(field = "applyTime", symbol = SqlSymbol.GTE) + private Date beginApplyTime; + + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "结束申请时间") + @DbQuery(field = "applyTime", symbol = SqlSymbol.LTE) + private Date endApplyTime; + + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "开始进场时间") + @DbQuery(field = "beginEnterTime", symbol = SqlSymbol.GTE) private Date beginEnterTime; @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "结束进场时间") - @DbQuery(field = "applyTime", symbol = SqlSymbol.LTE) + @DbQuery(field = "endEnterTime", symbol = SqlSymbol.LTE) private Date endEnterTime; @ApiModelProperty(value = "贸易类型") diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarOpenApi.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarOpenApi.java index 2402d90..639cd2a 100644 --- a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarOpenApi.java +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarOpenApi.java @@ -14,8 +14,8 @@ import java.util.List; import java.util.Map; -@FeignClient(name = "https://rtops4.haitongauto.com/tos/api") -//@FeignClient(name = "rtos-openapi") +//@FeignClient(name = "https://rtops4.haitongauto.com/tos/api") +@FeignClient(name = "rtos-openapi") public interface NuzarOpenApi { // 根据港区ID获取国家 @@ -110,9 +110,9 @@ public interface NuzarOpenApi { @PostMapping("/customer/exportInspectApply/applyId/status") List getInspectStatusStatus(@RequestBody List req); - // 判断是否生成船期计划 + // 判断是否生成船期计划, 返回的是生成的计划的进港计划ID @GetMapping("/customer/shipment/shipLoad/getShipPlan") - Boolean haveShipPlan(@RequestParam("vvyId") String vvyId); + List haveShipPlan(@RequestParam("vvyId") String vvyId); // 装船审核获取国际中转备件 @PostMapping("/customer/shipment/shipLoad/transitPart") diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShutoutCargos.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShutoutCargos.java index 02cfc72..4d9147f 100644 --- a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShutoutCargos.java +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShutoutCargos.java @@ -31,4 +31,9 @@ public class ShutoutCargos implements Serializable { @ApiModelProperty("退关货物信息主键") private String ysrId; + @ApiModelProperty("是否已经申请") + private Boolean repeat=false; + + @ApiModelProperty("货物状态") + private String vinStatus; } 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 db1ced0..732902d 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 @@ -4,14 +4,12 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; -import com.alibaba.excel.util.MapUtils; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.fill.FillConfig; import com.alibaba.excel.write.metadata.fill.FillWrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.haitonggauto.rtosc.api.NuzarOpenApi; import com.haitonggauto.rtosc.api.dto.*; @@ -59,6 +57,7 @@ import com.nuzar.rtops.log.service.EsLogApprovalUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -119,7 +118,41 @@ public class DepartureHandler implements BaseHandler { @PostMapping("/shutout/cargo/query") public Result> getShutoutCargoList(@RequestParam(required = false) @NotNull(message = "船ID不能为空") String shipId, @RequestParam(required = false) @NotNull(message = "航次ID不能为空") String vvyId) { - return ResultUtil.success(openApi.getShutoutCargosList(shipId, vvyId)); + List rst = openApi.getShutoutCargosList(shipId, vvyId); + List existsVins = rst.stream().map(item -> item.getVinCode()).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(existsVins)) { + List list = departureCargoService.lambdaQuery().in(CustomerDepartureCargo::getVin, existsVins).list(); + List exists = list.stream().map(item -> item.getVin()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(exists)) { + rst.stream().forEach(item -> { + if (exists.contains(item.getVinCode())) { + item.setRepeat(true); + } + }); + } + + // 获取作业状态 + Map collect = null; + List vins = rst.stream().map(item -> item.getVinCode()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(vins)) { + VinStatusRequest req = new VinStatusRequest(); + req.setBusinessType("PICK"); + req.setImportExportType("E"); + req.setVinCodeList(vins); + req.setVvyId(vvyId); + List status = openApi.getVinStatus(req); + collect = status.stream().collect(Collectors.toMap(WorkStatusDTO::getVinCode, WorkStatusDTO::getWorkStatus)); + } + + if (MapUtils.isNotEmpty(collect)) { + for (ShutoutCargos cargo : rst) { + cargo.setVinStatus(collect.get(cargo.getVinCode())); + } + } + } + + return ResultUtil.success(rst); } /** @@ -213,7 +246,7 @@ public class DepartureHandler implements BaseHandler { } - @ApiOperation("批量验证车架号是否已经存在") + @ApiOperation("批量验证车架号是否已经存在(带航次)") @PostMapping("/check/vin/repeat") public Result>> checkVinRepeat(@RequestBody @NotNull(message = "验证列表不能为空") @Size(min = 1, message = "验证列表不能为空") ValidList form) { Map> rst = new HashMap<>(); @@ -230,6 +263,18 @@ public class DepartureHandler implements BaseHandler { return ResultUtil.success(rst); } + @ApiOperation("批量验证车架号是否已经存在(不带航次)") + @PostMapping("/check/vin/repeat/novoyage") + public Result> checkVinRepeatNoVoyage(@RequestBody @NotNull(message = "验证列表不能为空") @Size(min = 1, message = "验证列表不能为空") ValidList vins) { + List cargos = departureCargoService.query() + .select("count(*) as quantity, vin") + .in("vin", vins) + .groupBy("vin") + .having("count(quantity) > 0") + .list(); + return ResultUtil.success(cargos.stream().map(item -> item.getVin()).collect(Collectors.toList())); + } + @ApiOperation("提交审核") @PostMapping("/submit-check") public Result submitCheck(@RequestBody @@ -419,6 +464,29 @@ public class DepartureHandler implements BaseHandler { customerService.wrapperEntity(page.getRecords()); + if (CollectionUtils.isNotEmpty(page.getRecords())) { + CustomerDeparture departure = departureService.getById(page.getRecords().get(0).getDepartureId()); + + // 获取作业状态 + Map collect = null; + List vins = page.getRecords().stream().map(item -> item.getVin()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(vins)) { + VinStatusRequest req = new VinStatusRequest(); + req.setBusinessType("PICK"); + req.setImportExportType("E"); + req.setVinCodeList(vins); + req.setVvyId(departure.getVoyageId()); + List status = openApi.getVinStatus(req); + collect = status.stream().collect(Collectors.toMap(WorkStatusDTO::getVinCode, WorkStatusDTO::getWorkStatus)); + } + + if (MapUtils.isNotEmpty(collect)) { + for (CustomerDepartureCargo cargo : page.getRecords()) { + cargo.setVinStatus(collect.get(cargo.getVin())); + } + } + } + return ResultUtil.success(page); } @@ -565,7 +633,7 @@ public class DepartureHandler implements BaseHandler { excelWriter.fill(new FillWrapper("plan", before), writeSheet); excelWriter.fill(new FillWrapper("plan", after), fillConfig, writeSheet); - Map map = MapUtils.newHashMap(); + Map map = new HashMap<>(); map.put("batchNo", departures.get(i).getBatchNo()); // {batchNo} map.put("receiveCompany", departures.get(i).getReceiveCompany()); // {receiveCompany} //{applicant} @@ -672,7 +740,7 @@ public class DepartureHandler implements BaseHandler { cargos.stream().forEach(cargo -> { cargoTable.addCell(new Paragraph(cargo.getBillNo()).setFont(font)); cargoTable.addCell(new Paragraph(cargo.getBrand()).setFont(font)); - cargoTable.addCell(new Paragraph(StringUtils.equals(cargo.getCargoType(), "0") ? "车辆" : "备件").setFont(font)); + cargoTable.addCell(new Paragraph(cargo.getCargoType()).setFont(font)); cargoTable.addCell(cargo.getVin()); cargoTable.addCell(String.valueOf(cargo.getQuantity())); }); diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/DictHandler.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/DictHandler.java index cbbe786..8972944 100644 --- a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/DictHandler.java +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/DictHandler.java @@ -121,7 +121,7 @@ public class DictHandler implements BaseHandler { } if (StringUtils.isNotEmpty(q)) { - rst = rst.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); + rst = rst.stream().filter(item -> StringUtils.containsIgnoreCase(item.getText(), q) || StringUtils.containsIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); } return ResultUtil.success(rst); @@ -149,7 +149,7 @@ public class DictHandler implements BaseHandler { } if (StringUtils.isNotEmpty(q)) { - rst = rst.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); + rst = rst.stream().filter(item -> StringUtils.containsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); } return ResultUtil.success(rst); @@ -193,7 +193,7 @@ public class DictHandler implements BaseHandler { } if (StringUtils.isNotEmpty(q)) { - rst = rst.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); + rst = rst.stream().filter(item -> StringUtils.containsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); } return ResultUtil.success(rst); @@ -258,7 +258,7 @@ public class DictHandler implements BaseHandler { } if (StringUtils.isNotEmpty(q)) { - rst = rst.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); + rst = rst.stream().filter(item -> StringUtils.containsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); } return ResultUtil.success(rst); @@ -285,7 +285,7 @@ public class DictHandler implements BaseHandler { } if (StringUtils.isNotEmpty(q)) { - rst = rst.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); + rst = rst.stream().filter(item -> StringUtils.containsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); } return ResultUtil.success(rst); @@ -311,7 +311,7 @@ public class DictHandler implements BaseHandler { } if (StringUtils.isNotEmpty(q)) { - rst = rst.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); + rst = rst.stream().filter(item -> StringUtils.containsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); } return ResultUtil.success(rst); @@ -337,7 +337,7 @@ public class DictHandler implements BaseHandler { } if (StringUtils.isNotEmpty(q)) { - rst = rst.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); + rst = rst.stream().filter(item -> StringUtils.containsIgnoreCase(item.getText(), q) || StringUtils.containsIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); } return ResultUtil.success(rst); 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 043d9b1..9f9535e 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 @@ -286,6 +286,19 @@ public class ExportInHandler implements BaseHandler { }.changeBaseQueryToWrapper(CustomerExportIn.class, query); Page page = customerExportInService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); customerService.wrapperEntity(page.getRecords()); + // 处理是否生成装船计划 + if(CollectionUtils.isNotEmpty(page.getRecords())) { + Map> map = new HashMap<>(); + List collect = page.getRecords().stream().map(item -> item.getVoyageId()).distinct().collect(Collectors.toList()); + for (String v : collect) { + List list = openApi.haveShipPlan(v); + map.put(v, CollectionUtils.isNotEmpty(list) ? list : Collections.emptyList()); + } + page.getRecords().stream().forEach(item -> { + item.setShipPlan(map.get(item.getVoyageId()).contains(item.getId())); + }); + } + return ResultUtil.success(page); } @@ -295,13 +308,17 @@ public class ExportInHandler implements BaseHandler { if (query.getEndEnterTime() != null) { query.setEndEnterTime(DateUtils.getDayEnd(query.getEndEnterTime())); } - 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); - } +// 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); +// } + + query.setBillNum(null); + query.setCheckStatus(AuditEnum.AUDIT_PASS); + QueryWrapper queryWrapper = (QueryWrapper) new WrapperKit() { }.changeBaseQueryToWrapper(CustomerExportIn.class, query); @@ -309,9 +326,9 @@ public class ExportInHandler implements BaseHandler { 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); @@ -425,6 +442,7 @@ public class ExportInHandler implements BaseHandler { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); queryWrapper.eq(query.getId() != null, CustomerExportInCargo::getExportInId, query.getId()); + queryWrapper.like(StringUtils.isNotEmpty(query.getVin()), CustomerExportInCargo::getVin, query.getVin()); queryWrapper.in(CollectionUtils.isNotEmpty(query.getIds()), CustomerExportInCargo::getExportInId, query.getIds()); if (query.getCargoType() != null) { queryWrapper.eq(CustomerExportInCargo::getCargoType, query.getCargoType()); @@ -1079,13 +1097,12 @@ public class ExportInHandler implements BaseHandler { return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "id:" + id + "不存在"); } - // 有装船审核通过的 - Long count = customerExportLoadService.lambdaQuery().eq(CustomerExportLoad::getShipId, ei.getShipId()) - .eq(CustomerExportLoad::getVoyageId, ei.getVoyageId()) - .eq(CustomerExportLoad::getBillNo, ei.getBillNum()) - .eq(CustomerExportLoad::getBrandId, ei.getBrandId()).eq(CustomerExportLoad::getCheckStatus, AuditEnum.AUDIT_PASS).count(); - if (count > 0) { - return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "装船审核通过,不允许取消审核"); + List havePlans = openApi.haveShipPlan(ei.getVoyageId()); + if (CollectionUtils.isNotEmpty(havePlans)) { + Boolean c = havePlans.contains(ei.getId()); + if (c) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已生成装船计划,不允许取消审核"); + } } CustomerExportIn exportIn = PoMapper.instance.exportInCheckVo2Entity(check); @@ -1108,11 +1125,6 @@ public class ExportInHandler implements BaseHandler { @Transactional(rollbackFor = {Exception.class}) @PostMapping("/batch-update/shipVoyage") public Result shipVoyageUpdate(@RequestBody @Validated(ValidationGroup.insert.class) BatchUpdateShipVo form) { - Boolean havePlan = openApi.haveShipPlan(form.getVoyageId()); - if (havePlan) { - return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已生成装船计划,不支持批量修改航次"); - } - // 船名,航次必须相同才能修改 long count = customerExportInService.query() .select("distinct(voyage_id)") @@ -1129,6 +1141,14 @@ public class ExportInHandler implements BaseHandler { .eq(CustomerExportIn::getShipId, form.getShipId()) .eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT).list(); + List havePlans = openApi.haveShipPlan(form.getVoyageId()); + if (CollectionUtils.isNotEmpty(exportInList) && CollectionUtils.isNotEmpty(havePlans)) { + long c = exportInList.stream().filter(item -> havePlans.contains(item.getId())).count(); + if (c > 0) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已生成装船计划,不支持批量修改航次"); + } + } + exportInList.stream().filter(item -> StringUtils.equals("备件", item.getCartType()) && StringUtils.equalsAnyIgnoreCase(item.getVoyage(), "HT6", "HTTC", "HTLG")) .forEach(item -> { String vvyId = item.getVoyageId(); @@ -1183,15 +1203,18 @@ public class ExportInHandler implements BaseHandler { return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "所选船名航次不同,不支持批量修改航次"); } - Boolean havePlan = openApi.haveShipPlan(exportIns.get(0).getVoyageId()); - if (havePlan) { - return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已生成装船计划,不支持批量修改航次"); - } - // 判断是不是备件,如果是备件,则需要重新生成 List exportInList = customerExportInService.lambdaQuery() .in(CustomerExportIn::getId, form.getIds()).list(); + List havePlans = openApi.haveShipPlan(exportIns.get(0).getVoyageId()); + if (CollectionUtils.isNotEmpty(exportInList) && CollectionUtils.isNotEmpty(havePlans)) { + long c = exportInList.stream().filter(item -> havePlans.contains(item.getId())).count(); + if (c > 0) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已生成装船计划,不支持批量修改航次"); + } + } + exportInList.stream().filter(item -> StringUtils.equals("备件", item.getCartType()) && StringUtils.equalsAnyIgnoreCase(item.getVoyage(), "HT6", "HTTC", "HTLG")) .forEach(item -> { String vvyId = item.getVoyageId(); @@ -1395,11 +1418,11 @@ public class ExportInHandler implements BaseHandler { return v; }).collect(Collectors.toList()); List rst = shpApi.checkVinRepeat(req); + existVins.clear(); if (CollectionUtils.isNotEmpty(rst)) { // 再次过滤出重复的 List sCollect = rst.stream().filter(ss -> ss.getIsRepetition()).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(sCollect)) { - existVins.clear(); existVins.addAll(sCollect.stream().map(ss -> ss.getVinCode()).collect(Collectors.toList())); } } @@ -1497,11 +1520,14 @@ public class ExportInHandler implements BaseHandler { @PostMapping("/import-vin") public Result> importVin(@RequestParam(required = false) @NotNull(message = "出口进场ID不能为空") Long id, MultipartFile file) throws IOException { CustomerExportIn exportIn = customerExportInService.getById(id); - Boolean havePlan = openApi.haveShipPlan(exportIn.getVoyageId()); - if (havePlan) { - return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已生成装船计划,不能导入"); - } + List havePlans = openApi.haveShipPlan(exportIn.getVoyageId()); + if (exportIn != null && CollectionUtils.isNotEmpty(havePlans)) { + Boolean c = havePlans.contains(exportIn.getId()); + if (c) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已生成装船计划,不能导入"); + } + } // 有错误的数据 List errorDataList = new ArrayList<>(); @@ -1603,11 +1629,11 @@ public class ExportInHandler implements BaseHandler { return v; }).collect(Collectors.toList()); List rst = shpApi.checkVinRepeat(req); + existVins.clear(); if (CollectionUtils.isNotEmpty(rst)) { // 再次过滤出重复的 List sCollect = rst.stream().filter(ss -> ss.getIsRepetition()).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(sCollect)) { - existVins.clear(); existVins.addAll(sCollect.stream().map(ss -> ss.getVinCode()).collect(Collectors.toList())); } } @@ -1829,11 +1855,11 @@ public class ExportInHandler implements BaseHandler { return v; }).collect(Collectors.toList()); List rst = shpApi.checkVinRepeat(req); + existVins.clear(); // 先清空 if (CollectionUtils.isNotEmpty(rst)) { // 再次过滤出重复的 List sCollect = rst.stream().filter(ss -> ss.getIsRepetition()).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(sCollect)) { - existVins.clear(); existVins.addAll(sCollect.stream().map(ss -> ss.getVinCode()).collect(Collectors.toList())); } } @@ -1841,20 +1867,27 @@ public class ExportInHandler implements BaseHandler { List existData = item.getValue().stream().filter(p -> existVins.contains(p.getVin())).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(existData)) { - errorDataList.addAll(item.getValue().stream().map(p -> { + errorDataList.addAll(item.getValue().stream().filter(p -> existVins.contains(p.getVin())).map(p -> { JSONObject o = JSONObject.from(p); o.put("status", "数据已存在, 未导入"); return o; }).collect(Collectors.toList())); + errorDataList.addAll(item.getValue().stream().filter(p -> !existVins.contains(p.getVin())) + .map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "验证通过"); + return o; + }).collect(Collectors.toList())); return; + } else { + errorDataList.addAll(item.getValue().stream().filter(p -> !existVins.contains(p.getVin())) + .map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "导入成功"); + return o; + }).collect(Collectors.toList())); } - errorDataList.addAll(item.getValue().stream().filter(p -> !existVins.contains(p.getVin())) - .map(p -> { - JSONObject o = JSONObject.from(p); - o.put("status", "导入成功"); - return o; - }).collect(Collectors.toList())); // 删除原有的车架号 customerExportInCargoService.lambdaUpdate().eq(CustomerExportInCargo::getExportInId, exportIn.getId()).remove(); List saveCargos = cargos.stream().filter(p -> !existVins.contains(p.getVin())).collect(Collectors.toList()); @@ -1888,6 +1921,19 @@ public class ExportInHandler implements BaseHandler { return ResultUtil.success("success"); } + @ApiOperation("通过车架号查询进港信息") + @PostMapping("/query/exportIn/vin") + public Result queryExportInByVin(@RequestParam(required = false) @NotBlank(message = "车架号不能为空") String vin) { + List list = customerExportInService.lambdaQuery() + .exists("select id from customer_export_in_cargo where customer_export_in.id = customer_export_in_cargo.export_in_id and vin={0}", vin) + .list(); + if (CollectionUtils.isNotEmpty(list)) { + return ResultUtil.success(list.get(0)); + } + + return ResultUtil.success(null); + } + @ApiOperation("出口进场导出") @GetMapping("/exportExecl") public void exportExecl( @@ -2196,12 +2242,6 @@ public class ExportInHandler implements BaseHandler { // 港区、船名、港口、品牌、车型 validData.stream().forEach(item -> { - if (item.getEnterQuantity() != item.getQuantity()) { - JSONObject o = JSONObject.from(item); - o.put("status", "数量和进场数量不一致"); - errorDataList.add(o); - return; - } if (portList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getPortName())).count() == 0) { JSONObject o = JSONObject.from(item); o.put("status", "港口不存在"); @@ -2260,7 +2300,7 @@ public class ExportInHandler implements BaseHandler { return; } // 运输方式必须是“板车运输、商品车自开、驳船,否则导入不成功,提示“运输方式错误” - if (!StringUtils.equalsAnyIgnoreCase(item.getTransportWay(), "板车运输", "商品车自开", "驳船") || transportWayList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getTransportWay())).count() == 0) { + if (transportWayList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getTransportWay())).count() == 0) { JSONObject o = JSONObject.from(item); o.put("status", "运输方式错误"); errorDataList.add(o); @@ -2278,9 +2318,7 @@ public class ExportInHandler implements BaseHandler { return; } // 车型如果是车辆操作模式必须为“港机作业,客户自开”,如果是备件操作模式必须为“铲车、吊车、浮吊”,否则导入不成功,提示“操作模式错误” - if ((StringUtils.equals("车辆", item.getCartType()) && !StringUtils.equalsAny(item.getOperateType(), "港机作业", "自开")) || - (StringUtils.equals("备件", item.getCartType()) && !StringUtils.equalsAny(item.getOperateType(), "铲车", "吊车", "浮吊")) - || operateTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getOperateType())).count() == 0) { + if (operateTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getOperateType())).count() == 0) { JSONObject o = JSONObject.from(item); o.put("status", "操作模式错误"); errorDataList.add(o); @@ -2292,15 +2330,31 @@ public class ExportInHandler implements BaseHandler { errorDataList.add(o); return; } - // 验证进场日期是否正确 - Date d = DateUtils.parseDate(StringUtils.trim(item.getEnterTime()), "yyyy/MM/dd"); - - if (d == null) { + Date bDate = DateUtils.parseDate(StringUtils.trim(item.getBeginEnterTime()), "yyyy/MM/dd"); + if (bDate == null) { JSONObject o = JSONObject.from(item); - o.put("status", "日期格式不正确yyyy/MM/dd"); + o.put("status", "进场开始日期格式为2023/09/08"); errorDataList.add(o); return; } + Date eDate = DateUtils.parseDate(StringUtils.trim(item.getEndEnterTime()), "yyyy/MM/dd"); + if (eDate == null) { + JSONObject o = JSONObject.from(item); + o.put("status", "进场结束日期格式为2023/09/08"); + errorDataList.add(o); + return; + } + if (StringUtils.isNotEmpty(item.getEnterTime())) { + // 验证进场时间是否正确 + Date d = DateUtils.parseDate(StringUtils.trim(item.getEnterTime()), "yyyy/MM/dd HH:mm"); + + if (d == null) { + JSONObject o = JSONObject.from(item); + o.put("status", "进场时间格式必须为2023/09/08 13:00"); + errorDataList.add(o); + return; + } + } saveData.add(item); // JSONObject o = JSONObject.from(item); @@ -2329,8 +2383,11 @@ public class ExportInHandler implements BaseHandler { in.setCountry(portCountryList.get(in.getPortId()).getText()); } - in.setBeginEnterTime(DateUtils.parseDate(StringUtils.trim(item.getEnterTime()), "yyyy/MM/dd")); - in.setEndEnterTime(in.getBeginEnterTime()); + if (StringUtils.isNotEmpty(item.getEnterTime())) { + // 验证进场时间是否正确 + Date d = DateUtils.parseDate(StringUtils.trim(item.getEnterTime()), "yyyy/MM/dd HH:mm"); + in.setTmpEnterDate(d); + } in.setShipId(shipList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getShipName())).findFirst().get().getId()); in.setShipEnName(shipList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getShipName())).findFirst().get().getExtra1()); @@ -2346,7 +2403,10 @@ public class ExportInHandler implements BaseHandler { in.setFreightId(companyMap.get(item.getFreight())); in.setApplicantId(UserContext.getUser().getUserId()); in.setTermcd(in.getPortAreaId()); - in.setVolume(in.getLength().multiply(in.getWeight()).multiply(in.getHeight()).setScale(4, RoundingMode.HALF_UP)); // 计算体积 + in.setVolume(in.getLength().multiply(in.getWidth()).multiply(in.getHeight()).setScale(4, RoundingMode.HALF_UP)); // 计算体积 + if (in.getEnterQuantity() == null) { + in.setEnterQuantity(in.getQuantity()); + } if (StringUtils.equals("1", type)) { in.setCheckStatus(AuditEnum.AUDIT); @@ -2451,7 +2511,7 @@ public class ExportInHandler implements BaseHandler { List times = new ArrayList<>(); CustomerExportInTimes time = new CustomerExportInTimes(); time.setEnterQuantity(ss.getQuantity()); - time.setEnterTime(ss.getBeginEnterTime()); + time.setEnterTime(ss.getTmpEnterDate() == null ? ss.getBeginEnterTime() : ss.getTmpEnterDate()); times.add(time); ss.setEachVolume(lastE.getEachVolume()); @@ -2466,7 +2526,7 @@ public class ExportInHandler implements BaseHandler { List times = new ArrayList<>(); CustomerExportInTimes time = new CustomerExportInTimes(); time.setEnterQuantity(ss.getQuantity()); - time.setEnterTime(ss.getBeginEnterTime()); + time.setEnterTime(ss.getTmpEnterDate() == null ? ss.getBeginEnterTime() : ss.getTmpEnterDate()); times.add(time); ss.setEachVolume(lastE.getEachVolume()); 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 7a83dfe..3016c14 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 @@ -857,8 +857,8 @@ public class ExportLoadHandler implements BaseHandler { return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "所选船名航次不同,不支持批量修改航次"); } - Boolean havePlan = openApi.haveShipPlan(exportLoads.get(0).getVoyageId()); - if (havePlan) { + List havePlans = openApi.haveShipPlan(exportLoads.get(0).getVoyageId()); + if (CollectionUtils.isNotEmpty(havePlans)) { return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已生成装船计划,不支持批量修改航次"); } @@ -874,8 +874,8 @@ public class ExportLoadHandler implements BaseHandler { @ApiOperation("批量修改船名航次") @PostMapping("/batch-update/shipVoyage") public Result shipVoyageUpdate(@RequestBody @Validated(ValidationGroup.update.class) BatchUpdateShipVo form) { - Boolean havePlan = openApi.haveShipPlan(form.getVoyageId()); - if (havePlan) { + List havePlans = openApi.haveShipPlan(form.getVoyageId()); + if (CollectionUtils.isNotEmpty(havePlans)) { return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已生成装船计划,不支持批量修改航次"); } @@ -1009,7 +1009,7 @@ public class ExportLoadHandler implements BaseHandler { if (exportIn == null || exportIn.getCheckStatus() != AuditEnum.AUDIT_PASS) { errorDataList.addAll(item.getValue().stream().map(p -> { JSONObject o = JSONObject.from(p); - o.put("status", "未找到审核通过的出口进港申请"); + o.put("status", "本船名航次下未找到审核通过的出口进港申请"); return o; }).collect(Collectors.toList())); return; @@ -1217,7 +1217,7 @@ public class ExportLoadHandler implements BaseHandler { if (exportIn == null || exportIn.getCheckStatus() != AuditEnum.AUDIT_PASS) { errorDataList.addAll(item.getValue().stream().map(p -> { JSONObject o = JSONObject.from(p); - o.put("status", "未找到审核通过的出口进港申请"); + o.put("status", "本船名航次下未找到审核通过的出口进港申请"); return o; }).collect(Collectors.toList())); return; @@ -1648,7 +1648,7 @@ public class ExportLoadHandler implements BaseHandler { if (exportIn == null || exportIn.getCheckStatus() != AuditEnum.AUDIT_PASS) { errorDataList.addAll(item.getValue().stream().map(p -> { JSONObject o = JSONObject.from(p); - o.put("status", "未找到审核通过的出口进港申请"); + o.put("status", "本船名航次下未找到审核通过的出口进港申请"); return o; }).collect(Collectors.toList())); return; diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/mapper/PoMapper.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/mapper/PoMapper.java index 67c3bcf..d653ffc 100644 --- a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/mapper/PoMapper.java +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/mapper/PoMapper.java @@ -58,6 +58,8 @@ public interface PoMapper { @Mapping(source = "createDate", target = "createDate", dateFormat="yyyy-MM-dd HH:mm:ss") FreeTradeExportExcel entity2Excel(CustomerFreeTrade entity); + @Mapping(source = "endEnterTime", target = "endEnterTime", dateFormat="yyyy/MM/dd") + @Mapping(source = "beginEnterTime", target = "beginEnterTime", dateFormat="yyyy/MM/dd") CustomerExportIn excel2Entity(ExportInPlanExcel excel); CustomerImportUnload importUnloadCheckVo2Entity(ImportUnloadCheckVo vo); diff --git a/nuzar-customer-controller/src/main/resources/templates/in_temp.xlsx b/nuzar-customer-controller/src/main/resources/templates/in_temp.xlsx index a247445..084feb7 100644 Binary files a/nuzar-customer-controller/src/main/resources/templates/in_temp.xlsx and b/nuzar-customer-controller/src/main/resources/templates/in_temp.xlsx differ diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDepartureCargo.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDepartureCargo.java index 1166cf0..6fb6f80 100644 --- a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDepartureCargo.java +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDepartureCargo.java @@ -73,6 +73,13 @@ public class CustomerDepartureCargo extends BaseEntity implements Serializable { @TableField(value = "is_shutout") private Integer isShutout; + /** + * 车辆状态 + */ + @TableField(value = "vin_status") + @ApiModelProperty(value = "车辆状态") + private String vinStatus; + @TableField(exist = false) @ApiModelProperty(hidden = true) private static final long serialVersionUID = 1L; diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportIn.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportIn.java index 75f88fb..a95240b 100644 --- a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportIn.java +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportIn.java @@ -415,6 +415,10 @@ public class CustomerExportIn extends BaseEntity implements Serializable { @ApiModelProperty(value = "审核状态") private AuditEnum checkStatus; + @TableField(exist = false) + @ApiModelProperty(value = "进场日期", hidden = true) + private Date tmpEnterDate; + /** * 审核原因 */ @@ -439,6 +443,10 @@ public class CustomerExportIn extends BaseEntity implements Serializable { @ApiModelProperty(value = "出口进场备件列表") private List spares; + @TableField(exist = false) + @ApiModelProperty(value = "是否生成装船计划") + private Boolean shipPlan; + @TableField(exist = false) @ApiModelProperty(hidden = true) private static final long serialVersionUID = 1L; diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/AuditEnum.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/AuditEnum.java index 9e1b6d8..d465565 100644 --- a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/AuditEnum.java +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/AuditEnum.java @@ -9,8 +9,8 @@ import com.haitonggauto.rtosc.common.enums.BaseEnum; public enum AuditEnum implements BaseEnum { SUBMIT(0, "待提交"), AUDIT(1, "待审核"), - AUDIT_PASS(2, "审核通过"), - AUDIT_REJECT(3, "审核拒绝") + AUDIT_PASS(2, "已通过"), + AUDIT_REJECT(3, "已驳回") ; @EnumValue