Merge branch 'master' of https://gitee.com/beijing_hongye_huicheng/lilishop into fengtianyangyang_clerk
Conflicts: DB/version4.2.3toMASTER.sql common-api/src/main/java/cn/lili/controller/common/SiteController.java common-api/src/main/java/cn/lili/controller/common/UploadController.java config/application.yml framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java framework/src/main/java/cn/lili/modules/page/serviceimpl/PageDataServiceImpl.java
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
package cn.lili.controller.hotwords;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.search.entity.dto.HotWordsDTO;
|
||||
import cn.lili.modules.search.service.EsGoodsSearchService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 管理端,app版本控制器
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2018-07-04 21:50:52
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,系统设置扩展接口")
|
||||
@RequestMapping("/manager/hotwords/hotwords")
|
||||
public class HotWordsManagerController {
|
||||
|
||||
@Autowired
|
||||
private EsGoodsSearchService esGoodsSearchService;
|
||||
|
||||
@ApiOperation(value = "获取热词")
|
||||
@GetMapping
|
||||
public ResultMessage<Object> getHotWords() {
|
||||
return ResultUtil.data(esGoodsSearchService.getHotWords(100));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设置热词")
|
||||
@PostMapping
|
||||
public ResultMessage<Object> paymentForm(@Validated HotWordsDTO hotWords) {
|
||||
esGoodsSearchService.setHotWords(hotWords);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设置热词")
|
||||
@DeleteMapping("/{words}")
|
||||
public ResultMessage<Object> deleteWords(@PathVariable String words) {
|
||||
esGoodsSearchService.deleteHotWords(words);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,6 +23,8 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 管理端,交易投诉接口
|
||||
*
|
||||
@@ -74,8 +76,8 @@ public class OrderComplaintManagerController {
|
||||
})
|
||||
@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());
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
OrderComplaintCommunicationVO communicationVO = new OrderComplaintCommunicationVO(complainId, content, CommunicationOwnerEnum.PLATFORM.name(), currentUser.getUsername(), currentUser.getId());
|
||||
orderComplaintCommunicationService.addCommunication(communicationVO);
|
||||
return ResultUtil.data(communicationVO);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,14 @@ public class ArticleManagerController {
|
||||
return ResultUtil.data(articleService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据类型查看文章")
|
||||
@ApiImplicitParam(name = "type", value = "文章类型", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping(value = "/type/{type}")
|
||||
public ResultMessage<Article> getByType(@PathVariable String type) {
|
||||
|
||||
return ResultUtil.data(articleService.customGetByType(type));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "categoryId", value = "文章分类ID", paramType = "query"),
|
||||
@@ -60,7 +68,7 @@ public class ArticleManagerController {
|
||||
return ResultUtil.data(article);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改文章")
|
||||
@ApiOperation(value = "修改文章--文章id")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, paramType = "path")
|
||||
@PutMapping(value = "update/{id}", consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<Article> update(@RequestBody Article article, @PathVariable("id") String id) {
|
||||
@@ -68,6 +76,15 @@ public class ArticleManagerController {
|
||||
return ResultUtil.data(articleService.updateArticle(article));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改文章--文章类型")
|
||||
@ApiImplicitParam(name = "type", value = "文章类型", required = true, paramType = "path")
|
||||
@PutMapping(value = "updateArticle/{type}", consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<Article> updateArticle(@RequestBody Article article, @PathVariable("type") String type,String id) {
|
||||
article.setId(id);
|
||||
article.setType(type);
|
||||
return ResultUtil.data(articleService.updateArticleType(article));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改文章状态")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, paramType = "path"),
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ElasticsearchController {
|
||||
}
|
||||
|
||||
@GetMapping("/progress")
|
||||
public ResultMessage<Map<String, Integer>> getProgress() {
|
||||
public ResultMessage<Map<String, Long>> getProgress() {
|
||||
return ResultUtil.data(esGoodsIndexService.getProgress());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.search.entity.dos.HotWordsHistory;
|
||||
import cn.lili.modules.search.entity.dto.HotWordsDTO;
|
||||
import cn.lili.modules.search.entity.dto.HotWordsSearchParams;
|
||||
import cn.lili.modules.search.service.HotWordsHistoryService;
|
||||
import cn.lili.modules.search.service.HotWordsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,热词管理
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2018-07-04 21:50:52
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,热词管理")
|
||||
@RequestMapping("/manager/hotwords/hotwords")
|
||||
public class HotWordsManagerController {
|
||||
|
||||
@Autowired
|
||||
private HotWordsService hotWordsService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private HotWordsHistoryService hotWordsHistoryService;
|
||||
|
||||
@ApiOperation(value = "获取热词")
|
||||
@GetMapping
|
||||
public ResultMessage<Object> getHotWords() {
|
||||
return ResultUtil.data(hotWordsService.getHotWords(100));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设置热词")
|
||||
@PostMapping
|
||||
public ResultMessage<Object> setHotWords(@Validated HotWordsDTO hotWords) {
|
||||
hotWordsService.setHotWords(hotWords);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除热词")
|
||||
@DeleteMapping
|
||||
public ResultMessage<Object> deleteWords(String words) {
|
||||
hotWordsService.deleteHotWords(words);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "历史热词")
|
||||
@GetMapping("/history")
|
||||
public ResultMessage<Object> deleteWords(HistorySearchParams historySearchParams) {
|
||||
List<HotWordsHistory> hotWordsHistoryList = hotWordsHistoryService.queryByDay(historySearchParams.getDate());
|
||||
Collections.sort(hotWordsHistoryList);
|
||||
return ResultUtil.data(hotWordsHistoryList);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "热词统计")
|
||||
@GetMapping("/statistics")
|
||||
public ResultMessage<Object> deleteWords(HotWordsSearchParams hotWordsSearchParams) {
|
||||
return ResultUtil.data(hotWordsHistoryService.statistics(hotWordsSearchParams));
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
class HistorySearchParams {
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@NotNull(message = "查询日期不能为空")
|
||||
private Date date;
|
||||
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public class StudioManagerController {
|
||||
@ApiOperation(value = "获取店铺直播间列表")
|
||||
@ApiImplicitParam(name = "status", value = "直播间状态", paramType = "query")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<Studio>> page(PageVO pageVO, String status) {
|
||||
public ResultMessage<IPage<StudioVO>> page(PageVO pageVO, String status) {
|
||||
return ResultUtil.data(studioService.studioList(pageVO, null, status));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.security.token.Token;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
@@ -17,7 +16,6 @@ import cn.lili.modules.permission.entity.dos.AdminUser;
|
||||
import cn.lili.modules.permission.entity.dto.AdminUserDTO;
|
||||
import cn.lili.modules.permission.entity.vo.AdminUserVO;
|
||||
import cn.lili.modules.permission.service.AdminUserService;
|
||||
import cn.lili.modules.permission.service.DepartmentService;
|
||||
import cn.lili.modules.verification.entity.enums.VerificationEnums;
|
||||
import cn.lili.modules.verification.service.VerificationService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
@@ -49,8 +47,6 @@ import java.util.List;
|
||||
public class AdminUserManagerController {
|
||||
@Autowired
|
||||
private AdminUserService adminUserService;
|
||||
@Autowired
|
||||
private DepartmentService departmentService;
|
||||
/**
|
||||
* 会员
|
||||
*/
|
||||
@@ -88,13 +84,10 @@ public class AdminUserManagerController {
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation(value = "获取当前登录用户接口")
|
||||
public ResultMessage<AdminUserVO> getUserInfo() {
|
||||
public ResultMessage<AdminUser> 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 adminUser = adminUserService.findByUsername(tokenUser.getUsername());
|
||||
adminUser.setPassword(null);
|
||||
return ResultUtil.data(adminUser);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.modules.permission.entity.dos.Department;
|
||||
import cn.lili.modules.permission.entity.vo.DepartmentVO;
|
||||
import cn.lili.modules.permission.service.DepartmentService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -45,15 +46,14 @@ public class DepartmentManagerController {
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增部门")
|
||||
public ResultMessage<Department> save(Department department) {
|
||||
public ResultMessage<Department> save(@Validated Department department) {
|
||||
departmentService.save(department);
|
||||
return ResultUtil.data(department);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation(value = "更新部门")
|
||||
public ResultMessage<Department> update(@PathVariable String id, Department department) {
|
||||
departmentService.updateById(department);
|
||||
public ResultMessage<Department> update(@PathVariable String id, @Validated Department department) {
|
||||
departmentService.updateById(department);
|
||||
return ResultUtil.data(department);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ public class MenuManagerController {
|
||||
@ApiImplicitParam(name = "id", value = "菜单ID", required = true, paramType = "path", dataType = "String")
|
||||
@ApiOperation(value = "编辑")
|
||||
@PutMapping(value = "/{id}")
|
||||
|
||||
@DemoSite
|
||||
public ResultMessage<Menu> edit(@PathVariable String id, Menu menu) {
|
||||
menu.setId(id);
|
||||
|
||||
@@ -6,6 +6,7 @@ import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.dos.CouponActivity;
|
||||
import cn.lili.modules.promotion.entity.dos.CouponActivityItem;
|
||||
import cn.lili.modules.promotion.entity.dto.CouponActivityDTO;
|
||||
import cn.lili.modules.promotion.entity.vos.CouponActivityVO;
|
||||
import cn.lili.modules.promotion.service.CouponActivityService;
|
||||
@@ -49,8 +50,12 @@ public class CouponActivityManagerController {
|
||||
|
||||
@ApiOperation(value = "添加优惠券活动")
|
||||
@PostMapping
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<CouponActivity> addCouponActivity(@RequestBody(required = false) CouponActivityDTO couponActivityDTO) {
|
||||
for (CouponActivityItem couponActivityItem : couponActivityDTO.getCouponActivityItems()) {
|
||||
if (couponActivityItem.getNum() > 3) {
|
||||
throw new ServiceException(ResultCode.COUPON_ACTIVITY_MAX_NUM);
|
||||
}
|
||||
}
|
||||
if (couponActivityService.savePromotions(couponActivityDTO)) {
|
||||
return ResultUtil.data(couponActivityDTO);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,9 @@ public class CouponManagerController {
|
||||
@ApiOperation(value = "获取优惠券列表")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<CouponVO>> getCouponList(CouponSearchParams queryParam, PageVO page) {
|
||||
queryParam.setStoreId(PromotionTools.PLATFORM_ID);
|
||||
if (queryParam.getStoreId() == null) {
|
||||
queryParam.setStoreId(PromotionTools.PLATFORM_ID);
|
||||
}
|
||||
return ResultUtil.data(couponService.pageVOFindAll(queryParam, page));
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -37,8 +38,8 @@ public class PromotionManagerController {
|
||||
|
||||
@GetMapping("/current")
|
||||
@ApiOperation(value = "获取当前进行中的促销活动")
|
||||
public ResultMessage<Map<String, Object>> getCurrentPromotion() {
|
||||
Map<String, Object> currentPromotion = promotionService.getCurrentPromotion();
|
||||
public ResultMessage<Map<String, List<PromotionGoods>>> getCurrentPromotion() {
|
||||
Map<String, List<PromotionGoods>> currentPromotion = promotionService.getCurrentPromotion();
|
||||
return ResultUtil.data(currentPromotion);
|
||||
}
|
||||
|
||||
|
||||
@@ -185,6 +185,10 @@ public class SettingManagerController {
|
||||
return setting == null ?
|
||||
ResultUtil.data(new ImSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), ImSetting.class));
|
||||
case HOT_WORDS:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new HotWordsSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), HotWordsSetting.class));
|
||||
default:
|
||||
throw new ServiceException(ResultCode.SETTING_NOT_TO_SET);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class ManagerAuthenticationFilter extends BasicAuthenticationFilter {
|
||||
|
||||
|
||||
//如果不是超级管理员, 则鉴权
|
||||
if (!authUser.getIsSuper()) {
|
||||
if (Boolean.FALSE.equals(authUser.getIsSuper())) {
|
||||
//获取缓存中的权限
|
||||
Map<String, List<String>> permission = (Map<String, List<String>>) cache.get(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.MANAGER) + authUser.getId());
|
||||
|
||||
|
||||
@@ -3,9 +3,11 @@ package cn.lili.test.elasticsearch;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.goods.entity.dos.Goods;
|
||||
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.GoodsService;
|
||||
import cn.lili.modules.goods.service.GoodsSkuService;
|
||||
import cn.lili.modules.promotion.service.PromotionService;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsAttribute;
|
||||
@@ -47,6 +49,9 @@ class EsTest {
|
||||
@Autowired
|
||||
private GoodsSkuService goodsSkuService;
|
||||
|
||||
@Autowired
|
||||
private GoodsService goodsService;
|
||||
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
||||
@@ -63,6 +68,13 @@ class EsTest {
|
||||
// System.out.println(HtmlUtil.filter("+ADw-script+AD4-alert(document.cookie)+ADw-/script+AD4-"));
|
||||
// Date dt1 = new Date(2021, 12, 10);
|
||||
// Date dt2 = new Date(2021, 12, 14);
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
|
||||
Goods goods = new Goods();
|
||||
goods.setGoodsName("测试商品" + i);
|
||||
// goods.setAuthFlag();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
@@ -132,7 +144,7 @@ class EsTest {
|
||||
esGoodsIndices.add(index);
|
||||
cache.put(GoodsSkuService.getStockCacheKey(goodsSku.getId()), goodsSku.getQuantity());
|
||||
}
|
||||
esGoodsIndexService.initIndex(esGoodsIndices);
|
||||
esGoodsIndexService.initIndex(esGoodsIndices, true);
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package cn.lili.test.promotion;
|
||||
|
||||
import cn.lili.modules.promotion.entity.dos.BasePromotions;
|
||||
import cn.lili.modules.promotion.service.PromotionGoodsService;
|
||||
import cn.lili.modules.promotion.service.PromotionService;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2020/11/23
|
||||
**/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest
|
||||
class PromotionPriceTest {
|
||||
|
||||
@Autowired
|
||||
private PromotionService promotionService;
|
||||
|
||||
@Autowired
|
||||
private PromotionGoodsService promotionGoodsServiceService;
|
||||
|
||||
@Test
|
||||
void testSeckillPrice() {
|
||||
Map<String, Object> currentPromotion = promotionService.getCurrentPromotion();
|
||||
for (Map.Entry<String, Object> entry : currentPromotion.entrySet()) {
|
||||
BasePromotions promotion = (BasePromotions) entry.getValue();
|
||||
System.out.println(entry.getKey() + "-" + promotion.getId());
|
||||
}
|
||||
Assertions.assertTrue(true);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user