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 index 99902243b..bf0f3a70a 100644 --- 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 @@ -31,11 +31,24 @@ public class ActiveAppletController extends BaseController { * @param activeApplet 查询实体 * @return 所有数据 */ - @GetMapping("/applet") + @GetMapping("/appletActive") public ResponseObject selectAll(ActiveApplet activeApplet) { return getSuccessResult(this.activeAppletService.applet(activeApplet)); } + /** + * 查询所有数据 + * + * @param activeApplet 查询实体 + * @return 所有数据 + */ + @GetMapping("/appletActiveByType") + public ResponseObject appletActiveByType(ActiveApplet activeApplet) { + return getSuccessResult(this.activeAppletService.appletActiveByType(activeApplet)); + } + + + /** * 通过主键查询单条数据 * 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 index 5623982d6..14316d00f 100644 --- 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 @@ -2,6 +2,9 @@ package com.fuint.business.marketingActivity.activeApplet.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 小程序端活动表(ActiveApplet)表数据库访问层 @@ -11,5 +14,8 @@ import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; */ public interface ActiveAppletMapper extends BaseMapper { + List selectApplet(@Param("cardValueRecord") ActiveApplet activeApplet); + + List appletActiveByType(@Param("cardValueRecord")ActiveApplet activeApplet); } 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 index 20d415913..0c574d939 100644 --- 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 @@ -14,5 +14,6 @@ import java.util.List; public interface ActiveAppletService extends IService { List applet(ActiveApplet activeApplet); + List appletActiveByType(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 index 9c6f873d9..868815344 100644 --- 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 @@ -6,6 +6,7 @@ import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.util.List; /** @@ -17,9 +18,17 @@ import java.util.List; @Service("activeAppletService") public class ActiveAppletServiceImpl extends ServiceImpl implements ActiveAppletService { + @Resource + private ActiveAppletMapper activeAppletMapper; + @Override public List applet(ActiveApplet activeApplet) { - return null; + return activeAppletMapper.selectApplet(); + } + + @Override + public List appletActiveByType(ActiveApplet activeApplet) { + return activeAppletMapper.appletActiveByType(activeApplet); } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/controller/ActiveRecommendController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/controller/ActiveRecommendController.java index aaebc7bfb..b8dcdf090 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/controller/ActiveRecommendController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/controller/ActiveRecommendController.java @@ -2,8 +2,11 @@ package com.fuint.business.marketingActivity.activeRecommend.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; +import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService; import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption; import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlyweds; import com.fuint.business.marketingActivity.activeRecommend.dto.ActiveRecommendDTO; @@ -19,6 +22,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.io.Serializable; import java.util.List; +import java.util.Map; /** * 推荐有礼表(ActiveRecommend)表控制层 @@ -36,6 +40,8 @@ public class ActiveRecommendController extends BaseController { private ActiveRecommendService activeRecommendService; @Resource private ActiveRecommendChildService activeRecommendChildService; + @Resource + private ActiveAppletService activeAppletService; /** * 分页查询所有数据 @@ -84,6 +90,19 @@ public class ActiveRecommendController extends BaseController { return getSuccessResult(this.activeRecommendService.add(activeRecommendDTO)); } + /** + * 修改数据 + * + * @param map 实体对象 + * @return 修改结果 + */ + @PostMapping("/edit") + public ResponseObject updateIsOnline(@RequestBody Map map) { + Integer id = Integer.valueOf(map.get("id")); + String isonline = map.get("isonline"); + return getSuccessResult(this.activeRecommendService.updateIsonline(id,isonline)); + } + /** * 修改数据 * @@ -112,6 +131,11 @@ public class ActiveRecommendController extends BaseController { */ @DeleteMapping("delById/{ids}") public ResponseObject delete(@PathVariable Long ids) { + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getActiveId,ids); + queryWrapper1.eq(ActiveApplet::getType,"7"); + activeAppletService.remove(queryWrapper1); return getSuccessResult(this.activeRecommendService.removeById(ids)); } 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 bb9a4e174..2b35423b5 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 @@ -34,6 +34,13 @@ public interface ActiveRecommendService extends IService { */ ActiveRecommendVO getOneById(Serializable id); List getOneByIdApplet(ActiveConsumption activeConsumption); + /** + * 修改下线 + * @param id + * @param isonline + * @return + */ + Boolean updateIsonline(Integer id,String isonline); /** * 修改数据 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 d3fd4734d..c7a621e4b 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 @@ -6,7 +6,11 @@ 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.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; @@ -66,6 +70,8 @@ public class ActiveRecommendServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(ActiveRecommend::getStoreId,storeId); @@ -100,6 +107,33 @@ public class ActiveRecommendServiceImpl extends ServiceImpl list = activeRecommendDTO.getActiveRecommendChildList(); if (CollectionUtils.isNotEmpty(list)) { @@ -114,6 +148,77 @@ public class ActiveRecommendServiceImpl extends ServiceImpl queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getType,"7"); + queryWrapper1.eq(ActiveApplet::getActiveId,activeRecommendDTO.getId()); + ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd"); + String formatSt = dateFormat.format(activeRecommendDTO.getActiveStartTime()); + String formatEd = dateFormat.format(activeRecommendDTO.getActiveEndTime()); + activeApplet.setTime(formatSt+"-" + formatEd+""); + + if (ObjectUtils.isNotEmpty(activeRecommendDTO.getPoints())){ + activeApplet.setPoints(activeRecommendDTO.getPoints()); + } + if (ObjectUtils.isNotEmpty(activeRecommendDTO.getGrowthValue())){ + activeApplet.setGrowaValue(activeRecommendDTO.getGrowthValue()); + } + activeApplet.setType("7"); + activeApplet.setName("推荐有礼活动"); + + //赠送优惠券兑换券实物 + String card = ""; + if (CollectionUtils.isNotEmpty(activeRecommendDTO.getActiveRecommendChildList())) { + for (ActiveRecommendChild activeRecommendChild : activeRecommendDTO.getActiveRecommendChildList()) { + card += activeRecommendChild.getGiftCardDetail() + "的券,"; + } + } + activeApplet.setDiscountActiveDescribe("此项推荐有礼活动,推荐即可获得积分:"+activeApplet.getPoints()+"积分,成长值:"+activeApplet.getGrowaValue()+"成长值,赠送券为:"+card+"。"); + activeAppletService.updateById(activeApplet); + + + + //更新推荐有礼活动 + ActiveRecommend activeRecommend = new ActiveRecommend(); + BeanUtils.copyProperties(activeRecommendDTO,activeRecommend); + TAccount accountInfoById = accountService.getAccountInfoById(TokenUtil.getNowAccountInfo().getId()); + if (ObjectUtil.isNotEmpty(accountInfoById)) activeRecommend.setCreateBy(accountInfoById.getRealName()); + //柴油会员等级 + if (ObjectUtil.isNotEmpty(activeRecommendDTO.getInviterGiftType())) + activeRecommend.setInviterGiftType(arrayToString(activeRecommendDTO.getInviterGiftType())); + if (activeRecommendDTO.getStatus().equals("0")) activeRecommend.setIsonline("0"); + if (activeRecommendDTO.getStatus().equals("2")) activeRecommend.setIsonline("1"); + + update = updateById(activeRecommend); + //更新子表数据 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveRecommendChild::getActiveRecommendId,activeRecommendDTO.getId()); + activeRecommendChildService.remove(queryWrapper); + //新增兑换物品 + List activeRecommendChildList = activeRecommendDTO.getActiveRecommendChildList(); + if (CollectionUtils.isNotEmpty(activeRecommendChildList)){ + activeRecommendChildList.stream().map(s ->{ + s.setActiveRecommendId(activeRecommend.getId()); + return s; + }).collect(Collectors.toList()); + update = activeRecommendChildService.saveBatch(activeRecommendChildList); + } + return update; + } + + /** * 通过店铺id查询单条数据 * @param id @@ -214,6 +319,28 @@ public class ActiveRecommendServiceImpl extends ServiceImpl queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId()); + queryWrapper1.eq(ActiveApplet::getActiveId,id); + queryWrapper1.eq(ActiveApplet::getType,"7"); + ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1); + activeApplet.setIsonline(isonline); + activeAppletService.updateById(activeApplet); + + return row == 1; + } + /** * 通过店铺id查询单条数据(小程序端) @@ -259,41 +386,7 @@ public class ActiveRecommendServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(ActiveRecommendChild::getActiveRecommendId,activeRecommendDTO.getId()); - activeRecommendChildService.remove(queryWrapper); - //新增兑换物品 - List activeRecommendChildList = activeRecommendDTO.getActiveRecommendChildList(); - if (CollectionUtils.isNotEmpty(activeRecommendChildList)){ - activeRecommendChildList.stream().map(s ->{ - s.setActiveRecommendId(activeRecommend.getId()); - return s; - }).collect(Collectors.toList()); - update = activeRecommendChildService.saveBatch(activeRecommendChildList); - } - return update; - } /** * 查询单条数据(小程序端)