修改榜单页面
This commit is contained in:
@@ -244,7 +244,7 @@ dubbo:
|
|||||||
bxg:
|
bxg:
|
||||||
shop:
|
shop:
|
||||||
# API_URL: http://192.168.10.113:48080/bxgApp
|
# API_URL: http://192.168.10.113:48080/bxgApp
|
||||||
API_URL: https://c522-27-19-79-200.jp.ngrok.io
|
API_URL: https://9783-27-19-79-200.jp.ngrok.io
|
||||||
SITE_URL: http://192.168.10.113:48080/bxgApp
|
SITE_URL: http://192.168.10.113:48080/bxgApp
|
||||||
UNI_SITE_URL: http://192.168.10.113:48080/bxgApp
|
UNI_SITE_URL: http://192.168.10.113:48080/bxgApp
|
||||||
ADMIN_API_URL: http://192.168.10.113:48080/bxg
|
ADMIN_API_URL: http://192.168.10.113:48080/bxg
|
||||||
|
|||||||
@@ -77,6 +77,12 @@
|
|||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||||
|
<version>2.5.10</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
||||||
|
|||||||
+2
-4
@@ -92,12 +92,10 @@ public class AppStoreBargainController {
|
|||||||
@ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
|
@ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
|
||||||
})
|
})
|
||||||
@ApiOperation(value = "砍价产品列表",notes = "砍价产品列表")
|
@ApiOperation(value = "砍价产品列表",notes = "砍价产品列表")
|
||||||
public ApiResult<Object> getYxStoreBargainPageList(@RequestParam(value = "page",defaultValue = "1") int page,
|
public ApiResult<Map<String,List<YxStoreBargainQueryVo>>> getYxStoreBargainPageList(@RequestParam(value = "page",defaultValue = "1") int page,
|
||||||
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
||||||
|
return ApiResult.ok(storeBargainService.getList(page, limit));
|
||||||
return ApiResult.resultPage(storeBargainService.getList(page, limit),limit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 砍价详情
|
* 砍价详情
|
||||||
*/
|
*/
|
||||||
|
|||||||
+15
@@ -82,6 +82,21 @@ public class AppStoreCombinationController {
|
|||||||
return ApiResult.ok(storeCombinationService.getList(page, limit));
|
return ApiResult.ok(storeCombinationService.getList(page, limit));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户已发起的拼团的列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/userCombination/list")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class),
|
||||||
|
@ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
|
||||||
|
})
|
||||||
|
@ApiOperation(value = "已发起的拼团的列表",notes = "已发起的拼团的列表")
|
||||||
|
public ApiResult<CombinationQueryVo> getUserCombinationList(@RequestParam(value = "page",defaultValue = "1") int page,
|
||||||
|
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
||||||
|
return ApiResult.ok(storeCombinationService.getCombinationList(page, limit));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼团产品详情
|
* 拼团产品详情
|
||||||
*/
|
*/
|
||||||
|
|||||||
+21
-10
@@ -2,9 +2,11 @@ package co.yixiang.app.modules.hotList.rest;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
|
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
|
||||||
import co.yixiang.annotation.AnonymousAccess;
|
import co.yixiang.annotation.AnonymousAccess;
|
||||||
|
import co.yixiang.app.modules.activity.param.YxStoreBargainUserHelpQueryParam;
|
||||||
import co.yixiang.modules.evaluation.service.YxEvaluationService;
|
import co.yixiang.modules.evaluation.service.YxEvaluationService;
|
||||||
import co.yixiang.modules.hotList.service.YxStoreHotListService;
|
import co.yixiang.modules.hotList.service.YxStoreHotListService;
|
||||||
import co.yixiang.modules.hotList.service.dto.YxStoreHotListDto;
|
import co.yixiang.modules.hotList.param.YxStoreHotListRecordQueryParam;
|
||||||
|
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||||
import co.yixiang.utils.EvaluationDTO;
|
import co.yixiang.utils.EvaluationDTO;
|
||||||
import co.yixiang.utils.HotListDTO;
|
import co.yixiang.utils.HotListDTO;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -38,21 +41,29 @@ public class AppStoreHotListController {
|
|||||||
* 热门榜单列表
|
* 热门榜单列表
|
||||||
*/
|
*/
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
@GetMapping("/hotList")
|
@GetMapping("/hotListData")
|
||||||
@ApiOperation(value = "热门榜单列表",notes = "热门榜单")
|
@ApiOperation(value = "榜单可选月及每月可选分类",notes = "榜单信息")
|
||||||
public ApiResult<List<HotListDTO>> getYxStoreHotList(){
|
public ApiResult<Map<String,Object>> getYxStoreHotDataList(){
|
||||||
|
return ApiResult.ok(yxStoreHotListService.getHotListDataList());
|
||||||
return ApiResult.ok(yxStoreHotListService.getList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 热门榜单列表
|
* 热门榜单列表
|
||||||
*/
|
*/
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
@GetMapping("/hotList/{mouth}")
|
@GetMapping("/hotList")
|
||||||
@ApiOperation(value = "根据年月查询热门榜单列表",notes = "热门榜单")
|
@ApiOperation(value = "榜单列表",notes = "热门榜单")
|
||||||
public ApiResult<List<HotListDTO>> getYxStoreHotList(@PathVariable String mouth){
|
public ApiResult<List<YxStoreProduct>> getYxStoreHotListRecord(YxStoreHotListRecordQueryParam QueryParam){
|
||||||
|
return ApiResult.ok(yxStoreHotListService.getList(QueryParam));
|
||||||
|
}
|
||||||
|
|
||||||
return ApiResult.ok(yxStoreHotListService.getList(mouth));
|
/**
|
||||||
|
* 热门榜单列表
|
||||||
|
*/
|
||||||
|
@AnonymousAccess
|
||||||
|
@GetMapping("/indexHotList")
|
||||||
|
@ApiOperation(value = "首页的榜单内容",notes = "首页的榜单内容")
|
||||||
|
public ApiResult<List<HotListDTO>> getYxStoreHotList(){
|
||||||
|
return ApiResult.ok(yxStoreHotListService.getList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class LetterAppUserController {
|
|||||||
* 获取各类轮播图
|
* 获取各类轮播图
|
||||||
*/
|
*/
|
||||||
@GetMapping("/menu/banner/{type}")
|
@GetMapping("/menu/banner/{type}")
|
||||||
@ApiOperation(value = "获取各种轮播图(0:首页 1:品牌馆 2:优惠券 3:活动专区)",notes = "获取轮播图")
|
@ApiOperation(value = "获取各种轮播图(0:首页 1:品牌馆 2:优惠券 3:活动专区 4:榜单列表)",notes = "获取轮播图")
|
||||||
public ApiResult<Map<String,Object>> bannerMenu(@PathVariable Integer type){
|
public ApiResult<Map<String,Object>> bannerMenu(@PathVariable Integer type){
|
||||||
Map<String,Object> map = new LinkedHashMap<>();
|
Map<String,Object> map = new LinkedHashMap<>();
|
||||||
// map.put("banner",systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_BANNER));
|
// map.put("banner",systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_BANNER));
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import lombok.Builder;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -30,6 +31,7 @@ import java.util.Date;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@TableName("yx_store_coupon_user")
|
@TableName("yx_store_coupon_user")
|
||||||
|
@Service
|
||||||
public class YxStoreCouponUser extends BaseDomain {
|
public class YxStoreCouponUser extends BaseDomain {
|
||||||
|
|
||||||
/** 优惠券发放记录id */
|
/** 优惠券发放记录id */
|
||||||
|
|||||||
+4
-2
@@ -91,9 +91,9 @@ public interface YxStoreBargainService extends BaseService<YxStoreBargain>{
|
|||||||
* @param limit limit
|
* @param limit limit
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
List<YxStoreBargainQueryVo> getList(int page, int limit);
|
Map<String,List<YxStoreBargainQueryVo>> getList(int page, int limit);
|
||||||
|
|
||||||
|
|
||||||
|
// List<YxStoreBargainQueryVo> getUserBargainList(int page, int limit);
|
||||||
/**
|
/**
|
||||||
* 查询数据分页
|
* 查询数据分页
|
||||||
* @param criteria 条件
|
* @param criteria 条件
|
||||||
@@ -122,4 +122,6 @@ public interface YxStoreBargainService extends BaseService<YxStoreBargain>{
|
|||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
void deleteBargainImg(String id);
|
void deleteBargainImg(String id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+8
@@ -84,6 +84,14 @@ public interface YxStoreBargainUserService extends BaseService<YxStoreBargainUse
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
Long getBargainUserCount(Long bargainId,Integer status);
|
Long getBargainUserCount(Long bargainId,Integer status);
|
||||||
|
/**
|
||||||
|
* 获取参与砍价的用户数量
|
||||||
|
* @param bargainId 砍价id
|
||||||
|
* @param uid 状态 OrderInfoEnum 1 进行中 2 结束失败 3结束成功
|
||||||
|
* @param uid 用户是否正在参加该活动
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
Boolean getUserIsParticipation(Long uid,Long bargainId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -38,6 +38,7 @@ public interface YxStoreCombinationService extends BaseService<YxStoreCombinati
|
|||||||
*/
|
*/
|
||||||
CombinationQueryVo getList(int page, int limit);
|
CombinationQueryVo getList(int page, int limit);
|
||||||
|
|
||||||
|
CombinationQueryVo getCombinationList(int page, int limit);
|
||||||
/**
|
/**
|
||||||
* 获取拼团详情
|
* 获取拼团详情
|
||||||
* @param id 拼团产品id
|
* @param id 拼团产品id
|
||||||
@@ -77,4 +78,6 @@ public interface YxStoreCombinationService extends BaseService<YxStoreCombinati
|
|||||||
void onSale(Long id, Integer status);
|
void onSale(Long id, Integer status);
|
||||||
|
|
||||||
boolean saveCombination(YxStoreCombinationDto resources);
|
boolean saveCombination(YxStoreCombinationDto resources);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-14
@@ -12,6 +12,7 @@ import cn.hutool.core.util.NumberUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.exception.YshopException;
|
import cn.iocoder.yudao.framework.common.exception.YshopException;
|
||||||
|
import co.yixiang.app.common.bean.LocalUser;
|
||||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||||
import co.yixiang.common.utils.QueryHelpPlus;
|
import co.yixiang.common.utils.QueryHelpPlus;
|
||||||
import co.yixiang.dozer.service.IGenerator;
|
import co.yixiang.dozer.service.IGenerator;
|
||||||
@@ -53,12 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -332,7 +328,8 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
|||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<YxStoreBargainQueryVo> getList(int page, int limit) {
|
public Map<String,List<YxStoreBargainQueryVo>> getList(int page, int limit) {
|
||||||
|
Map<String,List<YxStoreBargainQueryVo>> map=new HashMap<>();
|
||||||
Page<YxStoreBargain> pageModel = new Page<>(page, limit);
|
Page<YxStoreBargain> pageModel = new Page<>(page, limit);
|
||||||
LambdaQueryWrapper<YxStoreBargain> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<YxStoreBargain> wrapper = new LambdaQueryWrapper<>();
|
||||||
Date nowTime = new Date();
|
Date nowTime = new Date();
|
||||||
@@ -343,15 +340,23 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
|||||||
List<YxStoreBargainQueryVo> yxStoreBargainQueryVos = generator.convert(
|
List<YxStoreBargainQueryVo> yxStoreBargainQueryVos = generator.convert(
|
||||||
yxStoreBargainMapper.selectPage(pageModel,wrapper).getRecords(),
|
yxStoreBargainMapper.selectPage(pageModel,wrapper).getRecords(),
|
||||||
YxStoreBargainQueryVo.class);
|
YxStoreBargainQueryVo.class);
|
||||||
|
long uid = LocalUser.getUidByToken();
|
||||||
|
List<YxStoreBargainQueryVo> isParticipation=new ArrayList<>();
|
||||||
|
List<YxStoreBargainQueryVo> isNotParticipation=new ArrayList<>();
|
||||||
yxStoreBargainQueryVos.forEach(item->{
|
yxStoreBargainQueryVos.forEach(item->{
|
||||||
item.setPeople(storeBargainUserService.getBargainUserCount(item.getId(),
|
item.setPeople(storeBargainUserService.getBargainUserCount(item.getId(), OrderInfoEnum.BARGAIN_STATUS_1.getValue()));
|
||||||
OrderInfoEnum.BARGAIN_STATUS_1.getValue()));
|
item.setIsParticipation(storeBargainUserService.getUserIsParticipation(uid, item.getId()));
|
||||||
});
|
if (item.getIsParticipation()){
|
||||||
|
isParticipation.add(item);
|
||||||
return yxStoreBargainQueryVos;
|
}else {
|
||||||
|
isNotParticipation.add(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
map.put("yxStoreBargainQueryVos",yxStoreBargainQueryVos);
|
||||||
|
map.put("isParticipation",isParticipation);
|
||||||
|
map.put("isNotParticipation",isNotParticipation);
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加分享次数
|
* 增加分享次数
|
||||||
|
|||||||
+11
@@ -207,6 +207,17 @@ public class YxStoreBargainUserServiceImpl extends BaseServiceImpl<YxStoreBargai
|
|||||||
.eq(YxStoreBargainUser::getStatus,status).count();
|
.eq(YxStoreBargainUser::getStatus,status).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean getUserIsParticipation(Long uid, Long bargainId) {
|
||||||
|
Long count=this.lambdaQuery().eq(YxStoreBargainUser::getUid,uid)
|
||||||
|
.eq(YxStoreBargainUser::getBargainId,bargainId)
|
||||||
|
.eq(YxStoreBargainUser::getStatus,1).count();
|
||||||
|
if (count>0){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
|
|||||||
+25
@@ -14,6 +14,7 @@ import cn.hutool.core.util.NumberUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.exception.YshopException;
|
import cn.iocoder.yudao.framework.common.exception.YshopException;
|
||||||
|
import co.yixiang.app.common.bean.LocalUser;
|
||||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||||
import co.yixiang.common.utils.QueryHelpPlus;
|
import co.yixiang.common.utils.QueryHelpPlus;
|
||||||
import co.yixiang.dozer.service.IGenerator;
|
import co.yixiang.dozer.service.IGenerator;
|
||||||
@@ -29,6 +30,7 @@ import co.yixiang.modules.activity.service.YxStorePinkService;
|
|||||||
import co.yixiang.modules.activity.service.dto.PinkAllDto;
|
import co.yixiang.modules.activity.service.dto.PinkAllDto;
|
||||||
import co.yixiang.modules.activity.service.dto.YxStoreCombinationDto;
|
import co.yixiang.modules.activity.service.dto.YxStoreCombinationDto;
|
||||||
import co.yixiang.modules.activity.service.dto.YxStoreCombinationQueryCriteria;
|
import co.yixiang.modules.activity.service.dto.YxStoreCombinationQueryCriteria;
|
||||||
|
import co.yixiang.modules.activity.service.dto.YxStorePinkDto;
|
||||||
import co.yixiang.modules.activity.service.mapper.YxStoreCombinationMapper;
|
import co.yixiang.modules.activity.service.mapper.YxStoreCombinationMapper;
|
||||||
import co.yixiang.modules.activity.service.mapper.YxStorePinkMapper;
|
import co.yixiang.modules.activity.service.mapper.YxStorePinkMapper;
|
||||||
import co.yixiang.modules.activity.service.mapper.YxStoreVisitMapper;
|
import co.yixiang.modules.activity.service.mapper.YxStoreVisitMapper;
|
||||||
@@ -48,6 +50,7 @@ import co.yixiang.modules.product.vo.YxStoreProductAttrQueryVo;
|
|||||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||||
import co.yixiang.modules.template.domain.YxShippingTemplates;
|
import co.yixiang.modules.template.domain.YxShippingTemplates;
|
||||||
import co.yixiang.modules.template.service.YxShippingTemplatesService;
|
import co.yixiang.modules.template.service.YxShippingTemplatesService;
|
||||||
|
import co.yixiang.modules.user.domain.YxUser;
|
||||||
import co.yixiang.utils.FileUtil;
|
import co.yixiang.utils.FileUtil;
|
||||||
|
|
||||||
import co.yixiang.utils.RedisUtils;
|
import co.yixiang.utils.RedisUtils;
|
||||||
@@ -202,6 +205,28 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
|
|||||||
return combinationQueryVo;
|
return combinationQueryVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CombinationQueryVo getCombinationList(int page, int limit) {
|
||||||
|
long uid = LocalUser.getUidByToken();
|
||||||
|
Page<YxStorePink> pageModel=new Page<>(page, limit);
|
||||||
|
LambdaQueryWrapper<YxStorePink> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
//Status:1 进行中 KId:0 发起人是自己
|
||||||
|
wrapper.eq(YxStorePink::getStatus,1)
|
||||||
|
.eq(YxStorePink::getUid,uid);
|
||||||
|
// .eq(YxStorePink::getKId,0);
|
||||||
|
IPage<YxStorePink> yxStorePinkIPage = yxStorePinkMapper.selectPage(pageModel, wrapper);
|
||||||
|
List<YxStoreCombinationQueryVo> collect = yxStorePinkIPage.getRecords().stream().map(i -> {
|
||||||
|
YxStoreCombinationQueryVo yxStoreCombinationQueryVo = new YxStoreCombinationQueryVo();
|
||||||
|
YxStoreCombination yxStoreCombination=yxStoreCombinationMapper.selectById(i.getCid());
|
||||||
|
BeanUtils.copyProperties(yxStoreCombination, yxStoreCombinationQueryVo);
|
||||||
|
return yxStoreCombinationQueryVo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
CombinationQueryVo combinationQueryVo = new CombinationQueryVo();
|
||||||
|
combinationQueryVo.setStoreCombinationQueryVos(collect);
|
||||||
|
combinationQueryVo.setLastPage(yxStorePinkIPage.getPages());
|
||||||
|
return combinationQueryVo;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//=======================================//
|
//=======================================//
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ public interface YxStoreCouponUserMapper extends CoreMapper<YxStoreCouponUser> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Select("select *from yx_store_coupon_user where status = 0 AND is_fail=0 AND use_end_time <= #{endTime}")
|
@Select("select *from yx_store_coupon_user where status = 0 AND is_fail=0 AND use_end_time <= #{endTime} AND tenant_id = 138")
|
||||||
List<YxStoreCouponUser> selectUserCouponList(@Param("endTime") Date endTime);
|
List<YxStoreCouponUser> selectUserCouponList(@Param("endTime") Date endTime);
|
||||||
//"状态(0:未使用,1:已使用, 2:已过期)"
|
//"状态(0:未使用,1:已使用, 2:已过期)"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,5 +117,6 @@ public class YxStoreBargainQueryVo implements Serializable {
|
|||||||
@ApiModelProperty(value = "砍价产品参与人数")
|
@ApiModelProperty(value = "砍价产品参与人数")
|
||||||
private Long people;
|
private Long people;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "该用户是否已发起砍价")
|
||||||
|
private Boolean isParticipation;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,19 +7,18 @@
|
|||||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
*/
|
*/
|
||||||
package co.yixiang.modules.hotList.domain;
|
package co.yixiang.modules.hotList.domain;
|
||||||
import co.yixiang.modules.product.domain.YxStoreProduct;
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import lombok.Data;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import lombok.Data;
|
||||||
import cn.hutool.core.bean.copier.CopyOptions;
|
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.NotBlank;
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.sql.Timestamp;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ssj
|
* @author ssj
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package co.yixiang.modules.hotList.domain;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("yx_store_hot_list_record")
|
||||||
|
@Service
|
||||||
|
public class YxStoreHotListRecord implements Serializable {
|
||||||
|
/** 生成记录时候的ID */
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品ID")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "榜单Id")
|
||||||
|
private Integer hotListId;
|
||||||
|
|
||||||
|
/**榜单生成时商品的分类id */
|
||||||
|
@ApiModelProperty(value = "分类id")
|
||||||
|
private String cateId;
|
||||||
|
|
||||||
|
/** 榜单虚拟销量 */
|
||||||
|
@ApiModelProperty(value = "榜单记录时候商品的虚拟销量")
|
||||||
|
private Integer hotSales;
|
||||||
|
|
||||||
|
/** 商品的价格 */
|
||||||
|
@ApiModelProperty(value = "榜单记录商品的价格")
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
/** 是否显示 */
|
||||||
|
private Integer isShow;
|
||||||
|
|
||||||
|
/** 此条记录所属月份 */
|
||||||
|
private String mouth;
|
||||||
|
|
||||||
|
/** 添加时间 */
|
||||||
|
@TableField(fill= FieldFill.INSERT)
|
||||||
|
private Timestamp createTime;
|
||||||
|
|
||||||
|
@TableField(fill= FieldFill.INSERT_UPDATE)
|
||||||
|
private Timestamp updateTime;
|
||||||
|
|
||||||
|
/** 删除状态 */
|
||||||
|
private Integer isDel;
|
||||||
|
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
public void copy(YxStoreHotListRecord source){
|
||||||
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
|
}
|
||||||
|
}
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
package co.yixiang.modules.hotList.param;
|
||||||
|
|
||||||
|
import co.yixiang.common.web.param.QueryParam;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value="YxStoreHotListRecordQueryParam对象", description="热榜记录表查询参数")
|
||||||
|
public class YxStoreHotListRecordQueryParam extends QueryParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品分类ID")
|
||||||
|
private Long cateId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "榜单ID")
|
||||||
|
private Long hotListId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所属月份")
|
||||||
|
private String mouth;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "价格排序 desc降序/asc升序")
|
||||||
|
private String priceOrder;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "销量排序 desc降序/asc升序")
|
||||||
|
private String salesOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
+16
-21
@@ -8,20 +8,22 @@
|
|||||||
*/
|
*/
|
||||||
package co.yixiang.modules.hotList.rest;
|
package co.yixiang.modules.hotList.rest;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import co.yixiang.domain.PageResult;
|
import co.yixiang.domain.PageResult;
|
||||||
import co.yixiang.dozer.service.IGenerator;
|
import co.yixiang.dozer.service.IGenerator;
|
||||||
import co.yixiang.event.TemplateBean;
|
import co.yixiang.enums.CommonEnum;
|
||||||
import co.yixiang.event.TemplateEvent;
|
import co.yixiang.enums.ShopCommonEnum;
|
||||||
import co.yixiang.event.TemplateListenEnum;
|
|
||||||
import co.yixiang.logging.aop.log.Log;
|
import co.yixiang.logging.aop.log.Log;
|
||||||
import co.yixiang.modules.activity.domain.YxStoreCouponUser;
|
|
||||||
import co.yixiang.modules.activity.service.mapper.YxStoreCouponUserMapper;
|
import co.yixiang.modules.activity.service.mapper.YxStoreCouponUserMapper;
|
||||||
import co.yixiang.modules.hotList.domain.YxStoreHotList;
|
import co.yixiang.modules.hotList.domain.YxStoreHotList;
|
||||||
|
import co.yixiang.modules.hotList.domain.YxStoreHotListRecord;
|
||||||
|
import co.yixiang.modules.hotList.service.YxStoreHotListRecordService;
|
||||||
import co.yixiang.modules.hotList.service.YxStoreHotListService;
|
import co.yixiang.modules.hotList.service.YxStoreHotListService;
|
||||||
import co.yixiang.modules.hotList.service.dto.YxStoreHotListDto;
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListDto;
|
||||||
import co.yixiang.modules.hotList.service.dto.YxStoreHotListQueryCriteria;
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListQueryCriteria;
|
||||||
import co.yixiang.modules.hotList.service.vo.YxStoreHotListVo;
|
import co.yixiang.modules.hotList.service.vo.YxStoreHotListVo;
|
||||||
|
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||||
|
import co.yixiang.modules.product.service.mapper.StoreProductMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -30,14 +32,13 @@ import org.springframework.context.ApplicationEventPublisher;
|
|||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,8 +57,16 @@ public class YxStoreHotListController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private YxStoreCouponUserMapper yxStoreCouponUserMapper;
|
private YxStoreCouponUserMapper yxStoreCouponUserMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StoreProductMapper storeProductMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationEventPublisher publisher;
|
private ApplicationEventPublisher publisher;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private YxStoreHotListRecord yxStoreHotListRecord;
|
||||||
|
@Autowired
|
||||||
|
private YxStoreHotListRecordService yxStoreHotListRecordService;
|
||||||
@Log("导出数据")
|
@Log("导出数据")
|
||||||
@ApiOperation("导出数据")
|
@ApiOperation("导出数据")
|
||||||
@GetMapping(value = "/download")
|
@GetMapping(value = "/download")
|
||||||
@@ -71,20 +80,6 @@ public class YxStoreHotListController {
|
|||||||
@ApiOperation("查询hotList")
|
@ApiOperation("查询hotList")
|
||||||
// @PreAuthorize("@el.check('admin','yxStoreHotList:list')")
|
// @PreAuthorize("@el.check('admin','yxStoreHotList:list')")
|
||||||
public ResponseEntity<PageResult<YxStoreHotListVo>> getYxStoreHotLists(YxStoreHotListQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<PageResult<YxStoreHotListVo>> getYxStoreHotLists(YxStoreHotListQueryCriteria criteria, Pageable pageable){
|
||||||
// //查出所有用户拥有的券使用时间小于24小时且未使用的券
|
|
||||||
// Date now=new Date();
|
|
||||||
// Date endTime = DateUtil.offsetDay(now,1);
|
|
||||||
// List<YxStoreCouponUser> storeCouponUsers=yxStoreCouponUserMapper.selectUserCouponList(endTime);
|
|
||||||
// storeCouponUsers.forEach(storeCouponUser->{
|
|
||||||
// //这里调用微信订阅模板发送消息
|
|
||||||
// TemplateBean templateBean = TemplateBean.builder()
|
|
||||||
// .couponId(storeCouponUser.getCid())
|
|
||||||
// .uid(storeCouponUser.getUid())
|
|
||||||
// .templateType(TemplateListenEnum.TYPE_11.getValue())
|
|
||||||
// .time(DateUtil.formatTime(new Date()))
|
|
||||||
// .build();
|
|
||||||
// publisher.publishEvent(new TemplateEvent(this, templateBean));
|
|
||||||
// });
|
|
||||||
return new ResponseEntity<>(yxStoreHotListService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(yxStoreHotListService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+108
@@ -0,0 +1,108 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.hotList.rest;
|
||||||
|
|
||||||
|
import co.yixiang.domain.PageResult;
|
||||||
|
import co.yixiang.dozer.service.IGenerator;
|
||||||
|
import co.yixiang.enums.ShopCommonEnum;
|
||||||
|
import co.yixiang.logging.aop.log.Log;
|
||||||
|
import co.yixiang.modules.activity.service.mapper.YxStoreCouponUserMapper;
|
||||||
|
import co.yixiang.modules.hotList.domain.YxStoreHotList;
|
||||||
|
import co.yixiang.modules.hotList.domain.YxStoreHotListRecord;
|
||||||
|
import co.yixiang.modules.hotList.service.YxStoreHotListRecordService;
|
||||||
|
import co.yixiang.modules.hotList.service.YxStoreHotListService;
|
||||||
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListRecordDto;
|
||||||
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListRecordQueryCriteria;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ssj
|
||||||
|
* @date 2022-10-08
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Api(tags = "hotListRecord管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/yxStoreHotListRecord")
|
||||||
|
public class YxStoreHotListRecordController {
|
||||||
|
|
||||||
|
private final YxStoreHotListRecordService yxStoreHotListRecordService;
|
||||||
|
private final IGenerator generator;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private YxStoreCouponUserMapper yxStoreCouponUserMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private YxStoreHotListService yxStoreHotListService;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationEventPublisher publisher;
|
||||||
|
@Log("导出数据")
|
||||||
|
@ApiOperation("导出数据")
|
||||||
|
@GetMapping(value = "/download")
|
||||||
|
// @PreAuthorize("@el.check('admin','yxStoreHotList:list')")
|
||||||
|
public void download(HttpServletResponse response, YxStoreHotListRecordQueryCriteria criteria) throws IOException {
|
||||||
|
yxStoreHotListRecordService.download(generator.convert(yxStoreHotListRecordService.queryAll(criteria), YxStoreHotListRecordDto.class), response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("查询榜单记录")
|
||||||
|
@ApiOperation("查询榜单记录")
|
||||||
|
// @PreAuthorize("@el.check('admin','yxStoreHotList:list')")
|
||||||
|
public ResponseEntity<PageResult<YxStoreHotListRecordDto>> getYxStoreHotLists(YxStoreHotListRecordQueryCriteria criteria, Pageable pageable){
|
||||||
|
List<YxStoreHotListRecord> storeHotLists= yxStoreHotListRecordService.lambdaQuery()
|
||||||
|
.eq(YxStoreHotListRecord::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
||||||
|
.list();
|
||||||
|
return new ResponseEntity<>(yxStoreHotListRecordService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Log("新增榜单记录")
|
||||||
|
@ApiOperation("新增榜单记录")
|
||||||
|
// @PreAuthorize("@el.check('admin','yxStoreHotList:add')")
|
||||||
|
public ResponseEntity<Object> create(@Validated @RequestBody YxStoreHotListRecord resources){
|
||||||
|
return new ResponseEntity<>(yxStoreHotListRecordService.save(resources),HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Log("修改榜单记录")
|
||||||
|
@ApiOperation("修改榜单记录")
|
||||||
|
// @PreAuthorize("@el.check('admin','yxStoreHotList:edit')")
|
||||||
|
public ResponseEntity<Object> update(@Validated @RequestBody YxStoreHotListRecord resources){
|
||||||
|
yxStoreHotListRecordService.updateById(resources);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("删除榜单记录")
|
||||||
|
@ApiOperation("删除榜单记录")
|
||||||
|
// @PreAuthorize("@el.check('admin','yxStoreHotList:del')")
|
||||||
|
@DeleteMapping
|
||||||
|
public ResponseEntity<Object> deleteAll(@RequestBody Integer[] ids) {
|
||||||
|
Arrays.asList(ids).forEach(id->{
|
||||||
|
yxStoreHotListRecordService.removeById(id);
|
||||||
|
});
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.hotList.service;
|
||||||
|
|
||||||
|
import co.yixiang.common.service.BaseService;
|
||||||
|
import co.yixiang.domain.PageResult;
|
||||||
|
import co.yixiang.modules.hotList.domain.YxStoreHotListRecord;
|
||||||
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListRecordDto;
|
||||||
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListRecordQueryCriteria;
|
||||||
|
import co.yixiang.modules.product.service.dto.YxStoreProductQueryCriteria;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author sj
|
||||||
|
* @date 2022-11-03
|
||||||
|
*/
|
||||||
|
public interface YxStoreHotListRecordService extends BaseService<YxStoreHotListRecord> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
* @param criteria 条件
|
||||||
|
* @param pageable 分页参数
|
||||||
|
* @return Map<String,Object>
|
||||||
|
*/
|
||||||
|
PageResult<YxStoreHotListRecordDto> queryAll(YxStoreHotListRecordQueryCriteria criteria, Pageable pageable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有数据不分页
|
||||||
|
* @param criteria 条件参数
|
||||||
|
* @return List<YxStoreHotListRecordDto>
|
||||||
|
*/
|
||||||
|
List<YxStoreHotListRecord> queryAll(YxStoreHotListRecordQueryCriteria criteria);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据
|
||||||
|
* @param all 待导出的数据
|
||||||
|
* @param response /
|
||||||
|
* @throws IOException /
|
||||||
|
*/
|
||||||
|
void download(List<YxStoreHotListRecordDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
}
|
||||||
@@ -11,15 +11,19 @@ package co.yixiang.modules.hotList.service;
|
|||||||
import co.yixiang.common.service.BaseService;
|
import co.yixiang.common.service.BaseService;
|
||||||
import co.yixiang.domain.PageResult;
|
import co.yixiang.domain.PageResult;
|
||||||
import co.yixiang.modules.hotList.domain.YxStoreHotList;
|
import co.yixiang.modules.hotList.domain.YxStoreHotList;
|
||||||
|
import co.yixiang.modules.hotList.param.YxStoreHotListRecordQueryParam;
|
||||||
import co.yixiang.modules.hotList.service.dto.YxStoreHotListDto;
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListDto;
|
||||||
import co.yixiang.modules.hotList.service.dto.YxStoreHotListQueryCriteria;
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListQueryCriteria;
|
||||||
import co.yixiang.modules.hotList.service.vo.YxStoreHotListVo;
|
import co.yixiang.modules.hotList.service.vo.YxStoreHotListVo;
|
||||||
|
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||||
import co.yixiang.utils.HotListDTO;
|
import co.yixiang.utils.HotListDTO;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ssj
|
* @author ssj
|
||||||
* @date 2022-10-08
|
* @date 2022-10-08
|
||||||
@@ -48,12 +52,14 @@ public interface YxStoreHotListService extends BaseService<YxStoreHotList> {
|
|||||||
* @throws IOException /
|
* @throws IOException /
|
||||||
*/
|
*/
|
||||||
void download(List<YxStoreHotListDto> all, HttpServletResponse response) throws IOException;
|
void download(List<YxStoreHotListDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
Map<String,Object>getHotListDataList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* app根据月份获取列表
|
* app获取列表
|
||||||
* @param mouth 想要查的月份
|
* @param QueryParam YxStoreHotListRecordQueryParam
|
||||||
*/
|
*/
|
||||||
List<HotListDTO> getList(String mouth);
|
List<YxStoreProduct> getList(YxStoreHotListRecordQueryParam QueryParam);
|
||||||
|
|
||||||
List<HotListDTO> getList();
|
List<HotListDTO> getList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+59
@@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.hotList.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2022-11-03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class YxStoreHotListRecordDto implements Serializable {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 商品id */
|
||||||
|
private Integer productId;
|
||||||
|
private String productName;
|
||||||
|
/** 榜单id */
|
||||||
|
private Integer hotListId;
|
||||||
|
/** 榜单名称 */
|
||||||
|
private String hotListName;
|
||||||
|
|
||||||
|
/** 入榜价格 */
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
/** 入榜时候销量 */
|
||||||
|
private Integer hotSales;
|
||||||
|
|
||||||
|
/** 商品分类id */
|
||||||
|
private Integer cateId;
|
||||||
|
/** 商品分类id */
|
||||||
|
private String cateName;
|
||||||
|
|
||||||
|
/** 当前榜单所属时间月份 */
|
||||||
|
private String mouth;
|
||||||
|
|
||||||
|
/** 是否显示 */
|
||||||
|
private Integer isShow;
|
||||||
|
|
||||||
|
/** 添加时间 */
|
||||||
|
private Timestamp createTime;
|
||||||
|
|
||||||
|
private Timestamp updateTime;
|
||||||
|
|
||||||
|
/** 删除状态 */
|
||||||
|
private Integer isDel;
|
||||||
|
|
||||||
|
private Long tenantId;
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.hotList.service.dto;
|
||||||
|
|
||||||
|
import co.yixiang.annotation.Query;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author sj
|
||||||
|
* @date 2022-11-03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class YxStoreHotListRecordQueryCriteria{
|
||||||
|
|
||||||
|
//榜单id
|
||||||
|
@Query
|
||||||
|
private Integer hotListId;
|
||||||
|
|
||||||
|
@Query
|
||||||
|
private String mouth;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
package co.yixiang.modules.hotList.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import co.yixiang.enums.CommonEnum;
|
||||||
|
import co.yixiang.enums.ShopCommonEnum;
|
||||||
|
import co.yixiang.event.TemplateBean;
|
||||||
|
import co.yixiang.event.TemplateEvent;
|
||||||
|
import co.yixiang.event.TemplateListenEnum;
|
||||||
|
import co.yixiang.modules.activity.domain.YxStoreCouponUser;
|
||||||
|
import co.yixiang.modules.activity.service.mapper.YxStoreCouponUserMapper;
|
||||||
|
import co.yixiang.modules.hotList.domain.YxStoreHotListRecord;
|
||||||
|
import co.yixiang.modules.hotList.service.YxStoreHotListRecordService;
|
||||||
|
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||||
|
import co.yixiang.modules.product.service.mapper.StoreProductMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class TaskMsg {
|
||||||
|
@Autowired
|
||||||
|
private YxStoreCouponUserMapper yxStoreCouponUserMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationEventPublisher publisher;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StoreProductMapper storeProductMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private YxStoreHotListRecordService yxStoreHotListRecordService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private YxStoreHotListRecord yxStoreHotListRecord;
|
||||||
|
|
||||||
|
//定时器,每天下午17点触发
|
||||||
|
@Scheduled(cron = "0 0 17 * * ?")
|
||||||
|
// @Scheduled(cron = "0 50 17 * * ?")
|
||||||
|
public void scheduled(){
|
||||||
|
log.info("=====>>>>>使用cron {}",System.currentTimeMillis());
|
||||||
|
log.info("=====>>>>>使用cron {}",System.currentTimeMillis());
|
||||||
|
//查出所有用户拥有的券使用时间小于24小时且未使用的券
|
||||||
|
Date now=new Date();
|
||||||
|
Date endTime = DateUtil.offsetDay(now,1);
|
||||||
|
List<YxStoreCouponUser> storeCouponUsers=yxStoreCouponUserMapper.selectUserCouponList(endTime);
|
||||||
|
storeCouponUsers.forEach(storeCouponUser->{
|
||||||
|
//这里调用微信订阅模板发送消息
|
||||||
|
TemplateBean templateBean = TemplateBean.builder()
|
||||||
|
.couponId(storeCouponUser.getCid())
|
||||||
|
.uid(storeCouponUser.getUid())
|
||||||
|
.templateType(TemplateListenEnum.TYPE_11.getValue())
|
||||||
|
.time(DateUtil.formatTime(new Date()))
|
||||||
|
.build();
|
||||||
|
publisher.publishEvent(new TemplateEvent(this, templateBean));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Scheduled(fixedRate = 20000)
|
||||||
|
public void execute() {
|
||||||
|
log.info("[execute][定时第 ({}) 次执行]", System.currentTimeMillis());
|
||||||
|
// Date now=new Date();
|
||||||
|
// Date endTime = DateUtil.offsetDay(now,1);
|
||||||
|
// List<YxStoreCouponUser> storeCouponUsers=yxStoreCouponUserMapper.selectUserCouponList(endTime);
|
||||||
|
// storeCouponUsers.forEach(storeCouponUser->{
|
||||||
|
// //这里调用微信订阅模板发送消息
|
||||||
|
// TemplateBean templateBean = TemplateBean.builder()
|
||||||
|
// .couponId(storeCouponUser.getCid())
|
||||||
|
// .uid(storeCouponUser.getUid())
|
||||||
|
// .templateType(TemplateListenEnum.TYPE_11.getValue())
|
||||||
|
// .time(DateUtil.formatTime(new Date()))
|
||||||
|
// .build();
|
||||||
|
// publisher.publishEvent(new TemplateEvent(this, templateBean));
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//每个月最后一天23:30生成该月的榜单
|
||||||
|
@Scheduled(cron = "0 30 23 L * ?")
|
||||||
|
public void setYxStoreHotListRecord(){
|
||||||
|
log.info("=====>>>>>使用cron {}",System.currentTimeMillis());
|
||||||
|
log.info("=====>>>>>使用cron {}",System.currentTimeMillis());
|
||||||
|
LambdaQueryWrapper<YxStoreProduct> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
||||||
|
.eq(YxStoreProduct::getIsDel, CommonEnum.DEL_STATUS_0.getValue())
|
||||||
|
.eq(YxStoreProduct::getIsHotList,ShopCommonEnum.SHOW_1.getValue());
|
||||||
|
Calendar calender = Calendar.getInstance();
|
||||||
|
int yearMonth = calender.get(Calendar.MONTH) + 1; //月份
|
||||||
|
int year = calender.get(Calendar.YEAR); //年
|
||||||
|
String mouth= year+"-"+ (yearMonth > 10 ? yearMonth : ('0' + yearMonth));
|
||||||
|
//查询所有参与榜单评比的商品
|
||||||
|
List<YxStoreProduct> list=storeProductMapper.selectList(wrapper);
|
||||||
|
list.forEach(yxStoreProduct -> {
|
||||||
|
yxStoreHotListRecord.setHotListId(yxStoreProduct.getHotListId()) //榜单id
|
||||||
|
.setProductId(yxStoreProduct.getId()) //商品id
|
||||||
|
.setPrice(yxStoreProduct.getPrice()) //入榜价格
|
||||||
|
.setCateId(yxStoreProduct.getCateId()) //商品分类
|
||||||
|
.setMouth(mouth) //当月月份
|
||||||
|
.setHotSales(yxStoreProduct.getHotSales()==null?yxStoreProduct.getSales():yxStoreProduct.getHotSales()); //商品榜单虚拟销量,没填就使用真实销量
|
||||||
|
//每个商品添加一条评比记录
|
||||||
|
yxStoreHotListRecordService.save(yxStoreHotListRecord);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
+97
@@ -0,0 +1,97 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.hotList.service.impl;
|
||||||
|
|
||||||
|
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||||
|
import co.yixiang.common.utils.QueryHelpPlus;
|
||||||
|
import co.yixiang.domain.PageResult;
|
||||||
|
import co.yixiang.dozer.service.IGenerator;
|
||||||
|
import co.yixiang.modules.category.service.YxStoreCategoryService;
|
||||||
|
import co.yixiang.modules.category.service.mapper.StoreCategoryMapper;
|
||||||
|
import co.yixiang.modules.hotList.domain.YxStoreHotListRecord;
|
||||||
|
import co.yixiang.modules.hotList.service.YxStoreHotListRecordService;
|
||||||
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListRecordDto;
|
||||||
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListRecordQueryCriteria;
|
||||||
|
import co.yixiang.modules.hotList.service.mapper.YxStoreHotListMapper;
|
||||||
|
import co.yixiang.modules.hotList.service.mapper.YxStoreHotListRecordMapper;
|
||||||
|
import co.yixiang.modules.product.service.YxStoreProductService;
|
||||||
|
import co.yixiang.utils.FileUtil;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
/**
|
||||||
|
* @author sj
|
||||||
|
* @date 2022-11-03
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
//@CacheConfig(cacheNames = "yxStoreHotListRecord")
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||||
|
public class YxStoreHotListRecordServiceImpl extends BaseServiceImpl<YxStoreHotListRecordMapper, YxStoreHotListRecord> implements YxStoreHotListRecordService {
|
||||||
|
|
||||||
|
private final IGenerator generator;
|
||||||
|
private final YxStoreHotListMapper yxStoreHotListMapper;
|
||||||
|
private final YxStoreHotListRecordMapper yxStoreHotListRecordMapper;
|
||||||
|
private final StoreCategoryMapper storeCategoryMapper;
|
||||||
|
|
||||||
|
private final YxStoreCategoryService storeCategoryService;
|
||||||
|
private final YxStoreProductService yxStoreProductService;
|
||||||
|
@Override
|
||||||
|
//@Cacheable
|
||||||
|
public PageResult<YxStoreHotListRecordDto> queryAll(YxStoreHotListRecordQueryCriteria criteria, Pageable pageable) {
|
||||||
|
getPage(pageable);
|
||||||
|
PageInfo<YxStoreHotListRecord> page = new PageInfo<>(queryAll(criteria));
|
||||||
|
PageResult<YxStoreHotListRecordDto> result=generator.convertPageInfo(page,YxStoreHotListRecordDto.class);
|
||||||
|
result.getContent().forEach(i->{
|
||||||
|
i.setHotListName(yxStoreHotListMapper.selectById(i.getHotListId()).getListName());
|
||||||
|
i.setCateName(storeCategoryMapper.selectById(i.getCateId()).getCateName());
|
||||||
|
i.setProductName(yxStoreProductService.getById(i.getProductId()).getStoreName());
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
//@Cacheable
|
||||||
|
public List<YxStoreHotListRecord> queryAll(YxStoreHotListRecordQueryCriteria criteria){
|
||||||
|
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreHotListRecord.class, criteria));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void download(List<YxStoreHotListRecordDto> all, HttpServletResponse response) throws IOException {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for (YxStoreHotListRecordDto yxStoreHotListRecord : all) {
|
||||||
|
Map<String,Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("商品id", yxStoreHotListRecord.getProductId());
|
||||||
|
map.put("榜单id", yxStoreHotListRecord.getHotListId());
|
||||||
|
map.put("入榜价格", yxStoreHotListRecord.getPrice());
|
||||||
|
map.put("入榜时候销量", yxStoreHotListRecord.getHotSales());
|
||||||
|
map.put("商品分类id", yxStoreHotListRecord.getCateId());
|
||||||
|
map.put("当前榜单所属时间月份", yxStoreHotListRecord.getMouth());
|
||||||
|
map.put("是否显示", yxStoreHotListRecord.getIsShow());
|
||||||
|
map.put("添加时间", yxStoreHotListRecord.getCreateTime());
|
||||||
|
map.put(" updateTime", yxStoreHotListRecord.getUpdateTime());
|
||||||
|
map.put("删除状态", yxStoreHotListRecord.getIsDel());
|
||||||
|
map.put(" tenantId", yxStoreHotListRecord.getTenantId());
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(list, response);
|
||||||
|
}
|
||||||
|
}
|
||||||
+194
-30
@@ -8,9 +8,28 @@
|
|||||||
*/
|
*/
|
||||||
package co.yixiang.modules.hotList.service.impl;
|
package co.yixiang.modules.hotList.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import co.yixiang.enums.CommonEnum;
|
||||||
|
import co.yixiang.enums.SortEnum;
|
||||||
|
import co.yixiang.event.TemplateBean;
|
||||||
|
import co.yixiang.event.TemplateEvent;
|
||||||
|
import co.yixiang.event.TemplateListenEnum;
|
||||||
import co.yixiang.exception.ErrorRequestException;
|
import co.yixiang.exception.ErrorRequestException;
|
||||||
|
import co.yixiang.modules.activity.domain.YxStoreCouponUser;
|
||||||
|
import co.yixiang.modules.activity.service.mapper.YxStoreCouponUserMapper;
|
||||||
|
import co.yixiang.modules.cart.domain.YxStoreCart;
|
||||||
|
import co.yixiang.modules.category.service.mapper.StoreCategoryMapper;
|
||||||
|
import co.yixiang.modules.hotList.domain.YxStoreHotListRecord;
|
||||||
|
import co.yixiang.modules.hotList.service.mapper.YxStoreHotListRecordMapper;
|
||||||
import co.yixiang.modules.product.service.mapper.StoreProductMapper;
|
import co.yixiang.modules.product.service.mapper.StoreProductMapper;
|
||||||
|
import co.yixiang.modules.product.vo.YxStoreProductQueryVo;
|
||||||
|
import co.yixiang.utils.StringUtils;
|
||||||
|
import co.yixiang.utils.hotListDto.CateDto;
|
||||||
|
import co.yixiang.utils.hotListDto.HotListDataDto;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.SerializationUtils;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||||
@@ -32,6 +51,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
@@ -39,10 +60,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
import co.yixiang.modules.hotList.param.YxStoreHotListRecordQueryParam;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ssj
|
* @author ssj
|
||||||
@@ -58,6 +79,15 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
|
|||||||
private final YxStoreProductService yxStoreProductService;
|
private final YxStoreProductService yxStoreProductService;
|
||||||
|
|
||||||
private final StoreProductMapper storeProductMapper;
|
private final StoreProductMapper storeProductMapper;
|
||||||
|
private final YxStoreHotListRecordMapper yxStoreHotListRecordMapper;
|
||||||
|
|
||||||
|
private final YxStoreHotListMapper yxStoreHotListMapper;
|
||||||
|
private final StoreCategoryMapper storeCategoryMapper;
|
||||||
|
@Autowired
|
||||||
|
private YxStoreCouponUserMapper yxStoreCouponUserMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationEventPublisher publisher;
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@Override
|
@Override
|
||||||
//@Cacheable
|
//@Cacheable
|
||||||
@@ -88,6 +118,20 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
|
|||||||
@Override
|
@Override
|
||||||
//@Cacheable
|
//@Cacheable
|
||||||
public List<YxStoreHotList> queryAll(YxStoreHotListQueryCriteria criteria){
|
public List<YxStoreHotList> queryAll(YxStoreHotListQueryCriteria criteria){
|
||||||
|
//查出所有用户拥有的券使用时间小于24小时且未使用的券
|
||||||
|
Date now=new Date();
|
||||||
|
Date endTime = DateUtil.offsetDay(now,1);
|
||||||
|
List<YxStoreCouponUser> storeCouponUsers=yxStoreCouponUserMapper.selectUserCouponList(endTime);
|
||||||
|
storeCouponUsers.forEach(storeCouponUser->{
|
||||||
|
//这里调用微信订阅模板发送消息
|
||||||
|
TemplateBean templateBean = TemplateBean.builder()
|
||||||
|
.couponId(storeCouponUser.getCid())
|
||||||
|
.uid(storeCouponUser.getUid())
|
||||||
|
.templateType(TemplateListenEnum.TYPE_11.getValue())
|
||||||
|
.time(DateUtil.formatTime(new Date()))
|
||||||
|
.build();
|
||||||
|
publisher.publishEvent(new TemplateEvent(this, templateBean));
|
||||||
|
});
|
||||||
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreHotList.class, criteria));
|
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreHotList.class, criteria));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,41 +154,161 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
|
|||||||
FileUtil.downloadExcel(list, response);
|
FileUtil.downloadExcel(list, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
*获取所有拥有榜单的月份,并获取对应榜单
|
||||||
|
* ***/
|
||||||
|
public Map<String,Object>getHotListDataList(){
|
||||||
|
Map<String, Object> map=new HashMap<>();
|
||||||
|
LambdaQueryWrapper<YxStoreHotListRecord> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(YxStoreHotListRecord::getIsShow, ShopCommonEnum.SHOW_1.getValue());
|
||||||
|
wrapper.eq(YxStoreHotListRecord::getIsDel, CommonEnum.DEL_STATUS_0.getValue());
|
||||||
|
//获取所有评测列表(后期限制一年?)
|
||||||
|
List<YxStoreHotListRecord> list=yxStoreHotListRecordMapper.selectList(wrapper);
|
||||||
|
//获取月份
|
||||||
|
LinkedHashSet<String> mouthList=new LinkedHashSet<>();
|
||||||
|
list.forEach(yxStoreHotListRecord -> mouthList.add(yxStoreHotListRecord.getMouth()));
|
||||||
|
map.put("mouthList",mouthList);
|
||||||
|
mouthList.forEach(mouth->{
|
||||||
|
LambdaQueryWrapper<YxStoreHotListRecord> wrapper2= SerializationUtils.clone(wrapper);
|
||||||
|
//当前月份的所有榜单记录信息
|
||||||
|
List<YxStoreHotListRecord> recordList=yxStoreHotListRecordMapper.selectList(wrapper2.eq(YxStoreHotListRecord::getMouth,mouth));
|
||||||
|
LinkedHashSet<Integer> hotIdList=new LinkedHashSet<>();
|
||||||
|
//获得不重复的榜单信息
|
||||||
|
recordList.forEach(cate->{
|
||||||
|
if(ObjectUtil.isNotNull(yxStoreHotListMapper.selectById(cate.getHotListId()))){
|
||||||
|
hotIdList.add(cate.getHotListId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ArrayList<HotListDTO> hotListDTOS=new ArrayList<>();
|
||||||
|
hotIdList.forEach(hotId->{
|
||||||
|
LambdaQueryWrapper<YxStoreHotListRecord> wrapper1= SerializationUtils.clone(wrapper);
|
||||||
|
//查出当前月份当前榜单的记录
|
||||||
|
List<YxStoreHotListRecord> recordCateList=yxStoreHotListRecordMapper.selectList(wrapper1.eq(YxStoreHotListRecord::getHotListId,hotId).eq(YxStoreHotListRecord::getMouth,mouth));
|
||||||
|
LinkedHashSet<String> cateIdList=new LinkedHashSet<>();
|
||||||
|
//获得不重复的商品分类id
|
||||||
|
recordCateList.forEach(cate->{
|
||||||
|
if(ObjectUtil.isNotNull(storeCategoryMapper.selectById(cate.getCateId())))
|
||||||
|
cateIdList.add(cate.getCateId());
|
||||||
|
});
|
||||||
|
ArrayList<CateDto> cateDtos=new ArrayList<>();
|
||||||
|
//把该榜单下的分类封为一个数组
|
||||||
|
cateIdList.forEach(cateId->cateDtos.add(new CateDto().setCateId(Long.valueOf(cateId)).setCateName(storeCategoryMapper.selectById(cateId).getCateName())));
|
||||||
|
hotListDTOS.add(new HotListDTO().setId(Math.toIntExact(hotId)).setListName(yxStoreHotListMapper.selectById(hotId).getListName())
|
||||||
|
.setCateDtos(cateDtos)
|
||||||
|
.setListImage(yxStoreHotListMapper.selectById(hotId).getListImage()));
|
||||||
|
});
|
||||||
|
map.put(mouth,new HotListDataDto().setHotListDTOS(hotListDTOS));
|
||||||
|
//当前月份所有的商品分类
|
||||||
|
});
|
||||||
|
return map;
|
||||||
|
};
|
||||||
|
/***
|
||||||
|
*根据榜单,分类,时间等获取商品信息
|
||||||
|
* ***/
|
||||||
@Override
|
@Override
|
||||||
public List<HotListDTO> getList(String mouth) {
|
public List<YxStoreProduct> getList(YxStoreHotListRecordQueryParam queryParam) {
|
||||||
LambdaQueryWrapper<YxStoreHotList> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<YxStoreHotListRecord> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(YxStoreHotList::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
wrapper.eq(YxStoreHotListRecord::getIsShow, ShopCommonEnum.SHOW_1.getValue());
|
||||||
.orderByAsc(YxStoreHotList::getSort)
|
wrapper.eq(YxStoreHotListRecord::getIsDel, CommonEnum.DEL_STATUS_0.getValue());
|
||||||
.eq(YxStoreHotList::getMouth,mouth);
|
//按照商品分类id
|
||||||
return getHotListDTOS(wrapper);
|
if (queryParam.getCateId()!=null){
|
||||||
|
wrapper.eq(YxStoreHotListRecord::getCateId,queryParam.getCateId());
|
||||||
|
}
|
||||||
|
//评测id
|
||||||
|
if (queryParam.getHotListId()!=null){
|
||||||
|
wrapper.eq(YxStoreHotListRecord::getHotListId,queryParam.getHotListId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(queryParam.getMouth())){
|
||||||
|
wrapper.eq(YxStoreHotListRecord::getMouth,queryParam.getMouth());
|
||||||
|
}
|
||||||
|
//默认销量降序排序
|
||||||
|
if (SortEnum.DESC.getValue().equals(queryParam.getSalesOrder())) {
|
||||||
|
wrapper.orderByDesc(YxStoreHotListRecord::getHotSales);
|
||||||
|
} else if (SortEnum.ASC.getValue().equals(queryParam.getSalesOrder())) {
|
||||||
|
wrapper.orderByAsc(YxStoreHotListRecord::getHotSales);
|
||||||
|
}
|
||||||
|
//价格排序
|
||||||
|
if (SortEnum.DESC.getValue().equals(queryParam.getPriceOrder())) {
|
||||||
|
wrapper.orderByDesc(YxStoreHotListRecord::getPrice);
|
||||||
|
} else if (SortEnum.ASC.getValue().equals(queryParam.getPriceOrder())) {
|
||||||
|
wrapper.orderByAsc(YxStoreHotListRecord::getPrice);
|
||||||
|
}
|
||||||
|
Page<YxStoreHotListRecord> pageModel = new Page<>(queryParam.getPage(), queryParam.getLimit());
|
||||||
|
|
||||||
|
IPage<YxStoreHotListRecord> pageList = yxStoreHotListRecordMapper.selectPage(pageModel, wrapper);
|
||||||
|
List<YxStoreProduct> list =new ArrayList<>();
|
||||||
|
pageList.getRecords().forEach(yxStoreHotListRecord -> {
|
||||||
|
YxStoreProduct yxStoreProduct=storeProductMapper.selectById(yxStoreHotListRecord.getProductId());
|
||||||
|
if (ObjectUtil.isNotNull(yxStoreProduct)){
|
||||||
|
list.add(yxStoreProduct);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@Override
|
@Override
|
||||||
public List<HotListDTO> getList() {
|
public List<HotListDTO> getList() {
|
||||||
LambdaQueryWrapper<YxStoreHotList> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<YxStoreHotListRecord> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(YxStoreHotList::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
wrapper.eq(YxStoreHotListRecord::getIsShow, ShopCommonEnum.SHOW_1.getValue());
|
||||||
.orderByAsc(YxStoreHotList::getSort);
|
wrapper.eq(YxStoreHotListRecord::getIsDel, CommonEnum.DEL_STATUS_0.getValue());
|
||||||
return getHotListDTOS(wrapper);
|
//获取所有评测列表(后期限制一年?)
|
||||||
|
List<YxStoreHotListRecord> list=yxStoreHotListRecordMapper.selectList(wrapper);
|
||||||
|
//获取月份
|
||||||
|
LinkedHashSet<String> mouthList=new LinkedHashSet<>();
|
||||||
|
list.forEach(yxStoreHotListRecord -> mouthList.add(yxStoreHotListRecord.getMouth()));
|
||||||
|
String mouth=Collections.max(mouthList);
|
||||||
|
List<YxStoreHotListRecord> recordList=yxStoreHotListRecordMapper.selectList(wrapper.eq(YxStoreHotListRecord::getMouth,mouth));
|
||||||
|
LinkedHashSet<Integer> hotIdList=new LinkedHashSet<>();
|
||||||
|
//获得不重复的榜单信息
|
||||||
|
recordList.forEach(cate->{
|
||||||
|
if(ObjectUtil.isNotNull(yxStoreHotListMapper.selectById(cate.getHotListId()))){
|
||||||
|
hotIdList.add(cate.getHotListId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ArrayList<HotListDTO> hotListDTOS=new ArrayList<>();
|
||||||
|
hotIdList.forEach(hotId->{
|
||||||
|
LambdaQueryWrapper<YxStoreHotListRecord> wrapper1= SerializationUtils.clone(wrapper);
|
||||||
|
//查出当前月份当前榜单的记录
|
||||||
|
List<YxStoreHotListRecord> recordCateList=yxStoreHotListRecordMapper.selectList(wrapper1.eq(YxStoreHotListRecord::getHotListId,hotId).eq(YxStoreHotListRecord::getMouth,mouth));
|
||||||
|
//获得不重复的商品分类id
|
||||||
|
LinkedHashSet<String> cateIdList=new LinkedHashSet<>();
|
||||||
|
//当前榜单下的商品信息
|
||||||
|
List<YxStoreProduct> productInfo=new ArrayList<>();
|
||||||
|
//获得不重复的商品分类id
|
||||||
|
recordCateList.forEach(cate->{
|
||||||
|
if(ObjectUtil.isNotNull(storeCategoryMapper.selectById(cate.getCateId()))){
|
||||||
|
cateIdList.add(cate.getCateId());
|
||||||
|
}
|
||||||
|
productInfo.add(storeProductMapper.selectById(cate.getProductId()));
|
||||||
|
});
|
||||||
|
ArrayList<CateDto> cateDtos=new ArrayList<>();
|
||||||
|
//把该榜单下的分类封为一个数组
|
||||||
|
cateIdList.forEach(cateId->cateDtos.add(new CateDto().setCateId(Long.valueOf(cateId)).setCateName(storeCategoryMapper.selectById(cateId).getCateName())));
|
||||||
|
hotListDTOS.add(new HotListDTO().setId(Math.toIntExact(hotId)).setListName(yxStoreHotListMapper.selectById(hotId).getListName())
|
||||||
|
.setCateDtos(cateDtos)
|
||||||
|
.setProductInfo(productInfo)
|
||||||
|
.setListImage(yxStoreHotListMapper.selectById(hotId).getListImage()));
|
||||||
|
});
|
||||||
|
return hotListDTOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private List<HotListDTO> getHotListDTOS(LambdaQueryWrapper<YxStoreHotList> wrapper) {
|
private List<HotListDTO> getHotListDTOS(LambdaQueryWrapper<YxStoreHotList> wrapper) {
|
||||||
List<HotListDTO> list = generator.convert(baseMapper.selectList(wrapper),HotListDTO.class);
|
List<HotListDTO> list = generator.convert(baseMapper.selectList(wrapper),HotListDTO.class);
|
||||||
list.forEach(hotListDto->{
|
// list.forEach(hotListDto->{
|
||||||
List<Integer> productArr = JSONUtil.toList(hotListDto.getProductList(), Integer.class);
|
// List<Integer> productArr = JSONUtil.toList(hotListDto.getProductList(), Integer.class);
|
||||||
List<YxStoreProduct> list1 =new ArrayList<>();
|
// List<YxStoreProduct> list1 =new ArrayList<>();
|
||||||
productArr.forEach(productId->{
|
// productArr.forEach(productId->{
|
||||||
LambdaQueryWrapper<YxStoreProduct> wrapper1 = new LambdaQueryWrapper<>();
|
// LambdaQueryWrapper<YxStoreProduct> wrapper1 = new LambdaQueryWrapper<>();
|
||||||
wrapper1.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
// wrapper1.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
||||||
.eq(YxStoreProduct::getId, productId);
|
// .eq(YxStoreProduct::getId, productId);
|
||||||
YxStoreProduct yxStoreProduct = storeProductMapper.selectOne(wrapper1);
|
// YxStoreProduct yxStoreProduct = storeProductMapper.selectOne(wrapper1);
|
||||||
//这里需要有一个非空判断,找不到这个商品就不加
|
// //这里需要有一个非空判断,找不到这个商品就不加
|
||||||
if (ObjectUtil.isNotNull(yxStoreProduct)){
|
// if (ObjectUtil.isNotNull(yxStoreProduct)){
|
||||||
list1.add(yxStoreProduct);
|
// list1.add(yxStoreProduct);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
hotListDto.setProductInfo(list1);
|
// hotListDto.setProductInfo(list1);
|
||||||
});
|
// });
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.hotList.service.mapper;
|
||||||
|
|
||||||
|
import co.yixiang.common.mapper.CoreMapper;
|
||||||
|
import co.yixiang.logging.domain.Log;
|
||||||
|
import co.yixiang.modules.hotList.domain.YxStoreHotListRecord;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2022-11-03
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface YxStoreHotListRecordMapper extends CoreMapper<YxStoreHotListRecord> {
|
||||||
|
|
||||||
|
// @Select("select l.id,l.create_time as createTime,l.description, l.request_ip as requestIp,l.address,u.nickname from log l " +
|
||||||
|
// " left join yx_user u on u.uid=l.uid where l.type=1 " +
|
||||||
|
// " <if test = \"nickname !=null\"> and u.nickname LIKE CONCAT('%',#{nickname},'%')</if> order by l.id desc")
|
||||||
|
// List<YxStoreHotListRecord> list selectRecordList();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -256,6 +256,14 @@ public class YxStoreProduct extends BaseDomain {
|
|||||||
@ApiModelProperty(value = "是否开启积分兑换")
|
@ApiModelProperty(value = "是否开启积分兑换")
|
||||||
private Integer isIntegral;
|
private Integer isIntegral;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否参与榜单评比")
|
||||||
|
private Integer isHotList;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所参与评比的榜单的id")
|
||||||
|
private Integer hotListId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所参与评比的榜单的虚拟销量")
|
||||||
|
private Integer hotSales;
|
||||||
//商品对应的分类
|
//商品对应的分类
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private YxStoreCategory storeCategory;
|
private YxStoreCategory storeCategory;
|
||||||
|
|||||||
@@ -143,8 +143,8 @@ public class StoreProductController {
|
|||||||
}
|
}
|
||||||
Long count1 = yxStoreHotListMapper
|
Long count1 = yxStoreHotListMapper
|
||||||
.selectCount(Wrappers.<YxStoreHotList>lambdaQuery()
|
.selectCount(Wrappers.<YxStoreHotList>lambdaQuery()
|
||||||
.eq(YxStoreHotList::getIsShow,1)
|
.eq(YxStoreHotList::getIsShow,1));
|
||||||
.like(YxStoreHotList::getProductList,id));
|
// .like(YxStoreHotList::getProductList,id));
|
||||||
//此商品被热门榜单绑定,不能删除
|
//此商品被热门榜单绑定,不能删除
|
||||||
if(count1 > 0) {
|
if(count1 > 0) {
|
||||||
//不能删除
|
//不能删除
|
||||||
@@ -212,6 +212,9 @@ public class StoreProductController {
|
|||||||
ProductDto productDto = new ProductDto();
|
ProductDto productDto = new ProductDto();
|
||||||
productDto.setParameter(yxStoreProduct.getParameter());
|
productDto.setParameter(yxStoreProduct.getParameter());
|
||||||
productDto.setConfig(yxStoreProduct.getConfig());
|
productDto.setConfig(yxStoreProduct.getConfig());
|
||||||
|
productDto.setIsHotList(yxStoreProduct.getIsHotList());
|
||||||
|
productDto.setHotListId(yxStoreProduct.getHotListId());
|
||||||
|
productDto.setHotSales(yxStoreProduct.getHotSales());
|
||||||
BeanUtil.copyProperties(yxStoreProduct,productDto,"sliderImage");
|
BeanUtil.copyProperties(yxStoreProduct,productDto,"sliderImage");
|
||||||
productDto.setSliderImage(Arrays.asList(yxStoreProduct.getSliderImage().split(",")));
|
productDto.setSliderImage(Arrays.asList(yxStoreProduct.getSliderImage().split(",")));
|
||||||
YxStoreProductAttrResult storeProductAttrResult = yxStoreProductAttrResultService
|
YxStoreProductAttrResult storeProductAttrResult = yxStoreProductAttrResultService
|
||||||
@@ -230,7 +233,6 @@ public class StoreProductController {
|
|||||||
productDto.setAttrs(productFormatDtos);
|
productDto.setAttrs(productFormatDtos);
|
||||||
productDto.setItems(result.getObject("attr",ArrayList.class));
|
productDto.setItems(result.getObject("attr",ArrayList.class));
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
productFromat(productDto, result);
|
productFromat(productDto, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -589,8 +589,8 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
}
|
}
|
||||||
Long count1 = yxStoreHotListMapper
|
Long count1 = yxStoreHotListMapper
|
||||||
.selectCount(Wrappers.<YxStoreHotList>lambdaQuery()
|
.selectCount(Wrappers.<YxStoreHotList>lambdaQuery()
|
||||||
.eq(YxStoreHotList::getIsShow,1)
|
.eq(YxStoreHotList::getIsShow,1));
|
||||||
.like(YxStoreHotList::getProductList,id));
|
// .like(YxStoreHotList::getProductList,id));
|
||||||
//此商品被热门榜单绑定,不能下架
|
//此商品被热门榜单绑定,不能下架
|
||||||
if(count1 > 0) {
|
if(count1 > 0) {
|
||||||
throw new YshopException("当前商品已绑定热门榜单,不能被下架");
|
throw new YshopException("当前商品已绑定热门榜单,不能被下架");
|
||||||
@@ -622,6 +622,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
throw new YshopException("请上传轮播图");
|
throw new YshopException("请上传轮播图");
|
||||||
}
|
}
|
||||||
yxStoreProduct.setConfig(storeProductDto.getConfig());
|
yxStoreProduct.setConfig(storeProductDto.getConfig());
|
||||||
|
yxStoreProduct.setIsHotList(storeProductDto.getIsHotList());
|
||||||
|
yxStoreProduct.setHotListId(storeProductDto.getHotListId());
|
||||||
|
yxStoreProduct.setHotSales(storeProductDto.getHotSales());
|
||||||
yxStoreProduct.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice()));
|
yxStoreProduct.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice()));
|
||||||
yxStoreProduct.setOtPrice(BigDecimal.valueOf(resultDTO.getMinOtPrice()));
|
yxStoreProduct.setOtPrice(BigDecimal.valueOf(resultDTO.getMinOtPrice()));
|
||||||
yxStoreProduct.setCost(BigDecimal.valueOf(resultDTO.getMinCost()));
|
yxStoreProduct.setCost(BigDecimal.valueOf(resultDTO.getMinCost()));
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package co.yixiang.utils;
|
package co.yixiang.utils;
|
||||||
|
|
||||||
import co.yixiang.modules.product.domain.YxStoreProduct;
|
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||||
|
import co.yixiang.utils.hotListDto.CateDto;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.sql.Array;
|
import java.sql.Array;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -22,8 +24,8 @@ public class HotListDTO implements Serializable {
|
|||||||
/** 榜单名称 */
|
/** 榜单名称 */
|
||||||
private String listName;
|
private String listName;
|
||||||
|
|
||||||
/**商品数组*/
|
//当月所有的商品分类
|
||||||
private String productList;
|
private ArrayList<CateDto> cateDtos;
|
||||||
|
|
||||||
// /**商品信息数组**/
|
// /**商品信息数组**/
|
||||||
private List<YxStoreProduct> productInfo;
|
private List<YxStoreProduct> productInfo;
|
||||||
|
|||||||
@@ -3,17 +3,25 @@ package co.yixiang.utils;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import co.yixiang.constant.SystemConfigConstants;
|
import co.yixiang.constant.SystemConfigConstants;
|
||||||
|
import co.yixiang.enums.CommonEnum;
|
||||||
|
import co.yixiang.enums.ShopCommonEnum;
|
||||||
import co.yixiang.event.TemplateBean;
|
import co.yixiang.event.TemplateBean;
|
||||||
import co.yixiang.event.TemplateEvent;
|
import co.yixiang.event.TemplateEvent;
|
||||||
import co.yixiang.event.TemplateListenEnum;
|
import co.yixiang.event.TemplateListenEnum;
|
||||||
import co.yixiang.modules.activity.domain.YxStoreCouponUser;
|
import co.yixiang.modules.activity.domain.YxStoreCouponUser;
|
||||||
import co.yixiang.modules.activity.service.mapper.YxStoreCouponUserMapper;
|
import co.yixiang.modules.activity.service.mapper.YxStoreCouponUserMapper;
|
||||||
|
import co.yixiang.modules.hotList.domain.YxStoreHotListRecord;
|
||||||
|
import co.yixiang.modules.hotList.service.YxStoreHotListRecordService;
|
||||||
import co.yixiang.modules.order.service.YxStoreOrderService;
|
import co.yixiang.modules.order.service.YxStoreOrderService;
|
||||||
import co.yixiang.modules.order.service.dto.YxStoreOrderDto;
|
import co.yixiang.modules.order.service.dto.YxStoreOrderDto;
|
||||||
|
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||||
|
import co.yixiang.modules.product.service.YxStoreProductService;
|
||||||
|
import co.yixiang.modules.product.service.mapper.StoreProductMapper;
|
||||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||||
import co.yixiang.utils.WxTemplate.TemplateCard;
|
import co.yixiang.utils.WxTemplate.TemplateCard;
|
||||||
import co.yixiang.utils.WxTemplate.dto.*;
|
import co.yixiang.utils.WxTemplate.dto.*;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.http.HttpStatus;
|
import org.apache.http.HttpStatus;
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
@@ -43,37 +51,6 @@ public class WxbotMsgUtil {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private YxSystemConfigService systemConfigService;
|
private YxSystemConfigService systemConfigService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private YxStoreCouponUserMapper yxStoreCouponUserMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ApplicationEventPublisher publisher;
|
|
||||||
|
|
||||||
//定时器,每天下午17点触发
|
|
||||||
@Scheduled(cron = "0 0 17 * * ?")
|
|
||||||
public void scheduled(){
|
|
||||||
log.info("=====>>>>>使用cron {}",System.currentTimeMillis());
|
|
||||||
log.info("=====>>>>>使用cron {}",System.currentTimeMillis());
|
|
||||||
log.info("=====>>>>>使用cron {}",System.currentTimeMillis());
|
|
||||||
log.info("=====>>>>>使用cron {}",System.currentTimeMillis());
|
|
||||||
log.info("=====>>>>>使用cron {}",System.currentTimeMillis());
|
|
||||||
//查出所有用户拥有的券使用时间小于24小时且未使用的券
|
|
||||||
Date now=new Date();
|
|
||||||
Date endTime = DateUtil.offsetDay(now,1);
|
|
||||||
List<YxStoreCouponUser> storeCouponUsers=yxStoreCouponUserMapper.selectUserCouponList(endTime);
|
|
||||||
storeCouponUsers.forEach(storeCouponUser->{
|
|
||||||
//这里调用微信订阅模板发送消息
|
|
||||||
TemplateBean templateBean = TemplateBean.builder()
|
|
||||||
.couponId(storeCouponUser.getCid())
|
|
||||||
.uid(storeCouponUser.getUid())
|
|
||||||
.templateType(TemplateListenEnum.TYPE_10.getValue())
|
|
||||||
.time(DateUtil.formatTime(new Date()))
|
|
||||||
.build();
|
|
||||||
publisher.publishEvent(new TemplateEvent(this, templateBean));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void inform(long orderId, int type) throws IOException {
|
public void inform(long orderId, int type) throws IOException {
|
||||||
CloseableHttpClient httpClient = HttpClients.createDefault();//实例化对象
|
CloseableHttpClient httpClient = HttpClients.createDefault();//实例化对象
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package co.yixiang.utils.hotListDto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CateDto {
|
||||||
|
//分类id
|
||||||
|
private Long cateId;
|
||||||
|
//分类名
|
||||||
|
private String cateName;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package co.yixiang.utils.hotListDto;
|
||||||
|
|
||||||
|
import co.yixiang.utils.HotListDTO;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class HotListDataDto implements Serializable {
|
||||||
|
|
||||||
|
//当月的榜单信息
|
||||||
|
private ArrayList<HotListDTO> hotListDTOS;
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user