This commit is contained in:
齐天大圣 2024-03-12 14:08:40 +08:00
parent aaf5ac2f90
commit 918efbd372
5 changed files with 212 additions and 38 deletions

View File

@ -1,11 +1,15 @@
package com.fuint.business.marketingActivity.activeConsumption.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
import com.fuint.business.marketingActivity.activeConsumption.dto.ActiveConsumptionDTO;
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption;
import com.fuint.business.marketingActivity.activeConsumption.service.ActiveConsumptionChildService;
import com.fuint.business.marketingActivity.activeConsumption.service.ActiveConsumptionService;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
@ -32,6 +36,8 @@ public class ActiveConsumptionController extends BaseController {
private ActiveConsumptionService activeConsumptionService;
@Resource
private ActiveConsumptionChildService activeConsumptionChildService;
@Resource
private ActiveAppletService activeAppletService;
/**
* 分页查询所有数据
@ -132,6 +138,11 @@ public class ActiveConsumptionController extends BaseController {
*/
@DeleteMapping("delById/{ids}")
public ResponseObject delete(@PathVariable Long ids) {
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
queryWrapper1.eq(ActiveApplet::getActiveId,ids);
queryWrapper1.eq(ActiveApplet::getType,"5");
activeAppletService.remove(queryWrapper1);
return getSuccessResult(this.activeConsumptionService.removeById(ids));
}

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
import com.fuint.business.marketingActivity.activeConsumption.dto.ActiveConsumptionDTO;
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionChild;
import com.fuint.business.marketingActivity.activeConsumption.mapper.ActiveConsumptionMapper;
@ -95,6 +96,8 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
private AccountService accountService;
@Resource
private CardFavorableService cardFavorableService;
@Resource
private ActiveAppletService activeAppletService;
@ -150,7 +153,7 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
}
}
}else {
str = "普通群体";
str = "全部会员";
}
activeApplet.setAdaptUserType(str);
@ -169,6 +172,18 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
card += activeConsumptionChild.getGiftCardDetail() + "的券,";
}
}
activeApplet.setPoints(activeConsumption.getPoints());
activeApplet.setType("5");
activeApplet.setName("消费有礼活动");
String type = "";
if (activeConsumption.getMoneyType().equals("1")){
type ="订单金额";
}else {
type ="实付金额";
}
activeApplet.setDiscountActiveDescribe("此项消费有礼活动,"+type+""+
activeConsumption.getParticipationConditionMoney()+"元可参与,赠送积分为:"+activeConsumption.getPoints()+"积分,赠送券:"+card+"");
activeAppletService.save(activeApplet);
//新增兑换物品
List<ActiveConsumptionChild> list = activeConsumptionDTO.getActiveConsumptionChildList();
@ -353,6 +368,62 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
@Transactional
public Boolean updateOneById(ActiveConsumptionDTO activeConsumptionDTO) {
boolean update = false;
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId());
queryWrapper1.eq(ActiveApplet::getType,"5");
queryWrapper1.eq(ActiveApplet::getActiveId,activeConsumptionDTO.getId());
ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
String formatSt = dateFormat.format(activeConsumptionDTO.getActiveStartTime());
String formatEd = dateFormat.format(activeConsumptionDTO.getActiveEndTime());
activeApplet.setTime(formatSt+"-" + formatEd+"");
//获取会员等级
String str = "";
if (ObjectUtils.isNotEmpty(activeConsumptionDTO.getDieselUserLevel())){
for (String gradeId : activeConsumptionDTO.getDieselUserLevel()) {
if (gradeId.length()>2){
if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
}
}else {
str = "全部会员";
}
}
}else {
str = "全部会员";
}
activeApplet.setAdaptUserType(str);
String oilName = "";
//油品名称
String[] adaptOil = activeConsumptionDTO.getAdaptOil();
for (String oilType : adaptOil) {
OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType));
oilName += oilName1.getOilType() + "-"+oilName1.getOilName() + ",";
}
activeApplet.setOilName(oilName);
//赠送优惠券兑换券实物
String card = "";
if (CollectionUtils.isNotEmpty(activeConsumptionDTO.getActiveConsumptionChildList())) {
for (ActiveConsumptionChild activeConsumptionChild : activeConsumptionDTO.getActiveConsumptionChildList()) {
card += activeConsumptionChild.getGiftCardDetail() + "的券,";
}
}
activeApplet.setPoints(activeConsumptionDTO.getPoints());
activeApplet.setType("5");
activeApplet.setName("消费有礼活动");
String type = "";
if (activeConsumptionDTO.getMoneyType().equals("1")){
type ="订单金额";
}else {
type ="实付金额";
}
activeApplet.setDiscountActiveDescribe("此项消费有礼活动,"+type+""+
activeConsumptionDTO.getParticipationConditionMoney()+"元可参与,赠送积分为:"+activeConsumptionDTO.getPoints()+"积分,赠送券:"+card+"");
activeAppletService.updateById(activeApplet);
//更新消费有礼
ActiveConsumption activeConsumption = new ActiveConsumption();
String participationConditionMoney = activeConsumptionDTO.getParticipationConditionMoney();
@ -412,6 +483,13 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
activeConsumption.setStatus("1");
row = baseMapper.updateById(activeConsumption);
}
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
queryWrapper1.eq(ActiveApplet::getActiveId,id);
queryWrapper1.eq(ActiveApplet::getType,"5");
ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1);
activeApplet.setIsonline(isonline);
activeAppletService.updateById(activeApplet);
return row == 1;
}

View File

@ -2,12 +2,16 @@ package com.fuint.business.marketingActivity.activeNewlyweds.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption;
import com.fuint.business.marketingActivity.activeNewlyweds.dto.ActiveNewlywedsDTO;
import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlyweds;
import com.fuint.business.marketingActivity.activeNewlyweds.service.ActiveNewlywedsChildService;
import com.fuint.business.marketingActivity.activeNewlyweds.service.ActiveNewlywedsService;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
@ -34,6 +38,8 @@ public class ActiveNewlywedsController extends BaseController {
private ActiveNewlywedsService activeNewlywedsService;
@Resource
private ActiveNewlywedsChildService activeNewlywedsChildService;
@Resource
private ActiveAppletService activeAppletService;
/**
* 分页查询所有数据
@ -123,6 +129,11 @@ public class ActiveNewlywedsController extends BaseController {
*/
@DeleteMapping("delById/{ids}")
public ResponseObject delete(@PathVariable Integer ids) {
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
queryWrapper1.eq(ActiveApplet::getActiveId,ids);
queryWrapper1.eq(ActiveApplet::getType,"6");
activeAppletService.remove(queryWrapper1);
return getSuccessResult(this.activeNewlywedsService.removeById(ids));
}

View File

@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption;
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionChild;
import com.fuint.business.marketingActivity.activeNewlyweds.controller.vo.ActiveNewlywedsAppletVO;
import com.fuint.business.marketingActivity.activeNewlyweds.controller.vo.ActiveNewlywedsVO;
import com.fuint.business.marketingActivity.activeNewlyweds.dto.ActiveNewlywedsDTO;
@ -34,6 +37,7 @@ import com.fuint.repository.model.TAccount;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.Serializable;
@ -66,15 +70,20 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
@Resource
private CardExchangeMapper cardExchangeMapper;
@Resource
private ActiveAppletService activeAppletService;
/**
*
* @param activeNewlywedsDTO
* @return
*/
@Override
@Transactional
public Boolean add(ActiveNewlywedsDTO activeNewlywedsDTO) {
boolean save = false;
Integer storeId = TokenUtil.getNowAccountInfo().getStoreId();
ActiveApplet activeApplet = new ActiveApplet();
activeApplet.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
//根据店铺id查询
/*LambdaQueryWrapper<ActiveNewlyweds> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,storeId);
@ -97,6 +106,28 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
activeNewlyweds.setCourtesyReward(arrayToString(activeNewlywedsDTO.getCourtesyReward()));
save = save(activeNewlyweds);
}
activeApplet.setActiveId(activeNewlyweds.getId());
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
String formatSt = dateFormat.format(activeNewlyweds.getActiveStartTime());
String formatEd = dateFormat.format(activeNewlyweds.getActiveEndTime());
activeApplet.setTime(formatSt+"-" + formatEd+"");
activeApplet.setPoints(activeNewlyweds.getPoints());
activeApplet.setGrowaValue(activeNewlyweds.getGrowthValue());
activeApplet.setType("6");
activeApplet.setName("新人有礼活动");
//赠送优惠券兑换券实物
String card = "";
if (CollectionUtils.isNotEmpty(activeNewlywedsDTO.getActiveNewlywedsChildList())) {
for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsDTO.getActiveNewlywedsChildList()) {
card += activeNewlywedsChild.getGiftCardDetail() + "的券,";
}
}
activeApplet.setDiscountActiveDescribe("此项新人有礼活动,登录赠送积分为:"+activeNewlywedsDTO.getPoints()+"积分,赠送成长值为:"+activeNewlywedsDTO.getGrowthValue()+"成长值,赠送券为:"+card+"");
activeAppletService.save(activeApplet);
//新增兑换物品
List<ActiveNewlywedsChild> list = activeNewlywedsDTO.getActiveNewlywedsChildList();
list.stream().map(s ->{
@ -128,6 +159,70 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
return save;
}
/**
* 修改数据
* @param activeNewlywedsDTO
* @return
*/
@Override
@Transactional
public Boolean updateOneById(ActiveNewlywedsDTO activeNewlywedsDTO) {
boolean update = false;
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(ActiveApplet::getStoreId,TokenUtil.getNowAccountInfo().getStoreId());
queryWrapper1.eq(ActiveApplet::getType,"6");
queryWrapper1.eq(ActiveApplet::getActiveId,activeNewlywedsDTO.getId());
ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
String formatSt = dateFormat.format(activeNewlywedsDTO.getActiveStartTime());
String formatEd = dateFormat.format(activeNewlywedsDTO.getActiveEndTime());
activeApplet.setTime(formatSt+"-" + formatEd+"");
activeApplet.setPoints(activeNewlywedsDTO.getPoints());
activeApplet.setGrowaValue(activeNewlywedsDTO.getGrowthValue());
//赠送优惠券兑换券实物
String card = "";
if (CollectionUtils.isNotEmpty(activeNewlywedsDTO.getActiveNewlywedsChildList())) {
for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsDTO.getActiveNewlywedsChildList()) {
card += activeNewlywedsChild.getGiftCardDetail() + "的券,";
}
}
activeApplet.setDiscountActiveDescribe("此项新人有礼活动,登录赠送积分为:"+activeNewlywedsDTO.getPoints()+"积分,赠送成长值为:"+activeNewlywedsDTO.getGrowthValue()+"成长值,赠送券为:"+card+"");
activeAppletService.updateById(activeApplet);
//更新新人有礼活动
ActiveNewlyweds activeNewlyweds = new ActiveNewlyweds();
BeanUtils.copyProperties(activeNewlywedsDTO,activeNewlyweds);
TAccount accountInfoById = accountService.getAccountInfoById(TokenUtil.getNowAccountInfo().getId());
if (ObjectUtil.isNotEmpty(accountInfoById)) activeNewlyweds.setCreateBy(accountInfoById.getRealName());
//奖励类型
activeNewlyweds.setCourtesyReward(arrayToString(activeNewlywedsDTO.getCourtesyReward()));
if (activeNewlywedsDTO.getIsonline().equals("1")){
activeNewlyweds.setStatus("2");
}
update = updateById(activeNewlyweds);
//更新子表数据
LambdaQueryWrapper<ActiveNewlywedsChild> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlywedsDTO.getId());
activeNewlywedsChildService.remove(queryWrapper);
//新增兑换物品
List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlywedsDTO.getActiveNewlywedsChildList();
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
activeNewlywedsChildList.stream().map(s ->{
s.setActiveNewlywedsId(activeNewlyweds.getId());
return s;
}).collect(Collectors.toList());
update = activeNewlywedsChildService.saveBatch(activeNewlywedsChildList);
}
return update;
}
/**
* 分页查询所有数据
* @param page
@ -443,41 +538,7 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
return arrayList;
}
/**
* 修改数据
* @param activeNewlywedsDTO
* @return
*/
@Override
public Boolean updateOneById(ActiveNewlywedsDTO activeNewlywedsDTO) {
boolean update = false;
//更新新人有礼活动
ActiveNewlyweds activeNewlyweds = new ActiveNewlyweds();
BeanUtils.copyProperties(activeNewlywedsDTO,activeNewlyweds);
TAccount accountInfoById = accountService.getAccountInfoById(TokenUtil.getNowAccountInfo().getId());
if (ObjectUtil.isNotEmpty(accountInfoById)) activeNewlyweds.setCreateBy(accountInfoById.getRealName());
//奖励类型
activeNewlyweds.setCourtesyReward(arrayToString(activeNewlywedsDTO.getCourtesyReward()));
if (activeNewlywedsDTO.getIsonline().equals("1")){
activeNewlyweds.setStatus("2");
}
update = updateById(activeNewlyweds);
//更新子表数据
LambdaQueryWrapper<ActiveNewlywedsChild> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlywedsDTO.getId());
activeNewlywedsChildService.remove(queryWrapper);
//新增兑换物品
List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlywedsDTO.getActiveNewlywedsChildList();
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
activeNewlywedsChildList.stream().map(s ->{
s.setActiveNewlywedsId(activeNewlyweds.getId());
return s;
}).collect(Collectors.toList());
update = activeNewlywedsChildService.saveBatch(activeNewlywedsChildList);
}
return update;
}
@Override
public Boolean updateIsonline(Integer id, String isonline) {
@ -488,6 +549,15 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
activeNewlyweds.setIsonline(isonline);
row = baseMapper.updateById(activeNewlyweds);
}
LambdaQueryWrapper<ActiveApplet> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(ActiveApplet::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
queryWrapper1.eq(ActiveApplet::getActiveId,id);
queryWrapper1.eq(ActiveApplet::getType,"6");
ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper1);
activeApplet.setIsonline(isonline);
activeAppletService.updateById(activeApplet);
return row == 1;
}

View File

@ -388,8 +388,12 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
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() + ",";
if (gradeId.length()>2){
if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
}
}else {
str = "普通群体";
}
}
}else {