From 927bbf4e0796101957a6d0e064bac835229f8a58 Mon Sep 17 00:00:00 2001 From: cun-nan <19819293608@163.com> Date: Thu, 8 Aug 2024 15:53:07 +0800 Subject: [PATCH] bug --- .../src/api/fleet/fleetconsumerecord.js | 45 +++ .../src/views/fleet/tab/fleetMember.vue | 268 ++++++++++++------ .../FleetConsumeRecordController.java | 87 ++++++ .../controller/FleetMemberController.java | 95 +++++++ .../fleet/entity/FleetConsumeRecord.java | 89 ++++++ .../business/fleet/entity/FleetMember.java | 17 +- .../mapper/FleetConsumeRecordMapper.java | 11 + .../mapper/xml/FleetConsumeRecordMapper.xml | 27 ++ .../fleet/mapper/xml/FleetMemberMapper.xml | 1 + .../service/FleetConsumeRecordService.java | 54 ++++ .../fleet/service/FleetInfoService.java | 7 + .../fleet/service/FleetMemberService.java | 8 + .../impl/FleetConsumeRecordServiceImpl.java | 72 +++++ .../service/impl/FleetInfoServiceImpl.java | 17 +- .../service/impl/FleetMemberServiceImpl.java | 36 +++ .../business/fleet/util/GenderConverter.java | 42 +++ .../business/fleet/vo/FleetMemberVo.java | 6 + 17 files changed, 785 insertions(+), 97 deletions(-) create mode 100644 fuintAdmin/src/api/fleet/fleetconsumerecord.js create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetConsumeRecordController.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetConsumeRecord.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/FleetConsumeRecordMapper.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetConsumeRecordMapper.xml create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetConsumeRecordService.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetConsumeRecordServiceImpl.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/util/GenderConverter.java diff --git a/fuintAdmin/src/api/fleet/fleetconsumerecord.js b/fuintAdmin/src/api/fleet/fleetconsumerecord.js new file mode 100644 index 000000000..2bcd104ae --- /dev/null +++ b/fuintAdmin/src/api/fleet/fleetconsumerecord.js @@ -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', + }) +} diff --git a/fuintAdmin/src/views/fleet/tab/fleetMember.vue b/fuintAdmin/src/views/fleet/tab/fleetMember.vue index 296f6bdfa..fb7ffeeb6 100644 --- a/fuintAdmin/src/views/fleet/tab/fleetMember.vue +++ b/fuintAdmin/src/views/fleet/tab/fleetMember.vue @@ -172,7 +172,7 @@ - + @@ -222,13 +222,13 @@ - + 元 - + 元 @@ -268,19 +268,19 @@ - + 元 - + 元 - + 元 @@ -290,20 +290,20 @@ - - + @@ -321,11 +321,11 @@ @@ -334,18 +334,20 @@ 点击导入 文件 - - 导入模板下载.xlsx - - - 只能上传xls/xlsx文件,批量导入会员手机号,单次最大支持5000个会员手机号认证,请确保用户手机号已注册为油站会员(在会员列表已显示),否则无法添加成员信息 - + + + + 导入模板下载.xlsx + + + 只能上传xls/xlsx文件,批量导入会员手机号,单次最大支持5000个会员手机号认证,请确保用户手机号已注册为油站会员(在会员列表已显示),否则无法添加成员信息 + + + + + + 认证总数:{{result.total}} 人 + + + 成功人数:{{result.success}} 人 + + + 失败人数:{{result.error}} 人 + 会员信息不存在 + + + 已认证人数:{{result.repeat}} 人 + + + + @@ -377,6 +398,21 @@ + + + + 至 + + + 搜索 重置 @@ -384,29 +420,29 @@ - - - - - - - - - - - - {{ parseTime(scope.row.createTime) }} - - - + + + + + + + + + + + + {{ parseTime(scope.row.createTime) }} + + + - + @@ -418,9 +454,16 @@ import {delStaff} from "@/api/staff/staff"; import {getToken} from "@/utils/auth"; 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 {getUserMobile} from "@/api/staff/user/user"; +import {getUserPhone} from "@/api/staff/user/user"; +import {getFleetConsumeRecordList} from "@/api/fleet/fleetconsumerecord"; export default { dicts: ['zhzt'], @@ -436,23 +479,29 @@ export default { open: false, open1: false, open2: false, + open3: false, + result:{}, + openResult: false, title: '', // 日期范围 dateRange: [], beginTime: "", endTime: "", + beginTime1: "", + endTime1: "", // 收银台订单列表 orderList: [], deptList: [], fleetList: [], - consumeList:[], + consumeList: [], form: {}, form1: { - adjustType:[] + adjustType: [] }, form2: {}, - secondaryCardLimit:0, - usedCreditLimit:0, + form3: {}, + secondaryCardLimit: 0, + usedCreditLimit: 0, options: [{ value: '1', label: '共享副卡-不限额' @@ -511,25 +560,25 @@ export default { }, methods: { // 调整额度 - adjustLimit(){ + adjustLimit() { if (!this.form1.secondaryCardLimit) this.form1.secondaryCardLimit = 0 if (!this.form1.usedCreditLimit) this.form1.usedCreditLimit = 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.remainingCreditLimit = this.secondaryCardLimit - this.usedCreditLimit - }else if (this.form1.adjustType==1) { + this.form1.remainingCreditLimit = this.form1.secondaryCardLimit - this.usedCreditLimit + } else if (this.form1.adjustType == 1) { 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() }, // 查询用户信息 - queryUser(){ - getUserMobile({mobile:this.form.mobile}).then(res => { - if (res.data){ + queryUser() { + getUserPhone({mobile: this.form.mobile}).then(res => { + if (res.data) { this.form.userCardNum = res.data.userNo - }else { + } else { this.form.userCardNum = '' } this.$forceUpdate() @@ -553,38 +602,50 @@ export default { handleClose(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) { this.uploading = true; if (file.status === 'success') { this.uploading = false; this.fileList.splice(0, 1) - this.openMembers = false; this.openResult = true; - this.title = "会员认证结果"; + this.title = "成员录入结果"; this.result = file.response.data; this.reset2(); - this.getListMember(); + this.queryParams.page = 1 + this.getList(); } }, // 提交按钮 批量认证会员信息 submitFormMembers: function () { - this.$refs["form2"].validate(valid => { - if (valid) { - addCertifiedMembers(this.form2).then(response => { - this.openMembers = false; - this.openResult = true; - this.title = "会员认证结果"; - this.result = response.data; - this.reset2(); - this.getListMember(); - }) - } - }); + this.open3 = false; + this.reset2(); + // this.$refs["form2"].validate(valid => { + // if (valid) { + // addCertifiedMembers(this.form2).then(response => { + // this.openResult = true; + // this.title = "会员认证结果"; + // this.result = response.data; + // this.reset2(); + // this.getListMember(); + // }) + // } + // }); }, // 取消按钮 cancelMembers() { - this.openMembers = false; + this.open3 = false; this.reset2(); }, getFleetList() { @@ -615,23 +676,25 @@ export default { if (valid) { if (!this.form.id) { addFleetMember(this.form).then(res => { - if (res.data==1){ + if (res.data == 1) { this.$message.success("添加成功") this.open = false this.queryParams.page = 1 this.getList() - }else { + } else if (res.data == 2) { + this.$message.error("添加失败,请确保录入成员手机号已注册为油站会员") + } else if (res.data == 0) { this.$message.error("添加失败,手机号不能重复") } }) } else { editFleetMember(this.form).then(res => { - if (res.data==1){ + if (res.data == 1) { this.$message.success("修改成功") this.open = false this.queryParams.page = 1 this.getList() - }else { + } else { this.$message.error("修改失败,手机号已存在") } }) @@ -643,16 +706,29 @@ export default { submitForm1: function () { this.$refs["form1"].validate(valid => { if (valid) { - editFleetMember(this.form1).then(res => { - if (res.data==1){ - this.$message.success("修改成功") - this.open1 = false - this.queryParams.page = 1 - this.getList() - }else { - this.$message.error("修改失败,手机号已存在") - } - }) + editFleetMember(this.form1).then(res => { + if (res.data == 1) { + this.$message.success("修改成功") + this.open1 = false + this.queryParams.page = 1 + this.getList() + } else { + 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() { this.reset(); this.form = { - status:'qy' + status: 'qy' } this.open = true; this.title = "新增成员"; @@ -668,7 +744,8 @@ export default { // 新增按钮操作 batchAdd() { this.reset(); - this.open2 = true; + this.form3 = {} + this.open3 = true; this.title = "批量新增成员"; }, // 搜索按钮操作 @@ -711,10 +788,10 @@ export default { }, // 注销 handleLogOff(row) { - this.form1 = {} + this.form2 = {} getFleetMember(row.id).then(res => { - this.form1 = res.data - this.open1 = true; + this.form2 = res.data + this.open2 = true; this.title = '注销副卡' }) }, @@ -760,4 +837,9 @@ export default { overflow: auto; } +.huiyuan{ + height: 30px; + line-height: 30px; + font-size: 16px; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetConsumeRecordController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetConsumeRecordController.java new file mode 100644 index 000000000..bb4f97ba5 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetConsumeRecordController.java @@ -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)); + } + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetMemberController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetMemberController.java index 8721c0bc8..6e2318d27 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetMemberController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetMemberController.java @@ -1,14 +1,30 @@ 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.fuint.business.fleet.entity.FleetMember; import com.fuint.business.fleet.service.FleetMemberService; 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.ResponseObject; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; 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)表控制层 @@ -88,5 +104,84 @@ public class FleetMemberController extends BaseController { public ResponseObject logOffFleetMember(@PathVariable Integer 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 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 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 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); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetConsumeRecord.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetConsumeRecord.java new file mode 100644 index 000000000..0594187e0 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetConsumeRecord.java @@ -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; + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetMember.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetMember.java index db7c2dc18..98ef012b5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetMember.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetMember.java @@ -1,8 +1,11 @@ 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.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fuint.business.fleet.util.GenderConverter; import com.fuint.framework.entity.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -43,22 +46,30 @@ public class FleetMember extends BaseEntity implements Serializable { /** * 姓名 */ + @ExcelProperty(value = "车队成员名称") + @ColumnWidth(20) private String name; /** * 手机号 */ + @ExcelProperty(value = "手机号(必填)") + @ColumnWidth(20) private String mobile; /** * 会员卡号;关联会员表 */ 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; /** * 状态 @@ -87,6 +98,8 @@ public class FleetMember extends BaseEntity implements Serializable { /** * 备注 */ + @ExcelProperty(value = "备注") + @ColumnWidth(30) private String remark; /** * 密码 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/FleetConsumeRecordMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/FleetConsumeRecordMapper.java new file mode 100644 index 000000000..f22069c0e --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/FleetConsumeRecordMapper.java @@ -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 { + IPage queryPage(Page page, @Param("entity") FleetConsumeRecord fleetInfo); +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetConsumeRecordMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetConsumeRecordMapper.xml new file mode 100644 index 000000000..0f572fbb5 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetConsumeRecordMapper.xml @@ -0,0 +1,27 @@ + + + + + + SELECT * FROM fleet_consume_record + + + and store_id = #{entity.storeId} + + + and order_status = #{entity.orderStatus} + + + and order_no like concat('%', #{entity.orderNo}, '%') + + + and date_format(create_time,'%y%m%d') >= date_format(#{entity.params.beginTime},'%y%m%d') + + + and date_format(create_time,'%y%m%d') <= date_format(#{entity.params.endTime},'%y%m%d') + + + ORDER BY create_time DESC + + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetMemberMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetMemberMapper.xml index fd8462af7..343d6306b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetMemberMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetMemberMapper.xml @@ -7,6 +7,7 @@ LEFT JOIN fleet_info fi ON fm.fleet_id = fi.id LEFT JOIN t_account ta ON fm.create_by = ta.acct_id + fm.if_log_off = '0' and fm.store_id = #{entity.storeId} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetConsumeRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetConsumeRecordService.java new file mode 100644 index 000000000..502c0f7ed --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetConsumeRecordService.java @@ -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 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); + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetInfoService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetInfoService.java index b1bddf09a..a194782f4 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetInfoService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetInfoService.java @@ -28,6 +28,13 @@ public interface FleetInfoService { */ FleetInfo queryById(Integer id); + /** + * 根据车队名称查询车队信息 + * @param fleetName + * @return + */ + FleetInfo selectByName(String fleetName); + /** * 新增数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetMemberService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetMemberService.java index 3f3b90952..c5782647d 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetMemberService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetMemberService.java @@ -43,6 +43,14 @@ public interface FleetMemberService { */ int insert(FleetMember fleetMember); + /** + * 新增数据 + * + * @param fleetMember 实例对象 + * @return 实例对象 + */ + int insertFleetMember(FleetMemberVo fleetMember); + /** * 修改数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetConsumeRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetConsumeRecordServiceImpl.java new file mode 100644 index 000000000..b287c4ff3 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetConsumeRecordServiceImpl.java @@ -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 implements FleetConsumeRecordService { + + @Override + public IPage 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); + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java index 9ae5cff09..c78f22a2f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java @@ -1,6 +1,7 @@ package com.fuint.business.fleet.service.impl; 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.extension.plugins.pagination.Page; 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 java.util.List; +import java.util.Objects; /** @@ -64,6 +66,13 @@ public class FleetInfoServiceImpl extends ServiceImpl 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 */ @Override public int insert(FleetInfo fleetInfo) { + FleetInfo fleetInfo1 = selectByName(fleetInfo.getFleetName()); + if (ObjectUtil.isNotEmpty(fleetInfo1)){ + return 0; + } AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); fleetInfo.setStoreId(nowAccountInfo.getStoreId()); fleetInfo.setChainStoreId(nowAccountInfo.getChainStoreId()); @@ -86,8 +99,8 @@ public class FleetInfoServiceImpl extends ServiceImpl */ @Override public int update(FleetInfo fleetInfo) { - FleetInfo fleetInfo1 = queryById(fleetInfo.getId()); - if (ObjectUtil.isEmpty(fleetInfo1)){ + FleetInfo fleetInfo1 = selectByName(fleetInfo.getFleetName()); + if (ObjectUtil.isNotEmpty(fleetInfo1) && !Objects.equals(fleetInfo1.getId(), fleetInfo.getId())){ return 0; } if (ObjectUtil.isNotEmpty(fleetInfo.getRechargeAmount1()) && ObjectUtil.isNotEmpty(fleetInfo.getGiveAmount1())) { diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java index bce96d370..2f1065f0e 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java @@ -5,12 +5,17 @@ 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; +import com.fuint.business.fleet.entity.FleetInfo; import com.fuint.business.fleet.entity.FleetMember; 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.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.util.TokenUtil; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** @@ -22,6 +27,11 @@ import org.springframework.stereotype.Service; @Service("fleetMemberService") public class FleetMemberServiceImpl extends ServiceImpl implements FleetMemberService { + @Autowired + private LJUserService userService; + @Autowired + private FleetInfoService fleetInfoService; + @Override public IPage queryPage(Page page, FleetMemberVo fleetMember) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); @@ -60,6 +70,10 @@ public class FleetMemberServiceImpl extends ServiceImpl { + + 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; + } +} \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/vo/FleetMemberVo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/vo/FleetMemberVo.java index 8c9d3b5bd..0cbc51720 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/vo/FleetMemberVo.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/vo/FleetMemberVo.java @@ -1,13 +1,19 @@ 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 lombok.Data; @Data +@ExcelIgnoreUnannotated public class FleetMemberVo extends FleetMember { /** * 车队名称 */ + @ExcelProperty(value = "车队名称") + @ColumnWidth(20) private String fleetName; /** * 创建人