Merge pull request '组织架构图重构-异步数据接口;TODO注释清理' (#173) from feature/dxf into develop
Reviewed-on: http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization/pulls/173
This commit is contained in:
commit
0592b4dae1
|
|
@ -5,7 +5,6 @@ import javax.ws.rs.Path;
|
|||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/6/27 3:38 PM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import lombok.NoArgsConstructor;
|
|||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/6/29 11:19 AM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
|
|
|
|||
|
|
@ -9,6 +9,21 @@ import java.util.Map;
|
|||
*/
|
||||
public interface ChartService {
|
||||
|
||||
/**
|
||||
* 组织架构图 ,获取数据(同步)
|
||||
*
|
||||
* @param params 请求参数
|
||||
* @return 数据集合
|
||||
*/
|
||||
Map<String, Object> getCompanyData(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 组织架构图 ,获取数据(异步)
|
||||
*
|
||||
* @param params 请求参数
|
||||
* @return 数据集合
|
||||
*/
|
||||
Map<String, Object> asyncCompanyData(Map<String, Object> params);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import java.util.Map;
|
|||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/6/27 3:45 PM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface OrgVirtualService {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import java.util.Map;
|
|||
*/
|
||||
public class ChartServiceImpl extends Service implements ChartService {
|
||||
private static final String COMPANY_RIGHT = "OrgChart:All";
|
||||
private static final String USER_RIGHT = "OrgPerspective:All";
|
||||
|
||||
public String COMPANY_TABLE = "";
|
||||
public String SUB_COMPANY_TABLE = "";
|
||||
|
|
@ -38,19 +37,6 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
*/
|
||||
boolean hasVirtualFields;
|
||||
|
||||
public ChartServiceImpl() {
|
||||
super();
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select count(1) as num from hrm_formfield where (GROUPID =6 and FIELDNAME = 'fblx') or (GROUPID =7 and FIELDNAME = 'bmlx')");
|
||||
if (rs.next()) {
|
||||
String num = rs.getString("num");
|
||||
hasVirtualFields = "2".equals(num);
|
||||
|
||||
} else {
|
||||
hasVirtualFields = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCompanyData(Map<String, Object> params) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
|
@ -108,6 +94,74 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> asyncCompanyData(Map<String, Object> params) {
|
||||
|
||||
// 维度
|
||||
String dimension = Util.null2String(params.get("fclass"));
|
||||
dimension = StringUtils.isBlank(dimension) ? "0" : dimension;
|
||||
|
||||
// 是否展示虚拟组织
|
||||
String isVirtual = Util.null2String(params.get("fisvitual"));
|
||||
showVirtual = "1".equals(isVirtual);
|
||||
|
||||
// 初始化表名
|
||||
initTableNameByClass(dimension);
|
||||
|
||||
String ids = (String) params.get("ids");
|
||||
List<ChartPO> dataList = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
RecordSet rs = new RecordSet();
|
||||
String[] split = ids.split(",");
|
||||
for (String s : split) {
|
||||
//TODO 查询当前实际数据
|
||||
if (s.contains("_")) {
|
||||
String fObjId = s.split("_")[1];
|
||||
if (s.startsWith("s")) {
|
||||
if (hasVirtualFields) {
|
||||
if (showVirtual) {
|
||||
rs.executeQuery("select a.id,a.subcompanyname as 'name','1' as 'type' ,b.fblx as 'isvitual' from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid 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' from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and subcompanyid1 = '" + fObjId + "'");
|
||||
} else {
|
||||
rs.executeQuery("select a.id,a.subcompanyname as 'name','1' as 'type' ,b.fblx as 'isvitual' from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid 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' from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid 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 + "'");
|
||||
}
|
||||
} else {
|
||||
rs.executeQuery("select a.id,a.subcompanyname as 'name','1' as 'type' from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "'" +
|
||||
" union select a.id,a.departmentname as 'name','2' as 'type' from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '" + fObjId + "'");
|
||||
}
|
||||
|
||||
} else if (s.startsWith("d")) {
|
||||
if (hasVirtualFields) {
|
||||
if (showVirtual) {
|
||||
rs.executeQuery( "select a.id,a.departmentname as 'name','2' as 'type' ,b.bmlx as 'isvitual' from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and supdepid = '" + fObjId + "'");
|
||||
} else {
|
||||
rs.executeQuery( "select a.id,a.departmentname as 'name','2' as 'type' ,b.bmlx as 'isvitual' from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "'");
|
||||
}
|
||||
} else {
|
||||
rs.executeQuery( "select a.id,a.departmentname as 'name','2' as 'type' from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'");
|
||||
}
|
||||
}
|
||||
while (rs.next()){
|
||||
ChartPO chartPO = new ChartPO();
|
||||
chartPO.setFtype(rs.getString("type"));
|
||||
chartPO.setFobjid(rs.getString("id"));
|
||||
chartPO.setFname(rs.getString("name"));
|
||||
chartPO.setParentId(s);
|
||||
chartPO.setExpand("0");
|
||||
chartPO.setFisvitual(rs.getString("isvitual"));
|
||||
chartPO.setHasChildren(getHasChildren(chartPO.getFtype(), chartPO.getFobjid()).toString());
|
||||
dataList.add(chartPO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("api_status", true);
|
||||
result.put("data", dataList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实时数据,顶级元素SQL
|
||||
*
|
||||
|
|
@ -234,6 +288,15 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
SUB_COMPANY_DEFINED_TABLE = "hrmsubcompanydefined";
|
||||
DEPARTMENT_TABLE = "hrmdepartment";
|
||||
DEPARTMENT_DEFINED_TABLE = "hrmdepartmentdefined";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select count(1) as num from hrm_formfield where (GROUPID =6 and FIELDNAME = 'fblx') or (GROUPID =7 and FIELDNAME = 'bmlx')");
|
||||
if (rs.next()) {
|
||||
String num = rs.getString("num");
|
||||
hasVirtualFields = "2".equals(num);
|
||||
|
||||
} else {
|
||||
hasVirtualFields = false;
|
||||
}
|
||||
} else {
|
||||
COMPANY_TABLE = "hrmcompanyvirtual";
|
||||
SUB_COMPANY_TABLE = "hrmsubcompanyvirtual";
|
||||
|
|
|
|||
|
|
@ -469,7 +469,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
String ecDepartmentID = Util.null2String(syncMap.get("id"));
|
||||
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecDepartmentID), syncMap.get("message").toString());
|
||||
// 更新组织架构图
|
||||
//TODO new DepartmentTriggerRunnable(deptById.getId()).run();
|
||||
// new DepartmentTriggerRunnable(deptById.getId()).run();
|
||||
|
||||
// 复制当前部门岗位信息
|
||||
//if ("1".equals(copyJob)) {
|
||||
|
|
@ -540,7 +540,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
departmentPO.setSubCompanyId1(targetDepartment.getSubCompanyId1());
|
||||
updateEcDepartment(departmentPO);
|
||||
// 更新组织架构图
|
||||
//TODO new DepartmentTriggerRunnable(departmentPO.getId()).run();
|
||||
// new DepartmentTriggerRunnable(departmentPO.getId()).run();
|
||||
}
|
||||
// 查询该部门一级岗位、更新岗位所属分部、所属部门
|
||||
//List<JobPO> firstChildJobList = getJobMapper().listJobsByDepartmentId(mergeParam.getId());
|
||||
|
|
@ -553,7 +553,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
// 更新岗位组织架构图
|
||||
//for (JobPO jobPO : firstChildJobList) {
|
||||
// // 刷新组织架构图
|
||||
// TODO new JobTriggerRunnable(jobPO.getId()).run();
|
||||
// new JobTriggerRunnable(jobPO.getId()).run();
|
||||
//}
|
||||
// 更新当前部门下的人员
|
||||
rs.executeUpdate("update hrmresource set SUBCOMPANYID1 =?,DEPARTMENTID =? where DEPARTMENTID =?", targetDepartment.getSubCompanyId1(), targetEcDeptId, mergeEcDeptId);
|
||||
|
|
@ -561,7 +561,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
//List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(mergeParam.getId().toString());
|
||||
//// 更新人员组织架构图
|
||||
//for (Long hrmResourceId : hrmResourceIds) {
|
||||
//TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
// new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
//}
|
||||
// 更新子部门下岗位的所属分部
|
||||
for (DepartmentPO departmentPO : firstChildDeptList) {
|
||||
|
|
@ -575,13 +575,13 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
// 删除部门
|
||||
ServiceUtil.getService(OrganizationServiceImpl.class, user).doDepartmentCancel(map, user);
|
||||
// 更新组织架构图
|
||||
// TODO new DepartmentTriggerRunnable(mergeDepartment).run();
|
||||
// new DepartmentTriggerRunnable(mergeDepartment).run();
|
||||
// 更新部门合并后名称
|
||||
targetDepartment.setDepartmentName(mergeParam.getMergeName());
|
||||
targetDepartment.setDepartmentMark(mergeParam.getMergeName());
|
||||
updateEcDepartment(targetDepartment);
|
||||
// 更新组织架构图
|
||||
// TODO new DepartmentTriggerRunnable(oldFParentId, targetDepartment.getId()).run();
|
||||
// new DepartmentTriggerRunnable(oldFParentId, targetDepartment.getId()).run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -622,7 +622,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
deptById.setSupDepId(null);
|
||||
|
||||
// 更新组织架构图
|
||||
//TODO new DepartmentTriggerRunnable(company.toString(), deptById).run();
|
||||
// new DepartmentTriggerRunnable(company.toString(), deptById).run();
|
||||
} else if ("1".equals(moveParam.getMoveType())) {
|
||||
Integer departmentId = moveParam.getDepartment();
|
||||
OrganizationAssert.notNull(departmentId, "请选择要转移到的部门");
|
||||
|
|
@ -638,7 +638,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
deptById.setSubCompanyId1(parentDepartment.getSubCompanyId1());
|
||||
|
||||
// 更新组织架构图
|
||||
// TODO new DepartmentTriggerRunnable(Integer.toString(100000000 + department.intValue()), deptById).run();
|
||||
// new DepartmentTriggerRunnable(Integer.toString(100000000 + department.intValue()), deptById).run();
|
||||
}
|
||||
// 更新EC部门
|
||||
updateEcDepartment(deptById);
|
||||
|
|
@ -651,7 +651,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
//// 更新人员组织架构图
|
||||
//List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(deptById.getId().toString());
|
||||
//for (Long hrmResourceId : hrmResourceIds) {
|
||||
//TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
// new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
//}
|
||||
forbiddenChildTag(deptById.getSubCompanyId1(), deptList);
|
||||
// 递归更新下级部门、岗位
|
||||
|
|
@ -672,7 +672,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
updateEcDepartment(departmentPO);
|
||||
|
||||
// 更新组织架构图
|
||||
// TODO new DepartmentTriggerRunnable(departmentPO.getId()).run();
|
||||
// new DepartmentTriggerRunnable(departmentPO.getId()).run();
|
||||
// 刷新岗位所属分部
|
||||
//refreshJobComp(departmentPO.getId(), subCompanyId1);
|
||||
// 更新当前部门下的人员
|
||||
|
|
@ -682,7 +682,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
//List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(departmentPO.getId().toString());
|
||||
//// 更新人员组织架构图
|
||||
//for (Long hrmResourceId : hrmResourceIds) {
|
||||
//TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
// new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
//}
|
||||
List<DepartmentPO> childList = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
|
||||
forbiddenChildTag(subCompanyId1, childList);
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
jobById.setShowOrder(orderNum);
|
||||
insertCount += getJobMapper().insertIgnoreNull(jobById);
|
||||
// 更新组织架构图
|
||||
//TODO new JobTriggerRunnable(jobById.getId()).run();
|
||||
// new JobTriggerRunnable(jobById.getId()).run();
|
||||
}
|
||||
|
||||
return insertCount;
|
||||
|
|
@ -567,14 +567,14 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
// 更新合并后的岗位,更新组织架构图
|
||||
// updateEcJob(targetJob, mergeParam.getMergeName());
|
||||
|
||||
// TODO targetJob.setJobName(mergeParam.getMergeName());
|
||||
// targetJob.setJobName(mergeParam.getMergeName());
|
||||
getJobMapper().updateBaseJob(targetJob);
|
||||
//TODO new JobTriggerRunnable(jobById.getId(), targetJob.getId()).run();
|
||||
// new JobTriggerRunnable(jobById.getId(), targetJob.getId()).run();
|
||||
// 原岗位删除
|
||||
//new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.CANCELED, null, jobById).sync();
|
||||
getJobMapper().deleteByIds(Collections.singletonList(jobById.getId()));
|
||||
// 更新组织架构图
|
||||
//TODO new JobTriggerRunnable(jobById).run();
|
||||
// new JobTriggerRunnable(jobById).run();
|
||||
return updateCount;
|
||||
}
|
||||
|
||||
|
|
@ -614,7 +614,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
// 更新人员信息
|
||||
// updateResourceJob(job);
|
||||
// 更新组织架构图
|
||||
//TODO new JobTriggerRunnable(job.getId()).run();
|
||||
// new JobTriggerRunnable(job.getId()).run();
|
||||
|
||||
// 递归处理子级元素
|
||||
List<JobPO> jobsByPid = getJobMapper().getJobsByPid(job.getId());
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import java.util.Map;
|
|||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/6/27 3:45 PM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class OrgVirtualServiceImpl extends Service implements OrgVirtualService {
|
||||
|
|
|
|||
|
|
@ -180,7 +180,6 @@ public class OrganizationSyncEc {
|
|||
* 封存、解封分部
|
||||
*/
|
||||
private void cancelCompany() {
|
||||
// TODO
|
||||
String forbiddenTag = Util.null2String(params.get("forbiddenTag"));
|
||||
if ("0".equals(forbiddenTag)) {
|
||||
// 解封
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ public class CompanyImport {
|
|||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.ADD, map, false).sync();
|
||||
if (OrgImportUtil.isThrowError(syncMap)) {
|
||||
// 刷新组织架构图
|
||||
//TODO new CompanyTriggerRunnable(infoParams.getId()).run();
|
||||
// new CompanyTriggerRunnable(infoParams.getId()).run();
|
||||
historyDetailPO.setOperateDetail("添加成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
} else {
|
||||
|
|
@ -274,7 +274,7 @@ public class CompanyImport {
|
|||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, map, false).sync();
|
||||
if (OrgImportUtil.isThrowError(syncMap)) {
|
||||
// 刷新组织架构图
|
||||
//TODO new CompanyTriggerRunnable(companyId).run();
|
||||
// new CompanyTriggerRunnable(companyId).run();
|
||||
historyDetailPO.setOperateDetail("更新成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ public class DepartmentImport {
|
|||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map, false).sync();
|
||||
if (OrgImportUtil.isThrowError(syncMap)) {
|
||||
// 刷新组织架构图
|
||||
//TODO new DepartmentTriggerRunnable(departmentId).run();
|
||||
// new DepartmentTriggerRunnable(departmentId).run();
|
||||
historyDetailPO.setOperateDetail("更新成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import java.util.Map;
|
|||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/6/27 3:41 PM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class OrgVirtualController {
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ public class JobWrapper extends OrganizationWrapper {
|
|||
}.getClass(), jobById.getJobNo(), JSON.toJSONString(params), jobById, newJobById);
|
||||
|
||||
// 更新组织架构图
|
||||
//TODO new Thread(new JobTriggerRunnable(jobById, newJobById)).start();
|
||||
// new Thread(new JobTriggerRunnable(jobById, newJobById)).start();
|
||||
return updateForbiddenTagById;
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ public class JobWrapper extends OrganizationWrapper {
|
|||
writeOperateLog(new Object() {
|
||||
}.getClass(), jobPO.getJobTitleName(), JSON.toJSONString(ids), "删除岗位");
|
||||
// 更新组织架构图
|
||||
// TODO new JobTriggerRunnable(jobPO).run();
|
||||
// new JobTriggerRunnable(jobPO).run();
|
||||
}
|
||||
return deleteByIds;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ public class OrgChartWrapper extends Service {
|
|||
}
|
||||
|
||||
public Map<String, Object> asyncCompanyData(Map<String, Object> request2Map, User user) {
|
||||
return getOrgChartService(user).asyncCompanyData(request2Map, user);
|
||||
// return getOrgChartService(user).asyncCompanyData(request2Map, user);
|
||||
return getChartService(user).asyncCompanyData(request2Map);
|
||||
}
|
||||
|
||||
public String synchronousData(Map<String, Object> request2Map) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import java.util.Map;
|
|||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/6/27 3:42 PM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class OrgVirtualWrapper extends Service {
|
||||
|
|
|
|||
Loading…
Reference in New Issue