Compare commits
10 Commits
bb8c1724ff
...
d7daf871ca
Author | SHA1 | Date |
---|---|---|
dengjun | d7daf871ca | |
dengjun | b31b25b6ff | |
dengjun | 10c018cb81 | |
dengjun | cdf82b1963 | |
dengjun | bdf6232e15 | |
dengjun | 9bf5504fbf | |
dengjun | 25f0c98516 | |
dengjun | 751da4557b | |
dengjun | 8f70e34cb5 | |
dengjun | a3ae356a1f |
|
@ -0,0 +1,31 @@
|
|||
package com.haitonggauto.rtosc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "多船批量审核")
|
||||
public class BatchCheckShipVo implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "船ID")
|
||||
@NotBlank(message = "船ID不能为空")
|
||||
private String shipId;
|
||||
|
||||
@ApiModelProperty(value = "航次ID")
|
||||
@NotBlank(message = "航次ID不能为空")
|
||||
private String voyageId;
|
||||
|
||||
@ApiModelProperty(value = "港区ID")
|
||||
@NotBlank(message = "港区ID不能为空")
|
||||
private String portAreaId;
|
||||
|
||||
@ApiModelProperty(value = "预进港时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date preArrivalTime;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.haitonggauto.rtosc.dto;
|
||||
|
||||
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
@ApiModel("提单号验证")
|
||||
public class BillNumValidVo {
|
||||
@ApiModelProperty(value = "船ID")
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "船ID不能为空")
|
||||
private String shipId;
|
||||
|
||||
@ApiModelProperty(value = "航次ID")
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次ID不能为空")
|
||||
private String voyageId;
|
||||
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "货代ID不能为空")
|
||||
@ApiModelProperty(value = "货代ID", required = true)
|
||||
private String freightId;
|
||||
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "提单号不能为空")
|
||||
@ApiModelProperty(value = "提单号", required = true)
|
||||
private String billNum;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.haitonggauto.rtosc.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
@ -9,6 +10,7 @@ import javax.validation.constraints.NotBlank;
|
|||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "提离港区货物表",description = "")
|
||||
|
@ -46,14 +48,13 @@ public class DepartureCargoVo implements Serializable {
|
|||
* 货物类型
|
||||
*/
|
||||
// @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车型不能为空")
|
||||
@ApiModelProperty(value = "车型", required = true)
|
||||
private String cargoType;
|
||||
// @ApiModelProperty(value = "车型", required = true)
|
||||
// private String cargoType;
|
||||
|
||||
/**
|
||||
* 车架号/条码
|
||||
*/
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车架号/条码不能为空")
|
||||
@Size(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, min = 17, max = 17, message = "车架号长度为17位")
|
||||
@ApiModelProperty(value = "车架号/条码", required = true)
|
||||
private String vin;
|
||||
|
||||
|
@ -71,6 +72,53 @@ public class DepartureCargoVo implements Serializable {
|
|||
@ApiModelProperty(value = "是否退关", required = true)
|
||||
private Integer isShutout;
|
||||
|
||||
/**
|
||||
* 车型ID
|
||||
*/
|
||||
@ApiModelProperty(value = "车型ID")
|
||||
private String cartTypeId;
|
||||
|
||||
/**
|
||||
* 车型
|
||||
*/
|
||||
@ApiModelProperty(value = "车型")
|
||||
private String cartType;
|
||||
// 型号
|
||||
|
||||
@ApiModelProperty(value = "型号")
|
||||
private String models;
|
||||
/**
|
||||
* 长
|
||||
*/
|
||||
@ApiModelProperty(value = "长")
|
||||
private BigDecimal length;
|
||||
|
||||
/**
|
||||
* 宽
|
||||
*/
|
||||
@ApiModelProperty(value = "宽")
|
||||
private BigDecimal width;
|
||||
|
||||
/**
|
||||
* 高
|
||||
*/
|
||||
@ApiModelProperty(value = "高")
|
||||
private BigDecimal height;
|
||||
|
||||
/**
|
||||
* 重量(吨)
|
||||
*/
|
||||
@TableField(value = "weight")
|
||||
@ApiModelProperty(value = "重量")
|
||||
private BigDecimal weight;
|
||||
|
||||
// 是否报关
|
||||
@ApiModelProperty(value = "是否报关")
|
||||
private Integer isCustoms;
|
||||
|
||||
@ApiModelProperty(value = "是否随车备件")
|
||||
private Integer isSpare;
|
||||
|
||||
@ApiModelProperty(value = "车辆状态")
|
||||
private String vinStatus;
|
||||
|
||||
|
|
|
@ -23,6 +23,10 @@ public class DeparturePlanVo implements Serializable {
|
|||
@ApiModelProperty(value = "提离港区ID", hidden = true)
|
||||
private Long departureId;
|
||||
|
||||
@ApiModelProperty("货物类型,0代表车辆,1代表备件")
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "货物类型不能为空")
|
||||
private String cargoType;
|
||||
|
||||
/**
|
||||
* 品牌ID
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package com.haitonggauto.rtosc.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("提离港区验证")
|
||||
public class DepartureValidVo {
|
||||
@ApiModelProperty(value = "船ID")
|
||||
@NotBlank(message = "船ID不能为空")
|
||||
private String shipId;
|
||||
|
||||
@ApiModelProperty(value = "航次ID")
|
||||
@NotBlank(message = "航次ID不能为空")
|
||||
private String voyageId;
|
||||
|
||||
@NotBlank(message = "港区ID不能为空")
|
||||
@ApiModelProperty(value = "港区ID", required = true)
|
||||
private String portAreaId;
|
||||
|
||||
@ApiModelProperty(value = "品牌ID", required = true)
|
||||
@NotBlank(message = "品牌ID不能为空")
|
||||
private String brandId;
|
||||
|
||||
@Valid
|
||||
@NotNull(message = "车架号不能为空")
|
||||
@Size(min = 1, message = "车架号不能为空")
|
||||
private List<BillVin> vins;
|
||||
|
||||
@Data
|
||||
public static class BillVin {
|
||||
@ApiModelProperty(value = "提单号", required = true)
|
||||
@NotBlank(message = "提单号不能为空")
|
||||
private String billNo;
|
||||
|
||||
@ApiModelProperty(value = "车架号", required = true)
|
||||
@NotBlank(message = "车架号不能为空")
|
||||
private String vin;
|
||||
}
|
||||
}
|
|
@ -56,30 +56,44 @@ public class DepartureVo implements Serializable {
|
|||
* 航次ID
|
||||
*/
|
||||
@ApiModelProperty(value = "航次ID")
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次ID不能为空")
|
||||
// @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次ID不能为空")
|
||||
private String voyageId;
|
||||
|
||||
/**
|
||||
* 航次
|
||||
*/
|
||||
@ApiModelProperty(value = "航次", required = true)
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次不能为空")
|
||||
// @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次不能为空")
|
||||
private String voyage;
|
||||
|
||||
/**
|
||||
* 港区ID
|
||||
*/
|
||||
@ApiModelProperty(value = "港区ID")
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港区ID不能为空")
|
||||
// @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港区ID不能为空")
|
||||
private String portAreaId;
|
||||
|
||||
/**
|
||||
* 港区
|
||||
*/
|
||||
@ApiModelProperty(value = "港区", required = true)
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港区不能为空")
|
||||
// @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港区不能为空")
|
||||
private String portArea;
|
||||
|
||||
/**
|
||||
* 品牌ID
|
||||
*/
|
||||
@ApiModelProperty(value = "品牌ID")
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "品牌ID不能为空")
|
||||
private String brandId;
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "品牌不能为空")
|
||||
@ApiModelProperty(value = "品牌")
|
||||
private String brand;
|
||||
|
||||
/**
|
||||
* 贸易类型
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package com.haitonggauto.rtosc.dto;
|
||||
|
||||
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
|
||||
import com.haitonggauto.rtosc.repository.enums.AuditEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出口进场基本表
|
||||
*
|
||||
* @TableName customer_export_in
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "进港审核", description = "")
|
||||
public class ExportInAuditVo implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "船ID")
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "船ID不能为空")
|
||||
private String shipId;
|
||||
|
||||
/**
|
||||
* 航次ID
|
||||
*/
|
||||
@ApiModelProperty(value = "航次ID")
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次ID不能为空")
|
||||
private String voyageId;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
@ApiModelProperty(value = "审核状态")
|
||||
@NotNull(groups = {ValidationGroup.insert.class}, message = "审核状态不能为空")
|
||||
private AuditEnum checkStatus;
|
||||
|
||||
@ApiModelProperty(value = "提单号列表")
|
||||
@NotNull(groups = {ValidationGroup.insert.class}, message = "提单号列表不能为空")
|
||||
@Size(min = 1, message = "提单号列表不能为空")
|
||||
private List<String> billNums;
|
||||
/**
|
||||
* 审核原因
|
||||
*/
|
||||
@ApiModelProperty(value = "审核原因")
|
||||
private String checkResult;
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.haitonggauto.rtosc.dto;
|
||||
|
||||
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
|
||||
import com.haitonggauto.rtosc.repository.enums.AuditEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出口进场货物表
|
||||
* @TableName customer_export_in_cargo
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "多船审核信息",description = "")
|
||||
public class ExportInBatchCheckVo implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "原始审核状态")
|
||||
@NotNull(message = "原始审核状态不能为空")
|
||||
private AuditEnum originalCheckStatus;
|
||||
|
||||
@ApiModelProperty(value = "审核状态")
|
||||
@NotNull(message = "审核状态不能为空")
|
||||
private AuditEnum checkStatus;
|
||||
|
||||
/**
|
||||
* 审核原因
|
||||
*/
|
||||
@ApiModelProperty(value = "审核原因")
|
||||
private String checkResult;
|
||||
|
||||
@ApiModelProperty(value = "审核类型, 0-全部,1-车辆,2-备件")
|
||||
private String type;
|
||||
|
||||
@Valid
|
||||
@NotNull(message = "审核船名列表为空")
|
||||
@Size(min = 1, message = "审核船名列表不能为空")
|
||||
private List<BatchCheckShipVo> ships;
|
||||
}
|
|
@ -32,7 +32,6 @@ public class ExportInCargoVo implements Serializable {
|
|||
* 车架号
|
||||
*/
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车架号不能为空")
|
||||
@Size(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, min = 17, max = 17, message = "车架号长度为17位")
|
||||
@ApiModelProperty(value = "车架号", required = true)
|
||||
private String vin;
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.haitonggauto.rtosc.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "进港计划查询",description = "")
|
||||
public class ExportInQueryVo implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "船ID")
|
||||
private String shipId;
|
||||
|
||||
/**
|
||||
* 受理号
|
||||
*/
|
||||
@ApiModelProperty(value = "航次ID")
|
||||
private String voyageId;
|
||||
|
||||
@ApiModelProperty(value = "车架号列表")
|
||||
@NotNull(message = "请传入车架号列表")
|
||||
@Size(min = 1, message = "车架号列表不能为空")
|
||||
private List<String> billNums;
|
||||
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package com.haitonggauto.rtosc.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
|
||||
import com.haitonggauto.rtosc.common.validate.DependsOn;
|
||||
|
@ -25,7 +24,7 @@ import java.util.List;
|
|||
@Data
|
||||
@ApiModel(value = "出口进场基本表", description = "")
|
||||
@MoreThan(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, field1 = "quantity", field2 = "eachQuantity", message = "数量不得超过单票件数")
|
||||
@DependsOn(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, field1 = "natureFlagName", fields = {"transferShipId", "transferShipName", "transferVoyageId", "transferVoyage"}, message = "货物性质为“正常”时,中转船ID,中转船名,中转航次ID,中转航次为空, 否则必填")
|
||||
@DependsOn(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, field1 = "natureFlagName", fields = {"transferShipId", "transferShipName", "transferVoyageId", "transferVoyage"}, message = "货物性质为“正常”时,中转船名,中转航次为空, 否则必填")
|
||||
public class ExportInVo implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "是否直接提交审核")
|
||||
|
@ -182,6 +181,14 @@ public class ExportInVo implements Serializable {
|
|||
@ApiModelProperty(value = "运输方式", required = true)
|
||||
private String transportWay;
|
||||
|
||||
@ApiModelProperty(value = "预进港时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date preArrivalTime;
|
||||
|
||||
@ApiModelProperty(value = "预靠泊时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date planArrivePortTime;
|
||||
|
||||
@ApiModelProperty(value = "进场开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date beginEnterTime;
|
||||
|
|
|
@ -47,7 +47,6 @@ public class ExportInspectCargoVo implements Serializable {
|
|||
*/
|
||||
@ApiModelProperty(value = "车架号", required = true)
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车架号/条码不能为空")
|
||||
@Size(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, min = 17, max = 17, message = "车架号长度为17位")
|
||||
private String vin;
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,7 @@ public class ExportInspectVo implements Serializable {
|
|||
* 航次
|
||||
*/
|
||||
@ApiModelProperty(value = "航次", required = true)
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次不能为空")
|
||||
// @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次不能为空")
|
||||
private String voyage;
|
||||
|
||||
/**
|
||||
|
@ -85,7 +85,7 @@ public class ExportInspectVo implements Serializable {
|
|||
* 公司名
|
||||
*/
|
||||
@ApiModelProperty(value = "公司名", required = true)
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "公司名不能为空")
|
||||
// @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "公司名不能为空")
|
||||
private String company;
|
||||
|
||||
@ApiModelProperty(value = "申请对象ID")
|
||||
|
@ -96,7 +96,7 @@ public class ExportInspectVo implements Serializable {
|
|||
* 申请对象(从基础数据库获取客户类型为进口货代的数据)
|
||||
*/
|
||||
@ApiModelProperty(value = "申请对象", required = true)
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审请对象不能为空")
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "申请对象不能为空")
|
||||
private String applyObj;
|
||||
|
||||
/**
|
||||
|
@ -144,7 +144,7 @@ public class ExportInspectVo implements Serializable {
|
|||
* 航次ID
|
||||
*/
|
||||
@ApiModelProperty(value = "航次ID")
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次ID不能为空")
|
||||
// @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次ID不能为空")
|
||||
private String voyageId;
|
||||
|
||||
@ApiModelProperty(value = "港区ID")
|
||||
|
|
|
@ -39,7 +39,6 @@ public class ExportLoadCargoVo implements Serializable {
|
|||
* 车架号/条码
|
||||
*/
|
||||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车架号/条码不能为空")
|
||||
@Size(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, min = 17, max = 17, message = "车架号长度为17位")
|
||||
@ApiModelProperty(value = "车架号/条码", required = true)
|
||||
private String vin;
|
||||
|
||||
|
|
|
@ -48,6 +48,12 @@ public class ExportLoadCheckVo implements Serializable {
|
|||
@NotNull(groups = {ValidationGroup.insert.class}, message = "审核状态不能为空")
|
||||
private AuditEnum checkStatus;
|
||||
|
||||
@ApiModelProperty("提单号")
|
||||
private List<String> billNos;
|
||||
|
||||
@ApiModelProperty(value = "是否为备件")
|
||||
private Boolean spare;
|
||||
|
||||
/**
|
||||
* 审核原因
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package com.haitonggauto.rtosc.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("出口查验检验")
|
||||
@Data
|
||||
public class InspectValidVo implements Serializable {
|
||||
|
||||
@ApiModelProperty("船ID")
|
||||
@NotBlank(message = "船ID不能为空")
|
||||
private String shipId;
|
||||
|
||||
@ApiModelProperty("提单号")
|
||||
@NotBlank(message = "提单号不能为空")
|
||||
private String billNo;
|
||||
|
||||
@ApiModelProperty("车架号")
|
||||
private List<String> vins;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.haitonggauto.rtosc.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
@ApiModel("船舶状态")
|
||||
public class ShipStatusVo {
|
||||
@ApiModelProperty("船ID")
|
||||
@NotBlank(message = "船ID不能为空")
|
||||
private String shipId;
|
||||
|
||||
@ApiModelProperty("航次ID")
|
||||
@NotBlank(message = "航次ID不能为空")
|
||||
private String voyageId;
|
||||
|
||||
@ApiModelProperty("0取消,1装船确认")
|
||||
@NotBlank(message = "状态不能为空,0取消,1装船确认")
|
||||
private String status;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.haitonggauto.rtosc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 出口进场货物表
|
||||
* @TableName customer_export_in_cargo
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "同步预靠泊时间",description = "")
|
||||
public class UpdatePlanArrivePortVo implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "船ID")
|
||||
@NotBlank(message = "船ID不能为空")
|
||||
private String shipId;
|
||||
|
||||
@ApiModelProperty(value = "航次ID")
|
||||
@NotBlank(message = "航次ID不能为空")
|
||||
private String voyageId;
|
||||
|
||||
@ApiModelProperty(value = "预靠泊时间")
|
||||
@NotNull(message = "预靠泊时间不能为空")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date planArrivePortTime;
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.haitonggauto.rtosc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.haitonggauto.rtosc.repository.enums.AuditEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出口进场货物表
|
||||
* @TableName customer_export_in_cargo
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "同步预进港时间",description = "")
|
||||
public class UpdatePreArrivalTimeVo implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "船ID")
|
||||
@NotBlank(message = "船ID不能为空")
|
||||
private String shipId;
|
||||
|
||||
@ApiModelProperty(value = "航次ID")
|
||||
@NotBlank(message = "航次ID不能为空")
|
||||
private String voyageId;
|
||||
|
||||
@ApiModelProperty(value = "原预进港时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date oldPreArrivalTime;
|
||||
|
||||
@ApiModelProperty(value = "预进港时间")
|
||||
@NotNull(message = "预进港时间不能为空")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date preArrivalTime;
|
||||
|
||||
@ApiModelProperty(value = "新航次名称")
|
||||
private String newVoyage;
|
||||
}
|
|
@ -19,10 +19,10 @@ public class UpdateVoyageVo implements Serializable {
|
|||
/**
|
||||
* 船名
|
||||
*/
|
||||
@Valid
|
||||
// @Valid
|
||||
@ApiModelProperty(value = "计划ID")
|
||||
@Size(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, min = 1, message = "计划ID不能为空")
|
||||
@NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "计划ID不能为空")
|
||||
// @Size(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, min = 1, message = "计划ID不能为空")
|
||||
// @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "计划ID不能为空")
|
||||
private List<Long> ids;
|
||||
|
||||
/**
|
||||
|
@ -39,4 +39,9 @@ public class UpdateVoyageVo implements Serializable {
|
|||
@NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次不能为空")
|
||||
private String voyage;
|
||||
|
||||
@ApiModelProperty(value = "提单号列表")
|
||||
private List<String> billNums;
|
||||
|
||||
@ApiModelProperty(value = "是否验证")
|
||||
private Boolean valid;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package com.haitonggauto.rtosc.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "验证车架号是否激活",description = "")
|
||||
public class ValidVinActivateVo implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "船ID")
|
||||
private String shipId;
|
||||
|
||||
/**
|
||||
* 受理号
|
||||
*/
|
||||
@ApiModelProperty(value = "航次ID")
|
||||
private String voyageId;
|
||||
|
||||
@ApiModelProperty(value = "车架号列表")
|
||||
@NotNull(message = "请传入车架号列表")
|
||||
@Size(min = 1, message = "车架号列表不能为空")
|
||||
private List<String> vins;
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.haitonggauto.rtosc.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel("提离港区导入")
|
||||
public class DepartureImportExcel {
|
||||
@ApiModelProperty("提单号")
|
||||
@ExcelProperty(value = "提单号")
|
||||
@NotBlank(message = "提单号不能为空")
|
||||
private String billNo;
|
||||
|
||||
@ApiModelProperty("车架号/备件号")
|
||||
@ExcelProperty(value = "车架号/备件号")
|
||||
@NotBlank(message = "车架号/备件号不能为空")
|
||||
private String vin;
|
||||
|
||||
@ApiModelProperty("车型")
|
||||
@ExcelProperty(value = "车型")
|
||||
private String cartType;
|
||||
|
||||
@ApiModelProperty(value = "型号")
|
||||
@ExcelProperty(value = "型号")
|
||||
private String models;
|
||||
|
||||
@ApiModelProperty(value = "长(米)")
|
||||
@ExcelProperty(value = "长(米)")
|
||||
private BigDecimal length;
|
||||
|
||||
@ApiModelProperty(value = "宽(米)")
|
||||
@ExcelProperty(value = "宽(米)")
|
||||
private BigDecimal width;
|
||||
|
||||
@ApiModelProperty(value = "高(米)")
|
||||
@ExcelProperty(value = "高(米)")
|
||||
private BigDecimal height;
|
||||
|
||||
@ApiModelProperty(value = "重量(kg)")
|
||||
@ExcelProperty(value = "重量(kg)")
|
||||
private BigDecimal weight;
|
||||
|
||||
@ApiModelProperty(value = "是否报关")
|
||||
@ExcelProperty(value = "是否报关")
|
||||
private String isCustoms;
|
||||
|
||||
@ApiModelProperty(value = "是否退关提离")
|
||||
@ExcelProperty(value = "是否退关提离")
|
||||
private String isShutout;
|
||||
|
||||
@ApiModelProperty(value = "是否随车备件")
|
||||
@ExcelProperty(value = "是否随车备件")
|
||||
private String isSpare;
|
||||
}
|
|
@ -9,23 +9,23 @@ import javax.validation.constraints.Size;
|
|||
@Data
|
||||
public class ExportInBillSpareExcel {
|
||||
|
||||
@ExcelProperty("*船名")
|
||||
@ExcelProperty(value = "*船名")
|
||||
@NotBlank(message = "船名不能为空")
|
||||
private String shipName;
|
||||
|
||||
@ExcelProperty("*航次")
|
||||
@ExcelProperty(value = "*航次")
|
||||
@NotBlank(message = "航次不能为空")
|
||||
private String voyage;
|
||||
|
||||
@ExcelProperty("*提单号")
|
||||
@ExcelProperty(value = "*提单号")
|
||||
@NotBlank(message = "提单号不能为空")
|
||||
private String billNo;
|
||||
|
||||
@ExcelProperty("*品牌")
|
||||
@ExcelProperty(value = "*品牌")
|
||||
@NotBlank(message = "品牌不能为空")
|
||||
private String brand;
|
||||
|
||||
@ExcelProperty("*备件号")
|
||||
@ExcelProperty(value = "*备件号")
|
||||
@NotBlank(message = "备件号不能为空")
|
||||
@Size(min = 17, max = 17, message = "备件号长度为17位")
|
||||
private String vin;
|
||||
|
|
|
@ -12,31 +12,31 @@ import java.math.BigDecimal;
|
|||
@Data
|
||||
public class ExportInCargoExportExcel {
|
||||
|
||||
@ExcelProperty("船名")
|
||||
@ExcelProperty(value = "船名")
|
||||
private String shipName;
|
||||
|
||||
@ExcelProperty("航次")
|
||||
@ExcelProperty(value = "航次")
|
||||
private String voyage;
|
||||
|
||||
@ExcelProperty("提单号")
|
||||
@ExcelProperty(value = "提单号")
|
||||
private String billNum;
|
||||
|
||||
@ExcelProperty("品牌")
|
||||
@ExcelProperty(value = "品牌")
|
||||
private String brand;
|
||||
|
||||
@ExcelProperty("型号")
|
||||
@ExcelProperty(value = "型号")
|
||||
private String models;
|
||||
|
||||
@ExcelProperty("车架号")
|
||||
@ExcelProperty(value = "车架号")
|
||||
private String vin;
|
||||
|
||||
@ExcelProperty("实际进港时间")
|
||||
@ExcelProperty(value = "实际进港时间")
|
||||
private String enterPortTime;
|
||||
|
||||
@ExcelProperty("场地")
|
||||
@ExcelProperty(value = "场地")
|
||||
private String position;
|
||||
|
||||
@ExcelProperty("港口")
|
||||
@ExcelProperty(value = "港口")
|
||||
private String portName;
|
||||
|
||||
}
|
|
@ -9,28 +9,27 @@ import javax.validation.constraints.Size;
|
|||
@Data
|
||||
public class ExportInExcel {
|
||||
|
||||
@ExcelProperty("*船名")
|
||||
@ExcelProperty(value = "*船名")
|
||||
@NotBlank(message = "船名不能为空")
|
||||
private String shipName;
|
||||
|
||||
@ExcelProperty("*航次")
|
||||
@ExcelProperty(value = "*航次")
|
||||
@NotBlank(message = "航次不能为空")
|
||||
private String voyage;
|
||||
|
||||
@ExcelProperty("*提单号")
|
||||
@ExcelProperty(value = "*提单号")
|
||||
@NotBlank(message = "提单号不能为空")
|
||||
private String billNo;
|
||||
|
||||
@ExcelProperty("*品牌")
|
||||
@ExcelProperty(value = "*品牌")
|
||||
@NotBlank(message = "品牌不能为空")
|
||||
private String brand;
|
||||
|
||||
@ExcelProperty("*型号")
|
||||
@ExcelProperty(value = "*型号")
|
||||
@NotBlank(message = "型号不能为空")
|
||||
private String models;
|
||||
|
||||
@ExcelProperty("*车架号")
|
||||
@ExcelProperty(value = "*车架号")
|
||||
@NotBlank(message = "车架号不能为空")
|
||||
@Size(min = 17, max = 17, message = "车架号长度为17位")
|
||||
private String vin;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public class ExportInExportExcel {
|
|||
@ExcelProperty("单票件数")
|
||||
private Integer eachQuantity;
|
||||
|
||||
@ExcelProperty("单票重量(吨)")
|
||||
@ExcelProperty("单票重量(千克)")
|
||||
private BigDecimal eachWeight;
|
||||
|
||||
@ExcelProperty("单票体积")
|
||||
|
|
|
@ -37,45 +37,45 @@ import java.util.Date;
|
|||
* 19.源类型必须是是新能源、不是新能源,否则的导入不成功
|
||||
*/
|
||||
@Data
|
||||
@DependsOn(field1 = "natureFlagName", fields = {"transferShipName", "transferVoyage"}, message = "货物性质为“正常”时,中转船ID,中转船名,中转航次ID,中转航次为空, 否则必填")
|
||||
@DependsOn(field1 = "natureFlagName", fields = {"transferShipName", "transferVoyage"}, message = "货物性质为“正常”时,中转船名,中转航次为空, 否则必填")
|
||||
public class ExportInPlanExcel {
|
||||
|
||||
/**
|
||||
* 港区
|
||||
*/
|
||||
@ExcelProperty("*港区")
|
||||
@ExcelProperty(value = "*港区")
|
||||
@NotBlank(message = "港区不能为空")
|
||||
private String portArea;
|
||||
|
||||
/**
|
||||
* 船名
|
||||
*/
|
||||
@ExcelProperty("*船名")
|
||||
@ExcelProperty(value = "*船名")
|
||||
@NotBlank(message = "船名不能为空")
|
||||
private String shipName;
|
||||
|
||||
/**
|
||||
* 航次
|
||||
*/
|
||||
@ExcelProperty("*航次")
|
||||
@ExcelProperty(value = "*航次")
|
||||
@NotBlank(message = "航次不能为空")
|
||||
private String voyage;
|
||||
|
||||
@ExcelProperty("*货物性质")
|
||||
@ExcelProperty(value = "*货物性质")
|
||||
@NotBlank(message = "货物性质不能为空")
|
||||
private String natureFlagName;
|
||||
|
||||
@ExcelProperty("中转进口船名")
|
||||
@ExcelProperty(value = "中转进口船名")
|
||||
private String transferShipName;
|
||||
|
||||
@ExcelProperty("中转进口航次")
|
||||
@ExcelProperty(value = "中转进口航次")
|
||||
private String transferVoyage;
|
||||
|
||||
|
||||
/**
|
||||
* 货代
|
||||
*/
|
||||
@ExcelProperty("*货代")
|
||||
@ExcelProperty(value = "*货代")
|
||||
@NotBlank(message = "货代不能为空")
|
||||
private String freight;
|
||||
|
||||
|
@ -83,36 +83,43 @@ public class ExportInPlanExcel {
|
|||
/**
|
||||
* 联系人
|
||||
*/
|
||||
@ExcelProperty("*联系人")
|
||||
@ExcelProperty(value = "*联系人")
|
||||
@NotBlank(message = "联系人不能为空")
|
||||
private String contact;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
@ExcelProperty("*联系方式")
|
||||
@ExcelProperty(value = "*联系方式")
|
||||
@NotBlank(message = "联系方式不能为空")
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 港口
|
||||
*/
|
||||
@ExcelProperty("*港口")
|
||||
@ExcelProperty(value = "*国家")
|
||||
@NotBlank(message = "国家不能为空")
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* 港口
|
||||
*/
|
||||
@ExcelProperty(value = "*港口")
|
||||
@NotBlank(message = "港口不能为空")
|
||||
private String portName;
|
||||
|
||||
/**
|
||||
* 运输方式
|
||||
*/
|
||||
@ExcelProperty("*运输方式")
|
||||
@ExcelProperty(value = "*运输方式")
|
||||
@NotBlank(message = "运输方式不能为空")
|
||||
private String transportWay;
|
||||
|
||||
@ExcelProperty("*进场开始日期")
|
||||
@ExcelProperty(value = "*进场开始日期")
|
||||
@NotBlank(message = "进场开始日期不能为空")
|
||||
private String beginEnterTime;
|
||||
|
||||
@ExcelProperty("*进场结束日期")
|
||||
@ExcelProperty(value = "*进场结束日期")
|
||||
@NotBlank(message = "进场结束日期不能为空")
|
||||
private String endEnterTime;
|
||||
|
||||
|
@ -120,26 +127,26 @@ public class ExportInPlanExcel {
|
|||
* 进场时间
|
||||
*/
|
||||
// @DateTimeFormat("yyyy-MM-dd HH:mm")
|
||||
@ExcelProperty("进场时间")
|
||||
@ExcelProperty(value = "进场时间")
|
||||
private String enterTime;
|
||||
|
||||
/**
|
||||
* 进场数量
|
||||
*/
|
||||
@ExcelProperty("进场数量")
|
||||
@ExcelProperty(value = "进场数量")
|
||||
private Integer enterQuantity;
|
||||
|
||||
/**
|
||||
* 提单号
|
||||
*/
|
||||
@ExcelProperty("*提单号")
|
||||
@ExcelProperty(value = "*提单号")
|
||||
@NotBlank(message = "提单号不能为空")
|
||||
private String billNum;
|
||||
|
||||
/**
|
||||
* 单票数量
|
||||
*/
|
||||
@ExcelProperty("*单票件数")
|
||||
@ExcelProperty(value = "*单票件数")
|
||||
@NotNull(message = "单票件数不能为空")
|
||||
private Integer eachQuantity;
|
||||
|
||||
|
@ -153,7 +160,7 @@ public class ExportInPlanExcel {
|
|||
/**
|
||||
* 单票体积
|
||||
*/
|
||||
@ExcelProperty("*单票体积")
|
||||
@ExcelProperty(value = "*单票体积")
|
||||
@NotNull(message = "单票体积不能为空")
|
||||
@NumberFormat("#.####")
|
||||
private BigDecimal eachVolume;
|
||||
|
@ -161,7 +168,7 @@ public class ExportInPlanExcel {
|
|||
/**
|
||||
* 单票重量
|
||||
*/
|
||||
@ExcelProperty("*单票重量(吨)")
|
||||
@ExcelProperty(value = "*单票重量(千克)")
|
||||
@NotNull(message = "单票重量不能为空")
|
||||
@NumberFormat("#.####")
|
||||
private BigDecimal eachWeight;
|
||||
|
@ -169,49 +176,49 @@ public class ExportInPlanExcel {
|
|||
/**
|
||||
* 品牌
|
||||
*/
|
||||
@ExcelProperty("*品牌")
|
||||
@ExcelProperty(value = "*品牌")
|
||||
@NotBlank(message = "品牌不能为空")
|
||||
private String brand;
|
||||
|
||||
/**
|
||||
* 车型
|
||||
*/
|
||||
@ExcelProperty("*车型")
|
||||
@ExcelProperty(value = "*车型")
|
||||
@NotBlank(message = "车型不能为空")
|
||||
private String cartType;
|
||||
|
||||
/**
|
||||
* 车型明细
|
||||
*/
|
||||
@ExcelProperty("*车型明细")
|
||||
@ExcelProperty(value = "*车型明细")
|
||||
@NotBlank(message = "车型明细不能为空")
|
||||
private String cartTypeDetail;
|
||||
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
@ExcelProperty("*型号")
|
||||
@ExcelProperty(value = "*型号")
|
||||
@NotBlank(message = "型号不能为空")
|
||||
private String models;
|
||||
|
||||
/**
|
||||
* 产地
|
||||
*/
|
||||
@ExcelProperty("*产地")
|
||||
@ExcelProperty(value = "*产地")
|
||||
@NotBlank(message = "产地不能为空")
|
||||
private String originPlace;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@ExcelProperty("*数量")
|
||||
@ExcelProperty(value = "*数量")
|
||||
@NotNull(message = "数量不能为空")
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 长
|
||||
*/
|
||||
@ExcelProperty("*长")
|
||||
@ExcelProperty(value = "*长")
|
||||
@NotNull(message = "长不能为空")
|
||||
@NumberFormat("#.####")
|
||||
private BigDecimal length;
|
||||
|
@ -219,7 +226,7 @@ public class ExportInPlanExcel {
|
|||
/**
|
||||
* 宽
|
||||
*/
|
||||
@ExcelProperty("*宽")
|
||||
@ExcelProperty(value = "*宽")
|
||||
@NotNull(message = "宽不能为空")
|
||||
@NumberFormat("#.####")
|
||||
private BigDecimal width;
|
||||
|
@ -227,7 +234,7 @@ public class ExportInPlanExcel {
|
|||
/**
|
||||
* 高
|
||||
*/
|
||||
@ExcelProperty("*高")
|
||||
@ExcelProperty(value = "*高")
|
||||
@NotNull(message = "高不能为空")
|
||||
@NumberFormat("#.####")
|
||||
private BigDecimal height;
|
||||
|
@ -235,34 +242,37 @@ public class ExportInPlanExcel {
|
|||
/**
|
||||
* 重量(吨)
|
||||
*/
|
||||
@ExcelProperty("*重量(吨)")
|
||||
@ExcelProperty(value = "*重量(吨)")
|
||||
@NotNull(message = "重量不能为空")
|
||||
@NumberFormat("#.####")
|
||||
private BigDecimal weight;
|
||||
|
||||
@ExcelProperty("*体积")
|
||||
@ExcelProperty(value = "*体积")
|
||||
@ApiModelProperty(value = "体积")
|
||||
private BigDecimal volume;
|
||||
|
||||
/**
|
||||
* 操作模式
|
||||
*/
|
||||
@ExcelProperty("*操作模式")
|
||||
@ExcelProperty(value = "*操作模式")
|
||||
@NotBlank(message = "操作模式不能为空")
|
||||
private String operateType;
|
||||
|
||||
@NotBlank(message = "特殊作业不能为空")
|
||||
@ExcelProperty("*特殊作业")
|
||||
@ExcelProperty(value = "*特殊作业")
|
||||
private String specWork;
|
||||
|
||||
/**
|
||||
* 源类型
|
||||
*/
|
||||
@ExcelProperty("*能源类型")
|
||||
@NotBlank(message = "*能源类型不能为空")
|
||||
@ExcelProperty(value = "*能源类型")
|
||||
// @NotBlank(message = "*能源类型不能为空")
|
||||
private String energyTypeName;
|
||||
|
||||
@ExcelProperty("*是否二手车")
|
||||
@NotBlank(message = "是否是二手车不能为空")
|
||||
@ExcelProperty(value = "*是否二手车")
|
||||
// @NotBlank(message = "是否是二手车不能为空")
|
||||
private String secondHand;
|
||||
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
}
|
|
@ -22,7 +22,7 @@ public class ExportInSpareExcel {
|
|||
@NotBlank(message = "备件号不能为空")
|
||||
@Size(min = 17, max = 17, message = "备件号长度为17位")
|
||||
@ApiModelProperty(value = "备件号")
|
||||
@ExcelProperty("*备件号")
|
||||
@ExcelProperty(value = "*备件号")
|
||||
private String vin;
|
||||
|
||||
}
|
|
@ -9,28 +9,27 @@ import javax.validation.constraints.Size;
|
|||
@Data
|
||||
public class ExportLoadExcel {
|
||||
|
||||
@ExcelProperty("*船名")
|
||||
@ExcelProperty(value = "*船名")
|
||||
@NotBlank(message = "船名不能为空")
|
||||
private String shipName;
|
||||
|
||||
@ExcelProperty("*航次")
|
||||
@ExcelProperty(value = "*航次")
|
||||
@NotBlank(message = "航次不能为空")
|
||||
private String voyage;
|
||||
|
||||
@ExcelProperty("*提单号")
|
||||
@ExcelProperty(value = "*提单号")
|
||||
@NotBlank(message = "提单号不能为空")
|
||||
private String billNo;
|
||||
|
||||
@ExcelProperty("*车架号")
|
||||
@ExcelProperty(value = "*车架号")
|
||||
@NotBlank(message = "车架号不能为空")
|
||||
@Size(min = 17, max = 17, message = "车架号长度为17位")
|
||||
private String vin;
|
||||
|
||||
@ExcelProperty(value = "*目的港")
|
||||
@NotBlank(message = "车架号不能为空")
|
||||
@NotBlank(message = "目的港不能为空")
|
||||
private String destPort;
|
||||
|
||||
@ExcelProperty("*品牌")
|
||||
@ExcelProperty(value = "*品牌")
|
||||
@NotBlank(message = "品牌不能为空")
|
||||
private String brand;
|
||||
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
package com.haitonggauto.rtosc.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel("出口装船导出")
|
||||
@Data
|
||||
public class ExportLoadExportExcel implements Serializable {
|
||||
@ApiModelProperty(value = "中文船名")
|
||||
@ExcelProperty("船名")
|
||||
private String shipName;
|
||||
|
||||
@ApiModelProperty(value = "航次")
|
||||
@ExcelProperty("船名")
|
||||
private String voyage;
|
||||
|
||||
@ApiModelProperty(value = "货物性质名称")
|
||||
@ExcelProperty("货物性质")
|
||||
private String natureFlagName;
|
||||
|
||||
@ApiModelProperty(value = "中转进口船名")
|
||||
@ExcelProperty("中转进口船名")
|
||||
private String transferShipName;
|
||||
|
||||
@ApiModelProperty(value = "中转进口航次")
|
||||
@ExcelProperty("中转进口航次")
|
||||
private String transferVoyage;
|
||||
|
||||
@ApiModelProperty(value = "提单号")
|
||||
@ExcelProperty("提单号")
|
||||
private String billNo;
|
||||
|
||||
@ApiModelProperty(value = "品牌")
|
||||
@ExcelProperty("品牌")
|
||||
private String brand;
|
||||
|
||||
@ApiModelProperty(value = "目的港")
|
||||
@ExcelProperty("目的港")
|
||||
private String destPort;
|
||||
|
||||
@ApiModelProperty(value = "车架号")
|
||||
@ExcelProperty("车架号")
|
||||
private String vin;
|
||||
|
||||
@ApiModelProperty(value = "结算单位")
|
||||
@ExcelProperty("结算单位")
|
||||
private String settleCompName;
|
||||
|
||||
@ApiModelProperty(value = "联系人")
|
||||
@ExcelProperty("联系人")
|
||||
private String contact;
|
||||
|
||||
@ApiModelProperty(value = "联系方式")
|
||||
@ExcelProperty("联系方式")
|
||||
private String contactPhone;
|
||||
}
|
|
@ -9,59 +9,58 @@ import javax.validation.constraints.NotBlank;
|
|||
import javax.validation.constraints.Size;
|
||||
|
||||
@Data
|
||||
@DependsOn(field1 = "natureFlagName", fields = {"transferShipName", "transferVoyage"}, message = "货物性质为“正常”时,中转船ID,中转船名,中转航次ID,中转航次为空, 否则必填")
|
||||
@DependsOn(field1 = "natureFlagName", fields = {"transferShipName", "transferVoyage"}, message = "货物性质为“正常”时,中转船名,中转航次为空, 否则必填")
|
||||
public class ExportLoadInsideExcel {
|
||||
|
||||
@ExcelProperty("*船名")
|
||||
@ExcelProperty(value = "*船名")
|
||||
@NotBlank(message = "船名不能为空")
|
||||
private String shipName;
|
||||
|
||||
@ExcelProperty("*航次")
|
||||
@ExcelProperty(value = "*航次")
|
||||
@NotBlank(message = "航次不能为空")
|
||||
private String voyage;
|
||||
|
||||
@ExcelProperty("*货物性质")
|
||||
@ExcelProperty(value = "*货物性质")
|
||||
@NotBlank(message = "货物性质不能为空")
|
||||
private String natureFlagName;
|
||||
|
||||
@ExcelProperty("中转进口船名")
|
||||
@ExcelProperty(value = "中转进口船名")
|
||||
private String transferShipName;
|
||||
|
||||
@ExcelProperty("中转进口航次")
|
||||
@ExcelProperty(value = "中转进口航次")
|
||||
private String transferVoyage;
|
||||
|
||||
@ExcelProperty("*港区")
|
||||
@NotBlank(message = "港区不能为空")
|
||||
private String portArea;
|
||||
// @ExcelProperty("*港区")
|
||||
// @NotBlank(message = "港区不能为空")
|
||||
// private String portArea;
|
||||
|
||||
@ExcelProperty("*提单号")
|
||||
@ExcelProperty(value = "*提单号")
|
||||
@NotBlank(message = "提单号不能为空")
|
||||
private String billNo;
|
||||
|
||||
@ExcelProperty("*品牌")
|
||||
@ExcelProperty(value = "*品牌")
|
||||
@NotBlank(message = "品牌不能为空")
|
||||
private String brand;
|
||||
|
||||
@ExcelProperty("*目的港")
|
||||
@ExcelProperty(value = "*目的港")
|
||||
@NotBlank(message = "目的港不能为空")
|
||||
private String destPort;
|
||||
|
||||
@ExcelProperty("*车架号")
|
||||
@ExcelProperty(value = "*车架号")
|
||||
@NotBlank(message = "车架号不能为空")
|
||||
@Size(min = 17, max = 17, message = "车架号长度为17位")
|
||||
private String vin;
|
||||
|
||||
@ExcelProperty("*结算单位")
|
||||
@ExcelProperty(value = "*结算单位")
|
||||
@ApiModelProperty(value = "结算单位")
|
||||
@NotBlank(message = "结算单位不能为空")
|
||||
private String settleCompName;
|
||||
|
||||
@ExcelProperty("*联系人")
|
||||
@ExcelProperty(value = "*联系人")
|
||||
@ApiModelProperty(value = "联系人")
|
||||
@NotBlank(message = "联系人不能为空")
|
||||
private String contact;
|
||||
|
||||
@ExcelProperty("*联系方式")
|
||||
@ExcelProperty(value = "*联系方式")
|
||||
@ApiModelProperty(value = "联系方式")
|
||||
@NotBlank(message = "联系方式不能为空")
|
||||
private String contactPhone;
|
||||
|
|
|
@ -10,27 +10,27 @@ import javax.validation.constraints.Size;
|
|||
@Data
|
||||
public class ExportLoadSpareExcel {
|
||||
|
||||
@ExcelProperty("*船名")
|
||||
@ExcelProperty(value = "*船名")
|
||||
@NotBlank(message = "船名不能为空")
|
||||
private String shipName;
|
||||
|
||||
@ExcelProperty("*航次")
|
||||
@ExcelProperty(value = "*航次")
|
||||
@NotBlank(message = "航次不能为空")
|
||||
private String voyage;
|
||||
|
||||
@ExcelProperty("*提单号")
|
||||
@ExcelProperty(value = "*提单号")
|
||||
@NotBlank(message = "提单号不能为空")
|
||||
private String billNo;
|
||||
|
||||
@ExcelProperty(value = "*目的港")
|
||||
@NotBlank(message = "车架号不能为空")
|
||||
@NotBlank(message = "目的港不能为空")
|
||||
private String destPort;
|
||||
|
||||
@ExcelProperty("*品牌")
|
||||
@ExcelProperty(value = "*品牌")
|
||||
@NotBlank(message = "品牌不能为空")
|
||||
private String brand;
|
||||
|
||||
@ExcelProperty("*数量")
|
||||
@ExcelProperty(value = "*数量")
|
||||
@NotNull(message = "数量不能为空")
|
||||
private Integer num;
|
||||
|
||||
|
|
|
@ -22,16 +22,15 @@ public class ExportVinExcel {
|
|||
*/
|
||||
@ApiModelProperty(value = "提单号")
|
||||
@NotBlank(message = "提单号不能为空")
|
||||
@ExcelProperty("*提单号")
|
||||
@ExcelProperty(value = "*提单号")
|
||||
private String billNo;
|
||||
|
||||
/**
|
||||
* 船名
|
||||
*/
|
||||
@NotBlank(message = "车架号不能为空")
|
||||
@Size(min = 17, max = 17, message = "车架号长度为17位")
|
||||
@ApiModelProperty(value = "车架号")
|
||||
@ExcelProperty("*车架号")
|
||||
@ExcelProperty(value = "*车架号")
|
||||
private String vin;
|
||||
|
||||
}
|
|
@ -18,104 +18,125 @@ public class FreeTradeExcel {
|
|||
* 港区
|
||||
*/
|
||||
@NotBlank(message = "港区不能为空")
|
||||
@ExcelProperty("*港区")
|
||||
@ExcelProperty(value = "*港区")
|
||||
@ApiModelProperty(value = "港区")
|
||||
private String portArea;
|
||||
|
||||
/**
|
||||
* 船名
|
||||
*/
|
||||
@ExcelProperty(value = "*船名")
|
||||
@NotBlank(message = "船名不能为空")
|
||||
private String shipName;
|
||||
|
||||
/**
|
||||
* 航次
|
||||
*/
|
||||
@ExcelProperty(value = "*航次")
|
||||
@NotBlank(message = "航次不能为空")
|
||||
private String voyage;
|
||||
|
||||
// 批次号
|
||||
@ApiModelProperty(value = "批次号")
|
||||
@NotBlank(message = "批次号不能为空")
|
||||
@ExcelProperty("批次号")
|
||||
@ExcelProperty(value = "批次号")
|
||||
private String batchNo;
|
||||
|
||||
// 企业编码
|
||||
@ApiModelProperty(value = "企业编码")
|
||||
@NotBlank(message = "企业编码不能为空")
|
||||
@ExcelProperty("*企业编码")
|
||||
@ExcelProperty(value = "*企业编码")
|
||||
private String companyCode;
|
||||
|
||||
// 企业社会信用代码
|
||||
@ApiModelProperty(value = "企业社会信用代码")
|
||||
@NotBlank(message = "企业社会信用代码不能为空")
|
||||
@ExcelProperty("*企业社会信用代码")
|
||||
@ExcelProperty(value = "*企业社会信用代码")
|
||||
private String companySocialCode;
|
||||
|
||||
// 企业名称
|
||||
@ApiModelProperty(value = "企业名称")
|
||||
@NotBlank(message = "企业名称不能为空")
|
||||
@ExcelProperty("*企业名称")
|
||||
@ExcelProperty(value = "*企业名称")
|
||||
private String companyName;
|
||||
|
||||
// 企业所在国家
|
||||
@ApiModelProperty(value = "企业所在国家")
|
||||
@NotBlank(message = "企业所在国家不能为空")
|
||||
@ExcelProperty("*企业所在国家")
|
||||
@ExcelProperty(value = "*企业所在国家")
|
||||
private String country;
|
||||
|
||||
// 企业所在城市
|
||||
@ApiModelProperty(value = "企业所在城市")
|
||||
@NotBlank(message = "企业所在城市不能为空")
|
||||
@ExcelProperty("*企业所在城市")
|
||||
@ExcelProperty(value = "*企业所在城市")
|
||||
private String city;
|
||||
|
||||
// 商品料号
|
||||
/**
|
||||
* 商品料号
|
||||
*/
|
||||
@ApiModelProperty(value = "商品料号")
|
||||
@NotBlank(message = "商品料号不能为空")
|
||||
@ExcelProperty("*商品料号")
|
||||
@ExcelProperty(value = "*商品料号")
|
||||
private String cargoItemNo;
|
||||
|
||||
// 商品料号
|
||||
@ApiModelProperty(value = "商品编码")
|
||||
@NotBlank(message = "商品编码不能为空")
|
||||
@ExcelProperty(value = "*商品编码")
|
||||
private String cargoCode;
|
||||
|
||||
// 商品名称
|
||||
@ApiModelProperty(value = "商品名称")
|
||||
@NotBlank(message = "商品名称不能为空")
|
||||
@ExcelProperty("*商品名称")
|
||||
@ExcelProperty(value = "*商品名称")
|
||||
private String cargoName;
|
||||
|
||||
// 规格型号
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
@NotBlank(message = "规格型号不能为空")
|
||||
@ExcelProperty("*规格型号")
|
||||
@ExcelProperty(value = "*规格型号")
|
||||
private String spec;
|
||||
|
||||
// 币制
|
||||
@ApiModelProperty(value = "币制")
|
||||
@NotBlank(message = "币制不能为空")
|
||||
@ExcelProperty("*币制")
|
||||
@ExcelProperty(value = "*币制")
|
||||
private String currency;
|
||||
|
||||
// 总价
|
||||
@ApiModelProperty(value = "总价")
|
||||
@NotNull(message = "总价不能为空")
|
||||
@ExcelProperty("*总价")
|
||||
@ExcelProperty(value = "*总价")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
// 净重
|
||||
@ApiModelProperty(value = "净重")
|
||||
@NotNull(message = "净重不能为空")
|
||||
@ExcelProperty("*净重")
|
||||
@ExcelProperty(value = "*净重")
|
||||
private BigDecimal netWeight;
|
||||
|
||||
// 申报计量单位
|
||||
@ApiModelProperty(value = "申报计量单位")
|
||||
@NotBlank(message = "申报计量单位不能为空")
|
||||
@ExcelProperty("*申报计量单位")
|
||||
@ExcelProperty(value = "*申报计量单位")
|
||||
private String unitMeasure;
|
||||
|
||||
// 法定单位
|
||||
@ApiModelProperty(value = "法定单位")
|
||||
@NotBlank(message = "法定单位不能为空")
|
||||
@ExcelProperty("*法定单位")
|
||||
@ExcelProperty(value = "*法定单位")
|
||||
private String unitLegal;
|
||||
|
||||
// 原产国(地区)
|
||||
@ApiModelProperty(value = "原产国")
|
||||
@NotBlank(message = "原产国不能为空")
|
||||
@ExcelProperty("*原产国(地区)")
|
||||
@ExcelProperty(value = "*原产国(地区)")
|
||||
private String originArea;
|
||||
|
||||
// 车架号
|
||||
@ApiModelProperty(value = "车架号")
|
||||
@NotBlank(message = "车架号不能为空")
|
||||
@Size(min = 17, max = 17, message = "车架号长度为17位")
|
||||
@ExcelProperty("*车架号")
|
||||
@ExcelProperty(value = "*车架号")
|
||||
private String vin;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,5 @@ public class ImportUnloadExcel {
|
|||
|
||||
@ExcelProperty("*车架号")
|
||||
@NotBlank(message = "车架号不能为空")
|
||||
@Size(min = 17, max = 17, message = "车架号长度为17位")
|
||||
private String vin;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package com.haitonggauto.rtosc.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ApiModel("查验导入")
|
||||
public class InspectExcel {
|
||||
/**
|
||||
* 港区
|
||||
*/
|
||||
@ExcelProperty(value = "*港区")
|
||||
@NotBlank(message = "港区不能为空")
|
||||
private String portArea;
|
||||
|
||||
/**
|
||||
* 船名
|
||||
*/
|
||||
@ExcelProperty(value = "*船名")
|
||||
@NotBlank(message = "船名不能为空")
|
||||
private String shipName;
|
||||
|
||||
@ApiModelProperty(value = "航次")
|
||||
@ExcelProperty(index = 2)
|
||||
private String voyage;
|
||||
|
||||
@ExcelProperty(value = "*提单号")
|
||||
@NotBlank(message = "提单号不能为空")
|
||||
private String billNo;
|
||||
|
||||
@ApiModelProperty(value = "报关单号")
|
||||
private String passport;
|
||||
|
||||
@ApiModelProperty(value = "*查验日期")
|
||||
@NotNull(message = "查验日期不能为空")
|
||||
private Date inspectTime;
|
||||
|
||||
@ApiModelProperty(value = "公司名")
|
||||
private String company;
|
||||
|
||||
@ApiModelProperty(value = "*联系人")
|
||||
@NotBlank(message = "联系人不能为空")
|
||||
private String contact;
|
||||
|
||||
@ApiModelProperty(value = "*联系电话")
|
||||
@NotBlank(message = "联系电话不能为空")
|
||||
private String contactPhone;
|
||||
|
||||
@ApiModelProperty(value = "*车架号/备件号")
|
||||
@NotBlank(message = "车架号/备件号不能为空")
|
||||
private String vin;
|
||||
}
|
|
@ -19,4 +19,11 @@ public class CargoQuery extends BaseQuery {
|
|||
|
||||
@ApiModelProperty(value = "品牌ID")
|
||||
private String brandId;
|
||||
|
||||
@ApiModelProperty(value = "提单号")
|
||||
@DbQuery(field = "select id from customer_export_load where export_load_id=customer_export_load.id and bill_no like {0}", symbol = SqlSymbol.EXISTS)
|
||||
private String billNum;
|
||||
|
||||
@ApiModelProperty(value = "是否填充车辆状态")
|
||||
private Boolean vinStatus;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.haitonggauto.rtosc.query;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "货物明细查询")
|
||||
public class CargoVinQuery {
|
||||
@ApiModelProperty(value = "车架号")
|
||||
private String vin;
|
||||
|
||||
@ApiModelProperty("提单号")
|
||||
private String billNum;
|
||||
}
|
|
@ -8,6 +8,7 @@ import com.haitonggauto.rtosc.repository.enums.AuditEnum;
|
|||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -42,11 +43,13 @@ public class DepartureQuery extends BaseQuery {
|
|||
private String batchNo;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "开始申请时间")
|
||||
@DbQuery(field = "applyTime", symbol = SqlSymbol.GTE)
|
||||
private Date beginApplyTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "结束申请时间")
|
||||
@DbQuery(field = "applyTime", symbol = SqlSymbol.LTE)
|
||||
private Date endApplyTime;
|
||||
|
@ -71,6 +74,22 @@ public class DepartureQuery extends BaseQuery {
|
|||
@ApiModelProperty(value = "港区ID")
|
||||
private String portAreaId;
|
||||
|
||||
@ApiModelProperty(value = "提单号")
|
||||
@DbQuery(field = "select id from customer_departure_cargo where departure_id=customer_departure.id and bill_no like {0}", symbol = SqlSymbol.EXISTS)
|
||||
private String billNum;
|
||||
|
||||
@ApiModelProperty(value = "精确提单号")
|
||||
@DbQuery(field = "select id from customer_departure_cargo where departure_id=customer_departure.id and bill_no={0}", symbol = SqlSymbol.EXISTS)
|
||||
private String billNumAccurate;
|
||||
|
||||
@ApiModelProperty(value = "品牌ID")
|
||||
// @DbQuery(field = "select id from customer_departure_cargo where departure_id=customer_departure.id and brand_id={0}", symbol = SqlSymbol.EXISTS)
|
||||
private String brandId;
|
||||
|
||||
@ApiModelProperty(value = "车架号")
|
||||
@DbQuery(field = "select id from customer_departure_cargo where departure_id=customer_departure.id and vin like {0}", symbol = SqlSymbol.EXISTS)
|
||||
private String vin;
|
||||
|
||||
@ApiModelProperty(value = "港区ID集合")
|
||||
@DbQuery(field = "portAreaId", symbol = SqlSymbol.IN)
|
||||
private List<String> pamIds;
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.haitonggauto.rtosc.query;
|
||||
|
||||
import com.haitonggauto.rtosc.common.db.query.BaseQuery;
|
||||
import com.haitonggauto.rtosc.repository.enums.AuditEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "出口进港查询")
|
||||
public class ExportInBathCheckQuery extends BaseQuery {
|
||||
|
||||
@ApiModelProperty(value = "船ID")
|
||||
private String shipId;
|
||||
|
||||
@ApiModelProperty(value = "航次ID")
|
||||
private String voyageId;
|
||||
|
||||
@ApiModelProperty(value = "港区ID")
|
||||
private String portAreaId;
|
||||
|
||||
@ApiModelProperty(value = "审核状态")
|
||||
@NotNull(message = "审核状态不能为空")
|
||||
private AuditEnum checkStatus;
|
||||
|
||||
}
|
|
@ -56,12 +56,12 @@ public class ExportInCheckQuery extends BaseQuery {
|
|||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "开始进场时间")
|
||||
@DbQuery(field = "beginEnterTime", symbol = SqlSymbol.GTE)
|
||||
@DbQuery(field = "beginEnterTime", symbol = SqlSymbol.LTE)
|
||||
private Date beginEnterTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "结束进场时间")
|
||||
@DbQuery(field = "endEnterTime", symbol = SqlSymbol.LTE)
|
||||
@DbQuery(field = "endEnterTime", symbol = SqlSymbol.GTE)
|
||||
private Date endEnterTime;
|
||||
|
||||
@ApiModelProperty(value = "贸易类型")
|
||||
|
@ -90,6 +90,10 @@ public class ExportInCheckQuery extends BaseQuery {
|
|||
@DbQuery(symbol = SqlSymbol.LIKE)
|
||||
private String billNum;
|
||||
|
||||
@ApiModelProperty(value = "精确提单号")
|
||||
@DbQuery(field = "billNum")
|
||||
private String billNumAccurate;
|
||||
|
||||
@ApiModelProperty(value = "受理号")
|
||||
@DbQuery(symbol = SqlSymbol.LIKE)
|
||||
private String batchNo;
|
||||
|
@ -101,6 +105,7 @@ public class ExportInCheckQuery extends BaseQuery {
|
|||
private String freightId;
|
||||
|
||||
@ApiModelProperty(value = "车架号")
|
||||
@DbQuery(field = "select id from customer_export_in_cargo where export_in_id=customer_export_in.id and vin like {0}", symbol = SqlSymbol.EXISTS)
|
||||
private String vin;
|
||||
|
||||
@ApiModelProperty(value = "国家Id")
|
||||
|
@ -109,12 +114,18 @@ public class ExportInCheckQuery extends BaseQuery {
|
|||
@ApiModelProperty(value = "港口ID")
|
||||
private String portId;
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
@DbQuery(field = "vin", symbol = SqlSymbol.IN)
|
||||
private List<String> vins;
|
||||
@ApiModelProperty(value = "联系人")
|
||||
@DbQuery(symbol = SqlSymbol.LIKE)
|
||||
private String contact;
|
||||
|
||||
// 明细表查询时会用到
|
||||
@ApiModelProperty(hidden = true)
|
||||
private Long exportInId;
|
||||
|
||||
@ApiModelProperty(value = "是否加载车架号列表")
|
||||
private Boolean vinStatus;
|
||||
|
||||
@ApiModelProperty(value = "是否调用车架号状态接口")
|
||||
private Boolean vinStatusApi;
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.haitonggauto.rtosc.repository.enums.AuditEnum;
|
|||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -34,11 +35,13 @@ public class ExportInQuery extends BaseQuery {
|
|||
private String portAreaId;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "开始进场时间")
|
||||
@DbQuery(field = "applyTime", symbol = SqlSymbol.GTE)
|
||||
private Date beginEnterTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "结束进场时间")
|
||||
@DbQuery(field = "applyTime", symbol = SqlSymbol.LTE)
|
||||
private Date endEnterTime;
|
||||
|
@ -63,6 +66,10 @@ public class ExportInQuery extends BaseQuery {
|
|||
@DbQuery(symbol = SqlSymbol.LIKE)
|
||||
private String billNum;
|
||||
|
||||
@ApiModelProperty(value = "精确提单号")
|
||||
@DbQuery(field = "billNum")
|
||||
private String billNumAccurate;
|
||||
|
||||
@ApiModelProperty(value = "受理号")
|
||||
@DbQuery(symbol = SqlSymbol.LIKE)
|
||||
private String batchNo;
|
||||
|
@ -76,9 +83,16 @@ public class ExportInQuery extends BaseQuery {
|
|||
@ApiModelProperty(value = "港口ID")
|
||||
private String portId;
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
@DbQuery(field = "vin", symbol = SqlSymbol.IN)
|
||||
private List<String> vins;
|
||||
@ApiModelProperty(value = "货代ID")
|
||||
private String freightId;
|
||||
|
||||
@ApiModelProperty(value = "联系人")
|
||||
@DbQuery(symbol = SqlSymbol.LIKE)
|
||||
private String contact;
|
||||
|
||||
@ApiModelProperty(value = "车架号")
|
||||
@DbQuery(field = "select id from customer_export_in_cargo where export_in_id=customer_export_in.id and vin like {0}", symbol = SqlSymbol.EXISTS)
|
||||
private String vin;
|
||||
|
||||
// 明细表查询时会用到
|
||||
@ApiModelProperty(hidden = true)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.haitonggauto.rtosc.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.haitonggauto.rtosc.common.db.anno.DbQuery;
|
||||
import com.haitonggauto.rtosc.common.db.enums.SqlSymbol;
|
||||
import com.haitonggauto.rtosc.common.db.query.BaseQuery;
|
||||
|
@ -7,7 +8,9 @@ import com.haitonggauto.rtosc.repository.enums.AuditEnum;
|
|||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -24,6 +27,9 @@ public class ExportInspectCheckQuery extends BaseQuery {
|
|||
@ApiModelProperty(value = "航次ID")
|
||||
private String voyageId;
|
||||
|
||||
@ApiModelProperty(value = "申请对象ID")
|
||||
private String applyObjId;
|
||||
|
||||
@ApiModelProperty(value = "航次")
|
||||
private String voyage;
|
||||
|
||||
|
@ -45,6 +51,38 @@ public class ExportInspectCheckQuery extends BaseQuery {
|
|||
@DbQuery(symbol = SqlSymbol.LIKE)
|
||||
private String batchNo;
|
||||
|
||||
@ApiModelProperty(value = "报关单号")
|
||||
@DbQuery(symbol = SqlSymbol.LIKE)
|
||||
private String passport;
|
||||
|
||||
@ApiModelProperty(value = "提单号")
|
||||
@DbQuery(field = "billNo", symbol = SqlSymbol.LIKE)
|
||||
private String billNum;
|
||||
|
||||
@ApiModelProperty(value = "精确提单号")
|
||||
@DbQuery(field = "billNo")
|
||||
private String billNumAccurate;
|
||||
|
||||
@ApiModelProperty(value = "品牌ID")
|
||||
@DbQuery(field = "select id from customer_export_inspect_cargo where export_inspect_id=customer_export_inspect.id and brand_id={0}", symbol = SqlSymbol.EXISTS)
|
||||
private String brandId;
|
||||
|
||||
@ApiModelProperty(value = "车架号")
|
||||
@DbQuery(field = "select id from customer_export_inspect_cargo where export_inspect_id=customer_export_inspect.id and vin like {0}", symbol = SqlSymbol.EXISTS)
|
||||
private String vin;
|
||||
|
||||
@ApiModelProperty(value = "开始查验日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@DbQuery(field = "inspectTime", symbol = SqlSymbol.GTE)
|
||||
private Date beginInspectTime;
|
||||
|
||||
@ApiModelProperty(value = "结束查验日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@DbQuery(field = "inspectTime", symbol = SqlSymbol.LTE)
|
||||
private Date endInspectTime;
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
private String tradType;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.haitonggauto.rtosc.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.haitonggauto.rtosc.common.db.anno.DbQuery;
|
||||
import com.haitonggauto.rtosc.common.db.enums.SqlSymbol;
|
||||
import com.haitonggauto.rtosc.common.db.query.BaseQuery;
|
||||
|
@ -8,6 +9,7 @@ import io.swagger.annotations.ApiModel;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -20,6 +22,9 @@ public class ExportInspectQuery extends BaseQuery {
|
|||
@ApiModelProperty(value = "航次ID")
|
||||
private String voyageId;
|
||||
|
||||
@ApiModelProperty(value = "申请对象ID")
|
||||
private String applyObjId;
|
||||
|
||||
@ApiModelProperty(value = "船名")
|
||||
@DbQuery(symbol = SqlSymbol.LIKE)
|
||||
private String shipName;
|
||||
|
@ -42,6 +47,36 @@ public class ExportInspectQuery extends BaseQuery {
|
|||
@DbQuery(symbol = SqlSymbol.LIKE)
|
||||
private String batchNo;
|
||||
|
||||
@ApiModelProperty(value = "报关单号")
|
||||
@DbQuery(symbol = SqlSymbol.LIKE)
|
||||
private String passport;
|
||||
|
||||
@ApiModelProperty(value = "提单号")
|
||||
@DbQuery(field = "billNo", symbol = SqlSymbol.LIKE)
|
||||
private String billNum;
|
||||
|
||||
@ApiModelProperty(value = "精确提单号")
|
||||
@DbQuery(field = "billNo")
|
||||
private String billNumAccurate;
|
||||
|
||||
@ApiModelProperty(value = "品牌ID")
|
||||
@DbQuery(field = "select id from customer_export_inspect_cargo where export_inspect_id=customer_export_inspect.id and brand_id={0}", symbol = SqlSymbol.EXISTS)
|
||||
private String brandId;
|
||||
|
||||
@ApiModelProperty(value = "车架号")
|
||||
@DbQuery(field = "select id from customer_export_inspect_cargo where export_inspect_id=customer_export_inspect.id and vin like {0}", symbol = SqlSymbol.EXISTS)
|
||||
private String vin;
|
||||
|
||||
@ApiModelProperty(value = "开始查验日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DbQuery(field = "inspectTime", symbol = SqlSymbol.GTE)
|
||||
private Date beginInspectTime;
|
||||
|
||||
@ApiModelProperty(value = "结束查验日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DbQuery(field = "inspectTime", symbol = SqlSymbol.LTE)
|
||||
private Date endInspectTime;
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
private String tradType;
|
||||
|
||||
|
|
|
@ -54,6 +54,13 @@ public class ExportLoadCheckQuery extends BaseQuery {
|
|||
@ApiModelProperty(hidden = true)
|
||||
private Long exportLoadId;
|
||||
|
||||
@DbQuery(field = "billNo", symbol = SqlSymbol.IN)
|
||||
private List<String> billNos;
|
||||
|
||||
@ApiModelProperty(value = "车架号")
|
||||
@DbQuery(field = "select id from customer_export_load_cargo where export_load_id=customer_export_load.id and vin like {0}", symbol = SqlSymbol.EXISTS)
|
||||
private String vin;
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
@DbQuery(field = "vin", symbol = SqlSymbol.IN)
|
||||
private List<String> vins;
|
||||
|
|
|
@ -51,6 +51,10 @@ public class ExportLoadQuery extends BaseQuery {
|
|||
@ApiModelProperty(hidden = true)
|
||||
private Long exportLoadId;
|
||||
|
||||
@ApiModelProperty(value = "车架号")
|
||||
@DbQuery(field = "select id from customer_export_load_cargo where export_load_id=customer_export_load.id and vin like {0}", symbol = SqlSymbol.EXISTS)
|
||||
private String vin;
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
@DbQuery(field = "vin", symbol = SqlSymbol.IN)
|
||||
private List<String> vins;
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.haitonggauto.rtosc.repository.enums.AuditEnum;
|
|||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -24,11 +25,13 @@ public class FreeTradeQuery extends BaseQuery {
|
|||
private String cargoCode;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
@DbQuery(field = "createDate", symbol = SqlSymbol.GT)
|
||||
private Date beginCreateDate;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
@DbQuery(field = "createDate", symbol = SqlSymbol.LTE)
|
||||
private Date endCreateDate;
|
||||
|
|
|
@ -11,6 +11,9 @@ public class LoginUser implements Serializable {
|
|||
// 用户ID
|
||||
private String userId;
|
||||
|
||||
// 用户名
|
||||
private String username;
|
||||
|
||||
// 角色ID
|
||||
private Long roleId;
|
||||
|
||||
|
@ -57,4 +60,12 @@ public class LoginUser implements Serializable {
|
|||
public void setPermList(Set<String> permList) {
|
||||
this.permList = permList;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,13 +189,19 @@ public interface WrapperKit {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!fieldMetadataMap.containsKey(fName)) {
|
||||
if (symbol != SqlSymbol.EXISTS && symbol != SqlSymbol.NOT_EXISTS && symbol != SqlSymbol.EXPRESSION && !fieldMetadataMap.containsKey(fName)) {
|
||||
throw new FieldNotExistsException(String.format("类:%s, 不存在属性: %s" , classMetadata.getClazz().getName(), fName));
|
||||
}
|
||||
String column = fieldMetadataMap.get(fName).getColumn();
|
||||
String column = null;
|
||||
|
||||
if (symbol == SqlSymbol.EXISTS || symbol == SqlSymbol.NOT_EXISTS || symbol == SqlSymbol.EXPRESSION) {
|
||||
column = fName;
|
||||
} else {
|
||||
column = fieldMetadataMap.get(fName).getColumn();
|
||||
if (StringUtils.isNotEmpty(alias)) {
|
||||
column = alias + "." + column;
|
||||
}
|
||||
}
|
||||
|
||||
if (symbol == SqlSymbol.IN) {
|
||||
if (fValue instanceof List) {
|
||||
|
@ -212,9 +218,9 @@ public interface WrapperKit {
|
|||
} else if (symbol.equals(SqlSymbol.RLIKE)) {
|
||||
queryWrapper.likeRight(column, fValue);
|
||||
} else if (symbol.equals(SqlSymbol.EXISTS)) {
|
||||
queryWrapper.exists(column, fValue);
|
||||
queryWrapper.exists(column, StringUtils.containsIgnoreCase(column, " like ") ? "%" + fValue + "%" : fValue);
|
||||
} else if (symbol.equals(SqlSymbol.NOT_EXISTS)) {
|
||||
queryWrapper.notExists(column, fValue);
|
||||
queryWrapper.notExists(column, StringUtils.containsIgnoreCase(column, " like ") ? "%" + fValue + "%" : fValue);
|
||||
} else if (symbol.equals(SqlSymbol.GTE)) {
|
||||
queryWrapper.ge(column, fValue);
|
||||
} else if (symbol.equals(SqlSymbol.GT)) {
|
||||
|
|
|
@ -39,7 +39,7 @@ public class DependsOnValidator implements ConstraintValidator<DependsOn, Object
|
|||
}
|
||||
|
||||
if (value1 != null) {
|
||||
if (StringUtils.equals("正常", (String)value1)) {
|
||||
if (!StringUtils.equalsAny((String)value1,"内进转外出", "外进转内出", "国际中转", "国内中转")) {
|
||||
for (String field : fields) {
|
||||
String v = (String) wrapper.getPropertyValue(field);
|
||||
if (StringUtils.isNotEmpty(v)) {
|
||||
|
|
|
@ -2,6 +2,7 @@ FROM adoptopenjdk/openjdk8:ubi
|
|||
WORKDIR /home
|
||||
COPY target/*.jar /home/app.jar
|
||||
EXPOSE 9000
|
||||
EXPOSE 18085
|
||||
ENV TZ "Asia/Shanghai"
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
|
||||
ENV PROFILES_OPTS=""
|
||||
|
|
|
@ -81,6 +81,20 @@
|
|||
<groupId>org.elasticsearch.client</groupId>
|
||||
<version>7.17.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nuzar</groupId>
|
||||
<artifactId>nuzar-xxl-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy</artifactId>
|
||||
<version>4.0.19</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.9.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.springframework.boot.SpringApplication;
|
|||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
/**
|
||||
* @Author limng
|
||||
|
@ -15,6 +16,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
|||
@EnableCreateCacheAnnotation
|
||||
//开启Feign支持
|
||||
@EnableFeignClients
|
||||
@EnableAsync
|
||||
public class NuzarCustomerApplication implements CommandLineRunner {
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,12 +4,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.haitonggauto.rtosc.api.dto.*;
|
||||
import com.haitonggauto.rtosc.client.dto.UserAuthRequestDto;
|
||||
import com.haitonggauto.rtosc.dto.LoginDTO;
|
||||
import com.haitonggauto.rtosc.dto.UpdateVoyageVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -18,6 +20,9 @@ import java.util.Map;
|
|||
@FeignClient(name = "rtos-openapi")
|
||||
public interface NuzarOpenApi {
|
||||
|
||||
@GetMapping("/miniapp/getDownCountry")
|
||||
List<CityDTO> getCountryList();
|
||||
|
||||
// 根据港区ID获取国家
|
||||
@GetMapping(value = "/miniapp/portAreaManage/getCountry")
|
||||
PortAreaCountryDTO getPortAreaCountry(@RequestParam("potId") String potId);
|
||||
|
@ -114,6 +119,9 @@ public interface NuzarOpenApi {
|
|||
@GetMapping("/customer/shipment/shipLoad/getShipPlan")
|
||||
List<Long> haveShipPlan(@RequestParam("vvyId") String vvyId);
|
||||
|
||||
@PostMapping("/customer/shipment/shipLoad/getShipPlans")
|
||||
Map<String, List<Long>> haveShipPlans(@RequestBody CheckShipPlanReq req);
|
||||
|
||||
// 装船审核获取国际中转备件
|
||||
@PostMapping("/customer/shipment/shipLoad/transitPart")
|
||||
Map<String, List<TransitPartResp>> getTransitPart(@RequestBody TransitPartRequest request);
|
||||
|
@ -133,4 +141,27 @@ public interface NuzarOpenApi {
|
|||
// 查询获物信息
|
||||
@GetMapping("/miniapp/machineType/dict")
|
||||
List<MachineDTO> getMachineType();
|
||||
|
||||
// 获取绑定货代
|
||||
@GetMapping("/rtos/user/getFreightId")
|
||||
List<FreightVo> getUserBindFreight();
|
||||
|
||||
@PostMapping("/customer/shipment/queryTrendShips")
|
||||
List<TrendShipResp> getTrendShipList(@RequestBody List<String> shipNames);
|
||||
|
||||
@PostMapping("/customer/yard/batchConfirmRevise")
|
||||
Boolean batchConfirmRevise(UpdateVoyageVo req);
|
||||
|
||||
@PostMapping("/customer/yard/getCarPickTime")
|
||||
Map<String, Date> getCarPickTime(@RequestBody List<String> vinCodes);
|
||||
|
||||
@GetMapping("/rtos/user/searchUser")
|
||||
UserInfoDto getUserInfo();
|
||||
|
||||
// 提离港区车架号验证
|
||||
@PostMapping("/customer/pickDeparture/vinCheckInfo")
|
||||
List<VinCheckResp> vinCheckInfo(@RequestBody VinCheckReq req);
|
||||
|
||||
@PostMapping("/customer/yard/batchConfirmReview")
|
||||
Boolean batchConfirmReview(@RequestBody BatchConfirmReviewReq req);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.util.List;
|
|||
@FeignClient(name = "basic-service")
|
||||
public interface NuzarPubApi {
|
||||
|
||||
|
||||
//车辆操作模式
|
||||
@GetMapping(value = "/typeRef/domain/OPPROC_MODE")
|
||||
List<NuzarDictDTO> getOperateTypeList();
|
||||
|
@ -48,6 +47,9 @@ public interface NuzarPubApi {
|
|||
@GetMapping(value = "/city/queryOrigin")
|
||||
List<CityDTO> getCountryList(@RequestParam("key") String key);
|
||||
|
||||
@GetMapping(value = "/city/queryOriginAll")
|
||||
List<CityDTO> getAllCountryList(@RequestParam("key") String key);
|
||||
|
||||
// 运输方式
|
||||
@GetMapping(value = "/typeRef/domain/TRANSPORT_TYPE")
|
||||
List<NuzarDictDTO> getTransportWayList();
|
||||
|
@ -76,4 +78,8 @@ public interface NuzarPubApi {
|
|||
@GetMapping(value = "/shipManage/queryLikeShipManage")
|
||||
List<ShipDTO> getShipList(@RequestParam("key") String key, @RequestParam("query") String query, @RequestParam("spmId") String spmId
|
||||
, @RequestParam("valid") String valid, @RequestParam("vslCd") String vslCd, @RequestParam("vslCnname") String vslCnname, @RequestParam("vslEnnameList") List<String> vslEnnameList);
|
||||
|
||||
// 类型匹配
|
||||
@PostMapping("/attachment/mappingMap")
|
||||
PubMappingMapDto getPubMapping();
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package com.haitonggauto.rtosc.api;
|
||||
|
||||
import com.haitonggauto.rtosc.api.dto.CheckVinReq;
|
||||
import com.haitonggauto.rtosc.api.dto.VoyageDTO;
|
||||
import com.haitonggauto.rtosc.api.dto.VoyageReq;
|
||||
import com.haitonggauto.rtosc.api.dto.VoyageResp;
|
||||
import com.haitonggauto.rtosc.api.dto.*;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -29,4 +26,18 @@ public interface NuzarShpApi {
|
|||
@GetMapping("/vesselVoyages/queryByKey")
|
||||
List<VoyageResp> queryVoyageByKey(@RequestParam("ieType") String ieType, @RequestParam("key") String key, @RequestParam("pamId") String pamId, @RequestParam("spmId") String spmId
|
||||
, @RequestParam("tradeType") String tradeType);
|
||||
|
||||
@PostMapping("/vesselVoyages/shipNameFilter")
|
||||
List<String> checkShipStatus(@RequestBody List<String> req);
|
||||
|
||||
@PostMapping("/shipment/unload/plans/unloadInfoVerify")
|
||||
List<ImportInspectResp> unloadInfoVerify(@RequestBody List<ImportInspectReq> req);
|
||||
|
||||
/**
|
||||
* 离泊状态
|
||||
* @param vvyIds
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/vesselVoyages/queryBerthsStatusByVvyIds")
|
||||
List<ShipmentBerthsStatusRespDTO> queryVoyagesBerthsStatusByVvyIds(@RequestBody List<String> vvyIds);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.haitonggauto.rtosc.api;
|
|||
|
||||
import com.haitonggauto.rtosc.api.dto.CustomNoReq;
|
||||
import com.haitonggauto.rtosc.api.dto.CustomNoResp;
|
||||
import com.haitonggauto.rtosc.api.dto.VinStatus;
|
||||
import com.haitonggauto.rtosc.api.dto.VoyageDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@ -17,4 +18,7 @@ public interface NuzarYardApi {
|
|||
|
||||
@PostMapping("/yardCustomsRelease/queryCustomNoByvvyIdAndMnf")
|
||||
List<CustomNoResp> getVoyageNameByVvyName(@RequestBody CustomNoReq customNoReq);
|
||||
|
||||
@PostMapping("/yardGoods/vinCode")
|
||||
List<VinStatus> getVinStatus(@RequestBody List<String> vinCode);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.haitonggauto.rtosc.api.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("审核后批量修对对应航次")
|
||||
public class BatchConfirmReviewReq implements Serializable {
|
||||
private List<String> billNos;
|
||||
|
||||
private List<String> ids;
|
||||
|
||||
private List<String> mnfBls;
|
||||
|
||||
private String shipId;
|
||||
|
||||
private String shipName;
|
||||
|
||||
private String voyage;
|
||||
|
||||
private String voyageId;
|
||||
|
||||
private String vvyId;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.haitonggauto.rtosc.api.dto;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("验证是否有装船计划")
|
||||
public class CheckShipPlanReq implements Serializable {
|
||||
@ApiModelProperty("航次ID")
|
||||
private List<String> vvyIds;
|
||||
}
|
|
@ -19,4 +19,7 @@ public class CheckVinReq implements Serializable {
|
|||
|
||||
@ApiModelProperty("车架号")
|
||||
private String vinCode;
|
||||
|
||||
@ApiModelProperty("航次ID")
|
||||
private String vvyId;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.haitonggauto.rtosc.api.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel("货代信息")
|
||||
@Data
|
||||
public class FreightVo implements Serializable {
|
||||
|
||||
@ApiModelProperty("客户简称")
|
||||
private String cueAbbreviation;
|
||||
|
||||
@ApiModelProperty("客户中文名称")
|
||||
private String cueCnname;
|
||||
|
||||
@ApiModelProperty("客户中文名称")
|
||||
private String cueTypes;
|
||||
|
||||
private String cueId;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.haitonggauto.rtosc.api.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("进口查验检验请求")
|
||||
public class ImportInspectReq implements Serializable {
|
||||
@ApiModelProperty("提单号")
|
||||
private String mnfBl;
|
||||
|
||||
@ApiModelProperty("船ID")
|
||||
private String spmId;
|
||||
|
||||
@ApiModelProperty("船名")
|
||||
private String spmName;
|
||||
|
||||
@ApiModelProperty("车架号")
|
||||
private String vinCode;
|
||||
|
||||
@ApiModelProperty("航次ID")
|
||||
private String vvyId;
|
||||
|
||||
@ApiModelProperty("船次")
|
||||
private String vvyName;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.haitonggauto.rtosc.api.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("进口查验返回")
|
||||
public class ImportInspectResp implements Serializable {
|
||||
private String errorMsg;
|
||||
|
||||
private String mnfBl;
|
||||
|
||||
private String spmName;
|
||||
|
||||
private String vinCode;
|
||||
|
||||
private String vvyName;
|
||||
|
||||
private YardGoodsDTO yardGoodsDTO;
|
||||
|
||||
@Data
|
||||
public static class YardGoodsDTO implements Serializable {
|
||||
private String brdId;
|
||||
|
||||
private String brdName;
|
||||
|
||||
private String bvmName;
|
||||
|
||||
private String goodsType;
|
||||
|
||||
private String model;
|
||||
|
||||
private String position;
|
||||
|
||||
private String spmId;
|
||||
|
||||
private String storeArea;
|
||||
|
||||
private String vvyId;
|
||||
|
||||
private String yacId;
|
||||
|
||||
private String yalId;
|
||||
|
||||
private String yarId;
|
||||
|
||||
private String yardId;
|
||||
|
||||
private String pamId;
|
||||
|
||||
private String pamName;
|
||||
}
|
||||
}
|
|
@ -14,4 +14,5 @@ public class PortDTO implements Serializable {
|
|||
|
||||
private String potEnname;
|
||||
|
||||
private String potCtycd;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.haitonggauto.rtosc.api.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@ApiModel("字典映射关系")
|
||||
public class PubMappingMapDto implements Serializable {
|
||||
|
||||
@ApiModelProperty(value ="车型-车型明细-code")
|
||||
private Map<String, List<String>> vehicleDetail;
|
||||
|
||||
@ApiModelProperty(value ="车型-操作模式-code")
|
||||
private Map<String,List<String>> opprocMode;
|
||||
|
||||
@ApiModelProperty(value ="国家-港口-id")
|
||||
private Map<String, List<String>> port;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.haitonggauto.rtosc.api.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zhaoyusheng
|
||||
* @version 1.0.0
|
||||
* @classname ShipmentBerthsStatusRespDTO
|
||||
* @date 2024/7/23
|
||||
* @time 13:13
|
||||
* @description 航次泊位状态
|
||||
*/
|
||||
@Data
|
||||
public class ShipmentBerthsStatusRespDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1566352212034798745L;
|
||||
@ApiModelProperty(value = "航次id")
|
||||
private String vvyId;
|
||||
@ApiModelProperty(value = "是否离泊:0否 1是")
|
||||
private String unberthedStatus;
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.haitonggauto.rtosc.api.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ApiModel("旬度计划船名")
|
||||
public class TrendShipResp {
|
||||
@ApiModelProperty("船舶id")
|
||||
private String spmId;
|
||||
|
||||
@ApiModelProperty("船名")
|
||||
private String spmName;
|
||||
|
||||
@ApiModelProperty("船code")
|
||||
private String vslCode;
|
||||
|
||||
@ApiModelProperty("预计到港时间")
|
||||
private Date planArrivePortTime;
|
||||
|
||||
@ApiModelProperty("英文名")
|
||||
private String spmEname;
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package com.haitonggauto.rtosc.api.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wangzhengyan
|
||||
* @Date 2023/5/5 0005 13:55
|
||||
*/
|
||||
@Data
|
||||
public class UserInfoDto implements Serializable {
|
||||
private static final long serialVersionUID = -2463058823324072492L;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "客户姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "登录账号")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty(value = "联系人")
|
||||
@JsonAlias("memo")
|
||||
private String contactPerson;
|
||||
|
||||
@ApiModelProperty(value = "邮箱")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "客户地址")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
protected Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
protected String createUser;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
protected String updateUser;
|
||||
|
||||
@ApiModelProperty(value = "更新人")
|
||||
protected Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "登录时间")
|
||||
private String loginTime;
|
||||
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
private String enabled;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String phone;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "头像地址")
|
||||
private String uploadUrl;
|
||||
|
||||
@ApiModelProperty(value = "身份证号")
|
||||
private String idCard;
|
||||
|
||||
// @ApiModelProperty(value = "手机号群组")
|
||||
// private List<UsersPhones> phones;
|
||||
|
||||
|
||||
/**
|
||||
* 货代Id
|
||||
*/
|
||||
@ApiModelProperty(value = "货代ID")
|
||||
private String freightId;
|
||||
|
||||
/**
|
||||
* 货代Id
|
||||
*/
|
||||
@ApiModelProperty(value = "货代类型")
|
||||
private String freightType;
|
||||
|
||||
/**
|
||||
* 用户角色id
|
||||
*/
|
||||
@ApiModelProperty(value = "用户角色id")
|
||||
private List<String> roleIds;
|
||||
|
||||
@ApiModelProperty(value = "货代类型")
|
||||
private String med;
|
||||
|
||||
private String mediaType;
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.haitonggauto.rtosc.api.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("提离港区车架号验证")
|
||||
public class VinCheckReq implements Serializable {
|
||||
@ApiModelProperty("品牌ID")
|
||||
private String brdId;
|
||||
|
||||
@ApiModelProperty("港区ID")
|
||||
private String pamId;
|
||||
|
||||
@ApiModelProperty("船舶ID")
|
||||
private String spmId;
|
||||
|
||||
@ApiModelProperty("航次ID")
|
||||
private String vvyId;
|
||||
|
||||
@ApiModelProperty("车架号列表")
|
||||
private List<String> vinCodeList;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.haitonggauto.rtosc.api.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("提离港区车架号验证")
|
||||
public class VinCheckResp implements Serializable {
|
||||
@ApiModelProperty("是否退关扫描")
|
||||
private Boolean hasShutoutScan;
|
||||
|
||||
@ApiModelProperty("是否无计划收车")
|
||||
private Boolean noPlanCollect;
|
||||
|
||||
@ApiModelProperty("车架号")
|
||||
private String vinCode;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.haitonggauto.rtosc.api.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel("车辆在场状态")
|
||||
@Data
|
||||
public class VinStatus implements Serializable {
|
||||
@ApiModelProperty("车架号")
|
||||
private String vinCode;
|
||||
|
||||
@ApiModelProperty("货物是否异常 0 否 1 是")
|
||||
private String expFlag;
|
||||
|
||||
private String workStatus;
|
||||
|
||||
private String yardPos;
|
||||
}
|
|
@ -16,6 +16,9 @@ public class VoyageResp {
|
|||
@ApiModelProperty("船舶id")
|
||||
private String spmId;
|
||||
|
||||
@ApiModelProperty("港区ID")
|
||||
private String pamId;
|
||||
|
||||
@ApiModelProperty("内贸/外贸/内外贸")
|
||||
private String tradeType;
|
||||
|
||||
|
|
|
@ -2,7 +2,11 @@ package com.haitonggauto.rtosc.config;
|
|||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.haitonggauto.rtosc.api.NuzarOpenApi;
|
||||
import com.nuzar.rtops.log.service.SpringApplicationContextHolder;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
@ -11,6 +15,7 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 拦截器的属性配置
|
||||
|
@ -34,12 +39,15 @@ public class InterceptorConfiguration implements WebMvcConfigurer {
|
|||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public PermInterceptor permInterceptor() { return new PermInterceptor(); }
|
||||
public PermInterceptor permInterceptor() {
|
||||
return new PermInterceptor();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@ConditionalOnBean(PermInterceptor.class)
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 拦截器
|
||||
InterceptorRegistration registration = registry.addInterceptor(this.permInterceptor());
|
||||
InterceptorRegistration registration = registry.addInterceptor(permInterceptor());
|
||||
}
|
||||
}
|
|
@ -1,15 +1,13 @@
|
|||
package com.haitonggauto.rtosc.config;
|
||||
|
||||
import com.haitonggauto.rtosc.api.NuzarOpenApi;
|
||||
import com.haitonggauto.rtosc.api.dto.UserInfoDto;
|
||||
import com.haitonggauto.rtosc.common.context.UserContext;
|
||||
import com.haitonggauto.rtosc.common.dto.LoginUser;
|
||||
import com.haitonggauto.rtosc.common.exception.NoLoginException;
|
||||
import com.haitonggauto.rtosc.common.exception.NoPermException;
|
||||
import com.haitonggauto.rtosc.common.handler.anno.HandlerMethod;
|
||||
import com.haitonggauto.rtosc.common.service.AuthService;
|
||||
import com.haitonggauto.rtosc.common.utils.MethodInterceptorUtils;
|
||||
import com.nuzar.common.security5.common.util.SecurityUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -19,23 +17,51 @@ import javax.servlet.http.HttpServletResponse;
|
|||
* 权限过滤器
|
||||
*/
|
||||
public class PermInterceptor implements HandlerInterceptor {
|
||||
public static final String[] SWAGGER_EXCLUDE_PATHS = {"/doc.html", "/swagger-resources/**", "/webjars/**", "/v2/**", "/favicon.ico", "/swagger-ui.htmL/**", "/health/ping"};
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
//判断是否登录
|
||||
String userId = "";
|
||||
try {
|
||||
userId = SecurityUtils.getUserId();
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
userId = "0";
|
||||
String uri = request.getRequestURI();
|
||||
AntPathMatcher antPathMatcher = new AntPathMatcher();
|
||||
for (String p : SWAGGER_EXCLUDE_PATHS) {
|
||||
if (antPathMatcher.match(p, uri)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
System.err.println(userId);
|
||||
//判断是否登录
|
||||
String userId = "";
|
||||
String username = "";
|
||||
try {
|
||||
// userId = SecurityUtils.getUserId();
|
||||
|
||||
BeanFactory factory = WebApplicationContextUtils.getRequiredWebApplicationContext(request.getServletContext());
|
||||
NuzarOpenApi openApi = factory.getBean(NuzarOpenApi.class);
|
||||
|
||||
UserInfoDto info = openApi.getUserInfo();
|
||||
|
||||
userId = info.getId();
|
||||
username = info.getName();
|
||||
|
||||
if (StringUtils.equalsIgnoreCase(info.getMediaType(), "MINIAPP") && !StringUtils.equalsAny(request.getRequestURI(), "/dd/ship/all"
|
||||
, "/ee/plan/ship", "/dd/port", "/ee/plan/port", "/dd/brand", "/ee/voyage/brand", "/it/shipVoyage", "/spz/valid-vins")) {
|
||||
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
|
||||
// 可以设置响应体
|
||||
response.getWriter().write("Access Forbidden");
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
// response.setStatus(HttpServletResponse.SC_FORBIDDEN);
|
||||
// // 可以设置响应体
|
||||
// response.getWriter().write("Access Forbidden");
|
||||
// return false;
|
||||
}
|
||||
|
||||
LoginUser tmpUser = new LoginUser();
|
||||
tmpUser.setUserId(userId);
|
||||
tmpUser.setRoleId(0L);
|
||||
tmpUser.setUsername(username);
|
||||
tmpUser.setAdmin(true);
|
||||
|
||||
UserContext.setUser(tmpUser);
|
||||
|
|
|
@ -4,9 +4,11 @@ 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.exception.ExcelDataConvertException;
|
||||
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.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
@ -22,16 +24,14 @@ import com.haitonggauto.rtosc.common.enums.ErrorType;
|
|||
import com.haitonggauto.rtosc.common.handler.BaseHandler;
|
||||
import com.haitonggauto.rtosc.common.utils.*;
|
||||
import com.haitonggauto.rtosc.dto.*;
|
||||
import com.haitonggauto.rtosc.excel.DepartureImportExcel;
|
||||
import com.haitonggauto.rtosc.handler.excel.ReadExcelListener;
|
||||
import com.haitonggauto.rtosc.query.CargoQuery;
|
||||
import com.haitonggauto.rtosc.query.DepartureQuery;
|
||||
import com.haitonggauto.rtosc.query.ExportInCheckQuery;
|
||||
import com.haitonggauto.rtosc.repository.entity.*;
|
||||
import com.haitonggauto.rtosc.handler.mapper.PoMapper;
|
||||
import com.haitonggauto.rtosc.repository.enums.AuditEnum;
|
||||
import com.haitonggauto.rtosc.repository.service.CustomerDepartureCargoService;
|
||||
import com.haitonggauto.rtosc.repository.service.CustomerDepartureDriversService;
|
||||
import com.haitonggauto.rtosc.repository.service.CustomerDeparturePlanService;
|
||||
import com.haitonggauto.rtosc.repository.service.CustomerDepartureService;
|
||||
import com.haitonggauto.rtosc.repository.service.*;
|
||||
import com.haitonggauto.rtosc.service.CustomerService;
|
||||
import com.itextpdf.forms.PdfAcroForm;
|
||||
import com.itextpdf.forms.fields.PdfFormField;
|
||||
|
@ -51,11 +51,12 @@ import com.itextpdf.layout.layout.LayoutArea;
|
|||
import com.itextpdf.layout.layout.LayoutResult;
|
||||
import com.itextpdf.layout.properties.UnitValue;
|
||||
import com.itextpdf.layout.renderer.DocumentRenderer;
|
||||
import com.nuzar.common.security5.common.util.SecurityUtils;
|
||||
import com.nuzar.rtops.log.dto.LogRecordDTO;
|
||||
import com.nuzar.rtops.log.service.EsLogApprovalUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -65,15 +66,18 @@ import org.springframework.core.io.ClassPathResource;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.Validation;
|
||||
import javax.validation.Validator;
|
||||
import javax.validation.ValidatorFactory;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -82,6 +86,7 @@ import java.util.stream.Collectors;
|
|||
@RestController
|
||||
@RequestMapping("/ep")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class DepartureHandler implements BaseHandler {
|
||||
|
||||
@Resource
|
||||
|
@ -99,6 +104,12 @@ public class DepartureHandler implements BaseHandler {
|
|||
@Resource
|
||||
private CustomerDeparturePlanService departurePlanService;
|
||||
|
||||
@Resource
|
||||
private CustomerExportInCargoService exportInCargoService;
|
||||
|
||||
@Resource
|
||||
private CustomerExportInService exportInService;
|
||||
|
||||
@Resource
|
||||
private NuzarOpenApi openApi;
|
||||
|
||||
|
@ -217,6 +228,32 @@ public class DepartureHandler implements BaseHandler {
|
|||
return ResultUtil.success(rst, String.valueOf(page.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("提单号模糊匹配")
|
||||
@PostMapping("/billNo/query")
|
||||
public Result<List<String>> getExportInBillNoList(
|
||||
@ApiParam(name = "操作方式, 0为前端,1为审核端") @RequestParam(required = false, defaultValue = "0") String type,
|
||||
@RequestParam(required = false, defaultValue = "1") Integer current,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer size,
|
||||
@RequestParam(required = false) String shipId,
|
||||
@RequestParam(required = false) String voyageId,
|
||||
@RequestParam(required = false) String q) {
|
||||
QueryWrapper<CustomerDepartureCargo> query = new QueryWrapper<>();
|
||||
query.select("distinct bill_no");
|
||||
query.eq(StringUtils.equals(type, "0"), "create_by", UserContext.getUser().getUserId());
|
||||
query.exists(StringUtils.isNotEmpty(shipId), "select id from customer_departure where departure_id=customer_departure.id and ship_id={0}", shipId);
|
||||
query.exists(StringUtils.isNotEmpty(voyageId), "select id from customer_departure where departure_id=customer_departure.id and voyage_id={0}", shipId);
|
||||
// query.eq("create_by", UserContext.getUser().getUserId());
|
||||
query.like(StringUtils.isNotEmpty(q), "bill_no", q);
|
||||
|
||||
Page<CustomerDepartureCargo> page = departureCargoService.page(new Page<>(current, size), query);
|
||||
List<CustomerDepartureCargo> list = page.getRecords();
|
||||
|
||||
List<String> rst = list.stream().map(tmp -> tmp.getBillNo()).collect(Collectors.toList());
|
||||
|
||||
|
||||
return ResultUtil.success(rst, String.valueOf(page.getTotal()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param query
|
||||
|
@ -324,6 +361,10 @@ public class DepartureHandler implements BaseHandler {
|
|||
return entity;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
departure.setQuantity(cargos.size());
|
||||
departure.setSpareQuantity((int)cargos.stream().filter(s -> StringUtils.startsWith(s.getVin(), "BJ")).count());
|
||||
departure.setCarQuantity(departure.getQuantity() - departure.getSpareQuantity());
|
||||
|
||||
List<CustomerDepartureDrivers> drivers = form.getDrivers().stream().map(item -> {
|
||||
CustomerDepartureDrivers entity = PoMapper.instance.departureDriverVo2Entity(item);
|
||||
entity.setTermcd(departure.getPortAreaId());
|
||||
|
@ -336,6 +377,11 @@ public class DepartureHandler implements BaseHandler {
|
|||
return entity;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtils.isNotEmpty(plans)) {
|
||||
String collect = plans.stream().filter(s -> StringUtils.isNotEmpty(s.getMachine())).map(s -> s.getMachine()).collect(Collectors.joining(","));
|
||||
departure.setWorkStatus(collect);
|
||||
}
|
||||
|
||||
Long id = customerService.saveDeparture(departure, cargos, drivers, plans);
|
||||
|
||||
return ResultUtil.success(String.valueOf(id));
|
||||
|
@ -352,7 +398,7 @@ public class DepartureHandler implements BaseHandler {
|
|||
.in("vin", vo.getVins())
|
||||
.exists("select id from customer_departure where customer_departure.id=customer_departure_cargo.departure_id and customer_departure.voyage_id={0}", vo.getVoyageId())
|
||||
.groupBy("vin")
|
||||
.having("count(quantity) > 1")
|
||||
.having("count(*) > 1")
|
||||
.list();
|
||||
rst.put(vo.getVoyageId(), cargos.stream().map(item -> item.getVin()).collect(Collectors.toList()));
|
||||
}
|
||||
|
@ -366,7 +412,7 @@ public class DepartureHandler implements BaseHandler {
|
|||
.select("count(*) as quantity, vin")
|
||||
.in("vin", vins)
|
||||
.groupBy("vin")
|
||||
.having("count(quantity) > 0")
|
||||
.having("count(*) > 0")
|
||||
.list();
|
||||
return ResultUtil.success(cargos.stream().map(item -> item.getVin()).collect(Collectors.toList()));
|
||||
}
|
||||
|
@ -475,6 +521,10 @@ public class DepartureHandler implements BaseHandler {
|
|||
return entity;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
departure.setQuantity(cargos.size());
|
||||
departure.setSpareQuantity((int)cargos.stream().filter(s -> StringUtils.startsWith(s.getVin(), "BJ")).count());
|
||||
departure.setCarQuantity(departure.getQuantity() - departure.getSpareQuantity());
|
||||
|
||||
List<CustomerDepartureDrivers> drivers = form.getDrivers().stream().map(item -> {
|
||||
CustomerDepartureDrivers entity = PoMapper.instance.departureDriverVo2Entity(item);
|
||||
entity.setTermcd(departure.getPortAreaId());
|
||||
|
@ -487,6 +537,11 @@ public class DepartureHandler implements BaseHandler {
|
|||
return entity;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtils.isNotEmpty(plans)) {
|
||||
String collect = plans.stream().filter(s -> StringUtils.isNotEmpty(s.getMachine())).map(s -> s.getMachine()).collect(Collectors.joining(","));
|
||||
departure.setWorkStatus(collect);
|
||||
}
|
||||
|
||||
customerService.updateDeparture(false, departure, cargos, drivers, plans);
|
||||
|
||||
return ResultUtil.success(String.valueOf(departure.getId()));
|
||||
|
@ -572,6 +627,16 @@ public class DepartureHandler implements BaseHandler {
|
|||
|
||||
customerService.wrapperEntity(cargos);
|
||||
|
||||
// 获取进港时间
|
||||
Map<String, Date> carPickTime = openApi.getCarPickTime(cargos.stream().map(s -> s.getVin()).collect(Collectors.toList()));
|
||||
if (MapUtils.isNotEmpty(carPickTime)) {
|
||||
cargos.stream().forEach(s -> {
|
||||
if (carPickTime.containsKey(s.getVin()) && carPickTime.get(s.getVin()) != null) {
|
||||
s.setCarPickTime(DateUtils.formatDate(carPickTime.get(s.getVin())));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
List<CustomerDepartureDrivers> drivers = departureDriversService.list(new LambdaQueryWrapper<CustomerDepartureDrivers>().eq(CustomerDepartureDrivers::getDepartureId, id));
|
||||
|
||||
customerService.wrapperEntity(drivers);
|
||||
|
@ -632,13 +697,23 @@ public class DepartureHandler implements BaseHandler {
|
|||
LambdaQueryWrapper<CustomerDepartureCargo> queryWrapper = new LambdaQueryWrapper();
|
||||
queryWrapper.eq(query.getId() != null, CustomerDepartureCargo::getDepartureId, query.getId());
|
||||
if (query.getCargoType() != null) {
|
||||
queryWrapper.eq(query.getCargoType() != null, CustomerDepartureCargo::getCargoType, query.getCargoType());
|
||||
queryWrapper.eq(query.getCargoType() != null, CustomerDepartureCargo::getCartType, query.getCargoType());
|
||||
}
|
||||
Page<CustomerDepartureCargo> page = departureCargoService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper);
|
||||
|
||||
customerService.wrapperEntity(page.getRecords());
|
||||
|
||||
if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
||||
// 获取进港时间
|
||||
Map<String, Date> carPickTime = openApi.getCarPickTime(page.getRecords().stream().map(s -> s.getVin()).collect(Collectors.toList()));
|
||||
if (MapUtils.isNotEmpty(carPickTime)) {
|
||||
page.getRecords().stream().forEach(s -> {
|
||||
if (carPickTime.containsKey(s.getVin()) && carPickTime.get(s.getVin()) != null) {
|
||||
s.setCarPickTime(DateUtils.formatDate(carPickTime.get(s.getVin())));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
CustomerDeparture departure = departureService.getById(page.getRecords().get(0).getDepartureId());
|
||||
|
||||
// 获取作业状态
|
||||
|
@ -699,8 +774,8 @@ public class DepartureHandler implements BaseHandler {
|
|||
log.setOperateData(l);
|
||||
log.setStatus(check.getCheckStatus() == AuditEnum.AUDIT_PASS ? 0 : 1);
|
||||
log.setOperateTime(new Date());
|
||||
log.setUserId(SecurityUtils.getUserId());
|
||||
log.setUserName(SecurityUtils.getUserName());
|
||||
log.setUserId(UserContext.getUser().getUserId());
|
||||
log.setUserName(UserContext.getUser().getUsername());
|
||||
EsLogApprovalUtil.writeLog(log);
|
||||
}
|
||||
}
|
||||
|
@ -755,8 +830,8 @@ public class DepartureHandler implements BaseHandler {
|
|||
log.setOperateData(l);
|
||||
log.setStatus(check.getCheckStatus() == AuditEnum.AUDIT_PASS ? 0 : 1);
|
||||
log.setOperateTime(new Date());
|
||||
log.setUserId(SecurityUtils.getUserId());
|
||||
log.setUserName(SecurityUtils.getUserName());
|
||||
log.setUserId(UserContext.getUser().getUserId());
|
||||
log.setUserName(UserContext.getUser().getUsername());
|
||||
EsLogApprovalUtil.writeLog(log);
|
||||
}
|
||||
}
|
||||
|
@ -820,6 +895,7 @@ public class DepartureHandler implements BaseHandler {
|
|||
|
||||
// 查询出要加载的数据
|
||||
List<CustomerDeparture> departures = departureService.list(new LambdaQueryWrapper<CustomerDeparture>().in(CustomerDeparture::getBatchNo, nos));
|
||||
customerService.wrapperEntity(departures);
|
||||
|
||||
ExcelWriter excelWriter = null;
|
||||
try(ByteArrayOutputStream bos = new ByteArrayOutputStream()){
|
||||
|
@ -863,18 +939,19 @@ public class DepartureHandler implements BaseHandler {
|
|||
// 简单的说 如果你的模板有list,且list不是最后一行,下面还有数据需要填充 就必须设置 forceNewRow=true 但是这个就会把所有数据放到内存 会很耗内存
|
||||
// 如果数据量大 list不是最后一行 参照下一个
|
||||
|
||||
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
|
||||
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.FALSE).build();
|
||||
List<CustomerDeparturePlan> before = CollectionUtil.sub(plans, 0, 1);
|
||||
List<CustomerDeparturePlan> after = CollectionUtil.sub(plans, 1, plans.size() - 1);
|
||||
List<CustomerDeparturePlan> after = CollectionUtil.sub(plans, 1, plans.size());
|
||||
|
||||
excelWriter.fill(new FillWrapper("plan", before), writeSheet);
|
||||
excelWriter.fill(new FillWrapper("plan", after), fillConfig, writeSheet);
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("batchNo", departures.get(i).getBatchNo()); // {batchNo}
|
||||
// map.put("batchNo", departures.get(i).getBatchNo()); // {batchNo}
|
||||
map.put("receiveCompany", departures.get(i).getReceiveCompany()); // {receiveCompany}
|
||||
//{applicant}
|
||||
map.put("applicant", departures.get(i).getApplicant());
|
||||
map.put("applicant", departures.get(i).getCheckMan());
|
||||
map.put("remark", departures.get(i).getRemark());
|
||||
//{applyTime}
|
||||
map.put("applyTime", departures.get(i).getApplyTime());
|
||||
//{shipName}
|
||||
|
@ -933,10 +1010,13 @@ public class DepartureHandler implements BaseHandler {
|
|||
|
||||
List<CustomerDepartureCargo> cargos = departureCargoService.list(new LambdaQueryWrapper<CustomerDepartureCargo>().eq(CustomerDepartureCargo::getDepartureId, departure.getId()));
|
||||
|
||||
Integer num = cargos.stream().mapToInt(CustomerDepartureCargo::getQuantity).sum();
|
||||
Integer num = cargos.size();
|
||||
|
||||
List<CustomerDepartureDrivers> drivers = departureDriversService.list(new LambdaQueryWrapper<CustomerDepartureDrivers>().eq(CustomerDepartureDrivers::getDepartureId, departure.getId()));
|
||||
|
||||
// 获取进港时间
|
||||
Map<String, Date> carPickTime = openApi.getCarPickTime(cargos.stream().map(s -> s.getVin()).collect(Collectors.toList()));
|
||||
|
||||
PdfDocument pdfDoc = new PdfDocument(new PdfReader(inputStream), new PdfWriter(response.getOutputStream()));
|
||||
|
||||
org.springframework.core.io.Resource resource = new ClassPathResource("templates/SourceHanSansCN-Regular.ttf");
|
||||
|
@ -944,20 +1024,24 @@ public class DepartureHandler implements BaseHandler {
|
|||
byte[] bytes = IOUtils.toByteArray(stream);
|
||||
PdfFont font = PdfFontFactory.createFont(bytes, PdfEncodings.IDENTITY_H, PdfFontFactory.EmbeddingStrategy.PREFER_EMBEDDED);
|
||||
|
||||
PdfFont enFont = PdfFontFactory.createFont();
|
||||
|
||||
PdfAcroForm form = PdfAcroForm.getAcroForm(pdfDoc, false);
|
||||
|
||||
Map<String, PdfFormField> fields = form.getFormFields();
|
||||
|
||||
fields.get("batchNo").setValue(departure.getBatchNo()).setFont(font).setFontSize(12);
|
||||
fields.get("shipName").setValue(departure.getShipName()).setFont(font).setFontSize(12);
|
||||
fields.get("voyage").setValue(departure.getVoyage()).setFont(font).setFontSize(12);
|
||||
fields.get("voyage").setValue(StringUtils.isNotEmpty(departure.getVoyage()) ? departure.getVoyage() : "").setFont(font).setFontSize(12);
|
||||
fields.get("arrivalTime").setValue(DateUtil.format(departure.getArrivalTime(), "yyyy-MM-dd")).setFont(font).setFontSize(12);
|
||||
fields.get("deliveryTime").setValue(DateUtil.format(departure.getDeliveryTime(), "yyyy-MM-dd")).setFont(font).setFontSize(12);
|
||||
if (departure.getReturnTime() != null) {
|
||||
fields.get("returnTime").setValue(DateUtil.format(departure.getReturnTime(), "yyyy-MM-dd")).setFont(font).setFontSize(12);
|
||||
fields.get("num").setValue(String.valueOf(num)).setFont(font).setFontSize(12);
|
||||
if (StringUtils.isNotEmpty(departure.getRemark())) {
|
||||
fields.get("remark").setValue(departure.getRemark()).setFont(font).setFontSize(12);
|
||||
}
|
||||
fields.get("num").setValue(String.valueOf(num)).setFont(font).setFontSize(12);
|
||||
fields.get("brand").setValue(StringUtils.isNotEmpty(departure.getBrand()) ? departure.getBrand() : "").setFont(font).setFontSize(12);
|
||||
fields.get("remark").setValue(StringUtils.isNotEmpty(departure.getRemark()) ? departure.getRemark() : "").setFont(font).setFontSize(12);
|
||||
fields.get("reason").setValue(StringUtils.isNotEmpty(departure.getReason()) ? departure.getReason() : "").setFont(font).setFontSize(12);
|
||||
|
||||
Table driverTable = new Table(UnitValue.createPercentArray(new float[] {30f, 50f, 50f}));
|
||||
driverTable.addHeaderCell(new Cell().add(new Paragraph("司机姓名").setFont(font)));
|
||||
|
@ -969,18 +1053,30 @@ public class DepartureHandler implements BaseHandler {
|
|||
driverTable.addCell(new Paragraph(driver.getContactPhone()).setFont(font));
|
||||
});
|
||||
|
||||
Table cargoTable = new Table(UnitValue.createPercentArray(new float[] {30f, 50f, 50f, 50f, 50f}));
|
||||
Table cargoTable = new Table(UnitValue.createPercentArray(new float[] {30f, 50f, 50f, 50f, 50f, 50f, 50f, 50f, 50f,50f}));
|
||||
|
||||
cargoTable.addHeaderCell(new Cell().add(new Paragraph("提单号").setFont(font)));
|
||||
cargoTable.addHeaderCell(new Cell().add(new Paragraph("品牌").setFont(font)));
|
||||
cargoTable.addHeaderCell(new Cell().add(new Paragraph("货物类型").setFont(font)));
|
||||
cargoTable.addHeaderCell(new Cell().add(new Paragraph("车架号").setFont(font)));
|
||||
cargoTable.addHeaderCell(new Cell().add(new Paragraph("数量").setFont(font)));
|
||||
cargoTable.addHeaderCell(new Cell().add(new Paragraph("车型").setFont(font)));
|
||||
cargoTable.addHeaderCell(new Cell().add(new Paragraph("型号").setFont(font)));
|
||||
cargoTable.addHeaderCell(new Cell().add(new Paragraph("通关性质").setFont(font)));
|
||||
cargoTable.addHeaderCell(new Cell().add(new Paragraph("尺寸(米)").setFont(font)));
|
||||
cargoTable.addHeaderCell(new Cell().add(new Paragraph("重量(KG)").setFont(font)));
|
||||
cargoTable.addHeaderCell(new Cell().add(new Paragraph("是否退关提离").setFont(font)));
|
||||
cargoTable.addHeaderCell(new Cell().add(new Paragraph("是否随车备件").setFont(font)));
|
||||
cargoTable.addHeaderCell(new Cell().add(new Paragraph("进港时间").setFont(font)));
|
||||
|
||||
cargos.stream().forEach(cargo -> {
|
||||
cargoTable.addCell(new Paragraph(cargo.getBillNo()).setFont(font));
|
||||
cargoTable.addCell(new Paragraph(cargo.getBrand()).setFont(font));
|
||||
cargoTable.addCell(new Paragraph(cargo.getCargoType()).setFont(font));
|
||||
cargoTable.addCell(cargo.getVin());
|
||||
cargoTable.addCell(String.valueOf(cargo.getQuantity()));
|
||||
cargoTable.addCell(new Paragraph(StringUtils.isNotEmpty(cargo.getCartType()) ? cargo.getCartType() : "").setFont(font));
|
||||
cargoTable.addCell(new Paragraph(StringUtils.isNotEmpty(cargo.getModels()) ? cargo.getModels() : "").setFont(font));
|
||||
cargoTable.addCell(new Paragraph(cargo.getIsCustoms() != null ? (cargo.getIsCustoms() == 0 ? "未报关" : "已报关") : "").setFont(font));
|
||||
cargoTable.addCell(new Paragraph((cargo.getLength() != null && cargo.getWidth() != null && cargo.getHeight() != null) ? StringUtils.join(cargo.getLength(), "*", cargo.getWidth(), "\n*", cargo.getHeight()) : "").setFont(enFont));
|
||||
cargoTable.addCell(new Paragraph(cargo.getWeight() != null ? cargo.getWeight().toString() : "").setFont(font));
|
||||
cargoTable.addCell(new Paragraph(cargo.getIsShutout() != null ? (cargo.getIsShutout() == 0 ? "否" : "是") : "").setFont(font));
|
||||
cargoTable.addCell(new Paragraph(cargo.getIsSpare() != null ? (cargo.getIsSpare() == 0 ? "否" : "是") : "").setFont(font));
|
||||
cargoTable.addCell(new Paragraph(carPickTime != null && carPickTime.containsKey(cargo.getVin()) && carPickTime.get(cargo.getVin()) != null ? DateUtils.formatDate(carPickTime.get(cargo.getVin())) : "").setFont(font));
|
||||
});
|
||||
|
||||
final Document doc = new Document(pdfDoc);
|
||||
|
@ -1010,4 +1106,223 @@ public class DepartureHandler implements BaseHandler {
|
|||
|
||||
doc.close();
|
||||
}
|
||||
|
||||
@ApiOperation("提离港区导入模板下载")
|
||||
@GetMapping("/temp/down")
|
||||
public void tempDownPlan(HttpServletResponse response) throws Exception {
|
||||
// 加载模板
|
||||
ClassPathResource classPathResource = new ClassPathResource("templates/departure_temp.xlsx");
|
||||
InputStream inputStream = classPathResource.getInputStream();
|
||||
|
||||
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
|
||||
|
||||
OutputStream out = response.getOutputStream();
|
||||
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
|
||||
|
||||
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
||||
String fileName = URLEncoder.encode("提离港区导入模板", "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
workbook.write(bos);
|
||||
byte[] bArray = bos.toByteArray();
|
||||
InputStream is = new ByteArrayInputStream(bArray);
|
||||
org.apache.commons.io.IOUtils.copy(is, out);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("通过车架号获取信息")
|
||||
@PostMapping("/getInfoByVin")
|
||||
public Result<CustomerExportIn> getInfoByVin(@RequestParam(required = false) @NotBlank(message = "船ID不能为空") @ApiParam("船ID") String shipId,
|
||||
@RequestParam(required = false) @NotBlank(message = "航次ID不能为空") @ApiParam("航次ID") String voyageId,
|
||||
@RequestParam(required = false) @NotBlank(message = "港区ID不能为空") @ApiParam("港区ID") String portAreaId,
|
||||
@RequestParam(required = false) @NotBlank(message = "品牌ID不能为空") @ApiParam("品牌ID") String brandId,
|
||||
@RequestParam(required = false) @NotBlank(message = "提单号不能为空") @ApiParam("提单号") String billNo,
|
||||
@RequestParam(required = false) @NotBlank(message = "车架号不能为空") @ApiParam("车架号") String vin) {
|
||||
DepartureValidVo form = new DepartureValidVo();
|
||||
form.setBrandId(brandId);
|
||||
form.setShipId(shipId);
|
||||
form.setVoyageId(voyageId);
|
||||
form.setPortAreaId(portAreaId);
|
||||
DepartureValidVo.BillVin bvin = new DepartureValidVo.BillVin();
|
||||
bvin.setBillNo(billNo);
|
||||
bvin.setVin(vin);
|
||||
form.setVins(Arrays.asList(bvin));
|
||||
|
||||
Result<Map<String, CustomerExportIn>> mapResult = this.validVins(form);
|
||||
if (mapResult.getCode() != 0) { // 验证失败
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), mapResult.getMsg());
|
||||
}
|
||||
|
||||
return ResultUtil.success(mapResult.getData().get(vin));
|
||||
}
|
||||
|
||||
@ApiOperation("提离港区导入")
|
||||
@PostMapping("/import")
|
||||
public Result<List<DepartureImportExcel>> importExcel(@RequestParam(required = false) @NotBlank(message = "船ID不能为空") @ApiParam("船ID") String shipId,
|
||||
@RequestParam(required = false) @NotBlank(message = "航次ID不能为空") @ApiParam("航次ID") String voyageId,
|
||||
@RequestParam(required = false) @NotBlank(message = "港区ID不能为空") @ApiParam("港区ID") String portAreaId,
|
||||
@RequestParam(required = false) @NotBlank(message = "品牌ID不能为空") @ApiParam("品牌ID") String brandId,
|
||||
MultipartFile file) {
|
||||
try {
|
||||
// 所有读取的数据
|
||||
List<DepartureImportExcel> dataList = new ArrayList<>();
|
||||
|
||||
EasyExcel.read(file.getInputStream(), DepartureImportExcel.class, new ReadExcelListener<DepartureImportExcel>() {
|
||||
@Override
|
||||
protected void saveData(List<DepartureImportExcel> list) { // 缓存数据
|
||||
dataList.addAll(list);
|
||||
}
|
||||
}).sheet().doRead();
|
||||
|
||||
if (CollectionUtils.isEmpty(dataList)) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "没有读取到数据");
|
||||
}
|
||||
|
||||
ValidatorFactory vf = Validation.buildDefaultValidatorFactory();
|
||||
Validator validator = vf.getValidator();
|
||||
|
||||
// 数据验证
|
||||
for (DepartureImportExcel item : dataList) {
|
||||
Set<ConstraintViolation<DepartureImportExcel>> set = validator.validate(item);
|
||||
if (CollectionUtils.isNotEmpty(set)) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), set.stream().map(p -> p.getMessage()).collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
||||
|
||||
DepartureValidVo form = new DepartureValidVo();
|
||||
form.setBrandId(brandId);
|
||||
form.setShipId(shipId);
|
||||
form.setVoyageId(voyageId);
|
||||
form.setPortAreaId(portAreaId);
|
||||
|
||||
List<DepartureValidVo.BillVin> billVins = dataList.stream().map(item -> {
|
||||
DepartureValidVo.BillVin vin = new DepartureValidVo.BillVin();
|
||||
vin.setBillNo(item.getBillNo());
|
||||
vin.setVin(item.getVin());
|
||||
return vin;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
form.setVins(billVins);
|
||||
|
||||
Result<Map<String, CustomerExportIn>> mapResult = this.validVins(form);
|
||||
if (mapResult.getCode() != 0) { // 验证失败
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), mapResult.getMsg());
|
||||
}
|
||||
|
||||
dataList.stream().forEach(item -> {
|
||||
if (mapResult.getData().containsKey(item.getVin())) {
|
||||
CustomerExportIn in = mapResult.getData().get(item.getVin());
|
||||
item.setCartType(in.getCartType());
|
||||
item.setModels(in.getModels());
|
||||
item.setHeight(in.getHeight());
|
||||
item.setLength(in.getLength());
|
||||
item.setWidth(in.getWidth());
|
||||
item.setWeight(in.getWeight());
|
||||
}
|
||||
});
|
||||
|
||||
return ResultUtil.success(dataList);
|
||||
} catch (ExcelDataConvertException e) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入数据错误,请确认导入数据模板是否正确, 行:" + e.getRowIndex() + " 列:" + e.getColumnIndex());
|
||||
} catch (Exception e) {
|
||||
log.error("错误信息", e);
|
||||
return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("车架号验证")
|
||||
@PostMapping("/vin/valid")
|
||||
public Result<Map<String, CustomerExportIn>> validVins(@RequestBody @Validated DepartureValidVo form) {
|
||||
Map<String, CustomerExportIn> rst = new HashMap<>();
|
||||
// 所有车架号
|
||||
List<String> vins = form.getVins().stream().map(s -> s.getVin()).collect(Collectors.toList());
|
||||
// 根据车架号查询进港申请
|
||||
List<CustomerExportInCargo> list = exportInCargoService.lambdaQuery()
|
||||
.in(CustomerExportInCargo::getVin, vins)
|
||||
.exists("select id from customer_export_in B where B.id=customer_export_in_cargo.export_in_id and B.ship_id={0} and B.voyage_id={1} and port_area_id={2} and brand_id={3} and check_status={4}",
|
||||
form.getShipId(), form.getVoyageId(), form.getPortAreaId(), form.getBrandId(), AuditEnum.AUDIT_PASS).list();
|
||||
// 有进港计划的
|
||||
List<String> strings = list.stream().map(s -> s.getVin()).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(strings)) {
|
||||
// 检验提单号是否属于这个账号
|
||||
List<FreightVo> userBindFreight = openApi.getUserBindFreight();
|
||||
List<Long> ids = list.stream().map(s -> s.getExportInId()).distinct().collect(Collectors.toList());
|
||||
List<CustomerExportIn> exportIns = exportInService.lambdaQuery().in(CustomerExportIn::getId, ids).list();
|
||||
// 账号不一致的
|
||||
List<CustomerExportIn> ins = exportIns.stream().filter(item -> CollectionUtils.isEmpty(userBindFreight) || userBindFreight.stream().filter(s -> StringUtils.equalsAny(item.getFreightId(), s.getCueId())).count() == 0).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(ins)) {
|
||||
// 提示车架号不存在
|
||||
List<Long> longs = ins.stream().map(s -> s.getId()).collect(Collectors.toList());
|
||||
String collect = list.stream().filter(s -> longs.contains(s.getExportInId())).map(s -> s.getVin()).collect(Collectors.joining(","));
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "车架号"+collect+"不存在");
|
||||
}
|
||||
|
||||
// 提单号与车架号是否匹配
|
||||
Map<String, String> stringMap = form.getVins().stream().collect(Collectors.toMap(s -> s.getVin(), s -> s.getBillNo()));
|
||||
Map<Long, String> exportInMap = exportIns.stream().collect(Collectors.toMap(s -> s.getId(), s -> s.getBillNum()));
|
||||
Map<String, Long> longMap = list.stream().collect(Collectors.toMap(s -> s.getVin(), s -> s.getExportInId()));
|
||||
List<String> collect = strings.stream().filter(s -> !StringUtils.equals(stringMap.get(s), exportInMap.get(longMap.get(s)))).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(collect)) {
|
||||
String s1 = collect.stream().map(s -> "车架号" + s + "与提单号" + stringMap.get(s) + "不匹配").collect(Collectors.joining(","));
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), s1);
|
||||
}
|
||||
|
||||
// 是否做过退关退运扫描
|
||||
VinCheckReq req = new VinCheckReq();
|
||||
req.setPamId(form.getPortAreaId());
|
||||
req.setBrdId(form.getBrandId());
|
||||
req.setSpmId(form.getShipId());
|
||||
req.setVvyId(form.getVoyageId());
|
||||
req.setVinCodeList(strings);
|
||||
List<VinCheckResp> resp = openApi.vinCheckInfo(req);
|
||||
System.err.println(JSON.toJSONString(req));
|
||||
System.err.println(JSON.toJSONString(resp));
|
||||
|
||||
List<VinCheckResp> checkResps = resp.stream().filter(s -> !s.getHasShutoutScan()).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(checkResps)) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), checkResps.stream().map(s -> s.getVinCode()).collect(Collectors.joining(",")) + "暂无提离车辆信息,请联系码头确认");
|
||||
}
|
||||
|
||||
list.stream().forEach(s -> {
|
||||
rst.put(s.getVin(), exportIns.stream().filter(i -> Long.compare(i.getId(), s.getExportInId()) == 0).findFirst().get());
|
||||
});
|
||||
}
|
||||
// 没有进港计划的
|
||||
List<String> noVins = vins.stream().filter(s -> !strings.contains(s)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(noVins)) {
|
||||
// 是否做过退关退运扫描
|
||||
VinCheckReq req = new VinCheckReq();
|
||||
req.setPamId(form.getPortAreaId());
|
||||
req.setBrdId(form.getBrandId());
|
||||
req.setSpmId(form.getShipId());
|
||||
req.setVvyId(form.getVoyageId());
|
||||
req.setVinCodeList(noVins);
|
||||
List<VinCheckResp> resp = openApi.vinCheckInfo(req);
|
||||
|
||||
List<VinCheckResp> checkResps = resp.stream().filter(s -> !s.getNoPlanCollect()).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(checkResps)) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), checkResps.stream().map(s -> s.getVinCode()).collect(Collectors.joining(",")) + "车架号不正确");
|
||||
}
|
||||
|
||||
checkResps = resp.stream().filter(s -> !s.getHasShutoutScan()).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(checkResps)) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), checkResps.stream().map(s -> s.getVinCode()).collect(Collectors.joining(",")) + "暂无提离车辆信息,请联系码头确认");
|
||||
}
|
||||
}
|
||||
|
||||
return ResultUtil.success(rst);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,6 +145,7 @@ public class DictHandler implements BaseHandler {
|
|||
dto.setId(item.getPotId());
|
||||
dto.setText(item.getPotCnname());
|
||||
dto.setExtra1(item.getPotEnname());
|
||||
dto.setExtra2(item.getPotCtycd()); // 港口的国家ID
|
||||
return dto;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
@ -239,6 +240,21 @@ public class DictHandler implements BaseHandler {
|
|||
return ResultUtil.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation("国家城市全量")
|
||||
@PostMapping("/city/queryAllOrigin")
|
||||
public Result<List<CityDTO>> getAllCountryList(@RequestParam(required = false) String q) {
|
||||
|
||||
List<CityDTO> list = nuzarPubApi.getAllCountryList(q);
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return ResultUtil.success(Collections.emptyList());
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
return ResultUtil.success(list);
|
||||
}
|
||||
|
||||
// 运输方式
|
||||
@ApiOperation("运输方式")
|
||||
@PostMapping("/transportWay")
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,14 @@
|
|||
package com.haitonggauto.rtosc.handler;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.exception.ExcelDataConvertException;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
@ -19,11 +23,15 @@ import com.haitonggauto.rtosc.common.dto.DictDTO;
|
|||
import com.haitonggauto.rtosc.common.dto.Result;
|
||||
import com.haitonggauto.rtosc.common.enums.ErrorType;
|
||||
import com.haitonggauto.rtosc.common.handler.BaseHandler;
|
||||
import com.haitonggauto.rtosc.common.utils.DateUtils;
|
||||
import com.haitonggauto.rtosc.common.utils.ResultUtil;
|
||||
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
|
||||
import com.haitonggauto.rtosc.common.utils.WrapperKit;
|
||||
import com.haitonggauto.rtosc.dto.*;
|
||||
import com.haitonggauto.rtosc.excel.ExportInPlanExcel;
|
||||
import com.haitonggauto.rtosc.excel.ExportInspectExportExcel;
|
||||
import com.haitonggauto.rtosc.excel.InspectExcel;
|
||||
import com.haitonggauto.rtosc.handler.excel.ReadExcelListener;
|
||||
import com.haitonggauto.rtosc.query.CargoQuery;
|
||||
import com.haitonggauto.rtosc.query.ExportInspectCheckQuery;
|
||||
import com.haitonggauto.rtosc.query.ExportInspectQuery;
|
||||
|
@ -31,6 +39,8 @@ import com.haitonggauto.rtosc.repository.entity.*;
|
|||
import com.haitonggauto.rtosc.handler.mapper.PoMapper;
|
||||
import com.haitonggauto.rtosc.repository.enums.AuditEnum;
|
||||
import com.haitonggauto.rtosc.repository.enums.InspectStatusEnum;
|
||||
import com.haitonggauto.rtosc.repository.service.CustomerExportInCargoService;
|
||||
import com.haitonggauto.rtosc.repository.service.CustomerExportInService;
|
||||
import com.haitonggauto.rtosc.repository.service.CustomerExportInspectCargoService;
|
||||
import com.haitonggauto.rtosc.repository.service.CustomerExportInspectService;
|
||||
import com.haitonggauto.rtosc.service.CustomerService;
|
||||
|
@ -40,22 +50,34 @@ import com.nuzar.rtops.log.service.EsLogApprovalUtil;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.Validation;
|
||||
import javax.validation.Validator;
|
||||
import javax.validation.ValidatorFactory;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/ci")
|
||||
@Api(tags = "出口海关查验")
|
||||
|
@ -77,6 +99,15 @@ public class ExportInspectHandler implements BaseHandler {
|
|||
@Resource
|
||||
private NuzarYardApi yardApi;
|
||||
|
||||
@Resource
|
||||
private CustomerExportInService exportInService;
|
||||
|
||||
@Resource
|
||||
private CustomerExportInCargoService exportInCargoService;
|
||||
|
||||
@Resource
|
||||
private DictHandler dictHandler;
|
||||
|
||||
@ApiOperation("船名航次模糊匹配")
|
||||
@PostMapping("/shipVoyage")
|
||||
public Result<List<ShipVoyageVo>> getExportInShipNameList(
|
||||
|
@ -176,16 +207,19 @@ public class ExportInspectHandler implements BaseHandler {
|
|||
@ApiOperation("提单号模糊匹配")
|
||||
@PostMapping("/billNo/query")
|
||||
public Result<List<String>> getExportInBillNoList(
|
||||
@ApiParam(name = "操作方式, 0为前端,1为审核端") @RequestParam(required = false, defaultValue = "0") String type,
|
||||
@RequestParam(required = false, defaultValue = "1") Integer current,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer size,
|
||||
@RequestParam(required = false) String shipName,
|
||||
@RequestParam(required = false) String voyage,
|
||||
@RequestParam(required = false) String q) {
|
||||
LambdaQueryWrapper<CustomerExportInspect> query = new LambdaQueryWrapper<>();
|
||||
query.eq(CustomerExportInspect::getTradType, "E");
|
||||
query.eq(StringUtils.isNotEmpty(shipName), CustomerExportInspect::getShipName, shipName);
|
||||
query.eq(StringUtils.isNotEmpty(voyage), CustomerExportInspect::getVoyage, voyage);
|
||||
query.like(StringUtils.isNotEmpty(q), CustomerExportInspect::getBillNo, q); // 提单号
|
||||
QueryWrapper<CustomerExportInspect> query = new QueryWrapper<>();
|
||||
query.select("distinct bill_no");
|
||||
query.eq("trad_type", "E");
|
||||
query.eq(StringUtils.equals(type, "0"), "create_by", UserContext.getUser().getUserId());
|
||||
query.eq(StringUtils.isNotEmpty(shipName), "ship_name", shipName);
|
||||
query.eq(StringUtils.isNotEmpty(voyage), "voyage", voyage);
|
||||
query.like(StringUtils.isNotEmpty(q), "bill_no", q); // 提单号
|
||||
Page<CustomerExportInspect> page = customerExportInspectService.page(new Page<>(current, size), query);
|
||||
List<CustomerExportInspect> list = page.getRecords();
|
||||
|
||||
|
@ -211,7 +245,14 @@ public class ExportInspectHandler implements BaseHandler {
|
|||
public Result<List<InspectBillDTO>> getConfirmBillNo(@RequestParam(required = false) String voyageId,
|
||||
@RequestParam(required = false) String q) {
|
||||
|
||||
return ResultUtil.success(openApi.getExportInspectBillNoList(voyageId, q));
|
||||
List<InspectBillDTO> list = openApi.getExportInspectBillNoList(voyageId, q);
|
||||
|
||||
// 对结果按提单号进行去重处理
|
||||
Map<String, List<InspectBillDTO>> collect = list.stream().collect(Collectors.groupingBy(InspectBillDTO::getMnfBl));
|
||||
|
||||
List<InspectBillDTO> rst = collect.values().stream().map(item -> item.get(0)).collect(Collectors.toList());
|
||||
|
||||
return ResultUtil.success(rst);
|
||||
}
|
||||
|
||||
@ApiOperation("出口查验申请货物明细")
|
||||
|
@ -499,6 +540,28 @@ public class ExportInspectHandler implements BaseHandler {
|
|||
|
||||
List<CustomerExportInspectCargo> cargos = customerExportInspectCargoService.list(new LambdaQueryWrapper<CustomerExportInspectCargo>().eq(CustomerExportInspectCargo::getExportInspectId, id));
|
||||
|
||||
// 获取实时
|
||||
if (CollectionUtils.isNotEmpty(cargos)) {
|
||||
GoodsStatusReq req = new GoodsStatusReq();
|
||||
req.setBusinessType("INSPECT");
|
||||
req.setImportExportType("E");
|
||||
req.setVvyId(StringUtils.equalsAnyIgnoreCase(exportInspect.getVoyageId(), "HT6", "HTLG", "HTTC") ? "" : exportInspect.getVoyageId());
|
||||
req.setVinCodeList(cargos.stream().map(p -> p.getVin()).collect(Collectors.toList()));
|
||||
|
||||
List<GoodsStatusResp> resp = openApi.getGoodsStatus(req);
|
||||
|
||||
Map<String, GoodsStatusResp> respMap = resp.stream().collect(Collectors.toMap(p -> p.getVinCode(), p -> p));
|
||||
|
||||
cargos.stream().forEach(p -> {
|
||||
GoodsStatusResp r = respMap.get(p.getVin());
|
||||
if (r != null) {
|
||||
p.setArea(r.getPosition());
|
||||
} else {
|
||||
p.setArea("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
customerService.wrapperEntity(cargos);
|
||||
|
||||
exportInspect.setCargos(cargos);
|
||||
|
@ -542,6 +605,34 @@ public class ExportInspectHandler implements BaseHandler {
|
|||
}
|
||||
Page<CustomerExportInspectCargo> page = customerExportInspectCargoService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper);
|
||||
|
||||
// 获取实时
|
||||
if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
||||
// 需要按InspectId 进行分组
|
||||
Map<Long, List<CustomerExportInspectCargo>> collect = page.getRecords().stream().collect(Collectors.groupingBy(CustomerExportInspectCargo::getExportInspectId));
|
||||
collect.entrySet().forEach(item -> {
|
||||
CustomerExportInspect inspect = customerExportInspectService.getById(item.getKey());
|
||||
|
||||
GoodsStatusReq req = new GoodsStatusReq();
|
||||
req.setBusinessType("INSPECT");
|
||||
req.setImportExportType("E");
|
||||
req.setVvyId(StringUtils.equalsAnyIgnoreCase(inspect.getVoyageId(), "HT6", "HTLG", "HTTC") ? "" : inspect.getVoyageId());
|
||||
req.setVinCodeList(item.getValue().stream().map(p -> p.getVin()).collect(Collectors.toList()));
|
||||
|
||||
List<GoodsStatusResp> resp = openApi.getGoodsStatus(req);
|
||||
|
||||
Map<String, GoodsStatusResp> respMap = resp.stream().collect(Collectors.toMap(p -> p.getVinCode(), p -> p));
|
||||
|
||||
page.getRecords().stream().filter(p -> p.getExportInspectId() == item.getKey()).forEach(p -> {
|
||||
GoodsStatusResp r = respMap.get(p.getVin());
|
||||
if (r != null) {
|
||||
p.setArea(r.getPosition());
|
||||
} else {
|
||||
p.setArea("");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
customerService.wrapperEntity(page.getRecords());
|
||||
|
||||
return ResultUtil.success(page);
|
||||
|
@ -569,6 +660,41 @@ public class ExportInspectHandler implements BaseHandler {
|
|||
return ResultUtil.success(exportInspect);
|
||||
}
|
||||
|
||||
@ApiOperation("获取查验货物明细")
|
||||
@PostMapping("/inspect/cargo/detail")
|
||||
public Result<Page<CustomerExportInspectCargo>> inspectCargoDetail(@RequestBody ExportInspectCheckQuery query) {
|
||||
// 要么传 船ID和航次ID 要么传ids
|
||||
LambdaQueryWrapper<CustomerExportInspectCargo> cQuery = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotEmpty(query.getShipId()) && StringUtils.isNotEmpty(query.getVoyageId())) {
|
||||
cQuery.exists("select id from customer_export_inspect where customer_export_inspect.id=customer_export_inspect_cargo.export_inspect_id and ship_id={0} and voyage_id={1}", query.getShipId(), query.getVoyageId());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(query.getIds())) {
|
||||
cQuery.in(CustomerExportInspectCargo::getExportInspectId, query.getIds());
|
||||
}
|
||||
|
||||
Page<CustomerExportInspectCargo> page = customerExportInspectCargoService.page(new Page<>(query.getPage(), query.getRows()), cQuery);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
||||
List<String> vins = page.getRecords().stream().map(item -> item.getVin()).collect(Collectors.toList());
|
||||
List<Long> ids = page.getRecords().stream().map(item -> item.getExportInspectId()).distinct().collect(Collectors.toList());
|
||||
// 获取表头信息
|
||||
List<CustomerExportInspect> list = customerExportInspectService.lambdaQuery().in(CustomerExportInspect::getId, ids).list();
|
||||
Map<Long, CustomerExportInspect> collect = list.stream().collect(Collectors.toMap(CustomerExportInspect::getId, item -> item));
|
||||
|
||||
// 判断车辆是否在场
|
||||
List<VinStatus> vinStatus = yardApi.getVinStatus(vins);
|
||||
List<String> exists = vinStatus.stream().map(item -> item.getVinCode()).collect(Collectors.toList());
|
||||
|
||||
page.getRecords().stream().forEach(item -> {
|
||||
item.setInspect(collect.get(item.getExportInspectId()));
|
||||
item.setInArea(exists.contains(item.getVin()));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return ResultUtil.success(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
*
|
||||
|
@ -597,8 +723,8 @@ public class ExportInspectHandler implements BaseHandler {
|
|||
log.setOperateData(record);
|
||||
log.setStatus(check.getCheckStatus() == AuditEnum.AUDIT_PASS ? 0 : 1);
|
||||
log.setOperateTime(new Date());
|
||||
log.setUserId(SecurityUtils.getUserId());
|
||||
log.setUserName(SecurityUtils.getUserName());
|
||||
log.setUserId(UserContext.getUser().getUserId());
|
||||
log.setUserName(UserContext.getUser().getUsername());
|
||||
EsLogApprovalUtil.writeLog(log);
|
||||
}
|
||||
|
||||
|
@ -644,8 +770,8 @@ public class ExportInspectHandler implements BaseHandler {
|
|||
log.setOperateData(record);
|
||||
log.setStatus(check.getCheckStatus() == AuditEnum.AUDIT_PASS ? 0 : 1);
|
||||
log.setOperateTime(new Date());
|
||||
log.setUserId(SecurityUtils.getUserId());
|
||||
log.setUserName(SecurityUtils.getUserName());
|
||||
log.setUserId(UserContext.getUser().getUserId());
|
||||
log.setUserName(UserContext.getUser().getUsername());
|
||||
EsLogApprovalUtil.writeLog(log);
|
||||
}
|
||||
|
||||
|
@ -746,6 +872,7 @@ public class ExportInspectHandler implements BaseHandler {
|
|||
|
||||
private void write(AtomicInteger index, List<CustomerExportInspect> headers, ExcelWriter excelWriter, WriteSheet writeSheet) {
|
||||
if (CollectionUtils.isEmpty(headers)) {
|
||||
excelWriter.write(new ArrayList<>(), writeSheet);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -769,6 +896,10 @@ public class ExportInspectHandler implements BaseHandler {
|
|||
|
||||
// 备件号排序
|
||||
List<ExportInspectExportExcel> details = list.stream().filter(p -> ids.contains(p.getExportInspectId()))
|
||||
.map(s -> {
|
||||
s.setCartType(StringUtils.isBlank(s.getCartType()) ? "":s.getCartType());
|
||||
return s;
|
||||
})
|
||||
.sorted(Comparator.comparing(CustomerExportInspectCargo::getCartType).reversed())
|
||||
.map(p -> {
|
||||
CustomerExportInspect head = collect.get(p.getExportInspectId());
|
||||
|
@ -782,4 +913,337 @@ public class ExportInspectHandler implements BaseHandler {
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation("出口查验导入模板下载")
|
||||
@GetMapping("/temp/down")
|
||||
public void tempDownPlan(HttpServletResponse response) throws Exception {
|
||||
// 加载模板
|
||||
ClassPathResource classPathResource = new ClassPathResource("templates/export_inspect_temp.xlsx");
|
||||
InputStream inputStream = classPathResource.getInputStream();
|
||||
|
||||
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
|
||||
|
||||
OutputStream out = response.getOutputStream();
|
||||
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
|
||||
|
||||
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
||||
String fileName = URLEncoder.encode("出口查验导入模板", "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
workbook.write(bos);
|
||||
byte[] bArray = bos.toByteArray();
|
||||
InputStream is = new ByteArrayInputStream(bArray);
|
||||
IOUtils.copy(is, out);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("出口查验导入")
|
||||
@PostMapping("/inspect/import-to-add")
|
||||
public Result<List<JSONObject>> exportInPlanUpload(
|
||||
@ApiParam(name = "操作方式, 0为前端,1为审核端") @RequestParam(required = false, defaultValue = "0") String type,
|
||||
MultipartFile file) {
|
||||
// 所有读取的数据
|
||||
List<InspectExcel> dataList = new ArrayList<>();
|
||||
|
||||
// 有错误的数据
|
||||
List<JSONObject> errorDataList = new ArrayList<>();
|
||||
|
||||
// 验证通过的数据
|
||||
List<JSONObject> successDataList = new ArrayList<>();
|
||||
|
||||
Map<String, CustomerExportInspect> headMap = new HashMap<>();
|
||||
Map<String, List<CustomerExportInspectCargo>> detailMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
|
||||
EasyExcel.read(file.getInputStream(), InspectExcel.class, new ReadExcelListener<InspectExcel>() {
|
||||
@Override
|
||||
protected void saveData(List<InspectExcel> list) { // 保存数据
|
||||
dataList.addAll(list);
|
||||
}
|
||||
}).sheet().doRead();
|
||||
|
||||
ValidatorFactory vf = Validation.buildDefaultValidatorFactory();
|
||||
Validator validator = vf.getValidator();
|
||||
|
||||
List<InspectExcel> validData = new ArrayList<>();
|
||||
|
||||
// 需要保存的数据
|
||||
List<InspectExcel> saveData = new ArrayList<>();
|
||||
|
||||
// 数据验证
|
||||
dataList.stream().forEach(item -> {
|
||||
Set<ConstraintViolation<InspectExcel>> set = validator.validate(item);
|
||||
if (CollectionUtils.isEmpty(set)) { // 验证通过的
|
||||
validData.add(item);
|
||||
} else { // 验证失败的
|
||||
JSONObject o = JSONObject.from(item);
|
||||
o.put("status", set.stream().map(p -> p.getMessage()).collect(Collectors.joining(",")));
|
||||
errorDataList.add(o);
|
||||
}
|
||||
});
|
||||
|
||||
if (CollectionUtils.isEmpty(validData)) { // 数据完整性检验
|
||||
if (CollectionUtils.isEmpty(errorDataList)) { // 代表没有读取到数据
|
||||
JSONObject o = new JSONObject();
|
||||
o.put("status", "未读取到数据");
|
||||
errorDataList.add(o);
|
||||
}
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList);
|
||||
}
|
||||
|
||||
// 获取用户绑定的货代
|
||||
List<FreightVo> userBindFreight = openApi.getUserBindFreight();
|
||||
|
||||
// 港区基础数据
|
||||
List<DictDTO> portAreaList = dictHandler.getPortAreaList(null).getData();
|
||||
|
||||
// 航次不能为空
|
||||
validData.stream().forEach(item -> {
|
||||
if (portAreaList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getPortArea())).count() == 0) {
|
||||
JSONObject o = JSONObject.from(item);
|
||||
o.put("status", "港区不存在");
|
||||
errorDataList.add(o);
|
||||
return;
|
||||
}
|
||||
saveData.add(item);
|
||||
});
|
||||
|
||||
// 首先按对船名,般次,提单进行分组
|
||||
Map<String, List<InspectExcel>> inMap = saveData.stream()
|
||||
.collect(Collectors.groupingBy(item -> StringUtils.joinWith("#$#", item.getShipName(), StringUtils.isEmpty(item.getVoyage()) ? " " : item.getVoyage(), item.getBillNo()), Collectors.toList()));
|
||||
|
||||
inMap.entrySet().forEach(item -> {
|
||||
String[] keys = StringUtils.split(item.getKey(), "#$#");
|
||||
String shipName = keys[0]; // 船名
|
||||
String voyageName = keys[1]; // 航次
|
||||
String billNo = keys[2]; // 提单号
|
||||
|
||||
// 判断船名是否在进港计划中
|
||||
List<CustomerExportIn> list = exportInService.lambdaQuery().eq(CustomerExportIn::getShipName, shipName)
|
||||
.ne(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_REJECT)
|
||||
.last("limit 1").list();
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
errorDataList.addAll(item.getValue().stream().map(p -> {
|
||||
JSONObject o = JSONObject.from(p);
|
||||
o.put("status", "查验申请中的船名不存在");
|
||||
return o;
|
||||
}).collect(Collectors.toList()));
|
||||
return;
|
||||
}
|
||||
// 如果航次不为空
|
||||
if (StringUtils.isNotBlank(voyageName)) {
|
||||
list = exportInService.lambdaQuery().eq(CustomerExportIn::getShipName, shipName)
|
||||
.eq(CustomerExportIn::getVoyage, voyageName)
|
||||
.ne(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_REJECT)
|
||||
.last("limit 1").list();
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
errorDataList.addAll(item.getValue().stream().map(p -> {
|
||||
JSONObject o = JSONObject.from(p);
|
||||
o.put("status", "查验申请中的航次不存在");
|
||||
return o;
|
||||
}).collect(Collectors.toList()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 判断提单号
|
||||
list = exportInService.lambdaQuery().eq(CustomerExportIn::getShipName, shipName)
|
||||
.eq(StringUtils.isNotEmpty(voyageName), CustomerExportIn::getVoyage, voyageName)
|
||||
.eq(CustomerExportIn::getBillNum, billNo)
|
||||
.ne(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_REJECT)
|
||||
.last("limit 1").list();
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
errorDataList.addAll(item.getValue().stream().map(p -> {
|
||||
JSONObject o = JSONObject.from(p);
|
||||
o.put("status", StringUtils.isNotEmpty(voyageName) ? "该船名航次下的提单号不存在" : "该船名下的提单号不存在");
|
||||
return o;
|
||||
}).collect(Collectors.toList()));
|
||||
return;
|
||||
}
|
||||
|
||||
CustomerExportIn in = list.get(0);
|
||||
|
||||
// 提单对应的货代与登录账号是否一致
|
||||
Long id = in.getId();
|
||||
String freightId = in.getFreightId();
|
||||
if (CollectionUtils.isEmpty(userBindFreight) || userBindFreight.stream().filter(s -> StringUtils.equals(freightId, s.getCueId())).count() == 0) {
|
||||
errorDataList.addAll(item.getValue().stream().map(p -> {
|
||||
JSONObject o = JSONObject.from(p);
|
||||
o.put("status", "提单号的货代与登录账号不一致");
|
||||
return o;
|
||||
}).collect(Collectors.toList()));
|
||||
return;
|
||||
}
|
||||
|
||||
// 车架号是否在该提单下
|
||||
Map<String, InspectExcel> vins = item.getValue().stream().collect(Collectors.toMap(InspectExcel::getVin, s -> s));
|
||||
List<CustomerExportInCargo> exists = exportInCargoService.lambdaQuery().eq(CustomerExportInCargo::getExportInId, id)
|
||||
.in(CustomerExportInCargo::getVin, vins.keySet()).list();
|
||||
List<String> existsVins = exists.stream().map(s -> s.getVin()).collect(Collectors.toList());
|
||||
List<String> collect = vins.keySet().stream().filter(s -> !existsVins.contains(s)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(collect)) {
|
||||
collect.stream().forEach(s -> {
|
||||
JSONObject o = JSONObject.from(vins.get(s));
|
||||
o.put("status", "提单号不存在此车架号");
|
||||
errorDataList.add(o);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 港区是否一致
|
||||
long count = item.getValue().stream().map(s -> s.getPortArea()).collect(Collectors.toList())
|
||||
.stream().filter(s -> !StringUtils.equals(s, in.getPortArea())).count();
|
||||
if (count > 0) {
|
||||
errorDataList.addAll(item.getValue().stream().map(p -> {
|
||||
JSONObject o = JSONObject.from(p);
|
||||
o.put("status", "港区不一致");
|
||||
return o;
|
||||
}).collect(Collectors.toList()));
|
||||
return;
|
||||
}
|
||||
|
||||
CustomerExportInspect head = PoMapper.instance.excel2Entity(item.getValue().get(0));
|
||||
|
||||
String batchNo = customerService.getSequenceNo("inspect_in_batch_no", "出口查验", "CI");
|
||||
head.setInspectStatus(InspectStatusEnum.NO_INSPECT);
|
||||
head.setBatchNo(batchNo);
|
||||
head.setApplicantId(UserContext.getUser().getUserId());
|
||||
head.setTradType("E");
|
||||
head.setPortAreaId(in.getPortAreaId());
|
||||
head.setCheckStatus(StringUtils.equals(type, "1") ? AuditEnum.AUDIT : AuditEnum.SUBMIT);
|
||||
head.setTermcd(head.getPortAreaId());
|
||||
head.setApplyTime(new Date());
|
||||
head.setShipId(in.getShipId());
|
||||
head.setShipEnName(in.getShipEnName());
|
||||
if (StringUtils.isNotEmpty(head.getVoyage())) {
|
||||
head.setVoyageId(in.getVoyageId());
|
||||
}
|
||||
head.setApplyObjId(in.getFreightId());
|
||||
head.setApplyObj(in.getFreight());
|
||||
if (StringUtils.isEmpty(head.getCompany())) {
|
||||
head.setCompany(head.getApplyObj());
|
||||
}
|
||||
|
||||
List<CustomerExportInspectCargo> detail = item.getValue().stream().map(s -> {
|
||||
CustomerExportInspectCargo c = new CustomerExportInspectCargo();
|
||||
c.setCargoType(StringUtils.startsWith(s.getVin(), "BJ") ? 1 : 0);
|
||||
c.setBrand(in.getBrand());
|
||||
c.setBrandId(in.getBrandId());
|
||||
c.setCartTypeId(in.getCartTypeId());
|
||||
c.setCartType(in.getCartType());
|
||||
c.setModels(in.getModels());
|
||||
c.setVin(s.getVin());
|
||||
return c;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
head.setPlannedCargoQuantity((int)detail.stream().filter( s -> s.getCargoType() == 0).count());
|
||||
head.setPlannedSpareQuantity(detail.size() - head.getPlannedCargoQuantity());
|
||||
|
||||
headMap.put(item.getKey(), head);
|
||||
detailMap.put(item.getKey(), detail);
|
||||
|
||||
});
|
||||
|
||||
if (CollectionUtils.isNotEmpty(errorDataList)) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList);
|
||||
}
|
||||
|
||||
// 判断车辆是否在场
|
||||
List<VinStatus> vinStatus = yardApi.getVinStatus(dataList.stream().map(s -> s.getVin()).collect(Collectors.toList()));
|
||||
if (CollectionUtils.isEmpty(vinStatus)) {
|
||||
errorDataList.addAll(dataList.stream().map(p -> {
|
||||
JSONObject o = JSONObject.from(p);
|
||||
o.put("status", "所有查验的车架号均不在场");
|
||||
return o;
|
||||
}).collect(Collectors.toList()));
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList);
|
||||
}
|
||||
|
||||
Map<String, VinStatus> vinStatusMap = vinStatus.stream().collect(Collectors.toMap(VinStatus::getVinCode, s -> s));
|
||||
|
||||
// 保存对象
|
||||
headMap.keySet().stream().forEach(s -> customerService.saveExportInspect(headMap.get(s), detailMap.get(s)));
|
||||
|
||||
successDataList.addAll(dataList.stream().map(p -> {
|
||||
JSONObject o = JSONObject.from(p);
|
||||
o.put("status", "成攻");
|
||||
o.put("yardPos", vinStatusMap.containsKey(p.getVin()) ? vinStatusMap.get(p.getVin()).getYardPos() : "未进港");
|
||||
return o;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
} catch (ExcelDataConvertException e) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入数据错误,请确认导入数据模板是否正确, 行:"+e.getRowIndex()+" 列:" + e.getColumnIndex());
|
||||
} catch (Exception e) {
|
||||
log.error("上传错误", e);
|
||||
return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), e.getMessage());
|
||||
}
|
||||
|
||||
List<JSONObject> rst = new ArrayList<>();
|
||||
rst.addAll(successDataList.stream().filter(s -> StringUtils.isNotBlank(s.getString("yardPos"))).collect(Collectors.toList()));
|
||||
rst.addAll(successDataList.stream().filter(s -> StringUtils.isBlank(s.getString("yardPos"))).collect(Collectors.toList()));
|
||||
|
||||
return ResultUtil.success(rst);
|
||||
}
|
||||
|
||||
@ApiOperation("验证航次是否在进港计划中")
|
||||
@PostMapping("/valid/voyage")
|
||||
public Result<Boolean> validVoyage(@RequestParam @NotBlank(message = "船ID不能为空") String shipId, @RequestParam @NotBlank(message = "航次ID不能为空") String voyageId) {
|
||||
Long count = exportInService.lambdaQuery().eq(CustomerExportIn::getVoyageId, voyageId)
|
||||
.eq(CustomerExportIn::getShipId, shipId).count();
|
||||
|
||||
return ResultUtil.success(count > 0);
|
||||
}
|
||||
|
||||
@ApiOperation("提单号,货代,车架号验证")
|
||||
@PostMapping("/valid/billno")
|
||||
public Result<JSONObject> validBillno(@RequestBody InspectValidVo form) {
|
||||
List<CustomerExportIn> list = exportInService.lambdaQuery().eq(CustomerExportIn::getShipId, form.getShipId())
|
||||
.eq(CustomerExportIn::getBillNum, form.getBillNo())
|
||||
.ne(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_REJECT)
|
||||
.list();
|
||||
|
||||
if(CollectionUtil.isEmpty(list)) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(),"该船名下提单号不存在");
|
||||
}
|
||||
|
||||
// 获取用户绑定的货代
|
||||
List<FreightVo> userBindFreight = openApi.getUserBindFreight();
|
||||
if (CollectionUtils.isEmpty(userBindFreight) || userBindFreight.stream().filter(s -> StringUtils.equals(list.get(0).getFreightId(), s.getCueId())).count() == 0) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(),"提单号的货代与登录账号不一致");
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(form.getVins())) {
|
||||
List<CustomerExportInCargo> cargos = exportInCargoService.lambdaQuery().in(CustomerExportInCargo::getExportInId, list.stream().map(s -> s.getId()).collect(Collectors.toList()))
|
||||
.in(CustomerExportInCargo::getVin, form.getVins()).list();
|
||||
List<String> collect = cargos.stream().map(s -> s.getVin()).collect(Collectors.toList());
|
||||
List<String> strings = form.getVins().stream().filter(s -> !collect.contains(s)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(strings)) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(),"提单号不存在此车架号," + StringUtils.join(strings, ","));
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject rst = new JSONObject();
|
||||
rst.put("portAreaId", list.get(0).getPortAreaId());
|
||||
rst.put("portArea", list.get(0).getPortArea());
|
||||
|
||||
|
||||
return ResultUtil.success(rst);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,6 +4,7 @@ import cn.hutool.core.date.DatePattern;
|
|||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.exception.ExcelDataConvertException;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
|
@ -12,13 +13,18 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.haitonggauto.rtosc.api.NuzarMiniApi;
|
||||
import com.haitonggauto.rtosc.api.NuzarShpApi;
|
||||
import com.haitonggauto.rtosc.api.dto.VoyageReq;
|
||||
import com.haitonggauto.rtosc.api.dto.VoyageResp;
|
||||
import com.haitonggauto.rtosc.common.context.UserContext;
|
||||
import com.haitonggauto.rtosc.common.dto.DictDTO;
|
||||
import com.haitonggauto.rtosc.common.dto.Result;
|
||||
import com.haitonggauto.rtosc.common.enums.ErrorType;
|
||||
import com.haitonggauto.rtosc.common.handler.BaseHandler;
|
||||
import com.haitonggauto.rtosc.common.utils.*;
|
||||
import com.haitonggauto.rtosc.dto.FreeTradeCheckVo;
|
||||
import com.haitonggauto.rtosc.dto.FreeTradeVo;
|
||||
import com.haitonggauto.rtosc.dto.ValidVinActivateVo;
|
||||
import com.haitonggauto.rtosc.dto.VoyageSubmitVo;
|
||||
import com.haitonggauto.rtosc.excel.*;
|
||||
import com.haitonggauto.rtosc.handler.excel.ReadExcelListener;
|
||||
|
@ -36,6 +42,7 @@ import com.nuzar.rtops.log.dto.LogRecordDTO;
|
|||
import com.nuzar.rtops.log.service.EsLogApprovalUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -61,6 +68,7 @@ import java.util.stream.Collectors;
|
|||
@RequestMapping("/spz")
|
||||
@Api(tags = "特保区")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class FreeTradeHandler implements BaseHandler {
|
||||
|
||||
@Resource
|
||||
|
@ -72,6 +80,12 @@ public class FreeTradeHandler implements BaseHandler {
|
|||
@Resource
|
||||
private NuzarMiniApi miniApi;
|
||||
|
||||
@Resource
|
||||
private NuzarShpApi shpApi;
|
||||
|
||||
@Resource
|
||||
private DictHandler dictHandler;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
|
@ -265,26 +279,46 @@ public class FreeTradeHandler implements BaseHandler {
|
|||
return ResultUtil.success("success");
|
||||
}
|
||||
|
||||
@ApiOperation("返回车架号详情, IsActivate 为 1 代表已激活")
|
||||
@PostMapping("/valid-vins-all")
|
||||
public Result<List<CustomerFreeTrade>> validAllVins(@RequestBody @Validated ValidVinActivateVo vo) {
|
||||
List<CustomerFreeTrade> list = customerFreeTradeService.lambdaQuery()
|
||||
.eq(StringUtils.isNotEmpty(vo.getShipId()), CustomerFreeTrade::getShipId, vo.getShipId())
|
||||
.eq(StringUtils.isNotEmpty(vo.getVoyageId()), CustomerFreeTrade::getVoyageId, vo.getVoyageId())
|
||||
.in(CustomerFreeTrade::getVin, vo.getVins()).list();
|
||||
// 返回的车架号信息
|
||||
// List<String> collect = list.stream().map(item -> item.getVin()).collect(Collectors.toList());
|
||||
// 待激活的车架号信息
|
||||
// List<String> noActivate = list.stream().filter(item -> item.getIsActivate() == ActiveEnum.NO).map(item -> item.getVin()).collect(Collectors.toList());
|
||||
// List<String> noValid = vins.stream().filter(item -> !collect.contains(item) || noActivate.contains(item)).collect(Collectors.toList());
|
||||
// if (CollectionUtils.isNotEmpty(noValid)) {
|
||||
// return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(noValid, ","));
|
||||
// }
|
||||
return ResultUtil.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证车架号状态是否激活
|
||||
* @param vins
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("验证车架号激活状态")
|
||||
@ApiOperation("验证车架号激活状态, 返回已激活车架号详情")
|
||||
@PostMapping("/valid-vins")
|
||||
public Result<String> validVins(@RequestBody
|
||||
@NotNull(message = "请传入车架号列表")
|
||||
@Size(min = 1, message = "车架号列表不能为空") List<String> vins) {
|
||||
List<CustomerFreeTrade> list = customerFreeTradeService.lambdaQuery().in(CustomerFreeTrade::getVin, vins).list();
|
||||
public Result<List<CustomerFreeTrade>> validVins(@RequestBody @Validated ValidVinActivateVo vo) {
|
||||
List<CustomerFreeTrade> list = customerFreeTradeService.lambdaQuery()
|
||||
.eq(StringUtils.isNotEmpty(vo.getShipId()), CustomerFreeTrade::getShipId, vo.getShipId())
|
||||
.eq(StringUtils.isNotEmpty(vo.getVoyageId()), CustomerFreeTrade::getVoyageId, vo.getVoyageId())
|
||||
.eq(CustomerFreeTrade::getIsActivate, ActiveEnum.YES)
|
||||
.in(CustomerFreeTrade::getVin, vo.getVins()).list();
|
||||
// 返回的车架号信息
|
||||
List<String> collect = list.stream().map(item -> item.getVin()).collect(Collectors.toList());
|
||||
// List<String> collect = list.stream().map(item -> item.getVin()).collect(Collectors.toList());
|
||||
// 待激活的车架号信息
|
||||
List<String> noActivate = list.stream().filter(item -> item.getIsActivate() == ActiveEnum.NO).map(item -> item.getVin()).collect(Collectors.toList());
|
||||
List<String> noValid = vins.stream().filter(item -> !collect.contains(item) || noActivate.contains(item)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(noValid)) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(noValid, ","));
|
||||
}
|
||||
return ResultUtil.success("success");
|
||||
// List<String> noActivate = list.stream().filter(item -> item.getIsActivate() == ActiveEnum.NO).map(item -> item.getVin()).collect(Collectors.toList());
|
||||
// List<String> noValid = vins.stream().filter(item -> !collect.contains(item) || noActivate.contains(item)).collect(Collectors.toList());
|
||||
// if (CollectionUtils.isNotEmpty(noValid)) {
|
||||
// return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(noValid, ","));
|
||||
// }
|
||||
return ResultUtil.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -329,8 +363,8 @@ public class FreeTradeHandler implements BaseHandler {
|
|||
log.setOperateData(record);
|
||||
log.setStatus(check.getCheckStatus() == AuditEnum.AUDIT_PASS ? 0 : 1);
|
||||
log.setOperateTime(new Date());
|
||||
log.setUserId(SecurityUtils.getUserId());
|
||||
log.setUserName(SecurityUtils.getUserName());
|
||||
log.setUserId(UserContext.getUser().getUserId());
|
||||
log.setUserName(UserContext.getUser().getUsername());
|
||||
EsLogApprovalUtil.writeLog(log);
|
||||
}
|
||||
|
||||
|
@ -408,7 +442,7 @@ public class FreeTradeHandler implements BaseHandler {
|
|||
@PostMapping("/import-to-add")
|
||||
public Result<List<JSONObject>> upload(
|
||||
@RequestParam(required = false, defaultValue = "0") String type,
|
||||
MultipartFile file) throws IOException {
|
||||
MultipartFile file) {
|
||||
// 所有读取的数据
|
||||
List<FreeTradeExcel> dataList = new ArrayList<>();
|
||||
|
||||
|
@ -418,6 +452,14 @@ public class FreeTradeHandler implements BaseHandler {
|
|||
// 验证成功的数据
|
||||
List<JSONObject> successDataList = new ArrayList<>();
|
||||
|
||||
// 船名基础数据
|
||||
List<DictDTO> shipList = dictHandler.getAllShip(null).getData();
|
||||
|
||||
// 航次缴存
|
||||
Map<String, String> voyageMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
|
||||
EasyExcel.read(file.getInputStream(), FreeTradeExcel.class, new ReadExcelListener<FreeTradeExcel>() {
|
||||
@Override
|
||||
protected void saveData(List<FreeTradeExcel> list) { // 保存数据
|
||||
|
@ -444,6 +486,41 @@ public class FreeTradeHandler implements BaseHandler {
|
|||
|
||||
// 所有数据验证都不通过
|
||||
if (CollectionUtils.isEmpty(validData)) {
|
||||
if (CollectionUtils.isEmpty(errorDataList)) { // 代表没有读取到数据
|
||||
JSONObject o = new JSONObject();
|
||||
o.put("status", "未读取到数据");
|
||||
errorDataList.add(o);
|
||||
}
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList);
|
||||
}
|
||||
|
||||
validData.stream().forEach(item -> {
|
||||
if (shipList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getShipName())).count() == 0) {
|
||||
JSONObject o = JSONObject.from(item);
|
||||
o.put("status", "船名不存在");
|
||||
errorDataList.add(o);
|
||||
return;
|
||||
}
|
||||
if (!voyageMap.containsKey(StringUtils.join(item.getShipName(), item.getVoyage()))) {
|
||||
VoyageReq req = new VoyageReq();
|
||||
req.setSpmName(item.getShipName());
|
||||
req.setVvyName(item.getVoyage());
|
||||
List<VoyageResp> resp = shpApi.queryVvyListByVvNameAndSpmName(Arrays.asList(req));
|
||||
if (CollectionUtils.isEmpty(resp)) {
|
||||
voyageMap.put(StringUtils.join(item.getShipName(), item.getVoyage()), "");
|
||||
} else {
|
||||
voyageMap.put(StringUtils.join(item.getShipName(), item.getVoyage()), StringUtils.trim(resp.get(0).getVvyId()));
|
||||
}
|
||||
}
|
||||
if (StringUtils.isEmpty(voyageMap.get(StringUtils.join(item.getShipName(), item.getVoyage())))) {
|
||||
JSONObject o = JSONObject.from(item);
|
||||
o.put("status", "航次不存在");
|
||||
errorDataList.add(o);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
if (CollectionUtils.isNotEmpty(errorDataList)) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList);
|
||||
}
|
||||
|
||||
|
@ -461,6 +538,11 @@ public class FreeTradeHandler implements BaseHandler {
|
|||
|
||||
List<CustomerFreeTrade> collect = validData.stream().map(item -> {
|
||||
CustomerFreeTrade freeTrade = PoMapper.instance.excel2Entity(item);
|
||||
|
||||
freeTrade.setShipId(shipList.stream().filter(s -> StringUtils.equalsIgnoreCase(s.getText(), item.getShipName())).findFirst().get().getId());
|
||||
freeTrade.setShipEnName(shipList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getShipName())).findFirst().get().getExtra1());
|
||||
freeTrade.setVoyageId(voyageMap.get(StringUtils.join(item.getShipName(), item.getVoyage())));
|
||||
|
||||
freeTrade.setApplicantId(UserContext.getUser().getUserId());
|
||||
freeTrade.setIsActivate(ActiveEnum.NO);
|
||||
freeTrade.setApplyTime(new Date());
|
||||
|
@ -508,6 +590,12 @@ public class FreeTradeHandler implements BaseHandler {
|
|||
customerFreeTradeService.saveBatch(save);
|
||||
|
||||
return ResultUtil.success(errorDataList);
|
||||
} catch (ExcelDataConvertException e) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入数据错误,请确认导入数据模板是否正确, 行:"+e.getRowIndex()+" 列:" + e.getColumnIndex());
|
||||
} catch (Exception e) {
|
||||
log.error("错误信息", e);
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("导入删除")
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.haitonggauto.rtosc.handler;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/health")
|
||||
public class HeathCheckHandler {
|
||||
@GetMapping("/ping")
|
||||
public String ping() {
|
||||
return "pong";
|
||||
}
|
||||
}
|
|
@ -2,15 +2,21 @@ package com.haitonggauto.rtosc.handler;
|
|||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.exception.ExcelDataConvertException;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.haitonggauto.rtosc.api.NuzarOpenApi;
|
||||
import com.haitonggauto.rtosc.api.NuzarShpApi;
|
||||
import com.haitonggauto.rtosc.api.NuzarYardApi;
|
||||
import com.haitonggauto.rtosc.api.dto.*;
|
||||
import com.haitonggauto.rtosc.api.dto.log.ImportInspectLog;
|
||||
import com.haitonggauto.rtosc.common.context.UserContext;
|
||||
|
@ -18,12 +24,16 @@ import com.haitonggauto.rtosc.common.dto.DictDTO;
|
|||
import com.haitonggauto.rtosc.common.dto.Result;
|
||||
import com.haitonggauto.rtosc.common.enums.ErrorType;
|
||||
import com.haitonggauto.rtosc.common.handler.BaseHandler;
|
||||
import com.haitonggauto.rtosc.common.utils.DateUtils;
|
||||
import com.haitonggauto.rtosc.common.utils.ResultUtil;
|
||||
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
|
||||
import com.haitonggauto.rtosc.common.utils.WrapperKit;
|
||||
import com.haitonggauto.rtosc.dto.*;
|
||||
import com.haitonggauto.rtosc.excel.ExportInPlanExcel;
|
||||
import com.haitonggauto.rtosc.excel.ExportInspectExportExcel;
|
||||
import com.haitonggauto.rtosc.excel.ImportInspectExportExcel;
|
||||
import com.haitonggauto.rtosc.excel.InspectExcel;
|
||||
import com.haitonggauto.rtosc.handler.excel.ReadExcelListener;
|
||||
import com.haitonggauto.rtosc.handler.mapper.PoMapper;
|
||||
import com.haitonggauto.rtosc.query.CargoQuery;
|
||||
import com.haitonggauto.rtosc.query.ExportInspectCheckQuery;
|
||||
|
@ -40,18 +50,32 @@ import com.nuzar.rtops.log.service.EsLogApprovalUtil;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.Validation;
|
||||
import javax.validation.Validator;
|
||||
import javax.validation.ValidatorFactory;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
@ -61,6 +85,7 @@ import java.util.stream.Collectors;
|
|||
@RequestMapping("/iis")
|
||||
@Api(tags = "进口海关查验")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class ImportInspectHandler implements BaseHandler {
|
||||
|
||||
@Resource
|
||||
|
@ -75,6 +100,15 @@ public class ImportInspectHandler implements BaseHandler {
|
|||
@Resource
|
||||
private NuzarOpenApi openApi;
|
||||
|
||||
@Resource
|
||||
private NuzarYardApi yardApi;
|
||||
|
||||
@Resource
|
||||
private NuzarShpApi shpApi;
|
||||
|
||||
@Resource
|
||||
private DictHandler dictHandler;
|
||||
|
||||
@ApiOperation("船名航次模糊匹配")
|
||||
@PostMapping("/shipVoyage")
|
||||
public Result<List<ShipVoyageVo>> getExportInShipNameList(
|
||||
|
@ -174,17 +208,19 @@ public class ImportInspectHandler implements BaseHandler {
|
|||
@ApiOperation("提单号模糊匹配")
|
||||
@PostMapping("/billNo/query")
|
||||
public Result<List<String>> getExportInBillNoList(
|
||||
@ApiParam(name = "操作方式, 0为前端,1为审核端") @RequestParam(required = false, defaultValue = "0") String type,
|
||||
@RequestParam(required = false, defaultValue = "1") Integer current,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer size,
|
||||
@RequestParam(required = false) String shipName,
|
||||
@RequestParam(required = false) String voyage,
|
||||
@RequestParam(required = false) String q) {
|
||||
LambdaQueryWrapper<CustomerExportInspect> query = new LambdaQueryWrapper<>();
|
||||
query.eq(CustomerExportInspect::getTradType, "I");
|
||||
query.eq(StringUtils.isNotEmpty(shipName), CustomerExportInspect::getShipName, shipName);
|
||||
query.eq(StringUtils.isNotEmpty(voyage), CustomerExportInspect::getVoyage, voyage);
|
||||
query.like(StringUtils.isNotEmpty(q), CustomerExportInspect::getBillNo, q); // 提单号
|
||||
|
||||
QueryWrapper<CustomerExportInspect> query = new QueryWrapper<>();
|
||||
query.select("distinct bill_no");
|
||||
query.eq("trad_type", "I");
|
||||
query.eq(StringUtils.equals(type, "0"), "create_by", UserContext.getUser().getUserId());
|
||||
query.eq(StringUtils.isNotEmpty(shipName), "ship_name", shipName);
|
||||
query.eq(StringUtils.isNotEmpty(voyage), "voyage", voyage);
|
||||
query.like(StringUtils.isNotEmpty(q), "bill_no", q); // 提单号
|
||||
Page<CustomerExportInspect> page = customerExportInspectService.page(new Page<>(current, size), query);
|
||||
List<CustomerExportInspect> list = page.getRecords();
|
||||
|
||||
|
@ -211,7 +247,13 @@ public class ImportInspectHandler implements BaseHandler {
|
|||
@ApiOperation("场地确认完成的提单号")
|
||||
@PostMapping("/selectBills")
|
||||
public Result<List<InspectBillDTO>> getImportInspectBillNoList(@RequestParam(value = "vvyId", required = false) String vvyId, @RequestParam(value = "key", required = false) String key){
|
||||
return ResultUtil.success(openApi.getImportInspectBillNoList(vvyId, key));
|
||||
List<InspectBillDTO> list = openApi.getImportInspectBillNoList(vvyId, key);
|
||||
|
||||
// 对结果按提单号进行去重处理
|
||||
Map<String, List<InspectBillDTO>> collect = list.stream().collect(Collectors.groupingBy(InspectBillDTO::getMnfBl));
|
||||
|
||||
List<InspectBillDTO> rst = collect.values().stream().map(item -> item.get(0)).collect(Collectors.toList());
|
||||
return ResultUtil.success(rst);
|
||||
}
|
||||
|
||||
// 进口查验申请货物明细分页
|
||||
|
@ -336,6 +378,9 @@ public class ImportInspectHandler implements BaseHandler {
|
|||
exportInspect.setCheckStatus(form.getFlag() ? AuditEnum.AUDIT : AuditEnum.SUBMIT);
|
||||
exportInspect.setTermcd(exportInspect.getPortAreaId());
|
||||
exportInspect.setApplyTime(new Date());
|
||||
if (StringUtils.isEmpty(exportInspect.getCompany())) { // 公司为空,则填充申请对象
|
||||
exportInspect.setCompany(exportInspect.getApplyObj());
|
||||
}
|
||||
|
||||
List<CustomerExportInspectCargo> cargos = form.getCargos().stream().map(item -> {
|
||||
CustomerExportInspectCargo entity = PoMapper.instance.exportInspectCargoVo2Entity(item);
|
||||
|
@ -464,6 +509,28 @@ public class ImportInspectHandler implements BaseHandler {
|
|||
|
||||
customerService.wrapperEntity(exportInspect);
|
||||
List<CustomerExportInspectCargo> cargos = customerExportInspectCargoService.list(new LambdaQueryWrapper<CustomerExportInspectCargo>().eq(CustomerExportInspectCargo::getExportInspectId, id));
|
||||
// 获取实时
|
||||
if (CollectionUtils.isNotEmpty(cargos)) {
|
||||
GoodsStatusReq req = new GoodsStatusReq();
|
||||
req.setBusinessType("INSPECT");
|
||||
req.setImportExportType("I");
|
||||
req.setVvyId(StringUtils.equalsAnyIgnoreCase(exportInspect.getVoyageId(), "HT6", "HTLG", "HTTC") ? "" : exportInspect.getVoyageId());
|
||||
req.setVinCodeList(cargos.stream().map(p -> p.getVin()).collect(Collectors.toList()));
|
||||
|
||||
List<GoodsStatusResp> resp = openApi.getGoodsStatus(req);
|
||||
|
||||
Map<String, GoodsStatusResp> respMap = resp.stream().collect(Collectors.toMap(p -> p.getVinCode(), p -> p));
|
||||
|
||||
cargos.stream().forEach(p -> {
|
||||
GoodsStatusResp r = respMap.get(p.getVin());
|
||||
if (r != null) {
|
||||
p.setArea(r.getPosition());
|
||||
} else {
|
||||
p.setArea("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
customerService.wrapperEntity(cargos);
|
||||
|
||||
exportInspect.setCargos(cargos);
|
||||
|
@ -506,6 +573,35 @@ public class ImportInspectHandler implements BaseHandler {
|
|||
queryWrapper.eq(query.getCargoType() != null, CustomerExportInspectCargo::getCargoType, query.getCargoType());
|
||||
}
|
||||
Page<CustomerExportInspectCargo> page = customerExportInspectCargoService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper);
|
||||
|
||||
// 获取实时
|
||||
if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
||||
// 需要按InspectId 进行分组
|
||||
Map<Long, List<CustomerExportInspectCargo>> collect = page.getRecords().stream().collect(Collectors.groupingBy(CustomerExportInspectCargo::getExportInspectId));
|
||||
collect.entrySet().forEach(item -> {
|
||||
CustomerExportInspect inspect = customerExportInspectService.getById(item.getKey());
|
||||
|
||||
GoodsStatusReq req = new GoodsStatusReq();
|
||||
req.setBusinessType("INSPECT");
|
||||
req.setImportExportType("I");
|
||||
req.setVvyId(StringUtils.equalsAnyIgnoreCase(inspect.getVoyageId(), "HT6", "HTLG", "HTTC") ? "" : inspect.getVoyageId());
|
||||
req.setVinCodeList(item.getValue().stream().map(p -> p.getVin()).collect(Collectors.toList()));
|
||||
|
||||
List<GoodsStatusResp> resp = openApi.getGoodsStatus(req);
|
||||
|
||||
Map<String, GoodsStatusResp> respMap = resp.stream().collect(Collectors.toMap(p -> p.getVinCode(), p -> p));
|
||||
|
||||
page.getRecords().stream().filter(p -> p.getExportInspectId() == item.getKey()).forEach(p -> {
|
||||
GoodsStatusResp r = respMap.get(p.getVin());
|
||||
if (r != null) {
|
||||
p.setArea(r.getPosition());
|
||||
} else {
|
||||
p.setArea("");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
customerService.wrapperEntity(page.getRecords());
|
||||
return ResultUtil.success(page);
|
||||
}
|
||||
|
@ -532,6 +628,41 @@ public class ImportInspectHandler implements BaseHandler {
|
|||
return ResultUtil.success(exportInspect);
|
||||
}
|
||||
|
||||
@ApiOperation("获取查验货物明细")
|
||||
@PostMapping("/inspect/cargo/detail")
|
||||
public Result<Page<CustomerExportInspectCargo>> inspectCargoDetail(@RequestBody ExportInspectCheckQuery query) {
|
||||
// 要么传 船ID和航次ID 要么传ids
|
||||
LambdaQueryWrapper<CustomerExportInspectCargo> cQuery = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotEmpty(query.getShipId()) && StringUtils.isNotEmpty(query.getVoyageId())) {
|
||||
cQuery.exists("select id from customer_export_inspect where customer_export_inspect.id=customer_export_inspect_cargo.export_inspect_id and ship_id={0} and voyage_id={1}", query.getShipId(), query.getVoyageId());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(query.getIds())) {
|
||||
cQuery.in(CustomerExportInspectCargo::getExportInspectId, query.getIds());
|
||||
}
|
||||
|
||||
Page<CustomerExportInspectCargo> page = customerExportInspectCargoService.page(new Page<>(query.getPage(), query.getRows()), cQuery);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
||||
List<String> vins = page.getRecords().stream().map(item -> item.getVin()).collect(Collectors.toList());
|
||||
List<Long> ids = page.getRecords().stream().map(item -> item.getExportInspectId()).distinct().collect(Collectors.toList());
|
||||
// 获取表头信息
|
||||
List<CustomerExportInspect> list = customerExportInspectService.lambdaQuery().in(CustomerExportInspect::getId, ids).list();
|
||||
Map<Long, CustomerExportInspect> collect = list.stream().collect(Collectors.toMap(CustomerExportInspect::getId, item -> item));
|
||||
|
||||
// 判断车辆是否在场
|
||||
List<VinStatus> vinStatus = yardApi.getVinStatus(vins);
|
||||
List<String> exists = vinStatus.stream().map(item -> item.getVinCode()).collect(Collectors.toList());
|
||||
|
||||
page.getRecords().stream().forEach(item -> {
|
||||
item.setInspect(collect.get(item.getExportInspectId()));
|
||||
item.setInArea(exists.contains(item.getVin()));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return ResultUtil.success(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
*
|
||||
|
@ -563,8 +694,8 @@ public class ImportInspectHandler implements BaseHandler {
|
|||
log.setOperateData(importInspectLog);
|
||||
log.setStatus(check.getCheckStatus() == AuditEnum.AUDIT_PASS ? 0 : 1);
|
||||
log.setOperateTime(new Date());
|
||||
log.setUserId(SecurityUtils.getUserId());
|
||||
log.setUserName(SecurityUtils.getUserName());
|
||||
log.setUserId(UserContext.getUser().getUserId());
|
||||
log.setUserName(UserContext.getUser().getUsername());
|
||||
EsLogApprovalUtil.writeLog(log);
|
||||
}
|
||||
|
||||
|
@ -611,8 +742,8 @@ public class ImportInspectHandler implements BaseHandler {
|
|||
log.setOperateData(record);
|
||||
log.setStatus(check.getCheckStatus() == AuditEnum.AUDIT_PASS ? 0 : 1);
|
||||
log.setOperateTime(new Date());
|
||||
log.setUserId(SecurityUtils.getUserId());
|
||||
log.setUserName(SecurityUtils.getUserName());
|
||||
log.setUserId(UserContext.getUser().getUserId());
|
||||
log.setUserName(UserContext.getUser().getUsername());
|
||||
EsLogApprovalUtil.writeLog(log);
|
||||
}
|
||||
|
||||
|
@ -674,12 +805,12 @@ public class ImportInspectHandler implements BaseHandler {
|
|||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
||||
String fileName = URLEncoder.encode(DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN) + "进口查验申请", "UTF-8");
|
||||
String fileName = URLEncoder.encode(DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN) + "进口查验计划清单", "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
excelWriter = EasyExcel.write(out).build();
|
||||
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(0, "进口查验申请").head(ImportInspectExportExcel.class).build();
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(0, "进口查验计划清单").head(ImportInspectExportExcel.class).build();
|
||||
|
||||
// 查询数据
|
||||
Page<CustomerExportInspect> page = customerExportInspectService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper);
|
||||
|
@ -712,6 +843,7 @@ public class ImportInspectHandler implements BaseHandler {
|
|||
|
||||
private void write(AtomicInteger index, List<CustomerExportInspect> headers, ExcelWriter excelWriter, WriteSheet writeSheet) {
|
||||
if (CollectionUtils.isEmpty(headers)) {
|
||||
excelWriter.write(new ArrayList<>(), writeSheet);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -735,6 +867,10 @@ public class ImportInspectHandler implements BaseHandler {
|
|||
|
||||
// 备件号排序
|
||||
List<ExportInspectExportExcel> details = list.stream().filter(p -> ids.contains(p.getExportInspectId()))
|
||||
.map(s -> {
|
||||
s.setCartType(StringUtils.isBlank(s.getCartType()) ? "":s.getCartType());
|
||||
return s;
|
||||
})
|
||||
.sorted(Comparator.comparing(CustomerExportInspectCargo::getCartType).reversed())
|
||||
.map(p -> {
|
||||
CustomerExportInspect head = collect.get(p.getExportInspectId());
|
||||
|
@ -747,4 +883,279 @@ public class ImportInspectHandler implements BaseHandler {
|
|||
excelWriter.write(details, writeSheet);
|
||||
});
|
||||
}
|
||||
|
||||
@ApiOperation("进口查验导入模板下载")
|
||||
@GetMapping("/temp/down")
|
||||
public void tempDownPlan(HttpServletResponse response) throws Exception {
|
||||
// 加载模板
|
||||
ClassPathResource classPathResource = new ClassPathResource("templates/import_inspect_temp.xlsx");
|
||||
InputStream inputStream = classPathResource.getInputStream();
|
||||
|
||||
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
|
||||
|
||||
OutputStream out = response.getOutputStream();
|
||||
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
|
||||
|
||||
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
||||
String fileName = URLEncoder.encode("进口查验导入模板", "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
workbook.write(bos);
|
||||
byte[] bArray = bos.toByteArray();
|
||||
InputStream is = new ByteArrayInputStream(bArray);
|
||||
IOUtils.copy(is, out);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("进口查验导入")
|
||||
@PostMapping("/inspect/import-to-add")
|
||||
public Result<List<JSONObject>> exportInPlanUpload(
|
||||
@ApiParam(name = "操作方式, 0为前端,1为审核端") @RequestParam(required = false, defaultValue = "0") String type,
|
||||
MultipartFile file) {
|
||||
// 所有读取的数据
|
||||
List<InspectExcel> dataList = new ArrayList<>();
|
||||
|
||||
// 有错误的数据
|
||||
List<JSONObject> errorDataList = new ArrayList<>();
|
||||
|
||||
// 验证通过的数据
|
||||
List<JSONObject> successDataList = new ArrayList<>();
|
||||
|
||||
Map<String, CustomerExportInspect> headMap = new HashMap<>();
|
||||
Map<String, List<CustomerExportInspectCargo>> detailMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
|
||||
EasyExcel.read(file.getInputStream(), InspectExcel.class, new ReadExcelListener<InspectExcel>() {
|
||||
@Override
|
||||
protected void saveData(List<InspectExcel> list) { // 保存数据
|
||||
dataList.addAll(list);
|
||||
}
|
||||
}).sheet().doRead();
|
||||
|
||||
ValidatorFactory vf = Validation.buildDefaultValidatorFactory();
|
||||
Validator validator = vf.getValidator();
|
||||
|
||||
List<InspectExcel> validData = new ArrayList<>();
|
||||
|
||||
// 需要保存的数据
|
||||
List<InspectExcel> saveData = new ArrayList<>();
|
||||
|
||||
// 数据验证
|
||||
dataList.stream().forEach(item -> {
|
||||
Set<ConstraintViolation<InspectExcel>> set = validator.validate(item);
|
||||
if (CollectionUtils.isEmpty(set)) { // 验证通过的
|
||||
validData.add(item);
|
||||
} else { // 验证失败的
|
||||
JSONObject o = JSONObject.from(item);
|
||||
o.put("status", set.stream().map(p -> p.getMessage()).collect(Collectors.joining(",")));
|
||||
errorDataList.add(o);
|
||||
}
|
||||
});
|
||||
|
||||
if (CollectionUtils.isEmpty(validData)) { // 数据完整性检验
|
||||
if (CollectionUtils.isEmpty(errorDataList)) { // 代表没有读取到数据
|
||||
JSONObject o = new JSONObject();
|
||||
o.put("status", "未读取到数据");
|
||||
errorDataList.add(o);
|
||||
}
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList);
|
||||
}
|
||||
|
||||
// 获取用户绑定的货代
|
||||
List<FreightVo> userBindFreight = openApi.getUserBindFreight();
|
||||
|
||||
// 港区基础数据
|
||||
List<DictDTO> portAreaList = dictHandler.getPortAreaList(null).getData();
|
||||
|
||||
// 航次不能为空
|
||||
validData.stream().forEach(item -> {
|
||||
if (StringUtils.isEmpty(item.getVoyage())) {
|
||||
JSONObject o = JSONObject.from(item);
|
||||
o.put("status", "般次不能为空");
|
||||
errorDataList.add(o);
|
||||
return;
|
||||
}
|
||||
if (portAreaList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getPortArea())).count() == 0) {
|
||||
JSONObject o = JSONObject.from(item);
|
||||
o.put("status", "港区不存在");
|
||||
errorDataList.add(o);
|
||||
return;
|
||||
}
|
||||
saveData.add(item);
|
||||
});
|
||||
|
||||
// 首先按对船名,般次,提单进行分组
|
||||
Map<String, List<InspectExcel>> inMap = saveData.stream()
|
||||
.collect(Collectors.groupingBy(item -> StringUtils.joinWith("#$#", item.getShipName(), item.getVoyage(), item.getBillNo()), Collectors.toList()));
|
||||
|
||||
inMap.entrySet().forEach(item -> {
|
||||
String[] keys = StringUtils.split(item.getKey(), "#$#");
|
||||
String shipName = keys[0]; // 船名
|
||||
String voyageName = keys[1]; // 航次
|
||||
String billNo = keys[2]; // 提单号
|
||||
|
||||
List<ImportInspectReq> req = item.getValue().stream().map(s -> {
|
||||
ImportInspectReq r = new ImportInspectReq();
|
||||
r.setSpmName(shipName);
|
||||
r.setMnfBl(billNo);
|
||||
r.setVinCode(s.getVin());
|
||||
r.setVvyName(voyageName);
|
||||
return r;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
System.err.println(JSON.toJSONString(req));
|
||||
|
||||
// 调用接口进行验证
|
||||
List<ImportInspectResp> resp = shpApi.unloadInfoVerify(req);
|
||||
|
||||
Map<String, String> stringMap = resp.stream().filter(s -> StringUtils.isNotBlank(s.getErrorMsg())).collect(Collectors.toMap(s -> s.getVinCode(), s -> s.getErrorMsg()));
|
||||
if (MapUtils.isNotEmpty(stringMap)) {
|
||||
errorDataList.addAll(item.getValue().stream().filter(p -> stringMap.keySet().contains(p.getVin())).map(p -> {
|
||||
JSONObject o = JSONObject.from(p);
|
||||
o.put("status", stringMap.get(p.getVin()));
|
||||
return o;
|
||||
}).collect(Collectors.toList()));
|
||||
return;
|
||||
}
|
||||
|
||||
long count1 = resp.stream().filter(s -> s.getYardGoodsDTO() == null).count();
|
||||
if (count1 > 0) {
|
||||
errorDataList.addAll(item.getValue().stream().filter(p -> stringMap.keySet().contains(p.getVin())).map(p -> {
|
||||
JSONObject o = JSONObject.from(p);
|
||||
o.put("status", "接口未返回货物详细信息,参数为:" + JSONObject.toJSONString(req));
|
||||
return o;
|
||||
}).collect(Collectors.toList()));
|
||||
return;
|
||||
}
|
||||
|
||||
ImportInspectResp.YardGoodsDTO in = resp.get(0).getYardGoodsDTO();
|
||||
|
||||
// 港区是否一致
|
||||
long count = item.getValue().stream().map(s -> s.getPortArea()).collect(Collectors.toList())
|
||||
.stream().filter(s -> !StringUtils.equals(s, in.getPamName())).count();
|
||||
if (count > 0) {
|
||||
errorDataList.addAll(item.getValue().stream().map(p -> {
|
||||
JSONObject o = JSONObject.from(p);
|
||||
o.put("status", "港区不一致");
|
||||
return o;
|
||||
}).collect(Collectors.toList()));
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, ImportInspectResp> respMap = resp.stream().collect(Collectors.toMap(ImportInspectResp::getVinCode, s -> s));
|
||||
List<JSONObject> tList = new ArrayList<>();
|
||||
item.getValue().forEach(s -> {
|
||||
String errorMsg = respMap.get(s.getVin()).getErrorMsg();
|
||||
if (StringUtils.isNotEmpty(errorMsg)) {
|
||||
JSONObject o = JSONObject.from(item);
|
||||
o.put("status", errorMsg);
|
||||
tList.add(o);
|
||||
}
|
||||
});
|
||||
|
||||
if (CollectionUtils.isNotEmpty(tList)) {
|
||||
errorDataList.addAll(tList);
|
||||
return;
|
||||
}
|
||||
|
||||
CustomerExportInspect head = PoMapper.instance.excel2Entity(item.getValue().get(0));
|
||||
|
||||
String batchNo = customerService.getSequenceNo("inspect_in_batch_no", "出口查验", "CI");
|
||||
head.setInspectStatus(InspectStatusEnum.NO_INSPECT);
|
||||
head.setBatchNo(batchNo);
|
||||
head.setApplicantId(UserContext.getUser().getUserId());
|
||||
head.setTradType("I");
|
||||
head.setPortAreaId(portAreaList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), head.getPortArea())).findFirst().get().getId());
|
||||
head.setCheckStatus(StringUtils.equals(type, "1") ? AuditEnum.AUDIT : AuditEnum.SUBMIT);
|
||||
head.setTermcd(head.getPortAreaId());
|
||||
head.setApplyTime(new Date());
|
||||
head.setShipId(in.getSpmId());
|
||||
// head.setShipEnName(in.getShipEnName());
|
||||
if (StringUtils.isNotEmpty(head.getVoyage())) {
|
||||
head.setVoyageId(in.getVvyId());
|
||||
}
|
||||
// head.setApplyObjId(in.getFreightId());
|
||||
// head.setApplyObj(in.getFreight());
|
||||
if (StringUtils.isEmpty(head.getCompany())) {
|
||||
head.setCompany(head.getApplyObj());
|
||||
}
|
||||
|
||||
List<CustomerExportInspectCargo> detail = item.getValue().stream().map(s -> {
|
||||
CustomerExportInspectCargo c = new CustomerExportInspectCargo();
|
||||
c.setCargoType(StringUtils.startsWith(s.getVin(), "BJ") ? 1 : 0);
|
||||
|
||||
ImportInspectResp.YardGoodsDTO ss = respMap.get(s.getVin()).getYardGoodsDTO();
|
||||
|
||||
c.setBrand(ss.getBrdName());
|
||||
c.setBrandId(ss.getBrdId());
|
||||
c.setCartTypeId(ss.getGoodsType());
|
||||
c.setCartType(ss.getBvmName());
|
||||
c.setModels(in.getModel());
|
||||
c.setVin(s.getVin());
|
||||
return c;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
head.setPlannedCargoQuantity((int)detail.stream().filter( s -> s.getCargoType() == 0).count());
|
||||
head.setPlannedSpareQuantity(detail.size() - head.getPlannedCargoQuantity());
|
||||
|
||||
headMap.put(item.getKey(), head);
|
||||
detailMap.put(item.getKey(), detail);
|
||||
|
||||
});
|
||||
|
||||
if (CollectionUtils.isNotEmpty(errorDataList)) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList);
|
||||
}
|
||||
|
||||
// 判断车辆是否在场
|
||||
List<VinStatus> vinStatus = yardApi.getVinStatus(dataList.stream().map(s -> s.getVin()).collect(Collectors.toList()));
|
||||
// if (CollectionUtils.isEmpty(vinStatus)) {
|
||||
// errorDataList.addAll(dataList.stream().map(p -> {
|
||||
// JSONObject o = JSONObject.from(p);
|
||||
// o.put("status", "所有查验的车架号均不在场");
|
||||
// return o;
|
||||
// }).collect(Collectors.toList()));
|
||||
// return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList);
|
||||
// }
|
||||
|
||||
Map<String, VinStatus> vinStatusMap = vinStatus.stream().collect(Collectors.toMap(VinStatus::getVinCode, s -> s));
|
||||
|
||||
// 保存对象
|
||||
headMap.keySet().stream().forEach(s -> customerService.saveExportInspect(headMap.get(s), detailMap.get(s)));
|
||||
|
||||
successDataList.addAll(dataList.stream().map(p -> {
|
||||
JSONObject o = JSONObject.from(p);
|
||||
o.put("status", "成功");
|
||||
o.put("yardPos", vinStatusMap.containsKey(p.getVin()) ? vinStatusMap.get(p.getVin()).getYardPos() : "未进港");
|
||||
return o;
|
||||
}).collect(Collectors.toList()));
|
||||
} catch (ExcelDataConvertException e) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入数据错误,请确认导入数据模板是否正确, 行:"+e.getRowIndex()+" 列:" + e.getColumnIndex());
|
||||
} catch (Exception e) {
|
||||
log.error("上传错误", e);
|
||||
return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), e.getMessage());
|
||||
}
|
||||
|
||||
List<JSONObject> rst = new ArrayList<>();
|
||||
rst.addAll(successDataList.stream().filter(s -> StringUtils.isNotBlank(s.getString("yardPos"))).collect(Collectors.toList()));
|
||||
rst.addAll(successDataList.stream().filter(s -> StringUtils.isBlank(s.getString("yardPos"))).collect(Collectors.toList()));
|
||||
|
||||
return ResultUtil.success(rst);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -441,6 +441,11 @@ public class ImportUnloadHandler implements BaseHandler {
|
|||
});
|
||||
|
||||
if (CollectionUtils.isEmpty(validData)) {
|
||||
if (CollectionUtils.isEmpty(errorDataList)) { // 代表没有读取到数据
|
||||
JSONObject o = new JSONObject();
|
||||
o.put("status", "未读取到数据");
|
||||
errorDataList.add(o);
|
||||
}
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList);
|
||||
}
|
||||
|
||||
|
@ -632,6 +637,11 @@ public class ImportUnloadHandler implements BaseHandler {
|
|||
});
|
||||
|
||||
if (CollectionUtils.isEmpty(validData)) {
|
||||
if (CollectionUtils.isEmpty(errorDataList)) { // 代表没有读取到数据
|
||||
JSONObject o = new JSONObject();
|
||||
o.put("status", "未读取到数据");
|
||||
errorDataList.add(o);
|
||||
}
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
package com.haitonggauto.rtosc.handler.excel;
|
||||
|
||||
import com.alibaba.excel.metadata.Head;
|
||||
import com.alibaba.excel.metadata.data.WriteCellData;
|
||||
import com.alibaba.excel.write.handler.CellWriteHandler;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ExcelMergeUtil implements CellWriteHandler {
|
||||
private int[] mergeColumnIndex;
|
||||
private int mergeRowIndex;
|
||||
private int baseColIndex;
|
||||
|
||||
public ExcelMergeUtil() {
|
||||
}
|
||||
|
||||
public ExcelMergeUtil(int baseColIndex, int mergeRowIndex, int[] mergeColumnIndex) {
|
||||
this.baseColIndex = baseColIndex;
|
||||
this.mergeRowIndex = mergeRowIndex;
|
||||
this.mergeColumnIndex = mergeColumnIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Head head, Integer columnIndex, Integer relativeRowIndex, Boolean isHead) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<WriteCellData<?>> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
|
||||
|
||||
//当前行
|
||||
int curRowIndex = cell.getRowIndex();
|
||||
//当前列
|
||||
int curColIndex = cell.getColumnIndex();
|
||||
|
||||
if (curRowIndex > mergeRowIndex) {
|
||||
for (int i = 0; i < mergeColumnIndex.length; i++) {
|
||||
if (curColIndex == mergeColumnIndex[i]) {
|
||||
mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前单元格向上合并
|
||||
*
|
||||
* @param writeSheetHolder
|
||||
* @param cell 当前单元格
|
||||
* @param curRowIndex 当前行
|
||||
* @param curColIndex 当前列
|
||||
*/
|
||||
private void mergeWithPrevRow(WriteSheetHolder writeSheetHolder, Cell cell, int curRowIndex, int curColIndex) {
|
||||
Object curData = cell.getCellType() == CellType.STRING ? cell.getStringCellValue() : cell.getNumericCellValue();
|
||||
Cell preCell = cell.getSheet().getRow(curRowIndex - 1).getCell(curColIndex);
|
||||
Object preData = preCell.getCellType()== CellType.STRING ? preCell.getStringCellValue() : preCell.getNumericCellValue();
|
||||
// 将当前单元格数据与上一个单元格数据比较
|
||||
Boolean dataBool = preData.equals(curData);
|
||||
//此处需要注意,获取每一行第二列数据和上一行第一列数据进行比较,如果相等合并,getCell里面的值,是名称所在列的下标
|
||||
// System.err.println(cell.getRow().getCell(baseColIndex).getStringCellValue());
|
||||
Boolean bool = cell.getRow().getCell(baseColIndex).getStringCellValue().equals(cell.getSheet().getRow(curRowIndex - 1).getCell(baseColIndex).getStringCellValue());
|
||||
if (dataBool && bool) {
|
||||
Sheet sheet = writeSheetHolder.getSheet();
|
||||
List<CellRangeAddress> mergeRegions = sheet.getMergedRegions();
|
||||
boolean isMerged = false;
|
||||
for (int i = 0; i < mergeRegions.size() && !isMerged; i++) {
|
||||
CellRangeAddress cellRangeAddr = mergeRegions.get(i);
|
||||
// 若上一个单元格已经被合并,则先移出原有的合并单元,再重新添加合并单元
|
||||
if (cellRangeAddr.isInRange(curRowIndex - 1, curColIndex)) {
|
||||
sheet.removeMergedRegion(i);
|
||||
cellRangeAddr.setLastRow(curRowIndex);
|
||||
sheet.addMergedRegion(cellRangeAddr);
|
||||
isMerged = true;
|
||||
}
|
||||
}
|
||||
// 若上一个单元格未被合并,则新增合并单元
|
||||
if (!isMerged) {
|
||||
CellRangeAddress cellRangeAddress = new CellRangeAddress(curRowIndex - 1, curRowIndex, curColIndex, curColIndex);
|
||||
sheet.addMergedRegion(cellRangeAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,252 @@
|
|||
package com.haitonggauto.rtosc.handler.excel;
|
||||
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||
import org.apache.poi.xssf.usermodel.*;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* excel验证工具类
|
||||
*
|
||||
* @author chenchuancheng github.com/meethigher
|
||||
* @since 2023/08/20 23:55
|
||||
*/
|
||||
public class ExcelValidationUtils {
|
||||
|
||||
|
||||
private static final int minRow = 1;
|
||||
|
||||
private static final int maxRow = 100;
|
||||
|
||||
private static final boolean debugHideSheet = false;
|
||||
|
||||
|
||||
/**
|
||||
* 创建一个xlsx
|
||||
*
|
||||
* @return {@link XSSFWorkbook}
|
||||
*/
|
||||
public static XSSFWorkbook createOneXLSX() {
|
||||
return new XSSFWorkbook();
|
||||
}
|
||||
|
||||
/**
|
||||
* 为xlsx添加一个sheet
|
||||
*
|
||||
* @param wb xlsx
|
||||
* @param sheetName sheet名
|
||||
* @param headers 首行标题头
|
||||
* @return sheet
|
||||
*/
|
||||
public static XSSFSheet addOneSheet(XSSFWorkbook wb, String sheetName, String[] headers) {
|
||||
XSSFSheet st = wb.createSheet(sheetName);
|
||||
//表头样式
|
||||
CellStyle style = wb.createCellStyle();
|
||||
style.setAlignment(HorizontalAlignment.CENTER); // 创建一个居中格式
|
||||
//字体样式
|
||||
Font fontStyle = wb.createFont();
|
||||
fontStyle.setFontName("微软雅黑");
|
||||
fontStyle.setFontHeightInPoints((short) 12);
|
||||
style.setFont(fontStyle);
|
||||
//单元格格式为文本
|
||||
XSSFDataFormat format = wb.createDataFormat();
|
||||
style.setDataFormat(format.getFormat("@"));
|
||||
//写标题
|
||||
XSSFRow row = st.createRow(0);
|
||||
st.createFreezePane(0, 1, 0, 1);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
String value = headers[i];
|
||||
XSSFCell cell = row.createCell(i);
|
||||
st.setColumnWidth(i, value.length() * 1000);
|
||||
cell.setCellStyle(style);
|
||||
st.setDefaultColumnStyle(i, style);
|
||||
cell.setCellValue(value);
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加两层级联数据
|
||||
*
|
||||
* @param wb xlsx
|
||||
* @param targetSheet 目标sheet
|
||||
* @param linkageData 两层级联数据
|
||||
* @param parentCol 父列
|
||||
* @param childCol 孩子列
|
||||
* @param parentColIdentifier 父列标识符
|
||||
* @return {@link XSSFSheet}
|
||||
*/
|
||||
public static XSSFSheet addLinkageDataValidation(XSSFWorkbook wb, XSSFSheet targetSheet, Map<String, List<String>> linkageData,
|
||||
int parentCol, int childCol, String parentColIdentifier) {
|
||||
XSSFSheet hideSt = wb.createSheet();
|
||||
wb.setSheetHidden(wb.getSheetIndex(hideSt), !debugHideSheet);
|
||||
int rowId = 0;
|
||||
Set<String> keySet = linkageData.keySet();
|
||||
for (String parent : keySet) {
|
||||
List<String> sonList = linkageData.get(parent);
|
||||
XSSFRow row = hideSt.createRow(rowId++);
|
||||
row.createCell(0).setCellValue(parent);
|
||||
for (int i = 0; i < sonList.size(); i++) {
|
||||
XSSFCell cell = row.createCell(i + 1);
|
||||
cell.setCellValue(sonList.get(i));
|
||||
}
|
||||
// 添加名称管理器,1表示b列,从b列开始往后,都是子级
|
||||
String range = getRange(1, rowId, sonList.size());
|
||||
Name name = wb.createName();
|
||||
name.setNameName(parent);
|
||||
String formula = hideSt.getSheetName() + "!" + range;
|
||||
name.setRefersToFormula(formula);
|
||||
}
|
||||
//创建表达式校验
|
||||
XSSFDataValidationHelper helper = new XSSFDataValidationHelper(targetSheet);
|
||||
|
||||
// //父级校验,如需生成更多,用户手动拖拽下拉即可。此操作会导致数组内容总长度超过255时报错
|
||||
// DataValidation parentValidation = helper.createValidation(helper.createExplicitListConstraint(keySet.toArray(new String[0])),
|
||||
// new CellRangeAddressList(minRow, maxRow, parentCol, parentCol));
|
||||
// parentValidation.createErrorBox("错误", "请选择正确的父级类型");
|
||||
// parentValidation.setShowErrorBox(true);
|
||||
// parentValidation.setSuppressDropDownArrow(true);
|
||||
// targetSheet.addValidationData(parentValidation);
|
||||
|
||||
//解决长度为255的问题
|
||||
Name name = wb.createName();
|
||||
name.setNameName(hideSt.getSheetName());
|
||||
name.setRefersToFormula(hideSt.getSheetName() + "!$A$1:$A$" + keySet.size());
|
||||
DataValidation parentValidation = helper.createValidation(helper.createFormulaListConstraint(hideSt.getSheetName()), new CellRangeAddressList(minRow, maxRow, parentCol, parentCol));
|
||||
parentValidation.createErrorBox("错误", "请选择正确的父级类型");
|
||||
parentValidation.setShowErrorBox(true);
|
||||
targetSheet.addValidationData(parentValidation);
|
||||
|
||||
//子级校验,如需生成更多,用户手动拖拽下拉即可
|
||||
for (int i = minRow; i < maxRow; i++) {
|
||||
DataValidation childValidation = helper.createValidation(helper.createFormulaListConstraint("INDIRECT(" + parentColIdentifier + "" + (i + 1) + ")"),
|
||||
new CellRangeAddressList(i, i, childCol, childCol));
|
||||
childValidation.createErrorBox("错误", "请选择正确的子级类型");
|
||||
childValidation.setShowErrorBox(true);
|
||||
childValidation.setSuppressDropDownArrow(true);
|
||||
targetSheet.addValidationData(childValidation);
|
||||
}
|
||||
|
||||
return hideSt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加简单下拉列表验证-下拉列表总内容不超过255字符
|
||||
*
|
||||
* @param st sheet
|
||||
* @param dropDownList 下拉列表数据
|
||||
* @param firstCol 开始列,从0开始
|
||||
* @param lastCol 结束列,从0开始
|
||||
*/
|
||||
public static void addSimpleDropDownListValidation(XSSFSheet st, String[] dropDownList, int firstCol, int lastCol) {
|
||||
XSSFDataValidationHelper helper = new XSSFDataValidationHelper(st);
|
||||
XSSFDataValidationConstraint constraint = (XSSFDataValidationConstraint) helper.createExplicitListConstraint(dropDownList);
|
||||
CellRangeAddressList addressList = new CellRangeAddressList(minRow, maxRow, firstCol, lastCol);
|
||||
XSSFDataValidation validation = (XSSFDataValidation) helper.createValidation(constraint, addressList);
|
||||
validation.setSuppressDropDownArrow(true);
|
||||
validation.setShowErrorBox(true);
|
||||
st.addValidationData(validation);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加复杂下拉列表验证-下拉列表总内容允许超过255字符
|
||||
*
|
||||
* @param wb xlsx
|
||||
* @param dropDownList 下拉列表数据
|
||||
* @param firstCol 开始列,从0开始
|
||||
* @param lastCol 结束列,从0开始
|
||||
*/
|
||||
public static void addComplexDropDownListValidation(XSSFWorkbook wb, XSSFSheet st, String[] dropDownList, int firstCol, int lastCol) {
|
||||
XSSFSheet hideSt = wb.createSheet();
|
||||
wb.setSheetHidden(wb.getSheetIndex(hideSt), !debugHideSheet);
|
||||
XSSFDataValidationHelper helper = new XSSFDataValidationHelper(st);
|
||||
for (int i = 0, length = dropDownList.length; i < length; i++) {
|
||||
String value = dropDownList[i];
|
||||
XSSFRow row = hideSt.createRow(i);
|
||||
XSSFCell cell = row.createCell(0);
|
||||
cell.setCellValue(value);
|
||||
}
|
||||
//解决长度为255的问题
|
||||
Name name = wb.createName();
|
||||
name.setNameName(hideSt.getSheetName());
|
||||
name.setRefersToFormula(hideSt.getSheetName() + "!$A$1:$A$" + dropDownList.length);
|
||||
DataValidation parentValidation = helper.createValidation(helper.createFormulaListConstraint(hideSt.getSheetName()), new CellRangeAddressList(minRow, maxRow, firstCol, lastCol));
|
||||
parentValidation.createErrorBox("错误", "请选择正确的类型");
|
||||
parentValidation.setShowErrorBox(true);
|
||||
st.addValidationData(parentValidation);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算formula
|
||||
*
|
||||
* @param offset 偏移量,如果给0,表示从A列开始,1,就是从B列
|
||||
* @param rowId 第几行
|
||||
* @param colCount 一共多少列
|
||||
* @return 如果给入参 1,1,10. 表示从B1-K1。最终返回 $B$1:$K$1
|
||||
*/
|
||||
private static String getRange(int offset, int rowId, int colCount) {
|
||||
char start = (char) ('A' + offset);
|
||||
if (colCount <= 25) {
|
||||
char end = (char) (start + colCount - 1);
|
||||
return "$" + start + "$" + rowId + ":$" + end + "$" + rowId;
|
||||
} else {
|
||||
char endPrefix = 'A', endSuffix;
|
||||
if ((colCount - 25) / 26 == 0 || colCount == 51) {// 26-51之间,包括边界(仅两次字母表计算)
|
||||
if ((colCount - 25) % 26 == 0) {// 边界值
|
||||
endSuffix = (char) ('A' + 25);
|
||||
} else {
|
||||
endSuffix = (char) ('A' + (colCount - 25) % 26 - 1);
|
||||
}
|
||||
} else {// 51以上
|
||||
if ((colCount - 25) % 26 == 0) {
|
||||
endSuffix = (char) ('A' + 25);
|
||||
endPrefix = (char) (endPrefix + (colCount - 25) / 26 - 1);
|
||||
} else {
|
||||
endSuffix = (char) ('A' + (colCount - 25) % 26 - 1);
|
||||
endPrefix = (char) (endPrefix + (colCount - 25) / 26);
|
||||
}
|
||||
}
|
||||
return "$" + start + "$" + rowId + ":$" + endPrefix + endSuffix + "$" + rowId;
|
||||
}
|
||||
}
|
||||
|
||||
private final static String[] headers = new String[]{
|
||||
"性别",
|
||||
"省",
|
||||
"市",
|
||||
"区",
|
||||
};
|
||||
|
||||
|
||||
private static Map<String, List<String>> 省级() {
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
map.put("湖北省(可以吗)", Arrays.asList("武汉市", "襄阳市"));
|
||||
map.put("吉林省", Arrays.asList("长春市", "吉林市"));
|
||||
return map;
|
||||
}
|
||||
|
||||
private static Map<String, List<String>> 市级() {
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
map.put("武汉市", Arrays.asList("洪山区", "江夏区"));
|
||||
map.put("长春市", Arrays.asList("宽城区", "南关区"));
|
||||
return map;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
|
||||
XSSFWorkbook wb = createOneXLSX();
|
||||
XSSFSheet st = addOneSheet(wb, "data", headers);
|
||||
addSimpleDropDownListValidation(st, new String[]{"男", "女"}, 0, 0);
|
||||
addLinkageDataValidation(wb, st, 省级(), 1, 2, "B");
|
||||
addLinkageDataValidation(wb, st, 市级(), 2, 3, "C");
|
||||
|
||||
|
||||
wb.write(new FileOutputStream("d:\\aaa.xlsx"));
|
||||
}
|
||||
}
|
|
@ -5,6 +5,8 @@ import com.alibaba.excel.read.listener.ReadListener;
|
|||
import com.alibaba.excel.util.ListUtils;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.thymeleaf.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -37,10 +39,23 @@ public abstract class ReadExcelListener<T> implements ReadListener<T> {
|
|||
@Override
|
||||
public void invoke(T data, AnalysisContext context) {
|
||||
log.info("解析到一条数据:{}", JSON.toJSONString(data));
|
||||
// 去除空格的处理
|
||||
ReflectionUtils.doWithFields(data.getClass(), (field) -> {
|
||||
field.setAccessible(true);
|
||||
// 只处理字符串类型
|
||||
if (String.class.isAssignableFrom(field.getType())) {
|
||||
// 属性值
|
||||
String str = (String)field.get(data);
|
||||
|
||||
field.set(data, StringUtils.trim(str));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
cachedDataList.add(data);
|
||||
// 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
|
||||
if (cachedDataList.size() >= BATCH_COUNT) {
|
||||
|
||||
saveData(cachedDataList);
|
||||
// 存储完成清理 list
|
||||
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
||||
|
|
|
@ -116,4 +116,8 @@ public interface PoMapper {
|
|||
@Mapping(source = "endEnterTime", target = "inEndTm", dateFormat = "yyyy-MM-dd")
|
||||
@Mapping(source = "contactPhone", target = "personTel")
|
||||
OldExportInAddReq exportIn2OldExportInAddReq(CustomerExportIn exportIn);
|
||||
|
||||
CustomerExportInspect excel2Entity(InspectExcel excel);
|
||||
|
||||
ExportLoadExportExcel entity2Excel(CustomerExportLoad entity);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package com.haitonggauto.rtosc.job;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.haitonggauto.rtosc.common.context.UserContext;
|
||||
import com.haitonggauto.rtosc.common.dto.LoginUser;
|
||||
import com.haitonggauto.rtosc.common.utils.OkHttpUtils;
|
||||
import com.haitonggauto.rtosc.config.SyncConfig;
|
||||
import com.haitonggauto.rtosc.repository.entity.CustomerExportInSyncLog;
|
||||
import com.haitonggauto.rtosc.repository.service.CustomerExportInSyncLogService;
|
||||
import com.nuzar.common.security5.common.util.SecurityUtils;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class SyncToOldHandler {
|
||||
|
||||
@Resource
|
||||
private CustomerExportInSyncLogService syncLogService;
|
||||
|
||||
@Resource
|
||||
private SyncConfig syncConfig;
|
||||
|
||||
/**
|
||||
* 1、同步进港计划
|
||||
*/
|
||||
@XxlJob("exportInSyncHandler")
|
||||
public void exportInSyncHandler() throws Exception {
|
||||
XxlJobHelper.log("同步开始");
|
||||
|
||||
Page<CustomerExportInSyncLog> page = syncLogService.lambdaQuery().like(CustomerExportInSyncLog::getResponseStr, "Failed to connect to").page(new Page<>(1, 10));
|
||||
|
||||
List<String> collect = page.getRecords().stream().map(item -> item.getRequestStr()).collect(Collectors.toList());
|
||||
|
||||
XxlJobHelper.log("需要同步的数据:" + JSONObject.toJSONString(collect));
|
||||
|
||||
for (CustomerExportInSyncLog item : page.getRecords()) {
|
||||
try {
|
||||
|
||||
XxlJobHelper.log("同步老系统:" + item.getRequestStr());
|
||||
|
||||
String post = OkHttpUtils.post(syncConfig.getUrl() + "/execInPortPlanAdd", OkHttpUtils.buildJsonRequestBody(item.getRequestStr()), null);
|
||||
|
||||
JSONObject rst = JSONObject.parseObject(post);
|
||||
|
||||
XxlJobHelper.log("同步老系统结果:" + JSONObject.toJSONString(rst));
|
||||
|
||||
if (StringUtils.equals("0", rst.getString("success"))) {
|
||||
throw new RuntimeException("请求参数:" + item.getRequestStr() + ", 错误信息:" + rst.getString("errmsg"));
|
||||
}
|
||||
|
||||
// 成功后就删除
|
||||
syncLogService.removeById(item);
|
||||
} catch (Exception e) {
|
||||
XxlJobHelper.log("同步失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -49,7 +49,7 @@ public interface CustomerService {
|
|||
* @param cargos
|
||||
* @return
|
||||
*/
|
||||
Long saveExportLoad(CustomerExportLoad exportLoad, List<CustomerExportLoadCargo> cargos);
|
||||
Long saveExportLoad(CustomerExportLoad exportLoad, List<Long> removeIds, List<CustomerExportLoadCargo> cargos);
|
||||
|
||||
/**
|
||||
* 删除出口装船
|
||||
|
@ -173,4 +173,8 @@ public interface CustomerService {
|
|||
* @param jobs
|
||||
*/
|
||||
void updateImportTake(Boolean imp, CustomerImportTake importTake, List<CustomerImportTakeCargo> cargos, List<CustomerImportTakeJob> jobs);
|
||||
|
||||
void syncAddExportInToOld(List<CustomerExportIn> list);
|
||||
|
||||
void syncDelExportInToOld(List<Long> list);
|
||||
}
|
||||
|
|
|
@ -1,25 +1,41 @@
|
|||
package com.haitonggauto.rtosc.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.haitonggauto.rtosc.api.NuzarOpenApi;
|
||||
import com.haitonggauto.rtosc.api.dto.UserInfoDto;
|
||||
import com.haitonggauto.rtosc.common.context.UserContext;
|
||||
import com.haitonggauto.rtosc.common.dto.LoginUser;
|
||||
import com.haitonggauto.rtosc.common.utils.OkHttpUtils;
|
||||
import com.haitonggauto.rtosc.config.SyncConfig;
|
||||
import com.haitonggauto.rtosc.dto.OldExportInAddReq;
|
||||
import com.haitonggauto.rtosc.handler.mapper.PoMapper;
|
||||
import com.haitonggauto.rtosc.repository.entity.*;
|
||||
import com.haitonggauto.rtosc.repository.enums.SequenceTypeEnum;
|
||||
import com.haitonggauto.rtosc.repository.service.*;
|
||||
import com.haitonggauto.rtosc.service.CustomerService;
|
||||
import com.nuzar.cloud.annotation.echo.EchoResult;
|
||||
import com.nuzar.cloud.mapper.base.EchoEntity;
|
||||
import com.nuzar.common.security5.common.util.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.utils.DateUtils;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CustomerServiceImpl implements CustomerService {
|
||||
|
||||
@Autowired
|
||||
|
@ -76,6 +92,15 @@ public class CustomerServiceImpl implements CustomerService {
|
|||
@Resource
|
||||
private CustomerImportTakeJobService importTakeJobService;
|
||||
|
||||
@Resource
|
||||
private CustomerExportInSyncLogService customerExportInSyncLogService;
|
||||
|
||||
@Resource
|
||||
private SyncConfig syncConfig;
|
||||
|
||||
@Resource
|
||||
private NuzarOpenApi openApi;
|
||||
|
||||
@Override
|
||||
@EchoResult
|
||||
public <T extends EchoEntity> T wrapperEntity(T entity) {
|
||||
|
@ -172,6 +197,8 @@ public class CustomerServiceImpl implements CustomerService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Long saveExportIn(CustomerExportIn exportIn, List<CustomerExportInCargo> cargos, List<CustomerExportInTimes> times, List<CustomerExportInCargo> spares) {
|
||||
// 去除空格
|
||||
exportIn.setBillNum(StringUtils.trim(exportIn.getBillNum()));
|
||||
// 保存表头
|
||||
exportInService.save(exportIn);
|
||||
|
||||
|
@ -323,7 +350,12 @@ public class CustomerServiceImpl implements CustomerService {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Long saveExportLoad(CustomerExportLoad exportLoad, List<CustomerExportLoadCargo> cargos) {
|
||||
public Long saveExportLoad(CustomerExportLoad exportLoad, List<Long> removeIds, List<CustomerExportLoadCargo> cargos) {
|
||||
|
||||
if (CollectionUtils.isNotEmpty(removeIds)) {
|
||||
exportLoadCargoService.lambdaUpdate().in(CustomerExportLoadCargo::getExportLoadId, removeIds).remove();
|
||||
exportLoadService.lambdaUpdate().in(CustomerExportLoad::getId, removeIds).remove();
|
||||
}
|
||||
// 保存表头
|
||||
exportLoadService.save(exportLoad);
|
||||
|
||||
|
@ -766,4 +798,116 @@ public class CustomerServiceImpl implements CustomerService {
|
|||
importTakeJobService.saveBatch(insert);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public void syncAddExportInToOld(List<CustomerExportIn> list) {
|
||||
log.info("进入同步方法");
|
||||
log.info("同步配置: " + JSONObject.toJSONString(syncConfig));
|
||||
log.info("同步原始数据:" + JSONObject.toJSONString(list));
|
||||
if (!syncConfig.getSync() || CollectionUtils.isEmpty(list)) { // 没有打开同步或,列表为空真直接返回
|
||||
return;
|
||||
}
|
||||
|
||||
UserInfoDto info = openApi.getUserInfo();
|
||||
// 异步时,变量会丢失
|
||||
LoginUser tmpUser = new LoginUser();
|
||||
tmpUser.setUserId(info.getId());
|
||||
tmpUser.setUsername(info.getName());
|
||||
tmpUser.setRoleId(0L);
|
||||
tmpUser.setAdmin(true);
|
||||
|
||||
UserContext.setUser(tmpUser);
|
||||
for (CustomerExportIn item : list) {
|
||||
OldExportInAddReq req = PoMapper.instance.exportIn2OldExportInAddReq(item);
|
||||
req.setVlsNm(item.getShipName()+"/"+item.getShipEnName());
|
||||
if (item.getLength() != null) {
|
||||
req.setLength(req.getLength().setScale(3, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (item.getWidth() != null) {
|
||||
req.setWidth(item.getWidth().setScale(3, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (item.getHeight() != null) {
|
||||
req.setHeight(item.getHeight().setScale(3, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (item.getWeight() != null) {
|
||||
req.setWeight(item.getWeight().setScale(3, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (StringUtils.equals("备件", item.getCartType())) {
|
||||
req.setCarNum(0);
|
||||
req.setPartNum(item.getQuantity());
|
||||
req.setPartOpMode(item.getOperateType());
|
||||
} else {
|
||||
req.setCarNum(item.getQuantity());
|
||||
req.setPartNum(0);
|
||||
req.setCarOpMode(item.getOperateType());
|
||||
}
|
||||
if (item.getEachWeight() != null) {
|
||||
req.setMnfWeight(item.getEachWeight().setScale(3, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (item.getEachVolume() != null) {
|
||||
req.setMnfVolume(item.getEachVolume().setScale(3, RoundingMode.HALF_UP));
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
log.info("同步老系统:" + JSONObject.toJSONString(req));
|
||||
|
||||
String post = OkHttpUtils.post(syncConfig.getUrl() + "/execInPortPlanAdd", OkHttpUtils.buildJsonRequestBody(JSONObject.toJSONString(req)), null);
|
||||
|
||||
JSONObject rst = JSONObject.parseObject(post);
|
||||
|
||||
log.info("同步老系统结果:" + JSONObject.toJSONString(rst));
|
||||
|
||||
if (StringUtils.equals("0", rst.getString("success"))) {
|
||||
throw new RuntimeException("请求参数:" + JSONObject.toJSONString(req) + ", 错误信息:" + rst.getString("errmsg"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
CustomerExportInSyncLog log = new CustomerExportInSyncLog();
|
||||
log.setBatchNo(item.getBatchNo());
|
||||
log.setRequestStr(JSONObject.toJSONString(req));
|
||||
log.setResponseStr(e.getMessage());
|
||||
customerExportInSyncLogService.save(log);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public void syncDelExportInToOld(List<Long> list) {
|
||||
if (!syncConfig.getSync() || CollectionUtils.isEmpty(list)) { // 没有打开同步或,列表为空真直接返回
|
||||
return;
|
||||
}
|
||||
|
||||
UserInfoDto info = openApi.getUserInfo();
|
||||
|
||||
// 异步时,变量会丢失
|
||||
LoginUser tmpUser = new LoginUser();
|
||||
tmpUser.setUserId(info.getId());
|
||||
tmpUser.setUsername(info.getName());
|
||||
tmpUser.setRoleId(0L);
|
||||
tmpUser.setAdmin(true);
|
||||
|
||||
UserContext.setUser(tmpUser);
|
||||
for (Long id : list) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("nsId", String.valueOf(id));
|
||||
|
||||
try {
|
||||
String post = OkHttpUtils.post(syncConfig.getUrl() + "/execInPortPlanDel", OkHttpUtils.buildFormRequestBody(params), null);
|
||||
|
||||
JSONObject rst = JSONObject.parseObject(post);
|
||||
|
||||
if (StringUtils.equals("0", rst.getString("success"))) {
|
||||
throw new RuntimeException(rst.getString("errmsg"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
CustomerExportInSyncLog log = new CustomerExportInSyncLog();
|
||||
log.setBatchNo("");
|
||||
log.setRequestStr(JSONObject.toJSONString(params));
|
||||
log.setResponseStr(e.getMessage());
|
||||
customerExportInSyncLogService.save(log);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# import:
|
||||
# - optional:nacos:${spring.application.name}-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
|
||||
server:
|
||||
port: 18086
|
||||
#server:
|
||||
# port: 18086
|
||||
# servlet:
|
||||
# context-path: /move
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>1</maxHistory>
|
||||
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||
<maxHistory>7</maxHistory>
|
||||
<!-- <cleanHistoryOnStart>true</cleanHistoryOnStart>-->
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文件只记录debug级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -2,14 +2,15 @@
|
|||
|
||||
上海海通国际汽车码头有限公司:
|
||||
|
||||
基本信息 航次:
|
||||
受理号: 提货日期:
|
||||
船名:
|
||||
基本信息 船名:
|
||||
受理号: 品牌:
|
||||
航次: 提货日期:
|
||||
进港日期:
|
||||
|
||||
返回日期: 数量:
|
||||
|
||||
事由:
|
||||
|
||||
备注:
|
||||
司机信息
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1,6 +1,7 @@
|
|||
package com.haitonggauto.rtosc;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.generator.SnowflakeGenerator;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.haitonggauto.rtosc.common.utils.OkHttpUtils;
|
||||
|
@ -11,42 +12,65 @@ import org.asynchttpclient.RequestBuilder;
|
|||
import org.asynchttpclient.Response;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class BJNumTest {
|
||||
public static void main(String[] args) {
|
||||
JSONObject page = new JSONObject();
|
||||
page.put("current", 1);
|
||||
page.put("size", 50);
|
||||
// JSONObject page = new JSONObject();
|
||||
// page.put(current, 1);
|
||||
// page.put(size, 50);
|
||||
//
|
||||
// JSONObject params = new JSONObject();
|
||||
// params.put(queryPage, page);
|
||||
//
|
||||
// DefaultAsyncHttpClient asyncHttpClient = new DefaultAsyncHttpClient();
|
||||
// try {
|
||||
// String str = http://192.168.61.133/tos/yard/shutout/list;
|
||||
//
|
||||
// org.asynchttpclient.Request r = new RequestBuilder()
|
||||
// .setUrl(str)
|
||||
// .setBody(JSONObject.toJSONString(params))
|
||||
// .addHeader(Content-Type, application/json)
|
||||
// .build();
|
||||
//
|
||||
// ListenableFuture<Response> future = asyncHttpClient.executeRequest(r);
|
||||
//
|
||||
// org.asynchttpclient.Response resp = future.get();
|
||||
//
|
||||
// System.err.println(responseASYN=============+resp.getResponseBody());
|
||||
//
|
||||
// } catch (ExecutionException e) {
|
||||
// e.printStackTrace();
|
||||
// } catch (InterruptedException e) {
|
||||
// e.printStackTrace();
|
||||
// } finally {
|
||||
// asyncHttpClient.close();
|
||||
// }
|
||||
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("queryPage", page);
|
||||
// Map<String, String> map = new HashMap<>();
|
||||
//
|
||||
// map.put(MV.ETERNAL LIGHT, ceshi);
|
||||
//
|
||||
// System.err.println(map.get(MV.ETERNAL LIGHT));
|
||||
|
||||
DefaultAsyncHttpClient asyncHttpClient = new DefaultAsyncHttpClient();
|
||||
try {
|
||||
String str = "http://192.168.61.133/tos/yard/shutout/list";
|
||||
SnowflakeGenerator generator = new SnowflakeGenerator();
|
||||
|
||||
org.asynchttpclient.Request r = new RequestBuilder()
|
||||
.setUrl(str)
|
||||
.setBody(JSONObject.toJSONString(params))
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
// for (int j = 0; j < 5; j++) {
|
||||
// new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// for (int i = 0; i < 500; i++) {
|
||||
// System.err.println(generator.next());
|
||||
// }
|
||||
// }
|
||||
// }.run();
|
||||
// }
|
||||
|
||||
ListenableFuture<Response> future = asyncHttpClient.executeRequest(r);
|
||||
List<String> vins = new ArrayList<>(5);
|
||||
System.err.println(vins.size());
|
||||
|
||||
org.asynchttpclient.Response resp = future.get();
|
||||
System.err.println(StringUtils.isNotBlank(" "));
|
||||
|
||||
System.err.println("responseASYN============="+resp.getResponseBody());
|
||||
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
asyncHttpClient.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.haitonggauto.rtosc.repository.entity;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.haitonggauto.rtosc.common.db.entity.BaseEntity;
|
||||
import com.haitonggauto.rtosc.repository.enums.AuditEnum;
|
||||
import com.nuzar.cloud.annotation.echo.Echo;
|
||||
|
@ -131,13 +132,29 @@ public class CustomerDeparture extends BaseEntity implements Serializable {
|
|||
/**
|
||||
* 进港日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@TableField(value = "arrival_time")
|
||||
@ApiModelProperty(value = "进港日期")
|
||||
private Date arrivalTime;
|
||||
|
||||
/**
|
||||
* 品牌ID
|
||||
*/
|
||||
@TableField(value = "brand_id")
|
||||
@ApiModelProperty(value = "品牌ID")
|
||||
private String brandId;
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
@TableField(value = "brand")
|
||||
@ApiModelProperty(value = "品牌")
|
||||
private String brand;
|
||||
|
||||
/**
|
||||
* 提货日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@TableField(value = "delivery_time")
|
||||
@ApiModelProperty(value = "提货日期")
|
||||
private Date deliveryTime;
|
||||
|
@ -145,6 +162,7 @@ public class CustomerDeparture extends BaseEntity implements Serializable {
|
|||
/**
|
||||
* 返回日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@TableField(value = "return_time")
|
||||
@ApiModelProperty(value = "返回日期")
|
||||
private Date returnTime;
|
||||
|
@ -214,10 +232,22 @@ public class CustomerDeparture extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "数量(计划中,备件数和车辆数之后)")
|
||||
@TableField(value = "quantity")
|
||||
@ApiModelProperty(value = "数量(计划中,备件数和车辆数之和)")
|
||||
private Integer quantity;
|
||||
|
||||
@TableField(value = "car_quantity")
|
||||
@ApiModelProperty(value = "车辆数")
|
||||
private Integer carQuantity;
|
||||
|
||||
@TableField(value = "spare_quantity")
|
||||
@ApiModelProperty(value = "备件数")
|
||||
private Integer spareQuantity;
|
||||
|
||||
@TableField(value = "work_status")
|
||||
@ApiModelProperty(value = "工作过程")
|
||||
private String workStatus;
|
||||
|
||||
/**
|
||||
* 事由
|
||||
*/
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue