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

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

18482106067 2 лет назад
Родитель
Сommit
c5f1b7f44b
39 измененных файлов с 515 добавлено и 88 удалено
  1. 24 0
      sckw-gateway/src/main/resources/bootstrap-pdy.yml
  2. 1 1
      sckw-modules-api/sckw-manage-api/src/main/java/com/sckw/manage/api/RemoteManageService.java
  3. 9 10
      sckw-modules-api/sckw-order-api/src/main/java/com/sckw/order/api/dubbo/TradeOrderInfoService.java
  4. 1 1
      sckw-modules-api/sckw-product-api/src/main/java/com/sckw/product/api/dubbo/GoodsInfoService.java
  5. 5 0
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/dto/LogisticsOrderDTO.java
  6. 4 0
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/vo/KwtLogisticsOrderVO.java
  7. 5 0
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/vo/LogisticsOrderVO.java
  8. 5 0
      sckw-modules/sckw-order/pom.xml
  9. 24 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwpWantBuyController.java
  10. 8 6
      sckw-modules/sckw-order/src/main/java/com/sckw/order/dubbo/TradeOrderInfoServiceImpl.java
  11. 9 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/dto/OrderCheckDTO.java
  12. 17 14
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/dto/TransportDemandExport.java
  13. 56 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/dto/WantBuyExport.java
  14. 7 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/WantBuySelectParam.java
  15. 25 9
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java
  16. 14 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderUnitService.java
  17. 3 1
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTransportDemandService.java
  18. 47 5
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwpWantBuyService.java
  19. 6 0
      sckw-modules/sckw-order/src/main/resources/mapper/KwoWantBuyMapper.xml
  20. 14 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpSettlementWalletController.java
  21. 3 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpSettlementLogisticsMapper.java
  22. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/SettlementLogisticsDto.java
  23. 0 4
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/OfflinePaymentReq.java
  24. 19 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpSettlementLogisticsService.java
  25. 86 17
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpSettlementWalletService.java
  26. 22 5
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpSettlementLogisticsMapper.xml
  27. 13 0
      sckw-modules/sckw-product/src/main/java/com/sckw/product/controller/KwpGoodsController.java
  28. 4 0
      sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/req/AddGoodsDraftParam.java
  29. 3 0
      sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/req/UpdateGoodsParam.java
  30. 29 0
      sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsService.java
  31. 6 1
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/vo/AcceptCarriageOrderVo.java
  32. 6 2
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/vo/ConsignOrderVo.java
  33. 4 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/ConsignOrderVO.java
  34. 4 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/KwtLogisticsOrderVO.java
  35. 9 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/AcceptCarriageOrderService.java
  36. 11 2
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/ConsignOrderService.java
  37. 6 2
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/LogisticsConsignmentService.java
  38. 3 3
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/TransportCommonService.java
  39. 2 2
      sckw-modules/sckw-transport/src/main/resources/bootstrap.yml

+ 24 - 0
sckw-gateway/src/main/resources/bootstrap-pdy.yml

@@ -0,0 +1,24 @@
+spring:
+  cloud:
+    nacos:
+      discovery:
+        # 服务注册地址
+        server-addr: 10.10.10.230:8848
+        # 命名空间
+        namespace: sckw_pdy
+        # 共享配置
+        group: sckw-service-platform
+      config:
+        # 配置中心地址
+        server-addr: 10.10.10.230:8848
+        # 配置文件格式
+        file-extension: yaml
+        # 命名空间
+        namespace: sckw_pdy
+        # 共享配置
+        group: sckw-service-platform
+        #可以读多个配置文件  需要在同一个命名空间下面可以是不同的组
+        extension-configs:
+          - dataId: sckw-common.yml
+            group: sckw-service-platform
+            refresh: true

+ 1 - 1
sckw-modules-api/sckw-manage-api/src/main/java/com/sckw/manage/api/RemoteManageService.java

@@ -23,7 +23,7 @@ public interface RemoteManageService {
     Map<Long, List<EntAddressResDto>> queryEntAddressByEntIdList(List<Long> idList);
 
     /**
-     * @param entId 当前企业id  targetEntId对方企业id  cooperateType合作关系
+     * @param entId 当前企业id  targetEntId对方企业id  cooperateType合作关系[CooperateTypeEnum]
      * @return  FindEntCooperateResVo
      * @desc: 查询合作信息
      * @author: czh

+ 9 - 10
sckw-modules-api/sckw-order-api/src/main/java/com/sckw/order/api/dubbo/TradeOrderInfoService.java

@@ -28,16 +28,6 @@ public interface TradeOrderInfoService {
      */
     void updateOrderStatus(UpdateOrderStatusParam param);
 
-    /**
-     * @desc: 废弃
-     * @desc: 更新订单委托量、已履约量
-     * @author: yzc
-     * @date: 2023-07-18 18:34
-     * @Param param:
-     * @return: com.sckw.core.web.response.HttpResult
-     */
-    HttpResult updateOrderAmount(UpdateOrderAmountParam param);
-
     /**
      * @desc: 生成或撤销物流订单
      * @author: yzc
@@ -73,4 +63,13 @@ public interface TradeOrderInfoService {
      * @return: void
      */
     void updateAssociateStatement(UpdateAssociateStatementParam param);
+
+    /**
+     * @desc: 是否关联企业  true是,false否
+     * @author: yzc
+     * @date: 2023-08-16 16:20
+     * @Param entId:
+     * @return: java.lang.Boolean
+     */
+    Boolean associateEnt(Long entId);
 }

+ 1 - 1
sckw-modules-api/sckw-product-api/src/main/java/com/sckw/product/api/dubbo/GoodsInfoService.java

@@ -53,7 +53,7 @@ public interface GoodsInfoService {
     HttpResult updateGoodsAmount(Long id, BigDecimal amount);
 
     /**
-     * @desc: 是否有关联客服经理
+     * @desc: 是否有关联客服经理 true是,false否
      * @author: yzc
      * @date: 2023-08-15 10:06
      * @Param userId:  用户id

+ 5 - 0
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/dto/LogisticsOrderDTO.java

@@ -1,6 +1,7 @@
 package com.sckw.transport.api.model.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -19,21 +20,25 @@ public class LogisticsOrderDTO implements Serializable {
     /**
      * 物流订单id
      */
+    @JsonProperty("lOrderId")
     private String lOrderId;
 
     /**
      * 物流订单编号
      */
+    @JsonProperty("lOrderNO")
     private String lOrderNO;
 
     /**
      * 销售订单id
      */
+    @JsonProperty("tOrderId")
     private String tOrderId;
 
     /**
      * 销售订单编号
      */
+    @JsonProperty("tOrderNO")
     private String tOrderNO;
 
     /**

+ 4 - 0
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/vo/KwtLogisticsOrderVO.java

@@ -1,6 +1,7 @@
 package com.sckw.transport.api.model.vo;
 
 import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -27,16 +28,19 @@ public class KwtLogisticsOrderVO implements Serializable {
     /**
      * 交易订单id(kwo_trade_order)
      */
+    @JsonProperty("tOrderId")
     private Long tOrderId;
 
     /**
      * 交易订单编号(kwo_trade_order)
      */
+    @JsonProperty("tOrderNo")
     private String tOrderNo;
 
     /**
      * 物流订单编号
      */
+    @JsonProperty("lOrderNo")
     private String lOrderNo;
 
     /**

+ 5 - 0
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/vo/LogisticsOrderVO.java

@@ -1,6 +1,7 @@
 package com.sckw.transport.api.model.vo;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -19,21 +20,25 @@ public class LogisticsOrderVO implements Serializable {
     /**
      * 物流订单id
      */
+    @JsonProperty("lOrderId")
     private String lOrderId;
 
     /**
      * 物流订单编号
      */
+    @JsonProperty("lOrderNO")
     private String lOrderNO;
 
     /**
      * 销售订单id
      */
+    @JsonProperty("tOrderId")
     private String tOrderId;
 
     /**
      * 销售订单编号
      */
+    @JsonProperty("tOrderNO")
     private String tOrderNO;
 
     /**

+ 5 - 0
sckw-modules/sckw-order/pom.xml

@@ -91,6 +91,11 @@
             <groupId>com.sckw</groupId>
             <artifactId>sckw-transport-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-manage-api</artifactId>
+            <version>1.0.0</version>
+        </dependency>
 
     </dependencies>
 

+ 24 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwpWantBuyController.java

@@ -1,14 +1,21 @@
 package com.sckw.order.controller;
 
 import com.sckw.core.annotation.Log;
+import com.sckw.core.exception.BusinessException;
+import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.web.response.HttpResult;
+import com.sckw.excel.utils.ExcelUtil;
+import com.sckw.order.model.dto.WantBuyExport;
 import com.sckw.order.model.vo.req.*;
 import com.sckw.order.serivce.KwpWantBuyService;
+import jakarta.servlet.http.HttpServletResponse;
 import lombok.RequiredArgsConstructor;
 import org.springframework.http.MediaType;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 /**
  * @desc: 求购controller
  * @author: yzc
@@ -142,4 +149,21 @@ public class KwpWantBuyController {
     public HttpResult statistic(@RequestBody WantBuySelectParam params) {
         return HttpResult.ok(kwpWantBuyService.statistic(params));
     }
+
+    /**
+     * @desc: 求购导出
+     * @author: yzc
+     * @date: 2023-08-16 16:09
+     * @Param param:
+     * @Param response:
+     * @return: void
+     */
+    @PostMapping(value = "/export", produces = MediaType.APPLICATION_JSON_VALUE)
+    public void export(@RequestBody WantBuySelectParam param, HttpServletResponse response) {
+        List<WantBuyExport> list = kwpWantBuyService.export(param);
+        if (CollectionUtils.isEmpty(list)) {
+            throw new BusinessException("导出数据为空!");
+        }
+        ExcelUtil.downData(response, WantBuyExport.class, list);
+    }
 }

+ 8 - 6
sckw-modules/sckw-order/src/main/java/com/sckw/order/dubbo/TradeOrderInfoServiceImpl.java

@@ -17,6 +17,7 @@ import com.sckw.order.model.KwoTradeOrderTrack;
 import com.sckw.order.serivce.KwoTradeOrderContractService;
 import com.sckw.order.serivce.KwoTradeOrderService;
 import com.sckw.order.serivce.KwoTradeOrderTrackService;
+import com.sckw.order.serivce.KwoTradeOrderUnitService;
 import com.sckw.redis.constant.RedisConstant;
 import com.sckw.redis.utils.RedissonUtils;
 import com.sckw.stream.model.SckwBusSum;
@@ -48,6 +49,8 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
     private KwoTradeOrderTrackService kwoTradeOrderTrackService;
     @Autowired
     private KwoTradeOrderContractService kwoTradeOrderContractService;
+    @Autowired
+    private KwoTradeOrderUnitService tradeOrderUnitService;
 
 
     @Override
@@ -93,12 +96,6 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
         saveMongoDb(updateParam);
     }
 
-    @Override
-    public HttpResult updateOrderAmount(UpdateOrderAmountParam param) {
-        return HttpResult.ok();
-
-    }
-
     @Override
     @Transactional(rollbackFor = Exception.class)
     public HttpResult createOrCancelLogisticsOrder(CreateOrCancelLogisticsOrderParam param) {
@@ -271,6 +268,11 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
 
     }
 
+    @Override
+    public Boolean associateEnt(Long entId) {
+        return tradeOrderUnitService.associateEnt(entId);
+    }
+
     /**
      * @desc: mq保存mongodb
      * @author: yzc

+ 9 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/dto/OrderCheckDTO.java

@@ -48,10 +48,19 @@ public class OrderCheckDTO {
      */
     private Long procureTopEntId;
 
+    /**
+     * 采购企业id
+     */
+    private Long procureEntId;
+
     /**
      * 供应一级企业id
      */
     private Long supplyTopEntId;
+    /**
+     * 供应企业id
+     */
+    private Long supplyEntId;
 
     /**
      * 订单来源 1采购下单2代客下单

+ 17 - 14
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/dto/TransportDemandExport.java

@@ -20,40 +20,43 @@ public class TransportDemandExport implements Serializable {
     @Serial
     private static final long serialVersionUID = -7951209824419422786L;
 
-    @ExcelProperty(value = "状态", index = 0)
+    @ExcelProperty(value = "序号" )
+    private String serialNumber;
+
+    @ExcelProperty(value = "状态")
     private String statusLabel;
 
-    @ExcelProperty(value = "商品名称", index = 1)
+    @ExcelProperty(value = "商品名称")
     private String name;
 
-    @ExcelProperty(value = "分类", index = 2)
+    @ExcelProperty(value = "分类")
     private String goodsTypeLabel;
 
-    @ExcelProperty(value = "规格", index = 3)
-    private String spec;
-
-    @ExcelProperty(value = "运需单价", index = 4)
+    @ExcelProperty(value = "运需单价")
     private String price;
 
-    @ExcelProperty(value = "总计划量", index = 5)
+    @ExcelProperty(value = "总计划量")
     private String amount;
 
-    @ExcelProperty(value = "装货地址", index = 6)
+    @ExcelProperty(value = "商品规格")
+    private String spec;
+
+    @ExcelProperty(value = "装货地址")
     private String loadAddress;
 
-    @ExcelProperty(value = "卸货地址", index = 7)
+    @ExcelProperty(value = "卸货地址")
     private String unloadAddress;
 
-    @ExcelProperty(value = "截止时间", index = 8)
+    @ExcelProperty(value = "截止时间")
     private String deadline;
 
-    @ExcelProperty(value = "创建时间", index = 9)
+    @ExcelProperty(value = "创建时间")
     private String createTime;
 
-    @ExcelProperty(value = "更新时间", index = 10)
+    @ExcelProperty(value = "更新时间")
     private String updateTime;
 
-    @ExcelProperty(value = "备注", index = 11)
+    @ExcelProperty(value = "备注")
     private String remark;
 
 }

+ 56 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/dto/WantBuyExport.java

@@ -0,0 +1,56 @@
+package com.sckw.order.model.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.sckw.excel.annotation.ExcelContext;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @desc: 求购列表导出
+ * @author: yzc
+ * @date: 2023-08-16 15:36
+ */
+@Data
+@Accessors(chain = true)
+@ExcelContext(fileName = "求购列表信息", sheetName = "求购列表信息")
+public class WantBuyExport implements Serializable {
+    @Serial
+    private static final long serialVersionUID = 7225805024416842861L;
+
+
+    @ExcelProperty(value = "序号" )
+    private String serialNumber;
+
+    @ExcelProperty(value = "状态")
+    private String statusLabel;
+
+    @ExcelProperty(value = "商品名称")
+    private String name;
+
+    @ExcelProperty(value = "分类")
+    private String goodsTypeLabel;
+
+    @ExcelProperty(value = "规格尺寸")
+    private String spec;
+
+    @ExcelProperty(value = "支付方式")
+    private String tradings;
+
+    @ExcelProperty(value = "求购单价")
+    private String price;
+
+    @ExcelProperty(value = "求购总量")
+    private String amount;
+
+    @ExcelProperty(value = "创建时间")
+    private String createTime;
+
+    @ExcelProperty(value = "更新时间")
+    private String updateTime;
+
+    @ExcelProperty(value = "备注")
+    private String remark;
+}

+ 7 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/WantBuySelectParam.java

@@ -73,4 +73,11 @@ public class WantBuySelectParam extends PageRequest {
     private Long entId;
     private List<Long> entIds;
 
+    /**
+     * 指定求购id集合导出
+     */
+    private String ids;
+
+    private List<Long> wantBuyIds;
+
 }

+ 25 - 9
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java

@@ -10,6 +10,7 @@ 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.model.enums.CooperateTypeEnum;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.OrderGenerateUtils;
@@ -17,6 +18,8 @@ import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
+import com.sckw.manage.api.RemoteManageService;
+import com.sckw.manage.api.model.dto.res.FindEntCooperateResVo;
 import com.sckw.mongo.model.SckwTradeOrder;
 import com.sckw.order.dao.KwoTradeOrderMapper;
 import com.sckw.order.model.*;
@@ -62,6 +65,9 @@ public class KwoTradeOrderService {
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
 
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteManageService remoteManageService;
+
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private GoodsInfoService goodsInfoService;
 
@@ -275,15 +281,18 @@ public class KwoTradeOrderService {
         List<Long> entIds = unitInfo.stream().map(UnitInfo::getEntId).toList();
         Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntTreeByIds(entIds);
         unitInfo.forEach(e -> {
-            EntCacheResDto ent = entMap.get(e.getEntId());
+            Long entId = e.getEntId();
+            EntCacheResDto ent = entMap.get(entId);
             if (Objects.isNull(ent)) {
-                log.error("企业:{}找不到对应一级企业信息", e.getEntId());
+                log.error("企业:{}找不到对应一级企业信息", entId);
                 throw new BusinessException("一级企业信息不存在!");
             }
             if (Objects.equals(e.getUnitType(), DictEnum.TORDER_UNIT_TYPE_1.getValue())) {
-                orderCheckDTO.setProcureTopEntId(entMap.get(e.getEntId()).getId());
+                orderCheckDTO.setProcureTopEntId(ent.getId());
+                orderCheckDTO.setProcureEntId(entId);
             } else {
-                orderCheckDTO.setSupplyTopEntId(entMap.get(e.getEntId()).getId());
+                orderCheckDTO.setSupplyTopEntId(ent.getId());
+                orderCheckDTO.setSupplyEntId(entId);
             }
         });
     }
@@ -300,8 +309,15 @@ public class KwoTradeOrderService {
         BigDecimal amount = param.getAmount();
         String trading = param.getTrading();
         BigDecimal price = param.getPrice();
-        if (!isAcceptanceOrder && price.compareTo(amount.multiply(param.getUnitPrice())) != 0) {
-            throw new BusinessException("订单总金额不等于商品单价*订单总量!");
+        if (!isAcceptanceOrder) {
+            if (price.compareTo(amount.multiply(param.getUnitPrice())) != 0) {
+                throw new BusinessException("订单总金额不等于商品单价*订单总量!");
+            }
+            List<FindEntCooperateResVo> entCooperate = remoteManageService.findEntCooperate(param.getProcureEntId()
+                    , param.getSupplyEntId(), CooperateTypeEnum.SUPPLIER.getCode());
+            if (CollectionUtils.isEmpty(entCooperate)) {
+                throw new BusinessException("供采双方企业无合作关系!");
+            }
         }
         KwpGoods goods = goodsInfoService.getGoodsById(param.getGoodsId());
         if (Objects.isNull(goods) || Objects.equals(goods.getDelFlag(), Global.YES) || !Objects.equals(goods.getStatus(), 1)) {
@@ -767,10 +783,10 @@ public class KwoTradeOrderService {
             throw new BusinessException("执行中的订单才能完结订单!");
         }
         if (kwoTradeOrderUnitService.entMatch(param.getId(), LoginUserHolder.getEntId(), DictEnum.TORDER_UNIT_TYPE_2.getValue())) {
-            throw new CustomPromptException("无订单操作权限!");
+            throw new BusinessException("无订单操作权限!");
         }
-        if (transportDubboService.checkLogisticsOrderByTradeOrderId(param.getId())){
-            throw new BusinessException("订单存在未完成的物流托运,不可完结!");
+        if (transportDubboService.checkLogisticsOrderByTradeOrderId(param.getId())) {
+            throw new CustomPromptException("订单存在未完成的物流托运,不可完结!");
         }
         String lockKey = String.format(RedisConstant.TORDER_UPDATE_AMOUNT_KEY, param.getId());
         if (Boolean.FALSE.equals(RedissonUtils.tryLock(lockKey, 5L, 10L))) {

+ 14 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderUnitService.java

@@ -126,4 +126,18 @@ public class KwoTradeOrderUnitService {
         List<KwoTradeOrderUnit> list = kwoTradeOrderUnitMapper.selectList(wrapper);
         return CollectionUtils.emptyIfNull(list);
     }
+
+    /**
+     * @desc: 否关联企业  true是,false否
+     * @author: yzc
+     * @date: 2023-08-16 16:22
+     * @Param entId:
+     * @return: java.lang.Boolean
+     */
+    public Boolean associateEnt(Long entId) {
+        LambdaQueryWrapper<KwoTradeOrderUnit> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwoTradeOrderUnit::getEntId, entId).eq(KwoTradeOrderUnit::getDelFlag, Global.NO);
+        Long count = kwoTradeOrderUnitMapper.selectCount(wrapper);
+        return Objects.nonNull(count) && count > 0L;
+    }
 }

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

@@ -34,6 +34,7 @@ import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 
 /**
@@ -286,11 +287,12 @@ public class KwoTransportDemandService {
             return Collections.emptyList();
         }
         List<TransportDemandExport> result = Lists.newArrayList();
+        AtomicInteger i = new AtomicInteger(1);
         demands.forEach(e -> {
             TransportDemandExport export = BeanUtils.copyProperties(e, TransportDemandExport.class);
             export.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), e.getGoodsType()))
                     .setStatusLabel(DictEnum.getLabel(DictTypeEnum.TRANSPORT_DEMAND_STATUS.getType(), String.valueOf(e.getStatus())))
-                    .setLoadAddress(e.getLoadAreaName() + e.getLoadDetailAddress())
+                    .setLoadAddress(e.getLoadAreaName() + e.getLoadDetailAddress()).setSerialNumber(String.valueOf(i.getAndIncrement()))
                     .setUnloadAddress(e.getUnloadAreaName() + e.getUnloadDetailAddress())
                     .setDeadline(Objects.isNull(e.getDeadline()) ? null : DateUtil.dateToStr(e.getDeadline()))
                     .setCreateTime(Objects.isNull(e.getCreateTime()) ? null : DateUtil.getDateTime(e.getCreateTime()))

+ 47 - 5
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwpWantBuyService.java

@@ -16,12 +16,14 @@ import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.context.LoginUserHolder;
+import com.sckw.excel.utils.DateUtil;
 import com.sckw.order.dao.KwpWantBuyAddressMapper;
 import com.sckw.order.dao.KwpWantBuyMapper;
 import com.sckw.order.dao.KwpWantBuyTradingMapper;
 import com.sckw.order.model.KwoWantBuy;
 import com.sckw.order.model.KwoWantBuyAddress;
 import com.sckw.order.model.KwoWantBuyTrading;
+import com.sckw.order.model.dto.WantBuyExport;
 import com.sckw.order.model.vo.req.*;
 import com.sckw.order.model.vo.res.WantBuyAddressDetailRes;
 import com.sckw.order.model.vo.res.WantBuyDetailRes;
@@ -36,6 +38,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 
 /**
@@ -307,11 +310,11 @@ public class KwpWantBuyService {
     public void dels(WantBuyDels param) {
         List<Long> ids = StringUtils.splitStrToList(param.getIds(), Long.class);
         LambdaQueryWrapper<KwoWantBuy> wrapper = new LambdaQueryWrapper<>();
-        wrapper.in(KwoWantBuy::getId, ids).eq(KwoWantBuy::getStatus, 0)
+        wrapper.in(KwoWantBuy::getId, ids).ne(KwoWantBuy::getStatus, 1)
                 .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("删除操作仅针对“草稿”状态的单据");
+            throw new BusinessException("删除操作仅针对“已下架”“草稿”状态的单据");
         }
         LambdaUpdateWrapper<KwoWantBuy> updateWrapper = new LambdaUpdateWrapper<>();
         updateWrapper.set(KwoWantBuy::getDelFlag, Global.YES).in(KwoWantBuy::getId, ids);
@@ -446,9 +449,7 @@ public class KwpWantBuyService {
             List<String> longList = stringToLongList(params.getTrading());
             params.setTradings(longList);
         }
-        if (StringUtils.isNotBlank(params.getStatus())) {
-            params.setStatus(params.getStatus());
-        }
+        params.setStatus(null);
         //商品分类筛选处理
         if (StringUtils.isNotBlank(params.getGoodsType()) && StringUtils.isNotBlank(params.getGoodsTypeValue())) {
             List<String> goodsTypes = goodsTypeHandle(params);
@@ -475,4 +476,45 @@ public class KwpWantBuyService {
         res.setTableTops(tableTops).setTableBottom(tableBottom);
         return res;
     }
+
+    public List<WantBuyExport> export(WantBuySelectParam param) {
+        WantBuySelectParam selectParam = new WantBuySelectParam();
+        if (StringUtils.isNotBlank(param.getIds())) {
+            List<Long> ids = StringUtils.splitStrToList(param.getIds(), Long.class);
+            selectParam.setWantBuyIds(ids);
+        } else {
+            BeanUtils.copyProperties(param, selectParam);
+            if (StringUtils.isNotBlank(selectParam.getTrading())) {
+                List<String> longList = stringToLongList(selectParam.getTrading());
+                selectParam.setTradings(longList);
+            }
+            if (StringUtils.isNotBlank(selectParam.getStatus())) {
+                selectParam.setStatus(selectParam.getStatus());
+            }
+            //商品分类筛选处理
+            if (StringUtils.isNotBlank(selectParam.getGoodsType()) && StringUtils.isNotBlank(selectParam.getGoodsTypeValue())) {
+                List<String> goodsTypes = goodsTypeHandle(selectParam);
+                selectParam.setGoodsTypeValueSearch(goodsTypes);
+            }
+        }
+        selectParam.setEntId(LoginUserHolder.getEntId());
+        List<WantBuySelectRes> wantBuyDto = kwpWantBuyMapper.pageSelect(selectParam);
+        if (CollectionUtils.isEmpty(wantBuyDto)) {
+            return Collections.emptyList();
+        }
+        List<WantBuyExport> result = new ArrayList<>();
+        AtomicInteger i = new AtomicInteger(1);
+        wantBuyDto.forEach(e -> {
+            WantBuyExport export = BeanUtils.copyProperties(e, WantBuyExport.class);
+            List<String> tradings = e.getWantBuyTradings().stream()
+                    .map(wantBuyTradingRes -> DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), wantBuyTradingRes.getTrading()))
+                    .collect(Collectors.toList());
+            export.setSerialNumber(String.valueOf(i.getAndIncrement())).setTradings(String.join(Global.COMMA, tradings))
+                    .setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), e.getGoodsType()))
+                    .setCreateTime(Objects.isNull(e.getCreateTime()) ? null : DateUtil.getDateTime(e.getCreateTime()))
+                    .setUpdateTime(Objects.isNull(e.getUpdateTime()) ? null : DateUtil.getDateTime(e.getUpdateTime()));
+            result.add(export);
+        });
+        return result;
+    }
 }

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

@@ -55,6 +55,12 @@
                 #{item,jdbcType=VARCHAR}
             </foreach>
         </if>
+        <if test="wantBuyReq.wantBuyIds != null and wantBuyReq.wantBuyIds.size() > 0">
+            and kb.id in
+            <foreach collection="wantBuyReq.wantBuyIds" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+        </if>
         <if test="wantBuyReq.status != null and wantBuyReq.status != ''">
             and kb.status = #{wantBuyReq.status}
         </if>

+ 14 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpSettlementWalletController.java

@@ -53,6 +53,20 @@ public class KwpSettlementWalletController {
     }
 
 
+    /**
+     *
+     * 运费-货到付款-查询钱包余额
+     *
+     * @param id 结算单id
+     * @author Aick Spt
+     * @date 2023-08-16 11:15
+     */
+    @GetMapping(name = "运费-货到付款-查询钱包余额", path = "getConfirmLogisticsPay")
+    public HttpResult getConfirmLogisticsPay(@RequestParam("id") @NotBlank(message = "id不能为空") String id) {
+        return HttpResult.ok(kwpSettlementWalletService.getConfirmLogisticsPayment(Long.parseLong(id)));
+    }
+
+
     //  =========  销售收付款  =========
 
     /**

+ 3 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpSettlementLogisticsMapper.java

@@ -2,6 +2,7 @@ package com.sckw.payment.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.payment.model.KwpSettlementLogistics;
+import com.sckw.payment.model.dto.LedgerUnitDto;
 import com.sckw.payment.model.dto.SettlementLogisticsDto;
 import com.sckw.payment.model.vo.req.SettlementReq;
 import com.sckw.payment.model.vo.res.SettlementLogisticsSumVo;
@@ -51,4 +52,6 @@ public interface KwpSettlementLogisticsMapper extends BaseMapper<KwpSettlementLo
      * @date 2023-07-24 16:24
      */
     List<SettlementLogisticsDto> selectLogisticsList(@Param("settlementReq") SettlementReq settlementReq, @Param("ids") List<Long> ids);
+
+    List<LedgerUnitDto> getListById(@Param("id") Long id);
 }

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/SettlementLogisticsDto.java

@@ -18,7 +18,7 @@ import java.util.Date;
 @Setter
 @NoArgsConstructor
 @AllArgsConstructor
-public class SettlementLogisticsDto {
+public class SettlementLogisticsDto implements ISettlement  {
     /**
      * 主键
      */

+ 0 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/OfflinePaymentReq.java

@@ -38,10 +38,6 @@ public class OfflinePaymentReq extends BasePara {
     private BigDecimal price;
 
 
-    /**
-     * 附件地址
-     */
-    @NotBlank(message = "相关附件不能为空")
     private String url;
 
 

+ 19 - 2
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpSettlementLogisticsService.java

@@ -12,6 +12,7 @@ import com.sckw.payment.model.KwpSettlementLogistics;
 import com.sckw.payment.model.constant.LogisticsUnitType;
 import com.sckw.payment.model.constant.SettlementEnum;
 import com.sckw.payment.model.constant.TradingEnum;
+import com.sckw.payment.model.dto.LedgerUnitDto;
 import com.sckw.payment.model.dto.SettlementLogisticsDto;
 import com.sckw.payment.model.vo.req.SettlementReq;
 import com.sckw.payment.model.vo.res.SettlementLogisticsStatusCountVo;
@@ -146,6 +147,12 @@ public class KwpSettlementLogisticsService {
         if (StringUtils.isNotBlank(settlementReq.getEndCreateTime())) {
             settlementReq.setEndCreateTime(StringTimeUtil.fillEnd(settlementReq.getEndCreateTime()));
         }
+        if (StringUtils.isNotBlank(settlementReq.getStartReceiptTime())) {
+            settlementReq.setStartCreateTime(StringTimeUtil.fillStart(settlementReq.getStartReceiptTime()));
+        }
+        if (StringUtils.isNotBlank(settlementReq.getEndReceiptTime())) {
+            settlementReq.setEndCreateTime(StringTimeUtil.fillEnd(settlementReq.getEndReceiptTime()));
+        }
         //加上当前登录者顶级企业id用于过滤数据
         settlementReq.setEntId(LoginUserHolder.getEntId());
     }
@@ -201,7 +208,7 @@ public class KwpSettlementLogisticsService {
         List<TableTop> tableTops = new ArrayList<>();
         TableTop tableTop = new TableTop();
         //总
-        settlementReq.setStatus(null);
+        settlementReq.setStatus(SettlementEnum.ALL.getStatus());
         settlementLogisticsStatusCountVos.setAllCount(settlementLogisticsMapper.getCountList(settlementReq));
         tableTop.setName("全部").setValue(settlementReq.getStatus()).setTotal(Math.toIntExact(settlementLogisticsStatusCountVos.getAllCount()));
         tableTops.add(tableTop);
@@ -238,7 +245,7 @@ public class KwpSettlementLogisticsService {
      * @author Aick Spt
      * @date 2023-08-07 10:14
      */
-    private SettlementLogisticsDto detail(Long id, Integer unitType, Integer unitTypeTwo) {
+    public SettlementLogisticsDto detail(Long id, Integer unitType, Integer unitTypeTwo) {
         SettlementLogisticsDto settlementLogisticsDto = settlementLogisticsMapper.detail(id, unitType, unitTypeTwo);
         if (settlementLogisticsDto == null) {
             throw new BusinessException("查无数据");
@@ -247,6 +254,16 @@ public class KwpSettlementLogisticsService {
         return settlementLogisticsDto;
     }
 
+    /**
+     * 根据id查询结算单关联的企业信息
+     *
+     * @param id 结算单id
+     * @return
+     */
+    public List<LedgerUnitDto> getListById(Long id) {
+        return settlementLogisticsMapper.getListById(id);
+    }
+
 
     private String changeDict(String trading) {
         //字典等数据转换

+ 86 - 17
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpSettlementWalletService.java

@@ -20,10 +20,7 @@ import com.sckw.payment.dao.KwpSettlementLogisticsTrackMapper;
 import com.sckw.payment.dao.KwpSettlementWalletMapper;
 import com.sckw.payment.model.*;
 import com.sckw.payment.model.constant.*;
-import com.sckw.payment.model.dto.LedgerUnitDto;
-import com.sckw.payment.model.dto.SettlementLogisticsDto;
-import com.sckw.payment.model.dto.SettlementTradeDto;
-import com.sckw.payment.model.dto.SettlementWalletDto;
+import com.sckw.payment.model.dto.*;
 import com.sckw.payment.model.vo.req.OfflinePaymentReq;
 import com.sckw.payment.model.vo.req.SettlementWalletReq;
 import com.sckw.payment.model.vo.req.WalletPayReq;
@@ -516,24 +513,94 @@ public class KwpSettlementWalletService {
 
     }
 
+    public WalletDto getConfirmLogisticsPayment(Long id) {
+        //todo
+        WalletDto walletDto = new WalletDto();
+        walletDto.setName("测试钱宝");
+        walletDto.setMemberName("");
+        walletDto.setUid("kll_0001");
+        walletDto.setChannel("1");
+        walletDto.setCreateTime(LocalDateTime.now());
+        walletDto.setFilter("kll_0002");
+        walletDto.setFreeze(0L);
+        walletDto.setApMoney(0L);
+        walletDto.setTotalMoney(12000L);
+        walletDto.setMoney(1L);
+
+        return walletDto;
+//        SettlementLogisticsDto byId = kwpSettlementLogisticsService.detail(id, LogisticsUnitType.CARRIER, LogisticsUnitType.SHIPPER);
+//        if (Objects.isNull(byId)) {
+//            throw new BusinessException("结算单不存在");
+//        }
+//        if (StringUtils.isNotBlank(byId.getTrading()) && !byId.getTrading().startsWith(TradingEnum.RECEIVE_PAY.getValue())) {
+//            throw new BusinessException("只支持货货到付款方式订单进行当前操作");
+//        }
+//        List<LedgerUnitDto> listById = kwpSettlementLogisticsService.getListById(id);
+//        if (CollectionUtils.isEmpty(listById) || listById.size() != NumberConstant.TWO) {
+//            throw new BusinessException("对账单交易企业双方不存在或缺少");
+//        }
+//        return getWalletBalance(listById, byId.getTrading());
+    }
+
+
     /**
      * 货到付款-查询钱包余额
      *
      * @param id 结算单id
      * @return
      */
-    public BigDecimal getConfirmTradePayment(Long id) {
-        SettlementTradeDto byId = kwpSettlementTradeService.getById(id, TradeUnitType.SELL);
-        if (Objects.isNull(byId)) {
-            throw new BusinessException("结算单不存在");
-        }
-        if (StringUtils.isNotBlank(byId.getTrading()) && !byId.getTrading().startsWith(TradingEnum.RECEIVE_PAY.getValue())) {
-            throw new BusinessException("只支持货货到付款方式订单进行当前操作");
-        }
-        List<LedgerUnitDto> listById = kwpSettlementTradeService.getListById(id);
-        if (CollectionUtils.isEmpty(listById) || listById.size() != NumberConstant.TWO) {
-            throw new BusinessException("对账单交易企业双方不存在或缺少");
-        }
+    public WalletDto getConfirmTradePayment(Long id) {
+        //todo
+        WalletDto walletDto = new WalletDto();
+        walletDto.setName("测试钱宝");
+        walletDto.setMemberName("");
+        walletDto.setUid("kll_0001");
+        walletDto.setChannel("1");
+        walletDto.setCreateTime(LocalDateTime.now());
+        walletDto.setFilter("kll_0002");
+        walletDto.setFreeze(0L);
+        walletDto.setApMoney(0L);
+        walletDto.setTotalMoney(12000L);
+        walletDto.setMoney(1L);
+
+        return walletDto;
+//        SettlementTradeDto byId = kwpSettlementTradeService.getById(id, TradeUnitType.SELL);
+//        if (Objects.isNull(byId)) {
+//            throw new BusinessException("结算单不存在");
+//        }
+//        if (StringUtils.isNotBlank(byId.getTrading()) && !byId.getTrading().startsWith(TradingEnum.RECEIVE_PAY.getValue())) {
+//            throw new BusinessException("只支持货货到付款方式订单进行当前操作");
+//        }
+//        List<LedgerUnitDto> listById = kwpSettlementTradeService.getListById(id);
+//        if (CollectionUtils.isEmpty(listById) || listById.size() != NumberConstant.TWO) {
+//            throw new BusinessException("对账单交易企业双方不存在或缺少");
+//        }
+//        Long uid = null;
+//        Long filter = null;
+//        for (LedgerUnitDto ledgerUnitDto : listById) {
+//            Integer unitType = ledgerUnitDto.getUnitType();
+//            if (TradeUnitType.PURCHASE.equals(unitType)) {
+//                uid = ledgerUnitDto.getTopEntId();
+//                continue;
+//            }
+//            if (TradeUnitType.SELL.equals(unitType)) {
+//                filter = ledgerUnitDto.getTopEntId();
+//            }
+//        }
+//        String relation = walletRelationService.getRelation(uid);
+//        String filterUser = walletRelationService.getRelation(filter);
+//        if (StringUtils.isBlank(relation) || StringUtils.isBlank(filterUser)) {
+//            throw new BusinessException("顶级企业未开通电子钱包");
+//        }
+//        R<List<WalletDto>> wallet = payCenterService.wallet(relation, ChannelEnum.getByCode(byId.getTrading()), filterUser);
+//        if (CollectionUtils.isEmpty(wallet.getData())) {
+//            throw new BusinessException("暂未开通电子钱包");
+//        }
+//        List<WalletDto> data = wallet.getData();
+//        return data.get(NumberConstant.ZERO);
+//        return BigDecimal.valueOf(data.get(NumberConstant.ZERO).getMoney() / 100.0);
+    }
+    private BigDecimal getWalletBalance(List<LedgerUnitDto> listById, String trading) {
         Long uid = null;
         Long filter = null;
         for (LedgerUnitDto ledgerUnitDto : listById) {
@@ -551,12 +618,14 @@ public class KwpSettlementWalletService {
         if (StringUtils.isBlank(relation) || StringUtils.isBlank(filterUser)) {
             throw new BusinessException("顶级企业未开通电子钱包");
         }
-        R<List<WalletDto>> wallet = payCenterService.wallet(relation, ChannelEnum.getByCode(byId.getTrading()), filterUser);
+        R<List<WalletDto>> wallet = payCenterService.wallet(relation, ChannelEnum.getByCode(trading), filterUser);
         if (CollectionUtils.isEmpty(wallet.getData())) {
             throw new BusinessException("暂未开通电子钱包");
         }
         List<WalletDto> data = wallet.getData();
         return BigDecimal.valueOf(data.get(NumberConstant.ZERO).getMoney() / 100.0);
     }
+
+
 }
 

+ 22 - 5
sckw-modules/sckw-payment/src/main/resources/mapper/KwpSettlementLogisticsMapper.xml

@@ -99,7 +99,7 @@
 
     <!--  根据连表,查询条件准备  -->
     <sql id="settlementLogisticsSelectWhere">
-        <if test="settlementReq.status != null">
+        <if test="settlementReq.status != null and settlementReq.status != 0">
             and s.status = #{settlementReq.status}
         </if>
 
@@ -123,12 +123,13 @@
         </if>
 
         <if test="settlementReq.keywords != null and settlementReq.keywords != ''">
-            and l.name like concat('%'
-            , #{settlementReq.keywords}
+            and ( and l.name like concat('%'
+            , #{settlementReq.keywords,jdbcType=VARCHAR}
             , '%')
-                and lu.firm_name like concat('%'
-            , #{settlementReq.keywords}
+                or lu2.firm_name like concat('%'
+            , #{settlementReq.keywords,jdbcType=VARCHAR}
             , '%')
+                )
         </if>
     </sql>
 
@@ -207,6 +208,7 @@
             l.del_flag = 0
               and s.del_flag = 0
               and lu.del_flag = 0
+              and lu2.del_flag = 0
             <include refid="settlementLogisticsSelectWhere"/>
             <if test="ids != null and ids.size() > 0">
                 and s.id in
@@ -217,4 +219,19 @@
         </where>
         order by s.update_time desc
     </select>
+
+    <select id="getListById" resultType="com.sckw.payment.model.dto.LedgerUnitDto">
+        select kltu.top_ent_id,
+        kltu.ent_id,
+        kltu.unit_type
+        from kwp_settlement_logistics kst
+        inner join kwp_ledger_logistics klt on kst.l_ledger_id = klt.id and klt.del_flag = 0
+        inner join kwp_ledger_logistics_unit kltu on klt.id = kltu.l_ledger_id and kltu.del_flag = 0
+        <where>
+            kst.del_flag = 0
+            and kst.id = #{id,jdbcType=BIGINT}
+        </where>
+    </select>
+
+
 </mapper>

+ 13 - 0
sckw-modules/sckw-product/src/main/java/com/sckw/product/controller/KwpGoodsController.java

@@ -225,4 +225,17 @@ public class KwpGoodsController {
         kwpGoodsService.updateAmount(param);
         return HttpResult.ok("更新商品库存成功");
     }
+
+    /**
+     * @desc: 商品名称判重
+     * @author: yzc
+     * @date: 2023-08-16 15:24
+     * @Param name:
+     * @return: com.sckw.core.web.response.HttpResult
+     */
+    @Log(description = "商品名称判重")
+    @GetMapping("/nameDuplicationJudgment")
+    public HttpResult nameDuplicationJudgment(@RequestParam String name, @RequestParam Long supplyEntId) {
+        return HttpResult.ok("商品名称判重成功", kwpGoodsService.nameDuplicationJudgment(name, supplyEntId, null));
+    }
 }

+ 4 - 0
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/req/AddGoodsDraftParam.java

@@ -2,10 +2,12 @@ package com.sckw.product.model.vo.req;
 
 import jakarta.validation.Valid;
 import jakarta.validation.constraints.DecimalMin;
+import jakarta.validation.constraints.NotNull;
 import jakarta.validation.constraints.Size;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
+import org.apache.logging.log4j.core.config.plugins.validation.constraints.NotBlank;
 import org.hibernate.validator.constraints.Length;
 import org.hibernate.validator.constraints.Range;
 
@@ -25,6 +27,7 @@ public class AddGoodsDraftParam {
      * 商品名称
      */
     @Length(max = 50, message = "商品名称最多支持50字")
+    @NotBlank(message= "商品名称不能为空")
     private String name;
 
     /**
@@ -82,6 +85,7 @@ public class AddGoodsDraftParam {
     /**
      * 供应企业
      */
+    @NotNull(message = "供应企业不能为空")
     private Long supplyEntId;
 
     /**

+ 3 - 0
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/req/UpdateGoodsParam.java

@@ -7,6 +7,7 @@ import jakarta.validation.constraints.Size;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
+import org.apache.logging.log4j.core.config.plugins.validation.constraints.NotBlank;
 import org.hibernate.validator.constraints.Length;
 import org.hibernate.validator.constraints.Range;
 
@@ -33,6 +34,7 @@ public class UpdateGoodsParam {
      * 商品名称
      */
     @Length(max = 50, message = "商品名称最多支持50字")
+    @NotBlank(message = "商品名称不能为空")
     private String name;
 
     /**
@@ -90,6 +92,7 @@ public class UpdateGoodsParam {
     /**
      * 供应企业
      */
+    @NotNull(message = "供应企业不能为空")
     private Long supplyEntId;
 
     /**

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

@@ -82,6 +82,9 @@ public class KwpGoodsService {
      */
     @Transactional(rollbackFor = Exception.class)
     public void addDraft(AddGoodsDraftParam param) {
+        if (nameDuplicationJudgment(param.getName(), param.getSupplyEntId(), null)) {
+            throw new BusinessException("已存在相同商品名称!");
+        }
         //添加商品信息
         KwpGoods goods = BeanUtils.copyProperties(param, KwpGoods.class);
         AddressInfo address = param.getAddressInfo();
@@ -106,6 +109,9 @@ public class KwpGoodsService {
         if (Objects.equals(param.getPrepaidLimit(), 1) && Objects.isNull(param.getAdvancePrice())) {
             throw new BusinessException("设置预付限额时,预付款最低限额不能为空!");
         }
+        if (nameDuplicationJudgment(param.getName(), param.getSupplyEntId(), null)) {
+            throw new BusinessException("已存在相同商品名称!");
+        }
         //添加商品信息
         KwpGoods goods = BeanUtils.copyProperties(param, KwpGoods.class);
         AddressInfo address = param.getAddressInfo();
@@ -258,6 +264,9 @@ public class KwpGoodsService {
      */
     @Transactional(rollbackFor = Exception.class)
     public void update(UpdateGoodsParam param) {
+        if (nameDuplicationJudgment(param.getName(), param.getSupplyEntId(), param.getId())) {
+            throw new BusinessException("已存在相同商品名称!");
+        }
         KwpGoods goods = getGoodsById(param.getId());
         if (Objects.isNull(goods)) {
             throw new BusinessException("当前商品不存在!");
@@ -968,4 +977,24 @@ public class KwpGoodsService {
                 ne(KwpGoods::getStatus, GoodsStatusEnum.SAVED.getCode());
         return kwpGoodsMapper.selectCount(wrapper);
     }
+
+    /**
+     * @desc: 商品名称判重
+     * @author: yzc
+     * @date: 2023-08-16 15:24
+     * @Param name:
+     * @Param supplyEntId:
+     * @Param id:
+     * @return: java.lang.Boolean
+     */
+    public Boolean nameDuplicationJudgment(String name, Long supplyEntId, Long id) {
+        LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwpGoods::getSupplyEntId, supplyEntId)
+                .eq(KwpGoods::getName, name).eq(KwpGoods::getDelFlag, Global.NO);
+        if (Objects.nonNull(id)) {
+            wrapper.ne(KwpGoods::getId, id);
+        }
+        Long count = kwpGoodsMapper.selectCount(wrapper);
+        return Objects.nonNull(count) && count > 0L;
+    }
 }

+ 6 - 1
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/vo/AcceptCarriageOrderVo.java

@@ -1,6 +1,7 @@
 package com.sckw.report.service.vo;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import com.sckw.core.model.page.PageRequest;
 import lombok.Data;
 
@@ -91,10 +92,12 @@ public class AcceptCarriageOrderVo extends PageRequest {
     /**
      * 数据库id
      */
+    @JsonProperty("lOrderId")
     private String lOrderId;
     /**
      * 托运订单号
      */
+    @JsonProperty("lOrderNo")
     private String lOrderNo;
     /**
      * 合理损耗
@@ -157,10 +160,12 @@ public class AcceptCarriageOrderVo extends PageRequest {
     /**
      * 关联承运订单号
      */
+    @JsonProperty("wOrderNo")
     private String wOrderNo;
+
     private String createTime;
-    private String updateTime;
 
+    private String updateTime;
 
     /**
      * 发货单位

+ 6 - 2
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/vo/ConsignOrderVo.java

@@ -1,5 +1,6 @@
 package com.sckw.report.service.vo;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -75,10 +76,12 @@ public class ConsignOrderVo implements Serializable {
     /**
      * 数据库id
      */
+    @JsonProperty("lOrderId")
     private String lOrderId;
     /**
      * 托运订单号
      */
+    @JsonProperty("lOrderNo")
     private String lOrderNo;
     /**
      * 合理损耗
@@ -143,11 +146,12 @@ public class ConsignOrderVo implements Serializable {
     /**
      * 关联承运订单号
      */
+    @JsonProperty("wOrderNo")
     private String wOrderNo;
-    private String createTime;
-    private String updateTime;
 
+    private String createTime;
 
+    private String updateTime;
 
     /**
      * 发货单位

+ 4 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/ConsignOrderVO.java

@@ -1,5 +1,6 @@
 package com.sckw.transport.model.vo;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
 import com.sckw.core.model.page.PageResult;
 import lombok.Data;
 
@@ -75,10 +76,12 @@ public class ConsignOrderVO extends PageResult implements Serializable {
     /**
      * 数据库id
      */
+    @JsonProperty("lOrderId")
     private String lOrderId;
     /**
      * 托运订单号
      */
+    @JsonProperty("lOrderNo")
     private String lOrderNo;
     /**
      * 合理损耗
@@ -135,5 +138,6 @@ public class ConsignOrderVO extends PageResult implements Serializable {
     /**
      * 关联承运订单号
      */
+    @JsonProperty("wOrderNo")
     private String wOrderNo;
 }

+ 4 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/KwtLogisticsOrderVO.java

@@ -2,6 +2,7 @@ package com.sckw.transport.model.vo;
 
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import com.sckw.excel.annotation.ExcelContext;
 import jakarta.validation.constraints.DecimalMin;
 import jakarta.validation.constraints.Digits;
@@ -39,16 +40,19 @@ public class KwtLogisticsOrderVO implements Serializable {
     /**
      * 交易订单id(kwo_trade_order)
      */
+    @JsonProperty("tOrderId")
     private Long tOrderId;
 
     /**
      * 交易订单编号(kwo_trade_order)
      */
+    @JsonProperty("tOrderNo")
     private String tOrderNo;
 
     /**
      * 物流订单编号
      */
+    @JsonProperty("lOrderNo")
     private String lOrderNo;
 
     /**

+ 9 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/AcceptCarriageOrderService.java

@@ -12,6 +12,7 @@ import com.sckw.core.common.enums.StringConstant;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.enums.CarWaybillEnum;
+import com.sckw.core.model.enums.CooperateTypeEnum;
 import com.sckw.core.model.enums.LogisticsOrderEnum;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.CollectionUtils;
@@ -25,6 +26,7 @@ import com.sckw.excel.utils.ValidUtil;
 import com.sckw.fleet.api.RemoteFleetService;
 import com.sckw.fleet.api.model.vo.RTruckVo;
 import com.sckw.manage.api.RemoteManageService;
+import com.sckw.manage.api.model.dto.res.FindEntCooperateResVo;
 import com.sckw.mongo.enums.BusinessTypeEnum;
 import com.sckw.mongo.model.SckwLogisticsOrder;
 import com.sckw.mongo.model.SckwWaybillOrder;
@@ -1495,6 +1497,13 @@ public class AcceptCarriageOrderService {
             return HttpResult.error(httpResult.getMsg());
         }
         checkAddOrderParam(orderDTO);
+        /**2023-08-16 新增校验承运企业与托运企业是否存在合作关系*/
+        String consignCompanyId = orderDTO.getConsignCompanyId();
+        String acceptCompanyId = orderDTO.getAcceptCompanyId();
+        List<FindEntCooperateResVo> entCooperate = remoteManageService.findEntCooperate(Long.parseLong(acceptCompanyId), Long.parseLong(consignCompanyId), CooperateTypeEnum.CONSIGN.getCode());
+        if (entCooperate == null) {
+            return HttpResult.error("该托运企业与我方并无合作关系!");
+        }
         /**保存新建数据*/
         Long lOrderId = new IdWorker(NumberConstant.ONE).nextId();
         /**生成订单编号*/

+ 11 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/ConsignOrderService.java

@@ -9,6 +9,7 @@ import com.sckw.contract.api.model.dto.res.ContractCommonInfoResDto;
 import com.sckw.core.common.enums.NumberConstant;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.enums.CarWaybillEnum;
+import com.sckw.core.model.enums.CooperateTypeEnum;
 import com.sckw.core.model.enums.LogisticsOrderEnum;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.CollectionUtils;
@@ -21,11 +22,12 @@ import com.sckw.excel.utils.DateUtil;
 import com.sckw.excel.utils.ValidUtil;
 import com.sckw.fleet.api.RemoteFleetService;
 import com.sckw.fleet.api.model.vo.RTruckVo;
+import com.sckw.manage.api.RemoteManageService;
+import com.sckw.manage.api.model.dto.res.FindEntCooperateResVo;
 import com.sckw.mongo.enums.BusinessTypeEnum;
 import com.sckw.mongo.model.SckwLogisticsOrder;
 import com.sckw.order.api.dubbo.TradeOrderInfoService;
 import com.sckw.order.api.model.CompleteLogisticsOrderParam;
-import com.sckw.product.api.dubbo.GoodsInfoService;
 import com.sckw.stream.model.SckwBusSum;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.AreaTreeFrontResDto;
@@ -68,7 +70,7 @@ public class ConsignOrderService {
     RemoteContractService remoteContractService;
 
     @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 8000)
-    GoodsInfoService goodsInfoService;
+    RemoteManageService remoteManageService;
 
     @DubboReference(version = "1.0.0", group = "design", check = false)
     RemoteFleetService remoteFleetService;
@@ -935,6 +937,13 @@ public class ConsignOrderService {
             return HttpResult.error(httpResult.getMsg());
         }
         checkAddOrderParam(addOrderDTO);
+        /**2023-08-16 新增校验承运企业与托运企业是否存在合作关系*/
+        String consignCompanyId = addOrderDTO.getConsignCompanyId();
+        String acceptCompanyId = addOrderDTO.getAcceptCompanyId();
+        List<FindEntCooperateResVo> entCooperate = remoteManageService.findEntCooperate(Long.parseLong(consignCompanyId), Long.parseLong(acceptCompanyId), CooperateTypeEnum.CARRIAGE.getCode());
+        if (entCooperate == null) {
+            return HttpResult.error("该承运企业与我方企业并无合作关系!");
+        }
         /**保存新建数据*/
         Long lOrderId = new IdWorker(NumberConstant.ONE).nextId();
         /**生成订单编号*/

+ 6 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/LogisticsConsignmentService.java

@@ -942,7 +942,9 @@ public class LogisticsConsignmentService {
                             .set(KwtLogisticsOrder::getUpdateBy, LoginUserHolder.getUserId())
                             .set(KwtLogisticsOrder::getUpdateTime, new Date()));
                     KwtLogisticsOrderTrack orderTrack = kwtLogisticsOrderTrackMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderTrack>()
-                            .eq(KwtLogisticsOrderTrack::getLOrderId, s));
+                            .eq(KwtLogisticsOrderTrack::getLOrderId, s)
+                            .eq(KwtLogisticsOrderTrack::getStatus,LogisticsOrderEnum.CANCEL_ORDER.getCode())
+                    );
                     if (orderTrack == null) {
                         KwtLogisticsOrderTrack track = new KwtLogisticsOrderTrack();
                         track.setId(new IdWorker(NumberConstant.ONE).nextId());
@@ -1025,7 +1027,9 @@ public class LogisticsConsignmentService {
                             .set(KwtLogisticsOrder::getUpdateBy, LoginUserHolder.getUserId())
                             .set(KwtLogisticsOrder::getUpdateTime, new Date()));
                     KwtLogisticsOrderTrack orderTrack = kwtLogisticsOrderTrackMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderTrack>()
-                            .eq(KwtLogisticsOrderTrack::getLOrderId, s));
+                            .eq(KwtLogisticsOrderTrack::getLOrderId, s)
+                            .eq(KwtLogisticsOrderTrack::getStatus,LogisticsOrderEnum.CANCEL_ORDER.getCode())
+                    );
                     if (orderTrack == null) {
                         KwtLogisticsOrderTrack track = new KwtLogisticsOrderTrack();
                         track.setId(new IdWorker(NumberConstant.ONE).nextId());

+ 3 - 3
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/TransportCommonService.java

@@ -311,15 +311,15 @@ public class TransportCommonService {
             logisticsOrder1.setStatus(LogisticsOrderEnum.CANCEL_ORDER.getStatus());
             logisticsOrder1.setUpdateTime(new Date());
             logisticsOrder1.setUpdateByName(LoginUserHolder.getUserName());
-            sckwLogisticsOrder.setUpdateBy(LoginUserHolder.getUserId());
+            logisticsOrder1.setUpdateBy(LoginUserHolder.getUserId());
             SckwBusSum busSum1 = new SckwBusSum();
             //业务汇总类型
             busSum1.setBusSumType(BusinessTypeEnum.LOGISTICS_ORDER_TYPE.getName());
             //操作对象(1新增/2修改)
             busSum1.setMethod(NumberConstant.TWO);
             //业务汇总数据对象
-            busSum1.setObject(logisticsOrder);
-            streamBridge.send("sckw-busSum", JSON.toJSONString(busSum));
+            busSum1.setObject(logisticsOrder1);
+            streamBridge.send("sckw-busSum", JSON.toJSONString(busSum1));
         }
         return result;
     }

+ 2 - 2
sckw-modules/sckw-transport/src/main/resources/bootstrap.yml

@@ -5,8 +5,8 @@ spring:
   application:
     name: sckw-transport
   profiles:
-    active: ${DEPLOY_MODE:dev}
-#    active: @profiles.active@
+#    active: ${DEPLOY_MODE:dev}
+    active: @profiles.active@
   main:
     allow-bean-definition-overriding: true
     allow-circular-references: true