فهرست منبع

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

czh 2 سال پیش
والد
کامیت
c593053b24
25فایلهای تغییر یافته به همراه239 افزوده شده و 79 حذف شده
  1. 3 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/constant/Global.java
  2. 1 1
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/PasswordUtils.java
  3. 1 1
      sckw-modules-api/sckw-fleet-api/src/main/java/com/sckw/fleet/api/RemoteFleetService.java
  4. 5 0
      sckw-modules/sckw-example/src/main/java/com/sckw/example/controller/TransportController.java
  5. 12 0
      sckw-modules/sckw-example/src/main/java/com/sckw/example/service/TransportService.java
  6. 5 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTruckMapper.java
  7. 5 3
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dubbo/RemoteFleetServiceImpl.java
  8. 6 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfDriverVo.java
  9. 13 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java
  10. 5 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java
  11. 7 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml
  12. 1 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java
  13. 1 7
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/WalletController.java
  14. 4 4
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/CashEnum.java
  15. 5 3
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/AddWalletReq.java
  16. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/PrePayCheck.java
  17. 38 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/WalletAppendReq.java
  18. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/WalletDetailReq.java
  19. 27 8
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/WalletService.java
  20. 1 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/dubbo/PaymentDubboServiceImpl.java
  21. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/task/RefundTask.java
  22. 18 7
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwFleetService.java
  23. 65 36
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwOrderService.java
  24. 4 4
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/pojo/FindEntListPojo.java
  25. 9 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/LogisticsConsignmentService.java

+ 3 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/constant/Global.java

@@ -158,6 +158,9 @@ public class Global {
     /**+符号**/
     public static final String PLUS = "+";
 
+    /**-符号*/
+    public static final String MINUS_SIGN = "-";
+
     /**#符号**/
     public static final String POUND = "#";
 

+ 1 - 1
sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/PasswordUtils.java

@@ -123,7 +123,7 @@ public class PasswordUtils {
     public static void main(String[] args) {
 
         String password = PasswordUtils.entryptPassword(PasswordUtils.md5("18581845668"));
-        String md5 = PasswordUtils.md5("18581845668");
+        String md5 = PasswordUtils.md5("123456");
         System.out.println(password);
         System.out.println(md5);
         System.out.println(validatePassword(md5, password));

+ 1 - 1
sckw-modules-api/sckw-fleet-api/src/main/java/com/sckw/fleet/api/RemoteFleetService.java

@@ -77,5 +77,5 @@ public interface RemoteFleetService {
      * @author zk
      * @date 2023/9/4
      **/
-    List<Map<String, Object>> capacityStatistics(List entIds);
+    List<Map<String, Object>> capacityStatistics(List<Long> entIds, Integer capacityAmountMin, Integer capacityAmountMax);
 }

+ 5 - 0
sckw-modules/sckw-example/src/main/java/com/sckw/example/controller/TransportController.java

@@ -71,5 +71,10 @@ public class TransportController {
         return integer;
     }
 
+    @RequestMapping(value = "/refreshScopeDemo", method = RequestMethod.GET)
+    public void refreshScopeDemo(){
+        transportService.refreshScopeDemo();
+    }
+
 
 }

+ 12 - 0
sckw-modules/sckw-example/src/main/java/com/sckw/example/service/TransportService.java

@@ -3,6 +3,8 @@ package com.sckw.example.service;
 import com.sckw.transport.api.dubbo.TransportStatisticsService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.stereotype.Service;
 
 /**
@@ -12,8 +14,13 @@ import org.springframework.stereotype.Service;
  */
 @Slf4j
 @Service
+@RefreshScope
 public class TransportService {
 
+
+    @Value("${refreshScope.demo}")
+    private String refreshScope;
+
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private TransportStatisticsService statisticsService;
 
@@ -28,4 +35,9 @@ public class TransportService {
     public Integer statisticsPendingVerificationWaybill(Long topEntId) {
         return statisticsService.statisticsPendingVerificationWaybill(topEntId);
     }
+
+
+    public void refreshScopeDemo() {
+        System.out.println("refreshScope:" + refreshScope);
+    }
 }

+ 5 - 1
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTruckMapper.java

@@ -51,9 +51,13 @@ public interface KwfTruckMapper extends BaseMapper<KwfTruck> {
     /**
      * 企业运力统计
      * @param entIds 企业id集
+     * @param capacityAmountMin 最小合计载重
+     * @param capacityAmountMax 最大合计载重
      * @return
      */
-    List<Map<String, Object>> capacityStatistics(@Param("entIds") List entIds);
+    List<Map<String, Object>> capacityStatistics(@Param("entIds") List entIds,
+                                                 @Param("capacityAmountMin") Integer capacityAmountMin,
+                                                 @Param("capacityAmountMax") Integer capacityAmountMax);
 
     /**
      * 查询企业车辆

+ 5 - 3
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dubbo/RemoteFleetServiceImpl.java

@@ -171,13 +171,15 @@ public class RemoteFleetServiceImpl implements RemoteFleetService {
     }
 
     /**
-     * @param entIds 企业ID
+     * @param entIds 企业id集
+     * @param capacityAmountMin 最小合计载重
+     * @param capacityAmountMax 最大合计载重
      * @desc 企业运力统计
      * @author zk
      * @date 2023/9/4
      **/
     @Override
-    public List<Map<String, Object>> capacityStatistics(List entIds) {
-        return truckDao.capacityStatistics(entIds);
+    public List<Map<String, Object>> capacityStatistics(List<Long> entIds, Integer capacityAmountMin, Integer capacityAmountMax) {
+        return truckDao.capacityStatistics(entIds, capacityAmountMin, capacityAmountMax);
     }
 }

+ 6 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfDriverVo.java

@@ -72,6 +72,12 @@ public class KwfDriverVo {
     @ExcelProperty(value = "准驾车型", index = 7)
     private String licenseType;
 
+    /**
+     * 准驾车型
+     */
+    @ExcelIgnore
+    private String licenseTypeName;
+
     /**
      * 驾驶证有效期至
      */

+ 13 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java

@@ -201,9 +201,11 @@ public class KwfDriverService {
         /**获取查询数据**/
         List<Long> createBys = new ArrayList<>();
         List<Long> entIds = new ArrayList<>();
+        List<String> dictKey = new ArrayList<>();
         for (KwfDriverVo driver:drivers) {
             createBys.add(Long.parseLong(driver.getCreateBy()));
             entIds.add(Long.parseLong(driver.getEntId()));
+            dictKey.add(DictTypeEnum.APPROVED_DRIVING.getType() + Global.POUND + driver.getLicenseType());
         }
         //用户数据集
         createBys = createBys.stream().distinct().collect(Collectors.toList());
@@ -211,13 +213,18 @@ public class KwfDriverService {
         //企业数据集
         entIds = entIds.stream().distinct().collect(Collectors.toList());
         Map<Long, EntCacheResDto> ents = remoteSystemService.queryEntCacheMapByIds(entIds);
+        //数据字典
+        dictKey = dictKey.stream().distinct().collect(Collectors.toList());
+        Map<String, SysDictResDto> dicts = CollectionUtils.isEmpty(dictKey) ? remoteSystemService.queryDictMapByTypeValues(String.join(Global.COMMA, dictKey)) : null;
 
         /**数据组装**/
         for (KwfDriverVo driver:drivers) {
             UserCacheResDto user = users == null ? null : users.get(Long.parseLong(driver.getCreateBy()));
             EntCacheResDto ent = ents == null ? null : ents.get(Long.parseLong(driver.getEntId()));
+            SysDictResDto licenseType = dicts == null ? null : dicts.get(DictTypeEnum.APPROVED_DRIVING.getType() + Global.POUND + driver.getLicenseType());
             driver.setCreateByName(user != null ? user.getName() : null);
             driver.setFirmName(ent != null ? ent.getFirmName() : null);
+            driver.setLicenseTypeName(licenseType != null ? licenseType.getLabel() : null);
         }
         return drivers;
     }
@@ -477,6 +484,8 @@ public class KwfDriverService {
         driverCard.setStatus(Global.YES);
         if (StringUtils.isBlank(driverCard.getCertificateMain()) && StringUtils.isBlank(driverCard.getCertificateRevolt())) {
             driverCard.setStatus(Global.NO);
+            driverCard.setCertificateMain(Global.EMPTY_STRING);
+            driverCard.setCertificateRevolt(Global.EMPTY_STRING);
         }
 
         /**数据更新**/
@@ -526,6 +535,8 @@ public class KwfDriverService {
         driverLicense.setStatus(Global.YES);
         if (StringUtils.isBlank(driverLicense.getCertificateMain()) && StringUtils.isBlank(driverLicense.getCertificateRevolt())) {
             driverLicense.setStatus(Global.NO);
+            driverLicense.setCertificateMain(Global.EMPTY_STRING);
+            driverLicense.setCertificateRevolt(Global.EMPTY_STRING);
         }
 
         /**数据更新**/
@@ -576,6 +587,8 @@ public class KwfDriverService {
         driverQual.setStatus(Global.YES);
         if (StringUtils.isBlank(driverQual.getCertificateMain()) && StringUtils.isBlank(driverQual.getCertificateRevolt())) {
             driverQual.setStatus(Global.NO);
+            driverQual.setCertificateMain(Global.EMPTY_STRING);
+            driverQual.setCertificateRevolt(Global.EMPTY_STRING);
         }
 
         /**数据更新**/

+ 5 - 1
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java

@@ -197,7 +197,7 @@ public class KwfTruckService {
         Map<Long, EntCacheResDto> ents = remoteSystemService.queryEntCacheMapByIds(entIds);
         //数据字典
         dictKey = dictKey.stream().distinct().collect(Collectors.toList());
-        Map<String, SysDictResDto> dicts = remoteSystemService.queryDictMapByTypeValues(String.join(Global.COMMA, dictKey));
+        Map<String, SysDictResDto> dicts = CollectionUtils.isEmpty(dictKey) ? remoteSystemService.queryDictMapByTypeValues(String.join(Global.COMMA, dictKey)) : null;
 
         /**数据组装**/
         for (KwfTruckVo truck:trucks) {
@@ -442,6 +442,8 @@ public class KwfTruckService {
         truckLicense.setStatus(Global.YES);
         if (StringUtils.isBlank(truckLicense.getCertificateMain()) && StringUtils.isBlank(truckLicense.getCertificateRevolt())) {
             truckLicense.setStatus(Global.NO);
+            truckLicense.setCertificateMain(Global.EMPTY_STRING);
+            truckLicense.setCertificateRevolt(Global.EMPTY_STRING);
         }
 
         /**数据更新**/
@@ -482,6 +484,8 @@ public class KwfTruckService {
         transportLicense.setStatus(Global.YES);
         if (StringUtils.isBlank(transportLicense.getCertificateMain()) && StringUtils.isBlank(transportLicense.getCertificateRevolt())) {
             transportLicense.setStatus(Global.NO);
+            transportLicense.setCertificateMain(Global.EMPTY_STRING);
+            transportLicense.setCertificateRevolt(Global.EMPTY_STRING);
         }
 
         /**数据更新**/

+ 7 - 0
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml

@@ -232,6 +232,13 @@
             </when>
         </choose>
         GROUP BY ent_id
+        HAVING 1=1
+        <if test="capacityAmountMin != null and capacityAmountMin != ''">
+            and capacityAmount <![CDATA[ >= ]]> #{capacityAmountMin, jdbcType=INTEGER}
+        </if>
+        <if test="capacityAmountMax != null and capacityAmountMax != ''">
+            and capacityAmount <![CDATA[ <= ]]> #{capacityAmountMax, jdbcType=INTEGER}
+        </if>
     </select>
 
     <select id="findTruckByEnt" resultType="com.sckw.fleet.model.vo.KwfTruckMonitorVo" >

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

@@ -639,6 +639,7 @@ public class KwoTradeOrderService {
             if (Objects.nonNull(contractRes)) {
                 contractInfo.setContractName(contractRes.getContactName());
                 contractInfo.setContractSigningWay(contractRes.getSigningWayName());
+                contractInfo.setContractStatus(contractRes.getStatusName());
             }
             detail.setContractInfo(contractInfo);
         }

+ 1 - 7
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/WalletController.java

@@ -1,20 +1,14 @@
 package com.sckw.payment.controller;
 
-import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.payment.model.vo.req.*;
-import com.sckw.payment.service.MessageSender;
 import com.sckw.payment.service.WalletService;
-import com.sckw.stream.enums.MessageEnum;
-import com.sckw.stream.model.UserInfo;
 import jakarta.annotation.Resource;
 import jakarta.validation.Valid;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.HashMap;
-
 /**
  * 钱包
  *
@@ -66,7 +60,7 @@ public class WalletController {
      * @return
      */
     @PostMapping("recharge")
-    public HttpResult recharge(@RequestBody @Valid AddWalletReq addWalletReq) {
+    public HttpResult recharge(@RequestBody @Valid WalletAppendReq addWalletReq) {
         return HttpResult.ok(walletService.addWalletMoney(addWalletReq));
     }
 

+ 4 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/CashEnum.java

@@ -10,10 +10,10 @@ import java.util.Objects;
  * @date 2023-07-11 12:00:52
  */
 public enum CashEnum {
-    ALL(-1, "全部", "-1"),
-    FAIL(0, "提现失败", "0"),
-    SUCCESS(1, "提现成功", "1"),
-    LOAD(2, "提现中", "2"),
+    ALL(-1, "全部", "all"),
+    FAIL(0, "提现失败", "failed"),
+    SUCCESS(1, "提现成功", "success"),
+    LOAD(2, "提现中", "processing"),
     WAIT(3, "等待提现", "3");
 
     private final int status;

+ 5 - 3
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/AddWalletReq.java

@@ -1,8 +1,10 @@
 package com.sckw.payment.model.vo.req;
 
-import com.sckw.core.model.vo.BasePara;
 import com.sckw.payment.model.vo.res.MoneyChange;
-import jakarta.validation.constraints.*;
+import jakarta.validation.constraints.Digits;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.Positive;
+import jakarta.validation.constraints.Size;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -16,7 +18,7 @@ import java.math.BigDecimal;
  */
 @Getter
 @Setter
-public class AddWalletReq extends BasePara implements MoneyChange {
+public class AddWalletReq implements MoneyChange {
     /**
      * 支付通道 huifu
      */

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/PrePayCheck.java

@@ -14,7 +14,7 @@ import lombok.Setter;
 @Setter
 public class PrePayCheck {
     /**
-     * 支付通道 huifu
+     * 支付通道 1-汇付 2-新生
      */
     @NotBlank(message = "支付通道不能为空")
     private String channel;

+ 38 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/WalletAppendReq.java

@@ -0,0 +1,38 @@
+package com.sckw.payment.model.vo.req;
+
+import com.sckw.payment.model.vo.res.MoneyChange;
+import jakarta.validation.constraints.Digits;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.Positive;
+import jakarta.validation.constraints.Size;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * 账目账目追加
+ *
+ * @author xucaiqin
+ * @date 2023-08-29 09:14:04
+ */
+@Getter
+@Setter
+public class WalletAppendReq  implements MoneyChange {
+    /**
+     * 支付通道 huifu
+     */
+    @NotBlank(message = "支付通道不能为空")
+    private String channel;
+
+    @NotBlank(message = "合作企业不能为空")
+    private String filter;
+
+    @Positive(message = "充值金额必须大于0")
+    @Digits(message = "小数位数过长", integer = 10, fraction = 2)
+    private BigDecimal money;
+
+    @Size(message = "备注不能超过200")
+    private String remark;
+
+}

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/WalletDetailReq.java

@@ -13,7 +13,7 @@ import lombok.Setter;
 public class WalletDetailReq extends BasePara {
     private String entName;
     /**
-     * 支付通道字典值
+     * 支付通道字典值 1-汇付 2-新生
      */
     private String channel;
 }

+ 27 - 8
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/WalletService.java

@@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.text.DecimalFormat;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
@@ -168,6 +169,23 @@ public class WalletService {
         }
     }
 
+    /**
+     * 资金明细设置退款中金额
+     *
+     * @param fundVo 返回值vo
+     */
+    private void refundMoney2(FundVo fundVo) {
+        DecimalFormat df = new DecimalFormat("0.00");
+        LambdaQueryWrapper<KwpWalletRefund> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwpWalletRefund::getUid, fundVo.getUid()).eq(KwpWalletRefund::getFilter, fundVo.getFilter()).eq(KwpWalletRefund::getChannel, fundVo.getChannel()).eq(KwpWalletRefund::getStatus, RefundEnum.REFUNDING.getStatus()).last("limit 1");
+        KwpWalletRefund kwpWalletRefund = kwpWalletRefundMapper.selectOne(wrapper);
+        if (Objects.nonNull(kwpWalletRefund)) {
+            fundVo.setRefundMoney(df.format(kwpWalletRefund.getActualMoney()));
+        } else {
+            fundVo.setRefundMoney("0.00");
+        }
+    }
+
     /**
      * 钱包总览信息
      *
@@ -255,7 +273,7 @@ public class WalletService {
             fundVo.setWithdrawingMoney(dfMoney(re.getWithdrawingMoney()));
             fundVo.setChargingMoney(dfMoney(re.getChargingMoney()));
             fundVo.setTotalMoney(dfMoney(re.getTotalMoney()));
-//            fundVo.setRefundMoney(dfMoney(re.getMoney()));
+            refundMoney2(fundVo);
             vo.add(fundVo);
         }
         DecimalFormat df = new DecimalFormat("0.00");
@@ -304,18 +322,14 @@ public class WalletService {
      *
      * @return
      */
-    public Object addWalletMoney(AddWalletReq addWalletReq) {
+    public Object addWalletMoney(WalletAppendReq addWalletReq) {
         log.info("账目充值:{}", JSONObject.toJSONString(addWalletReq));
         Long entId1 = LoginUserHolder.getEntId();
         String uid = walletRelationService.getRelation(entId1);
         if (StringUtils.isBlank(uid)) {
             throw new BusinessException("您暂未开通电子钱包");
         }
-        String entId = addWalletReq.getEntId();
-        String filter = walletRelationService.getRelation(Long.parseLong(entId));
-        if (StringUtils.isBlank(filter)) {
-            throw new BusinessException("合作单位暂未开通电子钱包");
-        }
+        String filter = addWalletReq.getFilter();
         ChannelEnum channelEnum = ChannelEnum.getByChannel(addWalletReq.getChannel());
         if (Objects.isNull(channelEnum)) {
             throw new BusinessException("支付通道不存在");
@@ -648,7 +662,11 @@ public class WalletService {
             throw new BusinessException("支付通道不存在");
         }
 
-        R<Order> orderR = payCenterService.advancePayApply(uid, channelEnum, prePay.getEntId(), prePay.bigMoney(prePay.getMoney()));
+        String filter = walletRelationService.getRelation(Long.parseLong(prePay.getEntId()));
+        if (StringUtils.isBlank(filter)) {
+            throw new BusinessException("合作企业开通电子钱包");
+        }
+        R<Order> orderR = payCenterService.advancePayApply(uid, channelEnum, filter, prePay.bigMoney(prePay.getMoney()));
         if (!orderR.getStatus()) {
             throw new BusinessException(StringUtils.isNotBlank(orderR.getMsg()) ? orderR.getMsg() : "预付失败");
         }
@@ -702,6 +720,7 @@ public class WalletService {
         kwpWalletRefundAdd.setToEnt(walletRelationService.getEnt(refundReq.getFilter()));
         kwpWalletRefundAdd.setChannel(refundReq.getChannel());
         kwpWalletRefundAdd.setMoney(refundReq.getMoney());
+        kwpWalletRefundAdd.setActualMoney(new BigDecimal("0.0"));
         kwpWalletRefundAdd.setRemark(refundReq.getRemark());
         kwpWalletRefundAdd.setCreateBy(LoginUserHolder.getUserId());
         kwpWalletRefundAdd.setCreateTime(LocalDateTime.now());

+ 1 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/dubbo/PaymentDubboServiceImpl.java

@@ -60,6 +60,7 @@ public class PaymentDubboServiceImpl implements PaymentDubboService {
 
     @Override
     public LedgerCount countLedger(Long entId) {
+        //todo-xcq
         return new LedgerCount(1, 1, 1, 1);
     }
 }

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/task/RefundTask.java

@@ -37,7 +37,7 @@ public class RefundTask {
         wrapper.eq(KwpWalletRefund::getStatus, RefundEnum.REFUNDING.getStatus());
         List<KwpWalletRefund> kwpWalletRefunds = kwpWalletRefundMapper.selectList(wrapper);
         if (CollectionUtils.isEmpty(kwpWalletRefunds)) {
-            log.warn("无数据");
+//            log.warn("无数据");
             return;
         }
         try {

+ 18 - 7
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwFleetService.java

@@ -7,6 +7,7 @@ import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.NumberUtils;
+import com.sckw.core.utils.StringUtils;
 import com.sckw.fleet.api.RemoteFleetService;
 import com.sckw.report.model.vo.KwfCapacityVo;
 import com.sckw.system.api.RemoteUserService;
@@ -37,14 +38,26 @@ public class KwFleetService {
      * @date 2023/9/1
      **/
     public PageResult capacity(HashMap<String, Object> params) {
-        //企业数据查询
-        List<KwfCapacityVo> list = new ArrayList<>();
+        // 参数组装
         List<Long> entIds = new ArrayList<>();
+        Integer capacityAmountMin = null;
+        Integer capacityAmountMax = null;
+        String totalLoadStr = StringUtils.objectStr(params.get("totalLoad"));
+        String [] array = StringUtils.isNotBlank(totalLoadStr) ? totalLoadStr.split(Global.MINUS_SIGN) : null;
+        capacityAmountMin = NumberUtils.parseEmptyInteger(array != null && array.length > 0 ? array[0] : null);
+        capacityAmountMax = NumberUtils.parseEmptyInteger(array != null && array.length > 1 ? array[1] : null);
+        if (capacityAmountMin != null || capacityAmountMax != null) {
+            List<Map<String, Object>> statistics = fleetService.capacityStatistics(entIds, capacityAmountMin, capacityAmountMax);
+            statistics.forEach(e -> entIds.add(NumberUtils.parseEmptyLong(e.get("entId"))));
+        }
+
+        // 企业数据查询
+        List<KwfCapacityVo> list = new ArrayList<>();
         Integer cityCode = NumberUtils.parseIntV1(params.get("cityCode"));
         List<Integer> entTypes = new ArrayList<>(Arrays.asList(3, 4));
         Integer page = PageResult.getPage(params);
         Integer pageSize = PageResult.getPageSize(params);
-        PageResult pageResult = userService.queryEntInfoByCityCodeAndEntTypesWithPage(cityCode, entTypes, page, pageSize);
+        PageResult pageResult = userService.queryEntInfoByCityCodeAndEntTypesWithPage(cityCode, entTypes, entIds, page, pageSize);
         List<KwsEnterpriseResDto> ents = JSON.parseArray(JSON.toJSONString(pageResult.getList()), KwsEnterpriseResDto.class);
         for (KwsEnterpriseResDto ent:ents) {
             KwfCapacityVo capacity = new KwfCapacityVo();
@@ -58,11 +71,9 @@ public class KwFleetService {
         }
 
         //企业运力统计
-        List<Map<String, Object>> statistics = fleetService.capacityStatistics(entIds);
+        List<Map<String, Object>> statistics = fleetService.capacityStatistics(entIds, capacityAmountMin, capacityAmountMax);
         Map<Long, Map<String, Object>> entMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
-        for (Map<String, Object> statistic:statistics) {
-            entMap.put(NumberUtils.parseLong(statistic.get("entId")), statistic);
-        }
+        statistics.forEach(e -> entMap.put(NumberUtils.parseEmptyLong(e.get("entId")), e));
 
         //企业运力统计查询
         for (KwfCapacityVo capacity:list) {

+ 65 - 36
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwOrderService.java

@@ -138,84 +138,111 @@ public class KwOrderService {
     private Criteria buildCriteria(TradeOrderListStatisticParam params, Boolean isStatistic) {
         Long entId = LoginUserHolder.getEntId();
         Long userId = LoginUserHolder.getUserId();
-        Criteria criteria = new Criteria();
         String topEnt = Objects.equals(params.getOrderType(), 1) ? "procureTopEntId" : "supplyTopEntId";
-        criteria.and(topEnt).is(entId).and("delFlag").is(0);
+        Criteria dataPermission = getDataPermissions(params.getOrderType());
+        //订单状态
+        Criteria statusCriteria;
+        if (Objects.nonNull(params.getStatus()) && !isStatistic) {
+            statusCriteria = new Criteria().and("status").is(params.getStatus());
+            if (Objects.equals(params.getStatus(), 0)) {
+                //草稿状态只能创建订单的人能看
+                statusCriteria.and("createBy").is(userId);
+            }
+        } else {
+            //非草稿状态or草稿状态且是当前人
+            statusCriteria = new Criteria().orOperator(Criteria.where("status").ne(0),
+                    new Criteria().andOperator(Criteria.where("status").is(0),
+                            Criteria.where("createBy").is(userId)));
+        }
+        //匹配条件
+        Criteria condition = new Criteria();
+        condition.and("delFlag").is(0);
         //日期范围
         if (Objects.nonNull(params.getStartCreateTime()) && Objects.nonNull(params.getEndCreateTime())) {
-            criteria.and("createTime").gte(params.getStartCreateTime()).lte(params.getEndCreateTime());
+            condition.and("createTime").gte(params.getStartCreateTime()).lte(params.getEndCreateTime());
         } else if (Objects.nonNull(params.getStartCreateTime())) {
-            criteria.and("createTime").gte(params.getStartCreateTime());
+            condition.and("createTime").gte(params.getStartCreateTime());
         } else if (Objects.nonNull(params.getEndCreateTime())) {
-            criteria.and("createTime").lte(params.getEndCreateTime());
+            condition.and("createTime").lte(params.getEndCreateTime());
         }
         //装卸货地址
         String loadCode = params.getShippingAddressCode();
         if (StringUtils.isNotBlank(loadCode)) {
             switch (params.getShippingAddressLevel()) {
-                case 1 -> criteria.and("loadCityCode")
+                case 1 -> condition.and("loadCityCode")
                         .regex(Pattern.compile("^" + loadCode.substring(0, 2) + ".*$", Pattern.CASE_INSENSITIVE));
-                case 2 -> criteria.and("loadCityCode")
+                case 2 -> condition.and("loadCityCode")
                         .regex(Pattern.compile("^" + loadCode.substring(0, 4) + ".*$", Pattern.CASE_INSENSITIVE));
-                case 3 -> criteria.and("loadCityCode").is(loadCode);
+                case 3 -> condition.and("loadCityCode").is(loadCode);
             }
         }
         String unloadCode = params.getUnloadingAddressCode();
         if (StringUtils.isNotBlank(unloadCode)) {
             switch (params.getUnloadingAddressLevel()) {
-                case 1 -> criteria.and("unloadCityCode")
+                case 1 -> condition.and("unloadCityCode")
                         .regex(Pattern.compile("^" + unloadCode.substring(0, 2) + ".*$", Pattern.CASE_INSENSITIVE));
-                case 2 -> criteria.and("unloadCityCode")
+                case 2 -> condition.and("unloadCityCode")
                         .regex(Pattern.compile("^" + unloadCode.substring(0, 4) + ".*$", Pattern.CASE_INSENSITIVE));
-                case 3 -> criteria.and("unloadCityCode").is(unloadCode);
+                case 3 -> condition.and("unloadCityCode").is(unloadCode);
             }
         }
         //提货方式
         if (StringUtils.isNotBlank(params.getPickupType())) {
-            criteria.and("pickupType").is(params.getPickupType());
+            condition.and("pickupType").is(params.getPickupType());
         }
         //交易方式
         if (StringUtils.isNotBlank(params.getTrading())) {
-            criteria.and("trading").is(params.getTrading());
+            condition.and("trading").is(params.getTrading());
         }
         //交付类型
         if (StringUtils.isNotBlank(params.getDeliveryType())) {
-            criteria.and("deliveryType").is(params.getDeliveryType());
+            condition.and("deliveryType").is(params.getDeliveryType());
         }
         //下单方式
         if (StringUtils.isNotBlank(params.getSource())) {
-            criteria.and("source").is(params.getSource());
-        }
-        List<Criteria> orOperators = new ArrayList<>();
-        //订单状态
-        if (Objects.nonNull(params.getStatus()) && !isStatistic) {
-            criteria.and("status").is(params.getStatus());
-            if (Objects.equals(params.getStatus(), 0)) {
-                //草稿状态只能创建订单的人能看
-                criteria.and("createBy").is(userId);
-            }
-        } else {
-            //非草稿状态且一级企业匹配or草稿状态且是当前人
-            Criteria orOperator = new Criteria().orOperator(
-                    Criteria.where("status").ne(0),
-                    new Criteria().andOperator(Criteria.where("status").is(0),
-                            Criteria.where("createBy").is(userId)));
-            orOperators.add(orOperator);
+            condition.and("source").is(params.getSource());
         }
+        Criteria criteria = new Criteria().and(topEnt).is(entId);
         //关键字模糊匹配
         if (StringUtils.isNotBlank(params.getKeywords())) {
             Pattern pattern = Pattern.compile("^.*" + params.getKeywords() + ".*$", Pattern.CASE_INSENSITIVE);
-            Criteria orOperator = new Criteria().orOperator(
+            Criteria keywordsMatch = new Criteria().orOperator(
                     Criteria.where("tOrderNo").regex(pattern), Criteria.where("procureFirmName").regex(pattern),
                     Criteria.where("supplyFirmName").regex(pattern), Criteria.where("goodsName").regex(pattern));
-            orOperators.add(orOperator);
-        }
-        if (CollectionUtils.isNotEmpty(orOperators)) {
-            criteria.andOperator(orOperators);
+            criteria.andOperator(dataPermission, statusCriteria, condition, keywordsMatch);
+        } else {
+            criteria.andOperator(dataPermission, statusCriteria, condition);
         }
         return criteria;
     }
 
+    /**
+     * @desc: 数据权限组装
+     * @author: yzc
+     * @date: 2023-09-08 18:02
+     * @Param orderType:
+     * @return: org.springframework.data.mongodb.core.query.Criteria
+     */
+    private Criteria getDataPermissions(Integer orderType) {
+        Long entId = LoginUserHolder.getEntId();
+        Integer isMain = LoginUserHolder.getIsMain();
+        List<Long> authUserIdList = LoginUserHolder.getAuthUserIdList();
+        //数据权限
+        String topEnt = Objects.equals(orderType, 1) ? "procureTopEntId" : "supplyTopEntId";
+        String contactsId = Objects.equals(orderType, 1) ? "procureContactsId" : "supplyContactsId";
+        Criteria criteria1, criteria2;
+        if (Objects.equals(isMain, 0)) {
+            criteria1 = new Criteria().andOperator(Criteria.where("ent_id").is(entId),
+                    Criteria.where("create_by").in(authUserIdList));
+            criteria2 = new Criteria().andOperator(Criteria.where(topEnt).is(entId),
+                    Criteria.where(contactsId).in(authUserIdList));
+        } else {
+            criteria1 = new Criteria().andOperator(Criteria.where("ent_id").is(entId));
+            criteria2 = new Criteria().andOperator(Criteria.where(topEnt).is(entId));
+        }
+        return new Criteria().orOperator(criteria1, criteria2);
+    }
+
     /**
      * @desc: 贸易订单列表统计查询
      * @author: yzc
@@ -272,6 +299,8 @@ public class KwOrderService {
         List<Integer> status = Arrays.asList(1, 4, 5, 7);
         Criteria criteria = new Criteria();
         criteria.and(topEnt).is(entId).and("status").in(status).and("delFlag").is(0);
+        Criteria dataPermissions = getDataPermissions(params.getOrderType());
+        criteria.andOperator(dataPermissions);
         Aggregation aggregation = Aggregation.newAggregation(
                 Aggregation.match(criteria),
                 Aggregation.group("status").count().as("total"),

+ 4 - 4
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/pojo/FindEntListPojo.java

@@ -74,7 +74,7 @@ public class FindEntListPojo {
      * 注册时间
      */
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date regTime;
 
     /**
@@ -121,7 +121,7 @@ public class FindEntListPojo {
      * 审批时间
      */
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date approvalTime;
 
     /**
@@ -153,7 +153,7 @@ public class FindEntListPojo {
      * 创建时间
      */
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date createTime;
 
     /**
@@ -170,7 +170,7 @@ public class FindEntListPojo {
      * 更新时间
      */
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date updateTime;
 
     /**

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

@@ -666,6 +666,9 @@ public class LogisticsConsignmentService {
         stringList = stringList.stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList());
         for (String id : stringList) {
             OrderDetailRes orderDetailRes = tradeOrderInfoService.getOrderDetailById(Long.parseLong(id));
+            if (orderDetailRes==null){
+                continue;
+            }
             /**
              * 0销售展示是供应配送  1采购展示是采购自提
              * 根据提货方式(0供应配送/1采购自提)
@@ -723,6 +726,9 @@ public class LogisticsConsignmentService {
      */
     public HttpResult logisticsOrderCount(String id, String type) {
         OrderDetailRes orderDetailRes = tradeOrderInfoService.getOrderDetailById(Long.parseLong(id));
+        if (orderDetailRes==null){
+            return HttpResult.ok();
+        }
         /**根据下单方式(代客下单/自主下单)决定托运数据是否展示*/
         boolean flag = false;
         if (String.valueOf(NumberConstant.ONE).equals(orderDetailRes.getSource())) {
@@ -774,6 +780,9 @@ public class LogisticsConsignmentService {
         List<LogisticsOrderDTO> returnList = new ArrayList<>();
         for (String id : stringList) {
             OrderDetailRes orderDetailRes = tradeOrderInfoService.getOrderDetailById(Long.parseLong(id));
+            if (orderDetailRes==null){
+                continue;
+            }
             log.info("贸易订单数据:{}", JSONObject.toJSONString(orderDetailRes));
             log.info("贸易订单数据类型:{}", orderDetailRes.getPickupType());
             /**