From eba53ae473f8a5c1229e3ddfa8884b365ddab8e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=90=E5=A4=A9=E5=A4=A7=E5=9C=A3?= <17615834396@163.com> Date: Tue, 12 Mar 2024 11:35:29 +0800 Subject: [PATCH] bug --- .../controller/ActiveAppletController.java | 83 +++++++ .../activeApplet/entity/ActiveApplet.java | 211 +++++++++++++++++ .../mapper/ActiveAppletMapper.java | 15 ++ .../service/ActiveAppletService.java | 18 ++ .../service/impl/ActiveAppletServiceImpl.java | 25 ++ .../impl/ActiveConsumptionServiceImpl.java | 40 ++++ .../controller/ActiveDiscountController.java | 11 + .../impl/ActiveDiscountServiceImpl.java | 217 ++++++++++++++---- .../controller/ActiveFullminusController.java | 11 + .../impl/ActiveFullminusServiceImpl.java | 137 ++++++++++- .../ActiveRecommendRecordsServiceImpl.java | 3 + .../controller/CardFuelDieselController.java | 111 ++++++++- .../service/impl/CardValueServiceImpl.java | 101 ++++++++ 13 files changed, 937 insertions(+), 46 deletions(-) create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/controller/ActiveAppletController.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/entity/ActiveApplet.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/mapper/ActiveAppletMapper.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/ActiveAppletService.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/impl/ActiveAppletServiceImpl.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/controller/ActiveAppletController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/controller/ActiveAppletController.java new file mode 100644 index 000000000..99902243b --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/controller/ActiveAppletController.java @@ -0,0 +1,83 @@ +package com.fuint.business.marketingActivity.activeApplet.controller; + +import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; +import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService; +import com.fuint.framework.web.BaseController; +import com.fuint.framework.web.ResponseObject; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.io.Serializable; +import java.util.List; + +/** + * 小程序端活动表(ActiveApplet)表控制层 + * + * @author makejava + * @since 2024-03-11 15:28:10 + */ +@RestController +@RequestMapping("business/marketingActivity/activeApplet") +public class ActiveAppletController extends BaseController { + /** + * 服务对象 + */ + @Resource + private ActiveAppletService activeAppletService; + + /** + * 查询所有数据 + * + * @param activeApplet 查询实体 + * @return 所有数据 + */ + @GetMapping("/applet") + public ResponseObject selectAll(ActiveApplet activeApplet) { + return getSuccessResult(this.activeAppletService.applet(activeApplet)); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public ResponseObject selectOne(@PathVariable Serializable id) { + return getSuccessResult(this.activeAppletService.getById(id)); + } + + /** + * 新增数据 + * + * @param activeApplet 实体对象 + * @return 新增结果 + */ + @PostMapping + public ResponseObject insert(@RequestBody ActiveApplet activeApplet) { + return getSuccessResult(this.activeAppletService.save(activeApplet)); + } + + /** + * 修改数据 + * + * @param activeApplet 实体对象 + * @return 修改结果 + */ + @PutMapping + public ResponseObject update(@RequestBody ActiveApplet activeApplet) { + return getSuccessResult(this.activeAppletService.updateById(activeApplet)); + } + + /** + * 删除数据 + * + * @param idList 主键结合 + * @return 删除结果 + */ + @DeleteMapping + public ResponseObject delete(@RequestParam("idList") List idList) { + return getSuccessResult(this.activeAppletService.removeByIds(idList)); + } +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/entity/ActiveApplet.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/entity/ActiveApplet.java new file mode 100644 index 000000000..77a3411c1 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/entity/ActiveApplet.java @@ -0,0 +1,211 @@ +package com.fuint.business.marketingActivity.activeApplet.entity; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import java.io.Serializable; + +/** + * 小程序端活动表(ActiveApplet)表实体类 + * + * @author makejava + * @since 2024-03-11 15:28:10 + */ +@SuppressWarnings("serial") +public class ActiveApplet extends Model { + //主键id + @TableId(type = IdType.AUTO) + private Integer id; + //所属连锁店id + private Integer chainStoreId; + //店铺id + private Integer storeId; + //是否在线 0:在线 1: 下线 + private String isonline; + //活动状态 1:启用 2:禁用 + private String activeStatus; + //适用会员 + private String adaptUserType; + //活动描述 + private String discountActiveDescribe; + //成长值 + private Integer growaValue; + //适用油品 + private String oilName; + //积分 + private Integer points; + //时间 + private String time; + //类型 + private String type; + //活动时间 + private String name; + //活动id + private Integer activeId; + //创建者 + private String createBy; + //创建时间 + private Date createTime; + //更新者 + private String updateBy; + //更新时间 + private Date updateTime; + + + 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 getIsonline() { + return isonline; + } + + public void setIsonline(String isonline) { + this.isonline = isonline; + } + + public String getActiveStatus() { + return activeStatus; + } + + public void setActiveStatus(String activeStatus) { + this.activeStatus = activeStatus; + } + + public String getAdaptUserType() { + return adaptUserType; + } + + public void setAdaptUserType(String adaptUserType) { + this.adaptUserType = adaptUserType; + } + + public String getDiscountActiveDescribe() { + return discountActiveDescribe; + } + + public void setDiscountActiveDescribe(String discountActiveDescribe) { + this.discountActiveDescribe = discountActiveDescribe; + } + + public Integer getGrowaValue() { + return growaValue; + } + + public void setGrowaValue(Integer growaValue) { + this.growaValue = growaValue; + } + + public String getOilName() { + return oilName; + } + + public void setOilName(String oilName) { + this.oilName = oilName; + } + + public Integer getPoints() { + return points; + } + + public void setPoints(Integer points) { + this.points = points; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getActiveId() { + return activeId; + } + + public void setActiveId(Integer activeId) { + this.activeId = activeId; + } + + 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/activeApplet/mapper/ActiveAppletMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/mapper/ActiveAppletMapper.java new file mode 100644 index 000000000..5623982d6 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/mapper/ActiveAppletMapper.java @@ -0,0 +1,15 @@ +package com.fuint.business.marketingActivity.activeApplet.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; + +/** + * 小程序端活动表(ActiveApplet)表数据库访问层 + * + * @author makejava + * @since 2024-03-11 15:28:10 + */ +public interface ActiveAppletMapper extends BaseMapper { + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/ActiveAppletService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/ActiveAppletService.java new file mode 100644 index 000000000..20d415913 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/ActiveAppletService.java @@ -0,0 +1,18 @@ +package com.fuint.business.marketingActivity.activeApplet.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; + +import java.util.List; + +/** + * 小程序端活动表(ActiveApplet)表服务接口 + * + * @author makejava + * @since 2024-03-11 15:28:11 + */ +public interface ActiveAppletService extends IService { + + List applet(ActiveApplet activeApplet); +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/impl/ActiveAppletServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/impl/ActiveAppletServiceImpl.java new file mode 100644 index 000000000..9c6f873d9 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/impl/ActiveAppletServiceImpl.java @@ -0,0 +1,25 @@ +package com.fuint.business.marketingActivity.activeApplet.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.marketingActivity.activeApplet.mapper.ActiveAppletMapper; +import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; +import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 小程序端活动表(ActiveApplet)表服务实现类 + * + * @author makejava + * @since 2024-03-11 15:28:11 + */ +@Service("activeAppletService") +public class ActiveAppletServiceImpl extends ServiceImpl implements ActiveAppletService { + + @Override + public List applet(ActiveApplet activeApplet) { + return null; + } +} + 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 202e67d0f..4016a3040 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 @@ -6,6 +6,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.activeApplet.entity.ActiveApplet; import com.fuint.business.marketingActivity.activeConsumption.dto.ActiveConsumptionDTO; import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionChild; import com.fuint.business.marketingActivity.activeConsumption.mapper.ActiveConsumptionMapper; @@ -26,6 +27,7 @@ import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableMa import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService; import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService; import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableVO; +import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild; import com.fuint.business.member.entity.LJStaff; import com.fuint.business.member.service.ILJStaffService; import com.fuint.business.petrolStationManagement.entity.OilName; @@ -105,6 +107,8 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl list = activeConsumptionDTO.getActiveConsumptionChildList(); if (CollectionUtils.isNotEmpty(list)){ 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 f6422df75..115fc66e0 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 @@ -2,11 +2,15 @@ package com.fuint.business.marketingActivity.activeDiscount.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; +import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService; import com.fuint.business.marketingActivity.activeDiscount.dto.ActiveDiscountDTO; 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.common.util.TokenUtil; import com.fuint.framework.web.BaseController; import com.fuint.framework.web.ResponseObject; import org.apache.ibatis.annotations.Param; @@ -33,6 +37,8 @@ public class ActiveDiscountController extends BaseController { private ActiveDiscountService activeDiscountService; @Resource private ActiveDiscountChildService activeDiscountChildService; + @Resource + private ActiveAppletService activeAppletService; /** * 分页查询所有数据 @@ -123,6 +129,11 @@ public class ActiveDiscountController extends BaseController { */ @DeleteMapping("delById/{ids}") public ResponseObject delete(@PathVariable Integer ids) { + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getActiveId,ids); + queryWrapper1.eq(ActiveApplet::getType,"3"); + activeAppletService.remove(queryWrapper1); return getSuccessResult(this.activeDiscountService.removeById(ids)); } 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 a23f36120..075eab2fc 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 @@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; +import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService; import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption; import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionChild; import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionVO; @@ -23,6 +25,7 @@ import com.fuint.business.petrolStationManagement.service.OilNameService; import com.fuint.business.store.service.StoreService; import com.fuint.business.userManager.entity.LJUserGrade; import com.fuint.business.userManager.service.LJUserGradeService; +import com.fuint.common.dto.AccountInfo; import com.fuint.common.service.AccountService; import com.fuint.common.util.TokenUtil; import com.fuint.repository.model.TAccount; @@ -61,6 +64,8 @@ public class ActiveDiscountServiceImpl extends ServiceImpl list = activeDiscountDTO.getActiveDiscountChildList(); if (CollectionUtils.isNotEmpty(list)){ @@ -104,6 +167,110 @@ public class ActiveDiscountServiceImpl extends ServiceImpl queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getType,"3"); + queryWrapper1.eq(ActiveApplet::getActiveId,activeDiscountDTO.getId()); + ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd"); + String formatSt = dateFormat.format(activeDiscountDTO.getActiveStartTime()); + String formatEd = dateFormat.format(activeDiscountDTO.getActiveEndTime()); + activeApplet.setTime(formatSt+"-" + formatEd+""); + + //获取会员等级 + String str = ""; + if (ObjectUtils.isNotEmpty(activeDiscountDTO.getDieselUserLevel())){ + for (String gradeId : activeDiscountDTO.getDieselUserLevel()) { + if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){ + str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ","; + } + } + }else { + str = "普通群体"; + } + activeApplet.setAdaptUserType(str); + + String oilName = ""; + //油品名称 + String[] adaptOil = activeDiscountDTO.getAdaptOil(); + for (String oilType : adaptOil) { + OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType)); + oilName += oilName1.getOilType() + "-"+oilName1.getOilName() + ","; + } + activeApplet.setOilName(oilName); + + String describ = ""; + //活动规则满足金额 + double amount = 0.0; + //折扣 + double discount = 0.0; + if (CollectionUtils.isNotEmpty(activeDiscountDTO.getActiveDiscountChildList())) { + for (ActiveDiscountChild activeDiscountChild : activeDiscountDTO.getActiveDiscountChildList()) { + amount = activeDiscountChild.getAmount(); + discount = activeDiscountChild.getDiscount(); + describ += "满" + + amount + "元,打" + discount + "折;"; + } + } + if (activeDiscountDTO.getMemberDayType().equals("0")){ + activeApplet.setDiscountActiveDescribe("参加此项折扣营销活动,享受优惠为:" + + describ + "快来参与吧。"); + }else if (activeDiscountDTO.getMemberDayType().equals("2")){ + activeApplet.setDiscountActiveDescribe("参加此项折扣营销活动,享受优惠为:" + + describ + "本活动的会员日为每周的"+activeDiscountDTO.getWeekDay()+"快来参与吧。"); + }else { + activeApplet.setDiscountActiveDescribe("参加此项折扣营销活动,享受优惠为:" + + describ + "本活动的会员日为每月的"+activeDiscountDTO.getMonthDay()+"号,快来参与吧。"); + } + if (ObjectUtils.isNotEmpty(activeDiscountDTO.getIsonline())){ + activeApplet.setIsonline(activeDiscountDTO.getIsonline()); + } + activeAppletService.updateById(activeApplet); + + + //更新折扣营销 + ActiveDiscount activeDiscount = new ActiveDiscount(); + BeanUtils.copyProperties(activeDiscountDTO,activeDiscount); + + TAccount accountInfoById = accountService.getAccountInfoById(TokenUtil.getNowAccountInfo().getId()); + if (ObjectUtil.isNotEmpty(accountInfoById)) activeDiscount.setCreateBy(accountInfoById.getRealName()); + //柴油会员等级 + activeDiscount.setDieselUserLevel(arrayToString(activeDiscountDTO.getDieselUserLevel())); + //汽油会员等级 + activeDiscount.setGasolineUserLevel(arrayToString(activeDiscountDTO.getGasolineUserLevel())); + //天然气会员等级 + activeDiscount.setNaturalUserLevel(arrayToString(activeDiscountDTO.getNaturalUserLevel())); + activeDiscount.setAdaptOil(arrayToString(activeDiscountDTO.getAdaptOil())); + + if (activeDiscountDTO.getIsonline().equals("1")){ + activeDiscount.setStatus("1"); + } + update = updateById(activeDiscount); + //更新子表数据 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveDiscountChild::getActiveDiscountId,activeDiscountDTO.getId()); + activeDiscountChildService.remove(queryWrapper); + //新增兑换物品 + List activeDiscountChildList = activeDiscountDTO.getActiveDiscountChildList(); + if (CollectionUtils.isNotEmpty(activeDiscountChildList)){ + activeDiscountChildList.stream().map(s ->{ + s.setActiveDiscountId(activeDiscount.getId()); + return s; + }).collect(Collectors.toList()); + update = activeDiscountChildService.saveBatch(activeDiscountChildList); + } + return update; + } + /** * 分页查询所有数据 * @param page @@ -209,47 +376,6 @@ public class ActiveDiscountServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(ActiveDiscountChild::getActiveDiscountId,activeDiscountDTO.getId()); - activeDiscountChildService.remove(queryWrapper); - //新增兑换物品 - List activeDiscountChildList = activeDiscountDTO.getActiveDiscountChildList(); - if (CollectionUtils.isNotEmpty(activeDiscountChildList)){ - activeDiscountChildList.stream().map(s ->{ - s.setActiveDiscountId(activeDiscount.getId()); - return s; - }).collect(Collectors.toList()); - update = activeDiscountChildService.saveBatch(activeDiscountChildList); - } - return update; - } @Override public Boolean updateIsOnline(Integer id, String isonline) { @@ -260,6 +386,13 @@ public class ActiveDiscountServiceImpl extends ServiceImpl queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getActiveId,id); + queryWrapper1.eq(ActiveApplet::getType,"3"); + ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1); + activeApplet.setIsonline(isonline); + activeAppletService.updateById(activeApplet); return row==1; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/controller/ActiveFullminusController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/controller/ActiveFullminusController.java index a31e0bec4..23762f326 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 @@ -2,12 +2,16 @@ package com.fuint.business.marketingActivity.activeFullminus.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; +import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService; import com.fuint.business.marketingActivity.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; import com.fuint.business.marketingActivity.activeFullminus.service.ActiveFullminusService; +import com.fuint.common.util.TokenUtil; import com.fuint.framework.web.BaseController; import com.fuint.framework.web.ResponseObject; import org.apache.ibatis.annotations.Param; @@ -34,6 +38,8 @@ public class ActiveFullminusController extends BaseController { private ActiveFullminusService activeFullminusService; @Resource private ActiveDiscountChildService activeDiscountChildService; + @Resource + private ActiveAppletService activeAppletService; /** * 分页查询所有数据 @@ -123,6 +129,11 @@ public class ActiveFullminusController extends BaseController { */ @DeleteMapping("delById/{ids}") public ResponseObject delete(@PathVariable Integer ids) { + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getActiveId,ids); + queryWrapper1.eq(ActiveApplet::getType,"4"); + activeAppletService.remove(queryWrapper1); return getSuccessResult(this.activeFullminusService.removeById(ids)); } /** 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 b1b4148d8..c2b8fdc83 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 @@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; +import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService; import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount; import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscountChild; import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountChildService; @@ -22,6 +24,7 @@ import com.fuint.business.petrolStationManagement.service.OilNameService; import com.fuint.business.store.service.StoreService; import com.fuint.business.userManager.entity.LJUserGrade; import com.fuint.business.userManager.service.LJUserGradeService; +import com.fuint.common.dto.AccountInfo; import com.fuint.common.service.AccountService; import com.fuint.common.util.TokenUtil; import com.fuint.repository.model.TAccount; @@ -29,6 +32,7 @@ import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.io.Serializable; @@ -57,16 +61,22 @@ public class ActiveFullminusServiceImpl extends ServiceImpl list = activeFullminusDTO.getActiveDiscountChildList(); if (CollectionUtils.isNotEmpty(list)){ @@ -201,8 +268,69 @@ public class ActiveFullminusServiceImpl extends ServiceImpl queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getType,"4"); + queryWrapper1.eq(ActiveApplet::getActiveId,activeFullminusDTO.getId()); + ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd"); + String formatSt = dateFormat.format(activeFullminusDTO.getActiveStartTime()); + String formatEd = dateFormat.format(activeFullminusDTO.getActiveEndTime()); + activeApplet.setTime(formatSt+"-" + formatEd+""); + + //获取会员等级 + String str = ""; + if (ObjectUtils.isNotEmpty(activeFullminusDTO.getDieselUserLevel())){ + for (String gradeId : activeFullminusDTO.getDieselUserLevel()) { + if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){ + str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ","; + } + } + }else { + str = "普通群体"; + } + activeApplet.setAdaptUserType(str); + + String oilName = ""; + //油品名称 + String[] adaptOil = activeFullminusDTO.getAdaptOil(); + for (String oilType : adaptOil) { + OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType)); + oilName += oilName1.getOilType() + "-"+oilName1.getOilName() + ","; + } + activeApplet.setOilName(oilName); + + String describ = ""; + //活动规则满足金额 + double amount = 0.0; + //折扣 + double discount = 0.0; + if (CollectionUtils.isNotEmpty(activeFullminusDTO.getActiveDiscountChildList())) { + for (ActiveDiscountChild activeDiscountChild : activeFullminusDTO.getActiveDiscountChildList()) { + amount = activeDiscountChild.getAmount(); + discount = activeDiscountChild.getDeductionAmount(); + describ += "满" + + amount + "元,减" + discount + "元;"; + } + } + if (activeFullminusDTO.getMemberDayType().equals("0")){ + activeApplet.setDiscountActiveDescribe("参加此项折满减销活动,享受优惠为:" + + describ + "快来参与吧。"); + }else if (activeFullminusDTO.getMemberDayType().equals("2")){ + activeApplet.setDiscountActiveDescribe("参加此项满减营销活动,享受优惠为:" + + describ + "本活动的会员日为每周的"+activeFullminusDTO.getWeekDay()+"快来参与吧。"); + }else { + activeApplet.setDiscountActiveDescribe("参加此项满减营销活动,享受优惠为:" + + describ + "本活动的会员日为每月的"+activeFullminusDTO.getMonthDay()+"号,快来参与吧。"); + } + if (ObjectUtils.isNotEmpty(activeFullminusDTO.getIsonline())){ + activeApplet.setIsonline(activeFullminusDTO.getIsonline()); + } + activeAppletService.updateById(activeApplet); //更新折扣营销 ActiveFullminus activeFullminus = new ActiveFullminus(); BeanUtils.copyProperties(activeFullminusDTO,activeFullminus); @@ -246,6 +374,13 @@ public class ActiveFullminusServiceImpl extends ServiceImpl queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getActiveId,id); + queryWrapper1.eq(ActiveApplet::getType,"4"); + ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1); + activeApplet.setIsonline(isonline); + activeAppletService.updateById(activeApplet); return row == 1; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendRecordsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendRecordsServiceImpl.java index 7e5497cc5..899eed5dd 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 @@ -28,6 +28,7 @@ import com.fuint.business.userManager.service.LJUserService; import com.fuint.business.userManager.service.UserBalanceService; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.TokenUtil; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -44,6 +45,7 @@ import java.util.stream.Collectors; * @since 2023-12-20 14:13:16 */ @Service("activeRecommendRecordsService") +@Slf4j public class ActiveRecommendRecordsServiceImpl extends ServiceImpl implements ActiveRecommendRecordsService { @Resource @@ -154,6 +156,7 @@ public class ActiveRecommendRecordsServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(CardFuelDiesel::getStoreId, nowAccountInfo.getStoreId()); @@ -112,10 +126,51 @@ public class CardFuelDieselController extends BaseController { cardFuelDiesel.setStoreId(nowAccountInfo.getStoreId()); cardFuelDiesel.setChainStorId(storeService.getById(nowAccountInfo.getStoreId()).getChainStoreId()); } - /*cardFuelDiesel.setStartTime(new Date()); - cardFuelDiesel.setEndTime(new Date());*/ cardFuelDiesel.setStatus(cardFuelDiesel.getStatus().equals("true") ? "1" : "2"); - return getSuccessResult(this.cardFuelDieselService.save(cardFuelDiesel)); + boolean save = this.cardFuelDieselService.save(cardFuelDiesel); + activeApplet.setActiveId(cardFuelDiesel.getId()); + //活动时间 + if (cardFuelDiesel.getActiveTime().equals("1")){ + activeApplet.setTime("不限时间"); + }else { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd"); + String formatSt = dateFormat.format(cardFuelDiesel.getStartTime()); + String formatEd = dateFormat.format(cardFuelDiesel.getEndTime()); + activeApplet.setTime(formatSt+"-" + formatEd+""); + } + + //油品名称 + String type = cardFuelDiesel.getType(); + String oilType = cardFuelDiesel.getOilType(); + OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType)); + String oilName = oilName1.getOilName(); + activeApplet.setOilName(type+"-"+oilName); + //时间 + String startFormat= ""; + String endFormat = ""; + if (cardFuelDiesel.getActiveTime().equals("1")){ + activeApplet.setTime("不限时间!"); + //描述 + activeApplet.setDiscountActiveDescribe("本充值活动,充值满"+ + cardFuelDiesel.getRechargeBalance()+"元可以参加,所参与油品类型为:"+activeApplet.getOilName()+",锁价单价为:"+ + cardFuelDiesel.getLockupPrice()+"元/L,总升数为:"+cardFuelDiesel.getIncomeLitres()+"L,活动时间为:不限时间!"); + }else { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + startFormat = simpleDateFormat.format(cardFuelDiesel.getStartTime()); + endFormat = simpleDateFormat.format(cardFuelDiesel.getEndTime()); + activeApplet.setTime(startFormat+"-"+endFormat); + //描述 + activeApplet.setDiscountActiveDescribe("本充值活动,充值满"+ + cardFuelDiesel.getRechargeBalance()+"元可以参加,所参与油品类型为:"+activeApplet.getOilName()+",锁价单价为:"+ + cardFuelDiesel.getLockupPrice()+"元/L,总升数为:"+cardFuelDiesel.getIncomeLitres()+"L,活动时间为:"+startFormat+"-"+endFormat); + } + + + activeApplet.setPoints(cardFuelDiesel.getPoints()); + activeApplet.setName("囤油卡充值活动"); + activeApplet.setType("2"); + activeAppletService.save(activeApplet); + return getSuccessResult(save); } /** @@ -131,6 +186,49 @@ public class CardFuelDieselController extends BaseController { String substring = cardFuelDiesel.getType().substring(0, 3); cardFuelDiesel.setType(substring); } + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getType,"2"); + queryWrapper1.eq(ActiveApplet::getActiveId,cardFuelDiesel.getId()); + ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1); + //活动时间 + if (cardFuelDiesel.getActiveTime().equals("1")){ + activeApplet.setTime("不限时间"); + }else { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd"); + String formatSt = dateFormat.format(cardFuelDiesel.getStartTime()); + String formatEd = dateFormat.format(cardFuelDiesel.getEndTime()); + activeApplet.setTime(formatSt+"-" + formatEd+""); + } + + //油品名称 + String type = cardFuelDiesel.getType(); + String oilType = cardFuelDiesel.getOilType(); + OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType)); + String oilName = oilName1.getOilName(); + activeApplet.setOilName(type+"-"+oilName); + //时间 + String startFormat= ""; + String endFormat = ""; + if (cardFuelDiesel.getActiveTime().equals("1")){ + activeApplet.setTime("不限时间!"); + //描述 + activeApplet.setDiscountActiveDescribe("本充值活动,充值满"+ + cardFuelDiesel.getRechargeBalance()+"元可以参加,所参与油品类型为:"+activeApplet.getOilName()+",锁价单价为:"+ + cardFuelDiesel.getLockupPrice()+"元/L,总升数为:"+cardFuelDiesel.getIncomeLitres()+"L,活动时间为:不限时间!"); + }else { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + startFormat = simpleDateFormat.format(cardFuelDiesel.getStartTime()); + endFormat = simpleDateFormat.format(cardFuelDiesel.getEndTime()); + activeApplet.setTime(startFormat+"-"+endFormat); + //描述 + activeApplet.setDiscountActiveDescribe("本充值活动,充值满"+ + cardFuelDiesel.getRechargeBalance()+"元可以参加,所参与油品类型为:"+activeApplet.getOilName()+",锁价单价为:"+ + cardFuelDiesel.getLockupPrice()+"元/L,总升数为:"+cardFuelDiesel.getIncomeLitres()+"L,活动时间为:"+startFormat+"-"+endFormat); + } + + activeApplet.setPoints(cardFuelDiesel.getPoints()); + activeAppletService.updateById(activeApplet); return getSuccessResult(this.cardFuelDieselService.updateById(cardFuelDiesel)); } @@ -142,7 +240,14 @@ public class CardFuelDieselController extends BaseController { */ @DeleteMapping("/{id}") public ResponseObject delete(@PathVariable Integer id) { + + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getActiveId,id); + queryWrapper1.eq(ActiveApplet::getType,"2"); + activeAppletService.remove(queryWrapper1); return getSuccessResult(this.cardFuelDieselService.removeById(id)); + } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueServiceImpl.java index d14c732b3..76d20ef82 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueServiceImpl.java @@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; +import com.fuint.business.marketingActivity.activeApplet.mapper.ActiveAppletMapper; +import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService; import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionChild; import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionAppletVO; import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionVO; @@ -31,6 +34,7 @@ import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.io.Serializable; @@ -61,6 +65,9 @@ public class CardValueServiceImpl extends ServiceImpl cardValueChildList = cardValueDTO.getCardValueChildList(); cardValueChildList.stream().map(s ->{ @@ -292,6 +341,7 @@ public class CardValueServiceImpl extends ServiceImpl queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getType,"1"); + queryWrapper1.eq(ActiveApplet::getActiveId,cardValueDTO.getId()); + ActiveApplet one = activeAppletService.getOne(queryWrapper1); + + //获取会员等级 + String str = ""; + if (ObjectUtils.isNotEmpty(cardValueDTO.getMembershipLevel())){ + for (String gradeId : cardValueDTO.getMembershipLevel()) { + if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){ + str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ","; + } + } + }else { + str = "普通群体"; + } + //活动时间 + if (cardValue.getActiveTime().equals("1")){ + activeApplet.setTime("不限时间"); + }else { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd"); + String formatSt = dateFormat.format(cardValue.getStartTime()); + String formatEd = dateFormat.format(cardValue.getEndTime()); + activeApplet.setTime(formatSt+"-" + formatEd+""); + } + + //赠送优惠券兑换券实物 + String card = ""; + if (CollectionUtils.isNotEmpty(cardValueDTO.getCardValueChildList())) { + for (CardValueChild cardValueChild : cardValueDTO.getCardValueChildList()) { + card += cardValueChild.getGiftCardDetail() + "的券,"; + } + } + + activeApplet.setAdaptUserType(str); + activeApplet.setId(one.getId()); + activeApplet.setGrowaValue(cardValue.getGrowthValue()); + activeApplet.setPoints(cardValue.getPoints()); + activeApplet.setType("1"); + activeApplet.setName("储值卡充值活动"); + activeApplet.setDiscountActiveDescribe("本充值活动,充值满"+ + cardValue.getRechargeBalance()+"元,赠送金额为:"+cardValue.getGiftBalance()+"元,赠送券:"+card+"。"); + activeAppletService.updateById(activeApplet); return update; } @@ -382,6 +477,7 @@ public class CardValueServiceImpl extends ServiceImpl queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getActiveId,id); + queryWrapper1.eq(ActiveApplet::getType,"1"); + activeAppletService.remove(queryWrapper1); return flag; }