中远组织架构图编制统计优化需求

上海中远重工组织架构图
Chengliang 5 months ago
parent c7d9b53e13
commit 6c54bae6f2

@ -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 + '\'' +
'}';
}
}

@ -6,6 +6,7 @@ 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;
@ -754,7 +755,6 @@ public class ChartServiceImpl extends Service implements ChartService {
ArrayList<Integer> list = new ArrayList<>();
list.add(stp.getDataId());
BaseBean bb = new BaseBean();
if (ModuleTypeEnum.departmentfielddefined.getValue().equals(stp.getType())) {
dept.getAllChildDeptByDepId(list,String.valueOf(stp.getDataId()));
String value = StringUtils.join(list,",");
@ -765,13 +765,32 @@ public class ChartServiceImpl extends Service implements ChartService {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
String currentYearMonth = currentDateTime.format(formatter);
// 部门编制人数向下汇总
List<Integer> bzList = new ArrayList<>();
rs.executeQuery("select bzrs from uf_bzgljmb where bm in ("+value+") and ny = ?",currentYearMonth);
// 部门编制人数向下汇总 20250122 优化需求
List<ModeStaffPO> bzList = new ArrayList<>();
rs.executeQuery("select bzrs,ny from uf_bzgljmb where bm in ("+value+")");
while (rs.next()) {
bzList.add(Util.getIntValue(rs.getString("bzrs"), 0));
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 = modeStaffPOS.stream().mapToInt(ModeStaffPO::getCount).sum();
}
int sum = bzList.stream().mapToInt(Integer::intValue).sum();
stp.setStaffNum(sum);
}

Loading…
Cancel
Save