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

1、循环车辆运单卸货mongodb新增一条数据;

zk 2 лет назад
Родитель
Сommit
a1af3076bf

+ 1 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictTypeEnum.java

@@ -38,6 +38,7 @@ public enum DictTypeEnum {
     ENERGY_TYPE("energy_type", "能源类型"),
     TRUCK_TYPE("truck_type", "车辆类型"),
     USE_TYPE("use_type", "使用性质"),
+    APPROVED_DRIVING("approved_driving", "准驾车型"),
     SIGNING_WAY("signing_way", "签约方式"),
     WEIGHT_CAR("weight_car", "以车的限重"),
     TAX_RATE_TYPE("tax_rate_type", "合理损耗单位"),

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

@@ -236,7 +236,7 @@ public class BeanUtils extends BeanUtil {
             String fieldName = field[j].getName();
             // 通过属性名称获取对象属性值
             Object value = BeanUtils.getProperty(source, fieldName);
-            if (StringUtils.isNotBlank(value)) {
+            if (value != null) {
                 // 为对象属性赋值
                 BeanUtils.setProperty(target, fieldName, value);
             }

+ 1 - 1
sckw-common/sckw-common-mongo/src/main/java/com/sckw/mongo/model/SckwWaybillOrder.java

@@ -245,7 +245,7 @@ public class SckwWaybillOrder{
     /**
      * 商品类型
      */
-    private Long goodsType;
+    private String goodsType;
 
     /**
      * 商品行业

+ 5 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfDriverLicenseVo.java

@@ -28,6 +28,11 @@ public class KwfDriverLicenseVo implements Serializable{
      */
     private String type;
 
+    /**
+     * 准驾车型
+     */
+    private String typeName;
+
     /**
      * 有效日期
      */

+ 20 - 1
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java

@@ -5,6 +5,7 @@ import com.alibaba.excel.ExcelReader;
 import com.alibaba.excel.read.metadata.ReadSheet;
 import com.alibaba.fastjson.JSON;
 import com.sckw.core.common.enums.enums.DictEnum;
+import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.common.enums.enums.FileEnum;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.constant.Global;
@@ -25,6 +26,7 @@ import com.sckw.redis.constant.RedisConstant;
 import com.sckw.redis.utils.RedissonUtils;
 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.system.api.model.dto.res.UserCacheResDto;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -67,7 +69,6 @@ public class KwfDriverService {
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private FileApiDubboService remoteFileService;
 
-
     /**
      * @param key 逐渐id
      * @desc 根据主键查询
@@ -102,6 +103,8 @@ public class KwfDriverService {
             KwfDriverLicense licenseJson = this.findLicenseByKey(driverId);
             KwfDriverLicenseVo driverLicenseVo = new KwfDriverLicenseVo();
             BeanUtils.copyPropertiesValue(licenseJson, driverLicenseVo);
+            String value = getDictValue(DictTypeEnum.APPROVED_DRIVING.getType(), driverLicenseVo.getType());
+            driverLicenseVo.setTypeName(value);
             driverDetailVo.setDriverLicense(driverLicenseVo);
 
             //司机从业资格证
@@ -136,6 +139,22 @@ public class KwfDriverService {
         return null;
     }
 
+    /**
+     * @param type 字典类型
+     * @param value 字典值
+     * @desc 获取数据字典值
+     * @author zk
+     * @date 2023/8/30
+     **/
+    public String getDictValue(String type, String value) {
+        List<String> dictKey = new ArrayList<>(){{
+            add(type + Global.POUND + value);
+        }};
+        Map<String, SysDictResDto> dicts = remoteSystemService.queryDictMapByTypeValues(String.join(Global.COMMA, dictKey));
+        SysDictResDto dict = dicts == null ? null : dicts.get(DictTypeEnum.APPROVED_DRIVING.getType() + Global.POUND + value);
+        return dict != null ? dict.getLabel() : null;
+    }
+
     /**
      * @param params 参数
      * @desc 统计

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

@@ -193,7 +193,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(",", dictKey));
+        Map<String, SysDictResDto> dicts = remoteSystemService.queryDictMapByTypeValues(String.join(Global.COMMA, dictKey));
 
         /**数据组装**/
         for (KwfTruckVo truck:trucks) {

+ 4 - 4
sckw-modules/sckw-report/src/main/java/com/sckw/report/consumer/SckwBusSumConsumer.java

@@ -138,13 +138,13 @@ public class SckwBusSumConsumer {
                 waybillOrderRepository.save(order1);
             } else {
                 /**替换**/
-                Optional<SckwWaybillOrder> optional = waybillOrderRepository.findById(order.get_id());
+                Optional<SckwWaybillOrder> optional = waybillOrderRepository.findById(order.getWOrderId());
                 SckwWaybillOrder order1 = optional.get();
-                //删除
-                waybillOrderRepository.deleteById(order1.get_id());
+
                 //新增
                 BeanUtils.copyPropertiesValue(order, order1);
-                order1.set_id(order1.getWOrderId());
+                order1.setWOrderId(null);
+                order1.setWOrderNo(null);
                 waybillOrderRepository.insert(order1);
             }
         }

+ 58 - 14
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderService.java

@@ -40,7 +40,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
-
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
@@ -734,7 +733,7 @@ public class KwtWaybillOrderService {
         order.setGoodsId(goods.getGoodsId());
         order.setGoodsCode(null);
         order.setGoodsName(goods.getGoodsName());
-        order.setGoodsType(null);
+        order.setGoodsType(goods.getGoodsType());
         order.setGoodsType(null);
         order.setGoodsIndustry(null);
         order.setGoodsSpec(null);
@@ -781,6 +780,45 @@ public class KwtWaybillOrderService {
         return order;
     }
 
+    /**
+     * @param circulate 循环派车信息
+     * @desc mongodb车辆运单对象赋值(运单卸货mongodb重新生成一条数据)
+     * @author zk
+     * @date 2023/8/30
+     **/
+    public SckwWaybillOrder setSckwWaybillOrder(KwtLogisticsOrderCirculate circulate) {
+        //基础信息
+        SckwWaybillOrder order = new SckwWaybillOrder();
+        order.set_id(circulate.getId());
+        order.setWOrderId(null);
+        order.setWOrderNo(null);
+
+        //运输信息
+        order.setLoadTime(circulate.getStartTime());
+        order.setUnloadTime(circulate.getEndTime());
+        order.setLoadAmount(new BigDecimal(Global.AMOUNT));
+        order.setLoadTareAmount(new BigDecimal(Global.AMOUNT));
+        order.setLoadGrossAmount(new BigDecimal(Global.AMOUNT));
+        order.setLoadUrls(Global.EMPTY_STRING);
+        order.setUnloadAmount(new BigDecimal(Global.AMOUNT));
+        order.setUnloadTareAmount(new BigDecimal(Global.AMOUNT));
+        order.setUnloadGrossAmount(new BigDecimal(Global.AMOUNT));
+        order.setUnloadUrls(Global.EMPTY_STRING);
+        order.setDeficitAmount(new BigDecimal(Global.AMOUNT));
+        order.setDeficitPrice(new BigDecimal(Global.AMOUNT));
+
+        //操作人信息
+        order.setStatus(CarWaybillEnum.PENDING_ORDER.getCode());
+        order.setCreateBy(LoginUserHolder.getUserId());
+        order.setCreateByName(LoginUserHolder.getUserName());
+        order.setCreateTime(circulate.getUpdateTime());
+        order.setUpdateBy(LoginUserHolder.getUserId());
+        order.setUpdateByName(LoginUserHolder.getUserName());
+        order.setUpdateTime(circulate.getUpdateTime());
+        order.setDelFlag(Global.NO);
+        return order;
+    }
+
     /**
      * @param lOrderId 承运订单ID
      * @description 派车更新承运订单信息
@@ -989,10 +1027,10 @@ public class KwtWaybillOrderService {
      * @date 2023/7/26
      **/
     public void editSckwWaybillOrder(SckwWaybillOrder wOrder, KwtWaybillOrder order, int method) {
-        wOrder.setWOrderId(order.getId());
-        wOrder.setStatus(order.getStatus());
-        wOrder.setUpdateTime(order.getUpdateTime());
-        wOrder.setUpdateBy(order.getUpdateBy());
+        wOrder.setWOrderId(order != null ? order.getId() : wOrder.getWOrderId());
+        wOrder.setStatus(order != null ? order.getStatus() : wOrder.getStatus());
+        wOrder.setUpdateTime(order != null ? order.getUpdateTime() : wOrder.getUpdateTime());
+        wOrder.setUpdateBy(order != null ? order.getUpdateBy() : wOrder.getUpdateBy());
         //rabbitMq业务汇总数据发送/消费对象
         SckwBusSum busSum = new SckwBusSum();
         //业务汇总类型
@@ -1012,12 +1050,12 @@ public class KwtWaybillOrderService {
      * @date 2023/7/26
      **/
     public void editSckwLogisticsOrder(SckwLogisticsOrder lOrder, KwtLogisticsOrder order) {
-        lOrder.set_id(order.getId());
-        lOrder.setLOrderId(order.getId());
-        lOrder.setEntrustAmount(order.getEntrustAmount());
-        lOrder.setStatus(String.valueOf(order.getStatus()));
-        lOrder.setUpdateTime(order.getUpdateTime());
-        lOrder.setUpdateBy(order.getUpdateBy());
+        lOrder.set_id(order != null ? order.getId() : lOrder.get_id());
+        lOrder.setLOrderId(order != null ? order.getId() : lOrder.getLOrderId());
+        lOrder.setEntrustAmount(order != null ? order.getEntrustAmount() : lOrder.getEntrustAmount());
+        lOrder.setStatus(order != null ? String.valueOf(order.getStatus()) : lOrder.getStatus());
+        lOrder.setUpdateTime(order != null ? order.getUpdateTime() : lOrder.getUpdateTime());
+        lOrder.setUpdateBy(order != null ? order.getUpdateBy() : lOrder.getUpdateBy());
         //rabbitMq业务汇总数据发送/消费对象
         SckwBusSum busSum = new SckwBusSum();
         //业务汇总类型
@@ -1508,8 +1546,14 @@ public class KwtWaybillOrderService {
                     waybillOrder.getTruckId(), waybillOrder.getDriverId(), 0);
             /*circulate.setWOrderId(null);
             logisticsOrderCirculateDao.updateById(circulate);*/
-            Long wOrderId = new IdWorker(Global.NUMERICAL_ONE).nextId();
-            logisticsOrderCirculateDao.updateIdByKey(wOrderId, null, circulate.getId(), waybillOrder.getUpdateBy(), waybillOrder.getUpdateTime());
+            Long newId = new IdWorker(Global.NUMERICAL_ONE).nextId();
+            logisticsOrderCirculateDao.updateIdByKey(newId, null, circulate.getId(), waybillOrder.getUpdateBy(), waybillOrder.getUpdateTime());
+
+            circulate = logisticsOrderCirculateDao.selectById(newId);
+            //Mongodb 重新生成一条运单数据
+            SckwWaybillOrder wOrder = setSckwWaybillOrder(circulate);
+            wOrder.setWOrderId(waybillOrder.getId());
+            editSckwWaybillOrder(wOrder, null, 3);
         }
 
         /**6跟新司机/车辆数据