优化
This commit is contained in:
parent
de8c4d91da
commit
12c748828f
8
pom.xml
8
pom.xml
@ -952,13 +952,13 @@
|
||||
<!–<excludeClass>CustomClassLoader;WisdomSiteApplication;LicenseUtil;MyBootJarLauncher;MyJarClassLoader</excludeClass>–>
|
||||
</configuration>
|
||||
</plugin>-->
|
||||
<plugin>
|
||||
<!-- https://gitee.com/roseboy/classfinal -->
|
||||
<!-- <plugin>
|
||||
<!– https://gitee.com/roseboy/classfinal –>
|
||||
<groupId>net.roseboy</groupId>
|
||||
<artifactId>classfinal-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<configuration>
|
||||
<password>#</password><!--加密打包之后pom.xml会被删除,不用担心在jar包里找到此密码-->
|
||||
<password>#</password><!–加密打包之后pom.xml会被删除,不用担心在jar包里找到此密码–>
|
||||
<packages>com.zhgd,com.license</packages>
|
||||
<cfgfiles>application.yml,application.properties,application-dev.properties,application-test.properties</cfgfiles>
|
||||
<excludes>org.spring</excludes>
|
||||
@ -972,7 +972,7 @@
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugin>-->
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
|
||||
@ -5,14 +5,15 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemDictData;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemDictDataService;
|
||||
import com.zhgd.xmgl.modules.basicdata.vo.SystemUserSyncVo;
|
||||
import com.zhgd.xmgl.modules.wisdom.entity.AttendanceDev;
|
||||
import com.zhgd.xmgl.modules.wisdom.entity.AttendanceDevSync;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemDictData;
|
||||
import com.zhgd.xmgl.modules.wisdom.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.wisdom.mapper.AttendanceDevMapper;
|
||||
import com.zhgd.xmgl.modules.wisdom.mapper.WorkerInfoMapper;
|
||||
import com.zhgd.xmgl.modules.wisdom.service.IAttendanceDevSyncService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemDictDataService;
|
||||
import com.zhgd.xmgl.util.HttpUtil;
|
||||
import com.zhgd.xmgl.util.ParamEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -138,4 +139,27 @@ public class AsyncAttendance {
|
||||
attendanceDevSync.setCreateTime(new Date());
|
||||
return attendanceDevSync;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步用户信息
|
||||
* @param type
|
||||
* @param systemUserSyncVo
|
||||
*/
|
||||
public String syncUser(Integer type, SystemUserSyncVo systemUserSyncVo) {
|
||||
String requestUrl = buildRequestUrl(type, null);
|
||||
if (requestUrl == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(systemUserSyncVo));
|
||||
// 推送同步信息
|
||||
String result = HttpUtil.doPost(requestUrl, jsonObject.toString());
|
||||
return result;
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("推送考勤设备数据出现异常,请求路径:" + requestUrl + ",设备ID:" + systemUserSyncVo.getUid());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,14 +5,8 @@ import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.xmgl.handler.exception.CustomException;
|
||||
import com.zhgd.xmgl.modules.basicdata.dto.SystemUserDto;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.Government;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemRole;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUserRole;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IGovernmentService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemRoleService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserRoleService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.*;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.*;
|
||||
import com.zhgd.xmgl.modules.basicdata.vo.SystemUserOpVo;
|
||||
import com.zhgd.xmgl.modules.basicdata.vo.SystemUserVo;
|
||||
import com.zhgd.xmgl.security.JwtTokenProvider;
|
||||
@ -47,6 +41,9 @@ public class SystemUserOpController {
|
||||
@Autowired
|
||||
private ISystemUserService systemUserService;
|
||||
|
||||
@Autowired
|
||||
private IEnterpriseService enterpriseService;
|
||||
|
||||
@Autowired
|
||||
private ISystemUserRoleService systemUserRoleService;
|
||||
|
||||
@ -68,17 +65,16 @@ public class SystemUserOpController {
|
||||
if (systemUser1 != null) {
|
||||
throw new CustomException("该用户账号已存在!请重新输入");
|
||||
}
|
||||
Government government = governmentService.list().get(0);
|
||||
SystemUser systemUser = new SystemUser();
|
||||
systemUser.setUserId(systemUserOpVo.getId());
|
||||
systemUser.setAccount(systemUserOpVo.getName());
|
||||
systemUser.setPassword(systemUserOpVo.getPwd());
|
||||
systemUser.setShowPassword(systemUserOpVo.getPwd());
|
||||
systemUser.setCreateTime(new Date());
|
||||
systemUser.setSn(government.getGovernmentSn());
|
||||
systemUser.setSn(systemUserOpVo.getSn());
|
||||
systemUser.setShowPassword(systemUser.getPassword());
|
||||
systemUser.setIsManager(false);
|
||||
systemUser.setAccountType(2);
|
||||
systemUser.setAccountType(systemUserOpVo.getAccountType());
|
||||
systemUser.setUserTel(systemUserOpVo.getNumPhone());
|
||||
systemUser.setRealName(systemUserOpVo.getRealName());
|
||||
systemUserService.save(systemUser);
|
||||
@ -157,11 +153,11 @@ public class SystemUserOpController {
|
||||
|
||||
@OperLog(operModul = "角色管理", operType = "列表查询", operDesc = "列表查询系统角色信息")
|
||||
@ApiOperation(value = " 列表查询系统角色信息", notes = "列表查询系统角色信息", httpMethod="GET")
|
||||
@GetMapping(value = "/roleList")
|
||||
public Result<List<SystemRole>> roleList() {
|
||||
Government government = governmentService.list().get(0);
|
||||
List<SystemRole> list = systemRoleService.list(Wrappers.<SystemRole>lambdaQuery().eq(SystemRole::getSn, government.getGovernmentSn())
|
||||
.eq(SystemRole::getSysDefault, 0).gt(SystemRole::getPriority, 3));
|
||||
@PostMapping(value = "/roleList")
|
||||
public Result<List<SystemRole>> roleList(@RequestBody SystemRole systemRole) {
|
||||
List<SystemRole> list = systemRoleService.list(Wrappers.<SystemRole>lambdaQuery()
|
||||
.eq(SystemRole::getSysDefault, 0)
|
||||
.eq(SystemRole::getSn, systemRole.getSn()));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@ -176,4 +172,20 @@ public class SystemUserOpController {
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@OperLog(operModul = "角色管理", operType = "列表查询", operDesc = "查询政务信息")
|
||||
@ApiOperation(value = " 查询政务信息", notes = "查询政务信息", httpMethod="GET")
|
||||
@GetMapping(value = "/government")
|
||||
public Result<Government> government() {
|
||||
return Result.success(governmentService.list().get(0));
|
||||
}
|
||||
|
||||
@OperLog(operModul = "角色管理", operType = "列表查询", operDesc = "获取企业列表信息")
|
||||
@ApiOperation(value = " 获取企业列表信息", notes = "获取企业列表信息", httpMethod="GET")
|
||||
@GetMapping(value = "/enterpriseList")
|
||||
public Result<List<Enterprise>> enterpriseList() {
|
||||
List<Enterprise> list = enterpriseService.list(Wrappers.<Enterprise>lambdaQuery()
|
||||
.eq(Enterprise::getState, 1));
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,7 +72,11 @@ public class GovEnterpriseController {
|
||||
@PostMapping(value = "/list")
|
||||
public Result<List<Enterprise>> queryPageList(@RequestBody Enterprise enterprise) {
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
enterprise.setGovernmentSn(user.getSn());
|
||||
if (user.getAccountType() == 3) {
|
||||
user = null;
|
||||
} else {
|
||||
enterprise.setGovernmentSn(user.getSn());
|
||||
}
|
||||
QueryWrapper<Enterprise> queryWrapper = QueryGenerator.initQueryWrapper(enterprise);
|
||||
List<Enterprise> list = enterpriseService.list(queryWrapper);
|
||||
return Result.success(list);
|
||||
|
||||
@ -42,7 +42,7 @@ public class SystemUser implements Serializable {
|
||||
/**
|
||||
* 登录密码
|
||||
*/
|
||||
@NotBlank(message = "密码不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
// @NotBlank(message = "密码不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
@Excel(name = "登录密码", width = 15)
|
||||
@ApiModelProperty(value = "登录密码")
|
||||
private String password;
|
||||
|
||||
@ -11,9 +11,11 @@ import com.zhgd.xmgl.modules.basicdata.entity.SystemRole;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemRoleMenu;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemRoleMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemRoleMenuMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IGovernmentService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemRoleService;
|
||||
import com.zhgd.xmgl.security.SecurityUser;
|
||||
import com.zhgd.xmgl.security.SecurityUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -35,11 +37,14 @@ public class SystemRoleServiceImpl extends ServiceImpl<SystemRoleMapper, SystemR
|
||||
@Autowired
|
||||
private SystemRoleMenuMapper systemRoleMenuMapper;
|
||||
|
||||
@Autowired
|
||||
private IGovernmentService governmentService;
|
||||
|
||||
@Override
|
||||
public Page<SystemRole> pageList(Map<String, Object> map) {
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
QueryWrapper<SystemRole> queryWrapper = QueryGenerator.initPageQueryWrapper(SystemRole.class, map);
|
||||
if (user.getAccountType() == 4) {
|
||||
if (user.getAccountType() == 4 || (user.getAccountType() == 3 && !user.getEnterpriseMainList().contains(1))) {
|
||||
queryWrapper.eq("sn", user.getSn());
|
||||
if (!user.isManager()) {
|
||||
queryWrapper.eq("create_by", user.getUserId());
|
||||
@ -54,7 +59,9 @@ public class SystemRoleServiceImpl extends ServiceImpl<SystemRoleMapper, SystemR
|
||||
@Override
|
||||
public List<SystemRole> getList(SystemRole systemRole) {
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
if (user.getAccountType() == 4) {
|
||||
if (StringUtils.isNotBlank(systemRole.getSn())) {
|
||||
systemRole.setSn(systemRole.getSn());
|
||||
} else {
|
||||
systemRole.setSn(user.getSn());
|
||||
}
|
||||
QueryWrapper<SystemRole> queryWrapper = QueryGenerator.initQueryWrapper(systemRole);
|
||||
@ -71,7 +78,7 @@ public class SystemRoleServiceImpl extends ServiceImpl<SystemRoleMapper, SystemR
|
||||
if (systemRoleEntity != null) {
|
||||
throw new CustomException("角色名称已存在,请重新输入!");
|
||||
}
|
||||
systemRole.setSn(systemRole.getSn() == null ? user.getSn() : systemRole.getSn());
|
||||
systemRole.setSn(StringUtils.isBlank(systemRole.getSn()) ? governmentService.list().get(0).getGovernmentSn() : systemRole.getSn());
|
||||
systemRole.setRoleType(systemRole.getRoleType() == null ? user.getAccountType() : systemRole.getRoleType());
|
||||
systemRole.setCreateBy(user.getUserId());
|
||||
systemRole.setCreateTime(new Date());
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@ -7,12 +10,16 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.jeecg.common.util.PageUtil;
|
||||
import com.zhgd.mybatis.Aes;
|
||||
import com.zhgd.xmgl.async.AsyncAttendance;
|
||||
import com.zhgd.xmgl.handler.exception.CustomException;
|
||||
import com.zhgd.xmgl.modules.basicdata.dto.SystemUserDto;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUserRole;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.*;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IGovernmentService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
import com.zhgd.xmgl.modules.basicdata.vo.SystemUserSyncVo;
|
||||
import com.zhgd.xmgl.modules.basicdata.vo.SystemUserVo;
|
||||
import com.zhgd.xmgl.security.SecurityUser;
|
||||
import com.zhgd.xmgl.security.SecurityUtil;
|
||||
@ -51,12 +58,18 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
@Autowired
|
||||
private EnterpriseMapper enterpriseMapper;
|
||||
|
||||
@Autowired
|
||||
private AsyncAttendance asyncAttendance;
|
||||
|
||||
@Autowired
|
||||
private IGovernmentService governmentService;
|
||||
|
||||
@Override
|
||||
public Page<SystemUserDto> getPageList(Map<String, Object> map) {
|
||||
Page<SystemUser> page = PageUtil.getPage(map);
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
QueryWrapper<SystemUser> wrapper = QueryGenerator.initPageQueryWrapper(SystemUser.class, map);
|
||||
if (user.getAccountType() == 4) {
|
||||
if (user.getAccountType() == 4 || (user.getAccountType() == 3 && !user.getEnterpriseMainList().contains(1))) {
|
||||
wrapper.eq("u.sn", user.getSn());
|
||||
if (!user.isManager()) {
|
||||
wrapper.eq("u.create_by", user.getUserId());
|
||||
@ -87,21 +100,44 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
if (systemUser1 != null) {
|
||||
throw new CustomException("该用户账号已被使用!");
|
||||
}
|
||||
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
SystemUser systemUser = new SystemUser();
|
||||
BeanUtils.copyProperties(systemUserVo, systemUser);
|
||||
systemUser.setCreateTime(new Date());
|
||||
systemUser.setSn(systemUserVo.getSn() == null ? user.getSn() : systemUserVo.getSn());
|
||||
systemUser.setShowPassword(systemUser.getPassword());
|
||||
systemUser.setSn(StringUtils.isBlank(systemUserVo.getSn()) ? governmentService.list().get(0).getGovernmentSn() : systemUserVo.getSn());
|
||||
systemUser.setPassword(systemUser.getShowPassword());
|
||||
systemUser.setIsManager(false);
|
||||
systemUser.setAccountType(systemUserVo.getAccountType() == null ? user.getAccountType() : systemUserVo.getAccountType());
|
||||
systemUser.setCreateBy(user.getUserId());
|
||||
this.save(systemUser);
|
||||
//新增用户角色
|
||||
SystemUserRole systemUserRole = new SystemUserRole();
|
||||
systemUserRole.setRoleId(systemUserVo.getRoleId());
|
||||
systemUserRole.setUserId(systemUser.getUserId());
|
||||
return systemUserRoleMapper.insert(systemUserRole);
|
||||
//同步用户
|
||||
SystemUserSyncVo systemUserSyncVo = new SystemUserSyncVo();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("uid", user.getAccount());
|
||||
jsonObject.put("exp", DateUtil.offsetMinute(new Date(), 10).getTime());
|
||||
systemUserSyncVo.setToken(Aes.hzEncrypt(JSON.toJSONString(jsonObject)));
|
||||
systemUserSyncVo.setUid(systemUser.getAccount());
|
||||
systemUserSyncVo.setPwd(systemUser.getPassword());
|
||||
systemUserSyncVo.setRole(systemUserVo.getRoleId());
|
||||
systemUserSyncVo.setEnable(systemUser.getState());
|
||||
systemUserSyncVo.setNumPhone(systemUser.getUserTel());
|
||||
systemUserSyncVo.setRealName(systemUser.getRealName());
|
||||
systemUserSyncVo.setAccountType(systemUser.getAccountType());
|
||||
systemUserSyncVo.setSn(systemUser.getSn());
|
||||
String result = asyncAttendance.syncUser(1, systemUserSyncVo);
|
||||
if (result != null) {
|
||||
JSONObject object = JSONObject.parseObject(result);
|
||||
if (object.getInteger("code") == 200) {
|
||||
systemUser.setAccount(object.getJSONObject("data").getString("uid"));
|
||||
this.save(systemUser);
|
||||
//新增用户角色
|
||||
SystemUserRole systemUserRole = new SystemUserRole();
|
||||
systemUserRole.setRoleId(systemUserVo.getRoleId());
|
||||
systemUserRole.setUserId(systemUser.getUserId());
|
||||
return systemUserRoleMapper.insert(systemUserRole);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -28,4 +28,12 @@ public class SystemUserOpVo {
|
||||
|
||||
@ApiModelProperty(value = "用户名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "用户类型(2:政务;3:企业)")
|
||||
private Integer accountType;
|
||||
|
||||
@ApiModelProperty(value = "相对应的唯一标识SN")
|
||||
private String sn;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "系统用户同步信息(VO)", description = "SystemUserSyncVo")
|
||||
public class SystemUserSyncVo {
|
||||
|
||||
@ApiModelProperty(value = "token")
|
||||
private String token;
|
||||
|
||||
@ApiModelProperty(value = "登录账号")
|
||||
private String uid;
|
||||
|
||||
@ApiModelProperty(value = "登录密码")
|
||||
private String pwd;
|
||||
|
||||
@ApiModelProperty(value = "角色")
|
||||
private String role;
|
||||
|
||||
@ApiModelProperty(value = "1:开启,0:禁用")
|
||||
private Integer enable;
|
||||
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String numPhone;
|
||||
|
||||
@ApiModelProperty(value = "用户名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "用户类型(2:政务;3:企业)")
|
||||
private Integer accountType;
|
||||
|
||||
@ApiModelProperty(value = "相对应的唯一标识SN")
|
||||
private String sn;
|
||||
|
||||
|
||||
}
|
||||
@ -2,11 +2,13 @@ package com.zhgd.xmgl.security;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.EnterpriseMain;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUserRole;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.BaseActionMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserRoleMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IEnterpriseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.AuthorityUtils;
|
||||
@ -41,6 +43,9 @@ public class MyUserDetailsImpl implements UserDetailsService {
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
@Autowired
|
||||
private IEnterpriseMainService enterpriseMainService;
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
final SystemUser user = systemUserMapper.findByUsername(username);
|
||||
@ -57,10 +62,15 @@ public class MyUserDetailsImpl implements UserDetailsService {
|
||||
actionCodes = baseActionMapper.getActionCodeByRole(roleId).stream().map(a -> a.getActionCode()).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
List<Integer> enterpriseMainList = new ArrayList<>();
|
||||
if (user.getAccountType() == 3) {
|
||||
enterpriseMainList = enterpriseMainService.list(Wrappers.<EnterpriseMain>lambdaQuery().eq(EnterpriseMain::getEnterpriseSn, user.getSn()))
|
||||
.stream().map(e -> e.getMainType()).collect(Collectors.toList());
|
||||
}
|
||||
Collection<? extends GrantedAuthority> grantedAuthorityList = AuthorityUtils
|
||||
.createAuthorityList(actionCodes.toArray(new String[0]));
|
||||
return new SecurityUser(user.getUserId(), user.getAccount(), user.getRealName(),
|
||||
user.getUserTel(), user.getAccountType(), user.getSn(), user.getIsManager(), /*user.getEngineeringSn(),*/ user.getShowPassword(),
|
||||
user.getUserTel(), user.getAccountType(), user.getSn(), user.getIsManager(), enterpriseMainList, /*user.getEngineeringSn(),*/ user.getShowPassword(),
|
||||
true,
|
||||
true, true,
|
||||
false, grantedAuthorityList);
|
||||
|
||||
@ -9,6 +9,7 @@ import org.springframework.security.core.SpringSecurityCoreVersion;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author peng
|
||||
@ -25,6 +26,13 @@ public class SecurityUser extends User {
|
||||
@Setter
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 用户登录名
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
private String account;
|
||||
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
@ -60,6 +68,13 @@ public class SecurityUser extends User {
|
||||
@Setter
|
||||
private boolean isManager;
|
||||
|
||||
/**
|
||||
* 是否为管理员账号
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
private List<Integer> enterpriseMainList;
|
||||
|
||||
/**
|
||||
* 是否为工程账号
|
||||
*/
|
||||
@ -71,7 +86,7 @@ public class SecurityUser extends User {
|
||||
public SecurityUser(@JsonProperty("userId") String userId, @JsonProperty("account") String account,
|
||||
@JsonProperty("realName")String realName, @JsonProperty("userTel") String userTel,
|
||||
@JsonProperty("accountType") Integer accountType, @JsonProperty("sn") String sn,
|
||||
@JsonProperty("isManager") boolean isManager, /*@JsonProperty("engineeringSn") String engineeringSn,*/
|
||||
@JsonProperty("isManager") boolean isManager, @JsonProperty("enterpriseMainList") List<Integer> enterpriseMainList,
|
||||
@JsonProperty("password") String password, @JsonProperty("enabled") boolean enabled,
|
||||
@JsonProperty("accountNonExpired") boolean accountNonExpired,
|
||||
@JsonProperty("credentialsNonExpired") boolean credentialsNonExpired,
|
||||
@ -79,11 +94,13 @@ public class SecurityUser extends User {
|
||||
@JsonProperty("authorities") Collection<? extends GrantedAuthority> authorities) {
|
||||
super(account, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
|
||||
this.userId = userId;
|
||||
this.account = account;
|
||||
this.realName = realName;
|
||||
this.userTel = userTel;
|
||||
this.accountType = accountType;
|
||||
this.sn = sn;
|
||||
this.isManager = isManager;
|
||||
this.enterpriseMainList = enterpriseMainList;
|
||||
// this.engineeringSn = engineeringSn;
|
||||
}
|
||||
|
||||
|
||||
@ -54,18 +54,18 @@ spring.boot.admin.client.instance.name=dev
|
||||
#artemisConfig.host=182.101.141.23:18443
|
||||
#artemisConfig.appKey=24017757
|
||||
#artemisConfig.appSecret=VJz0FbzmE6drPQ7egsBi
|
||||
artemisConfig.host=120.236.122.37:81
|
||||
artemisConfig.appKey=27543152
|
||||
artemisConfig.appSecret=Xyi1y9udD7dGFGsS9d9w
|
||||
#artemisConfig.host=120.236.122.37:81
|
||||
#artemisConfig.appKey=27543152
|
||||
#artemisConfig.appSecret=Xyi1y9udD7dGFGsS9d9w
|
||||
|
||||
#opencv截取视频画面文件地址
|
||||
opencv.filePath=D://opencv//
|
||||
|
||||
#虹软人脸识别
|
||||
arcsoft.appId=13eRvuSeQYts8Tqcrqy4yFyg7h6XQqdUGkjJuh9ct2E2
|
||||
arcsoft.sdkKey=GLc2xHQ7yAwNxrWctSgNgVqwYqMTbz9RKTWWHQNMdJPU
|
||||
arcsoft.linux.sdkKey=
|
||||
arcsoft.dllPath=D:/dll
|
||||
#arcsoft.appId=13eRvuSeQYts8Tqcrqy4yFyg7h6XQqdUGkjJuh9ct2E2
|
||||
#arcsoft.sdkKey=GLc2xHQ7yAwNxrWctSgNgVqwYqMTbz9RKTWWHQNMdJPU
|
||||
#arcsoft.linux.sdkKey=
|
||||
#arcsoft.dllPath=D:/dll
|
||||
|
||||
#配置web页面入口
|
||||
magic-api.resource.location=D://data//magic-api
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user