初始化代码 2022-02-11前 最新版本
This commit is contained in:
34
manager-api/src/main/java/cn/lili/ManagerApiApplication.java
Normal file
34
manager-api/src/main/java/cn/lili/ManagerApiApplication.java
Normal file
@@ -0,0 +1,34 @@
|
||||
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 ManagerApiApplication {
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public TaskExecutor primaryTask() {
|
||||
return new ThreadPoolTaskExecutor();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.setProperty("es.set.netty.runtime.available.processors", "false");
|
||||
SpringApplication.run(ManagerApiApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.distribution.entity.dos.DistributionCash;
|
||||
import cn.lili.modules.distribution.entity.vos.DistributionCashSearchParams;
|
||||
import cn.lili.modules.distribution.service.DistributionCashService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,分销佣金管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-03-14 23:04:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,分销佣金管理接口")
|
||||
@RequestMapping("/manager/distribution/cash")
|
||||
public class DistributionCashManagerController {
|
||||
|
||||
@Autowired
|
||||
private DistributionCashService distributorCashService;
|
||||
|
||||
@ApiOperation(value = "通过id获取分销佣金详情")
|
||||
@GetMapping(value = "/get/{id}")
|
||||
public ResultMessage<DistributionCash> get(@PathVariable String id) {
|
||||
return ResultUtil.data(distributorCashService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<DistributionCash>> getByPage(DistributionCashSearchParams distributionCashSearchParams) {
|
||||
|
||||
return ResultUtil.data(distributorCashService.getDistributionCash(distributionCashSearchParams));
|
||||
}
|
||||
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "审核")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "分销佣金ID", required = true, paramType = "path", dataType = "String"),
|
||||
@ApiImplicitParam(name = "result", value = "处理结果", required = true, paramType = "query", dataType = "String")
|
||||
})
|
||||
@PostMapping(value = "/audit/{id}")
|
||||
public ResultMessage<DistributionCash> audit(@PathVariable String id, @NotNull String result) {
|
||||
return ResultUtil.data(distributorCashService.audit(id, result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.distribution.entity.dto.DistributionGoodsSearchParams;
|
||||
import cn.lili.modules.distribution.entity.vos.DistributionGoodsVO;
|
||||
import cn.lili.modules.distribution.service.DistributionGoodsService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,分销商品管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-03-14 23:04:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,分销商品管理接口")
|
||||
@RequestMapping("/manager/distribution/goods")
|
||||
public class DistributionGoodsManagerController {
|
||||
|
||||
@Autowired
|
||||
private DistributionGoodsService distributionGoodsService;
|
||||
|
||||
@GetMapping(value = "/getByPage")
|
||||
@ApiOperation(value = "分页获取")
|
||||
public ResultMessage<IPage<DistributionGoodsVO>> getByPage(DistributionGoodsSearchParams distributionGoodsSearchParams) {
|
||||
return ResultUtil.data(distributionGoodsService.goodsPage(distributionGoodsSearchParams));
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping(value = "/delByIds/{ids}")
|
||||
@ApiOperation(value = "批量删除")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
|
||||
distributionGoodsService.removeByIds(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
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.distribution.entity.dos.Distribution;
|
||||
import cn.lili.modules.distribution.entity.dto.DistributionSearchParams;
|
||||
import cn.lili.modules.distribution.service.DistributionService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,分销员管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-03-14 23:04:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,分销员管理接口")
|
||||
@RequestMapping("/manager/distribution")
|
||||
public class DistributionManagerController {
|
||||
|
||||
@Autowired
|
||||
private DistributionService distributionService;
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<Distribution>> getByPage(DistributionSearchParams distributionSearchParams, PageVO page) {
|
||||
return ResultUtil.data(distributionService.distributionPage(distributionSearchParams, page));
|
||||
}
|
||||
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "清退分销商")
|
||||
@PutMapping(value = "/retreat/{id}")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "分销商id", required = true, paramType = "path", dataType = "String")
|
||||
})
|
||||
public ResultMessage<Object> retreat(@PathVariable String id) {
|
||||
if (distributionService.retreat(id)) {
|
||||
return ResultUtil.success();
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.DISTRIBUTION_RETREAT_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "恢复分销商")
|
||||
@PutMapping(value = "/resume/{id}")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "分销商id", required = true, paramType = "path", dataType = "String")
|
||||
})
|
||||
public ResultMessage<Object> resume(@PathVariable String id) {
|
||||
if (distributionService.resume(id)) {
|
||||
return ResultUtil.success();
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.DISTRIBUTION_RETREAT_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "审核分销商")
|
||||
@PutMapping(value = "/audit/{id}")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "分销商id", required = true, paramType = "path", dataType = "String"),
|
||||
@ApiImplicitParam(name = "status", value = "审核结果,PASS 通过 REFUSE 拒绝", required = true, paramType = "query", dataType = "String")
|
||||
})
|
||||
public ResultMessage<Object> audit(@NotNull @PathVariable String id, @NotNull String status) {
|
||||
if (distributionService.audit(id, status)) {
|
||||
return ResultUtil.success();
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.DISTRIBUTION_AUDIT_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 管理端,分销订单管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-03-14 23:04:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,分销订单管理接口")
|
||||
@RequestMapping("/manager/distribution/order")
|
||||
public class DistributionOrderManagerController {
|
||||
|
||||
@Autowired
|
||||
private DistributionOrderService distributionOrderService;
|
||||
|
||||
@ApiOperation(value = "通过id获取分销订单")
|
||||
@GetMapping(value = "/get/{id}")
|
||||
public ResultMessage<DistributionOrder> get(@PathVariable String id) {
|
||||
|
||||
return ResultUtil.data(distributionOrderService.getById(id));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "分页获取分销订单")
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<DistributionOrder>> getByPage(DistributionOrderSearchParams distributionOrderSearchParams) {
|
||||
|
||||
return ResultUtil.data(distributionOrderService.getDistributionOrderPage(distributionOrderSearchParams));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package cn.lili.controller.file;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.file.entity.File;
|
||||
import cn.lili.modules.file.service.FileService;
|
||||
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.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,文件管理管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/26 15:41
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,文件管理管理接口")
|
||||
@RequestMapping("/manager/file")
|
||||
public class FileManagerController {
|
||||
|
||||
@Autowired
|
||||
private FileService fileService;
|
||||
|
||||
|
||||
@ApiOperation(value = "管理端管理所有图片")
|
||||
@GetMapping
|
||||
@ApiImplicitParam(name = "title", value = "名称模糊匹配")
|
||||
public ResultMessage<IPage<File>> adminFiles(File file, SearchVO searchVO, PageVO pageVo) {
|
||||
|
||||
return ResultUtil.data(fileService.customerPage(file, searchVO, pageVo));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "文件重命名")
|
||||
@PostMapping(value = "/rename")
|
||||
public ResultMessage<File> upload(String id, String newName) {
|
||||
File file = fileService.getById(id);
|
||||
file.setName(newName);
|
||||
fileService.updateById(file);
|
||||
return ResultUtil.data(file);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "文件删除")
|
||||
@DeleteMapping(value = "/delete/{ids}")
|
||||
public ResultMessage delete(@PathVariable List<String> ids) {
|
||||
fileService.batchDelete(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.Brand;
|
||||
import cn.lili.modules.goods.entity.dto.BrandPageDTO;
|
||||
import cn.lili.modules.goods.entity.vos.BrandVO;
|
||||
import cn.lili.modules.goods.service.BrandService;
|
||||
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.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,品牌接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-02-18 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,品牌接口")
|
||||
@RequestMapping("/manager/goods/brand")
|
||||
public class BrandManagerController {
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
@Autowired
|
||||
private BrandService brandService;
|
||||
|
||||
@ApiOperation(value = "通过id获取")
|
||||
@ApiImplicitParam(name = "id", value = "品牌ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/get/{id}")
|
||||
public ResultMessage<Brand> get(@NotNull @PathVariable String id) {
|
||||
return ResultUtil.data(brandService.getById(id));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/all")
|
||||
@ApiOperation(value = "获取所有可用品牌")
|
||||
public List<Brand> getAll() {
|
||||
List<Brand> list = brandService.list(new QueryWrapper<Brand>().eq("delete_flag", 0));
|
||||
return list;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<Brand>> getByPage(BrandPageDTO page) {
|
||||
return ResultUtil.data(brandService.getBrandsByPage(page));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增品牌")
|
||||
@PostMapping
|
||||
public ResultMessage<BrandVO> save(@Valid BrandVO brand) {
|
||||
if (brandService.addBrand(brand)) {
|
||||
return ResultUtil.data(brand);
|
||||
}
|
||||
throw new ServiceException(ResultCode.BRAND_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新数据")
|
||||
@ApiImplicitParam(name = "id", value = "品牌ID", required = true, dataType = "String", paramType = "path")
|
||||
@PutMapping("/{id}")
|
||||
public ResultMessage<BrandVO> update(@PathVariable String id, @Valid BrandVO brand) {
|
||||
brand.setId(id);
|
||||
if (brandService.updateBrand(brand)) {
|
||||
return ResultUtil.data(brand);
|
||||
}
|
||||
throw new ServiceException(ResultCode.BRAND_UPDATE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "后台禁用品牌")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "brandId", value = "品牌ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "disable", value = "是否可用", required = true, dataType = "boolean", paramType = "query")
|
||||
})
|
||||
@PutMapping(value = "/disable/{brandId}")
|
||||
public ResultMessage<Object> disable(@PathVariable String brandId, @RequestParam Boolean disable) {
|
||||
if (brandService.brandDisable(brandId, disable)) {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
throw new ServiceException(ResultCode.BRAND_DISABLE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@ApiImplicitParam(name = "ids", value = "品牌ID", required = true, dataType = "String", allowMultiple = true, paramType = "path")
|
||||
@DeleteMapping(value = "/delByIds/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List<String> ids) {
|
||||
brandService.deleteBrands(ids);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.CategoryBrand;
|
||||
import cn.lili.modules.goods.entity.vos.CategoryBrandVO;
|
||||
import cn.lili.modules.goods.service.CategoryBrandService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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 pikachu
|
||||
* @since 2020-02-27 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,分类品牌接口")
|
||||
@RequestMapping("/manager/category/brand")
|
||||
public class CategoryBrandManagerController {
|
||||
|
||||
/**
|
||||
* 规格品牌管理
|
||||
*/
|
||||
@Autowired
|
||||
private CategoryBrandService categoryBrandService;
|
||||
|
||||
@ApiOperation(value = "查询某分类下绑定的品牌信息")
|
||||
@ApiImplicitParam(name = "categoryId", value = "分类id", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/{categoryId}")
|
||||
public ResultMessage<List<CategoryBrandVO>> getCategoryBrand(@PathVariable String categoryId) {
|
||||
return ResultUtil.data(categoryBrandService.getCategoryBrandList(categoryId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "保存某分类下绑定的品牌信息")
|
||||
@PostMapping(value = "/{categoryId}")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "categoryId", value = "分类id", required = true, paramType = "path", dataType = "String"),
|
||||
@ApiImplicitParam(name = "categoryBrands", value = "品牌id数组", required = true, paramType = "query", dataType = "String[]")
|
||||
})
|
||||
public ResultMessage<Object> saveCategoryBrand(@PathVariable String categoryId, @RequestParam List<String> categoryBrands) {
|
||||
categoryBrandService.saveCategoryBrandList(categoryId,categoryBrands);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
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.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.Category;
|
||||
import cn.lili.modules.goods.entity.vos.CategoryVO;
|
||||
import cn.lili.modules.goods.service.CategoryService;
|
||||
import cn.lili.modules.goods.service.GoodsService;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,商品分类接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-02-27 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,商品分类接口")
|
||||
@RequestMapping("/manager/goods/category")
|
||||
@CacheConfig(cacheNames = "category")
|
||||
public class CategoryManagerController {
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
/**
|
||||
* 商品
|
||||
*/
|
||||
@Autowired
|
||||
private GoodsService goodsService;
|
||||
|
||||
@ApiOperation(value = "查询某分类下的全部子分类列表")
|
||||
@ApiImplicitParam(name = "parentId", value = "父id,顶级为0", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/{parentId}/all-children")
|
||||
public ResultMessage<List<Category>> list(@PathVariable String parentId) {
|
||||
return ResultUtil.data(this.categoryService.dbList(parentId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询全部分类列表")
|
||||
@GetMapping(value = "/allChildren")
|
||||
public ResultMessage<List<CategoryVO>> list() {
|
||||
return ResultUtil.data(this.categoryService.listAllChildren());
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加商品分类")
|
||||
public ResultMessage<Category> saveCategory(@Valid Category category) {
|
||||
//非顶级分类
|
||||
if (category.getParentId() != null && !"0".equals(category.getParentId())) {
|
||||
Category parent = categoryService.getById(category.getParentId());
|
||||
if (parent == null) {
|
||||
throw new ServiceException(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
||||
}
|
||||
if (category.getLevel() >= 4) {
|
||||
throw new ServiceException(ResultCode.CATEGORY_BEYOND_THREE);
|
||||
}
|
||||
}
|
||||
if (categoryService.saveCategory(category)) {
|
||||
return ResultUtil.data(category);
|
||||
}
|
||||
throw new ServiceException(ResultCode.CATEGORY_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改商品分类")
|
||||
public ResultMessage<Category> updateCategory(@Valid CategoryVO category) {
|
||||
Category catTemp = categoryService.getById(category.getId());
|
||||
if (catTemp == null) {
|
||||
throw new ServiceException(ResultCode.CATEGORY_NOT_EXIST);
|
||||
}
|
||||
|
||||
categoryService.updateCategory(category);
|
||||
return ResultUtil.data(category);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "分类ID", required = true, paramType = "path", dataType = "String")
|
||||
@ApiOperation(value = "通过id删除分类")
|
||||
public ResultMessage<Category> delAllByIds(@NotNull @PathVariable String id) {
|
||||
Category category = new Category();
|
||||
category.setParentId(id);
|
||||
List<Category> list = categoryService.findByAllBySortOrder(category);
|
||||
if (list != null && !list.isEmpty()) {
|
||||
throw new ServiceException(ResultCode.CATEGORY_HAS_CHILDREN);
|
||||
|
||||
}
|
||||
//查询某商品分类的商品数量
|
||||
long count = goodsService.getGoodsCountByCategory(id);
|
||||
if (count > 0) {
|
||||
throw new ServiceException(ResultCode.CATEGORY_HAS_GOODS);
|
||||
}
|
||||
categoryService.delete(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@PutMapping(value = "/disable/{id}")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "goodsId", value = "分类ID", required = true, paramType = "path", dataType = "String")
|
||||
})
|
||||
@ApiOperation(value = "后台 禁用/启用 分类")
|
||||
public ResultMessage<Object> disable(@PathVariable String id, @RequestParam Boolean enableOperations) {
|
||||
|
||||
Category category = categoryService.getById(id);
|
||||
if (category == null) {
|
||||
throw new ServiceException(ResultCode.CATEGORY_NOT_EXIST);
|
||||
}
|
||||
categoryService.updateCategoryStatus(id, enableOperations);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
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.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.CategoryParameterGroup;
|
||||
import cn.lili.modules.goods.entity.dos.Parameters;
|
||||
import cn.lili.modules.goods.entity.vos.ParameterGroupVO;
|
||||
import cn.lili.modules.goods.service.CategoryParameterGroupService;
|
||||
import cn.lili.modules.goods.service.ParametersService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,分类绑定参数组接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-02-18 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,分类绑定参数组接口")
|
||||
@RequestMapping("/manager/goods/category/parameters")
|
||||
public class CategoryParameterGroupManagerController {
|
||||
|
||||
/**
|
||||
* 参数组
|
||||
*/
|
||||
@Autowired
|
||||
private ParametersService parametersService;
|
||||
|
||||
/**
|
||||
* 分类参数
|
||||
*/
|
||||
@Autowired
|
||||
private CategoryParameterGroupService categoryParameterGroupService;
|
||||
|
||||
@ApiOperation(value = "查询某分类下绑定的参数信息")
|
||||
@GetMapping(value = "/{categoryId}")
|
||||
@ApiImplicitParam(value = "分类id", required = true, dataType = "String", paramType = "path")
|
||||
public ResultMessage<List<ParameterGroupVO>> getCategoryParam(@PathVariable String categoryId) {
|
||||
return ResultUtil.data(categoryParameterGroupService.getCategoryParams(categoryId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "保存数据")
|
||||
@PostMapping
|
||||
public ResultMessage<CategoryParameterGroup> saveOrUpdate(@Validated CategoryParameterGroup categoryParameterGroup) {
|
||||
|
||||
if (categoryParameterGroupService.save(categoryParameterGroup)) {
|
||||
return ResultUtil.data(categoryParameterGroup);
|
||||
}
|
||||
throw new ServiceException(ResultCode.CATEGORY_PARAMETER_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新数据")
|
||||
@PutMapping
|
||||
public ResultMessage<CategoryParameterGroup> update(@Validated CategoryParameterGroup categoryParameterGroup) {
|
||||
|
||||
if (categoryParameterGroupService.updateById(categoryParameterGroup)) {
|
||||
return ResultUtil.data(categoryParameterGroup);
|
||||
}
|
||||
throw new ServiceException(ResultCode.CATEGORY_PARAMETER_UPDATE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id删除参数组")
|
||||
@ApiImplicitParam(name = "id", value = "参数组ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping(value = "/{id}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable String id) {
|
||||
//删除参数
|
||||
parametersService.remove(new QueryWrapper<Parameters>().eq("group_id", id));
|
||||
//删除参数组
|
||||
categoryParameterGroupService.removeById(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.CategorySpecification;
|
||||
import cn.lili.modules.goods.entity.dos.Specification;
|
||||
import cn.lili.modules.goods.service.CategorySpecificationService;
|
||||
import cn.lili.modules.goods.service.SpecificationService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,商品分类规格接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-02-27 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,商品分类规格接口")
|
||||
@RequestMapping("/manager/goods/category/spec")
|
||||
public class CategorySpecificationManagerController {
|
||||
|
||||
/**
|
||||
* 分类规格
|
||||
*/
|
||||
@Autowired
|
||||
private CategorySpecificationService categorySpecificationService;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
@Autowired
|
||||
private SpecificationService specificationService;
|
||||
|
||||
|
||||
@ApiOperation(value = "查询某分类下绑定的规格信息")
|
||||
@GetMapping(value = "/{categoryId}")
|
||||
@ApiImplicitParam(name = "categoryId", value = "分类id", required = true, dataType = "String", paramType = "path")
|
||||
public List<Specification> getCategorySpec(@PathVariable String categoryId) {
|
||||
return categorySpecificationService.getCategorySpecList(categoryId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询某分类下绑定的规格信息,商品操作使用")
|
||||
@GetMapping(value = "/goods/{categoryId}")
|
||||
@ApiImplicitParam(name = "categoryId", value = "分类id", required = true, dataType = "String", paramType = "path")
|
||||
public List<Specification> getSpec(@PathVariable String categoryId) {
|
||||
return specificationService.list();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "保存某分类下绑定的规格信息")
|
||||
@PostMapping(value = "/{categoryId}")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "categoryId", value = "分类id", required = true, paramType = "path", dataType = "String"),
|
||||
@ApiImplicitParam(name = "categorySpecs", value = "规格id数组", required = true, paramType = "query", dataType = "String[]")
|
||||
})
|
||||
public ResultMessage<String> saveCategoryBrand(@PathVariable String categoryId,
|
||||
@RequestParam String[] categorySpecs) {
|
||||
//删除分类规格绑定信息
|
||||
this.categorySpecificationService.remove(new QueryWrapper<CategorySpecification>().eq("category_id", categoryId));
|
||||
//绑定规格信息
|
||||
if (categorySpecs != null && categorySpecs.length > 0) {
|
||||
List<CategorySpecification> categorySpecifications = new ArrayList<>();
|
||||
for (String categorySpec : categorySpecs) {
|
||||
categorySpecifications.add(new CategorySpecification(categoryId, categorySpec));
|
||||
}
|
||||
categorySpecificationService.saveBatch(categorySpecifications);
|
||||
}
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
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.GoodsSearchParams;
|
||||
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
|
||||
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
|
||||
import cn.lili.modules.goods.entity.vos.GoodsVO;
|
||||
import cn.lili.modules.goods.service.GoodsService;
|
||||
import cn.lili.modules.goods.service.GoodsSkuService;
|
||||
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.NotEmpty;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,商品管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-02-23 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,商品管理接口")
|
||||
@RequestMapping("/manager/goods")
|
||||
public class GoodsManagerController {
|
||||
/**
|
||||
* 商品
|
||||
*/
|
||||
@Autowired
|
||||
private GoodsService goodsService;
|
||||
/**
|
||||
* 规格商品
|
||||
*/
|
||||
@Autowired
|
||||
private GoodsSkuService goodsSkuService;
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping(value = "/list")
|
||||
public IPage<Goods> getByPage(GoodsSearchParams goodsSearchParams) {
|
||||
return goodsService.queryByParams(goodsSearchParams);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取商品列表")
|
||||
@GetMapping(value = "/sku/list")
|
||||
public ResultMessage<IPage<GoodsSku>> getSkuByPage(GoodsSearchParams goodsSearchParams) {
|
||||
return ResultUtil.data(goodsSkuService.getGoodsSkuByPage(goodsSearchParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取待审核商品")
|
||||
@GetMapping(value = "/auth/list")
|
||||
public IPage<Goods> getAuthPage(GoodsSearchParams goodsSearchParams) {
|
||||
|
||||
goodsSearchParams.setAuthFlag(GoodsAuthEnum.TOBEAUDITED.name());
|
||||
return goodsService.queryByParams(goodsSearchParams);
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "管理员下架商品", notes = "管理员下架商品时使用")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "query", allowMultiple = true),
|
||||
@ApiImplicitParam(name = "reason", value = "下架理由", required = true, paramType = "query")
|
||||
})
|
||||
@PutMapping(value = "/{goodsId}/under")
|
||||
public ResultMessage<Object> underGoods(@PathVariable String goodsId, @NotEmpty(message = "下架原因不能为空") @RequestParam String reason) {
|
||||
List<String> goodsIds = Arrays.asList(goodsId.split(","));
|
||||
if (Boolean.TRUE.equals(goodsService.managerUpdateGoodsMarketAble(goodsIds, GoodsStatusEnum.DOWN, reason))) {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
throw new ServiceException(ResultCode.GOODS_UNDER_ERROR);
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "管理员审核商品", notes = "管理员审核商品")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "goodsIds", value = "商品ID", required = true, paramType = "path", allowMultiple = true, dataType = "int"),
|
||||
@ApiImplicitParam(name = "authFlag", value = "审核结果", required = true, paramType = "query", dataType = "string")
|
||||
})
|
||||
@PutMapping(value = "{goodsIds}/auth")
|
||||
public ResultMessage<Object> auth(@PathVariable List<String> goodsIds, @RequestParam String authFlag) {
|
||||
//校验商品是否存在
|
||||
if (goodsService.auditGoods(goodsIds, GoodsAuthEnum.valueOf(authFlag))) {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
throw new ServiceException(ResultCode.GOODS_AUTH_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "管理员上架商品", notes = "管理员上架商品时使用")
|
||||
@PutMapping(value = "/{goodsId}/up")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, allowMultiple = true)
|
||||
})
|
||||
public ResultMessage<Object> unpGoods(@PathVariable List<String> goodsId) {
|
||||
if (goodsService.updateGoodsMarketAble(goodsId, GoodsStatusEnum.UPPER, "")) {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
throw new ServiceException(ResultCode.GOODS_UPPER_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "通过id获取商品详情")
|
||||
@GetMapping(value = "/get/{id}")
|
||||
public ResultMessage<GoodsVO> get(@PathVariable String id) {
|
||||
GoodsVO goods = goodsService.getGoodsVO(id);
|
||||
return ResultUtil.data(goods);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
|
||||
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 cn.lili.mybatis.util.PageUtil;
|
||||
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 javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,商品计量单位接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/11/26 16:15
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,商品计量单位接口")
|
||||
@RequestMapping("/manager/goods/goodsUnit")
|
||||
public class GoodsUnitManagerController {
|
||||
|
||||
@Autowired
|
||||
private GoodsUnitService goodsUnitService;
|
||||
|
||||
|
||||
@ApiOperation(value = "分页获取商品计量单位")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<GoodsUnit>> getByPage(PageVO pageVO) {
|
||||
return ResultUtil.data(goodsUnitService.page(PageUtil.initPage(pageVO)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取商品计量单位")
|
||||
@ApiImplicitParam(name = "id", value = "计量单位ID", required = true, paramType = "path")
|
||||
@GetMapping("/get/{id}")
|
||||
public ResultMessage<GoodsUnit> getById(@NotNull @PathVariable String id) {
|
||||
return ResultUtil.data(goodsUnitService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加商品计量单位")
|
||||
@PostMapping
|
||||
public ResultMessage<GoodsUnit> save(@Valid GoodsUnit goodsUnit) {
|
||||
goodsUnitService.save(goodsUnit);
|
||||
return ResultUtil.data(goodsUnit);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑商品计量单位")
|
||||
@ApiImplicitParam(name = "id", value = "计量单位ID", required = true, paramType = "path")
|
||||
@PutMapping("/{id}")
|
||||
public ResultMessage<GoodsUnit> update(@NotNull @PathVariable String id, @Valid GoodsUnit goodsUnit) {
|
||||
goodsUnit.setId(id);
|
||||
goodsUnitService.updateById(goodsUnit);
|
||||
return ResultUtil.data(goodsUnit);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除商品计量单位")
|
||||
@ApiImplicitParam(name = "ids", value = "计量单位ID", required = true, paramType = "path")
|
||||
@DeleteMapping("/delete/{ids}")
|
||||
public ResultMessage<Object> delete(@NotNull @PathVariable List<String> ids) {
|
||||
goodsUnitService.removeByIds(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.search.entity.dto.HotWordsDTO;
|
||||
import cn.lili.modules.search.service.EsGoodsSearchService;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* 管理端,app版本控制器
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2018-07-04 21:50:52
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,系统设置扩展接口")
|
||||
@RequestMapping("/manager/hotwords")
|
||||
public class HotWordsManagerController {
|
||||
|
||||
@Autowired
|
||||
private EsGoodsSearchService esGoodsSearchService;
|
||||
|
||||
@ApiOperation(value = "获取热词")
|
||||
@GetMapping
|
||||
public ResultMessage<Object> getHotWords() {
|
||||
return ResultUtil.data(esGoodsSearchService.getHotWords(100));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设置热词")
|
||||
@PostMapping
|
||||
public ResultMessage<Object> paymentForm(@Validated HotWordsDTO hotWords) {
|
||||
esGoodsSearchService.setHotWords(hotWords);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设置热词")
|
||||
@DeleteMapping("/{words}")
|
||||
public ResultMessage<Object> deleteWords(@PathVariable String words) {
|
||||
esGoodsSearchService.deleteHotWords(words);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
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.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.Parameters;
|
||||
import cn.lili.modules.goods.service.ParametersService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,分类绑定参数组管理接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/11/26 16:15
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,分类绑定参数组管理接口")
|
||||
@RequestMapping("/manager/goods/parameters")
|
||||
public class ParameterManagerController {
|
||||
|
||||
@Autowired
|
||||
private ParametersService parametersService;
|
||||
|
||||
|
||||
@ApiOperation(value = "添加参数")
|
||||
@PostMapping
|
||||
public ResultMessage<Parameters> save(@Valid Parameters parameters) {
|
||||
|
||||
if (parametersService.save(parameters)) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
throw new ServiceException(ResultCode.PARAMETER_SAVE_ERROR);
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑参数")
|
||||
@PutMapping
|
||||
public ResultMessage<Parameters> update(@Valid Parameters parameters) {
|
||||
|
||||
if (parametersService.updateParameter(parameters)) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
throw new ServiceException(ResultCode.PARAMETER_UPDATE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id删除参数")
|
||||
@ApiImplicitParam(name = "id", value = "参数ID", required = true, paramType = "path")
|
||||
@DeleteMapping(value = "/{id}")
|
||||
public ResultMessage<Object> delById(@PathVariable String id) {
|
||||
parametersService.removeById(id);
|
||||
return ResultUtil.success();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.Specification;
|
||||
import cn.lili.modules.goods.service.SpecificationService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,商品规格接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-02-18 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,商品规格接口")
|
||||
@RequestMapping("/manager/goods/spec")
|
||||
public class SpecificationManagerController {
|
||||
|
||||
@Autowired
|
||||
private SpecificationService specificationService;
|
||||
|
||||
|
||||
@GetMapping("/all")
|
||||
@ApiOperation(value = "获取所有可用规格")
|
||||
public List<Specification> getAll() {
|
||||
List<Specification> list = specificationService.list();
|
||||
return list;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "搜索规格")
|
||||
public Page<Specification> page(String specName, PageVO page) {
|
||||
LambdaQueryWrapper<Specification> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.like(StringUtils.isNotEmpty(specName), Specification::getSpecName, specName);
|
||||
return specificationService.page(PageUtil.initPage(page), lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "保存规格")
|
||||
public ResultMessage<Object> save(@Valid Specification specification) {
|
||||
specificationService.save(specification);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation(value = "更改规格")
|
||||
public ResultMessage<Object> update(@Valid Specification specification, @PathVariable String id) {
|
||||
specification.setId(id);
|
||||
specificationService.saveOrUpdate(specification);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiImplicitParam(name = "ids", value = "规格ID", required = true, dataType = "String", allowMultiple = true, paramType = "path")
|
||||
@ApiOperation(value = "批量删除")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List<String> ids) {
|
||||
specificationService.deleteSpecification(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dos.MemberAddress;
|
||||
import cn.lili.modules.member.service.MemberAddressService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,会员地址API
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员地址API")
|
||||
@RequestMapping("/manager/member/address")
|
||||
public class MemberAddressManagerController {
|
||||
@Autowired
|
||||
private MemberAddressService memberAddressService;
|
||||
|
||||
@ApiOperation(value = "会员地址分页列表")
|
||||
@GetMapping("/{memberId}")
|
||||
public ResultMessage<IPage<MemberAddress>> getByPage(PageVO page, @PathVariable("memberId") String memberId) {
|
||||
return ResultUtil.data(memberAddressService.getAddressByMember(page, memberId));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "删除会员收件地址")
|
||||
@ApiImplicitParam(name = "id", value = "会员地址ID", dataType = "String", paramType = "path")
|
||||
@DeleteMapping(value = "/delById/{id}")
|
||||
public ResultMessage<Object> delShippingAddressById(@PathVariable String id) {
|
||||
memberAddressService.removeMemberAddress(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改会员收件地址")
|
||||
@PutMapping
|
||||
public ResultMessage<MemberAddress> editShippingAddress(@Valid MemberAddress shippingAddress) {
|
||||
//修改会员地址
|
||||
return ResultUtil.data(memberAddressService.updateMemberAddress(shippingAddress));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "新增会员收件地址")
|
||||
@PostMapping
|
||||
public ResultMessage<MemberAddress> addShippingAddress(@Valid MemberAddress shippingAddress) {
|
||||
//添加会员地址
|
||||
return ResultUtil.data(memberAddressService.saveMemberAddress(shippingAddress));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
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 javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 管理端,会员商品评价接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员商品评价接口")
|
||||
@RequestMapping("/manager/memberEvaluation")
|
||||
public class MemberEvaluationManagerController {
|
||||
@Autowired
|
||||
private MemberEvaluationService memberEvaluationService;
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@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(memberEvaluationService.queryById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取评价分页")
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<MemberEvaluationListVO>> getByPage(EvaluationQueryParams evaluationQueryParams, PageVO page) {
|
||||
|
||||
return ResultUtil.data(memberEvaluationService.queryPage(evaluationQueryParams));
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "修改评价状态")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "评价ID", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "status", value = "显示状态,OPEN 正常 ,CLOSE 关闭", required = true, paramType = "query")
|
||||
})
|
||||
@GetMapping(value = "/updateStatus/{id}")
|
||||
public ResultMessage<Object> updateStatus(@PathVariable String id, @NotNull String status) {
|
||||
memberEvaluationService.updateStatus(id, status);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除评论")
|
||||
@ApiImplicitParam(name = "id", value = "评价ID", required = true, dataType = "String", paramType = "path")
|
||||
@PutMapping(value = "/delete/{id}")
|
||||
public ResultMessage<IPage<Object>> delete(@PathVariable String id) {
|
||||
memberEvaluationService.delete(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
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.member.entity.dos.MemberGrade;
|
||||
import cn.lili.modules.member.service.MemberGradeService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* 管理端,会员等级接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2021/5/16 11:29 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员等级接口")
|
||||
@RequestMapping("/manager/memberGrade")
|
||||
public class MemberGradeManagerController {
|
||||
|
||||
@Autowired
|
||||
private MemberGradeService memberGradeService;
|
||||
|
||||
@ApiOperation(value = "通过id获取会员等级")
|
||||
@ApiImplicitParam(name = "id", value = "会员等级ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/get/{id}")
|
||||
public ResultMessage<MemberGrade> get(@PathVariable String id) {
|
||||
|
||||
return ResultUtil.data(memberGradeService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取会员等级分页")
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<MemberGrade>> getByPage(PageVO page) {
|
||||
|
||||
return ResultUtil.data(memberGradeService.page(PageUtil.initPage(page)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加会员等级")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "会员等级ID", required = true, paramType = "path")
|
||||
})
|
||||
@PostMapping(value = "/add")
|
||||
public ResultMessage<Object> daa(@Validated MemberGrade memberGrade) {
|
||||
if (memberGradeService.save(memberGrade)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改会员等级")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "会员等级ID", required = true, paramType = "path")
|
||||
})
|
||||
@PutMapping(value = "/update/{id}")
|
||||
public ResultMessage<Object> update(@PathVariable String id,MemberGrade memberGrade) {
|
||||
if (memberGradeService.updateById(memberGrade)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "删除会员等级")
|
||||
@ApiImplicitParam(name = "id", value = "会员等级ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping(value = "/delete/{id}")
|
||||
public ResultMessage<IPage<Object>> delete(@PathVariable String id) {
|
||||
if(memberGradeService.getById(id).getIsDefault()){
|
||||
throw new ServiceException(ResultCode.USER_GRADE_IS_DEFAULT);
|
||||
}else if(memberGradeService.removeById(id)){
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.aop.annotation.DemoSite;
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.entity.dto.ManagerMemberEditDTO;
|
||||
import cn.lili.modules.member.entity.dto.MemberAddDTO;
|
||||
import cn.lili.modules.member.entity.vo.MemberSearchVO;
|
||||
import cn.lili.modules.member.entity.vo.MemberVO;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,会员接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员接口")
|
||||
@RequestMapping("/manager/member")
|
||||
public class MemberManagerController {
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
|
||||
@ApiOperation(value = "会员分页列表")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<MemberVO>> getByPage(MemberSearchVO memberSearchVO, PageVO page) {
|
||||
return ResultUtil.data(memberService.getMemberPage(memberSearchVO, page));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "通过ID获取会员信息")
|
||||
@ApiImplicitParam(name = "id", value = "会员ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<Member> get(@PathVariable String id) {
|
||||
|
||||
return ResultUtil.data(memberService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加会员")
|
||||
@PostMapping
|
||||
public ResultMessage<Member> save(@Valid MemberAddDTO member) {
|
||||
|
||||
return ResultUtil.data(memberService.addMember(member));
|
||||
}
|
||||
|
||||
@DemoSite
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "修改会员基本信息")
|
||||
@PutMapping
|
||||
public ResultMessage<Member> update(@Valid ManagerMemberEditDTO managerMemberEditDTO) {
|
||||
return ResultUtil.data(memberService.updateMember(managerMemberEditDTO));
|
||||
}
|
||||
|
||||
@DemoSite
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "修改会员状态,开启关闭会员")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "memberIds", value = "会员ID", required = true, dataType = "String", allowMultiple = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "disabled", required = true, dataType = "boolean", paramType = "query")
|
||||
})
|
||||
@PutMapping("/updateMemberStatus")
|
||||
public ResultMessage<Object> updateMemberStatus(@RequestParam List<String> memberIds, @RequestParam Boolean disabled) {
|
||||
memberService.updateMemberStatus(memberIds, disabled);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "根据条件查询会员总数")
|
||||
@GetMapping("/num")
|
||||
public ResultMessage<Long> getByPage(MemberSearchVO memberSearchVO) {
|
||||
return ResultUtil.data(memberService.getMemberNum(memberSearchVO));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dos.MemberPointsHistory;
|
||||
import cn.lili.modules.member.entity.vo.MemberPointsHistoryVO;
|
||||
import cn.lili.modules.member.service.MemberPointsHistoryService;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 管理端,会员积分历史接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员积分历史接口")
|
||||
@RequestMapping("/manager/member/memberPointsHistory")
|
||||
public class MemberPointsHistoryManagerController {
|
||||
@Autowired
|
||||
private MemberPointsHistoryService memberPointsHistoryService;
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "memberId", value = "会员ID", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "memberName", value = "会员名称", required = true, paramType = "query")
|
||||
})
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<MemberPointsHistory>> getByPage(PageVO page, String memberId, String memberName) {
|
||||
return ResultUtil.data(memberPointsHistoryService.MemberPointsHistoryList(page, memberId, memberName));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取会员积分VO")
|
||||
@ApiImplicitParam(name = "memberId", value = "会员ID", paramType = "query")
|
||||
@GetMapping(value = "/getMemberPointsHistoryVO")
|
||||
public ResultMessage<MemberPointsHistoryVO> getMemberPointsHistoryVO(String memberId) {
|
||||
return ResultUtil.data(memberPointsHistoryService.getMemberPointsHistoryVO(memberId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package cn.lili.controller.message;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.message.entity.dos.MemberMessage;
|
||||
import cn.lili.modules.message.entity.vos.MemberMessageQueryVO;
|
||||
import cn.lili.modules.message.service.MemberMessageService;
|
||||
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 pikachu
|
||||
* @since 2020/12/6 16:09
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员消息消息管理接口")
|
||||
@RequestMapping("/manager/message/member")
|
||||
public class MemberMessageManagerController {
|
||||
@Autowired
|
||||
private MemberMessageService memberMessageService;
|
||||
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "多条件分页获取")
|
||||
public ResultMessage<IPage<MemberMessage>> getByCondition(MemberMessageQueryVO memberMessageQueryVO,
|
||||
PageVO pageVo) {
|
||||
IPage<MemberMessage> page = memberMessageService.getPage(memberMessageQueryVO, pageVo);
|
||||
return ResultUtil.data(page);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package cn.lili.controller.message;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dos.MemberNoticeLog;
|
||||
import cn.lili.modules.member.service.MemberNoticeLogService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,会员消息接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员消息接口")
|
||||
@RequestMapping("/manager/memberNoticeLog")
|
||||
public class MemberNoticeLogManagerController {
|
||||
@Autowired
|
||||
private MemberNoticeLogService memberNoticeLogService;
|
||||
|
||||
@ApiOperation(value = "通过id获取")
|
||||
@GetMapping(value = "/get/{id}")
|
||||
public ResultMessage<MemberNoticeLog> get(@PathVariable String id) {
|
||||
MemberNoticeLog memberNoticeLog = memberNoticeLogService.getById(id);
|
||||
return ResultUtil.data(memberNoticeLog);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取全部数据")
|
||||
@GetMapping(value = "/getAll")
|
||||
public ResultMessage<List<MemberNoticeLog>> getAll() {
|
||||
List<MemberNoticeLog> list = memberNoticeLogService.list();
|
||||
return ResultUtil.data(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<MemberNoticeLog>> getByPage(PageVO page) {
|
||||
IPage<MemberNoticeLog> data = memberNoticeLogService.page(PageUtil.initPage(page));
|
||||
return ResultUtil.data(data);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑或更新数据")
|
||||
@PostMapping(value = "/insertOrUpdate")
|
||||
public ResultMessage<MemberNoticeLog> saveOrUpdate(MemberNoticeLog memberNoticeLog) {
|
||||
memberNoticeLogService.saveOrUpdate(memberNoticeLog);
|
||||
return ResultUtil.data(memberNoticeLog);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/delByIds/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
memberNoticeLogService.removeByIds(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package cn.lili.controller.message;
|
||||
|
||||
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.member.entity.dos.MemberNotice;
|
||||
import cn.lili.modules.member.service.MemberNoticeService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,会员站内信管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/17 4:31 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员站内信管理API")
|
||||
@RequestMapping("/manager/member/notice")
|
||||
public class MemberNoticeManagerController {
|
||||
@Autowired
|
||||
private MemberNoticeService memberNoticeService;
|
||||
|
||||
@ApiOperation(value = "获取详情")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<MemberNotice> get(@PathVariable String id) {
|
||||
MemberNotice memberNotice = memberNoticeService.getById(id);
|
||||
return ResultUtil.data(memberNotice);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取站内信")
|
||||
@GetMapping(value = "/page")
|
||||
public ResultMessage<IPage<MemberNotice>> getByPage(
|
||||
PageVO page) {
|
||||
IPage<MemberNotice> data = memberNoticeService.page(PageUtil.initPage(page));
|
||||
return ResultUtil.data(data);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "阅读消息")
|
||||
@PostMapping("/read/{ids}")
|
||||
public ResultMessage<Object> read(@PathVariable List ids) {
|
||||
UpdateWrapper updateWrapper = new UpdateWrapper();
|
||||
updateWrapper.in("id", ids);
|
||||
updateWrapper.set("is_read", true);
|
||||
memberNoticeService.update(updateWrapper);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "阅读全部")
|
||||
@PostMapping("/read/all")
|
||||
public ResultMessage<Object> readAll() {
|
||||
UpdateWrapper updateWrapper = new UpdateWrapper();
|
||||
updateWrapper.in("member_id", UserContext.getCurrentUser().getId());
|
||||
updateWrapper.set("is_read", true);
|
||||
memberNoticeService.update(updateWrapper);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
memberNoticeService.removeByIds(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除所有")
|
||||
@DeleteMapping
|
||||
public ResultMessage<Object> deleteAll() {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("member_id", UserContext.getCurrentUser().getId());
|
||||
memberNoticeService.remove(queryWrapper);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package cn.lili.controller.message;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.member.entity.dos.MemberNoticeSenter;
|
||||
import cn.lili.modules.member.service.MemberNoticeSenterService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,会员消息接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员消息接口")
|
||||
@RequestMapping("/manager/memberNoticeSenter")
|
||||
public class MemberNoticeSenterManagerController {
|
||||
@Autowired
|
||||
private MemberNoticeSenterService memberNoticeSenterService;
|
||||
|
||||
@ApiOperation(value = "通过id获取")
|
||||
@GetMapping(value = "/get/{id}")
|
||||
public ResultMessage<MemberNoticeSenter> get(@PathVariable String id) {
|
||||
MemberNoticeSenter memberNoticeSenter = memberNoticeSenterService.getById(id);
|
||||
return ResultUtil.data(memberNoticeSenter);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取全部数据")
|
||||
@GetMapping(value = "/getAll")
|
||||
public ResultMessage<List<MemberNoticeSenter>> getAll() {
|
||||
|
||||
List<MemberNoticeSenter> list = memberNoticeSenterService.list();
|
||||
return ResultUtil.data(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<MemberNoticeSenter>> getByPage(MemberNoticeSenter entity,
|
||||
SearchVO searchVo,
|
||||
PageVO page) {
|
||||
IPage<MemberNoticeSenter> data = memberNoticeSenterService.page(PageUtil.initPage(page), PageUtil.initWrapper(entity, searchVo));
|
||||
return ResultUtil.data(data);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑或更新数据")
|
||||
@PostMapping(value = "/insertOrUpdate")
|
||||
public ResultMessage<MemberNoticeSenter> saveOrUpdate(MemberNoticeSenter memberNoticeSenter) {
|
||||
|
||||
memberNoticeSenterService.customSave(memberNoticeSenter);
|
||||
return ResultUtil.data(memberNoticeSenter);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/delByIds/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
memberNoticeSenterService.removeByIds(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.lili.controller.message;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.system.entity.dos.ServiceNotice;
|
||||
import cn.lili.modules.system.service.ServiceNoticeService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,服务订阅消息接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/17 4:33 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,服务订阅消息接口")
|
||||
@RequestMapping("/manager/admin/notice")
|
||||
public class ServiceNoticeManagerController {
|
||||
@Autowired
|
||||
private ServiceNoticeService serviceNoticeService;
|
||||
|
||||
@ApiOperation(value = "查看服务订阅消息详情")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<ServiceNotice> get(@PathVariable String id) {
|
||||
ServiceNotice serviceNotice = serviceNoticeService.getById(id);
|
||||
return ResultUtil.data(serviceNotice);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取服务订阅消息")
|
||||
@GetMapping(value = "/page")
|
||||
public ResultMessage<IPage<ServiceNotice>> getByPage(ServiceNotice entity,
|
||||
SearchVO searchVo,
|
||||
PageVO page) {
|
||||
IPage<ServiceNotice> data = serviceNoticeService.page(PageUtil.initPage(page), PageUtil.initWrapper(entity, searchVo));
|
||||
return ResultUtil.data(data);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增服务订阅消息")
|
||||
@PostMapping
|
||||
public ResultMessage<ServiceNotice> save(ServiceNotice serviceNotice) {
|
||||
//标记平台消息
|
||||
serviceNotice.setStoreId("-1");
|
||||
serviceNoticeService.saveOrUpdate(serviceNotice);
|
||||
return ResultUtil.data(serviceNotice);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新服务订阅消息")
|
||||
@PostMapping("/{id}")
|
||||
public ResultMessage<ServiceNotice> update(@PathVariable String id, ServiceNotice serviceNotice) {
|
||||
serviceNoticeService.saveOrUpdate(serviceNotice);
|
||||
return ResultUtil.data(serviceNotice);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除服务订阅消息")
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
serviceNoticeService.removeByIds(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -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.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;
|
||||
|
||||
/**
|
||||
* 管理端,售后接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2021/1/6 14:11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manager/afterSale")
|
||||
@Api(tags = "管理端,售后接口")
|
||||
public class AfterSaleManagerController {
|
||||
|
||||
/**
|
||||
* 售后
|
||||
*/
|
||||
@Autowired
|
||||
private AfterSaleService afterSaleService;
|
||||
|
||||
@ApiOperation(value = "分页获取售后服务")
|
||||
@GetMapping(value = "/page")
|
||||
public ResultMessage<IPage<AfterSaleVO>> getByPage(AfterSaleSearchParams searchParams) {
|
||||
return ResultUtil.data(afterSaleService.getAfterSalePages(searchParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取导出售后服务列表列表")
|
||||
@GetMapping(value = "/exportAfterSaleOrder")
|
||||
public ResultMessage<List<AfterSale>> exportAfterSaleOrder(AfterSaleSearchParams searchParams) {
|
||||
return ResultUtil.data(afterSaleService.exportAfterSaleOrder(searchParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查看售后服务详情")
|
||||
@ApiImplicitParam(name = "sn", value = "售后单号", required = true, paramType = "path")
|
||||
@GetMapping(value = "/get/{sn}")
|
||||
public ResultMessage<AfterSaleVO> get(@NotNull(message = "售后单号") @PathVariable("sn") String sn) {
|
||||
return ResultUtil.data(afterSaleService.getAfterSale(sn));
|
||||
}
|
||||
|
||||
@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 = "售后线下退款")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "afterSaleSn", value = "售后sn", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "remark", value = "备注", paramType = "query")
|
||||
})
|
||||
@PutMapping(value = "/refund/{afterSaleSn}")
|
||||
public ResultMessage<AfterSale> refund(@NotNull(message = "请选择售后单") @PathVariable String afterSaleSn,
|
||||
@RequestParam String remark) {
|
||||
|
||||
return ResultUtil.data(afterSaleService.refund(afterSaleSn, remark));
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
|
||||
@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,73 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.order.aftersale.entity.dos.AfterSaleReason;
|
||||
import cn.lili.modules.order.aftersale.service.AfterSaleReasonService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
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.Valid;
|
||||
|
||||
/**
|
||||
* 管理端,售后原因接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2021/1/6 14:11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manager/afterSaleReason")
|
||||
@Api(tags = "管理端,售后原因接口")
|
||||
public class AfterSaleReasonManagerController {
|
||||
|
||||
/**
|
||||
* 售后原因
|
||||
*/
|
||||
@Autowired
|
||||
private AfterSaleReasonService afterSaleReasonService;
|
||||
|
||||
@ApiOperation(value = "查看售后原因")
|
||||
@ApiImplicitParam(name = "id", value = "售后原因ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<AfterSaleReason> get(@PathVariable String id) {
|
||||
|
||||
return ResultUtil.data(afterSaleReasonService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取售后原因")
|
||||
@GetMapping(value = "/getByPage")
|
||||
@ApiImplicitParam(name = "serviceType", value = "售后类型", required = true, dataType = "String", paramType = "query")
|
||||
public ResultMessage<IPage<AfterSaleReason>> getByPage(PageVO page, @RequestParam String serviceType) {
|
||||
return ResultUtil.data(afterSaleReasonService.page(PageUtil.initPage(page),new QueryWrapper<AfterSaleReason>().eq("service_Type", serviceType)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加售后原因")
|
||||
@PostMapping
|
||||
public ResultMessage<AfterSaleReason> save(@Valid AfterSaleReason afterSaleReason) {
|
||||
afterSaleReasonService.save(afterSaleReason);
|
||||
return ResultUtil.data(afterSaleReason);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改售后原因")
|
||||
@ApiImplicitParam(name = "id", value = "关键词ID", required = true, dataType = "String", paramType = "path")
|
||||
@PutMapping("update/{id}")
|
||||
public ResultMessage<AfterSaleReason> update(@Valid AfterSaleReason afterSaleReason, @PathVariable("id") String id) {
|
||||
afterSaleReason.setId(id);
|
||||
return ResultUtil.data(afterSaleReasonService.editAfterSaleReason(afterSaleReason));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除售后原因")
|
||||
@ApiImplicitParam(name = "id", value = "售后原因ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping(value = "/delByIds/{id}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable String id) {
|
||||
afterSaleReasonService.removeById(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -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.AuthUser;
|
||||
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.enums.OrderComplaintStatusEnum;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderComplaintCommunicationVO;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderComplaintOperationParams;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderComplaintSearchParams;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderComplaintVO;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* 管理端,交易投诉接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/12/5
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,交易投诉接口")
|
||||
@RequestMapping("/manager/complain")
|
||||
public class OrderComplaintManagerController {
|
||||
|
||||
/**
|
||||
* 交易投诉
|
||||
*/
|
||||
@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(orderComplaintService.getOrderComplainById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<OrderComplaint>> get(OrderComplaintSearchParams searchParams, PageVO pageVO) {
|
||||
return ResultUtil.data(orderComplaintService.getOrderComplainByPage(searchParams, pageVO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新数据")
|
||||
@PutMapping
|
||||
public ResultMessage<OrderComplaintVO> update(OrderComplaintVO orderComplainVO) {
|
||||
orderComplaintService.updateOrderComplain(orderComplainVO);
|
||||
return ResultUtil.data(orderComplainVO);
|
||||
|
||||
}
|
||||
|
||||
@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 = UserContext.getCurrentUser();
|
||||
OrderComplaintCommunicationVO communicationVO = new OrderComplaintCommunicationVO(complainId, content, CommunicationOwnerEnum.PLATFORM.name(), currentUser.getId(), currentUser.getUsername());
|
||||
orderComplaintCommunicationService.addCommunication(communicationVO);
|
||||
return ResultUtil.data(communicationVO);
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "修改状态")
|
||||
@PutMapping(value = "/status")
|
||||
public ResultMessage<Object> updateStatus(OrderComplaintOperationParams orderComplainVO) {
|
||||
orderComplaintService.updateOrderComplainByStatus(orderComplainVO);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "仲裁")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "投诉单ID", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "arbitrationResult", value = "仲裁结果", required = true, paramType = "query")
|
||||
})
|
||||
@PutMapping(value = "/complete/{id}")
|
||||
public ResultMessage<Object> complete(@PathVariable String id, String arbitrationResult) {
|
||||
//新建对象
|
||||
OrderComplaintOperationParams orderComplaintOperationParams = new OrderComplaintOperationParams();
|
||||
orderComplaintOperationParams.setComplainId(id);
|
||||
orderComplaintOperationParams.setArbitrationResult(arbitrationResult);
|
||||
orderComplaintOperationParams.setComplainStatus(OrderComplaintStatusEnum.COMPLETE.name());
|
||||
|
||||
//修改状态
|
||||
orderComplaintService.updateOrderComplainByStatus(orderComplaintOperationParams);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.order.trade.entity.dos.OrderLog;
|
||||
import cn.lili.modules.order.trade.service.OrderLogService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 管理端,订单日志管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/17 4:34 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,订单日志管理接口")
|
||||
@RequestMapping("/manager/orderLog")
|
||||
public class OrderLogManagerController {
|
||||
@Autowired
|
||||
private OrderLogService orderLogService;
|
||||
|
||||
@GetMapping(value = "/get/{id}")
|
||||
@ApiOperation(value = "通过id获取")
|
||||
public ResultMessage<OrderLog> get(@PathVariable String id) {
|
||||
|
||||
return ResultUtil.data(orderLogService.getById(id));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getByPage")
|
||||
@ApiOperation(value = "分页获取")
|
||||
public ResultMessage<IPage<OrderLog>> getByPage(OrderLog entity,
|
||||
SearchVO searchVo,
|
||||
PageVO page) {
|
||||
return ResultUtil.data(orderLogService.page(PageUtil.initPage(page), PageUtil.initWrapper(entity, searchVo)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dto.MemberAddressDTO;
|
||||
import cn.lili.modules.order.order.entity.dos.Order;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,订单API
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/17 4:34 下午
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manager/orders")
|
||||
@Api(tags = "管理端,订单API")
|
||||
public class OrderManagerController {
|
||||
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
@Autowired
|
||||
private OrderPriceService orderPriceService;
|
||||
|
||||
|
||||
@ApiOperation(value = "查询订单列表分页")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<OrderSimpleVO>> queryMineOrder(OrderSearchParams orderSearchParams) {
|
||||
return ResultUtil.data(orderService.queryByParams(orderSearchParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询订单导出列表")
|
||||
@GetMapping("/queryExportOrder")
|
||||
public ResultMessage<List<OrderExportDTO>> queryExportOrder(OrderSearchParams orderSearchParams) {
|
||||
return ResultUtil.data(orderService.queryExportOrder(orderSearchParams));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "订单明细")
|
||||
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/{orderSn}")
|
||||
public ResultMessage<OrderDetailVO> detail(@PathVariable String orderSn) {
|
||||
return ResultUtil.data(orderService.queryDetail(orderSn));
|
||||
}
|
||||
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "确认收款")
|
||||
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path")
|
||||
@PostMapping(value = "/{orderSn}/pay")
|
||||
public ResultMessage<Object> payOrder(@PathVariable String orderSn) {
|
||||
orderPriceService.adminPayOrder(orderSn);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "修改收货人信息")
|
||||
@ApiImplicitParam(name = "orderSn", value = "订单sn", required = true, dataType = "String", paramType = "path")
|
||||
@PostMapping(value = "/update/{orderSn}/consignee")
|
||||
public ResultMessage<Order> 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 = "price", value = "订单价格", required = true, dataType = "Double", paramType = "query"),
|
||||
})
|
||||
@PutMapping(value = "/update/{orderSn}/price")
|
||||
public ResultMessage<Order> updateOrderPrice(@PathVariable String orderSn,
|
||||
@NotNull(message = "订单价格不能为空") @RequestParam Double price) {
|
||||
return ResultUtil.data(orderPriceService.updatePrice(orderSn, price));
|
||||
}
|
||||
|
||||
|
||||
@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<Order> cancel(@ApiIgnore @PathVariable String orderSn, @RequestParam String reason) {
|
||||
return ResultUtil.data(orderService.cancel(orderSn, reason));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "查询物流踪迹")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path")
|
||||
})
|
||||
@PostMapping(value = "/getTraces/{orderSn}")
|
||||
public ResultMessage<Object> getTraces(@NotBlank(message = "订单编号不能为空") @PathVariable String orderSn) {
|
||||
return ResultUtil.data(orderService.getTraces(orderSn));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.order.order.entity.dos.Order;
|
||||
import cn.lili.modules.order.order.entity.vo.PaymentLog;
|
||||
import cn.lili.modules.order.order.service.OrderService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
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 Chopper
|
||||
* @since 2020/11/17 4:34 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,收款日志接口")
|
||||
@RequestMapping("/manager/paymentLog")
|
||||
public class PaymentLogManagerController {
|
||||
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "分页获取支付日志")
|
||||
public ResultMessage<IPage<PaymentLog>> getByPage(Order order,
|
||||
SearchVO searchVo,
|
||||
PageVO page) {
|
||||
return ResultUtil.data(orderService.queryPaymentLogs(PageUtil.initPage(page), PageUtil.initWrapper(order, searchVo)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
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.ReceiptService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,发票记录接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/11/17 4:34 下午
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,发票记录接口")
|
||||
@RequestMapping("/manager/receipt")
|
||||
public class ReceiptManagerController {
|
||||
|
||||
@Autowired
|
||||
private ReceiptService receiptService;
|
||||
|
||||
|
||||
@ApiOperation(value = "获取发票分页信息")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<OrderReceiptDTO>> getPage(ReceiptSearchParams searchParams, PageVO pageVO) {
|
||||
return ResultUtil.data(this.receiptService.getReceiptData(searchParams, pageVO));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.lili.controller.order;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.payment.entity.RefundLog;
|
||||
import cn.lili.modules.payment.service.RefundLogService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 管理端,退款日志接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/16 10:07 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,退款日志接口")
|
||||
@RequestMapping("/manager/refundLog")
|
||||
public class RefundLogManagerController {
|
||||
@Autowired
|
||||
private RefundLogService refundLogService;
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "查看退款日志详情")
|
||||
public ResultMessage<RefundLog> get(@PathVariable String id) {
|
||||
return ResultUtil.data(refundLogService.getById(id));
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "分页获取退款日志")
|
||||
public ResultMessage<IPage<RefundLog>> getByPage(RefundLog entity, SearchVO searchVo, PageVO page) {
|
||||
return ResultUtil.data(refundLogService.page(PageUtil.initPage(page), PageUtil.initWrapper(entity, searchVo)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.page.entity.dos.ArticleCategory;
|
||||
import cn.lili.modules.page.entity.vos.ArticleCategoryVO;
|
||||
import cn.lili.modules.page.service.ArticleCategoryService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,文章分类管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-05-5 15:10:16
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "管理端,文章分类管理接口")
|
||||
@RequestMapping("/manager/article-category")
|
||||
public class ArticleCategoryManagerController {
|
||||
|
||||
/**
|
||||
* 文章分类
|
||||
*/
|
||||
@Autowired
|
||||
private ArticleCategoryService articleCategoryService;
|
||||
|
||||
@ApiOperation(value = "查询分类列表")
|
||||
@GetMapping(value = "/all-children")
|
||||
public ResultMessage<List<ArticleCategoryVO>> allChildren() {
|
||||
try {
|
||||
return ResultUtil.data(this.articleCategoryService.allChildren());
|
||||
} catch (Exception e) {
|
||||
log.error("查询分类列表错误", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查看文章分类")
|
||||
@ApiImplicitParam(name = "id", value = "文章分类ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<ArticleCategory> getArticleCategory(@PathVariable String id) {
|
||||
return ResultUtil.data(this.articleCategoryService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "保存文章分类")
|
||||
@PostMapping
|
||||
public ResultMessage<ArticleCategory> save(@Valid ArticleCategory articleCategory) {
|
||||
if (articleCategory.getLevel() == null) {
|
||||
articleCategory.setLevel(0);
|
||||
}
|
||||
if (articleCategory.getSort() == null) {
|
||||
articleCategory.setSort(0);
|
||||
}
|
||||
|
||||
return ResultUtil.data(articleCategoryService.saveArticleCategory(articleCategory));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改文章分类")
|
||||
@ApiImplicitParam(name = "id", value = "文章分类ID", required = true, dataType = "String", paramType = "path")
|
||||
@PutMapping("/update/{id}")
|
||||
public ResultMessage<ArticleCategory> update(@Valid ArticleCategory articleCategory, @PathVariable("id") String id) {
|
||||
|
||||
if (articleCategory.getLevel() == null) {
|
||||
articleCategory.setLevel(0);
|
||||
}
|
||||
if (articleCategory.getSort() == null) {
|
||||
articleCategory.setSort(0);
|
||||
}
|
||||
|
||||
articleCategory.setId(id);
|
||||
return ResultUtil.data(articleCategoryService.updateArticleCategory(articleCategory));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除文章分类")
|
||||
@ApiImplicitParam(name = "id", value = "文章分类ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public ResultMessage<ArticleCategory> deleteById(@PathVariable String id) {
|
||||
articleCategoryService.deleteById(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
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.enums.ArticleEnum;
|
||||
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.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 管理端,文章接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-05-06 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,文章接口")
|
||||
@RequestMapping("/manager/article")
|
||||
public class ArticleManagerController {
|
||||
|
||||
/**
|
||||
* 文章
|
||||
*/
|
||||
@Autowired
|
||||
private ArticleService articleService;
|
||||
|
||||
@ApiOperation(value = "查看文章")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<Article> get(@PathVariable String id) {
|
||||
|
||||
return ResultUtil.data(articleService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "categoryId", value = "文章分类ID", paramType = "query"),
|
||||
@ApiImplicitParam(name = "title", value = "标题", paramType = "query")
|
||||
})
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<ArticleVO>> getByPage(ArticleSearchParams articleSearchParams) {
|
||||
return ResultUtil.data(articleService.managerArticlePage(articleSearchParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加文章")
|
||||
@PostMapping(consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<Article> save(@RequestBody Article article) {
|
||||
article.setType(ArticleEnum.OTHER.name());
|
||||
articleService.save(article);
|
||||
return ResultUtil.data(article);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改文章")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, paramType = "path")
|
||||
@PutMapping(value = "update/{id}", consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<Article> update(@RequestBody Article article, @PathVariable("id") String id) {
|
||||
article.setId(id);
|
||||
return ResultUtil.data(articleService.updateArticle(article));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改文章状态")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "status", value = "操作状态", required = true, paramType = "query")
|
||||
})
|
||||
@PutMapping("update/status/{id}")
|
||||
public ResultMessage<Article> updateStatus(@PathVariable("id") String id, boolean status) {
|
||||
articleService.updateArticleStatus(id, status);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping(value = "/delByIds/{id}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable String id) {
|
||||
articleService.customRemove(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
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.permission.SettingKeys;
|
||||
import cn.lili.modules.search.entity.dos.CustomWords;
|
||||
import cn.lili.modules.search.entity.vo.CustomWordsVO;
|
||||
import cn.lili.modules.search.service.CustomWordsService;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* 管理端,自定义分词接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/10/16
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "管理端,自定义分词接口")
|
||||
@RequestMapping("/manager/custom-words")
|
||||
public class CustomWordsController {
|
||||
|
||||
/**
|
||||
* 分词
|
||||
*/
|
||||
@Autowired
|
||||
private CustomWordsService customWordsService;
|
||||
/**
|
||||
* 设置
|
||||
*/
|
||||
@Autowired
|
||||
private SettingService settingService;
|
||||
|
||||
@GetMapping
|
||||
public String getCustomWords(String secretKey) {
|
||||
if (CharSequenceUtil.isEmpty(secretKey)) {
|
||||
return "";
|
||||
}
|
||||
Setting setting = settingService.get(SettingKeys.ES_SIGN.name());
|
||||
if (setting == null || CharSequenceUtil.isEmpty(setting.getSettingValue())) {
|
||||
return "";
|
||||
}
|
||||
|
||||
JSONObject jsonObject = JSONUtil.parseObj(setting.getSettingValue());
|
||||
if (!secretKey.equals(jsonObject.get("secretKey"))) {
|
||||
throw new ServiceException(ResultCode.CUSTOM_WORDS_SECRET_KEY_ERROR);
|
||||
}
|
||||
|
||||
String res = customWordsService.deploy();
|
||||
try {
|
||||
return new String(res.getBytes(), StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
log.error("获取分词错误", e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加自定义分词")
|
||||
@PostMapping
|
||||
public ResultMessage<CustomWordsVO> addCustomWords(@Valid CustomWordsVO customWords) {
|
||||
customWordsService.addCustomWords(customWords);
|
||||
return ResultUtil.data(customWords);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改自定义分词")
|
||||
@PutMapping
|
||||
public ResultMessage<CustomWordsVO> updateCustomWords(@Valid CustomWordsVO customWords) {
|
||||
customWordsService.updateCustomWords(customWords);
|
||||
return ResultUtil.data(customWords);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除自定义分词")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public ResultMessage<String> deleteCustomWords(@NotNull @PathVariable String id) {
|
||||
customWordsService.deleteCustomWords(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取自定义分词")
|
||||
@ApiImplicitParam(name = "words", value = "分词", required = true, dataType = "String", paramType = "query")
|
||||
@GetMapping("/page")
|
||||
public ResultMessage<IPage<CustomWords>> getCustomWords(@RequestParam String words, PageVO pageVo) {
|
||||
return ResultUtil.data(customWordsService.getCustomWordsByPage(words, pageVo));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.search.service.EsGoodsIndexService;
|
||||
import io.swagger.annotations.Api;
|
||||
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.Map;
|
||||
|
||||
/**
|
||||
* ElasticsearchController
|
||||
*
|
||||
* @author Chopper
|
||||
* @version v1.0
|
||||
* 2021-03-24 18:32
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "ES初始化接口")
|
||||
@RequestMapping("/manager/elasticsearch")
|
||||
public class ElasticsearchController {
|
||||
|
||||
@Autowired
|
||||
private EsGoodsIndexService esGoodsIndexService;
|
||||
|
||||
@GetMapping
|
||||
public ResultMessage<String> init() {
|
||||
esGoodsIndexService.init();
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@GetMapping("/progress")
|
||||
public ResultMessage<Map<String, Integer>> getProgress() {
|
||||
return ResultUtil.data(esGoodsIndexService.getProgress());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
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.page.entity.dos.Feedback;
|
||||
import cn.lili.modules.page.service.FeedbackService;
|
||||
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.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 管理端,意见反馈接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020-05-5 15:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,意见反馈接口")
|
||||
@RequestMapping("/manager/feedback")
|
||||
public class FeedbackManagerController {
|
||||
|
||||
/**
|
||||
* 意见反馈
|
||||
*/
|
||||
@Autowired
|
||||
private FeedbackService feedbackService;
|
||||
|
||||
@ApiOperation(value = "查询意见反馈列表")
|
||||
@ApiImplicitParam(name = "parentId", value = "父id,顶级为0", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping()
|
||||
public ResultMessage<IPage<Feedback>> page(PageVO pageVO) {
|
||||
return ResultUtil.data(feedbackService.page(PageUtil.initPage(pageVO)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查看意见反馈")
|
||||
@ApiImplicitParam(name = "id", value = "意见反馈ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<Feedback> getFeedback(@PathVariable String id) {
|
||||
return ResultUtil.data(this.feedbackService.getById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.message.entity.dos.Message;
|
||||
import cn.lili.modules.message.entity.vos.MessageVO;
|
||||
import cn.lili.modules.message.service.MessageService;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* 管理端,消息发送管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020-05-06 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,消息发送管理接口")
|
||||
@RequestMapping("/manager/message")
|
||||
public class MessageManagerController {
|
||||
@Autowired
|
||||
private MessageService messageService;
|
||||
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "多条件分页获取")
|
||||
public ResultMessage<IPage<Message>> getByCondition(MessageVO messageVO,
|
||||
PageVO pageVo) {
|
||||
return ResultUtil.data(messageService.getPage(messageVO, pageVo));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "发送消息")
|
||||
public ResultMessage<Boolean> sendMessage(Message message) {
|
||||
|
||||
return ResultUtil.data(messageService.sendMessage(message));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除消息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "消息id", required = true, dataType = "String", paramType = "path")
|
||||
})
|
||||
public ResultMessage<Boolean> deleteMessage(@PathVariable String id) {
|
||||
|
||||
return ResultUtil.data(messageService.deleteMessage(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.aop.annotation.DemoSite;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
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.vos.PageDataListVO;
|
||||
import cn.lili.modules.page.service.PageDataService;
|
||||
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 javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 管理端,页面设置管理接口
|
||||
*
|
||||
* @author paulGao
|
||||
* @since 2020-05-06 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,页面设置管理接口")
|
||||
@RequestMapping("/manager/pageData")
|
||||
public class PageDataManagerController {
|
||||
|
||||
@Autowired
|
||||
private PageDataService pageDataService;
|
||||
|
||||
@ApiOperation(value = "获取页面信息")
|
||||
@ApiImplicitParam(name = "id", value = "页面ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<PageData> getPageData(@PathVariable String id) {
|
||||
return ResultUtil.data(pageDataService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加页面")
|
||||
@PostMapping("/add")
|
||||
public ResultMessage<PageData> addPageData(@Valid PageData pageData) {
|
||||
return ResultUtil.data(pageDataService.addPageData(pageData));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改页面")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "页面ID", required = true, dataType = "String", paramType = "path")
|
||||
})
|
||||
@DemoSite
|
||||
@PutMapping("/update/{id}")
|
||||
public ResultMessage<PageData> updatePageData(@Valid PageData pageData, @NotNull @PathVariable String id) {
|
||||
pageData.setId(id);
|
||||
return ResultUtil.data(pageDataService.updatePageData(pageData));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "页面列表")
|
||||
@GetMapping("/pageDataList")
|
||||
public ResultMessage<IPage<PageDataListVO>> pageDataList(PageVO pageVO, PageDataDTO pageDataDTO) {
|
||||
return ResultUtil.data(pageDataService.getPageDataList(pageVO, pageDataDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "发布页面")
|
||||
@ApiImplicitParam(name = "id", value = "页面ID", required = true, dataType = "String", paramType = "path")
|
||||
@PutMapping("/release/{id}")
|
||||
@DemoSite
|
||||
public ResultMessage<PageData> release(@PathVariable String id) {
|
||||
return ResultUtil.data(pageDataService.releasePageData(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除页面")
|
||||
@DemoSite
|
||||
@ApiImplicitParam(name = "id", value = "页面ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/remove/{id}")
|
||||
public ResultMessage<Object> remove(@PathVariable String id) {
|
||||
return ResultUtil.data(pageDataService.removePageData(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.system.entity.dos.SensitiveWords;
|
||||
import cn.lili.modules.system.service.SensitiveWordsService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* 管理端,敏感词管理接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020-05-06 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,敏感词管理接口")
|
||||
@RequestMapping("/manager/sensitiveWords")
|
||||
public class SensitiveWordsManagerController {
|
||||
|
||||
@Autowired
|
||||
private SensitiveWordsService sensitiveWordsService;
|
||||
|
||||
@ApiOperation(value = "通过id获取")
|
||||
@ApiImplicitParam(name = "id", value = "敏感词ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/get/{id}")
|
||||
public ResultMessage<SensitiveWords> get(@PathVariable String id) {
|
||||
return ResultUtil.data(sensitiveWordsService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<SensitiveWords>> getByPage(PageVO page) {
|
||||
return ResultUtil.data(sensitiveWordsService.page(PageUtil.initPage(page)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加敏感词")
|
||||
@PostMapping
|
||||
public ResultMessage<SensitiveWords> add(@Valid SensitiveWords sensitiveWords) {
|
||||
sensitiveWordsService.save(sensitiveWords);
|
||||
sensitiveWordsService.resetCache();
|
||||
return ResultUtil.data(sensitiveWords);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改敏感词")
|
||||
@ApiImplicitParam(name = "id", value = "敏感词ID", required = true, dataType = "String", paramType = "path")
|
||||
@PutMapping("/{id}")
|
||||
public ResultMessage<SensitiveWords> edit(@PathVariable String id, SensitiveWords sensitiveWords) {
|
||||
sensitiveWords.setId(id);
|
||||
sensitiveWordsService.updateById(sensitiveWords);
|
||||
sensitiveWordsService.resetCache();
|
||||
return ResultUtil.data(sensitiveWords);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@ApiImplicitParam(name = "ids", value = "敏感词ID", required = true, dataType = "String", allowMultiple = true, paramType = "path")
|
||||
@DeleteMapping(value = "/delByIds/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List<String> ids) {
|
||||
sensitiveWordsService.removeByIds(ids);
|
||||
sensitiveWordsService.resetCache();
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.page.entity.dos.Special;
|
||||
import cn.lili.modules.page.service.SpecialService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* 管理端,专题活动接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/12/7 11:33
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,专题活动接口")
|
||||
@RequestMapping("/manager/special")
|
||||
public class SpecialManagerController {
|
||||
|
||||
@Autowired
|
||||
private SpecialService specialService;
|
||||
|
||||
@ApiOperation(value = "添加专题活动")
|
||||
@PostMapping("/addSpecial")
|
||||
public ResultMessage<Special> addSpecial(@Valid Special special) {
|
||||
return ResultUtil.data(specialService.addSpecial(special));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改专题活动")
|
||||
@ApiImplicitParam(name = "id", value = "专题ID", required = true, dataType = "String", paramType = "path")
|
||||
@PutMapping("/updateSpecial")
|
||||
public ResultMessage<Special> updateSpecial(@PathVariable String id, @Valid Special special) {
|
||||
special.setId(id);
|
||||
specialService.updateById(special);
|
||||
return ResultUtil.data(special);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除专题活动")
|
||||
@ApiImplicitParam(name = "id", value = "专题ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public ResultMessage<Object> deleteSpecial(@PathVariable String id) {
|
||||
specialService.removeSpecial(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取专题活动")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<Special>> getSpecials(PageVO pageVo) {
|
||||
return ResultUtil.data(specialService.page(PageUtil.initPage(pageVo)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取专题活动列表")
|
||||
@GetMapping("/getSpecialsList")
|
||||
public ResultMessage<List<Special>> getSpecialsList() {
|
||||
return ResultUtil.data(specialService.list());
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取专题活动")
|
||||
@ApiImplicitParam(name = "id", value = "专题ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<Special> getSpecialsList(@PathVariable String id) {
|
||||
return ResultUtil.data(specialService.getById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.aop.annotation.DemoSite;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.verification.entity.dos.VerificationSource;
|
||||
import cn.lili.modules.verification.service.VerificationSourceService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
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.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,验证码资源维护接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/12/7 11:33
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,验证码资源维护接口")
|
||||
@RequestMapping("/manager/verificationSource")
|
||||
public class VerificationSourceController {
|
||||
|
||||
@Autowired
|
||||
private VerificationSourceService verificationSourceService;
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "查看验证码资源维护详情")
|
||||
public ResultMessage<VerificationSource> get(@PathVariable String id) {
|
||||
|
||||
VerificationSource verificationSource = verificationSourceService.getById(id);
|
||||
return ResultUtil.data(verificationSource);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "分页获取验证码资源维护")
|
||||
public ResultMessage<IPage<VerificationSource>> getByPage(VerificationSource entity,
|
||||
SearchVO searchVo,
|
||||
PageVO page) {
|
||||
IPage<VerificationSource> data = verificationSourceService.page(PageUtil.initPage(page), PageUtil.initWrapper(entity, searchVo));
|
||||
return ResultUtil.data(data);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增验证码资源维护")
|
||||
@DemoSite
|
||||
public ResultMessage<VerificationSource> save(VerificationSource verificationSource) {
|
||||
|
||||
verificationSourceService.save(verificationSource);
|
||||
verificationSourceService.initCache();
|
||||
return ResultUtil.data(verificationSource);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation(value = "更新验证码资源维护")
|
||||
@DemoSite
|
||||
public ResultMessage<VerificationSource> update(@PathVariable String id, VerificationSource verificationSource) {
|
||||
verificationSource.setId(id);
|
||||
verificationSourceService.updateById(verificationSource);
|
||||
verificationSourceService.initCache();
|
||||
return ResultUtil.data(verificationSource);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ApiOperation(value = "删除验证码资源维护")
|
||||
@DemoSite
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
|
||||
verificationSourceService.removeByIds(ids);
|
||||
verificationSourceService.initCache();
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package cn.lili.controller.other.broadcast;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
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.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 管理端,直播间管理接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2021/5/28 11:56 上午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,直播商品接口")
|
||||
@RequestMapping("/manager/broadcast/commodity")
|
||||
public class CommodityManagerController {
|
||||
|
||||
@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));
|
||||
}
|
||||
}
|
||||
@@ -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.Studio;
|
||||
import cn.lili.modules.goods.entity.vos.StudioVO;
|
||||
import cn.lili.modules.goods.service.StudioService;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,直播间接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2021/5/28 11:56 上午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,直播间接口")
|
||||
@RequestMapping("/manager/broadcast/studio")
|
||||
public class StudioManagerController {
|
||||
|
||||
@Autowired
|
||||
private StudioService studioService;
|
||||
|
||||
@ApiOperation(value = "获取店铺直播间列表")
|
||||
@ApiImplicitParam(name = "status", value = "直播间状态", paramType = "query")
|
||||
@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, paramType = "path")
|
||||
@GetMapping("/{studioId}")
|
||||
public ResultMessage<StudioVO> studioInfo(@PathVariable String studioId) {
|
||||
return ResultUtil.data(studioService.getStudioVO(studioId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "是否推荐直播间")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "Id", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "recommend", value = "是否推荐", required = true, paramType = "query")
|
||||
})
|
||||
@PutMapping("/recommend/{id}")
|
||||
public ResultMessage<Object> recommend(@PathVariable String id, @NotNull boolean recommend) {
|
||||
if (studioService.update(new UpdateWrapper<Studio>()
|
||||
.eq("id", id)
|
||||
.set("recommend", recommend))) {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package cn.lili.controller.other.purchase;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.purchase.entity.dos.PurchaseOrder;
|
||||
import cn.lili.modules.purchase.entity.dos.PurchaseQuoted;
|
||||
import cn.lili.modules.purchase.entity.params.PurchaseOrderSearchParams;
|
||||
import cn.lili.modules.purchase.entity.vos.PurchaseOrderVO;
|
||||
import cn.lili.modules.purchase.entity.vos.PurchaseQuotedVO;
|
||||
import cn.lili.modules.purchase.service.PurchaseOrderService;
|
||||
import cn.lili.modules.purchase.service.PurchaseQuotedService;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* 管理端,采购接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/16 10:06 下午
|
||||
*/
|
||||
@Api(tags = "管理端,采购接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/purchase")
|
||||
public class PurchaseManagerController {
|
||||
|
||||
/**
|
||||
* 采购单
|
||||
*/
|
||||
@Autowired
|
||||
private PurchaseOrderService purchaseOrderService;
|
||||
/**
|
||||
* 采购单报价
|
||||
*/
|
||||
@Autowired
|
||||
private PurchaseQuotedService purchaseQuotedService;
|
||||
|
||||
|
||||
@ApiOperation(value = "采购单分页")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<PurchaseOrder>> get(PurchaseOrderSearchParams purchaseOrderSearchParams) {
|
||||
return ResultUtil.data(purchaseOrderService.page(purchaseOrderSearchParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "采购单详情")
|
||||
@ApiImplicitParam(name = "id", value = "采购单ID", required = true, dataType = "Long", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public ResultMessage<PurchaseOrderVO> getPurchaseOrder(@NotNull @PathVariable String id) {
|
||||
return ResultUtil.data(purchaseOrderService.getPurchaseOrder(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "关闭采购单")
|
||||
@ApiImplicitParam(name = "id", value = "采购单ID", required = true, dataType = "Long", paramType = "path")
|
||||
@PutMapping("/{id}")
|
||||
public ResultMessage<Object> close(@NotNull @PathVariable String id) {
|
||||
|
||||
purchaseOrderService.close(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "报价列表")
|
||||
@ApiImplicitParam(name = "purchaseOrderId", value = "采购单ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/purchaseQuoted/list/{purchaseOrderId}")
|
||||
public ResultMessage<List<PurchaseQuoted>> get(@NotNull @PathVariable String purchaseOrderId) {
|
||||
return ResultUtil.data(purchaseQuotedService.getByPurchaseOrderId(purchaseOrderId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "报价单详情")
|
||||
@ApiImplicitParam(name = "id", value = "报价单ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/purchaseQuoted/{id}")
|
||||
public ResultMessage<PurchaseQuotedVO> getPurchaseQuoted(@NotNull @PathVariable String id) {
|
||||
return ResultUtil.data(purchaseQuotedService.getById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package cn.lili.controller.passport;
|
||||
|
||||
import cn.lili.common.aop.annotation.DemoSite;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.security.token.Token;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.modules.permission.entity.dos.AdminUser;
|
||||
import cn.lili.modules.permission.entity.dto.AdminUserDTO;
|
||||
import cn.lili.modules.permission.entity.vo.AdminUserVO;
|
||||
import cn.lili.modules.permission.service.AdminUserService;
|
||||
import cn.lili.modules.permission.service.DepartmentService;
|
||||
import cn.lili.modules.verification.entity.enums.VerificationEnums;
|
||||
import cn.lili.modules.verification.service.VerificationService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理员接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/16 10:57
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "管理员")
|
||||
@RequestMapping("/manager/user")
|
||||
@Validated
|
||||
public class AdminUserManagerController {
|
||||
@Autowired
|
||||
private AdminUserService adminUserService;
|
||||
@Autowired
|
||||
private DepartmentService departmentService;
|
||||
/**
|
||||
* 会员
|
||||
*/
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
|
||||
@Autowired
|
||||
private VerificationService verificationService;
|
||||
|
||||
@PostMapping(value = "/login")
|
||||
@ApiOperation(value = "登录管理员")
|
||||
public ResultMessage<Token> login(@NotNull(message = "用户名不能为空") @RequestParam String username,
|
||||
@NotNull(message = "密码不能为空") @RequestParam String password,
|
||||
@RequestHeader String uuid) {
|
||||
if (verificationService.check(uuid, VerificationEnums.LOGIN)) {
|
||||
return ResultUtil.data(adminUserService.login(username, password));
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.VERIFICATION_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "注销接口")
|
||||
@PostMapping("/logout")
|
||||
public ResultMessage<Object> logout() {
|
||||
this.memberService.logout(UserEnums.MANAGER);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "刷新token")
|
||||
@GetMapping("/refresh/{refreshToken}")
|
||||
public ResultMessage<Object> refreshToken(@NotNull(message = "刷新token不能为空") @PathVariable String refreshToken) {
|
||||
return ResultUtil.data(this.adminUserService.refreshToken(refreshToken));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation(value = "获取当前登录用户接口")
|
||||
public ResultMessage<AdminUserVO> getUserInfo() {
|
||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
||||
if (tokenUser != null) {
|
||||
AdminUserVO adminUser = new AdminUserVO(adminUserService.findByUsername(tokenUser.getUsername()));
|
||||
if (StringUtils.isNotEmpty(adminUser.getDepartmentId())) {
|
||||
adminUser.setDepartmentTitle(departmentService.getById(adminUser.getDepartmentId()).getTitle());
|
||||
}
|
||||
adminUser.setPassword(null);
|
||||
return ResultUtil.data(adminUser);
|
||||
}
|
||||
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/edit")
|
||||
@ApiOperation(value = "修改用户自己资料", notes = "用户名密码不会修改")
|
||||
public ResultMessage<Object> editOwner(AdminUser adminUser) {
|
||||
|
||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
||||
if (tokenUser != null) {
|
||||
//查询当前管理员
|
||||
AdminUser oldAdminUser = adminUserService.findByUsername(tokenUser.getUsername());
|
||||
oldAdminUser.setAvatar(adminUser.getAvatar());
|
||||
oldAdminUser.setNickName(adminUser.getNickName());
|
||||
if (!adminUserService.updateById(oldAdminUser)) {
|
||||
throw new ServiceException(ResultCode.USER_EDIT_ERROR);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.USER_EDIT_SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/admin/edit")
|
||||
@ApiOperation(value = "超级管理员修改其他管理员资料")
|
||||
@DemoSite
|
||||
public ResultMessage<Object> edit(@Valid AdminUser adminUser,
|
||||
@RequestParam(required = false) List<String> roles) {
|
||||
if (!adminUserService.updateAdminUser(adminUser, roles)) {
|
||||
throw new ServiceException(ResultCode.USER_EDIT_ERROR);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.USER_EDIT_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*
|
||||
* @param password
|
||||
* @param newPassword
|
||||
* @return
|
||||
*/
|
||||
@PutMapping(value = "/editPassword")
|
||||
@ApiOperation(value = "修改密码")
|
||||
@DemoSite
|
||||
public ResultMessage<Object> editPassword(String password, String newPassword) {
|
||||
adminUserService.editPassword(password, newPassword);
|
||||
return ResultUtil.success(ResultCode.USER_EDIT_SUCCESS);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/resetPassword/{ids}")
|
||||
@ApiOperation(value = "重置密码")
|
||||
@DemoSite
|
||||
public ResultMessage<Object> resetPassword(@PathVariable List ids) {
|
||||
adminUserService.resetPassword(ids);
|
||||
return ResultUtil.success(ResultCode.USER_EDIT_SUCCESS);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "多条件分页获取用户列表")
|
||||
public ResultMessage<IPage<AdminUserVO>> getByCondition(AdminUserDTO user,
|
||||
SearchVO searchVo,
|
||||
PageVO pageVo) {
|
||||
IPage<AdminUserVO> page = adminUserService.adminUserPage(PageUtil.initPage(pageVo), PageUtil.initWrapper(user, searchVo));
|
||||
|
||||
return ResultUtil.data(page);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加用户")
|
||||
public ResultMessage<Object> register(@Valid AdminUserDTO adminUser,
|
||||
@RequestParam(required = false) List<String> roles) {
|
||||
int rolesMaxSize=10;
|
||||
try {
|
||||
if (roles != null && roles.size() >= rolesMaxSize) {
|
||||
throw new ServiceException(ResultCode.PERMISSION_BEYOND_TEN);
|
||||
}
|
||||
adminUserService.saveAdminUser(adminUser, roles);
|
||||
} catch (Exception e) {
|
||||
log.error("添加用户错误", e);
|
||||
}
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@PutMapping(value = "/enable/{userId}")
|
||||
@ApiOperation(value = "禁/启 用 用户")
|
||||
@DemoSite
|
||||
public ResultMessage<Object> disable(@ApiParam("用户唯一id标识") @PathVariable String userId, Boolean status) {
|
||||
AdminUser user = adminUserService.getById(userId);
|
||||
if (user == null) {
|
||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||
}
|
||||
user.setStatus(status);
|
||||
adminUserService.updateById(user);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ApiOperation(value = "批量通过ids删除")
|
||||
@DemoSite
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List<String> ids) {
|
||||
adminUserService.deleteCompletely(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.permission.entity.dos.Department;
|
||||
import cn.lili.modules.permission.entity.vo.DepartmentVO;
|
||||
import cn.lili.modules.permission.service.DepartmentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,部门管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/22 12:06
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,部门管理接口")
|
||||
@RequestMapping("/manager/department")
|
||||
public class DepartmentManagerController {
|
||||
@Autowired
|
||||
private DepartmentService departmentService;
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "查看部门详情")
|
||||
public ResultMessage<Department> get(@PathVariable String id) {
|
||||
Department department = departmentService.getById(id);
|
||||
return ResultUtil.data(department);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取树状结构")
|
||||
public ResultMessage<List<DepartmentVO>> getByPage(Department entity,
|
||||
SearchVO searchVo) {
|
||||
return ResultUtil.data(departmentService.tree(PageUtil.initWrapper(entity, searchVo)));
|
||||
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增部门")
|
||||
public ResultMessage<Department> save(Department department) {
|
||||
departmentService.save(department);
|
||||
return ResultUtil.data(department);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation(value = "更新部门")
|
||||
public ResultMessage<Department> update(@PathVariable String id, Department department) {
|
||||
departmentService.updateById(department);
|
||||
departmentService.updateById(department);
|
||||
return ResultUtil.data(department);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ApiOperation(value = "删除部门")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List<String> ids) {
|
||||
departmentService.deleteByIds(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.permission.entity.dos.DepartmentRole;
|
||||
import cn.lili.modules.permission.service.DepartmentRoleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,部门角色接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/22 14:05
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,部门角色接口")
|
||||
@RequestMapping("/manager/departmentRole")
|
||||
public class DepartmentRoleManagerController {
|
||||
@Autowired
|
||||
private DepartmentRoleService departmentRoleService;
|
||||
|
||||
@GetMapping(value = "/{departmentId}")
|
||||
@ApiOperation(value = "查看部门拥有的角色")
|
||||
public ResultMessage<List<DepartmentRole>> get(@PathVariable String departmentId) {
|
||||
return ResultUtil.data(departmentRoleService.listByDepartmentId(departmentId));
|
||||
}
|
||||
|
||||
@PutMapping("/{departmentId}")
|
||||
@ApiOperation(value = "更新部门角色")
|
||||
public ResultMessage<DepartmentRole> update(@PathVariable String departmentId, @RequestBody List<DepartmentRole> departmentRole) {
|
||||
|
||||
departmentRoleService.updateByDepartmentId(departmentId, departmentRole);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.aop.annotation.DemoSite;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.permission.entity.dos.Menu;
|
||||
import cn.lili.modules.permission.entity.dto.MenuSearchParams;
|
||||
import cn.lili.modules.permission.entity.vo.MenuVO;
|
||||
import cn.lili.modules.permission.service.MenuService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,菜单管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/20 12:07
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "管理端,菜单管理接口")
|
||||
@RequestMapping("/manager/menu")
|
||||
public class MenuManagerController {
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@ApiOperation(value = "搜索菜单")
|
||||
@GetMapping
|
||||
public ResultMessage<List<Menu>> searchPermissionList(MenuSearchParams searchParams) {
|
||||
return ResultUtil.data(menuService.searchList(searchParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加")
|
||||
@PostMapping
|
||||
@DemoSite
|
||||
public ResultMessage<Menu> add(Menu menu) {
|
||||
try {
|
||||
menuService.saveOrUpdateMenu(menu);
|
||||
} catch (Exception e) {
|
||||
log.error("添加菜单错误", e);
|
||||
}
|
||||
return ResultUtil.data(menu);
|
||||
}
|
||||
|
||||
@ApiImplicitParam(name = "id", value = "菜单ID", required = true, paramType = "path", dataType = "String")
|
||||
@ApiOperation(value = "编辑")
|
||||
@PutMapping(value = "/{id}")
|
||||
|
||||
@DemoSite
|
||||
public ResultMessage<Menu> edit(@PathVariable String id, Menu menu) {
|
||||
menu.setId(id);
|
||||
menuService.saveOrUpdateMenu(menu);
|
||||
return ResultUtil.data(menu);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@DemoSite
|
||||
public ResultMessage<Menu> delByIds(@PathVariable List<String> ids) {
|
||||
menuService.deleteIds(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取所有菜单")
|
||||
@GetMapping("/tree")
|
||||
public ResultMessage<List<MenuVO>> getAllMenuList() {
|
||||
return ResultUtil.data(menuService.tree());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取所有菜单")
|
||||
@GetMapping("/memberMenu")
|
||||
public ResultMessage<List<MenuVO>> memberMenu() {
|
||||
return ResultUtil.data(menuService.findUserTree());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
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.permission.entity.dos.Role;
|
||||
import cn.lili.modules.permission.service.RoleService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,角色管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/20 18:50
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,角色管理接口")
|
||||
@RequestMapping("/manager/role")
|
||||
public class RoleManagerController {
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加")
|
||||
public ResultMessage<Role> add(Role role) {
|
||||
roleService.save(role);
|
||||
return ResultUtil.data(role);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "查询")
|
||||
public ResultMessage<Page> add(PageVO pageVo, Role role) {
|
||||
Page page = roleService.page(PageUtil.initPage(pageVo), PageUtil.initWrapper(role));
|
||||
return ResultUtil.data(page);
|
||||
}
|
||||
|
||||
@PutMapping("/{roleId}")
|
||||
@ApiOperation(value = "编辑")
|
||||
public ResultMessage<Role> edit(@PathVariable String roleId, Role role) {
|
||||
role.setId(roleId);
|
||||
roleService.updateById(role);
|
||||
return ResultUtil.data(role);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ApiOperation(value = "批量删除")
|
||||
public ResultMessage<Role> delByIds(@PathVariable List<String> ids) {
|
||||
roleService.deleteRoles(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.permission.entity.dos.RoleMenu;
|
||||
import cn.lili.modules.permission.service.RoleMenuService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,角色菜单接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/22 11:40
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,角色菜单接口")
|
||||
@RequestMapping("/manager/roleMenu")
|
||||
public class RoleMenuManagerController {
|
||||
@Autowired
|
||||
private RoleMenuService roleMenuService;
|
||||
|
||||
@GetMapping(value = "/{roleId}")
|
||||
@ApiOperation(value = "查看某角色拥有到菜单")
|
||||
public ResultMessage<List<RoleMenu>> get(@PathVariable String roleId) {
|
||||
return ResultUtil.data(roleMenuService.findByRoleId(roleId));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/{roleId}")
|
||||
@ApiOperation(value = "保存角色菜单")
|
||||
public ResultMessage save(@PathVariable String roleId, @RequestBody List<RoleMenu> roleMenus) {
|
||||
roleMenuService.updateRoleMenu(roleId, roleMenus);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.permission.entity.dos.UserRole;
|
||||
import cn.lili.modules.permission.service.UserRoleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,管理员角色接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/22 11:53
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,管理员角色接口")
|
||||
@RequestMapping("/manager/userRole")
|
||||
public class UserRoleManagerController {
|
||||
@Autowired
|
||||
private UserRoleService userRoleService;
|
||||
|
||||
@GetMapping(value = "/{userId}")
|
||||
@ApiOperation(value = "查看管理员角色")
|
||||
public ResultMessage<UserRole> get(@PathVariable String userId) {
|
||||
UserRole userRole = userRoleService.getById(userId);
|
||||
return ResultUtil.data(userRole);
|
||||
}
|
||||
|
||||
@PutMapping("/{userId}")
|
||||
@ApiOperation(value = "更新角色菜单")
|
||||
public ResultMessage<UserRole> update(@PathVariable String userId, List<UserRole> userRole) {
|
||||
userRoleService.updateUserRole(userId, userRole);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
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.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.dos.CouponActivity;
|
||||
import cn.lili.modules.promotion.entity.dto.CouponActivityDTO;
|
||||
import cn.lili.modules.promotion.entity.vos.CouponActivityVO;
|
||||
import cn.lili.modules.promotion.service.CouponActivityService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 优惠券活动
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2021/5/21 7:11 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,优惠券活动接口")
|
||||
@RequestMapping("/manager/promotion/couponActivity")
|
||||
public class CouponActivityManagerController {
|
||||
|
||||
@Autowired
|
||||
private CouponActivityService couponActivityService;
|
||||
|
||||
@ApiOperation(value = "获取优惠券活动分页")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<CouponActivity>> getCouponActivityPage(PageVO page) {
|
||||
return ResultUtil.data(couponActivityService.page(PageUtil.initPage(page)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取优惠券活动")
|
||||
@ApiImplicitParam(name = "couponActivityId", value = "优惠券活动ID", required = true, paramType = "path")
|
||||
@GetMapping("/{couponActivityId}")
|
||||
public ResultMessage<CouponActivityVO> getCouponActivity(@PathVariable String couponActivityId) {
|
||||
return ResultUtil.data(couponActivityService.getCouponActivityVO(couponActivityId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加优惠券活动")
|
||||
@PostMapping
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<CouponActivity> addCouponActivity(@RequestBody(required = false) CouponActivityDTO couponActivityDTO) {
|
||||
if (couponActivityService.savePromotions(couponActivityDTO)) {
|
||||
return ResultUtil.data(couponActivityDTO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.COUPON_ACTIVITY_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "关闭优惠券活动")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "优惠券活动ID", required = true, dataType = "String", paramType = "path")
|
||||
})
|
||||
@DeleteMapping("/{id}")
|
||||
public ResultMessage<CouponActivity> updateStatus(@PathVariable String id) {
|
||||
if (couponActivityService.updateStatus(Collections.singletonList(id), null, null)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.dos.Coupon;
|
||||
import cn.lili.modules.promotion.entity.dos.MemberCoupon;
|
||||
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 cn.lili.modules.promotion.service.MemberCouponService;
|
||||
import cn.lili.modules.promotion.tools.PromotionTools;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,优惠券接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/10/9
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,优惠券接口")
|
||||
@RequestMapping("/manager/promotion/coupon")
|
||||
public class CouponManagerController {
|
||||
@Autowired
|
||||
private CouponService couponService;
|
||||
@Autowired
|
||||
private MemberCouponService memberCouponService;
|
||||
|
||||
@ApiOperation(value = "获取优惠券列表")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<CouponVO>> getCouponList(CouponSearchParams queryParam, PageVO page) {
|
||||
queryParam.setStoreId(PromotionTools.PLATFORM_ID);
|
||||
return ResultUtil.data(couponService.pageVOFindAll(queryParam, page));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取优惠券详情")
|
||||
@GetMapping("/{couponId}")
|
||||
public ResultMessage<CouponVO> getCoupon(@PathVariable String couponId) {
|
||||
CouponVO coupon = couponService.getDetail(couponId);
|
||||
return ResultUtil.data(coupon);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加优惠券")
|
||||
@PostMapping(consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<CouponVO> addCoupon(@RequestBody CouponVO couponVO) {
|
||||
this.setStoreInfo(couponVO);
|
||||
couponService.savePromotions(couponVO);
|
||||
return ResultUtil.data(couponVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改优惠券")
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<Coupon> updateCoupon(@RequestBody CouponVO couponVO) {
|
||||
this.setStoreInfo(couponVO);
|
||||
Coupon coupon = couponService.getById(couponVO.getId());
|
||||
couponService.updatePromotions(couponVO);
|
||||
return ResultUtil.data(coupon);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改优惠券状态")
|
||||
@PutMapping("/status")
|
||||
public ResultMessage<Object> updateCouponStatus(String couponIds, Long startTime, Long endTime) {
|
||||
String[] split = couponIds.split(",");
|
||||
if (couponService.updateStatus(Arrays.asList(split), startTime, endTime)) {
|
||||
return ResultUtil.success(ResultCode.COUPON_EDIT_STATUS_SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.COUPON_EDIT_STATUS_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List<String> ids) {
|
||||
couponService.removePromotions(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "会员优惠券作废")
|
||||
@PutMapping(value = "/member/cancellation/{id}")
|
||||
public ResultMessage<Object> cancellation(@PathVariable String id) {
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
memberCouponService.cancellation(currentUser.getId(), id);
|
||||
return ResultUtil.success(ResultCode.COUPON_CANCELLATION_SUCCESS);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据优惠券id券分页获取会员领详情")
|
||||
@GetMapping(value = "/member/{id}")
|
||||
public ResultMessage<IPage<MemberCoupon>> getByPage(@PathVariable String id,
|
||||
PageVO page) {
|
||||
QueryWrapper<MemberCoupon> queryWrapper = new QueryWrapper<>();
|
||||
IPage<MemberCoupon> data = memberCouponService.page(PageUtil.initPage(page),
|
||||
queryWrapper.eq("coupon_id", id)
|
||||
);
|
||||
return ResultUtil.data(data);
|
||||
|
||||
}
|
||||
|
||||
private void setStoreInfo(CouponVO couponVO) {
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
if (currentUser == null) {
|
||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||
}
|
||||
couponVO.setStoreId(PromotionTools.PLATFORM_ID);
|
||||
couponVO.setStoreName(PromotionTools.PLATFORM_NAME);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,满额活动接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2021/1/12
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,满额活动接口")
|
||||
@RequestMapping("/manager/promotion/fullDiscount")
|
||||
public class FullDiscountManagerController {
|
||||
|
||||
@Autowired
|
||||
private FullDiscountService fullDiscountService;
|
||||
|
||||
@ApiOperation(value = "获取满优惠列表")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<FullDiscount>> getCouponList(FullDiscountSearchParams searchParams, PageVO page) {
|
||||
page.setNotConvert(true);
|
||||
return ResultUtil.data(fullDiscountService.pageFindAll(searchParams, page));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取满优惠详情")
|
||||
@GetMapping("/{id}")
|
||||
public ResultMessage<FullDiscountVO> getCouponDetail(@PathVariable String id) {
|
||||
return ResultUtil.data(fullDiscountService.getFullDiscount(id));
|
||||
}
|
||||
|
||||
@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) {
|
||||
if (fullDiscountService.updateStatus(Collections.singletonList(id), startTime, endTime)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
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.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.dos.KanjiaActivityGoods;
|
||||
import cn.lili.modules.promotion.entity.dto.KanjiaActivityGoodsDTO;
|
||||
import cn.lili.modules.promotion.entity.dto.KanjiaActivityGoodsOperationDTO;
|
||||
import cn.lili.modules.promotion.entity.dto.search.KanjiaActivityGoodsParams;
|
||||
import cn.lili.modules.promotion.service.KanjiaActivityGoodsService;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,促销接口
|
||||
*
|
||||
* @author qiuqiu
|
||||
* @since 2021/7/2
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,砍价促销接口")
|
||||
@RequestMapping("/manager/promotion/kan-jia-goods")
|
||||
public class KanJiaActivityGoodsManagerController {
|
||||
|
||||
@Autowired
|
||||
private KanjiaActivityGoodsService kanJiaActivityGoodsService;
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加砍价活动")
|
||||
public ResultMessage<Object> add(@RequestBody KanjiaActivityGoodsOperationDTO kanJiaActivityGoodsOperationDTO) {
|
||||
kanJiaActivityGoodsService.add(kanJiaActivityGoodsOperationDTO);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取砍价活动分页")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<KanjiaActivityGoods>> getKanJiaActivityPage(KanjiaActivityGoodsParams kanJiaParams, PageVO page) {
|
||||
return ResultUtil.data(kanJiaActivityGoodsService.pageFindAll(kanJiaParams, page));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取积分商品详情")
|
||||
public ResultMessage<Object> getPointsGoodsDetail(@PathVariable("id") String goodsId) {
|
||||
KanjiaActivityGoodsDTO kanJiaActivityGoodsDTO = kanJiaActivityGoodsService.getKanjiaGoodsDetail(goodsId);
|
||||
return ResultUtil.data(kanJiaActivityGoodsDTO);
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改砍价商品")
|
||||
public ResultMessage<Object> updatePointsGoods(@RequestBody KanjiaActivityGoodsDTO kanJiaActivityGoodsDTO) {
|
||||
if (!kanJiaActivityGoodsService.updateKanjiaActivityGoods(kanJiaActivityGoodsDTO)) {
|
||||
return ResultUtil.error(ResultCode.KANJIA_GOODS_UPDATE_ERROR);
|
||||
}
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation(value = "删除砍价商品")
|
||||
public ResultMessage<Object> delete(@PathVariable String ids) {
|
||||
if (kanJiaActivityGoodsService.removePromotions(Arrays.asList(ids.split(",")))) {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
throw new ServiceException(ResultCode.KANJIA_GOODS_DELETE_ERROR);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.PromotionTypeEnum;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.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.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 管理端,平台拼团接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/10/9
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,平台拼团接口")
|
||||
@RequestMapping("/manager/promotion/pintuan")
|
||||
public class PintuanManagerController {
|
||||
@Autowired
|
||||
private PintuanService pintuanService;
|
||||
@Autowired
|
||||
private PromotionGoodsService promotionGoodsService;
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "通过id获取")
|
||||
public ResultMessage<PintuanVO> get(@PathVariable String id) {
|
||||
PintuanVO pintuan = pintuanService.getPintuanVO(id);
|
||||
return ResultUtil.data(pintuan);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "根据条件分页查询拼团活动列表")
|
||||
public ResultMessage<IPage<Pintuan>> getPintuanByPage(PintuanSearchParams queryParam, PageVO pageVo) {
|
||||
IPage<Pintuan> pintuanIPage = pintuanService.pageFindAll(queryParam, pageVo);
|
||||
return ResultUtil.data(pintuanIPage);
|
||||
}
|
||||
|
||||
@GetMapping("/goods/{pintuanId}")
|
||||
@ApiOperation(value = "根据条件分页查询拼团活动商品列表")
|
||||
public ResultMessage<IPage<PromotionGoods>> getPintuanGoodsByPage(@PathVariable String pintuanId, PageVO pageVo) {
|
||||
PromotionGoodsSearchParams searchParams = new PromotionGoodsSearchParams();
|
||||
searchParams.setPromotionId(pintuanId);
|
||||
searchParams.setPromotionType(PromotionTypeEnum.PINTUAN.name());
|
||||
return ResultUtil.data(promotionGoodsService.pageFindAll(searchParams, pageVo));
|
||||
}
|
||||
|
||||
@PutMapping("/status/{pintuanIds}")
|
||||
@ApiOperation(value = "操作拼团活动状态")
|
||||
public ResultMessage<String> openPintuan(@PathVariable String pintuanIds, Long startTime, Long endTime) {
|
||||
if (pintuanService.updateStatus(Arrays.asList(pintuanIds.split(",")), startTime, endTime)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_MANUAL_OPEN_SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.PINTUAN_MANUAL_OPEN_ERROR);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.dos.PointsGoodsCategory;
|
||||
import cn.lili.modules.promotion.entity.vos.PointsGoodsCategoryVO;
|
||||
import cn.lili.modules.promotion.service.PointsGoodsCategoryService;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* 管理端,积分商品分类接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2021/1/14
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,积分商品分类接口")
|
||||
@RequestMapping("/manager/promotion/pointsGoodsCategory")
|
||||
public class PointsGoodsCategoryManagerController {
|
||||
@Autowired
|
||||
private PointsGoodsCategoryService pointsGoodsCategoryService;
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加积分商品分类")
|
||||
public ResultMessage<Object> add(PointsGoodsCategoryVO pointsGoodsCategory) {
|
||||
pointsGoodsCategoryService.addCategory(pointsGoodsCategory);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改积分商品分类")
|
||||
public ResultMessage<Object> update(PointsGoodsCategoryVO pointsGoodsCategory) {
|
||||
pointsGoodsCategoryService.updateCategory(pointsGoodsCategory);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除积分商品分类")
|
||||
public ResultMessage<Object> delete(@PathVariable String id) {
|
||||
pointsGoodsCategoryService.deleteCategory(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取积分商品分类分页")
|
||||
public ResultMessage<IPage<PointsGoodsCategory>> page(String name, PageVO page) {
|
||||
return ResultUtil.data(pointsGoodsCategoryService.getCategoryByPage(name, page));
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "修改积分商品分类")
|
||||
public ResultMessage<Object> getById(@PathVariable String id) {
|
||||
return ResultUtil.data(pointsGoodsCategoryService.getCategoryDetail(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
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.context.UserContext;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.dos.PointsGoods;
|
||||
import cn.lili.modules.promotion.entity.dto.search.PointsGoodsSearchParams;
|
||||
import cn.lili.modules.promotion.entity.vos.PointsGoodsVO;
|
||||
import cn.lili.modules.promotion.service.PointsGoodsService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,积分商品接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2021/1/14
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,积分商品接口")
|
||||
@RequestMapping("/manager/promotion/pointsGoods")
|
||||
public class PointsGoodsManagerController {
|
||||
@Autowired
|
||||
private PointsGoodsService pointsGoodsService;
|
||||
|
||||
@PostMapping(consumes = "application/json", produces = "application/json")
|
||||
@ApiOperation(value = "添加积分商品")
|
||||
public ResultMessage<Object> addPointsGoods(@RequestBody List<PointsGoods> pointsGoodsList) {
|
||||
if (pointsGoodsService.savePointsGoodsBatch(pointsGoodsList)) {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
return ResultUtil.error(ResultCode.POINT_GOODS_ERROR);
|
||||
}
|
||||
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
@ApiOperation(value = "修改积分商品")
|
||||
public ResultMessage<Object> updatePointsGoods(@RequestBody PointsGoodsVO pointsGoods) {
|
||||
Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
pointsGoodsService.updatePromotions(pointsGoods);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@PutMapping("/status/{ids}")
|
||||
@ApiOperation(value = "修改积分商品状态")
|
||||
public ResultMessage<Object> updatePointsGoodsStatus(@PathVariable String ids, Long startTime, Long endTime) {
|
||||
if (pointsGoodsService.updateStatus(Arrays.asList(ids.split(",")), startTime, endTime)) {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
return ResultUtil.error(ResultCode.POINT_GOODS_ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation(value = "删除积分商品")
|
||||
public ResultMessage<Object> delete(@PathVariable String ids) {
|
||||
if (pointsGoodsService.removePromotions(Arrays.asList(ids.split(",")))) {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
throw new ServiceException(ResultCode.POINT_GOODS_ERROR);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "分页获取积分商品")
|
||||
public ResultMessage<IPage<PointsGoods>> getPointsGoodsPage(PointsGoodsSearchParams searchParams, PageVO page) {
|
||||
IPage<PointsGoods> pointsGoodsByPage = pointsGoodsService.pageFindAll(searchParams, page);
|
||||
return ResultUtil.data(pointsGoodsByPage);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取积分商品详情")
|
||||
public ResultMessage<Object> getPointsGoodsDetail(@PathVariable String id) {
|
||||
PointsGoodsVO pointsGoodsDetail = pointsGoodsService.getPointsGoodsDetail(id);
|
||||
return ResultUtil.data(pointsGoodsDetail);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.dos.PromotionGoods;
|
||||
import cn.lili.modules.promotion.entity.dto.search.PromotionGoodsSearchParams;
|
||||
import cn.lili.modules.promotion.entity.enums.PromotionsStatusEnum;
|
||||
import cn.lili.modules.promotion.service.PromotionGoodsService;
|
||||
import cn.lili.modules.promotion.service.PromotionService;
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 管理端,促销接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2021/2/2
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,促销接口")
|
||||
@RequestMapping("/manager/promotion")
|
||||
public class PromotionManagerController {
|
||||
|
||||
@Autowired
|
||||
private PromotionService promotionService;
|
||||
@Autowired
|
||||
private PromotionGoodsService promotionGoodsService;
|
||||
|
||||
@GetMapping("/current")
|
||||
@ApiOperation(value = "获取当前进行中的促销活动")
|
||||
public ResultMessage<Map<String, Object>> getCurrentPromotion() {
|
||||
Map<String, Object> currentPromotion = promotionService.getCurrentPromotion();
|
||||
return ResultUtil.data(currentPromotion);
|
||||
}
|
||||
|
||||
@GetMapping("/{promotionId}/goods")
|
||||
@ApiOperation(value = "获取当前进行中的促销活动商品")
|
||||
public ResultMessage<IPage<PromotionGoods>> getPromotionGoods(@PathVariable String promotionId, String promotionType, PageVO pageVO) {
|
||||
PromotionGoodsSearchParams searchParams = new PromotionGoodsSearchParams();
|
||||
searchParams.setPromotionId(promotionId);
|
||||
searchParams.setPromotionType(promotionType);
|
||||
searchParams.setPromotionStatus(PromotionsStatusEnum.START.name());
|
||||
IPage<PromotionGoods> promotionGoods = promotionGoodsService.pageFindAll(searchParams, pageVO);
|
||||
return ResultUtil.data(promotionGoods);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.dos.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.SeckillVO;
|
||||
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.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* 管理端,秒杀活动接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/8/20
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,秒杀活动接口")
|
||||
@RequestMapping("/manager/promotion/seckill")
|
||||
public class SeckillManagerController {
|
||||
@Autowired
|
||||
private SeckillService seckillService;
|
||||
@Autowired
|
||||
private SeckillApplyService seckillApplyService;
|
||||
|
||||
|
||||
@ApiOperation(value = "初始化秒杀活动(初始化方法,默认初始化30天内的活动)")
|
||||
@GetMapping("/init")
|
||||
public void addSeckill() {
|
||||
seckillService.init();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "修改秒杀活动")
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<Seckill> updateSeckill(@RequestBody SeckillVO seckillVO) {
|
||||
seckillService.updatePromotions(seckillVO);
|
||||
return ResultUtil.data(seckillVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id获取")
|
||||
@ApiImplicitParam(name = "id", value = "秒杀活动ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<Seckill> get(@PathVariable String id) {
|
||||
Seckill seckill = seckillService.getById(id);
|
||||
return ResultUtil.data(seckill);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页查询秒杀活动列表")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<Seckill>> getAll(SeckillSearchParams param, PageVO pageVo) {
|
||||
return ResultUtil.data(seckillService.pageFindAll(param, pageVo));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除一个秒杀活动")
|
||||
@ApiImplicitParam(name = "id", value = "秒杀活动ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public ResultMessage<Object> deleteSeckill(@PathVariable String id) {
|
||||
seckillService.removePromotions(Collections.singletonList(id));
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "操作秒杀活动状态")
|
||||
@ApiImplicitParam(name = "id", value = "秒杀活动ID", required = true, dataType = "String", paramType = "path")
|
||||
@PutMapping("/status/{id}")
|
||||
public ResultMessage<Object> updateSeckillStatus(@PathVariable String id, Long startTime, Long endTime) {
|
||||
seckillService.updateStatus(Collections.singletonList(id), startTime, endTime);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取秒杀活动申请列表")
|
||||
@GetMapping("/apply")
|
||||
public ResultMessage<IPage<SeckillApply>> getSeckillApply(SeckillSearchParams param, PageVO pageVo) {
|
||||
IPage<SeckillApply> seckillApply = seckillApplyService.getSeckillApplyPage(param, pageVo);
|
||||
return ResultUtil.data(seckillApply);
|
||||
}
|
||||
|
||||
@DeleteMapping("/apply/{seckillId}/{id}")
|
||||
@ApiOperation(value = "删除秒杀活动申请")
|
||||
public ResultMessage<String> deleteSeckillApply(@PathVariable String seckillId, @PathVariable String id) {
|
||||
seckillApplyService.removeSeckillApply(seckillId, id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.system.entity.dos.AppVersion;
|
||||
import cn.lili.modules.system.service.AppVersionService;
|
||||
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.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 管理端,app版本控制器
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2018-07-04 21:50:52
|
||||
*/
|
||||
@RestController
|
||||
@Api("管理端,app版本控制器")
|
||||
@RequestMapping("/manager/systems/app/version")
|
||||
public class AppVersionManagerController {
|
||||
@Autowired
|
||||
private AppVersionService appVersionService;
|
||||
|
||||
|
||||
@ApiOperation(value = "查询app升级消息", response = AppVersion.class)
|
||||
@GetMapping
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "type", value = "APP类型", required = true, dataType = "type", paramType = "query")
|
||||
})
|
||||
public ResultMessage<IPage<AppVersion>> getByPage(PageVO page, String type) {
|
||||
return ResultUtil.data(this.appVersionService.page(PageUtil.initPage(page),
|
||||
new QueryWrapper<AppVersion>().eq(StringUtils.isNotEmpty(type), "type", type).orderByDesc("create_time")));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "添加app版本信息", response = AppVersion.class)
|
||||
@PostMapping
|
||||
public ResultMessage<Object> add(@Valid AppVersion appVersion) {
|
||||
|
||||
if(this.appVersionService.checkAppVersion(appVersion)){
|
||||
if(this.appVersionService.save(appVersion)){
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/{id}")
|
||||
@ApiOperation(value = "修改app版本信息", response = AppVersion.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String", paramType = "path")
|
||||
})
|
||||
public ResultMessage<Object> edit(@Valid AppVersion appVersion, @PathVariable String id) {
|
||||
|
||||
if(this.appVersionService.checkAppVersion(appVersion)){
|
||||
if(this.appVersionService.updateById(appVersion)){
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{id}")
|
||||
@ApiOperation(value = "删除app版本")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "要删除的app版本主键", required = true, dataType = "String", paramType = "path")
|
||||
})
|
||||
public ResultMessage<Boolean> delete(@PathVariable String id) {
|
||||
if(this.appVersionService.removeById(id)){
|
||||
return ResultUtil.success();
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,日志管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/17 7:56 下午
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "日志管理接口")
|
||||
@RequestMapping("/manager/log")
|
||||
public class LogManagerController {
|
||||
@Autowired
|
||||
private SystemLogService systemLogService;
|
||||
|
||||
@GetMapping(value = "/getAllByPage")
|
||||
@ApiOperation(value = "分页获取全部")
|
||||
public ResultMessage<Object> getAllByPage(@RequestParam(required = false) Integer type,
|
||||
@RequestParam String searchKey,
|
||||
String operatorName,
|
||||
SearchVO searchVo,
|
||||
PageVO pageVo) {
|
||||
try {
|
||||
return ResultUtil.data(systemLogService.queryLog(null, operatorName, searchKey, searchVo, pageVo));
|
||||
} catch (Exception e) {
|
||||
log.error("日志获取错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
public ResultMessage<Object> delByIds(@PathVariable List<String> ids) {
|
||||
systemLogService.deleteLog(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation(value = "全部删除")
|
||||
public ResultMessage<Object> delAll() {
|
||||
systemLogService.flushAll();
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.system.entity.dos.Logistics;
|
||||
import cn.lili.modules.system.service.LogisticsService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
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 javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 管理端,物流公司接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/17 7:56 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,物流公司接口")
|
||||
@RequestMapping("/manager/logistics")
|
||||
public class LogisticsManagerController {
|
||||
@Autowired
|
||||
private LogisticsService logisticsService;
|
||||
|
||||
@ApiOperation(value = "通过id获取物流公司")
|
||||
@GetMapping(value = "/get/{id}")
|
||||
public ResultMessage<Logistics> get(@PathVariable String id) {
|
||||
return ResultUtil.data(logisticsService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取物流公司")
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<Logistics>> getByPage(PageVO page) {
|
||||
return ResultUtil.data(logisticsService.page(PageUtil.initPage(page)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑物流公司")
|
||||
@ApiImplicitParam(name = "id", value = "物流公司ID", required = true, paramType = "path", dataType = "string")
|
||||
@PutMapping(value = "/{id}")
|
||||
public ResultMessage<Logistics> update(@NotNull @PathVariable String id, @Valid Logistics logistics) {
|
||||
logistics.setId(id);
|
||||
logisticsService.updateById(logistics);
|
||||
return ResultUtil.data(logistics);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加物流公司")
|
||||
@PostMapping(value = "/save")
|
||||
public ResultMessage<Logistics> save(@Valid Logistics logistics) {
|
||||
logisticsService.save(logistics);
|
||||
return ResultUtil.data(logistics);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除物流公司")
|
||||
@ApiImplicitParam(name = "id", value = "物流公司ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping(value = "/delete/{id}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable String id) {
|
||||
logisticsService.removeById(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.enums.SwitchEnum;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.BeanUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.message.entity.dos.NoticeMessage;
|
||||
import cn.lili.modules.message.entity.dto.NoticeMessageDetailDTO;
|
||||
import cn.lili.modules.message.entity.enums.NoticeMessageParameterEnum;
|
||||
import cn.lili.modules.message.service.NoticeMessageService;
|
||||
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.apache.commons.lang3.EnumUtils;
|
||||
import org.elasticsearch.ResourceNotFoundException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,会员站内信管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/17 4:31 下午
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员站内信管理接口")
|
||||
@RequestMapping("/manager/noticeMessage")
|
||||
public class NoticeMessageManagerController {
|
||||
@Autowired
|
||||
private NoticeMessageService noticeMessageService;
|
||||
|
||||
@ApiOperation(value = "消息模板分页")
|
||||
@GetMapping
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "type", value = "消息类型", dataType = "String", paramType = "query",
|
||||
allowableValues = "MEMBER,OTHER,STORE,WECHAT", allowMultiple = true)
|
||||
})
|
||||
public ResultMessage<IPage<NoticeMessage>> getPage(PageVO pageVO, String type) {
|
||||
return ResultUtil.data(noticeMessageService.getMessageTemplate(pageVO, type));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "根据id获取通知详情")
|
||||
@ApiImplicitParam(name = "id", value = "模板id", dataType = "String", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public ResultMessage<NoticeMessageDetailDTO> get(@PathVariable String id) {
|
||||
//根据id获取当前消息模板
|
||||
NoticeMessage noticeMessage = noticeMessageService.getById(id);
|
||||
if (noticeMessage != null) {
|
||||
NoticeMessageDetailDTO noticeMessageDetailDTO = new NoticeMessageDetailDTO();
|
||||
BeanUtil.copyProperties(noticeMessage, noticeMessageDetailDTO);
|
||||
//组织消息变量
|
||||
String[] variableNames = noticeMessage.getVariable().split(",");
|
||||
//定义返回参数中变量列表
|
||||
List<String> variableValues = new ArrayList<>();
|
||||
//循环消息变量赋值
|
||||
if (variableNames.length > 0) {
|
||||
for (String variableName : variableNames) {
|
||||
if (NoticeMessageParameterEnum.getValueByType(variableName) != null) {
|
||||
variableValues.add(NoticeMessageParameterEnum.getValueByType(variableName));
|
||||
}
|
||||
}
|
||||
noticeMessageDetailDTO.setVariables(variableValues);
|
||||
}
|
||||
|
||||
return ResultUtil.data(noticeMessageDetailDTO);
|
||||
}
|
||||
throw new ResourceNotFoundException(ResultCode.NOTICE_NOT_EXIST.message());
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "修改站内信模板")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "noticeContent", value = "站内信内容", dataType = "String", paramType = "query"),
|
||||
@ApiImplicitParam(name = "noticeTitle", value = "站内信模板标题", dataType = "String", paramType = "query"),
|
||||
@ApiImplicitParam(name = "id", value = "模板id", dataType = "String", paramType = "path")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public ResultMessage<NoticeMessage> updateNoticeTemplate(@RequestParam String noticeContent,
|
||||
@RequestParam String noticeTitle,
|
||||
@PathVariable String id) {
|
||||
//根据id获取当前消息模板
|
||||
NoticeMessage noticeMessage = noticeMessageService.getById(id);
|
||||
if (noticeMessage != null) {
|
||||
noticeMessage.setNoticeContent(noticeContent);
|
||||
noticeMessage.setNoticeTitle(noticeTitle);
|
||||
noticeMessageService.updateById(noticeMessage);
|
||||
return ResultUtil.data(noticeMessage);
|
||||
}
|
||||
throw new ResourceNotFoundException(ResultCode.NOTICE_NOT_EXIST.message());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改站内信状态")
|
||||
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "站内信状态", dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "status", value = "站内信状态", dataType = "String", paramType = "path")
|
||||
})
|
||||
@PutMapping("/{id}/{status}")
|
||||
public ResultMessage<NoticeMessage> status(@PathVariable String id, @PathVariable String status) {
|
||||
//根据id获取当前消息模板
|
||||
NoticeMessage messageTemplate = noticeMessageService.getById(id);
|
||||
if (messageTemplate != null) {
|
||||
//校验传递站内信是否符合规范
|
||||
Boolean b = EnumUtils.isValidEnum(SwitchEnum.class, status);
|
||||
if (b) {
|
||||
//赋值执行修改操作
|
||||
messageTemplate.setNoticeStatus(status);
|
||||
noticeMessageService.updateById(messageTemplate);
|
||||
return ResultUtil.data(messageTemplate);
|
||||
}
|
||||
throw new ServiceException(ResultCode.NOTICE_ERROR);
|
||||
}
|
||||
throw new ResourceNotFoundException(ResultCode.NOTICE_NOT_EXIST.message());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.aop.annotation.DemoSite;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.system.entity.dos.Region;
|
||||
import cn.lili.modules.system.service.RegionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,行政地区管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/12/2 10:40
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,行政地区管理接口")
|
||||
@RequestMapping("/manager/region")
|
||||
public class RegionManagerController {
|
||||
@Autowired
|
||||
private RegionService regionService;
|
||||
|
||||
@DemoSite
|
||||
@PostMapping(value = "/sync")
|
||||
@ApiOperation(value = "同步高德行政地区数据")
|
||||
public void synchronizationData(String url) {
|
||||
regionService.synchronizationData(url);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "地区ID", required = true, dataType = "String", paramType = "path")
|
||||
@ApiOperation(value = "通过id获取地区详情")
|
||||
public ResultMessage<Region> get(@PathVariable String id) {
|
||||
return ResultUtil.data(regionService.getById(id));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/item/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "地区ID", required = true, dataType = "String", paramType = "path")
|
||||
@ApiOperation(value = "通过id获取子地区")
|
||||
public ResultMessage<List<Region>> getItem(@PathVariable String id) {
|
||||
return ResultUtil.data(regionService.getItem(id));
|
||||
}
|
||||
|
||||
@PutMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "地区ID", required = true, dataType = "String", paramType = "path")
|
||||
@ApiOperation(value = "更新地区")
|
||||
public ResultMessage<Region> update(@PathVariable String id, @Valid Region region) {
|
||||
region.setId(id);
|
||||
regionService.updateById(region);
|
||||
return ResultUtil.data(region);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "增加地区")
|
||||
public ResultMessage<Region> save(@Valid Region region) {
|
||||
regionService.save(region);
|
||||
return ResultUtil.data(region);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "{ids}")
|
||||
@ApiImplicitParam(name = "id", value = "地区ID", required = true, dataType = "String", allowMultiple = true, paramType = "path")
|
||||
@ApiOperation(value = "批量通过id删除")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List<String> ids) {
|
||||
regionService.removeByIds(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.aop.annotation.DemoSite;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
import cn.lili.modules.system.entity.dto.*;
|
||||
import cn.lili.modules.system.entity.dto.connect.QQConnectSetting;
|
||||
import cn.lili.modules.system.entity.dto.connect.WechatConnectSetting;
|
||||
import cn.lili.modules.system.entity.dto.payment.AlipayPaymentSetting;
|
||||
import cn.lili.modules.system.entity.dto.payment.PaymentSupportSetting;
|
||||
import cn.lili.modules.system.entity.dto.payment.WechatPaymentSetting;
|
||||
import cn.lili.modules.system.entity.dto.payment.dto.PaymentSupportForm;
|
||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
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.Collections;
|
||||
|
||||
/**
|
||||
* 管理端,系统设置接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/26 15:53
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,系统设置接口")
|
||||
@RequestMapping("/manager/system/setting")
|
||||
public class SettingManagerController {
|
||||
@Autowired
|
||||
private SettingService settingService;
|
||||
|
||||
|
||||
@DemoSite
|
||||
@ApiOperation(value = "更新配置")
|
||||
@PutMapping(value = "/put/{key}")
|
||||
@ApiImplicitParam(name = "key", value = "配置key", paramType = "path",
|
||||
allowableValues = "BASE_SETTING,EMAIL_SETTING,GOODS_SETTING,KUAIDI_SETTING,ORDER_SETTING,OSS_SETTING,POINT_SETTING," +
|
||||
"WECHAT_PC_CONNECT,WECHAT_WAP_CONNECT,WECHAT_APP_CONNECT,WECHAT_MP_CONNECT," +
|
||||
"QQ_WEB_CONNECT,QQ_APP_CONNECT," +
|
||||
"QQ_WEB_CONNECT,QQ_APP_CONNECT,WEIBO_CONNECT,ALIPAY_CONNECT," +
|
||||
"PAYMENT_SUPPORT,ALIPAY_PAYMENT,WECHAT_PAYMENT,SECKILL_SETTING,EXPERIENCE_SETTING,IM")
|
||||
public ResultMessage saveConfig(@PathVariable String key, @RequestBody String configValue) {
|
||||
SettingEnum settingEnum = SettingEnum.valueOf(key);
|
||||
//获取系统配置
|
||||
Setting setting = settingService.getById(settingEnum.name());
|
||||
if (setting == null) {
|
||||
setting = new Setting();
|
||||
setting.setId(settingEnum.name());
|
||||
}
|
||||
//特殊配置过滤
|
||||
configValue = filter(settingEnum, configValue);
|
||||
|
||||
setting.setSettingValue(configValue);
|
||||
settingService.saveUpdate(setting);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
|
||||
@DemoSite
|
||||
@ApiOperation(value = "查看配置")
|
||||
@GetMapping(value = "/get/{key}")
|
||||
@ApiImplicitParam(name = "key", value = "配置key", paramType = "path"
|
||||
, allowableValues = "BASE_SETTING,EMAIL_SETTING,GOODS_SETTING,KUAIDI_SETTING,ORDER_SETTING,OSS_SETTING,POINT_SETTING," +
|
||||
"WECHAT_PC_CONNECT,WECHAT_WAP_CONNECT,WECHAT_APP_CONNECT,WECHAT_MP_CONNECT," +
|
||||
"QQ_WEB_CONNECT,QQ_APP_CONNECT," +
|
||||
"QQ_WEB_CONNECT,QQ_APP_CONNECT,WEIBO_CONNECT,ALIPAY_CONNECT," +
|
||||
"PAYMENT_SUPPORT,ALIPAY_PAYMENT,WECHAT_PAYMENT,SECKILL_SETTING,EXPERIENCE_SETTING,IM"
|
||||
)
|
||||
public ResultMessage settingGet(@PathVariable String key) {
|
||||
return createSetting(key);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 对配置进行过滤
|
||||
*
|
||||
* @param settingEnum
|
||||
* @param configValue
|
||||
*/
|
||||
private String filter(SettingEnum settingEnum, String configValue) {
|
||||
if (settingEnum.equals(SettingEnum.POINT_SETTING)) {
|
||||
PointSetting pointSetting = JSONUtil.toBean(configValue, PointSetting.class);
|
||||
if (pointSetting.getPointSettingItems() != null && pointSetting.getPointSettingItems().size() > 0) {
|
||||
Collections.sort(pointSetting.getPointSettingItems());
|
||||
if (pointSetting.getPointSettingItems().size() > 4) {
|
||||
pointSetting.setPointSettingItems(pointSetting.getPointSettingItems().subList(0, 4));
|
||||
}
|
||||
}
|
||||
configValue = JSONUtil.toJsonStr(pointSetting);
|
||||
}
|
||||
return configValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表单
|
||||
* 这里主要包含一个配置对象为空,导致转换异常问题的处理,解决配置项增加减少,带来的系统异常,无法直接配置
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
* @throws InstantiationException
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
private ResultMessage createSetting(String key) {
|
||||
SettingEnum settingEnum = SettingEnum.valueOf(key);
|
||||
Setting setting = settingService.get(key);
|
||||
switch (settingEnum) {
|
||||
case BASE_SETTING:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new BaseSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), BaseSetting.class));
|
||||
case WITHDRAWAL_SETTING:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new WithdrawalSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), WithdrawalSetting.class));
|
||||
case DISTRIBUTION_SETTING:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new DistributionSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), DistributionSetting.class));
|
||||
case EMAIL_SETTING:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new EmailSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), EmailSetting.class));
|
||||
case GOODS_SETTING:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new GoodsSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), GoodsSetting.class));
|
||||
case KUAIDI_SETTING:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new KuaidiSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), KuaidiSetting.class));
|
||||
case ORDER_SETTING:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new OrderSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), OrderSetting.class));
|
||||
case OSS_SETTING:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new OssSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), OssSetting.class));
|
||||
case SMS_SETTING:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new SmsSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), SmsSetting.class));
|
||||
case POINT_SETTING:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new PointSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), PointSetting.class));
|
||||
case QQ_CONNECT:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new QQConnectSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), QQConnectSetting.class));
|
||||
case PAYMENT_SUPPORT:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new PaymentSupportSetting(new PaymentSupportForm())) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), PaymentSupportSetting.class));
|
||||
case ALIPAY_PAYMENT:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new AlipayPaymentSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), AlipayPaymentSetting.class));
|
||||
case WECHAT_CONNECT:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new WechatConnectSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), WechatConnectSetting.class));
|
||||
case WECHAT_PAYMENT:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new WechatPaymentSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), WechatPaymentSetting.class));
|
||||
case SECKILL_SETTING:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new SeckillSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), SeckillSetting.class));
|
||||
case EXPERIENCE_SETTING:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new ExperienceSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), ExperienceSetting.class));
|
||||
case IM_SETTING:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new ImSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), ImSetting.class));
|
||||
default:
|
||||
throw new ServiceException(ResultCode.SETTING_NOT_TO_SET);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.system.entity.dto.payment.dto.PaymentSupportForm;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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/26 15:53
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,系统设置扩展接口")
|
||||
@RequestMapping("/manager/system/settingx")
|
||||
public class SettingXManagerController {
|
||||
|
||||
@ApiOperation(value = "支持支付方式表单")
|
||||
@GetMapping("/paymentSupport")
|
||||
public ResultMessage<PaymentSupportForm> paymentForm() {
|
||||
return ResultUtil.data(new PaymentSupportForm());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package cn.lili.controller.sms;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.sms.entity.dos.SmsReach;
|
||||
import cn.lili.modules.sms.service.SmsReachService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* 管理端,短信接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2021/1/30 4:09 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,短信接口")
|
||||
@RequestMapping("/manager/sms")
|
||||
public class SmsManagerController {
|
||||
@Autowired
|
||||
private SmsReachService smsReachService;
|
||||
|
||||
@ApiOperation(value = "接口批量发送短信")
|
||||
@PostMapping
|
||||
public ResultMessage<Object> sendBatchSms(SmsReach smsReach, @RequestParam(value = "mobile") List<String> mobile) {
|
||||
smsReachService.addSmsReach(smsReach,mobile);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询短信任务分页")
|
||||
@GetMapping()
|
||||
public ResultMessage<IPage<SmsReach>> querySmsReachPage(PageVO page) {
|
||||
return ResultUtil.data(smsReachService.page(PageUtil.initPage(page)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询短信任务")
|
||||
@ApiImplicitParam(name = "id", value = "短信任务id", required = true, dataType = "String", allowMultiple = true, paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public ResultMessage<SmsReach> querySmsReach(@PathVariable String id) {
|
||||
return ResultUtil.data(smsReachService.getById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package cn.lili.controller.sms;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.sms.entity.dos.SmsSign;
|
||||
import cn.lili.modules.sms.service.SmsSignService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,短信签名接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2021/1/30 4:09 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,短信签名接口")
|
||||
@RequestMapping("/manager/sms/sign")
|
||||
public class SmsSignManagerController {
|
||||
@Autowired
|
||||
private SmsSignService smsSignService;
|
||||
|
||||
|
||||
@ApiOperation(value = "新增短信签名")
|
||||
@PostMapping
|
||||
public ResultMessage<SmsSign> save(@Valid SmsSign smsSign) {
|
||||
smsSignService.addSmsSign(smsSign);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除短信签名")
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "短信签名id", required = true, dataType = "String", allowMultiple = true, paramType = "path")
|
||||
public ResultMessage<SmsSign> delete(@PathVariable String id) {
|
||||
smsSignService.deleteSmsSign(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "查询签名详细")
|
||||
@GetMapping("/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "短信签名id", required = true, dataType = "String", allowMultiple = true, paramType = "path")
|
||||
public ResultMessage<SmsSign> getDetail(@PathVariable String id) {
|
||||
return ResultUtil.data(smsSignService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询短信签名状态")
|
||||
@PutMapping("/querySmsSign")
|
||||
public ResultMessage<SmsSign> querySmsSign() {
|
||||
smsSignService.querySmsSign();
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改短信签名")
|
||||
@PutMapping("/modifySmsSign")
|
||||
public ResultMessage<SmsSign> modifySmsSign(@Valid SmsSign smsSign) {
|
||||
smsSignService.modifySmsSign(smsSign);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询短信签名分页")
|
||||
@GetMapping("/querySmsSignPage")
|
||||
public ResultMessage<IPage<SmsSign>> querySmsSignPage(PageVO page, Integer signStatus) {
|
||||
return ResultUtil.data(smsSignService.page(page, signStatus));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package cn.lili.controller.sms;
|
||||
|
||||
import cn.lili.common.aop.annotation.DemoSite;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.sms.entity.dos.SmsTemplate;
|
||||
import cn.lili.modules.sms.service.SmsTemplateService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,短信模板接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2021/1/30 4:09 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,短信模板接口")
|
||||
@RequestMapping("/manager/sms/template")
|
||||
public class SmsTemplateManagerController {
|
||||
@Autowired
|
||||
private SmsTemplateService smsTemplateService;
|
||||
|
||||
@ApiOperation(value = "新增短信模板")
|
||||
@PostMapping
|
||||
@DemoSite
|
||||
public ResultMessage<SmsTemplate> save(@Valid SmsTemplate smsTemplate) {
|
||||
smsTemplateService.addSmsTemplate(smsTemplate);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除短信模板")
|
||||
@ApiImplicitParam(name = "templateCode", value = "短信模板CODE", required = true, paramType = "query")
|
||||
@DeleteMapping
|
||||
@DemoSite
|
||||
public ResultMessage<SmsTemplate> delete(String templateCode) {
|
||||
smsTemplateService.deleteSmsTemplate(templateCode);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询短信模板状态")
|
||||
@PutMapping("/querySmsSign")
|
||||
@DemoSite
|
||||
public ResultMessage<SmsTemplate> querySmsSign() {
|
||||
smsTemplateService.querySmsTemplate();
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改短信模板")
|
||||
@PutMapping("/modifySmsTemplate")
|
||||
@DemoSite
|
||||
public ResultMessage<SmsTemplate> modifySmsTemplate(@Valid SmsTemplate smsTemplate) {
|
||||
smsTemplateService.modifySmsTemplate(smsTemplate);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询短信模板分页")
|
||||
@GetMapping("/querySmsTemplatePage")
|
||||
public ResultMessage<IPage<SmsTemplate>> querySmsTemplatePage(PageVO page, Integer templateStatus) {
|
||||
return ResultUtil.data(smsTemplateService.page(page,templateStatus));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.statistics.entity.dto.GoodsStatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.entity.vo.CategoryStatisticsDataVO;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,商品统计接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/12/9 19:04
|
||||
*/
|
||||
@Api(tags = "管理端,商品流水统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/statistics/goods")
|
||||
public class GoodsStatisticsManagerController {
|
||||
@Autowired
|
||||
private StoreFlowStatisticsService storeFlowStatisticsService;
|
||||
|
||||
@ApiOperation(value = "获取统计列表,排行前一百的数据")
|
||||
@GetMapping
|
||||
public ResultMessage<List<GoodsStatisticsDataVO>> getByPage(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
|
||||
return ResultUtil.data(storeFlowStatisticsService.getGoodsStatisticsData(goodsStatisticsQueryParam, 100));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取行业统计列表")
|
||||
@GetMapping("/getCategoryByPage")
|
||||
public ResultMessage<List<CategoryStatisticsDataVO>> getCategoryByPage(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
|
||||
return ResultUtil.data(storeFlowStatisticsService.getCategoryStatisticsData(goodsStatisticsQueryParam));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.statistics.entity.dto.GoodsStatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.entity.dto.StatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.entity.enums.StatisticsQuery;
|
||||
import cn.lili.modules.statistics.entity.vo.GoodsStatisticsDataVO;
|
||||
import cn.lili.modules.statistics.entity.vo.IndexNoticeVO;
|
||||
import cn.lili.modules.statistics.entity.vo.IndexStatisticsVO;
|
||||
import cn.lili.modules.statistics.entity.vo.StoreStatisticsDataVO;
|
||||
import cn.lili.modules.statistics.service.IndexStatisticsService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,首页统计数据接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/12/15 17:53
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "管理端,首页统计数据接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/statistics/index")
|
||||
public class IndexStatisticsManagerController {
|
||||
|
||||
/**
|
||||
* 首页统计
|
||||
*/
|
||||
@Autowired
|
||||
private IndexStatisticsService indexStatisticsService;
|
||||
|
||||
@ApiOperation(value = "获取首页查询数据")
|
||||
@GetMapping
|
||||
@PreventDuplicateSubmissions
|
||||
public ResultMessage<IndexStatisticsVO> index() {
|
||||
try {
|
||||
return ResultUtil.data(indexStatisticsService.indexStatistics());
|
||||
} catch (Exception e) {
|
||||
log.error("获取首页查询数据错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取首页查询热卖商品TOP10")
|
||||
@GetMapping("/goodsStatistics")
|
||||
public ResultMessage<List<GoodsStatisticsDataVO>> goodsStatistics(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
|
||||
|
||||
//按照金额查询
|
||||
goodsStatisticsQueryParam.setType(StatisticsQuery.PRICE.name());
|
||||
return ResultUtil.data(indexStatisticsService.goodsStatistics(goodsStatisticsQueryParam));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取首页查询热卖店铺TOP10")
|
||||
@GetMapping("/storeStatistics")
|
||||
public ResultMessage<List<StoreStatisticsDataVO>> storeStatistics(StatisticsQueryParam statisticsQueryParam) {
|
||||
return ResultUtil.data(indexStatisticsService.storeStatistics(statisticsQueryParam));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通知提示信息")
|
||||
@GetMapping("/notice")
|
||||
public ResultMessage<IndexNoticeVO> notice() {
|
||||
return ResultUtil.data(indexStatisticsService.indexNotice());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.statistics.entity.dos.MemberStatisticsData;
|
||||
import cn.lili.modules.statistics.entity.dto.StatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.service.MemberStatisticsService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,会员统计接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/12/9 19:04
|
||||
*/
|
||||
@Api(tags = "管理端,会员统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/statistics/member")
|
||||
public class MemberStatisticsManagerController {
|
||||
@Autowired
|
||||
private MemberStatisticsService memberStatisticsService;
|
||||
|
||||
@ApiOperation(value = "获取会员统计")
|
||||
@GetMapping
|
||||
public ResultMessage<List<MemberStatisticsData>> getByList(StatisticsQueryParam statisticsQueryParam) {
|
||||
return ResultUtil.data(memberStatisticsService.statistics(statisticsQueryParam));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,订单统计接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/12/9 19:04
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "管理端,订单统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/statistics/order")
|
||||
public class OrderStatisticsManagerController {
|
||||
@Autowired
|
||||
private OrderStatisticsService orderStatisticsService;
|
||||
@Autowired
|
||||
private AfterSaleStatisticsService afterSaleStatisticsService;
|
||||
|
||||
@ApiOperation(value = "订单概览统计")
|
||||
@GetMapping("/overview")
|
||||
public ResultMessage<OrderOverviewVO> overview(StatisticsQueryParam statisticsQueryParam) {
|
||||
try {
|
||||
return ResultUtil.data(orderStatisticsService.overview(statisticsQueryParam));
|
||||
} catch (Exception e) {
|
||||
log.error("订单概览统计错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "订单图表统计")
|
||||
@GetMapping
|
||||
public ResultMessage<List<OrderStatisticsDataVO>> statisticsChart(StatisticsQueryParam statisticsQueryParam) {
|
||||
try {
|
||||
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) {
|
||||
try {
|
||||
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) {
|
||||
return ResultUtil.data(afterSaleStatisticsService.getStatistics(statisticsQueryParam, pageVO));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,退款统计接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/12/9 19:04
|
||||
*/
|
||||
@Api(tags = "管理端,退款统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/statistics/refund/order")
|
||||
public class RefundOrderStatisticsManagerController {
|
||||
@Autowired
|
||||
private RefundOrderStatisticsService refundOrderStatisticsService;
|
||||
|
||||
@ApiOperation(value = "获取退款统计列表")
|
||||
@GetMapping("/getByPage")
|
||||
public ResultMessage<IPage<RefundOrderStatisticsDataVO>> getByPage(PageVO pageVO, StatisticsQueryParam statisticsQueryParam) {
|
||||
return ResultUtil.data(refundOrderStatisticsService.getRefundOrderStatisticsData(pageVO, statisticsQueryParam));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取退款统计金额")
|
||||
@GetMapping("/getPrice")
|
||||
public ResultMessage<Object> getPrice(StatisticsQueryParam statisticsQueryParam) {
|
||||
return ResultUtil.data(refundOrderStatisticsService.getRefundOrderStatisticsPrice(statisticsQueryParam));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.vo.MemberDistributionVO;
|
||||
import cn.lili.modules.statistics.entity.dto.StatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.entity.vo.OnlineMemberVO;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 管理端,流量统计接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2021/2/9 11:19
|
||||
*/
|
||||
@Api(tags = "管理端,流量统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/statistics/view")
|
||||
public class ViewStatisticsManagerController {
|
||||
@Autowired
|
||||
private PlatformViewService platformViewService;
|
||||
|
||||
@ApiOperation(value = "流量数据 表单获取")
|
||||
@GetMapping("/list")
|
||||
public ResultMessage<List<PlatformViewVO>> getByPage(StatisticsQueryParam queryParam) {
|
||||
return ResultUtil.data(platformViewService.list(queryParam));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "当前在线人数")
|
||||
@GetMapping("/online/current")
|
||||
public ResultMessage<Long> currentNumberPeopleOnline() {
|
||||
return ResultUtil.data(platformViewService.online());
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "会员分布")
|
||||
@GetMapping("/online/distribution")
|
||||
public ResultMessage<List<MemberDistributionVO>> memberDistribution() {
|
||||
return ResultUtil.data(platformViewService.memberDistribution());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "在线人数历史(默认48小时)")
|
||||
@GetMapping("/online/history")
|
||||
public ResultMessage<List<OnlineMemberVO>> history() {
|
||||
return ResultUtil.data(platformViewService.statisticsOnline());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package cn.lili.controller.store;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
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.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 管理端,商家结算单接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/17 7:23 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,商家结算单接口")
|
||||
@RequestMapping("/manager/store/bill")
|
||||
public class BillManagerController {
|
||||
@Autowired
|
||||
private BillService billService;
|
||||
|
||||
@Autowired
|
||||
private StoreFlowService storeFlowService;
|
||||
|
||||
@ApiOperation(value = "通过id获取结算单")
|
||||
@ApiImplicitParam(name = "id", value = "结算单ID", required = true, paramType = "path")
|
||||
@GetMapping(value = "/get/{id}")
|
||||
public ResultMessage<Bill> get(@PathVariable @NotNull String id) {
|
||||
return ResultUtil.data(billService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取结算单分页")
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<BillListVO>> getByPage(BillSearchParams billSearchParams) {
|
||||
return ResultUtil.data(billService.billPage(billSearchParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取商家结算单流水分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "结算单ID", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "flowType", value = "流水类型:PAY、REFUND", paramType = "query")
|
||||
})
|
||||
@GetMapping(value = "/{id}/getStoreFlow")
|
||||
public ResultMessage<IPage<StoreFlow>> getStoreFlow(@PathVariable String id, String flowType, PageVO pageVO) {
|
||||
return ResultUtil.data(storeFlowService.getStoreFlow(id, flowType, pageVO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "支付结算单")
|
||||
@ApiImplicitParam(name = "id", value = "结算单ID", required = true, paramType = "path")
|
||||
@PutMapping(value = "/pay/{id}")
|
||||
public ResultMessage<Object> pay(@PathVariable String id) {
|
||||
billService.complete(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package cn.lili.controller.store;
|
||||
|
||||
import cn.lili.common.aop.annotation.DemoSite;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.store.entity.dos.Store;
|
||||
import cn.lili.modules.store.entity.dto.AdminStoreApplyDTO;
|
||||
import cn.lili.modules.store.entity.dto.StoreEditDTO;
|
||||
import cn.lili.modules.store.entity.vos.StoreDetailVO;
|
||||
import cn.lili.modules.store.entity.vos.StoreManagementCategoryVO;
|
||||
import cn.lili.modules.store.entity.vos.StoreSearchParams;
|
||||
import cn.lili.modules.store.entity.vos.StoreVO;
|
||||
import cn.lili.modules.store.service.StoreDetailService;
|
||||
import cn.lili.modules.store.service.StoreService;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* 管理端,店铺管理接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2020/12/6 16:09
|
||||
*/
|
||||
@Api(tags = "管理端,店铺管理接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/store")
|
||||
public class StoreManagerController {
|
||||
|
||||
/**
|
||||
* 店铺
|
||||
*/
|
||||
@Autowired
|
||||
private StoreService storeService;
|
||||
/**
|
||||
* 店铺详情
|
||||
*/
|
||||
@Autowired
|
||||
private StoreDetailService storeDetailService;
|
||||
|
||||
@ApiOperation(value = "获取店铺分页列表")
|
||||
@GetMapping("/all")
|
||||
public ResultMessage<List<Store>> getAll() {
|
||||
return ResultUtil.data(storeService.list(new QueryWrapper<Store>().eq("store_disable", "OPEN")));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取店铺分页列表")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<StoreVO>> getByPage(StoreSearchParams entity, PageVO page) {
|
||||
return ResultUtil.data(storeService.findByConditionPage(entity, page));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取店铺详情")
|
||||
@ApiImplicitParam(name = "storeId", value = "店铺ID", required = true, paramType = "path", dataType = "String")
|
||||
@GetMapping(value = "/get/detail/{storeId}")
|
||||
public ResultMessage<StoreDetailVO> detail(@PathVariable String storeId) {
|
||||
return ResultUtil.data(storeDetailService.getStoreDetailVO(storeId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加店铺")
|
||||
@PostMapping(value = "/add")
|
||||
public ResultMessage<Store> add(@Valid AdminStoreApplyDTO adminStoreApplyDTO) {
|
||||
return ResultUtil.data(storeService.add(adminStoreApplyDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑店铺")
|
||||
@ApiImplicitParam(name = "storeId", value = "店铺ID", required = true, paramType = "path", dataType = "String")
|
||||
@PutMapping(value = "/edit/{id}")
|
||||
public ResultMessage<Store> edit(@PathVariable String id, @Valid StoreEditDTO storeEditDTO) {
|
||||
storeEditDTO.setStoreId(id);
|
||||
return ResultUtil.data(storeService.edit(storeEditDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "审核店铺申请")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "passed", value = "是否通过审核 0 通过 1 拒绝 编辑操作则不需传递", paramType = "query", dataType = "int"),
|
||||
@ApiImplicitParam(name = "id", value = "店铺id", required = true, paramType = "path", dataType = "String")
|
||||
})
|
||||
@PutMapping(value = "/audit/{id}/{passed}")
|
||||
public ResultMessage<Object> audit(@PathVariable String id, @PathVariable Integer passed) {
|
||||
storeService.audit(id, passed);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
|
||||
@DemoSite
|
||||
@ApiOperation(value = "关闭店铺")
|
||||
@ApiImplicitParam(name = "id", value = "店铺id", required = true, dataType = "String", paramType = "path")
|
||||
@PutMapping(value = "/disable/{id}")
|
||||
public ResultMessage<Store> disable(@PathVariable String id) {
|
||||
storeService.disable(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "开启店铺")
|
||||
@ApiImplicitParam(name = "id", value = "店铺id", required = true, dataType = "String", paramType = "path")
|
||||
@PutMapping(value = "/enable/{id}")
|
||||
public ResultMessage<Store> enable(@PathVariable String id) {
|
||||
storeService.enable(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询一级分类列表")
|
||||
@ApiImplicitParam(name = "storeId", value = "店铺id", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/managementCategory/{storeId}")
|
||||
public ResultMessage<List<StoreManagementCategoryVO>> firstCategory(@PathVariable String storeId) {
|
||||
return ResultUtil.data(this.storeDetailService.goodsManagementCategory(storeId));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "根据会员id查询店铺信息")
|
||||
@GetMapping("/{memberId}/member")
|
||||
public ResultMessage<Store> getByMemberId(@Valid @PathVariable String memberId) {
|
||||
List<Store> list = storeService.list(new QueryWrapper<Store>().eq("member_id", memberId));
|
||||
if (list.size() > 0) {
|
||||
return ResultUtil.data(list.get(0));
|
||||
}
|
||||
return ResultUtil.data(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package cn.lili.controller.store;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
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.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.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 pikachu
|
||||
* @since 2020/12/6 16:09
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,店铺消息消息管理接口")
|
||||
@RequestMapping("/manager/message/store")
|
||||
public class StoreMessageManagerController {
|
||||
|
||||
@Autowired
|
||||
private StoreMessageService storeMessageService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "多条件分页获取")
|
||||
public ResultMessage<IPage<StoreMessage>> getByCondition(StoreMessageQueryVO storeMessageQueryVO,
|
||||
PageVO pageVo) {
|
||||
IPage<StoreMessage> page = storeMessageService.getPage(storeMessageQueryVO, pageVo);
|
||||
return ResultUtil.data(page);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.lili.controller.wallet;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.wallet.entity.vo.MemberWalletVO;
|
||||
import cn.lili.modules.wallet.service.MemberWalletService;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 管理端,预存款接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020/11/16 10:07 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,预存款接口")
|
||||
@RequestMapping("/manager/members/wallet")
|
||||
public class MemberWalletManagerController {
|
||||
@Autowired
|
||||
private MemberWalletService memberWalletService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "查询会员预存款余额")
|
||||
@ApiImplicitParam(name = "memberId", value = "会员ID", paramType = "query")
|
||||
public ResultMessage<MemberWalletVO> get(@RequestParam("memberId") String memberId) {
|
||||
return ResultUtil.data(memberWalletService.getMemberWallet(memberId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package cn.lili.controller.wallet;
|
||||
|
||||
|
||||
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.wallet.entity.dos.MemberWithdrawApply;
|
||||
import cn.lili.modules.wallet.entity.vo.MemberWithdrawApplyQueryVO;
|
||||
import cn.lili.modules.wallet.service.MemberWithdrawApplyService;
|
||||
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.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,余额提现记录接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @since 2020/11/16 10:07 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,余额提现记录接口")
|
||||
@RequestMapping("/manager/members/withdraw-apply")
|
||||
public class MemberWithdrawApplyManagerController {
|
||||
@Autowired
|
||||
private MemberWithdrawApplyService memberWithdrawApplyService;
|
||||
|
||||
|
||||
@ApiOperation(value = "分页获取提现记录")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<MemberWithdrawApply>> getByPage(PageVO page, MemberWithdrawApplyQueryVO memberWithdrawApplyQueryVO) {
|
||||
//构建查询 返回数据
|
||||
IPage<MemberWithdrawApply> memberWithdrawApplyPage = memberWithdrawApplyService.getMemberWithdrawPage(page, memberWithdrawApplyQueryVO);
|
||||
return ResultUtil.data(memberWithdrawApplyPage);
|
||||
}
|
||||
|
||||
|
||||
@PreventDuplicateSubmissions
|
||||
@ApiOperation(value = "提现申请审核")
|
||||
@PostMapping
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "applyId", value = "审核记录id", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "result", value = "审核结果", required = true, paramType = "query", dataType = "boolean"),
|
||||
@ApiImplicitParam(name = "remark", value = "审核备注", paramType = "query")
|
||||
})
|
||||
public Boolean audit(String applyId, Boolean result, String remark) {
|
||||
return memberWithdrawApplyService.audit(applyId, result, remark);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package cn.lili.controller.wallet;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.order.trade.entity.vo.RechargeQueryVO;
|
||||
import cn.lili.modules.wallet.entity.dos.Recharge;
|
||||
import cn.lili.modules.wallet.service.RechargeService;
|
||||
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 pikachu
|
||||
* @since 2020/11/16 10:07 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,预存款充值记录接口")
|
||||
@RequestMapping("/manager/recharge")
|
||||
public class RechargeManagerController {
|
||||
@Autowired
|
||||
private RechargeService rechargeService;
|
||||
|
||||
@ApiOperation(value = "分页获取预存款充值记录")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<Recharge>> getByPage(PageVO page, RechargeQueryVO rechargeQueryVO) {
|
||||
//构建查询 返回数据
|
||||
IPage<Recharge> rechargePage = rechargeService.rechargePage(page, rechargeQueryVO);
|
||||
return ResultUtil.data(rechargePage);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.lili.controller.wallet;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.order.trade.entity.vo.DepositQueryVO;
|
||||
import cn.lili.modules.wallet.entity.dos.WalletLog;
|
||||
import cn.lili.modules.wallet.service.WalletLogService;
|
||||
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 pikachu
|
||||
* @since 2020/11/16 10:07 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,预存款充值记录接口")
|
||||
@RequestMapping("/manager/wallet/log")
|
||||
public class WalletLogManagerController {
|
||||
@Autowired
|
||||
private WalletLogService walletLogService;
|
||||
|
||||
@ApiOperation(value = "分页获取预存款充值记录")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<WalletLog>> getByPage(PageVO page, DepositQueryVO depositQueryVO) {
|
||||
//构建查询 返回数据
|
||||
IPage<WalletLog> depositLogPage = walletLogService.depositLogPage(page, depositQueryVO);
|
||||
return ResultUtil.data(depositLogPage);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package cn.lili.controller.wechat;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.wechat.entity.dos.WechatMPMessage;
|
||||
import cn.lili.modules.wechat.service.WechatMPMessageService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
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.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author Chopper
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "微信小程序消息订阅接口")
|
||||
@RequestMapping("/manager/message/wechatMPMessage")
|
||||
public class WechatMPMessageManagerController {
|
||||
@Autowired
|
||||
private WechatMPMessageService wechatMPMessageService;
|
||||
|
||||
@GetMapping(value = "/init")
|
||||
@ApiOperation(value = "初始化微信小程序消息订阅")
|
||||
public ResultMessage init() {
|
||||
wechatMPMessageService.init();
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "查看微信小程序消息订阅详情")
|
||||
public ResultMessage<WechatMPMessage> get(@PathVariable String id) {
|
||||
|
||||
WechatMPMessage wechatMPMessage = wechatMPMessageService.getById(id);
|
||||
return new ResultUtil<WechatMPMessage>().setData(wechatMPMessage);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "分页获取微信小程序消息订阅")
|
||||
public ResultMessage<IPage<WechatMPMessage>> getByPage(WechatMPMessage entity,
|
||||
SearchVO searchVo,
|
||||
PageVO page) {
|
||||
IPage<WechatMPMessage> data = wechatMPMessageService.page(PageUtil.initPage(page), PageUtil.initWrapper(entity, searchVo));
|
||||
return new ResultUtil<IPage<WechatMPMessage>>().setData(data);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增微信小程序消息订阅")
|
||||
public ResultMessage<WechatMPMessage> save(WechatMPMessage wechatMPMessage) {
|
||||
|
||||
wechatMPMessageService.save(wechatMPMessage);
|
||||
return new ResultUtil<WechatMPMessage>().setData(wechatMPMessage);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation(value = "更新微信小程序消息订阅")
|
||||
public ResultMessage<WechatMPMessage> update(@PathVariable String id, WechatMPMessage wechatMPMessage) {
|
||||
wechatMPMessageService.updateById(wechatMPMessage);
|
||||
return new ResultUtil<WechatMPMessage>().setData(wechatMPMessage);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ApiOperation(value = "删除微信小程序消息订阅")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
|
||||
wechatMPMessageService.removeByIds(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package cn.lili.controller.wechat;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.wechat.entity.dos.WechatMessage;
|
||||
import cn.lili.modules.wechat.service.WechatMessageService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,微信消息接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/12/2 10:40
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,微信消息接口")
|
||||
@RequestMapping("/manager/message/wechat")
|
||||
public class WechatMessageManageController {
|
||||
@Autowired
|
||||
private WechatMessageService wechatMessageService;
|
||||
|
||||
|
||||
@GetMapping(value = "/init")
|
||||
@ApiOperation(value = "初始化微信消息")
|
||||
public ResultMessage init() {
|
||||
wechatMessageService.init();
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "查看微信消息详情")
|
||||
public ResultMessage<WechatMessage> get(@PathVariable String id) {
|
||||
|
||||
WechatMessage wechatMessage = wechatMessageService.getById(id);
|
||||
return ResultUtil.data(wechatMessage);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "分页获取微信消息")
|
||||
public ResultMessage<IPage<WechatMessage>> getByPage(PageVO page) {
|
||||
IPage<WechatMessage> data = wechatMessageService.page(PageUtil.initPage(page));
|
||||
return ResultUtil.data(data);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增微信消息")
|
||||
public ResultMessage<WechatMessage> save(WechatMessage wechatMessage) {
|
||||
|
||||
wechatMessageService.save(wechatMessage);
|
||||
return ResultUtil.data(wechatMessage);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation(value = "更新微信消息")
|
||||
public ResultMessage<WechatMessage> update(@PathVariable String id, WechatMessage wechatMessage) {
|
||||
wechatMessageService.updateById(wechatMessage);
|
||||
return ResultUtil.data(wechatMessage);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ApiOperation(value = "删除微信消息")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
wechatMessageService.removeByIds(ids);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package cn.lili.security;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.cache.CachePrefix;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.enums.PermissionEnum;
|
||||
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 org.springframework.util.PatternMatchUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import javax.naming.NoPermissionException;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 管理端token过滤
|
||||
*
|
||||
* @author Chopper
|
||||
*/
|
||||
@Slf4j
|
||||
public class ManagerAuthenticationFilter extends BasicAuthenticationFilter {
|
||||
|
||||
private final Cache cache;
|
||||
|
||||
public ManagerAuthenticationFilter(AuthenticationManager authenticationManager,
|
||||
Cache cache) {
|
||||
super(authenticationManager);
|
||||
this.cache = cache;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) {
|
||||
|
||||
//从header中获取jwt
|
||||
String jwt = request.getHeader(SecurityEnum.HEADER_TOKEN.getValue());
|
||||
//如果没有token 则return
|
||||
if (StrUtil.isBlank(jwt)) {
|
||||
chain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
//获取用户信息,存入context
|
||||
UsernamePasswordAuthenticationToken authentication = getAuthentication(jwt, response);
|
||||
//自定义权限过滤
|
||||
if (authentication != null) {
|
||||
customAuthentication(request, response, authentication);
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
}
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义权限过滤
|
||||
*
|
||||
* @param request 请求
|
||||
* @param response 响应
|
||||
* @param authentication 用户信息
|
||||
*/
|
||||
private void customAuthentication(HttpServletRequest request, HttpServletResponse response, UsernamePasswordAuthenticationToken authentication) throws NoPermissionException {
|
||||
AuthUser authUser = (AuthUser) authentication.getDetails();
|
||||
String requestUrl = request.getRequestURI();
|
||||
|
||||
|
||||
//如果不是超级管理员, 则鉴权
|
||||
if (!authUser.getIsSuper()) {
|
||||
//获取缓存中的权限
|
||||
Map<String, List<String>> permission = (Map<String, List<String>>) cache.get(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.MANAGER) + authUser.getId());
|
||||
|
||||
//获取数据(GET 请求)权限
|
||||
if (request.getMethod().equals(RequestMethod.GET.name())) {
|
||||
//如果用户的超级权限和查阅权限都不包含当前请求的api
|
||||
if (match(permission.get(PermissionEnum.SUPER.name()), requestUrl) ||
|
||||
match(permission.get(PermissionEnum.QUERY.name()), requestUrl)) {
|
||||
} else {
|
||||
ResponseUtil.output(response, ResponseUtil.resultMap(false, 400, "权限不足"));
|
||||
log.error("当前请求路径:{},所拥有权限:{}", requestUrl, JSONUtil.toJsonStr(permission));
|
||||
throw new NoPermissionException("权限不足");
|
||||
}
|
||||
}
|
||||
//非get请求(数据操作) 判定鉴权
|
||||
else {
|
||||
if (!match(permission.get(PermissionEnum.SUPER.name()), requestUrl)) {
|
||||
ResponseUtil.output(response, ResponseUtil.resultMap(false, 400, "权限不足"));
|
||||
log.error("当前请求路径:{},所拥有权限:{}", requestUrl, JSONUtil.toJsonStr(permission));
|
||||
throw new NoPermissionException("权限不足");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验权限
|
||||
*
|
||||
* @param permissions 权限集合
|
||||
* @param url 请求地址
|
||||
* @return 是否拥有权限
|
||||
*/
|
||||
boolean match(List<String> permissions, String url) {
|
||||
if (permissions == null || permissions.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return PatternMatchUtils.simpleMatch(permissions.toArray(new String[0]), url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取token信息
|
||||
*
|
||||
* @param jwt token信息
|
||||
* @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.MANAGER) + 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("other exception:", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package cn.lili.security;
|
||||
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.common.security.CustomAccessDeniedHandler;
|
||||
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 核心配置类 Manager安全配置中心
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/14 16:20
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
||||
public class ManagerSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
|
||||
/**
|
||||
* 忽略验权配置
|
||||
*/
|
||||
@Autowired
|
||||
private IgnoredUrlsProperties ignoredUrlsProperties;
|
||||
|
||||
/**
|
||||
* spring security -》 权限不足处理
|
||||
*/
|
||||
@Autowired
|
||||
private CustomAccessDeniedHandler accessDeniedHandler;
|
||||
|
||||
@Autowired
|
||||
private Cache<String> cache;
|
||||
@Autowired
|
||||
private CorsConfigurationSource corsConfigurationSource;
|
||||
|
||||
@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()
|
||||
.authorizeRequests()
|
||||
//任何请求
|
||||
.anyRequest()
|
||||
//需要身份认证
|
||||
.authenticated()
|
||||
.and()
|
||||
//允许跨域
|
||||
.cors().configurationSource(corsConfigurationSource).and()
|
||||
//关闭跨站请求防护
|
||||
.csrf().disable()
|
||||
//前后端分离采用JWT 不需要session
|
||||
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||
.and()
|
||||
//自定义权限拒绝处理类
|
||||
.exceptionHandling().accessDeniedHandler(accessDeniedHandler)
|
||||
.and()
|
||||
//添加JWT认证过滤器
|
||||
.addFilter(new ManagerAuthenticationFilter(authenticationManager(), cache));
|
||||
}
|
||||
|
||||
}
|
||||
274
manager-api/src/main/resources/application.yml
Normal file
274
manager-api/src/main/resources/application.yml
Normal file
@@ -0,0 +1,274 @@
|
||||
server:
|
||||
port: 8887
|
||||
|
||||
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:
|
||||
show: false
|
||||
|
||||
# 忽略鉴权url
|
||||
ignored:
|
||||
urls:
|
||||
- /editor-app/**
|
||||
- /actuator**
|
||||
- /actuator/**
|
||||
- /MP_verify_qSyvBPhDsPdxvOhC.txt
|
||||
- /weixin/**
|
||||
- /source/**
|
||||
- /manager/user/login
|
||||
- /manager/user/refresh/**
|
||||
- /manager/elasticsearch
|
||||
- /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
manager-api/src/main/resources/logback-spring.xml
Normal file
43
manager-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>
|
||||
125
manager-api/src/test/java/cn/lili/test/CacheTest/CacheTest.java
Normal file
125
manager-api/src/test/java/cn/lili/test/CacheTest/CacheTest.java
Normal file
@@ -0,0 +1,125 @@
|
||||
package cn.lili.test.CacheTest;
|
||||
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.cache.CachePrefix;
|
||||
import cn.lili.modules.statistics.util.StatisticsSuffix;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.redis.core.DefaultTypedTuple;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Chopper
|
||||
* @version v1.0
|
||||
* @since v7.0
|
||||
* 2021/1/15 16:25
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest
|
||||
class CacheTest {
|
||||
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
||||
String KEY = "test1";
|
||||
|
||||
/**
|
||||
* 计数器测试
|
||||
*
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Test
|
||||
void testCache() throws InterruptedException {
|
||||
|
||||
System.out.println(cache.incr(KEY, 3));
|
||||
System.out.println(cache.incr(KEY, 1));
|
||||
System.out.println(cache.incr(KEY, 1));
|
||||
Thread.sleep(2000);
|
||||
System.out.println(cache.incr(KEY, 1));
|
||||
Thread.sleep(1000);
|
||||
System.out.println(cache.incr(KEY, 1));
|
||||
Thread.sleep(10000);
|
||||
|
||||
System.out.println(cache.incr(KEY, 1));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存中的流量统计数据模拟
|
||||
*/
|
||||
@Test
|
||||
void pageViewInit() {
|
||||
String storeUV = "{STORE_UV}_2021-4-12-1376369067769724928";
|
||||
String storePV = "{STORE_PV}_2021-4-12-1376369067769724928";
|
||||
String UV = "{UV}_2021-4-12";
|
||||
String PV = "{PV}_2021-4-12";
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
//PV
|
||||
cache.incr(PV, 60 * 60 * 48);
|
||||
cache.incr(storePV, 60 * 60 * 48);
|
||||
//店铺UV 统计,则需要对id去重复,所以如下处理
|
||||
cache.cumulative(storeUV, "192.168.0.1" + random.nextInt(100));
|
||||
//平台UV统计
|
||||
cache.cumulative(UV, "192.168.0.1" + random.nextInt(100));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 流量单元测试
|
||||
* <p>
|
||||
* 模拟1000次请求发,查看这块执行时间,单节点性能简单尝试同时还有redis连接池问题,这个只是简单压力模拟
|
||||
* <p>
|
||||
* 执行结果
|
||||
* 1.251
|
||||
* 1.167
|
||||
* 1.363
|
||||
*/
|
||||
@Test
|
||||
void testPageViewStatistics() {
|
||||
Date start = new Date();
|
||||
System.out.println(start.getTime());
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
|
||||
//PV 统计48小时过期 留下一定时间予以统计累计数据库
|
||||
cache.incr(CachePrefix.PV.getPrefix() + StatisticsSuffix.suffix(i / 100 + ""), 60 * 60 * 48);
|
||||
|
||||
//店铺UV 统计,则需要对id去重复,所以如下处理
|
||||
cache.cumulative(CachePrefix.UV.getPrefix() + StatisticsSuffix.suffix(i / 100 + "1321312312312312321312"), "192.168.0.1" + i);
|
||||
|
||||
//平台UV统计
|
||||
cache.cumulative(CachePrefix.UV.getPrefix() + StatisticsSuffix.suffix(), "192.168.0.1" + i);
|
||||
}
|
||||
|
||||
Date end = new Date();
|
||||
System.out.println(end.getTime());
|
||||
System.out.println(end.getTime() - start.getTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testZincrby() {
|
||||
cache.incrementScore("searchHotWord", "Chrome");
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testReverseRangeWithScores() {
|
||||
Set searchHotWord = cache.reverseRangeWithScores("searchHotWord", 0, 100);
|
||||
for (Object o : searchHotWord) {
|
||||
DefaultTypedTuple str = (DefaultTypedTuple) o;
|
||||
System.out.println(str.getScore());
|
||||
System.out.println(str.getValue());
|
||||
System.out.println("----------");
|
||||
}
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
}
|
||||
219
manager-api/src/test/java/cn/lili/test/elasticsearch/EsTest.java
Normal file
219
manager-api/src/test/java/cn/lili/test/elasticsearch/EsTest.java
Normal file
@@ -0,0 +1,219 @@
|
||||
package cn.lili.test.elasticsearch;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
||||
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
|
||||
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
|
||||
import cn.lili.modules.goods.service.GoodsSkuService;
|
||||
import cn.lili.modules.promotion.service.PromotionService;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsAttribute;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsRelatedInfo;
|
||||
import cn.lili.modules.search.entity.dto.EsGoodsSearchDTO;
|
||||
import cn.lili.modules.search.repository.EsGoodsIndexRepository;
|
||||
import cn.lili.modules.search.service.EsGoodsIndexService;
|
||||
import cn.lili.modules.search.service.EsGoodsSearchService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.elasticsearch.core.SearchPage;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2020/10/14
|
||||
**/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest
|
||||
class EsTest {
|
||||
|
||||
@Autowired
|
||||
private EsGoodsIndexService esGoodsIndexService;
|
||||
|
||||
@Autowired
|
||||
private EsGoodsIndexRepository goodsIndexRepository;
|
||||
|
||||
@Autowired
|
||||
private EsGoodsSearchService goodsSearchService;
|
||||
|
||||
@Autowired
|
||||
private GoodsSkuService goodsSkuService;
|
||||
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
||||
@Autowired
|
||||
private PromotionService promotionService;
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
// PolicyFactory policy = Sanitizers.FORMATTING.and(Sanitizers.LINKS);
|
||||
// String safeHTML = policy.sanitize("+ADw-script+AD4-alert(document.cookie)+ADw-/script+AD4-");
|
||||
// System.out.println(safeHTML);
|
||||
// System.out.println(Sanitizers.FORMATTING.and(Sanitizers.FORMATTING).sanitize("+ADw-script+AD4-alert(document.cookie)+ADw-/script+AD4-"));
|
||||
// System.out.println(HtmlUtil.unescape(safeHTML));
|
||||
// System.out.println(HtmlUtil.filter("+ADw-script+AD4-alert(document.cookie)+ADw-/script+AD4-"));
|
||||
// Date dt1 = new Date(2021, 12, 10);
|
||||
// Date dt2 = new Date(2021, 12, 14);
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void cleanInvalidPromotion() {
|
||||
this.esGoodsIndexService.cleanInvalidPromotion();
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
void searchGoods() {
|
||||
EsGoodsSearchDTO goodsSearchDTO = new EsGoodsSearchDTO();
|
||||
// goodsSearchDTO.setKeyword("黄");
|
||||
// goodsSearchDTO.setProp("IETF_HTTP/3");
|
||||
// goodsSearchDTO.setPrice("100_20000");
|
||||
// goodsSearchDTO.setStoreCatId(1L);
|
||||
// goodsSearchDTO.setBrandId(123L);
|
||||
// goodsSearchDTO.setCategoryId(2L);
|
||||
// goodsSearchDTO.setNameIds(Arrays.asList("1344113311566553088", "1344113367694729216"));
|
||||
PageVO pageVo = new PageVO();
|
||||
pageVo.setPageNumber(0);
|
||||
pageVo.setPageSize(100);
|
||||
pageVo.setOrder("desc");
|
||||
pageVo.setNotConvert(true);
|
||||
SearchPage<EsGoodsIndex> esGoodsIndices = goodsSearchService.searchGoods(goodsSearchDTO, pageVo);
|
||||
Assertions.assertNotNull(esGoodsIndices);
|
||||
esGoodsIndices.getContent().forEach(System.out::println);
|
||||
// esGoodsIndices.getContent().forEach(i -> {
|
||||
// if (i.getPromotionMap() != null){
|
||||
// String s = i.getPromotionMap().keySet().parallelStream().filter(j -> j.contains(PromotionTypeEnum.FULL_DISCOUNT.name())).findFirst().orElse(null);
|
||||
// if (s != null) {
|
||||
// FullDiscount basePromotion = (FullDiscount) i.getPromotionMap().get(s);
|
||||
// System.out.println(basePromotion);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void aggregationSearch() {
|
||||
EsGoodsSearchDTO goodsSearchDTO = new EsGoodsSearchDTO();
|
||||
//goodsSearchDTO.setKeyword("电脑");
|
||||
//goodsSearchDTO.setProp("颜色_故宫文创@版本_小新Pro13s");
|
||||
// goodsSearchDTO.setCategoryId("2");
|
||||
// goodsSearchDTO.setPrice("100_20000");
|
||||
PageVO pageVo = new PageVO();
|
||||
pageVo.setPageNumber(0);
|
||||
pageVo.setPageSize(10);
|
||||
pageVo.setOrder("desc");
|
||||
EsGoodsRelatedInfo selector = goodsSearchService.getSelector(goodsSearchDTO, pageVo);
|
||||
Assertions.assertNotNull(selector);
|
||||
System.out.println(JSONUtil.toJsonStr(selector));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void init() {
|
||||
LambdaQueryWrapper<GoodsSku> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(GoodsSku::getAuthFlag, GoodsAuthEnum.PASS.name());
|
||||
queryWrapper.eq(GoodsSku::getMarketEnable, GoodsStatusEnum.UPPER.name());
|
||||
List<GoodsSku> list = goodsSkuService.list(queryWrapper);
|
||||
List<EsGoodsIndex> esGoodsIndices = new ArrayList<>();
|
||||
for (GoodsSku goodsSku : list) {
|
||||
EsGoodsIndex index = new EsGoodsIndex(goodsSku);
|
||||
esGoodsIndices.add(index);
|
||||
cache.put(GoodsSkuService.getStockCacheKey(goodsSku.getId()), goodsSku.getQuantity());
|
||||
}
|
||||
esGoodsIndexService.initIndex(esGoodsIndices);
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
void addIndex() {
|
||||
List<EsGoodsAttribute> esGoodsAttributeList = new ArrayList<>();
|
||||
EsGoodsAttribute attribute = new EsGoodsAttribute();
|
||||
attribute.setType(0);
|
||||
attribute.setName("颜色");
|
||||
attribute.setValue("16.1英寸 6核R5 16G 512G 高色域");
|
||||
esGoodsAttributeList.add(attribute);
|
||||
attribute = new EsGoodsAttribute();
|
||||
attribute.setType(0);
|
||||
attribute.setName("版本");
|
||||
attribute.setValue("RedmiBook 18英寸 深空灰");
|
||||
esGoodsAttributeList.add(attribute);
|
||||
EsGoodsIndex goodsIndex = initGoodsIndexData("122", "0|2", "140", "142", "A142", "RedmiBook 18 锐龙版 超轻薄全面屏(6核R5-4500U 16G 512G 100% sRGB高色域)灰 手提 笔记本电脑 小米 红米 ", "131", "小米自营旗舰店", 10000D);
|
||||
goodsIndex.setAttrList(esGoodsAttributeList);
|
||||
|
||||
//GoodsSku goodsSkuByIdFromCache = goodsSkuService.getGoodsSkuByIdFromCache("121");
|
||||
//EsGoodsIndex goodsIndex = new EsGoodsIndex(goodsSkuByIdFromCache);
|
||||
|
||||
|
||||
esGoodsIndexService.addIndex(goodsIndex);
|
||||
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
void searchAll() {
|
||||
Iterable<EsGoodsIndex> all = goodsIndexRepository.findAll();
|
||||
Assertions.assertNotNull(all);
|
||||
all.forEach(System.out::println);
|
||||
}
|
||||
|
||||
@Test
|
||||
void updateIndex() {
|
||||
EsGoodsIndex byId = esGoodsIndexService.findById("121");
|
||||
esGoodsIndexService.updateIndex(byId);
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
void deleteIndex() {
|
||||
esGoodsIndexService.deleteIndex(null);
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
void cleanPromotion() {
|
||||
esGoodsIndexService.cleanInvalidPromotion();
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
|
||||
private EsGoodsIndex initGoodsIndexData(String brandId, String categoryPath, String goodsId, String id, String sn, String goodsName, String storeId, String storeName, Double price) {
|
||||
EsGoodsIndex goodsIndex = new EsGoodsIndex();
|
||||
goodsIndex.setBuyCount(99);
|
||||
goodsIndex.setCommentNum(99);
|
||||
goodsIndex.setGrade(100D);
|
||||
goodsIndex.setHighPraiseNum(100);
|
||||
goodsIndex.setIntro("I'd like a cup of tea, please");
|
||||
goodsIndex.setAuthFlag("1");
|
||||
goodsIndex.setMarketEnable("1");
|
||||
goodsIndex.setMobileIntro("I want something cold to drink");
|
||||
goodsIndex.setPoint(0);
|
||||
goodsIndex.setSelfOperated(true);
|
||||
goodsIndex.setThumbnail("picture");
|
||||
goodsIndex.setStoreCategoryPath("1");
|
||||
|
||||
goodsIndex.setId(id);
|
||||
goodsIndex.setBrandId(brandId);
|
||||
goodsIndex.setGoodsId(goodsId);
|
||||
goodsIndex.setCategoryPath(categoryPath);
|
||||
goodsIndex.setGoodsName(goodsName);
|
||||
goodsIndex.setPrice(price);
|
||||
goodsIndex.setSn(sn);
|
||||
goodsIndex.setStoreId(storeId);
|
||||
goodsIndex.setStoreName(storeName);
|
||||
return goodsIndex;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.lili.test.order;
|
||||
|
||||
import cn.lili.modules.order.order.service.OrderService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2020/12/1
|
||||
**/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest
|
||||
class OrderServiceTest {
|
||||
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
|
||||
@Test
|
||||
void QueryParam() {
|
||||
// OrderSearchParams orderSearchParams = new OrderSearchParams();
|
||||
// orderSearchParams.setPageSize(0);
|
||||
// orderSearchParams.setPageNumber(10);
|
||||
// IPage<OrderSimpleVO> orderVOIPage = orderService.queryByParams(orderSearchParams);
|
||||
// Assertions.assertNotNull(orderVOIPage);
|
||||
// orderVOIPage.getRecords().forEach(System.out::println);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
177
manager-api/src/test/java/cn/lili/test/promotion/CouponTest.java
Normal file
177
manager-api/src/test/java/cn/lili/test/promotion/CouponTest.java
Normal file
@@ -0,0 +1,177 @@
|
||||
package cn.lili.test.promotion;
|
||||
|
||||
import cn.lili.common.enums.PromotionTypeEnum;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
|
||||
import cn.lili.modules.promotion.entity.dos.Coupon;
|
||||
import cn.lili.modules.promotion.entity.dos.PromotionGoods;
|
||||
import cn.lili.modules.promotion.entity.dto.search.CouponSearchParams;
|
||||
import cn.lili.modules.promotion.entity.enums.CouponGetEnum;
|
||||
import cn.lili.modules.promotion.entity.enums.CouponTypeEnum;
|
||||
import cn.lili.modules.promotion.entity.enums.PromotionsScopeTypeEnum;
|
||||
import cn.lili.modules.promotion.entity.vos.CouponVO;
|
||||
import cn.lili.modules.promotion.service.CouponService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2020/10/29
|
||||
**/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest
|
||||
class CouponTest {
|
||||
|
||||
@Autowired
|
||||
private CouponService couponService;
|
||||
|
||||
@Test
|
||||
void addCoupon() {
|
||||
CouponVO couponVO = new CouponVO();
|
||||
couponVO.setCouponName("Coupon V" + couponVO.getId());
|
||||
couponVO.setCouponType(CouponTypeEnum.DISCOUNT.name());
|
||||
couponVO.setDescription(couponVO.getCouponName() + " are expensive");
|
||||
couponVO.setGetType(CouponGetEnum.FREE.name());
|
||||
// couponVO.setStoreId("0");
|
||||
// couponVO.setStoreName("platform");
|
||||
couponVO.setStoreId("131");
|
||||
couponVO.setStoreName("小米自营旗舰店");
|
||||
couponVO.setPublishNum(1000);
|
||||
couponVO.setCouponLimitNum(0);
|
||||
couponVO.setConsumeThreshold(500D);
|
||||
// couponVO.setPrice(200D);
|
||||
couponVO.setCouponDiscount(0.1D);
|
||||
|
||||
couponVO.setScopeType(PromotionsScopeTypeEnum.PORTION_GOODS.name());
|
||||
couponVO.setScopeId("121");
|
||||
couponVO.setStartTime(cn.hutool.core.date.DateUtil.parse("2020-11-30 15:58:00"));
|
||||
couponVO.setEndTime(cn.hutool.core.date.DateUtil.parse("2020-12-30 23:50:00"));
|
||||
|
||||
if (couponVO.getCouponType().equals(CouponTypeEnum.DISCOUNT.name())) {
|
||||
couponVO.setPromotionName(couponVO.getCouponDiscount() + "折券");
|
||||
} else {
|
||||
couponVO.setPromotionName(couponVO.getPrice() + "元券");
|
||||
}
|
||||
List<PromotionGoods> promotionGoodsList = new ArrayList<>();
|
||||
// GoodsSku sku121 = goodsSkuService.getGoodsSkuByIdFromCache("121");
|
||||
PromotionGoods promotionGoods = new PromotionGoods();
|
||||
promotionGoods.setPrice(0.0);
|
||||
promotionGoods.setLimitNum(0);
|
||||
promotionGoods.setNum(1000);
|
||||
promotionGoods.setStartTime(couponVO.getStartTime());
|
||||
promotionGoods.setEndTime(couponVO.getEndTime());
|
||||
promotionGoods.setTitle(couponVO.getPromotionName());
|
||||
promotionGoods.setPromotionId(couponVO.getId());
|
||||
promotionGoods.setQuantity(1000);
|
||||
promotionGoods.setPromotionType(PromotionTypeEnum.COUPON.name());
|
||||
promotionGoodsList.add(promotionGoods);
|
||||
//
|
||||
// GoodsSku sku50112 = goodsSkuService.getGoodsSkuByIdFromCache("50112");
|
||||
// promotionGoods = new PromotionGoods(sku50112);
|
||||
// promotionGoods.setPrice(80000d);
|
||||
// promotionGoods.setLimitNum(0);
|
||||
// promotionGoods.setPromotionQuantity(1000);
|
||||
// promotionGoods.setNum(1000);
|
||||
// promotionGoods.setStartTime(couponVO.getStartTime());
|
||||
// promotionGoods.setEndTime(couponVO.getEndTime());
|
||||
// promotionGoods.setTitle(couponVO.getPromotionName());
|
||||
// promotionGoods.setPromotionStatus(couponVO.getPromotionStatus());
|
||||
// promotionGoodsList.add(promotionGoods);
|
||||
//
|
||||
couponVO.setPromotionGoodsList(promotionGoodsList);
|
||||
Assertions.assertNotNull(couponService.savePromotions(couponVO));
|
||||
}
|
||||
|
||||
@Test
|
||||
void update() {
|
||||
CouponVO couponVO = new CouponVO();
|
||||
couponVO.setId("1326081397400297472");
|
||||
couponVO.setCouponName("Coupon V" + couponVO.getId());
|
||||
couponVO.setCouponType(CouponTypeEnum.DISCOUNT.name());
|
||||
couponVO.setDescription(couponVO.getId() + " is expensive");
|
||||
couponVO.setGetType(CouponGetEnum.FREE.name());
|
||||
couponVO.setStoreId("132");
|
||||
couponVO.setStoreName("联想自营旗舰店");
|
||||
couponVO.setStoreCommission(99.99D);
|
||||
couponVO.setPublishNum(1000);
|
||||
couponVO.setCouponLimitNum(0);
|
||||
couponVO.setCouponDiscount(10D);
|
||||
couponVO.setPrice(0D);
|
||||
|
||||
couponVO.setScopeType(PromotionsScopeTypeEnum.PORTION_GOODS.name());
|
||||
couponVO.setScopeId("134,133");
|
||||
couponVO.setStartTime(cn.hutool.core.date.DateUtil.parse("2020-11-10 17:01:00"));
|
||||
couponVO.setEndTime(cn.hutool.core.date.DateUtil.parse("2020-11-10 17:10:00"));
|
||||
|
||||
if (couponVO.getCouponType().equals(CouponTypeEnum.DISCOUNT.name())) {
|
||||
couponVO.setPromotionName(couponVO.getCouponDiscount() + "折券");
|
||||
} else {
|
||||
couponVO.setPromotionName(couponVO.getPrice() + "元券");
|
||||
}
|
||||
|
||||
List<PromotionGoods> promotionGoodsList = new ArrayList<>();
|
||||
PromotionGoods promotionGoods = new PromotionGoods();
|
||||
promotionGoods.setSkuId("134");
|
||||
promotionGoods.setGoodsName("联想(Lenovo)YOGA S740商务办公本 英特尔酷睿i5 14英寸超轻薄笔记本电脑(i5 16G 512G 独显 雷电3 WiFi6)灰");
|
||||
promotionGoods.setPrice(20000d);
|
||||
promotionGoods.setStoreId("132");
|
||||
promotionGoods.setStoreName("联想自营旗舰店");
|
||||
promotionGoods.setLimitNum(0);
|
||||
promotionGoods.setQuantity(1000);
|
||||
promotionGoods.setThumbnail("thumbnail");
|
||||
promotionGoods.setNum(1000);
|
||||
promotionGoods.setStartTime(couponVO.getStartTime());
|
||||
promotionGoods.setEndTime(couponVO.getEndTime());
|
||||
promotionGoods.setTitle(couponVO.getPromotionName());
|
||||
promotionGoodsList.add(promotionGoods);
|
||||
|
||||
promotionGoods = new PromotionGoods();
|
||||
promotionGoods.setSkuId("133");
|
||||
promotionGoods.setGoodsName("联想(Lenovo)小新Pro13s“锦绣前程”故宫文创版13.3英寸轻薄笔记本电脑(I5 16G 512G 2.5K 100%sRGB)");
|
||||
promotionGoods.setPrice(100000d);
|
||||
promotionGoods.setStoreId("132");
|
||||
promotionGoods.setStoreName("联想自营旗舰店");
|
||||
promotionGoods.setLimitNum(0);
|
||||
promotionGoods.setQuantity(1000);
|
||||
promotionGoods.setThumbnail("thumbnail");
|
||||
promotionGoods.setNum(1000);
|
||||
promotionGoods.setStartTime(couponVO.getStartTime());
|
||||
promotionGoods.setEndTime(couponVO.getEndTime());
|
||||
promotionGoods.setTitle(couponVO.getPromotionName());
|
||||
promotionGoodsList.add(promotionGoods);
|
||||
|
||||
couponVO.setPromotionGoodsList(promotionGoodsList);
|
||||
Assertions.assertTrue(couponService.updatePromotions(couponVO));
|
||||
}
|
||||
|
||||
@Test
|
||||
void search() {
|
||||
CouponSearchParams queryParam = new CouponSearchParams();
|
||||
queryParam.setStoreId("");
|
||||
PageVO pageVo = new PageVO();
|
||||
pageVo.setPageNumber(0);
|
||||
pageVo.setPageSize(10);
|
||||
IPage<Coupon> couponsByPage = couponService.pageFindAll(queryParam, pageVo);
|
||||
Assertions.assertNotNull(couponsByPage);
|
||||
couponsByPage.getRecords().forEach(System.out::println);
|
||||
}
|
||||
|
||||
@Test
|
||||
void delete() {
|
||||
// Assertions.assertTrue(couponService.deleteCoupon("1326001296591577088"));
|
||||
GoodsStatusEnum goodsStatusEnum = GoodsStatusEnum.DOWN;
|
||||
System.out.println("name:: " + goodsStatusEnum.name());
|
||||
System.out.println("description:: " + goodsStatusEnum.description());
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package cn.lili.test.promotion;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.lili.common.enums.PromotionTypeEnum;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
||||
import cn.lili.modules.goods.service.GoodsSkuService;
|
||||
import cn.lili.modules.order.cart.entity.vo.FullDiscountVO;
|
||||
import cn.lili.modules.promotion.entity.dos.FullDiscount;
|
||||
import cn.lili.modules.promotion.entity.dos.PromotionGoods;
|
||||
import cn.lili.modules.promotion.entity.dto.search.FullDiscountSearchParams;
|
||||
import cn.lili.modules.promotion.service.FullDiscountService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2020/10/22
|
||||
**/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest
|
||||
class FullDiscountTest {
|
||||
|
||||
@Autowired
|
||||
private FullDiscountService fullDiscountService;
|
||||
|
||||
@Autowired
|
||||
private GoodsSkuService goodsSkuService;
|
||||
|
||||
@Test
|
||||
void addFullDiscount() {
|
||||
FullDiscountVO fullDiscountVO = new FullDiscountVO();
|
||||
fullDiscountVO.setStoreId("131");
|
||||
fullDiscountVO.setStoreName("小米自营旗舰店");
|
||||
fullDiscountVO.setDescription("full discount test " + RandomUtil.randomNumber());
|
||||
fullDiscountVO.setFullMinusFlag(true);
|
||||
fullDiscountVO.setFullMoney(130D);
|
||||
fullDiscountVO.setFullMinus(100D);
|
||||
fullDiscountVO.setFreeFreightFlag(true);
|
||||
|
||||
fullDiscountVO.setPromotionName("FullDiscount-" + fullDiscountVO.getId());
|
||||
fullDiscountVO.setTitle("满" + fullDiscountVO.getFullMoney() + "减" + fullDiscountVO.getFullMinus());
|
||||
fullDiscountVO.setStartTime(cn.hutool.core.date.DateUtil.parse("2020-11-30 10:35:00"));
|
||||
fullDiscountVO.setEndTime(cn.hutool.core.date.DateUtil.parse("2020-12-25 23:20:00"));
|
||||
|
||||
List<PromotionGoods> promotionGoodsLis = new ArrayList<>();
|
||||
GoodsSku sku121 = goodsSkuService.getGoodsSkuByIdFromCache("121");
|
||||
PromotionGoods promotionGoods = new PromotionGoods(sku121);
|
||||
promotionGoods.setPrice(sku121.getPrice());
|
||||
promotionGoods.setLimitNum(100);
|
||||
promotionGoods.setStartTime(fullDiscountVO.getStartTime());
|
||||
promotionGoods.setEndTime(fullDiscountVO.getEndTime());
|
||||
promotionGoods.setNum(10);
|
||||
promotionGoods.setQuantity(100);
|
||||
promotionGoods.setPromotionId(fullDiscountVO.getId());
|
||||
promotionGoods.setPromotionType(PromotionTypeEnum.FULL_DISCOUNT.name());
|
||||
promotionGoods.setTitle("满" + fullDiscountVO.getFullMoney() + "减" + fullDiscountVO.getFullMinus());
|
||||
promotionGoodsLis.add(promotionGoods);
|
||||
fullDiscountVO.setPromotionGoodsList(promotionGoodsLis);
|
||||
|
||||
Assertions.assertTrue(fullDiscountService.savePromotions(fullDiscountVO));
|
||||
}
|
||||
|
||||
@Test
|
||||
void search() {
|
||||
PageVO pageVo = new PageVO();
|
||||
pageVo.setPageSize(10);
|
||||
pageVo.setPageNumber(0);
|
||||
pageVo.setNotConvert(true);
|
||||
pageVo.setSort("startTime");
|
||||
pageVo.setOrder("asc");
|
||||
|
||||
IPage<FullDiscount> fullDiscountByPage = fullDiscountService.pageFindAll(new FullDiscountSearchParams(), null);
|
||||
|
||||
Assertions.assertNotNull(fullDiscountByPage);
|
||||
}
|
||||
|
||||
@Test
|
||||
void update() {
|
||||
FullDiscountVO fullDiscountVO = new FullDiscountVO();
|
||||
fullDiscountVO.setId("1325981729404248064");
|
||||
fullDiscountVO.setStoreId("132");
|
||||
fullDiscountVO.setStoreName("联想自营旗舰店");
|
||||
fullDiscountVO.setDescription("Not worth");
|
||||
fullDiscountVO.setFullMinusFlag(true);
|
||||
fullDiscountVO.setFullMoney(100D);
|
||||
fullDiscountVO.setFullMinus(80D);
|
||||
fullDiscountVO.setFreeFreightFlag(true);
|
||||
|
||||
fullDiscountVO.setPromotionName("FullDiscount-" + fullDiscountVO.getId());
|
||||
fullDiscountVO.setTitle("满" + fullDiscountVO.getFullMoney() + "减" + fullDiscountVO.getFullMinus());
|
||||
fullDiscountVO.setStartTime(cn.hutool.core.date.DateUtil.parse("2020-11-10 10:15:00"));
|
||||
fullDiscountVO.setEndTime(cn.hutool.core.date.DateUtil.parse("2020-11-10 10:30:00"));
|
||||
|
||||
List<PromotionGoods> promotionGoodsLis = new ArrayList<>();
|
||||
PromotionGoods promotionGoods = new PromotionGoods();
|
||||
promotionGoods.setSkuId("134");
|
||||
promotionGoods.setPrice(18000D);
|
||||
promotionGoods.setStartTime(fullDiscountVO.getStartTime());
|
||||
promotionGoods.setEndTime(fullDiscountVO.getEndTime());
|
||||
promotionGoods.setNum(1);
|
||||
promotionGoods.setQuantity(100);
|
||||
promotionGoods.setPromotionType(PromotionTypeEnum.FULL_DISCOUNT.name());
|
||||
promotionGoods.setTitle("满" + fullDiscountVO.getFullMoney() + "减" + fullDiscountVO.getFullMinus());
|
||||
promotionGoods.setLimitNum(100);
|
||||
promotionGoods.setPromotionId("200");
|
||||
promotionGoods.setStoreId("132");
|
||||
promotionGoodsLis.add(promotionGoods);
|
||||
fullDiscountVO.setPromotionGoodsList(promotionGoodsLis);
|
||||
Assertions.assertTrue(fullDiscountService.updatePromotions(fullDiscountVO));
|
||||
}
|
||||
|
||||
@Test
|
||||
void delete() {
|
||||
Assertions.assertTrue(fullDiscountService.removePromotions(Collections.singletonList("1325995092947525632")));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.lili.test.promotion;
|
||||
|
||||
import cn.lili.modules.promotion.entity.dos.BasePromotions;
|
||||
import cn.lili.modules.promotion.service.PromotionGoodsService;
|
||||
import cn.lili.modules.promotion.service.PromotionService;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2020/11/23
|
||||
**/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest
|
||||
class PromotionPriceTest {
|
||||
|
||||
@Autowired
|
||||
private PromotionService promotionService;
|
||||
|
||||
@Autowired
|
||||
private PromotionGoodsService promotionGoodsServiceService;
|
||||
|
||||
@Test
|
||||
void testSeckillPrice() {
|
||||
Map<String, Object> currentPromotion = promotionService.getCurrentPromotion();
|
||||
for (Map.Entry<String, Object> entry : currentPromotion.entrySet()) {
|
||||
BasePromotions promotion = (BasePromotions) entry.getValue();
|
||||
System.out.println(entry.getKey() + "-" + promotion.getId());
|
||||
}
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package cn.lili.test.promotion;
|
||||
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.modules.promotion.entity.dos.Seckill;
|
||||
import cn.lili.modules.promotion.entity.enums.PromotionsApplyStatusEnum;
|
||||
import cn.lili.modules.promotion.entity.vos.SeckillApplyVO;
|
||||
import cn.lili.modules.promotion.service.SeckillApplyService;
|
||||
import cn.lili.modules.promotion.service.SeckillService;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
import cn.lili.modules.system.entity.dto.SeckillSetting;
|
||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import com.google.gson.Gson;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2020/10/29
|
||||
**/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest
|
||||
class SeckillTest {
|
||||
|
||||
@Autowired
|
||||
private SeckillService seckillService;
|
||||
|
||||
@Autowired
|
||||
private SeckillApplyService seckillApplyService;
|
||||
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
|
||||
/**
|
||||
* 系统设置
|
||||
*/
|
||||
@Autowired
|
||||
private SettingService settingService;
|
||||
|
||||
@Test
|
||||
void add() {
|
||||
Setting setting = settingService.get(SettingEnum.SECKILL_SETTING.name());
|
||||
System.out.println(setting);
|
||||
SeckillSetting seckillSetting = new Gson().fromJson(setting.getSettingValue(), SeckillSetting.class);
|
||||
System.out.println(seckillSetting);
|
||||
boolean result = true;
|
||||
for (int i = 1; i <= SeckillService.PRE_CREATION; i++) {
|
||||
Seckill seckill = new Seckill(i, seckillSetting.getHours(), seckillSetting.getSeckillRule());
|
||||
seckillService.savePromotions(seckill);
|
||||
}
|
||||
Assertions.assertTrue(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
void addApply() {
|
||||
List<SeckillApplyVO> seckillApplyVOS = new ArrayList<>();
|
||||
SeckillApplyVO seckillApplyVO = new SeckillApplyVO();
|
||||
seckillApplyVO.setGoodsName("Apple iPhone 12");
|
||||
seckillApplyVO.setSkuId("1387977574860193792");
|
||||
seckillApplyVO.setOriginalPrice(4000D);
|
||||
seckillApplyVO.setPrice(3600D);
|
||||
seckillApplyVO.setPromotionApplyStatus(PromotionsApplyStatusEnum.APPLY.name());
|
||||
seckillApplyVO.setQuantity(1);
|
||||
seckillApplyVO.setSalesNum(0);
|
||||
seckillApplyVO.setSeckillId("10000");
|
||||
seckillApplyVO.setStoreId("1376369067769724928");
|
||||
seckillApplyVO.setStoreName("Lilishop自营店");
|
||||
seckillApplyVO.setTimeLine(15);
|
||||
seckillApplyVOS.add(seckillApplyVO);
|
||||
seckillApplyVO = new SeckillApplyVO();
|
||||
seckillApplyVO.setGoodsName("Apple iPhone 12");
|
||||
seckillApplyVO.setSkuId("1387977574864388096");
|
||||
seckillApplyVO.setOriginalPrice(4000D);
|
||||
seckillApplyVO.setPrice(3600D);
|
||||
seckillApplyVO.setPromotionApplyStatus(PromotionsApplyStatusEnum.APPLY.name());
|
||||
seckillApplyVO.setQuantity(1);
|
||||
seckillApplyVO.setSalesNum(0);
|
||||
seckillApplyVO.setSeckillId("10000");
|
||||
seckillApplyVO.setStoreId("1376369067769724928");
|
||||
seckillApplyVO.setStoreName("Lilishop自营店");
|
||||
seckillApplyVO.setTimeLine(15);
|
||||
seckillApplyVOS.add(seckillApplyVO);
|
||||
seckillApplyService.addSeckillApply("10000", "1376369067769724928", seckillApplyVOS);
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.lili.test.rocketmq;
|
||||
|
||||
import cn.lili.common.properties.RocketmqCustomProperties;
|
||||
import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
|
||||
import cn.lili.rocketmq.tags.OrderTagsEnum;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.support.MessageBuilder;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2021/1/15
|
||||
**/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest
|
||||
class MsgExtRocketMqTest {
|
||||
|
||||
@Autowired
|
||||
private RocketMQTemplate rocketMQTemplate;
|
||||
|
||||
@Autowired
|
||||
private RocketmqCustomProperties rocketmqCustomProperties;
|
||||
|
||||
@Test
|
||||
void searchAll() {
|
||||
String destination = rocketmqCustomProperties.getOrderTopic() + ":" + OrderTagsEnum.STATUS_CHANGE.name();
|
||||
Message<String> message = MessageBuilder.withPayload("Context").build();
|
||||
rocketMQTemplate.asyncSend(destination, message, RocketmqSendCallbackBuilder.commonCallback());
|
||||
rocketMQTemplate.send(destination, message);
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user