diff --git a/src/com/engine/organization/entity/chart/StatisticsVO.java b/src/com/engine/organization/entity/chart/StatisticsVO.java new file mode 100644 index 00000000..80b90f55 --- /dev/null +++ b/src/com/engine/organization/entity/chart/StatisticsVO.java @@ -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; + + +} diff --git a/src/com/engine/organization/service/ChartService.java b/src/com/engine/organization/service/ChartService.java index cff12446..ed8594d4 100644 --- a/src/com/engine/organization/service/ChartService.java +++ b/src/com/engine/organization/service/ChartService.java @@ -72,4 +72,13 @@ public interface ChartService { * @return */ Map getFullSelectTree(Map params); + + /** + * @Description: 人数统计页面 + * @Author: liang.cheng + * @Date: 2023/9/11 4:51 PM + * @param: [request2Map] + * @return: java.util.Map + */ + Map selectStatistics(Map params); } diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index 9c472bdf..3b6aeae8 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -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 selectStatistics(Map params) { + RecordSet rs = new RecordSet(); + Map result = new HashMap<>(4); + DepartmentComInfo departmentComInfo = new DepartmentComInfo(); + ResourceComInfo resourceComInfo = new ResourceComInfo(); + SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo(); + List 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; + } + /** * 添加树结构所有上级节点 * diff --git a/src/com/engine/organization/web/OrgChartController.java b/src/com/engine/organization/web/OrgChartController.java index 86e1d17a..288db4ca 100644 --- a/src/com/engine/organization/web/OrgChartController.java +++ b/src/com/engine/organization/web/OrgChartController.java @@ -209,7 +209,7 @@ public class OrgChartController { @Produces(MediaType.APPLICATION_JSON) public String getUserData(@Context HttpServletRequest request, @Context HttpServletResponse response) { - Map apidatas = new HashMap(); + Map 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 apidatas = new HashMap(); + Map 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 apidatas = new HashMap(); + Map 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 params = ParamUtil.request2Map(request); + return ReturnResult.successed(getOrgChartWrapper(user).selectStatistics(params)); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e); + } + } + + } diff --git a/src/com/engine/organization/wrapper/OrgChartWrapper.java b/src/com/engine/organization/wrapper/OrgChartWrapper.java index 6cb8fb97..935b0523 100644 --- a/src/com/engine/organization/wrapper/OrgChartWrapper.java +++ b/src/com/engine/organization/wrapper/OrgChartWrapper.java @@ -80,4 +80,8 @@ public class OrgChartWrapper extends Service { public Map getFullSelectTree(Map request2Map, User user) { return getChartService(user).getFullSelectTree(request2Map); } + + public Map selectStatistics(Map request2Map) { + return getChartService(user).selectStatistics(request2Map); + } }