From 3875a8f62bd6cecd78f56fb9a6911fa44891dfed Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期二, 22 六月 2021 15:57:30 +0800
Subject: [PATCH] 特殊人群上报接口
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java | 61 ++++++++++++++++--------------
1 files changed, 32 insertions(+), 29 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java
index 0b7564e..d414e90 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java
@@ -31,6 +31,7 @@
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
/**
* @auther lyq
@@ -49,7 +50,6 @@
private ComShopOrderService orderService;
@Resource
private UserService userService;
-
/**
* 查询店铺列表
*
@@ -61,8 +61,8 @@
public R pageStoreList(PageComShopStoreDTO pageComShopStoreDTO) {
Page page = new Page<>(pageComShopStoreDTO.getPageNum(), pageComShopStoreDTO.getPageSize());
IPage<PageShopStoreVO> comShopStoreVOIPage = this.baseMapper.pageShopStore(page, pageComShopStoreDTO);
- if (comShopStoreVOIPage != null) {
- Optional.ofNullable(comShopStoreVOIPage.getRecords()).orElse(new ArrayList<>()).forEach(shopStoreVO -> {
+ if(comShopStoreVOIPage!=null){
+ Optional.ofNullable(comShopStoreVOIPage.getRecords()).orElse(new ArrayList<>()).forEach(shopStoreVO ->{
List<Integer> notDoneOrderStatus = new ArrayList<>();
notDoneOrderStatus.add(1);
notDoneOrderStatus.add(2);
@@ -74,7 +74,9 @@
.eq(ComShopOrderDO::getDeleteStatus, 1)
.in(ComShopOrderDO::getStatus, notDoneOrderStatus)
);
- if (orderCount != null && orderCount.intValue() > 0) {
+ if(orderCount==null || orderCount.intValue() <= 0){
+ shopStoreVO.setOrderDone(true);
+ }else{
shopStoreVO.setOrderDone(false);
}
});
@@ -92,7 +94,8 @@
public R shopStoreDetail(PageComShopStoreDTO comShopStoreDTO) {
//查询店铺
ComShopStoreDO storeDO = this.baseMapper.selectById(comShopStoreDTO.getStoreId());
- if (storeDO == null) {
+ boolean storeDeleted = storeDO!=null && 2==storeDO.getDeleteStatus();
+ if (storeDO == null || storeDeleted) {
return R.fail(401, "店铺不存在");
}
if (storeDO.getStatus().equals(ComShopStoreDO.status.no)) {
@@ -105,11 +108,11 @@
Page page = new Page<>(comShopStoreDTO.getPageNum(), comShopStoreDTO.getPageSize());
List<ComShopGoodsVO> goodsList = shopGoodsDAO.pageShopGoodsByStoreId(page, comShopStoreDTO).getRecords();
- if (!goodsList.isEmpty()) {
+ if(!goodsList.isEmpty()){
//查询商品规格列表
goodsList.forEach(goods -> {
List<ComShopGoodsAttrVO> goodsAttrList = comShopGoodsAttrDAO.getGoodsAttr(goods.getId());
- if (!goodsAttrList.isEmpty()) {
+ if(!goodsAttrList.isEmpty()){
goods.setGoodsAttrList(goodsAttrList);
}
});
@@ -126,7 +129,7 @@
}
//判断店铺是否存在
ComShopStoreDO oldComShopStoreDO = this.baseMapper.selectOne(new LambdaQueryWrapper<ComShopStoreDO>()
- .eq(ComShopStoreDO::getStoreAccount, storeVO.getStoreAccount()).eq(ComShopStoreDO::getDeleteStatus, ComShopStoreDO.deleteStatus.no));
+ .eq(ComShopStoreDO::getStoreAccount, storeVO.getStoreAccount()).eq(ComShopStoreDO::getDeleteStatus,ComShopStoreDO.deleteStatus.no));
if (oldComShopStoreDO != null) {
return R.fail("商家已注册");
}
@@ -152,7 +155,7 @@
return R.ok();
}
- public R addStore(ShopStoreVO storeVO) {
+ public R addStore(ShopStoreVO storeVO){
//判断店铺是否存在
ComShopStoreDO oldComShopStoreDO = this.baseMapper.selectOne(new LambdaQueryWrapper<ComShopStoreDO>()
.eq(ComShopStoreDO::getStoreAccount, storeVO.getStoreAccount()).eq(ComShopStoreDO::getDeleteStatus, ComShopStoreDO.deleteStatus.no));
@@ -185,9 +188,9 @@
ComShopStoreDO storeDO = new ComShopStoreDO();
BeanUtils.copyProperties(storeVO, storeDO);
storeDO.setSale(0);
- if (this.baseMapper.insert(storeDO) > 0) {
+ if(this.baseMapper.insert(storeDO) > 0){
return R.ok();
- } else {
+ }else{
return R.fail();
}
}
@@ -195,13 +198,13 @@
@Override
public R editStore(Long id, ShopStoreVO storeVO) {
ComShopStoreDO storeDO = this.baseMapper.selectById(id);
- if (storeDO == null) {
+ if(storeDO == null){
return R.fail("商家不存在");
}
BeanUtils.copyProperties(storeVO, storeDO);
- if (this.baseMapper.updateById(storeDO) > 0) {
+ if(this.baseMapper.updateById(storeDO) > 0){
return R.ok();
- } else {
+ }else{
return R.fail();
}
}
@@ -210,26 +213,26 @@
public R deleteStore(Long[] id) {
LambdaQueryWrapper<ComShopStoreDO> query = new LambdaQueryWrapper<ComShopStoreDO>().in(ComShopStoreDO::getId, id);
List<ComShopStoreDO> comShopStoreDO = this.baseMapper.selectList(query);
- if (!comShopStoreDO.isEmpty()) {
- for (ComShopStoreDO shopStoreDO : comShopStoreDO) {
+ if(!comShopStoreDO.isEmpty()){
+ for (ComShopStoreDO shopStoreDO:comShopStoreDO) {
//判断店铺下是否拥有正常的商品
List<ComShopGoodsDO> shopGoodsList = shopGoodsDAO.selectList(new QueryWrapper<ComShopGoodsDO>()
- .lambda().eq(ComShopGoodsDO::getStoreId, shopStoreDO.getId())
- .eq(ComShopGoodsDO::getDeleteStatus, ComShopGoodsDO.deleteStatus.no)
- .eq(ComShopGoodsDO::getStatus, ComShopGoodsDO.status.sell));
- if (!shopGoodsList.isEmpty()) {//如果有正常商品则提示无法删除
+ .lambda().eq(ComShopGoodsDO::getStoreId,shopStoreDO.getId())
+ .eq(ComShopGoodsDO::getDeleteStatus,ComShopGoodsDO.deleteStatus.no)
+ .eq(ComShopGoodsDO::getStatus,ComShopGoodsDO.status.sell));
+ if(!shopGoodsList.isEmpty()){//如果有正常商品则提示无法删除
return R.fail("店铺下有商品正在出售,无法删除店铺");
}
List<ComShopOrderDO> comShopOrderDOS = orderService.getBaseMapper().selectList(new LambdaQueryWrapper<ComShopOrderDO>()
- .eq(ComShopOrderDO::getStoreId, shopStoreDO.getId()));
+ .eq(ComShopOrderDO::getStoreId,shopStoreDO.getId()));
List<ComShopOrderDO> filterOrder = comShopOrderDOS.stream()
.filter(order -> order.getStatus() < ComShopOrderDO.status.dpj)
.collect(Collectors.toList());
- if (!filterOrder.isEmpty()) {
- return R.fail("店铺下还有订单未完成");
+ if(!filterOrder.isEmpty()){
+ return R.fail("该商家还有订单未完成,不能删除");
}
//删除商家下的订单
- comShopOrderDOS.forEach(order -> {
+ comShopOrderDOS.forEach(order->{
order.setDeleteStatus(ComShopOrderDO.deleteStatus.yes);
orderService.getBaseMapper().updateById(order);
});
@@ -238,7 +241,7 @@
//删除sys_user 物理删除
this.baseMapper.deleteSysUserBySysUserId(shopStoreDO.getSysUserId());
}
- } else {
+ }else {
return R.fail("未查询到店铺");
}
return R.ok();
@@ -269,21 +272,21 @@
@Override
public R getUserStoreInfo(String account) {
try {
- R<LoginUserInfoVO> loginUserInfoVOR = userService.getUserInfo(account + "_5");
+ R<LoginUserInfoVO> loginUserInfoVOR = userService.getUserInfo(account+"_5");
LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(JSONObject.toJSONString(loginUserInfoVOR.getData()), LoginUserInfoVO.class);
- if (loginUserInfoVO == null) {
+ if(loginUserInfoVO==null){
return R.fail(500, "该账号不存在");
}
ComShopStoreDO comShopStoreDO = this.baseMapper.selectOne(new LambdaQueryWrapper<ComShopStoreDO>()
.eq(ComShopStoreDO::getDeleteStatus, 1).eq(ComShopStoreDO::getSysUserId, loginUserInfoVO.getUserId()));
if (comShopStoreDO == null) {
- return R.fail(500, "该账号不存在");
+ return R.fail(500, "该账号不存在");
}
ShopStoreVO shopStoreVO = new ShopStoreVO();
BeanUtils.copyProperties(comShopStoreDO, shopStoreVO);
return R.ok(shopStoreVO);
- } catch (Exception e) {
+ }catch (Exception e){
return R.fail();
}
}
--
Gitblit v1.7.1