瀏覽代碼

Merge branch 'dev' of http://git.sckaiwu.cn/17358629955/sckw-service-platform into dev

chenlin 2 年之前
父節點
當前提交
e5221487fe

+ 5 - 0
sckw-modules/sckw-operation/src/main/java/com/sckw/operation/model/vo/req/BannerQueryReqVo.java

@@ -52,4 +52,9 @@ public class BannerQueryReqVo extends PageRequest implements Serializable {
      */
     private String Keywords;
 
+    /**
+     * 搜索
+     */
+    private Integer district;
+
 }

+ 2 - 2
sckw-modules/sckw-operation/src/main/java/com/sckw/operation/service/BannerService.java

@@ -76,7 +76,7 @@ public class BannerService {
      */
     private List<KwoBanner> findList(BannerQueryReqVo reqVo) {
         LambdaQueryWrapper<KwoBanner> wrapper = new LambdaQueryWrapper<>();
-        if(Objects.isNull(reqVo.getStatus()))
+        if(Objects.nonNull(reqVo.getDistrict()))
         {
             reqVo.setStatus(1);
         }
@@ -85,7 +85,7 @@ public class BannerService {
                 and(StringUtils.isNotBlank(reqVo.getKeywords()),
                         wq -> wq.like(KwoBanner::getUrl, reqVo.getKeywords()).or().
                                 like(KwoBanner::getClientType, reqVo.getKeywords())).
-                orderByDesc(KwoBanner::getUpdateTime);
+                orderByDesc(KwoBanner::getDistrict,KwoBanner::getSort);
 
         if (Objects.nonNull(reqVo.getStartTime())) {
             wrapper.ge(KwoBanner::getStartTime, reqVo.getStartTime());

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

@@ -771,7 +771,19 @@ public class KwoTradeOrderService {
                 .setPrice(param.getPrice()).setTrading(param.getTrading()).setPickupType(param.getPickupType())
                 .setDeliveryType(param.getDeliveryType()).setStartTime(param.getStartTime()).setEndTime(param.getEndTime())
                 .setRemark(param.getRemark());
-        kwoTradeOrderMapper.updateById(order);
+        LambdaUpdateWrapper<KwoTradeOrder> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.set(KwoTradeOrder::getAmount, order.getAmount())
+                .set(KwoTradeOrder::getUnit, order.getUnit())
+                .set(KwoTradeOrder::getPrice, order.getPrice())
+                .set(KwoTradeOrder::getTrading, order.getTrading())
+                .set(KwoTradeOrder::getPickupType, order.getPickupType())
+                .set(KwoTradeOrder::getDeliveryType, order.getDeliveryType())
+                .set(KwoTradeOrder::getStartTime, order.getStartTime())
+                .set(KwoTradeOrder::getEndTime, order.getEndTime())
+                .set(KwoTradeOrder::getRemark, order.getRemark())
+                .set(KwoTradeOrder::getStatus, order.getStatus())
+                .eq(KwoTradeOrder::getId, order.getId());
+        kwoTradeOrderMapper.update(null, wrapper);
         ValetOrderParam valetOrderParam = BeanUtils.copyProperties(param, ValetOrderParam.class);
 
         addOtherOrderInfo(order, valetOrderParam, true);

+ 19 - 2
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTransportDemandService.java

@@ -145,8 +145,25 @@ public class KwoTransportDemandService {
         if (Objects.isNull(demand)) {
             throw new BusinessException("数据不存在!");
         }
-        BeanUtils.copyProperties(param, demand);
-        kwoTransportDemandMapper.updateById(demand);
+        LambdaUpdateWrapper<KwoTransportDemand> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.set(KwoTransportDemand::getName, param.getName())
+                .set(KwoTransportDemand::getGoodsType, param.getGoodsType())
+                .set(KwoTransportDemand::getSpec, param.getSpec())
+                .set(KwoTransportDemand::getTrading, param.getTrading())
+                .set(KwoTransportDemand::getPrice, param.getPrice())
+                .set(KwoTransportDemand::getAmount, param.getAmount())
+                .set(KwoTransportDemand::getDeadline, param.getDeadline())
+                .set(KwoTransportDemand::getContacts, param.getContacts())
+                .set(KwoTransportDemand::getPhone, param.getPhone())
+                .set(KwoTransportDemand::getLoadAreaCode, param.getLoadAreaCode())
+                .set(KwoTransportDemand::getLoadAreaName, param.getLoadAreaName())
+                .set(KwoTransportDemand::getLoadDetailAddress, param.getLoadDetailAddress())
+                .set(KwoTransportDemand::getUnloadAreaCode, param.getUnloadAreaCode())
+                .set(KwoTransportDemand::getUnloadAreaName, param.getUnloadAreaName())
+                .set(KwoTransportDemand::getUnloadDetailAddress, param.getUnloadDetailAddress())
+                .set(KwoTransportDemand::getRemark, param.getRemark())
+                .eq(KwoTransportDemand::getId, param.getId());
+        kwoTransportDemandMapper.update(null, wrapper);
     }
 
     /**

+ 11 - 2
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwpWantBuyService.java

@@ -420,8 +420,17 @@ public class KwpWantBuyService {
             throw new BusinessException("求购信息不存在");
         }
         //1.更新求购信息
-        BeanUtils.copyProperties(param, kwoWantBuy);
-        kwpWantBuyMapper.updateById(kwoWantBuy);
+        LambdaUpdateWrapper<KwoWantBuy> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.set(KwoWantBuy::getName, param.getName())
+                .set(KwoWantBuy::getGoodsType, param.getGoodsType())
+                .set(KwoWantBuy::getSpec, param.getSpec())
+                .set(KwoWantBuy::getPrice, param.getPrice())
+                .set(KwoWantBuy::getAmount, param.getAmount())
+                .set(KwoWantBuy::getContacts, param.getContacts())
+                .set(KwoWantBuy::getPhone, param.getPhone())
+                .set(KwoWantBuy::getRemark, param.getRemark())
+                .eq(KwoWantBuy::getId, param.getId());
+        kwpWantBuyMapper.update(null, wrapper);
         //2.更新求购地址信息
         kwoWantBuyAddressService.delAddressByWantBuyIds(List.of(id));
         if (Objects.nonNull(param.getAddressInfo())) {

+ 20 - 3
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerLogisticsMapper.java

@@ -30,7 +30,7 @@ public interface KwpLedgerLogisticsMapper extends BaseMapper<KwpLedgerLogistics>
      * @param logisticsReq
      * @return
      */
-    List<LedgerShipperDto> shipperSelect(@Param("logisticsReq") LogisticsReq logisticsReq);
+    List<LedgerShipperDto> shipperSelect(@Param("logisticsReq") LogisticsReq logisticsReq, @Param("authList") List<Long> authList);
 
     /**
      * 运营端
@@ -46,7 +46,7 @@ public interface KwpLedgerLogisticsMapper extends BaseMapper<KwpLedgerLogistics>
      * @param logisticsReq
      * @return
      */
-    List<LedgerCarrierDto> carrierSelect(@Param("logisticsReq") LogisticsReq logisticsReq);
+    List<LedgerCarrierDto> carrierSelect(@Param("logisticsReq") LogisticsReq logisticsReq, @Param("authList") List<Long> authList);
 
     /**
      * 统计订单数量
@@ -56,6 +56,23 @@ public interface KwpLedgerLogisticsMapper extends BaseMapper<KwpLedgerLogistics>
      */
     Map<String, Long> countOrder(@Param("logisticsReq") LogisticsReq logisticsReq);
 
+    /**
+     * 承运方统计订单数量
+     *
+     * @param logisticsReq
+     * @return
+     */
+    Map<String, Long> countSendOrder(@Param("logisticsReq") LogisticsReq logisticsReq, @Param("authList") List<Long> authList);
+
+    /**
+     * 托运方统计订单数量
+     *
+     * @param logisticsReq
+     * @param authList
+     * @return
+     */
+    Map<String, Long> countAuditOrder(@Param("logisticsReq") LogisticsReq logisticsReq, @Param("authList") List<Long> authList);
+
     /**
      * 运营端统计
      *
@@ -124,5 +141,5 @@ public interface KwpLedgerLogisticsMapper extends BaseMapper<KwpLedgerLogistics>
      * @param idList
      * @return
      */
-    List<LedgerLogisticsDto> exportList(@Param("logisticsReq") LogisticsReq logisticsReq, @Param("idList") List<Long> idList);
+    List<LedgerLogisticsDto> exportList(@Param("logisticsReq") LogisticsReq logisticsReq, @Param("idList") List<Long> idList, @Param("authList") List<Long> authList);
 }

+ 8 - 3
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerTradeMapper.java

@@ -23,7 +23,7 @@ import java.util.Map;
 @Mapper
 public interface KwpLedgerTradeMapper extends BaseMapper<KwpLedgerTrade> {
 
-    List<LedgerSellDto> sellList(@Param("tradeReq") TradeReq tradeReq);
+    List<LedgerSellDto> sellList(@Param("tradeReq") TradeReq tradeReq, @Param("authList") List<Long> authList);
 
     /**
      * 运营端 对账列表数据
@@ -40,7 +40,7 @@ public interface KwpLedgerTradeMapper extends BaseMapper<KwpLedgerTrade> {
      * @return
      */
 
-    List<LedgerPurchaseDto> purchaseList(@Param("tradeReq") TradeReq tradeReq);
+    List<LedgerPurchaseDto> purchaseList(@Param("tradeReq") TradeReq tradeReq, @Param("authList") List<Long> authList);
 
     /**
      * 统计对账单数量
@@ -50,6 +50,10 @@ public interface KwpLedgerTradeMapper extends BaseMapper<KwpLedgerTrade> {
      */
     Map<String, Long> countOrder(@Param("tradeReq") TradeReq tradeReq);
 
+    Map<String, Long> countSellOrder(@Param("tradeReq") TradeReq tradeReq, @Param("authList") List<Long> authList);
+
+    Map<String, Long> countPurchaseOrder(@Param("tradeReq") TradeReq tradeReq, @Param("authList") List<Long> authList);
+
     /**
      * 运营端统计对账单数量
      *
@@ -72,6 +76,7 @@ public interface KwpLedgerTradeMapper extends BaseMapper<KwpLedgerTrade> {
      * @return
      */
     Long countSum(@Param("tradeReq") TradeReq tradeReq, @Param("status") List<Integer> status);
+
     /**
      * app端对账统计
      *
@@ -100,5 +105,5 @@ public interface KwpLedgerTradeMapper extends BaseMapper<KwpLedgerTrade> {
      */
     List<LedgerSell> selectIds(@Param("ids") List<Long> ids);
 
-    List<LedgerTradeDto> exportList(@Param("tradeReq") TradeReq tradeReq, @Param("idList") List<Long> idList);
+    List<LedgerTradeDto> exportList(@Param("tradeReq") TradeReq tradeReq, @Param("idList") List<Long> idList, @Param("authList") List<Long> authList);
 }

+ 7 - 2
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/KwpLedgerLogisticsUnit.java

@@ -16,8 +16,8 @@ import java.time.LocalDateTime;
  */
 
 /**
-    * 物流对账单托运方或承运方企业信息
-    */
+ * 物流对账单托运方或承运方企业信息
+ */
 @Getter
 @Setter
 @ToString
@@ -70,6 +70,11 @@ public class KwpLedgerLogisticsUnit {
      */
     @TableField(value = "contacts")
     private String contacts;
+    /**
+     * 联系人ID
+     */
+    @TableField(value = "contacts_id")
+    private Long contactsId;
 
     /**
      * 联系电话

+ 5 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/KwpLedgerTradeUnit.java

@@ -67,6 +67,11 @@ public class KwpLedgerTradeUnit {
      */
     @TableField(value = "contacts")
     private String contacts;
+    /**
+     * 联系人ID
+     */
+    @TableField(value = "contacts_id")
+    private Long contactsId;
 
     /**
      * 联系电话

+ 13 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerLogisticsService.java

@@ -122,7 +122,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         logisticsReq.setUnitType(LogisticsUnitType.CARRIER);
         logisticsReq.setUnitTypeTwo(LogisticsUnitType.SHIPPER);
         PageHelper.startPage(logisticsReq.getPage(), logisticsReq.getPageSize());
-        List<LedgerShipperDto> kwpLedgerLogisticsList = logisticsMapper.shipperSelect(logisticsReq);
+        List<LedgerShipperDto> kwpLedgerLogisticsList = logisticsMapper.shipperSelect(logisticsReq, LoginUserHolder.getAuthUserIdList());
         PageInfo<ILedger> ledgerShipperDtoPageInfo = new PageInfo<>(kwpLedgerLogisticsList);
         //字典转换
         if (!CollectionUtils.isEmpty(kwpLedgerLogisticsList)) {
@@ -156,7 +156,8 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         logisticsReq.setUnitType(LogisticsUnitType.SHIPPER);
         logisticsReq.setUnitTypeTwo(LogisticsUnitType.CARRIER);
         PageHelper.startPage(logisticsReq.getPage(), logisticsReq.getPageSize());
-        List<LedgerCarrierDto> kwpLedgerLogisticsList = logisticsMapper.carrierSelect(logisticsReq);
+        List<Long> authUserIdList = LoginUserHolder.getAuthUserIdList();
+        List<LedgerCarrierDto> kwpLedgerLogisticsList = logisticsMapper.carrierSelect(logisticsReq, authUserIdList);
         PageInfo<ILedger> ledgerShipperDtoPageInfo = new PageInfo<>(kwpLedgerLogisticsList);
         //字典转换
         if (!CollectionUtils.isEmpty(kwpLedgerLogisticsList)) {
@@ -333,6 +334,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         kwpLedgerLogisticsUnit.setTopEntId(entCacheResDto.getId());
         kwpLedgerLogisticsUnit.setFirmName(entCacheResDto.getFirmName());
         kwpLedgerLogisticsUnit.setContacts(entCacheResDto.getContacts());
+        kwpLedgerLogisticsUnit.setContactsId(entCacheResDto.getContactsId());
         kwpLedgerLogisticsUnit.setPhone(entCacheResDto.getPhone());
         kwpLedgerLogisticsUnit.setRemark(Global.EMPTY_STRING);
         kwpLedgerLogisticsUnit.setStatus(NumberConstant.ZERO);
@@ -360,6 +362,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         carrierUnit.setTopEntId(entCacheResDto1.getId());
         carrierUnit.setFirmName(entCacheResDto1.getFirmName());
         carrierUnit.setContacts(entCacheResDto1.getContacts());
+        carrierUnit.setContactsId(entCacheResDto1.getContactsId());
         carrierUnit.setPhone(entCacheResDto1.getPhone());
         carrierUnit.setRemark(Global.EMPTY_STRING);
         carrierUnit.setStatus(NumberConstant.ZERO);
@@ -647,7 +650,13 @@ public class KwpLedgerLogisticsService extends AbsLedger {
      */
     public List<TableTop> orderCount(LogisticsReq logisticsReq) {
         logisticsReq.setEntId(LoginUserHolder.getEntId());
-        Map<String, Long> map = logisticsMapper.countOrder(logisticsReq);
+        Map<String, Long> map;
+        List<Long> authUserIdList = LoginUserHolder.getAuthUserIdList();
+        if (Objects.equals(logisticsReq.getUnitType(), LogisticsUnitType.SHIPPER)) {
+            map = logisticsMapper.countSendOrder(logisticsReq, authUserIdList);
+        } else {
+            map = logisticsMapper.countAuditOrder(logisticsReq, authUserIdList);
+        }
         TableTop ledgerCountVo;
         /*统计数据转换*/
         List<TableTop> res = new ArrayList<>();
@@ -804,7 +813,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
 
     public List<LedgerLogisticsDto> exportList(LogisticsReq logisticsReq, List<Long> idList) {
         fillPara(logisticsReq);
-        List<LedgerLogisticsDto> ledgerLogisticsDtos = logisticsMapper.exportList(logisticsReq, idList);
+        List<LedgerLogisticsDto> ledgerLogisticsDtos = logisticsMapper.exportList(logisticsReq, idList, LoginUserHolder.getAuthUserIdList());
         changeDict(ledgerLogisticsDtos);
         return ledgerLogisticsDtos;
     }

+ 13 - 8
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerTradeService.java

@@ -18,10 +18,7 @@ import com.sckw.order.api.dubbo.TradeOrderInfoService;
 import com.sckw.order.api.model.*;
 import com.sckw.payment.dao.KwpLedgerTradeMapper;
 import com.sckw.payment.model.*;
-import com.sckw.payment.model.constant.LedgerEnum;
-import com.sckw.payment.model.constant.SettlementEnum;
-import com.sckw.payment.model.constant.TradeUnitType;
-import com.sckw.payment.model.constant.TradingEnum;
+import com.sckw.payment.model.constant.*;
 import com.sckw.payment.model.dto.*;
 import com.sckw.payment.model.vo.req.*;
 import com.sckw.payment.model.vo.res.LedgerCountSumVo;
@@ -128,7 +125,7 @@ public class KwpLedgerTradeService extends AbsLedger {
         }
         tradeReq.setUnitType(TradeUnitType.PURCHASE);
         tradeReq.setUnitTypeTwo(TradeUnitType.SELL);
-        List<LedgerSellDto> ledgerTradeDto = tradeMapper.sellList(tradeReq);
+        List<LedgerSellDto> ledgerTradeDto = tradeMapper.sellList(tradeReq, LoginUserHolder.getAuthUserIdList());
         //字典转换
         if (!CollectionUtils.isEmpty(ledgerTradeDto)) {
             changeDict(ledgerTradeDto);
@@ -167,7 +164,7 @@ public class KwpLedgerTradeService extends AbsLedger {
         }
         tradeReq.setUnitType(TradeUnitType.SELL);
         tradeReq.setUnitTypeTwo(TradeUnitType.PURCHASE);
-        List<LedgerPurchaseDto> ledgerTradeDto = tradeMapper.purchaseList(tradeReq);
+        List<LedgerPurchaseDto> ledgerTradeDto = tradeMapper.purchaseList(tradeReq, LoginUserHolder.getAuthUserIdList());
         //字典转换
         if (!CollectionUtils.isEmpty(ledgerTradeDto)) {
             changeDict(ledgerTradeDto);
@@ -317,6 +314,7 @@ public class KwpLedgerTradeService extends AbsLedger {
         kwpLedgerTradeUnit.setTopEntId(entCacheResDto.getId());
         kwpLedgerTradeUnit.setFirmName(entCacheResDto.getFirmName());
         kwpLedgerTradeUnit.setContacts(entCacheResDto.getContacts());
+        kwpLedgerTradeUnit.setContactsId(entCacheResDto.getContactsId());
         kwpLedgerTradeUnit.setPhone(entCacheResDto.getPhone());
         kwpLedgerTradeUnit.setRemark(Global.EMPTY_STRING);
         kwpLedgerTradeUnit.setStatus(NumberConstant.ZERO);
@@ -343,6 +341,7 @@ public class KwpLedgerTradeService extends AbsLedger {
         sellLedgerTradeUnit.setTopEntId(entCacheResDto1.getId());
         sellLedgerTradeUnit.setFirmName(entCacheResDto1.getFirmName());
         sellLedgerTradeUnit.setContacts(entCacheResDto1.getContacts());
+        sellLedgerTradeUnit.setContactsId(entCacheResDto1.getContactsId());
         sellLedgerTradeUnit.setPhone(entCacheResDto1.getPhone());
         sellLedgerTradeUnit.setRemark(Global.EMPTY_STRING);
         sellLedgerTradeUnit.setStatus(NumberConstant.ZERO);
@@ -678,7 +677,13 @@ public class KwpLedgerTradeService extends AbsLedger {
      */
     public List<TableTop> orderCount(TradeReq tradeReq) {
         tradeReq.setEntId(LoginUserHolder.getEntId());
-        Map<String, Long> map = tradeMapper.countOrder(tradeReq);
+        Map<String, Long> map;
+        List<Long> authUserIdList = LoginUserHolder.getAuthUserIdList();
+        if (Objects.equals(tradeReq.getUnitTypeTwo(), TradeUnitType.SELL)) {
+            map = tradeMapper.countSellOrder(tradeReq, authUserIdList);
+        } else {
+            map = tradeMapper.countPurchaseOrder(tradeReq, authUserIdList);
+        }
         TableTop ledgerCountVo;
         List<TableTop> res = new ArrayList<>();
         for (LedgerEnum value : LedgerEnum.values()) {
@@ -912,7 +917,7 @@ public class KwpLedgerTradeService extends AbsLedger {
 
     public List<LedgerTradeDto> exportList(TradeReq tradeReq, List<Long> idList) {
         fillPara(tradeReq);
-        List<LedgerTradeDto> ledgerTradeDtos = tradeMapper.exportList(tradeReq, idList);
+        List<LedgerTradeDto> ledgerTradeDtos = tradeMapper.exportList(tradeReq, idList, LoginUserHolder.getAuthUserIdList());
         changeDict(ledgerTradeDtos);
         return ledgerTradeDtos;
     }

+ 225 - 16
sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerLogisticsMapper.xml

@@ -147,6 +147,31 @@
                         or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
                     )
             </if>
+            and (
+            case
+                when kll.status = 2 then
+                    true
+            when kll.status in (3, 4, 5) then
+            (
+            (
+                kllu2.contacts_id in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>)
+            or
+        (
+        select kllt.id
+        from kwp_ledger_logistics_track kllt where kllt.del_flag = 0
+                                               and kllt.l_ledger_id = kll.id
+                                               and kllt.status in (3, 5)
+                                               and kllt.create_by in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            )
+                )
+                end
+                )
         </where>
         order by kll.generate_time desc
     </select>
@@ -359,10 +384,145 @@
                         or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
                     )
             </if>
+            and (
+            case when kll.status in (1, 6)
+                then
+                kll.create_by in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            when kll.status in (2, 3, 4, 5) then
+            (
+                kll.create_by in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            or kllu2.contacts_id in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            )
+                end
+                )
         </where>
         order by kll.generate_time desc
     </select>
-
+    <!--对账发起方-->
+    <select id="countSendOrder" resultType="java.util.Map">
+        SELECT count(1)                           "0",
+               count(IF(kll.status = 1, 1, NULL)) "1",
+               count(IF(kll.status = 2, 1, NULL)) "2",
+               count(IF(kll.status = 3, 1, NULL)) "3",
+               count(IF(kll.status = 4, 1, NULL)) "4",
+               count(IF(kll.status = 5, 1, NULL)) "5",
+               count(IF(kll.status = 6, 1, NULL)) "6"
+        FROM kwp_ledger_logistics kll
+                 inner join kwp_ledger_logistics_unit kllu
+                            on kll.id = kllu.l_ledger_id and kllu.del_flag = 0 and
+                               kllu.unit_type = #{logisticsReq.unitType,jdbcType=INTEGER}
+                 inner join kwp_ledger_logistics_unit kllu2
+                            on kll.id = kllu2.l_ledger_id and kllu2.del_flag = 0 and
+                               kllu2.unit_type = #{logisticsReq.unitTypeTwo,jdbcType=INTEGER}
+        <where>
+            kll.del_flag = 0
+              and kllu2.top_ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
+            <if test="logisticsReq.trading != null">
+                and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
+            </if>
+            <if test="logisticsReq.startCreateTime != null and logisticsReq.startCreateTime != '' and logisticsReq.endCreateTime != null and logisticsReq.endCreateTime != ''">
+                and kll.generate_time between #{logisticsReq.startCreateTime,jdbcType=TIMESTAMP}
+                    and #{logisticsReq.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="logisticsReq.keywords != null and logisticsReq.keywords != ''">
+                and (
+                            kll.l_ledger_no like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kllu.firm_name like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                    )
+            </if>
+            and (
+            case when kll.status in (1, 6)
+                then
+                kll.create_by in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            when kll.status in (2, 3, 4, 5) then
+            (
+                kll.create_by in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            or kllu2.contacts_id in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            )
+                end
+                )
+        </where>
+    </select>
+    <!--对账审核方-->
+    <select id="countAuditOrder" resultType="java.util.Map">
+        SELECT count(1)                           "0",
+               count(IF(kll.status = 1, 1, NULL)) "1",
+               count(IF(kll.status = 2, 1, NULL)) "2",
+               count(IF(kll.status = 3, 1, NULL)) "3",
+               count(IF(kll.status = 4, 1, NULL)) "4",
+               count(IF(kll.status = 5, 1, NULL)) "5",
+               count(IF(kll.status = 6, 1, NULL)) "6"
+        FROM kwp_ledger_logistics kll
+                 inner join kwp_ledger_logistics_unit kllu
+                            on kll.id = kllu.l_ledger_id and kllu.del_flag = 0 and
+                               kllu.unit_type = #{logisticsReq.unitType,jdbcType=INTEGER}
+                 inner join kwp_ledger_logistics_unit kllu2
+                            on kll.id = kllu2.l_ledger_id and kllu2.del_flag = 0 and
+                               kllu2.unit_type = #{logisticsReq.unitTypeTwo,jdbcType=INTEGER}
+        <where>
+            kll.del_flag = 0
+              and kllu2.top_ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
+              and kll.status not in (1, 6)
+            <if test="logisticsReq.trading != null">
+                and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
+            </if>
+            <if test="logisticsReq.startCreateTime != null and logisticsReq.startCreateTime != '' and logisticsReq.endCreateTime != null and logisticsReq.endCreateTime != ''">
+                and kll.generate_time between #{logisticsReq.startCreateTime,jdbcType=TIMESTAMP}
+                    and #{logisticsReq.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="logisticsReq.keywords != null and logisticsReq.keywords != ''">
+                and (
+                            kll.l_ledger_no like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kllu.firm_name like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                    )
+            </if>
+            and (
+            case
+                when kll.status = 2 then
+                    true
+            when kll.status in (3, 4, 5) then
+            (
+            (
+                kllu2.contacts_id in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>)
+            or
+        (
+        select kllt.id
+        from kwp_ledger_logistics_track kllt where kllt.del_flag = 0
+                                               and kllt.l_ledger_id = kll.id
+                                               and kllt.status in (3, 5)
+                                               and kllt.create_by in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            )
+                )
+                end
+                )
+        </where>
+    </select>
     <select id="countOrder" resultType="java.util.Map">
         SELECT count(1)                           "0",
                count(IF(kll.status = 1, 1, NULL)) "1",
@@ -507,31 +667,31 @@
 
     <select id="exportList" resultType="com.sckw.payment.model.dto.LedgerLogisticsDto">
         select kll.id,
-               kll.l_ledger_no                  lLedgerNo,
+               kll.l_ledger_no                     lLedgerNo,
                kll.name,
-               kll.start_time                   startTime,
-               kll.end_time                     endTime,
-               kll.tax_rate                     taxRate,
+               kll.start_time                      startTime,
+               kll.end_time                        endTime,
+               kll.tax_rate                        taxRate,
                kll.trading,
-               kll.total_price                  totalPrice,
-               kll.ex_tax_price                 exTaxPrice,
-               kll.settle_price                 settlePrice,
-               kll.actual_price                 actualPrice,
+               kll.total_price                     totalPrice,
+               kll.ex_tax_price                    exTaxPrice,
+               kll.settle_price                    settlePrice,
+               kll.actual_price                    actualPrice,
                kll.url,
-               kll.generate_time                generateTime,
-               kll.receipt_time                 receiptTime,
+               kll.generate_time                   generateTime,
+               kll.receipt_time                    receiptTime,
                kll.remark,
                kll.status,
-               kll.create_by                    createBy,
-               kllu.top_ent_id                  checkEntId,
+               kll.create_by                       createBy,
+               kllu.top_ent_id                     checkEntId,
                (case
                     when #{logisticsReq.unitType,jdbcType=INTEGER} = 1 then kll.audit_user
-                    else kll.success_user end) as contacts,
+                    else kll.success_user end)  as contacts,
                (case
                     when #{logisticsReq.unitType,jdbcType=INTEGER} = 1 then kll.audit_phone
                     else kll.success_phone end) as phone,
-               kllu.firm_name                   firmName,
-               kll.order_count                  orderCount
+               kllu.firm_name                      firmName,
+               kll.order_count                     orderCount
         from kwp_ledger_logistics kll
                  inner join kwp_ledger_logistics_unit kllu
                             on kll.id = kllu.l_ledger_id and kllu.del_flag = 0 and
@@ -567,6 +727,55 @@
                                 or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
                             )
                     </if>
+                    <if test="logisticsReq.unitType == 1">
+                        and (
+                        case when kll.status in (1, 6)
+                            then
+                            kll.create_by in
+                        <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                            #{item,jdbcType=BIGINT}
+                        </foreach>
+                        when kll.status in (2, 3, 4, 5) then
+                        (
+                            kll.create_by in
+                        <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                            #{item,jdbcType=BIGINT}
+                        </foreach>
+                        or kllu2.contacts_id in
+                        <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                            #{item,jdbcType=BIGINT}
+                        </foreach>
+                        )
+                            end
+                            )
+                    </if>
+                    <if test="logisticsReq.unitType == 2">
+                        and (
+                        case
+                            when kll.status = 2 then
+                                true
+                        when kll.status in (3, 4, 5) then
+                        (
+                        (
+                            kllu2.contacts_id in
+                        <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                            #{item,jdbcType=BIGINT}
+                        </foreach>)
+                        or
+                    (
+                    select kllt.id
+                    from kwp_ledger_logistics_track kllt where kllt.del_flag = 0
+                                                           and kllt.l_ledger_id = kll.id
+                                                           and kllt.status in (3, 5)
+                                                           and kllt.create_by in
+                        <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                            #{item,jdbcType=BIGINT}
+                        </foreach>
+                        )
+                            )
+                            end
+                            )
+                    </if>
                 </otherwise>
             </choose>
         </where>

+ 226 - 0
sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerTradeMapper.xml

@@ -149,6 +149,26 @@
                         , '%')
                     )
             </if>
+            and (
+            case when klt.status in (1, 6)
+            then
+            klt.create_by in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            when klt.status in (2, 3, 4, 5) then
+            (
+            klt.create_by in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            or kltu2.contacts_id in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            )
+            end
+            )
         </where>
         order by klt.generate_time desc
     </select>
@@ -299,6 +319,31 @@
                         , '%')
                     )
             </if>
+            and (
+            case
+                when klt.status = 2 then
+                    true
+            when klt.status in (3, 4, 5) then
+            (
+            (
+                kltu2.contacts_id in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>)
+            or
+        (
+        select kllt.id
+        from kwp_ledger_logistics_track kllt where kllt.del_flag = 0
+                                               and kllt.l_ledger_id = klt.id
+                                               and kllt.status in (3, 5)
+                                               and kllt.create_by in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            )
+                )
+                end
+                )
         </where>
         order by klt.generate_time desc
     </select>
@@ -438,6 +483,138 @@
             </if>
         </where>
     </select>
+    <select id="countSellOrder" resultType="java.util.Map">
+        SELECT count(1)                           "0",
+               count(IF(klt.status = 1, 1, NULL)) "1",
+               count(IF(klt.status = 2, 1, NULL)) "2",
+               count(IF(klt.status = 3, 1, NULL)) "3",
+               count(IF(klt.status = 4, 1, NULL)) "4",
+               count(IF(klt.status = 5, 1, NULL)) "5",
+               count(IF(klt.status = 6, 1, NULL)) "6"
+        from kwp_ledger_trade klt
+                 inner join kwp_ledger_trade_unit kltu
+                            on klt.id = kltu.t_ledger_id and kltu.del_flag = 0 and
+                               kltu.unit_type = #{tradeReq.unitType,jdbcType=INTEGER}
+                 inner join kwp_ledger_trade_unit kltu2
+                            on klt.id = kltu2.t_ledger_id and kltu2.del_flag = 0 and kltu2.unit_type =
+                                                                                     #{tradeReq.unitTypeTwo,jdbcType=INTEGER}
+        <where>
+            klt.del_flag = 0
+              and kltu2.top_ent_id = #{tradeReq.entId,jdbcType=BIGINT}
+            <if test="tradeReq.unitType != null and tradeReq.unitType == 2">
+                and klt.status not in (1, 6)
+            </if>
+            <if test="tradeReq.trading != null">
+                and klt.trading = #{tradeReq.trading,jdbcType=INTEGER}
+            </if>
+            <if test="tradeReq.endCreateTime != null and tradeReq.endCreateTime != '' and tradeReq.startCreateTime != null and tradeReq.startCreateTime != ''">
+                and klt.generate_time between #{tradeReq.startCreateTime,jdbcType=TIMESTAMP}
+                    and #{tradeReq.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="tradeReq.keywords != null and tradeReq.keywords != ''">
+                and (
+                            klt.t_ledger_no like concat('%'
+                            , #{tradeReq.keywords,jdbcType=VARCHAR}
+                            , '%')
+                        or kltu.firm_name like concat('%'
+                        , #{tradeReq.keywords,jdbcType=VARCHAR}
+                        , '%')
+                        or kltu.contacts like concat('%'
+                        , #{tradeReq.keywords,jdbcType=VARCHAR}
+                        , '%')
+                    )
+            </if>
+            and (
+            case when klt.status in (1, 6)
+            then
+            klt.create_by in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            when klt.status in (2, 3, 4, 5) then
+            (
+            klt.create_by in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            or kltu2.contacts_id in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            )
+            end
+            )
+        </where>
+    </select>
+    <select id="countPurchaseOrder" resultType="java.util.Map">
+        SELECT count(1)                           "0",
+               count(IF(klt.status = 1, 1, NULL)) "1",
+               count(IF(klt.status = 2, 1, NULL)) "2",
+               count(IF(klt.status = 3, 1, NULL)) "3",
+               count(IF(klt.status = 4, 1, NULL)) "4",
+               count(IF(klt.status = 5, 1, NULL)) "5",
+               count(IF(klt.status = 6, 1, NULL)) "6"
+        from kwp_ledger_trade klt
+                 inner join kwp_ledger_trade_unit kltu
+                            on klt.id = kltu.t_ledger_id and kltu.del_flag = 0 and
+                               kltu.unit_type = #{tradeReq.unitType,jdbcType=INTEGER}
+                 inner join kwp_ledger_trade_unit kltu2
+                            on klt.id = kltu2.t_ledger_id and kltu2.del_flag = 0 and kltu2.unit_type =
+                                                                                     #{tradeReq.unitTypeTwo,jdbcType=INTEGER}
+        <where>
+            klt.del_flag = 0
+              and kltu2.top_ent_id = #{tradeReq.entId,jdbcType=BIGINT}
+            <if test="tradeReq.unitType != null and tradeReq.unitType == 2">
+                and klt.status not in (1, 6)
+            </if>
+            <if test="tradeReq.trading != null">
+                and klt.trading = #{tradeReq.trading,jdbcType=INTEGER}
+            </if>
+            <if test="tradeReq.endCreateTime != null and tradeReq.endCreateTime != '' and tradeReq.startCreateTime != null and tradeReq.startCreateTime != ''">
+                and klt.generate_time between #{tradeReq.startCreateTime,jdbcType=TIMESTAMP}
+                    and #{tradeReq.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="tradeReq.keywords != null and tradeReq.keywords != ''">
+                and (
+                            klt.t_ledger_no like concat('%'
+                            , #{tradeReq.keywords,jdbcType=VARCHAR}
+                            , '%')
+                        or kltu.firm_name like concat('%'
+                        , #{tradeReq.keywords,jdbcType=VARCHAR}
+                        , '%')
+                        or kltu.contacts like concat('%'
+                        , #{tradeReq.keywords,jdbcType=VARCHAR}
+                        , '%')
+                    )
+            </if>
+            and (
+            case
+                when klt.status = 2 then
+                    true
+            when klt.status in (3, 4, 5) then
+            (
+            (
+                kltu2.contacts_id in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>)
+            or
+        (
+        select kllt.id
+        from kwp_ledger_logistics_track kllt where kllt.del_flag = 0
+                                               and kllt.l_ledger_id = klt.id
+                                               and kllt.status in (3, 5)
+                                               and kllt.create_by in
+            <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                #{item,jdbcType=BIGINT}
+            </foreach>
+            )
+                )
+                end
+                )
+        </where>
+    </select>
+
     <select id="countOrder2" resultType="java.util.Map">
         SELECT count(1)                                    "0",
                count(IF(kll_distinct.status = 1, 1, NULL)) "1",
@@ -676,6 +853,55 @@
                         , '%')
                         )
                     </if>
+                    <if test="tradeReq.unitType == 1">
+                        and (
+                        case when klt.status in (1, 6)
+                        then
+                        klt.create_by in
+                        <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                            #{item,jdbcType=BIGINT}
+                        </foreach>
+                        when klt.status in (2, 3, 4, 5) then
+                        (
+                        klt.create_by in
+                        <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                            #{item,jdbcType=BIGINT}
+                        </foreach>
+                        or kltu2.contacts_id in
+                        <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                            #{item,jdbcType=BIGINT}
+                        </foreach>
+                        )
+                        end
+                        )
+                    </if>
+                    <if test="tradeReq.unitType == 2">
+                        and (
+                        case
+                        when klt.status = 2 then
+                        true
+                        when klt.status in (3, 4, 5) then
+                        (
+                        (
+                        kltu2.contacts_id in
+                        <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                            #{item,jdbcType=BIGINT}
+                        </foreach>)
+                        or
+                        (
+                        select kllt.id
+                        from kwp_ledger_logistics_track kllt where kllt.del_flag = 0
+                        and kllt.l_ledger_id = klt.id
+                        and kllt.status in (3, 5)
+                        and kllt.create_by in
+                        <foreach collection="authList" item="item" open="(" close=")" separator=",">
+                            #{item,jdbcType=BIGINT}
+                        </foreach>
+                        )
+                        )
+                        end
+                        )
+                    </if>
                 </otherwise>
             </choose>
         </where>