修改bug
This commit is contained in:
parent
087b4ded03
commit
b5d5f6b1eb
@ -28,12 +28,12 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="isonline">
|
||||
<!-- <el-form-item label="" prop="isonline">
|
||||
<el-select v-model="queryParams.status" placeholder="是否使用">
|
||||
<el-option label="已使用" value="0"></el-option>
|
||||
<el-option label="未使用" value="1"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form-item>-->
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
@ -62,9 +62,9 @@
|
||||
<!-- <el-table-column label="员工id" align="center" prop="mtStaffId" />-->
|
||||
<!-- <el-table-column label="兑换券id" align="center" prop="cardExchangeId" />-->
|
||||
|
||||
<el-table-column label="id" align="center" prop="mtUserId" />
|
||||
<el-table-column label="序号" align="center" prop="mtUserId" />
|
||||
<el-table-column label="手机号码" align="center" prop="mobile" />
|
||||
<el-table-column label="名字" align="center" prop="name" />
|
||||
<el-table-column label="姓名" align="center" prop="name" />
|
||||
<el-table-column label="头像" align="center" prop="photo" />
|
||||
<el-table-column label="核销人手机号" align="center" prop="staffMobile" />
|
||||
<el-table-column label="核销人姓名" align="center" prop="realName" />
|
||||
|
@ -290,9 +290,6 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
||||
new Date().getTime() <= cardFavorable.getCreateTime().getTime() + Integer.parseInt(cardFavorable.getValidityDay()) * 86400000L + 86400000L * cardFavorable.getValidityTwo()) {
|
||||
BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO);
|
||||
}
|
||||
/*if (){
|
||||
|
||||
}*/
|
||||
exchangeFavorableVOArrayList.add(exchangeFavorableVO);
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ public interface ActiveNewlywedsService extends IService<ActiveNewlyweds> {
|
||||
* @return
|
||||
*/
|
||||
ActiveNewlywedsVO getOneById(Serializable id);
|
||||
ActiveNewlywedsVO getOneByStoreId(Serializable id);
|
||||
ActiveNewlywedsVO getOneByIdApplet(ActiveConsumption activeConsumption);
|
||||
|
||||
/**
|
||||
|
@ -14,11 +14,14 @@ import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRec
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRecordMapper;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
import com.fuint.business.userManager.service.LJUserService;
|
||||
import com.fuint.business.userManager.service.UserBalanceService;
|
||||
import com.fuint.business.userManager.vo.LJUserVo;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.sun.xml.bind.v2.TODO;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -43,6 +46,8 @@ public class ActiveNewlywedsRecordsServiceImpl extends ServiceImpl<ActiveNewlywe
|
||||
private CardExchangeRecordService cardExchangeRecordService;
|
||||
@Resource
|
||||
private LJUserService userService;
|
||||
@Resource
|
||||
private UserBalanceService userBalanceService;
|
||||
/**
|
||||
* 新增数据
|
||||
* @param activeNewlywedsRecords
|
||||
@ -57,48 +62,52 @@ public class ActiveNewlywedsRecordsServiceImpl extends ServiceImpl<ActiveNewlywe
|
||||
Integer userId = nowAccountInfo.getId();
|
||||
LJUserVo ljUserVo = userService.selectUserById(userId);
|
||||
//保存新人有礼记录
|
||||
ActiveNewlywedsVO activeNewlyweds = activeNewlywedsService.getOneById(1);
|
||||
ActiveNewlywedsVO activeNewlyweds = activeNewlywedsService.getOneByStoreId(activeNewlywedsRecords.getStoreId());
|
||||
activeNewlywedsRecords.setActiveNewlywedsId(activeNewlyweds.getId());
|
||||
activeNewlywedsRecords.setChainStoreId(nowAccountInfo.getChainStoreId());
|
||||
activeNewlywedsRecords.setStoreId(nowAccountInfo.getStoreId());
|
||||
activeNewlywedsRecords.setUserId(userId);
|
||||
save = save(activeNewlywedsRecords);
|
||||
//优惠券
|
||||
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
|
||||
List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlyweds.getActiveNewlywedsChildList();
|
||||
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
|
||||
for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsChildList) {
|
||||
if (activeNewlywedsChild.getActiveGift().equals("1")){
|
||||
cardFavorableRecord.setCardFavorableId(activeNewlywedsChild.getActiveNewlywedsId());
|
||||
cardFavorableRecord.setChainStorId(nowAccountInfo.getChainStoreId());
|
||||
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
|
||||
cardFavorableRecord.setCardFavorableId(activeNewlywedsChild.getVouchersId());
|
||||
cardFavorableRecord.setStoreId(nowAccountInfo.getStoreId());
|
||||
cardFavorableRecord.setMtUserId(userId);
|
||||
cardFavorableRecord.setMtUserId(ljUserVo.getId());
|
||||
cardFavorableRecord.setName(ljUserVo.getName());
|
||||
cardFavorableRecord.setMobile(ljUserVo.getMobile());
|
||||
cardFavorableRecord.setName(nowAccountInfo.getRealName());
|
||||
cardFavorableRecord.setStatus("0");
|
||||
cardFavorableRecord.setExchangeFrom("新人发券");
|
||||
save = cardFavorableRecordService.save(cardFavorableRecord);
|
||||
save = cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord);
|
||||
}else {
|
||||
//兑换券
|
||||
CardExchangeRecord cardExchangeRecord = new CardExchangeRecord();
|
||||
cardExchangeRecord.setCardExchangeId(activeNewlywedsChild.getActiveNewlywedsId());
|
||||
cardExchangeRecord.setChainStorId(nowAccountInfo.getChainStoreId());
|
||||
cardExchangeRecord.setCardExchangeId(activeNewlywedsChild.getVouchersId());
|
||||
cardExchangeRecord.setStoreId(nowAccountInfo.getStoreId());
|
||||
cardExchangeRecord.setMtUserId(userId);
|
||||
cardExchangeRecord.setMtUserId(ljUserVo.getId());
|
||||
cardExchangeRecord.setName(ljUserVo.getName());
|
||||
cardExchangeRecord.setMobile(ljUserVo.getMobile());
|
||||
cardExchangeRecord.setExchangeName(activeNewlywedsChild.getGiftCardName());
|
||||
cardExchangeRecord.setPhoto(ljUserVo.getAvatar());
|
||||
cardExchangeRecord.setStatus("0");
|
||||
cardExchangeRecord.setExchangeFrom("新人领券");
|
||||
cardExchangeRecord.setGiftName(activeNewlywedsChild.getGiftCardName());
|
||||
cardExchangeRecord.setDescription(activeNewlywedsChild.getGiftCardDetail());
|
||||
save = cardExchangeRecordService.save(cardExchangeRecord);
|
||||
save = cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord);
|
||||
}
|
||||
}
|
||||
//用户余额
|
||||
UserBalance userBalance = userBalanceService.selectUserBalance(userId,ljUserVo.getChainStoreId());
|
||||
//积分
|
||||
//成长值 TODO
|
||||
if (ObjectUtils.isNotEmpty(userBalance.getPoints()) && ObjectUtils.isNotEmpty(activeNewlyweds.getPoints())){
|
||||
userBalance.setPoints(userBalance.getPoints() + activeNewlyweds.getPoints());
|
||||
}
|
||||
//成长值
|
||||
if (ObjectUtils.isNotEmpty(userBalance.getGrowthValue()) && ObjectUtils.isNotEmpty(activeNewlyweds.getGrowthValue())){
|
||||
userBalance.setGrowthValue(userBalance.getGrowthValue() + activeNewlyweds.getGrowthValue());
|
||||
}
|
||||
userBalanceService.updateUserBalance(userBalance);
|
||||
}
|
||||
//
|
||||
|
||||
return save;
|
||||
}
|
||||
}
|
||||
|
@ -183,6 +183,43 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
|
||||
return activeNewlywedsVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过店铺查询单条数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ActiveNewlywedsVO getOneByStoreId(Serializable id) {
|
||||
ActiveNewlywedsVO activeNewlywedsVO = new ActiveNewlywedsVO();
|
||||
activeNewlywedsVO.setCourtesyReward(new String[0]);
|
||||
if (ObjectUtils.isNotEmpty(id)){
|
||||
//获取新人有礼活动信息
|
||||
LambdaQueryWrapper<ActiveNewlyweds> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,id);
|
||||
ActiveNewlyweds activeNewlyweds = getOne(lambdaQueryWrapper);
|
||||
//获取兑换物品信息
|
||||
if (ObjectUtils.isNotEmpty(activeNewlyweds)){
|
||||
LambdaQueryWrapper<ActiveNewlywedsChild> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlyweds.getId());
|
||||
queryWrapper.orderByDesc(ActiveNewlywedsChild::getCreateTime);
|
||||
List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlywedsChildService.list(queryWrapper);
|
||||
BeanUtils.copyProperties(activeNewlyweds,activeNewlywedsVO);
|
||||
//封装VO返回
|
||||
activeNewlywedsVO.setCourtesyReward(activeNewlyweds.getCourtesyReward().split(","));
|
||||
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
|
||||
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList);
|
||||
}else {
|
||||
ArrayList<ActiveNewlywedsChild> activeNewlywedsChildLists = new ArrayList<>();
|
||||
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildLists);
|
||||
}
|
||||
}else {
|
||||
ArrayList<ActiveNewlywedsChild> activeNewlywedsChildList = new ArrayList<>();
|
||||
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList);
|
||||
}
|
||||
}
|
||||
return activeNewlywedsVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过店铺查询单条数据(小程序端)
|
||||
* @param activeConsumption
|
||||
|
@ -4,6 +4,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.cardExchange.dto.CardExchangeRecordDTO;
|
||||
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
|
||||
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
|
||||
import com.fuint.business.member.entity.LJStaff;
|
||||
import com.fuint.business.member.service.ILJStaffService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -27,6 +31,8 @@ public class CardExchangeRecordController extends BaseController {
|
||||
*/
|
||||
@Resource
|
||||
private CardExchangeRecordService cardExchangeRecordService;
|
||||
@Resource
|
||||
private ILJStaffService iljStaffService;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
@ -104,6 +110,10 @@ public class CardExchangeRecordController extends BaseController {
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject update(@RequestBody CardExchangeRecord cardExchangeRecord) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
LJStaff ljStaff = iljStaffService.selectStaffById(nowAccountInfo.getStaffId());
|
||||
cardExchangeRecord.setRealName(ljStaff.getRealName());
|
||||
cardExchangeRecord.setStaffMobile(ljStaff.getMobile());
|
||||
return getSuccessResult(this.cardExchangeRecordService.updateById(cardExchangeRecord));
|
||||
}
|
||||
|
||||
|
@ -11,13 +11,19 @@ import com.fuint.business.marketingActivity.cardGift.service.CardGiftService;
|
||||
import com.fuint.business.oilDepotConfiguration.entity.OilDepotConfig;
|
||||
import com.fuint.business.oilDepotConfiguration.service.OilDepotConfigService;
|
||||
import com.fuint.business.store.service.StoreService;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
import com.fuint.business.userManager.mapper.LJUserMapper;
|
||||
import com.fuint.business.userManager.service.UserBalanceService;
|
||||
import com.fuint.business.userManager.vo.LJUserVo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@ -38,6 +44,10 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
|
||||
|
||||
@Resource
|
||||
private StoreService storeService;
|
||||
@Resource
|
||||
private UserBalanceService userBalanceService;
|
||||
@Resource
|
||||
private LJUserMapper ljUserMapper;
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
@ -148,6 +158,7 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public CardGift exchange(CardGift cardGift) {
|
||||
//登录用户id
|
||||
Integer userId = TokenUtil.getNowAccountInfo().getId();
|
||||
@ -161,6 +172,17 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
|
||||
one.setActivateStatus("1");
|
||||
one.setUserId(userId);
|
||||
updateById(one);
|
||||
//更新用户余额
|
||||
Double cardAmount = one.getCardAmount();
|
||||
//会员信息
|
||||
LJUserVo ljUserVo = ljUserMapper.selectUserById(userId);
|
||||
UserBalance userBalance = userBalanceService.selectUserBalance(userId,ljUserVo.getChainStoreId());
|
||||
Double cardBalance = userBalance.getCardBalance();
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(cardAmount);
|
||||
BigDecimal bigDecimal1 = BigDecimal.valueOf(cardBalance);
|
||||
BigDecimal add = bigDecimal1.add(bigDecimal);
|
||||
userBalance.setCardBalance(add.doubleValue());
|
||||
userBalanceService.updateUserBalance(userBalance);
|
||||
return one;
|
||||
}else {
|
||||
return cardGift;
|
||||
@ -179,6 +201,7 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
|
||||
Integer userId = TokenUtil.getNowAccountInfo().getId();
|
||||
LambdaQueryWrapper<CardGift> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CardGift::getUserId,userId);
|
||||
queryWrapper.orderByDesc(CardGift::getUpdateTime);
|
||||
return page(page,queryWrapper);
|
||||
}
|
||||
}
|
||||
|
@ -768,6 +768,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
||||
cardValueRecord.setAmountCommission(cardValueOrders.getAmountCommission());
|
||||
cardValueRecord.setPayStatus("paid");
|
||||
cardValueRecord.setStoreId(cardValueOrders.getStoreId());
|
||||
cardValueRecord.setChainStoreId(cardValueOrders.getChainStoreId());
|
||||
cardValueRecord.setPaymentNo(cardValueOrders.getOrderNo());
|
||||
save(cardValueRecord);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user