嘉华组织透视图编制数取数逻辑修改

feature/jiazhao_nodetach
Mlin 1 year ago
parent 47773d4c8a
commit 4a46272bca

@ -19,6 +19,7 @@ import com.engine.organization.util.OrganizationDateUtil;
import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import com.weaver.formmodel.util.DateHelper;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
@ -351,7 +352,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
whereSql += " and t.ftype = 3 and fobjid = '" + deptLeader + "' ";
deptLeader = String.valueOf(200000000 + Integer.parseInt(deptLeader));
} else {
if (checkDeptManager(id.split("_")[0])){
if (checkDeptManager(id.split("_")[0],whereSql)){
// whereSql += " and t.fparentid = "+ id.split("_")[0] +" or t.fparentid = "+ id.split("_")[1];
whereSql += " and t.fparentid = "+ id.split("_")[1];
}else{
@ -392,7 +393,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
item.put("id", id + "_" + deptLeader);
item.put("parentId", id);
item.put("hasChildren", hasChildren(id, false));
item.put("this_dept",checkDeptManager(id)?1:0);
item.put("this_dept",checkDeptManager(id,whereSql)?1:0);
} else {
item.put("hasChildren", hasChildren(rs.getString("id"), false));
@ -534,7 +535,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
item.put("id", id + "_" + deptLeader);
item.put("parentId", id);
item.put("hasChildren", hasChildren(id, false));
item.put("this_dept",checkDeptManager(id)?1:0);
item.put("this_dept",checkDeptManager(id,whereSql)?1:0);
} else {
item.put("hasChildren", hasChildren(rs.getString("id"), false));
}
@ -720,6 +721,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
String queryAllSubCompanySql = "select id,subcompanyname,supsubcomid from hrmsubcompany a where isnull(a.canceled,0)='0'";
rs.execute(queryAllSubCompanySql);
String allSupComIds = "";
String currentMonth = DateHelper.getCurrentMonth();
while (rs.next()) {
allSupComIds = "";
recordSet.execute(" with children as\n" +
@ -736,7 +738,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
//分部编制数
int bzs = 0;
recordSet.execute("select sum(rs) as bzs from \n" +
"(select *,row_number() over(partition by bm order by ny desc) as rank from uf_rybzb )\n" +
"(select *,row_number() over(partition by bm order by ny desc) as rank from uf_rybzb where ny='"+currentMonth+"' )\n" +
"as A where A.rank=1 and A.bm in (\n" +
"select id from HrmDepartment where subcompanyid1 in (" + allSupComIds + "))");
if (recordSet.next()) {
@ -753,7 +755,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
// 9、更新部门编制数
rs.execute("update p set p.fplan = q.rs from jcl_org_map p \n" +
"inner join (select A.* from (\n" +
"select *,row_number() over(partition by bm order by ny desc) as rank from uf_rybzb \n" +
"select *,row_number() over(partition by bm order by ny desc) as rank from uf_rybzb where ny='"+currentMonth+"' \n" +
")as A where A.rank=1) q on p.fobjid=q.bm and fdateend>getDate() and ftype=2");
}
return "同步成功";
@ -819,10 +821,14 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
return flag;
}
private Boolean checkDeptManager(String id) {
private Boolean checkDeptManager(String id,String whereSql) {
RecordSet recordSet = new RecordSet();
boolean flag = false;
recordSet.executeQuery("select fleader,fobjid,ftype from jcl_org_map where id = "+id);
String sql = "select fleader,fobjid,ftype from jcl_org_map t ";
if (StringUtils.isBlank(id)){
return false;
}
recordSet.executeQuery(sql + whereSql + " and t.id='"+id+"' ");
String fleader = "";
String fobjid = "";
String ftype = "";

Loading…
Cancel
Save