|
|
@@ -9,6 +9,9 @@ import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.page.PageRes;
|
|
|
+import com.sckw.core.model.vo.TableBottom;
|
|
|
+import com.sckw.core.model.vo.TableStatisticRes;
|
|
|
+import com.sckw.core.model.vo.TableTop;
|
|
|
import com.sckw.core.utils.BeanUtils;
|
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
|
import com.sckw.core.utils.StringUtils;
|
|
|
@@ -20,7 +23,6 @@ import com.sckw.order.model.KwoWantBuy;
|
|
|
import com.sckw.order.model.KwoWantBuyAddress;
|
|
|
import com.sckw.order.model.KwoWantBuyTrading;
|
|
|
import com.sckw.order.model.vo.req.*;
|
|
|
-import com.sckw.order.model.vo.res.TableTopRes;
|
|
|
import com.sckw.order.model.vo.res.WantBuyAddressDetailRes;
|
|
|
import com.sckw.order.model.vo.res.WantBuyDetailRes;
|
|
|
import com.sckw.order.model.vo.res.WantBuySelectRes;
|
|
|
@@ -57,8 +59,8 @@ public class KwpWantBuyService {
|
|
|
* @desc: 求购大厅列表查询
|
|
|
* @author lt
|
|
|
* @Date 11:50 2023/8/1 0001
|
|
|
- **/
|
|
|
- public PageRes<WantBuySelectRes> buyHallList(WantBuySelectParam wantBuySelectParam){
|
|
|
+ **/
|
|
|
+ public PageRes<WantBuySelectRes> buyHallList(WantBuySelectParam wantBuySelectParam) {
|
|
|
// 如果有求购方式的查询条件,需要先查询出求购方式的id
|
|
|
if (StringUtils.isNotBlank(wantBuySelectParam.getTrading())) {
|
|
|
List<String> longList = stringToLongList(wantBuySelectParam.getTrading());
|
|
|
@@ -69,6 +71,26 @@ public class KwpWantBuyService {
|
|
|
List<String> goodsTypes = goodsTypeHandle(wantBuySelectParam);
|
|
|
wantBuySelectParam.setGoodsTypeValueSearch(goodsTypes);
|
|
|
}
|
|
|
+ //区域筛选
|
|
|
+ String cityCode = wantBuySelectParam.getCityCode();
|
|
|
+ Integer areaLevel = wantBuySelectParam.getAreaLevel();
|
|
|
+ if (StringUtils.isNotBlank(cityCode) && Objects.nonNull(areaLevel)) {
|
|
|
+ if (Objects.equals(1, areaLevel)) {
|
|
|
+ cityCode = cityCode.substring(0, 2);
|
|
|
+ } else if (Objects.equals(2, areaLevel)) {
|
|
|
+ cityCode = cityCode.substring(0, 4);
|
|
|
+ }
|
|
|
+ wantBuySelectParam.setCityCode(cityCode);
|
|
|
+ }
|
|
|
+ //关键字模糊匹配
|
|
|
+ if (StringUtils.isNotBlank(wantBuySelectParam.getKeywords())) {
|
|
|
+ List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByName(wantBuySelectParam.getKeywords());
|
|
|
+ List<Long> entIds = entList.stream().map(EntCacheResDto::getId).toList();
|
|
|
+ if (CollectionUtils.isNotEmpty(entIds)) {
|
|
|
+ wantBuySelectParam.setEntIds(entIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ wantBuySelectParam.setStatus(Integer.valueOf(DictEnum.WANT_BUY_STATUS_1.getValue()));
|
|
|
|
|
|
// 分页查询求购列表
|
|
|
PageHelper.startPage(wantBuySelectParam.getPage(), wantBuySelectParam.getPageSize());
|
|
|
@@ -105,7 +127,7 @@ public class KwpWantBuyService {
|
|
|
* @desc 求购列表查询
|
|
|
* @author lt
|
|
|
* @Date 11:50 2023/8/1 0001
|
|
|
- **/
|
|
|
+ **/
|
|
|
public PageRes<WantBuySelectRes> select(WantBuySelectParam wantBuySelectParam) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(wantBuySelectParam.getTrading())) {
|
|
|
@@ -121,6 +143,7 @@ public class KwpWantBuyService {
|
|
|
List<String> goodsTypes = goodsTypeHandle(wantBuySelectParam);
|
|
|
wantBuySelectParam.setGoodsTypeValueSearch(goodsTypes);
|
|
|
}
|
|
|
+ wantBuySelectParam.setEntId(LoginUserHolder.getEntId());
|
|
|
PageHelper.startPage(wantBuySelectParam.getPage(), wantBuySelectParam.getPageSize());
|
|
|
List<WantBuySelectRes> wantBuyDto = kwpWantBuyMapper.pageSelect(wantBuySelectParam);
|
|
|
if (CollectionUtils.isEmpty(wantBuyDto)) {
|
|
|
@@ -417,7 +440,8 @@ public class KwpWantBuyService {
|
|
|
* @return
|
|
|
* @Desc: 查询求购角标统计数量
|
|
|
*/
|
|
|
- public Map statistic(WantBuySelectParam params) {
|
|
|
+ public TableStatisticRes statistic(WantBuySelectParam params) {
|
|
|
+ TableStatisticRes res = new TableStatisticRes();
|
|
|
if (StringUtils.isNotBlank(params.getTrading())) {
|
|
|
List<String> longList = stringToLongList(params.getTrading());
|
|
|
params.setTradings(longList);
|
|
|
@@ -430,43 +454,25 @@ public class KwpWantBuyService {
|
|
|
List<String> goodsTypes = goodsTypeHandle(params);
|
|
|
params.setGoodsTypeValueSearch(goodsTypes);
|
|
|
}
|
|
|
- /**统计数据**/
|
|
|
- List<TableTopRes> counts = kwpWantBuyMapper.statisticsCount(params);
|
|
|
- long tatol = counts.size();
|
|
|
- System.out.println(counts);
|
|
|
-
|
|
|
- /**全部数据-处理**/
|
|
|
- List<TableTopRes> countList = new ArrayList();
|
|
|
- TableTopRes allCount = new TableTopRes();
|
|
|
-// allCount.setValue(String.valueOf(DictEnum.GOODS_STATUS_0));
|
|
|
- allCount.setTotal(tatol);
|
|
|
- allCount.setName("全部");
|
|
|
- countList.add(allCount);
|
|
|
-
|
|
|
- /**数据处理**/
|
|
|
- Map<String, Integer> statusMap = new HashMap<>();
|
|
|
- statusMap.put("保存", Integer.valueOf(DictEnum.GOODS_STATUS_0.getValue()));
|
|
|
- statusMap.put("下架", Integer.valueOf(DictEnum.GOODS_STATUS_2.getValue()));
|
|
|
- statusMap.put("上架", Integer.valueOf(DictEnum.GOODS_STATUS_1.getValue()));
|
|
|
- for (Map.Entry<String, Integer> entry : statusMap.entrySet()) {
|
|
|
- System.out.println(entry.getKey() + "--->" + entry.getValue());
|
|
|
- TableTopRes count = new TableTopRes();
|
|
|
- int smlTotal = 0;
|
|
|
- for (TableTopRes topCount : counts) {
|
|
|
- if (topCount.getValue() != null && !topCount.getValue().isEmpty() && Integer.parseInt(topCount.getValue()) == entry.getValue()) {
|
|
|
- smlTotal++;
|
|
|
- }
|
|
|
- }
|
|
|
- count.setName(entry.getKey());
|
|
|
- count.setValue(String.valueOf(entry.getValue()));
|
|
|
- count.setTotal(smlTotal);
|
|
|
- countList.add(count);
|
|
|
- }
|
|
|
-
|
|
|
- /**数据组装**/
|
|
|
- Map tableCount = new HashMap();
|
|
|
- tableCount.put("tableTop", countList);
|
|
|
- tableCount.put("tableBottom", tatol);
|
|
|
- return tableCount;
|
|
|
+ params.setEntId(LoginUserHolder.getEntId());
|
|
|
+ List<WantBuySelectRes> result = kwpWantBuyMapper.pageSelect(params);
|
|
|
+ Map<Integer, List<WantBuySelectRes>> map = result.stream().collect(Collectors.groupingBy(WantBuySelectRes::getStatus));
|
|
|
+ List<TableTop> tableTops = new ArrayList<>();
|
|
|
+ TableTop all = new TableTop();
|
|
|
+ all.setName("全部").setTotal(CollectionUtils.isEmpty(result) ? 0 : result.size());
|
|
|
+ tableTops.add(all);
|
|
|
+ List<DictEnum> enums = DictEnum.getEnumsByType(DictTypeEnum.WANT_BUY_STATUS.getType());
|
|
|
+ enums.forEach(e -> {
|
|
|
+ Integer value = Integer.valueOf(e.getValue());
|
|
|
+ List<WantBuySelectRes> list = map.get(value);
|
|
|
+ int total = CollectionUtils.isEmpty(list) ? 0 : list.size();
|
|
|
+ TableTop tableTop = new TableTop();
|
|
|
+ tableTop.setName(e.getLabel()).setValue(value).setTotal(total);
|
|
|
+ tableTops.add(tableTop);
|
|
|
+ });
|
|
|
+ TableBottom tableBottom = new TableBottom();
|
|
|
+ tableBottom.setTotal(CollectionUtils.isEmpty(result) ? 0 : result.size());
|
|
|
+ res.setTableTops(tableTops).setTableBottom(tableBottom);
|
|
|
+ return res;
|
|
|
}
|
|
|
}
|