|
|
@@ -1,8 +1,6 @@
|
|
|
package com.kxs.store.biz.service.impl;
|
|
|
|
|
|
-import cn.hutool.core.lang.Snowflake;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
@@ -25,10 +23,8 @@ 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;
|
|
|
@@ -46,8 +42,11 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 客小爽仓库机具回收申请表(KxsMachineRecycle)表服务实现类
|
|
|
@@ -277,11 +276,25 @@ public class KxsMachineRecycleServiceImpl extends ServiceImpl<KxsMachineRecycleM
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public IPage<NeedConfirmRecycleVO> needConfirmList(Page<NeedConfirmRecycleVO> page, Integer brandId) {
|
|
|
+ public List<NeedConfirmRecycleVO> needConfirmList(Page<NeedConfirmRecycleVO> page) {
|
|
|
|
|
|
Long userId = SecurityUtils.getUser().getId();
|
|
|
+ List<NeedConfirmPosListVO> list = baseMapper.needConfirmList(page, userId);
|
|
|
+ //按照品牌ID分组
|
|
|
+ Map<Integer, List<NeedConfirmPosListVO>> listMap = list.stream().collect(Collectors.groupingBy(NeedConfirmPosListVO::getBrandId));
|
|
|
+ List<NeedConfirmRecycleVO> needList = new ArrayList<>();
|
|
|
+ for (Integer brandId : listMap.keySet()) {
|
|
|
+ R<KxsBrand> kxsBrandR = remoteKxsProductService.loadByBrand(brandId, SecurityConstants.FROM_IN);
|
|
|
+ KxsBrand brand = RetOps.of(kxsBrandR)
|
|
|
+ .getData()
|
|
|
+ .orElseThrow(() -> new GlobalCustomerException(StoreErrorTypeEnum.DATA_ERROR.getDescription()));
|
|
|
+ needList.add(NeedConfirmRecycleVO.builder()
|
|
|
+ .brandId(brandId)
|
|
|
+ .brandName(brand.getName())
|
|
|
+ .posList(listMap.get(brandId)).build());
|
|
|
+ }
|
|
|
|
|
|
- return baseMapper.needConfirmList(page, userId, brandId);
|
|
|
+ return needList;
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -317,10 +330,18 @@ public class KxsMachineRecycleServiceImpl extends ServiceImpl<KxsMachineRecycleM
|
|
|
throw new GlobalCustomerException(sn + "机具已处理");
|
|
|
}
|
|
|
//回收机具
|
|
|
- recycleInfo.setStatus(RecycleOrderEnum.INFO_RETURN.getType());
|
|
|
- kxsMachineRecycleInfoMapper.updateById(recycleInfo);
|
|
|
+// recycleInfo.setStatus(RecycleOrderEnum.INFO_RETURN.getType());
|
|
|
+// kxsMachineRecycleInfoMapper.updateById(recycleInfo);
|
|
|
|
|
|
|
|
|
+ kxsMachineRecycleInfoMapper.deleteById(recycleInfo.getId());
|
|
|
+ //都处理完成后主订单状态字段修改为完成
|
|
|
+ Long count = kxsMachineRecycleInfoMapper.selectCount(Wrappers.lambdaQuery(KxsMachineRecycleInfo.class)
|
|
|
+ .eq(KxsMachineRecycleInfo::getOrderId, recycleInfo.getOrderId()));
|
|
|
+ if (count == 0) {
|
|
|
+ baseMapper.deleteById(recycleInfo.getOrderId());
|
|
|
+ }
|
|
|
+
|
|
|
});
|
|
|
|
|
|
return R.ok();
|