Search in sources :

Example 1 with YxStoreCouponUserDto

use of co.yixiang.modules.activity.service.dto.YxStoreCouponUserDto in project yshopmall by guchengwuyue.

the class YxStoreCouponUserServiceImpl method queryAll.

@Override
public // @Cacheable
Map<String, Object> queryAll(YxStoreCouponUserQueryCriteria criteria, Pageable pageable) {
    getPage(pageable);
    PageInfo<YxStoreCouponUser> page = new PageInfo<>(queryAll(criteria));
    List<YxStoreCouponUserDto> storeOrderDTOS = generator.convert(page.getList(), YxStoreCouponUserDto.class);
    for (YxStoreCouponUserDto couponUserDTO : storeOrderDTOS) {
        YxUser yxUser = userService.getOne(new LambdaQueryWrapper<YxUser>().eq(YxUser::getUid, couponUserDTO.getUid()));
        if (yxUser == null) {
            couponUserDTO.setNickname("--");
            continue;
        }
        couponUserDTO.setNickname(yxUser.getNickname());
    }
    Map<String, Object> map = new LinkedHashMap<>(2);
    map.put("content", storeOrderDTOS);
    map.put("totalElements", page.getTotal());
    return map;
}
Also used : PageInfo(com.github.pagehelper.PageInfo) YxStoreCouponUserDto(co.yixiang.modules.activity.service.dto.YxStoreCouponUserDto) YxUser(co.yixiang.modules.shop.domain.YxUser) YxStoreCouponUser(co.yixiang.modules.activity.domain.YxStoreCouponUser) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with YxStoreCouponUserDto

use of co.yixiang.modules.activity.service.dto.YxStoreCouponUserDto in project yshopmall by guchengwuyue.

the class YxStoreCouponUserServiceImpl method download.

@Override
public void download(List<YxStoreCouponUserDto> all, HttpServletResponse response) throws IOException {
    List<Map<String, Object>> list = new ArrayList<>();
    for (YxStoreCouponUserDto yxStoreCouponUser : all) {
        Map<String, Object> map = new LinkedHashMap<>();
        map.put("兑换的项目id", yxStoreCouponUser.getCid());
        map.put("优惠券所属用户", yxStoreCouponUser.getUid());
        map.put("优惠券名称", yxStoreCouponUser.getCouponTitle());
        map.put("优惠券的面值", yxStoreCouponUser.getCouponPrice());
        map.put("最低消费多少金额可用优惠券", yxStoreCouponUser.getUseMinPrice());
        map.put("优惠券结束时间", yxStoreCouponUser.getEndTime());
        map.put("使用时间", yxStoreCouponUser.getUseTime());
        map.put("获取方式", yxStoreCouponUser.getType());
        map.put("状态(0:未使用,1:已使用, 2:已过期)", yxStoreCouponUser.getStatus());
        map.put("是否有效", yxStoreCouponUser.getIsFail());
        list.add(map);
    }
    FileUtil.downloadExcel(list, response);
}
Also used : ArrayList(java.util.ArrayList) YxStoreCouponUserDto(co.yixiang.modules.activity.service.dto.YxStoreCouponUserDto) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

YxStoreCouponUserDto (co.yixiang.modules.activity.service.dto.YxStoreCouponUserDto)2 LinkedHashMap (java.util.LinkedHashMap)2 YxStoreCouponUser (co.yixiang.modules.activity.domain.YxStoreCouponUser)1 YxUser (co.yixiang.modules.shop.domain.YxUser)1 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)1 PageInfo (com.github.pagehelper.PageInfo)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1