Commit b274f894 by tangzhaoqian

组织管理-部门树查询、ip获取所在地址、审批bug

parent 3ab28ba2
......@@ -94,7 +94,6 @@ public class LogAspect
// 获取当前的用户
// LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
QyzxEmpLogin eld = (QyzxEmpLogin)session.getAttribute("ui");
System.out.println(eld);
// *========数据库日志=========*//
QyzxOperLog operLog = new QyzxOperLog();
......@@ -110,7 +109,7 @@ public class LogAspect
operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
if (eld != null)
{
operLog.setOperName(eld.getUsername());
operLog.setOperName(eld.getYgglMainEmp().getName());
}
if (e != null)
......
......@@ -2,6 +2,7 @@ package cn.timer.api.controller.zzgl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.transaction.Transactional;
......@@ -24,6 +25,7 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNodeConfig;
......@@ -91,7 +93,7 @@ public class ZzglController {
}
/**
* 架构树/架构图/导出
* 获取部门岗位-升级版
*
* @param
* @return
......@@ -99,7 +101,7 @@ public class ZzglController {
@GetMapping(value = "/deptlist_plus")
@ApiOperation(value = "1.获取部门岗位-升级版", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 1)
public Result<List<Tree<String>>> selectlistdept2(@CurrentUser UserBean userBean) {
public Result<List<Tree<String>>> deptlistPlus(@CurrentUser UserBean userBean) {
Integer orgCode = userBean.getOrgCode();
List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.eq(ZzglBmgwM::getOrgCode, orgCode).list();
......@@ -134,6 +136,49 @@ public class ZzglController {
return ResultUtil.data(treeNodes);
}
/**
* 获取部门
*
* @param
* @return
*/
@GetMapping(value = "/depts_tree")
@ApiOperation(value = "2.获取部门", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 1)
public Result<List<Tree<String>>> deptsOnlyone(@CurrentUser UserBean userBean) {
Integer orgCode = userBean.getOrgCode();
List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.eq(ZzglBmgwM::getOrgCode, orgCode).list();
if (CollectionUtil.isNotEmpty(zzglBmgwMs)) {
zzglBmgwMs = zzglBmgwMs.stream().filter(z -> z.getType() == 0).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(zzglBmgwMs)) {
//配置
TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
// 自定义属性名 都要默认值的
treeNodeConfig.setIdKey("id");
treeNodeConfig.setParentIdKey("upId");
//转换器
List<Tree<String>> treeNodes = TreeUtil.build(zzglBmgwMs, "0", treeNodeConfig,
(treeNode, tree) -> {
tree.setId(Convert.toStr(treeNode.getId()));
tree.setParentId(Convert.toStr(treeNode.getUpId()));
tree.setName(treeNode.getName());
// 扩展属性 ...
tree.putExtra("leader", treeNode.getLeader());
tree.putExtra("type", treeNode.getType());
});
return ResultUtil.data(treeNodes);
}
}
return ResultUtil.success();
}
@GetMapping(value = "/depts")
@ApiOperation(value = "2.获取部门", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 2)
......
package cn.timer.api.utils;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSONObject;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
/**
* 获取地址类
......@@ -15,17 +20,29 @@ public class AddressUtils
{
private static final Logger log = LoggerFactory.getLogger(AddressUtils.class);
public static final String IP_URL = "http://ip.taobao.com/service/getIpInfo.php";
public static final String IP_URL = "http://ip.taobao.com/outGetIpInfo";
public static Map<String, Object> PARAM_MAP = new HashMap<String, Object>();
static {
PARAM_MAP.put("accessKey", "alibaba-inc");
}
public static String getRealAddressByIP(String ip)
{
PARAM_MAP.put("ip", ip);
String address = "XX XX";
// 内网不查询
if (UserIp.internalIp(ip))
{
return "内网IP";
}
String rspStr = HttpUtils.sendPost(IP_URL, "ip=" + ip);
//链式构建请求
String rspStr = HttpRequest.post(IP_URL)
.header(Header.USER_AGENT, "Hutool http")//头信息,多个头信息多次调用此方法即可
.form(PARAM_MAP)//表单内容
.timeout(20000)//超时,毫秒
.execute().body();
if (StrUtil.isEmpty(rspStr))
{
log.error("获取地理位置异常 {}", ip);
......
......@@ -351,6 +351,7 @@ public class UserIp {
return macAddress;
}
}
......@@ -126,7 +126,7 @@ public class RouterUtils {
case UNEXECUTED:
listUser.get(i).setExecute(EXECUTING);
// 首次发起申请时,写入 审批人名称 至 obj 中
if (isFirse && obj.getStr("current_approver") != null ) {
if (isFirse && obj.getStr("current_approver") == null ) {
obj.set("current_approver", listUser.get(i).getName());
}
......
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