|
@@ -11,15 +11,22 @@ import com.sckw.core.model.page.PageResult;
|
|
|
import com.sckw.core.model.vo.TableBottom;
|
|
import com.sckw.core.model.vo.TableBottom;
|
|
|
import com.sckw.core.model.vo.TableStatisticRes;
|
|
import com.sckw.core.model.vo.TableStatisticRes;
|
|
|
import com.sckw.core.model.vo.TableTop;
|
|
import com.sckw.core.model.vo.TableTop;
|
|
|
-import com.sckw.core.utils.*;
|
|
|
|
|
|
|
+import com.sckw.core.utils.BeanUtils;
|
|
|
|
|
+import com.sckw.core.utils.CollectionUtils;
|
|
|
|
|
+import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.excel.utils.DateUtil;
|
|
import com.sckw.excel.utils.DateUtil;
|
|
|
-import com.sckw.payment.api.dubbo.PayCenterDubboService;
|
|
|
|
|
import com.sckw.product.dao.KwpGoodsMapper;
|
|
import com.sckw.product.dao.KwpGoodsMapper;
|
|
|
import com.sckw.product.enums.GoodsStatusEnum;
|
|
import com.sckw.product.enums.GoodsStatusEnum;
|
|
|
import com.sckw.product.model.*;
|
|
import com.sckw.product.model.*;
|
|
|
-import com.sckw.product.model.vo.req.*;
|
|
|
|
|
|
|
+import com.sckw.product.model.dto.OperatorGoodsListQueryDTO;
|
|
|
|
|
+import com.sckw.product.model.vo.req.OperatorGoodsExportQueryVO;
|
|
|
|
|
+import com.sckw.product.model.vo.req.OperatorGoodsListQueryVO;
|
|
|
|
|
+import com.sckw.product.model.vo.req.OperatorGoodsStsQueryVO;
|
|
|
import com.sckw.product.model.vo.res.*;
|
|
import com.sckw.product.model.vo.res.*;
|
|
|
-import com.sckw.product.service.*;
|
|
|
|
|
|
|
+import com.sckw.product.service.KwpGoodsAddressService;
|
|
|
|
|
+import com.sckw.product.service.KwpGoodsAttributeService;
|
|
|
|
|
+import com.sckw.product.service.KwpGoodsImageService;
|
|
|
|
|
+import com.sckw.product.service.KwpGoodsPriceRangeService;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.RemoteUserService;
|
|
import com.sckw.system.api.RemoteUserService;
|
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
@@ -29,8 +36,6 @@ import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
-import org.springframework.cloud.stream.function.StreamBridge;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
@@ -54,22 +59,16 @@ public class GoodsManagerService {
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
private RemoteUserService remoteUserService;
|
|
private RemoteUserService remoteUserService;
|
|
|
|
|
|
|
|
- @DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
|
|
- private PayCenterDubboService payCenterDubboService;
|
|
|
|
|
|
|
|
|
|
private final KwpGoodsMapper kwpGoodsMapper;
|
|
private final KwpGoodsMapper kwpGoodsMapper;
|
|
|
private final KwpGoodsAddressService kwpGoodsAddressService;
|
|
private final KwpGoodsAddressService kwpGoodsAddressService;
|
|
|
private final KwpGoodsAttributeService kwpGoodsAttributeService;
|
|
private final KwpGoodsAttributeService kwpGoodsAttributeService;
|
|
|
private final KwpGoodsImageService kwpGoodsImageService;
|
|
private final KwpGoodsImageService kwpGoodsImageService;
|
|
|
private final KwpGoodsPriceRangeService kwpGoodsPriceRangeService;
|
|
private final KwpGoodsPriceRangeService kwpGoodsPriceRangeService;
|
|
|
- private final StreamBridge streamBridge;
|
|
|
|
|
-
|
|
|
|
|
- @Value("${goods.url.list}")
|
|
|
|
|
- private String goodsListUrl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- public PageResult select(SelectOperationGoodsListParam params) {
|
|
|
|
|
- LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(BeanUtils.copyProperties(params, ExportStatisticGoodsListParam.class));
|
|
|
|
|
|
|
+ public PageResult select(OperatorGoodsListQueryVO params) {
|
|
|
|
|
+ LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(BeanUtils.copyProperties(params, OperatorGoodsListQueryDTO.class));
|
|
|
Page<KwpGoods> page = new Page<>(params.getPage(), params.getPageSize());
|
|
Page<KwpGoods> page = new Page<>(params.getPage(), params.getPageSize());
|
|
|
IPage<KwpGoods> goodsIpage = kwpGoodsMapper.selectPage(page, wrapper);
|
|
IPage<KwpGoods> goodsIpage = kwpGoodsMapper.selectPage(page, wrapper);
|
|
|
List<KwpGoods> list = goodsIpage.getRecords();
|
|
List<KwpGoods> list = goodsIpage.getRecords();
|
|
@@ -88,43 +87,44 @@ public class GoodsManagerService {
|
|
|
* @Param list:
|
|
* @Param list:
|
|
|
* @return: java.util.List<com.sckw.product.model.vo.res.GoodsList>
|
|
* @return: java.util.List<com.sckw.product.model.vo.res.GoodsList>
|
|
|
*/
|
|
*/
|
|
|
- private LambdaQueryWrapper<KwpGoods> buildWrapper(ExportStatisticGoodsListParam params) {
|
|
|
|
|
|
|
+ private LambdaQueryWrapper<KwpGoods> buildWrapper(OperatorGoodsListQueryDTO params) {
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
if (StringUtils.isNotBlank(params.getIds())) {
|
|
if (StringUtils.isNotBlank(params.getIds())) {
|
|
|
List<Long> ids = StringUtils.splitStrToList(params.getIds(), ",", Long.class);
|
|
List<Long> ids = StringUtils.splitStrToList(params.getIds(), ",", Long.class);
|
|
|
wrapper.in(KwpGoods::getId, ids);
|
|
wrapper.in(KwpGoods::getId, ids);
|
|
|
} else {
|
|
} else {
|
|
|
- if (Objects.nonNull(params.getEndCreateTime())) {
|
|
|
|
|
|
|
+ if (Objects.nonNull(params.getStartCreateTime())) {
|
|
|
wrapper.ge(KwpGoods::getCreateTime, params.getStartCreateTime());
|
|
wrapper.ge(KwpGoods::getCreateTime, params.getStartCreateTime());
|
|
|
}
|
|
}
|
|
|
if (Objects.nonNull(params.getEndCreateTime())) {
|
|
if (Objects.nonNull(params.getEndCreateTime())) {
|
|
|
wrapper.le(KwpGoods::getCreateTime, params.getEndCreateTime());
|
|
wrapper.le(KwpGoods::getCreateTime, params.getEndCreateTime());
|
|
|
}
|
|
}
|
|
|
//运营端不需要显示草稿数据
|
|
//运营端不需要显示草稿数据
|
|
|
- wrapper.ne(KwpGoods::getStatus, 0);
|
|
|
|
|
- wrapper.eq(Objects.nonNull(params.getSupplyEntId()), KwpGoods::getSupplyEntId, params.getSupplyEntId())
|
|
|
|
|
- .eq(Objects.nonNull(params.getPrepaidLimit()), KwpGoods::getPrepaidLimit, params.getPrepaidLimit())
|
|
|
|
|
- .eq(Objects.nonNull(params.getStatus()), KwpGoods::getStatus, params.getStatus());
|
|
|
|
|
- if (StringUtils.isNotBlank(params.getGoodsType()) && StringUtils.isNotBlank(params.getGoodsTypeValue())) {
|
|
|
|
|
- List<SysDictResDto> goodsTypeList = remoteSystemService.queryDictBottom(params.getGoodsType(), params.getGoodsTypeValue());
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(goodsTypeList)) {
|
|
|
|
|
- List<String> goodsTypes = goodsTypeList.stream().map(SysDictResDto::getValue).toList();
|
|
|
|
|
- wrapper.in(KwpGoods::getGoodsType, goodsTypes);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (Objects.isNull(params.getStatus())) {
|
|
|
|
|
+ wrapper.ne(KwpGoods::getStatus, 0);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wrapper.eq(KwpGoods::getStatus, params.getStatus());
|
|
|
}
|
|
}
|
|
|
String keywords = params.getKeywords();
|
|
String keywords = params.getKeywords();
|
|
|
if (StringUtils.isNotBlank(keywords)) {
|
|
if (StringUtils.isNotBlank(keywords)) {
|
|
|
//模糊匹配商品名称、仓储地址、客户经理
|
|
//模糊匹配商品名称、仓储地址、客户经理
|
|
|
List<KwsUserResDto> managers = remoteUserService.getUserByName(keywords);
|
|
List<KwsUserResDto> managers = remoteUserService.getUserByName(keywords);
|
|
|
- if (CollectionUtils.isEmpty(managers)) {
|
|
|
|
|
- wrapper.and(e -> e.like(KwpGoods::getName, keywords).or().like(KwpGoods::getAddressName, keywords));
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(managers)) {
|
|
|
List<Long> managerIds = managers.stream().map(KwsUserResDto::getId).toList();
|
|
List<Long> managerIds = managers.stream().map(KwsUserResDto::getId).toList();
|
|
|
wrapper.and(e -> e.like(KwpGoods::getName, keywords).or().like(KwpGoods::getAddressName, keywords)
|
|
wrapper.and(e -> e.like(KwpGoods::getName, keywords).or().like(KwpGoods::getAddressName, keywords)
|
|
|
.or().in(KwpGoods::getManager, managerIds));
|
|
.or().in(KwpGoods::getManager, managerIds));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wrapper.and(e -> e.like(KwpGoods::getName, keywords).or().like(KwpGoods::getAddressName, keywords));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if (StringUtils.isNotBlank(params.getGoodsType()) && StringUtils.isNotBlank(params.getGoodsTypeValue())) {
|
|
|
|
|
+ List<SysDictResDto> goodsTypeList = remoteSystemService.queryDictBottom(params.getGoodsType(), params.getGoodsTypeValue());
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(goodsTypeList)) {
|
|
|
|
|
+ List<String> goodsTypes = goodsTypeList.stream().map(SysDictResDto::getValue).toList();
|
|
|
|
|
+ wrapper.in(KwpGoods::getGoodsType, goodsTypes);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
wrapper.eq(KwpGoods::getDelFlag, Global.NO).orderByDesc(KwpGoods::getCreateTime);
|
|
wrapper.eq(KwpGoods::getDelFlag, Global.NO).orderByDesc(KwpGoods::getCreateTime);
|
|
|
return wrapper;
|
|
return wrapper;
|
|
|
}
|
|
}
|
|
@@ -253,16 +253,18 @@ public class GoodsManagerService {
|
|
|
* @Param params:
|
|
* @Param params:
|
|
|
* @return: com.sckw.core.model.vo.TableStatisticRes
|
|
* @return: com.sckw.core.model.vo.TableStatisticRes
|
|
|
*/
|
|
*/
|
|
|
- public TableStatisticRes statistic(SelectOperationGoodsListParam params) {
|
|
|
|
|
|
|
+ public TableStatisticRes statistic(OperatorGoodsStsQueryVO params) {
|
|
|
TableStatisticRes res = new TableStatisticRes();
|
|
TableStatisticRes res = new TableStatisticRes();
|
|
|
- LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(BeanUtils.copyProperties(params, ExportStatisticGoodsListParam.class));
|
|
|
|
|
|
|
+ LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(BeanUtils.copyProperties(params, OperatorGoodsListQueryDTO.class));
|
|
|
List<KwpGoods> goodsList = kwpGoodsMapper.selectList(wrapper);
|
|
List<KwpGoods> goodsList = kwpGoodsMapper.selectList(wrapper);
|
|
|
Map<Integer, List<KwpGoods>> map = goodsList.stream().collect(Collectors.groupingBy(KwpGoods::getStatus));
|
|
Map<Integer, List<KwpGoods>> map = goodsList.stream().collect(Collectors.groupingBy(KwpGoods::getStatus));
|
|
|
List<TableTop> tableTops = new ArrayList<>();
|
|
List<TableTop> tableTops = new ArrayList<>();
|
|
|
TableTop all = new TableTop();
|
|
TableTop all = new TableTop();
|
|
|
all.setName("全部").setTotal(CollectionUtils.isEmpty(goodsList) ? 0 : goodsList.size());
|
|
all.setName("全部").setTotal(CollectionUtils.isEmpty(goodsList) ? 0 : goodsList.size());
|
|
|
tableTops.add(all);
|
|
tableTops.add(all);
|
|
|
- GoodsStatusEnum.getSortList().forEach(e -> {
|
|
|
|
|
|
|
+ List<GoodsStatusEnum> sortList = GoodsStatusEnum.getSortList();
|
|
|
|
|
+ sortList.remove(0);
|
|
|
|
|
+ sortList.forEach(e -> {
|
|
|
List<KwpGoods> list = map.get(e.getCode());
|
|
List<KwpGoods> list = map.get(e.getCode());
|
|
|
int total = CollectionUtils.isEmpty(list) ? 0 : list.size();
|
|
int total = CollectionUtils.isEmpty(list) ? 0 : list.size();
|
|
|
TableTop tableTop = new TableTop();
|
|
TableTop tableTop = new TableTop();
|
|
@@ -271,10 +273,7 @@ public class GoodsManagerService {
|
|
|
});
|
|
});
|
|
|
TableBottom tableBottom = new TableBottom();
|
|
TableBottom tableBottom = new TableBottom();
|
|
|
tableBottom.setTotal(CollectionUtils.isEmpty(goodsList) ? 0 : goodsList.size());
|
|
tableBottom.setTotal(CollectionUtils.isEmpty(goodsList) ? 0 : goodsList.size());
|
|
|
- List<TableTop> filteredTableTops = tableTops.stream()
|
|
|
|
|
- .filter(tableTop -> !tableTop.getName().equals("已保存"))
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
- res.setTableTops(filteredTableTops).setTableBottom(tableBottom);
|
|
|
|
|
|
|
+ res.setTableTops(tableTops).setTableBottom(tableBottom);
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -285,8 +284,8 @@ public class GoodsManagerService {
|
|
|
* @Param params:
|
|
* @Param params:
|
|
|
* @return: void
|
|
* @return: void
|
|
|
*/
|
|
*/
|
|
|
- public List<OperationGoodsListExport> export(ExportStatisticGoodsListParam params) {
|
|
|
|
|
- LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(params);
|
|
|
|
|
|
|
+ public List<OperationGoodsListExport> export(OperatorGoodsExportQueryVO params) {
|
|
|
|
|
+ LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(BeanUtils.copyProperties(params, OperatorGoodsListQueryDTO.class));
|
|
|
List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
|
|
List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
|
|
|
List<OperationGoodsList> goodsLists = buildGoodLists(list);
|
|
List<OperationGoodsList> goodsLists = buildGoodLists(list);
|
|
|
if (CollectionUtils.isEmpty(goodsLists)) {
|
|
if (CollectionUtils.isEmpty(goodsLists)) {
|
|
@@ -309,10 +308,4 @@ public class GoodsManagerService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|