初始化代码 2022-02-11前 最新版本
This commit is contained in:
32
seller-api/pom.xml
Normal file
32
seller-api/pom.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>seller-api</artifactId>
|
||||
<parent>
|
||||
<groupId>cn.lili</groupId>
|
||||
<artifactId>lili-shop-parent</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.lili</groupId>
|
||||
<artifactId>framework</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
36
seller-api/src/main/java/cn/lili/StoreApiApplication.java
Normal file
36
seller-api/src/main/java/cn/lili/StoreApiApplication.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package cn.lili;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
/**
|
||||
* 商家后台 API
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/16 10:03 下午
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableCaching
|
||||
@EnableAsync
|
||||
public class StoreApiApplication {
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public TaskExecutor primaryTaskExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
return executor;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
System.setProperty("es.set.netty.runtime.available.processors", "false");
|
||||
SpringApplication.run(StoreApiApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
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;
|
||||
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 com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,分销商品接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/11/16 10:06 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,分销商品接口")
|
||||
@RequestMapping("/store/distributionGoods")
|
||||
public class DistributionGoodsStoreController {
|
||||
|
||||
/**
|
||||
* 分销商品
|
||||
*/
|
||||
@Autowired
|
||||
private DistributionGoodsService distributionGoodsService;
|
||||
|
||||
/**
|
||||
* 已选择分销商品
|
||||
*/
|
||||
@Autowired
|
||||
private DistributionSelectedGoodsService distributionSelectedGoodsService;
|
||||
|
||||
@ApiOperation(value = "获取分销商商品列表")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<DistributionGoodsVO>> distributionGoods(DistributionGoodsSearchParams distributionGoodsSearchParams) {
|
||||
|
||||
return ResultUtil.data(distributionGoodsService.goodsPage(distributionGoodsSearchParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "选择商品参与分销")
|
||||
@ApiImplicitParam(name = "skuId", value = "规格ID", required = true, dataType = "String", paramType = "path")
|
||||
@PutMapping(value = "/checked/{skuId}")
|
||||
public ResultMessage<DistributionGoods> distributionCheckGoods(@NotNull(message = "规格ID不能为空") @PathVariable String skuId,
|
||||
@NotNull(message = "佣金金额不能为空") @RequestParam Double 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));
|
||||
//清除分销商品
|
||||
distributionGoodsService.removeById(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
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;
|
||||
import cn.lili.modules.distribution.service.DistributionOrderService;
|
||||
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.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,分销订单接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/11/16 10:06 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,分销订单接口")
|
||||
@RequestMapping("/store/distributionOrder")
|
||||
public class DistributionOrderStoreController {
|
||||
|
||||
/**
|
||||
* 分销订单
|
||||
*/
|
||||
@Autowired
|
||||
private DistributionOrderService distributionOrderService;
|
||||
|
||||
@ApiOperation(value = "获取分销订单列表")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<DistributionOrder>> distributionOrder(DistributionOrderSearchParams distributionOrderSearchParams) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
//获取当前登录商家账号-查询当前店铺的分销订单
|
||||
distributionOrderSearchParams.setStoreId(storeId);
|
||||
//查询分销订单列表
|
||||
IPage<DistributionOrder> distributionOrderPage = distributionOrderService.getDistributionOrderPage(distributionOrderSearchParams);
|
||||
return ResultUtil.data(distributionOrderPage);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.modules.goods.entity.vos.ParameterGroupVO;
|
||||
import cn.lili.modules.goods.service.CategoryParameterGroupService;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* 店铺端,分类绑定参数组管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-02-18 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,分类绑定参数组管理接口")
|
||||
@RequestMapping("/store/goods/category/parameters")
|
||||
public class CategoryParameterGroupStoreController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private CategoryParameterGroupService categoryParameterGroupService;
|
||||
|
||||
@ApiOperation(value = "查询某分类下绑定的参数信息")
|
||||
@GetMapping(value = "/{category_id}")
|
||||
@ApiImplicitParam(name = "category_id", value = "分类id", required = true, dataType = "String", paramType = "path")
|
||||
public List<ParameterGroupVO> getCategoryParam(@PathVariable("category_id") String categoryId) {
|
||||
return categoryParameterGroupService.getCategoryParams(categoryId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.modules.goods.entity.dos.Specification;
|
||||
import cn.lili.modules.goods.service.CategorySpecificationService;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* 店铺端,商品分类规格接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-02-27 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,商品分类规格接口")
|
||||
@RequestMapping("/store/goods/category/spec")
|
||||
public class CategorySpecificationStoreController {
|
||||
@Autowired
|
||||
private CategorySpecificationService categorySpecificationService;
|
||||
|
||||
|
||||
@ApiOperation(value = "查询某分类下绑定的规格信息")
|
||||
@GetMapping(value = "/{category_id}")
|
||||
@ApiImplicitParam(name = "category_id", value = "分类id", required = true, dataType = "String", paramType = "path")
|
||||
public List<Specification> getCategorySpec(@PathVariable("category_id") String categoryId) {
|
||||
return categorySpecificationService.getCategorySpecList(categoryId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
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;
|
||||
import cn.lili.modules.goods.service.CategoryBrandService;
|
||||
import cn.lili.modules.goods.service.CategoryService;
|
||||
import cn.lili.modules.store.service.StoreDetailService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
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;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,商品分类接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2021/2/20 2:26 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,商品分类接口")
|
||||
@RequestMapping("/store/goods/category")
|
||||
@CacheConfig(cacheNames = "category")
|
||||
public class CategoryStoreController {
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
/**
|
||||
* 分类品牌
|
||||
*/
|
||||
@Autowired
|
||||
private CategoryBrandService categoryBrandService;
|
||||
/**
|
||||
* 店铺详情
|
||||
*/
|
||||
@Autowired
|
||||
private StoreDetailService storeDetailService;
|
||||
|
||||
@ApiOperation(value = "获取店铺经营的分类")
|
||||
@GetMapping(value = "/all")
|
||||
public ResultMessage<List<CategoryVO>> getListAll() {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
//获取店铺经营范围
|
||||
String goodsManagementCategory = storeDetailService.getStoreDetail(storeId).getGoodsManagementCategory();
|
||||
return ResultUtil.data(this.categoryService.getStoreCategory(goodsManagementCategory.split(",")));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取所选分类关联的品牌信息")
|
||||
@GetMapping(value = "/{categoryId}/brands")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "categoryId", value = "分类id", required = true, paramType = "path"),
|
||||
})
|
||||
public List<CategoryBrandVO> queryBrands(@PathVariable String categoryId) {
|
||||
return this.categoryBrandService.getCategoryBrandList(categoryId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
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 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 = "店铺端,草稿商品接口")
|
||||
@RequestMapping("/store/draft/goods")
|
||||
public class DraftGoodsStoreController {
|
||||
@Autowired
|
||||
private DraftGoodsService draftGoodsService;
|
||||
|
||||
|
||||
@ApiOperation(value = "分页获取草稿商品列表")
|
||||
@GetMapping(value = "/page")
|
||||
public ResultMessage<IPage<DraftGoods>> getDraftGoodsByPage(DraftGoodsSearchParams searchParams) {
|
||||
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 = 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) {
|
||||
draftGoodsVO.setStoreId(storeId);
|
||||
} else if (draftGoodsVO.getStoreId() != null && !storeId.equals(draftGoodsVO.getStoreId())) {
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
draftGoodsService.saveGoodsDraft(draftGoodsVO);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除草稿商品")
|
||||
@DeleteMapping(value = "/{id}")
|
||||
public ResultMessage<String> deleteDraftGoods(@PathVariable String id) {
|
||||
OperationalJudgment.judgment(draftGoodsService.getDraftGoods(id));
|
||||
draftGoodsService.deleteGoodsDraft(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.StoreGoodsLabel;
|
||||
import cn.lili.modules.goods.entity.vos.StoreGoodsLabelVO;
|
||||
import cn.lili.modules.goods.service.StoreGoodsLabelService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* 店铺端,店铺分类接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/11/17 2:32 下午
|
||||
*/
|
||||
@Api(tags = "店铺端,店铺分类接口")
|
||||
@RestController
|
||||
@RequestMapping("/store/goods/label")
|
||||
public class GoodsLabelStoreController {
|
||||
|
||||
/**
|
||||
* 店铺分类
|
||||
*/
|
||||
@Autowired
|
||||
private StoreGoodsLabelService storeGoodsLabelService;
|
||||
|
||||
@ApiOperation(value = "获取当前店铺商品分类列表")
|
||||
@GetMapping
|
||||
public ResultMessage<List<StoreGoodsLabelVO>> list() {
|
||||
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(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));
|
||||
}
|
||||
|
||||
@ApiImplicitParam(name = "id", value = "店铺商品分类ID", required = true, paramType = "path")
|
||||
@ApiOperation(value = "删除店铺商品分类")
|
||||
@DeleteMapping("/{id}")
|
||||
public ResultMessage<StoreGoodsLabel> delete(@PathVariable String id) {
|
||||
OperationalJudgment.judgment(storeGoodsLabelService.getById(id));
|
||||
storeGoodsLabelService.removeStoreGoodsLabel(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
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;
|
||||
import cn.lili.modules.goods.entity.dto.GoodsOperationDTO;
|
||||
import cn.lili.modules.goods.entity.dto.GoodsSearchParams;
|
||||
import cn.lili.modules.goods.entity.dto.GoodsSkuStockDTO;
|
||||
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
|
||||
import cn.lili.modules.goods.entity.vos.GoodsSkuVO;
|
||||
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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 店铺端,商品接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-02-23 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,商品接口")
|
||||
@RequestMapping("/store/goods")
|
||||
public class GoodsStoreController {
|
||||
|
||||
/**
|
||||
* 商品
|
||||
*/
|
||||
@Autowired
|
||||
private GoodsService goodsService;
|
||||
/**
|
||||
* 商品sku
|
||||
*/
|
||||
@Autowired
|
||||
private GoodsSkuService goodsSkuService;
|
||||
/**
|
||||
* 店铺详情
|
||||
*/
|
||||
@Autowired
|
||||
private StoreDetailService storeDetailService;
|
||||
|
||||
@ApiOperation(value = "分页获取商品列表")
|
||||
@GetMapping(value = "/list")
|
||||
public ResultMessage<IPage<Goods>> getByPage(GoodsSearchParams goodsSearchParams) {
|
||||
//获取当前登录商家账号
|
||||
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) {
|
||||
//获取当前登录商家账号
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
goodsSearchParams.setStoreId(storeId);
|
||||
return ResultUtil.data(goodsSkuService.getGoodsSkuByPage(goodsSearchParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取库存告警商品列表")
|
||||
@GetMapping(value = "/list/stock")
|
||||
public ResultMessage<StockWarningVO> getWarningStockByPage(GoodsSearchParams goodsSearchParams) {
|
||||
//获取当前登录商家账号
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
StoreDetail storeDetail = OperationalJudgment.judgment(storeDetailService.getStoreDetail(storeId));
|
||||
Integer stockWarnNum = storeDetail.getStockWarning();
|
||||
goodsSearchParams.setStoreId(storeId);
|
||||
goodsSearchParams.setLeQuantity(stockWarnNum);
|
||||
goodsSearchParams.setMarketEnable(GoodsStatusEnum.UPPER.name());
|
||||
IPage<GoodsSku> goodsSku = goodsSkuService.getGoodsSkuByPage(goodsSearchParams);
|
||||
StockWarningVO stockWarning = new StockWarningVO(stockWarnNum, goodsSku);
|
||||
return ResultUtil.data(stockWarning);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "通过id获取")
|
||||
@GetMapping(value = "/get/{id}")
|
||||
public ResultMessage<GoodsVO> get(@PathVariable String id) {
|
||||
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(@Valid @RequestBody GoodsOperationDTO goodsOperationDTO) {
|
||||
goodsService.addGoods(goodsOperationDTO);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改商品")
|
||||
@PutMapping(value = "/update/{goodsId}", consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<GoodsOperationDTO> update(@RequestBody GoodsOperationDTO goodsOperationDTO, @PathVariable String goodsId) {
|
||||
goodsService.editGoods(goodsOperationDTO, goodsId);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "下架商品", notes = "下架商品时使用")
|
||||
@ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "query", allowMultiple = true)
|
||||
@PutMapping(value = "/under")
|
||||
public ResultMessage<Object> underGoods(@RequestParam List<String> goodsId) {
|
||||
|
||||
goodsService.updateGoodsMarketAble(goodsId, GoodsStatusEnum.DOWN, "商家下架");
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "上架商品", notes = "上架商品时使用")
|
||||
@PutMapping(value = "/up")
|
||||
@ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "query", allowMultiple = true)
|
||||
public ResultMessage<Object> unpGoods(@RequestParam List<String> goodsId) {
|
||||
goodsService.updateGoodsMarketAble(goodsId, GoodsStatusEnum.UPPER, "");
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除商品")
|
||||
@PutMapping(value = "/delete")
|
||||
@ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "query", allowMultiple = true)
|
||||
public ResultMessage<Object> deleteGoods(@RequestParam List<String> goodsId) {
|
||||
goodsService.deleteGoods(goodsId);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设置商品运费模板")
|
||||
@PutMapping(value = "/freight")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "query", allowMultiple = true),
|
||||
@ApiImplicitParam(name = "templateId", value = "运费模板ID", required = true, paramType = "query")
|
||||
})
|
||||
public ResultMessage<Object> freight(@RequestParam List<String> goodsId, @RequestParam String templateId) {
|
||||
goodsService.freight(goodsId, templateId);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据goodsId分页获取商品规格列表")
|
||||
@GetMapping(value = "/sku/{goodsId}/list")
|
||||
public ResultMessage<List<GoodsSkuVO>> getSkuByList(@PathVariable String 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) {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.GoodsUnit;
|
||||
import cn.lili.modules.goods.service.GoodsUnitService;
|
||||
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.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 店铺端,商品计量单位接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/11/26 16:15
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,商品计量单位接口")
|
||||
@RequestMapping("/store/goods/unit")
|
||||
public class GoodsUnitStoreController {
|
||||
@Autowired
|
||||
private GoodsUnitService goodsUnitService;
|
||||
|
||||
|
||||
@ApiOperation(value = "分页获取商品计量单位")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<GoodsUnit>> getByPage(PageVO pageVO) {
|
||||
return ResultUtil.data(goodsUnitService.page(PageUtil.initPage(pageVO)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
|
||||
import cn.lili.modules.goods.entity.dos.Specification;
|
||||
import cn.lili.modules.goods.service.CategorySpecificationService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* 店铺端,规格管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-02-18 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,规格接口")
|
||||
@RequestMapping("/store/goods/spec")
|
||||
public class SpecificationStoreController {
|
||||
|
||||
@Autowired
|
||||
private CategorySpecificationService categorySpecificationService;
|
||||
|
||||
@GetMapping(value = "/{categoryId}")
|
||||
@ApiOperation(value = "获取分类规格")
|
||||
public List<Specification> getSpecifications(@PathVariable String categoryId) {
|
||||
return categorySpecificationService.getCategorySpecList(categoryId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.context.ThreadContextHolder;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
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;
|
||||
import cn.lili.modules.order.order.service.StoreFlowService;
|
||||
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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,结算单接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/17 4:29 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,结算单接口")
|
||||
@RequestMapping("/store/bill")
|
||||
public class BillStoreController {
|
||||
|
||||
@Autowired
|
||||
private BillService billService;
|
||||
|
||||
@Autowired
|
||||
private StoreFlowService storeFlowService;
|
||||
|
||||
@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));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id获取结算单")
|
||||
@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(OperationalJudgment.judgment(billService.getById(id)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取商家结算单流水分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "结算单ID", required = true, paramType = "path", dataType = "String"),
|
||||
@ApiImplicitParam(name = "flowType", value = "流水类型:PAY、REFUND", paramType = "query", dataType = "String")
|
||||
})
|
||||
@GetMapping(value = "/{id}/getStoreFlow")
|
||||
public ResultMessage<IPage<StoreFlow>> getStoreFlow(@PathVariable String id, String flowType, PageVO pageVO) {
|
||||
OperationalJudgment.judgment(billService.getById(id));
|
||||
return ResultUtil.data(storeFlowService.getStoreFlow(id, flowType, pageVO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取商家分销订单流水分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "结算单ID", required = true, paramType = "path", dataType = "String")
|
||||
})
|
||||
@GetMapping(value = "/{id}/getDistributionFlow")
|
||||
public ResultMessage<IPage<StoreFlow>> getDistributionFlow(@PathVariable String id, PageVO pageVO) {
|
||||
OperationalJudgment.judgment(billService.getById(id));
|
||||
return ResultUtil.data(storeFlowService.getDistributionFlow(id, pageVO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "核对结算单")
|
||||
@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();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "下载结算单", produces = "application/octet-stream")
|
||||
@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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,商品评价管理接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,商品评价管理接口")
|
||||
@RequestMapping("/store/memberEvaluation")
|
||||
public class MemberEvaluationStoreController {
|
||||
|
||||
@Autowired
|
||||
private MemberEvaluationService memberEvaluationService;
|
||||
|
||||
@ApiOperation(value = "分页获取会员评论列表")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<MemberEvaluationListVO>> getByPage(EvaluationQueryParams evaluationQueryParams) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
evaluationQueryParams.setStoreId(storeId);
|
||||
return ResultUtil.data(memberEvaluationService.queryPage(evaluationQueryParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id获取")
|
||||
@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(OperationalJudgment.judgment(memberEvaluationService.queryById(id)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "回复评价")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "评价ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "reply", value = "回复内容", required = true, dataType = "String", paramType = "query"),
|
||||
@ApiImplicitParam(name = "replyImage", value = "回复图片", dataType = "String", paramType = "query")
|
||||
})
|
||||
@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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
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.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 店铺端,管理员接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/16 10:57
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,管理员接口")
|
||||
@RequestMapping("/store/user")
|
||||
public class StoreUserController {
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation(value = "获取当前登录用户接口")
|
||||
public ResultMessage<Member> getUserInfo() {
|
||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
||||
if (tokenUser != null) {
|
||||
Member member = memberService.findByUsername(tokenUser.getUsername());
|
||||
member.setPassword(null);
|
||||
return ResultUtil.data(member);
|
||||
}
|
||||
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package cn.lili.controller.message;
|
||||
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,消息接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/11/22 14:23
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,消息接口")
|
||||
@RequestMapping("/store/message")
|
||||
public class StoreMessageController {
|
||||
|
||||
/**
|
||||
* 商家消息
|
||||
*/
|
||||
@Autowired
|
||||
private StoreMessageService storeMessageService;
|
||||
|
||||
@ApiOperation(value = "获取商家消息")
|
||||
@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(storeId);
|
||||
IPage<StoreMessage> page = storeMessageService.getPage(storeMessageQueryVO, pageVo);
|
||||
return ResultUtil.data(page);
|
||||
}
|
||||
|
||||
|
||||
@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(storeId);
|
||||
//未读消息
|
||||
storeMessageQueryVO.setStatus(MessageStatusEnum.UN_READY.name());
|
||||
IPage<StoreMessage> page = storeMessageService.getPage(storeMessageQueryVO, pageVo);
|
||||
map.put("UN_READY", page);
|
||||
//已读消息
|
||||
storeMessageQueryVO.setStatus(MessageStatusEnum.ALREADY_READY.name());
|
||||
page = storeMessageService.getPage(storeMessageQueryVO, pageVo);
|
||||
map.put("ALREADY_READY", page);
|
||||
//回收站
|
||||
storeMessageQueryVO.setStatus(MessageStatusEnum.ALREADY_REMOVE.name());
|
||||
page = storeMessageService.getPage(storeMessageQueryVO, pageVo);
|
||||
map.put("ALREADY_REMOVE", page);
|
||||
return ResultUtil.data(map);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "已读操作")
|
||||
@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);
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "回收站还原消息")
|
||||
@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);
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除操作")
|
||||
@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);
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "彻底删除操作")
|
||||
@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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.order.aftersale.entity.dos.AfterSale;
|
||||
import cn.lili.modules.order.aftersale.entity.vo.AfterSaleSearchParams;
|
||||
import cn.lili.modules.order.aftersale.entity.vo.AfterSaleVO;
|
||||
import cn.lili.modules.order.aftersale.service.AfterSaleService;
|
||||
import cn.lili.modules.store.entity.dto.StoreAfterSaleAddressDTO;
|
||||
import cn.lili.modules.system.entity.vo.Traces;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,售后管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/17 4:29 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,售后管理接口")
|
||||
@RequestMapping("/store/afterSale")
|
||||
public class AfterSaleStoreController {
|
||||
|
||||
@Autowired
|
||||
private AfterSaleService afterSaleService;
|
||||
|
||||
@ApiOperation(value = "查看售后服务详情")
|
||||
@ApiImplicitParam(name = "sn", value = "售后单号", required = true, paramType = "path")
|
||||
@GetMapping(value = "/{sn}")
|
||||
public ResultMessage<AfterSaleVO> get(@PathVariable String 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));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "审核售后申请")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "afterSaleSn", value = "售后sn", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "serviceStatus", value = "PASS:审核通过,REFUSE:审核未通过", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "remark", value = "备注", paramType = "query"),
|
||||
@ApiImplicitParam(name = "actualRefundPrice", value = "实际退款金额", paramType = "query")
|
||||
})
|
||||
@PutMapping(value = "/review/{afterSaleSn}")
|
||||
public ResultMessage<AfterSale> review(@NotNull(message = "请选择售后单") @PathVariable String afterSaleSn,
|
||||
@NotNull(message = "请审核") String serviceStatus,
|
||||
String remark,
|
||||
Double actualRefundPrice) {
|
||||
|
||||
return ResultUtil.data(afterSaleService.review(afterSaleSn, serviceStatus, remark,actualRefundPrice));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "卖家确认收货")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "afterSaleSn", value = "售后sn", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "serviceStatus", value = "PASS:审核通过,REFUSE:审核未通过", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "remark", value = "备注", paramType = "query")
|
||||
})
|
||||
@PutMapping(value = "/confirm/{afterSaleSn}")
|
||||
public ResultMessage<AfterSale> confirm(@NotNull(message = "请选择售后单") @PathVariable String afterSaleSn,
|
||||
@NotNull(message = "请审核") String serviceStatus,
|
||||
String remark) {
|
||||
|
||||
return ResultUtil.data(afterSaleService.storeConfirm(afterSaleSn, serviceStatus, remark));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查看买家退货物流踪迹")
|
||||
@ApiImplicitParam(name = "sn", value = "售后单号", required = true, paramType = "path")
|
||||
@GetMapping(value = "/getDeliveryTraces/{sn}")
|
||||
public ResultMessage<Traces> getDeliveryTraces(@PathVariable String sn) {
|
||||
return ResultUtil.data(afterSaleService.deliveryTraces(sn));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取商家售后收件地址")
|
||||
@ApiImplicitParam(name = "sn", value = "售后单号", required = true, paramType = "path")
|
||||
@GetMapping(value = "/getStoreAfterSaleAddress/{sn}")
|
||||
public ResultMessage<StoreAfterSaleAddressDTO> getStoreAfterSaleAddress(@NotNull(message = "售后单号") @PathVariable("sn") String sn) {
|
||||
return ResultUtil.data(afterSaleService.getStoreAfterSaleAddressDTO(sn));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
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.OrderComplaint;
|
||||
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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
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 2020/12/5
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,交易投诉接口")
|
||||
@RequestMapping("/store/complain")
|
||||
public class OrderComplaintStoreController {
|
||||
|
||||
/**
|
||||
* 交易投诉
|
||||
*/
|
||||
@Autowired
|
||||
private OrderComplaintService orderComplaintService;
|
||||
|
||||
/**
|
||||
* 投诉沟通
|
||||
*/
|
||||
@Autowired
|
||||
private OrderComplaintCommunicationService orderComplaintCommunicationService;
|
||||
|
||||
@ApiOperation(value = "通过id获取")
|
||||
@ApiImplicitParam(name = "id", value = "投诉单ID", required = true, paramType = "path")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<OrderComplaintVO> get(@PathVariable String id) {
|
||||
return ResultUtil.data(OperationalJudgment.judgment(orderComplaintService.getOrderComplainById(id)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<OrderComplaint>> get(OrderComplaintSearchParams searchParams, PageVO pageVO) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
searchParams.setStoreId(storeId);
|
||||
return ResultUtil.data(orderComplaintService.getOrderComplainByPage(searchParams, pageVO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加交易投诉对话")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "complainId", value = "投诉单ID", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "content", value = "内容", required = true, paramType = "query")
|
||||
})
|
||||
@PostMapping("/communication")
|
||||
public ResultMessage<OrderComplaintCommunicationVO> addCommunication(@RequestParam String complainId, @RequestParam String content) {
|
||||
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();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改申诉信息")
|
||||
@PutMapping
|
||||
public ResultMessage<OrderComplaintVO> update(OrderComplaintVO orderComplainVO) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
orderComplainVO.setStoreId(storeId);
|
||||
orderComplaintService.updateOrderComplain(orderComplainVO);
|
||||
return ResultUtil.data(orderComplainVO);
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "申诉")
|
||||
@PutMapping("/appeal")
|
||||
public ResultMessage<OrderComplaintVO> appeal(StoreAppealVO storeAppealVO) {
|
||||
orderComplaintService.appeal(storeAppealVO);
|
||||
return ResultUtil.data(orderComplaintService.getOrderComplainById(storeAppealVO.getOrderComplaintId()));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "修改状态")
|
||||
@PutMapping(value = "/status")
|
||||
public ResultMessage<Object> updateStatus(OrderComplaintOperationParams orderComplainVO) {
|
||||
orderComplaintService.updateOrderComplainByStatus(orderComplainVO);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
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 io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 店铺端,订单日志接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/12/5
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,订单日志接口")
|
||||
@RequestMapping("/store/orderLog")
|
||||
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));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.context.ThreadContextHolder;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dto.MemberAddressDTO;
|
||||
import cn.lili.modules.member.service.StoreLogisticsService;
|
||||
import cn.lili.modules.order.order.entity.dto.OrderExportDTO;
|
||||
import cn.lili.modules.order.order.entity.dto.OrderSearchParams;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
|
||||
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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,订单接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/17 4:35 下午
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/store/orders")
|
||||
@Api(tags = "店铺端,订单接口")
|
||||
public class OrderStoreController {
|
||||
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
@Autowired
|
||||
private OrderPriceService orderPriceService;
|
||||
/**
|
||||
* 物流公司
|
||||
*/
|
||||
@Autowired
|
||||
private StoreLogisticsService storeLogisticsService;
|
||||
|
||||
|
||||
@ApiOperation(value = "查询订单列表")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<OrderSimpleVO>> queryMineOrder(OrderSearchParams orderSearchParams) {
|
||||
return ResultUtil.data(orderService.queryByParams(orderSearchParams));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "订单明细")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path")
|
||||
})
|
||||
@GetMapping(value = "/{orderSn}")
|
||||
public ResultMessage<OrderDetailVO> detail(@NotNull @PathVariable String orderSn) {
|
||||
OperationalJudgment.judgment(orderService.getBySn(orderSn));
|
||||
return ResultUtil.data(orderService.queryDetail(orderSn));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改收货人信息")
|
||||
@ApiImplicitParam(name = "orderSn", value = "订单sn", required = true, dataType = "String", paramType = "path")
|
||||
@PostMapping(value = "/update/{orderSn}/consignee")
|
||||
public ResultMessage<Object> consignee(@NotNull(message = "参数非法") @PathVariable String orderSn,
|
||||
@Valid MemberAddressDTO memberAddressDTO) {
|
||||
return ResultUtil.data(orderService.updateConsignee(orderSn, memberAddressDTO));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "修改订单价格")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "orderSn", value = "订单sn", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "orderPrice", value = "订单价格", required = true, dataType = "Double", paramType = "query"),
|
||||
})
|
||||
@PutMapping(value = "/update/{orderSn}/price")
|
||||
public ResultMessage<Object> updateOrderPrice(@PathVariable String orderSn,
|
||||
@NotNull(message = "订单价格不能为空") @RequestParam Double orderPrice) {
|
||||
return ResultUtil.data(orderPriceService.updatePrice(orderSn, orderPrice));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "订单发货")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "orderSn", value = "订单sn", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "logisticsNo", value = "发货单号", required = true, dataType = "String", paramType = "query"),
|
||||
@ApiImplicitParam(name = "logisticsId", value = "物流公司", required = true, dataType = "String", paramType = "query")
|
||||
})
|
||||
@PostMapping(value = "/{orderSn}/delivery")
|
||||
public ResultMessage<Object> delivery(@NotNull(message = "参数非法") @PathVariable String orderSn,
|
||||
@NotNull(message = "发货单号不能为空") String logisticsNo,
|
||||
@NotNull(message = "请选择物流公司") String logisticsId) {
|
||||
return ResultUtil.data(orderService.delivery(orderSn, logisticsNo, logisticsId));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "取消订单")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "reason", value = "取消原因", required = true, dataType = "String", paramType = "query")
|
||||
})
|
||||
@PostMapping(value = "/{orderSn}/cancel")
|
||||
public ResultMessage<Object> cancel(@PathVariable String orderSn, @RequestParam String reason) {
|
||||
return ResultUtil.data(orderService.cancel(orderSn, reason));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据核验码获取订单信息")
|
||||
@ApiImplicitParam(name = "verificationCode", value = "核验码", required = true, paramType = "path")
|
||||
@GetMapping(value = "/getOrderByVerificationCode/{verificationCode}")
|
||||
public ResultMessage<Object> getOrderByVerificationCode(@PathVariable String verificationCode) {
|
||||
return ResultUtil.data(orderService.getOrderByVerificationCode(verificationCode));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "订单核验")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "orderSn", value = "订单号", required = true, paramType = "path"),
|
||||
@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));
|
||||
}
|
||||
|
||||
@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")
|
||||
@GetMapping(value = "/downLoadDeliverExcel")
|
||||
public void downLoadDeliverExcel() {
|
||||
HttpServletResponse response = ThreadContextHolder.getHttpResponse();
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
//获取店铺已经选择物流公司列表
|
||||
List<String> logisticsName = storeLogisticsService.getStoreSelectedLogisticsName(storeId);
|
||||
//下载订单批量发货Excel
|
||||
this.orderService.getBatchDeliverList(response, logisticsName);
|
||||
|
||||
}
|
||||
|
||||
@PostMapping(value = "/batchDeliver", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
@ApiOperation(value = "上传文件进行订单批量发货")
|
||||
public ResultMessage<Object> batchDeliver(@RequestPart("files") MultipartFile files) {
|
||||
orderService.batchDeliver(files);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询订单导出列表")
|
||||
@GetMapping("/queryExportOrder")
|
||||
public ResultMessage<List<OrderExportDTO>> queryExportOrder(OrderSearchParams orderSearchParams) {
|
||||
return ResultUtil.data(orderService.queryExportOrder(orderSearchParams));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,发票接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/11/28 14:09
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,发票接口")
|
||||
@RequestMapping("/store/receipt")
|
||||
public class ReceiptStoreController {
|
||||
|
||||
@Autowired
|
||||
private ReceiptService receiptService;
|
||||
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<OrderReceiptDTO>> getByPage(PageVO page, ReceiptSearchParams receiptSearchParams) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
receiptSearchParams.setStoreId(storeId);
|
||||
return ResultUtil.data(receiptService.getReceiptData(receiptSearchParams, page));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id获取")
|
||||
@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(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));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过订单编号获取")
|
||||
@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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package cn.lili.controller.other.article;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.page.entity.dos.Article;
|
||||
import cn.lili.modules.page.entity.dto.ArticleSearchParams;
|
||||
import cn.lili.modules.page.entity.vos.ArticleVO;
|
||||
import cn.lili.modules.page.service.ArticleService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 店铺端,文章接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-05-06 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,文章接口")
|
||||
@RequestMapping("/store/article")
|
||||
public class ArticleStoreController {
|
||||
|
||||
/**
|
||||
* 文章
|
||||
*/
|
||||
@Autowired
|
||||
private ArticleService articleService;
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "categoryId", value = "文章分类ID", paramType = "query")
|
||||
})
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<ArticleVO>> getByPage(ArticleSearchParams articleSearchParams) {
|
||||
return ResultUtil.data(articleService.articlePage(articleSearchParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查看文章")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, paramType = "path")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<Article> get(@PathVariable String id) {
|
||||
|
||||
return ResultUtil.data(articleService.getById(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
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.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.Commodity;
|
||||
import cn.lili.modules.goods.entity.vos.CommodityVO;
|
||||
import cn.lili.modules.goods.service.CommodityService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺端,直播商品接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2021/5/17 2:05 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,直播商品接口")
|
||||
@RequestMapping("/store/broadcast/commodity")
|
||||
public class CommodityStoreController {
|
||||
|
||||
@Autowired
|
||||
private CommodityService commodityService;
|
||||
|
||||
@ApiOperation(value = "获取店铺直播商品列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "name", value = "商品名称", dataType = "String", paramType = "query"),
|
||||
@ApiImplicitParam(name = "auditStatus", value = "直播商品状态", dataType = "String", paramType = "query")
|
||||
})
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<CommodityVO>> page(String auditStatus, String name, PageVO pageVO) {
|
||||
return ResultUtil.data(commodityService.commodityList(pageVO, name, auditStatus));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加店铺直播商品")
|
||||
@ApiImplicitParam(name = "commodityList", value = "直播商品列表", paramType = "body", allowMultiple = true, dataType = "Commodity")
|
||||
@PostMapping
|
||||
public ResultMessage<Object> addCommodity(@RequestBody List<Commodity> commodityList) {
|
||||
if (commodityService.addCommodity(commodityList)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除店铺直播商品")
|
||||
@ApiImplicitParam(name = "goodsId", value = "直播商品ID", dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{goodsId}")
|
||||
public ResultMessage<Object> delete(@PathVariable String goodsId) {
|
||||
if (commodityService.deleteCommodity(goodsId)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
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.OperationalJudgment;
|
||||
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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,直播间接口")
|
||||
@RequestMapping("/store/broadcast/studio")
|
||||
public class StudioStoreController {
|
||||
|
||||
@Autowired
|
||||
private StudioService studioService;
|
||||
|
||||
@ApiOperation(value = "获取店铺直播间列表")
|
||||
@ApiImplicitParam(name = "status", value = "直播间状态", paramType = "query", dataType = "String")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<Studio>> page(PageVO pageVO, String status) {
|
||||
return ResultUtil.data(studioService.studioList(pageVO, null, status));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取店铺直播间详情")
|
||||
@ApiImplicitParam(name = "studioId", value = "直播间ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/studioInfo/{studioId}")
|
||||
public ResultMessage<StudioVO> studioInfo(@PathVariable String studioId) {
|
||||
return ResultUtil.data(OperationalJudgment.judgment(studioService.getStudioVO(studioId)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加直播间")
|
||||
@PostMapping
|
||||
public ResultMessage<Object> add(@Validated Studio studio) {
|
||||
if (Boolean.TRUE.equals(studioService.create(studio))) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改直播间")
|
||||
@PutMapping("/edit")
|
||||
public ResultMessage<Object> edit(Studio studio) {
|
||||
OperationalJudgment.judgment(studioService.getById(studio.getId()));
|
||||
if (Boolean.TRUE.equals(studioService.edit(studio))) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "店铺直播间添加商品")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roomId", value = "房间ID", required = true, dataType = "Integer", paramType = "path"),
|
||||
@ApiImplicitParam(name = "liveGoodsId", value = "直播商品ID", required = true, dataType = "Integer", paramType = "path")
|
||||
})
|
||||
@PutMapping(value = "/push/{roomId}/{liveGoodsId}")
|
||||
public ResultMessage<Studio> push(@PathVariable Integer roomId, @PathVariable Integer 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);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "店铺直播间删除商品")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roomId", value = "房间ID", required = true, dataType = "Integer", paramType = "path"),
|
||||
@ApiImplicitParam(name = "liveGoodsId", value = "直播商品ID", required = true, dataType = "Integer", paramType = "path")
|
||||
})
|
||||
@DeleteMapping(value = "/deleteInRoom/{roomId}/{liveGoodsId}")
|
||||
public ResultMessage<Studio> deleteInRoom(@PathVariable Integer roomId, @PathVariable Integer 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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.lili.controller.passport;
|
||||
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.modules.verification.entity.enums.VerificationEnums;
|
||||
import cn.lili.modules.verification.service.VerificationService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 店铺端,商家登录接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/12/22 15:02
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@Api(tags = "店铺端,商家登录接口 ")
|
||||
@RequestMapping("/store/login")
|
||||
public class StorePassportController {
|
||||
|
||||
/**
|
||||
* 会员
|
||||
*/
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
|
||||
@Autowired
|
||||
private VerificationService verificationService;
|
||||
|
||||
@ApiOperation(value = "登录接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "username", value = "用户名", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "password", value = "密码", required = true, paramType = "query")
|
||||
})
|
||||
@PostMapping("/userLogin")
|
||||
public ResultMessage<Object> userLogin(@NotNull(message = "用户名不能为空") @RequestParam String username,
|
||||
@NotNull(message = "密码不能为空") @RequestParam String password, @RequestHeader String uuid) {
|
||||
if (verificationService.check(uuid, VerificationEnums.LOGIN)) {
|
||||
return ResultUtil.data(this.memberService.usernameStoreLogin(username, password));
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.VERIFICATION_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "注销接口")
|
||||
@PostMapping("/logout")
|
||||
public ResultMessage<Object> logout() {
|
||||
this.memberService.logout(UserEnums.STORE);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改密码")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "password", value = "旧密码", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "newPassword", value = "新密码", required = true, paramType = "query")
|
||||
})
|
||||
@PostMapping("/modifyPass")
|
||||
public ResultMessage<Member> modifyPass(@NotNull(message = "旧密码不能为空") @RequestParam String password,
|
||||
@NotNull(message = "新密码不能为空") @RequestParam String newPassword) {
|
||||
return ResultUtil.data(memberService.modifyPass(password, newPassword));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "刷新token")
|
||||
@GetMapping("/refresh/{refreshToken}")
|
||||
public ResultMessage<Object> refreshToken(@NotNull(message = "刷新token不能为空") @PathVariable String refreshToken) {
|
||||
return ResultUtil.data(this.memberService.refreshStoreToken(refreshToken));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
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.OperationalJudgment;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.dos.Coupon;
|
||||
import cn.lili.modules.promotion.entity.dto.search.CouponSearchParams;
|
||||
import cn.lili.modules.promotion.entity.vos.CouponVO;
|
||||
import cn.lili.modules.promotion.service.CouponService;
|
||||
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;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 店铺端,优惠券接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/8/28
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,优惠券接口")
|
||||
@RequestMapping("/store/promotion/coupon")
|
||||
public class CouponStoreController {
|
||||
|
||||
@Autowired
|
||||
private CouponService couponService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取优惠券列表")
|
||||
public ResultMessage<IPage<CouponVO>> getCouponList(CouponSearchParams queryParam, PageVO page) {
|
||||
page.setNotConvert(true);
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
queryParam.setStoreId(storeId);
|
||||
IPage<CouponVO> coupons = couponService.pageVOFindAll(queryParam, page);
|
||||
return ResultUtil.data(coupons);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取优惠券详情")
|
||||
@GetMapping("/{couponId}")
|
||||
public ResultMessage<Coupon> getCouponList(@PathVariable String couponId) {
|
||||
CouponVO coupon = OperationalJudgment.judgment(couponService.getDetail(couponId));
|
||||
return ResultUtil.data(coupon);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加优惠券")
|
||||
@PostMapping(consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<CouponVO> addCoupon(@RequestBody CouponVO couponVO) {
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
couponVO.setStoreId(currentUser.getStoreId());
|
||||
couponVO.setStoreName(currentUser.getStoreName());
|
||||
if (couponService.savePromotions(couponVO)) {
|
||||
return ResultUtil.data(couponVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.COUPON_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
@ApiOperation(value = "修改优惠券")
|
||||
public ResultMessage<Coupon> updateCoupon(@RequestBody CouponVO couponVO) {
|
||||
OperationalJudgment.judgment(couponService.getById(couponVO.getId()));
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
couponVO.setStoreId(currentUser.getStoreId());
|
||||
couponVO.setStoreName(currentUser.getStoreName());
|
||||
if (couponService.updatePromotions(couponVO)) {
|
||||
return ResultUtil.data(couponVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.COUPON_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ApiOperation(value = "批量删除")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List<String> 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());
|
||||
return couponService.removePromotions(filterIds) ? ResultUtil.success() : ResultUtil.error(ResultCode.COUPON_DELETE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改优惠券状态")
|
||||
@PutMapping("/status")
|
||||
public ResultMessage<Object> updateCouponStatus(String couponIds, Long startTime, Long endTime) {
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
String[] split = couponIds.split(",");
|
||||
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.updateStatus(couponIdList, startTime, endTime)) {
|
||||
return ResultUtil.success(ResultCode.COUPON_EDIT_STATUS_SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.COUPON_EDIT_STATUS_ERROR);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.order.cart.entity.vo.FullDiscountVO;
|
||||
import cn.lili.modules.promotion.entity.dos.FullDiscount;
|
||||
import cn.lili.modules.promotion.entity.dto.search.FullDiscountSearchParams;
|
||||
import cn.lili.modules.promotion.service.FullDiscountService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,满额活动接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/8/19
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,满额活动接口")
|
||||
@RequestMapping("/store/promotion/fullDiscount")
|
||||
public class FullDiscountStoreController {
|
||||
|
||||
@Autowired
|
||||
private FullDiscountService fullDiscountService;
|
||||
|
||||
@ApiOperation(value = "新增满优惠活动")
|
||||
@PostMapping(consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<FullDiscount> addFullDiscount(@RequestBody FullDiscountVO fullDiscountVO) {
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
fullDiscountVO.setStoreId(currentUser.getStoreId());
|
||||
fullDiscountVO.setStoreName(currentUser.getStoreName());
|
||||
if (!fullDiscountService.savePromotions(fullDiscountVO)) {
|
||||
return ResultUtil.error(ResultCode.PINTUAN_ADD_ERROR);
|
||||
}
|
||||
return ResultUtil.data(fullDiscountVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id获取")
|
||||
@GetMapping("/{id}")
|
||||
public ResultMessage<FullDiscountVO> get(@PathVariable String id) {
|
||||
FullDiscountVO fullDiscount = OperationalJudgment.judgment(fullDiscountService.getFullDiscount(id));
|
||||
return ResultUtil.data(fullDiscount);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据条件分页查询满优惠活动")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<FullDiscount>> getFullDiscountByPage(FullDiscountSearchParams searchParams, PageVO page) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
searchParams.setStoreId(storeId);
|
||||
IPage<FullDiscount> fullDiscountByPage = fullDiscountService.pageFindAll(searchParams, page);
|
||||
return ResultUtil.data(fullDiscountByPage);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改满优惠活动")
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<String> editFullDiscount(@RequestBody FullDiscountVO fullDiscountVO) {
|
||||
OperationalJudgment.judgment(fullDiscountService.getFullDiscount(fullDiscountVO.getId()));
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
fullDiscountVO.setStoreId(currentUser.getStoreId());
|
||||
fullDiscountVO.setStoreName(currentUser.getStoreName());
|
||||
if (!fullDiscountService.updatePromotions(fullDiscountVO)) {
|
||||
return ResultUtil.error(ResultCode.PINTUAN_EDIT_ERROR);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.FULL_DISCOUNT_EDIT_SUCCESS);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除满优惠活动")
|
||||
@DeleteMapping("/{id}")
|
||||
public ResultMessage<String> deleteFullDiscount(@PathVariable String id) {
|
||||
OperationalJudgment.judgment(fullDiscountService.getById(id));
|
||||
fullDiscountService.removePromotions(Collections.singletonList(id));
|
||||
return ResultUtil.success(ResultCode.FULL_DISCOUNT_EDIT_DELETE);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "修改满额活动状态")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "满额活动ID", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "promotionStatus", value = "满额活动状态", required = true, paramType = "path")
|
||||
})
|
||||
@PutMapping("/status/{id}")
|
||||
public ResultMessage<Object> updateCouponStatus(@PathVariable String id, Long startTime, Long endTime) {
|
||||
OperationalJudgment.judgment(fullDiscountService.getFullDiscount(id));
|
||||
if (fullDiscountService.updateStatus(Collections.singletonList(id), startTime, endTime)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
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.OperationalJudgment;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.dos.Pintuan;
|
||||
import cn.lili.modules.promotion.entity.dos.PromotionGoods;
|
||||
import cn.lili.modules.promotion.entity.dto.search.PintuanSearchParams;
|
||||
import cn.lili.modules.promotion.entity.dto.search.PromotionGoodsSearchParams;
|
||||
import cn.lili.modules.promotion.entity.vos.PintuanVO;
|
||||
import cn.lili.modules.promotion.service.PintuanService;
|
||||
import cn.lili.modules.promotion.service.PromotionGoodsService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 店铺端,拼团管理接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/10/9
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,拼团管理接口")
|
||||
@RequestMapping("/store/promotion/pintuan")
|
||||
public class PintuanStoreController {
|
||||
|
||||
@Autowired
|
||||
private PintuanService pintuanService;
|
||||
@Autowired
|
||||
private PromotionGoodsService promotionGoodsService;
|
||||
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "根据条件分页查询拼团活动列表")
|
||||
public ResultMessage<IPage<Pintuan>> getPintuanByPage(PintuanSearchParams queryParam, PageVO pageVo) {
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
queryParam.setStoreId(currentUser.getStoreId());
|
||||
return ResultUtil.data(pintuanService.pageFindAll(queryParam, pageVo));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "通过id获取")
|
||||
public ResultMessage<PintuanVO> get(@PathVariable String id) {
|
||||
PintuanVO pintuan = OperationalJudgment.judgment(pintuanService.getPintuanVO(id));
|
||||
return ResultUtil.data(pintuan);
|
||||
}
|
||||
|
||||
@GetMapping("/goods/{pintuanId}")
|
||||
@ApiOperation(value = "根据条件分页查询拼团活动商品列表")
|
||||
public ResultMessage<IPage<PromotionGoods>> 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());
|
||||
return ResultUtil.data(promotionGoodsService.pageFindAll(searchParams, pageVo));
|
||||
}
|
||||
|
||||
@PostMapping(consumes = "application/json", produces = "application/json")
|
||||
@ApiOperation(value = "添加拼团活动")
|
||||
public ResultMessage<String> addPintuan(@RequestBody @Validated PintuanVO pintuan) {
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
pintuan.setStoreId(currentUser.getStoreId());
|
||||
pintuan.setStoreName(currentUser.getStoreName());
|
||||
if (pintuanService.savePromotions(pintuan)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_ADD_SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.PINTUAN_ADD_ERROR);
|
||||
}
|
||||
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
@ApiOperation(value = "修改拼团活动")
|
||||
public ResultMessage<String> editPintuan(@RequestBody @Validated PintuanVO pintuan) {
|
||||
OperationalJudgment.judgment(pintuanService.getById(pintuan.getId()));
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
pintuan.setStoreId(currentUser.getStoreId());
|
||||
pintuan.setStoreName(currentUser.getStoreName());
|
||||
if (pintuan.getPromotionGoodsList() != null && !pintuan.getPromotionGoodsList().isEmpty()) {
|
||||
List<String> skuIds = pintuan.getPromotionGoodsList().stream().map(PromotionGoods::getSkuId).collect(Collectors.toList());
|
||||
pintuan.setScopeId(ArrayUtil.join(skuIds.toArray(), ","));
|
||||
} else {
|
||||
pintuan.setScopeId(null);
|
||||
}
|
||||
if (pintuanService.updatePromotions(pintuan)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_EDIT_SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.PINTUAN_EDIT_ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/status/{pintuanId}")
|
||||
@ApiOperation(value = "操作拼团活动状态")
|
||||
public ResultMessage<String> openPintuan(@PathVariable String pintuanId, Long startTime, Long endTime) {
|
||||
OperationalJudgment.judgment(pintuanService.getById(pintuanId));
|
||||
if (pintuanService.updateStatus(Collections.singletonList(pintuanId), startTime, endTime)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_MANUAL_OPEN_SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.PINTUAN_MANUAL_OPEN_ERROR);
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping("/{pintuanId}")
|
||||
@ApiOperation(value = "手动删除拼团活动")
|
||||
public ResultMessage<String> deletePintuan(@PathVariable String pintuanId) {
|
||||
OperationalJudgment.judgment(pintuanService.getById(pintuanId));
|
||||
if (pintuanService.removePromotions(Collections.singletonList(pintuanId))) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_DELETE_SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.PINTUAN_DELETE_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.dos.Seckill;
|
||||
import cn.lili.modules.promotion.entity.dos.SeckillApply;
|
||||
import cn.lili.modules.promotion.entity.dto.search.SeckillSearchParams;
|
||||
import cn.lili.modules.promotion.entity.vos.SeckillApplyVO;
|
||||
import cn.lili.modules.promotion.service.SeckillApplyService;
|
||||
import cn.lili.modules.promotion.service.SeckillService;
|
||||
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;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,秒杀活动接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/8/26
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,秒杀活动接口")
|
||||
@RequestMapping("/store/promotion/seckill")
|
||||
public class SeckillStoreController {
|
||||
@Autowired
|
||||
private SeckillService seckillService;
|
||||
@Autowired
|
||||
private SeckillApplyService seckillApplyService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取秒杀活动列表")
|
||||
public ResultMessage<IPage<Seckill>> getSeckillPage(SeckillSearchParams queryParam, PageVO pageVo) {
|
||||
IPage<Seckill> seckillPage = seckillService.pageFindAll(queryParam, pageVo);
|
||||
return ResultUtil.data(seckillPage);
|
||||
}
|
||||
|
||||
@GetMapping("/apply")
|
||||
@ApiOperation(value = "获取秒杀活动申请列表")
|
||||
public ResultMessage<IPage<SeckillApply>> getSeckillApplyPage(SeckillSearchParams queryParam, PageVO pageVo) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
queryParam.setStoreId(storeId);
|
||||
IPage<SeckillApply> seckillPage = seckillApplyService.getSeckillApplyPage(queryParam, pageVo);
|
||||
return ResultUtil.data(seckillPage);
|
||||
}
|
||||
|
||||
@GetMapping("/{seckillId}")
|
||||
@ApiOperation(value = "获取秒杀活动信息")
|
||||
public ResultMessage<Seckill> getSeckill(@PathVariable String seckillId) {
|
||||
return ResultUtil.data(seckillService.getById(seckillId));
|
||||
}
|
||||
|
||||
@GetMapping("/apply/{seckillApplyId}")
|
||||
@ApiOperation(value = "获取秒杀活动申请")
|
||||
public ResultMessage<SeckillApply> getSeckillApply(@PathVariable String 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 = 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) {
|
||||
OperationalJudgment.judgment(seckillApplyService.getById(id));
|
||||
seckillApplyService.removeSeckillApply(seckillId, id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.lili.controller.settings;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
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 io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,运费模板接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/8/26
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,运费模板接口")
|
||||
@RequestMapping("/store/freightTemplate")
|
||||
public class FreightTemplateStoreController {
|
||||
@Autowired
|
||||
private FreightTemplateService freightTemplateService;
|
||||
|
||||
@ApiOperation(value = "商家运费模板列表")
|
||||
@GetMapping
|
||||
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}")
|
||||
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));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除商家运费模板")
|
||||
@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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package cn.lili.controller.settings;
|
||||
|
||||
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;
|
||||
import cn.lili.modules.permission.service.SystemLogService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,日志管理接口")
|
||||
@RequestMapping("/store/log")
|
||||
public class LogStoreController {
|
||||
@Autowired
|
||||
private SystemLogService systemLogService;
|
||||
|
||||
@GetMapping(value = "/getAllByPage")
|
||||
@ApiOperation(value = "分页获取全部")
|
||||
public ResultMessage<Object> getAllByPage(@RequestParam(required = false) Integer type,
|
||||
@RequestParam String key,
|
||||
String operatorName,
|
||||
SearchVO searchVo,
|
||||
PageVO pageVo) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
return ResultUtil.data(systemLogService.queryLog(storeId, operatorName, key, searchVo, pageVo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package cn.lili.controller.settings;
|
||||
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.service.StoreLogisticsService;
|
||||
import cn.lili.modules.store.entity.dos.StoreLogistics;
|
||||
import cn.lili.modules.system.entity.vo.StoreLogisticsVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,物流公司接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/11/22 14:23
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,物流公司接口")
|
||||
@RequestMapping("/store/logistics")
|
||||
public class LogisticsStoreController {
|
||||
|
||||
/**
|
||||
* 物流公司
|
||||
*/
|
||||
@Autowired
|
||||
private StoreLogisticsService storeLogisticsService;
|
||||
|
||||
@ApiOperation(value = "获取商家物流公司列表,如果已选择则checked有值")
|
||||
@GetMapping
|
||||
public ResultMessage<List<StoreLogisticsVO>> get() {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
return ResultUtil.data(storeLogisticsService.getStoreLogistics(storeId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取商家已选择物流公司列表")
|
||||
@GetMapping("/getChecked")
|
||||
public ResultMessage<List<StoreLogisticsVO>> getChecked() {
|
||||
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) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
return ResultUtil.data(storeLogisticsService.add(logisticsId, storeId));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "取消选择物流公司")
|
||||
@ApiImplicitParam(name = "id", value = "物流公司ID", required = true, paramType = "path")
|
||||
@DeleteMapping(value = "/{id}")
|
||||
public ResultMessage<Object> cancel(@PathVariable String id) {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.lili.controller.settings;
|
||||
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,商家地址(自提点)接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/11/22 14:23
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,商家地址(自提点)接口")
|
||||
@RequestMapping("/store/storeAddress")
|
||||
public class StoreAddressController {
|
||||
|
||||
/**
|
||||
* 店铺自提点
|
||||
*/
|
||||
@Autowired
|
||||
private StoreAddressService storeAddressService;
|
||||
|
||||
@ApiOperation(value = "获取商家自提点分页")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<StoreAddress>> get(PageVO 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) {
|
||||
StoreAddress address = OperationalJudgment.judgment(storeAddressService.getById(id));
|
||||
return ResultUtil.data(address);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加")
|
||||
@PostMapping
|
||||
public ResultMessage<StoreAddress> add(@Valid StoreAddress storeAddress) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
storeAddress.setStoreId(storeId);
|
||||
storeAddressService.save(storeAddress);
|
||||
return ResultUtil.data(storeAddress);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑")
|
||||
@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(storeId);
|
||||
storeAddressService.updateById(storeAddress);
|
||||
return ResultUtil.data(storeAddress);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除")
|
||||
@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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package cn.lili.controller.settings;
|
||||
|
||||
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;
|
||||
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;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,页面接口")
|
||||
@RequestMapping("/store/pageData")
|
||||
public class StorePageDataController {
|
||||
@Autowired
|
||||
private PageDataService pageDataService;
|
||||
|
||||
@ApiOperation(value = "页面列表")
|
||||
@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(storeId);
|
||||
return ResultUtil.data(pageDataService.getPageDataList(pageVO, pageDataDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取页面信息")
|
||||
@ApiImplicitParam(name = "id", value = "页面ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<PageData> getPageData(@PathVariable 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);
|
||||
return ResultUtil.data(pageDataService.getOne(queryWrapper));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加店铺首页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "name", value = "页面名称", required = true, dataType = "String", paramType = "query"),
|
||||
@ApiImplicitParam(name = "pageClientType", value = "客户端类型", required = true, dataType = "String", paramType = "query"),
|
||||
@ApiImplicitParam(name = "pageData", value = "页面数据", required = true, dataType = "String", paramType = "query")
|
||||
})
|
||||
@PostMapping("/save")
|
||||
public ResultMessage<PageData> savePageData(@RequestParam String name, @RequestParam String pageClientType, @RequestParam String pageData) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
return ResultUtil.data(pageDataService.addPageData(new PageData(name, pageClientType, pageData, storeId)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改首页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "页面ID", required = true, dataType = "String", paramType = "path")
|
||||
})
|
||||
@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));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "发布页面")
|
||||
@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));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除页面")
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package cn.lili.controller.settings;
|
||||
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.store.entity.dto.StoreAfterSaleAddressDTO;
|
||||
import cn.lili.modules.store.entity.dto.StoreSettingDTO;
|
||||
import cn.lili.modules.store.entity.vos.StoreVO;
|
||||
import cn.lili.modules.store.service.StoreDetailService;
|
||||
import cn.lili.modules.store.service.StoreService;
|
||||
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.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 店铺端,店铺设置接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/11/22 14:23
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,店铺设置接口")
|
||||
@RequestMapping("/store/settings")
|
||||
public class StoreSettingsController {
|
||||
|
||||
/**
|
||||
* 店铺
|
||||
*/
|
||||
@Autowired
|
||||
private StoreService storeService;
|
||||
/**
|
||||
* 店铺详情
|
||||
*/
|
||||
@Autowired
|
||||
private StoreDetailService storeDetailService;
|
||||
|
||||
@ApiOperation(value = "获取商家设置")
|
||||
@GetMapping
|
||||
public ResultMessage<StoreVO> get() {
|
||||
//获取当前登录商家内容
|
||||
return ResultUtil.data(storeService.getStoreDetail());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改商家设置")
|
||||
@PutMapping
|
||||
public ResultMessage<Object> edit(@Valid StoreSettingDTO storeSettingDTO) {
|
||||
//修改商家设置
|
||||
Boolean result = storeDetailService.editStoreSetting(storeSettingDTO);
|
||||
return ResultUtil.data(result);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改商家设置")
|
||||
@PutMapping("/merchantEuid")
|
||||
public ResultMessage<Object> edit(String merchantEuid) {
|
||||
//修改UDESK设置
|
||||
Boolean result = storeDetailService.editMerchantEuid(merchantEuid);
|
||||
return ResultUtil.data(result);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改店铺库存预警数量")
|
||||
@ApiImplicitParam(name = "stockWarning", value = "库存预警数量", required = true, dataType = "Integer", paramType = "query")
|
||||
@PutMapping("/updateStockWarning")
|
||||
public ResultMessage<Object> updateStockWarning(Integer stockWarning) {
|
||||
//修改商家设置
|
||||
boolean result = storeDetailService.updateStockWarning(stockWarning);
|
||||
return ResultUtil.data(result);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取商家退货收件地址")
|
||||
@GetMapping("/storeAfterSaleAddress")
|
||||
public ResultMessage<StoreAfterSaleAddressDTO> getStoreAfterSaleAddress() {
|
||||
//获取当前登录商家内容
|
||||
return ResultUtil.data(storeDetailService.getStoreAfterSaleAddressDTO());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改商家退货收件地址")
|
||||
@PutMapping("/storeAfterSaleAddress")
|
||||
public ResultMessage<Object> editStoreAfterSaleAddress(@Valid StoreAfterSaleAddressDTO storeAfterSaleAddressDTO) {
|
||||
//修改商家退货收件地址
|
||||
boolean result = storeDetailService.editStoreAfterSaleAddressDTO(storeAfterSaleAddressDTO);
|
||||
return ResultUtil.data(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.statistics.entity.dto.GoodsStatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.entity.vo.GoodsStatisticsDataVO;
|
||||
import cn.lili.modules.statistics.service.StoreFlowStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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
|
||||
*/
|
||||
@Api(tags = "店铺端,商品统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/store/statistics/goods")
|
||||
public class GoodsStatisticsStoreController {
|
||||
|
||||
/**
|
||||
* 商品统计
|
||||
*/
|
||||
@Autowired
|
||||
private StoreFlowStatisticsService storeFlowStatisticsService;
|
||||
|
||||
@ApiOperation(value = "获取统计列表,排行前一百的数据")
|
||||
@GetMapping
|
||||
public ResultMessage<List<GoodsStatisticsDataVO>> getByPage(GoodsStatisticsQueryParam statisticsQueryParam) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
statisticsQueryParam.setStoreId(storeId);
|
||||
return ResultUtil.data(storeFlowStatisticsService.getGoodsStatisticsData(statisticsQueryParam, 100));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.statistics.entity.dto.GoodsStatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.entity.vo.GoodsStatisticsDataVO;
|
||||
import cn.lili.modules.statistics.entity.vo.StoreIndexStatisticsVO;
|
||||
import cn.lili.modules.statistics.service.IndexStatisticsService;
|
||||
import cn.lili.modules.statistics.service.StoreFlowStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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
|
||||
*/
|
||||
@Api(tags = "店铺端,首页统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/store/statistics/index")
|
||||
public class IndexStatisticsStoreController {
|
||||
|
||||
/**
|
||||
* 热卖商品统计
|
||||
*/
|
||||
@Autowired
|
||||
private StoreFlowStatisticsService storeFlowStatisticsService;
|
||||
/**
|
||||
* 首页统计
|
||||
*/
|
||||
@Autowired
|
||||
private IndexStatisticsService indexStatisticsService;
|
||||
|
||||
@ApiOperation(value = "获取统计列表,排行前一百的数据")
|
||||
@GetMapping("/top100")
|
||||
public ResultMessage<List<GoodsStatisticsDataVO>> getByPage(GoodsStatisticsQueryParam statisticsQueryParam) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
statisticsQueryParam.setStoreId(storeId);
|
||||
return ResultUtil.data(storeFlowStatisticsService.getGoodsStatisticsData(statisticsQueryParam, 100));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取首页查询数据")
|
||||
@GetMapping
|
||||
public ResultMessage<StoreIndexStatisticsVO> index() {
|
||||
return ResultUtil.data(indexStatisticsService.storeIndexStatistics());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
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.aftersale.entity.dos.AfterSale;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
|
||||
import cn.lili.modules.statistics.entity.dto.StatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.entity.vo.OrderOverviewVO;
|
||||
import cn.lili.modules.statistics.entity.vo.OrderStatisticsDataVO;
|
||||
import cn.lili.modules.statistics.service.AfterSaleStatisticsService;
|
||||
import cn.lili.modules.statistics.service.OrderStatisticsService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "店铺端,订单统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/store/statistics/order")
|
||||
public class OrderStatisticsStoreController {
|
||||
|
||||
/**
|
||||
* 售后
|
||||
*/
|
||||
@Autowired
|
||||
private AfterSaleStatisticsService afterSaleStatisticsService;
|
||||
/**
|
||||
* 订单统计
|
||||
*/
|
||||
@Autowired
|
||||
private OrderStatisticsService orderStatisticsService;
|
||||
|
||||
@ApiOperation(value = "订单概览统计")
|
||||
@GetMapping("/overview")
|
||||
public ResultMessage<OrderOverviewVO> overview(StatisticsQueryParam statisticsQueryParam) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
try {
|
||||
statisticsQueryParam.setStoreId(storeId);
|
||||
return ResultUtil.data(orderStatisticsService.overview(statisticsQueryParam));
|
||||
} catch (Exception e) {
|
||||
log.error("订单概览统计错误", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "订单图表统计")
|
||||
@GetMapping
|
||||
public ResultMessage<List<OrderStatisticsDataVO>> statisticsChart(StatisticsQueryParam statisticsQueryParam) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
try {
|
||||
statisticsQueryParam.setStoreId(storeId);
|
||||
return ResultUtil.data(orderStatisticsService.statisticsChart(statisticsQueryParam));
|
||||
} catch (Exception e) {
|
||||
log.error("订单图表统计错误", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "订单统计")
|
||||
@GetMapping("/order")
|
||||
public ResultMessage<IPage<OrderSimpleVO>> order(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
try {
|
||||
statisticsQueryParam.setStoreId(storeId);
|
||||
return ResultUtil.data(orderStatisticsService.getStatistics(statisticsQueryParam, pageVO));
|
||||
} catch (Exception e) {
|
||||
log.error("订单统计错误", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "退单统计")
|
||||
@GetMapping("/refund")
|
||||
public ResultMessage<IPage<AfterSale>> refund(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
statisticsQueryParam.setStoreId(storeId);
|
||||
return ResultUtil.data(afterSaleStatisticsService.getStatistics(statisticsQueryParam, pageVO));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
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.entity.dto.StatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.entity.vo.RefundOrderStatisticsDataVO;
|
||||
import cn.lili.modules.statistics.service.RefundOrderStatisticsService;
|
||||
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.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
|
||||
*/
|
||||
@Api(tags = "店铺端,退款统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/store/statistics/refund/order")
|
||||
public class RefundOrderStatisticsStoreController {
|
||||
|
||||
@Autowired
|
||||
private RefundOrderStatisticsService refundOrderStatisticsService;
|
||||
|
||||
@ApiOperation(value = "获取退款统计列表")
|
||||
@GetMapping("/getByPage")
|
||||
public ResultMessage<IPage<RefundOrderStatisticsDataVO>> getByPage(PageVO pageVO, StatisticsQueryParam statisticsQueryParam) {
|
||||
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) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
statisticsQueryParam.setStoreId(storeId);
|
||||
Double price = refundOrderStatisticsService.getRefundOrderStatisticsPrice(statisticsQueryParam);
|
||||
return ResultUtil.data(price);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.statistics.entity.dto.StatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.entity.vo.PlatformViewVO;
|
||||
import cn.lili.modules.statistics.service.PlatformViewService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺端,流量统计接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2021/2/9 11:19
|
||||
*/
|
||||
@Api(tags = "店铺端,流量统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/store/statistics/view")
|
||||
public class ViewStatisticsStoreController {
|
||||
@Autowired
|
||||
private PlatformViewService platformViewService;
|
||||
|
||||
@ApiOperation(value = "流量数据 表单获取")
|
||||
@GetMapping("/list")
|
||||
public ResultMessage<List<PlatformViewVO>> getByPage(StatisticsQueryParam queryParam) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
queryParam.setStoreId(storeId);
|
||||
return ResultUtil.data(platformViewService.list(queryParam));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package cn.lili.security;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.cache.CachePrefix;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.enums.SecurityEnum;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.security.token.SecretKeyUtil;
|
||||
import cn.lili.common.utils.ResponseUtil;
|
||||
import com.google.gson.Gson;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.ExpiredJwtException;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Chopper
|
||||
*/
|
||||
@Slf4j
|
||||
public class StoreAuthenticationFilter extends BasicAuthenticationFilter {
|
||||
|
||||
private final Cache cache;
|
||||
|
||||
public StoreAuthenticationFilter(AuthenticationManager authenticationManager,
|
||||
Cache cache) {
|
||||
super(authenticationManager);
|
||||
this.cache = cache;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
|
||||
String accessToken = request.getHeader(SecurityEnum.HEADER_TOKEN.getValue());
|
||||
if (StrUtil.isBlank(accessToken)) {
|
||||
chain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
UsernamePasswordAuthenticationToken authentication = getAuthentication(accessToken, response);
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取token信息
|
||||
*
|
||||
* @param jwt
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
private UsernamePasswordAuthenticationToken getAuthentication(String jwt, HttpServletResponse response) {
|
||||
|
||||
try {
|
||||
Claims claims
|
||||
= Jwts.parser()
|
||||
.setSigningKey(SecretKeyUtil.generalKeyByDecoders())
|
||||
.parseClaimsJws(jwt).getBody();
|
||||
//获取存储在claims中的用户信息
|
||||
String json = claims.get(SecurityEnum.USER_CONTEXT.getValue()).toString();
|
||||
AuthUser authUser = new Gson().fromJson(json, AuthUser.class);
|
||||
|
||||
//校验redis中是否有权限
|
||||
if (cache.hasKey(CachePrefix.ACCESS_TOKEN.getPrefix(UserEnums.STORE) + jwt)) {
|
||||
//用户角色
|
||||
List<GrantedAuthority> auths = new ArrayList<>();
|
||||
auths.add(new SimpleGrantedAuthority("ROLE_" + authUser.getRole().name()));
|
||||
//构造返回信息
|
||||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(authUser.getUsername(), null, auths);
|
||||
authentication.setDetails(authUser);
|
||||
return authentication;
|
||||
}
|
||||
ResponseUtil.output(response, 403, ResponseUtil.resultMap(false, 403, "登录已失效,请重新登录"));
|
||||
return null;
|
||||
} catch (ExpiredJwtException e) {
|
||||
log.debug("user analysis exception:", e);
|
||||
} catch (Exception e) {
|
||||
log.error("user analysis exception:", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.lili.security;
|
||||
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.common.security.CustomAccessDeniedHandler;
|
||||
import cn.lili.common.utils.SpringContextUtil;
|
||||
import cn.lili.common.properties.IgnoredUrlsProperties;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.web.cors.CorsConfigurationSource;
|
||||
|
||||
/**
|
||||
* spring Security 核心配置类 Store安全配置中心
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/14 16:20
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
||||
public class StoreSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
/**
|
||||
* 忽略验权配置
|
||||
*/
|
||||
@Autowired
|
||||
private IgnoredUrlsProperties ignoredUrlsProperties;
|
||||
|
||||
/**
|
||||
* spring security -》 权限不足处理
|
||||
*/
|
||||
@Autowired
|
||||
private CustomAccessDeniedHandler accessDeniedHandler;
|
||||
|
||||
@Autowired
|
||||
private Cache<String> cache;
|
||||
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
|
||||
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = http
|
||||
.authorizeRequests();
|
||||
//配置的url 不需要授权
|
||||
for (String url : ignoredUrlsProperties.getUrls()) {
|
||||
registry.antMatchers(url).permitAll();
|
||||
}
|
||||
registry.and()
|
||||
//禁止网页iframe
|
||||
.headers().frameOptions().disable()
|
||||
.and()
|
||||
.logout()
|
||||
.permitAll()
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
//任何请求
|
||||
.anyRequest()
|
||||
//需要身份认证
|
||||
.authenticated()
|
||||
.and()
|
||||
//允许跨域
|
||||
.cors().configurationSource((CorsConfigurationSource) SpringContextUtil.getBean("corsConfigurationSource")).and()
|
||||
//关闭跨站请求防护
|
||||
.csrf().disable()
|
||||
//前后端分离采用JWT 不需要session
|
||||
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||
.and()
|
||||
//自定义权限拒绝处理类
|
||||
.exceptionHandling().accessDeniedHandler(accessDeniedHandler)
|
||||
.and()
|
||||
//添加JWT认证过滤器
|
||||
.addFilter(new StoreAuthenticationFilter(authenticationManager(), cache));
|
||||
}
|
||||
|
||||
}
|
||||
272
seller-api/src/main/resources/application.yml
Normal file
272
seller-api/src/main/resources/application.yml
Normal file
@@ -0,0 +1,272 @@
|
||||
server:
|
||||
port: 8889
|
||||
|
||||
servlet:
|
||||
context-path: /
|
||||
|
||||
tomcat:
|
||||
uri-encoding: UTF-8
|
||||
threads:
|
||||
min-spare: 50
|
||||
max: 1000
|
||||
|
||||
# 与Spring Boot 2一样,默认情况下,大多数端点都不通过http公开,我们公开了所有端点。对于生产,您应该仔细选择要公开的端点。
|
||||
management:
|
||||
# health:
|
||||
# elasticsearch:
|
||||
# enabled: false
|
||||
# datasource:
|
||||
# enabled: false
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
spring:
|
||||
# 要在其中注册的Spring Boot Admin Server的URL。
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
url: http://127.0.0.1:8000
|
||||
# mongodb
|
||||
data:
|
||||
mongodb:
|
||||
host: 192.168.2.126
|
||||
port: 27017
|
||||
database: rx-shop
|
||||
username: goboo
|
||||
password: Gb84505016
|
||||
authentication-database: admin
|
||||
# replica-set-name: mongoreplset
|
||||
cache:
|
||||
type: redis
|
||||
# Redis
|
||||
redis:
|
||||
host: 192.168.2.126
|
||||
port: 6379
|
||||
password: Gb84505016
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池最大连接数(使用负值表示没有限制) 默认 8
|
||||
max-active: 200
|
||||
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认 -1
|
||||
max-wait: 20
|
||||
# 连接池中的最大空闲连接 默认 8
|
||||
max-idle: 10
|
||||
# 连接池中的最小空闲连接 默认 8
|
||||
min-idle: 8
|
||||
# 文件大小上传配置
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 20MB
|
||||
max-request-size: 20MB
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
serialization:
|
||||
#关闭jackson 对json做解析
|
||||
fail-on-empty-beans: false
|
||||
|
||||
shardingsphere:
|
||||
datasource:
|
||||
# 数据库名称,可自定义,可以为多个,以逗号隔开,每个在这里定义的库,都要在下面定义连接属性
|
||||
names: default-datasource
|
||||
default-datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.2.126:3306/rx-shop?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&allowPublicKeyRetrieval=true&verifyServerCertificate=false&useSSL=false
|
||||
username: rx-shop
|
||||
password: J2xEZ42HwPXrDXt3
|
||||
maxActive: 20
|
||||
initialSize: 5
|
||||
maxWait: 60000
|
||||
minIdle: 5
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
#是否缓存preparedStatement,也就是PSCache。在mysql下建议关闭。 PSCache对支持游标的数据库性能提升巨大,比如说oracle。
|
||||
poolPreparedStatements: false
|
||||
#要启用PSCache,-1为关闭 必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true 可以把这个数值配置大一些,比如说100
|
||||
maxOpenPreparedStatements: -1
|
||||
#配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
|
||||
filters: stat,wall,log4j2
|
||||
#通过connectProperties属性来打开mergeSql功能;慢SQL记录
|
||||
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
|
||||
#合并多个DruidDataSource的监控数据
|
||||
useGlobalDataSourceStat: true
|
||||
loginUsername: druid
|
||||
loginPassword: druid
|
||||
# sharding:
|
||||
# default-data-source-name: default-datasource
|
||||
# #需要拆分的表,可以设置多个 在 li_order 级别即可
|
||||
# tables:
|
||||
# #需要进行分表的逻辑表名
|
||||
# li_order:
|
||||
# #实际的表结点,下面代表的是li_order_为开头的所有表,如果能确定表的范围例如按月份分表,这里的写法是data2020.li_order_$->{2020..2021}_$->{01..12} 表示例如 li_order_2020_01 li_order_2020_03 li_order_2021_01
|
||||
# actual-data-nodes: data2020.li_order_$->{2019..2021}_$->{01..12}
|
||||
# table-strategy:
|
||||
# # 分表策略,根据创建日期
|
||||
# standard:
|
||||
# sharding-column: create_time
|
||||
# #分表策略
|
||||
# precise-algorithm-class-name: cn.lili.mybatis.sharding.CreateTimeShardingTableAlgorithm
|
||||
# #范围查询实现
|
||||
# range-algorithm-class-name: cn.lili.mybatis.sharding.CreateTimeShardingTableAlgorithm
|
||||
props:
|
||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭 sql打印
|
||||
sql:
|
||||
show: true
|
||||
|
||||
# 忽略鉴权url
|
||||
ignored:
|
||||
urls:
|
||||
- /editor-app/**
|
||||
- /actuator**
|
||||
- /actuator/**
|
||||
- /MP_verify_qSyvBPhDsPdxvOhC.txt
|
||||
- /weixin/**
|
||||
- /source/**
|
||||
- /store/login/**
|
||||
- /druid/**
|
||||
- /swagger-ui.html
|
||||
- /doc.html
|
||||
- /swagger-resources/**
|
||||
- /swagger/**
|
||||
- /webjars/**
|
||||
- /v2/api-docs
|
||||
- /configuration/ui
|
||||
- /boot-admin
|
||||
- /**/*.js
|
||||
- /**/*.css
|
||||
- /**/*.png
|
||||
- /**/*.ico
|
||||
|
||||
# Swagger界面内容配置
|
||||
swagger:
|
||||
title: API接口文档
|
||||
description: Api Documentation
|
||||
version: 1.0.0
|
||||
termsOfServiceUrl:
|
||||
contact:
|
||||
name: rx
|
||||
url:
|
||||
email:
|
||||
|
||||
# Mybatis-plus
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:mapper/*.xml
|
||||
configuration:
|
||||
#缓存开启
|
||||
cache-enabled: true
|
||||
#日志
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
# 日志
|
||||
logging:
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: info
|
||||
# org.hibernate: debug
|
||||
# org.springframework: debug
|
||||
# org.springframework.data.mongodb.core: debug
|
||||
file:
|
||||
# 指定路径
|
||||
path: lili-logs
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-size: 5MB
|
||||
#加密参数
|
||||
jasypt:
|
||||
encryptor:
|
||||
password: lili
|
||||
|
||||
lili:
|
||||
system:
|
||||
isDemoSite: false
|
||||
statistics:
|
||||
# 在线人数统计 X 小时。这里设置48,即统计过去48小时每小时在线人数
|
||||
onlineMember: 48
|
||||
# 当前在线人数刷新时间间隔,单位秒,设置为600,则每10分钟刷新一次
|
||||
currentOnlineUpdate: 600
|
||||
#qq lbs 申请
|
||||
lbs:
|
||||
key: 4BYBZ-7MT6S-PUAOA-6BNWL-FJUD7-UUFXT
|
||||
sk: zhNKVrJK6UPOhqIjn8AQvG37b9sz6
|
||||
#域名
|
||||
domain:
|
||||
pc: https://pc.b2b2c.pickmall.cn
|
||||
wap: https://m.b2b2c.pickmall.cn
|
||||
store: https://store.b2b2c.pickmall.cn
|
||||
admin: https://admin.b2b2c.pickmall.cn
|
||||
#api地址
|
||||
api:
|
||||
buyer: https://buyer-api.pickmall.cn
|
||||
common: https://common-api.pickmall.cn
|
||||
manager: https://admin-api.pickmall.cn
|
||||
store: https://store-api.pickmall.cn
|
||||
|
||||
# jwt 细节设定
|
||||
jwt-setting:
|
||||
# token过期时间(分钟)
|
||||
tokenExpireTime: 60
|
||||
|
||||
# 使用Spring @Cacheable注解失效时间
|
||||
cache:
|
||||
# 过期时间 单位秒 永久不过期设为-1
|
||||
timeout: 1500
|
||||
#多线程配置
|
||||
thread:
|
||||
corePoolSize: 5
|
||||
maxPoolSize: 50
|
||||
queueCapacity: 50
|
||||
data:
|
||||
elasticsearch:
|
||||
cluster-name: elasticsearch
|
||||
cluster-nodes: 192.168.2.126:9200
|
||||
index:
|
||||
number-of-replicas: 0
|
||||
number-of-shards: 3
|
||||
index-prefix: lili
|
||||
schema: http
|
||||
# account:
|
||||
# username: elastic
|
||||
# password: LiLiShopES
|
||||
|
||||
rocketmq:
|
||||
promotion-topic: lili_promotion_topic
|
||||
promotion-group: lili_promotion_group
|
||||
msg-ext-topic: lili_msg_topic
|
||||
msg-ext-group: lili_msg_group
|
||||
goods-topic: lili_goods_topic
|
||||
goods-group: lili_goods_group
|
||||
order-topic: lili_order_topic
|
||||
order-group: lili_order_group
|
||||
member-topic: lili_member_topic
|
||||
member-group: lili_member_group
|
||||
other-topic: lili_other_topic
|
||||
other-group: lili_other_group
|
||||
notice-topic: lili_notice_topic
|
||||
notice-group: lili_notice_group
|
||||
notice-send-topic: lili_send_notice_topic
|
||||
notice-send-group: lili_send_notice_group
|
||||
after-sale-topic: lili_after_sale_topic
|
||||
after-sale-group: lili_after_sale_group
|
||||
rocketmq:
|
||||
name-server: 192.168.2.126:9876
|
||||
producer:
|
||||
group: lili_group
|
||||
send-message-timeout: 30000
|
||||
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
addresses: http://192.168.2.126:9001/xxl-job-admin
|
||||
executor:
|
||||
appname: xxl-job-executor-lilishop
|
||||
address:
|
||||
ip:
|
||||
port: 8891
|
||||
logpath: ./xxl-job/executor
|
||||
logretentiondays: 7
|
||||
43
seller-api/src/main/resources/logback-spring.xml
Normal file
43
seller-api/src/main/resources/logback-spring.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE configuration>
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<!--应用名称-->
|
||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
|
||||
<!--日志文件保存路径-->
|
||||
<springProperty scope="context" name="LOG_FILE_PATH" source="logging.file.path"/>
|
||||
<springProperty scope="context" name="LOGSTASH_SERVER" source="lili.data.logstash.server"/>
|
||||
<contextName>${APP_NAME}</contextName>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_FILE_PATH}/${APP_NAME}-%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${FILE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--输出到elk的LOGSTASH-->
|
||||
<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<!-- 配置elk日志收集 配饰的是 LOGSTASH 的地址-->
|
||||
<destination>${LOGSTASH_SERVER}</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
|
||||
<providers>
|
||||
<timestamp>
|
||||
<timeZone>UTC</timeZone>
|
||||
</timestamp>
|
||||
</providers>
|
||||
<!--自定义字段 区分项目-->
|
||||
<customFields>{"appName":"${APP_NAME}"}</customFields>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- <root level="INFO">-->
|
||||
<root>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
<appender-ref ref="LOGSTASH"/>
|
||||
</root>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user