Commit 1a6da35f authored by “yiyousong”'s avatar “yiyousong”
parents 8c6229bf 1f9ac10e
<template>
<el-popover placement="bottom-start" trigger="manual" v-model="visible">
<a slot="reference" class="ant-dropdown-link" @click="visible = true">
{{ siteName }} <i class="el-icon-arrow-down"></i>
</a>
<div class="content" style="min-width: 50vw; min-height: 200px">
<div class="flex_row flex_align_c primary-color name">
<i class="el-icon-location" style="margin-right: 10px"></i>
<span style="">{{ siteName }}</span>
</div>
<div class="site-list">
<span
v-for="(item, index) in sitelist"
:key="index"
:class="{ 'primary-color': item.id == checkid }"
@click="setSite(item)"
>{{ item.label }}</span
>
</div>
<div class="check-site">
<span>您的选择是:</span>
<span
v-for="(item, index) in checkarr"
:key="index"
@click="updataSite(item)"
>{{ index > 0 ? ">" : "" }}{{ item.label }}</span
>
</div>
<div class="site-btn">
<el-button
type="primary" class="addclass"
size="small"
style="margin-right: 10px"
@click="onSucessSite"
:disabled="isSite"
>确定</el-button
>
<el-button size="small" @click="visible = false">取消</el-button>
</div>
</div>
</el-popover>
</template>
<script>
import session from "@/assets/utils/session.js";
export default {
data() {
return {
sitelist: [],
visible: false,
offsetLeft: 0,
checkarr: [], //选中站点
checkid: undefined, //最终选中站点
siteName: "请选择站点",
isSite: true,
};
},
computed: {},
created() {
this.getwaitedListdata();
},
mounted() {},
methods: {
// 确认站点
onSucessSite() {
if (this.checkarr.length == 0) return;
let obj = this.checkarr[this.checkarr.length - 1];
this.clickSite(obj);
},
// 选中
setSite(obj) {
this.checkid = undefined;
// 为子节点不添加数据
let data = this.checkarr[this.checkarr.length - 1];
if (data && (data.isLeaf || data.children.length == 0)) {
// 如果为子节点更新最后一个数据
this.checkid = obj.id;
this.checkarr[this.checkarr.length - 1] = obj;
} else {
this.checkarr.push(obj);
if (obj.children && obj.children.length > 0) {
this.sitelist = obj.children;
}
}
if (obj && obj.type == "site") {
this.isSite = false;
} else {
this.isSite = true;
}
},
// 更新选中
updataSite(row) {
const { id } = row;
this.checkid = undefined;
let index = this.checkarr.findIndex((v) => v.id == id);
this.checkarr.length = index + 1;
this.sitelist = row.children;
if (row && row.type == "site") {
this.isSite = false;
} else {
this.isSite = true;
}
},
getwaitedListdata() {
let url =
process.env.VUE_APP_SITETREE_URL == "undefined"
? "http://192.168.0.98:11078/base/site/siteTree"
: process.env.VUE_APP_SITETREE_URL;
this.$get(url).then((res) => {
const { siteTree } = res.data;
this.sitelist = siteTree;
let arr = [];
const treeFn = function (e) {
e.forEach((element) => {
arr.push(element);
if (element.children && element.children.length > 0) {
treeFn(element.children);
}
});
};
const siteid = session.getSession("siteid");
treeFn(siteTree);
const siteObj = arr.find((v) => v.id == siteid);
this.siteName = siteObj ? siteObj.label : "请选择站点";
});
},
clickSite(obj) {
session.setSession("siteid", obj.id);
this.show = false;
if (location.href.search(/token/gi) >= 0) {
setTimeout(() => {
location.reload();
});
} else {
location.reload();
}
},
},
};
</script>
<style lang="less" scoped>
.ant-dropdown-link {
padding: 0px;
font-size: 16px;
min-width: 200px;
display: inline-block;
}
.content {
display: flex;
flex-direction: column;
justify-content: space-around;
.name {
font-size: 20px;
color: #1890ff;
}
.site-list {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
display: flex;
flex-wrap: wrap;
span {
line-height: 1.5;
padding: 10px 20px;
cursor: pointer;
&:hover {
color: #1890ff;
}
}
}
.check-site,
.site-btn {
padding: 0 20px;
}
.check-site {
cursor: pointer;
}
}
.trigger {
display: inline-block;
position: relative;
}
.ant-dropdown-link {
padding: 0px;
font-size: 16px;
display: inline-block;
color: #fff;
cursor: pointer;
}
.select-site {
position: fixed;
left: 300px !important;
top: 65px;
background: #fff;
border-radius: 6px;
padding: 10px;
min-width: 60%;
max-width: 80%;
z-index: 9;
color: rgba(0, 0, 0, 0.8);
font-size: 14px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
.name {
font-size: 20px;
}
.site-list {
// padding: 10px 0;
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
overflow: hidden;
span {
float: left;
line-height: 1.5;
padding: 10px 20px;
cursor: pointer;
&:hover {
color: #1890ff;
}
}
}
.check-site,
.site-btn {
padding: 0 20px;
}
}
</style>
<template> <template>
<el-popover placement="bottom-start" trigger="manual" v-model="visible"> <div :trigger="['click']" class="trigger" @click="ontrigger">
<a slot="reference" class="ant-dropdown-link" @click="visible = true"> <slot>
{{ siteName }} <i class="el-icon-arrow-down"></i> <a class="ant-dropdown-link" @click="(e) => e.preventDefault()">
</a> {{siteName}} <a-icon type="down" />
<div class="content" style="min-width: 50vw; min-height: 200px"> </a>
</slot>
<div
slot="overlay"
class="select-site"
:style="{ left: `${offsetLeft}px` }"
v-if="show"
>
<div class="flex_row flex_align_c primary-color name"> <div class="flex_row flex_align_c primary-color name">
<i class="el-icon-location" style="margin-right: 10px"></i> <a-icon type="environment" style="margin-right: 10px" />
<span style="">{{ siteName }}</span> <span style="">{{siteName}}</span>
</div> </div>
<div class="site-list"> <div class="site-list">
<span <span
...@@ -27,168 +34,166 @@ ...@@ -27,168 +34,166 @@
> >
</div> </div>
<div class="site-btn"> <div class="site-btn">
<el-button <a-button
type="primary" class="addclass" type="primary"
size="small"
style="margin-right: 10px" style="margin-right: 10px"
@click="onSucessSite" @click="onSucessSite"
:disabled="isSite" :disabled="isSite"
>确定</el-button >确定</a-button
> >
<el-button size="small" @click="visible = false">取消</el-button> <a-button @click="show = false">取消</a-button>
</div> </div>
</div> </div>
</el-popover> </div>
</template> </template>
<script> <script>
// import {getsiteTree} from "@/services/default"
// import { mapGetters } from "vuex";
// import Cookie from 'js-cookie'
import session from "@/assets/utils/session.js"; import session from "@/assets/utils/session.js";
export default { export default {
data() { data() {
return { return {
sitelist: [], sitelist: [],
visible: false, show: false,
offsetLeft: 0, offsetLeft: 0,
checkarr: [], //选中站点 checkarr: [], //选中站点
checkid: undefined, //最终选中站点 checkid: undefined, //最终选中站点
siteName: "请选择站点", siteName:"",
isSite: true, isSite:true
}; };
}, },
computed: {}, // computed: {
// ...mapGetters("account", ["user"]),
// },
created() { created() {
this.getwaitedListdata(); this.getwaitedListdata();
}, },
mounted() {}, mounted() {
const { offsetLeft } = this.$el;
this.offsetLeft = offsetLeft;
},
methods: { methods: {
// 确认站点 // 确认站点
onSucessSite() { onSucessSite() {
if (this.checkarr.length == 0) return; if (this.checkarr.length == 0) return;
let obj = this.checkarr[this.checkarr.length - 1]; let obj = this.checkarr[this.checkarr.length - 1];
this.clickSite(obj); this.clickSite(obj);
}, },
// 选中 // 选中
setSite(obj) { setSite(obj) {
this.checkid = undefined; this.checkid = undefined;
// 为子节点不添加数据 // 为子节点不添加数据
let data = this.checkarr[this.checkarr.length - 1]; let data = this.checkarr[this.checkarr.length - 1];
if (data && (data.isLeaf || data.children.length == 0)) { if (data && (data.isLeaf || data.children.length == 0)) {
// 如果为子节点更新最后一个数据 // 如果为子节点更新最后一个数据
this.checkid = obj.id; this.checkid = obj.id;
this.checkarr[this.checkarr.length - 1] = obj; this.checkarr[this.checkarr.length - 1] = obj;
// 如果选中数据有子集更新站点列表
if(obj.children && obj.children.length>0){
this.sitelist = obj.children
}
} else { } else {
this.checkarr.push(obj); this.checkarr.push(obj);
if (obj.children && obj.children.length > 0) { if(obj.children && obj.children.length>0){
this.sitelist = obj.children; this.sitelist = obj.children
} }
} }
if (obj && obj.type == "site") {
this.isSite = false; if(obj && obj.type == "site"){
} else { this.isSite = false
this.isSite = true; }else{
this.isSite = true
} }
}, },
// 更新选中 // 更新选中
updataSite(row) { updataSite(row) {
const { id } = row; const {id} = row
this.checkid = undefined; this.checkid = undefined;
let index = this.checkarr.findIndex((v) => v.id == id); let index = this.checkarr.findIndex((v) => v.id == id);
this.checkarr.length = index + 1;
this.sitelist = row.children; if(index > -1){
this.checkarr.splice(index+1,this.checkarr.length-(index+1))
if (row && row.type == "site") { }
this.isSite = false; if(row.children && row.children.length>0){
} else { this.sitelist = row.children
this.isSite = true; }
if(row && row.type == "site"){
this.isSite = false
}else{
this.isSite = true
} }
// this.getwaitedListdata(id);
}, },
getwaitedListdata() { getwaitedListdata() {
let url = let url =
process.env.VUE_APP_SITETREE_URL == "undefined" process.env.VUE_APP_SITETREE_URL == "undefined"
? "http://192.168.0.98:11078/base/site/siteTree" ? "http://192.168.0.98:11078/base/site/siteTree"
: process.env.VUE_APP_SITETREE_URL; : process.env.VUE_APP_SITETREE_URL;
this.$get(url).then((res) => { this.$get(url).then(res=>{
const { siteTree } = res.data; const {code,data} = res.data
this.sitelist = siteTree;
let arr = []; if(code == 1){
const treeFn = function (e) { const {siteTree} = data
e.forEach((element) => { this.sitelist = siteTree
arr.push(element); let arr = []
if (element.children && element.children.length > 0) { const treeFn = function(e){
treeFn(element.children); e.forEach(element => {
} arr.push(element)
}); if(element.children && element.children.length>0){
}; treeFn(element.children)
const siteid = session.getSession("siteid"); }
treeFn(siteTree); });
const siteObj = arr.find((v) => v.id == siteid); }
this.siteName = siteObj ? siteObj.label : "请选择站点"; // const siteid = Cookie.get('siteid')
}); const siteid = session.getSession("siteid");
treeFn(siteTree)
const siteObj = arr.find(v=>v.id == siteid)
this.siteName = siteObj?siteObj.label:"请选择站点"
}
})
}, },
clickSite(obj) { clickSite(obj) {
// Cookie.set('siteid', obj.id)
session.setSession("siteid", obj.id); session.setSession("siteid", obj.id);
this.show = false; this.show = false
if (location.href.search(/token/gi) >= 0) { if(location.href.search(/token/ig) >= 0){
this.$router.push({path:'/resource/advimg'})
setTimeout(() => { setTimeout(() => {
location.reload(); location.reload()
}); });
} else { }else{
location.reload(); location.reload()
}
},
ontrigger(e) {
if (e.target && e.target.nodeName == "A") {
this.show = !this.show;
} }
}, },
}, },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.ant-dropdown-link {
padding: 0px;
font-size: 16px;
min-width: 200px;
display: inline-block;
}
.content {
display: flex;
flex-direction: column;
justify-content: space-around;
.name {
font-size: 20px;
color: #1890ff;
}
.site-list {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
display: flex;
flex-wrap: wrap;
span {
line-height: 1.5;
padding: 10px 20px;
cursor: pointer;
&:hover {
color: #1890ff;
}
}
}
.check-site,
.site-btn {
padding: 0 20px;
}
.check-site {
cursor: pointer;
}
}
.trigger { .trigger {
display: inline-block; display: inline-block;
position: relative; position: relative;
} }
.ant-dropdown-link { .ant-dropdown-link {
padding: 0px; color: #fff;
padding: 0 20px;
font-size: 16px; font-size: 16px;
min-width: 200px;
display: inline-block; display: inline-block;
color: #fff;
cursor: pointer;
} }
.select-site { .select-site {
position: fixed; position: fixed;
left: 300px !important; left: 0;
top: 65px; top: 65px;
background: #fff; background: #fff;
border-radius: 6px; border-radius: 6px;
...@@ -211,6 +216,7 @@ export default { ...@@ -211,6 +216,7 @@ export default {
float: left; float: left;
line-height: 1.5; line-height: 1.5;
padding: 10px 20px; padding: 10px 20px;
display: inline-block;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
color: #1890ff; color: #1890ff;
......
package com.mortals.xhx.base.system.user.model;
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
import java.util.List;
/**
* Description:User
* date: 2021-9-26 16:11:48
*/
@Data
public class UserEntityExt extends BaseEntityLong {
/**
* 站点名称
*/
private String siteName;
private String roleIds;
/**
* 唯一标识
*/
private String token;
/**
* 菜单栏
*/
private String menuUrl;
/**
* 登录时间
*/
private Long loginTime;
/**
* 过期时间
*/
private Long expireTime;
}
\ No newline at end of file
...@@ -116,9 +116,6 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -116,9 +116,6 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
boolean updateUserPwd(String loginName, String oldPwd, String newPwd) throws AppException; boolean updateUserPwd(String loginName, String oldPwd, String newPwd) throws AppException;
Rest<Void> refreshUser(); Rest<Void> refreshUser();
UserDao getUserDao(); UserDao getUserDao();
......
...@@ -25,7 +25,6 @@ import com.mortals.xhx.base.system.resource.model.ResourceEntity; ...@@ -25,7 +25,6 @@ import com.mortals.xhx.base.system.resource.model.ResourceEntity;
import com.mortals.xhx.base.system.resource.service.ResourceService; import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.role.model.RoleUserEntity; import com.mortals.xhx.base.system.role.model.RoleUserEntity;
import com.mortals.xhx.base.system.role.model.RoleUserQuery; import com.mortals.xhx.base.system.role.model.RoleUserQuery;
import com.mortals.xhx.base.system.role.service.RoleService;
import com.mortals.xhx.base.system.role.service.RoleUserService; import com.mortals.xhx.base.system.role.service.RoleUserService;
import com.mortals.xhx.base.system.user.dao.UserDao; import com.mortals.xhx.base.system.user.dao.UserDao;
import com.mortals.xhx.base.system.user.model.UserEntity; import com.mortals.xhx.base.system.user.model.UserEntity;
...@@ -38,6 +37,7 @@ import com.mortals.xhx.feign.user.IUserFeign; ...@@ -38,6 +37,7 @@ import com.mortals.xhx.feign.user.IUserFeign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -63,10 +63,9 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE ...@@ -63,10 +63,9 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
@Autowired @Autowired
private ResourceService resourceService; private ResourceService resourceService;
@Autowired @Autowired
private RoleService roleService;
@Autowired
private RoleUserService roleUserService; private RoleUserService roleUserService;
@Lazy
@Autowired @Autowired
private IUserFeign userFeign; private IUserFeign userFeign;
...@@ -105,19 +104,22 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE ...@@ -105,19 +104,22 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
//更新不更新密码字段 //更新不更新密码字段
entity.setLoginPwd(null); entity.setLoginPwd(null);
this.doHandlerUser(entity); this.doHandlerUser(entity);
//更新角色
if (entity.getId().longValue() != SysConstains.ADMIN_ID && !ObjectUtils.isEmpty(entity.getRoleIds())) {
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(entity.getId());
List<Long> idList = Arrays.asList(entity.getRoleIds().split(",")).stream().map(Long::parseLong).collect(Collectors.toList());
roleUserQuery.setRoleIdList(idList);
roleUserService.doDistributionRole(roleUserQuery);
}
} }
@Override @Override
protected void saveAfter(UserEntity entity, Context context) throws AppException { protected void saveAfter(UserEntity entity, Context context) throws AppException {
//更新角色 //新增角色
updateUserRole(entity);
super.saveAfter(entity, context);
}
@Override
protected void updateAfter(UserEntity entity, Context context) throws AppException {
updateUserRole(entity);
super.updateAfter(entity, context);
}
private void updateUserRole(UserEntity entity) {
if (!ObjectUtils.isEmpty(entity.getId()) && entity.getId().longValue() != SysConstains.ADMIN_ID && !ObjectUtils.isEmpty(entity.getRoleIds())) { if (!ObjectUtils.isEmpty(entity.getId()) && entity.getId().longValue() != SysConstains.ADMIN_ID && !ObjectUtils.isEmpty(entity.getRoleIds())) {
RoleUserQuery roleUserQuery = new RoleUserQuery(); RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(entity.getId()); roleUserQuery.setUserId(entity.getId());
...@@ -125,7 +127,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE ...@@ -125,7 +127,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
roleUserQuery.setRoleIdList(idList); roleUserQuery.setRoleIdList(idList);
roleUserService.doDistributionRole(roleUserQuery); roleUserService.doDistributionRole(roleUserQuery);
} }
super.saveAfter(entity, context);
} }
@Override @Override
...@@ -139,21 +140,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE ...@@ -139,21 +140,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
super.findAfter(params, pageInfo, context, list); super.findAfter(params, pageInfo, context, list);
} }
@Override
protected UserEntity findBefore(UserEntity params, Context context) throws AppException {
// if (StringUtils.isNotEmpty(params.getDeptIds())) {
// params.setDeptIds(StringUtils.fillWithMark(params.getDeptIds(), ","));
// }
return super.findBefore(params, context);
}
@Override
protected UserEntity findBefore(UserEntity params, PageInfo pageInfo, Context context) throws AppException {
// if (StringUtils.isNotEmpty(params.getDeptIds())) {
// params.setDeptIds(StringUtils.fillWithMark(params.getDeptIds(), ","));
// }
return super.findBefore(params, pageInfo, context);
}
public UserEntity findByLoginName(String loginName) { public UserEntity findByLoginName(String loginName) {
UserQuery params = new UserQuery(); UserQuery params = new UserQuery();
...@@ -343,40 +329,51 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE ...@@ -343,40 +329,51 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
List<UserEntity> newUserList = userPduList.stream().map(newUser -> { List<UserEntity> newUserList = userPduList.stream().map(newUser -> {
UserEntity userEntity = new UserEntity(); UserEntity userEntity = new UserEntity();
userEntity.initAttrValue(); userEntity.initAttrValue();
BeanUtils.copyProperties(newUser, userEntity, new String[]{"id","lastLoginTime", "lastLoginAddress"}); BeanUtils.copyProperties(newUser, userEntity, new String[]{"id", "lastLoginTime", "lastLoginAddress"});
return userEntity; return userEntity;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
List<UserEntity> oldUserList = this.find(new UserQuery()); List<UserEntity> saveUpdateUserList = newUserList.parallelStream().map(item -> {
log.info(" oldUserList size:{}", oldUserList.size()); UserEntity extCache = this.getExtCache(item.getLoginName());
if (ObjectUtils.isEmpty(extCache)) {
Map<String, UserEntity> oldUserMap = oldUserList.stream().collect(Collectors.toMap(x -> x.getLoginName(), y -> y, (o, n) -> n));
Map<String, UserEntity> newUserMap = newUserList.stream().collect(Collectors.toMap(x -> x.getLoginName(), y -> y, (o, n) -> n));
List<UserEntity> saveUserList = newUserList.stream().map(item -> {
if (!oldUserMap.containsKey(item.getLoginName())) {
item.setCreateUserId(1L); item.setCreateUserId(1L);
item.setCreateUserName("系统管理员"); item.setCreateUserName("系统管理员");
item.setCreateTime(new Date()); item.setCreateTime(new Date());
return item; return item;
} else {
//更新用户列表
item.setId(extCache.getId());
item.setUpdateUserId(1L);
item.setUpdateUserName("系统管理员");
item.setUpdateTime(new Date());
return item;
} }
return null; }).collect(Collectors.toList());
}).filter(f -> f != null).collect(Collectors.toList()); Map<Boolean, List<UserEntity>> saveUpdateCollect = saveUpdateUserList.stream().collect(Collectors.partitioningBy(x -> x.getId() == null));
if (!ObjectUtils.isEmpty(saveUpdateCollect.get(true))) {
//需要新增的用户
if (!ObjectUtils.isEmpty(saveUserList)) { log.info("需要新增用户数量:{}", saveUpdateCollect.get(true).size());
saveUserList.stream().forEach(item->{ saveUpdateCollect.get(true).stream().forEach(item -> {
this.getUserDao().insert(item); this.getUserDao().insert(item);
this.putCache(item.getId() == null ? "" : item.getId().toString(), item);
//更新默认用户角色
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(item.getId());
roleUserQuery.setRoleIdList(Arrays.asList(1L));
roleUserService.doDistributionRole(roleUserQuery);
}); });
//userService.save(saveUserList);
} }
if (!ObjectUtils.isEmpty(saveUpdateCollect.get(false))) {
//需要新增的用户
log.info("需要更新用户数量:{}", saveUpdateCollect.get(false).size());
saveUpdateCollect.get(false).stream().forEach(item -> {
this.getUserDao().update(item);
this.putCache(item.getId() == null ? "" : item.getId().toString(), item);
});
}
} }
//查找新增 与更新 //查找新增 与更新
} }
return Rest.ok(); return Rest.ok();
} }
...@@ -388,13 +385,10 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE ...@@ -388,13 +385,10 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
@Override @Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException { protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
Arrays.asList(ids).stream().peek(userId -> {
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(userId);
Long[] userIds = roleUserService.find(roleUserQuery).stream().map(RoleUserEntity::getId).toArray(Long[]::new);
roleUserService.remove(userIds, context);
}).count();
super.removeAfter(ids, context, result); super.removeAfter(ids, context, result);
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserIdList(Arrays.asList(ids));
Long[] userIds = roleUserService.find(roleUserQuery).stream().map(RoleUserEntity::getId).toArray(Long[]::new);
roleUserService.remove(userIds, context);
} }
} }
\ No newline at end of file
...@@ -44,7 +44,6 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -44,7 +44,6 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
private RoleUserService roleUserService; private RoleUserService roleUserService;
public UserController() { public UserController() {
super.setFormClass(UserForm.class);
super.setModuleDesc("用户信息"); super.setModuleDesc("用户信息");
} }
...@@ -78,10 +77,6 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -78,10 +77,6 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
@Override @Override
protected int saveAfter(UserEntity entity, Map<String, Object> model, Context context) throws AppException { protected int saveAfter(UserEntity entity, Map<String, Object> model, Context context) throws AppException {
if (entity.getId() == getCurUser().getId()) {
// TODO: 2022/8/15 更新redis session信息
//saveCurrUserForSession(request, response, userService.get(form.getEntity().getId(), false));
}
return super.saveAfter(entity, model, context); return super.saveAfter(entity, model, context);
} }
......
/**
* 文件:UserForm.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.user.web;
import com.mortals.framework.web.BaseCRUDFormLong;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
/**
* <p>Title: 用户信息</p>
* <p>Description: UserForm </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public class UserForm extends BaseCRUDFormLong<UserEntity> {
private UserEntity entity = new UserEntity();
private UserQuery query = new UserQuery();
public UserForm(){
}
@Override
public UserEntity getEntity() {
return entity;
}
public void setEntity(UserEntity entity) {
this.entity = entity;
}
@Override
public UserQuery getQuery() {
return query;
}
public void setQuery(UserQuery query) {
this.query = query;
}
}
\ No newline at end of file
...@@ -107,7 +107,7 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl ...@@ -107,7 +107,7 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl
deviceAlarmInfo.setTodayAlarmInfoCount(todayAlarmInfoCount); deviceAlarmInfo.setTodayAlarmInfoCount(todayAlarmInfoCount);
//今日告警设备数量 //今日告警设备数量
long todayAlarmDeviceCount = deviceAlarmInfoList.parallelStream().distinct().count(); long todayAlarmDeviceCount = deviceAlarmInfoList.parallelStream().map(i->i.getDeviceCode()).distinct().count();
deviceAlarmInfo.setTodayAlarmDeviceCount(todayAlarmDeviceCount); deviceAlarmInfo.setTodayAlarmDeviceCount(todayAlarmDeviceCount);
//告警类型分布 //告警类型分布
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment