Bladeren bron

迁移承运合同托运合同由mongo查询变更为mysql查询
修复运单管理列表时间格式转换bug

lengfaqiang 2 jaren geleden
bovenliggende
commit
5d2a7b366a

+ 2 - 0
sckw-common/sckw-common-mongo/src/main/java/com/sckw/mongo/model/SckwLogisticsOrder.java

@@ -125,11 +125,13 @@ public class SckwLogisticsOrder {
     /**
      * 卸货日期
      */
+    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
     private Date unloadTime;
 
     /**
      * 装货日期
      */
+    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
     private Date loadTime;
 
     /**

+ 15 - 0
sckw-modules/sckw-report/src/main/java/com/sckw/report/controller/KwTransportController.java

@@ -251,6 +251,21 @@ public class KwTransportController {
         }
     }
 
+    /**
+     * 承运合同/托运合同-根据合同id获取托运订单列表
+     * @param contractParam 请求参数
+     * @return
+     */
+    @RequestMapping(value = "/getLogisticsOrderContract", method = RequestMethod.POST)
+    public HttpResult getLogisticsOrderContract(@Validated @RequestBody ContractParam contractParam) {
+        try {
+            return transportService.getLogisticsOrderByContractId(contractParam);
+        } catch (Exception e) {
+            log.error("承运合同/托运合同-根据合同id获取托运订单列表 error:{}", e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
+
     /**
      * 运单管理-运单列表 运单地址查询接口
      * @param tag

+ 4 - 4
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwTransportService.java

@@ -523,14 +523,14 @@ public class KwTransportService {
         if (unitType.equals(String.valueOf(NumberConstant.ONE))) {
             //托运
             criteria.orOperator(
-                    Criteria.where("checkTopEntId").is(entId),
-                    Criteria.where("checkEntId").is(entId));
+                    Criteria.where("checkTopEntId").is("177802391955968000"),
+                    Criteria.where("checkEntId").is("177802391955968000"));
         } else {
             //承运企业主键ID
 //            criteria.and("carrierTopEntId").is(entMap.get(LoginUserHolder.getEntId()).getId());
             criteria.orOperator(
-                    Criteria.where("carrierTopEntId").is(entId),
-                    Criteria.where("carrierEntId").is(entId));
+                    Criteria.where("carrierTopEntId").is("177802391955968000"),
+                    Criteria.where("carrierEntId").is("177802391955968000"));
         }
         List<String> stringList = StringUtils.splitStrToList(contractIds, String.class);
         criteria.and("delFlag").is(String.valueOf(NumberConstant.ZERO));

+ 17 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/AcceptCarriageOrderController.java

@@ -11,6 +11,7 @@ import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.transport.model.dto.*;
 import com.sckw.transport.model.param.AcceptCarriageOrderQuery;
+import com.sckw.transport.model.param.ContractParam;
 import com.sckw.transport.model.param.DriverParam;
 import com.sckw.transport.model.param.LogisticsOrderParam;
 import com.sckw.transport.service.AcceptCarriageOrderService;
@@ -99,6 +100,22 @@ public class AcceptCarriageOrderController {
         }
     }
 
+
+    /**
+     * 承运合同/托运合同-根据合同id获取托运订单列表
+     * @param contractParam 请求参数
+     * @return
+     */
+    @RequestMapping(value = "/getLogisticsOrderContract", method = RequestMethod.POST)
+    public HttpResult getLogisticsOrderContract(@Validated @RequestBody ContractParam contractParam) {
+        try {
+            return transportCommonService.getLogisticsOrderByContractId(contractParam);
+        } catch (Exception e) {
+            log.error("承运合同/托运合同-根据合同id获取托运订单列表 error:{}", e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
+
     /**
      * 托运订单/承运订单-撤销托运
      *

+ 6 - 9
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtLogisticsOrderMapper.java

@@ -9,10 +9,7 @@ import com.sckw.transport.model.KwtLogisticsOrder;
 import com.sckw.transport.model.param.AcceptCarriageOrderQuery;
 import com.sckw.transport.model.param.DriverParam;
 import com.sckw.transport.model.param.LogisticsOrderParam;
-import com.sckw.transport.model.vo.AcceptCarriageOrderVO;
-import com.sckw.transport.model.vo.DriverListVo;
-import com.sckw.transport.model.vo.OrderFinishVO;
-import com.sckw.transport.model.vo.SubcontractConsignmentVO;
+import com.sckw.transport.model.vo.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -59,6 +56,8 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
      */
     List<com.sckw.transport.model.dto.LogisticsOrderDTO> selectOrderListNotPage(@Param("id") String id, @Param("type") String type);
 
+    List<SckwLogisticsOrderVO> selectOrderListByContractId(@Param("type") String type, @Param("entId") Long entId, @Param("contractIds") List<Long> contractIds);
+
     /**
      * 销售订单-采购订单-托运详情(导出)
      *
@@ -187,7 +186,6 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
     List<DriverListVo> selectLoopOrderAndDriverListByOrderIds(@Param("idsList") List<Long> idsList);
 
     /**
-     *
      * @param query
      * @param orderList
      * @param type
@@ -202,7 +200,6 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
 
 
     /**
-     *
      * @param query
      * @param orderList
      * @param type
@@ -210,9 +207,9 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
      * @return
      */
     List<TableTops> countLogisticsOrderListByStatus(@Param("query") AcceptCarriageOrderQuery query,
-                                                     @Param("orderList") List<Integer> orderList,
-                                                     @Param("type") String type,
-                                                     @Param("entId") Long entId
+                                                    @Param("orderList") List<Integer> orderList,
+                                                    @Param("type") String type,
+                                                    @Param("entId") Long entId
     );
 
     /**

+ 26 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/param/ContractParam.java

@@ -0,0 +1,26 @@
+package com.sckw.transport.model.param;
+
+import com.sckw.core.model.page.PageRequest;
+import jakarta.validation.constraints.NotBlank;
+import lombok.Data;
+
+/**
+ * @author lfdc
+ * @description 合同查询列表param
+ * @date 2023-08-03 13:08:51
+ */
+@Data
+public class ContractParam extends PageRequest {
+
+    /**
+     * 合同id  “,”隔开
+     */
+    @NotBlank(message = "合同ids不能为空")
+    private String contractIds;
+    /**
+     * 类型 1 托运合同 2 承运合同
+     */
+    @NotBlank(message = "托运合同不能为空")
+    private String contractType;
+
+}

+ 484 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/SckwLogisticsOrderVO.java

@@ -0,0 +1,484 @@
+package com.sckw.transport.model.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Date;
+
+/**
+ * @author zk
+ * @desc MongoDB-物流订单信息
+ * @date 2023/7/8
+ */
+@Data
+public class SckwLogisticsOrderVO {
+
+
+    /**
+     * 物流订单ID
+     */
+    private Long lOrderId;
+
+    /**
+     * 物流订单编号
+     */
+    private String lOrderNo;
+
+    /**
+     * 分包上级物流订单id
+     */
+    private Long lOrderPid;
+
+    /**
+     * 单据下所有的id(包含一二三级订单id“,”隔开)
+     */
+    private String lOrderPids;
+
+    /**
+     * 对账是否绑定 0未绑定 1已绑定
+     */
+    private String bindStatus;
+
+
+    /**
+     * 交易订单id(kwo_trade_order)
+     */
+    private Long tOrderId;
+
+    /**
+     * 交易订单编号(kwo_trade_order)
+     */
+    private String tOrderNo;
+
+    /**
+     * 物流订单类型(1 贸易订单生成物流订单、2 自建物流订单)
+     */
+    private Integer type;
+
+    /**
+     * 结算周期(周结、月结、季结)
+     */
+    private Long settlementCycle;
+
+    /**
+     * 结算周期(周结、月结、季结)
+     */
+    private String settlementCycleLabel;
+
+    /**
+     * 运价
+     */
+    private BigDecimal price;
+
+    /**
+     * 运价方式(元/吨、元/车)
+     */
+    private Long priceType;
+
+    /**
+     * 已委托量
+     */
+    private BigDecimal amount;
+
+    /**
+     * 单位(吨、方、箱、件)
+     */
+    private String unit;
+
+    /**
+     * 合理损耗
+     */
+    private BigDecimal loss;
+
+    /**
+     * 合理损耗单位(‰/kG)
+     */
+    private String lossUnit;
+
+    /**
+     * 商品价值(扣亏货值)
+     */
+    private BigDecimal goodsPrice;
+
+    /**
+     * 商品价值(扣亏货值)单位
+     */
+    private String goodsPriceUnit;
+
+    /**
+     * 卸货日期
+     */
+    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
+    private Date unloadTime;
+
+    /**
+     * 装货日期
+     */
+    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
+    private Date loadTime;
+
+    /**
+     * 分包量
+     */
+    private BigDecimal subcontractAmount;
+
+    /**
+     * 已委托量(自己承运量)
+     */
+    private BigDecimal entrustAmount;
+
+    /**
+     * 卸货量(自己承运总卸货量)
+     */
+    private BigDecimal unloadAmount;
+
+    /**
+     * 装货量(自己承运总装货量)
+     */
+    private BigDecimal loadAmount;
+
+    /**
+     * 忽略剩余量
+     */
+    private BigDecimal ignoreAmount;
+
+    /**
+     * 亏吨量(自己承运总亏吨量)
+     */
+    private BigDecimal deficitAmount;
+
+    /**
+     * 亏吨扣款(自己承运总亏吨扣款)
+     */
+    private BigDecimal deficitPrice;
+
+    /**
+     * 总卸货量(自己承运总卸货量+分包承运总卸货量)
+     */
+    private BigDecimal totalUnloadAmount;
+
+    /**
+     * 总装货量(自己承运总装货量+分包承运总装货量)
+     */
+    private BigDecimal totalLoadAmount;
+
+    /**
+     * 总亏吨量(自己承运总亏吨量+分包承运总亏吨量)
+     */
+    private BigDecimal totalDeficitAmount;
+
+    /**
+     * 总亏吨扣款(自己承运总亏吨扣款+分包承运总亏吨扣款)
+     */
+    private BigDecimal totalDeficitPrice;
+
+    /**
+     * 付款方式(预付款、线下支付、第三方支付)
+     */
+    private Long payment;
+
+    /**
+     * 发票税率(%)
+     */
+    private BigDecimal taxRate;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 业务状态
+     */
+    private String status;
+    /**
+     * 业务状态 label
+     */
+    private String statusLabel;
+
+    /**
+     * 企业id
+     */
+    private Long entId;
+
+    /**
+     * 企业名称
+     */
+    private String firmName;
+
+    /**
+     * 商品主键
+     */
+    private Long goodsId;
+
+    /**
+     * 商品编号
+     */
+    private String goodsCode;
+
+    /**
+     * 商品名称
+     */
+    private String goodsName;
+
+    /**
+     * 商品类型
+     */
+    private String goodsType;
+
+    /**
+     * 商品行业
+     */
+    private Long goodsIndustry;
+
+    /**
+     * 商品尺寸大小
+     */
+    private String goodsSpec;
+
+    /**
+     * 合同主键
+     */
+    private String contractId;
+
+    /**
+     * 合同编号
+     */
+    private String contractNo;
+
+    /**
+     * 合同mc
+     */
+    private String contractName;
+
+    /**
+     * 合同签约方式
+     */
+    private String contractSigningWay;
+
+    /**
+     * 托运企业主键ID
+     */
+    private Long checkEntId;
+
+    /**
+     * 托运一级企业主键ID
+     */
+    private Long checkTopEntId;
+
+    /**
+     * 托运企业名称
+     */
+    private String checkFirmName;
+
+    /**
+     * 托运企业联系人
+     */
+    private String checkContacts;
+
+    /**
+     * 托运企业联系电话
+     */
+    private String checkPhone;
+
+    /**
+     * 承运企业主键ID
+     */
+    private Long carrierEntId;
+
+    /**
+     * 承运企业主键ID
+     */
+    private Long carrierTopEntId;
+
+    /**
+     * 承运企业名称
+     */
+    private String carrierFirmName;
+
+    /**
+     * 承运企业联系人
+     */
+    private String carrierContacts;
+
+    /**
+     * 承运企业联系电话
+     */
+    private String carrierPhone;
+
+    /**
+     * 发货单位
+     */
+    private String shipmentsUnitEntId;
+
+    /**
+     * 发货单位
+     */
+    private String shipmentsUnit;
+
+    /**
+     * 收货单位
+     */
+    private String receiveGoodsUnitEntId;
+
+    /**
+     * 收货单位
+     */
+    private String receiveGoodsUnit;
+
+    /**
+     * 装货地址类型
+     */
+    private Long loadType;
+
+    /**
+     * 装货联系人姓名
+     */
+    private String loadContacts;
+
+    /**
+     * 装货联系电话
+     */
+    private String loadPhone;
+
+    /**
+     * 装货所在地区
+     */
+    private Integer loadCityCode;
+
+    /**
+     * 装货所属区域名称
+     */
+    private String loadCityName;
+
+    /**
+     * 装货详细地址
+     */
+    private String loadDetailAddress;
+
+    /**
+     * 装货纬度
+     */
+    private String loadLat;
+
+    /**
+     * 装货纬度
+     */
+    private String loadLng;
+
+    /**
+     * 卸货地址类型
+     */
+    private Long unloadType;
+
+    /**
+     * 卸货联系人姓名
+     */
+    private String unloadContacts;
+
+    /**
+     * 卸货联系电话
+     */
+    private String unloadPhone;
+
+    /**
+     * 卸货所在地区
+     */
+    private Integer unloadCityCode;
+
+    /**
+     * 卸货所属区域名称
+     */
+    private String unloadCityName;
+
+    /**
+     * 卸货详细地址
+     */
+    private String unloadDetailAddress;
+
+    /**
+     * 卸货纬度
+     */
+    private String unloadLat;
+
+    /**
+     * 卸货纬度
+     */
+    private String unloadLng;
+
+    /**
+     * 创建人主键id
+     */
+    private Long createBy;
+
+    /**
+     * 创建人姓名
+     */
+    private String createByName;
+
+    /**
+     * 创建时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+    /**
+     * 更新人主键id
+     */
+    private Long updateBy;
+
+    /**
+     * 更新人姓名
+     */
+    private String updateByName;
+
+    /**
+     * 更新时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updateTime;
+
+    /**
+     * 是否删除(0未删除,1删除)
+     */
+    private String delFlag;
+
+    /**
+     * 车辆运单编号
+     */
+    private String wOrderNo;
+
+    /**
+     * 分配的承运量
+     */
+    private BigDecimal carryingCapacity;
+
+    /**
+     * 计费方式
+     */
+    private String billingMode;
+    /**
+     * 计费方式
+     */
+    private String billingModeLabel;
+
+    /**
+     * 计划开始时间
+     */
+//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private LocalDate startTime;
+    /**
+     * 计划结束时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private LocalDate endTime;
+}

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

@@ -25,14 +25,17 @@ import com.sckw.order.api.model.OrderDetailRes;
 import com.sckw.order.api.model.UnitInfoDetailRes;
 import com.sckw.stream.model.SckwBusSum;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.transport.api.model.vo.LogisticsOrderVO;
 import com.sckw.transport.dao.*;
 import com.sckw.transport.model.*;
 import com.sckw.transport.model.dto.CancelOrderDTO;
 import com.sckw.transport.model.dto.DocumentParamDTO;
+import com.sckw.transport.model.param.ContractParam;
 import com.sckw.transport.model.param.LogisticsOrderParam;
 import com.sckw.transport.model.vo.OrderDetailVO;
+import com.sckw.transport.model.vo.SckwLogisticsOrderVO;
 import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
@@ -557,4 +560,17 @@ public class TransportCommonService {
         }
         return maps;
     }
+
+    public HttpResult getLogisticsOrderByContractId(ContractParam contractParam) {
+        List<Long> contractIds = StringUtils.splitStrToList(contractParam.getContractIds(), Long.class);
+        Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntTreeByIds(Collections.singletonList(LoginUserHolder.getEntId()));
+        List<SckwLogisticsOrderVO> list = logisticsOrderMapper.selectOrderListByContractId(contractParam.getContractType(), entMap.get(LoginUserHolder.getEntId()).getId(), contractIds);
+        List<SckwLogisticsOrderVO> returnList =new ArrayList<>();
+        if (CollectionUtils.isNotEmpty(list)){
+             returnList = list.stream().skip((contractParam.getPage() - 1) * contractParam.getPageSize()).limit(contractParam.getPageSize()).collect(Collectors.toList());
+
+        }
+        PageResult build = PageResult.build(contractParam.getPage(), contractParam.getPageSize(), list.stream().count(), returnList);
+        return HttpResult.ok(build);
+    }
 }

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

@@ -147,10 +147,14 @@ public class WaybillManagementService {
             waybillCarVO.setDriverId(String.valueOf(info.getTruckId()));
             waybillCarVO.setTrailerNo(info.getTruckTrailerNo());
             // 票据
-            waybillTicketVO.setLoadTime(DateUtil.getDateTime(info.getLoadTime()));
+            if (info.getLoadTime()!=null){
+                waybillTicketVO.setLoadTime(DateUtil.getDateTime(info.getLoadTime()));
+            }
             waybillTicketVO.setLoadWeight(String.valueOf(info.getLoadAmount()));
             waybillTicketVO.setLoadUrl(String.valueOf(info.getLoadUrls()));
-            waybillTicketVO.setUnloadTime(DateUtil.getDateTime(info.getUnloadTime()));
+            if (info.getUnloadTime()!=null){
+                waybillTicketVO.setUnloadTime(DateUtil.getDateTime(info.getUnloadTime()));
+            }
             waybillTicketVO.setUnloadWeight(String.valueOf(info.getUnloadAmount()));
             waybillTicketVO.setUnloadUrl(String.valueOf(info.getUnloadUrls()));
             waybillTicketVO.setDeficitAmount(String.valueOf(info.getDeficitAmount()));

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

@@ -100,6 +100,70 @@
           AND a.t_order_id = #{id,jdbcType=VARCHAR}
         order by createTime desc
     </select>
+
+    <select id="selectOrderListByContractId" resultType="com.sckw.transport.model.vo.SckwLogisticsOrderVO">
+        SELECT
+        a.STATUS,
+        a.l_order_no AS lOrderNo,
+        f.contract_no AS contractNo,
+        d.firm_name AS checkFirmName,
+        e.firm_name AS carrierFirmName,
+        g.goods_name AS goodsName,
+        a.amount AS carryingCapacity,
+        a.price AS price,
+        b.city_name AS loadCityName,
+        b.detail_address AS loadDetailAddress,
+        a.payment AS payment,
+        a.loss AS loss,
+        a.goods_price AS goodsPrice,
+        a.settlement_cycle AS settlementCycle,
+        e.contacts AS carrierContacts,
+        e.phone AS carrierPhone,
+        d.contacts AS checkContacts,
+        d.phone AS checkPhone,
+        b.contacts AS loadContacts,
+        b.phone AS loadPhone,
+        c.contacts AS unloadContacts,
+        c.phone AS unloadPhone,
+        a.start_time AS startTime,
+        a.end_time AS endTime,
+        a.remark AS remark,
+        a.create_by AS createBy,
+        a.create_time AS createTime
+        FROM
+        kwt_logistics_order a
+        LEFT JOIN kwt_logistics_order_address b ON a.id = b.l_order_id
+        AND b.address_type = 1
+        AND b.del_flag = 0
+        LEFT JOIN kwt_logistics_order_address c ON a.id = c.l_order_id
+        AND c.address_type = 2
+        AND c.del_flag = 0
+        LEFT JOIN kwt_logistics_order_unit d ON a.id = d.l_order_id
+        AND d.unit_type = 1
+        AND d.del_flag = 0
+        LEFT JOIN kwt_logistics_order_unit e ON a.id = e.l_order_id
+        AND e.unit_type = 2
+        LEFT JOIN kwt_logistics_order_goods g ON a.id = g.l_order_id
+        AND g.del_flag = 0
+        LEFT JOIN kwt_logistics_order_contract f ON a.id = f.l_order_id
+        AND f.del_flag = 0
+        <where>
+            a.del_flag = 0
+            <if test="type == 1">
+                and (d.top_ent_id = #{entId} or d.ent_id = #{entId})
+            </if>
+            <if test="type == 2">
+                and (e.top_ent_id = #{entId} or e.ent_id = #{entId})
+            </if>
+            <if test="contractIds != null and contractIds.size() > 0">
+                and f.contract_id in
+                <foreach collection="contractIds" item="item" separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+        ORDER BY a.id DESC
+    </select>
     <select id="selectOrderCount" resultType="java.lang.Long">
         SELECT count(a.id)
         FROM kwt_logistics_order a