Browse Source

1、专场业务数据过滤处理

zk 2 years ago
parent
commit
4c89b49af9
31 changed files with 560 additions and 72 deletions
  1. 1 1
      sckw-auth/src/main/java/com/sckw/auth/service/impl/AuthServiceImpl.java
  2. 11 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/EntTypeEnum.java
  3. 2 2
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/context/LoginEntHolder.java
  4. 11 2
      sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteSystemService.java
  5. 3 2
      sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwoTransportDemandController.java
  6. 3 2
      sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwpWantBuyController.java
  7. 21 2
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/WantBuySelectParam.java
  8. 13 1
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTransportDemandService.java
  9. 12 1
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwpWantBuyService.java
  10. 6 5
      sckw-modules/sckw-order/src/main/resources/mapper/KwoWantBuyMapper.xml
  11. 5 4
      sckw-modules/sckw-product/src/main/java/com/sckw/product/controller/KwpGoodsController.java
  12. 25 3
      sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsService.java
  13. 3 2
      sckw-modules/sckw-report/src/main/java/com/sckw/report/controller/KwFleetController.java
  14. 18 1
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwFleetService.java
  15. 3 2
      sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsEnterpriseController.java
  16. 37 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsSpecialController.java
  17. 8 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEntSpecialDao.java
  18. 8 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsSpecialDao.java
  19. 14 3
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteBaseService.java
  20. 15 3
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java
  21. 51 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/KwsSpecialEntResVo.java
  22. 14 3
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java
  23. 90 8
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsSpecialService.java
  24. 21 0
      sckw-modules/sckw-system/src/main/resources/mapper/KwsEntSpecialDao.xml
  25. 37 0
      sckw-modules/sckw-system/src/main/resources/mapper/KwsSpecialDao.xml
  26. 7 6
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/KwtWaybillOrderController.java
  27. 2 2
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtWaybillOrderMapper.java
  28. 10 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/GoodsUnitVo.java
  29. 23 5
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtLogisticsOrderGoodsService.java
  30. 21 4
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderService.java
  31. 65 7
      sckw-modules/sckw-transport/src/main/resources/mapper/KwtWaybillOrderMapper.xml

+ 1 - 1
sckw-auth/src/main/java/com/sckw/auth/service/impl/AuthServiceImpl.java

@@ -310,7 +310,7 @@ public class AuthServiceImpl implements IAuthService {
             return HttpResult.ok();
         }
         //平台专场集
-        List<SpecialResVo> specialResVos = systemService.findSpecial();
+        List<SpecialResVo> specialResVos = systemService.querySpecial();
         //企业所属专场
         String special = enterprise != null ? enterprise.getSpecial() : null;
         //用户当前使用平台

+ 11 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/EntTypeEnum.java

@@ -81,4 +81,15 @@ public enum EntTypeEnum {
         return entTypes.contains(String.valueOf(EntTypeEnum.LOGISTICS3.getCode()))
                 || entTypes.contains(String.valueOf(EntTypeEnum.LOGISTICS4.getCode()));
     }
+
+    /**
+     * @desc 获取企业是承运单位类型值(4P物流、3P物流)
+     * @author zk
+     * @date 2023/10/7
+     **/
+    public static String carrier() {
+        return EntTypeEnum.LOGISTICS3.getCode() + Global.COMMA + EntTypeEnum.LOGISTICS4.getCode();
+    }
+
+
 }

+ 2 - 2
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/context/LoginEntHolder.java

@@ -88,9 +88,9 @@ public class LoginEntHolder {
      * @author zk
      * @Date 2023/12/17 0021
      */
-    public static boolean mainPlatform(){
+    public static boolean getMainPlatform(){
         String pecial = getSpecial();
-        return StringUtils.isBlank(pecial);
+        return StringUtils.isNotBlank(pecial);
     }
 
 }

+ 11 - 2
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteSystemService.java

@@ -249,15 +249,24 @@ public interface RemoteSystemService {
      * @author zk
      * @date 2023/12/14
      **/
-    List<SpecialResVo> findSpecial();
+    List<SpecialResVo> querySpecial();
 
     /**
      * @param code 专场编号
+     * @param type 企业类型
      * @desc 专场编号查询关联企业ID
      * @author zk
      * @date 2023/12/16
      **/
-    List<Long> findEntIdsByCode(String code);
+    List<Long> queryEntIdsByCode(String code, String type);
+
+    /**
+     * @param code 专场编号
+     * @desc 专场编号查询是否为主平台
+     * @author zk
+     * @date 2023/12/16
+     **/
+    boolean queryMainPlatform(String code);
 
     /**
      * 企业主键id查询数据库企业信息

+ 3 - 2
sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwoTransportDemandController.java

@@ -10,6 +10,7 @@ import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.order.model.dto.TransportDemandExport;
 import com.sckw.order.model.vo.req.*;
 import com.sckw.order.serivce.KwoTransportDemandService;
+import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
 import lombok.RequiredArgsConstructor;
 import org.springframework.http.MediaType;
@@ -177,8 +178,8 @@ public class KwoTransportDemandController {
      * @return: com.sckw.core.web.response.HttpResult
      */
     @PostMapping(value = "/demandSquaresList", produces = MediaType.APPLICATION_JSON_VALUE)
-    public HttpResult demandSquaresList(@RequestBody @Validated TransportDemandSquaresParam param) {
-        return HttpResult.ok(kwoTransportDemandService.demandSquaresList(param));
+    public HttpResult demandSquaresList(@RequestBody @Validated TransportDemandSquaresParam param, HttpServletRequest request) {
+        return HttpResult.ok(kwoTransportDemandService.demandSquaresList(param, request));
     }
 
     /**

+ 3 - 2
sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwpWantBuyController.java

@@ -10,6 +10,7 @@ import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.order.model.dto.WantBuyExport;
 import com.sckw.order.model.vo.req.*;
 import com.sckw.order.serivce.KwpWantBuyService;
+import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
 import lombok.RequiredArgsConstructor;
 import org.springframework.http.MediaType;
@@ -46,8 +47,8 @@ public class KwpWantBuyController {
      * @Date 15:34 2023/7/26 0026
      **/
     @PostMapping(value = "/buyHallList", produces = MediaType.APPLICATION_JSON_VALUE)
-    public HttpResult buyHallList(@RequestBody WantBuySelectParam wantBuySelectParam) {
-        return HttpResult.ok(kwpWantBuyService.buyHallList(wantBuySelectParam));
+    public HttpResult buyHallList(@RequestBody WantBuySelectParam wantBuySelectParam, HttpServletRequest request) {
+        return HttpResult.ok(kwpWantBuyService.buyHallList(wantBuySelectParam, request));
     }
 
     /**

+ 21 - 2
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/WantBuySelectParam.java

@@ -5,12 +5,11 @@ import com.sckw.core.model.page.PageRequest;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
-
 import java.util.Date;
 import java.util.List;
 
 /**
- * @Description:
+ * @Desc: 求购查询条件
  * @Author: lt
  * @Date: 2023-07-26-15:43
  */
@@ -59,11 +58,20 @@ public class WantBuySelectParam extends PageRequest {
      */
     private String goodsTypeValue;
 
+    /**
+     * 商品类型type值集
+     */
     private List<String> goodsTypeValueSearch;
 
+    /**
+     * 开始时间
+     */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date startCreateTime;
 
+    /**
+     * 结束时间
+     */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date endCreateTime;
 
@@ -71,6 +79,10 @@ public class WantBuySelectParam extends PageRequest {
      * 企业id
      */
     private Long entId;
+
+    /**
+     * 企业id集
+     */
     private List<Long> entIds;
 
     /**
@@ -78,6 +90,9 @@ public class WantBuySelectParam extends PageRequest {
      */
     private String ids;
 
+    /**
+     * 求购id集
+     */
     private List<Long> wantBuyIds;
 
     /**
@@ -85,4 +100,8 @@ public class WantBuySelectParam extends PageRequest {
      */
     private Integer systemType;
 
+    /**
+     * 专场企业ID集
+     */
+    private List<Long> specialEntIds;
 }

+ 13 - 1
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTransportDemandService.java

@@ -19,6 +19,7 @@ import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.DateUtils;
 import com.sckw.core.utils.StringUtils;
+import com.sckw.core.web.context.LoginEntHolder;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.excel.utils.DateUtil;
 import com.sckw.order.dao.KwoTransportDemandMapper;
@@ -34,6 +35,7 @@ import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
+import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
@@ -569,7 +571,7 @@ public class KwoTransportDemandService {
      * @Param param:
      * @return: com.sckw.core.model.page.PageResult
      */
-    public PageResult demandSquaresList(TransportDemandSquaresParam param) {
+    public PageResult demandSquaresList(TransportDemandSquaresParam param, HttpServletRequest request) {
         Page<KwoTransportDemand> page = new Page<>(param.getPage(), param.getPageSize());
         LambdaQueryWrapper<KwoTransportDemand> wrapper = new LambdaQueryWrapper<>();
         if (StringUtils.isNotBlank(param.getGoodsType()) && StringUtils.isNotBlank(param.getGoodsTypeValue())) {
@@ -610,6 +612,16 @@ public class KwoTransportDemandService {
                 wrapper.like(KwoTransportDemand::getName, param.getKeywords());
             }
         }
+
+        //专场逻辑
+        String accessSpecial = request.getHeader("Access-Special");
+        //是否主平台
+        boolean mainPlatform = remoteSystemService.queryMainPlatform(accessSpecial);
+        if (!mainPlatform) {
+            List<Long> entIds = remoteSystemService.queryEntIdsByCode(accessSpecial, null);
+            wrapper.in(KwoTransportDemand::getEntId, entIds);
+        }
+
         wrapper.last("order by RAND()");
         Page<KwoTransportDemand> kwpGoodsPage = kwoTransportDemandMapper.selectPage(page, wrapper);
         List<KwoTransportDemand> list = kwpGoodsPage.getRecords();

+ 12 - 1
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwpWantBuyService.java

@@ -15,6 +15,7 @@ import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
+import com.sckw.core.web.context.LoginEntHolder;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.excel.utils.DateUtil;
 import com.sckw.order.dao.KwpWantBuyAddressMapper;
@@ -31,6 +32,7 @@ import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
+import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
@@ -64,7 +66,7 @@ public class KwpWantBuyService {
      * @author lt
      * @Date 11:50 2023/8/1 0001
      **/
-    public PageRes<WantBuyHallRes> buyHallList(WantBuySelectParam wantBuySelectParam) {
+    public PageRes<WantBuyHallRes> buyHallList(WantBuySelectParam wantBuySelectParam, HttpServletRequest request) {
         // 如果有求购方式的查询条件,需要先查询出求购方式的id
         if (StringUtils.isNotBlank(wantBuySelectParam.getTrading())) {
             List<String> longList = stringToLongList(wantBuySelectParam.getTrading());
@@ -96,6 +98,15 @@ public class KwpWantBuyService {
         }
         wantBuySelectParam.setStatus(WantBuyStatusEnum.PUT_ON_SHELVES.getCode());
 
+        //专场逻辑
+        String accessSpecial = request.getHeader("Access-Special");
+        //是否主平台
+        boolean mainPlatform = remoteSystemService.queryMainPlatform(accessSpecial);
+        if (!mainPlatform) {
+            List<Long> entIds = remoteSystemService.queryEntIdsByCode(accessSpecial, null);
+            wantBuySelectParam.setSpecialEntIds(entIds);
+        }
+
         // 分页查询求购列表
         PageHelper.startPage(wantBuySelectParam.getPage(), wantBuySelectParam.getPageSize());
         List<WantBuySelectRes> wantBuyDto = kwpWantBuyMapper.queryBuyHallList(wantBuySelectParam);

+ 6 - 5
sckw-modules/sckw-order/src/main/resources/mapper/KwoWantBuyMapper.xml

@@ -183,7 +183,12 @@
         <if test="wantBuyReq.systemType != null and wantBuyReq.systemType == 1">
             and kb.status in (1,2)
         </if>
-
+        <if test="wantBuyReq.specialEntIds != null and wantBuyReq.specialEntIds.size() > 0">
+            and kb.ent_id in
+            <foreach collection="wantBuyReq.specialEntIds" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+        </if>
     </sql>
 
     <select id="pageSelect" resultMap="wangBuyResultMap" resultType="com.sckw.order.model.vo.res.WantBuySelectRes">
@@ -215,15 +220,12 @@
         <result column="trading" property="trading"/>
     </resultMap>
 
-
     <select id="tradingSql" resultMap="tradIngMap">
         select want_buy_id wantBuyId, trading
         from kwo_want_buy_trading
         where want_buy_id = #{wantBuyId} and del_flag = 0
     </select>
 
-
-
     <select id="statisticsCount"  resultType="com.sckw.order.model.vo.res.TableTopRes" parameterType="java.util.Map">
         select kb.`status` value
         from kwo_want_buy kb left join kwo_want_buy_trading kt on kb.id = kt.want_buy_id
@@ -234,7 +236,6 @@
         order by kb.create_time desc
     </select>
 
-
     <select id="queryBuyHallList"  resultMap="wangBuyResultMap" resultType="com.sckw.order.model.vo.res.WantBuySelectRes">
         select
             <include refid="Base_Column_List" />

+ 5 - 4
sckw-modules/sckw-product/src/main/java/com/sckw/product/controller/KwpGoodsController.java

@@ -11,6 +11,7 @@ import com.sckw.product.model.GoodsListExport;
 import com.sckw.product.model.vo.req.*;
 import com.sckw.product.service.KwpGoodsService;
 import com.sckw.product.service.KwpGoodsUnitService;
+import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
 import lombok.RequiredArgsConstructor;
 import org.springframework.http.MediaType;
@@ -176,8 +177,8 @@ public class KwpGoodsController {
      * @return: com.sckw.core.web.response.HttpResult
      */
     @PostMapping(value = "/buildingMaterialsMarketList", produces = MediaType.APPLICATION_JSON_VALUE)
-    public HttpResult buildingMaterialsMarketList(@RequestBody BuildingMaterialsMarketListParam params) {
-        return HttpResult.ok(kwpGoodsService.buildingMaterialsMarketList(params));
+    public HttpResult buildingMaterialsMarketList(@RequestBody BuildingMaterialsMarketListParam params, HttpServletRequest request) {
+        return HttpResult.ok(kwpGoodsService.buildingMaterialsMarketList(params, request));
     }
 
     /**
@@ -188,8 +189,8 @@ public class KwpGoodsController {
      * @return: com.sckw.core.web.response.HttpResult
      */
     @PostMapping(value = "/dropList", produces = MediaType.APPLICATION_JSON_VALUE)
-    public HttpResult dropList(@RequestBody @Validated GoodsDropListReq params) {
-        return HttpResult.ok(kwpGoodsService.dropList(params));
+    public HttpResult dropList(@RequestBody @Validated GoodsDropListReq params, HttpServletRequest request) {
+        return HttpResult.ok(kwpGoodsService.dropList(params, request));
     }
 
     /**

+ 25 - 3
sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsService.java

@@ -10,12 +10,14 @@ import com.sckw.core.exception.BusinessException;
 import com.sckw.core.exception.CustomPromptException;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.enums.ClientTypeEnum;
+import com.sckw.core.model.enums.EntTypeEnum;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.model.vo.TableBottom;
 import com.sckw.core.model.vo.TableStatisticRes;
 import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.utils.*;
 import com.sckw.core.web.constant.HttpStatus;
+import com.sckw.core.web.context.LoginEntHolder;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.excel.utils.DateUtil;
 import com.sckw.payment.api.dubbo.PayCenterDubboService;
@@ -39,6 +41,7 @@ import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.KwsUserResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
+import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
@@ -886,7 +889,7 @@ public class KwpGoodsService {
      * @Param params:
      * @return: com.sckw.core.model.page.PageResult
      */
-    public PageResult buildingMaterialsMarketList(BuildingMaterialsMarketListParam params) {
+    public PageResult buildingMaterialsMarketList(BuildingMaterialsMarketListParam params, HttpServletRequest request) {
         Page<KwpGoods> page = new Page<>(params.getPage(), params.getPageSize());
         LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode()).eq(KwpGoods::getDelFlag, Global.NO);
@@ -915,6 +918,16 @@ public class KwpGoodsService {
                 wrapper.like(KwpGoods::getName, params.getKeywords());
             }
         }
+
+        //专场逻辑
+        String accessSpecial = request.getHeader("Access-Special");
+        //是否主平台
+        boolean mainPlatform = remoteSystemService.queryMainPlatform(accessSpecial);
+        if (!mainPlatform) {
+            List<Long> entIds = remoteSystemService.queryEntIdsByCode(accessSpecial, String.valueOf(EntTypeEnum.SUPPLIER.getCode()));
+            wrapper.in(KwpGoods::getEntId, entIds);
+        }
+
         wrapper.last("order by RAND()");
         Page<KwpGoods> kwpGoodsPage = kwpGoodsMapper.selectPage(page, wrapper);
         List<KwpGoods> list = kwpGoodsPage.getRecords();
@@ -965,7 +978,6 @@ public class KwpGoodsService {
         return PageResult.build(params.getPage(), params.getPageSize(), kwpGoodsPage.getTotal(), result);
     }
 
-
     /**
      * @desc: 商品下拉列表
      * @author: yzc
@@ -973,7 +985,7 @@ public class KwpGoodsService {
      * @Param params:
      * @return: java.util.List<com.sckw.product.model.vo.res.GoodsDropList>
      */
-    public List<GoodsDropList> dropList(GoodsDropListReq params) {
+    public List<GoodsDropList> dropList(GoodsDropListReq params, HttpServletRequest request) {
         LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
         if (Objects.equals(params.getOrderType(), 2)) {
             Long supplyEntId = params.getSupplyEntId();
@@ -985,6 +997,16 @@ public class KwpGoodsService {
         wrapper.like(StringUtils.isNotBlank(params.getName()), KwpGoods::getName, params.getName())
                 .eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode())
                 .eq(KwpGoods::getDelFlag, Global.NO).orderByDesc(KwpGoods::getAddedTime);
+
+        //专场逻辑
+        String accessSpecial = request.getHeader("Access-Special");
+        //是否主平台
+        boolean mainPlatform = remoteSystemService.queryMainPlatform(accessSpecial);
+        if (!mainPlatform) {
+            List<Long> entIds = remoteSystemService.queryEntIdsByCode(accessSpecial, String.valueOf(EntTypeEnum.SUPPLIER.getCode()));
+            wrapper.in(KwpGoods::getEntId, entIds);
+        }
+
         List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
         if (CollectionUtils.isEmpty(list)) {
             return Collections.emptyList();

+ 3 - 2
sckw-modules/sckw-report/src/main/java/com/sckw/report/controller/KwFleetController.java

@@ -3,6 +3,7 @@ package com.sckw.report.controller;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.report.service.KwFleetService;
+import jakarta.servlet.http.HttpServletRequest;
 import lombok.AllArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -32,8 +33,8 @@ public class KwFleetController {
      * @date 2023/9/1
      **/
     @PostMapping("/capacity")
-    public HttpResult capacity(@RequestBody HashMap params) {
-        PageResult pageResult = fleetService.capacity(params);
+    public HttpResult capacity(@RequestBody HashMap params, HttpServletRequest request) {
+        PageResult pageResult = fleetService.capacity(params, request);
         return HttpResult.ok(pageResult);
     }
 }

+ 18 - 1
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwFleetService.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.enums.EntTypeEnum;
 import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.CollectionUtils;
@@ -11,9 +12,11 @@ import com.sckw.core.utils.NumberUtils;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.fleet.api.RemoteFleetService;
 import com.sckw.report.model.vo.KwfCapacityVo;
+import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.req.QueryEntInfoByCityCodeAndEntTypesWithPageReqDto;
 import com.sckw.system.api.model.dto.res.KwsEnterpriseResDto;
+import jakarta.servlet.http.HttpServletRequest;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.stereotype.Service;
 
@@ -30,6 +33,9 @@ public class KwFleetService {
     @DubboReference(version = "1.0.0", group = "design", check = false)
     RemoteUserService userService;
 
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    RemoteSystemService systemService;
+
     @DubboReference(version = "1.0.0", group = "design", check = false)
     RemoteFleetService fleetService;
 
@@ -39,7 +45,7 @@ public class KwFleetService {
      * @author zk
      * @date 2023/9/1
      **/
-    public PageResult capacity(HashMap<String, Object> params) {
+    public PageResult capacity(HashMap<String, Object> params, HttpServletRequest request) {
         // 参数组装
         List<Long> entIds = new ArrayList<>();
         Integer capacityAmountMin = null;
@@ -56,6 +62,17 @@ public class KwFleetService {
             }
         }
 
+        //专场逻辑
+        String accessSpecial = request.getHeader("Access-Special");
+        //是否主平台
+        boolean mainPlatform = systemService.queryMainPlatform(accessSpecial);
+        if (!mainPlatform) {
+            List<Long> specialEntIds = systemService.queryEntIdsByCode(accessSpecial, EntTypeEnum.carrier());
+            if (CollectionUtils.isNotEmpty(entIds)) {
+                entIds.retainAll(specialEntIds);
+            }
+        }
+
         // 企业数据查询
         List<KwfCapacityVo> list = new ArrayList<>();
         int page = PageResult.getPage(params);

+ 3 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsEnterpriseController.java

@@ -6,6 +6,7 @@ import com.sckw.system.model.KwsEnterprise;
 import com.sckw.system.model.vo.req.*;
 import com.sckw.system.model.vo.req.FindListReqVo;
 import com.sckw.system.service.KwsEnterpriseService;
+import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -277,8 +278,8 @@ public class KwsEnterpriseController {
      * @date: 2023/7/22
      */
     @PostMapping("queryOtherEnt")
-    public HttpResult queryOtherEnt(@RequestBody IdReqVo reqVo) {
-        return HttpResult.ok(kwsEntService.queryOtherEnt(reqVo.getId()));
+    public HttpResult queryOtherEnt(@RequestBody IdReqVo reqVo, HttpServletRequest request) {
+        return HttpResult.ok(kwsEntService.queryOtherEnt(reqVo.getId(), request));
     }
 
     /**

+ 37 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsSpecialController.java

@@ -9,6 +9,7 @@ import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.system.model.vo.req.KwsSpecialAddReqVo;
 import com.sckw.system.model.vo.req.KwsSpecialUpdateReqVo;
+import com.sckw.system.model.vo.res.KwsSpecialEntResVo;
 import com.sckw.system.model.vo.res.KwsSpecialResVo;
 import com.sckw.system.service.KwsSpecialService;
 import jakarta.validation.Valid;
@@ -45,7 +46,6 @@ public class KwsSpecialController {
         return HttpResult.ok(truckDetailVo);
     }
 
-
     /**
      * @param params {page:页数、pageSize:每页条数、。。。}
      * @desc 分页查询
@@ -61,6 +61,21 @@ public class KwsSpecialController {
         return HttpResult.ok(pageResult);
     }
 
+    /**
+     * @param params {page:页数、pageSize:每页条数、。。。}
+     * @desc 分页查询
+     * @author zk
+     * @date 2023/12/13
+     **/
+    @PostMapping("/specialSelect")
+    public HttpResult specialSelect(@RequestBody Map<String, Object> params) throws SystemException {
+        // 设置分页参数
+        PageHelper.startPage(PageResult.getPage(params), PageResult.getPageSize(params));
+        List<KwsSpecialEntResVo> list = kwsSpecialService.findSpecialPage(params);
+        PageResult pageResult = PageHelperUtil.getPageResult(new PageInfo<>(list));
+        return HttpResult.ok(pageResult);
+    }
+
     /**
      * @param params {。。。}
      * @desc 查询
@@ -117,4 +132,25 @@ public class KwsSpecialController {
         return kwsSpecialService.joinSpecial(params);
     }
 
+    /**
+     * @param params {}
+     * @desc 退出专场
+     * @author zk
+     * @date 2023/12/13
+     **/
+    @PostMapping("/exitSpecial")
+    public HttpResult exitSpecial(@Valid @RequestBody HashMap<String, Object> params) throws SystemException {
+        return kwsSpecialService.exitSpecial(params);
+    }
+
+    /**
+     * @param domain 域名
+     * @desc 专场详情
+     * @author zk
+     * @date 2023/12/13
+     **/
+    @GetMapping("/findSpecial")
+    public HttpResult findSpecial(String domain){
+        return HttpResult.ok(kwsSpecialService.findSpecial(domain));
+    }
 }

+ 8 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEntSpecialDao.java

@@ -20,4 +20,12 @@ public interface KwsEntSpecialDao extends BaseMapper<KwsEntSpecial> {
      * @return 专场企业集
      */
     List<KwsEntSpecial> findList(Map<String, Object> params);
+
+    /**
+     * 专场企业类型查询
+     * @param params {mainPlatform 是否公共平台、entId 企业ID、specialId 专场ID, type 企业类型}
+     * @return 专场企业集
+     */
+    List<Long> findListByEntType(Map<String, Object> params);
+
 }

+ 8 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsSpecialDao.java

@@ -2,6 +2,7 @@ package com.sckw.system.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.system.model.KwsSpecial;
+import com.sckw.system.model.vo.res.KwsSpecialEntResVo;
 import com.sckw.system.model.vo.res.KwsSpecialResVo;
 import org.apache.ibatis.annotations.Mapper;
 import java.util.List;
@@ -22,6 +23,13 @@ public interface KwsSpecialDao extends BaseMapper<KwsSpecial> {
      */
     List<KwsSpecialResVo> findPage(Map<String, Object> params);
 
+    /**
+     * 专场查询
+     * @param params 查询参数
+     * @return 专场集
+     */
+    List<KwsSpecialEntResVo> findSpecialPage(Map<String, Object> params);
+
     /**
      * 专场查询
      * @param params 查询参数

+ 14 - 3
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteBaseService.java

@@ -272,12 +272,23 @@ public class RemoteBaseService {
 
     /**
      * @param code 专场编号
-     * @desc 专场编号查询关联企业ID
+     * @param type 企业类型
+     * @desc 专场编号查询关联企业ID()
      * @author zk
      * @date 2023/12/16
      **/
-    public List<Long> findEntIdsByCode(String code) {
-        return kwsSpecialService.findEntIdsByCode(code);
+    public List<Long> findEntIdsByCode(String code, String type) {
+        return kwsSpecialService.findEntIdsByCode(code, type);
+    }
+
+    /**
+     * @param code 专场编号
+     * @desc 专场编号查询是否为主平台
+     * @author zk
+     * @date 2023/12/16
+     **/
+    public boolean queryMainPlatform(String code) {
+        return kwsSpecialService.queryMainPlatform(code);
     }
 
     /**

+ 15 - 3
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java

@@ -810,19 +810,31 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      * @date 2023/12/14
      **/
     @Override
-    public List<SpecialResVo> findSpecial() {
+    public List<SpecialResVo> querySpecial() {
         return remoteBaseService.findSpecial();
     }
 
     /**
      * @param code 专场编号
+     * @param type 企业类型
      * @desc 专场编号查询关联企业ID
      * @author zk
      * @date 2023/12/16
      **/
     @Override
-    public List<Long> findEntIdsByCode(String code){
-        return remoteBaseService.findEntIdsByCode(code);
+    public List<Long> queryEntIdsByCode(String code, String type){
+        return remoteBaseService.findEntIdsByCode(code, type);
+    }
+
+    /**
+     * @param code 专场编号
+     * @desc 专场编号查询是否为主平台
+     * @author zk
+     * @date 2023/12/16
+     **/
+    @Override
+    public boolean queryMainPlatform(String code) {
+        return remoteBaseService.queryMainPlatform(code);
     }
 
     /**

+ 51 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/KwsSpecialEntResVo.java

@@ -0,0 +1,51 @@
+package com.sckw.system.model.vo.res;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @desc 专场信息
+ * @author zk
+ * @date 2023/12/13 0013
+ */
+@Data
+public class KwsSpecialEntResVo implements Serializable {
+    /**
+     * 专场主企业ID
+     */
+    private Long entId;
+
+    /**
+     * 专场主企业
+     */
+    private String firmName;
+
+    /**
+     * 是否主平台(0否、1是)
+     */
+    private Integer isMain;
+
+    /**
+     * 是否主平台(0否、1是)
+     */
+    private String code;
+
+    /**
+     * 专场ID
+     */
+    private Long specialId;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    private String createByName;
+
+}

+ 14 - 3
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -32,6 +32,7 @@ import com.sckw.system.model.report.EntCustomerExcel;
 import com.sckw.system.model.report.EntSettleExcel;
 import com.sckw.system.model.vo.req.*;
 import com.sckw.system.model.vo.res.*;
+import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -1081,7 +1082,6 @@ public class KwsEnterpriseService {
         return list;
     }
 
-
     /**
      * @param entId id
      * @return QueryCurrentOrganization
@@ -1089,12 +1089,24 @@ public class KwsEnterpriseService {
      * @author: czh
      * @date: 2023/7/22
      */
-    public List<QueryCurrentOrganizationResVo> queryOtherEnt(Long entId) {
+    public List<QueryCurrentOrganizationResVo> queryOtherEnt(Long entId, HttpServletRequest request) {
         List<KwsEnterprise> kwsEnterprises = kwsEnterpriseDao.selectByKeys(null);
         if (CollectionUtils.isEmpty(kwsEnterprises)) {
             return Collections.emptyList();
         }
 
+        //专场逻辑
+        String accessSpecial = request.getHeader("Access-Special");
+        //是否主平台
+        boolean mainPlatform = remoteSystemService.queryMainPlatform(accessSpecial);
+        if (!mainPlatform) {
+            List<Long> entIds = remoteSystemService.queryEntIdsByCode(accessSpecial, null);
+            if (CollectionUtils.isEmpty(entIds)) {
+                return Collections.emptyList();
+            }
+            kwsEnterprises = kwsEnterprises.stream() .filter(item -> !entIds.contains(item.getId())) .collect(Collectors.toList());
+        }
+
         //过滤除了当前企业的其他企业
         kwsEnterprises = kwsEnterprises.stream().filter(item -> !item.getId().equals(entId)).toList();
         if (CollectionUtils.isEmpty(kwsEnterprises)) {
@@ -1130,7 +1142,6 @@ public class KwsEnterpriseService {
             manageInfoCollect = manageInfoByEntIds.stream().collect(Collectors.toMap(FindManagePojo::getEntId, Function.identity()));
         }
 
-
         List<QueryCurrentOrganizationResVo> list = new ArrayList<>();
         for (KwsEnterprise kwsEnterprise : kwsEnterprises) {
             QueryCurrentOrganizationResVo queryCurrentOrganizationResVo = new QueryCurrentOrganizationResVo();

+ 90 - 8
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsSpecialService.java

@@ -26,6 +26,7 @@ import com.sckw.system.model.KwsSpecial;
 import com.sckw.system.model.KwsUser;
 import com.sckw.system.model.vo.req.KwsSpecialAddReqVo;
 import com.sckw.system.model.vo.req.KwsSpecialUpdateReqVo;
+import com.sckw.system.model.vo.res.KwsSpecialEntResVo;
 import com.sckw.system.model.vo.res.KwsSpecialResVo;
 import org.checkerframework.checker.units.qual.C;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -105,6 +106,16 @@ public class KwsSpecialService {
         return kwsSpecialDao.findPage(params);
     }
 
+    /**
+     * @param params 分页参数
+     * @desc 分页查询
+     * @author zk
+     * @date 2023/12/13
+     **/
+    public List<KwsSpecialEntResVo> findSpecialPage(Map<String, Object> params) {
+        return kwsSpecialDao.findSpecialPage(params);
+    }
+
     /**
      * @param params 查询参数
      * @desc 查询
@@ -115,6 +126,25 @@ public class KwsSpecialService {
         return kwsSpecialDao.findList(params);
     }
 
+    /**
+     * @param domain 域名
+     * @desc 通过域名查询专场信息
+     * @author zk
+     * @date 2023/12/13
+     **/
+    public Map<String, Object> findSpecial(String domain) {
+        List<KwsSpecial> specials = kwsSpecialDao.findList(new HashMap<>(){{put("websiteFuzzy", domain);}});
+        if (CollectionUtils.isNotEmpty(specials)) {
+            KwsSpecial special1 = specials.get(NumberConstant.ZERO);
+            Map<String, Object> special = new HashMap<>(NumberConstant.SIXTEEN);
+            special.put("name", special1.getName());
+            special.put("website", special1.getWebsite());
+            special.put("code", special1.getCode());
+            return special;
+        }
+        return null;
+    }
+
     /**
      * @param params 参数
      * @desc 新增专场
@@ -261,6 +291,36 @@ public class KwsSpecialService {
         return HttpResult.ok("加入专场成功!");
     }
 
+    /**
+     * @param params {}
+     * @desc 退出专场
+     * @author zk
+     * @date 2023/12/13
+     **/
+    public HttpResult exitSpecial(HashMap<String, Object> params) {
+        /*校验*/
+        if (StringUtils.isBlank(params.get("specialId")) || StringUtils.isBlank(params.get("entIds"))) {
+            return HttpResult.error("参数不能为空!");
+        }
+        Long specialId = NumberUtils.parseLong(params.get("specialId"));
+        String entId = StringUtils.objectStr(params.get("entId"));
+        KwsSpecial special = kwsSpecialDao.selectById(specialId);
+        if (special == null) {
+            return HttpResult.error("专场信息不存在!");
+        }
+        List<KwsEntSpecial> entSpecials = kwsEntSpecialDao.findList(new HashMap<>(){{put("entId", entId); put("specialId", specialId);}});
+        if (CollectionUtils.isNotEmpty(entSpecials)) {
+            return HttpResult.error("专场企业信息不存在!");
+        } else {
+            entSpecials.forEach(e -> {
+                e.setDelFlag(Global.YES);
+                kwsEntSpecialDao.updateById(e);
+            });
+        }
+
+        return HttpResult.ok("企业从专场删除成功!");
+    }
+
     /**
      * @param entId 企业ID
      * @desc 企业专场编号查询
@@ -284,11 +344,12 @@ public class KwsSpecialService {
 
     /**
      * @param code 专场编号
+     * @param type 企业类型
      * @desc 专场编号查询关联企业ID
      * @author zk
      * @date 2023/12/16
      **/
-    public List<Long> findEntIdsByCode(String code) {
+    public List<Long> findEntIdsByCode(String code, String type) {
         //企业ID结果集
         List<Long> entIds = new ArrayList<>();
         //专场
@@ -296,15 +357,36 @@ public class KwsSpecialService {
         if (CollectionUtils.isNotEmpty(specials)) {
             KwsSpecial special = specials.get(NumberConstant.ZERO);
             entIds.add(special.getEntId());
-
-            //专场关联企业
-            List<KwsEntSpecial> entSpecials = kwsEntSpecialDao.findList(new HashMap<>(){{put("specialId", special.getId());}});
-            if (CollectionUtils.isNotEmpty(entSpecials)) {
-                entSpecials.forEach(e ->{
-                    entIds.add(e.getEntId());
-                });
+            if (special.getIsMain() == NumberConstant.ONE) {
+                //公共平台企业
+                entIds = kwsEntSpecialDao.findListByEntType(new HashMap<>() {{
+                    put("mainPlatform", NumberConstant.ONE);
+                    put("type", type);
+                }});
+            } else {
+                //专场关联企业
+                entIds = kwsEntSpecialDao.findListByEntType(new HashMap<>() {{
+                    put("specialId", special.getId());
+                    put("type", type);
+                }});
             }
         }
         return entIds;
     }
+
+    /**
+     * @param code 专场编号
+     * @desc 专场编号查询是否为主平台
+     * @author zk
+     * @date 2023/12/16
+     **/
+    public boolean queryMainPlatform(String code) {
+        //专场
+        List<KwsSpecial> specials = kwsSpecialDao.findList(new HashMap<>(){{put("code", code);}});
+        if (CollectionUtils.isNotEmpty(specials)) {
+            KwsSpecial special = specials.get(NumberConstant.ZERO);
+            return special.getIsMain() == NumberConstant.ONE;
+        }
+        return false;
+    }
 }

+ 21 - 0
sckw-modules/sckw-system/src/main/resources/mapper/KwsEntSpecialDao.xml

@@ -17,4 +17,25 @@
         ORDER BY create_time desc
     </select>
 
+    <select id="findListByEntType" parameterType="java.util.Map" >
+        select
+        DISTINCT ke.id entId
+        from kws_enterprise ke
+        left join kws_ent_type ket on ket.ent_id = ke.id and ket.del_flag = 0
+        left join kws_ent_special kes on kes.ent_id = ke.id and kes.del_flag = 0
+        where ke.del_flag = 0
+        <if test="entId != null and entId != ''">
+            and ke.id = #{entId, jdbcType=BIGINT}
+        </if>
+        <if test="specialId != null and specialId != ''">
+            and kes.special_id = #{specialId, jdbcType=BIGINT}
+        </if>
+        <if test="mainPlatform != null and mainPlatform != ''">
+            and kes.special_id is null
+        </if>
+        <if test="type != null and type != ''">
+            and FIND_IN_SET(ket.type, #{type})
+        </if>
+    </select>
+
 </mapper>

+ 37 - 0
sckw-modules/sckw-system/src/main/resources/mapper/KwsSpecialDao.xml

@@ -18,6 +18,9 @@
     <if test="code != null and code != ''">
       and ks.code = #{code, jdbcType=VARCHAR}
     </if>
+    <if test="isMain != null and isMain != ''">
+      and is_main = #{isMain, jdbcType=INTEGER}
+    </if>
     <if test="keywords != null and keywords != ''">
       and (
         ks.name like concat('%', #{keywords}, '%')
@@ -44,10 +47,44 @@
     <if test="code != null and code != ''">
       and code = #{code, jdbcType=VARCHAR}
     </if>
+    <if test="isMain != null and isMain != ''">
+      and is_main = #{isMain, jdbcType=INTEGER}
+    </if>
+    <if test="website != null and website != ''">
+      and website = #{website, jdbcType=VARCHAR}
+    </if>
+    <if test="websiteFuzzy != null and websiteFuzzy != ''">
+      and website like concat('%', #{websiteFuzzy}, '%')
+    </if>
     <if test="manager != null and manager != ''">
       and manager = #{manager, jdbcType=VARCHAR}
     </if>
     ORDER BY create_time desc
   </select>
 
+  <select id="findSpecialPage" resultType="com.sckw.system.model.vo.res.KwsSpecialEntResVo" parameterType="java.util.Map" >
+    SELECT * from (
+      select
+        ke.id entId, ke.firm_name firmName, 0 isMain, ks.id specialId, ks.code, kes.create_time createTime, ku.`name` createByName
+      from kws_enterprise ke
+      left join kws_ent_special kes on kes.ent_id = ke.id and kes.del_flag = 0
+      LEFT JOIN kws_special ks on ks.id = kes.special_id
+      left join kws_user ku on ku.id = kes.create_by
+      where ke.del_flag = 0 and kes.del_flag = 0
+      UNION
+      select
+        ke.id entId, ke.firm_name firmName, 1 isMain, ks.id specialId, ks.code, ks.create_time createTime, ku.`name` createByName
+      from kws_enterprise ke
+      LEFT JOIN kws_special ks on ks.ent_id = ke.id
+      left join kws_user ku on ku.id = ks.create_by
+      where ke.del_flag = 0 and ks.del_flag = 0
+    ) tab where 1=1
+    <if test="firmName != null and firmName != ''">
+      and firmName LIKE concat('%',#{firmName},'%')
+    </if>
+    <if test="isMain != null and isMain != ''">
+      and isMain = #{isMain, jdbcType=INTEGER}
+    </if>
+    ORDER BY createTime desc
+  </select>
 </mapper>

+ 7 - 6
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/KwtWaybillOrderController.java

@@ -14,6 +14,7 @@ import com.sckw.core.web.response.HttpResult;
 import com.sckw.transport.model.dto.*;
 import com.sckw.transport.model.vo.WaybillOrderDriverVo;
 import com.sckw.transport.service.KwtWaybillOrderService;
+import jakarta.servlet.http.HttpServletRequest;
 import jakarta.validation.Valid;
 import jakarta.validation.constraints.NotBlank;
 import lombok.extern.slf4j.Slf4j;
@@ -41,9 +42,9 @@ public class KwtWaybillOrderController {
      * @date 2023/8/1
      **/
     @GetMapping("/findCountByDriver")
-    public HttpResult findCountByDriver(){
+    public HttpResult findCountByDriver(HttpServletRequest request){
         Long driverId = LoginUserHolder.getUserId();
-        Map count = waybillOrderService.findStatisticsCountByDriver(driverId);
+        Map count = waybillOrderService.findStatisticsCountByDriver(driverId, request);
         return HttpResult.ok(count);
     }
 
@@ -54,10 +55,10 @@ public class KwtWaybillOrderController {
      * @date 2023/8/1
      **/
     @PostMapping("/findSumByDriver")
-    public HttpResult findSumByDriver(@RequestBody Map<String, Object> params){
+    public HttpResult findSumByDriver(@RequestBody Map<String, Object> params, HttpServletRequest request){
         try {
             params.put("driverId", LoginUserHolder.getUserId());
-            Map<String, Object> count = waybillOrderService.findStatisticsSumByDriver(params);
+            Map<String, Object> count = waybillOrderService.findStatisticsSumByDriver(params, request);
             return HttpResult.ok(count);
         } catch (Exception e) {
             log.error("findSumByDriver error query:{},errorMessage:{}", JSONObject.toJSONString(params),e.getMessage(),e);
@@ -72,7 +73,7 @@ public class KwtWaybillOrderController {
      * @date 2023/8/1
      **/
     @PostMapping("/findWaybillOrderByDriver")
-    public HttpResult findWaybillOrderByDriver(@RequestBody Map<String, Object> params){
+    public HttpResult findWaybillOrderByDriver(@RequestBody Map<String, Object> params, HttpServletRequest request){
         params.put("driverId", LoginUserHolder.getUserId());
         /**校验**/
         if (StringUtils.isBlank(params.get("busStatus"))) {
@@ -80,7 +81,7 @@ public class KwtWaybillOrderController {
         }
         // 设置分页参数
         PageHelper.startPage(PageResult.getPage(params), PageResult.getPageSize(params));
-        List<WaybillOrderDriverVo> list = waybillOrderService.findWaybillOrderByDriver(params);
+        List<WaybillOrderDriverVo> list = waybillOrderService.findWaybillOrderByDriver(params, request);
         PageResult pageResult = PageHelperUtil.getPageResult(new PageInfo<>(list));
         return HttpResult.ok(pageResult);
     }

+ 2 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtWaybillOrderMapper.java

@@ -125,13 +125,13 @@ public interface KwtWaybillOrderMapper extends BaseMapper<KwtWaybillOrder> {
 
     /**
      * 统计司机任务数(待接单/出车/执行/完结)
-     * @param driverId 司机ID
+     * @param params {driverId 司机ID}
      * @desc 统计司机任务数(待接单/出车/执行/完结)
      * @author zk
      * @date 2023/8/1
      * @return 统计数据
      **/
-    Map<String, Object> findStatisticsCountByDriver(@Param("driverId") Long driverId);
+    Map<String, Object> findStatisticsCountByDriver(Map<String, Object> params);
 
     /**
      * 统计司机任务数(任务数/委派量/装货量/卸货量/亏吨量/亏吨扣款)

+ 10 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/GoodsUnitVo.java

@@ -22,11 +22,21 @@ public class GoodsUnitVo implements Serializable {
      */
     private String fromUnit;
 
+    /**
+     * 被转换单位
+     */
+    private String fromUnitName;
+
     /**
      * 转换目标单位
      */
     private String toUnit;
 
+    /**
+     * 转换目标单位
+     */
+    private String toUnitName;
+
     /**
      * 换算值
      */

+ 23 - 5
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtLogisticsOrderGoodsService.java

@@ -1,5 +1,6 @@
 package com.sckw.transport.service;
 
+import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.model.enums.LogisticsOrderEnum;
@@ -10,6 +11,7 @@ import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.order.api.model.GoodsLoadingParam;
 import com.sckw.order.api.model.OrderDetailRes;
+import com.sckw.system.api.RemoteSystemService;
 import com.sckw.transport.dao.KwtLogisticsOrderGoodsMapper;
 import com.sckw.transport.dao.KwtLogisticsOrderGoodsUnitMapper;
 import com.sckw.transport.dao.KwtLogisticsOrderMapper;
@@ -26,13 +28,11 @@ import com.sckw.transport.model.vo.GoodsUnitVo;
 import com.sckw.transport.model.vo.LogisticsCountVo;
 import com.sckw.transport.model.vo.WaybillCountVo;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
 
 /**
  * @desc 物流订单关联商品信息
@@ -51,6 +51,8 @@ public class KwtLogisticsOrderGoodsService {
     public KwtLogisticsOrderGoodsMapper goodsMapper;
     @Autowired
     public KwtLogisticsOrderGoodsUnitMapper goodsUnitMapper;
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteSystemService remoteSystemService;
 
     /**
      * 物流订单-商品信息
@@ -278,7 +280,23 @@ public class KwtLogisticsOrderGoodsService {
         List<KwtLogisticsOrderGoodsUnit> assistUnit = goodsUnitMapper.findGoodsUnit(new HashMap<>(NumberConstant.SIXTEEN){{
             put("lOrderId", lOrderId);
         }});
-        return BeanUtils.copyToList(assistUnit, GoodsUnitVo.class);
+
+        if (CollectionUtils.isNotEmpty(assistUnit)) {
+            //单位
+            Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.UNIT_TYPE.getType()));
+            Map<String, String> unitMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
+            if (CollectionUtils.isNotEmpty(dict)) {
+                unitMap = dict.get(DictTypeEnum.UNIT_TYPE.getType());
+            }
+
+            Map<String, String> finalUnitMap = unitMap;
+            units = BeanUtils.copyToList(assistUnit, GoodsUnitVo.class);
+            units.forEach(e->{
+                e.setFromUnit(finalUnitMap != null ? finalUnitMap.get(e.getFromUnit()) : null);
+                e.setToUnitName(finalUnitMap != null ? finalUnitMap.get(e.getToUnit()) : null);
+            });
+        }
+        return units;
     }
 
     /**

+ 21 - 4
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderService.java

@@ -36,6 +36,7 @@ import com.sckw.transport.model.*;
 import com.sckw.transport.model.dto.*;
 import com.sckw.transport.model.vo.*;
 import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletRequest;
 import jakarta.validation.Valid;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
@@ -107,8 +108,15 @@ public class KwtWaybillOrderService {
      * @author zk
      * @date 2023/8/1
      **/
-    public Map<String, Object> findStatisticsCountByDriver(Long driverId) {
-        return waybillOrderDao.findStatisticsCountByDriver(driverId);
+    public Map<String, Object> findStatisticsCountByDriver(Long driverId, HttpServletRequest request) {
+        //参数
+        Map<String, Object> params = new HashMap<>(){{put("driverId", driverId);}};
+
+        //专场逻辑
+        String accessSpecial = request.getHeader("Access-Special");
+        List<Long> specialEntIds = remoteSystemService.queryEntIdsByCode(accessSpecial, EntTypeEnum.carrier());
+        params.put("specialEntIds", specialEntIds);
+        return waybillOrderDao.findStatisticsCountByDriver(params);
     }
 
     /**
@@ -117,7 +125,12 @@ public class KwtWaybillOrderService {
      * @author zk
      * @date 2023/8/1
      **/
-    public Map<String, Object> findStatisticsSumByDriver(Map params) {
+    public Map<String, Object> findStatisticsSumByDriver(Map params, HttpServletRequest request) {
+        //专场逻辑
+        String accessSpecial = request.getHeader("Access-Special");
+        List<Long> specialEntIds = remoteSystemService.queryEntIdsByCode(accessSpecial, EntTypeEnum.carrier());
+        params.put("specialEntIds", specialEntIds);
+
         Map<String, Object> data = waybillOrderDao.findStatisticsSumByDriver(params);
         BigDecimal deficitLossAmount = waybillOrderDao.deficitLossAmountByDriver(params);
         deficitLossAmount = deficitLossAmount.setScale(2, RoundingMode.HALF_UP);
@@ -131,12 +144,16 @@ public class KwtWaybillOrderService {
      * @author zk
      * @date 2023/8/1
      **/
-    public List<WaybillOrderDriverVo> findWaybillOrderByDriver(Map params) {
+    public List<WaybillOrderDriverVo> findWaybillOrderByDriver(Map params, HttpServletRequest request) {
         /**参数处理**/
         //业务状态busStatus  1待接单/2出车/3执行/4完结
         Integer busStatus = NumberUtils.parseInt(params.get("busStatus"));
         Object driverId = StringUtils.isBlank(params.get("driverId")) ? LoginUserHolder.getUserId() : params.get("driverId");
         params.put("driverId", driverId);
+        //专场逻辑
+        String accessSpecial = request.getHeader("Access-Special");
+        List<Long> specialEntIds = remoteSystemService.queryEntIdsByCode(accessSpecial, EntTypeEnum.carrier());
+        params.put("specialEntIds", specialEntIds);
         // 设置分页参数
         PageHelper.startPage(PageResult.getPage(params), PageResult.getPageSize(params));
 

+ 65 - 7
sckw-modules/sckw-transport/src/main/resources/mapper/KwtWaybillOrderMapper.xml

@@ -281,7 +281,7 @@
         limit #{page},#{pageSize}
     </select>
 
-    <select id="findStatisticsCountByDriver" resultType="java.util.Map">
+    <select id="findStatisticsCountByDriver" resultType="java.util.Map" parameterType="java.util.Map">
         select tabA.total + tabB.total as waitTotal,
                tabC.total                 departureTotal,
                tabD.total                 executeTotal,
@@ -294,7 +294,14 @@
                 and lo.del_flag = 0
                 and loc.status = 0
                 and loc.w_order_id is null
-                and loc.driver_id = #{driverId, jdbcType=BIGINT}) tabA
+                and loc.driver_id = #{driverId, jdbcType=BIGINT}
+                <if test="specialEntIds != null and specialEntIds.size() > 0">
+                    and loc.ent_id in
+                    <foreach collection="specialEntIds" item="item" open="(" close=")" separator=",">
+                        #{item,jdbcType=BIGINT}
+                    </foreach>
+                </if>
+                ) tabA
                  left join
              (SELECT count(1) total,
                      0        indexNum
@@ -303,7 +310,14 @@
               where wo.del_flag = 0
                 and lo.del_flag = 0
                 and wo.status = 1
-                and wo.driver_id = #{driverId, jdbcType=BIGINT}) tabB on tabB.indexNum = tabA.indexNum
+                and wo.driver_id = #{driverId, jdbcType=BIGINT}
+                <if test="specialEntIds != null and specialEntIds.size() > 0">
+                    and wo.ent_id in
+                    <foreach collection="specialEntIds" item="item" open="(" close=")" separator=",">
+                        #{item,jdbcType=BIGINT}
+                    </foreach>
+                </if>
+                ) tabB on tabB.indexNum = tabA.indexNum
                  left join
              (SELECT count(1) total,
                      0        indexNum
@@ -312,7 +326,14 @@
               where wo.del_flag = 0
                 and lo.del_flag = 0
                 and wo.status = 2
-                and wo.driver_id = #{driverId, jdbcType=BIGINT}) tabC on tabC.indexNum = tabA.indexNum
+                and wo.driver_id = #{driverId, jdbcType=BIGINT}
+                <if test="specialEntIds != null and specialEntIds.size() > 0">
+                    and wo.ent_id in
+                    <foreach collection="specialEntIds" item="item" open="(" close=")" separator=",">
+                        #{item,jdbcType=BIGINT}
+                    </foreach>
+                </if>
+                ) tabC on tabC.indexNum = tabA.indexNum
                  left join
              (SELECT count(1) total,
                      0        indexNum
@@ -321,7 +342,14 @@
               where wo.del_flag = 0
                 and lo.del_flag = 0
                 and wo.status in (3, 4, 5, 6)
-                and wo.driver_id = #{driverId, jdbcType=BIGINT}) tabD on tabD.indexNum = tabA.indexNum
+                and wo.driver_id = #{driverId, jdbcType=BIGINT}
+                <if test="specialEntIds != null and specialEntIds.size() > 0">
+                    and wo.ent_id in
+                    <foreach collection="specialEntIds" item="item" open="(" close=")" separator=",">
+                        #{item,jdbcType=BIGINT}
+                    </foreach>
+                </if>
+                ) tabD on tabD.indexNum = tabA.indexNum
                  left join
              (SELECT count(1) total,
                      0        indexNum
@@ -330,7 +358,14 @@
               where wo.del_flag = 0
                 and lo.del_flag = 0
                 and wo.status in (7, 8, 9, 10, 12, 13)
-                and wo.driver_id = #{driverId, jdbcType=BIGINT}) tabE on tabE.indexNum = tabA.indexNum
+                and wo.driver_id = #{driverId, jdbcType=BIGINT}
+                <if test="specialEntIds != null and specialEntIds.size() > 0">
+                    and wo.ent_id in
+                    <foreach collection="specialEntIds" item="item" open="(" close=")" separator=",">
+                        #{item,jdbcType=BIGINT}
+                    </foreach>
+                </if>
+            ) tabE on tabE.indexNum = tabA.indexNum
     </select>
 
     <select id="findStatisticsSumByDriver" resultType="java.util.Map" parameterType="java.util.Map">
@@ -356,6 +391,12 @@
         <if test="endTime != null and endTime != ''">
             and DATE(wo.create_time) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
         </if>
+        <if test="specialEntIds != null and specialEntIds.size() > 0">
+            and wo.ent_id in
+            <foreach collection="specialEntIds" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+        </if>
     </select>
 
     <select id="deficitLossAmountByDriver" parameterType="java.util.Map">
@@ -391,6 +432,12 @@
                 <if test="endTime != null and endTime != ''">
                     and DATE(wo.create_time) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
                 </if>
+                <if test="specialEntIds != null and specialEntIds.size() > 0">
+                    and wo.ent_id in
+                    <foreach collection="specialEntIds" item="item" open="(" close=")" separator=",">
+                        #{item,jdbcType=BIGINT}
+                    </foreach>
+                </if>
             ) tab
         ) tab1
     </select>
@@ -436,6 +483,12 @@
                 and lo.del_flag = 0
                 and wo.status = 1
                 and wo.driver_id = #{driverId, jdbcType=BIGINT}
+                <if test="specialEntIds != null and specialEntIds.size() > 0">
+                    and wo.ent_id in
+                    <foreach collection="specialEntIds" item="item" open="(" close=")" separator=",">
+                        #{item,jdbcType=BIGINT}
+                    </foreach>
+                </if>
               UNION
               SELECT loc.id              wOrderId,
                      null                wOrderNo,
@@ -476,6 +529,12 @@
                 and loc.status = 0
                 and loc.w_order_id is null
                 and loc.driver_id = #{driverId, jdbcType=BIGINT}
+                <if test="specialEntIds != null and specialEntIds.size() > 0">
+                    and loc.ent_id in
+                    <foreach collection="specialEntIds" item="item" open="(" close=")" separator=",">
+                        #{item,jdbcType=BIGINT}
+                    </foreach>
+                </if>
         ) tab
         order by startTime
     </select>
@@ -518,7 +577,6 @@
         <if test="endTime != null and endTime != ''">
             and DATE(wo.create_time) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
         </if>
-
         <if test="busStatus != null and busStatus == 2">
             ORDER BY wo.start_time
         </if>