diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 000000000..2b63946d5 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fuintAdmin/src/views/EventMarketing/SaveBlock/index.vue b/fuintAdmin/src/views/EventMarketing/SaveBlock/index.vue index 6e49630d3..1537259f0 100644 --- a/fuintAdmin/src/views/EventMarketing/SaveBlock/index.vue +++ b/fuintAdmin/src/views/EventMarketing/SaveBlock/index.vue @@ -276,19 +276,17 @@
- - - 不赠送 - 赠送 - + + + + + 添加
-
-
+
附加特权
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/controller/CardCouponUserController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/controller/CardCouponUserController.java new file mode 100644 index 000000000..742b85f66 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/controller/CardCouponUserController.java @@ -0,0 +1,92 @@ +package com.fuint.business.marketingActivity.cardCoupon.controller; + + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.api.ApiController; +import com.baomidou.mybatisplus.extension.api.R; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser; +import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponUserService; +import com.fuint.framework.web.BaseController; +import com.fuint.framework.web.ResponseObject; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.io.Serializable; +import java.util.List; + +import static org.springframework.boot.actuate.autoconfigure.cloudfoundry.SecurityResponse.success; + +/** + * 用户优惠卷表2024(CardCouponUser)表控制层 + * + * @author makejava + * @since 2024-09-22 15:14:30 + */ +@RestController +@RequestMapping("cardCouponUser") +public class CardCouponUserController extends BaseController { + /** + * 服务对象 + */ + @Resource + private CardCouponUserService cardCouponUserService; + + /** + * 分页查询所有数据 + * + * @param page 分页对象 + * @param cardCouponUser 查询实体 + * @return 所有数据 + */ + @GetMapping + public ResponseObject selectAll(Page page, CardCouponUser cardCouponUser) { + return getSuccessResult(this.cardCouponUserService.page(page, new QueryWrapper<>(cardCouponUser))); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public ResponseObject selectOne(@PathVariable Serializable id) { + return getSuccessResult(this.cardCouponUserService.getById(id)); + } + + /** + * 新增数据 + * + * @param cardCouponUser 实体对象 + * @return 新增结果 + */ + @PostMapping + public ResponseObject insert(@RequestBody CardCouponUser cardCouponUser) { + return getSuccessResult(this.cardCouponUserService.save(cardCouponUser)); + } + + /** + * 修改数据 + * + * @param cardCouponUser 实体对象 + * @return 修改结果 + */ + @PutMapping + public ResponseObject update(@RequestBody CardCouponUser cardCouponUser) { + return getSuccessResult(this.cardCouponUserService.updateById(cardCouponUser)); + } + + /** + * 删除数据 + * + * @param idList 主键结合 + * @return 删除结果 + */ + @DeleteMapping + public ResponseObject delete(@RequestParam("idList") List idList) { + return getSuccessResult(this.cardCouponUserService.removeByIds(idList)); + } +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java index ef2ebc197..bc92392b6 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java @@ -4,6 +4,7 @@ import java.time.LocalTime; import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.fasterxml.jackson.annotation.JsonFormat; @@ -130,6 +131,9 @@ public class CardCoupon extends Model { private String updateBy; //更新时间 private Date updateTime; + //当次获取数量 + @TableField(exist = false) + private Integer giftCardToatl; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCouponUser.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCouponUser.java new file mode 100644 index 000000000..a664367bb --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCouponUser.java @@ -0,0 +1,55 @@ +package com.fuint.business.marketingActivity.cardCoupon.entity; + +import java.util.Date; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import lombok.Data; + +import java.io.Serializable; + +/** + * 用户优惠卷表2024(CardCouponUser)表实体类 + * + * @author makejava + * @since 2024-09-22 15:14:30 + */ + +@Data +public class CardCouponUser extends Model { + //主键id + private Integer id; + //所属连锁店id + private Integer chainStoreId; + //所属店铺id + private Integer storeId; + //会员id + private Integer mtUserId; + //会员手机号码 + private String mobile; + //来源类型 1储值卡2囤油卡.... + private String fromType; + //活动id + private Integer activeId; + //优惠券id + private Integer cardCouponId; + //有效期开始时间 + private Date startTime; + //有效期结束时间 + private Date endTime; + //0未使用1已核销 + private String status; + //使用时间 + private Date useTime; + //订单总表all order 的主键 + private Integer orderId; + //创建者 + private String createBy; + //创建时间 + private Date createTime; + //更新者 + private String updateBy; + //更新时间 + private Date updateTime; + + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponUserMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponUserMapper.java new file mode 100644 index 000000000..3bd24967d --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponUserMapper.java @@ -0,0 +1,15 @@ +package com.fuint.business.marketingActivity.cardCoupon.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser; + +/** + * 用户优惠卷表2024(CardCouponUser)表数据库访问层 + * + * @author makejava + * @since 2024-09-22 15:14:30 + */ +public interface CardCouponUserMapper extends BaseMapper { + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponUserService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponUserService.java new file mode 100644 index 000000000..db3bbbfba --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponUserService.java @@ -0,0 +1,22 @@ +package com.fuint.business.marketingActivity.cardCoupon.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser; + +/** + * 用户优惠卷表2024(CardCouponUser)表服务接口 + * + * @author makejava + * @since 2024-09-22 15:14:30 + */ +public interface CardCouponUserService extends IService { + /** + * 判断用户是否还能领取该优惠卷 + * @param couponId 优惠卷id + * @param userId 用户主键 + * @return true 能 false 不能 + */ + boolean userCanGet(Integer couponId,Integer userId); + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponUserServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponUserServiceImpl.java new file mode 100644 index 000000000..eb6bf9a9e --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponUserServiceImpl.java @@ -0,0 +1,60 @@ +package com.fuint.business.marketingActivity.cardCoupon.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; +import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponUserMapper; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser; +import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponService; +import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * 用户优惠卷表2024(CardCouponUser)表服务实现类 + * + * @author makejava + * @since 2024-09-22 15:14:30 + */ +@Service("cardCouponUserService") +public class CardCouponUserServiceImpl extends ServiceImpl implements CardCouponUserService { + @Autowired + private CardCouponService cardCouponService; + /** + * 判断用户是否还能领取该优惠卷 + * @param couponId 优惠卷id + * @param userId 用户主键 + * @return true 能 false 不能 + */ + @Override + public boolean userCanGet(Integer couponId, Integer userId) { + CardCoupon cardCoupon = cardCouponService.getById(couponId); + if (cardCoupon.getTfTotal()<=cardCoupon.getTfTotal()){ + //领取数量大于策略中的送出总量 + return false; + } + String nowDate = DateUtil.format(new Date(), "yyyy-MM-dd"); + LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); + queryWrapper.eq(CardCouponUser::getCardCouponId,couponId).eq(CardCouponUser::getMtUserId,userId); + List list = this.list(queryWrapper); + if (CollectionUtil.isEmpty(list)){ + list =new ArrayList<>(); + } + if (list.size()>=cardCoupon.getGetNumLimit()){ + //当前用户领取已到达上限 + return false; + } + //获取当日获取数量 + long count = list.stream().filter(it -> { + return DateUtil.format(it.getCreateTime(), "yyyy-MM-dd").equals(nowDate); + }).count(); + return count < cardCoupon.getDayGetLimit(); + } +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueController.java index 161f3587f..217104a56 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueController.java @@ -69,6 +69,17 @@ public class CardValueController extends BaseController { return getSuccessResult(this.cardValueService.selectAllApplet(cardValue)); } + + /** + * 查询本站会员充值卡列表 + * @param cardValue + * @return + */ + @GetMapping("cardValueList") + public ResponseObject cardValueList(@Param("cardValue") CardValue cardValue) { + return getSuccessResult(this.cardValueService.cardValueList(cardValue)); + } + /** * 通过主键查询单条数据 * @@ -90,7 +101,16 @@ public class CardValueController extends BaseController { public ResponseObject selectById(@PathVariable Serializable id) { return getSuccessResult(this.cardValueService.getOneById(id)); } - + /** + * 获取使用时的详细信息 + * + * @param cardValueId 主键 + * @return 单条数据 + */ + @GetMapping("/getCoupons") + public ResponseObject getCoupons(@RequestParam("userId") Integer userId,@RequestParam("cardValueId") Integer cardValueId) { + return getSuccessResult(this.cardValueService.getCoupons(userId,cardValueId)); + } /** * 新增数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/entity/CardValue.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/entity/CardValue.java index 07dfdc41d..5f833f727 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/entity/CardValue.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/entity/CardValue.java @@ -3,12 +3,15 @@ package com.fuint.business.marketingActivity.cardValue.entity; import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * 储值卡表(CardValue)表实体类 @@ -87,6 +90,8 @@ public class CardValue extends Model { //20240821追加字段 //活动名称 private String activeName; + @TableField(exist = false) + private List cardCoupons; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/mapper/CardValueChildMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/mapper/CardValueChildMapper.java index 9047a05c1..4b3cbef9d 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/mapper/CardValueChildMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/mapper/CardValueChildMapper.java @@ -1,7 +1,11 @@ package com.fuint.business.marketingActivity.cardValue.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 储值卡子表(CardValueChild)表数据库访问层 @@ -10,5 +14,6 @@ import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild; * @since 2023-11-20 17:50:59 */ public interface CardValueChildMapper extends BaseMapper { + List getByCardId(@Param("cardValueId") Integer cardValueId); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/mapper/xml/CardValueChildMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/mapper/xml/CardValueChildMapper.xml new file mode 100644 index 000000000..6cd46c444 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/mapper/xml/CardValueChildMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueChildService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueChildService.java index 7340266d9..d32763fe8 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueChildService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueChildService.java @@ -1,8 +1,11 @@ package com.fuint.business.marketingActivity.cardValue.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild; +import java.util.List; + /** * 储值卡子表(CardValueChild)表服务接口 * @@ -10,5 +13,5 @@ import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild; * @since 2023-11-20 17:51:06 */ public interface CardValueChildService extends IService { - + List getByCardId(Integer cardValueId); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueService.java index 03146539e..137247d15 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueService.java @@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.cardValue.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; import com.fuint.business.marketingActivity.cardValue.dto.CardValueDTO; import com.fuint.business.marketingActivity.cardValue.entity.CardValue; import com.fuint.business.marketingActivity.cardValue.vo.CardValueAppletVO; @@ -43,6 +44,7 @@ public interface CardValueService extends IService { * @return */ CardValueVO getOneById(Serializable id); + List getCoupons(Integer userId,Integer cardValueId); /** * 新增数据 @@ -66,6 +68,8 @@ public interface CardValueService extends IService { */ List selectAllApplet(CardValue cardValue); + List cardValueList (CardValue cardValue); + /** * 删除数据 * @param id diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueChildServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueChildServiceImpl.java index c4f524b4a..7a9a3a9d9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueChildServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueChildServiceImpl.java @@ -1,11 +1,14 @@ package com.fuint.business.marketingActivity.cardValue.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild; import com.fuint.business.marketingActivity.cardValue.mapper.CardValueChildMapper; import com.fuint.business.marketingActivity.cardValue.service.CardValueChildService; import org.springframework.stereotype.Service; +import java.util.List; + /** * 储值卡子表(CardValueChild)表服务实现类 * @@ -15,5 +18,9 @@ import org.springframework.stereotype.Service; @Service("cardValueChildService") public class CardValueChildServiceImpl extends ServiceImpl implements CardValueChildService { + @Override + public List getByCardId(Integer cardValueId) { + return baseMapper.getByCardId(cardValueId); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueServiceImpl.java index fcd5ea727..43ce6b7b9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueServiceImpl.java @@ -1,5 +1,6 @@ package com.fuint.business.marketingActivity.cardValue.service.impl; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -15,6 +16,9 @@ import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumpti import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount; import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscountChild; import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountVO; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser; +import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponUserService; import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange; import com.fuint.business.marketingActivity.cardExchange.mapper.CardExchangeMapper; import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable; @@ -33,6 +37,7 @@ import com.fuint.business.member.service.ILJStaffService; import com.fuint.business.store.service.StoreService; import com.fuint.business.storeInformation.service.ILJStoreService; import com.fuint.business.userManager.service.LJUserGradeService; +import com.fuint.common.dto.AccountInfo; import com.fuint.common.service.StaffService; import com.fuint.common.util.TokenUtil; import com.fuint.repository.mapper.MtStaffMapper; @@ -86,6 +91,8 @@ public class CardValueServiceImpl extends ServiceImpl getCoupons(Integer userId,Integer cardValueId) { + List cardCoupons = cardValueChildService.getByCardId(cardValueId); + //过滤 + return cardCoupons.stream().filter(it -> { + return cardCouponUserService.userCanGet(it.getId(), userId); + }).collect(Collectors.toList()); + + } + /** * 新增数据 * @param cardValueDTO @@ -525,6 +542,19 @@ public class CardValueServiceImpl extends ServiceImpl cardValueList(CardValue cardValue) { + //获取当前登录用户 + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + String nowTime = DateUtil.format(new Date(), "yyyy-MM-dd")+"00:00:00"; + LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); + queryWrapper.eq(CardValue::getStoreId,nowAccountInfo.getStoreId()).eq(CardValue::getIsonline,"0").eq(CardValue::getActiveStatus,"1").and(it->{ + return it.eq(CardValue::getActiveTime,"1").or().eq(CardValue::getActiveTime,"2") + .ge(CardValue::getStartTime,nowTime).le(CardValue::getEndTime,nowTime); + }).orderByAsc(CardValue::getRechargeBalance); + return this.list(queryWrapper); + } + /** * 删除数据 * @param id diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilGunMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilGunMapper.xml index f1424e00e..65ac256b9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilGunMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilGunMapper.xml @@ -160,13 +160,13 @@ select zong.*, o2.oil_name FROM (SELECT o1.*, - o2.oil_name as oil_name_id, + o2.oil_name as oilNameId, o2.oil_type as oilType, o2.oil_price as oilPrice FROM oil_gun o1 - LEFT JOIN oil_number o2 ON o1.number_id = o2.number_id + LEFT JOIN oil_number o2 ON o1.number_id = o2.number_id WHERE o1.store_id = #{storeId} and o1.status = '启用' ) as zong - LEFT JOIN oil_name as o2 on zong.oil_name_id = o2.id + LEFT JOIN oil_name as o2 on zong.oilNameId = o2.id diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilCashRegisterVo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilCashRegisterVo.java index 277f9c018..dd02f326a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilCashRegisterVo.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilCashRegisterVo.java @@ -20,5 +20,6 @@ public class OilCashRegisterVo extends OilGun { * 关联表 挂牌价 */ private BigDecimal oilPrice; + private Integer oilNameId; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/controller/PayCenterController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/controller/PayCenterController.java index 52ef88374..bdf88210b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/controller/PayCenterController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/controller/PayCenterController.java @@ -32,8 +32,8 @@ public class PayCenterController extends BaseController { * @param request * @return com.fuint.framework.web.ResponseObject **/ - @GetMapping("/getActivityAndCoupon") - public ResponseObject getActivityAndCoupon(Map map,HttpServletRequest request) throws Exception { + @PostMapping("/getActivityAndCoupon") + public ResponseObject getActivityAndCoupon(@RequestBody Map map,HttpServletRequest request) throws Exception { logger.info("收银台获取可用优惠券和可以参加的优惠活动参数:{}", map); return getSuccessResult("查询成功",payCenterService.getActivityAndCoupon(map)); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/service/impl/PayCenterServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/service/impl/PayCenterServiceImpl.java index 66e129796..0fb446f5b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/service/impl/PayCenterServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/service/impl/PayCenterServiceImpl.java @@ -105,8 +105,8 @@ public class PayCenterServiceImpl implements PayCenterService { actList.addAll(this.getLijianAct(nowDate,userId,gradeId,storeId,labelIdList,oilAmount,oilLiter,oilId)); //2.3 查可参加的折扣营销(会员折扣) actList.addAll(this.getZhekouAct(nowDate,gradeId,storeId,oilAmount)); - /*3.查询所有可用的优惠券 TODO 需要等待优惠券表修改完以后再处理 */ - List couponList = new ArrayList<>(); + /*3.查询所有可用的优惠券 */ + List couponList = this.getCouponList(userId,storeId,oilAmount,orderAmount,nowDate); rtnObj.put("activity",actList); rtnObj.put("coupon",couponList); return rtnObj; @@ -279,4 +279,19 @@ public class PayCenterServiceImpl implements PayCenterService { } return rtnList; } + + /** + * 获取当前会员可以使用的优惠券 + * @author vinjor-M + * @date 11:46 2024/9/22 + * @param userId 用户Id + * @param storeId 店铺id + * @param oilAmount 当前加油金额 + * @param orderAmount 订单总金额 + * @param nowDate 结算那一刻的时间 + * @return java.util.List + **/ + public List getCouponList(Integer userId,Integer storeId,Double oilAmount,Double orderAmount,Date nowDate){ + + } } diff --git a/fuintCashierWeb/src/api/newHome/newHome.js b/fuintCashierWeb/src/api/newHome/newHome.js index 104d19a3d..fdd15139e 100644 --- a/fuintCashierWeb/src/api/newHome/newHome.js +++ b/fuintCashierWeb/src/api/newHome/newHome.js @@ -16,10 +16,23 @@ export function cashRegisterGoodsList() { }) } +export function cardValueList() { + return request({ + url: '/business/marketingActivity/cardValue/cardValueList', + method: 'get', + }) +} +export function getCoupons(param) { + return request({ + url: '/business/marketingActivity/cardValue/getCoupons', + method: 'get', + params:param + }) +} export function getActivityAndCoupon(data) { return request({ url: '/pay/paycenter/getActivityAndCoupon', - method: 'get', - params: data + method: 'post', + data: data }) } diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue b/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue index 5569d8ddb..b51786e38 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue @@ -403,7 +403,7 @@ width="910px" center > - + 取 消 确认充值 @@ -436,7 +436,7 @@ import refuelingAmount from './newHomeComponents/refuelingAmount.vue' import { cashRegisterList, cashRegisterGoodsList,getActivityAndCoupon } from '@/api/newHome/newHome.js' import {QRCodeByStoreId} from "@/api/staff/qrcode"; import {userListByPhone} from "@/api/cashier/user"; -import Vue from 'vue'; + import { VueClipboard } from 'vue-clipboard2'; export default { @@ -578,6 +578,8 @@ export default { handler(newValue, oldValue) { console.log('油枪发生拜年话', newValue); this.refuelingAmount = false + //查询可用优惠券 + this.getActivityAndCoupon() } }, //监听商品总金额发生变化 @@ -642,10 +644,23 @@ export default { */ getActivityAndCoupon(){ //组装请求参数 - let dataObj = {userId:"",oil:"",oilAmount:"",orderAmount:"",oilLiter:""} - getActivityAndCoupon(dataObj).then(res => { - - }) + if(this.oilGunClearing!='' && this.oilGunClearing.hasOwnProperty("oilNameId") && this.chooseVipUser.hasOwnProperty("id")){ + // 保留两位小数 + let oilLiter = (this.oilGunClearing.amount / this.oilGunClearing.oilPrice).toFixed(2) + let orderAmount = this.oilGunClearing.amount+this.getGoodsNum + //油枪已结算,且已选择会员 + let dataObj = { + userId: this.chooseVipUser.id, + oilId: this.oilGunClearing.oilNameId, + oilPrice:this.oilGunClearing.oilPrice, + oilAmount: this.oilGunClearing.amount, + orderAmount: orderAmount, + oilLiter: oilLiter + } + getActivityAndCoupon(dataObj).then(res => { + console.log("返回结果",res) + }) + } }, copyToClipboard(textToCopy) { @@ -865,6 +880,10 @@ export default { }, addMemberRecharge() { this.memberRecharge = true + this.$nextTick(res=>{ + this.$refs.rechargeRef.getCardValueList(); + }) + }, changeBox() { this.boxShow = !this.boxShow diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/newHomeComponents/memberRecharge.vue b/fuintCashierWeb/src/views/cashier/NewComponents/newHomeComponents/memberRecharge.vue index 7a179c147..0b109606d 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/newHomeComponents/memberRecharge.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/newHomeComponents/memberRecharge.vue @@ -1,7 +1,15 @@