This commit is contained in:
cun-nan 2024-08-08 15:53:07 +08:00
parent 694dbdbac7
commit 927bbf4e07
17 changed files with 785 additions and 97 deletions

View File

@ -0,0 +1,45 @@
import request from '@/utils/request'
// 分页查询所有的订单信息
export function getFleetConsumeRecordList(query) {
return request({
url: 'fleetConsumeRecord',
method: 'get',
params: query
})
}
// 分页查询所有的订单信息
export function getFleetConsumeRecord(id) {
return request({
url: 'fleetConsumeRecord/'+id,
method: 'get',
})
}
// 分页查询所有的订单信息
export function addFleetConsumeRecord(data) {
return request({
url: 'fleetConsumeRecord',
method: 'post',
data: data
})
}
// 分页查询所有的订单信息
export function editFleetConsumeRecord(data) {
return request({
url: 'fleetConsumeRecord',
method: 'put',
data: data
})
}
// 分页查询所有的订单信息
export function deleteFleetConsumeRecord(id) {
return request({
url: 'fleetConsumeRecord/'+id,
method: 'delete',
})
}

View File

@ -172,7 +172,7 @@
</el-form-item> </el-form-item>
<el-form-item label="姓名" prop="name"> <el-form-item label="姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入成员姓名" maxlength="30" /> <el-input v-model="form.name" placeholder="请输入成员姓名" maxlength="30"/>
</el-form-item> </el-form-item>
<el-form-item label="手机号码" prop="mobile"> <el-form-item label="手机号码" prop="mobile">
@ -222,13 +222,13 @@
<el-form ref="form1" :model="form1" :rules="rules" label-width="120px"> <el-form ref="form1" :model="form1" :rules="rules" label-width="120px">
<el-form-item label="副卡额度" prop="secondaryCardLimit"> <el-form-item label="副卡额度" prop="secondaryCardLimit">
<el-input v-model="form1.secondaryCardLimit" disabled placeholder="0.0" maxlength="30" > <el-input v-model="form1.secondaryCardLimit" disabled placeholder="0.0" maxlength="30">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="已用额度" prop="usedCreditLimit"> <el-form-item label="已用额度" prop="usedCreditLimit">
<el-input v-model="form1.usedCreditLimit" disabled placeholder="0.0" maxlength="30" > <el-input v-model="form1.usedCreditLimit" disabled placeholder="0.0" maxlength="30">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -268,19 +268,19 @@
<el-form ref="form2" :model="form2" :rules="rules" label-width="120px"> <el-form ref="form2" :model="form2" :rules="rules" label-width="120px">
<el-form-item label="副卡额度" prop="secondaryCardLimit"> <el-form-item label="副卡额度" prop="secondaryCardLimit">
<el-input v-model="form2.secondaryCardLimit" placeholder="0.0" maxlength="30" style="width: 270px"> <el-input v-model="form2.secondaryCardLimit" disabled placeholder="0.0" maxlength="30" >
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="已用额度" prop="usedCreditLimit"> <el-form-item label="已用额度" prop="usedCreditLimit">
<el-input v-model="form2.usedCreditLimit" placeholder="0.0" maxlength="30" style="width: 270px"> <el-input v-model="form2.usedCreditLimit" disabled placeholder="0.0" maxlength="30" >
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="剩余额度" prop="remainingCreditLimit"> <el-form-item label="剩余额度" prop="remainingCreditLimit">
<el-input v-model="form2.remainingCreditLimit" placeholder="0.0"> <el-input v-model="form2.remainingCreditLimit" disabled placeholder="0.0">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -290,20 +290,20 @@
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm2"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="open2 = false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 批量添加用户认证信息 --> <!-- 批量添加用户认证信息 -->
<el-dialog :title="title" :visible.sync="open2" width="30%" <el-dialog :title="title" :visible.sync="open3" width="30%"
:close-on-click-modal="false" append-to-body> :close-on-click-modal="false" append-to-body>
<el-form ref="form2" :model="form2" :rules="rules"> <el-form ref="form2" :model="form3" :rules="rules">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="车队名称" prop="fleetId"> <el-form-item label="车队名称" prop="fleetId">
<el-select <el-select
v-model="form2.fleetId" v-model="form3.fleetId"
placeholder="请选择车队名称" placeholder="请选择车队名称"
clearable clearable
> >
@ -321,11 +321,11 @@
<el-upload <el-upload
class="upload-demo" class="upload-demo"
v-loading="uploading" v-loading="uploading"
action="/fuint-application/business/userManager/certifiedMember/import" action="/dev-api/fleetMember/import"
:headers="headers" :headers="headers"
:limit="1" :limit="1"
:on-change="handleChange" :on-change="handleChange"
style="margin-left: 50px" style="margin-left: 50px;width: 200px"
:file-list="fileList"> :file-list="fileList">
<div style="display: flex;margin-left: 20px"> <div style="display: flex;margin-left: 20px">
<div style="position: relative"> <div style="position: relative">
@ -334,18 +334,20 @@
<span style="color: #FF9655">点击导入</span> 文件 <span style="color: #FF9655">点击导入</span> 文件
</div> </div>
</div> </div>
<div style="margin-top: 120px">
<a style="margin-left: 50px;color: #FF9655;"
href="/fuint-application/business/userManager/certifiedMember/export"> 导入模板下载.xlsx </a>
</div>
</div> </div>
<!-- <el-button size="small" type="success" icon="el-icon-upload">点击上传</el-button>--> <!-- <el-button size="small" type="success" icon="el-icon-upload">点击上传</el-button>-->
<div slot="tip" style="margin-top: 20px;color: grey;font-size: 12px;line-height: 20px">
只能上传xls/xlsx文件批量导入会员手机号单次最大支持5000个会员手机号认证请确保用户手机号已注册为油站会员(在会员列表已显示)否则无法添加成员信息
</div>
</el-upload> </el-upload>
<div style="margin-top: 120px">
<!-- dev-api fuint-application-->
<a style="margin-left: 50px;color: #00A1FF;"
href="/dev-api/fleetMember/export"> 导入模板下载.xlsx </a>
</div>
</div> </div>
<div style="color: grey;font-size: 12px;line-height: 20px">
只能上传xls/xlsx文件批量导入会员手机号单次最大支持5000个会员手机号认证请确保用户手机号已注册为油站会员(在会员列表已显示)否则无法添加成员信息
</div>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFormMembers"> </el-button> <el-button type="primary" @click="submitFormMembers"> </el-button>
@ -353,6 +355,25 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 批量导入结果-->
<el-dialog width="400px" style="margin-top: 150px" :title="title" :visible.sync="openResult" append-to-body>
<div class="huiyuan">
认证总数<span class="num">{{result.total}}</span>
</div>
<div class="huiyuan">
成功人数<span class="num">{{result.success}}</span>
</div>
<div class="huiyuan">
失败人数<span class="num">{{result.error}}</span>
<span v-if="result.error!=0" style="color: red;font-size: 12px">会员信息不存在</span>
</div>
<div class="huiyuan">
已认证人数<span class="num">{{result.repeat}}</span>
</div>
</el-dialog>
<el-drawer <el-drawer
title="消费记录" title="消费记录"
:visible.sync="drawer" :visible.sync="drawer"
@ -364,7 +385,7 @@
<el-form :model="queryParams2" ref="queryForm" size="small" :inline="true" label-width="68px"> <el-form :model="queryParams2" ref="queryForm" size="small" :inline="true" label-width="68px">
<el-form-item label=""> <el-form-item label="">
<el-select <el-select
v-model="queryParams2.type" v-model="queryParams2.orderStatus"
clearable clearable
placeholder="请选择订单类型" placeholder="请选择订单类型"
> >
@ -377,6 +398,21 @@
<el-form-item label=""> <el-form-item label="">
<el-input v-model="queryParams2.orderNo" placeholder="请输入订单号"></el-input> <el-input v-model="queryParams2.orderNo" placeholder="请输入订单号"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="">
<el-date-picker
v-model="beginTime1"
style="width: 160px"
type="date"
placeholder="开始日期">
</el-date-picker>
<el-date-picker
v-model="endTime1"
style="width: 160px"
type="date"
placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery1">搜索</el-button> <el-button type="primary" icon="el-icon-search" @click="handleQuery1">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery1">重置</el-button> <el-button icon="el-icon-refresh" @click="resetQuery1">重置</el-button>
@ -384,29 +420,29 @@
</el-form> </el-form>
</el-card> </el-card>
<el-card class="box-card" style="margin-top: 15px"> <el-card class="box-card" style="margin-top: 15px">
<el-table ref="tables" v-loading="loading" :data="consumeList"> <el-table ref="tables" v-loading="loading" :data="consumeList">
<el-table-column type="index" width="80" align="center" label="序号"/> <el-table-column type="index" width="80" align="center" label="序号"/>
<el-table-column label="订单号" prop="type" align="center"></el-table-column> <el-table-column label="订单号" prop="orderNo" align="center"></el-table-column>
<el-table-column label="机构信息" prop="amount" align="center"></el-table-column> <el-table-column label="机构信息" prop="storeId" align="center"></el-table-column>
<el-table-column label="储值卡付款金额" prop="orderNo" align="center" width="260"/> <el-table-column label="储值卡付款金额" prop="cardPaymentAmount" align="center" width="260"/>
<el-table-column label="订单金额" prop="description" align="center"/> <el-table-column label="订单金额" prop="orderAmount" align="center"/>
<el-table-column label="优惠金额" prop="description" align="center"/> <el-table-column label="优惠金额" prop="preferentialAmount" align="center"/>
<el-table-column label="实收金额" prop="description" align="center"/> <el-table-column label="实收金额" prop="netReceiptsAmount" align="center"/>
<el-table-column label="订单状态" prop="description" align="center"/> <el-table-column label="订单状态" prop="orderStatus" align="center"/>
<el-table-column label="订单完成时间" prop="createTime" align="center" width="160"> <el-table-column label="订单完成时间" prop="paymentTime" align="center" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total2>0" v-show="total2>0"
:total="total2" :total="total2"
:page.sync="queryParams2.page" :page.sync="queryParams2.page"
:limit.sync="queryParams2.pageSize" :limit.sync="queryParams2.pageSize"
@pagination="getList" @pagination="getRecordList"
/> />
</el-card> </el-card>
</div> </div>
</el-drawer> </el-drawer>
@ -418,9 +454,16 @@
import {delStaff} from "@/api/staff/staff"; import {delStaff} from "@/api/staff/staff";
import {getToken} from "@/utils/auth"; import {getToken} from "@/utils/auth";
import {addCertifiedMembers} from "@/api/staff/user/certifiedmember"; import {addCertifiedMembers} from "@/api/staff/user/certifiedmember";
import {addFleetMember, editFleetMember, getFleetMember, getFleetMemberList} from "@/api/fleet/fleetmember"; import {
addFleetMember,
editFleetMember,
getFleetMember,
getFleetMemberList,
logOffFleetMember
} from "@/api/fleet/fleetmember";
import {getFleetInfoList} from "@/api/fleet/fleetinfo"; import {getFleetInfoList} from "@/api/fleet/fleetinfo";
import {getUserMobile} from "@/api/staff/user/user"; import {getUserPhone} from "@/api/staff/user/user";
import {getFleetConsumeRecordList} from "@/api/fleet/fleetconsumerecord";
export default { export default {
dicts: ['zhzt'], dicts: ['zhzt'],
@ -436,23 +479,29 @@ export default {
open: false, open: false,
open1: false, open1: false,
open2: false, open2: false,
open3: false,
result:{},
openResult: false,
title: '', title: '',
// //
dateRange: [], dateRange: [],
beginTime: "", beginTime: "",
endTime: "", endTime: "",
beginTime1: "",
endTime1: "",
// //
orderList: [], orderList: [],
deptList: [], deptList: [],
fleetList: [], fleetList: [],
consumeList:[], consumeList: [],
form: {}, form: {},
form1: { form1: {
adjustType:[] adjustType: []
}, },
form2: {}, form2: {},
secondaryCardLimit:0, form3: {},
usedCreditLimit:0, secondaryCardLimit: 0,
usedCreditLimit: 0,
options: [{ options: [{
value: '1', value: '1',
label: '共享副卡-不限额' label: '共享副卡-不限额'
@ -511,25 +560,25 @@ export default {
}, },
methods: { methods: {
// //
adjustLimit(){ adjustLimit() {
if (!this.form1.secondaryCardLimit) this.form1.secondaryCardLimit = 0 if (!this.form1.secondaryCardLimit) this.form1.secondaryCardLimit = 0
if (!this.form1.usedCreditLimit) this.form1.usedCreditLimit = 0 if (!this.form1.usedCreditLimit) this.form1.usedCreditLimit = 0
if (!this.form1.remainingCreditLimit) this.form1.remainingCreditLimit = 0 if (!this.form1.remainingCreditLimit) this.form1.remainingCreditLimit = 0
if (this.form1.adjustType==0){ if (this.form1.adjustType == 0) {
this.form1.secondaryCardLimit = Number(this.secondaryCardLimit) + Number(this.form1.adjustLimit) this.form1.secondaryCardLimit = Number(this.secondaryCardLimit) + Number(this.form1.adjustLimit)
this.form1.remainingCreditLimit = this.secondaryCardLimit - this.usedCreditLimit this.form1.remainingCreditLimit = this.form1.secondaryCardLimit - this.usedCreditLimit
}else if (this.form1.adjustType==1) { } else if (this.form1.adjustType == 1) {
this.form1.secondaryCardLimit = this.secondaryCardLimit - this.form1.adjustLimit this.form1.secondaryCardLimit = this.secondaryCardLimit - this.form1.adjustLimit
this.form1.remainingCreditLimit = this.secondaryCardLimit - this.usedCreditLimit this.form1.remainingCreditLimit = this.form1.secondaryCardLimit - this.usedCreditLimit
} }
this.$forceUpdate() this.$forceUpdate()
}, },
// //
queryUser(){ queryUser() {
getUserMobile({mobile:this.form.mobile}).then(res => { getUserPhone({mobile: this.form.mobile}).then(res => {
if (res.data){ if (res.data) {
this.form.userCardNum = res.data.userNo this.form.userCardNum = res.data.userNo
}else { } else {
this.form.userCardNum = '' this.form.userCardNum = ''
} }
this.$forceUpdate() this.$forceUpdate()
@ -553,38 +602,50 @@ export default {
handleClose(done) { handleClose(done) {
done(); done();
}, },
getRecordList(){
let dateRange = []
if (this.beginTime1 && this.endTime1) {
dateRange.push(this.beginTime1.toLocaleDateString())
dateRange.push(this.endTime1.toLocaleDateString())
}
getFleetConsumeRecordList(this.addDateRange(this.queryParams2, dateRange)).then(res => {
this.consumeList = res.data.records
this.total2 = res.data.total
})
},
// //
handleChange(file, fileList) { handleChange(file, fileList) {
this.uploading = true; this.uploading = true;
if (file.status === 'success') { if (file.status === 'success') {
this.uploading = false; this.uploading = false;
this.fileList.splice(0, 1) this.fileList.splice(0, 1)
this.openMembers = false;
this.openResult = true; this.openResult = true;
this.title = "会员认证结果"; this.title = "成员录入结果";
this.result = file.response.data; this.result = file.response.data;
this.reset2(); this.reset2();
this.getListMember(); this.queryParams.page = 1
this.getList();
} }
}, },
// //
submitFormMembers: function () { submitFormMembers: function () {
this.$refs["form2"].validate(valid => { this.open3 = false;
if (valid) { this.reset2();
addCertifiedMembers(this.form2).then(response => { // this.$refs["form2"].validate(valid => {
this.openMembers = false; // if (valid) {
this.openResult = true; // addCertifiedMembers(this.form2).then(response => {
this.title = "会员认证结果"; // this.openResult = true;
this.result = response.data; // this.title = "";
this.reset2(); // this.result = response.data;
this.getListMember(); // this.reset2();
}) // this.getListMember();
} // })
}); // }
// });
}, },
// //
cancelMembers() { cancelMembers() {
this.openMembers = false; this.open3 = false;
this.reset2(); this.reset2();
}, },
getFleetList() { getFleetList() {
@ -615,23 +676,25 @@ export default {
if (valid) { if (valid) {
if (!this.form.id) { if (!this.form.id) {
addFleetMember(this.form).then(res => { addFleetMember(this.form).then(res => {
if (res.data==1){ if (res.data == 1) {
this.$message.success("添加成功") this.$message.success("添加成功")
this.open = false this.open = false
this.queryParams.page = 1 this.queryParams.page = 1
this.getList() this.getList()
}else { } else if (res.data == 2) {
this.$message.error("添加失败,请确保录入成员手机号已注册为油站会员")
} else if (res.data == 0) {
this.$message.error("添加失败,手机号不能重复") this.$message.error("添加失败,手机号不能重复")
} }
}) })
} else { } else {
editFleetMember(this.form).then(res => { editFleetMember(this.form).then(res => {
if (res.data==1){ if (res.data == 1) {
this.$message.success("修改成功") this.$message.success("修改成功")
this.open = false this.open = false
this.queryParams.page = 1 this.queryParams.page = 1
this.getList() this.getList()
}else { } else {
this.$message.error("修改失败,手机号已存在") this.$message.error("修改失败,手机号已存在")
} }
}) })
@ -643,16 +706,29 @@ export default {
submitForm1: function () { submitForm1: function () {
this.$refs["form1"].validate(valid => { this.$refs["form1"].validate(valid => {
if (valid) { if (valid) {
editFleetMember(this.form1).then(res => { editFleetMember(this.form1).then(res => {
if (res.data==1){ if (res.data == 1) {
this.$message.success("修改成功") this.$message.success("修改成功")
this.open1 = false this.open1 = false
this.queryParams.page = 1 this.queryParams.page = 1
this.getList() this.getList()
}else { } else {
this.$message.error("修改失败,手机号已存在") this.$message.error("修改失败,手机号已存在")
} }
}) })
}
});
},
//
submitForm2: function () {
this.$refs["form2"].validate(valid => {
if (valid) {
logOffFleetMember(this.form2.id).then(res => {
this.$message.success("注销成功")
this.open2 = false
this.queryParams.page = 1
this.getList()
})
} }
}); });
}, },
@ -660,7 +736,7 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.form = { this.form = {
status:'qy' status: 'qy'
} }
this.open = true; this.open = true;
this.title = "新增成员"; this.title = "新增成员";
@ -668,7 +744,8 @@ export default {
// //
batchAdd() { batchAdd() {
this.reset(); this.reset();
this.open2 = true; this.form3 = {}
this.open3 = true;
this.title = "批量新增成员"; this.title = "批量新增成员";
}, },
// //
@ -711,10 +788,10 @@ export default {
}, },
// //
handleLogOff(row) { handleLogOff(row) {
this.form1 = {} this.form2 = {}
getFleetMember(row.id).then(res => { getFleetMember(row.id).then(res => {
this.form1 = res.data this.form2 = res.data
this.open1 = true; this.open2 = true;
this.title = '注销副卡' this.title = '注销副卡'
}) })
}, },
@ -760,4 +837,9 @@ export default {
overflow: auto; overflow: auto;
} }
.huiyuan{
height: 30px;
line-height: 30px;
font-size: 16px;
}
</style> </style>

View File

@ -0,0 +1,87 @@
package com.fuint.business.fleet.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.fleet.entity.FleetConsumeRecord;
import com.fuint.business.fleet.service.FleetConsumeRecordService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 油机汽机配置(FleetConsumeRecord)表控制层
*
* @author makejava
* @since 2024-07-31 14:59:04
*/
@RestController
@RequestMapping("fleetConsumeRecord")
public class FleetConsumeRecordController extends BaseController {
/**
* 服务对象
*/
@Resource
private FleetConsumeRecordService fleetConsumeRecordService;
/**
* 根据条件分页查询首页轮播图
* @param fleetConsumeRecord
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping
public ResponseObject lists(FleetConsumeRecord fleetConsumeRecord,
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
Page page =new Page(pageNo,pageSize);
return getSuccessResult(fleetConsumeRecordService.queryPage(page,fleetConsumeRecord));
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject queryById(@PathVariable("id") Integer id) {
return getSuccessResult(fleetConsumeRecordService.queryById(id));
}
/**
* 新增数据
*
* @param fleetConsumeRecord 实体
* @return 新增结果
*/
@PostMapping
public ResponseObject add(@RequestBody FleetConsumeRecord fleetConsumeRecord) {
return getSuccessResult(fleetConsumeRecordService.insert(fleetConsumeRecord));
}
/**
* 编辑数据
*
* @param fleetConsumeRecord 实体
* @return 编辑结果
*/
@PutMapping
public ResponseObject edit(@RequestBody FleetConsumeRecord fleetConsumeRecord) {
return getSuccessResult(fleetConsumeRecordService.update(fleetConsumeRecord));
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@DeleteMapping("{id}")
public ResponseObject deleteById(@PathVariable Integer id) {
return getSuccessResult(fleetConsumeRecordService.deleteById(id));
}
}

View File

@ -1,14 +1,30 @@
package com.fuint.business.fleet.controller; package com.fuint.business.fleet.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.fleet.entity.FleetMember; import com.fuint.business.fleet.entity.FleetMember;
import com.fuint.business.fleet.service.FleetMemberService; import com.fuint.business.fleet.service.FleetMemberService;
import com.fuint.business.fleet.vo.FleetMemberVo; import com.fuint.business.fleet.vo.FleetMemberVo;
import com.fuint.business.userManager.entity.UserStatistic;
import com.fuint.business.userManager.listener.EasyExcelListener;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.framework.web.BaseController; import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject; import com.fuint.framework.web.ResponseObject;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 油机汽机配置(FleetMember)表控制层 * 油机汽机配置(FleetMember)表控制层
@ -88,5 +104,84 @@ public class FleetMemberController extends BaseController {
public ResponseObject logOffFleetMember(@PathVariable Integer id){ public ResponseObject logOffFleetMember(@PathVariable Integer id){
return getSuccessResult(fleetMemberService.logOffFleetMember(id)); return getSuccessResult(fleetMemberService.logOffFleetMember(id));
} }
// 导入模板示例
@RequestMapping("/export")
public void export(HttpServletResponse response, HttpServletRequest request) {
try {
String filenames = "车队成员导入模板示列";
String userAgent = request.getHeader("User-Agent");
if (userAgent.contains("MSIE") || userAgent.contains("Trident")) {
filenames = URLEncoder.encode(filenames, "UTF-8");
} else {
filenames = new String(filenames.getBytes("UTF-8"), "ISO-8859-1");
}
response.setContentType("application/json.ms-exce");
response.setCharacterEncoding("utf-8");
response.addHeader("Content-Disposition", "filename=" + filenames + ".xlsx");
FleetMemberVo fleetMemberVo = new FleetMemberVo();
fleetMemberVo.setMobile("12345678912");
fleetMemberVo.setFleetName("xx车队");
fleetMemberVo.setName("张三");
fleetMemberVo.setCarNum("鲁A8888");
fleetMemberVo.setRemark("这是一条示例数据");
// fleetMemberVo.setSecondaryCardType(1);
List<FleetMemberVo> list = new ArrayList<>();
list.add(fleetMemberVo);
EasyExcel.write(response.getOutputStream(), FleetMemberVo.class).sheet("sheet").doWrite(list);
} catch (Exception e) {
e.printStackTrace();
}
}
@RequestMapping("/import")
public ResponseObject myImport(MultipartFile file) throws IOException {
Map<String,Integer> map = new HashMap<>();
int success = 0;
int error = 0;
int repeat = 0;
int total = 0;
try {
//获取文件名
String filename = file.getOriginalFilename();
//获取文件流
InputStream inputStream = file.getInputStream();
//实例化实现了AnalysisEventListener接口的类
EasyExcelListener listener = new EasyExcelListener();
EasyExcelFactory.read(inputStream, FleetMemberVo.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++) {
FleetMemberVo fleetMemberVo = (FleetMemberVo) list.get(i);
FleetMember fleetMember = fleetMemberService.queryByMobile(fleetMemberVo.getMobile());
if (ObjectUtil.isNotEmpty(fleetMember)){
repeat += 1;
}else {
//使用mybatis-plus添加到数据库
int row = fleetMemberService.insertFleetMember(fleetMemberVo);
if (row == 1){
success++;
}else {
error++;
}
}
}
}
map.put("total",total);
map.put("success",success);
map.put("error",error);
map.put("repeat",repeat);
} catch (Exception e) {
e.printStackTrace();
}
return getSuccessResult(map);
}
} }

View File

@ -0,0 +1,89 @@
package com.fuint.business.fleet.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;
/**
* (FleetConsumeRecord)实体类
*
* @author makejava
* @since 2024-08-08 15:15:16
*/
@Data
@TableName("fleet_consume_record")
@ApiModel(value = "FleetConsumeRecord", description = "车队信息")
public class FleetConsumeRecord extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty("自增ID")
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
/**
* 所属连锁店id
*/
private Integer chainStoreId;
/**
* 所属店铺id
*/
private Integer storeId;
/**
* 车队成员id
*/
private Integer fleetMemberId;
/**
* 订单号
*/
private String orderNo;
/**
* 储值卡付款金额
*/
private Double cardPaymentAmount;
/**
* 订单金额
*/
private Double orderAmount;
/**
* 优惠金额
*/
private Double preferentialAmount;
/**
* 实收金额
*/
private Double netReceiptsAmount;
/**
* 订单状态
*/
private String orderStatus;
/**
* 订单完成时间
*/
private Date paymentTime;
/**
* 创建者
*/
private String createBy;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新者
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
}

View File

@ -1,8 +1,11 @@
package com.fuint.business.fleet.entity; package com.fuint.business.fleet.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fuint.business.fleet.util.GenderConverter;
import com.fuint.framework.entity.BaseEntity; import com.fuint.framework.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -43,22 +46,30 @@ public class FleetMember extends BaseEntity implements Serializable {
/** /**
* 姓名 * 姓名
*/ */
@ExcelProperty(value = "车队成员名称")
@ColumnWidth(20)
private String name; private String name;
/** /**
* 手机号 * 手机号
*/ */
@ExcelProperty(value = "手机号(必填)")
@ColumnWidth(20)
private String mobile; private String mobile;
/** /**
* 会员卡号关联会员表 * 会员卡号关联会员表
*/ */
private String userCardNum; private String userCardNum;
/** /**
* 副卡类型选项为1共享副卡-不限额2共享副卡限额3独立副卡 * 副卡类型选项为1共享副卡-不限额2共享副卡-限额3独立副卡
*/ */
private String secondaryCardType; @ExcelProperty(value = "副卡类型(共享副卡-不限额;共享副卡-限额;独立副卡)" ,converter = GenderConverter.class)
@ColumnWidth(50)
private Integer secondaryCardType;
/** /**
* 车牌号 * 车牌号
*/ */
@ExcelProperty(value = "车牌号")
@ColumnWidth(20)
private String carNum; private String carNum;
/** /**
* 状态 * 状态
@ -87,6 +98,8 @@ public class FleetMember extends BaseEntity implements Serializable {
/** /**
* 备注 * 备注
*/ */
@ExcelProperty(value = "备注")
@ColumnWidth(30)
private String remark; private String remark;
/** /**
* 密码 * 密码

View File

@ -0,0 +1,11 @@
package com.fuint.business.fleet.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.fleet.entity.FleetConsumeRecord;
import org.apache.ibatis.annotations.Param;
public interface FleetConsumeRecordMapper extends BaseMapper<FleetConsumeRecord> {
IPage<FleetConsumeRecord> queryPage(Page page, @Param("entity") FleetConsumeRecord fleetInfo);
}

View File

@ -0,0 +1,27 @@
<?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.fleet.mapper.FleetConsumeRecordMapper">
<select id="queryPage" resultType="com.fuint.business.fleet.entity.FleetConsumeRecord">
SELECT * FROM fleet_consume_record
<where>
<if test="entity.storeId != null and entity.storeId != ''">
and store_id = #{entity.storeId}
</if>
<if test="entity.orderStatus != null and entity.orderStatus != ''">
and order_status = #{entity.orderStatus}
</if>
<if test="entity.orderNo != null and entity.orderNo != ''">
and order_no like concat('%', #{entity.orderNo}, '%')
</if>
<if test="entity.params.beginTime != null and entity.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{entity.params.beginTime},'%y%m%d')
</if>
<if test="entity.params.endTime != null and entity.params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{entity.params.endTime},'%y%m%d')
</if>
</where>
ORDER BY create_time DESC
</select>
</mapper>

View File

@ -7,6 +7,7 @@
LEFT JOIN fleet_info fi ON fm.fleet_id = fi.id LEFT JOIN fleet_info fi ON fm.fleet_id = fi.id
LEFT JOIN t_account ta ON fm.create_by = ta.acct_id LEFT JOIN t_account ta ON fm.create_by = ta.acct_id
<where> <where>
fm.if_log_off = '0'
<if test="entity.storeId != null and entity.storeId != ''"> <if test="entity.storeId != null and entity.storeId != ''">
and fm.store_id = #{entity.storeId} and fm.store_id = #{entity.storeId}
</if> </if>

View File

@ -0,0 +1,54 @@
package com.fuint.business.fleet.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.fleet.entity.FleetConsumeRecord;
/**
* (FleetConsumeRecord)表服务接口
*
* @author makejava
* @since 2024-08-08 15:15:16
*/
public interface FleetConsumeRecordService {
/**
* 根据条件分页查询
* @param page
* @param fleetInfo
* @return
*/
IPage<FleetConsumeRecord> queryPage(Page page, FleetConsumeRecord fleetInfo);
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
FleetConsumeRecord queryById(Integer id);
/**
* 新增数据
*
* @param fleetConsumeRecord 实例对象
* @return 实例对象
*/
int insert(FleetConsumeRecord fleetConsumeRecord);
/**
* 修改数据
*
* @param fleetConsumeRecord 实例对象
* @return 实例对象
*/
int update(FleetConsumeRecord fleetConsumeRecord);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
int deleteById(Integer id);
}

View File

@ -28,6 +28,13 @@ public interface FleetInfoService {
*/ */
FleetInfo queryById(Integer id); FleetInfo queryById(Integer id);
/**
* 根据车队名称查询车队信息
* @param fleetName
* @return
*/
FleetInfo selectByName(String fleetName);
/** /**
* 新增数据 * 新增数据
* *

View File

@ -43,6 +43,14 @@ public interface FleetMemberService {
*/ */
int insert(FleetMember fleetMember); int insert(FleetMember fleetMember);
/**
* 新增数据
*
* @param fleetMember 实例对象
* @return 实例对象
*/
int insertFleetMember(FleetMemberVo fleetMember);
/** /**
* 修改数据 * 修改数据
* *

View File

@ -0,0 +1,72 @@
package com.fuint.business.fleet.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.fleet.entity.FleetConsumeRecord;
import com.fuint.business.fleet.mapper.FleetConsumeRecordMapper;
import com.fuint.business.fleet.service.FleetConsumeRecordService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
/**
* (FleetConsumeRecord)表服务实现类
*
* @author makejava
* @since 2024-08-08 15:15:16
*/
@Service("fleetConsumeRecordService")
public class FleetConsumeRecordServiceImpl extends ServiceImpl<FleetConsumeRecordMapper,FleetConsumeRecord> implements FleetConsumeRecordService {
@Override
public IPage<FleetConsumeRecord> queryPage(Page page, FleetConsumeRecord fleetInfo) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
fleetInfo.setStoreId(nowAccountInfo.getStoreId());
return baseMapper.queryPage(page,fleetInfo);
}
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public FleetConsumeRecord queryById(Integer id) {
return baseMapper.selectById(id);
}
/**
* 新增数据
*
* @param fleetConsumeRecord 实例对象
* @return 实例对象
*/
@Override
public int insert(FleetConsumeRecord fleetConsumeRecord) {
return baseMapper.insert(fleetConsumeRecord);
}
/**
* 修改数据
*
* @param fleetConsumeRecord 实例对象
* @return 实例对象
*/
@Override
public int update(FleetConsumeRecord fleetConsumeRecord) {
return baseMapper.updateById(fleetConsumeRecord);
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public int deleteById(Integer id) {
return baseMapper.deleteById(id);
}
}

View File

@ -1,6 +1,7 @@
package com.fuint.business.fleet.service.impl; package com.fuint.business.fleet.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -16,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
@ -64,6 +66,13 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper,FleetInfo>
return baseMapper.selectById(id); return baseMapper.selectById(id);
} }
@Override
public FleetInfo selectByName(String fleetName) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("fleet_name",fleetName);
return baseMapper.selectOne(queryWrapper);
}
/** /**
* 新增数据 * 新增数据
* *
@ -72,6 +81,10 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper,FleetInfo>
*/ */
@Override @Override
public int insert(FleetInfo fleetInfo) { public int insert(FleetInfo fleetInfo) {
FleetInfo fleetInfo1 = selectByName(fleetInfo.getFleetName());
if (ObjectUtil.isNotEmpty(fleetInfo1)){
return 0;
}
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
fleetInfo.setStoreId(nowAccountInfo.getStoreId()); fleetInfo.setStoreId(nowAccountInfo.getStoreId());
fleetInfo.setChainStoreId(nowAccountInfo.getChainStoreId()); fleetInfo.setChainStoreId(nowAccountInfo.getChainStoreId());
@ -86,8 +99,8 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper,FleetInfo>
*/ */
@Override @Override
public int update(FleetInfo fleetInfo) { public int update(FleetInfo fleetInfo) {
FleetInfo fleetInfo1 = queryById(fleetInfo.getId()); FleetInfo fleetInfo1 = selectByName(fleetInfo.getFleetName());
if (ObjectUtil.isEmpty(fleetInfo1)){ if (ObjectUtil.isNotEmpty(fleetInfo1) && !Objects.equals(fleetInfo1.getId(), fleetInfo.getId())){
return 0; return 0;
} }
if (ObjectUtil.isNotEmpty(fleetInfo.getRechargeAmount1()) && ObjectUtil.isNotEmpty(fleetInfo.getGiveAmount1())) { if (ObjectUtil.isNotEmpty(fleetInfo.getRechargeAmount1()) && ObjectUtil.isNotEmpty(fleetInfo.getGiveAmount1())) {

View File

@ -5,12 +5,17 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.fleet.entity.FleetInfo;
import com.fuint.business.fleet.entity.FleetMember; import com.fuint.business.fleet.entity.FleetMember;
import com.fuint.business.fleet.mapper.FleetMemberMapper; import com.fuint.business.fleet.mapper.FleetMemberMapper;
import com.fuint.business.fleet.service.FleetInfoService;
import com.fuint.business.fleet.service.FleetMemberService; import com.fuint.business.fleet.service.FleetMemberService;
import com.fuint.business.fleet.vo.FleetMemberVo; import com.fuint.business.fleet.vo.FleetMemberVo;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.dto.AccountInfo; import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
@ -22,6 +27,11 @@ import org.springframework.stereotype.Service;
@Service("fleetMemberService") @Service("fleetMemberService")
public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper,FleetMember> implements FleetMemberService { public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper,FleetMember> implements FleetMemberService {
@Autowired
private LJUserService userService;
@Autowired
private FleetInfoService fleetInfoService;
@Override @Override
public IPage<FleetMemberVo> queryPage(Page page, FleetMemberVo fleetMember) { public IPage<FleetMemberVo> queryPage(Page page, FleetMemberVo fleetMember) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
@ -60,6 +70,10 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper,FleetM
if (ObjectUtil.isNotEmpty(fleetMember1)) { if (ObjectUtil.isNotEmpty(fleetMember1)) {
return 0; return 0;
} }
LJUserVo user = userService.selectUserByMobileAndChantStoreId(fleetMember.getMobile());
if (ObjectUtil.isEmpty(user)){
return 2;
}
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
fleetMember.setStoreId(nowAccountInfo.getStoreId()); fleetMember.setStoreId(nowAccountInfo.getStoreId());
@ -67,6 +81,28 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper,FleetM
return baseMapper.insert(fleetMember); return baseMapper.insert(fleetMember);
} }
@Override
public int insertFleetMember(FleetMemberVo fleetMember) {
FleetMember fleetMember1 = queryByMobile(fleetMember.getMobile());
if (ObjectUtil.isNotEmpty(fleetMember1)) {
return 0;
}
LJUserVo user = userService.selectUserByMobileAndChantStoreId(fleetMember.getMobile());
if (ObjectUtil.isEmpty(user)){
return 2;
}
FleetInfo fleetInfo = fleetInfoService.selectByName(fleetMember.getFleetName());
if (ObjectUtil.isEmpty(fleetInfo)){
return 3;
}
fleetMember.setFleetId(fleetInfo.getId());
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
fleetMember.setStoreId(nowAccountInfo.getStoreId());
fleetMember.setChainStoreId(nowAccountInfo.getChainStoreId());
return baseMapper.insert(fleetMember);
}
/** /**
* 修改数据 * 修改数据
* *

View File

@ -0,0 +1,42 @@
package com.fuint.business.fleet.util;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
public class GenderConverter implements Converter<Integer> {
public static final String LIMIT = "共享副卡-限额";
public static final String NOLIMIT = "共享副卡-不限额";
public static final String DULI = "独立副卡 ";
@Override
public Class supportJavaTypeKey() {
return Integer.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public Integer convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
String stringValue = cellData.getStringValue();
if (NOLIMIT.equals(stringValue)){
return 1;
}else if (LIMIT.equals(stringValue)){
return 2;
}else {
return 3;
}
}
@Override
public CellData convertToExcelData(Integer integer, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
return null;
}
}

View File

@ -1,13 +1,19 @@
package com.fuint.business.fleet.vo; package com.fuint.business.fleet.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.fuint.business.fleet.entity.FleetMember; import com.fuint.business.fleet.entity.FleetMember;
import lombok.Data; import lombok.Data;
@Data @Data
@ExcelIgnoreUnannotated
public class FleetMemberVo extends FleetMember { public class FleetMemberVo extends FleetMember {
/** /**
* 车队名称 * 车队名称
*/ */
@ExcelProperty(value = "车队名称")
@ColumnWidth(20)
private String fleetName; private String fleetName;
/** /**
* 创建人 * 创建人