Merge pull request '组织架构图人数统计' (#216) from feature/cl into develop
Reviewed-on: http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization/pulls/216
This commit is contained in:
commit
e57af84b06
|
|
@ -0,0 +1,41 @@
|
|||
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;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/9/11 4:59 PM
|
||||
* @Description: 人数统计
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class StatisticsVO {
|
||||
|
||||
private Integer key;
|
||||
|
||||
private String dataIdName;
|
||||
|
||||
private String superIdName;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private Integer onJobNum;
|
||||
|
||||
private Integer staffNum;
|
||||
|
||||
private String creator;
|
||||
|
||||
private String createTime;
|
||||
|
||||
private String updateTime;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -72,4 +72,13 @@ public interface ChartService {
|
|||
* @return
|
||||
*/
|
||||
Map<String, Object> getFullSelectTree(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* @Description: 人数统计页面
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2023/9/11 4:51 PM
|
||||
* @param: [request2Map]
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
*/
|
||||
Map<String, Object> selectStatistics(Map<String, Object> params);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import com.engine.common.util.ServiceUtil;
|
|||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.chart.ChartPO;
|
||||
import com.engine.organization.entity.chart.CompanyTreePO;
|
||||
import com.engine.organization.entity.chart.StatisticsVO;
|
||||
import com.engine.organization.entity.chart.TreeSelect;
|
||||
import com.engine.organization.enums.ModuleTypeEnum;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.service.ChartService;
|
||||
import com.engine.organization.service.OrgChartService;
|
||||
|
|
@ -13,6 +15,7 @@ import com.engine.organization.util.OrganizationAssert;
|
|||
import com.engine.organization.util.OrganizationDateUtil;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
|
|
@ -515,6 +518,45 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Map<String, Object> selectStatistics(Map<String, Object> params) {
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String, Object> result = new HashMap<>(4);
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
List<StatisticsVO> statisticsVOS = new ArrayList<>();
|
||||
rs.executeQuery("select id,data_id,super_id,type,on_job_num,staff_num,creator,create_time,update_time from jcl_org_onjob");
|
||||
while (rs.next()) {
|
||||
Integer type = Util.getIntValue(rs.getString("type"));
|
||||
String dataIdName = "";
|
||||
String superIdName = "";
|
||||
if (ModuleTypeEnum.subcompanyfielddefined.getValue().equals(type)) {
|
||||
dataIdName = subCompanyComInfo.getSubCompanyname(Util.null2String((rs.getString("data_id"))));
|
||||
superIdName = subCompanyComInfo.getSubCompanyname(Util.null2String((rs.getString("super_id"))));
|
||||
}else {
|
||||
dataIdName = departmentComInfo.getDepartmentname(Util.null2String((rs.getString("data_id"))));
|
||||
superIdName = departmentComInfo.getDepartmentname(Util.null2String((rs.getString("super_id"))));
|
||||
}
|
||||
|
||||
StatisticsVO statisticsVO = StatisticsVO.builder()
|
||||
.key(Util.getIntValue(rs.getString("id")))
|
||||
.dataIdName(dataIdName)
|
||||
.superIdName(superIdName)
|
||||
.type(type)
|
||||
.onJobNum(Util.getIntValue(rs.getString("on_job_num")))
|
||||
.staffNum(Util.getIntValue(rs.getString("staff_num")))
|
||||
.creator(resourceComInfo.getLastname(Util.null2String(rs.getString("creator"))))
|
||||
.createTime(Util.null2String(rs.getString("create_time")))
|
||||
.updateTime(Util.null2String(rs.getString("update_time")))
|
||||
.build();
|
||||
statisticsVOS.add(statisticsVO);
|
||||
}
|
||||
result.put("result",statisticsVOS);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加树结构所有上级节点
|
||||
*
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ public class OrgChartController {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getUserData(@Context HttpServletRequest request, @Context HttpServletResponse
|
||||
response) {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
//实例化Service 并调用业务类处理
|
||||
|
|
@ -232,7 +232,7 @@ public class OrgChartController {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String asyncUserData(@Context HttpServletRequest request, @Context HttpServletResponse
|
||||
response) {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
//实例化Service 并调用业务类处理
|
||||
|
|
@ -255,7 +255,7 @@ public class OrgChartController {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String asyncCompanyData(@Context HttpServletRequest request, @Context HttpServletResponse
|
||||
response) {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
//实例化Service 并调用业务类处理
|
||||
|
|
@ -287,4 +287,19 @@ public class OrgChartController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/selectStatistics")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult selectStatistics(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getOrgChartWrapper(user).selectStatistics(params));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,4 +80,8 @@ public class OrgChartWrapper extends Service {
|
|||
public Map<String, Object> getFullSelectTree(Map<String, Object> request2Map, User user) {
|
||||
return getChartService(user).getFullSelectTree(request2Map);
|
||||
}
|
||||
|
||||
public Map<String, Object> selectStatistics(Map<String, Object> request2Map) {
|
||||
return getChartService(user).selectStatistics(request2Map);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue