Merge remote-tracking branch 'origin/master'

# Conflicts:
#	fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java
This commit is contained in:
齐天大圣 2024-01-22 14:26:39 +08:00
commit 0d16fe2c8d
26 changed files with 604 additions and 104 deletions

View File

@ -0,0 +1,10 @@
import request from '@/utils/request'
// 查询成长值记录信息列表
export function listGrowthValueRecord(query) {
return request({
url: '/business/growthValueChange/list',
method: 'get',
params: query
})
}

View File

@ -105,7 +105,6 @@ export default {
},
getOilName(){
oilNumbers().then(res => {
console.log(res)
this.oilNameList = res.data
})
},
@ -123,7 +122,6 @@ export default {
})
},
changeStatus() {
console.log("12312312312312312",this.cardList)
if (this.cardList == 'notUse') {
this.queryParams.status = 0
} else if (this.cardList == 'used') {

View File

@ -1,12 +1,23 @@
<template>
<div>
<el-table ref="tables" v-loading="loading" :data="list">
<el-table-column label="所属油站" prop="id" align="center"/>
<el-table-column label="变动时间" align="center"/>
<el-table-column label="类型" align="center" prop="userNo"/>
<el-table-column label="变动成长值" align="center" prop="name" />
<el-table-column label="描述" align="center" prop="name" />
<el-table-column label="类型" align="center" prop="balance"/>
<el-table-column label="所属油站" prop="storeName" align="center">
<template slot-scope="scope">
<span>{{scope.row.storeName ? scope.row.storeName : storeName}}</span>
</template>
</el-table-column>
<el-table-column label="变动时间" prop="createTime" align="center"/>
<el-table-column label="类型" align="center" prop="changeType">
<template slot-scope="scope">
<el-tag v-if="scope.row.changeType == 0">减少</el-tag>
<el-tag type="success" v-else>增加</el-tag>
</template>
</el-table-column>
<el-table-column label="变动成长值" align="center" prop="growthValue" />
<el-table-column label="变动后成长值" align="center" prop="afterTheChange" />
<el-table-column label="描述" align="center" prop="fromType" />
</el-table>
<pagination
@ -19,6 +30,9 @@
</template>
<script>
import {listGrowthValueRecord} from "@/api/order/growthvaluerecord";
import {ljStoreInfo} from "@/api/staff/store";
export default {
props:["pUserId"],
data(){
@ -30,16 +44,30 @@ export default {
queryParams:{
page:1,
pageSize:10,
}
},
storeName:"",
}
},
created() {
// this.userId = this.pUserId;
this.userId = this.$route.query.id;
this.getList()
this.getStoreName()
},
methods:{
getStoreName(){
ljStoreInfo().then(res => {
this.storeName = res.data.name
})
},
getList(){
this.loading = true
this.queryParams.userId = this.userId
listGrowthValueRecord(this.queryParams).then(res => {
this.list = res.data.records
this.total = res.data.total
this.loading = false
})
}
}
}

View File

@ -40,15 +40,15 @@
<div style="margin-top: 15px">
<span style="color: grey;">成长值计算方式</span>
<div style="display: flex;justify-content: space-between">
<el-input v-model="gasGrowthValue" disabled placeholder="1" style="margin: 10px 10px">
<el-input v-model="gasGrowthValue" disabled style="margin: 10px 10px">
<template slot="prepend">汽油成长值比例,每消费1元积</template>
<template slot="append">成长值</template>
</el-input>
<el-input v-model="dieselGrowthValue" disabled placeholder="1" style="margin: 10px 10px">
<el-input v-model="dieselGrowthValue" disabled style="margin: 10px 10px">
<template slot="prepend">柴油成长值比例,每消费1元积</template>
<template slot="append">成长值</template>
</el-input>
<el-input v-model="naturalGrowthValue" disabled placeholder="1" style="margin: 10px 10px">
<el-input v-model="naturalGrowthValue" disabled style="margin: 10px 10px">
<template slot="prepend">天然气成长值比例,每消费1元积</template>
<template slot="append">成长值</template>
</el-input>
@ -491,11 +491,11 @@ export default {
//
growthValueRule:[],
//
gasGrowthValue:'',
gasGrowthValue:0,
//
dieselGrowthValue:'',
dieselGrowthValue:0,
//
naturalGrowthValue:'',
naturalGrowthValue:0,
clear:'',
//
loading: true,
@ -584,9 +584,15 @@ export default {
// console.log(response)
this.isEnableLevel = response.data.isEnableLevel;
this.clear = response.data.isMonthClear;
if (response.data.gasGrowthValue){
this.gasGrowthValue = response.data.gasGrowthValue;
}
if (response.data.dieselGrowthValue) {
this.dieselGrowthValue = response.data.dieselGrowthValue;
}
if (response.data.naturalGrowthValue) {
this.naturalGrowthValue = response.data.naturalGrowthValue;
}
if (response.data.isEnableLevel=="no"){
this.level1 = true;
this.level2 = false;

View File

@ -49,7 +49,7 @@ public class Const {
public static String NOTIFY_PUBLIC_KEYS="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCbBAl3xSB7YeUnze4yYZmnTeT7OtXZr0sP10TsDVRH2SY/VEjgS9KPmHMmVeKZT3+6xKsUvulgVyie46GGtZPrnoh+glF1gzsYAXJ7dvR/R5nYO5VvfwK/ChPFTiKhbTtO4OKtchgBZuqCbsemG+gFIiVJo37dY0Kg0zISmFHdOQIDAQAB";
//异步通知(回调地址)
// public static String notify_url = "https://www.fuint.cn/fuint-application/clientApi/pay/aliPayCallback";
// public static String notify_url = "https://www.tuofeng.cc/oilAdmin/api/fyPay/notify";
public static String notify_url = "https://8q4f124343.yicp.fun/api/fyPay/notify";
//下单

View File

@ -27,4 +27,10 @@ public class PaymentActiveVO implements Serializable {
private BigDecimal cardFavorableAmount;
//等级会员优惠金额
private BigDecimal memberFavorableAmount;
//订单金额
private BigDecimal orderAmount;
//可用油品Id
private Integer oilId;
//会员等级
private Integer mtUserLevel;
}

View File

@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.activeDiscountRecords.entity.ActiveDiscountRecords;
import com.fuint.business.marketingActivity.activeDiscountRecords.mapper.ActiveDiscountRecordsMapper;
import com.fuint.business.marketingActivity.activeDiscountRecords.service.ActiveDiscountRecordsService;
import com.fuint.business.marketingActivity.activeExchange.dto.PaymentActiveDTO;
import com.fuint.business.marketingActivity.activeExchange.service.ActiveExchangeService;
import com.fuint.business.marketingActivity.activeExchange.vo.PaymentActiveVO;
import com.fuint.business.marketingActivity.activeFullminusRecords.entity.ActiveFullminusRecords;
import com.fuint.business.marketingActivity.activeFullminusRecords.mapper.ActiveFullminusRecordsMapper;
@ -27,6 +29,7 @@ import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -57,6 +60,9 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
private ActiveFullminusRecordsService activeFullminusRecordsService;
@Resource
private ActiveDiscountRecordsService activeDiscountRecordsService;
@Resource
@Lazy
private ActiveExchangeService activeExchangeService;
/**
* 分页查询所有数据
* @param page
@ -240,7 +246,7 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
boolean flag = false;
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer userId = null;
if (StringUtils.isNotEmpty(paymentActiveVO.getUserId().toString())){
if (paymentActiveVO.getUserId()!=null){
userId = paymentActiveVO.getUserId();
}else {
userId = nowAccountInfo.getId();
@ -264,6 +270,13 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
activeDiscountRecords.setStoreId(paymentActiveVO.getStoreId());
flag = activeDiscountRecordsService.save(activeDiscountRecords);
}
PaymentActiveDTO paymentActiveDTO = new PaymentActiveDTO();
paymentActiveDTO.setUserId(userId);
paymentActiveDTO.setAmount(paymentActiveVO.getOrderAmount());
paymentActiveDTO.setStoreId(paymentActiveVO.getStoreId());
paymentActiveDTO.setOilId(paymentActiveVO.getOilId());
paymentActiveDTO.setMtUserLevel(paymentActiveVO.getMtUserLevel());
activeExchangeService.activeConsumption(paymentActiveDTO);
return flag;
}
}

View File

@ -0,0 +1,38 @@
package com.fuint.business.order.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.order.entity.GrowthValueChange;
import com.fuint.business.order.entity.LJOrder;
import com.fuint.business.order.service.GrowthValueChangeService;
import com.fuint.business.order.vo.GrowthValueChangeVo;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/business/growthValueChange")
public class GrowthValueChangeController extends BaseController {
@Autowired
private GrowthValueChangeService growthValueChangeService;
/**
* 根据条件分页查询会员信息
* @param growthValueChange
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("/list")
public ResponseObject list(GrowthValueChangeVo growthValueChange,
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
Page page =new Page(pageNo,pageSize);
IPage<GrowthValueChangeVo> list = growthValueChangeService.selectGrowthValueChangeList(page,growthValueChange);
return getSuccessResult(list);
}
}

View File

@ -0,0 +1,63 @@
package com.fuint.business.order.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuint.framework.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 成长值变化记录表(GrowthValueChange)实体类
*/
@Data
@TableName("growth_value_change")
@ApiModel(value = "GrowthValueChange对象", description = "成长值变化记录表")
public class GrowthValueChange extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 自增ID
*/
@ApiModelProperty("自增ID")
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
/**
* 用户id
*/
private Integer userId;
/**
* 连锁店id
*/
private Integer chainStoreId;
/**
* 油站id
*/
private Integer storeId;
/**
* 余额变化类型 0-减少 1增加
*/
private String changeType;
/**
* 消费来源
*/
private String fromType;
/**
* 成长值变化值
*/
private Integer growthValue;
/**
* 变化之后的成长值
*/
private Integer afterTheChange;
/**
* 订单号
*/
private String orderNo;
}

View File

@ -0,0 +1,18 @@
package com.fuint.business.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.order.entity.GrowthValueChange;
import com.fuint.business.order.vo.GrowthValueChangeVo;
import org.apache.ibatis.annotations.Param;
public interface GrowthValueChangeMapper extends BaseMapper<GrowthValueChange> {
/**
* 根据条件分页查询成长值变化记录信息
* @param page
* @param growthValueChange
* @return
*/
public IPage<GrowthValueChangeVo> selectGrowthValueChangeList(@Param("page") Page page, @Param("growthValueChange") GrowthValueChangeVo growthValueChange);
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.business.order.mapper.GrowthValueChangeMapper">
<select id="selectGrowthValueChangeList" resultType="com.fuint.business.order.vo.GrowthValueChangeVo">
select gvc.*,ms.name storeName from growth_value_change gvc
left join mt_store ms on store_id = ms.id
<where>
<if test="growthValueChange.storeId != null and growthValueChange.storeId != ''">
and gvc.store_id = #{growthValueChange.storeId}
</if>
<if test="growthValueChange.userId != null and growthValueChange.userId != ''">
and gvc.user_id = #{growthValueChange.userId}
</if>
</where>
order by gvc.create_time desc
</select>
</mapper>

View File

@ -0,0 +1,37 @@
package com.fuint.business.order.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.order.entity.GrowthValueChange;
import com.fuint.business.order.vo.GrowthValueChangeVo;
public interface GrowthValueChangeService {
/**
* 根据条件分页查询成长值变化记录信息
* @param page
* @param growthValueChange
* @return
*/
public IPage<GrowthValueChangeVo> selectGrowthValueChangeList(Page page, GrowthValueChangeVo growthValueChange);
/**
* 根据id查询成长值变化记录信息
* @param id
* @return
*/
public GrowthValueChange selectGrowthValueChangeById(int id);
/**
* 添加成长值变化记录信息
* @param growthValueChange
* @return
*/
public int insertGrowthValueChange(GrowthValueChange growthValueChange);
/**
* 修改成长值变化记录信息
* @param growthValueChange
* @return
*/
public int updateGrowthValueChange(GrowthValueChange growthValueChange);
}

View File

@ -0,0 +1,37 @@
package com.fuint.business.order.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.order.entity.GrowthValueChange;
import com.fuint.business.order.mapper.GrowthValueChangeMapper;
import com.fuint.business.order.service.GrowthValueChangeService;
import com.fuint.business.order.vo.GrowthValueChangeVo;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
@Service
public class GrowthValueChangeServiceImpl extends ServiceImpl<GrowthValueChangeMapper, GrowthValueChange> implements GrowthValueChangeService {
@Override
public IPage<GrowthValueChangeVo> selectGrowthValueChangeList(Page page, GrowthValueChangeVo growthValueChange) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
growthValueChange.setStoreId(nowAccountInfo.getStoreId());
return baseMapper.selectGrowthValueChangeList(page,growthValueChange);
}
@Override
public GrowthValueChange selectGrowthValueChangeById(int id) {
return baseMapper.selectById(id);
}
@Override
public int insertGrowthValueChange(GrowthValueChange growthValueChange) {
return baseMapper.insert(growthValueChange);
}
@Override
public int updateGrowthValueChange(GrowthValueChange growthValueChange) {
return baseMapper.updateById(growthValueChange);
}
}

View File

@ -40,9 +40,11 @@ import com.fuint.business.petrolStationManagement.service.OilTankService;
import com.fuint.business.petrolStationManagement.service.OilTrackingService;
import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.userManager.entity.ChainStoreConfig;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.entity.LJUserGrade;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.service.ChainStoreConfigService;
import com.fuint.business.userManager.service.LJUserGradeService;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.business.userManager.service.UserBalanceService;
@ -92,6 +94,10 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
private LJGoodsService goodsService;
@Autowired
private StaffCommissionService staffCommissionService;
@Autowired
private GrowthValueChangeService growthValueChangeService;
@Autowired
private ChainStoreConfigService chainStoreConfigService;
@Override
public IPage<OilOrder> selectOilOrderList(Page page, OilOrder order) {
@ -339,7 +345,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
if (userId!=null){
this.updateGrowthValue(oilActualPay, userId, Integer.valueOf(jsonObjects.get(i).get("oilName").toString()),refuelMoney,storeId,orderNo);
this.updateGrowthValue(oilAmount,oilActualPay, userId, Integer.valueOf(jsonObjects.get(i).get("oilName").toString()),refuelMoney,storeId,orderNo);
}
order.setStoreId(storeId);
order.setUserId(userId);
@ -554,7 +560,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
baseMapper.insert(order);
oilOrder = this.selectOilOrderByOrderNo(orderNo);
this.updateGrowthValue1(0.0, userId, Integer.valueOf(oilOrder.getOils()), refuelMoneyLiters - Double.valueOf(oilOrders.get(i).get("liters").toString()), storeId,orderNo);
this.updateGrowthValue1(oilAmount,0.0, userId, Integer.valueOf(oilOrder.getOils()), refuelMoneyLiters - Double.valueOf(oilOrders.get(i).get("liters").toString()), storeId,orderNo);
this.insertOilBalance(userId,storeId,oilName.getId().toString(),oilName.getOilType(),Double.valueOf(oilOrders.get(i).get("liters").toString()),refuelMoneyLiters - Double.valueOf(oilOrders.get(i).get("liters").toString()),orderNo);
}else if (refuelMoneyLiters>0 && (Double.valueOf(oilOrders.get(i).get("liters").toString())-refuelMoneyLiters)*oilPrice<=cardBalance){
flag = true;
@ -591,7 +597,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
baseMapper.insert(order);
oilOrder = this.selectOilOrderByOrderNo(orderNo);
this.updateGrowthValue1((Double.valueOf(oilOrders.get(i).get("liters").toString())-refuelMoneyLiters)*oilPrice, userId, Integer.valueOf(oilOrder.getOils()), 0.0, storeId,orderNo);
this.updateGrowthValue1(oilAmount,(Double.valueOf(oilOrders.get(i).get("liters").toString())-refuelMoneyLiters)*oilPrice, userId, Integer.valueOf(oilOrder.getOils()), 0.0, storeId,orderNo);
this.insertOilBalance(userId,storeId,oilName.getId().toString(),oilName.getOilType(),refuelMoneyLiters,0.0,orderNo);
} else if (cardBalance >= oilAmount){
flag = true;
@ -628,7 +634,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
baseMapper.insert(order);
oilOrder = this.selectOilOrderByOrderNo(orderNo);
this.updateGrowthValue1(oilAmount,userId, Integer.valueOf(oilOrder.getOils()),0.0,storeId,orderNo);
this.updateGrowthValue1(oilAmount,oilAmount,userId, Integer.valueOf(oilOrder.getOils()),0.0,storeId,orderNo);
// this.insertCardBalance((Double.valueOf(oilOrders.get(i).get("liters").toString())-refuelMoneyLiters)*oilPrice,userId,storeId);
}else {
res.put("error","囤油卡或储值卡余额不足!");
@ -670,7 +676,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
baseMapper.insert(order);
oilOrder = this.selectOilOrderByOrderNo(orderNo);
this.updateGrowthValue1(oilAmount,userId, Integer.valueOf(oilOrder.getOils()),0.0,storeId,orderNo);
this.updateGrowthValue1(oilAmount,oilAmount,userId, Integer.valueOf(oilOrder.getOils()),0.0,storeId,orderNo);
}
}
@ -755,7 +761,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cashierOrder.setSeekZero(0.0);
cashierOrder.setPayType(map.get("payType"));
cashierOrderService.insertCashierOrder(cashierOrder);
this.updateGrowthValue1(oilAmount,userId, Integer.valueOf(oilOrder.getOils()),0.0,storeId,orderNo);
this.updateGrowthValue1(oilAmount,oilAmount,userId, Integer.valueOf(oilOrder.getOils()),0.0,storeId,orderNo);
this.insertAllOrderInfo(orderNo,accountInfo.getStoreId(),oilAmount,map.get("payType"),userId,"PC","1","paid");
staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")),storeId,oilAmount,oilAmount,oilLiters,"1",orderNo);
// this.insertCardBalance(oilAmount,userId,storeId);
@ -806,9 +812,18 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
* @param oilId 油号id
* @param refuelMoney 扣除的囤油卡升数
*/
private void updateGrowthValue1(Double oilActualPay,Integer userid,Integer oilId,Double refuelMoney,Integer storeId,String orderNo){
private void updateGrowthValue1(Double oilAmount,Double oilActualPay,Integer userid,Integer oilId,Double refuelMoney,Integer storeId,String orderNo){
OilName oilName = oilNameService.selectOilNameById(oilId);
// 获取成长值增长数值
Integer gasGrowthValue = null;
Integer dieselGrowthValue = null;
Integer naturalGrowthValue = null;
Integer addGrowthVal = null;
Integer growthAfter = null;
LJStore store = storeService.selectStoreByStoreId(storeId);
UserBalance balance = userBalanceService.selectUserBalance(userid,store.getChainStoreId());
int growth = balance.getGrowthValue();
JSONArray refuelMoneys = JSONArray.parseArray(balance.getRefuelMoney());
if (ObjectUtil.isNotEmpty(refuelMoneys)){
List<RefuelMoney> list = new ArrayList<>();
@ -827,8 +842,61 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
balance.setRefuelMoney(JSONObject.toJSONString(list));
}
// 查询会员等级列表信息
Page page = new Page(1,20);
LJUserGrade ljUserGrade1 = new LJUserGrade();
List<LJUserGrade> records = userGradeService.selectUserGradeAll(storeId);
ChainStoreConfig chainStoreConfig = chainStoreConfigService.selectChainStoreByStoreId(storeId);
if (oilName.getOilType().equals("汽油") && ObjectUtil.isNotEmpty(chainStoreConfig)){
gasGrowthValue = Integer.valueOf(chainStoreConfig.getGasGrowthValue());
Integer addVal = (int) (gasGrowthValue * oilAmount);
addGrowthVal = addVal;
growthAfter = growth + addVal;
// 如果会员成长值达到会员等级成长值则修改会员的会员等级信息
for (int i = 0; i < records.size(); i++){
if ((growthAfter-records.get(i).getGrowthValue())<100){
balance.setGradeId(records.get(i).getId());
}
if (growthAfter>records.get(records.size()-1).getGrowthValue()){
balance.setGradeId(records.get(records.size()-1).getId());
}
}
balance.setGrowthValue(growthAfter);
}else if(oilName.getOilType().equals("柴油") && ObjectUtil.isNotEmpty(chainStoreConfig)){
dieselGrowthValue = Integer.valueOf(chainStoreConfig.getDieselGrowthValue());
Integer addVal = (int) (dieselGrowthValue * oilAmount);
addGrowthVal = addVal;
growthAfter = growth + addVal;
// 如果会员成长值达到会员等级成长值则修改会员的会员等级信息
for (int i = 0; i < records.size(); i++){
if ((growthAfter-records.get(i).getGrowthValue())<100 && (growthAfter-records.get(i).getGrowthValue())>0){
balance.setGradeId(records.get(i).getId());
}
if (growthAfter > records.get(records.size()-1).getGrowthValue()){
balance.setGradeId(records.get(records.size()-1).getId());
}
}
balance.setGrowthValue(growthAfter);
}else if (oilName.getOilType().equals("天然气") && ObjectUtil.isNotEmpty(chainStoreConfig)){
naturalGrowthValue = Integer.valueOf(chainStoreConfig.getNaturalGrowthValue());
Integer addVal = (int) (naturalGrowthValue * oilAmount);
addGrowthVal = addVal;
growthAfter = growth + addVal;
// 如果会员成长值达到会员等级成长值则修改会员的会员等级信息
for (int i = 0; i < records.size(); i++){
if ((growthAfter-records.get(i).getGrowthValue())<100){
balance.setGradeId(records.get(i).getId());
}
if (growthAfter>records.get(records.size()-1).getGrowthValue()){
balance.setGradeId(records.get(records.size()-1).getId());
}
}
balance.setGrowthValue(growthAfter);
}else {}
// balance.setCardBalance(balance.getCardBalance()-oilActualPay);
userBalanceService.updateUserBalance(balance);
this.insertGrowthValueChange(userid,storeId,addGrowthVal,growthAfter,orderNo);
this.insertCardBalance(oilActualPay,userid,storeId,orderNo);
}
@ -1009,7 +1077,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
e.printStackTrace();
}
}else {
this.updateGrowthValue(payAmount,userId, Integer.valueOf(oilOrder.getOils()),oilCardAmount,oilOrder.getStoreId(),orderNo);
this.updateGrowthValue(oilOrder.getOrderAmount(),payAmount,userId, Integer.valueOf(oilOrder.getOils()),oilCardAmount,oilOrder.getStoreId(),orderNo);
this.addOilTracks(oilOrder,oilOrder.getStoreId());
this.insertCardOrder(oilOrder.getUserId(),oilOrder.getStoreId(),orderNo,oilOrder.getOrderAmount(),"paid", Double.valueOf(balanceAmount),payAmount);
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getOrderAmount(),oilOrder.getOilNum(),"1",orderNo);
@ -1081,7 +1149,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
CardValudChildrens cardValudChildrens = cardValudChildrensService.selectCardValueChildrenByMobileAndStoreId(user.getMobile(), oilOrder.getStoreId());
userId = cardValudChildrens.getUserId();
}
this.updateGrowthValue(oilOrder.getPayAmount(),userId, Integer.valueOf(oilOrder.getOils()),null,oilOrder.getStoreId(),orderNo);
this.updateGrowthValue(oilOrder.getOrderAmount(),oilOrder.getPayAmount(),userId, Integer.valueOf(oilOrder.getOils()),null,oilOrder.getStoreId(),orderNo);
this.addOilTracks(oilOrder,oilOrder.getStoreId());
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getPayAmount(),oilOrder.getOilNum(),"1",orderNo);
@ -1185,13 +1253,15 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
* @param refuelMoney 消费后的加油金信息
* @param storeId 店铺id
*/
private void updateGrowthValue(Double oilActualPay,Integer userid,Integer oilId,String refuelMoney,Integer storeId,String orderNo){
private void updateGrowthValue(Double oilAmount,Double oilActualPay,Integer userid,Integer oilId,String refuelMoney,Integer storeId,String orderNo){
if (oilId!=null){
OilName oilName = oilNameService.selectOilNameById(oilId);
// 获取成长值增长数值
Integer gasGrowthValue = null;
Integer dieselGrowthValue = null;
Integer naturalGrowthValue = null;
Integer addGrowthVal = null;
Integer growthAfter = null;
LJStore store = storeService.selectStoreByStoreId(storeId);
UserBalance balance = userBalanceService.selectUserBalance(userid,store.getChainStoreId());
int growth = balance.getGrowthValue();
@ -1226,10 +1296,12 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
Page page = new Page(1,20);
LJUserGrade ljUserGrade1 = new LJUserGrade();
List<LJUserGrade> records = userGradeService.selectUserGradeAll(storeId);
if (oilName.getOilType().equals("汽油")){
gasGrowthValue = Integer.valueOf(sysConfigService.getValueByKey("gas_growth_value"));
Integer addVal = (int) (gasGrowthValue * oilActualPay);
Integer growthAfter = growth + addVal;
ChainStoreConfig chainStoreConfig = chainStoreConfigService.selectChainStoreByStoreId(storeId);
if (oilName.getOilType().equals("汽油") && ObjectUtil.isNotEmpty(chainStoreConfig)){
gasGrowthValue = Integer.valueOf(chainStoreConfig.getGasGrowthValue());
Integer addVal = (int) (gasGrowthValue * oilAmount);
addGrowthVal = addVal;
growthAfter = growth + addVal;
// 如果会员成长值达到会员等级成长值则修改会员的会员等级信息
for (int i = 0; i < records.size(); i++){
if ((growthAfter-records.get(i).getGrowthValue())<100){
@ -1240,10 +1312,11 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
}
balance.setGrowthValue(growthAfter);
}else if(oilName.getOilType().equals("柴油")){
dieselGrowthValue = Integer.valueOf(sysConfigService.getValueByKey("diesel_growth_value"));
Integer addVal = (int) (dieselGrowthValue * oilActualPay);
Integer growthAfter = growth + addVal;
}else if(oilName.getOilType().equals("柴油") && ObjectUtil.isNotEmpty(chainStoreConfig)){
dieselGrowthValue = Integer.valueOf(chainStoreConfig.getDieselGrowthValue());
Integer addVal = (int) (dieselGrowthValue * oilAmount);
addGrowthVal = addVal;
growthAfter = growth + addVal;
// 如果会员成长值达到会员等级成长值则修改会员的会员等级信息
for (int i = 0; i < records.size(); i++){
if ((growthAfter-records.get(i).getGrowthValue())<100 && (growthAfter-records.get(i).getGrowthValue())>0){
@ -1254,10 +1327,11 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
}
balance.setGrowthValue(growthAfter);
}else{
naturalGrowthValue = Integer.valueOf(sysConfigService.getValueByKey("natural_growth_value"));
Integer addVal = (int) (naturalGrowthValue * oilActualPay);
Integer growthAfter = growth + addVal;
}else if (oilName.getOilType().equals("天然气") && ObjectUtil.isNotEmpty(chainStoreConfig)){
naturalGrowthValue = Integer.valueOf(chainStoreConfig.getNaturalGrowthValue());
Integer addVal = (int) (naturalGrowthValue * oilAmount);
addGrowthVal = addVal;
growthAfter = growth + addVal;
// 如果会员成长值达到会员等级成长值则修改会员的会员等级信息
for (int i = 0; i < records.size(); i++){
if ((growthAfter-records.get(i).getGrowthValue())<100){
@ -1268,9 +1342,23 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
}
balance.setGrowthValue(growthAfter);
}
}else {}
// 修改用户成长值
Integer consumeNum = balance.getConsumeNum();
balance.setConsumeNum(consumeNum+1);
userBalanceService.updateUserBalance(balance);
this.insertGrowthValueChange(userid,storeId,addGrowthVal,growthAfter,orderNo);
CardBalanceChange cardBalanceChange = new CardBalanceChange();
// 添加余额记录信息
cardBalanceChange.setUserId(userid);
cardBalanceChange.setChangeType("0");
cardBalanceChange.setFromType("油品订单消费");
cardBalanceChange.setBalance(oilAmount - oilActualPay);
cardBalanceChange.setOrderNo(orderNo);
cardBalanceChangeService.insertCardBalance(cardBalanceChange);
}
}
@ -1307,6 +1395,20 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cardBalanceChangeService.insertCardBalance(cardBalanceChange);
}
private void insertGrowthValueChange(Integer userId,Integer storeId,Integer growthValue,Integer growthValueAfter,String orderNo){
LJStore store = storeService.selectStoreByStoreId(storeId);
GrowthValueChange growthValueChange = new GrowthValueChange();
growthValueChange.setUserId(userId);
growthValueChange.setStoreId(storeId);
growthValueChange.setChainStoreId(store.getChainStoreId());
growthValueChange.setChangeType("1");
growthValueChange.setFromType("油品订单消费");
growthValueChange.setGrowthValue(growthValue);
growthValueChange.setAfterTheChange(growthValueAfter);
growthValueChange.setOrderNo(orderNo);
growthValueChangeService.insertGrowthValueChange(growthValueChange);
}
/**
* 添加囤油卡消费记录
* @param userId

View File

@ -0,0 +1,10 @@
package com.fuint.business.order.vo;
import com.fuint.business.order.entity.GrowthValueChange;
public class GrowthValueChangeVo extends GrowthValueChange {
/**
* 店铺名称
*/
private String storeName;
}

View File

@ -29,7 +29,9 @@ public class ChainStoreConfigServiceImpl extends ServiceImpl<ChainStoreConfigMap
public ChainStoreConfig selectChainStoreConfigById() {
LJStore store = storeService.selectStoreById();
Integer id = store.getChainStoreId();
return baseMapper.selectById(id);
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("chain_store_id",id);
return baseMapper.selectOne(queryWrapper);
}
/**

View File

@ -0,0 +1,10 @@
import request from '@/utils/request'
// 查询成长值记录信息列表
export function listGrowthValueRecord(query) {
return request({
url: '/business/growthValueChange/list',
method: 'get',
params: query
})
}

View File

@ -209,6 +209,7 @@ export default {
}
},
created() {
// this.userId = this.pUserId;
this.userId = this.$route.query.id;
this.getUser()

View File

@ -76,9 +76,9 @@ export default {
}
},
created() {
this.userId = this.pUserId;
// this.userId = this.$route.query.id;
console.log( "111111",this.userId)
// this.userId = this.pUserId;
this.userId = this.$route.query.id;
this.getList()
this.getOilName()
},
@ -109,7 +109,6 @@ export default {
},
getOilName(){
oilNumbers().then(res => {
console.log(res)
this.oilNameList = res.data
})
},
@ -129,7 +128,6 @@ export default {
})
},
changeStatus() {
console.log("12312312312312312",this.cardList)
if (this.cardList == 'notUse') {
this.queryParams.status = 0
} else if (this.cardList == 'used') {

View File

@ -1,12 +1,23 @@
<template>
<div>
<el-table ref="tables" v-loading="loading" :data="list">
<el-table-column label="所属油站" prop="id" align="center"/>
<el-table-column label="变动时间" align="center"/>
<el-table-column label="类型" align="center" prop="userNo"/>
<el-table-column label="变动成长值" align="center" prop="name" />
<el-table-column label="描述" align="center" prop="name" />
<el-table-column label="类型" align="center" prop="balance"/>
<el-table-column label="所属油站" prop="storeName" align="center">
<template slot-scope="scope">
<span>{{scope.row.storeName ? scope.row.storeName : storeName}}</span>
</template>
</el-table-column>
<el-table-column label="变动时间" prop="createTime" align="center"/>
<el-table-column label="类型" align="center" prop="changeType">
<template slot-scope="scope">
<el-tag v-if="scope.row.changeType == 0">减少</el-tag>
<el-tag type="success" v-else>增加</el-tag>
</template>
</el-table-column>
<el-table-column label="变动成长值" align="center" prop="growthValue" />
<el-table-column label="变动后成长值" align="center" prop="afterTheChange" />
<el-table-column label="描述" align="center" prop="fromType" />
</el-table>
<pagination
@ -19,6 +30,9 @@
</template>
<script>
import {ljStoreInfo} from "@/api/staff/store";
import {listGrowthValueRecord} from "@/api/cashier/growthvaluerecord";
export default {
props:["pUserId"],
data(){
@ -30,15 +44,31 @@ export default {
queryParams:{
page:1,
pageSize:10,
}
},
storeName:""
}
},
created() {
this.userId = this.pUserId;
// this.userId = this.pUserId;
this.userId = this.$route.query.id;
this.getList()
this.getStoreName()
},
methods:{
getList(){
getStoreName(){
ljStoreInfo().then(res => {
this.storeName = res.data.name
})
},
getList(){
this.loading = true
this.queryParams.userId = this.userId
listGrowthValueRecord(this.queryParams).then(res => {
this.list = res.data.records
this.total = res.data.total
this.loading = false
})
}
}
}

View File

@ -84,7 +84,6 @@ export default {
getPayType(){
getDicts("payment_type").then(res => {
this.payTypeList = res.data
console.log(res)
})
},
//

View File

@ -45,7 +45,6 @@ export default {
created() {
// this.userId = this.pUserId;
this.userId = this.$route.query.id;
console.log('1212',this.userId)
this.getList()
},
methods:{

View File

@ -35,7 +35,8 @@ export default {
}
},
created() {
this.userId = this.pUserId;
// this.userId = this.pUserId;
this.userId = this.$route.query.id;
},
methods:{
getList(){

View File

@ -42,6 +42,36 @@
uni.setStorageSync("appltType","ALIPAY")
console.log("支付宝")
my.canIUse('button.open-type.getAuthorize')
//qrCode
if (e.query && e.query.qrCode) {
console.log(JSON.stringify(e)+"1.0")
let q = e.query.qrCode;
if (e.query.qrCode) {
let str = q.split("?")[1];
let storeId = "";
let staffId = "";
if (str.includes("&")){
let arr = str.split("&");
arr.forEach(item => {
if (item.includes("storeId")) {
storeId = item.split("=")[1]
}else {
staffId = item.split("=")[1]
}
})
}else{
if (str.includes("storeId")) {
storeId = str.split("=")[1]
}
}
uni.setStorageSync("storeId", storeId)
uni.setStorageSync("inviteStaffId", staffId)
uni.showLoading({
title:uni.getStorageSync("storeId") + "staffId" + uni.getStorageSync("inviteStaffId")
})
}
}
// #endif
},
onShow: function() {

View File

@ -175,6 +175,7 @@
tabbar
},
onLoad(query) {
if (uni.getStorageSync("appltType") == "WECHAT"){
const q = decodeURIComponent(query.q) //
if (query.q) {
let str = q.split("?")[1];
@ -193,14 +194,20 @@
}else{
storeId = str.split("=")[1]
}
uni.setStorageSync("storeId", storeId)
uni.setStorageSync("inviteStaffId", staffId)
this.storeId = uni.getStorageSync("storeId")
this.staffId = uni.getStorageSync("inviteStaffId")
this.getStore(uni.getStorageSync("storeId"));
}
}else{
if (uni.getStorageSync("storeId")){
this.getStore(uni.getStorageSync("storeId"));
}
}
},
onShow() {
@ -333,7 +340,22 @@
//
getSIndex(index,id) {
this.sindex = index
//
request({
url: "business/petrolStationManagement/oilTank/" + uni.getStorageSync('tankId'),
method: 'get',
}).then((res)=>{
if (res.data.storedQuantity-this.liters<0){
uni.showToast({
title:"所加油的升数大于油罐内的升数,请重新选择加油升数",
icon:"none"
})
return;
}else {
this.toPayment(id)
}
})
},
toPayment(id){
this.oilOrder.orderAmount = this.value
@ -391,9 +413,21 @@
},
//
submitAmount(){
//
request({
url: "business/petrolStationManagement/oilTank/" + uni.getStorageSync('tankId'),
method: 'get',
}).then((res)=>{
if (res.data.storedQuantity-this.liters<0){
uni.showToast({
title:"所加油的升数大于油罐内的升数,请重新选择加油升数",
icon:"none"
})
return;
}else {
if (this.value!="" && this.qindex!=null){
this.show = false
if (uni.getStorageSync("inviteStaffId")!=null && uni.getStorageSync("inviteStaffId")!="" && uni.getStorageSync("inviteStaffId")!=undefined){
if (uni.getStorageSync("inviteStaffId")){
this.toPayment(uni.getStorageSync("inviteStaffId"))
}else{
this.$refs.popup.open('bottom')
@ -411,6 +445,10 @@
})
}
}
}
})
},
changeVal(val) {
this.value = val;

View File

@ -324,6 +324,9 @@
}
if(res.data.success == "ok"){
_this.preferentialData.storeId = _this.oilOrder.storeId
_this.preferentialData.orderAmount = _this.oilOrder.orderAmount
_this.preferentialData.oilId = _this.oilOrder.oils
_this.preferentialData.mtUserLevel = _this.user.gradeId
request({
url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById",
method: 'post',
@ -361,6 +364,9 @@
console.log('success');
// 使
_this.preferentialData.storeId = _this.oilOrder.storeId
_this.preferentialData.orderAmount = _this.oilOrder.orderAmount
_this.preferentialData.oilId = _this.oilOrder.oils
_this.preferentialData.mtUserLevel = _this.user.gradeId
request({
url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById",
method: 'post',
@ -393,6 +399,9 @@
console.log("支付成功")
// 使
_this.preferentialData.storeId = _this.oilOrder.storeId
_this.preferentialData.orderAmount = _this.oilOrder.orderAmount
_this.preferentialData.oilId = _this.oilOrder.oils
_this.preferentialData.mtUserLevel = _this.user.gradeId
request({
url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById",
method: 'post',