Merge branch 'master' of https://gitee.com/nny_1/oilSystem
This commit is contained in:
commit
22aee4bb01
18
fuintAdmin/src/api/payConfig/merchantconfig.js
Normal file
18
fuintAdmin/src/api/payConfig/merchantconfig.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询商户列表
|
||||||
|
export function listMerchant() {
|
||||||
|
return request({
|
||||||
|
url: '/api/merchantConfig/list',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改商户使用状态
|
||||||
|
export function editMerchant(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/merchantConfig',
|
||||||
|
method: 'put',
|
||||||
|
data: data,
|
||||||
|
})
|
||||||
|
}
|
25
fuintAdmin/src/api/payConfig/oilconfig.js
Normal file
25
fuintAdmin/src/api/payConfig/oilconfig.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询支付规则列表
|
||||||
|
export function listOilConfig() {
|
||||||
|
return request({
|
||||||
|
url: '/api/oilConfig/list',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否开启支付规则
|
||||||
|
export function isOpenOilConfig(isOpen) {
|
||||||
|
return request({
|
||||||
|
url: '/api/oilConfig/'+isOpen,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据id查询支付配置信息
|
||||||
|
export function oilConfigInfo(id) {
|
||||||
|
return request({
|
||||||
|
url: '/api/oilConfig/info/'+id,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
@ -1,23 +1,42 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="box-centenr">
|
<div class="box-centenr">
|
||||||
<div style="width: 40%">
|
<div style="width: 100%;display: flex">
|
||||||
<el-alert
|
<el-alert
|
||||||
title="警告提示的文案"
|
title="说明"
|
||||||
type="error"
|
type="error"
|
||||||
description="为了保证加油站商户日常在线支付业务的稳定性,油客里里目前支持多通道支付
|
description="为了保证加油站商户日常在线支付业务的稳定性,油客里里目前支持多通道支付
|
||||||
可以有效的避免单支付通道带来不稳定性,从而造成油站不能正常支付问题
|
可以有效的避免单支付通道带来不稳定性,从而造成油站不能正常支付问题
|
||||||
加油站一旦出现不能正常支付的情况,可以随时手工切换支付通道,来保证加油站支付收款业务"
|
加油站一旦出现不能正常支付的情况,可以随时手工切换支付通道,来保证加油站支付收款业务"
|
||||||
:closable="false"
|
:closable="false"
|
||||||
>
|
>
|
||||||
</el-alert>
|
</el-alert>
|
||||||
|
|
||||||
|
<div style="width: 150%;display: flex;justify-content: right">
|
||||||
|
<div class="mingc">功能状态</div>
|
||||||
|
<el-switch
|
||||||
|
v-model="value1"
|
||||||
|
@change="changeStatus1"
|
||||||
|
>
|
||||||
|
</el-switch>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-box">
|
<div class="content-box">
|
||||||
<el-card class="box-card" shadow="hover" v-for="(item,index) in 10" :key="index">
|
<!-- <el-card class="box-card" shadow="hover" v-for="(item,index) in 10" :key="index">-->
|
||||||
|
<!-- <div slot="header" class="clearfix">-->
|
||||||
|
<!-- <span>卡片名称</span>-->
|
||||||
|
<!-- <el-button style="float: right; padding: 3px 0" type="text">切换为当前通道</el-button>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <div>商户编号:1861975</div>-->
|
||||||
|
<!-- </el-card>-->
|
||||||
|
<el-card class="box-card" shadow="hover" v-for="item in merchantList" :key="item.id">
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span>卡片名称</span>
|
<span>{{ item.merchantName }}</span>
|
||||||
<el-button style="float: right; padding: 3px 0" type="text">切换为当前通道</el-button>
|
<el-button v-if="item.isUse=='0'"
|
||||||
|
@click="editStatus(item,1)"
|
||||||
|
style="float: right; padding: 3px 0" type="text">切换为当前通道</el-button>
|
||||||
|
<el-tag v-else effect="dark" type="success" style="float: right">当前使用中</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<div>商户编号:1861975</div>
|
<div>商户编号:{{ item.mchntCd }}</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
<el-divider></el-divider>
|
<el-divider></el-divider>
|
||||||
@ -42,6 +61,7 @@
|
|||||||
<div class="mingc">功能状态</div>
|
<div class="mingc">功能状态</div>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="value"
|
v-model="value"
|
||||||
|
@change="changeStatus"
|
||||||
>
|
>
|
||||||
</el-switch>
|
</el-switch>
|
||||||
</div>
|
</div>
|
||||||
@ -51,35 +71,50 @@
|
|||||||
<div><el-button type="primary" icon="el-icon-plus" @click="dialogFormVisible = true">添加规则</el-button></div>
|
<div><el-button type="primary" icon="el-icon-plus" @click="dialogFormVisible = true">添加规则</el-button></div>
|
||||||
<div><el-button type="success" icon="el-icon-s-promotion" @click="open">发布规则</el-button></div>
|
<div><el-button type="success" icon="el-icon-s-promotion" @click="open">发布规则</el-button></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="hangbox" v-for="(item,index) in 3" :key="index">
|
<div class="hangbox" v-for="(item,index) in oilConfigList" :key="item.id">
|
||||||
<div>{{index + 1}}.通道</div>
|
<div>{{index + 1}}.通道</div>
|
||||||
<div class="jiaong"> 名称 </div>
|
<div class="jiaong">{{ item.merchantName }}</div>
|
||||||
<div> 商户号 </div>
|
<div> 商户号 </div>
|
||||||
<div class="jiaong"> 1231213213212</div>
|
<div class="jiaong">{{ item.mchntCd }}</div>
|
||||||
<div> 交易满 </div>
|
<!-- <div> 交易满 </div>-->
|
||||||
<div class="jiaong"> 2 </div>
|
<div> 交易占比 </div>
|
||||||
<div> 笔更换支付通道 参与次数 </div>
|
<div class="jiaong"> {{ item.proportion }} </div>
|
||||||
|
<div> %更换支付通道 参与次数 </div>
|
||||||
<div class="jiaong"> 不固定次数 </div>
|
<div class="jiaong"> 不固定次数 </div>
|
||||||
|
|
||||||
<el-button type="primary" icon="el-icon-edit">编辑</el-button>
|
<el-button type="primary" icon="el-icon-edit" @click="editOilConfig(item.id)">编辑</el-button>
|
||||||
<el-button type="danger" icon="el-icon-close">删除</el-button>
|
<el-button type="danger" icon="el-icon-close">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- <div class="hangbox" v-for="(item,index) in 3" :key="index">-->
|
||||||
|
<!-- <div>{{index + 1}}.通道</div>-->
|
||||||
|
<!-- <div class="jiaong"> 名称 </div>-->
|
||||||
|
<!-- <div> 商户号 </div>-->
|
||||||
|
<!-- <div class="jiaong"> 1231213213212</div>-->
|
||||||
|
<!--<!– <div> 交易满 </div>–>-->
|
||||||
|
<!-- <div> 交易占比 </div>-->
|
||||||
|
<!-- <div class="jiaong"> 2 </div>-->
|
||||||
|
<!-- <div> %更换支付通道 参与次数 </div>-->
|
||||||
|
<!-- <div class="jiaong"> 不固定次数 </div>-->
|
||||||
|
|
||||||
|
<!-- <el-button type="primary" icon="el-icon-edit">编辑</el-button>-->
|
||||||
|
<!-- <el-button type="danger" icon="el-icon-close">删除</el-button>-->
|
||||||
|
<!-- </div>-->
|
||||||
<div class="hsize">注:规则按照顺序进行处理并自动更换支付通道,新增或变更规则后需要发布当前规则才生效,发布生效后的规则将从序号1的配置生效</div>
|
<div class="hsize">注:规则按照顺序进行处理并自动更换支付通道,新增或变更规则后需要发布当前规则才生效,发布生效后的规则将从序号1的配置生效</div>
|
||||||
|
|
||||||
<el-dialog title="编辑通道规则" :visible.sync="dialogFormVisible">
|
<el-dialog title="编辑通道规则" :visible.sync="dialogFormVisible">
|
||||||
<el-form :model="form">
|
<el-form :model="form">
|
||||||
|
|
||||||
<el-form-item label="支付通道" :label-width="formLabelWidth" width="300px">
|
<el-form-item label="支付通道" :label-width="formLabelWidth" width="300px">
|
||||||
<el-select v-model="form.region" placeholder="请选择活动区域">
|
<el-select v-model="form.merchConfigId" placeholder="请选择活动区域">
|
||||||
<el-option label="区域一" value="shanghai"></el-option>
|
<el-option label="区域一" value="shanghai"></el-option>
|
||||||
<el-option label="区域二" value="beijing"></el-option>
|
<el-option label="区域二" value="beijing"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商户号" :label-width="formLabelWidth">
|
<el-form-item label="商户号" :label-width="formLabelWidth">
|
||||||
<el-input v-model="form.name" autocomplete="off"></el-input>
|
<el-input v-model="form.mchntCd" autocomplete="off"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="消费满笔数" :label-width="formLabelWidth">
|
<el-form-item label="消费满笔数" :label-width="formLabelWidth">
|
||||||
<el-input v-model="form.name" autocomplete="off"></el-input>
|
<el-input v-model="form.proportion" autocomplete="off"></el-input>
|
||||||
<div>消费笔数满足后切换到下一个支付通道</div>
|
<div>消费笔数满足后切换到下一个支付通道</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="参与次数" :label-width="formLabelWidth">
|
<el-form-item label="参与次数" :label-width="formLabelWidth">
|
||||||
@ -107,10 +142,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {editMerchant, listMerchant} from "@/api/payConfig/merchantconfig";
|
||||||
|
import {isOpenOilConfig, listOilConfig, oilConfigInfo} from "@/api/payConfig/oilconfig";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'peizhi',
|
name: 'peizhi',
|
||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
|
// 商户配置信息
|
||||||
|
merchantList:[],
|
||||||
|
// 商品规则配置信息
|
||||||
|
oilConfigList:[],
|
||||||
form: {
|
form: {
|
||||||
name: '',
|
name: '',
|
||||||
region: '',
|
region: '',
|
||||||
@ -124,11 +166,73 @@ export default {
|
|||||||
},
|
},
|
||||||
formLabelWidth: '120px',
|
formLabelWidth: '120px',
|
||||||
dialogFormVisible:false,
|
dialogFormVisible:false,
|
||||||
value:'false',
|
value:false,
|
||||||
|
value1:true,
|
||||||
labelPosition: 'right',
|
labelPosition: 'right',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
// 修改支付配置信息
|
||||||
|
editOilConfig(id){
|
||||||
|
this.dialogFormVisible = true;
|
||||||
|
oilConfigInfo(id).then( response => {
|
||||||
|
this.form = response.data
|
||||||
|
console.log(response)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 修改启用状态
|
||||||
|
changeStatus(){
|
||||||
|
if (this.value){
|
||||||
|
this.value1 = false;
|
||||||
|
isOpenOilConfig(1).then( response => {})
|
||||||
|
}else {
|
||||||
|
this.value1 = true;
|
||||||
|
isOpenOilConfig(0).then( response => {})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
changeStatus1(){
|
||||||
|
if (this.value1){
|
||||||
|
this.value = false;
|
||||||
|
isOpenOilConfig(0).then( response => {})
|
||||||
|
}else {
|
||||||
|
this.value = true;
|
||||||
|
isOpenOilConfig(1).then( response => {})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 修改商户使用状态
|
||||||
|
editStatus(data,isUse){
|
||||||
|
this.$confirm('确定将当前支付配置切换为商户号('+data.mchntCd+')吗?切换后实时生效!', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
data.isUse = isUse
|
||||||
|
editMerchant(data).then( response => {})
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: '支付通道切换成功,已实时切换为商户号('+data.mchntCd+')'
|
||||||
|
});
|
||||||
|
this.getList();
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
// 获取商户列表信息
|
||||||
|
getList(){
|
||||||
|
listMerchant().then( response => {
|
||||||
|
this.merchantList = response.data;
|
||||||
|
this.merchantList.forEach(item => {
|
||||||
|
if (item.isOpenRule == "1"){
|
||||||
|
this.value1 = false;
|
||||||
|
this.value = true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
listOilConfig().then( response => {
|
||||||
|
this.oilConfigList = response.data;
|
||||||
|
})
|
||||||
|
},
|
||||||
open() {
|
open() {
|
||||||
this.$confirm('此操作会发布件, 是否继续?', '提示', {
|
this.$confirm('此操作会发布件, 是否继续?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
|
@ -66,21 +66,26 @@
|
|||||||
|
|
||||||
<el-card class="card">
|
<el-card class="card">
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="21">
|
||||||
|
<span style="font-size: 18px">等级规则</span>
|
||||||
|
<span style="font-size: 14px">(最多支持20个等级)</span>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="3">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
>新增会员等级</el-button>
|
>新增会员等级</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
|
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
|
||||||
<el-table-column label="等级" prop="grade" width="55"/>
|
<el-table-column label="等级" prop="grade" width="55"/>
|
||||||
<el-table-column label="等级名称" align="center" prop="name" />
|
<el-table-column label="等级名称" align="center" prop="name" />
|
||||||
<el-table-column label="汽油成长值" align="center" prop="gasoline" />
|
<el-table-column label="成长值" align="center" prop="growthValue" />
|
||||||
<el-table-column label="柴油成长值" align="center" prop="dieselOil" />
|
<!-- <el-table-column label="汽油成长值" align="center" prop="gasoline" />-->
|
||||||
<el-table-column label="天然气成长值" align="center" prop="naturalGas" />
|
<!-- <el-table-column label="柴油成长值" align="center" prop="dieselOil" />-->
|
||||||
|
<!-- <el-table-column label="天然气成长值" align="center" prop="naturalGas" />-->
|
||||||
<!-- <el-table-column label="升级条件值" align="center" prop="catchValue">-->
|
<!-- <el-table-column label="升级条件值" align="center" prop="catchValue">-->
|
||||||
<!-- <template slot-scope="scope">-->
|
<!-- <template slot-scope="scope">-->
|
||||||
<!-- <span v-if="scope.row.catchValue > 0">-->
|
<!-- <span v-if="scope.row.catchValue > 0">-->
|
||||||
@ -112,7 +117,7 @@
|
|||||||
<dict-tag :options="dict.type.yhlx" :value="scope.row.preferential"/>
|
<dict-tag :options="dict.type.yhlx" :value="scope.row.preferential"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="特权信息" width="180">
|
<el-table-column label="特权信息">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div v-show="scope.row.preferential=='自定义优惠'">
|
<div v-show="scope.row.preferential=='自定义优惠'">
|
||||||
<p>
|
<p>
|
||||||
@ -181,7 +186,9 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.zhzt" :value="scope.row.status"/>
|
<!-- <dict-tag :options="dict.type.zhzt" :value="scope.row.status"/>-->
|
||||||
|
<el-tag v-if="scope.row.status == 'qy'">启用</el-tag>
|
||||||
|
<el-tag v-else type="info">禁用</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
@ -230,37 +237,40 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="所需成长值" prop="gasoline">
|
<el-form-item label="所需成长值" prop="growthValue">
|
||||||
<e-row>
|
<el-input v-model="form.growthValue" placeholder="1">
|
||||||
<el-col :span="8">
|
<template slot="append">成长值</template>
|
||||||
<el-form-item prop="gasoline">
|
</el-input>
|
||||||
<el-input v-model="form.gasoline" placeholder="1">
|
<!-- <e-row>-->
|
||||||
<template slot="prepend">汽油</template>
|
<!-- <el-col :span="8">-->
|
||||||
<template slot="append">成长值</template>
|
<!-- <el-form-item prop="gasoline">-->
|
||||||
</el-input>
|
<!-- <el-input v-model="form.gasoline" placeholder="1">-->
|
||||||
</el-form-item>
|
<!-- <template slot="prepend">汽油</template>-->
|
||||||
</el-col>
|
<!-- <template slot="append">成长值</template>-->
|
||||||
</e-row>
|
<!-- </el-input>-->
|
||||||
<e-row>
|
<!-- </el-form-item>-->
|
||||||
<el-col :span="8">
|
<!-- </el-col>-->
|
||||||
<el-form-item prop="dieselOil">
|
<!-- </e-row>-->
|
||||||
<el-input v-model="form.dieselOil" placeholder="1">
|
<!-- <e-row>-->
|
||||||
<template slot="prepend">柴油</template>
|
<!-- <el-col :span="8">-->
|
||||||
<template slot="append">成长值</template>
|
<!-- <el-form-item prop="dieselOil">-->
|
||||||
</el-input>
|
<!-- <el-input v-model="form.dieselOil" placeholder="1">-->
|
||||||
</el-form-item>
|
<!-- <template slot="prepend">柴油</template>-->
|
||||||
</el-col>
|
<!-- <template slot="append">成长值</template>-->
|
||||||
</e-row>
|
<!-- </el-input>-->
|
||||||
<e-row>
|
<!-- </el-form-item>-->
|
||||||
<el-col :span="8">
|
<!-- </el-col>-->
|
||||||
<el-form-item prop="naturalGas">
|
<!-- </e-row>-->
|
||||||
<el-input v-model="form.naturalGas" placeholder="1">
|
<!-- <e-row>-->
|
||||||
<template slot="prepend">天然气</template>
|
<!-- <el-col :span="8">-->
|
||||||
<template slot="append">成长值</template>
|
<!-- <el-form-item prop="naturalGas">-->
|
||||||
</el-input>
|
<!-- <el-input v-model="form.naturalGas" placeholder="1">-->
|
||||||
</el-form-item>
|
<!-- <template slot="prepend">天然气</template>-->
|
||||||
</el-col>
|
<!-- <template slot="append">成长值</template>-->
|
||||||
</e-row>
|
<!-- </el-input>-->
|
||||||
|
<!-- </el-form-item>-->
|
||||||
|
<!-- </el-col>-->
|
||||||
|
<!-- </e-row>-->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.fuint.api.fuyou.controller;
|
||||||
|
|
||||||
|
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||||
|
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||||
|
import com.fuint.framework.web.BaseController;
|
||||||
|
import com.fuint.framework.web.ResponseObject;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户配置信息 controller层
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/merchantConfig")
|
||||||
|
public class MerchantConfigController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private MerchantConfigService merchantConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商户列表信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public ResponseObject list(){
|
||||||
|
List<MerchantConfig> list = merchantConfigService.selectMerchList();
|
||||||
|
return getSuccessResult(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商户使用状态
|
||||||
|
* @param merchantConfig
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PutMapping
|
||||||
|
public ResponseObject edit(@Validated @RequestBody MerchantConfig merchantConfig){
|
||||||
|
int row = merchantConfigService.updateMerchStatus(merchantConfig);
|
||||||
|
return getSuccessResult(row);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.fuint.api.fuyou.controller;
|
||||||
|
|
||||||
|
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||||
|
import com.fuint.api.fuyou.service.OilConfigService;
|
||||||
|
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.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付配置信息 controller层
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/oilConfig")
|
||||||
|
public class OilConfigController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private OilConfigService oilConfigService;
|
||||||
|
@Autowired
|
||||||
|
private MerchantConfigService merchantConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询支付配置信息列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public ResponseObject list(){
|
||||||
|
return getSuccessResult(oilConfigService.selectOilConfigList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看支付配置规则是否开启
|
||||||
|
* @param isOpen
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/{isOpen}")
|
||||||
|
public ResponseObject isOpen(@PathVariable String isOpen){
|
||||||
|
if (isOpen.equals("1")){
|
||||||
|
oilConfigService.oilRule();
|
||||||
|
}else {
|
||||||
|
merchantConfigService.updateMerchIsOpen("0");
|
||||||
|
}
|
||||||
|
return getSuccessResult(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询支付配置信息
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/info/{id}")
|
||||||
|
public ResponseObject oilConfigInfo(@PathVariable Integer id){
|
||||||
|
return getSuccessResult(oilConfigService.selectOilConfigById(id));
|
||||||
|
}
|
||||||
|
}
|
@ -50,6 +50,10 @@ public class MerchantConfig extends BaseEntity implements Serializable {
|
|||||||
* 私钥
|
* 私钥
|
||||||
*/
|
*/
|
||||||
private String privateKey;
|
private String privateKey;
|
||||||
|
/**
|
||||||
|
* 是否使用当前账户收款:0不使用,1使用
|
||||||
|
*/
|
||||||
|
private String isUse;
|
||||||
/**
|
/**
|
||||||
* 是否开启规则:0不开启,1开启
|
* 是否开启规则:0不开启,1开启
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.fuint.api.fuyou.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (OilConfig)实体类 支付配置规则表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("oil_config")
|
||||||
|
@ApiModel(value = "OilConfig对象", description = "支付配置规则表")
|
||||||
|
public class OilConfig implements Serializable {
|
||||||
|
private static final long serialVersionUID = -72940523083738137L;
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 油站id
|
||||||
|
*/
|
||||||
|
private Integer storeId;
|
||||||
|
/**
|
||||||
|
* 商户配置id
|
||||||
|
*/
|
||||||
|
private Integer merchConfigId;
|
||||||
|
/**
|
||||||
|
* 交易占比
|
||||||
|
*/
|
||||||
|
private Integer proportion;
|
||||||
|
/**
|
||||||
|
* key值
|
||||||
|
*/
|
||||||
|
private String keyStr;
|
||||||
|
/**
|
||||||
|
* value值
|
||||||
|
*/
|
||||||
|
private String valueStr;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.fuint.api.fuyou.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.fuint.api.fuyou.entity.OilConfig;
|
||||||
|
import com.fuint.api.fuyou.vo.OilConfigVo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付配置信息 Mapper层
|
||||||
|
*/
|
||||||
|
public interface OilConfigMapper extends BaseMapper<OilConfig> {
|
||||||
|
/**
|
||||||
|
* 查询油品配置列表信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<OilConfigVo> selectOilConfigList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询支付配置信息
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public OilConfigVo selectOilConfigById(@Param("id") int id);
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
<?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.api.fuyou.mapper.OilConfigMapper">
|
||||||
|
<sql id="selectOilConfig">
|
||||||
|
select oc.*,mc.mchnt_cd,mc.merchant_name from oil_config oc
|
||||||
|
inner join merchant_config mc on oc.merch_config_id = mc.id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectOilConfigList" resultType="com.fuint.api.fuyou.vo.OilConfigVo">
|
||||||
|
<include refid="selectOilConfig"></include>
|
||||||
|
</select>
|
||||||
|
<select id="selectOilConfigById" resultType="com.fuint.api.fuyou.vo.OilConfigVo" parameterType="int">
|
||||||
|
<include refid="selectOilConfig"></include>
|
||||||
|
<where>
|
||||||
|
oc.id = #{id}
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -3,14 +3,56 @@ package com.fuint.api.fuyou.service;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商户配置信息 业务层
|
* 商户配置信息 业务层
|
||||||
*/
|
*/
|
||||||
public interface MerchantConfigService extends IService<MerchantConfig> {
|
public interface MerchantConfigService extends IService<MerchantConfig> {
|
||||||
/**
|
/**
|
||||||
* 根据店铺id查询商户信息
|
* 根据店铺id查询商户信息
|
||||||
* @param storeId
|
* @param isUse
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public MerchantConfig selectMeChByStoreId(int storeId);
|
public MerchantConfig selectMeChByIsUse(String isUse);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据店铺id查询商户信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<MerchantConfig> selectMeChByIsOpen();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有商户配置信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<MerchantConfig> selectMerchList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询商户信息
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public MerchantConfig selectMerchById(int id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商户使用状态
|
||||||
|
* @param merchantConfig
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int updateMerch(MerchantConfig merchantConfig);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商户使用状态
|
||||||
|
* @param merchantConfig
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int updateMerchStatus(MerchantConfig merchantConfig);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商户是否开启支付规则状态
|
||||||
|
* @param isOpenRule
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int updateMerchIsOpen(String isOpenRule);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.fuint.api.fuyou.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.fuint.api.fuyou.entity.OilConfig;
|
||||||
|
import com.fuint.api.fuyou.vo.OilConfigVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付配置信息 业务层
|
||||||
|
*/
|
||||||
|
public interface OilConfigService extends IService<OilConfig> {
|
||||||
|
/**
|
||||||
|
* 规则配置
|
||||||
|
*/
|
||||||
|
public void oilRule();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询油品配置信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<OilConfigVo> selectOilConfigList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询支付配置信息
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public OilConfigVo selectOilConfigById(int id);
|
||||||
|
}
|
@ -5,19 +5,76 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||||
import com.fuint.api.fuyou.mapper.MerchantConfigMapper;
|
import com.fuint.api.fuyou.mapper.MerchantConfigMapper;
|
||||||
import com.fuint.api.fuyou.service.MerchantConfigService;
|
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||||
|
import com.fuint.common.dto.AccountInfo;
|
||||||
|
import com.fuint.common.util.TokenUtil;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商户配置信息 业务层
|
* 商户配置信息 业务层
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class MerchantConfigServiceImpl extends ServiceImpl<MerchantConfigMapper, MerchantConfig> implements MerchantConfigService {
|
public class MerchantConfigServiceImpl extends ServiceImpl<MerchantConfigMapper, MerchantConfig> implements MerchantConfigService {
|
||||||
@Override
|
@Override
|
||||||
public MerchantConfig selectMeChByStoreId(int storeId) {
|
public MerchantConfig selectMeChByIsUse(String isUse) {
|
||||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("store_id",storeId);
|
queryWrapper.eq("is_use",isUse);
|
||||||
queryWrapper.eq("is_open_rule",0);
|
|
||||||
MerchantConfig merchantConfig = baseMapper.selectOne(queryWrapper);
|
MerchantConfig merchantConfig = baseMapper.selectOne(queryWrapper);
|
||||||
return merchantConfig;
|
return merchantConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MerchantConfig> selectMeChByIsOpen() {
|
||||||
|
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("is_open_rule","1");
|
||||||
|
List list = baseMapper.selectList(queryWrapper);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MerchantConfig> selectMerchList() {
|
||||||
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
|
Integer storeId = nowAccountInfo.getStoreId();
|
||||||
|
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("store_id",storeId);
|
||||||
|
List list = baseMapper.selectList(queryWrapper);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MerchantConfig selectMerchById(int id) {
|
||||||
|
MerchantConfig merchantConfig = baseMapper.selectById(id);
|
||||||
|
return merchantConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateMerch(MerchantConfig merchantConfig) {
|
||||||
|
int row = baseMapper.updateById(merchantConfig);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateMerchStatus(MerchantConfig merchantConfig) {
|
||||||
|
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("is_use",1);
|
||||||
|
List<MerchantConfig> list = baseMapper.selectList(queryWrapper);
|
||||||
|
for (MerchantConfig config : list) {
|
||||||
|
config.setIsUse("0");
|
||||||
|
baseMapper.updateById(config);
|
||||||
|
}
|
||||||
|
int row = baseMapper.updateById(merchantConfig);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateMerchIsOpen(String isOpenRule) {
|
||||||
|
List<MerchantConfig> list = baseMapper.selectList(null);
|
||||||
|
int row = 0;
|
||||||
|
for (MerchantConfig merchantConfig : list) {
|
||||||
|
merchantConfig.setIsOpenRule(isOpenRule);
|
||||||
|
row = baseMapper.updateById(merchantConfig);
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.fuint.api.fuyou.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||||
|
import com.fuint.api.fuyou.entity.OilConfig;
|
||||||
|
import com.fuint.api.fuyou.mapper.OilConfigMapper;
|
||||||
|
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||||
|
import com.fuint.api.fuyou.service.OilConfigService;
|
||||||
|
import com.fuint.api.fuyou.vo.OilConfigVo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付配置信息 业务层
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OilConfigServiceImpl extends ServiceImpl<OilConfigMapper, OilConfig> implements OilConfigService {
|
||||||
|
@Autowired
|
||||||
|
private MerchantConfigService merchantConfigService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void oilRule() {
|
||||||
|
List<OilConfig> list = baseMapper.selectList(null);
|
||||||
|
Double amountAll = 0.0;
|
||||||
|
// 百分占比
|
||||||
|
List<Double> proList = new ArrayList<>();
|
||||||
|
// radio
|
||||||
|
List<Double> radioList = new ArrayList<>();
|
||||||
|
// 距离
|
||||||
|
List<Double> distanceList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
MerchantConfig merchantConfig = merchantConfigService.selectMerchById(list.get(i).getMerchConfigId());
|
||||||
|
amountAll += merchantConfig.getAmount();
|
||||||
|
proList.add((double) (list.get(i).getProportion()/100));
|
||||||
|
radioList.add(merchantConfig.getAmount()/amountAll);
|
||||||
|
distanceList.add(proList.get(i) - radioList.get(i));
|
||||||
|
}
|
||||||
|
int index = 0;
|
||||||
|
Double max = Collections.max(distanceList);
|
||||||
|
for (int i = 0; i<distanceList.size(); i++) {
|
||||||
|
if (distanceList.get(i)==max){
|
||||||
|
index = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MerchantConfig merchantConfig = merchantConfigService.selectMerchById(list.get(index).getMerchConfigId());
|
||||||
|
merchantConfig.setIsUse("1");
|
||||||
|
merchantConfig.setIsOpenRule("1");
|
||||||
|
merchantConfigService.updateMerch(merchantConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OilConfigVo> selectOilConfigList() {
|
||||||
|
List<OilConfigVo> oilConfigs = baseMapper.selectOilConfigList();
|
||||||
|
return oilConfigs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OilConfigVo selectOilConfigById(int id) {
|
||||||
|
OilConfigVo oilConfigVo = baseMapper.selectOilConfigById(id);
|
||||||
|
return oilConfigVo;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.fuint.api.fuyou.vo;
|
||||||
|
|
||||||
|
import com.fuint.api.fuyou.entity.OilConfig;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OilConfigVo extends OilConfig {
|
||||||
|
private String merchantName;
|
||||||
|
private String mchntCd;
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额变化记录表(CardBalanceChange)实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("card_balance_change")
|
||||||
|
@ApiModel(value = "CardBalanceChange对象", description = "余额变化记录表")
|
||||||
|
public class CardBalanceChange 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 Double balance;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.fuint.business.order.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.fuint.business.order.entity.CardBalanceChange;
|
||||||
|
|
||||||
|
public interface CardBalanceChangeMapper extends BaseMapper<CardBalanceChange> {
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.fuint.business.order.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.fuint.business.order.entity.CardBalanceChange;
|
||||||
|
|
||||||
|
public interface CardBalanceChangeService extends IService<CardBalanceChange> {
|
||||||
|
/**
|
||||||
|
* 添加用户余额变化信息
|
||||||
|
* @param cardBalanceChange
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int insertCardBalance(CardBalanceChange cardBalanceChange);
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.fuint.business.order.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.fuint.business.order.entity.CardBalanceChange;
|
||||||
|
import com.fuint.business.order.mapper.CardBalanceChangeMapper;
|
||||||
|
import com.fuint.business.order.service.CardBalanceChangeService;
|
||||||
|
import com.fuint.common.dto.AccountInfo;
|
||||||
|
import com.fuint.common.util.TokenUtil;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CardBalanceChangeServiceImpl extends ServiceImpl<CardBalanceChangeMapper, CardBalanceChange> implements CardBalanceChangeService {
|
||||||
|
@Override
|
||||||
|
public int insertCardBalance(CardBalanceChange cardBalanceChange) {
|
||||||
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
|
Integer storeId = nowAccountInfo.getStoreId();
|
||||||
|
cardBalanceChange.setStoreId(storeId);
|
||||||
|
int row = baseMapper.insert(cardBalanceChange);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
}
|
@ -10,20 +10,22 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||||
import com.fuint.api.fuyou.service.FyPayService;
|
import com.fuint.api.fuyou.service.FyPayService;
|
||||||
import com.fuint.api.fuyou.service.MerchantConfigService;
|
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||||
import com.fuint.business.order.entity.CashierOrder;
|
import com.fuint.api.fuyou.service.OilConfigService;
|
||||||
import com.fuint.business.order.entity.LJOrder;
|
import com.fuint.business.order.entity.*;
|
||||||
import com.fuint.business.order.entity.OilOrder;
|
|
||||||
import com.fuint.business.order.entity.OrderGoods;
|
|
||||||
import com.fuint.business.order.mapper.OilOrderMapper;
|
import com.fuint.business.order.mapper.OilOrderMapper;
|
||||||
import com.fuint.business.order.service.CashierOrderService;
|
import com.fuint.business.order.service.*;
|
||||||
import com.fuint.business.order.service.LJOrderService;
|
|
||||||
import com.fuint.business.order.service.OilOrderService;
|
|
||||||
import com.fuint.business.order.service.OrderGoodsService;
|
|
||||||
import com.fuint.business.order.vo.OilOrderVo;
|
import com.fuint.business.order.vo.OilOrderVo;
|
||||||
|
import com.fuint.business.petrolStationManagement.entity.OilName;
|
||||||
|
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
||||||
|
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.entity.UserBalance;
|
||||||
|
import com.fuint.business.userManager.service.LJUserGradeService;
|
||||||
|
import com.fuint.business.userManager.service.LJUserService;
|
||||||
import com.fuint.business.userManager.service.UserBalanceService;
|
import com.fuint.business.userManager.service.UserBalanceService;
|
||||||
import com.fuint.common.dto.AccountInfo;
|
import com.fuint.common.dto.AccountInfo;
|
||||||
import com.fuint.common.util.TokenUtil;
|
import com.fuint.common.util.TokenUtil;
|
||||||
|
import com.fuint.system.config.service.SysConfigService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -44,6 +46,12 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
|||||||
private UserBalanceService userBalanceService;
|
private UserBalanceService userBalanceService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CashierOrderService cashierOrderService;
|
private CashierOrderService cashierOrderService;
|
||||||
|
@Autowired
|
||||||
|
private OilNameService oilNameService;
|
||||||
|
@Autowired
|
||||||
|
private CardBalanceChangeService cardBalanceChangeService;
|
||||||
|
@Autowired
|
||||||
|
private OilConfigService oilConfigService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<OilOrder> selectOilOrderList(Page page, OilOrder order) {
|
public IPage<OilOrder> selectOilOrderList(Page page, OilOrder order) {
|
||||||
@ -114,13 +122,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
|||||||
// 会员id
|
// 会员id
|
||||||
userId = Integer.valueOf(map.get("userId"));
|
userId = Integer.valueOf(map.get("userId"));
|
||||||
|
|
||||||
// 根据用户id查询用户余额信息
|
this.insertCardBalance(consumeAmount,userId);
|
||||||
UserBalance balance = userBalanceService.selectUserBalance(userId);
|
|
||||||
// 修改余额信息
|
|
||||||
double beforeBalance = balance.getCardBalance();
|
|
||||||
double afterBalance = beforeBalance - consumeAmount;
|
|
||||||
balance.setCardBalance(afterBalance);
|
|
||||||
userBalanceService.updateUserBalance(balance);
|
|
||||||
}
|
}
|
||||||
// 优惠券id
|
// 优惠券id
|
||||||
Integer couponId = null;
|
Integer couponId = null;
|
||||||
@ -190,6 +192,9 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
|||||||
order.setOrderNo(orderNo+"1");
|
order.setOrderNo(orderNo+"1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (userId!=null){
|
||||||
|
this.updateGrowthValue(oilActualPay, userId, Integer.valueOf(jsonObjects.get(i).get("oilName").toString()));
|
||||||
|
}
|
||||||
order.setStoreId(storeId);
|
order.setStoreId(storeId);
|
||||||
order.setUserId(userId);
|
order.setUserId(userId);
|
||||||
order.setCouponId(couponId);
|
order.setCouponId(couponId);
|
||||||
@ -253,8 +258,13 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
|||||||
// 如果金额不等于0调用第三方支付接口
|
// 如果金额不等于0调用第三方支付接口
|
||||||
if (!map.get("allAmount").equals("0") && !map.get("payType").equals("CASH")){
|
if (!map.get("allAmount").equals("0") && !map.get("payType").equals("CASH")){
|
||||||
Integer allAmount = (int) (Double.valueOf(map.get("allAmount"))*100);
|
Integer allAmount = (int) (Double.valueOf(map.get("allAmount"))*100);
|
||||||
// 根据店铺id查询商户配置信息
|
// 判断是否开启支付规则
|
||||||
MerchantConfig merchantConfig = merchantConfigService.selectMeChByStoreId(storeId);
|
List<MerchantConfig> list = merchantConfigService.selectMeChByIsOpen();
|
||||||
|
if (list.size()>0){
|
||||||
|
oilConfigService.oilRule();
|
||||||
|
}
|
||||||
|
// 根据店铺id查询商户配置信息
|
||||||
|
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1");
|
||||||
// 处理支付需要的数据
|
// 处理支付需要的数据
|
||||||
Map<String,String> map1 = new HashMap<>();
|
Map<String,String> map1 = new HashMap<>();
|
||||||
map1.put("authCode",map.get("authCode"));
|
map1.put("authCode",map.get("authCode"));
|
||||||
@ -295,4 +305,95 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
|||||||
int row = baseMapper.updateById(order);
|
int row = baseMapper.updateById(order);
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysConfigService sysConfigService;
|
||||||
|
@Autowired
|
||||||
|
private LJUserService userService;
|
||||||
|
@Autowired
|
||||||
|
private LJUserGradeService userGradeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户成长值信息
|
||||||
|
*/
|
||||||
|
private void updateGrowthValue(Double oilActualPay,Integer userid,Integer oilId){
|
||||||
|
if (oilId!=null){
|
||||||
|
OilName oilName = oilNameService.selectOilNameById(oilId);
|
||||||
|
// 获取成长值增长数值
|
||||||
|
Integer gasGrowthValue = null;
|
||||||
|
Integer dieselGrowthValue = null;
|
||||||
|
Integer naturalGrowthValue = null;
|
||||||
|
// 根据id查询会员信息 获取会员当前成长值数据
|
||||||
|
LJUser user = userService.selectUserById(userid);
|
||||||
|
int growth = user.getGrowthValue();
|
||||||
|
// 查询会员等级列表信息
|
||||||
|
Page page = new Page(1,20);
|
||||||
|
LJUserGrade ljUserGrade1 = new LJUserGrade();
|
||||||
|
IPage<LJUserGrade> ljUserGradeIPage = userGradeService.selectUserGradeList(page, ljUserGrade1);
|
||||||
|
List<LJUserGrade> records = ljUserGradeIPage.getRecords();
|
||||||
|
if (oilName.getOilType().equals("汽油")){
|
||||||
|
gasGrowthValue = Integer.valueOf(sysConfigService.getValueByKey("gas_growth_value"));
|
||||||
|
Integer addVal = (int) (gasGrowthValue * oilActualPay);
|
||||||
|
Integer growthAfter = growth + addVal;
|
||||||
|
// 如果会员成长值达到会员等级成长值,则修改会员的会员等级信息
|
||||||
|
for (int i = 0; i < records.size(); i++){
|
||||||
|
if ((growthAfter-records.get(i).getGrowthValue())<100){
|
||||||
|
user.setGradeId(records.get(i).getId());
|
||||||
|
}
|
||||||
|
if (growthAfter>records.get(records.size()-1).getGrowthValue()){
|
||||||
|
user.setGradeId(records.get(records.size()-1).getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
user.setGrowthValue(growthAfter);
|
||||||
|
}else if(oilName.getOilType().equals("柴油")){
|
||||||
|
dieselGrowthValue = Integer.valueOf(sysConfigService.getValueByKey("diesel_growth_value"));
|
||||||
|
Integer addVal = (int) (dieselGrowthValue * oilActualPay);
|
||||||
|
Integer growthAfter = growth + addVal;
|
||||||
|
// 如果会员成长值达到会员等级成长值,则修改会员的会员等级信息
|
||||||
|
for (int i = 0; i < records.size(); i++){
|
||||||
|
if ((growthAfter-records.get(i).getGrowthValue())<100 && (growthAfter-records.get(i).getGrowthValue())>0){
|
||||||
|
user.setGradeId(records.get(i).getId());
|
||||||
|
}
|
||||||
|
if (growthAfter > records.get(records.size()-1).getGrowthValue()){
|
||||||
|
user.setGradeId(records.get(records.size()-1).getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
user.setGrowthValue(growthAfter);
|
||||||
|
}else{
|
||||||
|
naturalGrowthValue = Integer.valueOf(sysConfigService.getValueByKey("natural_growth_value"));
|
||||||
|
Integer addVal = (int) (naturalGrowthValue * oilActualPay);
|
||||||
|
Integer growthAfter = growth + addVal;
|
||||||
|
// 如果会员成长值达到会员等级成长值,则修改会员的会员等级信息
|
||||||
|
for (int i = 0; i < records.size(); i++){
|
||||||
|
if ((growthAfter-records.get(i).getGrowthValue())<100){
|
||||||
|
user.setGradeId(records.get(i).getId());
|
||||||
|
}
|
||||||
|
if (growthAfter>records.get(records.size()-1).getGrowthValue()){
|
||||||
|
user.setGradeId(records.get(records.size()-1).getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
user.setGrowthValue(growthAfter);
|
||||||
|
}
|
||||||
|
// 修改用户成长值
|
||||||
|
userService.updateUser(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void insertCardBalance(Double amount,Integer userId){
|
||||||
|
// 根据用户id查询用户余额信息
|
||||||
|
UserBalance balance = userBalanceService.selectUserBalance(userId);
|
||||||
|
// 修改余额信息
|
||||||
|
Double beforeBalance = balance.getCardBalance();
|
||||||
|
Double afterBalance = beforeBalance - amount;
|
||||||
|
balance.setCardBalance(afterBalance);
|
||||||
|
userBalanceService.updateUserBalance(balance);
|
||||||
|
// 添加余额记录信息
|
||||||
|
CardBalanceChange cardBalanceChange = new CardBalanceChange();
|
||||||
|
cardBalanceChange.setUserId(userId);
|
||||||
|
cardBalanceChange.setChangeType("0");
|
||||||
|
cardBalanceChange.setFromType("油品订单消费");
|
||||||
|
cardBalanceChange.setBalance(amount);
|
||||||
|
|
||||||
|
cardBalanceChangeService.insertCardBalance(cardBalanceChange);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,11 @@ public class OilNameController extends BaseController {
|
|||||||
return getSuccessResult(oilNameService.oilNameListByType(oilName));
|
return getSuccessResult(oilNameService.oilNameListByType(oilName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询油品信息
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseObject oilNameInfo(@PathVariable Integer id){
|
public ResponseObject oilNameInfo(@PathVariable Integer id){
|
||||||
return getSuccessResult(oilNameService.selectOilNameById(id));
|
return getSuccessResult(oilNameService.selectOilNameById(id));
|
||||||
|
@ -58,7 +58,10 @@ public class LJUser extends BaseEntity implements Serializable {
|
|||||||
private String idcard;
|
private String idcard;
|
||||||
|
|
||||||
@ApiModelProperty("等级ID")
|
@ApiModelProperty("等级ID")
|
||||||
private String gradeId;
|
private Integer gradeId;
|
||||||
|
|
||||||
|
@ApiModelProperty("成长值")
|
||||||
|
private Integer growthValue;
|
||||||
|
|
||||||
@ApiModelProperty("性别 1男,0女")
|
@ApiModelProperty("性别 1男,0女")
|
||||||
private Integer sex;
|
private Integer sex;
|
||||||
|
@ -42,30 +42,12 @@ public class LJUserGrade extends BaseEntity implements Serializable {
|
|||||||
@ApiModelProperty("等级名称")
|
@ApiModelProperty("等级名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty("升级会员等级条件描述")
|
|
||||||
private String catchCondition;
|
|
||||||
|
|
||||||
@ApiModelProperty("升级会员等级条件,init:默认获取;pay:付费升级;frequency:消费次数;amount:累积消费金额升级")
|
|
||||||
private String catchType;
|
|
||||||
|
|
||||||
@ApiModelProperty("达到升级条件的值")
|
|
||||||
private BigDecimal catchValue;
|
|
||||||
|
|
||||||
@ApiModelProperty("会员权益描述")
|
|
||||||
private String userPrivilege;
|
|
||||||
|
|
||||||
@ApiModelProperty("有效期")
|
|
||||||
private Integer validDay;
|
|
||||||
|
|
||||||
@ApiModelProperty("享受折扣")
|
|
||||||
private Float discount;
|
|
||||||
|
|
||||||
@ApiModelProperty("积分加速")
|
|
||||||
private Float speedPoint;
|
|
||||||
|
|
||||||
@ApiModelProperty("状态")
|
@ApiModelProperty("状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
@ApiModelProperty("成长值")
|
||||||
|
private Integer growthValue;
|
||||||
|
|
||||||
@ApiModelProperty("汽油成长值")
|
@ApiModelProperty("汽油成长值")
|
||||||
private Integer gasoline;
|
private Integer gasoline;
|
||||||
|
|
||||||
|
@ -9,18 +9,6 @@
|
|||||||
<include refid="selectUserGrade"></include>
|
<include refid="selectUserGrade"></include>
|
||||||
<where>
|
<where>
|
||||||
store_id = #{userGrade.storeId}
|
store_id = #{userGrade.storeId}
|
||||||
<!-- <if test="userGrade.mobile != null and userGrade.mobile != ''">-->
|
|
||||||
<!-- and mobile like concat('%', #{userGrade.mobile}, '%')-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- <if test="userGrade.userNo != null and userGrade.userNo != ''">-->
|
|
||||||
<!-- and user_no like concat('%', #{userGrade.userNo}, '%')-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- <if test="userGrade.name != null and userGrade.name != ''">-->
|
|
||||||
<!-- and name like concat('%', #{userGrade.name}, '%')-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- <if test="userGrade.gradeId != null and userGrade.gradeId != ''">-->
|
|
||||||
<!-- and grade_id = #{userGrade.gradeId}-->
|
|
||||||
<!-- </if>-->
|
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -42,7 +42,7 @@ public class LJUserVo extends BaseEntity {
|
|||||||
private String idcard;
|
private String idcard;
|
||||||
|
|
||||||
// 等级ID
|
// 等级ID
|
||||||
private String gradeId;
|
private Integer gradeId;
|
||||||
|
|
||||||
// 性别 1男,0女
|
// 性别 1男,0女
|
||||||
@ExcelProperty(value = "性别",converter = GenderConverter.class)
|
@ExcelProperty(value = "性别",converter = GenderConverter.class)
|
||||||
|
@ -982,9 +982,9 @@
|
|||||||
this.map.goodsOrder = JSON.stringify(this.goodsOrder);
|
this.map.goodsOrder = JSON.stringify(this.goodsOrder);
|
||||||
this.map.authCode = this.authCode;
|
this.map.authCode = this.authCode;
|
||||||
this.map.allAmount = this.oilActualPay + this.goodsActualPay;
|
this.map.allAmount = this.oilActualPay + this.goodsActualPay;
|
||||||
|
this.map.consumeAmount = this.consumeAmount;
|
||||||
|
|
||||||
let _this = this;
|
let _this = this;
|
||||||
console.log(this.oilOrder)
|
|
||||||
addLJGoods(_this.map).then( response => {
|
addLJGoods(_this.map).then( response => {
|
||||||
if (response.data.oilOrder!=null){
|
if (response.data.oilOrder!=null){
|
||||||
_this.orderNo = response.data.oilOrder.orderNo;
|
_this.orderNo = response.data.oilOrder.orderNo;
|
||||||
@ -1022,7 +1022,46 @@
|
|||||||
_this.consumeAmount = 0;
|
_this.consumeAmount = 0;
|
||||||
_this.oilTotal = 0;
|
_this.oilTotal = 0;
|
||||||
_this.goodsTotal = 0;
|
_this.goodsTotal = 0;
|
||||||
}
|
};
|
||||||
|
this.map = {
|
||||||
|
allAmount:0,
|
||||||
|
// 用户支付条码信息
|
||||||
|
authCode:'',
|
||||||
|
// 油品订单
|
||||||
|
oilOrder:"",
|
||||||
|
// 商品订单
|
||||||
|
goodsOrder:"",
|
||||||
|
// 支付方式
|
||||||
|
payType:"WECHAT",
|
||||||
|
// 油品订单金额
|
||||||
|
oilAmount:0,
|
||||||
|
// 商品订单金额
|
||||||
|
goodsAmount:0,
|
||||||
|
// 油品实付金额
|
||||||
|
oilActualPay:0,
|
||||||
|
// 商品实付金额
|
||||||
|
goodsActualPay:0,
|
||||||
|
// 付款用户
|
||||||
|
payUser:"",
|
||||||
|
// 油品优惠金额
|
||||||
|
oilDiscount:0,
|
||||||
|
// 商品优惠金额
|
||||||
|
goodsDiscount:0,
|
||||||
|
// 优惠券id
|
||||||
|
couponId:"",
|
||||||
|
// 提成金额
|
||||||
|
commissionAmount:0,
|
||||||
|
// 使用积分数量
|
||||||
|
usePoint:0,
|
||||||
|
// 积分金额
|
||||||
|
pointAmount:0,
|
||||||
|
// 终端
|
||||||
|
terminal:"PC",
|
||||||
|
// 商品数量
|
||||||
|
goodsNum:0,
|
||||||
|
// 会员消费金额(储值卡需要减少的金额)
|
||||||
|
consumeAmount:0,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
// 查询订单支付状态
|
// 查询订单支付状态
|
||||||
queryPayStatus(){
|
queryPayStatus(){
|
||||||
|
Loading…
Reference in New Issue
Block a user