Compare commits

...

14 Commits

@ -44,14 +44,32 @@ public class ChartPO {
private String id;
private String key;
// 部门层级
// 部门深度
private int departmentDepth;
//部门层级
private int deptLevel;
// 在编数
private int onJobNum;
// 编制数
private int staffNum;
//人员所属当前部门
private String localDeptName;
//岗位名称
private String jobTitle;
//部门类型 0部门 1科室
private Integer deptType;
//卡片跳转链接
private String pcUrl;
//用工性质
private String personType;
public String getId() {
if (StringUtils.isNotBlank(ftype)) {
switch (ftype) {

@ -0,0 +1,27 @@
package com.engine.organization.entity.chart;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author liang.cheng
* @Date 2024/4/29 2:15 PM
* @Description:
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class DetailConditionVO {
private String label;
private String value;
private Boolean disabled;
}

@ -1,6 +1,5 @@
package com.engine.organization.entity.chart;
import com.icbc.api.internal.apache.http.impl.cookie.S;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

@ -0,0 +1,32 @@
package com.engine.organization.entity.chart.params;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author liang.cheng
* @Date 2024/4/24 2:04 PM
* @Description: TODO
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ModeHrmResourceParam {
private String departmentId;
private String nbValue;
private String wbValue;
private String versionId;
private String deptLevel;
}

@ -30,10 +30,18 @@ public class ResourceChartPO {
private Integer subcompanyid1;
private Integer deptType;
private Integer jobTitle;
private String jobBrowser;
private Integer status;
private String mobile;
private String pcUrl;
private String personType;
}

@ -28,6 +28,8 @@ public class ResourceChartVO {
private String departmentName;
private Integer deptType;
private String subcompanyName;
private String jobTitle;
@ -38,6 +40,10 @@ public class ResourceChartVO {
private Long key;
private String pcUrl;
private String personType;
public Long getKey() {
return id;
}

@ -0,0 +1,32 @@
package com.engine.organization.entity.staff.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author liang.cheng
* @Date 2025/1/22 16:52
* @Description:
* @Version 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ModeStaffPO {
private Integer count;
private String monthYear;
@Override
public String toString() {
return "ModeStaffPO{" +
"count=" + count +
", monthYear='" + monthYear + '\'' +
'}';
}
}

@ -91,4 +91,22 @@ public interface ChartService {
* @return: java.util.Map<java.lang.String,java.lang.Object>
*/
Map<String, Object> recordStatistics(StatisticsParam param);
/**
* @Description:
* @Author: liang.cheng
* @Date: 2024/4/24 11:41 AM
* @param: [request2Map]
* @return: java.util.Map<java.lang.String,java.lang.Object>
*/
Map<String, Object> getDepartmentNewDetail(Map<String, Object> request2Map);
/**
* @Description:
* @Author: liang.cheng
* @Date: 2024/8/1 4:30 PM
* @param: []
* @return: java.util.Map<java.lang.String,java.lang.Object>
*/
Map<String, Object> versionDelete(Integer versionId);
}

@ -0,0 +1,53 @@
package com.engine.organization.service;
import com.engine.organization.entity.chart.params.ModeHrmResourceParam;
import java.util.Map;
/**
* @Author liang.cheng
* @Date 2024/4/24 2:00 PM
* @Description:
* @Version 1.0
*/
public interface ModeHrmResourceService {
/**
* @Description:
* @Author: liang.cheng
* @Date: 2024/4/24 2:05 PM
* @param: [modeHrmResourceParam]
* @return: java.util.Map<java.lang.String,java.lang.Object>
*/
Map<String, Object> chartResourceList(ModeHrmResourceParam modeHrmResourceParam);
/**
* @Description:
* @Author: liang.cheng
* @Date: 2024/4/24 2:06 PM
* @param: [modeHrmResourceParam]
* @return: java.util.Map<java.lang.String,java.lang.Object>
*/
Map<String, Object> chartResourceChart(ModeHrmResourceParam modeHrmResourceParam);
/**
* @Description: ()
* @Author: liang.cheng
* @Date: 2024/4/26 2:11 PM
* @param: [departmentId]
* @return: int
*/
int selcetPersonCount(String departmentIds);
/**
* @Description:
* @Author: liang.cheng
* @Date: 2024/4/29 2:23 PM
* @param: [request2Map, user]
* @return: java.util.Map<java.lang.String,java.lang.Object>
*/
Map<String, Object> getDeptDetailCondition();
}

@ -4,10 +4,13 @@ import cn.hutool.core.thread.ThreadUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.organization.entity.chart.*;
import com.engine.organization.entity.chart.params.ModeHrmResourceParam;
import com.engine.organization.entity.chart.params.StatisticsParam;
import com.engine.organization.entity.staff.po.ModeStaffPO;
import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.service.ChartService;
import com.engine.organization.service.ModeHrmResourceService;
import com.engine.organization.service.OrgChartService;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.OrganizationAssert;
@ -30,6 +33,7 @@ import weaver.hrm.resource.ResourceComInfo;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.ExecutorService;
@ -66,6 +70,10 @@ public class ChartServiceImpl extends Service implements ChartService {
}
private ModeHrmResourceService getModeHrmResourceService(User user) {
return ServiceUtil.getService(ModeHrmResourceServiceImpl.class,user);
}
/**
*
*/
@ -86,8 +94,7 @@ public class ChartServiceImpl extends Service implements ChartService {
}
// 根结点
String root = Util.null2String(params.get("root"));
root = StringUtils.isBlank(root) ? "0" : root;
String root = new BaseBean().getPropValue("hrmOrganization", "subCompanyId");
// 维度
String dimension = Util.null2String(params.get("fclass"));
@ -104,6 +111,13 @@ public class ChartServiceImpl extends Service implements ChartService {
boolean hideDepartment = "1".equals(Util.null2String(params.get("hidedept")));
//一级部门节点
String department = Util.null2String(params.get("department"));
//隐藏班组
boolean showClass = "1".equals(Util.null2String(params.get("showClass")));
// 初始化表名
initTableNameByClass(dimension, id);
@ -139,7 +153,7 @@ public class ChartServiceImpl extends Service implements ChartService {
// 向下查询数据
if (null != topChartPO) {
findChildData(topChartPO, dataList, Integer.parseInt(depth), id, hideDepartment);
findChildData(topChartPO, dataList, Integer.parseInt(depth), id, hideDepartment,department,showClass);
}
result.put("api_status", true);
@ -162,6 +176,12 @@ public class ChartServiceImpl extends Service implements ChartService {
String versionId = Util.null2String(params.get("id"));
boolean hideDepartment = "1".equals(Util.null2String(params.get("hidedept")));
//一级部门节点
String department = Util.null2String(params.get("department"));
//显示班组
boolean showClass = "1".equals(Util.null2String(params.get("showClass")));
// 初始化表名
initTableNameByClass(dimension, versionId);
@ -176,21 +196,22 @@ public class ChartServiceImpl extends Service implements ChartService {
String fObjId = s.split("_")[1];
if (s.startsWith("s")) {
if (isRealTime) {
rs.executeQuery(getRealTimeChildSql("", "1", fObjId));
rs.executeQuery(getRealTimeChildSql("", "1", fObjId,department,showClass));
} else {
rs.executeQuery(getLastTimeChildSql("", "1", fObjId, versionId));
}
} else if (s.startsWith("d")) {
if (isRealTime) {
rs.executeQuery(getRealTimeChildSql("", "2", fObjId));
rs.executeQuery(getRealTimeChildSql("", "2", fObjId,department,showClass));
} else {
rs.executeQuery(getLastTimeChildSql("", "2", fObjId, versionId));
}
}
while (rs.next()) {
String type = rs.getString("type");
ChartPO chartPO = new ChartPO();
chartPO.setFtype(rs.getString("type"));
chartPO.setFtype(type);
chartPO.setFobjid(rs.getString("id"));
chartPO.setFname(rs.getString("name"));
chartPO.setParentId(s);
@ -199,14 +220,19 @@ public class ChartServiceImpl extends Service implements ChartService {
chartPO.setHasChildren(getHasChildren(chartPO.getFtype(), chartPO.getFobjid()).toString());
chartPO.setOnJobNum(isRealTime ? Util.getIntValue(rs.getString("on_job_num"),0) : Util.getIntValue(rs.getString("job_num"),0));
chartPO.setStaffNum(Util.getIntValue(rs.getString("staff_num"),0));
if ("2".equals(type)) {
chartPO.setDeptLevel(Util.getIntValue(rs.getString("bmcj"),0));
}
filterAndAddData(dataList, chartPO, hideDepartment);
//dataList.add(chartPO);
}
}
}
}
Map<String, Object> result = new HashMap<>();
Map<String, Object> result = new HashMap<>(4);
result.put("api_status", true);
result.put("data", dataList);
return result;
@ -347,6 +373,43 @@ public class ChartServiceImpl extends Service implements ChartService {
return result;
}
@Override
public Map<String, Object> getDepartmentNewDetail(Map<String, Object> params) {
String rootId = Util.null2String(params.get("rootId"));
String nbValue = Util.null2String(params.get("nbValue"));
String wbValue = Util.null2String(params.get("wbValue"));
String versionId = Util.null2String(params.get("versionId"));
String deptLevel = Util.null2String(params.get("deptLevel"));
String departmentId = rootId.split("_")[1];
ModeHrmResourceParam build = ModeHrmResourceParam.builder()
.nbValue(nbValue)
.wbValue(wbValue)
.departmentId(departmentId)
.versionId(versionId)
.deptLevel(deptLevel)
.build();
String detauleType = Util.null2String(params.get("detailType"));
if (!"chart".equals(detauleType)) {
// 展示列表模块
return ServiceUtil.getService(ModeHrmResourceServiceImpl.class, user).chartResourceList(build);
}else {
if ("0".equals(versionId)) {
return ServiceUtil.getService(ModeHrmResourceServiceImpl.class, user).chartResourceChart(build);
}else {
return ServiceUtil.getService(ModeHrmResourceServiceImpl.class, user).chartResourceChartHt(build);
}
}
}
@Override
public String selectVersionDate(String id) {
RecordSet rs = new RecordSet();
@ -470,22 +533,60 @@ public class ChartServiceImpl extends Service implements ChartService {
RecordSet rs = new RecordSet();
List<CompanyTreePO> departmentTree = new ArrayList<>();
List<CompanyTreePO> topDepartmentTree = new ArrayList<>();
String subCompany = Util.null2String(params.get("subcompany"));
String dimension = Util.null2String(params.get("fclass"));
String versionId = Util.null2String(params.get("id"));
if (StringUtils.isBlank(subCompany)) {
subCompany = "0";
}
String sql = getDepartmentTreeSql(versionId, dimension, subCompany);
DBType dbType = DBType.get(new RecordSet().getDBType());
// 根据分部查询顶级部门
String sql = "select id as id, id as value, departmentname as title, subcompanyid1 as pId from hrmdepartment where (canceled is null or canceled != '1') and (supdepid is null or supdepid =0) and" + dbType.ifNull("subcompanyid1", "0") + " = " + subCompany;
rs.executeQuery(sql);
while (rs.next()) {
departmentTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).disabled(!rs.getString("id").startsWith("d")).value(rs.getString("value")).title(rs.getString("title")).isLeaf(judgeTreeLeaf(versionId, dimension, rs.getString("id"))).build());
topDepartmentTree.add(
CompanyTreePO.builder()
.id(rs.getString("id"))
.pId(rs.getString("pId"))
.disabled(false)
.value(rs.getString("value"))
.title(rs.getString("title"))
.isLeaf(true)
.build()
);
}
result.put("departmentTree", departmentTree);
//只查询一级部门
// if (CollectionUtils.isNotEmpty(topDepartmentTree)) {
// sql = "select id as id, id as value, departmentname as title, supdepid as pId from hrmdepartment where (canceled is null or canceled != '1') and " + dbType.ifNull("supdepid", "0") + " = ?";
// for (CompanyTreePO department : topDepartmentTree) {
// getChildDepartment(department, sql, departmentTree);
// }
// }
result.put("departmentTree", topDepartmentTree);
result.put("api_status", true);
return result;
}
private void getChildDepartment(CompanyTreePO parentDepartment, String sql, List<CompanyTreePO> departmentTree) {
RecordSet rs = new RecordSet();
rs.executeQuery(sql, parentDepartment.getId());
while (rs.next()) {
CompanyTreePO build = CompanyTreePO.builder()
.id(rs.getString("id"))
.pId(rs.getString("pId"))
.disabled(false)
.value(rs.getString("value"))
.title(rs.getString("title"))
.isLeaf(true)
.build();
getChildDepartment(build, sql, departmentTree);
parentDepartment.setLeaf(false);
}
departmentTree.add(parentDepartment);
}
@Override
public Map<String, Object> getMovingTree(Map<String, Object> params) {
RecordSet rs = new RecordSet();
@ -570,7 +671,7 @@ public class ChartServiceImpl extends Service implements ChartService {
public Map<String, Object> recordStatistics(StatisticsParam statisticsParam) {
Map<String, Object> result = new HashMap<>(2);
long startTime = System.currentTimeMillis();
//需要新的数据List
//需要的数据List
List<StatisticsPO> list = filterIds(statisticsParam.getCompanyId());
RecordSetTrans rst = new RecordSetTrans();
// 核心线程数
@ -618,6 +719,21 @@ public class ChartServiceImpl extends Service implements ChartService {
rst.rollback();
}
//上海中远重工唯一分部在编数和编制更新
List<Integer> jobList = new ArrayList<>();
List<Integer> staffList = new ArrayList<>();
RecordSet rs = new RecordSet();
rs.executeQuery("select on_job_num,staff_num from jcl_org_onjob a left join uf_shzg_zzjgkz b on a.data_id = b.bmbz\n" +
" where a.type = 2 and a.super_id = 0 and b.sfxs = 0");
while (rs.next()) {
jobList.add(Util.getIntValue(rs.getString("on_job_num"),0));
staffList.add(Util.getIntValue(rs.getString("staff_num"),0));
}
int jobSum = jobList.stream().mapToInt(Integer::intValue).sum();
int staffSum = staffList.stream().mapToInt(Integer::intValue).sum();
rs.executeUpdate("update jcl_org_onjob set on_job_num = ?,staff_num = ? where type = 1",jobSum,staffSum);
long endTime = System.currentTimeMillis();
long executionTime = endTime - startTime;
@ -625,6 +741,8 @@ public class ChartServiceImpl extends Service implements ChartService {
return result;
}
/**
*
* @param stp
@ -633,43 +751,47 @@ public class ChartServiceImpl extends Service implements ChartService {
private StatisticsPO buildCount(StatisticsPO stp) {
RecordSet rs = new RecordSet();
DepartmentComInfo dept = new DepartmentComInfo();
SubCompanyComInfo subCompany = new SubCompanyComInfo();
ArrayList<Integer> list = new ArrayList<>();
list.add(stp.getDataId());
StringBuilder jobSql = new StringBuilder();
StringBuilder staffSql = new StringBuilder();
if (ModuleTypeEnum.subcompanyfielddefined.getValue().equals(stp.getType())) {
subCompany.getSubCompanyLists(String.valueOf(stp.getDataId()), list);
String value = StringUtils.join(list,",");
jobSql.append("select count(1) as count from hrmresource where status < 4 and subcompanyid1 in (").append(value).append(")");
staffSql.append("select a.staff_num from jcl_org_staff a inner join jcl_org_staffplan b\n" +
" on a.plan_id = b.id\n" +
" and a.ec_company = ? and a.ec_department is null and a.delete_type = 0\n" +
" and b.plan_year = ?");
}else {
BaseBean bb = new BaseBean();
if (ModuleTypeEnum.departmentfielddefined.getValue().equals(stp.getType())) {
dept.getAllChildDeptByDepId(list,String.valueOf(stp.getDataId()));
String value = StringUtils.join(list,",");
jobSql.append("select count(1) as count from hrmresource where status < 4 and departmentid in (").append(value).append(")");
staffSql.append("select a.staff_num from jcl_org_staff a inner join jcl_org_staffplan b\n" +
" on a.plan_id = b.id\n" +
" and a.ec_department = ? and a.job_id is null and a.delete_type = 0\n" +
" and b.plan_year = ?");
}
int jobNum = getModeHrmResourceService(user).selcetPersonCount(value);
stp.setOnJobNum(jobNum);
if ("false".equals(new BaseBean().getPropValue("hrmOrganization","accountType"))) {
jobSql.append(" and accounttype != 1");
}
LocalDateTime currentDateTime = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
String currentYearMonth = currentDateTime.format(formatter);
rs.executeQuery(jobSql.toString());
rs.next();
stp.setOnJobNum(Util.getIntValue(rs.getString("count")));
// 部门编制人数向下汇总 20250122 优化需求 ==》需求变更20250205 不使用年月字段 数据存在即汇总统计
List<ModeStaffPO> bzList = new ArrayList<>();
rs.executeQuery("select bzrs,ny from uf_bzgljmb where bm in ("+value+")");
while (rs.next()) {
int bzrs = Util.getIntValue(rs.getString("bzrs"), 0);
String ny = Util.null2String(rs.getString("ny"));
if(StringUtils.isNotEmpty(ny)) {
bzList.add(ModeStaffPO.builder().count(bzrs).monthYear(ny).build());
}
}
int sum = 0;
if (bzList.size() > 0) {
// Map<String, List<ModeStaffPO>> groupedByMonthYear = bzList.stream()
// .collect(Collectors.groupingBy(ModeStaffPO::getMonthYear));
//
// // 获取最新的 monthYear
// String latestMonthYear = groupedByMonthYear.keySet().stream()
// .max(String::compareTo)
// .orElse(null);
// List<ModeStaffPO> modeStaffPOS = groupedByMonthYear.get(latestMonthYear);
sum = bzList.stream().mapToInt(ModeStaffPO::getCount).sum();
}
stp.setStaffNum(sum);
rs.executeQuery(staffSql.toString(),stp.getDataId(),OrganizationDateUtil.getFormatYear(new Date()));
if (rs.next()) {
stp.setStaffNum(Util.getIntValue(rs.getString("staff_num")));
}else {
stp.setStaffNum(0);
}
return stp;
@ -689,7 +811,9 @@ public class ChartServiceImpl extends Service implements ChartService {
List<Integer> hisCompanyList = new ArrayList<>();
List<Integer> hisDepartmentList = new ArrayList<>();
rs.executeQuery("select data_id from jcl_org_onjob where type = 1");
String propValue = new BaseBean().getPropValue("hrmOrganization", "subCompanyId");
rs.executeQuery("select data_id from jcl_org_onjob where type = 1 ");
while (rs.next()) {
hisCompanyList.add(Util.getIntValue(rs.getString("data_id")));
}
@ -704,10 +828,12 @@ public class ChartServiceImpl extends Service implements ChartService {
StringBuilder sql1 = new StringBuilder();
sql.append("select id,supsubcomid from hrmsubcompany where 1=1");
sql1.append("select id,supdepid from hrmdepartment where 1=1");
if (companyId != null) {
sql.append(" and id = ").append(companyId);
sql1.append(" and subcompanyid1 = ").append(companyId);
}
//中远重工指定分部数据记录
companyId = Integer.parseInt(propValue);
sql.append(" and id = ").append(companyId);
sql1.append(" and subcompanyid1 = ").append(companyId);
rs.executeQuery(sql.toString());
while (rs.next()) {
@ -865,11 +991,12 @@ public class ChartServiceImpl extends Service implements ChartService {
" left join JCL_ORG_ONJOB d on a.id=d.data_id and d.type=1 ";
deptQuerySql = "select a.id as departmentid, a.departmentmark, a.departmentname, a.subcompanyid1 as subcompanyid, " +
"b.SUBCOMPANYNAME as subcompany,a.supdepid as supdepartmentid,c.departmentname as supdepartment," +
"a.canceled,a.departmentcode,a.coadjutant,a.tlevel,d.bmlx as isvirtual,a.bmfzr as fleader,e.on_job_num,e.staff_num " +
"a.canceled,a.departmentcode,a.coadjutant,a.tlevel,d.bmlx as isvirtual,d.bmfzr as fleader,e.on_job_num,e.staff_num,f.sfxs " +
"from hrmdepartment a left join hrmsubcompany b on a.subcompanyid1 = b.id " +
"left join hrmdepartment c on a.supdepid = c.id " +
"left join hrmdepartmentdefined d on a.id=d.deptid " +
"left join JCL_ORG_ONJOB e on a.id=e.data_id and e.type=2 ";
"left join JCL_ORG_ONJOB e on a.id=e.data_id and e.type=2 " +
"left join uf_shzg_zzjgkz f on a.id = f.bmbz ";
} else {
subCompanyQuerySql = "select a.id as subcompanyid,\n" +
@ -898,7 +1025,7 @@ public class ChartServiceImpl extends Service implements ChartService {
" a.departmentcode,\n" +
" a.coadjutant,\n" +
" a.tlevel,\n" +
" a.bmfzr as fleader,\n" +
" a.bmfzr as fleader,\n" +
" d.on_job_num,\n" +
" d.staff_num" +
" from hrmdepartment a\n" +
@ -961,103 +1088,73 @@ public class ChartServiceImpl extends Service implements ChartService {
insertList.add(StringUtils.isBlank(versionId) ? null : Util.getIntValue(versionId));
insertList.add(Util.getIntValue(rs.getString("on_job_num"),0));
insertList.add(Util.getIntValue(rs.getString("staff_num"),0));
insertList.add(Util.getIntValue(rs.getString("sfxs"),1));
insertParamList.add(insertList);
}
String insertDeptSql = "insert into jcl_chart_department(creater, departmentid, departmentmark, departmentname, subcompanyid,\n" +
" subcompany, supdepartmentid, supdepartment, canceled, departmentcode,\n" +
" coadjutant, fleader,versiondate, isvirtual,versionid,job_num,staff_num) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
" coadjutant, fleader,versiondate, isvirtual,versionid,job_num,staff_num,sfxs) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
insertData(recordSetTrans, insertDeptSql, insertParamList);
//当前岗位版本存储
rs.executeQuery("select b.id as jobid,b.JOBTITLENAME as jobname,a.ec_department as departmentid," +
"c.departmentname as department,a.ec_company as subcompanyid,d.subcompanyname as subcompany," +
"b.jobresponsibility,a.forbidden_tag as canceled,a.job_no as jobcode,a.description " +
"from jcl_org_job a inner join hrmjobtitles b on a.ec_jobtitle = b.id " +
"left join hrmdepartment c on a.ec_department=c.id " +
"left join hrmsubcompany d on a.ec_company=d.id");
//当前人员版本存储todo 人员数据存在建模表)
DepartmentComInfo deptInfo = new DepartmentComInfo();
SubCompanyComInfo subInfo = new SubCompanyComInfo();
insertParamList = new ArrayList<>();
while (rs.next()) {
//正式员工
rs.executeQuery("select a.id,a.gh,a.xm,a.xb,a.bm,a.ks,a.gw,a.sjhm,a.ygxz,a.zt,d.gwmc from uf_zsygrzbdd a \n" +
"left join uf_zsyggwbd d on a.gw = d.id " +
" where a.zt = 1 and a.zgzt = 1");
while(rs.next()) {
insertList = new ArrayList<>();
insertList.add(StringUtils.isBlank(rs.getString("jobid")) ? null : rs.getString("jobid"));
insertList.add(currentUser);
insertList.add(rs.getString("jobname"));
insertList.add(rs.getString("departmentid"));
insertList.add(rs.getString("department"));
insertList.add(rs.getString("subcompanyid"));
insertList.add(rs.getString("subcompany"));
insertList.add(rs.getString("jobresponsibility"));
insertList.add(StringUtils.isBlank(rs.getString("canceled")) ? null : rs.getInt("canceled"));
insertList.add(rs.getString("jobcode"));
insertList.add(rs.getString("description"));
insertList.add(currentDate);
int bm = Util.getIntValue(rs.getString("bm"));
int ks = Util.getIntValue(rs.getString("ks"));
int deptId = ks != -1 ? ks : bm;
String subcompanyid1 = deptInfo.getSubcompanyid1(String.valueOf(deptId));
String subCompanyname = subInfo.getSubCompanyname(subcompanyid1);
insertList.add(Util.null2String(rs.getString("gh")));
insertList.add(Util.null2String(rs.getString("xm")));
insertList.add(Util.null2String(rs.getString("xb")));
insertList.add(subCompanyname);
insertList.add(deptId);
insertList.add(deptInfo.getDepartmentname(String.valueOf(deptId)));
insertList.add(Util.null2String(rs.getString("gwmc")));
insertList.add(Util.null2String(rs.getString("sjhm")));
insertList.add(Util.null2String(rs.getString("ygxz")));
insertList.add(Util.getIntValue(rs.getString("zt")));
insertList.add(StringUtils.isBlank(versionId) ? null : Util.getIntValue(versionId));
insertParamList.add(insertList);
}
String insertJobSql = "insert into jcl_chart_job(jobid,creater,jobname,departmentid,department,subcompanyid," +
"subcompany,jobresponsibility,canceled,jobcode,description,versiondate,versionid)values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
insertData(recordSetTrans, insertJobSql, insertParamList);
//当前人员版本存储
rs.executeQuery("select a.id as resourceid,workyear,usekind,managerstr,status,sex,accounttype,belongto," +
"loginid,maritalstatus,a.telephone,mobile,mobilecall,email,b.locationname,resourcetype,startdate," +
"enddate,d.id as jobtitleid,d.JOBTITLENAME as jobtitle,joblevel,seclevel,departmentid,e.departmentname as department," +
"a.subcompanyid1 as subcompanyid,f.subcompanyname as subcompany,a.costcenterid as costcenter," +
"a.managerid as manager,a.assistantid as assistant,workcode,classification,policy," +
"degree,a.lastname,a.companyworkyear from hrmresource a " +
"left join hrmlocations b on a.locationid = b.id " +
"left join hrmjobtitles d on a.jobtitle = d.id " +
"left join hrmdepartment e on a.departmentid = e.id " +
"left join hrmsubcompany f on a.subcompanyid1=f.id");
insertParamList = new ArrayList<>();
while (rs.next()) {
//外部员工
rs.executeQuery("select a.id,a.gh,a.xm,a.xb,a.ks,a.gw,a.lxfs,a.zt,a.ygxz,b.departmentname,c.subcompanyname,d.gwmc from uf_qlwbrydngljmb a\n" +
"left join hrmdepartment b on a.ks = b.id\n" +
"left join hrmsubcompany c on b.subcompanyid1 = c.id\n" +
"left join uf_gwmc d on a.gw = d.gwbm" +
" where a.zt < 4");
while(rs.next()) {
insertList = new ArrayList<>();
insertList.add(StringUtils.isBlank(rs.getString("resourceid")) ? null : rs.getInt("resourceid"));
insertList.add(currentUser);
insertList.add(StringUtils.isBlank(rs.getString("workyear")) ? null : rs.getString("workyear"));
insertList.add(rs.getString("usekind"));
insertList.add(rs.getString("managerstr"));
insertList.add(StringUtils.isBlank(rs.getString("status")) ? null : rs.getInt("status"));
insertList.add(rs.getString("sex"));
insertList.add(StringUtils.isBlank(rs.getString("accounttype")) ? null : rs.getInt("accounttype"));
insertList.add(StringUtils.isBlank(rs.getString("belongto")) ? null : rs.getInt("belongto"));
insertList.add(rs.getString("loginid"));
insertList.add(rs.getString("maritalstatus"));
insertList.add(rs.getString("telephone"));
insertList.add(rs.getString("mobile"));
insertList.add(rs.getString("mobilecall"));
insertList.add(rs.getString("email"));
insertList.add(rs.getString("locationname"));
insertList.add(rs.getString("resourcetype"));
insertList.add(rs.getString("startdate"));
insertList.add(rs.getString("enddate"));
insertList.add(StringUtils.isBlank(rs.getString("jobtitleid")) ? null : rs.getInt("jobtitleid"));
insertList.add(rs.getString("jobtitle"));
insertList.add(StringUtils.isBlank(rs.getString("joblevel")) ? null : rs.getInt("joblevel"));
insertList.add(StringUtils.isBlank(rs.getString("seclevel")) ? null : rs.getInt("seclevel"));
insertList.add(StringUtils.isBlank(rs.getString("departmentid")) ? null : rs.getInt("departmentid"));
insertList.add(rs.getString("department"));
insertList.add(StringUtils.isBlank(rs.getString("subcompanyid")) ? null : rs.getInt("subcompanyid"));
insertList.add(rs.getString("subcompany"));
insertList.add(rs.getString("costcenter"));
insertList.add(StringUtils.isBlank(rs.getString("manager")) ? null : rs.getInt("manager"));
insertList.add(StringUtils.isBlank(rs.getString("assistant")) ? null : rs.getInt("assistant"));
insertList.add(rs.getString("workcode"));
insertList.add(rs.getString("classification"));
insertList.add(currentDate);
insertList.add(rs.getString("policy"));
insertList.add(rs.getString("degree"));
insertList.add(Util.null2String(rs.getString("gh")));
insertList.add(Util.null2String(rs.getString("xm")));
insertList.add(Util.null2String(rs.getString("xb")));
insertList.add(Util.null2String(rs.getString("subcompanyname")));
insertList.add(Util.getIntValue(rs.getString("ks")));
insertList.add(Util.null2String(rs.getString("departmentname")));
insertList.add(Util.null2String(rs.getString("gwmc")));
insertList.add(Util.null2String(rs.getString("lxfs")));
insertList.add(Util.null2String(rs.getString("ygxz")));
insertList.add(Util.getIntValue(rs.getString("zt")));
insertList.add(StringUtils.isBlank(versionId) ? null : Util.getIntValue(versionId));
insertList.add(rs.getString("lastname"));
insertList.add(StringUtils.isBlank(rs.getString("companyworkyear")) ? null : rs.getString("companyworkyear"));
insertParamList.add(insertList);
}
String insertResourceSql = "insert into jcl_chart_resource(resourceid, creater, workyear, usekind, managerstr," +
"status, sex, accounttype,belongto, loginid, maritalstatus, telephone, mobile, mobilecall, email," +
"locationname, resourcetype, startdate, enddate, jobtitleid, jobtitle, joblevel,seclevel, departmentid," +
"department, subcompanyid, subcompany, costcenter,manager, assistant, workcode, classification, " +
"versiondate, policy, degree,versionid,lastname,companyworkyear) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?," +
"?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
String insertResourceSql = "insert into jcl_chart_resource(workcode, lastname,sex,subcompany,departmentid,department,jobtitle,mobile,usekind,status,versionid) " +
"values (?,?,?,?,?,?,?,?,?,?,?)";
insertData(recordSetTrans, insertResourceSql, insertParamList);
}
private void virtualDimension(RecordSetTrans recordSetTrans, String versionId, String currentUser, String currentDate, String fclass) {
@ -1215,22 +1312,7 @@ public class ChartServiceImpl extends Service implements ChartService {
"department, subcompanyid, subcompany, costcenter,manager, assistant, workcode, classification, " +
"versiondate, policy, degree,versionid,lastname,companyworkyear) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?," +
"?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
// while (rs.next()) {
// insertList = new ArrayList<>();
// insertList.add(StringUtils.isBlank(rs.getString("resourceid")) ? null : rs.getInt("resourceid"));
// insertList.add(StringUtils.isBlank(rs.getString("managerid")) ? null : rs.getInt("managerid"));
// insertList.add(StringUtils.isBlank(rs.getString("subcompanyid")) ? null : rs.getInt("subcompanyid"));
// insertList.add(StringUtils.isBlank(rs.getString("departmentid")) ? null : rs.getInt("departmentid"));
// insertList.add(rs.getString("managerstr"));
// //insertList.add(rs.getString("virtualtype"));
// insertList.add(currentDate);
// insertList.add(StringUtils.isBlank(versionId) ? null : Util.getIntValue(versionId));
// insertParamList.add(insertList);
// }
// String insertVirtualHrmSql = "insert into jcl_chart_resource(resourceid,MANAGER,subcompanyid," +
// "departmentid,managerstr," +
// //"virtualtype," +
// "versiondate,versionid) values (?,?,?,?,?,?,?)";
insertData(recordSetTrans, insertVirtualHrmSql, insertParamList);
}
@ -1262,26 +1344,13 @@ public class ChartServiceImpl extends Service implements ChartService {
* @return SQL
*/
private String getRealTimeTopSql(String root, String dimension) {
if ("0".equals(root)) {
// 查询集团数据
if (isRealDimension) {
// 查询实际集团表
return "select id,companyname as name,'0' as type from " + COMPANY_TABLE;
} else {
// 查询其他维度集团信息
return "select id,companyname as name,'0' as type from " + COMPANY_TABLE + " where id = '" + dimension + "'";
}
// 查询集团数据
if (isRealDimension) {
// 查询实际集团表
return "select id,companyname as name,'0' as type from " + COMPANY_TABLE;
} else {
if (hasVirtualFields) {
if (showVirtual) {
return "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual,c.on_job_num,c.staff_num from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid left join jcl_org_onjob c on a.id=c.data_id and c.type=1 where a.id = '" + root + "' order by showorder,id";
} else {
return "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual,c.on_job_num,c.staff_num from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid left join jcl_org_onjob c on a.id=c.data_id and c.type=1 where a.id = '" + root + "' and (b.fblx is null or b.fblx!='1') order by showorder,id";
}
} else {
return "select a.id,a.subcompanyname as name,'1' as type,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a.id=b.data_id and b.type=1 where a.id = '" + root + "' order by a.showorder,a.id";
}
// 查询其他维度集团信息
return "select id,companyname as name,'0' as type from " + COMPANY_TABLE + " where id = '" + dimension + "'";
}
}
@ -1293,7 +1362,7 @@ public class ChartServiceImpl extends Service implements ChartService {
* @param fObjId ID
* @return SQL
*/
private String getRealTimeChildSql(String sql, String fType, String fObjId) {
private String getRealTimeChildSql(String sql, String fType, String fObjId,String department,boolean showClass) {
if (StringUtils.isNotBlank(fType)) {
switch (fType) {
case "0":
@ -1307,6 +1376,10 @@ public class ChartServiceImpl extends Service implements ChartService {
sql = "select a.id,a.subcompanyname as name,'1' as type,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a.id=b.data_id and b.type=1 where (a.canceled is null or a.canceled != '1') and (a.supsubcomid is null or a.supsubcomid = '0') and a.companyid = '" + fObjId + "'";
}
//中远重工二开 只能查看某一分部(非标分权无效)
String subCompanyId = new BaseBean().getPropValue("hrmOrganization", "subCompanyId");
sql = sql + " and a.id = "+subCompanyId;
// 一级分部数据分权处理
if (isRealTime && user.getUID() != 1 && isRealDimension) {
DetachUtil detachUtil = new DetachUtil(user);
@ -1315,6 +1388,7 @@ public class ChartServiceImpl extends Service implements ChartService {
sql = sql + " and a.id in (" + ids + ")";
}
}
break;
case "1":
if (hasVirtualFields) {
@ -1322,24 +1396,36 @@ public class ChartServiceImpl extends Service implements ChartService {
sql = "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual,showorder,c.on_job_num,c.staff_num from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid left join jcl_org_onjob c on a.id=c.data_id and c.type=1 where (a.canceled is null or a.canceled != '1') and a.supsubcomid = '" + fObjId + "'" +
" union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,showorder,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id and c.type=2 where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and subcompanyid1 = '" + fObjId + "'";
} else {
sql = "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual,showorder,c.on_job_num,c.staff_num from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid left join jcl_org_onjob c on a.id=c.data_id and c.type=1 where (a.canceled is null or a.canceled != '1') and (b.fblx is null or b.fblx != '1') and a.supsubcomid = '" + fObjId + "'" +
" union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,showorder,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id and c.type=2 where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and (b.bmlx is null or b.bmlx != '1') and subcompanyid1 = '" + fObjId + "'";
sql = "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual,0,showorder,c.on_job_num,c.staff_num from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid left join jcl_org_onjob c on a.id=c.data_id and c.type=1 where (a.canceled is null or a.canceled != '1') and (b.fblx is null or b.fblx != '1') and a.supsubcomid = '" + fObjId + "'" +
" union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,b.bmcj,showorder,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id and c.type=2 left join uf_shzg_zzjgkz d on a.id = d.bmbz where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and (b.bmlx is null or b.bmlx != '1') and (d.sfxs != 1 and d.sfxs is not null) and subcompanyid1 = '" + fObjId + "'";
}
} else {
sql = "select a.id,a.subcompanyname as name,'1' as type,showorder,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a.id=b.data_id and b.type=1 where (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "'" +
" union select a.id,a.departmentname as name,'2' as type,showorder,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a.id=b.data_id and b.type=2 where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '" + fObjId + "'";
}
break;
//指定筛选一级部门节点数据
if (StringUtils.isNotEmpty(department)) {
sql += " and a.id = "+department;
}
break;
case "2":
if (hasVirtualFields) {
if (showVirtual) {
sql = "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id and c.type=2 where (a.canceled is null or a.canceled != '1') and supdepid = '" + fObjId + "'";
} else {
sql = "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id and c.type=2 where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "'";
sql = "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,b.bmcj,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id and c.type=2 left join uf_shzg_zzjgkz d on a.id = d.bmbz where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and (d.sfxs != 1 and d.sfxs is not null) and a.supdepid = '" + fObjId + "'";
}
} else {
sql = "select a.id,a.departmentname as name,'2' as type,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a.id=b.data_id and b.type=2 where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'";
}
//隐藏班组数据
if (!showClass) {
sql += " and (b.sfbz is null or b.sfbz != '1')";
}
break;
default:
break;
@ -1353,8 +1439,9 @@ public class ChartServiceImpl extends Service implements ChartService {
* ,SQL
*
* @param sql SQL
* @param fType
* @param fType deptLevel
* @param fObjId ID
* todo
* @return SQL
*/
private String getLastTimeChildSql(String sql, String fType, String fObjId, String versionId) {
@ -1381,7 +1468,7 @@ public class ChartServiceImpl extends Service implements ChartService {
" union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and subcompanyid = '" + fObjId + "' and versionid = " + versionId;
} else {
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supsubcompanyid = '" + fObjId + "' and versionid = " + versionId +
" union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and (isvirtual is null or isvirtual != '1') and subcompanyid = '" + fObjId + "' and versionid = " + versionId;
" union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and (isvirtual is null or isvirtual != '1') and (a.sfxs = 0 or a.sfxs is null) and subcompanyid = '" + fObjId + "' and versionid = " + versionId;
}
} else {
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcompanyid = '" + fObjId + "' and versionid = " + versionId +
@ -1393,7 +1480,7 @@ public class ChartServiceImpl extends Service implements ChartService {
if (showVirtual) {
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and supdepartmentid = '" + fObjId + "' and versionid = " + versionId;
} else {
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supdepartmentid = '" + fObjId + "' and versionid = " + versionId;
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (isvirtual is null or isvirtual != '1') and (a.sfxs = 0 or a.sfxs is null) and a.supdepartmentid = '" + fObjId + "' and versionid = " + versionId;
}
} else {
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "' and versionid = " + versionId;
@ -1414,12 +1501,12 @@ public class ChartServiceImpl extends Service implements ChartService {
* @param selectDepth
* @param hideDepartment
*/
private void findChildData(ChartPO topChartPO, List<ChartPO> dataList, Integer selectDepth, String versionId, boolean hideDepartment) {
private void findChildData(ChartPO topChartPO, List<ChartPO> dataList, Integer selectDepth, String versionId, boolean hideDepartment,String department,boolean showClass) {
String fType = topChartPO.getFtype();
String fObjId = topChartPO.getFobjid();
String sql = "";
if (isRealTime) {
sql = getRealTimeChildSql(sql, fType, fObjId);
sql = getRealTimeChildSql(sql, fType, fObjId,department,showClass);
} else {
sql = getLastTimeChildSql(sql, fType, fObjId, versionId);
}
@ -1429,8 +1516,9 @@ public class ChartServiceImpl extends Service implements ChartService {
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql);
while (recordSet.next()) {
String type = recordSet.getString("type");
ChartPO chartPO = new ChartPO();
chartPO.setFtype(recordSet.getString("type"));
chartPO.setFtype(type);
chartPO.setFobjid(recordSet.getString("id"));
chartPO.setFname(recordSet.getString("name"));
chartPO.setOnJobNum(isRealTime ? Util.getIntValue(recordSet.getString("on_job_num"),0) : Util.getIntValue(recordSet.getString("job_num"),0));
@ -1441,6 +1529,12 @@ public class ChartServiceImpl extends Service implements ChartService {
chartPO.setDepartmentDepth(getDepartmentDepth(chartPO, topChartPO));
// 小于、等于所选层级元素展开
chartPO.setExpand(inDepth(selectDepth, chartPO.getDepartmentDepth()) ? "1" : "0");
if ("2".equals(type)) {
chartPO.setDeptLevel(Util.getIntValue(recordSet.getString("bmcj"),0));
}
filterAndAddData(currentList, chartPO, hideDepartment);
//currentList.add(chartPO);
}
@ -1448,7 +1542,7 @@ public class ChartServiceImpl extends Service implements ChartService {
for (ChartPO chartPO : currentList) {
if (inDepth(selectDepth, chartPO.getDepartmentDepth())) {
findChildData(chartPO, dataList, selectDepth, versionId, hideDepartment);
findChildData(chartPO, dataList, selectDepth, versionId, hideDepartment,department,showClass);
}
}
@ -1700,4 +1794,30 @@ public class ChartServiceImpl extends Service implements ChartService {
currentList.add(chartPO);
}
@Override
public Map<String, Object> versionDelete(Integer versionId) {
Map<String, Object> data = new HashMap<>();
RecordSet rs = new RecordSet();
//1.删除版本表
rs.executeUpdate("delete from jcl_org_chartversion where id = ?",versionId);
//2.删除历史分部表
rs.executeUpdate("delete from jcl_chart_subcompany where versionid = ?",versionId);
//3.删除历史部门表
rs.executeUpdate("delete from jcl_chart_department where versionid = ?",versionId);
//4.删除历史聚才林岗位表
rs.executeUpdate("delete from jcl_chart_job where versionid = ?",versionId);
//5.删除历史人员表
rs.executeUpdate("delete from jcl_chart_resource where versionid = ?",versionId);
data.put("versionId",versionId);
return data;
}
}

@ -0,0 +1,518 @@
package com.engine.organization.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.engine.core.impl.Service;
import com.engine.organization.entity.chart.ChartPO;
import com.engine.organization.entity.chart.DetailConditionVO;
import com.engine.organization.entity.chart.ResourceListColumns;
import com.engine.organization.entity.chart.params.ModeHrmResourceParam;
import com.engine.organization.entity.hrmresource.po.ResourceChartPO;
import com.engine.organization.entity.hrmresource.vo.ResourceChartVO;
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.service.ModeHrmResourceService;
import com.engine.organization.util.db.MapperProxyFactory;
import com.weaver.general.BaseBean;
import lombok.SneakyThrows;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.resource.ResourceComInfo;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author liang.cheng
* @Date 2024/4/24 2:01 PM
* @Description: uf_zsygrzbdd uf_qlwbrydngljmb
* @Version 1.0
*/
public class ModeHrmResourceServiceImpl extends Service implements ModeHrmResourceService {
@Override
public Map<String, Object> chartResourceList(ModeHrmResourceParam param) {
Map<String, Object> dataMap = new HashMap<>(4);
List<ResourceListColumns> resourceListColumns = getTableColumns();
List<Integer> allSupDepartment = getAllSupDepartment(param.getDepartmentId());
List<ResourceChartVO> resourceChartVOS = new ArrayList<>();
if ("0".equals(param.getVersionId())) {
List<ResourceChartPO> resourceChartNb = new ArrayList<>(selectNbPerson(allSupDepartment,param.getNbValue(),param.getDeptLevel(),param.getDepartmentId()));
resourceChartVOS.addAll(convertToVO(resourceChartNb,"1"));
List<ResourceChartPO> resourceChartWb = new ArrayList<>(selectWbPerson(allSupDepartment,param.getWbValue()));
resourceChartVOS.addAll(convertToVO(resourceChartWb,"2"));
}else {
//历史版本
List<String> results = new ArrayList<>();
if (StringUtils.isNotEmpty(param.getNbValue())) {
results.addAll(Arrays.asList(param.getNbValue().split(",")));
}
if (StringUtils.isNotEmpty(param.getWbValue())) {
results.addAll(Arrays.asList(param.getWbValue().split(",")));
}
resourceChartVOS = selectPersonHt(allSupDepartment,results,param.getVersionId());
}
dataMap.put("columns", resourceListColumns);
dataMap.put("dataSource", resourceChartVOS);
return dataMap;
}
/**
*
* @param allSupDepartment
* @param versionId
* @return
*/
private List<ResourceChartVO> selectPersonHt(Collection<Integer> allSupDepartment,List<String> result,String versionId) {
//历史版本
List<ResourceChartVO> resourceChartVOS = new ArrayList<>();
if (CollectionUtil.isEmpty(result)){
return resourceChartVOS;
}
String workType = result.stream()
.map(s -> "'" + s + "'")
.collect(Collectors.joining(","));
RecordSet rs = new RecordSet();
String join = CollectionUtil.join(allSupDepartment, ",");
rs.executeQuery("select id,workcode,lastname,sex,subcompany,department,jobtitle,mobile,usekind,status,versionid \n" +
"from jcl_chart_resource where status < 4 and versionid = "+versionId+" and departmentid in ("+join+") and usekind in ("+workType+")");
while (rs.next()) {
ResourceChartVO build = ResourceChartVO.builder()
.id((long) Util.getIntValue(rs.getString("id")))
.workCode(Util.null2String(rs.getString("workcode")))
.lastName(Util.null2String(rs.getString("lastname")))
.sex("1".equals(Util.null2String(rs.getString("sex"))) ? "女" : "男")
.subcompanyName(Util.null2String(rs.getString("subcompany")))
.departmentName(Util.null2String(rs.getString("department")))
.jobTitle(Util.null2String(rs.getString("jobtitle")))
.mobile(Util.null2String(rs.getString("mobile")))
.build();
resourceChartVOS.add(build);
}
return resourceChartVOS;
}
@Override
public Map<String, Object> chartResourceChart(ModeHrmResourceParam param) {
List<ChartPO> dataList = new ArrayList<>();
String departmentId = param.getDepartmentId();
RecordSet rs = new RecordSet();
rs.executeQuery("select a.id,a.departmentname as name,b.bmfzr\n" +
"from hrmdepartment a left join hrmdepartmentdefined b on a.id = b.deptid \n" +
"where a.id = ?",param.getDepartmentId());
//部门
ChartPO departmentChartPO = new ChartPO();
if (rs.next()) {
String fLeader = Util.null2String(rs.getString("bmfzr"));
departmentChartPO.setFtype("2");
departmentChartPO.setFobjid(departmentId);
departmentChartPO.setExpand("1");
departmentChartPO.setId("d_"+departmentId);
departmentChartPO.setFname(rs.getString("name"));
departmentChartPO.setFleader(getDepartmentLeader(fLeader));
try {
departmentChartPO.setFleaderimg(new ResourceComInfo().getMessagerUrls(fLeader));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
//人员
List<Integer> allSupDepartment = getAllSupDepartment(param.getDepartmentId());
List<ResourceChartPO> resourceChartNb = new ArrayList<>(selectNbPerson(allSupDepartment,param.getNbValue(),param.getDeptLevel(),param.getDepartmentId()));
List<ResourceChartVO> resourceChartVOS = convertToVO(resourceChartNb,"1");
List<ResourceChartPO> resourceChartWb = new ArrayList<>(selectWbPerson(allSupDepartment,param.getWbValue()));
resourceChartVOS.addAll(convertToVO(resourceChartWb,"2"));
resourceChartVOS.forEach(item -> {
ChartPO chartPO = getResourceChartPO(item,departmentChartPO.getId());
dataList.add(chartPO);
});
departmentChartPO.setFonjob(resourceChartVOS.size());
dataList.add(departmentChartPO);
Map<String, Object> result = new HashMap<>(4);
result.put("api_status", true);
result.put("data", dataList);
return result;
}
@Override
public int selcetPersonCount(String departmentIds) {
RecordSet rs = new RecordSet();
int totalCount = 0;
rs.executeQuery("select count(1) as total_count from uf_zsygrzbdd where zt = 1 and bm in ("+departmentIds+")");
if (rs.next()) {
totalCount = Util.getIntValue(rs.getString("total_count"));
}
rs.executeQuery("select count(1) as total_count from uf_qlwbrydngljmb where zt < 4 and bmbz in ("+departmentIds+")");
if (rs.next()) {
totalCount += Util.getIntValue(rs.getString("total_count"));
}
return totalCount;
}
@Override
public Map<String, Object> getDeptDetailCondition() {
RecordSet rs = new RecordSet();
List<DetailConditionVO> nbCondition = new ArrayList<>();
List<String> nbValue = new ArrayList<>();
List<DetailConditionVO> wbCondition = new ArrayList<>();
List<String> wbValue = new ArrayList<>();
//内部职工
rs.executeQuery("select mc,bh from uf_ygxz where sfqy = 0 and syfw = 0 and sfxsss = 1");
while (rs.next()) {
String mc = Util.null2String(rs.getString("mc"));
String bh = Util.null2String(rs.getString("bh"));
nbCondition.add(DetailConditionVO.builder().label(mc).value(bh).build());
nbValue.add(bh);
}
//外部人员
rs.executeQuery("select mc,bh from uf_ygxz where sfqy = 0 and syfw = 1 and sfxsss = 1");
while (rs.next()) {
String mc = Util.null2String(rs.getString("mc"));
String bh = Util.null2String(rs.getString("bh"));
wbCondition.add(DetailConditionVO.builder().label(mc).value(bh).build());
wbValue.add(bh);
}
Map<String,Object> datas = new HashMap<>(4);
datas.put("nbCondition",nbCondition);
datas.put("nbValue",nbValue);
datas.put("wbCondition",wbCondition);
datas.put("wbValue",wbValue);
return datas;
}
/**
*
* @param allSupDepartment
* @return
*/
private List<ResourceChartPO> selectNbPerson(Collection<Integer> allSupDepartment,String workType,String depetLevel,String departmentId) {
List<ResourceChartPO> resourceChartPOS = new ArrayList<>();
if (StringUtils.isEmpty(workType)){
return resourceChartPOS;
}
List<String> result = Arrays.asList(workType.split(","));
workType = result.stream()
.map(s -> "'" + s + "'")
.collect(Collectors.joining(","));
BaseBean bb = new BaseBean();
String modeId = bb.getPropValue("hrmOrganization", "nbmodeId");
String formId = bb.getPropValue("hrmOrganization", "nbformId");
String customid = bb.getPropValue("hrmOrganization", "nbcustomid");
RecordSet rs = new RecordSet();
String join = CollectionUtil.join(allSupDepartment, ",");
String sql = "select id,gh,xm,xb,bm,ks,gw,sjhm,ygxz from uf_zsygrzbdd where zt = 1 and zgzt = 1 and bm = "+departmentId+" and ygxz in ("+workType+")";
//非一级部门情况下使用科室字段
if (!"0".equals(depetLevel)) {
sql = "select id,gh,xm,xb,bm,ks,gw,sjhm,ygxz from uf_zsygrzbdd where zt = 1 and zgzt = 1 and ks in ("+join+") and ygxz in ("+workType+")";
}
rs.executeQuery(sql);
while (rs.next()) {
int bm = Util.getIntValue(rs.getString("bm"));
int ks = Util.getIntValue(rs.getString("ks"));
int id = Util.getIntValue(rs.getString("id"));
ResourceChartPO build = ResourceChartPO.builder()
.id((long) id)
.workCode(Util.null2String(rs.getString("gh")))
.lastName(Util.null2String(rs.getString("xm")))
.sex(Util.null2String(rs.getString("xb")))
.departmentId(ks != -1 ? ks : bm)
.deptType(ks != -1 ? 1 : 0)
.jobBrowser(Util.null2String(rs.getString("gw")))
.mobile(Util.null2String(rs.getString("sjhm")))
.pcUrl(String.format("/spa/cube/index.html#/main/cube/card?type=0&modeId=%s&formId=%s&billid=%s&opentype=0&customid=%s&viewfrom=fromsearchlist",modeId,formId,id,customid))
.personType(Util.null2String(rs.getString("ygxz")))
.build();
resourceChartPOS.add(build);
}
return resourceChartPOS;
}
/**
*
* @param allSupDepartment
* @return
*/
private List<ResourceChartPO> selectWbPerson(Collection<Integer> allSupDepartment,String workType) {
List<ResourceChartPO> resourceChartPOS = new ArrayList<>();
if (StringUtils.isEmpty(workType)){
return resourceChartPOS;
}
List<String> result = Arrays.asList(workType.split(","));
workType = result.stream()
.map(s -> "'" + s + "'")
.collect(Collectors.joining(","));
BaseBean bb = new BaseBean();
String modeId = bb.getPropValue("hrmOrganization", "wbmodeId");
String formId = bb.getPropValue("hrmOrganization", "wbformId");
String customid = bb.getPropValue("hrmOrganization", "wbcustomid");
RecordSet rs = new RecordSet();
String join = CollectionUtil.join(allSupDepartment, ",");
rs.executeQuery("select id,gh,xm,xb,bmbz,gw,lxfs,ks,ygxz from uf_qlwbrydngljmb where zt < 4 and ks in ("+join+") and ygxz in ("+workType+")");
while (rs.next()) {
int id = Util.getIntValue(rs.getString("id"));
ResourceChartPO build = ResourceChartPO.builder()
.id((long) id)
.workCode(Util.null2String(rs.getString("gh")))
.lastName(Util.null2String(rs.getString("xm")))
.sex(Util.null2String(rs.getString("xb")))
.departmentId(Util.getIntValue(rs.getString("ks")))
.deptType(1)
.jobBrowser(Util.null2String(rs.getString("gw")))
.mobile(Util.null2String(rs.getString("lxfs")))
.pcUrl(String.format("/spa/cube/index.html#/main/cube/card?type=0&modeId=%s&formId=%s&billid=%s&opentype=0&customid=%s&viewfrom=fromsearchlist",modeId,formId,id,customid))
.personType(Util.null2String(rs.getString("ygxz")))
.build();
resourceChartPOS.add(build);
}
return resourceChartPOS;
}
/**
*
* @return
*/
private List<ResourceListColumns> getTableColumns() {
List<ResourceListColumns> list = new ArrayList<>();
list.add(ResourceListColumns.builder().title("序号").dataIndex("id").key("id").build());
list.add(ResourceListColumns.builder().title("工号").dataIndex("workCode").key("workCode").build());
list.add(ResourceListColumns.builder().title("姓名").dataIndex("lastName").key("lastName").build());
list.add(ResourceListColumns.builder().title("性别").dataIndex("sex").key("sex").build());
list.add(ResourceListColumns.builder().title("部门").dataIndex("departmentName").key("departmentName").build());
list.add(ResourceListColumns.builder().title("分部").dataIndex("subcompanyName").key("subcompanyName").build());
list.add(ResourceListColumns.builder().title("岗位").dataIndex("jobTitle").key("jobTitle").build());
list.add(ResourceListColumns.builder().title("手机号").dataIndex("mobile").key("mobile").build());
return list;
}
/**
*
* @param departmentId
* @return
*/
@SneakyThrows
private List<Integer> getAllSupDepartment(String departmentId){
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
ArrayList subList = new ArrayList();
departmentComInfo.getAllChildDeptByDepId(subList, departmentId);
subList.add(departmentId);
return subList;
}
/**
*
* @param resourceChartPOS
* @return
*/
@SneakyThrows
private List<ResourceChartVO> convertToVO(List<ResourceChartPO> resourceChartPOS,String type) {
List<ResourceChartVO> resourceChartVOS = new ArrayList<>();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
for (ResourceChartPO item : resourceChartPOS) {
ResourceChartVO resourceChartVO = new ResourceChartVO();
String departmentId =String.valueOf(item.getDepartmentId());
String subCompanyname = subCompanyComInfo.getSubCompanyname(departmentComInfo.getSubcompanyid1(departmentId));
resourceChartVO.setId(item.getId());
resourceChartVO.setWorkCode(item.getWorkCode());
resourceChartVO.setLastName(item.getLastName());
resourceChartVO.setSex("1".equals(item.getSex()) ? "女" : "男");
resourceChartVO.setDepartmentName(departmentComInfo.getDepartmentName(departmentId));
resourceChartVO.setSubcompanyName(subCompanyname);
resourceChartVO.setJobTitle(getJobBrowserName(item.getJobBrowser(),type));
resourceChartVO.setStatus(item.getStatus());
resourceChartVO.setMobile(item.getMobile());
resourceChartVO.setDeptType(item.getDeptType());
resourceChartVO.setPcUrl(item.getPcUrl());
resourceChartVO.setPersonType(item.getPersonType());
resourceChartVOS.add(resourceChartVO);
}
return resourceChartVOS;
}
/**
*
* @param code
* @param code
* @return
*/
private String getJobBrowserName(String code,String type){
String gwmc;
RecordSet rs = new RecordSet();
if ("1".equals(type)) {
rs.executeQuery("select gwmc from uf_zsyggwbd where id = ?",code);
rs.next();
gwmc = Util.null2String(rs.getString("gwmc"));
}else {
rs.executeQuery("select gwmc from uf_gwmc where gwbm = ?",code);
rs.next();
gwmc = Util.null2String(rs.getString("gwmc"));
}
return gwmc;
}
/**
*
*
* @param ids ID
* @return
*/
private String getDepartmentLeader(String ids) {
if (StringUtils.isBlank(ids)) {
return "";
}
List<String> leaderList = new ArrayList<>();
String[] split = ids.split(",");
for (String s : split) {
//String lastName = MapperProxyFactory.getProxy(SystemDataMapper.class).getScHrmResourceNameById(s);
try {
ResourceComInfo resourceComInfo = new ResourceComInfo();
String lastName = resourceComInfo.getLastname(s);
if (StringUtils.isNotBlank(lastName)) {
leaderList.add(lastName);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return StringUtils.join(leaderList, ",");
}
/**
*
* @param item
* @return
*/
private ChartPO getResourceChartPO(ResourceChartVO item,String parentId) {
ChartPO chartPO = new ChartPO();
chartPO.setFtype("4");
chartPO.setFobjid(String.valueOf(item.getId()));
chartPO.setId(chartPO.getFobjid());
chartPO.setFname(item.getLastName());
chartPO.setParentId(parentId);
chartPO.setLocalDeptName(item.getDepartmentName());
chartPO.setJobTitle(item.getJobTitle());
chartPO.setExpand("1");
chartPO.setHasChildren("false");
chartPO.setDeptType(item.getDeptType());
chartPO.setPcUrl(item.getPcUrl());
chartPO.setPersonType(item.getPersonType());
try {
String resourceId = getResourceIdByWorkCode(item.getWorkCode());
chartPO.setFleaderimg(new ResourceComInfo().getMessagerUrls(resourceId));
} catch (Exception e) {
throw new RuntimeException(e);
}
return chartPO;
}
/**
* id
* @param workCode
* @return
*/
private String getResourceIdByWorkCode(String workCode) {
RecordSet rs = new RecordSet();
rs.executeQuery("select id from hrmresource where workcode = ?",workCode);
rs.next();
return Util.null2String(rs.getString("id"));
}
public Map<String, Object> chartResourceChartHt(ModeHrmResourceParam param) {
List<ChartPO> dataList = new ArrayList<>();
String departmentId = param.getDepartmentId();
RecordSet rs = new RecordSet();
rs.executeQuery("select departmentid,departmentname,fleader from jcl_chart_department where departmentid = ? and versionid = ?",param.getDepartmentId(),param.getVersionId());
//部门
ChartPO departmentChartPO = new ChartPO();
if (rs.next()) {
String fLeader = Util.null2String(rs.getString("fleader"));
departmentChartPO.setFtype("2");
departmentChartPO.setFobjid(departmentId);
departmentChartPO.setExpand("1");
departmentChartPO.setId("d_"+departmentId);
departmentChartPO.setFname(rs.getString("departmentname"));
departmentChartPO.setFleader(getDepartmentLeader(fLeader));
try {
departmentChartPO.setFleaderimg(new ResourceComInfo().getMessagerUrls(fLeader));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
//人员
List<Integer> allSupDepartment = getAllSupDepartment(param.getDepartmentId());
List<String> results = new ArrayList<>();
if (StringUtils.isNotEmpty(param.getNbValue())) {
results.addAll(Arrays.asList(param.getNbValue().split(",")));
}
if (StringUtils.isNotEmpty(param.getWbValue())) {
results.addAll(Arrays.asList(param.getWbValue().split(",")));
}
List<ResourceChartVO> resourceChartVOS = selectPersonHt(allSupDepartment, results, param.getVersionId());
resourceChartVOS.forEach(item -> {
ChartPO chartPO = getResourceChartPO(item,departmentChartPO.getId());
dataList.add(chartPO);
});
departmentChartPO.setFonjob(resourceChartVOS.size());
dataList.add(departmentChartPO);
Map<String, Object> result = new HashMap<>(4);
result.put("api_status", true);
result.put("data", dataList);
return result;
}
}

@ -19,6 +19,7 @@ import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
@ -79,7 +80,11 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
while (rs.next()) {
companyTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).value(rs.getString("value")).title(rs.getString("title")).isLeaf(judgeTreeLeaf("select id from hrmsubcompany where (canceled is null or canceled != '1') and supsubcomid = ?", rs.getString("id"))).build());
}
String root = new BaseBean().getPropValue("hrmOrganization", "subCompanyId");
result.put("api_status", true);
result.put("root",root);
result.put("fclasslist", fclasslist);
result.put("companyTree", companyTree);
return result;

@ -470,6 +470,15 @@ public class OrganizationDateUtil {
return localDate;
}
/**
*
* @return
*/
public static String dateExample(LocalDate date) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
return date.format(formatter);
}
}

@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.entity.chart.params.StatisticsParam;
import com.engine.organization.service.ModeHrmResourceService;
import com.engine.organization.service.impl.ModeHrmResourceServiceImpl;
import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.wrapper.OrgChartWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
@ -12,10 +14,7 @@ import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
@ -23,10 +22,15 @@ import java.util.Map;
public class OrgChartController {
public OrgChartWrapper getOrgChartWrapper(User user) {
return ServiceUtil.getService(OrgChartWrapper.class, user);
}
private ModeHrmResourceService getModeHrmResourceService(User user) {
return ServiceUtil.getService(ModeHrmResourceServiceImpl.class, user);
}
/**
*
*/
@ -66,6 +70,23 @@ public class OrgChartController {
return JSONObject.toJSONString(apidatas);
}
@GET
@Path("/getDeptDetailCondition")
@Produces(MediaType.APPLICATION_JSON)
public String getDeptDetailCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String, Object> apidatas = new HashMap<>(4);
try {
User user = HrmUserVarify.getUser(request, response);
apidatas = getModeHrmResourceService(user).getDeptDetailCondition();
} catch (Exception e) {
//异常处理
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSONObject.toJSONString(apidatas);
}
@GET
@Path("/getDepartmentDetail")
@Produces(MediaType.APPLICATION_JSON)
@ -100,6 +121,24 @@ public class OrgChartController {
return JSONObject.toJSONString(apidatas);
}
@GET
@Path("/versionDelete")
@Produces(MediaType.APPLICATION_JSON)
public String versionDelete(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("versionId") Integer versionId) {
Map<String, Object> apidatas = new HashMap<>(4);
try {
User user = HrmUserVarify.getUser(request, response);
apidatas = getOrgChartWrapper(user).versionDelete(versionId);
apidatas.put("api_status", true);
} catch (Exception e) {
//异常处理
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSONObject.toJSONString(apidatas);
}
@GET
@Path("/getSubCompanyTree")

@ -63,7 +63,9 @@ public class OrgChartWrapper extends Service {
}
public Map<String, Object> getDepartmentDetail(Map<String, Object> request2Map, User user) {
return getChartService(user).getDepartmentDetail(request2Map);
//上海中远重工项目二开
return getChartService(user).getDepartmentNewDetail(request2Map);
//return getChartService(user).getDepartmentDetail(request2Map);
}
public Map<String, Object> versionRecord(Map<String, Object> request2Map, User user) {
@ -89,4 +91,8 @@ public class OrgChartWrapper extends Service {
public Map<String, Object> recordStatistics(StatisticsParam param) {
return getChartService(user).recordStatistics(param);
}
public Map<String, Object> versionDelete(Integer versionId) {
return getChartService(user).versionDelete(versionId);
}
}

@ -0,0 +1,39 @@
package weaver.interfaces.organization.cronjob;
import com.engine.organization.service.impl.ChartServiceImpl;
import com.engine.organization.util.OrganizationDateUtil;
import weaver.hrm.User;
import weaver.interfaces.schedule.BaseCronJob;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;
/**
* @Author liang.cheng
* @Date 2024/8/2 9:39 AM
* @Description:
* @Version 1.0
*/
public class OrgVersionRecordCron extends BaseCronJob {
@Override
public void execute() {
ChartServiceImpl chartService = new ChartServiceImpl();
User user = new User();
user.setUid(1);
// 获取当前日期
LocalDate today = LocalDate.now();
String example = OrganizationDateUtil.dateExample(today);
String description = "版本自动记录"+example;
Map<String, Object> params = new HashMap<String, Object>(4){
{
put("description",description);
}};
chartService.versionRecord(params,user);
}
}

@ -33,6 +33,7 @@ public class StatisticsPersonCron extends BaseCronJob {
@Override
public void execute() {
//todo 指定分部的情况下 数据库预制数据需要重新更新
Integer value = StringUtils.isNotBlank(companyId) ? Integer.parseInt(companyId) : null;
StatisticsParam build = StatisticsParam.builder().companyId(value).build();
User user = new User();

Loading…
Cancel
Save