From 9a0095d202b06d380718344c13eb623cf1159d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=85=81=E6=9E=9E?= <3422692813@qq.com> Date: Fri, 11 Oct 2024 14:00:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B010.11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fuyou/service/impl/FyPayServiceImpl.java | 26 ++++++- .../service/ActivePriceRecordService.java | 24 +++++++ .../impl/ActivePriceRecordServiceImpl.java | 68 +++++++++++++++++++ .../UserDiscountRecordController.java | 20 ++++++ .../userGroup/entity/UserDiscountRecord.java | 64 +++++++++++++++++ .../mapper/UserDiscountRecordMapper.java | 16 +++++ .../service/IUserDiscountRecordService.java | 35 ++++++++++ .../impl/UserDiscountRecordServiceImpl.java | 52 ++++++++++++++ .../mapper/UserDiscountRecordMapper.xml | 5 ++ gasStation-uni/pagesMy/signIn/index.vue | 1 + 10 files changed, 309 insertions(+), 2 deletions(-) create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/controller/UserDiscountRecordController.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/entity/UserDiscountRecord.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/mapper/UserDiscountRecordMapper.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/service/IUserDiscountRecordService.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/service/impl/UserDiscountRecordServiceImpl.java create mode 100644 fuintBackend/fuint-application/src/main/resources/mapper/UserDiscountRecordMapper.xml diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java index e508eff40..561b16a62 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java @@ -16,6 +16,9 @@ import com.fuint.business.commission.service.StaffCommissionService; import com.fuint.business.integral.entity.IntegralOrders; import com.fuint.business.integral.service.IntegralOrdersService; import com.fuint.business.integral.service.IntegralSettingsService; +import com.fuint.business.marketingActivity.activePrice.entity.ActivePriceRecord; +import com.fuint.business.marketingActivity.activePrice.service.ActivePriceRecordService; +import com.fuint.business.marketingActivity.activePrice.service.ActivePriceService; import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendRecordsService; import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser; import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponUserMapper; @@ -29,6 +32,9 @@ import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordSer import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService; import com.fuint.business.order.entity.*; import com.fuint.business.order.service.*; +import com.fuint.business.userGroup.entity.UserDiscountRecord; +import com.fuint.business.userGroup.service.IUserDiscountRecordService; +import com.fuint.business.userGroup.service.UserDiscountService; import com.fuint.business.userManager.entity.UserBalance; import com.fuint.business.userManager.service.LJUserService; import com.fuint.business.userManager.service.UserBalanceService; @@ -70,6 +76,10 @@ public class FyPayServiceImpl implements FyPayService { private ActiveRecommendRecordsService activeRecommendRecordsService; @Autowired private CardCouponUserMapper cardCouponUserMapper; + @Autowired + private IUserDiscountRecordService userDiscountRecordService; + @Autowired + private ActivePriceRecordService activePriceRecordService; /** * 条码支付 @@ -189,9 +199,9 @@ public class FyPayServiceImpl implements FyPayService { //响应报文验签 Map reqMap = Utils.xmlStr2Map(rspXml); String str = reqMap.get("sign"); + //查询总订单 + AllOrderInfo allOrderInfo = allOrderInfoService.selectAllOrderInfoByOrderNo(orderNo); if (Utils.verifySign(reqMap, str)) { - //查询总订单 - AllOrderInfo allOrderInfo = allOrderInfoService.selectAllOrderInfoByOrderNo(orderNo); //油品订单 OilOrder oilOrder = oilOrderService.selectOilOrderByOrderNo(orderNo); //商品订单 @@ -437,6 +447,18 @@ public class FyPayServiceImpl implements FyPayService { } //推荐会员充值有礼 activeRecommendRecordsService.recommendMembersRechargePolite(allOrderInfo.getStoreId(), allOrderInfo.getUserId(), allOrderInfo.getPayType()); + }else { + //删除会员折扣记录 + UserDiscountRecord userDiscountRecord = userDiscountRecordService.queryByOrderId(allOrderInfo.getId()); + if (ObjectUtil.isNotEmpty(userDiscountRecord)) { + userDiscountRecordService.delete(userDiscountRecord.getId()); + } + + //删除分时优惠记录 + ActivePriceRecord activePriceRecord = activePriceRecordService.queryByOrderId(allOrderInfo.getId()); + if (ObjectUtil.isNotEmpty(activePriceRecord)) { + activePriceRecordService.delete(activePriceRecord.getId()); + } } } catch (Exception e) { e.printStackTrace(); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/service/ActivePriceRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/service/ActivePriceRecordService.java index 77eb177ec..865052ea4 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/service/ActivePriceRecordService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/service/ActivePriceRecordService.java @@ -24,5 +24,29 @@ public interface ActivePriceRecordService extends IService { * @return java.util.List **/ List selectListByUserIdAndActIds(Integer userId,List ruleIdList,List actIdList,List actTypeList); + + /** + * 根据订单id查询记录 + * @param orderId + * @return + */ + ActivePriceRecord queryByOrderId(Integer orderId); + + /** + * 删除记录 + * @param id + * @return + */ + int delete (Integer id); + + /** + * 新增分时优惠记录 + * @param actId + * @param ruleId + * @param orderId + * @param disAmount + * @return + */ + int add(Integer userId,Integer actId, Integer ruleId, Integer orderId, Double disAmount); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/service/impl/ActivePriceRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/service/impl/ActivePriceRecordServiceImpl.java index f5d58d89e..0bd7a93b0 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/service/impl/ActivePriceRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/service/impl/ActivePriceRecordServiceImpl.java @@ -1,10 +1,16 @@ package com.fuint.business.marketingActivity.activePrice.service.impl; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.marketingActivity.activePrice.entity.ActivePrice; import com.fuint.business.marketingActivity.activePrice.entity.ActivePriceRecord; +import com.fuint.business.marketingActivity.activePrice.entity.ActivePriceRule; +import com.fuint.business.marketingActivity.activePrice.mapper.ActivePriceMapper; import com.fuint.business.marketingActivity.activePrice.mapper.ActivePriceRecordMapper; +import com.fuint.business.marketingActivity.activePrice.mapper.ActivePriceRuleMapper; import com.fuint.business.marketingActivity.activePrice.service.ActivePriceRecordService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @@ -18,6 +24,11 @@ import java.util.List; @Service("ActivePriceRecordService") public class ActivePriceRecordServiceImpl extends ServiceImpl implements ActivePriceRecordService { + @Autowired + private ActivePriceMapper activePriceMapper; + @Autowired + private ActivePriceRuleMapper activePriceRuleMapper; + /** * 根据用户Id和活动ids查询所有参与的记录 * @@ -44,4 +55,61 @@ public class ActivePriceRecordServiceImpl extends ServiceImpl() + .eq(ActivePriceRecord::getOrderId, orderId)); + } + + /** + * 删除记录 + * + * @param id + * @return + */ + @Override + public int delete(Integer id) { + return baseMapper.deleteById(id); + } + + /** + * 新增分时优惠记录 + * + * @param actId + * @param ruleId + * @param orderId + * @param disAmount + * @return + */ + @Override + public int add(Integer userId,Integer actId, Integer ruleId, Integer orderId, Double disAmount) { + //通过活动id查询名称 + ActivePrice activePrice = activePriceMapper.selectOne(new LambdaQueryWrapper() + .eq(ActivePrice::getId, actId)); + if (ObjectUtil.isEmpty(activePrice)) { + throw new RuntimeException("未找到该活动"); + } + ActivePriceRecord activePriceRecord = new ActivePriceRecord(); + activePriceRecord.setActId(actId); + activePriceRecord.setRuleId(ruleId); + activePriceRecord.setOrderId(orderId); + activePriceRecord.setStoreId(activePrice.getStoreId()); + activePriceRecord.setDisAmount(disAmount); + activePriceRecord.setActName(activePrice.getTitle()); + activePriceRecord.setActType(activePrice.getActiveType()); + //查询活动规则 + ActivePriceRule activePriceRule = activePriceRuleMapper.selectOne(new LambdaQueryWrapper() + .eq(ActivePriceRule::getId, ruleId)); + if (ObjectUtil.isNotEmpty(activePriceRule)) { + activePriceRecord.setRuleName(activePriceRule.getRuleName()); + } + return baseMapper.insert(activePriceRecord); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/controller/UserDiscountRecordController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/controller/UserDiscountRecordController.java new file mode 100644 index 000000000..46130c5d8 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/controller/UserDiscountRecordController.java @@ -0,0 +1,20 @@ +package com.fuint.business.userGroup.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 会员折扣记录表 前端控制器 + *

+ * + * @author dianliang + * @since 2024-10-11 + */ +@Controller +@RequestMapping("/user-discount-record") +public class UserDiscountRecordController { + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/entity/UserDiscountRecord.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/entity/UserDiscountRecord.java new file mode 100644 index 000000000..b9dab5aee --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/entity/UserDiscountRecord.java @@ -0,0 +1,64 @@ +package com.fuint.business.userGroup.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 会员折扣记录表 + *

+ * + * @author dianliang + * @since 2024-10-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("user_discount_record") +@ApiModel(value="UserDiscountRecord对象", description="会员折扣记录表") +public class UserDiscountRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "会员折扣活动id") + private Integer userDiscountId; + + @ApiModelProperty(value = "用户id") + private Integer userId; + + @ApiModelProperty(value = "店铺id") + private Integer storeId; + + @ApiModelProperty(value = "订单id") + private Integer orderId; + + @ApiModelProperty(value = "优惠金额(元)") + private BigDecimal disAmount; + + @ApiModelProperty(value = "创建者") + private String createBy; + + @ApiModelProperty(value = "更新者") + private String updateBy; + + @ApiModelProperty(value = "创建时间") + private LocalDateTime createTime; + + @ApiModelProperty(value = "更新时间") + private LocalDateTime updateTime; + + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/mapper/UserDiscountRecordMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/mapper/UserDiscountRecordMapper.java new file mode 100644 index 000000000..e50f3c676 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/mapper/UserDiscountRecordMapper.java @@ -0,0 +1,16 @@ +package com.fuint.business.userGroup.mapper; + +import com.fuint.business.userGroup.entity.UserDiscountRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 会员折扣记录表 Mapper 接口 + *

+ * + * @author dianliang + * @since 2024-10-11 + */ +public interface UserDiscountRecordMapper extends BaseMapper { + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/service/IUserDiscountRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/service/IUserDiscountRecordService.java new file mode 100644 index 000000000..335a2463d --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/service/IUserDiscountRecordService.java @@ -0,0 +1,35 @@ +package com.fuint.business.userGroup.service; + +import com.fuint.business.userGroup.entity.UserDiscountRecord; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 会员折扣记录表 服务类 + *

+ * + * @author dianliang + * @since 2024-10-11 + */ +public interface IUserDiscountRecordService extends IService { + + /** + * 新增会员折扣记录 + * @return + */ + int add(UserDiscountRecord userDiscountRecord); + + /** + * 删除会员折扣记录 + * @param id + * @return + */ + int delete(Integer id); + + /** + * 根据订单ID获取会员折扣记录 + * @param orderId + * @return + */ + UserDiscountRecord queryByOrderId(Integer orderId); +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/service/impl/UserDiscountRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/service/impl/UserDiscountRecordServiceImpl.java new file mode 100644 index 000000000..bb665e311 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userGroup/service/impl/UserDiscountRecordServiceImpl.java @@ -0,0 +1,52 @@ +package com.fuint.business.userGroup.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.fuint.business.userGroup.entity.UserDiscountRecord; +import com.fuint.business.userGroup.mapper.UserDiscountRecordMapper; +import com.fuint.business.userGroup.service.IUserDiscountRecordService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 会员折扣记录表 服务实现类 + *

+ * + * @author dianliang + * @since 2024-10-11 + */ +@Service +public class UserDiscountRecordServiceImpl extends ServiceImpl implements IUserDiscountRecordService { + + /** + * 新增会员折扣记录 + * @return + */ + @Override + public int add(UserDiscountRecord userDiscountRecord) { + return baseMapper.insert(userDiscountRecord); + } + + /** + * 删除会员折扣记录 + * + * @param id + * @return + */ + @Override + public int delete(Integer id) { + return baseMapper.deleteById(id); + } + + /** + * 根据订单ID获取会员折扣记录 + * + * @param orderId + * @return + */ + @Override + public UserDiscountRecord queryByOrderId(Integer orderId) { + return baseMapper.selectOne(new LambdaQueryWrapper() + .eq(UserDiscountRecord::getOrderId, orderId)); + } +} diff --git a/fuintBackend/fuint-application/src/main/resources/mapper/UserDiscountRecordMapper.xml b/fuintBackend/fuint-application/src/main/resources/mapper/UserDiscountRecordMapper.xml new file mode 100644 index 000000000..31804cd2b --- /dev/null +++ b/fuintBackend/fuint-application/src/main/resources/mapper/UserDiscountRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/gasStation-uni/pagesMy/signIn/index.vue b/gasStation-uni/pagesMy/signIn/index.vue index 2ae132171..bf7ae632c 100644 --- a/gasStation-uni/pagesMy/signIn/index.vue +++ b/gasStation-uni/pagesMy/signIn/index.vue @@ -111,6 +111,7 @@ this.integral = res.data.pointsChange this.show = true this.getList() + this.getIsSignIn() } }) this.getList()