1
This commit is contained in:
parent
581cefa9b3
commit
839c5f5226
@ -15,6 +15,20 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
</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>
|
||||
|
@ -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<CardValueRecordMappe
|
||||
private CardFuelRecordService fuelRecordService;
|
||||
@Autowired
|
||||
private LJUserGradeService userGradeService;
|
||||
@Autowired
|
||||
private MtUserFuelMapper mtUserFuelMapper;
|
||||
|
||||
/**
|
||||
* 储值卡充值(新增)
|
||||
@ -545,8 +550,32 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
||||
}
|
||||
res = JSONObject.parseObject(JSONObject.toJSONString(cardValueRecordDTO));
|
||||
} else if (selectCard.getCardType().equals("1")) {
|
||||
// 查询囤油卡活动
|
||||
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.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());
|
||||
|
||||
mtUserFuel.setFuelAmount(mtUserFuel.getFuelAmount()+cardFuelRecordDTO.getIncomeLitres());
|
||||
mtUserFuelMapper.updateById(mtUserFuel);
|
||||
//充值金额
|
||||
cardFuelRecordDTO.setRechargeBalance(selectCard.getRechargeBalance().doubleValue());
|
||||
|
||||
|
@ -1,10 +1,13 @@
|
||||
package com.fuint.business.userManager.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -51,16 +54,18 @@ public class MtUserFuel implements Serializable {
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新者")
|
||||
private String updateBy;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
// 油号名称 不参与新增 修改编辑
|
||||
@TableField(exist = false)
|
||||
private String oilNumberName;
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
package com.fuint.business.userManager.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.fuint.business.userManager.entity.MtUserFuel;
|
||||
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 org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -21,4 +24,6 @@ public interface MtUserFuelMapper extends BaseMapper<MtUserFuel> {
|
||||
|
||||
BigDecimal selectSumFuelAmountByMtUserId(@Param("mtUserId") Integer mtUserId);
|
||||
BigDecimal selectSumFuelAmountByStoreIds(@Param("storeIds") List<Long> storeIds);
|
||||
|
||||
List<MtUserFuel> selectUserFuelAndOilName(@Param("obj")LJUserVo userVo);
|
||||
}
|
||||
|
@ -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<LJUserMapper, LJUser> impleme
|
||||
@Autowired
|
||||
private IMtUserFuelService userFuelService;
|
||||
@Autowired
|
||||
private MtUserFuelMapper mtUserFuelMapper;
|
||||
@Autowired
|
||||
private FleetInfoService fleetInfoService;
|
||||
@Autowired
|
||||
@Lazy
|
||||
@ -379,10 +383,8 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
|
||||
List<LJUserVo> ljUserVos = baseMapper.userListByPhone(mobile, nowAccountInfo.getStoreId());
|
||||
ljUserVos.forEach(it->{
|
||||
//在查询囤油卡信息
|
||||
LambdaQueryWrapper<MtUserFuel> queryWrapper =new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(MtUserFuel::getStoreId,nowAccountInfo.getStoreId()).eq(MtUserFuel::getMtUserId,it.getId());
|
||||
List<MtUserFuel> list = userFuelService.list(queryWrapper);
|
||||
it.setUserFuels(list);
|
||||
List<MtUserFuel> userFuels = mtUserFuelMapper.selectUserFuelAndOilName(it);
|
||||
it.setUserFuels(userFuels);
|
||||
//判断当前用户是否存在车队
|
||||
List<FleetInfoUniVo> fleetInfoUniVos = fleetInfoService.queryByStoreId(nowAccountInfo.getStoreId(),it.getId());
|
||||
if (CollUtil.isNotEmpty(fleetInfoUniVos)) {
|
||||
|
@ -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;
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
<div> 储值卡:¥{{ chooseVipUser.cardBalance || 0 }}</div>
|
||||
<div v-if="chooseVipUser.userFuels">
|
||||
<div v-for="(item,index) in chooseVipUser.userFuels" :key="index">
|
||||
囤油卡:¥{{item.fuelAmount}}
|
||||
囤油卡:{{item.oilNumberName}} {{item.fuelAmount}}升
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="chooseVipUser.fleetMember">
|
||||
|
Loading…
Reference in New Issue
Block a user