35 changed files with 981 additions and 133 deletions
@ -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)); |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
|
||||
|
@ -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); |
||||
} |
||||
} |
@ -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; |
||||
} |
@ -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; |
||||
} |
@ -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); |
||||
}); |
||||
} |
||||
} |
@ -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); |
||||
} |
||||
} |
@ -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();
|
||||
|
||||
} |
@ -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; |
||||
|
||||
} |
Loading…
Reference in new issue