From eff58c7a3a73136de03b061b2c47fdf0acdd5d2f 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: Wed, 29 Nov 2023 18:21:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=AB=AF?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ActiveConsumptionController.java | 10 ++ .../service/ActiveConsumptionService.java | 9 + .../impl/ActiveConsumptionServiceImpl.java | 50 ++++++ .../vo/ActiveConsumptionAppletVO.java | 11 ++ .../controller/ActiveDiscountController.java | 10 ++ .../service/ActiveDiscountService.java | 9 + .../impl/ActiveDiscountServiceImpl.java | 35 ++++ .../vo/ActiveDiscountAppletVO.java | 9 + .../controller/ActiveFullminusController.java | 11 ++ .../service/ActiveFullminusService.java | 9 + .../impl/ActiveFullminusServiceImpl.java | 41 +++++ .../vo/ActiveFullminusAppletVO.java | 10 ++ .../controller/ActiveNewlywedsController.java | 13 +- .../vo/ActiveNewlywedsAppletVO.java | 15 ++ .../controller/vo/ActiveNewlywedsVO.java | 158 +----------------- .../entity/ActiveNewlywedsChild.java | 142 +--------------- .../service/ActiveNewlywedsService.java | 7 + .../impl/ActiveNewlywedsServiceImpl.java | 106 ++++++++++-- .../controller/ActiveRecommendController.java | 9 + .../entity/ActiveRecommend.java | 1 + .../entity/ActiveRecommendChild.java | 150 +---------------- .../service/ActiveRecommendService.java | 7 + .../impl/ActiveRecommendServiceImpl.java | 91 ++++++++-- .../vo/ActiveRecommendAppletVO.java | 16 ++ .../src/main/resources/application.properties | 2 +- 25 files changed, 455 insertions(+), 476 deletions(-) create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/vo/ActiveConsumptionAppletVO.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveDiscountAppletVO.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/vo/ActiveFullminusAppletVO.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/vo/ActiveNewlywedsAppletVO.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/vo/ActiveRecommendAppletVO.java 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 27df0bf97..2faef0233 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 @@ -47,6 +47,16 @@ public class ActiveConsumptionController extends BaseController { return getSuccessResult(this.activeConsumptionService.select(page, activeConsumption)); } + /** + * 查询所有数据(小程序端) + * @param activeConsumption + * @return + */ + @GetMapping("appletList") + public ResponseObject selectAllApplet(@Param("cardFuelDiesel") ActiveConsumption activeConsumption) { + return getSuccessResult(this.activeConsumptionService.selectAllApplet(activeConsumption)); + } + /** * 通过主键查询单条数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/ActiveConsumptionService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/ActiveConsumptionService.java index 2fd44cde4..40e47344a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/ActiveConsumptionService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/ActiveConsumptionService.java @@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.fuint.business.marketingActivity.activeConsumption.dto.ActiveConsumptionDTO; import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption; +import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionAppletVO; import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionVO; import java.io.Serializable; +import java.util.List; /** * 消费有礼活动(ActiveConsumption)表服务接口 @@ -45,5 +47,12 @@ public interface ActiveConsumptionService extends IService { * @return */ Boolean updateOneById(ActiveConsumptionDTO activeConsumptionDTO); + + /** + * 查询所有数据(小程序端) + * @param activeConsumption + * @return + */ + List selectAllApplet(ActiveConsumption activeConsumption); } 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 9a89aa1b9..c3dcd936f 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 @@ -11,7 +11,9 @@ import com.fuint.business.marketingActivity.activeConsumption.mapper.ActiveConsu 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.business.marketingActivity.activeConsumption.vo.ActiveConsumptionAppletVO; import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionVO; +import com.fuint.business.petrolStationManagement.service.OilNameService; import com.fuint.business.store.service.StoreService; import com.fuint.business.userManager.service.LJUserGradeService; import com.fuint.common.util.TokenUtil; @@ -23,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.io.Serializable; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @@ -42,6 +45,8 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl selectAllApplet(ActiveConsumption activeConsumption) { + //获取本油站消费有礼活动列表 + IPage page = select(new Page(1, 9999), activeConsumption); + List activeConsumptionVOList = page.getRecords(); + List appletVOList = activeConsumptionVOList.stream().map(s -> { + ActiveConsumptionAppletVO activeConsumptionAppletVO = new ActiveConsumptionAppletVO(); + //适用用户名 + String adaptUserType = ""; + if (s.getAdaptUserType().equals("0")){ + adaptUserType = "全部用户"; + }else if (s.getAdaptUserType().equals("1")){ + adaptUserType = "全部会员"; + }else { + adaptUserType = arrayToString(s.getDieselUserLevel()); + } + //赠送优惠券兑换券实物 + String card = ""; + String goods = ""; + if (CollectionUtils.isNotEmpty(s.getActiveConsumptionChildList())){ + for (ActiveConsumptionChild activeConsumptionChild : s.getActiveConsumptionChildList()) { + if (activeConsumptionChild.getActiveGift().equals("1") || activeConsumptionChild.getActiveGift().equals("2")){ + card = activeConsumptionChild.getGiftCardDetail()+"的券"; + }else { + goods = activeConsumptionChild.getGoodsName()+activeConsumptionChild.getGoodsTotal()+"个"; + } + } + } + //油号名字 + String oilName = ""; + for (Integer id : s.getAdaptOil()) { + oilName += oilNameService.selectOilNameById(id).getOilName()+","; + } + activeConsumptionAppletVO.setActiveDescribe(s.getName() + ":"+"本活动"+oilName+"油品可用,消费需满"+ + s.getParticipationConditionMoney()+"元,"+ adaptUserType+"可用,赠送券:"+card+" 赠送物品:"+goods+" 赠送积分:"+s.getPoints()+"积分。"); + return activeConsumptionAppletVO; + }).collect(Collectors.toList()); + return appletVOList; + } + /** * 数组转字符串 * @param array diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/vo/ActiveConsumptionAppletVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/vo/ActiveConsumptionAppletVO.java new file mode 100644 index 000000000..79b30073a --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/vo/ActiveConsumptionAppletVO.java @@ -0,0 +1,11 @@ +package com.fuint.business.marketingActivity.activeConsumption.vo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ActiveConsumptionAppletVO implements Serializable { + //活动描述 + private String activeDescribe; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/controller/ActiveDiscountController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/controller/ActiveDiscountController.java index be265e381..18ba9c387 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/controller/ActiveDiscountController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/controller/ActiveDiscountController.java @@ -48,6 +48,16 @@ public class ActiveDiscountController extends BaseController { return getSuccessResult(this.activeDiscountService.select(page,activeDiscount)); } + /** + * 查询所有数据(小程序端) + * @param activeDiscount + * @return + */ + @GetMapping("appletList") + public ResponseObject selectAllApplet(@Param("cardFuelDiesel") ActiveDiscount activeDiscount) { + return getSuccessResult(this.activeDiscountService.selectAllApplet(activeDiscount)); + } + /** * 通过主键查询单条数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/service/ActiveDiscountService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/service/ActiveDiscountService.java index 911c2bca7..85e57f785 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/service/ActiveDiscountService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/service/ActiveDiscountService.java @@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.fuint.business.marketingActivity.activeDiscount.dto.ActiveDiscountDTO; import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount; +import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountAppletVO; import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountVO; import java.io.Serializable; +import java.util.List; /** * 折扣营销表(ActiveDiscount)表服务接口 @@ -45,5 +47,12 @@ public interface ActiveDiscountService extends IService { * @return */ Boolean updateOneById(ActiveDiscountDTO activeDiscountDTO); + + /** + * 查询所有数据(小程序端) + * @param activeDiscount + * @return + */ + List selectAllApplet(ActiveDiscount activeDiscount); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/service/impl/ActiveDiscountServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/service/impl/ActiveDiscountServiceImpl.java index 8a6811248..5e56dcb81 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/service/impl/ActiveDiscountServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/service/impl/ActiveDiscountServiceImpl.java @@ -14,7 +14,9 @@ import com.fuint.business.marketingActivity.activeDiscount.mapper.ActiveDiscount import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount; import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountChildService; import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountService; +import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountAppletVO; import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountVO; +import com.fuint.business.petrolStationManagement.service.OilNameService; import com.fuint.business.store.service.StoreService; import com.fuint.business.userManager.service.LJUserGradeService; import com.fuint.common.util.TokenUtil; @@ -45,6 +47,8 @@ public class ActiveDiscountServiceImpl extends ServiceImpl selectAllApplet(ActiveDiscount activeDiscount) { + IPage page = select(new Page(1, 9999), activeDiscount); + List activeDiscountVOList = page.getRecords(); + List activeDiscountAppletVOS = activeDiscountVOList.stream().map(s -> { + ActiveDiscountAppletVO activeDiscountAppletVO = new ActiveDiscountAppletVO(); + //油号名字 + String oilName = ""; + for (Integer id : s.getAdaptOil()) { + oilName += oilNameService.selectOilNameById(id).getOilName() + ","; + } + //适用用户名 + String adaptUserType = ""; + adaptUserType = arrayToString(s.getDieselUserLevel()); + //活动规则满足金额 + double amount = 0.0; + //折扣 + double discount = 0.0; + if (CollectionUtils.isNotEmpty(s.getActiveDiscountChildList())) { + for (ActiveDiscountChild activeDiscountChild : s.getActiveDiscountChildList()) { + amount = activeDiscountChild.getAmount(); + discount = activeDiscountChild.getDiscount(); + } + } + activeDiscountAppletVO.setDiscountActiveDescribe(s.getName() + ":本活动:适用用户为:"+adaptUserType+"购买如下油品:" + oilName + ",享受满" + + amount + "元,打" + discount + "折。"); + return activeDiscountAppletVO; + }).collect(Collectors.toList()); + return activeDiscountAppletVOS; + } + /** * 数组转字符串 * @param array diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveDiscountAppletVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveDiscountAppletVO.java new file mode 100644 index 000000000..8d5677f16 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveDiscountAppletVO.java @@ -0,0 +1,9 @@ +package com.fuint.business.marketingActivity.activeDiscount.vo; + +import lombok.Data; + +import java.io.Serializable; +@Data +public class ActiveDiscountAppletVO implements Serializable { + private String discountActiveDescribe; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/controller/ActiveFullminusController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/controller/ActiveFullminusController.java index c226d444e..4bd533808 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/controller/ActiveFullminusController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/controller/ActiveFullminusController.java @@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.activeFullminus.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount; import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountChildService; import com.fuint.business.marketingActivity.activeFullminus.dto.ActiveFullminusDTO; import com.fuint.business.marketingActivity.activeFullminus.entity.ActiveFullminus; @@ -59,6 +60,16 @@ public class ActiveFullminusController extends BaseController { return getSuccessResult(this.activeFullminusService.getOneById(id)); } + /** + * 查询所有数据(小程序端) + * @param activeFullminus + * @return + */ + @GetMapping("appletList") + public ResponseObject selectAllApplet(@Param("activeFullminus") ActiveFullminus activeFullminus) { + return getSuccessResult(this.activeFullminusService.selectAllApplet(activeFullminus)); + } + /** * 新增数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/service/ActiveFullminusService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/service/ActiveFullminusService.java index f35641184..d0eab7680 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/service/ActiveFullminusService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/service/ActiveFullminusService.java @@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.fuint.business.marketingActivity.activeFullminus.dto.ActiveFullminusDTO; import com.fuint.business.marketingActivity.activeFullminus.entity.ActiveFullminus; +import com.fuint.business.marketingActivity.activeFullminus.vo.ActiveFullminusAppletVO; import com.fuint.business.marketingActivity.activeFullminus.vo.ActiveFullminusVO; import java.io.Serializable; +import java.util.List; /** * 满减营销表(ActiveFullminus)表服务接口 @@ -45,5 +47,12 @@ public interface ActiveFullminusService extends IService { * @return */ Boolean updateOneById(ActiveFullminusDTO activeFullminusDTO); + + /** + * 查询所有数据(小程序端) + * @param activeFullminus + * @return + */ + List selectAllApplet(ActiveFullminus activeFullminus); } 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 3bba74d56..e6a3abe10 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 @@ -8,12 +8,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount; import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscountChild; import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountChildService; +import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountAppletVO; import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountVO; import com.fuint.business.marketingActivity.activeFullminus.dto.ActiveFullminusDTO; import com.fuint.business.marketingActivity.activeFullminus.mapper.ActiveFullminusMapper; import com.fuint.business.marketingActivity.activeFullminus.entity.ActiveFullminus; import com.fuint.business.marketingActivity.activeFullminus.service.ActiveFullminusService; +import com.fuint.business.marketingActivity.activeFullminus.vo.ActiveFullminusAppletVO; import com.fuint.business.marketingActivity.activeFullminus.vo.ActiveFullminusVO; +import com.fuint.business.petrolStationManagement.service.OilNameService; import com.fuint.business.store.service.StoreService; import com.fuint.business.userManager.service.LJUserGradeService; import com.fuint.common.util.TokenUtil; @@ -43,6 +46,8 @@ public class ActiveFullminusServiceImpl extends ServiceImpl selectAllApplet(ActiveFullminus activeFullminus) { + IPage page = select(new Page(1, 9999), activeFullminus); + List activeFullminusVOList = page.getRecords(); + List activeFullminusAppletVOList = activeFullminusVOList.stream().map(s -> { + ActiveFullminusAppletVO activeFullminusAppletVO = new ActiveFullminusAppletVO(); + //油号名字 + String oilName = ""; + for (Integer id : s.getAdaptOil()) { + oilName += oilNameService.selectOilNameById(id).getOilName() + ","; + } + //适用用户名 + String adaptUserType = ""; + adaptUserType = arrayToString(s.getDieselUserLevel()); + //活动规则满足金额 + double amount = 0.0; + //折扣 + double discount = 0.0; + if (CollectionUtils.isNotEmpty(s.getActiveDiscountChildList())) { + for (ActiveDiscountChild activeDiscountChild : s.getActiveDiscountChildList()) { + amount = activeDiscountChild.getAmount(); + discount = activeDiscountChild.getDeductionAmount(); + } + } + activeFullminusAppletVO.setFullminusActiveDescribe(s.getName() + ":本活动:适用用户为:"+adaptUserType+"购买如下油品:" + oilName + ",享受满" + + amount + "元,减" + discount + "元。"); + return activeFullminusAppletVO; + }).collect(Collectors.toList()); + return activeFullminusAppletVOList; + } + /** * 数组转字符串 * @param array diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/vo/ActiveFullminusAppletVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/vo/ActiveFullminusAppletVO.java new file mode 100644 index 000000000..d6d60fc98 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/vo/ActiveFullminusAppletVO.java @@ -0,0 +1,10 @@ +package com.fuint.business.marketingActivity.activeFullminus.vo; + +import lombok.Data; + +import java.io.Serializable; +@Data +public class ActiveFullminusAppletVO implements Serializable { + //活动描述 + private String fullminusActiveDescribe; +} 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 3ce1c67c2..a3b727bc0 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,11 +2,7 @@ package com.fuint.business.marketingActivity.activeNewlyweds.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.activeDiscount.entity.ActiveDiscount; import com.fuint.business.marketingActivity.activeNewlyweds.dto.ActiveNewlywedsDTO; import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlyweds; import com.fuint.business.marketingActivity.activeNewlyweds.service.ActiveNewlywedsChildService; @@ -63,6 +59,15 @@ public class ActiveNewlywedsController extends BaseController { return getSuccessResult(this.activeNewlywedsService.getOneById(id)); } + /** + * 查询单条数据(小程序端) + * @return 单条数据 + */ + @GetMapping("applet") + public ResponseObject selectApplet() { + return getSuccessResult(this.activeNewlywedsService.selectApplet()); + } + /** * 新增数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/vo/ActiveNewlywedsAppletVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/vo/ActiveNewlywedsAppletVO.java new file mode 100644 index 000000000..81218183d --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/vo/ActiveNewlywedsAppletVO.java @@ -0,0 +1,15 @@ +package com.fuint.business.marketingActivity.activeNewlyweds.controller.vo; + +import lombok.Data; + +import java.io.Serializable; +@Data +public class ActiveNewlywedsAppletVO implements Serializable { + //活动描述获得券 + private String NewlywedsActiveDescribe; + //积分 + private String point; + //成长值 + private String growValue; + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/vo/ActiveNewlywedsVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/vo/ActiveNewlywedsVO.java index eb7323a0d..740678bb3 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/vo/ActiveNewlywedsVO.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/vo/ActiveNewlywedsVO.java @@ -4,12 +4,12 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat; import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlywedsChild; +import lombok.Data; -import java.io.Serializable; import java.util.Date; import java.util.List; - -public class ActiveNewlywedsVO implements Serializable { +@Data +public class ActiveNewlywedsVO { //主键id @TableId(type = IdType.AUTO) private Integer id; @@ -53,156 +53,4 @@ public class ActiveNewlywedsVO implements Serializable { //更新时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; - - public String getActiveCode() { - return activeCode; - } - - public void setActiveCode(String activeCode) { - this.activeCode = activeCode; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getChainStoreId() { - return chainStoreId; - } - - public void setChainStoreId(Integer chainStoreId) { - this.chainStoreId = chainStoreId; - } - - public Integer getStoreId() { - return storeId; - } - - public void setStoreId(Integer storeId) { - this.storeId = storeId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Date getActiveStartTime() { - return activeStartTime; - } - - public void setActiveStartTime(Date activeStartTime) { - this.activeStartTime = activeStartTime; - } - - public Date getActiveEndTime() { - return activeEndTime; - } - - public void setActiveEndTime(Date activeEndTime) { - this.activeEndTime = activeEndTime; - } - - public String[] getCourtesyReward() { - return courtesyReward; - } - - public void setCourtesyReward(String[] courtesyReward) { - this.courtesyReward = courtesyReward; - } - - public String getIsonline() { - return isonline; - } - - public void setIsonline(String isonline) { - this.isonline = isonline; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public Integer getRemainderTotal() { - return remainderTotal; - } - - public void setRemainderTotal(Integer remainderTotal) { - this.remainderTotal = remainderTotal; - } - - public Integer getPoints() { - return points; - } - - public void setPoints(Integer points) { - this.points = points; - } - - public Integer getGrowthValue() { - return growthValue; - } - - public void setGrowthValue(Integer growthValue) { - this.growthValue = growthValue; - } - - public String getRemark() { - return remark; - } - - public void setRemark(String remark) { - this.remark = remark; - } - - public List getActiveNewlywedsChildList() { - return activeNewlywedsChildList; - } - - public void setActiveNewlywedsChildList(List activeNewlywedsChildList) { - this.activeNewlywedsChildList = activeNewlywedsChildList; - } - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public String getUpdateBy() { - return updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/entity/ActiveNewlywedsChild.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/entity/ActiveNewlywedsChild.java index 75bceff62..210f952d1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/entity/ActiveNewlywedsChild.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/entity/ActiveNewlywedsChild.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; import java.io.Serializable; @@ -16,6 +17,7 @@ import java.io.Serializable; * @since 2023-11-13 13:17:14 */ @SuppressWarnings("serial") +@Data public class ActiveNewlywedsChild extends Model { //主键id @TableId(type = IdType.AUTO) @@ -34,6 +36,8 @@ public class ActiveNewlywedsChild extends Model { private String giftCardType; //券详情 private String giftCardDetail; + //生效日期类型 0 ,1,2 + private String timeType; //券有效期 private Integer giftCardTime; //有效期0 @@ -54,143 +58,5 @@ public class ActiveNewlywedsChild extends Model { //更新时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; - - public Integer getValidityZero() { - return validityZero; - } - - public void setValidityZero(Integer validityZero) { - this.validityZero = validityZero; - } - - public Integer getValidityOne() { - return validityOne; - } - - public void setValidityOne(Integer validityOne) { - this.validityOne = validityOne; - } - - public Integer getValidityTwo() { - return validityTwo; - } - - public void setValidityTwo(Integer validityTwo) { - this.validityTwo = validityTwo; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getActiveNewlywedsId() { - return activeNewlywedsId; - } - - public void setActiveNewlywedsId(Integer activeNewlywedsId) { - this.activeNewlywedsId = activeNewlywedsId; - } - - public String getActiveGift() { - return activeGift; - } - - public void setActiveGift(String activeGift) { - this.activeGift = activeGift; - } - - public Integer getVouchersId() { - return vouchersId; - } - - public void setVouchersId(Integer vouchersId) { - this.vouchersId = vouchersId; - } - - public String getGiftCardName() { - return giftCardName; - } - - public void setGiftCardName(String giftCardName) { - this.giftCardName = giftCardName; - } - - public String getGiftCardType() { - return giftCardType; - } - - public void setGiftCardType(String giftCardType) { - this.giftCardType = giftCardType; - } - - public String getGiftCardDetail() { - return giftCardDetail; - } - - public void setGiftCardDetail(String giftCardDetail) { - this.giftCardDetail = giftCardDetail; - } - - public Integer getGiftCardTime() { - return giftCardTime; - } - - public void setGiftCardTime(Integer giftCardTime) { - this.giftCardTime = giftCardTime; - } - - public Integer getGiftCardTotal() { - return giftCardTotal; - } - - public void setGiftCardTotal(Integer giftCardTotal) { - this.giftCardTotal = giftCardTotal; - } - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public String getUpdateBy() { - return updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } } 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 93f4de67b..d372590cd 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 @@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.activeNewlyweds.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.activeNewlyweds.controller.vo.ActiveNewlywedsAppletVO; import com.fuint.business.marketingActivity.activeNewlyweds.controller.vo.ActiveNewlywedsVO; import com.fuint.business.marketingActivity.activeNewlyweds.dto.ActiveNewlywedsDTO; import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlyweds; @@ -45,5 +46,11 @@ public interface ActiveNewlywedsService extends IService { * @return */ Boolean updateOneById(ActiveNewlywedsDTO activeNewlywedsDTO); + + /** + * 查询单条数据(小程序端) + * @return + */ + ActiveNewlywedsAppletVO selectApplet(); } 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 e3f40190a..93a2ef339 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 @@ -5,10 +5,7 @@ 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.activeDiscount.entity.ActiveDiscount; -import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscountChild; -import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountVO; -import com.fuint.business.marketingActivity.activeFullminus.entity.ActiveFullminus; +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; import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlywedsChild; @@ -16,7 +13,10 @@ import com.fuint.business.marketingActivity.activeNewlyweds.mapper.ActiveNewlywe 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.business.marketingActivity.activeRecommend.entity.ActiveRecommend; import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendChild; +import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendAppletVO; +import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendVO; import com.fuint.business.store.service.StoreService; import com.fuint.common.util.TokenUtil; import org.apache.commons.lang3.ObjectUtils; @@ -25,6 +25,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -49,7 +50,36 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,storeId); + ActiveNewlyweds one = getOne(lambdaQueryWrapper); + if (ObjectUtils.isNotEmpty(one)){ + activeNewlywedsDTO.setId(one.getId()); + save = updateOneById(activeNewlywedsDTO); + }else { + if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) { + activeNewlywedsDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId()); + activeNewlywedsDTO.setChainStoreId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId()); + } + //新增折扣营销活动模板 + ActiveNewlyweds activeNewlyweds = new ActiveNewlyweds(); + if (ObjectUtils.isNotEmpty(activeNewlywedsDTO)){ + BeanUtils.copyProperties(activeNewlywedsDTO,activeNewlyweds); + //有礼奖励 + activeNewlyweds.setCourtesyReward(arrayToString(activeNewlywedsDTO.getCourtesyReward())); + save = save(activeNewlyweds); + } + //新增兑换物品 + List list = activeNewlywedsDTO.getActiveNewlywedsChildList(); + list.stream().map(s ->{ + s.setActiveNewlywedsId(activeNewlyweds.getId()); + return s; + }).collect(Collectors.toList()); + save = activeNewlywedsChildService.saveBatch(list); + } + /* //获取当前店铺的id和连锁店id if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) { activeNewlywedsDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId()); activeNewlywedsDTO.setChainStoreId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId()); @@ -68,7 +98,7 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,TokenUtil.getNowAccountInfo().getStoreId()); + ActiveNewlyweds activeNewlyweds = getOne(lambdaQueryWrapper); //获取兑换物品信息 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,id); - queryWrapper.orderByDesc(ActiveNewlywedsChild::getCreateTime); - List activeNewlywedsChildList = activeNewlywedsChildService.list(queryWrapper); - if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ - //封装VO返回 + if (ObjectUtils.isNotEmpty(activeNewlyweds)){ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlyweds.getId()); + queryWrapper.orderByDesc(ActiveNewlywedsChild::getCreateTime); + List activeNewlywedsChildList = activeNewlywedsChildService.list(queryWrapper); BeanUtils.copyProperties(activeNewlyweds,activeNewlywedsVO); + //封装VO返回 activeNewlywedsVO.setCourtesyReward(activeNewlyweds.getCourtesyReward().split(",")); + if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ + activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList); + }else { + ArrayList activeNewlywedsChildLists = new ArrayList<>(); + activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildLists); + } + }else { + ArrayList activeNewlywedsChildList = new ArrayList<>(); activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList); } } @@ -173,6 +215,40 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl { //主键id + @TableId(type = IdType.AUTO) private Integer id; //所属连锁店id private Integer chainStoreId; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendChild.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendChild.java index aa9fc728d..6cc52be40 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendChild.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendChild.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; import java.io.Serializable; @@ -16,6 +17,7 @@ import java.io.Serializable; * @since 2023-11-13 15:10:17 */ @SuppressWarnings("serial") +@Data public class ActiveRecommendChild extends Model { //主键id @TableId(type = IdType.AUTO) @@ -38,6 +40,8 @@ public class ActiveRecommendChild extends Model { private String giftCardDetail; //券有效期 private Integer giftCardTime; + //生效日期类型 0 ,1,2 + private String timeType; //有效期0 private Integer validityZero; //有效期1 @@ -56,151 +60,5 @@ public class ActiveRecommendChild extends Model { //更新时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; - - public Integer getValidityZero() { - return validityZero; - } - - public void setValidityZero(Integer validityZero) { - this.validityZero = validityZero; - } - - public Integer getValidityOne() { - return validityOne; - } - - public void setValidityOne(Integer validityOne) { - this.validityOne = validityOne; - } - - public Integer getValidityTwo() { - return validityTwo; - } - - public void setValidityTwo(Integer validityTwo) { - this.validityTwo = validityTwo; - } - - public String getGiftUserType() { - return giftUserType; - } - - public void setGiftUserType(String giftUserType) { - this.giftUserType = giftUserType; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getActiveRecommendId() { - return activeRecommendId; - } - - public void setActiveRecommendId(Integer activeRecommendId) { - this.activeRecommendId = activeRecommendId; - } - - public String getActiveGift() { - return activeGift; - } - - public void setActiveGift(String activeGift) { - this.activeGift = activeGift; - } - - public Integer getVouchersId() { - return vouchersId; - } - - public void setVouchersId(Integer vouchersId) { - this.vouchersId = vouchersId; - } - - public String getGiftCardName() { - return giftCardName; - } - - public void setGiftCardName(String giftCardName) { - this.giftCardName = giftCardName; - } - - public String getGiftCardType() { - return giftCardType; - } - - public void setGiftCardType(String giftCardType) { - this.giftCardType = giftCardType; - } - - public String getGiftCardDetail() { - return giftCardDetail; - } - - public void setGiftCardDetail(String giftCardDetail) { - this.giftCardDetail = giftCardDetail; - } - - public Integer getGiftCardTime() { - return giftCardTime; - } - - public void setGiftCardTime(Integer giftCardTime) { - this.giftCardTime = giftCardTime; - } - - public Integer getGiftCardTotal() { - return giftCardTotal; - } - - public void setGiftCardTotal(Integer giftCardTotal) { - this.giftCardTotal = giftCardTotal; - } - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public String getUpdateBy() { - return updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } } 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 b47e188eb..460dbca11 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 @@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.activeRecommend.service; import com.baomidou.mybatisplus.extension.service.IService; import com.fuint.business.marketingActivity.activeRecommend.dto.ActiveRecommendDTO; import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommend; +import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendAppletVO; import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendVO; import java.io.Serializable; @@ -35,5 +36,11 @@ public interface ActiveRecommendService extends IService { * @return */ Boolean updateOneById(ActiveRecommendDTO activeRecommendDTO); + + /** + * 查询单条数据(小程序端) + * @return + */ + ActiveRecommendAppletVO selectApplet(); } 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 c7f1ce070..6f7bfc8ec 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 @@ -3,17 +3,15 @@ package com.fuint.business.marketingActivity.activeRecommend.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscountChild; -import com.fuint.business.marketingActivity.activeNewlyweds.controller.vo.ActiveNewlywedsVO; -import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlyweds; -import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlywedsChild; import com.fuint.business.marketingActivity.activeRecommend.dto.ActiveRecommendDTO; import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendChild; import com.fuint.business.marketingActivity.activeRecommend.mapper.ActiveRecommendMapper; import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommend; import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendChildService; import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendService; +import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendAppletVO; import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendVO; +import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService; import com.fuint.business.store.service.StoreService; import com.fuint.common.util.TokenUtil; import org.apache.commons.lang3.ObjectUtils; @@ -23,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -39,6 +38,8 @@ public class ActiveRecommendServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(ActiveRecommend::getStoreId,storeId); + ActiveRecommend one = getOne(lambdaQueryWrapper); + if (ObjectUtils.isNotEmpty(one)){ + activeRecommendDTO.setId(one.getId()); save = updateOneById(activeRecommendDTO); }else { //获取当前店铺的id和连锁店id @@ -64,12 +69,14 @@ public class ActiveRecommendServiceImpl extends ServiceImpl list = activeRecommendDTO.getActiveRecommendChildList(); if (CollectionUtils.isNotEmpty(list)) { list.stream().map(s -> { + //s.setTimeType(cardFavorableService.selectOneById(s.getId()).getTimeType()); s.setActiveRecommendId(activeRecommend.getId()); return s; }).collect(Collectors.toList()); @@ -80,33 +87,39 @@ public class ActiveRecommendServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(ActiveRecommend::getId,id); lambdaQueryWrapper.eq(ActiveRecommend::getStoreId,TokenUtil.getNowAccountInfo().getStoreId()); ActiveRecommend activeRecommend = getOne(lambdaQueryWrapper); - //ActiveRecommend activeRecommend = getById(id); //获取兑换物品信息 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(ActiveRecommendChild::getActiveRecommendId,id); - queryWrapper.orderByDesc(ActiveRecommendChild::getCreateTime); - List activeRecommendChildList = activeRecommendChildService.list(queryWrapper); - //封装VO返回 if (ObjectUtils.isNotEmpty(activeRecommend)){ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveRecommendChild::getActiveRecommendId,activeRecommend.getId()); + queryWrapper.orderByDesc(ActiveRecommendChild::getCreateTime); + List activeRecommendChildList = activeRecommendChildService.list(queryWrapper); BeanUtils.copyProperties(activeRecommend,activeRecommendVO); activeRecommendVO.setInviterGiftType(activeRecommend.getInviterGiftType().split(",")); + if (CollectionUtils.isNotEmpty(activeRecommendChildList)){ + activeRecommendVO.setActiveRecommendChildList(activeRecommendChildList); + }else { + ArrayList activeRecommendChildren = new ArrayList<>(); + activeRecommendVO.setActiveRecommendChildList(activeRecommendChildren); + } + }else { + ArrayList activeRecommendChildren = new ArrayList<>(); + activeRecommendVO.setActiveRecommendChildList(activeRecommendChildren); } - activeRecommendVO.setActiveRecommendChildList(activeRecommendChildList); } return activeRecommendVO; } @@ -142,6 +155,50 @@ public class ActiveRecommendServiceImpl extends ServiceImpl Date: Wed, 29 Nov 2023 18:33:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=9A=E5=91=98=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fuintAdmin/src/views/member/index.vue | 19 +++++----- .../mapper/xml/MtInvitationMapper.xml | 38 ++++++++++--------- .../service/LJUserGradeService.java | 7 ++++ .../service/impl/LJUserGradeServiceImpl.java | 9 +++++ .../service/impl/LJUserServiceImpl.java | 24 +++++++++--- 5 files changed, 64 insertions(+), 33 deletions(-) diff --git a/fuintAdmin/src/views/member/index.vue b/fuintAdmin/src/views/member/index.vue index 46f45bb60..878fc6ca8 100644 --- a/fuintAdmin/src/views/member/index.vue +++ b/fuintAdmin/src/views/member/index.vue @@ -245,7 +245,7 @@ - + @@ -334,7 +334,7 @@ - + @@ -348,7 +348,7 @@ - + @@ -528,8 +528,9 @@ export default { // 默认排序 defaultSort: {prop: 'updateTime', order: 'descending'}, // 表单参数 - form: { id: '', name: '', gradeId: '', mobile: '', userNo: '',point:'0', startTime: '', endTime: '', refuelMoney:'0',official:'wgz', - cardBalance:'0', literCard:'0', sex: 1, idcard: '', birthday: '', address: '', status: "qy", description: '' }, + form: { id: '', name: '', gradeId: '', mobile: '', userNo: '',points:0, startTime: '', + endTime: '', refuelMoney:'0',official:'wgz', + cardBalance:0, literCard:'0', sex: 1, idcard: '', birthday: '', address: '', status: "qy", description: '' }, // 查询参数 queryParams: { page: 1, @@ -555,6 +556,7 @@ export default { status: [{ required: true, message: "请选择会员状态", trigger: "blur" }], mobile: [ { required: true, message: "请输入手机号", trigger: "blur" }, + { min: 8, max: 11, message: '请输入正确的手机号', trigger: 'blur' } ], } }; @@ -708,15 +710,14 @@ export default { // 表单重置 reset() { this.resetForm("form"); - this.form= { id: '', name: '', gradeId: '', mobile: '', userNo: '',point:'0', startTime: '', endTime: '', - refuelMoney:'0',official:'wgz',cardBalance:'0', literCard:'0', sex: 1, idcard: '', birthday: '', address: '', + this.form= { id: '', name: '', gradeId: '', mobile: '', userNo: '',points:0, startTime: '', endTime: '', + refuelMoney:'0',official:'wgz',cardBalance:0, literCard:'0', sex: 1, idcard: '', birthday: '', address: '', status: "qy", description: '' } }, // 取消按钮 cancel() { this.open = false; - this.openUser = false; this.reset(); }, // 提交按钮 @@ -753,7 +754,6 @@ export default { const id = row.id || this.ids; getUser(id).then(response => { this.form = response.data; - console.log(this.form) this.open = true; this.title = "编辑会员"; }); @@ -786,6 +786,7 @@ export default {