fix XSS and BAC, improve code style

This commit is contained in:
paulGao
2021-09-09 16:47:14 +08:00
parent d470192ac6
commit d3e1de5620
175 changed files with 858 additions and 678 deletions

View File

@@ -1,19 +1,17 @@
package cn.lili.controller.goods;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.CategoryParameterGroup;
import cn.lili.modules.goods.entity.dos.Parameters;
import cn.lili.modules.goods.entity.vos.ParameterGroupVO;
import cn.lili.modules.goods.service.CategoryParameterGroupService;
import cn.lili.modules.goods.service.ParametersService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@@ -28,8 +26,10 @@ import java.util.List;
@RequestMapping("/store/goods/category/parameters")
@Transactional(rollbackFor = Exception.class)
public class CategoryParameterGroupStoreController {
@Autowired
private ParametersService parametersService;
@Autowired
private CategoryParameterGroupService categoryParameterGroupService;
@@ -40,22 +40,4 @@ public class CategoryParameterGroupStoreController {
return categoryParameterGroupService.getCategoryParams(categoryId);
}
@ApiOperation(value = "编辑或更新数据")
@PostMapping(value = "/save")
public ResultMessage<CategoryParameterGroup> saveOrUpdate(CategoryParameterGroup categoryParameterGroup) {
categoryParameterGroupService.save(categoryParameterGroup);
return ResultUtil.data(categoryParameterGroup);
}
@ApiOperation(value = "通过id删除参数组")
@DeleteMapping(value = "/{id}")
public ResultMessage<Object> delAllByIds(@PathVariable String id) {
//删除参数
parametersService.remove(new QueryWrapper<Parameters>().eq("group_id", id));
//删除参数组
categoryParameterGroupService.removeById(id);
return ResultUtil.success();
}
}

View File

@@ -1,7 +1,7 @@
package cn.lili.controller.goods;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.vos.CategoryBrandVO;
import cn.lili.modules.goods.entity.vos.CategoryVO;
@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Objects;
/**
* 店铺端,商品分类接口
@@ -54,8 +55,9 @@ public class CategoryStoreController {
@ApiOperation(value = "获取店铺经营的分类")
@GetMapping(value = "/all")
public ResultMessage<List<CategoryVO>> getListAll() {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
//获取店铺经营范围
String goodsManagementCategory = storeDetailService.getStoreDetail(UserContext.getCurrentUser().getStoreId()).getGoodsManagementCategory();
String goodsManagementCategory = storeDetailService.getStoreDetail(storeId).getGoodsManagementCategory();
return ResultUtil.data(this.categoryService.getStoreCategory(goodsManagementCategory.split(",")));
}

View File

@@ -1,28 +1,29 @@
package cn.lili.controller.goods;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.AuthUser;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.DraftGoods;
import cn.lili.modules.goods.entity.dto.DraftGoodsDTO;
import cn.lili.modules.goods.entity.dto.DraftGoodsSearchParams;
import cn.lili.modules.goods.entity.vos.DraftGoodsVO;
import cn.lili.modules.goods.service.DraftGoodsService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* 店铺端,草稿商品接口
*
* @author paulG
* @since 2021/2/20 2:26 下午
*
*/
@RestController
@Api(tags = "店铺端,草稿商品接口")
@@ -35,27 +36,25 @@ public class DraftGoodsStoreController {
@ApiOperation(value = "分页获取草稿商品列表")
@GetMapping(value = "/page")
public ResultMessage<IPage<DraftGoods>> getDraftGoodsByPage(DraftGoodsSearchParams searchParams) {
searchParams.setStoreId(UserContext.getCurrentUser().getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
searchParams.setStoreId(storeId);
return ResultUtil.data(draftGoodsService.getDraftGoods(searchParams));
}
@ApiOperation(value = "获取草稿商品")
@GetMapping(value = "/{id}")
public ResultMessage<DraftGoodsVO> getDraftGoods(@PathVariable String id) {
DraftGoodsVO draftGoods = draftGoodsService.getDraftGoods(id);
if (!UserContext.getCurrentUser().getStoreId().equals(draftGoods.getStoreId())) {
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
}
DraftGoodsVO draftGoods = OperationalJudgment.judgment(draftGoodsService.getDraftGoods(id));
return ResultUtil.data(draftGoods);
}
@ApiOperation(value = "保存草稿商品")
@PostMapping(value = "/save", consumes = "application/json", produces = "application/json")
public ResultMessage<String> saveDraftGoods(@RequestBody DraftGoodsDTO draftGoodsVO) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
if (draftGoodsVO.getStoreId() == null) {
AuthUser currentUser = UserContext.getCurrentUser();
draftGoodsVO.setStoreId(currentUser.getStoreId());
} else if (draftGoodsVO.getStoreId() != null && !UserContext.getCurrentUser().getStoreId().equals(draftGoodsVO.getStoreId())) {
draftGoodsVO.setStoreId(storeId);
} else if (draftGoodsVO.getStoreId() != null && !storeId.equals(draftGoodsVO.getStoreId())) {
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
}
draftGoodsService.saveGoodsDraft(draftGoodsVO);
@@ -65,10 +64,7 @@ public class DraftGoodsStoreController {
@ApiOperation(value = "删除草稿商品")
@DeleteMapping(value = "/{id}")
public ResultMessage<String> deleteDraftGoods(@PathVariable String id) {
DraftGoods draftGoods = draftGoodsService.getById(id);
if (!draftGoods.getStoreId().equals(UserContext.getCurrentUser().getStoreId())) {
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
}
OperationalJudgment.judgment(draftGoodsService.getDraftGoods(id));
draftGoodsService.deleteGoodsDraft(id);
return ResultUtil.success();
}

View File

@@ -1,79 +0,0 @@
package cn.lili.controller.goods;
import cn.lili.common.enums.ResultUtil;
import cn.lili.mybatis.util.PageUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.common.vo.SearchVO;
import cn.lili.modules.goods.entity.dos.GoodsGallery;
import cn.lili.modules.goods.service.GoodsGalleryService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 店铺端,商品相册接口
*
* @author pikachu
* @since 2020-03-13 11:18:56
*/
@RestController
@Api(tags = "店铺端,商品相册接口")
@RequestMapping("/store/goodsGallery")
public class GoodsGalleryController {
@Autowired
private GoodsGalleryService goodsGalleryService;
@ApiOperation(value = "通过id获取")
@GetMapping(value = "/get/{id}")
public ResultMessage<GoodsGallery> get(@PathVariable String id) {
GoodsGallery goodsGallery = goodsGalleryService.getById(id);
return ResultUtil.data(goodsGallery);
}
@ApiOperation(value = "获取全部数据")
@GetMapping(value = "/getAll")
public ResultMessage<List<GoodsGallery>> getAll() {
List<GoodsGallery> list = goodsGalleryService.list();
return ResultUtil.data(list);
}
@ApiOperation(value = "分页获取")
@GetMapping(value = "/getByPage")
public ResultMessage<IPage<GoodsGallery>> getByPage(GoodsGallery entity,
SearchVO searchVo,
PageVO page) {
IPage<GoodsGallery> data = goodsGalleryService.page(PageUtil.initPage(page), PageUtil.initWrapper(entity, searchVo));
return ResultUtil.data(data);
}
@ApiOperation(value = "添加商品相册")
@PostMapping(value = "/save")
public ResultMessage<GoodsGallery> save(GoodsGallery goodsGallery) {
goodsGalleryService.save(goodsGallery);
return ResultUtil.data(goodsGallery);
}
@ApiOperation(value = "修改商品相册")
@PostMapping(value = "/update")
public ResultMessage<GoodsGallery> update(GoodsGallery goodsGallery) {
goodsGalleryService.updateById(goodsGallery);
return ResultUtil.data(goodsGallery);
}
@ApiOperation(value = "批量删除")
@DeleteMapping(value = "/delByIds/{ids}")
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
goodsGalleryService.removeByIds(ids);
return ResultUtil.success();
}
}

View File

@@ -6,6 +6,7 @@ import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.store.entity.dos.StoreGoodsLabel;
import cn.lili.modules.store.entity.vos.StoreGoodsLabelVO;
import cn.lili.modules.store.service.StoreGoodsLabelService;
import cn.lili.modules.system.utils.OperationalJudgment;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
@@ -14,6 +15,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
@@ -36,25 +38,29 @@ public class GoodsLabelStoreController {
@ApiOperation(value = "获取当前店铺商品分类列表")
@GetMapping
public ResultMessage<List<StoreGoodsLabelVO>> list() {
return ResultUtil.data(storeGoodsLabelService.listByStoreId(UserContext.getCurrentUser().getStoreId()));
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
return ResultUtil.data(storeGoodsLabelService.listByStoreId(storeId));
}
@ApiImplicitParam(name = "id", value = "店铺商品分类ID", required = true, paramType = "path")
@ApiOperation(value = "获取店铺商品分类详情")
@GetMapping("/get/{id}")
public ResultMessage<StoreGoodsLabel> getStoreGoodsLabel(@PathVariable String id) {
return ResultUtil.data(storeGoodsLabelService.getById(id));
return ResultUtil.data(OperationalJudgment.judgment(storeGoodsLabelService.getById(id)));
}
@ApiOperation(value = "添加店铺商品分类")
@PostMapping
public ResultMessage<StoreGoodsLabel> add(@Validated StoreGoodsLabel storeGoodsLabel) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
storeGoodsLabel.setStoreId(storeId);
return ResultUtil.data(storeGoodsLabelService.addStoreGoodsLabel(storeGoodsLabel));
}
@ApiOperation(value = "修改店铺商品分类")
@PutMapping
public ResultMessage<StoreGoodsLabel> edit(@Validated StoreGoodsLabel storeGoodsLabel) {
OperationalJudgment.judgment(storeGoodsLabelService.getById(storeGoodsLabel.getId()));
return ResultUtil.data(storeGoodsLabelService.editStoreGoodsLabel(storeGoodsLabel));
}
@@ -62,6 +68,7 @@ public class GoodsLabelStoreController {
@ApiOperation(value = "删除店铺商品分类")
@DeleteMapping("/{id}")
public ResultMessage<StoreGoodsLabel> delete(@PathVariable String id) {
OperationalJudgment.judgment(storeGoodsLabelService.getById(id));
storeGoodsLabelService.removeStoreGoodsLabel(id);
return ResultUtil.success();
}

View File

@@ -1,10 +1,7 @@
package cn.lili.controller.goods;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.AuthUser;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.Goods;
import cn.lili.modules.goods.entity.dos.GoodsSku;
@@ -17,7 +14,10 @@ import cn.lili.modules.goods.entity.vos.GoodsVO;
import cn.lili.modules.goods.entity.vos.StockWarningVO;
import cn.lili.modules.goods.service.GoodsService;
import cn.lili.modules.goods.service.GoodsSkuService;
import cn.lili.modules.store.entity.dos.StoreDetail;
import cn.lili.modules.store.service.StoreDetailService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -27,6 +27,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 店铺端,商品接口
@@ -58,20 +60,18 @@ public class GoodsStoreController {
@ApiOperation(value = "分页获取商品列表")
@GetMapping(value = "/list")
public ResultMessage<IPage<Goods>> getByPage(GoodsSearchParams goodsSearchParams) {
//获取当前登录商家账号
AuthUser tokenUser = UserContext.getCurrentUser();
goodsSearchParams.setStoreId(tokenUser.getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
goodsSearchParams.setStoreId(storeId);
return ResultUtil.data(goodsService.queryByParams(goodsSearchParams));
}
@ApiOperation(value = "分页获取商品Sku列表")
@GetMapping(value = "/sku/list")
public ResultMessage<IPage<GoodsSku>> getSkuByPage(GoodsSearchParams goodsSearchParams) {
//获取当前登录商家账号
AuthUser tokenUser = UserContext.getCurrentUser();
goodsSearchParams.setStoreId(tokenUser.getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
goodsSearchParams.setStoreId(storeId);
return ResultUtil.data(goodsSkuService.getGoodsSkuByPage(goodsSearchParams));
}
@@ -79,10 +79,11 @@ public class GoodsStoreController {
@GetMapping(value = "/list/stock")
public ResultMessage<StockWarningVO> getWarningStockByPage(GoodsSearchParams goodsSearchParams) {
//获取当前登录商家账号
AuthUser tokenUser = UserContext.getCurrentUser();
Integer stockWarnNum = storeDetailService.getStoreDetail(tokenUser.getStoreId()).getStockWarning();
goodsSearchParams.setStoreId(tokenUser.getStoreId());
goodsSearchParams.setQuantity(storeDetailService.getStoreDetail(tokenUser.getStoreId()).getStockWarning());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
StoreDetail storeDetail = OperationalJudgment.judgment(storeDetailService.getStoreDetail(storeId));
Integer stockWarnNum = storeDetail.getStockWarning();
goodsSearchParams.setStoreId(storeId);
goodsSearchParams.setQuantity(stockWarnNum);
goodsSearchParams.setMarketEnable(GoodsStatusEnum.UPPER.name());
IPage<GoodsSku> goodsSku = goodsSkuService.getGoodsSkuByPage(goodsSearchParams);
StockWarningVO stockWarning = new StockWarningVO(stockWarnNum, goodsSku);
@@ -93,19 +94,13 @@ public class GoodsStoreController {
@ApiOperation(value = "通过id获取")
@GetMapping(value = "/get/{id}")
public ResultMessage<GoodsVO> get(@PathVariable String id) {
AuthUser tokenUser = UserContext.getCurrentUser();
GoodsVO goods = goodsService.getGoodsVO(id);
assert tokenUser != null;
if (tokenUser.getStoreId().equals(goods.getStoreId())) {
return ResultUtil.data(goods);
}
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
GoodsVO goods = OperationalJudgment.judgment(goodsService.getGoodsVO(id));
return ResultUtil.data(goods);
}
@ApiOperation(value = "新增商品")
@PostMapping(value = "/create", consumes = "application/json", produces = "application/json")
public ResultMessage<GoodsOperationDTO> save(@RequestBody GoodsOperationDTO goodsOperationDTO) {
goodsService.addGoods(goodsOperationDTO);
return ResultUtil.success();
}
@@ -156,14 +151,22 @@ public class GoodsStoreController {
@ApiOperation(value = "根据goodsId分页获取商品规格列表")
@GetMapping(value = "/sku/{goodsId}/list")
public ResultMessage<List<GoodsSkuVO>> getSkuByList(@PathVariable String goodsId) {
return ResultUtil.data(goodsSkuService.getGoodsListByGoodsId(goodsId));
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
return ResultUtil.data(goodsSkuService.getGoodsSkuVOList(goodsSkuService.list(new LambdaQueryWrapper<GoodsSku>().eq(GoodsSku::getGoodsId, goodsId).eq(GoodsSku::getStoreId, storeId))));
}
@ApiOperation(value = "修改商品库存")
@PutMapping(value = "/update/stocks", consumes = "application/json")
public ResultMessage<Object> updateStocks(@RequestBody List<GoodsSkuStockDTO> updateStockList) {
goodsSkuService.updateStocks(updateStockList);
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
// 获取商品skuId集合
List<String> goodsSkuIds = updateStockList.stream().map(GoodsSkuStockDTO::getSkuId).collect(Collectors.toList());
// 根据skuId集合查询商品信息
List<GoodsSku> goodsSkuList = goodsSkuService.list(new LambdaQueryWrapper<GoodsSku>().in(GoodsSku::getId, goodsSkuIds).eq(GoodsSku::getStoreId, storeId));
// 过滤不符合当前店铺的商品
List<String> filterGoodsSkuIds = goodsSkuList.stream().map(GoodsSku::getId).collect(Collectors.toList());
List<GoodsSkuStockDTO> collect = updateStockList.stream().filter(i -> filterGoodsSkuIds.contains(i.getSkuId())).collect(Collectors.toList());
goodsSkuService.updateStocks(collect);
return ResultUtil.success();
}

View File

@@ -22,7 +22,7 @@ import java.util.List;
* 店铺端,直播商品接口
*
* @author Bulbasaur
* @since: 2021/5/17 2:05 下午
* @since 2021/5/17 2:05 下午
*/
@RestController
@Api(tags = "店铺端,直播商品接口")

View File

@@ -3,11 +3,13 @@ package cn.lili.controller.other.broadcast;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.Studio;
import cn.lili.modules.goods.entity.vos.StudioVO;
import cn.lili.modules.goods.service.StudioService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -17,11 +19,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* 店铺端,直播间接口
*
* @author Bulbasaur
* @since: 2021/5/17 2:05 下午
* @since 2021/5/17 2:05 下午
*/
@RestController
@Api(tags = "店铺端,直播间接口")
@@ -42,13 +46,13 @@ public class StudioStoreController {
@ApiImplicitParam(name = "studioId", value = "直播间ID", required = true, dataType = "String", paramType = "path")
@GetMapping("/studioInfo/{studioId}")
public ResultMessage<StudioVO> studioInfo(@PathVariable String studioId) {
return ResultUtil.data(studioService.getStudioVO(studioId));
return ResultUtil.data(OperationalJudgment.judgment(studioService.getStudioVO(studioId)));
}
@ApiOperation(value = "添加直播间")
@PostMapping
public ResultMessage<Object> add(@Validated Studio studio) {
if (studioService.create(studio)) {
if (Boolean.TRUE.equals(studioService.create(studio))) {
return ResultUtil.success(ResultCode.SUCCESS);
}
throw new ServiceException(ResultCode.ERROR);
@@ -57,7 +61,8 @@ public class StudioStoreController {
@ApiOperation(value = "修改直播间")
@PutMapping("/edit")
public ResultMessage<Object> edit(Studio studio) {
if (studioService.edit(studio)) {
OperationalJudgment.judgment(studioService.getById(studio.getId()));
if (Boolean.TRUE.equals(studioService.edit(studio))) {
return ResultUtil.success(ResultCode.SUCCESS);
}
throw new ServiceException(ResultCode.ERROR);
@@ -70,7 +75,8 @@ public class StudioStoreController {
})
@PutMapping(value = "/push/{roomId}/{liveGoodsId}")
public ResultMessage<Studio> push(@PathVariable Integer roomId, @PathVariable Integer liveGoodsId) {
if (studioService.push(roomId, liveGoodsId)) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
if (Boolean.TRUE.equals(studioService.push(roomId, liveGoodsId, storeId))) {
return ResultUtil.success(ResultCode.SUCCESS);
}
throw new ServiceException(ResultCode.ERROR);
@@ -83,7 +89,8 @@ public class StudioStoreController {
})
@DeleteMapping(value = "/deleteInRoom/{roomId}/{liveGoodsId}")
public ResultMessage<Studio> deleteInRoom(@PathVariable Integer roomId, @PathVariable Integer liveGoodsId) {
if (studioService.goodsDeleteInRoom(roomId, liveGoodsId)) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
if (Boolean.TRUE.equals(studioService.goodsDeleteInRoom(roomId, liveGoodsId, storeId))) {
return ResultUtil.success(ResultCode.SUCCESS);
}
throw new ServiceException(ResultCode.ERROR);

View File

@@ -1,7 +1,7 @@
package cn.lili.controller.other.distribution;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.distribution.entity.dos.DistributionGoods;
import cn.lili.modules.distribution.entity.dos.DistributionSelectedGoods;
@@ -9,6 +9,7 @@ import cn.lili.modules.distribution.entity.dto.DistributionGoodsSearchParams;
import cn.lili.modules.distribution.entity.vos.DistributionGoodsVO;
import cn.lili.modules.distribution.service.DistributionGoodsService;
import cn.lili.modules.distribution.service.DistributionSelectedGoodsService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
@@ -18,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.Objects;
/**
* 店铺端,分销商品接口
@@ -54,13 +56,16 @@ public class DistributionGoodsStoreController {
@PutMapping(value = "/checked/{skuId}")
public ResultMessage<DistributionGoods> distributionCheckGoods(@NotNull(message = "规格ID不能为空") @PathVariable String skuId,
@NotNull(message = "佣金金额不能为空") @RequestParam Double commission) {
return ResultUtil.data(distributionGoodsService.checked(skuId, commission));
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
return ResultUtil.data(distributionGoodsService.checked(skuId, commission, storeId));
}
@ApiOperation(value = "取消分销商品")
@ApiImplicitParam(name = "id", value = "分销商商品ID", required = true, paramType = "path")
@DeleteMapping(value = "/cancel/{id}")
public ResultMessage<Object> cancel(@NotNull @PathVariable String id) {
OperationalJudgment.judgment(distributionGoodsService.getById(id));
//清除分销商已选择分销商品
distributionSelectedGoodsService.remove(new QueryWrapper<DistributionSelectedGoods>().eq("distribution_goods_id", id));
//清除分销商品

View File

@@ -1,7 +1,7 @@
package cn.lili.controller.other.distribution;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.distribution.entity.dos.DistributionOrder;
import cn.lili.modules.distribution.entity.vos.DistributionOrderSearchParams;
@@ -14,6 +14,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Objects;
/**
* 店铺端,分销订单接口
*
@@ -34,9 +36,9 @@ public class DistributionOrderStoreController {
@ApiOperation(value = "获取分销订单列表")
@GetMapping
public ResultMessage<IPage<DistributionOrder>> distributionOrder(DistributionOrderSearchParams distributionOrderSearchParams) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
//获取当前登录商家账号-查询当前店铺的分销订单
distributionOrderSearchParams.setStoreId(UserContext.getCurrentUser().getStoreId());
distributionOrderSearchParams.setStoreId(storeId);
//查询分销订单列表
IPage<DistributionOrder> distributionOrderPage = distributionOrderService.getDistributionOrderPage(distributionOrderSearchParams);
return ResultUtil.data(distributionOrderPage);

View File

@@ -1,10 +1,10 @@
package cn.lili.controller.promotion;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.AuthUser;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.promotion.entity.dos.Coupon;
@@ -12,6 +12,8 @@ import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum;
import cn.lili.modules.promotion.entity.vos.CouponSearchParams;
import cn.lili.modules.promotion.entity.vos.CouponVO;
import cn.lili.modules.promotion.service.CouponService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -20,6 +22,8 @@ import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 店铺端,优惠券接口
@@ -39,8 +43,8 @@ public class CouponStoreController {
@ApiOperation(value = "获取优惠券列表")
public ResultMessage<IPage<CouponVO>> getCouponList(CouponSearchParams queryParam, PageVO page) {
page.setNotConvert(true);
AuthUser currentUser = UserContext.getCurrentUser();
queryParam.setStoreId(currentUser.getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
queryParam.setStoreId(storeId);
IPage<CouponVO> coupons = couponService.getCouponsByPageFromMongo(queryParam, page);
return ResultUtil.data(coupons);
}
@@ -48,18 +52,14 @@ public class CouponStoreController {
@ApiOperation(value = "获取优惠券详情")
@GetMapping("/{couponId}")
public ResultMessage<Coupon> getCouponList(@PathVariable String couponId) {
AuthUser currentUser = UserContext.getCurrentUser();
Coupon coupon = couponService.getCouponDetailFromMongo(couponId);
if (coupon == null || !coupon.getStoreId().equals(currentUser.getStoreId())) {
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
}
CouponVO coupon = OperationalJudgment.judgment(couponService.getCouponDetailFromMongo(couponId));
return ResultUtil.data(coupon);
}
@ApiOperation(value = "添加优惠券")
@PostMapping(consumes = "application/json", produces = "application/json")
public ResultMessage<CouponVO> addCoupon(@RequestBody CouponVO couponVO) {
AuthUser currentUser = UserContext.getCurrentUser();
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
couponVO.setStoreId(currentUser.getStoreId());
couponVO.setStoreName(currentUser.getStoreName());
couponService.add(couponVO);
@@ -69,14 +69,11 @@ public class CouponStoreController {
@PutMapping(consumes = "application/json", produces = "application/json")
@ApiOperation(value = "修改优惠券")
public ResultMessage<Coupon> updateCoupon(@RequestBody CouponVO couponVO) {
AuthUser currentUser = UserContext.getCurrentUser();
OperationalJudgment.judgment(couponService.getCouponDetailFromMongo(couponVO.getId()));
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
couponVO.setStoreId(currentUser.getStoreId());
couponVO.setStoreName(currentUser.getStoreName());
couponVO.setPromotionStatus(PromotionStatusEnum.NEW.name());
Coupon byId = couponService.getById(couponVO.getId());
if (!currentUser.getStoreId().equals(byId.getStoreId())) {
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
}
CouponVO coupon = couponService.updateCoupon(couponVO);
return ResultUtil.data(coupon);
}
@@ -84,12 +81,13 @@ public class CouponStoreController {
@DeleteMapping(value = "/{ids}")
@ApiOperation(value = "批量删除")
public ResultMessage<Object> delAllByIds(@PathVariable List<String> ids) {
AuthUser currentUser = UserContext.getCurrentUser();
Coupon byId = couponService.getById(ids.get(0));
if (!currentUser.getStoreId().equals(byId.getStoreId())) {
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
}
for (String id : ids) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
LambdaQueryWrapper<Coupon> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(Coupon::getId, ids);
queryWrapper.eq(Coupon::getStoreId, storeId);
List<Coupon> list = couponService.list(queryWrapper);
List<String> filterIds = list.stream().map(Coupon::getId).collect(Collectors.toList());
for (String id : filterIds) {
couponService.deleteCoupon(id);
}
return ResultUtil.success();
@@ -98,8 +96,10 @@ public class CouponStoreController {
@ApiOperation(value = "修改优惠券状态")
@PutMapping("/status")
public ResultMessage<Object> updateCouponStatus(String couponIds, String promotionStatus) {
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
String[] split = couponIds.split(",");
if (couponService.updateCouponStatus(Arrays.asList(split), PromotionStatusEnum.valueOf(promotionStatus))) {
List<String> couponIdList = couponService.list(new LambdaQueryWrapper<Coupon>().in(Coupon::getId, Arrays.asList(split)).eq(Coupon::getStoreId, currentUser.getStoreId())).stream().map(Coupon::getId).collect(Collectors.toList());
if (couponService.updateCouponStatus(couponIdList, PromotionStatusEnum.valueOf(promotionStatus))) {
return ResultUtil.success(ResultCode.COUPON_EDIT_STATUS_SUCCESS);
}
throw new ServiceException(ResultCode.COUPON_EDIT_STATUS_ERROR);

View File

@@ -11,6 +11,7 @@ import cn.lili.modules.promotion.entity.dos.FullDiscount;
import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum;
import cn.lili.modules.promotion.entity.vos.FullDiscountSearchParams;
import cn.lili.modules.promotion.service.FullDiscountService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -19,6 +20,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* 店铺端,满额活动接口
*
@@ -36,7 +39,7 @@ public class FullDiscountStoreController {
@ApiOperation(value = "新增满优惠活动")
@PostMapping(consumes = "application/json", produces = "application/json")
public ResultMessage<FullDiscount> addFullDiscount(@RequestBody FullDiscountVO fullDiscountVO) {
AuthUser currentUser = UserContext.getCurrentUser();
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
fullDiscountVO.setStoreId(currentUser.getStoreId());
fullDiscountVO.setStoreName(currentUser.getStoreName());
fullDiscountVO.setPromotionStatus(PromotionStatusEnum.NEW.name());
@@ -47,14 +50,14 @@ public class FullDiscountStoreController {
@ApiOperation(value = "通过id获取")
@GetMapping("/{id}")
public ResultMessage<FullDiscountVO> get(@PathVariable String id) {
FullDiscountVO fullDiscount = fullDiscountService.getFullDiscount(id);
FullDiscountVO fullDiscount = OperationalJudgment.judgment(fullDiscountService.getFullDiscount(id));
return ResultUtil.data(fullDiscount);
}
@ApiOperation(value = "根据条件分页查询满优惠活动")
@GetMapping
public ResultMessage<IPage<FullDiscountVO>> getFullDiscountByPage(FullDiscountSearchParams searchParams, PageVO page) {
String storeId = UserContext.getCurrentUser().getStoreId();
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
searchParams.setStoreId(storeId);
IPage<FullDiscountVO> fullDiscountByPage = fullDiscountService.getFullDiscountByPageFromMongo(searchParams, page);
return ResultUtil.data(fullDiscountByPage);
@@ -63,7 +66,8 @@ public class FullDiscountStoreController {
@ApiOperation(value = "修改满优惠活动")
@PutMapping(consumes = "application/json", produces = "application/json")
public ResultMessage<String> editFullDiscount(@RequestBody FullDiscountVO fullDiscountVO) {
AuthUser currentUser = UserContext.getCurrentUser();
OperationalJudgment.judgment(fullDiscountService.getFullDiscount(fullDiscountVO.getId()));
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
fullDiscountVO.setStoreId(currentUser.getStoreId());
fullDiscountVO.setStoreName(currentUser.getStoreName());
fullDiscountService.modifyFullDiscount(fullDiscountVO);
@@ -73,6 +77,7 @@ public class FullDiscountStoreController {
@ApiOperation(value = "删除满优惠活动")
@DeleteMapping("/{id}")
public ResultMessage<String> deleteFullDiscount(@PathVariable String id) {
OperationalJudgment.judgment(fullDiscountService.getFullDiscount(id));
fullDiscountService.deleteFullDiscount(id);
return ResultUtil.success(ResultCode.FULL_DISCOUNT_EDIT_DELETE);
}
@@ -85,6 +90,7 @@ public class FullDiscountStoreController {
})
@PutMapping("/status/{id}/{promotionStatus}")
public ResultMessage<Object> updateCouponStatus(@PathVariable String id, @PathVariable String promotionStatus) {
OperationalJudgment.judgment(fullDiscountService.getFullDiscount(id));
if (fullDiscountService.updateFullDiscountStatus(id, PromotionStatusEnum.valueOf(promotionStatus))) {
return ResultUtil.success(ResultCode.SUCCESS);
}

View File

@@ -1,19 +1,20 @@
package cn.lili.controller.promotion;
import cn.lili.common.enums.PromotionTypeEnum;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.AuthUser;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.promotion.entity.dto.PromotionGoodsDTO;
import cn.lili.common.enums.PromotionTypeEnum;
import cn.lili.modules.promotion.entity.vos.PintuanSearchParams;
import cn.lili.modules.promotion.entity.vos.PintuanVO;
import cn.lili.modules.promotion.entity.vos.PromotionGoodsSearchParams;
import cn.lili.modules.promotion.service.PintuanService;
import cn.lili.modules.promotion.service.PromotionGoodsService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -22,6 +23,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.Objects;
/**
* 店铺端,拼团管理接口
@@ -43,7 +45,7 @@ public class PintuanStoreController {
@GetMapping
@ApiOperation(value = "根据条件分页查询拼团活动列表")
public ResultMessage<IPage<PintuanVO>> getPintuanByPage(PintuanSearchParams queryParam, PageVO pageVo) {
AuthUser currentUser = UserContext.getCurrentUser();
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
queryParam.setStoreId(currentUser.getStoreId());
IPage<PintuanVO> pintuanByPageFromMongo = pintuanService.getPintuanByPageFromMongo(queryParam, pageVo);
return ResultUtil.data(pintuanByPageFromMongo);
@@ -52,13 +54,16 @@ public class PintuanStoreController {
@GetMapping(value = "/{id}")
@ApiOperation(value = "通过id获取")
public ResultMessage<PintuanVO> get(@PathVariable String id) {
return ResultUtil.data(pintuanService.getPintuanByIdFromMongo(id));
PintuanVO pintuan = OperationalJudgment.judgment(pintuanService.getPintuanByIdFromMongo(id));
return ResultUtil.data(pintuan);
}
@GetMapping("/goods/{pintuanId}")
@ApiOperation(value = "根据条件分页查询拼团活动商品列表")
public ResultMessage<IPage<PromotionGoodsDTO>> getPintuanGoodsByPage(@PathVariable String pintuanId, PageVO pageVo) {
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
PromotionGoodsSearchParams searchParams = new PromotionGoodsSearchParams();
searchParams.setStoreId(currentUser.getStoreId());
searchParams.setPromotionId(pintuanId);
searchParams.setPromotionType(PromotionTypeEnum.PINTUAN.name());
IPage<PromotionGoodsDTO> promotionGoods = promotionGoodsService.getPromotionGoods(searchParams, pageVo);
@@ -68,7 +73,7 @@ public class PintuanStoreController {
@PostMapping(consumes = "application/json", produces = "application/json")
@ApiOperation(value = "添加拼团活动")
public ResultMessage<String> addPintuan(@RequestBody @Validated PintuanVO pintuan) {
AuthUser currentUser = UserContext.getCurrentUser();
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
pintuan.setStoreId(currentUser.getStoreId());
pintuan.setStoreName(currentUser.getStoreName());
if (pintuanService.addPintuan(pintuan)) {
@@ -80,7 +85,8 @@ public class PintuanStoreController {
@PutMapping(consumes = "application/json", produces = "application/json")
@ApiOperation(value = "修改拼团活动")
public ResultMessage<String> editPintuan(@RequestBody @Validated PintuanVO pintuan) {
AuthUser currentUser = UserContext.getCurrentUser();
OperationalJudgment.judgment(pintuanService.getPintuanByIdFromMongo(pintuan.getId()));
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
pintuan.setStoreId(currentUser.getStoreId());
pintuan.setStoreName(currentUser.getStoreName());
if (pintuanService.modifyPintuan(pintuan)) {
@@ -92,6 +98,7 @@ public class PintuanStoreController {
@PutMapping("/open/{pintuanId}")
@ApiOperation(value = "手动开启拼团活动")
public ResultMessage<String> openPintuan(@PathVariable String pintuanId, Long startTime, Long endTime) {
OperationalJudgment.judgment(pintuanService.getPintuanByIdFromMongo(pintuanId));
if (pintuanService.openPintuan(pintuanId, new Date(startTime), new Date(endTime))) {
return ResultUtil.success(ResultCode.PINTUAN_MANUAL_OPEN_SUCCESS);
}
@@ -102,6 +109,7 @@ public class PintuanStoreController {
@PutMapping("/close/{pintuanId}")
@ApiOperation(value = "手动关闭拼团活动")
public ResultMessage<String> closePintuan(@PathVariable String pintuanId) {
OperationalJudgment.judgment(pintuanService.getPintuanByIdFromMongo(pintuanId));
if (pintuanService.closePintuan(pintuanId)) {
return ResultUtil.success(ResultCode.PINTUAN_MANUAL_CLOSE_SUCCESS);
}
@@ -111,6 +119,7 @@ public class PintuanStoreController {
@DeleteMapping("/{pintuanId}")
@ApiOperation(value = "手动删除拼团活动")
public ResultMessage<String> deletePintuan(@PathVariable String pintuanId) {
OperationalJudgment.judgment(pintuanService.getPintuanByIdFromMongo(pintuanId));
if (pintuanService.deletePintuan(pintuanId)) {
return ResultUtil.success(ResultCode.PINTUAN_DELETE_SUCCESS);
}

View File

@@ -11,6 +11,7 @@ import cn.lili.modules.promotion.entity.vos.SeckillSearchParams;
import cn.lili.modules.promotion.entity.vos.SeckillVO;
import cn.lili.modules.promotion.service.SeckillApplyService;
import cn.lili.modules.promotion.service.SeckillService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -18,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 店铺端,秒杀活动接口
@@ -44,7 +46,7 @@ public class SeckillStoreController {
@GetMapping("/apply")
@ApiOperation(value = "获取秒杀活动申请列表")
public ResultMessage<IPage<SeckillApply>> getSeckillApplyPage(SeckillSearchParams queryParam, PageVO pageVo) {
String storeId = UserContext.getCurrentUser().getStoreId();
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
queryParam.setStoreId(storeId);
IPage<SeckillApply> seckillPage = seckillApplyService.getSeckillApplyFromMongo(queryParam, pageVo);
return ResultUtil.data(seckillPage);
@@ -59,20 +61,22 @@ public class SeckillStoreController {
@GetMapping("/apply/{seckillApplyId}")
@ApiOperation(value = "获取秒杀活动申请")
public ResultMessage<SeckillApply> getSeckillApply(@PathVariable String seckillApplyId) {
return ResultUtil.data(seckillApplyService.getById(seckillApplyId));
SeckillApply seckillApply = OperationalJudgment.judgment(seckillApplyService.getById(seckillApplyId));
return ResultUtil.data(seckillApply);
}
@PostMapping(path = "/apply/{seckillId}", consumes = "application/json", produces = "application/json")
@ApiOperation(value = "添加秒杀活动申请")
public ResultMessage<String> addSeckillApply(@PathVariable String seckillId, @RequestBody List<SeckillApplyVO> applyVos) {
String storeId = UserContext.getCurrentUser().getStoreId();
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
seckillApplyService.addSeckillApply(seckillId, storeId, applyVos);
return ResultUtil.success();
}
@DeleteMapping("/apply/{seckillId}/{id}")
@ApiOperation(value = "删除秒杀活动商品")
public ResultMessage<String> deleteSeckillApply(@PathVariable String seckillId,@PathVariable String id) {
public ResultMessage<String> deleteSeckillApply(@PathVariable String seckillId, @PathVariable String id) {
OperationalJudgment.judgment(seckillApplyService.getById(id));
seckillApplyService.removeSeckillApply(seckillId, id);
return ResultUtil.success();
}

View File

@@ -5,6 +5,7 @@ import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.store.entity.vos.FreightTemplateVO;
import cn.lili.modules.store.service.FreightTemplateService;
import cn.lili.modules.system.utils.OperationalJudgment;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Objects;
/**
* 店铺端,运费模板接口
@@ -29,26 +31,31 @@ public class FreightTemplateStoreController {
@ApiOperation(value = "商家运费模板列表")
@GetMapping
private ResultMessage<List<FreightTemplateVO>> list() {
return ResultUtil.data(freightTemplateService.getFreightTemplateList(UserContext.getCurrentUser().getStoreId()));
public ResultMessage<List<FreightTemplateVO>> list() {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
return ResultUtil.data(freightTemplateService.getFreightTemplateList(storeId));
}
@ApiOperation(value = "获取商家运费模板详情")
@ApiImplicitParam(name = "id", value = "商家模板ID", required = true, paramType = "path")
@GetMapping("/{id}")
private ResultMessage<FreightTemplateVO> list(@PathVariable String id) {
return ResultUtil.data(freightTemplateService.getFreightTemplate(id));
public ResultMessage<FreightTemplateVO> list(@PathVariable String id) {
FreightTemplateVO freightTemplate = OperationalJudgment.judgment(freightTemplateService.getFreightTemplate(id));
return ResultUtil.data(freightTemplate);
}
@ApiOperation(value = "添加商家运费模板")
@PostMapping
public ResultMessage<FreightTemplateVO> add(@Valid @RequestBody FreightTemplateVO freightTemplateVO) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
freightTemplateVO.setStoreId(storeId);
return ResultUtil.data(freightTemplateService.addFreightTemplate(freightTemplateVO));
}
@ApiOperation(value = "修改商家运费模板")
@PutMapping("/{id}")
public ResultMessage<FreightTemplateVO> edit(@PathVariable String id, @RequestBody @Valid FreightTemplateVO freightTemplateVO) {
OperationalJudgment.judgment(freightTemplateService.getFreightTemplate(id));
return ResultUtil.data(freightTemplateService.editFreightTemplate(freightTemplateVO));
}
@@ -56,6 +63,7 @@ public class FreightTemplateStoreController {
@ApiImplicitParam(name = "id", value = "商家模板ID", required = true, paramType = "path")
@DeleteMapping("/{id}")
public ResultMessage<Object> edit(@PathVariable String id) {
OperationalJudgment.judgment(freightTemplateService.getFreightTemplate(id));
freightTemplateService.removeFreightTemplate(id);
return ResultUtil.success();
}

View File

@@ -1,7 +1,7 @@
package cn.lili.controller.settings;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.common.vo.SearchVO;
@@ -15,12 +15,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Objects;
/**
* 店铺端,日志管理接口
*
* @author Chopper
* @since: 2020/11/22 14:23
* @since 2020/11/22 14:23
*/
@RestController
@Transactional(rollbackFor = Exception.class)
@@ -37,6 +39,7 @@ public class LogStoreController {
String operatorName,
SearchVO searchVo,
PageVO pageVo) {
return ResultUtil.data(systemLogService.queryLog(UserContext.getCurrentUser().getStoreId(), operatorName, key, searchVo, pageVo));
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
return ResultUtil.data(systemLogService.queryLog(storeId, operatorName, key, searchVo, pageVo));
}
}

View File

@@ -1,12 +1,13 @@
package cn.lili.controller.settings;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.store.entity.dos.StoreLogistics;
import cn.lili.modules.system.entity.vo.StoreLogisticsVO;
import cn.lili.modules.system.service.StoreLogisticsService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
@@ -14,12 +15,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 店铺端,物流公司接口
*
* @author Bulbasaur
* @since: 2020/11/22 14:23
* @since 2020/11/22 14:23
*/
@RestController
@Api(tags = "店铺端,物流公司接口")
@@ -35,20 +37,23 @@ public class LogisticsStoreController {
@ApiOperation(value = "获取商家物流公司列表如果已选择则checked有值")
@GetMapping
public ResultMessage<List<StoreLogisticsVO>> get() {
return ResultUtil.data(storeLogisticsService.getStoreLogistics());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
return ResultUtil.data(storeLogisticsService.getStoreLogistics(storeId));
}
@ApiOperation(value = "获取商家已选择物流公司列表")
@GetMapping("/getChecked")
public ResultMessage<List<StoreLogisticsVO>> getChecked() {
return ResultUtil.data(storeLogisticsService.getStoreSelectedLogistics());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
return ResultUtil.data(storeLogisticsService.getStoreSelectedLogistics(storeId));
}
@ApiOperation(value = "选择物流公司")
@ApiImplicitParam(name = "logisticsId", value = "物流公司ID", required = true, paramType = "path")
@PostMapping("/{logisticsId}")
public ResultMessage<StoreLogistics> checked(@PathVariable String logisticsId) {
return ResultUtil.data(storeLogisticsService.add(logisticsId));
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
return ResultUtil.data(storeLogisticsService.add(logisticsId, storeId));
}
@@ -56,8 +61,9 @@ public class LogisticsStoreController {
@ApiImplicitParam(name = "id", value = "物流公司ID", required = true, paramType = "path")
@DeleteMapping(value = "/{id}")
public ResultMessage<Object> cancel(@PathVariable String id) {
storeLogisticsService.removeById(id);
return ResultUtil.success();
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
boolean remove = storeLogisticsService.remove(new LambdaQueryWrapper<StoreLogistics>().eq(StoreLogistics::getId, id).eq(StoreLogistics::getStoreId, storeId));
return ResultUtil.data(remove);
}
}

View File

@@ -1,13 +1,13 @@
package cn.lili.controller.settings;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.store.entity.dos.StoreAddress;
import cn.lili.modules.store.service.StoreAddressService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -16,12 +16,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Objects;
/**
* 店铺端,商家地址(自提点)接口
*
* @author Bulbasaur
* @since: 2020/11/22 14:23
* @since 2020/11/22 14:23
*/
@RestController
@Api(tags = "店铺端,商家地址(自提点)接口")
@@ -37,20 +38,23 @@ public class StoreAddressController {
@ApiOperation(value = "获取商家自提点分页")
@GetMapping
public ResultMessage<IPage<StoreAddress>> get(PageVO pageVo) {
return ResultUtil.data(storeAddressService.getStoreAddress(pageVo));
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
return ResultUtil.data(storeAddressService.getStoreAddress(storeId, pageVo));
}
@ApiOperation(value = "获取商家自提点信息")
@ApiImplicitParam(name = "id", value = "自提点ID", required = true, paramType = "path")
@GetMapping("/{id}")
public ResultMessage<StoreAddress> get(@PathVariable String id) {
return ResultUtil.data(storeAddressService.getById(id));
StoreAddress address = OperationalJudgment.judgment(storeAddressService.getById(id));
return ResultUtil.data(address);
}
@ApiOperation(value = "添加")
@PostMapping
public ResultMessage<StoreAddress> add(@Valid StoreAddress storeAddress) {
storeAddress.setStoreId(UserContext.getCurrentUser().getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
storeAddress.setStoreId(storeId);
storeAddressService.save(storeAddress);
return ResultUtil.data(storeAddress);
}
@@ -59,8 +63,10 @@ public class StoreAddressController {
@ApiImplicitParam(name = "id", value = "自提点ID", required = true, paramType = "path")
@PutMapping("/{id}")
public ResultMessage<StoreAddress> edit(@PathVariable String id, @Valid StoreAddress storeAddress) {
OperationalJudgment.judgment(storeAddressService.getById(id));
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
storeAddress.setId(id);
storeAddress.setStoreId(UserContext.getCurrentUser().getStoreId());
storeAddress.setStoreId(storeId);
storeAddressService.updateById(storeAddress);
return ResultUtil.data(storeAddress);
}
@@ -69,6 +75,7 @@ public class StoreAddressController {
@ApiImplicitParam(name = "id", value = "自提点ID", required = true, paramType = "path")
@DeleteMapping(value = "/{id}")
public ResultMessage<Object> delByIds(@PathVariable String id) {
OperationalJudgment.judgment(storeAddressService.getById(id));
storeAddressService.removeStoreAddress(id);
return ResultUtil.success();
}

View File

@@ -1,14 +1,15 @@
package cn.lili.controller.settings;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.message.entity.dos.StoreMessage;
import cn.lili.modules.message.entity.enums.MessageStatusEnum;
import cn.lili.modules.message.entity.vos.StoreMessageQueryVO;
import cn.lili.modules.message.service.StoreMessageService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -18,12 +19,13 @@ import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* 店铺端,消息接口
*
* @author Bulbasaur
* @since: 2020/11/22 14:23
* @since 2020/11/22 14:23
*/
@RestController
@Api(tags = "店铺端,消息接口")
@@ -40,9 +42,10 @@ public class StoreMessageController {
@ApiImplicitParam(name = "status", value = "状态", required = true, paramType = "query")
@GetMapping
public ResultMessage<IPage<StoreMessage>> getPage(String status, PageVO pageVo) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
StoreMessageQueryVO storeMessageQueryVO = new StoreMessageQueryVO();
storeMessageQueryVO.setStatus(status);
storeMessageQueryVO.setStoreId(UserContext.getCurrentUser().getStoreId());
storeMessageQueryVO.setStoreId(storeId);
IPage<StoreMessage> page = storeMessageService.getPage(storeMessageQueryVO, pageVo);
return ResultUtil.data(page);
}
@@ -51,10 +54,11 @@ public class StoreMessageController {
@ApiOperation(value = "获取商家消息总汇")
@GetMapping("/all")
public ResultMessage<Map<String, Object>> getPage(PageVO pageVo) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
//返回值定义
Map<String, Object> map = new HashMap<>(4);
StoreMessageQueryVO storeMessageQueryVO = new StoreMessageQueryVO();
storeMessageQueryVO.setStoreId(UserContext.getCurrentUser().getStoreId());
storeMessageQueryVO.setStoreId(storeId);
//未读消息
storeMessageQueryVO.setStatus(MessageStatusEnum.UN_READY.name());
IPage<StoreMessage> page = storeMessageService.getPage(storeMessageQueryVO, pageVo);
@@ -74,6 +78,7 @@ public class StoreMessageController {
@ApiImplicitParam(name = "id", value = "店铺消息id", required = true, paramType = "path")
@PutMapping("/{id}/read")
public ResultMessage<Boolean> readMessage(@PathVariable String id) {
OperationalJudgment.judgment(storeMessageService.getById(id));
Boolean result = storeMessageService.editStatus(MessageStatusEnum.ALREADY_READY.name(), id);
return ResultUtil.data(result);
@@ -83,6 +88,7 @@ public class StoreMessageController {
@ApiImplicitParam(name = "id", value = "店铺消息id", required = true, paramType = "path")
@PutMapping("/{id}/reduction")
public ResultMessage<Boolean> reductionMessage(@PathVariable String id) {
OperationalJudgment.judgment(storeMessageService.getById(id));
Boolean result = storeMessageService.editStatus(MessageStatusEnum.ALREADY_READY.name(), id);
return ResultUtil.data(result);
@@ -92,6 +98,7 @@ public class StoreMessageController {
@ApiImplicitParam(name = "id", value = "店铺消息id", required = true, paramType = "path")
@DeleteMapping("/{id}/delete")
public ResultMessage<Boolean> deleteMessage(@PathVariable String id) {
OperationalJudgment.judgment(storeMessageService.getById(id));
Boolean result = storeMessageService.editStatus(MessageStatusEnum.ALREADY_REMOVE.name(), id);
return ResultUtil.data(result);
@@ -101,6 +108,7 @@ public class StoreMessageController {
@ApiImplicitParam(name = "id", value = "店铺消息id", required = true, paramType = "path")
@DeleteMapping("/{id}")
public ResultMessage<Boolean> disabled(@PathVariable String id) {
OperationalJudgment.judgment(storeMessageService.getById(id));
Boolean result = storeMessageService.deleteByMessageId(id);
return ResultUtil.data(result);
}

View File

@@ -1,7 +1,9 @@
package cn.lili.controller.settings;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.page.entity.dos.PageData;
@@ -9,6 +11,7 @@ import cn.lili.modules.page.entity.dto.PageDataDTO;
import cn.lili.modules.page.entity.enums.PageEnum;
import cn.lili.modules.page.entity.vos.PageDataListVO;
import cn.lili.modules.page.service.PageDataService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -18,12 +21,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Objects;
/**
* 店铺端,页面接口
*
* @author paulGao
* @since: 2020/11/22 14:23
* @since 2020/11/22 14:23
*/
@RestController
@Api(tags = "店铺端,页面接口")
@@ -36,10 +40,11 @@ public class StorePageDataController {
@ApiImplicitParam(name = "pageClientType", value = "客户端类型", required = true, dataType = "String", paramType = "path")
@GetMapping("/{pageClientType}/pageDataList")
public ResultMessage<IPage<PageDataListVO>> pageDataList(@PathVariable String pageClientType, PageVO pageVO) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
PageDataDTO pageDataDTO = new PageDataDTO();
pageDataDTO.setPageType(PageEnum.STORE.name());
pageDataDTO.setPageClientType(pageClientType);
pageDataDTO.setNum(UserContext.getCurrentUser().getStoreId());
pageDataDTO.setNum(storeId);
return ResultUtil.data(pageDataService.getPageDataList(pageVO, pageDataDTO));
}
@@ -47,7 +52,9 @@ public class StorePageDataController {
@ApiImplicitParam(name = "id", value = "页面ID", required = true, dataType = "String", paramType = "path")
@GetMapping(value = "/{id}")
public ResultMessage<PageData> getPageData(@PathVariable String id) {
return ResultUtil.data(pageDataService.getById(id));
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
LambdaQueryWrapper<PageData> queryWrapper = new LambdaQueryWrapper<PageData>().eq(PageData::getId, id).eq(PageData::getPageType, PageEnum.STORE.name()).eq(PageData::getNum, storeId);
return ResultUtil.data(pageDataService.getOne(queryWrapper));
}
@ApiOperation(value = "添加店铺首页")
@@ -58,7 +65,8 @@ public class StorePageDataController {
})
@PostMapping("/save")
public ResultMessage<PageData> savePageData(@RequestParam String name, @RequestParam String pageClientType, @RequestParam String pageData) {
return ResultUtil.data(pageDataService.addPageData(new PageData(name, pageClientType, pageData)));
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
return ResultUtil.data(pageDataService.addPageData(new PageData(name, pageClientType, pageData, storeId)));
}
@ApiOperation(value = "修改首页")
@@ -67,6 +75,7 @@ public class StorePageDataController {
})
@PutMapping("/update/{id}")
public ResultMessage<PageData> updatePageData(@Valid PageData pageData, @PathVariable String id) {
this.checkAuthority(id);
pageData.setId(id);
return ResultUtil.data(pageDataService.updatePageData(pageData));
}
@@ -75,6 +84,7 @@ public class StorePageDataController {
@ApiImplicitParam(name = "id", value = "页面ID", required = true, dataType = "String", paramType = "path")
@PutMapping("/release/{id}")
public ResultMessage<PageData> releasePageData(@PathVariable String id) {
this.checkAuthority(id);
return ResultUtil.data(pageDataService.releasePageData(id));
}
@@ -82,7 +92,17 @@ public class StorePageDataController {
@ApiImplicitParam(name = "id", value = "页面ID", required = true, dataType = "String", paramType = "path")
@DeleteMapping("/removePageData/{id}")
public ResultMessage<Object> removePageData(@PathVariable String id) {
this.checkAuthority(id);
return ResultUtil.data(pageDataService.removePageData(id));
}
private void checkAuthority(String id) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
LambdaQueryWrapper<PageData> queryWrapper = new LambdaQueryWrapper<PageData>().eq(PageData::getId, id).eq(PageData::getPageType, PageEnum.STORE.name()).eq(PageData::getNum, storeId);
PageData data = pageDataService.getOne(queryWrapper);
if (data == null) {
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
}
}
}

View File

@@ -3,7 +3,6 @@ package cn.lili.controller.settings;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.store.entity.dos.StoreDetail;
import cn.lili.modules.store.entity.dto.StoreAfterSaleAddressDTO;
import cn.lili.modules.store.entity.dto.StoreSettingDTO;
import cn.lili.modules.store.entity.vos.StoreVO;
@@ -24,7 +23,7 @@ import javax.validation.Valid;
* 店铺端,店铺设置接口
*
* @author Bulbasaur
* @since: 2020/11/22 14:23
* @since 2020/11/22 14:23
*/
@RestController
@Api(tags = "店铺端,店铺设置接口")
@@ -51,19 +50,19 @@ public class StoreSettingsController {
@ApiOperation(value = "修改商家设置")
@PutMapping
public ResultMessage<StoreDetail> edit(@Valid StoreSettingDTO storeSettingDTO) {
public ResultMessage<Object> edit(@Valid StoreSettingDTO storeSettingDTO) {
//修改商家设置
storeDetailService.editStoreSetting(storeSettingDTO);
return ResultUtil.success();
Boolean result = storeDetailService.editStoreSetting(storeSettingDTO);
return ResultUtil.data(result);
}
@ApiOperation(value = "修改店铺库存预警数量")
@ApiImplicitParam(name = "stockWarning", value = "库存预警数量", required = true, dataType = "Integer", paramType = "query")
@PutMapping("/updateStockWarning")
public ResultMessage<StoreDetail> updateStockWarning(Integer stockWarning) {
public ResultMessage<Object> updateStockWarning(Integer stockWarning) {
//修改商家设置
storeDetailService.updateStockWarning(stockWarning);
return ResultUtil.success();
boolean result = storeDetailService.updateStockWarning(stockWarning);
return ResultUtil.data(result);
}
@ApiOperation(value = "获取商家退货收件地址")
@@ -75,9 +74,9 @@ public class StoreSettingsController {
@ApiOperation(value = "修改商家退货收件地址")
@PutMapping("/storeAfterSaleAddress")
public ResultMessage<StoreDetail> editStoreAfterSaleAddress(@Valid StoreAfterSaleAddressDTO storeAfterSaleAddressDTO) {
public ResultMessage<Object> editStoreAfterSaleAddress(@Valid StoreAfterSaleAddressDTO storeAfterSaleAddressDTO) {
//修改商家退货收件地址
storeDetailService.editStoreAfterSaleAddressDTO(storeAfterSaleAddressDTO);
return ResultUtil.success();
boolean result = storeDetailService.editStoreAfterSaleAddressDTO(storeAfterSaleAddressDTO);
return ResultUtil.data(result);
}
}

View File

@@ -1,7 +1,7 @@
package cn.lili.controller.statistics;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.statistics.model.dto.GoodsStatisticsQueryParam;
import cn.lili.modules.statistics.model.vo.GoodsStatisticsDataVO;
@@ -14,12 +14,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Objects;
/**
* 店铺端,商品统计接口
*
* @author Bulbasaur
* @since: 2020/11/22 14:23
* @since 2020/11/22 14:23
*/
@Api(tags = "店铺端,商品统计接口")
@RestController
@@ -35,7 +36,8 @@ public class GoodsStatisticsStoreController {
@ApiOperation(value = "获取统计列表,排行前一百的数据")
@GetMapping
public ResultMessage<List<GoodsStatisticsDataVO>> getByPage(GoodsStatisticsQueryParam statisticsQueryParam) {
statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
statisticsQueryParam.setStoreId(storeId);
return ResultUtil.data(goodsStatisticsDataService.getGoodsStatisticsData(statisticsQueryParam, 100));
}
}

View File

@@ -1,7 +1,7 @@
package cn.lili.controller.statistics;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.statistics.model.dto.GoodsStatisticsQueryParam;
import cn.lili.modules.statistics.model.vo.GoodsStatisticsDataVO;
@@ -16,12 +16,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Objects;
/**
* 店铺端,首页统计接口
*
* @author Bulbasaur
* @since: 2020/12/9 19:04
* @since 2020/12/9 19:04
*/
@Api(tags = "店铺端,首页统计接口")
@RestController
@@ -42,7 +43,8 @@ public class IndexStatisticsStoreController {
@ApiOperation(value = "获取统计列表,排行前一百的数据")
@GetMapping("/top100")
public ResultMessage<List<GoodsStatisticsDataVO>> getByPage(GoodsStatisticsQueryParam statisticsQueryParam) {
statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
statisticsQueryParam.setStoreId(storeId);
return ResultUtil.data(goodsStatisticsDataService.getGoodsStatisticsData(statisticsQueryParam, 100));
}

View File

@@ -1,7 +1,7 @@
package cn.lili.controller.statistics;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.order.entity.dos.AfterSale;
@@ -22,12 +22,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Objects;
/**
* 店铺端,订单统计接口
*
* @author Bulbasaur
* @since: 2020/12/9 19:04
* @since 2020/12/9 19:04
*/
@Slf4j
@Api(tags = "店铺端,订单统计接口")
@@ -54,11 +55,12 @@ public class OrderStatisticsStoreController {
@ApiOperation(value = "订单概览统计")
@GetMapping("/overview")
public ResultMessage<OrderOverviewVO> overview(StatisticsQueryParam statisticsQueryParam) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
try {
statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
statisticsQueryParam.setStoreId(storeId);
return ResultUtil.data(orderStatisticsDataService.overview(statisticsQueryParam));
} catch (Exception e) {
log.error("订单概览统计错误",e);
log.error("订单概览统计错误", e);
}
return null;
}
@@ -66,11 +68,12 @@ public class OrderStatisticsStoreController {
@ApiOperation(value = "订单图表统计")
@GetMapping
public ResultMessage<List<OrderStatisticsDataVO>> statisticsChart(StatisticsQueryParam statisticsQueryParam) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
try {
statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
statisticsQueryParam.setStoreId(storeId);
return ResultUtil.data(orderStatisticsDataService.statisticsChart(statisticsQueryParam));
} catch (Exception e) {
log.error("订单图表统计错误",e);
log.error("订单图表统计错误", e);
}
return null;
}
@@ -79,12 +82,12 @@ public class OrderStatisticsStoreController {
@ApiOperation(value = "订单统计")
@GetMapping("/order")
public ResultMessage<IPage<OrderSimpleVO>> order(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
try {
statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
statisticsQueryParam.setStoreId(storeId);
return ResultUtil.data(orderService.getStatistics(statisticsQueryParam, pageVO));
} catch (Exception e) {
log.error("订单统计错误",e);
log.error("订单统计错误", e);
}
return null;
}
@@ -93,7 +96,8 @@ public class OrderStatisticsStoreController {
@ApiOperation(value = "退单统计")
@GetMapping("/refund")
public ResultMessage<IPage<AfterSale>> refund(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {
statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
statisticsQueryParam.setStoreId(storeId);
return ResultUtil.data(afterSaleService.getStatistics(statisticsQueryParam, pageVO));
}
}

View File

@@ -1,7 +1,7 @@
package cn.lili.controller.statistics;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.statistics.model.dto.StatisticsQueryParam;
@@ -15,11 +15,13 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Objects;
/**
* 店铺端,退款统计接口
*
* @author Bulbasaur
* @since: 2020/12/9 19:04
* @since 2020/12/9 19:04
*/
@Api(tags = "店铺端,退款统计接口")
@RestController
@@ -32,14 +34,16 @@ public class RefundOrderStatisticsStoreController {
@ApiOperation(value = "获取退款统计列表")
@GetMapping("/getByPage")
public ResultMessage<IPage<RefundOrderStatisticsDataVO>> getByPage(PageVO pageVO, StatisticsQueryParam statisticsQueryParam) {
statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
statisticsQueryParam.setStoreId(storeId);
return ResultUtil.data(refundOrderStatisticsService.getRefundOrderStatisticsData(pageVO, statisticsQueryParam));
}
@ApiOperation(value = "获取退款统计金额")
@GetMapping("/getPrice")
public ResultMessage<Object> getPrice(StatisticsQueryParam statisticsQueryParam) {
statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
statisticsQueryParam.setStoreId(storeId);
Double price = refundOrderStatisticsService.getRefundOrderStatisticsPrice(statisticsQueryParam);
return ResultUtil.data(price);
}

View File

@@ -1,7 +1,7 @@
package cn.lili.controller.statistics;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.statistics.model.dto.StatisticsQueryParam;
import cn.lili.modules.statistics.model.vo.PlatformViewVO;
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Objects;
/**
* 店铺端,流量统计接口
@@ -31,7 +32,8 @@ public class ViewStatisticsStoreController {
@ApiOperation(value = "流量数据 表单获取")
@GetMapping("/list")
public ResultMessage<List<PlatformViewVO>> getByPage(StatisticsQueryParam queryParam) {
queryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
queryParam.setStoreId(storeId);
return ResultUtil.data(platformViewDataService.list(queryParam));
}
}

View File

@@ -1,6 +1,7 @@
package cn.lili.controller.trade;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.order.entity.dos.AfterSale;
import cn.lili.modules.order.order.entity.vo.AfterSaleSearchParams;
@@ -8,6 +9,7 @@ import cn.lili.modules.order.order.entity.vo.AfterSaleVO;
import cn.lili.modules.order.order.service.AfterSaleService;
import cn.lili.modules.store.entity.dto.StoreAfterSaleAddressDTO;
import cn.lili.modules.system.entity.vo.Traces;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Objects;
/**
* 店铺端,售后管理接口
@@ -37,18 +40,23 @@ public class AfterSaleStoreController {
@ApiImplicitParam(name = "sn", value = "售后单号", required = true, paramType = "path")
@GetMapping(value = "/{sn}")
public ResultMessage<AfterSaleVO> get(@PathVariable String sn) {
return ResultUtil.data(afterSaleService.getAfterSale(sn));
AfterSaleVO afterSale = OperationalJudgment.judgment(afterSaleService.getAfterSale(sn));
return ResultUtil.data(afterSale);
}
@ApiOperation(value = "分页获取售后服务")
@GetMapping(value = "/page")
public ResultMessage<IPage<AfterSaleVO>> getByPage(AfterSaleSearchParams searchParams) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
searchParams.setStoreId(storeId);
return ResultUtil.data(afterSaleService.getAfterSalePages(searchParams));
}
@ApiOperation(value = "获取导出售后服务列表列表")
@GetMapping(value = "/exportAfterSaleOrder")
public ResultMessage<List<AfterSale>> exportAfterSaleOrder(AfterSaleSearchParams searchParams) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
searchParams.setStoreId(storeId);
return ResultUtil.data(afterSaleService.exportAfterSaleOrder(searchParams));
}

View File

@@ -2,6 +2,7 @@ package cn.lili.controller.trade;
import cn.lili.common.context.ThreadContextHolder;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.order.entity.dos.StoreFlow;
@@ -9,6 +10,7 @@ import cn.lili.modules.store.entity.dos.Bill;
import cn.lili.modules.store.entity.dto.BillSearchParams;
import cn.lili.modules.store.entity.vos.BillListVO;
import cn.lili.modules.store.service.BillService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Objects;
/**
* 店铺端,结算单接口
@@ -36,6 +39,8 @@ public class BillStoreController {
@ApiOperation(value = "获取结算单分页")
@GetMapping(value = "/getByPage")
public ResultMessage<IPage<BillListVO>> getByPage(BillSearchParams billSearchParams) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
billSearchParams.setStoreId(storeId);
return ResultUtil.data(billService.billPage(billSearchParams));
}
@@ -43,7 +48,7 @@ public class BillStoreController {
@ApiImplicitParam(name = "id", value = "结算单ID", required = true, paramType = "path", dataType = "String")
@GetMapping(value = "/get/{id}")
public ResultMessage<Bill> get(@PathVariable String id) {
return ResultUtil.data(billService.getById(id));
return ResultUtil.data(OperationalJudgment.judgment(billService.getById(id)));
}
@ApiOperation(value = "获取商家结算单流水分页")
@@ -53,6 +58,7 @@ public class BillStoreController {
})
@GetMapping(value = "/{id}/getStoreFlow")
public ResultMessage<IPage<StoreFlow>> getStoreFlow(@PathVariable String id, String flowType, PageVO pageVO) {
OperationalJudgment.judgment(billService.getById(id));
return ResultUtil.data(billService.getStoreFlow(id, flowType, pageVO));
}
@@ -62,6 +68,7 @@ public class BillStoreController {
})
@GetMapping(value = "/{id}/getDistributionFlow")
public ResultMessage<IPage<StoreFlow>> getDistributionFlow(@PathVariable String id, PageVO pageVO) {
OperationalJudgment.judgment(billService.getById(id));
return ResultUtil.data(billService.getDistributionFlow(id, pageVO));
}
@@ -69,6 +76,7 @@ public class BillStoreController {
@ApiImplicitParam(name = "id", value = "结算单ID", required = true, paramType = "path", dataType = "String")
@PutMapping(value = "/check/{id}")
public ResultMessage<Object> examine(@PathVariable String id) {
OperationalJudgment.judgment(billService.getById(id));
billService.check(id);
return ResultUtil.success();
}
@@ -77,6 +85,7 @@ public class BillStoreController {
@ApiImplicitParam(name = "id", value = "结算单ID", required = true, paramType = "path", dataType = "String")
@GetMapping(value = "/downLoad/{id}")
public void downLoadDeliverExcel(@PathVariable String id) {
OperationalJudgment.judgment(billService.getById(id));
HttpServletResponse response = ThreadContextHolder.getHttpResponse();
billService.download(response,id);

View File

@@ -2,12 +2,12 @@ package cn.lili.controller.trade;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.security.enums.UserEnums;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.member.entity.dto.EvaluationQueryParams;
import cn.lili.modules.member.entity.vo.MemberEvaluationListVO;
import cn.lili.modules.member.entity.vo.MemberEvaluationVO;
import cn.lili.modules.member.service.MemberEvaluationService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -16,6 +16,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* 店铺端,商品评价管理接口
*
@@ -33,7 +35,8 @@ public class MemberEvaluationStoreController {
@ApiOperation(value = "分页获取会员评论列表")
@GetMapping
public ResultMessage<IPage<MemberEvaluationListVO>> getByPage(EvaluationQueryParams evaluationQueryParams) {
evaluationQueryParams.setStoreId(UserContext.getCurrentUser().getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
evaluationQueryParams.setStoreId(storeId);
return ResultUtil.data(memberEvaluationService.queryPage(evaluationQueryParams));
}
@@ -41,7 +44,7 @@ public class MemberEvaluationStoreController {
@ApiImplicitParam(name = "id", value = "评价ID", required = true, dataType = "String", paramType = "path")
@GetMapping(value = "/get/{id}")
public ResultMessage<MemberEvaluationVO> get(@PathVariable String id) {
return ResultUtil.data(memberEvaluationService.queryById(id));
return ResultUtil.data(OperationalJudgment.judgment(memberEvaluationService.queryById(id)));
}
@ApiOperation(value = "回复评价")
@@ -52,6 +55,7 @@ public class MemberEvaluationStoreController {
})
@PutMapping(value = "/reply/{id}")
public ResultMessage<MemberEvaluationVO> reply(@PathVariable String id, @RequestParam String reply, @RequestParam String replyImage) {
OperationalJudgment.judgment(memberEvaluationService.queryById(id));
memberEvaluationService.reply(id, reply, replyImage);
return ResultUtil.success();
}

View File

@@ -10,6 +10,7 @@ import cn.lili.modules.order.order.entity.enums.CommunicationOwnerEnum;
import cn.lili.modules.order.order.entity.vo.*;
import cn.lili.modules.order.order.service.OrderComplaintCommunicationService;
import cn.lili.modules.order.order.service.OrderComplaintService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -18,6 +19,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* 店铺端,交易投诉接口
*
@@ -45,13 +48,14 @@ public class OrderComplaintStoreController {
@ApiImplicitParam(name = "id", value = "投诉单ID", required = true, paramType = "path")
@GetMapping(value = "/{id}")
public ResultMessage<OrderComplaintVO> get(@PathVariable String id) {
return ResultUtil.data(orderComplaintService.getOrderComplainById(id));
return ResultUtil.data(OperationalJudgment.judgment(orderComplaintService.getOrderComplainById(id)));
}
@ApiOperation(value = "分页获取")
@GetMapping
public ResultMessage<IPage<OrderComplaint>> get(OrderComplaintSearchParams searchParams, PageVO pageVO) {
searchParams.setStoreId(UserContext.getCurrentUser().getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
searchParams.setStoreId(storeId);
return ResultUtil.data(orderComplaintService.getOrderComplainByPage(searchParams, pageVO));
}
@@ -62,7 +66,7 @@ public class OrderComplaintStoreController {
})
@PostMapping("/communication")
public ResultMessage<OrderComplaintCommunicationVO> addCommunication(@RequestParam String complainId, @RequestParam String content) {
AuthUser currentUser = UserContext.getCurrentUser();
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
OrderComplaintCommunicationVO communicationVO = new OrderComplaintCommunicationVO(complainId, content, CommunicationOwnerEnum.STORE.name(), currentUser.getStoreId(), currentUser.getUsername());
orderComplaintCommunicationService.addCommunication(communicationVO);
return ResultUtil.success();
@@ -71,7 +75,8 @@ public class OrderComplaintStoreController {
@ApiOperation(value = "修改申诉信息")
@PutMapping
public ResultMessage<OrderComplaintVO> update(OrderComplaintVO orderComplainVO) {
orderComplainVO.setStoreId(UserContext.getCurrentUser().getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
orderComplainVO.setStoreId(storeId);
orderComplaintService.updateOrderComplain(orderComplainVO);
return ResultUtil.data(orderComplainVO);
}

View File

@@ -2,8 +2,10 @@ package cn.lili.controller.trade;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.order.trade.entity.dos.OrderLog;
import cn.lili.modules.order.trade.service.OrderLogService;
import cn.lili.modules.system.utils.OperationalJudgment;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
@@ -29,10 +31,14 @@ public class OrderLogStoreController {
@Autowired
private OrderLogService orderLogService;
@Autowired
private OrderService orderService;
@ApiOperation(value = "通过订单编号获取订单日志")
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, paramType = "path")
@GetMapping(value = "/{orderSn}")
public ResultMessage<List<OrderLog>> get(@PathVariable String orderSn) {
OperationalJudgment.judgment(orderService.getBySn(orderSn));
return ResultUtil.data(orderLogService.getOrderLog(orderSn));
}
}

View File

@@ -1,9 +1,10 @@
package cn.lili.controller.trade;
import cn.lili.common.context.ThreadContextHolder;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.common.context.ThreadContextHolder;
import cn.lili.modules.member.entity.dto.MemberAddressDTO;
import cn.lili.modules.order.order.entity.dto.OrderExportDTO;
import cn.lili.modules.order.order.entity.dto.OrderSearchParams;
@@ -12,6 +13,7 @@ import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
import cn.lili.modules.order.order.service.OrderPriceService;
import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.system.service.StoreLogisticsService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -28,6 +30,7 @@ import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Objects;
/**
* 店铺端,订单接口
@@ -71,7 +74,7 @@ public class OrderStoreController {
})
@GetMapping(value = "/{orderSn}")
public ResultMessage<OrderDetailVO> detail(@NotNull @PathVariable String orderSn) {
OperationalJudgment.judgment(orderService.getBySn(orderSn));
return ResultUtil.data(orderService.queryDetail(orderSn));
}
@@ -120,7 +123,7 @@ public class OrderStoreController {
@ApiOperation(value = "根据核验码获取订单信息")
@ApiImplicitParam(name = "verificationCode", value = "核验码", required = true, paramType = "path")
@GetMapping(value = "/getOrderByVerificationCode/{verificationCode}")
public ResultMessage<Object> getOrderByVerificationCode(@PathVariable String verificationCode){
public ResultMessage<Object> getOrderByVerificationCode(@PathVariable String verificationCode) {
return ResultUtil.data(orderService.getOrderByVerificationCode(verificationCode));
}
@@ -130,25 +133,27 @@ public class OrderStoreController {
@ApiImplicitParam(name = "verificationCode", value = "核验码", required = true, paramType = "path")
})
@PutMapping(value = "/take/{orderSn}/{verificationCode}")
public ResultMessage<Object> take(@PathVariable String orderSn,@PathVariable String verificationCode) {
return ResultUtil.data(orderService.take(orderSn,verificationCode));
public ResultMessage<Object> take(@PathVariable String orderSn, @PathVariable String verificationCode) {
return ResultUtil.data(orderService.take(orderSn, verificationCode));
}
@ApiOperation(value = "查询物流踪迹")
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path")
@GetMapping(value = "/getTraces/{orderSn}")
public ResultMessage<Object> getTraces(@NotBlank(message = "订单编号不能为空") @PathVariable String orderSn) {
OperationalJudgment.judgment(orderService.getBySn(orderSn));
return ResultUtil.data(orderService.getTraces(orderSn));
}
@ApiOperation(value = "下载待发货的订单列表",produces="application/octet-stream")
@ApiOperation(value = "下载待发货的订单列表", produces = "application/octet-stream")
@GetMapping(value = "/downLoadDeliverExcel")
public void downLoadDeliverExcel() {
HttpServletResponse response = ThreadContextHolder.getHttpResponse();
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
//获取店铺已经选择物流公司列表
List<String> logisticsName = storeLogisticsService.getStoreSelectedLogisticsName();
List<String> logisticsName = storeLogisticsService.getStoreSelectedLogisticsName(storeId);
//下载订单批量发货Excel
this.orderService.getBatchDeliverList(response,logisticsName);
this.orderService.getBatchDeliverList(response, logisticsName);
}

View File

@@ -1,13 +1,15 @@
package cn.lili.controller.trade;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.order.entity.dos.Receipt;
import cn.lili.modules.order.order.entity.dto.OrderReceiptDTO;
import cn.lili.modules.order.order.entity.dto.ReceiptSearchParams;
import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.order.order.service.ReceiptService;
import cn.lili.modules.system.utils.OperationalJudgment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -15,6 +17,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* 店铺端,发票接口
*
@@ -29,10 +33,14 @@ public class ReceiptStoreController {
@Autowired
private ReceiptService receiptService;
@Autowired
private OrderService orderService;
@ApiOperation(value = "分页获取")
@GetMapping
public ResultMessage<IPage<OrderReceiptDTO>> getByPage(PageVO page, ReceiptSearchParams receiptSearchParams) {
receiptSearchParams.setStoreId(UserContext.getCurrentUser().getStoreId());
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
receiptSearchParams.setStoreId(storeId);
return ResultUtil.data(receiptService.getReceiptData(receiptSearchParams, page));
}
@@ -40,13 +48,14 @@ public class ReceiptStoreController {
@ApiImplicitParam(name = "id", value = "发票ID", required = true, dataType = "String", paramType = "path")
@GetMapping(value = "/get/{id}")
public ResultMessage<Receipt> get(@PathVariable String id) {
return ResultUtil.data(receiptService.getById(id));
return ResultUtil.data(OperationalJudgment.judgment(receiptService.getById(id)));
}
@ApiOperation(value = "开发票")
@ApiImplicitParam(name = "id", value = "发票ID", required = true, dataType = "String", paramType = "path")
@PostMapping(value = "/{id}/invoicing")
public ResultMessage<Receipt> invoicing(@PathVariable String id) {
OperationalJudgment.judgment(receiptService.getById(id));
return ResultUtil.data(receiptService.invoicing(id));
}
@@ -54,6 +63,7 @@ public class ReceiptStoreController {
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path")
@GetMapping(value = "/get/orderSn/{orderSn}")
public ResultMessage<Receipt> getByOrderSn(@PathVariable String orderSn) {
OperationalJudgment.judgment(orderService.getBySn(orderSn));
return ResultUtil.data(receiptService.getByOrderSn(orderSn));
}