批量修改

This commit is contained in:
dengjun 2023-12-19 13:33:25 +08:00
parent d85e352457
commit 031902091a
17 changed files with 270 additions and 97 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@
/.idea/
/logs/
/nuzar-customer-repository/nuzar-customer-repository.iml
/nuzar-customer-proxy/nuzar-customer-proxy.iml

View File

@ -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;

View File

@ -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;
/**

View File

@ -329,8 +329,8 @@ public class ExportInVo implements Serializable {
/**
* 是否是二手车
*/
@ApiModelProperty(value = "是否是二手车1是二手车0不是二手车")
private Integer secondHand;
@ApiModelProperty(value = "是否是二手车")
private String secondHand;
/**
* 备注

View File

@ -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;
/**

View File

@ -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<String> shipIds;
@ApiModelProperty(value = "航次ID")
private String voyageId;
@ -41,13 +45,23 @@ public class ExportInCheckQuery extends BaseQuery {
private List<String> 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 = "贸易类型")

View File

@ -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<InspectStatusResp> getInspectStatusStatus(@RequestBody List<String> req);
// 判断是否生成船期计划
// 判断是否生成船期计划, 返回的是生成的计划的进港计划ID
@GetMapping("/customer/shipment/shipLoad/getShipPlan")
Boolean haveShipPlan(@RequestParam("vvyId") String vvyId);
List<Long> haveShipPlan(@RequestParam("vvyId") String vvyId);
// 装船审核获取国际中转备件
@PostMapping("/customer/shipment/shipLoad/transitPart")

View File

@ -31,4 +31,9 @@ public class ShutoutCargos implements Serializable {
@ApiModelProperty("退关货物信息主键")
private String ysrId;
@ApiModelProperty("是否已经申请")
private Boolean repeat=false;
@ApiModelProperty("货物状态")
private String vinStatus;
}

View File

@ -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<List<ShutoutCargos>> 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<ShutoutCargos> rst = openApi.getShutoutCargosList(shipId, vvyId);
List<String> existsVins = rst.stream().map(item -> item.getVinCode()).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(existsVins)) {
List<CustomerDepartureCargo> list = departureCargoService.lambdaQuery().in(CustomerDepartureCargo::getVin, existsVins).list();
List<String> 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<String, String> collect = null;
List<String> 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<WorkStatusDTO> 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<Map<String,List<String>>> checkVinRepeat(@RequestBody @NotNull(message = "验证列表不能为空") @Size(min = 1, message = "验证列表不能为空") ValidList<CheckVinRepeatVo> form) {
Map<String, List<String>> rst = new HashMap<>();
@ -230,6 +263,18 @@ public class DepartureHandler implements BaseHandler {
return ResultUtil.success(rst);
}
@ApiOperation("批量验证车架号是否已经存在(不带航次)")
@PostMapping("/check/vin/repeat/novoyage")
public Result<List<String>> checkVinRepeatNoVoyage(@RequestBody @NotNull(message = "验证列表不能为空") @Size(min = 1, message = "验证列表不能为空") ValidList<String> vins) {
List<CustomerDepartureCargo> 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<String> 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<String, String> collect = null;
List<String> 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<WorkStatusDTO> 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<String, Object> map = MapUtils.newHashMap();
Map<String, Object> 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()));
});

View File

@ -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);

View File

@ -286,6 +286,19 @@ public class ExportInHandler implements BaseHandler {
}.changeBaseQueryToWrapper(CustomerExportIn.class, query);
Page<CustomerExportIn> page = customerExportInService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper);
customerService.wrapperEntity(page.getRecords());
// 处理是否生成装船计划
if(CollectionUtils.isNotEmpty(page.getRecords())) {
Map<String, List<Long>> map = new HashMap<>();
List<String> collect = page.getRecords().stream().map(item -> item.getVoyageId()).distinct().collect(Collectors.toList());
for (String v : collect) {
List<Long> 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<CustomerExportIn> 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<CustomerExportIn> page = customerExportInService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper);
@ -425,6 +442,7 @@ public class ExportInHandler implements BaseHandler {
LambdaQueryWrapper<CustomerExportInCargo> 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<Long> 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<String> 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<Long> 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<CustomerExportIn> exportInList = customerExportInService.lambdaQuery()
.in(CustomerExportIn::getId, form.getIds()).list();
List<Long> 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<CheckVinReq> rst = shpApi.checkVinRepeat(req);
existVins.clear();
if (CollectionUtils.isNotEmpty(rst)) {
// 再次过滤出重复的
List<CheckVinReq> 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<List<JSONObject>> 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<Long> 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<JSONObject> errorDataList = new ArrayList<>();
@ -1603,11 +1629,11 @@ public class ExportInHandler implements BaseHandler {
return v;
}).collect(Collectors.toList());
List<CheckVinReq> rst = shpApi.checkVinRepeat(req);
existVins.clear();
if (CollectionUtils.isNotEmpty(rst)) {
// 再次过滤出重复的
List<CheckVinReq> 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<CheckVinReq> rst = shpApi.checkVinRepeat(req);
existVins.clear(); // 先清空
if (CollectionUtils.isNotEmpty(rst)) {
// 再次过滤出重复的
List<CheckVinReq> 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<ExportLoadExcel> 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<CustomerExportInCargo> 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<CustomerExportIn> queryExportInByVin(@RequestParam(required = false) @NotBlank(message = "车架号不能为空") String vin) {
List<CustomerExportIn> 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<CustomerExportInTimes> 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<CustomerExportInTimes> 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());

View File

@ -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<Long> 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<String> shipVoyageUpdate(@RequestBody @Validated(ValidationGroup.update.class) BatchUpdateShipVo form) {
Boolean havePlan = openApi.haveShipPlan(form.getVoyageId());
if (havePlan) {
List<Long> 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;

View File

@ -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);

View File

@ -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;

View File

@ -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<CustomerExportInCargo> spares;
@TableField(exist = false)
@ApiModelProperty(value = "是否生成装船计划")
private Boolean shipPlan;
@TableField(exist = false)
@ApiModelProperty(hidden = true)
private static final long serialVersionUID = 1L;

View File

@ -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