فهرست منبع

机具回收功能优化

mac 2 سال پیش
والد
کامیت
3c64dcbad1
16فایلهای تغییر یافته به همراه129 افزوده شده و 89 حذف شده
  1. 1 1
      kxs-gateway/src/main/java/com/kxs/gateway/api/rabbit/RabbitDtsMethodQueueMQ.java
  2. 6 0
      kxs-product/kxs-product-api/src/main/java/com/kxs/product/api/dto/kxsapp/machine/RecycleMachineQuery.java
  3. 3 6
      kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/mapper/KxsMachineMapper.java
  4. 14 7
      kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/service/impl/KxsMachineServiceImpl.java
  5. 18 5
      kxs-product/kxs-product-biz/src/main/resources/mapper/KxsMachineMapper.xml
  6. 0 1
      kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/dto/kxsapp/storeRecycle/RecycleSubmitDTO.java
  7. 11 0
      kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/feign/RemoteKxsStoreService.java
  8. 6 0
      kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/model/KxsMachineRecycle.java
  9. 1 1
      kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/vo/kxsapp/store/StoreDataVO.java
  10. 2 2
      kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/vo/kxsapp/storeRecycle/StoreRecycleDataVO.java
  11. 8 8
      kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/controller/kxsapp/StoreRecycleController.java
  12. 3 10
      kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/mapper/KxsMachineRecycleMapper.java
  13. 4 2
      kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/service/KxsMachineRecycleService.java
  14. 41 23
      kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/service/impl/KxsMachineRecycleServiceImpl.java
  15. 4 1
      kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/service/impl/KxsWarehouseServiceImpl.java
  16. 7 22
      kxs-store/kxs-store-biz/src/main/resources/mapper/KxsMachineRecycleMapper.xml

+ 1 - 1
kxs-gateway/src/main/java/com/kxs/gateway/api/rabbit/RabbitDtsMethodQueueMQ.java

@@ -26,7 +26,7 @@ public class RabbitDtsMethodQueueMQ extends AbstractMQ {
 
 
     /**
-     * 订单交易队列
+     * 订单同步队列
      */
     public static final String QUEUE_NAME = "QUEUE_DTS_URL_DATA_DIVISION";
 

+ 6 - 0
kxs-product/kxs-product-api/src/main/java/com/kxs/product/api/dto/kxsapp/machine/RecycleMachineQuery.java

@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
 import java.time.LocalDateTime;
+import java.util.List;
 
 
 /**
@@ -40,5 +41,10 @@ public class RecycleMachineQuery {
      */
     private LocalDateTime endDay;
 
+    /**
+     * 回收中/已回收的机具排除查询
+     */
+    private List<String> sns;
+
 
 }

+ 3 - 6
kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/mapper/KxsMachineMapper.java

@@ -6,14 +6,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.kxs.product.api.dto.admin.machine.SysMachinePageDTO;
 import com.kxs.product.api.dto.kxsapp.GetActivityMachineByIdAndTimeDTO;
 import com.kxs.product.api.dto.kxsapp.machine.*;
-import com.kxs.product.api.dto.kxsapp.merchant.MerchantListDTO;
 import com.kxs.product.api.model.KxsMachine;
-import com.kxs.product.api.model.KxsMerchant;
 import com.kxs.product.api.vo.admin.machine.SysMachinePageVO;
 import com.kxs.product.api.vo.kxsapp.machine.*;
-import com.kxs.product.api.vo.kxsapp.merchant.MerchantListVO;
-import com.kxs.stat.api.dto.statUser.GetActivityStatByIdAndTimeDTO;
-import com.kxs.stat.api.vo.GetActivityStatByIdAndTimeVO;
 import com.kxs.system.api.vo.kxsapp.RecycleBrandListVO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -113,10 +108,12 @@ public interface KxsMachineMapper extends BaseMapper<KxsMachine> {
 
     /**
      * 可回收机具品牌列表
+     *
      * @param userId 用户id
+     * @param sns
      * @return 机具可回收列表
      */
-    List<RecycleBrandListVO> recycleBrandList(@Param("userId") Long userId, @Param("endDay") LocalDateTime endDay);
+    List<RecycleBrandListVO> recycleBrandList(@Param("userId") Long userId, @Param("endDay") LocalDateTime endDay, @Param("sns") List<String> sns);
 
     /**
      * 查询激活和绑定时间在指定区间的机具

+ 14 - 7
kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/service/impl/KxsMachineServiceImpl.java

@@ -34,6 +34,7 @@ import com.kxs.stat.api.vo.GetActivityStatByIdAndTimeVO;
 import com.kxs.store.api.dto.admin.machine.WarehouseSearchDTO;
 import com.kxs.store.api.feign.RemoteKxsStoreService;
 import com.kxs.store.api.feign.RemoteKxsWarehouseService;
+import com.kxs.store.api.model.KxsMachineRecycleInfo;
 import com.kxs.system.api.feign.RemoteOldService;
 import com.kxs.system.api.util.ParamResolver;
 import com.kxs.system.api.vo.kxsapp.RecycleBrandListVO;
@@ -235,6 +236,12 @@ public class KxsMachineServiceImpl extends ServiceImpl<KxsMachineMapper, KxsMach
         Integer reDayCount = ParamResolver.getInteger("MACHINE_RE_DAY_COUNT", 15);
         LocalDateTime endDay = LocalDate.now().minusDays(reDayCount).atStartOfDay();
         param.setEndDay(endDay);
+        //查询回收中的机具排除
+        R<List<String>> listR = remoteKxsStoreService.loadByRecycleSnList();
+        List<String> sns = RetOps.of(listR)
+                .getData()
+                .orElse(new ArrayList<>());
+        param.setSns(sns);
 
         return baseMapper.recyclePageList(page, param);
     }
@@ -247,7 +254,7 @@ public class KxsMachineServiceImpl extends ServiceImpl<KxsMachineMapper, KxsMach
 
         List<ExpiredModalBrandVO> result = new ArrayList<>();
         //查询用户已经申请了回收的机具
-        R<List<String>> listR = remoteKxsStoreService.recycleSnList(SecurityConstants.FROM_IN);
+        R<List<String>> listR = remoteKxsStoreService.loadByRecycleSnList();
         List<String> sns = RetOps.of(listR)
                 .getData()
                 .orElse(new ArrayList<>());
@@ -296,11 +303,6 @@ public class KxsMachineServiceImpl extends ServiceImpl<KxsMachineMapper, KxsMach
                 result.add(expiredModalBrandVO);
             }
         });
-        // 结束时间
-        long etime1 = System.currentTimeMillis();
-        // 计算执行时间
-//        System.out.printf("执行时长:%d 毫秒.", (etime - stime));
-//        System.out.printf("执行时长:%d 毫秒.", (etime1 - stime));
         return result;
     }
 
@@ -335,8 +337,13 @@ public class KxsMachineServiceImpl extends ServiceImpl<KxsMachineMapper, KxsMach
         Long userId = SecurityUtils.getUser().getId();
         Integer reDayCount = ParamResolver.getInteger("MACHINE_RE_DAY_COUNT", 15);
         LocalDateTime endDay = LocalDate.now().minusDays(reDayCount).atStartOfDay();
+        //查询回收中的机具排除
+        R<List<String>> listR = remoteKxsStoreService.loadByRecycleSnList();
+        List<String> sns = RetOps.of(listR)
+                .getData()
+                .orElse(new ArrayList<>());
 
-        return  baseMapper.recycleBrandList(userId, endDay);
+        return  baseMapper.recycleBrandList(userId, endDay, sns);
     }
 
     @Override

+ 18 - 5
kxs-product/kxs-product-biz/src/main/resources/mapper/KxsMachineMapper.xml

@@ -151,6 +151,13 @@
         <if test="query.brandId != null and query.brandId != ''">
             and brand_id = #{query.brandId}
         </if>
+        <if test="query.sns != null and query.sns.size() > 0">
+            and pos_sn not in
+            <foreach collection="query.sns" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+
         order by recycle_end_time desc
     </select>
 
@@ -181,12 +188,18 @@
     <select id="recycleBrandList" resultType="com.kxs.system.api.vo.kxsapp.RecycleBrandListVO">
         select DISTINCT kb.id, kb.name
         from kxs_machine km
-                 left join kxs_brand kb on km.brand_id = kb.id
+        left join kxs_brand kb on km.brand_id = kb.id
         where km.del_flag = 0
-          and km.is_act = 0
-          and km.bind_status = 0
-          and km.recycle_end_time &lt; #{endDay}
-          and km.user_id = #{userId}
+        and km.is_act = 0
+        and km.bind_status = 0
+        and km.recycle_end_time &lt; #{endDay}
+        and km.user_id = #{userId}
+        <if test="sns != null and sns.size() > 0">
+            and km.pos_sn not in
+            <foreach collection="sns" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
     </select>
     <select id="getActivityMachineByIdAndTime" resultType="java.lang.Integer">
         select

+ 0 - 1
kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/dto/kxsapp/storeRecycle/RecycleSubmitDTO.java

@@ -47,7 +47,6 @@ public class RecycleSubmitDTO {
      * 快递单号
      */
     @Schema(description = "快递单号")
-    @NotBlank(message = "快递单号不能为空")
     private String trackNo;
 
 

+ 11 - 0
kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/feign/RemoteKxsStoreService.java

@@ -3,6 +3,7 @@ package com.kxs.store.api.feign;
 
 import com.kxs.common.core.constant.SecurityConstants;
 import com.kxs.common.core.util.R;
+import com.kxs.store.api.model.KxsMachineRecycleInfo;
 import com.kxs.store.api.model.KxsWarehouseLimit;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestHeader;
@@ -45,4 +46,14 @@ public interface RemoteKxsStoreService {
 	 */
 	@PostExchange("storeLimit/addForAmount")
 	R<Boolean> addForAmount(@RequestBody KxsWarehouseLimit kxsWarehouseLimit, @RequestHeader(SecurityConstants.FROM) String from);
+
+	/**
+	 * 查询回收中的机具
+	 *
+	 * @return {@link List}<{@link KxsMachineRecycleInfo}>
+	 */
+	@GetExchange("/storeRecycle/loadByRecycleSnList")
+    R<List<String>> loadByRecycleSnList();
+
+
 }

+ 6 - 0
kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/model/KxsMachineRecycle.java

@@ -136,6 +136,12 @@ public class KxsMachineRecycle extends Model<KxsMachineRecycle> implements Seria
     @Schema(description = "创客电话")
     private String phone;
 
+    /**
+     * 状态 0处理中 1已完成
+     */
+    @Schema(description = "状态 0处理中 1已完成")
+    private Integer status;
+
 
 
 

+ 1 - 1
kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/vo/kxsapp/store/StoreDataVO.java

@@ -44,6 +44,6 @@ public class StoreDataVO implements Serializable {
      * 待回收机具数量
      */
     @Schema(description = "待回收机具数量")
-    private Integer recycleCount;
+    private Long recycleCount;
 
 }

+ 2 - 2
kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/vo/kxsapp/storeRecycle/StoreRecycleDataVO.java

@@ -24,12 +24,12 @@ public class StoreRecycleDataVO implements Serializable {
      * 已完成数量
      */
     @Schema(description = "已完成数量")
-    private Integer recyclableCount;
+    private Long recyclableCount;
 
     /**
      * 待回收机具数量
      */
     @Schema(description = "待回收机具数量")
-    private Integer recycleCount;
+    private Long recycleCount;
 
 }

+ 8 - 8
kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/controller/kxsapp/StoreRecycleController.java

@@ -50,14 +50,14 @@ public class StoreRecycleController {
     }
 
     /**
-     * 用户机具回收列表
+     * 查询已回收中的机具
      *
-     * @return 用户机具回收列表
+     * @return {@link R}
      */
-    @GetMapping("/recycleSnList")
-    public R recycleSnList() {
+    @GetMapping("/loadByRecycleSnList")
+    public R loadByRecycleSnList() {
 
-        return R.ok(kxsMachineRecycleService.recycleSnList());
+        return R.ok(kxsMachineRecycleService.loadByRecycleSnList());
     }
 
     /**
@@ -73,10 +73,10 @@ public class StoreRecycleController {
     }
 
     /**
-     * 待回收机具-确认收货
+     * 待回收机具-驳回机具
      *
-     * @param param 确认收货
-     * @return 待回收机具-确认收货
+     * @param param 驳回机具
+     * @return 待回收机具-驳回机具
      */
     @PostMapping("/cancel")
     public R cancel(@Valid @RequestBody RecycleConfirmDTO param) {

+ 3 - 10
kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/mapper/KxsMachineRecycleMapper.java

@@ -63,20 +63,13 @@ public interface KxsMachineRecycleMapper extends BaseMapper<KxsMachineRecycle> {
      */
     Integer recoverableData(Long userId);
 
-    /**
-     * 仓库待确认数量
-     *
-     * @param warehouseUserId 用户 ID
-     * @return {@link Long}
-     */
-    Integer storeRecoverableData(@Param("warehouseUserId") Integer warehouseUserId, @Param("status") Integer status);
 
     /**
-     * 用户机具回收列表
+     * 查询回收中的机具
      *
      * @param userId 用户 ID
-     * @return {@link List}<{@link KxsMachineRecycleInfo}>
+     * @return {@link List}<{@link String}>
      */
-    List<String> recycleUserSnList(Long userId);
+    List<String> loadByRecycleSnList(Long userId);
 }
 

+ 4 - 2
kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/service/KxsMachineRecycleService.java

@@ -95,10 +95,12 @@ public interface KxsMachineRecycleService extends IService<KxsMachineRecycle> {
     R userReturnRecycle(UserReturnRecycleDTO userReturnRecycleDTO);
 
     /**
-     * 用户机具回收列表
+     * 查询回收中的机具
      *
      * @return {@link List}<{@link KxsMachineRecycleInfo}>
      */
-    List<String> recycleSnList();
+    List<String> loadByRecycleSnList();
+
+
 }
 

+ 41 - 23
kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/service/impl/KxsMachineRecycleServiceImpl.java

@@ -25,8 +25,10 @@ import com.kxs.store.api.dto.kxsapp.storeRecycle.UserReturnRecycleDTO;
 import com.kxs.store.api.model.KxsMachineRecycleInfo;
 import com.kxs.store.api.model.KxsWarehouse;
 import com.kxs.store.api.vo.kxsapp.storeRecycle.*;
+import com.kxs.store.biz.constant.enums.MachineRecycleStatusEnum;
 import com.kxs.store.biz.constant.enums.RecycleOrderEnum;
 import com.kxs.store.biz.constant.enums.StoreErrorTypeEnum;
+import com.kxs.store.biz.constant.enums.StoreStatusEnum;
 import com.kxs.store.biz.mapper.KxsMachineRecycleInfoMapper;
 import com.kxs.store.biz.mapper.KxsMachineRecycleMapper;
 import com.kxs.store.api.model.KxsMachineRecycle;
@@ -89,23 +91,23 @@ public class KxsMachineRecycleServiceImpl extends ServiceImpl<KxsMachineRecycleM
     public R confirm(RecycleConfirmDTO param) {
 
         KxsMachineRecycle machineRecycle = baseMapper.selectById(param.getId());
-        if(machineRecycle == null){
+        if (machineRecycle == null) {
             return R.failed(StoreErrorTypeEnum.DATA_ERROR.getDescription());
         }
         List<KxsMachineRecycleInfo> recycleInfos = kxsMachineRecycleInfoMapper.selectList(Wrappers.<KxsMachineRecycleInfo>lambdaQuery()
                 .eq(KxsMachineRecycleInfo::getStatus, RecycleOrderEnum.INFO_UNCONFIRM.getType())
                 .eq(KxsMachineRecycleInfo::getOrderId, machineRecycle.getId()));
-        if(recycleInfos.isEmpty()){
+        if (recycleInfos.isEmpty()) {
             return R.failed(StoreErrorTypeEnum.DATA_ERROR.getDescription());
         }
         for (KxsMachineRecycleInfo recycleInfo : recycleInfos) {
-            if(param.getSnList().contains(recycleInfo.getPosSn())){
+            if (param.getSnList().contains(recycleInfo.getPosSn())) {
                 //远程查询机具号
                 R<KxsMachine> kxsMachineR = remoteKxsProductService.loadMachineBySn(recycleInfo.getPosSn(), SecurityConstants.FROM_IN);
                 KxsMachine machine = RetOps.of(kxsMachineR)
                         .getData()
                         .orElseThrow(() -> new GlobalCustomerException(StoreErrorTypeEnum.SN_FIND_NULL.getDescription()));
-                if(Objects.equals(machine.getBindStatus(), MachineTypeEnum.BIND.getType())){
+                if (Objects.equals(machine.getBindStatus(), MachineTypeEnum.BIND.getType())) {
                     throw new GlobalCustomerException("机具" + machine.getPosSn() + "已被绑定,请驳回该机具");
                 }
 
@@ -118,11 +120,19 @@ public class KxsMachineRecycleServiceImpl extends ServiceImpl<KxsMachineRecycleM
                 machine.setStatus(MachineTypeEnum.STATUS_IS.getType());
                 machine.setMachineType(MachineTypeEnum.M_TYPE_SN.getType());
                 R<Boolean> booleanR = remoteKxsProductService.updateByMachine(machine, SecurityConstants.FROM_IN);
-                if(!booleanR.getData()){
+                if (!booleanR.getData()) {
                     throw new GlobalCustomerException(ErrorTypeEnum.REMOTE_DATA_ERROR.getDescription());
                 }
             }
         }
+        //都处理完成后主订单状态字段修改为完成
+        Long count = kxsMachineRecycleInfoMapper.selectCount(Wrappers.lambdaQuery(KxsMachineRecycleInfo.class)
+                .eq(KxsMachineRecycleInfo::getStatus, RecycleOrderEnum.INFO_UNCONFIRM.getType())
+                .eq(KxsMachineRecycleInfo::getOrderId, param.getId()));
+        if (count == 0) {
+            machineRecycle.setStatus(CommonConstants.SUCCESS);
+            baseMapper.updateById(machineRecycle);
+        }
 
         return R.ok();
     }
@@ -133,27 +143,35 @@ public class KxsMachineRecycleServiceImpl extends ServiceImpl<KxsMachineRecycleM
     @Transactional(rollbackFor = Exception.class)
     public R cancel(RecycleConfirmDTO param) {
 
-        KxsMachineRecycle recycleOrder = baseMapper.selectById(param.getId());
+        KxsMachineRecycle machineRecycle = baseMapper.selectById(param.getId());
 
-        if(recycleOrder == null){
+        if (machineRecycle == null) {
             return R.failed(StoreErrorTypeEnum.DATA_ERROR.getDescription());
         }
         List<KxsMachineRecycleInfo> recycleInfos = kxsMachineRecycleInfoMapper.selectList(Wrappers.<KxsMachineRecycleInfo>lambdaQuery()
                 .eq(KxsMachineRecycleInfo::getStatus, RecycleOrderEnum.INFO_UNCONFIRM.getType())
-                .eq(KxsMachineRecycleInfo::getOrderId, recycleOrder.getId()));
+                .eq(KxsMachineRecycleInfo::getOrderId, machineRecycle.getId()));
 
         for (KxsMachineRecycleInfo recycleInfo : recycleInfos) {
-            if(param.getSnList().contains(recycleInfo.getPosSn())){
+            if (param.getSnList().contains(recycleInfo.getPosSn())) {
                 recycleInfo.setStatus(RecycleOrderEnum.INFO_CANCEL.getType());
                 recycleInfo.setCancelTime(LocalDateTime.now());
                 kxsMachineRecycleInfoMapper.updateById(recycleInfo);
             }
         }
-
+        //都处理完成后主订单状态字段修改为完成
+        Long count = kxsMachineRecycleInfoMapper.selectCount(Wrappers.lambdaQuery(KxsMachineRecycleInfo.class)
+                .eq(KxsMachineRecycleInfo::getStatus, RecycleOrderEnum.INFO_UNCONFIRM.getType())
+                .eq(KxsMachineRecycleInfo::getOrderId, param.getId()));
+        if (count == 0) {
+            machineRecycle.setStatus(CommonConstants.SUCCESS);
+            baseMapper.updateById(machineRecycle);
+        }
         return R.ok();
     }
 
 
+
     @Override
     public StoreRecycleDataVO recycleCount() {
 
@@ -162,10 +180,14 @@ public class KxsMachineRecycleServiceImpl extends ServiceImpl<KxsMachineRecycleM
         StoreRecycleDataVO storeRecycleDataVO = new StoreRecycleDataVO();
 
         //待确认机具数量
-        Integer recycleCount = baseMapper.storeRecoverableData(userId.intValue(), 0);
+        Long recycleCount = baseMapper.selectCount(Wrappers.<KxsMachineRecycle>lambdaQuery()
+                        .eq(KxsMachineRecycle::getUserId, userId)
+                .eq(KxsMachineRecycle::getStatus, CommonConstants.FAIL));
         storeRecycleDataVO.setRecycleCount(recycleCount);
         //已完成
-        Integer recyclableCount = baseMapper.storeRecoverableData(userId.intValue(), 1);
+        Long recyclableCount = baseMapper.selectCount(Wrappers.<KxsMachineRecycle>lambdaQuery()
+                .eq(KxsMachineRecycle::getUserId, userId)
+                .eq(KxsMachineRecycle::getStatus, CommonConstants.SUCCESS));
         storeRecycleDataVO.setRecyclableCount(recyclableCount);
 
         return storeRecycleDataVO;
@@ -190,7 +212,7 @@ public class KxsMachineRecycleServiceImpl extends ServiceImpl<KxsMachineRecycleM
                 .orElseThrow(() -> new GlobalCustomerException(StoreErrorTypeEnum.DATA_ERROR.getDescription()));
         //查询仓库
         KxsWarehouse kxsWarehouse = kxsWarehouseMapper.selectById(param.getWarehouseId());
-        if(kxsWarehouse == null){
+        if (kxsWarehouse == null) {
             return R.failed(StoreErrorTypeEnum.STORE_NOT_FIND.getDescription());
         }
         BeanUtils.copyProperties(param, machineRecycle);
@@ -212,14 +234,14 @@ public class KxsMachineRecycleServiceImpl extends ServiceImpl<KxsMachineRecycleM
             KxsMachine machine = RetOps.of(kxsMachineR)
                     .getData()
                     .orElseThrow(() -> new GlobalCustomerException(StoreErrorTypeEnum.DATA_ERROR.getDescription()));
-            if(Objects.equals(machine.getIsAct(), MachineTypeEnum.ACT.getType()) || Objects.equals(machine.getBindStatus(), MachineTypeEnum.BIND.getType())){
+            if (Objects.equals(machine.getIsAct(), MachineTypeEnum.ACT.getType()) || Objects.equals(machine.getBindStatus(), MachineTypeEnum.BIND.getType())) {
                 throw new GlobalCustomerException("机具号" + machine.getPosSn() + "已绑定/已激活");
             }
             //查询是否已提交
             KxsMachineRecycleInfo recycleInfo = kxsMachineRecycleInfoMapper.selectOne(Wrappers.<KxsMachineRecycleInfo>lambdaQuery()
                     .in(KxsMachineRecycleInfo::getStatus, 0, 1)
                     .eq(KxsMachineRecycleInfo::getPosSn, sn));
-            if(recycleInfo != null){
+            if (recycleInfo != null) {
                 throw new GlobalCustomerException("机具号" + machine.getPosSn() + "重复提交/已回收");
             }
             KxsMachineRecycleInfo kxsMachineRecycleInfo = new KxsMachineRecycleInfo();
@@ -298,22 +320,18 @@ public class KxsMachineRecycleServiceImpl extends ServiceImpl<KxsMachineRecycleM
             recycleInfo.setStatus(RecycleOrderEnum.INFO_RETURN.getType());
             kxsMachineRecycleInfoMapper.updateById(recycleInfo);
 
-            //主订单
-//            Long count = kxsMachineRecycleInfoMapper.selectCount(Wrappers.lambdaQuery(KxsMachineRecycleInfo.class)
-//                    .eq(KxsMachineRecycleInfo::getOrderId, recycleInfo.getOrderId()));
-//            if(count == 0){
-//                baseMapper.deleteById(recycleInfo.getOrderId());
-//            }
+
         });
 
         return R.ok();
     }
 
     @Override
-    public List<String> recycleSnList() {
+    public List<String> loadByRecycleSnList() {
+
         Long userId = SecurityUtils.getUser().getId();
 
-        return baseMapper.recycleUserSnList(userId);
+        return baseMapper.loadByRecycleSnList(userId);
     }
 
 

+ 4 - 1
kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/service/impl/KxsWarehouseServiceImpl.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.kxs.common.core.constant.CommonConstants;
 import com.kxs.common.core.constant.SecurityConstants;
 import com.kxs.common.core.constant.enums.ErrorTypeEnum;
 import com.kxs.common.core.exception.GlobalCustomerException;
@@ -117,7 +118,9 @@ public class KxsWarehouseServiceImpl extends ServiceImpl<KxsWarehouseMapper, Kxs
 
         //待回收机具数量
         KxsWarehouse warehouse = baseMapper.selectById(warehouseId);
-        Integer recycleCount = kxsMachineRecycleMapper.storeRecoverableData(warehouse.getUserId(), 0);
+        Long recycleCount = kxsMachineRecycleMapper.selectCount(Wrappers.<KxsMachineRecycle>lambdaQuery()
+                .eq(KxsMachineRecycle::getUserId, warehouse.getUserId())
+                .eq(KxsMachineRecycle::getStatus, CommonConstants.FAIL));
         storeDataVO.setRecycleCount(recycleCount);
 
         return storeDataVO;

+ 7 - 22
kxs-store/kxs-store-biz/src/main/resources/mapper/KxsMachineRecycleMapper.xml

@@ -19,6 +19,7 @@
         <result column="username" property="username"/>
         <result column="user_code" property="userCode"/>
         <result column="phone" property="phone"/>
+        <result column="status" property="status"/>
 
     </resultMap>
     <!-- kxs app 回收订单列表分页 map -->
@@ -52,17 +53,15 @@
         ) a
         LEFT JOIN kxs_machine_recycle_info t ON a.id = t.order_id
         <where>
-            <if test="query.status != null and query.status == 0">
-                and t.status = #{query.status}
-            </if>
-            <if test="query.status != null and query.status == 1">
-                and t.status in (1,2)
+            <if test="query.status != null">
+                and a.status = #{query.status}
             </if>
             <if test="query.keyword != null and query.keyword != ''">
                 and (t.pos_sn like concat('%',#{query.keyword},'%') or a.user_code like
                 concat('%',#{query.keyword},'%'))
             </if>
         </where>
+        order by a.create_time desc
     </select>
     <!-- kxs app 回收订单列表分页 map -->
     <resultMap type="com.kxs.store.api.vo.kxsapp.storeRecycle.RecycleUserListVO" id="KxsRecycleUserListVO">
@@ -100,7 +99,7 @@
         <where>
             and t.del_flag = 0
         </where>
-        order by  a.create_time desc
+        order by a.create_time desc
     </select>
     <select id="needConfirmList" resultType="com.kxs.store.api.vo.kxsapp.storeRecycle.NeedConfirmRecycleVO">
         select a.pos_sn, a.recycle_end_time
@@ -118,26 +117,12 @@
           and a.status = 0
           and a.del_flag = 0
     </select>
-    <select id="storeRecoverableData" resultType="java.lang.Integer">
-        select count(*)
-        from kxs_machine_recycle_info a
-        left join kxs_machine_recycle b on a.order_id = b.id
-        <where>
-            and a.del_flag = 0
-            and b.warehouse_user_id = #{warehouseUserId}
-            <if test="status == 0">
-                and a.status = #{status}
-            </if>
-            <if test="status == 1">
-                and a.status in (1,2)
-            </if>
-        </where>
-    </select>
-    <select id="recycleUserSnList" resultType="java.lang.String">
+    <select id="loadByRecycleSnList" resultType="java.lang.String">
         select a.pos_sn
         from kxs_machine_recycle_info a
                  left join kxs_machine_recycle b on a.order_id = b.id
         where b.user_id = #{userId}
+          and a.status in (0, 1)
     </select>
 
 </mapper>