中台处理

This commit is contained in:
wangh 2023-12-22 15:33:38 +08:00
parent 4641b04b65
commit 087ce92cbf
40 changed files with 1783 additions and 169 deletions

View File

@ -60,3 +60,13 @@ export function getCodeImg() {
method: 'get'
})
}
// 单点登录
export function loginVerificationApi(data) {
return request({
url: 'backendApi/store/loginVerification',
method: 'post',
data:data
})
}

View File

@ -3,28 +3,50 @@ import store from './store'
import { Message } from 'element-ui'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import { getToken } from '@/utils/auth'
import {getToken, removeToken, setToken} from '@/utils/auth'
import { isRelogin } from '@/utils/request'
import { loginVerificationApi } from '@/api/login'
// import BigNumber from 'bignumber.js';
NProgress.configure({ showSpinner: false })
const whiteList = ['/login', '/auth-redirect']
router.beforeEach((to, from, next) => {
router.beforeEach(async (to, from, next) => {
NProgress.start()
console.log(to,from,next)
if (to.query.entrance) {
try {
const res = await loginVerificationApi(to.query.entrance);
if (res.data.token) {
setToken(res.data.token);
to.meta.title = "系统首页";
}
} catch (error) {
console.error("An error occurred:", error);
}
}
if (getToken()) {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/
if (to.path === '/login') {
next({ path: '/' })
NProgress.done()
} else {
}else {
console.log("111113",store.getters.roles)
if (store.getters.roles.length === 0) {
console.log("111114")
isRelogin.show = true
// 判断当前用户是否已拉取完user_info信息
store.dispatch('GetInfo').then(() => {
console.log("111116")
isRelogin.show = false
store.dispatch('GenerateRoutes').then(accessRoutes => {
console.log("111117")
// 根据roles权限生成可访问的路由表
router.addRoutes(accessRoutes) // 动态添加可访问路由表
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成

View File

@ -46,6 +46,11 @@ export const constantRoutes = [
component: () => import('@/views/login'),
hidden: true
},
// {
// path: '/jumpInTheMiddleOffice',
// component: () => import('@/views/index'),
// hidden: true
// },
{
path: '/404',
component: () => import('@/views/error/404'),
@ -56,6 +61,20 @@ export const constantRoutes = [
component: () => import('@/views/error/401'),
hidden: true
},
// {
// path: '/jumpInTheMiddleOffice',
// component: Layout,
// redirect: 'index',
// children: [
// {
// path: 'index',
// component: () => import('@/views/index'),
// name: 'Index',
// meta: { title: '系统首页', icon: 'dashboard', affix: true }
// }
// ]
// },
{
path: '',
component: Layout,
@ -201,7 +220,7 @@ Router.prototype.push = function push(location) {
}
export default new Router({
// mode: 'history', // 去掉url中的#
mode: 'history', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})

View File

@ -81,6 +81,8 @@ const user = {
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
console.log("22222223")
const user = res.data.accountInfo
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/avatar.png") : process.env.VUE_APP_BASE_API + user.avatar;
if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
@ -96,9 +98,10 @@ const user = {
commit('SET_STORE_ID', user.storeId)
commit('SET_STORE_NAME', user.storeName)
resolve(res)
}).catch(error => {
reject(error)
})
// .catch(error => {
// reject(error)
// })
})
},

View File

@ -11,7 +11,7 @@ export function setToken(token) {
return Cookies.set(TokenKey, token)
}
export function removeToken() {
export function removeToken() {
return Cookies.remove(TokenKey)
}

View File

@ -76,7 +76,7 @@ export default {
this.getMerchandiseSales()
this.getPrepaidCardSales()
// this.getTunFuelCardSales()
},
methods:{
@ -91,17 +91,22 @@ export default {
this.goodsSum = 0
let dataList = res.data
if (this.goodsRadio === '7天' && dataList.length >= 7) {
dataList = dataList.slice(0, 7);
// dataList = dataList.slice(0, 7);
dataList = dataList.slice(-7);
} else if (this.goodsRadio === '15天' && dataList.length >= 15) {
dataList = dataList.slice(0, 15);
// dataList = dataList.slice(0, 15);
dataList = dataList.slice(-15);
} else if (this.goodsRadio === '30天' && dataList.length >= 30) {
dataList = dataList.slice(0, 30);
// dataList = dataList.slice(0, 30);
dataList = dataList.slice(-30);
}
dataList.forEach(element => {
this.goodsTimeDate.push(parseTime(element.sales_day,'{y}-{m}-{d}'));
this.goodsDate.push(element.total_sales);
this.goodsSum+=element.total_sales
this.goodsSum = parseFloat(this.goodsSum.toFixed(2));
});
this.initChart()
this.goodsLoading = false
@ -120,17 +125,22 @@ export default {
this.cardSum = 0
let dataList = res.data
if (this.cardRadio === '7天' && dataList.length >= 7) {
dataList = dataList.slice(0, 7);
dataList = dataList.slice(-7);
// dataList = dataList.slice(0, 7);
} else if (this.cardRadio === '15天' && dataList.length >= 15) {
dataList = dataList.slice(0, 15);
dataList = dataList.slice(-15);
// dataList = dataList.slice(0, 15);
} else if (this.cardRadio === '30天' && dataList.length >= 30) {
dataList = dataList.slice(0, 30);
dataList = dataList.slice(-30);
// dataList = dataList.slice(0, 30);
}
dataList.forEach(element => {
this.cardTimeDate.push(parseTime(element.sales_day,'{y}-{m}-{d}'));
this.cardDate.push(element.total_sales);
this.cardSum+=element.total_sales
this.cardSum = parseFloat(this.cardSum.toFixed(2));
});
this.getTunFuelCardSales()
// this.changeLabel();
@ -146,11 +156,14 @@ export default {
// this.cardSum = 0
let dataList = res.data
if (this.cardRadio === '7天' && dataList.length >= 7) {
dataList = dataList.slice(0, 7);
// dataList = dataList.slice(0, 7);
dataList = dataList.slice(- 7);
} else if (this.cardRadio === '15天' && dataList.length >= 15) {
dataList = dataList.slice(0, 15);
// dataList = dataList.slice(0, 15);
dataList = dataList.slice(-15);
} else if (this.cardRadio === '30天' && dataList.length >= 30) {
dataList = dataList.slice(0, 30);
// dataList = dataList.slice(0, 30);
dataList = dataList.slice(- 30);
}
dataList.forEach(element => {

View File

@ -46,7 +46,7 @@
<div class="xse">{{item.totalSum}}</div>
</div>
</template>
</div>
</div>
</template>
@ -92,17 +92,25 @@ export default {
this.sum = 0
let dataList = res.data
if (this.radio === '7天' && dataList.length >= 7) {
dataList = dataList.slice(0, 7);
// dataList = dataList.slice(0, 7);
dataList = dataList.slice(-7);
} else if (this.radio === '15天' && dataList.length >= 15) {
dataList = dataList.slice(0, 15);
// dataList = dataList.slice(0, 15);
dataList = dataList.slice(-15);
} else if (this.radio === '30天' && dataList.length >= 30) {
dataList = dataList.slice(0, 30);
// dataList = dataList.slice(0, 30);
dataList = dataList.slice(-30);
}
dataList.forEach(element => {
this.timeDate.push(parseTime(element.sales_day,'{y}-{m}-{d}'));
this.oilDate.push(element.total_sales);
this.sum+=element.total_sales
this.sum = parseFloat(this.sum.toFixed(2));
});
this.initChart()
// this.changeLabel();
@ -130,14 +138,21 @@ export default {
changeLabel() {
if (this.radio === '7天' && this.timeDate.length >= 7) {
this.timeDate = this.timeDate.slice(0, 7);
this.oilDate = this.oilDate.slice(0, 7);
// this.timeDate = this.timeDate.slice(0, 7);
// this.oilDate = this.oilDate.slice(0, 7);
this.timeDate = this.timeDate.slice(-7);
this.oilDate = this.oilDate.slice(-7);
} else if (this.radio === '15天' && this.timeDate.length >= 15) {
this.timeDate = this.timeDate.slice(0, 15);
this.oilDate = this.oilDate.slice(0, 15);
// this.timeDate = this.timeDate.slice(0, 15);
// this.oilDate = this.oilDate.slice(0, 15);
this.timeDate = this.timeDate.slice(-15);
this.oilDate = this.oilDate.slice(-15);
} else if (this.radio === '30天' && this.timeDate.length >= 30) {
this.timeDate = this.timeDate.slice(0, 30);
this.oilDate = this.oilDate.slice(0, 30);
// this.timeDate = this.timeDate.slice(0, 30);
// this.oilDate = this.oilDate.slice(0, 30);
this.timeDate = this.timeDate.slice(-30);
this.oilDate = this.oilDate.slice(-30);
}
this.initChart()
},

View File

@ -1,6 +1,6 @@
<template>
<div class="app-container">
<el-card >
<el-card >
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="礼品名称" prop="giftName">
<el-input
@ -26,8 +26,8 @@
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</el-form>
</el-card>
<el-card style="margin-top: 20px" >
<el-row :gutter="10" class="mb8">
@ -43,7 +43,7 @@
<el-table ref="tables"
v-loading="loading"
:data="dataList"
:default-sort="defaultSort">
:default-sort="defaultSort">
<el-table-column label="分类" align="center" prop="categoryName" width="90px">
<template slot-scope="scope">
{{ scope.row.categoryName==null? '不分类': scope.row.categoryName}}
@ -162,7 +162,7 @@
<el-option
v-for="option in giftCategoryList"
:key="option.id"
:label="option.categoryName"
:value="option.id"
></el-option>
@ -209,7 +209,7 @@
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
<!-- <el-upload
:action="uploadAction"
:action="uploadAction"
list-type="picture-card"
:class="{hide:hideUpload}"
:file-list="uploadFiles"
@ -337,7 +337,7 @@
</el-col>
</el-row>
<el-row :gutter="24" v-if="showList.delivery">
<!-- <el-col :span="8">
@ -416,7 +416,7 @@
<editor @input="handleChildValue" :value.default="dataForm.detailedDescription" :height.default="150"></editor>
</el-form-item>
</el-col>
</el-row>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -531,7 +531,7 @@
<template slot="prepend">-</template>
</el-input>
<el-input v-else="" disabled placeholder="变更为不限制库存" maxlength="30" style="width: 270px;"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -750,7 +750,7 @@ export default {
pageSize: 1000,
isRecovery:0,
},
cvsGoodList:[],
//
@ -771,13 +771,13 @@ export default {
methods: {
getList() {
getGiftApi(this.queryParams).then(res=>{
this.dataList = res.data.records
this.dataList = res.data.records
})
},
submitForm: function() {
let this_ = this
// if (this.dataForm.deliveryMethod.length === 0) {
// this.$message.warning('');
@ -821,14 +821,14 @@ export default {
this.inventoryForm.editInventory = this.inventoryForm.editInventory+1
}
updateGiftInventoryApi(this.inventoryForm).then(res=>{
this.getList();
})
this.openInventory = false
this.resInventoryForm()
},
resInventoryForm() {
@ -848,12 +848,12 @@ export default {
giftAdd() {
this.reset();
this.open = true
this.title = '添加礼品'
this.title = '添加礼品'
this.changeGiftType("优惠券")
this.selectGiftCategory();
this.cardFavorableApi();
this.cardExchangeApi();
},
//
cancel() {
@ -897,20 +897,20 @@ export default {
console.log(" this.dataForm", this.dataForm)
this.open = true;
this.getList();
},
cardFavorableApi () {
getCardFavorableApi().then(res=>{
this.cardFavorableList = res.data.records
this.cardFavorableList = res.data.records
})
},
cardExchangeApi () {
getCardExchangeApi().then(res=>{
this.cardExchangeApiList =res.data.records
this.cardExchangeApiList =res.data.records
})
},
@ -998,7 +998,7 @@ export default {
/**
* 表单
*/
//
initializeForm() {
@ -1010,7 +1010,7 @@ export default {
getGiftCategoryApi(queryParams).then(response => {
this.giftCategoryList = response.data.records;
})
},
//
changeGiftType(newVal) {
@ -1127,11 +1127,11 @@ export default {
}
},
//
handleIsopenSelect() {
// this.$forceUpdate()
this.$forceUpdate()
},
//
handleUploadSuccessCover(file) {
@ -1152,7 +1152,7 @@ export default {
this.giftImages.push(newImage);
},
// handleUploadSuccessGift(file) {
// // let newImage = {
// // name: file.data.original,

View File

@ -38,6 +38,7 @@
"dependencies": {
"@riophae/vue-treeselect": "0.4.0",
"axios": "0.24.0",
"bignumber.js": "^9.1.2",
"clipboard": "2.0.8",
"core-js": "3.25.3",
"echarts": "4.9.0",

View 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,
})
}

View File

@ -0,0 +1,52 @@
import request from '@/utils/request'
// 查询支付规则列表
export function listOilConfig() {
return request({
url: '/api/oilConfig/list',
method: 'get',
})
}
// 是否开启支付规则
export function isOpenOilConfig(data) {
return request({
url: '/api/oilConfig/isOpen',
method: 'post',
data: data
})
}
// 根据id查询支付配置信息
export function oilConfigInfo(id) {
return request({
url: '/api/oilConfig/info/'+id,
method: 'get',
})
}
// 添加支付配置信息
export function addOilConfig(data) {
return request({
url: '/api/oilConfig',
method: 'post',
data: data,
})
}
// 修改支付配置信息
export function editOilConfig(data) {
return request({
url: '/api/oilConfig',
method: 'put',
data: data,
})
}
// 删除支付配置信息
export function delOilConfig(id) {
return request({
url: '/api/oilConfig/'+id,
method: 'delete',
})
}

View File

@ -50,3 +50,32 @@ export function delStaff(id) {
method: 'delete'
})
}
// 查找店铺信息
export function getStoreInfo(id) {
return request({
url: '/backendApi/store/info/' + id,
method: 'get'
})
}
// 修改店铺信息
export function editStoreInfoApi(data) {
return request({
url: '/backendApi/store/editStoreInfo',
method: 'post',
data: data
})
}
// 修改店铺信息
export function singleSignOnApi(data) {
return request({
url: '/backendApi/store/singleSignOn',
method: 'post',
data: data
})
}

View File

@ -0,0 +1,78 @@
import request from '@/utils/request'
// 查询会员列表
export function listUser(query) {
return request({
url: '/business/userManager/user/list',
method: 'get',
params: query
})
}
// 查询会员统计列表
export function listUserStatistic(query) {
return request({
url: '/business/userManager/userStatistic/list',
method: 'get',
params: query
})
}
// 查询会员列表
export function listStatistic(query) {
return request({
url: '/business/userManager/user/statistic',
method: 'get',
params: query
})
}
// 查询会员详细
export function getUser(id) {
return request({
url: '/business/userManager/user/' + id,
method: 'get'
})
}
// 根据手机号查询会员详细
export function getUserMobile(data) {
return request({
url: '/business/userManager/user/mobile' ,
method: 'post',
data: data
})
}
// 新增会员
export function addUser(data) {
return request({
url: '/business/userManager/user',
method: 'post',
data: data
})
}
// 修改会员
export function updateUser(data) {
return request({
url: '/business/userManager/user',
method: 'put',
data: data
})
}
// 删除会员
export function delUser(id) {
return request({
url: '/business/userManager/user/' + id,
method: 'delete'
})
}
//下载示例文件
export function exportUsers() {
return request({
url: '/excel/export',
method: 'get'
})
}

View File

@ -9,7 +9,7 @@ export function listUser(query) {
params: query
})
}
// 查询用户列表
// 查询用户列表 获取部门信息
export function Userlist(id) {
return request({
url: '/system/dept/'+id,
@ -17,12 +17,11 @@ export function Userlist(id) {
})
}
// 查询用户列表
export function jklist(id) {
// 查询校色列表
export function jklist() {
return request({
url: '/backendApi/duty/list',
method: 'get',
})
}
@ -54,10 +53,17 @@ export function updateUser(data) {
}
// 删除用户
// export function delUser(userId) {
// return request({
// url: '/system/user/' + userId,
// method: 'delete'
// })
// }
export function delUser(userId) {
return request({
url: '/system/user/' + userId,
method: 'delete'
url: '/backendApi/account/delete/' + userId,
method: 'get'
})
}

View File

@ -1,5 +1,5 @@
import router from './router'
import store from './store'
import store from '@/store'
import { Message } from 'element-ui'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
@ -12,6 +12,14 @@ const whiteList = ['/login', '/auth-redirect']
router.beforeEach((to, from, next) => {
NProgress.start()
// this.$store.commit('token/setToken', 'your_token_value');
// const currentToken = this.$store.state.token.token;
// 调用 mutations 更新 token
// store.commit('setToken', '');
// 读取状态
// const currentToken = store.state.token;
// console.log('Current Token:', currentToken.token);
if (getToken()) {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/

View File

@ -5,6 +5,7 @@ import user from './modules/user'
import tagsView from './modules/tagsView'
import permission from './modules/permission'
import settings from './modules/settings'
import token from './modules/token'
import getters from './getters'
Vue.use(Vuex)
@ -15,7 +16,8 @@ const store = new Vuex.Store({
user,
tagsView,
permission,
settings
settings,
token
},
getters

View File

@ -0,0 +1,29 @@
const token = {
state: {
token:''
},
mutations: {
setToken: (state, token) => {
state.token = token;
},
getToken: (state, token) => {
state.token = token;
}
},
actions: {
async setTokenAsync({ commit }, token) {
// 这里可以进行异步操作,例如 API 调用等
// 假设你在这里调用了异步 API 获取 token
const response = await api.getToken();
const fetchedToken = response.data.token;
// 提交 mutation 更新 token
commit('setToken', fetchedToken);
},
}
}
export default token

View File

@ -1,18 +1,62 @@
// import Cookies from 'js-cookie'
// const TokenKey = 'Access-Token-Admin'
// const UserKey = 'User-Id'
// export function getToken() {
// return Cookies.get(TokenKey)
// }
// export function setToken(token) {
// return Cookies.set(TokenKey, token)
// }
// export function removeToken() {
// return Cookies.remove(TokenKey)
// }
// export function getUserId() {
// return Cookies.get(UserKey)
// }
// export function setUserId(userId) {
// return Cookies.set(UserKey, userId)
// }
// export function removeUserId() {
// return Cookies.remove(UserKey)
// }
import store from '@/store/index'
import Cookies from 'js-cookie'
const TokenKey = 'Access-Token'
const TokenKey = 'Access-Token-Admin'
const UserKey = 'User-Id'
export function getToken() {
return Cookies.get(TokenKey)
let token
if( store) {
// console.log("store",store.state.token.token)
token = store.state.token.token
}
return token
// const currentToken = store.state.token;
// console.log('Current Token:', currentToken.token);
// console.log("111111111",currentToken)
// return Cookies.get(TokenKey)
// return store.state.token
}
export function setToken(token) {
return Cookies.set(TokenKey, token)
return store.commit('setToken', token);
}
export function removeToken() {
return Cookies.remove(TokenKey)
return store.state.token = ''
}
export function getUserId() {
@ -26,4 +70,3 @@ export function setUserId(userId) {
export function removeUserId() {
return Cookies.remove(UserKey)
}

View File

@ -9,7 +9,9 @@
</el-tab-pane>
<el-tab-pane label="支付配置" name="second">
<peizhi></peizhi>
<!-- <peizhi></peizhi>
-->
<payment></payment>
</el-tab-pane>
<el-tab-pane label="员工管理" name="staff">
<staff></staff>
@ -24,7 +26,8 @@
</template>
<script>
import peizhi from '../components/Service/peizhi'
// import peizhi from '../components/Service/peizhi'
import payment from '../components/Service/payment'
import staff from '../components/Service/staff'
import jcindex from '../components/Service/index'
export default {
@ -35,8 +38,10 @@
activeName: 'first'
};
},
// peizhi
components:{
jcindex, peizhi,staff,
jcindex,staff,payment,
},
created() {
this.id = this.$route.query.id

View File

@ -2,25 +2,25 @@
<div class="app-container">
<el-card >
<el-row :gutter="24">
<el-form ref="form" :model="form" label-width="40px">
<el-form ref="queryParams" :model="queryParams" label-width="40px">
<el-col :span="4">
<el-form-item label="名称">
<el-input v-model="form.name"></el-input>
<el-input v-model="queryParams.storeName"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="状态">
<el-select v-model="form.region" placeholder="店铺状态">
<el-option label="店铺状态一" value="shanghai"></el-option>
<el-option label="店铺状态二" value="beijing"></el-option>
<el-select v-model="queryParams.status" placeholder="店铺状态">
<el-option label="启用" value="qy"></el-option>
<el-option label="禁用" value="jy"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<!-- <el-col :span="4">
<el-form-item label="套餐">
<el-select v-model="form.region" placeholder="店铺套餐">
@ -29,8 +29,8 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
</el-col> -->
<!-- <el-col :span="6">
<el-form-item label="时间">
<el-date-picker
@ -42,9 +42,10 @@
</el-date-picker>
</el-form-item>
</el-col>
</el-col> -->
<el-col :span="4">
<el-button type="primary" icon="el-icon-search">搜索</el-button>
<el-button type="primary" icon="el-icon-search" @click="getlist()">搜索</el-button>
<el-button type="" icon="el-icon-refresh" @click="res()">重置</el-button>
</el-col>
@ -64,8 +65,8 @@
<div class="pur-box" @click="godetails(items.id)">
<el-tag type="success">{{items.status=='qy'?'启用':'禁用'}}</el-tag>
<div class="disper-box">
<div class="box-img">
<!-- <img src="../../assets/images/wl.png" style="width: 96px;height: 96px">-->
<div class="box-img">
<img :src="imagePath + items.logo" style="width: 96px;height: 96px">
</div>
<div >
<div class="title">{{items.name || ''}}</div>
@ -75,11 +76,11 @@
</div>
<div class="box-hui">
<div>联系人</div>
<div>{{items.leaderName || '暂无'}}</div>
<div>{{items.contact || '暂无'}}</div>
</div>
<div class="box-hui">
<div>联系电话</div>
<div>{{items.leaderPhone || '暂无'}}</div>
<div>{{items.phone || '暂无'}}</div>
</div>
</div>
</div>
@ -123,9 +124,13 @@
resource: '',
desc: ''
},
imagePath: process.env.VUE_APP_SERVER_URL,
arrlist:[],
value1:'',
queryParams: {
storeName: '',
status: '',
pageNo: 1,
pageSize: 10,
@ -142,6 +147,17 @@
this.arrlist = res.data.records
})
},
res() {
this.queryParams= {
storeName: '',
status: '',
pageNo: 1,
pageSize: 10,
}
this.getlist()
},
godetails(id){
this.$router.push({
path:'/Service/details',

View File

@ -107,7 +107,7 @@
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createDate" v-if="columns[3].visible" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createDate) }}</span>
<span>{{ scope.row.createTime }}</span>
</template>
</el-table-column>
<el-table-column
@ -203,43 +203,50 @@
</el-col>
</el-row>
<!-- 添加或修改用户配置对话框 -->
<el-dialog :title="title" :visible.sync="open" class="common-dialog" width="600px" append-to-body>
<!-- 添加或修改用户配置对话框 class="common-dialog" -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body :close-on-click-modal="false" >
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24">
<el-form-item label="用户名" prop="accountName">
<el-input v-model="form.accountName" placeholder="请输入用户名" maxlength="50" />
<el-input v-model="form.accountName" placeholder="请输入用户名" maxlength="50" autocomplete="off" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<template v-if="title == '新增用户'">
<el-row>
<el-col :span="24">
<el-form-item v-if="form.id == undefined" label="登录密码" prop="password">
<el-input v-model="form.password" placeholder="请输入登录密码" maxlength="30" show-password/>
<el-input v-model="form.password" placeholder="请输入登录密码" maxlength="30" show-password autocomplete="off"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item v-if="form.id == undefined" label="确认密码" prop="password1">
<el-input v-model="form.password1" placeholder="请输入确认密码" type="password" maxlength="30" show-password/>
<el-input v-model="form.password1" placeholder="请输入确认密码" type="password" maxlength="30" show-password autocomplete="off"/>
</el-form-item>
</el-col>
</el-row>
</template>
<el-row>
<el-col :span="24">
<el-form-item label="真实姓名" prop="realName">
<el-input v-model="form.realName" placeholder="请输入真实姓名" maxlength="30" />
<el-input v-model="form.realName" placeholder="请输入真实姓名" maxlength="30" autocomplete="off"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="状态">
<el-radio-group v-model="form.accountStatus">
<el-radio :key="1" :label="1" :value="1">启用</el-radio>
<el-radio :key="0" :label="0" :value="0">禁用</el-radio>
<el-radio-group v-model="form.accountStatus" @change="$forceUpdate()">
<el-radio :key=1 :label=1 :value=1>启用</el-radio>
<el-radio :key=0 :label=0 :value=0>禁用</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@ -247,12 +254,12 @@
<el-row>
<el-col :span="24">
<el-form-item label="分配角色">
<el-select v-model="form.roleIds" @change="$forceUpdate()" placeholder="请选择角色">
<el-select v-model="form.roleIds" @change="$forceUpdate(),getCodeByRole($event)" placeholder="请选择角色">
<el-option
v-for="item in rolelist"
:key="item.dutyId"
:label="item.dutyName"
:value="item.dutyId"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
@ -268,7 +275,7 @@
</el-dialog>
<!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body :close-on-click-modal="false">
<el-upload
ref="upload"
:limit="1"
@ -385,7 +392,16 @@
//
roleOptions: [],
//
form: {},
form: {
accountName:'',
password:'',
accountStatus:'1',
roleIds:[],
deptId:'',
code:'',
},
deptType:'',
defaultProps: {
checkStrictly : 'true',
children: "childrens",
@ -411,10 +427,10 @@
queryParams: {
pageNum: 1,
pageSize: 10,
userName: undefined,
phonenumber: undefined,
status: undefined,
deptId: undefined
userName: '',
phonenumber: '',
status: '',
deptId: ''
},
//
columns: [
@ -520,12 +536,17 @@
}
},
activecilck(data){
// console.log('',data)
console.log('点树',data)
//
this.queryParams.deptId = data.id
this.deptType = data.deptType
//
if(this.activeName == 'info'){
this.appedit(data.id,data.label)
}
//
if(this.activeName == 'list'){
this.queryParams.deptId = data.id
this.getList();
}
},
@ -537,7 +558,7 @@
}
},
handleChange(value) {
// console.log(value);
console.log(value);
},
handleChanges(value) {
// console.log('',value,this.cascader);
@ -599,19 +620,48 @@
//
//
append(data) {
// console.log('',data)
console.log('新增',data)
//
this.cleanRuleForm()
this.activeName = 'info'
this.pdinfo = 1
this.addNode(data.id,data.label)
// console.log(this.pdinfo)
event.stopPropagation();
//
},
cleanRuleForm() {
this.ruleForm= {
parentId:'',
deptType:'1',
status:'qy',
leader_name:'',
leader_phone:'',
// parentName:'',
deptName: '',
}
},
//
addNode(id,label) {
//
let _this = this
// _this.ruleForm.deptType = '1'
//
Userlist(id).then(res=>{
this.parentName = res.data.parentName
this.ruleForm.parentId = res.data.parentId
})
},
//
appedit(id,label) {
this.pdinfo = 2
//
Userlist(id).then(res=>{
let ancestors = res.data.ancestors.slice(2).toString();
// console.log('Userlist:',res)
console.log('Userlist:',res)
this.parentName = res.data.parentName
this.ruleForm.parentId = res.data.parentId
this.ruleForm.status = res.data.status
@ -677,18 +727,27 @@
</span>);
},
/** 查询用户列表 */
getList() {
async getList() {
console.log("123123123",this.form)
await deptTreeSelect().then(response => {
this.Thetree = response.data
if(this.Thetree.length>0 && !this.queryParams.deptId) {
this.queryParams.deptId = this.Thetree[0].id
this.form.deptType = this.Thetree[0].deptType
console.log("this.Thetree",this.Thetree[0])
}
});
this.loading = true;
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
// this.addDateRange(this.queryParams, this.dateRange)
listUser(this.queryParams).then(response => {
this.userList = response.data.records;
// console.log(response.data)
this.total = response.data.total;
this.total = response.data.total;
this.loading = false;
}
);
deptTreeSelect().then(response => {
this.Thetree = response.data
});
},
// getStaffList() {
@ -724,13 +783,32 @@
//
handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function () {
this.$modal.confirm('确认要"' + text + '""' + row.realName + '"用户吗?').then(function () {
return changeUserStatus(row.userId, row.status);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function () {
row.status = row.status === "0" ? "1" : "0";
});
// scope.row.accountStatus
// this.$confirm('"' + text + '""' + row.realName + '"', '', {
// confirmButtonText: '',
// cancelButtonText: '',
// type: 'warning'
// }).then(() => {
// changeUserStatus(row.userId, row.status).then(res=>{
// this.$message({
// type: 'success',
// message: text+'!'
// });
// })
// }).catch(() => {
// });
},
//
cancel() {
@ -763,10 +841,13 @@
status: "0",
remark: undefined,
postIds: [],
roleIds: []
// roleIds: []
roleIds: ''
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
@ -782,7 +863,8 @@
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.userId);
// this.ids = selection.map(item => item.userId);
this.ids = selection.map(item => item.acctId);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
@ -801,23 +883,39 @@
},
/** 新增按钮操作 */
handleAdd() {
this.open = true
this.open = true
this.title = "新增用户"
this.resetForm()
console.log("this.form",this.form)
jklist().then(res=>{
console.log(res)
this.rolelist = res.data.records
this.rolelist = res.data.content
})
},
resetForm () {
this.form= {
accountName:'',
password:'',
accountStatus:1
}
},
/** 修改按钮操作 */
handleUpdate(row) {
// console.log(row)
console.log('修改用户信息',row)
this.title = '修改用户信息'
const app = this;
app.reset();
app.open = true;
app.form = row
app.form.roleIds = Number(app.form.roleIds);
app.form.password1 = row.password
jklist().then(res=>{
console.log(res)
this.rolelist = res.data.records
this.rolelist = res.data.content
})
@ -825,7 +923,7 @@
},
/** 重置密码按钮操作 */
handleResetPwd(row) {
this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
this.$prompt('请输入"' + row.realName + '"的新密码', "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
closeOnClickModal: false,
@ -847,7 +945,7 @@
submitForm: function () {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.roleIds = [this.form.roleIds]
// this.form.roleIds = [this.form.roleIds]
if (this.form.userId !== undefined) {
updateUser(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
@ -855,6 +953,8 @@
this.getList();
});
} else {
this.form.deptId = this.queryParams.deptId
this.form.deptType = this.deptType
addUser(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
@ -864,10 +964,22 @@
}
});
},
getCodeByRole(value) {
console.log("value",value)
this.rolelist.forEach(res => {
if (res.id == value) {
this.form.code = res.code
}
})
console.log("value22",this.form.code)
},
/** 删除按钮操作 */
handleDelete(row) {
const userIds = row.userId || this.ids;
this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function () {
// const userIds = row.userId || this.ids;
const userIds = row.acctId || this.ids;
// this.$modal.confirm('"' + userIds + '"').then(function () {
this.$modal.confirm('是否确认删除"' + row.realName + '"的数据项?').then(function () {
return delUser(userIds);
}).then(() => {
this.getList();

View File

@ -10,55 +10,230 @@
<!-- <img src="../../assets/images/wl.png" style="width: 96px; height: 96px">-->
<!-- -->
<!-- </div>-->
<div class="block"><el-avatar shape="square" :size="96" :src="squareUrl"></el-avatar></div>
<div class="block">
<el-avatar shape="square" :size="96" :key="fullImagePath" :src="fullImagePath">
</el-avatar>
</div>
<div style="width: 100%">
<div class="dis-box" style="align-items: center;cursor: pointer;margin-bottom: 20px">
<div class="title">{{from.name}}</div>
<div class="lansiez">编辑油站</div>
<div class="lansiez" @click="editInfo()">编辑油站</div>
<div class="lansiez" @click="enterThePetrolStation()">进入油站</div>
</div>
<div class="wrap-box">
<div class="threebox">
<div>油站状态</div>
<div> <el-tag type="success">正常</el-tag></div>
<div v-if="from.status === 'qy'">
<el-tag type="success">正常</el-tag>
</div>
<div v-else>
<el-tag type="danger">停用</el-tag>
</div>
</div>
<div class="threebox">
<div>油站联系人</div>
<div>{{ seeFrom.contact }}</div>
</div>
<div class="threebox">
<div>油站联系方式</div>
<div>{{ seeFrom.phone }}</div>
</div>
<div class="threebox">
<div>油站ID</div>
<div>999</div>
<div>{{ seeFrom.id }}</div>
</div>
<!-- <div class="threebox">-->
<!-- <div>所属用户</div>-->
<!-- <div class="lansiez">编辑</div>-->
<!-- </div>-->
<div class="threebox">
<div>油站创建时间</div>
<div>2023</div>
<div>{{ parseTime(seeFrom.createTime) }}</div>
</div>
<div class="threebox">
<div>套餐到期时间</div>
<div>3023</div>
<div>{{ from.expirationTime?parseTime(seeFrom.expirationTime):"--" }}</div>
</div>
<div class="threebox">
<div>所属套餐</div>
<div>vip</div>
</div>
<div class="threebox">
<div>最后登录时间</div>
<div>2023</div>
</div>
<div class="threebox">
<div>所属区域</div>
<div>山东</div>
<div>地址</div>
<div>{{ seeFrom.address }}</div>
</div>
</div>
</div>
</div>
<div class="bottom-box">
<div class="bottom-box2">
<div style="height: 200px;">
<span class="demonstration" >营业执照</span>
<el-image :src="imagePath+from.license" style="margin-top: 10px;"></el-image>
</div>
<div style="height: 200px; margin-left: 100px;">
<span class="demonstration">门头照</span>
<el-image :src="imagePath+from.doorstepPhoto[0]" style="margin-top: 10px;"></el-image>
</div>
</div>
<!-- <div class="bottom-box">
<div class="bott-box"><el-tag type="info">返回</el-tag></div>
<div class="bott-box"><el-tag>保存</el-tag></div>
<div class="bott-box"><el-tag type="danger">删除油站</el-tag></div>
</div>
</div> -->
<el-dialog title="编辑油站" :visible.sync="editDialog" width="900px" style="padding-right: 10px;">
<el-form :model="from" ref="form" :rules="rules">
<el-row>
<el-col :span="10">
<el-form-item label="油站名称" prop="name" :label-width="formLabelWidth">
<el-input v-model="from.name" autocomplete="off" style="width:220px"></el-input>
</el-form-item>
<el-form-item label="油站联系人" prop="contact" :label-width="formLabelWidth">
<el-input v-model="from.contact" autocomplete="off" style="width:220px"></el-input>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="上传头像" prop="name" :label-width="formLabelWidth">
<el-upload
:action="uploadAction"
list-type="picture-card"
:class="{hide:hideUpload}"
:file-list="uploadFiles"
:auto-upload="true"
:show-file-list="false"
:headers="uploadHeader"
:on-success="handleUploadSuccessLogo">
<img
v-if="this.from.logo"
:src="imagePath + this.from.logo"
class="list-img"
/>
<i v-if="!this.from.logo" class="el-icon-plus"></i>
</el-upload>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<el-form-item label="联系电话" prop="phone" :label-width="formLabelWidth">
<el-input v-model="from.phone" autocomplete="off" style="width:220px"></el-input>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="套餐到期时间" prop="expirationTime" :label-width="formLabelWidth">
<el-date-picker
v-model="from.expirationTime"
type="date"
style="width:220px"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<el-form-item label="店铺地址" prop="address" :label-width="formLabelWidth">
<el-input
style="width:220px"
type="textarea"
:rows="2"
placeholder="请输入地址"
v-model="from.address">
</el-input>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="油站状态" prop="status" :label-width="formLabelWidth">
<el-switch
v-model="from.status"
@change="getswitch"
active-value="qy"
inactive-value="jy"
></el-switch>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="上传营业执照" prop="name" :label-width="formLabelWidth">
<el-upload
:action="uploadAction"
list-type="picture-card"
:class="{hide:hideUpload}"
:file-list="uploadFiles"
:auto-upload="true"
:show-file-list="false"
:headers="uploadHeader"
:on-success="handleUploadSuccessLicence">
<img
v-if="this.from.license"
:src="imagePath + this.from.license"
class="list-img"
/>
<i v-if="!this.from.license" class="el-icon-plus"></i>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="18">
<el-form-item label="上传门头照" prop="name" :label-width="formLabelWidth">
<el-upload
:action="uploadAction"
list-type="picture-card"
:class="{hide:hideUpload}"
:file-list="uploadImages"
:headers="uploadHeader"
:auto-upload="true"
:on-preview="handlePictureCardPreview"
:on-success="handleUploadSuccessGift"
style="height: 100px;"
:on-remove="handleRemove"
:before-upload="beforeUpload"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="editDialog = false"> </el-button>
<el-button type="primary" @click=" edit"> </el-button>
</div>
</el-dialog>
<el-dialog title="收货地址" :visible.sync="dialogFormVisible">
<el-form :model="form">
@ -81,17 +256,74 @@
</template>
<script>
import { Storelist, Storedetails } from "@/api/service/service";
import { Storelist, Storedetails,getStoreInfo,editStoreInfoApi,singleSignOnApi } from "@/api/service/service";
import { parseTime } from "@/utils/fuint";
import BigNumber from 'bignumber.js';
import { getToken } from '@/utils/auth'
export default {
name: 'index',
props: ["id"],
data(){
return{
from:{},
dataForm:{coverImage:''},
//
uploadAction: process.env.VUE_APP_SERVER_URL + 'backendApi/file/upload',
uploadHeader: { 'Access-Token' : getToken() },
//
hideUpload: false,
//
uploadFiles: [
{
name:"nihao",
url:'http://localhost:8008/static/uploadImages/20231103/ffbbe7d3ee1441fdaf706802fa0f176a.png'}
],
imagePath: process.env.VUE_APP_SERVER_URL,
//
uploadImages: [],
dialogImageUrl: "",
dialogVisible: false,
hideUpload: false,
from:{
name: '',
status:'',
expirationTime:'',
address:'',
contact:'',
phone:'',
logo:'',
license:'',
doorstepPhoto:[],
},
seeFrom:{
name: '',
status:'',
expirationTime:'',
address:'',
contact:'',
phone:'',
logo:'',
license:'',
doorstepPhoto:[],
},
squareUrl: "https://cube.elemecdn.com/9/c2/f0ee8a3c7c9638a54940382568c9dpng.png",
dialogFormVisible: false,
editDialog: false,
baseUrl: process.env.VUE_APP_SERVER_URL,
form: {
name: '',
status:'',
expirationTime:'',
address:'',
contact:'',
phone:'',
region: '',
date1: '',
date2: '',
@ -100,24 +332,173 @@
resource: '',
desc: ''
},
formLabelWidth: '120px'
formLabelWidth: '120px',
rules: {
name: [
{ required: true, message: '油站名称不能为空', trigger: 'blur' },
],
contact: [
{ required: true, message: '油站联系人不能为空', trigger: 'blur' },
],
phone: [
{ required: true, message: '联系人电话不能为空', trigger: 'blur' },
],
expirationTime: [
{ type: 'date', required: true, message: '请选择套餐到期时间', trigger: 'change' }
],
}
}
},
computed: {
fullImagePath() {
return this.imagePath + this.from.logo;
}
},
mounted() {
},
created() {
this.getindex()
},
methods:{
editInfo() {
this.editDialog = true
},
//
edit: function () {
this.$refs["form"].validate((valid) => {
if (valid) {
this.from.expirationTime = Date.parse(this.from.expirationTime);
this.from.doorstepPhoto = JSON.stringify(this.from.doorstepPhoto);
// this.from.expirationTime = new Date(this.from.expirationTime).toLocaleString('en-US', { timeZone: 'UTC' });
editStoreInfoApi(this.from).then(res=>{
if(res.code = 200){
}
this.getindex()
})
this.editDialog = false
}
})
},
getindex(){
if(this.id){
Storedetails(this.id).then(res=>{
console.log('详情',res)
if (res.code == 200) {
this.from = res.data
this.seeFrom = res.data
this.uploadImages = []
if (res.data.doorstepPhoto) {
this.from.doorstepPhoto = JSON.parse(res.data.doorstepPhoto);
this.from.doorstepPhoto.forEach(res=> {
let newImage = {
url: this.baseUrl+res,
fileName: res
}
this.uploadImages.push(newImage);
})
}
this.$forceUpdate();
}
})
}else {
console.log('没有id',this.id)
}
},
enterThePetrolStation() {
let number = new BigNumber(this.id)
number = number.plus(1.4)
number = number.times(2.1);
// let id = (this.id + 1.4) * 2.1
singleSignOnApi(number.toString()).then(res=>{
window.open('http://localhost:82/index?entrance='+number.toString())
// '_blank');
})
// token+
},
//
handleUploadSuccessLogo(file) {
this.from.logo = file.data.fileName;
},
handleUploadSuccessLicence(file) {
this.from.license = file.data.fileName;
},
//
//
handleUploadSuccessGift(file) {
let newImage = {
url: process.env.VUE_APP_SERVER_URL + file.data.fileName,
fileName: file.data.fileName
}
if (this.uploadImages == undefined) {
this.uploadImages = [];
}
this.uploadImages.push(newImage);
this.from.doorstepPhoto.push(file.data.fileName);
this.$forceUpdate()
},
handleRemove(file, fileList) {
this.$forceUpdate()
this.hideUpload = true
console.log("qweqweqe",this.hideUpload)
this.uploadImages.forEach((image, index) => {
if (file.url === image.url) {
this.uploadImages.splice(index, 1);
}
});
this.from.doorstepPhoto.forEach((image, index) => {
if (file.fileName == image) {
this.from.doorstepPhoto.splice(index, 1);
}
});
},
handlePictureCardPreview(file) {
console.log(file);
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
beforeUpload(file) {
this.hideUpload = true
// Check if the number of files exceeds 3
if (this.uploadImages.length >= 3) {
this.$message.warning('You can only upload up to three images.');
return false; // Cancel upload
}
return true; // Continue with the upload
},
getswitch(value) {
console.log(value)
},
handleClick(tab, event) {
console.log(tab, event);
@ -167,6 +548,22 @@
font-size: 14px;
margin-bottom: 20px;
}
.bottom-box2{
width: 1400px;
/* position: absolute;
bottom: 0px; */
margin-top: 30px;
margin-bottom: 30px;
height: 350px;
background: rgb(255, 255, 255);
/* background-color: #006cff; */
display: flex;
/* align-items: center; */
justify-content: center;
}
.bottom-box{
width: 1600px;
position: absolute;
@ -185,4 +582,47 @@
.block{
margin-right: 20px;
}
</style>
/* 上传头像 */
.list-img{
width: 100px;
height: 100px;
}
.d-dialog >>> .el-upload--picture-card {
width: 100px;
height: 100px;
line-height: 100px;
}
.d-dialog >>> .avatar-uploader .el-upload {
width: 100px;
height: 100px;
}
.d-dialog >>> .el-upload-list--picture-card .el-upload-list__item {
width: 100px;
height: 100px;
}
.common-dialog >>> .el-upload--picture-card {
width: 60px;
height: 50px;
line-height: 60px;
}
.hide {
/deep/.el-upload--picture-card {
display: none !important;
}
}
/* //去掉过渡动画,不然删除操作的时候,布局会闪一下。 */
/deep/ .el-upload-list__item {
transition: none !important
}
</style>

View File

@ -0,0 +1,430 @@
<template>
<div class="box-centenr">
<div style="width: 100%;display: flex">
<el-alert
title="说明"
type="error"
description="为了保证加油站商户日常在线支付业务的稳定性油客里里目前支持多通道支付
可以有效的避免单支付通道带来不稳定性从而造成油站不能正常支付问题
加油站一旦出现不能正常支付的情况可以随时手工切换支付通道来保证加油站支付收款业务"
:closable="false"
>
</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 class="content-box">
<!-- <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">
<span>{{ item.merchantName }}</span>
<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>商户编号:{{ item.mchntCd }}</div>
</el-card>
</div>
<el-divider></el-divider>
<div class="cont-box">
<div style="width: 40%">
<el-alert
title="使用说明"
type="error"
description="添加/编辑对应的规则->规则配置正常->发布规则->规则生效
注意:功能状态启用且通道规则发布生效后当前功能才有效,否则使用系统单商户号模式"
:closable="false"
>
</el-alert>
</div>
<div style="display: flex;align-items: center">
<div class="mingc">规则周期</div>
<el-radio-group v-model="labelPosition" @input="ruleCycle == labelPosition" size="small">
<el-radio-button label="permanent">永久</el-radio-button>
<el-radio-button label="singleDay">单日</el-radio-button>
</el-radio-group>
<div class="mingc">功能状态</div>
<el-switch
v-model="value"
@change="changeStatus"
>
</el-switch>
</div>
</div>
<div class="cont-box" >
<div><el-button type="primary" icon="el-icon-plus" @click="addOil">添加规则</el-button></div>
<div><el-button type="success" icon="el-icon-s-promotion" @click="open">发布规则</el-button></div>
</div>
<div class="hangbox" v-for="(item,index) in oilConfigList" :key="item.id">
<div>{{index + 1}}.通道</div>
<div class="jiaong">{{ item.merchantName }}</div>
<div> 商户号 </div>
<div class="jiaong">{{ item.mchntCd }}</div>
<!-- <div> 交易满 </div>-->
<div> 交易占比 </div>
<div class="jiaong"> {{ item.proportion }} </div>
<div style="margin-right: 20px"> %更换支付通道 </div>
<!-- <div class="jiaong"> 参与次数不固定次数 </div>-->
<el-button type="primary" icon="el-icon-edit" @click="editOilConfig(item.id)">编辑</el-button>
<el-button type="danger" icon="el-icon-close" @click="deleteOilConfig(item.id)">删除</el-button>
</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>-->
<!--&lt;!&ndash; <div> 交易满 </div>&ndash;&gt;-->
<!-- <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>
<!-- 编辑通道规则-->
<el-dialog title="编辑通道规则" :visible.sync="dialogFormVisible"
width="30%">
<el-form :model="form" ref="form">
<el-form-item label="支付通道" :label-width="formLabelWidth" width="300px">
<el-select v-model="form.merchConfigId"
@change="changeMerch"
:disabled="isDis" placeholder="请选择商户信息">
<el-option v-for="item in merchantList" :key="item.id"
:label="item.merchantName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="商户号" :label-width="formLabelWidth">
<el-input v-model="form.mchntCd" disabled autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="交易占比" :label-width="formLabelWidth">
<el-input v-model="form.proportion" autocomplete="off">
<template slot="append">%</template>
</el-input>
<div>交易占比满足规则后切换到下一个支付通道</div>
</el-form-item>
<!-- <el-form-item label="参与次数" :label-width="formLabelWidth">-->
<!-- <el-radio-group v-model="form.resource" >-->
<!-- <el-radio label="不固定次数"></el-radio>-->
<!-- <el-radio label="固定次数"></el-radio>-->
<!-- </el-radio-group>-->
<!-- <div>是否限制当前配置在生效期间内的参与次数</div>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="排序" :label-width="formLabelWidth">-->
<!-- <el-input-number v-model="form.num" controls-position="right" :min="1" :max="100"></el-input-number>-->
<!-- <div>数值越大顺序越在前</div>-->
<!-- </el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="clearOil"> </el-button>
<el-button type="primary" @click="submitOilConfig"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {editMerchant, listMerchant} from "@/api/payConfig/merchantconfig";
import {
addOilConfig,
delOilConfig,
editOilConfig,
isOpenOilConfig,
listOilConfig,
oilConfigInfo
} from "@/api/payConfig/oilconfig";
import {addUser, getUserMobile, updateUser} from "@/api/staff/user/user";
export default {
name: 'peizhi',
data(){
return{
//
isDis:false,
//
merchantList:[],
//
oilConfigList:[],
//
ruleCycle:"singleDay",
form: {
name: '',
region: '',
date1: '',
date2: '',
num: 1,
delivery: false,
type: [],
resource: '',
desc: ''
},
formLabelWidth: '70px',
dialogFormVisible:false,
value:false,
value1:true,
labelPosition: 'singleDay',
}
},
created() {
this.getList();
},
methods:{
//
deleteOilConfig(id){
this.$confirm('确认删除此通道规则吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delOilConfig(id).then( response => {
this.$message({
type: 'success',
message: '规则数据删除成功'
});
this.getList();
this.value1 = true;
this.changeStatus1();
})
}).catch(() => {});
},
//
addOil(){
this.dialogFormVisible = true;
this.form = {
name: '',
region: '',
date1: '',
date2: '',
num: 1,
delivery: false,
type: [],
resource: '',
desc: ''
}
},
//
changeMerch(val){
this.merchantList.forEach(item => {
if (item.id == val){
this.form.mchntCd = item.mchntCd
}
})
},
//
submitOilConfig(){
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id) {
editOilConfig(this.form).then(response => {
this.$modal.msgSuccess("修改会员成功");
this.getList();
this.dialogFormVisible = false;
this.isDis = false;
});
} else {
addOilConfig(this.form).then( response => {
if (response.data==0){
this.$modal.msgError("已存在当前通道商户号的规则");
}else {
this.$modal.msgSuccess("新增会员成功");
this.getList();
this.dialogFormVisible = false;
this.isDis = false;
}
})
}
}
});
},
//
clearOil(){
this.dialogFormVisible = false;
this.isDis = false;
},
//
editOilConfig(id){
this.isDis = true;
this.dialogFormVisible = true;
oilConfigInfo(id).then( response => {
this.form = response.data
})
},
//
changeStatus(){
if (this.value){
isOpenOilConfig({isOpen:1,ruleCycle:this.ruleCycle}).then( response => {
if (response.data!=1){
this.$message({
type: 'error',
message: '支付通道切换失败,请确保交易占比相加满足百分之百'
});
this.value = false;
this.value1 = true;
}else {
this.$message({
type: 'success',
message: '发布成功!'
});
this.value1 = false;
}
})
}else {
isOpenOilConfig({isOpen:0,ruleCycle:this.ruleCycle}).then( response => {
this.value1 = true;
})
}
},
changeStatus1(){
if (this.value1){
isOpenOilConfig({isOpen:0,ruleCycle:this.ruleCycle}).then( response => {
this.value = false;
})
}else {
isOpenOilConfig({isOpen:1,ruleCycle:this.ruleCycle}).then( response => {
if (response.data!=1){
this.$message({
type: 'error',
message: '支付通道切换失败,请确保交易占比相加满足百分之百'
});
this.value = false;
this.value1 = true;
}else {
this.$message({
type: 'success',
message: '发布成功!'
});
this.value = true;
}
})
}
},
// 使
editStatus(data,isUse){
this.$confirm('确定将当前支付配置切换为商户号('+data.mchntCd+')吗?切换后实时生效!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
data.isUse = isUse
editMerchant(data).then( response => {
this.getList();
this.$message({
type: 'success',
message: '支付通道切换成功,已实时切换为商户号('+data.mchntCd+')'
});
})
}).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() {
this.$confirm('此操作会发布件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.value1 = false;
this.changeStatus1()
}).catch(() => {
this.$message({
type: 'info',
message: '已取消发布'
});
});
}
}
}
</script>
<style scoped>
.box-centenr{
width: 100%;
box-sizing: border-box;
padding: 20px;
}
.content-box{
width: 100%;
display: flex;
flex-wrap: wrap;
margin-top: 20px;
}
.box-card{
width: 24%;
margin-right: 15px;
margin-bottom: 15px;
}
.cont-box{
display: flex;
width: 100%;
justify-content: space-between;
margin: 20px 0px;
}
.hangbox{
width: 100%;
border-bottom: 1px solid #f4f5f6;
display: flex;
align-items: center;
box-sizing: border-box;
padding: 15px 0px;
}
.jiaong{
text-align: center;
box-sizing: border-box;
padding: 5px 20px;
background: #F2F6FC;
color: #409EFF;
font-weight: bold;
margin: 0px 5px;
border-radius: 4px;
}
.mingc{
margin: 0px 10px;
color: #999;
}
.hsize{
color: #999;
}
</style>

View File

@ -210,7 +210,7 @@
GROUP BY
date_range.date
ORDER BY
date_range.date;
date_range.date
</select>
<!-- COUNT(*) AS count-->
<!-- &#45;&#45; and store_id = #{storeId}-->

View File

@ -9,6 +9,7 @@ import com.fuint.common.service.MerchantService;
import com.fuint.common.service.SettingService;
import com.fuint.business.store.service.StoreService;
import com.fuint.common.util.CommonUtil;
import com.fuint.common.util.RedisUtil;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.framework.pagination.PaginationRequest;
@ -21,11 +22,15 @@ import com.fuint.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* 店铺管理类controller
@ -293,4 +298,37 @@ public class BackendStoreController extends BaseController {
StoreDto storeInfo = storeService.queryStoreDtoById(id);
return getSuccessResult(storeInfo);
}
/**
* 修改店铺信息
* @return
* @throws BusinessCheckException
*/
@PostMapping("editStoreInfo")
public ResponseObject editStoreInfo( @RequestBody MtStore mtStore) throws BusinessCheckException {
return getSuccessResult( storeService.editStoreInfo(mtStore));
}
@Autowired
public RedisTemplate redisTemplate;
/**
* 单点登陆时使用
*
* singleSignOn
* @return
*/
@PostMapping("singleSignOn")
public ResponseObject singleSignOn(@RequestBody String flag) {
redisTemplate.opsForValue().set(flag,flag,300, TimeUnit.SECONDS);
// Object codeInRedis = redisTemplate.opsForValue().get(flag);
Boolean aBoolean = redisTemplate.hasKey(flag);
return getSuccessResult(aBoolean);
}
@PostMapping("loginVerification")
public ResponseObject loginVerification(@RequestBody String flag) {
return getSuccessResult(storeService.loginVerification(flag));
}
}

View File

@ -7,6 +7,7 @@ import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuint.repository.model.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -82,4 +83,7 @@ public class MtStore extends BaseEntity implements Serializable {
@ApiModelProperty("门头照")
private String doorstepPhoto;
@ApiModelProperty("服务到期时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date expirationTime;
}

View File

@ -23,4 +23,7 @@ public interface MtStoreMapper extends BaseMapper<MtStore> {
List<StoreDistanceBean> queryByDistance(@Param("merchantId") Integer merchantId, @Param("keyword") String keyword, @Param("latitude") String latitude, @Param("longitude") String longitude);
int editStoreInfo(@Param("mtStore") MtStore mtStore);
// getAccountByRole
}

View File

@ -25,4 +25,18 @@
</if>
ORDER BY distance LIMIT 0,1000
</select>
<update id="editStoreInfo">
update mt_store
<set>
<if test="mtStore.name != null">name =#{mtStore.name}</if>
<if test="mtStore.address != null">address =#{mtStore.address}</if>
<if test="mtStore.expirationTime != null">expiration_time = #{vexpirationTime}</if>
<if test="mtStore.status != null"> status=#{mtStore.status}</if>
<if test="mtStore.logo != null"> logo=#{mtStore.logo}</if>
</set>
where id = #{mtStore.id}
</update>
</mapper>

View File

@ -100,4 +100,8 @@ public interface StoreService extends IService<MtStore> {
* @return
* */
List<MtStore> queryByDistance(String merchantNo, String keyword, String latitude, String longitude) throws BusinessCheckException;
boolean editStoreInfo(MtStore mtStore);
Map<String,Object> loginVerification(String flag);
}

View File

@ -1,30 +1,40 @@
package com.fuint.business.store.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.store.service.StoreService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.dto.StoreDto;
import com.fuint.common.enums.StatusEnum;
import com.fuint.common.enums.YesOrNoEnum;
import com.fuint.common.service.MerchantService;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.annoation.OperationServiceLog;
import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.framework.pagination.PaginationRequest;
import com.fuint.framework.pagination.PaginationResponse;
import com.fuint.module.backendApi.response.LoginResponse;
import com.fuint.repository.bean.StoreDistanceBean;
import com.fuint.repository.mapper.MtMerchantMapper;
import com.fuint.business.store.mapper.MtStoreMapper;
import com.fuint.repository.mapper.TAccountMapper;
import com.fuint.repository.model.MtMerchant;
import com.fuint.business.store.entity.MtStore;
import com.fuint.repository.model.TAccount;
import com.fuint.utils.StringUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@ -335,4 +345,101 @@ public class StoreServiceImpl extends ServiceImpl<MtStoreMapper, MtStore> implem
return dataList;
}
@Override
public boolean editStoreInfo(MtStore mtStore) {
return mtStoreMapper.updateById(mtStore)>0;
}
@Autowired
public RedisTemplate redisTemplate;
@Autowired
TAccountMapper tAccountMapper;
@Override
public Map<String,Object> loginVerification(String flag) {
Map<String,Object> res = new HashMap<>();
if (ObjectUtil.isEmpty(flag)){
res.put(flag,false);
return res;
}
// if (redisTemplate.hasKey(flag)) {
if (true) {
// BigDecimal bigDecimal = new BigDecimal(flag);
// BigDecimal multiply = bigDecimal.divide(new BigDecimal("2.1")).multiply(new BigDecimal("1.4"));
// 使用 intValue() BigDecimal 转换为整数
// int i = multiply.intValue();
// 找到站长的
Map<String, Object> param = new HashMap();
param.put("role_ids", 12);
List<TAccount> accountList = tAccountMapper.selectByMap(param);
if (accountList != null && accountList.size() > 0) {
AccountInfo accountByName = getAccountByName(accountList.get(0));
Subject subject = SecurityUtils.getSubject();
UsernamePasswordToken info = new UsernamePasswordToken(accountByName.getAccountName(), "111111");
// subject.login(info);
String token = TokenUtil.generateToken("user-agent", accountByName.getId());
accountByName.setToken(token);
TokenUtil.saveAccountToken(accountByName);
LoginResponse response = new LoginResponse();
response.setLogin(true);
response.setToken(token);
response.setTokenCreatedTime(new Date());
res.put("flag",true);
res.put("token",token);
}else {
res.put("flag",true);
res.put("token",null);
res.put("info","用户不存在");
return res;
}
// mtStoreMapper.getAccountByRole(12);
// 生成token
// 返回token
// redisTemplate.delete(flag);
return res;
} else {
}
return res;
}
// 处理
public AccountInfo getAccountByName(TAccount account) {
AccountInfo accountInfo = new AccountInfo();
// TAccount account = accountList.get(0);
accountInfo.setId(account.getAcctId());
accountInfo.setAccountName(account.getAccountName());
accountInfo.setRealName(account.getRealName());
accountInfo.setRoleIds(account.getRoleIds());
accountInfo.setStaffId(account.getStaffId());
accountInfo.setStoreId(account.getStoreId());
accountInfo.setMerchantId(account.getMerchantId());
accountInfo.setDeptId(account.getDeptId());
if (account.getMerchantId() != null && account.getMerchantId() > 0) {
MtMerchant mtMerchant = mtMerchantMapper.selectById(account.getMerchantId());
if (mtMerchant != null) {
accountInfo.setMerchantName(mtMerchant.getName());
}
}
if (account.getStoreId() != null && account.getStoreId() >= 0) {
MtStore mtStore = mtStoreMapper.selectById(account.getStoreId());
if (mtStore != null) {
accountInfo.setStoreName(mtStore.getName());
accountInfo.setChainStoreId(mtStore.getChainStoreId());
}
}
return accountInfo;
}
}

View File

@ -65,6 +65,7 @@ public class WebConfig extends WebMvcConfigurationSupport {
.excludePathPatterns("/clientApi/captcha/**")
.excludePathPatterns("/backendApi/captcha/**")
.excludePathPatterns("/backendApi/userCoupon/exportList")
.excludePathPatterns("/backendApi/store/loginVerification")
.excludePathPatterns("/backendApi/login/**");
// 客户端拦截

View File

@ -30,11 +30,23 @@ public class RoleDto {
* */
private String description;
private String code;
/**
* 状态 : A 有效 D 无效
*/
private String status;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Long getId() {
return id;
}

View File

@ -140,11 +140,29 @@ public class StoreDto implements Serializable {
*/
private String status;
private String doorstepPhoto;
/**
* 最后操作人
*/
private String operator;
/**
* 服务到期时间
*/
private Date expirationTime;
public Date getExpirationTime() {
return expirationTime;
}
public void setExpirationTime(Date expirationTime) {
this.expirationTime = expirationTime;
}
public Integer getId(){
return id;
}
@ -307,4 +325,12 @@ public class StoreDto implements Serializable {
public void setOperator(String operator){
this.operator=operator;
}
public String getDoorstepPhoto() {
return doorstepPhoto;
}
public void setDoorstepPhoto(String doorstepPhoto) {
this.doorstepPhoto = doorstepPhoto;
}
}

View File

@ -43,7 +43,7 @@ public interface AccountService extends IService<TAccount> {
* @param id
* @return
*/
TAccount getAccountInfoById(Integer id);
TAccount getAccountInfoById(Integer id);
/**
* 创建账号信息

View File

@ -1,5 +1,6 @@
package com.fuint.common.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -136,15 +137,18 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
@Override
public IPage<TAccount> listAccount(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, TAccount accountInfo) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
SysDept sysDept = deptService.selectDeptById(nowAccountInfo.getDeptId());
if (ObjectUtil.isEmpty(accountInfo) || ObjectUtil.isEmpty(accountInfo.getDeptId()) ) {
accountInfo.setDeptId(nowAccountInfo.getDeptId());
}
SysDept sysDept = deptService.selectDeptById(accountInfo.getDeptId());
IPage<TAccount> tAccountIPage = baseMapper.listAccount(page, accountInfo, sysDept.getAncestors());
return tAccountIPage;
}
@Override
public AccountInfo getAccountByName(String userName) {
Map<String, Object> param = new HashMap();
param.put("account_name", userName);
List<TAccount> accountList = tAccountMapper.selectByMap(param);
Map<String, Object> param = new HashMap();
param.put("account_name", userName);
List<TAccount> accountList = tAccountMapper.selectByMap(param);
if (accountList != null && accountList.size() > 0) {
AccountInfo accountInfo = new AccountInfo();
TAccount account = accountList.get(0);

View File

@ -42,6 +42,7 @@ public class ShiroConfig {
filterMap.put("/business/storeInformation/store/recentlyStore","anon");
//会员扫码进入小程序后根据id获取店铺信息
filterMap.put("/business/storeInformation/store/queryStoreById","anon");
filterMap.put("/backendApi/store/loginVerification","anon");
//小程序支付回调地址
filterMap.put("/api/fyPay/notify","anon");
filterMap.put("/**","commonFilter");

View File

@ -96,6 +96,7 @@ public class BackendDutyController extends BaseController {
String type = AdminRoleEnum.getName(tDuty.getDutyType());
dto.setType(type);
dto.setStatus(tDuty.getStatus());
dto.setCode(tDuty.getCode());
content.add(dto);
}
}

View File

@ -45,5 +45,8 @@ public class TDuty extends BaseEntity implements Serializable {
@ApiModelProperty("角色类型")
private String dutyType;
@ApiModelProperty("角色编码")
private String code;
}

View File

@ -1,5 +1,6 @@
package com.fuint.system.user.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.common.dto.AccountDto;
@ -7,6 +8,8 @@ import com.fuint.common.dto.AccountInfo;
import com.fuint.common.dto.RoleDto;
import com.fuint.common.enums.StatusEnum;
import com.fuint.common.service.AccountService;
import com.fuint.repository.mapper.TAccountDutyMapper;
import com.fuint.repository.model.TAccountDuty;
import com.fuint.system.role.service.DutyService;
import com.fuint.common.service.MerchantService;
import com.fuint.business.store.service.StoreService;
@ -25,6 +28,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
@ -162,6 +167,13 @@ public class BackendAccountController extends BaseController {
return getSuccessResult(result);
}
@Resource
TAccountDutyMapper tAccountDutyMapper;
/**
* 新增账户
*
@ -171,7 +183,7 @@ public class BackendAccountController extends BaseController {
@ApiOperation(value = "新增账户")
@RequestMapping(value = "/doCreate", method = RequestMethod.POST)
@CrossOrigin
@Transactional
// @Transactional
public ResponseObject doCreate(HttpServletRequest request, @RequestBody Map<String, Object> param) {
String token = request.getHeader("Access-Token");
AccountInfo loginAccount = TokenUtil.getAccountInfoByToken(token);
@ -180,14 +192,27 @@ public class BackendAccountController extends BaseController {
}
// List<Integer> roleIds = (List) param.get("roleIds");
String roleId = param.get("roleIds").toString();
String accountName = param.get("accountName").toString();
String accountStatus = param.get("accountStatus").toString();
String realName = param.get("realName").toString();
String password = param.get("password").toString();
String roleIds = param.get("roleIds").toString();
// String roleIds = param.get("roleIds").toString();
String storeId = param.get("storeId") == null ? "0" : param.get("storeId").toString();
String merchantId = param.get("merchantId") == null ? "0" : param.get("merchantId").toString();
String staffId = param.get("staffId") == null ? "0" : param.get("staffId").toString();
String deptId = param.get("deptId") == null ? "0" : param.get("deptId").toString();
// 获取角色code
String code = param.get("code") == null ? "0" : param.get("code").toString();
// 所属的连锁店类型
String deptType = param.get("deptType") == null ? "0" : param.get("deptType").toString();
if (!"3".equals(deptType) && "z001".equals(code) ) {
return getFailureResult(201, "用户角色与组织架构不匹配");
}
AccountInfo accountInfo = tAccountService.getAccountByName(accountName);
if (accountInfo != null) {
@ -195,19 +220,32 @@ public class BackendAccountController extends BaseController {
}
List<TDuty> duties = new ArrayList<>();
// todo
String[] ids = new String[1];
ids[0] = roleId;
duties = tDutyService.findDatasByIds(ids);
if (ObjectUtil.isEmpty(duties)) {
return getFailureResult(201, "您分配的角色不存在");
}
// if (roleIds.size() > 0) {
// Integer[] roles = roleIds.toArray(new Integer[roleIds.size()]);
// String[] ids = new String[roles.length];
// for (int i = 0; i < roles.length; i++) {
// ids[i] = roles[i].toString();
// }
//// for (int i = 0; i < roles.length; i++) {
//// ids[i] = roles[i].toString();
//// }
// duties = tDutyService.findDatasByIds(ids);
// if (duties.size() < roleIds.size()) {
// return getFailureResult(201, "您分配的角色不存在");
// }
// }
// 查询角色是否存在
TAccount tAccount = new TAccount();
tAccount.setAccountKey(CommonUtil.createAccountKey());
tAccount.setRealName(realName);
@ -221,6 +259,9 @@ public class BackendAccountController extends BaseController {
tAccount.setStaffId(Integer.parseInt(staffId));
tAccountService.createAccountInfo(tAccount, duties);
return getSuccessResult(true);
}

View File

@ -7,6 +7,9 @@
FROM
`t_account` ta
left join sys_dept sd on sd.dept_id = ta.dept_id
where account_status != -1
<if test="accountInfo.realName != null and accountInfo.realName != ''">
AND ta.real_name = like concat('%',#{accountInfo.realName},'%')
</if>
@ -17,6 +20,7 @@
<if test="ancestors != null and ancestors!=''">
AND sd.ancestors like concat (#{ancestors},'%')
</if>
order by create_time desc
</select>