This commit is contained in:
zhaohengkun 2024-10-29 16:09:01 +08:00
parent 581cefa9b3
commit 839c5f5226
7 changed files with 74 additions and 9 deletions

View File

@ -15,6 +15,20 @@
#{item} #{item}
</foreach> </foreach>
</select> </select>
<select id="selectUserFuelAndOilName" resultType="com.fuint.business.userManager.entity.MtUserFuel">
select uf.*, CONCAT(na.oil_type, ' ',na.oil_name) AS oilNumberName
from mt_user_fuel uf
left JOIN oil_name na on na.id = uf.oil_name
<where>
<if test="obj.Id != null and obj.Id != ''">
and uf.mt_user_id = #{obj.id}
</if>
<if test="obj.storeId != null and obj.storeId != ''">
and uf.store_id = #{obj.storeId}
</if>
</where>
</select>
</mapper> </mapper>

View File

@ -61,9 +61,12 @@ import com.fuint.business.order.service.GrowthValueChangeService;
import com.fuint.business.storeInformation.entity.LJStore; import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService; import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.userManager.entity.LJUserGrade; 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.MtUserGradeChild;
import com.fuint.business.userManager.entity.UserBalance; import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.LJUserMapper; 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.LJUserGradeService;
import com.fuint.business.userManager.service.MtUserGradeChildService; import com.fuint.business.userManager.service.MtUserGradeChildService;
import com.fuint.business.userManager.service.UserBalanceService; import com.fuint.business.userManager.service.UserBalanceService;
@ -152,6 +155,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
private CardFuelRecordService fuelRecordService; private CardFuelRecordService fuelRecordService;
@Autowired @Autowired
private LJUserGradeService userGradeService; private LJUserGradeService userGradeService;
@Autowired
private MtUserFuelMapper mtUserFuelMapper;
/** /**
* 储值卡充值新增 * 储值卡充值新增
@ -545,8 +550,32 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
} }
res = JSONObject.parseObject(JSONObject.toJSONString(cardValueRecordDTO)); res = JSONObject.parseObject(JSONObject.toJSONString(cardValueRecordDTO));
} else if (selectCard.getCardType().equals("1")) { } else if (selectCard.getCardType().equals("1")) {
// 查询囤油卡活动
CardFuelDiesel fuelDiesel = fuelDieselService.getById(selectCard.getSelectCardId()); CardFuelDiesel fuelDiesel = fuelDieselService.getById(selectCard.getSelectCardId());
// 当前用户囤油卡
MtUserFuel mtUserFuel = null;
HashMap<String, Object> 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<MtUserFuel> 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 cardFuelRecordDTO =new CardFuelRecordDTO();
cardFuelRecordDTO.setCardFuelId(selectCard.getSelectCardId()); cardFuelRecordDTO.setCardFuelId(selectCard.getSelectCardId());
@ -567,6 +596,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
//所得升数 //所得升数
cardFuelRecordDTO.setIncomeLitres(BigDecimal.valueOf(fuelDiesel.getRechargeBalance()/fuelDiesel.getLockPrice()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); cardFuelRecordDTO.setIncomeLitres(BigDecimal.valueOf(fuelDiesel.getRechargeBalance()/fuelDiesel.getLockPrice()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
mtUserFuel.setFuelAmount(mtUserFuel.getFuelAmount()+cardFuelRecordDTO.getIncomeLitres());
mtUserFuelMapper.updateById(mtUserFuel);
//充值金额 //充值金额
cardFuelRecordDTO.setRechargeBalance(selectCard.getRechargeBalance().doubleValue()); cardFuelRecordDTO.setRechargeBalance(selectCard.getRechargeBalance().doubleValue());

View File

@ -1,10 +1,13 @@
package com.fuint.business.userManager.entity; package com.fuint.business.userManager.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -51,16 +54,18 @@ public class MtUserFuel implements Serializable {
private String createBy; private String createBy;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private LocalDateTime createTime; private Date createTime;
@ApiModelProperty(value = "更新者") @ApiModelProperty(value = "更新者")
private String updateBy; private String updateBy;
@ApiModelProperty(value = "更新时间") @ApiModelProperty(value = "更新时间")
private LocalDateTime updateTime; private Date updateTime;
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
// 油号名称 不参与新增 修改编辑
@TableField(exist = false)
private String oilNumberName;
} }

View File

@ -1,7 +1,10 @@
package com.fuint.business.userManager.mapper; package com.fuint.business.userManager.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fuint.business.userManager.entity.MtUserFuel; import com.fuint.business.userManager.entity.MtUserFuel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.business.userManager.vo.MtUserFuelVo;
import com.fuint.business.userManager.vo.UserBalanceVo; import com.fuint.business.userManager.vo.UserBalanceVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -21,4 +24,6 @@ public interface MtUserFuelMapper extends BaseMapper<MtUserFuel> {
BigDecimal selectSumFuelAmountByMtUserId(@Param("mtUserId") Integer mtUserId); BigDecimal selectSumFuelAmountByMtUserId(@Param("mtUserId") Integer mtUserId);
BigDecimal selectSumFuelAmountByStoreIds(@Param("storeIds") List<Long> storeIds); BigDecimal selectSumFuelAmountByStoreIds(@Param("storeIds") List<Long> storeIds);
List<MtUserFuel> selectUserFuelAndOilName(@Param("obj")LJUserVo userVo);
} }

View File

@ -26,9 +26,11 @@ import com.fuint.business.userGroup.entity.UserGroup;
import com.fuint.business.userManager.entity.*; import com.fuint.business.userManager.entity.*;
import com.fuint.business.userManager.mapper.LJUserMapper; import com.fuint.business.userManager.mapper.LJUserMapper;
import com.fuint.business.userManager.mapper.MtInvitationMapper; 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.mapper.UserBalanceMapper;
import com.fuint.business.userManager.service.*; import com.fuint.business.userManager.service.*;
import com.fuint.business.userManager.vo.LJUserVo; import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.business.userManager.vo.MtUserFuelVo;
import com.fuint.common.dto.AccountInfo; import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.StringUtils; import com.fuint.common.util.StringUtils;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
@ -72,6 +74,8 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
@Autowired @Autowired
private IMtUserFuelService userFuelService; private IMtUserFuelService userFuelService;
@Autowired @Autowired
private MtUserFuelMapper mtUserFuelMapper;
@Autowired
private FleetInfoService fleetInfoService; private FleetInfoService fleetInfoService;
@Autowired @Autowired
@Lazy @Lazy
@ -379,10 +383,8 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
List<LJUserVo> ljUserVos = baseMapper.userListByPhone(mobile, nowAccountInfo.getStoreId()); List<LJUserVo> ljUserVos = baseMapper.userListByPhone(mobile, nowAccountInfo.getStoreId());
ljUserVos.forEach(it->{ ljUserVos.forEach(it->{
//在查询囤油卡信息 //在查询囤油卡信息
LambdaQueryWrapper<MtUserFuel> queryWrapper =new LambdaQueryWrapper<>(); List<MtUserFuel> userFuels = mtUserFuelMapper.selectUserFuelAndOilName(it);
queryWrapper.eq(MtUserFuel::getStoreId,nowAccountInfo.getStoreId()).eq(MtUserFuel::getMtUserId,it.getId()); it.setUserFuels(userFuels);
List<MtUserFuel> list = userFuelService.list(queryWrapper);
it.setUserFuels(list);
//判断当前用户是否存在车队 //判断当前用户是否存在车队
List<FleetInfoUniVo> fleetInfoUniVos = fleetInfoService.queryByStoreId(nowAccountInfo.getStoreId(),it.getId()); List<FleetInfoUniVo> fleetInfoUniVos = fleetInfoService.queryByStoreId(nowAccountInfo.getStoreId(),it.getId());
if (CollUtil.isNotEmpty(fleetInfoUniVos)) { if (CollUtil.isNotEmpty(fleetInfoUniVos)) {

View File

@ -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;
}

View File

@ -17,7 +17,7 @@
<div> 储值卡{{ chooseVipUser.cardBalance || 0 }}</div> <div> 储值卡{{ chooseVipUser.cardBalance || 0 }}</div>
<div v-if="chooseVipUser.userFuels"> <div v-if="chooseVipUser.userFuels">
<div v-for="(item,index) in chooseVipUser.userFuels" :key="index"> <div v-for="(item,index) in chooseVipUser.userFuels" :key="index">
囤油卡{{item.fuelAmount}} 囤油卡{{item.oilNumberName}} {{item.fuelAmount}}
</div> </div>
</div> </div>
<div v-if="chooseVipUser.fleetMember"> <div v-if="chooseVipUser.fleetMember">