批量修改

This commit is contained in:
dengjun 2023-12-07 10:05:24 +08:00
parent cd306eea52
commit d85e352457
34 changed files with 1357 additions and 177 deletions

View File

@ -47,9 +47,9 @@ public class CargoStatusVo implements Serializable {
@ApiModelProperty(value = "单票体积") @ApiModelProperty(value = "单票体积")
private BigDecimal eachVolume; private BigDecimal eachVolume;
@Valid // @Valid
@NotNull(groups = {ValidationGroup.update.class}, message = "车架号必填!" ) // @NotNull(groups = {ValidationGroup.update.class}, message = "车架号必填!" )
@Size(min = 1 , message = "车架号必填要有一个") // @Size(min = 1 , message = "车架号必填要有一个")
private List<CargoStatus> vins; private List<CargoStatus> vins;
} }

View File

@ -0,0 +1,26 @@
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.io.Serializable;
import java.util.List;
@Data
@ApiModel(value = "验证车架号是否已经申请",description = "")
public class CheckVinRepeatVo implements Serializable {
@NotBlank(message = "航次ID为空")
@ApiModelProperty(value = "航次ID")
private String voyageId;
@Valid
@NotNull(message = "车架号必填!" )
@Size(min = 1 , message = "车架号必填要有一个")
private List<String> vins;
}

View File

@ -1,5 +1,6 @@
package com.haitonggauto.rtosc.dto; package com.haitonggauto.rtosc.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.haitonggauto.rtosc.common.utils.ValidationGroup; import com.haitonggauto.rtosc.common.utils.ValidationGroup;
import com.haitonggauto.rtosc.common.validate.MoreThan; import com.haitonggauto.rtosc.common.validate.MoreThan;
@ -313,6 +314,24 @@ public class ExportInVo implements Serializable {
@ApiModelProperty(value = "提单号", required = true) @ApiModelProperty(value = "提单号", required = true)
private String billNum; private String billNum;
/**
* 使用机械ID
*/
@ApiModelProperty(value = "使用机械ID")
private String machineId;
/**
* 使用机械名称
*/
@ApiModelProperty(value = "使用机械名称")
private String machineName;
/**
* 是否是二手车
*/
@ApiModelProperty(value = "是否是二手车1是二手车0不是二手车")
private Integer secondHand;
/** /**
* 备注 * 备注
*/ */
@ -322,11 +341,11 @@ public class ExportInVo implements Serializable {
/** /**
* 源类型 * 源类型
*/ */
@NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "源类型不能为空") // @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "源类型不能为空")
@ApiModelProperty(value = "源类型", required = true) @ApiModelProperty(value = "源类型", required = true)
private String energyType; private String energyType;
@NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "源类型名称不能为空") // @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "源类型名称不能为空")
@ApiModelProperty(value = "源类型名称", required = true) @ApiModelProperty(value = "源类型名称", required = true)
private String energyTypeName; private String energyTypeName;
@ -358,8 +377,8 @@ public class ExportInVo implements Serializable {
private List<ExportInCargoVo> cargos; private List<ExportInCargoVo> cargos;
@Valid @Valid
@NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "出口进场时间必须填!") // @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "出口进场时间必须填!")
@Size(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, min = 1, message = "出口进场时间至少要有一个") // @Size(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, min = 1, message = "出口进场时间至少要有一个")
private List<ExportInTimesVo> times; private List<ExportInTimesVo> times;
@Valid @Valid

View File

@ -1,5 +1,6 @@
package com.haitonggauto.rtosc.dto; package com.haitonggauto.rtosc.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.haitonggauto.rtosc.common.utils.ValidationGroup; import com.haitonggauto.rtosc.common.utils.ValidationGroup;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -38,6 +39,9 @@ public class ExportInspectCargoVo implements Serializable {
// @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车型不能为空") // @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车型不能为空")
private String cartType; private String cartType;
@ApiModelProperty(value = "型号")
private String models;
/** /**
* 车架号 * 车架号
*/ */

View File

@ -0,0 +1,42 @@
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.Valid;
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 = "批量修改船名、航次")
public class UpdateVoyageVo implements Serializable {
/**
* 船名
*/
@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不能为空")
private List<Long> ids;
/**
* 航次ID
*/
@ApiModelProperty(value = "航次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 = "航次不能为空")
private String voyage;
}

View File

@ -98,14 +98,14 @@ public class ExportInPlanExcel {
* 进场时间 * 进场时间
*/ */
// @DateTimeFormat("yyyy-MM-dd HH:mm") // @DateTimeFormat("yyyy-MM-dd HH:mm")
@ExcelProperty("*进场时间") @ExcelProperty("进场时间")
@NotNull(message = "进场时间不能为空") @NotNull(message = "进场时间不能为空")
private String enterTime; private String enterTime;
/** /**
* 进场数量 * 进场数量
*/ */
@ExcelProperty("*进场数量") @ExcelProperty("进场数量")
@NotNull(message = "进场数量不能为空") @NotNull(message = "进场数量不能为空")
private Integer enterQuantity; private Integer enterQuantity;
@ -234,7 +234,11 @@ public class ExportInPlanExcel {
/** /**
* 源类型 * 源类型
*/ */
@ExcelProperty("*源类型") @ExcelProperty("*源类型")
@NotBlank(message = "源类型不能为空") @NotBlank(message = "*能源类型不能为空")
private String energyTypeName; private String energyTypeName;
@ExcelProperty("*是否二手车")
@NotBlank(message = "是否是二手车不能为空")
private String secondHand;
} }

View File

@ -0,0 +1,90 @@
package com.haitonggauto.rtosc.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 出口进场基本表
* @TableName customer_export_in
*/
@Data
public class InspectExportExcel {
/**
* 受理号
*/
@ExcelProperty("受理号")
private String batchNo;
/**
* 中文船名
*/
@ExcelProperty("船名")
private String shipName;
/**
* 航次
*/
@ExcelProperty("航次")
private String voyage;
/**
* 提单号
*/
@ExcelProperty("提单号")
private String billNo;
/**
* 查验日期
*/
@ExcelProperty("查验日期")
private Date inspectTime;
/**
* 查验车辆数
*/
@ExcelProperty("计划车辆数")
private Integer plannedCargoQuantity;
/**
* 查验备件数
*/
@ExcelProperty("计划备件数")
private Integer plannedSpareQuantity;
/**
* 公司名
*/
@ExcelProperty("公司名称")
private String company;
/**
* 申请对象(从基础数据库获取客户类型为进口货代的数据)
*/
@ExcelProperty("申请对象")
private String applyObj;
/**
* 联系人
*/
@ExcelProperty("联系人")
private String contact;
/**
* 联系电话
*/
@ExcelProperty(value = "联系电话")
private String contactPhone;
@ExcelProperty(value = "查验状态")
private String apiInspectStatus;
@ExcelProperty(value = "申请时间")
private Date applyTime;
}

View File

@ -11,4 +11,7 @@ import lombok.Data;
public class CargoQuery extends BaseQuery { public class CargoQuery extends BaseQuery {
@ApiModelProperty(value = "货物类型, 0代表车辆1代表备件") @ApiModelProperty(value = "货物类型, 0代表车辆1代表备件")
private Integer cargoType; private Integer cargoType;
@ApiModelProperty(value = "车架号")
private String vin;
} }

View File

@ -49,6 +49,10 @@ public class DepartureQuery extends BaseQuery {
@ApiModelProperty(value = "港区ID") @ApiModelProperty(value = "港区ID")
private String portAreaId; private String portAreaId;
@ApiModelProperty(value = "港区ID集合")
@DbQuery(field = "portAreaId", symbol = SqlSymbol.IN)
private List<String> pamIds;
@ApiModelProperty(hidden = true) @ApiModelProperty(hidden = true)
// 明细表查询时会用到 // 明细表查询时会用到
private Long departureId; private Long departureId;

View File

@ -26,12 +26,20 @@ public class ExportInCheckQuery extends BaseQuery {
@ApiModelProperty(value = "航次ID") @ApiModelProperty(value = "航次ID")
private String voyageId; private String voyageId;
@ApiModelProperty(value = "批量航次ID")
@DbQuery(field = "voyageId", symbol = SqlSymbol.IN)
private List<String> voyageIds;
@ApiModelProperty(value = "航次") @ApiModelProperty(value = "航次")
private String voyage; private String voyage;
@ApiModelProperty(value = "港区ID") @ApiModelProperty(value = "港区ID")
private String portAreaId; private String portAreaId;
@ApiModelProperty(value = "港区ID集合")
@DbQuery(field = "portAreaId", symbol = SqlSymbol.IN)
private List<String> pamIds;
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "开始进场时间") @ApiModelProperty(value = "开始进场时间")
@DbQuery(field = "applyTime", symbol = SqlSymbol.GTE) @DbQuery(field = "applyTime", symbol = SqlSymbol.GTE)
@ -75,6 +83,18 @@ public class ExportInCheckQuery extends BaseQuery {
@ApiModelProperty(value = "型号") @ApiModelProperty(value = "型号")
private String models; private String models;
@ApiModelProperty(value = "货代ID")
private String freightId;
@ApiModelProperty(value = "车架号")
private String vin;
@ApiModelProperty(value = "国家Id")
private String countryId;
@ApiModelProperty(value = "港口ID")
private String portId;
@ApiModelProperty(hidden = true) @ApiModelProperty(hidden = true)
@DbQuery(field = "vin", symbol = SqlSymbol.IN) @DbQuery(field = "vin", symbol = SqlSymbol.IN)
private List<String> vins; private List<String> vins;

View File

@ -16,10 +16,18 @@ import java.util.List;
@ApiModel(value = "出口进场查询") @ApiModel(value = "出口进场查询")
public class ExportInQuery extends BaseQuery { public class ExportInQuery extends BaseQuery {
@ApiModelProperty(value = "船ID")
private String shipId;
@ApiModelProperty(value = "航次ID")
private String voyageId;
@ApiModelProperty(value = "船名") @ApiModelProperty(value = "船名")
@DbQuery(symbol = SqlSymbol.LIKE)
private String shipName; private String shipName;
@ApiModelProperty(value = "航次") @ApiModelProperty(value = "航次")
@DbQuery(symbol = SqlSymbol.LIKE)
private String voyage; private String voyage;
@ApiModelProperty(value = "港区ID") @ApiModelProperty(value = "港区ID")
@ -62,6 +70,12 @@ public class ExportInQuery extends BaseQuery {
@ApiModelProperty(value = "型号") @ApiModelProperty(value = "型号")
private String models; private String models;
@ApiModelProperty(value = "国家Id")
private String countryId;
@ApiModelProperty(value = "港口ID")
private String portId;
@ApiModelProperty(hidden = true) @ApiModelProperty(hidden = true)
@DbQuery(field = "vin", symbol = SqlSymbol.IN) @DbQuery(field = "vin", symbol = SqlSymbol.IN)
private List<String> vins; private List<String> vins;

View File

@ -18,6 +18,9 @@ public class ExportInspectCheckQuery extends BaseQuery {
@DbQuery(field = "shipId") @DbQuery(field = "shipId")
private String shipName; private String shipName;
@ApiModelProperty(value = "船ID")
private String shipId;
@ApiModelProperty(value = "航次ID") @ApiModelProperty(value = "航次ID")
private String voyageId; private String voyageId;
@ -27,6 +30,10 @@ public class ExportInspectCheckQuery extends BaseQuery {
@ApiModelProperty(value = "港区ID") @ApiModelProperty(value = "港区ID")
private String portAreaId; private String portAreaId;
@ApiModelProperty(value = "港区ID集合")
@DbQuery(field = "portAreaId", symbol = SqlSymbol.IN)
private List<String> pamIds;
@ApiModelProperty(value = "审核状态") @ApiModelProperty(value = "审核状态")
private AuditEnum checkStatus; private AuditEnum checkStatus;
@ -35,6 +42,7 @@ public class ExportInspectCheckQuery extends BaseQuery {
private List<AuditEnum> checkStatusList; private List<AuditEnum> checkStatusList;
@ApiModelProperty(value = "受理号") @ApiModelProperty(value = "受理号")
@DbQuery(symbol = SqlSymbol.LIKE)
private String batchNo; private String batchNo;
@ApiModelProperty(hidden = true) @ApiModelProperty(hidden = true)

View File

@ -14,10 +14,18 @@ import java.util.List;
@ApiModel(value = "海关查验查询") @ApiModel(value = "海关查验查询")
public class ExportInspectQuery extends BaseQuery { public class ExportInspectQuery extends BaseQuery {
@ApiModelProperty(value = "船ID")
private String shipId;
@ApiModelProperty(value = "航次ID")
private String voyageId;
@ApiModelProperty(value = "船名") @ApiModelProperty(value = "船名")
@DbQuery(symbol = SqlSymbol.LIKE)
private String shipName; private String shipName;
@ApiModelProperty(value = "航次") @ApiModelProperty(value = "航次")
@DbQuery(symbol = SqlSymbol.LIKE)
private String voyage; private String voyage;
@ApiModelProperty(value = "港区ID") @ApiModelProperty(value = "港区ID")
@ -31,6 +39,7 @@ public class ExportInspectQuery extends BaseQuery {
private List<AuditEnum> checkStatusList; private List<AuditEnum> checkStatusList;
@ApiModelProperty(value = "受理号") @ApiModelProperty(value = "受理号")
@DbQuery(symbol = SqlSymbol.LIKE)
private String batchNo; private String batchNo;
@ApiModelProperty(hidden = true) @ApiModelProperty(hidden = true)

View File

@ -14,6 +14,7 @@ import java.util.List;
@ApiModel(value = "出口装船查询") @ApiModel(value = "出口装船查询")
public class ExportLoadCheckQuery extends BaseQuery { public class ExportLoadCheckQuery extends BaseQuery {
@ApiModelProperty(value = "受理号") @ApiModelProperty(value = "受理号")
@DbQuery(symbol = SqlSymbol.LIKE)
private String batchNo; private String batchNo;
@ApiModelProperty(value = "船ID") @ApiModelProperty(value = "船ID")
@ -39,6 +40,10 @@ public class ExportLoadCheckQuery extends BaseQuery {
@ApiModelProperty(value = "港区ID") @ApiModelProperty(value = "港区ID")
private String portAreaId; private String portAreaId;
@ApiModelProperty(value = "港区ID集合")
@DbQuery(field = "portAreaId", symbol = SqlSymbol.IN)
private List<String> pamIds;
@ApiModelProperty(value = "审核状态") @ApiModelProperty(value = "审核状态")
private AuditEnum checkStatus; private AuditEnum checkStatus;

View File

@ -14,15 +14,21 @@ import java.util.List;
@ApiModel(value = "出口装船查询") @ApiModel(value = "出口装船查询")
public class ExportLoadQuery extends BaseQuery { public class ExportLoadQuery extends BaseQuery {
@ApiModelProperty(value = "受理号") @ApiModelProperty(value = "受理号")
@DbQuery(symbol = SqlSymbol.LIKE)
private String batchNo; private String batchNo;
@ApiModelProperty(value = "") @ApiModelProperty(value = "ID")
private String shipName; private String shipId;
@ApiModelProperty(value = "航次ID") @ApiModelProperty(value = "航次ID")
private String voyageId; private String voyageId;
@ApiModelProperty(value = "船名")
@DbQuery(symbol = SqlSymbol.LIKE)
private String shipName;
@ApiModelProperty(value = "航次") @ApiModelProperty(value = "航次")
@DbQuery(symbol = SqlSymbol.LIKE)
private String voyage; private String voyage;
@ApiModelProperty(value = "贸易类型") @ApiModelProperty(value = "贸易类型")

View File

@ -17,6 +17,7 @@ import java.util.List;
@ApiModel(value = "特保区查询") @ApiModel(value = "特保区查询")
public class FreeTradeQuery extends BaseQuery { public class FreeTradeQuery extends BaseQuery {
@ApiModelProperty(value = "批次号") @ApiModelProperty(value = "批次号")
@DbQuery(symbol = SqlSymbol.LIKE)
private String batchNo; private String batchNo;
@ApiModelProperty(value = "企业编码") @ApiModelProperty(value = "企业编码")
@ -42,6 +43,10 @@ public class FreeTradeQuery extends BaseQuery {
@ApiModelProperty(value = "港区ID") @ApiModelProperty(value = "港区ID")
private String portAreaId; private String portAreaId;
@ApiModelProperty(value = "港区ID集合")
@DbQuery(field = "portAreaId", symbol = SqlSymbol.IN)
private List<String> pamIds;
@ApiModelProperty(value = "审核状态", hidden = true) @ApiModelProperty(value = "审核状态", hidden = true)
@DbQuery(field = "checkStatus", symbol = SqlSymbol.IN) @DbQuery(field = "checkStatus", symbol = SqlSymbol.IN)
private List<AuditEnum> checkStatusList; private List<AuditEnum> checkStatusList;

View File

@ -14,7 +14,6 @@ public class BaseQuery extends Perm {
private Long id; private Long id;
// 批量查询 // 批量查询
@ApiModelProperty(hidden = true)
@DbQuery(field = "id", symbol = SqlSymbol.IN) @DbQuery(field = "id", symbol = SqlSymbol.IN)
private List<Long> ids; private List<Long> ids;

View File

@ -11,10 +11,11 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
import java.util.Map;
//@FeignClient(name = "https://rtops4.haitongauto.com/tos/api") @FeignClient(name = "https://rtops4.haitongauto.com/tos/api")
@FeignClient(name = "rtos-openapi") //@FeignClient(name = "rtos-openapi")
public interface NuzarOpenApi { public interface NuzarOpenApi {
// 根据港区ID获取国家 // 根据港区ID获取国家
@ -108,4 +109,12 @@ public interface NuzarOpenApi {
// 查验状态 // 查验状态
@PostMapping("/customer/exportInspectApply/applyId/status") @PostMapping("/customer/exportInspectApply/applyId/status")
List<InspectStatusResp> getInspectStatusStatus(@RequestBody List<String> req); List<InspectStatusResp> getInspectStatusStatus(@RequestBody List<String> req);
// 判断是否生成船期计划
@GetMapping("/customer/shipment/shipLoad/getShipPlan")
Boolean haveShipPlan(@RequestParam("vvyId") String vvyId);
// 装船审核获取国际中转备件
@PostMapping("/customer/shipment/shipLoad/transitPart")
Map<String, List<TransitPartResp>> getTransitPart(@RequestBody TransitPartRequest request);
} }

View File

@ -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;
import java.util.List;
@Data
@ApiModel("国际中转备件")
public class TransitPartRequest implements Serializable {
@ApiModelProperty("提单号")
private String mnfBl;
@ApiModelProperty("备件数")
private Integer partAmount;
@ApiModelProperty("航次ID")
private List<String> vvyIds;
}

View File

@ -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 TransitPartResp implements Serializable {
private String workStatus;
private String vinCode;
}

View File

@ -11,6 +11,7 @@ import com.alibaba.excel.write.metadata.fill.FillWrapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.haitonggauto.rtosc.api.NuzarOpenApi; import com.haitonggauto.rtosc.api.NuzarOpenApi;
import com.haitonggauto.rtosc.api.dto.*; import com.haitonggauto.rtosc.api.dto.*;
@ -19,10 +20,8 @@ import com.haitonggauto.rtosc.common.context.UserContext;
import com.haitonggauto.rtosc.common.dto.Result; import com.haitonggauto.rtosc.common.dto.Result;
import com.haitonggauto.rtosc.common.enums.ErrorType; import com.haitonggauto.rtosc.common.enums.ErrorType;
import com.haitonggauto.rtosc.common.handler.BaseHandler; import com.haitonggauto.rtosc.common.handler.BaseHandler;
import com.haitonggauto.rtosc.common.utils.DateUtils; import com.haitonggauto.rtosc.common.utils.*;
import com.haitonggauto.rtosc.common.utils.ResultUtil; import com.haitonggauto.rtosc.dto.CheckVinRepeatVo;
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
import com.haitonggauto.rtosc.common.utils.WrapperKit;
import com.haitonggauto.rtosc.dto.DepartureCargoVo; import com.haitonggauto.rtosc.dto.DepartureCargoVo;
import com.haitonggauto.rtosc.dto.DepartureCheckVo; import com.haitonggauto.rtosc.dto.DepartureCheckVo;
import com.haitonggauto.rtosc.dto.DepartureVo; import com.haitonggauto.rtosc.dto.DepartureVo;
@ -172,6 +171,15 @@ public class DepartureHandler implements BaseHandler {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复"); return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复");
} }
} }
// 验证是否重复申请
List<String> vins = form.getCargos().stream().map(item -> item.getVin()).collect(Collectors.toList());
List<CustomerDepartureCargo> exists = departureCargoService.lambdaQuery().in(CustomerDepartureCargo::getVin, vins).list();
List<String> repeat = exists.stream().map(item -> item.getVin()).collect(Collectors.toList());;
if (CollectionUtils.isNotEmpty(exists)) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号不能重复申请");
}
String batchNo = customerService.getSequenceNo("departure_batch_no", "提离港区", "EP"); String batchNo = customerService.getSequenceNo("departure_batch_no", "提离港区", "EP");
// 表单验证以及格式转换 // 表单验证以及格式转换
CustomerDeparture departure = PoMapper.instance.departureVo2Entity(form); CustomerDeparture departure = PoMapper.instance.departureVo2Entity(form);
@ -204,6 +212,24 @@ public class DepartureHandler implements BaseHandler {
return ResultUtil.success(String.valueOf(id)); return ResultUtil.success(String.valueOf(id));
} }
@ApiOperation("批量验证车架号是否已经存在")
@PostMapping("/check/vin/repeat")
public Result<Map<String,List<String>>> checkVinRepeat(@RequestBody @NotNull(message = "验证列表不能为空") @Size(min = 1, message = "验证列表不能为空") ValidList<CheckVinRepeatVo> form) {
Map<String, List<String>> rst = new HashMap<>();
for(CheckVinRepeatVo vo : form) {
List<CustomerDepartureCargo> cargos = departureCargoService.query()
.select("count(*) as quantity, vin")
.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")
.list();
rst.put(vo.getVoyageId(), cargos.stream().map(item -> item.getVin()).collect(Collectors.toList()));
}
return ResultUtil.success(rst);
}
@ApiOperation("提交审核") @ApiOperation("提交审核")
@PostMapping("/submit-check") @PostMapping("/submit-check")
public Result<String> submitCheck(@RequestBody public Result<String> submitCheck(@RequestBody
@ -214,6 +240,16 @@ public class DepartureHandler implements BaseHandler {
return ResultUtil.success("success"); return ResultUtil.success("success");
} }
@ApiOperation("撤销提交审核")
@PostMapping("/submit-check/reverse")
public Result<String> submitCheckReverse(@RequestBody
@NotNull(message = "请传入要审核的提离港区ID")
@Size(min = 1, message = "ID列表不能为空") List<Long> ids) {
departureService.lambdaUpdate().set(CustomerDeparture::getCheckStatus, AuditEnum.SUBMIT)
.set(CustomerDeparture::getCheckResult, null).in(CustomerDeparture::getId, ids).update();
return ResultUtil.success("success");
}
/** /**
* 删除 * 删除
* @param id * @param id
@ -255,6 +291,15 @@ public class DepartureHandler implements BaseHandler {
if (dep.getCheckStatus() == AuditEnum.AUDIT_PASS) { if (dep.getCheckStatus() == AuditEnum.AUDIT_PASS) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "审核通过之后不能进行编辑"); return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "审核通过之后不能进行编辑");
} }
// 验证是否重复申请
List<String> vins = form.getCargos().stream().map(item -> item.getVin()).collect(Collectors.toList());
List<CustomerDepartureCargo> exists = departureCargoService.lambdaQuery().in(CustomerDepartureCargo::getVin, vins).ne(CustomerDepartureCargo::getDepartureId, form.getId()).list();
List<String> repeat = exists.stream().map(item -> item.getVin()).collect(Collectors.toList());;
if (CollectionUtils.isNotEmpty(exists)) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号不能重复申请");
}
String batchNo = dep.getBatchNo(); String batchNo = dep.getBatchNo();
// 表单验证以及格式转换 // 表单验证以及格式转换
CustomerDeparture departure = PoMapper.instance.departureVo2Entity(form); CustomerDeparture departure = PoMapper.instance.departureVo2Entity(form);

View File

@ -47,7 +47,10 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.core.io.ClassPathResource;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -64,6 +67,7 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.io.*; import java.io.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -135,6 +139,66 @@ public class ExportInHandler implements BaseHandler {
return ResultUtil.success(rst, String.valueOf(page.getTotal())); return ResultUtil.success(rst, String.valueOf(page.getTotal()));
} }
@ApiOperation("船名模糊匹配")
@PostMapping("/ship/list")
public Result<List<DictDTO>> getShipList(
@RequestParam(required = false, defaultValue = "1") Integer current,
@RequestParam(required = false, defaultValue = "10") Integer size,
@RequestParam(required = false) String q) {
QueryWrapper<CustomerExportIn> query = new QueryWrapper<>();
query.select("distinct ship_id, ship_name, ship_en_name");
query.eq("create_by", UserContext.getUser().getUserId());
if (StringUtils.isNotEmpty(q)) {
query.and((wrapper) -> {
wrapper.like("ship_name", q);
wrapper.or().like("ship_en_name", q);
});
}
Page<CustomerExportIn> page = customerExportInService.page(new Page<>(current, size), query);
List<CustomerExportIn> list = page.getRecords();
List<DictDTO> rst = list.stream().map(tmp -> {
DictDTO vo = new DictDTO();
vo.setId(tmp.getShipId());
vo.setText(tmp.getShipName());
vo.setExtra1(tmp.getShipEnName());
return vo;
}).collect(Collectors.toList());
return ResultUtil.success(rst, String.valueOf(page.getTotal()));
}
@ApiOperation("航次模糊匹配")
@PostMapping("/voyage/list")
public Result<List<DictDTO>> getVoyageList(
@RequestParam(required = false, defaultValue = "1") Integer current,
@RequestParam(required = false, defaultValue = "10") Integer size,
@RequestParam(required = false) String shipId,
@RequestParam(required = false) String q) {
QueryWrapper<CustomerExportIn> query = new QueryWrapper<>();
query.select("distinct voyage_id, voyage");
query.eq("create_by", UserContext.getUser().getUserId());
query.eq(StringUtils.isNotEmpty(shipId), "ship_id", shipId);
if (StringUtils.isNotEmpty(q)) {
query.and((wrapper) -> {
wrapper.like("voyage", q);
});
}
Page<CustomerExportIn> page = customerExportInService.page(new Page<>(current, size), query);
List<CustomerExportIn> list = page.getRecords();
List<DictDTO> rst = list.stream().map(tmp -> {
DictDTO vo = new DictDTO();
vo.setId(tmp.getVoyageId());
vo.setText(tmp.getVoyage());
return vo;
}).collect(Collectors.toList());
return ResultUtil.success(rst, String.valueOf(page.getTotal()));
}
@ApiOperation("提单号模糊匹配") @ApiOperation("提单号模糊匹配")
@PostMapping("/billNo/query") @PostMapping("/billNo/query")
public Result<List<String>> getExportInBillNoList( public Result<List<String>> getExportInBillNoList(
@ -216,7 +280,7 @@ public class ExportInHandler implements BaseHandler {
query.setEndEnterTime(DateUtils.getDayEnd(query.getEndEnterTime())); query.setEndEnterTime(DateUtils.getDayEnd(query.getEndEnterTime()));
} }
if (query.getCheckStatus() == null) { if (query.getCheckStatus() == null) {
query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); query.setCheckStatusList(Arrays.asList(AuditEnum.SUBMIT, AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT));
} }
Wrapper<CustomerExportIn> queryWrapper = new WrapperKit() { Wrapper<CustomerExportIn> queryWrapper = new WrapperKit() {
}.changeBaseQueryToWrapper(CustomerExportIn.class, query); }.changeBaseQueryToWrapper(CustomerExportIn.class, query);
@ -225,6 +289,58 @@ public class ExportInHandler implements BaseHandler {
return ResultUtil.success(page); return ResultUtil.success(page);
} }
@ApiOperation("出口进港货物跟踪查询")
@PostMapping("/cargo/tracking")
public Result<IPage<CustomerExportIn>> cargoTracking(@RequestBody ExportInCheckQuery query) {
if (query.getEndEnterTime() != null) {
query.setEndEnterTime(DateUtils.getDayEnd(query.getEndEnterTime()));
}
if (query.getCheckStatus() == null) {
query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT));
}
String vin = query.getVin();
if (StringUtils.isNotEmpty(vin)) {
query.setVin(null);
}
QueryWrapper<CustomerExportIn> queryWrapper = (QueryWrapper) new WrapperKit() {
}.changeBaseQueryToWrapper(CustomerExportIn.class, query);
queryWrapper.select("sum(quantity) as quantity, port_area_id, ship_id, voyage_id, max(update_date) as update_date");
queryWrapper.groupBy("port_area_id, ship_id, voyage_id");
if (StringUtils.isNotEmpty(vin)) {
queryWrapper.exists("select id from customer_export_in_cargo where customer_export_in_cargo.export_in_id=customer_export_in.id and customer_export_in_cargo.vin={0}", vin);
}
Page<CustomerExportIn> page = customerExportInService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper);
customerService.wrapperEntity(page.getRecords());
return ResultUtil.success(page);
}
@ApiOperation("审核端统计查询")
@PostMapping("/check/query-list/count")
public Result<Map<String, Object>> checkCountQuery(@RequestBody ExportInCheckQuery query) {
if (query.getEndEnterTime() != null) {
query.setEndEnterTime(DateUtils.getDayEnd(query.getEndEnterTime()));
}
if (query.getCheckStatus() == null) {
query.setCheckStatusList(Arrays.asList(AuditEnum.SUBMIT, AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT));
}
query.setSorts(null);
QueryWrapper<CustomerExportIn> queryWrapper = (QueryWrapper) new WrapperKit() {
}.changeBaseQueryToWrapper(CustomerExportIn.class, query);
queryWrapper.select("sum(quantity) as quantity, sum(volume) as volume, sum(weight) as weight, sum(length) as length, sum(width) as width, sum(height) as height");
Map<String, Object> map = customerExportInService.getMap(queryWrapper);
return ResultUtil.success(map);
}
@ApiOperation("根据航次ID查询审核通过进港记录") @ApiOperation("根据航次ID查询审核通过进港记录")
@PostMapping("/query-list/voyage") @PostMapping("/query-list/voyage")
public Result<List<CustomerExportIn>> checkQuery(@RequestParam(required = false) @NotBlank(message = "航次ID不能为空") String voyageId, public Result<List<CustomerExportIn>> checkQuery(@RequestParam(required = false) @NotBlank(message = "航次ID不能为空") String voyageId,
@ -298,10 +414,18 @@ public class ExportInHandler implements BaseHandler {
@ApiOperation("货物明细分页列表") @ApiOperation("货物明细分页列表")
@PostMapping("/cargos/page") @PostMapping("/cargos/page")
public Result<Page<CustomerExportInCargo>> cargoList(@RequestBody @Validated(ValidationGroup.update.class) CargoQuery query) { public Result<Page<CustomerExportInCargo>> cargoList(@RequestBody @Validated(ValidationGroup.update.class) CargoQuery query) {
CustomerExportIn exportIn = customerExportInService.getById(query.getId()); List<Long> ids = new ArrayList<>();
if (query.getId() != null) {
ids.add(query.getId());
} else if (CollectionUtils.isNotEmpty(query.getIds())) {
ids.addAll(query.getIds());
}
List<CustomerExportIn> exportInList = customerExportInService.lambdaQuery().in(CustomerExportIn::getId, ids).list();
Map<Long, CustomerExportIn> eMap = exportInList.stream().collect(Collectors.toMap(CustomerExportIn::getId, item->item));
LambdaQueryWrapper<CustomerExportInCargo> queryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<CustomerExportInCargo> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(query.getId() != null, CustomerExportInCargo::getExportInId, query.getId()); queryWrapper.eq(query.getId() != null, CustomerExportInCargo::getExportInId, query.getId());
queryWrapper.in(CollectionUtils.isNotEmpty(query.getIds()), CustomerExportInCargo::getExportInId, query.getIds());
if (query.getCargoType() != null) { if (query.getCargoType() != null) {
queryWrapper.eq(CustomerExportInCargo::getCargoType, query.getCargoType()); queryWrapper.eq(CustomerExportInCargo::getCargoType, query.getCargoType());
} }
@ -310,6 +434,7 @@ public class ExportInHandler implements BaseHandler {
customerService.wrapperEntity(page.getRecords()); customerService.wrapperEntity(page.getRecords());
page.getRecords().forEach(item -> { page.getRecords().forEach(item -> {
CustomerExportIn exportIn = eMap.get(item.getExportInId());
item.setBrandId(exportIn.getBrandId()); item.setBrandId(exportIn.getBrandId());
item.setBrand(exportIn.getBrand()); item.setBrand(exportIn.getBrand());
item.setCartTypeId(exportIn.getCartTypeId()); item.setCartTypeId(exportIn.getCartTypeId());
@ -321,10 +446,15 @@ public class ExportInHandler implements BaseHandler {
item.setModels(exportIn.getModels()); item.setModels(exportIn.getModels());
}); });
Map<Long, List<CustomerExportInCargo>> collect1 = page.getRecords().stream().collect(Collectors.groupingBy(CustomerExportInCargo::getExportInId));
collect1.entrySet().stream().forEach(m->{
// 获取作业状态 // 获取作业状态
Map<String, String> collect = null; Map<String, String> collect = null;
List<String> vins = page.getRecords().stream().map(item -> item.getVin()).collect(Collectors.toList()); List<String> vins = m.getValue().stream().map(item -> item.getVin()).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(vins)) { if (CollectionUtils.isNotEmpty(vins)) {
CustomerExportIn exportIn = eMap.get(m.getKey());
VinStatusRequest req = new VinStatusRequest(); VinStatusRequest req = new VinStatusRequest();
req.setBusinessType("IN_PORT"); req.setBusinessType("IN_PORT");
req.setImportExportType("E"); req.setImportExportType("E");
@ -335,11 +465,14 @@ public class ExportInHandler implements BaseHandler {
List<WorkStatusDTO> status = openApi.getVinStatus(req); List<WorkStatusDTO> status = openApi.getVinStatus(req);
collect = status.stream().collect(Collectors.toMap(WorkStatusDTO::getVinCode, WorkStatusDTO::getWorkStatus)); collect = status.stream().collect(Collectors.toMap(WorkStatusDTO::getVinCode, WorkStatusDTO::getWorkStatus));
} }
if (MapUtils.isNotEmpty(collect)) { if (MapUtils.isNotEmpty(collect)) {
for (CustomerExportInCargo cargo : page.getRecords()) { for (CustomerExportInCargo cargo : page.getRecords()) {
cargo.setWorkStatus(collect.get(cargo.getVin())); cargo.setWorkStatus(collect.get(cargo.getVin()));
} }
} }
});
return ResultUtil.success(page); return ResultUtil.success(page);
} }
@ -398,7 +531,7 @@ public class ExportInHandler implements BaseHandler {
return entity; return entity;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(cargos)) { if (CollectionUtils.isNotEmpty(cargos) && !StringUtils.equalsAnyIgnoreCase(exportIn.getCartType(), "备件", "BJ")) {
if (exportIn.getQuantity() != cargos.size()) { if (exportIn.getQuantity() != cargos.size()) {
return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车辆数不等于明细数量"); return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车辆数不等于明细数量");
} }
@ -452,7 +585,7 @@ public class ExportInHandler implements BaseHandler {
return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "进场货物的进场时间,要小于表头进场时间"); return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "进场货物的进场时间,要小于表头进场时间");
} }
// 进场时间的数量加起来要和数量进行匹配如果超过无法进行输入自动获取进场时间加起来的数量 // 进场时间的数量加起来要和数量进行匹配如果超过无法进行输入自动获取进场时间加起来的数量
int num = times.stream().mapToInt(CustomerExportInTimes::getEnterQuantity).sum(); int num = exportIn.getEnterQuantity();
if (num != exportIn.getQuantity()) { if (num != exportIn.getQuantity()) {
return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "进场货物的数量,要等于进场货物的所有数量"); return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "进场货物的数量,要等于进场货物的所有数量");
} }
@ -527,7 +660,7 @@ public class ExportInHandler implements BaseHandler {
return ResultUtil.success("success"); return ResultUtil.success("success");
} }
@ApiOperation("取消提交审核") @ApiOperation("撤销提交审核")
@PostMapping("/submit-check/reverse") @PostMapping("/submit-check/reverse")
public Result<String> submitCheckReverse(@RequestBody public Result<String> submitCheckReverse(@RequestBody
@NotNull(message = "请传入要审核的出口进场ID") @NotNull(message = "请传入要审核的出口进场ID")
@ -545,6 +678,7 @@ public class ExportInHandler implements BaseHandler {
if (form.getEachQuantity() == null || form.getEachVolume() == null || form.getEachWeight() == null) { if (form.getEachQuantity() == null || form.getEachVolume() == null || form.getEachWeight() == null) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "单票体积,单票件数,单票重量不能为空"); return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "单票体积,单票件数,单票重量不能为空");
} }
if (CollectionUtils.isNotEmpty(form.getVins())) {
// 查询出货物列表 // 查询出货物列表
List<CustomerExportInCargo> list = customerExportInCargoService.lambdaQuery() List<CustomerExportInCargo> list = customerExportInCargoService.lambdaQuery()
.exists("select id from customer_export_in where customer_export_in.id = customer_export_in_cargo.export_in_id and check_status={0} and ship_id={1} and voyage_id={2} and bill_num={3}", AuditEnum.AUDIT_PASS, form.getShipId(), form.getVoyageId(), form.getBillNo()) .exists("select id from customer_export_in where customer_export_in.id = customer_export_in_cargo.export_in_id and check_status={0} and ship_id={1} and voyage_id={2} and bill_num={3}", AuditEnum.AUDIT_PASS, form.getShipId(), form.getVoyageId(), form.getBillNo())
@ -583,6 +717,7 @@ public class ExportInHandler implements BaseHandler {
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
}); });
customerExportInCargoService.updateBatchById(update); customerExportInCargoService.updateBatchById(update);
}
// 修改提单号的信息 // 修改提单号的信息
customerExportInService.lambdaUpdate() customerExportInService.lambdaUpdate()
@ -693,7 +828,7 @@ public class ExportInHandler implements BaseHandler {
return entity; return entity;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(cargos)) { if (CollectionUtils.isNotEmpty(cargos) && !StringUtils.equalsAnyIgnoreCase(exportIn.getCartType(), "备件", "BJ")) {
if (exportIn.getQuantity() != cargos.size()) { if (exportIn.getQuantity() != cargos.size()) {
return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车辆数不等于明细数量"); return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车辆数不等于明细数量");
} }
@ -754,7 +889,7 @@ public class ExportInHandler implements BaseHandler {
return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "进场货物的进场时间,要小于表头进场时间"); return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "进场货物的进场时间,要小于表头进场时间");
} }
// 进场时间的数量加起来要和数量进行匹配如果超过无法进行输入自动获取进场时间加起来的数量 // 进场时间的数量加起来要和数量进行匹配如果超过无法进行输入自动获取进场时间加起来的数量
int num = times.stream().mapToInt(CustomerExportInTimes::getEnterQuantity).sum(); int num = exportIn.getEnterQuantity();
if (num != exportIn.getQuantity()) { if (num != exportIn.getQuantity()) {
return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "进场货物的数量,要等于进场货物的所有数量"); return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "进场货物的数量,要等于进场货物的所有数量");
} }
@ -856,6 +991,26 @@ public class ExportInHandler implements BaseHandler {
item.setCartType(exportIn.getCartType()); item.setCartType(exportIn.getCartType());
}); });
// 获取作业状态
Map<String, String> statCollect = null;
List<String> vins = collect.stream().map(item -> item.getVin()).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(vins)) {
VinStatusRequest req = new VinStatusRequest();
req.setBusinessType("IN_PORT");
req.setImportExportType("E");
req.setVinCodeList(vins);
if (!StringUtils.equalsAnyIgnoreCase(exportIn.getVoyageId(), "HT6", "HTLG", "HTTC")) {
req.setVvyId(exportIn.getVoyageId());
}
List<WorkStatusDTO> status = openApi.getVinStatus(req);
statCollect = status.stream().collect(Collectors.toMap(WorkStatusDTO::getVinCode, WorkStatusDTO::getWorkStatus));
}
if (MapUtils.isNotEmpty(statCollect)) {
for (CustomerExportInCargo cargo : collect) {
cargo.setWorkStatus(statCollect.get(cargo.getVin()));
}
}
customerService.wrapperEntity(collect); customerService.wrapperEntity(collect);
List<CustomerExportInCargo> cargos = collect.stream().filter(item -> item.getCargoType() == 0).collect(Collectors.toList()); List<CustomerExportInCargo> cargos = collect.stream().filter(item -> item.getCargoType() == 0).collect(Collectors.toList());
@ -948,9 +1103,61 @@ public class ExportInHandler implements BaseHandler {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败ID不存在"); return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败ID不存在");
} }
@ApiOperation("批量修改船名航次") @ApiOperation("批量修改船名航次")
@Transactional(rollbackFor = {Exception.class})
@PostMapping("/batch-update/shipVoyage") @PostMapping("/batch-update/shipVoyage")
public Result<String> shipVoyageUpdate(@RequestBody @Validated(ValidationGroup.insert.class) BatchUpdateShipVo form) { public Result<String> shipVoyageUpdate(@RequestBody @Validated(ValidationGroup.insert.class) BatchUpdateShipVo form) {
Boolean havePlan = openApi.haveShipPlan(form.getVoyageId());
if (havePlan) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已生成装船计划,不支持批量修改航次");
}
// 船名航次必须相同才能修改
long count = customerExportInService.query()
.select("distinct(voyage_id)")
.eq("ship_id", form.getShipId())
.eq("check_status", AuditEnum.AUDIT)
.count();
if (count > 0) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "所选船名航次不同,不支持批量修改航次");
}
// 判断是不是备件如果是备件则需要重新生成
List<CustomerExportIn> exportInList = customerExportInService.lambdaQuery()
.eq(CustomerExportIn::getShipId, form.getShipId())
.eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT).list();
exportInList.stream().filter(item -> StringUtils.equals("备件", item.getCartType()) && StringUtils.equalsAnyIgnoreCase(item.getVoyage(), "HT6", "HTTC", "HTLG"))
.forEach(item -> {
String vvyId = item.getVoyageId();
TransitPartRequest request = new TransitPartRequest();
request.setVvyIds(Arrays.asList(vvyId));
request.setPartAmount(item.getQuantity());
request.setMnfBl(item.getBillNum());
Map<String, List<TransitPartResp>> rst = openApi.getTransitPart(request);
List<String> vins = new ArrayList<>(item.getQuantity());
if (MapUtils.isNotEmpty(rst) && CollectionUtils.isNotEmpty(rst.get(vvyId))) { // 需要自动生成
vins.addAll(rst.get(vvyId).stream().map(t -> t.getVinCode()).collect(Collectors.toList()));
List<CustomerExportInCargo> spares = vins.stream().map(p -> {
CustomerExportInCargo entity = new CustomerExportInCargo();
entity.setCargoType(1);
entity.setVinStatus(1);
entity.setVin(p);
entity.setTermcd(item.getPortAreaId());
return entity;
}).collect(Collectors.toList());
// 先删除
customerExportInCargoService.lambdaUpdate().eq(CustomerExportInCargo::getExportInId, item.getId()).remove();
// 后保存
customerExportInCargoService.saveBatch(spares);
}
});
customerExportInService.lambdaUpdate() customerExportInService.lambdaUpdate()
.set(CustomerExportIn::getVoyageId, form.getVoyageId()) .set(CustomerExportIn::getVoyageId, form.getVoyageId())
.set(CustomerExportIn::getVoyage, form.getVoyage()) .set(CustomerExportIn::getVoyage, form.getVoyage())
@ -963,9 +1170,103 @@ public class ExportInHandler implements BaseHandler {
return ResultUtil.success("success"); return ResultUtil.success("success");
} }
@ApiOperation("批量修改船名航次(新)")
@Transactional(rollbackFor = {Exception.class})
@PostMapping("/update/shipVoyage/new")
public Result<String> shipVoyageUpdate(@RequestBody @Validated(ValidationGroup.insert.class) UpdateVoyageVo form) {
List<CustomerExportIn> exportIns = customerExportInService.query()
.select("distinct voyage_id, ship_id")
.in("id", form.getIds())
.list();
if (exportIns.size() > 1) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "所选船名航次不同,不支持批量修改航次");
}
Boolean havePlan = openApi.haveShipPlan(exportIns.get(0).getVoyageId());
if (havePlan) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已生成装船计划,不支持批量修改航次");
}
// 判断是不是备件如果是备件则需要重新生成
List<CustomerExportIn> exportInList = customerExportInService.lambdaQuery()
.in(CustomerExportIn::getId, form.getIds()).list();
exportInList.stream().filter(item -> StringUtils.equals("备件", item.getCartType()) && StringUtils.equalsAnyIgnoreCase(item.getVoyage(), "HT6", "HTTC", "HTLG"))
.forEach(item -> {
String vvyId = item.getVoyageId();
TransitPartRequest request = new TransitPartRequest();
request.setVvyIds(Arrays.asList(vvyId));
request.setPartAmount(item.getQuantity());
request.setMnfBl(item.getBillNum());
Map<String, List<TransitPartResp>> rst = openApi.getTransitPart(request);
List<String> vins = new ArrayList<>(item.getQuantity());
if (MapUtils.isNotEmpty(rst) && CollectionUtils.isNotEmpty(rst.get(vvyId))) { // 需要自动生成
vins.addAll(rst.get(vvyId).stream().map(t -> t.getVinCode()).collect(Collectors.toList()));
List<CustomerExportInCargo> spares = vins.stream().map(p -> {
CustomerExportInCargo entity = new CustomerExportInCargo();
entity.setCargoType(1);
entity.setVinStatus(1);
entity.setVin(p);
entity.setTermcd(item.getPortAreaId());
return entity;
}).collect(Collectors.toList());
// 先删除
customerExportInCargoService.lambdaUpdate().eq(CustomerExportInCargo::getExportInId, item.getId()).remove();
// 后保存
customerExportInCargoService.saveBatch(spares);
}
});
customerExportInService.lambdaUpdate()
.set(CustomerExportIn::getVoyageId, form.getVoyageId())
.set(CustomerExportIn::getVoyage, form.getVoyage())
.in(CustomerExportIn::getId, form.getIds())
.update();
return ResultUtil.success("success");
}
@ApiOperation("单个修改船名航次") @ApiOperation("单个修改船名航次")
@Transactional(rollbackFor = {Exception.class})
@PostMapping("/update/shipVoyage") @PostMapping("/update/shipVoyage")
public Result<String> shipVoyageUpdate(@RequestBody @Validated(ValidationGroup.insert.class) UpdateShipVo form) { public Result<String> shipVoyageUpdate(@RequestBody @Validated(ValidationGroup.insert.class) UpdateShipVo form) {
// 判断是不是备件如果是备件则需要重新生成
List<CustomerExportIn> exportInList = customerExportInService.lambdaQuery()
.eq(CustomerExportIn::getId, form.getId()).list();
exportInList.stream().filter(item -> StringUtils.equals("备件", item.getCartType()) && StringUtils.equalsAnyIgnoreCase(item.getVoyage(), "HT6", "HTTC", "HTLG"))
.forEach(item -> {
String vvyId = item.getVoyageId();
TransitPartRequest request = new TransitPartRequest();
request.setVvyIds(Arrays.asList(vvyId));
request.setPartAmount(item.getQuantity());
request.setMnfBl(item.getBillNum());
Map<String, List<TransitPartResp>> rst = openApi.getTransitPart(request);
List<String> vins = new ArrayList<>(item.getQuantity());
if (MapUtils.isNotEmpty(rst) && CollectionUtils.isNotEmpty(rst.get(vvyId))) { // 需要自动生成
vins.addAll(rst.get(vvyId).stream().map(t -> t.getVinCode()).collect(Collectors.toList()));
List<CustomerExportInCargo> spares = vins.stream().map(p -> {
CustomerExportInCargo entity = new CustomerExportInCargo();
entity.setCargoType(1);
entity.setVinStatus(1);
entity.setVin(p);
entity.setTermcd(item.getPortAreaId());
return entity;
}).collect(Collectors.toList());
// 先删除
customerExportInCargoService.lambdaUpdate().eq(CustomerExportInCargo::getExportInId, item.getId()).remove();
// 后保存
customerExportInCargoService.saveBatch(spares);
}
});
customerExportInService.lambdaUpdate() customerExportInService.lambdaUpdate()
.set(CustomerExportIn::getVoyageId, form.getVoyageId()) .set(CustomerExportIn::getVoyageId, form.getVoyageId())
.set(CustomerExportIn::getVoyage, form.getVoyage()) .set(CustomerExportIn::getVoyage, form.getVoyage())
@ -1195,6 +1496,13 @@ public class ExportInHandler implements BaseHandler {
@ApiOperation("车架号导入(文件形式)") @ApiOperation("车架号导入(文件形式)")
@PostMapping("/import-vin") @PostMapping("/import-vin")
public Result<List<JSONObject>> importVin(@RequestParam(required = false) @NotNull(message = "出口进场ID不能为空") Long id, MultipartFile file) throws IOException { public Result<List<JSONObject>> importVin(@RequestParam(required = false) @NotNull(message = "出口进场ID不能为空") Long id, MultipartFile file) throws IOException {
CustomerExportIn exportIn = customerExportInService.getById(id);
Boolean havePlan = openApi.haveShipPlan(exportIn.getVoyageId());
if (havePlan) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已生成装船计划,不能导入");
}
// 有错误的数据 // 有错误的数据
List<JSONObject> errorDataList = new ArrayList<>(); List<JSONObject> errorDataList = new ArrayList<>();
@ -1582,11 +1890,15 @@ public class ExportInHandler implements BaseHandler {
@ApiOperation("出口进场导出") @ApiOperation("出口进场导出")
@GetMapping("/exportExecl") @GetMapping("/exportExecl")
public void exportExecl(ExportInQuery query, HttpServletResponse response) { public void exportExecl(
@ApiParam(name = "操作方式, 0为前端1为审核端") @RequestParam(required = false, defaultValue = "0") String type,
ExportInQuery query, HttpServletResponse response) {
if (query.getEndEnterTime() != null) { if (query.getEndEnterTime() != null) {
query.setEndEnterTime(DateUtils.getDayEnd(query.getEndEnterTime())); query.setEndEnterTime(DateUtils.getDayEnd(query.getEndEnterTime()));
} }
if (StringUtils.equals(type, "0")) {
query.setCreateBy(UserContext.getUser().getUserId()); query.setCreateBy(UserContext.getUser().getUserId());
}
query.setPage(1); query.setPage(1);
query.setRows(500); query.setRows(500);
Wrapper<CustomerExportIn> queryWrapper = new WrapperKit() { Wrapper<CustomerExportIn> queryWrapper = new WrapperKit() {
@ -1744,11 +2056,52 @@ public class ExportInHandler implements BaseHandler {
@ApiOperation("出口进场计划导入模板下载") @ApiOperation("出口进场计划导入模板下载")
@GetMapping("/temp/down/plan") @GetMapping("/temp/down/plan")
public void tmpDownPlan(HttpServletResponse response) throws Exception { public void newTmpDownPlan(HttpServletResponse response) throws Exception {
ExcelWriter excelWriter = null;
OutputStream out = null; // 车型基础数据
try { List<DictDTO> carTypeList = dictHandler.getCartTypeList(null).getData();
out = response.getOutputStream();
// 加载模板
ClassPathResource classPathResource = new ClassPathResource("templates/in_temp.xlsx");
InputStream inputStream = classPathResource.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(1);
// 车型
XSSFRow row = sheet.getRow(0);
if (row == null) {
row = sheet.createRow(0);
}
for (int i = 0; i < carTypeList.size(); i++) {
XSSFCell cell = row.getCell(i);
if (cell == null) {
// XSSFCellStyle cellStyle = row.getCell(i).getCellStyle();
cell = row.createCell(i);
// cell.setCellStyle(cellStyle);
}
cell.setCellValue(carTypeList.get(i).getText());
// 车型明细
List<DictDTO> data = dictHandler.getCartTypeDetailList(carTypeList.get(i).getId(), null).getData();
for (int j = 0; j < data.size(); j++) {
XSSFRow r = sheet.getRow(j + 1);
if (r == null) {
r = sheet.createRow(j + 1);
}
XSSFCell c = r.getCell(i);
if (c == null) {
// XSSFCellStyle cellStyle = r.getCell(i).getCellStyle();
c = r.createCell(i);
// c.setCellStyle(cellStyle);
}
c.setCellValue(data.get(j).getText());
}
}
OutputStream out = response.getOutputStream();
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
// 这里注意 有同学反应使用swagger 会导致各种问题请直接用浏览器或者用postman // 这里注意 有同学反应使用swagger 会导致各种问题请直接用浏览器或者用postman
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
@ -1757,20 +2110,13 @@ public class ExportInHandler implements BaseHandler {
String fileName = URLEncoder.encode("出口进场计划导入模板", "UTF-8"); String fileName = URLEncoder.encode("出口进场计划导入模板", "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
excelWriter = EasyExcel.write(out).build(); workbook.write(bos);
byte[] bArray = bos.toByteArray();
WriteSheet writeSheet = EasyExcel.writerSheet(0, "出口进场计划").head(ExportInPlanExcel.class).build(); InputStream is = new ByteArrayInputStream(bArray);
IOUtils.copy(is, out);
// 查询数据
List<ExportInPlanExcel> rows = new ArrayList<>();
excelWriter.write(rows, writeSheet);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (excelWriter != null) {
excelWriter.finish();
}
if (out != null) { if (out != null) {
try { try {
out.close(); out.close();
@ -1850,6 +2196,12 @@ public class ExportInHandler implements BaseHandler {
// 港区船名港口品牌车型 // 港区船名港口品牌车型
validData.stream().forEach(item -> { validData.stream().forEach(item -> {
if (item.getEnterQuantity() != item.getQuantity()) {
JSONObject o = JSONObject.from(item);
o.put("status", "数量和进场数量不一致");
errorDataList.add(o);
return;
}
if (portList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getPortName())).count() == 0) { if (portList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getPortName())).count() == 0) {
JSONObject o = JSONObject.from(item); JSONObject o = JSONObject.from(item);
o.put("status", "港口不存在"); o.put("status", "港口不存在");
@ -1994,6 +2346,7 @@ public class ExportInHandler implements BaseHandler {
in.setFreightId(companyMap.get(item.getFreight())); in.setFreightId(companyMap.get(item.getFreight()));
in.setApplicantId(UserContext.getUser().getUserId()); in.setApplicantId(UserContext.getUser().getUserId());
in.setTermcd(in.getPortAreaId()); in.setTermcd(in.getPortAreaId());
in.setVolume(in.getLength().multiply(in.getWeight()).multiply(in.getHeight()).setScale(4, RoundingMode.HALF_UP)); // 计算体积
if (StringUtils.equals("1", type)) { if (StringUtils.equals("1", type)) {
in.setCheckStatus(AuditEnum.AUDIT); in.setCheckStatus(AuditEnum.AUDIT);
@ -2065,15 +2418,27 @@ public class ExportInHandler implements BaseHandler {
// 如果是备件自动生成条码 // 如果是备件自动生成条码
// 过滤出是备件的 // 过滤出是备件的
item.getValue().stream().filter(ss -> StringUtils.equals(ss.getCartType(), "备件")).forEach(ss -> { item.getValue().stream().filter(ss -> StringUtils.equals(ss.getCartType(), "备件")).forEach(ss -> {
// 判断是否是国际中转航次ID
String vvyId = ss.getVoyageId();
TransitPartRequest request = new TransitPartRequest();
request.setVvyIds(Arrays.asList(vvyId));
request.setPartAmount(ss.getQuantity());
request.setMnfBl(ss.getBillNum());
Map<String, List<TransitPartResp>> rst = openApi.getTransitPart(request);
List<String> vins = new ArrayList<>(ss.getQuantity());
if (MapUtils.isNotEmpty(rst) && CollectionUtils.isNotEmpty(rst.get(vvyId))) { // 需要自动生成
vins.addAll(rst.get(vvyId).stream().map(t -> t.getVinCode()).collect(Collectors.toList()));
} else {
// 出口进场计划备件条码生成的规则要变一下BJ+年月日时分+5随机数一共要17位 // 出口进场计划备件条码生成的规则要变一下BJ+年月日时分+5随机数一共要17位
String prefix = StringUtils.join("BJ", DateUtil.format(new Date(), "yyMMddHHmm")); String prefix = StringUtils.join("BJ", DateUtil.format(new Date(), "yyMMddHHmm"));
List<String> vins = new ArrayList<>(ss.getQuantity());
do { do {
String vin = prefix + RandomUtil.randomNumbers(5); String vin = prefix + RandomUtil.randomNumbers(5);
if (!vins.contains(vin)) { if (!vins.contains(vin)) {
vins.add(vin); vins.add(vin);
} }
} while (vins.size() < ss.getQuantity()); } while (vins.size() < ss.getQuantity());
}
List<CustomerExportInCargo> spares = vins.stream().map(p -> { List<CustomerExportInCargo> spares = vins.stream().map(p -> {
CustomerExportInCargo entity = new CustomerExportInCargo(); CustomerExportInCargo entity = new CustomerExportInCargo();
entity.setCargoType(1); entity.setCargoType(1);

View File

@ -1,5 +1,10 @@
package com.haitonggauto.rtosc.handler; package com.haitonggauto.rtosc.handler;
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.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -9,13 +14,17 @@ import com.haitonggauto.rtosc.api.NuzarOpenApi;
import com.haitonggauto.rtosc.api.NuzarYardApi; import com.haitonggauto.rtosc.api.NuzarYardApi;
import com.haitonggauto.rtosc.api.dto.*; import com.haitonggauto.rtosc.api.dto.*;
import com.haitonggauto.rtosc.common.context.UserContext; 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.dto.Result;
import com.haitonggauto.rtosc.common.enums.ErrorType; import com.haitonggauto.rtosc.common.enums.ErrorType;
import com.haitonggauto.rtosc.common.handler.BaseHandler; 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.ResultUtil;
import com.haitonggauto.rtosc.common.utils.ValidationGroup; import com.haitonggauto.rtosc.common.utils.ValidationGroup;
import com.haitonggauto.rtosc.common.utils.WrapperKit; import com.haitonggauto.rtosc.common.utils.WrapperKit;
import com.haitonggauto.rtosc.dto.*; import com.haitonggauto.rtosc.dto.*;
import com.haitonggauto.rtosc.excel.ExportInExcel;
import com.haitonggauto.rtosc.excel.InspectExportExcel;
import com.haitonggauto.rtosc.query.CargoQuery; import com.haitonggauto.rtosc.query.CargoQuery;
import com.haitonggauto.rtosc.query.ExportInspectCheckQuery; import com.haitonggauto.rtosc.query.ExportInspectCheckQuery;
import com.haitonggauto.rtosc.query.ExportInspectQuery; import com.haitonggauto.rtosc.query.ExportInspectQuery;
@ -38,9 +47,12 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.io.*;
import java.net.URLEncoder;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -99,6 +111,68 @@ public class ExportInspectHandler implements BaseHandler {
return ResultUtil.success(rst, String.valueOf(page.getTotal())); return ResultUtil.success(rst, String.valueOf(page.getTotal()));
} }
@ApiOperation("船名模糊匹配")
@PostMapping("/ship/list")
public Result<List<DictDTO>> getShipList(
@RequestParam(required = false, defaultValue = "1") Integer current,
@RequestParam(required = false, defaultValue = "10") Integer size,
@RequestParam(required = false) String q) {
QueryWrapper<CustomerExportInspect> query = new QueryWrapper<>();
query.select("distinct ship_id, ship_name, ship_en_name");
query.eq("create_by", UserContext.getUser().getUserId());
query.eq("trad_type", "E");
if (StringUtils.isNotEmpty(q)) {
query.and((wrapper) -> {
wrapper.like("ship_name", q);
wrapper.or().like("ship_en_name", q);
});
}
Page<CustomerExportInspect> page = customerExportInspectService.page(new Page<>(current, size), query);
List<CustomerExportInspect> list = page.getRecords();
List<DictDTO> rst = list.stream().map(tmp -> {
DictDTO vo = new DictDTO();
vo.setId(tmp.getShipId());
vo.setText(tmp.getShipName());
vo.setExtra1(tmp.getShipEnName());
return vo;
}).collect(Collectors.toList());
return ResultUtil.success(rst, String.valueOf(page.getTotal()));
}
@ApiOperation("航次模糊匹配")
@PostMapping("/voyage/list")
public Result<List<DictDTO>> getVoyageList(
@RequestParam(required = false, defaultValue = "1") Integer current,
@RequestParam(required = false, defaultValue = "10") Integer size,
@RequestParam(required = false) String shipId,
@RequestParam(required = false) String q) {
QueryWrapper<CustomerExportInspect> query = new QueryWrapper<>();
query.select("distinct voyage_id, voyage");
query.eq("create_by", UserContext.getUser().getUserId());
query.eq("trad_type", "E");
query.eq(StringUtils.isNotEmpty(shipId), "ship_id", shipId);
if (StringUtils.isNotEmpty(q)) {
query.and((wrapper) -> {
wrapper.like("voyage", q);
});
}
Page<CustomerExportInspect> page = customerExportInspectService.page(new Page<>(current, size), query);
List<CustomerExportInspect> list = page.getRecords();
List<DictDTO> rst = list.stream().map(tmp -> {
DictDTO vo = new DictDTO();
vo.setId(tmp.getVoyageId());
vo.setText(tmp.getVoyage());
return vo;
}).collect(Collectors.toList());
return ResultUtil.success(rst, String.valueOf(page.getTotal()));
}
@ApiOperation("提单号模糊匹配") @ApiOperation("提单号模糊匹配")
@PostMapping("/billNo/query") @PostMapping("/billNo/query")
public Result<List<String>> getExportInBillNoList( public Result<List<String>> getExportInBillNoList(
@ -198,7 +272,7 @@ public class ExportInspectHandler implements BaseHandler {
public Result<IPage<CustomerExportInspect>> checkQuery(@RequestBody ExportInspectCheckQuery query) { public Result<IPage<CustomerExportInspect>> checkQuery(@RequestBody ExportInspectCheckQuery query) {
query.setTradType("E"); query.setTradType("E");
if (query.getCheckStatus() == null) { if (query.getCheckStatus() == null) {
query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); query.setCheckStatusList(Arrays.asList(AuditEnum.SUBMIT, AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT));
} }
Wrapper<CustomerExportInspect> queryWrapper = new WrapperKit() { Wrapper<CustomerExportInspect> queryWrapper = new WrapperKit() {
}.changeBaseQueryToWrapper(CustomerExportInspect.class, query); }.changeBaseQueryToWrapper(CustomerExportInspect.class, query);
@ -274,6 +348,15 @@ public class ExportInspectHandler implements BaseHandler {
return ResultUtil.success("success"); return ResultUtil.success("success");
} }
@ApiOperation("撤销提交审核")
@PostMapping("/submit-check/reverse")
public Result<String> submitCheckReverse(@RequestBody
@NotNull(message = "请传入要审核的海关查验ID")
@Size(min = 1, message = "ID列表不能为空") List<Long> ids) {
customerExportInspectService.lambdaUpdate().set(CustomerExportInspect::getCheckStatus, AuditEnum.SUBMIT).in(CustomerExportInspect::getId, ids).update();
return ResultUtil.success("success");
}
/** /**
* 删除 * 删除
* *
@ -505,4 +588,66 @@ public class ExportInspectHandler implements BaseHandler {
} }
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败ID不存在"); return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败ID不存在");
} }
/**
*
* 导出excel
* @param response
*/
@ApiOperation("导出excel")
@GetMapping("/export-execl")
public void exportExcel(HttpServletResponse response,
@RequestParam
@NotBlank(message = "请传入ID列表") String strIds) throws Exception {
List<Long> ids = Arrays.stream(StringUtils.split(strIds, "-")).map(item -> Long.valueOf(item)).collect(Collectors.toList());
ExcelWriter excelWriter = null;
OutputStream out = null;
try {
out = response.getOutputStream();
// 这里注意 有同学反应使用swagger 会导致各种问题请直接用浏览器或者用postman
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");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
excelWriter = EasyExcel.write(out).build();
WriteSheet writeSheet = EasyExcel.writerSheet(0, "出口查验计划清单").head(ExportInExcel.class).build();
// 查询数据
List<CustomerExportInspect> list = customerExportInspectService.lambdaQuery().in(CustomerExportInspect::getId, ids).list();
customerService.wrapperEntity(list);
// 获取查验状态
List<String> sids = list.stream().map(item -> item.getId() + "").collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(ids)) {
List<InspectStatusResp> inspectStatusStatus = openApi.getInspectStatusStatus(sids);
Map<String, String> collect = inspectStatusStatus.stream().collect(Collectors.toMap(InspectStatusResp::getApplyId, InspectStatusResp::getInspectionStatusNm));
list.forEach(item -> {
if (collect.containsKey(item.getId()+"")) {
item.setApiInspectStatus(collect.get(item.getId()+""));
}
});
}
List<InspectExportExcel> rows = list.stream().map(item -> PoMapper.instance.inspectEntity2ExportExcel(item)).collect(Collectors.toList());
excelWriter.write(rows, writeSheet);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (excelWriter != null) {
excelWriter.finish();
}
if (out != null) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
} }

View File

@ -19,12 +19,14 @@ import com.haitonggauto.rtosc.common.dto.DictDTO;
import com.haitonggauto.rtosc.common.dto.Result; import com.haitonggauto.rtosc.common.dto.Result;
import com.haitonggauto.rtosc.common.enums.ErrorType; import com.haitonggauto.rtosc.common.enums.ErrorType;
import com.haitonggauto.rtosc.common.handler.BaseHandler; 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.ResultUtil;
import com.haitonggauto.rtosc.common.utils.ValidationGroup; import com.haitonggauto.rtosc.common.utils.ValidationGroup;
import com.haitonggauto.rtosc.common.utils.WrapperKit; import com.haitonggauto.rtosc.common.utils.WrapperKit;
import com.haitonggauto.rtosc.dto.*; import com.haitonggauto.rtosc.dto.*;
import com.haitonggauto.rtosc.excel.*; import com.haitonggauto.rtosc.excel.*;
import com.haitonggauto.rtosc.query.CargoQuery; import com.haitonggauto.rtosc.query.CargoQuery;
import com.haitonggauto.rtosc.query.ExportInCheckQuery;
import com.haitonggauto.rtosc.query.ExportLoadCheckQuery; import com.haitonggauto.rtosc.query.ExportLoadCheckQuery;
import com.haitonggauto.rtosc.query.ExportLoadQuery; import com.haitonggauto.rtosc.query.ExportLoadQuery;
import com.haitonggauto.rtosc.repository.entity.*; import com.haitonggauto.rtosc.repository.entity.*;
@ -132,6 +134,66 @@ public class ExportLoadHandler implements BaseHandler {
return ResultUtil.success(rst, String.valueOf(page.getTotal())); return ResultUtil.success(rst, String.valueOf(page.getTotal()));
} }
@ApiOperation("船名模糊匹配")
@PostMapping("/ship/list")
public Result<List<DictDTO>> getShipList(
@RequestParam(required = false, defaultValue = "1") Integer current,
@RequestParam(required = false, defaultValue = "10") Integer size,
@RequestParam(required = false) String q) {
QueryWrapper<CustomerExportLoad> query = new QueryWrapper<>();
query.select("distinct ship_id, ship_name, ship_en_name");
query.eq("create_by", UserContext.getUser().getUserId());
if (StringUtils.isNotEmpty(q)) {
query.and((wrapper) -> {
wrapper.like("ship_name", q);
wrapper.or().like("ship_en_name", q);
});
}
Page<CustomerExportLoad> page = customerExportLoadService.page(new Page<>(current, size), query);
List<CustomerExportLoad> list = page.getRecords();
List<DictDTO> rst = list.stream().map(tmp -> {
DictDTO vo = new DictDTO();
vo.setId(tmp.getShipId());
vo.setText(tmp.getShipName());
vo.setExtra1(tmp.getShipEnName());
return vo;
}).collect(Collectors.toList());
return ResultUtil.success(rst, String.valueOf(page.getTotal()));
}
@ApiOperation("航次模糊匹配")
@PostMapping("/voyage/list")
public Result<List<DictDTO>> getVoyageList(
@RequestParam(required = false, defaultValue = "1") Integer current,
@RequestParam(required = false, defaultValue = "10") Integer size,
@RequestParam(required = false) String shipId,
@RequestParam(required = false) String q) {
QueryWrapper<CustomerExportLoad> query = new QueryWrapper<>();
query.select("distinct voyage_id, voyage");
query.eq("create_by", UserContext.getUser().getUserId());
query.eq(StringUtils.isNotEmpty(shipId), "ship_id", shipId);
if (StringUtils.isNotEmpty(q)) {
query.and((wrapper) -> {
wrapper.like("voyage", q);
});
}
Page<CustomerExportLoad> page = customerExportLoadService.page(new Page<>(current, size), query);
List<CustomerExportLoad> list = page.getRecords();
List<DictDTO> rst = list.stream().map(tmp -> {
DictDTO vo = new DictDTO();
vo.setId(tmp.getVoyageId());
vo.setText(tmp.getVoyage());
return vo;
}).collect(Collectors.toList());
return ResultUtil.success(rst, String.valueOf(page.getTotal()));
}
@ApiOperation("审核端所有待审核船名列表") @ApiOperation("审核端所有待审核船名列表")
@PostMapping("/check/ship/list") @PostMapping("/check/ship/list")
public Result<List<DictDTO>> getCheckShipList( public Result<List<DictDTO>> getCheckShipList(
@ -231,7 +293,7 @@ public class ExportLoadHandler implements BaseHandler {
@PostMapping("/check/query-list") @PostMapping("/check/query-list")
public Result<IPage<CustomerExportLoad>> checkQuery(@RequestBody ExportLoadCheckQuery query) { public Result<IPage<CustomerExportLoad>> checkQuery(@RequestBody ExportLoadCheckQuery query) {
if (query.getCheckStatus() == null) { if (query.getCheckStatus() == null) {
query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); query.setCheckStatusList(Arrays.asList(AuditEnum.SUBMIT, AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT));
} }
Wrapper<CustomerExportLoad> queryWrapper = new WrapperKit() { Wrapper<CustomerExportLoad> queryWrapper = new WrapperKit() {
}.changeBaseQueryToWrapper(CustomerExportLoad.class, query); }.changeBaseQueryToWrapper(CustomerExportLoad.class, query);
@ -240,6 +302,25 @@ public class ExportLoadHandler implements BaseHandler {
return ResultUtil.success(page); return ResultUtil.success(page);
} }
@ApiOperation("审核端统计查询")
@PostMapping("/check/query-list/count")
public Result<Map<String, Object>> checkCountQuery(@RequestBody ExportLoadCheckQuery query) {
if (query.getCheckStatus() == null) {
query.setCheckStatusList(Arrays.asList(AuditEnum.SUBMIT, AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT));
}
query.setSorts(null);
QueryWrapper<CustomerExportLoad> queryWrapper = (QueryWrapper) new WrapperKit() {
}.changeBaseQueryToWrapper(CustomerExportLoad.class, query);
queryWrapper.select("sum(quantity) as quantity, sum(spare_quantity) as spare_quantity");
Map<String, Object> map = customerExportLoadService.getMap(queryWrapper);
return ResultUtil.success(map);
}
@ApiOperation("根据航次ID查询审核通过出口装船记录") @ApiOperation("根据航次ID查询审核通过出口装船记录")
@PostMapping("/query-list/voyage") @PostMapping("/query-list/voyage")
public Result<List<CustomerExportLoad>> checkQuery(@RequestParam(required = false) @NotBlank(message = "航次ID不能为空") String voyageId, public Result<List<CustomerExportLoad>> checkQuery(@RequestParam(required = false) @NotBlank(message = "航次ID不能为空") String voyageId,
@ -328,6 +409,16 @@ public class ExportLoadHandler implements BaseHandler {
return ResultUtil.success("success"); return ResultUtil.success("success");
} }
@ApiOperation("撤销提交审核")
@PostMapping("/submit-check/reverse")
public Result<String> submitCheckReverse(@RequestBody
@NotNull(message = "请传入要审核的出口装船ID")
@Size(min = 1, message = "ID列表不能为空") List<Long> ids) {
customerExportLoadService.lambdaUpdate().set(CustomerExportLoad::getCheckStatus, AuditEnum.SUBMIT)
.set(CustomerExportLoad::getCheckResult, null).in(CustomerExportLoad::getId, ids).update();
return ResultUtil.success("success");
}
/** /**
* 删除 * 删除
* *
@ -362,6 +453,7 @@ public class ExportLoadHandler implements BaseHandler {
exportInHandler.recoverVin(form); exportInHandler.recoverVin(form);
} }
if (CollectionUtils.isNotEmpty(form.getVins())) {
// 修改 装船的数据 // 修改 装船的数据
// 查询出货物列表 // 查询出货物列表
List<CustomerExportLoadCargo> list = customerExportLoadCargoService.lambdaQuery() List<CustomerExportLoadCargo> list = customerExportLoadCargoService.lambdaQuery()
@ -422,6 +514,7 @@ public class ExportLoadHandler implements BaseHandler {
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
}); });
customerExportLoadCargoService.updateBatchById(update); customerExportLoadCargoService.updateBatchById(update);
}
return ResultUtil.success("success"); return ResultUtil.success("success");
} }
@ -752,9 +845,50 @@ public class ExportLoadHandler implements BaseHandler {
return ResultUtil.success("success"); return ResultUtil.success("success");
} }
@ApiOperation("批量修改船名航次(新)")
@PostMapping("/update/shipVoyage/new")
public Result<String> shipVoyageUpdate(@RequestBody @Validated(ValidationGroup.insert.class) UpdateVoyageVo form) {
List<CustomerExportLoad> exportLoads = customerExportLoadService.query()
.select("distinct voyage_id, ship_id")
.in("id", form.getIds())
.list();
if (exportLoads.size() > 1) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "所选船名航次不同,不支持批量修改航次");
}
Boolean havePlan = openApi.haveShipPlan(exportLoads.get(0).getVoyageId());
if (havePlan) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已生成装船计划,不支持批量修改航次");
}
customerExportLoadService.lambdaUpdate()
.set(CustomerExportLoad::getVoyageId, form.getVoyageId())
.set(CustomerExportLoad::getVoyage, form.getVoyage())
.in(CustomerExportLoad::getId, form.getIds())
.update();
return ResultUtil.success("success");
}
@ApiOperation("批量修改船名航次") @ApiOperation("批量修改船名航次")
@PostMapping("/batch-update/shipVoyage") @PostMapping("/batch-update/shipVoyage")
public Result<String> shipVoyageUpdate(@RequestBody @Validated(ValidationGroup.update.class) BatchUpdateShipVo form) { public Result<String> shipVoyageUpdate(@RequestBody @Validated(ValidationGroup.update.class) BatchUpdateShipVo form) {
Boolean havePlan = openApi.haveShipPlan(form.getVoyageId());
if (havePlan) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已生成装船计划,不支持批量修改航次");
}
// 船名航次必须相同才能修改
long count = customerExportInService.query()
.select("distinct(voyage_id)")
.eq("ship_id", form.getShipId())
.eq("check_status", AuditEnum.AUDIT)
.count();
if (count > 0) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "所选船名航次不同,不支持批量修改航次");
}
customerExportLoadService.lambdaUpdate() customerExportLoadService.lambdaUpdate()
.set(CustomerExportLoad::getVoyageId, form.getVoyageId()) .set(CustomerExportLoad::getVoyageId, form.getVoyageId())

View File

@ -99,7 +99,7 @@ public class FreeTradeHandler implements BaseHandler {
query.setEndCreateDate(DateUtils.getDayEnd(query.getEndCreateDate())); query.setEndCreateDate(DateUtils.getDayEnd(query.getEndCreateDate()));
} }
if (query.getCheckStatus() == null) { if (query.getCheckStatus() == null) {
query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); query.setCheckStatusList(Arrays.asList(AuditEnum.SUBMIT, AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT));
} }
Wrapper<CustomerFreeTrade> queryWrapper = new WrapperKit() { Wrapper<CustomerFreeTrade> queryWrapper = new WrapperKit() {
}.changeBaseQueryToWrapper(CustomerFreeTrade.class, query); }.changeBaseQueryToWrapper(CustomerFreeTrade.class, query);
@ -236,6 +236,18 @@ public class FreeTradeHandler implements BaseHandler {
return ResultUtil.success("success"); return ResultUtil.success("success");
} }
@ApiOperation("撤销提交审核")
@PostMapping("/submit-check/reverse")
public Result<String> submitCheckReverse(@RequestBody List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
} else {
customerFreeTradeService.lambdaUpdate().set(CustomerFreeTrade::getCheckStatus, AuditEnum.SUBMIT)
.set(CustomerFreeTrade::getCheckResult, null)
.in(CustomerFreeTrade::getId, ids).update();
}
return ResultUtil.success("success");
}
/** /**
* 验证车架号状态是否激活 * 验证车架号状态是否激活
* @param vins * @param vins

View File

@ -1,5 +1,10 @@
package com.haitonggauto.rtosc.handler; package com.haitonggauto.rtosc.handler;
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.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -9,6 +14,7 @@ import com.haitonggauto.rtosc.api.NuzarOpenApi;
import com.haitonggauto.rtosc.api.dto.*; import com.haitonggauto.rtosc.api.dto.*;
import com.haitonggauto.rtosc.api.dto.log.ImportInspectLog; import com.haitonggauto.rtosc.api.dto.log.ImportInspectLog;
import com.haitonggauto.rtosc.common.context.UserContext; 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.dto.Result;
import com.haitonggauto.rtosc.common.enums.ErrorType; import com.haitonggauto.rtosc.common.enums.ErrorType;
import com.haitonggauto.rtosc.common.handler.BaseHandler; import com.haitonggauto.rtosc.common.handler.BaseHandler;
@ -16,6 +22,8 @@ import com.haitonggauto.rtosc.common.utils.ResultUtil;
import com.haitonggauto.rtosc.common.utils.ValidationGroup; import com.haitonggauto.rtosc.common.utils.ValidationGroup;
import com.haitonggauto.rtosc.common.utils.WrapperKit; import com.haitonggauto.rtosc.common.utils.WrapperKit;
import com.haitonggauto.rtosc.dto.*; import com.haitonggauto.rtosc.dto.*;
import com.haitonggauto.rtosc.excel.ExportInExcel;
import com.haitonggauto.rtosc.excel.InspectExportExcel;
import com.haitonggauto.rtosc.handler.mapper.PoMapper; import com.haitonggauto.rtosc.handler.mapper.PoMapper;
import com.haitonggauto.rtosc.query.CargoQuery; import com.haitonggauto.rtosc.query.CargoQuery;
import com.haitonggauto.rtosc.query.ExportInspectCheckQuery; import com.haitonggauto.rtosc.query.ExportInspectCheckQuery;
@ -39,9 +47,13 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -97,6 +109,68 @@ public class ImportInspectHandler implements BaseHandler {
return ResultUtil.success(rst, String.valueOf(page.getTotal())); return ResultUtil.success(rst, String.valueOf(page.getTotal()));
} }
@ApiOperation("船名模糊匹配")
@PostMapping("/ship/list")
public Result<List<DictDTO>> getShipList(
@RequestParam(required = false, defaultValue = "1") Integer current,
@RequestParam(required = false, defaultValue = "10") Integer size,
@RequestParam(required = false) String q) {
QueryWrapper<CustomerExportInspect> query = new QueryWrapper<>();
query.select("distinct ship_id, ship_name, ship_en_name");
query.eq("create_by", UserContext.getUser().getUserId());
query.eq("trad_type", "I");
if (StringUtils.isNotEmpty(q)) {
query.and((wrapper) -> {
wrapper.like("ship_name", q);
wrapper.or().like("ship_en_name", q);
});
}
Page<CustomerExportInspect> page = customerExportInspectService.page(new Page<>(current, size), query);
List<CustomerExportInspect> list = page.getRecords();
List<DictDTO> rst = list.stream().map(tmp -> {
DictDTO vo = new DictDTO();
vo.setId(tmp.getShipId());
vo.setText(tmp.getShipName());
vo.setExtra1(tmp.getShipEnName());
return vo;
}).collect(Collectors.toList());
return ResultUtil.success(rst, String.valueOf(page.getTotal()));
}
@ApiOperation("航次模糊匹配")
@PostMapping("/voyage/list")
public Result<List<DictDTO>> getVoyageList(
@RequestParam(required = false, defaultValue = "1") Integer current,
@RequestParam(required = false, defaultValue = "10") Integer size,
@RequestParam(required = false) String shipId,
@RequestParam(required = false) String q) {
QueryWrapper<CustomerExportInspect> query = new QueryWrapper<>();
query.select("distinct voyage_id, voyage");
query.eq("create_by", UserContext.getUser().getUserId());
query.eq("trad_type", "I");
query.eq(StringUtils.isNotEmpty(shipId), "ship_id", shipId);
if (StringUtils.isNotEmpty(q)) {
query.and((wrapper) -> {
wrapper.like("voyage", q);
});
}
Page<CustomerExportInspect> page = customerExportInspectService.page(new Page<>(current, size), query);
List<CustomerExportInspect> list = page.getRecords();
List<DictDTO> rst = list.stream().map(tmp -> {
DictDTO vo = new DictDTO();
vo.setId(tmp.getVoyageId());
vo.setText(tmp.getVoyage());
return vo;
}).collect(Collectors.toList());
return ResultUtil.success(rst, String.valueOf(page.getTotal()));
}
@ApiOperation("提单号模糊匹配") @ApiOperation("提单号模糊匹配")
@PostMapping("/billNo/query") @PostMapping("/billNo/query")
public Result<List<String>> getExportInBillNoList( public Result<List<String>> getExportInBillNoList(
@ -183,7 +257,7 @@ public class ImportInspectHandler implements BaseHandler {
public Result<IPage<CustomerExportInspect>> checkQuery(@RequestBody ExportInspectCheckQuery query) { public Result<IPage<CustomerExportInspect>> checkQuery(@RequestBody ExportInspectCheckQuery query) {
query.setTradType("I"); query.setTradType("I");
if (query.getCheckStatus() == null) { if (query.getCheckStatus() == null) {
query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); query.setCheckStatusList(Arrays.asList(AuditEnum.SUBMIT, AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT));
} }
Wrapper<CustomerExportInspect> queryWrapper = new WrapperKit() { Wrapper<CustomerExportInspect> queryWrapper = new WrapperKit() {
}.changeBaseQueryToWrapper(CustomerExportInspect.class, query); }.changeBaseQueryToWrapper(CustomerExportInspect.class, query);
@ -255,6 +329,16 @@ public class ImportInspectHandler implements BaseHandler {
return ResultUtil.success("success"); return ResultUtil.success("success");
} }
@ApiOperation("撤销提交审核")
@PostMapping("/submit-check/reverse")
public Result<String> submitCheckReverse(@RequestBody
@NotNull(message = "请传入要审核的海关查验ID")
@Size(min = 1, message = "ID列表不能为空") List<Long> ids) {
customerExportInspectService.lambdaUpdate().set(CustomerExportInspect::getCheckStatus, AuditEnum.SUBMIT)
.set(CustomerExportInspect::getCheckReason, null).in(CustomerExportInspect::getId, ids).update();
return ResultUtil.success("success");
}
/** /**
* 删除 * 删除
* *
@ -470,4 +554,66 @@ public class ImportInspectHandler implements BaseHandler {
} }
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败ID不存在"); return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败ID不存在");
} }
/**
*
* 导出excel
* @param response
*/
@ApiOperation("导出excel")
@GetMapping("/export-execl")
public void exportExcel(HttpServletResponse response,
@RequestParam
@NotBlank(message = "请传入ID列表") String strIds) throws Exception {
List<Long> ids = Arrays.stream(StringUtils.split(strIds, "-")).map(item -> Long.valueOf(item)).collect(Collectors.toList());
ExcelWriter excelWriter = null;
OutputStream out = null;
try {
out = response.getOutputStream();
// 这里注意 有同学反应使用swagger 会导致各种问题请直接用浏览器或者用postman
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");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
excelWriter = EasyExcel.write(out).build();
WriteSheet writeSheet = EasyExcel.writerSheet(0, "进口查验计划清单").head(ExportInExcel.class).build();
// 查询数据
List<CustomerExportInspect> list = customerExportInspectService.lambdaQuery().in(CustomerExportInspect::getId, ids).list();
customerService.wrapperEntity(list);
// 获取查验状态
List<String> sids = list.stream().map(item -> item.getId() + "").collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(ids)) {
List<InspectStatusResp> inspectStatusStatus = openApi.getInspectStatusStatus(sids);
Map<String, String> collect = inspectStatusStatus.stream().collect(Collectors.toMap(InspectStatusResp::getApplyId, InspectStatusResp::getInspectionStatusNm));
list.forEach(item -> {
if (collect.containsKey(item.getId()+"")) {
item.setApiInspectStatus(collect.get(item.getId()+""));
}
});
}
List<InspectExportExcel> rows = list.stream().map(item -> PoMapper.instance.inspectEntity2ExportExcel(item)).collect(Collectors.toList());
excelWriter.write(rows, writeSheet);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (excelWriter != null) {
excelWriter.finish();
}
if (out != null) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
} }

View File

@ -153,7 +153,7 @@ public class ImportTakeHandler implements BaseHandler {
@PostMapping("/check/list") @PostMapping("/check/list")
public Result<IPage<CustomerImportTakeCargo>> checkList(@RequestBody ImportTakeQuery query) { public Result<IPage<CustomerImportTakeCargo>> checkList(@RequestBody ImportTakeQuery query) {
if (query.getCheckStatus() == null) { if (query.getCheckStatus() == null) {
query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); query.setCheckStatusList(Arrays.asList(AuditEnum.SUBMIT, AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT));
} }
IPage<CustomerImportTakeCargo> page = importTakeCargoService.getImportTakeCargoPage(new Page<>(query.getPage(), query.getRows()), query); IPage<CustomerImportTakeCargo> page = importTakeCargoService.getImportTakeCargoPage(new Page<>(query.getPage(), query.getRows()), query);
customerService.wrapperEntity(page.getRecords()); customerService.wrapperEntity(page.getRecords());

View File

@ -159,7 +159,7 @@ public class ImportUnloadHandler implements BaseHandler {
@PostMapping("/audit/query-list") @PostMapping("/audit/query-list")
public Result<IPage<CustomerImportUnload>> auditQuery(@RequestBody ImportUnloadQuery query) { public Result<IPage<CustomerImportUnload>> auditQuery(@RequestBody ImportUnloadQuery query) {
if (query.getCheckStatus() == null) { if (query.getCheckStatus() == null) {
query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); query.setCheckStatusList(Arrays.asList(AuditEnum.SUBMIT, AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT));
} }
Wrapper<CustomerImportUnload> queryWrapper = new WrapperKit() { Wrapper<CustomerImportUnload> queryWrapper = new WrapperKit() {
}.changeBaseQueryToWrapper(CustomerImportUnload.class, query); }.changeBaseQueryToWrapper(CustomerImportUnload.class, query);

View File

@ -1,10 +1,7 @@
package com.haitonggauto.rtosc.handler.mapper; package com.haitonggauto.rtosc.handler.mapper;
import com.haitonggauto.rtosc.api.dto.log.ImportInspectLog; import com.haitonggauto.rtosc.api.dto.log.ImportInspectLog;
import com.haitonggauto.rtosc.excel.ExportInExcel; import com.haitonggauto.rtosc.excel.*;
import com.haitonggauto.rtosc.excel.ExportInPlanExcel;
import com.haitonggauto.rtosc.excel.FreeTradeExcel;
import com.haitonggauto.rtosc.excel.FreeTradeExportExcel;
import com.haitonggauto.rtosc.repository.entity.*; import com.haitonggauto.rtosc.repository.entity.*;
import com.haitonggauto.rtosc.dto.*; import com.haitonggauto.rtosc.dto.*;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@ -78,4 +75,6 @@ public interface PoMapper {
CustomerLinkman linkmanVo2Entity(LinkmanVo vo); CustomerLinkman linkmanVo2Entity(LinkmanVo vo);
ImportInspectLog exportInspect2Import(CustomerExportInspect inspect); ImportInspectLog exportInspect2Import(CustomerExportInspect inspect);
InspectExportExcel inspectEntity2ExportExcel(CustomerExportInspect inspect);
} }

View File

@ -307,6 +307,8 @@ public class CustomerServiceImpl implements CustomerService {
} }
exportInTimesService.saveBatch(insert); exportInTimesService.saveBatch(insert);
} else {
exportInTimesService.lambdaUpdate().eq(CustomerExportInTimes::getExportInId, exportIn.getId()).remove();
} }
} }

View File

@ -315,6 +315,27 @@ public class CustomerExportIn extends BaseEntity implements Serializable {
@ApiModelProperty(value = "操作模式") @ApiModelProperty(value = "操作模式")
private String operateType; private String operateType;
/**
* 使用机械ID
*/
@TableField(value = "machine_id")
@ApiModelProperty(value = "使用机械ID")
private String machineId;
/**
* 使用机械名称
*/
@TableField(value = "machine_name")
@ApiModelProperty(value = "使用机械名称")
private String machineName;
/**
* 是否是二手车
*/
@TableField(value = "second_hand")
@ApiModelProperty(value = "是否是二手车1是二手车0不是二手车")
private String secondHand;
/** /**
* 提单号 * 提单号
*/ */

View File

@ -59,6 +59,11 @@ public class CustomerExportInspectCargo extends BaseEntity implements Serializab
@ApiModelProperty(value = "车型") @ApiModelProperty(value = "车型")
private String cartType; private String cartType;
@TableField(value = "models")
@ApiModelProperty(value = "型号")
private String models;
/** /**
* 车架号 * 车架号
*/ */

View File

@ -60,6 +60,8 @@
<result property="shipEnName" column="ship_en_name" jdbcType="VARCHAR"/> <result property="shipEnName" column="ship_en_name" jdbcType="VARCHAR"/>
<result property="voyageId" column="voyage_id" jdbcType="VARCHAR"/> <result property="voyageId" column="voyage_id" jdbcType="VARCHAR"/>
<result property="applicantId" column="applicant_id" jdbcType="VARCHAR"/> <result property="applicantId" column="applicant_id" jdbcType="VARCHAR"/>
<result property="settleCompId" column="settle_comp_id" jdbcType="VARCHAR"/>
<result property="settleCompName" column="settle_comp_name" jdbcType="VARCHAR"/>
<result property="checkManId" column="check_man_id" jdbcType="VARCHAR"/> <result property="checkManId" column="check_man_id" jdbcType="VARCHAR"/>
<collection property="vins" ofType="com.haitonggauto.rtosc.repository.entity.CustomerExportLoadCargo"> <collection property="vins" ofType="com.haitonggauto.rtosc.repository.entity.CustomerExportLoadCargo">
<result property="id" column="vin_id" jdbcType="BIGINT"/> <result property="id" column="vin_id" jdbcType="BIGINT"/>