commit
3af444c6d5
|
|
@ -2,6 +2,7 @@ package com.ruoyi.test.conrtroller;
|
||||||
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.system.service.ISysDeptService;
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -16,27 +17,20 @@ public class GetEcologyInfoTestController extends BaseController {
|
||||||
private ISysUserService userService;
|
private ISysUserService userService;
|
||||||
|
|
||||||
@RequestMapping("/anon/getEcologyDept")
|
@RequestMapping("/anon/getEcologyDept")
|
||||||
public String getEcologyDept() throws Exception {
|
public AjaxResult getEcologyDept() throws Exception {
|
||||||
String url="http://192.168.2.85:90/api/hrm/resful/getHrmdepartmentWithPage";
|
String url="http://192.168.2.85:90/api/hrm/resful/getHrmdepartmentWithPage";
|
||||||
String params="{\"params\":{\"pagesize\":999999}}";
|
String params="{\"params\":{\"pagesize\":999999}}";
|
||||||
//return sendPost(url,params);
|
//return sendPost(url,params);
|
||||||
int result = deptService.syncEcologyDept(url,params);
|
return deptService.syncEcologyDept(url,params);
|
||||||
if(result==200){
|
|
||||||
return "同步成功";
|
|
||||||
}
|
|
||||||
return "同步失败";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/anon/getEcologyUser")
|
@RequestMapping("/anon/getEcologyUser")
|
||||||
public String getEcologyUser(){
|
public AjaxResult getEcologyUser(){
|
||||||
String url="http://192.168.2.85:90/api/hrm/resful/getHrmUserInfoWithPage";
|
String url="http://192.168.2.85:90/api/hrm/resful/getHrmUserInfoWithPage";
|
||||||
String params="{\"params\":{\"pagesize\":999999}}";
|
String params="{\"params\":{\"pagesize\":999999}}";
|
||||||
int result = userService.syncEcologyUser(url,params);
|
return userService.syncEcologyUser(url,params);
|
||||||
if(result==200){
|
|
||||||
return "同步成功";
|
|
||||||
}
|
|
||||||
return "同步失败";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *//*public Map<String,String> sendPostWithRest(String url,String params){
|
/* *//*public Map<String,String> sendPostWithRest(String url,String params){
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
@ -37,6 +39,9 @@ public class SysDeptController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysDeptService deptService;
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ISysConfigService configService;
|
||||||
|
|
||||||
@RequiresPermissions("system:dept:view")
|
@RequiresPermissions("system:dept:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String dept()
|
public String dept()
|
||||||
|
|
@ -212,14 +217,9 @@ public class SysDeptController extends BaseController
|
||||||
@RequiresPermissions("system:dept:sync")
|
@RequiresPermissions("system:dept:sync")
|
||||||
@PostMapping("/syncDept")
|
@PostMapping("/syncDept")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult syncDept()
|
public AjaxResult syncDept() {
|
||||||
{
|
String url = "http://192.168.2.85:90/api/hrm/resful/getHrmdepartmentWithPage";
|
||||||
String url="http://192.168.2.85:90/api/hrm/resful/getHrmdepartmentWithPage";
|
String params = "{\"params\":{\"pagesize\":999999}}";
|
||||||
String params="{\"params\":{\"pagesize\":999999}}";
|
return deptService.syncEcologyDept(url, params);
|
||||||
int result = deptService.syncEcologyDept(url,params);
|
|
||||||
if(result==200){
|
|
||||||
return AjaxResult.success("同步Ecology部门成功,返回状态码:"+result);
|
|
||||||
}
|
|
||||||
return AjaxResult.error("同步Ecology部门失败,返回状态码:"+result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
@ -52,6 +54,9 @@ public class SysUserController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysPasswordService passwordService;
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService configService;
|
||||||
|
|
||||||
@RequiresPermissions("system:user:view")
|
@RequiresPermissions("system:user:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String user()
|
public String user()
|
||||||
|
|
@ -293,14 +298,10 @@ public class SysUserController extends BaseController
|
||||||
@RequiresPermissions("system:user:sync")
|
@RequiresPermissions("system:user:sync")
|
||||||
@PostMapping("/syncUser")
|
@PostMapping("/syncUser")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult syncDept()
|
public AjaxResult syncUser() {
|
||||||
{
|
String url = "http://192.168.2.85:90/api/hrm/resful/getHrmUserInfoWithPage";
|
||||||
String url="http://192.168.2.85:90/api/hrm/resful/getHrmUserInfoWithPage";
|
String params = "{\"params\":{\"pagesize\":999999}}";
|
||||||
String params="{\"params\":{\"pagesize\":999999}}";
|
return userService.syncEcologyUser(url, params);
|
||||||
int result = userService.syncEcologyUser(url,params);
|
|
||||||
if(result==200){
|
|
||||||
return AjaxResult.success("Ecology人员同步成功,返回状态码:"+result);
|
|
||||||
}
|
|
||||||
return AjaxResult.error("Ecology人员同步失败,返回状态码:"+result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="gray-bg">
|
<body class="gray-bg">
|
||||||
<div id="parent" class="col-sm-6">
|
<div id="parent" class="col-sm-4">
|
||||||
<div id="child">
|
<div id="child">
|
||||||
<h3 class="text-primary"> <strong>[[${wordsContent}]]</strong></h3>
|
<h3 class="text-primary"> <strong>[[${wordsContent}]]</strong></h3>
|
||||||
<h5 class="pull-right text-warning">-- 《[[${wordsOrigin}]]》 · [[${wordsAuthor}]]</h5>
|
<h5 class="pull-right text-warning">-- 《[[${wordsOrigin}]]》 · [[${wordsAuthor}]]</h5>
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
<a class="btn btn-success" onclick="addDept()" shiro:hasPermission="system:dept:add" >
|
<a class="btn btn-success" onclick="addDept()" shiro:hasPermission="system:dept:add" >
|
||||||
<i class="fa fa-plus"></i> 新增
|
<i class="fa fa-plus"></i> 新增
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="system:dept:edit">
|
<a class="btn btn-primary" onclick="editDept()" shiro:hasPermission="system:dept:edit">
|
||||||
<i class="fa fa-edit"></i> 修改
|
<i class="fa fa-edit"></i> 修改
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-info" id="expandAllBtn">
|
<a class="btn btn-info" id="expandAllBtn">
|
||||||
|
|
@ -96,6 +96,7 @@
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
visible: showAction(),
|
||||||
formatter: function(value, row, index) {
|
formatter: function(value, row, index) {
|
||||||
if (row.parentId != 0) {
|
if (row.parentId != 0) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
|
|
@ -112,30 +113,44 @@
|
||||||
$.treeTable.init(options);
|
$.treeTable.init(options);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function showAction(){
|
||||||
|
if(deptSyncType == "1"){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function editDept(){
|
||||||
|
if(deptSyncType =="0") {
|
||||||
|
$.operate.edit();
|
||||||
|
}else {
|
||||||
|
alert("已启用同步Ecology部门信息,禁止手动修改部门!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function addDept(){
|
function addDept(){
|
||||||
|
|
||||||
if(deptSyncType =="0") {
|
if(deptSyncType =="0") {
|
||||||
$.operate.add(999999);
|
$.operate.add(999999);
|
||||||
}else {
|
}else {
|
||||||
alert("系统参数已启用同步Ecology部门信息,禁止手动新增部门!")
|
alert("已启用同步Ecology部门信息,禁止手动新增部门!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function syncDept() {
|
function syncDept() {
|
||||||
if(deptSyncType =="1") {
|
/*if(deptSyncType =="1") {*/
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: ctx + "system/dept/syncDept",
|
url: ctx + "system/dept/syncDept",
|
||||||
data: JSON.stringify(""), //beauty是字符串
|
data: JSON.stringify(""),
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (message) {
|
success: function (message) {
|
||||||
alert(JSON.stringify(message)); //将JSON对象转换为字符串
|
alert(JSON.stringify(message)); //将JSON对象转换为字符串
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else {
|
/*}else {
|
||||||
alert("系统参数未启用同步Ecology部门!")
|
alert("系统未启用同步Ecology部门!");
|
||||||
}
|
}*/
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-4 control-label is-required">用户名称:</label>
|
<label class="col-sm-4 control-label is-required">用户名称:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input name="userName" placeholder="请输入用户名称" class="form-control" type="text" maxlength="30" th:field="*{userName}" required>
|
<input id="userName" name="userName" placeholder="请输入用户名称" class="form-control" type="text" maxlength="30" th:field="*{userName}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
<label class="col-sm-4 control-label">手机号码:</label>
|
<label class="col-sm-4 control-label">手机号码:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input name="phonenumber" placeholder="请输入手机号码" class="form-control" type="text" maxlength="11" th:field="*{phonenumber}">
|
<input id="phonenumber" name="phonenumber" placeholder="请输入手机号码" class="form-control" type="text" maxlength="11" th:field="*{phonenumber}">
|
||||||
<span class="input-group-addon"><i class="fa fa-mobile"></i></span>
|
<span class="input-group-addon"><i class="fa fa-mobile"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
<label class="col-sm-4 control-label">邮箱:</label>
|
<label class="col-sm-4 control-label">邮箱:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input name="email" class="form-control email" type="text" maxlength="50" placeholder="请输入邮箱" th:field="*{email}">
|
<input name="email" class="form-control email" type="text" maxlength="50" placeholder="请输入邮箱" th:field="*{email}" id="email">
|
||||||
<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
|
<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -91,7 +91,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-4 control-label">用户性别:</label>
|
<label class="col-sm-4 control-label">用户性别:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<select name="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
|
<select id="sex" name="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
|
||||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{sex}"></option>
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{sex}"></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -133,6 +133,7 @@
|
||||||
<th:block th:include="include :: select2-js" />
|
<th:block th:include="include :: select2-js" />
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var prefix = ctx + "system/user";
|
var prefix = ctx + "system/user";
|
||||||
|
var userType = [[${user.userType}]];
|
||||||
|
|
||||||
$("#form-user-edit").validate({
|
$("#form-user-edit").validate({
|
||||||
onkeyup: false,
|
onkeyup: false,
|
||||||
|
|
@ -202,6 +203,7 @@
|
||||||
|
|
||||||
/* 用户管理-修改-选择部门树 */
|
/* 用户管理-修改-选择部门树 */
|
||||||
function selectDeptTree() {
|
function selectDeptTree() {
|
||||||
|
if(userType !="02") { //如果用户状态为02(从OA同步),则不可选择部门
|
||||||
var deptId = $.common.isEmpty($("#treeId").val()) ? "100" : $("#treeId").val();
|
var deptId = $.common.isEmpty($("#treeId").val()) ? "100" : $("#treeId").val();
|
||||||
var url = ctx + "system/dept/selectDeptTree/" + deptId;
|
var url = ctx + "system/dept/selectDeptTree/" + deptId;
|
||||||
var options = {
|
var options = {
|
||||||
|
|
@ -211,6 +213,7 @@
|
||||||
callBack: doSubmit
|
callBack: doSubmit
|
||||||
};
|
};
|
||||||
$.modal.openOptions(options);
|
$.modal.openOptions(options);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function doSubmit(index, layero){
|
function doSubmit(index, layero){
|
||||||
|
|
@ -226,6 +229,10 @@
|
||||||
placeholder: "请选择岗位",
|
placeholder: "请选择岗位",
|
||||||
allowClear: true
|
allowClear: true
|
||||||
});
|
});
|
||||||
|
//如果用户状态为02(从OA同步),则将相关信息不能做变更
|
||||||
|
if(userType=="02") {
|
||||||
|
$("#email,#userName,#treeName,#phonenumber").attr("readonly", "readonly")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@
|
||||||
var editFlag = [[${@permission.hasPermi('system:user:edit')}]];
|
var editFlag = [[${@permission.hasPermi('system:user:edit')}]];
|
||||||
var removeFlag = [[${@permission.hasPermi('system:user:remove')}]];
|
var removeFlag = [[${@permission.hasPermi('system:user:remove')}]];
|
||||||
var resetPwdFlag = [[${@permission.hasPermi('system:user:resetPwd')}]];
|
var resetPwdFlag = [[${@permission.hasPermi('system:user:resetPwd')}]];
|
||||||
|
var userSyncType = [[${#strings.defaultString(@config.getKey('sys.user.sync'), 0)}]];
|
||||||
var prefix = ctx + "system/user";
|
var prefix = ctx + "system/user";
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
@ -267,6 +268,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function syncUser() {
|
function syncUser() {
|
||||||
|
/*if(userSyncType=="1") {*/
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: ctx + "system/user/syncUser",
|
url: ctx + "system/user/syncUser",
|
||||||
|
|
@ -277,6 +279,9 @@
|
||||||
alert(JSON.stringify(message)); //将JSON对象转换为字符串
|
alert(JSON.stringify(message)); //将JSON对象转换为字符串
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
/*}else {
|
||||||
|
alert("系统未启用同步Ecology部门!");
|
||||||
|
}*/
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.Ztree;
|
import com.ruoyi.common.core.domain.Ztree;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
|
@ -111,5 +113,5 @@ public interface ISysDeptService
|
||||||
/**
|
/**
|
||||||
* Ecology部门信息同步
|
* Ecology部门信息同步
|
||||||
*/
|
*/
|
||||||
public int syncEcologyDept(String url,String params);
|
public AjaxResult syncEcologyDept(String url, String params);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.system.domain.SysUserRole;
|
import com.ruoyi.system.domain.SysUserRole;
|
||||||
|
|
||||||
|
|
@ -208,7 +210,7 @@ public interface ISysUserService
|
||||||
/**
|
/**
|
||||||
* Ecology人员信息同步
|
* Ecology人员信息同步
|
||||||
*/
|
*/
|
||||||
public int syncEcologyUser(String url,String params);
|
public AjaxResult syncEcologyUser(String url, String params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用户列表
|
* 查询用户列表
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,22 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.Ztree;
|
import com.ruoyi.common.core.domain.Ztree;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.common.exception.BusinessException;
|
import com.ruoyi.common.exception.BusinessException;
|
||||||
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.http.HttpUtils;
|
import com.ruoyi.common.utils.http.HttpUtils;
|
||||||
import com.ruoyi.system.domain.EcologyDept;
|
import com.ruoyi.system.domain.EcologyDept;
|
||||||
import com.ruoyi.system.mapper.SysDeptMapper;
|
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import com.ruoyi.system.service.ISysDeptService;
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import com.ruoyi.system.service.IWechatApiService;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -35,6 +41,15 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDeptMapper deptMapper;
|
private SysDeptMapper deptMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService sysconfig;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IWechatApiService wechatApiService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ISysUserService userService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部门管理数据
|
* 查询部门管理数据
|
||||||
*
|
*
|
||||||
|
|
@ -66,7 +81,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
/**
|
/**
|
||||||
* 查询部门管理树(排除下级)
|
* 查询部门管理树(排除下级)
|
||||||
*
|
*
|
||||||
* @param deptId 部门ID
|
* @param dept 部门
|
||||||
* @return 所有部门信息
|
* @return 所有部门信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -320,9 +335,24 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
* Ecology部门信息同步
|
* Ecology部门信息同步
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int syncEcologyDept(String url,String params) {
|
public AjaxResult syncEcologyDept(String url, String params) {
|
||||||
int result= deptSync(HttpUtils.sendPostWithRest(url,params));
|
String msg="同步OA部门失败!";
|
||||||
return result;
|
List<String> userList=new ArrayList<>();
|
||||||
|
userList.add(ShiroUtils.getLoginName().equals("admin")?"359":String.valueOf(ShiroUtils.getUserId()));
|
||||||
|
if( ! sysconfig.selectConfigByKey("sys.dept.sync").equals("1")){
|
||||||
|
msg="OA部门同步失败!系统未开启OA部门同步!";
|
||||||
|
wechatApiService.SendTextMessageToWechatUser(userList,msg);
|
||||||
|
return AjaxResult.success(msg,"false");
|
||||||
|
}
|
||||||
|
int result =deptSync(HttpUtils.sendPostWithRest(url,params));
|
||||||
|
if( result==200)
|
||||||
|
{
|
||||||
|
return AjaxResult.success("OA部门同步成功!",result);
|
||||||
|
}
|
||||||
|
|
||||||
|
wechatApiService.SendTextMessageToWechatUser(userList,msg+"result:"+result);
|
||||||
|
return AjaxResult.error(msg,result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,12 @@ import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.common.exception.BusinessException;
|
import com.ruoyi.common.exception.BusinessException;
|
||||||
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.http.HttpUtils;
|
import com.ruoyi.common.utils.http.HttpUtils;
|
||||||
import com.ruoyi.common.utils.security.Md5Utils;
|
import com.ruoyi.common.utils.security.Md5Utils;
|
||||||
|
|
@ -17,6 +19,7 @@ import com.ruoyi.system.domain.*;
|
||||||
import com.ruoyi.system.mapper.*;
|
import com.ruoyi.system.mapper.*;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import com.ruoyi.system.service.IWechatApiService;
|
||||||
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;
|
||||||
|
|
@ -56,6 +59,9 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysConfigService configService;
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IWechatApiService wechatApiService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据条件分页查询用户列表
|
* 根据条件分页查询用户列表
|
||||||
*
|
*
|
||||||
|
|
@ -535,9 +541,24 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int syncEcologyUser(String url, String params) {
|
public AjaxResult syncEcologyUser(String url, String params) {
|
||||||
|
String msg="OA人员同步失败!";
|
||||||
|
List<String> userList=new ArrayList<>();
|
||||||
|
userList.add(ShiroUtils.getLoginName().equals("admin")?"359":String.valueOf(ShiroUtils.getUserId()));
|
||||||
|
if( ! configService.selectConfigByKey("sys.user.sync").equals("1")){
|
||||||
|
msg="OA人员同步失败!系统未开启OA人员同步!";
|
||||||
|
wechatApiService.SendTextMessageToWechatUser(userList,msg);
|
||||||
|
return AjaxResult.success(msg,"false");
|
||||||
|
}
|
||||||
int result= userSync(HttpUtils.sendPostWithRest(url,params));
|
int result= userSync(HttpUtils.sendPostWithRest(url,params));
|
||||||
return result;
|
if( result==200)
|
||||||
|
{
|
||||||
|
return AjaxResult.success("OA人员同步成功!",result);
|
||||||
|
}
|
||||||
|
|
||||||
|
wechatApiService.SendTextMessageToWechatUser(userList,msg+"result:"+result);
|
||||||
|
return AjaxResult.error(msg,result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -569,10 +590,15 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
List<EcologyUser> ecologyUserList= new Gson().fromJson(dataMap.get("dataList").toString(), new TypeToken<List<EcologyUser>>(){}.getType());
|
List<EcologyUser> ecologyUserList= new Gson().fromJson(dataMap.get("dataList").toString(), new TypeToken<List<EcologyUser>>(){}.getType());
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//获取原同步的用户
|
||||||
|
SysUser oldSysUser=new SysUser();
|
||||||
|
oldSysUser.setUserType("02");
|
||||||
|
List<SysUser> oldSysUserList=userMapper.selectUserLists(oldSysUser);
|
||||||
|
|
||||||
//删除从Ecology同步过来(用户类型为02)的用户
|
//删除从Ecology同步过来(用户类型为02)的用户
|
||||||
userMapper.deleteEcologySyncUser();
|
userMapper.deleteEcologySyncUser();
|
||||||
|
|
||||||
//同步Ecology部门信息
|
//同步Ecology人员信息
|
||||||
SysUser user = new SysUser();
|
SysUser user = new SysUser();
|
||||||
for(EcologyUser ecologyUser:ecologyUserList){
|
for(EcologyUser ecologyUser:ecologyUserList){
|
||||||
if(ecologyUser.getSubcompanyid1().equals("1") && StringUtils.isNotEmpty(ecologyUser.getLoginid())) { //只取分部ID为“1”的员工
|
if(ecologyUser.getSubcompanyid1().equals("1") && StringUtils.isNotEmpty(ecologyUser.getLoginid())) { //只取分部ID为“1”的员工
|
||||||
|
|
@ -593,6 +619,17 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
user.setPhonenumber(ecologyUser.getMobile());
|
user.setPhonenumber(ecologyUser.getMobile());
|
||||||
user.setStatus(ecologyUser.getStatus().equals("5")?"1":"0"); //Ecology为离职状态5,则无效
|
user.setStatus(ecologyUser.getStatus().equals("5")?"1":"0"); //Ecology为离职状态5,则无效
|
||||||
user.setDelFlag("0");
|
user.setDelFlag("0");
|
||||||
|
for(SysUser oldUser:oldSysUserList){
|
||||||
|
if(String.valueOf(oldUser.getUserId()).equals(ecologyUser.getId())){
|
||||||
|
user.setAvatar(oldUser.getAvatar());
|
||||||
|
user.setPassword(oldUser.getPassword());
|
||||||
|
user.setSalt(oldUser.getSalt());
|
||||||
|
user.setLoginDate(oldUser.getLoginDate());
|
||||||
|
user.setLoginIp(oldUser.getLoginIp());
|
||||||
|
user.setPwdUpdateDate(oldUser.getPwdUpdateDate());
|
||||||
|
user.setRemark(oldUser.getRemark());
|
||||||
|
}
|
||||||
|
}
|
||||||
userMapper.insertUser(user);
|
userMapper.insertUser(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue