9 Commits c11425be0c ... 6acd613e1a

Author SHA1 Message Date
  xucaiqin 6acd613e1a Merge remote-tracking branch 'origin/dev' into dev 1 year ago
  zk 4a37211417 1、按车次计费调整; 1 year ago
  zk 0c85603b10 Merge remote-tracking branch 'origin/dev' into dev 1 year ago
  zk 0785d743fb 1、按车次计费调整; 1 year ago
  xucaiqin e99dc92e85 fix 1 year ago
  xucaiqin cc0c57e756 fix 1 year ago
  xucaiqin bd456cd159 对账确认 ,修改物流订单状态 1 year ago
  lengfaqiang e52dc2bfd5 1.新增对账dubbo接口 1 year ago
  lengfaqiang d8f9d30a31 1.新增对账dubbo接口 1 year ago

+ 36 - 2
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/utils/DateUtil.java

@@ -132,7 +132,7 @@ public class DateUtil {
 
 
     /**
-     * yyyy-MM-dd 转换成 LocalDateTime
+     * yyyy-MM-dd 转换成 LocalDateTime-添加00:00:00
      *
      * @param str
      * @return
@@ -395,6 +395,40 @@ public class DateUtil {
         return null;
     }
 
+    /**
+     * 日期字符串转换为LocalDateTime方法-添加00:00:00
+     *
+     * @param dateString 日期字符串,格式:yyyy-MM-dd
+     * @return
+     */
+    public static LocalDateTime strToLocalDateTimeStart(String dateString) {
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        LocalDateTime localDateTime = LocalDate.parse(dateString, formatter).atStartOfDay();
+//        LocalDateTime localDateTime1 = strToLocalDateTime(dateString);
+        return localDateTime;
+    }
+
+
+    /**
+     * 日期字符串转换为LocalDateTime方法-添加00:00:00
+     *
+     * @param dateString 日期字符串,格式:yyyy-MM-dd
+     * @return
+     */
+    public static LocalDateTime strToLocalDateTimeEnd(String dateString) {
+        String timeString = " 23:59:59";
+        String dateTimeString = timeString + timeString;
+        DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        LocalDateTime localDateTime = LocalDateTime.now();
+        try {
+            localDateTime = LocalDateTime.parse(dateTimeString, formatter1);
+            return localDateTime;
+        } catch (java.time.format.DateTimeParseException e) {
+            throw new RuntimeException("Invalid date strToLocalDateTimeEnd error" + e.getMessage());
+        }
+    }
+
+
     public static String date() {
         return LocalDate.now().format(YYYY_MM_DD);
     }
@@ -584,7 +618,7 @@ public class DateUtil {
 //        //结束时间
 //        String beforeMonthDateAndDaysEndToString1 = getBeforeMonthDateAndDaysEndToString(1, 0);
 //        System.out.println(beforeMonthDateAndDaysEndToString1);
-       String SS= cn.hutool.core.date.DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd")+" 00:00:00";
+        String SS = cn.hutool.core.date.DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd") + " 00:00:00";
         //月
         //开始时间
         String monthDateStart = DateUtil.getBeforeMonthDateAndDaysStartToString(LocalDateTime.now(), 1, -1);

+ 15 - 4
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/dubbo/TransportRemoteService.java

@@ -6,6 +6,7 @@ import com.sckw.transport.api.model.dto.AccountCheckingBindDTO;
 import com.sckw.transport.api.model.dto.RWaybillOrderDto;
 import com.sckw.transport.api.model.param.ContractSignLogisticsParam;
 import com.sckw.transport.api.model.param.LogisticsOrderParam;
+import com.sckw.transport.api.model.param.UpdateOrderStatusDto;
 import com.sckw.transport.api.model.vo.KwtLogisticsOrderVO;
 import com.sckw.transport.api.model.vo.RTruckMonitorVo;
 import com.sckw.transport.api.model.vo.RWaybillOrderVo;
@@ -44,6 +45,7 @@ public interface TransportRemoteService {
      * @return
      */
     List<Integer> getLogisticsOrderAddressList();
+
     /**
      * 贸易订单验证物流订单是否已完成
      *
@@ -72,21 +74,22 @@ public interface TransportRemoteService {
      * 根据企业id 判断是否存在未完成完结的物流订单
      *
      * @param entId 企业id
-     * @return  ture 代表还有未完结的  false代表没有未完结的
+     * @return ture 代表还有未完结的  false代表没有未完结的
      */
     boolean checkLogisticsOrderFinishByEntId(Long entId);
 
     /**
      * 根据企业id 判断是否存在未完成完结的物流订单
      *
-     * @param consignEntId 托运企业id
+     * @param consignEntId        托运企业id
      * @param acceptCarriageEntId 承运企业id
-     * @return   根据data是否为空判断 是否存在未完结订单  空  不存在  不为空  存在
+     * @return 根据data是否为空判断 是否存在未完结订单  空  不存在  不为空  存在
      */
-    HttpResult checkLogisticsOrderIsFinishByEntId(Long consignEntId,Long acceptCarriageEntId);
+    HttpResult checkLogisticsOrderIsFinishByEntId(Long consignEntId, Long acceptCarriageEntId);
 
     /**
      * 合同变更,修改物流订单状态【仅仅支持待签约变更为已签约】  0 已签约 1待签约
+     *
      * @param param
      */
     void contractSignLogisticsCompleted(ContractSignLogisticsParam param);
@@ -106,4 +109,12 @@ public interface TransportRemoteService {
      * @date 2023/10/8
      **/
     List<RTruckMonitorVo> truckInTask(Long checkEntId);
+
+
+    /**
+     * 物流订单发起对账状态变更
+     *
+     * @param params 请求参数
+     */
+    HttpResult logisticsOrderInitiateReconciliationUpdateStatus(UpdateOrderStatusDto params);
 }

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

@@ -318,4 +318,9 @@ public class AcceptCarriageLogisticsOrderDto implements Serializable {
 
     @JsonProperty("totalUnloadAmount")
     private BigDecimal totalUnloadAmount;
+
+    /**
+     * 趟次(自己+下游承运总卸货量,算方式为趟次时,最终值以完结输入值为准)
+     */
+    private Integer totalTake;
 }

+ 43 - 0
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/param/UpdateOrderStatusDto.java

@@ -0,0 +1,43 @@
+package com.sckw.transport.api.model.param;
+
+import com.sckw.core.model.enums.LogisticsOrderEnum;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @author lfdc
+ * @description 修改物流订单状态dto
+ * @date 2024-05-27 11:05:33
+ */
+@Data
+public class UpdateOrderStatusDto implements Serializable {
+
+    /**
+     * 物流订单id
+     */
+    @NotNull(message = "物流订单id不能为空")
+    private List<Long> orderIds;
+
+    /**
+     * 物流订单状态
+     */
+    @NotNull(message = "物流订单状态不能为空")
+    private LogisticsOrderEnum logisticsOrderStatus;
+
+
+    /**
+     * 修改人
+     */
+    @NotNull(message = "修改人不能为空")
+    private Long updateBy;
+
+    /**
+     * 修改时间
+     */
+    @NotNull(message = "修改时间不能为空")
+    private LocalDateTime updateTime;
+}

+ 0 - 1
sckw-modules/sckw-example/src/main/java/com/sckw/example/controller/TestController.java

@@ -2,7 +2,6 @@ package com.sckw.example.controller;
 
 import com.sckw.payment.api.dubbo.PayCenterDubboService;
 import com.sckw.payment.api.dubbo.PaymentDubboService;
-import com.sckw.payment.api.model.constant.ChannelEnum;
 import com.sckw.payment.api.model.dto.MemberDetail;
 import com.sckw.payment.api.model.dto.WalletDto;
 import com.sckw.payment.api.model.dto.common.R;

+ 21 - 3
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerLogisticsService.java

@@ -1,5 +1,7 @@
 package com.sckw.payment.service;
 
+import com.sckw.core.model.enums.LogisticsOrderEnum;
+
 import com.alibaba.fastjson2.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -15,6 +17,7 @@ import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.IdWorker;
 import com.sckw.core.utils.OrderGenerateSeqNoUtils;
 import com.sckw.core.utils.StringTimeUtil;
+import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.payment.dao.KwpLedgerLogisticsMapper;
@@ -35,6 +38,7 @@ import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import com.sckw.transport.api.dubbo.TransportRemoteService;
 import com.sckw.transport.api.model.dto.AcceptCarriageLogisticsOrderDto;
 import com.sckw.transport.api.model.dto.AccountCheckingBindDTO;
+import com.sckw.transport.api.model.param.UpdateOrderStatusDto;
 import io.seata.spring.annotation.GlobalTransactional;
 import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
@@ -66,7 +70,6 @@ public class KwpLedgerLogisticsService extends AbsLedger {
     private KwpLedgerLogisticsOrderService logisticsOrderService;
     @Resource
     private MessageSender messageSender;
-
     @Resource
     private KwpLedgerLogisticsMapper logisticsMapper;
     @DubboReference(version = "1.0.0", group = "design", check = false)
@@ -543,6 +546,21 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         KwpLedgerLogisticsUnit logisticsUnit = logisticsUnitService.queryCustomerEnt(confirmReq.getIdLong(), LogisticsUnitType.SHIPPER);
         //承运方
         KwpLedgerLogisticsUnit logisticsUnit2 = logisticsUnitService.queryCustomerEnt(confirmReq.getIdLong(), LogisticsUnitType.CARRIER);
+
+        //5.27 修改物流单状态
+        List<KwpLedgerLogisticsOrder> kwpLedgerLogisticsOrders = logisticsOrderService.queryList(confirmReq.getIdLong());
+        if (CollectionUtils.isNotEmpty(kwpLedgerLogisticsOrders)) {
+            UpdateOrderStatusDto updateOrderStatusDto = new UpdateOrderStatusDto();
+            updateOrderStatusDto.setOrderIds(kwpLedgerLogisticsOrders.stream().map(KwpLedgerLogisticsOrder::getLOrderId).toList());
+            updateOrderStatusDto.setLogisticsOrderStatus(LogisticsOrderEnum.HAVE_RECONCILED);
+            updateOrderStatusDto.setUpdateBy(LoginUserHolder.getUserId());
+            updateOrderStatusDto.setUpdateTime(LocalDateTime.now());
+            HttpResult httpResult = transportRemoteService.logisticsOrderInitiateReconciliationUpdateStatus(updateOrderStatusDto);
+            if (!Objects.equals(httpResult.getCode(), HttpStatus.SUCCESS_CODE)) {
+                throw new BusinessException(httpResult.getMsg());
+            }
+        }
+
         //推送创建人
         messageSender.sendCreate(LoginUserHolder.getUserId(), new HashMap<>(Global.NUMERICAL_SIXTEEN) {{
             put("company", logisticsUnit.getFirmName());
@@ -814,8 +832,8 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         return logisticsMapper.selectJoin(entId, entTarget);
     }
 
-    public LedgerSize count(Long entId,List<Long> enterpriseIds) {
-        return logisticsMapper.countSize(entId,enterpriseIds);
+    public LedgerSize count(Long entId, List<Long> enterpriseIds) {
+        return logisticsMapper.countSize(entId, enterpriseIds);
     }
 
     public List<LedgerLogisticsDto> exportList(LogisticsReq logisticsReq, List<Long> idList) {

+ 59 - 5
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dubbo/TransportServiceImpl.java

@@ -13,6 +13,7 @@ import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.model.enums.CarWaybillEnum;
 import com.sckw.core.model.enums.LogisticsOrderEnum;
 import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.utils.DateUtils;
 import com.sckw.core.utils.IdWorker;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.constant.HttpStatus;
@@ -31,11 +32,13 @@ import com.sckw.stream.model.SckwBusSum;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.transport.api.dubbo.TransportRemoteService;
-import com.sckw.transport.api.model.dto.*;
+import com.sckw.transport.api.model.dto.AcceptCarriageLogisticsOrderDto;
+import com.sckw.transport.api.model.dto.AccountCheckingBindDTO;
+import com.sckw.transport.api.model.dto.RWaybillOrderDto;
 import com.sckw.transport.api.model.param.ContractSignLogisticsParam;
 import com.sckw.transport.api.model.param.LogisticsOrderParam;
+import com.sckw.transport.api.model.param.UpdateOrderStatusDto;
 import com.sckw.transport.api.model.vo.KwtLogisticsOrderVO;
-import com.sckw.transport.api.model.vo.LogisticsOrderVO;
 import com.sckw.transport.api.model.vo.RTruckMonitorVo;
 import com.sckw.transport.api.model.vo.RWaybillOrderVo;
 import com.sckw.transport.dao.*;
@@ -54,7 +57,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
-import java.math.RoundingMode;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -310,8 +312,10 @@ public class TransportServiceImpl implements TransportRemoteService {
 //                    actualAmount = (logisticsOrderDTO.getTotalUnloadAmount() == null ? NumberConstant.ZERO_TWO : logisticsOrderDTO.getTotalUnloadAmount()).multiply(price).subtract(fineValue);
         } else if (DictEnum.CHARGING_TYPE_3.getValue().equals(billingMode)) {
             // 物流订单运单趟次数量
-            WaybillCountVo waybillOrderCount = waybillOrderV1Mapper.findCountByLOrderId(Long.parseLong(logisticsOrderDTO.getLOrderId()));
-            BigDecimal totalComplete = waybillOrderCount == null ? NumberConstant.ZERO_TWO : new BigDecimal(waybillOrderCount.getTotalComplete());
+            /*WaybillCountVo waybillOrderCount = waybillOrderV1Mapper.findCountByLOrderId(Long.parseLong(logisticsOrderDTO.getLOrderId()));
+            BigDecimal totalComplete = waybillOrderCount == null ? NumberConstant.ZERO_TWO : new BigDecimal(waybillOrderCount.getTotalComplete());*/
+
+            BigDecimal totalComplete = BigDecimal.valueOf(logisticsOrderDTO.getTotalTake());
             actualAmount = totalComplete.multiply(price);
         } else if (DictEnum.CHARGING_TYPE_4.getValue().equals(billingMode)) {
             String lOrderId = logisticsOrderDTO.getLOrderId();
@@ -748,4 +752,54 @@ public class TransportServiceImpl implements TransportRemoteService {
             findLogisticsOrderChild(orderIds, StringUtil.join(idList, Global.COMMA));
         }
     }
+
+    /**
+     * 物流订单发起对账状态变更
+     *
+     * @param params 请求参数
+     */
+    @Transactional
+    public HttpResult logisticsOrderInitiateReconciliationUpdateStatus(UpdateOrderStatusDto params) {
+        List<Long> orderIds = params.getOrderIds();
+        for (Long orderId : orderIds) {
+            KwtLogisticsOrder kwtLogisticsOrder = logisticsOrderMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrder>()
+                    .eq(KwtLogisticsOrder::getId, orderId));
+            Integer code = params.getLogisticsOrderStatus().getCode();
+            if (LogisticsOrderEnum.HAVE_ALREADY_SETTLED.getCode() == kwtLogisticsOrder.getStatus()) {
+                return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, "已结算,不能进行对账");
+            }
+            if (LogisticsOrderEnum.HAVE_FINISHED.getCode() != kwtLogisticsOrder.getStatus()) {
+                return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, "订单并未完成,不能进行对账");
+            }
+            if (LogisticsOrderEnum.HAVE_RECONCILED.getCode() != code) {
+                return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, "订单状态错误");
+            }
+            logisticsOrderMapper.update(null, new LambdaUpdateWrapper<KwtLogisticsOrder>()
+                    .eq(KwtLogisticsOrder::getId, orderId)
+                    .set(KwtLogisticsOrder::getStatus, code)
+            );
+            KwtLogisticsOrderTrack orderTrack = logisticsOrderTrackMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderTrack>()
+                    .eq(KwtLogisticsOrderTrack::getLOrderId, orderId)
+                    .eq(KwtLogisticsOrderTrack::getStatus, code)
+                    .eq(KwtLogisticsOrderTrack::getDelFlag, 0)
+            );
+            if (orderTrack != null) {
+                orderTrack.setStatus(code);
+                orderTrack.setUpdateBy(params.getUpdateBy());
+                orderTrack.setUpdateTime(DateUtils.formatDate(params.getUpdateTime()));
+            } else {
+                KwtLogisticsOrderTrack track = new KwtLogisticsOrderTrack();
+                track.setId(new IdWorker(NumberConstant.ONE).nextId());
+                track.setLOrderId(orderId);
+                track.setStatus(code);
+                track.setCreateBy(params.getUpdateBy());
+                track.setCreateTime(DateUtils.formatDate(params.getUpdateTime()));
+                track.setUpdateBy(params.getUpdateBy());
+                track.setUpdateTime(DateUtils.formatDate(params.getUpdateTime()));
+                track.setDelFlag(0);
+                logisticsOrderTrackMapper.insert(track);
+            }
+        }
+        return HttpResult.ok();
+    }
 }

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

@@ -211,13 +211,14 @@ public class KwtCommonService {
         } else if (DictEnum.CHARGING_TYPE_2.getValue().equals(billingMode)) {
             actualAmount = unloadAmount;
         } else if (DictEnum.CHARGING_TYPE_3.getValue().equals(billingMode)) {
-            // 物流订单运单趟次数量
+            /*// 物流订单运单趟次数量
             Map<String, Object> map = new HashMap<>(NumberConstant.SIXTEEN) {{
                 put("upperlOrderId", logisticsOrder.getId());
                 put("passStatus", Global.NUMERICAL_ONE);
             }};
             WaybillCountVo waybillOrderCount = kwtWaybillOrderV1Mapper.findWaybillOrderCount(map);
-            actualAmount = waybillOrderCount == null ? NumberConstant.ZERO_TWO : new BigDecimal(waybillOrderCount.getTotalComplete());
+            actualAmount = waybillOrderCount == null ? NumberConstant.ZERO_TWO : new BigDecimal(waybillOrderCount.getTotalComplete());*/
+            actualAmount = BigDecimal.valueOf(logisticsOrder.getTotalTake());
         } else if (DictEnum.CHARGING_TYPE_4.getValue().equals(billingMode)) {
             log.debug("“该方式不处理合同");
         } else {

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

@@ -393,14 +393,15 @@ public class KwtTransportCommonService {
             } else if (DictEnum.CHARGING_TYPE_2.getValue().equals(logisticsOrder.getBillingMode())) {
                 orderDetailVO.setOrderAmount(unloadAmount.multiply(price).subtract(fineValue));
             } else if (DictEnum.CHARGING_TYPE_3.getValue().equals(logisticsOrder.getBillingMode())) {
-                // 物流订单运单趟次数量
+                /*// 物流订单运单趟次数量
                 Map<String, Object> map = new HashMap<>(NumberConstant.SIXTEEN) {{
                     put("upperlOrderId", logisticsOrder.getId());
                     put("passStatus", Global.NUMERICAL_ONE);
                 }};
                 WaybillCountVo waybillOrderCount = kwtWaybillOrderV1Mapper.findWaybillOrderCount(map);
-                int count = waybillOrderCount == null ? NumberConstant.ZERO : waybillOrderCount.getTotalComplete();
-                orderDetailVO.setOrderAmount(new BigDecimal(count).multiply(price).subtract(fineValue));
+                int count = waybillOrderCount == null ? NumberConstant.ZERO : waybillOrderCount.getTotalComplete();*/
+                BigDecimal totalComplete = BigDecimal.valueOf(logisticsOrder.getTotalTake());
+                orderDetailVO.setOrderAmount(totalComplete.multiply(price).subtract(fineValue));
             }
         } else {
             orderDetailVO.setOrderAmount(NumberUtils.parseBigDecimal(logisticsOrder.getAmount()).multiply(NumberUtils.parseBigDecimal(logisticsOrder.getPrice())));

+ 3 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/operateService/KwtManagementLogisticsOrderService.java

@@ -719,13 +719,14 @@ public class KwtManagementLogisticsOrderService {
             } else if (DictEnum.CHARGING_TYPE_2.getValue().equals(logisticsOrder.getBillingMode())) {
                 orderDetailVO.setOrderAmount(unloadAmount.multiply(price).subtract(fineValue));
             } else if (DictEnum.CHARGING_TYPE_3.getValue().equals(logisticsOrder.getBillingMode())) {
-                // 物流订单运单趟次数量
+                /*// 物流订单运单趟次数量
                 Map<String, Object> map = new HashMap<>(NumberConstant.SIXTEEN) {{
                     put("upperlOrderId", logisticsOrder.getId());
                     put("passStatus", Global.NUMERICAL_ONE);
                 }};
                 WaybillCountVo waybillOrderCount = waybillOrderMapper.findWaybillOrderCount(map);
-                BigDecimal totalComplete = waybillOrderCount == null ? NumberConstant.ZERO_TWO : new BigDecimal(waybillOrderCount.getTotalComplete());
+                BigDecimal totalComplete = waybillOrderCount == null ? NumberConstant.ZERO_TWO : new BigDecimal(waybillOrderCount.getTotalComplete());*/
+                BigDecimal totalComplete = BigDecimal.valueOf(logisticsOrder.getTotalTake());
                 orderDetailVO.setOrderAmount(totalComplete.multiply(price).subtract(fineValue));
             }
         } else {

+ 1 - 0
sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml

@@ -812,6 +812,7 @@
                         a.unload_amount       AS unloadAmount,
                         a.total_load_amount   AS totalLoadAmount,
                         a.total_unload_amount AS totalUnloadAmount,
+                        a.total_take AS totalTake,
                         a.settlement_cycle    as settlementCycle,
                         a.start_time          AS startTime,
                         a.end_time            AS endTime,