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 f0856c08b..05a8abe3d 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 @@ -166,7 +166,7 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM Integer[] array = Arrays.stream(s.getAdaptOil().split(",")) .map(Integer::valueOf) .toArray(Integer[]::new); - String[] adaptOil = new String[array.length]; + /*String[] adaptOil = new String[array.length]; if (array.length>0) { for (int i = 0;i<array.length;i++) { OilName oilName = oilNameService.selectOilNameById(array[i]); @@ -174,15 +174,15 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM adaptOil[i] = oilName.getOilName(); } } - } + }*/ activeConsumptionVO.setAdaptOil(Arrays.stream(s.getAdaptOil().split(",")) .map(Integer::valueOf) .toArray(Integer[]::new)); - activeConsumptionVO.setAdaptOils(adaptOil); + //activeConsumptionVO.setAdaptOils(adaptOil); activeConsumptionVO.setActiveGift(s.getActiveGift().split(",")); //获取会员等级 - String str = ""; + /*String str = ""; if (ObjectUtils.isNotEmpty(s.getDieselUserLevel())){ for (String gradeId : s.getDieselUserLevel().split(",")) { LJUserGrade ljUserGrade = userGradeService.selectUserGradeById(Integer.parseInt(gradeId)); @@ -191,7 +191,7 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM } } activeConsumptionVO.setDieselUserLevel(str.split(",")); - } + }*/ List<ActiveConsumptionChild> activeConsumptionChildList = activeConsumptionChildService.selectList(s.getId()); int youhuiTed = 0; int duihuanTed = 0; @@ -227,7 +227,9 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM activeConsumptionVO.setDuihuanTotaled(duihuanTed); TAccount accountInfoById = accountService.getAccountInfoById(Integer.parseInt(s.getCreateBy())); - if (ObjectUtil.isNotEmpty(accountInfoById)) activeConsumptionVO.setCreateBy(accountInfoById.getRealName()); + if (ObjectUtil.isNotEmpty(accountInfoById)) { + activeConsumptionVO.setCreateBy(accountInfoById.getRealName()); + } return activeConsumptionVO; }).collect(Collectors.toList()); activeConsumptionVOSIPage.setRecords(activeConsumptionVOList); @@ -385,7 +387,9 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM }else if (s.getAdaptUserType().equals("1")){ adaptUserType = "全部会员"; }else { - adaptUserType = arrayToString(s.getDieselUserLevel()); + if(ObjectUtils.isNotEmpty(s.getDieselUserLevel())){ + adaptUserType = arrayToString(s.getDieselUserLevel()); + } } //赠送优惠券兑换券实物 String card = ""; @@ -399,13 +403,13 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM } } } - ArrayList<String> oilNameList = new ArrayList<>(); + /* ArrayList<String> oilNameList = new ArrayList<>(); //油号名字 for (Integer id : s.getAdaptOil()) { String oilName = oilNameService.selectOilNameById(id).getOilName(); oilNameList.add(oilName); - } - activeConsumptionAppletVO.setOilName(oilNameList); + }*/ + //activeConsumptionAppletVO.setOilName(oilNameList); activeConsumptionAppletVO.setPoints(s.getPoints()); activeConsumptionAppletVO.setAdaptUserType(adaptUserType); String goodss = ""; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java index 9c0cb7d89..2a5848746 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java @@ -42,6 +42,9 @@ import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableR import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService; import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableRecordVO; import com.fuint.business.marketingActivity.cardFavorable.vo.CouponVO; +import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel; +import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService; +import com.fuint.business.marketingActivity.cardFule.vo.CardFuelDieselVO; import com.fuint.business.marketingActivity.cardValue.entity.CardValue; import com.fuint.business.marketingActivity.cardValue.service.CardValueService; import com.fuint.business.marketingActivity.cardValue.vo.CardValueAppletVO; @@ -128,6 +131,8 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { private ChainStoreConfigService chainStoreConfigService; @Resource private ActiveConsumptionChildService activeConsumptionChildService; + @Resource + private CardFuelDieselService cardFuelDieselService; /** * 分页查询所有 * @param @@ -344,6 +349,38 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { @Override public List<ActiveAppletVO> select(ActiveExchangeRecordDTO activeExchangeRecordDTO) { ArrayList<ActiveAppletVO> activeAppletVOS = new ArrayList<>(); + //充值有礼 + CardValue cardValue = new CardValue(); + cardValue.setStoreId(activeExchangeRecordDTO.getStoreId()); + List<CardValueAppletVO> cardValueAppletVOS = cardValueService.selectAllApplet(cardValue); + if (CollectionUtils.isNotEmpty(cardValueAppletVOS)){ + ActiveAppletVO activeAppletVO = new ActiveAppletVO(); + activeAppletVO.setName("储值卡充值活动"); + activeAppletVO.setDes(cardValueAppletVOS.get(0).getDiscountActiveDescribe()); + activeAppletVO.setTime(cardValueAppletVOS.get(0).getTime()); + activeAppletVOS.add(activeAppletVO); + }else { + ActiveAppletVO activeAppletVO = new ActiveAppletVO(); + activeAppletVO.setName("储值卡充值活动"); + activeAppletVO.setDes("活动准备中,敬请期待!"); + activeAppletVOS.add(activeAppletVO); + } + //囤油卡有礼 + CardFuelDiesel cardFuelDiesel = new CardFuelDiesel(); + cardFuelDiesel.setStoreId(activeExchangeRecordDTO.getStoreId()); + List<CardFuelDieselVO> cardFuelDieselVOS = cardFuelDieselService.selectAllAppletByStorId(cardFuelDiesel); + if (CollectionUtils.isNotEmpty(cardFuelDieselVOS)){ + ActiveAppletVO activeAppletVO = new ActiveAppletVO(); + activeAppletVO.setName("囤油卡充值活动"); + activeAppletVO.setDes(cardFuelDieselVOS.get(0).getDiscountActiveDescribe()); + activeAppletVO.setTime(cardFuelDieselVOS.get(0).getTime()); + activeAppletVOS.add(activeAppletVO); + }else { + ActiveAppletVO activeAppletVO = new ActiveAppletVO(); + activeAppletVO.setName("囤油卡充值活动"); + activeAppletVO.setDes("活动准备中,敬请期待!"); + activeAppletVOS.add(activeAppletVO); + } //消费有礼活动 ActiveConsumption consumption = new ActiveConsumption(); consumption.setStoreId(activeExchangeRecordDTO.getStoreId()); @@ -393,12 +430,12 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { activeAppletVOS.add(activeAppletVO); } //新人有礼 - ActiveNewlywedsAppletVO activeNewlywedsAppletVO = activeNewlywedsService.selectApplet(consumption); - if (ObjectUtils.isNotEmpty(activeNewlywedsAppletVO) && ObjectUtils.isNotEmpty(activeNewlywedsAppletVO.getNewlywedsActiveDescribe())){ + List<ActiveNewlywedsAppletVO> activeNewlywedsAppletVOS = activeNewlywedsService.selectApplet(consumption); + if (ObjectUtils.isNotEmpty(activeNewlywedsAppletVOS)){ ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("新人有礼活动"); - activeAppletVO.setDes(activeNewlywedsAppletVO.getNewlywedsActiveDescribe()); - activeAppletVO.setTime(activeNewlywedsAppletVO.getTime()); + activeAppletVO.setDes(activeNewlywedsAppletVOS.get(0).getNewlywedsActiveDescribe()); + activeAppletVO.setTime(activeNewlywedsAppletVOS.get(0).getTime()); activeAppletVOS.add(activeAppletVO); }else { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); @@ -407,11 +444,11 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { activeAppletVOS.add(activeAppletVO); } //推荐有礼 - ActiveRecommendAppletVO activeRecommendAppletVO = activeRecommendService.selectApplet(consumption); - if (ObjectUtils.isNotEmpty(activeRecommendAppletVO) && ObjectUtils.isNotEmpty(activeRecommendAppletVO.getRecommendActiveDescribeIn())){ + List<ActiveRecommendAppletVO> activeRecommendAppletVOS = activeRecommendService.selectApplet(consumption); + if (ObjectUtils.isNotEmpty(activeRecommendAppletVOS)){ ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("推荐有礼活动"); - activeAppletVO.setDes(activeRecommendAppletVO.getRecommendActiveDescribeIn()); + activeAppletVO.setDes(activeRecommendAppletVOS.get(0).getRecommendActiveDescribeIn()); activeAppletVO.setTime("永久有效"); activeAppletVOS.add(activeAppletVO); }else { @@ -420,22 +457,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { activeAppletVO.setDes("活动准备中,敬请期待!"); activeAppletVOS.add(activeAppletVO); } - //充值有礼 - CardValue cardValue = new CardValue(); - cardValue.setStoreId(activeExchangeRecordDTO.getStoreId()); - List<CardValueAppletVO> cardValueAppletVOS = cardValueService.selectAllApplet(cardValue); - if (CollectionUtils.isNotEmpty(cardValueAppletVOS)){ - ActiveAppletVO activeAppletVO = new ActiveAppletVO(); - activeAppletVO.setName("储值卡充值活动"); - activeAppletVO.setDes(cardValueAppletVOS.get(0).getDiscountActiveDescribe()); - activeAppletVO.setTime(cardValueAppletVOS.get(0).getTime()); - activeAppletVOS.add(activeAppletVO); - }else { - ActiveAppletVO activeAppletVO = new ActiveAppletVO(); - activeAppletVO.setName("储值卡充值活动"); - activeAppletVO.setDes("活动准备中,敬请期待!"); - activeAppletVOS.add(activeAppletVO); - } + return activeAppletVOS; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/service/impl/ActiveFullminusServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/service/impl/ActiveFullminusServiceImpl.java index dac865e3f..e45e57803 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/service/impl/ActiveFullminusServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/service/impl/ActiveFullminusServiceImpl.java @@ -254,11 +254,11 @@ public class ActiveFullminusServiceImpl extends ServiceImpl<ActiveFullminusMappe String formatEd = dateFormat.format(s.getActiveEndTime()); activeFullminusAppletVO.setTime(formatSt+"-" + formatEd+""); //油号名字 - ArrayList<String> oilNameList = new ArrayList<>(); + /* ArrayList<String> oilNameList = new ArrayList<>(); for (Integer id : s.getAdaptOil()) { String oilName = oilNameService.selectOilNameById(id).getOilName(); oilNameList.add(oilName); - } + }*/ //适用用户名 String adaptUserType = ""; adaptUserType = arrayToString(s.getDieselUserLevel()); @@ -273,7 +273,7 @@ public class ActiveFullminusServiceImpl extends ServiceImpl<ActiveFullminusMappe } } activeFullminusAppletVO.setAdaptUserType(adaptUserType); - activeFullminusAppletVO.setOilName(oilNameList); + // activeFullminusAppletVO.setOilName(oilNameList); activeFullminusAppletVO.setFullminusActiveDescribe(s.getName() +"享受满" + amount + "元,减" + discount + "元。"); return activeFullminusAppletVO; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java index 684be40a7..bd5c6ba59 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java @@ -42,7 +42,7 @@ public interface ActiveNewlywedsService extends IService<ActiveNewlyweds> { */ ActiveNewlywedsVO getOneById(Serializable id); ActiveNewlywedsVO getOneByStoreId(Serializable id); - ActiveNewlywedsVO getOneByIdApplet(ActiveConsumption activeConsumption); + List<ActiveNewlywedsVO> getOneByIdApplet(ActiveConsumption activeConsumption); /** * 修改数据 @@ -55,6 +55,6 @@ public interface ActiveNewlywedsService extends IService<ActiveNewlyweds> { * 查询单条数据(小程序端) * @return */ - ActiveNewlywedsAppletVO selectApplet(ActiveConsumption activeConsumption); + List<ActiveNewlywedsAppletVO> selectApplet(ActiveConsumption activeConsumption); } 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 77208758e..b7a46ae17 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 @@ -395,36 +395,46 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe * @return */ @Override - public ActiveNewlywedsVO getOneByIdApplet(ActiveConsumption activeConsumption) { + public List<ActiveNewlywedsVO> getOneByIdApplet(ActiveConsumption activeConsumption) { Integer storeId = activeConsumption.getStoreId(); - ActiveNewlywedsVO activeNewlywedsVO = new ActiveNewlywedsVO(); - activeNewlywedsVO.setCourtesyReward(new String[0]); + ArrayList<ActiveNewlywedsVO> arrayList = new ArrayList<>(); if (ObjectUtils.isNotEmpty(storeId)){ //获取新人有礼活动信息 LambdaQueryWrapper<ActiveNewlyweds> lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,storeId); - ActiveNewlyweds activeNewlyweds = getOne(lambdaQueryWrapper); + List<ActiveNewlyweds> list = list(lambdaQueryWrapper); + //ActiveNewlyweds activeNewlyweds = getOne(lambdaQueryWrapper); //获取兑换物品信息 - if (ObjectUtils.isNotEmpty(activeNewlyweds)){ - LambdaQueryWrapper<ActiveNewlywedsChild> queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlyweds.getId()); - queryWrapper.orderByDesc(ActiveNewlywedsChild::getCreateTime); - List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlywedsChildService.list(queryWrapper); - BeanUtils.copyProperties(activeNewlyweds,activeNewlywedsVO); - //封装VO返回 - activeNewlywedsVO.setCourtesyReward(activeNewlyweds.getCourtesyReward().split(",")); - if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ - activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList); - }else { - ArrayList<ActiveNewlywedsChild> activeNewlywedsChildLists = new ArrayList<>(); - activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildLists); + if (ObjectUtils.isNotEmpty(list)){ + for (ActiveNewlyweds activeNewlyweds : list) { + ActiveNewlywedsVO activeNewlywedsVO = new ActiveNewlywedsVO(); + activeNewlywedsVO.setCourtesyReward(new String[0]); + + LambdaQueryWrapper<ActiveNewlywedsChild> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlyweds.getId()); + queryWrapper.orderByDesc(ActiveNewlywedsChild::getCreateTime); + List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlywedsChildService.list(queryWrapper); + BeanUtils.copyProperties(activeNewlyweds,activeNewlywedsVO); + //封装VO返回 + activeNewlywedsVO.setCourtesyReward(activeNewlyweds.getCourtesyReward().split(",")); + if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ + activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList); + }else { + ArrayList<ActiveNewlywedsChild> activeNewlywedsChildLists = new ArrayList<>(); + activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildLists); + } + arrayList.add(activeNewlywedsVO); } + }else { + ActiveNewlywedsVO activeNewlywedsVO = new ActiveNewlywedsVO(); + activeNewlywedsVO.setCourtesyReward(new String[0]); ArrayList<ActiveNewlywedsChild> activeNewlywedsChildList = new ArrayList<>(); activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList); + arrayList.add(activeNewlywedsVO); } } - return activeNewlywedsVO; + return arrayList; } /** @@ -464,49 +474,56 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe } @Override - public ActiveNewlywedsAppletVO selectApplet(ActiveConsumption activeConsumption) { - ActiveNewlywedsAppletVO activeNewlywedsAppletVO = new ActiveNewlywedsAppletVO(); + public List<ActiveNewlywedsAppletVO> selectApplet(ActiveConsumption activeConsumption) { + ArrayList<ActiveNewlywedsAppletVO> arrayList = new ArrayList<>(); //获取本店铺的推荐有礼活动 - ActiveNewlywedsVO activeNewlywedsVO = getOneByIdApplet(activeConsumption); - if (ObjectUtils.isNotEmpty(activeNewlywedsVO.getId())){ - //活动时间 - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd"); - String formatSt = dateFormat.format(activeNewlywedsVO.getActiveStartTime()); - String formatEd = dateFormat.format(activeNewlywedsVO.getActiveEndTime()); - activeNewlywedsAppletVO.setTime(formatSt+"-" + formatEd+""); - //邀请人获得 - if (ObjectUtils.isNotEmpty(activeNewlywedsVO) && ObjectUtils.isNotEmpty(activeNewlywedsVO.getPoints())){ - //积分 - activeNewlywedsAppletVO.setPoint(activeNewlywedsVO.getPoints().toString()); - } - if (ObjectUtils.isNotEmpty(activeNewlywedsVO) && ObjectUtils.isNotEmpty(activeNewlywedsVO.getGrowthValue())){ - //成长值 - activeNewlywedsAppletVO.setGrowValue(activeNewlywedsVO.getGrowthValue().toString()); - } - //邀请人赠送优惠券兑换券 - String cardi1 = ""; - String cardo1 = ""; - if (CollectionUtils.isNotEmpty(activeNewlywedsVO.getActiveNewlywedsChildList())){ - for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsVO.getActiveNewlywedsChildList()) { - if (activeNewlywedsChild.getActiveGift().equals("1")){ - //优惠券 - cardi1 += activeNewlywedsChild.getGiftCardName()+"的券("+activeNewlywedsChild.getGiftCardDetail()+");"; + List<ActiveNewlywedsVO> oneByIdApplet = getOneByIdApplet(activeConsumption); + if (ObjectUtils.isNotEmpty(oneByIdApplet)){ + for (ActiveNewlywedsVO activeNewlywedsVO : oneByIdApplet) { + ActiveNewlywedsAppletVO activeNewlywedsAppletVO = new ActiveNewlywedsAppletVO(); + if (ObjectUtils.isNotEmpty(activeNewlywedsVO.getId())){ + //活动时间 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd"); + String formatSt = dateFormat.format(activeNewlywedsVO.getActiveStartTime()); + String formatEd = dateFormat.format(activeNewlywedsVO.getActiveEndTime()); + activeNewlywedsAppletVO.setTime(formatSt+"-" + formatEd+""); + //邀请人获得 + if (ObjectUtils.isNotEmpty(activeNewlywedsVO) && ObjectUtils.isNotEmpty(activeNewlywedsVO.getPoints())){ + //积分 + activeNewlywedsAppletVO.setPoint(activeNewlywedsVO.getPoints().toString()); } - if (activeNewlywedsChild.getActiveGift().equals("2")){ - //兑换券 - cardo1 += activeNewlywedsChild.getGiftCardName()+"的券;"; + if (ObjectUtils.isNotEmpty(activeNewlywedsVO) && ObjectUtils.isNotEmpty(activeNewlywedsVO.getGrowthValue())){ + //成长值 + activeNewlywedsAppletVO.setGrowValue(activeNewlywedsVO.getGrowthValue().toString()); } + //邀请人赠送优惠券兑换券 + String cardi1 = ""; + String cardo1 = ""; + if (CollectionUtils.isNotEmpty(activeNewlywedsVO.getActiveNewlywedsChildList())){ + for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsVO.getActiveNewlywedsChildList()) { + if (activeNewlywedsChild.getActiveGift().equals("1")){ + //优惠券 + cardi1 += activeNewlywedsChild.getGiftCardName()+"的券("+activeNewlywedsChild.getGiftCardDetail()+");"; + } + if (activeNewlywedsChild.getActiveGift().equals("2")){ + //兑换券 + cardo1 += activeNewlywedsChild.getGiftCardName()+"的券;"; + } + } + } + //邀请人的券 + //积分 + activeNewlywedsAppletVO.setPoint(activeNewlywedsVO.getPoints().toString()); + //成长值 + activeNewlywedsAppletVO.setGrowValue(activeNewlywedsVO.getGrowthValue().toString()); + activeNewlywedsAppletVO.setNewlywedsActiveDescribe("欢迎各位亲朋好友参加本店的新人有礼活动,我们有丰厚的奖励哦,参加即送优惠券:"+cardi1+"兑换券:"+cardo1); + arrayList.add(activeNewlywedsAppletVO); + //return activeNewlywedsAppletVO; } } - //邀请人的券 - //积分 - activeNewlywedsAppletVO.setPoint(activeNewlywedsVO.getPoints().toString()); - //成长值 - activeNewlywedsAppletVO.setGrowValue(activeNewlywedsVO.getGrowthValue().toString()); - activeNewlywedsAppletVO.setNewlywedsActiveDescribe("欢迎各位亲朋好友参加本店的新人有礼活动,我们有丰厚的奖励哦,参加即送优惠券:"+cardi1+"兑换券:"+cardo1); - return activeNewlywedsAppletVO; } - return activeNewlywedsAppletVO; + + return arrayList; } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/ActiveRecommendService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/ActiveRecommendService.java index 63047f415..bb9a4e174 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/ActiveRecommendService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/ActiveRecommendService.java @@ -33,7 +33,7 @@ public interface ActiveRecommendService extends IService<ActiveRecommend> { * @return */ ActiveRecommendVO getOneById(Serializable id); - ActiveRecommendVO getOneByIdApplet(ActiveConsumption activeConsumption); + List<ActiveRecommendVO> getOneByIdApplet(ActiveConsumption activeConsumption); /** * 修改数据 @@ -46,7 +46,7 @@ public interface ActiveRecommendService extends IService<ActiveRecommend> { * 查询单条数据(小程序端) * @return */ - ActiveRecommendAppletVO selectApplet(ActiveConsumption activeConsumption); + List<ActiveRecommendAppletVO> selectApplet(ActiveConsumption activeConsumption); IPage select(Page page, ActiveRecommend activeRecommend); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendRecordsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendRecordsServiceImpl.java index 713ff9244..7e5497cc5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendRecordsServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendRecordsServiceImpl.java @@ -124,21 +124,24 @@ public class ActiveRecommendRecordsServiceImpl extends ServiceImpl<ActiveRecomme //推荐有礼活动 ActiveConsumption activeConsumption = new ActiveConsumption(); activeConsumption.setStoreId(storeId); - ActiveRecommendVO activeRecommendVO = activeRecommendService.getOneByIdApplet(activeConsumption); - //活动所送推荐人的优惠券 - List<ActiveRecommendChild> activeRecommendChildList = activeRecommendVO.getActiveRecommendChildList(); - if(CollectionUtils.isNotEmpty(activeRecommendChildList)){ - for (ActiveRecommendChild activeRecommendChild : activeRecommendChildList) { - if (activeRecommendChild.getActiveGift().equals("1")){ - //券数量 - Integer giftCardTotal = activeRecommendChild.getGiftCardTotal(); - //券id - Integer vouchersId = activeRecommendChild.getVouchersId(); - //券总额 - discountAmount += (cardFavorableService.getById(vouchersId).getDiscountAmount() * giftCardTotal * size); + List<ActiveRecommendVO> oneByIdApplet = activeRecommendService.getOneByIdApplet(activeConsumption); + for (ActiveRecommendVO activeRecommendVO : oneByIdApplet) { + //活动所送推荐人的优惠券 + List<ActiveRecommendChild> activeRecommendChildList = activeRecommendVO.getActiveRecommendChildList(); + if(CollectionUtils.isNotEmpty(activeRecommendChildList)){ + for (ActiveRecommendChild activeRecommendChild : activeRecommendChildList) { + if (activeRecommendChild.getActiveGift().equals("1")){ + //券数量 + Integer giftCardTotal = activeRecommendChild.getGiftCardTotal(); + //券id + Integer vouchersId = activeRecommendChild.getVouchersId(); + //券总额 + discountAmount += (cardFavorableService.getById(vouchersId).getDiscountAmount() * giftCardTotal * size); + } } } } + } return discountAmount; } @@ -162,67 +165,70 @@ public class ActiveRecommendRecordsServiceImpl extends ServiceImpl<ActiveRecomme LJUser ljUser = ljUserService.queryUserByUserId(userId); ActiveConsumption activeConsumption = new ActiveConsumption(); activeConsumption.setStoreId(activeRecommendRecordsDTO.getStoreId()); - ActiveRecommendVO activeRecommendVO = activeRecommendService.getOneByIdApplet(activeConsumption); - UserBalance userBalance = userBalanceService.selectUserBalance(Integer.parseInt(activeRecommendRecordsDTO.getUserId()),iljStoreService.selectStoreByStoreId(activeRecommendRecordsDTO.getStoreId()).getChainStoreId()); - //积分 - if (ObjectUtils.isNotEmpty(activeRecommendVO.getPoints())){ - userBalance.setPoints(userBalance.getPoints() + activeRecommendVO.getPoints()); - } - //成长值 - if (ObjectUtils.isNotEmpty(activeRecommendVO.getGrowthValue())){ - userBalance.setGrowthValue(userBalance.getGrowthValue() + activeRecommendVO.getGrowthValue()); - } - //卡券 - List<ActiveRecommendChild> activeRecommendChildList = activeRecommendVO.getActiveRecommendChildList(); - if(CollectionUtils.isNotEmpty(activeRecommendChildList)){ - for (ActiveRecommendChild activeRecommendChild : activeRecommendChildList) { - //优惠券 - if (activeRecommendChild.getGiftUserType().equals("0") && activeRecommendChild.getActiveGift().equals("1")){ - CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); - cardFavorableRecord.setCardFavorableId(activeRecommendChild.getVouchersId()); - cardFavorableRecord.setStoreId(activeRecommendRecordsDTO.getStoreId()); - cardFavorableRecord.setMtUserId(ljUser1.getId()); - cardFavorableRecord.setName(ljUser1.getName()); - cardFavorableRecord.setMobile(ljUser1.getMobile()); - cardFavorableRecord.setStatus("0"); - cardFavorableRecord.setExchangeFrom("推荐有礼"); - cardFavorableRecord.setActiveId(activeRecommendChild.getActiveRecommendId()); - cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord); - } - //兑换券 - if (activeRecommendChild.getGiftUserType().equals("0") && activeRecommendChild.getActiveGift().equals("2")){ - CardExchangeRecord cardExchangeRecord = new CardExchangeRecord(); - cardExchangeRecord.setCardExchangeId(activeRecommendChild.getVouchersId()); - cardExchangeRecord.setStoreId(activeRecommendRecordsDTO.getStoreId()); - cardExchangeRecord.setMtUserId(ljUser1.getId()); - cardExchangeRecord.setName(ljUser1.getName()); - cardExchangeRecord.setMobile(ljUser1.getMobile()); - cardExchangeRecord.setPhoto(ljUser1.getAvatar()); - cardExchangeRecord.setStatus("0"); - cardExchangeRecord.setExchangeFrom("推荐有礼"); - cardExchangeRecord.setActiveId(activeRecommendChild.getActiveRecommendId()); - cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord); - } - //被邀请人优惠券 - if (activeRecommendChild.getGiftUserType().equals("1") && activeRecommendChild.getActiveGift().equals("1")){ - CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); - cardFavorableRecord.setCardFavorableId(activeRecommendChild.getVouchersId()); - cardFavorableRecord.setStoreId(activeRecommendRecordsDTO.getStoreId()); - cardFavorableRecord.setMtUserId(ljUser.getId()); - cardFavorableRecord.setName(ljUser.getName()); - cardFavorableRecord.setMobile(ljUser.getMobile()); - cardFavorableRecord.setStatus("0"); - cardFavorableRecord.setExchangeFrom("新人送券"); - cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord); + List<ActiveRecommendVO> oneByIdApplet = activeRecommendService.getOneByIdApplet(activeConsumption); + for (ActiveRecommendVO activeRecommendVO : oneByIdApplet) { + UserBalance userBalance = userBalanceService.selectUserBalance(Integer.parseInt(activeRecommendRecordsDTO.getUserId()),iljStoreService.selectStoreByStoreId(activeRecommendRecordsDTO.getStoreId()).getChainStoreId()); + //积分 + if (ObjectUtils.isNotEmpty(activeRecommendVO.getPoints())){ + userBalance.setPoints(userBalance.getPoints() + activeRecommendVO.getPoints()); + } + //成长值 + if (ObjectUtils.isNotEmpty(activeRecommendVO.getGrowthValue())){ + userBalance.setGrowthValue(userBalance.getGrowthValue() + activeRecommendVO.getGrowthValue()); + } + //卡券 + List<ActiveRecommendChild> activeRecommendChildList = activeRecommendVO.getActiveRecommendChildList(); + if(CollectionUtils.isNotEmpty(activeRecommendChildList)){ + for (ActiveRecommendChild activeRecommendChild : activeRecommendChildList) { + //优惠券 + if (activeRecommendChild.getGiftUserType().equals("0") && activeRecommendChild.getActiveGift().equals("1")){ + CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); + cardFavorableRecord.setCardFavorableId(activeRecommendChild.getVouchersId()); + cardFavorableRecord.setStoreId(activeRecommendRecordsDTO.getStoreId()); + cardFavorableRecord.setMtUserId(ljUser1.getId()); + cardFavorableRecord.setName(ljUser1.getName()); + cardFavorableRecord.setMobile(ljUser1.getMobile()); + cardFavorableRecord.setStatus("0"); + cardFavorableRecord.setExchangeFrom("推荐有礼"); + cardFavorableRecord.setActiveId(activeRecommendChild.getActiveRecommendId()); + cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord); + } + //兑换券 + if (activeRecommendChild.getGiftUserType().equals("0") && activeRecommendChild.getActiveGift().equals("2")){ + CardExchangeRecord cardExchangeRecord = new CardExchangeRecord(); + cardExchangeRecord.setCardExchangeId(activeRecommendChild.getVouchersId()); + cardExchangeRecord.setStoreId(activeRecommendRecordsDTO.getStoreId()); + cardExchangeRecord.setMtUserId(ljUser1.getId()); + cardExchangeRecord.setName(ljUser1.getName()); + cardExchangeRecord.setMobile(ljUser1.getMobile()); + cardExchangeRecord.setPhoto(ljUser1.getAvatar()); + cardExchangeRecord.setStatus("0"); + cardExchangeRecord.setExchangeFrom("推荐有礼"); + cardExchangeRecord.setActiveId(activeRecommendChild.getActiveRecommendId()); + cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord); + } + //被邀请人优惠券 + if (activeRecommendChild.getGiftUserType().equals("1") && activeRecommendChild.getActiveGift().equals("1")){ + CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); + cardFavorableRecord.setCardFavorableId(activeRecommendChild.getVouchersId()); + cardFavorableRecord.setStoreId(activeRecommendRecordsDTO.getStoreId()); + cardFavorableRecord.setMtUserId(ljUser.getId()); + cardFavorableRecord.setName(ljUser.getName()); + cardFavorableRecord.setMobile(ljUser.getMobile()); + cardFavorableRecord.setStatus("0"); + cardFavorableRecord.setExchangeFrom("新人送券"); + cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord); + } } } + userBalanceService.updateById(userBalance); + //被邀请人 + activeRecommendRecords.setInviteeUserId(userId.toString()); + activeRecommendRecords.setInviteeUserName(ljUser.getName()); + return save(activeRecommendRecords); } - userBalanceService.updateById(userBalance); - //被邀请人 - activeRecommendRecords.setInviteeUserId(userId.toString()); - activeRecommendRecords.setInviteeUserName(ljUser.getName()); - return save(activeRecommendRecords); - } + } + return false; } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendServiceImpl.java index d6d1245d3..8417ca9fa 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendServiceImpl.java @@ -221,35 +221,42 @@ public class ActiveRecommendServiceImpl extends ServiceImpl<ActiveRecommendMappe * @return */ @Override - public ActiveRecommendVO getOneByIdApplet(ActiveConsumption activeConsumption) { + public List<ActiveRecommendVO> getOneByIdApplet(ActiveConsumption activeConsumption) { Integer storeId = activeConsumption.getStoreId(); - ActiveRecommendVO activeRecommendVO = new ActiveRecommendVO(); - activeRecommendVO.setInviterGiftType(new String[0]); + ArrayList<ActiveRecommendVO> arrayList = new ArrayList<>(); if (ObjectUtils.isNotEmpty(storeId)){ //获取新人有礼活动信息 LambdaQueryWrapper<ActiveRecommend> lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(ActiveRecommend::getStoreId,storeId); - ActiveRecommend activeRecommend = getOne(lambdaQueryWrapper); - //获取兑换物品信息 - if (ObjectUtils.isNotEmpty(activeRecommend)){ - LambdaQueryWrapper<ActiveRecommendChild> queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(ActiveRecommendChild::getActiveRecommendId,activeRecommend.getId()); - queryWrapper.orderByDesc(ActiveRecommendChild::getCreateTime); - List<ActiveRecommendChild> activeRecommendChildList = activeRecommendChildService.list(queryWrapper); - BeanUtils.copyProperties(activeRecommend,activeRecommendVO); - activeRecommendVO.setInviterGiftType(activeRecommend.getInviterGiftType().split(",")); - if (CollectionUtils.isNotEmpty(activeRecommendChildList)){ - activeRecommendVO.setActiveRecommendChildList(activeRecommendChildList); + List<ActiveRecommend> list = list(lambdaQueryWrapper); + for (ActiveRecommend activeRecommend : list) { + ActiveRecommendVO activeRecommendVO = new ActiveRecommendVO(); + activeRecommendVO.setInviterGiftType(new String[0]); + + if (ObjectUtils.isNotEmpty(activeRecommend)){ + LambdaQueryWrapper<ActiveRecommendChild> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveRecommendChild::getActiveRecommendId,activeRecommend.getId()); + queryWrapper.orderByDesc(ActiveRecommendChild::getCreateTime); + List<ActiveRecommendChild> activeRecommendChildList = activeRecommendChildService.list(queryWrapper); + BeanUtils.copyProperties(activeRecommend,activeRecommendVO); + activeRecommendVO.setInviterGiftType(activeRecommend.getInviterGiftType().split(",")); + if (CollectionUtils.isNotEmpty(activeRecommendChildList)){ + activeRecommendVO.setActiveRecommendChildList(activeRecommendChildList); + }else { + ArrayList<ActiveRecommendChild> activeRecommendChildren = new ArrayList<>(); + activeRecommendVO.setActiveRecommendChildList(activeRecommendChildren); + } }else { ArrayList<ActiveRecommendChild> activeRecommendChildren = new ArrayList<>(); activeRecommendVO.setActiveRecommendChildList(activeRecommendChildren); } - }else { - ArrayList<ActiveRecommendChild> activeRecommendChildren = new ArrayList<>(); - activeRecommendVO.setActiveRecommendChildList(activeRecommendChildren); + arrayList.add(activeRecommendVO); } + //ActiveRecommend activeRecommend = getOne(lambdaQueryWrapper); + //获取兑换物品信息 + } - return activeRecommendVO; + return arrayList; } /** @@ -292,60 +299,66 @@ public class ActiveRecommendServiceImpl extends ServiceImpl<ActiveRecommendMappe * @return */ @Override - public ActiveRecommendAppletVO selectApplet(ActiveConsumption activeConsumption) { - ActiveRecommendAppletVO activeRecommendAppletVO = new ActiveRecommendAppletVO(); + public List<ActiveRecommendAppletVO> selectApplet(ActiveConsumption activeConsumption) { + + ArrayList<ActiveRecommendAppletVO> arrayList = new ArrayList<>(); //获取本店铺的推荐有礼活动 - ActiveRecommendVO activeRecommendVO = getOneByIdApplet(activeConsumption); - //邀请人获得 - if (ObjectUtils.isNotEmpty(activeRecommendVO) && ObjectUtils.isNotEmpty(activeRecommendVO.getPoints())){ - //积分 - activeRecommendAppletVO.setPoint(activeRecommendVO.getPoints().toString()); - } - if (ObjectUtils.isNotEmpty(activeRecommendVO) && ObjectUtils.isNotEmpty(activeRecommendVO.getGrowthValue())){ - //成长值 - activeRecommendAppletVO.setGrowValue(activeRecommendVO.getGrowthValue().toString()); - } - //邀请人赠送优惠券兑换券 - String cardi1 = ""; - String cardo1 = ""; - //被邀请人赠送优惠券 - String cardi2 = ""; - if (CollectionUtils.isNotEmpty(activeRecommendVO.getActiveRecommendChildList())){ - for (ActiveRecommendChild activeRecommendChild : activeRecommendVO.getActiveRecommendChildList()) { - if (activeRecommendChild.getGiftUserType().equals("0") && activeRecommendChild.getActiveGift().equals("1")){ - //优惠券 - cardi1 += activeRecommendChild.getGiftCardName()+"的券("+activeRecommendChild.getGiftCardDetail()+");"; - }else if (activeRecommendChild.getGiftUserType().equals("0") && activeRecommendChild.getActiveGift().equals("2")){ - //兑换券 - cardo1 += activeRecommendChild.getGiftCardName()+"的券;"; - }else if (activeRecommendChild.getGiftUserType().equals("1") && activeRecommendChild.getActiveGift().equals("1")){ - //优惠券 - cardi2 += activeRecommendChild.getGiftCardName()+"的券("+activeRecommendChild.getGiftCardDetail()+");"; + List<ActiveRecommendVO> activeRecommendVOList = getOneByIdApplet(activeConsumption); + for (ActiveRecommendVO activeRecommendVO : activeRecommendVOList) { + ActiveRecommendAppletVO activeRecommendAppletVO = new ActiveRecommendAppletVO(); + //邀请人获得 + if (ObjectUtils.isNotEmpty(activeRecommendVO) && ObjectUtils.isNotEmpty(activeRecommendVO.getPoints())){ + //积分 + activeRecommendAppletVO.setPoint(activeRecommendVO.getPoints().toString()); + } + if (ObjectUtils.isNotEmpty(activeRecommendVO) && ObjectUtils.isNotEmpty(activeRecommendVO.getGrowthValue())){ + //成长值 + activeRecommendAppletVO.setGrowValue(activeRecommendVO.getGrowthValue().toString()); + } + //邀请人赠送优惠券兑换券 + String cardi1 = ""; + String cardo1 = ""; + //被邀请人赠送优惠券 + String cardi2 = ""; + if (CollectionUtils.isNotEmpty(activeRecommendVO.getActiveRecommendChildList())){ + for (ActiveRecommendChild activeRecommendChild : activeRecommendVO.getActiveRecommendChildList()) { + if (activeRecommendChild.getGiftUserType().equals("0") && activeRecommendChild.getActiveGift().equals("1")){ + //优惠券 + cardi1 += activeRecommendChild.getGiftCardName()+"的券("+activeRecommendChild.getGiftCardDetail()+");"; + }else if (activeRecommendChild.getGiftUserType().equals("0") && activeRecommendChild.getActiveGift().equals("2")){ + //兑换券 + cardo1 += activeRecommendChild.getGiftCardName()+"的券;"; + }else if (activeRecommendChild.getGiftUserType().equals("1") && activeRecommendChild.getActiveGift().equals("1")){ + //优惠券 + cardi2 += activeRecommendChild.getGiftCardName()+"的券("+activeRecommendChild.getGiftCardDetail()+");"; + } } } - } - //邀请人的券 - //活动时间 - activeRecommendAppletVO.setTime("永久有效"); - //积分 - if (ObjectUtils.isNotEmpty(activeRecommendVO.getPoints())){ - activeRecommendAppletVO.setPoint(activeRecommendVO.getPoints().toString()); - } - //成长值 - if (ObjectUtils.isNotEmpty(activeRecommendVO.getGrowthValue())){ - activeRecommendAppletVO.setGrowValue(activeRecommendVO.getGrowthValue().toString()); + //邀请人的券 + //活动时间 + activeRecommendAppletVO.setTime("永久有效"); + //积分 + if (ObjectUtils.isNotEmpty(activeRecommendVO.getPoints())){ + activeRecommendAppletVO.setPoint(activeRecommendVO.getPoints().toString()); + } + //成长值 + if (ObjectUtils.isNotEmpty(activeRecommendVO.getGrowthValue())){ + activeRecommendAppletVO.setGrowValue(activeRecommendVO.getGrowthValue().toString()); + } + + activeRecommendAppletVO.setRecommendActiveDescribeIn("欢迎各位亲朋好友来参加本店的推荐有礼活动,对于邀请人,参加即送:优惠券:"+cardi1+"兑换券:"+cardo1); + //被邀请人的券 + activeRecommendAppletVO.setRecommendActiveDescribeOut("对于被邀请人,参加即送:优惠券:"+cardi2); + if (ObjectUtils.isEmpty(cardi1)){ + activeRecommendAppletVO.setRecommendActiveDescribeIn(""); + } + if (ObjectUtils.isEmpty(cardi2)){ + activeRecommendAppletVO.setRecommendActiveDescribeOut(""); + } + arrayList.add(activeRecommendAppletVO); } - activeRecommendAppletVO.setRecommendActiveDescribeIn("欢迎各位亲朋好友来参加本店的推荐有礼活动,对于邀请人,参加即送:优惠券:"+cardi1+"兑换券:"+cardo1); - //被邀请人的券 - activeRecommendAppletVO.setRecommendActiveDescribeOut("对于被邀请人,参加即送:优惠券:"+cardi2); - if (ObjectUtils.isEmpty(cardi1)){ - activeRecommendAppletVO.setRecommendActiveDescribeIn(""); - } - if (ObjectUtils.isEmpty(cardi2)){ - activeRecommendAppletVO.setRecommendActiveDescribeOut(""); - } - return activeRecommendAppletVO; + return arrayList; } @Override diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/CardFuelDieselService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/CardFuelDieselService.java index 206b88730..243dc72c4 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/CardFuelDieselService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/CardFuelDieselService.java @@ -4,6 +4,7 @@ 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.cardFule.entity.CardFuelDiesel; +import com.fuint.business.marketingActivity.cardFule.vo.CardFuelDieselVO; import java.util.List; @@ -26,5 +27,6 @@ public interface CardFuelDieselService extends IService<CardFuelDiesel> { IPage select(Page page, CardFuelDiesel cardFuelDiesel); IPage selectAllApplet(Page page, CardFuelDiesel cardFuelDiesel); + List<CardFuelDieselVO> selectAllAppletByStorId(CardFuelDiesel cardFuelDiesel); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelDieselServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelDieselServiceImpl.java index f3167d2b8..ff556cdd4 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelDieselServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelDieselServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.business.marketingActivity.cardFule.mapper.CardFuelDieselMapper; import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel; import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService; +import com.fuint.business.marketingActivity.cardFule.vo.CardFuelDieselVO; import com.fuint.business.petrolStationManagement.entity.OilName; import com.fuint.business.petrolStationManagement.entity.OilNumber; import com.fuint.business.petrolStationManagement.service.OilNameService; @@ -18,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -149,5 +151,43 @@ public class CardFuelDieselServiceImpl extends ServiceImpl<CardFuelDieselMapper, page1.setRecords(cardFuelDiesels); return page1; } + + @Override + public List<CardFuelDieselVO> selectAllAppletByStorId(CardFuelDiesel cardFuelDiesel) { + ArrayList<CardFuelDieselVO> arrayList = new ArrayList<>(); + LambdaQueryWrapper<CardFuelDiesel> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(CardFuelDiesel::getStoreId, cardFuelDiesel.getStoreId()); + List<CardFuelDiesel> list = list(queryWrapper); + for (CardFuelDiesel fuelDiesel : list) { + CardFuelDieselVO cardFuelDieselVO = new CardFuelDieselVO(); + //油品名称 + String type = fuelDiesel.getType(); + String oilType = fuelDiesel.getOilType(); + OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType)); + String oilName = oilName1.getOilName(); + cardFuelDieselVO.setOilName(type+"-"+oilName); + //时间 + String startFormat= ""; + String endFormat = ""; + if (fuelDiesel.getActiveTime().equals("1")){ + cardFuelDieselVO.setTime("不限时间!"); + //描述 + cardFuelDieselVO.setDiscountActiveDescribe("本充值活动,充值满"+ + fuelDiesel.getRechargeBalance()+"元可以参加,所参与油品类型为:"+cardFuelDieselVO.getOilName()+",锁价单价为:"+ + fuelDiesel.getLockupPrice()+"元/L,总升数为:"+fuelDiesel.getIncomeLitres()+"L,活动时间为:不限时间!"); + }else { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + startFormat = simpleDateFormat.format(fuelDiesel.getStartTime()); + endFormat = simpleDateFormat.format(fuelDiesel.getEndTime()); + cardFuelDieselVO.setTime(startFormat+"-"+endFormat); + //描述 + cardFuelDieselVO.setDiscountActiveDescribe("本充值活动,充值满"+ + fuelDiesel.getRechargeBalance()+"元可以参加,所参与油品类型为:"+cardFuelDieselVO.getOilName()+",锁价单价为:"+ + fuelDiesel.getLockupPrice()+"元/L,总升数为:"+fuelDiesel.getIncomeLitres()+"L,活动时间为:"+startFormat+"-"+endFormat); + } + arrayList.add(cardFuelDieselVO); + } + return arrayList; + } }