From 918efbd372ff70ed40547202705883954a87e21c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=90=E5=A4=A9=E5=A4=A7=E5=9C=A3?= <17615834396@163.com> Date: Tue, 12 Mar 2024 14:08:40 +0800 Subject: [PATCH] bug --- .../ActiveConsumptionController.java | 11 ++ .../impl/ActiveConsumptionServiceImpl.java | 80 +++++++++- .../controller/ActiveNewlywedsController.java | 11 ++ .../impl/ActiveNewlywedsServiceImpl.java | 140 +++++++++++++----- .../service/impl/CardValueServiceImpl.java | 8 +- 5 files changed, 212 insertions(+), 38 deletions(-) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/controller/ActiveConsumptionController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/controller/ActiveConsumptionController.java index 2273b6c9d..ef80103eb 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/controller/ActiveConsumptionController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/controller/ActiveConsumptionController.java @@ -1,11 +1,15 @@ package com.fuint.business.marketingActivity.activeConsumption.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; +import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService; import com.fuint.business.marketingActivity.activeConsumption.dto.ActiveConsumptionDTO; import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption; import com.fuint.business.marketingActivity.activeConsumption.service.ActiveConsumptionChildService; import com.fuint.business.marketingActivity.activeConsumption.service.ActiveConsumptionService; +import com.fuint.common.util.TokenUtil; import com.fuint.framework.web.BaseController; import com.fuint.framework.web.ResponseObject; import org.apache.ibatis.annotations.Param; @@ -32,6 +36,8 @@ public class ActiveConsumptionController extends BaseController { private ActiveConsumptionService activeConsumptionService; @Resource private ActiveConsumptionChildService activeConsumptionChildService; + @Resource + private ActiveAppletService activeAppletService; /** * 分页查询所有数据 @@ -132,6 +138,11 @@ public class ActiveConsumptionController extends BaseController { */ @DeleteMapping("delById/{ids}") public ResponseObject delete(@PathVariable Long ids) { + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getActiveId,ids); + queryWrapper1.eq(ActiveApplet::getType,"5"); + activeAppletService.remove(queryWrapper1); return getSuccessResult(this.activeConsumptionService.removeById(ids)); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionServiceImpl.java index 4016a3040..a00d44b0e 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; +import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService; import com.fuint.business.marketingActivity.activeConsumption.dto.ActiveConsumptionDTO; import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionChild; import com.fuint.business.marketingActivity.activeConsumption.mapper.ActiveConsumptionMapper; @@ -95,6 +96,8 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl list = activeConsumptionDTO.getActiveConsumptionChildList(); @@ -353,6 +368,62 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getType,"5"); + queryWrapper1.eq(ActiveApplet::getActiveId,activeConsumptionDTO.getId()); + ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd"); + String formatSt = dateFormat.format(activeConsumptionDTO.getActiveStartTime()); + String formatEd = dateFormat.format(activeConsumptionDTO.getActiveEndTime()); + activeApplet.setTime(formatSt+"-" + formatEd+""); + + //获取会员等级 + String str = ""; + if (ObjectUtils.isNotEmpty(activeConsumptionDTO.getDieselUserLevel())){ + for (String gradeId : activeConsumptionDTO.getDieselUserLevel()) { + if (gradeId.length()>2){ + if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){ + str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ","; + } + }else { + str = "全部会员"; + } + } + }else { + str = "全部会员"; + } + activeApplet.setAdaptUserType(str); + + String oilName = ""; + //油品名称 + String[] adaptOil = activeConsumptionDTO.getAdaptOil(); + for (String oilType : adaptOil) { + OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType)); + oilName += oilName1.getOilType() + "-"+oilName1.getOilName() + ","; + } + activeApplet.setOilName(oilName); + //赠送优惠券兑换券实物 + String card = ""; + if (CollectionUtils.isNotEmpty(activeConsumptionDTO.getActiveConsumptionChildList())) { + for (ActiveConsumptionChild activeConsumptionChild : activeConsumptionDTO.getActiveConsumptionChildList()) { + card += activeConsumptionChild.getGiftCardDetail() + "的券,"; + } + } + activeApplet.setPoints(activeConsumptionDTO.getPoints()); + activeApplet.setType("5"); + activeApplet.setName("消费有礼活动"); + String type = ""; + if (activeConsumptionDTO.getMoneyType().equals("1")){ + type ="订单金额"; + }else { + type ="实付金额"; + } + activeApplet.setDiscountActiveDescribe("此项消费有礼活动,"+type+"满"+ + activeConsumptionDTO.getParticipationConditionMoney()+"元可参与,赠送积分为:"+activeConsumptionDTO.getPoints()+"积分,赠送券:"+card+"。"); + activeAppletService.updateById(activeApplet); + //更新消费有礼 ActiveConsumption activeConsumption = new ActiveConsumption(); String participationConditionMoney = activeConsumptionDTO.getParticipationConditionMoney(); @@ -412,6 +483,13 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getActiveId,id); + queryWrapper1.eq(ActiveApplet::getType,"5"); + ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1); + activeApplet.setIsonline(isonline); + activeAppletService.updateById(activeApplet); return row == 1; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/ActiveNewlywedsController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/ActiveNewlywedsController.java index af6057f9b..5862c55a8 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/ActiveNewlywedsController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/ActiveNewlywedsController.java @@ -2,12 +2,16 @@ package com.fuint.business.marketingActivity.activeNewlyweds.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; +import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService; import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption; import com.fuint.business.marketingActivity.activeNewlyweds.dto.ActiveNewlywedsDTO; import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlyweds; import com.fuint.business.marketingActivity.activeNewlyweds.service.ActiveNewlywedsChildService; import com.fuint.business.marketingActivity.activeNewlyweds.service.ActiveNewlywedsService; +import com.fuint.common.util.TokenUtil; import com.fuint.framework.web.BaseController; import com.fuint.framework.web.ResponseObject; import org.apache.ibatis.annotations.Param; @@ -34,6 +38,8 @@ public class ActiveNewlywedsController extends BaseController { private ActiveNewlywedsService activeNewlywedsService; @Resource private ActiveNewlywedsChildService activeNewlywedsChildService; + @Resource + private ActiveAppletService activeAppletService; /** * 分页查询所有数据 @@ -123,6 +129,11 @@ public class ActiveNewlywedsController extends BaseController { */ @DeleteMapping("delById/{ids}") public ResponseObject delete(@PathVariable Integer ids) { + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getActiveId,ids); + queryWrapper1.eq(ActiveApplet::getType,"6"); + activeAppletService.remove(queryWrapper1); return getSuccessResult(this.activeNewlywedsService.removeById(ids)); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java index 4bd752427..9e1f32d12 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java @@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; +import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService; import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption; +import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionChild; import com.fuint.business.marketingActivity.activeNewlyweds.controller.vo.ActiveNewlywedsAppletVO; import com.fuint.business.marketingActivity.activeNewlyweds.controller.vo.ActiveNewlywedsVO; import com.fuint.business.marketingActivity.activeNewlyweds.dto.ActiveNewlywedsDTO; @@ -34,6 +37,7 @@ import com.fuint.repository.model.TAccount; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.io.Serializable; @@ -66,15 +70,20 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,storeId); @@ -97,6 +106,28 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl list = activeNewlywedsDTO.getActiveNewlywedsChildList(); list.stream().map(s ->{ @@ -128,6 +159,70 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getType,"6"); + queryWrapper1.eq(ActiveApplet::getActiveId,activeNewlywedsDTO.getId()); + ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd"); + String formatSt = dateFormat.format(activeNewlywedsDTO.getActiveStartTime()); + String formatEd = dateFormat.format(activeNewlywedsDTO.getActiveEndTime()); + activeApplet.setTime(formatSt+"-" + formatEd+""); + + activeApplet.setPoints(activeNewlywedsDTO.getPoints()); + activeApplet.setGrowaValue(activeNewlywedsDTO.getGrowthValue()); + + //赠送优惠券兑换券实物 + String card = ""; + if (CollectionUtils.isNotEmpty(activeNewlywedsDTO.getActiveNewlywedsChildList())) { + for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsDTO.getActiveNewlywedsChildList()) { + card += activeNewlywedsChild.getGiftCardDetail() + "的券,"; + } + } + activeApplet.setDiscountActiveDescribe("此项新人有礼活动,登录赠送积分为:"+activeNewlywedsDTO.getPoints()+"积分,赠送成长值为:"+activeNewlywedsDTO.getGrowthValue()+"成长值,赠送券为:"+card+"。"); + activeAppletService.updateById(activeApplet); + + //更新新人有礼活动 + ActiveNewlyweds activeNewlyweds = new ActiveNewlyweds(); + BeanUtils.copyProperties(activeNewlywedsDTO,activeNewlyweds); + TAccount accountInfoById = accountService.getAccountInfoById(TokenUtil.getNowAccountInfo().getId()); + if (ObjectUtil.isNotEmpty(accountInfoById)) activeNewlyweds.setCreateBy(accountInfoById.getRealName()); + //奖励类型 + activeNewlyweds.setCourtesyReward(arrayToString(activeNewlywedsDTO.getCourtesyReward())); + + if (activeNewlywedsDTO.getIsonline().equals("1")){ + activeNewlyweds.setStatus("2"); + } + update = updateById(activeNewlyweds); + //更新子表数据 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlywedsDTO.getId()); + activeNewlywedsChildService.remove(queryWrapper); + //新增兑换物品 + List activeNewlywedsChildList = activeNewlywedsDTO.getActiveNewlywedsChildList(); + if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ + activeNewlywedsChildList.stream().map(s ->{ + s.setActiveNewlywedsId(activeNewlyweds.getId()); + return s; + }).collect(Collectors.toList()); + update = activeNewlywedsChildService.saveBatch(activeNewlywedsChildList); + } + return update; + } + + + /** * 分页查询所有数据 * @param page @@ -443,41 +538,7 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlywedsDTO.getId()); - activeNewlywedsChildService.remove(queryWrapper); - //新增兑换物品 - List activeNewlywedsChildList = activeNewlywedsDTO.getActiveNewlywedsChildList(); - if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ - activeNewlywedsChildList.stream().map(s ->{ - s.setActiveNewlywedsId(activeNewlyweds.getId()); - return s; - }).collect(Collectors.toList()); - update = activeNewlywedsChildService.saveBatch(activeNewlywedsChildList); - } - return update; - } @Override public Boolean updateIsonline(Integer id, String isonline) { @@ -488,6 +549,15 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getActiveId,id); + queryWrapper1.eq(ActiveApplet::getType,"6"); + ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1); + activeApplet.setIsonline(isonline); + activeAppletService.updateById(activeApplet); + return row == 1; } 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 76d20ef82..f0a8251ae 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 @@ -388,8 +388,12 @@ public class CardValueServiceImpl extends ServiceImpl2){ + if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){ + str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ","; + } + }else { + str = "普通群体"; } } }else {