From 4a2ea588da0676804af1cf63842b65f7bbb51354 Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Thu, 20 Mar 2025 10:17:11 +0800 Subject: [PATCH] 111 --- ...ontroller.java => UserCardController.java} | 58 +++++----- .../web/controller/system/UserController.java | 6 +- .../java/com/ruoyi/ss/card/domain/SsCard.java | 8 ++ .../com/ruoyi/ss/card/mapper/SsCardMapper.xml | 10 ++ .../card/service/impl/SsCardServiceImpl.java | 10 +- .../domain/CardGetRecordsQuery.java | 7 -- .../mapper/CardGetRecordsMapper.java | 64 ----------- .../service/ICardGetRecordsService.java | 68 ----------- .../impl/CardGetRecordsServiceImpl.java | 108 ------------------ .../domain/UserCard.java} | 6 +- .../ss/userCard/domain/UserCardQuery.java | 7 ++ .../domain/UserCardVO.java} | 4 +- .../ss/userCard/mapper/UserCardMapper.java | 64 +++++++++++ .../mapper/UserCardMapper.xml} | 26 ++--- .../ss/userCard/service/IUserCardService.java | 68 +++++++++++ .../service/impl/UserCardServiceImpl.java | 108 ++++++++++++++++++ .../ruoyi/system/task/ReconciliationTask.java | 8 ++ 17 files changed, 327 insertions(+), 303 deletions(-) rename share-space-admin/src/main/java/com/ruoyi/web/controller/system/{CardGetRecordsController.java => UserCardController.java} (50%) delete mode 100644 share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/domain/CardGetRecordsQuery.java delete mode 100644 share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/mapper/CardGetRecordsMapper.java delete mode 100644 share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/service/ICardGetRecordsService.java delete mode 100644 share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/service/impl/CardGetRecordsServiceImpl.java rename share-space-system/src/main/java/com/ruoyi/ss/{cardGetRecords/domain/CardGetRecords.java => userCard/domain/UserCard.java} (90%) create mode 100644 share-space-system/src/main/java/com/ruoyi/ss/userCard/domain/UserCardQuery.java rename share-space-system/src/main/java/com/ruoyi/ss/{cardGetRecords/domain/CardGetRecordsVO.java => userCard/domain/UserCardVO.java} (70%) create mode 100644 share-space-system/src/main/java/com/ruoyi/ss/userCard/mapper/UserCardMapper.java rename share-space-system/src/main/java/com/ruoyi/ss/{cardGetRecords/mapper/CardGetRecordsMapper.xml => userCard/mapper/UserCardMapper.xml} (79%) create mode 100644 share-space-system/src/main/java/com/ruoyi/ss/userCard/service/IUserCardService.java create mode 100644 share-space-system/src/main/java/com/ruoyi/ss/userCard/service/impl/UserCardServiceImpl.java diff --git a/share-space-admin/src/main/java/com/ruoyi/web/controller/system/CardGetRecordsController.java b/share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserCardController.java similarity index 50% rename from share-space-admin/src/main/java/com/ruoyi/web/controller/system/CardGetRecordsController.java rename to share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserCardController.java index 8eaff34..b175b1a 100644 --- a/share-space-admin/src/main/java/com/ruoyi/web/controller/system/CardGetRecordsController.java +++ b/share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserCardController.java @@ -16,92 +16,92 @@ import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; -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 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 com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** - * 卡券领取(购买)记录Controller + * 用户卡券Controller * * @author qzz * @date 2025-03-19 */ @RestController @RequestMapping("/system/getRecords") -public class CardGetRecordsController extends BaseController +public class UserCardController extends BaseController { @Autowired - private ICardGetRecordsService cardGetRecordsService; + private IUserCardService userCardService; /** - * 查询卡券领取(购买)记录列表 + * 查询用户卡券列表 */ @PreAuthorize("@ss.hasPermi('system:getRecords:list')") @GetMapping("/list") - public TableDataInfo list(CardGetRecordsQuery query) + public TableDataInfo list(UserCardQuery query) { startPage(); startOrderBy(); - List list = cardGetRecordsService.selectCardGetRecordsList(query); + List list = userCardService.selectUserCardList(query); return getDataTable(list); } /** - * 导出卡券领取(购买)记录列表 + * 导出用户卡券列表 */ @PreAuthorize("@ss.hasPermi('system:getRecords:export')") - @Log(title = "卡券领取(购买)记录", businessType = BusinessType.EXPORT) + @Log(title = "用户卡券", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, CardGetRecordsQuery query) + public void export(HttpServletResponse response, UserCardQuery query) { - List list = cardGetRecordsService.selectCardGetRecordsList(query); - ExcelUtil util = new ExcelUtil(CardGetRecordsVO.class); - util.exportExcel(response, list, "卡券领取(购买)记录数据"); + List list = userCardService.selectUserCardList(query); + ExcelUtil util = new ExcelUtil(UserCardVO.class); + util.exportExcel(response, list, "用户卡券数据"); } /** - * 获取卡券领取(购买)记录详细信息 + * 获取用户卡券详细信息 */ @PreAuthorize("@ss.hasPermi('system:getRecords:query')") @GetMapping(value = "/{recordId}") public AjaxResult getInfo(@PathVariable("recordId") Long recordId) { - return success(cardGetRecordsService.selectCardGetRecordsByRecordId(recordId)); + return success(userCardService.selectUserCardById(recordId)); } /** - * 新增卡券领取(购买)记录 + * 新增用户卡券 */ @PreAuthorize("@ss.hasPermi('system:getRecords:add')") - @Log(title = "卡券领取(购买)记录", businessType = BusinessType.INSERT) + @Log(title = "用户卡券", businessType = BusinessType.INSERT) @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')") - @Log(title = "卡券领取(购买)记录", businessType = BusinessType.UPDATE) + @Log(title = "用户卡券", businessType = BusinessType.UPDATE) @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')") - @Log(title = "卡券领取(购买)记录", businessType = BusinessType.DELETE) + @Log(title = "用户卡券", businessType = BusinessType.DELETE) @DeleteMapping("/{recordIds}") public AjaxResult remove(@PathVariable Long[] recordIds) { - return toAjax(cardGetRecordsService.deleteCardGetRecordsByRecordIds(recordIds)); + return toAjax(userCardService.deleteUserCardByRecordIds(recordIds)); } } diff --git a/share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java b/share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java index 715c850..8cced7f 100644 --- a/share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java +++ b/share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java @@ -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.entity.User; 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.user.domain.UserVO; 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.IUserService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.format.annotation.DateTimeFormat; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; -import java.time.LocalDateTime; import java.util.List; /** @@ -46,7 +44,7 @@ public class UserController extends BaseController private IChangeBalanceService changeBalanceService; @Autowired - private ICardGetRecordsService cardGetRecordsService; + private IUserCardService cardGetRecordsService; /** * 获取用户列表 diff --git a/share-space-system/src/main/java/com/ruoyi/ss/card/domain/SsCard.java b/share-space-system/src/main/java/com/ruoyi/ss/card/domain/SsCard.java index fa2545e..d2e9083 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/card/domain/SsCard.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/card/domain/SsCard.java @@ -61,6 +61,14 @@ public class SsCard extends BaseEntity{ @ApiModelProperty("零售价") private BigDecimal retailPrice; + @Excel(name = "储值金额") + @ApiModelProperty("储值金额") + private BigDecimal storedAmount; + + @Excel(name = "小时数") + @ApiModelProperty("小时数") + private Integer hours; + @Excel(name = "有效期的值") @ApiModelProperty("有效期的值") private Integer validityValue; diff --git a/share-space-system/src/main/java/com/ruoyi/ss/card/mapper/SsCardMapper.xml b/share-space-system/src/main/java/com/ruoyi/ss/card/mapper/SsCardMapper.xml index 3649970..ea1c60d 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/card/mapper/SsCardMapper.xml +++ b/share-space-system/src/main/java/com/ruoyi/ss/card/mapper/SsCardMapper.xml @@ -22,6 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" c.limit_num, c.descr, c.retail_price, + c.stored_amount, + c.hours, c.validity_value, c.validity_unit, c.status, @@ -48,6 +50,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and c.limit_num = #{query.limitNum} and c.descr = #{query.descr} and c.retail_price = #{query.retailPrice} + and c.stored_amount = #{query.storedAmount} + and c.hours = #{query.hours} and c.validity_value = #{query.validityValue} and c.validity_unit = #{query.validityUnit} and c.status = #{query.status} @@ -88,6 +92,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" limit_num, descr, retail_price, + stored_amount, + hours, validity_value, validity_unit, status, @@ -111,6 +117,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{limitNum}, #{descr}, #{retailPrice}, + #{storedAmount}, + #{hours}, #{validityValue}, #{validityUnit}, #{status}, @@ -144,6 +152,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" limit_num = #{data.limitNum}, descr = #{data.descr}, retail_price = #{data.retailPrice}, + stored_amount = #{data.storedAmount}, + hours = #{data.hours}, validity_value = #{data.validityValue}, validity_unit = #{data.validityUnit}, status = #{data.status}, diff --git a/share-space-system/src/main/java/com/ruoyi/ss/card/service/impl/SsCardServiceImpl.java b/share-space-system/src/main/java/com/ruoyi/ss/card/service/impl/SsCardServiceImpl.java index fc24daf..75811c7 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/card/service/impl/SsCardServiceImpl.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/card/service/impl/SsCardServiceImpl.java @@ -16,8 +16,8 @@ import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.ServiceUtil; import com.ruoyi.common.utils.dy.DouYinAccessTokenUtil; import com.ruoyi.ss.card.domain.GroupBuyingDTO; -import com.ruoyi.ss.cardGetRecords.domain.CardGetRecords; -import com.ruoyi.ss.cardGetRecords.service.ICardGetRecordsService; +import com.ruoyi.ss.userCard.domain.UserCard; +import com.ruoyi.ss.userCard.service.IUserCardService; import com.ruoyi.ss.checkoff.domain.CheckoffRecords; import com.ruoyi.ss.checkoff.service.ICheckoffRecordsService; import com.ruoyi.ss.mapping.domain.StoreMappingVO; @@ -63,7 +63,7 @@ public class SsCardServiceImpl implements ISsCardService private ICheckoffRecordsService checkoffRecordsService; @Autowired - private ICardGetRecordsService cardGetRecordsService; + private IUserCardService cardGetRecordsService; /** * 查询卡券 @@ -240,7 +240,7 @@ public class SsCardServiceImpl implements ISsCardService verifyCertificate(checkoffRecords, token); // 创建卡券领取记录 - CardGetRecords cardGetRecords = new CardGetRecords(); + UserCard cardGetRecords = new UserCard(); cardGetRecords.setStatus(CARD_STATUS_UNUSED); cardGetRecords.setUserId(SecurityUtils.getUserId()); cardGetRecords.setCouponId(ssCardVO.getCouponId()); @@ -249,7 +249,7 @@ public class SsCardServiceImpl implements ISsCardService cardGetRecords.setStartTime(DateUtils.getNowDate()); cardGetRecords.setEndTime(DateUtils.addYears(DateUtils.getNowDate(), 1)); - int cardInsertResult = cardGetRecordsService.insertCardGetRecords(cardGetRecords); + int cardInsertResult = cardGetRecordsService.insertUserCard(cardGetRecords); log.info("新建卡券领取记录:{}", cardInsertResult > 0 ? "成功" : "失败"); ServiceUtil.assertion(cardInsertResult == 0, "新建卡券领取记录失败"); } diff --git a/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/domain/CardGetRecordsQuery.java b/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/domain/CardGetRecordsQuery.java deleted file mode 100644 index f70b555..0000000 --- a/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/domain/CardGetRecordsQuery.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.ruoyi.ss.cardGetRecords.domain; - -import lombok.Data; - -@Data -public class CardGetRecordsQuery extends CardGetRecords{ -} diff --git a/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/mapper/CardGetRecordsMapper.java b/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/mapper/CardGetRecordsMapper.java deleted file mode 100644 index ce48a47..0000000 --- a/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/mapper/CardGetRecordsMapper.java +++ /dev/null @@ -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 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); -} diff --git a/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/service/ICardGetRecordsService.java b/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/service/ICardGetRecordsService.java deleted file mode 100644 index a2ea19e..0000000 --- a/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/service/ICardGetRecordsService.java +++ /dev/null @@ -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 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 getAvailableCard(Long userId); -} diff --git a/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/service/impl/CardGetRecordsServiceImpl.java b/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/service/impl/CardGetRecordsServiceImpl.java deleted file mode 100644 index 122178f..0000000 --- a/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/service/impl/CardGetRecordsServiceImpl.java +++ /dev/null @@ -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 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 getAvailableCard(Long userId) { - CardGetRecordsQuery cardGetRecordsQuery = new CardGetRecordsQuery(); - cardGetRecordsQuery.setUserId(userId); - cardGetRecordsQuery.setStatus(CARD_STATUS_UNUSED); - return cardGetRecordsMapper.selectCardGetRecordsList(cardGetRecordsQuery); - } -} diff --git a/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/domain/CardGetRecords.java b/share-space-system/src/main/java/com/ruoyi/ss/userCard/domain/UserCard.java similarity index 90% rename from share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/domain/CardGetRecords.java rename to share-space-system/src/main/java/com/ruoyi/ss/userCard/domain/UserCard.java index c75f290..cae498b 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/domain/CardGetRecords.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/userCard/domain/UserCard.java @@ -1,4 +1,4 @@ -package com.ruoyi.ss.cardGetRecords.domain; +package com.ruoyi.ss.userCard.domain; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; @@ -8,13 +8,13 @@ import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; /** - * 卡券领取(购买)记录对象 ss_card_records + * 用户卡券对象 ss_user_card * * @author qzz * @date 2025-03-19 */ @Data -public class CardGetRecords extends BaseEntity{ +public class UserCard extends BaseEntity{ private static final long serialVersionUID = 1L; diff --git a/share-space-system/src/main/java/com/ruoyi/ss/userCard/domain/UserCardQuery.java b/share-space-system/src/main/java/com/ruoyi/ss/userCard/domain/UserCardQuery.java new file mode 100644 index 0000000..4549b1c --- /dev/null +++ b/share-space-system/src/main/java/com/ruoyi/ss/userCard/domain/UserCardQuery.java @@ -0,0 +1,7 @@ +package com.ruoyi.ss.userCard.domain; + +import lombok.Data; + +@Data +public class UserCardQuery extends UserCard { +} diff --git a/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/domain/CardGetRecordsVO.java b/share-space-system/src/main/java/com/ruoyi/ss/userCard/domain/UserCardVO.java similarity index 70% rename from share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/domain/CardGetRecordsVO.java rename to share-space-system/src/main/java/com/ruoyi/ss/userCard/domain/UserCardVO.java index b44e3ce..49d6624 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/domain/CardGetRecordsVO.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/userCard/domain/UserCardVO.java @@ -1,10 +1,10 @@ -package com.ruoyi.ss.cardGetRecords.domain; +package com.ruoyi.ss.userCard.domain; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data -public class CardGetRecordsVO extends CardGetRecords{ +public class UserCardVO extends UserCard { @ApiModelProperty(value = "领取人姓名") private String userName; diff --git a/share-space-system/src/main/java/com/ruoyi/ss/userCard/mapper/UserCardMapper.java b/share-space-system/src/main/java/com/ruoyi/ss/userCard/mapper/UserCardMapper.java new file mode 100644 index 0000000..7d262dd --- /dev/null +++ b/share-space-system/src/main/java/com/ruoyi/ss/userCard/mapper/UserCardMapper.java @@ -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 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); +} diff --git a/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/mapper/CardGetRecordsMapper.xml b/share-space-system/src/main/java/com/ruoyi/ss/userCard/mapper/UserCardMapper.xml similarity index 79% rename from share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/mapper/CardGetRecordsMapper.xml rename to share-space-system/src/main/java/com/ruoyi/ss/userCard/mapper/UserCardMapper.xml index 54dc789..ec761f4 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/cardGetRecords/mapper/CardGetRecordsMapper.xml +++ b/share-space-system/src/main/java/com/ruoyi/ss/userCard/mapper/UserCardMapper.xml @@ -2,9 +2,9 @@ - + - + select @@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" cr.status, cr.start_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_card c on cr.coupon_id = c.coupon_id @@ -33,20 +33,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and cr.end_time = #{query.endTime} - - where cr.record_id = #{recordId} - - insert into ss_card_records + + insert into ss_user_card user_id, coupon_id, @@ -67,8 +67,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - update ss_card_records + + update ss_user_card @@ -85,12 +85,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" end_time = #{data.endTime}, - - delete from ss_card_records where record_id = #{recordId} + + delete from ss_user_card where record_id = #{recordId} - - delete from ss_card_records where record_id in + + delete from ss_user_card where record_id in #{recordId} diff --git a/share-space-system/src/main/java/com/ruoyi/ss/userCard/service/IUserCardService.java b/share-space-system/src/main/java/com/ruoyi/ss/userCard/service/IUserCardService.java new file mode 100644 index 0000000..467fa8a --- /dev/null +++ b/share-space-system/src/main/java/com/ruoyi/ss/userCard/service/IUserCardService.java @@ -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 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 getAvailableCard(Long userId); +} diff --git a/share-space-system/src/main/java/com/ruoyi/ss/userCard/service/impl/UserCardServiceImpl.java b/share-space-system/src/main/java/com/ruoyi/ss/userCard/service/impl/UserCardServiceImpl.java new file mode 100644 index 0000000..0a332f6 --- /dev/null +++ b/share-space-system/src/main/java/com/ruoyi/ss/userCard/service/impl/UserCardServiceImpl.java @@ -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 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 getAvailableCard(Long userId) { + UserCardQuery userCardQuery = new UserCardQuery(); + userCardQuery.setUserId(userId); + userCardQuery.setStatus(CARD_STATUS_UNUSED); + return userCardMapper.selectUserCardList(userCardQuery); + } +} diff --git a/share-space-system/src/main/java/com/ruoyi/system/task/ReconciliationTask.java b/share-space-system/src/main/java/com/ruoyi/system/task/ReconciliationTask.java index 68ef306..fb1a893 100644 --- a/share-space-system/src/main/java/com/ruoyi/system/task/ReconciliationTask.java +++ b/share-space-system/src/main/java/com/ruoyi/system/task/ReconciliationTask.java @@ -87,6 +87,14 @@ public class ReconciliationTask { // 定义日期格式 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 startDate = LocalDate.parse(startDateStr, formatter); LocalDate endDate = LocalDate.parse(endDateStr, formatter);