代理表与user同步 (A级代理 1级代理)

This commit is contained in:
wangshuai 2024-07-09 17:32:54 +08:00
parent af7e576a9d
commit 3a411dd1f3
5 changed files with 52 additions and 13 deletions

View File

@ -1,9 +1,15 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.validation.Validator; import javax.validation.Validator;
import com.ruoyi.business.domain.BusAgentInfo;
import com.ruoyi.business.mapper.BusAgentInfoMapper;
import com.ruoyi.business.service.IBusAgentInfoService;
import com.ruoyi.common.core.domain.model.LoginUser;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -65,6 +71,9 @@ public class SysUserServiceImpl implements ISysUserService
@Autowired @Autowired
protected Validator validator; protected Validator validator;
@Autowired
private BusAgentInfoMapper busAgentInfoMapper;
/** /**
* 根据条件分页查询用户列表 * 根据条件分页查询用户列表
* *
@ -266,6 +275,19 @@ public class SysUserServiceImpl implements ISysUserService
insertUserPost(user); insertUserPost(user);
// 新增用户与角色管理 // 新增用户与角色管理
insertUserRole(user); insertUserRole(user);
if(user.getRoleIds()[0]==100L){
LoginUser loginUser = SecurityUtils.getLoginUser();
BusAgentInfo busAgentInfo = new BusAgentInfo();
busAgentInfo.setId(user.getUserId());
busAgentInfo.setAgentAccount(user.getUserName());
busAgentInfo.setAgentName(user.getNickName());
busAgentInfo.setSuperiorAgentCode(loginUser.getUserId());
busAgentInfo.setSuperiorAgentAccount(loginUser.getUsername());
busAgentInfo.setDelStatus("1");
busAgentInfo.setIntegral("0");
busAgentInfo.setCreateTime(new Date());
busAgentInfoMapper.insertBusAgentInfo(busAgentInfo);
}
return rows; return rows;
} }
@ -471,6 +493,12 @@ public class SysUserServiceImpl implements ISysUserService
userRoleMapper.deleteUserRole(userIds); userRoleMapper.deleteUserRole(userIds);
// 删除用户与岗位关联 // 删除用户与岗位关联
userPostMapper.deleteUserPost(userIds); userPostMapper.deleteUserPost(userIds);
if(userIds.length==1){
BusAgentInfo busAgentInfo = new BusAgentInfo();
busAgentInfo.setId(userIds[0]);
busAgentInfo.setDelStatus("2");
busAgentInfoMapper.updateBusAgentInfo(busAgentInfo);
}
return userMapper.deleteUserByIds(userIds); return userMapper.deleteUserByIds(userIds);
} }

View File

@ -61,3 +61,10 @@ export function updateStoreConfig(data) {
data: data data: data
}) })
} }
export function refresh(){
return request({
url: '/business/store/saveOrUpdate',
method: 'get'
})
}

View File

@ -186,17 +186,7 @@ export default {
pageSize: 10, pageSize: 10,
agentAccount: null, agentAccount: null,
agentName: null, agentName: null,
superiorAgentCode: null, delStatus: "1"
superiorAgentAccount: null,
grantStoreNum: null,
operateStoreNum: null,
lastUseIntegralNum: null,
lastPositiveReviewsNum: null,
aiDurationBalance: null,
lastLoginTime: null,
lastLoginIp: null,
loginNum: null,
delStatus: null
}, },
// //
form: {}, form: {},

View File

@ -128,6 +128,15 @@
<el-tooltip content="请使用鼠标右键点击授权M后选择在隐身窗口中打开链接新增或更新失效操作一致" effect="dark" placement="right"> <el-tooltip content="请使用鼠标右键点击授权M后选择在隐身窗口中打开链接新增或更新失效操作一致" effect="dark" placement="right">
<i class="el-tooltip el-icon-question" tabindex="0" ></i> <i class="el-tooltip el-icon-question" tabindex="0" ></i>
</el-tooltip> </el-tooltip>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-refresh"
size="mini"
@click="handleRefresh"
>一键同步</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -353,7 +362,7 @@
<script> <script>
import { listStore, changeReturnVisitStatus, getMtUrl, changeSelfDeliveryStatus, getStoreConfig, updateStoreConfig} from "@/api/business/store"; import { listStore, changeReturnVisitStatus, getMtUrl, changeSelfDeliveryStatus, getStoreConfig, updateStoreConfig, refresh} from "@/api/business/store";
import { listSaleA} from "@/api/business/sale"; import { listSaleA} from "@/api/business/sale";
export default { export default {
@ -557,6 +566,11 @@ export default {
// this.open = true; // this.open = true;
// this.title = ""; // this.title = "";
}, },
async handleRefresh(){
await refresh().then(response => {
this.handleQuery();
})
},
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();

View File

@ -141,7 +141,7 @@
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" /> <el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" /> <el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" /> <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
<el-table-column label="代理级别" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" /> <el-table-column label="所属代理级别" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" /> <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible"> <el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
<template slot-scope="scope"> <template slot-scope="scope">