Merge remote-tracking branch 'origin/master'

This commit is contained in:
user 2023-10-24 18:52:25 +08:00
commit c19f1bbbb1
9 changed files with 354 additions and 45 deletions

View File

@ -34,6 +34,15 @@ export function addCertifiedMember(data) {
})
}
// 批量新增固定等级
export function addCertifiedMembers(data) {
return request({
url: '/business/userManager/certifiedMember/members',
method: 'post',
data: data
})
}
// 修改固定等级
export function updateCertifiedMember(data) {
return request({

View File

@ -102,7 +102,15 @@
@click="handleAddMember"
v-hasPermi="['member:add']"
>新增用户认证</el-button>
<el-table ref="tables" v-loading="loading" :data="listMember" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
<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"
@sort-change="handleSortChange">
<el-table-column label="认证类型" prop="fixingLevelId" align="center">
<template slot-scope="scope">
<span>{{ scope.row.fixingLevelId ? getName(fixingLevelList, scope.row.fixingLevelId) : '-' }}</span>
@ -116,7 +124,11 @@
</el-table-column>
<el-table-column label="姓名" align="center" prop="name" />
<el-table-column label="车牌号" align="center" prop="carNumber"/>
<el-table-column label="认证资料" align="center" prop="attestationData"/>
<el-table-column label="认证资料" align="center" prop="attestationData">
<template slot-scope="scope">
<!-- {{scope.row}}-->
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
@ -316,6 +328,71 @@
</div>
</el-card>
<!-- 批量添加用户认证信息 -->
<el-dialog :title="title" :visible.sync="openMembers"
:close-on-click-modal="false" append-to-body>
<el-form ref="form2" :model="form2" :rules="rules2">
<el-row>
<el-col :span="24">
<el-form-item label="认证类型" prop="fixingLevelId">
<el-select
v-model="form2.fixingLevelId"
placeholder="请选择"
clearable
>
<el-option v-for="item in fixingLevelList" :key="item.id+''" :label="item.name" :value="item.id"/>
</el-select>
<div>
<div style="color: grey;font-size: 12px;height: 18px;margin-left: 8%">
认证会员类型,每个会员仅支持认证一个类型
</div>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="手机号" prop="mobile">
<el-input v-model="form2.mobile"
type="textarea"
maxlength="12000"
style="width: 85%;height: 300px;:deep(.el-textarea__inner){height: 300px;}
:deep(.el-input__wrapper){height:300px;}"
show-word-limit
placeholder="请输入会员手机号多个手机号换行操作每行一个会员手机号单次最大支持1000个会员手机号认证~">
</el-input>
<div>
<div style="color: grey;font-size: 12px;height: 18px;margin-left: 8%">
多个会员手机号换行操作,每行为一个会员手机号单次最大支持1000个会员手机号认证,请确保用户手机号已注册为油站会员(在会员列表已显示),否则无法添加认证信息
</div>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFormMembers"> </el-button>
<el-button @click="cancelMembers"> </el-button>
</div>
</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.certified}}</span>
</div>
</el-dialog>
<!-- 添加用户认证或修改对话框 -->
<el-dialog :title="title" :visible.sync="openMember"
:close-on-click-modal="false" append-to-body>
@ -375,15 +452,16 @@
<el-form-item label="认证图片1" prop="photo1">
<div>
<el-upload
action="https://jsonplaceholder.typicode.com/posts/"
action="/dev-api/picture/upload"
:show-file-list="false"
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove">
<i class="el-icon-plus"></i>
:on-success="handleAvatarSuccess1"
:on-change="onChange"
ref="upload"
>
<img v-if="imageUrl.imageUrl1" :src="imageUrl.imageUrl1" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</div>
</el-form-item>
</el-col>
@ -391,15 +469,16 @@
<el-form-item label="认证图片2" prop="photo2">
<div>
<el-upload
action="https://jsonplaceholder.typicode.com/posts/"
action="/dev-api/picture/upload"
:show-file-list="false"
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove">
<i class="el-icon-plus"></i>
:on-success="handleAvatarSuccess2"
:on-change="onChange"
ref="upload"
>
<img v-if="imageUrl.imageUrl2" :src="imageUrl.imageUrl2" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</div>
</el-form-item>
</el-col>
@ -407,15 +486,16 @@
<el-form-item label="认证图片3" prop="photo3">
<div>
<el-upload
action="https://jsonplaceholder.typicode.com/posts/"
action="/dev-api/picture/upload"
:show-file-list="false"
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove">
<i class="el-icon-plus"></i>
:on-success="handleAvatarSuccess3"
:on-change="onChange"
ref="upload"
>
<img v-if="imageUrl.imageUrl3" :src="imageUrl.imageUrl3" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</div>
</el-form-item>
</el-col>
@ -725,7 +805,7 @@ import {
updateFixingLevel
} from "@/api/staff/user/fixinglevel";
import {
addCertifiedMember,
addCertifiedMember, addCertifiedMembers,
delCertifiedMember,
getCertifiedMember, getCertifiedMemberByUserId,
listCertifiedMember,
@ -737,10 +817,14 @@ export default {
dicts: ['yhlx','yes_or_no','zhzt','yhhdz','rzzt'],
data() {
return {
result:{},
isEdit:false,
//
dialogImageUrl: '',
dialogVisible: false,
imageUrl: {
imageUrl1: '',
imageUrl2: '',
imageUrl3: '',
},
mobile:'',
activeName: 'member',
//
@ -787,6 +871,8 @@ export default {
//
open: false,
openMember: false,
openMembers: false,
openResult: false,
//
form: {
id: '', name: '',discountType:'自定义优惠',gasolineDiscount:'无优惠',
@ -798,6 +884,7 @@ export default {
id: '', name: '',mobile:'',carNumber:'',userId:'',
attestationData:'',remark:'',status: 'enable'
},
form2:{},
//
gasolinePreferential:[
{
@ -871,7 +958,16 @@ export default {
status: [
{ required: true, message: "请选择认证状态", trigger: "blur" },
],
}
},
//
rules2: {
mobile: [
{ required: true, message: "请填写认证手机号", trigger: "blur" },
],
fixingLevelId: [
{ required: true, message: "请选择认证类型", trigger: "blur" },
],
},
};
},
created() {
@ -880,13 +976,6 @@ export default {
this.getUserList();
},
methods: {
checkMobile(){
getUserMobile({mobile:this.form1.mobile}).then( response => {
if (response.data==null){
}
})
},
handleClick(tab, event) {
// console.log(tab, event);
},
@ -963,8 +1052,17 @@ export default {
id: '', name: '',mobile:'',carNumber:'',userId:'',
attestationData:'',remark:'',status: 'enable'
};
this.imageUrl={
imageUrl1 : "",
imageUrl2 : "",
imageUrl3 : "",
};
this.resetForm("form1");
},
reset2() {
this.form2 = {};
this.resetForm("form2");
},
//
handleAdd() {
this.open = true;
@ -975,6 +1073,37 @@ export default {
this.openMember = true;
this.title = "新增用户认证";
},
handleAvatarSuccess1(res, file) {
// this.imageUrl.imageUrl1 = `/dev-api/uploadImages/certifiedImage/file.jpg`
this.imageUrl.imageUrl1 = URL.createObjectURL(file.raw);
},
handleAvatarSuccess2(res, file) {
this.imageUrl.imageUrl2 = URL.createObjectURL(file.raw);
},
handleAvatarSuccess3(res, file) {
this.imageUrl.imageUrl3 = URL.createObjectURL(file.raw);
},
onChange (file,fileList) {
if(file){
const suffix = file.name.split('.')[1]
const size = file.size / 1024 / 1024 < 2
if(['png','jpeg','jpg'].indexOf(suffix) < 0){
this.$message.error('上传图片只支持 png、jpeg、jpg 格式!')
this.$refs.upload.clearFiles()
return false
}
if(!size){
this.$message.error('上传文件大小不能超过 2MB!')
return false
}
return file
}
},
//
handleAddMembers() {
this.openMembers = true;
this.title = "批量用户认证";
},
//
handleUpdate(row) {
this.reset();
@ -994,6 +1123,7 @@ export default {
this.form1 = response.data;
this.openMember = true;
this.title = "编辑用户认证";
this.imageUrl = JSON.parse(this.form1.attestationData)
});
},
//
@ -1007,7 +1137,12 @@ export default {
this.reset1();
this.isEdit = false;
},
//
//
cancelMembers() {
this.openMembers = false;
this.reset2();
},
//
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
@ -1030,10 +1165,11 @@ export default {
}
});
},
//
//
submitFormMember: function() {
this.$refs["form1"].validate(valid => {
if (valid) {
this.form1.attestationData = JSON.stringify(this.imageUrl)
if (this.form1.id) {
updateCertifiedMember(this.form1).then(response => {
this.$modal.msgSuccess("用户认证信息更新成功");
@ -1065,6 +1201,20 @@ export default {
}
});
},
//
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();
})
}
});
},
//
handleDelete(row) {
const name = row.name
@ -1087,13 +1237,6 @@ export default {
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
handleRemove(file, fileList) {
// console.log(file, fileList);
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
@ -1148,10 +1291,23 @@ export default {
height: 100%;
background: #f6f8f9;
}
.huiyuan{
height: 30px;
line-height: 30px;
font-size: 16px;
}
.num{
font-weight: bold;
color: red;
font-size: 18px;
}
.roll-dialog ::v-deep .el-dialog .el-dialog__body {
padding: 3px 30px;
overflow-y: scroll;
height: 500px;
}
.avatar{
width: 100%;
height: 100%;
}
</style>

View File

@ -162,7 +162,9 @@
@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 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="头像" align="center" width="70">
<template slot-scope="scope">

View File

@ -152,6 +152,13 @@
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<!-- 上传图片-->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>

View File

@ -10,6 +10,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
/**
* 固定等级 controller层
*/
@ -77,6 +80,40 @@ public class CertifiedMemberController extends BaseController {
return getSuccessResult(certifiedMemberService.insertCertifiedMember(certifiedMember));
}
/**
* 添加固定等级信息
* @param map
* @return
*/
@PostMapping("/members")
public ResponseObject addMembers(@Validated @RequestBody Map<String ,String > map){
Map<String ,Object > map1 = new HashMap<>();
int error = 0;
int certified = 0;
int success = 0;
int total = 0;
CertifiedMember certifiedMember = new CertifiedMember();
certifiedMember.setFixingLevelId(Integer.parseInt(map.get("fixingLevelId")));
String[] mobiles = map.get("mobile").split("\n");
for (String mobile : mobiles) {
total++;
certifiedMember.setMobile(mobile);
int row = certifiedMemberService.insertCertifiedMember(certifiedMember);
if (row==1){
success++;
} else if (row==2 || row==3) {
error++;
}else {
certified++;
}
}
map1.put("success",success);
map1.put("error",error);
map1.put("certified",certified);
map1.put("total",total);
return getSuccessResult(map1);
}
/**
* 修改固定等级信息
* @param certifiedMember

View File

@ -0,0 +1,41 @@
package com.fuint.business.userManager.controller;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.FileOutputStream;
import java.util.UUID;
@RestController
@RequestMapping("/picture")
public class FileUploadController extends BaseController {
@PostMapping("/upload")
public ResponseObject handleFileUpload(@RequestParam("file") MultipartFile file) {
if (!file.isEmpty()) {
try {
byte[] bytes = file.getBytes();
// 保存文件到服务器
String filePath = "D:/workspaces/oilSystem/fuintBackend/fuint-application/src/main/resources/static/uploadImages/certifiedImage/";
String imgName = UUID.randomUUID().toString().replace("-","").substring(0,6);
// String imgName = file.getName();
String path = filePath+imgName+".jpg";
FileOutputStream fos = new FileOutputStream(path);
fos.write(bytes);
fos.close();
return getSuccessResult("上传成功");
} catch (Exception e) {
return getSuccessResult("上传失败:" + e.getMessage());
}
} else {
return getSuccessResult("上传失败:文件为空");
}
// 处理文件上传逻辑
// return getSuccessResult("上传成功");
}
}

View File

@ -1,6 +1,8 @@
package com.fuint.business.userManager.entity;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuint.framework.entity.BaseEntity;
@ -11,6 +13,7 @@ import lombok.Setter;
import java.util.Date;
import java.io.Serializable;
import java.util.List;
/**
* 认证会员表(CertifiedMember)实体类
@ -68,5 +71,10 @@ public class CertifiedMember extends BaseEntity implements Serializable {
*/
@ApiModelProperty("认证状态")
private String status;
/**
* 图片URL
*/
@TableField(exist = false)
private List<JSONObject> imgUrlList;
}

View File

@ -30,6 +30,13 @@ public interface CertifiedMemberService extends IService<CertifiedMember> {
*/
public CertifiedMember selectCertifiedMemberByUserId(int userId);
/**
* 根据会员手机号查询认证会员信息
* @param mobile
* @return
*/
public CertifiedMember selectCertifiedMemberByMobile(String mobile);
/**
* 根据id删除认证会员信息
* @param id

View File

@ -8,11 +8,14 @@ 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.FixingLevel;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.mapper.CertifiedMemberMapper;
import com.fuint.business.userManager.mapper.FixingLevelMapper;
import com.fuint.business.userManager.service.CertifiedMemberService;
import com.fuint.business.userManager.service.FixingLevelService;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.common.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@ -20,6 +23,9 @@ import org.springframework.stereotype.Service;
*/
@Service
public class CertifiedMemberServiceImpl extends ServiceImpl<CertifiedMemberMapper, CertifiedMember> implements CertifiedMemberService {
@Autowired
private LJUserService userService;
/**
* 根据条件分页查询固定等级信息
* @param page
@ -28,6 +34,11 @@ public class CertifiedMemberServiceImpl extends ServiceImpl<CertifiedMemberMappe
@Override
public IPage<CertifiedMember> selectCertifiedMemberList(Page page, CertifiedMember certifiedMember) {
IPage<CertifiedMember> fixingLevelIPage = baseMapper.selectCertifiedMemberList(page, certifiedMember);
// for (CertifiedMember record : fixingLevelIPage.getRecords()) {
// if (StringUtils.isNotEmpty(record.getAttestationData())){
// record.setImgUrlList(JSONArray.parseArray(record.getAttestationData(), JSONObject.class));
// }
// }
return fixingLevelIPage;
}
@ -54,6 +65,19 @@ public class CertifiedMemberServiceImpl extends ServiceImpl<CertifiedMemberMappe
return certifiedMember;
}
/**
* 根据会员手机号查询认证会员信息
* @param mobile
* @return
*/
@Override
public CertifiedMember selectCertifiedMemberByMobile(String mobile) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("mobile",mobile);
CertifiedMember certifiedMember = baseMapper.selectOne(queryWrapper);
return certifiedMember;
}
/**
* 根据id删除固定等级信息
* @param id
@ -70,6 +94,24 @@ public class CertifiedMemberServiceImpl extends ServiceImpl<CertifiedMemberMappe
*/
@Override
public int insertCertifiedMember(CertifiedMember certifiedMember) {
if (certifiedMember.getMobile()==null || certifiedMember.getMobile().equals("")){
return 2;
}
LJUser user = userService.selectUserByMobile(certifiedMember.getMobile());
if (user==null){
return 3;
}
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("mobile",certifiedMember.getMobile());
CertifiedMember member = baseMapper.selectOne(queryWrapper);
if (member!=null){
return 4;
}
if (certifiedMember.getName()==null || certifiedMember.getName().equals("")){
LJUser ljUser = userService.selectUserByMobile(certifiedMember.getMobile());
certifiedMember.setName(ljUser.getName());
certifiedMember.setUserId(ljUser.getId());
}
int row = baseMapper.insert(certifiedMember);
return row;
}