yzc пре 2 година
родитељ
комит
c725934750

+ 50 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwoTransportDemandController.java

@@ -0,0 +1,50 @@
+package com.sckw.order.controller;
+
+import com.sckw.core.web.response.HttpResult;
+import com.sckw.order.model.vo.req.AddTransportDemandDraftParam;
+import com.sckw.order.model.vo.req.AddTransportDemandParam;
+import com.sckw.order.model.vo.req.UpdateTransportDemandParam;
+import com.sckw.order.serivce.KwoTransportDemandService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.MediaType;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @desc: 运需controller
+ * @author: yzc
+ * @date: 2023-07-25 16:21
+ */
+@RestController
+@RequestMapping(value = "/kwoTransportDemand")
+@RequiredArgsConstructor
+public class KwoTransportDemandController {
+
+    private final KwoTransportDemandService kwoTransportDemandService;
+
+    @PostMapping(value = "/addDraft", produces = MediaType.APPLICATION_JSON_VALUE)
+    public HttpResult addDraft(@RequestBody @Validated AddTransportDemandDraftParam param) {
+        kwoTransportDemandService.addDraft(param);
+        return HttpResult.ok("新增运需草稿成功");
+    }
+
+
+    @PostMapping(value = "/addShelves", produces = MediaType.APPLICATION_JSON_VALUE)
+    public HttpResult addShelves(@RequestBody @Validated AddTransportDemandParam param) {
+        kwoTransportDemandService.addShelves(param);
+        return HttpResult.ok("新增运需上架成功");
+    }
+
+
+    @GetMapping("/detail")
+    public HttpResult detail(@RequestParam Long id) {
+        return HttpResult.ok(kwoTransportDemandService.detail(id));
+    }
+
+    @PostMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
+    public HttpResult update(@RequestBody @Validated UpdateTransportDemandParam param) {
+        kwoTransportDemandService.update(param);
+        return HttpResult.ok("运需修改成功!");
+    }
+
+}

+ 1 - 1
sckw-modules/sckw-order/src/main/java/com/sckw/order/dao/KwpTransportDemandMapper.java → sckw-modules/sckw-order/src/main/java/com/sckw/order/dao/KwoTransportDemandMapper.java

@@ -10,5 +10,5 @@ import org.apache.ibatis.annotations.Mapper;
  * @date: 2023-06-25 14:45
  */
 @Mapper
-public interface KwpTransportDemandMapper extends BaseMapper<KwoTransportDemand> {
+public interface KwoTransportDemandMapper extends BaseMapper<KwoTransportDemand> {
 }

+ 45 - 14
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/KwoTransportDemand.java

@@ -9,7 +9,7 @@ import lombok.experimental.Accessors;
 
 import java.io.Serial;
 import java.io.Serializable;
-import java.math.BigDecimal;
+import java.time.LocalDate;
 
 /**
  * @desc: 运需
@@ -42,14 +42,9 @@ public class KwoTransportDemand extends BaseModel implements Serializable {
     private String goodsType;
 
     /**
-     * 尺寸大小
+     * 商品规格
      */
-    private String size;
-
-    /**
-     * 单位(吨、方、件、箱、其他)
-     */
-    private String unit;
+    private String spec;
 
     /**
      * 交易方式(预付款、货到付款、线下付款)
@@ -59,20 +54,56 @@ public class KwoTransportDemand extends BaseModel implements Serializable {
     /**
      * 运需单价(元)
      */
-    private BigDecimal price;
+    private String price;
 
     /**
      * 运输总量
      */
-    private BigDecimal totalNum;
+    private String amount;
 
     /**
-     * 装货地址id
+     * 截止时间(yyyy-MM-dd)
      */
-    private Long shippingAddressId;
+    private LocalDate deadline;
 
     /**
-     * 卸货地址id
+     * 联系人姓名
      */
-    private Long unloadingAddressId;
+    private String contacts;
+
+    /**
+     * 联系电话
+     */
+    private String phone;
+
+    /**
+     * 装货区域code
+     */
+    private Integer loadAreaCode;
+
+    /**
+     * 装货区域名称
+     */
+    private String loadAreaName;
+
+    /**
+     * 装货详细地址
+     */
+    private String loadDetailAddress;
+
+    /**
+     * 卸货区域code
+     */
+    private Integer unloadAreaCode;
+
+    /**
+     * 卸货区域名称
+     */
+    private String unloadAreaName;
+
+    /**
+     * 卸货详细地址
+     */
+    private String unloadDetailAddress;
+
 }

+ 110 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/AddTransportDemandDraftParam.java

@@ -0,0 +1,110 @@
+package com.sckw.order.model.vo.req;
+
+import jakarta.validation.constraints.Pattern;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.hibernate.validator.constraints.Length;
+
+import java.time.LocalDate;
+
+/**
+ * @desc: 添加运需草稿请求参数
+ * @author: yzc
+ * @date: 2023-07-26 9:16
+ */
+@Getter
+@Setter
+@ToString
+public class AddTransportDemandDraftParam {
+
+    /**
+     * 商品名称
+     */
+    @Length(max = 50, message = "商品名称最多支持200字")
+    private String name;
+
+    /**
+     * 商品分类
+     */
+    private String goodsType;
+
+    /**
+     * 商品规格
+     */
+    @Length(max = 20, message = "商品规格最多支持20字")
+    private String spec;
+
+    /**
+     * 交易方式(预付款、货到付款、线下付款)
+     */
+    private String trading;
+
+    /**
+     * 运需单价
+     */
+    @Length(max = 20, message = "运需单价最多支持20字")
+    private String price;
+
+    /**
+     * 运输总量
+     */
+    @Length(max = 20, message = "运输总量最多支持20字")
+    private String amount;
+
+    /**
+     * 截止时间(yyyy-MM-dd)
+     */
+    private LocalDate deadline;
+
+    /**
+     * 联系人姓名
+     */
+    private String contacts;
+
+    /**
+     * 联系电话
+     */
+    @Pattern(regexp = "^1[3456789]\\d{9}$", message = "非法手机号格式")
+    private String phone;
+
+    /**
+     * 装货区域code
+     */
+    private Integer loadAreaCode;
+
+    /**
+     * 装货区域名称
+     */
+    private String loadAreaName;
+
+    /**
+     * 装货详细地址
+     */
+    @Length(max = 255, message = "装货详细地址最多支持255字")
+    private String loadDetailAddress;
+
+    /**
+     * 卸货区域code
+     */
+    private Integer unloadAreaCode;
+
+    /**
+     * 卸货区域名称
+     */
+    private String unloadAreaName;
+
+    /**
+     * 卸货详细地址
+     */
+    @Length(max = 255, message = "卸货详细地址最多支持255字")
+    private String unloadDetailAddress;
+
+    /**
+     * 备注
+     */
+    @Length(max = 200, message = "备注最多支持200字")
+    private String remark;
+
+
+}

+ 118 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/AddTransportDemandParam.java

@@ -0,0 +1,118 @@
+package com.sckw.order.model.vo.req;
+
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Pattern;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.hibernate.validator.constraints.Length;
+
+import java.time.LocalDate;
+
+/**
+ * @desc: 添加运需请求参数
+ * @author: yzc
+ * @date: 2023-07-26 9:16
+ */
+@Getter
+@Setter
+@ToString
+public class AddTransportDemandParam {
+    /**
+     * 商品名称
+     */
+    @Length(max = 50, message = "商品名称最多支持200字")
+    @NotBlank(message = "商品名称不能为空")
+    private String name;
+
+    /**
+     * 商品分类
+     */
+    private String goodsType;
+
+    /**
+     * 商品规格
+     */
+    @Length(max = 20, message = "商品规格最多支持20字")
+    private String spec;
+
+    /**
+     * 交易方式(预付款、货到付款、线下付款)
+     */
+    private String trading;
+
+    /**
+     * 运需单价
+     */
+    @Length(max = 20, message = "运需单价最多支持20字")
+    @NotBlank(message = "运需单价不能为空")
+    private String price;
+
+    /**
+     * 运输总量
+     */
+    @Length(max = 20, message = "运输总量最多支持20字")
+    @NotBlank(message = "运输总量不能为空")
+    private String amount;
+
+    /**
+     * 截止时间(yyyy-MM-dd)
+     */
+    private LocalDate deadline;
+
+    /**
+     * 联系人姓名
+     */
+    @NotBlank(message = "联系人姓名不能为空")
+    private String contacts;
+
+    /**
+     * 联系电话
+     */
+    @Pattern(regexp = "^1[3456789]\\d{9}$", message = "非法手机号格式")
+    @NotBlank(message = "联系人电话不能为空")
+    private String phone;
+
+    /**
+     * 装货区域code
+     */
+    @NotNull(message = "装货区域code不能为空")
+    private Integer loadAreaCode;
+
+    /**
+     * 装货区域名称
+     */
+    @NotBlank(message = "装货区域名称不能为空")
+    private String loadAreaName;
+
+    /**
+     * 装货详细地址
+     */
+    @Length(max = 255, message = "装货详细地址最多支持255字")
+    private String loadDetailAddress;
+
+    /**
+     * 卸货区域code
+     */
+    @NotBlank(message = "卸货区域code不能为空")
+    private Integer unloadAreaCode;
+
+    /**
+     * 卸货区域名称
+     */
+    @NotBlank(message = "卸货区域名称不能为空")
+    private String unloadAreaName;
+
+    /**
+     * 卸货详细地址
+     */
+    @Length(max = 255, message = "卸货详细地址最多支持255字")
+    private String unloadDetailAddress;
+
+    /**
+     * 备注
+     */
+    @Length(max = 200, message = "备注最多支持200字")
+    private String remark;
+}

+ 16 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/UpdateTransportDemandParam.java

@@ -0,0 +1,16 @@
+package com.sckw.order.model.vo.req;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+/**
+ * @desc: 更新运需请求参数
+ * @author: yzc
+ * @date: 2023-07-26 9:37
+ */
+@Getter
+@Setter
+@ToString
+public class UpdateTransportDemandParam {
+}

+ 39 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTransportDemandService.java

@@ -0,0 +1,39 @@
+package com.sckw.order.serivce;
+
+import com.sckw.order.dao.KwoTransportDemandMapper;
+import com.sckw.order.model.vo.req.AddTransportDemandDraftParam;
+import com.sckw.order.model.vo.req.AddTransportDemandParam;
+import com.sckw.order.model.vo.req.UpdateTransportDemandParam;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+/**
+ * @desc: 运需service
+ * @author: yzc
+ * @date: 2023-06-25 14:53
+ */
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class KwoTransportDemandService {
+
+    private final KwoTransportDemandMapper kwoTransportDemandMapper;
+
+
+    public void addDraft(AddTransportDemandDraftParam param) {
+
+    }
+
+    public void addShelves(AddTransportDemandParam param) {
+
+    }
+
+    public String detail(Long id) {
+        return null;
+    }
+
+    public void update(UpdateTransportDemandParam param) {
+
+    }
+}

+ 0 - 20
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwpTransportDemandService.java

@@ -1,20 +0,0 @@
-package com.sckw.order.serivce;
-
-import com.sckw.order.dao.KwpTransportDemandMapper;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-/**
- * @desc: 运需service
- * @author: yzc
- * @date: 2023-06-25 14:53
- */
-@Service
-@Slf4j
-@RequiredArgsConstructor
-public class KwpTransportDemandService {
-
-    private final KwpTransportDemandMapper kwpTransportDemandMapper;
-
-}

+ 4 - 2
sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsService.java

@@ -195,7 +195,9 @@ public class KwpGoodsService {
         //商品地址信息
         KwpGoodsAddress goodsAddress = kwpGoodsAddressService.getByGoodsId(id);
         AddressInfoDetail addressInfo = BeanUtils.copyProperties(goodsAddress, AddressInfoDetail.class);
-        addressInfo.setTypeName(DictEnum.getLabel(DictTypeEnum.ADDRESS_TYPE.getType(), addressInfo.getType()));
+        if (Objects.nonNull(addressInfo)) {
+            addressInfo.setTypeName(DictEnum.getLabel(DictTypeEnum.ADDRESS_TYPE.getType(), addressInfo.getType()));
+        }
         detail.setImages(images).setPriceRanges(ranges).setAttributes(attributes).setAddressInfo(addressInfo);
 
         return detail;
@@ -458,7 +460,7 @@ public class KwpGoodsService {
         if (CollectionUtils.isNotEmpty(params.getIds())) {
             wrapper.in(KwpGoods::getId, params.getIds());
         } else {
-            if (Objects.nonNull(params.getEndCreateTime())){
+            if (Objects.nonNull(params.getEndCreateTime())) {
                 wrapper.le(KwpGoods::getCreateTime, DateUtil.offsetDay(params.getEndCreateTime(), 1));
             }
             wrapper.ge(Objects.nonNull(params.getStartCreateTime()), KwpGoods::getCreateTime, params.getStartCreateTime())