Quellcode durchsuchen

1.新增对账dubbo接口
2.修改日期工具类注释

lengfaqiang vor 1 Jahr
Ursprung
Commit
d8f9d30a31

+ 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);
 }

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

@@ -0,0 +1,48 @@
+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;
+
+/**
+ * @author lfdc
+ * @description 修改物流订单状态dto
+ * @date 2024-05-27 11:05:33
+ */
+@Data
+public class UpdateOrderStatusDto implements Serializable {
+
+    /**
+     * 物流订单id
+     */
+    @NotNull(message = "物流订单id不能为空")
+    private Long orderId;
+
+    /**
+     * 物流订单状态
+     */
+    @NotNull(message = "物流订单状态不能为空")
+    private LogisticsOrderEnum logisticsOrderStatus;
+
+    /**
+     * 修改人
+     */
+    @NotNull(message = "修改人不能为空")
+    private Long updateById;
+
+
+    /**
+     * 修改人
+     */
+    @NotNull(message = "修改人不能为空")
+    private Long updateBy;
+
+    /**
+     * 修改时间
+     */
+    @NotNull(message = "修改时间不能为空")
+    private LocalDateTime updateTime;
+}

+ 52 - 3
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,15 +32,17 @@ 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.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.*;
 import com.sckw.transport.model.*;
+import com.sckw.transport.api.model.param.UpdateOrderStatusDto;
 import com.sckw.transport.model.vo.WaybillCountVo;
 import com.sckw.transport.service.KwtCommonService;
 import jakarta.annotation.Resource;
@@ -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;
 
@@ -748,4 +750,51 @@ public class TransportServiceImpl implements TransportRemoteService {
             findLogisticsOrderChild(orderIds, StringUtil.join(idList, Global.COMMA));
         }
     }
+
+    /**
+     * 物流订单发起对账状态变更
+     *
+     * @param params 请求参数
+     */
+    public HttpResult logisticsOrderInitiateReconciliationUpdateStatus(UpdateOrderStatusDto params) {
+        Long orderId = params.getOrderId();
+        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.getUpdateById());
+            track.setCreateTime(DateUtils.formatDate(params.getUpdateTime()));
+            track.setUpdateBy(params.getUpdateById());
+            track.setUpdateTime(DateUtils.formatDate(params.getUpdateTime()));
+            track.setDelFlag(0);
+            logisticsOrderTrackMapper.insert(track);
+        }
+        return HttpResult.ok();
+    }
 }