Commit 802ebbb2 authored by 赵啸非's avatar 赵啸非

添加前端打包文件

parent b5b33213
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
<el-dropdown @command="handleCommand"> <el-dropdown @command="handleCommand">
<span class="el-dropdown-link" style="color:white"> <span class="el-dropdown-link" style="color:white">
{{userData.currUserName}} {{userData.currUserName}}
<i class="el-icon-arrow-down el-icon--right"></i> <!-- <i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
</span> </span>
<el-dropdown-menu slot="dropdown"> <!-- <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="update">修改密码</el-dropdown-item> <el-dropdown-item command="update">修改密码</el-dropdown-item>
<el-dropdown-item command="logout">退出登录</el-dropdown-item> <el-dropdown-item command="logout">退出登录</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>-->
</el-dropdown> </el-dropdown>
</div> </div>
</div> </div>
......
...@@ -5,13 +5,29 @@ ...@@ -5,13 +5,29 @@
</template> </template>
<script> <script>
import jwt_decode from "jwt-decode";
export default { export default {
name: 'sso',
created () {
},
mounted() { mounted() {
let token = this.$route.query.token let token = this.$route.query.token
console.log("token:"+token) console.log("token:"+token)
if(token ) { console.log("解析后的token:",jwt_decode(token))
window.sessionStorage.setItem("token", token); //const decode = jwt_decode(data.normal_login_token).accountId; // 解析
this.$router.push('/index') // 有token直接跳转首页 if(token) {
//本地登录后跳转
this.form.loginName=jwt_decode(token).userInfo.account
this.form.password=jwt_decode(token).userInfo.password
/* this.form.loginName="admin"
this.form.password="scsmile"*/
this.login()
//window.sessionStorage.setItem("token", token);
// this.$router.push('/index') // 有token直接跳转首页
}else{ }else{
this.$message({ this.$message({
message: '没有权限,正在跳转登录页面...', message: '没有权限,正在跳转登录页面...',
...@@ -22,6 +38,37 @@ export default { ...@@ -22,6 +38,37 @@ export default {
//this.$router.push('/login') //this.$router.push('/login')
},1000) },1000)
} }
},
methods: {
login() {
this.loading = true;
this.$post("/login/login", this.form)
.then(this.loginSuccess)
.catch(this.loginFail);
},
loginSuccess({ data }) {
console.log("userData", data);
this.$store.commit("setUserData", data);
this.$router.push('/index') // 有token直接跳转首页
/* this.$router.replace({
path: this.redirect,
});*/
},
loginFail(error) {
this.loading = false;
this.$message.error(error.message);
},
},
data() {
return {
form: {
loginName: '',
password: '',
securityCode: '',
},
redirect: this.$route.query.redirect,
loading: true,
}
} }
} }
</script> </script>
...@@ -31,4 +78,4 @@ export default { ...@@ -31,4 +78,4 @@ export default {
width: 300px; width: 300px;
height: 100px; height: 100px;
} }
</style> </style>
\ No newline at end of file
...@@ -109,6 +109,7 @@ export default { ...@@ -109,6 +109,7 @@ export default {
}, },
loginSuccess({ data }) { loginSuccess({ data }) {
console.log("userData", data); console.log("userData", data);
console.log("redirect",this.redirect)
this.$store.commit("setUserData", data); this.$store.commit("setUserData", data);
this.$router.replace({ this.$router.replace({
path: this.redirect, path: this.redirect,
......
...@@ -2,3 +2,7 @@ ...@@ -2,3 +2,7 @@
# yarn lockfile v1 # yarn lockfile v1
"jwt-decode@^3.1.2":
"integrity" "sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A=="
"resolved" "https://registry.npmmirror.com/jwt-decode/-/jwt-decode-3.1.2.tgz"
"version" "3.1.2"
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<profiles.server.port>17300</profiles.server.port> <profiles.server.port>17300</profiles.server.port>
<profiles.server.gatewayport>11078</profiles.server.gatewayport> <profiles.server.gatewayport>11078</profiles.server.gatewayport>
<profiles.server.path>/study</profiles.server.path> <profiles.server.path>/study</profiles.server.path>
<profiles.nacos.server-addr>192.168.0.62:8848</profiles.nacos.server-addr> <profiles.nacos.server-addr>192.168.0.54:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group> <profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov-cs</profiles.nacos.namespace> <profiles.nacos.namespace>smart-gov-cs</profiles.nacos.namespace>
<profiles.log.path>/mortals/app/logs</profiles.log.path> <profiles.log.path>/mortals/app/logs</profiles.log.path>
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
package com.mortals.xhx.base.system.task.service; package com.mortals.xhx.base.system.task.service;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.base.system.task.model.TaskEntity; import com.mortals.xhx.base.system.task.model.TaskEntity;
...@@ -22,7 +21,7 @@ import com.mortals.xhx.base.system.task.model.TaskEntity; ...@@ -22,7 +21,7 @@ import com.mortals.xhx.base.system.task.model.TaskEntity;
* @version 1.0.0 * @version 1.0.0
*/ */
public interface TaskService extends ICRUDCacheService<TaskEntity,Long> { public interface TaskService extends ICRUDService<TaskEntity,Long> {
boolean doForceUpdateTaskLock(TaskEntity task); boolean doForceUpdateTaskLock(TaskEntity task);
boolean doForceUpdateTaskUnLock(TaskEntity task); boolean doForceUpdateTaskUnLock(TaskEntity task);
......
...@@ -4,21 +4,6 @@ ...@@ -4,21 +4,6 @@
package com.mortals.xhx.base.system.task.service.impl; package com.mortals.xhx.base.system.task.service.impl;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
import cn.hutool.core.net.NetUtil;
import cn.hutool.core.thread.ThreadUtil;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.ap.GlobalSysInfo; import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.code.ExcuteStatus; import com.mortals.framework.common.code.ExcuteStatus;
import com.mortals.framework.common.code.TaskExcuteStrategy; import com.mortals.framework.common.code.TaskExcuteStrategy;
...@@ -34,7 +19,12 @@ import com.mortals.xhx.base.system.task.dao.TaskDao; ...@@ -34,7 +19,12 @@ import com.mortals.xhx.base.system.task.dao.TaskDao;
import com.mortals.xhx.base.system.task.model.TaskEntity; import com.mortals.xhx.base.system.task.model.TaskEntity;
import com.mortals.xhx.base.system.task.model.TaskQuery; import com.mortals.xhx.base.system.task.model.TaskQuery;
import com.mortals.xhx.base.system.task.service.TaskService; import com.mortals.xhx.base.system.task.service.TaskService;
import org.springframework.util.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* <p> * <p>
...@@ -54,13 +44,11 @@ import org.springframework.util.ObjectUtils; ...@@ -54,13 +44,11 @@ import org.springframework.util.ObjectUtils;
* @version 1.0.0 * @version 1.0.0
*/ */
@Service("taskService") @Service("taskService")
public class TaskServiceImpl extends AbstractCRUDCacheServiceImpl<TaskDao, TaskEntity, Long> public class TaskServiceImpl extends AbstractCRUDServiceImpl<TaskDao, TaskEntity, Long>
implements TaskService, IApplicationStartedService {// implements TaskService, IApplicationStartedService {//
private boolean isStop = false; private boolean isStop = false;
/** /** 休眠时间 */
* 休眠时间
*/
private long sleepTime = 1000; private long sleepTime = 1000;
private boolean isUnlockSuccess = true; private boolean isUnlockSuccess = true;
...@@ -68,98 +56,53 @@ public class TaskServiceImpl extends AbstractCRUDCacheServiceImpl<TaskDao, TaskE ...@@ -68,98 +56,53 @@ public class TaskServiceImpl extends AbstractCRUDCacheServiceImpl<TaskDao, TaskE
private TaskEntity prevTask = null; private TaskEntity prevTask = null;
private Thread thread = null; private Thread thread = null;
/** /** 日志打印时间,key:任务ID,value:最后一次打印日志时间 */
* 日志打印时间,key:任务ID,value:最后一次打印日志时间
*/
private Map<Long, Long> printLogTime = new HashMap<>(); private Map<Long, Long> printLogTime = new HashMap<>();
@Autowired(required = false) @Autowired(required=false)
private TaskService taskService; private TaskService taskService;
//加锁
public boolean doForceUpdateTaskLock(TaskEntity task) throws AppException { public boolean doForceUpdateTaskLock(TaskEntity task) throws AppException {
int ret=0;
if (task == null) { if (task == null) {
return false; return false;
} }
TaskEntity condition = new TaskEntity(); Map<String, Object> data = new HashMap<String, Object>();
condition.setStatus(ExcuteStatus.WAIT_RUN.getValue()); data.put("status", ExcuteStatus.RUNNING.getValue());
condition.setId(task.getId()); data.put("lastExcuteHost", task.getLastExcuteHost());
Map<String, Object> condition = new HashMap<String, Object>();
List<TaskEntity> taskEntities = taskService.find(condition); condition.put("status", ExcuteStatus.WAIT_RUN.getValue());
if(!ObjectUtils.isEmpty(taskEntities)){ condition.put("id", task.getId());
for (TaskEntity data : taskEntities) { int ret = dao.update(data, condition);
data.setStatus(ExcuteStatus.RUNNING.getValue());
data.setLastExcuteHost(task.getLastExcuteHost());
this.update(data,null);
}
}
return ret > 0 ? true : false; return ret > 0 ? true : false;
} }
//解锁
public boolean doForceUpdateTaskUnLock(TaskEntity task) throws AppException { public boolean doForceUpdateTaskUnLock(TaskEntity task) throws AppException {
int ret = 0; int ret = 0;
if (task.getInterimExcuteStatus() == TaskInterimExcuteStatus.IMMEDIATE_EXECUTION_BEFORE_DELETE.getValue()) { if (task.getInterimExcuteStatus() == TaskInterimExcuteStatus.IMMEDIATE_EXECUTION_BEFORE_DELETE.getValue()) {
//ret = dao.re(task.getId()); ret = dao.delete(task.getId());
ret = this.remove(task.getId(), null);
} else { } else {
TaskEntity condition = new TaskEntity(); Map<String, Object> data = new HashMap<String, Object>();
condition.setStatus(ExcuteStatus.RUNNING.getValue()); data.put("status", ExcuteStatus.WAIT_RUN.getValue());
condition.setId(task.getId()); data.put("interimExcuteStatus", TaskInterimExcuteStatus.UNUSE.getValue());
if (task.getLastExcuteTime() != null) {
List<TaskEntity> taskEntities = this.find(condition); data.put("lastExcuteTime", task.getLastExcuteTime());
if(!ObjectUtils.isEmpty(taskEntities)){
for (TaskEntity data : taskEntities) {
data.setStatus(ExcuteStatus.WAIT_RUN.getValue());
data.setInterimExcuteStatus(TaskInterimExcuteStatus.UNUSE.getValue());
if (task.getLastExcuteTime() != null) {
data.setLastExcuteTime(task.getLastExcuteTime());
}
this.update(data);
}
} }
Map<String, Object> condition = new HashMap<String, Object>();
condition.put("status", ExcuteStatus.RUNNING.getValue());
condition.put("id", task.getId());
ret = this.dao.update(data, condition);
} }
return ret > 0 ? true : false; return ret > 0 ? true : false;
} }
public boolean doForceUpdateTaskUnLock(String excuteHost) throws AppException { public boolean doForceUpdateTaskUnLock(String excuteHost) throws AppException {
int ret =0;
if (StringUtils.isEmpty(excuteHost)) { if (StringUtils.isEmpty(excuteHost)) {
return false; return false;
} }
Map<String, Object> data = new HashMap<String, Object>();
TaskEntity condition = new TaskEntity();
condition.setLastExcuteHost(excuteHost);
List<TaskEntity> taskEntities = this.find(condition);
if(!ObjectUtils.isEmpty(taskEntities)){
for (TaskEntity taskEntity : taskEntities) {
taskEntity.setStatus(ExcuteStatus.WAIT_RUN.getValue());
this.update(taskEntity);
}
}
/* TaskEntity condition = new TaskEntity();
condition.setLastExcuteHost(excuteHost);
List<TaskEntity> taskEntities = this.find(condition);
for (TaskEntity taskEntity : taskEntities) {
taskEntity.setStatus(ExcuteStatus.WAIT_RUN.getValue());
}
int ret = this.update(taskEntities);*/
// TaskEntity data = new TaskEntity();
// data.setStatus(ExcuteStatus.WAIT_RUN.getValue());
//
// TaskEntity condition = new TaskEntity();
// condition.setLastExcuteHost(excuteHost);
/* Map<String, Object> data = new HashMap<String, Object>();
data.put("status", ExcuteStatus.WAIT_RUN.getValue()); data.put("status", ExcuteStatus.WAIT_RUN.getValue());
Map<String, Object> condition = new HashMap<String, Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("lastExcuteHost", excuteHost); condition.put("lastExcuteHost", excuteHost);
int ret = this.getDao().update(data, condition);*/ int ret = this.dao.update(data, condition);
return ret > 0 ? true : false; return ret > 0 ? true : false;
} }
...@@ -205,7 +148,7 @@ public class TaskServiceImpl extends AbstractCRUDCacheServiceImpl<TaskDao, TaskE ...@@ -205,7 +148,7 @@ public class TaskServiceImpl extends AbstractCRUDCacheServiceImpl<TaskDao, TaskE
@Override @Override
public void start() throws AppException { public void start() throws AppException {
final String localIp = NetUtil.getLocalhostStr(); final String localIp = SystemUtil.getLocalHostIp();
log.info("任务执行线程启动...-->" + localIp); log.info("任务执行线程启动...-->" + localIp);
thread = new Thread(() -> { thread = new Thread(() -> {
// 将本机上次执行而未完成的任务状态变更 // 将本机上次执行而未完成的任务状态变更
...@@ -218,7 +161,6 @@ public class TaskServiceImpl extends AbstractCRUDCacheServiceImpl<TaskDao, TaskE ...@@ -218,7 +161,6 @@ public class TaskServiceImpl extends AbstractCRUDCacheServiceImpl<TaskDao, TaskE
ExecutorService executorService = Executors.newFixedThreadPool(threadSize); ExecutorService executorService = Executors.newFixedThreadPool(threadSize);
while (!isStop) { while (!isStop) {
if (!isUnlockSuccess && prevTask != null) { if (!isUnlockSuccess && prevTask != null) {
log.info("doForceUpdateTaskUnLock=====");
try { try {
taskService.doForceUpdateTaskUnLock(prevTask); taskService.doForceUpdateTaskUnLock(prevTask);
isUnlockSuccess = true; isUnlockSuccess = true;
...@@ -246,9 +188,7 @@ public class TaskServiceImpl extends AbstractCRUDCacheServiceImpl<TaskDao, TaskE ...@@ -246,9 +188,7 @@ public class TaskServiceImpl extends AbstractCRUDCacheServiceImpl<TaskDao, TaskE
try { try {
TaskQuery params = new TaskQuery(); TaskQuery params = new TaskQuery();
params.setStatus(ExcuteStatus.WAIT_RUN.getValue()); params.setStatus(ExcuteStatus.WAIT_RUN.getValue());
//修改为redis 缓存 List<TaskEntity> taskList = find(params, null);
List<TaskEntity> taskList = this.getCacheList().stream().filter(f -> ExcuteStatus.WAIT_RUN.getValue() == f.getStatus()).collect(Collectors.toList());
//List<TaskEntity> taskList = find(params, null);
if (taskList != null && taskList.size() > 0) { if (taskList != null && taskList.size() > 0) {
final Date currDateTime = cal.getTime(); final Date currDateTime = cal.getTime();
String currDateTimeStr = DateUtils.getDateTime(currDateTime, "yyyyMMddHHmm"); String currDateTimeStr = DateUtils.getDateTime(currDateTime, "yyyyMMddHHmm");
......
...@@ -118,4 +118,6 @@ public interface UserService extends ICRUDService<UserEntity,Long> { ...@@ -118,4 +118,6 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
UserDao getUserDao(); UserDao getUserDao();
void doHandlerUser(UserEntity entity);
} }
\ No newline at end of file
...@@ -50,18 +50,14 @@ import java.util.stream.Collectors; ...@@ -50,18 +50,14 @@ import java.util.stream.Collectors;
*/ */
@Service("userService") @Service("userService")
public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity, Long> implements UserService { public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity, Long> implements UserService {
@Autowired @Autowired
private MenuService menuService; private MenuService menuService;
@Autowired @Autowired
private ResourceService resourceService; private ResourceService resourceService;
@Autowired @Autowired
private RoleService roleService;
@Autowired
private RoleUserService roleUserService; private RoleUserService roleUserService;
@Override
private void doHandlerUser(UserEntity entity) throws AppException { public void doHandlerUser(UserEntity entity) throws AppException {
if (StringUtils.isNotEmpty(entity.getLoginPwd())) { if (StringUtils.isNotEmpty(entity.getLoginPwd())) {
try { try {
entity.setLoginPwd(SecurityUtil.md5DoubleEncoding(entity.getLoginPwd())); entity.setLoginPwd(SecurityUtil.md5DoubleEncoding(entity.getLoginPwd()));
......
...@@ -13,7 +13,9 @@ public class CustomerInfoPdu { ...@@ -13,7 +13,9 @@ public class CustomerInfoPdu {
private String user_name; private String user_name;
private String account; private String account;
private String password; private String password;
private Integer userType; private Integer type;
private String mobile; private String mobile;
} }
...@@ -13,9 +13,14 @@ import com.mortals.xhx.base.system.user.model.UserEntity; ...@@ -13,9 +13,14 @@ import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery; import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService; import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.busiz.rsp.ApiResp; import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.common.code.UserType;
import com.mortals.xhx.common.key.ParamKey; import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.common.pdu.CustomerInfoPdu; import com.mortals.xhx.common.pdu.CustomerInfoPdu;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -24,6 +29,7 @@ import java.util.*; ...@@ -24,6 +29,7 @@ import java.util.*;
/** /**
* 用户同步 * 用户同步
*
* @author: * @author:
* @date: 2023/3/6 13:46 * @date: 2023/3/6 13:46
*/ */
...@@ -35,6 +41,8 @@ public class UserSyncTaskImpl implements ITaskExcuteService { ...@@ -35,6 +41,8 @@ public class UserSyncTaskImpl implements ITaskExcuteService {
private UserService userService; private UserService userService;
@Autowired @Autowired
private RoleUserService roleUserService; private RoleUserService roleUserService;
@Autowired
private DeptService deptService;
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
...@@ -47,40 +55,66 @@ public class UserSyncTaskImpl implements ITaskExcuteService { ...@@ -47,40 +55,66 @@ public class UserSyncTaskImpl implements ITaskExcuteService {
* 用户同步 * 用户同步
*/ */
private void syncUser() { private void syncUser() {
String url = GlobalSysInfo.getParamValue(ParamKey.SYS_PARAM_USER_URL, "http://127.0.0.1:8076/doors/inter/user/userList"); String url = GlobalSysInfo.getParamValue(ParamKey.SYS_PARAM_USER_URL, "http://192.168.0.231:8076/doors/inter/user/userList");
Map<String, String> headers = new HashMap<>(); Map<String, String> headers = new HashMap<>();
try { try {
String resp = HttpUtil.doGet(url, headers); String resp = HttpUtil.doGet(url, headers);
ApiResp<List<CustomerInfoPdu>> apiResp = JSON.parseObject(resp, new TypeReference<ApiResp<List<CustomerInfoPdu>>>() { ApiResp<List<CustomerInfoPdu>> apiResp = JSON.parseObject(resp, new TypeReference<ApiResp<List<CustomerInfoPdu>>>() {
}); });
if(apiResp.getCode()==0){ if (apiResp.getCode() == 0) {
apiResp.getData().stream().forEach(user->{ for (CustomerInfoPdu user : apiResp.getData()) {
//查询用户是否存在 if("admin".equalsIgnoreCase(user.getAccount())){
//更新超级管理员
UserEntity userEntity = userService.get(1L);
userEntity.setLoginName(user.getAccount());
userEntity.setRealName(user.getUser_name());
userEntity.setMobile(user.getMobile());
userEntity.setUserType(UserType.SYSTEM.getValue());
userEntity.setLoginPwd(user.getPassword());
userEntity.setUpdateUserId(1L);
userEntity.setUpdateTime(new Date());
updateDefaultDept(userEntity);
userService.doHandlerUser(userEntity);
userService.getUserDao().update(userEntity);
// userService.update(userEntity);
continue;
}
//查询用户是否存在,登录用户名唯一
UserQuery userQuery = new UserQuery(); UserQuery userQuery = new UserQuery();
userQuery.id(user.getId()); //userQuery.id(user.getId());
userQuery.setLoginName(user.getAccount()); userQuery.setLoginName(user.getAccount());
UserEntity userEntity = userService.selectOne(userQuery); UserEntity userEntity = userService.selectOne(userQuery);
if(!ObjectUtils.isEmpty(userEntity)){ if (!ObjectUtils.isEmpty(userEntity)) {
// userEntity.setCustomerId(user.getId()); updateDefaultDept(userEntity);
userEntity.setLoginName(user.getAccount()); userEntity.setLoginName(user.getAccount());
userEntity.setRealName(user.getUser_name()); userEntity.setRealName(user.getUser_name());
userEntity.setMobile(user.getMobile()); userEntity.setMobile(user.getMobile());
userEntity.setUserType(user.getUserType()); userEntity.setUserType(user.getType());
userEntity.setLoginPwd(user.getPassword()); userEntity.setLoginPwd(user.getPassword());
userEntity.setUpdateUserId(1L); userEntity.setUpdateUserId(1L);
userEntity.setUpdateTime(new Date()); userEntity.setUpdateTime(new Date());
userService.update(userEntity); userService.update(userEntity);
}else { } else {
//新增用户 //新增用户
userEntity = userService.createUser(null, user.getId(), "", user.getAccount(), user.getPassword(), user.getUser_name(), user.getMobile()); userEntity = userService.createUser(null, user.getId(), "", user.getAccount(), user.getPassword(), user.getUser_name(), user.getMobile());
//根据用户类型添加默认访问权限 if(UserType.WORK.getValue()==user.getType()){
RoleUserQuery roleUserQuery = new RoleUserQuery(); //根据用户类型添加默认访问权限
roleUserQuery.setUserId(userEntity.getId()); RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setRoleIdList(Arrays.asList(new Long[]{1L})); roleUserQuery.setUserId(userEntity.getId());
roleUserService.doDistributionRole(roleUserQuery); roleUserQuery.setRoleIdList(Arrays.asList(new Long[]{3L}));
roleUserService.doDistributionRole(roleUserQuery);
}else if (UserType.WORK_PERSON.getValue()==user.getType()){
//根据用户类型添加默认访问权限
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(userEntity.getId());
roleUserQuery.setRoleIdList(Arrays.asList(new Long[]{2L}));
roleUserService.doDistributionRole(roleUserQuery);
}
} }
}); }
} }
log.debug("user resp:{}", JSON.toJSONString(apiResp)); log.debug("user resp:{}", JSON.toJSONString(apiResp));
} catch (Exception e) { } catch (Exception e) {
...@@ -88,6 +122,17 @@ public class UserSyncTaskImpl implements ITaskExcuteService { ...@@ -88,6 +122,17 @@ public class UserSyncTaskImpl implements ITaskExcuteService {
} }
} }
private void updateDefaultDept(UserEntity userEntity) {
if(ObjectUtils.isEmpty(userEntity.getDeptId())){
//没有部门 默认添加一个
DeptEntity deptEntity = deptService.selectOne(new DeptQuery());
if(!ObjectUtils.isEmpty(deptEntity)){
userEntity.setDeptId(deptEntity.getId());
userEntity.setDeptName(deptEntity.getDeptName());
}
}
}
@Override @Override
public void stopTask(ITask task) throws AppException { public void stopTask(ITask task) throws AppException {
......
...@@ -8,7 +8,7 @@ spring: ...@@ -8,7 +8,7 @@ spring:
application: application:
name: study-manager name: study-manager
profiles: profiles:
active: test active: develop
servlet: servlet:
multipart: multipart:
max-file-size: 100MB max-file-size: 100MB
...@@ -23,9 +23,9 @@ spring: ...@@ -23,9 +23,9 @@ spring:
nacos: nacos:
# Nacos 作为注册中心的配置项,对应 NacosDiscoveryProperties 配置类 # Nacos 作为注册中心的配置项,对应 NacosDiscoveryProperties 配置类
discovery: discovery:
server-addr: 192.168.0.252:8848 # Nacos 服务器地址 server-addr: 192.168.0.54:8848 # Nacos 服务器地址
group: DEFAULT_GROUP group: DEFAULT_GROUP
namespace: smart-gov-chuanshan namespace: smart-gov-cs
config: config:
server-addr: ${spring.cloud.nacos.discovery.server-addr} # Nacos 服务器地址 server-addr: ${spring.cloud.nacos.discovery.server-addr} # Nacos 服务器地址
group: ${spring.cloud.nacos.discovery.group} group: ${spring.cloud.nacos.discovery.group}
......
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