无关风月
2024-12-20 8b4b4eb2a6d06469d0e2a61ec0f8ce4d5953c375
代码
19个文件已修改
6个文件已添加
500 ■■■■■ 已修改文件
manage/pom.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/controller/TAppUserController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/controller/TCouponController.java 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/mapper/TCouponMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/mapper/TCouponReceiveMapper.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/model/TCoupon.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/model/TCouponReceive.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/query/TAppUserCouponQuery.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/query/TAppUserQuery.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/query/TCouponQuery.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/service/TCouponReceiveService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/service/TCouponService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/service/impl/TCouponReceiveServiceImpl.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/service/impl/TCouponServiceImpl.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/utils/QRCodeUtil.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/vo/TAppUserCouponVO.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/vo/TCouponInfoVO.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/vo/TCouponVO.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/resources/mapping/TAppUserMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/resources/mapping/TCouponMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/resources/mapping/TCouponReceiveMapper.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/resources/mapping/TFrameGoods.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/resources/mapping/TInventoryMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/resources/mapping/TLensGoods.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/resources/mapping/TLineUpMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/pom.xml
@@ -18,6 +18,21 @@
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>5.3.9</version>
        </dependency>
        <dependency>
            <groupId>com.google.zxing</groupId>
            <artifactId>core</artifactId>
            <version>3.4.1</version>
        </dependency>
        <dependency>
            <groupId>com.google.zxing</groupId>
            <artifactId>javase</artifactId>
            <version>3.4.1</version>
        </dependency>
        <dependency>
            <groupId>com</groupId>
            <artifactId>common</artifactId>
            <version>0.0.1-SNAPSHOT</version>
manage/src/main/java/com/jilongda/manage/controller/TAppUserController.java
@@ -5,13 +5,17 @@
import com.jilongda.common.basic.ApiResult;
import com.jilongda.common.basic.PageInfo;
import com.jilongda.manage.model.TAppUser;
import com.jilongda.manage.model.TCouponReceive;
import com.jilongda.manage.model.TOptometry;
import com.jilongda.manage.model.TOrder;
import com.jilongda.manage.query.TAppUserCouponQuery;
import com.jilongda.manage.query.TAppUserQuery;
import com.jilongda.manage.query.TOptometristQuery;
import com.jilongda.manage.service.TAppUserService;
import com.jilongda.manage.service.TCouponReceiveService;
import com.jilongda.manage.service.TOptometryService;
import com.jilongda.manage.service.TOrderService;
import com.jilongda.manage.vo.TAppUserCouponVO;
import com.jilongda.manage.vo.TAppUserVO;
import com.jilongda.manage.vo.TOptometristVO;
import io.swagger.annotations.Api;
@@ -42,6 +46,8 @@
    private TOrderService orderService;
    @Resource
    private TOptometryService tOptometryService;
    @Resource
    private TCouponReceiveService couponReceiveService;
    @ApiOperation(value = "用户列表")
    @PostMapping(value = "/pageList")
    public ApiResult<PageInfo<TAppUserVO>> pageList(@RequestBody TAppUserQuery query) {
@@ -91,5 +97,11 @@
        return ApiResult.success(tAppUserVO);
    }
    @ApiOperation(value = "用户详情-查看优惠券")
    @GetMapping(value = "/getCouponDetailById")
    public ApiResult<PageInfo<TAppUserCouponVO>> getCouponDetailById(@RequestBody TAppUserCouponQuery query) {
        PageInfo<TAppUserCouponVO> appUserVOPageInfo = couponReceiveService.pageList(query);
        return ApiResult.success(appUserVOPageInfo);
    }
}
manage/src/main/java/com/jilongda/manage/controller/TCouponController.java
@@ -1,9 +1,49 @@
package com.jilongda.manage.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jilongda.common.basic.ApiResult;
import com.jilongda.common.basic.PageInfo;
import com.jilongda.common.utils.UUIDUtil;
import com.jilongda.manage.dto.TModelDTO;
import com.jilongda.manage.model.TAppUser;
import com.jilongda.manage.model.TCoupon;
import com.jilongda.manage.model.TCouponReceive;
import com.jilongda.manage.model.TModel;
import com.jilongda.manage.query.TAppUserQuery;
import com.jilongda.manage.query.TCouponQuery;
import com.jilongda.manage.service.TAppUserService;
import com.jilongda.manage.service.TCouponReceiveService;
import com.jilongda.manage.service.TCouponService;
import com.jilongda.manage.utils.QRCodeUtil;
import com.jilongda.manage.vo.TAppUserVO;
import com.jilongda.manage.vo.TCouponInfoVO;
import com.jilongda.manage.vo.TCouponVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.tomcat.util.http.fileupload.ByteArrayOutputStream;
import org.springframework.beans.BeanUtils;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
/**
 * <p>
@@ -14,8 +54,116 @@
 * @since 2024-12-09
 */
@RestController
@Api(tags = "优惠券管理")
@RequestMapping("/t-coupon")
public class TCouponController {
    @Resource
    private TCouponService couponService;
    @Resource
    private TCouponReceiveService couponReceiveService;
    @Resource
    private TAppUserService appUserService;
    @ApiOperation(value = "优惠券列表")
    @PostMapping(value = "/pageList")
    public ApiResult<PageInfo<TCouponVO>> pageList(@RequestBody TCouponQuery query) {
        PageInfo<TCouponVO> appUserVOPageInfo = couponService.pageList(query);
        return ApiResult.success(appUserVOPageInfo);
    }
    @ApiOperation(value = "添加优惠券")
    @PostMapping(value = "/add")
    public ApiResult<String> add( @RequestBody TCoupon dto) throws Exception {
        couponService.save(dto);
        switch (dto.getType()){
            case 2:
                // 全局发放
                List<Integer> collect = appUserService.lambdaQuery().list().stream()
                        .map(TAppUser::getId).collect(Collectors.toList());
                List<TCouponReceive> tCouponReceives = new ArrayList<>();
                for (Integer i : collect) {
                    TCouponReceive tCouponReceive = new TCouponReceive();
                    tCouponReceive.setCouponId(dto.getId());
                    tCouponReceive.setUserId(i);
                    tCouponReceive.setType(2);
                    tCouponReceive.setAmount(dto.getAmount());
                    tCouponReceive.setStoreId(dto.getStoreId());
                    if (dto.getTime()!=0){
                        tCouponReceive.setEndTime(LocalDateTime.now().plusDays(dto.getTime()));
                    }
                    tCouponReceive.setAmountCondition(dto.getAmountCondition());
                    tCouponReceive.setStatus(1);
                    tCouponReceives.add(tCouponReceive);
                }
                couponReceiveService.saveBatch(tCouponReceives);
                break;
            case 3:
                List<TCouponReceive> tCouponReceives1 = new ArrayList<>();
                for (Integer userId : dto.getUserIds()) {
                    TCouponReceive tCouponReceive = new TCouponReceive();
                    tCouponReceive.setCouponId(dto.getId());
                    tCouponReceive.setUserId(userId);
                    tCouponReceive.setType(2);
                    tCouponReceive.setAmount(dto.getAmount());
                    tCouponReceive.setStoreId(dto.getStoreId());
                    if (dto.getTime()!=0){
                        tCouponReceive.setEndTime(LocalDateTime.now().plusDays(dto.getTime()));
                    }
                    tCouponReceive.setAmountCondition(dto.getAmountCondition());
                    tCouponReceive.setStatus(1);
                    tCouponReceives1.add(tCouponReceive);
                }
                couponReceiveService.saveBatch(tCouponReceives1);
                break;
            case 4:
                String code = "{\"id\": "+dto.getId()+ "}";
                BufferedImage blueImage = QRCodeUtil.createImage(code);
                MultipartFile blueFile = convert(blueImage, new Date().getTime() + UUIDUtil.getRandomCode(3) + ".PNG");
                // todo 没有云存储
//                String s = OssUploadUtil.ossUpload("img/", blueFile);
                break;
        }
        return ApiResult.success();
    }
    @ApiOperation(value = "修改优惠券")
    @PostMapping(value = "/update")
    public ApiResult<String> update( @RequestBody TCoupon dto) throws Exception {
        couponService.updateById(dto);
        return ApiResult.success();
    }
    @ApiOperation(value = "优惠券详情")
    @PostMapping(value = "/getDetail")
    public ApiResult<TCouponInfoVO> getDetail(Integer id) {
        TCouponInfoVO tCouponInfoVO = new TCouponInfoVO();
        TCoupon byId = couponService.getById(id);
        BeanUtils.copyProperties(byId, tCouponInfoVO);
        int size = couponReceiveService.list(new LambdaQueryWrapper<TCouponReceive>()
                .eq(TCouponReceive::getCouponId, id)).size();
        tCouponInfoVO.setGrantCout(size);
        int size1 = couponReceiveService.list(new LambdaQueryWrapper<TCouponReceive>()
                .eq(TCouponReceive::getCouponId, id)
                .eq(TCouponReceive::getStatus, 2)).size();
        tCouponInfoVO.setUseCount(size1);
        return ApiResult.success(tCouponInfoVO);
    }
    public static MultipartFile convert(BufferedImage bufferedImage, String fileName) throws IOException {
        // 将 BufferedImage 转换为字节数组
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ImageIO.write(bufferedImage, "png", baos);
        byte[] bytes = baos.toByteArray();
        // 创建 ByteArrayResource
        ByteArrayResource resource = new ByteArrayResource(bytes);
        // 创建 MockMultipartFile
        MockMultipartFile multipartFile = new MockMultipartFile(
                "file",
                fileName,
                "image/png",
                resource.getInputStream()
        );
        return multipartFile;
    }
}
manage/src/main/java/com/jilongda/manage/mapper/TCouponMapper.java
@@ -1,7 +1,15 @@
package com.jilongda.manage.mapper;
import com.jilongda.common.basic.PageInfo;
import com.jilongda.manage.model.TCoupon;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jilongda.manage.query.TAppUserQuery;
import com.jilongda.manage.query.TCouponQuery;
import com.jilongda.manage.vo.TAppUserVO;
import com.jilongda.manage.vo.TCouponVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * <p>
@@ -13,4 +21,6 @@
 */
public interface TCouponMapper extends BaseMapper<TCoupon> {
    List<TCouponVO> pageList(@Param("query")TCouponQuery query,@Param("pageInfo") PageInfo<TCouponVO> pageInfo);
}
manage/src/main/java/com/jilongda/manage/mapper/TCouponReceiveMapper.java
@@ -1,7 +1,15 @@
package com.jilongda.manage.mapper;
import com.jilongda.common.basic.PageInfo;
import com.jilongda.manage.model.TCouponReceive;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jilongda.manage.query.TAppUserCouponQuery;
import com.jilongda.manage.query.TAppUserQuery;
import com.jilongda.manage.vo.TAppUserCouponVO;
import com.jilongda.manage.vo.TAppUserVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * <p>
@@ -13,4 +21,7 @@
 */
public interface TCouponReceiveMapper extends BaseMapper<TCouponReceive> {
    List<TAppUserCouponVO> pageList(@Param("query")TAppUserCouponQuery query, @Param("pageInfo")PageInfo<TAppUserCouponVO> pageInfo);
}
manage/src/main/java/com/jilongda/manage/model/TCoupon.java
@@ -7,6 +7,7 @@
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import java.util.List;
import com.jilongda.common.pojo.BaseModel;
import io.swagger.annotations.ApiModel;
@@ -46,11 +47,11 @@
    @TableField("amount")
    private BigDecimal amount;
    @ApiModelProperty(value = "门店id 字段为null表示全部")
    @ApiModelProperty(value = "门店id 空字符串表示不限门店")
    @TableField("storeId")
    private Integer storeId;
    private String storeId;
    @ApiModelProperty(value = "有效期(天)最高365")
    @ApiModelProperty(value = " 有效期(天)最高365 0表示无期限")
    @TableField("time")
    private Integer time;
@@ -62,5 +63,7 @@
    @TableField("grantStatus")
    private Integer grantStatus;
    @ApiModelProperty(value = "指定发放时传 用户id集合")
    @TableField(exist = false)
    private List<Integer> userIds;
}
manage/src/main/java/com/jilongda/manage/model/TCouponReceive.java
@@ -52,11 +52,14 @@
    @ApiModelProperty(value = "门店id 字段为null表示全部")
    @TableField("storeId")
    private Integer storeId;
    private String storeId;
    @ApiModelProperty(value = "有效期截止日期")
    @TableField("endTime")
    private LocalDateTime endTime;
    @ApiModelProperty(value = "使用时间")
    @TableField("useTime")
    private LocalDateTime useTime;
    @ApiModelProperty(value = "优惠条件金额 为0则表示通用券")
    @TableField("amountCondition")
manage/src/main/java/com/jilongda/manage/query/TAppUserCouponQuery.java
New file
@@ -0,0 +1,20 @@
package com.jilongda.manage.query;
import com.jilongda.common.pojo.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
@Data
@ApiModel(value = "用户详情-查看优惠券")
public class TAppUserCouponQuery extends BasePage {
    @ApiModelProperty(value = "用户id")
    private Integer id;
}
manage/src/main/java/com/jilongda/manage/query/TAppUserQuery.java
@@ -6,7 +6,7 @@
import lombok.Data;
@Data
@ApiModel(value = "验光师查询条件")
@ApiModel(value = "用户管理查询条件")
public class TAppUserQuery extends BasePage {
    @ApiModelProperty(value = "微信昵称")
manage/src/main/java/com/jilongda/manage/query/TCouponQuery.java
New file
@@ -0,0 +1,17 @@
package com.jilongda.manage.query;
import com.jilongda.common.pojo.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "用户管理查询条件")
public class TCouponQuery extends BasePage {
    @ApiModelProperty(value = "优惠券名称")
    private String name;
    @ApiModelProperty(value = "发放方式 发放方式 1注册发放 2全局发放 3指定发放 4扫码发放")
    private String type;
    @ApiModelProperty(value = "发放状态1发放中 2暂停发放 只有发放方式为1和4的时候存储")
    private String grantStatus;
}
manage/src/main/java/com/jilongda/manage/service/TCouponReceiveService.java
@@ -1,7 +1,10 @@
package com.jilongda.manage.service;
import com.jilongda.common.basic.PageInfo;
import com.jilongda.manage.model.TCouponReceive;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jilongda.manage.query.TAppUserCouponQuery;
import com.jilongda.manage.vo.TAppUserCouponVO;
/**
 * <p>
@@ -13,4 +16,6 @@
 */
public interface TCouponReceiveService extends IService<TCouponReceive> {
    PageInfo<TAppUserCouponVO> pageList(TAppUserCouponQuery query);
}
manage/src/main/java/com/jilongda/manage/service/TCouponService.java
@@ -1,7 +1,10 @@
package com.jilongda.manage.service;
import com.jilongda.common.basic.PageInfo;
import com.jilongda.manage.model.TCoupon;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jilongda.manage.query.TCouponQuery;
import com.jilongda.manage.vo.TCouponVO;
/**
 * <p>
@@ -13,4 +16,5 @@
 */
public interface TCouponService extends IService<TCoupon> {
    PageInfo<TCouponVO> pageList(TCouponQuery query);
}
manage/src/main/java/com/jilongda/manage/service/impl/TCouponReceiveServiceImpl.java
@@ -1,10 +1,25 @@
package com.jilongda.manage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jilongda.common.basic.PageInfo;
import com.jilongda.manage.mapper.TCouponMapper;
import com.jilongda.manage.mapper.TStoreMapper;
import com.jilongda.manage.model.TCouponReceive;
import com.jilongda.manage.mapper.TCouponReceiveMapper;
import com.jilongda.manage.model.TStore;
import com.jilongda.manage.query.TAppUserCouponQuery;
import com.jilongda.manage.service.TCouponReceiveService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jilongda.manage.service.TCouponService;
import com.jilongda.manage.service.TStoreService;
import com.jilongda.manage.vo.TAppUserCouponVO;
import com.jilongda.manage.vo.TStoreVO;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
/**
 * <p>
@@ -17,4 +32,30 @@
@Service
public class TCouponReceiveServiceImpl extends ServiceImpl<TCouponReceiveMapper, TCouponReceive> implements TCouponReceiveService {
    @Resource
    private TCouponMapper couponMapper;
    @Resource
    private TStoreMapper storeMapper;
    @Resource
    private TCouponReceiveMapper couponReceiveMapper;
    @Override
    public PageInfo<TAppUserCouponVO> pageList(TAppUserCouponQuery query) {
        PageInfo<TAppUserCouponVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
        List<TAppUserCouponVO> list = couponReceiveMapper.pageList(query,pageInfo);
        for (TAppUserCouponVO tAppUserCouponVO : list) {
            StringBuilder stringBuilder = new StringBuilder();
            if (StringUtils.hasLength(tAppUserCouponVO.getStoreId())) {
                List<TStore> tStores = storeMapper.selectList(new LambdaQueryWrapper<TStore>()
                        .in(TStore::getId, Arrays.asList(tAppUserCouponVO.getStoreId().split(","))));
                for (TStore tStoreVO : tStores) {
                    stringBuilder.append(tStoreVO.getName()).append(",");
                }
                tAppUserCouponVO.setStoreName(stringBuilder.substring(0, stringBuilder.length() - 1));
            } else {
                tAppUserCouponVO.setStoreName("不限");
            }
        }
        pageInfo.setRecords(list);
        return pageInfo;
    }
}
manage/src/main/java/com/jilongda/manage/service/impl/TCouponServiceImpl.java
@@ -1,10 +1,26 @@
package com.jilongda.manage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jilongda.common.basic.PageInfo;
import com.jilongda.manage.mapper.TCouponReceiveMapper;
import com.jilongda.manage.mapper.TStoreMapper;
import com.jilongda.manage.model.TCoupon;
import com.jilongda.manage.mapper.TCouponMapper;
import com.jilongda.manage.model.TCouponReceive;
import com.jilongda.manage.model.TOrder;
import com.jilongda.manage.model.TStore;
import com.jilongda.manage.query.TCouponQuery;
import com.jilongda.manage.service.TCouponService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jilongda.manage.vo.TAppUserVO;
import com.jilongda.manage.vo.TCouponVO;
import org.apache.ibatis.annotations.ResultType;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
/**
 * <p>
@@ -17,4 +33,38 @@
@Service
public class TCouponServiceImpl extends ServiceImpl<TCouponMapper, TCoupon> implements TCouponService {
    @Resource
    private TStoreMapper storeMapper;
    @Resource
    private TCouponReceiveMapper couponReceiveMapper;
    @Override
    public PageInfo<TCouponVO> pageList(TCouponQuery query) {
        PageInfo<TCouponVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
        List<TCouponVO> list = this.baseMapper.pageList(query,pageInfo);
        StringBuilder stringBuilder = new StringBuilder();
        for (TCouponVO tAppUserCouponVO : list) {
            if (StringUtils.hasLength(tAppUserCouponVO.getStoreId())) {
                List<TStore> tStores = storeMapper.selectList(new LambdaQueryWrapper<TStore>()
                        .in(TStore::getId, Arrays.asList(tAppUserCouponVO.getStoreId().split(","))));
                for (TStore tStoreVO : tStores) {
                    stringBuilder.append(tStoreVO.getName()).append(",");
                }
                tAppUserCouponVO.setStoreName(stringBuilder.substring(0, stringBuilder.length() - 1));
            } else {
                tAppUserCouponVO.setStoreName("不限");
            }
            // 查询发放数量和使用数量
            int size = couponReceiveMapper.selectList(new LambdaQueryWrapper<TCouponReceive>()
                    .eq(TCouponReceive::getCouponId, tAppUserCouponVO.getId())).size();
            tAppUserCouponVO.setGrantCout(size);
            int size1 = couponReceiveMapper.selectList(new LambdaQueryWrapper<TCouponReceive>()
                    .eq(TCouponReceive::getCouponId, tAppUserCouponVO.getId())
                    .eq(TCouponReceive::getStatus, 2)).size();
            tAppUserCouponVO.setUseCount(size1);
        }
        pageInfo.setRecords(list);
        return pageInfo;
    }
}
manage/src/main/java/com/jilongda/manage/utils/QRCodeUtil.java
New file
@@ -0,0 +1,50 @@
package com.jilongda.manage.utils;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import java.awt.image.BufferedImage;
import java.util.Hashtable;
/**
 * @author chengst
 * @date 2019/11/4
 **/
public class QRCodeUtil {
    private final static String CHARSET = "utf-8";
    private final static int QRSIZEE = 300;
    // 二维码颜色
    private static final int BLACK = 0xFF000000;
    // 二维码颜色
    private static final int WHITE = 0xFFFFFFFF;
    public static BufferedImage createImage(String content){
        Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
        hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
        hints.put(EncodeHintType.CHARACTER_SET, CHARSET);
        hints.put(EncodeHintType.MARGIN, 1);
        BitMatrix bitMatrix = null;
        try {
            bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, QRSIZEE, QRSIZEE,hints);
        }catch (Exception e){
            e.printStackTrace();
        }
        int width = bitMatrix.getWidth();
        int height = bitMatrix.getHeight();
        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
                image.setRGB(x, y, bitMatrix.get(x, y) ? BLACK : WHITE);
            }
        }
        return image;
    }
}
manage/src/main/java/com/jilongda/manage/vo/TAppUserCouponVO.java
New file
@@ -0,0 +1,23 @@
package com.jilongda.manage.vo;
import com.jilongda.manage.model.TAppUser;
import com.jilongda.manage.model.TCouponReceive;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@ApiModel(value = "用户VO")
public class TAppUserCouponVO extends TCouponReceive {
    @ApiModelProperty(value = "优惠券名称")
    private String couponName;
    @ApiModelProperty(value = "门店名称")
    private String storeName;
}
manage/src/main/java/com/jilongda/manage/vo/TCouponInfoVO.java
New file
@@ -0,0 +1,21 @@
package com.jilongda.manage.vo;
import com.jilongda.manage.model.TCoupon;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "优惠券详情VO")
public class TCouponInfoVO extends TCoupon {
    @ApiModelProperty(value = "门店名称")
    private String storeName;
    @ApiModelProperty(value = "领取数量")
    private Integer grantCout;
    @ApiModelProperty(value = "使用数量")
    private Integer useCount;
}
manage/src/main/java/com/jilongda/manage/vo/TCouponVO.java
New file
@@ -0,0 +1,25 @@
package com.jilongda.manage.vo;
import com.jilongda.manage.model.TAppUser;
import com.jilongda.manage.model.TCoupon;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@ApiModel(value = "优惠券VO")
public class TCouponVO extends TCoupon {
    @ApiModelProperty(value = "门店名称")
    private String storeName;
    @ApiModelProperty(value = "发放数量")
    private Integer grantCout;
    @ApiModelProperty(value = "使用数量")
    private Integer useCount;
}
manage/src/main/resources/mapping/TAppUserMapper.xml
@@ -38,6 +38,7 @@
          <if test="query.startTime != null and query.startTime != ''">
              and (createTime between #{query.startTime} and #{query.endTime})
        </if>
        and isDelete =  ${@com.jilongda.common.enums.DisabledEnum@NO.getCode()}
    </select>
manage/src/main/resources/mapping/TCouponMapper.xml
@@ -23,5 +23,19 @@
    <sql id="Base_Column_List">
        id, name, type, amount, storeId, time, amountCondition, createTime, updateTime, createBy, updateBy, isDelete, grantStatus
    </sql>
    <select id="pageList" resultType="com.jilongda.manage.vo.TCouponVO">
        select t1.* from
            t_coupon t1
        where 1=1
        <if test="query.name != null and query.name != ''">
            and t1.name like concat('%',#{query.name},'%')
        </if>
        <if test="query.type != null and query.type != ''">
            and t1.type =#{query.type}
        </if>
        <if test="query.grantStatus != null and query.grantStatus != ''">
            and t1.grantStatus =#{query.grantStatus}
        </if>
    </select>
</mapper>
manage/src/main/resources/mapping/TCouponReceiveMapper.xml
@@ -24,5 +24,12 @@
    <sql id="Base_Column_List">
        id, couponId, userId, type, amount, storeId, endTime, amountCondition, status, createTime, updateTime, createBy, updateBy, isDelete
    </sql>
    <select id="pageList" resultType="com.jilongda.manage.vo.TAppUserCouponVO">
        select t1.* ,t2.name as couponName from
            t_coupon_receive t1
        left join t_coupon t2 on t1.couponId = t2.id
        where t1.userId = #{query.id}
        and t1.isDelete =  ${@com.jilongda.common.enums.DisabledEnum@NO.getCode()}
    </select>
</mapper>
manage/src/main/resources/mapping/TFrameGoods.xml
@@ -45,6 +45,8 @@
        <if test="query.startCount != null and query.endCount != null">
            and t1.total between #{query.startCount} and #{query.endCount}
        </if>
        and t1.isDelete =  ${@com.jilongda.common.enums.DisabledEnum@NO.getCode()}
        order by t1.id
    </select>
</mapper>
manage/src/main/resources/mapping/TInventoryMapper.xml
@@ -40,6 +40,8 @@
        <if test="query.startTime != null and query.startTime != ''">
            and t1.createTime between #{query.startTime} and #{query.endTime}
        </if>
        and t1.isDelete =  ${@com.jilongda.common.enums.DisabledEnum@NO.getCode()}
    </select>
</mapper>
manage/src/main/resources/mapping/TLensGoods.xml
@@ -37,6 +37,8 @@
        <if test="query.isWarning != null and query.isWarning = 2">
            and t1.total >= t7.lensThreshold
        </if>
        and t1.isDelete =  ${@com.jilongda.common.enums.DisabledEnum@NO.getCode()}
        order by t1.id
    </select>
</mapper>
manage/src/main/resources/mapping/TLineUpMapper.xml
@@ -40,6 +40,8 @@
            <if test="query.storeId != null">
                and s.id = #{query.storeId}
            </if>
            and t1.isDelete =  ${@com.jilongda.common.enums.DisabledEnum@NO.getCode()}
        </where>
        order by t.createTime desc
    </select>