diff --git a/fuintAdmin/src/views/EventMarketing/Writeoffrecords/index.vue b/fuintAdmin/src/views/EventMarketing/Writeoffrecords/index.vue index 6be83fd82..72d283a14 100644 --- a/fuintAdmin/src/views/EventMarketing/Writeoffrecords/index.vue +++ b/fuintAdmin/src/views/EventMarketing/Writeoffrecords/index.vue @@ -28,12 +28,12 @@ /> - + 搜索 @@ -62,9 +62,9 @@ - + - + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java index b4a538567..894d44575 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java @@ -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); } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java index 922059183..9143c2fe7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java @@ -40,6 +40,7 @@ public interface ActiveNewlywedsService extends IService { * @return */ ActiveNewlywedsVO getOneById(Serializable id); + ActiveNewlywedsVO getOneByStoreId(Serializable id); ActiveNewlywedsVO getOneByIdApplet(ActiveConsumption activeConsumption); /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsRecordsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsRecordsServiceImpl.java index db9a238ce..21f8a889c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsRecordsServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsRecordsServiceImpl.java @@ -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 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; } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java index 7d0b740ad..2b00d6c27 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java @@ -183,6 +183,43 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,id); + ActiveNewlyweds activeNewlyweds = getOne(lambdaQueryWrapper); + //获取兑换物品信息 + if (ObjectUtils.isNotEmpty(activeNewlyweds)){ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlyweds.getId()); + queryWrapper.orderByDesc(ActiveNewlywedsChild::getCreateTime); + List activeNewlywedsChildList = activeNewlywedsChildService.list(queryWrapper); + BeanUtils.copyProperties(activeNewlyweds,activeNewlywedsVO); + //封装VO返回 + activeNewlywedsVO.setCourtesyReward(activeNewlyweds.getCourtesyReward().split(",")); + if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ + activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList); + }else { + ArrayList activeNewlywedsChildLists = new ArrayList<>(); + activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildLists); + } + }else { + ArrayList activeNewlywedsChildList = new ArrayList<>(); + activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList); + } + } + return activeNewlywedsVO; + } + /** * 通过店铺查询单条数据(小程序端) * @param activeConsumption diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/controller/CardExchangeRecordController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/controller/CardExchangeRecordController.java index c885a6aeb..75694a474 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/controller/CardExchangeRecordController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/controller/CardExchangeRecordController.java @@ -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)); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java index 857140129..6d62c1a2f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java @@ -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 i @Resource private StoreService storeService; + @Resource + private UserBalanceService userBalanceService; + @Resource + private LJUserMapper ljUserMapper; /** * 新增数据 @@ -148,6 +158,7 @@ public class CardGiftServiceImpl extends ServiceImpl i * @return */ @Override + @Transactional public CardGift exchange(CardGift cardGift) { //登录用户id Integer userId = TokenUtil.getNowAccountInfo().getId(); @@ -161,6 +172,17 @@ public class CardGiftServiceImpl extends ServiceImpl 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 i Integer userId = TokenUtil.getNowAccountInfo().getId(); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(CardGift::getUserId,userId); + queryWrapper.orderByDesc(CardGift::getUpdateTime); return page(page,queryWrapper); } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java index 9c19d659d..16889b9fa 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java @@ -772,6 +772,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl