推荐有礼

This commit is contained in:
齐天大圣 2024-02-28 16:45:03 +08:00
parent 9126fc46aa
commit a913357d69
15 changed files with 317 additions and 127 deletions

View File

@ -8,7 +8,7 @@
</div> </div>
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm"> <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="活动图片" prop="activePictureUrl"> <!-- <el-form-item label="活动图片" prop="activePictureUrl">
<el-upload <el-upload
:action="uploadAction" :action="uploadAction"
list-type="picture-card" list-type="picture-card"
@ -24,7 +24,7 @@
/> />
<i v-if="!this.ruleForm.activePictureUrl" class="el-icon-plus"></i> <i v-if="!this.ruleForm.activePictureUrl" class="el-icon-plus"></i>
</el-upload> </el-upload>
</el-form-item> </el-form-item>-->
<el-form-item label="邀请人获得" prop="inviterGiftType"> <el-form-item label="邀请人获得" prop="inviterGiftType">
<el-checkbox-group v-model="ruleForm.inviterGiftType" > <el-checkbox-group v-model="ruleForm.inviterGiftType" >
<el-checkbox v-for="city in Typelist" :label="city.type" :key="city.type">{{city.text}}</el-checkbox> <el-checkbox v-for="city in Typelist" :label="city.type" :key="city.type">{{city.text}}</el-checkbox>
@ -243,7 +243,7 @@
</div> </div>
</div> </div>
<el-form-item label="分享标题" prop="title"> <!-- <el-form-item label="分享标题" prop="title">
<el-input v-model="ruleForm.title"></el-input> <el-input v-model="ruleForm.title"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="分享图片" prop="titleUrl"> <el-form-item label="分享图片" prop="titleUrl">
@ -262,13 +262,13 @@
/> />
<i v-if="!this.ruleForm.titleUrl" class="el-icon-plus"></i> <i v-if="!this.ruleForm.titleUrl" class="el-icon-plus"></i>
</el-upload> </el-upload>
</el-form-item> </el-form-item>-->
<el-form-item label="邀请二维码" prop="invitationCodeType"> <!-- <el-form-item label="邀请二维码" prop="invitationCodeType">
<el-radio-group v-model="ruleForm.invitationCodeType"> <el-radio-group v-model="ruleForm.invitationCodeType">
<el-radio label="0">小程序码</el-radio> <el-radio label="0">小程序码</el-radio>
<el-radio label="1">参数二维码</el-radio> <el-radio label="1">参数二维码</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>-->
<!-- <el-form-item label="奖励显示" prop="rewardDisplay"> <!-- <el-form-item label="奖励显示" prop="rewardDisplay">
<el-radio-group v-model="ruleForm.rewardDisplay"> <el-radio-group v-model="ruleForm.rewardDisplay">
<el-radio label="0">优惠券总额</el-radio> <el-radio label="0">优惠券总额</el-radio>
@ -598,9 +598,9 @@ export default {
form: {}, form: {},
// //
rules: { rules: {
activePictureUrl: [ /*activePictureUrl: [
{ required: true, message: '必填项不能为空', trigger: 'blur' }, { required: true, message: '必填项不能为空', trigger: 'blur' },
], ],*/
inviterGiftType: [ inviterGiftType: [
{ required: true, message: '必填项不能为空', trigger: 'blur' }, { required: true, message: '必填项不能为空', trigger: 'blur' },
], ],
@ -610,9 +610,6 @@ export default {
growthValue: [ growthValue: [
{ required: true, message: '必填项不能为空', trigger: 'blur' }, { required: true, message: '必填项不能为空', trigger: 'blur' },
], ],
title: [
{ required: true, message: '必填项不能为空', trigger: 'blur' },
],
invitationCodeType:[ invitationCodeType:[
{ required: true, message: '必填项不能为空', trigger: 'blur' }, { required: true, message: '必填项不能为空', trigger: 'blur' },
], ],

View File

@ -172,7 +172,7 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
} }
} }
} }
activeConsumptionVO.setDuihuanTotaled(youhuiTed); activeConsumptionVO.setYouhuiTotaled(youhuiTed);
activeConsumptionVO.setDuihuanTotaled(duihuanTed); activeConsumptionVO.setDuihuanTotaled(duihuanTed);
return activeConsumptionVO; return activeConsumptionVO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());

View File

@ -39,6 +39,10 @@ public class ActiveNewlywedsVO {
private Integer points; private Integer points;
//赠送成长值 //赠送成长值
private Integer growthValue; private Integer growthValue;
private Integer youhuiTotal;
private Integer duihuanTotal;
private Integer youhuiTotaled;
private Integer duihuanTotaled;
//自定义规则 //自定义规则
private String remark; private String remark;
//新人有礼卡券列表 //新人有礼卡券列表

View File

@ -10,6 +10,7 @@ import com.fuint.business.marketingActivity.activeNewlyweds.dto.ActiveNewlywedsD
import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlyweds; import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlyweds;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* 新人有礼活动(ActiveNewlyweds)表服务接口 * 新人有礼活动(ActiveNewlyweds)表服务接口
@ -39,7 +40,7 @@ public interface ActiveNewlywedsService extends IService<ActiveNewlyweds> {
* @param id * @param id
* @return * @return
*/ */
ActiveNewlywedsVO getOneById(Serializable id); List<ActiveNewlywedsVO> getOneById(Serializable id);
ActiveNewlywedsVO getOneByStoreId(Serializable id); ActiveNewlywedsVO getOneByStoreId(Serializable id);
ActiveNewlywedsVO getOneByIdApplet(ActiveConsumption activeConsumption); ActiveNewlywedsVO getOneByIdApplet(ActiveConsumption activeConsumption);

View File

@ -18,6 +18,10 @@ import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecomme
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendChild; import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendChild;
import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendAppletVO; import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendAppletVO;
import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendVO; import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendVO;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.store.service.StoreService; import com.fuint.business.store.service.StoreService;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
@ -44,6 +48,10 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
private StoreService storeService; private StoreService storeService;
@Resource @Resource
private ActiveNewlywedsChildService activeNewlywedsChildService; private ActiveNewlywedsChildService activeNewlywedsChildService;
@Resource
private CardFavorableRecordService cardFavorableRecordService;
@Resource
private CardExchangeRecordService cardExchangeRecordService;
/** /**
* *
* @param activeNewlywedsDTO * @param activeNewlywedsDTO
@ -54,13 +62,13 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
boolean save = false; boolean save = false;
Integer storeId = TokenUtil.getNowAccountInfo().getStoreId(); Integer storeId = TokenUtil.getNowAccountInfo().getStoreId();
//根据店铺id查询 //根据店铺id查询
LambdaQueryWrapper<ActiveNewlyweds> lambdaQueryWrapper = new LambdaQueryWrapper<>(); /*LambdaQueryWrapper<ActiveNewlyweds> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,storeId); lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,storeId);
ActiveNewlyweds one = getOne(lambdaQueryWrapper); ActiveNewlyweds one = getOne(lambdaQueryWrapper);
if (ObjectUtils.isNotEmpty(one)){ if (ObjectUtils.isNotEmpty(one)){
activeNewlywedsDTO.setId(one.getId()); activeNewlywedsDTO.setId(one.getId());
save = updateOneById(activeNewlywedsDTO); save = updateOneById(activeNewlywedsDTO);
}else { }else {*/
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) { if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
activeNewlywedsDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId()); activeNewlywedsDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
activeNewlywedsDTO.setChainStoreId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId()); activeNewlywedsDTO.setChainStoreId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
@ -80,7 +88,7 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
return s; return s;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
save = activeNewlywedsChildService.saveBatch(list); save = activeNewlywedsChildService.saveBatch(list);
} //}
/* //获取当前店铺的id和连锁店id /* //获取当前店铺的id和连锁店id
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) { if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
activeNewlywedsDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId()); activeNewlywedsDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
@ -151,36 +159,81 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
* @return * @return
*/ */
@Override @Override
public ActiveNewlywedsVO getOneById(Serializable id) { public List<ActiveNewlywedsVO> getOneById(Serializable id) {
Integer storeId = TokenUtil.getNowAccountInfo().getStoreId(); Integer storeId = TokenUtil.getNowAccountInfo().getStoreId();
ActiveNewlywedsVO activeNewlywedsVO = new ActiveNewlywedsVO(); ArrayList<ActiveNewlywedsVO> activeNewlywedsVOS = new ArrayList<>();
activeNewlywedsVO.setCourtesyReward(new String[0]);
if (ObjectUtils.isNotEmpty(storeId)){ if (ObjectUtils.isNotEmpty(storeId)){
//获取新人有礼活动信息 //获取新人有礼活动信息
LambdaQueryWrapper<ActiveNewlyweds> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ActiveNewlyweds> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,TokenUtil.getNowAccountInfo().getStoreId()); lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,TokenUtil.getNowAccountInfo().getStoreId());
ActiveNewlyweds activeNewlyweds = getOne(lambdaQueryWrapper); //ActiveNewlyweds activeNewlyweds = getOne(lambdaQueryWrapper);
List<ActiveNewlyweds> list = list(lambdaQueryWrapper);
//获取兑换物品信息 //获取兑换物品信息
if (ObjectUtils.isNotEmpty(activeNewlyweds)){ if (CollectionUtils.isNotEmpty(list)){
LambdaQueryWrapper<ActiveNewlywedsChild> queryWrapper = new LambdaQueryWrapper<>(); for (ActiveNewlyweds activeNewlyweds : list) {
queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlyweds.getId()); int youhuiTed = 0;
queryWrapper.orderByDesc(ActiveNewlywedsChild::getCreateTime); int duihuanTed = 0;
List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlywedsChildService.list(queryWrapper); ActiveNewlywedsVO activeNewlywedsVO = new ActiveNewlywedsVO();
BeanUtils.copyProperties(activeNewlyweds,activeNewlywedsVO); activeNewlywedsVO.setCourtesyReward(new String[0]);
//封装VO返回 if (ObjectUtils.isNotEmpty(activeNewlyweds)){
activeNewlywedsVO.setCourtesyReward(activeNewlyweds.getCourtesyReward().split(",")); LambdaQueryWrapper<ActiveNewlywedsChild> queryWrapper = new LambdaQueryWrapper<>();
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlyweds.getId());
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList); queryWrapper.orderByDesc(ActiveNewlywedsChild::getCreateTime);
}else { List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlywedsChildService.list(queryWrapper);
ArrayList<ActiveNewlywedsChild> activeNewlywedsChildLists = new ArrayList<>(); for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsChildList) {
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildLists); //优惠券
if (activeNewlywedsChild.getActiveGift().equals("1")){
LambdaQueryWrapper<CardFavorableRecord> queryWrappers = new LambdaQueryWrapper<>();
queryWrappers.eq(CardFavorableRecord::getActiveId,activeNewlywedsChild.getActiveNewlywedsId());
queryWrappers.eq(CardFavorableRecord::getCardFavorableId,activeNewlywedsChild.getVouchersId());
List<CardFavorableRecord> lists = cardFavorableRecordService.list(queryWrappers);
activeNewlywedsVO.setYouhuiTotal(list.size());
for (CardFavorableRecord cardFavorableRecord : lists) {
if (cardFavorableRecord.getStatus().equals("1")){
youhuiTed+=1;
}
}
}
//兑换券
if (activeNewlywedsChild.getActiveGift().equals("2")){
LambdaQueryWrapper<CardExchangeRecord> queryWrapperss = new LambdaQueryWrapper<>();
queryWrapperss.eq(CardExchangeRecord::getActiveId,activeNewlywedsChild.getActiveNewlywedsId());
queryWrapperss.eq(CardExchangeRecord::getCardExchangeId,activeNewlywedsChild.getVouchersId());
List<CardExchangeRecord> lisst = cardExchangeRecordService.list(queryWrapperss);
activeNewlywedsVO.setDuihuanTotal(list.size());
for (CardExchangeRecord cardExchangeRecord : lisst) {
if (cardExchangeRecord.getStatus().equals("1")){
duihuanTed+=1;
}
}
}
}
BeanUtils.copyProperties(activeNewlyweds,activeNewlywedsVO);
//封装VO返回
activeNewlywedsVO.setCourtesyReward(activeNewlyweds.getCourtesyReward().split(","));
activeNewlywedsVO.setYouhuiTotaled(youhuiTed);
activeNewlywedsVO.setDuihuanTotaled(duihuanTed);
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList);
activeNewlywedsVOS.add(activeNewlywedsVO);
}else {
ArrayList<ActiveNewlywedsChild> activeNewlywedsChildLists = new ArrayList<>();
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildLists);
activeNewlywedsVOS.add(activeNewlywedsVO);
}
}else {
ArrayList<ActiveNewlywedsChild> activeNewlywedsChildList = new ArrayList<>();
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList);
activeNewlywedsVO.setDuihuanTotaled(youhuiTed);
activeNewlywedsVO.setDuihuanTotaled(duihuanTed);
activeNewlywedsVO.setDuihuanTotal(0);
activeNewlywedsVO.setDuihuanTotal(0);
activeNewlywedsVOS.add(activeNewlywedsVO);
}
} }
}else {
ArrayList<ActiveNewlywedsChild> activeNewlywedsChildList = new ArrayList<>();
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList);
} }
} }
return activeNewlywedsVO; return activeNewlywedsVOS;
} }
/** /**

View File

@ -30,6 +30,8 @@ public class ActiveRecommend extends Model<ActiveRecommend> {
private String activePictureUrl; private String activePictureUrl;
//邀请人获得 0优惠券 1兑换券 2成长值 3积分 //邀请人获得 0优惠券 1兑换券 2成长值 3积分
private String inviterGiftType; private String inviterGiftType;
private String activeNewName;
private Integer activeNewId;
//赠送积分 //赠送积分
private Integer points; private Integer points;
//赠送成长值 //赠送成长值

View File

@ -8,6 +8,7 @@ import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendAp
import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendVO; import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendVO;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* 推荐有礼表(ActiveRecommend)表服务接口 * 推荐有礼表(ActiveRecommend)表服务接口
@ -29,7 +30,7 @@ public interface ActiveRecommendService extends IService<ActiveRecommend> {
* @param id * @param id
* @return * @return
*/ */
ActiveRecommendVO getOneById(Serializable id); List<ActiveRecommendVO> getOneById(Serializable id);
ActiveRecommendVO getOneByIdApplet(ActiveConsumption activeConsumption); ActiveRecommendVO getOneByIdApplet(ActiveConsumption activeConsumption);
/** /**

View File

@ -12,6 +12,10 @@ import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecomm
import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendService; import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendService;
import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendAppletVO; import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendAppletVO;
import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendVO; import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendVO;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService; import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
import com.fuint.business.store.service.StoreService; import com.fuint.business.store.service.StoreService;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
@ -42,6 +46,10 @@ public class ActiveRecommendServiceImpl extends ServiceImpl<ActiveRecommendMappe
private ActiveRecommendChildService activeRecommendChildService; private ActiveRecommendChildService activeRecommendChildService;
@Resource @Resource
private CardFavorableService cardFavorableService; private CardFavorableService cardFavorableService;
@Resource
private CardFavorableRecordService cardFavorableRecordService;
@Resource
private CardExchangeRecordService cardExchangeRecordService;
/** /**
* 新增数据 * 新增数据
* @param activeRecommendDTO * @param activeRecommendDTO
@ -53,13 +61,13 @@ public class ActiveRecommendServiceImpl extends ServiceImpl<ActiveRecommendMappe
boolean save = false; boolean save = false;
Integer storeId = TokenUtil.getNowAccountInfo().getStoreId(); Integer storeId = TokenUtil.getNowAccountInfo().getStoreId();
//根据店铺id查询 //根据店铺id查询
LambdaQueryWrapper<ActiveRecommend> lambdaQueryWrapper = new LambdaQueryWrapper<>(); /* LambdaQueryWrapper<ActiveRecommend> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ActiveRecommend::getStoreId,storeId); lambdaQueryWrapper.eq(ActiveRecommend::getStoreId,storeId);
ActiveRecommend one = getOne(lambdaQueryWrapper); ActiveRecommend one = getOne(lambdaQueryWrapper);
if (ObjectUtils.isNotEmpty(one)){ if (ObjectUtils.isNotEmpty(one)){
activeRecommendDTO.setId(one.getId()); activeRecommendDTO.setId(one.getId());
save = updateOneById(activeRecommendDTO); save = updateOneById(activeRecommendDTO);
}else { }else {*/
//获取当前店铺的id和连锁店id //获取当前店铺的id和连锁店id
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) { if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
activeRecommendDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId()); activeRecommendDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
@ -84,7 +92,7 @@ public class ActiveRecommendServiceImpl extends ServiceImpl<ActiveRecommendMappe
}).collect(Collectors.toList()); }).collect(Collectors.toList());
save = activeRecommendChildService.saveBatch(list); save = activeRecommendChildService.saveBatch(list);
} }
} //}
return save; return save;
} }
@ -94,42 +102,86 @@ public class ActiveRecommendServiceImpl extends ServiceImpl<ActiveRecommendMappe
* @return * @return
*/ */
@Override @Override
public ActiveRecommendVO getOneById(Serializable id) { public List<ActiveRecommendVO> getOneById(Serializable id) {
Integer storeId = TokenUtil.getNowAccountInfo().getStoreId(); Integer storeId = TokenUtil.getNowAccountInfo().getStoreId();
ActiveRecommendVO activeRecommendVO = new ActiveRecommendVO(); ArrayList<ActiveRecommendVO> activeRecommendVOS = new ArrayList<>();
activeRecommendVO.setInviterGiftType(new String[0]);
if (ObjectUtils.isNotEmpty(storeId)){ if (ObjectUtils.isNotEmpty(storeId)){
//获取新人有礼活动信息 //获取新人有礼活动信息
LambdaQueryWrapper<ActiveRecommend> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ActiveRecommend> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ActiveRecommend::getStoreId,TokenUtil.getNowAccountInfo().getStoreId()); lambdaQueryWrapper.eq(ActiveRecommend::getStoreId,TokenUtil.getNowAccountInfo().getStoreId());
ActiveRecommend activeRecommend = getOne(lambdaQueryWrapper); //ActiveRecommend activeRecommend = getOne(lambdaQueryWrapper);
//获取兑换物品信息 List<ActiveRecommend> list = list(lambdaQueryWrapper);
if (ObjectUtils.isNotEmpty(activeRecommend)){ for (ActiveRecommend activeRecommend : list) {
LambdaQueryWrapper<ActiveRecommendChild> queryWrapper = new LambdaQueryWrapper<>(); int youhuiTed = 0;
queryWrapper.eq(ActiveRecommendChild::getActiveRecommendId,activeRecommend.getId()); int duihuanTed = 0;
queryWrapper.orderByDesc(ActiveRecommendChild::getCreateTime); ActiveRecommendVO activeRecommendVO = new ActiveRecommendVO();
List<ActiveRecommendChild> activeRecommendChildList = activeRecommendChildService.list(queryWrapper); activeRecommendVO.setInviterGiftType(new String[0]);
BeanUtils.copyProperties(activeRecommend,activeRecommendVO); //获取兑换物品信息
activeRecommendVO.setInviterGiftType(activeRecommend.getInviterGiftType().split(",")); if (ObjectUtils.isNotEmpty(activeRecommend)){
if (CollectionUtils.isNotEmpty(activeRecommendChildList)){ LambdaQueryWrapper<ActiveRecommendChild> queryWrapper = new LambdaQueryWrapper<>();
activeRecommendVO.setActiveRecommendChildList(activeRecommendChildList); queryWrapper.eq(ActiveRecommendChild::getActiveRecommendId,activeRecommend.getId());
queryWrapper.orderByDesc(ActiveRecommendChild::getCreateTime);
List<ActiveRecommendChild> activeRecommendChildList = activeRecommendChildService.list(queryWrapper);
for (ActiveRecommendChild activeRecommendChild : activeRecommendChildList) {
//优惠券
if (activeRecommendChild.getActiveGift().equals("1")){
LambdaQueryWrapper<CardFavorableRecord> queryWrappers = new LambdaQueryWrapper<>();
queryWrappers.eq(CardFavorableRecord::getActiveId,activeRecommendChild.getActiveRecommendId());
queryWrappers.eq(CardFavorableRecord::getCardFavorableId,activeRecommendChild.getVouchersId());
List<CardFavorableRecord> lists = cardFavorableRecordService.list(queryWrappers);
activeRecommendVO.setYouhuiTotal(list.size());
for (CardFavorableRecord cardFavorableRecord : lists) {
if (cardFavorableRecord.getStatus().equals("1")){
youhuiTed+=1;
}
}
}
//兑换券
if (activeRecommendChild.getActiveGift().equals("2")){
LambdaQueryWrapper<CardExchangeRecord> queryWrapperss = new LambdaQueryWrapper<>();
queryWrapperss.eq(CardExchangeRecord::getActiveId,activeRecommendChild.getActiveRecommendId());
queryWrapperss.eq(CardExchangeRecord::getCardExchangeId,activeRecommendChild.getVouchersId());
List<CardExchangeRecord> lisst = cardExchangeRecordService.list(queryWrapperss);
activeRecommendVO.setDuihuanTotal(list.size());
for (CardExchangeRecord cardExchangeRecord : lisst) {
if (cardExchangeRecord.getStatus().equals("1")){
duihuanTed+=1;
}
}
}
}
BeanUtils.copyProperties(activeRecommend,activeRecommendVO);
activeRecommendVO.setInviterGiftType(activeRecommend.getInviterGiftType().split(","));
activeRecommendVO.setYouhuiTotaled(youhuiTed);
activeRecommendVO.setDuihuanTotaled(duihuanTed);
if (CollectionUtils.isNotEmpty(activeRecommendChildList)){
activeRecommendVO.setActiveRecommendChildList(activeRecommendChildList);
activeRecommendVOS.add(activeRecommendVO);
}else {
ArrayList<ActiveRecommendChild> activeRecommendChildren = new ArrayList<>();
activeRecommendVO.setActiveRecommendChildList(activeRecommendChildren);
activeRecommendVOS.add(activeRecommendVO);
}
}else { }else {
ArrayList<ActiveRecommendChild> activeRecommendChildren = new ArrayList<>(); ArrayList<ActiveRecommendChild> activeRecommendChildren = new ArrayList<>();
activeRecommendVO.setActiveRecommendChildList(activeRecommendChildren); activeRecommendVO.setActiveRecommendChildList(activeRecommendChildren);
activeRecommendVO.setDuihuanTotaled(youhuiTed);
activeRecommendVO.setDuihuanTotaled(duihuanTed);
activeRecommendVO.setDuihuanTotal(0);
activeRecommendVO.setDuihuanTotal(0);
activeRecommendVOS.add(activeRecommendVO);
} }
}else {
ArrayList<ActiveRecommendChild> activeRecommendChildren = new ArrayList<>();
activeRecommendVO.setActiveRecommendChildList(activeRecommendChildren);
} }
} }
return activeRecommendVO; return activeRecommendVOS;
} }
/** /**
* 通过店铺id查询单条数据(小程序端) * 通过店铺id查询单条数据(小程序端)
* @param id * @param activeConsumption
* @return * @return
*/ */
@Override @Override

View File

@ -42,6 +42,10 @@ public class ActiveRecommendVO extends Model<ActiveRecommendVO> {
private String invitationCodeType; private String invitationCodeType;
//奖励显示 0优惠券 1成长值总额 2积分总额 //奖励显示 0优惠券 1成长值总额 2积分总额
private String rewardDisplay; private String rewardDisplay;
private Integer youhuiTotal;
private Integer duihuanTotal;
private Integer youhuiTotaled;
private Integer duihuanTotaled;
//活动规则 //活动规则
private String activeRule; private String activeRule;
//活动状态 0进行中 1 待生效 2已结束 //活动状态 0进行中 1 待生效 2已结束

View File

@ -24,6 +24,7 @@ public class CardExchange extends Model<CardExchange> {
private Integer id; private Integer id;
//所属连锁店id //所属连锁店id
private Integer chainStorId; private Integer chainStorId;
private Integer giftId;
//所属店铺id //所属店铺id
private Integer storeId; private Integer storeId;
//是否在线 0在线 1 下线 //是否在线 0在线 1 下线

View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.convenienceSore.entity.LJGoods;
import com.fuint.business.convenienceSore.service.LJGoodsService;
import com.fuint.business.marketingActivity.cardExchange.mapper.CardExchangeMapper; import com.fuint.business.marketingActivity.cardExchange.mapper.CardExchangeMapper;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange; import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange;
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeService; import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeService;
@ -11,6 +13,7 @@ import com.fuint.business.store.service.StoreService;
import com.fuint.common.util.CryptoUtils; import com.fuint.common.util.CryptoUtils;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -27,6 +30,8 @@ public class CardExchangeServiceImpl extends ServiceImpl<CardExchangeMapper, Car
@Resource @Resource
private StoreService storeService; private StoreService storeService;
@Autowired
private LJGoodsService goodsService;
/** /**
* 新增数据 * 新增数据
* @param cardExchange * @param cardExchange
@ -49,6 +54,9 @@ public class CardExchangeServiceImpl extends ServiceImpl<CardExchangeMapper, Car
cardExchange.setQrCodeLink(qr_code_link); cardExchange.setQrCodeLink(qr_code_link);
String secretKey = "sQPoC/1do9BZMkg8I5c09A=="; String secretKey = "sQPoC/1do9BZMkg8I5c09A==";
CryptoUtils.encryptSymmetrically(secretKey, null,cardExchange.getQrCodeLink(), CryptoUtils.Algorithm.Encryption.AES_ECB_PKCS5); CryptoUtils.encryptSymmetrically(secretKey, null,cardExchange.getQrCodeLink(), CryptoUtils.Algorithm.Encryption.AES_ECB_PKCS5);
Integer giftId = cardExchange.getGiftId();
LJGoods ljGoods = goodsService.selectLJGoodsById(giftId);
cardExchange.setGiftName(ljGoods.getName());
return save(cardExchange); return save(cardExchange);
} }

View File

@ -12,6 +12,7 @@ public class CardValueRecordDTO extends CardValueRecord {
private String obtain; private String obtain;
private String authCode; private String authCode;
private Double realyPayBills; private Double realyPayBills;
private Double balance;
//付款类型 1.微信 2.支付宝 //付款类型 1.微信 2.支付宝
private String payType; private String payType;
private String oilName; private String oilName;
@ -23,6 +24,7 @@ public class CardValueRecordDTO extends CardValueRecord {
private String appltType; private String appltType;
private String paymentType; private String paymentType;
private String payStatus; private String payStatus;
private String types;
// /** // /**
// * 会员id // * 会员id

View File

@ -150,9 +150,34 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
//会员信息 //会员信息
LJUserVo ljUserVo = ljUserMapper.queryUserByChainStoreId(nowAccountInfo.getId(),store.getChainStoreId()); LJUserVo ljUserVo = ljUserMapper.queryUserByChainStoreId(nowAccountInfo.getId(),store.getChainStoreId());
//员工信息 //员工信息
LJStaff ljStaff = mtStaffService.selectStaffById(cardValueRecordDTO.getMtStaffId()); LJStaff ljStaff = new LJStaff();
if(ObjectUtils.isNotEmpty(cardValueRecordDTO.getMtStaffId())){
ljStaff = mtStaffService.selectStaffById(cardValueRecordDTO.getMtStaffId());
}
CardValueVO cardValue = new CardValueVO();
//自定义
if (ObjectUtils.isNotEmpty(cardValueRecordDTO.getTypes()) && cardValueRecordDTO.getTypes().equals("1")){
cardValueOrders.setRechargeType("1");
cardValueOrders.setBidBalance(cardValueRecordDTO.getBalance());
cardValueOrders.setRechargeBalance(cardValueRecordDTO.getBalance());
}else {
//查询储值卡信息
cardValue = cardValueService.getOneById(cardValueRecordDTO.getId());
cardValueOrders.setCardValueId(cardValue.getId());
cardValueOrders.setRechargeType("0");
cardValueOrders.setBidBalance(cardValue.getBidBalance());
cardValueOrders.setRechargeBalance(cardValue.getRechargeBalance());
if (ObjectUtils.isNotEmpty(cardValue.getGiftBalance())){
cardValueOrders.setGiftBalance(cardValue.getGiftBalance());
}
cardValueOrders.setPoints(cardValue.getPoints());
cardValueOrders.setGrowthValue(cardValue.getGrowthValue());
if (ObjectUtils.isNotEmpty(cardValue.getFringeBenefit())){
cardValueOrders.setFringeBenefit(cardValue.getFringeBenefit());
}
}
//查询储值卡信息 //查询储值卡信息
CardValueVO cardValue = cardValueService.getOneById(cardValueRecordDTO.getId()); /* CardValueVO cardValue = cardValueService.getOneById(cardValueRecordDTO.getId());
cardValueOrders.setCardValueId(cardValue.getId()); cardValueOrders.setCardValueId(cardValue.getId());
cardValueOrders.setRechargeType("0"); cardValueOrders.setRechargeType("0");
cardValueOrders.setBidBalance(cardValue.getBidBalance()); cardValueOrders.setBidBalance(cardValue.getBidBalance());
@ -164,7 +189,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardValueOrders.setGrowthValue(cardValue.getGrowthValue()); cardValueOrders.setGrowthValue(cardValue.getGrowthValue());
if (ObjectUtils.isNotEmpty(cardValue.getFringeBenefit())){ if (ObjectUtils.isNotEmpty(cardValue.getFringeBenefit())){
cardValueOrders.setFringeBenefit(cardValue.getFringeBenefit()); cardValueOrders.setFringeBenefit(cardValue.getFringeBenefit());
} }*/
//优惠券优惠金额 //优惠券优惠金额
if (ObjectUtils.isNotEmpty(cardValueRecordDTO.getCardFavorableId())){ if (ObjectUtils.isNotEmpty(cardValueRecordDTO.getCardFavorableId())){
CardFavorable cardFavorable = cardFavorableService.getById(cardValueRecordDTO.getCardFavorableId()); CardFavorable cardFavorable = cardFavorableService.getById(cardValueRecordDTO.getCardFavorableId());
@ -190,9 +215,11 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardValueOrders.setName(ljUserVo.getName()); cardValueOrders.setName(ljUserVo.getName());
cardValueOrders.setMobile(ljUserVo.getMobile()); cardValueOrders.setMobile(ljUserVo.getMobile());
//员工信息 //员工信息
cardValueOrders.setStaffId(ljStaff.getId()); if (ObjectUtils.isNotEmpty(ljStaff)){
cardValueOrders.setRealName(ljStaff.getRealName()); cardValueOrders.setStaffId(ljStaff.getId());
cardValueOrders.setStaffMobile(ljStaff.getMobile()); cardValueOrders.setRealName(ljStaff.getRealName());
cardValueOrders.setStaffMobile(ljStaff.getMobile());
}
//员工提成信息 //员工提成信息
if (ObjectUtils.isNotEmpty(cardValue.getRoyaltyType())){ if (ObjectUtils.isNotEmpty(cardValue.getRoyaltyType())){
cardValueOrders.setRoyaltyType(cardValue.getRoyaltyType()); cardValueOrders.setRoyaltyType(cardValue.getRoyaltyType());
@ -846,74 +873,81 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
//查询储值卡对应的优惠券列表 //查询储值卡对应的优惠券列表
List<CardFavorable> cardValueVouchers = getCardValueVouchers(cardValue); List<CardFavorable> cardValueVouchers = getCardValueVouchers(cardValue);
//送优惠券兑换券 //送优惠券兑换券
if (CollectionUtils.isNotEmpty(cardValueVouchers)) { if (cardValueOrders.getRechargeType().equals("1")){
for (CardFavorable cardValueVoucher : cardValueVouchers) { //会员等级充值送券
if (ObjectUtils.isNotEmpty(cardValueVoucher)){ giveCoupon(cardValueOrders.getMtUserId(),cardValueOrders.getStoreId(),ljUserVo,ljStaff);
cardValueOrders.setCardFavorableId(cardValueVoucher.getId()); }else {
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); if (CollectionUtils.isNotEmpty(cardValueVouchers)) {
cardFavorableRecord.setCardFavorableId(cardValueVoucher.getId()); for (CardFavorable cardValueVoucher : cardValueVouchers) {
cardFavorableRecord.setStoreId(cardValueOrders.getStoreId()); if (ObjectUtils.isNotEmpty(cardValueVoucher)){
cardFavorableRecord.setMtUserId(ljUserVo.getId()); cardValueOrders.setCardFavorableId(cardValueVoucher.getId());
cardFavorableRecord.setName(ljUserVo.getName()); CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
cardFavorableRecord.setMobile(ljUserVo.getMobile()); cardFavorableRecord.setCardFavorableId(cardValueVoucher.getId());
cardFavorableRecord.setStatus("0"); cardFavorableRecord.setStoreId(cardValueOrders.getStoreId());
cardFavorableRecord.setExchangeFrom("充值送券"); cardFavorableRecord.setMtUserId(ljUserVo.getId());
//优惠券开始结束时间 cardFavorableRecord.setName(ljUserVo.getName());
if (ObjectUtils.isNotEmpty(cardValueVoucher) && ObjectUtils.isNotEmpty(cardValueVoucher.getTimeType())) { cardFavorableRecord.setMobile(ljUserVo.getMobile());
if (cardValueVoucher.getTimeType().equals("0")) { cardFavorableRecord.setStatus("0");
LocalDate today = LocalDate.now(); cardFavorableRecord.setExchangeFrom("充值送券");
LocalDate localDate = today.plusDays(cardValueVoucher.getValidityZero()); //优惠券开始结束时间
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); if (ObjectUtils.isNotEmpty(cardValueVoucher) && ObjectUtils.isNotEmpty(cardValueVoucher.getTimeType())) {
cardFavorableRecord.setEndTime(from); if (cardValueVoucher.getTimeType().equals("0")) {
} else if (cardValueVoucher.getTimeType().equals("1")) { LocalDate today = LocalDate.now();
cardFavorableRecord.setStartTime(cardValueVoucher.getEffectiveDate()); LocalDate localDate = today.plusDays(cardValueVoucher.getValidityZero());
LocalDate today = LocalDate.now(); Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
LocalDate localDate = today.plusDays(cardValueVoucher.getValidityOne()); cardFavorableRecord.setEndTime(from);
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); } else if (cardValueVoucher.getTimeType().equals("1")) {
cardFavorableRecord.setEndTime(from); cardFavorableRecord.setStartTime(cardValueVoucher.getEffectiveDate());
} else { LocalDate today = LocalDate.now();
LocalDate today = LocalDate.now(); LocalDate localDate = today.plusDays(cardValueVoucher.getValidityOne());
LocalDate localDate = today.plusDays(cardValueVoucher.getValidityTwo()); Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
LocalDate localDates = today.plusDays(Integer.parseInt(cardValueVoucher.getValidityDay())); cardFavorableRecord.setEndTime(from);
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); } else {
Date froms = Date.from(localDates.atStartOfDay(ZoneId.systemDefault()).toInstant()); LocalDate today = LocalDate.now();
cardFavorableRecord.setStartTime(froms); LocalDate localDate = today.plusDays(cardValueVoucher.getValidityTwo());
cardFavorableRecord.setEndTime(from); LocalDate localDates = today.plusDays(Integer.parseInt(cardValueVoucher.getValidityDay()));
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
Date froms = Date.from(localDates.atStartOfDay(ZoneId.systemDefault()).toInstant());
cardFavorableRecord.setStartTime(froms);
cardFavorableRecord.setEndTime(from);
}
} }
cardFavorableRecordService.save(cardFavorableRecord);
} }
cardFavorableRecordService.save(cardFavorableRecord);
}
/* /*
if (cardValue.getRechargeBalance() >= cardValueVoucher.getSatisfiedAmount()) { if (cardValue.getRechargeBalance() >= cardValueVoucher.getSatisfiedAmount()) {
cardFavorableValue += cardValueVoucher.getDiscountAmount(); cardFavorableValue += cardValueVoucher.getDiscountAmount();
}*/ }*/
}
}
//查询储值卡对应的兑换券列表
List<CardExchange> cardExchangeVouchers = getCardExchangeVouchers(cardValue);
if (CollectionUtils.isNotEmpty(cardExchangeVouchers)){
for (CardExchange cardExchangeVoucher : cardExchangeVouchers) {
if (ObjectUtils.isNotEmpty(cardExchangeVoucher)){
CardExchangeRecord cardExchangeRecord = new CardExchangeRecord();
cardValueOrders.setCardExchangeId(cardExchangeVoucher.getId());
cardExchangeRecord.setCardExchangeId(cardExchangeVoucher.getId());
cardExchangeRecord.setStoreId(cardValueOrders.getStoreId());
cardExchangeRecord.setMtUserId(ljUserVo.getId());
cardExchangeRecord.setName(ljUserVo.getName());
cardExchangeRecord.setMobile(ljUserVo.getMobile());
cardExchangeRecord.setPhoto(ljUserVo.getAvatar());
cardExchangeRecord.setMtStaffId(ljStaff.getId());
cardExchangeRecord.setRealName(ljStaff.getRealName());
cardExchangeRecord.setStaffMobile(ljStaff.getMobile());
cardExchangeRecord.setStatus("0");
cardExchangeRecord.setExchangeFrom("充值送券");
cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord);
} }
} }
//查询储值卡对应的兑换券列表
List<CardExchange> cardExchangeVouchers = getCardExchangeVouchers(cardValue);
if (CollectionUtils.isNotEmpty(cardExchangeVouchers)){
for (CardExchange cardExchangeVoucher : cardExchangeVouchers) {
if (ObjectUtils.isNotEmpty(cardExchangeVoucher)){
CardExchangeRecord cardExchangeRecord = new CardExchangeRecord();
cardValueOrders.setCardExchangeId(cardExchangeVoucher.getId());
cardExchangeRecord.setCardExchangeId(cardExchangeVoucher.getId());
cardExchangeRecord.setStoreId(cardValueOrders.getStoreId());
cardExchangeRecord.setMtUserId(ljUserVo.getId());
cardExchangeRecord.setName(ljUserVo.getName());
cardExchangeRecord.setMobile(ljUserVo.getMobile());
cardExchangeRecord.setPhoto(ljUserVo.getAvatar());
cardExchangeRecord.setMtStaffId(ljStaff.getId());
cardExchangeRecord.setRealName(ljStaff.getRealName());
cardExchangeRecord.setStaffMobile(ljStaff.getMobile());
cardExchangeRecord.setStatus("0");
cardExchangeRecord.setExchangeFrom("充值送券");
cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord);
}
}
}
//会员等级充值送券
giveCoupon(cardValueOrders.getMtUserId(),cardValueOrders.getStoreId(),ljUserVo,ljStaff);
} }
//会员等级充值送券
giveCoupon(cardValueOrders.getMtUserId(),cardValueOrders.getStoreId(),ljUserVo,ljStaff);
//生成充值记录 //生成充值记录

View File

@ -30,8 +30,10 @@ import java.util.Map;
@Service @Service
public class LJUserGradeServiceImpl extends ServiceImpl<LJUserGradeMapper, LJUserGrade> implements LJUserGradeService { public class LJUserGradeServiceImpl extends ServiceImpl<LJUserGradeMapper, LJUserGrade> implements LJUserGradeService {
@Autowired @Autowired
@Lazy
private ILJStoreService storeService; private ILJStoreService storeService;
@Autowired @Autowired
@Lazy
private MtUserGradeChildService userGradeChildService; private MtUserGradeChildService userGradeChildService;
@Override @Override

View File

@ -3,22 +3,38 @@ package com.fuint.business.userManager.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.userManager.entity.ChainStoreConfig;
import com.fuint.business.userManager.entity.LJUserGrade;
import com.fuint.business.userManager.entity.MtUserGradeChild; import com.fuint.business.userManager.entity.MtUserGradeChild;
import com.fuint.business.userManager.mapper.MtUserGradeChildMapper; import com.fuint.business.userManager.mapper.MtUserGradeChildMapper;
import com.fuint.business.userManager.service.ChainStoreConfigService;
import com.fuint.business.userManager.service.LJUserGradeService;
import com.fuint.business.userManager.service.LJUserService; import com.fuint.business.userManager.service.LJUserService;
import com.fuint.business.userManager.service.MtUserGradeChildService; import com.fuint.business.userManager.service.MtUserGradeChildService;
import com.fuint.business.userManager.vo.LJUserVo; import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.util.StringUtils;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Service @Service
public class MtUserGradeChildServiceImpl extends ServiceImpl<MtUserGradeChildMapper,MtUserGradeChild> implements MtUserGradeChildService { public class MtUserGradeChildServiceImpl extends ServiceImpl<MtUserGradeChildMapper,MtUserGradeChild> implements MtUserGradeChildService {
@Autowired @Autowired
@Lazy @Lazy
private LJUserService userService; private LJUserService userService;
@Autowired
private ILJStoreService storeService;
@Autowired
@Lazy
private ChainStoreConfigService chainStoreConfigService;
@Resource
private LJUserGradeService ljUserGradeService;
@Override @Override
public List<MtUserGradeChild> selectListByGradeId(Integer gradeId) { public List<MtUserGradeChild> selectListByGradeId(Integer gradeId) {
@ -30,9 +46,22 @@ public class MtUserGradeChildServiceImpl extends ServiceImpl<MtUserGradeChildMap
@Override @Override
public List<MtUserGradeChild> selectListByUserId(Integer userId,Integer storeId) { public List<MtUserGradeChild> selectListByUserId(Integer userId,Integer storeId) {
LJUserVo userVo = userService.queryUserById(userId, storeId); LJUserVo userVo = userService.queryUserById(userId, storeId);
QueryWrapper queryWrapper = new QueryWrapper<>(); LJStore store = storeService.selectStoreById();
queryWrapper.eq("user_grade_id",userVo.getGradeId()); ChainStoreConfig chainStoreConfig = chainStoreConfigService.selectChainStoreById(store.getChainStoreId());
return baseMapper.selectList(queryWrapper); String isEnableLevel = chainStoreConfig.getIsEnableLevel();
if (isEnableLevel.equals("yes")){
if (ObjectUtil.isNotEmpty(userVo.getGradeId())){
LJUserGrade ljUserGrade = ljUserGradeService.selectUserGradeById(userVo.getGradeId());
if (!ljUserGrade.getIfRechargeCoupon().equals("1")){
return new ArrayList<MtUserGradeChild>();
}
}else{
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_grade_id",userVo.getGradeId());
return baseMapper.selectList(queryWrapper);
}
}
return new ArrayList<MtUserGradeChild>();
} }
@Override @Override