Просмотр исходного кода

Merge remote-tracking branch 'origin/dev' into dev

sptkw 2 лет назад
Родитель
Сommit
3336ca4288
20 измененных файлов с 351 добавлено и 207 удалено
  1. 3 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictEnum.java
  2. 1 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictTypeEnum.java
  3. 34 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/exception/CustomPromptException.java
  4. 13 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/exception/GlobalSystemExceptionHandler.java
  5. 4 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/HttpStatus.java
  6. 12 8
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java
  7. 16 20
      sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwpWantBuyController.java
  8. 28 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/dto/WantBuySelectPageDTO.java
  9. 37 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/dto/WantBuySelectParamDTO.java
  10. 77 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/AddDraftWantBuyParam.java
  11. 0 6
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/UpdateWantBuyParam.java
  12. 0 11
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/WantBuyAddressParam.java
  13. 8 13
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/WantBuySelectParam.java
  14. 2 1
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java
  15. 1 2
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoWantBuyAddressService.java
  16. 3 3
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoWantBuyTradingService.java
  17. 99 132
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwpWantBuyService.java
  18. 6 4
      sckw-modules/sckw-order/src/main/resources/mapper/KwoWantBuyMapper.xml
  19. 6 6
      sckw-modules/sckw-order/src/main/resources/mapper/KwoWantBuyTradingMapper.xml
  20. 1 1
      sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsService.java

+ 3 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictEnum.java

@@ -81,6 +81,9 @@ public enum DictEnum {
     TRANSPORT_DEMAND_STATUS_0("transport_demand_status", "0","已保存"),
     TRANSPORT_DEMAND_STATUS_1("transport_demand_status", "1","已上架"),
     TRANSPORT_DEMAND_STATUS_2("transport_demand_status", "2","已下架"),
+    WANT_BUY_STATUS_0("want_buy_status", "0","已保存"),
+    WANT_BUY_STATUS_1("want_buy_status", "1","已上架"),
+    WANT_BUY_STATUS_2("want_buy_status", "2","已下架"),
     PREPAID_LIMIT_NO("prepaid_limit", "0","否"),
     PREPAID_LIMIT_YES("prepaid_limit", "1","是"),
     ;

+ 1 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictTypeEnum.java

@@ -43,6 +43,7 @@ public enum DictTypeEnum {
     TAX_RATE_TYPE("tax_rate_type", "合理损耗单位"),
     TRANSPORT_DEMAND_STATUS("transport_demand_status", "运需状态"),
     PREPAID_LIMIT("prepaid_limit", "预付限额"),
+    WANT_BUY_STATUS("want_buy_status", "求购状态"),
     ;
 
     private final String type;

+ 34 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/exception/CustomPromptException.java

@@ -0,0 +1,34 @@
+package com.sckw.core.exception;
+
+import lombok.Getter;
+
+import java.io.Serial;
+
+/**
+ * @Author yzc
+ * @Description 自定义提示异常
+ * @createTime 2023年06月08日 10:05:00
+ */
+@Getter
+public class CustomPromptException extends RuntimeException {
+
+    @Serial
+    private static final long serialVersionUID = -295458079254252674L;
+    /**
+     * 异常信息
+     **/
+    private String msg;
+    private Object[] param;
+
+    public CustomPromptException(String msg) {
+        super(msg);
+        this.msg = msg;
+    }
+
+    public CustomPromptException(String msg, Object... param) {
+        super(msg);
+        this.msg = msg;
+        this.param = param;
+    }
+
+}

+ 13 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/exception/GlobalSystemExceptionHandler.java

@@ -47,6 +47,19 @@ public class GlobalSystemExceptionHandler {
         return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, ex.getMessage());
     }
 
+    /**
+     * 前端自定义提示异常
+     * @param ex
+     * @return
+     */
+    @ResponseBody
+    @ExceptionHandler(CustomPromptException.class)
+    public HttpResult customPromptExceptionHandler(CustomPromptException ex) {
+        log.info("业务异常,message={},param={}", ex.getMsg(), ex.getParam());
+        return HttpResult.error(HttpStatus.CUSTOM_PROMPT_CODE, ex.getMessage());
+    }
+
+
     /**
      * NotLoginException处理
      *

+ 4 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/HttpStatus.java

@@ -23,6 +23,10 @@ public class HttpStatus {
 
     /**全局异常状态码*/
     public static final int GLOBAL_EXCEPTION_CODE = 60500;
+    /**
+     * 自定义提示异常
+     */
+    public static final int CUSTOM_PROMPT_CODE = 60666;
     /**全局异常提示信息*/
     public static final String GLOBAL_EXCEPTION_MESSAGE = "攻城狮正在拼命优化,请您稍候再试!";
 

+ 12 - 8
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java

@@ -346,17 +346,21 @@ public class KwmAddressService {
      * @date 2023/7/18
      */
     public List<AddressQueryResVo> queryByEnt(QueryByEntReqVo reqVo) {
+        Map<Long, EntCacheResDto> entCacheResDtos = remoteSystemService.queryEntTreeByIds(Collections.singletonList(reqVo.getId()));
+        if (entCacheResDtos.isEmpty()) {
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENT_NOT_EXISTS);
+        }
+
+        EntCacheResDto entCacheResDto = entCacheResDtos.get(reqVo.getId());
+        if (Objects.isNull(entCacheResDto)) {
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENT_NOT_EXISTS);
+        }
+
         LambdaQueryWrapper<KwmAddress> wrapper = new LambdaQueryWrapper<>();
-        //wrapper.eq(KwmAddress::getEntId, reqVo.getId());
         wrapper.eq(KwmAddress::getDelFlag, Global.NO);
-        List<Long> ids = new ArrayList<>();
-        ids.add(reqVo.getId());
-        Map<Long, EntCacheResDto> entCacheResDtos = remoteSystemService.queryEntTreeByIds(ids);
-        EntCacheResDto id = entCacheResDtos.get(reqVo.getId());
-        wrapper.eq(KwmAddress::getEntId, id.getId());
-        //entCacheResDtos.get();
+        wrapper.eq(KwmAddress::getEntId, entCacheResDto.getId());
         if (StringUtils.isNotBlank(reqVo.getCityTrueName())) {
-            wrapper.and(wp -> wp.eq(KwmAddress::getName, reqVo.getCityTrueName()));
+            wrapper.eq(KwmAddress::getName, reqVo.getCityTrueName());
         }
         if (StringUtils.isNotBlank(reqVo.getCityName())) {
             wrapper.and(wp -> wp.like(KwmAddress::getCityName, reqVo.getCityName()).or().

+ 16 - 20
sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwpWantBuyController.java

@@ -2,10 +2,7 @@ package com.sckw.order.controller;
 
 import com.sckw.core.annotation.Log;
 import com.sckw.core.web.response.HttpResult;
-import com.sckw.order.model.vo.req.AddWantBuyParam;
-import com.sckw.order.model.vo.req.UpdateWantBuyParam;
-import com.sckw.order.model.vo.req.WantBuyDels;
-import com.sckw.order.model.vo.req.WantBuySelectParam;
+import com.sckw.order.model.vo.req.*;
 import com.sckw.order.serivce.KwpWantBuyService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.http.MediaType;
@@ -28,7 +25,7 @@ public class KwpWantBuyController {
      * @desc: 求购分页查询
      * @author lt
      * @Date 15:34 2023/7/26 0026
-    **/
+     **/
     @PostMapping(value = "/select", produces = MediaType.APPLICATION_JSON_VALUE)
     @Log(description = "求购分页查询")
     public HttpResult select(@RequestBody WantBuySelectParam wantBuySelectParam) {
@@ -39,7 +36,7 @@ public class KwpWantBuyController {
      * @desc: 求购大厅
      * @author lt
      * @Date 15:34 2023/7/26 0026
-    **/
+     **/
     @PostMapping(value = "/buyHallList", produces = MediaType.APPLICATION_JSON_VALUE)
     @Log(description = "求购大厅")
     public HttpResult buyHallList(@RequestBody WantBuySelectParam wantBuySelectParam) {
@@ -55,8 +52,8 @@ public class KwpWantBuyController {
      */
     @PostMapping(value = "/addDraft", produces = MediaType.APPLICATION_JSON_VALUE)
     @Log(description = "新增求购草稿")
-    public HttpResult addDraft(@RequestBody AddWantBuyParam addWantBuyParam) {
-        kwpWantBuyService.addDraft(addWantBuyParam);
+    public HttpResult addDraft(@RequestBody AddDraftWantBuyParam addDraftWantBuyParam) {
+        kwpWantBuyService.addDraft(addDraftWantBuyParam);
         return HttpResult.ok("新增求购草稿成功");
     }
 
@@ -78,7 +75,7 @@ public class KwpWantBuyController {
      * @desc: 求购上架
      * @Author: lt
      * @Date: 13:39 2023/7/25 0025
-    **/
+     **/
     @GetMapping(value = "/putOnShelves", produces = MediaType.APPLICATION_JSON_VALUE)
     @Log(description = "求购上架")
     public HttpResult putOnShelves(@RequestParam Long id) {
@@ -90,11 +87,11 @@ public class KwpWantBuyController {
      * @desc: 求购批量下架
      * @Author: lt
      * @Date: 13:39 2023/7/25 0025
-    **/
+     **/
     @PostMapping(value = "/batchTakeOffShelves", produces = MediaType.APPLICATION_JSON_VALUE)
     @Log(description = "求购批量下架")
-    public HttpResult batchTakeOffShelves(@RequestBody WantBuyDels ids) {
-        kwpWantBuyService.batchTakeOffShelves(ids);
+    public HttpResult batchTakeOffShelves(@RequestBody @Validated WantBuyDels wantBuyDels) {
+        kwpWantBuyService.batchTakeOffShelves(wantBuyDels);
         return HttpResult.ok("批量下架成功");
     }
 
@@ -102,11 +99,11 @@ public class KwpWantBuyController {
      * @desc: 求购批量删除
      * @Author: lt
      * @Date: 13:39 2023/7/25 0025
-    **/
-    @DeleteMapping(value = "/dels", produces = MediaType.APPLICATION_JSON_VALUE)
+     **/
+    @PostMapping(value = "/dels", produces = MediaType.APPLICATION_JSON_VALUE)
     @Log(description = "求购批量删除")
-    public HttpResult dels(@RequestBody WantBuyDels ids) {
-        kwpWantBuyService.dels(ids);
+    public HttpResult dels(@RequestBody @Validated WantBuyDels wantBuyDels) {
+        kwpWantBuyService.dels(wantBuyDels);
         return HttpResult.ok("批量删除成功");
     }
 
@@ -127,7 +124,7 @@ public class KwpWantBuyController {
      * @desc: 求购编辑
      * @author lt
      * @Date 15:22 2023/7/26 0026
-    **/
+     **/
     @PostMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
     @Log(description = "求购编辑")
     public HttpResult update(@RequestBody @Validated UpdateWantBuyParam updateWantBuyParam) {
@@ -139,11 +136,10 @@ public class KwpWantBuyController {
      * @desc 求购角标统计
      * @author lt
      * @Date 15:23 2023/7/26 0026
-    **/
+     **/
     @PostMapping(value = "/statistic", produces = MediaType.APPLICATION_JSON_VALUE)
     @Log(description = "求购统计")
-    public HttpResult statistic(@RequestBody WantBuySelectParam params)
-    {
+    public HttpResult statistic(@RequestBody WantBuySelectParam params) {
         return HttpResult.ok(kwpWantBuyService.statistic(params));
     }
 }

+ 28 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/dto/WantBuySelectPageDTO.java

@@ -0,0 +1,28 @@
+package com.sckw.order.model.dto;
+
+import com.sckw.order.model.KwoWantBuy;
+import com.sckw.order.model.KwoWantBuyAddress;
+import com.sckw.order.model.KwoWantBuyTrading;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @desc: 求购列表响应DTO
+ * @author: yzc
+ * @date: 2023-08-15 18:17
+ */
+@Getter
+@Setter
+@ToString
+public class WantBuySelectPageDTO {
+
+    private KwoWantBuy wantBuy;
+
+    private List<KwoWantBuyTrading> wantBuyTradings;
+
+    private KwoWantBuyAddress wantBuyAddress;
+
+}

+ 37 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/dto/WantBuySelectParamDTO.java

@@ -0,0 +1,37 @@
+package com.sckw.order.model.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.util.Date;
+
+/**
+ * @desc: 求购列表筛选参数dto
+ * @author: yzc
+ * @date: 2023-08-15 18:18
+ */
+@Getter
+@Setter
+@ToString
+public class WantBuySelectParamDTO {
+
+    /**
+     * 关键字搜索
+     */
+    private String keywords;
+
+    /**
+     * 状态
+     */
+    private Integer status;
+
+    /**
+     * 支付方式
+     */
+    private String trading;
+
+    private Date startCreateTime;
+
+    private Date endCreateTime;
+}

+ 77 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/AddDraftWantBuyParam.java

@@ -0,0 +1,77 @@
+package com.sckw.order.model.vo.req;
+
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.hibernate.validator.constraints.Length;
+
+import java.util.List;
+
+/**
+ * @desc: 新增草稿求购请求参数
+ * @author: yzc
+ * @date: 2023-08-15 15:26
+ */
+@Getter
+@Setter
+@ToString
+public class AddDraftWantBuyParam {
+
+    /**
+     * 商品名称
+     */
+    @Length(max = 50, message = "商品名称最多支持50字")
+    private String name;
+
+    /**
+     * 商品分类
+     */
+    @Length(max = 32, message = "商品分类最多支持32字")
+    private String goodsType;
+
+    /**
+     * 商品规格
+     */
+    @Length(max = 20, message = "商品规格最多支持20字")
+    private String spec;
+
+    /**
+     * 支付方式集合
+     */
+    private List<String> tradings;
+
+    /**
+     * 求购单价
+     */
+    @Length(max = 20, message = "求购单价最多支持20字")
+    private String price;
+
+    /**
+     * 求购总量
+     */
+    @Length(max = 20, message = "求购总量最多支持20字")
+    private String amount;
+
+    /**
+     * 联系人姓名
+     */
+    @Length(max = 32, message = "联系人姓名最多支持32字")
+    private String contacts;
+
+    /**
+     * 联系电话
+     */
+    @Pattern(regexp = "^1[3456789]\\d{9}$", message = "非法手机号格式")
+    private String phone;
+
+    /**
+     * 地址信息
+     */
+    @Valid
+    private WantBuyAddressParam addressInfo;
+
+    @Length(max = 200, message = "备注最多支持200字")
+    private String remark;
+}

+ 0 - 6
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/UpdateWantBuyParam.java

@@ -1,7 +1,6 @@
 package com.sckw.order.model.vo.req;
 
 import jakarta.validation.Valid;
-import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotNull;
 import jakarta.validation.constraints.Pattern;
 import lombok.Getter;
@@ -30,7 +29,6 @@ public class UpdateWantBuyParam {
     /**
      * 商品名称
      */
-    @NotBlank(message = "商品名称不能为空")
     @Length(max = 50, message = "商品名称最多支持50字")
     private String name;
 
@@ -54,28 +52,24 @@ public class UpdateWantBuyParam {
     /**
      * 求购单价
      */
-    @NotBlank(message = "求购单价不能为空")
     @Length(max = 20, message = "求购单价最多支持20字")
     private String price;
 
     /**
      * 求购总量
      */
-    @NotBlank(message = "求购总量不能为空")
     @Length(max = 20, message = "求购总量最多支持20字")
     private String amount;
 
     /**
      * 联系人姓名
      */
-    @NotBlank(message = "联系人姓名不能为空")
     @Length(max = 32, message = "联系人姓名最多支持32字")
     private String contacts;
 
     /**
      * 联系电话
      */
-    @NotBlank(message = "联系电话不能为空")
     @Pattern(regexp = "^1[3456789]\\d{9}$", message = "非法手机号格式")
     private String phone;
 

+ 0 - 11
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/WantBuyAddressParam.java

@@ -1,7 +1,5 @@
 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;
@@ -20,56 +18,47 @@ public class WantBuyAddressParam {
     /**
      * 地址名称
      */
-    @NotBlank(message = "地址名称不能为空")
     private String name;
 
     /**
      * 地址类型
      */
-    @NotNull(message = "地址类型不能为空")
     private String type;
 
     /**
      * 联系人姓名
      */
-    @NotBlank(message = "联系人姓名不能为空")
     private String contacts;
 
     /**
      * 联系电话
      */
-    @NotBlank(message = "联系电话不能为空")
     @Pattern(regexp = "^1[3456789]\\d{9}$", message = "非法手机号格式")
     private String phone;
 
     /**
      * 所在地区
      */
-    @NotNull(message = "所在地区code不能为空")
     private Integer cityCode;
 
     /**
      * 所属区域名称
      */
-    @NotBlank(message = "所属区域名称不能为空")
     private String cityName;
 
     /**
      * 详细地址
      */
-    @NotBlank(message = "详细地址不能为空")
     private String detailAddress;
 
     /**
      * 纬度
      */
-    @NotBlank(message = "纬度不能为空")
     private String lat;
 
     /**
      * 经度
      */
-    @NotBlank(message = "经度不能为空")
     private String lng;
 
     /**

+ 8 - 13
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/WantBuySelectParam.java

@@ -2,12 +2,11 @@ package com.sckw.order.model.vo.req;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.sckw.core.model.page.PageRequest;
-import jakarta.validation.constraints.NotNull;
 import lombok.Getter;
 import lombok.Setter;
+import lombok.ToString;
 
-import java.io.Serial;
-import java.time.LocalDateTime;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -17,23 +16,21 @@ import java.util.List;
  */
 @Getter
 @Setter
+@ToString
 public class WantBuySelectParam extends PageRequest {
 
-    @Serial
-    private static final long serialVersionUID = 1881051859375157819L;
-
     /**
      * 关键字搜索
      */
     private String keywords;
 
     /**
-     * 状态 来自com.sckw.core.common.enums.enums.DictEnum.GOODS_STATUS_0
+     * 状态
      */
-    private String status;
+    private Integer status;
 
     /**
-     * 支付集合字符串
+     * 支付方式
      */
     private String trading;
 
@@ -65,11 +62,9 @@ public class WantBuySelectParam extends PageRequest {
     private List<String> goodsTypeValueSearch;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @NotNull(message = "生成开始时间不能为空")
-    private LocalDateTime startCreateTime;
+    private Date startCreateTime;
 
-    @NotNull(message = "生成结束时间不能为空")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    private LocalDateTime endCreateTime;
+    private Date endCreateTime;
 
 }

+ 2 - 1
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java

@@ -8,6 +8,7 @@ import com.sckw.contract.api.model.dto.res.ContractCommonInfoResDto;
 import com.sckw.core.common.enums.enums.DictEnum;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.exception.BusinessException;
+import com.sckw.core.exception.CustomPromptException;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
@@ -766,7 +767,7 @@ public class KwoTradeOrderService {
             throw new BusinessException("执行中的订单才能完结订单!");
         }
         if (kwoTradeOrderUnitService.entMatch(param.getId(), LoginUserHolder.getEntId(), DictEnum.TORDER_UNIT_TYPE_2.getValue())) {
-            throw new BusinessException("无订单操作权限!");
+            throw new CustomPromptException("无订单操作权限!");
         }
         if (transportDubboService.checkLogisticsOrderByTradeOrderId(param.getId())){
             throw new BusinessException("订单存在未完成的物流托运,不可完结!");

+ 1 - 2
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoWantBuyAddressService.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.order.dao.KwpWantBuyAddressMapper;
-import com.sckw.order.model.KwoTradeOrderAddress;
 import com.sckw.order.model.KwoWantBuyAddress;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -32,7 +31,7 @@ public class KwoWantBuyAddressService {
         return CollectionUtils.emptyIfNull(list);
     }
 
-    public void delAddressByWantBuyIds(List<String> wantBuyIds) {
+    public void delAddressByWantBuyIds(List<Long> wantBuyIds) {
         LambdaUpdateWrapper<KwoWantBuyAddress> wrapper = new LambdaUpdateWrapper<>();
         wrapper.in(KwoWantBuyAddress::getWantBuyId, wantBuyIds).eq(KwoWantBuyAddress::getDelFlag, Global.NO)
                         .set(KwoWantBuyAddress::getDelFlag, Global.YES);

+ 3 - 3
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoWantBuyTradingService.java

@@ -3,8 +3,8 @@ package com.sckw.order.serivce;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.utils.CollectionUtils;
 import com.sckw.order.dao.KwpWantBuyTradingMapper;
-import com.sckw.order.model.KwoTradeOrderAddress;
 import com.sckw.order.model.KwoWantBuyTrading;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -32,7 +32,7 @@ public class KwoWantBuyTradingService {
         LambdaQueryWrapper<KwoWantBuyTrading> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(KwoWantBuyTrading::getWantBuyId, wantBuyId).eq(KwoWantBuyTrading::getDelFlag, Global.NO);
         List<KwoWantBuyTrading> list = kwpWantBuyTradingMapper.selectList(wrapper);
-        return list;
+        return CollectionUtils.emptyIfNull(list);
     }
 
     //根据wangtBuyId删除
@@ -43,7 +43,7 @@ public class KwoWantBuyTradingService {
     }
 
     //根据wangtBuyIds批量删除
-    public void delTradingByWantBuyids(List<String> ids)
+    public void delTradingByWantBuyids(List<Long> ids)
     {
         LambdaUpdateWrapper<KwoWantBuyTrading> wrapper = new LambdaUpdateWrapper<>();
         wrapper.in(KwoWantBuyTrading::getWantBuyId, ids).eq(KwoWantBuyTrading::getDelFlag, Global.NO).set(KwoWantBuyTrading::getDelFlag, Global.YES);

+ 99 - 132
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwpWantBuyService.java

@@ -11,18 +11,19 @@ import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.page.PageRes;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
-import com.sckw.core.utils.IdWorker;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.order.dao.KwpWantBuyAddressMapper;
 import com.sckw.order.dao.KwpWantBuyMapper;
 import com.sckw.order.dao.KwpWantBuyTradingMapper;
-import com.sckw.order.model.*;
-import com.sckw.order.model.vo.req.AddWantBuyParam;
-import com.sckw.order.model.vo.req.UpdateWantBuyParam;
-import com.sckw.order.model.vo.req.WantBuyDels;
-import com.sckw.order.model.vo.req.WantBuySelectParam;
-import com.sckw.order.model.vo.res.*;
+import com.sckw.order.model.KwoWantBuy;
+import com.sckw.order.model.KwoWantBuyAddress;
+import com.sckw.order.model.KwoWantBuyTrading;
+import com.sckw.order.model.vo.req.*;
+import com.sckw.order.model.vo.res.TableTopRes;
+import com.sckw.order.model.vo.res.WantBuyAddressDetailRes;
+import com.sckw.order.model.vo.res.WantBuyDetailRes;
+import com.sckw.order.model.vo.res.WantBuySelectRes;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
@@ -148,21 +149,21 @@ public class KwpWantBuyService {
     }
 
     /**
-     * @Desc 求购列表查询
      * @param wantBuySelectParam
      * @return
+     * @Desc 求购列表查询
      */
     private List<String> goodsTypeHandle(WantBuySelectParam wantBuySelectParam) {
         List<SysDictResDto> goodsTypeList = remoteSystemService.queryDictBottom(wantBuySelectParam.getGoodsType(), wantBuySelectParam.getGoodsTypeValue());
         if (CollectionUtils.isNotEmpty(goodsTypeList)) {
-            return  goodsTypeList.stream().map(SysDictResDto::getValue).toList();
+            return goodsTypeList.stream().map(SysDictResDto::getValue).toList();
         }
         return null;
     }
 
     /**
-     * @Desc 字符串转数组
      * @return
+     * @Desc 字符串转数组
      */
     private List<String> stringToLongList(String str) {
         if (StringUtils.isBlank(str)) {
@@ -180,11 +181,10 @@ public class KwpWantBuyService {
      * @Return
      * @Date 11:56 2023/7/25 0025
      **/
-    public void addDraft(AddWantBuyParam param) {
-        Integer status = Integer.valueOf(DictEnum.GOODS_STATUS_0.getValue());  //保存草稿
-        String message = "求购草稿";
-        addWantBuy(param, message, status);
-
+    @Transactional(rollbackFor = Exception.class)
+    public void addDraft(AddDraftWantBuyParam param) {
+        Integer status = Integer.valueOf(DictEnum.WANT_BUY_STATUS_0.getValue());
+        addWantBuy(BeanUtils.copyProperties(param, AddWantBuyParam.class), status);
     }
 
     /**
@@ -194,80 +194,41 @@ public class KwpWantBuyService {
      * @Return
      * @Date 11:57 2023/7/25 0025
      **/
+    @Transactional(rollbackFor = Exception.class)
     public void addShelves(AddWantBuyParam param) {
-        Integer status = Integer.valueOf(DictEnum.GOODS_STATUS_1.getValue());   //上架
-        String message = "求购上架";
-        addWantBuy(param, message, status);
+        Integer status = Integer.valueOf(DictEnum.WANT_BUY_STATUS_1.getValue());
+        addWantBuy(param, status);
     }
 
     /**
      * @desc 新增求购统一方法
      * @author lt
      * @Date 11:52 2023/8/1 0001
-    **/
-    @Transactional(rollbackFor = Exception.class)
-    public void addWantBuy(AddWantBuyParam param, String message, Integer status) {
-        Date currentDate = new Date();
-        Long entId = LoginUserHolder.getEntId();
-        if (Objects.isNull(entId)) {
-            throw new BusinessException("企业ID不存在,请重新登录");
-        }
-//        KwoWantBuy kwoWantBuy = BeanUtils.copyProperties(param, KwoWantBuy.class);
-        KwoWantBuy kwoWantBuy = new KwoWantBuy();
-        Long userId = LoginUserHolder.getUserId();
-        kwoWantBuy.setEntId(LoginUserHolder.getEntId())
-                .setName(param.getName()).setGoodsType(param.getGoodsType())
-                .setSpec(param.getSpec()).setPrice(param.getPrice())
-                .setAmount(param.getAmount()).setContacts(param.getContacts())
-                .setPhone(param.getPhone()).setId(new IdWorker(1L).nextId())
-                .setRemark(param.getRemark()).setStatus(status).setCreateBy(userId)
-                .setCreateTime(currentDate).setUpdateBy(userId)
-                .setUpdateTime(currentDate).setDelFlag(Global.NO);
+     **/
+    public void addWantBuy(AddWantBuyParam param, Integer status) {
+        //添加求购
+        KwoWantBuy kwoWantBuy = BeanUtils.copyProperties(param, KwoWantBuy.class);
+        kwoWantBuy.setEntId(LoginUserHolder.getEntId()).setStatus(status);
         kwpWantBuyMapper.insert(kwoWantBuy);
-        if (Objects.isNull(kwoWantBuy.getId())) {
-            throw new BusinessException(message + "失败");
-        }
-        /*
-        支付方式添加
-         */
+        //添加支付方式
         List<String> list = param.getTradings();
-        if (list != null && !list.isEmpty()) {
-            Date currentDateTime = new Date();
+        if (CollectionUtils.isNotEmpty(list)) {
+            Long wantBuyId = kwoWantBuy.getId();
             List<KwoWantBuyTrading> tradingList = list.stream()
                     .map(item -> {
                         KwoWantBuyTrading kwoWantBuyTrading = new KwoWantBuyTrading();
-                        kwoWantBuyTrading.setWantBuyId(kwoWantBuy.getId());
+                        kwoWantBuyTrading.setWantBuyId(wantBuyId);
                         kwoWantBuyTrading.setTrading(item);
-                        kwoWantBuyTrading.setCreateBy(userId);
-                        kwoWantBuyTrading.setCreateTime(currentDateTime);
-                        kwoWantBuyTrading.setUpdateTime(currentDateTime);
-                        kwoWantBuyTrading.setStatus(status);
                         return kwoWantBuyTrading;
                     })
                     .collect(Collectors.toList());
             kwoWantBuyTradingService.insertBatch(tradingList);
         }
-        /*
-        地址信息添加,如果存在地址信息-新增入库
-         */
-        if (Objects.nonNull(param.getAddressInfo())) {
-            KwoWantBuyAddress address = new KwoWantBuyAddress();
-            Long idWorker = new IdWorker(1L).nextId();
+        //地址信息添加,如果存在地址信息-新增入库
+        WantBuyAddressParam addressInfo = param.getAddressInfo();
+        if (Objects.nonNull(addressInfo)) {
+            KwoWantBuyAddress address = BeanUtils.copyProperties(addressInfo, KwoWantBuyAddress.class);
             address.setWantBuyId(kwoWantBuy.getId());
-            address.setName(param.getAddressInfo().getName());
-            address.setType(param.getAddressInfo().getType());
-            address.setContacts(param.getAddressInfo().getContacts());
-            address.setPhone(param.getAddressInfo().getPhone());
-            address.setCityCode(param.getAddressInfo().getCityCode());
-            address.setCityName(param.getAddressInfo().getCityName());
-            address.setDetailAddress(param.getAddressInfo().getDetailAddress());
-            address.setLat(param.getAddressInfo().getLat());
-            address.setLng(param.getAddressInfo().getLng());
-            address.setFence(param.getAddressInfo().getFence());
-            address.setId(idWorker);
-            address.setCreateBy(LoginUserHolder.getUserId());
-            address.setCreateTime(new Date());
-            address.setUpdateTime(new Date());
             kwpWantBuyAddressMapper.insert(address);
         }
     }
@@ -278,14 +239,20 @@ public class KwpWantBuyService {
      * @Date: 13:38 2023/7/25 0025
      **/
     public void putOnShelves(Long id) {
-        KwoWantBuy kwoWantBuy = kwpWantBuyMapper.selectById(id);
+        LambdaQueryWrapper<KwoWantBuy> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwoWantBuy::getId, id).eq(KwoWantBuy::getEntId, LoginUserHolder.getEntId())
+                .eq(KwoWantBuy::getDelFlag, Global.NO).last("LIMIT 1");
+        KwoWantBuy kwoWantBuy = kwpWantBuyMapper.selectOne(wrapper);
         if (Objects.isNull(kwoWantBuy)) {
             throw new BusinessException("求购信息不存在");
         }
-        if (kwoWantBuy.getStatus().equals(Integer.valueOf(DictEnum.GOODS_STATUS_1.getValue()))) {
+        if (Integer.valueOf(DictEnum.WANT_BUY_STATUS_1.getValue()).equals(kwoWantBuy.getStatus())) {
             throw new BusinessException("求购信息已上架");
         }
-        kwoWantBuy.setStatus(Integer.valueOf(DictEnum.GOODS_STATUS_1.getValue()));
+        if (Integer.valueOf(DictEnum.WANT_BUY_STATUS_0.getValue()).equals(kwoWantBuy.getStatus())) {
+            checkParams(BeanUtils.copyProperties(kwoWantBuy, UpdateWantBuyParam.class));
+        }
+        kwoWantBuy.setStatus(Integer.valueOf(DictEnum.WANT_BUY_STATUS_1.getValue()));
         kwpWantBuyMapper.updateById(kwoWantBuy);
     }
 
@@ -295,16 +262,16 @@ public class KwpWantBuyService {
      * @Date 14:56 2023/7/25 0025
      **/
     public void batchTakeOffShelves(WantBuyDels param) {
-        if (BeanUtils.isEmpty(param)) {
-            throw new BusinessException("请提供需要下架的产品");
+        List<Long> ids = StringUtils.splitStrToList(param.getIds(), Long.class);
+        LambdaQueryWrapper<KwoWantBuy> wrapper = new LambdaQueryWrapper<>();
+        wrapper.in(KwoWantBuy::getId, ids).eq(KwoWantBuy::getStatus, Integer.valueOf(DictEnum.WANT_BUY_STATUS_1.getValue()))
+                .eq(KwoWantBuy::getEntId, LoginUserHolder.getEntId()).eq(KwoWantBuy::getDelFlag, Global.NO);
+        List<KwoWantBuy> list = kwpWantBuyMapper.selectList(wrapper);
+        if (!Objects.equals(ids.size(), list.size())) {
+            throw new BusinessException("下架操作仅针对“已上架”状态的单据");
         }
-        List<String> ids = List.of(param.getIds().split(Global.COMMA));
-        //1.查询ids所属产品只有status=1的才能下架,如果存在其它状态的则不能下架
         LambdaUpdateWrapper<KwoWantBuy> updateWrapper = new LambdaUpdateWrapper<>();
-        updateWrapper.eq(KwoWantBuy::getDelFlag, Global.NO).in(KwoWantBuy::getId, ids);
-        updateWrapper.set(KwoWantBuy::getStatus, DictEnum.GOODS_STATUS_2.getValue())
-                .set(KwoWantBuy::getUpdateBy, LoginUserHolder.getUserId())
-                .set(KwoWantBuy::getUpdateTime, new Date());
+        updateWrapper.set(KwoWantBuy::getStatus, Integer.valueOf(DictEnum.WANT_BUY_STATUS_2.getValue())).in(KwoWantBuy::getId, ids);
         kwpWantBuyMapper.update(null, updateWrapper);
     }
 
@@ -312,15 +279,19 @@ public class KwpWantBuyService {
      * @desc 求购删除
      * @author lt
      * @Date 10:15 2023/8/1 0001
-    **/
+     **/
     @Transactional(rollbackFor = Exception.class)
     public void dels(WantBuyDels param) {
-        List<String> ids = List.of(param.getIds().split(Global.COMMA));
+        List<Long> ids = StringUtils.splitStrToList(param.getIds(), Long.class);
+        LambdaQueryWrapper<KwoWantBuy> wrapper = new LambdaQueryWrapper<>();
+        wrapper.in(KwoWantBuy::getId, ids).eq(KwoWantBuy::getStatus, 0)
+                .eq(KwoWantBuy::getEntId, LoginUserHolder.getEntId()).eq(KwoWantBuy::getDelFlag, Global.NO);
+        List<KwoWantBuy> list = kwpWantBuyMapper.selectList(wrapper);
+        if (!Objects.equals(ids.size(), list.size())) {
+            throw new BusinessException("删除操作仅针对“草稿”状态的单据");
+        }
         LambdaUpdateWrapper<KwoWantBuy> updateWrapper = new LambdaUpdateWrapper<>();
-        updateWrapper.in(KwoWantBuy::getId, ids).eq(KwoWantBuy::getDelFlag, Global.NO)
-                .set(KwoWantBuy::getDelFlag, Global.YES)
-                .set(KwoWantBuy::getUpdateBy, LoginUserHolder.getUserId())
-                .set(KwoWantBuy::getUpdateTime, new Date());
+        updateWrapper.set(KwoWantBuy::getDelFlag, Global.YES).in(KwoWantBuy::getId, ids);
         kwpWantBuyMapper.update(null, updateWrapper);
         //删除地址信息
         kwoWantBuyAddressService.delAddressByWantBuyIds(ids);
@@ -333,7 +304,7 @@ public class KwpWantBuyService {
      * @desc 求购详情查询
      * @author lt
      * @Date 10:15 2023/8/1 0001
-    **/
+     **/
     public WantBuyDetailRes detail(Long id) {
         //先判断求购订单是否存在
         KwoWantBuy kwoWantBuy = kwpWantBuyMapper.selectById(id);
@@ -341,15 +312,14 @@ public class KwpWantBuyService {
             throw new BusinessException("求购信息不存在");
         }
         WantBuyDetailRes responseData = BeanUtils.copyProperties(kwoWantBuy, WantBuyDetailRes.class);
-        //TODO 还未定义好求购状态(从表里面拿还是enum)
-        responseData.setStatusLabel(DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(responseData.getStatus())));
+        responseData.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), responseData.getGoodsType()))
+                .setStatusLabel(DictEnum.getLabel(DictTypeEnum.WANT_BUY_STATUS.getType(), String.valueOf(responseData.getStatus())));
         //求购地址信息
         KwoWantBuyAddress address = kwpWantBuyAddressMapper.selectOne(new LambdaQueryWrapper<KwoWantBuyAddress>()
-                .eq(KwoWantBuyAddress::getWantBuyId, id).eq(KwoWantBuyAddress::getDelFlag, Global.NO));
+                .eq(KwoWantBuyAddress::getWantBuyId, id).eq(KwoWantBuyAddress::getDelFlag, Global.NO).last("LIMIT 1"));
         if (Objects.nonNull(address)) {
             WantBuyAddressDetailRes wantBuyAddressInfo = BeanUtils.copyProperties(address, WantBuyAddressDetailRes.class);
-            wantBuyAddressInfo.setTypeLabel(DictEnum.getLabel(DictTypeEnum.TORDER_ADDRESS_TYPE.getType(), String.valueOf(wantBuyAddressInfo.getType())));
-            System.out.println(wantBuyAddressInfo);
+            wantBuyAddressInfo.setTypeLabel(DictEnum.getLabel(DictTypeEnum.TORDER_ADDRESS_TYPE.getType(), wantBuyAddressInfo.getType()));
             responseData.setAddressInfo(wantBuyAddressInfo);
         }
         //获取求购企业信息
@@ -359,7 +329,7 @@ public class KwpWantBuyService {
         }
         //求购支付方式集合
         List<KwoWantBuyTrading> tradingList = kwoWantBuyTradingService.getByWantBuyId(id);
-        if (Objects.nonNull(tradingList) && !tradingList.isEmpty()) {
+        if (CollectionUtils.isNotEmpty(tradingList)) {
             List<String> tradings = tradingList.stream().map(KwoWantBuyTrading::getTrading).collect(Collectors.toList());
             responseData.setTradings(tradings);
             //改成stream流的方式
@@ -381,74 +351,71 @@ public class KwpWantBuyService {
     public void update(UpdateWantBuyParam param) {
         Long id = param.getId();
         KwoWantBuy kwoWantBuy = selectOneById(id);
-        if (Objects.isNull(kwoWantBuy)) throw new BusinessException("求购信息不存在");
+        if (Objects.isNull(kwoWantBuy)) {
+            throw new BusinessException("求购信息不存在");
+        }
+        if (!Objects.equals(String.valueOf(kwoWantBuy.getStatus()), DictEnum.WANT_BUY_STATUS_0.getValue())) {
+            checkParams(param);
+        }
         //1.更新求购信息
-        Date currentDate = new Date();
-        Long userId = LoginUserHolder.getUserId();
-        KwoWantBuy wantBuy = BeanUtils.copyProperties(param, KwoWantBuy.class);
-        wantBuy.setUpdateBy(userId);
-        wantBuy.setUpdateTime(currentDate);
-        kwpWantBuyMapper.updateById(wantBuy);
-        //int i = kwpWantBuyMapper.updateById(wantBuy);
-        //2.更新求购地址信息,判断是否存在地址信息
-
+        BeanUtils.copyProperties(param, kwoWantBuy);
+        kwpWantBuyMapper.updateById(kwoWantBuy);
+        //2.更新求购地址信息
+        kwoWantBuyAddressService.delAddressByWantBuyIds(List.of(id));
         if (Objects.nonNull(param.getAddressInfo())) {
-            //判断是否存在地址信息
-            LambdaQueryWrapper<KwoWantBuyAddress> queryWrapper = new LambdaQueryWrapper<>();
-            queryWrapper.eq(KwoWantBuyAddress::getWantBuyId, id).eq(KwoWantBuyAddress::getDelFlag, Global.NO);
-            KwoWantBuyAddress kwoWantBuyAddress = kwpWantBuyAddressMapper.selectOne(queryWrapper);
-            //存在地址信息则更新,不存在则新增
+            KwoWantBuyAddress kwoWantBuyAddress = BeanUtils.copyProperties(param.getAddressInfo(), KwoWantBuyAddress.class);
+            kwoWantBuyAddress.setWantBuyId(id);
+            kwpWantBuyAddressMapper.insert(kwoWantBuyAddress);
 
-            KwoWantBuyAddress kwoWantBuyAddress1 = BeanUtils.copyProperties(param.getAddressInfo(), KwoWantBuyAddress.class);
-            kwoWantBuyAddress1.setUpdateTime(currentDate);
-            kwoWantBuyAddress1.setUpdateBy(userId);
-            if (Objects.nonNull(kwoWantBuyAddress)) {
-                kwoWantBuyAddress1.setId(kwoWantBuyAddress.getId());
-                kwpWantBuyAddressMapper.updateById(kwoWantBuyAddress1);
-            } else {
-                //不存在则新增地址信息
-                kwoWantBuyAddress1.setWantBuyId(id);
-                kwoWantBuyAddress1.setCreateTime(currentDate);
-                kwoWantBuyAddress1.setCreateBy(userId);
-                kwpWantBuyAddressMapper.insert(kwoWantBuyAddress1);
-            }
         }
         //3.更新求购支付方式
+        kwoWantBuyTradingService.deleteByWantBuyid(id);
         List<String> tradings = param.getTradings();
         if (CollectionUtils.isNotEmpty(tradings)) {
-            kwoWantBuyTradingService.deleteByWantBuyid(id);
-            ArrayList<KwoWantBuyTrading> list = new ArrayList<>(param.getTradings().size());
+            List<KwoWantBuyTrading> list = new ArrayList<>(param.getTradings().size());
             for (String trading : tradings) {
                 KwoWantBuyTrading kwoWantBuyTrading = new KwoWantBuyTrading();
                 kwoWantBuyTrading.setWantBuyId(id);
                 kwoWantBuyTrading.setTrading(trading);
-                kwoWantBuyTrading.setCreateTime(currentDate);
-                kwoWantBuyTrading.setUpdateTime(currentDate);
-                kwoWantBuyTrading.setCreateBy(userId);
                 list.add(kwoWantBuyTrading);
             }
             kwpWantBuyTradingMapper.insertBatch(list);
         }
+    }
 
-
+    private void checkParams(UpdateWantBuyParam param) {
+        if (StringUtils.isBlank(param.getName())) {
+            throw new BusinessException("商品名称不能为空!");
+        }
+        if (StringUtils.isBlank(param.getPrice())) {
+            throw new BusinessException("求购单价不能为空!");
+        }
+        if (StringUtils.isBlank(param.getAmount())) {
+            throw new BusinessException("求购总量不能为空!");
+        }
+        if (StringUtils.isBlank(param.getContacts())) {
+            throw new BusinessException("联系人不能为空!");
+        }
+        if (Objects.isNull(param.getPhone())) {
+            throw new BusinessException("联系电话不能为空!");
+        }
     }
 
     /**
-     * @Desc: 根据id查询求购信息
      * @param id
      * @return
+     * @Desc: 根据id查询求购信息
      */
     public KwoWantBuy selectOneById(Long id) {
         LambdaQueryWrapper<KwoWantBuy> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(KwoWantBuy::getId, id)
-                .eq(KwoWantBuy::getDelFlag, Global.NO);
+        queryWrapper.eq(KwoWantBuy::getId, id).eq(KwoWantBuy::getDelFlag, Global.NO).last("LIMIT 1");
         return kwpWantBuyMapper.selectOne(queryWrapper);
     }
 
     /**
-     * @Desc: 查询求购角标统计数量
      * @param
      * @return
+     * @Desc: 查询求购角标统计数量
      */
     public Map statistic(WantBuySelectParam params) {
         if (StringUtils.isNotBlank(params.getTrading())) {

+ 6 - 4
sckw-modules/sckw-order/src/main/resources/mapper/KwoWantBuyMapper.xml

@@ -36,10 +36,12 @@
     </resultMap>
 
     <sql id="where">
-        kb.del_flag = 0 and kt.del_flag = 0
-        <if test="wantBuyReq.startCreateTime != null and wantBuyReq.endCreateTime != null">
-            and kb.create_time between #{wantBuyReq.startCreateTime,jdbcType=TIMESTAMP} and
-            #{wantBuyReq.endCreateTime,jdbcType=TIMESTAMP}
+        kb.del_flag = 0 and kt.del_flag = 0 and kba.del_flag = 0
+        <if test="wantBuyReq.startCreateTime != null">
+            and kb.create_time &gt;= #{wantBuyReq.startCreateTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="wantBuyReq.endCreateTime != null">
+            and kb.create_time &lt;= #{wantBuyReq.endCreateTime,jdbcType=TIMESTAMP}
         </if>
         <if test="wantBuyReq.tradings != null and wantBuyReq.tradings.size() > 0">
             and kt.trading in

+ 6 - 6
sckw-modules/sckw-order/src/main/resources/mapper/KwoWantBuyTradingMapper.xml

@@ -23,12 +23,12 @@
                 #{item.wantBuyId,jdbcType=BIGINT},
                 #{item.trading,jdbcType=VARCHAR},
                 #{item.remark,jdbcType=VARCHAR},
-                #{item.status,jdbcType=VARCHAR},
-                #{item.createBy,jdbcType=VARCHAR},
-                #{item.createTime,jdbcType=VARCHAR},
-                #{item.updateBy,jdbcType=VARCHAR},
-                #{item.updateTime,jdbcType=VARCHAR},
-                #{item.delFlag,jdbcType=VARCHAR}
+                #{item.status,jdbcType=INTEGER},
+                #{item.createBy,jdbcType=BIGINT},
+                #{item.createTime,jdbcType=TIMESTAMP},
+                #{item.updateBy,jdbcType=BIGINT},
+                #{item.updateTime,jdbcType=TIMESTAMP},
+                #{item.delFlag,jdbcType=INTEGER}
             </trim>
         </foreach>
     </insert>

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

@@ -217,7 +217,7 @@ public class KwpGoodsService {
         }
         EntCacheResDto supplyEnt = entMap.get(detail.getSupplyEntId());
         if (Objects.nonNull(supplyEnt)) {
-            detail.setEntAddress(supplyEnt.getFirmName());
+            detail.setSupplyEnt(supplyEnt.getFirmName());
         }
         UserCacheResDto managerInfo = remoteSystemService.queryUserCacheById(detail.getManager());
         if (Objects.nonNull(managerInfo)) {