14 changed files with 326 additions and 1 deletions
@ -0,0 +1,29 @@ |
|||||
|
package com.yxt.yyth.api.lpkcardqrcode; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
/** |
||||
|
* @author Fan |
||||
|
* @description |
||||
|
* @date 2023/11/24 16:03 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "礼品卡二维码表", description = "礼品卡二维码表") |
||||
|
@TableName("lpk_card_qrcode") |
||||
|
public class LpkCardQrcode { |
||||
|
|
||||
|
private String id; |
||||
|
private String sid = UUID.randomUUID().toString(); |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date createTime; |
||||
|
private String remarks; |
||||
|
private String cardSid; |
||||
|
private String file; |
||||
|
private String fileName; |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package com.yxt.yyth.api.lpkcardqrcode; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
|
||||
|
@ApiModel(value = "礼品卡二维码表 数据传输对象", description = "礼品卡二维码表 数据传输对象") |
||||
|
@Data |
||||
|
public class LpkCardQrcodeDto implements Dto { |
||||
|
private String id; |
||||
|
private String sid = UUID.randomUUID().toString(); |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date createTime; |
||||
|
private String remarks; |
||||
|
private String cardSid; |
||||
|
private String file; |
||||
|
private String fileName; |
||||
|
|
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
package com.yxt.yyth.api.lpkcardqrcode; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
@ApiModel(value = "礼品卡二维码表 查询条件", description = "礼品卡二维码表 查询条件") |
||||
|
@Data |
||||
|
public class LpkCardQrcodeQuery implements Query { |
||||
|
|
||||
|
private String startDate; //开始时间
|
||||
|
private String endDate; //结束时间
|
||||
|
private String countNumber; //总数
|
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package com.yxt.yyth.api.lpkcardqrcode; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
@Data |
||||
|
@ApiModel(value = "礼品卡二维码表 视图数据对象", description = "礼品卡二维码表 视图数据对象") |
||||
|
@NoArgsConstructor |
||||
|
public class LpkCardQrcodeVo implements Vo { |
||||
|
|
||||
|
private String id; |
||||
|
private String sid; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date createTime; |
||||
|
private String remarks; |
||||
|
private String cardSid; |
||||
|
private String file; |
||||
|
private String fileName; |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.yxt.yyth.api.lpkgiftcard; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/12/6 15:49 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class LpkGiftCardWordVo { |
||||
|
private String qrCode;//二维码
|
||||
|
private String bagName;//礼包名
|
||||
|
private String serialNumber;//序列号
|
||||
|
private String code;//卡号
|
||||
|
private String codeKey;//密码
|
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package com.yxt.yyth.biz.lpkcardqrcode; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import com.yxt.yyth.api.lpkcardqrcode.LpkCardQrcode; |
||||
|
import com.yxt.yyth.api.lpkcardqrcode.LpkCardQrcodeVo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/11/21 15:03 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface LpkCardQrcodeMapper extends BaseMapper<LpkCardQrcode> { |
||||
|
|
||||
|
IPage<LpkCardQrcodeVo> recordListPage(IPage<LpkCardQrcode> page, @Param(Constants.WRAPPER) QueryWrapper<LpkCardQrcode> qw); |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.yyth.biz.lpkcardqrcode.LpkCardQrcodeMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
|
||||
|
|
||||
|
<select id="recordListPage" resultType="com.yxt.yyth.api.lpkcardqrcode.LpkCardQrcodeVo"> |
||||
|
select |
||||
|
r.sid, |
||||
|
date_format(r.buildDate, '%Y-%m-%d') as buildDate, |
||||
|
r.countNumber, |
||||
|
r.startNumber, |
||||
|
r.endNumber, |
||||
|
from lpk_card_qrcode as r |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,41 @@ |
|||||
|
package com.yxt.yyth.biz.lpkcardqrcode; |
||||
|
|
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.yyth.api.lpkcardqrcode.LpkCardQrcodeDto; |
||||
|
import com.yxt.yyth.api.lpkcardqrcode.LpkCardQrcodeQuery; |
||||
|
import com.yxt.yyth.api.lpkcardqrcode.LpkCardQrcodeVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/11/21 15:03 |
||||
|
*/ |
||||
|
|
||||
|
@Api(tags = "礼品卡二维码") |
||||
|
@RestController |
||||
|
@RequestMapping("lpkcardqrcode") |
||||
|
public class LpkCardQrcodeRest { |
||||
|
|
||||
|
@Autowired |
||||
|
LpkCardQrcodeService LpkCardQrcodeService; |
||||
|
|
||||
|
@ApiOperation("发放记录列表") |
||||
|
@PostMapping("/recordListPage") |
||||
|
public ResultBean<PagerVo<LpkCardQrcodeVo>> recordListPage(@RequestBody PagerQuery<LpkCardQrcodeQuery> pq) { |
||||
|
return LpkCardQrcodeService.recordListPage(pq); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation("保存") |
||||
|
@PostMapping("/save") |
||||
|
public ResultBean save(@RequestBody LpkCardQrcodeDto dto) { |
||||
|
return LpkCardQrcodeService.save(dto); |
||||
|
} |
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
package com.yxt.yyth.biz.lpkcardqrcode; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.common.base.utils.PagerUtil; |
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.yyth.api.lpkcardqrcode.LpkCardQrcode; |
||||
|
import com.yxt.yyth.api.lpkcardqrcode.LpkCardQrcodeDto; |
||||
|
import com.yxt.yyth.api.lpkcardqrcode.LpkCardQrcodeQuery; |
||||
|
import com.yxt.yyth.api.lpkcardqrcode.LpkCardQrcodeVo; |
||||
|
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/11/21 15:03 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class LpkCardQrcodeService extends MybatisBaseService<LpkCardQrcodeMapper, LpkCardQrcode> { |
||||
|
|
||||
|
@Autowired |
||||
|
private LpkGiftCardService lpkGiftCardService; |
||||
|
|
||||
|
public ResultBean<PagerVo<LpkCardQrcodeVo>> recordListPage(PagerQuery<LpkCardQrcodeQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
LpkCardQrcodeQuery query = pq.getParams(); |
||||
|
QueryWrapper<LpkCardQrcode> qw = new QueryWrapper<>(); |
||||
|
qw.eq("1", "1"); |
||||
|
if (StringUtils.isNotBlank(query.getCountNumber())) { |
||||
|
qw.eq("r.countNumber", query.getCountNumber()); |
||||
|
} |
||||
|
// String startDate = query.getStartDate();
|
||||
|
// String effEndTime = query.getEndDate();
|
||||
|
// qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(startDate), "date_format (r.buildDate,'%Y-%m-%d') >= date_format('" + startDate + "','%Y-%m-%d')").
|
||||
|
// apply(org.apache.commons.lang3.StringUtils.isNotEmpty(effEndTime), "date_format (r.buildDate,'%Y-%m-%d') <= date_format('" + effEndTime + "','%Y-%m-%d')"
|
||||
|
// );
|
||||
|
qw.orderByDesc("r.createTime"); |
||||
|
IPage<LpkCardQrcode> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<LpkCardQrcodeVo> pagging = baseMapper.recordListPage(page, qw); |
||||
|
PagerVo<LpkCardQrcodeVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return rb.success().setData(p); |
||||
|
} |
||||
|
public ResultBean save(LpkCardQrcodeDto dto) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
LpkCardQrcode entity=new LpkCardQrcode(); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
String sid=entity.getSid(); |
||||
|
baseMapper.insert(entity); |
||||
|
return rb.success().setMsg(sid); |
||||
|
} |
||||
|
|
||||
|
} |
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue