便利店

This commit is contained in:
cun-nan 2023-11-02 18:38:22 +08:00
parent 089dcbabbe
commit 590bad37d3
54 changed files with 1670 additions and 670 deletions

View File

@ -0,0 +1,10 @@
import request from '@/utils/request'
// 查询商品列表
export function listOrder(query) {
return request({
url: '/api/order/list',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,9 @@
import request from '@/utils/request'
// 测试支付接口
export function paymentApi() {
return request({
url: '/api/fyPay/ok',
method: 'get',
})
}

View File

@ -1,6 +1,6 @@
import request from '@/utils/request'
// 查询会员列表
// 查询员工提成方案
export function listCommission(query) {
return request({
url: '/business/commission/staffCommission/list',
@ -9,14 +9,24 @@ export function listCommission(query) {
})
}
// 查询员详细
// 查询工提成方案详细
export function getCommission(id) {
return request({
url: '/business/commission/staffCommission/' + id,
method: 'get'
})
}
// 新增会员
// 查询员工提成方案
export function queryCommission(data) {
return request({
url: '/business/commission/staffCommission/getCommission',
method: 'post',
data: data
})
}
// 新增员工提成方案
export function addCommission(data) {
return request({
url: '/business/commission/staffCommission',
@ -25,7 +35,7 @@ export function addCommission(data) {
})
}
// 修改
// 修改工提成方案
export function updateCommission(data) {
return request({
url: '/business/commission/staffCommission',
@ -34,3 +44,10 @@ export function updateCommission(data) {
})
}
// 删除会员
export function delCommission(id) {
return request({
url: '/business/commission/staffCommission/' + id,
method: 'delete'
})
}

View File

@ -93,7 +93,6 @@
type="primary"
icon="el-icon-plus"
@click="handleAdd"
v-hasPermi="['member:add']"
>新增商品</el-button>
<el-table ref="tables" v-loading="loading" :data="list"
@selection-change="handleSelectionChange" :default-sort="defaultSort"
@ -136,14 +135,12 @@
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['member:add']"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['member:add']"
@click="isRecoveryBin(scope.row,1)"
>移至回收站</el-button>
</template>
@ -154,14 +151,12 @@
size="mini"
type="text"
icon="el-icon-shopping-cart-full"
v-hasPermi="['member:add']"
@click="isRecoveryBin(scope.row,0)"
>移出至商品档案</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['member:add']"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>

View File

@ -30,7 +30,6 @@
type="primary"
icon="el-icon-plus"
@click="handleAdd"
v-hasPermi="['member:add']"
>添加分类</el-button>
<!-- <div class="tTop">分类列表-->
<!-- <el-button type="primary" @click="insertGoods" >添加分类</el-button>-->
@ -66,14 +65,12 @@
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['member:add']"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['member:add']"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>

View File

@ -134,8 +134,6 @@
icon="el-icon-edit"
@click="trace(scope.row)"
>库存跟踪</el-button>
<!-- v-hasPermi="['']"-->
</template>
</el-table-column>
</el-table>

View File

@ -42,7 +42,6 @@
type="primary"
icon="el-icon-plus"
@click="handleAdd"
v-hasPermi="['member:add']"
>新增供应商</el-button>
<el-table ref="tables" v-loading="loading" :data="list"
@selection-change="handleSelectionChange" :default-sort="defaultSort"
@ -80,14 +79,12 @@
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['member:add']"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['member:add']"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>

View File

@ -102,13 +102,11 @@
type="primary"
icon="el-icon-plus"
@click="handleAddMember"
v-hasPermi="['member:add']"
>新增用户认证</el-button>
<el-button
type="danger"
icon="el-icon-document-copy"
@click="handleAddMembers"
v-hasPermi="['member:add']"
>批量用户认证</el-button>
<el-table ref="tables" v-loading="loading" :data="listMember"
@selection-change="handleSelectionChange" :default-sort="defaultSort"
@ -148,14 +146,12 @@
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['member:add']"
@click="handleUpdateMember(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['member:add']"
@click="handleDeleteMember(scope.row)"
>删除</el-button>
</template>
@ -176,7 +172,6 @@
type="primary"
icon="el-icon-plus"
@click="handleAdd"
v-hasPermi="['member:add']"
>新增固定等级类型</el-button>
<el-table ref="tables" v-loading="loading"
:data="list"
@ -315,14 +310,12 @@
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['member:add']"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['member:add']"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>

View File

@ -121,16 +121,16 @@
></el-statistic>
</div>
</el-col>
<el-col :span="4">
<div class="sta">
<el-statistic
group-separator=","
:precision="2"
:value="literCard"
title="升数卡总余额"
></el-statistic>
</div>
</el-col>
<!-- <el-col :span="4">-->
<!-- <div class="sta">-->
<!-- <el-statistic-->
<!-- group-separator=","-->
<!-- :precision="2"-->
<!-- :value="literCard"-->
<!-- title="升数卡总余额"-->
<!-- ></el-statistic>-->
<!-- </div>-->
<!-- </el-col>-->
<el-col :span="4">
<div class="sta">
<el-statistic
@ -140,16 +140,16 @@
></el-statistic>
</div>
</el-col>
<el-col :span="4">
<div class="sta">
<el-statistic
group-separator=","
:precision="2"
:value="refuelMoney"
title="加油金余额"
></el-statistic>
</div>
</el-col>
<!-- <el-col :span="4">-->
<!-- <div class="sta">-->
<!-- <el-statistic-->
<!-- group-separator=","-->
<!-- :precision="2"-->
<!-- :value="refuelMoney"-->
<!-- title="加油金余额"-->
<!-- ></el-statistic>-->
<!-- </div>-->
<!-- </el-col>-->
</el-row>
</div>
</template>
@ -160,7 +160,6 @@
type="primary"
icon="el-icon-plus"
@click="handleAdd"
v-hasPermi="['member:add']"
>新增会员</el-button>
<el-table ref="tables" v-loading="loading" :data="list"
@selection-change="handleSelectionChange" :default-sort="defaultSort"
@ -188,27 +187,27 @@
<span>{{ scope.row.gradeId ? getName(userGradeList, scope.row.gradeId) : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="储值卡" align="center" prop="balance">
<el-table-column label="储值卡" align="center" prop="cardBalance">
<template slot-scope="scope">
<div>{{ scope.row.balance ? scope.row.balance.toFixed(2) : '0.00' }}</div>
<div>{{ scope.row.cardBalance ? scope.row.cardBalance.toFixed(2) : '0.00' }}</div>
</template>
</el-table-column>
<el-table-column label="升数卡" align="center" prop="literCard">
<!-- <el-table-column label="升数卡" align="center" prop="literCard">-->
<!-- <template slot-scope="scope">-->
<!-- <div>{{ scope.row.literCard ? scope.row.literCard.toFixed(2) : '0.00' }}L</div>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="加油金" align="center" prop="balance">-->
<!-- <template slot-scope="scope">-->
<!-- <div>{{ scope.row.refuelMoney ? scope.row.refuelMoney.toFixed(2) : '0.00' }}</div>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="积分" align="center" prop="points">
<template slot-scope="scope">
<div>{{ scope.row.literCard ? scope.row.literCard.toFixed(2) : '0.00' }}L</div>
<div><span>{{ scope.row.points ? scope.row.points : '0.00' }}</span></div>
</template>
</el-table-column>
<el-table-column label="加油金" align="center" prop="balance">
<template slot-scope="scope">
<div>{{ scope.row.refuelMoney ? scope.row.refuelMoney.toFixed(2) : '0.00' }}</div>
</template>
</el-table-column>
<el-table-column label="积分" align="center" prop="point">
<template slot-scope="scope">
<div><span>{{ scope.row.point ? scope.row.point : '0.00' }}</span></div>
</template>
</el-table-column>
<el-table-column label="加油次数" align="center" prop="balance">
<el-table-column label="加油次数" align="center" prop="consumeNum">
<template slot-scope="scope">
<div>{{ scope.row.consumeNum }}</div>
</template>
@ -234,14 +233,12 @@
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['member:add']"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['member:add']"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
@ -346,32 +343,32 @@
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="会员初始积分" prop="point">
<el-input v-model="form.point" placeholder="0" maxlength="30"/>
<el-form-item label="会员初始积分" prop="points">
<el-input v-model="form.points" placeholder="0" maxlength="30"/>
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="初始加油金" prop="refuelMoney">-->
<!-- <el-input v-model="form.refuelMoney" placeholder="0" maxlength="30"/>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-row>
<el-col :span="24">
<el-form-item label="初始加油金" prop="refuelMoney">
<el-input v-model="form.refuelMoney" placeholder="0" maxlength="30"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="储值通用余额" prop="balance">
<el-input v-model="form.balance" placeholder="0" maxlength="30"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="升数卡余额" prop="literCard">
<el-input v-model="form.literCard" placeholder="0" maxlength="30"/>
<el-form-item label="储值通用余额" prop="cardBalance">
<el-input v-model="form.cardBalance" placeholder="0" maxlength="30"/>
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="升数卡余额" prop="literCard">-->
<!-- <el-input v-model="form.literCard" placeholder="0" maxlength="30"/>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-row>
<el-col :span="24">
<el-form-item label="是否关注公众号">
@ -470,6 +467,7 @@ import {listUserGrade} from "@/api/staff/user/usergrade";
import {ljStoreList} from "@/api/staff/store";
import {getSysConfig} from "@/api/staff/user/sysconfig";
import { getToken } from "@/utils/auth";
import {paymentApi} from "@/api/payment/fypay";
export default {
name: "MemberIndex",
components: { balanceRecharge, pointRecharge },
@ -539,7 +537,7 @@ export default {
defaultSort: {prop: 'updateTime', order: 'descending'},
//
form: { id: '', name: '', gradeId: '', mobile: '', userNo: '',point:'0', startTime: '', endTime: '', refuelMoney:'0',official:'wgz',
balance:'0', literCard:'0', sex: 1, idcard: '', birthday: '', address: '', status: "qy", description: '' },
cardBalance:'0', literCard:'0', sex: 1, idcard: '', birthday: '', address: '', status: "qy", description: '' },
//
queryParams: {
page: 1,
@ -552,7 +550,7 @@ export default {
status: '',
storeIds: '',
official:'',
balance:'',
cardBalance:'',
},
ifBalance:'',
//
@ -573,8 +571,13 @@ export default {
this.getStatistic();
this.getConfig();
this.getUserList();
// this.test();
},
methods: {
//
// test(){
// paymentApi().then( response => {})
// },
//
goDedi(id){
this.$router.push({
@ -608,8 +611,8 @@ export default {
this.yesterdayAddNum = response.data.yesterdayAddNum;
this.balance = response.data.balance;
this.point = response.data.point;
this.literCard = response.data.literCard;
this.refuelMoney = response.data.refuelMoney;
// this.literCard = response.data.literCard;
// this.refuelMoney = response.data.refuelMoney;
});
listUserGrade().then( response => {
this.userGradeList = response.data.records
@ -622,12 +625,12 @@ export default {
handleQuery() {
this.queryParams.page = 1;
if (this.ifBalance=='haveBalance'){
this.queryParams.balance = 1;
this.queryParams.cardBalance = 1;
}else {
this.queryParams.balance = 2;
this.queryParams.cardBalance = 2;
}
if (this.ifBalance==''){
this.queryParams.balance = ''
this.queryParams.cardBalance = ''
}
this.getList();
},
@ -715,7 +718,7 @@ export default {
reset() {
this.resetForm("form");
this.form= { id: '', name: '', gradeId: '', mobile: '', userNo: '',point:'0', startTime: '', endTime: '',
refuelMoney:'0',official:'wgz',balance:'0', literCard:'0', sex: 1, idcard: '', birthday: '', address: '',
refuelMoney:'0',official:'wgz',cardBalance:'0', literCard:'0', sex: 1, idcard: '', birthday: '', address: '',
status: "qy", description: ''
}
},

View File

@ -1,99 +0,0 @@
<template>
<div class="app-container">
<div class="main-panel">
<el-form ref="form" :model="form" :rules="rules" label-width="200px" style="margin-top: 20px;">
<el-row>
<el-col :span="24">
<el-form-item label="领券是否需要手机号" prop="getCouponNeedPhone">
<el-select v-model="form.getCouponNeedPhone" placeholder="领券是否需要手机号">
<el-option key="true" label="是" value="true"/>
<el-option key="false" label="否" value="false"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="提交订单是否需要手机号" prop="submitOrderNeedPhone">
<el-select v-model="form.submitOrderNeedPhone" placeholder="提交订单是否需要手机号">
<el-option key="true" label="是" value="true"/>
<el-option key="false" label="否" value="false"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="登录是否需要手机号" prop="loginNeedPhone">
<el-select v-model="form.loginNeedPhone" placeholder="提交订单是否需要手机号">
<el-option key="true" label="是" value="true"/>
<el-option key="false" label="否" value="false"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</div>
</div>
</template>
<script>
import { getMemberSetting, saveSetting } from "@/api/member";
export default {
name: "MemberSetting",
data() {
return {
//
loading: false,
//
form: { getCouponNeedPhone: "false", submitOrderNeedPhone: "false", loginNeedPhone: "false" },
//
rules: {
getCouponNeedPhone: [
{ required: true, message: "请选择", trigger: "blur" },
],
submitOrderNeedPhone: [
{ required: true, message: "请选择", trigger: "blur" },
],
loginNeedPhone: [
{ required: true, message: "请选择", trigger: "blur" },
],
}
};
},
created() {
this.getSettingInfo();
},
methods: {
//
getSettingInfo() {
this.loading = true;
getMemberSetting().then(response => {
this.form = response.data;
this.loading = false;
}
);
},
//
cancel() {
this.$store.dispatch('tagsView/delView', this.$route)
this.$router.push('/')
},
//
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
saveSetting(this.form).then(response => {
this.$modal.msgSuccess("保存成功");
this.getSettingInfo();
});
}
});
}
}
};
</script>

View File

@ -395,6 +395,7 @@ import { getName } from "@/utils/fuint";
import { getOrderList, updateOrderStatus, getOrderInfo, saveOrder, deleteOrder, verifyOrder, delivered } from "@/api/order";
import { doRefund } from "@/api/refund";
import orderPrintDialog from '../cashier/components/orderPrintDialog'
import {listOrder} from "@/api/order/order";
export default {
name: "OrderIndex",
components: {
@ -495,6 +496,9 @@ export default {
methods: {
//
getList() {
listOrder().then( response => {
console.log(response)
})
const app = this;
app.loading = true;
app.queryParams.storeIds = app.storeIds ? app.storeIds.join(",") : '';

View File

@ -2,16 +2,6 @@
<div class="app-container">
<el-card >
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item label="员工类别" prop="category">-->
<!-- <el-select v-model="queryParams.category" clearable placeholder="请选择员工类别">-->
<!-- <el-option-->
<!-- v-for="item in categoryOptions"-->
<!-- :key="item.key"-->
<!-- :label="item.name"-->
<!-- :value="item.key"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="姓名" prop="name">
<el-input
v-model="queryParams.realName"
@ -80,19 +70,10 @@
<dict-tag :options="dict.type.ywqx" :value="scope.row.refund"/>
</template>
</el-table-column>
<el-table-column label="审核状态" align="center" prop="storeName">
<template slot-scope="scope">
<el-switch
v-model="scope.row.auditedStatus"
active-value="A"
inactive-value="N"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="员工状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.zhzt" :value="scope.row.status"/>
<el-tag v-if="scope.row.status=='qy'">启用</el-tag>
<el-tag type="info" v-if="scope.row.status=='jy'">禁用</el-tag>
</template>
</el-table-column>
<el-table-column label="公众号" align="center" prop="official">
@ -126,14 +107,12 @@
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['staff:list']"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['staff:list']"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
@ -152,21 +131,6 @@
<!-- 添加或修改对话框 -->
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="60%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<!-- <el-row>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="员工类别" prop="category">-->
<!-- <el-select v-model="form.category" placeholder="请选择员工类别">-->
<!-- <el-option key="0" label="请选择员工类别" value="0"></el-option>-->
<!-- <el-option-->
<!-- v-for="item in categoryOptions"-->
<!-- :key="item.key"-->
<!-- :label="item.name"-->
<!-- :value="item.key"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-row>
<el-col :span="8">
<el-form-item label="姓名" prop="realName">
@ -179,13 +143,13 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="角色组" prop="role">
<el-select v-model="form.role" placeholder="请选择角色">
<el-form-item label="角色组" prop="roleId">
<el-select v-model="form.roleId" placeholder="请选择角色">
<el-option
v-for="dict in dict.type.role"
:key="dict.value"
:label="dict.label"
:value="dict.value"
v-for="item in roleList"
:key="item.dutyId"
:label="item.dutyName"
:value="item.dutyId"
></el-option>
</el-select>
</el-form-item>
@ -194,7 +158,7 @@
<el-row>
<el-col :span="8">
<el-form-item label="登录密码" prop="password">
<el-input v-model="form.password" placeholder="请输入登录密码" maxlength="30"/>
<el-input v-model="form.password" type="password" placeholder="请输入登录密码" maxlength="30"/>
</el-form-item>
</el-col>
<el-col :span="8">
@ -211,7 +175,7 @@
</el-col>
<el-col :span="8">
<el-form-item label="退款密码" prop="refundPassword">
<el-input v-model="form.applypassword" placeholder="请输入登录密码" maxlength="30"/>
<el-input v-model="form.refundPassword" type="password" placeholder="请输入退款密码" maxlength="30"/>
</el-form-item>
</el-col>
</el-row>
@ -585,6 +549,8 @@ export default {
'jbjl','official','notice','special_prem','role','shqx'],
data() {
return {
//
roleList:[],
drawer: false,
//
title: "",
@ -596,7 +562,6 @@ export default {
multiple: true,
//
showSearch: true,
categoryOptions: [],
storeOptions: [],
// role:[],
posPrem:'',
@ -656,10 +621,10 @@ export default {
defaultSort: {prop: 'createTime', order: 'descending'},
//
form: {
id:'', category:'', userId:'', mobile:'', realName:'', wechat:'', merchantId:'', storeId:'', auditedStatus:'',
id:'', userId:'', mobile:'', realName:'', wechat:'', merchantId:'', storeId:'', auditedStatus:'',
auditedTime:'', description:'', isRefuel:'yc', handoverMode:'dqmdtyjb', handoverPrem:'yqx', handoverOut:'jbtc', record:'qbjl',
merchantStatus:'qy',screen:'qy', posPrem:'', appletPrem:'', notice:'advice_jy', oilGunId:'', timeFrame:'bx', refund:'yqx',
transaction:'qbjy', writeOff:'',auditPrem:'',specialPrem:'', official:'', status:'qy',pos:'jy',role:''
transaction:'qbjy', writeOff:'',auditPrem:'',specialPrem:'', official:'', status:'qy',pos:'jy',roleId:''
},
//
queryParams: {
@ -679,7 +644,7 @@ export default {
{ required: true, message: "手机号不能为空", trigger: "blur" },
{ min: 11, max: 20, message: '手机号长度必须11', trigger: 'blur' },
],
role: [
roleId: [
{ required: true, message: "请选择员工角色", trigger: "blur" }
],
isRefuel: [
@ -723,7 +688,7 @@ export default {
},
created() {
this.getList();
// this.getDuty();
this.getDuty();
// this.getStoreList();
},
methods: {
@ -759,7 +724,7 @@ export default {
//
getDuty(){
listDuty().then(response => {
this.role = response.data
this.roleList = response.data
})
},
//
@ -817,10 +782,10 @@ export default {
this.writeOff = [];
this.auditPrem = [];
this.form = {
id:'', category:'', userId:'', mobile:'', realName:'', wechat:'', merchantId:'', storeId:'', auditedStatus:'A',
id:'', userId:'', mobile:'', realName:'', wechat:'', merchantId:'', storeId:'', auditedStatus:'A',
auditedTime:'', description:'', isRefuel:'yc', handoverMode:'dqmdtyjb', handoverPrem:'yqx', handoverOut:'jbtc', record:'qbjl',
merchantStatus:'qy',screen:'qy', posPrem:'', appletPrem:'', notice:'advice_jy', oilGunId:'', timeFrame:'bx', refund:'yqx',
transaction:'qbjy', writeOff:'',auditPrem:'',specialPrem:'', official:'', status:'qy',pos:'jy',role:''
transaction:'qbjy', writeOff:'',auditPrem:'',specialPrem:'', official:'', status:'qy',pos:'jy',roleId:''
};
this.resetForm("form");
},
@ -864,7 +829,8 @@ export default {
const id = row.id || this.ids;
getStaff(id).then(response => {
this.form = response.data;
// this.form.category = response.data.staffInfo.category + '';
this.form.password = '123456'
this.form.refundPassword = '123456'
this.open = true;
this.title = "编辑员工信息";
if (this.auditPrem.length > 0){

View File

@ -1,14 +1,15 @@
<template>
<div class="app-container">
<el-card>
<div slot="header" class="clearfix">
<span>油品提成方案</span>
</div>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="油品提成方案" name="oil"></el-tab-pane>
<el-tab-pane label="非油品提成方案" name="nonOil"></el-tab-pane>
</el-tabs>
<el-alert
title="方案说明"
type="info"
description="同一生效时间内同一角色组、同一参与油品只能设置一种启用的提成方案">
description="同一角色组、同一参与油品只能设置一种启用的提成方案">
</el-alert>
<div style="margin-top: 20px">
@ -16,14 +17,13 @@
type="primary"
icon="el-icon-plus"
@click="handleAdd"
v-hasPermi="['member:add']"
>新增提成方案</el-button>
<el-table ref="tables" v-loading="loading" :data="list"
@selection-change="handleSelectionChange" :default-sort="defaultSort"
@sort-change="handleSortChange">
<el-table-column label="ID" prop="id" align="center" width="60"/>
<el-table-column label="方案名称" prop="name" align="center"/>
<el-table-column label="员工角色" prop="staffRoleGroup" align="center">
<el-table-column label="员工角色" prop="staffRoleGroup" align="center">
<template slot-scope="scope">
<dict-tag :options="dict.type.role" :value="scope.row.staffRoleGroup"/>
</template>
@ -43,13 +43,13 @@
</template>
</el-table-column>
<el-table-column label="油品提成" prop="royaltyRate" align="center"/>
<el-table-column label="生效时间" prop="takeEffect" align="center">
<template slot-scope="scope">
<span>
{{JSON.parse(scope.row.takeEffect)[0]}}{{JSON.parse(scope.row.takeEffect)[1]}}
</span>
</template>
</el-table-column>
<!-- <el-table-column label="生效时间" prop="takeEffect" align="center">-->
<!-- <template slot-scope="scope">-->
<!-- <span>-->
<!-- {{JSON.parse(scope.row.takeEffect)[0]}}{{JSON.parse(scope.row.takeEffect)[1]}}-->
<!-- </span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="方案状态" align="center" prop="status">
<template slot-scope="scope">
<el-tag v-if="scope.row.status=='qy'">启用</el-tag>
@ -68,19 +68,14 @@
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['member:add']"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
v-hasPermi="['member:add']"
>
<span v-if="scope.row.status == 'qy'"
@click="handleStatus(scope.row,'jy')"><i class="el-icon-turn-off"></i>禁用</span>
<span v-else
@click="handleStatus(scope.row,'qy')"><i class="el-icon-open"></i>启用</span>
</el-button>
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
@ -108,14 +103,17 @@
<el-row>
<el-col :span="24" style="display: flex;margin-bottom: 10px">
<el-form-item label="提成来源" prop="commissionSource" style="width: 420px">
<el-checkbox-group v-model="commissionSource" ref="" @change="getCheckbox">
<el-checkbox
v-for="dict in dict.type.source"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-checkbox>
</el-checkbox-group>
<el-radio-group v-model="form.commissionSource">
<el-radio v-for="dict in dict.type.source" @change="isChange" :label="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
<!-- <el-radio-group v-model="commissionSource" ref="" @change="getCheckbox">-->
<!-- <el-checkbox-->
<!-- v-for="dict in dict.type.source"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- ></el-checkbox>-->
<!-- </el-radio-group>-->
</el-form-item>
</el-col>
</el-row>
@ -172,21 +170,21 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="生效时间" prop="takeEffect">
<el-date-picker
v-model="form.takeEffect"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
<div style="font-size: 12px;color: grey">时间范围内的油品交易有效</div>
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="生效时间" prop="takeEffect">-->
<!-- <el-date-picker-->
<!-- v-model="form.takeEffect"-->
<!-- type="daterange"-->
<!-- value-format="yyyy-MM-dd HH:mm:ss"-->
<!-- range-separator="至"-->
<!-- start-placeholder="开始日期"-->
<!-- end-placeholder="结束日期">-->
<!-- </el-date-picker>-->
<!-- <div style="font-size: 12px;color: grey">时间范围内的油品交易有效</div>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-row>
<el-col :span="24">
<el-form-item label="方案状态" prop="status">
@ -211,14 +209,20 @@
<script>
import {addCommission, getCommission, listCommission, updateCommission} from "@/api/staffCommission/staffcommission";
import {
addCommission, delCommission,
getCommission,
listCommission,
queryCommission,
updateCommission
} from "@/api/staffCommission/staffcommission";
export default {
dicts: ['source','role','zhzt','comissionType'],
data(){
return {
//
dateRange: [],
changeCom:false,
activeName: 'oil',
select:"元",
commissionSource:[],
//
@ -239,7 +243,7 @@ export default {
pageSize: 10,
id: '',
name: '',
mobile: '',
commissionSource:'油品'
},
//
form: {
@ -268,9 +272,9 @@ export default {
royaltyRate: [
{ required: true, message: "请填写油品提成", trigger: "blur" },
],
takeEffect: [
{ required: true, message: "请选择方案生效时间", trigger: "change" },
],
// takeEffect: [
// { required: true, message: "", trigger: "change" },
// ],
status: [
{ required: true, message: "请选择方案状态", trigger: "blur" },
],
@ -281,6 +285,29 @@ export default {
this.getList();
},
methods:{
//
handleClick(tab, event) {
if (this.activeName == 'oil'){
this.queryParams = {
page: 1,
pageSize: 10,
id: '',
name: '',
commissionSource:'油品'
};
this.getList();
}else {
this.queryParams = {
page: 1,
pageSize: 10,
id: '',
name: '',
commissionSource:'非油品'
};
this.getList();
}
},
getCheckbox(){
this.form.commissionSource = this.commissionSource.toString()
},
@ -296,9 +323,18 @@ export default {
//
reset() {
this.resetForm("form");
this.form= {
type:'orderAmount',
status:'qy'
if (this.activeName == 'oil'){
this.form = {
type:'orderAmount',
status:'qy',
commissionSource:'油品'
};
}else {
this.form = {
type:'orderAmount',
status:'qy',
commissionSource:'非油品'
};
}
},
//
@ -313,41 +349,99 @@ export default {
const id = row.id || this.ids;
getCommission(id).then(response => {
this.form = response.data;
this.commissionSource = this.form.commissionSource.split(",")
this.form.takeEffect = JSON.parse(this.form.takeEffect)
// this.commissionSource = this.form.commissionSource.split(",")
// this.form.takeEffect = JSON.parse(this.form.takeEffect)
this.form.royaltyRate = this.form.royaltyRate.slice(0,this.form.royaltyRate.length-1)
this.open = true;
this.title = "编辑提成方案";
});
},
//
handleStatus(row,status) {
row.status = status;
updateCommission(row).then(response => {
this.$modal.msgSuccess("方案状态更新成功");
this.open = false;
//
handleDelete(row) {
const name = row.name
this.$modal.confirm('确定删除"' + name + '"的提成方案信息?').then(function() {
return delCommission(row.id);
}).then(() => {
this.queryParams.page = 1
this.getList();
});
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
//
isChange(){
this.changeCom = true;
},
add0(m){
return m<10?'0'+m:m
},
//
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.commissionSource = this.commissionSource.toString()
this.form.takeEffect = JSON.stringify(this.form.takeEffect)
this.form.royaltyRate = this.form.royaltyRate + this.select
// let date = new Date();
// let year = date.getFullYear()
// let month = date.getMonth()+1
// let day = date.getDate()
// let hour = date.getHours()
// let minutes = date.getMinutes()
// let second = date.getSeconds()
// let now = year+"-"+this.add0(month)+"-"+this.add0(day)+" "+hour+":"+minutes+":"+second
// if(this.form.takeEffect[0] < now && this.form.takeEffect[1] > now){
// this.form.status = 'qy'
// }else {
// this.form.status = 'jy'
// }
// // this.form.commissionSource = this.commissionSource.toString()
// this.form.takeEffect = JSON.stringify(this.form.takeEffect)
if (this.form.id) {
updateCommission(this.form).then(response => {
this.$modal.msgSuccess("提成方案更新成功");
this.open = false;
this.getList();
});
if (this.changeCom){
queryCommission(this.form).then(response => {
if (response.data != null) {
if (this.changeCom) {
this.$modal.msgError("同一个角色组只能对应一个" + this.form.commissionSource + "提成方案")
}else {
this.$modal.msgError("当前时间段已存在相同油品、相同角色组的方案")
}
} else {
this.form.royaltyRate = this.form.royaltyRate + this.select
updateCommission(this.form).then(response => {
this.$modal.msgSuccess("提成方案更新成功");
this.open = false;
this.changeCom = false;
this.getList();
});
}
})
}else {
this.form.royaltyRate = this.form.royaltyRate + this.select
updateCommission(this.form).then(response => {
this.$modal.msgSuccess("提成方案更新成功");
this.open = false;
this.getList();
});
}
} else {
addCommission(this.form).then(response => {
this.$modal.msgSuccess("提成方案新增成功");
this.open = false;
this.getList();
});
queryCommission(this.form).then(response => {
if (response.data != null){
if (response.data.status == 'qy'){
this.$modal.msgError("同一个角色组只能对应一个"+this.form.commissionSource+"提成方案")
}else {
this.form.royaltyRate = this.form.royaltyRate + this.select
addCommission(this.form).then(response => {
this.$modal.msgSuccess("提成方案新增成功");
this.open = false;
this.getList();
});
}
}else {
this.form.royaltyRate = this.form.royaltyRate + this.select
addCommission(this.form).then(response => {
this.$modal.msgSuccess("提成方案新增成功");
this.open = false;
this.getList();
});
}
})
}
}
});

View File

@ -1,5 +1,5 @@
<template>
<div class="app-container">
<div class="app-container" style="height: 100%">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button

View File

@ -64,51 +64,6 @@
</div>
</el-card>
<!-- <el-card class="card">-->
<!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">-->
<!-- <el-form-item label="等级名称" prop="name">-->
<!-- <el-input-->
<!-- v-model="queryParams.name"-->
<!-- placeholder="请输入等级名称"-->
<!-- clearable-->
<!-- style="width: 240px;"-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="升级方式" prop="catchType">-->
<!-- <el-select-->
<!-- v-model="queryParams.catchType"-->
<!-- clearable-->
<!-- placeholder="升级方式"-->
<!-- >-->
<!-- <el-option v-for="catchType in catchTypeList" :key="catchType.key" :label="catchType.name" :value="catchType.value"/>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="状态" prop="status">-->
<!-- <el-select-->
<!-- v-model="queryParams.status"-->
<!-- placeholder="状态"-->
<!-- clearable-->
<!-- >-->
<!-- <el-option key="A" label="启用" value="A"/>-->
<!-- <el-option key="N" label="禁用" value="N"/>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item>-->
<!-- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>-->
<!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['userGrade:add']"-->
<!-- >新增</el-button>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<!-- </el-card>-->
<el-card class="card">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
@ -235,14 +190,12 @@
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['userGrade:add']"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['userGrade:add']"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>

View File

@ -23,6 +23,11 @@
<artifactId>fuint-framework</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.fuint</groupId>
<artifactId>fuint-payment</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.fuint</groupId>
<artifactId>fuint-quartz</artifactId>
@ -159,6 +164,7 @@
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>

View File

@ -46,6 +46,27 @@ public class StaffCommissionController extends BaseController {
return getSuccessResult(commission);
}
/**
* 根据角色名称和提成来源查询员工提成方案信息
* @param commission
* @return
*/
@PostMapping("/getCommission")
public ResponseObject queryCommission(@Validated @RequestBody StaffCommission commission){
StaffCommission commission1 = commissionService.selectCommissionByRole(commission);
return getSuccessResult(commission1);
}
/**
* 删除员工提成方案信息
* @return
*/
@DeleteMapping("/{id}")
public ResponseObject remove(@PathVariable Integer id){
commissionService.deleteCommissionById(id);
return getSuccessResult("操作成功");
}
/**
* 添加员工提成方案信息
* @param commission

View File

@ -9,6 +9,7 @@
<include refid="selectCommission"></include>
<where>
store_id = #{commission.storeId}
and commission_source = #{commission.commissionSource}
</where>
</select>
</mapper>

View File

@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.commission.entity.StaffCommission;
import com.fuint.business.member.entity.LJStaff;
/**
* 员工提成方案信息 业务层
@ -24,6 +23,19 @@ public interface StaffCommissionService extends IService<StaffCommission> {
*/
public StaffCommission selectCommissionById(int id);
/**
* 根据员工角色查询员工提成方案信息
* @param commission
* @return
*/
public StaffCommission selectCommissionByRole(StaffCommission commission);
/**
* 根据id删除员工提成方案信息
* @param id
*/
public void deleteCommissionById(Integer id);
/**
* 增加员工提成方案信息
* @param commission

View File

@ -1,7 +1,6 @@
package com.fuint.business.commission.service.impl;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -9,11 +8,11 @@ import com.fuint.business.commission.entity.StaffCommission;
import com.fuint.business.commission.mapper.StaffCommissionMapper;
import com.fuint.business.commission.service.StaffCommissionService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.StringUtils;
import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang.StringEscapeUtils;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
@ -27,7 +26,19 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
Integer storeId = nowAccountInfo.getStoreId();
commission.setStoreId(storeId);
IPage<StaffCommission> staffCommissionIPage = baseMapper.selectCommissionList(page, commission);
return staffCommissionIPage;
for (StaffCommission record : staffCommissionIPage.getRecords()) {
String substring = record.getTakeEffect().substring(24, 43);
Date date = new Date();
SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String now = dateFormat.format(date);
int row = substring.compareTo(now);
if (row == -1){
record.setStatus("jy");
baseMapper.updateById(record);
}
}
IPage<StaffCommission> commissionIPage = baseMapper.selectCommissionList(page, commission);
return commissionIPage;
}
@Override
@ -36,6 +47,24 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
return commission;
}
@Override
public StaffCommission selectCommissionByRole(StaffCommission commission) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("store_id",storeId);
queryWrapper.eq("staff_role_group",commission.getStaffRoleGroup());
queryWrapper.eq("commission_source",commission.getCommissionSource());
queryWrapper.eq("status","qy");
StaffCommission commission1 = baseMapper.selectOne(queryWrapper);
return commission1;
}
@Override
public void deleteCommissionById(Integer id) {
baseMapper.deleteById(id);
}
@Override
public int insertStaffCommission(StaffCommission commission) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();

View File

@ -31,9 +31,6 @@ public class LJStaff extends BaseEntity implements Serializable {
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
@ApiModelProperty("员工类别")
private Integer category;
@ApiModelProperty("用户ID")
private Integer userId;
@ -43,25 +40,12 @@ public class LJStaff extends BaseEntity implements Serializable {
@ApiModelProperty("真实姓名")
private String realName;
@ApiModelProperty("微信号")
private String wechat;
@ApiModelProperty("商户ID")
private Integer merchantId;
@ApiModelProperty("店铺ID")
private Integer storeId;
@ApiModelProperty("审核状态A审核通过U未审核D无效; ")
private String auditedStatus;
@ApiModelProperty("审核时间")
private Date auditedTime;
@ApiModelProperty("备注")
private String description;
@ApiModelProperty("一键加油: 显示、隐藏")
private String isRefuel;
@ -123,5 +107,12 @@ public class LJStaff extends BaseEntity implements Serializable {
private String pos;
@ApiModelProperty("角色id")
private String role;
private Integer roleId;
@ApiModelProperty("登入密码")
@TableField(exist = false)
private String password;
@ApiModelProperty("退款密码")
private String refundPassword;
}

View File

@ -25,34 +25,6 @@ public interface LJStaffMapper extends BaseMapper<LJStaff> {
*/
public IPage<LJStaff> selectLJStaffList(Page page, @Param("staff") LJStaff staff);
/**
* 根据id查询员工信息
* @param id
* @return
*/
public LJStaff selectLJStaffById(@Param("id") int id);
/**
* 根据id删除员工信息
* @param id
* @return
*/
public int deleteStaffById(@Param("id") int id);
/**
* 添加员工信息
* @param staff
* @return
*/
public int insertStaff(LJStaff staff);
/**
* 修改员工信息
* @param staff
* @return
*/
public int updateStaff(LJStaff staff);
int updateStatus(@Param("id") Integer id, @Param("status") String status, @Param("updateTime") Date updateTime);
LJStaff queryStaffByMobile(@Param("mobile") String mobile);

View File

@ -1,50 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.business.member.mapper.LJStaffMapper">
<resultMap type="com.fuint.business.member.entity.LJStaff" id="LJStaffResult">
<id property="id" column="id" />
<result property="merchantId" column="merchant_id" />
<result property="storeId" column="store_id" />
<result property="userId" column="user_id" />
<result property="category" column="category" />
<result property="mobile" column="mobile" />
<result property="realName" column="real_name" />
<result property="wechat" column="wechat" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="auditedStatus" column="audited_status" />
<result property="auditedTime" column="audited_time" />
<result property="description" column="description" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="isRefuel" column="is_refuel" />
<result property="handoverMode" column="handover_mode" />
<result property="handoverPrem" column="handover_prem" />
<result property="handoverOut" column="handover_out" />
<result property="record" column="record" />
<result property="merchantStatus" column="merchant_status" />
<result property="screen" column="screen" />
<result property="posPrem" column="pos_prem" />
<result property="appletPrem" column="applet_prem" />
<result property="notice" column="notice" />
<result property="oilGunId" column="oil_gun_id" />
<result property="timeFrame" column="time_frame" />
<result property="refund" column="refund" />
<result property="transaction" column="transaction" />
<result property="writeOff" column="write_off" />
<result property="specialPrem" column="special_prem" />
<result property="official" column="official" />
<result property="status" column="status" />
<result property="pos" column="pos" />
<result property="role" column="role" />
<result property="auditPrem" column="audit_prem" />
</resultMap>
<sql id="selectMtStaff">
select * from mt_staff
</sql>
<!--根据条件分页查询用户信息-->
<select id="selectLJStaffList" resultMap="LJStaffResult">
<select id="selectLJStaffList" resultType="com.fuint.business.member.entity.LJStaff">
<include refid="selectMtStaff"></include>
<where>
store_id = #{staff.storeId}
@ -59,85 +20,6 @@
</if>
</where>
</select>
<!--根据id查询员工信息-->
<select id="selectLJStaffById" resultMap="LJStaffResult">
<include refid="selectMtStaff"></include>
where id = #{id}
</select>
<!--根据id查询员工信息-->
<delete id="deleteStaffById">
delete from mt_staff where id = #{id}
</delete>
<!--增加员工信息-->
<insert id="insertStaff">
insert into mt_staff(
<if test="merchantId != null">merchant_id,</if>
<if test="storeId != null">store_id,</if>
<if test="userId != null">user_id,</if>
<if test="category != null">category,</if>
<if test="mobile != null and mobile != ''">mobile,</if>
<if test="realName != null and realName != ''">real_name,</if>
<if test="wechat != null and wechat != ''">wechat,</if>
<if test="updateTime != null and updateTime != ''">update_time,</if>
<if test="auditedStatus != null and auditedStatus != ''">audited_status,</if>
<if test="auditedTime != null and auditedTime != ''">audited_time,</if>
<if test="description != null and description != ''">description,</if>
<if test="createUser != null and createUser != ''">create_user,</if>
<if test="updateUser != null and updateUser != ''">update_user,</if>
<if test="isRefuel != null and isRefuel != ''">is_refuel,</if>
<if test="handoverMode != null and handoverMode != ''">handover_mode,</if>
<if test="handoverPrem != null and handoverPrem != ''">handover_prem,</if>
<if test="out != null and out != ''">out,</if>
<if test="record != null and record != ''">record,</if>
<if test="merchantStatus != null and merchantStatus != ''">merchant_status,</if>
<if test="screen != null and screen != ''">screen,</if>
<if test="posPrem != null and posPrem != ''">pos_prem,</if>
<if test="appletPrem != null and appletPrem != ''">applet_prem,</if>
<if test="notice != null and notice != ''">notice,</if>
<if test="oilGunId != null and oilGunId != ''">oil_gun_id,</if>
<if test="timeFrame != null and timeFrame != ''">time_frame,</if>
<if test="refund != null and refund != ''">refund,</if>
<if test="transaction != null and transaction != ''">transaction,</if>
<if test="writeOff != null and writeOff != ''">write_off,</if>
<if test="specialPrem != null and specialPrem != ''">special_prem,</if>
<if test="official != null and official != ''">official,</if>
create_time
)values (
<if test="merchantId != null">#{merchantId},</if>
<if test="storeId != null">#{storeId},</if>
<if test="userId != null">#{userId},</if>
<if test="category != null">#{category},</if>
<if test="mobile != null and mobile != ''">#{mobile},</if>
<if test="realName != null and realName != ''">#{realName},</if>
<if test="wechat != null and wechat != ''">#{wechat},</if>
<if test="updateTime != null and updateTime != ''">#{updateTime},</if>
<if test="auditedStatus != null and auditedStatus != ''">#{auditedStatus},</if>
<if test="auditedTime != null and auditedTime != ''">#{auditedTime},</if>
<if test="description != null and description != ''">#{description},</if>
<if test="createUser != null and createUser != ''">#{createUser},</if>
<if test="updateUser != null and updateUser != ''">#{updateUser},</if>
<if test="isRefuel != null and isRefuel != ''">#{isRefuel},</if>
<if test="handoverMode != null and handoverMode != ''">#{handoverMode},</if>
<if test="handoverPrem != null and handoverPrem != ''">#{handoverPrem},</if>
<if test="out != null and out != ''">#{out},</if>
<if test="record != null and record != ''">#{record},</if>
<if test="merchantStatus != null and merchantStatus != ''">#{merchantStatus},</if>
<if test="screen != null and screen != ''">#{screen},</if>
<if test="posPrem != null and posPrem != ''">#{posPrem},</if>
<if test="appletPrem != null and appletPrem != ''">#{appletPrem},</if>
<if test="notice != null and notice != ''">#{notice},</if>
<if test="oilGunId != null and oilGunId != ''">#{oilGunId},</if>
<if test="timeFrame != null and timeFrame != ''">#{time_frame},</if>
<if test="refund != null and refund != ''">#{refund},</if>
<if test="transaction != null and transaction != ''">#{transaction},</if>
<if test="writeOff != null and writeOff != ''">#{write_off},</if>
<if test="specialPrem != null and specialPrem != ''">#{special_prem},</if>
<if test="official != null and official != ''">#{official},</if>
sysdate()
)
</insert>
<!-- 修改员工信息-->
<update id="updateStaff"></update>
<update id="updateStatus">
update mt_staff p set p.AUDITED_STATUS = #{status}, p.UPDATE_TIME = #{updateTime} where p.ID = #{id}

View File

@ -56,5 +56,10 @@ public interface ILJStaffService extends IService<LJStaff> {
*/
public int updateStaff(LJStaff staff);
/**
* 设定安全的密码生成随机的salt并经过1024次 sha-1 hash
*/
public void entryptPassword(LJStaff staff);
public int auditPrem(String auditPrem);
}

View File

@ -8,17 +8,27 @@ import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.member.mapper.LJStaffMapper;
import com.fuint.business.member.service.ILJStaffService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.service.AccountService;
import com.fuint.common.util.TokenUtil;
import com.fuint.repository.model.TAccount;
import com.fuint.utils.Digests;
import com.fuint.utils.Encodes;
import jdk.nashorn.internal.parser.Token;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
/**
* 员工管理 业务层
*/
@Service
public class LJStaffServiceImpl extends ServiceImpl<LJStaffMapper, LJStaff> implements ILJStaffService {
@Autowired
private AccountService accountService;
/**
* 根据条件分页查询员工信息
* @param page
@ -89,7 +99,26 @@ public class LJStaffServiceImpl extends ServiceImpl<LJStaffMapper, LJStaff> impl
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
staff.setStoreId(storeId);
this.entryptPassword(staff);
int row = baseMapper.insert(staff);
LJStaff staff1 = this.selectStaffByMobile(staff.getMobile());
// 添加账户信息
TAccount account = new TAccount();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date());
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
account.setAccountKey(timestamp+randomString);
account.setAccountName(staff.getMobile());
account.setAccountStatus(1);
account.setRealName(staff.getRealName());
account.setRoleIds(String.valueOf(staff.getRoleId()));
account.setStaffId(staff1.getId());
account.setCreateTime(new Date());
account.setUpdateTime(new Date());
account.setStoreId(storeId);
account.setPassword(staff.getPassword());
accountService.createAccountInfo(account,null);
return row;
}
@ -104,6 +133,13 @@ public class LJStaffServiceImpl extends ServiceImpl<LJStaffMapper, LJStaff> impl
return row;
}
@Override
public void entryptPassword(LJStaff staff) {
byte[] salt = Digests.generateSalt(8);
byte[] hashPassword1 = Digests.sha1(staff.getRefundPassword().getBytes(), salt, 1024);
staff.setRefundPassword(Encodes.encodeHex(hashPassword1));
}
@Override
public int auditPrem(String auditPrem) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();

View File

@ -8,6 +8,7 @@ import com.fuint.business.userManager.listener.EasyExcelListener;
import com.fuint.business.userManager.mapper.LJUserMapper;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.business.userManager.service.UserStatisticService;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -49,13 +50,13 @@ public class ExportController extends BaseController{
//实例化实现了AnalysisEventListener接口的类
EasyExcelListener listener = new EasyExcelListener();
EasyExcelFactory.read(inputStream, LJUser.class, listener).headRowNumber(1).build().readAll();
EasyExcelFactory.read(inputStream, LJUserVo.class, listener).headRowNumber(1).build().readAll();
//获取数据
List<Object> list = listener.getDatas();
total = list.size();
if (list.size() >= 1) {
for (int i = 0; i < list.size(); i++) {
LJUser user = (LJUser) list.get(i);
LJUserVo user = (LJUserVo) list.get(i);
LJUser user1 = service.selectUserByMobile(user.getMobile());
if (user1!=null){
repeat += 1;
@ -105,20 +106,21 @@ public class ExportController extends BaseController{
response.setCharacterEncoding("utf-8");
response.addHeader("Content-Disposition", "filename=" + filenames + ".xlsx");
LJUser ljUser = new LJUser();
LJUserVo ljUser = new LJUserVo();
ljUser.setUserNo("51246214");
ljUser.setName("会员");
ljUser.setOpenId("15245698512");
ljUser.setMobile("15245698512");
ljUser.setIdcard("845126542514568542");
ljUser.setPoint(1);
ljUser.setAddress("山东省济南市");
ljUser.setSecondCard("15245698513");
ljUser.setCardBalance(100.00);
ljUser.setPoints(100);
List<LJUser> list = new ArrayList<>();
List<LJUserVo> list = new ArrayList<>();
list.add(ljUser);
EasyExcel.write(response.getOutputStream(), LJUser.class).sheet("sheet").doWrite(list);
EasyExcel.write(response.getOutputStream(), LJUserVo.class).sheet("sheet").doWrite(list);
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -6,6 +6,7 @@ import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.entity.UserStatistic;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.business.userManager.service.UserStatisticService;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,11 +34,11 @@ public class LJUserController extends BaseController {
* @return
*/
@GetMapping("/list")
public ResponseObject list(LJUser user,
public ResponseObject list(LJUserVo user,
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
Page page =new Page(pageNo,pageSize);
IPage<LJUser> list = userService.selectUserList(page,user);
IPage<LJUserVo> list = userService.selectUserList(page,user);
return getSuccessResult(list);
}
@ -90,7 +91,7 @@ public class LJUserController extends BaseController {
* @return
*/
@PostMapping
public ResponseObject add(@Validated @RequestBody LJUser user){
public ResponseObject add(@Validated @RequestBody LJUserVo user){
int row = userService.insertUser(user);
// 添加会员统计信息
UserStatistic statistic = new UserStatistic();

View File

@ -27,7 +27,6 @@ import java.util.List;
@Getter
@Setter
@TableName("mt_user")
@ExcelIgnoreUnannotated
@ApiModel(value = "MtUser对象", description = "会员个人信息")
public class LJUser extends BaseEntity implements Serializable {
@ -38,51 +37,27 @@ public class LJUser extends BaseEntity implements Serializable {
private Integer id;
@ApiModelProperty("会员号")
@ExcelProperty(value = "会员号")
private String userNo;
@ApiModelProperty("头像")
private String avatar;
@ApiModelProperty("称呼")
@ExcelProperty(value = "姓名")
private String name;
@ApiModelProperty("微信")
@ExcelProperty(value = "微信")
private String openId;
@ApiModelProperty("手机号码")
@ExcelProperty(value = "手机号码(必填)")
private String mobile;
@ApiModelProperty("证件号码")
@ExcelProperty(value = "证件号码")
private String idcard;
@ApiModelProperty("等级ID")
private String gradeId;
@ApiModelProperty("会员开始时间")
@TableField(strategy = FieldStrategy.IGNORED)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime;
@ApiModelProperty("会员结束时间")
@TableField(strategy=FieldStrategy.IGNORED)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
@ApiModelProperty("余额")
@ExcelProperty(value = "余额")
private BigDecimal balance;
@ApiModelProperty("积分")
@ExcelProperty(value = "积分")
private Integer point;
@ApiModelProperty("性别 1男,0女")
@ExcelProperty(value = "性别",converter = GenderConverter.class)
private Integer sex;
@ApiModelProperty("出生日期")
@ -91,23 +66,9 @@ public class LJUser extends BaseEntity implements Serializable {
@ApiModelProperty("车牌号")
private String carNo;
@ApiModelProperty("来源渠道")
private String source;
@ApiModelProperty("密码")
@ExcelProperty(value = "密码")
private String password;
@ApiModelProperty("salt")
private String salt;
@ApiModelProperty("地址")
@ExcelProperty(value = "地址")
private String address;
@ApiModelProperty("所属商户ID")
private Integer merchantId;
@ApiModelProperty("默认店铺")
private Integer storeId;
@ -115,29 +76,15 @@ public class LJUser extends BaseEntity implements Serializable {
private String status;
@ApiModelProperty("备注信息")
@ExcelProperty(value = "备注信息")
private String description;
@ApiModelProperty("最后操作人")
private String operator;
@ApiModelProperty("升数卡")
@ExcelProperty(value = "升数卡")
private BigDecimal literCard;
@ApiModelProperty("公众号")
private String official;
@ApiModelProperty("加油金")
@ExcelProperty(value = "加油金")
private BigDecimal refuelMoney;
@ApiModelProperty("加油次数")
@ExcelProperty(value = "加油次数")
private BigDecimal consumeNum;
@ApiModelProperty("副卡信息")
@ExcelProperty(value = "副卡信息")
private String secondCard;
@ApiModelProperty("固定等级")

View File

@ -0,0 +1,59 @@
package com.fuint.business.userManager.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;
/**
* 用户余额表(UserBalance)实体类
*/
@Data
@TableName("mt_user_balance")
@ApiModel(value = "UserBalance对象", description = "用户余额表")
public class UserBalance 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 mtUserId;
/**
* 所属连锁店id
*/
private Integer chainStorId;
/**
* 所属店铺id
*/
private Integer storeId;
/**
* 储值卡余额
*/
private Double cardBalance;
/**
* 积分
*/
private Integer points;
/**
* 成长值
*/
private Integer growthValue;
/**
* 加油金
*/
private Integer refuelMoney;
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.vo.LJUserVo;
import org.apache.ibatis.annotations.Param;
/**
@ -16,7 +17,7 @@ public interface LJUserMapper extends BaseMapper<LJUser> {
* @param user
* @return
*/
public IPage<LJUser> selectUserList(Page page, @Param("user") LJUser user);
public IPage<LJUserVo> selectUserList(Page page, @Param("user") LJUserVo user);
public Double selectSumByStore(@Param("storeId") int storeId,@Param("sumValue") String sumValue);
}

View File

@ -0,0 +1,7 @@
package com.fuint.business.userManager.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.userManager.entity.UserBalance;
public interface UserBalanceMapper extends BaseMapper<UserBalance> {
}

View File

@ -1,86 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.business.userManager.mapper.LJUserMapper">
<resultMap id="UserResult" type="com.fuint.business.userManager.entity.LJUser">
<id property="id" column="id" />
<result property="merchantId" column="merchant_id" />
<result property="storeId" column="store_id" />
<result property="userNo" column="user_no" />
<result property="avatar" column="avatar" />
<result property="name" column="name" />
<result property="openId" column="open_id" />
<result property="idcard" column="idcard" />
<result property="gradeId" column="grade_id" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="mobile" column="mobile" />
<result property="balance" column="balance" />
<result property="point" column="point" />
<result property="sex" column="sex" />
<result property="birthday" column="birthday" />
<result property="carNo" column="car_no" />
<result property="source" column="source" />
<result property="password" column="password" />
<result property="salt" column="salt" />
<result property="address" column="address" />
<result property="status" column="status" />
<result property="operator" column="operator" />
<result property="description" column="description" />
<result property="official" column="official" />
<result property="literCard" column="liter_card" />
<result property="refuelMoney" column="refuel_money" />
<result property="consumeNum" column="consume_num" />
<result property="secondCard" column="second_card" />
<result property="fixingLevel" column="fixing_level" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectUser">
select id, mobile, user_no, avatar, name, open_id, idcard, grade_id, start_time, end_time, balance, point,
sex, birthday, car_no, source, password, salt, address, merchant_id, store_id, create_time, update_time,
status, description, operator,official,liter_card,refuel_money,consume_num,second_card,fixing_level from mt_user
select mu.*,mub.card_balance,mub.points from mt_user mu
inner join mt_user_balance mub on mu.id = mub.mt_user_id
</sql>
<select id="selectUserList" resultMap="UserResult">
<select id="selectUserList" resultType="com.fuint.business.userManager.vo.LJUserVo">
<include refid="selectUser"></include>
<where>
store_id = #{user.storeId}
mu.store_id = #{user.storeId}
<if test="user.mobile != null and user.mobile != ''">
and mobile like concat('%', #{user.mobile}, '%')
and mu.mobile like concat('%', #{user.mobile}, '%')
</if>
<if test="user.userNo != null and user.userNo != ''">
and user_no like concat('%', #{user.userNo}, '%')
and mu.user_no like concat('%', #{user.userNo}, '%')
</if>
<if test="user.name != null and user.name != ''">
and name like concat('%', #{user.name}, '%')
and mu.name like concat('%', #{user.name}, '%')
</if>
<if test="user.gradeId != null and user.gradeId != ''">
and grade_id = #{user.gradeId}
</if>
<if test="user.storeId != null and user.storeId != ''">
and store_id = #{user.storeId}
and mu.grade_id = #{user.gradeId}
</if>
<if test="user.official != null and user.official != ''">
and official = #{user.official}
and mu.official = #{user.official}
</if>
<if test="user.balance != null and user.balance != '' and user.balance == 2">
and balance = 0
<if test="user.cardBalance != null and user.cardBalance != '' and user.cardBalance == 2">
and mub.cardBalance = 0
</if>
<if test="user.balance != null and user.balance != '' and user.balance == 1">
and balance != 0
<if test="user.cardBalance != null and user.cardBalance != '' and user.cardBalance == 1">
and mub.cardBalance != 0
</if>
<if test="user.params.beginTime != null and user.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{user.params.beginTime},'%y%m%d')
and date_format(mu.create_time,'%y%m%d') &gt;= date_format(#{user.params.beginTime},'%y%m%d')
</if>
<if test="user.params.endTime != null and user.params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{user.params.endTime},'%y%m%d')
and date_format(mu.create_time,'%y%m%d') &lt;= date_format(#{user.params.endTime},'%y%m%d')
</if>
</where>
</select>
<select id="selectSumByStore" resultType="java.lang.Double" parameterType="int">
select sum(${sumValue}) from mt_user where store_id = #{storeId}
select sum(${sumValue}) from mt_user_balance where store_id = #{storeId}
</select>
</mapper>

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.vo.LJUserVo;
import java.util.List;
import java.util.Map;
@ -17,7 +18,7 @@ public interface LJUserService extends IService<LJUser> {
* @param page
* @return
*/
public IPage<LJUser> selectUserList(Page page, LJUser user);
public IPage<LJUserVo> selectUserList(Page page, LJUserVo user);
/**
* 查询会员统计信息
@ -50,7 +51,7 @@ public interface LJUserService extends IService<LJUser> {
* @param user
* @return
*/
public int insertUser(LJUser user);
public int insertUser(LJUserVo user);
/**
* 修改会员信息

View File

@ -0,0 +1,23 @@
package com.fuint.business.userManager.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.userManager.entity.UserBalance;
/**
* 会员储值卡信息 业务层
*/
public interface UserBalanceService extends IService<UserBalance> {
/**
* 增加会员储值信息信息
* @param balance
* @return
*/
public int insertUserBalance(UserBalance balance);
/**
* 根据用户id删除会员储值信息
* @param userId
*/
public void deleteUserBalanceByUserId(Integer userId);
}

View File

@ -6,9 +6,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.userManager.entity.CertifiedMember;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.CertifiedMemberMapper;
import com.fuint.business.userManager.mapper.LJUserMapper;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
@ -23,6 +26,8 @@ import java.util.*;
public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> implements LJUserService {
@Autowired
private CertifiedMemberMapper certifiedMemberMapper;
@Autowired
private UserBalanceService balanceService;
/**
* 根据条件分页查询会员信息
@ -31,11 +36,11 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
* @return
*/
@Override
public IPage<LJUser> selectUserList(Page page, LJUser user) {
public IPage<LJUserVo> selectUserList(Page page, LJUserVo user) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
user.setStoreId(storeId);
IPage<LJUser> ljUserIPage = baseMapper.selectUserList(page, user);
IPage<LJUserVo> ljUserIPage = baseMapper.selectUserList(page, user);
return ljUserIPage;
}
@ -48,10 +53,10 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
Map<String ,Object> map = new HashMap<>();
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
Double balance = baseMapper.selectSumByStore(storeId, "balance");
Double point = baseMapper.selectSumByStore(storeId, "point");
Double literCard = baseMapper.selectSumByStore(storeId, "liter_card");
Double refuelMoney = baseMapper.selectSumByStore(storeId, "refuel_money");
Double balance = baseMapper.selectSumByStore(storeId, "card_balance");
Double point = baseMapper.selectSumByStore(storeId, "points");
// Double literCard = baseMapper.selectSumByStore(storeId, "liter_card");
// Double refuelMoney = baseMapper.selectSumByStore(storeId, "refuel_money");
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.apply(true, "TO_DAYS(NOW())-TO_DAYS(create_time) = 0");
@ -64,8 +69,8 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
map.put("balance",balance);
map.put("point",point);
map.put("literCard",literCard);
map.put("refuelMoney",refuelMoney);
// map.put("literCard",literCard);
// map.put("refuelMoney",refuelMoney);
map.put("addNum",addNum);
map.put("yesterdayAddNum",yesterdayAddNum);
return map;
@ -100,6 +105,7 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
@Override
public void deleteUserById(Integer id) {
baseMapper.deleteById(id);
balanceService.deleteUserBalanceByUserId(id);
}
/**
@ -108,10 +114,11 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
* @return
*/
@Override
public int insertUser(LJUser user) {
public int insertUser(LJUserVo user) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
user.setStoreId(storeId);
LJUser user1 = new LJUser();
user1.setStoreId(storeId);
if (user.getMobile()==null || user.getMobile().equals("")){
return 0;
}
@ -119,9 +126,35 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
// String timestamp = dateFormat.format(new Date());
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
user.setUserNo(randomString);
user1.setUserNo(randomString);
}
int row = baseMapper.insert(user);
user1.setUserNo(user.getUserNo());
user1.setAvatar(user.getAvatar());
user1.setName(user.getName());
user1.setOpenId(user.getOpenId());
user1.setMobile(user.getMobile());
user1.setIdcard(user.getIdcard());
user1.setGradeId(user.getGradeId());
user1.setSex(user.getSex());
user1.setBirthday(user.getBirthday());
user1.setCarNo(user.getCarNo());
user1.setAddress(user.getAddress());
user1.setStatus(user.getStatus());
user1.setDescription(user.getDescription());
user1.setOfficial(user.getOfficial());
user1.setConsumeNum(user.getConsumeNum());
user1.setSecondCard(user.getSecondCard());
user1.setFixingLevel(user.getFixingLevel());
int row = baseMapper.insert(user1);
// 查询添加后的用户id
LJUser ljUser = this.selectUserByMobile(user.getMobile());
// 添加用户储值卡信息
UserBalance balance = new UserBalance();
balance.setMtUserId(ljUser.getId());
balance.setCardBalance(user.getCardBalance());
balance.setPoints(user.getPoints());
balance.setStoreId(storeId);
balanceService.insertUserBalance(balance);
return row;
}

View File

@ -0,0 +1,27 @@
package com.fuint.business.userManager.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.UserBalanceMapper;
import com.fuint.business.userManager.service.UserBalanceService;
import org.springframework.stereotype.Service;
/**
* 会员储值卡信息 业务层
*/
@Service
public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserBalance> implements UserBalanceService {
@Override
public int insertUserBalance(UserBalance balance) {
int row = baseMapper.insert(balance);
return row;
}
@Override
public void deleteUserBalanceByUserId(Integer userId) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("mt_user_id",userId);
baseMapper.delete(queryWrapper);
}
}

View File

@ -0,0 +1,86 @@
package com.fuint.business.userManager.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fuint.business.userManager.util.GenderConverter;
import com.fuint.framework.entity.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ExcelIgnoreUnannotated
public class LJUserVo extends BaseEntity {
private Integer id;
// 会员号
@ExcelProperty(value = "会员号")
private String userNo;
// 头像
private String avatar;
// 称呼
@ExcelProperty(value = "姓名")
private String name;
// 微信
@ExcelProperty(value = "微信")
private String openId;
// 手机号码
@ExcelProperty(value = "手机号码(必填)")
private String mobile;
// 证件号码
@ExcelProperty(value = "证件号码")
private String idcard;
// 等级ID
private String gradeId;
// 性别 1男,0女
@ExcelProperty(value = "性别",converter = GenderConverter.class)
private Integer sex;
// 储值卡
@ExcelProperty(value = "储值卡余额")
private Double cardBalance;
// 积分
@ExcelProperty(value = "积分余额")
private Integer points;
// 出生日期
private String birthday;
// 车牌号
private String carNo;
// 地址
@ExcelProperty(value = "地址")
private String address;
// 默认店铺
private Integer storeId;
// 状态启用禁用
private String status;
// 备注信息
@ExcelProperty(value = "备注信息")
private String description;
// 公众号
private String official;
// 加油次数
private BigDecimal consumeNum;
// 副卡信息
@ExcelProperty(value = "副卡信息")
private String secondCard;
// 固定等级
private String fixingLevel;
}

View File

@ -0,0 +1,7 @@
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
</web-app>

View File

@ -0,0 +1,5 @@
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>

View File

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fuint</groupId>
<artifactId>fuint</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>fuint-payment</artifactId>
<description>
对接第三方支付
</description>
<!-- <properties>-->
<!-- <maven.compiler.source>8</maven.compiler.source>-->
<!-- <maven.compiler.target>8</maven.compiler.target>-->
<!-- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>-->
<!-- </properties>-->
<dependencies>
<dependency>
<groupId>com.fuint</groupId>
<artifactId>fuint-framework</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>nl.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>1.2.4</version>
<scope>compile</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.fuint</groupId>-->
<!-- <artifactId>fuint-application</artifactId>-->
<!-- <version>1.0.0</version>-->
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.5.12</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
</project>

View File

@ -0,0 +1,39 @@
package com.fuint.api.fuyou.controller;
import com.fuint.api.fuyou.service.FyPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping("/api/fyPay")
public class FyPayController {
@Autowired
private FyPayService payService;
/**
* 成功result_msg显示success
* result_code显示000000
* @param map
* @return
* @throws Exception
*/
@PostMapping
public Map<String, String> run(@RequestBody Map<String ,String> map) throws Exception {
Map<String, String> pay = payService.pay(map);
return pay;
}
/**
* 查询订单信息 成功 result_msg 显示success
* result_code显示000000
* @return
* @throws Exception
*/
@PostMapping("/query")
public Map<String, String> queryOrder() throws Exception {
Map<String, String> map = payService.queryOrder();
return map;
}
}

View File

@ -0,0 +1,151 @@
package com.fuint.api.fuyou.entity;
import org.apache.shiro.crypto.RandomNumberGenerator;
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
import java.security.SecureRandom;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
public class Builder {
private static RandomNumberGenerator randomNumberGenerator = new SecureRandomNumberGenerator();
private static SecureRandom random = new SecureRandom();
/**
* 统一下单
*
* @return
*/
public static Map<String, String> buildFuiou21() {
Map<String, String> map = new HashMap<>();
map.put("version", "1");
map.put("ins_cd", Const.ins_cd);
map.put("mchnt_cd", Const.mchnt_cd);
map.put("term_id", "88888888");
map.put("random_str", randomNumberGenerator.nextBytes().toHex());
map.put("sign", "");
map.put("order_type", "WECHAT");
map.put("goods_des", "这是一个货物");
map.put("goods_detail", "");
map.put("addn_inf", "");
SimpleDateFormat sdf_no = new SimpleDateFormat("yyyyMMddHHmmssSSS");
Calendar calendar = Calendar.getInstance();
map.put("mchnt_order_no", sdf_no.format(calendar.getTime()) + (int) (random.nextDouble() * 100000));
map.put("curr_type", "");
map.put("order_amt", "1");
map.put("term_ip", Const.term_ip);
SimpleDateFormat sdf_ts = new SimpleDateFormat("yyyyMMddHHmmss");
map.put("txn_begin_ts", sdf_ts.format(calendar.getTime()));
map.put("goods_tag", "");
map.put("notify_url", Const.notify_url);
map.put("reserved_sub_appid", "");
map.put("reserved_limit_pay", "");
return map;
}
/**
* 条码支付下单
*
* @return
*/
public static Map<String, String> buildFuiou22() {
Map<String, String> map = new HashMap<>();
map.put("version", Const.version);
map.put("ins_cd", Const.ins_cd);
map.put("mchnt_cd", Const.mchnt_cd);
map.put("term_id", Const.term_id);
map.put("random_str", randomNumberGenerator.nextBytes().toHex());
map.put("sign", "");
map.put("order_type", Const.order_type);
map.put("goods_des", Const.goods_des);
map.put("goods_detail", "");
map.put("addn_inf", "");
SimpleDateFormat sdf_no = new SimpleDateFormat("yyyyMMddHHmmssSSS");
Calendar calendar = Calendar.getInstance();
// sdf_no.format(calendar.getTime()) + (int) (random.nextDouble() * 100000)
map.put("mchnt_order_no", "14527847");
map.put("curr_type", "");
map.put("order_amt", "1");
map.put("term_ip", Const.term_ip);
SimpleDateFormat sdf_ts = new SimpleDateFormat("yyyyMMddHHmmss");
map.put("goods_tag", "");
map.put("sence", "1");
map.put("txn_begin_ts", sdf_ts.format(calendar.getTime()));
map.put("auth_code", Const.auth_code);
map.put("reserved_expire_minute", "1");
return map;
}
/**
* 条码支付下单
*
* @return
*/
public static Map<String, String> buildFuiou30() {
Map<String, String> map = new HashMap<>();
map.put("version", Const.version);
map.put("ins_cd", Const.ins_cd);
map.put("mchnt_cd", Const.mchnt_cd);
map.put("term_id", Const.term_id);
map.put("random_str", randomNumberGenerator.nextBytes().toHex());
map.put("sign", "");
map.put("order_type", Const.order_type);
map.put("mchnt_order_no", "14527848");
return map;
}
/**
* 公众号/服务窗统一下单
*
* @return
*/
public static Map<String, String> buildFuiou23() {
Map<String, String> map = new HashMap<>();
map.put("version", "1.0");
map.put("ins_cd", Const.ins_cd);
map.put("mchnt_cd", "6510F5938854");//0001210F0976403富友商户号服务商模式0001210F0976403
map.put("term_id", "88888888");
map.put("random_str", randomNumberGenerator.nextBytes().toHex());
map.put("sign", "");
map.put("goods_des", "这是一个货物");
map.put("goods_detail", "");
map.put("goods_tag", "");
map.put("product_id", "");
SimpleDateFormat sdf_no = new SimpleDateFormat("yyyyMMddHHmmssSSS");
Calendar calendar = Calendar.getInstance();
map.put("mchnt_order_no", sdf_no.format(calendar.getTime()) + (int) (random.nextDouble() * 100000));
map.put("curr_type", "CNY");
map.put("order_amt", "1");
map.put("term_ip", Const.term_ip);
SimpleDateFormat sdf_ts = new SimpleDateFormat("yyyyMMddHHmmss");
map.put("txn_begin_ts", sdf_ts.format(calendar.getTime()));
map.put("notify_url", Const.notify_url);
map.put("limit_pay", "");
map.put("trade_type", "JSAPI");//微信小程序
// map.put("trade_type","LETPAY");//微信小程序
// map.put("trade_type","FWC");//支付宝服务窗
map.put("openid", "ooIeqs5VwPJnDUYfLweOKcR5AxpE"); //富友公众号 ooIeqs5VwPJnDUYfLweOKcR5AxpE
map.put("sub_openid", "osgI-t3iTLkEdGhhwTwyYy_QiqFM");//服务窗时填buyer_id的值 公众号的osgI-t3iTLkEdGhhwTwyYy_QiqFM
map.put("sub_appid", "wx04bdf63c774e12ce");//公众号的 wx04bdf63c774e12ce
map.put("reserved_fy_term_id", "");
map.put("reserved_expire_minute", "0");
// map.put("reserved_user_creid ","");
map.put("reserved_user_truename", "");
map.put("reserved_user_mobile", "");
map.put("addn_inf", "");
return map;
}
}

View File

@ -0,0 +1,77 @@
package com.fuint.api.fuyou.entity;
import lombok.Data;
@Data
public class Const {
//编码
public static String charset = "GBK";
//富友公钥 用于验签
public static final String FY_PUBLIC_KEY ="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCBv9K+jiuHqXIehX81oyNSD2RfVn+KTPb7NRT5HDPFE35CjZJd7Fu40r0U2Cp7Eyhayv/mRS6ZqvBT/8tQqwpUExTQQBbdZjfk+efb9bF9a+uCnAg0RsuqxeJ2r/rRTsORzVLJy+4GKcv06/p6CcBc5BI1gqSKmyyNBlgfkxLYewIDAQAB";
public static String version = "1.0";
//机构私钥
public static final String INS_PRIVATE_KEY ="MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJgAzD8fEvBHQTyxUEeK963mjziM\n" +
"WG7nxpi+pDMdtWiakc6xVhhbaipLaHo4wVI92A2wr3ptGQ1/YsASEHm3m2wGOpT2vrb2Ln/S7lz1\n" +
"ShjTKaT8U6rKgCdpQNHUuLhBQlpJer2mcYEzG/nGzcyalOCgXC/6CySiJCWJmPyR45bJAgMBAAEC\n" +
"gYBHFfBvAKBBwIEQ2jeaDbKBIFcQcgoVa81jt5xgz178WXUg/awu3emLeBKXPh2i0YtN87hM/+J8\n" +
"fnt3KbuMwMItCsTD72XFXLM4FgzJ4555CUCXBf5/tcKpS2xT8qV8QDr8oLKA18sQxWp8BMPrNp0e\n" +
"pmwun/gwgxoyQrJUB5YgZQJBAOiVXHiTnc3KwvIkdOEPmlfePFnkD4zzcv2UwTlHWgCyM/L8SCAF\n" +
"clXmSiJfKSZZS7o0kIeJJ6xe3Mf4/HSlhdMCQQCnTow+TnlEhDTPtWa+TUgzOys83Q/VLikqKmDz\n" +
"kWJ7I12+WX6AbxxEHLD+THn0JGrlvzTEIZyCe0sjQy4LzQNzAkEAr2SjfVJkuGJlrNENSwPHMugm\n" +
"vusbRwH3/38ET7udBdVdE6poga1Z0al+0njMwVypnNwy+eLWhkhrWmpLh3OjfQJAI3BV8JS6xzKh\n" +
"5SVtn/3Kv19XJ0tEIUnn2lCjvLQdAixZnQpj61ydxie1rggRBQ/5vLSlvq3H8zOelNeUF1fT1QJA\n" +
"DNo+tkHVXLY9H2kdWFoYTvuLexHAgrsnHxONOlSA5hcVLd1B3p9utOt3QeDf6x2i1lqhTH2w8gzj\n" +
"vsnx13tWqg==";
// 机构号
public static String ins_cd = "08A9999999";
// public static String ins_cd = "08K0056616";
// 商户号
public static String mchnt_cd = "0002900F0370542";
// public static String mchnt_cd = "0004510F6119622";
// 终端号
public static String term_id = "88888888";
// 随机字符串
public static String random_str;
// 签名
public static String sign;
// 订单类型
public static String order_type = "WECHAT";
// 商品名称
public static String goods_des = "测试";
// 订单总金额
public static Double order_amt = 1.0;
// 实时交易终端IP
public static String term_ip = "127.0.0.1";
// 交易起始时间
public static String txn_begin_ts;
// 扫码支付授权码
public static String auth_code = "134429487327511978";
// 交易关闭时间
public static Integer reserved_expire_minute = 1;
//机构公钥
public static final String INS_PUBLIC_KEY="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCYAMw/HxLwR0E8sVBHivet5o84jFhu58aYvqQzHbVompHOsVYYW2oqS2h6OMFSPdgNsK96bRkNf2LAEhB5t5tsBjqU9r629i5/0u5c9UoY0ymk/FOqyoAnaUDR1Li4QUJaSXq9pnGBMxv5xs3MmpTgoFwv+gskoiQliZj8keOWyQIDAQAB";
//异步通知(回调地址)
public static String notify_url = "http://www.wrx.cn";
//下单
public static String fuiou_21_url = "https://fundwx.fuiou.com/preCreate";
//扫码
public static String fuiou_22_url = "https://fundwx.fuiou.com/micropay";
//公众号/服务窗统一下单
public static String fuiou_23_url = "https://fundwx.fuiou.com/wxPreCreate";
//退款
public static String fuiou_24_url = "https://fundwx.fuiou.com/commonRefund";
//资金划拨信息
// public static String fuiou_xx_url = "https://fundwx.fuiou.com/queryChnlPayAmt";
//查询可提现资金
public static String fuiou_27_url = "https://fundwx.fuiou.com/queryWithdrawAmt";
//查询手续费
public static String fuiou_28_url = "https://fundwx.fuiou.com/queryFeeAmt";
//提现
public static String fuiou_29_url = "https://fundwx.fuiou.com/withdraw";
//查询
public static String fuiou_30_url = "https://fundwx.fuiou.com/commonQuery";
}

View File

@ -0,0 +1,19 @@
package com.fuint.api.fuyou.service;
import java.util.Map;
public interface FyPayService {
/**
* 条码支付
* @param map
* @return
*/
public Map<String, String> pay(Map<String ,String> map) throws Exception;
/**
* 查询订单交易状态
* @return
* @throws Exception
*/
public Map<String, String> queryOrder() throws Exception;
}

View File

@ -0,0 +1,87 @@
package com.fuint.api.fuyou.service.impl;
import cn.hutool.http.HttpUtil;
import com.fuint.api.fuyou.entity.Builder;
import com.fuint.api.fuyou.entity.Const;
import com.fuint.api.fuyou.service.FyPayService;
import com.fuint.api.fuyou.util.Utils;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.springframework.stereotype.Service;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@Service
public class FyPayServiceImpl implements FyPayService {
@Override
public Map<String, String> pay(Map<String, String> map1) throws Exception {
String authCode = map1.get("authCode");
Map<String, String> map = Builder.buildFuiou22();
map.put("auth_code",authCode);
Map<String, String> reqs = new HashMap<>();
reqs.putAll(map);
String sign = Utils.getSign(reqs);
reqs.put("sign", sign);
Document doc = DocumentHelper.createDocument();
Element root = doc.addElement("xml");
Iterator it = reqs.keySet().iterator();
while (it.hasNext()) {
String key = it.next().toString();
String value = reqs.get(key);
root.addElement(key).addText(value);
}
String reqBody = "<?xml version=\"1.0\" encoding=\"GBK\" standalone=\"yes\"?>" + doc.getRootElement().asXML();
reqBody = URLEncoder.encode(reqBody, Const.charset);
Map<String, Object> reqParam = new HashMap<>();
reqParam.put("req",reqBody);
String resMsg = HttpUtil.post(Const.fuiou_22_url, reqParam);
String rspXml = URLDecoder.decode(resMsg, Const.charset);
//响应报文验签
Map<String, String> resMap = Utils.xmlStr2Map(rspXml);
String str = resMap.get("sign");
if (Utils.verifySign(resMap, str)){
return resMap;
}
return null;
}
@Override
public Map<String, String> queryOrder() throws Exception {
Map<String, String> map = Builder.buildFuiou30();
Map<String, String> reqs = new HashMap<>();
reqs.putAll(map);
String sign = Utils.getSign(reqs);
reqs.put("sign", sign);
Document doc = DocumentHelper.createDocument();
Element root = doc.addElement("xml");
Iterator it = reqs.keySet().iterator();
while (it.hasNext()) {
String key = it.next().toString();
String value = reqs.get(key);
root.addElement(key).addText(value);
}
String reqBody = "<?xml version=\"1.0\" encoding=\"GBK\" standalone=\"yes\"?>" + doc.getRootElement().asXML();
reqBody = URLEncoder.encode(reqBody, Const.charset);
Map<String, Object> reqParam = new HashMap<>();
reqParam.put("req",reqBody);
String resMsg = HttpUtil.post(Const.fuiou_30_url, reqParam);
String rspXml = URLDecoder.decode(resMsg, Const.charset);
//响应报文验签
Map<String, String> resMap = Utils.xmlStr2Map(rspXml);
String str = resMap.get("sign");
if (Utils.verifySign(resMap, str)){
return resMap;
}
return null;
}
}

View File

@ -0,0 +1,96 @@
package com.fuint.api.fuyou.util;
import com.fuint.api.fuyou.entity.Const;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import java.io.IOException;
import java.security.*;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
public class Sign {
/**
* sign(RSA签名方法)
* TODO(这里描述这个方法适用条件 可选)
*
* @param srcSignPacket URL拼接的参数
* @param privateKey 私钥
* @return String DOM对象
* @Exception 异常对象
*/
public static String sign(String srcSignPacket, String privateKey)
throws IOException, NoSuchAlgorithmException,
InvalidKeySpecException, InvalidKeyException, SignatureException {
// 解密由base64编码的私钥
byte[] bytesKey = (new BASE64Decoder()).decodeBuffer(privateKey);
// 构造PKCS8EncodedKeySpec对象
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(bytesKey);
// KEY_ALGORITHM 指定的加密算法
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
// 取私钥匙对象
PrivateKey priKey = keyFactory.generatePrivate(pkcs8KeySpec);
// 用私钥对信息生成数字签名
Signature signature = Signature.getInstance("MD5WithRSA");
signature.initSign(priKey);
signature.update(srcSignPacket.getBytes(Const.charset));
String sign = (new BASE64Encoder()).encodeBuffer(signature.sign());
return sign;
}
/**
* 校验数字签名
*
* @param data 加密数据
* @param publicKey 公钥
* @param sign 数字签名
* @return 校验成功返回true 失败返回false
* @throws Exception
*/
public static boolean verify(byte[] data, String publicKey, String sign) throws Exception {
// 解密由base64编码的公钥
byte[] keyBytes = decryptBASE64(publicKey);
// 构造X509EncodedKeySpec对象
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
// KEY_ALGORITHM 指定的加密算法
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
// 取公钥匙对象
PublicKey pubKey = keyFactory.generatePublic(keySpec);
Signature signature = Signature.getInstance("MD5withRSA");
signature.initVerify(pubKey);
signature.update(data);
// 验证签名是否正常
return signature.verify(decryptBASE64(sign));
}
/**
* BASE64加密
*
* @param key
* @return
* @throws Exception
*/
public static String encryptBASE64(byte[] key) throws Exception {
return (new BASE64Encoder()).encodeBuffer(key);
}
/**
* BASE64解密
*
* @param key
* @return
* @throws Exception
*/
public static byte[] decryptBASE64(String key) throws Exception {
return (new BASE64Decoder()).decodeBuffer(key);
}
}

View File

@ -0,0 +1,138 @@
package com.fuint.api.fuyou.util;
import com.fuint.api.fuyou.entity.Const;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.security.spec.InvalidKeySpecException;
import java.util.*;
public class Utils {
/**
* 准备签名所需字段(并不是每个参数都需要进行签名具体看官网)
* @param map
* @return
*/
public static Map<String, String> paraFilter(Map<String, String> map) {
Map<String, String> result = new HashMap<>();
if (map == null || map.size() <= 0) {
return result;
}
for (String key : map.keySet()) {
String value = map.get(key);
if (key.equalsIgnoreCase("sign") || (key.length() >= 8 && key.substring(0, 8).equalsIgnoreCase("reserved"))) {
continue;
}
result.put(key, value);
}
return result;
}
/**
* 准备请求生成订单的 拼接地址 参数
* @param map
* @return
*/
public static String createLinkString(Map<String, String> map) {
List<String> keys = new ArrayList<>(map.keySet());
Collections.sort(keys);
String prestr = "";
for (int i = 0; i < keys.size(); i++) {
String key = keys.get(i);
String value = map.get(key);
if (i == keys.size() - 1) {
//拼接时不包括最后一个&字符
prestr = prestr + key + "=" + value;
} else {
prestr = prestr + key + "=" + value + "&";
}
}
return prestr;
}
/**
* 获取签名
* @param map 准备签名所需要的字段参数
* @return
* @throws InvalidKeySpecException
* @throws SignatureException
* @throws NoSuchAlgorithmException
* @throws InvalidKeyException
* @throws IOException
*/
public static String getSign(Map<String, String> map) throws InvalidKeySpecException, SignatureException, NoSuchAlgorithmException, InvalidKeyException, IOException {
Map<String, String> mapNew = paraFilter(map);
String preSignStr = createLinkString(mapNew);
// System.out.println("==============================待签名字符串==============================\r\n" + preSignStr);
String sign = Sign.sign(preSignStr, Const.INS_PRIVATE_KEY);
sign = sign.replace("\r\n", "");
// System.out.println("==============================签名字符串==============================\r\n" + sign);
return sign;
}
/**
* 校验返回签名
* @param map
* @param sign
* @return
* @throws Exception
*/
public static Boolean verifySign(Map<String, String> map, String sign) throws Exception {
Map<String, String> mapNew = paraFilter(map);
String preSignStr = createLinkString(mapNew);
return Sign.verify(preSignStr.getBytes(Const.charset), Const.FY_PUBLIC_KEY, sign);
}
/**
* 将接收到的xml字符串转map
* @param xmlStr
* @return
*/
public static Map<String,String> xmlStr2Map(String xmlStr){
Map<String,String> map = new HashMap<String,String>();
Document doc;
try {
doc = DocumentHelper.parseText(xmlStr);
Element resroot = doc.getRootElement();
List children = resroot.elements();
if(children != null && children.size() > 0) {
for(int i = 0; i < children.size(); i++) {
Element child = (Element)children.get(i);
// map.put(child.getName(), child.getTextTrim());//会将换行符转换成空格
map.put(child.getName(), child.getStringValue().trim());
}
}
} catch (DocumentException e) {
e.printStackTrace();
}
return map;
}
}

View File

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

View File

@ -0,0 +1,91 @@
package com.fuint.api.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;
/**
* 订单表(MtOrder)实体类
*/
@Data
@TableName("mt_order")
@ApiModel(value = "LJOrder对象", description = "订单表")
public class LJOrder extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 自增ID
*/
@ApiModelProperty("自增ID")
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
/**
* 订单类型
*/
private String type;
/**
* 付款用户
*/
private String payUser;
/**
* 支付类型
*/
private String payType;
/**
* 订单号
*/
private String orderNo;
/**
* 所属店铺ID
*/
private Integer storeId;
/**
* 用户ID
*/
private Integer userId;
/**
* 订单金额
*/
private Double amount;
/**
* 支付金额
*/
private Double payAmount;
/**
* 使用积分数量
*/
private Integer usePoint;
/**
* 积分金额
*/
private Double pointAmount;
/**
* 折扣金额
*/
private Double discount;
/**
* 用户备注
*/
private String remark;
/**
* 订单状态
*/
private String status;
/**
* 支付时间
*/
private Date payTime;
/**
* 操作员工
*/
private Integer staffId;
}

View File

@ -0,0 +1,20 @@
package com.fuint.api.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.api.order.entity.LJOrder;
import org.apache.ibatis.annotations.Param;
/**
* 订单信息 Mapper层
*/
public interface LJOrderMapper extends BaseMapper<LJOrder> {
/**
* 根据条件分页查询订单信息
* @param page
* @param order
* @return
*/
public IPage<LJOrder> selectOrderList(Page page, @Param("order") LJOrder order);
}

View File

@ -0,0 +1,35 @@
<?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.order.mapper.LJOrderMapper">
<sql id="selectOrders">
select * from mt_order
</sql>
<select id="selectOrderList" resultType="com.fuint.api.order.entity.LJOrder">
<include refid="selectOrders"></include>
<where>
store_id = #{order.storeId}
<if test="order.staffId != null and order.staffId != ''">
and staff_id = #{order.staffId}
</if>
<if test="order.type != null and order.type != ''">
and type = #{order.type}
</if>
<if test="order.payType != null and order.payType != ''">
and pay_type = #{order.payType}
</if>
<if test="order.orderNo != null and order.orderNo != ''">
and order_no like concat('%', #{order.orderNo}, '%')
</if>
<if test="order.payUser != null and order.payUser != ''">
and pay_user like concat('%', #{order.payUser}, '%')
</if>
<if test="order.params.beginTime != null and order.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{order.params.beginTime},'%y%m%d')
</if>
<if test="order.params.endTime != null and order.params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{order.params.endTime},'%y%m%d')
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,20 @@
package com.fuint.api.order.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.api.order.entity.LJOrder;
import org.apache.ibatis.annotations.Param;
/**
* 订单信息 业务层
*/
public interface LJOrderService extends IService<LJOrder> {
/**
* 根据条件分页查询订单信息
* @param page
* @param order
* @return
*/
public IPage<LJOrder> selectOrderList(Page page, LJOrder order);
}

View File

@ -0,0 +1,23 @@
package com.fuint.api.order.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.api.order.entity.LJOrder;
import com.fuint.api.order.mapper.LJOrderMapper;
import com.fuint.api.order.service.LJOrderService;
import org.springframework.stereotype.Service;
//import com.fuint.common.dto.AccountInfo;
//import com.fuint.common.util.TokenUtil;
@Service
public class LJOrderServiceImpl extends ServiceImpl<LJOrderMapper, LJOrder> implements LJOrderService {
@Override
public IPage<LJOrder> selectOrderList(Page page, LJOrder order) {
// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// Integer storeId = nowAccountInfo.getStoreId();
order.setStoreId(0);
IPage<LJOrder> ljOrderIPage = baseMapper.selectOrderList(page, order);
return ljOrderIPage;
}
}

View File

@ -15,6 +15,9 @@
<module>fuint-application</module>
<module>fuint-framework</module>
<module>fuint-quartz</module>
<module>fuint-payment</module>
<module>fuint-payment/circular_dependency</module>
<module>circular_dependent</module>
</modules>
<parent>
@ -34,6 +37,11 @@
</properties>
<dependencies>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.16</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>