|
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
-import com.sckw.core.common.enums.enums.DictEnum;
|
|
|
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
import com.sckw.core.exception.BusinessException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
import com.sckw.core.model.constant.Global;
|
|
@@ -21,6 +20,7 @@ import com.sckw.excel.utils.DateUtil;
|
|
|
import com.sckw.order.dao.KwpWantBuyAddressMapper;
|
|
import com.sckw.order.dao.KwpWantBuyAddressMapper;
|
|
|
import com.sckw.order.dao.KwpWantBuyMapper;
|
|
import com.sckw.order.dao.KwpWantBuyMapper;
|
|
|
import com.sckw.order.dao.KwpWantBuyTradingMapper;
|
|
import com.sckw.order.dao.KwpWantBuyTradingMapper;
|
|
|
|
|
+import com.sckw.order.enums.WantBuyStatusEnum;
|
|
|
import com.sckw.order.model.KwoWantBuy;
|
|
import com.sckw.order.model.KwoWantBuy;
|
|
|
import com.sckw.order.model.KwoWantBuyAddress;
|
|
import com.sckw.order.model.KwoWantBuyAddress;
|
|
|
import com.sckw.order.model.KwoWantBuyTrading;
|
|
import com.sckw.order.model.KwoWantBuyTrading;
|
|
@@ -92,7 +92,7 @@ public class KwpWantBuyService {
|
|
|
wantBuySelectParam.setEntIds(entIds);
|
|
wantBuySelectParam.setEntIds(entIds);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- wantBuySelectParam.setStatus(Integer.valueOf(DictEnum.WANT_BUY_STATUS_1.getValue()));
|
|
|
|
|
|
|
+ wantBuySelectParam.setStatus(WantBuyStatusEnum.PUT_ON_SHELVES.getCode());
|
|
|
|
|
|
|
|
// 分页查询求购列表
|
|
// 分页查询求购列表
|
|
|
PageHelper.startPage(wantBuySelectParam.getPage(), wantBuySelectParam.getPageSize());
|
|
PageHelper.startPage(wantBuySelectParam.getPage(), wantBuySelectParam.getPageSize());
|
|
@@ -112,14 +112,29 @@ public class KwpWantBuyService {
|
|
|
Map<Long, String> entMap = entList.stream()
|
|
Map<Long, String> entMap = entList.stream()
|
|
|
.collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
|
|
.collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
|
|
|
|
|
|
|
|
|
|
+ Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.TRADE_TYPE.getType(),
|
|
|
|
|
+ DictTypeEnum.PRODUCT_NAME_TYPE.getType(), DictTypeEnum.GOODS_STATUS.getType()));
|
|
|
|
|
+ Map<String, String> tradeMap, productNameMap, goodsStatusMap;
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(dict)) {
|
|
|
|
|
+ tradeMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.TRADE_TYPE.getType())) ?
|
|
|
|
|
+ dict.get(DictTypeEnum.TRADE_TYPE.getType()) : new HashMap<>();
|
|
|
|
|
+ productNameMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.TRADE_TYPE.getType())) ?
|
|
|
|
|
+ dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType()) : new HashMap<>();
|
|
|
|
|
+ goodsStatusMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.TRADE_TYPE.getType())) ?
|
|
|
|
|
+ dict.get(DictTypeEnum.GOODS_STATUS.getType()) : new HashMap<>();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ tradeMap = new HashMap<>();
|
|
|
|
|
+ productNameMap = new HashMap<>();
|
|
|
|
|
+ goodsStatusMap = new HashMap<>();
|
|
|
|
|
+ }
|
|
|
// 对求购列表进行数据处理
|
|
// 对求购列表进行数据处理
|
|
|
res.forEach(e -> {
|
|
res.forEach(e -> {
|
|
|
List<String> tradings = e.getWantBuyTradings().stream()
|
|
List<String> tradings = e.getWantBuyTradings().stream()
|
|
|
- .map(f -> DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), f.getTrading()))
|
|
|
|
|
|
|
+ .map(f -> tradeMap.get(f.getTrading()))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
e.setTradings(String.join(Global.COMMA, tradings));
|
|
e.setTradings(String.join(Global.COMMA, tradings));
|
|
|
- e.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), e.getGoodsType()));
|
|
|
|
|
- e.setStatusLabel(DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(e.getStatus())));
|
|
|
|
|
|
|
+ e.setGoodsTypeLabel(productNameMap.get(e.getGoodsType()));
|
|
|
|
|
+ e.setStatusLabel(goodsStatusMap.get(String.valueOf(e.getStatus())));
|
|
|
e.setEntName(Objects.nonNull(entMap.get(e.getEntId())) ? entMap.get(e.getEntId()) : null);
|
|
e.setEntName(Objects.nonNull(entMap.get(e.getEntId())) ? entMap.get(e.getEntId()) : null);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -157,14 +172,29 @@ public class KwpWantBuyService {
|
|
|
List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
|
|
List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
|
|
|
Map<Long, String> entMap = entList.stream()
|
|
Map<Long, String> entMap = entList.stream()
|
|
|
.collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
|
|
.collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
|
|
|
|
|
+ Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.TRADE_TYPE.getType(),
|
|
|
|
|
+ DictTypeEnum.PRODUCT_NAME_TYPE.getType(), DictTypeEnum.GOODS_STATUS.getType()));
|
|
|
|
|
+ Map<String, String> tradeMap, productNameMap, goodsStatusMap;
|
|
|
|
|
+ if (CollectionUtils.isEmpty(dict)) {
|
|
|
|
|
+ tradeMap = new HashMap<>();
|
|
|
|
|
+ productNameMap = new HashMap<>();
|
|
|
|
|
+ goodsStatusMap = new HashMap<>();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ tradeMap = CollectionUtils.isEmpty(dict.get(DictTypeEnum.TRADE_TYPE.getType())) ?
|
|
|
|
|
+ new HashMap<>() : dict.get(DictTypeEnum.TRADE_TYPE.getType());
|
|
|
|
|
+ productNameMap = CollectionUtils.isEmpty(dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType())) ?
|
|
|
|
|
+ new HashMap<>() : dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
|
|
|
|
|
+ goodsStatusMap = CollectionUtils.isEmpty(dict.get(DictTypeEnum.GOODS_STATUS.getType())) ?
|
|
|
|
|
+ new HashMap<>() : dict.get(DictTypeEnum.GOODS_STATUS.getType());
|
|
|
|
|
+ }
|
|
|
//把查询出来的集合wantBuyTradings里面对的tranding 转成字符串放在String里面
|
|
//把查询出来的集合wantBuyTradings里面对的tranding 转成字符串放在String里面
|
|
|
wantBuyDto.forEach(wantBuySelectRes -> {
|
|
wantBuyDto.forEach(wantBuySelectRes -> {
|
|
|
List<String> tradings = wantBuySelectRes.getWantBuyTradings().stream()
|
|
List<String> tradings = wantBuySelectRes.getWantBuyTradings().stream()
|
|
|
- .map(wantBuyTradingRes -> DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), wantBuyTradingRes.getTrading()))
|
|
|
|
|
|
|
+ .map(wantBuyTradingRes -> tradeMap.get(wantBuyTradingRes.getTrading()))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
wantBuySelectRes.setTradings(String.join(Global.COMMA, tradings));
|
|
wantBuySelectRes.setTradings(String.join(Global.COMMA, tradings));
|
|
|
- wantBuySelectRes.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), wantBuySelectRes.getGoodsType()));
|
|
|
|
|
- wantBuySelectRes.setStatusLabel(DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(wantBuySelectRes.getStatus())));
|
|
|
|
|
|
|
+ wantBuySelectRes.setGoodsTypeLabel(productNameMap.get(wantBuySelectRes.getGoodsType()));
|
|
|
|
|
+ wantBuySelectRes.setStatusLabel(goodsStatusMap.get(String.valueOf(wantBuySelectRes.getStatus())));
|
|
|
wantBuySelectRes.setEntName(Objects.nonNull(entMap.get(wantBuySelectRes.getEntId())) ? entMap.get(wantBuySelectRes.getEntId()) : null);
|
|
wantBuySelectRes.setEntName(Objects.nonNull(entMap.get(wantBuySelectRes.getEntId())) ? entMap.get(wantBuySelectRes.getEntId()) : null);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -206,8 +236,7 @@ public class KwpWantBuyService {
|
|
|
**/
|
|
**/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void addDraft(AddDraftWantBuyParam param) {
|
|
public void addDraft(AddDraftWantBuyParam param) {
|
|
|
- Integer status = Integer.valueOf(DictEnum.WANT_BUY_STATUS_0.getValue());
|
|
|
|
|
- addWantBuy(BeanUtils.copyProperties(param, AddWantBuyParam.class), status);
|
|
|
|
|
|
|
+ addWantBuy(BeanUtils.copyProperties(param, AddWantBuyParam.class), WantBuyStatusEnum.SAVED.getCode());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -219,8 +248,7 @@ public class KwpWantBuyService {
|
|
|
**/
|
|
**/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void addShelves(AddWantBuyParam param) {
|
|
public void addShelves(AddWantBuyParam param) {
|
|
|
- Integer status = Integer.valueOf(DictEnum.WANT_BUY_STATUS_1.getValue());
|
|
|
|
|
- addWantBuy(param, status);
|
|
|
|
|
|
|
+ addWantBuy(param, WantBuyStatusEnum.PUT_ON_SHELVES.getCode());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -263,14 +291,14 @@ public class KwpWantBuyService {
|
|
|
**/
|
|
**/
|
|
|
public void batchPutOnShelves(List<Long> ids) {
|
|
public void batchPutOnShelves(List<Long> ids) {
|
|
|
LambdaQueryWrapper<KwoWantBuy> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwoWantBuy> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.in(KwoWantBuy::getId, ids).ne(KwoWantBuy::getStatus, Integer.valueOf(DictEnum.WANT_BUY_STATUS_1.getValue()))
|
|
|
|
|
|
|
+ wrapper.in(KwoWantBuy::getId, ids).ne(KwoWantBuy::getStatus, WantBuyStatusEnum.PUT_ON_SHELVES.getCode())
|
|
|
.eq(KwoWantBuy::getEntId, LoginUserHolder.getEntId()).eq(KwoWantBuy::getDelFlag, Global.NO);
|
|
.eq(KwoWantBuy::getEntId, LoginUserHolder.getEntId()).eq(KwoWantBuy::getDelFlag, Global.NO);
|
|
|
List<KwoWantBuy> list = kwpWantBuyMapper.selectList(wrapper);
|
|
List<KwoWantBuy> list = kwpWantBuyMapper.selectList(wrapper);
|
|
|
if (!Objects.equals(ids.size(), list.size())) {
|
|
if (!Objects.equals(ids.size(), list.size())) {
|
|
|
throw new BusinessException("上架操作仅针对“已下架”“草稿”状态的单据!");
|
|
throw new BusinessException("上架操作仅针对“已下架”“草稿”状态的单据!");
|
|
|
}
|
|
}
|
|
|
LambdaUpdateWrapper<KwoWantBuy> updateWrapper = new LambdaUpdateWrapper<>();
|
|
LambdaUpdateWrapper<KwoWantBuy> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.set(KwoWantBuy::getStatus, Integer.valueOf(DictEnum.WANT_BUY_STATUS_1.getValue()))
|
|
|
|
|
|
|
+ updateWrapper.set(KwoWantBuy::getStatus, WantBuyStatusEnum.PUT_ON_SHELVES.getCode())
|
|
|
.in(KwoWantBuy::getId, ids);
|
|
.in(KwoWantBuy::getId, ids);
|
|
|
kwpWantBuyMapper.update(null, updateWrapper);
|
|
kwpWantBuyMapper.update(null, updateWrapper);
|
|
|
}
|
|
}
|
|
@@ -283,14 +311,14 @@ public class KwpWantBuyService {
|
|
|
public void batchTakeOffShelves(WantBuyDels param) {
|
|
public void batchTakeOffShelves(WantBuyDels param) {
|
|
|
List<Long> ids = StringUtils.splitStrToList(param.getIds(), Long.class);
|
|
List<Long> ids = StringUtils.splitStrToList(param.getIds(), Long.class);
|
|
|
LambdaQueryWrapper<KwoWantBuy> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwoWantBuy> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.in(KwoWantBuy::getId, ids).eq(KwoWantBuy::getStatus, Integer.valueOf(DictEnum.WANT_BUY_STATUS_1.getValue()))
|
|
|
|
|
|
|
+ wrapper.in(KwoWantBuy::getId, ids).eq(KwoWantBuy::getStatus, WantBuyStatusEnum.PUT_ON_SHELVES.getCode())
|
|
|
.eq(KwoWantBuy::getEntId, LoginUserHolder.getEntId()).eq(KwoWantBuy::getDelFlag, Global.NO);
|
|
.eq(KwoWantBuy::getEntId, LoginUserHolder.getEntId()).eq(KwoWantBuy::getDelFlag, Global.NO);
|
|
|
List<KwoWantBuy> list = kwpWantBuyMapper.selectList(wrapper);
|
|
List<KwoWantBuy> list = kwpWantBuyMapper.selectList(wrapper);
|
|
|
if (!Objects.equals(ids.size(), list.size())) {
|
|
if (!Objects.equals(ids.size(), list.size())) {
|
|
|
throw new BusinessException("下架操作仅针对“已上架”状态的单据");
|
|
throw new BusinessException("下架操作仅针对“已上架”状态的单据");
|
|
|
}
|
|
}
|
|
|
LambdaUpdateWrapper<KwoWantBuy> updateWrapper = new LambdaUpdateWrapper<>();
|
|
LambdaUpdateWrapper<KwoWantBuy> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.set(KwoWantBuy::getStatus, Integer.valueOf(DictEnum.WANT_BUY_STATUS_2.getValue())).in(KwoWantBuy::getId, ids);
|
|
|
|
|
|
|
+ updateWrapper.set(KwoWantBuy::getStatus, WantBuyStatusEnum.TAKE_OFF_SHELVES.getCode()).in(KwoWantBuy::getId, ids);
|
|
|
kwpWantBuyMapper.update(null, updateWrapper);
|
|
kwpWantBuyMapper.update(null, updateWrapper);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -331,14 +359,32 @@ public class KwpWantBuyService {
|
|
|
throw new BusinessException("求购信息不存在");
|
|
throw new BusinessException("求购信息不存在");
|
|
|
}
|
|
}
|
|
|
WantBuyDetailRes responseData = BeanUtils.copyProperties(kwoWantBuy, WantBuyDetailRes.class);
|
|
WantBuyDetailRes responseData = BeanUtils.copyProperties(kwoWantBuy, WantBuyDetailRes.class);
|
|
|
- responseData.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), responseData.getGoodsType()))
|
|
|
|
|
- .setStatusLabel(DictEnum.getLabel(DictTypeEnum.WANT_BUY_STATUS.getType(), String.valueOf(responseData.getStatus())));
|
|
|
|
|
|
|
+ Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.PRODUCT_NAME_TYPE.getType(),
|
|
|
|
|
+ DictTypeEnum.WANT_BUY_STATUS.getType(), DictTypeEnum.TORDER_ADDRESS_TYPE.getType(), DictTypeEnum.TRADE_TYPE.getType()));
|
|
|
|
|
+ Map<String, String> productNameMap, wantBuyStatusMap, orderAddressMap, tradeMap;
|
|
|
|
|
+ if (CollectionUtils.isEmpty(dict)) {
|
|
|
|
|
+ productNameMap = new HashMap<>();
|
|
|
|
|
+ wantBuyStatusMap = new HashMap<>();
|
|
|
|
|
+ orderAddressMap = new HashMap<>();
|
|
|
|
|
+ tradeMap = new HashMap<>();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ productNameMap = CollectionUtils.isEmpty(dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType())) ?
|
|
|
|
|
+ new HashMap<>() : dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
|
|
|
|
|
+ wantBuyStatusMap = CollectionUtils.isEmpty(dict.get(DictTypeEnum.WANT_BUY_STATUS.getType())) ?
|
|
|
|
|
+ new HashMap<>() : dict.get(DictTypeEnum.WANT_BUY_STATUS.getType());
|
|
|
|
|
+ orderAddressMap = CollectionUtils.isEmpty(dict.get(DictTypeEnum.TORDER_ADDRESS_TYPE.getType())) ?
|
|
|
|
|
+ new HashMap<>() : dict.get(DictTypeEnum.TORDER_ADDRESS_TYPE.getType());
|
|
|
|
|
+ tradeMap = CollectionUtils.isEmpty(dict.get(DictTypeEnum.TRADE_TYPE.getType())) ?
|
|
|
|
|
+ new HashMap<>() : dict.get(DictTypeEnum.TRADE_TYPE.getType());
|
|
|
|
|
+ }
|
|
|
|
|
+ responseData.setGoodsTypeLabel(productNameMap.get(responseData.getGoodsType()))
|
|
|
|
|
+ .setStatusLabel(wantBuyStatusMap.get(String.valueOf(responseData.getStatus())));
|
|
|
//求购地址信息
|
|
//求购地址信息
|
|
|
KwoWantBuyAddress address = kwpWantBuyAddressMapper.selectOne(new LambdaQueryWrapper<KwoWantBuyAddress>()
|
|
KwoWantBuyAddress address = kwpWantBuyAddressMapper.selectOne(new LambdaQueryWrapper<KwoWantBuyAddress>()
|
|
|
.eq(KwoWantBuyAddress::getWantBuyId, id).eq(KwoWantBuyAddress::getDelFlag, Global.NO).last("LIMIT 1"));
|
|
.eq(KwoWantBuyAddress::getWantBuyId, id).eq(KwoWantBuyAddress::getDelFlag, Global.NO).last("LIMIT 1"));
|
|
|
if (Objects.nonNull(address)) {
|
|
if (Objects.nonNull(address)) {
|
|
|
WantBuyAddressDetailRes wantBuyAddressInfo = BeanUtils.copyProperties(address, WantBuyAddressDetailRes.class);
|
|
WantBuyAddressDetailRes wantBuyAddressInfo = BeanUtils.copyProperties(address, WantBuyAddressDetailRes.class);
|
|
|
- wantBuyAddressInfo.setTypeLabel(DictEnum.getLabel(DictTypeEnum.TORDER_ADDRESS_TYPE.getType(), wantBuyAddressInfo.getType()));
|
|
|
|
|
|
|
+ wantBuyAddressInfo.setTypeLabel(orderAddressMap.get(wantBuyAddressInfo.getType()));
|
|
|
responseData.setAddressInfo(wantBuyAddressInfo);
|
|
responseData.setAddressInfo(wantBuyAddressInfo);
|
|
|
}
|
|
}
|
|
|
//获取求购企业信息
|
|
//获取求购企业信息
|
|
@@ -353,7 +399,7 @@ public class KwpWantBuyService {
|
|
|
responseData.setTradings(tradings);
|
|
responseData.setTradings(tradings);
|
|
|
//改成stream流的方式
|
|
//改成stream流的方式
|
|
|
List<String> result = tradings.stream()
|
|
List<String> result = tradings.stream()
|
|
|
- .map(trading -> DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), trading))
|
|
|
|
|
|
|
+ .map(tradeMap::get)
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
String tradingLabels = String.join(Global.COMMA, result);
|
|
String tradingLabels = String.join(Global.COMMA, result);
|
|
|
//获取到的是一个集合,需要转换成字符串
|
|
//获取到的是一个集合,需要转换成字符串
|
|
@@ -454,9 +500,9 @@ public class KwpWantBuyService {
|
|
|
TableTop all = new TableTop();
|
|
TableTop all = new TableTop();
|
|
|
all.setName("全部").setTotal(CollectionUtils.isEmpty(result) ? 0 : result.size());
|
|
all.setName("全部").setTotal(CollectionUtils.isEmpty(result) ? 0 : result.size());
|
|
|
tableTops.add(all);
|
|
tableTops.add(all);
|
|
|
- List<DictEnum> enums = DictEnum.getEnumsByType(DictTypeEnum.WANT_BUY_STATUS.getType());
|
|
|
|
|
|
|
+ List<WantBuyStatusEnum> enums = WantBuyStatusEnum.getSortList();
|
|
|
enums.forEach(e -> {
|
|
enums.forEach(e -> {
|
|
|
- Integer value = Integer.valueOf(e.getValue());
|
|
|
|
|
|
|
+ Integer value = e.getCode();
|
|
|
Integer systemType = LoginUserHolder.getSystemType();
|
|
Integer systemType = LoginUserHolder.getSystemType();
|
|
|
if (Objects.equals(systemType, SystemTypeEnum.MANAGE.getCode()) && Objects.equals(value, Global.NO)) {
|
|
if (Objects.equals(systemType, SystemTypeEnum.MANAGE.getCode()) && Objects.equals(value, Global.NO)) {
|
|
|
return;
|
|
return;
|
|
@@ -464,7 +510,7 @@ public class KwpWantBuyService {
|
|
|
List<WantBuySelectRes> list = map.get(value);
|
|
List<WantBuySelectRes> list = map.get(value);
|
|
|
int total = CollectionUtils.isEmpty(list) ? 0 : list.size();
|
|
int total = CollectionUtils.isEmpty(list) ? 0 : list.size();
|
|
|
TableTop tableTop = new TableTop();
|
|
TableTop tableTop = new TableTop();
|
|
|
- tableTop.setName(e.getLabel()).setValue(value).setTotal(total);
|
|
|
|
|
|
|
+ tableTop.setName(e.getMsg()).setValue(value).setTotal(total);
|
|
|
tableTops.add(tableTop);
|
|
tableTops.add(tableTop);
|
|
|
});
|
|
});
|
|
|
TableBottom tableBottom = new TableBottom();
|
|
TableBottom tableBottom = new TableBottom();
|
|
@@ -497,15 +543,27 @@ public class KwpWantBuyService {
|
|
|
if (CollectionUtils.isEmpty(wantBuyDto)) {
|
|
if (CollectionUtils.isEmpty(wantBuyDto)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
|
|
+ Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.TRADE_TYPE.getType(),
|
|
|
|
|
+ DictTypeEnum.PRODUCT_NAME_TYPE.getType()));
|
|
|
|
|
+ Map<String, String> tradeMap, productNameMap;
|
|
|
|
|
+ if (CollectionUtils.isEmpty(dict)) {
|
|
|
|
|
+ tradeMap = new HashMap<>();
|
|
|
|
|
+ productNameMap = new HashMap<>();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ tradeMap = CollectionUtils.isEmpty(dict.get(DictTypeEnum.TRADE_TYPE.getType())) ?
|
|
|
|
|
+ new HashMap<>() : dict.get(DictTypeEnum.TRADE_TYPE.getType());
|
|
|
|
|
+ productNameMap = CollectionUtils.isEmpty(dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType())) ?
|
|
|
|
|
+ new HashMap<>() : dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
|
|
|
|
|
+ }
|
|
|
List<WantBuyExport> result = new ArrayList<>();
|
|
List<WantBuyExport> result = new ArrayList<>();
|
|
|
AtomicInteger i = new AtomicInteger(1);
|
|
AtomicInteger i = new AtomicInteger(1);
|
|
|
wantBuyDto.forEach(e -> {
|
|
wantBuyDto.forEach(e -> {
|
|
|
WantBuyExport export = BeanUtils.copyProperties(e, WantBuyExport.class);
|
|
WantBuyExport export = BeanUtils.copyProperties(e, WantBuyExport.class);
|
|
|
List<String> tradings = e.getWantBuyTradings().stream()
|
|
List<String> tradings = e.getWantBuyTradings().stream()
|
|
|
- .map(wantBuyTradingRes -> DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), wantBuyTradingRes.getTrading()))
|
|
|
|
|
|
|
+ .map(wantBuyTradingRes -> tradeMap.get(wantBuyTradingRes.getTrading()))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
export.setSerialNumber(String.valueOf(i.getAndIncrement())).setTradings(String.join(Global.COMMA, tradings))
|
|
export.setSerialNumber(String.valueOf(i.getAndIncrement())).setTradings(String.join(Global.COMMA, tradings))
|
|
|
- .setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), e.getGoodsType()))
|
|
|
|
|
|
|
+ .setGoodsTypeLabel(productNameMap.get(e.getGoodsType()))
|
|
|
.setCreateTime(Objects.isNull(e.getCreateTime()) ? null : DateUtil.getDateTime(e.getCreateTime()))
|
|
.setCreateTime(Objects.isNull(e.getCreateTime()) ? null : DateUtil.getDateTime(e.getCreateTime()))
|
|
|
.setUpdateTime(Objects.isNull(e.getUpdateTime()) ? null : DateUtil.getDateTime(e.getUpdateTime()));
|
|
.setUpdateTime(Objects.isNull(e.getUpdateTime()) ? null : DateUtil.getDateTime(e.getUpdateTime()));
|
|
|
result.add(export);
|
|
result.add(export);
|
|
@@ -526,7 +584,7 @@ public class KwpWantBuyService {
|
|
|
.eq(KwoWantBuy::getDelFlag, Global.NO)
|
|
.eq(KwoWantBuy::getDelFlag, Global.NO)
|
|
|
.last("LIMIT 1");
|
|
.last("LIMIT 1");
|
|
|
KwoWantBuy wantBuy = kwpWantBuyMapper.selectOne(wrapper);
|
|
KwoWantBuy wantBuy = kwpWantBuyMapper.selectOne(wrapper);
|
|
|
- if (Objects.isNull(wantBuy)){
|
|
|
|
|
|
|
+ if (Objects.isNull(wantBuy)) {
|
|
|
throw new BusinessException("求购信息不存在");
|
|
throw new BusinessException("求购信息不存在");
|
|
|
}
|
|
}
|
|
|
WantBuyContactInfoRes res = new WantBuyContactInfoRes();
|
|
WantBuyContactInfoRes res = new WantBuyContactInfoRes();
|