增加,门店恢复状态,删除门店接口

This commit is contained in:
shuo.wang
2025-03-24 15:12:50 +08:00
parent 879db971ea
commit 5bd795fec3
3 changed files with 17 additions and 1 deletions

View File

@@ -3,6 +3,8 @@ package com.cool.store.request;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull;
/** /**
* @author zhangchenbiao * @author zhangchenbiao
* @FileName: DeleteShopRequest * @FileName: DeleteShopRequest
@@ -13,6 +15,8 @@ import lombok.Data;
public class DeleteShopRequest { public class DeleteShopRequest {
@ApiModelProperty("店铺id") @ApiModelProperty("店铺id")
@NotNull
private Long shopId; private Long shopId;
private String userId;
} }

View File

@@ -192,8 +192,12 @@ public class ShopServiceImpl implements ShopService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public Integer deleteShop(DeleteShopRequest request) { public Integer deleteShop(DeleteShopRequest request) {
// ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId()); ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
if (shopInfo==null){
throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST);
}
// if (Objects.nonNull(shopInfo)) { // if (Objects.nonNull(shopInfo)) {
// //进入选址不允许删除操作 // //进入选址不允许删除操作
// throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE); // throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
@@ -209,9 +213,16 @@ public class ShopServiceImpl implements ShopService {
// } // }
// pointRecommendDAO.updateRecommendStatus(shopInfo.getPointId(), PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1, Arrays.asList(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_5)); // pointRecommendDAO.updateRecommendStatus(shopInfo.getPointId(), PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1, Arrays.asList(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_5));
// } // }
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfo.getLineId());
lineInfoDO.setWantShopNum(lineInfoDO.getWantShopNum() - 1);
lineInfoDO.setUpdateTime(new Date());
lineInfoDO.setUpdateUserId(request.getUserId());
lineInfoDAO.updateLineInfo(lineInfoDO);
ShopInfoDO updateShop = new ShopInfoDO(); ShopInfoDO updateShop = new ShopInfoDO();
updateShop.setId(request.getShopId()); updateShop.setId(request.getShopId());
updateShop.setDeleted(true); updateShop.setDeleted(true);
updateShop.setUpdateTime(new Date());
updateShop.setUpdateUserId(request.getUserId());
return shopInfoDAO.updateShopInfo(updateShop); return shopInfoDAO.updateShopInfo(updateShop);
} }

View File

@@ -59,6 +59,7 @@ public class PCShopController {
@ApiOperation("删除店铺") @ApiOperation("删除店铺")
@PostMapping("/deleteShop") @PostMapping("/deleteShop")
public ResponseResult<Integer> deleteShop(@RequestBody @Validated DeleteShopRequest request) { public ResponseResult<Integer> deleteShop(@RequestBody @Validated DeleteShopRequest request) {
request.setUserId(CurrentUserHolder.getUserId());
return ResponseResult.success(shopService.deleteShop(request)); return ResponseResult.success(shopService.deleteShop(request));
} }