|
|
@@ -16,12 +16,14 @@ import com.sckw.core.utils.BeanUtils;
|
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
|
import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
+import com.sckw.excel.utils.DateUtil;
|
|
|
import com.sckw.order.dao.KwpWantBuyAddressMapper;
|
|
|
import com.sckw.order.dao.KwpWantBuyMapper;
|
|
|
import com.sckw.order.dao.KwpWantBuyTradingMapper;
|
|
|
import com.sckw.order.model.KwoWantBuy;
|
|
|
import com.sckw.order.model.KwoWantBuyAddress;
|
|
|
import com.sckw.order.model.KwoWantBuyTrading;
|
|
|
+import com.sckw.order.model.dto.WantBuyExport;
|
|
|
import com.sckw.order.model.vo.req.*;
|
|
|
import com.sckw.order.model.vo.res.WantBuyAddressDetailRes;
|
|
|
import com.sckw.order.model.vo.res.WantBuyDetailRes;
|
|
|
@@ -36,6 +38,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -446,9 +449,7 @@ public class KwpWantBuyService {
|
|
|
List<String> longList = stringToLongList(params.getTrading());
|
|
|
params.setTradings(longList);
|
|
|
}
|
|
|
- if (StringUtils.isNotBlank(params.getStatus())) {
|
|
|
- params.setStatus(params.getStatus());
|
|
|
- }
|
|
|
+ params.setStatus(null);
|
|
|
//商品分类筛选处理
|
|
|
if (StringUtils.isNotBlank(params.getGoodsType()) && StringUtils.isNotBlank(params.getGoodsTypeValue())) {
|
|
|
List<String> goodsTypes = goodsTypeHandle(params);
|
|
|
@@ -475,4 +476,45 @@ public class KwpWantBuyService {
|
|
|
res.setTableTops(tableTops).setTableBottom(tableBottom);
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ public List<WantBuyExport> export(WantBuySelectParam param) {
|
|
|
+ WantBuySelectParam selectParam = new WantBuySelectParam();
|
|
|
+ if (StringUtils.isNotBlank(param.getIds())) {
|
|
|
+ List<Long> ids = StringUtils.splitStrToList(param.getIds(), Long.class);
|
|
|
+ selectParam.setWantBuyIds(ids);
|
|
|
+ } else {
|
|
|
+ BeanUtils.copyProperties(param, selectParam);
|
|
|
+ if (StringUtils.isNotBlank(selectParam.getTrading())) {
|
|
|
+ List<String> longList = stringToLongList(selectParam.getTrading());
|
|
|
+ selectParam.setTradings(longList);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(selectParam.getStatus())) {
|
|
|
+ selectParam.setStatus(selectParam.getStatus());
|
|
|
+ }
|
|
|
+ //商品分类筛选处理
|
|
|
+ if (StringUtils.isNotBlank(selectParam.getGoodsType()) && StringUtils.isNotBlank(selectParam.getGoodsTypeValue())) {
|
|
|
+ List<String> goodsTypes = goodsTypeHandle(selectParam);
|
|
|
+ selectParam.setGoodsTypeValueSearch(goodsTypes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ selectParam.setEntId(LoginUserHolder.getEntId());
|
|
|
+ List<WantBuySelectRes> wantBuyDto = kwpWantBuyMapper.pageSelect(selectParam);
|
|
|
+ if (CollectionUtils.isEmpty(wantBuyDto)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+ List<WantBuyExport> result = new ArrayList<>();
|
|
|
+ AtomicInteger i = new AtomicInteger(1);
|
|
|
+ wantBuyDto.forEach(e -> {
|
|
|
+ WantBuyExport export = BeanUtils.copyProperties(e, WantBuyExport.class);
|
|
|
+ List<String> tradings = e.getWantBuyTradings().stream()
|
|
|
+ .map(wantBuyTradingRes -> DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), wantBuyTradingRes.getTrading()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ export.setSerialNumber(String.valueOf(i.getAndIncrement())).setTradings(String.join(Global.COMMA, tradings))
|
|
|
+ .setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), e.getGoodsType()))
|
|
|
+ .setCreateTime(Objects.isNull(e.getCreateTime()) ? null : DateUtil.getDateTime(e.getCreateTime()))
|
|
|
+ .setUpdateTime(Objects.isNull(e.getUpdateTime()) ? null : DateUtil.getDateTime(e.getUpdateTime()));
|
|
|
+ result.add(export);
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|