diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/MtUserFuelMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/MtUserFuelMapper.xml index 232ebbfbf..185792fcb 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/MtUserFuelMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/MtUserFuelMapper.xml @@ -3,7 +3,7 @@ @@ -15,6 +15,20 @@ #{item} + 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 cf0486636..a7df27c20 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 @@ -61,9 +61,12 @@ import com.fuint.business.order.service.GrowthValueChangeService; import com.fuint.business.storeInformation.entity.LJStore; import com.fuint.business.storeInformation.service.ILJStoreService; import com.fuint.business.userManager.entity.LJUserGrade; +import com.fuint.business.userManager.entity.MtUserFuel; import com.fuint.business.userManager.entity.MtUserGradeChild; import com.fuint.business.userManager.entity.UserBalance; import com.fuint.business.userManager.mapper.LJUserMapper; +import com.fuint.business.userManager.mapper.MtUserFuelMapper; +import com.fuint.business.userManager.service.IMtUserFuelService; import com.fuint.business.userManager.service.LJUserGradeService; import com.fuint.business.userManager.service.MtUserGradeChildService; import com.fuint.business.userManager.service.UserBalanceService; @@ -152,6 +155,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl m1 = new HashMap<>(); +// 根据油号 店铺id 用户id 锁定唯一囤油卡 + m1.put("mt_user_id",ljUserVo.getId()); + m1.put("store_id",ljUserVo.getStoreId()); + m1.put("oil_name",fuelDiesel.getOilNumberId()); + List userFuels = mtUserFuelMapper.selectByMap(m1); +// 没有油卡则新建 有则追加囤油升数 + if (CollectionUtil.isEmpty(userFuels)){ + mtUserFuel = new MtUserFuel(); + mtUserFuel.setMtUserId(ljUserVo.getId()); + mtUserFuel.setStoreId(nowAccountInfo.getStoreId()); + mtUserFuel.setChainStoreId(ljUserVo.getChainStoreId()); + mtUserFuel.setOilName(String.valueOf(fuelDiesel.getOilNumberId())); + mtUserFuel.setFuelAmount(0.0); + int insert = mtUserFuelMapper.insert(mtUserFuel); + }else { + mtUserFuel = userFuels.get(0); + } + + //囤油卡 CardFuelRecordDTO cardFuelRecordDTO =new CardFuelRecordDTO(); cardFuelRecordDTO.setCardFuelId(selectCard.getSelectCardId()); @@ -567,6 +596,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl { BigDecimal selectSumFuelAmountByMtUserId(@Param("mtUserId") Integer mtUserId); BigDecimal selectSumFuelAmountByStoreIds(@Param("storeIds") List storeIds); + + List selectUserFuelAndOilName(@Param("obj")LJUserVo userVo); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserServiceImpl.java index 63cc80da4..d140bdc72 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserServiceImpl.java @@ -26,9 +26,11 @@ import com.fuint.business.userGroup.entity.UserGroup; import com.fuint.business.userManager.entity.*; import com.fuint.business.userManager.mapper.LJUserMapper; import com.fuint.business.userManager.mapper.MtInvitationMapper; +import com.fuint.business.userManager.mapper.MtUserFuelMapper; import com.fuint.business.userManager.mapper.UserBalanceMapper; import com.fuint.business.userManager.service.*; import com.fuint.business.userManager.vo.LJUserVo; +import com.fuint.business.userManager.vo.MtUserFuelVo; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.StringUtils; import com.fuint.common.util.TokenUtil; @@ -72,6 +74,8 @@ public class LJUserServiceImpl extends ServiceImpl impleme @Autowired private IMtUserFuelService userFuelService; @Autowired + private MtUserFuelMapper mtUserFuelMapper; + @Autowired private FleetInfoService fleetInfoService; @Autowired @Lazy @@ -379,10 +383,8 @@ public class LJUserServiceImpl extends ServiceImpl impleme List ljUserVos = baseMapper.userListByPhone(mobile, nowAccountInfo.getStoreId()); ljUserVos.forEach(it->{ //在查询囤油卡信息 - LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(MtUserFuel::getStoreId,nowAccountInfo.getStoreId()).eq(MtUserFuel::getMtUserId,it.getId()); - List list = userFuelService.list(queryWrapper); - it.setUserFuels(list); + List userFuels = mtUserFuelMapper.selectUserFuelAndOilName(it); + it.setUserFuels(userFuels); //判断当前用户是否存在车队 List fleetInfoUniVos = fleetInfoService.queryByStoreId(nowAccountInfo.getStoreId(),it.getId()); if (CollUtil.isNotEmpty(fleetInfoUniVos)) { diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/vo/MtUserFuelVo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/vo/MtUserFuelVo.java new file mode 100644 index 000000000..837a02243 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/vo/MtUserFuelVo.java @@ -0,0 +1,8 @@ +package com.fuint.business.userManager.vo; + +import com.fuint.business.userManager.entity.MtUserFuel; + +public class MtUserFuelVo extends MtUserFuel { +// 油号名称 + private String oilNumberName; +} diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue b/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue index 75544f27e..10b25884c 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue @@ -17,7 +17,7 @@
储值卡:¥{{ chooseVipUser.cardBalance || 0 }}
- 囤油卡:¥{{item.fuelAmount}} + 囤油卡:{{item.oilNumberName}} {{item.fuelAmount}}升