commit message
This commit is contained in:
31
manager-api/pom.xml
Normal file
31
manager-api/pom.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>manager-api</artifactId>
|
||||
<parent>
|
||||
<groupId>cn.lili</groupId>
|
||||
<artifactId>lili-shop-parent</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.lili</groupId>
|
||||
<artifactId>framework</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
37
manager-api/src/main/java/cn/lili/ManagerApiApplication.java
Normal file
37
manager-api/src/main/java/cn/lili/ManagerApiApplication.java
Normal file
@@ -0,0 +1,37 @@
|
||||
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.data.jpa.repository.config.EnableJpaAuditing;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
/**
|
||||
* 运营后台 API
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/16 10:03 下午
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableCaching
|
||||
@EnableAsync
|
||||
@EnableJpaAuditing
|
||||
public class ManagerApiApplication {
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public TaskExecutor primaryTask() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
return executor;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.setProperty("es.set.netty.runtime.available.processors", "false");
|
||||
SpringApplication.run(ManagerApiApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 管理端,分销佣金管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date 2020-03-14 23:04:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,分销佣金管理接口")
|
||||
@RequestMapping("/manager/distribution/cash")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class DistributionCashManagerController {
|
||||
|
||||
private final 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));
|
||||
}
|
||||
|
||||
|
||||
@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,46 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,分销商品管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date 2020-03-14 23:04:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,分销商品管理接口")
|
||||
@RequestMapping("/manager/distribution/goods")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class DistributionGoodsManagerController {
|
||||
|
||||
private final 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(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 管理端,分销员管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date 2020-03-14 23:04:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,分销员管理接口")
|
||||
@RequestMapping("/manager/distribution")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class DistributionManagerController {
|
||||
|
||||
private final DistributionService distributionService;
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<Distribution>> getByPage(DistributionSearchParams distributionSearchParams, PageVO page) {
|
||||
return ResultUtil.data(distributionService.distributionPage(distributionSearchParams, page));
|
||||
}
|
||||
|
||||
|
||||
@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(ResultCode.SUCCESS);
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.DISTRIBUTION_RETREAT_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@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(ResultCode.SUCCESS);
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.DISTRIBUTION_RETREAT_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@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(ResultCode.SUCCESS);
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.DISTRIBUTION_AUDIT_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date 2020-03-14 23:04:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,分销订单管理接口")
|
||||
@RequestMapping("/manager/distribution/order")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class DistributionOrderManagerController {
|
||||
|
||||
private final 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,61 @@
|
||||
package cn.lili.controller.file;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,文件管理管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/26 15:41
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,文件管理管理接口")
|
||||
@RequestMapping("/manager/file")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class FileManagerController {
|
||||
|
||||
private final 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(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
|
||||
import cn.lili.common.enums.MessageCode;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date 2020-02-18 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,品牌接口")
|
||||
@RequestMapping("/manager/goods/brand")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class BrandManagerController {
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
private final 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);
|
||||
}
|
||||
return ResultUtil.error(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);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.BRAND_UPDATE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "后台禁用品牌")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "brandId", value = "品牌ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "id", value = "是否不可用", required = true, dataType = "String", paramType = "query")
|
||||
})
|
||||
@PutMapping(value = "/disable/{brandId}")
|
||||
public ResultMessage<Object> disable(@PathVariable String brandId, @RequestParam Boolean disable) {
|
||||
if (brandService.brandDisable(brandId, disable)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(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) {
|
||||
|
||||
for (String id : ids) {
|
||||
Brand brand = brandService.getById(id);
|
||||
brand.setDeleteFlag(true);
|
||||
brandService.updateById(brand);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.BRAND_DELETE_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,分类品牌接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date 2020-02-27 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,分类品牌接口")
|
||||
@RequestMapping("/manager/category/brand")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class CategoryBrandManagerController {
|
||||
|
||||
/**
|
||||
* 规格品牌管理
|
||||
*/
|
||||
private final 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 String[] categoryBrands) {
|
||||
//删除分类品牌绑定信息
|
||||
this.categoryBrandService.remove(new QueryWrapper<CategoryBrand>().eq("category_id", categoryId));
|
||||
//绑定品牌信息
|
||||
for (String brandId : categoryBrands) {
|
||||
CategoryBrand categoryBrand = new CategoryBrand(categoryId, brandId);
|
||||
categoryBrandService.save(categoryBrand);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date 2020-02-27 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,商品分类接口")
|
||||
@RequestMapping("/manager/goods/category")
|
||||
@CacheConfig(cacheNames = "category")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class CategoryManagerController {
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
private final CategoryService categoryService;
|
||||
|
||||
/**
|
||||
* 商品
|
||||
*/
|
||||
private final 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.listAllChildrenDB());
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加商品分类")
|
||||
public ResultMessage<Category> saveCategory(@Valid Category category) {
|
||||
|
||||
//不能添加重复的分类名称
|
||||
Category category1 = new Category();
|
||||
category1.setName(category.getName());
|
||||
List<Category> list = categoryService.findByAllBySortOrder(category1);
|
||||
if (StringUtils.isNotEmpty(list)) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_NOT_EXIST);
|
||||
}
|
||||
// 非顶级分类
|
||||
if (category.getParentId() != null && !category.getParentId().equals("0")) {
|
||||
Category parent = categoryService.getById(category.getParentId());
|
||||
if (parent == null) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
||||
}
|
||||
if (category.getLevel() >= 4) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_BEYOND_THREE);
|
||||
}
|
||||
}
|
||||
if (categoryService.saveCategory(category)) {
|
||||
return ResultUtil.data(category);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.CATEGORY_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改商品分类")
|
||||
public ResultMessage<Category> updateCategory(CategoryVO category) {
|
||||
Category catTemp = categoryService.getById(category.getId());
|
||||
if (catTemp == null) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
||||
}
|
||||
//不能添加重复的分类名称
|
||||
Category category1 = new Category();
|
||||
category1.setName(category.getName());
|
||||
category1.setId(category.getId());
|
||||
List<Category> list = categoryService.findByAllBySortOrder(category1);
|
||||
if (StringUtils.isNotEmpty(list)) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_NAME_IS_EXIST);
|
||||
}
|
||||
|
||||
categoryService.updateCategory(category);
|
||||
return ResultUtil.data(category);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "goodsId", 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()) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_HAS_CHILDREN);
|
||||
|
||||
}
|
||||
// 查询某商品分类的商品数量
|
||||
Integer count = goodsService.getGoodsCountByCategory(id);
|
||||
if (count > 0) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_HAS_GOODS);
|
||||
}
|
||||
categoryService.delete(id);
|
||||
return ResultUtil.success(ResultCode.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) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_NOT_EXIST);
|
||||
}
|
||||
categoryService.updateCategoryStatus(id, enableOperations);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.CategoryParameterGroup;
|
||||
import cn.lili.modules.goods.entity.dos.Parameters;
|
||||
import cn.lili.modules.goods.entity.vos.ParameterGroupVO;
|
||||
import cn.lili.modules.goods.service.CategoryParameterGroupService;
|
||||
import cn.lili.modules.goods.service.ParametersService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,分类绑定参数组接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date 2020-02-18 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,分类绑定参数组接口")
|
||||
@RequestMapping("/manager/goods/category/parameters")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class CategoryParameterGroupManagerController {
|
||||
|
||||
/**
|
||||
* 参数组
|
||||
*/
|
||||
private final ParametersService parametersService;
|
||||
|
||||
/**
|
||||
* 分类参数
|
||||
*/
|
||||
private final 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(CategoryParameterGroup categoryParameterGroup) {
|
||||
|
||||
if (categoryParameterGroupService.save(categoryParameterGroup)) {
|
||||
return ResultUtil.data(categoryParameterGroup);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.CATEGORY_PARAMETER_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新数据")
|
||||
@PutMapping
|
||||
public ResultMessage<CategoryParameterGroup> update(CategoryParameterGroup categoryParameterGroup) {
|
||||
|
||||
if (categoryParameterGroupService.updateById(categoryParameterGroup)) {
|
||||
return ResultUtil.data(categoryParameterGroup);
|
||||
}
|
||||
return ResultUtil.error(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(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.CategorySpecification;
|
||||
import cn.lili.modules.goods.entity.vos.CategorySpecificationVO;
|
||||
import cn.lili.modules.goods.entity.vos.GoodsSpecValueVO;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,商品分类规格接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date 2020-02-27 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,商品分类规格接口")
|
||||
@RequestMapping("/manager/goods/category/spec")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class CategorySpecificationManagerController {
|
||||
|
||||
/**
|
||||
* 分类规格
|
||||
*/
|
||||
private final CategorySpecificationService categorySpecificationService;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
private final SpecificationService specificationService;
|
||||
|
||||
|
||||
@ApiOperation(value = "查询某分类下绑定的规格信息")
|
||||
@GetMapping(value = "/{categoryId}")
|
||||
@ApiImplicitParam(name = "categoryId", value = "分类id", required = true, dataType = "String", paramType = "path")
|
||||
public List<CategorySpecificationVO> 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<GoodsSpecValueVO> getSpec(@PathVariable String categoryId) {
|
||||
return specificationService.getGoodsSpecValue(categoryId);
|
||||
}
|
||||
|
||||
|
||||
@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));
|
||||
//绑定规格信息
|
||||
for (String specId : categorySpecs) {
|
||||
CategorySpecification categoryBrand = new CategorySpecification(categoryId, specId);
|
||||
categorySpecificationService.save(categoryBrand);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date 2020-02-23 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,商品管理接口")
|
||||
@RequestMapping("/manager/goods")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class GoodsManagerController {
|
||||
//商品
|
||||
private final GoodsService goodsService;
|
||||
//规格商品
|
||||
private final 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.setIsAuth(GoodsAuthEnum.TOBEAUDITED.name());
|
||||
goodsSearchParams.setMarketEnable(GoodsStatusEnum.UPPER.name());
|
||||
return goodsService.queryByParams(goodsSearchParams);
|
||||
}
|
||||
|
||||
@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.updateGoodsMarketAble(goodsIds, GoodsStatusEnum.DOWN, reason))) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.GOODS_UNDER_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "管理员审核商品", notes = "管理员审核商品")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "goodsIds", value = "商品ID", required = true, paramType = "path", allowMultiple = true, dataType = "int"),
|
||||
@ApiImplicitParam(name = "isAuth", value = "审核结果", required = true, paramType = "query", dataType = "string")
|
||||
})
|
||||
@PutMapping(value = "{goodsIds}/auth")
|
||||
public ResultMessage<Object> auth(@PathVariable List<String> goodsIds, @RequestParam String isAuth) {
|
||||
//校验商品是否存在
|
||||
if (goodsService.auditGoods(goodsIds, GoodsAuthEnum.valueOf(isAuth))) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.GOODS_AUTH_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@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(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(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,44 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO;
|
||||
import cn.lili.modules.goods.service.GoodsParamsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,商品关联参数管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date 2020-02-18 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,商品关联参数管理接口")
|
||||
@RequestMapping("/manager/goods/parameters")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class GoodsParameterManagerController {
|
||||
|
||||
private final GoodsParamsService goodsParamsService;
|
||||
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "path", dataType = "String"),
|
||||
@ApiImplicitParam(name = "categoryId", value = "分类ID", required = true, paramType = "path", dataType = "String")
|
||||
})
|
||||
@ApiOperation(value = "通过商品id和分类id查询参数信息")
|
||||
@GetMapping(value = "/{goodsId}/{categoryId}")
|
||||
public ResultMessage<List<GoodsParamsGroupVO>> getGoodsParameters(@PathVariable String goodsId, @PathVariable String categoryId) {
|
||||
return ResultUtil.data(this.goodsParamsService.queryGoodsParams(goodsId, categoryId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
|
||||
import cn.lili.common.enums.MessageCode;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.GoodsUnit;
|
||||
import cn.lili.modules.goods.service.GoodsUnitService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date: 2020/11/26 16:15
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,商品计量单位接口")
|
||||
@RequestMapping("/manager/goods/goodsUnit")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class GoodsUnitManagerController {
|
||||
|
||||
private final 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(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 管理端,分类绑定参数组管理接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2020/11/26 16:15
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,分类绑定参数组管理接口")
|
||||
@RequestMapping("/manager/goods/parameters")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class ParameterManagerController {
|
||||
|
||||
private final ParametersService parametersService;
|
||||
|
||||
@ApiOperation(value = "添加参数")
|
||||
@PostMapping
|
||||
public ResultMessage<Parameters> save(@Valid Parameters parameters) {
|
||||
|
||||
if (parametersService.save(parameters)) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PARAMETER_SAVE_ERROR);
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑参数")
|
||||
@PutMapping
|
||||
public ResultMessage<Parameters> update(@Valid Parameters parameters) {
|
||||
|
||||
if (parametersService.updateById(parameters)) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
return ResultUtil.error(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(ResultCode.SUCCESS);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.SpecValues;
|
||||
import cn.lili.modules.goods.service.SpecValuesService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,规格项管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date 2020-02-18 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,规格项管理接口")
|
||||
@RequestMapping("/manager/goods/specValues")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class SpecValuesManagerController {
|
||||
|
||||
private final SpecValuesService specValuesService;
|
||||
|
||||
@GetMapping(value = "/values/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "规格项ID", required = true, dataType = "String", paramType = "path")
|
||||
@ApiOperation(value = "查询规格值列表")
|
||||
public ResultMessage<List<SpecValues>> list(@PathVariable("id") String id) {
|
||||
return ResultUtil.data(specValuesService.query().eq("spec_id", id).list());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "保存规格值")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "specId", value = "商品规格ID", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "specValue", value = "商品项", required = true, allowMultiple = true, paramType = "query")
|
||||
})
|
||||
@PostMapping(value = "/save/{specId}")
|
||||
public ResultMessage<List<SpecValues>> saveSpecValue(@PathVariable String specId,
|
||||
@NotNull(message = "至少添加一个规格值") @RequestParam String[] specValue) {
|
||||
//重新添加
|
||||
List<SpecValues> list = specValuesService.saveSpecValue(specId, specValue);
|
||||
return ResultUtil.data(list);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
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.entity.dto.SpecificationSearchParams;
|
||||
import cn.lili.modules.goods.entity.vos.SpecificationVO;
|
||||
import cn.lili.modules.goods.service.SpecificationService;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,商品规格接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date 2020-02-18 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,商品规格接口")
|
||||
@RequestMapping("/manager/goods/spec")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class SpecificationManagerController {
|
||||
|
||||
private final SpecificationService specificationService;
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "商品规格ID", required = true, dataType = "String", paramType = "path")
|
||||
@ApiOperation(value = "通过id获取商品规格")
|
||||
public ResultMessage<Specification> get(@PathVariable String id) {
|
||||
return ResultUtil.data(specificationService.getSpecification(id));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/all", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "获取所有可用规格")
|
||||
public List<Specification> getAll() {
|
||||
List<Specification> list = specificationService.list(new QueryWrapper<Specification>().eq("delete_flag", 0));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@ApiOperation(value = "分页获取")
|
||||
public ResultMessage<IPage<SpecificationVO>> getByPage(@RequestParam(required = false) String specName, PageVO pageVo) {
|
||||
SpecificationSearchParams searchParams = new SpecificationSearchParams();
|
||||
searchParams.setSpecName(specName);
|
||||
return ResultUtil.data(specificationService.getSpecificationPage(searchParams, pageVo));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "编辑规格")
|
||||
public ResultMessage<Specification> update(@Valid SpecificationVO parameters) {
|
||||
if (parameters.getStoreId() == null) {
|
||||
parameters.setStoreId("0");
|
||||
}
|
||||
if (specificationService.updateSpecification(parameters)) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.SPEC_UPDATE_ERROR);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加规格")
|
||||
public ResultMessage<Specification> save(@Valid SpecificationVO parameters) {
|
||||
if (parameters.getStoreId() == null) {
|
||||
parameters.setStoreId("0");
|
||||
}
|
||||
if (specificationService.addSpecification(parameters) != null) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.SPEC_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{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(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.connect.entity.ConnectConfig;
|
||||
import cn.lili.modules.connect.entity.vo.ConnectConfigForm;
|
||||
import cn.lili.modules.connect.service.ConnectConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,联合登陆配置接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,联合登陆配置接口")
|
||||
@RequestMapping("/manager/connectConfig")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class ConnectConfigManagerController {
|
||||
|
||||
private final ConnectConfigService connectConfigService;
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@ApiOperation(value = "获取所有联合配置")
|
||||
public ResultMessage<List<ConnectConfigForm>> all() {
|
||||
return ResultUtil.data(connectConfigService.listForms());
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{key}")
|
||||
@ApiOperation(value = "查看联合登陆配置详情")
|
||||
public ResultMessage<ConnectConfig> get(@PathVariable String key) {
|
||||
ConnectConfig connectConfig = connectConfigService.getConfig(key);
|
||||
return ResultUtil.data(connectConfig);
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/{configKey}")
|
||||
@ApiOperation(value = "更新联合登陆配置")
|
||||
public ResultMessage<ConnectConfig> update(@PathVariable String configKey, ConnectConfig connectConfig) {
|
||||
connectConfig.setConfigKey(configKey);
|
||||
connectConfigService.saveConfig(connectConfig);
|
||||
return ResultUtil.data(connectConfig);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.utils.IpHelper;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 管理端,IP接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,IP接口")
|
||||
@RequestMapping("/manager/common/ip")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class IpInfoManagerController {
|
||||
|
||||
private final IpHelper ipHelper;
|
||||
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "IP及天气相关信息")
|
||||
public ResultMessage<Object> upload(HttpServletRequest request) {
|
||||
|
||||
String result = ipHelper.getIpCity(request);
|
||||
return ResultUtil.data(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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.promotion.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 管理端,会员地址API
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员地址API")
|
||||
@RequestMapping("/manager/member/address")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class MemberAddressManagerController {
|
||||
|
||||
private final MemberAddressService memberAddressService;
|
||||
|
||||
@ApiOperation(value = "会员地址分页列表")
|
||||
@GetMapping("/{memberId}")
|
||||
public ResultMessage<IPage<MemberAddress>> getByPage(PageVO page, @PathVariable("memberId") String memberId) {
|
||||
return ResultUtil.data(memberAddressService.getAddressByMember(page, memberId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除会员收件地址")
|
||||
@ApiImplicitParam(name = "id", value = "会员地址ID", dataType = "String", paramType = "path")
|
||||
@DeleteMapping(value = "/delById/{id}")
|
||||
public ResultMessage<Object> delShippingAddressById(@PathVariable String id) {
|
||||
if (memberAddressService.removeMemberAddress(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改会员收件地址")
|
||||
@PutMapping
|
||||
public ResultMessage<MemberAddress> editShippingAddress(@Valid MemberAddress shippingAddress) {
|
||||
//修改会员地址
|
||||
return ResultUtil.data(memberAddressService.updateMemberAddress(shippingAddress));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增会员收件地址")
|
||||
@PostMapping
|
||||
public ResultMessage<MemberAddress> addShippingAddress(@Valid MemberAddress shippingAddress) {
|
||||
//添加会员地址
|
||||
return ResultUtil.data(memberAddressService.saveMemberAddress(shippingAddress));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 管理端,会员商品评价接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员商品评价接口")
|
||||
@RequestMapping("/manager/memberEvaluation")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class MemberEvaluationManagerController {
|
||||
|
||||
private final MemberEvaluationService memberEvaluationService;
|
||||
|
||||
@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, page));
|
||||
}
|
||||
|
||||
@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) {
|
||||
if (memberEvaluationService.updateStatus(id, status)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@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) {
|
||||
if (memberEvaluationService.delete(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,会员接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员接口")
|
||||
@RequestMapping("/manager/member")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class MemberManagerController {
|
||||
|
||||
private final MemberService memberService;
|
||||
|
||||
@ApiOperation(value = "会员分页列表")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<Member>> 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));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改会员基本信息")
|
||||
@PutMapping
|
||||
public ResultMessage<Member> update(@Valid ManagerMemberEditDTO managerMemberEditDTO) {
|
||||
return ResultUtil.data(memberService.updateMember(managerMemberEditDTO));
|
||||
}
|
||||
|
||||
@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) {
|
||||
if (memberService.updateMemberStatus(memberIds, disabled)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "根据条件查询会员总数")
|
||||
@GetMapping("/num")
|
||||
public ResultMessage<Integer> getByPage(MemberSearchVO memberSearchVO) {
|
||||
return ResultUtil.data(memberService.getMemberNum(memberSearchVO));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,会员消息接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员消息接口")
|
||||
@RequestMapping("/manager/memberNoticeLog")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class MemberNoticeLogManagerController {
|
||||
|
||||
private final 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) {
|
||||
if (memberNoticeLogService.saveOrUpdate(memberNoticeLog)) {
|
||||
return ResultUtil.data(memberNoticeLog);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/delByIds/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
memberNoticeLogService.removeByIds(ids);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,会员消息接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员消息接口")
|
||||
@RequestMapping("/manager/memberNoticeSenter")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class MemberNoticeSenterManagerController {
|
||||
|
||||
private final 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) {
|
||||
|
||||
if (memberNoticeSenterService.customSave(memberNoticeSenter)) {
|
||||
return ResultUtil.data(memberNoticeSenter);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/delByIds/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
memberNoticeSenterService.removeByIds(ids);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.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.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 lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date 2020-02-25 14:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员积分历史接口")
|
||||
@RequestMapping("/manager/member/memberPointsHistory")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class MemberPointsHistoryManagerController {
|
||||
|
||||
private final 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) {
|
||||
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq(memberId != null, "member_id", memberId);
|
||||
queryWrapper.like(memberName != null, "member_name", memberName);
|
||||
|
||||
return ResultUtil.data(memberPointsHistoryService.page(PageUtil.initPage(page), queryWrapper));
|
||||
}
|
||||
|
||||
@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,39 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.vo.MemberWalletVO;
|
||||
import cn.lili.modules.member.service.MemberWalletService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date: 2020/11/16 10:07 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,预存款接口")
|
||||
@RequestMapping("/manager/members/wallet")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class MemberWalletManagerController {
|
||||
|
||||
private final 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,57 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dos.MemberWithdrawApply;
|
||||
import cn.lili.modules.member.entity.vo.MemberWithdrawApplyQueryVO;
|
||||
import cn.lili.modules.member.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,余额提现记录接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date: 2020/11/16 10:07 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,余额提现记录接口")
|
||||
@RequestMapping("/manager/members/withdraw-apply")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class MemberWithdrawApplyManagerController {
|
||||
|
||||
private final MemberWithdrawApplyService memberWithdrawApplyService;
|
||||
|
||||
|
||||
@ApiOperation(value = "分页获取提现记录")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<MemberWithdrawApply>> getByPage(PageVO page, MemberWithdrawApplyQueryVO memberWithdrawApplyQueryVO) {
|
||||
//构建查询 返回数据
|
||||
IPage<MemberWithdrawApply> memberWithdrawApplyIPage = memberWithdrawApplyService.getMemberWithdrawPage(page, memberWithdrawApplyQueryVO);
|
||||
return ResultUtil.data(memberWithdrawApplyIPage);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "提现申请审核")
|
||||
@PostMapping
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "apply_id", 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,81 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,文章分类管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date 2020-05-5 15:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,文章分类管理接口")
|
||||
@RequestMapping("/manager/article-category")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class ArticleCategoryManagerController {
|
||||
|
||||
/**
|
||||
* 文章分类
|
||||
*/
|
||||
private final ArticleCategoryService articleCategoryService;
|
||||
|
||||
@ApiOperation(value = "查询分类列表")
|
||||
@GetMapping(value = "/all-children")
|
||||
public ResultMessage<List<ArticleCategoryVO>> allChildren() {
|
||||
try {
|
||||
return ResultUtil.data(this.articleCategoryService.allChildren());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
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) {
|
||||
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) {
|
||||
if (articleCategoryService.deleteById(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 管理端,文章接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date 2020-05-06 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,文章接口")
|
||||
@RequestMapping("/manager/article")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class ArticleManagerController {
|
||||
|
||||
/**
|
||||
* 文章
|
||||
*/
|
||||
private final 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", dataType = "String", paramType = "query"),
|
||||
@ApiImplicitParam(name = "title", value = "标题", dataType = "String", paramType = "query")
|
||||
})
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<ArticleVO>> getByPage(ArticleSearchParams articleSearchParams) {
|
||||
return ResultUtil.data(articleService.articlePage(articleSearchParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加文章")
|
||||
@PostMapping
|
||||
public ResultMessage<Article> save(@Valid Article article) {
|
||||
article.setType(ArticleEnum.OTHER.name());
|
||||
articleService.save(article);
|
||||
return ResultUtil.data(article);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改文章")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "String", paramType = "path")
|
||||
@PutMapping("update/{id}")
|
||||
public ResultMessage<Article> update(@Valid Article article, @PathVariable("id") String id) {
|
||||
article.setId(id);
|
||||
return ResultUtil.data(articleService.updateArticle(article));
|
||||
}
|
||||
|
||||
@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(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.modules.permission.SettingKeys;
|
||||
import cn.lili.modules.search.service.CustomWordsService;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* 管理端,自定义分词接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/10/16
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,自定义分词接口")
|
||||
@RequestMapping("/manager/custom-words")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class CustomWordsController {
|
||||
|
||||
/**
|
||||
* 分词
|
||||
*/
|
||||
private final CustomWordsService customWordsService;
|
||||
/**
|
||||
* 设置
|
||||
*/
|
||||
private final SettingService settingService;
|
||||
|
||||
@GetMapping
|
||||
public String getCustomWords(String secretKey) {
|
||||
if (StringUtils.isEmpty(secretKey)) {
|
||||
return "";
|
||||
}
|
||||
Setting setting = settingService.get(SettingKeys.ES_SIGN.name());
|
||||
if (setting == null || StringUtils.isEmpty(setting.getSettingValue())) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (!setting.getSettingValue().equals(secretKey)) {
|
||||
throw new ServiceException("秘钥验证失败!");
|
||||
}
|
||||
|
||||
String res = customWordsService.deploy();
|
||||
try {
|
||||
return new String(res.getBytes(), StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.search.entity.dos.CustomWords;
|
||||
import cn.lili.modules.search.entity.vo.CustomWordsVO;
|
||||
import cn.lili.modules.search.service.CustomWordsService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 管理端,自定义分词接口
|
||||
*
|
||||
* @author paulG
|
||||
* @date 2020/10/16
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,自定义分词接口")
|
||||
@RequestMapping("/manager/manager/custom-words")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class CustomWordsManagerController {
|
||||
|
||||
/**
|
||||
* 分词
|
||||
*/
|
||||
private final CustomWordsService customWordsService;
|
||||
|
||||
@ApiOperation(value = "添加自定义分词")
|
||||
@PostMapping
|
||||
public ResultMessage<CustomWordsVO> addCustomWords(@Valid CustomWordsVO customWords) {
|
||||
if (customWordsService.addCustomWords(customWords)) {
|
||||
return ResultUtil.data(customWords);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改自定义分词")
|
||||
@PutMapping
|
||||
public ResultMessage<CustomWordsVO> updateCustomWords(@Valid CustomWordsVO customWords) {
|
||||
if (customWordsService.updateCustomWords(customWords)) {
|
||||
return ResultUtil.data(customWords);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除自定义分词")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public ResultMessage<String> deleteCustomWords(@NotNull @PathVariable String id) {
|
||||
if (customWordsService.deleteCustomWords(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取自定义分词")
|
||||
@ApiImplicitParam(name = "words", value = "分词", required = true, dataType = "String", paramType = "query")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<CustomWords>> getCustomWords(@RequestParam String words, PageVO pageVo) {
|
||||
return ResultUtil.data(customWordsService.getCustomWordsByPage(words, pageVo));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
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.EsGoodsIndex;
|
||||
import cn.lili.modules.search.service.EsGoodsIndexService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
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;
|
||||
|
||||
@Autowired
|
||||
private GoodsSkuService goodsSkuService;
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Autowired
|
||||
private PromotionService promotionService;
|
||||
|
||||
@GetMapping
|
||||
public void init() {
|
||||
LambdaQueryWrapper<GoodsSku> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(GoodsSku::getIsAuth, 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);
|
||||
Map<String, Object> goodsCurrentPromotionMap = promotionService.getGoodsCurrentPromotionMap(index);
|
||||
index.setPromotionMap(goodsCurrentPromotionMap);
|
||||
esGoodsIndices.add(index);
|
||||
stringRedisTemplate.opsForValue().set(GoodsSkuService.getStockCacheKey(goodsSku.getId()), goodsSku.getQuantity().toString());
|
||||
}
|
||||
esGoodsIndexService.initIndex(esGoodsIndices);
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date 2020-05-5 15:10:16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,意见反馈接口")
|
||||
@RequestMapping("/manager/feedback")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class FeedbackManagerController {
|
||||
|
||||
/**
|
||||
* 意见反馈
|
||||
*/
|
||||
private final 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,57 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 管理端,消息发送管理接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date 2020-05-06 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,消息发送管理接口")
|
||||
@RequestMapping("/manager/message")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class MessageManagerController {
|
||||
|
||||
private final 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,78 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 管理端,页面设置管理接口
|
||||
*
|
||||
* @author paulGao
|
||||
* @date 2020-05-06 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,页面设置管理接口")
|
||||
@RequestMapping("/manager/pageData")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class PageDataManagerController {
|
||||
|
||||
private final 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")
|
||||
})
|
||||
@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}")
|
||||
public ResultMessage<PageData> release(@PathVariable String id) {
|
||||
return ResultUtil.data(pageDataService.releasePageData(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除页面")
|
||||
@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,83 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.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.modules.system.utils.SensitiveWordsFilter;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,敏感词管理接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date 2020-05-06 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,敏感词管理接口")
|
||||
@RequestMapping("/manager/sensitiveWords")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class SensitiveWordsManagerController {
|
||||
|
||||
private final 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) {
|
||||
if (sensitiveWordsService.save(sensitiveWords)) {
|
||||
SensitiveWordsFilter.put(sensitiveWords.getSensitiveWord());
|
||||
return ResultUtil.data(sensitiveWords);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@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);
|
||||
if (sensitiveWordsService.updateById(sensitiveWords)) {
|
||||
SensitiveWordsFilter.put(sensitiveWords.getSensitiveWord());
|
||||
return ResultUtil.data(sensitiveWords);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.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) {
|
||||
for (String id : ids) {
|
||||
String name = sensitiveWordsService.getById(id).getSensitiveWord();
|
||||
SensitiveWordsFilter.remove(name);
|
||||
sensitiveWordsService.removeById(id);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.MessageCode;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,专题活动接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2020/12/7 11:33
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,专题活动接口")
|
||||
@RequestMapping("/manager/special")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class SpecialManagerController {
|
||||
|
||||
private final 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);
|
||||
if (specialService.updateById(special)) {
|
||||
return ResultUtil.data(special);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除专题活动")
|
||||
@ApiImplicitParam(name = "id", value = "专题ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public ResultMessage<Object> deleteSpecial(@PathVariable String id) {
|
||||
if(specialService.removeSpecial(id)){
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
|
||||
}
|
||||
|
||||
@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,84 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.base.entity.dos.VerificationSource;
|
||||
import cn.lili.modules.base.service.VerificationSourceService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date: 2020/12/7 11:33
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,验证码资源维护接口")
|
||||
@RequestMapping("/manager/verificationSource")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class VerificationSourceController {
|
||||
|
||||
private final 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 = "新增验证码资源维护")
|
||||
public ResultMessage<VerificationSource> save(VerificationSource verificationSource) {
|
||||
|
||||
if (verificationSourceService.save(verificationSource)) {
|
||||
verificationSourceService.initCache();
|
||||
return ResultUtil.data(verificationSource);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation(value = "更新验证码资源维护")
|
||||
public ResultMessage<VerificationSource> update(@PathVariable String id, VerificationSource verificationSource) {
|
||||
verificationSource.setId(id);
|
||||
if (verificationSourceService.updateById(verificationSource)) {
|
||||
verificationSourceService.initCache();
|
||||
return ResultUtil.data(verificationSource);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ApiOperation(value = "删除验证码资源维护")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
|
||||
verificationSourceService.removeByIds(ids);
|
||||
verificationSourceService.initCache();
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package cn.lili.controller.passport;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.token.Token;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
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.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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理员接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/16 10:57
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "管理员")
|
||||
@RequestMapping("/manager/user")
|
||||
@Transactional
|
||||
@Validated
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class AdminUserManagerController {
|
||||
|
||||
private final AdminUserService adminUserService;
|
||||
|
||||
private final DepartmentService departmentService;
|
||||
|
||||
|
||||
@GetMapping(value = "/login")
|
||||
@ApiOperation(value = "登录管理员")
|
||||
public ResultMessage<Token> login(String username, String password) {
|
||||
return ResultUtil.data(adminUserService.login(username, password));
|
||||
}
|
||||
|
||||
|
||||
@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);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/edit")
|
||||
@ApiOperation(value = "修改用户自己资料", notes = "用户名密码不会修改")
|
||||
public ResultMessage<Object> editOwner(AdminUser adminUser) {
|
||||
|
||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
||||
if (tokenUser != null) {
|
||||
//查询当前管理员
|
||||
AdminUser adminUserDB = adminUserService.findByUsername(tokenUser.getUsername());
|
||||
adminUserDB.setAvatar(adminUser.getAvatar());
|
||||
adminUserDB.setNickName(adminUser.getNickName());
|
||||
if (!adminUserService.updateById(adminUserDB)) {
|
||||
return ResultUtil.error(ResultCode.USER_EDIT_ERROR);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.USER_EDIT_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/admin/edit")
|
||||
@ApiOperation(value = "超级管理员修改其他管理员资料")
|
||||
public ResultMessage<Object> edit(AdminUser adminUser,
|
||||
@RequestParam(required = false) List<String> roles) {
|
||||
if (!adminUserService.updateAdminUser(adminUser, roles)) {
|
||||
return ResultUtil.error(ResultCode.USER_EDIT_ERROR);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.USER_EDIT_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*
|
||||
* @param password
|
||||
* @param newPassword
|
||||
* @return
|
||||
*/
|
||||
@PutMapping(value = "/editPassword")
|
||||
@ApiOperation(value = "修改密码")
|
||||
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 = "重置密码")
|
||||
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(AdminUserDTO adminUser,
|
||||
@RequestParam(required = false) List<String> roles) {
|
||||
try {
|
||||
if (roles != null & roles.size() >= 10) {
|
||||
return ResultUtil.error(ResultCode.PERMISSION_BEYOND_TEN);
|
||||
}
|
||||
adminUserService.saveAdminUser(adminUser, roles);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/enable/{userId}")
|
||||
@ApiOperation(value = "禁/启 用 用户")
|
||||
public ResultMessage<Object> disable(@ApiParam("用户唯一id标识") @PathVariable String userId, Boolean status) {
|
||||
AdminUser user = adminUserService.getById(userId);
|
||||
if (user == null) {
|
||||
return ResultUtil.error(ResultCode.USER_NOT_EXIST);
|
||||
}
|
||||
user.setStatus(status);
|
||||
adminUserService.updateById(user);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ApiOperation(value = "批量通过ids删除")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List<String> ids) {
|
||||
adminUserService.deleteCompletely(ids);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
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")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class DepartmentManagerController {
|
||||
|
||||
private final 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) {
|
||||
if (departmentService.save(department)) {
|
||||
return ResultUtil.data(department);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation(value = "更新部门")
|
||||
public ResultMessage<Department> update(@PathVariable String id, Department department) {
|
||||
if (departmentService.updateById(department)) {
|
||||
return ResultUtil.data(department);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ApiOperation(value = "删除部门")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List<String> ids) {
|
||||
departmentService.deleteByIds(ids);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
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")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class DepartmentRoleManagerController {
|
||||
|
||||
private final 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) {
|
||||
try {
|
||||
departmentRoleService.updateByDepartmentId(departmentId, departmentRole);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,菜单管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/20 12:07
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,菜单管理接口")
|
||||
@RequestMapping("/manager/menu")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class MenuManagerController {
|
||||
|
||||
private final MenuService menuService;
|
||||
|
||||
|
||||
@ApiOperation(value = "搜索菜单")
|
||||
@GetMapping
|
||||
public ResultMessage<List<Menu>> searchPermissionList(MenuSearchParams searchParams) {
|
||||
return ResultUtil.data(menuService.searchList(searchParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加")
|
||||
@PostMapping
|
||||
public ResultMessage<Menu> add(Menu menu) {
|
||||
try {
|
||||
menuService.save(menu);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ResultUtil.data(menu);
|
||||
}
|
||||
|
||||
@ApiImplicitParam(name = "id", value = "菜单ID", required = true, paramType = "path", dataType = "String")
|
||||
@ApiOperation(value = "编辑")
|
||||
@PutMapping(value = "/{id}")
|
||||
public ResultMessage<Menu> edit(@PathVariable String id, Menu menu) {
|
||||
menu.setId(id);
|
||||
menuService.updateById(menu);
|
||||
return ResultUtil.data(menu);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
public ResultMessage<Menu> delByIds(@PathVariable List<String> ids) {
|
||||
menuService.deleteIds(ids);
|
||||
return ResultUtil.success(ResultCode.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,64 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,角色管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/20 18:50
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,角色管理接口")
|
||||
@RequestMapping("/manager/role")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class RoleManagerController {
|
||||
|
||||
private final 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(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,角色菜单接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/22 11:40
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,角色菜单接口")
|
||||
@RequestMapping("/manager/roleMenu")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class RoleMenuManagerController {
|
||||
|
||||
private final 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(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,管理员角色接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/22 11:53
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,管理员角色接口")
|
||||
@RequestMapping("/manager/userRole")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class UserRoleManagerController {
|
||||
|
||||
private final 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(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
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.enums.PromotionStatusEnum;
|
||||
import cn.lili.modules.promotion.entity.vos.CouponSearchParams;
|
||||
import cn.lili.modules.promotion.entity.vos.CouponVO;
|
||||
import cn.lili.modules.promotion.service.CouponService;
|
||||
import cn.lili.modules.promotion.service.MemberCouponService;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,优惠券接口
|
||||
*
|
||||
* @author paulG
|
||||
* @date 2020/10/9
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,优惠券接口")
|
||||
@RequestMapping("/manager/promotion/coupon")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class CouponManagerController {
|
||||
|
||||
private final CouponService couponService;
|
||||
private final MemberCouponService memberCouponService;
|
||||
|
||||
@ApiOperation(value = "获取优惠券列表")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<CouponVO>> getCouponList(CouponSearchParams queryParam, PageVO page) {
|
||||
page.setNotConvert(true);
|
||||
queryParam.setStoreId("platform");
|
||||
IPage<CouponVO> coupons = couponService.getCouponsByPageFromMongo(queryParam, page);
|
||||
return ResultUtil.data(coupons);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取优惠券详情")
|
||||
@GetMapping("/{couponId}")
|
||||
public ResultMessage<CouponVO> getCoupon(@PathVariable String couponId) {
|
||||
CouponVO coupon = couponService.getCouponDetailFromMongo(couponId);
|
||||
return ResultUtil.data(coupon);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加优惠券")
|
||||
@PostMapping(consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<CouponVO> addCoupon(@RequestBody CouponVO couponVO) {
|
||||
this.setStoreInfo(couponVO);
|
||||
if (couponService.add(couponVO) != null) {
|
||||
return ResultUtil.data(couponVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改优惠券")
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<Coupon> updateCoupon(@RequestBody CouponVO couponVO) {
|
||||
Coupon coupon = couponService.getById(couponVO.getId());
|
||||
couponVO.setPromotionStatus(PromotionStatusEnum.NEW.name());
|
||||
if (couponService.updateCoupon(couponVO) != null) {
|
||||
return ResultUtil.data(coupon);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改优惠券状态")
|
||||
@PutMapping("/status")
|
||||
public ResultMessage<Object> updateCouponStatus(String couponIds, String promotionStatus) {
|
||||
String[] split = couponIds.split(",");
|
||||
if (couponService.updateCouponStatus(Arrays.asList(split), PromotionStatusEnum.valueOf(promotionStatus))) {
|
||||
return ResultUtil.success(ResultCode.COUPON_EDIT_STATUS_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.COUPON_EDIT_STATUS_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List<String> ids) {
|
||||
for (String id : ids) {
|
||||
couponService.deleteCoupon(id);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "会员优惠券作废")
|
||||
@PutMapping(value = "/member/cancellation/{id}")
|
||||
public ResultMessage<Object> cancellation(@PathVariable String id) {
|
||||
memberCouponService.cancellation(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("获取当前用户信息不存在");
|
||||
}
|
||||
couponVO.setStoreId("platform");
|
||||
couponVO.setStoreName("platform");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.vos.FullDiscountSearchParams;
|
||||
import cn.lili.modules.promotion.service.FullDiscountService;
|
||||
import cn.lili.modules.order.cart.entity.vo.FullDiscountVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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 paulG
|
||||
* @date 2021/1/12
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,满额活动接口")
|
||||
@RequestMapping("/manager/promotion/fullDiscount")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class FullDiscountManagerController {
|
||||
|
||||
private final FullDiscountService fullDiscountService;
|
||||
|
||||
@ApiOperation(value = "获取满优惠列表")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<FullDiscountVO>> getCouponList(FullDiscountSearchParams searchParams, PageVO page) {
|
||||
page.setNotConvert(true);
|
||||
return ResultUtil.data(fullDiscountService.getFullDiscountByPageFromMongo(searchParams, page));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取满优惠详情")
|
||||
@GetMapping("/{id}")
|
||||
public ResultMessage<FullDiscountVO> getCouponDetail(@PathVariable String id) {
|
||||
return ResultUtil.data(fullDiscountService.getFullDiscount(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取满优惠商品列表")
|
||||
@GetMapping("/goods/{id}")
|
||||
public ResultMessage<FullDiscountVO> getCouponGoods(@PathVariable String id) {
|
||||
return ResultUtil.data(fullDiscountService.getFullDiscount(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
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.dto.PromotionGoodsDTO;
|
||||
import cn.lili.modules.promotion.entity.enums.PromotionTypeEnum;
|
||||
import cn.lili.modules.promotion.entity.vos.PintuanSearchParams;
|
||||
import cn.lili.modules.promotion.entity.vos.PintuanVO;
|
||||
import cn.lili.modules.promotion.entity.vos.PromotionGoodsSearchParams;
|
||||
import cn.lili.modules.promotion.service.PintuanService;
|
||||
import cn.lili.modules.promotion.service.PromotionGoodsService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 管理端,平台拼团接口
|
||||
*
|
||||
* @author paulG
|
||||
* @date 2020/10/9
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,平台拼团接口")
|
||||
@RequestMapping("/manager/promotion/pintuan")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class PintuanManagerController {
|
||||
|
||||
private final PintuanService pintuanService;
|
||||
private final PromotionGoodsService promotionGoodsService;
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "通过id获取")
|
||||
public ResultMessage<Pintuan> get(@PathVariable String id) {
|
||||
Pintuan pintuan = pintuanService.getById(id);
|
||||
return ResultUtil.data(pintuan);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "根据条件分页查询拼团活动列表")
|
||||
public ResultMessage<IPage<PintuanVO>> getPintuanByPage(PintuanSearchParams queryParam, PageVO pageVo) {
|
||||
IPage<PintuanVO> pintuanByPageFromMongo = pintuanService.getPintuanByPageFromMongo(queryParam, pageVo);
|
||||
return ResultUtil.data(pintuanByPageFromMongo);
|
||||
}
|
||||
|
||||
@GetMapping("/goods/{pintuanId}")
|
||||
@ApiOperation(value = "根据条件分页查询拼团活动商品列表")
|
||||
public ResultMessage<IPage<PromotionGoodsDTO>> getPintuanGoodsByPage(@PathVariable String pintuanId, PageVO pageVo) {
|
||||
PromotionGoodsSearchParams searchParams = new PromotionGoodsSearchParams();
|
||||
searchParams.setPromotionId(pintuanId);
|
||||
searchParams.setPromotionType(PromotionTypeEnum.PINTUAN.name());
|
||||
IPage<PromotionGoodsDTO> promotionGoods = promotionGoodsService.getPromotionGoods(searchParams, pageVo);
|
||||
return ResultUtil.data(promotionGoods);
|
||||
}
|
||||
|
||||
@PutMapping("/open/{pintuanId}")
|
||||
@ApiOperation(value = "手动开启拼团活动")
|
||||
public ResultMessage<String> openPintuan(@PathVariable String pintuanId, Long startTime, Long endTime) {
|
||||
if (pintuanService.openPintuan(pintuanId, new Date(startTime), new Date(endTime))) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_MANUAL_OPEN_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_MANUAL_OPEN_ERROR);
|
||||
|
||||
}
|
||||
|
||||
@PutMapping("/close/{pintuanId}")
|
||||
@ApiOperation(value = "手动关闭拼团活动")
|
||||
public ResultMessage<String> closePintuan(@PathVariable String pintuanId) {
|
||||
if (pintuanService.closePintuan(pintuanId)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_MANUAL_CLOSE_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_MANUAL_CLOSE_ERROR);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 管理端,积分商品分类接口
|
||||
*
|
||||
* @author paulG
|
||||
* @date 2021/1/14
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,积分商品分类接口")
|
||||
@RequestMapping("/manager/promotion/pointsGoodsCategory")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class PointsGoodsCategoryManagerController {
|
||||
|
||||
private final PointsGoodsCategoryService pointsGoodsCategoryService;
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加积分商品分类")
|
||||
public ResultMessage<Object> add(PointsGoodsCategoryVO pointsGoodsCategory) {
|
||||
if (pointsGoodsCategoryService.addCategory(pointsGoodsCategory)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改积分商品分类")
|
||||
public ResultMessage<Object> update(PointsGoodsCategoryVO pointsGoodsCategory) {
|
||||
if (pointsGoodsCategoryService.updateCategory(pointsGoodsCategory)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除积分商品分类")
|
||||
public ResultMessage<Object> delete(@PathVariable String id) {
|
||||
if (pointsGoodsCategoryService.deleteCategory(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@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,97 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.vos.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,积分商品接口
|
||||
*
|
||||
* @author paulG
|
||||
* @date 2021/1/14
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,积分商品接口")
|
||||
@RequestMapping("/manager/promotion/pointsGoods")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class PointsGoodsManagerController {
|
||||
|
||||
private final PointsGoodsService pointsGoodsService;
|
||||
|
||||
@PostMapping(consumes = "application/json", produces = "application/json")
|
||||
@ApiOperation(value = "添加积分商品")
|
||||
public ResultMessage<Object> addPointsGoods(@RequestBody List<PointsGoodsVO> pointsGoodsList) {
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
List<PointsGoodsVO> collect = new ArrayList<>();
|
||||
for (PointsGoodsVO i : pointsGoodsList) {
|
||||
i.setStoreName("platform");
|
||||
i.setStoreId(currentUser.getId());
|
||||
collect.add(i);
|
||||
}
|
||||
if (pointsGoodsService.addPointsGoods(collect)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
@ApiOperation(value = "修改积分商品")
|
||||
public ResultMessage<Object> updatePointsGoods(@RequestBody PointsGoodsVO pointsGoods) {
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
pointsGoods.setStoreId(currentUser.getId());
|
||||
pointsGoods.setStoreName("platform");
|
||||
if (pointsGoodsService.updatePointsGoods(pointsGoods)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{ids}")
|
||||
@ApiOperation(value = "修改积分商品状态")
|
||||
public ResultMessage<Object> updatePointsGoodsStatus(@PathVariable String ids, String promotionStatus) {
|
||||
if (pointsGoodsService.updatePointsGoodsPromotionStatus(Arrays.asList(ids.split(",")), promotionStatus)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation(value = "删除积分商品")
|
||||
public ResultMessage<Object> delete(@PathVariable String ids) {
|
||||
if (pointsGoodsService.deletePointsGoods(Arrays.asList(ids.split(",")))) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "分页获取积分商品")
|
||||
public ResultMessage<IPage<PointsGoodsVO>> getPointsGoodsPage(PointsGoodsSearchParams searchParams, PageVO page) {
|
||||
IPage<PointsGoodsVO> pointsGoodsByPage = pointsGoodsService.getPointsGoodsByPage(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,52 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.dto.PromotionGoodsDTO;
|
||||
import cn.lili.modules.promotion.service.PromotionService;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date 2021/2/2
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,促销接口")
|
||||
@RequestMapping("/manager/promotion")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class PromotionManagerController {
|
||||
|
||||
private final PromotionService promotionService;
|
||||
|
||||
private final 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<PromotionGoodsDTO>> getPromotionGoods(@PathVariable String promotionId, String promotionType, PageVO pageVO) {
|
||||
IPage<PromotionGoodsDTO> promotionGoods = promotionGoodsService.getCurrentPromotionGoods(promotionType, pageVO);
|
||||
return ResultUtil.data(promotionGoods);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.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.enums.SeckillApplyStatusEnum;
|
||||
import cn.lili.modules.promotion.entity.vos.SeckillSearchParams;
|
||||
import cn.lili.modules.promotion.entity.vos.SeckillVO;
|
||||
import cn.lili.modules.promotion.service.SeckillApplyService;
|
||||
import cn.lili.modules.promotion.service.SeckillService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 管理端,限时抢购接口
|
||||
*
|
||||
* @author paulG
|
||||
* @date 2020/8/20
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,限时抢购接口")
|
||||
@RequestMapping("/manager/promotion/seckill")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class SeckillManagerController {
|
||||
|
||||
private final SeckillService seckillService;
|
||||
private final SeckillApplyService seckillApplyService;
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加限时抢购")
|
||||
public ResultMessage<Seckill> addSeckill(SeckillVO seckillVO) {
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
seckillVO.setStoreId(currentUser.getId());
|
||||
seckillVO.setStoreName(currentUser.getUsername());
|
||||
seckillVO.setSeckillApplyStatus(SeckillApplyStatusEnum.NOT_APPLY.name());
|
||||
if (seckillService.saveSeckill(seckillVO)) {
|
||||
return ResultUtil.data(seckillVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改限时抢购")
|
||||
public ResultMessage<Seckill> updateSeckill(SeckillVO seckillVO) {
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
seckillVO.setStoreId(currentUser.getId());
|
||||
seckillVO.setStoreName(currentUser.getUsername());
|
||||
if (seckillService.modifySeckill(seckillVO)) {
|
||||
return ResultUtil.data(seckillVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "通过id获取")
|
||||
public ResultMessage<Seckill> get(@PathVariable String id) {
|
||||
Seckill seckill = seckillService.getById(id);
|
||||
return ResultUtil.data(seckill);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "分页查询限时抢购列表")
|
||||
public ResultMessage<IPage<SeckillVO>> getAll(SeckillSearchParams param, PageVO pageVo) {
|
||||
pageVo.setNotConvert(true);
|
||||
IPage<SeckillVO> page = seckillService.getSeckillByPageFromMongo(param, pageVo);
|
||||
return ResultUtil.data(page);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除一个限时抢购")
|
||||
public ResultMessage<Object> deleteSeckill(@PathVariable String id) {
|
||||
seckillService.deleteSeckill(id);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@PutMapping("/close/{id}")
|
||||
@ApiOperation(value = "关闭一个限时抢购")
|
||||
public ResultMessage<Object> closeSeckill(@PathVariable String id) {
|
||||
seckillService.closeSeckill(id);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@PutMapping("/open/{id}")
|
||||
@ApiOperation(value = "一个限时抢购")
|
||||
public ResultMessage<Object> openSeckill(@PathVariable String id) {
|
||||
seckillService.openSeckill(id);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@GetMapping("/apply")
|
||||
@ApiOperation(value = "获取限时抢购申请列表")
|
||||
public ResultMessage<IPage<SeckillApply>> getSeckillApply(SeckillSearchParams param, PageVO pageVo) {
|
||||
IPage<SeckillApply> seckillApply = seckillApplyService.getSeckillApplyFromMongo(param, pageVo);
|
||||
return ResultUtil.data(seckillApply);
|
||||
}
|
||||
|
||||
@PutMapping("/apply/audit/{ids}")
|
||||
@ApiOperation(value = "审核多个限时抢购申请")
|
||||
public ResultMessage<Object> auditSeckillApply(@PathVariable String[] ids, String seckillId, String applyStatus, String failReason) {
|
||||
seckillApplyService.auditBatchApply(ids, seckillId, applyStatus, failReason);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package cn.lili.controller.purchase;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,采购接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date: 2020/11/16 10:06 下午
|
||||
*/
|
||||
@Api(tags = "管理端,采购接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/purchase")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class PurchaseManagerController {
|
||||
|
||||
/**
|
||||
* 采购单
|
||||
*/
|
||||
private final PurchaseOrderService purchaseOrderService;
|
||||
/**
|
||||
* 采购单报价
|
||||
*/
|
||||
private final 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) {
|
||||
|
||||
if (purchaseOrderService.close(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@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,78 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.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.AppVersionDO;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 管理端,app版本控制器
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2018-07-04 21:50:52
|
||||
*/
|
||||
@RestController
|
||||
@Api("管理端,app版本控制器")
|
||||
@RequestMapping("/manager/systems/app/version")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class AppVersionManagerController {
|
||||
|
||||
private final AppVersionService appVersionService;
|
||||
|
||||
|
||||
@ApiOperation(value = "查询app升级消息", response = AppVersionDO.class)
|
||||
@GetMapping
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "type", value = "APP类型", required = true, dataType = "type", paramType = "query")
|
||||
})
|
||||
public ResultMessage<IPage<AppVersionDO>> getByPage(PageVO page, String type) {
|
||||
return ResultUtil.data(this.appVersionService.page(PageUtil.initPage(page),
|
||||
new QueryWrapper<AppVersionDO>().eq(StringUtils.isNotEmpty(type), "type", type).orderByDesc("create_time")));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "添加app版本信息", response = AppVersionDO.class)
|
||||
@PostMapping
|
||||
public ResultMessage<Boolean> add(@Valid AppVersionDO appVersionDO) {
|
||||
return ResultUtil.data(this.appVersionService.save(appVersionDO));
|
||||
}
|
||||
|
||||
@PutMapping(value = "/{id}")
|
||||
@ApiOperation(value = "修改app版本信息", response = AppVersionDO.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String", paramType = "path")
|
||||
})
|
||||
public ResultMessage<Boolean> edit(@Valid AppVersionDO appVersionDO, @PathVariable String id) {
|
||||
if (appVersionService.getById(id) != null) {
|
||||
return ResultUtil.data(this.appVersionService.updateById(appVersionDO));
|
||||
}
|
||||
return ResultUtil.data(false);
|
||||
}
|
||||
|
||||
@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 (appVersionService.getById(id) != null) {
|
||||
return ResultUtil.data(this.appVersionService.removeById(id));
|
||||
}
|
||||
return ResultUtil.data(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.system.entity.dos.InstantDelivery;
|
||||
import cn.lili.modules.system.entity.plugin.ConfigItem;
|
||||
import cn.lili.modules.system.entity.vo.InstantDeliveryVO;
|
||||
import cn.lili.modules.system.service.InstantDeliveryService;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,即时配送接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date: 2020/11/17 7:56 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,即时配送接口")
|
||||
@RequestMapping("/manager/instant-delivery")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class InstantDeliveryManagerController {
|
||||
|
||||
private final InstantDeliveryService instantDeliveryService;
|
||||
|
||||
@GetMapping(value = "/getByPage")
|
||||
@ApiOperation(value = "分页获取")
|
||||
public ResultMessage<IPage<InstantDeliveryVO>> getByPage(PageVO page) {
|
||||
//查询数据
|
||||
IPage<InstantDelivery> data = instantDeliveryService.page(PageUtil.initPage(page));
|
||||
//组织数据结构
|
||||
IPage<InstantDeliveryVO> newData = instantDeliveryService.getInstantDeliveryPage(data, page);
|
||||
System.out.println();
|
||||
//返回数据
|
||||
return ResultUtil.data(newData);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改即时配送方案参数", response = InstantDeliveryVO.class)
|
||||
@PutMapping(value = "/{bean}/config")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "bean", value = "即时配送bean", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "config", value = "即时配送参数", required = true, dataType = "String", paramType = "body")
|
||||
})
|
||||
public ResultMessage<InstantDeliveryVO> edit(@PathVariable String bean, @RequestBody List<ConfigItem> config) {
|
||||
InstantDeliveryVO instantDeliveryVO = new InstantDeliveryVO();
|
||||
instantDeliveryVO.setDeliveryBean(bean);
|
||||
instantDeliveryVO.setConfigItems(config);
|
||||
return ResultUtil.data(this.instantDeliveryService.edit(instantDeliveryVO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取即时配送的配置", response = InstantDeliveryVO.class)
|
||||
@GetMapping("/{bean}")
|
||||
@ApiImplicitParam(name = "bean", value = "即时配送bean id", required = true, dataType = "String", paramType = "path")
|
||||
public ResultMessage<InstantDeliveryVO> getInstantDeliverySetting(@PathVariable String bean) {
|
||||
return ResultUtil.data(this.instantDeliveryService.getInstantDeliveryConfig(bean));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "开启即时配送方案", response = String.class)
|
||||
@PutMapping("/{bean}/open")
|
||||
@ApiImplicitParam(name = "bean", value = "bean", required = true, dataType = "String", paramType = "path")
|
||||
public ResultMessage<String> open(@PathVariable String bean) {
|
||||
this.instantDeliveryService.openInstantDelivery(bean);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "修改封面图片", response = String.class)
|
||||
@PutMapping("/{bean}/image")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "bean", value = "即时配送bean", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "images", value = "封面图片", required = true, dataType = "String", paramType = "query")
|
||||
})
|
||||
public ResultMessage<Boolean> open(@PathVariable String bean, String images) {
|
||||
InstantDelivery instantDelivery = this.instantDeliveryService.getOne(new QueryWrapper<InstantDelivery>().eq("delivery_bean", bean));
|
||||
if (instantDelivery != null) {
|
||||
instantDelivery.setImages(images);
|
||||
return ResultUtil.data(instantDeliveryService.updateById(instantDelivery));
|
||||
}
|
||||
return ResultUtil.data(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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
|
||||
* @date: 2020/11/17 7:56 下午
|
||||
*/
|
||||
@Slf4j
|
||||
@Transactional
|
||||
@RestController
|
||||
@Api(tags = "日志管理接口")
|
||||
@RequestMapping("/manager/log")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class LogManagerController {
|
||||
|
||||
private final SystemLogService systemLogService;
|
||||
|
||||
@GetMapping(value = "/getAllByPage")
|
||||
@ApiOperation(value = "分页获取全部")
|
||||
public ResultMessage<Object> getAllByPage(@RequestParam(required = false) Integer type,
|
||||
@RequestParam String key,
|
||||
String operatorName,
|
||||
SearchVO searchVo,
|
||||
PageVO pageVo) {
|
||||
try {
|
||||
return ResultUtil.data(systemLogService.queryLog(null, operatorName, key, searchVo, pageVo));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
public ResultMessage<Object> delByIds(@PathVariable List<String> ids) {
|
||||
systemLogService.deleteLog(ids);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation(value = "全部删除")
|
||||
public ResultMessage<Object> delAll() {
|
||||
systemLogService.flushAll();
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 管理端,物流公司接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date: 2020/11/17 7:56 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,物流公司接口")
|
||||
@RequestMapping("/manager/logistics")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class LogisticsManagerController {
|
||||
|
||||
private final 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(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
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 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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,会员站内信管理接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date: 2020/11/17 4:31 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员站内信管理API")
|
||||
@RequestMapping("/manager/member/notice")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class MemberNoticeManagerController {
|
||||
|
||||
private final 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(ResultCode.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(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
memberNoticeService.removeByIds(ids);
|
||||
return ResultUtil.success(ResultCode.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(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.SwitchEnum;
|
||||
import cn.lili.common.utils.BeanUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
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.RequiredArgsConstructor;
|
||||
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
|
||||
* @date: 2020/11/17 4:31 下午
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "管理端,会员站内信管理接口")
|
||||
@RequestMapping("/manager/noticeMessage")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class NoticeMessageManagerController {
|
||||
|
||||
private final 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);
|
||||
boolean result = noticeMessageService.updateById(noticeMessage);
|
||||
if (result) {
|
||||
return ResultUtil.data(noticeMessage);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
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);
|
||||
boolean result = noticeMessageService.updateById(messageTemplate);
|
||||
if (result) {
|
||||
return ResultUtil.data(messageTemplate);
|
||||
}
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
throw new ResourceNotFoundException(ResultCode.NOTICE_NOT_EXIST.message());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.base.service.RegionService;
|
||||
import cn.lili.modules.system.entity.dos.Region;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date 2020/12/2 10:40
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,行政地区管理接口")
|
||||
@RequestMapping("/manager/region")
|
||||
@Transactional
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class RegionManagerController {
|
||||
|
||||
private final RegionService regionService;
|
||||
|
||||
@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);
|
||||
if (regionService.updateById(region)) {
|
||||
return ResultUtil.data(region);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "增加地区")
|
||||
public ResultMessage<Region> save(@Valid Region region) {
|
||||
if (regionService.save(region)) {
|
||||
return ResultUtil.data(region);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@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(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,服务订阅消息接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date: 2020/11/17 4:33 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,服务订阅消息接口")
|
||||
@RequestMapping("/manager/admin/notice")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class ServiceNoticeManagerController {
|
||||
|
||||
private final 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");
|
||||
if (serviceNoticeService.saveOrUpdate(serviceNotice)) {
|
||||
return ResultUtil.data(serviceNotice);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新服务订阅消息")
|
||||
@PostMapping("/{id}")
|
||||
public ResultMessage<ServiceNotice> update(@PathVariable String id, ServiceNotice serviceNotice) {
|
||||
if (serviceNoticeService.saveOrUpdate(serviceNotice)) {
|
||||
return ResultUtil.data(serviceNotice);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除服务订阅消息")
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
serviceNoticeService.removeByIds(ids);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.base.aspect.DemoSite;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* 管理端,系统设置接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/26 15:53
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,系统设置接口")
|
||||
@RequestMapping("/manager/system/setting")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class SettingManagerController {
|
||||
|
||||
private final 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")
|
||||
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(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对配置进行过滤
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
||||
@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"
|
||||
)
|
||||
public ResultMessage settingGet(@PathVariable String key) {
|
||||
try {
|
||||
return createSetting(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表单
|
||||
* 这里主要包含一个配置对象为空,导致转换异常问题的处理,解决配置项增加减少,带来的系统异常,无法直接配置
|
||||
*
|
||||
* @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));
|
||||
default:
|
||||
return ResultUtil.error(ResultCode.SETTING_NOT_TO_SET);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 管理端,系统设置扩展接口
|
||||
* 对一些系统设置的支持,例如动态表单等
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/26 15:53
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,系统设置扩展接口")
|
||||
@RequestMapping("/manager/system/settingx")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class SettingXManagerController {
|
||||
|
||||
@ApiOperation(value = "支持支付方式表单")
|
||||
@GetMapping("/paymentSupport")
|
||||
public ResultMessage<PaymentSupportForm> paymentForm() {
|
||||
return ResultUtil.data(new PaymentSupportForm());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.message.entity.dos.SmsReach;
|
||||
import cn.lili.modules.message.service.SmsReachService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,短信接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/1/30 4:09 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,短信接口")
|
||||
@RequestMapping("/manager/sms")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class SmsManagerController {
|
||||
|
||||
private final SmsReachService smsReachService;
|
||||
|
||||
@ApiOperation(value = "接口批量发送短信")
|
||||
@PostMapping
|
||||
public ResultMessage<Object> sendBatchSms(SmsReach smsReach, @RequestParam(value = "mobile") List<String> mobile) {
|
||||
smsReachService.addSmsReach(smsReach,mobile);
|
||||
return ResultUtil.success(ResultCode.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,76 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.message.entity.dos.SmsSign;
|
||||
import cn.lili.modules.message.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 管理端,短信签名接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date: 2021/1/30 4:09 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,短信签名接口")
|
||||
@RequestMapping("/manager/sms/sign")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class SmsSignManagerController {
|
||||
private final SmsSignService smsSignService;
|
||||
|
||||
|
||||
@ApiOperation(value = "新增短信签名")
|
||||
@PostMapping
|
||||
public ResultMessage<SmsSign> save(@Valid SmsSign smsSign) {
|
||||
smsSignService.addSmsSign(smsSign);
|
||||
return ResultUtil.success(ResultCode.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(ResultCode.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(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改短信签名")
|
||||
@PutMapping("/modifySmsSign")
|
||||
public ResultMessage<SmsSign> modifySmsSign(@Valid SmsSign smsSign) {
|
||||
smsSignService.modifySmsSign(smsSign);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询短信签名分页")
|
||||
@GetMapping("/querySmsSignPage")
|
||||
public ResultMessage<IPage<SmsSign>> querySmsSignPage(PageVO page, Integer signStatus) {
|
||||
return ResultUtil.data(smsSignService.page(page, signStatus));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.message.entity.dos.SmsTemplate;
|
||||
import cn.lili.modules.message.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 管理端,短信模板接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/1/30 4:09 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,短信模板接口")
|
||||
@RequestMapping("/manager/sms/template")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class SmsTemplateManagerController {
|
||||
private final SmsTemplateService smsTemplateService;
|
||||
|
||||
@ApiOperation(value = "新增短信模板")
|
||||
@PostMapping
|
||||
public ResultMessage<SmsTemplate> save(@Valid SmsTemplate smsTemplate) {
|
||||
smsTemplateService.addSmsTemplate(smsTemplate);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除短信模板")
|
||||
@ApiImplicitParam(name = "id", value = "短信模板ID", required = true, paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public ResultMessage<SmsTemplate> delete(@PathVariable("id") String id) {
|
||||
smsTemplateService.deleteSmsTemplate(id);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询短信模板状态")
|
||||
@PutMapping("/querySmsSign")
|
||||
public ResultMessage<SmsTemplate> querySmsSign() {
|
||||
smsTemplateService.querySmsTemplate();
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改短信模板")
|
||||
@PutMapping("/modifySmsTemplate")
|
||||
public ResultMessage<SmsTemplate> modifySmsTemplate(@Valid SmsTemplate smsTemplate) {
|
||||
smsTemplateService.modifySmsTemplate(smsTemplate);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询短信模板分页")
|
||||
@GetMapping("/querySmsTemplatePage")
|
||||
public ResultMessage<IPage<SmsTemplate>> querySmsTemplatePage(PageVO page, Integer templateStatus) {
|
||||
return ResultUtil.data(smsTemplateService.page(page,templateStatus));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.message.entity.dos.WechatMPMessage;
|
||||
import cn.lili.modules.message.service.WechatMPMessageService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class WechatMPMessageManagerController {
|
||||
|
||||
private final WechatMPMessageService wechatMPMessageService;
|
||||
|
||||
@GetMapping(value = "/init")
|
||||
@ApiOperation(value = "初始化微信小程序消息订阅")
|
||||
public ResultMessage init() {
|
||||
wechatMPMessageService.init();
|
||||
return ResultUtil.success(ResultCode.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) {
|
||||
|
||||
if (wechatMPMessageService.save(wechatMPMessage)) {
|
||||
return new ResultUtil<WechatMPMessage>().setData(wechatMPMessage);
|
||||
}
|
||||
return new ResultUtil<WechatMPMessage>().setErrorMsg(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation(value = "更新微信小程序消息订阅")
|
||||
public ResultMessage<WechatMPMessage> update(@PathVariable String id, WechatMPMessage wechatMPMessage) {
|
||||
if (wechatMPMessageService.updateById(wechatMPMessage)) {
|
||||
return new ResultUtil<WechatMPMessage>().setData(wechatMPMessage);
|
||||
}
|
||||
return new ResultUtil<WechatMPMessage>().setErrorMsg(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ApiOperation(value = "删除微信小程序消息订阅")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
|
||||
wechatMPMessageService.removeByIds(ids);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.message.entity.dos.WechatMessage;
|
||||
import cn.lili.modules.message.service.WechatMessageService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,微信消息接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/12/2 10:40
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,微信消息接口")
|
||||
@RequestMapping("/manager/message/wechat")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class WechatMessageManageController {
|
||||
|
||||
private final WechatMessageService wechatMessageService;
|
||||
|
||||
|
||||
@GetMapping(value = "/init")
|
||||
@ApiOperation(value = "初始化微信消息")
|
||||
public ResultMessage init() {
|
||||
wechatMessageService.init();
|
||||
return ResultUtil.success(ResultCode.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) {
|
||||
|
||||
if (wechatMessageService.save(wechatMessage)) {
|
||||
return ResultUtil.data(wechatMessage);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation(value = "更新微信消息")
|
||||
public ResultMessage<WechatMessage> update(@PathVariable String id, WechatMessage wechatMessage) {
|
||||
if (wechatMessageService.updateById(wechatMessage)) {
|
||||
return ResultUtil.data(wechatMessage);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ApiOperation(value = "删除微信消息")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {
|
||||
wechatMessageService.removeByIds(ids);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.statistics.model.dto.GoodsStatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.model.vo.CategoryStatisticsDataVO;
|
||||
import cn.lili.modules.statistics.model.vo.GoodsStatisticsDataVO;
|
||||
import cn.lili.modules.statistics.service.GoodsStatisticsDataService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date: 2020/12/9 19:04
|
||||
*/
|
||||
@Api(tags = "管理端,商品统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/statistics/goods")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class GoodsStatisticsManagerController {
|
||||
|
||||
private final GoodsStatisticsDataService goodsStatisticsDataService;
|
||||
|
||||
@ApiOperation(value = "获取统计列表,排行前一百的数据")
|
||||
@GetMapping
|
||||
public ResultMessage<List<GoodsStatisticsDataVO>> getByPage(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
|
||||
try {
|
||||
return ResultUtil.data(goodsStatisticsDataService.getGoodsStatisticsData(goodsStatisticsQueryParam, 100));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取行业统计列表")
|
||||
@GetMapping("/getCategoryByPage")
|
||||
public ResultMessage<List<CategoryStatisticsDataVO>> getCategoryByPage(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
|
||||
return ResultUtil.data(goodsStatisticsDataService.getCategoryStatisticsData(goodsStatisticsQueryParam));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.statistics.model.vo.GoodsStatisticsDataVO;
|
||||
import cn.lili.modules.statistics.model.vo.IndexNoticeVO;
|
||||
import cn.lili.modules.statistics.model.vo.IndexStatisticsVO;
|
||||
import cn.lili.modules.statistics.model.vo.StoreStatisticsDataVO;
|
||||
import cn.lili.modules.statistics.service.IndexStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date: 2020/12/15 17:53
|
||||
*/
|
||||
@Api(tags = "管理端,首页统计数据接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/statistics/index")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class IndexStatisticsManagerController {
|
||||
|
||||
/**
|
||||
* 首页统计
|
||||
*/
|
||||
private final IndexStatisticsService indexStatisticsService;
|
||||
|
||||
@ApiOperation(value = "获取首页查询数据")
|
||||
@GetMapping
|
||||
public ResultMessage<IndexStatisticsVO> index() {
|
||||
try {
|
||||
return ResultUtil.data(indexStatisticsService.indexStatistics());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取首页查询热卖商品TOP10")
|
||||
@GetMapping("/goodsStatistics")
|
||||
public ResultMessage<List<GoodsStatisticsDataVO>> goodsStatistics() {
|
||||
return ResultUtil.data(indexStatisticsService.goodsStatisticsOfMonth());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取首页查询热卖店铺TOP10")
|
||||
@GetMapping("/storeStatistics")
|
||||
public ResultMessage<List<StoreStatisticsDataVO>> storeStatistics() {
|
||||
return ResultUtil.data(indexStatisticsService.storeStatisticsOfMonth());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通知提示信息")
|
||||
@GetMapping("/notice")
|
||||
public ResultMessage<IndexNoticeVO> notice() {
|
||||
return ResultUtil.data(indexStatisticsService.indexNotice());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.statistics.model.dos.MemberStatisticsData;
|
||||
import cn.lili.modules.statistics.model.dto.StatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.service.MemberStatisticsDataService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date: 2020/12/9 19:04
|
||||
*/
|
||||
@Api(tags = "管理端,会员统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/statistics/member")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class MemberStatisticsManagerController {
|
||||
|
||||
private final MemberStatisticsDataService memberStatisticsDataService;
|
||||
|
||||
@ApiOperation(value = "获取会员统计")
|
||||
@GetMapping
|
||||
public ResultMessage<List<MemberStatisticsData>> getByList(StatisticsQueryParam statisticsQueryParam) {
|
||||
return ResultUtil.data(memberStatisticsDataService.statistics(statisticsQueryParam));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.order.order.entity.dos.AfterSale;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
|
||||
import cn.lili.modules.order.order.service.AfterSaleService;
|
||||
import cn.lili.modules.order.order.service.OrderService;
|
||||
import cn.lili.modules.statistics.model.dto.StatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.model.vo.OrderOverviewVO;
|
||||
import cn.lili.modules.statistics.model.vo.OrderStatisticsDataVO;
|
||||
import cn.lili.modules.statistics.service.OrderStatisticsDataService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date: 2020/12/9 19:04
|
||||
*/
|
||||
@Api(tags = "管理端,订单统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/statistics/order")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class OrderStatisticsManagerController {
|
||||
|
||||
private final OrderStatisticsDataService orderStatisticsDataService;
|
||||
|
||||
private final OrderService orderService;
|
||||
|
||||
private final AfterSaleService afterSaleService;
|
||||
|
||||
@ApiOperation(value = "订单概览统计")
|
||||
@GetMapping("/overview")
|
||||
public ResultMessage<OrderOverviewVO> overview(StatisticsQueryParam statisticsQueryParam) {
|
||||
try {
|
||||
return ResultUtil.data(orderStatisticsDataService.overview(statisticsQueryParam));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "订单图表统计")
|
||||
@GetMapping
|
||||
public ResultMessage<List<OrderStatisticsDataVO>> statisticsChart(StatisticsQueryParam statisticsQueryParam) {
|
||||
try {
|
||||
return ResultUtil.data(orderStatisticsDataService.statisticsChart(statisticsQueryParam));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "订单统计")
|
||||
@GetMapping("/order")
|
||||
public ResultMessage<IPage<OrderSimpleVO>> order(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {
|
||||
try {
|
||||
return ResultUtil.data(orderService.getStatistics(statisticsQueryParam, pageVO));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "退单统计")
|
||||
@GetMapping("/refund")
|
||||
public ResultMessage<IPage<AfterSale>> refund(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {
|
||||
return ResultUtil.data(afterSaleService.getStatistics(statisticsQueryParam, pageVO));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.statistics.model.dto.StatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.model.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 lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date: 2020/12/9 19:04
|
||||
*/
|
||||
@Api(tags = "管理端,退款统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/statistics/refund/order")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class RefundOrderStatisticsManagerController {
|
||||
|
||||
private final 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,59 @@
|
||||
package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.vo.MemberDistributionVO;
|
||||
import cn.lili.modules.statistics.model.dto.StatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.model.vo.OnlineMemberVO;
|
||||
import cn.lili.modules.statistics.model.vo.PlatformViewVO;
|
||||
import cn.lili.modules.statistics.service.PlatformViewDataService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date 2021/2/9 11:19
|
||||
*/
|
||||
@Api(tags = "管理端,流量统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/statistics/view")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class ViewStatisticsManagerController {
|
||||
|
||||
private final PlatformViewDataService platformViewDataService;
|
||||
|
||||
@ApiOperation(value = "流量数据 表单获取")
|
||||
@GetMapping("/list")
|
||||
public ResultMessage<List<PlatformViewVO>> getByPage(StatisticsQueryParam queryParam) {
|
||||
return ResultUtil.data(platformViewDataService.list(queryParam));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "当前在线人数")
|
||||
@GetMapping("/online/current")
|
||||
public ResultMessage<Long> currentNumberPeopleOnline() {
|
||||
return ResultUtil.data(platformViewDataService.online());
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "会员分布")
|
||||
@GetMapping("/online/distribution")
|
||||
public ResultMessage<List<MemberDistributionVO>> memberDistribution() {
|
||||
return ResultUtil.data(platformViewDataService.memberDistribution());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "在线人数历史(默认48小时)")
|
||||
@GetMapping("/online/history")
|
||||
public ResultMessage<List<OnlineMemberVO>> history() {
|
||||
return ResultUtil.data(platformViewDataService.statisticsOnline());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.lili.controller.store;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 管理端,商家结算单接口
|
||||
*
|
||||
* @author Chopper
|
||||
* @date: 2020/11/17 7:23 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,商家结算单接口")
|
||||
@RequestMapping("/manager/store/bill")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class BillManagerController {
|
||||
|
||||
private final BillService billService;
|
||||
|
||||
@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(billService.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) {
|
||||
if (billService.complete(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package cn.lili.controller.store;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.vos.CategoryVO;
|
||||
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.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,店铺管理接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2020/12/6 16:09
|
||||
*/
|
||||
@Api(tags = "管理端,店铺管理接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/store")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class StoreManagerController {
|
||||
|
||||
/**
|
||||
* 店铺
|
||||
*/
|
||||
private final StoreService storeService;
|
||||
/**
|
||||
* 店铺详情
|
||||
*/
|
||||
private final 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(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "关闭店铺")
|
||||
@ApiImplicitParam(name = "id", value = "店铺id", required = true, dataType = "String", paramType = "path")
|
||||
@PutMapping(value = "/disable/{id}")
|
||||
public ResultMessage<Store> disable(@PathVariable String id) {
|
||||
if (storeService.disable(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "开启店铺")
|
||||
@ApiImplicitParam(name = "id", value = "店铺id", required = true, dataType = "String", paramType = "path")
|
||||
@PutMapping(value = "/enable/{id}")
|
||||
public ResultMessage<Store> enable(@PathVariable String id) {
|
||||
if (storeService.enable(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询一级分类列表")
|
||||
@ApiImplicitParam(name = "storeId", value = "店铺id", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/ManagementCategory/{storeId}")
|
||||
public ResultMessage<List<CategoryVO>> firstCategory(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,44 @@
|
||||
package cn.lili.controller.store;
|
||||
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date: 2020/12/6 16:09
|
||||
*/
|
||||
@Transactional
|
||||
@RestController
|
||||
@Api(tags = "管理端,店铺消息消息管理接口")
|
||||
@RequestMapping("/manager/message/store")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class StoreMessageManagerController {
|
||||
|
||||
private final 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,70 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.order.order.entity.dos.AfterSale;
|
||||
import cn.lili.modules.order.order.entity.vo.AfterSaleSearchParams;
|
||||
import cn.lili.modules.order.order.entity.vo.AfterSaleVO;
|
||||
import cn.lili.modules.order.order.service.AfterSaleService;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 管理端,售后接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/1/6 14:11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manager/afterSale")
|
||||
@Api(tags = "管理端,售后接口")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class AfterSaleManagerController {
|
||||
|
||||
/**
|
||||
* 售后
|
||||
*/
|
||||
private final AfterSaleService afterSaleService;
|
||||
|
||||
@ApiOperation(value = "分页获取售后服务")
|
||||
@GetMapping(value = "/page")
|
||||
public ResultMessage<IPage<AfterSaleVO>> getByPage(AfterSaleSearchParams searchParams) {
|
||||
return ResultUtil.data(afterSaleService.getAfterSalePages(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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.order.order.entity.dos.AfterSaleReason;
|
||||
import cn.lili.modules.order.order.service.AfterSaleReasonService;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 管理端,售后原因接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/1/6 14:11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manager/afterSaleReason")
|
||||
@Api(tags = "管理端,售后原因接口")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class AfterSaleReasonManagerController {
|
||||
|
||||
/**
|
||||
* 售后原因
|
||||
*/
|
||||
private final 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(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 管理端,交易投诉接口
|
||||
*
|
||||
* @author paulG
|
||||
* @date: 2020/12/5
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,交易投诉接口")
|
||||
@RequestMapping("/manager/complain")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class OrderComplaintManagerController {
|
||||
|
||||
/**
|
||||
* 交易投诉
|
||||
*/
|
||||
private final OrderComplaintService orderComplaintService;
|
||||
|
||||
/**
|
||||
* 交易投诉沟通
|
||||
*/
|
||||
private final 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) {
|
||||
if (orderComplaintService.updateOrderComplain(orderComplainVO)) {
|
||||
return ResultUtil.data(orderComplainVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@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());
|
||||
if (orderComplaintCommunicationService.addCommunication(communicationVO)) {
|
||||
return ResultUtil.data(communicationVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改状态")
|
||||
@PutMapping(value = "/status")
|
||||
public ResultMessage<Object> updateStatus(OrderComplaintOperationParams orderComplainVO) {
|
||||
if (orderComplaintService.updateOrderComplainByStatus(orderComplainVO) != null) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
@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());
|
||||
|
||||
//修改状态
|
||||
if (orderComplaintService.updateOrderComplainByStatus(orderComplaintOperationParams) != null) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date 2020/11/17 4:34 下午
|
||||
*/
|
||||
@Transactional
|
||||
@RestController
|
||||
@Api(tags = "管理端,订单日志管理接口")
|
||||
@RequestMapping("/manager/orderLog")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class OrderLogManagerController {
|
||||
|
||||
private final 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,97 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.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.OrderSearchParams;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
|
||||
import cn.lili.modules.order.order.service.OrderPriceService;
|
||||
import cn.lili.modules.order.order.service.OrderService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.NotNull;
|
||||
|
||||
/**
|
||||
* 管理端,订单API
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 4:34 下午
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manager/orders")
|
||||
@Api(tags = "管理端,订单API")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class OrderManagerController {
|
||||
|
||||
//订单
|
||||
private final OrderService orderService;
|
||||
//订单价格
|
||||
private final OrderPriceService orderPriceService;
|
||||
|
||||
|
||||
@ApiOperation(value = "查询订单列表分页")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<OrderSimpleVO>> queryMineOrder(OrderSearchParams orderSearchParams) {
|
||||
return ResultUtil.data(orderService.queryByParams(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));
|
||||
}
|
||||
|
||||
|
||||
@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(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
|
||||
|
||||
@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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.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.payment.service.PaymentService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date 2020/11/17 4:34 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,收款日志接口")
|
||||
@RequestMapping("/manager/paymentLog")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class PaymentLogManagerController {
|
||||
|
||||
private final PaymentService paymentService;
|
||||
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "分页获取支付日志")
|
||||
public ResultMessage<IPage<PaymentLog>> getByPage(Order order,
|
||||
SearchVO searchVo,
|
||||
PageVO page) {
|
||||
return ResultUtil.data(paymentService.page(PageUtil.initPage(page), PageUtil.initWrapper(order, searchVo)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.utils.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 lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date 2020/11/17 4:34 下午
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,发票记录接口")
|
||||
@RequestMapping("/manager/receipt")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class ReceiptManagerController {
|
||||
|
||||
private final 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,41 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.order.trade.entity.dos.Recharge;
|
||||
import cn.lili.modules.order.trade.entity.vo.RechargeQueryVO;
|
||||
import cn.lili.modules.order.trade.service.RechargeService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 管理端,预存款充值记录接口
|
||||
*
|
||||
* @author pikachu
|
||||
* @date: 2020/11/16 10:07 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,预存款充值记录接口")
|
||||
@RequestMapping("/manager/recharge")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class RechargeManagerController {
|
||||
|
||||
private final 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,48 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date: 2020/11/16 10:07 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,退款日志接口")
|
||||
@RequestMapping("/manager/refundLog")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class RefundLogManagerController {
|
||||
|
||||
private final 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,41 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.order.trade.entity.dos.WalletLog;
|
||||
import cn.lili.modules.order.trade.entity.vo.DepositQueryVO;
|
||||
import cn.lili.modules.order.trade.service.WalletLogService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date: 2020/11/16 10:07 下午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,预存款充值记录接口")
|
||||
@RequestMapping("/manager/wallet/log")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class WalletLogManagerController {
|
||||
|
||||
private final 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);
|
||||
}
|
||||
}
|
||||
136
manager-api/src/main/java/cn/lili/security/ManagerAuthenticationFilter.java
Executable file
136
manager-api/src/main/java/cn/lili/security/ManagerAuthenticationFilter.java
Executable file
@@ -0,0 +1,136 @@
|
||||
package cn.lili.security;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.lili.common.cache.Cache;
|
||||
import cn.lili.common.cache.CachePrefix;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.enums.SecurityEnum;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.token.SecretKeyUtil;
|
||||
import cn.lili.common.utils.ResponseUtil;
|
||||
import com.google.gson.Gson;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.ExpiredJwtException;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
|
||||
|
||||
import javax.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;
|
||||
|
||||
/**
|
||||
* @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);
|
||||
//自定义权限过滤
|
||||
customAuthentication(request, response, authentication);
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义权限过滤
|
||||
*
|
||||
* @param request
|
||||
* @param authentication
|
||||
*/
|
||||
private void customAuthentication(HttpServletRequest request, HttpServletResponse response, UsernamePasswordAuthenticationToken authentication) throws NoPermissionException {
|
||||
AuthUser authUser = (AuthUser) authentication.getDetails();
|
||||
Map<String, List<String>> permission = (Map<String, List<String>>) cache.get(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.MANAGER) + authUser.getId());
|
||||
if (authUser.getIsSuper()) {
|
||||
return;
|
||||
} else {
|
||||
//用户是否拥有权限判定œ
|
||||
//获取数据权限
|
||||
// if (request.getMethod().equals(RequestMethod.GET.name())) {
|
||||
// if (!PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.SUPER).toArray(new String[0]), request.getRequestURI()) ||
|
||||
// PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.QUERY).toArray(new String[0]), request.getRequestURI())) {
|
||||
//
|
||||
// ResponseUtil.output(response, ResponseUtil.resultMap(false, 401, "抱歉,您没有访问权限"));
|
||||
// throw new NoPermissionException("权限不足");
|
||||
// }
|
||||
// } else {
|
||||
// if (!PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.SUPER).toArray(new String[0]), request.getRequestURI())) {
|
||||
//
|
||||
// ResponseUtil.output(response, ResponseUtil.resultMap(false, 401, "抱歉,您没有访问权限"));
|
||||
// throw new NoPermissionException("权限不足");
|
||||
// }
|
||||
// }
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取token信息
|
||||
*
|
||||
* @param jwt
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
private UsernamePasswordAuthenticationToken getAuthentication(String jwt, HttpServletResponse response) {
|
||||
|
||||
try {
|
||||
Claims claims
|
||||
= Jwts.parser()
|
||||
.setSigningKey(SecretKeyUtil.generalKeyByDecoders())
|
||||
.parseClaimsJws(jwt).getBody();
|
||||
//获取存储在claims中的用户信息
|
||||
String json = claims.get(SecurityEnum.USER_CONTEXT.getValue()).toString();
|
||||
AuthUser authUser = new Gson().fromJson(json, AuthUser.class);
|
||||
|
||||
// 校验redis中是否有权限
|
||||
if (cache.hasKey(CachePrefix.ACCESS_TOKEN.getPrefix(UserEnums.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("user analysis exception:", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.lili.security;
|
||||
|
||||
import cn.lili.common.cache.Cache;
|
||||
import cn.lili.common.security.CustomAccessDeniedHandler;
|
||||
import cn.lili.config.properties.IgnoredUrlsProperties;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
* @date 2020/11/14 16:20
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class ManagerSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
|
||||
/**
|
||||
* 忽略验权配置
|
||||
*/
|
||||
private final IgnoredUrlsProperties ignoredUrlsProperties;
|
||||
|
||||
/**
|
||||
* spring security -》 权限不足处理
|
||||
*/
|
||||
private final CustomAccessDeniedHandler accessDeniedHandler;
|
||||
|
||||
|
||||
private final Cache<String> cache;
|
||||
|
||||
private final CorsConfigurationSource corsConfigurationSource;
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
|
||||
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = http
|
||||
.authorizeRequests();
|
||||
// 配置的url 不需要授权
|
||||
for (String url : ignoredUrlsProperties.getUrls()) {
|
||||
log.error(url);
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
302
manager-api/src/main/resources/application.yml
Normal file
302
manager-api/src/main/resources/application.yml
Normal file
@@ -0,0 +1,302 @@
|
||||
server:
|
||||
port: 8887
|
||||
|
||||
servlet:
|
||||
context-path: /
|
||||
|
||||
# 正式部署时候,解开此处配置,防止文件夹被清除导致的文件上传失败问题
|
||||
# multipart:
|
||||
# location: /Users/lifenlong/Desktop/ceshi
|
||||
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: 127.0.0.1
|
||||
port: 27017
|
||||
database: lilishop
|
||||
username: root
|
||||
password: lilishop
|
||||
authentication-database: admin
|
||||
# replica-set-name: mongoreplset
|
||||
cache:
|
||||
type: redis
|
||||
|
||||
jpa:
|
||||
# 自动生成表结构
|
||||
generate-ddl: true
|
||||
open-in-view: false
|
||||
# Redis
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: lilishop
|
||||
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://127.0.0.1:3306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: lilishop
|
||||
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.config.sharding.CreateTimeShardingTableAlgorithm
|
||||
# #范围查询实现
|
||||
# range-algorithm-class-name: cn.lili.config.sharding.CreateTimeShardingTableAlgorithm
|
||||
props:
|
||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||
sql:
|
||||
show: true
|
||||
|
||||
# 忽略鉴权url
|
||||
ignored:
|
||||
urls:
|
||||
- /editor-app/**
|
||||
- /actuator**
|
||||
- /actuator/**
|
||||
- /MP_verify_qSyvBPhDsPdxvOhC.txt
|
||||
- /weixin/**
|
||||
- /source/**
|
||||
- /buyer/mini-program/**
|
||||
- /buyer/cashier/**
|
||||
- /buyer/pageData/**
|
||||
- /buyer/article/**
|
||||
- /buyer/goods/**
|
||||
- /buyer/category/**
|
||||
- /buyer/shop/**
|
||||
- /buyer/connect/**
|
||||
- /buyer/members/smsLogin
|
||||
- /buyer/members/refresh/*
|
||||
- /buyer/members/refresh**
|
||||
- /buyer/promotion/pintuan
|
||||
- /buyer/promotion/seckill
|
||||
- /buyer/memberEvaluation/**/goodsEvaluation
|
||||
- /buyer/memberEvaluation/**/evaluationNumber
|
||||
- /store/login/**
|
||||
- /manager/user/login
|
||||
- /manager/user/refresh/**
|
||||
- /manager/elasticsearch
|
||||
- /druid/**
|
||||
- /swagger-ui.html
|
||||
- /doc.html
|
||||
- /swagger-resources/**
|
||||
- /swagger/**
|
||||
- /**/**.js
|
||||
- /**/**.png
|
||||
- /**/**.css
|
||||
- /webjars/**
|
||||
- /v2/api-docs
|
||||
- /configuration/ui
|
||||
- /boot-admin
|
||||
statics:
|
||||
- /**/*.js
|
||||
- /**/*.css
|
||||
- /**/*.png
|
||||
- /**/*.ico
|
||||
|
||||
# Swagger界面内容配置
|
||||
swagger:
|
||||
title: lili API接口文档
|
||||
description: lili Api Documentation
|
||||
version: 1.0.0
|
||||
termsOfServiceUrl: https://pickmall.cn
|
||||
contact:
|
||||
name: lili
|
||||
url: https://pickmall.cn
|
||||
email: admin@pickmall.com
|
||||
|
||||
# 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: true
|
||||
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: 127.0.0.1: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: 127.0.0.1:9876
|
||||
producer:
|
||||
group: lili_group
|
||||
send-message-timeout: 30000
|
||||
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
addresses: http://127.0.0.1:9001/xxl-job-admin
|
||||
executor:
|
||||
appname: xxl-job-executor-lilishop
|
||||
address:
|
||||
ip:
|
||||
port: 8891
|
||||
logpath: ./xxl-job/executor
|
||||
logretentiondays: 7
|
||||
19
manager-api/src/main/resources/banner.txt
Normal file
19
manager-api/src/main/resources/banner.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
___ ___ ___ ___ ________ ________ _______ ________ _____ ______ ___ __ ________ ________ ___ __
|
||||
|\ \ |\ \|\ \ |\ \ |\ _____\\ __ \|\ ___ \ |\ __ \|\ _ \ _ \|\ \ |\ \|\ __ \|\ __ \|\ \|\ \
|
||||
\ \ \ \ \ \ \ \ \ \ \ ____________\ \ \__/\ \ \|\ \ \ __/|\ \ \|\ \ \ \\\__\ \ \ \ \ \ \ \ \ \|\ \ \ \|\ \ \ \/ /|_
|
||||
\ \ \ \ \ \ \ \ \ \ \|\____________\ \ __\\ \ _ _\ \ \_|/_\ \ __ \ \ \\|__| \ \ \ \ __\ \ \ \ \\\ \ \ _ _\ \ ___ \
|
||||
\ \ \____\ \ \ \ \____\ \ \|____________|\ \ \_| \ \ \\ \\ \ \_|\ \ \ \ \ \ \ \ \ \ \ \ \|\__\_\ \ \ \\\ \ \ \\ \\ \ \\ \ \
|
||||
\ \_______\ \__\ \_______\ \__\ \ \__\ \ \__\\ _\\ \_______\ \__\ \__\ \__\ \ \__\ \____________\ \_______\ \__\\ _\\ \__\\ \__\
|
||||
\|_______|\|__|\|_______|\|__| \|__| \|__|\|__|\|_______|\|__|\|__|\|__| \|__|\|____________|\|_______|\|__|\|__|\|__| \|__|
|
||||
|
||||
|
||||
|
||||
___ ___ ___ ___ ________ ___ ___ ________ ________
|
||||
|\ \ |\ \|\ \ |\ \ |\ ____\|\ \|\ \|\ __ \|\ __ \
|
||||
\ \ \ \ \ \ \ \ \ \ \ ____________\ \ \___|\ \ \\\ \ \ \|\ \ \ \|\ \
|
||||
\ \ \ \ \ \ \ \ \ \ \|\____________\ \_____ \ \ __ \ \ \\\ \ \ ____\
|
||||
\ \ \____\ \ \ \ \____\ \ \|____________|\|____|\ \ \ \ \ \ \ \\\ \ \ \___|
|
||||
\ \_______\ \__\ \_______\ \__\ ____\_\ \ \__\ \__\ \_______\ \__\
|
||||
\|_______|\|__|\|_______|\|__| |\_________\|__|\|__|\|_______|\|__|
|
||||
\|_________|
|
||||
|
||||
126
manager-api/src/test/java/cn/lili/test/CacheTest/CacheTest.java
Normal file
126
manager-api/src/test/java/cn/lili/test/CacheTest/CacheTest.java
Normal file
@@ -0,0 +1,126 @@
|
||||
package cn.lili.test.CacheTest;
|
||||
|
||||
import cn.lili.common.cache.Cache;
|
||||
import cn.lili.common.cache.CachePrefix;
|
||||
import cn.lili.modules.statistics.util.StatisticsSuffix;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
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.junit4.SpringRunner;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Chopper
|
||||
* @version v1.0
|
||||
* @Description:
|
||||
* @since v7.0
|
||||
* 2021/1/15 16:25
|
||||
*/
|
||||
@RunWith(SpringRunner.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);
|
||||
}
|
||||
|
||||
}
|
||||
258
manager-api/src/test/java/cn/lili/test/elasticsearch/EsTest.java
Normal file
258
manager-api/src/test/java/cn/lili/test/elasticsearch/EsTest.java
Normal file
@@ -0,0 +1,258 @@
|
||||
package cn.lili.test.elasticsearch;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
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.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2020/10/14
|
||||
**/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
class EsTest {
|
||||
|
||||
@Autowired
|
||||
private EsGoodsIndexService esGoodsIndexService;
|
||||
|
||||
@Autowired
|
||||
private EsGoodsIndexRepository goodsIndexRepository;
|
||||
|
||||
@Autowired
|
||||
private EsGoodsSearchService goodsSearchService;
|
||||
|
||||
@Autowired
|
||||
private GoodsSkuService goodsSkuService;
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Autowired
|
||||
private PromotionService promotionService;
|
||||
|
||||
|
||||
@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);
|
||||
Page<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::getIsAuth, 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);
|
||||
Map<String, Object> goodsCurrentPromotionMap = promotionService.getGoodsCurrentPromotionMap(index);
|
||||
index.setPromotionMap(goodsCurrentPromotionMap);
|
||||
esGoodsIndices.add(index);
|
||||
stringRedisTemplate.opsForValue().set(GoodsSkuService.getStockCacheKey(goodsSku.getId()), goodsSku.getQuantity().toString());
|
||||
}
|
||||
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 goodsIndex = new EsGoodsIndex();
|
||||
// goodsIndex.setId("121");
|
||||
// goodsIndex.setBrandId("113");
|
||||
// goodsIndex.setGoodsId("113");
|
||||
// goodsIndex.setCategoryPath("0|1");
|
||||
// goodsIndex.setBuyCount(100);
|
||||
// goodsIndex.setCommentNum(100);
|
||||
// goodsIndex.setGoodsName("惠普(HP)战66 三代AMD版14英寸轻薄笔记本电脑(锐龙7nm 六核R5-4500U 16G 512G 400尼特高色域一年上门 )");
|
||||
// goodsIndex.setGrade(100D);
|
||||
// goodsIndex.setHighPraiseNum(100);
|
||||
// goodsIndex.setIntro("I'd like a cup of tea, please");
|
||||
// goodsIndex.setIsAuth("1");
|
||||
// goodsIndex.setMarketEnable("1");
|
||||
// goodsIndex.setMobileIntro("I want something cold to drink");
|
||||
// goodsIndex.setPoint(100);
|
||||
// goodsIndex.setPrice(100D);
|
||||
// goodsIndex.setSelfOperated(true);
|
||||
// goodsIndex.setStoreId("113");
|
||||
// goodsIndex.setStoreName("惠普自营官方旗舰店");
|
||||
// goodsIndex.setStoreCategoryPath("1");
|
||||
// goodsIndex.setThumbnail("picture");
|
||||
// goodsIndex.setSn("A113");
|
||||
// Map<String, BasePromotion> promotionMap = new HashMap<>();
|
||||
// Coupon coupon = new Coupon();
|
||||
// coupon.setStoreId("113");
|
||||
// coupon.setStoreName("惠普自营官方旗舰店");
|
||||
// coupon.setPromotionStatus(PromotionStatusEnum.START.name());
|
||||
// coupon.setReceivedNum(0);
|
||||
// coupon.setConsumeLimit(11D);
|
||||
// coupon.setCouponLimitNum(10);
|
||||
// coupon.setCouponName("满11减10");
|
||||
// coupon.setCouponType(CouponTypeEnum.PRICE.name());
|
||||
// coupon.setGetType(CouponGetEnum.FREE.name());
|
||||
// coupon.setPrice(10D);
|
||||
// promotionMap.put(PromotionTypeEnum.COUPON.name(), coupon);
|
||||
// goodsIndex.setPromotionMap(promotionMap);
|
||||
// List<EsGoodsAttribute> esGoodsAttributeList = new ArrayList<>();
|
||||
// EsGoodsAttribute attribute = new EsGoodsAttribute();
|
||||
// attribute.setType(0);
|
||||
// attribute.setName("颜色");
|
||||
// attribute.setValue("14英寸");
|
||||
// esGoodsAttributeList.add(attribute);
|
||||
// esGoodsAttributeList.add(attribute);
|
||||
// attribute = new EsGoodsAttribute();
|
||||
// attribute.setName("版本");
|
||||
// attribute.setValue("【战66新品】R5-4500 8G 256G");
|
||||
// esGoodsAttributeList.add(attribute);
|
||||
// attribute = new EsGoodsAttribute();
|
||||
// attribute.setName("配置");
|
||||
// attribute.setValue("i5 8G 512G 2G独显");
|
||||
// esGoodsAttributeList.add(attribute);
|
||||
// goodsIndex.setAttrList(esGoodsAttributeList);
|
||||
// GoodsSku goodsSkuByIdFromCache = goodsSkuService.getGoodsSkuByIdFromCache("121");
|
||||
// EsGoodsIndex goodsIndex = new EsGoodsIndex(goodsSkuByIdFromCache);
|
||||
EsGoodsIndex byId = esGoodsIndexService.findById("121");
|
||||
byId.setPromotionMap(null);
|
||||
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.setIsAuth("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.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2020/12/1
|
||||
**/
|
||||
@RunWith(SpringRunner.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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
203
manager-api/src/test/java/cn/lili/test/promotion/CouponTest.java
Normal file
203
manager-api/src/test/java/cn/lili/test/promotion/CouponTest.java
Normal file
@@ -0,0 +1,203 @@
|
||||
package cn.lili.test.promotion;
|
||||
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.config.rocketmq.RocketmqCustomProperties;
|
||||
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
|
||||
import cn.lili.modules.goods.service.GoodsSkuService;
|
||||
import cn.lili.modules.promotion.entity.dos.Coupon;
|
||||
import cn.lili.modules.promotion.entity.dos.PromotionGoods;
|
||||
import cn.lili.modules.promotion.entity.enums.*;
|
||||
import cn.lili.modules.promotion.entity.vos.CouponSearchParams;
|
||||
import cn.lili.modules.promotion.entity.vos.CouponVO;
|
||||
import cn.lili.modules.promotion.service.CouponService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2020/10/29
|
||||
**/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
class CouponTest {
|
||||
|
||||
@Autowired
|
||||
private CouponService couponService;
|
||||
|
||||
@Autowired
|
||||
private GoodsSkuService goodsSkuService;
|
||||
|
||||
@Autowired
|
||||
private RocketMQTemplate rocketMQTemplate;
|
||||
|
||||
@Autowired
|
||||
private RocketmqCustomProperties rocketmqCustomProperties;
|
||||
|
||||
@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.setPromotionStatus(PromotionStatusEnum.NEW.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(CouponScopeTypeEnum.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.setPromotionStatus(couponVO.getPromotionStatus());
|
||||
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.add(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.setPromotionStatus(PromotionStatusEnum.START.name());
|
||||
couponVO.setStoreId("132");
|
||||
couponVO.setStoreName("联想自营旗舰店");
|
||||
couponVO.setStoreCommission(99.99D);
|
||||
couponVO.setPublishNum(1000);
|
||||
couponVO.setCouponLimitNum(0);
|
||||
couponVO.setCouponDiscount(10D);
|
||||
couponVO.setPrice(0D);
|
||||
|
||||
couponVO.setScopeType(CouponScopeTypeEnum.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());
|
||||
promotionGoods.setPromotionStatus(couponVO.getPromotionStatus());
|
||||
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());
|
||||
promotionGoods.setPromotionStatus(couponVO.getPromotionStatus());
|
||||
promotionGoodsList.add(promotionGoods);
|
||||
|
||||
couponVO.setPromotionGoodsList(promotionGoodsList);
|
||||
Assertions.assertNotNull(couponService.updateCoupon(couponVO));
|
||||
}
|
||||
|
||||
@Test
|
||||
void searchFromMongo() {
|
||||
CouponSearchParams queryParam = new CouponSearchParams();
|
||||
queryParam.setStoreId("");
|
||||
PageVO pageVo = new PageVO();
|
||||
pageVo.setPageNumber(0);
|
||||
pageVo.setPageSize(10);
|
||||
IPage<CouponVO> couponsByPageFromMongo = couponService.getCouponsByPageFromMongo(queryParam, pageVo);
|
||||
Assertions.assertNotNull(couponsByPageFromMongo);
|
||||
couponsByPageFromMongo.getRecords().forEach(System.out::println);
|
||||
}
|
||||
|
||||
@Test
|
||||
void searchFromMysql() {
|
||||
CouponSearchParams queryParam = new CouponSearchParams();
|
||||
|
||||
PageVO pageVo = new PageVO();
|
||||
pageVo.setPageNumber(0);
|
||||
pageVo.setPageSize(10);
|
||||
IPage<Coupon> coupons = couponService.getCouponsByPage(queryParam, pageVo);
|
||||
Assertions.assertNotNull(coupons);
|
||||
coupons.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,138 @@
|
||||
package cn.lili.test.promotion;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
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.promotion.entity.dos.FullDiscount;
|
||||
import cn.lili.modules.promotion.entity.dos.PromotionGoods;
|
||||
import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum;
|
||||
import cn.lili.modules.promotion.entity.enums.PromotionTypeEnum;
|
||||
import cn.lili.modules.promotion.entity.vos.FullDiscountSearchParams;
|
||||
import cn.lili.modules.promotion.service.FullDiscountService;
|
||||
import cn.lili.modules.order.cart.entity.vo.FullDiscountVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2020/10/22
|
||||
**/
|
||||
@RunWith(SpringRunner.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.setNumber(1);
|
||||
fullDiscountVO.setDescription("full discount test " + RandomUtil.randomNumber());
|
||||
fullDiscountVO.setIsFullMinus(true);
|
||||
fullDiscountVO.setFullMoney(130D);
|
||||
fullDiscountVO.setFullMinus(100D);
|
||||
fullDiscountVO.setPromotionStatus(PromotionStatusEnum.NEW.name());
|
||||
fullDiscountVO.setIsFreeFreight(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.setPromotionStatus(PromotionStatusEnum.NEW.name());
|
||||
promotionGoods.setPromotionType(PromotionTypeEnum.FULL_DISCOUNT.name());
|
||||
promotionGoods.setTitle("满" + fullDiscountVO.getFullMoney() + "减" + fullDiscountVO.getFullMinus());
|
||||
promotionGoodsLis.add(promotionGoods);
|
||||
fullDiscountVO.setPromotionGoodsList(promotionGoodsLis);
|
||||
|
||||
Assertions.assertNotNull(fullDiscountService.addFullDiscount(fullDiscountVO));
|
||||
}
|
||||
|
||||
@Test
|
||||
void searchFromMongo() {
|
||||
PageVO pageVo = new PageVO();
|
||||
pageVo.setPageSize(10);
|
||||
pageVo.setPageNumber(0);
|
||||
pageVo.setNotConvert(true);
|
||||
pageVo.setSort("startTime");
|
||||
pageVo.setOrder("asc");
|
||||
|
||||
IPage<FullDiscountVO> fullDiscountByPageFromMongo = fullDiscountService.getFullDiscountByPageFromMongo(new FullDiscountSearchParams(), null);
|
||||
|
||||
Assertions.assertNotNull(fullDiscountByPageFromMongo);
|
||||
FullDiscount fullDiscount = JSONUtil.toBean(JSONUtil.parseObj(fullDiscountByPageFromMongo.getPages()), FullDiscount.class);
|
||||
System.out.println(fullDiscount);
|
||||
// fullDiscountByPageFromMongo.forEach(System.out::println);
|
||||
}
|
||||
|
||||
@Test
|
||||
void update() {
|
||||
FullDiscountVO fullDiscountVO = new FullDiscountVO();
|
||||
fullDiscountVO.setId("1325981729404248064");
|
||||
fullDiscountVO.setStoreId("132");
|
||||
fullDiscountVO.setStoreName("联想自营旗舰店");
|
||||
fullDiscountVO.setNumber(1);
|
||||
fullDiscountVO.setDescription("Not worth");
|
||||
fullDiscountVO.setIsFullMinus(true);
|
||||
fullDiscountVO.setFullMoney(100D);
|
||||
fullDiscountVO.setFullMinus(80D);
|
||||
fullDiscountVO.setPromotionStatus(PromotionStatusEnum.NEW.name());
|
||||
fullDiscountVO.setIsFreeFreight(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.setPromotionStatus(PromotionStatusEnum.NEW.name());
|
||||
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.assertNotNull(fullDiscountService.modifyFullDiscount(fullDiscountVO));
|
||||
}
|
||||
|
||||
@Test
|
||||
void delete() {
|
||||
Assertions.assertTrue(fullDiscountService.deleteFullDiscount("1325995092947525632"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package cn.lili.test.promotion;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.dto.BasePromotion;
|
||||
import cn.lili.modules.promotion.entity.dto.PromotionGoodsDTO;
|
||||
import cn.lili.modules.promotion.entity.enums.PromotionTypeEnum;
|
||||
import cn.lili.modules.promotion.service.PromotionPriceService;
|
||||
import cn.lili.modules.promotion.service.PromotionService;
|
||||
import cn.lili.modules.promotion.service.PromotionGoodsService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2020/11/23
|
||||
**/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
class PromotionPriceTest {
|
||||
|
||||
@Autowired
|
||||
private PromotionPriceService promotionPriceService;
|
||||
|
||||
@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()) {
|
||||
BasePromotion promotion = (BasePromotion) entry.getValue();
|
||||
System.out.println(entry.getKey() + "-" + promotion.getId());
|
||||
}
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSeckillPrice1() {
|
||||
IPage<PromotionGoodsDTO> promotionGoods = promotionGoodsServiceService.getCurrentPromotionGoods(PromotionTypeEnum.FULL_DISCOUNT.name(), new PageVO());
|
||||
|
||||
ResultMessage<IPage<PromotionGoodsDTO>> data = ResultUtil.data(promotionGoods);
|
||||
String s = JSONUtil.toJsonStr(data);
|
||||
System.out.println(s);
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package cn.lili.test.promotion;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.lili.modules.promotion.entity.enums.PromotionApplyStatusEnum;
|
||||
import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum;
|
||||
import cn.lili.modules.promotion.entity.enums.SeckillApplyStatusEnum;
|
||||
import cn.lili.modules.promotion.entity.vos.SeckillApplyVO;
|
||||
import cn.lili.modules.promotion.entity.vos.SeckillVO;
|
||||
import cn.lili.modules.promotion.service.SeckillApplyService;
|
||||
import cn.lili.modules.promotion.service.SeckillService;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2020/10/29
|
||||
**/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
class SeckillTest {
|
||||
|
||||
@Autowired
|
||||
private SeckillService seckillService;
|
||||
|
||||
@Autowired
|
||||
private SeckillApplyService seckillApplyService;
|
||||
|
||||
@Test
|
||||
void add() {
|
||||
SeckillVO seckillVO = new SeckillVO();
|
||||
seckillVO.setId("123456");
|
||||
seckillVO.setStoreIds("132");
|
||||
seckillVO.setSeckillApplyStatus(SeckillApplyStatusEnum.NOT_APPLY.name());
|
||||
seckillVO.setPromotionStatus(PromotionStatusEnum.NEW.name());
|
||||
seckillVO.setApplyEndTime(DateUtil.parse("2020-11-13 23:50:00"));
|
||||
seckillVO.setStartTime(DateUtil.parse("2020-11-14 12:00:00"));
|
||||
seckillVO.setEndTime(DateUtil.parse("2020-11-14 18:00:00"));
|
||||
seckillVO.setHours("13,14,15,16,17");
|
||||
seckillVO.setPromotionName("Seckill" + seckillVO.getId());
|
||||
seckillVO.setSeckillRule("rule" + seckillVO.getId());
|
||||
seckillVO.setStoreId("0");
|
||||
seckillVO.setStoreName("platform");
|
||||
Assertions.assertTrue(seckillService.saveSeckill(seckillVO));
|
||||
}
|
||||
|
||||
@Test
|
||||
void addApply() {
|
||||
List<SeckillApplyVO> seckillApplyVOS = new ArrayList<>();
|
||||
SeckillApplyVO seckillApplyVO = new SeckillApplyVO();
|
||||
seckillApplyVO.setGoodsName("Apple MacBook Pro 13.3 新款八核M1芯片 8G 256G SSD 深空灰 笔记本电脑 轻薄本 MYD82CH/A");
|
||||
seckillApplyVO.setSkuId("50111");
|
||||
seckillApplyVO.setOriginalPrice(20000D);
|
||||
seckillApplyVO.setPrice(19000D);
|
||||
seckillApplyVO.setPromotionApplyStatus(PromotionApplyStatusEnum.APPLY.name());
|
||||
seckillApplyVO.setQuantity(100);
|
||||
seckillApplyVO.setSalesNum(0);
|
||||
seckillApplyVO.setSeckillId("123456");
|
||||
seckillApplyVO.setStoreId("501");
|
||||
seckillApplyVO.setStoreName("Apple产品自营旗舰店");
|
||||
seckillApplyVO.setTimeLine(17);
|
||||
seckillApplyVOS.add(seckillApplyVO);
|
||||
seckillApplyVO = new SeckillApplyVO();
|
||||
seckillApplyVO.setGoodsName("RedmiBook 16 锐龙版 超轻薄全面屏(6核R5-4500U 16G 512G 100% sRGB高色域)灰 手提 笔记本电脑 小米 红米");
|
||||
seckillApplyVO.setSkuId("141");
|
||||
seckillApplyVO.setOriginalPrice(10000D);
|
||||
seckillApplyVO.setPrice(9000D);
|
||||
seckillApplyVO.setPromotionApplyStatus(PromotionApplyStatusEnum.APPLY.name());
|
||||
seckillApplyVO.setQuantity(100);
|
||||
seckillApplyVO.setSalesNum(0);
|
||||
seckillApplyVO.setSeckillId("123456");
|
||||
seckillApplyVO.setStoreId("131");
|
||||
seckillApplyVO.setStoreName("小米自营旗舰店");
|
||||
seckillApplyVO.setTimeLine(16);
|
||||
seckillApplyVOS.add(seckillApplyVO);
|
||||
seckillApplyService.addSeckillApply("123456", "501", seckillApplyVOS);
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void audit() {
|
||||
seckillApplyService.auditBatchApply(new String[]{"1327169604003061760"}, "123456", PromotionApplyStatusEnum.PASS.name(), "");
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.lili.test.rocketmq;
|
||||
|
||||
import cn.lili.common.rocketmq.RocketmqSendCallbackBuilder;
|
||||
import cn.lili.common.rocketmq.tags.MqOrderTagsEnum;
|
||||
import cn.lili.config.rocketmq.RocketmqCustomProperties;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
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.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2021/1/15
|
||||
**/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
class MsgExtRocketMqTest {
|
||||
|
||||
@Autowired
|
||||
private RocketMQTemplate rocketMQTemplate;
|
||||
|
||||
@Autowired
|
||||
private RocketmqCustomProperties rocketmqCustomProperties;
|
||||
|
||||
@Test
|
||||
void searchAll() {
|
||||
String destination = rocketmqCustomProperties.getOrderTopic() + ":" + MqOrderTagsEnum.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