This commit is contained in:
邱贞招 2025-03-20 10:17:11 +08:00
parent 70b44c1387
commit 4a2ea588da
17 changed files with 327 additions and 303 deletions

View File

@ -16,92 +16,92 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.ss.cardGetRecords.domain.CardGetRecords; import com.ruoyi.ss.userCard.domain.UserCard;
import com.ruoyi.ss.cardGetRecords.domain.CardGetRecordsVO; import com.ruoyi.ss.userCard.domain.UserCardVO;
import com.ruoyi.ss.cardGetRecords.domain.CardGetRecordsQuery; import com.ruoyi.ss.userCard.domain.UserCardQuery;
import com.ruoyi.ss.cardGetRecords.service.ICardGetRecordsService; import com.ruoyi.ss.userCard.service.IUserCardService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
/** /**
* 卡券领取购买记录Controller * 用户卡券Controller
* *
* @author qzz * @author qzz
* @date 2025-03-19 * @date 2025-03-19
*/ */
@RestController @RestController
@RequestMapping("/system/getRecords") @RequestMapping("/system/getRecords")
public class CardGetRecordsController extends BaseController public class UserCardController extends BaseController
{ {
@Autowired @Autowired
private ICardGetRecordsService cardGetRecordsService; private IUserCardService userCardService;
/** /**
* 查询卡券领取购买记录列表 * 查询用户卡券列表
*/ */
@PreAuthorize("@ss.hasPermi('system:getRecords:list')") @PreAuthorize("@ss.hasPermi('system:getRecords:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(CardGetRecordsQuery query) public TableDataInfo list(UserCardQuery query)
{ {
startPage(); startPage();
startOrderBy(); startOrderBy();
List<CardGetRecordsVO> list = cardGetRecordsService.selectCardGetRecordsList(query); List<UserCardVO> list = userCardService.selectUserCardList(query);
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 导出卡券领取购买记录列表 * 导出用户卡券列表
*/ */
@PreAuthorize("@ss.hasPermi('system:getRecords:export')") @PreAuthorize("@ss.hasPermi('system:getRecords:export')")
@Log(title = "卡券领取(购买)记录", businessType = BusinessType.EXPORT) @Log(title = "用户卡券", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, CardGetRecordsQuery query) public void export(HttpServletResponse response, UserCardQuery query)
{ {
List<CardGetRecordsVO> list = cardGetRecordsService.selectCardGetRecordsList(query); List<UserCardVO> list = userCardService.selectUserCardList(query);
ExcelUtil<CardGetRecordsVO> util = new ExcelUtil<CardGetRecordsVO>(CardGetRecordsVO.class); ExcelUtil<UserCardVO> util = new ExcelUtil<UserCardVO>(UserCardVO.class);
util.exportExcel(response, list, "卡券领取(购买)记录数据"); util.exportExcel(response, list, "用户卡券数据");
} }
/** /**
* 获取卡券领取购买记录详细信息 * 获取用户卡券详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:getRecords:query')") @PreAuthorize("@ss.hasPermi('system:getRecords:query')")
@GetMapping(value = "/{recordId}") @GetMapping(value = "/{recordId}")
public AjaxResult getInfo(@PathVariable("recordId") Long recordId) public AjaxResult getInfo(@PathVariable("recordId") Long recordId)
{ {
return success(cardGetRecordsService.selectCardGetRecordsByRecordId(recordId)); return success(userCardService.selectUserCardById(recordId));
} }
/** /**
* 新增卡券领取购买记录 * 新增用户卡券
*/ */
@PreAuthorize("@ss.hasPermi('system:getRecords:add')") @PreAuthorize("@ss.hasPermi('system:getRecords:add')")
@Log(title = "卡券领取(购买)记录", businessType = BusinessType.INSERT) @Log(title = "用户卡券", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody CardGetRecords cardGetRecords) public AjaxResult add(@RequestBody UserCard userCard)
{ {
return toAjax(cardGetRecordsService.insertCardGetRecords(cardGetRecords)); return toAjax(userCardService.insertUserCard(userCard));
} }
/** /**
* 修改卡券领取购买记录 * 修改用户卡券
*/ */
@PreAuthorize("@ss.hasPermi('system:getRecords:edit')") @PreAuthorize("@ss.hasPermi('system:getRecords:edit')")
@Log(title = "卡券领取(购买)记录", businessType = BusinessType.UPDATE) @Log(title = "用户卡券", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody CardGetRecords cardGetRecords) public AjaxResult edit(@RequestBody UserCard userCard)
{ {
return toAjax(cardGetRecordsService.updateCardGetRecords(cardGetRecords)); return toAjax(userCardService.updateUserCard(userCard));
} }
/** /**
* 删除卡券领取购买记录 * 删除用户卡券
*/ */
@PreAuthorize("@ss.hasPermi('system:getRecords:remove')") @PreAuthorize("@ss.hasPermi('system:getRecords:remove')")
@Log(title = "卡券领取(购买)记录", businessType = BusinessType.DELETE) @Log(title = "用户卡券", businessType = BusinessType.DELETE)
@DeleteMapping("/{recordIds}") @DeleteMapping("/{recordIds}")
public AjaxResult remove(@PathVariable Long[] recordIds) public AjaxResult remove(@PathVariable Long[] recordIds)
{ {
return toAjax(cardGetRecordsService.deleteCardGetRecordsByRecordIds(recordIds)); return toAjax(userCardService.deleteUserCardByRecordIds(recordIds));
} }
} }

View File

@ -7,7 +7,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.dto.ModifyBalanceDTO; import com.ruoyi.common.core.domain.dto.ModifyBalanceDTO;
import com.ruoyi.common.core.domain.entity.User; import com.ruoyi.common.core.domain.entity.User;
import com.ruoyi.common.utils.ServiceUtil; import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.cardGetRecords.service.ICardGetRecordsService; import com.ruoyi.ss.userCard.service.IUserCardService;
import com.ruoyi.ss.changeBalance.service.IChangeBalanceService; import com.ruoyi.ss.changeBalance.service.IChangeBalanceService;
import com.ruoyi.ss.user.domain.UserVO; import com.ruoyi.ss.user.domain.UserVO;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
@ -18,13 +18,11 @@ import com.ruoyi.ss.user.domain.UserQuery;
import com.ruoyi.ss.user.service.IUserAssembler; import com.ruoyi.ss.user.service.IUserAssembler;
import com.ruoyi.ss.user.service.IUserService; import com.ruoyi.ss.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
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.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
/** /**
@ -46,7 +44,7 @@ public class UserController extends BaseController
private IChangeBalanceService changeBalanceService; private IChangeBalanceService changeBalanceService;
@Autowired @Autowired
private ICardGetRecordsService cardGetRecordsService; private IUserCardService cardGetRecordsService;
/** /**
* 获取用户列表 * 获取用户列表

View File

@ -61,6 +61,14 @@ public class SsCard extends BaseEntity{
@ApiModelProperty("零售价") @ApiModelProperty("零售价")
private BigDecimal retailPrice; private BigDecimal retailPrice;
@Excel(name = "储值金额")
@ApiModelProperty("储值金额")
private BigDecimal storedAmount;
@Excel(name = "小时数")
@ApiModelProperty("小时数")
private Integer hours;
@Excel(name = "有效期的值") @Excel(name = "有效期的值")
@ApiModelProperty("有效期的值") @ApiModelProperty("有效期的值")
private Integer validityValue; private Integer validityValue;

View File

@ -22,6 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
c.limit_num, c.limit_num,
c.descr, c.descr,
c.retail_price, c.retail_price,
c.stored_amount,
c.hours,
c.validity_value, c.validity_value,
c.validity_unit, c.validity_unit,
c.status, c.status,
@ -48,6 +50,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.limitNum != null and query.limitNum != ''"> and c.limit_num = #{query.limitNum}</if> <if test="query.limitNum != null and query.limitNum != ''"> and c.limit_num = #{query.limitNum}</if>
<if test="query.descr != null and query.descr != ''"> and c.descr = #{query.descr}</if> <if test="query.descr != null and query.descr != ''"> and c.descr = #{query.descr}</if>
<if test="query.retailPrice != null "> and c.retail_price = #{query.retailPrice}</if> <if test="query.retailPrice != null "> and c.retail_price = #{query.retailPrice}</if>
<if test="query.storedAmount != null "> and c.stored_amount = #{query.storedAmount}</if>
<if test="query.hours != null "> and c.hours = #{query.hours}</if>
<if test="query.validityValue != null "> and c.validity_value = #{query.validityValue}</if> <if test="query.validityValue != null "> and c.validity_value = #{query.validityValue}</if>
<if test="query.validityUnit != null and query.validityUnit != ''"> and c.validity_unit = #{query.validityUnit}</if> <if test="query.validityUnit != null and query.validityUnit != ''"> and c.validity_unit = #{query.validityUnit}</if>
<if test="query.status != null and query.status != ''"> and c.status = #{query.status}</if> <if test="query.status != null and query.status != ''"> and c.status = #{query.status}</if>
@ -88,6 +92,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="limitNum != null">limit_num,</if> <if test="limitNum != null">limit_num,</if>
<if test="descr != null">descr,</if> <if test="descr != null">descr,</if>
<if test="retailPrice != null">retail_price,</if> <if test="retailPrice != null">retail_price,</if>
<if test="storedAmount != null">stored_amount,</if>
<if test="hours != null">hours,</if>
<if test="validityValue != null">validity_value,</if> <if test="validityValue != null">validity_value,</if>
<if test="validityUnit != null">validity_unit,</if> <if test="validityUnit != null">validity_unit,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
@ -111,6 +117,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="limitNum != null">#{limitNum},</if> <if test="limitNum != null">#{limitNum},</if>
<if test="descr != null">#{descr},</if> <if test="descr != null">#{descr},</if>
<if test="retailPrice != null">#{retailPrice},</if> <if test="retailPrice != null">#{retailPrice},</if>
<if test="storedAmount != null">#{storedAmount},</if>
<if test="hours != null">#{hours},</if>
<if test="validityValue != null">#{validityValue},</if> <if test="validityValue != null">#{validityValue},</if>
<if test="validityUnit != null">#{validityUnit},</if> <if test="validityUnit != null">#{validityUnit},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
@ -144,6 +152,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="data.limitNum != null">limit_num = #{data.limitNum},</if> <if test="data.limitNum != null">limit_num = #{data.limitNum},</if>
<if test="data.descr != null">descr = #{data.descr},</if> <if test="data.descr != null">descr = #{data.descr},</if>
<if test="data.retailPrice != null">retail_price = #{data.retailPrice},</if> <if test="data.retailPrice != null">retail_price = #{data.retailPrice},</if>
<if test="data.storedAmount != null">stored_amount = #{data.storedAmount},</if>
<if test="data.hours != null">hours = #{data.hours},</if>
<if test="data.validityValue != null">validity_value = #{data.validityValue},</if> <if test="data.validityValue != null">validity_value = #{data.validityValue},</if>
<if test="data.validityUnit != null">validity_unit = #{data.validityUnit},</if> <if test="data.validityUnit != null">validity_unit = #{data.validityUnit},</if>
<if test="data.status != null">status = #{data.status},</if> <if test="data.status != null">status = #{data.status},</if>

View File

@ -16,8 +16,8 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServiceUtil; import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.dy.DouYinAccessTokenUtil; import com.ruoyi.common.utils.dy.DouYinAccessTokenUtil;
import com.ruoyi.ss.card.domain.GroupBuyingDTO; import com.ruoyi.ss.card.domain.GroupBuyingDTO;
import com.ruoyi.ss.cardGetRecords.domain.CardGetRecords; import com.ruoyi.ss.userCard.domain.UserCard;
import com.ruoyi.ss.cardGetRecords.service.ICardGetRecordsService; import com.ruoyi.ss.userCard.service.IUserCardService;
import com.ruoyi.ss.checkoff.domain.CheckoffRecords; import com.ruoyi.ss.checkoff.domain.CheckoffRecords;
import com.ruoyi.ss.checkoff.service.ICheckoffRecordsService; import com.ruoyi.ss.checkoff.service.ICheckoffRecordsService;
import com.ruoyi.ss.mapping.domain.StoreMappingVO; import com.ruoyi.ss.mapping.domain.StoreMappingVO;
@ -63,7 +63,7 @@ public class SsCardServiceImpl implements ISsCardService
private ICheckoffRecordsService checkoffRecordsService; private ICheckoffRecordsService checkoffRecordsService;
@Autowired @Autowired
private ICardGetRecordsService cardGetRecordsService; private IUserCardService cardGetRecordsService;
/** /**
* 查询卡券 * 查询卡券
@ -240,7 +240,7 @@ public class SsCardServiceImpl implements ISsCardService
verifyCertificate(checkoffRecords, token); verifyCertificate(checkoffRecords, token);
// 创建卡券领取记录 // 创建卡券领取记录
CardGetRecords cardGetRecords = new CardGetRecords(); UserCard cardGetRecords = new UserCard();
cardGetRecords.setStatus(CARD_STATUS_UNUSED); cardGetRecords.setStatus(CARD_STATUS_UNUSED);
cardGetRecords.setUserId(SecurityUtils.getUserId()); cardGetRecords.setUserId(SecurityUtils.getUserId());
cardGetRecords.setCouponId(ssCardVO.getCouponId()); cardGetRecords.setCouponId(ssCardVO.getCouponId());
@ -249,7 +249,7 @@ public class SsCardServiceImpl implements ISsCardService
cardGetRecords.setStartTime(DateUtils.getNowDate()); cardGetRecords.setStartTime(DateUtils.getNowDate());
cardGetRecords.setEndTime(DateUtils.addYears(DateUtils.getNowDate(), 1)); cardGetRecords.setEndTime(DateUtils.addYears(DateUtils.getNowDate(), 1));
int cardInsertResult = cardGetRecordsService.insertCardGetRecords(cardGetRecords); int cardInsertResult = cardGetRecordsService.insertUserCard(cardGetRecords);
log.info("新建卡券领取记录:{}", cardInsertResult > 0 ? "成功" : "失败"); log.info("新建卡券领取记录:{}", cardInsertResult > 0 ? "成功" : "失败");
ServiceUtil.assertion(cardInsertResult == 0, "新建卡券领取记录失败"); ServiceUtil.assertion(cardInsertResult == 0, "新建卡券领取记录失败");
} }

View File

@ -1,7 +0,0 @@
package com.ruoyi.ss.cardGetRecords.domain;
import lombok.Data;
@Data
public class CardGetRecordsQuery extends CardGetRecords{
}

View File

@ -1,64 +0,0 @@
package com.ruoyi.ss.cardGetRecords.mapper;
import java.util.List;
import com.ruoyi.ss.cardGetRecords.domain.CardGetRecords;
import com.ruoyi.ss.cardGetRecords.domain.CardGetRecordsVO;
import com.ruoyi.ss.cardGetRecords.domain.CardGetRecordsQuery;
import org.apache.ibatis.annotations.Param;
/**
* 卡券领取购买记录Mapper接口
*
* @author qzz
* @date 2025-03-19
*/
public interface CardGetRecordsMapper
{
/**
* 查询卡券领取购买记录
*
* @param recordId 卡券领取购买记录主键
* @return 卡券领取购买记录
*/
public CardGetRecordsVO selectCardGetRecordsByRecordId(Long recordId);
/**
* 查询卡券领取购买记录列表
*
* @param query 卡券领取购买记录
* @return 卡券领取购买记录集合
*/
public List<CardGetRecordsVO> selectCardGetRecordsList(@Param("query")CardGetRecordsQuery query);
/**
* 新增卡券领取购买记录
*
* @param cardGetRecords 卡券领取购买记录
* @return 结果
*/
public int insertCardGetRecords(CardGetRecords cardGetRecords);
/**
* 修改卡券领取购买记录
*
* @param cardGetRecords 卡券领取购买记录
* @return 结果
*/
public int updateCardGetRecords(@Param("data") CardGetRecords cardGetRecords);
/**
* 删除卡券领取购买记录
*
* @param recordId 卡券领取购买记录主键
* @return 结果
*/
public int deleteCardGetRecordsByRecordId(Long recordId);
/**
* 批量删除卡券领取购买记录
*
* @param recordIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteCardGetRecordsByRecordIds(Long[] recordIds);
}

View File

@ -1,68 +0,0 @@
package com.ruoyi.ss.cardGetRecords.service;
import java.util.List;
import com.ruoyi.ss.cardGetRecords.domain.CardGetRecords;
import com.ruoyi.ss.cardGetRecords.domain.CardGetRecordsVO;
import com.ruoyi.ss.cardGetRecords.domain.CardGetRecordsQuery;
/**
* 卡券领取购买记录Service接口
*
* @author qzz
* @date 2025-03-19
*/
public interface ICardGetRecordsService
{
/**
* 查询卡券领取购买记录
*
* @param recordId 卡券领取购买记录主键
* @return 卡券领取购买记录
*/
public CardGetRecordsVO selectCardGetRecordsByRecordId(Long recordId);
/**
* 查询卡券领取购买记录列表
*
* @param cardGetRecords 卡券领取购买记录
* @return 卡券领取购买记录集合
*/
public List<CardGetRecordsVO> selectCardGetRecordsList(CardGetRecordsQuery cardGetRecords);
/**
* 新增卡券领取购买记录
*
* @param cardGetRecords 卡券领取购买记录
* @return 结果
*/
public int insertCardGetRecords(CardGetRecords cardGetRecords);
/**
* 修改卡券领取购买记录
*
* @param cardGetRecords 卡券领取购买记录
* @return 结果
*/
public int updateCardGetRecords(CardGetRecords cardGetRecords);
/**
* 批量删除卡券领取购买记录
*
* @param recordIds 需要删除的卡券领取购买记录主键集合
* @return 结果
*/
public int deleteCardGetRecordsByRecordIds(Long[] recordIds);
/**
* 删除卡券领取购买记录信息
*
* @param recordId 卡券领取购买记录主键
* @return 结果
*/
public int deleteCardGetRecordsByRecordId(Long recordId);
/**
* 获取用户可用卡券
*/
List<CardGetRecordsVO> getAvailableCard(Long userId);
}

View File

@ -1,108 +0,0 @@
package com.ruoyi.ss.cardGetRecords.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ss.cardGetRecords.mapper.CardGetRecordsMapper;
import com.ruoyi.ss.cardGetRecords.domain.CardGetRecords;
import com.ruoyi.ss.cardGetRecords.domain.CardGetRecordsVO;
import com.ruoyi.ss.cardGetRecords.domain.CardGetRecordsQuery;
import com.ruoyi.ss.cardGetRecords.service.ICardGetRecordsService;
import static com.ruoyi.common.constant.ServiceConstants.CARD_STATUS_UNUSED;
/**
* 卡券领取购买记录Service业务层处理
*
* @author qzz
* @date 2025-03-19
*/
@Service
public class CardGetRecordsServiceImpl implements ICardGetRecordsService
{
@Autowired
private CardGetRecordsMapper cardGetRecordsMapper;
/**
* 查询卡券领取购买记录
*
* @param recordId 卡券领取购买记录主键
* @return 卡券领取购买记录
*/
@Override
public CardGetRecordsVO selectCardGetRecordsByRecordId(Long recordId)
{
return cardGetRecordsMapper.selectCardGetRecordsByRecordId(recordId);
}
/**
* 查询卡券领取购买记录列表
*
* @param cardGetRecords 卡券领取购买记录
* @return 卡券领取购买记录
*/
@Override
public List<CardGetRecordsVO> selectCardGetRecordsList(CardGetRecordsQuery cardGetRecords)
{
return cardGetRecordsMapper.selectCardGetRecordsList(cardGetRecords);
}
/**
* 新增卡券领取购买记录
*
* @param cardGetRecords 卡券领取购买记录
* @return 结果
*/
@Override
public int insertCardGetRecords(CardGetRecords cardGetRecords)
{
return cardGetRecordsMapper.insertCardGetRecords(cardGetRecords);
}
/**
* 修改卡券领取购买记录
*
* @param cardGetRecords 卡券领取购买记录
* @return 结果
*/
@Override
public int updateCardGetRecords(CardGetRecords cardGetRecords)
{
return cardGetRecordsMapper.updateCardGetRecords(cardGetRecords);
}
/**
* 批量删除卡券领取购买记录
*
* @param recordIds 需要删除的卡券领取购买记录主键
* @return 结果
*/
@Override
public int deleteCardGetRecordsByRecordIds(Long[] recordIds)
{
return cardGetRecordsMapper.deleteCardGetRecordsByRecordIds(recordIds);
}
/**
* 删除卡券领取购买记录信息
*
* @param recordId 卡券领取购买记录主键
* @return 结果
*/
@Override
public int deleteCardGetRecordsByRecordId(Long recordId)
{
return cardGetRecordsMapper.deleteCardGetRecordsByRecordId(recordId);
}
/**
* 获取用户可用卡券
*/
@Override
public List<CardGetRecordsVO> getAvailableCard(Long userId) {
CardGetRecordsQuery cardGetRecordsQuery = new CardGetRecordsQuery();
cardGetRecordsQuery.setUserId(userId);
cardGetRecordsQuery.setStatus(CARD_STATUS_UNUSED);
return cardGetRecordsMapper.selectCardGetRecordsList(cardGetRecordsQuery);
}
}

View File

@ -1,4 +1,4 @@
package com.ruoyi.ss.cardGetRecords.domain; package com.ruoyi.ss.userCard.domain;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
@ -8,13 +8,13 @@ import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* 卡券领取购买记录对象 ss_card_records * 用户卡券对象 ss_user_card
* *
* @author qzz * @author qzz
* @date 2025-03-19 * @date 2025-03-19
*/ */
@Data @Data
public class CardGetRecords extends BaseEntity{ public class UserCard extends BaseEntity{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -0,0 +1,7 @@
package com.ruoyi.ss.userCard.domain;
import lombok.Data;
@Data
public class UserCardQuery extends UserCard {
}

View File

@ -1,10 +1,10 @@
package com.ruoyi.ss.cardGetRecords.domain; package com.ruoyi.ss.userCard.domain;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
public class CardGetRecordsVO extends CardGetRecords{ public class UserCardVO extends UserCard {
@ApiModelProperty(value = "领取人姓名") @ApiModelProperty(value = "领取人姓名")
private String userName; private String userName;

View File

@ -0,0 +1,64 @@
package com.ruoyi.ss.userCard.mapper;
import java.util.List;
import com.ruoyi.ss.userCard.domain.UserCard;
import com.ruoyi.ss.userCard.domain.UserCardVO;
import com.ruoyi.ss.userCard.domain.UserCardQuery;
import org.apache.ibatis.annotations.Param;
/**
* 用户卡券Mapper接口
*
* @author qzz
* @date 2025-03-19
*/
public interface UserCardMapper
{
/**
* 查询用户卡券
*
* @param recordId 用户卡券主键
* @return 用户卡券
*/
public UserCardVO selectUserCardById(Long recordId);
/**
* 查询用户卡券列表
*
* @param query 用户卡券
* @return 用户卡券集合
*/
public List<UserCardVO> selectCardGetRecordsList(@Param("query") UserCardQuery query);
/**
* 新增用户卡券
*
* @param cardGetRecords 用户卡券
* @return 结果
*/
public int insertUserCard(UserCard cardGetRecords);
/**
* 修改用户卡券
*
* @param cardGetRecords 用户卡券
* @return 结果
*/
public int updateUserCard(@Param("data") UserCard cardGetRecords);
/**
* 删除用户卡券
*
* @param recordId 用户卡券主键
* @return 结果
*/
public int deleteUserCardById(Long recordId);
/**
* 批量删除用户卡券
*
* @param recordIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteUserCardByIds(Long[] recordIds);
}

View File

@ -2,9 +2,9 @@
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.ss.cardGetRecords.mapper.CardGetRecordsMapper"> <mapper namespace="com.ruoyi.ss.userCard.mapper.UserCardMapper">
<resultMap type="CardGetRecordsVO" id="CardGetRecordsResult" autoMapping="true" /> <resultMap type="UserCardVO" id="CardGetRecordsResult" autoMapping="true" />
<sql id="selectCardGetRecordsVo"> <sql id="selectCardGetRecordsVo">
select select
@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
cr.status, cr.status,
cr.start_time, cr.start_time,
cr.end_time cr.end_time
from ss_card_records cr from ss_user_card cr
left join ss_user u on cr.user_id = u.user_id left join ss_user u on cr.user_id = u.user_id
left join ss_card c on cr.coupon_id = c.coupon_id left join ss_card c on cr.coupon_id = c.coupon_id
</sql> </sql>
@ -33,20 +33,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.endTime != null "> and cr.end_time = #{query.endTime}</if> <if test="query.endTime != null "> and cr.end_time = #{query.endTime}</if>
</sql> </sql>
<select id="selectCardGetRecordsList" parameterType="CardGetRecordsQuery" resultMap="CardGetRecordsResult"> <select id="selectCardGetRecordsList" parameterType="UserCardQuery" resultMap="CardGetRecordsResult">
<include refid="selectCardGetRecordsVo"/> <include refid="selectCardGetRecordsVo"/>
<where> <where>
<include refid="searchCondition"/> <include refid="searchCondition"/>
</where> </where>
</select> </select>
<select id="selectCardGetRecordsByRecordId" parameterType="Long" resultMap="CardGetRecordsResult"> <select id="selectUserCardById" parameterType="Long" resultMap="CardGetRecordsResult">
<include refid="selectCardGetRecordsVo"/> <include refid="selectCardGetRecordsVo"/>
where cr.record_id = #{recordId} where cr.record_id = #{recordId}
</select> </select>
<insert id="insertCardGetRecords" parameterType="CardGetRecords" useGeneratedKeys="true" keyProperty="recordId"> <insert id="insertUserCard" parameterType="UserCard" useGeneratedKeys="true" keyProperty="recordId">
insert into ss_card_records insert into ss_user_card
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if> <if test="userId != null">user_id,</if>
<if test="couponId != null">coupon_id,</if> <if test="couponId != null">coupon_id,</if>
@ -67,8 +67,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
</insert> </insert>
<update id="updateCardGetRecords" parameterType="CardGetRecords"> <update id="updateUserCard" parameterType="UserCard">
update ss_card_records update ss_user_card
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<include refid="updateColumns"/> <include refid="updateColumns"/>
</trim> </trim>
@ -85,12 +85,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="data.endTime != null">end_time = #{data.endTime},</if> <if test="data.endTime != null">end_time = #{data.endTime},</if>
</sql> </sql>
<delete id="deleteCardGetRecordsByRecordId" parameterType="Long"> <delete id="deleteUserCardById" parameterType="Long">
delete from ss_card_records where record_id = #{recordId} delete from ss_user_card where record_id = #{recordId}
</delete> </delete>
<delete id="deleteCardGetRecordsByRecordIds" parameterType="String"> <delete id="deleteUserCardByIds" parameterType="String">
delete from ss_card_records where record_id in delete from ss_user_card where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")"> <foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId} #{recordId}
</foreach> </foreach>

View File

@ -0,0 +1,68 @@
package com.ruoyi.ss.userCard.service;
import java.util.List;
import com.ruoyi.ss.userCard.domain.UserCard;
import com.ruoyi.ss.userCard.domain.UserCardVO;
import com.ruoyi.ss.userCard.domain.UserCardQuery;
/**
* 用户卡券Service接口
*
* @author qzz
* @date 2025-03-19
*/
public interface IUserCardService
{
/**
* 查询用户卡券
*
* @param recordId 用户卡券主键
* @return 用户卡券
*/
public UserCardVO selectUserCardById(Long recordId);
/**
* 查询用户卡券列表
*
* @param userCard 用户卡券
* @return 用户卡券集合
*/
public List<UserCardVO> selectUserCardList(UserCardQuery userCard);
/**
* 新增用户卡券
*
* @param userCard 用户卡券
* @return 结果
*/
public int insertUserCard(UserCard userCard);
/**
* 修改用户卡券
*
* @param userCard 用户卡券
* @return 结果
*/
public int updateUserCard(UserCard userCard);
/**
* 批量删除用户卡券
*
* @param recordIds 需要删除的用户卡券主键集合
* @return 结果
*/
public int deleteUserCardByRecordIds(Long[] recordIds);
/**
* 删除用户卡券信息
*
* @param recordId 用户卡券主键
* @return 结果
*/
public int deleteUserCardByRecordId(Long recordId);
/**
* 获取用户可用卡券
*/
List<UserCardVO> getAvailableCard(Long userId);
}

View File

@ -0,0 +1,108 @@
package com.ruoyi.ss.userCard.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ss.userCard.mapper.UserCardMapper;
import com.ruoyi.ss.userCard.domain.UserCard;
import com.ruoyi.ss.userCard.domain.UserCardVO;
import com.ruoyi.ss.userCard.domain.UserCardQuery;
import com.ruoyi.ss.userCard.service.IUserCardService;
import static com.ruoyi.common.constant.ServiceConstants.CARD_STATUS_UNUSED;
/**
* 用户卡券Service业务层处理
*
* @author qzz
* @date 2025-03-19
*/
@Service
public class UserCardServiceImpl implements IUserCardService
{
@Autowired
private UserCardMapper userCardMapper;
/**
* 查询用户卡券
*
* @param recordId 用户卡券主键
* @return 用户卡券
*/
@Override
public UserCardVO selectUserCardById(Long recordId)
{
return userCardMapper.selectUserCardById(recordId);
}
/**
* 查询用户卡券列表
*
* @param userCard 用户卡券
* @return 用户卡券
*/
@Override
public List<UserCardVO> selectUserCardList(UserCardQuery userCard)
{
return userCardMapper.selectUserCardList(userCard);
}
/**
* 新增用户卡券
*
* @param userCard 用户卡券
* @return 结果
*/
@Override
public int insertUserCard(UserCard userCard)
{
return userCardMapper.insertUserCard(userCard);
}
/**
* 修改用户卡券
*
* @param userCard 用户卡券
* @return 结果
*/
@Override
public int updateUserCard(UserCard userCard)
{
return userCardMapper.updateUserCard(userCard);
}
/**
* 批量删除用户卡券
*
* @param recordIds 需要删除的用户卡券主键
* @return 结果
*/
@Override
public int deleteUserCardByRecordIds(Long[] recordIds)
{
return userCardMapper.deleteUserCardByIds(recordIds);
}
/**
* 删除用户卡券信息
*
* @param recordId 用户卡券主键
* @return 结果
*/
@Override
public int deleteUserCardByRecordId(Long recordId)
{
return userCardMapper.deleteUserCardById(recordId);
}
/**
* 获取用户可用卡券
*/
@Override
public List<UserCardVO> getAvailableCard(Long userId) {
UserCardQuery userCardQuery = new UserCardQuery();
userCardQuery.setUserId(userId);
userCardQuery.setStatus(CARD_STATUS_UNUSED);
return userCardMapper.selectUserCardList(userCardQuery);
}
}

View File

@ -87,6 +87,14 @@ public class ReconciliationTask {
// 定义日期格式 // 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate yesterday = LocalDate.now().minusDays(1);
if (startDateStr == null || startDateStr.isEmpty()) {
startDateStr = yesterday.format(formatter);
}
if (endDateStr == null || endDateStr.isEmpty()) {
endDateStr = yesterday.format(formatter);
}
// 将传入的字符串日期转换为 LocalDate 对象 // 将传入的字符串日期转换为 LocalDate 对象
LocalDate startDate = LocalDate.parse(startDateStr, formatter); LocalDate startDate = LocalDate.parse(startDateStr, formatter);
LocalDate endDate = LocalDate.parse(endDateStr, formatter); LocalDate endDate = LocalDate.parse(endDateStr, formatter);