commit 4d129332cf5b9fbce012fb21fa9116f18cb40a61 Author: dengjun Date: Thu Nov 2 16:33:24 2023 +0800 2023-11-02 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1cce23f --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +/nuzar-customer-business/target/ +/nuzar-customer-client/target/ +/nuzar-customer-common/target/ +/nuzar-customer-controller/target/ +/nuzar-customer-domain/target/ +/nuzar-customer-proxy/target/ +/nuzar-customer-repository/target/ +/.idea/ +/logs/ +*.iml +/nuzar-customer-repository/nuzar-customer-repository.iml diff --git a/README.md b/README.md new file mode 100644 index 0000000..195479f --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# nuzar-cloud-ddd-archetype + +#### 介绍 +nuzar-cloud-ddd-archetype 提供了一个基于领域驱动设计分层模型的脚手架 + +#### 软件架构 + diff --git a/nuzar-customer-business/pom.xml b/nuzar-customer-business/pom.xml new file mode 100644 index 0000000..0146a3a --- /dev/null +++ b/nuzar-customer-business/pom.xml @@ -0,0 +1,52 @@ + + + + com.haitonggauto.rtosc + nuzar-customer + 1.0-SNAPSHOT + + 4.0.0 + + nuzar-customer-business + jar + + true + + + + + com.haitonggauto.rtosc + nuzar-customer-client + 1.0-SNAPSHOT + + + + + com.haitonggauto.rtosc + nuzar-customer-domain + + + + com.haitonggauto.rtosc + nuzar-customer-proxy + + + com.nuzar + nuzar-redis-starter + + + + com.nuzar + nuzar-core + + + + + diff --git a/nuzar-customer-business/src/main/java/com/haitonggauto/rtosc/business/converter/OrderConverter.java b/nuzar-customer-business/src/main/java/com/haitonggauto/rtosc/business/converter/OrderConverter.java new file mode 100644 index 0000000..0d4b44a --- /dev/null +++ b/nuzar-customer-business/src/main/java/com/haitonggauto/rtosc/business/converter/OrderConverter.java @@ -0,0 +1,42 @@ +package com.haitonggauto.rtosc.business.converter; + +import com.haitonggauto.rtosc.domain.entity.Order; +import com.haitonggauto.rtosc.dto.OrderDTO; +import com.haitonggauto.rtosc.repository.dataobject.OrderDO; +import java.util.List; +import org.mapstruct.InheritInverseConfiguration; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +/** + *

+ * Order 对象转换 + *

+ * + * @author admin + * @since 2023/4/4 9:38 + */ +@Mapper +public interface OrderConverter { + + OrderConverter INSTANCE = Mappers.getMapper(OrderConverter.class); + + @Mapping(target = "id", ignore = true) + @Mapping(target = "createTime" ,source = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss") + @Mapping(target = "updateTime" ,source = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss") + OrderDTO convert(OrderDO orderDO); + + @InheritInverseConfiguration + OrderDO convert(OrderDTO orderDTO); + + @Mapping(target = "id", ignore = true) + @Mapping(target = "createTime" ,source = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss") + @Mapping(target = "updateTime" ,source = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss") + OrderDTO convertToDTO(Order order); + + @Mapping(target = "id", ignore = true) + Order convertToOrder(OrderDTO order); + + List convertToListDTO(List orderList); +} diff --git a/nuzar-customer-business/src/main/java/com/haitonggauto/rtosc/business/dto/TestDTO.java b/nuzar-customer-business/src/main/java/com/haitonggauto/rtosc/business/dto/TestDTO.java new file mode 100644 index 0000000..c9c58a4 --- /dev/null +++ b/nuzar-customer-business/src/main/java/com/haitonggauto/rtosc/business/dto/TestDTO.java @@ -0,0 +1,5 @@ +package com.haitonggauto.rtosc.business.dto; + +public class TestDTO { + +} diff --git a/nuzar-customer-business/src/main/java/com/haitonggauto/rtosc/business/service/OrderBiz.java b/nuzar-customer-business/src/main/java/com/haitonggauto/rtosc/business/service/OrderBiz.java new file mode 100644 index 0000000..27f8c38 --- /dev/null +++ b/nuzar-customer-business/src/main/java/com/haitonggauto/rtosc/business/service/OrderBiz.java @@ -0,0 +1,38 @@ +package com.haitonggauto.rtosc.business.service; + +import com.haitonggauto.rtosc.dto.OrderDTO; +import com.haitonggauto.rtosc.request.OrderPageRequest; +import com.nuzar.cloud.common.exception.BizException; +import com.nuzar.cloud.web.model.PageResult; + +import java.util.List; + +public interface OrderBiz { + + /** + * 下单 + * + * @param orderDTO + * @return + * @throws BizException + */ + void createOrder(OrderDTO orderDTO) + throws BizException; + + /** + * 发货 + * + * @param orderId + */ + void deliveryOrder(Long orderId); + + /** + * 翻页查询订单列表 + * + * @param request + * @return + */ + PageResult queryPage(OrderPageRequest request); + + List list(); +} diff --git a/nuzar-customer-business/src/main/java/com/haitonggauto/rtosc/business/service/impl/OrderBizImpl.java b/nuzar-customer-business/src/main/java/com/haitonggauto/rtosc/business/service/impl/OrderBizImpl.java new file mode 100644 index 0000000..595324c --- /dev/null +++ b/nuzar-customer-business/src/main/java/com/haitonggauto/rtosc/business/service/impl/OrderBizImpl.java @@ -0,0 +1,82 @@ +package com.haitonggauto.rtosc.business.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.haitonggauto.rtosc.business.converter.OrderConverter; +import com.haitonggauto.rtosc.domain.entity.Order; +import com.haitonggauto.rtosc.domain.service.OrderService; +import com.haitonggauto.rtosc.dto.OrderDTO; +import com.haitonggauto.rtosc.enums.OrderStatusEnum; +import com.haitonggauto.rtosc.business.service.OrderBiz; +import com.nuzar.cloud.web.model.PageResult; +import com.nuzar.cloud.web.model.QueryPage; +import com.haitonggauto.rtosc.repository.service.OrderRepository; +import com.haitonggauto.rtosc.repository.dataobject.OrderDO; +import com.haitonggauto.rtosc.request.OrderPageRequest; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; + +@Service +public class OrderBizImpl implements OrderBiz { + + @Autowired + private OrderService orderService; + + @Autowired + private OrderRepository orderRepository; + + @Override +// @GlobalTransactional + public void createOrder(OrderDTO orderDTO) { + // save order + Order order = OrderConverter.INSTANCE.convertToOrder(orderDTO); + order.setStatus(OrderStatusEnum.PAID.getCode()); + order.setCreateTime(LocalDateTime.now()); + order.setUpdateTime(LocalDateTime.now()); + orderService.createOrder(order); + } + + @Override + public void deliveryOrder(Long orderId) { + orderService.deliveryOrder(orderId); + OrderDTO orderDTO = new OrderDTO(); + orderDTO.setStatus(OrderStatusEnum.DELIVERED.getCode()); + orderDTO.setId(orderId); + } + + @Override + public PageResult queryPage(OrderPageRequest request) { + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq(StringUtils.isNotBlank(request.getUserId()),"user_id", request.getUserId()); + wrapper.eq(StringUtils.isNotBlank(request.getStatus()),"status", request.getStatus()); + QueryPage page = new QueryPage<>(); + page.setCurrent(request.getPageNo()); + page.setSize(request.getPageSize()); + //根据条件查询数据 + IPage iPage = this.orderRepository.page(page, wrapper); + List orders = iPage.getRecords(); + List orderDTOList = OrderConverter.INSTANCE.convertToListDTO(orders); + + PageResult orderPage = new PageResult<>(); + orderPage.setTotal(iPage.getTotal()); + orderPage.setList(orderDTOList); + return orderPage; + } + + @Override + public List list() { + List orderDOList = orderRepository.list(); + List orderList = OrderConverter.INSTANCE.convertToListDTO(orderDOList); + return orderList; + } + +// @Override +// public IService getRepository() { +// return this.orderRepository; +// } + +} diff --git a/nuzar-customer-client/pom.xml b/nuzar-customer-client/pom.xml new file mode 100644 index 0000000..b06c9b6 --- /dev/null +++ b/nuzar-customer-client/pom.xml @@ -0,0 +1,51 @@ + + + + com.haitonggauto.rtosc + nuzar-customer + 1.0-SNAPSHOT + + 4.0.0 + com.haitonggauto.rtosc + nuzar-customer-client + jar + + true + + + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + io.swagger + swagger-annotations + 1.5.22 + compile + + + com.haitonggauto.rtosc + nuzar-customer-common + + + com.haitonggauto.rtosc + nuzar-customer-repository + + + com.alibaba + easyexcel + ${easyexcel.version} + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/api/OrderApi.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/api/OrderApi.java new file mode 100644 index 0000000..0322579 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/api/OrderApi.java @@ -0,0 +1,25 @@ +package com.haitonggauto.rtosc.api; + +import com.haitonggauto.rtosc.dto.OrderDTO; +import com.haitonggauto.rtosc.request.OrderPageRequest; +import com.nuzar.cloud.common.web.CommonResult; +import com.nuzar.cloud.web.model.PageResult; +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 java.util.List; + +@FeignClient(name = "nuzar-mydemo-archetype-web") +public interface OrderApi { + + @PostMapping("/order/create") + CommonResult createOrder(@RequestBody OrderDTO orderDTO); + + @GetMapping("/order/list") + CommonResult> list(); + + @PostMapping("/order/page") + CommonResult> queryPage(@RequestBody OrderPageRequest request); +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/BatchUpdateShipVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/BatchUpdateShipVo.java new file mode 100644 index 0000000..bba8439 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/BatchUpdateShipVo.java @@ -0,0 +1,60 @@ +package com.haitonggauto.rtosc.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +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.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +@Data +@ApiModel(value = "批量修改船名、航次") +public class BatchUpdateShipVo 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 = "航次", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次不能为空") + private String voyage; + +// /** +// * 开始时间 +// */ +// @JsonFormat(pattern = "yyyy-MM-dd") +// @ApiModelProperty(value = "开始时间", required = true) +// @NotNull(groups = {ValidationGroup.insert.class}, message = "开始时间不能为空") +// private Date beginDate; +// +// /** +// * 结束时间 +// */ +// @JsonFormat(pattern = "yyyy-MM-dd") +// @ApiModelProperty(value = "结束时间", required = true) +// @NotNull(groups = {ValidationGroup.insert.class}, message = "结束时间不能为空") +// private Date endDate; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/CargoStatus.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/CargoStatus.java new file mode 100644 index 0000000..e887c13 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/CargoStatus.java @@ -0,0 +1,26 @@ +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 = "车辆状态",description = "") +public class CargoStatus implements Serializable { + @NotNull(groups = {ValidationGroup.update.class}, message = "车辆状态") + @ApiModelProperty("车辆状态, 0为取消,1为正常") + private Integer status; + + @NotNull(groups = {ValidationGroup.update.class}, message = "车架号必填!" ) + @ApiModelProperty("车架号") + private String vin; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/CargoStatusVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/CargoStatusVo.java new file mode 100644 index 0000000..ed78e59 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/CargoStatusVo.java @@ -0,0 +1,55 @@ +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; +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.math.BigDecimal; +import java.util.List; + +@Data +@ApiModel(value = "取消恢复车架号",description = "") +public class CargoStatusVo implements Serializable { + @NotBlank(groups = {ValidationGroup.update.class}, message = "船ID不能为空") + @ApiModelProperty(value = "船ID") + private String shipId; + + @NotBlank(groups = {ValidationGroup.update.class}, message = "航次ID为空") + @ApiModelProperty(value = "航次ID") + private String voyageId; + + @NotBlank(groups = {ValidationGroup.update.class}, message = "提单号不能为空") + @ApiModelProperty(value = "提单号") + private String billNo; + + /** + * 单票重量 + */ + @ApiModelProperty(value = "单票重量") + private BigDecimal eachWeight; + + /** + * 单票数量 + */ + @ApiModelProperty(value = "单票数量") + private Integer eachQuantity; + + /** + * 单票体积 + */ + @ApiModelProperty(value = "单票体积") + private BigDecimal eachVolume; + + @Valid + @NotNull(groups = {ValidationGroup.update.class}, message = "车架号必填!" ) + @Size(min = 1 , message = "车架号必填要有一个") + private List vins; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureCargoVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureCargoVo.java new file mode 100644 index 0000000..0bf64be --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureCargoVo.java @@ -0,0 +1,78 @@ +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; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; + +@Data +@ApiModel(value = "提离港区货物表",description = "") +public class DepartureCargoVo implements Serializable { + @ApiModelProperty(value = "id") + private Long id; + /** + * 提离港区ID + */ + @ApiModelProperty(value = "提离港区ID", hidden = true) + private Long departureId; + + /** + * 提单号 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "提单号不能为空") + @ApiModelProperty(value = "提单号", required = true) + private String billNo; + + /** + * 品牌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 = "品牌", required = true) + private String brand; + + /** + * 货物类型 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "货物类型不能为空") + @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; + + /** + * 数量 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "数量不能为空") + @ApiModelProperty(value = "数量", required = true) + private Integer quantity; + + /** + * 是否退关 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "是否退关不能为空") + @ApiModelProperty(value = "是否退关", required = true) + private Integer isShutout; + + + @ApiModelProperty(value = "版本号") + private Integer version; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureCheckVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureCheckVo.java new file mode 100644 index 0000000..46952ba --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureCheckVo.java @@ -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.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel(value = "提离港区审核") +public class DepartureCheckVo implements Serializable { + + @ApiModelProperty(value = "提离港区ID列表") + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "提离港区ID不能为空") + private List ids; + + @ApiModelProperty(value = "审核人ID") +// @NotEmpty(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审核人ID不能为空") + private String checkManId; + + /** + * 审核人 + */ + @ApiModelProperty(value = "审核人") +// @NotEmpty(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审核人不能为空") + private String checkMan; + + /** + * 审核时间 + */ +// private Date checkTime; + + /** + * 审核状态 + */ + @ApiModelProperty(value = "审核状态") + @NotNull(groups = {ValidationGroup.insert.class}, message = "审核状态") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @ApiModelProperty(value = "审核原因") + private String checkResult; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureDriverVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureDriverVo.java new file mode 100644 index 0000000..4047481 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureDriverVo.java @@ -0,0 +1,45 @@ +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; +import java.io.Serializable; + +@Data +@ApiModel(value = "提离港区司机表") +public class DepartureDriverVo implements Serializable { + @ApiModelProperty(value = "id") + private Long id; + /** + * 提离港区ID + */ + @ApiModelProperty(value = "提离港区ID", hidden = true) + private Long departureId; + + /** + * 司机名称 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "司机名称不能为空") + @ApiModelProperty(value = "司机名称", required = true) + private String driverName; + + /** + * 车牌号 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车牌号不能为空") + @ApiModelProperty(value = "车牌号", required = true) + private String carNo; + + /** + * 联系电话 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "联系电话不能为空") + @ApiModelProperty(value = "联系电话", required = true) + private String contactPhone; + + @ApiModelProperty(value = "版本号") + private Integer version; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureLetterVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureLetterVo.java new file mode 100644 index 0000000..48ec44b --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureLetterVo.java @@ -0,0 +1,42 @@ +package com.haitonggauto.rtosc.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class DepartureLetterVo implements Serializable { + private Long id; + /** + * 提离港区ID + */ + private Long departureId; + + /** + * 批次号 + */ + private String batchNo; + + /** + * 进港日期 + */ + private Date enterTime; + + /** + * 提货日期 + */ + private Date departureTime; + + /** + * 返回日期 + */ + private Date returnTime; + + /** + * 事由 + */ + private String reason; + + private Integer version; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DeparturePlanVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DeparturePlanVo.java new file mode 100644 index 0000000..623daba --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DeparturePlanVo.java @@ -0,0 +1,80 @@ +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 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; + +@Data +@ApiModel(value = "提离港区操作计划表") +public class DeparturePlanVo implements Serializable { + @ApiModelProperty(value = "id") + private Long id; + /** + * 提离港区ID + */ + @ApiModelProperty(value = "提离港区ID", hidden = true) + private Long departureId; + + /** + * 品牌ID + */ + @ApiModelProperty(value = "品牌ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "品牌ID不能为空") + private String brandId; + + /** + * 品牌 + */ + @TableField(value = "brand") + @ApiModelProperty(value = "品牌") + private String brand; + + /** + * 计划提货时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "计划提货时间", required = true, example="2023-06-12") + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "计划提货时间不能为空") + private Date pickTime; + + /** + * 计划车辆数量 + */ + @ApiModelProperty(value = "计划车辆数量", required = true) + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "计划车辆数量不能为空") + private Integer carQuantity; + + /** + * 计划备件数量 + */ + @ApiModelProperty(value = "计划备件数量", required = true) + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "计划备件数量不能为空") + private Integer partQuantity; + + /** + * 工作过程 + */ + @ApiModelProperty(value = "工作过程", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "工作过程不能为空") + private String workStatus; + + @ApiModelProperty(value = "工作过程", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "工作过程名称不能为空") + private String workStatusName; + + + @ApiModelProperty(value = "版本号") + private Integer version; + + + + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureVo.java new file mode 100644 index 0000000..af03a06 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/DepartureVo.java @@ -0,0 +1,203 @@ +package com.haitonggauto.rtosc.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +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.Date; +import java.util.List; + +@Data +@ApiModel(value = "提离港区",description = "") +public class DepartureVo implements Serializable { + @NotNull(groups = {ValidationGroup.update.class}, message = "编辑时请进场ID不能为空") + @ApiModelProperty(value = "id") + private Long id; + + /** + * 受理号 + */ + @ApiModelProperty(value = "受理号") + @NotBlank(groups = {ValidationGroup.update.class}, message = "受理号不能为空") + private String batchNo; + + /** + * 船名 + */ + @ApiModelProperty(value = "船ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "船ID不能为空") + private String shipId; + + /** + * 船名 + */ + @ApiModelProperty(value = "船名", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "船名不能为空") + private String shipName; + + /** + * 英文船名 + */ + @ApiModelProperty(value = "英文船名") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "英文船名不能为空") + private String shipEnName; + + /** + * 航次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; + + /** + * 港区ID + */ + @ApiModelProperty(value = "港区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 = "港区不能为空") + private String portArea; + + /** + * 贸易类型 + */ + @ApiModelProperty(value = "贸易类型", required = true) + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "贸易类型不能为空") + private String tradType; + + /** + * 收货单位ID + */ + @ApiModelProperty(value = "收货单位ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "收货单位ID不能为空") + private String receiveCompanyId; + + /** + * 收货单位 + */ + @ApiModelProperty(value = "收货单位", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "收货单位不能为空") + private String receiveCompany; + + /** + * 联系人 + */ + @ApiModelProperty(value = "联系人", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "联系人不能为空") + private String contact; + + /** + * 联系方式 + */ + @ApiModelProperty(value = "联系方式", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "联系方式不能为空") + private String contactPhone; + + /** + * 堆放港区ID + */ + @ApiModelProperty(value = "堆放港区ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "堆放港区ID不能为空") + private String retainPortId; + + /** + * 堆放港区 + */ + @ApiModelProperty(value = "堆放港区", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "堆放港区不能为空") + private String retainPort; + + + /** + * 进港日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "进港日期", required = true, example="2023-06-12") + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "进港日期不能为空") + private Date arrivalTime; + + /** + * 提货日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "提货日期", required = true, example="2023-06-12") + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "提货日期不能为空") + private Date deliveryTime; + + /** + * 返回日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "返回日期", required = true, example="2023-06-12") + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "返回日期不能为空") + private Date returnTime; + + /** + * 申请时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "申请时间", hidden = true) + private Date applyTime; + + /** + * 申请人ID + */ + @ApiModelProperty(value = "申请人Id") + private String applicantId; + + /** + * 申请人 + */ + @ApiModelProperty(value = "申请人") + private String applicant; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 事由 + */ + @ApiModelProperty(value = "事由") + private String reason; + + @ApiModelProperty(value = "版本号", hidden = true) + private Integer version; + + @Valid + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "出口海关查验货物必须填!" ) + @Size(min = 1 , message = "提离港区验货物至少要有一个") + private List cargos; + + @Valid + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "出口海关查验司机必须填!" ) + @Size(min = 1 , message = "提离港区司机至少要有一个") + private List drivers; + + @Valid + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "出口海关查验保函必须填!" ) + @Size(min = 1 , message = "提离港区保函至少要有一个") + private List plans; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInCargoVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInCargoVo.java new file mode 100644 index 0000000..0408af6 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInCargoVo.java @@ -0,0 +1,41 @@ +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; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + * 出口进场货物表 + * @TableName customer_export_in_cargo + */ +@Data +@ApiModel(value = "出口进场货物表",description = "") +public class ExportInCargoVo implements Serializable { + + @ApiModelProperty(value = "id") + private Long id; + /** + * 出口进场ID + */ + @ApiModelProperty(value = "出口进场ID", hidden = true) + private Long exportInId; + + @ApiModelProperty(value = "货物类型, 0代表车辆内,1代表备件") + private Integer 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; + + @ApiModelProperty(value = "版本号") + private Integer version; +} \ No newline at end of file diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInCheckDetailVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInCheckDetailVo.java new file mode 100644 index 0000000..9b0e5c0 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInCheckDetailVo.java @@ -0,0 +1,29 @@ +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; +import java.io.Serializable; + +@Data +@ApiModel(value = "出口进场审核",description = "") +public class ExportInCheckDetailVo implements Serializable { + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "进场ID不能为空") + @ApiModelProperty(value = "id") + private Long id; + + @ApiModelProperty(value = "航次ID") + @NotBlank(groups = {ValidationGroup.insert.class}, message = "航次ID不能为空") + private String voyageId; + + /** + * 航次 + */ + @ApiModelProperty(value = "航次") + @NotBlank(groups = {ValidationGroup.insert.class}, message = "航次不能为空") + private String voyage; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInCheckVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInCheckVo.java new file mode 100644 index 0000000..9ccb543 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInCheckVo.java @@ -0,0 +1,50 @@ +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.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel(value = "出口进场审核") +public class ExportInCheckVo implements Serializable { + + @ApiModelProperty(value = "出口进场ID") + @Valid + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "出口进场ID不能为空") + @Size(min = 1, message = "出口进场ID不能为空") + private List ids; + + @ApiModelProperty(value = "审核人ID") +// @NotEmpty(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审核人ID不能为空") + private String checkManId; + + /** + * 审核人 + */ + @ApiModelProperty(value = "审核人") +// @NotEmpty(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审核人不能为空") + private String checkMan; + + /** + * 审核状态 + */ + @ApiModelProperty(value = "审核状态") + @NotNull(groups = {ValidationGroup.insert.class}, message = "审核状态不能为空") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @ApiModelProperty(value = "审核原因") + private String checkResult; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInTimesVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInTimesVo.java new file mode 100644 index 0000000..e656f69 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInTimesVo.java @@ -0,0 +1,48 @@ +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.Future; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + * 出口进场时间表 + * @TableName customer_export_in_times + */ +@Data +@ApiModel(value = "出口进场时间表",description = "") +public class ExportInTimesVo implements Serializable { + @ApiModelProperty(value = "id") + private Long id; + /** + * 出口进场ID + */ + @ApiModelProperty(value = "出口进场ID", hidden = true) + private Long exportInId; + + /** + * 进场时间 + */ + @NotNull(message = "进场时间不能空") + @Future(message = "进场时间必须大于当前时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "进场时间", required = true) + private Date enterTime; + + /** + * 进场数量 + */ + @NotNull(message = "进场数量不能空") + @Min(value = 1, message = "进场数量必须大于0") + @ApiModelProperty(value = "进场数量", required = true) + private Integer enterQuantity; + + @ApiModelProperty(value = "版本号") + private Integer version; +} \ No newline at end of file diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInVo.java new file mode 100644 index 0000000..6892646 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInVo.java @@ -0,0 +1,366 @@ +package com.haitonggauto.rtosc.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.haitonggauto.rtosc.common.utils.ValidationGroup; +import com.haitonggauto.rtosc.common.validate.MoreThan; +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.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * 出口进场基本表 + * + * @TableName customer_export_in + */ +@Data +@ApiModel(value = "出口进场基本表", description = "") +@MoreThan(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, field1 = "quantity", field2 = "eachQuantity", message = "数量不得超过单票件数") +public class ExportInVo implements Serializable { + @NotNull(groups = {ValidationGroup.update.class}, message = "编辑时请进场ID不能为空") + @ApiModelProperty(value = "id") + private Long id; + + /** + * 受理号 + */ + @NotBlank(groups = {ValidationGroup.update.class}, message = "受理号不能为空") + @ApiModelProperty(value = "受理号", required = false) + private String batchNo; + + @ApiModelProperty(value = "船ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "船ID不能为空") + private String shipId; + + /** + * 船名 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "船名不能为空") + @ApiModelProperty(value = "船名", required = true) + private String shipName; + + @ApiModelProperty(value = "英文船名") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "英文船名不能为空") + private String shipEnName; + + /** + * 航次ID + */ + @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 = "航次不能为空") + @ApiModelProperty(value = "航次", required = true) + private String voyage; + + /** + * 港区ID + */ + @ApiModelProperty(value = "港区ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港区ID不能为空") + private String portAreaId; + + /** + * 港区 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港区不能为空") + @ApiModelProperty(value = "港区", required = true) + private String portArea; + +// @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 freight; + /** + * 联系人 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "联系人不能为空") + @ApiModelProperty(value = "联系人", required = true) + private String contact; + + /** + * 联系方式 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "联系人电话号码不能为空") + @ApiModelProperty(value = "联系方式", required = true) + private String contactPhone; + + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "国家ID不能为空") + @ApiModelProperty(value = "国家ID", required = true) + private String countryId; + /** + * 国家 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "国家不能为空") + @ApiModelProperty(value = "国家", required = true) + private String country; + + /** + * 产地ID + */ + @ApiModelProperty(value = "产地ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "产地ID不能为空") + private String originPlaceId; + + /** + * 产地 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "产地不能为空") + @ApiModelProperty(value = "产地", required = true) + private String originPlace; + + /** + * 港口 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港口ID不能为空") + @ApiModelProperty(value = "港口ID", required = true) + private String portId; + + /** + * 港口名称 + */ + @ApiModelProperty(value = "港口名称") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港口名称不能为空") + private String portName; + + /** + * 运输方式ID + */ + @ApiModelProperty(value = "运输方式ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "运输方式ID不能为空") + private String transportWayId; + + /** + * 运输方式 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "运输方式不能为空") + @ApiModelProperty(value = "运输方式", required = true) + private String transportWay; + + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "进场开始时间不能为空") + @ApiModelProperty(value = "进场开始时间", required = true) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date beginEnterTime; + + /** + * 进场开始时间 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "进场结束时间不能为空") + @ApiModelProperty(value = "进场结束时间", required = true) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endEnterTime; + + /** + * 品牌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 = "品牌", required = true) + private String brand; + + /** + * 车型ID + */ + @ApiModelProperty(value = "车型ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车型ID不能为空") + private String cartTypeId; + + /** + * 车型 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车型不能为空") + @ApiModelProperty(value = "车型", required = true) + private String cartType; + + /** + * 车型明细ID + */ + @ApiModelProperty(value = "车型明细ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车型明细ID不能为空") + private String cartTypeDetailId; + + /** + * 车型明细 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车型明细不能为空") + @ApiModelProperty(value = "车型明细", required = true) + private String cartTypeDetail; + + /** + * 型号 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "型号不能为空") + @ApiModelProperty(value = "型号", required = true) + private String models; + + /** + * 数量 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "数量不能为空") + @ApiModelProperty(value = "数量", required = true) + private Integer quantity; + + /** + * 单票重量 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "单票重量不能为空") + @ApiModelProperty(value = "单票重量", required = true) + private BigDecimal eachWeight; + + /** + * 单票数量 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "单票数量不能为空") + @ApiModelProperty(value = "单票数量", required = true) + private Integer eachQuantity; + + /** + * 进场数量 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "进场数量不能为空") + @ApiModelProperty(value = "进场数量", required = true) + private Integer enterQuantity; + + /** + * 单票体积 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "单票体积不能为空") + @ApiModelProperty(value = "单票体积", required = true) + private BigDecimal eachVolume; + + /** + * 体积 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "体积不能为空") + @ApiModelProperty(value = "体积", required = true) + private BigDecimal volume; + + /** + * 长 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "长不能为空") + @ApiModelProperty(value = "长", required = true) + private BigDecimal length; + + /** + * 宽 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "宽不能为空") + @ApiModelProperty(value = "宽", required = true) + private BigDecimal width; + + /** + * 高 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "高不能为空") + @ApiModelProperty(value = "高", required = true) + private BigDecimal height; + + /** + * 重量(吨) + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "重量不能为空") + @ApiModelProperty(value = "重量", required = true) + private BigDecimal weight; + + + /** + * 操作模式ID + */ + @ApiModelProperty(value = "操作模式ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "操作模式ID不能为空") + private String operateTypeId; + + /** + * 操作模式 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "操作模式不能为空") + @ApiModelProperty(value = "操作模式", required = true) + private String operateType; + + /** + * 提单号 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "提单号不能为空") + @ApiModelProperty(value = "提单号", required = true) + private String billNum; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 源类型 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "源类型不能为空") + @ApiModelProperty(value = "源类型", required = true) + private String energyType; + + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "源类型名称不能为空") + @ApiModelProperty(value = "源类型名称", required = true) + private String energyTypeName; + + /** + * 申请人ID + */ + @ApiModelProperty(value = "申请人Id") + private String applicantId; + + /** + * 申请人 + */ + @ApiModelProperty(value = "申请人", required = true) + private String applicant; + + /** + * 申请时间 + */ + @ApiModelProperty(value = "申请时间", required = true) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date applyTime; + + @ApiModelProperty(value = "版本号", required = true) + private Integer version; + + + @Valid + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "货物列表不能为空") + private List cargos; + + @Valid + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "出口进场时间必须填!") + @Size(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, min = 1, message = "出口进场时间至少要有一个") + private List times; + + @Valid + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "备件列表不能为空") + private List spares; + + +} \ No newline at end of file diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInspectCargoVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInspectCargoVo.java new file mode 100644 index 0000000..2fd495e --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInspectCargoVo.java @@ -0,0 +1,72 @@ +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; +import javax.validation.constraints.Size; +import java.io.Serializable; + +@Data +@ApiModel(value = "出口查验货物表") +public class ExportInspectCargoVo implements Serializable { + @ApiModelProperty(value = "id") + private Long id; + /** + * 出口查验ID + */ + @ApiModelProperty(value = "出口查验ID", hidden = true) + private Long exportInspectId; + + /** + * 品牌 + */ + @ApiModelProperty(value = "品牌", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "品牌不能为空") + private String brand; + + @ApiModelProperty(value = "车型ID") +// @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车型ID不能为空") + private String cartTypeId; + + /** + * 车型 + */ + @ApiModelProperty(value = "车型") +// @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车型不能为空") + private String cartType; + + /** + * 车架号 + */ + @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; + + /** + * 区域( 从基础数据获取区道位信息) + */ + @ApiModelProperty(value = "区域", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "区域不能为空") + private String area; + + /** + * 品牌ID + */ + @ApiModelProperty(value = "品牌ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "品牌ID不能为空") + private String brandId; + + /** + * 区域ID + */ + @ApiModelProperty(value = "区域ID") +// @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "区域ID不能为空") + private String areaId; + + @ApiModelProperty(value = "版本号") + private Integer version; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInspectCheckVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInspectCheckVo.java new file mode 100644 index 0000000..a3d8a74 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInspectCheckVo.java @@ -0,0 +1,55 @@ +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.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel(value = "海关查验审核") +public class ExportInspectCheckVo implements Serializable { + + @ApiModelProperty(value = "海关查验ID") + @Valid + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "海关查验ID不能为空") + @Size(min = 1, message = "海关查验ID不能为空") + private List ids; + + @ApiModelProperty(value = "审核人ID") +// @NotEmpty(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审核人ID不能为空") + private String checkManId; + + /** + * 审核人 + */ + @ApiModelProperty(value = "审核人") +// @NotEmpty(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审核人不能为空") + private String checkMan; + + /** + * 审核时间 + */ +// private Date checkTime; + + /** + * 审核状态 + */ + @ApiModelProperty(value = "审核状态") + @NotNull(groups = {ValidationGroup.insert.class}, message = "审核状态不能为空") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @ApiModelProperty(value = "审核原因") + private String checkReason; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInspectVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInspectVo.java new file mode 100644 index 0000000..fabc59b --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportInspectVo.java @@ -0,0 +1,165 @@ +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 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; + +@Data +@ApiModel(value = "出口查验表") +public class ExportInspectVo implements Serializable { + @NotNull(groups = {ValidationGroup.update.class}, message = "编辑时ID不能为空") + @ApiModelProperty(value = "id") + private Long id; + + /** + * 受理号 + */ + @ApiModelProperty(value = "batchNo", required = true) + @NotBlank(groups = {ValidationGroup.update.class}, message = "受理号不能为空") + private String batchNo; + + /** + * 船名 + */ + @ApiModelProperty(value = "船名", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "船名不能为空") + private String shipName; + + /** + * 航次 + */ + @ApiModelProperty(value = "航次", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次不能为空") + private String voyage; + + /** + * 提单号 + */ + @ApiModelProperty(value = "提单号", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "提单号不能为空") + private String billNo; + + /** + * 报关单号 + */ + @ApiModelProperty(value = "passport", required = true) + private String passport; + + /** + * 查验日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "查验日期", required = true) + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "查验日期不能为空") + private Date inspectTime; + + /** + * + */ + @ApiModelProperty(value = "查验车辆数", required = true) + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "查验车辆数不能为空") + private Integer plannedCargoQuantity; + + /** + * 查验备件数 + */ + @ApiModelProperty(value = "查验备件数", required = true) + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "查验备件数不能为空") + private Integer plannedSpareQuantity; + + /** + * 公司名 + */ + @ApiModelProperty(value = "公司名", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "公司名不能为空") + private String company; + + @ApiModelProperty(value = "申请对象ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "申请对象ID不能为空") + private String applyObjId; + + /** + * 申请对象(从基础数据库获取客户类型为进口货代的数据) + */ + @ApiModelProperty(value = "申请对象", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审请对象不能为空") + private String applyObj; + + /** + * 联系人 + */ + @ApiModelProperty(value = "联系人", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "联系人不能为空") + private String contact; + + /** + * 联系电话 + */ + @ApiModelProperty(value = "联系电话", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "联系电话不能为空") + private String contactPhone; + + /** + * 申请人 + */ + @ApiModelProperty(value = "申请人", required = true) + private String applicant; + + /** + * 申请时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "申请时间", required = true) + private Date applyTime; + + /** + * 船名 + */ + @ApiModelProperty(value = "船ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "船ID不能为空") + private String shipId; + + /** + * 英文船名 + */ + @ApiModelProperty(value = "英文船名") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "英文船名不能为空") + private String shipEnName; + + /** + * 航次ID + */ + @ApiModelProperty(value = "航次ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次ID不能为空") + private String voyageId; + + @ApiModelProperty(value = "港区ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港区ID不能为空") + private String portAreaId; + + /** + * 港区 + */ + @ApiModelProperty(value = "港区") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港区不能为空") + private String portArea; + + @ApiModelProperty(value = "版本号") + private Integer version; + + @Valid + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "出口查验表货物必须填!" ) + @Size(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, min = 1 , message = "出口查验表至少要有一个") + private List cargos; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportLoadCargoVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportLoadCargoVo.java new file mode 100644 index 0000000..8deaf1c --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportLoadCargoVo.java @@ -0,0 +1,94 @@ +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; +import javax.validation.constraints.Size; +import java.io.Serializable; + +@Data +@ApiModel(value = "出口装船货物表",description = "") +public class ExportLoadCargoVo implements Serializable { + @ApiModelProperty(value = "id") + private Long id; + + /** + * 受理号 + */ + @ApiModelProperty(value = "受理号", hidden = true) + private String batchNo; + + /** + * 品牌 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "品牌不能为空") + @ApiModelProperty(value = "品牌", required = true) + private String brand; + + /** + * 型号 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "型号不能为空") + @ApiModelProperty(value = "型号", required = true) + private String models; + + /** + * 车架号/条码 + */ + @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; + + /** + * 作业状态(未进港:未收车扫描, 已收车:收车扫描作业完成, 已理货:理货作业完成, 已装船:装船作业完成, 退关:退关扫描完成, 退运:退运扫描完成) + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "作业状态") + @ApiModelProperty(value = "作业状态", required = true) + private String workStatus; + + @ApiModelProperty(value = "版本号") + private Integer version; + + + /** + * 货物类型ID,0代表车辆,1代表备件 + */ + @ApiModelProperty(hidden = true) + private Integer cargoType; + + /** + * 品牌ID + */ + @ApiModelProperty(value = "品牌ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "品牌ID不能为空") + private String brandId; + + /** + * 结算单位ID + */ + @ApiModelProperty(value = "结算单位ID") + private String settleCompId; + + /** + * 结算单位名称 + */ + @ApiModelProperty(value = "结算单位") + private String settleCompName; + + /** + * 联系人 + */ + @ApiModelProperty(value = "联系人") + private String contact; + + /** + * 联系方式 + */ + @ApiModelProperty(value = "联系方式") + private String contactPhone; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportLoadCheckCargoVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportLoadCheckCargoVo.java new file mode 100644 index 0000000..75286fb --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportLoadCheckCargoVo.java @@ -0,0 +1,27 @@ +package com.haitonggauto.rtosc.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel(value = "审核货物列表") +public class ExportLoadCheckCargoVo implements Serializable { + + @ApiModelProperty(value = "货物ID") + @NotNull(message = "货物ID不能为空") + private Long id; + + @ApiModelProperty(value = "匹配结果") + @TableField(value = "result") + private String result; + + @ApiModelProperty(value = "原因") + @TableField(value = "reason") + private String reason; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportLoadCheckVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportLoadCheckVo.java new file mode 100644 index 0000000..28e4b1e --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportLoadCheckVo.java @@ -0,0 +1,65 @@ +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.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel(value = "出口装船审核") +public class ExportLoadCheckVo implements Serializable { + + @ApiModelProperty(value = "船ID") + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "船ID不能为空") + private String shipId; + + @ApiModelProperty(value = "航次ID") + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次ID不能为空") + private String voyageId; + + @ApiModelProperty(value = "审核人ID") +// @NotEmpty(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审核人ID不能为空") + private String checkManId; + + /** + * 审核人 + */ + @ApiModelProperty(value = "审核人") +// @NotEmpty(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审核人不能为空") + private String checkMan; + + /** + * 审核时间 + */ +// private Date checkTime; + + /** + * 审核状态 + */ + @ApiModelProperty(value = "审核状态") + @NotNull(groups = {ValidationGroup.insert.class}, message = "审核状态不能为空") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @ApiModelProperty(value = "审核原因") + private String checkResult; + + @ApiModelProperty(value = "审核拒绝时,没有核验通过的装船ID") + private List ids; + +// @Valid +// @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "出口装船货物必须填!" ) +// @Size(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, min = 1 , message = "出口装船货物至少要有一个") +// private List cargos; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportLoadVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportLoadVo.java new file mode 100644 index 0000000..9191969 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ExportLoadVo.java @@ -0,0 +1,135 @@ +package com.haitonggauto.rtosc.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +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.Date; +import java.util.List; + +@Data +@ApiModel(value = "出口装船表",description = "") +public class ExportLoadVo implements Serializable { + @NotNull(groups = {ValidationGroup.update.class}, message = "编辑时请ID不能为空") + @ApiModelProperty(value = "id") + private Long id; + + /** + * 受理号 + */ + @NotBlank(groups = {ValidationGroup.update.class}, message = "受理号不能为空") + @ApiModelProperty(value = "受理号", required = true) + private String batchNo; + + /** + * 船名 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "船名不能为空") + @ApiModelProperty(value = "船名", required = true) + private String shipName; + + /** + * 航次 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次不能为空") + @ApiModelProperty(value = "航次", required = true) + private String voyage; + + /** + * 提单号 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "提单号不能为空") + @ApiModelProperty(value = "提单号", required = true) + private String billNo; + + /** + * 品牌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 = "品牌", required = true) + private String brand; + + /** + * 数量 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "数量不能为空") + @ApiModelProperty(value = "数量", required = true) + private Integer quantity; + + /** + * 数量 + */ + @ApiModelProperty(value = "备件数", required = true) + private Integer spareQuantity; + + /** + * 申请人 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "申请人不能为空") + @ApiModelProperty(value = "申请人", required = true) + private String applicant; + + + /** + * 贸易类型 + */ + @ApiModelProperty(value = "贸易类型") + private String tradType; + + /** + * 船名 + */ + @ApiModelProperty(value = "船ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "船ID不能为空") + private String shipId; + + /** + * 英文船名 + */ + @ApiModelProperty(value = "英文船名") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "英文船名不能为空") + private String shipEnName; + + /** + * 航次ID + */ + @ApiModelProperty(value = "航次ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次ID不能为空") + private String voyageId; + + /** + * 申请人ID + */ + @ApiModelProperty(value = "申请人Id") + private String applicantId; + + /** + * 申请时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "申请时间不能为空") + @ApiModelProperty(value = "申请时间", required = true) + private Date applyTime; + + @ApiModelProperty(value = "版本号") + private Integer version; + + @Valid + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "出口装船货物必须填!" ) + @Size(min = 1 , message = "出口装船货物至少要有一个") + private List cargos; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/FreeTradeCheckVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/FreeTradeCheckVo.java new file mode 100644 index 0000000..09543fe --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/FreeTradeCheckVo.java @@ -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.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel(value = "特保区审核") +public class FreeTradeCheckVo implements Serializable { + + @ApiModelProperty(value = "特保区ID") + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "特保区ID不能为空") + private List ids; + + @ApiModelProperty(value = "审核人ID") +// @NotEmpty(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审核人ID不能为空") + private String checkManId; + + /** + * 审核人 + */ + @ApiModelProperty(value = "审核人") +// @NotEmpty(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审核人不能为空") + private String checkMan; + + /** + * 审核时间 + */ +// private Date checkTime; + + /** + * 审核状态 + */ + @ApiModelProperty(value = "审核状态") + @NotNull(groups = {ValidationGroup.insert.class}, message = "审核状态不能为空") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @ApiModelProperty(value = "审核原因") + private String checkResult; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/FreeTradeVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/FreeTradeVo.java new file mode 100644 index 0000000..16c0981 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/FreeTradeVo.java @@ -0,0 +1,161 @@ +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; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +@Data +@ApiModel(value = "特保区基本信息表") +public class FreeTradeVo implements Serializable { + @ApiModelProperty(value = "id") + @NotNull(groups = {ValidationGroup.update.class}, message = "编辑时ID不能为空") + private Long id; + + /** + * 批次号 + */ + @ApiModelProperty(value = "批次号", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "批次号不能为空") + private String batchNo; + + /** + * 企业编码 + */ + @ApiModelProperty(value = "企业编码", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "企业编码不能为空") + private String companyCode; + + /** + * 企业社会信用代码 + */ + @ApiModelProperty(value = "企业社会信用代码", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "企业社会信用代码不能为空") + private String companySocialCode; + + /** + * 企业名称 + */ + @ApiModelProperty(value = "企业名称", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "企业名称不能为空") + private String companyName; + + /** + * 国家 + */ + @ApiModelProperty(value = "国家", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "国家不能为空") + private String country; + + /** + * 城市 + */ + @ApiModelProperty(value = "城市", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "城市不能为空") + private String city; + + /** + * 商品料号 + */ + @ApiModelProperty(value = "商品料号", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "商品料号不能为空") + private String cargoItemNo; + + /** + * 商品编码 + */ + @ApiModelProperty(value = "商品编码", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "商品编码不能为空") + private String cargoCode; + + /** + * 商品名称 + */ + @ApiModelProperty(value = "商品名称", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "商品名称不能为空") + private String cargoName; + + /** + * 规格型号 + */ + @ApiModelProperty(value = "规格型号", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "规格型号不能为空") + private String spec; + + /** + * 币制 + */ + @ApiModelProperty(value = "币制", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "币制不能为空") + private String currency; + + /** + * 总价 + */ + @ApiModelProperty(value = "总价", required = true) + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "总价不能为空") + private BigDecimal totalPrice; + + /** + * 净重 + */ + @ApiModelProperty(value = "净重", required = true) + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "净重不能为空") + private Integer netWeight; + + /** + * 申报计量单位 + */ + @ApiModelProperty(value = "申报计量单位", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "申报计量单位不能为空") + private String unitMeasure; + + /** + * 法定单位 + */ + @ApiModelProperty(value = "法定单位", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "法定单位不能为空") + private String unitLegal; + + /** + * 原产国 + */ + @ApiModelProperty(value = "原产国", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "原产国不能为空") + private String originArea; + + /** + * 是否激活 + */ + @ApiModelProperty(value = "是否激活", required = true) + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "是否激活不能为空") + private String isActivate; + + @ApiModelProperty(value = "版本号") + private Integer version; + + /** + * 港区ID + */ + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + /** + * 港区 + */ + @ApiModelProperty(value = "港区") + private String portArea; + + /** + * 车架号 + */ + @ApiModelProperty(value = "车架号") + private String vin; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakeCargoVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakeCargoVo.java new file mode 100644 index 0000000..2ec84e3 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakeCargoVo.java @@ -0,0 +1,89 @@ +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; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel(value = "进口提货货物表",description = "") +public class ImportTakeCargoVo implements Serializable { + @ApiModelProperty(value = "id") + private Long id; + + /** + * 品牌 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "品牌不能为空") + @ApiModelProperty(value = "品牌", required = true) + private String brand; + + /** + * 查验 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "查验不能为空") + @ApiModelProperty(value = "查验", required = true) + private Integer examine; + + /** + * 受理 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "受理不能为空") + @ApiModelProperty(value = "受理", required = true) + private Integer accept; + + /** + * 提单号 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "提单号不能为空") + @ApiModelProperty(value = "提单号", required = true) + private String billNo; + + /** + * 报关单号 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "报关单号不能为空") + @ApiModelProperty(value = "报关单号", required = true) + private String customsNo; + + /** + * 车辆数量 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "车辆数量不能为空") + @ApiModelProperty(value = "车辆数量", required = true) + private Integer carNum; + + /** + * 备件数量 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "备件数量不能为空") + @ApiModelProperty(value = "备件数量", required = true) + private Integer spareNum; + + /** + * 总数 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "总数不能为空") + @ApiModelProperty(value = "总数", required = true) + private Integer totalNum; + + /** + * 货物类型ID,0代表车辆,1代表备件 + */ + @ApiModelProperty(hidden = true) + private Integer cargoType; + + /** + * 品牌ID + */ + @ApiModelProperty(value = "品牌ID") + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "品牌ID不能为空") + private String brandId; + + @ApiModelProperty(value = "版本号") + private Integer version; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakeCheckVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakeCheckVo.java new file mode 100644 index 0000000..0ef581f --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakeCheckVo.java @@ -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.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel(value = "进口提货审核") +public class ImportTakeCheckVo implements Serializable { + + @ApiModelProperty(value = "进口提货ID") + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "进口提货ID不能为空") + private List ids; + + @ApiModelProperty(value = "审核人ID") +// @NotEmpty(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审核人ID不能为空") + private String checkManId; + + /** + * 审核人 + */ + @ApiModelProperty(value = "审核人") +// @NotEmpty(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审核人不能为空") + private String checkMan; + + /** + * 审核时间 + */ +// private Date checkTime; + + /** + * 审核状态 + */ + @ApiModelProperty(value = "审核状态") + @NotNull(groups = {ValidationGroup.insert.class}, message = "审核状态不能为空") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @ApiModelProperty(value = "审核原因") + private String checkResult; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakeJobVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakeJobVo.java new file mode 100644 index 0000000..65f0fe6 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakeJobVo.java @@ -0,0 +1,49 @@ +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; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel(value = "进口提货工作过程表",description = "") +public class ImportTakeJobVo implements Serializable { + @ApiModelProperty(value = "id") + private Long id; + + /** + * 类型 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "类型不能为空") + @ApiModelProperty(value = "类型", required = true) + private Integer jobType; + + /** + * 作业过程 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "作业过程不能为空") + @ApiModelProperty(value = "作业过程", required = true) + private String jobProcess; + + /** + * 作业方式 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "作业方式不能为空") + @ApiModelProperty(value = "作业方式", required = true) + private String jobMode; + + /** + * 使用机械 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "使用机械不能为空") + @ApiModelProperty(value = "使用机械", required = true) + private String jobMachine; + + + @ApiModelProperty(value = "版本号") + private Integer version; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakePrintVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakePrintVo.java new file mode 100644 index 0000000..df301e4 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakePrintVo.java @@ -0,0 +1,94 @@ +package com.haitonggauto.rtosc.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +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.Date; +import java.util.List; + +/** + * 计划号 按照年月日时分秒生成唯一字符串,只生成一次 + * 计划类型 取作业模式下的作业过程字段 + * 作业方式 取作业模式下的作业方式字段 + * 船名 + * 航次 + * 提单号 + * 货名 取作业模式下的类型字段(既有车辆又有备件分开打印,计划号不同) + * 作业日期 + * 件数 + * 重量 取舱单的重量,随车备件没有重量则为空 + * 立方 取舱单的体积,随车备件没有体积则为空 + * 申请单位 取申请对象对应的单位名称 + * 申请人 取申请对象对应的申请人 + * 联系电话 取申请人对应的联系电话 + * 申请说明 显示备注内容 + * 受理人 显示实际受理人姓名 + * 受理时间 显示实际受理时间,精确到秒 + * + */ +@Data +@ApiModel(value = "进口提货小票打印", description = "") +public class ImportTakePrintVo implements Serializable { + /** + * 受理号 + */ + @ApiModelProperty(value = "计划号", required = false) + private String batchNo; + + // 计划类型 + private Integer jobProcess; + + // 作业方式 + private String jobMode; + + /** + * 船名 + */ + @ApiModelProperty(value = "船名", required = true) + private String shipName; + + /** + * 航次 + */ + @ApiModelProperty(value = "航次", required = true) + private String voyage; + + // 提单号 + private String billNo; + + // 货名 + private Integer jobType; + + // 作业日期 + private Date jobTime; + + // 件数 + private Integer takeCarNum; + + // 重量 + + // 立方 + + // 申请单位 + + // 申请人 + private String applicant; + + // 联系电话 + private String phone; + + // 申请说明 + private String remark; + + // 受理人 + + // 受理时间 +} \ No newline at end of file diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakeVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakeVo.java new file mode 100644 index 0000000..09fa61f --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportTakeVo.java @@ -0,0 +1,224 @@ +package com.haitonggauto.rtosc.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +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.Date; +import java.util.List; + +/** + * 出口进场基本表 + * + * @TableName customer_export_in + */ +@Data +@ApiModel(value = "进口提货基本表", description = "") +public class ImportTakeVo implements Serializable { + @NotNull(groups = {ValidationGroup.update.class}, message = "编辑时请进场ID不能为空") + @ApiModelProperty(value = "id") + private Long id; + + /** + * 受理号 + */ + @NotBlank(groups = {ValidationGroup.update.class}, message = "受理号不能为空") + @ApiModelProperty(value = "受理号", required = false) + private String batchNo; + + /** + * 贸易类型 + */ + @NotBlank(groups = {ValidationGroup.update.class, ValidationGroup.insert.class}, message = "贸易类型不能为空") + @ApiModelProperty(value = "贸易类型") + private String tradType; + + /** + * 船名 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "船名不能为空") + @ApiModelProperty(value = "船名", required = true) + private String shipName; + + /** + * 航次 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "航次不能为空") + @ApiModelProperty(value = "航次", required = true) + private String voyage; + + /** + * 港区 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港区不能为空") + @ApiModelProperty(value = "港区", required = true) + private String portArea; + + /** + * 提车总数 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "提车总数不能为空") + @ApiModelProperty(value = "提车总数", required = true) + private Integer takeCarNum; + + /** + * 计划备件数 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "计划备件数不能为空") + @ApiModelProperty(value = "计划备件数", required = true) + private Integer planSpareNum; + + /** + * 计划车辆数 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "计划车辆数不能为空") + @ApiModelProperty(value = "计划车辆数", required = true) + private Integer planCarNum; + + /** + * 货物进场时间 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "货物进场时间不能为空") + @ApiModelProperty(value = "货物进场时间", required = true) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date cargoEnterTime; + + /** + * 船舶到港日期 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "船舶到港日期不能为空") + @ApiModelProperty(value = "船舶到港日期", required = true) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date shipEnterTime; + + /** + * 作业时间 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "作业时间不能为空") + @ApiModelProperty(value = "作业时间", required = true) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date jobTime; + + /** + * 通关性质 + */ + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "通关性质不能为空") + @ApiModelProperty(value = "通关性质", required = true) + private Integer clearanceType; + + /** + * 收货单位 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港区不能为空") + @ApiModelProperty(value = "港区", required = true) + private String consignee; + + /** + * 付款单位 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港区不能为空") + @ApiModelProperty(value = "港区", required = true) + private String payer; + + /** + * 联系人 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港区不能为空") + @ApiModelProperty(value = "港区", required = true) + private String linkMan; + + /** + * 联系电话 + */ + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "港区不能为空") + @ApiModelProperty(value = "港区", required = true) + private String phone; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 申请人 + */ + @ApiModelProperty(value = "申请人", required = true) + private String applicant; + + /** + * 申请时间 + */ + @ApiModelProperty(value = "申请时间", required = true) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date applyTime; + + + /** + * 船名 + */ + @ApiModelProperty(value = "船ID") + @NotBlank(groups = {ValidationGroup.update.class, ValidationGroup.insert.class}, message = "船ID不能为空") + private String shipId; + + /** + * 英文船名 + */ + @ApiModelProperty(value = "英文船名") + @NotBlank(groups = {ValidationGroup.update.class, ValidationGroup.insert.class}, message = "英文船名不能为空") + private String shipEnName; + + /** + * 航次ID + */ + @ApiModelProperty(value = "航次ID") + @NotBlank(groups = {ValidationGroup.update.class, ValidationGroup.insert.class}, message = "航次ID不能为空") + private String voyageId; + + /** + * 港区ID + */ + @ApiModelProperty(value = "港区ID") + @NotBlank(groups = {ValidationGroup.update.class, ValidationGroup.insert.class}, message = "港区ID不能为空") + private String portAreaId; + + /** + * 收货单位ID + */ + @ApiModelProperty(value = "收货单位ID") + @NotBlank(groups = {ValidationGroup.update.class, ValidationGroup.insert.class}, message = "收货单位ID不能为空") + private String consigneeId; + + /** + * 付款单位Id + */ + @ApiModelProperty(value = "付款单位Id") + @NotBlank(groups = {ValidationGroup.update.class, ValidationGroup.insert.class}, message = "付款单位Id不能为空") + private String payerId; + + /** + * 申请人ID + */ + @ApiModelProperty(value = "申请人ID") + private String applicantId; + + @ApiModelProperty(value = "版本号", required = true) + private Integer version; + + @Valid + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "货物列表不能为空") + @Size(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, min = 1, message = "货物列表至少要有一个") + private List cargos; + + @Valid + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "工作过程必须填!") + @Size(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, min = 1, message = "工作过程至少要有一个") + private List jobs; +} \ No newline at end of file diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportUnloadCheckVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportUnloadCheckVo.java new file mode 100644 index 0000000..e6f35bf --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportUnloadCheckVo.java @@ -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.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel(value = "进口卸船审核") +public class ImportUnloadCheckVo implements Serializable { + + @ApiModelProperty(value = "进口卸船ID") + @NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "进口卸船ID不能为空") + private List ids; + + @ApiModelProperty(value = "审核人ID") +// @NotEmpty(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审核人ID不能为空") + private String checkManId; + + /** + * 审核人 + */ + @ApiModelProperty(value = "审核人") +// @NotEmpty(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "审核人不能为空") + private String checkMan; + + /** + * 审核时间 + */ +// private Date checkTime; + + /** + * 审核状态 + */ + @ApiModelProperty(value = "审核状态") + @NotNull(groups = {ValidationGroup.insert.class}, message = "审核状态不能为空") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @ApiModelProperty(value = "审核原因") + private String checkResult; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportVinVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportVinVo.java new file mode 100644 index 0000000..04d4cc6 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ImportVinVo.java @@ -0,0 +1,24 @@ +package com.haitonggauto.rtosc.dto; + +import com.haitonggauto.rtosc.excel.ExportVinExcel; +import io.swagger.annotations.ApiModel; +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; + +@Data +@ApiModel(value = "车架号导入") +public class ImportVinVo implements Serializable { + + @NotNull(message = "出口进场ID不能为空") + private Long id; + + @Valid + @NotNull(message = "车架号列表不能为空") + @Size(min = 1, message = "车架号列表不能为空") + private List data; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/LinkmanVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/LinkmanVo.java new file mode 100644 index 0000000..b184f7a --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/LinkmanVo.java @@ -0,0 +1,58 @@ +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; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel(value = "联系人",description = "") +public class LinkmanVo implements Serializable { + @NotNull(groups = {ValidationGroup.update.class}, message = "联系人ID不能为空") + @ApiModelProperty(value = "id") + private Long id; + + + /** + * 货代 + */ + @ApiModelProperty(value ="货代") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "货代不能为空") + private String freight; + + /** + * 联系人 + */ + @ApiModelProperty(value ="联系人") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "联系人不能为空") + private String contact; + + /** + * 联系方式 + */ + @ApiModelProperty(value ="联系方式") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "联系方式不能为空") + private String contactPhone; + + /** + * 外勤联系人 + */ + @ApiModelProperty(value ="外勤联系人") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "外勤联系人不能为空") + private String fieldContact; + + /** + * 外勤联系方式 + */ + @ApiModelProperty(value ="外勤联系方式") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "外勤联系方式不能为空") + private String fieldContactPhone; + + @ApiModelProperty(value = "版本号", hidden = true) + private Integer version; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/LoginDTO.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/LoginDTO.java new file mode 100644 index 0000000..3fb1627 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/LoginDTO.java @@ -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.NotNull; +import java.io.Serializable; + +@Data +@ApiModel(value ="用户登录") +public class LoginDTO implements Serializable { + + @ApiModelProperty(value = "账号") + @NotNull(message = "账号不能为空") + private String account; + + @ApiModelProperty(value = "密码") + @NotNull(message = "密码不能为空") + private String password; + + @ApiModelProperty(value = "手机号") + @NotNull(message = "手机号不能为空") + private String mobile; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/OrderDTO.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/OrderDTO.java new file mode 100644 index 0000000..61a41d7 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/OrderDTO.java @@ -0,0 +1,35 @@ +package com.haitonggauto.rtosc.dto; + +import com.nuzar.cloud.web.model.QueryModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import lombok.Data; +import lombok.ToString; + +@ToString +@Data +public class OrderDTO extends QueryModel { + private Long id; + + @ApiModelProperty(value = "用户编号", required = true) + @Size(max = 20) + @NotBlank(message = "用户编号不能为空") + private String userId; + + private String commodityCode; + + @ApiModelProperty(value = "金额", required = true) + @Size(max = 20) + @NotNull(message = "金额不能为空") + private Integer count; + + private Integer money; + + private String status; + + private String createTime; + + private String updateTime; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ShipVoyageVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ShipVoyageVo.java new file mode 100644 index 0000000..2cc8efe --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/ShipVoyageVo.java @@ -0,0 +1,41 @@ +package com.haitonggauto.rtosc.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel(value = "船名航次列表") +public class ShipVoyageVo implements Serializable { + /** + * 船名 + */ + @ApiModelProperty(value = "船ID") + private String shipId; + + /** + * 中文船名 + */ + @ApiModelProperty(value = "中文船名") + private String shipName; + + /** + * 英文船名 + */ + @ApiModelProperty(value = "英文船名") + private String shipEnName; + + /** + * 航次ID + */ + @ApiModelProperty(value = "航次ID") + private String voyageId; + + /** + * 航次 + */ + @ApiModelProperty(value = "航次") + private String voyage; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/UpdateShipVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/UpdateShipVo.java new file mode 100644 index 0000000..a6c799c --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/UpdateShipVo.java @@ -0,0 +1,39 @@ +package com.haitonggauto.rtosc.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +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; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +@Data +@ApiModel(value = "批量修改船名、航次") +public class UpdateShipVo implements Serializable { + + /** + * 船名 + */ + @ApiModelProperty(value = "计划ID") + @NotBlank(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "计划ID不能为空") + private Long id; + + /** + * 航次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; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/WorkStatusVo.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/WorkStatusVo.java new file mode 100644 index 0000000..42af80a --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/WorkStatusVo.java @@ -0,0 +1,31 @@ +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 = "工作状态",description = "") +public class WorkStatusVo implements Serializable { + + /** + * 受理号 + */ + @ApiModelProperty(value = "工作状态") + @NotBlank(groups = {ValidationGroup.update.class}, message = "工作状态不能为空") + private String workStatus; + + @Valid + @NotNull(groups = {ValidationGroup.update.class}, message = "车架号不能为空!" ) + @Size(min = 1 , message = "车架号至少要有一个") + private List vins; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/WsnetUser.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/WsnetUser.java new file mode 100644 index 0000000..b0eb800 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/dto/WsnetUser.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.dto; + +import com.haitonggauto.rtosc.common.dto.LoginUser; +import lombok.Data; + +@Data +public class WsnetUser extends LoginUser { + private String username; // 用户名称 + + private Long customerId; // 客户ID + + private String customerName; // 客户名称 +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/enums/OrderStatusEnum.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/enums/OrderStatusEnum.java new file mode 100644 index 0000000..786980f --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/enums/OrderStatusEnum.java @@ -0,0 +1,47 @@ +package com.haitonggauto.rtosc.enums; + +/** + * + */ +public enum OrderStatusEnum { + INIT("INIT","初始状态"), + PAID("PAID","已支付"), + + DELIVERED("DELIVERED","已发货"), + + RECEIVED("RECEIVED","已收货"), + + CANCELED("CANCELED","交易取消"); + + + private String code; + + private String value; + + OrderStatusEnum(String code,String value){ + this.code = code; + this.value = value; + } + + public String getCode() { + return code; + } + + public String getValueByCode(String code) { + for (OrderStatusEnum statusEnum : OrderStatusEnum.values()) { + if(statusEnum.getCode().equals(code)){ + return statusEnum.value; + } + } + return null; + } + + public OrderStatusEnum getByCode(String code){ + for (OrderStatusEnum statusEnum : OrderStatusEnum.values()) { + if(statusEnum.getCode().equals(code)){ + return statusEnum; + } + } + return null; + } +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportInExcel.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportInExcel.java new file mode 100644 index 0000000..93eaf1a --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportInExcel.java @@ -0,0 +1,227 @@ +package com.haitonggauto.rtosc.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 出口进场基本表 + * @TableName customer_export_in + */ +@Data +public class ExportInExcel { + + /** + * 受理号 + */ + @ExcelProperty("受理号") + private String batchNo; + + /** + * 船名 + */ + @ExcelProperty("船名") + private String shipName; + + /** + * 航次 + */ + @ExcelProperty("航次") + private String voyage; + + /** + * 港区 + */ + @ExcelProperty("港区") + private String portArea; + + /** + * 联系人 + */ + @ExcelProperty("联系人") + private String contact; + + /** + * 联系方式 + */ + @ExcelProperty("联系方式") + private String contactPhone; + + /** + * 国家 + */ + @ExcelProperty("国家") + private String country; + + /** + * 港口 + */ + @ExcelProperty("港口") + private String portName; + + /** + * 运输方式 + */ + @ExcelProperty("运输方式") + private String transportWay; + + /** + * 进场时间 + */ + @ExcelProperty("进场时间") + private String enterTime; + + /** + * 品牌 + */ + @ExcelProperty("品牌") + private String brand; + + /** + * 车型 + */ + @ExcelProperty("车型") + private String cartType; + + /** + * 车型明细 + */ + @ExcelProperty("车型明细") + private String cartTypeDetail; + + /** + * 型号 + */ + @ExcelProperty("型号") + private String models; + + /** + * 数量 + */ + @ExcelProperty("数量") + private Integer quantity; + + @ExcelProperty("进场数量") + private Integer enterQuantity; + + /** + * 单票重量 + */ + @ExcelProperty("单票重量(吨)") + private BigDecimal eachWeight; + + /** + * 单票数量 + */ + @ExcelProperty("单票件数") + private Integer eachQuantity; + + /** + * 单票体积 + */ + @ExcelProperty("单票体积") + private BigDecimal eachVolume; + + /** + * 体积 + */ + @ExcelProperty("体积") + private BigDecimal volume; + + /** + * 长 + */ + @ExcelProperty("长") + private Integer length; + + /** + * 宽 + */ + @ExcelProperty("宽") + private Integer width; + + /** + * 高 + */ + @ExcelProperty("高") + private Integer height; + + /** + * 重量(吨) + */ + @ExcelProperty("重量(吨)") + private Integer weight; + + /** + * 操作模式 + */ + @ExcelProperty("操作模式") + private String operateType; + + /** + * 操作模式 + */ + @ExcelProperty("货代") + private String freight; + + /** + * 提单号 + */ + @ExcelProperty("提单号") + private String billNum; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String remark; + + /** + * 源类型 + */ + @ExcelProperty("源类型") + private String energyTypeName; + + @ExcelProperty("产地") + private String originPlace; +// /** +// * 申请人 +// */ +// @ExcelProperty("申请人") +// private String applicant; +// +// /** +// * 申请时间 +// */ +// @ExcelProperty("申请时间") +// private Date applyTime; +// +// /** +// * 审核人 +// */ +// @ExcelProperty("审核人") +// private String checkMan; +// +// /** +// * 审核时间 +// */ +// @ExcelProperty("审核时间") +// private Date checkTime; +// +// /** +// * 审核状态 +// */ +// @ExcelProperty("审核状态") +// private String checkStatus; +// +// /** +// * 审核原因 +// */ +// @ExcelProperty("审核原因") +// private String checkResult; + +} \ No newline at end of file diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportInPlanExcel.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportInPlanExcel.java new file mode 100644 index 0000000..7b83803 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportInPlanExcel.java @@ -0,0 +1,240 @@ +package com.haitonggauto.rtosc.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.alibaba.excel.annotation.format.NumberFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 导入说明: + * 1.港区必须是基础数据的港区,否则导入不成功 + * 2.船名必须是基础数据的船名,否则导入不成功 + * 3.航次必须是HT6、HTTC、HTLG,否则导入不成功 + * 4.联系方式必须要校验手机号是否正确,不正确导入不成功 + * 5.港口必须是基础数据的港口,否则导入不成功 + * 6.运输方式必须是板车运输、商品车自开、驳船,否则导入不成功 + * 7.进场时间格式为2023-09-08 12:00,否则导入不成功 + * 8.进场数量:必须是整数,否则导入不成功 + * 9.单票件数必须是整数,否则导入不成功 + * 10.单票体积最多四位小数,否则导入不成功 + * 11.单票重量最多四位小数,否则导入不成功 + * 12.品牌必须是基础数据的品牌,否则导入不成功 + * 13.车型必须是基础数据的车型,否则导入不成功 + * 14.车型明细必须是和车型关联的车型明细,否则导入不成功 + * 15.产地必须是基础数据的城市否则导入不成功 + * 16.数量必须是整数,否则导入不成功 + * 17.长、宽、高、重量最多保留四位小数,否则导入不成功 + * 18.操作模式:如果是车辆为港机作业,客户自开,如果是备件为铲车、吊车、浮吊,否则导入不成功 + * 19.源类型必须是是新能源、不是新能源,否则的导入不成功 + */ +@Data +public class ExportInPlanExcel { + + /** + * 港区 + */ + @ExcelProperty("*港区") + @NotBlank(message = "港区不能为空") + private String portArea; + + /** + * 船名 + */ + @ExcelProperty("*船名") + @NotBlank(message = "船名不能为空") + private String shipName; + + /** + * 航次 + */ + @ExcelProperty("*航次") + @NotBlank(message = "航次不能为空") + private String voyage; + + + /** + * 货代 + */ + @ExcelProperty("*货代") + @NotBlank(message = "货代不能为空") + private String freight; + + + /** + * 联系人 + */ + @ExcelProperty("*联系人") + @NotBlank(message = "联系人不能为空") + private String contact; + + /** + * 联系方式 + */ + @ExcelProperty("*联系方式") + @NotBlank(message = "联系方式不能为空") + private String contactPhone; + + /** + * 港口 + */ + @ExcelProperty("*港口") + @NotBlank(message = "港口不能为空") + private String portName; + + /** + * 运输方式 + */ + @ExcelProperty("*运输方式") + @NotBlank(message = "运输方式不能为空") + private String transportWay; + + /** + * 进场时间 + */ +// @DateTimeFormat("yyyy-MM-dd HH:mm") + @ExcelProperty("*进场时间") + @NotNull(message = "进场时间不能为空") + private String enterTime; + + /** + * 进场数量 + */ + @ExcelProperty("*进场数量") + @NotNull(message = "进场数量不能为空") + private Integer enterQuantity; + + /** + * 提单号 + */ + @ExcelProperty("*提单号") + @NotBlank(message = "提单号不能为空") + private String billNum; + + /** + * 单票数量 + */ + @ExcelProperty("*单票件数") + @NotNull(message = "单票件数不能为空") + private Integer eachQuantity; + +// /** +// * 单票件数 +// */ +// @ExcelProperty("单票件数") +// @NotNull(message = "单票件数不能为空") +// private Integer eachPieces; + + /** + * 单票体积 + */ + @ExcelProperty("*单票体积") + @NotNull(message = "单票体积不能为空") + @NumberFormat("#.####") + private BigDecimal eachVolume; + + /** + * 单票重量 + */ + @ExcelProperty("*单票重量(吨)") + @NotNull(message = "单票重量不能为空") + @NumberFormat("#.####") + private BigDecimal eachWeight; + + /** + * 品牌 + */ + @ExcelProperty("*品牌") + @NotBlank(message = "品牌不能为空") + private String brand; + + /** + * 车型 + */ + @ExcelProperty("*车型") + @NotBlank(message = "车型不能为空") + private String cartType; + + /** + * 车型明细 + */ + @ExcelProperty("*车型明细") + @NotBlank(message = "车型明细不能为空") + private String cartTypeDetail; + + /** + * 型号 + */ + @ExcelProperty("*型号") + @NotBlank(message = "型号不能为空") + private String models; + + /** + * 产地 + */ + @ExcelProperty("*产地") + @NotBlank(message = "产地不能为空") + private String originPlace; + + /** + * 数量 + */ + @ExcelProperty("*数量") + @NotNull(message = "数量不能为空") + private Integer quantity; + + /** + * 长 + */ + @ExcelProperty("*长") + @NotNull(message = "长不能为空") + @NumberFormat("#.####") + private BigDecimal length; + + /** + * 宽 + */ + @ExcelProperty("*宽") + @NotNull(message = "宽不能为空") + @NumberFormat("#.####") + private BigDecimal width; + + /** + * 高 + */ + @ExcelProperty("*高") + @NotNull(message = "高不能为空") + @NumberFormat("#.####") + private BigDecimal height; + + /** + * 重量(吨) + */ + @ExcelProperty("*重量(吨)") + @NotNull(message = "重量不能为空") + @NumberFormat("#.####") + private BigDecimal weight; + + @ExcelProperty("*体积") + @ApiModelProperty(value = "体积") + private BigDecimal volume; + + /** + * 操作模式 + */ + @ExcelProperty("*操作模式") + @NotBlank(message = "操作模式不能为空") + private String operateType; + + /** + * 源类型 + */ + @ExcelProperty("*源类型") + @NotBlank(message = "源类型不能为空") + private String energyTypeName; +} \ No newline at end of file diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportInVinExportExcel.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportInVinExportExcel.java new file mode 100644 index 0000000..ad77338 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportInVinExportExcel.java @@ -0,0 +1,55 @@ +package com.haitonggauto.rtosc.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +/** + * 出口进场货物名比较喜欢导出 + * @TableName customer_export_in + */ +@Data +public class ExportInVinExportExcel { + + /** + * 受理号 + */ + @ExcelProperty("序号") + private Integer serialNo; + + /** + * 船名 + */ + @ExcelProperty("船名") + private String shipName; + + /** + * 航次 + */ + @ExcelProperty("航次") + private String voyage; + + /** + * 提单号 + */ + @ExcelProperty("提单号") + private String billNum; + + /** + * 品牌 + */ + @ExcelProperty("品牌") + private String brand; + + /** + * 型号 + */ + @ExcelProperty("型号") + private String models; + + /** + * 车架号 + */ + @ExcelProperty("车架号") + private String vin; + +} \ No newline at end of file diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportLoadExcel.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportLoadExcel.java new file mode 100644 index 0000000..edcf74b --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportLoadExcel.java @@ -0,0 +1,36 @@ +package com.haitonggauto.rtosc.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +@Data +public class ExportLoadExcel { + + @ExcelProperty("*船名") + @NotBlank(message = "船名不能为空") + private String shipName; + + @ExcelProperty("*航次") + @NotBlank(message = "航次不能为空") + private String voyage; + + @ExcelProperty("*提单号") + @NotBlank(message = "提单号不能为空") + private String billNo; + + @ExcelProperty("*品牌") + @NotBlank(message = "品牌不能为空") + private String brand; + + @ExcelProperty("*型号") + @NotBlank(message = "型号不能为空") + private String models; + + @ExcelProperty("*车架号") + @NotBlank(message = "车架号不能为空") + @Size(min = 17, max = 17, message = "车架号长度为17位") + private String vin; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportLoadInsideExcel.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportLoadInsideExcel.java new file mode 100644 index 0000000..8235ecd --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportLoadInsideExcel.java @@ -0,0 +1,55 @@ +package com.haitonggauto.rtosc.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +@Data +public class ExportLoadInsideExcel { + + @ExcelProperty("*船名") + @NotBlank(message = "船名不能为空") + private String shipName; + + @ExcelProperty("*航次") + @NotBlank(message = "航次不能为空") + private String voyage; + + @ExcelProperty("*港区") + @NotBlank(message = "港区不能为空") + private String portArea; + + @ExcelProperty("*提单号") + @NotBlank(message = "提单号不能为空") + private String billNo; + + @ExcelProperty("*品牌") + @NotBlank(message = "品牌不能为空") + private String brand; + + @ExcelProperty("*目的港") + private String destPort; + + @ExcelProperty("*车架号") + @NotBlank(message = "车架号不能为空") + @Size(min = 17, max = 17, message = "车架号长度为17位") + private String vin; + + @ExcelProperty("*结算单位") + @ApiModelProperty(value = "结算单位") + @NotBlank(message = "结算单位不能为空") + private String settleCompName; + + @ExcelProperty("*联系人") + @ApiModelProperty(value = "联系人") + @NotBlank(message = "联系人不能为空") + private String contact; + + @ExcelProperty("*联系方式") + @ApiModelProperty(value = "联系方式") + @NotBlank(message = "联系方式不能为空") + private String contactPhone; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportLoadInsideSpareExcel.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportLoadInsideSpareExcel.java new file mode 100644 index 0000000..2661f18 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportLoadInsideSpareExcel.java @@ -0,0 +1,49 @@ +package com.haitonggauto.rtosc.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +@Data +public class ExportLoadInsideSpareExcel { + + @ExcelProperty("船名") + @NotBlank(message = "船名不能为空") + private String shipName; + + @ExcelProperty("航次") + @NotBlank(message = "航次不能为空") + private String voyage; + + @ExcelProperty("提单号") + @NotBlank(message = "提单号不能为空") + private String billNo; + + @ExcelProperty("品牌") + @NotBlank(message = "品牌不能为空") + private String brand; + + @ExcelProperty("数量") + @NotNull(message = "数量不能为空") + @Min(value = 1, message = "数量必须大于0") + private Integer num; + + @ExcelProperty("结算单位") + @ApiModelProperty(value = "结算单位") + @NotBlank(message = "结算单位不能为空") + private String settleCompName; + + @ExcelProperty("联系人") + @ApiModelProperty(value = "联系人") + @NotBlank(message = "联系人不能为空") + private String contact; + + @ExcelProperty("联系方式") + @ApiModelProperty(value = "联系方式") + @NotBlank(message = "联系方式不能为空") + private String contactPhone; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportLoadSpareExcel.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportLoadSpareExcel.java new file mode 100644 index 0000000..8f35a5b --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportLoadSpareExcel.java @@ -0,0 +1,33 @@ +package com.haitonggauto.rtosc.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +@Data +public class ExportLoadSpareExcel { + + @ExcelProperty("*船名") + @NotBlank(message = "船名不能为空") + private String shipName; + + @ExcelProperty("*航次") + @NotBlank(message = "航次不能为空") + private String voyage; + + @ExcelProperty("*提单号") + @NotBlank(message = "提单号不能为空") + private String billNo; + + @ExcelProperty("*品牌") + @NotBlank(message = "品牌不能为空") + private String brand; + + @ExcelProperty("*数量") + @NotNull(message = "数量不能为空") + private Integer num; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportVinExcel.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportVinExcel.java new file mode 100644 index 0000000..070e7bd --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ExportVinExcel.java @@ -0,0 +1,37 @@ +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.Size; + + +/** + * 出口进场基本表 + * @TableName customer_export_in + */ +@Data +@ApiModel +public class ExportVinExcel { + + /** + * 受理号 + */ + @ApiModelProperty(value = "提单号") + @NotBlank(message = "提单号不能为空") + @ExcelProperty("*提单号") + private String billNo; + + /** + * 船名 + */ + @NotBlank(message = "车架号不能为空") + @Size(min = 17, max = 17, message = "车架号长度为17位") + @ApiModelProperty(value = "车架号") + @ExcelProperty("*车架号") + private String vin; + +} \ No newline at end of file diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/FreeTradeExcel.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/FreeTradeExcel.java new file mode 100644 index 0000000..1180e11 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/FreeTradeExcel.java @@ -0,0 +1,121 @@ +package com.haitonggauto.rtosc.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.TableField; +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.math.BigDecimal; + +@Data +@ApiModel +public class FreeTradeExcel { + /** + * 港区 + */ + @NotBlank(message = "港区不能为空") + @ExcelProperty("*港区") + @ApiModelProperty(value = "港区") + private String portArea; + + // 批次号 + @ApiModelProperty(value = "批次号") + @NotBlank(message = "批次号不能为空") + @ExcelProperty("批次号") + private String batchNo; + + // 企业编码 + @ApiModelProperty(value = "企业编码") + @NotBlank(message = "企业编码不能为空") + @ExcelProperty("*企业编码") + private String companyCode; + + // 企业社会信用代码 + @ApiModelProperty(value = "企业社会信用代码") + @NotBlank(message = "企业社会信用代码不能为空") + @ExcelProperty("*企业社会信用代码") + private String companySocialCode; + + // 企业名称 + @ApiModelProperty(value = "企业名称") + @NotBlank(message = "企业名称不能为空") + @ExcelProperty("*企业名称") + private String companyName; + + // 企业所在国家 + @ApiModelProperty(value = "企业所在国家") + @NotBlank(message = "企业所在国家不能为空") + @ExcelProperty("*企业所在国家") + private String country; + + // 企业所在城市 + @ApiModelProperty(value = "企业所在城市") + @NotBlank(message = "企业所在城市不能为空") + @ExcelProperty("*企业所在城市") + private String city; + + // 商品料号 + @ApiModelProperty(value = "商品料号") + @NotBlank(message = "商品料号不能为空") + @ExcelProperty("*商品料号") + private String cargoCode; + + // 商品名称 + @ApiModelProperty(value = "商品名称") + @NotBlank(message = "商品名称不能为空") + @ExcelProperty("*商品名称") + private String cargoName; + + // 规格型号 + @ApiModelProperty(value = "规格型号") + @NotBlank(message = "规格型号不能为空") + @ExcelProperty("*规格型号") + private String spec; + + // 币制 + @ApiModelProperty(value = "币制") + @NotBlank(message = "币制不能为空") + @ExcelProperty("*币制") + private String currency; + + // 总价 + @ApiModelProperty(value = "总价") + @NotNull(message = "总价不能为空") + @ExcelProperty("*总价") + private BigDecimal totalPrice; + + // 净重 + @ApiModelProperty(value = "净重") + @NotNull(message = "净重不能为空") + @ExcelProperty("*净重") + private BigDecimal netWeight; + + // 申报计量单位 + @ApiModelProperty(value = "申报计量单位") + @NotBlank(message = "申报计量单位不能为空") + @ExcelProperty("*申报计量单位") + private String unitMeasure; + + // 法定单位 + @ApiModelProperty(value = "法定单位") + @NotBlank(message = "法定单位不能为空") + @ExcelProperty("*法定单位") + private String unitLegal; + + // 原产国(地区) + @ApiModelProperty(value = "原产国") + @NotBlank(message = "原产国不能为空") + @ExcelProperty("*原产国(地区)") + private String originArea; + + // 车架号 + @ApiModelProperty(value = "车架号") + @NotBlank(message = "车架号不能为空") + @Size(min = 17, max = 17, message = "车架号长度为17位") + @ExcelProperty("*车架号") + private String vin; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/FreeTradeExportExcel.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/FreeTradeExportExcel.java new file mode 100644 index 0000000..8976e60 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/FreeTradeExportExcel.java @@ -0,0 +1,114 @@ +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.Size; +import java.math.BigDecimal; + +@Data +@ApiModel +public class FreeTradeExportExcel { + @ExcelProperty("ID") + private String id; + + // 批次号 + @ApiModelProperty(value = "批次号") + @ExcelProperty("批次号") + private String batchNo; + + // 车架号 + @ApiModelProperty(value = "车架号") + @ExcelProperty("车架号") + private String vin; + + // 导入日期 + @ExcelProperty("导入日期") + private String createDate; + + // 导入人 + @ExcelProperty("导入人") + private String createBy; + + // 企业编码 + @ApiModelProperty(value = "企业编码") + @ExcelProperty("企业编码") + private String companyCode; + + // 企业社会信用代码 + @ApiModelProperty(value = "企业社会信用代码") + @ExcelProperty("企业社会信用代码") + private String companySocialCode; + + // 企业名称 + @ApiModelProperty(value = "企业名称") + @ExcelProperty("企业名称") + private String companyName; + + // 企业所在国家 + @ApiModelProperty(value = "企业所在国家") + @ExcelProperty("企业所在国家") + private String country; + + // 企业所在城市 + @ApiModelProperty(value = "企业所在城市") + @ExcelProperty("企业所在城市") + private String city; + + // 商品料号 + @ApiModelProperty(value = "商品料号") + @ExcelProperty("商品料号") + private String cargoCode; + + // 商品名称 + @ApiModelProperty(value = "商品名称") + @ExcelProperty("商品名称") + private String cargoName; + + // 规格型号 + @ApiModelProperty(value = "规格型号") + @ExcelProperty("规格型号") + private String spec; + + // 币制 + @ApiModelProperty(value = "币制") + @ExcelProperty("币制") + private String currency; + + // 总价 + @ApiModelProperty(value = "总价") + @ExcelProperty("总价") + private BigDecimal totalPrice; + + // 净重 + @ApiModelProperty(value = "净重") + @ExcelProperty("净重") + private BigDecimal netWeight; + + // 申报计量单位 + @ApiModelProperty(value = "申报计量单位") + @ExcelProperty("申报计量单位") + private String unitMeasure; + + // 法定单位 + @ApiModelProperty(value = "法定单位") + @ExcelProperty("法定单位") + private String unitLegal; + + // 原产国(地区) + @ApiModelProperty(value = "原产国") + @ExcelProperty("原产国(地区)") + private String originArea; + + @ExcelProperty("是否激活") + private String isActivate; + + @ExcelProperty("操作人") + private String operator; + + @ExcelProperty("操作日期") + private String exportDate; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ImportUnloadExcel.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ImportUnloadExcel.java new file mode 100644 index 0000000..23ac159 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ImportUnloadExcel.java @@ -0,0 +1,36 @@ +package com.haitonggauto.rtosc.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +@Data +public class ImportUnloadExcel { + + @ExcelProperty("*船名") + @NotBlank(message = "船名不能为空") + private String shipName; + + @ExcelProperty("*航次") + @NotBlank(message = "航次不能为空") + private String voyage; + + @ExcelProperty("*提单号") + @NotBlank(message = "提单号不能为空") + private String billNo; + + @ExcelProperty("*品牌") + @NotBlank(message = "品牌不能为空") + private String brand; + + @ExcelProperty("*型号") + @NotBlank(message = "型号不能为空") + private String models; + + @ExcelProperty("*车架号") + @NotBlank(message = "车架号不能为空") + @Size(min = 17, max = 17, message = "车架号长度为17位") + private String vin; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ImportUnloadSpareExcel.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ImportUnloadSpareExcel.java new file mode 100644 index 0000000..71e7b02 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/excel/ImportUnloadSpareExcel.java @@ -0,0 +1,32 @@ +package com.haitonggauto.rtosc.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +@Data +public class ImportUnloadSpareExcel { + + @ExcelProperty("*船名") + @NotBlank(message = "船名不能为空") + private String shipName; + + @ExcelProperty("*航次") + @NotBlank(message = "航次不能为空") + private String voyage; + + @ExcelProperty("*提单号") + @NotBlank(message = "提单号不能为空") + private String billNo; + + @ExcelProperty("*品牌") + @NotBlank(message = "品牌不能为空") + private String brand; + + @ExcelProperty("*数量") + @NotNull(message = "数量不能为空") + private Integer num; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/CargoQuery.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/CargoQuery.java new file mode 100644 index 0000000..83a677c --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/CargoQuery.java @@ -0,0 +1,14 @@ +package com.haitonggauto.rtosc.query; + +import com.haitonggauto.rtosc.common.db.query.BaseQuery; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "货物明细查询") +public class CargoQuery extends BaseQuery { + @ApiModelProperty(value = "货物类型, 0代表车辆,1代表备件") + private Integer cargoType; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/DepartureQuery.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/DepartureQuery.java new file mode 100644 index 0000000..34e2e22 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/DepartureQuery.java @@ -0,0 +1,55 @@ +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; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +@ApiModel +public class DepartureQuery extends BaseQuery { + @ApiModelProperty(value = "受理号") + @DbQuery(symbol = SqlSymbol.LIKE) + private String batchNo; + + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "开始申请时间") + @DbQuery(field = "applyTime", symbol = SqlSymbol.GTE) + private Date beginApplyTime; + + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "结束申请时间") + @DbQuery(field = "applyTime", symbol = SqlSymbol.LTE) + private Date endApplyTime; + + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + @ApiModelProperty(value = "审核状态", hidden = true) + @DbQuery(field = "checkStatus", symbol = SqlSymbol.IN) + private List checkStatusList; + + @ApiModelProperty(value = "贸易类型") + private String tradType; + + @ApiModelProperty(value = "受理号") + @DbQuery(field = "batchNo", symbol = SqlSymbol.IN) + private List batchNos; + + @ApiModelProperty(value = "收货单位ID") + private String receiveCompanyId; + + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + @ApiModelProperty(hidden = true) + // 明细表查询时会用到 + private Long departureId; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInCheckQuery.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInCheckQuery.java new file mode 100644 index 0000000..afd7614 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInCheckQuery.java @@ -0,0 +1,83 @@ +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; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +@ApiModel(value = "出口进场查询") +public class ExportInCheckQuery extends BaseQuery { + + @ApiModelProperty(value = "船名") + @DbQuery(field = "shipId") + private String shipName; + + @ApiModelProperty(value = "航次ID") + private String voyageId; + + @ApiModelProperty(value = "航次") + private String voyage; + + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "开始进场时间") + @DbQuery(field = "applyTime", symbol = SqlSymbol.GTE) + private Date beginEnterTime; + + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "结束进场时间") + @DbQuery(field = "applyTime", symbol = SqlSymbol.LTE) + private Date endEnterTime; + + @ApiModelProperty(value = "贸易类型") + private String tradType; + + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + @ApiModelProperty(value = "审核状态", hidden = true) + @DbQuery(field = "checkStatus", symbol = SqlSymbol.IN) + private List checkStatusList; + + @ApiModelProperty(value = "品牌") + @DbQuery(field = "brandId") + private String brand; + + @ApiModelProperty(value = "车型") + @DbQuery(field = "cartTypeId") + private String cartType; + + @ApiModelProperty(value = "车型明细") + @DbQuery(field = "cartTypeDetailId") + private String cartTypeDetail; + + @ApiModelProperty(value = "提单号") + @DbQuery(symbol = SqlSymbol.LIKE) + private String billNum; + + @ApiModelProperty(value = "受理号") + @DbQuery(symbol = SqlSymbol.LIKE) + private String batchNo; + + @ApiModelProperty(value = "型号") + private String models; + + @ApiModelProperty(hidden = true) + @DbQuery(field = "vin", symbol = SqlSymbol.IN) + private List vins; + + // 明细表查询时会用到 + @ApiModelProperty(hidden = true) + private Long exportInId; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInQuery.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInQuery.java new file mode 100644 index 0000000..c8e08a5 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInQuery.java @@ -0,0 +1,73 @@ +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; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +@ApiModel(value = "出口进场查询") +public class ExportInQuery extends BaseQuery { + + @ApiModelProperty(value = "船名") + private String shipName; + + @ApiModelProperty(value = "航次") + private String voyage; + + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "开始进场时间") + @DbQuery(field = "applyTime", symbol = SqlSymbol.GTE) + private Date beginEnterTime; + + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "结束进场时间") + @DbQuery(field = "applyTime", symbol = SqlSymbol.LTE) + private Date endEnterTime; + + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + @ApiModelProperty(value = "审核状态", hidden = true) + @DbQuery(field = "checkStatus", symbol = SqlSymbol.IN) + private List checkStatusList; + + @ApiModelProperty(value = "品牌") + private String brand; + + @ApiModelProperty(value = "车型") + private String cartType; + + @ApiModelProperty(value = "车型明细") + private String cartTypeDetail; + + @ApiModelProperty(value = "提单号") + @DbQuery(symbol = SqlSymbol.LIKE) + private String billNum; + + @ApiModelProperty(value = "受理号") + @DbQuery(symbol = SqlSymbol.LIKE) + private String batchNo; + + @ApiModelProperty(value = "型号") + private String models; + + @ApiModelProperty(hidden = true) + @DbQuery(field = "vin", symbol = SqlSymbol.IN) + private List vins; + + // 明细表查询时会用到 + @ApiModelProperty(hidden = true) + private Long exportInId; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInspectCheckQuery.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInspectCheckQuery.java new file mode 100644 index 0000000..0f96a71 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInspectCheckQuery.java @@ -0,0 +1,46 @@ +package com.haitonggauto.rtosc.query; + +import com.haitonggauto.rtosc.common.db.anno.DbQuery; +import com.haitonggauto.rtosc.common.db.enums.SqlSymbol; +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 java.util.List; + +@Data +@ApiModel(value = "海关查验查询") +public class ExportInspectCheckQuery extends BaseQuery { + + @ApiModelProperty(value = "船名") + @DbQuery(field = "shipId") + private String shipName; + + @ApiModelProperty(value = "航次ID") + private String voyageId; + + @ApiModelProperty(value = "航次") + private String voyage; + + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + @ApiModelProperty(value = "审核状态", hidden = true) + @DbQuery(field = "checkStatus", symbol = SqlSymbol.IN) + private List checkStatusList; + + @ApiModelProperty(value = "受理号") + private String batchNo; + + @ApiModelProperty(hidden = true) + private String tradType; + + // 明细表查询时会用到 + @ApiModelProperty(hidden = true) + private Long exportInspectId; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInspectQuery.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInspectQuery.java new file mode 100644 index 0000000..2e77c19 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportInspectQuery.java @@ -0,0 +1,42 @@ +package com.haitonggauto.rtosc.query; + +import com.haitonggauto.rtosc.common.db.anno.DbQuery; +import com.haitonggauto.rtosc.common.db.enums.SqlSymbol; +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 java.util.List; + +@Data +@ApiModel(value = "海关查验查询") +public class ExportInspectQuery extends BaseQuery { + + @ApiModelProperty(value = "船名") + private String shipName; + + @ApiModelProperty(value = "航次") + private String voyage; + + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + @ApiModelProperty(value = "审核状态", hidden = true) + @DbQuery(field = "checkStatus", symbol = SqlSymbol.IN) + private List checkStatusList; + + @ApiModelProperty(value = "受理号") + private String batchNo; + + @ApiModelProperty(hidden = true) + private String tradType; + + // 明细表查询时会用到 + @ApiModelProperty(hidden = true) + private Long exportInspectId; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportLoadCheckQuery.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportLoadCheckQuery.java new file mode 100644 index 0000000..2e82bb5 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportLoadCheckQuery.java @@ -0,0 +1,52 @@ +package com.haitonggauto.rtosc.query; + +import com.haitonggauto.rtosc.common.db.anno.DbQuery; +import com.haitonggauto.rtosc.common.db.enums.SqlSymbol; +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 java.util.List; + +@Data +@ApiModel(value = "出口装船查询") +public class ExportLoadCheckQuery extends BaseQuery { + @ApiModelProperty(value = "受理号") + private String batchNo; + + @ApiModelProperty(value = "船名") + @DbQuery(field = "shipId") + private String shipName; + + @ApiModelProperty(value = "航次ID") + private String voyageId; + + @ApiModelProperty(value = "航次") + private String voyage; + + @ApiModelProperty(value = "提单号") + @DbQuery(symbol = SqlSymbol.LIKE) + private String billNo; + + @ApiModelProperty(value = "贸易类型") + private String tradType; + + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + @ApiModelProperty(value = "审核状态", hidden = true) + @DbQuery(field = "checkStatus", symbol = SqlSymbol.IN) + private List checkStatusList; + + @ApiModelProperty(hidden = true) + private Long exportLoadId; + + @ApiModelProperty(hidden = true) + @DbQuery(field = "vin", symbol = SqlSymbol.IN) + private List vins; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportLoadQuery.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportLoadQuery.java new file mode 100644 index 0000000..0c02669 --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ExportLoadQuery.java @@ -0,0 +1,51 @@ +package com.haitonggauto.rtosc.query; + +import com.haitonggauto.rtosc.common.db.anno.DbQuery; +import com.haitonggauto.rtosc.common.db.enums.SqlSymbol; +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 java.util.List; + +@Data +@ApiModel(value = "出口装船查询") +public class ExportLoadQuery extends BaseQuery { + @ApiModelProperty(value = "受理号") + private String batchNo; + + @ApiModelProperty(value = "船名") + private String shipName; + + @ApiModelProperty(value = "航次ID") + private String voyageId; + + @ApiModelProperty(value = "航次") + private String voyage; + + @ApiModelProperty(value = "贸易类型") + private String tradType; + + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + @ApiModelProperty(value = "提单号") + @DbQuery(symbol = SqlSymbol.LIKE) + private String billNo; + + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + @ApiModelProperty(value = "审核状态", hidden = true) + @DbQuery(field = "checkStatus", symbol = SqlSymbol.IN) + private List checkStatusList; + + @ApiModelProperty(hidden = true) + private Long exportLoadId; + + @ApiModelProperty(hidden = true) + @DbQuery(field = "vin", symbol = SqlSymbol.IN) + private List vins; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/FreeTradeQuery.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/FreeTradeQuery.java new file mode 100644 index 0000000..c71787e --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/FreeTradeQuery.java @@ -0,0 +1,55 @@ +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; +import com.haitonggauto.rtosc.repository.enums.ActiveEnum; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +@ApiModel(value = "特保区查询") +public class FreeTradeQuery extends BaseQuery { + @ApiModelProperty(value = "批次号") + private String batchNo; + + @ApiModelProperty(value = "企业编码") + private String cargoCode; + + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "开始时间") + @DbQuery(field = "createDate", symbol = SqlSymbol.GT) + private Date beginCreateDate; + + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "结束时间") + @DbQuery(field = "createDate", symbol = SqlSymbol.LTE) + private Date endCreateDate; + + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + @DbQuery(symbol = SqlSymbol.LIKE) + @ApiModelProperty(value = "车架号") + private String vin; + + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + @ApiModelProperty(value = "审核状态", hidden = true) + @DbQuery(field = "checkStatus", symbol = SqlSymbol.IN) + private List checkStatusList; + + @ApiModelProperty(value = "是否激活") + private ActiveEnum isActivate; + + // 明细表查询时会用到 + @ApiModelProperty(hidden = true) + private Long departureId; +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ImportUnloadQuery.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ImportUnloadQuery.java new file mode 100644 index 0000000..59853ed --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/query/ImportUnloadQuery.java @@ -0,0 +1,45 @@ +package com.haitonggauto.rtosc.query; + +import com.haitonggauto.rtosc.common.db.anno.DbQuery; +import com.haitonggauto.rtosc.common.db.enums.SqlSymbol; +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 java.util.List; + + +@Data +@ApiModel(value = "进口卸船查询") +public class ImportUnloadQuery extends BaseQuery { + + @ApiModelProperty(value = "船名") + private String shipName; + + @ApiModelProperty(value = "航次ID") + private String voyageId; + + @ApiModelProperty(value = "航次") + private String voyage; + + @ApiModelProperty(value = "贸易类型") + private String tradType; + + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + @ApiModelProperty(value = "审核状态", hidden = true) + @DbQuery(field = "checkStatus", symbol = SqlSymbol.IN) + private List checkStatusList; + + @ApiModelProperty(value = "提单号") + @DbQuery(symbol = SqlSymbol.LIKE) + private String billNo; + + @ApiModelProperty(value = "受理号") + @DbQuery(symbol = SqlSymbol.LIKE) + private String batchNo; + +} diff --git a/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/request/OrderPageRequest.java b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/request/OrderPageRequest.java new file mode 100644 index 0000000..e62a43d --- /dev/null +++ b/nuzar-customer-client/src/main/java/com/haitonggauto/rtosc/request/OrderPageRequest.java @@ -0,0 +1,15 @@ +package com.haitonggauto.rtosc.request; + +import com.nuzar.cloud.web.model.PageRequest; +import lombok.Data; +import lombok.ToString; + +@Data +@ToString +public class OrderPageRequest extends PageRequest { + + private String userId; + + private String status; + +} diff --git a/nuzar-customer-common/pom.xml b/nuzar-customer-common/pom.xml new file mode 100644 index 0000000..fe45730 --- /dev/null +++ b/nuzar-customer-common/pom.xml @@ -0,0 +1,62 @@ + + + + com.haitonggauto.rtosc + nuzar-customer + 1.0-SNAPSHOT + + 4.0.0 + + nuzar-customer-common + jar + + false + + + + + com.nuzar + nuzar-core + + + + + + org.mapstruct + mapstruct + 1.5.3.Final + + + + org.mapstruct + mapstruct-processor + 1.5.3.Final + + + io.swagger + swagger-annotations + 1.5.22 + compile + + + com.google.guava + guava + ${guava.version} + + + org.apache.commons + commons-collections4 + ${commons-collections.version} + + + com.alibaba.fastjson2 + fastjson2 + ${fastjson2.version} + + + com.alicp.jetcache + jetcache-starter-redis + ${jetcache.version} + + + diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/aop/BaseHandlerLogAspect.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/aop/BaseHandlerLogAspect.java new file mode 100644 index 0000000..15f3243 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/aop/BaseHandlerLogAspect.java @@ -0,0 +1,105 @@ +package com.haitonggauto.rtosc.common.aop; + +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + *

+ * Description: + *

+ * + * @author songzixian + * @version v1.0.0 + * @create 2021-06-07 0:05 + */ +//@Aspect +//@ConditionalOnClass(HttpServletRequest.class) +//@Component +//@Order(100) +//@Profile({"dev", "test"}) 加这个注解代表只会在开发环境生效,配置需要改完开发环境 +public class BaseHandlerLogAspect { + private static final Logger logger = LoggerFactory.getLogger(BaseHandlerLogAspect.class); + private ThreadLocal> threadLocal = new ThreadLocal>(); + /** + * 横切点 + */ + @Pointcut("(target(com.haitonggauto.rtosc.common.handler.BaseHandler))") + public void webLog() { + } + /** + * 接收请求,并记录数据 + * @param joinPoint + */ + @Before(value = "webLog()") + public void doBefore(JoinPoint joinPoint) { + // 接收到请求 + RequestAttributes ra = RequestContextHolder.getRequestAttributes(); + ServletRequestAttributes sra = (ServletRequestAttributes) ra; + HttpServletRequest request = sra.getRequest(); + // 记录请求内容,threadInfo存储所有内容 + Map threadInfo = new LinkedHashMap<>(); + threadInfo.put("ip", request.getRemoteAddr()); +// threadInfo.put("url", request.getRequestURL()); + threadInfo.put("uri", request.getRequestURI()); +// threadInfo.put("httpMethod", request.getMethod()); + threadInfo.put("classMethod", + joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName()); + threadInfo.put("args", Arrays.toString(joinPoint.getArgs())); + threadInfo.put("userAgent", request.getHeader("User-Agent")); + threadLocal.set(threadInfo); + } + /** + * 执行成功后处理 + * @param ret + * @throws Throwable + */ + @AfterReturning(value = "webLog()", returning = "ret") + public void doAfterReturning(JoinPoint joinPoint, Object ret) throws Throwable { + Map threadInfo = threadLocal.get(); + threadInfo.put("result", ret); +// if (controllerWebLog.intoDb()) { +// //插入数据库操作 +// //insertResult(threadInfo); +// } + // 处理完请求,返回内容 + } + + /** + * 获取执行时间 + * @param proceedingJoinPoint + * @return + * @throws Throwable + */ + @Around(value = "webLog()") + public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { + long startTime = System.currentTimeMillis(); + Object ob = proceedingJoinPoint.proceed(); + Map threadInfo = threadLocal.get(); + Long takeTime = System.currentTimeMillis() - startTime; + threadInfo.put("takeTime", takeTime); + threadLocal.set(threadInfo); + logger.info("{}", threadInfo); + return ob; + } + /** + * 异常处理 + * @param throwable + */ + @AfterThrowing(value = "webLog()", throwing = "throwable") + public void doAfterThrowing(Throwable throwable) { + Map threadInfo = threadLocal.get(); + // 异常信息 + logger.error("{}接口调用异常,异常信息{}", threadInfo, throwable); + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/aop/BaseServiceLogAspect.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/aop/BaseServiceLogAspect.java new file mode 100644 index 0000000..d582456 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/aop/BaseServiceLogAspect.java @@ -0,0 +1,92 @@ +package com.haitonggauto.rtosc.common.aop; + +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + *

+ * Description: + *

+ * + * @author songzixian + * @version v1.0.0 + * @create 2021-06-07 0:05 + */ +//@Aspect +//@Component +//@Order(100) +//@Profile({"dev", "test"}) 加这个注解代表只会在开发环境生效,配置需要改完开发环境 +public class BaseServiceLogAspect { + private static final Logger logger = LoggerFactory.getLogger(BaseServiceLogAspect.class); + private ThreadLocal> threadLocal = new ThreadLocal>(); + /** + * 横切点 + */ + @Pointcut("(target(com.haitonggauto.rtosc.common.service.BaseDubboService))") + public void serviceLog() { + } + /** + * 接收请求,并记录数据 + * @param joinPoint + */ + @Before(value = "serviceLog()") + public void doBefore(JoinPoint joinPoint) { + // 接收到请求 + // 记录请求内容,threadInfo存储所有内容 + Map threadInfo = new LinkedHashMap<>(); + threadInfo.put("classMethod", + joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName()); + threadInfo.put("args", Arrays.toString(joinPoint.getArgs())); + threadLocal.set(threadInfo); + } + /** + * 执行成功后处理 + * @param ret + * @throws Throwable + */ + @AfterReturning(value = "serviceLog()", returning = "ret") + public void doAfterReturning(JoinPoint joinPoint, Object ret) throws Throwable { + Map threadInfo = threadLocal.get(); + threadInfo.put("result", ret); +// if (controllerWebLog.intoDb()) { +// //插入数据库操作 +// //insertResult(threadInfo); +// } + // 处理完请求,返回内容 + } + + /** + * 获取执行时间 + * @param proceedingJoinPoint + * @return + * @throws Throwable + */ + @Around(value = "serviceLog()") + public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { + long startTime = System.currentTimeMillis(); + Object ob = proceedingJoinPoint.proceed(); + Map threadInfo = threadLocal.get(); + Long takeTime = System.currentTimeMillis() - startTime; + threadInfo.put("takeTime", takeTime); + threadLocal.set(threadInfo); + logger.info("{}", threadInfo); + return ob; + } + /** + * 异常处理 + * @param throwable + */ + @AfterThrowing(value = "serviceLog()", throwing = "throwable") + public void doAfterThrowing(Throwable throwable) { + Map threadInfo = threadLocal.get(); + // 异常信息 + logger.error("{}接口调用异常,异常信息{}", threadInfo, throwable); + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/constants/Constant.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/constants/Constant.java new file mode 100644 index 0000000..c00f301 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/constants/Constant.java @@ -0,0 +1,7 @@ +package com.haitonggauto.rtosc.common.constants; + +public interface Constant { + String TOKEN = "X-Token"; + String ADMIN_APP_ID = "admin_app"; + String WX_APP_ID = "wx_app"; +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/context/UserContext.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/context/UserContext.java new file mode 100644 index 0000000..a43d772 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/context/UserContext.java @@ -0,0 +1,20 @@ +package com.haitonggauto.rtosc.common.context; + +import com.haitonggauto.rtosc.common.dto.LoginUser; + +public class UserContext { + private static ThreadLocal userHolder = new ThreadLocal(); + + public static void setUser(LoginUser loginUser) { + userHolder.set(loginUser); + } + + public static LoginUser getUser() { + return userHolder.get(); + } + + public static void clear() { + userHolder.remove(); + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/anno/DbColumn.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/anno/DbColumn.java new file mode 100644 index 0000000..367a385 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/anno/DbColumn.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.common.db.anno; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.FIELD, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface DbColumn { + String column() default ""; //数据库字段 + String desc() default ""; +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/anno/DbQuery.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/anno/DbQuery.java new file mode 100644 index 0000000..79519a0 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/anno/DbQuery.java @@ -0,0 +1,19 @@ +package com.haitonggauto.rtosc.common.db.anno; + +import com.haitonggauto.rtosc.common.db.enums.SqlSymbol; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 当symbol为EXISTS或NOT_EXISTS时column对应的是子句 + */ +@Target({ElementType.FIELD, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface DbQuery { + String alias() default ""; + String field() default ""; //对应类的字段名 + SqlSymbol symbol() default SqlSymbol.EQ;//比较符号 其它可选项有>=, <=, >,<, like +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/anno/DbTable.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/anno/DbTable.java new file mode 100644 index 0000000..5eb211e --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/anno/DbTable.java @@ -0,0 +1,19 @@ +package com.haitonggauto.rtosc.common.db.anno; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface DbTable { + Class service(); //服务提供接口 + String desc(); // 描述 + boolean dict() default false; //是不是字典,如果是字典,数据是需要进行缓存的 + String idField() default "id"; // 主键字段 + String textField() default "name"; // 显示字段 + String refField() default ""; // 外键字段 + String filterField() default ""; // 用于过滤的字段 + String[] extraField() default {}; // 额外字段 +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/entity/BaseEntity.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/entity/BaseEntity.java new file mode 100644 index 0000000..dbcd7a0 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/entity/BaseEntity.java @@ -0,0 +1,71 @@ +package com.haitonggauto.rtosc.common.db.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.nuzar.cloud.annotation.echo.Echo; +import com.nuzar.cloud.mapper.base.EchoEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +//@JsonInclude(JsonInclude.Include.NON_NULL) +public class BaseEntity implements EchoEntity, Serializable { + /** + * + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "ID") + private Long id; + + //创建人 + @Echo(dictDomain = "user", ref = {"createByName"}) + @TableField(value = "create_by", fill = FieldFill.INSERT) + @ApiModelProperty(value = "创建人") + private String createBy; + + @TableField(exist = false) + @ApiModelProperty(value = "创建人姓名") + private String createByName; + + //创建时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @TableField(value = "create_date", fill = FieldFill.INSERT) + @ApiModelProperty(value = "创建时间") + private Date createDate; + + //修改人 + @Echo(dictDomain = "user", ref = {"updateByName"}) + @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE) + @ApiModelProperty(value = "修改人") + private String updateBy; + + @TableField(exist = false) + @ApiModelProperty(value = "修改人名称") + private String updateByName; + + //创建时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @TableField(value = "update_date", fill = FieldFill.INSERT_UPDATE) + @ApiModelProperty(value = "修改时间") + private Date updateDate; + + @TableField(value = "termcd") + @ApiModelProperty(value = "权限港区") + private String termcd; + + // 逻辑删除 + @TableLogic + @TableField(value = "is_del") + @ApiModelProperty(hidden = true) + private Integer isDel; + + //数据的版本 + @Version + @TableField(fill = FieldFill.INSERT) + @ApiModelProperty(hidden = true) + private Integer version; + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/enums/SqlSymbol.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/enums/SqlSymbol.java new file mode 100644 index 0000000..48e8770 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/enums/SqlSymbol.java @@ -0,0 +1,39 @@ +package com.haitonggauto.rtosc.common.db.enums; + + +import com.haitonggauto.rtosc.common.enums.BaseEnum; + +public enum SqlSymbol implements BaseEnum { + + EQ("="), + GT(">"), + GTE(">="), + LTE("<="), + LT("<"), + NEQ("<>"), + IN("IN"), + LIKE("LIKE"), + LLIKE("LLIKE"), + RLIKE("RLIKE"), + EXISTS("EXISTS"), + NOT_EXISTS("NOT EXISTS"), + EXPRESSION("EXPRESSION") + ; + + /** 描述 */ + private String text; + + private SqlSymbol(String text) { + this.text = text; + } + + @Override + public String text() { + return this.text; + } + + @Override + public Integer id() { + return null; + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/metadata/ClassMetadata.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/metadata/ClassMetadata.java new file mode 100644 index 0000000..a0d09e5 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/metadata/ClassMetadata.java @@ -0,0 +1,229 @@ +package com.haitonggauto.rtosc.common.db.metadata; + +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; + +import java.util.List; + +/** + * 类的原数据 + */ +public class ClassMetadata { + // 实体类 com.wsnet.mybatis.entity.SysUser + private Class clazz; + + // 表名 + private String dbName; + + // 表描述 + private String dbDesc; + + // 服务提供方 + private Class service; + + // 是否是字典 + private boolean dict; + + // 字典的元数据, dict=true时,才不为空 + private DictMetadata dictMetadata; + + // 属性列表 + private List fields; + + public Class getClazz() { + return clazz; + } + + public void setClazz(Class clazz) { + this.clazz = clazz; + } + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getDbDesc() { + return dbDesc; + } + + public void setDbDesc(String dbDesc) { + this.dbDesc = dbDesc; + } + + public Class getService() { + return service; + } + + public void setService(Class service) { + this.service = service; + } + + public boolean isDict() { + return dict; + } + + public void setDict(boolean dict) { + this.dict = dict; + } + + public DictMetadata getDictMetadata() { + return dictMetadata; + } + + public void setDictMetadata(DictMetadata dictMetadata) { + this.dictMetadata = dictMetadata; + } + + public List getFields() { + return fields; + } + + public void setFields(List fields) { + this.fields = fields; + } + + public static class FieldMetadata { + // 数据库中是否存在此字段 + private Boolean exist; + + // 属性名称 + private String field; + + // 数据库字段名称, 这里的column 如果是一对一时指的是本类的属性字段, 如果是集合,则指的是refClazz的字段 + private String column; + + // 字段的描述 + private String desc; + + // 字段基本数据类型 List, BaseEntity, Integer..... + private Class clazz; + + // 引用数据类型 List, SysUser, 这里指的就是SysUser + private Class refClazz; + + public FieldMetadata() { + + } + + public FieldMetadata(Boolean exist, String field, String column, String desc, Class clazz, Class refClazz) { + this.exist = exist; + this.field = field; + this.column = column; + this.desc = desc; + this.clazz = clazz; + this.refClazz = refClazz; + } + + public Boolean getExist() { + return exist; + } + + public void setExist(Boolean exist) { + this.exist = exist; + } + + public String getField() { + return field; + } + + public void setField(String field) { + this.field = field; + } + + public String getColumn() { + return column; + } + + public void setColumn(String column) { + this.column = column; + } + + public Class getClazz() { + return clazz; + } + + public void setClazz(Class clazz) { + this.clazz = clazz; + } + + public Class getRefClazz() { + return refClazz; + } + + public void setRefClazz(Class refClazz) { + this.refClazz = refClazz; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + } + + public static class DictMetadata { + private String idField; // 主键字段 + + private String textField; // 显示字段, 默认为可过滤字段 + + private String refField; // 外键字段 + + private String filterField; // 过滤的字段, 和textField为or关系 + + private List extraField; // 额外字段 + + public DictMetadata() { + + } + + public DictMetadata(String idField, String textField) { + this.idField = idField; + this.textField = textField; + } + + public String getIdField() { + return idField; + } + + public void setIdField(String idField) { + this.idField = idField; + } + + public String getTextField() { + return textField; + } + + public void setTextField(String textField) { + this.textField = textField; + } + + public String getRefField() { + return refField; + } + + public void setRefField(String refField) { + this.refField = refField; + } + + public String getFilterField() { + return filterField; + } + + public void setFilterField(String filterField) { + this.filterField = filterField; + } + + public List getExtraField() { + return extraField; + } + + public void setExtraField(List extraField) { + this.extraField = extraField; + } + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/query/BaseQuery.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/query/BaseQuery.java new file mode 100644 index 0000000..46484e5 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/query/BaseQuery.java @@ -0,0 +1,137 @@ +package com.haitonggauto.rtosc.common.db.query; + +import com.haitonggauto.rtosc.common.db.anno.DbQuery; +import com.haitonggauto.rtosc.common.db.enums.SqlSymbol; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Arrays; +import java.util.List; + +public class BaseQuery extends Perm { + + // 单个查询 + @ApiModelProperty("id") + private Long id; + + // 批量查询 + @ApiModelProperty(hidden = true) + @DbQuery(field = "id", symbol = SqlSymbol.IN) + private List ids; + + // 当前页数 + @ApiModelProperty(value = "当前页数") + private int page = 1; + + // 每页记录数 + @ApiModelProperty(value = "每页记录数") + private int rows = 2000; + + private String createBy; + + // 排序字段 + private List sorts = Arrays.asList(new SortField("updateDate", "desc")); + + public BaseQuery() {} + + public BaseQuery(String u$id, Long r$id) { + super(u$id, r$id); + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + + public int getPage() { + return page; + } + + public void setPage(int page) { + this.page = page; + } + + public int getRows() { + return rows; + } + + public void setRows(int rows) { + this.rows = rows; + } + + public List getSorts() { + return sorts; + } + + public void setSorts(List sorts) { + this.sorts = sorts; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + // 排序字段内部类 + public static class SortField { + // 表的别名 + private String alias; + // 属性名,而非数据库字段名 + private String field; + // 排序方式 + private String sort; + + public SortField() { + + } + + public SortField(String field) { + this.field = field; + this.sort = "desc"; + } + + public SortField(String field, String sort) { + this.field = field; + this.sort = sort; + } + + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public String getField() { + return field; + } + + public void setField(String field) { + this.field = field; + } + + public String getSort() { + return sort; + } + + public void setSort(String sort) { + this.sort = sort; + } + } + + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/query/Perm.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/query/Perm.java new file mode 100644 index 0000000..55cdbc6 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/db/query/Perm.java @@ -0,0 +1,73 @@ +package com.haitonggauto.rtosc.common.db.query; + +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; +import java.util.Map; +import java.util.Set; + +public abstract class Perm implements Serializable { + // 用户ID + @ApiModelProperty(hidden = true) + private String u$id; + // 角色ID + @ApiModelProperty(hidden = true) + private Long r$id; + // 字段组装路由 + @ApiModelProperty(hidden = true) + private String fields = "*"; + // 排除的字段 + @ApiModelProperty(hidden = true) + private Set excludeFields; + // 授权的字典值 + @ApiModelProperty(hidden = true) + private Map> includeIds; + + public Perm() { + } + + public Perm(String u$id, Long r$id) { + this.u$id = u$id; + this.r$id = r$id; + } + + public String getU$id() { + return u$id; + } + + public void setU$id(String u$id) { + this.u$id = u$id; + } + + public Long getR$id() { + return r$id; + } + + public void setR$id(Long r$id) { + this.r$id = r$id; + } + + public String getFields() { + return fields; + } + + public void setFields(String fields) { + this.fields = fields; + } + + public Set getExcludeFields() { + return excludeFields; + } + + public void setExcludeFields(Set excludeFields) { + this.excludeFields = excludeFields; + } + + public Map> getIncludeIds() { + return includeIds; + } + + public void setIncludeIds(Map> includeIds) { + this.includeIds = includeIds; + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/dto/DictDTO.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/dto/DictDTO.java new file mode 100644 index 0000000..16072d9 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/dto/DictDTO.java @@ -0,0 +1,70 @@ +package com.haitonggauto.rtosc.common.dto; + +import com.nuzar.cloud.annotation.echo.Echo; +import com.nuzar.cloud.mapper.base.EchoEntity; + +import java.io.Serializable; + +public class DictDTO implements EchoEntity, Serializable { + /** + * + */ + private static final long serialVersionUID = -1347613740865124637L; + @Echo(dictDomain = "PUB_BRAND_EN", ref = {"extra1"}) + private String id; + private String text; + private String extra1; + private String extra2; + private String extra3; + + public DictDTO() { + + } + + public DictDTO(String id, String text) { + this.id = id; + this.text = text; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public String getExtra1() { + return extra1; + } + + public void setExtra1(String extra1) { + this.extra1 = extra1; + } + + public String getExtra2() { + return extra2; + } + + public void setExtra2(String extra2) { + this.extra2 = extra2; + } + + public String getExtra3() { + return extra3; + } + + public void setExtra3(String extra3) { + this.extra3 = extra3; + } + + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/dto/LoginUser.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/dto/LoginUser.java new file mode 100644 index 0000000..a749f13 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/dto/LoginUser.java @@ -0,0 +1,60 @@ +package com.haitonggauto.rtosc.common.dto; + +import java.io.Serializable; +import java.util.Set; + +public class LoginUser implements Serializable { + + // 是否是系统管理员 + private boolean admin; + + // 用户ID + private String userId; + + // 角色ID + private Long roleId; + + // 可操作权限列表 + private Set permList; + + + public LoginUser() { + } + + public LoginUser(String userId, Long roleId) { + this.userId = userId; + this.roleId = roleId; + } + + public String getUserId() { + return userId; + } + + public boolean isAdmin() { + return admin; + } + + public void setAdmin(boolean admin) { + this.admin = admin; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + public Set getPermList() { + return permList; + } + + public void setPermList(Set permList) { + this.permList = permList; + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/dto/PermNode.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/dto/PermNode.java new file mode 100644 index 0000000..8876998 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/dto/PermNode.java @@ -0,0 +1,62 @@ +package com.haitonggauto.rtosc.common.dto; + +import java.io.Serializable; +import java.util.List; + +public class PermNode implements Serializable { + /** + * + */ + private String code; + private String name; + private String remark; + + public PermNode() { + } + + public PermNode(String code, String name) { + this.code = code; + this.name = name; + } + + public PermNode(String code, String name, String remark) { + this.code = code; + this.name = name; + this.remark = remark; + } + + private List children; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/dto/Result.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/dto/Result.java new file mode 100644 index 0000000..21a3cde --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/dto/Result.java @@ -0,0 +1,41 @@ +package com.haitonggauto.rtosc.common.dto; + +import java.io.Serializable; + +public class Result implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -8179392268406183074L; + + int code = 0; + + T data; + + private String msg;//提示信息 + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/enums/BaseEnum.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/enums/BaseEnum.java new file mode 100644 index 0000000..74f8bf3 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/enums/BaseEnum.java @@ -0,0 +1,7 @@ +package com.haitonggauto.rtosc.common.enums; + +public interface BaseEnum { + String text(); + String name(); + Integer id(); +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/enums/ErrorType.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/enums/ErrorType.java new file mode 100644 index 0000000..a1a32bf --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/enums/ErrorType.java @@ -0,0 +1,39 @@ +package com.haitonggauto.rtosc.common.enums; + +public enum ErrorType implements BaseEnum { + PROGRAM_ERROR(500, "程序内部异常"), + PARAMS_ERROR(501, "参数错误"), + NO_USERNAME(14001, "用户名为空"), + NO_PASSWORD(14002, "密码为空"), + ERROR_PASS(14003, "密码错误"), + NO_USER(14004, "用户不存在"), + NO_ROLE(14005, "用户角色不存在"), + ROLE_NOT_USED(14010, "角色被禁用"), + NO_LOGIN(14006, "用户未登录"), + NOT_AVAILABLE_TOKEN(14007, "无效TOKEN"), + NO_AUTH_PERM(14008, "无操作权限"), + USER_NOT_USED(14009, "用户已禁用"), + USER_NOT_PIPEI(14009, "所在公司与分配的调度组不匹配"), + USER_NOT_BIND(14010, "账号没有绑定客户"), + PAY_ERR(2000, "支付失败"), + URL_ERROR(404, "地址不存在");; + + private int id; + private String text; + + private ErrorType(int id, String text) { + this.id = id; + this.text = text; + } + + + @Override + public String text() { + return text; + } + + @Override + public Integer id() { + return id; + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/AccessFrequencyException.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/AccessFrequencyException.java new file mode 100644 index 0000000..e8b5466 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/AccessFrequencyException.java @@ -0,0 +1,15 @@ +package com.haitonggauto.rtosc.common.exception; + + +/** + * 这里必须继承自RuntimeException, 不然会有其它问题发生java.lang.reflect.UndeclaredThrowableException: null + */ +public class AccessFrequencyException extends RuntimeException { + + public AccessFrequencyException() {} + + public AccessFrequencyException(String msg) { + super(msg); + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/FieldNotExistsException.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/FieldNotExistsException.java new file mode 100644 index 0000000..20c61cc --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/FieldNotExistsException.java @@ -0,0 +1,15 @@ +package com.haitonggauto.rtosc.common.exception; + + +/** + * 这里必须继承自RuntimeException, 不然会有其它问题发生java.lang.reflect.UndeclaredThrowableException: null + */ +public class FieldNotExistsException extends RuntimeException { + + public FieldNotExistsException() {} + + public FieldNotExistsException(String msg) { + super(msg); + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NoAnnotationException.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NoAnnotationException.java new file mode 100644 index 0000000..b2b6d1d --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NoAnnotationException.java @@ -0,0 +1,15 @@ +package com.haitonggauto.rtosc.common.exception; + + +/** + * 这里必须继承自RuntimeException, 不然会有其它问题发生java.lang.reflect.UndeclaredThrowableException: null + */ +public class NoAnnotationException extends RuntimeException { + + public NoAnnotationException() {} + + public NoAnnotationException(String msg) { + super(msg); + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NoLoginException.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NoLoginException.java new file mode 100644 index 0000000..94a7898 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NoLoginException.java @@ -0,0 +1,15 @@ +package com.haitonggauto.rtosc.common.exception; + + +/** + * 这里必须继承自RuntimeException, 不然会有其它问题发生java.lang.reflect.UndeclaredThrowableException: null + */ +public class NoLoginException extends RuntimeException { + + public NoLoginException() {} + + public NoLoginException(String msg) { + super(msg); + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NoPermException.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NoPermException.java new file mode 100644 index 0000000..8c8c9ab --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NoPermException.java @@ -0,0 +1,15 @@ +package com.haitonggauto.rtosc.common.exception; + + +/** + * 这里必须继承自RuntimeException, 不然会有其它问题发生java.lang.reflect.UndeclaredThrowableException: null + */ +public class NoPermException extends RuntimeException { + + public NoPermException() {} + + public NoPermException(String msg) { + super(msg); + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NoUserExistsException.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NoUserExistsException.java new file mode 100644 index 0000000..add937c --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NoUserExistsException.java @@ -0,0 +1,15 @@ +package com.haitonggauto.rtosc.common.exception; + + +/** + * 这里必须继承自RuntimeException, 不然会有其它问题发生java.lang.reflect.UndeclaredThrowableException: null + */ +public class NoUserExistsException extends RuntimeException { + + public NoUserExistsException() {} + + public NoUserExistsException(String msg) { + super(msg); + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NotBaseEntityTypeException.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NotBaseEntityTypeException.java new file mode 100644 index 0000000..ac3f9f1 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NotBaseEntityTypeException.java @@ -0,0 +1,15 @@ +package com.haitonggauto.rtosc.common.exception; + + +/** + * 这里必须继承自RuntimeException, 不然会有其它问题发生java.lang.reflect.UndeclaredThrowableException: null + */ +public class NotBaseEntityTypeException extends RuntimeException { + + public NotBaseEntityTypeException() {} + + public NotBaseEntityTypeException(String msg) { + super(msg); + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NullObjectException.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NullObjectException.java new file mode 100644 index 0000000..0509911 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/NullObjectException.java @@ -0,0 +1,15 @@ +package com.haitonggauto.rtosc.common.exception; + + +/** + * 这里必须继承自RuntimeException, 不然会有其它问题发生java.lang.reflect.UndeclaredThrowableException: null + */ +public class NullObjectException extends RuntimeException { + + public NullObjectException() {} + + public NullObjectException(String msg) { + super(msg); + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/PasswordWrongException.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/PasswordWrongException.java new file mode 100644 index 0000000..681b7ca --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/exception/PasswordWrongException.java @@ -0,0 +1,15 @@ +package com.haitonggauto.rtosc.common.exception; + + +/** + * 这里必须继承自RuntimeException, 不然会有其它问题发生java.lang.reflect.UndeclaredThrowableException: null + */ +public class PasswordWrongException extends RuntimeException { + + public PasswordWrongException() {} + + public PasswordWrongException(String msg) { + super(msg); + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/BaseHandler.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/BaseHandler.java new file mode 100644 index 0000000..f7cd5ed --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/BaseHandler.java @@ -0,0 +1,5 @@ +package com.haitonggauto.rtosc.common.handler; + +public interface BaseHandler { + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/BaseLocalHandler.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/BaseLocalHandler.java new file mode 100644 index 0000000..49a1e17 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/BaseLocalHandler.java @@ -0,0 +1,76 @@ +package com.haitonggauto.rtosc.common.handler; + +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.ReflectionKit; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import com.haitonggauto.rtosc.common.db.query.BaseQuery; +import com.haitonggauto.rtosc.common.dto.Result; +import com.haitonggauto.rtosc.common.enums.ErrorType; +import com.haitonggauto.rtosc.common.handler.anno.HandlerMethod; +import com.haitonggauto.rtosc.common.utils.ResultUtil; +import com.haitonggauto.rtosc.common.utils.WrapperKit; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; +import java.util.Map; + + +/** + * 通用handler的封装 + * @param + */ +public abstract class BaseLocalHandler, T extends BaseEntity> implements BaseHandler { + + @Autowired + protected M service; + + protected Class entityClass = this.currentModelClass(); + + protected Class currentModelClass() { + return (Class) ReflectionKit.getSuperClassGenericType(this.getClass(), BaseLocalHandler.class, 1); + } + + protected BaseQuery transformQuery(Map query) { + JSONObject json = new JSONObject(query); + return json.to(BaseQuery.class); + } + + @HandlerMethod(code="0100", name="列表") + @PostMapping("/page") + protected Result> page(@RequestBody Map query) { + BaseQuery baseQuery = transformQuery(query); + Wrapper queryWrapper = new WrapperKit(){}.changeBaseQueryToWrapper(entityClass, baseQuery); + return ResultUtil.success(service.page(new Page<>(baseQuery.getPage(), baseQuery.getRows()), queryWrapper)); + } + + @HandlerMethod(code="0200", name="获取") + @PostMapping("/get") + protected Result get(@RequestParam Long id) { + return ResultUtil.success(service.getById(id)); + } + + @HandlerMethod(code="0300", name="保存") + @PostMapping("/save") + protected Result save(@RequestBody T entity) { + service.saveOrUpdate(entity); + return ResultUtil.success("success"); + } + + @HandlerMethod(code="0400", name="删除") + @PostMapping("/delete") + protected Result delete(@RequestBody List ids) { + if (CollectionUtils.isEmpty(ids)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "ID列表不能为空"); + } +// service.removeBatchByIds(ids); + return ResultUtil.success("success"); + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/GlobalExceptionHandler.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/GlobalExceptionHandler.java new file mode 100644 index 0000000..796288f --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/GlobalExceptionHandler.java @@ -0,0 +1,54 @@ +package com.haitonggauto.rtosc.common.handler; + +import com.alibaba.fastjson2.JSON; +import com.haitonggauto.rtosc.common.dto.Result; +import com.haitonggauto.rtosc.common.enums.ErrorType; +import com.haitonggauto.rtosc.common.exception.NoLoginException; +import com.haitonggauto.rtosc.common.exception.NoPermException; +import com.haitonggauto.rtosc.common.utils.ResultUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.validation.FieldError; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.MissingServletRequestParameterException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 定义全局的的异常处理 + */ +@RestControllerAdvice +public class GlobalExceptionHandler { + private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class); + + @ExceptionHandler(value = Exception.class) + public @ResponseBody + Result handle(HttpServletRequest request, HttpServletResponse response, Exception e) { + // 记录日志 + String path = request.getRequestURI(); + int status = response.getStatus(); + + if (e instanceof NoLoginException) { + return ResultUtil.failure(ErrorType.NO_LOGIN.id(), ErrorType.NO_LOGIN.text()); + } else if (e instanceof NoPermException) { + return ResultUtil.failure(ErrorType.NO_AUTH_PERM.id(), e.getMessage()); + } else if (e instanceof MissingServletRequestParameterException) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), e.getMessage()); + } else if (e instanceof MethodArgumentNotValidException) { + List res = ((MethodArgumentNotValidException)e).getBindingResult().getAllErrors().stream() + .map(err -> String.format("%s->%s", ((FieldError) err).getField() , err.getDefaultMessage())) + .collect(Collectors.toList()); + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), JSON.toJSONString(res)); + } + + log.error(String.format("访问%s失败", path), e); + + return ResultUtil.failure(status, String.format("访问%s失败,原因:%s", path, e.getMessage())); + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/anno/HandlerMethod.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/anno/HandlerMethod.java new file mode 100644 index 0000000..f1a82bd --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/anno/HandlerMethod.java @@ -0,0 +1,16 @@ +package com.haitonggauto.rtosc.common.handler.anno; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface HandlerMethod { + String code(); //表现出菜单的层级关系每级两位编码共8位编码如01000000 + String name(); //菜单名称 + String remark() default ""; //菜单备注 + boolean login() default true; //是否需要登录才允许访问 + boolean auth() default true; //是否有授权才允许访问 +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/anno/HandlerModule.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/anno/HandlerModule.java new file mode 100644 index 0000000..46d7f4a --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/handler/anno/HandlerModule.java @@ -0,0 +1,12 @@ +package com.haitonggauto.rtosc.common.handler.anno; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface HandlerModule { + String code(); //模块编码需要4位 +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/service/AuthService.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/service/AuthService.java new file mode 100644 index 0000000..d784572 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/service/AuthService.java @@ -0,0 +1,46 @@ +package com.haitonggauto.rtosc.common.service; + +import com.haitonggauto.rtosc.common.dto.LoginUser; + +import javax.servlet.http.HttpServletRequest; + +public interface AuthService { + + /** + * 用户登录 + * @param loginUser + * @param appId + * @param appId + * @return + */ + String login(LoginUser loginUser, String appId); + + /** + * 用于微信登录 + * @param token + * @param loginUser + * @param appId + * @return + */ + String login(String token, LoginUser loginUser, String appId); + + /** + * 获取用户访问token + * @param request + * @return + */ + String getRequestToken(HttpServletRequest request); + + /** + * 获取登录用户信息 + * @param request + * @return + */ + LoginUser getUser(HttpServletRequest request); + + /** + * 退出登录 + * @param request + */ + void logout(HttpServletRequest request); +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/service/impl/BaseAuthServiceImpl.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/service/impl/BaseAuthServiceImpl.java new file mode 100644 index 0000000..5cd55d4 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/service/impl/BaseAuthServiceImpl.java @@ -0,0 +1,124 @@ +package com.haitonggauto.rtosc.common.service.impl; + +import com.alicp.jetcache.Cache; +import com.alicp.jetcache.anno.CacheType; +import com.alicp.jetcache.anno.CreateCache; +import com.haitonggauto.rtosc.common.constants.Constant; +import com.haitonggauto.rtosc.common.dto.LoginUser; +import com.haitonggauto.rtosc.common.service.AuthService; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +public abstract class BaseAuthServiceImpl implements AuthService { + + @Value("${sys.cache-prefix}") + private String cachePrefix; + + @CreateCache(name="login_user:", cacheType = CacheType.BOTH, expire = 4, localExpire = 1, timeUnit = TimeUnit.HOURS) + private Cache loginUserCache; + + // 记录在线的用户及TOKEN,用来解决一个用户有多个可用TOKEN的问题 map appId->userId, token + @CreateCache(name="online:login_user:", cacheType = CacheType.REMOTE) + private Cache> onlineLoginUserCache; + + @Override + public String login(LoginUser loginUser, String appId) { +// String token = SecureUtil.md5(StringUtils.join(loginUser.getUserId(), appId, UUID.fastUUID().toString())); + String token = "1668443085744283650"; + return login(token, loginUser, appId); + } + + @Override + public String login(String token, LoginUser loginUser, String appId) { + String userId = loginUser.getUserId(); + + // 移除上一次登录的token + String onlineKey = StringUtils.joinWith(cachePrefix, appId); + Map userId2Token = onlineLoginUserCache.get(onlineKey); + if (userId2Token != null) { + if (userId2Token.containsKey(userId)) { // 已经登录过了 + loginUserCache.remove(userId2Token.get(userId)); + } + } else { + userId2Token = new HashMap<>(); + } + userId2Token.put(userId, token); // 添加新的访问token + + refresh(appId); // 清除掉不在线的用户 + + loginUserCache.put(token, loginUser); + onlineLoginUserCache.put(onlineKey, userId2Token); + + return token; + } + + @Override + public String getRequestToken(HttpServletRequest request) { + // 默认从请求头中获得token + String token = request.getHeader(Constant.TOKEN); + // 如果header中不存在token,则从参数中获取token + if (StringUtils.isBlank(token)) { + token = request.getParameter("token"); + } + return token; + } + + @Override + public LoginUser getUser(HttpServletRequest request) { + String token = getRequestToken(request); + if (StringUtils.isEmpty(token)) { + return null; + } + LoginUser loginUser = loginUserCache.get(token); + if (loginUser == null) { + refresh(); + return null; + } + // 刷新过期时间 + loginUserCache.put(token, loginUser); + return loginUser; + } + + @Override + public void logout(HttpServletRequest request) { + String token = getRequestToken(request); + if (StringUtils.isNotEmpty(token)) { + loginUserCache.remove(token); + } + refresh(); + } + + // 清除已过期的登录用户 + private void refresh() { + refresh(Constant.ADMIN_APP_ID); + refresh(Constant.WX_APP_ID); + } + + private void refresh(String appId) { + String onlineKey = StringUtils.joinWith(cachePrefix, appId); + Map userId2Token = onlineLoginUserCache.get(onlineKey); + if (MapUtils.isEmpty(userId2Token)) { + return; + } + // 过滤出已经过期的 + List list = userId2Token.entrySet().stream() + .filter(item -> loginUserCache.get(item.getValue()) == null) + .map(item -> item.getKey()).collect(Collectors.toList()); + + if (CollectionUtils.isEmpty(list)) { + return; + } + + list.forEach(item -> userId2Token.remove(item)); + onlineLoginUserCache.put(onlineKey, userId2Token); + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ClassScanner.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ClassScanner.java new file mode 100644 index 0000000..88ee96b --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ClassScanner.java @@ -0,0 +1,123 @@ +package com.haitonggauto.rtosc.common.utils; + +import org.apache.commons.lang3.ArrayUtils; +import org.springframework.beans.factory.BeanDefinitionStoreException; +import org.springframework.context.ResourceLoaderAware; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.core.io.support.ResourcePatternResolver; +import org.springframework.core.io.support.ResourcePatternUtils; +import org.springframework.core.type.classreading.CachingMetadataReaderFactory; +import org.springframework.core.type.classreading.MetadataReader; +import org.springframework.core.type.classreading.MetadataReaderFactory; +import org.springframework.core.type.filter.AnnotationTypeFilter; +import org.springframework.core.type.filter.TypeFilter; +import org.springframework.util.StringUtils; +import org.springframework.util.SystemPropertyUtils; + +import java.io.IOException; +import java.lang.annotation.Annotation; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; + +public class ClassScanner implements ResourceLoaderAware { + + // 保存过滤规则要排除的注解 + private final List includeFilters = new LinkedList<>(); + private final List excludeFilters = new LinkedList<>(); + + private ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver(); + private MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory( + this.resourcePatternResolver); + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static Set scan(String[] basePackages, Class... annotations) { + ClassScanner cs = new ClassScanner(); + + if (ArrayUtils.isNotEmpty(annotations)) { + for (Class anno : annotations) { + cs.addIncludeFilter(new AnnotationTypeFilter(anno)); + } + } + + Set classes = new HashSet<>(); + for (String s : basePackages) { + classes.addAll(cs.doScan(s)); + } + return classes; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static Set scan(String basePackages, Class... annotations) { + return ClassScanner.scan(StringUtils.tokenizeToStringArray(basePackages, ",; \t\n"), annotations); + } + + public final ResourceLoader getResourceLoader() { + return this.resourcePatternResolver; + } + + @Override + public void setResourceLoader(ResourceLoader resourceLoader) { + this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader); + this.metadataReaderFactory = new CachingMetadataReaderFactory(resourceLoader); + } + + public void addIncludeFilter(TypeFilter includeFilter) { + this.includeFilters.add(includeFilter); + } + + public void addExcludeFilter(TypeFilter excludeFilter) { + this.excludeFilters.add(0, excludeFilter); + } + + public void resetFilters(boolean useDefaultFilters) { + this.includeFilters.clear(); + this.excludeFilters.clear(); + } + + @SuppressWarnings("rawtypes") + public Set doScan(String basePackage) { + Set classes = new HashSet<>(); + try { + String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + + org.springframework.util.ClassUtils.convertClassNameToResourcePath( + SystemPropertyUtils.resolvePlaceholders(basePackage)) + + "/**/*.class"; + Resource[] resources = this.resourcePatternResolver.getResources(packageSearchPath); + + for (Resource resource : resources) { + if (resource.isReadable()) { + MetadataReader metadataReader = this.metadataReaderFactory.getMetadataReader(resource); + if ((includeFilters.size() == 0 && excludeFilters.size() == 0) || matches(metadataReader)) { + try { + classes.add(Class.forName(metadataReader.getClassMetadata().getClassName())); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + } + } + } + } catch (IOException ex) { + throw new BeanDefinitionStoreException("I/O failure during classpath scanning", ex); + } + return classes; + } + + protected boolean matches(MetadataReader metadataReader) throws IOException { + for (TypeFilter tf : this.excludeFilters) { + if (tf.match(metadataReader, this.metadataReaderFactory)) { + return false; + } + } + for (TypeFilter tf : this.includeFilters) { + if (tf.match(metadataReader, this.metadataReaderFactory)) { + return true; + } + } + return false; + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/DateUtils.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/DateUtils.java new file mode 100644 index 0000000..136dccc --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/DateUtils.java @@ -0,0 +1,1542 @@ +package com.haitonggauto.rtosc.common.utils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +public class DateUtils extends org.apache.commons.lang3.time.DateUtils { + + public static final String TIME_WITH_MINUTE_PATTERN = "HH:mm"; + + public static final long DAY_MILLI = 24 * 60 * 60 * 1000; // 一天的MilliSecond + + public final static int LEFT_OPEN_RIGHT_OPEN = 1; + public final static int LEFT_CLOSE_RIGHT_OPEN = 2; + public final static int LEFT_OPEN_RIGHT_CLOSE = 3; + public final static int LEFT_CLOSE_RIGHT_CLOSE = 4; + + /** + * 比较日期的模式 --只比较日期,不比较时间 + */ + public final static int COMP_MODEL_DATE = 1; + /** + * 比较日期的模式 --只比较时间,不比较日期 + */ + public final static int COMP_MODEL_TIME = 2; + /** + * 比较日期的模式 --比较日期,也比较时间 + */ + public final static int COMP_MODEL_DATETIME = 3; + + private static Logger logger = LoggerFactory.getLogger(DateUtils.class); + + /** + * 要用到的DATE Format的定义 + */ + public static String DATE_FORMAT_DATEONLY = "yyyy-MM-dd"; // 年/月/日 + public static String DATE_FORMAT_DATETIME = "yyyy-MM-dd HH:mm:ss"; // 年/月/日 + public static SimpleDateFormat sdfDateTime = new SimpleDateFormat(DateUtils.DATE_FORMAT_DATETIME); + // Global SimpleDateFormat object + public static SimpleDateFormat sdfDateOnly = new SimpleDateFormat(DateUtils.DATE_FORMAT_DATEONLY); + public static final SimpleDateFormat SHORTDATEFORMAT = new SimpleDateFormat("yyyyMMdd"); + public static final SimpleDateFormat SHORT_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); + public static final SimpleDateFormat LONG_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + public static final SimpleDateFormat HMS_FORMAT = new SimpleDateFormat("HH:mm:ss"); + public static final SimpleDateFormat formatTimestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + /** + * 根据日期格式字符串解析日期字符串 + * + * @param str + * 日期字符串 + * @param parsePatterns + * 日期格式字符串 + * @return 解析后日期 + * @throws ParseException + */ + public static Date parseDate(String str, String parsePatterns) { + try { + return parseDate(str, new String[] { parsePatterns }); + } catch (ParseException e) { + logger.error("", e); + return null; + } + } + + /** + * 根据单位字段比较两个日期 + * + * @param date + * 日期1 + * @param otherDate + * 日期2 + * @param withUnit + * 单位字段,从Calendar field取值 + * @return 等于返回0值, 大于返回大于0的值 小于返回小于0的值 + */ + public static int compareDate(Date date, Date otherDate, int withUnit) { + Calendar dateCal = Calendar.getInstance(); + dateCal.setTime(date); + Calendar otherDateCal = Calendar.getInstance(); + otherDateCal.setTime(otherDate); + + switch (withUnit) { + case Calendar.YEAR: + dateCal.clear(Calendar.MONTH); + otherDateCal.clear(Calendar.MONTH); + case Calendar.MONTH: + dateCal.set(Calendar.DATE, 1); + otherDateCal.set(Calendar.DATE, 1); + case Calendar.DATE: + dateCal.set(Calendar.HOUR_OF_DAY, 0); + otherDateCal.set(Calendar.HOUR_OF_DAY, 0); + case Calendar.HOUR: + dateCal.clear(Calendar.MINUTE); + otherDateCal.clear(Calendar.MINUTE); + case Calendar.MINUTE: + dateCal.clear(Calendar.SECOND); + otherDateCal.clear(Calendar.SECOND); + case Calendar.SECOND: + dateCal.clear(Calendar.MILLISECOND); + otherDateCal.clear(Calendar.MILLISECOND); + case Calendar.MILLISECOND: + break; + default: + throw new IllegalArgumentException("withUnit 单位字段 " + withUnit + " 不合法!!"); + } + return dateCal.compareTo(otherDateCal); + } + + /** + * 根据单位字段比较两个时间 + * + * @param date + * 时间1 + * @param otherDate + * 时间2 + * @param withUnit + * 单位字段,从Calendar field取值 + * @return 等于返回0值, 大于返回大于0的值 小于返回小于0的值 + */ + public static int compareTime(Date date, Date otherDate, int withUnit) { + Calendar dateCal = Calendar.getInstance(); + dateCal.setTime(date); + Calendar otherDateCal = Calendar.getInstance(); + otherDateCal.setTime(otherDate); + + dateCal.clear(Calendar.YEAR); + dateCal.clear(Calendar.MONTH); + dateCal.set(Calendar.DATE, 1); + otherDateCal.clear(Calendar.YEAR); + otherDateCal.clear(Calendar.MONTH); + otherDateCal.set(Calendar.DATE, 1); + switch (withUnit) { + case Calendar.HOUR: + dateCal.clear(Calendar.MINUTE); + otherDateCal.clear(Calendar.MINUTE); + case Calendar.MINUTE: + dateCal.clear(Calendar.SECOND); + otherDateCal.clear(Calendar.SECOND); + case Calendar.SECOND: + dateCal.clear(Calendar.MILLISECOND); + otherDateCal.clear(Calendar.MILLISECOND); + case Calendar.MILLISECOND: + break; + default: + throw new IllegalArgumentException("withUnit 单位字段 " + withUnit + " 不合法!!"); + } + return dateCal.compareTo(otherDateCal); + } + + /** + * 获得当前的日期毫秒 + * + * @return + */ + public static long nowTimeMillis() { + return System.currentTimeMillis(); + } + + /** + * 获得当前的时间戳 + * + * @return + */ + public static Timestamp nowTimeStamp() { + return new Timestamp(nowTimeMillis()); + } + + /** + * yyyy-MM-dd 当前日期 + * + */ + public static String getReqDate() { + return SHORT_DATE_FORMAT.format(new Date()); + } + + /** + * yyyy-MM-dd 传入日期 + * + * @param date + * @return + */ + public static String getReqDate(Date date) { + return SHORT_DATE_FORMAT.format(date); + } + + /** + * yyyyMMdd 传入日期 + * + * @param date + * @return + */ + public static String getReqDateyyyyMMdd(Date date) { + return SHORTDATEFORMAT.format(date); + } + + /** + * yyyy-MM-dd 传入的时间戳 + * + * @param tmp + * @return + */ + public static String TimestampToDateStr(Timestamp tmp) { + return SHORT_DATE_FORMAT.format(tmp); + } + + /** + * HH:mm:ss 当前时间 + * + * @return + */ + public static String getReqTime() { + return HMS_FORMAT.format(new Date()); + } + + /** + * 得到时间戳格式字串 + * + * @param date + * @return + */ + public static String getTimeStampStr(Date date) { + return LONG_DATE_FORMAT.format(date); + } + + /** + * 得到长日期格式字串 + * + * @return + */ + public static String getLongDateStr() { + return LONG_DATE_FORMAT.format(new Date()); + } + + public static String getLongDateStr(Timestamp time) { + return LONG_DATE_FORMAT.format(time); + } + + /** + * 得到短日期格式字串 + * + * @param date + * @return + */ + public static String getShortDateStr(Date date) { + return SHORT_DATE_FORMAT.format(date); + } + + public static String getShortDateStr() { + return SHORT_DATE_FORMAT.format(new Date()); + } + + /** + * 计算 second 秒后的时间 + * + * @param date + * @param second + * @return + */ + public static Date addSecond(Date date, int second) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + ; + calendar.add(Calendar.SECOND, second); + return calendar.getTime(); + } + + /** + * 计算 minute 分钟后的时间 + * + * @param date + * @param minute + * @return + */ + public static Date addMinute(Date date, int minute) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.MINUTE, minute); + return calendar.getTime(); + } + + /** + * 计算 hour 小时后的时间 + * + * @param date + * @param hour + * @return + */ + public static Date addHour(Date date, int hour) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.HOUR, hour); + return calendar.getTime(); + } + + /** + * 得到day的起始时间点。 + * + * @param date + * @return + */ + public static Date getDayStart(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + return calendar.getTime(); + } + + /** + * 得到day的终止时间点. + * + * @param date + * @return + */ + public static Date getDayEnd(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + calendar.add(Calendar.DAY_OF_MONTH, 1); + calendar.add(Calendar.MILLISECOND, -1); + return calendar.getTime(); + } + + /** + * 计算 day 天后的时间 + * + * @param date + * @param day + * @return + */ + public static Date addDay(Date date, int day) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.DAY_OF_MONTH, day); + return calendar.getTime(); + } + + /** + * 得到month的终止时间点. + * + * @param date + * @return + */ + public static Date getMonthEnd(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.DAY_OF_MONTH, 1); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + calendar.add(Calendar.MONTH, 1); + calendar.add(Calendar.MILLISECOND, -1); + return calendar.getTime(); + } + + public static Date addYear(Date date, int year) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.DAY_OF_YEAR, 365 * year); + return calendar.getTime(); + } + + public static Timestamp strToTimestamp(String dateStr) { + return Timestamp.valueOf(dateStr); + } + + public static Timestamp strToTimestamp(Date date) { + return Timestamp.valueOf(formatTimestamp.format(date)); + } + + public static Timestamp getCurTimestamp() { + return Timestamp.valueOf(formatTimestamp.format(new Date())); + } + + /** + * 取得两个日期之间的日数 + * + * @return t1到t2间的日数,如果t2 在 t1之后,返回正数,否则返回负数 + */ + public static long daysBetween(Timestamp t1, Timestamp t2) { + return (t2.getTime() - t1.getTime()) / DAY_MILLI; + } + + /** + * 返回java.sql.Timestamp型的SYSDATE + * + * @return java.sql.Timestamp型的SYSDATE + * @since 1.0 + * @history + */ + public static Timestamp getSysDateTimestamp() { + return new Timestamp(System.currentTimeMillis()); + } + + /** + * 利用缺省的Date格式(YYYY/MM/DD)转换String到java.sql.Timestamp + * + * @param sDate + * Date string + * @return + * @since 1.0 + * @history + */ + public static Timestamp toSqlTimestamp(String sDate) { + if (sDate == null) { + return null; + } + if (sDate.length() != DateUtils.DATE_FORMAT_DATEONLY.length() + &&sDate.length() != DateUtils.DATE_FORMAT_DATETIME.length()) { + return null; + } + return toSqlTimestamp(sDate, + sDate.length() == DateUtils.DATE_FORMAT_DATEONLY.length() + ?DateUtils.DATE_FORMAT_DATEONLY + :DateUtils.DATE_FORMAT_DATETIME); + + } + + /** + * 利用缺省的Date格式(YYYY/MM/DD hh:mm:ss)转化String到java.sql.Timestamp + * + * @param sDate + * Date string + * @param sFmt + * Date format DATE_FORMAT_DATEONLY/DATE_FORMAT_DATETIME + * @return + * @since 1.0 + * @history + */ + public static Timestamp toSqlTimestamp(String sDate, String sFmt) { + String temp = null; + if (sDate == null || sFmt == null) { + return null; + } + if (sDate.length() != sFmt.length()) { + return null; + } + if (sFmt.equals(DateUtils.DATE_FORMAT_DATETIME)) { + temp = sDate.replace('/', '-'); + temp = temp + ".000000000"; + } else if (sFmt.equals(DateUtils.DATE_FORMAT_DATEONLY)) { + temp = sDate.replace('/', '-'); + temp = temp + " 00:00:00.000000000"; + // }else if( sFmt.equals (DateUtils.DATE_FORMAT_SESSION )){ + // //Format: 200009301230 + // temp = + // sDate.substring(0,4)+"-"+sDate.substring(4,6)+"-"+sDate.substring(6,8); + // temp += " " + sDate.substring(8,10) + ":" + + // sDate.substring(10,12) + ":00.000000000"; + } else { + return null; + } + // java.sql.Timestamp.value() 要求的格式必须为yyyy-mm-dd hh:mm:ss.fffffffff + return Timestamp.valueOf(temp); + } + + /** + * 以YYYY/MM/DD HH24:MI:SS格式返回系统日期时间 + * + * @return 系统日期时间 + * @since 1.0 + * @history + */ + public static String getSysDateTimeString() { + return toString(new Date(System.currentTimeMillis()), DateUtils.sdfDateTime); + } + + /** + * 根据指定的Format转化java.util.Date到String + * + * @param dt + * java.util.Date instance + * @param sFmt + * Date format , DATE_FORMAT_DATEONLY or DATE_FORMAT_DATETIME + * @return + * @since 1.0 + * @history + */ + public static String toString(Date dt, String sFmt) { + if (dt == null || sFmt == null || "".equals(sFmt)) { + return ""; + } + return toString(dt, new SimpleDateFormat(sFmt)); + } + + /** + * 利用指定SimpleDateFormat instance转换java.util.Date到String + * + * @param dt + * java.util.Date instance + * @param formatter + * SimpleDateFormat Instance + * @return + * @since 1.0 + * @history + */ + private static String toString(Date dt, SimpleDateFormat formatter) { + String sRet = null; + + try { + sRet = formatter.format(dt).toString(); + } catch (Exception e) { + logger.error("", e); + sRet = null; + } + + return sRet; + } + + /** + * 转换java.sql.Timestamp到String,格式为YYYY/MM/DD HH24:MI + * + * @param dt + * java.sql.Timestamp instance + * @return + * @since 1.0 + * @history + */ + public static String toSqlTimestampString2(Timestamp dt) { + if (dt == null) { + return null; + } + String temp = toSqlTimestampString(dt, DateUtils.DATE_FORMAT_DATETIME); + return temp.substring(0, 16); + } + + public static String toString(Timestamp dt) { + return dt == null ? "" : toSqlTimestampString2(dt); + } + + /** + * 根据指定的格式转换java.sql.Timestamp到String + * + * @param dt + * java.sql.Timestamp instance + * @param sFmt + * Date 格式,DATE_FORMAT_DATEONLY/DATE_FORMAT_DATETIME/ + * DATE_FORMAT_SESSION + * @return + * @since 1.0 + * @history + */ + public static String toSqlTimestampString(Timestamp dt, String sFmt) { + String temp = null; + String out = null; + if (dt == null || sFmt == null) { + return null; + } + temp = dt.toString(); + if (sFmt.equals(DateUtils.DATE_FORMAT_DATETIME) || // "YYYY/MM/DD + // HH24:MI:SS" + sFmt.equals(DateUtils.DATE_FORMAT_DATEONLY)) { // YYYY/MM/DD + temp = temp.substring(0, sFmt.length()); + out = temp.replace('/', '-'); + // }else if( sFmt.equals (DateUtils.DATE_FORMAT_SESSION ) ){ + // //Session + // out = + // temp.substring(0,4)+temp.substring(5,7)+temp.substring(8,10); + // out += temp.substring(12,14) + temp.substring(15,17); + } + return out; + } + + // 得到当前日期的星期 + public static int getWeek() { + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + int w = cal.get(Calendar.DAY_OF_WEEK); + return w; + } + + /** + * Timestamp 格式转换成yyyy-MM-dd timestampToSql(Timestamp 格式转换成yyyy-MM-dd) + * + * @param timestamp + * 时间 + * @return createTimeStr yyyy-MM-dd 时间 + * @Exception 异常对象 + * @since V1.0 + */ + public static String timestampToStringYMD(Timestamp timestamp) { + SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.DATE_FORMAT_DATEONLY); + String createTimeStr = sdf.format(timestamp); + return createTimeStr; + } + + /** + * 判断一个时间是否在某个时间区间内 + * + * @param now + * 目标时间 + * @param start + * 时间区间开始 + * @param end + * 时间区间结束 + * @param model + * 区间模式 + * @return 是否在区间内 + */ + public static boolean isBetween(Date now, Date start, Date end, int model) { + return isBetween(now, start, end, model, LEFT_OPEN_RIGHT_OPEN); + } + + /** + * 判断时间是否在制定的时间段之类 + * + * @param date + * 需要判断的时间 + * @param start + * 时间段的起始时间 + * @param end + * 时间段的截止时间 + * @param interModel + * 区间的模式 + * + *
+	 * 		取值:
+	 * 			LEFT_OPEN_RIGHT_OPEN
+	 * 			LEFT_CLOSE_RIGHT_OPEN
+	 * 			LEFT_OPEN_RIGHT_CLOSE
+	 * 			LEFT_CLOSE_RIGHT_CLOSE
+	 * 
+ * @param compModel + * 比较的模式 + * + *
+	 * 		取值:
+	 * 			COMP_MODEL_DATE		只比较日期,不比较时间
+	 * 			COMP_MODEL_TIME		只比较时间,不比较日期
+	 * 			COMP_MODEL_DATETIME 比较日期,也比较时间
+	 * 
+ * @return + */ + public static boolean isBetween(Date date, Date start, Date end, int interModel, int compModel) { + if (date == null || start == null || end == null) { + throw new IllegalArgumentException("日期不能为空"); + } + SimpleDateFormat format = null; + switch (compModel) { + case COMP_MODEL_DATE: { + format = new SimpleDateFormat("yyyyMMdd"); + break; + } + case COMP_MODEL_TIME: { + format = new SimpleDateFormat("HHmmss"); + break; + } + case COMP_MODEL_DATETIME: { + format = new SimpleDateFormat("yyyyMMddHHmmss"); + break; + } + default: { + throw new IllegalArgumentException(String.format("日期的比较模式[%d]有误", compModel)); + } + } + long dateNumber = Long.parseLong(format.format(date)); + long startNumber = Long.parseLong(format.format(start)); + long endNumber = Long.parseLong(format.format(end)); + switch (interModel) { + case LEFT_OPEN_RIGHT_OPEN: { + if (dateNumber <= startNumber || dateNumber >= endNumber) { + return false; + } else { + return true; + } + } + case LEFT_CLOSE_RIGHT_OPEN: { + if (dateNumber < startNumber || dateNumber >= endNumber) { + return false; + } else { + return true; + } + } + case LEFT_OPEN_RIGHT_CLOSE: { + if (dateNumber <= startNumber || dateNumber > endNumber) { + return false; + } else { + return true; + } + } + case LEFT_CLOSE_RIGHT_CLOSE: { + if (dateNumber < startNumber || dateNumber > endNumber) { + return false; + } else { + return true; + } + } + default: { + throw new IllegalArgumentException(String.format("日期的区间模式[%d]有误", interModel)); + } + } + } + + /** + * 得到当前周起始时间 + * + * @param date + * @return + */ + public static Date getWeekStart(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.get(Calendar.WEEK_OF_YEAR); + int firstDay = calendar.getFirstDayOfWeek(); + calendar.set(Calendar.DAY_OF_WEEK, firstDay); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + return calendar.getTime(); + } + + /** + * 得到当前周截止时间 + * + * @param date + * @return + */ + public static Date getWeekEnd(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.get(Calendar.WEEK_OF_YEAR); + int firstDay = calendar.getFirstDayOfWeek(); + calendar.set(Calendar.DAY_OF_WEEK, 8 - firstDay); + calendar.set(Calendar.HOUR_OF_DAY, 23); + calendar.set(Calendar.MINUTE, 59); + calendar.set(Calendar.SECOND, 59); + calendar.set(Calendar.MILLISECOND, 0); + return calendar.getTime(); + } + + /** + * 得到当月起始时间 + * + * @param date + * @return + */ + public static Date getMonthStart(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.DAY_OF_MONTH, 1); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + return calendar.getTime(); + } + + /** + * 得到当前年起始时间 + * + * @param date + * @return + */ + public static Date getYearStart(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR)); + calendar.set(Calendar.MONTH, 0); + calendar.set(Calendar.DAY_OF_MONTH, 1); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + return calendar.getTime(); + } + + /** + * 得到当前年最后一天 + * + * @param date + * @return + */ + public static Date getYearEnd(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR)); + calendar.set(Calendar.MONTH, 11); + calendar.set(Calendar.DAY_OF_MONTH, 31); + calendar.set(Calendar.HOUR_OF_DAY, 23); + calendar.set(Calendar.MINUTE, 59); + calendar.set(Calendar.SECOND, 59); + calendar.set(Calendar.MILLISECOND, 0); + return calendar.getTime(); + } + + /** + * 取得月天数 + * + * @param date + * @return + */ + public static int getDayOfMonth(Date date) { + Calendar c = Calendar.getInstance(); + c.setTime(date); + return c.getActualMaximum(Calendar.DAY_OF_MONTH); + } + + /** + * 取得月第一天 + * + * @param date + * @return + */ + public static Date getFirstDateOfMonth(Date date) { + Calendar c = Calendar.getInstance(); + c.setTime(date); + c.set(Calendar.DAY_OF_MONTH, c.getActualMinimum(Calendar.DAY_OF_MONTH)); + return c.getTime(); + } + + /** + * 取得月最后一天 + * + * @param date + * @return + */ + public static Date getLastDateOfMonth(Date date) { + Calendar c = Calendar.getInstance(); + c.setTime(date); + c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH)); + return c.getTime(); + } + + /** + * 取得季度第一天 + * + * @param date + * @return + */ + public static Date getSeasonStart(Date date) { + return getDayStart(getFirstDateOfMonth(getSeasonDate(date)[0])); + } + + /** + * 取得季度最后一天 + * + * @param date + * @return + */ + public static Date getSeasonEnd(Date date) { + return getDayEnd(getLastDateOfMonth(getSeasonDate(date)[2])); + } + + /** + * 取得季度月 + * + * @param date + * @return + */ + public static Date[] getSeasonDate(Date date) { + Date[] season = new Date[3]; + + Calendar c = Calendar.getInstance(); + c.setTime(date); + + int nSeason = getSeason(date); + if (nSeason == 1) {// 第一季度 + c.set(Calendar.MONTH, Calendar.JANUARY); + season[0] = c.getTime(); + c.set(Calendar.MONTH, Calendar.FEBRUARY); + season[1] = c.getTime(); + c.set(Calendar.MONTH, Calendar.MARCH); + season[2] = c.getTime(); + } else if (nSeason == 2) {// 第二季度 + c.set(Calendar.MONTH, Calendar.APRIL); + season[0] = c.getTime(); + c.set(Calendar.MONTH, Calendar.MAY); + season[1] = c.getTime(); + c.set(Calendar.MONTH, Calendar.JUNE); + season[2] = c.getTime(); + } else if (nSeason == 3) {// 第三季度 + c.set(Calendar.MONTH, Calendar.JULY); + season[0] = c.getTime(); + c.set(Calendar.MONTH, Calendar.AUGUST); + season[1] = c.getTime(); + c.set(Calendar.MONTH, Calendar.SEPTEMBER); + season[2] = c.getTime(); + } else if (nSeason == 4) {// 第四季度 + c.set(Calendar.MONTH, Calendar.OCTOBER); + season[0] = c.getTime(); + c.set(Calendar.MONTH, Calendar.NOVEMBER); + season[1] = c.getTime(); + c.set(Calendar.MONTH, Calendar.DECEMBER); + season[2] = c.getTime(); + } + return season; + } + + /** + * + * 1 第一季度 2 第二季度 3 第三季度 4 第四季度 + * + * @param date + * @return + */ + public static int getSeason(Date date) { + + int season = 0; + + Calendar c = Calendar.getInstance(); + c.setTime(date); + int month = c.get(Calendar.MONTH); + switch (month) { + case Calendar.JANUARY: + case Calendar.FEBRUARY: + case Calendar.MARCH: + season = 1; + break; + case Calendar.APRIL: + case Calendar.MAY: + case Calendar.JUNE: + season = 2; + break; + case Calendar.JULY: + case Calendar.AUGUST: + case Calendar.SEPTEMBER: + season = 3; + break; + case Calendar.OCTOBER: + case Calendar.NOVEMBER: + case Calendar.DECEMBER: + season = 4; + break; + default: + break; + } + return season; + } + + /** + * 字符串转date + * + * @param dateString + * @return + */ + public static Date StringToDate(String dateString) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); + Date date = null; + try { + date = sdf.parse(dateString); + } catch (ParseException e) { + logger.error("", e); + } + return date; + } + + /** + * 判断输入日期是一个星期中的第几天(星期天为一个星期第一天) + * + * @param date + * @return + */ + public static int getWeekIndex(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + return calendar.get(Calendar.DAY_OF_WEEK); + } + + /** + * 当前时间的前几天,并且以例如2013/12/09 00:00:00 形式输出 + */ + public static Date subDays(int days) { + Date date = addDay(new Date(), -days); + String dateStr = getReqDate(date); + Date date1 = null; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + try { + date1 = sdf.parse(dateStr); + } catch (ParseException e) { + logger.error("", e); + } + return date1; + } + + /** + * 判断开始时间和结束时间,是否超出了当前时间的一定的间隔数限制 如:开始时间和结束时间,不能超出距离当前时间90天 + * + * @param startDate + * 开始时间 + * @param endDate + * 结束时间按 + * @param interval + * 间隔数 + * @param dateUnit + * 单位(如:月,日),参照Calendar的时间单位 + * @return + */ + public static boolean isOverIntervalLimit(Date startDate, Date endDate, int interval, int dateUnit) { + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + cal.add(dateUnit, interval * (-1)); + Date curDate = getDayStart(cal.getTime()); + if (getDayStart(startDate).compareTo(curDate) < 0 || getDayStart(endDate).compareTo(curDate) < 0) { + return true; + } + return false; + } + + /** + * 判断开始时间和结束时间,是否超出了当前时间的一定的间隔数限制, 时间单位默认为天数 如:开始时间和结束时间,不能超出距离当前时间90天 + * + * @param startDate + * 开始时间 + * @param endDate + * 结束时间按 + * @param interval + * 间隔数 + * @return + */ + public static boolean isOverIntervalLimit(Date startDate, Date endDate, int interval) { + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + cal.add(Calendar.DAY_OF_MONTH, interval * (-1)); + Date curDate = getDayStart(cal.getTime()); + if (getDayStart(startDate).compareTo(curDate) < 0 || getDayStart(endDate).compareTo(curDate) < 0) { + return true; + } + return false; + } + + /** + * 判断开始时间和结束时间,是否超出了当前时间的一定的间隔数限制, 时间单位默认为天数 如:开始时间和结束时间,不能超出距离当前时间90天 + * + * @param startDateStr + * 开始时间 + * @param endDateStr + * 结束时间按 + * @param interval + * 间隔数 + * @return + */ + public static boolean isOverIntervalLimit(String startDateStr, String endDateStr, int interval) { + Date startDate = null; + Date endDate = null; + startDate = DateUtils.parseDate(startDateStr, DateUtils.DATE_FORMAT_DATEONLY); + endDate = DateUtils.parseDate(endDateStr, DateUtils.DATE_FORMAT_DATEONLY); + if (startDate == null || endDate == null){ + return true; + } + + return isOverIntervalLimit(startDate, endDate, interval); + } + + /** + * 传入时间字符串及时间格式,返回对应的Date对象 + * + * @param src + * 时间字符串 + * @param pattern + * 时间格式 + * @return Date + */ + public static Date getDateFromString(String src, String pattern) { + SimpleDateFormat f = new SimpleDateFormat(pattern); + try { + return f.parse(src); + } catch (ParseException e) { + return null; + } + } + + /** + * 取季度 + * + * @param date + * @return + */ + @SuppressWarnings("deprecation") + public static int getQuarter(Date date) { + if (date.getMonth() == 0 || date.getMonth() == 1 || date.getMonth() == 2) { + return 1; + } else if (date.getMonth() == 3 || date.getMonth() == 4 || date.getMonth() == 5) { + return 2; + } else if (date.getMonth() == 6 || date.getMonth() == 7 || date.getMonth() == 8) { + return 3; + } else if (date.getMonth() == 9 || date.getMonth() == 10 || date.getMonth() == 11) { + return 4; + } else { + return 0; + + } + } + + /** + * 取得通用日期时间格式字符串 + * + * @param date + * @return String + */ + public static String formatDate(Date date) { + if (date == null) { + return ""; + } + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return dateFormat.format(date); + } + + /** + * 获取当日的日期格式串 + * + * @param + * @return String + */ + public static String today() { + return formatDate(new Date(), "yyyy-MM-dd"); + } + + /** + * 获取当前时间格式串 + * + * @param + * @return String + */ + public static String currentTime() { + return formatDate(new Date(), "yyyyMMddhhmmssSSS"); + } + + /** + * 取得指定日期格式的字符串 + * + * @param date + * @return String + */ + public static String formatDate(Date date, String format) { + SimpleDateFormat dateFormat = new SimpleDateFormat(format); + return dateFormat.format(date); + } + + /** + * 获取昨日的日期格式串 + * + * @return Date + */ + public static String getYesterday() { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DATE, -1); + return formatDate(calendar.getTime(), "yyyy-MM-dd"); + } + + public static String getTomorrow() { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DATE, 1); + return formatDate(calendar.getTime(), "yyyy-MM-dd"); + } + + /** + * 判断当前时间是否在一定的时间范围内 + * + * @param startTime + * @return boolean + */ + public static boolean isInBetweenTimes(String startTime, String endTime) { + Date nowTime = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); + String time = sdf.format(nowTime); + if (time.compareTo(startTime) >= 0 && time.compareTo(endTime) <= 0) { + return true; + } else { + return false; + } + } + + /** + * 字符转日期 + * + * @param dateStr + * @return + */ + public static Date getDateByStr(String dateStr) { + SimpleDateFormat formatter = null; + if (dateStr == null) { + return null; + } else if (dateStr.length() == 10) { + formatter = new SimpleDateFormat("yyyy-MM-dd"); + } else if (dateStr.length() == 16) { + formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + } else if (dateStr.length() == 19) { + formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + } else if (dateStr.length() > 19) { + dateStr = dateStr.substring(0, 19); + formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + } else { + return null; + } + try { + return formatter.parse(dateStr); + } catch (ParseException e) { +// logger.error("", e); + return null; + } + } + + /** + * 根据传入的数字,输出相比现在days天的数据 + * + * @param days + * @return Date + */ + public static Date getDate(int days) { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DATE, days); + return calendar.getTime(); + } + + /** + * 日期最大时间 + * + * @param dt + * @return + */ + public static Date getMaxTime(Date dt) { + + Date dt1 = null; + Calendar ca = Calendar.getInstance(); + ca.setTime(dt); + ca.add(Calendar.DAY_OF_MONTH, 1); + dt1 = ca.getTime(); + dt1 = DateUtils.getMinTime(dt1); + ca.setTime(dt1); + ca.add(Calendar.SECOND, -1); + dt1 = ca.getTime(); + return dt1; + } + + /** + * 日期最小时间 + * + * @param dt + * @return + */ + public static Date getMinTime(Date dt) { + Date dt1 = null; + dt1 = DateUtils.getDateByStr(DateUtils.formatDate(dt, "yyyy-MM-dd")); + return dt1; + } + + /** + * 月的最后一天 + * + * @param date + * @return + */ + @SuppressWarnings("deprecation") + public static Date getLastDayOfMonth(Date date) { + Calendar cDay1 = Calendar.getInstance(); + cDay1.setTime(date); + int lastDay = cDay1.getActualMaximum(Calendar.DAY_OF_MONTH); + Date lastDate = cDay1.getTime(); + lastDate.setDate(lastDay); + return lastDate; + } + + /** + * 月的第一天 + * + * @param date + * @return + */ + public static Date getFirstDayOfMonth(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.DATE, calendar.getActualMinimum(Calendar.DATE)); + return calendar.getTime(); + } + + /** + * 上月第一天 + * + * @return + */ + public static Date getPreviousMonthFirstDay() { + Calendar lastDate = Calendar.getInstance(); + lastDate.set(Calendar.DATE, 1);// 设为当前月的1号 + lastDate.add(Calendar.MONTH, -1);// 减一个月,变为下月的1号 + return getMinTime(lastDate.getTime()); + } + + /** + * 上月最后一天 + * + * @return + */ + public static Date getPreviousMonthLastDay() { + Calendar lastDate = Calendar.getInstance(); + lastDate.set(Calendar.DATE, 1);// 设为当前月的1号 + lastDate.add(Calendar.DATE, -1); + return getMinTime(lastDate.getTime()); + } + + /** + * 两个日期相关天数 + * + * @param startDate + * @param endDate + * @return + */ + public static long getDateDiff(String startDate, String endDate) { + long diff = 0; + try { + Date date1 = new SimpleDateFormat("yyyy-MM-dd").parse(startDate); + Date date2 = new SimpleDateFormat("yyyy-MM-dd").parse(endDate); + + diff = (date1.getTime() - date2.getTime()) / (24 * 60 * 60 * 1000) > 0 ? (date1.getTime() - date2.getTime()) + / (24 * 60 * 60 * 1000) + : (date2.getTime() - date1.getTime()) / (24 * 60 * 60 * 1000); + } catch (ParseException e) { + } + return diff; + } + + /** + * 返回天数 + * @param date1 + * @param date2 + * @return + */ + public static long getDateDiff(Date date1, Date date2) { + if (date1 == null || date2 == null) { + return 0L; + } + long diff = (date1.getTime() - date2.getTime()) / (24 * 60 * 60 * 1000) > 0 ? (date1.getTime() - date2 + .getTime()) / (24 * 60 * 60 * 1000) : (date2.getTime() - date1.getTime()) / (24 * 60 * 60 * 1000); + return diff; + } + + /** + * 判断两个时间的相差年数 + * @param date1 + * @param date2 + * @return + */ + public static int getYearDiff(Date date1, Date date2){ + if (date1 == null || date2 == null) { + return 0; + } + + Calendar calendar1 = Calendar.getInstance(); + calendar1.setTime(date1); + int year1 = calendar1.get(Calendar.YEAR); + + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(date2); + int year2 = calendar2.get(Calendar.YEAR); + + return Math.abs( year1 - year2); + } + + /** + * 获取两个时间的毫秒数 + * @param date1 + * @param date2 + * @return + */ + public static long getTimeDiff(Date date1, Date date2){ + if (date1 == null || date1 == null) { + return 0L; + } + long diff = (date1.getTime() - date2.getTime()) > 0 ? (date1.getTime() - date2 + .getTime()) : (date2.getTime() - date1.getTime()) ; + return diff; + } + + /* + * 判断两个时间是不是在一个周中 + */ + public static boolean isSameWeekWithToday(Date date) { + + if (date == null) { + return false; + } + + // 0.先把Date类型的对象转换Calendar类型的对象 + Calendar todayCal = Calendar.getInstance(); + Calendar dateCal = Calendar.getInstance(); + + todayCal.setTime(new Date()); + dateCal.setTime(date); + int subYear = todayCal.get(Calendar.YEAR) - dateCal.get(Calendar.YEAR); + // subYear==0,说明是同一年 + if (subYear == 0) { + if (todayCal.get(Calendar.WEEK_OF_YEAR) == dateCal.get(Calendar.WEEK_OF_YEAR)) + return true; + } else if (subYear == 1 && dateCal.get(Calendar.MONTH) == 11 && todayCal.get(Calendar.MONTH) == 0) { + if (todayCal.get(Calendar.WEEK_OF_YEAR) == dateCal.get(Calendar.WEEK_OF_YEAR)) + return true; + } else if (subYear == -1 && todayCal.get(Calendar.MONTH) == 11 && dateCal.get(Calendar.MONTH) == 0) { + if (todayCal.get(Calendar.WEEK_OF_YEAR) == dateCal.get(Calendar.WEEK_OF_YEAR)) + return true; + } + return false; + } + + /** + * getStrFormTime:
+ * + * @param form + * 格式时间 + * @param date + * 时间 + * @return + */ + public static String getStrFormTime(String form, Date date) { + SimpleDateFormat sdf = new SimpleDateFormat(form); + return sdf.format(date); + } + + /** + * 获取几天内日期 return 2014-5-4、2014-5-3 + */ + public static List getLastDays(int countDay) { + List listDate = new ArrayList(); + for (int i = 0; i < countDay; i++) { + listDate.add(DateUtils.getReqDateyyyyMMdd(DateUtils.getDate(-i))); + } + return listDate; + } + + /** + * 对时间进行格式化 + * + * @param date + * @return + */ + public static Date dateFormat(Date date) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Date value = new Date(); + + try { + value = sdf.parse(sdf.format(date)); + } catch (ParseException e) { + e.printStackTrace(); + } + + return value; + + } + + public static boolean isSameDayWithToday(Date date) { + + if (date == null) { + return false; + } + + Calendar todayCal = Calendar.getInstance(); + Calendar dateCal = Calendar.getInstance(); + + todayCal.setTime(new Date()); + dateCal.setTime(date); + int subYear = todayCal.get(Calendar.YEAR) - dateCal.get(Calendar.YEAR); + int subMouth = todayCal.get(Calendar.MONTH) - dateCal.get(Calendar.MONTH); + int subDay = todayCal.get(Calendar.DAY_OF_MONTH) - dateCal.get(Calendar.DAY_OF_MONTH); + if (subYear == 0 && subMouth == 0 && subDay == 0) { + return true; + } + return false; + } + + public static String dateFormatNoChar() { + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + // date.parse(System.currentTimeMillis()); + + Date date = new Date(System.currentTimeMillis()); + + String dateString = dateFormat.format(date); + + return dateString.trim(); + } + + public static String dateFormatToMonthFirstDay() { + //SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + + //获取当前月第一天: + Calendar ca = Calendar.getInstance(); + ca.add(Calendar.MONTH, 0); + ca.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天 + String first = SHORT_DATE_FORMAT.format(ca.getTime()); + //System.out.println("===============first:"+first); + return first; + } + + public static String dateFormatToMonthLastDay() { + + //获取当前月最后一天 + Calendar ca = Calendar.getInstance(); + ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH)); + String last = SHORT_DATE_FORMAT.format(ca.getTime()); + //System.out.println("===============last:"+last); + return last; + } + + /** + * 前几个月第几天 + * @param dayIndex 1,2 -1,-2 + * @param monthIndex 1,2 -1,-2 + * @return + */ + public static Date getPreviousMonthAndDay(int dayIndex,int monthIndex) { + Calendar lastDate = Calendar.getInstance(); + lastDate.add(Calendar.DATE, dayIndex);// 设为当前月的1号 + lastDate.add(Calendar.MONTH, monthIndex);// 减一个月,变为下月的1号 + return lastDate.getTime(); + } + + /** + * 计算工作日 + * @param date + * @param day + * @return + */ + public static Date getWorkDate(Date date, int day) { + Calendar ca = Calendar.getInstance(); + ca.setTime(date); + Date d = ca.getTime(); + int i = 0; + while (i <= day) { + d = DateUtils.addDays(d, 1); + int idx = DateUtils.getWeekIndex(d); + if (idx != 0 && idx != 6) { + i++; + } + } + + return d; + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/GenericSuperclassUtil.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/GenericSuperclassUtil.java new file mode 100644 index 0000000..c7c2cd2 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/GenericSuperclassUtil.java @@ -0,0 +1,33 @@ +package com.haitonggauto.rtosc.common.utils; + +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; + +public class GenericSuperclassUtil { + public static Class getActualTypeArgument(Class clazz) { + Class entitiClass = null; + Type genericSuperclass = clazz.getGenericSuperclass(); + if (genericSuperclass instanceof ParameterizedType) { + Type[] actualTypeArguments = ((ParameterizedType) genericSuperclass) + .getActualTypeArguments(); + if (actualTypeArguments != null && actualTypeArguments.length > 0) { + entitiClass = (Class) actualTypeArguments[0]; + } + } + return entitiClass; + } + + public static Class getActualTypeArgument(Class clazz,int i) { + Class entitiClass = null; + Type genericSuperclass = clazz.getGenericSuperclass(); + if (genericSuperclass instanceof ParameterizedType) { + Type[] actualTypeArguments = ((ParameterizedType) genericSuperclass) + .getActualTypeArguments(); + if (actualTypeArguments != null && actualTypeArguments.length > 0) { + entitiClass = (Class) actualTypeArguments[i]; + } + } + return entitiClass; + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/MethodAnnotationCacheUtils.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/MethodAnnotationCacheUtils.java new file mode 100644 index 0000000..04a9c03 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/MethodAnnotationCacheUtils.java @@ -0,0 +1,100 @@ +package com.haitonggauto.rtosc.common.utils; + +import com.google.common.base.Objects; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.web.method.HandlerMethod; + +import java.lang.annotation.Annotation; +import java.util.Optional; + +public class MethodAnnotationCacheUtils { + //缓存的大小 + private static final int MAX_CACHE_SIZE = 5000; + private static final int CACHE_CONCURRENCY_LEVEL = 200; + + /** + * 本缓存对象可以缓存null值,可以优化性能。 + */ + private static final LoadingCache> ANNOTATION_CACHE = + CacheBuilder.newBuilder().weakKeys().maximumSize(MAX_CACHE_SIZE).concurrencyLevel(CACHE_CONCURRENCY_LEVEL) + .build(new CacheLoader>() { + @Override + public Optional load(AnnotationCacheKey key) throws Exception { + return Optional.ofNullable( + getAnnotationInternal(key.getHandler(), key.getAnnotationClass())); + } + }); + + + public static A getAnnotation(Object handler, Class annotationClass) { + if (!(handler instanceof HandlerMethod)) { + return null; + } + //key对象 + AnnotationCacheKey cacheKey = new AnnotationCacheKey(handler, annotationClass); + return (A) ANNOTATION_CACHE.getUnchecked(cacheKey).orElse(null); + } + + + /** + * 获取handler上的对应的注解信息,可能返回null。 + * 缓存null值。 + */ + private static A getAnnotationInternal(Object handler, Class annotationClass) { + if (!(handler instanceof HandlerMethod)) { + return null; + } + HandlerMethod handlerMethod = (HandlerMethod) handler; + //获取注解上的值 + A result = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), annotationClass); + if (result == null) { + result = AnnotationUtils.findAnnotation(handlerMethod.getBeanType(), annotationClass); + } + return result; + } + + /** + * 注解缓存的key + */ + private static class AnnotationCacheKey { + + private final Object handler; + + private final Class annotationClass; + + public AnnotationCacheKey(Object handler, Class annotationClass) { + this.handler = handler; + this.annotationClass = annotationClass; + } + + public Object getHandler() { + return handler; + } + + public Class getAnnotationClass() { + return annotationClass; + } + + //guava生成的方法 + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnnotationCacheKey that = (AnnotationCacheKey) o; + return Objects.equal(handler, that.handler) && Objects.equal( + annotationClass, that.annotationClass); + } + + @Override + public int hashCode() { + return Objects.hashCode(handler, annotationClass); + } + } +} \ No newline at end of file diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/MethodInterceptorUtils.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/MethodInterceptorUtils.java new file mode 100644 index 0000000..dd33618 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/MethodInterceptorUtils.java @@ -0,0 +1,39 @@ +package com.haitonggauto.rtosc.common.utils; + +import org.springframework.core.MethodParameter; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.method.HandlerMethod; + +import java.lang.annotation.Annotation; +import java.util.Objects; +import java.util.stream.Stream; + +public class MethodInterceptorUtils { + + public static A getAnnotation(Object handler, Class annotationClass) { + return MethodAnnotationCacheUtils.getAnnotation(handler, annotationClass); + } + + public static Stream getRequestParams(Object handler) { + if (!(handler instanceof HandlerMethod)) { + return null; + } + HandlerMethod handlerMethod = (HandlerMethod) handler; + MethodParameter[] methodParameters = handlerMethod.getMethodParameters(); + return Stream.of(methodParameters) + .map(MethodInterceptorUtils::getParamName) + .filter(Objects::nonNull); + } + + + /** + * 解析参数 + */ + private static String getParamName(MethodParameter methodParameter) { + RequestParam requestParam = methodParameter.getParameterAnnotation(RequestParam.class); + if (requestParam != null) { + return requestParam.value(); + } + return null; + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/OkHttpUtils.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/OkHttpUtils.java new file mode 100644 index 0000000..ead33af --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/OkHttpUtils.java @@ -0,0 +1,215 @@ +package com.haitonggauto.rtosc.common.utils; + + +import okhttp3.*; + +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +public class OkHttpUtils { + + // 创建OkHttpClient对象 + private static final OkHttpClient client = new OkHttpClient.Builder() + .connectTimeout(30, TimeUnit.SECONDS) // 连接超时时间 + .readTimeout(30, TimeUnit.SECONDS) // 读取超时时间 + .writeTimeout(30, TimeUnit.SECONDS) // 写入超时时间 + .build(); + + /** + * GET请求 + * @param url 请求URL + * @return 响应体字符串 + * @throws IOException 请求或响应过程中发生的错误 + */ + public static String get(String url) throws IOException { + Request request = new Request.Builder() + .url(url) + .build(); + Response response = client.newCall(request).execute(); + if (response.isSuccessful()) { + return response.body().string(); + } else { + throw new IOException("Unexpected code " + response); + } + } + + public static String get(String url, Map headers) throws IOException { + Request.Builder builder = new Request.Builder() + .url(url); + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + builder.addHeader(entry.getKey(), entry.getValue()); + } + } + Request request = builder.build(); + Response response = client.newCall(request).execute(); + if (response.isSuccessful()) { + return response.body().string(); + } else { + throw new IOException("Unexpected code " + response); + } + } + + /** + * POST请求 + * @param url 请求URL + * @param requestBody 请求体 + * @param headers 请求头 + * @return 响应体字符串 + * @throws IOException 请求或响应过程中发生的错误 + */ + public static String post(String url, RequestBody requestBody, Map headers) throws IOException { + Request.Builder builder = new Request.Builder() + .url(url) + .post(requestBody); + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + builder.addHeader(entry.getKey(), entry.getValue()); + } + } + Request request = builder.build(); + Response response = client.newCall(request).execute(); + if (response.isSuccessful()) { + return response.body().string(); + } else { + throw new IOException("Unexpected code " + response); + } + } + + /** + * 构造JSON请求体 + * @param jsonStr JSON字符串 + * @return JSON请求体 + */ + public static RequestBody buildJsonRequestBody(String jsonStr) { + return RequestBody.create(jsonStr, MediaType.parse("application/json")); + } + + /** + * 构造表单请求体 + * @param formParams 表单参数 + * @return 表单请求体 + */ + public static RequestBody buildFormRequestBody(Map formParams) { + FormBody.Builder builder = new FormBody.Builder(); + if (formParams != null && formParams.size() > 0) { + for (Map.Entry entry : formParams.entrySet()) { + builder.add(entry.getKey(), entry.getValue()); + } + } + return builder.build(); + } + + /** + * 构造Multipart请求体 + * @param multipartParams Multipart参数 + * @return Multipart请求体 + */ + public static RequestBody buildMultipartRequestBody(Map multipartParams) { + MultipartBody.Builder builder = new MultipartBody.Builder() + .setType(MultipartBody.FORM); + if (multipartParams != null && multipartParams.size() > 0) { + for (Map.Entry entry : multipartParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + if (value instanceof String) { + builder.addFormDataPart(key, (String) value); + } else if (value instanceof byte[]) { + builder.addFormDataPart(key, null, + RequestBody.create(MediaType.parse("application/octet-stream"), (byte[]) value)); + } else if (value instanceof RequestBody) { + builder.addFormDataPart(key, null, (RequestBody) value); + } + } + } + return builder.build(); + } + + /** + * 构造Multipart请求体,支持上传文件 + * @param multipartParams Multipart参数 + * @return Multipart请求体 + */ + public static RequestBody buildMultipartRequestBodyWithFiles(Map multipartParams) { + MultipartBody.Builder builder = new MultipartBody.Builder() + .setType(MultipartBody.FORM); + if (multipartParams != null && multipartParams.size() > 0) { + for (Map.Entry entry : multipartParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + if (value instanceof String) { + builder.addFormDataPart(key, (String) value); + } else if (value instanceof byte[]) { + builder.addFormDataPart(key, null, + RequestBody.create((byte[]) value, MediaType.parse("application/octet-stream"))); + } else if (value instanceof RequestBody) { + builder.addFormDataPart(key, null, (RequestBody) value); + } else if (value instanceof UploadFile) { // 支持上传文件 + UploadFile file = (UploadFile) value; + builder.addFormDataPart(key, file.getName(), + RequestBody.create(MediaType.parse(file.getMimeType()), file.getFile())); + } + } + } + return builder.build(); + } + + /** + * 上传文件 + * @param url 请求URL + * @param file 上传的文件 + * @param headers 请求头 + * @return 响应体字符串 + * @throws IOException 请求或响应过程中发生的错误 + */ + public static String uploadFile(String url, UploadFile file, Map headers) throws IOException { + RequestBody requestBody = new MultipartBody.Builder() + .setType(MultipartBody.FORM) + .addFormDataPart("file", file.getName(), + RequestBody.create(MediaType.parse(file.getMimeType()), file.getFile())) + .build(); + Request.Builder builder = new Request.Builder() + .url(url) + .post(requestBody); + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + builder.addHeader(entry.getKey(), entry.getValue()); + } + } + Request request = builder.build(); + Response response = client.newCall(request).execute(); + if (response.isSuccessful()) { + return response.body().string(); + } else { + throw new IOException("Unexpected code " + response); + } + } + + /** + * 封装文件上传参数 + */ + public static class UploadFile { + private final String name; + private final String mimeType; + private final byte[] file; + + public UploadFile(String name, String mimeType, byte[] file) { + this.name = name; + this.mimeType = mimeType; + this.file = file; + } + + public String getName() { + return name; + } + + public String getMimeType() { + return mimeType; + } + + public byte[] getFile() { + return file; + } + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/PermKit.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/PermKit.java new file mode 100644 index 0000000..85f5170 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/PermKit.java @@ -0,0 +1,81 @@ +package com.haitonggauto.rtosc.common.utils; + +import com.alibaba.fastjson2.JSON; +import com.haitonggauto.rtosc.common.db.anno.DbTable; +import com.haitonggauto.rtosc.common.dto.DictDTO; +import com.haitonggauto.rtosc.common.dto.PermNode; +import com.haitonggauto.rtosc.common.handler.anno.HandlerMethod; +import com.haitonggauto.rtosc.common.handler.anno.HandlerModule; +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; +import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.util.ReflectionUtils; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +public final class PermKit { + // 获取所有的权限 + @NotNull + public static List getSysPerm(){ + List nodes = new ArrayList<>(); + + Set classes = ClassScanner.scan("com.wsnet.move.handler, com.xsy.tms.handler, com.xsy.charge.handler, com.xsy.base.handler", HandlerModule.class); + classes.forEach(clazz -> { + HandlerModule module = AnnotationUtils.findAnnotation(clazz, HandlerModule.class); + String baseCode = module.code(); + + ReflectionUtils.doWithMethods(clazz, (method) -> { + HandlerMethod handlerMethod = AnnotationUtils.findAnnotation(method, HandlerMethod.class); + if (handlerMethod == null || StringUtils.isEmpty(handlerMethod.code()) || StringUtils.isEmpty(handlerMethod.name())) { + return; + } + PermNode node = new PermNode(StringUtils.deleteWhitespace(baseCode + handlerMethod.code()), handlerMethod.name(), handlerMethod.remark()); + + nodes.add(node); + }); + + }); + + //按CODE值进行排序 + List rst = nodes.stream().sorted(Comparator.comparing(PermNode::getCode)).collect(Collectors.toList()); + + //获取重复code值的列表 + List codes = rst.stream() + .collect(Collectors.groupingBy(a -> a.getCode(), Collectors.counting())) + .entrySet().stream() + .filter(entry -> entry.getValue() > 1) + .map(entry -> entry.getKey()) + .collect(Collectors.toList()); + + if (codes.size() > 0) { + throw new RuntimeException("权限CODE值重复:" + JSON.toJSONString(codes)); + } + + return rst; + } + + public static List getDictEntityList() { + List list = new ArrayList<>(); + + Set clazzes = ClassScanner.scan("com.wsnet.move.entity, com.xsy.core.tms.entity, com.xsy.core.user.entity", DbTable.class); + + clazzes.forEach(item -> { + DbTable annotation = (DbTable) item.getAnnotation(DbTable.class); + + if (annotation.dict()) { + + DictDTO dto = new DictDTO(); + dto.setId(item.getName()); + dto.setText(annotation.desc()); + + list.add(dto); + } + }); + + return list; + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ReflectKit.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ReflectKit.java new file mode 100644 index 0000000..e4c31db --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ReflectKit.java @@ -0,0 +1,267 @@ +package com.haitonggauto.rtosc.common.utils; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.google.common.base.CaseFormat; +import com.haitonggauto.rtosc.common.db.anno.DbColumn; +import com.haitonggauto.rtosc.common.db.anno.DbTable; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import com.haitonggauto.rtosc.common.db.metadata.ClassMetadata; +import com.haitonggauto.rtosc.common.exception.FieldNotExistsException; +import com.haitonggauto.rtosc.common.exception.NoAnnotationException; +import com.haitonggauto.rtosc.common.exception.NotBaseEntityTypeException; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.util.ReflectionUtils; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; + +public final class ReflectKit { + private static final Map CLASS_METADATA_MAP = new ConcurrentHashMap(); + + /** + * 获取类的元数据 + * @param clazz + * @param + * @return + * @throws Exception + */ + public static ClassMetadata getClassMetaData(Class clazz) { + String key = clazz.getName(); + ClassMetadata classMetadata = CLASS_METADATA_MAP.get(key); + if (classMetadata != null) { + return classMetadata; + } + // 判断是否为baseEntity类型 + if (!BaseEntity.class.isAssignableFrom(clazz)) { + throw new NotBaseEntityTypeException(String.format("类:%s, 非BaseEntity类型", clazz.getName())); + } + + // 缓存为空,则需要解析 + classMetadata = new ClassMetadata(); + classMetadata.setClazz(clazz); + + // 获取直实数据库表名 + TableName tableName = AnnotationUtils.findAnnotation(clazz, TableName.class); + if (tableName != null) { + classMetadata.setDbName(tableName.value()); + } else { + classMetadata.setDbName(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, clazz.getSimpleName())); + } + + // 自定义配置项 + DbTable dbTable = AnnotationUtils.findAnnotation(clazz, DbTable.class); + if (dbTable != null) { + classMetadata.setService(dbTable.service()); // 服务提供方 + classMetadata.setDict(dbTable.dict()); // 是否是字典 + classMetadata.setDbDesc(dbTable.desc()); // 描述 + } else { + classMetadata.setDict(false); // 默认不是字典 + } + + if (classMetadata.isDict()) { // 如果为字典, 则设置字典的基础数据 + if (StringUtils.isAnyEmpty(dbTable.idField(), dbTable.textField())) { + throw new FieldNotExistsException(String.format("类:%s, 为字典数据时,idField和textField不能为空", clazz.getName())); + } + ClassMetadata.DictMetadata dictMetadata = new ClassMetadata.DictMetadata(dbTable.idField(), dbTable.textField()); + dictMetadata.setRefField(dbTable.refField()); + dictMetadata.setExtraField(Arrays.asList(dbTable.extraField())); + dictMetadata.setFilterField(dbTable.filterField()); + + classMetadata.setDictMetadata(dictMetadata); + } + + // 解析出所有的属性 + List fieldMetadataList = new ArrayList<>(); + ReflectionUtils.doWithFields(clazz, (field) -> { + // 过滤掉不需要的字段 + String fieldName = field.getName(); + if (StringUtils.equalsIgnoreCase("serialVersionUID", fieldName)) { + return; + } + ClassMetadata.FieldMetadata fieldMetadata = new ClassMetadata.FieldMetadata(); + fieldMetadata.setField(fieldName); + fieldMetadata.setClazz(field.getType()); + TableField f = field.getAnnotation(TableField.class); + if (f != null) { + fieldMetadata.setColumn(f.value()); + fieldMetadata.setExist(f.exist()); + if (!f.exist()) { + return; // 过滤掉数据库中不存在的字段 + } + } else { + fieldMetadata.setExist(true); + } + DbColumn d = field.getAnnotation(DbColumn.class); + if (d != null) { + fieldMetadata.setDesc(d.desc()); + if (StringUtils.isEmpty(fieldMetadata.getColumn())) { + fieldMetadata.setColumn(d.column()); + } + } + if (StringUtils.isEmpty(fieldMetadata.getColumn())) { + // 将属性名,转成下划线模式 + String col = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, fieldMetadata.getField()); + fieldMetadata.setColumn(col); + } + // 判断是否baseEntity类型 + boolean flag = false; + if (BaseEntity.class.isAssignableFrom(fieldMetadata.getClazz())) { + flag = true; + } else if (Collection.class.isAssignableFrom(fieldMetadata.getClazz())) { // 判断是否为集合属性 + flag = true; + + Class refClazz = field.getDeclaringClass(); + if (!BaseEntity.class.isAssignableFrom(refClazz)) { + throw new NotBaseEntityTypeException(String.format("类:%s, 非BaseEntity类型", refClazz.getName())); + } + fieldMetadata.setRefClazz(refClazz); + } + if (flag) { + if (d == null) { + throw new NoAnnotationException(String.format("类:%s, 集合类型字段%s,缺少@DbColumn注解", clazz.getName(), fieldName)); + } + if (StringUtils.isEmpty(d.column())) { + throw new NoAnnotationException(String.format("类:%s, BaseEntity类型字段%s,需要配置column", clazz.getName(), fieldName)); + } + fieldMetadata.setColumn(d.column()); + } + + fieldMetadataList.add(fieldMetadata); + }); + + // 所有配置的字段 + List allFields = fieldMetadataList.stream().map(item -> item.getField()).collect(Collectors.toList()); + + // 验证字典属性是否配置正确 + if (classMetadata.isDict()) { + List fields = new ArrayList<>(); + + ClassMetadata.DictMetadata dictMetadata = classMetadata.getDictMetadata(); + fields.add(dictMetadata.getIdField()); + fields.add(dictMetadata.getTextField()); + fields.add(dictMetadata.getFilterField()); + fields.add(dictMetadata.getRefField()); + fields.addAll(dictMetadata.getExtraField()); + + fields = fields.stream().filter(item -> StringUtils.isNotEmpty(item)).distinct() + .filter(item -> !allFields.contains(item)) + .collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(fields)) { + throw new FieldNotExistsException(String.format("类:%s, 为字典数据配置错误,有属性不存在: %s", clazz.getName(), StringUtils.join(fields, ","))); + } + } + + // 验证BaseEntity或List的column是否配置正确 + List refFields = fieldMetadataList.stream().filter(item -> item.getRefClazz() != null || BaseEntity.class.isAssignableFrom(item.getClazz())).map(item -> item.getColumn()).distinct() + .filter(item -> !allFields.contains(item)) + .collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(refFields)) { + throw new FieldNotExistsException(String.format("类:%s, BaseEntity或List,有属性配置不存在: %s", clazz.getName(), StringUtils.join(refFields, ","))); + } + + classMetadata.setFields(fieldMetadataList); + // 保存到缓存 + CLASS_METADATA_MAP.put(key, classMetadata); + + return classMetadata; + } + + /** + * 获取直接查询对象 + * 例*|f1,f2,f3+a@f1,f2+b@f1,f2+b@c@f1,f2+b@e@f@f1,f2 + * 这里就是需要取出*|f1,f2,f3 + * @param classMetadata + * @param routes + * @return + */ + public static List getSelectFields(ClassMetadata classMetadata, List routes) { + List selectRoutes = routes.stream().filter(item -> StringUtils.countMatches(item, "@") == 0).collect(Collectors.toList()); + List selectFields = Arrays.stream(StringUtils.split(StringUtils.join(selectRoutes, ","), ",")).distinct().collect(Collectors.toList()); + // 默认添加上Id + selectFields.add("id"); + + if (selectFields.contains("*")) { + selectFields.clear(); + selectFields.add("*"); + } else { + List attachFields = getAttachFields(classMetadata, routes); + // 对查询字段进行合并 + selectFields = CollectionUtils.union(selectFields, attachFields).stream().distinct().sorted().collect(Collectors.toList()); + } + return selectFields; + } + + /** + * 获取直接查询子对象需要的字段 + * 例*|f1,f2,f3+a@f1,f2+b@f1,f2+b@c@f1,f2+b@e@f@f1,f2 + * 这里就是需要取出a,b + * @param metadata + * @param routes + * @return + */ + private static List getAttachFields(ClassMetadata metadata, List routes) { + List nextRoutes = routes.stream() + .filter(item -> StringUtils.countMatches(item, '@') > 0) + .map(item -> StringUtils.substringBefore(item, "@")) + .distinct() + .collect(Collectors.toList()); + + List fieldMetadataList = metadata.getFields(); + // 属性MAP + Map fieldMetadataMap = fieldMetadataList.stream().collect(Collectors.toMap(ClassMetadata.FieldMetadata::getField, item -> item)); + + List rst = new ArrayList<>(); + + if (CollectionUtils.isNotEmpty(nextRoutes)) { + for (String n : nextRoutes) { + if (!fieldMetadataMap.containsKey(n)) { + throw new FieldNotExistsException(String.format("类:%s, 不存在属性: %s" , metadata.getClazz().getName(), n)); + } + if (BaseEntity.class.isAssignableFrom(fieldMetadataMap.get(n).getClazz())) { + rst.add(fieldMetadataMap.get(n).getColumn()); + } + } + } + + return rst; + } + + /** + * + * @param rootClass + * @param objRoute one@two@three + * @return + */ + public static Class getTargetClassByRoute(Class rootClass, String objRoute) { + if (StringUtils.isEmpty(objRoute)) { + return rootClass; + } + + Class rst = rootClass; + + for (String item : StringUtils.split(objRoute, "@")) { + ClassMetadata classMetadata = ReflectKit.getClassMetaData(rst); + + List fieldMetadataList = classMetadata.getFields(); + // 属性MAP + Map fieldMetadataMap = fieldMetadataList.stream().collect(Collectors.toMap(ClassMetadata.FieldMetadata::getField, p -> p)); + if (!fieldMetadataMap.containsKey(item)) { + throw new FieldNotExistsException(String.format("类:%s, 不存在属性: %s" , rst.getName(), item)); + } + ClassMetadata.FieldMetadata fieldMetadata = fieldMetadataMap.get(item); + + if (!BaseEntity.class.isAssignableFrom(rst)) { + throw new NotBaseEntityTypeException(String.format("类:%s, 属性: %s, 非BaseEntity类型" , rst.getName(), item)); + } + + rst = (Class) fieldMetadata.getClazz(); + } + + return rst; + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/RequestUtil.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/RequestUtil.java new file mode 100644 index 0000000..b791782 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/RequestUtil.java @@ -0,0 +1,113 @@ +package com.haitonggauto.rtosc.common.utils; + +import org.apache.commons.lang3.StringUtils; + +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; + +public final class RequestUtil { + + /** + * 构造方法
+ */ + private RequestUtil() { + + } + + public static String getRefererUrl(HttpServletRequest request) { + return request.getHeader("referer"); + } + + /** + * 方法名称:获取客户端信息
+ * 概要说明:根据请求获取客户端信息。
+ * + * @param request + * 请求 + * @return String 客户端信息 + */ + public static String getClientInfo(HttpServletRequest request) { + + String ipAddress = null; + ipAddress = request.getHeader("x-forwarded-for"); + if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getHeader("Proxy-Client-IP"); + } + if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getHeader("WL-Proxy-Client-IP"); + } + if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getHeader("HTTP_CLIENT_IP"); + } + if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getHeader("HTTP_X_FORWARDED_FOR"); + } + if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getRemoteAddr(); + if (ipAddress.equals("127.0.0.1") || ipAddress.equals("0:0:0:0:0:0:0:1")) { + // 根据网卡取本机配置的IP + InetAddress inet = null; + try { + inet = InetAddress.getLocalHost(); + } catch (UnknownHostException e) { + e.printStackTrace(); + } + ipAddress = inet.getHostAddress(); + } + + } + + // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割 + if (ipAddress != null && ipAddress.length() > 15) { + if (ipAddress.indexOf(",") > 0) { + ipAddress = ipAddress.substring(0, ipAddress.indexOf(",")); + } + } + return ipAddress; + } + + /** + * 方法名称:判断客户端是否为Firefox
+ * 概要说明:
+ * + * @param request + * 请求 + * @return boolean 是否为Firefox + */ + public static boolean isFirefox(HttpServletRequest request) { + String agent = request.getHeader("USER-AGENT").toUpperCase(); + return (!StringUtils.isBlank(agent) && agent.indexOf("FIREFOX") > 0); + } + + public static byte[] getRequestPostBytes(HttpServletRequest request) throws IOException { + int contentLength = request.getContentLength(); + if (contentLength < 0) { + return null; + } + byte[] buffer = new byte[contentLength]; + for (int i = 0; i < contentLength;) { + + int readlen = request.getInputStream().read(buffer, i, contentLength - i); + if (readlen == -1) { + break; + } + i += readlen; + } + return buffer; + } + + public static String getRequestPostStr(HttpServletRequest request) throws IOException { + byte[] buffer = getRequestPostBytes(request); + String charEncoding = request.getCharacterEncoding(); + if (charEncoding == null) { + charEncoding = "UTF-8"; + } + return buffer == null ? "" : new String(buffer, charEncoding); + } + + public static boolean isJsonRequest(HttpServletRequest request){ + return (request.getHeader("accept").contains("application/json") || StringUtils.contains(request.getHeader("X-Requested-With"), "XMLHttpRequest")); + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ResultUtil.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ResultUtil.java new file mode 100644 index 0000000..4c97701 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ResultUtil.java @@ -0,0 +1,36 @@ +package com.haitonggauto.rtosc.common.utils; + +import com.haitonggauto.rtosc.common.dto.Result; + +public class ResultUtil { + public static Result success(T data) { + Result rst = new Result<>(); + rst.setCode(0); + rst.setMsg("success"); + rst.setData(data); + return rst; + } + + public static Result success(T data, String msg) { + Result rst = new Result<>(); + rst.setCode(0); + rst.setMsg(msg); + rst.setData(data); + return rst; + } + + public static Result failure(int code, String msg) { + Result rst = new Result<>(); + rst.setCode(code); + rst.setMsg(msg); + return rst; + } + + public static Result failure(int code, String msg, T data) { + Result rst = new Result<>(); + rst.setCode(code); + rst.setMsg(msg); + rst.setData(data); + return rst; + } +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ValidList.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ValidList.java new file mode 100644 index 0000000..ac266f3 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ValidList.java @@ -0,0 +1,135 @@ +package com.haitonggauto.rtosc.common.utils; + +import javax.validation.Valid; +import java.util.*; + + +public class ValidList implements List { + + @Valid + private List list = new LinkedList<>(); + + @Override + public int size() { + return list.size(); + } + + @Override + public boolean isEmpty() { + return list.isEmpty(); + } + + @Override + public boolean contains(Object o) { + return list.contains(o); + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + @Override + public Object[] toArray() { + return list.toArray(); + } + + @Override + public T[] toArray(T[] a) { + return list.toArray(a); + } + + @Override + public boolean add(E e) { + return list.add(e); + } + + @Override + public boolean remove(Object o) { + return list.remove(o); + } + + @Override + public boolean containsAll(Collection c) { + return list.containsAll(c); + } + + @Override + public boolean addAll(Collection c) { + return list.addAll(c); + } + + @Override + public boolean addAll(int index, Collection c) { + return list.addAll(index, c); + } + + @Override + public boolean removeAll(Collection c) { + return list.removeAll(c); + } + + @Override + public boolean retainAll(Collection c) { + return list.retainAll(c); + } + + @Override + public void clear() { + list.clear(); + } + + @Override + public E get(int index) { + return list.get(index); + } + + @Override + public E set(int index, E element) { + return list.set(index, element); + } + + @Override + public void add(int index, E element) { + list.add(index, element); + } + + @Override + public E remove(int index) { + return list.remove(index); + } + + @Override + public int indexOf(Object o) { + return list.indexOf(o); + } + + @Override + public int lastIndexOf(Object o) { + return list.lastIndexOf(o); + } + + @Override + public ListIterator listIterator() { + return list.listIterator(); + } + + @Override + public ListIterator listIterator(int index) { + return list.listIterator(index); + } + + @Override + public List subList(int fromIndex, int toIndex) { + return list.subList(fromIndex, toIndex); + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + +} \ No newline at end of file diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ValidationGroup.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ValidationGroup.java new file mode 100644 index 0000000..af6e7a4 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/ValidationGroup.java @@ -0,0 +1,15 @@ +package com.haitonggauto.rtosc.common.utils; + +public class ValidationGroup { + // 新增 + public interface insert {}; + + // 修改 + public interface update {}; + + // 删除 + public interface delete {}; + + // 查询 + public interface query {}; +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/WrapperKit.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/WrapperKit.java new file mode 100644 index 0000000..0bb2205 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/utils/WrapperKit.java @@ -0,0 +1,351 @@ +package com.haitonggauto.rtosc.common.utils; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.haitonggauto.rtosc.common.context.UserContext; +import com.haitonggauto.rtosc.common.db.anno.DbQuery; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import com.haitonggauto.rtosc.common.db.enums.SqlSymbol; +import com.haitonggauto.rtosc.common.db.metadata.ClassMetadata; +import com.haitonggauto.rtosc.common.db.query.BaseQuery; +import com.haitonggauto.rtosc.common.dto.LoginUser; +import com.haitonggauto.rtosc.common.exception.FieldNotExistsException; +import com.haitonggauto.rtosc.common.exception.NoLoginException; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.util.ReflectionUtils; + +import java.util.*; +import java.util.stream.Collectors; + +public interface WrapperKit { + // 是否以管理员的身份进行查询, 默认不是 + default boolean admin() { + return true; + } + + /** + * 获取权限的基础服务 + * @return + */ + default void loadPerm(Class clazz, BaseQuery query) { + if (admin()) { + return; // 如果是以管理员进行查询,则不需要在加载,非系统管理员登录,但是需要查询全局数据时 + } + + LoginUser user = UserContext.getUser(); + if (user == null) {// 系统未登陆 + throw new NoLoginException(); + } + if (user.isAdmin()) { + return; + } + + // 初始化用户 + if (query.getU$id() == null) { + query.setU$id(user.getUserId()); + query.setR$id(user.getRoleId()); + } + + } + + /** + * 将BaseQuery对象,组装成为Wrapper对象,里面涉及到了权限的处理 + * @param clazz + * @param query + * @param + * @return + * @throws Exception + */ + default Wrapper changeBaseQueryToWrapper(Class clazz, BaseQuery query) { + // 加载T对象的权限 + this.loadPerm(clazz, query); + + ClassMetadata classMetadata = ReflectKit.getClassMetaData(clazz); + + // 获取查询的字段 + List routes = Arrays.asList(StringUtils.split(query.getFields(), "+")); + List selectFields = ReflectKit.getSelectFields(classMetadata, routes); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntityClass(clazz); + + List fieldMetadataList = classMetadata.getFields(); + // 属性MAP + Map fieldMetadataMap = fieldMetadataList.stream().collect(Collectors.toMap(ClassMetadata.FieldMetadata::getField, item -> item)); + + // 查询字段, 包括字段权限操作 + if (CollectionUtils.isNotEmpty(selectFields)) { + if (CollectionUtils.isNotEmpty(query.getExcludeFields())) { // 有排除属性,需要特殊处理。 + if (selectFields.contains("*")) { + selectFields = fieldMetadataList.stream().filter(item -> item.getExist()) // 过滤出数据库有的属性 + .filter(item -> !query.getExcludeFields().contains(item.getField())) // 过滤出不能查询的属性 + .map(item -> item.getField()).collect(Collectors.toList()); + } else { + selectFields = selectFields.stream().filter(item -> !query.getExcludeFields().contains(item)) // 过滤出不能查询的属性 + .collect(Collectors.toList()); + } + } + + if (!selectFields.contains("*")) { + List columns = selectFields.stream().map(item -> fieldMetadataMap.get(item).getColumn()).collect(Collectors.toList()); + String[] c = new String[columns.size()]; + c = columns.toArray(c); + queryWrapper.select(c); + } + } + // 处理数据权限 + // TODO + if (MapUtils.isNotEmpty(query.getIncludeIds())) { + if (CollectionUtils.isNotEmpty(query.getIncludeIds().get("id"))) { // 先处理主键 + if (query.getId() != null) { + if (!query.getIncludeIds().get("id").contains(query.getId())) { + query.setId(0L); // 指向一个不存在的对象 + } + } else if (CollectionUtils.isNotEmpty(query.getIds())) { + List ids = query.getIds().stream().filter(item -> query.getIncludeIds().get("id").contains(item)).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(ids)) { // 代表没有一个有权限的 + query.setId(0L); + query.setIds(null); + } + } else { + query.setIds(query.getIncludeIds().get("id").stream().collect(Collectors.toList())); + } + } + // 处理外键 + query.getIncludeIds().entrySet().stream() + .filter(item -> !StringUtils.equals("id", item.getKey())) // 过滤掉ID,因为上面已经处理过了 + .forEach(item -> { + queryWrapper.in(item.getKey(), item.getValue()); + }); + } + + // 解析查询对象 + ReflectionUtils.doWithFields(query.getClass(), (field) -> { + field.setAccessible(true); + + // 属性名称 + String fName = field.getName(); + + if (StringUtils.equalsAny(fName,"fields", "page", "rows", "u$id", "r$id", "excludeFields", "includeIds")) { + return; + } + + // 属性值 + Object fValue = field.get(query); + + // 过滤掉空值字段 + if (fValue == null) { + return; + } + + // 过滤掉空数组 + if (fValue instanceof Object[] || fValue instanceof List) { + if (CollectionUtils.sizeIsEmpty(fValue)) { + return; + } + } + + // 过滤掉空字符串 + if (StringUtils.isBlank(String.valueOf(fValue))) { + return; + } + + String alias = ""; + SqlSymbol symbol = SqlSymbol.EQ; + + // 查询注解 + DbQuery fAnn = field.getAnnotation(DbQuery.class); + if (fAnn != null) { + if (StringUtils.isNotEmpty(fAnn.field())) { + fName = fAnn.field(); + } + alias = fAnn.alias(); + symbol = fAnn.symbol(); + } + + // 组装排序条件 queryWrapper.orderByDesc("age").orderByAsc("id"); + if (StringUtils.equals("sorts", fName)) { + List sorts = (List)fValue; + sorts.forEach(item -> { + String a = item.getAlias(); + if (StringUtils.isEmpty(item.getField())) { + return; + } + if (!fieldMetadataMap.containsKey(item.getField())) { + return; + } + String column = fieldMetadataMap.get(item.getField()).getColumn(); + if (StringUtils.isNotEmpty(a)) { + column = a + "." + column; + } + if (StringUtils.equalsIgnoreCase(item.getSort(), "ASC")) { + queryWrapper.orderByAsc(column); + } else { + queryWrapper.orderByDesc(column); + } + }); + return; + } + + if (!fieldMetadataMap.containsKey(fName)) { + throw new FieldNotExistsException(String.format("类:%s, 不存在属性: %s" , classMetadata.getClazz().getName(), fName)); + } + String column = fieldMetadataMap.get(fName).getColumn(); + if (StringUtils.isNotEmpty(alias)) { + column = alias + "." + column; + } + + if (symbol == SqlSymbol.IN) { + if (fValue instanceof List) { + List vs = (List) fValue; + queryWrapper.in(column, vs.toArray()); + } else if (fValue instanceof Set) { + Set vs = (Set) fValue; + queryWrapper.in(column, vs.toArray()); + } + } else if (symbol ==SqlSymbol.LIKE) { + queryWrapper.like(column, fValue); + } else if (symbol == SqlSymbol.LLIKE) { + queryWrapper.likeLeft(column, fValue); + } else if (symbol.equals(SqlSymbol.RLIKE)) { + queryWrapper.likeRight(column, fValue); + } else if (symbol.equals(SqlSymbol.EXISTS)) { + queryWrapper.exists(column, fValue); + } else if (symbol.equals(SqlSymbol.NOT_EXISTS)) { + queryWrapper.notExists(column, fValue); + } else if (symbol.equals(SqlSymbol.GTE)) { + queryWrapper.ge(column, fValue); + } else if (symbol.equals(SqlSymbol.GT)) { + queryWrapper.gt(column, fValue); + } else if (symbol.equals(SqlSymbol.LTE)) { + queryWrapper.le(column, fValue); + } else if (symbol.equals(SqlSymbol.LT)) { + queryWrapper.lt(column, fValue); + } else { + queryWrapper.eq(column, fValue); + } + + }); + + return queryWrapper; + } + + /** + * 返回 修改的query + * @param clazz + * @param columnMap + * @param query + * @param + * @return + */ + default Wrapper changeBaseQueryToWrapper(Class clazz, Map columnMap, BaseQuery query) { + + ClassMetadata classMetadata = ReflectKit.getClassMetaData(clazz); + + + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.setEntityClass(clazz); + + List fieldMetadataList = classMetadata.getFields(); + // 属性MAP + Map fieldMetadataMap = fieldMetadataList.stream().collect(Collectors.toMap(ClassMetadata.FieldMetadata::getField, item -> item)); + + columnMap.entrySet().stream().forEach(entry -> { + if (!fieldMetadataMap.containsKey(entry.getKey())) { + throw new FieldNotExistsException(String.format("类:%s, 不存在属性: %s" , classMetadata.getClazz().getName(), entry.getKey())); + } + String column = fieldMetadataMap.get(entry.getKey()).getColumn(); + updateWrapper.set(column, entry.getValue()); + }); + + // 解析查询对象 + ReflectionUtils.doWithFields(query.getClass(), (field) -> { + field.setAccessible(true); + + // 属性名称 + String fName = field.getName(); + + if (StringUtils.equalsAny(fName,"fields", "page", "rows", "u$id", "r$id", "excludeFields", "includeIds")) { + return; + } + + // 属性值 + Object fValue = field.get(query); + + // 过滤掉空值字段 + if (fValue == null) { + return; + } + + // 过滤掉空数组 + if (fValue instanceof Object[] || fValue instanceof List) { + if (CollectionUtils.sizeIsEmpty(fValue)) { + return; + } + } + + // 过滤掉空字符串 + if (StringUtils.isBlank(String.valueOf(fValue))) { + return; + } + + String alias = ""; + SqlSymbol symbol = SqlSymbol.EQ; + + // 查询注解 + DbQuery fAnn = field.getAnnotation(DbQuery.class); + if (fAnn != null) { + if (StringUtils.isNotEmpty(fAnn.field())) { + fName = fAnn.field(); + } + alias = fAnn.alias(); + symbol = fAnn.symbol(); + } + + if (!fieldMetadataMap.containsKey(fName)) { + throw new FieldNotExistsException(String.format("类:%s, 不存在属性: %s" , classMetadata.getClazz().getName(), fName)); + } + String column = fieldMetadataMap.get(fName).getColumn(); + if (StringUtils.isNotEmpty(alias)) { + column = alias + "." + column; + } + + if (symbol == SqlSymbol.IN) { + if (fValue instanceof List) { + List vs = (List) fValue; + updateWrapper.in(column, vs.toArray()); + } else if (fValue instanceof Set) { + Set vs = (Set) fValue; + updateWrapper.in(column, vs.toArray()); + } + } else if (symbol ==SqlSymbol.LIKE) { + updateWrapper.like(column, fValue); + } else if (symbol == SqlSymbol.LLIKE) { + updateWrapper.likeLeft(column, fValue); + } else if (symbol.equals(SqlSymbol.RLIKE)) { + updateWrapper.likeRight(column, fValue); + } else if (symbol.equals(SqlSymbol.EXISTS)) { + updateWrapper.exists(column, fValue); + } else if (symbol.equals(SqlSymbol.NOT_EXISTS)) { + updateWrapper.notExists(column, fValue); + } else if (symbol.equals(SqlSymbol.GTE)) { + updateWrapper.ge(column, fValue); + } else if (symbol.equals(SqlSymbol.GT)) { + updateWrapper.gt(column, fValue); + } else if (symbol.equals(SqlSymbol.LTE)) { + updateWrapper.le(column, fValue); + } else if (symbol.equals(SqlSymbol.LT)) { + updateWrapper.lt(column, fValue); + } else { + updateWrapper.eq(column, fValue); + } + + }); + + return updateWrapper; + } + +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/validate/MoreThan.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/validate/MoreThan.java new file mode 100644 index 0000000..3b55c22 --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/validate/MoreThan.java @@ -0,0 +1,32 @@ +package com.haitonggauto.rtosc.common.validate; + +import javax.validation.Constraint; +import javax.validation.Payload; +import java.lang.annotation.*; + +/** + * 可以用于数字或日期的比较 + */ +@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Constraint(validatedBy = MoreThanValidator.class) +public @interface MoreThan { + + /** + * 违反校验时的错误信息 + */ + String message() default "{MoreThan.message}"; + + /** + * 用于指定校验的条件 + */ + Class[] groups() default {}; + + Class[] payload() default {}; + + // 比较字段一 + String field1(); + // 比较字段二 + String field2(); +} diff --git a/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/validate/MoreThanValidator.java b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/validate/MoreThanValidator.java new file mode 100644 index 0000000..47a10af --- /dev/null +++ b/nuzar-customer-common/src/main/java/com/haitonggauto/rtosc/common/validate/MoreThanValidator.java @@ -0,0 +1,49 @@ +package com.haitonggauto.rtosc.common.validate; + +import cn.hutool.core.date.DateUtil; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanWrapperImpl; + +import javax.validation.ConstraintValidator; +import javax.validation.ConstraintValidatorContext; +import java.math.BigDecimal; +import java.util.Date; + +public class MoreThanValidator implements ConstraintValidator { + // 字段一 + private String field1; + // 字段二 + private String field2; + + @Override + public void initialize(final MoreThan constraintAnnotation) { + field1 = constraintAnnotation.field1(); + field2 = constraintAnnotation.field2(); + } + + @Override + public boolean isValid(final Object src, ConstraintValidatorContext context) { + BeanWrapperImpl wrapper = new BeanWrapperImpl(src); + + if (StringUtils.isAnyEmpty(field1, field1)) { + return false; + } + + Object value1 = wrapper.getPropertyValue(field1); + Object value2 = wrapper.getPropertyValue(field2); + + if (value1 == null || value2 == null) { + return true; + } + + if (value1 instanceof Number && value2 instanceof Number) { // 数值比较 + return new BigDecimal(String.valueOf(value2)).compareTo(new BigDecimal(String.valueOf(value1))) >= 0; // 数值2大于等于数值1 + } else if (value1 instanceof Date && value2 instanceof Date) { // 日期比较 + return DateUtil.compare((Date)value2, (Date)value1) >= 0; + } else if (value1 instanceof String && value2 instanceof String) { // 字符串只做相等比较 + return StringUtils.equals((String)value1, (String)value2); + } + + return false; + } +} diff --git a/nuzar-customer-controller/Dockerfile b/nuzar-customer-controller/Dockerfile new file mode 100644 index 0000000..e2afd2e --- /dev/null +++ b/nuzar-customer-controller/Dockerfile @@ -0,0 +1,7 @@ +FROM adoptopenjdk/openjdk8:ubi +WORKDIR /home +COPY target/*.jar /home/app.jar +EXPOSE 9000 +ENV TZ "Asia/Shanghai" +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime +ENTRYPOINT ["java","-jar","/home/app.jar"] \ No newline at end of file diff --git a/nuzar-customer-controller/pom.xml b/nuzar-customer-controller/pom.xml new file mode 100644 index 0000000..e1cebcd --- /dev/null +++ b/nuzar-customer-controller/pom.xml @@ -0,0 +1,103 @@ + + + + com.haitonggauto.rtosc + nuzar-customer + 1.0-SNAPSHOT + + 4.0.0 + nuzar-customer-controller + jar + + 8 + 8 + latest + ${project.artifactId} + + + + + + com.haitonggauto.rtosc + nuzar-customer-business + + + + com.nuzar + nuzar-web-starter + + + com.nuzar + nuzar-nacos-starter + + + com.nuzar + nuzar-swagger-starter + + + junit + junit + test + + + org.springframework.boot + spring-boot-test + test + + + org.springframework + spring-test + test + + + com.itextpdf + itext7-core + ${itext.version} + pom + + + + org.asynchttpclient + async-http-client + 2.12.3 + + + com.nuzar + nuzar-echo-starter + + + + com.nuzar + nuzar-redis-starter + + + + jakarta.json + jakarta.json-api + 2.0.1 + + + elasticsearch-rest-client + org.elasticsearch.client + 7.17.2 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.6.11 + + + + repackage + + + + + + + + diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/NuzarCustomerApplication.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/NuzarCustomerApplication.java new file mode 100644 index 0000000..eab6eb3 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/NuzarCustomerApplication.java @@ -0,0 +1,33 @@ +package com.haitonggauto.rtosc; + +import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.cloud.openfeign.EnableFeignClients; + +/** + * @Author limng + * @Date 2022/12/14 + */ +@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) +@EnableCreateCacheAnnotation +//开启Feign支持 +@EnableFeignClients +public class NuzarCustomerApplication implements CommandLineRunner { + + /** + * application entry point + * + * @param args + */ + public static void main(String[] args) { + SpringApplication.run(NuzarCustomerApplication.class, args); + } + + @Override + public void run(String... args) throws Exception { + + } +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/aop/HandlerLogAspect.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/aop/HandlerLogAspect.java new file mode 100644 index 0000000..59f7fc5 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/aop/HandlerLogAspect.java @@ -0,0 +1,10 @@ +package com.haitonggauto.rtosc.aop; + +import com.haitonggauto.rtosc.common.aop.BaseHandlerLogAspect; +import org.aspectj.lang.annotation.Aspect; +import org.springframework.stereotype.Component; + +//@Aspect +//@Component +public class HandlerLogAspect extends BaseHandlerLogAspect { +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarMiniApi.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarMiniApi.java new file mode 100644 index 0000000..a11ce01 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarMiniApi.java @@ -0,0 +1,17 @@ +package com.haitonggauto.rtosc.api; + +import com.nuzar.cloud.common.annotations.ResponseWrapper; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + + +//@FeignClient(name = "https://rtops4.haitongauto.com/tos/mini-admin") +@FeignClient(name = "rtos-mini-admin") +public interface NuzarMiniApi { + @ResponseWrapper(wrapper=false) + @PostMapping("/openApi/getAppointmentByVin") + List getAppointmentByVin(@RequestBody List vinList); +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarOpenApi.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarOpenApi.java new file mode 100644 index 0000000..3f8ac3b --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarOpenApi.java @@ -0,0 +1,111 @@ +package com.haitonggauto.rtosc.api; + +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 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.List; + + +//@FeignClient(name = "https://rtops4.haitongauto.com/tos/api") +@FeignClient(name = "rtos-openapi") +public interface NuzarOpenApi { + + // 根据港区ID获取国家 + @GetMapping(value = "/miniapp/portAreaManage/getCountry") + PortAreaCountryDTO getPortAreaCountry(@RequestParam("potId") String potId); + + // 车型 + @GetMapping(value = "/miniapp/getVehicleModel") + List getCartTypeList(); + + // 车型明细 + @GetMapping(value = "/miniapp/getVehicleModelDetail") + List getCartTypeDetailList(@RequestParam("bvmId") String bvmId); + + // 用户注册 + @PostMapping(value = "/customer/register") + RegisterDTO userRegister(@RequestBody UserAuthRequestDto user); + + // 用户登录 + @PostMapping("/customer/login") + RegisterDTO userLogin(@RequestBody LoginDTO login); + + // 客户平台查询提货申请船名航次 + @GetMapping("/customer/importPickApply/voyages") + List getDepartureShipVoyageList(@RequestBody DepartureShipVoyageQuery query); + + // 提离港区船名下拉 + @GetMapping("/customer/pickDeparture/selectShip") + List getShutoutShipList(@RequestParam("key") String key); + + // 提离港区航次下接 + @GetMapping("/customer/pickDeparture/selectVoyages") + List getShutoutVoyageList(@RequestParam("spmId") String spmId, @RequestParam("key") String key); + + // 退关货物 + @GetMapping("/customer/pickDeparture/goodsInfo") + List getShutoutCargosList(@RequestParam("spmId") String spmId, @RequestParam("vvyId") String vvyId); + + // 出口查验船名列表 + @GetMapping("/customer/exportInspectApply/selectShip") + List getExportInspectShipList(@RequestParam("key") String key); + + // 出口查验航次列表 + @GetMapping("/customer/exportInspectApply/selectVoyages") + List getExportInspectVoyageList(@RequestParam("spmId") String spmId, @RequestParam("key") String key); + + // 出口查验提单列表 + @GetMapping("/customer/exportInspectApply/selectBills") + List getExportInspectBillNoList(@RequestParam("vvyId") String vvyId, @RequestParam("key") String key); + + // 出口查验申请货物明细分页 + @GetMapping("/customer/exportInspectApply/goodsDetail") + Page getExportInspectCargos(@RequestParam("current") Integer current, + @RequestParam("planId") String planId, + @RequestParam("size") Integer size, @RequestParam("splitId") String splitId); + + // 进口提货申请船名 + @GetMapping("/customer/importPickApply/selectShip") + List getImportTakeShipList(@RequestParam("key") String key); + + // 进口提货申请航次 + @GetMapping("/customer/importPickApply/selectVoyages") + List getImportTakeVoyageList(@RequestParam("spmId") String spmId, @RequestParam("key") String key); + + // 根据航次ID查询提单信息 + @GetMapping("/customer/importPickApply/billInfo") + List getBillInfo(@RequestParam("vvyId") String vvyId); + + // 进口查验船名列表 + @GetMapping("/customer/importInspectApply/selectShip") + List getImportInspectShipList(@RequestParam("key") String key); + + // 进口查验航次列表 + @GetMapping("/customer/importInspectApply/selectVoyages") + List getImportInspectVoyageList(@RequestParam("spmId") String spmId, @RequestParam("key") String key); + + // 进口查验提单列表 + @GetMapping("/customer/importInspectApply/selectBills") + List getImportInspectBillNoList(@RequestParam("vvyId") String vvyId, @RequestParam("key") String key); + + // 进口查验申请货物明细分页 + @GetMapping("/customer/importInspectApply/goodsDetail") + Page getImportInspectCargos(@RequestParam("current") Integer current, + @RequestParam("planId") String planId, + @RequestParam("size") Integer size, @RequestParam("splitId") String splitId); + + // 车辆状态 + @PostMapping("/customer/yard/vinCodeStatusNew") + List getVinStatus(@RequestBody VinStatusRequest req); + + // 查验状态 + @PostMapping("/customer/exportInspectApply/applyId/status") + List getInspectStatusStatus(@RequestBody List req); +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarPubApi.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarPubApi.java new file mode 100644 index 0000000..5e54940 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarPubApi.java @@ -0,0 +1,66 @@ +package com.haitonggauto.rtosc.api; + +import com.haitonggauto.rtosc.api.dto.*; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + + +//@FeignClient(name = "https://rtops4.haitongauto.com/tos/pub") +@FeignClient(name = "basic-service") +public interface NuzarPubApi { + + + //车辆操作模式 + @GetMapping(value = "/typeRef/domain/OPPROC_MODE") + List getOperateTypeList(); + + // 备件操作模式 + @GetMapping(value = "/typeRef/domain/PART_OPPROC_MODE") + List getSpareOperateTypeList(); + + // 贸易类型 + @GetMapping(value = "/typeRef/domain/TRADE_TYPE") + List getTradType(); + + // 所有船舶 + @GetMapping(value = "/shipManage/queryAllShipManage") + List getAllShip(); + + // 所有港口 + @GetMapping(value = "/port/queryPort") + List getPortList(); + + // 所有港区 + @GetMapping(value = "/portAreaManage/selectPortArea") + List getPortAreaList(); + + // 国家城市 + @GetMapping(value = "/city/queryOrigin") + List getCountryList(@RequestParam("key") String key); + + // 运输方式 + @GetMapping(value = "/typeRef/domain/TRANSPORT_TYPE") + List getTransportWayList(); + + // 品牌 + @GetMapping(value = "/brand/queryBrand") + List getBrandList(); + + // 货类列表 + @GetMapping(value = "/typeRef/domain/CARGO_TYPE") + List getCargoTypeList(); + + // 源类型 + @GetMapping(value = "/typeRef/domain/SOURCE_TYPE") + List getEnergyTypeList(); + + // 公司列表 + @PostMapping(value = "/customerManage/query/cueTypes") + List getCompanyList(@RequestBody List cueTypes); + + // 根据客户名称查询客户信息 + @GetMapping(value = "/customerManage/query/name") + CompanyDTO getCompanyByName(@RequestParam("cueCnname") String cueCnname); +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarShpApi.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarShpApi.java new file mode 100644 index 0000000..4e368b3 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarShpApi.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.api; + +import com.haitonggauto.rtosc.api.dto.CheckVinReq; +import com.haitonggauto.rtosc.api.dto.VoyageDTO; +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.List; + +//@FeignClient(name = "https://rtops4.haitongauto.com/tos/shp") +@FeignClient(name = "shipment-service") +public interface NuzarShpApi { + + @GetMapping("/vesselVoyages/queryVvyName") + VoyageDTO getVoyageNameByVvyName(@RequestParam("vvyName") String vvyName); + + @PostMapping("/checkDup/checkDupVincode") + List checkVinRepeat(@RequestBody List req); +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarYardApi.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarYardApi.java new file mode 100644 index 0000000..728d11f --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/NuzarYardApi.java @@ -0,0 +1,20 @@ +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.VoyageDTO; +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.List; + +//@FeignClient(name = "https://rtops4.haitongauto.com/tos/yard") +@FeignClient(name = "yard-service") +public interface NuzarYardApi { + + @PostMapping("/yardCustomsRelease/queryCustomNoByvvyIdAndMnf") + List getVoyageNameByVvyName(@RequestBody CustomNoReq customNoReq); +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/BillInfoDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/BillInfoDTO.java new file mode 100644 index 0000000..3b638ca --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/BillInfoDTO.java @@ -0,0 +1,57 @@ +package com.haitonggauto.rtosc.api.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("提单信息") +public class BillInfoDTO { + @ApiModelProperty(value = "") + private Boolean abnormal; + + @ApiModelProperty(value = "提单异常信息") + private String abnormalInfo; + + @ApiModelProperty(value = "是否受理") + private Boolean applied; + + @ApiModelProperty(value = "品牌ID") + private String brdId; + + @ApiModelProperty(value = "货物名称") + private String brdName; + + @ApiModelProperty(value = "车型ID") + private String bvmId; + + @ApiModelProperty(value = "车辆数量") + private String carAmount; + + @ApiModelProperty(value = "报关单号") + private String customsDeclareNo; + + @ApiModelProperty(value = "是否有拆分") + private Integer hasSplit; + + @ApiModelProperty(value = "是否查验") + private Boolean inspected; + + @ApiModelProperty(value = "是否是拆分出来的卸船计划") + private Integer isSplitPlan; + + @ApiModelProperty(value = "提单号") + private String mnfBl; + + @ApiModelProperty(value = "备件数量") + private Integer partAmount; + + @ApiModelProperty(value = "卸船计划ID") + private String supId; + + @ApiModelProperty(value = "总数") + private Integer totalAmount; + + @ApiModelProperty(value = "卸船计划拆分ID") + private String upsId; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/BrandDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/BrandDTO.java new file mode 100644 index 0000000..37ac01d --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/BrandDTO.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.api.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class BrandDTO implements Serializable { + private String brdId; + + private String brdCode; + + private String brdName; + + private String brdEnname; + + private String valid; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CarTypeDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CarTypeDTO.java new file mode 100644 index 0000000..5bb11bb --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CarTypeDTO.java @@ -0,0 +1,14 @@ +package com.haitonggauto.rtosc.api.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CarTypeDTO implements Serializable { + private String id; + + private String code; + + private String name; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CarTypeDetailDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CarTypeDetailDTO.java new file mode 100644 index 0000000..3215baf --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CarTypeDetailDTO.java @@ -0,0 +1,15 @@ +package com.haitonggauto.rtosc.api.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CarTypeDetailDTO implements Serializable { + + private String bvdId; + + private String bvdCode; + + private String bvdType; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CheckVinReq.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CheckVinReq.java new file mode 100644 index 0000000..1f2093b --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CheckVinReq.java @@ -0,0 +1,22 @@ +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 CheckVinReq implements Serializable { + @ApiModelProperty("车架号是否重复") + private Boolean isRepetition; + + @ApiModelProperty("港区ID") + private String pamId; + + @ApiModelProperty("车架号") + private String vinCode; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CityDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CityDTO.java new file mode 100644 index 0000000..bbf1682 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CityDTO.java @@ -0,0 +1,35 @@ +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 CityDTO implements Serializable { + @ApiModelProperty("城市id") + private String ciyId; + + @ApiModelProperty("国家Code") + private String ciyCode; + + @ApiModelProperty("城市中文名称") + private String ciyCnname; + + @ApiModelProperty("国家英文名") + private String ciyEnname; + + @ApiModelProperty("国家中文名") + private String ctyCnname; + + @ApiModelProperty("国家Code") + private String ctyCode; + + @ApiModelProperty("国家英文名") + private String ctyEnname; + + @ApiModelProperty("国家id") + private String ctyId; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CompanyDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CompanyDTO.java new file mode 100644 index 0000000..c884369 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CompanyDTO.java @@ -0,0 +1,123 @@ +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 CompanyDTO implements Serializable { + @ApiModelProperty("") + private String clearingTypeName; + + @ApiModelProperty("") + private String createTime; + + @ApiModelProperty("") + private String createUser; + + @ApiModelProperty("所属国家转义") + private String ctyCnname; + + @ApiModelProperty("所属国家") + private String ctyId; + + @ApiModelProperty("客户简称") + private String cueAbbreviation; + + @ApiModelProperty("客户地址") + private String cueAddress; + + @ApiModelProperty("客户银行") + private String cueBank; + + @ApiModelProperty("银行账号") + private String cueBankAccount; + + @ApiModelProperty("结算方式 (日结 月结)") + private String cueClearingType; + + @ApiModelProperty("客户中文名称") + private String cueCnname; + + @ApiModelProperty("客户管理代码") + private String cueCode; + + @ApiModelProperty("颜色") + private String cueColour; + + @ApiModelProperty("联系人") + private String cueContact; + + @ApiModelProperty("海关代码") + private String cueCustomsCode; + + @ApiModelProperty("EDI代码") + private String cueEdiCode; + + @ApiModelProperty("邮箱") + private String cueEmail; + + @ApiModelProperty("英文名称") + private String cueEnname; + + @ApiModelProperty("传真") + private String cueFax; + + @ApiModelProperty("") + private String cueId; + + @ApiModelProperty("联系电话") + private String cuePhone; + + @ApiModelProperty("港务局代码") + private String cuePortOffice; + + @ApiModelProperty("邮编") + private String cuePostcode; + + @ApiModelProperty("备注") + private String cueRemark; + + @ApiModelProperty("所属船公司") + private String cueShipCompany; + + @ApiModelProperty("客户税号") + private String cueTaxId; + + @ApiModelProperty("") + private String cueType; + + @ApiModelProperty("客户类型转义") + private String cueTypeName; + + @ApiModelProperty("客户类型") + private String cueTypes; + + @ApiModelProperty("") + private Integer limit; + + @ApiModelProperty("ORACLE_ID") + private String oracleId; + + @ApiModelProperty("") + private String orderItems; + + @ApiModelProperty("租户id") + private String tenantId; + + @ApiModelProperty("权限配置") + private String termcd; + + @ApiModelProperty("") + private String updateTime; + + @ApiModelProperty("") + private String updateUser; + + @ApiModelProperty("有效标志 Y N") + private String valid; +} + diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CustomNoReq.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CustomNoReq.java new file mode 100644 index 0000000..4863254 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CustomNoReq.java @@ -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; + +@Data +@ApiModel("报关单查询请求") +public class CustomNoReq implements Serializable { + private Integer limit; + + @ApiModelProperty("提单号") + private List mnfBls; + + private List orderItems; + + @ApiModelProperty("航次id") + private List vvyIds; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CustomNoResp.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CustomNoResp.java new file mode 100644 index 0000000..52e4150 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/CustomNoResp.java @@ -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 CustomNoResp implements Serializable { + @ApiModelProperty("报关单号") + private String customsDeclareNo; + + @ApiModelProperty("提单号") + private String mnfBl; + + @ApiModelProperty("航次id") + private String vvyId; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/DepartureShipVoyage.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/DepartureShipVoyage.java new file mode 100644 index 0000000..f5e6212 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/DepartureShipVoyage.java @@ -0,0 +1,66 @@ +package com.haitonggauto.rtosc.api.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("出口提离港区船名航次") +public class DepartureShipVoyage { + @ApiModelProperty(value = "是否关仓") + private Integer closeWarehouse; + + @ApiModelProperty(value = "进出口标志") + private String importExportFlag; + + @ApiModelProperty(value = "进出口标志") + private String importExportFlagName; + + @ApiModelProperty(value = "航线id 从基础数据航线信息获取") + private String lcoId; + + @ApiModelProperty(value = "装卸要求") + private String loadUnloadRequirements; + + @ApiModelProperty(value = "港区ID") + private String pamId; + + @ApiModelProperty(value = "港区") + private String pamIdDesc; + + private String shipAgent; + + @ApiModelProperty(value = "船代ID") + private String shipAgentId; + + @ApiModelProperty(value = "船公司ID") + private String shipComId; + + @ApiModelProperty(value = "船舶ID") + private String spmId; + + @ApiModelProperty(value = "航次下的货物是否理货完成") + private String tallyCompleted; + + @ApiModelProperty(value = "贸易类型 内贸/外贸/内外贸") + private String tradeType; + + @ApiModelProperty(value = "贸易类型") + private String tradeTypeName; + + @ApiModelProperty(value = "船舶代码") + private String vslCd; + + @ApiModelProperty(value = "船名") + private String vslCnname; + + @ApiModelProperty(value = "") + private String vslEnname; + + @ApiModelProperty(value = "主键") + private String vvyId; + + @ApiModelProperty(value = "航次名,手动输入") + private String vvyName; + +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/DepartureShipVoyageQuery.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/DepartureShipVoyageQuery.java new file mode 100644 index 0000000..8648d57 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/DepartureShipVoyageQuery.java @@ -0,0 +1,17 @@ +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 DepartureShipVoyageQuery implements Serializable { + @ApiModelProperty("查询条件,船名,航次名") + private String key; + + @ApiModelProperty("港区ID") + private String pamId; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ExportInspectDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ExportInspectDTO.java new file mode 100644 index 0000000..d039eb5 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ExportInspectDTO.java @@ -0,0 +1,29 @@ +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 ExportInspectDTO implements Serializable { + @ApiModelProperty(value = "品牌ID") + private String brdId; + + @ApiModelProperty(value = "品牌名称") + private String brdName; + + @ApiModelProperty(value = "车型ID") + private String bvmId; + + @ApiModelProperty(value = "车型名称") + private String bvmName; + + @ApiModelProperty(value = "车架号") + private String vinCode; + + @ApiModelProperty(value = "区域") + private String yardPos; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ImportTakeShipVo.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ImportTakeShipVo.java new file mode 100644 index 0000000..a798c9c --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ImportTakeShipVo.java @@ -0,0 +1,24 @@ +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(value ="提货申请船名") +public class ImportTakeShipVo implements Serializable { + + @ApiModelProperty("船舶id") + private String spmId; + + @ApiModelProperty("船名") + private String spmName; + + @ApiModelProperty("船code") + private String vslCode; + + @ApiModelProperty("英文名") + private String spmEname; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ImportTakeVoyageVo.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ImportTakeVoyageVo.java new file mode 100644 index 0000000..464237d --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ImportTakeVoyageVo.java @@ -0,0 +1,48 @@ +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(value ="提货申请航次") +public class ImportTakeVoyageVo implements Serializable { + + @ApiModelProperty("进出口标志") + private String importExportFlag; + + @ApiModelProperty("进出口标志") + private String importExportFlagName; + + @ApiModelProperty("港区ID") + private String pamId; + + @ApiModelProperty("港区名称") + private String pamIdDesc; + + @ApiModelProperty("船舶ID") + private String spmId; + + @ApiModelProperty("贸易类型 内贸/外贸") + private String tradeType; + + @ApiModelProperty("贸易类型") + private String tradeTypeName; + + @ApiModelProperty("船舶代码") + private String vslCd; + + @ApiModelProperty("船舶中文名") + private String vslCnname; + + @ApiModelProperty("船舶英文名") + private String vslEnname; + + @ApiModelProperty("航次ID") + private String vvyId; + + @ApiModelProperty("航次名") + private String vvyName; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/InspectBillDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/InspectBillDTO.java new file mode 100644 index 0000000..cc353f9 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/InspectBillDTO.java @@ -0,0 +1,48 @@ +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 InspectBillDTO implements Serializable { + + @ApiModelProperty("报关单号") + private String customsDeclareNo; + + @ApiModelProperty("进出口标识") + private String importExportFlag; + + @ApiModelProperty("进出口标识转义") + private String importExportFlagName; + + @ApiModelProperty("提单号") + private String mnfBl; + + @ApiModelProperty("原装船/卸船计划ID") + private String planId; + + @ApiModelProperty("装船/卸船计划拆分后ID") + private String splitId; + + @ApiModelProperty("船ID") + private String spmId; + + @ApiModelProperty("船名") + private String spmName; + + @ApiModelProperty("贸易类型") + private String tradeType; + + @ApiModelProperty("贸易类型转义") + private String tradeTypeName; + + @ApiModelProperty("航次ID") + private String vvyId; + + @ApiModelProperty("航次名") + private String vvyName; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/InspectStatusResp.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/InspectStatusResp.java new file mode 100644 index 0000000..86ed48d --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/InspectStatusResp.java @@ -0,0 +1,21 @@ +package com.haitonggauto.rtosc.api.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("查验状态") +public class InspectStatusResp { + @ApiModelProperty("查验计划号") + private String acceptanceNo; + + @ApiModelProperty("平台查验计划申请id") + private String applyId; + + @ApiModelProperty("查验计划状态 0待查验,1查验中,2查验完成") + private String inspectionStatus; + + @ApiModelProperty("查验计划状态") + private String inspectionStatusNm; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/NuzarDictDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/NuzarDictDTO.java new file mode 100644 index 0000000..316a1d3 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/NuzarDictDTO.java @@ -0,0 +1,17 @@ +package com.haitonggauto.rtosc.api.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class NuzarDictDTO implements Serializable { + private String ptrCode; + private String ptrDesc; +// private Date createTime; + private String createUser; + private String updateUser; + private String updateTime; + +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/PortAreaCountryDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/PortAreaCountryDTO.java new file mode 100644 index 0000000..5d28935 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/PortAreaCountryDTO.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.api.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PortAreaCountryDTO implements Serializable { + private String ctyId; + + private String ctyCode; + + private String ctyCnname; + + private String ctyEnname; + + private String areCode; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/PortAreaDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/PortAreaDTO.java new file mode 100644 index 0000000..bb698d2 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/PortAreaDTO.java @@ -0,0 +1,16 @@ +package com.haitonggauto.rtosc.api.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PortAreaDTO implements Serializable { + private String pamId; + + private String pamNo; + + private String pamName; + + private String valid; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/PortDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/PortDTO.java new file mode 100644 index 0000000..cf0e4ec --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/PortDTO.java @@ -0,0 +1,17 @@ +package com.haitonggauto.rtosc.api.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PortDTO implements Serializable { + private String potId; + + private String potPortcd; + + private String potCnname; + + private String potEnname; + +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/RegisterDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/RegisterDTO.java new file mode 100644 index 0000000..6f7a248 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/RegisterDTO.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.api.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class RegisterDTO implements Serializable { + private String accessToken; + private Integer expiresIn; + private String refreshToken; + private String tokenType; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShipDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShipDTO.java new file mode 100644 index 0000000..7548b0e --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShipDTO.java @@ -0,0 +1,16 @@ +package com.haitonggauto.rtosc.api.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ShipDTO implements Serializable { + private String spmId; + + private String vslCd; + + private String vslCnname; + + private String vslEnname; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShutoutCargos.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShutoutCargos.java new file mode 100644 index 0000000..02cfc72 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShutoutCargos.java @@ -0,0 +1,34 @@ +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 ShutoutCargos implements Serializable { + + @ApiModelProperty("品牌ID") + private String brdId; + + @ApiModelProperty("品牌名称") + private String brdName; + + @ApiModelProperty("车型ID") + private String bvmId; + + @ApiModelProperty("车型名称") + private String bvmName; + + @ApiModelProperty("提单号") + private String mnfBl; + + @ApiModelProperty("车架号") + private String vinCode; + + @ApiModelProperty("退关货物信息主键") + private String ysrId; + +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShutoutShip.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShutoutShip.java new file mode 100644 index 0000000..df3abd3 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShutoutShip.java @@ -0,0 +1,24 @@ +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 ShutoutShip implements Serializable { + + @ApiModelProperty("英文名") + private String spmEname; + + @ApiModelProperty("船期 id") + private String spmId; + + @ApiModelProperty("船名") + private String spmName; + + @ApiModelProperty("船code") + private String vslCode; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShutoutVoyage.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShutoutVoyage.java new file mode 100644 index 0000000..77a0026 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/ShutoutVoyage.java @@ -0,0 +1,48 @@ +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 ShutoutVoyage implements Serializable { + + @ApiModelProperty("进出口标志") + private String importExportFlag; + + @ApiModelProperty("进出口标志") + private String importExportFlagName; + + @ApiModelProperty("船舶ID") + private String spmId; + + @ApiModelProperty("贸易类型 内贸/外贸") + private String tradeType; + + @ApiModelProperty("贸易类型") + private String tradeTypeName; + + @ApiModelProperty("船舶代码") + private String vslCd; + + @ApiModelProperty("船舶中文名") + private String vslCnname; + + @ApiModelProperty("船舶英文名") + private String vslEnname; + + @ApiModelProperty("航次ID") + private String vvyId; + + @ApiModelProperty("航次名") + private String vvyName; + + @ApiModelProperty("港区ID") + private String pamId; + + @ApiModelProperty("港区名称") + private String pamIdDesc; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/VinStatusRequest.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/VinStatusRequest.java new file mode 100644 index 0000000..ae7e03c --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/VinStatusRequest.java @@ -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.util.List; + +@Data +@ApiModel("车辆状态查询") +public class VinStatusRequest { + @ApiModelProperty("客户平台业务类型:IN_PORT:进港申请 LOAD:装船申请 INSPECT:查验申请 PICK_DEPARTURE:提离港区申请 PICK:提货申请 UNLOAD:卸船申请 SPECIAL_BONDED_ZONE:特保区") + private String businessType; + + @ApiModelProperty("进出口,进口I,出口E") + private String importExportType; + + @ApiModelProperty("车架号列表") + private List vinCodeList; + + @ApiModelProperty("航次ID,如果有的话传,航次是HT6,HTLG,HTTC的时候不需要传") + private String vvyId; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/VoyageDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/VoyageDTO.java new file mode 100644 index 0000000..cf11247 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/VoyageDTO.java @@ -0,0 +1,38 @@ +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 VoyageDTO implements Serializable { + @ApiModelProperty("实际离泊时间") + private String actualAnchoringTime; + + @ApiModelProperty("实际靠泊时间") + private String actualBerthingTime; + + @ApiModelProperty("进出口标志") + private String importExportFlag; + + @ApiModelProperty("") + private String importExportFlagName; + + @ApiModelProperty("船舶id") + private String spmId; + + @ApiModelProperty("\t内贸/外贸/内外贸") + private String tradeType; + + @ApiModelProperty("") + private String tradeTypeName; + + @ApiModelProperty("主键") + private String vvyId; + + @ApiModelProperty("航次名,手动输入") + private String vvyName; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/WorkStatusDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/WorkStatusDTO.java new file mode 100644 index 0000000..02eefde --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/WorkStatusDTO.java @@ -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; + +@Data +@ApiModel("车辆状态") +public class WorkStatusDTO implements Serializable { + + @ApiModelProperty("车架号") + private String vinCode; + + @ApiModelProperty("车辆作业状态") + private String workStatus; + + @ApiModelProperty("车辆作业状态代码") + private String workStatusCode; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/log/DepartureLog.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/log/DepartureLog.java new file mode 100644 index 0000000..34e741a --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/log/DepartureLog.java @@ -0,0 +1,20 @@ +package com.haitonggauto.rtosc.api.dto.log; + +import com.nuzar.rtops.log.annotation.EsLogApproval; +import com.nuzar.rtops.log.annotation.EsLogMean; +import lombok.Data; + +import java.io.Serializable; + +@Data +@EsLogApproval(module = "提离港区审核") +public class DepartureLog implements Serializable { + @EsLogMean(name="船名", title = true) + private String shipName; + + @EsLogMean(name="航次", title = true) + private String voyage; + + @EsLogMean(name="提单号", title = true) + private String billNo; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/log/ImportInspectLog.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/log/ImportInspectLog.java new file mode 100644 index 0000000..352f18d --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/api/dto/log/ImportInspectLog.java @@ -0,0 +1,189 @@ +package com.haitonggauto.rtosc.api.dto.log; + +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.haitonggauto.rtosc.repository.enums.InspectStatusEnum; +import com.nuzar.rtops.log.annotation.EsLogApproval; +import com.nuzar.rtops.log.annotation.EsLogMean; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +@EsLogApproval(module = "进口查验审核") +public class ImportInspectLog implements Serializable { + /** + * 受理号 + */ + @ApiModelProperty(value = "受理号") + private String batchNo; + + /** + * 进出口类型 + */ + @ApiModelProperty(value = "进出口类型") + private String tradType; + + /** + * 船名 + */ + @ApiModelProperty(value = "船ID") + private String shipId; + + /** + * 中文船名 + */ + @ApiModelProperty(value = "中文船名") + @EsLogMean(name = "船名", title = true) + private String shipName; + + /** + * 英文船名 + */ + @ApiModelProperty(value = "英文船名") + private String shipEnName; + + /** + * 航次ID + */ + @ApiModelProperty(value = "航次ID") + private String voyageId; + + /** + * 航次 + */ + @ApiModelProperty(value = "航次") + @EsLogMean(name = "航次", title = true) + private String voyage; + + /** + * 港区ID + */ + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + /** + * 港区 + */ + @ApiModelProperty(value = "港区") + private String portArea; + + /** + * 提单号 + */ + @ApiModelProperty(value = "提单号") + @EsLogMean(name = "提单号", title = true) + private String billNo; + + /** + * 报关单号 + */ + @ApiModelProperty(value = "报关单号") + private String passport; + + /** + * 查验日期 + */ + @ApiModelProperty(value = "查验日期") + private Date inspectTime; + + /** + * 查验车辆数 + */ + @ApiModelProperty(value = "查验车辆数") + private Integer plannedCargoQuantity; + + /** + * 查验备件数 + */ + @ApiModelProperty(value = "查验备件数") + private Integer plannedSpareQuantity; + + /** + * 查验状态 + */ + @ApiModelProperty(value = "查验状态") + private InspectStatusEnum inspectStatus; + + @ApiModelProperty(value = "通过接口获取的查验状态") + private String apiInspectStatus; + + /** + * 公司名 + */ + @ApiModelProperty(value = "公司名") + private String company; + + /** + * 申请对象(从基础数据库获取客户类型为进口货代的数据) + */ + @ApiModelProperty(value = "申请对象ID") + private String applyObjId; + + /** + * 申请对象(从基础数据库获取客户类型为进口货代的数据) + */ + @ApiModelProperty(value = "申请对象") + private String applyObj; + + /** + * 联系人 + */ + @ApiModelProperty(value = "联系人") + private String contact; + + /** + * 联系电话 + */ + @ApiModelProperty(value = "联系电话") + private String contactPhone; + + /** + * 申请人ID + */ + @ApiModelProperty(value = "申请人Id") + private String applicantId; + + /** + * 申请人 + */ + @ApiModelProperty(value = "申请人") + private String applicant; + + /** + * 申请时间 + */ + @ApiModelProperty(value = "申请时间") + private Date applyTime; + + /** + * 审核人ID + */ + @ApiModelProperty(value = "审核人ID") + private String checkManId; + + /** + * 审核人 + */ + @ApiModelProperty(value = "审核人") + private String checkMan; + + /** + * 审核时间 + */ + @ApiModelProperty(value = "审核时间") + private Date checkTime; + + /** + * 审核状态 + */ + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @ApiModelProperty(value = "审核原因") + private String checkReason; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/AuthServiceApi.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/AuthServiceApi.java new file mode 100644 index 0000000..ae555b5 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/AuthServiceApi.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.client; + +import com.haitonggauto.rtosc.client.dto.UserAuthRequestDto; +import com.haitonggauto.rtosc.dto.OrderDTO; +import com.haitonggauto.rtosc.request.OrderPageRequest; +import com.nuzar.cloud.common.web.CommonResult; +import com.nuzar.cloud.web.model.PageResult; +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.List; + +@FeignClient(name = "auth-service") +public interface AuthServiceApi { + + @GetMapping("/customer/login") + CommonResult login(@RequestParam("account") String account, @RequestParam("password") String password, @RequestParam("mobile") String mobile); + +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/PhoneDto.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/PhoneDto.java new file mode 100644 index 0000000..23c083e --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/PhoneDto.java @@ -0,0 +1,14 @@ +package com.haitonggauto.rtosc.client.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PhoneDto implements Serializable { + private String id; + + private Integer isDefault; + + private String phone; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/PortEnDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/PortEnDTO.java new file mode 100644 index 0000000..bc122cc --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/PortEnDTO.java @@ -0,0 +1,70 @@ +package com.haitonggauto.rtosc.client.dto; + +import com.nuzar.cloud.annotation.echo.Echo; +import com.nuzar.cloud.mapper.base.EchoEntity; + +import java.io.Serializable; + +public class PortEnDTO implements EchoEntity, Serializable { + /** + * + */ + private static final long serialVersionUID = -1347613740865124637L; + @Echo(dictDomain = "PUB_PORT_EN", ref = {"extra1"}) + private String id; + private String text; + private String extra1; + private String extra2; + private String extra3; + + public PortEnDTO() { + + } + + public PortEnDTO(String id, String text) { + this.id = id; + this.text = text; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public String getExtra1() { + return extra1; + } + + public void setExtra1(String extra1) { + this.extra1 = extra1; + } + + public String getExtra2() { + return extra2; + } + + public void setExtra2(String extra2) { + this.extra2 = extra2; + } + + public String getExtra3() { + return extra3; + } + + public void setExtra3(String extra3) { + this.extra3 = extra3; + } + + +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/ShutoutQuery.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/ShutoutQuery.java new file mode 100644 index 0000000..80ae22f --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/ShutoutQuery.java @@ -0,0 +1,10 @@ +package com.haitonggauto.rtosc.client.dto; + +import com.haitonggauto.rtosc.common.db.query.BaseQuery; +import lombok.Data; + +@Data +public class ShutoutQuery extends BaseQuery { + + private String key; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/UserAuthRequestDto.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/UserAuthRequestDto.java new file mode 100644 index 0000000..52ba38e --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/UserAuthRequestDto.java @@ -0,0 +1,48 @@ +package com.haitonggauto.rtosc.client.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 = "用户注册及登录") +public class UserAuthRequestDto implements Serializable { + + @ApiModelProperty(value = "登录账号") + @NotBlank(message = "登录账号不能为空") + private String account; + + @ApiModelProperty(value = "客户地址") + private String address; + + @ApiModelProperty(value = "联系人") + private String contactPerson; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "手机号") + private String mobile; + + @ApiModelProperty(value = "客户名称") + private String name; + + @ApiModelProperty(value = "登录密码") + @NotBlank(message = "登录密码不能为空") + private String password; + + @ApiModelProperty(value = "验证码") + private String smsCode; + + @NotNull(message = "手机组不能为空") + @Size(min = 1, message = "手机组不能为空") + private List mobiles; + + +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/UserResp.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/UserResp.java new file mode 100644 index 0000000..29e5f34 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/UserResp.java @@ -0,0 +1,26 @@ +package com.haitonggauto.rtosc.client.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel(value = "登录用户信息") +public class UserResp implements Serializable { + @ApiModelProperty(value = "") + private String account; + + @ApiModelProperty(value = "客户地址") + private String address; + + @ApiModelProperty(value = "联系人") + private String contactPerson; + + @ApiModelProperty(value = "用户ID") + private String id; + + @ApiModelProperty(value = "姓名") + private String name; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/VinValidDTO.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/VinValidDTO.java new file mode 100644 index 0000000..5cceca0 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/client/dto/VinValidDTO.java @@ -0,0 +1,21 @@ +package com.haitonggauto.rtosc.client.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("车架号验证") +public class VinValidDTO implements Serializable { + @ApiModelProperty("进港计划ID") + private Long id; + + @NotNull(message = "VIN数组不能为空") + @Size(min = 1, message = "VIN数组不能为空") + private List vins; +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/CorsConfig.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/CorsConfig.java new file mode 100644 index 0000000..d50db45 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/CorsConfig.java @@ -0,0 +1,29 @@ +package com.haitonggauto.rtosc.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; + +import java.util.Collections; + +@Configuration +public class CorsConfig { + @Bean + public CorsFilter corsFilter() { + CorsConfiguration corsConfiguration = new CorsConfiguration(); + //1,允许任何来源 + corsConfiguration.setAllowedOriginPatterns(Collections.singletonList("*")); + //2,允许任何请求头 + corsConfiguration.addAllowedHeader(CorsConfiguration.ALL); + //3,允许任何方法 + corsConfiguration.addAllowedMethod(CorsConfiguration.ALL); + //4,允许凭证 + corsConfiguration.setAllowCredentials(true); + + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", corsConfiguration); + return new CorsFilter(source); + } +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/DictUtil.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/DictUtil.java new file mode 100644 index 0000000..220844b --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/DictUtil.java @@ -0,0 +1,221 @@ +package com.haitonggauto.rtosc.config; + +import com.alicp.jetcache.Cache; +import com.alicp.jetcache.anno.CacheType; +import com.alicp.jetcache.anno.CreateCache; +import com.haitonggauto.rtosc.client.dto.UserResp; +import com.haitonggauto.rtosc.common.dto.DictDTO; +import com.haitonggauto.rtosc.common.dto.Result; +import com.haitonggauto.rtosc.handler.DictHandler; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.List; +import java.util.concurrent.TimeUnit; + +//@Component +public class DictUtil { + + /* + @CreateCache(name="dict:values", cacheType = CacheType.LOCAL, localExpire = 1, timeUnit = TimeUnit.HOURS) + private Cache dictCache; + + @Resource + private DictHandler dictHandler; + // 港区 + public DictDTO getPortArea(String id) { + if (StringUtils.isEmpty(id)) { + return null; + } + + DictDTO rst = dictCache.get(id); + + if (rst == null) { + Result> list = dictHandler.getPortAreaList(null); + list.getData().stream().forEach(item -> { + dictCache.put(item.getId(), item); + }); + } + + return dictCache.get(id); + } + // 船名 + public DictDTO getShipName(String id) { + if (StringUtils.isEmpty(id)) { + return null; + } + + DictDTO rst = dictCache.get(id); + + if (rst == null) { + Result> list = dictHandler.getAllShip(null); + list.getData().stream().forEach(item -> { + dictCache.put(item.getId(), item); + }); + } + + return dictCache.get(id); + } + // 港口 + public DictDTO getPort(String id) { + if (StringUtils.isEmpty(id)) { + return null; + } + + DictDTO rst = dictCache.get(id); + + if (rst == null) { + Result> list = dictHandler.getPortList(null); + list.getData().stream().forEach(item -> { + dictCache.put(item.getId(), item); + }); + } + + return dictCache.get(id); + } + // 运输方式 + public DictDTO getTransportWay(String id) { + if (StringUtils.isEmpty(id)) { + return null; + } + + String prefix = "TransportWay_"; + + DictDTO rst = dictCache.get(prefix+id); + + if (rst == null) { + Result> list = dictHandler.getTransportWayList(null); + list.getData().stream().forEach(item -> { + dictCache.put(prefix+item.getId(), item); + }); + } + + return dictCache.get(prefix+id); + } + // 品牌 + public DictDTO getBrand(String id) { + if (StringUtils.isEmpty(id)) { + return null; + } + + DictDTO rst = dictCache.get(id); + + if (rst == null) { + Result> list = dictHandler.getBrandList(""); + list.getData().stream().forEach(item -> { + dictCache.put(item.getId(), item); + }); + } + + return dictCache.get(id); + } + // 车型 + public DictDTO getCartType(String id) { + if (StringUtils.isEmpty(id)) { + return null; + } + + DictDTO rst = dictCache.get(id); + + if (rst == null) { + Result> list = dictHandler.getCartTypeList(""); + list.getData().stream().forEach(item -> { + dictCache.put(item.getId(), item); + }); + } + + return dictCache.get(id); + } + // 车型明细 + public DictDTO getCartTypeDetail(String cartTypeId, String id) { + if (StringUtils.isEmpty(id)) { + return null; + } + + DictDTO rst = dictCache.get(id); + + if (rst == null) { + Result> list = dictHandler.getCartTypeDetailList(cartTypeId, ""); + list.getData().stream().forEach(item -> { + dictCache.put(item.getId(), item); + }); + } + + return dictCache.get(id); + } + // 操作模式 + public DictDTO getOperateType(String carTypeName, String id) { + if (StringUtils.isEmpty(id)) { + return null; + } + + String prefix = "OperateType_"; + + DictDTO rst = dictCache.get(prefix+id); + + if (rst == null) { + Result> list = dictHandler.getOperateTypeList(carTypeName); + list.getData().stream().forEach(item -> { + dictCache.put(prefix+item.getId(), item); + }); + } + + return dictCache.get(prefix+id); + } + // 人员信息 + public DictDTO getUser(String id) { + if (StringUtils.isEmpty(id)) { + return null; + } + + DictDTO rst = dictCache.get(id); + + if (rst == null) { + Result list = dictHandler.getUserInfo(id); + if (list.getCode() == 0 && list.getData() != null) { + DictDTO dto = new DictDTO(); + dto.setId(list.getData().getId()); + dto.setText(list.getData().getName()); + + dictCache.put(dto.getId(), dto); + } + } + + return dictCache.get(id); + } + // 公司信息 + public DictDTO getCompany(String id) { + if (StringUtils.isEmpty(id)) { + return null; + } + + DictDTO rst = dictCache.get(id); + + if (rst == null) { + Result> list = dictHandler.getCompanyList(); + list.getData().stream().forEach(item -> { + dictCache.put(item.getId(), item); + }); + } + + return dictCache.get(id); + } + // 货物类型 + public DictDTO getCargoType(String id) { + if (StringUtils.isEmpty(id)) { + return null; + } + + DictDTO rst = dictCache.get(id); + + if (rst == null) { + Result> list = dictHandler.getCargoTypeList(); + list.getData().stream().forEach(item -> { + dictCache.put(item.getId(), item); + }); + } + + return dictCache.get(id); + }*/ +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/InterceptorConfiguration.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/InterceptorConfiguration.java new file mode 100644 index 0000000..5522972 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/InterceptorConfiguration.java @@ -0,0 +1,45 @@ +package com.haitonggauto.rtosc.config; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import javax.annotation.PostConstruct; + +/** + * 拦截器的属性配置 + * + */ +@Configuration +@ConditionalOnClass(WebMvcConfigurer.class) +public class InterceptorConfiguration implements WebMvcConfigurer { + + @Autowired + private ObjectMapper objectMapper; + + @PostConstruct + public void EnumObjectMapper() { + // 解决enum不匹配问题 默认值为false + objectMapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); + } + + /** + * 权限验证过滤器 + * @return + */ + @Bean + public PermInterceptor permInterceptor() { return new PermInterceptor(); } + + + @Override + public void addInterceptors(InterceptorRegistry registry) { + // 拦截器 + InterceptorRegistration registration = registry.addInterceptor(this.permInterceptor()); + } +} \ No newline at end of file diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/JacksonConfig.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/JacksonConfig.java new file mode 100644 index 0000000..dfc0d96 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/JacksonConfig.java @@ -0,0 +1,38 @@ +package com.haitonggauto.rtosc.config; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.haitonggauto.rtosc.common.enums.BaseEnum; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; + +import java.io.IOException; + +@Configuration +public class JacksonConfig { + + /** + * Jackson全局转化long类型为String,解决jackson序列化时long类型缺失精度问题 + * @return Jackson2ObjectMapperBuilderCustomizer 注入的对象 + */ + @Bean + public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { + return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder + .serializerByType(Long.class, ToStringSerializer.instance) + .serializerByType(Long.TYPE, ToStringSerializer.instance) + .serializerByType(BaseEnum.class, new JsonSerializer() { + @Override + public void serialize(BaseEnum value, JsonGenerator gen, SerializerProvider serializers) throws IOException { + gen.writeStartObject(); + gen.writeStringField("id", value.name()); + gen.writeStringField("text",value.text()); + gen.writeEndObject(); + } + }); + } +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/PermInterceptor.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/PermInterceptor.java new file mode 100644 index 0000000..dd83361 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/config/PermInterceptor.java @@ -0,0 +1,83 @@ +package com.haitonggauto.rtosc.config; + +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.web.servlet.HandlerInterceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * 权限过滤器 + */ +public class PermInterceptor implements HandlerInterceptor { + + @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"; + } + + System.err.println(userId); + + LoginUser tmpUser = new LoginUser(); + tmpUser.setUserId(userId); + tmpUser.setRoleId(0L); + tmpUser.setAdmin(true); + + UserContext.setUser(tmpUser); + + return true; + } + + @Override + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { + UserContext.clear(); + } + + + /** + * 判断是否有权限 + * 1.从请求头中获取token + * + * 2.通过token从redis中获取当前登录对象(object) + * + * 3.通过对象查询数据库是否存在当前对象 + * + * 4.获取登录对象的登录名 判断是否是(admin或者总经理)这两个账号拥有最高权限 + * + * 5.判断是否被授权,(获取临时授权时设置的开始时间,结束时间,当前时间), + * + * 获取这个三个时间的时间戳,判断当前时间是否在开始时间和结束时间之间 + * + * 如果开始时间和结束时间为空的话表示当前登录对象未被临时授权,会执行后面的 4,5,6, + * + * 如果有时间,但是当前时间不在这个时间段也会执行 4,5,6 + * + * 如果有时间,并且当前时间在这个时间段之中,就会直接返回true + * + * 6.从请求头中获取当前接口的地址, + * + * 7.通过当前登录对象的id查询权限 + * + * 8.判断当前登录对象的权限中是否包含当前接口的地址,如果包含,允许当前登录对象访问,如果不包含,则不允许当前登录人访问 + * ———————————————— + * 版权声明:本文为CSDN博主「原你是阳光(#`O′)」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 + * 原文链接:https://blog.csdn.net/weixin_58696998/article/details/124663181 + * @param request + * @return + */ +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/DepartureHandler.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/DepartureHandler.java new file mode 100644 index 0000000..37ff88a --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/DepartureHandler.java @@ -0,0 +1,662 @@ +package com.haitonggauto.rtosc.handler; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.util.MapUtils; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.alibaba.excel.write.metadata.fill.FillConfig; +import com.alibaba.excel.write.metadata.fill.FillWrapper; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.haitonggauto.rtosc.api.NuzarOpenApi; +import com.haitonggauto.rtosc.api.dto.*; +import com.haitonggauto.rtosc.api.dto.log.DepartureLog; +import com.haitonggauto.rtosc.common.context.UserContext; +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.DepartureCargoVo; +import com.haitonggauto.rtosc.dto.DepartureCheckVo; +import com.haitonggauto.rtosc.dto.DepartureVo; +import com.haitonggauto.rtosc.query.CargoQuery; +import com.haitonggauto.rtosc.query.DepartureQuery; +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.service.CustomerService; +import com.itextpdf.forms.PdfAcroForm; +import com.itextpdf.forms.fields.PdfFormField; +import com.itextpdf.io.font.PdfEncodings; +import com.itextpdf.kernel.font.PdfFont; +import com.itextpdf.kernel.font.PdfFontFactory; +import com.itextpdf.kernel.pdf.PdfDocument; +import com.itextpdf.kernel.pdf.PdfReader; +import com.itextpdf.kernel.pdf.PdfWriter; +import com.itextpdf.kernel.pdf.canvas.parser.PdfDocumentContentParser; +import com.itextpdf.kernel.pdf.canvas.parser.listener.TextMarginFinder; +import com.itextpdf.layout.Document; +import com.itextpdf.layout.element.Cell; +import com.itextpdf.layout.element.Paragraph; +import com.itextpdf.layout.element.Table; +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 org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.util.IOUtils; +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 javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +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.net.URLEncoder; +import java.util.*; +import java.util.stream.Collectors; + +@Api(tags = "提离港区") +@RestController +@RequestMapping("/ep") +@Validated +public class DepartureHandler implements BaseHandler { + + @Resource + private CustomerService customerService; + + @Resource + private CustomerDepartureService departureService; + + @Resource + private CustomerDepartureCargoService departureCargoService; + + @Resource + private CustomerDepartureDriversService departureDriversService; + + @Resource + private CustomerDeparturePlanService departurePlanService; + + @Resource + private NuzarOpenApi openApi; + + @ApiOperation("获取退关的船名") + @PostMapping("/shutout/ship/query") + public Result> getShutoutShipList(@RequestParam(required = false) String key) { + return ResultUtil.success(openApi.getShutoutShipList(key)); + } + + @ApiOperation("获取退关的航次") + @PostMapping("/shutout/voyage/query") + public Result> getShutoutVoyageList(@RequestParam(required = false) @NotNull(message = "船舶ID不能为空") String spmId, + @RequestParam(required = false) String key) { + return ResultUtil.success(openApi.getShutoutVoyageList(spmId, key)); + } + + @ApiOperation("获取退关的货物") + @PostMapping("/shutout/cargo/query") + public Result> getShutoutCargoList(@RequestParam(required = false) @NotNull(message = "船ID不能为空") String shipId, + @RequestParam(required = false) @NotNull(message = "航次ID不能为空") String vvyId) { + return ResultUtil.success(openApi.getShutoutCargosList(shipId, vvyId)); + } + + /** + * 分页查询 + * @param query + * @return + */ + @ApiOperation("条件分页查询") + @PostMapping("/query-list") + public Result> query(@RequestBody DepartureQuery query) { + if (query.getEndApplyTime() != null) { + query.setEndApplyTime(DateUtils.getDayEnd(query.getEndApplyTime())); + } + query.setCreateBy(UserContext.getUser().getUserId()); + Wrapper queryWrapper = new WrapperKit(){}.changeBaseQueryToWrapper(CustomerDeparture.class, query); + Page page = departureService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + return ResultUtil.success(page); + } + + @ApiOperation("审核条件分页查询") + @PostMapping("/check/query-list") + public Result> checkQuery(@RequestBody DepartureQuery query) { + if (query.getEndApplyTime() != null) { + query.setEndApplyTime(DateUtils.getDayEnd(query.getEndApplyTime())); + } + if (query.getCheckStatus() == null) { + query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); + } + Wrapper queryWrapper = new WrapperKit(){}.changeBaseQueryToWrapper(CustomerDeparture.class, query); + Page page = departureService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + return ResultUtil.success(page); + } + + /** + * 新增 + * @param form + * @return + */ + @ApiOperation("新增") + @PostMapping("/add") + public Result save(@RequestBody @Validated(ValidationGroup.insert.class) DepartureVo form) { + // 验证是否有重复的车架号 + if (CollectionUtils.isNotEmpty(form.getCargos())) { + List repeat = form.getCargos().stream().collect(Collectors.groupingBy(DepartureCargoVo::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复"); + } + } + String batchNo = customerService.getSequenceNo("departure_batch_no", "提离港区", "EP"); + // 表单验证以及格式转换 + CustomerDeparture departure = PoMapper.instance.departureVo2Entity(form); + departure.setBatchNo(batchNo); + departure.setApplicantId(UserContext.getUser().getUserId()); + departure.setCheckStatus(AuditEnum.SUBMIT); + departure.setApplyTime(new Date()); + departure.setTermcd(departure.getPortAreaId()); + + List cargos = form.getCargos().stream().map(item -> { + CustomerDepartureCargo entity = PoMapper.instance.departureCargoVo2Entity(item); + entity.setTermcd(departure.getPortAreaId()); + return entity; + }).collect(Collectors.toList()); + + List drivers = form.getDrivers().stream().map(item -> { + CustomerDepartureDrivers entity = PoMapper.instance.departureDriverVo2Entity(item); + entity.setTermcd(departure.getPortAreaId()); + return entity; + }).collect(Collectors.toList()); + + List plans = form.getPlans().stream().map(item -> { + CustomerDeparturePlan entity = PoMapper.instance.departurePlanVo2Entity(item); + entity.setTermcd(departure.getPortAreaId()); + return entity; + }).collect(Collectors.toList()); + + Long id = customerService.saveDeparture(departure, cargos, drivers, plans); + + return ResultUtil.success(String.valueOf(id)); + } + + @ApiOperation("提交审核") + @PostMapping("/submit-check") + public Result submitCheck(@RequestBody + @NotNull(message = "请传入要审核的提离港区ID") + @Size(min = 1, message = "ID列表不能为空") List ids) { + departureService.lambdaUpdate().set(CustomerDeparture::getCheckStatus, AuditEnum.AUDIT) + .set(CustomerDeparture::getCheckResult, null).in(CustomerDeparture::getId, ids).update(); + return ResultUtil.success("success"); + } + + /** + * 删除 + * @param id + * @return + */ + @ApiOperation("删除") + @PostMapping("/del") + public Result delete(@RequestParam @NotNull(message = "请传入要删除的出口进场ID") Long id) { + customerService.delDeparture(id); + return ResultUtil.success("success"); + } + + @ApiOperation("审核端编辑") + @PostMapping("/checker/edit") + // 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法 + public Result edit(@RequestBody @Validated(ValidationGroup.update.class) DepartureVo form) { + return this.edit(true, form); + } + /** + * 编辑 + * @param form + * @return + */ + @ApiOperation("编辑") + @PostMapping("/edit") + // 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法 + public Result edit(@RequestParam(required = false, defaultValue = "false")Boolean flag, + @RequestBody @Validated(ValidationGroup.update.class) DepartureVo form) { + // 验证是否有重复的车架号 + if (CollectionUtils.isNotEmpty(form.getCargos())) { + List repeat = form.getCargos().stream().collect(Collectors.groupingBy(DepartureCargoVo::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复"); + } + } + + CustomerDeparture dep = departureService.getById(form.getId()); + if (dep.getCheckStatus() == AuditEnum.AUDIT_PASS) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "审核通过之后不能进行编辑"); + } + String batchNo = dep.getBatchNo(); + // 表单验证以及格式转换 + CustomerDeparture departure = PoMapper.instance.departureVo2Entity(form); + departure.setBatchNo(batchNo); + if (!flag) { + departure.setCheckStatus(AuditEnum.SUBMIT); + } else { + departure.setCheckStatus(AuditEnum.AUDIT); + } + + List cargos = form.getCargos().stream().map(item -> { + CustomerDepartureCargo entity = PoMapper.instance.departureCargoVo2Entity(item); + entity.setTermcd(departure.getPortAreaId()); + return entity; + }).collect(Collectors.toList()); + + List drivers = form.getDrivers().stream().map(item -> { + CustomerDepartureDrivers entity = PoMapper.instance.departureDriverVo2Entity(item); + entity.setTermcd(departure.getPortAreaId()); + return entity; + }).collect(Collectors.toList()); + + List plans = form.getPlans().stream().map(item -> { + CustomerDeparturePlan entity = PoMapper.instance.departurePlanVo2Entity(item); + entity.setTermcd(departure.getPortAreaId()); + return entity; + }).collect(Collectors.toList()); + + customerService.updateDeparture(false, departure, cargos, drivers, plans); + + return ResultUtil.success(String.valueOf(departure.getId())); + } + + /** + * 详情 + * @param id + * @return + */ + @ApiOperation("详情") + @PostMapping("/detail") + public Result detail(@RequestParam @NotNull(message = "请传入要获取的出口进场ID") Long id) { + CustomerDeparture departure = departureService.getById(id); + + if (departure == null) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "id:" + id + "不存在"); + } + + customerService.wrapperEntity(departure); + + List cargos = departureCargoService.list(new LambdaQueryWrapper().eq(CustomerDepartureCargo::getDepartureId, id)); + + customerService.wrapperEntity(cargos); + + List drivers = departureDriversService.list(new LambdaQueryWrapper().eq(CustomerDepartureDrivers::getDepartureId, id)); + + customerService.wrapperEntity(drivers); + + List plans = departurePlanService.list(new LambdaQueryWrapper().eq(CustomerDeparturePlan::getDepartureId, id)); + + int quantity = plans.stream().map(item -> item.getPartQuantity() + item.getCarQuantity()).mapToInt(item -> item).sum(); + departure.setQuantity(quantity); + + customerService.wrapperEntity(plans); + + departure.setCargos(cargos); + departure.setDrivers(drivers); + departure.setPlans(plans); + + return ResultUtil.success(departure); + } + + @ApiOperation("批量详情") + @PostMapping("/batch/detail") + public Result> batchDetail(@RequestBody @NotNull(message = "请传入ID列表") @Size(min = 1, message = "请传入ID列表") List ids) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.in(CustomerDeparture::getId, ids); + + List departureList = departureService.list(query); + + if (CollectionUtils.isEmpty(departureList)) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "id列表不存在"); + } + + for (CustomerDeparture departure : departureList) { + + customerService.wrapperEntity(departure); + + List cargos = departureCargoService.list(new LambdaQueryWrapper().eq(CustomerDepartureCargo::getDepartureId, departure.getId())); + + customerService.wrapperEntity(cargos); + + List drivers = departureDriversService.list(new LambdaQueryWrapper().eq(CustomerDepartureDrivers::getDepartureId, departure.getId())); + + customerService.wrapperEntity(drivers); + + List plans = departurePlanService.list(new LambdaQueryWrapper().eq(CustomerDeparturePlan::getDepartureId, departure.getId())); + + customerService.wrapperEntity(plans); + + departure.setCargos(cargos); + departure.setDrivers(drivers); + departure.setPlans(plans); + } + + return ResultUtil.success(departureList); + } + + @ApiOperation("货物明细分页列表") + @PostMapping("/cargos/page") + public Result> cargoList(@RequestBody @Validated(ValidationGroup.update.class) CargoQuery query) { + LambdaQueryWrapper 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()); + } + Page page = departureCargoService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + + customerService.wrapperEntity(page.getRecords()); + + return ResultUtil.success(page); + } + + /** + * 审核 + * @param check + * @return + */ + @ApiOperation("审核") + @PostMapping("/check") + public Result check(@RequestBody @Validated(ValidationGroup.insert.class) DepartureCheckVo check) throws Exception { + List departures = new ArrayList<>(); + for (Long id : check.getIds()) { + CustomerDeparture departure = PoMapper.instance.departureCheckVo2Entity(check); + departure.setCheckManId(UserContext.getUser().getUserId()); + departure.setId(id); + departure.setCheckTime(new Date()); + departures.add(departure); + } + + boolean row = departureService.updateBatchById(departures); + if (row) { + List list = departureService.lambdaQuery().in(CustomerDeparture::getId, check.getIds()).list(); + + // 记录日志 + for (CustomerDeparture record : list) { + // 提单号在明细里 + List ds = departureCargoService.lambdaQuery().eq(CustomerDepartureCargo::getDepartureId, record.getId()).list(); + for (CustomerDepartureCargo d : ds) { + DepartureLog l = new DepartureLog(); + l.setShipName(record.getShipName()); + l.setBillNo(d.getBillNo()); + l.setVoyage(record.getVoyage()); + + LogRecordDTO log = new LogRecordDTO(); + log.setOperateData(l); + log.setStatus(check.getCheckStatus() == AuditEnum.AUDIT_PASS ? 0 : 1); + log.setOperateTime(new Date()); + log.setUserId(SecurityUtils.getUserId()); + log.setUserName(SecurityUtils.getUserName()); + EsLogApprovalUtil.writeLog(log); + } + } + + return ResultUtil.success("success"); + } + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败,ID不存在"); + } + + /** + * 审核 + * @param check + * @return + */ + @ApiOperation("取消审核") + @PostMapping("/cancel-check") + public Result cancelCheck(@RequestBody @Validated(ValidationGroup.update.class) DepartureCheckVo check) { + List departures = new ArrayList<>(); + for (Long id : check.getIds()) { + CustomerDeparture departure = PoMapper.instance.departureCheckVo2Entity(check); + departure.setId(id); + departure.setCheckTime(new Date()); + departure.setCheckManId(UserContext.getUser().getUserId()); + departure.setCheckStatus(AuditEnum.AUDIT); + departures.add(departure); + } + + boolean row = departureService.updateBatchById(departures); + + if (row) { + return ResultUtil.success("success"); + } + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败,ID不存在"); + } + + /** + * + * 导出excel + * @param response + */ + @ApiOperation("导出excel") + @GetMapping("/export-execl") + public void exportExcel(HttpServletResponse response, + @RequestParam + @NotBlank(message = "受理号不能为空!" ) String batchNos) throws Exception { + response.setContentType("application/vnd.ms-excel;charset=utf-8"); + response.setCharacterEncoding("utf-8"); + + // 20220213-提离港区清单,日期加名称 + String date = DateUtil.format(new Date(), "yyyyMMdd"); + + String fileName = URLEncoder.encode(StringUtils.join(date, "-提离港区清单"), "UTF-8"); + response.setHeader("Content-disposition", "attachment;filename="+ fileName + ".xlsx"); + + // 加载模板 + ClassPathResource classPathResource = new ClassPathResource("templates/template.xlsx"); + InputStream inputStream = classPathResource.getInputStream(); + + List nos = Arrays.asList(StringUtils.split(batchNos, "-")); + + // 查询出要加载的数据 + List departures = departureService.list(new LambdaQueryWrapper().in(CustomerDeparture::getBatchNo, nos)); + + ExcelWriter excelWriter = null; + try(ByteArrayOutputStream bos = new ByteArrayOutputStream()){ + //原模板只有一个sheet,通过poi复制出需要的sheet个数的模板 + XSSFWorkbook workbook = new XSSFWorkbook(inputStream); + //设置模板的第一个sheet的名称 + // 查询出所有提单的数量 + List ids = departures.stream().map(item -> item.getId()).collect(Collectors.toList()); + long count = departureCargoService.count(new LambdaQueryWrapper().in(CustomerDepartureCargo::getDepartureId, ids)); + for (int i = 1; i < count; i++) { + workbook.cloneSheet(0, "Sheet"+(i+1)); + } + + //写到流里 + workbook.write(bos); + byte[] bArray = bos.toByteArray(); + InputStream is = new ByteArrayInputStream(bArray); + excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(is).build(); + + for (int i = 0; i < departures.size(); i++) { + // 计划数据是共用的 + List plans = departurePlanService.list(new LambdaQueryWrapper().eq(CustomerDeparturePlan::getDepartureId, departures.get(i).getId())); + + int totalCarQuantity = plans.stream().mapToInt(item -> item.getCarQuantity()).sum(); + int totalPartQuantity = plans.stream().mapToInt(item -> item.getPartQuantity()).sum(); + + // 查询出提单 + List list = departureCargoService.list(new LambdaQueryWrapper().in(CustomerDepartureCargo::getDepartureId, departures.get(i).getId())); + + for (CustomerDepartureCargo cargo : list) { + // 每个提单一个sheet + WriteSheet writeSheet = EasyExcel.writerSheet(i, departures.get(i).getBatchNo()).build(); + // 这里注意 入参用了forceNewRow 代表在写入list的时候不管list下面有没有空行 都会创建一行,然后下面的数据往后移动。默认 是false,会直接使用下一行,如果没有则创建。 + // forceNewRow 如果设置了true,有个缺点 就是他会把所有的数据都放到内存了,所以慎用 + // 简单的说 如果你的模板有list,且list不是最后一行,下面还有数据需要填充 就必须设置 forceNewRow=true 但是这个就会把所有数据放到内存 会很耗内存 + // 如果数据量大 list不是最后一行 参照下一个 + + FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); + List before = CollectionUtil.sub(plans, 0, 1); + List after = CollectionUtil.sub(plans, 1, plans.size() - 1); + + excelWriter.fill(new FillWrapper("plan", before), writeSheet); + excelWriter.fill(new FillWrapper("plan", after), fillConfig, writeSheet); + + Map map = MapUtils.newHashMap(); + map.put("batchNo", departures.get(i).getBatchNo()); // {batchNo} + map.put("receiveCompany", departures.get(i).getReceiveCompany()); // {receiveCompany} + //{applicant} + map.put("applicant", departures.get(i).getApplicant()); + //{applyTime} + map.put("applyTime", departures.get(i).getApplyTime()); + //{shipName} + map.put("shipName", departures.get(i).getShipName()); + //{voyage} + map.put("voyage", departures.get(i).getVoyage()); + // {billNo} + map.put("billNo", cargo.getBillNo()); + // {arrivalTime} + map.put("arrivalTime", departures.get(i).getArrivalTime()); + // {deliveryTime} + map.put("deliveryTime", departures.get(i).getDeliveryTime()); + // {contact} + map.put("contact", departures.get(i).getContact()); + // {contactPhone} + map.put("contactPhone", departures.get(i).getContactPhone()); + // {retainPort} + map.put("retainPort", departures.get(i).getRetainPort()); + // {totalCarQuantity} + map.put("totalCarQuantity", totalCarQuantity); + // {totalPartQuantity} + map.put("totalPartQuantity", totalPartQuantity); + excelWriter.fill(map, writeSheet); + } + } + }catch (Exception e){ + e.printStackTrace(); + }finally { + // 关闭流 + if(excelWriter!=null){ + excelWriter.close(); + } + if(inputStream != null){ + inputStream.close(); + } + } + } + + @ApiOperation("导出PDF") + @GetMapping("/down-letter") + public void exportLetter(HttpServletResponse response, + @RequestParam @NotBlank(message = "受理号不能为空") String batchNo) throws Exception { + response.setContentType("application/pdf;charset=utf-8"); + response.setCharacterEncoding("utf-8"); + String fileName = URLEncoder.encode("提离港区保函", "UTF-8"); + response.setHeader("Content-disposition", "attachment;filename="+ fileName + ".pdf"); + + //模板路径,放到项目里用这个ClassPathResource + ClassPathResource classPathResource = new ClassPathResource("templates/template.pdf"); + InputStream inputStream = classPathResource.getInputStream(); + + // 查询出要加载的数据 + + CustomerDeparture departure = departureService.getOne(new LambdaQueryWrapper().eq(CustomerDeparture::getBatchNo, batchNo)); + + List cargos = departureCargoService.list(new LambdaQueryWrapper().eq(CustomerDepartureCargo::getDepartureId, departure.getId())); + + Integer num = cargos.stream().mapToInt(CustomerDepartureCargo::getQuantity).sum(); + + List drivers = departureDriversService.list(new LambdaQueryWrapper().eq(CustomerDepartureDrivers::getDepartureId, departure.getId())); + + PdfDocument pdfDoc = new PdfDocument(new PdfReader(inputStream), new PdfWriter(response.getOutputStream())); + + org.springframework.core.io.Resource resource = new ClassPathResource("templates/SourceHanSansCN-Regular.ttf"); + InputStream stream = resource.getInputStream(); + byte[] bytes = IOUtils.toByteArray(stream); + PdfFont font = PdfFontFactory.createFont(bytes, PdfEncodings.IDENTITY_H, PdfFontFactory.EmbeddingStrategy.PREFER_EMBEDDED); + + PdfAcroForm form = PdfAcroForm.getAcroForm(pdfDoc, false); + + Map 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("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); + 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); + } + + Table driverTable = new Table(UnitValue.createPercentArray(new float[] {30f, 50f, 50f})); + driverTable.addHeaderCell(new Cell().add(new Paragraph("司机姓名").setFont(font))); + driverTable.addHeaderCell(new Cell().add(new Paragraph("车牌号").setFont(font))); + driverTable.addHeaderCell(new Cell().add(new Paragraph("联系电话").setFont(font))); + drivers.stream().forEach(driver -> { + driverTable.addCell(new Paragraph(driver.getDriverName()).setFont(font)); + driverTable.addCell(new Paragraph(driver.getCarNo()).setFont(font)); + driverTable.addCell(new Paragraph(driver.getContactPhone()).setFont(font)); + }); + + Table cargoTable = new Table(UnitValue.createPercentArray(new float[] {30f, 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))); + cargos.stream().forEach(cargo -> { + cargoTable.addCell(new Paragraph(cargo.getBillNo()).setFont(font)); + cargoTable.addCell(new Paragraph(cargo.getBrand()).setFont(font)); + cargoTable.addCell(new Paragraph(StringUtils.equals(cargo.getCargoType(), "0") ? "车辆" : "备件").setFont(font)); + cargoTable.addCell(cargo.getVin()); + cargoTable.addCell(String.valueOf(cargo.getQuantity())); + }); + + final Document doc = new Document(pdfDoc); + + doc.setRenderer(new DocumentRenderer(doc) { + @Override + protected LayoutArea updateCurrentArea(LayoutResult overflowResult) { + + int lastPage = doc.getPdfDocument().getNumberOfPages(); + + LayoutArea area = super.updateCurrentArea(overflowResult); + + if (area.getPageNumber() == lastPage) { + PdfDocumentContentParser parser = new PdfDocumentContentParser(doc.getPdfDocument()); + TextMarginFinder finder = parser.processContent(lastPage, new TextMarginFinder()); + area.getBBox().decreaseHeight(finder.getTextRectangle().getHeight()); + } + return area; + } + }); + + doc.add(driverTable); + + doc.add(new Paragraph("货物信息").setMarginBottom(15).setMarginTop(30).setFont(font).setBold()); + + doc.add(cargoTable); + + doc.close(); + } +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/DictHandler.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/DictHandler.java new file mode 100644 index 0000000..cbbe786 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/DictHandler.java @@ -0,0 +1,449 @@ +package com.haitonggauto.rtosc.handler; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.haitonggauto.rtosc.api.NuzarOpenApi; +import com.haitonggauto.rtosc.api.NuzarPubApi; +import com.haitonggauto.rtosc.api.dto.*; +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.ResultUtil; +import com.haitonggauto.rtosc.repository.entity.CustomerLinkman; +import com.haitonggauto.rtosc.repository.service.CustomerLinkmanService; +import com.nuzar.common.security5.core.SimpleAuthentication; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.cloud.context.config.annotation.RefreshScope; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.oauth2.core.OAuth2AccessToken; +import org.springframework.security.oauth2.jwt.Jwt; +import org.springframework.security.oauth2.server.resource.authentication.BearerTokenAuthentication; +import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.constraints.NotBlank; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 用来获取一些基础字典信息 + */ +@RestController +@RequestMapping("/dd") +@Api(tags = "基础字典") +@RefreshScope +@Validated +public class DictHandler implements BaseHandler { + + @Resource + private LoginHandler loginHandler; + + @Resource + private NuzarPubApi nuzarPubApi; + + @Resource + private NuzarOpenApi nuzarOpenApi; + + @Resource + private CustomerLinkmanService customerLinkmanService; + + private Map getAuthorization() { + Map headers = new HashMap<>(); + if (SecurityContextHolder.getContext().getAuthentication() instanceof BearerTokenAuthentication) { + BearerTokenAuthentication auth = (BearerTokenAuthentication) SecurityContextHolder.getContext().getAuthentication(); + if (auth != null && auth.isAuthenticated()) { + headers.put("Authorization", String.format("%s %s", "bearer", ((OAuth2AccessToken) auth.getToken()).getTokenValue())); + } + } + + if (SecurityContextHolder.getContext().getAuthentication() instanceof SimpleAuthentication) { + SimpleAuthentication auth = (SimpleAuthentication) SecurityContextHolder.getContext().getAuthentication(); + if (auth != null && auth.isAuthenticated() && auth.getBearerToken() != null) { + headers.put("Authorization", String.format("%s %s", "bearer", auth.getBearerToken())); + } + } + + if (SecurityContextHolder.getContext().getAuthentication() instanceof JwtAuthenticationToken) { + JwtAuthenticationToken auth = (JwtAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); + headers.put("Authorization", String.format("%s %s", "bearer", ((Jwt) auth.getToken()).getTokenValue())); + } + + headers.put("x-request-permitted", System.currentTimeMillis() + ""); + + return headers; + } + + // 贸易类型 + @ApiOperation("贸易类型") + @PostMapping("/tradType") + public Result> getTradType() { + List rst = null; + + List list = nuzarPubApi.getTradType(); + + if (CollectionUtils.isEmpty(list)) { + return ResultUtil.success(Collections.emptyList()); + } else { + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getPtrCode()); + dto.setText(item.getPtrDesc()); + return dto; + }).collect(Collectors.toList()); + } + + return ResultUtil.success(rst); + } + + @ApiOperation("获取所有船舶") + @PostMapping("/ship/all") + public Result> getAllShip(@RequestParam(required = false) String q) { + List rst = null; + + List list = nuzarPubApi.getAllShip(); + + if (CollectionUtils.isEmpty(list)) { + return ResultUtil.success(Collections.emptyList()); + } else { + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getSpmId()); + dto.setText(item.getVslCnname()); + dto.setExtra1(item.getVslEnname()); + return dto; + }).collect(Collectors.toList()); + } + + if (StringUtils.isNotEmpty(q)) { + rst = rst.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); + } + + return ResultUtil.success(rst); + } + + // IMPORT_EXPORT_TYPE 进出品类型 + // 港口 + @ApiOperation("港口") + @PostMapping("/port") + public Result> getPortList(@RequestParam(required = false) String q) { + List rst = null; + + List list = nuzarPubApi.getPortList(); + + if (CollectionUtils.isEmpty(list)) { + return ResultUtil.success(Collections.emptyList()); + } else { + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getPotId()); + dto.setText(item.getPotCnname()); + dto.setExtra1(item.getPotEnname()); + return dto; + }).collect(Collectors.toList()); + } + + if (StringUtils.isNotEmpty(q)) { + rst = rst.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); + } + + return ResultUtil.success(rst); + } + + // 通过港口获取国家名称 + @ApiOperation("通过港口ID获取国家名称") + @PostMapping("/countryByPortName") + public Result getCountryByPortName(@RequestParam @NotBlank(message = "请传入港口ID") String potId) { + PortAreaCountryDTO portAreaCountryDTO = nuzarOpenApi.getPortAreaCountry(potId); + if (portAreaCountryDTO != null) { + DictDTO dto = new DictDTO(); + dto.setId(portAreaCountryDTO.getCtyId()); + dto.setText(portAreaCountryDTO.getCtyCnname()); + dto.setExtra1(portAreaCountryDTO.getCtyEnname()); + dto.setExtra2(portAreaCountryDTO.getCtyCode()); + return ResultUtil.success(dto); + } + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "查无数据"); + + } + + // 港区 + @ApiOperation("港区") + @PostMapping("/portArea") + public Result> getPortAreaList(@RequestParam(required = false) String q) { + List rst = null; + + List list = nuzarPubApi.getPortAreaList(); + + if (CollectionUtils.isEmpty(list)) { + return ResultUtil.success(Collections.emptyList()); + } else { + rst = list.stream().filter(item -> StringUtils.equalsIgnoreCase("Y", item.getValid())).map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getPamId()); + dto.setText(item.getPamName()); + dto.setExtra1(item.getPamNo()); + return dto; + }).collect(Collectors.toList()); + } + + if (StringUtils.isNotEmpty(q)) { + rst = rst.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); + } + + return ResultUtil.success(rst); + } + + // 航次 + @ApiOperation("航次") + @PostMapping("/voyage") + public Result> getVoyageList() { + List rst = new ArrayList<>(); + + DictDTO ht6 = new DictDTO(); + ht6.setId("HT6"); + ht6.setText("HT6"); + rst.add(ht6); + + DictDTO httc = new DictDTO(); + httc.setId("HTTC"); + httc.setText("HTTC"); + rst.add(httc); + + DictDTO htlg = new DictDTO(); + htlg.setId("HTLG"); + htlg.setText("HTLG"); + rst.add(htlg); + + return ResultUtil.success(rst); + } + + @ApiOperation("国家城市") + @PostMapping("/city/queryOrigin") + public Result> getCountryList(@RequestParam(required = false) String key) { + + List list = nuzarPubApi.getCountryList(key); + + if (CollectionUtils.isEmpty(list)) { + return ResultUtil.success(Collections.emptyList()); + } else { + + } + + return ResultUtil.success(list); + } + + // 运输方式 + @ApiOperation("运输方式") + @PostMapping("/transportWay") + public Result> getTransportWayList(@RequestParam(required = false) String q) { + List rst = null; + + List list = nuzarPubApi.getTransportWayList(); + + if (CollectionUtils.isEmpty(list)) { + return ResultUtil.success(Collections.emptyList()); + } else { + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getPtrCode()); + dto.setText(item.getPtrDesc()); + return dto; + }).collect(Collectors.toList()); + } + + if (StringUtils.isNotEmpty(q)) { + rst = rst.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); + } + + return ResultUtil.success(rst); + } + + // 品牌 + @ApiOperation("品牌") + @PostMapping("/brand") + public Result> getBrandList(@RequestParam(required = false) String q) { + List rst = null; + + List list = nuzarPubApi.getBrandList(); + + if (CollectionUtils.isEmpty(list)) { + return ResultUtil.success(Collections.emptyList()); + } else { + rst = list.stream().filter(item -> StringUtils.equalsIgnoreCase("Y", item.getValid())).map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getBrdId()); + dto.setText(item.getBrdName()); + dto.setExtra1(item.getBrdEnname()); + return dto; + }).collect(Collectors.toList()); + } + + if (StringUtils.isNotEmpty(q)) { + rst = rst.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); + } + + return ResultUtil.success(rst); + } + + // 车型 + @ApiOperation("车型") + @PostMapping("/cartType") + public Result> getCartTypeList(@RequestParam(required = false) String q) { + List rst = null; + + List list = nuzarOpenApi.getCartTypeList(); + + if (CollectionUtils.isEmpty(list)) { + return ResultUtil.success(Collections.emptyList()); + } else { + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getId()); + dto.setText(item.getName()); + return dto; + }).collect(Collectors.toList()); + } + + if (StringUtils.isNotEmpty(q)) { + rst = rst.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); + } + + return ResultUtil.success(rst); + } + + // 车型明细 + @ApiOperation("车型明细") + @PostMapping("/cartTypeDetail") + public Result> getCartTypeDetailList(@RequestParam(required = false) @NotBlank(message = "车型Id不能为空") String cartTypeId, @RequestParam(required = false) String q) { + List rst = null; + + List list = nuzarOpenApi.getCartTypeDetailList(cartTypeId); + + if (CollectionUtils.isEmpty(list)) { + return ResultUtil.success(Collections.emptyList()); + } else { + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getBvdId()); + dto.setText(item.getBvdType()); + return dto; + }).collect(Collectors.toList()); + } + + if (StringUtils.isNotEmpty(q)) { + rst = rst.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getText(), q) || StringUtils.equalsAnyIgnoreCase(item.getExtra1(), q)).collect(Collectors.toList()); + } + + return ResultUtil.success(rst); + } + + // 操作模式 + @ApiOperation("操作模式") + @PostMapping("/operateType") + public Result> getOperateTypeList(@RequestParam(required = false) String cartTypeName) { + List rst = new ArrayList<>(); + + List list = null; + if (StringUtils.isNotEmpty(cartTypeName)) { + if (StringUtils.equals("备件", cartTypeName)) { + list = nuzarPubApi.getSpareOperateTypeList(); + } else { + list = nuzarPubApi.getOperateTypeList(); + } + } else { + list = nuzarPubApi.getOperateTypeList(); + if (CollectionUtils.isNotEmpty(list)) { + list.addAll(nuzarPubApi.getSpareOperateTypeList()); + } else { + list = nuzarPubApi.getSpareOperateTypeList(); + } + } + + if (CollectionUtils.isEmpty(list)) { + return ResultUtil.success(Collections.emptyList()); + } else { + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getPtrCode()); + dto.setText(item.getPtrDesc()); + return dto; + }).collect(Collectors.toList()); + } + + return ResultUtil.success(rst); + } + + // 源类型 + @ApiOperation("源类型") + @PostMapping("/energyType") + public Result> getEnergyTypeList() { + List rst = null; + + List list = nuzarPubApi.getEnergyTypeList(); + + if (CollectionUtils.isEmpty(list)) { + return ResultUtil.success(Collections.emptyList()); + } else { + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getPtrCode()); + dto.setText(item.getPtrDesc()); + return dto; + }).collect(Collectors.toList()); + } + + return ResultUtil.success(rst); + } + + // 货类列表 + @ApiOperation("货类列表") + @PostMapping("/cargoType") + public Result> getCargoTypeList() { + List rst = null; + + List list = nuzarPubApi.getCargoTypeList(); + + if (CollectionUtils.isEmpty(list)) { + return ResultUtil.success(Collections.emptyList()); + } else { + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getPtrCode()); + dto.setText(item.getPtrDesc()); + return dto; + }).collect(Collectors.toList()); + } + + return ResultUtil.success(rst); + } + + @PostMapping("/customer/linkman") + @ApiOperation("获取客户的联系对象") + public Result> getCustomerUser(@RequestParam(required = false) String q) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CustomerLinkman::getCreateBy, UserContext.getUser().getUserId()); + query.like(StringUtils.isNotEmpty(q), CustomerLinkman::getFreight, q); + + return ResultUtil.success(customerLinkmanService.list(query)); + } + + // 获取公司信息 + @PostMapping("/company") + @ApiOperation("获取公司信息") + public Result> getCompanyList(@RequestBody List cueTypes) { + List list = nuzarPubApi.getCompanyList(cueTypes); + + if (CollectionUtils.isEmpty(list)) { + return ResultUtil.success(Collections.emptyList()); + } else { + return ResultUtil.success(list); + } + } + +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportInHandler.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportInHandler.java new file mode 100644 index 0000000..ac7e68e --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportInHandler.java @@ -0,0 +1,2456 @@ +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.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; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +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.dto.CheckVinReq; +import com.haitonggauto.rtosc.api.dto.CityDTO; +import com.haitonggauto.rtosc.api.dto.VinStatusRequest; +import com.haitonggauto.rtosc.api.dto.WorkStatusDTO; +import com.haitonggauto.rtosc.client.dto.PortEnDTO; +import com.haitonggauto.rtosc.client.dto.VinValidDTO; +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.*; +import com.haitonggauto.rtosc.excel.*; +import com.haitonggauto.rtosc.query.CargoQuery; +import com.haitonggauto.rtosc.query.ExportInCheckQuery; +import com.haitonggauto.rtosc.query.ExportInQuery; +import com.haitonggauto.rtosc.repository.entity.*; +import com.haitonggauto.rtosc.handler.excel.ReadExcelListener; +import com.haitonggauto.rtosc.handler.mapper.PoMapper; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.haitonggauto.rtosc.repository.query.PrintQuery; +import com.haitonggauto.rtosc.repository.service.CustomerExportInCargoService; +import com.haitonggauto.rtosc.repository.service.CustomerExportInService; +import com.haitonggauto.rtosc.repository.service.CustomerExportInTimesService; +import com.haitonggauto.rtosc.repository.service.CustomerExportLoadService; +import com.haitonggauto.rtosc.service.CustomerService; +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 org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +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.*; +import java.math.BigDecimal; +import java.net.URLEncoder; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("/ee") +@Api(tags = "出口进场") +@Validated +public class ExportInHandler implements BaseHandler { + + @Resource + private CustomerService customerService; + + @Resource + private CustomerExportInService customerExportInService; + + @Resource + private CustomerExportInCargoService customerExportInCargoService; + + @Resource + private CustomerExportInTimesService customerExportInTimesService; + + @Resource + private CustomerExportLoadService customerExportLoadService; + + @Resource + private DictHandler dictHandler; + + @Resource + private NuzarOpenApi openApi; + + @Resource + private NuzarShpApi shpApi; + + @ApiOperation("船名航次模糊匹配") + @PostMapping("/shipVoyage") + public Result> getExportInShipNameList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) String q) { + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct ship_id, ship_name, ship_en_name, voyage_id, voyage"); + 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); + wrapper.or().like("voyage", q); + }); + } + + Page page = customerExportInService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(tmp -> { + ShipVoyageVo vo = new ShipVoyageVo(); + vo.setShipId(tmp.getShipId()); + vo.setShipName(tmp.getShipName()); + vo.setShipEnName(tmp.getShipEnName()); + vo.setVoyageId(tmp.getVoyageId()); + vo.setVoyage(tmp.getVoyage()); + return vo; + }).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + @ApiOperation("提单号模糊匹配") + @PostMapping("/billNo/query") + public Result> getExportInBillNoList( + @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 query = new LambdaQueryWrapper<>(); + query.eq(CustomerExportIn::getCreateBy, UserContext.getUser().getUserId()); + query.eq(StringUtils.isNotEmpty(shipName), CustomerExportIn::getShipName, shipName); + query.eq(StringUtils.isNotEmpty(voyage), CustomerExportIn::getVoyage, voyage); + query.like(StringUtils.isNotEmpty(q), CustomerExportIn::getBillNum, q); // 提单号 + + Page page = customerExportInService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(item -> item.getBillNum()).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + @ApiOperation("审核端所有待审核船名列表") + @PostMapping("/check/ship/list") + public Result> getCheckShipList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) String q) { + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct ship_id, ship_name, ship_en_name"); + query.in("check_status", Arrays.asList(AuditEnum.AUDIT)); + if (StringUtils.isNotEmpty(q)) { + query.and((wrapper) -> { + wrapper.like("ship_name", q); + wrapper.or().like("ship_en_name", q); + }); + } + + Page page = customerExportInService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getShipId()); + dto.setText(item.getShipName()); + dto.setExtra1(item.getShipEnName()); + return dto; + }).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + /** + * 分页查询 + * + * @param query + * @return + */ + @ApiOperation("条件分页查询") + @PostMapping("/query-list") + public Result> query(@RequestBody ExportInQuery query) { + if (query.getEndEnterTime() != null) { + query.setEndEnterTime(DateUtils.getDayEnd(query.getEndEnterTime())); + } + query.setCreateBy(UserContext.getUser().getUserId()); + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerExportIn.class, query); + Page page = customerExportInService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + page.getRecords().forEach(item -> { + customerService.wrapperEntity(item); + }); + return ResultUtil.success(page); + } + + @ApiOperation("审核端条件分页查询") + @PostMapping("/check/query-list") + public Result> checkQuery(@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)); + } + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerExportIn.class, query); + Page page = customerExportInService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + return ResultUtil.success(page); + } + + @ApiOperation("根据航次ID查询审核通过进港记录") + @PostMapping("/query-list/voyage") + public Result> checkQuery(@RequestParam(required = false) @NotBlank(message = "航次ID不能为空") String voyageId, + @RequestParam(required = false) AuditEnum status) { + if (status == null) { + status = AuditEnum.AUDIT_PASS; + } + List list = customerExportInService.getListByVoyageId(voyageId, status); + customerService.wrapperEntity(list); + return ResultUtil.success(list); + } + + @ApiOperation("出口条码打印列表查询") + @PostMapping("/check/list") + public Result> checkList(@RequestBody ExportInCheckQuery query) { + if (query.getEndEnterTime() != null) { + query.setEndEnterTime(DateUtils.getDayEnd(query.getEndEnterTime())); + } + query.setCheckStatus(AuditEnum.AUDIT_PASS); + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerExportIn.class, query); + List list = customerExportInService.list(queryWrapper); + customerService.wrapperEntity(list); + return ResultUtil.success(list); + } + + @ApiOperation("出口条码(航次)打印列表查询") + @PostMapping("/print/voyage") + public Result> getPrintList(@RequestBody PrintQuery query) { + + return ResultUtil.success(customerExportInCargoService.getListByVoyageId(query)); + } + + /** + * 通过提单号获取基本信息 + * + * @param billNum + * @return + */ + @ApiOperation("通过提单号获取基本信息") + @PostMapping("/query-billNum") + public Result queryByBillNum(@RequestParam @NotBlank(message = "请传入提单号") String billNum) { + + CustomerExportIn exportIn = customerExportInService.getOne(new LambdaQueryWrapper().eq(CustomerExportIn::getBillNum, billNum), false); + + customerService.wrapperEntity(exportIn); + + if (exportIn == null) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "提单号:" + billNum + "不存在"); + } + + List times = customerExportInTimesService.list(new LambdaQueryWrapper().eq(CustomerExportInTimes::getExportInId, exportIn.getId())); + customerService.wrapperEntity(times); + + List collect = customerExportInCargoService.list(new LambdaQueryWrapper().eq(CustomerExportInCargo::getExportInId, exportIn.getId())); + + customerService.wrapperEntity(collect); + + List cargos = collect.stream().filter(item -> item.getCargoType() == 0).collect(Collectors.toList()); + + List spares = collect.stream().filter(item -> item.getCargoType() == 1).collect(Collectors.toList()); + + + exportIn.setTimes(times); + exportIn.setCargos(cargos); + exportIn.setSpares(spares); + + return ResultUtil.success(exportIn); + } + + @ApiOperation("货物明细分页列表") + @PostMapping("/cargos/page") + public Result> cargoList(@RequestBody @Validated(ValidationGroup.update.class) CargoQuery query) { + CustomerExportIn exportIn = customerExportInService.getById(query.getId()); + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + queryWrapper.eq(query.getId() != null, CustomerExportInCargo::getExportInId, query.getId()); + if (query.getCargoType() != null) { + queryWrapper.eq(CustomerExportInCargo::getCargoType, query.getCargoType()); + } + Page page = customerExportInCargoService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + + customerService.wrapperEntity(page.getRecords()); + + page.getRecords().forEach(item -> { + item.setBrandId(exportIn.getBrandId()); + item.setBrand(exportIn.getBrand()); + item.setCartTypeId(exportIn.getCartTypeId()); + item.setCartType(exportIn.getCartType()); + item.setBillNum(exportIn.getBillNum()); + item.setShipEnName(exportIn.getShipEnName()); + item.setVoyage(exportIn.getVoyage()); + item.setShipName(exportIn.getShipName()); + item.setModels(exportIn.getModels()); + }); + + // 获取作业状态 + Map collect = null; + List vins = page.getRecords().stream().map(item -> item.getVin()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(vins)) { + VinStatusRequest req = new VinStatusRequest(); + req.setBusinessType("IN_PORT"); + req.setImportExportType("E"); + req.setVinCodeList(vins); + if (!StringUtils.equalsAnyIgnoreCase(exportIn.getVoyageId(), "HT6", "HTLG", "HTTC")) { + req.setVvyId(exportIn.getVoyageId()); + } + List status = openApi.getVinStatus(req); + collect = status.stream().collect(Collectors.toMap(WorkStatusDTO::getVinCode, WorkStatusDTO::getWorkStatus)); + } + if (MapUtils.isNotEmpty(collect)) { + for (CustomerExportInCargo cargo : page.getRecords()) { + cargo.setWorkStatus(collect.get(cargo.getVin())); + } + } + return ResultUtil.success(page); + } + + /** + * 新增 + * + * @param form + * @return 要求: + * 进场时间和进场货物的进场时间是绑定的,进场货物的时间必须在进场时间的范围内,否则不可选 (完成) + * 进场时间的数量加起来要和数量进行匹配,如果超过无法进行输入,自动获取进场时间加起来的数量 (完成) + * 数量必须≤单票件数,否则不能跳转下一步,并提示“数量不得超过单票件数” (完成) + * 如果提单号相同,默认将之前已填的单票件数、单票体积、单票重量的数据带入,支持修改,修改提交后,相同提单号的单票件数、单票体积、单票重量都同步修改。 (完成) + * 异常情况有,必填项车架号,车架号必须17位,数据重复,如果重复进行覆盖更新 (完成) + * 车架号重复不支持导入或新增 (完成) + * 新增的如果车型选择的是备件,显示备件的条形码和备件号的信息 + * 备件的条形码根据数量自动生成,按照数量生成对应的条数,一对一 + * 序号从01开始 + * 条形码系统自动生成,BJ+生成的时间日期,唯一的条形码信息,开发可自行定义 + * 点击提交审核,数据进入海通后台去审核,状态为待审核 + * 点击保存,状态为待提交,数据不会进入海通后台审核页面 + */ + @ApiOperation("新增") + @PostMapping("/add") + public Result save(@RequestBody @Validated(ValidationGroup.insert.class) ExportInVo form) { + // 验证是否有重复的车架号 + if (CollectionUtils.isNotEmpty(form.getCargos())) { + List repeat = form.getCargos().stream().collect(Collectors.groupingBy(ExportInCargoVo::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复"); + } + } + if (CollectionUtils.isNotEmpty(form.getSpares())) { + List repeat = form.getSpares().stream().collect(Collectors.groupingBy(ExportInCargoVo::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复"); + } + } + String batchNo = customerService.getSequenceNo("export_in_batch_no", "出口进场", "EI"); + // 表单验证以及格式转换 + CustomerExportIn exportIn = PoMapper.instance.exportInVo2Entity(form); + exportIn.setBatchNo(batchNo); + exportIn.setCheckStatus(AuditEnum.SUBMIT); // 待提交, 待审核, 审核通守,审核拒绝 + exportIn.setApplyTime(new Date()); + exportIn.setApplicantId(UserContext.getUser().getUserId()); + exportIn.setTermcd(exportIn.getPortAreaId()); + + List cargos = form.getCargos().stream().map(item -> { + CustomerExportInCargo entity = PoMapper.instance.exportInCargoVo2Entity(item); + entity.setBrand(exportIn.getBrand()); + entity.setBrandId(exportIn.getBrandId()); + entity.setCargoType(0); + entity.setTermcd(exportIn.getPortAreaId()); + entity.setVinStatus(1); + return entity; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(cargos)) { + if (exportIn.getQuantity() != cargos.size()) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车辆数不等于明细数量"); + } + } + + List times = form.getTimes().stream().map(item -> { + CustomerExportInTimes entity = PoMapper.instance.exportInTimesVo2Entity(item); + entity.setTermcd(exportIn.getPortAreaId()); + return entity; + }).collect(Collectors.toList()); + + // 如果车型是备件,则自动生成条码 + List spares = form.getSpares().stream().map(item -> { + CustomerExportInCargo entity = PoMapper.instance.exportInCargoVo2Entity(item); + entity.setBrand(exportIn.getBrand()); + entity.setBrandId(exportIn.getBrandId()); + entity.setCargoType(1); + entity.setTermcd(exportIn.getPortAreaId()); + entity.setVinStatus(1); + return entity; + }).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(spares) && StringUtils.equalsAnyIgnoreCase(exportIn.getCartType(), "备件", "BJ")) { + // 出口进场计划备件条码生成的规则要变一下,BJ+年月日时分+5随机数,一共要17位 + String prefix = StringUtils.join("BJ", DateUtil.format(new Date(), "yyMMddHHmm")); + List vins = new ArrayList<>(exportIn.getQuantity()); + do { + String vin = prefix + RandomUtil.randomNumbers(5); + if (!vins.contains(vin)) { + vins.add(vin); + } + } while (vins.size() < exportIn.getQuantity()); + spares = vins.stream().map(item -> { + CustomerExportInCargo entity = new CustomerExportInCargo(); + entity.setBrand(exportIn.getBrand()); + entity.setBrandId(exportIn.getBrandId()); + entity.setCargoType(1); + entity.setVin(item); + entity.setTermcd(exportIn.getPortAreaId()); + entity.setVinStatus(1); + return entity; + }).collect(Collectors.toList()); + } + + if (CollectionUtils.isEmpty(cargos) && CollectionUtils.isEmpty(spares)) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车辆和备件不能都为空"); + } + + // 进场时间和进场货物的进场时间是绑定的,进场货物的时间必须在进场时间的范围内,否则不可选 + long count = times.stream().filter(item -> DateUtil.compare(item.getEnterTime(), exportIn.getEndEnterTime()) > 0 || DateUtil.compare(item.getEnterTime(), exportIn.getBeginEnterTime()) < 0).count(); + if (count > 0) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "进场货物的进场时间,要小于表头进场时间"); + } + // 进场时间的数量加起来要和数量进行匹配,如果超过无法进行输入,自动获取进场时间加起来的数量 + int num = times.stream().mapToInt(CustomerExportInTimes::getEnterQuantity).sum(); + if (num != exportIn.getQuantity()) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "进场货物的数量,要等于进场货物的所有数量"); + } + + // 验证同一提单下,所有进场的数量,体积,重量和提单号的每票的数量进行, 船名,航次 + QueryWrapper nQuery = new QueryWrapper<>(); + nQuery.select("sum(quantity) as quantity, sum(volume) as volume, sum(weight) as weight") + .eq("bill_num", exportIn.getBillNum()) + .eq("ship_id", exportIn.getShipId()) + .eq("voyage_id", exportIn.getVoyageId()); + Map map = customerExportInService.getMap(nQuery); + if (MapUtils.isEmpty(map)) { + map = new HashMap<>(); + map.put("quantity", new BigDecimal(0)); + map.put("weight", new BigDecimal(0)); + map.put("volume", new BigDecimal(0)); + } + if (new BigDecimal(exportIn.getEachQuantity()).compareTo(((BigDecimal) map.get("quantity")).add(new BigDecimal(exportIn.getQuantity()))) < 0) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "数量不得超过单票件数"); + } + if (exportIn.getEachWeight().compareTo(((BigDecimal) map.get("weight")).add(exportIn.getWeight())) < 0) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "重量不得超过单票重量"); + } + if (exportIn.getEachVolume().compareTo(((BigDecimal) map.get("volume")).add(exportIn.getVolume())) < 0) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "体积不得超过单票体积"); + } + + // 数量必须≤单票件数,否则不能跳转下一步,并提示“数量不得超过单票件数” 通过自定义验证组件实现 + //* 车架号重复不支持导入或新增 + if (CollectionUtils.isNotEmpty(cargos)) { // 验证车架号 + // 查询 车架号在系统中是否已经存在, 编辑的和新增的判断方式是不一样的 + List vins = cargos.stream().map(item -> item.getVin()).collect(Collectors.toList()); + List exists = customerExportInCargoService.list(new LambdaQueryWrapper().in(CustomerExportInCargo::getVin, vins)); + if (CollectionUtils.isNotEmpty(exists)) { + // 查询出对应的港区 + List list = customerExportInService.lambdaQuery().in(CustomerExportIn::getId, exists.stream().map(item -> item.getExportInId()).collect(Collectors.toList())).list(); + Map portAreaMap = list.stream().collect(Collectors.toMap(CustomerExportIn::getId, CustomerExportIn::getPortAreaId)); + // 通过接口再次验证 + List req = exists.stream().map(item -> { + CheckVinReq v = new CheckVinReq(); + v.setIsRepetition(true); + v.setPamId(portAreaMap.get(item.getExportInId())); + v.setVinCode(item.getVin()); + return v; + }).collect(Collectors.toList()); + List rst = shpApi.checkVinRepeat(req); + if (CollectionUtils.isNotEmpty(rst)) { + // 再次过滤出重复的 + List collect = rst.stream().filter(item -> item.getIsRepetition()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(collect)) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车架号已存在<接口验证>:" + collect.stream().map(item -> item.getVinCode()).collect(Collectors.joining(","))); + } + } else { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车架号已存在:" + exists.stream().map(item -> item.getVin()).collect(Collectors.joining(","))); + } + } + } + + Long id = customerService.saveExportIn(exportIn, cargos, times, spares); + + return ResultUtil.success(String.valueOf(id)); + } + + @ApiOperation("提交审核") + @PostMapping("/submit-check") + public Result submitCheck(@RequestBody + @NotNull(message = "请传入要审核的出口进场ID") + @Size(min = 1, message = "ID列表不能为空") List ids) { + customerExportInService.lambdaUpdate().set(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT) + .set(CustomerExportIn::getCheckResult, null) + .in(CustomerExportIn::getId, ids).update(); + return ResultUtil.success("success"); + } + + @ApiOperation("取消/恢复车架号") + @PostMapping("/recover/vin") + @Transactional(rollbackFor = {Exception.class}) + public Result recoverVin(@RequestBody @Validated(ValidationGroup.update.class) CargoStatusVo form) { + if (form.getEachQuantity() == null || form.getEachVolume() == null || form.getEachWeight() == null) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "单票体积,单票件数,单票重量不能为空"); + } + // 查询出货物列表 + List 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()) + .list(); + // 转成MAP + Map collect = list.stream().collect(Collectors.toMap(CustomerExportInCargo::getVin, item -> item)); + // 找出状态不一致的,(有些情况下可能会出现本来是正常的,传进来的也是正常) + Map> listMap = form.getVins().stream().filter(item -> collect.containsKey(item.getVin())).filter(item -> item.getStatus() != collect.get(item.getVin()).getVinStatus()) + .collect(Collectors.groupingBy(CargoStatus::getStatus)); + + if (listMap.containsKey(0)) { // 代表取消 + listMap.get(0).stream().map(item -> collect.get(item.getVin())) // 找到数据库中的明细 + .collect(Collectors.groupingBy(CustomerExportInCargo::getExportInId)) // 按主表ID进行分组 + .entrySet().stream().forEach(entry -> { + // 修改进场数量,和数量 + customerExportInService.update().setSql("enter_quantity=enter_quantity-" + entry.getValue().size() + ",quantity=quantity-" + entry.getValue().size()) + .eq("id", entry.getKey()).update(); + }); + } else if (listMap.containsKey(1)) { // 代表恢复 + listMap.get(1).stream().map(item -> collect.get(item.getVin())) // 找到数据库中的明细 + .collect(Collectors.groupingBy(CustomerExportInCargo::getExportInId)) // 按主表ID进行分组 + .entrySet().stream().forEach(entry -> { + // 修改进场数量,和数量 + customerExportInService.update().setSql("enter_quantity=enter_quantity+" + entry.getValue().size() + ",quantity=quantity+" + entry.getValue().size()) + .eq("id", entry.getKey()).update(); + }); + } + + // 批量修改车辆的状态 + List update = new ArrayList<>(); + listMap.entrySet().stream().forEach(item -> { + update.addAll(item.getValue().stream().map(p -> { + CustomerExportInCargo cargo = collect.get(p.getVin()); + cargo.setVinStatus(item.getKey()); + return cargo; + }).collect(Collectors.toList())); + }); + customerExportInCargoService.updateBatchById(update); + + // 修改提单号的信息 + customerExportInService.lambdaUpdate() + .set(CustomerExportIn::getEachQuantity, form.getEachQuantity()) + .set(CustomerExportIn::getEachWeight, form.getEachWeight()) + .set(CustomerExportIn::getEachVolume, form.getEachVolume()) + .eq(CustomerExportIn::getShipId, form.getShipId()) + .eq(CustomerExportIn::getVoyageId, form.getVoyageId()) + .eq(CustomerExportIn::getBillNum, form.getBillNo()) + .update(); + + return ResultUtil.success("success"); + } + + /** + * 删除 + * + * @param ids + * @return + */ + @ApiOperation("删除") + @PostMapping("/del") + public Result delete(@RequestBody + @NotNull(message = "请传入要删除的出口进场ID") + @Size(min = 1, message = "请传入要删除的出口进场ID") List ids) { + for (Long id : ids) { + // 货物已开始作业,也不能删除 + List list = customerExportInCargoService.lambdaQuery().eq(CustomerExportInCargo::getExportInId, id).isNotNull(CustomerExportInCargo::getWorkStatus).list(); + if (CollectionUtils.isNotEmpty(list)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "货物已开始作业,也不能删除"); + } + // 待提交,已驳回的可以删除 + CustomerExportIn exportIn = customerExportInService.getById(id); + if (exportIn == null) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "要删除的ID不存在"); + } + if (exportIn.getCheckStatus() == AuditEnum.SUBMIT || exportIn.getCheckStatus() == AuditEnum.AUDIT_REJECT || exportIn.getCheckStatus() == AuditEnum.AUDIT) { + customerService.delExportIn(id); + } else { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "已审核通过的不可删除"); + } + } + return ResultUtil.success("success"); + } + + /** + * 编辑 + * + * @param form + * @return + */ + @ApiOperation("审核端编辑") + @PostMapping("/checker/edit") + // 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法 + public Result checker(@RequestBody @Validated(ValidationGroup.update.class) ExportInVo form) { + return this.edit(true, form); + } + + /** + * 编辑 + * + * @param form + * @return + */ + @ApiOperation("编辑") + @PostMapping("/edit") + // 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法 + public Result edit(@RequestParam(required = false, defaultValue = "false") Boolean flag, + @RequestBody @Validated(ValidationGroup.update.class) ExportInVo form) { + // 验证是否有重复的车架号 + if (CollectionUtils.isNotEmpty(form.getCargos())) { + List repeat = form.getCargos().stream().collect(Collectors.groupingBy(ExportInCargoVo::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复"); + } + } + if (CollectionUtils.isNotEmpty(form.getSpares())) { + List repeat = form.getSpares().stream().collect(Collectors.groupingBy(ExportInCargoVo::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复"); + } + } + + CustomerExportIn in = customerExportInService.getById(form.getId()); + if (in.getCheckStatus() == AuditEnum.AUDIT_PASS) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "审核通过之后不能进行编辑"); + } + String batchNo = in.getBatchNo(); + // 表单验证以及格式转换 + CustomerExportIn exportIn = PoMapper.instance.exportInVo2Entity(form); + exportIn.setBatchNo(batchNo); + exportIn.setTermcd(exportIn.getPortAreaId()); + if (!flag) { + exportIn.setCheckStatus(AuditEnum.SUBMIT); + } else { + exportIn.setCheckStatus(AuditEnum.AUDIT); + } + + List cargos = form.getCargos().stream().map(item -> { + CustomerExportInCargo entity = PoMapper.instance.exportInCargoVo2Entity(item); + entity.setBrand(exportIn.getBrand()); + entity.setBrandId(exportIn.getBrandId()); + entity.setCargoType(0); + entity.setTermcd(exportIn.getPortAreaId()); + entity.setVinStatus(1); + return entity; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(cargos)) { + if (exportIn.getQuantity() != cargos.size()) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车辆数不等于明细数量"); + } + } + + List times = form.getTimes().stream().map(item -> { + CustomerExportInTimes entity = PoMapper.instance.exportInTimesVo2Entity(item); + entity.setTermcd(exportIn.getPortAreaId()); + return entity; + }).collect(Collectors.toList()); + + List spares = form.getSpares().stream().map(item -> { + CustomerExportInCargo entity = PoMapper.instance.exportInCargoVo2Entity(item); + entity.setBrand(exportIn.getBrand()); + entity.setBrandId(exportIn.getBrandId()); + entity.setCargoType(1); + entity.setTermcd(exportIn.getPortAreaId()); + entity.setVinStatus(1); + return entity; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(spares)) { + // 验证数量 + if (exportIn.getQuantity() < spares.size()) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "备件列表不能大于备件总数"); + } + if (exportIn.getQuantity() > spares.size()) { // 自动生成备件号 + String prefix = StringUtils.join("BJ", DateUtil.format(new Date(), "yyMMddHHmm")); + List vins = new ArrayList<>(exportIn.getQuantity() - spares.size()); + do { + String vin = prefix + RandomUtil.randomNumbers(5); + if (!vins.contains(vin)) { + vins.add(vin); + } + } while (vins.size() < exportIn.getQuantity() - spares.size()); + List addSpares = vins.stream().map(item -> { + CustomerExportInCargo entity = new CustomerExportInCargo(); + entity.setBrand(exportIn.getBrand()); + entity.setBrandId(exportIn.getBrandId()); + entity.setCargoType(1); + entity.setVin(item); + entity.setTermcd(exportIn.getPortAreaId()); + entity.setVinStatus(1); + return entity; + }).collect(Collectors.toList()); + + spares.addAll(addSpares); + } + } + + if (CollectionUtils.isEmpty(cargos) && CollectionUtils.isEmpty(spares)) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车辆和备件不能都为空"); + } + + // 进场时间和进场货物的进场时间是绑定的,进场货物的时间必须在进场时间的范围内,否则不可选 + long count = times.stream().filter(item -> DateUtil.compare(item.getEnterTime(), exportIn.getEndEnterTime()) > 0 || DateUtil.compare(item.getEnterTime(), exportIn.getBeginEnterTime()) < 0).count(); + if (count > 0) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "进场货物的进场时间,要小于表头进场时间"); + } + // 进场时间的数量加起来要和数量进行匹配,如果超过无法进行输入,自动获取进场时间加起来的数量 + int num = times.stream().mapToInt(CustomerExportInTimes::getEnterQuantity).sum(); + if (num != exportIn.getQuantity()) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "进场货物的数量,要等于进场货物的所有数量"); + } + // 数量必须≤单票件数,否则不能跳转下一步,并提示“数量不得超过单票件数” + if (num > exportIn.getEachQuantity()) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "数量不得超过单票件数"); + } + + // 验证同一提单下,所有进场的数量,体积,重量和提单号的每票的数量进行 + QueryWrapper nQuery = new QueryWrapper<>(); + nQuery.select("sum(quantity) as quantity, sum(volume) as volume, sum(weight) as weight") + .eq("bill_num", exportIn.getBillNum()).ne("id", exportIn.getId()); + Map vmap = customerExportInService.getMap(nQuery); + if (MapUtils.isEmpty(vmap)) { + vmap = new HashMap<>(); + vmap.put("quantity", new BigDecimal(0)); + vmap.put("weight", new BigDecimal(0)); + vmap.put("volume", new BigDecimal(0)); + } + if (new BigDecimal(exportIn.getEachQuantity()).compareTo(((BigDecimal) vmap.get("quantity")).add(new BigDecimal(exportIn.getQuantity()))) < 0) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "数量不得超过单票件数"); + } + if (exportIn.getEachWeight().compareTo(((BigDecimal) vmap.get("weight")).add(exportIn.getWeight())) < 0) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "重量不得超过单票重量"); + } + if (exportIn.getEachVolume().compareTo(((BigDecimal) vmap.get("volume")).add(exportIn.getVolume())) < 0) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "体积不得超过单票体积"); + } + + //* 异常情况有,必填项车架号,车架号必须17位,数据重复,如果重复进行覆盖更新 + count = cargos.stream().filter(item -> item.getVin().length() != 17).count(); + if (count > 0) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车架号必须17位"); + } + //* 车架号重复不支持导入或新增 + if (CollectionUtils.isNotEmpty(cargos)) { + // 查询 车架号在系统中是否已经存在, 编辑的和新增的判断方式是不一样的 + List vins = cargos.stream().map(item -> item.getVin()).collect(Collectors.toList()); + List exists = customerExportInCargoService.list(new LambdaQueryWrapper().isNotNull(CustomerExportInCargo::getExportInId).in(CustomerExportInCargo::getVin, vins).ne(CustomerExportInCargo::getExportInId, exportIn.getId())); + if (CollectionUtils.isNotEmpty(exists)) { + // 查询出对应的港区 + List list = customerExportInService.lambdaQuery().in(CustomerExportIn::getId, exists.stream().map(item -> item.getExportInId()).collect(Collectors.toList())).list(); + Map portAreaMap = list.stream().collect(Collectors.toMap(CustomerExportIn::getId, CustomerExportIn::getPortAreaId)); + // 通过接口再次验证 + List req = exists.stream().map(item -> { + CheckVinReq v = new CheckVinReq(); + v.setIsRepetition(true); + v.setPamId(portAreaMap.get(item.getExportInId())); + v.setVinCode(item.getVin()); + return v; + }).collect(Collectors.toList()); + List rst = shpApi.checkVinRepeat(req); + if (CollectionUtils.isNotEmpty(rst)) { + // 再次过滤出重复的 + List collect = rst.stream().filter(item -> item.getIsRepetition()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(collect)) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车架号已存在<接口验证>:" + collect.stream().map(item -> item.getVinCode()).collect(Collectors.joining(","))); + } + } else { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车架号已存在:" + exists.stream().map(item -> item.getVin()).collect(Collectors.joining(","))); + } + } + } + + customerService.updateExportIn(false, exportIn, cargos, times, spares); + + return ResultUtil.success(String.valueOf(exportIn.getId())); + } + + /** + * 详情 + * + * @param id + * @return + */ + @ApiOperation("详情") + @PostMapping("/detail") + public Result detail(@RequestParam @NotNull(message = "请传入要获取的出口进场ID") Long id) { + CustomerExportIn exportIn = customerExportInService.getById(id); + + if (exportIn == null) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "id:" + id + "不存在"); + } + + customerService.wrapperEntity(exportIn); + + List times = customerExportInTimesService.list(new LambdaQueryWrapper().eq(CustomerExportInTimes::getExportInId, id)); + + customerService.wrapperEntity(times); + + List collect = customerExportInCargoService.list(new LambdaQueryWrapper().eq(CustomerExportInCargo::getExportInId, exportIn.getId())); + + collect.forEach(item -> { + item.setBrandId(exportIn.getBrandId()); + item.setBrand(exportIn.getBrand()); + item.setCartTypeId(exportIn.getCartTypeId()); + item.setCartType(exportIn.getCartType()); + }); + + customerService.wrapperEntity(collect); + + List cargos = collect.stream().filter(item -> item.getCargoType() == 0).collect(Collectors.toList()); + + List spares = collect.stream().filter(item -> item.getCargoType() == 1).collect(Collectors.toList()); + + exportIn.setSpares(spares); + exportIn.setCargos(cargos); + exportIn.setTimes(times); + + return ResultUtil.success(exportIn); + } + + /** + * 审核 + * + * @param check + * @return + */ + @ApiOperation("审核") + @PostMapping("/check") + public Result check(@RequestBody @Validated(ValidationGroup.insert.class) ExportInCheckVo check) throws Exception { + List exportIns = new ArrayList<>(); + for (Long id : check.getIds()) { + CustomerExportIn exportIn = PoMapper.instance.exportInCheckVo2Entity(check); + exportIn.setCheckManId(UserContext.getUser().getUserId()); + exportIn.setCheckTime(new Date()); + exportIn.setId(id); + exportIns.add(exportIn); + } + + boolean row = customerExportInService.updateBatchById(exportIns); + if (row) { + List list = customerExportInService.lambdaQuery().in(CustomerExportIn::getId, check.getIds()).list(); + + // 记录日志 + for (CustomerExportIn exportIn : list) { + LogRecordDTO log = new LogRecordDTO(); + log.setOperateData(exportIn); + log.setStatus(check.getCheckStatus() == AuditEnum.AUDIT_PASS ? 0 : 1); + log.setOperateTime(new Date()); + log.setUserId(SecurityUtils.getUserId()); + log.setUserName(SecurityUtils.getUserName()); + EsLogApprovalUtil.writeLog(log); + } + + return ResultUtil.success("success"); + } + + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败,ID不存在"); + } + + /** + * @param check + * @return + */ + @ApiOperation("取消审核") + @PostMapping("/cancel-check") + public Result cancelCheck(@RequestBody @Validated(ValidationGroup.update.class) ExportInCheckVo check) { + List exportIns = new ArrayList<>(); + for (Long id : check.getIds()) { + + // 需要判断,是否有出口装船审核通过的数据 + CustomerExportIn ei = customerExportInService.getById(id); + if (ei == null) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "id:" + id + "不存在"); + } + + // 有装船审核通过的 + Long count = customerExportLoadService.lambdaQuery().eq(CustomerExportLoad::getShipId, ei.getShipId()) + .eq(CustomerExportLoad::getVoyageId, ei.getVoyageId()) + .eq(CustomerExportLoad::getBillNo, ei.getBillNum()) + .eq(CustomerExportLoad::getBrandId, ei.getBrandId()).eq(CustomerExportLoad::getCheckStatus, AuditEnum.AUDIT_PASS).count(); + if (count > 0) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "装船审核通过,不允许取消审核"); + } + + CustomerExportIn exportIn = PoMapper.instance.exportInCheckVo2Entity(check); + exportIn.setCheckTime(new Date()); + exportIn.setId(id); + exportIn.setCheckManId(UserContext.getUser().getUserId()); + exportIn.setCheckStatus(AuditEnum.AUDIT); + exportIns.add(exportIn); + } + + boolean row = customerExportInService.updateBatchById(exportIns); + if (row) { + return ResultUtil.success("success"); + } + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败,ID不存在"); + } + + @ApiOperation("批量修改船名航次") + @PostMapping("/batch-update/shipVoyage") + public Result shipVoyageUpdate(@RequestBody @Validated(ValidationGroup.insert.class) BatchUpdateShipVo form) { + customerExportInService.lambdaUpdate() + .set(CustomerExportIn::getVoyageId, form.getVoyageId()) + .set(CustomerExportIn::getVoyage, form.getVoyage()) + .eq(CustomerExportIn::getShipId, form.getShipId()) + .eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT) +// .gt(CustomerExportIn::getApplyTime, form.getBeginDate()) +// .lt(CustomerExportIn::getApplyTime, form.getEndDate()) + .update(); + + return ResultUtil.success("success"); + } + + @ApiOperation("单个修改船名航次") + @PostMapping("/update/shipVoyage") + public Result shipVoyageUpdate(@RequestBody @Validated(ValidationGroup.insert.class) UpdateShipVo form) { + customerExportInService.lambdaUpdate() + .set(CustomerExportIn::getVoyageId, form.getVoyageId()) + .set(CustomerExportIn::getVoyage, form.getVoyage()) + .eq(CustomerExportIn::getId, form.getId()) + .update(); + + return ResultUtil.success("success"); + } + + @ApiOperation("验证车架号是否存在") + @PostMapping("/valid/vin") + public Result> importVinData(@RequestBody @Validated VinValidDTO form) { + List oExists = new ArrayList<>(); + //如果进港ID不为空,则代表编辑 + if (form.getId() != null) { + List list = customerExportInCargoService.lambdaQuery().eq(CustomerExportInCargo::getExportInId, form.getId()).list(); + oExists.addAll(list.stream().map(item -> item.getVin()).collect(Collectors.toList())); + } + // 验证哪些车架号已经存在了 + // 移除oExists已经存在的 + List vins = form.getVins().stream().filter(item -> !oExists.contains(item)).collect(Collectors.toList()); + List exists = customerExportInCargoService.list(new LambdaQueryWrapper().in(CustomerExportInCargo::getVin, vins)); + List existVins = exists.stream().map(p -> p.getVin()).collect(Collectors.toList()); + + // 查询出对应的港区 + if (CollectionUtils.isNotEmpty(exists)) { + List list = customerExportInService.lambdaQuery().in(CustomerExportIn::getId, exists.stream().map(item -> item.getExportInId()).collect(Collectors.toList())).list(); + Map portAreaMap = list.stream().collect(Collectors.toMap(CustomerExportIn::getId, CustomerExportIn::getPortAreaId)); + // 通过接口再次验证 + List req = exists.stream().map(item -> { + CheckVinReq v = new CheckVinReq(); + v.setIsRepetition(true); + v.setPamId(portAreaMap.get(item.getExportInId())); + v.setVinCode(item.getVin()); + return v; + }).collect(Collectors.toList()); + List rst = shpApi.checkVinRepeat(req); + if (CollectionUtils.isNotEmpty(rst)) { + // 再次过滤出重复的 + List collect = rst.stream().filter(item -> item.getIsRepetition()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(collect)) { + return ResultUtil.success(collect.stream().map(item -> item.getVinCode()).collect(Collectors.toList())); + } + } else { + return ResultUtil.success(existVins); + } + } + + return ResultUtil.success(existVins); + } + + @ApiOperation("车架号导入(数组形式)") + @PostMapping("/import-vin-data") + public Result> importVinData(@RequestBody @Validated ImportVinVo vinList) throws IOException { + // 船名,航次不存在 + List noShipList = new ArrayList<>(); + // 数量不一致 + List noNumList = new ArrayList<>(); + // 已存在的数据 + List exists = new ArrayList<>(); + // 成功导入的数据 + List successList = new ArrayList<>(); + + List validData = vinList.getData(); + // 对不完整的数据进行筛选 + + // 不能有重复的车架号 + List list = validData.stream().collect(Collectors.groupingBy(ExportVinExcel::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(list)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(list, ",") + "车架号重复"); + } + + // 提单进行分组 + Map> collect = validData.stream() + .collect(Collectors.groupingBy(item -> item.getBillNo(), Collectors.toList())); + collect.entrySet().forEach(item -> { + String billNo = item.getKey(); + // 找到是否存在船名,航次,提单号的表头 + + CustomerExportIn exportIn = customerExportInService.getOne(new LambdaQueryWrapper() + .eq(CustomerExportIn::getId, vinList.getId()) + .eq(CustomerExportIn::getBillNum, billNo)); + if (exportIn == null) { + noShipList.addAll(item.getValue()); + return; + } + if (exportIn.getQuantity() != item.getValue().size()) { + noNumList.addAll(item.getValue()); + return; + } + List cargos = item.getValue().stream().map(p -> { + CustomerExportInCargo cargo = new CustomerExportInCargo(); + cargo.setExportInId(exportIn.getId()); + cargo.setBrand(exportIn.getBrand()); + cargo.setBrandId(exportIn.getBrandId()); + cargo.setCargoType(0); + cargo.setVin(p.getVin()); + cargo.setTermcd(exportIn.getPortAreaId()); + cargo.setVinStatus(1); + return cargo; + }).collect(Collectors.toList()); + + List vins = cargos.stream().map(p -> p.getVin()).collect(Collectors.toList()); + + // 验证哪些车架号已经存在了 + List existCargos = customerExportInCargoService.list(new LambdaQueryWrapper().in(CustomerExportInCargo::getVin, vins)); + List existVins = existCargos.stream().map(p -> p.getVin()).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(existCargos)) { + // 查询出对应的港区 + List sList = customerExportInService.lambdaQuery().in(CustomerExportIn::getId, existCargos.stream().map(ss -> ss.getExportInId()).collect(Collectors.toList())).list(); + Map portAreaMap = sList.stream().collect(Collectors.toMap(CustomerExportIn::getId, CustomerExportIn::getPortAreaId)); + // 通过接口再次验证 + List req = existCargos.stream().map(ss -> { + CheckVinReq v = new CheckVinReq(); + v.setIsRepetition(true); + v.setPamId(portAreaMap.get(ss.getExportInId())); + v.setVinCode(ss.getVin()); + return v; + }).collect(Collectors.toList()); + List rst = shpApi.checkVinRepeat(req); + if (CollectionUtils.isNotEmpty(rst)) { + // 再次过滤出重复的 + List sCollect = rst.stream().filter(ss -> ss.getIsRepetition()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(sCollect)) { + existVins.clear(); + existVins.addAll(sCollect.stream().map(ss -> ss.getVinCode()).collect(Collectors.toList())); + } + } + } + + List existData = item.getValue().stream().filter(p -> existVins.contains(p.getVin())).collect(Collectors.toList()); + exists.addAll(existData); + + successList.addAll(item.getValue().stream().filter(p -> !existVins.contains(p.getVin())).collect(Collectors.toList())); + + List saveCargos = cargos.stream().filter(p -> !existVins.contains(p.getVin())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(saveCargos)) { // 保存新记录 + customerExportInCargoService.lambdaUpdate().eq(CustomerExportInCargo::getExportInId, exportIn.getId()).remove(); // 移除以前的 + customerExportInCargoService.saveBatch(saveCargos); + } + }); + + List rst = new ArrayList<>(); + + if (CollectionUtils.isNotEmpty(successList)) { + rst.addAll(successList.stream().map(item -> { + JSONObject o = JSONObject.from(item); + o.put("status", "导入成功"); + return o; + }).collect(Collectors.toList())); + } + + if (CollectionUtils.isNotEmpty(noShipList)) { + rst.addAll(noShipList.stream().map(item -> { + JSONObject o = JSONObject.from(item); + o.put("status", "提单号不匹配, 未导入"); + return o; + }).collect(Collectors.toList())); + } + + if (CollectionUtils.isNotEmpty(noNumList)) { + rst.addAll(noNumList.stream().map(item -> { + JSONObject o = JSONObject.from(item); + o.put("status", "数量不一致, 未导入"); + return o; + }).collect(Collectors.toList())); + } + + if (CollectionUtils.isNotEmpty(exists)) { + rst.addAll(exists.stream().map(item -> { + JSONObject o = JSONObject.from(item); + o.put("status", "数据已存在, 未导入"); + return o; + }).collect(Collectors.toList())); + } + + return ResultUtil.success(rst); + } + + @ApiOperation("车架号导入模板下载") + @GetMapping("/temp/down/vin") + public void tmpDownVin(HttpServletResponse response) throws Exception { + 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("车架号导入模板", "UTF-8"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + + excelWriter = EasyExcel.write(out).build(); + + WriteSheet writeSheet = EasyExcel.writerSheet(0, "车架号").head(ExportVinExcel.class).build(); + + // 查询数据 + List rows = new ArrayList<>(); + + 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(); + } + } + } + } + + @ApiOperation("车架号导入(文件形式)") + @PostMapping("/import-vin") + public Result> importVin(@RequestParam(required = false) @NotNull(message = "出口进场ID不能为空") Long id, MultipartFile file) throws IOException { + // 有错误的数据 + List errorDataList = new ArrayList<>(); + + EasyExcel.read(file.getInputStream(), ExportVinExcel.class, new ReadExcelListener() { + @Override + protected void saveData(List list) { // 保存数据 + + ValidatorFactory vf = Validation.buildDefaultValidatorFactory(); + Validator validator = vf.getValidator(); + + List validData = new ArrayList<>(); + + // 数据验证 + list.stream().forEach(item -> { + Set> 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)) { + return; + } + + // 是否有重复的车架号 + List repeat = validData.stream().collect(Collectors.groupingBy(ExportVinExcel::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + errorDataList.addAll(validData.stream().filter(p -> repeat.contains(p.getVin())).map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "车架号重复"); + return o; + }).collect(Collectors.toList())); + return; + } + + // 提单进行分组 + Map> collect = validData.stream() + .collect(Collectors.groupingBy(item -> item.getBillNo(), Collectors.toList())); + collect.entrySet().forEach(item -> { + String billNo = item.getKey(); + // 找到是否存在船名,航次,提单号的表头 + + CustomerExportIn exportIn = customerExportInService.getOne(new LambdaQueryWrapper() + .eq(CustomerExportIn::getId, id) + .eq(CustomerExportIn::getBillNum, billNo)); + + if (exportIn == null) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "提单号不匹配, 未导入"); + return o; + }).collect(Collectors.toList())); + return; + } + + if (exportIn.getQuantity() != item.getValue().size()) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "数量不一致, 未导入"); + return o; + }).collect(Collectors.toList())); + return; + } + + List cargos = item.getValue().stream().map(p -> { + CustomerExportInCargo cargo = new CustomerExportInCargo(); + cargo.setExportInId(exportIn.getId()); + cargo.setBrand(exportIn.getBrand()); + cargo.setBrandId(exportIn.getBrandId()); + cargo.setCargoType(0); + cargo.setVin(p.getVin()); + cargo.setTermcd(exportIn.getPortAreaId()); + cargo.setVinStatus(1); + return cargo; + }).collect(Collectors.toList()); + + List vins = cargos.stream().map(p -> p.getVin()).collect(Collectors.toList()); + + // 验证哪些车架号已经存在了 + List existCargos = customerExportInCargoService.list(new LambdaQueryWrapper().in(CustomerExportInCargo::getVin, vins).ne(CustomerExportInCargo::getExportInId, exportIn.getId())); + List existVins = existCargos.stream().map(p -> p.getVin()).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(existCargos)) { + // 查询出对应的港区 + List sList = customerExportInService.lambdaQuery().in(CustomerExportIn::getId, existCargos.stream().map(ss -> ss.getExportInId()).collect(Collectors.toList())).list(); + Map portAreaMap = sList.stream().collect(Collectors.toMap(CustomerExportIn::getId, CustomerExportIn::getPortAreaId)); + // 通过接口再次验证 + List req = existCargos.stream().map(ss -> { + CheckVinReq v = new CheckVinReq(); + v.setIsRepetition(true); + v.setPamId(portAreaMap.get(ss.getExportInId())); + v.setVinCode(ss.getVin()); + return v; + }).collect(Collectors.toList()); + List rst = shpApi.checkVinRepeat(req); + if (CollectionUtils.isNotEmpty(rst)) { + // 再次过滤出重复的 + List sCollect = rst.stream().filter(ss -> ss.getIsRepetition()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(sCollect)) { + existVins.clear(); + existVins.addAll(sCollect.stream().map(ss -> ss.getVinCode()).collect(Collectors.toList())); + } + } + } + + List existData = item.getValue().stream().filter(p -> existVins.contains(p.getVin())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(existData)) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "数据已存在, 未导入"); + return o; + }).collect(Collectors.toList())); + } + + errorDataList.addAll(item.getValue().stream().filter(p -> !existVins.contains(p.getVin())) + .map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "导入成功"); + return o; + }).collect(Collectors.toList())); + + List saveCargos = cargos.stream().filter(p -> !existVins.contains(p.getVin())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(saveCargos)) { // 保存新记录 + // 删除原有的车架号 + customerExportInCargoService.lambdaUpdate().eq(CustomerExportInCargo::getExportInId, exportIn.getId()).remove(); + customerExportInCargoService.saveBatch(saveCargos); + } + }); + } + }).sheet().doRead(); + + return ResultUtil.success(errorDataList); + } + + @ApiOperation("整船清单导入模板下载") + @GetMapping("/temp/down/ship") + public void tmpDownShip(HttpServletResponse response) throws Exception { + 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("整船清单导入模板", "UTF-8"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + + excelWriter = EasyExcel.write(out).build(); + + WriteSheet writeSheet = EasyExcel.writerSheet(0, "整船清单").head(ExportLoadExcel.class).build(); + + // 查询数据 + List rows = new ArrayList<>(); + + 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(); + } + } + } + } + + @ApiOperation("整船清单导入") + @PostMapping("/import-to-add") + public Result> upload( + @ApiParam(name = "操作方式, 0为前端,1为审核端") @RequestParam(required = false, defaultValue = "0") String type, + MultipartFile file) throws IOException { + // 所有读取的数据 + List dataList = new ArrayList<>(); + + // 有错误的数据 + List errorDataList = new ArrayList<>(); + + EasyExcel.read(file.getInputStream(), ExportLoadExcel.class, new ReadExcelListener() { + @Override + protected void saveData(List list) { // 保存数据 + dataList.addAll(list); + } + }).sheet().doRead(); + + ValidatorFactory vf = Validation.buildDefaultValidatorFactory(); + Validator validator = vf.getValidator(); + + List validData = new ArrayList<>(); + + // 数据验证 + dataList.stream().forEach(item -> { + Set> 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)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList); + } + + // 首先按对船名,般次,提单进行分组 + Map> collect = validData.stream() + .collect(Collectors.groupingBy(item -> StringUtils.joinWith("#$#", item.getShipName(), item.getVoyage(), item.getBillNo(), item.getBrand(), item.getModels()), Collectors.toList())); + + collect.entrySet().forEach(item -> { + String[] keys = StringUtils.split(item.getKey(), "#$#"); + String shipName = keys[0]; // 船名 + String voyage = keys[1]; // 航次 + String billNo = keys[2]; // 提单号 + String brand = keys[3]; // 品牌 + String models = keys[4]; // 型号 + // 找到是否存在船名,航次,提单号的表头 + + LambdaQueryWrapper cQuery = new LambdaQueryWrapper<>(); + cQuery.eq(CustomerExportIn::getShipName, shipName) + .eq(CustomerExportIn::getVoyage, voyage) + .eq(CustomerExportIn::getBillNum, billNo) + .eq(CustomerExportIn::getBrand, brand) + .eq(CustomerExportIn::getModels, models) + .ne(CustomerExportIn::getCartType, "备件"); // 备件的不允许整船导入 + if (StringUtils.equals(type, "0")) { + cQuery.and((wrapper) -> { + wrapper.eq(CustomerExportIn::getCheckStatus, AuditEnum.SUBMIT) + .or() + .eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_REJECT); + }); + } else { + cQuery.and((wrapper) -> { + wrapper.eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT) + .or() + .eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_REJECT); + }); + } + + List exportInList = customerExportInService.list(cQuery); + + if (CollectionUtils.isEmpty(exportInList)) { // 船名,航次等不存在 + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "船名、航次、提单号、品牌或型号不存在"); + return o; + }).collect(Collectors.toList())); + return; + } + + // 找到和本次数量一致的 + Optional first = exportInList.stream().filter(p -> p.getQuantity() == item.getValue().size()).findFirst(); + + CustomerExportIn exportIn = first.isPresent() ? first.get() : null; + + if (exportIn == null) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "数量不一致不允许导入"); + return o; + }).collect(Collectors.toList())); + return; + } + + if (exportIn.getCheckStatus() == AuditEnum.AUDIT_PASS) { // 审核 + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "审核通过状态的不可导入"); + return o; + }).collect(Collectors.toList())); + return; + } + + if (exportIn.getEnterQuantity() != item.getValue().size()) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "车架号数量和实际货物数量不符合,无法导入"); + return o; + }).collect(Collectors.toList())); + return; + } + + List cargos = item.getValue().stream().map(p -> { + CustomerExportInCargo cargo = new CustomerExportInCargo(); + cargo.setBrandId(exportIn.getBrandId()); + cargo.setBrand(exportIn.getBrand()); + cargo.setExportInId(exportIn.getId()); + cargo.setCargoType(0); + cargo.setVin(p.getVin()); + cargo.setTermcd(exportIn.getPortAreaId()); + cargo.setVinStatus(1); + return cargo; + }).collect(Collectors.toList()); + + List vins = cargos.stream().map(p -> p.getVin()).collect(Collectors.toList()); + + // 验证哪些车架号已经存在了 + List existCargos = customerExportInCargoService.list(new LambdaQueryWrapper().in(CustomerExportInCargo::getVin, vins).ne(CustomerExportInCargo::getExportInId, exportIn.getId())); + List existVins = existCargos.stream().map(p -> p.getVin()).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(existCargos)) { + // 查询出对应的港区 + List sList = customerExportInService.lambdaQuery().in(CustomerExportIn::getId, existCargos.stream().map(ss -> ss.getExportInId()).collect(Collectors.toList())).list(); + Map portAreaMap = sList.stream().collect(Collectors.toMap(CustomerExportIn::getId, CustomerExportIn::getPortAreaId)); + // 通过接口再次验证 + List req = existCargos.stream().map(ss -> { + CheckVinReq v = new CheckVinReq(); + v.setIsRepetition(true); + v.setPamId(portAreaMap.get(ss.getExportInId())); + v.setVinCode(ss.getVin()); + return v; + }).collect(Collectors.toList()); + List rst = shpApi.checkVinRepeat(req); + if (CollectionUtils.isNotEmpty(rst)) { + // 再次过滤出重复的 + List sCollect = rst.stream().filter(ss -> ss.getIsRepetition()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(sCollect)) { + existVins.clear(); + existVins.addAll(sCollect.stream().map(ss -> ss.getVinCode()).collect(Collectors.toList())); + } + } + } + + List existData = item.getValue().stream().filter(p -> existVins.contains(p.getVin())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(existData)) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "数据已存在, 未导入"); + return o; + }).collect(Collectors.toList())); + return; + } + + errorDataList.addAll(item.getValue().stream().filter(p -> !existVins.contains(p.getVin())) + .map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "导入成功"); + return o; + }).collect(Collectors.toList())); + // 删除原有的车架号 + customerExportInCargoService.lambdaUpdate().eq(CustomerExportInCargo::getExportInId, exportIn.getId()).remove(); + List saveCargos = cargos.stream().filter(p -> !existVins.contains(p.getVin())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(saveCargos)) { // 保存新记录 + customerExportInCargoService.saveBatch(saveCargos); + } + }); + + return ResultUtil.success(errorDataList); + } + + @ApiOperation("导入删除") + @PostMapping("/import-to-del") + public Result uploadToDelete(@RequestParam @NotBlank(message = "车架号不能为空") String vin) { + customerService.delExportInByVin(vin); + + return ResultUtil.success("success"); + } + + @ApiOperation("删除车辆或备件明细") + @PostMapping("/delete/cargo") + @Transactional(rollbackFor = {Exception.class}) + public Result deleteCargo(@RequestBody @NotNull(message = "删除的明细ID不能为空") @Size(min = 1, message = "删除的明细ID不能为空") ValidList ids) { + List list = customerExportInCargoService.lambdaQuery().in(CustomerExportInCargo::getId, ids).list(); + Map> collect = list.stream().collect(Collectors.groupingBy(CustomerExportInCargo::getExportInId)); + if (customerExportInCargoService.removeByIds(ids)) { + collect.entrySet().stream().forEach(item -> { + customerExportInService.update().setSql("quantity=quantity-"+item.getValue().size()+",enter_quantity=enter_quantity-"+item.getValue().size()).eq("id", item.getKey()).update(); + }); + } + return ResultUtil.success("success"); + } + + @ApiOperation("出口进场导出") + @GetMapping("/exportExecl") + public void exportExecl(ExportInQuery query, HttpServletResponse response) { + if (query.getEndEnterTime() != null) { + query.setEndEnterTime(DateUtils.getDayEnd(query.getEndEnterTime())); + } + query.setCreateBy(UserContext.getUser().getUserId()); + query.setPage(1); + query.setRows(500); + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerExportIn.class, query); + + 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(); + + // 查询数据 + + query.setCreateBy(UserContext.getUser().getUserId()); + + Page page = customerExportInService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + + List rows = page.getRecords().stream().map(item -> { +// item.setEnergyTypeName(item.getEnergyType().text()); + ExportInExcel e = PoMapper.instance.entity2Excel(item); + e.setEnterTime( + StringUtils.join( + item.getBeginEnterTime() != null ? DateUtils.formatDate(item.getBeginEnterTime(), "yyyy-MM-dd HH:mm") : "", + ",", + item.getEndEnterTime() != null ? DateUtils.formatDate(item.getEndEnterTime(), "yyyy-MM-dd HH:mm") : "" + )); + // 处理一下时间问题 + return e; + }).collect(Collectors.toList()); + + excelWriter.write(rows, writeSheet); + + for (int i = 2; i <= page.getPages(); i++) { + query.setPage(2); + customerExportInService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + + rows = page.getRecords().stream().map(item -> PoMapper.instance.entity2Excel(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(); + } + } + } + + } + + @ApiOperation("出口进场货物明细导出") + @GetMapping("/export-vin") + public void exportExportVin(@RequestParam(required = false) @NotNull(message = "出口进场ID不能为空") Long id, + @RequestParam(required = false) String vinIds, + HttpServletResponse response) { + CustomerExportIn exportIn = customerExportInService.getById(id); + + if (exportIn == null) { + throw new RuntimeException("id:" + id + "不存在"); + } + + List ids = new ArrayList<>(); + + // 是否指定导出 + if (StringUtils.isNotEmpty(vinIds)) { + ids.addAll(Arrays.asList(StringUtils.split(vinIds, ","))); + } + + List collect = customerExportInCargoService.list(new LambdaQueryWrapper().eq(CustomerExportInCargo::getExportInId, id)); + + List cargos = collect.stream().filter(item -> item.getCargoType() == 0).collect(Collectors.toList()); + + List spares = collect.stream().filter(item -> item.getCargoType() == 1).collect(Collectors.toList()); + + AtomicInteger index = new AtomicInteger(1); + + List rows = null; + + if (CollectionUtils.isNotEmpty(cargos)) { + rows = cargos.stream().filter(item -> CollectionUtils.isEmpty(ids) || ids.contains(item)).map(item -> { + ExportInVinExportExcel excel = new ExportInVinExportExcel(); + excel.setSerialNo(index.getAndIncrement()); + excel.setShipName(exportIn.getShipName()); + excel.setVoyage(exportIn.getVoyage()); + excel.setBillNum(exportIn.getBillNum()); + excel.setBrand(exportIn.getBrand()); + excel.setModels(exportIn.getModels()); + excel.setVin(item.getVin()); + return excel; + }).collect(Collectors.toList()); + } else { + rows = spares.stream().filter(item -> CollectionUtils.isEmpty(ids) || ids.contains(item)).map(item -> { + ExportInVinExportExcel excel = new ExportInVinExportExcel(); + excel.setSerialNo(index.getAndIncrement()); + excel.setShipName(exportIn.getShipName()); + excel.setVoyage(exportIn.getVoyage()); + excel.setBillNum(exportIn.getBillNum()); + excel.setBrand(exportIn.getBrand()); + excel.setModels(exportIn.getModels()); + excel.setVin(item.getVin()); + return excel; + }).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(ExportInVinExportExcel.class).build(); + + 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(); + } + } + } + + } + + @ApiOperation("出口进场计划导入模板下载") + @GetMapping("/temp/down/plan") + public void tmpDownPlan(HttpServletResponse response) throws Exception { + 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("出口进场计划导入模板", "UTF-8"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + + excelWriter = EasyExcel.write(out).build(); + + WriteSheet writeSheet = EasyExcel.writerSheet(0, "出口进场计划").head(ExportInPlanExcel.class).build(); + + // 查询数据 + List rows = new ArrayList<>(); + + 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(); + } + } + } + } + + @ApiOperation("出口进场计划导入") + @PostMapping("/exportIn/plan/import-to-add") + public Result> exportInPlanUpload( + @ApiParam(name = "操作方式, 0为前端,1为审核端") @RequestParam(required = false, defaultValue = "0") String type, + MultipartFile file) throws IOException { + // 所有读取的数据 + List dataList = new ArrayList<>(); + + // 有错误的数据 + List errorDataList = new ArrayList<>(); + + // 港口基础数据 + List portList = dictHandler.getPortList(null).getData(); + // 船名基础数据 + List shipList = dictHandler.getAllShip(null).getData(); + // 港区基础数据 + List portAreaList = dictHandler.getPortAreaList(null).getData(); + // 品牌基础数据 + List brandList = dictHandler.getBrandList(null).getData(); + // 车型基础数据 + List carTypeList = dictHandler.getCartTypeList(null).getData(); + // 国家基础数据 + List countryList = dictHandler.getCountryList(null).getData(); + // 运输模式 + List transportWayList = dictHandler.getTransportWayList(null).getData(); + // 操作模式 + List operateTypeList = dictHandler.getOperateTypeList(null).getData(); + // 新能源类型 + List energyTypeList = dictHandler.getEnergyTypeList().getData(); + // 根据港口ID 获取国家 + Map portCountryList = new HashMap<>(); + + // 车型明细缓存 + Map> carDetailTypeList = new HashMap<>(); + + EasyExcel.read(file.getInputStream(), ExportInPlanExcel.class, new ReadExcelListener() { + @Override + protected void saveData(List list) { // 保存数据 + dataList.addAll(list); + } + }).sheet().doRead(); + + ValidatorFactory vf = Validation.buildDefaultValidatorFactory(); + Validator validator = vf.getValidator(); + + List validData = new ArrayList<>(); + + // 需要保存的数据 + List saveData = new ArrayList<>(); + // 数据验证 + dataList.stream().forEach(item -> { + Set> 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)) { // 数据完整性检验 + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList); + } + + // 港区、船名、港口、品牌、车型 + validData.stream().forEach(item -> { + if (portList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getPortName())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "港口不存在"); + errorDataList.add(o); + return; + } + 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 (portAreaList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getPortArea())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "港区不存在"); + errorDataList.add(o); + return; + } + if (brandList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getBrand())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "品牌不存在"); + errorDataList.add(o); + return; + } + if (carTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getCartType())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "车型不存在"); + errorDataList.add(o); + return; + } + if (countryList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getCiyCnname(), item.getOriginPlace())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "区域代码不存在"); + errorDataList.add(o); + return; + } + // 航次必须是HT6、HTTC、HTLG中的一个,否则导入不成功,提示“航次错误 + if (!StringUtils.equalsAnyIgnoreCase(item.getVoyage(), "HT6", "HTTC", "HTLG")) { + JSONObject o = JSONObject.from(item); + o.put("status", "航次错误"); + errorDataList.add(o); + return; + } + // 运输方式必须是“板车运输、商品车自开、驳船,否则导入不成功,提示“运输方式错误” + if (!StringUtils.equalsAnyIgnoreCase(item.getTransportWay(), "板车运输", "商品车自开", "驳船") || transportWayList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getTransportWay())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "运输方式错误"); + errorDataList.add(o); + return; + } + // 车型明细必须是车型关联的车型明细,否则导入不成功,提示“车型明细错误” + if (!carDetailTypeList.containsKey(item.getCartType())) { + List data = dictHandler.getCartTypeDetailList(carTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getCartType())).findFirst().get().getId(), null).getData(); + carDetailTypeList.put(item.getCartType(), data); + } + if (carDetailTypeList.get(item.getCartType()).stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getCartTypeDetail())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "车型明细错误"); + errorDataList.add(o); + return; + } + // 车型如果是车辆操作模式必须为“港机作业,客户自开”,如果是备件操作模式必须为“铲车、吊车、浮吊”,否则导入不成功,提示“操作模式错误” + if ((StringUtils.equals("车辆", item.getCartType()) && !StringUtils.equalsAny(item.getOperateType(), "港机作业", "自开")) || + (StringUtils.equals("备件", item.getCartType()) && !StringUtils.equalsAny(item.getOperateType(), "铲车", "吊车", "浮吊")) + || operateTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getOperateType())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "操作模式错误"); + errorDataList.add(o); + return; + } + if (energyTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getEnergyTypeName())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "源类型不存在"); + errorDataList.add(o); + return; + } + // 验证进场日期是否正确 + Date d = DateUtils.parseDate(StringUtils.trim(item.getEnterTime()), "yyyy/MM/dd"); + + if (d == null) { + JSONObject o = JSONObject.from(item); + o.put("status", "日期格式不正确yyyy/MM/dd"); + errorDataList.add(o); + return; + } + + saveData.add(item); +// JSONObject o = JSONObject.from(item); +// o.put("status", "导入成功"); +// errorDataList.add(o); + }); + + if (CollectionUtils.isEmpty(saveData)) { // 数据完整性检验 + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList); + } + + // 对象转换 + List collect = saveData.stream().map(item -> { + CustomerExportIn in = PoMapper.instance.excel2Entity(item); + String batchNo = customerService.getSequenceNo("export_in_batch_no", "出口进场", "EI"); + in.setBatchNo(batchNo); + in.setApplyTime(new Date()); + in.setPortId(portList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getPortName())).findFirst().get().getId()); + // 处理国家 + if (!portCountryList.containsKey(in.getPortId())) { + DictDTO dto = dictHandler.getCountryByPortName(in.getPortId()).getData(); + portCountryList.put(in.getPortId(), dto); + } + if (portCountryList.containsKey(in.getPortId())) { + in.setCountryId(portCountryList.get(in.getPortId()).getId()); + in.setCountry(portCountryList.get(in.getPortId()).getText()); + } + + in.setBeginEnterTime(DateUtils.parseDate(StringUtils.trim(item.getEnterTime()), "yyyy/MM/dd")); + in.setEndEnterTime(in.getBeginEnterTime()); + + in.setShipId(shipList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getShipName())).findFirst().get().getId()); + in.setShipEnName(shipList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getShipName())).findFirst().get().getExtra1()); + in.setPortAreaId(portAreaList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getPortArea())).findFirst().get().getId()); + in.setBrandId(brandList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getBrand())).findFirst().get().getId()); + in.setCartTypeId(carTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getCartType())).findFirst().get().getId()); + in.setVoyageId(in.getVoyage()); + in.setOriginPlaceId(countryList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getCiyCnname(), item.getOriginPlace())).findFirst().get().getCiyId()); + in.setTransportWayId(transportWayList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getTransportWay())).findFirst().get().getId()); + in.setCartTypeDetailId(carDetailTypeList.get(in.getCartType()).stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getCartTypeDetail())).findFirst().get().getId()); + in.setOperateTypeId(operateTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getOperateType())).findFirst().get().getId()); + in.setEnergyType(energyTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getEnergyTypeName())).findFirst().get().getId()); + in.setApplicantId(UserContext.getUser().getUserId()); + in.setTermcd(in.getPortAreaId()); + + if (StringUtils.equals("1", type)) { + in.setCheckStatus(AuditEnum.AUDIT); + } else { + in.setCheckStatus(AuditEnum.SUBMIT); + } + return in; + }).collect(Collectors.toList()); + + // 首先按对船名,般次,提单进行分组 + Map> inMap = collect.stream() + .collect(Collectors.groupingBy(item -> StringUtils.joinWith("#$#", item.getShipId(), item.getVoyageId(), item.getBillNum()), Collectors.toList())); + + + inMap.entrySet().forEach(item -> { + String[] keys = StringUtils.split(item.getKey(), "#$#"); + String shipId = keys[0]; // 船名 + String voyageId = keys[1]; // 航次 + String billNo = keys[2]; // 提单号 + + // 查询出已存在的数据 + LambdaQueryWrapper cQuery = new LambdaQueryWrapper<>(); + cQuery.eq(CustomerExportIn::getShipId, shipId); + cQuery.eq(CustomerExportIn::getVoyageId, voyageId); + cQuery.eq(CustomerExportIn::getBillNum, billNo); + + List exportInList = customerExportInService.list(cQuery); + + // 单票件件,毛,体 + CustomerExportIn lastE = item.getValue().get(item.getValue().size() - 1); // 以最后一个为标准 + // 验证件,毛,体 + // 件数 + int totalQuantity = exportInList.stream().mapToInt(CustomerExportIn::getQuantity).sum() + item.getValue().stream().mapToInt(CustomerExportIn::getQuantity).sum(); + if (totalQuantity > lastE.getEachQuantity()) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "数量不得超过单票件数"); + return o; + }).collect(Collectors.toList())); + return; + } + // 重量 + double totalWeight = exportInList.stream().map(p -> p.getWeight().doubleValue()).mapToDouble(p -> p).sum() + item.getValue().stream().map(p -> p.getWeight().doubleValue()).mapToDouble(p -> p).sum(); + if (new BigDecimal(totalWeight).compareTo(lastE.getEachWeight()) > 0) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "重量不得超过单票重量"); + return o; + }).collect(Collectors.toList())); + return; + } + // 体积 + double totalVolume = exportInList.stream().map(p -> p.getVolume().doubleValue()).mapToDouble(p -> p).sum() + item.getValue().stream().map(p -> p.getVolume().doubleValue()).mapToDouble(p -> p).sum(); + if (new BigDecimal(totalVolume).compareTo(lastE.getEachWeight()) > 0) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "体积不得超过单票重量"); + return o; + }).collect(Collectors.toList())); + return; + } + + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "导入成功"); + return o; + }).collect(Collectors.toList())); + + // 如果是备件自动生成条码 + // 过滤出是备件的 + item.getValue().stream().filter(ss -> StringUtils.equals(ss.getCartType(), "备件")).forEach(ss -> { + // 出口进场计划备件条码生成的规则要变一下,BJ+年月日时分+5随机数,一共要17位 + String prefix = StringUtils.join("BJ", DateUtil.format(new Date(), "yyMMddHHmm")); + List vins = new ArrayList<>(ss.getQuantity()); + do { + String vin = prefix + RandomUtil.randomNumbers(5); + if (!vins.contains(vin)) { + vins.add(vin); + } + } while (vins.size() < ss.getQuantity()); + List spares = vins.stream().map(p -> { + CustomerExportInCargo entity = new CustomerExportInCargo(); + entity.setCargoType(1); + entity.setVinStatus(1); + entity.setVin(p); + entity.setTermcd(ss.getPortAreaId()); + return entity; + }).collect(Collectors.toList()); + + List times = new ArrayList<>(); + CustomerExportInTimes time = new CustomerExportInTimes(); + time.setEnterQuantity(ss.getQuantity()); + time.setEnterTime(ss.getBeginEnterTime()); + times.add(time); + + ss.setEachVolume(lastE.getEachVolume()); + ss.setEachQuantity(lastE.getEachQuantity()); + ss.setEachWeight(lastE.getEachWeight()); + + customerService.saveExportIn(ss, null, times, spares); + + }); + + item.getValue().stream().filter(ss -> !StringUtils.equals(ss.getCartType(), "备件")).forEach(ss -> { + List times = new ArrayList<>(); + CustomerExportInTimes time = new CustomerExportInTimes(); + time.setEnterQuantity(ss.getQuantity()); + time.setEnterTime(ss.getBeginEnterTime()); + times.add(time); + + ss.setEachVolume(lastE.getEachVolume()); + ss.setEachQuantity(lastE.getEachQuantity()); + ss.setEachWeight(lastE.getEachWeight()); + + customerService.saveExportIn(ss, null, times, null); + }); + }); + + /* + EasyExcel.read(file.getInputStream(), ExportInPlanExcel.class, new ReadExcelListener() { + @Override + protected void saveData(List list) { // 保存数据 + ValidatorFactory vf = Validation.buildDefaultValidatorFactory(); + Validator validator = vf.getValidator(); + + List validData = new ArrayList<>(); + + // 需要保存的数据 + List saveData = new ArrayList<>(); + // 数据验证 + list.stream().forEach(item -> { + Set> 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)) { // 数据完整性检验 + return; + } + + // 港区、船名、港口、品牌、车型 + validData.stream().forEach(item -> { + if (portList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getPortName())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "港口不存在"); + errorDataList.add(o); + return; + } + 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 (portAreaList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getPortArea())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "港区不存在"); + errorDataList.add(o); + return; + } + if (brandList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getBrand())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "品牌不存在"); + errorDataList.add(o); + return; + } + if (carTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getCartType())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "车型不存在"); + errorDataList.add(o); + return; + } + if (countryList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getCiyCnname(), item.getOriginPlace())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "区域代码不存在"); + errorDataList.add(o); + return; + } + // 航次必须是HT6、HTTC、HTLG中的一个,否则导入不成功,提示“航次错误 + if (!StringUtils.equalsAnyIgnoreCase(item.getVoyage(), "HT6", "HTTC", "HTLG")) { + JSONObject o = JSONObject.from(item); + o.put("status", "航次错误"); + errorDataList.add(o); + return; + } + // 运输方式必须是“板车运输、商品车自开、驳船,否则导入不成功,提示“运输方式错误” + if (!StringUtils.equalsAnyIgnoreCase(item.getTransportWay(), "板车运输", "商品车自开", "驳船") || transportWayList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getTransportWay())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "运输方式错误"); + errorDataList.add(o); + return; + } + // 车型明细必须是车型关联的车型明细,否则导入不成功,提示“车型明细错误” + if (!carDetailTypeList.containsKey(item.getCartType())) { + List data = dictHandler.getCartTypeDetailList(carTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getCartType())).findFirst().get().getId(), null).getData(); + carDetailTypeList.put(item.getCartType(), data); + } + if (carDetailTypeList.get(item.getCartType()).stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getCartTypeDetail())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "车型明细错误"); + errorDataList.add(o); + return; + } + // 车型如果是车辆操作模式必须为“港机作业,客户自开”,如果是备件操作模式必须为“铲车、吊车、浮吊”,否则导入不成功,提示“操作模式错误” + if ((StringUtils.equals("车辆", item.getCartType()) && !StringUtils.equalsAny(item.getOperateType(), "港机作业", "自开")) || + (StringUtils.equals("备件", item.getCartType()) && !StringUtils.equalsAny(item.getOperateType(), "铲车", "吊车", "浮吊")) + || operateTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getOperateType())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "操作模式错误"); + errorDataList.add(o); + return; + } + if (energyTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getEnergyTypeName())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "源类型不存在"); + errorDataList.add(o); + return; + } + // 验证进场日期是否正确 + Date d = DateUtils.parseDate(StringUtils.trim(item.getEnterTime()), "yyyy/MM/dd"); + + if (d == null) { + JSONObject o = JSONObject.from(item); + o.put("status", "日期格式不正确yyyy/MM/dd"); + errorDataList.add(o); + return; + } + + saveData.add(item); + JSONObject o = JSONObject.from(item); + o.put("status", "导入成功"); + errorDataList.add(o); + }); + + + if (CollectionUtils.isNotEmpty(saveData)) { // 保存新记录 + List collect = saveData.stream().map(item -> { + CustomerExportIn in = PoMapper.instance.excel2Entity(item); + String batchNo = customerService.getSequenceNo("export_in_batch_no", "出口进场", "EI"); + in.setBatchNo(batchNo); + in.setApplyTime(new Date()); + in.setPortId(portList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getPortName())).findFirst().get().getId()); + // 处理国家 + if (!portCountryList.containsKey(in.getPortId())) { + DictDTO dto = dictHandler.getCountryByPortName(in.getPortId()).getData(); + portCountryList.put(in.getPortId(), dto); + } + if (portCountryList.containsKey(in.getPortId())) { + in.setCountryId(portCountryList.get(in.getPortId()).getId()); + in.setCountry(portCountryList.get(in.getPortId()).getText()); + } + + in.setBeginEnterTime(DateUtils.parseDate(StringUtils.trim(item.getEnterTime()), "yyyy/MM/dd")); + in.setEndEnterTime(in.getBeginEnterTime()); + + in.setShipId(shipList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getShipName())).findFirst().get().getId()); + in.setShipEnName(shipList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getShipName())).findFirst().get().getExtra1()); + in.setPortAreaId(portAreaList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getPortArea())).findFirst().get().getId()); + in.setBrandId(brandList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getBrand())).findFirst().get().getId()); + in.setCartTypeId(carTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getCartType())).findFirst().get().getId()); + in.setVoyageId(in.getVoyage()); + in.setOriginPlaceId(countryList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getCiyCnname(), item.getOriginPlace())).findFirst().get().getCiyId()); + in.setTransportWayId(transportWayList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getTransportWay())).findFirst().get().getId()); + in.setCartTypeDetailId(carDetailTypeList.get(in.getCartType()).stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getCartTypeDetail())).findFirst().get().getId()); + in.setOperateTypeId(operateTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getOperateType())).findFirst().get().getId()); + in.setEnergyType(energyTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getEnergyTypeName())).findFirst().get().getId()); + in.setApplicantId(UserContext.getUser().getUserId()); + in.setTermcd(in.getPortAreaId()); + + if (StringUtils.equals("1", type)) { + in.setCheckStatus(AuditEnum.AUDIT); + } else { + in.setCheckStatus(AuditEnum.SUBMIT); + } + return in; + }).collect(Collectors.toList()); + + // 如果是备件自动生成条码 + // 过滤出是备件的 + collect.stream().filter(item -> StringUtils.equals(item.getCartType(), "备件")).forEach(item -> { + // 出口进场计划备件条码生成的规则要变一下,BJ+年月日时分+5随机数,一共要17位 + String prefix = StringUtils.join("BJ", DateUtil.format(new Date(), "yyMMddHHmm")); + List vins = new ArrayList<>(item.getQuantity()); + do { + String vin = prefix + RandomUtil.randomNumbers(5); + if (!vins.contains(vin)) { + vins.add(vin); + } + } while (vins.size() < item.getQuantity()); + List 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()); + + List times = new ArrayList<>(); + CustomerExportInTimes time = new CustomerExportInTimes(); + time.setEnterQuantity(item.getQuantity()); + time.setEnterTime(item.getBeginEnterTime()); + times.add(time); + + customerService.saveExportIn(item, null, times, spares); + + }); + + collect.stream().filter(item -> !StringUtils.equals(item.getCartType(), "备件")).forEach(item -> { + List times = new ArrayList<>(); + CustomerExportInTimes time = new CustomerExportInTimes(); + time.setEnterQuantity(item.getQuantity()); + time.setEnterTime(item.getBeginEnterTime()); + times.add(time); + + customerService.saveExportIn(item, null, times, null); + }); + +// List carts = collect.stream().filter(item -> !StringUtils.equals(item.getCartType(), "备件")).collect(Collectors.toList()); +// +// if (CollectionUtils.isNotEmpty(carts)) { +// customerExportInService.saveBatch(carts); +// } + } + } + }).sheet().doRead(); + + */ + + return ResultUtil.success(errorDataList); + } + + @ApiOperation("更改作业状态") + @PostMapping("/update/workstatus") + public Result updateWorkStatus(@RequestBody @Validated(ValidationGroup.update.class) WorkStatusVo vo) { + customerExportInCargoService.lambdaUpdate() + .set(CustomerExportInCargo::getWorkStatus, vo.getWorkStatus()) + .in(CustomerExportInCargo::getVin, vo.getVins()) + .update(); + return ResultUtil.success("success"); + } + + @ApiOperation("出口进场计划港口") + @PostMapping("/plan/port") + public Result> getPlanPortList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) @NotBlank(message = "船ID不能为空") String shipId, + @RequestParam(required = false) String q) { + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct port_id, port_name"); + query.eq("check_status", AuditEnum.AUDIT_PASS); + query.eq(StringUtils.isNotEmpty(shipId), "ship_id", shipId); + if (StringUtils.isNotEmpty(q)) { + query.like("port_name", q); + } + + Page page = customerExportInService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(item -> { + PortEnDTO dto = new PortEnDTO(); + dto.setId(item.getPortId()); + dto.setText(item.getPortName()); + return dto; + }).collect(Collectors.toList()); + + customerService.wrapperEntity(rst); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + @ApiOperation("出口进场计划船名航次") + @PostMapping("/plan/ship") + public Result> getExportInPlanShipList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) String q) { + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct ship_id, ship_name, ship_en_name"); + query.eq("check_status", AuditEnum.AUDIT_PASS); + if (StringUtils.isNotEmpty(q)) { + query.and((wrapper) -> { + wrapper.like("ship_name", q); + wrapper.or().like("ship_en_name", q); + }); + } + Page page = customerExportInService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(tmp -> { + ShipVoyageVo vo = new ShipVoyageVo(); + vo.setShipId(tmp.getShipId()); + vo.setShipName(tmp.getShipName()); + vo.setShipEnName(tmp.getShipEnName()); +// vo.setVoyageId(tmp.getVoyageId()); +// vo.setVoyage(tmp.getVoyage()); + return vo; + }).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + @ApiOperation("出口进场计划航次") + @PostMapping("/plan/voyage") + public Result> getPlanVoyageList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) @NotBlank(message = "船名不能为空") String shipId, + @RequestParam(required = false) String q) { + List rst = new ArrayList<>(); + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct voyage_id, voyage"); + query.eq("check_status", AuditEnum.AUDIT_PASS); + query.eq("ship_id", shipId); + if (StringUtils.isNotEmpty(q)) { + query.like("voyage", q); + } + + Page page = customerExportInService.page(new Page<>(current, size), query); + List list = page.getRecords(); + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getVoyageId()); + dto.setText(item.getVoyage()); + return dto; + }).filter(item -> item != null).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + @ApiOperation("出口进场计划提单号") + @PostMapping("/plan/billNo") + public Result> getPlanBillNoList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) String q) { + List rst = new ArrayList<>(); + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct bill_num"); + query.eq("check_status", AuditEnum.AUDIT_PASS); + if (StringUtils.isNotEmpty(q)) { + query.like("bill_num", q); + } + + Page page = customerExportInService.page(new Page<>(current, size), query); + List list = page.getRecords(); + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getBillNum()); + dto.setText(item.getBillNum()); + return dto; + }).filter(item -> item != null).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + // 品牌 + @ApiOperation("出口进场计划品牌") + @PostMapping("/voyage/brand") + public Result> getVoyageBrandList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) @NotBlank(message = "船名不能为空") String shipName, +// @RequestParam(required = false) @NotBlank(message = "航次不能为空") String voyage, + @RequestParam(required = false) String q) { + List rst = new ArrayList<>(); + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct brand_id, brand"); + query.eq("check_status", AuditEnum.AUDIT_PASS); + query.eq("ship_name", shipName); +// query.eq("voyage", voyage); + if (StringUtils.isNotEmpty(q)) { + query.like("brand", q); + } + + Page page = customerExportInService.page(new Page<>(current, size), query); + List list = page.getRecords(); + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getBrandId()); + dto.setText(item.getBrand()); + return dto; + }).filter(item -> item != null).collect(Collectors.toList()); + + customerService.wrapperEntity(rst); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportInspectHandler.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportInspectHandler.java new file mode 100644 index 0000000..967f3c8 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportInspectHandler.java @@ -0,0 +1,508 @@ +package com.haitonggauto.rtosc.handler; + +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.NuzarYardApi; +import com.haitonggauto.rtosc.api.dto.*; +import com.haitonggauto.rtosc.common.context.UserContext; +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.ResultUtil; +import com.haitonggauto.rtosc.common.utils.ValidationGroup; +import com.haitonggauto.rtosc.common.utils.WrapperKit; +import com.haitonggauto.rtosc.dto.*; +import com.haitonggauto.rtosc.query.CargoQuery; +import com.haitonggauto.rtosc.query.ExportInspectCheckQuery; +import com.haitonggauto.rtosc.query.ExportInspectQuery; +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.CustomerExportInspectCargoService; +import com.haitonggauto.rtosc.repository.service.CustomerExportInspectService; +import com.haitonggauto.rtosc.service.CustomerService; +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 org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.*; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("/ci") +@Api(tags = "出口海关查验") +@Validated +public class ExportInspectHandler implements BaseHandler { + + @Resource + private CustomerService customerService; + + @Resource + private CustomerExportInspectService customerExportInspectService; + + @Resource + private CustomerExportInspectCargoService customerExportInspectCargoService; + + @Resource + private NuzarOpenApi openApi; + + @Resource + private NuzarYardApi yardApi; + + @ApiOperation("船名航次模糊匹配") + @PostMapping("/shipVoyage") + public Result> getExportInShipNameList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) String q) { + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct ship_id, ship_name, ship_en_name, voyage_id, voyage"); + 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); + wrapper.or().like("voyage", q); + }); + } + + Page page = customerExportInspectService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(tmp -> { + ShipVoyageVo vo = new ShipVoyageVo(); + vo.setShipId(tmp.getShipId()); + vo.setShipName(tmp.getShipName()); + vo.setShipEnName(tmp.getShipEnName()); + vo.setVoyageId(tmp.getVoyageId()); + vo.setVoyage(tmp.getVoyage()); + return vo; + }).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + @ApiOperation("提单号模糊匹配") + @PostMapping("/billNo/query") + public Result> getExportInBillNoList( + @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 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); // 提单号 + Page page = customerExportInspectService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(item -> item.getBillNo()).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + @ApiOperation("出口装船审核审核通过的船名") + @PostMapping("/confirm/ship") + public Result> getConfirmShip(@RequestParam(required = false) String q) { + return ResultUtil.success(openApi.getExportInspectShipList(q)); + } + + @ApiOperation("出口装船审核审核通过的航次") + @PostMapping("/confirm/voyage") + public Result> getConfirmVoyage(@RequestParam(required = false) String shipId, @RequestParam(required = false) String q) { + return ResultUtil.success(openApi.getExportInspectVoyageList(shipId, q)); + } + + @ApiOperation("出口装船审核审核通过的提单号") + @PostMapping("/confirm/billNo") + public Result> getConfirmBillNo(@RequestParam(required = false) String voyageId, + @RequestParam(required = false) String q) { + + return ResultUtil.success(openApi.getExportInspectBillNoList(voyageId, q)); + } + + @ApiOperation("出口查验申请货物明细") + @PostMapping("/nuzar/query-list") + public Result> query(@RequestParam("current") Integer current, + @RequestParam(name = "planId", required = false) String planId, + @RequestParam Integer size, @RequestParam(name = "splitId", required = false) String splitId) { + return ResultUtil.success(openApi.getExportInspectCargos(current, planId, size, splitId)); + } + + @ApiOperation("根据航次ID,和提单号查询报关单号") + @PostMapping("/nuzar/customNo/query") + public Result query(@RequestParam(name = "billNo") @ApiParam("提单号") String billNo, + @RequestParam(name = "voyageId") @ApiParam("航次ID") String voyageId) { + CustomNoReq req = new CustomNoReq(); + req.setLimit(10); + req.setMnfBls(Arrays.asList(billNo)); + req.setVvyIds(Arrays.asList(voyageId)); + + List rst = yardApi.getVoyageNameByVvyName(req); + if (CollectionUtils.isNotEmpty(rst)) { + return ResultUtil.success(rst.get(0).getCustomsDeclareNo()); + } + return ResultUtil.success(""); + } + + /** + * 分页查询 + * + * @param query + * @return + */ + @ApiOperation("条件分页查询") + @PostMapping("/query-list") + public Result> query(@RequestBody ExportInspectQuery query) { + query.setCreateBy(UserContext.getUser().getUserId()); + query.setTradType("E"); + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerExportInspect.class, query); + Page page = customerExportInspectService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + // 获取查验状态 + List ids = page.getRecords().stream().map(item -> item.getId() + "").collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(ids)) { + List inspectStatusStatus = openApi.getInspectStatusStatus(ids); + Map collect = inspectStatusStatus.stream().collect(Collectors.toMap(InspectStatusResp::getApplyId, InspectStatusResp::getInspectionStatusNm)); + page.getRecords().forEach(item -> { + if (collect.containsKey(item.getId()+"")) { + item.setApiInspectStatus(collect.get(item.getId()+"")); + } + }); + } + return ResultUtil.success(page); + } + + @ApiOperation("审核条件分页查询") + @PostMapping("/check/query-list") + public Result> checkQuery(@RequestBody ExportInspectCheckQuery query) { + query.setTradType("E"); + if (query.getCheckStatus() == null) { + query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); + } + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerExportInspect.class, query); + Page page = customerExportInspectService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + // 获取查验状态 + List ids = page.getRecords().stream().map(item -> item.getId() + "").collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(ids)) { + List inspectStatusStatus = openApi.getInspectStatusStatus(ids); + Map collect = inspectStatusStatus.stream().collect(Collectors.toMap(InspectStatusResp::getApplyId, InspectStatusResp::getInspectionStatusNm)); + page.getRecords().forEach(item -> { + if (collect.containsKey(item.getId()+"")) { + item.setApiInspectStatus(collect.get(item.getId()+"")); + } + }); + } + return ResultUtil.success(page); + } + + /** + * 新增 + * + * @param form + * @return + */ + @ApiOperation("新增") + @PostMapping("/add") + public Result save(@RequestBody @Validated(ValidationGroup.insert.class) ExportInspectVo form) { + if (CollectionUtils.isNotEmpty(form.getCargos())) { + List repeat = form.getCargos().stream().collect(Collectors.groupingBy(ExportInspectCargoVo::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复"); + } + } + + String batchNo = customerService.getSequenceNo("inspect_in_batch_no", "出口查验", "CI"); + // 表单验证以及格式转换 + CustomerExportInspect exportInspect = PoMapper.instance.exportInspectVo2Entity(form); + exportInspect.setInspectStatus(InspectStatusEnum.NO_INSPECT); + exportInspect.setBatchNo(batchNo); + exportInspect.setApplicantId(UserContext.getUser().getUserId()); + exportInspect.setTradType("E"); + exportInspect.setCheckStatus(AuditEnum.SUBMIT); + exportInspect.setTermcd(exportInspect.getPortAreaId()); + exportInspect.setApplyTime(new Date()); + + List cargos = form.getCargos().stream().map(item -> { + CustomerExportInspectCargo entity = PoMapper.instance.exportInspectCargoVo2Entity(item); + if (StringUtils.equals(entity.getCartTypeId(), "备件")) { + entity.setCargoType(1); + } else { + entity.setCargoType(0); + } + return entity; + }).collect(Collectors.toList()); + + Long id = customerService.saveExportInspect(exportInspect, cargos); + + return ResultUtil.success(String.valueOf(id)); + } + + /** + * @param ids + * @return + */ + @ApiOperation("提交审核") + @PostMapping("/submit-check") + public Result submitCheck(@RequestBody + @NotNull(message = "请传入要审核的海关查验ID") + @Size(min = 1, message = "ID列表不能为空") List ids) { + customerExportInspectService.lambdaUpdate().set(CustomerExportInspect::getCheckStatus, AuditEnum.AUDIT).in(CustomerExportInspect::getId, ids).update(); + return ResultUtil.success("success"); + } + + /** + * 删除 + * + * @param id + * @return + */ + @ApiOperation("删除") + @PostMapping("/del") + public Result delete(@RequestParam @NotNull(message = "请传入要删除的出口进场ID") Long id) { + customerService.delExportInspect(id); + return ResultUtil.success("success"); + } + + @ApiOperation("审核端编辑") + @PostMapping("/checker/edit") + // 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法 + public Result edit(@RequestBody @Validated(ValidationGroup.update.class) ExportInspectVo form) { + return this.edit(true, form); + } + + /** + * 编辑 + * + * @param form + * @return + */ + @ApiOperation("编辑") + @PostMapping("/edit") + // 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法 + public Result edit(@RequestParam(required = false, defaultValue = "false")Boolean flag, + @RequestBody @Validated(ValidationGroup.update.class) ExportInspectVo form) { + if (CollectionUtils.isNotEmpty(form.getCargos())) { + List repeat = form.getCargos().stream().collect(Collectors.groupingBy(ExportInspectCargoVo::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复"); + } + } + + CustomerExportInspect cei = customerExportInspectService.getById(form.getId()); + if (cei.getCheckStatus() == AuditEnum.AUDIT_PASS) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "审核通过之后不能进行编辑"); + } + String batchNo = cei.getBatchNo(); + // 表单验证以及格式转换 + CustomerExportInspect exportInspect = PoMapper.instance.exportInspectVo2Entity(form); + exportInspect.setBatchNo(batchNo); + exportInspect.setTermcd(exportInspect.getPortAreaId()); + exportInspect.setTradType("E"); + if (!flag) { // 后台编辑 + exportInspect.setCheckStatus(AuditEnum.SUBMIT); + } else { + exportInspect.setCheckStatus(AuditEnum.AUDIT); + } + + List cargos = form.getCargos().stream().map(item -> { + CustomerExportInspectCargo entity = PoMapper.instance.exportInspectCargoVo2Entity(item); + if (StringUtils.equals(entity.getCartTypeId(), "备件")) { + entity.setCargoType(1); + } else { + entity.setCargoType(0); + } + return entity; + }).collect(Collectors.toList()); + customerService.updateExportInspect(false, exportInspect, cargos); + + return ResultUtil.success(String.valueOf(exportInspect.getId())); + } + + /** + * 详情 + * + * @param id + * @return + */ + @ApiOperation("详情") + @PostMapping("/detail") + public Result detail(@RequestParam @NotNull(message = "请传入要获取的ID") Long id) { + CustomerExportInspect exportInspect = customerExportInspectService.getById(id); + + if (exportInspect == null) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "id:" + id + "不存在"); + } + + customerService.wrapperEntity(exportInspect); + + // 获取查验状态 + List ids = Arrays.asList(exportInspect.getId() + ""); + if (CollectionUtils.isNotEmpty(ids)) { + List inspectStatusStatus = openApi.getInspectStatusStatus(ids); + Map collect = inspectStatusStatus.stream().collect(Collectors.toMap(InspectStatusResp::getApplyId, InspectStatusResp::getInspectionStatus)); + if (collect.containsKey(exportInspect.getId()+"")) { + exportInspect.setApiInspectStatus(collect.get(exportInspect.getId()+"")); + } + } + + List cargos = customerExportInspectCargoService.list(new LambdaQueryWrapper().eq(CustomerExportInspectCargo::getExportInspectId, id)); + + customerService.wrapperEntity(cargos); + + exportInspect.setCargos(cargos); + + return ResultUtil.success(exportInspect); + } + + @ApiOperation("批量获取详情") + @PostMapping("/batch/detail") + public Result> getBatchDetail(@RequestBody @NotNull(message = "请传入ID列表") @Size(min = 1, message = "请传入ID列表") List ids) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.in(CustomerExportInspect::getId, ids); + + List exportInspectList = customerExportInspectService.list(query); + + if (CollectionUtils.isEmpty(exportInspectList)) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "传入ID列表不存在"); + } + + for (CustomerExportInspect exportInspect : exportInspectList) { + + customerService.wrapperEntity(exportInspect); + + List cargos = customerExportInspectCargoService.list(new LambdaQueryWrapper().eq(CustomerExportInspectCargo::getExportInspectId, exportInspect.getId())); + + customerService.wrapperEntity(cargos); + + exportInspect.setCargos(cargos); + } + + return ResultUtil.success(exportInspectList); + } + + @ApiOperation("货物明细分页列表") + @PostMapping("/cargos/page") + public Result> cargoList(@RequestBody @Validated(ValidationGroup.update.class) CargoQuery query) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + queryWrapper.eq(query.getId() != null, CustomerExportInspectCargo::getExportInspectId, query.getId()); + if (query.getCargoType() != null) { + queryWrapper.eq(query.getCargoType() != null, CustomerExportInspectCargo::getCargoType, query.getCargoType()); + } + Page page = customerExportInspectCargoService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + + customerService.wrapperEntity(page.getRecords()); + + return ResultUtil.success(page); + } + + @ApiOperation("出口查验审核货物详情") + @PostMapping("/check/detail") + public Result checkDetail(@RequestParam @NotBlank(message = "提单号不能为空") String billNo) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CustomerExportInspect::getBillNo, billNo); + CustomerExportInspect exportInspect = customerExportInspectService.getOne(query, false); + + if (exportInspect == null) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "提单号:" + billNo + "不存在"); + } + + customerService.wrapperEntity(exportInspect); + + List cargos = customerExportInspectCargoService.list(new LambdaQueryWrapper().eq(CustomerExportInspectCargo::getExportInspectId, exportInspect.getId())); + + customerService.wrapperEntity(cargos); + + exportInspect.setCargos(cargos); + + return ResultUtil.success(exportInspect); + } + + /** + * 审核 + * + * @param check + * @return + */ + @ApiOperation("审核") + @PostMapping("/check") + public Result check(@RequestBody @Validated(ValidationGroup.insert.class) ExportInspectCheckVo check) throws Exception { + List checks = new ArrayList<>(); + for (Long id : check.getIds()) { + CustomerExportInspect exportIn = PoMapper.instance.exportInspectCheckVo2Entity(check); + exportIn.setCheckManId(UserContext.getUser().getUserId()); + exportIn.setCheckTime(new Date()); + exportIn.setId(id); + checks.add(exportIn); + } + + boolean row = customerExportInspectService.updateBatchById(checks); + if (row) { + List list = customerExportInspectService.lambdaQuery().in(CustomerExportInspect::getId, check.getIds()).list(); + + // 记录日志 + for (CustomerExportInspect record : list) { + LogRecordDTO log = new LogRecordDTO(); + log.setOperateData(record); + log.setStatus(check.getCheckStatus() == AuditEnum.AUDIT_PASS ? 0 : 1); + log.setOperateTime(new Date()); + log.setUserId(SecurityUtils.getUserId()); + log.setUserName(SecurityUtils.getUserName()); + EsLogApprovalUtil.writeLog(log); + } + + return ResultUtil.success("success"); + } + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败,ID不存在"); + } + + /** + * 取消审核 + * + * @param check + * @return + */ + @ApiOperation("取消审核") + @PostMapping("/cancel-check") + public Result cancelCheck(@RequestBody @Validated(ValidationGroup.update.class) ExportInspectCheckVo check) { + List checks = new ArrayList<>(); + for (Long id : check.getIds()) { + CustomerExportInspect exportIn = PoMapper.instance.exportInspectCheckVo2Entity(check); + exportIn.setCheckTime(new Date()); + exportIn.setCheckManId(UserContext.getUser().getUserId()); + exportIn.setId(id); + exportIn.setCheckStatus(AuditEnum.AUDIT); + checks.add(exportIn); + } + + boolean row = customerExportInspectService.updateBatchById(checks); + if (row) { + return ResultUtil.success("success"); + } + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败,ID不存在"); + } +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportLoadHandler.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportLoadHandler.java new file mode 100644 index 0000000..705e82b --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ExportLoadHandler.java @@ -0,0 +1,1556 @@ +package com.haitonggauto.rtosc.handler; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +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; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +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.NuzarPubApi; +import com.haitonggauto.rtosc.api.NuzarShpApi; +import com.haitonggauto.rtosc.api.dto.*; +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.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.*; +import com.haitonggauto.rtosc.query.CargoQuery; +import com.haitonggauto.rtosc.query.ExportLoadCheckQuery; +import com.haitonggauto.rtosc.query.ExportLoadQuery; +import com.haitonggauto.rtosc.repository.entity.*; +import com.haitonggauto.rtosc.handler.excel.ReadExcelListener; +import com.haitonggauto.rtosc.handler.mapper.PoMapper; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.haitonggauto.rtosc.repository.service.*; +import com.haitonggauto.rtosc.service.CustomerService; +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 org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +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.IOException; +import java.io.OutputStream; +import java.net.URLEncoder; +import java.util.*; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("/el") +@Api(tags = "出口装船") +@Validated +public class ExportLoadHandler implements BaseHandler { + + @Resource + private CustomerService customerService; + + @Resource + private CustomerExportLoadService customerExportLoadService; + + @Resource + private CustomerExportLoadCargoService customerExportLoadCargoService; + + @Resource + private CustomerExportInService customerExportInService; + + @Resource + private CustomerExportInCargoService customerExportInCargoService; + + @Resource + private ExportInHandler exportInHandler; + + @Resource + private NuzarOpenApi openApi; + + @Resource + private NuzarPubApi pubApi; + + @Resource + private NuzarShpApi shpApi; + + @Resource + private DictHandler dictHandler; + + @ApiOperation("船名航次模糊匹配") + @PostMapping("/shipVoyage") + public Result> getExportInShipNameList( + @RequestParam(required = false, defaultValue = "W") String tradType, + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) String q) { + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct ship_id, ship_name, ship_en_name, voyage_id, voyage"); + query.eq("create_by", UserContext.getUser().getUserId()); + query.eq("trad_type", tradType); + if (StringUtils.isNotEmpty(q)) { + query.and((wrapper) -> { + wrapper.like("ship_name", q); + wrapper.or().like("ship_en_name", q); + wrapper.or().like("voyage", q); + }); + } + + Page page = customerExportLoadService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(tmp -> { + ShipVoyageVo vo = new ShipVoyageVo(); + vo.setShipId(tmp.getShipId()); + vo.setShipName(tmp.getShipName()); + vo.setShipEnName(tmp.getShipEnName()); + vo.setVoyageId(tmp.getVoyageId()); + vo.setVoyage(tmp.getVoyage()); + return vo; + }).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + @ApiOperation("审核端所有待审核船名列表") + @PostMapping("/check/ship/list") + public Result> getCheckShipList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false, defaultValue = "W") String tradType, + @RequestParam(required = false) String q) { + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct ship_id, ship_name, ship_en_name"); + query.eq("trad_type", tradType); + query.in("check_status", Arrays.asList(AuditEnum.AUDIT)); + if (StringUtils.isNotEmpty(q)) { + query.and((wrapper) -> { + wrapper.like("ship_name", q); + wrapper.or().like("ship_en_name", q); + }); + } + + Page page = customerExportLoadService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getShipId()); + dto.setText(item.getShipName()); + dto.setExtra1(item.getShipEnName()); + return dto; + }).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + @ApiOperation("提单号模糊匹配") + @PostMapping("/billNo/query") + public Result> getExportInBillNoList( + @RequestParam(required = false, defaultValue = "W") String tradType, + @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 query = new LambdaQueryWrapper<>(); + query.eq(CustomerExportLoad::getCreateBy, UserContext.getUser().getUserId()); + query.eq(StringUtils.isNotEmpty(shipName), CustomerExportLoad::getShipName, shipName); + query.eq(StringUtils.isNotEmpty(voyage), CustomerExportLoad::getVoyage, voyage); + query.like(StringUtils.isNotEmpty(q), CustomerExportLoad::getBillNo, q); // 提单号 + query.like(CustomerExportLoad::getTradType, tradType); + + Page page = customerExportLoadService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(item -> item.getBillNo()).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + @ApiOperation("收车凭证船名") + @PostMapping("/receiveCar/ship/list") + public Result> getReceiveCarShipList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) String q) { + Page page = customerExportLoadService.getReceiveCarShipList(new Page<>(current, size), q); + List list = page.getRecords(); + + List rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getShipId()); + dto.setText(item.getShipName()); + dto.setExtra1(item.getShipEnName()); + return dto; + }).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + /** + * 分页查询 + * + * @param query + * @return + */ + @ApiOperation("条件分页查询") + @PostMapping("/query-list") + public Result> query(@RequestBody ExportLoadQuery query) { + query.setCreateBy(UserContext.getUser().getUserId()); + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerExportLoad.class, query); + Page page = customerExportLoadService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + + customerService.wrapperEntity(page.getRecords()); + + return ResultUtil.success(page); + } + + @ApiOperation("审核条件分页查询") + @PostMapping("/check/query-list") + public Result> checkQuery(@RequestBody ExportLoadCheckQuery query) { + if (query.getCheckStatus() == null) { + query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); + } + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerExportLoad.class, query); + Page page = customerExportLoadService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + return ResultUtil.success(page); + } + + @ApiOperation("根据航次ID查询审核通过出口装船记录") + @PostMapping("/query-list/voyage") + public Result> checkQuery(@RequestParam(required = false) @NotBlank(message = "航次ID不能为空") String voyageId, + @RequestParam(required = false) AuditEnum status) { + if (status == null) { + status = AuditEnum.AUDIT_PASS; + } + return ResultUtil.success(customerExportLoadService.getListByVoyageId(voyageId, status)); + } + + /** + * 新增 + * + * @param form + * @return + */ + @PostMapping("/add") + public Result save(@RequestBody @Validated(ValidationGroup.insert.class) ExportLoadVo form) { + if (CollectionUtils.isNotEmpty(form.getCargos())) { + List repeat = form.getCargos().stream().collect(Collectors.groupingBy(ExportLoadCargoVo::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复"); + } + } + + String batchNo = customerService.getSequenceNo("export_load_batch_no", "出口装船", "EL"); + // 表单验证以及格式转换 + CustomerExportLoad exportLoad = PoMapper.instance.exportLoadVo2Entity(form); + exportLoad.setBatchNo(batchNo); + exportLoad.setCheckStatus(AuditEnum.SUBMIT); + exportLoad.setApplyTime(new Date()); + exportLoad.setApplicantId(UserContext.getUser().getUserId()); + + List cargos = form.getCargos().stream().map(item -> { + CustomerExportLoadCargo entity = PoMapper.instance.exportLoadCargoVo2Entity(item); + entity.setVinStatus(1); + return entity; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(cargos)) { // 验证车架号 + // 查询 车架号在系统中是否已经存在, 编辑的和新增的判断方式是不一样的 + List vins = cargos.stream().map(item -> item.getVin()).collect(Collectors.toList()); + List exists = customerExportLoadCargoService.list(new LambdaQueryWrapper().in(CustomerExportLoadCargo::getVin, vins)); + if (CollectionUtils.isNotEmpty(exists)) { + // 查询出对应的港区 + List list = customerExportLoadService.lambdaQuery().in(CustomerExportLoad::getId, exists.stream().map(item -> item.getExportLoadId()).collect(Collectors.toList())).list(); + Map portAreaMap = list.stream().collect(Collectors.toMap(CustomerExportLoad::getId, CustomerExportLoad::getPortAreaId)); + // 通过接口再次验证 + List req = exists.stream().map(item -> { + CheckVinReq v = new CheckVinReq(); + v.setIsRepetition(true); + v.setPamId(portAreaMap.get(item.getExportLoadId())); + v.setVinCode(item.getVin()); + return v; + }).collect(Collectors.toList()); + List rst = shpApi.checkVinRepeat(req); + if (CollectionUtils.isNotEmpty(rst)) { + // 再次过滤出重复的 + List collect = rst.stream().filter(item -> item.getIsRepetition()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(collect)) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车架号已存在<接口验证>:" + collect.stream().map(item -> item.getVinCode()).collect(Collectors.joining(","))); + } + } else { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车架号已存在:" + exists.stream().map(item -> item.getVin()).collect(Collectors.joining(","))); + } + } + } + + Long id = customerService.saveExportLoad(exportLoad, cargos); + + return ResultUtil.success(String.valueOf(id)); + } + + /** + * @param ids + * @return + */ + @ApiOperation("提交审核") + @PostMapping("/submit-check") + public Result submitCheck(@RequestBody + @NotNull(message = "请传入要审核的出口装船ID") + @Size(min = 1, message = "ID列表不能为空") List ids) { + customerExportLoadService.lambdaUpdate().set(CustomerExportLoad::getCheckStatus, AuditEnum.AUDIT) + .set(CustomerExportLoad::getCheckResult, null).in(CustomerExportLoad::getId, ids).update(); + return ResultUtil.success("success"); + } + + /** + * 删除 + * + * @param ids + * @return + */ + @ApiOperation("删除") + @PostMapping("/del") + public Result delete(@RequestBody + @NotNull(message = "请传入要删除的ID") + @Size(min = 1, message = "请传入要删除的ID") List ids) { + for (Long id : ids) { + customerService.delExportLoad(id); + } + return ResultUtil.success("success"); + } + + @ApiOperation("取消/恢复车架号") + @PostMapping("/recover/vin") + @Transactional(rollbackFor = {Exception.class}) + public Result recoverVin(@RequestBody @Validated(ValidationGroup.update.class) CargoStatusVo form) { + // 如果是内贸则不需要处理 + List exportLoads = customerExportLoadService.lambdaQuery() + .eq(CustomerExportLoad::getShipId, form.getShipId()) + .eq(CustomerExportLoad::getVoyageId, form.getVoyageId()) + .eq(CustomerExportLoad::getBillNo, form.getBillNo()).list(); + if (CollectionUtils.isEmpty(exportLoads)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "船名、航次、提单号不存在"); + } + + if (StringUtils.equalsIgnoreCase("W", exportLoads.get(0).getTradType())) { // 外贸才修改进港的数据 + exportInHandler.recoverVin(form); + } + + // 修改 装船的数据 + // 查询出货物列表 + List list = customerExportLoadCargoService.lambdaQuery() + .exists("select id from customer_export_load where customer_export_load.id = customer_export_load_cargo.export_load_id and check_status={0} and ship_id={1} and voyage_id={2} and bill_no={3}", AuditEnum.AUDIT_PASS, form.getShipId(), form.getVoyageId(), form.getBillNo()) + .list(); + // 转成MAP + Map collect = + list.stream() + .collect(Collectors.collectingAndThen( + Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CustomerExportLoadCargo::getVin))), + ArrayList::new + )) // 先去重 + .stream().collect(Collectors.toMap(CustomerExportLoadCargo::getVin, item->item)); + // 找出状态不一致的,(有些情况下可能会出现本来是正常的,传进来的也是正常) + Map> listMap = form.getVins().stream().filter(item -> collect.containsKey(item.getVin())).filter(item -> item.getStatus() != collect.get(item.getVin()).getVinStatus()) + .collect(Collectors.groupingBy(CargoStatus::getStatus)); + + // 这里需要区分备件 + if (listMap.containsKey(0)) { // 代表取消 + listMap.get(0).stream().filter(item -> collect.containsKey(item.getVin())).map(item -> collect.get(item.getVin())) // 找到数据库中的明细 + .collect(Collectors.groupingBy(CustomerExportLoadCargo::getExportLoadId)) // 按主表ID进行分组 + .entrySet().stream().forEach(entry -> { + // 修改进场数量,和数量 + Map collect1 = entry.getValue().stream().map(item -> collect.get(item.getVin())).collect(Collectors.groupingBy(CustomerExportLoadCargo::getCargoType, Collectors.counting())); + if (collect1.containsKey(0)) { // 车辆 + customerExportLoadService.update().setSql("quantity=quantity-" + collect1.get(0)) + .eq("id", entry.getKey()).update(); + } + if (collect1.containsKey(1)) { // 备件 + customerExportLoadService.update().setSql("spare_quantity=spare_quantity-" + collect1.get(1)) + .eq("id", entry.getKey()).update(); + } + }); + } else if (listMap.containsKey(1)) { // 代表恢复 + listMap.get(1).stream().filter(item -> collect.containsKey(item.getVin())).map(item -> collect.get(item.getVin())) // 找到数据库中的明细 + .collect(Collectors.groupingBy(CustomerExportLoadCargo::getExportLoadId)) // 按主表ID进行分组 + .entrySet().stream().forEach(entry -> { + // 修改进场数量,和数量 + Map collect1 = entry.getValue().stream().map(item -> collect.get(item.getVin())).collect(Collectors.groupingBy(CustomerExportLoadCargo::getCargoType, Collectors.counting())); + if (collect1.containsKey(0)) { // 车辆 + customerExportLoadService.update().setSql("quantity=quantity+" + collect1.get(0)) + .eq("id", entry.getKey()).update(); + } + if (collect1.containsKey(1)) { // 备件 + customerExportLoadService.update().setSql("spare_quantity=spare_quantity+" + collect1.get(1)) + .eq("id", entry.getKey()).update(); + } + }); + } + + // 批量修改车辆的状态 + List update = new ArrayList<>(); + listMap.entrySet().stream().forEach(item -> { + update.addAll(item.getValue().stream().map(p -> { + CustomerExportLoadCargo cargo = collect.get(p.getVin()); + cargo.setVinStatus(item.getKey()); + return cargo; + }).collect(Collectors.toList())); + }); + customerExportLoadCargoService.updateBatchById(update); + + return ResultUtil.success("success"); + } + + @ApiOperation("审核端编辑") + @PostMapping("/checker/edit") + // 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法 + public Result edit(@RequestBody @Validated(ValidationGroup.update.class) ExportLoadVo form) { + return this.edit(true, form); + } + /** + * 编辑 + * + * @param form + * @return + */ + @ApiOperation("编辑") + @PostMapping("/edit") + // 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法 + public Result edit(@RequestParam(required = false, defaultValue = "false")Boolean flag, + @RequestBody @Validated(ValidationGroup.update.class) ExportLoadVo form) { + if (CollectionUtils.isNotEmpty(form.getCargos())) { + List repeat = form.getCargos().stream().collect(Collectors.groupingBy(ExportLoadCargoVo::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复"); + } + } + + CustomerExportLoad load = customerExportLoadService.getById(form.getId()); + if (load.getCheckStatus() == AuditEnum.AUDIT_PASS) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "审核通过之后不能进行编辑"); + } + String batchNo = load.getBatchNo(); + // 表单验证以及格式转换 + CustomerExportLoad exportLoad = PoMapper.instance.exportLoadVo2Entity(form); + exportLoad.setBatchNo(batchNo); + if (!flag) { + exportLoad.setCheckStatus(AuditEnum.SUBMIT); + } else { + exportLoad.setCheckStatus(AuditEnum.AUDIT); + } + + List cargos = form.getCargos().stream().map(item -> { + CustomerExportLoadCargo entity = PoMapper.instance.exportLoadCargoVo2Entity(item); + entity.setVinStatus(1); + return entity; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(cargos)) { // 验证车架号 + // 查询 车架号在系统中是否已经存在, 编辑的和新增的判断方式是不一样的 + List vins = cargos.stream().map(item -> item.getVin()).collect(Collectors.toList()); + List exists = customerExportLoadCargoService.list(new LambdaQueryWrapper().in(CustomerExportLoadCargo::getVin, vins).ne(CustomerExportLoadCargo::getExportLoadId, exportLoad.getId())); + if (CollectionUtils.isNotEmpty(exists)) { + // 查询出对应的港区 + List list = customerExportLoadService.lambdaQuery().in(CustomerExportLoad::getId, exists.stream().map(item -> item.getExportLoadId()).collect(Collectors.toList())).list(); + Map portAreaMap = list.stream().collect(Collectors.toMap(CustomerExportLoad::getId, CustomerExportLoad::getPortAreaId)); + // 通过接口再次验证 + List req = exists.stream().map(item -> { + CheckVinReq v = new CheckVinReq(); + v.setIsRepetition(true); + v.setPamId(portAreaMap.get(item.getExportLoadId())); + v.setVinCode(item.getVin()); + return v; + }).collect(Collectors.toList()); + List rst = shpApi.checkVinRepeat(req); + if (CollectionUtils.isNotEmpty(rst)) { + // 再次过滤出重复的 + List collect = rst.stream().filter(item -> item.getIsRepetition()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(collect)) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车架号已存在<接口验证>:" + collect.stream().map(item -> item.getVinCode()).collect(Collectors.joining(","))); + } + } else { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "车架号已存在:" + exists.stream().map(item -> item.getVin()).collect(Collectors.joining(","))); + } + } + } + + customerService.updateExportLoad(false, exportLoad, cargos); + + return ResultUtil.success(String.valueOf(exportLoad.getId())); + } + + /** + * 详情 + * + * @param id + * @return + */ + @ApiOperation("详情") + @PostMapping("/detail") + public Result detail(@RequestParam @NotNull(message = "请传入要获取的出口进场ID") Long id) { + CustomerExportLoad exportLoad = customerExportLoadService.getById(id); + + if (exportLoad == null) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "id:" + id + "不存在"); + } + + customerService.wrapperEntity(exportLoad); + + ExportLoadQuery query = new ExportLoadQuery(); + query.setExportLoadId(id); + + List cargos = customerExportLoadCargoService.list(new LambdaQueryWrapper().eq(CustomerExportLoadCargo::getExportLoadId, id)); + + customerService.wrapperEntity(cargos); + + exportLoad.setCargos(cargos); + + return ResultUtil.success(exportLoad); + } + + @ApiOperation("货物明细分页列表") + @PostMapping("/cargos/page") + public Result> cargoList(@RequestBody @Validated(ValidationGroup.update.class) CargoQuery query) { + // 查询内外贸 + CustomerExportLoad exportLoad = customerExportLoadService.getById(query.getId()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + queryWrapper.eq(query.getId() != null, CustomerExportLoadCargo::getExportLoadId, query.getId()); + if (query.getCargoType() != null) { + queryWrapper.eq(query.getCargoType() != null, CustomerExportLoadCargo::getCargoType, query.getCargoType()); + } + Page page = customerExportLoadCargoService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + + customerService.wrapperEntity(page.getRecords()); + + // 获取作业状态 + Map collect = null; + List vins = page.getRecords().stream().map(item -> item.getVin()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(vins)) { + VinStatusRequest req = new VinStatusRequest(); + req.setBusinessType("LOAD"); + req.setImportExportType("E"); + req.setVinCodeList(vins); + req.setVvyId(exportLoad.getVoyageId()); + List status = openApi.getVinStatus(req); + collect = status.stream().collect(Collectors.toMap(WorkStatusDTO::getVinCode, WorkStatusDTO::getWorkStatus)); + } + if (MapUtils.isNotEmpty(collect)) { + for (CustomerExportLoadCargo cargo : page.getRecords()) { + cargo.setWorkStatus(collect.get(cargo.getVin())); + } + } + + if (CollectionUtils.isNotEmpty(page.getRecords()) && StringUtils.equalsIgnoreCase("N", exportLoad.getTradType())) { + // 未进港、已收车、装船完成、取消装船、退运、提货 + page.setRecords(page.getRecords().stream().filter(item -> StringUtils.equalsAny(item.getWorkStatus(), "未进港", "已收车", "装船完成", "取消装船", "退运", "提货")).collect(Collectors.toList())); + } + + return ResultUtil.success(page); + } + + /** + * 整船审核 + * + * @param check + * @return + */ + @ApiOperation("审核") + @PostMapping("/check") + @Transactional(rollbackFor = {Exception.class}) + public Result check(@RequestBody @Validated(ValidationGroup.insert.class) ExportLoadCheckVo check) throws Exception { + List spares = null; + + if (check.getCheckStatus() == AuditEnum.AUDIT_PASS) { // 先找到需要同步的备件 + // 如果审核通过,且是备件,则需要从出口进港计划中匹配到相同的数量,添加到装船申请中 + LambdaQueryWrapper lQuery = new LambdaQueryWrapper<>(); + lQuery.eq(CustomerExportLoad::getShipId, check.getShipId()); + lQuery.eq(CustomerExportLoad::getVoyageId, check.getVoyageId()); + lQuery.gt(CustomerExportLoad::getSpareQuantity, 0); + lQuery.eq(CustomerExportLoad::getCheckStatus, AuditEnum.AUDIT); + + spares = customerExportLoadService.list(lQuery); + } + + if (check.getCheckStatus() == AuditEnum.AUDIT_PASS) { // 通过 + LambdaUpdateWrapper update = new LambdaUpdateWrapper<>(); + update.set(CustomerExportLoad::getCheckManId, UserContext.getUser().getUserId()); + update.set(CustomerExportLoad::getCheckMan, check.getCheckMan()); + update.set(CustomerExportLoad::getCheckStatus, check.getCheckStatus()); + update.set(CustomerExportLoad::getCheckResult, check.getCheckResult()); + update.set(CustomerExportLoad::getCheckTime, new Date()); + update.eq(CustomerExportLoad::getShipId, check.getShipId()); + update.eq(CustomerExportLoad::getVoyageId, check.getVoyageId()); + update.eq(CustomerExportLoad::getCheckStatus, AuditEnum.AUDIT); + + boolean flag = customerExportLoadService.update(update); + + if (!flag) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "船名,航次不存在"); + } + } else if (check.getCheckStatus() == AuditEnum.AUDIT_REJECT) { // 拒绝时,只修改该货代下的数据 +// if (CollectionUtils.isEmpty(check.getIds())) { +// return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "审核拒绝时,没有核验通过的装船ID列表不能为空"); +// } + // 找到货代ID +// LambdaQueryWrapper cQuery = new LambdaQueryWrapper<>(); +// cQuery.in(CustomerExportLoad::getId, check.getIds()); +// +// List userIds = customerExportLoadService.list(cQuery).stream().map(item -> item.getCreateBy()).distinct().collect(Collectors.toList()); + LambdaUpdateWrapper update = new LambdaUpdateWrapper<>(); + update.set(CustomerExportLoad::getCheckManId, UserContext.getUser().getUserId()); + update.set(CustomerExportLoad::getCheckMan, check.getCheckMan()); + update.set(CustomerExportLoad::getCheckStatus, check.getCheckStatus()); + update.set(CustomerExportLoad::getCheckResult, check.getCheckResult()); + update.set(CustomerExportLoad::getCheckTime, new Date()); + update.eq(CustomerExportLoad::getShipId, check.getShipId()); + update.eq(CustomerExportLoad::getVoyageId, check.getVoyageId()); + update.eq(CustomerExportLoad::getCheckStatus, AuditEnum.AUDIT); +// update.in(CustomerExportLoad::getCreateBy, userIds); + + boolean flag = customerExportLoadService.update(update); + + if (!flag) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "船名,航次不存在"); + } + } + + if (check.getCheckStatus() == AuditEnum.AUDIT_PASS && CollectionUtils.isNotEmpty(spares)) { + // 如果审核通过,且是备件,则需要从出口进港计划中匹配到相同的数量,添加到装船申请中 + for (CustomerExportLoad load : spares) { // 找到审核通过的进港计划 + // 首先执行删除 + customerExportLoadCargoService.lambdaUpdate().eq(CustomerExportLoadCargo::getExportLoadId, load.getId()).remove(); + + QueryWrapper eQuery = new QueryWrapper<>(); + eQuery.exists("select id from customer_export_in " + + "where customer_export_in.id = customer_export_in_cargo.export_in_id " + + "and ship_id={0} and voyage_id={1} and check_status={2} and cart_type={3} and quantity={4} and bill_num={5}", check.getShipId(), check.getVoyageId(), AuditEnum.AUDIT_PASS, "备件", load.getSpareQuantity(), load.getBillNo()); + List list = customerExportInCargoService.list(eQuery); + + List collect = list.stream().map(item -> { + CustomerExportLoadCargo cargo = new CustomerExportLoadCargo(); + cargo.setExportLoadId(load.getId()); + cargo.setTermcd(load.getTermcd()); + cargo.setCargoType(1); + cargo.setVinStatus(1); + cargo.setBrandId(load.getBrandId()); + cargo.setBrand(load.getBrand()); + cargo.setVin(item.getVin()); + return cargo; + }).collect(Collectors.toList()); + + customerExportLoadCargoService.saveBatch(collect); + } + } + + // 记录日志 + List list = customerExportLoadService.lambdaQuery() + .eq(CustomerExportLoad::getShipId, check.getShipId()) + .eq(CustomerExportLoad::getVoyageId, check.getVoyageId()) + .eq(CustomerExportLoad::getCheckStatus, AuditEnum.AUDIT) + .list(); + + // 记录日志 + for (CustomerExportLoad record : list) { + LogRecordDTO log = new LogRecordDTO(); + log.setOperateData(record); + log.setStatus(check.getCheckStatus() == AuditEnum.AUDIT_PASS ? 0 : 1); + log.setOperateTime(new Date()); + log.setUserId(SecurityUtils.getUserId()); + log.setUserName(SecurityUtils.getUserName()); + EsLogApprovalUtil.writeLog(log); + } + + return ResultUtil.success("success"); + } + + /** + * 取消审核 + * + * @param check + * @return + */ + @ApiOperation("取消审核") + @PostMapping("/cancel-check") + @Transactional(rollbackFor = {Exception.class}) + public Result cancelCheck(@RequestBody @Validated(ValidationGroup.update.class) ExportLoadCheckVo check) { + LambdaUpdateWrapper update = new LambdaUpdateWrapper<>(); + update.set(CustomerExportLoad::getCheckManId, UserContext.getUser().getUserId()); + update.set(CustomerExportLoad::getCheckMan, check.getCheckMan()); + update.set(CustomerExportLoad::getCheckStatus, AuditEnum.AUDIT); + update.set(CustomerExportLoad::getCheckResult, ""); + update.set(CustomerExportLoad::getCheckTime, new Date()); + update.eq(CustomerExportLoad::getShipId, check.getShipId()); + update.eq(CustomerExportLoad::getVoyageId, check.getVoyageId()); + update.and((wrapper) -> { + wrapper.eq(CustomerExportLoad::getCheckStatus, AuditEnum.AUDIT_PASS) + .or() + .eq(CustomerExportLoad::getCheckStatus, AuditEnum.AUDIT_REJECT); + }); + boolean flag = customerExportLoadService.update(update); + + if (!flag) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "船名,航次不存在"); + } + + // 如果审核通过,且是备件,则需要从出口进港计划中匹配到相同的数量,添加到装船申请中 + LambdaQueryWrapper lQuery = new LambdaQueryWrapper<>(); + lQuery.eq(CustomerExportLoad::getShipId, check.getShipId()); + lQuery.eq(CustomerExportLoad::getVoyageId, check.getVoyageId()); + lQuery.gt(CustomerExportLoad::getSpareQuantity, 0); + + List spares = customerExportLoadService.list(lQuery); + for (CustomerExportLoad load : spares) { // 找到审核通过的进港计划 + //删除 + customerExportLoadCargoService.lambdaUpdate().eq(CustomerExportLoadCargo::getExportLoadId, load.getId()).remove(); + } + + return ResultUtil.success("success"); + } + + @ApiOperation("作业状态更新") + @PostMapping("/status-update") + public Result statusUpdate(@RequestParam @NotBlank(message = "受理号不能为空") String batchNo, + @RequestParam @NotBlank(message = "状态不能为空") String status) { + + LambdaQueryWrapper lQuery = new LambdaQueryWrapper<>(); + lQuery.eq(CustomerExportLoad::getBatchNo, batchNo); + + CustomerExportLoad exportLoad = customerExportLoadService.getOne(lQuery); + if (exportLoad == null) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "受理号" + batchNo + "不存在"); + } + + customerExportLoadCargoService.lambdaUpdate().set(CustomerExportLoadCargo::getWorkStatus, status).eq(CustomerExportLoadCargo::getExportLoadId, exportLoad.getId()).update(); + + return ResultUtil.success("success"); + } + + @ApiOperation("批量修改船名航次") + @PostMapping("/batch-update/shipVoyage") + public Result shipVoyageUpdate(@RequestBody @Validated(ValidationGroup.update.class) BatchUpdateShipVo form) { + + customerExportLoadService.lambdaUpdate() + .set(CustomerExportLoad::getVoyageId, form.getVoyageId()) + .set(CustomerExportLoad::getVoyage, form.getVoyage()) + .eq(CustomerExportLoad::getShipId, form.getShipId()) + .eq(CustomerExportLoad::getCheckStatus, AuditEnum.AUDIT) + .update(); + + return ResultUtil.success("success"); + } + + @ApiOperation("外贸整船车辆导入模板下载") + @GetMapping("/temp/down/ship") + public void tmpDownVin(HttpServletResponse response) throws Exception { + 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("外贸整船车辆导入模板", "UTF-8"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + + excelWriter = EasyExcel.write(out).build(); + + WriteSheet writeSheet = EasyExcel.writerSheet(0, "外贸整船车辆导入模板").head(ExportLoadExcel.class).build(); + + // 查询数据 + List rows = new ArrayList<>(); + + 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(); + } + } + } + } + + @ApiOperation("外贸整船车辆导入") + @PostMapping("/outside/import-to-add") + public Result> outsideUpload(@RequestParam(required = false) String type, MultipartFile file) throws IOException { + // 所有读取的数据 + List dataList = new ArrayList<>(); + + // 有错误的数据 + List errorDataList = new ArrayList<>(); + + // 品牌基础数据 + List brandList = dictHandler.getBrandList(null).getData(); + + EasyExcel.read(file.getInputStream(), ExportLoadExcel.class, new ReadExcelListener() { + @Override + protected void saveData(List list) { // 保存数据 + dataList.addAll(list); + } + }).sheet().doRead(); + + ValidatorFactory vf = Validation.buildDefaultValidatorFactory(); + Validator validator = vf.getValidator(); + + List validData = new ArrayList<>(); + + // 数据验证 + dataList.stream().forEach(item -> { + Set> 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)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList); + } + + // 是否有重复的车架号 + List repeat = validData.stream().collect(Collectors.groupingBy(ExportLoadExcel::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + errorDataList.addAll(validData.stream().filter(p -> repeat.contains(p.getVin())).map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "车架号重复"); + return o; + }).collect(Collectors.toList())); + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList); + } + + // 首先按对船名,般次,提单进行分组 + Map> collect = validData.stream() + .collect(Collectors.groupingBy(item -> StringUtils.joinWith("#$#", item.getShipName(), item.getVoyage(), item.getBillNo(), item.getBrand()), Collectors.toList())); + collect.entrySet().forEach(item -> { + String[] keys = StringUtils.split(item.getKey(), "#$#"); + // 首先判断,船名,航次,提单号在出口进港申请中是否已经通过 + LambdaQueryWrapper iQuery = new LambdaQueryWrapper<>(); + iQuery.eq(CustomerExportIn::getShipName, keys[0]); + iQuery.eq(CustomerExportIn::getVoyage, keys[1]); + iQuery.eq(CustomerExportIn::getBillNum, keys[2]); +// iQuery.eq(CustomerExportIn::getBrand, keys[3]); + iQuery.isNotNull(CustomerExportIn::getVoyageId); + iQuery.eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_PASS); + + CustomerExportIn exportIn = customerExportInService.getOne(iQuery, false); + if (exportIn == null || exportIn.getCheckStatus() != AuditEnum.AUDIT_PASS) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "未找到审核通过的出口进港申请"); + return o; + }).collect(Collectors.toList())); + return; + } + + if (brandList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), keys[3])).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "品牌不存在"); + errorDataList.add(o); + return; + } + + List cargos = item.getValue().stream().map(p -> { + CustomerExportLoadCargo cargo = new CustomerExportLoadCargo(); + cargo.setCargoType(0); + cargo.setVinStatus(1); + cargo.setBrandId(brandList.stream().filter(s -> StringUtils.equalsIgnoreCase(s.getText(), keys[3])).findFirst().get().getId()); + cargo.setBrand(keys[3]); + cargo.setModels(p.getModels()); + cargo.setVin(p.getVin()); + cargo.setTermcd(exportIn.getPortAreaId()); + return cargo; + }).collect(Collectors.toList()); + + List vins = cargos.stream().map(p -> p.getVin()).collect(Collectors.toList()); + + // 导入时校验待提交、待审核、已通过状态中是否有重复的车架号,重复导入失败,提示”车架号已存在,请勿重复申请“ + List existCargos = customerExportLoadCargoService.list(new LambdaQueryWrapper() + .in(CustomerExportLoadCargo::getVin, vins) + .exists("select id from customer_export_load where customer_export_load.id = customer_export_load_cargo.export_load_id and customer_export_load.check_status <> 3")); + List existVins = existCargos.stream().map(p -> p.getVin()).collect(Collectors.toList()); + + // 查询出对应的港区 + if (CollectionUtils.isNotEmpty(existCargos)) { + List sList = customerExportLoadService.lambdaQuery().in(CustomerExportLoad::getId, existCargos.stream().map(ss -> ss.getExportLoadId()).collect(Collectors.toList())).list(); + Map portAreaMap = sList.stream().collect(Collectors.toMap(CustomerExportLoad::getId, CustomerExportLoad::getPortAreaId)); + // 通过接口再次验证 + List req = existCargos.stream().map(ss -> { + CheckVinReq v = new CheckVinReq(); + v.setIsRepetition(true); + v.setPamId(portAreaMap.get(ss.getExportLoadId())); + v.setVinCode(ss.getVin()); + return v; + }).collect(Collectors.toList()); + List rst = shpApi.checkVinRepeat(req); + if (CollectionUtils.isNotEmpty(rst)) { + // 再次过滤出重复的 + List sCollect = rst.stream().filter(ss -> ss.getIsRepetition()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(sCollect)) { + existVins.clear(); + existVins.addAll(sCollect.stream().map(ss -> ss.getVinCode()).collect(Collectors.toList())); + } + } + } + + List existData = item.getValue().stream().filter(p -> existVins.contains(p.getVin())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(existData)) { + errorDataList.addAll(existData.stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "车架号已存在,请勿重复申请"); + return o; + }).collect(Collectors.toList())); + } + + errorDataList.addAll(item.getValue().stream().filter(p -> !existVins.contains(p.getVin())) + .map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "导入成功"); + return o; + }).collect(Collectors.toList())); + + // 生成新的装船记录 + String batchNo = customerService.getSequenceNo("export_load_batch_no", "出口装船", "EL"); + List saveCargos = cargos.stream().filter(s -> !existVins.contains(s.getVin())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(saveCargos)) { + + CustomerExportLoad exportLoad = new CustomerExportLoad(); + + exportLoad.setTradType("W"); + exportLoad.setShipName(keys[0]); + exportLoad.setVoyage(keys[1]); + exportLoad.setBillNo(keys[2]); + exportLoad.setShipId(exportIn.getShipId()); + exportLoad.setShipEnName(exportIn.getShipEnName()); + exportLoad.setVoyageId(exportIn.getVoyageId()); + exportLoad.setBrandId(brandList.stream().filter(s -> StringUtils.equalsIgnoreCase(s.getText(), keys[3])).findFirst().get().getId()); + exportLoad.setBrand(keys[3]); + exportLoad.setBatchNo(batchNo); + exportLoad.setQuantity(saveCargos.size()); + exportLoad.setSpareQuantity(0); + exportLoad.setPortArea(exportIn.getPortArea()); + exportLoad.setPortAreaId(exportIn.getPortAreaId()); + exportLoad.setTermcd(exportIn.getPortAreaId()); + if (StringUtils.equals("1", type)) { + exportLoad.setCheckStatus(AuditEnum.AUDIT); + } else { + exportLoad.setCheckStatus(AuditEnum.SUBMIT); + } + exportLoad.setApplyTime(new Date()); + exportLoad.setApplicantId(UserContext.getUser().getUserId()); + + customerService.saveExportLoad(exportLoad, saveCargos); + } + + }); + + return ResultUtil.success(errorDataList); + } + + + @ApiOperation("外贸整船备件导入模板下载") + @GetMapping("/temp/down/spare") + public void tmpDownSpare(HttpServletResponse response) throws Exception { + 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("外贸整船备件导入模板", "UTF-8"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + + excelWriter = EasyExcel.write(out).build(); + + WriteSheet writeSheet = EasyExcel.writerSheet(0, "外贸整船备件导入模板").head(ExportLoadSpareExcel.class).build(); + + // 查询数据 + List rows = new ArrayList<>(); + + 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(); + } + } + } + } + + @ApiOperation("外贸整船备件导入") + @PostMapping("/outside/spare/import-to-add") + public Result> outsideSpareUpload(@RequestParam(required = false) String type, MultipartFile file) throws IOException { + // 所有读取的数据 + List dataList = new ArrayList<>(); + + // 有错误的数据 + List errorDataList = new ArrayList<>(); + + // 品牌基础数据 + List brandList = dictHandler.getBrandList(null).getData(); + + EasyExcel.read(file.getInputStream(), ExportLoadSpareExcel.class, new ReadExcelListener() { + @Override + protected void saveData(List list) { // 保存数据 + dataList.addAll(list); + } + }).sheet().doRead(); + + ValidatorFactory vf = Validation.buildDefaultValidatorFactory(); + Validator validator = vf.getValidator(); + + List validData = new ArrayList<>(); + + // 数据验证 + dataList.stream().forEach(item -> { + Set> 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)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList); + } + + // 首先按对船名,般次,提单进行分组 + Map> collect = validData.stream().collect(Collectors.groupingBy(item -> StringUtils.joinWith("#$#", item.getShipName(), item.getVoyage(), item.getBillNo(), item.getBrand()), Collectors.toList())); + collect.entrySet().forEach(item -> { + String[] keys = StringUtils.split(item.getKey(), "#$#"); + + // 首先判断,船名,航次,提单号在出口进港申请中是否已经通过 + LambdaQueryWrapper iQuery = new LambdaQueryWrapper<>(); + iQuery.eq(CustomerExportIn::getShipName, keys[0]); + iQuery.eq(CustomerExportIn::getVoyage, keys[1]); + iQuery.eq(CustomerExportIn::getBillNum, keys[2]); +// iQuery.eq(CustomerExportIn::getBrand, keys[3]); + iQuery.isNotNull(CustomerExportIn::getVoyageId); + iQuery.eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_PASS); + + CustomerExportIn exportIn = customerExportInService.getOne(iQuery, false); + if (exportIn == null || exportIn.getCheckStatus() != AuditEnum.AUDIT_PASS) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "未找到审核通过的出口进港申请"); + return o; + }).collect(Collectors.toList())); + return; + } + + if (brandList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), keys[3])).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "品牌不存在"); + errorDataList.add(o); + return; + } + + int num = item.getValue().stream().mapToInt(ExportLoadSpareExcel::getNum).sum(); + + errorDataList.addAll(item.getValue().stream() + .map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "导入成功"); + return o; + }).collect(Collectors.toList())); + + String batchNo = customerService.getSequenceNo("export_load_batch_no", "出口装船", "EL"); + + CustomerExportLoad exportLoad = new CustomerExportLoad(); + + exportLoad.setTradType("W"); + exportLoad.setShipId(exportIn.getShipId()); + exportLoad.setShipName(keys[0]); + exportLoad.setShipEnName(exportIn.getShipEnName()); + exportLoad.setVoyage(keys[1]); + exportLoad.setVoyageId(exportIn.getVoyageId()); + exportLoad.setBillNo(keys[2]); + exportLoad.setBrandId(brandList.stream().filter(s -> StringUtils.equalsIgnoreCase(s.getText(), keys[3])).findFirst().get().getId()); + exportLoad.setBrand(keys[3]); + exportLoad.setBatchNo(batchNo); + exportLoad.setQuantity(0); + exportLoad.setSpareQuantity(num); + exportLoad.setPortArea(exportIn.getPortArea()); + exportLoad.setPortAreaId(exportIn.getPortAreaId()); + exportLoad.setTermcd(exportIn.getTermcd()); + if (StringUtils.equals("1", type)) { + exportLoad.setCheckStatus(AuditEnum.AUDIT); + } else { + exportLoad.setCheckStatus(AuditEnum.SUBMIT); + } + exportLoad.setApplyTime(new Date()); + exportLoad.setApplicantId(UserContext.getUser().getUserId()); + + + customerService.saveExportLoad(exportLoad, Collections.emptyList()); + + }); + + return ResultUtil.success(errorDataList); + } + + @ApiOperation("导入删除") + @PostMapping("/import-to-del") + public Result uploadToDelete(@RequestParam @NotBlank(message = "车架号不能为空") String vin) { + customerService.delExportLoadByVin(vin); + + return ResultUtil.success("success"); + } + + @ApiOperation("内贸整船车辆导入模板下载") + @GetMapping("/temp/down/inside/vin") + public void tmpDownInsideVin(HttpServletResponse response) throws Exception { + 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("内贸整船车辆导入模板", "UTF-8"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + + excelWriter = EasyExcel.write(out).build(); + + WriteSheet writeSheet = EasyExcel.writerSheet(0, "内贸整船车辆导入模板").head(ExportLoadInsideExcel.class).build(); + + // 查询数据 + List rows = new ArrayList<>(); + + 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(); + } + } + } + } + + @ApiOperation("内贸整船车辆导入") + @PostMapping("/inside/import-to-add") + public Result> insideUpload(@RequestParam(required = false) String type, MultipartFile file) throws IOException { + // 所有读取的数据 + List dataList = new ArrayList<>(); + + // 有错误的数据 + List errorDataList = new ArrayList<>(); + + // 结算单位 + Map companyMap = new HashMap<>(); +// List companyList = pubApi.getCompanyList(Arrays.asList("7")); + // 品牌基础数据 + List brandList = dictHandler.getBrandList(null).getData(); + // 港口基础数据 + List portList = dictHandler.getPortList(null).getData(); + // 船名基础数据 + List shipList = dictHandler.getAllShip(null).getData(); + // 港区基础数据 + List portAreaList = dictHandler.getPortAreaList(null).getData(); + // 缓存航次信息 + Map voyageMap = new HashMap<>(); + + EasyExcel.read(file.getInputStream(), ExportLoadInsideExcel.class, new ReadExcelListener() { + @Override + protected void saveData(List list) { // 保存数据 + dataList.addAll(list); + } + }).sheet().doRead(); + + ValidatorFactory vf = Validation.buildDefaultValidatorFactory(); + Validator validator = vf.getValidator(); + + List validData = new ArrayList<>(); + + // 数据验证 + dataList.stream().forEach(item -> { + Set> 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)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList); + } + + // 是否有重复的车架号 + List repeat = validData.stream().collect(Collectors.groupingBy(ExportLoadInsideExcel::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + errorDataList.addAll(validData.stream().filter(p -> repeat.contains(p.getVin())).map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "车架号重复"); + return o; + }).collect(Collectors.toList())); + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList); + } + + // 结算单位不一致 + List list = validData.stream().collect(Collectors.groupingBy(ExportLoadInsideExcel::getBillNo, Collectors.groupingBy(ExportLoadInsideExcel::getSettleCompName, Collectors.counting()))) + .entrySet().stream().filter(entry -> entry.getValue().size() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + + validData.stream().forEach(item -> { + if (StringUtils.isNotEmpty(item.getDestPort()) && portList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getDestPort())).count() == 0) { + 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; + } + 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(item.getVoyage())) { + VoyageDTO v = shpApi.getVoyageNameByVvyName(item.getVoyage()); + if (v == null || StringUtils.isEmpty(v.getVvyId())) { + voyageMap.put(item.getVoyage(), ""); + } else { + voyageMap.put(item.getVoyage(),StringUtils.trim(v.getVvyId())); + } + } + if (StringUtils.isEmpty(voyageMap.get(item.getVoyage()))) { + JSONObject o = JSONObject.from(item); + o.put("status", "航次不存在"); + errorDataList.add(o); + return; + } + if (CollectionUtils.containsAny(list, item.getSettleCompName())) { + JSONObject o = JSONObject.from(item); + o.put("status", "相同提单号需保持结费单位相同"); + errorDataList.add(o); + return; + } + if (!companyMap.containsKey(item.getSettleCompName())) { + CompanyDTO company = pubApi.getCompanyByName(item.getSettleCompName()); + if (company == null || StringUtils.isEmpty(company.getCueId())) { + companyMap.put(item.getSettleCompName(), ""); + } else { + companyMap.put(item.getSettleCompName(), StringUtils.trim(company.getCueId())); + } + } + if (StringUtils.isEmpty(companyMap.get(item.getSettleCompName()))) { + JSONObject o = JSONObject.from(item); + o.put("status", "结算单位不存在"); + errorDataList.add(o); + return; + } + if (brandList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getBrand())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "品牌不存在"); + errorDataList.add(o); + return; + } + }); + + if (CollectionUtils.isNotEmpty(errorDataList)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList); + } + + // 首先按对船名,般次,提单进行分组 + Map> collect = validData.stream().collect(Collectors.groupingBy(item -> StringUtils.joinWith("#$#", item.getShipName(), item.getVoyage(), item.getBillNo(), item.getBrand()), Collectors.toList())); + collect.entrySet().forEach(item -> { + String[] keys = StringUtils.split(item.getKey(), "#$#"); + + // 相同的提单号,必须是相同的结算单位 + LambdaQueryWrapper lQuery = new LambdaQueryWrapper<>(); + lQuery.eq(CustomerExportLoad::getBillNo, keys[2]); + lQuery.ne(CustomerExportLoad::getSettleCompId, companyMap.get(item.getValue().get(0).getSettleCompName())); + + long count = customerExportLoadService.count(lQuery); + if (count > 0) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "相同提单号需保持结费单位相同"); + return o; + }).collect(Collectors.toList())); + return; + } + + List cargos = item.getValue().stream().map(p -> { + CustomerExportLoadCargo cargo = new CustomerExportLoadCargo(); + cargo.setCargoType(0); + cargo.setVinStatus(1); + cargo.setBrandId(brandList.stream().filter(s -> StringUtils.equalsIgnoreCase(s.getText(), p.getBrand())).findFirst().get().getId()); + cargo.setBrand(p.getBrand()); + cargo.setVin(p.getVin()); + return cargo; + }).collect(Collectors.toList()); + + List vins = cargos.stream().map(p -> p.getVin()).collect(Collectors.toList()); + + // 导入时校验待提交、待审核、已通过状态中是否有重复的车架号,重复导入失败,提示”车架号已存在,请勿重复申请“ + List existCargos = customerExportLoadCargoService.list(new LambdaQueryWrapper() + .in(CustomerExportLoadCargo::getVin, vins) + .exists("select id from customer_export_load where customer_export_load.id = customer_export_load_cargo.export_load_id and customer_export_load.check_status <> 3")); + List existVins = existCargos.stream().map(p -> p.getVin()).collect(Collectors.toList()); + + // 查询出对应的港区 + if (CollectionUtils.isNotEmpty(existCargos)) { + List sList = customerExportLoadService.lambdaQuery().in(CustomerExportLoad::getId, existCargos.stream().map(ss -> ss.getExportLoadId()).collect(Collectors.toList())).list(); + Map portAreaMap = sList.stream().collect(Collectors.toMap(CustomerExportLoad::getId, CustomerExportLoad::getPortAreaId)); + // 通过接口再次验证 + List req = existCargos.stream().map(ss -> { + CheckVinReq v = new CheckVinReq(); + v.setIsRepetition(true); + v.setPamId(portAreaMap.get(ss.getExportLoadId())); + v.setVinCode(ss.getVin()); + return v; + }).collect(Collectors.toList()); + List rst = shpApi.checkVinRepeat(req); + if (CollectionUtils.isNotEmpty(rst)) { + // 再次过滤出重复的 + List sCollect = rst.stream().filter(ss -> ss.getIsRepetition()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(sCollect)) { + existVins.clear(); + existVins.addAll(sCollect.stream().map(ss -> ss.getVinCode()).collect(Collectors.toList())); + } + } + } + + List existData = item.getValue().stream().filter(p -> existVins.contains(p.getVin())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(existData)) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "车架号已存在,请勿重复申请"); + return o; + }).collect(Collectors.toList())); + } + + errorDataList.addAll(item.getValue().stream().filter(p -> !existVins.contains(p.getVin())) + .map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "导入成功"); + return o; + }).collect(Collectors.toList())); + + // 生成新的装船记录 + String batchNo = customerService.getSequenceNo("export_load_batch_no", "出口装船", "EL"); + List saveCargos = cargos.stream().filter(s -> !existVins.contains(s.getVin())).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(saveCargos)) { + + CustomerExportLoad exportLoad = new CustomerExportLoad(); + + exportLoad.setTradType("N"); + exportLoad.setShipId(shipList.stream().filter(s -> StringUtils.equalsIgnoreCase(s.getText(), keys[0])).findFirst().get().getId()); + exportLoad.setShipName(keys[0]); + exportLoad.setShipEnName(shipList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), keys[0])).findFirst().get().getExtra1()); + exportLoad.setVoyageId(voyageMap.get(keys[1])); + exportLoad.setVoyage(keys[1]); + exportLoad.setBillNo(keys[2]); + exportLoad.setBrandId(brandList.stream().filter(s -> StringUtils.equalsIgnoreCase(s.getText(), keys[3])).findFirst().get().getId()); + exportLoad.setBrand(keys[3]); + exportLoad.setBatchNo(batchNo); + exportLoad.setQuantity(saveCargos.size()); + exportLoad.setSpareQuantity(0); + exportLoad.setSettleCompId(companyMap.get(item.getValue().get(0).getSettleCompName())); + exportLoad.setSettleCompName(item.getValue().get(0).getSettleCompName()); + exportLoad.setPortAreaId(portAreaList.stream().filter(s -> StringUtils.equals(s.getText(), item.getValue().get(0).getPortArea())).findFirst().get().getId()); + exportLoad.setPortArea(item.getValue().get(0).getPortArea()); + exportLoad.setContact(item.getValue().get(0).getContact()); + exportLoad.setContactPhone(item.getValue().get(0).getContactPhone()); + exportLoad.setDestPort(item.getValue().get(0).getDestPort()); + exportLoad.setDestPortId(portList.stream().filter(s -> StringUtils.equals(s.getText(), item.getValue().get(0).getDestPort())).findFirst().get().getId()); + if (StringUtils.equals("1", type)) { + exportLoad.setCheckStatus(AuditEnum.AUDIT); + } else { + exportLoad.setCheckStatus(AuditEnum.SUBMIT); + } + exportLoad.setApplyTime(new Date()); + exportLoad.setApplicantId(UserContext.getUser().getUserId()); + + customerService.saveExportLoad(exportLoad, saveCargos); + } + + }); + + return ResultUtil.success(errorDataList); + } + + /* + @ApiOperation("内贸整船备件导入") + @PostMapping("/inside/spare/import-to-add") + public Result> insideSpareUpload(@RequestParam(required = false) String type, MultipartFile file) throws IOException { + // 所有读取的数据 + List dataList = new ArrayList<>(); + + // 有错误的数据 + List errorDataList = new ArrayList<>(); + + // 公司信息 + List companyList = pubApi.getCompanyList(Arrays.asList("7")); + + EasyExcel.read(file.getInputStream(), ExportLoadInsideSpareExcel.class, new ReadExcelListener() { + @Override + protected void saveData(List list) { // 保存数据 + dataList.addAll(list); + } + }).sheet().doRead(); + + ValidatorFactory vf = Validation.buildDefaultValidatorFactory(); + Validator validator = vf.getValidator(); + + List validData = new ArrayList<>(); + + // 数据验证 + dataList.stream().forEach(item -> { + Set> 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)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList); + } + + validData.stream().forEach(item -> { + if (companyList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getCueCnname(), item.getSettleCompName())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "结算单位不存在"); + errorDataList.add(o); + return; + } + }); + + // 首先按对船名,般次,提单进行分组 + Map> collect = validData.stream().collect(Collectors.groupingBy(item -> StringUtils.joinWith("#$#", item.getShipName(), item.getVoyage(), item.getBillNo(), item.getBrand()), Collectors.toList())); + collect.entrySet().forEach(item -> { + String[] keys = StringUtils.split(item.getKey(), "#$#"); + + // 首先判断,船名,航次,提单号在出口进港申请中是否已经通过 + LambdaQueryWrapper iQuery = new LambdaQueryWrapper<>(); + iQuery.eq(CustomerExportIn::getShipName, keys[0]); + iQuery.eq(CustomerExportIn::getVoyage, keys[1]); + iQuery.eq(CustomerExportIn::getBillNum, keys[2]); + iQuery.eq(CustomerExportIn::getBrand, keys[3]); + iQuery.isNotNull(CustomerExportIn::getVoyageId); + iQuery.eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_PASS); + + CustomerExportIn exportIn = customerExportInService.getOne(iQuery); + if (exportIn == null || exportIn.getCheckStatus() != AuditEnum.AUDIT_PASS) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "未找到审核通过的出口进港申请"); + return o; + }).collect(Collectors.toList())); + return; + } + + int num = item.getValue().stream().mapToInt(ExportLoadInsideSpareExcel::getNum).sum(); + + errorDataList.addAll(item.getValue().stream() + .map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "导入成功"); + return o; + }).collect(Collectors.toList())); + + String batchNo = customerService.getSequenceNo("export_load_batch_no", "出口装船", "EL"); + + CustomerExportLoad exportLoad = new CustomerExportLoad(); + + exportLoad.setTradType("N"); + exportLoad.setShipId(exportIn.getShipId()); + exportLoad.setShipName(keys[0]); + exportLoad.setShipEnName(exportIn.getShipEnName()); + exportLoad.setVoyageId(exportIn.getVoyageId()); + exportLoad.setVoyage(keys[1]); + exportLoad.setBillNo(keys[2]); + exportLoad.setBrandId(exportIn.getBrandId()); + exportLoad.setBrand(exportIn.getBrand()); + exportLoad.setBatchNo(batchNo); + exportLoad.setQuantity(0); + exportLoad.setSpareQuantity(num); + if (StringUtils.equals("1", type)) { + exportLoad.setCheckStatus(AuditEnum.AUDIT); + } else { + exportLoad.setCheckStatus(AuditEnum.SUBMIT); + } + exportLoad.setApplyTime(new Date()); + +// exportLoad.setQuantity(exportLoad.getQuantity() + saveCargos.size()); + + customerService.saveExportLoad(exportLoad, Collections.emptyList()); + + }); + + return ResultUtil.success(errorDataList); + }*/ +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/FreeTradeHandler.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/FreeTradeHandler.java new file mode 100644 index 0000000..c741ad2 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/FreeTradeHandler.java @@ -0,0 +1,589 @@ +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.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.haitonggauto.rtosc.api.NuzarMiniApi; +import com.haitonggauto.rtosc.common.context.UserContext; +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.excel.ExportLoadInsideExcel; +import com.haitonggauto.rtosc.excel.ExportVinExcel; +import com.haitonggauto.rtosc.excel.FreeTradeExcel; +import com.haitonggauto.rtosc.excel.FreeTradeExportExcel; +import com.haitonggauto.rtosc.handler.excel.ReadExcelListener; +import com.haitonggauto.rtosc.query.FreeTradeQuery; +import com.haitonggauto.rtosc.repository.entity.CustomerExportIn; +import com.haitonggauto.rtosc.repository.entity.CustomerFreeTrade; +import com.haitonggauto.rtosc.handler.mapper.PoMapper; +import com.haitonggauto.rtosc.repository.enums.ActiveEnum; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.haitonggauto.rtosc.repository.service.CustomerFreeTradeService; +import com.haitonggauto.rtosc.service.CustomerService; +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 org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +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.net.URLEncoder; +import java.util.*; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("/spz") +@Api(tags = "特保区") +@Validated +public class FreeTradeHandler implements BaseHandler { + + @Resource + private CustomerService customerService; + + @Resource + private CustomerFreeTradeService customerFreeTradeService; + + @Resource + private NuzarMiniApi miniApi; + + /** + * 分页查询 + * + * @param query + * @return + */ + @ApiOperation("条件分页查询") + @PostMapping("/query-list") + public Result> query(@RequestBody FreeTradeQuery query) { + if (query.getEndCreateDate() != null) { + query.setEndCreateDate(DateUtils.getDayEnd(query.getEndCreateDate())); + } + query.setCreateBy(UserContext.getUser().getUserId()); + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerFreeTrade.class, query); + Page page = customerFreeTradeService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + return ResultUtil.success(page); + } + + @ApiOperation("审核端条件分页查询") + @PostMapping("/check/query-list") + public Result> checkQuery(@RequestBody FreeTradeQuery query) { + if (query.getEndCreateDate() != null) { + query.setEndCreateDate(DateUtils.getDayEnd(query.getEndCreateDate())); + } + if (query.getCheckStatus() == null) { + query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); + } + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerFreeTrade.class, query); + Page page = customerFreeTradeService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + return ResultUtil.success(page); + } + + /** + * 新增 + * + * @param form + * @return + */ + @ApiOperation("新增") + @PostMapping("/add") + public Result save(@RequestBody @Validated(ValidationGroup.insert.class) FreeTradeVo form) { + String batchNo = customerService.getSequenceNo("free_trade_batch_no", "特保区基本", "SPZ"); + // 表单验证以及格式转换 + CustomerFreeTrade freeTrade = PoMapper.instance.freeTradeVo2Entity(form); + freeTrade.setBatchNo(batchNo); + freeTrade.setCheckStatus(AuditEnum.SUBMIT); + + customerFreeTradeService.save(freeTrade); + + return ResultUtil.success(String.valueOf(freeTrade.getId())); + } + + /** + * 删除 + * + * @param ids + * @return + */ + @ApiOperation("删除") + @PostMapping("/del") + public Result delete(@RequestBody @NotNull(message = "请传入要删除的出口进场ID") @Size(min = 1, message = "至少需要传入一个ID") ValidList ids) { + for (Long id : ids) { + CustomerFreeTrade freeTrade = customerFreeTradeService.getById(id); + if (freeTrade != null) { + if (freeTrade.getIsActivate() == ActiveEnum.YES) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "ID:" + id + ",已激活的数据不可删除"); + } + customerFreeTradeService.removeById(id); + } else { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "ID:" + id + ",不存在"); + } + } + return ResultUtil.success("success"); + } + + @ApiOperation("审核端编辑") + @PostMapping("/checker/edit") + // 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法 + public Result edit(@RequestBody @Validated(ValidationGroup.update.class) FreeTradeVo form) { + return this.edit(true, form); + } + + /** + * 编辑 + * + * @param form + * @return + */ + @ApiOperation("编辑") + @PostMapping("/edit") + // 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法 + public Result edit(@RequestParam(required = false, defaultValue = "false")Boolean flag, + @RequestBody @Validated(ValidationGroup.update.class) FreeTradeVo form) { + CustomerFreeTrade trade = customerFreeTradeService.getById(form.getId()); + if (trade.getCheckStatus() == AuditEnum.AUDIT_PASS) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "审核通过之后不能进行编辑"); + } + String batchNo = trade.getBatchNo(); + // 表单验证以及格式转换 + CustomerFreeTrade freeTrade = PoMapper.instance.freeTradeVo2Entity(form); + freeTrade.setBatchNo(batchNo); + if (!flag) { + freeTrade.setCheckStatus(AuditEnum.SUBMIT); + } else { + freeTrade.setCheckStatus(AuditEnum.AUDIT); + } + + customerFreeTradeService.updateById(freeTrade); + + return ResultUtil.success(String.valueOf(freeTrade.getId())); + } + + /** + * @param ids + * @return + */ + @ApiOperation("激活") + @PostMapping("/activate") + public Result activate(@RequestBody + @NotNull(message = "请传入要提交激活的ID列表") + @Size(min = 1, message = "ID列表不能为空") List ids) { + customerFreeTradeService.lambdaUpdate().set(CustomerFreeTrade::getIsActivate, ActiveEnum.YES).in(CustomerFreeTrade::getId, ids).update(); + return ResultUtil.success("success"); + } + + /** + * 取消激活 + * @param ids + * @return + */ + @ApiOperation("取消激活") + @PostMapping("/cancel-activate") + public Result canclelAtivate(@RequestBody + @NotNull(message = "请传入要提交激活的ID列表") + @Size(min = 1, message = "ID列表不能为空") List ids) { + List collect = customerFreeTradeService.lambdaQuery().in(CustomerFreeTrade::getId, ids).list().stream().map(item -> item.getVin()).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(collect)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "未查询到车架号"); + } + List vins = miniApi.getAppointmentByVin(collect); + if (CollectionUtils.isNotEmpty(vins)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(vins, ",") + "已预约, 无法取消激活"); + } + customerFreeTradeService.lambdaUpdate().set(CustomerFreeTrade::getIsActivate, ActiveEnum.NO).in(CustomerFreeTrade::getId, ids).update(); + return ResultUtil.success("success"); + } + + @ApiOperation("提交审核") + @PostMapping("/submit-check") + public Result submitCheck(@RequestBody List ids) { + if (CollectionUtils.isEmpty(ids)) { + customerFreeTradeService.lambdaUpdate().eq(CustomerFreeTrade::getCheckStatus, AuditEnum.SUBMIT).set(CustomerFreeTrade::getCheckStatus, AuditEnum.AUDIT).update(); + } else { + customerFreeTradeService.lambdaUpdate().set(CustomerFreeTrade::getCheckStatus, AuditEnum.AUDIT) + .set(CustomerFreeTrade::getCheckResult, null) + .in(CustomerFreeTrade::getId, ids).update(); + } + return ResultUtil.success("success"); + } + + /** + * 验证车架号状态是否激活 + * @param vins + * @return + */ + @ApiOperation("验证车架号激活状态") + @PostMapping("/valid-vins") + public Result validVins(@RequestBody + @NotNull(message = "请传入车架号列表") + @Size(min = 1, message = "车架号列表不能为空") List vins) { + List list = customerFreeTradeService.lambdaQuery().in(CustomerFreeTrade::getVin, vins).list(); + // 返回的车架号信息 + List collect = list.stream().map(item -> item.getVin()).collect(Collectors.toList()); + // 待激活的车架号信息 + List noActivate = list.stream().filter(item -> item.getIsActivate() == ActiveEnum.NO).map(item -> item.getVin()).collect(Collectors.toList()); + List 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"); + } + + /** + * 详情 + * + * @param id + * @return + */ + @ApiOperation("详情") + @PostMapping("/detail") + public Result detail(@RequestParam @NotNull(message = "请传入要获取的出口进场ID") Long id) { + CustomerFreeTrade freeTrade = customerFreeTradeService.getById(id); + customerService.wrapperEntity(freeTrade); + return ResultUtil.success(freeTrade); + } + + /** + * 审核 + * + * @param check + * @return + */ + @ApiOperation("审核") + @PostMapping("/check") + public Result check(@RequestBody @Validated(ValidationGroup.insert.class) FreeTradeCheckVo check) throws Exception { + List freeTrades = new ArrayList<>(); + for (Long id : check.getIds()) { + CustomerFreeTrade f = PoMapper.instance.freeTradeCheckVo2Entity(check); + f.setId(id); + f.setCheckManId(UserContext.getUser().getUserId()); + f.setCheckTime(new Date()); + freeTrades.add(f); + } + + boolean row = customerFreeTradeService.updateBatchById(freeTrades); + if (row) { + List list = customerFreeTradeService.lambdaQuery().in(CustomerFreeTrade::getId, check.getIds()).list(); + + // 记录日志 + for (CustomerFreeTrade record : list) { + LogRecordDTO log = new LogRecordDTO(); + log.setOperateData(record); + log.setStatus(check.getCheckStatus() == AuditEnum.AUDIT_PASS ? 0 : 1); + log.setOperateTime(new Date()); + log.setUserId(SecurityUtils.getUserId()); + log.setUserName(SecurityUtils.getUserName()); + EsLogApprovalUtil.writeLog(log); + } + + return ResultUtil.success("success"); + } + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败,ID不存在"); + } + + /** + * 取消审核 + * + * @param check + * @return + */ + @ApiOperation("取消审核") + @PostMapping("/cancel-check") + public Result cancelCheck(@RequestBody @Validated(ValidationGroup.update.class) FreeTradeCheckVo check) { + List freeTrades = new ArrayList<>(); + for (Long id : check.getIds()) { + CustomerFreeTrade f = PoMapper.instance.freeTradeCheckVo2Entity(check); + f.setId(id); + f.setCheckTime(new Date()); + f.setCheckManId(UserContext.getUser().getUserId()); + f.setCheckStatus(AuditEnum.AUDIT); + freeTrades.add(f); + } + + boolean row = customerFreeTradeService.updateBatchById(freeTrades); + if (row) { + return ResultUtil.success("success"); + } + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败,ID不存在"); + } + + @ApiOperation("特保区导入模板下载") + @GetMapping("/temp/down/freeTradeExcel") + public void tmpDownFreeTrade(HttpServletResponse response) throws Exception { + 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("特保区导入模板", "UTF-8"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + + excelWriter = EasyExcel.write(out).build(); + + WriteSheet writeSheet = EasyExcel.writerSheet(0, "特保区导入模板").head(FreeTradeExcel.class).build(); + + // 查询数据 + List rows = new ArrayList<>(); + + 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(); + } + } + } + } + + @ApiOperation("特保区导入") + @PostMapping("/import-to-add") + public Result> upload( + @RequestParam(required = false, defaultValue = "0") String type, + MultipartFile file) throws IOException { + // 不完整的数据 + List noValidList = new ArrayList<>(); + + // 已存在的数据 + List exists = new ArrayList<>(); + + // 更新成功的数据 + List updateList = new ArrayList<>(); + + // 成功导入的数据 + List successList = new ArrayList<>(); + + EasyExcel.read(file.getInputStream(), FreeTradeExcel.class, new ReadExcelListener() { + @Override + protected void saveData(List list) { // 保存数据 + ValidatorFactory vf = Validation.buildDefaultValidatorFactory(); + Validator validator = vf.getValidator(); + + List validData = new ArrayList<>(); + + // 数据验证 + list.stream().forEach(item -> { + Set> 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(","))); + noValidList.add(o); + } + }); + + if (CollectionUtils.isEmpty(validData)) { + return; + } + + // 是否有重复的车架号 + List repeat = validData.stream().collect(Collectors.groupingBy(FreeTradeExcel::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + noValidList.addAll(validData.stream().filter(p -> repeat.contains(p.getVin())).map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "车架号重复"); + return o; + }).collect(Collectors.toList())); + return; + } + + List collect = validData.stream().map(item -> { + CustomerFreeTrade freeTrade = PoMapper.instance.excel2Entity(item); + freeTrade.setApplicantId(UserContext.getUser().getUserId()); + freeTrade.setIsActivate(ActiveEnum.NO); + freeTrade.setApplyTime(new Date()); + if (StringUtils.equals("1", type)) { + freeTrade.setCheckStatus(AuditEnum.AUDIT); + } else { + freeTrade.setCheckStatus(AuditEnum.SUBMIT); + } + return freeTrade; + }).collect(Collectors.toList()); + + List vins = collect.stream().map(p -> p.getVin()).collect(Collectors.toList()); + + // 验证哪些车架号已经存在了 + List existCargos = customerFreeTradeService.list(new LambdaQueryWrapper().in(CustomerFreeTrade::getVin, vins)); + Map existVins = existCargos.stream().collect(Collectors.toMap(CustomerFreeTrade::getVin, CustomerFreeTrade::getIsActivate)); + Map existIdMap = existCargos.stream().collect(Collectors.toMap(CustomerFreeTrade::getVin, CustomerFreeTrade::getId)); + + // 已激活不处理的数据 + List activeData = validData.stream().filter(p -> existVins.containsKey(p.getVin()) && existVins.get(p.getVin()) == ActiveEnum.YES).collect(Collectors.toList()); + exists.addAll(activeData); + + // 需要修改的数据 + List update = collect.stream().filter(p -> existVins.containsKey(p.getVin()) && existVins.get(p.getVin()) == ActiveEnum.NO).map(p -> { + p.setId(existIdMap.get(p.getVin())); + p.setIsActivate(ActiveEnum.NO); + return p; + }).collect(Collectors.toList()); + + updateList.addAll(validData.stream().filter(p -> existVins.containsKey(p.getVin()) && existVins.get(p.getVin()) == ActiveEnum.NO).collect(Collectors.toList())); + + List save = collect.stream().filter(p -> !existIdMap.containsKey(p.getVin())).map(p -> { + p.setIsActivate(ActiveEnum.NO); + return p; + }).collect(Collectors.toList()); + + successList.addAll(validData.stream().filter(p -> !existIdMap.containsKey(p.getVin())).collect(Collectors.toList())); + + customerFreeTradeService.updateBatchById(update); + + customerFreeTradeService.saveBatch(save); + + } + }).sheet().doRead(); + + List rst = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(successList)) { + rst.addAll(successList.stream().map(item -> { + JSONObject o = JSONObject.from(item); + o.put("status", "导入成功"); + return o; + }).collect(Collectors.toList())); + } + + if (CollectionUtils.isNotEmpty(noValidList)) { + rst.addAll(noValidList); + } + + if (CollectionUtils.isNotEmpty(exists)) { + rst.addAll(exists.stream().map(item -> { + JSONObject o = JSONObject.from(item); + o.put("status", "数据存在并激活, 未导入"); + return o; + }).collect(Collectors.toList())); + } + + + if (CollectionUtils.isNotEmpty(updateList)) { + rst.addAll(updateList.stream().map(item -> { + JSONObject o = JSONObject.from(item); + o.put("status", "数据存在,更新成功"); + return o; + }).collect(Collectors.toList())); + } + + return ResultUtil.success(rst); + } + + @ApiOperation("导入删除") + @PostMapping("/import-to-del") + public Result uploadToDelete(@RequestParam @NotBlank(message = "车架号不能为空") String vin) { + Map m = new HashMap<>(); + m.put("vin", vin); + customerFreeTradeService.removeByMap(m); + + return ResultUtil.success("success"); + } + + @ApiOperation("导出") + @GetMapping("/exportExecl") + public void exportExecl(FreeTradeQuery query, HttpServletResponse response) { + query.setCreateBy(UserContext.getUser().getUserId()); + query.setPage(1); + query.setRows(500); + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerFreeTrade.class, query); + + 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(); + + String exportDate = DateUtil.now(); + + WriteSheet writeSheet = EasyExcel.writerSheet(0, "特保商品车").head(FreeTradeExportExcel.class).build(); + + // 查询数据 + + query.setCreateBy(UserContext.getUser().getUserId()); + + Page page = customerFreeTradeService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + + List rows = page.getRecords().stream().map(item -> { + FreeTradeExportExcel p = PoMapper.instance.entity2Excel(item); + p.setExportDate(exportDate); + return p; + }).collect(Collectors.toList()); + + excelWriter.write(rows, writeSheet); + + for (int i = 2; i <= page.getPages(); i++) { + query.setPage(2); + customerFreeTradeService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + + rows = page.getRecords().stream().map(item -> { + FreeTradeExportExcel p = PoMapper.instance.entity2Excel(item); + p.setExportDate(exportDate); + return p; + }).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(); + } + } + } + + } +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ImportInspectHandler.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ImportInspectHandler.java new file mode 100644 index 0000000..dcd80f6 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ImportInspectHandler.java @@ -0,0 +1,473 @@ +package com.haitonggauto.rtosc.handler; + +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.dto.*; +import com.haitonggauto.rtosc.api.dto.log.ImportInspectLog; +import com.haitonggauto.rtosc.common.context.UserContext; +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.ResultUtil; +import com.haitonggauto.rtosc.common.utils.ValidationGroup; +import com.haitonggauto.rtosc.common.utils.WrapperKit; +import com.haitonggauto.rtosc.dto.*; +import com.haitonggauto.rtosc.handler.mapper.PoMapper; +import com.haitonggauto.rtosc.query.CargoQuery; +import com.haitonggauto.rtosc.query.ExportInspectCheckQuery; +import com.haitonggauto.rtosc.query.ExportInspectQuery; +import com.haitonggauto.rtosc.repository.entity.CustomerExportIn; +import com.haitonggauto.rtosc.repository.entity.CustomerExportInspect; +import com.haitonggauto.rtosc.repository.entity.CustomerExportInspectCargo; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.haitonggauto.rtosc.repository.enums.InspectStatusEnum; +import com.haitonggauto.rtosc.repository.service.CustomerExportInspectCargoService; +import com.haitonggauto.rtosc.repository.service.CustomerExportInspectService; +import com.haitonggauto.rtosc.service.CustomerService; +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 org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.*; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("/iis") +@Api(tags = "进口海关查验") +@Validated +public class ImportInspectHandler implements BaseHandler { + + @Resource + private CustomerService customerService; + + @Resource + private CustomerExportInspectService customerExportInspectService; + + @Resource + private CustomerExportInspectCargoService customerExportInspectCargoService; + + @Resource + private NuzarOpenApi openApi; + + @ApiOperation("船名航次模糊匹配") + @PostMapping("/shipVoyage") + public Result> getExportInShipNameList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) String q) { + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct ship_id, ship_name, ship_en_name, voyage_id, voyage"); + 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); + wrapper.or().like("voyage", q); + }); + } + + Page page = customerExportInspectService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(tmp -> { + ShipVoyageVo vo = new ShipVoyageVo(); + vo.setShipId(tmp.getShipId()); + vo.setShipName(tmp.getShipName()); + vo.setShipEnName(tmp.getShipEnName()); + vo.setVoyageId(tmp.getVoyageId()); + vo.setVoyage(tmp.getVoyage()); + return vo; + }).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + @ApiOperation("提单号模糊匹配") + @PostMapping("/billNo/query") + public Result> getExportInBillNoList( + @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 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); // 提单号 + + Page page = customerExportInspectService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(item -> item.getBillNo()).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + // 进口查验船名列表 + @ApiOperation("场地确认完成的船名") + @PostMapping("/selectShip") + public Result> getImportInspectShipList(@RequestParam(value = "key", required = false) String key){ + return ResultUtil.success(openApi.getImportInspectShipList(key)); + } + + // 进口查验航次列表 + @ApiOperation("场地确认完成的航次") + @PostMapping("/selectVoyages") + public Result> getImportInspectVoyageList(@RequestParam(value = "spmId", required = false) String spmId, @RequestParam(value = "key", required = false) String key){ + return ResultUtil.success(openApi.getImportInspectVoyageList(spmId, key)); + } + + // 进口查验提单列表 + @ApiOperation("场地确认完成的提单号") + @PostMapping("/selectBills") + public Result> getImportInspectBillNoList(@RequestParam(value = "vvyId", required = false) String vvyId, @RequestParam(value = "key", required = false) String key){ + return ResultUtil.success(openApi.getImportInspectBillNoList(vvyId, key)); + } + + // 进口查验申请货物明细分页 + @ApiOperation("进口查验申请货物明细") + @PostMapping("/goodsDetail") + public Result> getImportInspectCargos(@RequestParam("current") Integer current, + @RequestParam("planId") String planId, + @RequestParam("size") Integer size, @RequestParam(value = "splitId", required=false) String splitId){ + return ResultUtil.success(openApi.getImportInspectCargos(current, planId, size, splitId)); + } + + /** + * 分页查询 + * + * @param query + * @return + */ + @ApiOperation("条件分页查询") + @PostMapping("/query-list") + public Result> query(@RequestBody ExportInspectQuery query) { + query.setCreateBy(UserContext.getUser().getUserId()); + query.setTradType("I"); + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerExportInspect.class, query); + Page page = customerExportInspectService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + // 获取查验状态 + List ids = page.getRecords().stream().map(item -> item.getId() + "").collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(ids)) { + List inspectStatusStatus = openApi.getInspectStatusStatus(ids); + Map collect = inspectStatusStatus.stream().collect(Collectors.toMap(InspectStatusResp::getApplyId, InspectStatusResp::getInspectionStatusNm)); + page.getRecords().forEach(item -> { + if (collect.containsKey(item.getId()+"")) { + item.setApiInspectStatus(collect.get(item.getId()+"")); + } + }); + } + return ResultUtil.success(page); + } + + @ApiOperation("审核条件分页查询") + @PostMapping("/check/query-list") + public Result> checkQuery(@RequestBody ExportInspectCheckQuery query) { + query.setTradType("I"); + if (query.getCheckStatus() == null) { + query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); + } + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerExportInspect.class, query); + Page page = customerExportInspectService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + // 获取查验状态 + List ids = page.getRecords().stream().map(item -> item.getId() + "").collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(ids)) { + List inspectStatusStatus = openApi.getInspectStatusStatus(ids); + Map collect = inspectStatusStatus.stream().collect(Collectors.toMap(InspectStatusResp::getApplyId, InspectStatusResp::getInspectionStatusNm)); + page.getRecords().forEach(item -> { + if (collect.containsKey(item.getId()+"")) { + item.setApiInspectStatus(collect.get(item.getId()+"")); + } + }); + } + return ResultUtil.success(page); + } + + /** + * 新增 + * + * @param form + * @return + */ + @ApiOperation("新增") + @PostMapping("/add") + public Result save(@RequestBody @Validated(ValidationGroup.insert.class) ExportInspectVo form) { + if (CollectionUtils.isNotEmpty(form.getCargos())) { + List repeat = form.getCargos().stream().collect(Collectors.groupingBy(ExportInspectCargoVo::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复"); + } + } + + String batchNo = customerService.getSequenceNo("inspect_in_batch_no", "出口查验", "CI"); + // 表单验证以及格式转换 + CustomerExportInspect exportInspect = PoMapper.instance.exportInspectVo2Entity(form); + exportInspect.setInspectStatus(InspectStatusEnum.NO_INSPECT); + exportInspect.setBatchNo(batchNo); + exportInspect.setApplicantId(UserContext.getUser().getUserId()); + exportInspect.setTradType("I"); + exportInspect.setCheckStatus(AuditEnum.SUBMIT); + exportInspect.setTermcd(exportInspect.getPortAreaId()); + exportInspect.setApplyTime(new Date()); + + List cargos = form.getCargos().stream().map(item -> { + CustomerExportInspectCargo entity = PoMapper.instance.exportInspectCargoVo2Entity(item); + return entity; + }).collect(Collectors.toList()); + + Long id = customerService.saveExportInspect(exportInspect, cargos); + + return ResultUtil.success(String.valueOf(id)); + } + + /** + * @param ids + * @return + */ + @ApiOperation("提交审核") + @PostMapping("/submit-check") + public Result submitCheck(@RequestBody + @NotNull(message = "请传入要审核的海关查验ID") + @Size(min = 1, message = "ID列表不能为空") List ids) { + customerExportInspectService.lambdaUpdate().set(CustomerExportInspect::getCheckStatus, AuditEnum.AUDIT) + .set(CustomerExportInspect::getCheckReason, null).in(CustomerExportInspect::getId, ids).update(); + return ResultUtil.success("success"); + } + + /** + * 删除 + * + * @param id + * @return + */ + @ApiOperation("删除") + @PostMapping("/del") + public Result delete(@RequestParam @NotNull(message = "请传入要删除的出口进场ID") Long id) { + customerService.delExportInspect(id); + return ResultUtil.success("success"); + } + + @ApiOperation("审核端编辑") + @PostMapping("/checker/edit") + // 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法 + public Result edit(@RequestBody @Validated(ValidationGroup.update.class) ExportInspectVo form) { + return this.edit(true, form); + } + + /** + * 编辑 + * + * @param form + * @return + */ + @ApiOperation("编辑") + @PostMapping("/edit") + // 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法 + public Result edit(@RequestParam(required = false, defaultValue = "false")Boolean flag, + @RequestBody @Validated(ValidationGroup.update.class) ExportInspectVo form) { + if (CollectionUtils.isNotEmpty(form.getCargos())) { + List repeat = form.getCargos().stream().collect(Collectors.groupingBy(ExportInspectCargoVo::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复"); + } + } + + CustomerExportInspect cei = customerExportInspectService.getById(form.getId()); + if (cei.getCheckStatus() == AuditEnum.AUDIT_PASS) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "审核通过之后不能进行编辑"); + } + String batchNo = cei.getBatchNo(); + // 表单验证以及格式转换 + CustomerExportInspect exportInspect = PoMapper.instance.exportInspectVo2Entity(form); + exportInspect.setBatchNo(batchNo); + exportInspect.setTermcd(exportInspect.getPortAreaId()); + exportInspect.setTradType("I"); + if (!flag) { + exportInspect.setCheckStatus(AuditEnum.SUBMIT); + } else { + exportInspect.setCheckStatus(AuditEnum.AUDIT); + } + + List cargos = form.getCargos().stream().map(item -> { + CustomerExportInspectCargo entity = PoMapper.instance.exportInspectCargoVo2Entity(item); + return entity; + }).collect(Collectors.toList()); + customerService.updateExportInspect(false, exportInspect, cargos); + + return ResultUtil.success(String.valueOf(exportInspect.getId())); + } + + /** + * 详情 + * + * @param id + * @return + */ + @ApiOperation("详情") + @PostMapping("/detail") + public Result detail(@RequestParam @NotNull(message = "请传入要获取的出口进场ID") Long id) { + CustomerExportInspect exportInspect = customerExportInspectService.getById(id); + + if (exportInspect == null) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "id:" + id + "不存在"); + } + + customerService.wrapperEntity(exportInspect); + List cargos = customerExportInspectCargoService.list(new LambdaQueryWrapper().eq(CustomerExportInspectCargo::getExportInspectId, id)); + customerService.wrapperEntity(cargos); + + exportInspect.setCargos(cargos); + + return ResultUtil.success(exportInspect); + } + + @ApiOperation("批量获取详情") + @PostMapping("/batch/detail") + public Result> getBatchDetail(@RequestBody @NotNull(message = "请传入ID列表") @Size(min = 1, message = "请传入ID列表") List ids) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.in(CustomerExportInspect::getId, ids); + + List exportInspectList = customerExportInspectService.list(query); + + if (CollectionUtils.isEmpty(exportInspectList)) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "传入ID列表不存在"); + } + + for (CustomerExportInspect exportInspect : exportInspectList) { + + customerService.wrapperEntity(exportInspect); + + List cargos = customerExportInspectCargoService.list(new LambdaQueryWrapper().eq(CustomerExportInspectCargo::getExportInspectId, exportInspect.getId())); + + customerService.wrapperEntity(cargos); + + exportInspect.setCargos(cargos); + } + + return ResultUtil.success(exportInspectList); + } + + @ApiOperation("货物明细分页列表") + @PostMapping("/cargos/page") + public Result> cargoList(@RequestBody @Validated(ValidationGroup.update.class) CargoQuery query) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + queryWrapper.eq(query.getId() != null, CustomerExportInspectCargo::getExportInspectId, query.getId()); + if (query.getCargoType() != null) { + queryWrapper.eq(query.getCargoType() != null, CustomerExportInspectCargo::getCargoType, query.getCargoType()); + } + Page page = customerExportInspectCargoService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + return ResultUtil.success(page); + } + + @ApiOperation("出口查验审核货物详情") + @PostMapping("/check/detail") + public Result checkDetail(@RequestParam @NotBlank(message = "提单号不能为空") String billNo) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CustomerExportInspect::getBillNo, billNo); + CustomerExportInspect exportInspect = customerExportInspectService.getOne(query, false); + + if (exportInspect == null) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "提单号:" + billNo + "不存在"); + } + + customerService.wrapperEntity(exportInspect); + + List cargos = customerExportInspectCargoService.list(new LambdaQueryWrapper().eq(CustomerExportInspectCargo::getExportInspectId, exportInspect.getId())); + + customerService.wrapperEntity(cargos); + + exportInspect.setCargos(cargos); + + return ResultUtil.success(exportInspect); + } + + /** + * 审核 + * + * @param check + * @return + */ + @ApiOperation("审核") + @PostMapping("/check") + public Result check(@RequestBody @Validated(ValidationGroup.insert.class) ExportInspectCheckVo check) throws Exception { + List checks = new ArrayList<>(); + for (Long id : check.getIds()) { + CustomerExportInspect exportIn = PoMapper.instance.exportInspectCheckVo2Entity(check); + exportIn.setCheckManId(UserContext.getUser().getUserId()); + exportIn.setCheckTime(new Date()); + exportIn.setId(id); + checks.add(exportIn); + } + + boolean row = customerExportInspectService.updateBatchById(checks); + if (row) { + List list = customerExportInspectService.lambdaQuery().in(CustomerExportInspect::getId, check.getIds()).list(); + + // 记录日志 + for (CustomerExportInspect record : list) { + LogRecordDTO log = new LogRecordDTO(); + + ImportInspectLog importInspectLog = PoMapper.instance.exportInspect2Import(record); + + log.setOperateData(importInspectLog); + log.setStatus(check.getCheckStatus() == AuditEnum.AUDIT_PASS ? 0 : 1); + log.setOperateTime(new Date()); + log.setUserId(SecurityUtils.getUserId()); + log.setUserName(SecurityUtils.getUserName()); + EsLogApprovalUtil.writeLog(log); + } + + return ResultUtil.success("success"); + } + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败,ID不存在"); + } + + /** + * 取消审核 + * + * @param check + * @return + */ + @ApiOperation("取消审核") + @PostMapping("/cancel-check") + public Result cancelCheck(@RequestBody @Validated(ValidationGroup.update.class) ExportInspectCheckVo check) { + List checks = new ArrayList<>(); + for (Long id : check.getIds()) { + CustomerExportInspect exportIn = PoMapper.instance.exportInspectCheckVo2Entity(check); + exportIn.setCheckTime(new Date()); + exportIn.setCheckManId(UserContext.getUser().getUserId()); + exportIn.setId(id); + exportIn.setCheckStatus(AuditEnum.AUDIT); + checks.add(exportIn); + } + + boolean row = customerExportInspectService.updateBatchById(checks); + if (row) { + return ResultUtil.success("success"); + } + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败,ID不存在"); + } +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ImportTakeHandler.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ImportTakeHandler.java new file mode 100644 index 0000000..d5c7874 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ImportTakeHandler.java @@ -0,0 +1,482 @@ +package com.haitonggauto.rtosc.handler; + +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.dto.BillInfoDTO; +import com.haitonggauto.rtosc.api.dto.ImportTakeShipVo; +import com.haitonggauto.rtosc.api.dto.ImportTakeVoyageVo; +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.ResultUtil; +import com.haitonggauto.rtosc.common.utils.ValidationGroup; +import com.haitonggauto.rtosc.dto.*; +import com.haitonggauto.rtosc.handler.mapper.PoMapper; +import com.haitonggauto.rtosc.query.CargoQuery; +import com.haitonggauto.rtosc.repository.query.ImportTakeQuery; +import com.haitonggauto.rtosc.repository.entity.*; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.haitonggauto.rtosc.repository.service.*; +import com.haitonggauto.rtosc.service.CustomerService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.*; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("/it") +@Api(tags = "进口提货") +@Validated +public class ImportTakeHandler implements BaseHandler { + + @Resource + private CustomerService customerService; + + @Resource + private CustomerImportTakeService importTakeService; + + @Resource + private CustomerImportTakeCargoService importTakeCargoService; + + @Resource + private CustomerImportTakeJobService importTakeJobService; + + @Resource + private NuzarOpenApi openApi; + + @ApiOperation("船名航次模糊匹配") + @PostMapping("/shipVoyage") + public Result> getExportInShipNameList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) String q) { + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct ship_id, ship_name, ship_en_name, voyage_id, voyage"); + 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); + wrapper.or().like("voyage", q); + }); + } + + Page page = importTakeService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(tmp -> { + ShipVoyageVo vo = new ShipVoyageVo(); + vo.setShipId(tmp.getShipId()); + vo.setShipName(tmp.getShipName()); + vo.setShipEnName(tmp.getShipEnName()); + vo.setVoyageId(tmp.getVoyageId()); + vo.setVoyage(tmp.getVoyage()); + return vo; + }).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getSize())); + } + + @ApiOperation("提单号模糊匹配") + @PostMapping("/billNo/query") + public Result> getExportInBillNoList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) @NotBlank(message = "船名不能为空") String shipName, + @RequestParam(required = false) @NotBlank(message = "航次不能为空") String voyage, + @RequestParam(required = false) String q) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + if (StringUtils.isNotEmpty(q)) { + query.like(CustomerImportTakeCargo::getBillNo, q); // 提单号 + } + query.exists("select id from customer_import_take where customer_import_take.id = customer_import_take_cargo.import_take_id and customer_import_take.ship_name={0} and customer_import_take.voyage={1}", shipName, voyage); + + Page page = importTakeCargoService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(item -> item.getBillNo()).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + // 进口提货申请船名 + @ApiOperation("场地确认船名") + @PostMapping("/selectShip") + public Result> getImportTakeShipList(@RequestParam(value = "key", required = false) String key) { + return ResultUtil.success(openApi.getImportTakeShipList(key)); + } + + // 进口提货申请航次 + @ApiOperation("场地确认航次") + @PostMapping("/selectVoyages") + public Result> getImportTakeVoyageList(@RequestParam(value = "spmId", required = false) String spmId, + @RequestParam(value = "key", required = false) String key) { + return ResultUtil.success(openApi.getImportTakeVoyageList(spmId, key)); + } + + // 根据航次ID查询提单信息 + @ApiOperation("根据航次ID查询提单信息") + @PostMapping("/billInfo") + public Result> getBillInfo(@RequestParam("vvyId") String vvyId) { + return ResultUtil.success(openApi.getBillInfo(vvyId)); + } + + /** + * 分页查询 + * + * @param query + * @return + */ + @ApiOperation("条件分页查询") + @PostMapping("/query-list") + public Result> query(@RequestBody ImportTakeQuery query) { + query.setCreateBy(UserContext.getUser().getUserId()); + IPage page = importTakeCargoService.getImportTakeCargoPage(new Page<>(query.getPage(), query.getRows()), query); + customerService.wrapperEntity(page.getRecords()); + return ResultUtil.success(page); + } + + @ApiOperation("审核列表查询") + @PostMapping("/check/list") + public Result> checkList(@RequestBody ImportTakeQuery query) { + if (query.getCheckStatus() == null) { + query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); + } + IPage page = importTakeCargoService.getImportTakeCargoPage(new Page<>(query.getPage(), query.getRows()), query); + customerService.wrapperEntity(page.getRecords()); + return ResultUtil.success(page); + } + + /** + * 新增 + * + * @param form + * @return 要求: + */ + @ApiOperation("新增") + @PostMapping("/add") + public Result save(@RequestBody @Validated(ValidationGroup.insert.class) ImportTakeVo form) { + // TODO +// 2.如果有查验计划(审核通过的查验计划),必须查验完成才能进行提货申请 +// 3.提货数量为场地确认后的未申请过的在场货的数量 +// 4.必须时放关的才能进行提货申请 +// 5.如果先提交了提货申请,后进行了舱单的抵补,需要新提交一次提货申请,提单号的数量=修改后数量-之前已申请的数量 + + String batchNo = customerService.getSequenceNo("import_take_batch_no", "进口提货", "IT"); + // 表单验证以及格式转换 + CustomerImportTake importTake = PoMapper.instance.importTakeVo2Entity(form); + importTake.setBatchNo(batchNo); + importTake.setApplicantId(UserContext.getUser().getUserId()); + importTake.setTermcd(form.getPortAreaId()); + importTake.setApplyTime(new Date()); + + List cargos = form.getCargos().stream().map(item -> { + CustomerImportTakeCargo entity = PoMapper.instance.importTakeCargoVo2Entity(item); + entity.setTermcd(form.getPortAreaId()); + entity.setCheckStatus(AuditEnum.AUDIT); + return entity; + }).collect(Collectors.toList()); + + List jobs = form.getJobs().stream().map(item -> { + CustomerImportTakeJob entity = PoMapper.instance.importTakeJobVo2Entity(item); + entity.setTermcd(form.getPortAreaId()); + return entity; + }).collect(Collectors.toList()); + + + Long id = customerService.saveImportTake(importTake, cargos, jobs); + + return ResultUtil.success(String.valueOf(id)); + } + + @ApiOperation("提交审核") + @PostMapping("/submit-check") + public Result submitCheck(@RequestBody + @NotNull(message = "请传入要审核的出口进场ID") + @Size(min = 1, message = "ID列表不能为空") List ids) { + importTakeCargoService.lambdaUpdate().set(CustomerImportTakeCargo::getCheckStatus, AuditEnum.AUDIT) + .set(CustomerImportTakeCargo::getCheckResult, null).in(CustomerImportTakeCargo::getId, ids).update(); + return ResultUtil.success("success"); + } + + /** + * 删除 + * + * @param id + * @return + */ + @ApiOperation("删除") + @PostMapping("/del") + public Result delete(@RequestParam @NotNull(message = "请传入要删除的ID") Long id) { + customerService.delImportTake(id); + return ResultUtil.success("success"); + } + + @ApiOperation("审核端编辑") + @PostMapping("/checker/edit") + // 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法 + public Result edit(@RequestBody @Validated(ValidationGroup.update.class) ImportTakeVo form) { + return this.edit(true, form); + } + + /** + * 编辑 + * + * @param form + * @return + */ + @ApiOperation("编辑") + @PostMapping("/edit") + // 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法 + public Result edit(@RequestParam(required = false, defaultValue = "false")Boolean flag, + @RequestBody @Validated(ValidationGroup.update.class) ImportTakeVo form) { + CustomerImportTake take = importTakeService.getById(form.getId()); + String batchNo = take.getBatchNo(); + // 表单验证以及格式转换 + CustomerImportTake importTake = PoMapper.instance.importTakeVo2Entity(form); + importTake.setBatchNo(batchNo); + + List cargos = form.getCargos().stream().map(item -> { + CustomerImportTakeCargo entity = PoMapper.instance.importTakeCargoVo2Entity(item); + entity.setTermcd(form.getPortAreaId()); + if (!flag) { + entity.setCheckStatus(AuditEnum.SUBMIT); + } else { + entity.setCheckStatus(AuditEnum.AUDIT); + } + return entity; + }).collect(Collectors.toList()); + + List jobs = form.getJobs().stream().map(item -> { + CustomerImportTakeJob entity = PoMapper.instance.importTakeJobVo2Entity(item); + entity.setTermcd(form.getPortAreaId()); + return entity; + }).collect(Collectors.toList()); + + customerService.updateImportTake(false, importTake, cargos, jobs); + + return ResultUtil.success(String.valueOf(importTake.getId())); + } + + /** + * 详情 + * + * @param id + * @return + */ + @ApiOperation("详情") + @PostMapping("/detail") + public Result detail(@RequestParam @NotNull(message = "请传入要获取ID") Long id) { + CustomerImportTake importTake = importTakeService.getById(id); + + if (importTake == null) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "id:" + id + "不存在"); + } + + customerService.wrapperEntity(importTake); + + List jobs = importTakeJobService.list(new LambdaQueryWrapper().eq(CustomerImportTakeJob::getImportTakeId, id)); + + customerService.wrapperEntity(jobs); + + List cargos = importTakeCargoService.list(new LambdaQueryWrapper().eq(CustomerImportTakeCargo::getImportTakeId, id)); + + customerService.wrapperEntity(cargos); + + importTake.setJobs(jobs); + importTake.setCargos(cargos); + + return ResultUtil.success(importTake); + } + + @ApiOperation("货物明细分页列表") + @PostMapping("/cargos/page") + public Result> cargoList(@RequestBody @Validated(ValidationGroup.update.class) CargoQuery query) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + queryWrapper.eq(query.getId() != null, CustomerImportTakeCargo::getImportTakeId, query.getId()); + if (query.getCargoType() != null) { + queryWrapper.eq(query.getCargoType() != null, CustomerImportTakeCargo::getCargoType, query.getCargoType()); + } + Page page = importTakeCargoService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + return ResultUtil.success(page); + } + + /** + * 审核 + * + * @param check + * @return + */ + @ApiOperation("审核") + @PostMapping("/check") + public Result check(@RequestBody @Validated(ValidationGroup.insert.class) ImportTakeCheckVo check) { + List importTakes = new ArrayList<>(); + for (Long id : check.getIds()) { + CustomerImportTakeCargo importTake = PoMapper.instance.importTakeCheckVo2Entity(check); + importTake.setCheckManId(UserContext.getUser().getUserId()); + importTake.setCheckTime(new Date()); + importTake.setId(id); + importTakes.add(importTake); + } + + boolean row = importTakeCargoService.updateBatchById(importTakes); + if (row) { + return ResultUtil.success("success"); + } + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败,ID不存在"); + } + + /** + * @param check + * @return + */ + @ApiOperation("取消审核") + @PostMapping("/cancel-check") + public Result cancelCheck(@RequestBody @Validated(ValidationGroup.update.class) ImportTakeCheckVo check) { + List importTakes = new ArrayList<>(); + for (Long id : check.getIds()) { + CustomerImportTakeCargo importTake = PoMapper.instance.importTakeCheckVo2Entity(check); + importTake.setCheckTime(new Date()); + importTake.setCheckManId(UserContext.getUser().getUserId()); + importTake.setId(id); + importTake.setCheckStatus(AuditEnum.AUDIT); + importTakes.add(importTake); + } + + boolean row = importTakeCargoService.updateBatchById(importTakes); + if (row) { + return ResultUtil.success("success"); + } + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败,ID不存在"); + } + + @ApiOperation("进口提货港区") + @PostMapping("/plan/port") + public Result> getPlanPortList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) String q) { + List rst = new ArrayList<>(); + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct port_area_id, port_area"); + query.exists("select id from customer_import_take_cargo where customer_import_take_cargo.import_take_id=customer_import_take.id and check_status={0}", AuditEnum.AUDIT_PASS); + if (StringUtils.isNotEmpty(q)) { + query.like("port_area", q); + } + + Page page = importTakeService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getPortAreaId()); + dto.setText(item.getPortArea()); + return dto; + }).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + @ApiOperation("进口提货船名航次") + @PostMapping("/plan/ship") + public Result> getPlanShipList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) String q) { + List rst = new ArrayList<>(); + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct ship_id, ship_name, ship_en_name, voyage_id, voyage"); + query.exists("select id from customer_import_take_cargo where customer_import_take_cargo.import_take_id=customer_import_take.id and check_status={0}", AuditEnum.AUDIT_PASS); + if (StringUtils.isNotEmpty(q)) { + query.and((wrapper) -> { + wrapper.like("ship_name", q); + wrapper.or().like("ship_en_name", q); + wrapper.or().like("voyage", q); + }); + } + + Page page = importTakeService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + rst = list.stream().map(item -> { + ShipVoyageVo dto = new ShipVoyageVo(); + dto.setShipId(item.getShipId()); + dto.setShipName(item.getShipName()); + dto.setShipEnName(item.getShipEnName()); + dto.setVoyageId(item.getVoyageId()); + dto.setVoyage(item.getVoyage()); + return dto; + }).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + @ApiOperation("进口提货航次") + @PostMapping("/plan/voyage") + public Result> getPlanVoyageList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) @NotBlank(message = "船名不能为空") String shipName, + @RequestParam(required = false) String q) { + List rst = new ArrayList<>(); + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct voyage_id, voyage"); + query.eq("ship_name", shipName); + query.exists("select id from customer_import_take_cargo where customer_import_take_cargo.import_take_id=customer_import_take.id and check_status={0}", AuditEnum.AUDIT_PASS); + if (StringUtils.isNotEmpty(q)) { + query.like("voyage", q); + } + + Page page = importTakeService.page(new Page<>(current, size), query); + List list = page.getRecords(); + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getVoyageId()); + dto.setText(item.getVoyage()); + return dto; + }).filter(item -> item != null).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + // 品牌 + @ApiOperation("进口提货品牌") + @PostMapping("/voyage/brand") + public Result> getVoyageBrandList( + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) String q) { + List rst = new ArrayList<>(); + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct brand_id, brand"); + query.eq("check_status", AuditEnum.AUDIT_PASS); + if (StringUtils.isNotEmpty(q)) { + query.like("brand", q); + } + + Page page = importTakeCargoService.page(new Page<>(current, size), query); + List list = page.getRecords(); + rst = list.stream().map(item -> { + DictDTO dto = new DictDTO(); + dto.setId(item.getBrandId()); + dto.setId(item.getBrand()); + return dto; + }).filter(item -> item != null).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ImportUnloadHandler.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ImportUnloadHandler.java new file mode 100644 index 0000000..91b8bf7 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/ImportUnloadHandler.java @@ -0,0 +1,735 @@ +package com.haitonggauto.rtosc.handler; + +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.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; +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.dto.VinStatusRequest; +import com.haitonggauto.rtosc.api.dto.WorkStatusDTO; +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.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.*; +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.ImportUnloadQuery; +import com.haitonggauto.rtosc.repository.entity.*; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.haitonggauto.rtosc.repository.service.*; +import com.haitonggauto.rtosc.service.CustomerService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.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.NotNull; +import javax.validation.constraints.Size; +import java.io.IOException; +import java.io.OutputStream; +import java.net.URLEncoder; +import java.util.*; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("/iu") +@Api(tags = "进口卸船") +@Validated +public class ImportUnloadHandler implements BaseHandler { + + @Resource + private CustomerService customerService; + + @Resource + private CustomerImportUnloadService customerImportUnloadService; + + @Resource + private CustomerImportUnloadCargoService customerImportUnloadCargoService; + + @Resource + private DictHandler dictHandler; + + @Resource + private NuzarOpenApi openApi; + + @ApiOperation("船名航次模糊匹配") + @PostMapping("/shipVoyage") + public Result> getExportInShipNameList( + @RequestParam(required = false, defaultValue = "W") String tradType, + @RequestParam(required = false, defaultValue = "1") Integer current, + @RequestParam(required = false, defaultValue = "10") Integer size, + @RequestParam(required = false) String q) { + QueryWrapper query = new QueryWrapper<>(); + query.select("distinct ship_id, ship_name, ship_en_name, voyage_id, voyage"); + query.eq("create_by", UserContext.getUser().getUserId()); + query.eq("trad_type", tradType); + if (StringUtils.isNotEmpty(q)) { + query.and((wrapper) -> { + wrapper.like("ship_name", q); + wrapper.or().like("ship_en_name", q); + wrapper.or().like("voyage", q); + }); + } + + Page page = customerImportUnloadService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(tmp -> { + ShipVoyageVo vo = new ShipVoyageVo(); + vo.setShipId(tmp.getShipId()); + vo.setShipName(tmp.getShipName()); + vo.setShipEnName(tmp.getShipEnName()); + vo.setVoyageId(tmp.getVoyageId()); + vo.setVoyage(tmp.getVoyage()); + return vo; + }).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + + } + + @ApiOperation("提单号模糊匹配") + @PostMapping("/billNo/query") + public Result> getExportInBillNoList( + @RequestParam(required = false, defaultValue = "W") String tradType, + @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 query = new LambdaQueryWrapper<>(); + query.eq(StringUtils.isNotEmpty(shipName), CustomerImportUnload::getShipName, shipName); + query.eq(StringUtils.isNotEmpty(voyage), CustomerImportUnload::getVoyage, voyage); + query.eq(CustomerImportUnload::getTradType, tradType); + if (StringUtils.isNotEmpty(q)) { + query.like(CustomerImportUnload::getBillNo, q); // 提单号 + } + + Page page = customerImportUnloadService.page(new Page<>(current, size), query); + List list = page.getRecords(); + + List rst = list.stream().map(item -> item.getBillNo()).collect(Collectors.toList()); + + return ResultUtil.success(rst, String.valueOf(page.getTotal())); + } + + /** + * 分页查询 + * + * @param query + * @return + */ + @ApiOperation("条件分页查询") + @PostMapping("/query-list") + public Result> query(@RequestBody ImportUnloadQuery query) { + query.setCreateBy(UserContext.getUser().getUserId()); + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerImportUnload.class, query); + Page page = customerImportUnloadService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + return ResultUtil.success(page); + } + + @ApiOperation("审核端条件分页查询") + @PostMapping("/audit/query-list") + public Result> auditQuery(@RequestBody ImportUnloadQuery query) { + if (query.getCheckStatus() == null) { + query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); + } + Wrapper queryWrapper = new WrapperKit() { + }.changeBaseQueryToWrapper(CustomerImportUnload.class, query); + Page page = customerImportUnloadService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + return ResultUtil.success(page); + } + + @ApiOperation("提交审核") + @PostMapping("/submit-check") + public Result submitCheck(@RequestBody + @NotNull(message = "请传入要审核的ID列表") + @Size(min = 1, message = "ID列表不能为空") List ids) { + customerImportUnloadService.lambdaUpdate().set(CustomerImportUnload::getCheckStatus, AuditEnum.AUDIT) + .set(CustomerImportUnload::getCheckResult, null).in(CustomerImportUnload::getId, ids).update(); + return ResultUtil.success("success"); + } + + /** + * 删除 + * + * @param id + * @return + */ + @ApiOperation("删除") + @PostMapping("/del") + public Result delete(@RequestParam @NotNull(message = "请传入要删除的ID") Long id) { + customerService.delImportUnload(id); + return ResultUtil.success("success"); + } + + @ApiOperation("取消/恢复车架号") + @PostMapping("/recover/vin") + @Transactional(rollbackFor = {Exception.class}) + public Result recoverVin(@RequestBody @Validated(ValidationGroup.update.class) CargoStatusVo form) { + // 修改 装船的数据 + // 查询出货物列表 + List list = customerImportUnloadCargoService.lambdaQuery() + .exists("select id from customer_import_unload where customer_import_unload.id = customer_import_unload_cargo.import_unload_id and check_status={0} and ship_id={1} and voyage_id={2} and bill_no={3}", AuditEnum.AUDIT_PASS, form.getShipId(), form.getVoyageId(), form.getBillNo()) + .list(); + // 转成MAP + Map collect = list.stream().collect(Collectors.toMap(CustomerImportUnloadCargo::getVin, item->item)); + // 找出状态不一致的,(有些情况下可能会出现本来是正常的,传进来的也是正常) + Map> listMap = form.getVins().stream().filter(item -> collect.containsKey(item.getVin())).filter(item -> item.getStatus() != collect.get(item.getVin()).getVinStatus()) + .collect(Collectors.groupingBy(CargoStatus::getStatus)); + + if (listMap.containsKey(0)) { // 代表取消 + listMap.get(0).stream().map(item -> collect.get(item.getVin())) // 找到数据库中的明细 + .collect(Collectors.groupingBy(CustomerImportUnloadCargo::getImportUnloadId)) // 按主表ID进行分组 + .entrySet().stream().forEach(entry -> { + // 修改进场数量,和数量 + Map collect1 = entry.getValue().stream().map(item -> collect.get(item.getVin())).collect(Collectors.groupingBy(CustomerImportUnloadCargo::getCargoType, Collectors.counting())); + if (collect1.containsKey(0)) { // 车辆 + customerImportUnloadService.update().setSql("quantity=quantity-" + collect1.get(0)) + .eq("id", entry.getKey()).update(); + } + if (collect1.containsKey(1)) { // 备件 + customerImportUnloadService.update().setSql("spare_quantity=spare_quantity-" + collect1.get(1)) + .eq("id", entry.getKey()).update(); + } + }); + } else if (listMap.containsKey(1)) { // 代表恢复 + listMap.get(1).stream().map(item -> collect.get(item.getVin())) // 找到数据库中的明细 + .collect(Collectors.groupingBy(CustomerImportUnloadCargo::getImportUnloadId)) // 按主表ID进行分组 + .entrySet().stream().forEach(entry -> { + // 修改进场数量,和数量 + Map collect1 = entry.getValue().stream().map(item -> collect.get(item.getVin())).collect(Collectors.groupingBy(CustomerImportUnloadCargo::getCargoType, Collectors.counting())); + if (collect1.containsKey(0)) { // 车辆 + customerImportUnloadService.update().setSql("quantity=quantity+" + collect1.get(0)) + .eq("id", entry.getKey()).update(); + } + if (collect1.containsKey(1)) { // 备件 + customerImportUnloadService.update().setSql("spare_quantity=spare_quantity+" + collect1.get(1)) + .eq("id", entry.getKey()).update(); + } + }); + } + + // 批量修改车辆的状态 + List update = new ArrayList<>(); + listMap.entrySet().stream().forEach(item -> { + update.addAll(item.getValue().stream().map(p -> { + CustomerImportUnloadCargo cargo = collect.get(p.getVin()); + cargo.setVinStatus(item.getKey()); + return cargo; + }).collect(Collectors.toList())); + }); + customerImportUnloadCargoService.updateBatchById(update); + + return ResultUtil.success("success"); + } + + /** + * 详情 + * + * @param id + * @return + */ + @ApiOperation("详情") + @PostMapping("/detail") + public Result detail(@RequestParam @NotNull(message = "请传入要获取的ID") Long id) { + CustomerImportUnload importUnload = customerImportUnloadService.getById(id); + + if (importUnload == null) { + return ResultUtil.failure(ErrorType.PROGRAM_ERROR.id(), "id:" + id + "不存在"); + } + + customerService.wrapperEntity(importUnload); + + List cargos = customerImportUnloadCargoService.list(new LambdaQueryWrapper().eq(CustomerImportUnloadCargo::getImportUnloadId, id)); + + customerService.wrapperEntity(cargos); + + importUnload.setCargos(cargos); + + return ResultUtil.success(importUnload); + } + + @ApiOperation("货物明细分页列表") + @PostMapping("/cargos/page") + public Result> cargoList(@RequestBody @Validated(ValidationGroup.update.class) CargoQuery query) { + CustomerImportUnload exportLoad = customerImportUnloadService.getById(query.getId()); + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + queryWrapper.eq(query.getId() != null, CustomerImportUnloadCargo::getImportUnloadId, query.getId()); + if (query.getCargoType() != null) { + queryWrapper.eq(query.getCargoType() != null, CustomerImportUnloadCargo::getCargoType, query.getCargoType()); + } + Page page = customerImportUnloadCargoService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); + customerService.wrapperEntity(page.getRecords()); + // 获取作业状态 + Map collect = null; + List vins = page.getRecords().stream().map(item -> item.getVin()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(vins)) { + VinStatusRequest req = new VinStatusRequest(); + req.setBusinessType("UNLOAD"); + req.setImportExportType("I"); + req.setVinCodeList(vins); + req.setVvyId(exportLoad.getVoyageId()); + List status = openApi.getVinStatus(req); + collect = status.stream().collect(Collectors.toMap(WorkStatusDTO::getVinCode, WorkStatusDTO::getWorkStatus)); + } + if (MapUtils.isNotEmpty(collect)) { + for (CustomerImportUnloadCargo cargo : page.getRecords()) { + cargo.setWorkStatus(collect.get(cargo.getVin())); + } + } + + return ResultUtil.success(page); + } + + /** + * 审核 + * + * @param check + * @return + */ + @ApiOperation("审核") + @PostMapping("/check") + public Result check(@RequestBody @Validated(ValidationGroup.insert.class) ImportUnloadCheckVo check) { + List importUnloads = new ArrayList<>(); + for (Long id : check.getIds()) { + CustomerImportUnload importUnload = PoMapper.instance.importUnloadCheckVo2Entity(check); + importUnload.setCheckManId(UserContext.getUser().getUserId()); + importUnload.setCheckTime(new Date()); + importUnload.setId(id); + importUnloads.add(importUnload); + } + + boolean row = customerImportUnloadService.updateBatchById(importUnloads); + if (row) { + return ResultUtil.success("success"); + } + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败,ID不存在"); + } + + /** + * @param check + * @return + */ + @ApiOperation("取消审核") + @PostMapping("/cancel-check") + public Result cancelCheck(@RequestBody @Validated(ValidationGroup.update.class) ImportUnloadCheckVo check) { + List importUnloads = new ArrayList<>(); + for (Long id : check.getIds()) { + CustomerImportUnload importUnload = PoMapper.instance.importUnloadCheckVo2Entity(check); + importUnload.setCheckManId(UserContext.getUser().getUserId()); + importUnload.setCheckTime(new Date()); + importUnload.setId(id); + importUnload.setCheckStatus(AuditEnum.AUDIT); + importUnloads.add(importUnload); + } + + boolean row = customerImportUnloadService.updateBatchById(importUnloads); + if (row) { + return ResultUtil.success("success"); + } + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "修改失败,ID不存在"); + } + + @ApiOperation("整船车辆导入模板下载") + @GetMapping("/temp/down/vin") + public void tmpDownVin(HttpServletResponse response) throws Exception { + 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("整船车辆导入模板", "UTF-8"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + + excelWriter = EasyExcel.write(out).build(); + + WriteSheet writeSheet = EasyExcel.writerSheet(0, "整船车辆导入模板").head(ImportUnloadExcel.class).build(); + + // 查询数据 + List rows = new ArrayList<>(); + + 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(); + } + } + } + } + + @ApiOperation("整船车辆导入") + @PostMapping("/import-to-add") + public Result> upload(@RequestParam(required = false) @NotNull(message = "贸易类型不能为空") String tradType, MultipartFile file) throws IOException { + // 所有读取的数据 + List dataList = new ArrayList<>(); + + // 有错误的数据 + List errorDataList = new ArrayList<>(); + + EasyExcel.read(file.getInputStream(), ImportUnloadExcel.class, new ReadExcelListener() { + @Override + protected void saveData(List list) { // 保存数据 + dataList.addAll(list); + } + }).sheet().doRead(); + + ValidatorFactory vf = Validation.buildDefaultValidatorFactory(); + Validator validator = vf.getValidator(); + + List validData = new ArrayList<>(); + + // 需要保存的数据 + List saveData = new ArrayList<>(); + + // 船名基础数据 + List shipList = dictHandler.getAllShip(null).getData(); + // 品牌基础数据 + List brandList = dictHandler.getBrandList(null).getData(); + + // 数据验证 + dataList.stream().forEach(item -> { + Set> 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)) { + return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "导入失败", errorDataList); + } + + // 是否有重复的车架号 + List repeat = validData.stream().collect(Collectors.groupingBy(ImportUnloadExcel::getVin, Collectors.counting())) + .entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeat)) { + errorDataList.addAll(validData.stream().filter(p -> repeat.contains(p.getVin())).map(p -> { + JSONObject o = JSONObject.from(p); + o.put("status", "车架号重复"); + return o; + }).collect(Collectors.toList())); + 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 (brandList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getBrand())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "品牌不存在"); + errorDataList.add(o); + return; + } + // 航次必须是HT6、HTTC、HTLG中的一个,否则导入不成功,提示“航次错误 +// if (!StringUtils.equalsAnyIgnoreCase(item.getVoyage(), "HT6", "HTTC", "HTLG")) { +// JSONObject o = JSONObject.from(item); +// o.put("status", "航次错误"); +// errorDataList.add(o); +// return; +// } + + + saveData.add(item); + JSONObject o = JSONObject.from(item); + o.put("status", "导入成功"); + errorDataList.add(o); + }); + + // 首先按对船名,般次,提单, 品牌进行分组 + Map> collect = saveData.stream().collect(Collectors.groupingBy(item -> StringUtils.joinWith("#$#", item.getShipName(), item.getVoyage(), item.getBillNo(), item.getBrand()), Collectors.toList())); + collect.entrySet().forEach(item -> { + String[] keys = StringUtils.split(item.getKey(), "#$#"); + // 找到是否存在船名,航次,提单号的表头 + + String batchNo = customerService.getSequenceNo("import_unload_batch_no", "进口卸船", "iu"); + + List cargos = item.getValue().stream().map(p -> { + CustomerImportUnloadCargo cargo = new CustomerImportUnloadCargo(); + cargo.setCargoType(0); + cargo.setVinStatus(1); + cargo.setBrandId(brandList.stream().filter(s -> StringUtils.equalsIgnoreCase(s.getText(), p.getBrand())).findFirst().get().getId()); + cargo.setBrand(p.getBrand()); + cargo.setModels(p.getModels()); + cargo.setVin(p.getVin()); + return cargo; + }).collect(Collectors.toList()); + + List vins = cargos.stream().map(p -> p.getVin()).collect(Collectors.toList()); + + // 验证哪些车架号已经存在了 + List existCargos = customerImportUnloadCargoService.list(new LambdaQueryWrapper().in(CustomerImportUnloadCargo::getVin, vins)); + List existVins = existCargos.stream().map(p -> p.getVin()).collect(Collectors.toList()); + + List existData = item.getValue().stream().filter(p -> existVins.contains(p.getVin())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(existData)) { + errorDataList.addAll(item.getValue().stream().map(p -> { + JSONObject o = JSONObject.from(item); + o.put("status", "数据已存在, 未导入"); + return o; + }).collect(Collectors.toList())); + } + + errorDataList.addAll(item.getValue().stream().filter(p -> !existVins.contains(p.getVin())) + .map(p -> { + JSONObject o = JSONObject.from(item); + o.put("status", "导入成功"); + return o; + }).collect(Collectors.toList())); + + List saveCargos = cargos.stream().filter(p -> !existCargos.contains(p.getVin())).collect(Collectors.toList()); + + CustomerImportUnload importUnload = new CustomerImportUnload(); + importUnload.setShipId(shipList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), keys[0])).findFirst().get().getId()); + importUnload.setShipName(keys[0]); + importUnload.setShipEnName(shipList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), keys[0])).findFirst().get().getExtra1()); + importUnload.setVoyage(keys[1]); + importUnload.setBillNo(keys[2]); + importUnload.setBatchNo(batchNo); + importUnload.setBrandId(brandList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), keys[3])).findFirst().get().getExtra1()); + importUnload.setBrand(keys[3]); + importUnload.setQuantity(saveCargos.size()); + importUnload.setSpareQuantity(0); + importUnload.setTradType(tradType); + importUnload.setCheckStatus(AuditEnum.SUBMIT); + importUnload.setApplicantId(UserContext.getUser().getUserId()); + importUnload.setApplyTime(new Date()); + + customerService.saveImportUnload(importUnload, saveCargos); + + }); + + return ResultUtil.success(errorDataList); + } + + @ApiOperation("整船备件导入模板下载") + @GetMapping("/temp/down/spare") + public void tmpDownSpare(HttpServletResponse response) throws Exception { + 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("整船备件导入模板", "UTF-8"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + + excelWriter = EasyExcel.write(out).build(); + + WriteSheet writeSheet = EasyExcel.writerSheet(0, "整船备件导入模板").head(ImportUnloadSpareExcel.class).build(); + + // 查询数据 + List rows = new ArrayList<>(); + + 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(); + } + } + } + } + + @ApiOperation("整船备件导入") + @PostMapping("/spare/import-to-add") + public Result> spareUpload(@RequestParam @NotNull(message = "贸易类型不能为空") String tradType, MultipartFile file) throws IOException { + // 所有读取的数据 + List dataList = new ArrayList<>(); + + // 有错误的数据 + List errorDataList = new ArrayList<>(); + + EasyExcel.read(file.getInputStream(), ImportUnloadSpareExcel.class, new ReadExcelListener() { + @Override + protected void saveData(List list) { // 保存数据 + dataList.addAll(list); + } + }).sheet().doRead(); + + ValidatorFactory vf = Validation.buildDefaultValidatorFactory(); + Validator validator = vf.getValidator(); + + List validData = new ArrayList<>(); + + // 需要保存的数据 + List saveData = new ArrayList<>(); + + // 船名基础数据 + List shipList = dictHandler.getAllShip(null).getData(); + // 品牌基础数据 + List brandList = dictHandler.getBrandList(null).getData(); + + // 数据验证 + dataList.stream().forEach(item -> { + Set> 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)) { + 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 (brandList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getBrand())).count() == 0) { + JSONObject o = JSONObject.from(item); + o.put("status", "品牌不存在"); + errorDataList.add(o); + return; + } + // 航次必须是HT6、HTTC、HTLG中的一个,否则导入不成功,提示“航次错误 +// if (!StringUtils.equalsAnyIgnoreCase(item.getVoyage(), "HT6", "HTTC", "HTLG")) { +// JSONObject o = JSONObject.from(item); +// o.put("status", "航次错误"); +// errorDataList.add(o); +// return; +// } + + + saveData.add(item); + JSONObject o = JSONObject.from(item); + o.put("status", "导入成功"); + errorDataList.add(o); + }); + + // 首先按对船名,般次,提单, 品牌进行分组 + Map> collect = saveData.stream().collect(Collectors.groupingBy(item -> StringUtils.joinWith("#$#", item.getShipName(), item.getVoyage(), item.getBillNo(), item.getBrand()), Collectors.toList())); + collect.entrySet().forEach(item -> { + String[] keys = StringUtils.split(item.getKey(), "#$#"); + // 找到是否存在船名,航次,提单号的表头 + + + String batchNo = customerService.getSequenceNo("import_unload_batch_no", "进口卸船", "iu"); + + List cargos = new ArrayList<>(); + item.getValue().stream().forEach(p -> { + for (int i = 0; i < p.getNum(); i++) { + CustomerImportUnloadCargo cargo = new CustomerImportUnloadCargo(); + cargo.setCargoType(1); + cargo.setVinStatus(1); + cargo.setBrandId(brandList.stream().filter(s -> StringUtils.equalsIgnoreCase(s.getText(), p.getBrand())).findFirst().get().getId()); + cargo.setBrand(p.getBrand()); + // 生成编码 + String prefix = StringUtils.join("BJ", DateUtil.format(new Date(), "yyMMddHHmm")); + String vin = prefix + RandomUtil.randomNumbers(5); + cargo.setVin(vin); + + cargos.add(cargo); + } + }); + + errorDataList.addAll(item.getValue().stream() + .map(p -> { + JSONObject o = JSONObject.from(item); + o.put("status", "导入成功"); + return o; + }).collect(Collectors.toList())); + + List saveCargos = cargos.stream().collect(Collectors.toList()); + + CustomerImportUnload importUnload = new CustomerImportUnload(); + importUnload.setShipId(shipList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), keys[0])).findFirst().get().getId()); + importUnload.setShipName(keys[0]); + importUnload.setShipEnName(shipList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), keys[0])).findFirst().get().getExtra1()); + importUnload.setVoyage(keys[1]); + importUnload.setBillNo(keys[2]); + importUnload.setBatchNo(batchNo); + importUnload.setBrandId(brandList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), keys[3])).findFirst().get().getExtra1()); + importUnload.setBrand(keys[3]); + importUnload.setQuantity(0); + importUnload.setSpareQuantity(saveCargos.size()); + importUnload.setTradType(tradType); + importUnload.setCheckStatus(AuditEnum.SUBMIT); + importUnload.setApplicantId(UserContext.getUser().getUserId()); + importUnload.setApplyTime(new Date()); + + customerService.saveImportUnload(importUnload, saveCargos); + + }); + + return ResultUtil.success(errorDataList); + } + + @ApiOperation("更改作业状态") + @PostMapping("/update/workstatus") + public Result updateWorkStatus(@RequestBody @Validated(ValidationGroup.update.class) WorkStatusVo vo) { + customerImportUnloadCargoService.lambdaUpdate() + .set(CustomerImportUnloadCargo::getWorkStatus, vo.getWorkStatus()) + .in(CustomerImportUnloadCargo::getVin, vo.getVins()) + .update(); + return ResultUtil.success("success"); + } + +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/LoginHandler.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/LoginHandler.java new file mode 100644 index 0000000..de8f171 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/LoginHandler.java @@ -0,0 +1,107 @@ +package com.haitonggauto.rtosc.handler; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.haitonggauto.rtosc.api.NuzarOpenApi; +import com.haitonggauto.rtosc.api.dto.RegisterDTO; +import com.haitonggauto.rtosc.client.dto.UserAuthRequestDto; +import com.haitonggauto.rtosc.common.context.UserContext; +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.ResultUtil; +import com.haitonggauto.rtosc.common.utils.ValidationGroup; +import com.haitonggauto.rtosc.dto.LinkmanVo; +import com.haitonggauto.rtosc.dto.LoginDTO; +import com.haitonggauto.rtosc.handler.mapper.PoMapper; +import com.haitonggauto.rtosc.repository.entity.CustomerExportIn; +import com.haitonggauto.rtosc.repository.entity.CustomerExportInCargo; +import com.haitonggauto.rtosc.repository.entity.CustomerLinkman; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.haitonggauto.rtosc.repository.service.CustomerLinkmanService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.cloud.context.config.annotation.RefreshScope; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.List; + +/** + * 用户登录 + */ +@RestController +@Api(tags = "用户登录") +@RefreshScope +@Validated +public class LoginHandler implements BaseHandler { + + @Resource + private CustomerLinkmanService linkmanService; + + @Resource + private NuzarOpenApi openApi; + + @ApiOperation("用户注册") + @PostMapping("/register") + public Result register(@RequestBody @Validated UserAuthRequestDto user) { + RegisterDTO register = openApi.userRegister(user); + return ResultUtil.success(register.getAccessToken()); + } + + /** + * rtoswuhan 123456 + * @param login + * @return + */ + @ApiOperation("用户登录") + @PostMapping("/login") + public Result login(@RequestBody @Validated LoginDTO login) { + RegisterDTO register = openApi.userLogin(login); + return ResultUtil.success(register.getAccessToken()); + } + + // 添加联系人 + @ApiOperation("添加联系人") + @PostMapping("/user/linkman/add") + public Result addContract(@RequestBody @Validated(ValidationGroup.insert.class) LinkmanVo form) { + linkmanService.save(PoMapper.instance.linkmanVo2Entity(form)); + return ResultUtil.success("success"); + } + + @ApiOperation("编辑联系人") + @PostMapping("/user/linkman/update") + public Result updateContract(@RequestBody @Validated(ValidationGroup.insert.class) LinkmanVo form) { + linkmanService.updateById(PoMapper.instance.linkmanVo2Entity(form)); + return ResultUtil.success("success"); + } + + // 联系人列表 + @ApiOperation("联系人列表") + @PostMapping("/user/linkman/list") + public Result> listContract() { + // 查询 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CustomerLinkman::getCreateBy, UserContext.getUser().getUserId()); + return ResultUtil.success(linkmanService.list(query)); + } + + /** + * 删除 + * + * @param ids + * @return + */ + @ApiOperation("联系人删除") + @PostMapping("/user/linkman/del") + public Result delete(@RequestBody @NotNull(message = "请传入要删除的ID") @Size(min = 1, message = "请传入要删除的ID") List ids) { + linkmanService.lambdaUpdate().in(CustomerLinkman::getId, ids).remove(); + return ResultUtil.success("success"); + } +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/excel/ReadExcelListener.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/excel/ReadExcelListener.java new file mode 100644 index 0000000..35071f9 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/excel/ReadExcelListener.java @@ -0,0 +1,66 @@ +package com.haitonggauto.rtosc.handler.excel; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.read.listener.ReadListener; +import com.alibaba.excel.util.ListUtils; +import com.alibaba.fastjson2.JSON; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; + +@Slf4j +public abstract class ReadExcelListener implements ReadListener { + /** + * 每隔5条存储数据库,实际使用中可以100条,然后清理list ,方便内存回收 + */ + private static final int BATCH_COUNT = 100; + /** + * 缓存的数据 + */ + private List cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT); + + /** + * 如果使用了spring,请使用这个构造方法。每次创建Listener的时候需要把spring管理的类传进来 + * + * @param + */ + public ReadExcelListener() { + + } + + /** + * 这个每一条数据解析都会来调用 + * + * @param data one row value. Is is same as {@link AnalysisContext#readRowHolder()} + * @param context + */ + @Override + public void invoke(T data, AnalysisContext context) { + log.info("解析到一条数据:{}", JSON.toJSONString(data)); + + cachedDataList.add(data); + // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM + if (cachedDataList.size() >= BATCH_COUNT) { + saveData(cachedDataList); + // 存储完成清理 list + cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT); + } + } + + /** + * 所有数据解析完成了 都会来调用 + * + * @param context + */ + @Override + public void doAfterAllAnalysed(AnalysisContext context) { + // 这里也要保存数据,确保最后遗留的数据也存储到数据库 + saveData(cachedDataList); + log.info("所有数据解析完成!"); + } + + /** + * 加上存储数据库 + */ + protected abstract void saveData(List cachedDataList); +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/mapper/PoMapper.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/mapper/PoMapper.java new file mode 100644 index 0000000..f746ca4 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/handler/mapper/PoMapper.java @@ -0,0 +1,81 @@ +package com.haitonggauto.rtosc.handler.mapper; + +import com.haitonggauto.rtosc.api.dto.log.ImportInspectLog; +import com.haitonggauto.rtosc.excel.ExportInExcel; +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.dto.*; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface PoMapper { + PoMapper instance = Mappers.getMapper(PoMapper.class); + + // 出口进场 + CustomerExportIn exportInVo2Entity(ExportInVo dto); + + CustomerExportIn exportInCheckVo2Entity(ExportInCheckVo dto); + + CustomerExportInCargo exportInCargoVo2Entity(ExportInCargoVo dto); + + CustomerExportInTimes exportInTimesVo2Entity(ExportInTimesVo dto); + + // 出口装船 + CustomerExportLoad exportLoadVo2Entity(ExportLoadVo vo); + + CustomerExportLoadCargo exportLoadCargoVo2Entity(ExportLoadCargoVo vo); + + CustomerExportLoadCheck exportLoadCheckCargoVo2Entity(ExportLoadCheckCargoVo vo); + + // 出口查验 + CustomerExportInspect exportInspectVo2Entity(ExportInspectVo vo); + + CustomerExportInspect exportInspectCheckVo2Entity(ExportInspectCheckVo vo); + + CustomerExportInspectCargo exportInspectCargoVo2Entity(ExportInspectCargoVo vo); + + // 提离港区 + CustomerDeparture departureVo2Entity(DepartureVo vo); + + CustomerDeparture departureCheckVo2Entity(DepartureCheckVo vo); + + CustomerDepartureCargo departureCargoVo2Entity(DepartureCargoVo vo); + + CustomerDepartureDrivers departureDriverVo2Entity(DepartureDriverVo vo); + + CustomerDeparturePlan departurePlanVo2Entity(DeparturePlanVo vo); + + // 特保区 + CustomerFreeTrade freeTradeVo2Entity(FreeTradeVo vo); + + CustomerFreeTrade freeTradeCheckVo2Entity(FreeTradeCheckVo vo); + + ExportInExcel entity2Excel(CustomerExportIn entity); + + CustomerFreeTrade excel2Entity(FreeTradeExcel excel); + + @Mapping(source = "createDate", target = "createDate", dateFormat="yyyy-MM-dd HH:mm:ss") + FreeTradeExportExcel entity2Excel(CustomerFreeTrade entity); + + CustomerExportIn excel2Entity(ExportInPlanExcel excel); + + CustomerImportUnload importUnloadCheckVo2Entity(ImportUnloadCheckVo vo); + + // 进口提货 + CustomerImportTake importTakeVo2Entity(ImportTakeVo vo); + + CustomerImportTakeCargo importTakeCargoVo2Entity(ImportTakeCargoVo vo); + + CustomerImportTakeJob importTakeJobVo2Entity(ImportTakeJobVo vo); + + CustomerImportTakeCargo importTakeCheckVo2Entity(ImportTakeCheckVo vo); + + // 联系人转换 + CustomerLinkman linkmanVo2Entity(LinkmanVo vo); + + ImportInspectLog exportInspect2Import(CustomerExportInspect inspect); +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/service/CustomerService.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/service/CustomerService.java new file mode 100644 index 0000000..10da963 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/service/CustomerService.java @@ -0,0 +1,176 @@ +package com.haitonggauto.rtosc.service; + +import com.haitonggauto.rtosc.repository.entity.*; +import com.nuzar.cloud.mapper.base.EchoEntity; + +import java.util.List; + +public interface CustomerService { + + T wrapperEntity(T entity); + + + List wrapperEntity(List entity); + /** + * 序列号生成规则 + * @param code + * @param name + * @param prefix + * @return + */ + String getSequenceNo(String code, String name, String prefix); + List getSequenceNo(String code, String name, String prefix, int size); + /** + * 保存出口进场 + * @param exportIn + * @param cargos + * @param times + * @return + */ + Long saveExportIn(CustomerExportIn exportIn, List cargos, List times, List spares); + + /** + * 删除 + * @param id + */ + void delExportIn(Long id); + + /** + * 修改 + * @param exportIn + * @param cargos + * @param times + */ + void updateExportIn(Boolean imp, CustomerExportIn exportIn, List cargos, List times, List spares); + + /** + * 保存出口装船 + * @param exportLoad + * @param cargos + * @return + */ + Long saveExportLoad(CustomerExportLoad exportLoad, List cargos); + + /** + * 删除出口装船 + * @param id + */ + void delExportLoad(Long id); + + /** + * 修改出口装船 + * @param imp // 是否是导入, 导入的时候不处理删除 + * @param exportLoad + * @param cargos + */ + void updateExportLoad(Boolean imp, CustomerExportLoad exportLoad, List cargos); + + /** + * 保存提离港区申请 + * @param departure + * @param cargos + * @return + */ + Long saveDeparture(CustomerDeparture departure, List cargos, List drivers, List plans); + + /** + * 删除保存提离港区申请 + * @param id + */ + void delDeparture(Long id); + + /** + * 修改保存提离港区申请 + * @param departure + * @param cargos + */ + void updateDeparture(Boolean imp, CustomerDeparture departure, List cargos, List drivers, List plans); + + + /** + * 保存出口海关查验 + * @param inspect + * @param cargos + * @return + */ + Long saveExportInspect(CustomerExportInspect inspect, List cargos); + + /** + * 删除出口海关查验 + * @param id + */ + void delExportInspect(Long id); + + /** + * 修改出口海关查验 + * @param inspect + * @param cargos + */ + void updateExportInspect(Boolean imp, CustomerExportInspect inspect, List cargos); + + /** + * 审核 + * @param exportLoad + * @param checks + * @return + */ + boolean checkExportLoad(CustomerExportLoad exportLoad, List checks); + + /** + * 取消审核 + * @param exportLoad + * @return + */ + boolean cancelCheckExportLoad(CustomerExportLoad exportLoad); + + /** + * 导入后,通过车架号删除 + * @param vin + */ + void delExportLoadByVin(String vin); + + /** + * 删除车架号 + * @param vin + */ + void delExportInByVin(String vin); + + /** + * 删除进口卸船 + * @param id + */ + void delImportUnload(Long id); + + /** + * 出口卸船保存 + * @param importUnload + * @param cargos + * @return + */ + Long saveImportUnload(CustomerImportUnload importUnload, List cargos); + + void updateImportUnload(CustomerImportUnload importUnload, List cargos); + + /** + * 进口提货保存 + * @param importTake + * @param cargos + * @param jobs + * @return + */ + Long saveImportTake(CustomerImportTake importTake, List cargos, List jobs); + + /** + * 删除进口提货 + * @param id + */ + void delImportTake(Long id); + + /** + * 编辑进口提货 + * @param importTake + * @param cargos + * @param jobs + */ + void updateImportTake(Boolean imp, CustomerImportTake importTake, List cargos, List jobs); +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/service/impl/AuthServiceImpl.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/service/impl/AuthServiceImpl.java new file mode 100644 index 0000000..2f24388 --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/service/impl/AuthServiceImpl.java @@ -0,0 +1,9 @@ +package com.haitonggauto.rtosc.service.impl; + +import com.haitonggauto.rtosc.common.service.impl.BaseAuthServiceImpl; +import org.springframework.stereotype.Component; + +@Component +public class AuthServiceImpl extends BaseAuthServiceImpl { + +} diff --git a/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/service/impl/CustomerServiceImpl.java b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/service/impl/CustomerServiceImpl.java new file mode 100644 index 0000000..210641e --- /dev/null +++ b/nuzar-customer-controller/src/main/java/com/haitonggauto/rtosc/service/impl/CustomerServiceImpl.java @@ -0,0 +1,767 @@ +package com.haitonggauto.rtosc.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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 org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.client.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + +@Service +public class CustomerServiceImpl implements CustomerService { + + @Autowired + private CustomerExportInService exportInService; + + @Autowired + private CustomerExportInCargoService exportInCargoService; + + @Autowired + private CustomerExportInTimesService exportInTimesService; + + @Autowired + private CustomerExportLoadService exportLoadService; + + @Autowired + private CustomerExportLoadCargoService exportLoadCargoService; + + @Autowired + private CustomerExportLoadCheckService exportLoadCheckService; + + @Autowired + private CustomerDepartureService departureService; + + @Autowired + private CustomerDepartureCargoService departureCargoService; + + @Autowired + private CustomerDepartureDriversService departureDriversService; + + @Autowired + private CustomerDeparturePlanService departurePlanService; + + @Autowired + private CustomerExportInspectService exportInspectService; + + @Autowired + private CustomerExportInspectCargoService exportInspectCargoService; + + @Autowired + private SysSequenceNoService sysSequenceNoService; + + @Resource + private CustomerImportUnloadService customerImportUnloadService; + + @Resource + private CustomerImportUnloadCargoService customerImportUnloadCargoService; + + @Resource + private CustomerImportTakeService importTakeService; + + @Resource + private CustomerImportTakeCargoService importTakeCargoService; + + @Resource + private CustomerImportTakeJobService importTakeJobService; + + @Override + @EchoResult + public T wrapperEntity(T entity) { + return entity; + } + + @Override + @EchoResult + public List wrapperEntity(List entity) { + return entity; + } + + @Override + public String getSequenceNo(String code, String name, String prefix) { + return getSequenceNo(code, name, prefix, 1).get(0); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public synchronized List getSequenceNo(String code, String name, String prefix, int size) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(SysSequenceNo::getCode, code); + + SysSequenceNo sn = sysSequenceNoService.getOne(query); + + if (sn == null) { + sn = new SysSequenceNo(); + sn.setCode(code); + sn.setName(name); + sn.setSequenceType(SequenceTypeEnum.SECOND); + sn.setGenDate(new Date()); + sn.setPrefixStr(prefix); + sn.setYearLength(2); + sn.setCurValue(1L); + sn.setIncValue(1); + sn.setSequenceLength(5); + sn.setVersion(0); + } + + //判断当前的生成方式年/月/日 + SequenceTypeEnum sequenceType = sn.getSequenceType(); + Date genDate = sn.getGenDate(); + Date curDate = new Date(); + + String _prefix = sn.getPrefixStr(); + String dateStr = ""; + int yearLength = sn.getYearLength(); + + int diff = -1; + if (SequenceTypeEnum.YEAR == sequenceType) { + diff = DateUtil.compare(genDate, curDate, "yyyy"); + dateStr = yearLength == 2 ? DateUtils.formatDate(curDate, "yy") : DateUtils.formatDate(curDate, "yyyy"); + } else if (SequenceTypeEnum.MONTH == sequenceType) { + diff = DateUtil.compare(genDate, curDate, "yyyyMM"); + dateStr = yearLength == 2 ? DateUtils.formatDate(curDate, "yyMM") : DateUtils.formatDate(curDate, "yyyyMM"); + } else if (SequenceTypeEnum.DAY == sequenceType) { + diff = DateUtil.compare(genDate, curDate, "yyyyMMdd"); + dateStr = yearLength == 2 ? DateUtils.formatDate(curDate, "yyMMdd") : DateUtils.formatDate(curDate, "yyyyMMdd"); + } else if (SequenceTypeEnum.HOUR == sequenceType) { + diff = DateUtil.compare(genDate, curDate, "yyyyMMddHH"); + dateStr = yearLength == 2 ? DateUtils.formatDate(curDate, "yyMMddHH") : DateUtils.formatDate(curDate, "yyyyMMddHH"); + } else if (SequenceTypeEnum.MINUTE == sequenceType) { + diff = DateUtil.compare(genDate, curDate, "yyyyMMddHHmm"); + dateStr = yearLength == 2 ? DateUtils.formatDate(curDate, "yyMMddHHmm") : DateUtils.formatDate(curDate, "yyyyMMddHHmm"); + } else if (SequenceTypeEnum.SECOND == sequenceType) { + diff = DateUtil.compare(genDate, curDate, "yyyyMMddHHmmss"); + dateStr = yearLength == 2 ? DateUtils.formatDate(curDate, "yyMMddHHmmss") : DateUtils.formatDate(curDate, "yyyyMMddHHmmss"); + } + + if (diff != 0) { //如果diff不为0的话,则需要重新生成一组序列号 + sn.setCurValue(1L); + sn.setGenDate(curDate); + sn.setUpdateDate(curDate); + } + + List rst = new ArrayList<>(size); + Long curValue = sn.getCurValue(); + + for (int i = 0; i < size; i++) { + String numNo = StringUtils.leftPad(String.valueOf(curValue), sn.getSequenceLength(), "0"); + String tmp = _prefix + dateStr + numNo; + rst.add(tmp); + curValue += sn.getIncValue(); + } + + //更新序列值 + sn.setCurValue(curValue + sn.getIncValue()); + + sysSequenceNoService.saveOrUpdate(sn); + + return rst; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public Long saveExportIn(CustomerExportIn exportIn, List cargos, List times, List spares) { + // 保存表头 + exportInService.save(exportIn); + + // 货物 + if (CollectionUtils.isNotEmpty(cargos)) { + cargos.stream().forEach(item -> item.setExportInId(exportIn.getId())); + exportInCargoService.saveBatch(cargos); + } + + // 时间 + if (CollectionUtils.isNotEmpty(times)) { + times.stream().forEach(item -> item.setExportInId(exportIn.getId())); + exportInTimesService.saveBatch(times); + } + + // 备件 可以为空 + if (CollectionUtils.isNotEmpty(spares)) { + spares.stream().forEach(item -> item.setExportInId(exportIn.getId())); + exportInCargoService.saveBatch(spares); + } + + // 如果提单号相同,默认将之前已填的单票件数、单票体积、单票重量的数据带入,支持修改,修改提交后,相同提单号的单票件数、单票体积、单票重量都同步修改。 + exportInService.lambdaUpdate() + .set(CustomerExportIn::getEachQuantity, exportIn.getEachQuantity()) + .set(CustomerExportIn::getEachVolume, exportIn.getEachVolume()) + .set(CustomerExportIn::getEachWeight, exportIn.getEachWeight()) + .eq(CustomerExportIn::getBillNum, exportIn.getBillNum()) + .eq(CustomerExportIn::getShipId, exportIn.getShipId()) + .eq(CustomerExportIn::getVoyageId, exportIn.getVoyageId()) + .update(); + + return exportIn.getId(); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public void delExportIn(Long id) { + // 删除时间表 + { + LambdaQueryWrapper delQuery = new LambdaQueryWrapper<>(); + delQuery.eq(CustomerExportInTimes::getExportInId, id); + exportInTimesService.remove(delQuery); + } + + // 删除货物表 + { + LambdaQueryWrapper delQuery = new LambdaQueryWrapper<>(); + delQuery.eq(CustomerExportInCargo::getExportInId, id); + exportInCargoService.remove(delQuery); + } + + // 删除表头 + exportInService.removeById(id); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public void updateExportIn(Boolean imp, CustomerExportIn exportIn, List cargos, List times, List spares) { + // 修改表头 + exportInService.updateById(exportIn); + + { + if (CollectionUtils.isNotEmpty(cargos)) { + // 处理货物 + cargos.stream().forEach(item -> item.setExportInId(exportIn.getId())); + + List insert = cargos.stream().filter(item -> item.getId() == null).collect(Collectors.toList()); + List update = cargos.stream().filter(item -> item.getId() != null).collect(Collectors.toList()); + + exportInCargoService.updateBatchById(update); + + // 需要删除的 + if (!imp) { + List collect = update.stream().map(item -> item.getId()).collect(Collectors.toList()); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CustomerExportInCargo::getExportInId, exportIn.getId()); + List delete = exportInCargoService.list(query).stream() + .map(item -> item.getId()) + .filter(item -> !collect.contains(item)) + .collect(Collectors.toList()); + exportInCargoService.removeByIds(delete); + } + + exportInCargoService.saveBatch(insert); + } + } + + { + if (CollectionUtils.isNotEmpty(spares)) { + // 处理备件 + spares.stream().forEach(item -> item.setExportInId(exportIn.getId())); + + List insert = spares.stream().filter(item -> item.getId() == null).collect(Collectors.toList()); + List update = spares.stream().filter(item -> item.getId() != null).collect(Collectors.toList()); + + exportInCargoService.updateBatchById(update); + + if (!imp) { + // 需要删除的 + List collect = update.stream().map(item -> item.getId()).collect(Collectors.toList()); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CustomerExportInCargo::getExportInId, exportIn.getId()); + List delete = exportInCargoService.list(query).stream() + .map(item -> item.getId()) + .filter(item -> !collect.contains(item)) + .collect(Collectors.toList()); + exportInCargoService.removeByIds(delete); + } + + exportInCargoService.saveBatch(insert); + } + } + + { + if (CollectionUtils.isNotEmpty(times)) { + // 处理时间 + times.stream().forEach(item -> item.setExportInId(exportIn.getId())); + + List insert = times.stream().filter(item -> item.getId() == null).collect(Collectors.toList()); + List update = times.stream().filter(item -> item.getId() != null).collect(Collectors.toList()); + + exportInTimesService.updateBatchById(update); + + if (!imp) { + List collect = update.stream().map(item -> item.getId()).collect(Collectors.toList()); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CustomerExportInTimes::getExportInId, exportIn.getId()); + List delete = exportInTimesService.list(query).stream() + .map(item -> item.getId()) + .filter(item -> !collect.contains(item)) + .collect(Collectors.toList()); + exportInTimesService.removeByIds(delete); + } + + exportInTimesService.saveBatch(insert); + } + } + + // 如果提单号相同,默认将之前已填的单票件数、单票体积、单票重量的数据带入,支持修改,修改提交后,相同提单号的单票件数、单票体积、单票重量都同步修改。 + exportInService.lambdaUpdate() + .set(CustomerExportIn::getEachQuantity, exportIn.getEachQuantity()) + .set(CustomerExportIn::getEachVolume, exportIn.getEachVolume()) + .set(CustomerExportIn::getEachWeight, exportIn.getEachWeight()) + .eq(CustomerExportIn::getBillNum, exportIn.getBillNum()) + .update(); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public Long saveExportLoad(CustomerExportLoad exportLoad, List cargos) { + // 保存表头 + exportLoadService.save(exportLoad); + + if (CollectionUtils.isNotEmpty(cargos)) { + // 设置外键的值 + cargos.stream().forEach(item -> item.setExportLoadId(exportLoad.getId())); + exportLoadCargoService.saveBatch(cargos); + } + + return exportLoad.getId(); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public void delExportLoad(Long id) { + // 删除货物表 + { + LambdaQueryWrapper delQuery = new LambdaQueryWrapper<>(); + delQuery.eq(CustomerExportLoadCargo::getExportLoadId, id); + exportLoadCargoService.remove(delQuery); + } + + // 删除表头 + exportLoadService.removeById(id); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public void updateExportLoad(Boolean imp, CustomerExportLoad exportLoad, List cargos) { + // 修改表头 + exportLoadService.updateById(exportLoad); + + { + // 处理货物 + cargos.stream().forEach(item -> item.setExportLoadId(exportLoad.getId())); + + List insert = cargos.stream().filter(item -> item.getId() == null).collect(Collectors.toList()); + List update = cargos.stream().filter(item -> item.getId() != null).collect(Collectors.toList()); + + exportLoadCargoService.updateBatchById(update); + + // 需要删除的 + if (!imp) { + List collect = update.stream().map(item -> item.getId()).collect(Collectors.toList()); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CustomerExportLoadCargo::getExportLoadId, exportLoad.getId()); + List delete = exportLoadCargoService.list(query).stream() + .map(item -> item.getId()) + .filter(item -> !collect.contains(item)) + .collect(Collectors.toList()); + exportLoadCargoService.removeByIds(delete); + } + + exportLoadCargoService.saveBatch(insert); + } + } + + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean checkExportLoad(CustomerExportLoad exportLoad, List checks) { + CustomerExportLoad load = exportLoadService.getById(exportLoad.getId()); + + // 获取所有的获物信息 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.in(CustomerExportLoadCargo::getId, checks.stream().map(item -> item.getId()).collect(Collectors.toList())); + List cargos = exportLoadCargoService.list(query); + Map collect = cargos.stream().collect(Collectors.toMap(CustomerExportLoadCargo::getId, v -> v)); + + checks.stream().forEach(item -> { + item.setExportLoadId(load.getId()); + item.setShipName(load.getShipName()); + item.setVoyage(load.getVoyage()); + item.setBillNo(load.getBillNo()); + if (collect.containsKey(item.getId())) { + CustomerExportLoadCargo cargo = collect.get(item.getId()); + item.setBrand(cargo.getBrand()); + item.setModels(cargo.getModels()); + item.setVin(cargo.getVin()); + } + }); + + // 修改审核状态 + exportLoadService.updateById(exportLoad); + exportLoadCheckService.saveBatch(checks); + + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean cancelCheckExportLoad(CustomerExportLoad exportLoad) { + // 修改审核状态 + exportLoadService.updateById(exportLoad); + // 删除审核货物列表 + Map query = new HashMap<>(); + query.put("export_load_id", exportLoad.getId()); + exportLoadCheckService.removeByMap(query); + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public Long saveDeparture(CustomerDeparture departure, List cargos, List drivers, List plans) { + // 保存表头 + departureService.save(departure); + + // 设置外键的值 + cargos.stream().forEach(item -> item.setDepartureId(departure.getId())); + departureCargoService.saveBatch(cargos); + + // 司机 + drivers.stream().forEach(item -> item.setDepartureId(departure.getId())); + departureDriversService.saveBatch(drivers); + + // 计划 + plans.stream().forEach(item -> item.setDepartureId(departure.getId())); + departurePlanService.saveBatch(plans); + + return departure.getId(); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public void delDeparture(Long id) { + // 删除货物表 + { + LambdaQueryWrapper delQuery = new LambdaQueryWrapper<>(); + delQuery.eq(CustomerDepartureCargo::getDepartureId, id); + departureCargoService.remove(delQuery); + } + + // 删除司机 + { + LambdaQueryWrapper delQuery = new LambdaQueryWrapper<>(); + delQuery.eq(CustomerDepartureDrivers::getDepartureId, id); + departureDriversService.remove(delQuery); + } + + // 删除计划 + { + LambdaQueryWrapper delQuery = new LambdaQueryWrapper<>(); + delQuery.eq(CustomerDeparturePlan::getDepartureId, id); + departurePlanService.remove(delQuery); + } + + // 删除表头 + departureService.removeById(id); + + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public void updateDeparture(Boolean imp, CustomerDeparture departure, List cargos, List drivers, List plans) { + // 修改表头 + departureService.updateById(departure); + + { + // 处理货物 + cargos.stream().forEach(item -> item.setDepartureId(departure.getId())); + + List insert = cargos.stream().filter(item -> item.getId() == null).collect(Collectors.toList()); + List update = cargos.stream().filter(item -> item.getId() != null).collect(Collectors.toList()); + + departureCargoService.updateBatchById(update); + + // 需要删除的 + if (!imp) { + List collect = update.stream().map(item -> item.getId()).collect(Collectors.toList()); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CustomerDepartureCargo::getDepartureId, departure.getId()); + List delete = departureCargoService.list(query).stream() + .map(item -> item.getId()) + .filter(item -> !collect.contains(item)) + .collect(Collectors.toList()); + departureCargoService.removeByIds(delete); + } + + departureCargoService.saveBatch(insert); + } + + { + // 处理司机 + drivers.stream().forEach(item -> item.setDepartureId(departure.getId())); + + List insert = drivers.stream().filter(item -> item.getId() == null).collect(Collectors.toList()); + List update = drivers.stream().filter(item -> item.getId() != null).collect(Collectors.toList()); + + departureDriversService.updateBatchById(update); + + // 需要删除的 + if (!imp) { + List collect = update.stream().map(item -> item.getId()).collect(Collectors.toList()); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CustomerDepartureDrivers::getDepartureId, departure.getId()); + List delete = departureDriversService.list(query).stream() + .map(item -> item.getId()) + .filter(item -> !collect.contains(item)) + .collect(Collectors.toList()); + departureDriversService.removeByIds(delete); + } + + departureDriversService.saveBatch(insert); + } + + { + // 处理计划 + plans.stream().forEach(item -> item.setDepartureId(departure.getId())); + + List insert = plans.stream().filter(item -> item.getId() == null).collect(Collectors.toList()); + List update = plans.stream().filter(item -> item.getId() != null).collect(Collectors.toList()); + + departurePlanService.updateBatchById(update); + + // 需要删除的 + if (!imp) { + List collect = update.stream().map(item -> item.getId()).collect(Collectors.toList()); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CustomerDeparturePlan::getDepartureId, departure.getId()); + List delete = departurePlanService.list(query).stream() + .map(item -> item.getId()) + .filter(item -> !collect.contains(item)) + .collect(Collectors.toList()); + departurePlanService.removeByIds(delete); + } + + departurePlanService.saveBatch(insert); + } + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public Long saveExportInspect(CustomerExportInspect inspect, List cargos) { + // 保存表头 + exportInspectService.save(inspect); + + // 设置外键的值 + cargos.stream().forEach(item -> item.setExportInspectId(inspect.getId())); + exportInspectCargoService.saveBatch(cargos); + + return inspect.getId(); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public void delExportInspect(Long id) { + // 删除货物表 + { + LambdaQueryWrapper delQuery = new LambdaQueryWrapper<>(); + delQuery.eq(CustomerExportInspectCargo::getExportInspectId, id); + exportInspectCargoService.remove(delQuery); + } + + // 删除表头 + exportInspectService.removeById(id); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public void updateExportInspect(Boolean imp, CustomerExportInspect inspect, List cargos) { + // 修改表头 + exportInspectService.updateById(inspect); + + { + // 处理货物 + cargos.stream().forEach(item -> item.setExportInspectId(inspect.getId())); + + List insert = cargos.stream().filter(item -> item.getId() == null).collect(Collectors.toList()); + List update = cargos.stream().filter(item -> item.getId() != null).collect(Collectors.toList()); + + exportInspectCargoService.updateBatchById(update); + + // 需要删除的 + if (!imp) { + List collect = update.stream().map(item -> item.getId()).collect(Collectors.toList()); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CustomerExportInspectCargo::getExportInspectId, inspect.getId()); + List delete = exportInspectCargoService.list(query).stream() + .map(item -> item.getId()) + .filter(item -> !collect.contains(item)) + .collect(Collectors.toList()); + exportInspectCargoService.removeByIds(delete); + } + + exportInspectCargoService.saveBatch(insert); + } + + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public void delExportLoadByVin(String vin) { + CustomerExportLoadCargo cargo = exportLoadCargoService.getOne(new LambdaQueryWrapper().eq(CustomerExportLoadCargo::getVin, vin)); + if (cargo == null) { + return; + } + + if (!StringUtils.equals(cargo.getWorkStatus(), "未进港")) { + throw new RuntimeException("已作业,无法删除"); + } + + exportLoadService.lambdaUpdate().setSql("quantity=quantity-1").eq(CustomerExportLoad::getId, cargo.getExportLoadId()).update(); + + exportLoadCargoService.removeById(cargo.getId()); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public void delExportInByVin(String vin) { + CustomerExportInCargo cargo = exportInCargoService.getOne(new LambdaQueryWrapper().eq(CustomerExportInCargo::getVin, vin)); + if (cargo == null) { + return; + } + + exportInService.lambdaUpdate().setSql("quantity=quantity-1").eq(CustomerExportIn::getId, cargo.getExportInId()).update(); + + exportInCargoService.removeById(cargo.getId()); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public void delImportUnload(Long id) { + // 删除货物 + customerImportUnloadCargoService.lambdaUpdate().eq(CustomerImportUnloadCargo::getImportUnloadId, id).remove(); + + customerImportUnloadService.removeById(id); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public Long saveImportUnload(CustomerImportUnload importUnload, List cargos) { + // 保存表头 + customerImportUnloadService.save(importUnload); + + // 设置外键的值 + cargos.stream().forEach(item -> item.setImportUnloadId(importUnload.getId())); + customerImportUnloadCargoService.saveBatch(cargos); + + return importUnload.getId(); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public void updateImportUnload(CustomerImportUnload importUnload, List cargos) { + // 修改表头 + customerImportUnloadService.updateById(importUnload); + + // 设置外键的值 + cargos.stream().forEach(item -> item.setImportUnloadId(importUnload.getId())); + customerImportUnloadCargoService.saveBatch(cargos); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public Long saveImportTake(CustomerImportTake importTake, List cargos, List jobs) { + // 保存表头 + importTakeService.save(importTake); + + // 货物 + cargos.stream().forEach(item -> item.setImportTakeId(importTake.getId())); + importTakeCargoService.saveBatch(cargos); + + // 时间 + jobs.stream().forEach(item -> item.setImportTakeId(importTake.getId())); + importTakeJobService.saveBatch(jobs); + + return importTake.getId(); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public void delImportTake(Long id) { + { + LambdaQueryWrapper delQuery = new LambdaQueryWrapper<>(); + delQuery.eq(CustomerImportTakeCargo::getImportTakeId, id); + importTakeCargoService.remove(delQuery); + } + + { + LambdaQueryWrapper delQuery = new LambdaQueryWrapper<>(); + delQuery.eq(CustomerImportTakeJob::getImportTakeId, id); + importTakeJobService.remove(delQuery); + } + + // 删除表头 + importTakeService.removeById(id); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public void updateImportTake(Boolean imp, CustomerImportTake importTake, List cargos, List jobs) { + // 修改表头 + importTakeService.updateById(importTake); + + { + // 处理货物 + cargos.stream().forEach(item -> item.setImportTakeId(importTake.getId())); + + List insert = cargos.stream().filter(item -> item.getId() == null).collect(Collectors.toList()); + List update = cargos.stream().filter(item -> item.getId() != null).collect(Collectors.toList()); + + importTakeCargoService.updateBatchById(update); + + // 需要删除的 + if (!imp) { + List collect = update.stream().map(item -> item.getId()).collect(Collectors.toList()); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CustomerImportTakeCargo::getImportTakeId, importTake.getId()); + List delete = importTakeCargoService.list(query).stream() + .map(item -> item.getId()) + .filter(item -> !collect.contains(item)) + .collect(Collectors.toList()); + importTakeCargoService.removeByIds(delete); + } + + importTakeCargoService.saveBatch(insert); + } + + { + // 处理工作过程 + jobs.stream().forEach(item -> item.setImportTakeId(importTake.getId())); + + List insert = jobs.stream().filter(item -> item.getId() == null).collect(Collectors.toList()); + List update = jobs.stream().filter(item -> item.getId() != null).collect(Collectors.toList()); + + importTakeJobService.updateBatchById(update); + + // 需要删除的 + if (!imp) { + List collect = update.stream().map(item -> item.getId()).collect(Collectors.toList()); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CustomerImportTakeJob::getImportTakeId, importTake.getId()); + List delete = importTakeJobService.list(query).stream() + .map(item -> item.getId()) + .filter(item -> !collect.contains(item)) + .collect(Collectors.toList()); + importTakeJobService.removeByIds(delete); + } + + importTakeJobService.saveBatch(insert); + } + } +} diff --git a/nuzar-customer-controller/src/main/resources/application-dev.yml b/nuzar-customer-controller/src/main/resources/application-dev.yml new file mode 100644 index 0000000..db1ba53 --- /dev/null +++ b/nuzar-customer-controller/src/main/resources/application-dev.yml @@ -0,0 +1,10 @@ +#spring: +# config: +# import: +# - optional:nacos:${spring.application.name}-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + +server: + port: 18086 + servlet: + context-path: /move + diff --git a/nuzar-customer-controller/src/main/resources/application-pre.yml b/nuzar-customer-controller/src/main/resources/application-pre.yml new file mode 100644 index 0000000..3be0c01 --- /dev/null +++ b/nuzar-customer-controller/src/main/resources/application-pre.yml @@ -0,0 +1,22 @@ +#spring: +# +# cloud: +# nacos: +# discovery: +# server-addr: 192.168.61.130:8848 +# namespace: 4f38d093-5ff8-46f0-974f-08453b0980f4 +# config: +# server-addr: 192.168.61.130:8848 +# file-extension: yaml +# namespace: 4f38d093-5ff8-46f0-974f-08453b0980f4 +# username: nacos +# password: nacos +# +# config: +# import: +# - optional:nacos:${spring.application.name}-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + +server: + port: 18086 +# servlet: +# context-path: /move diff --git a/nuzar-customer-controller/src/main/resources/application.yml b/nuzar-customer-controller/src/main/resources/application.yml new file mode 100644 index 0000000..16eb659 --- /dev/null +++ b/nuzar-customer-controller/src/main/resources/application.yml @@ -0,0 +1,43 @@ +spring: + mvc: + pathmatch: + matching-strategy: ant_path_matcher + + main: + allow-bean-definition-overriding: true + + profiles: + active: pre + +logging: + level: + root: info + com.nuzar: debug + +# job: +# enabled: true +# admin-addresses: http://10.166.0.192:8491/xxl-job-admin ##调度中心地址 +# access-token: Nuzar123456_ #执行器通讯TOKEN [选填]:非空时启用; +# executor: +# appname: ${spring.application.name} #执行器AppName,[选填]:执行器心跳注册分组依据;为空则关闭自动注册(与三.1中的appName一致) + +management: + endpoints: + web: + exposure: + include: health + enabled-by-default: true + health: + ping: + enabled: true + rabbit: + enabled: false + +sys: + modules: + - + code: '01' + name: '系统管理' + remark: '系统管理' + - + code: '02' diff --git a/nuzar-customer-controller/src/main/resources/application_backup.yml b/nuzar-customer-controller/src/main/resources/application_backup.yml new file mode 100644 index 0000000..e3253ba --- /dev/null +++ b/nuzar-customer-controller/src/main/resources/application_backup.yml @@ -0,0 +1,104 @@ +#server: +# port: 9005 +# +spring: +# cloud: +# stream: +# bindings: +# orderDeliveriedNotice-out-0: +# destination: ss007-auto-topic +# orderDeliveriedNotice-in-0: +# destination: ss007-auto-topic +# group: ss007-group +# rabbit: +# bindings: +# orderDeliveriedNotice-out-0: +# producer: +# auto-bind-dlq: true +# receiveDeliveriedNotice-in-0: +# consumer: +# auto-bind-dlq: true +# dlqMaxLength: 100000 +# function: +# routing: +# enabled: true +# definition: orderDeliveriedNotice,receiveDeliveriedNotice +# default-binder: rabbit +# rabbitmq: +# host: 10.166.0.192 +# username: admin +# password: Nuzar123456_ +# port: 5672 +# virtual-host: / + +# sleuth: +# enabled: true +# sampler: +# # 设置 Sleuth 收集信息的百分比,一般情况下,10%就够用了,这里设置100%观察 +# rate: 10 + +# zipkin: +# sender: +# type: web +# base-url: http://10.166.0.193:9411/ +# discovery-client-enabled: false +# zipkin: +# base-url: http://10.166.0.193:9411/ #zipkin地址 +# discovery-client-enabled: false #不⽤开启服务发现 + +# # profiles: +# # active: host +# datasource: +# driver-class-name: com.mysql.cj.jdbc.Driver +# url: jdbc:mysql://192.168.56.101:3306/integrated_order?useSSL=false&characterEncoding=utf8 +# username: root +# password: 123456 +# main: +# allow-bean-definition-overriding: true +# type: com.alibaba.druid.pool.DruidDataSource +# mybatis: +# configuration: +# map-underscore-to-camel-case: true +# redis: +# host: 192.168.56.101 +# port: 6379 +logging: + level: + root: info + com.nuzar: debug +nuzar: + cloud: + web: + wrapper: common #默认mass结构,common为简化返回结构 + security: + mode: none + audit: + enabled: true + processor: database + async: true + feign: + okhttp: + enabled: true + client: + config: + default: + connectTimeout: 500 + +# job: +# enabled: true +# admin-addresses: http://10.166.0.192:8491/xxl-job-admin ##调度中心地址 +# access-token: Nuzar123456_ #执行器通讯TOKEN [选填]:非空时启用; +# executor: +# appname: ${spring.application.name} #执行器AppName,[选填]:执行器心跳注册分组依据;为空则关闭自动注册(与三.1中的appName一致) + +management: + endpoints: + web: + exposure: + include: health + enabled-by-default: true + health: + ping: + enabled: true + rabbit: + enabled: false \ No newline at end of file diff --git a/nuzar-customer-controller/src/main/resources/bootstrap.yml b/nuzar-customer-controller/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..f0103b4 --- /dev/null +++ b/nuzar-customer-controller/src/main/resources/bootstrap.yml @@ -0,0 +1,19 @@ +spring: + application: + name: nuzar-customer-boss + cloud: + nacos: + server-addr: 192.168.61.130:8848 + discovery: + namespace: 4f38d093-5ff8-46f0-974f-08453b0980f4 + config: + namespace: 4f38d093-5ff8-46f0-974f-08453b0980f4 + file-extension: yaml + prefix: ${spring.application.name} + shared-configs: + - data-id: rtops-pre.yaml + username: nacos + password: Nuzar123456_#QWE + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss diff --git a/nuzar-customer-controller/src/main/resources/bootstrap_local.yml b/nuzar-customer-controller/src/main/resources/bootstrap_local.yml new file mode 100644 index 0000000..752aa20 --- /dev/null +++ b/nuzar-customer-controller/src/main/resources/bootstrap_local.yml @@ -0,0 +1,19 @@ +spring: + application: + name: nuzar-customer-boss + cloud: + nacos: + server-addr: localhost:8848 + discovery: + namespace: f0812ced-eae5-45a5-a080-61ef32dcec18 + config: + namespace: f0812ced-eae5-45a5-a080-61ef32dcec18 + file-extension: yaml + prefix: ${spring.application.name} + shared-configs: + - data-id: rtops-pre.yaml + username: nacos + password: nacos + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss diff --git a/nuzar-customer-controller/src/main/resources/logback-spring.xml b/nuzar-customer-controller/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..06beff5 --- /dev/null +++ b/nuzar-customer-controller/src/main/resources/logback-spring.xml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + ${CONSOLE_LOG_PATTERN} + UTF-8 + + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 1 + true + + + + debug + ACCEPT + DENY + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 1 + + + + info + ACCEPT + DENY + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 1 + + + + warn + ACCEPT + DENY + + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 1 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + diff --git a/nuzar-customer-controller/src/main/resources/templates/SourceHanSansCN-Regular.ttf b/nuzar-customer-controller/src/main/resources/templates/SourceHanSansCN-Regular.ttf new file mode 100644 index 0000000..53b6691 Binary files /dev/null and b/nuzar-customer-controller/src/main/resources/templates/SourceHanSansCN-Regular.ttf differ diff --git a/nuzar-customer-controller/src/main/resources/templates/template.pdf b/nuzar-customer-controller/src/main/resources/templates/template.pdf new file mode 100644 index 0000000..215a7b5 --- /dev/null +++ b/nuzar-customer-controller/src/main/resources/templates/template.pdf @@ -0,0 +1,15 @@ + 提离港区保函 + +上海海通国际汽车码头有限公司: + +基本信息 航次: +受理号: 提货日期: +船名: +进港日期: + +返回日期: 数量: + +事由: + +司机信息 + diff --git a/nuzar-customer-controller/src/main/resources/templates/template.xlsx b/nuzar-customer-controller/src/main/resources/templates/template.xlsx new file mode 100644 index 0000000..77f5d42 Binary files /dev/null and b/nuzar-customer-controller/src/main/resources/templates/template.xlsx differ diff --git a/nuzar-customer-controller/src/test/java/com/haitonggauto/rtosc/BJNumTest.java b/nuzar-customer-controller/src/test/java/com/haitonggauto/rtosc/BJNumTest.java new file mode 100644 index 0000000..5829377 --- /dev/null +++ b/nuzar-customer-controller/src/test/java/com/haitonggauto/rtosc/BJNumTest.java @@ -0,0 +1,52 @@ +package com.haitonggauto.rtosc; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.RandomUtil; +import com.alibaba.fastjson2.JSONObject; +import com.haitonggauto.rtosc.common.utils.OkHttpUtils; +import org.apache.commons.lang3.StringUtils; +import org.asynchttpclient.DefaultAsyncHttpClient; +import org.asynchttpclient.ListenableFuture; +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.concurrent.ExecutionException; + +public class BJNumTest { + public static void main(String[] args) { + 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 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(); + } + } +} diff --git a/nuzar-customer-controller/src/test/java/com/haitonggauto/rtosc/MybatisGenerator.java b/nuzar-customer-controller/src/test/java/com/haitonggauto/rtosc/MybatisGenerator.java new file mode 100644 index 0000000..3aa0514 --- /dev/null +++ b/nuzar-customer-controller/src/test/java/com/haitonggauto/rtosc/MybatisGenerator.java @@ -0,0 +1,43 @@ +//package org.example; +// +//import com.baomidou.mybatisplus.generator.FastAutoGenerator; +//import com.baomidou.mybatisplus.generator.config.OutputFile; +//import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; +//import org.junit.Test; +//import org.junit.runner.RunWith; +//import org.springframework.boot.test.context.SpringBootTest; +//import org.springframework.test.context.junit4.SpringRunner; +// +//import java.util.Collections; +// +////@RunWith(SpringRunner.class) +////@SpringBootTest(classes = NuzarApplication.class) +//public class MybatisGenerator { +// +// public static void main(String[] args) { +// MybatisGenerator.gen(); +// } +// +//// @Test +// public static void gen(){ +// FastAutoGenerator.create("jdbc:mysql://192.168.56.101:3306/demo?useSSL=false&characterEncoding=utf8", "root", "123456") +// .globalConfig(builder -> { +// builder.author("hanson") // 设置作者 +//// .enableSwagger() // 开启 swagger 模式 +// .fileOverride() // 覆盖已生成文件 +// .outputDir("D://mybatis/"); // 指定输出目录 +// }) +// .packageConfig(builder -> { +// builder.parent("org.example.repository") // 设置父包名 +//// .moduleName("demo") // 设置父包模块名 +// .pathInfo(Collections.singletonMap(OutputFile.mapperXml, "D://mybatis/")); // 设置mapperXml生成路径 +// }) +// .strategyConfig(builder -> { +// builder.addInclude("user") // 设置需要生成的表名 +// .addTablePrefix("t_", "c_"); // 设置过滤表前缀 +// }) +// .templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板,默认的是Velocity引擎模板 +// .execute(); +// +// } +//} diff --git a/nuzar-customer-controller/src/test/java/com/haitonggauto/rtosc/repository/service/CustomerImportTakeCargoServiceImpl.java b/nuzar-customer-controller/src/test/java/com/haitonggauto/rtosc/repository/service/CustomerImportTakeCargoServiceImpl.java new file mode 100644 index 0000000..05c1d41 --- /dev/null +++ b/nuzar-customer-controller/src/test/java/com/haitonggauto/rtosc/repository/service/CustomerImportTakeCargoServiceImpl.java @@ -0,0 +1,21 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.query.ImportTakeQuery; +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; + +import javax.annotation.Resource; + +@SpringBootTest +public class CustomerImportTakeCargoServiceImpl { + + @Resource + private CustomerImportTakeCargoService importTakeCargoService; + + @Test + public void testGetImportTakeCargoList() { + ImportTakeQuery query = new ImportTakeQuery(); + importTakeCargoService.getImportTakeCargoList(query); + } + +} diff --git a/nuzar-customer-domain/pom.xml b/nuzar-customer-domain/pom.xml new file mode 100644 index 0000000..1377f6c --- /dev/null +++ b/nuzar-customer-domain/pom.xml @@ -0,0 +1,27 @@ + + + + com.haitonggauto.rtosc + nuzar-customer + 1.0-SNAPSHOT + + 4.0.0 + nuzar-customer-domain + jar + + false + + + + + com.haitonggauto.rtosc + nuzar-customer-repository + + + com.haitonggauto.rtosc + nuzar-customer-client + 1.0-SNAPSHOT + compile + + + diff --git a/nuzar-customer-domain/src/main/java/com/haitonggauto/rtosc/domain/entity/Order.java b/nuzar-customer-domain/src/main/java/com/haitonggauto/rtosc/domain/entity/Order.java new file mode 100644 index 0000000..3873372 --- /dev/null +++ b/nuzar-customer-domain/src/main/java/com/haitonggauto/rtosc/domain/entity/Order.java @@ -0,0 +1,35 @@ +package com.haitonggauto.rtosc.domain.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author hanson + * @since 2022-12-29 + */ +@Data +public class Order implements Serializable { + + private Long id; + + private String userId; + + private String commodityCode; + + private Integer count; + + private Integer money; + + private String status; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + +} diff --git a/nuzar-customer-domain/src/main/java/com/haitonggauto/rtosc/domain/service/OrderService.java b/nuzar-customer-domain/src/main/java/com/haitonggauto/rtosc/domain/service/OrderService.java new file mode 100644 index 0000000..d78566c --- /dev/null +++ b/nuzar-customer-domain/src/main/java/com/haitonggauto/rtosc/domain/service/OrderService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.domain.service; + +import com.nuzar.cloud.common.exception.BizException; +import com.haitonggauto.rtosc.domain.entity.Order; + +public interface OrderService { + + Order createOrder(Order order) + throws BizException; + + void deliveryOrder(Long orderId); + +} diff --git a/nuzar-customer-domain/src/main/java/com/haitonggauto/rtosc/domain/service/impl/OrderServiceImpl.java b/nuzar-customer-domain/src/main/java/com/haitonggauto/rtosc/domain/service/impl/OrderServiceImpl.java new file mode 100644 index 0000000..c3bebbb --- /dev/null +++ b/nuzar-customer-domain/src/main/java/com/haitonggauto/rtosc/domain/service/impl/OrderServiceImpl.java @@ -0,0 +1,55 @@ +package com.haitonggauto.rtosc.domain.service.impl; + +import com.haitonggauto.rtosc.domain.service.OrderService; +import com.haitonggauto.rtosc.enums.OrderStatusEnum; +import com.nuzar.cloud.common.exception.BizException; +import com.haitonggauto.rtosc.domain.entity.Order; +import com.haitonggauto.rtosc.repository.service.OrderRepository; +import com.haitonggauto.rtosc.repository.dataobject.OrderDO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; + +@Slf4j +@Service +public class OrderServiceImpl implements OrderService { + + @Autowired + private OrderRepository orderRepository; + + @Override + public Order createOrder(Order order) { + log.info("下单"); + // save order + OrderDO orderDO = new OrderDO(); + orderDO.setUserId(order.getUserId()); + orderDO.setCommodityCode(order.getCommodityCode()); + orderDO.setCount(order.getCount()); + orderDO.setMoney(order.getMoney()); + orderDO.setStatus(order.getStatus()); + orderDO.setCreateTime(LocalDateTime.now()); + orderDO.setUpdateTime(LocalDateTime.now()); + orderRepository.saveOrUpdate(orderDO); + + order.setId(orderDO.getId()); + return order; + } + + @Override + public void deliveryOrder(Long orderId) { + OrderDO order = orderRepository.getById(orderId); + if(order == null){ + log.error("order not exist,orderId:{}",orderId); + throw new BizException("order not exist"); + } + + if(OrderStatusEnum.PAID.getCode().equals(order.getStatus())){ + order.setStatus(OrderStatusEnum.DELIVERED.getCode()); + orderRepository.updateById(order); + } + } + + +} diff --git a/nuzar-customer-proxy/pom.xml b/nuzar-customer-proxy/pom.xml new file mode 100644 index 0000000..de35099 --- /dev/null +++ b/nuzar-customer-proxy/pom.xml @@ -0,0 +1,38 @@ + + + + com.haitonggauto.rtosc + nuzar-customer + 1.0-SNAPSHOT + + 4.0.0 + nuzar-customer-proxy + jar + + true + + + + + + com.haitonggauto.rtosc + nuzar-customer-common + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/nuzar-customer-proxy/src/main/java/com/haitonggauto/rtosc/facade/impl/AccountProxyImpl.java b/nuzar-customer-proxy/src/main/java/com/haitonggauto/rtosc/facade/impl/AccountProxyImpl.java new file mode 100644 index 0000000..ce680b9 --- /dev/null +++ b/nuzar-customer-proxy/src/main/java/com/haitonggauto/rtosc/facade/impl/AccountProxyImpl.java @@ -0,0 +1,17 @@ +package com.haitonggauto.rtosc.facade.impl; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class AccountProxyImpl { + +// private final AccountApi accountApi; +// +// public String reduceBalance(AccountDTO accountReduceBalanceVO) { +// ReduceBalanceResponse response = accountApi.reduceBalance(accountReduceBalanceVO); +// return response.getResult(); +// } + +} diff --git a/nuzar-customer-repository/pom.xml b/nuzar-customer-repository/pom.xml new file mode 100644 index 0000000..c58f3e7 --- /dev/null +++ b/nuzar-customer-repository/pom.xml @@ -0,0 +1,66 @@ + + + 4.0.0 + + com.haitonggauto.rtosc + nuzar-customer + 1.0-SNAPSHOT + + nuzar-customer-repository + nuzar-customer-repository + nuzar-customer-repository + jar + + 11 + 1.2.3 + + + + com.haitonggauto.rtosc + nuzar-customer-common + + + com.nuzar + nuzar-core + + + com.nuzar + nuzar-spring + + + com.alibaba + druid-spring-boot-starter + ${durid.version} + + + com.baomidou + mybatis-plus-extension + + + com.alibaba + fastjson + 1.2.83 + + + org.postgresql + postgresql + runtime + + + com.nuzar.rtops + rtos-log-es-starter + 1.0.0-SNAPSHOT + + + jakarta.json-api + jakarta.json + + + elasticsearch-rest-client + org.elasticsearch.client + + + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/config/MpMetaObjectHandler.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/config/MpMetaObjectHandler.java new file mode 100644 index 0000000..d53a526 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/config/MpMetaObjectHandler.java @@ -0,0 +1,41 @@ +package com.haitonggauto.rtosc.repository.config; + + +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.common.context.UserContext; +import org.apache.ibatis.reflection.MetaObject; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.context.annotation.Primary; +import org.springframework.stereotype.Component; + +import java.util.Date; + +@Primary +@Component +@ConditionalOnClass(BaseMapper.class) +public class MpMetaObjectHandler implements MetaObjectHandler { + + /** + * 插入时的填充策略 + * @param metaObject + */ + @Override + public void insertFill(MetaObject metaObject) { + this.setFieldValByName("createBy", UserContext.getUser().getUserId(),metaObject); + this.setFieldValByName("createDate", new Date(), metaObject); + this.setFieldValByName("updateBy", UserContext.getUser().getUserId(),metaObject); + this.setFieldValByName("updateDate", new Date(), metaObject); + this.setFieldValByName("version", 0, metaObject); + } + + /** + * 更新时的填充策略 + * @param metaObject + */ + @Override + public void updateFill(MetaObject metaObject) { + this.setFieldValByName("updateBy", UserContext.getUser().getUserId(),metaObject); + this.setFieldValByName("updateDate", new Date(), metaObject); + } +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/config/MyBatisPlusConfig.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/config/MyBatisPlusConfig.java new file mode 100644 index 0000000..b740104 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/config/MyBatisPlusConfig.java @@ -0,0 +1,32 @@ +package com.haitonggauto.rtosc.repository.config; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Date:2022/2/14 + * Author:ybc + * Description: + */ +@Configuration +@MapperScan("com.haitonggauto.rtosc.repository.mapper") +public class MyBatisPlusConfig { + +// @Bean +// public MybatisPlusInterceptor mybatisPlusInterceptor(){ +// MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); +// //添加分页插件 +// interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL)); +// //添加乐观锁插件 +// interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor()); +// return interceptor; +// } + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/dataobject/OrderDO.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/dataobject/OrderDO.java new file mode 100644 index 0000000..ff96aa4 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/dataobject/OrderDO.java @@ -0,0 +1,55 @@ +package com.haitonggauto.rtosc.repository.dataobject; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.nuzar.cloud.annotation.audit.TableAudit; +import com.nuzar.cloud.annotation.dict.DictCode; +import com.nuzar.cloud.annotation.dict.DictId; +import com.nuzar.cloud.annotation.dict.DictName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author hanson + * @since 2023-01-05 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("t_order") +@TableAudit +public class OrderDO implements Serializable { + + private static final long serialVersionUID = 1L; + + @DictId + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @DictCode + private String userId; + + private String commodityCode; + + private Integer count; + + @DictName + private Integer money; + + private String status; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDeparture.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDeparture.java new file mode 100644 index 0000000..97a5840 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDeparture.java @@ -0,0 +1,243 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.nuzar.cloud.annotation.echo.Echo; +import com.nuzar.rtops.log.annotation.EsLogApproval; +import com.nuzar.rtops.log.annotation.EsLogMean; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 提离港区基本信息表 + * @TableName customer_departure + */ +@TableName(value ="customer_departure") +@Data +@ApiModel(value = "提离港区基本信息表") +public class CustomerDeparture extends BaseEntity implements Serializable { + /** + * 受理号 + */ + @TableField(value = "batch_no") + @ApiModelProperty(value = "受理号") + private String batchNo; + + /** + * 贸易类型 + */ + @TableField(value = "trad_type") + @ApiModelProperty(value = "贸易类型") + private String tradType; + + /** + * 船名 + */ + @TableField(value = "ship_id") + @ApiModelProperty(value = "船ID") + private String shipId; + + /** + * 中文船名 + */ + @TableField(value = "ship_name") + @ApiModelProperty(value = "中文船名") + private String shipName; + + /** + * 英文船名 + */ + @TableField(value = "ship_en_name") + @ApiModelProperty(value = "英文船名") + private String shipEnName; + + /** + * 航次ID + */ + @TableField(value = "voyage_id") + @ApiModelProperty(value = "航次ID") + private String voyageId; + + /** + * 航次 + */ + @TableField(value = "voyage") + @ApiModelProperty(value = "航次") + private String voyage; + + /** + * 港区ID + */ + @TableField(value = "port_area_id") + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + /** + * 港区 + */ + @TableField(value = "port_area") + @ApiModelProperty(value = "港区") + private String portArea; + + /** + * 收货单位ID + */ + @TableField(value = "receive_company_id") + @ApiModelProperty(value = "收货单位ID") + private String receiveCompanyId; + + /** + * 收货单位 + */ + @TableField(value = "receive_company") + @ApiModelProperty(value = "收货单位") + private String receiveCompany; + + /** + * 联系人 + */ + @TableField(value = "contact") + @ApiModelProperty(value = "联系人") + private String contact; + + /** + * 联系方式 + */ + @TableField(value = "contact_phone") + @ApiModelProperty(value = "联系方式") + private String contactPhone; + + /** + * 堆放港区ID + */ + @TableField(value = "retain_port_id") + @ApiModelProperty(value = "堆放港区ID") + private String retainPortId; + + /** + * 堆放港区 + */ + @TableField(value = "retain_port") + @ApiModelProperty(value = "堆放港区") + private String retainPort; + + /** + * 进港日期 + */ + @TableField(value = "arrival_time") + @ApiModelProperty(value = "进港日期") + private Date arrivalTime; + + /** + * 提货日期 + */ + @TableField(value = "delivery_time") + @ApiModelProperty(value = "提货日期") + private Date deliveryTime; + + /** + * 返回日期 + */ + @TableField(value = "return_time") + @ApiModelProperty(value = "返回日期") + private Date returnTime; + + /** + * 审核人ID + */ + @Echo(dictDomain = "user", ref = {"checkMan"}) + @TableField(value = "check_man_id") + @ApiModelProperty(value = "审核人ID") + private String checkManId; + + /** + * 审核人 + */ + @TableField(value = "check_man") + @ApiModelProperty(value = "审核人") + private String checkMan; + + /** + * 审核时间 + */ + @TableField(value = "check_time") + @ApiModelProperty(value = "审核时间") + private Date checkTime; + + /** + * 审核状态 + */ + @TableField(value = "check_status") + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @TableField(value = "check_result") + @ApiModelProperty(value = "审核原因") + private String checkResult; + + /** + * 申请时间 + */ + @TableField(value = "apply_time") + @ApiModelProperty(value = "申请时间") + private Date applyTime; + + /** + * 申请人ID + */ + @Echo(dictDomain = "user", ref = {"applicant"}) + @TableField(value = "applicant_id") + @ApiModelProperty(value = "申请人Id") + private String applicantId; + + /** + * 申请人 + */ + @TableField(value = "applicant") + @ApiModelProperty(value = "申请人") + private String applicant; + + /** + * 备注 + */ + @TableField(value = "remark") + @ApiModelProperty(value = "备注") + private String remark; + + @TableField(exist = false) + @ApiModelProperty(value = "数量(计划中,备件数和车辆数之后)") + private Integer quantity; + + /** + * 事由 + */ + @TableField(value = "reason") + @ApiModelProperty(value = "事由") + private String reason; + + @TableField(exist = false) + @ApiModelProperty(value = "车辆/备件列表") + private List cargos; + + @TableField(exist = false) + @ApiModelProperty(value = "提离港区司机列表") + private List drivers; + + @TableField(exist = false) + @ApiModelProperty(value = "提离港区操作计划列表") + private List plans; + + @TableField(exist = false) + @ApiModelProperty(hidden = true) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDepartureCargo.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDepartureCargo.java new file mode 100644 index 0000000..1166cf0 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDepartureCargo.java @@ -0,0 +1,79 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 提离港区货物表 + * @TableName customer_departure_cargo + */ +@TableName(value ="customer_departure_cargo") +@Data +@ApiModel(value = "提离港区货物表") +public class CustomerDepartureCargo extends BaseEntity implements Serializable { + /** + * 提离港区ID + */ + @TableField(value = "departure_id") + @ApiModelProperty(hidden = true) + private Long departureId; + + /** + * 货物类型ID,0代表车辆,1代表备件 + */ + @TableField(value = "cargo_type") + @ApiModelProperty(hidden = true) + private String cargoType; + + /** + * 提单号 + */ + @TableField(value = "bill_no") + @ApiModelProperty(value = "提单号") + private String billNo; + + /** + * 品牌ID + */ + @TableField(value = "brand_id") + @ApiModelProperty(value = "品牌ID") + private String brandId; + + /** + * 品牌 + */ + @TableField(value = "brand") + @ApiModelProperty(value = "品牌") + private String brand; + + /** + * 车架号/条码 + */ + @ApiModelProperty(value = "车架号/条码") + @TableField(value = "vin") + private String vin; + + /** + * 数量 + */ + @ApiModelProperty(value = "数量") + @TableField(value = "quantity") + private Integer quantity; + + /** + * 是否退关 + */ + @ApiModelProperty(value = "是否退关") + @TableField(value = "is_shutout") + private Integer isShutout; + + @TableField(exist = false) + @ApiModelProperty(hidden = true) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDepartureDrivers.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDepartureDrivers.java new file mode 100644 index 0000000..90cef61 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDepartureDrivers.java @@ -0,0 +1,51 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 提离港区司机表 + * @TableName customer_departure_drivers + */ +@TableName(value ="customer_departure_drivers") +@Data +@ApiModel(value = "提离港区司机表") +public class CustomerDepartureDrivers extends BaseEntity implements Serializable { + /** + * 提离港区ID + */ + @TableField(value = "departure_id") + @ApiModelProperty(hidden = true) + private Long departureId; + + /** + * 司机名称 + */ + @TableField(value = "driver_name") + @ApiModelProperty(value = "司机名称") + private String driverName; + + /** + * 车牌号 + */ + @TableField(value = "car_no") + @ApiModelProperty(value = "车牌号") + private String carNo; + + /** + * 联系电话 + */ + @TableField(value = "contact_phone") + @ApiModelProperty(value = "联系电话") + private String contactPhone; + + @TableField(exist = false) + @ApiModelProperty(hidden = true) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDeparturePlan.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDeparturePlan.java new file mode 100644 index 0000000..3cc7a9a --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerDeparturePlan.java @@ -0,0 +1,77 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 提离港区操作计划表 + * @TableName customer_departure_plan + */ +@TableName(value ="customer_departure_plan") +@Data +@ApiModel(value = "提离港区操作计划表") +public class CustomerDeparturePlan extends BaseEntity implements Serializable { + /** + * 提离港区ID + */ + @TableField(value = "departure_id") + @ApiModelProperty(hidden = true) + private Long departureId; + + /** + * 计划提货时间 + */ + @TableField(value = "pick_time") + @ApiModelProperty(value = "计划提货时间") + private Date pickTime; + + /** + * 品牌ID + */ + @TableField(value = "brand_id") + @ApiModelProperty(value = "品牌ID") + private String brandId; + + /** + * 品牌 + */ + @TableField(value = "brand") + @ApiModelProperty(value = "品牌") + private String brand; + + /** + * 计划车辆数量 + */ + @TableField(value = "car_quantity") + @ApiModelProperty(value = "计划车辆数量") + private Integer carQuantity; + + /** + * 计划备件数量 + */ + @TableField(value = "part_quantity") + @ApiModelProperty(value = "计划备件数量") + private Integer partQuantity; + + /** + * 工作过程 + */ + @TableField(value = "work_status") + @ApiModelProperty(value = "工作过程CODE") + private String workStatus; + + @TableField(value = "work_status_name") + @ApiModelProperty(value = "工作过程") + private String workStatusName; + + @TableField(exist = false) + @ApiModelProperty(hidden = true) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportIn.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportIn.java new file mode 100644 index 0000000..469f669 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportIn.java @@ -0,0 +1,424 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.anno.DbColumn; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.nuzar.cloud.annotation.echo.Echo; +import com.nuzar.rtops.log.annotation.EsLogApproval; +import com.nuzar.rtops.log.annotation.EsLogMean; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * 出口进场基本表 + * @TableName customer_export_in + */ +@TableName(value ="customer_export_in") +@Data +@ApiModel(value = "出口进场基本表") +@EsLogApproval(module = "出口进场审核") +public class CustomerExportIn extends BaseEntity implements Serializable { + /** + * 受理号 + */ + @TableField(value = "batch_no") + @ApiModelProperty(value = "受理号") + private String batchNo; + + /** + * 船名 + */ + @TableField(value = "ship_id") + @ApiModelProperty(value = "船ID") + private String shipId; + + /** + * 中文船名 + */ + @TableField(value = "ship_name") + @ApiModelProperty(value = "中文船名") + @EsLogMean(name = "船名", title = true) + private String shipName; + + /** + * 英文船名 + */ + @TableField(value = "ship_en_name") + @ApiModelProperty(value = "英文船名") + private String shipEnName; + + /** + * 航次ID + */ + @TableField(value = "voyage_id") + @ApiModelProperty(value = "航次ID") + private String voyageId; + + /** + * 航次 + */ + @TableField(value = "voyage") + @ApiModelProperty(value = "航次") + @EsLogMean(name = "航次", title = true) + private String voyage; + + /** + * 港区ID + */ + @TableField(value = "port_area_id") + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + /** + * 港区 + */ + @TableField(value = "port_area") + @ApiModelProperty(value = "港区") + private String portArea; + + /** + * 货代Id + */ + @TableField(value = "freight_id") + @ApiModelProperty(value = "货代ID") + private String freightId; + + /** + * 货代 + */ + @TableField(value = "freight") + @ApiModelProperty(value = "货代") + private String freight; + + /** + * 联系人 + */ + @TableField(value = "contact") + @ApiModelProperty(value = "联系人") + private String contact; + + /** + * 联系方式 + */ + @TableField(value = "contact_phone") + @ApiModelProperty(value = "联系方式") + private String contactPhone; + + /** + * 国家 + */ + @TableField(value = "country_id") + @ApiModelProperty(value = "国家Id") + private String countryId; + + /** + * 国家 + */ + @TableField(value = "country") + @ApiModelProperty(value = "国家") + private String country; + + /** + * 产地ID + */ + @TableField(value = "origin_place_id") + @ApiModelProperty(value = "产地ID") + private String originPlaceId; + + /** + * 产地 + */ + @TableField(value = "origin_place") + @ApiModelProperty(value = "产地") + private String originPlace; + + /** + * 港口ID + */ + @TableField(value = "port_id") + @ApiModelProperty(value = "港口ID") + private String portId; + + /** + * 港口名称 + */ + @TableField(value = "port_name") + @ApiModelProperty(value = "港口名称") + private String portName; + + /** + * 运输方式ID + */ + @TableField(value = "transport_way_id") + @ApiModelProperty(value = "运输方式ID") + private String transportWayId; + + /** + * 运输方式 + */ + @TableField(value = "transport_way") + @ApiModelProperty(value = "运输方式") + private String transportWay; + + /** + * 进场开始时间 + */ + @TableField(value = "begin_enter_time") + @ApiModelProperty(value = "进场开始时间") + private Date beginEnterTime; + + /** + * 进场开始时间 + */ + @TableField(value = "end_enter_time") + @ApiModelProperty(value = "进场结束时间") + private Date endEnterTime; + + /** + * 进场数量 + */ + @TableField(value = "enter_quantity") + @ApiModelProperty(value = "进场数量") + private Integer enterQuantity; + + /** + * 品牌ID + */ + @TableField(value = "brand_id") + @ApiModelProperty(value = "品牌ID") + private String brandId; + + /** + * 品牌 + */ + @TableField(value = "brand") + @ApiModelProperty(value = "品牌") + private String brand; + + /** + * 车型ID + */ + @TableField(value = "cart_type_id") + @ApiModelProperty(value = "车型ID") + private String cartTypeId; + + /** + * 车型 + */ + @TableField(value = "cart_type") + @ApiModelProperty(value = "车型") + private String cartType; + + /** + * 车型明细ID + */ + @TableField(value = "cart_type_detail_id") + @ApiModelProperty(value = "车型明细ID") + private String cartTypeDetailId; + + /** + * 车型明细 + */ + @TableField(value = "cart_type_detail") + @ApiModelProperty(value = "车型明细") + private String cartTypeDetail; + + /** + * 型号 + */ + @TableField(value = "models") + @ApiModelProperty(value = "型号") + private String models; + + /** + * 数量 + */ + @TableField(value = "quantity") + @ApiModelProperty(value = "数量") + private Integer quantity; + + /** + * 单票重量 + */ + @TableField(value = "each_weight") + @ApiModelProperty(value = "单票重量") + private BigDecimal eachWeight; + + /** + * 单票数量 + */ + @TableField(value = "each_quantity") + @ApiModelProperty(value = "单票数量") + private Integer eachQuantity; + + /** + * 单票体积 + */ + @TableField(value = "each_volume") + @ApiModelProperty(value = "单票体积") + private BigDecimal eachVolume; + + /** + * 体积 + */ + @TableField(value = "volume") + @ApiModelProperty(value = "体积") + private BigDecimal volume; + + /** + * 长 + */ + @TableField(value = "length") + @ApiModelProperty(value = "长") + private BigDecimal length; + + /** + * 宽 + */ + @TableField(value = "width") + @ApiModelProperty(value = "宽") + private BigDecimal width; + + /** + * 高 + */ + @TableField(value = "height") + @ApiModelProperty(value = "高") + private BigDecimal height; + + /** + * 重量(吨) + */ + @TableField(value = "weight") + @ApiModelProperty(value = "重量") + private BigDecimal weight; + + /** + * 操作模式ID + */ + @TableField(value = "operate_type_id") + @ApiModelProperty(value = "操作模式ID") + private String operateTypeId; + + /** + * 操作模式 + */ + @TableField(value = "operate_type") + @ApiModelProperty(value = "操作模式") + private String operateType; + + /** + * 提单号 + */ + @TableField(value = "bill_num") + @ApiModelProperty(value = "提单号") + @EsLogMean(name = "提单号", title = true) + private String billNum; + + /** + * 备注 + */ + @TableField(value = "remark") + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 源类型 + */ + @TableField(value = "energy_type") + @ApiModelProperty(value = "源类型") + private String energyType; + + @TableField(value = "energy_type_name") + @ApiModelProperty(value = "源类型名称") + private String energyTypeName; + + /** + * 申请人ID + */ + @Echo(dictDomain = "user", ref = {"applicant"}) + @TableField(value = "applicant_id") + @ApiModelProperty(value = "申请人Id") + private String applicantId; + + /** + * 申请人 + */ + @TableField(value = "applicant") + @ApiModelProperty(value = "申请人") + private String applicant; + + + /** + * 申请时间 + */ + @TableField(value = "apply_time") + @ApiModelProperty(value = "申请时间") + private Date applyTime; + + + /** + * 审核人ID + */ + @Echo(dictDomain = "user", ref = {"checkMan"}) + @TableField(value = "check_man_id") + @ApiModelProperty(value = "审核人ID") + private String checkManId; + + /** + * 审核人 + */ + @TableField(value = "check_man") + @ApiModelProperty(value = "审核人") + private String checkMan; + + /** + * 审核时间 + */ + @TableField(value = "check_time") + @ApiModelProperty(value = "审核时间") + private Date checkTime; + + /** + * 审核状态 + */ + @TableField(value = "check_status") + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @TableField(value = "check_result") + @ApiModelProperty(value = "审核原因") + private String checkResult; + + @TableField(exist = false) + @ApiModelProperty(value = "车架号列表") + @DbColumn(column = "id") + private List vins; + + @TableField(exist = false) + @ApiModelProperty(value = "出口进场时间列表") + private List times; + + @TableField(exist = false) + @ApiModelProperty(value = "出口进场车辆列表") + private List cargos; + + @TableField(exist = false) + @ApiModelProperty(value = "出口进场备件列表") + private List spares; + + @TableField(exist = false) + @ApiModelProperty(hidden = true) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportInCargo.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportInCargo.java new file mode 100644 index 0000000..d98193e --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportInCargo.java @@ -0,0 +1,110 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 出口进场货物表 + * @TableName customer_export_in_cargo + */ +@TableName(value ="customer_export_in_cargo") +@Data +@ApiModel(value = "出口进场货物表") +public class CustomerExportInCargo extends BaseEntity implements Serializable { + /** + * 出口进场ID + */ + @TableField(value = "export_in_id") + @ApiModelProperty(hidden = true) + private Long exportInId; + + /** + * 货物类型ID,0代表车辆,1代表备件 + */ + @TableField(value = "cargo_type") + @ApiModelProperty(hidden = true) + private Integer cargoType; + + /** + * 作业状态 + */ + @TableField(value = "work_status") + @ApiModelProperty(value = "作业状态") + private String workStatus; + + /** + * 品牌ID + */ + @TableField(exist = false) + @ApiModelProperty(value = "品牌ID") + private String brandId; + + /** + * 品牌 + */ + @TableField(exist = false) + @ApiModelProperty(value = "品牌") + private String brand; + + /** + * 车型ID + */ + @TableField(exist = false) + @ApiModelProperty(value = "车型ID") + private String cartTypeId; + + /** + * 车型 + */ + @TableField(exist = false) + @ApiModelProperty(value = "车型") + private String cartType; + + @TableField(exist = false) + @ApiModelProperty(value = "中文船名") + private String shipName; + + @TableField(exist = false) + @ApiModelProperty(value = "英文船名") + private String shipEnName; + + @TableField(exist = false) + @ApiModelProperty(value = "提单号") + private String billNum; + + @TableField(exist = false) + @ApiModelProperty(value = "航次") + private String voyage; + + @TableField(exist = false) + @ApiModelProperty(value = "型号") + private String models; + + /** + * 车辆状态 + */ + @TableField(value = "vin_status") + @ApiModelProperty(value = "车辆状态") + private Integer vinStatus; + + /** + * 车架号 + */ + @TableField(value = "vin") + @ApiModelProperty(value = "车架号") + private String vin; + + @TableField(exist = false) + @ApiModelProperty(value = "进港记录") + private CustomerExportIn exportIn; + + @TableField(exist = false) + @ApiModelProperty(hidden = true) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportInTimes.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportInTimes.java new file mode 100644 index 0000000..7c57c07 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportInTimes.java @@ -0,0 +1,45 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 出口进场时间表 + * @TableName customer_export_in_times + */ +@TableName(value ="customer_export_in_times") +@Data +@ApiModel(value = "出口进场时间表") +public class CustomerExportInTimes extends BaseEntity implements Serializable { + /** + * 出口进场ID + */ + @TableField(value = "export_in_id") + @ApiModelProperty(hidden = true) + private Long exportInId; + + /** + * 进场时间 + */ + @TableField(value = "enter_time") + @ApiModelProperty(value = "进场时间") + private Date enterTime; + + /** + * 进场数量 + */ + @TableField(value = "enter_quantity") + @ApiModelProperty(value = "进场数量") + private Integer enterQuantity; + + @TableField(exist = false) + @ApiModelProperty(hidden = true) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportInspect.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportInspect.java new file mode 100644 index 0000000..c749369 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportInspect.java @@ -0,0 +1,241 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import com.haitonggauto.rtosc.common.dto.DictDTO; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.haitonggauto.rtosc.repository.enums.InspectStatusEnum; +import com.nuzar.cloud.annotation.echo.Echo; +import com.nuzar.rtops.log.annotation.EsLogApproval; +import com.nuzar.rtops.log.annotation.EsLogMean; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 出口查验表 + * @TableName customer_export_inspect + */ +@TableName(value ="customer_export_inspect") +@Data +@ApiModel(value = "出口查验表") +@EsLogApproval(module = "出口查验审核") +public class CustomerExportInspect extends BaseEntity implements Serializable { + /** + * 受理号 + */ + @TableField(value = "batch_no") + @ApiModelProperty(value = "受理号") + private String batchNo; + + /** + * 进出口类型 + */ + @TableField(value = "trad_type") + @ApiModelProperty(value = "进出口类型") + private String tradType; + + /** + * 船名 + */ + @TableField(value = "ship_id") + @ApiModelProperty(value = "船ID") + private String shipId; + + /** + * 中文船名 + */ + @TableField(value = "ship_name") + @ApiModelProperty(value = "中文船名") + @EsLogMean(name = "船名", title = true) + private String shipName; + + /** + * 英文船名 + */ + @TableField(value = "ship_en_name") + @ApiModelProperty(value = "英文船名") + private String shipEnName; + + /** + * 航次ID + */ + @TableField(value = "voyage_id") + @ApiModelProperty(value = "航次ID") + private String voyageId; + + /** + * 航次 + */ + @TableField(value = "voyage") + @ApiModelProperty(value = "航次") + @EsLogMean(name = "航次", title = true) + private String voyage; + + /** + * 港区ID + */ + @TableField(value = "port_area_id") + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + /** + * 港区 + */ + @TableField(value = "port_area") + @ApiModelProperty(value = "港区") + private String portArea; + + /** + * 提单号 + */ + @TableField(value = "bill_no") + @ApiModelProperty(value = "提单号") + @EsLogMean(name = "提单号", title = true) + private String billNo; + + /** + * 报关单号 + */ + @TableField(value = "passport") + @ApiModelProperty(value = "报关单号") + private String passport; + + /** + * 查验日期 + */ + @TableField(value = "inspect_time") + @ApiModelProperty(value = "查验日期") + private Date inspectTime; + + /** + * 查验车辆数 + */ + @TableField(value = "planned_cargo_quantity") + @ApiModelProperty(value = "查验车辆数") + private Integer plannedCargoQuantity; + + /** + * 查验备件数 + */ + @TableField(value = "planned_spare_quantity") + @ApiModelProperty(value = "查验备件数") + private Integer plannedSpareQuantity; + + /** + * 查验状态 + */ + @TableField(value = "inspect_status") + @ApiModelProperty(value = "查验状态") + private InspectStatusEnum inspectStatus; + + @TableField(exist = false) + @ApiModelProperty(value = "通过接口获取的查验状态") + private String apiInspectStatus; + + /** + * 公司名 + */ + @TableField(value = "company") + @ApiModelProperty(value = "公司名") + private String company; + + /** + * 申请对象(从基础数据库获取客户类型为进口货代的数据) + */ + @TableField(value = "apply_obj_id") + @ApiModelProperty(value = "申请对象ID") + private String applyObjId; + + /** + * 申请对象(从基础数据库获取客户类型为进口货代的数据) + */ + @TableField(value = "apply_obj") + @ApiModelProperty(value = "申请对象") + private String applyObj; + + /** + * 联系人 + */ + @TableField(value = "contact") + @ApiModelProperty(value = "联系人") + private String contact; + + /** + * 联系电话 + */ + @TableField(value = "contact_phone") + @ApiModelProperty(value = "联系电话") + private String contactPhone; + + /** + * 申请人ID + */ + @Echo(dictDomain = "user", ref = {"applicant"}) + @TableField(value = "applicant_id") + @ApiModelProperty(value = "申请人Id") + private String applicantId; + + /** + * 申请人 + */ + @TableField(value = "applicant") + @ApiModelProperty(value = "申请人") + private String applicant; + + /** + * 申请时间 + */ + @TableField(value = "apply_time") + @ApiModelProperty(value = "申请时间") + private Date applyTime; + + /** + * 审核人ID + */ + @Echo(dictDomain = "user", ref = {"checkMan"}) + @TableField(value = "check_man_id") + @ApiModelProperty(value = "审核人ID") + private String checkManId; + + /** + * 审核人 + */ + @TableField(value = "check_man") + @ApiModelProperty(value = "审核人") + private String checkMan; + + /** + * 审核时间 + */ + @TableField(value = "check_time") + @ApiModelProperty(value = "审核时间") + private Date checkTime; + + /** + * 审核状态 + */ + @TableField(value = "check_status") + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @TableField(value = "check_reason") + @ApiModelProperty(value = "审核原因") + private String checkReason; + + @TableField(exist = false) + @ApiModelProperty(value = "车辆/备件列表") + private List cargos; + + @TableField(exist = false) + @ApiModelProperty(hidden = true) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportInspectCargo.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportInspectCargo.java new file mode 100644 index 0000000..8aaa9c1 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportInspectCargo.java @@ -0,0 +1,87 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 出口查验货物表 + * @TableName customer_export_inspect_cargo + */ +@TableName(value ="customer_export_inspect_cargo") +@Data +@ApiModel(value = "出口查验货物表") +public class CustomerExportInspectCargo extends BaseEntity implements Serializable { + /** + * 出口查验ID + */ + @TableField(value = "export_inspect_id") + @ApiModelProperty(hidden = true) + private Long exportInspectId; + + /** + * 货物类型ID,0代表车辆,1代表备件 + */ + @TableField(value = "cargo_type") + @ApiModelProperty(hidden = true) + private Integer cargoType; + + /** + * 品牌ID + */ + @TableField(value = "brand_id") + @ApiModelProperty(value = "品牌ID") + private String brandId; + + /** + * 品牌 + */ + @TableField(value = "brand") + @ApiModelProperty(value = "品牌") + private String brand; + + /** + * 车型ID + */ + @TableField(value = "cart_type_id") + @ApiModelProperty(value = "车型ID") + private String cartTypeId; + + /** + * 车型 + */ + @TableField(value = "cart_type") + @ApiModelProperty(value = "车型") + private String cartType; + + /** + * 车架号 + */ + @TableField(value = "vin") + @ApiModelProperty(value = "车架号") + private String vin; + + /** + * 区域ID + */ + @ApiModelProperty(value = "区域ID") + @TableField(value = "area_id") + private String areaId; + + /** + * 区域( 从基础数据获取区道位信息) + */ + @ApiModelProperty(value = "区域") + @TableField(value = "area") + private String area; + + + @TableField(exist = false) + @ApiModelProperty(hidden = true) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportLoad.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportLoad.java new file mode 100644 index 0000000..d58b551 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportLoad.java @@ -0,0 +1,242 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.anno.DbColumn; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.nuzar.cloud.annotation.echo.Echo; +import com.nuzar.rtops.log.annotation.EsLogApproval; +import com.nuzar.rtops.log.annotation.EsLogMean; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 出口装船表 + * @TableName customer_export_load + */ +@TableName(value ="customer_export_load") +@Data +@ApiModel(value = "出口装船表") +@EsLogApproval(module = "出口装船审核") +public class CustomerExportLoad extends BaseEntity implements Serializable { + /** + * 受理号 + */ + @TableField(value = "batch_no") + @ApiModelProperty(value = "受理号") + private String batchNo; + + /** + * 贸易类型 + */ + @TableField(value = "trad_type") + @ApiModelProperty(value = "贸易类型") + private String tradType; + + /** + * 船名 + */ + @TableField(value = "ship_id") + @ApiModelProperty(value = "船ID") + private String shipId; + + /** + * 中文船名 + */ + @TableField(value = "ship_name") + @ApiModelProperty(value = "中文船名") + @EsLogMean(name = "船名", title = true) + private String shipName; + + /** + * 英文船名 + */ + @TableField(value = "ship_en_name") + @ApiModelProperty(value = "英文船名") + private String shipEnName; + + /** + * 航次ID + */ + @TableField(value = "voyage_id") + @ApiModelProperty(value = "航次ID") + private String voyageId; + + /** + * 航次 + */ + @TableField(value = "voyage") + @ApiModelProperty(value = "航次") + @EsLogMean(name = "航次", title = true) + private String voyage; + + /** + * 港区ID + */ + @TableField(value = "port_area_id") + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + /** + * 港区 + */ + @TableField(value = "port_area") + @ApiModelProperty(value = "港区") + private String portArea; + + /** + * 提单号 + */ + @TableField(value = "bill_no") + @ApiModelProperty(value = "提单号") + @EsLogMean(name = "提单号", title = true) + private String billNo; + + /** + * 品牌ID + */ + @TableField(value = "brand_id") + @ApiModelProperty(value = "品牌ID") + private String brandId; + + /** + * 品牌 + */ + @TableField(value = "brand") + @ApiModelProperty(value = "品牌") + private String brand; + + /** + * 数量 + */ + @TableField(value = "quantity") + @ApiModelProperty(value = "数量") + private Integer quantity; + + /** + * 备件数 + */ + @TableField(value = "spare_quantity") + @ApiModelProperty(value = "备件数量") + private Integer spareQuantity; + + /** + * 备件数 + */ + @TableField(value = "dest_port_id") + @ApiModelProperty(value = "目的港ID(内贸)") + private String destPortId; + + /** + * 备件数 + */ + @TableField(value = "dest_port") + @ApiModelProperty(value = "目的港(内贸)") + private String destPort; + + // 如果是内贸 + /** + * 结算单位ID + */ + @TableField(value = "settle_comp_id") + @ApiModelProperty(value = "结算单位ID") + private String settleCompId; + + /** + * 结算单位名称 + */ + @TableField(value = "settle_comp_name") + @ApiModelProperty(value = "结算单位") + private String settleCompName; + + /** + * 联系人 + */ + @TableField(value = "contact") + @ApiModelProperty(value = "联系人") + private String contact; + + /** + * 联系方式 + */ + @TableField(value = "contact_phone") + @ApiModelProperty(value = "联系方式") + private String contactPhone; + + /** + * 申请人ID + */ + @Echo(dictDomain = "user", ref = {"applicant"}) + @TableField(value = "applicant_id") + @ApiModelProperty(value = "申请人Id") + private String applicantId; + + /** + * 申请人 + */ + @TableField(value = "applicant") + @ApiModelProperty(value = "申请人") + private String applicant; + + /** + * 申请时间 + */ + @TableField(value = "apply_time") + @ApiModelProperty(value = "申请时间") + private Date applyTime; + + /** + * 审核人ID + */ + @Echo(dictDomain = "user", ref = {"checkMan"}) + @TableField(value = "check_man_id") + @ApiModelProperty(value = "审核人ID") + private String checkManId; + + /** + * 审核人 + */ + @TableField(value = "check_man") + @ApiModelProperty(value = "审核人") + private String checkMan; + + /** + * 审核时间 + */ + @TableField(value = "check_time") + @ApiModelProperty(value = "审核时间") + private Date checkTime; + + /** + * 审核状态 + */ + @TableField(value = "check_status") + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @TableField(value = "check_result") + @ApiModelProperty(value = "审核原因") + private String checkResult; + + @TableField(exist = false) + @ApiModelProperty(value = "车架号列表") + @DbColumn(column = "id") + private List vins; + + @TableField(exist = false) + @ApiModelProperty(value = "车辆/备件列表") + private List cargos; + + @TableField(exist = false) + @ApiModelProperty(hidden = true) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportLoadCargo.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportLoadCargo.java new file mode 100644 index 0000000..a260f85 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportLoadCargo.java @@ -0,0 +1,83 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 出口装船货物表 + * @TableName customer_export_load_cargo + */ +@TableName(value ="customer_export_load_cargo") +@Data +@ApiModel(value = "出口装船货物表") +public class CustomerExportLoadCargo extends BaseEntity implements Serializable { + /** + * 出口装船ID + */ + @TableField(value = "export_load_id") + @ApiModelProperty(hidden = true) + private Long exportLoadId; + + /** + * 货物类型ID,0代表车辆,1代表备件 + */ + @TableField(value = "cargo_type") + @ApiModelProperty(hidden = true) + private Integer cargoType; + + /** + * 品牌ID + */ + @TableField(value = "brand_id") + @ApiModelProperty(value = "品牌ID") + private String brandId; + + /** + * 品牌 + */ + @TableField(value = "brand") + @ApiModelProperty(value = "品牌") + private String brand; + + /** + * 型号 + */ + @TableField(value = "models") + @ApiModelProperty(value = "型号") + private String models; + + /** + * 车架号/条码 + */ + @TableField(value = "vin") + @ApiModelProperty(value = "车架号/条码") + private String vin; + + /** + * 车辆状态 + */ + @TableField(value = "vin_status") + @ApiModelProperty(value = "车辆状态") + private Integer vinStatus; + + /** + * 作业状态(未进港:未收车扫描, 已收车:收车扫描作业完成, 已理货:理货作业完成, 已装船:装船作业完成, 退关:退关扫描完成, 退运:退运扫描完成) + */ + @TableField(value = "work_status") + @ApiModelProperty(value = "作业状态") + private String workStatus; + + @TableField(exist = false) + @ApiModelProperty(value = "基本信息") + private CustomerExportLoad exportLoad; + + @TableField(exist = false) + @ApiModelProperty(hidden = true) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportLoadCheck.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportLoadCheck.java new file mode 100644 index 0000000..258c27c --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerExportLoadCheck.java @@ -0,0 +1,121 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 出口装船审核明细表 + * @TableName customer_export_load_check + */ +@TableName(value ="customer_export_load_check") +@Data +@ApiModel(value = "出口装船审核明细表") +public class CustomerExportLoadCheck extends BaseEntity implements Serializable { + /** + * 出口装船ID + */ + @TableField(value = "export_load_id") + @ApiModelProperty(hidden = true) + private Long exportLoadId; + + /** + * 货物类型ID,0代表车辆,1代表备件 + */ + @TableField(value = "cargo_type") + @ApiModelProperty(hidden = true) + private Integer cargoType; + + /** + * 品牌ID + */ + @TableField(value = "brand_id") + @ApiModelProperty(value = "品牌ID") + private String brandId; + + /** + * 品牌 + */ + @TableField(value = "brand") + @ApiModelProperty(value = "品牌") + private String brand; + + /** + * 型号 + */ + @TableField(value = "models") + @ApiModelProperty(value = "型号") + private String models; + + /** + * 车架号/条码 + */ + @TableField(value = "vin") + @ApiModelProperty(value = "车架号/条码") + private String vin; + + /** + * 船名 + */ + @TableField(value = "ship_id") + @ApiModelProperty(value = "船ID") + private String shipId; + + /** + * 中文船名 + */ + @TableField(value = "ship_name") + @ApiModelProperty(value = "中文船名") + private String shipName; + + /** + * 英文船名 + */ + @TableField(value = "ship_en_name") + @ApiModelProperty(value = "英文船名") + private String shipEnName; + + /** + * 航次ID + */ + @TableField(value = "voyage_id") + @ApiModelProperty(value = "航次ID") + private String voyageId; + + /** + * 航次 + */ + @TableField(value = "voyage") + @ApiModelProperty(value = "航次") + private String voyage; + + /** + * 提单号 + */ + @TableField(value = "bill_no") + @ApiModelProperty(value = "提单号") + private String billNo; + + /** + * 匹配结果 + */ + @TableField(value = "result") + @ApiModelProperty(value = "匹配结果") + private String result; + + /** + * 失败原因 + */ + @TableField(value = "reason") + @ApiModelProperty(value = "失败原因") + private String reason; + + @TableField(exist = false) + @ApiModelProperty(hidden = true) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerFreeTrade.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerFreeTrade.java new file mode 100644 index 0000000..652abec --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerFreeTrade.java @@ -0,0 +1,231 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import com.haitonggauto.rtosc.repository.enums.ActiveEnum; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.nuzar.cloud.annotation.echo.Echo; +import com.nuzar.rtops.log.annotation.EsLogApproval; +import com.nuzar.rtops.log.annotation.EsLogMean; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 特保区基本信息表 + * @TableName customer_free_trade + */ +@TableName(value ="customer_free_trade") +@Data +@ApiModel(value = "特保区基本信息表") +@EsLogApproval(module = "特保区审核") +public class CustomerFreeTrade extends BaseEntity implements Serializable { + /** + * 批次号 + */ + @TableField(value = "batch_no") + @ApiModelProperty(value = "批次号") + @EsLogMean(name = "批次号", title = true) + private String batchNo; + + /** + * 港区ID + */ + @TableField(value = "port_area_id") + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + /** + * 港区 + */ + @TableField(value = "port_area") + @ApiModelProperty(value = "港区") + private String portArea; + + /** + * 企业编码 + */ + @TableField(value = "company_code") + @ApiModelProperty(value = "企业编码") + private String companyCode; + + /** + * 企业社会信用代码 + */ + @TableField(value = "company_social_code") + @ApiModelProperty(value = "企业社会信用代码") + private String companySocialCode; + + /** + * 企业名称 + */ + @TableField(value = "company_name") + @ApiModelProperty(value = "企业名称") + private String companyName; + + /** + * 国家 + */ + @TableField(value = "country") + @ApiModelProperty(value = "国家") + private String country; + + /** + * 城市 + */ + @TableField(value = "city") + @ApiModelProperty(value = "城市") + private String city; + + /** + * 商品料号 + */ + @TableField(value = "cargo_item_no") + @ApiModelProperty(value = "商品料号") + private String cargoItemNo; + + /** + * 商品编码 + */ + @TableField(value = "cargo_code") + @ApiModelProperty(value = "商品编码") + private String cargoCode; + + /** + * 商品名称 + */ + @TableField(value = "cargo_name") + @ApiModelProperty(value = "商品名称") + private String cargoName; + + /** + * 规格型号 + */ + @TableField(value = "spec") + @ApiModelProperty(value = "规格型号") + private String spec; + + /** + * 币制 + */ + @TableField(value = "currency") + @ApiModelProperty(value = "币制") + private String currency; + + /** + * 总价 + */ + @TableField(value = "total_price") + @ApiModelProperty(value = "总价") + private BigDecimal totalPrice; + + /** + * 净重 + */ + @TableField(value = "net_weight") + @ApiModelProperty(value = "净重") + private BigDecimal netWeight; + + /** + * 申报计量单位 + */ + @TableField(value = "unit_measure") + @ApiModelProperty(value = "申报计量单位") + private String unitMeasure; + + /** + * 法定单位 + */ + @TableField(value = "unit_legal") + @ApiModelProperty(value = "法定单位") + private String unitLegal; + + /** + * 原产国 + */ + @TableField(value = "origin_area") + @ApiModelProperty(value = "原产国") + private String originArea; + + /** + * 车架号 + */ + @TableField(value = "vin") + @ApiModelProperty(value = "车架号") + private String vin; + + /** + * 是否激活 + */ + @TableField(value = "is_activate") + @ApiModelProperty(value = "是否激活") + private ActiveEnum isActivate; + + /** + * 申请人ID + */ + @Echo(dictDomain = "user", ref = {"applicant"}) + @TableField(value = "applicant_id") + @ApiModelProperty(value = "申请人Id") + private String applicantId; + + /** + * 申请人 + */ + @TableField(value = "applicant") + @ApiModelProperty(value = "申请人") + private String applicant; + + + /** + * 申请时间 + */ + @TableField(value = "apply_time") + @ApiModelProperty(value = "申请时间") + private Date applyTime; + + /** + * 审核人ID + */ + @Echo(dictDomain = "user", ref = {"checkMan"}) + @TableField(value = "check_man_id") + @ApiModelProperty(value = "审核人ID") + private String checkManId; + + /** + * 审核人 + */ + @TableField(value = "check_man") + @ApiModelProperty(value = "审核人") + private String checkMan; + + /** + * 审核时间 + */ + @TableField(value = "check_time") + @ApiModelProperty(value = "审核时间") + private Date checkTime; + + /** + * 审核状态 + */ + @TableField(value = "check_status") + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @TableField(value = "check_result") + @ApiModelProperty(value = "审核原因") + private String checkResult; + + @TableField(exist = false) + @ApiModelProperty(hidden = true) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportTake.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportTake.java new file mode 100644 index 0000000..be27de5 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportTake.java @@ -0,0 +1,217 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import com.nuzar.cloud.annotation.echo.Echo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 进口提货表 + * @TableName customer_import_take + */ +@TableName(value ="customer_import_take") +@Data +@ApiModel(value = "进口提货表") +public class CustomerImportTake extends BaseEntity implements Serializable { + /** + * 受理号 + */ + @TableField(value = "batch_no") + @ApiModelProperty(value = "受理号") + private String batchNo; + + /** + * 贸易类型 + */ + @TableField(value = "trad_type") + @ApiModelProperty(value = "贸易类型") + private String tradType; + + /** + * 船名 + */ + @TableField(value = "ship_id") + @ApiModelProperty(value = "船ID") + private String shipId; + + /** + * 中文船名 + */ + @TableField(value = "ship_name") + @ApiModelProperty(value = "中文船名") + private String shipName; + + /** + * 英文船名 + */ + @TableField(value = "ship_en_name") + @ApiModelProperty(value = "英文船名") + private String shipEnName; + + /** + * 航次ID + */ + @TableField(value = "voyage_id") + @ApiModelProperty(value = "航次ID") + private String voyageId; + + /** + * 航次 + */ + @TableField(value = "voyage") + @ApiModelProperty(value = "航次") + private String voyage; + + /** + * 港区ID + */ + @TableField(value = "port_area_id") + @ApiModelProperty(value = "港区ID") + private String portAreaId; + + /** + * 港区 + */ + @TableField(value = "port_area") + @ApiModelProperty(value = "港区") + private String portArea; + + /** + * 提车总数 + */ + @TableField(value = "take_car_num") + @ApiModelProperty(value = "提车总数") + private Integer takeCarNum; + + /** + * 计划备件数 + */ + @TableField(value = "plan_spare_num") + @ApiModelProperty(value = "计划备件数") + private Integer planSpareNum; + + /** + * 计划车辆数 + */ + @TableField(value = "plan_car_num") + @ApiModelProperty(value = "计划车辆数") + private Integer planCarNum; + + /** + * 货物进场时间 + */ + @TableField(value = "cargo_enter_time") + @ApiModelProperty(value = "货物进场时间") + private Date cargoEnterTime; + + /** + * 船舶到港日期 + */ + @TableField(value = "ship_enter_time") + @ApiModelProperty(value = "船舶到港日期") + private Date shipEnterTime; + + /** + * 作业时间 + */ + @TableField(value = "job_time") + @ApiModelProperty(value = "作业时间") + private Date jobTime; + + /** + * 通关性质 + */ + @TableField(value = "clearance_type") + @ApiModelProperty(value = "通关性质") + private Integer clearanceType; + + /** + * 收货单位ID + */ + @TableField(value = "consignee_id") + @ApiModelProperty(value = "收货单位ID") + private String consigneeId; + + /** + * 收货单位 + */ + @TableField(value = "consignee") + @ApiModelProperty(value = "收货单位") + private String consignee; + + /** + * 付款单位Id + */ + @TableField(value = "payer_id") + @ApiModelProperty(value = "付款单位Id") + private String payerId; + + /** + * 付款单位 + */ + @TableField(value = "payer") + @ApiModelProperty(value = "付款单位") + private String payer; + + /** + * 联系人 + */ + @TableField(value = "link_man") + @ApiModelProperty(value = "联系人") + private String linkMan; + + /** + * 联系电话 + */ + @TableField(value = "phone") + @ApiModelProperty(value = "联系电话") + private String phone; + + /** + * 备注 + */ + @TableField(value = "remark") + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 申请人ID + */ + @Echo(dictDomain = "user", ref = {"applicant"}) + @TableField(value = "applicant_id") + @ApiModelProperty(value = "申请人ID") + private String applicantId; + + /** + * 申请人 + */ + @TableField(value = "applicant") + @ApiModelProperty(value = "申请人") + private String applicant; + + /** + * 申请时间 + */ + @TableField(value = "apply_time") + @ApiModelProperty(value = "申请时间") + private Date applyTime; + + @TableField(exist = false) + @ApiModelProperty(value = "进口提货作业模式列表") + private List jobs; + + @TableField(exist = false) + @ApiModelProperty(value = "车辆/备件列表") + private List cargos; + + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportTakeCargo.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportTakeCargo.java new file mode 100644 index 0000000..64e22f8 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportTakeCargo.java @@ -0,0 +1,139 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import java.io.Serializable; +import java.util.Date; + +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.nuzar.cloud.annotation.echo.Echo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 进口提货货物表 + * @TableName customer_import_take_cargo + */ +@TableName(value ="customer_import_take_cargo") +@Data +@ApiModel(value = "进口提货货物表") +public class CustomerImportTakeCargo extends BaseEntity implements Serializable { + /** + * 卸船ID + */ + @TableField(value = "import_take_id") + @ApiModelProperty(value = "进口提货ID") + private Long importTakeId; + + /** + * 货物类型ID,0代表车辆,1代表备件 + */ + @TableField(value = "cargo_type") + @ApiModelProperty(hidden = true) + private Integer cargoType; + + /** + * 品牌ID + */ + @TableField(value = "brand_id") + @ApiModelProperty(value = "品牌ID") + private String brandId; + + /** + * 品牌 + */ + @TableField(value = "brand") + @ApiModelProperty(value = "品牌") + private String brand; + + /** + * 查验 + */ + @TableField(value = "examine") + @ApiModelProperty(value = "查验") + private Integer examine; + + /** + * 受理 + */ + @TableField(value = "accept") + @ApiModelProperty(value = "受理") + private Integer accept; + + /** + * 提单号 + */ + @TableField(value = "bill_no") + @ApiModelProperty(value = "提单号") + private String billNo; + + /** + * 报关单号 + */ + @TableField(value = "customs_no") + @ApiModelProperty(value = "报关单号") + private String customsNo; + + /** + * 车辆数量 + */ + @TableField(value = "car_num") + @ApiModelProperty(value = "车辆数量") + private Integer carNum; + + /** + * 备件数量 + */ + @TableField(value = "spare_num") + @ApiModelProperty(value = "备件数量") + private Integer spareNum; + + /** + * 总数 + */ + @TableField(value = "total_num") + @ApiModelProperty(value = "总数") + private Integer totalNum; + + /** + * 审核人ID + */ + @Echo(dictDomain = "user", ref = {"checkMan"}) + @TableField(value = "check_man_id") + @ApiModelProperty(value = "审核人ID") + private String checkManId; + + /** + * 审核人 + */ + @TableField(value = "check_man") + @ApiModelProperty(value = "审核人") + private String checkMan; + + /** + * 审核时间 + */ + @TableField(value = "check_time") + @ApiModelProperty(value = "审核时间") + private Date checkTime; + + /** + * 审核状态 + */ + @TableField(value = "check_status") + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @TableField(value = "check_result") + @ApiModelProperty(value = "审核原因") + private String checkResult; + + @TableField(exist = false) + private CustomerImportTake importTake; + +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportTakeJob.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportTakeJob.java new file mode 100644 index 0000000..0fdcb09 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportTakeJob.java @@ -0,0 +1,58 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 进口提货作业模式 + * @TableName customer_import_take_job + */ +@TableName(value ="customer_import_take_job") +@Data +@ApiModel(value = "进口提货作业模式") +public class CustomerImportTakeJob extends BaseEntity implements Serializable { + /** + * 进口提货ID + */ + @TableField(value = "import_take_id") + @ApiModelProperty(value = "进口提货ID") + private Long importTakeId; + + /** + * 类型 + */ + @TableField(value = "job_type") + @ApiModelProperty(value = "类型") + private Integer jobType; + + /** + * 作业过程 + */ + @TableField(value = "job_process") + @ApiModelProperty(value = "作业过程") + private String jobProcess; + + /** + * 作业方式 + */ + @TableField(value = "job_mode") + @ApiModelProperty(value = "作业方式") + private String jobMode; + + /** + * 使用机械 + */ + @TableField(value = "job_machine") + @ApiModelProperty(value = "使用机械") + private String jobMachine; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportUnload.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportUnload.java new file mode 100644 index 0000000..ffa347d --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportUnload.java @@ -0,0 +1,173 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.nuzar.cloud.annotation.echo.Echo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 进口卸船表 + * @TableName customer_import_unload + */ +@TableName(value ="customer_import_unload") +@Data +@ApiModel(value = "进口卸船表") +public class CustomerImportUnload extends BaseEntity implements Serializable { + /** + * 受理号 + */ + @TableField(value = "batch_no") + @ApiModelProperty(value = "受理号") + private String batchNo; + + /** + * 贸易类型 + */ + @TableField(value = "trad_type") + @ApiModelProperty(value = "贸易类型") + private String tradType; + + /** + * 船ID + */ + @TableField(value = "ship_id") + @ApiModelProperty(value = "船ID") + private String shipId; + + /** + * 中文船名 + */ + @TableField(value = "ship_name") + @ApiModelProperty(value = "中文船名") + private String shipName; + + /** + * 英文船名 + */ + @TableField(value = "ship_en_name") + @ApiModelProperty(value = "英文船名") + private String shipEnName; + + /** + * 航次ID + */ + @TableField(value = "voyage_id") + @ApiModelProperty(value = "航次ID") + private String voyageId; + + /** + * 航次 + */ + @TableField(value = "voyage") + @ApiModelProperty(value = "航次") + private String voyage; + + /** + * 提单号 + */ + @TableField(value = "bill_no") + @ApiModelProperty(value = "提单号") + private String billNo; + + /** + * 品牌ID + */ + @TableField(value = "brand_id") + @ApiModelProperty(value = "品牌ID") + private String brandId; + + /** + * 品牌 + */ + @TableField(value = "brand") + @ApiModelProperty(value = "品牌") + private String brand; + + /** + * 数量 + */ + @TableField(value = "quantity") + @ApiModelProperty(value = "数量") + private Integer quantity; + + /** + * 备件数 + */ + @TableField(value = "spare_quantity") + @ApiModelProperty(value = "备件数量") + private Integer spareQuantity; + + /** + * 申请人ID + */ + @Echo(dictDomain = "user", ref = {"applicant"}) + @TableField(value = "applicant_id") + @ApiModelProperty(value = "申请人Id") + private String applicantId; + + /** + * 申请人 + */ + @TableField(value = "applicant") + @ApiModelProperty(value = "申请人") + private String applicant; + + /** + * 申请时间 + */ + @TableField(value = "apply_time") + @ApiModelProperty(value = "申请时间") + private Date applyTime; + + /** + * 审核人ID + */ + @Echo(dictDomain = "user", ref = {"checkMan"}) + @TableField(value = "check_man_id") + @ApiModelProperty(value = "审核人ID") + private String checkManId; + + /** + * 审核人 + */ + @TableField(value = "check_man") + @ApiModelProperty(value = "审核人") + private String checkMan; + + /** + * 审核时间 + */ + @TableField(value = "check_time") + @ApiModelProperty(value = "审核时间") + private Date checkTime; + + /** + * 审核状态 + */ + @TableField(value = "check_status") + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + /** + * 审核原因 + */ + @TableField(value = "check_result") + @ApiModelProperty(value = "审核原因") + private String checkResult; + + @TableField(exist = false) + @ApiModelProperty(value = "车辆/备件列表") + private List cargos; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportUnloadCargo.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportUnloadCargo.java new file mode 100644 index 0000000..d2409f9 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerImportUnloadCargo.java @@ -0,0 +1,80 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 进口卸船货物表 + * @TableName customer_import_unload_cargo + */ +@TableName(value ="customer_import_unload_cargo") +@Data +@ApiModel(value = "进口卸船货物表") +public class CustomerImportUnloadCargo extends BaseEntity implements Serializable { + /** + * 卸船ID + */ + @TableField(value = "import_unload_id") + @ApiModelProperty(value = "受理号") + private Long importUnloadId; + + /** + * 货物类型ID,0代表车辆,1代表备件 + */ + @TableField(value = "cargo_type") + @ApiModelProperty(hidden = true) + private Integer cargoType; + + /** + * 品牌ID + */ + @TableField(value = "brand_id") + @ApiModelProperty(value = "品牌ID") + private String brandId; + + /** + * 品牌 + */ + @TableField(value = "brand") + @ApiModelProperty(value = "品牌") + private String brand; + + + /** + * 型号 + */ + @TableField(value = "models") + @ApiModelProperty(value = "型号") + private String models; + + /** + * 车架号 + */ + @TableField(value = "vin") + @ApiModelProperty(value = "车架号") + private String vin; + + /** + * 车辆状态 + */ + @TableField(value = "vin_status") + @ApiModelProperty(value = "车辆状态") + private Integer vinStatus; + + /** + * 作业状态 + */ + @TableField(value = "work_status") + @ApiModelProperty(value = "作业状态") + private String workStatus; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerLinkman.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerLinkman.java new file mode 100644 index 0000000..314f850 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/CustomerLinkman.java @@ -0,0 +1,57 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 提离港区基本信息表 + * @TableName customer_linkman + */ +@TableName(value ="customer_linkman") +@Data +@ApiModel("联系人") +public class CustomerLinkman extends BaseEntity implements Serializable { + /** + * 货代 + */ + @TableField(value = "freight") + @ApiModelProperty(value ="货代") + private String freight; + + /** + * 联系人 + */ + @TableField(value = "contact") + @ApiModelProperty(value ="联系人") + private String contact; + + /** + * 联系方式 + */ + @TableField(value = "contact_phone") + @ApiModelProperty(value ="联系方式") + private String contactPhone; + + /** + * 外勤联系人 + */ + @TableField(value = "field_contact") + @ApiModelProperty(value ="外勤联系人") + private String fieldContact; + + /** + * 外勤联系方式 + */ + @TableField(value = "field_contact_phone") + @ApiModelProperty(value ="外勤联系方式") + private String fieldContactPhone; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysPerm.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysPerm.java new file mode 100644 index 0000000..e6c5e93 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysPerm.java @@ -0,0 +1,29 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import lombok.Data; + +/** + * 系统权限表 + * @TableName sys_perm + */ +@TableName(value ="sys_perm") +@Data +public class SysPerm extends BaseEntity { + /** + * 编码,8个字符 + */ + private String code; + + /** + * 权限名称 + */ + private String name; + + /** + * 备注 + */ + private String remark; + +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysRole.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysRole.java new file mode 100644 index 0000000..cca3c00 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysRole.java @@ -0,0 +1,33 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import lombok.Data; + +/** + * 系统角色表 + * @TableName sys_role + */ +@TableName(value ="sys_role") +@Data +public class SysRole extends BaseEntity { + /** + * 角色名称 + */ + private String name; + + /** + * 备注 + */ + private String remark; + + /** + * 角色类型 + */ + private String roleType; + + /** + * 状态 + */ + private String status; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysRoleData.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysRoleData.java new file mode 100644 index 0000000..de19ef7 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysRoleData.java @@ -0,0 +1,29 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import lombok.Data; + +/** + * 系统角色数据权限表 + * @TableName sys_role_data + */ +@TableName(value ="sys_role_data") +@Data +public class SysRoleData extends BaseEntity { + /** + * 类名 + */ + private String className; + + /** + * 字典ID + */ + private String dataIds; + + /** + * 角色ID + */ + private Long roleId; + +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysRoleField.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysRoleField.java new file mode 100644 index 0000000..66df3ca --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysRoleField.java @@ -0,0 +1,29 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import lombok.Data; + +/** + * 系统角色字段权限表 + * @TableName sys_role_field + */ +@TableName(value ="sys_role_field") +@Data +public class SysRoleField extends BaseEntity { + /** + * 类名 + */ + private String className; + + /** + * 类属性 + */ + private String excludeFields; + + /** + * 角色ID + */ + private Long roleId; + +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysRolePerm.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysRolePerm.java new file mode 100644 index 0000000..885ccb2 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysRolePerm.java @@ -0,0 +1,23 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import lombok.Data; + +/** + * 系统角色操作权限表 + * @TableName sys_role_perm + */ +@TableName(value ="sys_role_perm") +@Data +public class SysRolePerm extends BaseEntity { + /** + * 操作权限 + */ + private String perms; + + /** + * 角色ID + */ + private Long roleId; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysSequenceNo.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysSequenceNo.java new file mode 100644 index 0000000..2a08bca --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysSequenceNo.java @@ -0,0 +1,62 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import com.haitonggauto.rtosc.repository.enums.SequenceTypeEnum; +import lombok.Data; + +import java.util.Date; + +/** + * 序列号规则表 + * @TableName sys_sequence_no + */ +@TableName(value ="sys_sequence_no") +@Data +public class SysSequenceNo extends BaseEntity { + /** + * 编码 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 当前值 + */ + private Long curValue; + + /** + * 当前时间 + */ + private Date genDate; + + /** + * 递增值 + */ + private Integer incValue; + + /** + * 前缀 + */ + private String prefixStr; + + /** + * 序列长度 + */ + private Integer sequenceLength; + + /** + * 年度度,2或者4 + */ + private Integer yearLength; + + /** + * 年或月或日 + */ + private SequenceTypeEnum sequenceType; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysUser.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysUser.java new file mode 100644 index 0000000..dba3938 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysUser.java @@ -0,0 +1,39 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import com.haitonggauto.rtosc.repository.enums.StatusEnum; +import lombok.Data; + +/** + * 系统用户表 + * @TableName sys_user + */ +@TableName(value ="sys_user") +@Data +public class SysUser extends BaseEntity { + /** + * 真实姓名 + */ + private String name; + + /** + * 用户名 + */ + private String username; + + /** + * 密码 + */ + private String password; + + /** + * 手机号码 + */ + private String phone; + + /** + * 状态 + */ + private StatusEnum status; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysUserData.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysUserData.java new file mode 100644 index 0000000..cccbbee --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysUserData.java @@ -0,0 +1,29 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import lombok.Data; + +/** + * 系统用户数据权限表 + * @TableName sys_user_data + */ +@TableName(value ="sys_user_data") +@Data +public class SysUserData extends BaseEntity { + /** + * 类名 + */ + private String className; + + /** + * 字典ID + */ + private String dataIds; + + /** + * 用户ID + */ + private Long userId; + +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysUserField.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysUserField.java new file mode 100644 index 0000000..82b7044 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysUserField.java @@ -0,0 +1,29 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import lombok.Data; + +/** + * 系统角色字段权限表 + * @TableName sys_user_field + */ +@TableName(value ="sys_user_field") +@Data +public class SysUserField extends BaseEntity { + /** + * 类名 + */ + private String className; + + /** + * 类属性 + */ + private String excludeFields; + + /** + * 用户ID + */ + private Long userId; + +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysUserRole.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysUserRole.java new file mode 100644 index 0000000..f27e1d7 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/entity/SysUserRole.java @@ -0,0 +1,23 @@ +package com.haitonggauto.rtosc.repository.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.haitonggauto.rtosc.common.db.entity.BaseEntity; +import lombok.Data; + +/** + * 系统角色字段权限表 + * @TableName sys_user_role + */ +@TableName(value ="sys_user_role") +@Data +public class SysUserRole extends BaseEntity { + /** + * 角色ID + */ + private String roleIds; + + /** + * 用户ID + */ + private Long userId; +} \ No newline at end of file diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/ActiveEnum.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/ActiveEnum.java new file mode 100644 index 0000000..3cc8090 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/ActiveEnum.java @@ -0,0 +1,34 @@ +package com.haitonggauto.rtosc.repository.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.haitonggauto.rtosc.common.enums.BaseEnum; + +/** + * 数据状态 + */ +public enum ActiveEnum implements BaseEnum { + SUBMIT(0, "待提交"), + YES(1, "已激活"), + NO(2, "待激活") + ; + + @EnumValue + private int id; + private String text; + + private ActiveEnum(int id, String text) { + this.id = id; + this.text = text; + } + + + @Override + public String text() { + return text; + } + + @Override + public Integer id() { + return id; + } +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/AuditEnum.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/AuditEnum.java new file mode 100644 index 0000000..9e1b6d8 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/AuditEnum.java @@ -0,0 +1,35 @@ +package com.haitonggauto.rtosc.repository.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.haitonggauto.rtosc.common.enums.BaseEnum; + +/** + * 数据状态 + */ +public enum AuditEnum implements BaseEnum { + SUBMIT(0, "待提交"), + AUDIT(1, "待审核"), + AUDIT_PASS(2, "审核通过"), + AUDIT_REJECT(3, "审核拒绝") + ; + + @EnumValue + private int id; + private String text; + + private AuditEnum(int id, String text) { + this.id = id; + this.text = text; + } + + + @Override + public String text() { + return text; + } + + @Override + public Integer id() { + return id; + } +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/BjOperEnum.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/BjOperEnum.java new file mode 100644 index 0000000..54d68dc --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/BjOperEnum.java @@ -0,0 +1,34 @@ +package com.haitonggauto.rtosc.repository.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.haitonggauto.rtosc.common.enums.BaseEnum; + +/** + * 车辆操作模式 + */ +public enum BjOperEnum implements BaseEnum { + FORKLIFT(0, "铲车"), + CRANE(1, "吊车"), + FLOAT(2, "浮吊") + ; + + @EnumValue + private int id; + private String text; + + private BjOperEnum(int id, String text) { + this.id = id; + this.text = text; + } + + + @Override + public String text() { + return text; + } + + @Override + public Integer id() { + return id; + } +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/CarOperEnum.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/CarOperEnum.java new file mode 100644 index 0000000..b95f3da --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/CarOperEnum.java @@ -0,0 +1,33 @@ +package com.haitonggauto.rtosc.repository.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.haitonggauto.rtosc.common.enums.BaseEnum; + +/** + * 车辆操作模式 + */ +public enum CarOperEnum implements BaseEnum { + MACH(0, "港机作业"), + SELF(1, "客户自开") + ; + + @EnumValue + private int id; + private String text; + + private CarOperEnum(int id, String text) { + this.id = id; + this.text = text; + } + + + @Override + public String text() { + return text; + } + + @Override + public Integer id() { + return id; + } +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/InspectStatusEnum.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/InspectStatusEnum.java new file mode 100644 index 0000000..496fff4 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/InspectStatusEnum.java @@ -0,0 +1,34 @@ +package com.haitonggauto.rtosc.repository.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.haitonggauto.rtosc.common.enums.BaseEnum; + +/** + * 数据状态 + */ +public enum InspectStatusEnum implements BaseEnum { + NO_INSPECT(0, "待查验"), + INSPECTING(1, "查验中"), + INSPECTED(2, "查验完成") + ; + + @EnumValue + private int id; + private String text; + + private InspectStatusEnum(int id, String text) { + this.id = id; + this.text = text; + } + + + @Override + public String text() { + return text; + } + + @Override + public Integer id() { + return id; + } +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/RoleTypeEnum.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/RoleTypeEnum.java new file mode 100644 index 0000000..bdb2444 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/RoleTypeEnum.java @@ -0,0 +1,34 @@ +package com.haitonggauto.rtosc.repository.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.haitonggauto.rtosc.common.enums.BaseEnum; + +/** + * 角色类型 + */ +public enum RoleTypeEnum implements BaseEnum { + ADMIN(0, "系统管理员"), + COMMON_ADMIN(1, "管理员"), // 可以传递,角色内可操作的权限 + USER(2, "普通用户") + ; + + @EnumValue + private int id; + private String text; + + private RoleTypeEnum(int id, String text) { + this.id = id; + this.text = text; + } + + + @Override + public String text() { + return text; + } + + @Override + public Integer id() { + return id; + } +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/SequenceTypeEnum.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/SequenceTypeEnum.java new file mode 100644 index 0000000..5e91103 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/SequenceTypeEnum.java @@ -0,0 +1,35 @@ +package com.haitonggauto.rtosc.repository.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.haitonggauto.rtosc.common.enums.BaseEnum; + +public enum SequenceTypeEnum implements BaseEnum { + + YEAR(1, "年"), + MONTH(2, "月"), + DAY(3, "日"), + HOUR(4, "时"), + MINUTE(5, "分"), + SECOND(6, "秒") + ; + + @EnumValue + private int id; + private String text; + + private SequenceTypeEnum(int id, String text) { + this.id = id; + this.text = text; + } + + + @Override + public String text() { + return text; + } + + @Override + public Integer id() { + return id; + } +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/StatusEnum.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/StatusEnum.java new file mode 100644 index 0000000..fc3f302 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/enums/StatusEnum.java @@ -0,0 +1,33 @@ +package com.haitonggauto.rtosc.repository.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.haitonggauto.rtosc.common.enums.BaseEnum; + +/** + * 数据状态 + */ +public enum StatusEnum implements BaseEnum { + YES(0, "启用"), + NO(1, "禁用") + ; + + @EnumValue + private int id; + private String text; + + private StatusEnum(int id, String text) { + this.id = id; + this.text = text; + } + + + @Override + public String text() { + return text; + } + + @Override + public Integer id() { + return id; + } +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerDepartureCargoMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerDepartureCargoMapper.java new file mode 100644 index 0000000..9bd26fa --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerDepartureCargoMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerDepartureCargo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author dj +* @description 针对表【customer_departure_cargo(提离港区货物表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:30 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerDepartureCargo +*/ +public interface CustomerDepartureCargoMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerDepartureDriversMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerDepartureDriversMapper.java new file mode 100644 index 0000000..39e9aaf --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerDepartureDriversMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerDepartureDrivers; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author dj +* @description 针对表【customer_departure_drivers(提离港区司机表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:30 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerDepartureDrivers +*/ +public interface CustomerDepartureDriversMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerDepartureMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerDepartureMapper.java new file mode 100644 index 0000000..bdae26a --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerDepartureMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerDeparture; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author dj +* @description 针对表【customer_departure(提离港区基本信息表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:30 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerDeparture +*/ +public interface CustomerDepartureMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerDeparturePlanMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerDeparturePlanMapper.java new file mode 100644 index 0000000..da5ec21 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerDeparturePlanMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerDeparturePlan; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author dj +* @description 针对表【customer_departure_plan(提离港区操作计划表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:30 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerDeparturePlan +*/ +public interface CustomerDeparturePlanMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInCargoMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInCargoMapper.java new file mode 100644 index 0000000..eddddf7 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInCargoMapper.java @@ -0,0 +1,23 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerExportInCargo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.repository.query.PrintQuery; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_export_in_cargo(出口进场货物表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:30 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerExportInCargo +*/ +public interface CustomerExportInCargoMapper extends BaseMapper { + + List getListByVoyageId(PrintQuery query); +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInMapper.java new file mode 100644 index 0000000..3034f47 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInMapper.java @@ -0,0 +1,27 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerExportIn; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_export_in(出口进场基本表)】的数据库操作Mapper +* @createDate 2023-08-30 17:15:27 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerExportIn +*/ +public interface CustomerExportInMapper extends BaseMapper { + + /** + * @param voyageId + * @return + */ + List getListByVoyageId(@Param("voyageId") String voyageId, @Param("status") AuditEnum status); +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInTimesMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInTimesMapper.java new file mode 100644 index 0000000..607af3a --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInTimesMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerExportInTimes; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author dj +* @description 针对表【customer_export_in_times(出口进场时间表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:31 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerExportInTimes +*/ +public interface CustomerExportInTimesMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInspectCargoMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInspectCargoMapper.java new file mode 100644 index 0000000..b92c852 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInspectCargoMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerExportInspectCargo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author dj +* @description 针对表【customer_export_inspect_cargo(出口查验货物表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:31 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerExportInspectCargo +*/ +public interface CustomerExportInspectCargoMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInspectMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInspectMapper.java new file mode 100644 index 0000000..8152079 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportInspectMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerExportInspect; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author dj +* @description 针对表【customer_export_inspect(出口查验表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:31 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerExportInspect +*/ +public interface CustomerExportInspectMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportLoadCargoMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportLoadCargoMapper.java new file mode 100644 index 0000000..7804493 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportLoadCargoMapper.java @@ -0,0 +1,21 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerExportLoadCargo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_export_load_cargo(出口装船货物表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:31 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerExportLoadCargo +*/ +public interface CustomerExportLoadCargoMapper extends BaseMapper { + List getListByVoyageId(@Param("voyageId") String voyageId); +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportLoadCheckMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportLoadCheckMapper.java new file mode 100644 index 0000000..e0d8e70 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportLoadCheckMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerExportLoadCheck; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author dj +* @description 针对表【customer_export_load_check(出口装船审核明细表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:31 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerExportLoadCheck +*/ +public interface CustomerExportLoadCheckMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportLoadMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportLoadMapper.java new file mode 100644 index 0000000..f443839 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerExportLoadMapper.java @@ -0,0 +1,27 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.haitonggauto.rtosc.repository.entity.CustomerExportLoad; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_export_load(出口装船表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:31 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerExportLoad +*/ +public interface CustomerExportLoadMapper extends BaseMapper { + + List getListByVoyageId(@Param("voyageId") String voyageId, @Param("status") AuditEnum status); + + Page getReceiveCarShipList(@Param("page") Page page, @Param("q") String q); +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerFreeTradeMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerFreeTradeMapper.java new file mode 100644 index 0000000..840dfdb --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerFreeTradeMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerFreeTrade; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author dj +* @description 针对表【customer_free_trade(特保区基本信息表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:31 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerFreeTrade +*/ +public interface CustomerFreeTradeMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportTakeCargoMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportTakeCargoMapper.java new file mode 100644 index 0000000..994538d --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportTakeCargoMapper.java @@ -0,0 +1,37 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.haitonggauto.rtosc.repository.entity.CustomerImportTakeCargo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.repository.query.ImportTakeQuery; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_import_take_cargo(进口提货货物表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:31 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerImportTakeCargo +*/ +public interface CustomerImportTakeCargoMapper extends BaseMapper { + /** + * 关联查询 + * @param query + * @return + */ + List getImportTakeCargoList(ImportTakeQuery query); + + /** + * 分页查询 + * @param page + * @param query + * @return + */ + IPage getImportTakeCargoPage(@Param("page")IPage page, @Param("query") ImportTakeQuery query); + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportTakeJobMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportTakeJobMapper.java new file mode 100644 index 0000000..2cacde4 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportTakeJobMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerImportTakeJob; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author dj +* @description 针对表【customer_import_take_job(进口提货作业模式)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:31 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerImportTakeJob +*/ +public interface CustomerImportTakeJobMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportTakeMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportTakeMapper.java new file mode 100644 index 0000000..b2fbc33 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportTakeMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerImportTake; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author dj +* @description 针对表【customer_import_take(进口提货表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:31 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerImportTake +*/ +public interface CustomerImportTakeMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportUnloadCargoMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportUnloadCargoMapper.java new file mode 100644 index 0000000..5c2ddeb --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportUnloadCargoMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerImportUnloadCargo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author dj +* @description 针对表【customer_import_unload_cargo(进口卸船货物表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:32 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerImportUnloadCargo +*/ +public interface CustomerImportUnloadCargoMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportUnloadMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportUnloadMapper.java new file mode 100644 index 0000000..8124da5 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerImportUnloadMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerImportUnload; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author dj +* @description 针对表【customer_import_unload(进口卸船表)】的数据库操作Mapper +* @createDate 2023-08-30 14:32:31 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerImportUnload +*/ +public interface CustomerImportUnloadMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerLinkmanMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerLinkmanMapper.java new file mode 100644 index 0000000..5da2714 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/CustomerLinkmanMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.haitonggauto.rtosc.repository.entity.CustomerLinkman; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author dj +* @description 针对表【customer_linkman(提离港区基本信息表)】的数据库操作Mapper +* @createDate 2023-09-09 09:10:45 +* @Entity com.haitonggauto.rtosc.repository.entity.CustomerLinkman +*/ +public interface CustomerLinkmanMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/OrderMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/OrderMapper.java new file mode 100644 index 0000000..7c491c2 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/OrderMapper.java @@ -0,0 +1,16 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.nuzar.cloud.mapper.CommonMapper; +import com.haitonggauto.rtosc.repository.dataobject.OrderDO; + +/** + *

+ * Mapper 接口 + *

+ * + * @author hanson + * @since 2023-01-05 + */ +public interface OrderMapper extends CommonMapper { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysPermMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysPermMapper.java new file mode 100644 index 0000000..1a18158 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysPermMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.repository.entity.SysPerm; + +/** +* @author dj +* @description 针对表【sys_perm(系统权限表)】的数据库操作Mapper +* @createDate 2023-04-26 21:16:14 +* @Entity com.wsnet.move.entity.SysPerm +*/ +public interface SysPermMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysRoleDataMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysRoleDataMapper.java new file mode 100644 index 0000000..5000dad --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysRoleDataMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.repository.entity.SysRoleData; + +/** +* @author dj +* @description 针对表【sys_role_data(系统角色数据权限表)】的数据库操作Mapper +* @createDate 2023-04-26 21:16:14 +* @Entity com.wsnet.move.entity.SysRoleData +*/ +public interface SysRoleDataMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysRoleFieldMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysRoleFieldMapper.java new file mode 100644 index 0000000..780f3e5 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysRoleFieldMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.repository.entity.SysRoleField; + +/** +* @author dj +* @description 针对表【sys_role_field(系统角色字段权限表)】的数据库操作Mapper +* @createDate 2023-04-26 21:16:14 +* @Entity com.wsnet.move.entity.SysRoleField +*/ +public interface SysRoleFieldMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysRoleMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysRoleMapper.java new file mode 100644 index 0000000..f815c3c --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysRoleMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.repository.entity.SysRole; + +/** +* @author dj +* @description 针对表【sys_role(系统角色表)】的数据库操作Mapper +* @createDate 2023-04-26 21:16:14 +* @Entity com.wsnet.move.entity.SysRole +*/ +public interface SysRoleMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysRolePermMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysRolePermMapper.java new file mode 100644 index 0000000..57c14b3 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysRolePermMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.repository.entity.SysRolePerm; + +/** +* @author dj +* @description 针对表【sys_role_perm(系统角色操作权限表)】的数据库操作Mapper +* @createDate 2023-04-26 21:16:14 +* @Entity com.wsnet.move.entity.SysRolePerm +*/ +public interface SysRolePermMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysSequenceNoMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysSequenceNoMapper.java new file mode 100644 index 0000000..8105547 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysSequenceNoMapper.java @@ -0,0 +1,19 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.repository.entity.SysSequenceNo; + +/** +* @author dj +* @description 针对表【sys_sequence_no(序列号规则表)】的数据库操作Mapper +* @createDate 2023-04-26 21:16:14 +* @Entity com.wsnet.move.entity.SysSequenceNo +*/ +public interface SysSequenceNoMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysUserDataMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysUserDataMapper.java new file mode 100644 index 0000000..707836d --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysUserDataMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.repository.entity.SysUserData; + +/** +* @author dj +* @description 针对表【sys_user_data(系统用户数据权限表)】的数据库操作Mapper +* @createDate 2023-04-26 21:16:14 +* @Entity com.wsnet.move.entity.SysUserData +*/ +public interface SysUserDataMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysUserFieldMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysUserFieldMapper.java new file mode 100644 index 0000000..93c5df6 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysUserFieldMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.repository.entity.SysUserField; + +/** +* @author dj +* @description 针对表【sys_user_field(系统角色字段权限表)】的数据库操作Mapper +* @createDate 2023-04-26 21:16:14 +* @Entity com.wsnet.move.entity.SysUserField +*/ +public interface SysUserFieldMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysUserMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysUserMapper.java new file mode 100644 index 0000000..0b4d73e --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysUserMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.repository.entity.SysUser; + +/** +* @author dj +* @description 针对表【sys_user(系统用户表)】的数据库操作Mapper +* @createDate 2023-04-26 21:16:14 +* @Entity com.wsnet.move.entity.SysUser +*/ +public interface SysUserMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysUserRoleMapper.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysUserRoleMapper.java new file mode 100644 index 0000000..2be547a --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/mapper/SysUserRoleMapper.java @@ -0,0 +1,18 @@ +package com.haitonggauto.rtosc.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.haitonggauto.rtosc.repository.entity.SysUserRole; + +/** +* @author dj +* @description 针对表【sys_user_role(系统角色字段权限表)】的数据库操作Mapper +* @createDate 2023-04-26 21:16:14 +* @Entity com.wsnet.move.entity.SysUserRole +*/ +public interface SysUserRoleMapper extends BaseMapper { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/query/ImportTakeQuery.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/query/ImportTakeQuery.java new file mode 100644 index 0000000..653bf18 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/query/ImportTakeQuery.java @@ -0,0 +1,44 @@ +package com.haitonggauto.rtosc.repository.query; + +import com.haitonggauto.rtosc.common.db.anno.DbQuery; +import com.haitonggauto.rtosc.common.db.enums.SqlSymbol; +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 java.util.List; + + +@Data +@ApiModel(value = "进口提货查询") +public class ImportTakeQuery extends BaseQuery { + + @ApiModelProperty(value = "港区") + private String portArea; + + @ApiModelProperty(value = "船名") + private String shipName; + + @ApiModelProperty(value = "航次") + private String voyage; + + @ApiModelProperty(value = "贸易类型") + private String tradType; + + @ApiModelProperty(value = "审核状态") + private AuditEnum checkStatus; + + @ApiModelProperty(value = "审核状态", hidden = true) + private List checkStatusList; + + @ApiModelProperty(value = "提单号") + @DbQuery(symbol = SqlSymbol.LIKE) + private String billNo; + + @ApiModelProperty(value = "受理号") + @DbQuery(symbol = SqlSymbol.LIKE) + private String batchNo; + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/query/PrintQuery.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/query/PrintQuery.java new file mode 100644 index 0000000..da86a42 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/query/PrintQuery.java @@ -0,0 +1,21 @@ +package com.haitonggauto.rtosc.repository.query; + +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 PrintQuery implements Serializable { + @ApiModelProperty("航次ID") + private String voyageId; + + @ApiModelProperty("提单号列表") + private List billNo; + + @ApiModelProperty("货物ID列表") + private List id; +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerDepartureCargoService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerDepartureCargoService.java new file mode 100644 index 0000000..aaa1018 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerDepartureCargoService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerDepartureCargo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author dj +* @description 针对表【customer_departure_cargo(提离港区货物表)】的数据库操作Service +* @createDate 2023-08-30 14:32:30 +*/ +public interface CustomerDepartureCargoService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerDepartureDriversService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerDepartureDriversService.java new file mode 100644 index 0000000..19f707d --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerDepartureDriversService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerDepartureDrivers; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author dj +* @description 针对表【customer_departure_drivers(提离港区司机表)】的数据库操作Service +* @createDate 2023-08-30 14:32:30 +*/ +public interface CustomerDepartureDriversService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerDeparturePlanService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerDeparturePlanService.java new file mode 100644 index 0000000..85bc227 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerDeparturePlanService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerDeparturePlan; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author dj +* @description 针对表【customer_departure_plan(提离港区操作计划表)】的数据库操作Service +* @createDate 2023-08-30 14:32:30 +*/ +public interface CustomerDeparturePlanService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerDepartureService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerDepartureService.java new file mode 100644 index 0000000..f98bb76 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerDepartureService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerDeparture; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author dj +* @description 针对表【customer_departure(提离港区基本信息表)】的数据库操作Service +* @createDate 2023-08-30 14:32:30 +*/ +public interface CustomerDepartureService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInCargoService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInCargoService.java new file mode 100644 index 0000000..6b7b0b2 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInCargoService.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerExportInCargo; +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.repository.query.PrintQuery; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_export_in_cargo(出口进场货物表)】的数据库操作Service +* @createDate 2023-08-30 14:32:31 +*/ +public interface CustomerExportInCargoService extends IService { + + /** + * 查询审核通过后的进港记录,连接查询 + * @param query + * @return + */ + List getListByVoyageId(PrintQuery query); +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInService.java new file mode 100644 index 0000000..4a555fa --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInService.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerExportIn; +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_export_in(出口进场基本表)】的数据库操作Service +* @createDate 2023-08-30 17:15:27 +*/ +public interface CustomerExportInService extends IService { + + /** + * 通过航次ID查询所有的提单 + * @param voyageId + * @return + */ + List getListByVoyageId(String voyageId, AuditEnum status); +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInTimesService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInTimesService.java new file mode 100644 index 0000000..1d94599 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInTimesService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerExportInTimes; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author dj +* @description 针对表【customer_export_in_times(出口进场时间表)】的数据库操作Service +* @createDate 2023-08-30 14:32:31 +*/ +public interface CustomerExportInTimesService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInspectCargoService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInspectCargoService.java new file mode 100644 index 0000000..1498612 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInspectCargoService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerExportInspectCargo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author dj +* @description 针对表【customer_export_inspect_cargo(出口查验货物表)】的数据库操作Service +* @createDate 2023-08-30 14:32:31 +*/ +public interface CustomerExportInspectCargoService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInspectService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInspectService.java new file mode 100644 index 0000000..e8a89b8 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportInspectService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerExportInspect; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author dj +* @description 针对表【customer_export_inspect(出口查验表)】的数据库操作Service +* @createDate 2023-08-30 14:32:31 +*/ +public interface CustomerExportInspectService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportLoadCargoService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportLoadCargoService.java new file mode 100644 index 0000000..da081ef --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportLoadCargoService.java @@ -0,0 +1,20 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerExportLoadCargo; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_export_load_cargo(出口装船货物表)】的数据库操作Service +* @createDate 2023-08-30 14:32:31 +*/ +public interface CustomerExportLoadCargoService extends IService { + /** + * 根据航次ID查询装船的清单 + * @param voyageId + * @return + */ + List getListByVoyageId(String voyageId); +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportLoadCheckService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportLoadCheckService.java new file mode 100644 index 0000000..0ac0b70 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportLoadCheckService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerExportLoadCheck; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author dj +* @description 针对表【customer_export_load_check(出口装船审核明细表)】的数据库操作Service +* @createDate 2023-08-30 14:32:31 +*/ +public interface CustomerExportLoadCheckService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportLoadService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportLoadService.java new file mode 100644 index 0000000..d3ceda7 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerExportLoadService.java @@ -0,0 +1,30 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.haitonggauto.rtosc.repository.entity.CustomerExportLoad; +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_export_load(出口装船表)】的数据库操作Service +* @createDate 2023-08-30 14:32:31 +*/ +public interface CustomerExportLoadService extends IService { + /** + * 通过航次ID查询提单列表 + * @param voyageId + * @return + */ + List getListByVoyageId(String voyageId, AuditEnum status); + + /** + * 收车凭证: 进港申请(审核通过)、装船申请(审核通过 + * @param page + * @param q + * @return + */ + Page getReceiveCarShipList(Page page, String q); +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerFreeTradeService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerFreeTradeService.java new file mode 100644 index 0000000..ea35b51 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerFreeTradeService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerFreeTrade; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author dj +* @description 针对表【customer_free_trade(特保区基本信息表)】的数据库操作Service +* @createDate 2023-08-30 14:32:31 +*/ +public interface CustomerFreeTradeService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportTakeCargoService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportTakeCargoService.java new file mode 100644 index 0000000..8936edc --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportTakeCargoService.java @@ -0,0 +1,31 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.haitonggauto.rtosc.repository.entity.CustomerImportTakeCargo; +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.repository.query.ImportTakeQuery; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_import_take_cargo(进口提货货物表)】的数据库操作Service +* @createDate 2023-08-30 14:32:31 +*/ +public interface CustomerImportTakeCargoService extends IService { + + /** + * 关联查询 + * @param query + * @return + */ + List getImportTakeCargoList(ImportTakeQuery query); + + /** + * 分页查询 + * @param page + * @param query + * @return + */ + IPage getImportTakeCargoPage(IPage page, ImportTakeQuery query); +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportTakeJobService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportTakeJobService.java new file mode 100644 index 0000000..f935b8d --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportTakeJobService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerImportTakeJob; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author dj +* @description 针对表【customer_import_take_job(进口提货作业模式)】的数据库操作Service +* @createDate 2023-08-30 14:32:31 +*/ +public interface CustomerImportTakeJobService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportTakeService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportTakeService.java new file mode 100644 index 0000000..9ab55a2 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportTakeService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerImportTake; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author dj +* @description 针对表【customer_import_take(进口提货表)】的数据库操作Service +* @createDate 2023-08-30 14:32:31 +*/ +public interface CustomerImportTakeService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportUnloadCargoService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportUnloadCargoService.java new file mode 100644 index 0000000..953a66b --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportUnloadCargoService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerImportUnloadCargo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author dj +* @description 针对表【customer_import_unload_cargo(进口卸船货物表)】的数据库操作Service +* @createDate 2023-08-30 14:32:32 +*/ +public interface CustomerImportUnloadCargoService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportUnloadService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportUnloadService.java new file mode 100644 index 0000000..c7a7862 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerImportUnloadService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerImportUnload; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author dj +* @description 针对表【customer_import_unload(进口卸船表)】的数据库操作Service +* @createDate 2023-08-30 14:32:31 +*/ +public interface CustomerImportUnloadService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerLinkmanService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerLinkmanService.java new file mode 100644 index 0000000..555c3b0 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/CustomerLinkmanService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.haitonggauto.rtosc.repository.entity.CustomerLinkman; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author dj +* @description 针对表【customer_linkman(提离港区基本信息表)】的数据库操作Service +* @createDate 2023-09-09 09:10:45 +*/ +public interface CustomerLinkmanService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/OrderRepository.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/OrderRepository.java new file mode 100644 index 0000000..290d559 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/OrderRepository.java @@ -0,0 +1,16 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.nuzar.cloud.mapper.CommonService; +import com.haitonggauto.rtosc.repository.dataobject.OrderDO; + +/** + *

+ * 服务类 + *

+ * + * @author hanson + * @since 2022-12-29 + */ +public interface OrderRepository extends CommonService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysPermService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysPermService.java new file mode 100644 index 0000000..a0930e7 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysPermService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.repository.entity.SysPerm; + +/** +* @author dj +* @description 针对表【sys_perm(系统权限表)】的数据库操作Service +* @createDate 2023-04-26 21:16:14 +*/ +public interface SysPermService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysRoleDataService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysRoleDataService.java new file mode 100644 index 0000000..5966be8 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysRoleDataService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.repository.entity.SysRoleData; + +/** +* @author dj +* @description 针对表【sys_role_data(系统角色数据权限表)】的数据库操作Service +* @createDate 2023-04-26 21:16:14 +*/ +public interface SysRoleDataService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysRoleFieldService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysRoleFieldService.java new file mode 100644 index 0000000..8bb58a2 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysRoleFieldService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.repository.entity.SysRoleField; + +/** +* @author dj +* @description 针对表【sys_role_field(系统角色字段权限表)】的数据库操作Service +* @createDate 2023-04-26 21:16:14 +*/ +public interface SysRoleFieldService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysRolePermService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysRolePermService.java new file mode 100644 index 0000000..b07454c --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysRolePermService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.repository.entity.SysRolePerm; + +/** +* @author dj +* @description 针对表【sys_role_perm(系统角色操作权限表)】的数据库操作Service +* @createDate 2023-04-26 21:16:14 +*/ +public interface SysRolePermService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysRoleService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysRoleService.java new file mode 100644 index 0000000..0662579 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysRoleService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.repository.entity.SysRole; + +/** +* @author dj +* @description 针对表【sys_role(系统角色表)】的数据库操作Service +* @createDate 2023-04-26 21:16:14 +*/ +public interface SysRoleService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysSequenceNoService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysSequenceNoService.java new file mode 100644 index 0000000..a6e1e42 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysSequenceNoService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.repository.entity.SysSequenceNo; + +/** +* @author dj +* @description 针对表【sys_sequence_no(序列号规则表)】的数据库操作Service +* @createDate 2023-04-26 21:16:14 +*/ +public interface SysSequenceNoService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysUserDataService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysUserDataService.java new file mode 100644 index 0000000..20c781a --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysUserDataService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.repository.entity.SysUserData; + +/** +* @author dj +* @description 针对表【sys_user_data(系统用户数据权限表)】的数据库操作Service +* @createDate 2023-04-26 21:16:14 +*/ +public interface SysUserDataService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysUserFieldService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysUserFieldService.java new file mode 100644 index 0000000..90cade8 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysUserFieldService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.repository.entity.SysUserField; + +/** +* @author dj +* @description 针对表【sys_user_field(系统角色字段权限表)】的数据库操作Service +* @createDate 2023-04-26 21:16:14 +*/ +public interface SysUserFieldService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysUserRoleService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysUserRoleService.java new file mode 100644 index 0000000..9cab794 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysUserRoleService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.repository.entity.SysUserRole; + +/** +* @author dj +* @description 针对表【sys_user_role(系统角色字段权限表)】的数据库操作Service +* @createDate 2023-04-26 21:16:14 +*/ +public interface SysUserRoleService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysUserService.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysUserService.java new file mode 100644 index 0000000..81a0945 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/SysUserService.java @@ -0,0 +1,13 @@ +package com.haitonggauto.rtosc.repository.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.haitonggauto.rtosc.repository.entity.SysUser; + +/** +* @author dj +* @description 针对表【sys_user(系统用户表)】的数据库操作Service +* @createDate 2023-04-26 21:16:14 +*/ +public interface SysUserService extends IService { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerDepartureCargoServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerDepartureCargoServiceImpl.java new file mode 100644 index 0000000..bc4884b --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerDepartureCargoServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerDepartureCargo; +import com.haitonggauto.rtosc.repository.service.CustomerDepartureCargoService; +import com.haitonggauto.rtosc.repository.mapper.CustomerDepartureCargoMapper; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【customer_departure_cargo(提离港区货物表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:30 +*/ +@Service +public class CustomerDepartureCargoServiceImpl extends ServiceImpl + implements CustomerDepartureCargoService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerDepartureDriversServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerDepartureDriversServiceImpl.java new file mode 100644 index 0000000..1b1ed47 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerDepartureDriversServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerDepartureDrivers; +import com.haitonggauto.rtosc.repository.service.CustomerDepartureDriversService; +import com.haitonggauto.rtosc.repository.mapper.CustomerDepartureDriversMapper; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【customer_departure_drivers(提离港区司机表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:30 +*/ +@Service +public class CustomerDepartureDriversServiceImpl extends ServiceImpl + implements CustomerDepartureDriversService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerDeparturePlanServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerDeparturePlanServiceImpl.java new file mode 100644 index 0000000..7450093 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerDeparturePlanServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerDeparturePlan; +import com.haitonggauto.rtosc.repository.service.CustomerDeparturePlanService; +import com.haitonggauto.rtosc.repository.mapper.CustomerDeparturePlanMapper; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【customer_departure_plan(提离港区操作计划表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:30 +*/ +@Service +public class CustomerDeparturePlanServiceImpl extends ServiceImpl + implements CustomerDeparturePlanService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerDepartureServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerDepartureServiceImpl.java new file mode 100644 index 0000000..141ee94 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerDepartureServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerDeparture; +import com.haitonggauto.rtosc.repository.service.CustomerDepartureService; +import com.haitonggauto.rtosc.repository.mapper.CustomerDepartureMapper; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【customer_departure(提离港区基本信息表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:30 +*/ +@Service +public class CustomerDepartureServiceImpl extends ServiceImpl + implements CustomerDepartureService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInCargoServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInCargoServiceImpl.java new file mode 100644 index 0000000..0179180 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInCargoServiceImpl.java @@ -0,0 +1,29 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerExportInCargo; +import com.haitonggauto.rtosc.repository.query.PrintQuery; +import com.haitonggauto.rtosc.repository.service.CustomerExportInCargoService; +import com.haitonggauto.rtosc.repository.mapper.CustomerExportInCargoMapper; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_export_in_cargo(出口进场货物表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:31 +*/ +@Service +public class CustomerExportInCargoServiceImpl extends ServiceImpl + implements CustomerExportInCargoService{ + + @Override + public List getListByVoyageId(PrintQuery query) { + return getBaseMapper().getListByVoyageId(query); + } +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInServiceImpl.java new file mode 100644 index 0000000..d3d55cc --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInServiceImpl.java @@ -0,0 +1,30 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerExportIn; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.haitonggauto.rtosc.repository.service.CustomerExportInService; +import com.haitonggauto.rtosc.repository.mapper.CustomerExportInMapper; +import com.nuzar.cloud.annotation.echo.EchoResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_export_in(出口进场基本表)】的数据库操作Service实现 +* @createDate 2023-08-30 17:15:27 +*/ +@Service +public class CustomerExportInServiceImpl extends ServiceImpl + implements CustomerExportInService{ + + @Override + public List getListByVoyageId(String voyageId, AuditEnum status) { + return getBaseMapper().getListByVoyageId(voyageId, status); + } +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInTimesServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInTimesServiceImpl.java new file mode 100644 index 0000000..cf00690 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInTimesServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerExportInTimes; +import com.haitonggauto.rtosc.repository.service.CustomerExportInTimesService; +import com.haitonggauto.rtosc.repository.mapper.CustomerExportInTimesMapper; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【customer_export_in_times(出口进场时间表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:31 +*/ +@Service +public class CustomerExportInTimesServiceImpl extends ServiceImpl + implements CustomerExportInTimesService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInspectCargoServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInspectCargoServiceImpl.java new file mode 100644 index 0000000..7c37281 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInspectCargoServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerExportInspectCargo; +import com.haitonggauto.rtosc.repository.service.CustomerExportInspectCargoService; +import com.haitonggauto.rtosc.repository.mapper.CustomerExportInspectCargoMapper; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【customer_export_inspect_cargo(出口查验货物表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:31 +*/ +@Service +public class CustomerExportInspectCargoServiceImpl extends ServiceImpl + implements CustomerExportInspectCargoService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInspectServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInspectServiceImpl.java new file mode 100644 index 0000000..3dc1706 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportInspectServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerExportInspect; +import com.haitonggauto.rtosc.repository.service.CustomerExportInspectService; +import com.haitonggauto.rtosc.repository.mapper.CustomerExportInspectMapper; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【customer_export_inspect(出口查验表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:31 +*/ +@Service +public class CustomerExportInspectServiceImpl extends ServiceImpl + implements CustomerExportInspectService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportLoadCargoServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportLoadCargoServiceImpl.java new file mode 100644 index 0000000..b11ba39 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportLoadCargoServiceImpl.java @@ -0,0 +1,28 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerExportLoadCargo; +import com.haitonggauto.rtosc.repository.service.CustomerExportLoadCargoService; +import com.haitonggauto.rtosc.repository.mapper.CustomerExportLoadCargoMapper; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_export_load_cargo(出口装船货物表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:31 +*/ +@Service +public class CustomerExportLoadCargoServiceImpl extends ServiceImpl + implements CustomerExportLoadCargoService{ + + @Override + public List getListByVoyageId(String voyageId) { + return getBaseMapper().getListByVoyageId(voyageId); + } +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportLoadCheckServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportLoadCheckServiceImpl.java new file mode 100644 index 0000000..c1af240 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportLoadCheckServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerExportLoadCheck; +import com.haitonggauto.rtosc.repository.service.CustomerExportLoadCheckService; +import com.haitonggauto.rtosc.repository.mapper.CustomerExportLoadCheckMapper; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【customer_export_load_check(出口装船审核明细表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:31 +*/ +@Service +public class CustomerExportLoadCheckServiceImpl extends ServiceImpl + implements CustomerExportLoadCheckService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportLoadServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportLoadServiceImpl.java new file mode 100644 index 0000000..74fef13 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerExportLoadServiceImpl.java @@ -0,0 +1,35 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerExportLoad; +import com.haitonggauto.rtosc.repository.enums.AuditEnum; +import com.haitonggauto.rtosc.repository.service.CustomerExportLoadService; +import com.haitonggauto.rtosc.repository.mapper.CustomerExportLoadMapper; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_export_load(出口装船表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:31 +*/ +@Service +public class CustomerExportLoadServiceImpl extends ServiceImpl + implements CustomerExportLoadService{ + + @Override + public List getListByVoyageId(String voyageId, AuditEnum status) { + return getBaseMapper().getListByVoyageId(voyageId, status); + } + + @Override + public Page getReceiveCarShipList(Page page, String q) { + return getBaseMapper().getReceiveCarShipList(page, q); + } +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerFreeTradeServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerFreeTradeServiceImpl.java new file mode 100644 index 0000000..5f2a7ec --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerFreeTradeServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerFreeTrade; +import com.haitonggauto.rtosc.repository.service.CustomerFreeTradeService; +import com.haitonggauto.rtosc.repository.mapper.CustomerFreeTradeMapper; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【customer_free_trade(特保区基本信息表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:31 +*/ +@Service +public class CustomerFreeTradeServiceImpl extends ServiceImpl + implements CustomerFreeTradeService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportTakeCargoServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportTakeCargoServiceImpl.java new file mode 100644 index 0000000..9b776fd --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportTakeCargoServiceImpl.java @@ -0,0 +1,35 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerImportTakeCargo; +import com.haitonggauto.rtosc.repository.query.ImportTakeQuery; +import com.haitonggauto.rtosc.repository.service.CustomerImportTakeCargoService; +import com.haitonggauto.rtosc.repository.mapper.CustomerImportTakeCargoMapper; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** +* @author dj +* @description 针对表【customer_import_take_cargo(进口提货货物表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:31 +*/ +@Service +public class CustomerImportTakeCargoServiceImpl extends ServiceImpl + implements CustomerImportTakeCargoService{ + + @Override + public List getImportTakeCargoList(ImportTakeQuery query) { + return getBaseMapper().getImportTakeCargoList(query); + } + + @Override + public IPage getImportTakeCargoPage(IPage page, ImportTakeQuery query) { + return getBaseMapper().getImportTakeCargoPage(page, query); + } +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportTakeJobServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportTakeJobServiceImpl.java new file mode 100644 index 0000000..40e0288 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportTakeJobServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerImportTakeJob; +import com.haitonggauto.rtosc.repository.service.CustomerImportTakeJobService; +import com.haitonggauto.rtosc.repository.mapper.CustomerImportTakeJobMapper; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【customer_import_take_job(进口提货作业模式)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:31 +*/ +@Service +public class CustomerImportTakeJobServiceImpl extends ServiceImpl + implements CustomerImportTakeJobService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportTakeServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportTakeServiceImpl.java new file mode 100644 index 0000000..1e93f2f --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportTakeServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerImportTake; +import com.haitonggauto.rtosc.repository.service.CustomerImportTakeService; +import com.haitonggauto.rtosc.repository.mapper.CustomerImportTakeMapper; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【customer_import_take(进口提货表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:31 +*/ +@Service +public class CustomerImportTakeServiceImpl extends ServiceImpl + implements CustomerImportTakeService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportUnloadCargoServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportUnloadCargoServiceImpl.java new file mode 100644 index 0000000..3497eb5 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportUnloadCargoServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerImportUnloadCargo; +import com.haitonggauto.rtosc.repository.service.CustomerImportUnloadCargoService; +import com.haitonggauto.rtosc.repository.mapper.CustomerImportUnloadCargoMapper; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【customer_import_unload_cargo(进口卸船货物表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:32 +*/ +@Service +public class CustomerImportUnloadCargoServiceImpl extends ServiceImpl + implements CustomerImportUnloadCargoService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportUnloadServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportUnloadServiceImpl.java new file mode 100644 index 0000000..eb99f82 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerImportUnloadServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerImportUnload; +import com.haitonggauto.rtosc.repository.service.CustomerImportUnloadService; +import com.haitonggauto.rtosc.repository.mapper.CustomerImportUnloadMapper; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【customer_import_unload(进口卸船表)】的数据库操作Service实现 +* @createDate 2023-08-30 14:32:31 +*/ +@Service +public class CustomerImportUnloadServiceImpl extends ServiceImpl + implements CustomerImportUnloadService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerLinkmanServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerLinkmanServiceImpl.java new file mode 100644 index 0000000..45ea70d --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/CustomerLinkmanServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.CustomerLinkman; +import com.haitonggauto.rtosc.repository.service.CustomerLinkmanService; +import com.haitonggauto.rtosc.repository.mapper.CustomerLinkmanMapper; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【customer_linkman(提离港区基本信息表)】的数据库操作Service实现 +* @createDate 2023-09-09 09:10:45 +*/ +@Service +public class CustomerLinkmanServiceImpl extends ServiceImpl + implements CustomerLinkmanService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/OrderRepositoryImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/OrderRepositoryImpl.java new file mode 100644 index 0000000..7ca265a --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/OrderRepositoryImpl.java @@ -0,0 +1,20 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.nuzar.cloud.mapper.impl.CommonServiceImpl; +import com.haitonggauto.rtosc.repository.service.OrderRepository; +import com.haitonggauto.rtosc.repository.dataobject.OrderDO; +import com.haitonggauto.rtosc.repository.mapper.OrderMapper; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author hanson + * @since 2022-12-29 + */ +@Service +public class OrderRepositoryImpl extends CommonServiceImpl implements OrderRepository { + +} diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysPermServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysPermServiceImpl.java new file mode 100644 index 0000000..7a82abd --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysPermServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.SysPerm; +import com.haitonggauto.rtosc.repository.mapper.SysPermMapper; +import com.haitonggauto.rtosc.repository.service.SysPermService; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【sys_perm(系统权限表)】的数据库操作Service实现 +* @createDate 2023-04-26 21:16:14 +*/ +@Service +public class SysPermServiceImpl extends ServiceImpl + implements SysPermService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysRoleDataServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysRoleDataServiceImpl.java new file mode 100644 index 0000000..4a7d1d2 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysRoleDataServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.SysRoleData; +import com.haitonggauto.rtosc.repository.mapper.SysRoleDataMapper; +import com.haitonggauto.rtosc.repository.service.SysRoleDataService; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【sys_role_data(系统角色数据权限表)】的数据库操作Service实现 +* @createDate 2023-04-26 21:16:14 +*/ +@Service +public class SysRoleDataServiceImpl extends ServiceImpl + implements SysRoleDataService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysRoleFieldServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysRoleFieldServiceImpl.java new file mode 100644 index 0000000..7c358d0 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysRoleFieldServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.SysRoleField; +import com.haitonggauto.rtosc.repository.mapper.SysRoleFieldMapper; +import com.haitonggauto.rtosc.repository.service.SysRoleFieldService; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【sys_role_field(系统角色字段权限表)】的数据库操作Service实现 +* @createDate 2023-04-26 21:16:14 +*/ +@Service +public class SysRoleFieldServiceImpl extends ServiceImpl + implements SysRoleFieldService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysRolePermServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysRolePermServiceImpl.java new file mode 100644 index 0000000..86a47ad --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysRolePermServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.SysRolePerm; +import com.haitonggauto.rtosc.repository.mapper.SysRolePermMapper; +import com.haitonggauto.rtosc.repository.service.SysRolePermService; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【sys_role_perm(系统角色操作权限表)】的数据库操作Service实现 +* @createDate 2023-04-26 21:16:14 +*/ +@Service +public class SysRolePermServiceImpl extends ServiceImpl + implements SysRolePermService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysRoleServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysRoleServiceImpl.java new file mode 100644 index 0000000..33ed8df --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysRoleServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.SysRole; +import com.haitonggauto.rtosc.repository.mapper.SysRoleMapper; +import com.haitonggauto.rtosc.repository.service.SysRoleService; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【sys_role(系统角色表)】的数据库操作Service实现 +* @createDate 2023-04-26 21:16:14 +*/ +@Service +public class SysRoleServiceImpl extends ServiceImpl + implements SysRoleService { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysSequenceNoServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysSequenceNoServiceImpl.java new file mode 100644 index 0000000..b9f42f1 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysSequenceNoServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.SysSequenceNo; +import com.haitonggauto.rtosc.repository.mapper.SysSequenceNoMapper; +import com.haitonggauto.rtosc.repository.service.SysSequenceNoService; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【sys_sequence_no(序列号规则表)】的数据库操作Service实现 +* @createDate 2023-04-26 21:16:14 +*/ +@Service +public class SysSequenceNoServiceImpl extends ServiceImpl + implements SysSequenceNoService { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysUserDataServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysUserDataServiceImpl.java new file mode 100644 index 0000000..3992286 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysUserDataServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.SysUserData; +import com.haitonggauto.rtosc.repository.mapper.SysUserDataMapper; +import com.haitonggauto.rtosc.repository.service.SysUserDataService; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【sys_user_data(系统用户数据权限表)】的数据库操作Service实现 +* @createDate 2023-04-26 21:16:14 +*/ +@Service +public class SysUserDataServiceImpl extends ServiceImpl + implements SysUserDataService { + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysUserFieldServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysUserFieldServiceImpl.java new file mode 100644 index 0000000..cb36215 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysUserFieldServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.SysUserField; +import com.haitonggauto.rtosc.repository.mapper.SysUserFieldMapper; +import com.haitonggauto.rtosc.repository.service.SysUserFieldService; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【sys_user_field(系统角色字段权限表)】的数据库操作Service实现 +* @createDate 2023-04-26 21:16:14 +*/ +@Service +public class SysUserFieldServiceImpl extends ServiceImpl + implements SysUserFieldService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysUserRoleServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysUserRoleServiceImpl.java new file mode 100644 index 0000000..2bf4af4 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysUserRoleServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.SysUserRole; +import com.haitonggauto.rtosc.repository.mapper.SysUserRoleMapper; +import com.haitonggauto.rtosc.repository.service.SysUserRoleService; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【sys_user_role(系统角色字段权限表)】的数据库操作Service实现 +* @createDate 2023-04-26 21:16:14 +*/ +@Service +public class SysUserRoleServiceImpl extends ServiceImpl + implements SysUserRoleService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysUserServiceImpl.java b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysUserServiceImpl.java new file mode 100644 index 0000000..bec9ad4 --- /dev/null +++ b/nuzar-customer-repository/src/main/java/com/haitonggauto/rtosc/repository/service/impl/SysUserServiceImpl.java @@ -0,0 +1,22 @@ +package com.haitonggauto.rtosc.repository.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.haitonggauto.rtosc.repository.entity.SysUser; +import com.haitonggauto.rtosc.repository.mapper.SysUserMapper; +import com.haitonggauto.rtosc.repository.service.SysUserService; +import org.springframework.stereotype.Service; + +/** +* @author dj +* @description 针对表【sys_user(系统用户表)】的数据库操作Service实现 +* @createDate 2023-04-26 21:16:14 +*/ +@Service +public class SysUserServiceImpl extends ServiceImpl + implements SysUserService{ + +} + + + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerDepartureCargoMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerDepartureCargoMapper.xml new file mode 100644 index 0000000..d0c7adc --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerDepartureCargoMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + id,departure_id,bill_no, + brand,cargo_type,vin, + quantity,is_shutout,is_del, + create_by,create_date,update_by, + update_date,version,termcd, + brand_id + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerDepartureDriversMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerDepartureDriversMapper.xml new file mode 100644 index 0000000..8778810 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerDepartureDriversMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + id,departure_id,driver_name, + car_no,contact_phone,is_del, + create_by,create_date,update_by, + update_date,version,termcd + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerDepartureMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerDepartureMapper.xml new file mode 100644 index 0000000..3641ff5 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerDepartureMapper.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id,batch_no,ship_name, + voyage,port_area,trad_type, + receive_company,contact,contact_phone, + retain_port,arrival_time,delivery_time, + return_time,check_status,check_time, + apply_time,applicat,remark, + is_del,create_by,create_date, + update_by,update_date,version, + check_man,check_result,termcd, + ship_id,ship_en_name,voyage_id, + port_area_id,receive_company_id,retain_port_id, + check_man_id,applicant_id,reason + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerDeparturePlanMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerDeparturePlanMapper.xml new file mode 100644 index 0000000..a6bc565 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerDeparturePlanMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + id,departure_id,pick_time, + car_quantity,part_quantity,work_status, + operator,is_del,create_by, + create_date,update_by,update_date, + version,termcd,brand_id, + brand + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInCargoMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInCargoMapper.xml new file mode 100644 index 0000000..88fac82 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInCargoMapper.xml @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id,export_in_id,vin, + is_del,create_by,create_date, + update_by,update_date,version, + termcd,cargo_type,work_status + + + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInMapper.xml new file mode 100644 index 0000000..07df74c --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInMapper.xml @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id,batch_no,ship_name, + voyage,port_area,trad_type, + contact,contact_phone,country, + port_id,transport_way,brand, + cart_type,cart_type_detail,models, + quantity,each_weight,each_quantity, + each_volume,volume,length, + width,height,weight, + operate_type,bill_num,remark, + energy_type,applicant,apply_time, + check_man,check_time,check_status, + check_result,is_del,create_by, + create_date,update_by,update_date, + version,freight,enter_quantity, + termcd,begin_enter_time,end_enter_time, + ship_id,ship_en_name,voyage_id, + port_area_id,origin_place_id,origin_place,port_name, + transport_way_id,brand_id,cart_type_id, + cart_type_detail_id,operate_type_id,applicant_id, + check_man_id + + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInTimesMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInTimesMapper.xml new file mode 100644 index 0000000..04a68dc --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInTimesMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + id,export_in_id,enter_time, + enter_quantity,is_del,create_by, + create_date,update_by,update_date, + version,termcd + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInspectCargoMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInspectCargoMapper.xml new file mode 100644 index 0000000..067a3bd --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInspectCargoMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + id,export_inspect_id,brand, + models,vin,area, + is_del,create_by,create_date, + update_by,update_date,version, + termcd,cargo_type,brand_id, + area_id + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInspectMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInspectMapper.xml new file mode 100644 index 0000000..9014a07 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportInspectMapper.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id,batch_no,ship_name, + voyage,bill_no,passport, + inspect_time,planned_cargo_quantity,planned_spare_quantity, + company,apply_obj,contact, + contact_phone,applicant,apply_time, + check_man,check_time,check_status, + check_reason,is_del,create_by, + create_date,update_by,update_date, + version,termcd,trad_type, + ship_id,ship_en_name,voyage_id, + applicant_id,check_man_id + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerExportLoadCargoMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportLoadCargoMapper.xml new file mode 100644 index 0000000..c4586be --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportLoadCargoMapper.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id,export_load_id,brand, + models,vin,work_status, + is_del,create_by,create_date, + update_by,update_date,version, + termcd,cargo_type,brand_id, + settle_comp_id,settle_comp_name,contact, + contact_phone + + + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerExportLoadCheckMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportLoadCheckMapper.xml new file mode 100644 index 0000000..002e8f6 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportLoadCheckMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id,export_load_id,ship_name, + voyage,bill_no,brand, + models,vin,result, + reason,is_del,create_by, + create_date,update_by,update_date, + version,termcd,cargo_type, + brand_id,ship_id,ship_en_name, + voyage_id + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerExportLoadMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportLoadMapper.xml new file mode 100644 index 0000000..a631430 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerExportLoadMapper.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id,batch_no,ship_name, + voyage,bill_no,quantity, + applicant,apply_time,check_man, + check_time,check_status,check_result, + is_del,create_by,create_date, + update_by,update_date,version, + termcd,trad_type,ship_id, + ship_en_name,voyage_id,applicant_id, + check_man_id + + + + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerFreeTradeMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerFreeTradeMapper.xml new file mode 100644 index 0000000..84a4166 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerFreeTradeMapper.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id,batch_no,company_code, + company_social_code,company_name,country, + city,cargo_item_no,cargo_code, + cargo_name,spec,currency, + total_price,net_weight,unit_measure, + unit_legal,origin_area,is_activate, + check_man,check_time,check_status, + check_result,is_del,create_by, + create_date,update_by,update_date, + version,vin,termcd + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerImportTakeCargoMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerImportTakeCargoMapper.xml new file mode 100644 index 0000000..b366f5c --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerImportTakeCargoMapper.xml @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id,import_take_id,brand, + examine,accept,bill_no, + customs_no,car_num,spare_num, + total_num,is_del,create_by, + create_date,update_by,update_date, + version,check_man,check_time, + check_status,check_result,cargo_type, + brand_id,check_man_id,termcd + + + + + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerImportTakeJobMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerImportTakeJobMapper.xml new file mode 100644 index 0000000..1341253 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerImportTakeJobMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + id,import_take_id,job_type, + job_process,job_mode,job_machine, + create_by,create_date,update_by, + update_date,version,termcd + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerImportTakeMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerImportTakeMapper.xml new file mode 100644 index 0000000..ecaf52a --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerImportTakeMapper.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id,batch_no,trad_type, + ship_name,voyage,port_area, + take_car_num,plan_spare_num,plan_car_num, + cargo_enter_time,ship_enter_time,job_time, + clearance_type,consignee,payer, + link_man,phone,remark, + applicant,apply_time,is_del, + create_by,create_date,update_by, + update_date,version,ship_id, + ship_en_name,voyage_id,port_area_id, + consignee_id,payer_id,applicant_id, + termcd + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerImportUnloadCargoMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerImportUnloadCargoMapper.xml new file mode 100644 index 0000000..5a6e815 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerImportUnloadCargoMapper.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + id,import_unload_id,brand, + models,vin,is_del, + create_by,create_date,update_by, + update_date,version,cargo_type, + brand_id + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerImportUnloadMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerImportUnloadMapper.xml new file mode 100644 index 0000000..5c04035 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerImportUnloadMapper.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id,batch_no,trad_type, + ship_name,voyage,bill_no, + brand,quantity,applicant, + apply_time,check_man,check_time, + check_status,check_result,is_del, + create_by,create_date,update_by, + update_date,version,ship_id, + ship_en_name,voyage_id,brand_id, + applicant_id,check_man_id,termcd + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/CustomerLinkmanMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/CustomerLinkmanMapper.xml new file mode 100644 index 0000000..85d5d35 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/CustomerLinkmanMapper.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + id,is_del,create_by, + create_date,update_by,update_date, + version,termcd,freight, + contact,contact_phone,field_contact, + field_contact_phone + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/OrderBiz.xml b/nuzar-customer-repository/src/main/resources/mapper/OrderBiz.xml new file mode 100644 index 0000000..a716c32 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/OrderBiz.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/SysPermMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/SysPermMapper.xml new file mode 100644 index 0000000..a612bc0 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/SysPermMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + id,create_by,create_date, + update_by,update_date,version, + code,name,remark + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/SysRoleDataMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/SysRoleDataMapper.xml new file mode 100644 index 0000000..e1e6817 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/SysRoleDataMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + id,create_by,create_date, + update_by,update_date,version, + class_name,data_ids,role_id + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/SysRoleFieldMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/SysRoleFieldMapper.xml new file mode 100644 index 0000000..942c54a --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/SysRoleFieldMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + id,create_by,create_date, + update_by,update_date,version, + class_name,exclude_fields,role_id + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/SysRoleMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/SysRoleMapper.xml new file mode 100644 index 0000000..b87f716 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/SysRoleMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + id,create_by,create_date, + update_by,update_date,version, + name,remark,status + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/SysRolePermMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/SysRolePermMapper.xml new file mode 100644 index 0000000..2adf2f5 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/SysRolePermMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + id,create_by,create_date, + update_by,update_date,version, + perms,role_id + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/SysSequenceNoMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/SysSequenceNoMapper.xml new file mode 100644 index 0000000..c1007e2 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/SysSequenceNoMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + id + ,create_by,create_date, + update_by,update_date,version, + code,name,cur_value, + gen_date,inc_value,prefix_str,termcd, + sequence_length,year_length,sequence_type + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/SysUserDataMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/SysUserDataMapper.xml new file mode 100644 index 0000000..b8c5555 --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/SysUserDataMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + id,create_by,create_date, + update_by,update_date,version, + class_name,data_ids,user_id + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/SysUserFieldMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/SysUserFieldMapper.xml new file mode 100644 index 0000000..ff6513d --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/SysUserFieldMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + id,create_by,create_date, + update_by,update_date,version, + class_name,exclude_fields,user_id + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/SysUserMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/SysUserMapper.xml new file mode 100644 index 0000000..e37a60a --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/SysUserMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + id,create_by,create_date, + update_by,update_date,version, + name,username,password, + phone,status + + diff --git a/nuzar-customer-repository/src/main/resources/mapper/SysUserRoleMapper.xml b/nuzar-customer-repository/src/main/resources/mapper/SysUserRoleMapper.xml new file mode 100644 index 0000000..581ef9e --- /dev/null +++ b/nuzar-customer-repository/src/main/resources/mapper/SysUserRoleMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + id,create_by,create_date, + update_by,update_date,version, + role_ids,user_id + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..fed625d --- /dev/null +++ b/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + com.haitonggauto.rtosc + nuzar-customer + 1.0-SNAPSHOT + pom + Build By Nuzar Cloud Archetype + + + nuzar-customer-common + nuzar-customer-domain + nuzar-customer-proxy + nuzar-customer-business + nuzar-customer-controller + nuzar-customer-repository + nuzar-customer-client + + + UTF-8 + 2.6.14.10-SNAPSHOT + 8 + 8 + 4.4 + 31.1-jre + 2.0.26 + 3.2.1 + 7.2.5 + 2.6.7 + 3.5.0 + 1.5.5.Final + + + + + com.nuzar + nuzar-cloud-dependencies + ${nuzar-cloud.version} + pom + import + + + com.haitonggauto.rtosc + nuzar-customer-common + 1.0-SNAPSHOT + + + com.haitonggauto.rtosc + nuzar-customer-domain + 1.0-SNAPSHOT + + + com.haitonggauto.rtosc + nuzar-customer-proxy + 1.0-SNAPSHOT + + + com.haitonggauto.rtosc + nuzar-customer-business + 1.0-SNAPSHOT + + + com.haitonggauto.rtosc + nuzar-customer-controller + 1.0-SNAPSHOT + + + com.haitonggauto.rtosc + nuzar-customer-repository + 1.0-SNAPSHOT + + + + + + com.nuzar + nuzar-web-starter + + + org.projectlombok + lombok + + +