Merge pull request '组织架构图V3' (#164) from feature/cl into develop
Reviewed-on: http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization/pulls/164
This commit is contained in:
commit
5b320e874b
|
|
@ -2,12 +2,7 @@ package com.api.organization.web;
|
|||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @className: OrgChartController
|
||||
* @author: dengjp
|
||||
* @date: 2022/7/7
|
||||
* @description: 组织架构图
|
||||
**/
|
||||
|
||||
@Path("/bs/hrmorganization/orgchart")
|
||||
public class OrgChartController extends com.engine.organization.web.OrgChartController {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,16 +11,60 @@ import java.util.Map;
|
|||
* @description: 组织架构图Service
|
||||
**/
|
||||
public interface OrgChartService {
|
||||
|
||||
/**
|
||||
* @Description: 高级搜索
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2023/6/26 3:18 PM
|
||||
* @param: [request2Map, user]
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
*/
|
||||
Map<String, Object> getOptionCondition(Map<String, Object> request2Map, User user);
|
||||
|
||||
/**
|
||||
* @Description: 组织架构图
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2023/6/26 3:19 PM
|
||||
* @param: [request2Map, user]
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
*/
|
||||
Map<String, Object> getCompanyData(Map<String, Object> request2Map, User user);
|
||||
|
||||
/**
|
||||
* @Description: 组织透视图
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2023/6/26 3:20 PM
|
||||
* @param: [request2Map, user]
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
*/
|
||||
Map<String, Object> getUserData(Map<String, Object> request2Map, User user);
|
||||
|
||||
/**
|
||||
* @Description: 异步获取
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2023/6/26 3:21 PM
|
||||
* @param: [request2Map, user]
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
*/
|
||||
Map<String, Object> asyncUserData(Map<String, Object> request2Map, User user);
|
||||
|
||||
/**
|
||||
* @Description: 异步获取
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2023/6/26 3:21 PM
|
||||
* @param: [request2Map, user]
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
*/
|
||||
Map<String, Object> asyncCompanyData(Map<String, Object> request2Map, User user);
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 同步数据
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2023/6/26 3:22 PM
|
||||
* @param: [request2Map, user]
|
||||
* @return: java.lang.String
|
||||
*/
|
||||
String synchronousData(Map<String, Object> request2Map, User user);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,15 +42,17 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
public Map<String, Object> getOptionCondition(Map<String, Object> request2Map, User user) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
rs.executeQuery("select id, companyname from HrmCompanyVirtual order by id");
|
||||
List<Map<String, Object>> fclasslist = new ArrayList<>();
|
||||
Map<String, Object> defaultItem = new HashMap<>();
|
||||
int fkey = 0;
|
||||
defaultItem.put("key",fkey++);
|
||||
defaultItem.put("id", "0");
|
||||
defaultItem.put("companyname", "行政维度");
|
||||
fclasslist.add(defaultItem);
|
||||
while (rs.next()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("key",fkey++);
|
||||
item.put("id", rs.getString("id"));
|
||||
item.put("companyname", rs.getString("companyname"));
|
||||
fclasslist.add(item);
|
||||
|
|
@ -69,8 +71,10 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
}
|
||||
rs.executeQuery(sql + " and fdateend > " + DBType.get(new RecordSet().getDBType()).currentDate() + " order by ftype , id,fdateend desc ");
|
||||
Set<OrgSelectItem> companySet = new HashSet<>();
|
||||
int ckey = 0;
|
||||
while (rs.next()) {
|
||||
OrgSelectItem item = new OrgSelectItem();
|
||||
item.setKey(ckey++);
|
||||
item.setId(rs.getString("id"));
|
||||
item.setFnumber(rs.getString("fnumber"));
|
||||
item.setFname(rs.getString("fname"));
|
||||
|
|
@ -83,15 +87,12 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
}
|
||||
|
||||
private String companyDateWhereSql(Map<String, Object> request2Map) {
|
||||
String date = (String) request2Map.get("date"); // 数据日期
|
||||
String date = (String) request2Map.get("date");
|
||||
if (StringUtils.isBlank(date)) {
|
||||
date = DateUtil.format(DateUtil.offset(new Date(), DateField.DAY_OF_MONTH, 1), "yyyy-MM-dd");
|
||||
}
|
||||
|
||||
String fclass = (String) request2Map.get("fclass"); // 维度
|
||||
|
||||
|
||||
String fisvitual = (String) request2Map.get("fisvitual"); // 是否显示虚拟组织
|
||||
String fclass = (String) request2Map.get("fclass");
|
||||
String fisvitual = (String) request2Map.get("fisvitual");
|
||||
if (StringUtils.isBlank(fisvitual)) {
|
||||
fisvitual = "0";
|
||||
}
|
||||
|
|
@ -123,15 +124,15 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
return result;
|
||||
}
|
||||
|
||||
String root = (String) request2Map.get("root"); // 根节点
|
||||
String level = (String) request2Map.get("level"); // 显示层级
|
||||
String root = (String) request2Map.get("root");
|
||||
String level = (String) request2Map.get("level");
|
||||
if (StringUtils.isBlank(level)) {
|
||||
level = "3";
|
||||
}
|
||||
String whereSql = companyDateWhereSql(request2Map);
|
||||
|
||||
String whereItemSql = " ";
|
||||
if ("0".equals(root)) { // 集团的情况
|
||||
if ("0".equals(root)) {
|
||||
whereItemSql += " and ftype = 0 ";
|
||||
} else {
|
||||
whereItemSql += " and id = '" + root + "' ";
|
||||
|
|
@ -211,14 +212,14 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
}
|
||||
|
||||
private String userWhereSql(Map<String, Object> request2Map) {
|
||||
String date = (String) request2Map.get("date"); // 数据日期
|
||||
String date = (String) request2Map.get("date");
|
||||
if (StringUtils.isBlank(date)) {
|
||||
date = DateUtil.format(DateUtil.offset(new Date(), DateField.DAY_OF_MONTH, 1), "yyyy-MM-dd");
|
||||
}
|
||||
|
||||
String fclass = (String) request2Map.get("fclass"); // 维度
|
||||
String fclass = (String) request2Map.get("fclass");
|
||||
|
||||
String fisvitual = (String) request2Map.get("fisvitual"); // 是否显示虚拟组织
|
||||
String fisvitual = (String) request2Map.get("fisvitual");
|
||||
if (StringUtils.isBlank(fisvitual)) {
|
||||
fisvitual = "0";
|
||||
}
|
||||
|
|
@ -247,8 +248,8 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
if (!hasRight) {
|
||||
return result;
|
||||
}
|
||||
String root = (String) request2Map.get("root"); // 根节点
|
||||
String level = (String) request2Map.get("level"); // 显示层级
|
||||
String root = (String) request2Map.get("root");
|
||||
String level = (String) request2Map.get("level");
|
||||
if (StringUtils.isBlank(level)) {
|
||||
level = "3";
|
||||
}
|
||||
|
|
@ -256,7 +257,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
String whereSql = userWhereSql(request2Map);
|
||||
|
||||
String whereItemSql = " ";
|
||||
if ("0".equals(root)) { // 集团的情况
|
||||
if ("0".equals(root)) {
|
||||
whereItemSql += " and t.ftype = 0 ";
|
||||
} else {
|
||||
whereItemSql += " and t.id = '" + root + "' ";
|
||||
|
|
@ -618,10 +619,19 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
}
|
||||
|
||||
static class OrgSelectItem {
|
||||
private Integer key;
|
||||
private String id;
|
||||
private String fnumber;
|
||||
private String fname;
|
||||
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(Integer key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,7 @@ import javax.ws.rs.core.MediaType;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @className: OrgChartController
|
||||
* @author: dengjp
|
||||
* @date: 2022/7/7
|
||||
* @description: 组织架构图
|
||||
**/
|
||||
|
||||
public class OrgChartController {
|
||||
public OrgChartWrapper getOrgChartWrapper(User user) {
|
||||
return ServiceUtil.getService(OrgChartWrapper.class, user);
|
||||
|
|
|
|||
Loading…
Reference in New Issue