Prechádzať zdrojové kódy

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

lengfaqiang 1 rok pred
rodič
commit
623bfa6bdd

+ 43 - 4
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/KwtWaybillOrderController.java

@@ -1,9 +1,12 @@
 package com.sckw.transport.controller;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.fastjson2.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.sckw.core.exception.CustomPromptException;
 import com.sckw.core.exception.SystemException;
+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.CollectionUtils;
@@ -12,18 +15,25 @@ import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.model.ValiList;
 import com.sckw.core.web.response.HttpResult;
+import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.mongo.model.TableTops;
 import com.sckw.transport.model.dto.*;
 import com.sckw.transport.model.vo.WaybillOrderDriverVo;
+import com.sckw.transport.model.vo.WaybillOrderExportVo;
 import com.sckw.transport.model.vo.WaybillOrderSelectVo;
 import com.sckw.transport.service.KwtWaybillOrderService;
 import com.sckw.transport.service.KwtWaybillOrderV1Service;
 import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;
 import jakarta.validation.constraints.NotBlank;
+import jdk.jshell.execution.FailOverExecutionControlProvider;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -61,7 +71,39 @@ public class KwtWaybillOrderController {
      **/
     @PostMapping("/select")
     public HttpResult findListPage(@RequestBody WaybillOrderQueryDto params) throws SystemException {
-        return HttpResult.ok(waybillOrderV1Service.findListPage(params));
+        params.setEntId(LoginUserHolder.getEntId());
+        // 设置分页参数
+        PageHelper.startPage(params.getPage(), params.getPageSize());
+        List<WaybillOrderSelectVo> list = waybillOrderV1Service.findListPage(params);
+        PageResult result = PageHelperUtil.getPageResult(new PageInfo<>(list));
+        return HttpResult.ok(result);
+    }
+
+    /**
+     * @param params 查询参数
+     * @desc 司机导出
+     * @author zk
+     * @date 2023/07/11
+     **/
+    @PostMapping(value = "/export", produces = MediaType.APPLICATION_JSON_VALUE)
+    public void export(@RequestBody WaybillOrderQueryDto params, HttpServletResponse response) {
+        params.setEntId(LoginUserHolder.getEntId());
+        /*查询数据*/
+        List<WaybillOrderSelectVo> list = waybillOrderV1Service.findListPage(params);
+        if (CollectionUtils.isEmpty(list)) {
+            throw new CustomPromptException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认!");
+        }
+        //数据处理
+        List<WaybillOrderExportVo> orders = new ArrayList<>();
+        for (WaybillOrderSelectVo select:list) {
+            WaybillOrderExportVo exportVo = new WaybillOrderExportVo();
+            exportVo.setLoadName(String.join(Global.COMMA, select.getLoadName()));
+            exportVo.setLoadAddress(String.join(Global.COMMA, select.getLoadAddress()));
+            exportVo.setUnloadName(String.join(Global.COMMA, select.getUnloadName()));
+            exportVo.setUnloadAddress(String.join(Global.COMMA, select.getUnloadAddress()));
+            orders.add(exportVo);
+        }
+        ExcelUtil.downData(response, WaybillOrderExportVo.class, orders);
     }
 
     /**
@@ -538,9 +580,6 @@ public class KwtWaybillOrderController {
     }
 
 
-
-
-
     /**
      * @param params {}
      * @desc 单证审核

+ 92 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/operate/ManagementWaybillOrderController.java

@@ -1,13 +1,22 @@
 package com.sckw.transport.controller.operate;
 
 import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.sckw.core.exception.CustomPromptException;
+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.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.config.easyexcel.RequestHolder;
 import com.sckw.excel.utils.ExcelUtil;
+import com.sckw.transport.model.dto.WaybillOrderQueryDto;
 import com.sckw.transport.model.param.ManagementWaybillOrderQuery;
+import com.sckw.transport.model.vo.WaybillOrderExportVo;
+import com.sckw.transport.model.vo.WaybillOrderSelectVo;
 import com.sckw.transport.model.vo.execlVo.ManagementWaybillOrderExcelVO;
+import com.sckw.transport.service.KwtWaybillOrderV1Service;
 import com.sckw.transport.service.operateService.KwtManagementWaybillOrderService;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;
@@ -18,6 +27,7 @@ import org.springframework.util.CollectionUtils;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -34,6 +44,8 @@ public class ManagementWaybillOrderController {
 
     @Autowired
     KwtManagementWaybillOrderService managementWaybillOrderService;
+    @Autowired
+    KwtWaybillOrderV1Service waybillOrderV1Service;
 
 
     /**
@@ -52,6 +64,27 @@ public class ManagementWaybillOrderController {
         }
     }
 
+    /**
+     * 运营管理端-运单-首页条件查询
+     *
+     * @param query 查询参数
+     * @return  运单响应结果数据
+     */
+    @RequestMapping(value = "/selectV1", method = RequestMethod.POST)
+    public HttpResult selectWaybillOrder(@Valid @RequestBody WaybillOrderQueryDto query) {
+        try {
+            //return managementWaybillOrderService.selectWaybillOrder(query);
+            // 设置分页参数
+            PageHelper.startPage(query.getPage(), query.getPageSize());
+            List<WaybillOrderSelectVo> list = waybillOrderV1Service.findListPage(query);
+            PageResult result = PageHelperUtil.getPageResult(new PageInfo<>(list));
+            return HttpResult.ok(result);
+        } catch (Exception e) {
+            log.error("运营管理端-运单-首页条件查询 查询失败:{}", e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
+
 
     /**
      * 运营管理端-运单-top统计
@@ -70,6 +103,24 @@ public class ManagementWaybillOrderController {
         }
     }
 
+    /**
+     * 运营管理端-运单-top统计
+     *
+     * @param query 查询参数
+     * @return  运单统计结果
+     */
+    @RequestMapping(value = "/statisticsV1", method = RequestMethod.POST)
+    public HttpResult statisticsWaybillOrder(@Valid @RequestBody WaybillOrderQueryDto query) {
+        log.error("运营管理端-运单-top统计 查询 :{}", JSONObject.toJSONString(query));
+        try {
+            return HttpResult.ok(waybillOrderV1Service.statistics(query));
+        } catch (Exception e) {
+            log.error("运营管理端-运单-top统计 失败 :{}", e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
+
+
     /***
      * 运营管理端-运单-导出
      * @param query 查询参数
@@ -85,6 +136,31 @@ public class ManagementWaybillOrderController {
         ExcelUtil.downData(response, ManagementWaybillOrderExcelVO.class, list);
     }
 
+    /***
+     * 运营管理端-运单-导出
+     * @param query 查询参数
+     */
+    @RequestMapping(value = "/exportV1", method = RequestMethod.POST)
+    public void exportWaybillOrder(@Validated @RequestBody WaybillOrderQueryDto query, HttpServletResponse response) {
+        log.error("运营管理端-运单-导出 query :{}", JSONObject.toJSONString(query));
+        /*查询数据*/
+        List<WaybillOrderSelectVo> list = waybillOrderV1Service.findListPage(query);
+        if (CollectionUtils.isEmpty(list)) {
+            throw new CustomPromptException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认!");
+        }
+        //数据处理
+        List<WaybillOrderExportVo> orders = new ArrayList<>();
+        for (WaybillOrderSelectVo select:list) {
+            WaybillOrderExportVo exportVo = new WaybillOrderExportVo();
+            exportVo.setLoadName(String.join(Global.COMMA, select.getLoadName()));
+            exportVo.setLoadAddress(String.join(Global.COMMA, select.getLoadAddress()));
+            exportVo.setUnloadName(String.join(Global.COMMA, select.getUnloadName()));
+            exportVo.setUnloadAddress(String.join(Global.COMMA, select.getUnloadAddress()));
+            orders.add(exportVo);
+        }
+        ExcelUtil.downData(response, WaybillOrderExportVo.class, orders);
+    }
+
 
     /**
      * 运营端-运单-获取订单详情
@@ -102,4 +178,20 @@ public class ManagementWaybillOrderController {
         }
     }
 
+    /**
+     * 运营端-运单-获取订单详情
+     *
+     * @param id 订单id
+     * @return  订单数据
+     */
+    @RequestMapping(value = "/getOrderDetailV1", method = RequestMethod.GET)
+    public HttpResult getOrderDetailV1(@RequestParam("id") Long id) {
+        try {
+            return waybillOrderV1Service.waybillDetail(id);
+        } catch (Exception e) {
+            log.error("运营端-运单-获取订单详情失败:error :单据id:{}, errorMessage:{}", id, e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
+
 }

+ 6 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/WaybillOrderQueryDto.java

@@ -6,6 +6,7 @@ import com.sckw.core.model.page.PageRequest;
 import jakarta.validation.constraints.NotNull;
 import lombok.Data;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @author zk
@@ -22,6 +23,11 @@ public class WaybillOrderQueryDto extends PageRequest{
      */
     private Long  entId;
 
+    /**
+     * 多企业ID
+     */
+    private List<Long> entIds;
+
     /**
      * 关键字搜索
      */

+ 175 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/WaybillOrderExportVo.java

@@ -0,0 +1,175 @@
+package com.sckw.transport.model.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.sckw.core.model.constant.Global;
+import com.sckw.excel.annotation.ExcelContext;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author zk
+ * @desc 车辆运单列表
+ * @date 2024/3/11 0011
+ */
+@Data
+@Accessors(chain = true)
+@ExcelContext(fileName = "运单信息", sheetName = "运单信息")
+public class WaybillOrderExportVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 4526063761808958350L;
+
+    /**
+     * 运单号
+     */
+    @ExcelProperty(value = "运单号")
+    @JsonProperty(value="wOrderNo")
+    private String wOrderNo;
+
+    /**
+     * 物流订单编号
+     */
+    @ExcelProperty(value = "物流订单编号")
+    private String lOrderNo;
+
+    /**
+     * 车辆牌照
+     */
+    @ExcelProperty(value = "车辆牌照")
+    private String truckNo;
+
+    /**
+     * 司机
+     */
+    @ExcelProperty(value = "司机")
+    private String driverName;
+
+    /**
+     * 司机手机号
+     */
+    @ExcelProperty(value = "司机手机号")
+    private String driverPhone;
+
+    /**
+     * 运单类型字符
+     */
+    @ExcelIgnore
+    private Integer type;
+
+    /**
+     * 运单类型字符
+     */
+    @ExcelProperty(value = "运单类型字符")
+    private String typeLabel;
+
+    /**
+     * 采购企业名称
+     */
+    @ExcelProperty(value = "采购企业名称")
+    private String procureFirmName;
+
+    /**
+     * 供应企业名称
+     */
+    @ExcelProperty(value = "供应企业名称")
+    private String supplyFirmName;
+
+    /**
+     * 计划开始时间
+     */
+    @ExcelProperty(value = "计划开始时间")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date startTime;
+
+    /**
+     * 计划结束时间
+     */
+    @ExcelProperty(value = "计划结束时间")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date endTime;
+
+    /**
+     * 派单量/吨
+     */
+    @ExcelProperty(value = "派单量")
+    private String entrustAmount;
+
+    /**
+     * 装货地点名称
+     */
+    @ExcelProperty(value = "装货地点名称")
+    private String loadName;
+
+    /**
+     * 装货地点
+     */
+    @ExcelProperty(value = "装货地点")
+    private String loadAddress;
+
+    /**
+     * 卸货地点点名称
+     */
+    @ExcelProperty(value = "卸货地点点名称")
+    private String unloadName;
+
+    /**
+     * 卸货地点
+     */
+    @ExcelProperty(value = "卸货地点")
+    private String unloadAddress;
+
+    /**
+     * 实装量/吨
+     */
+    @ExcelProperty(value = "实装量")
+    private String loadAmount;
+
+    /**
+     * 实卸量/吨
+     */
+    @ExcelProperty(value = "实卸量")
+    private String unloadAmount;
+
+    /**
+     * 亏吨重量
+     */
+    @ExcelProperty(value = "亏吨重量")
+    private String deficitAmount;
+
+    /**
+     * 扣亏量(合理损耗-(实装-实卸))-单位
+     */
+    @ExcelProperty(value = "扣亏量")
+    private String deficitRealAmount;
+
+    /**
+     * 派车时间
+     */
+    @ExcelProperty(value = "派车时间")
+    private String sendCarTime;
+
+    /**
+     * 运单状态字符
+     */
+    @ExcelProperty(value = "运单状态")
+    private String  statusLabel;
+
+    /**
+     * 装载量
+     */
+    @ExcelProperty(value = "装载量")
+    private Double actualWeight;
+
+    public String getTypeLabel() {
+        return type != null && type == Global.NUMERICAL_ONE ? "趟次" : "循环";
+    }
+
+}

+ 44 - 7
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderV1Service.java

@@ -26,6 +26,7 @@ import com.sckw.stream.enums.MessageEnum;
 import com.sckw.stream.model.SckwMessage;
 import com.sckw.stream.model.UserInfo;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.AreaTreeFrontResDto;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
@@ -99,6 +100,8 @@ public class KwtWaybillOrderV1Service {
     private StreamBridge streamBridge;
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
+    @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
+    private RemoteUserService remoteUserService;
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteFleetService remoteFleetService;
     @DubboReference(version = "1.0.0", group = "design", check = false)
@@ -148,12 +151,12 @@ public class KwtWaybillOrderV1Service {
      * @author zk
      * @date 2024/3/8
      **/
-    public PageResult findListPage(WaybillOrderQueryDto params){
-        params.setEntId(LoginUserHolder.getEntId());
-        // 设置分页参数
-        PageHelper.startPage(params.getPage(), params.getPageSize());
+    public List<WaybillOrderSelectVo> findListPage(WaybillOrderQueryDto params){
         params.setQueryWstatus(CarWaybillTableTopEnum.getValue(params.getStatus()));
         List<WaybillOrderSelectVo> list = waybillOrderV1Dao.findListPage(params);
+        if (CollectionUtils.isEmpty(list)) {
+            return list;
+        }
 
         //单位
         Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.UNIT_TYPE.getType()));
@@ -164,7 +167,7 @@ public class KwtWaybillOrderV1Service {
             findListPageHandle(waybillOrder, unitMap);
             waybillOrder.setStatusLabel(CarWaybillEnum.getName(waybillOrder.getStatus()));
         }
-        return PageHelperUtil.getPageResult(new PageInfo<>(list));
+        return list;
     }
 
     /**
@@ -201,6 +204,41 @@ public class KwtWaybillOrderV1Service {
         return PageHelperUtil.getPageResult(new PageInfo<>(data));
     }
 
+    /**
+     * @param params {page:页数、pageSize:每页条数、。。。}
+     * @desc 分页查询-运营端
+     * @author zk
+     * @date 2024/3/8
+     **/
+    public List<WaybillOrderSelectVo> findListPageManagement(WaybillOrderQueryDto params) {
+        //客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)) {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)){
+                return new ArrayList<>();
+            }
+            authEntIdList.addAll(ids);
+        }
+        params.setEntIds(authEntIdList);
+        params.setQueryWstatus(CarWaybillTableTopEnum.getValue(params.getStatus()));
+        List<WaybillOrderSelectVo> list = waybillOrderV1Dao.findListPage(params);
+        if (CollectionUtils.isEmpty(list)) {
+            return list;
+        }
+
+        //单位
+        Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.UNIT_TYPE.getType()));
+        Map<String, String> unitMap = CollectionUtils.isNotEmpty(dict) ? dict.get(DictTypeEnum.UNIT_TYPE.getType()) : new HashMap<>(NumberConstant.SIXTEEN);
+
+        //数据处理
+        for (WaybillOrderSelectVo waybillOrder:list) {
+            findListPageHandle(waybillOrder, unitMap);
+            waybillOrder.setStatusLabel(CarWaybillEnum.getName(waybillOrder.getStatus()));
+        }
+        return list;
+    }
+
     /**
      * @param wOrderId 运单ID
      * @desc 运单详情
@@ -2236,7 +2274,6 @@ public class KwtWaybillOrderV1Service {
         result.put("driverName", waybillOrder.getDriverName());
         result.put("driverPhone", waybillOrder.getDriverPhone());
         result.put("driverIdcard", waybillOrder.getDriverIdcard());
-
         result.put("wTicketId", ticket != null ? ticket.getId() : null);
         result.put("wSubtaskId", subtask.getId());
         result.put("wAddressId", address.getId());
@@ -2318,7 +2355,7 @@ public class KwtWaybillOrderV1Service {
                 //状态记录
                 KwtWaybillOrderTrack track = waybillOrderTrackDao.findWaybillOrderTrack(wOrderId, subtask.getId(), address.getId(), status);
                 //辅助单位
-                List<WaybillOrderLoadingVO> loading = waybillOrderTicketService.agreementV1(subtask, track.getWAddressId());
+                List<WaybillOrderLoadingVO> loading = track != null ? waybillOrderTicketService.agreementV1(subtask, track.getWAddressId()) : null;
                 //辅助单位
                 List<GoodsUnitVo> assistUnit = kwtLogisticsOrderGoodsService.assistUnit(subtask.getLOrderId());
                 Map<String, Object> trackData = new HashMap<>(NumberConstant.SIXTEEN);

+ 3 - 2
sckw-modules/sckw-transport/src/main/resources/mapper/KwtWaybillOrderV1Mapper.xml

@@ -62,8 +62,9 @@
     <select id="findListPage" resultType="com.sckw.transport.model.vo.WaybillOrderSelectVo"
             parameterType="com.sckw.transport.model.dto.WaybillOrderQueryDto">
         SELECT
-        wo.id wOrderId, wo.ent_id entId, wo.w_order_no wOrderNo, wo.truck_no truckNo, wo.driver_name driverName, wo.driver_phone driverPhone,
-        wo.type, wo.create_time sendCarTime, wo.create_by createBy, wo.create_time createTime, wo.update_time updateTime, wo.status
+        wo.id wOrderId, wo.ent_id entId, wo.w_order_no wOrderNo, wo.type, wo.truck_no truckNo, wo.driver_name driverName,
+        wo.driver_phone driverPhone, wo.type, wo.create_time sendCarTime, wo.create_by createBy, wo.create_time createTime,
+        wo.update_time updateTime, wo.status
         from kwt_waybill_order wo
         where wo.del_flag = 0
         <if test="entId != null and entId != ''">