部门统计bug修复

This commit is contained in:
wanghao
2026-01-09 16:06:36 +08:00
parent 410bd6efa6
commit 58acc58338
7 changed files with 50 additions and 4 deletions
@@ -640,9 +640,9 @@ public class DeptStatisticDataServiceImpl extends ServiceImpl<DeptStatisticDataM
private DeptStatData transferData(SysDepart depart, DepartStatTransfer transfer) { private DeptStatData transferData(SysDepart depart, DepartStatTransfer transfer) {
DeptStatData deptStatData = new DeptStatData(); DeptStatData deptStatData = new DeptStatData();
String orgCode = depart.getOrgCode(); String orgCode = null != depart ? depart.getOrgCode() : null;
boolean allSecond = StrUtil.isEmpty(transfer.filter().getOrgCode()); boolean allSecond = StrUtil.isEmpty(transfer.filter().getOrgCode());
boolean isSecond = orgCode.length() == 6; boolean isSecond = StrUtil.isNotEmpty(orgCode) && orgCode.length() == 6;
if (isSecond) { if (isSecond) {
deptStatData.setOrgCode(orgCode); deptStatData.setOrgCode(orgCode);
deptStatData.setOrgCodeLeaf(orgCode); deptStatData.setOrgCodeLeaf(orgCode);
@@ -657,7 +657,7 @@ public class DeptStatisticDataServiceImpl extends ServiceImpl<DeptStatisticDataM
deptStatData.setOrgCode(Optional.ofNullable(transfer.secondDepart()).map(SysDepart::getOrgCode).orElse("")); deptStatData.setOrgCode(Optional.ofNullable(transfer.secondDepart()).map(SysDepart::getOrgCode).orElse(""));
deptStatData.setOrgCodeLeaf(orgCode); deptStatData.setOrgCodeLeaf(orgCode);
deptStatData.setOrgCodeName(Optional.ofNullable(transfer.secondDepart()).map(SysDepart::getDepartName).orElse("")); deptStatData.setOrgCodeName(Optional.ofNullable(transfer.secondDepart()).map(SysDepart::getDepartName).orElse(""));
deptStatData.setOrgCodeLeafName(depart.getDepartName()); deptStatData.setOrgCodeLeafName(null!=depart ? depart.getDepartName() : "");
} }
fillWatchNums( fillWatchNums(
deptStatData, deptStatData,
@@ -802,7 +802,7 @@ public class DeptStatisticDataServiceImpl extends ServiceImpl<DeptStatisticDataM
} else { } else {
return departDeviceNumMap.keySet() return departDeviceNumMap.keySet()
.stream() .stream()
.map(sysCache::getDepartByOrgCode) .map(sysBaseAPI::getDepartIdsByOrgCodeNew)
.sorted(this::departComparator) .sorted(this::departComparator)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@@ -14,6 +14,7 @@ public interface ISysCache {
SysDepart getDepartByOrgCode(String departOrgCode); SysDepart getDepartByOrgCode(String departOrgCode);
String getDepartIdByOrgCode(String departOrgCode); String getDepartIdByOrgCode(String departOrgCode);
SysDepart getDepartByIdClient(String departId, boolean qh); SysDepart getDepartByIdClient(String departId, boolean qh);
@@ -505,6 +505,15 @@ public interface ISysBaseAPI extends CommonAPI {
@GetMapping("/sys/api/getDepartIdsByOrgCode") @GetMapping("/sys/api/getDepartIdsByOrgCode")
public String getDepartIdsByOrgCode(@RequestParam("orgCode") String orgCode); public String getDepartIdsByOrgCode(@RequestParam("orgCode") String orgCode);
/**
* 22通过部门编号查询部门id
*
* @param orgCode
* @return
*/
@GetMapping("/sys/api/getDepartIdsByOrgCodeNew")
public SysDepart getDepartIdsByOrgCodeNew(@RequestParam("orgCode") String orgCode);
/** /**
* 23查询所有部门 * 23查询所有部门
* *
@@ -295,6 +295,11 @@ public class SysBaseAPIFallback implements ISysBaseAPI {
return null; return null;
} }
@Override
public SysDepart getDepartIdsByOrgCodeNew(String orgCode) {
return null;
}
@Override @Override
public List<SysDepartModel> getAllSysDepart() { public List<SysDepartModel> getAllSysDepart() {
return null; return null;
@@ -20,6 +20,7 @@ import org.jeecg.common.bean.transfer.UserWeightSign;
import org.jeecg.common.system.vo.*; import org.jeecg.common.system.vo.*;
import org.jeecg.modules.system.bean.UserEmployee; import org.jeecg.modules.system.bean.UserEmployee;
import org.jeecg.modules.system.entity.HealthUserEmployeeEx; import org.jeecg.modules.system.entity.HealthUserEmployeeEx;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.entity.SysUserEmergencyContact; import org.jeecg.modules.system.entity.SysUserEmergencyContact;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@@ -255,6 +256,14 @@ public interface ISysBaseAPI extends CommonAPI {
*/ */
public String getDepartIdsByOrgCode(String orgCode); public String getDepartIdsByOrgCode(String orgCode);
/**
* 23通过部门编号查询部门id
*
* @param orgCode
* @return
*/
public SysDepart getDepartIdsByOrgCodeNew(String orgCode);
/** /**
* 24查询所有部门 * 24查询所有部门
* *
@@ -521,6 +521,17 @@ public class SystemApiController {
return sysBaseApi.getDepartIdsByOrgCode(orgCode); return sysBaseApi.getDepartIdsByOrgCode(orgCode);
} }
/**
* 通过部门编号查询部门id
*
* @param orgCode
* @return
*/
@GetMapping("/getDepartIdsByOrgCodeNew")
public SysDepart getDepartIdsByOrgCodeNew(@RequestParam("orgCode") String orgCode) {
return sysBaseApi.getDepartIdsByOrgCodeNew(orgCode);
}
/** /**
* 查询所有部门 * 查询所有部门
* *
@@ -1371,6 +1371,17 @@ public class SysBaseApiImpl implements ISysBaseAPI {
return departMapper.queryDepartIdByOrgCode(orgCode); return departMapper.queryDepartIdByOrgCode(orgCode);
} }
@Override
public SysDepart getDepartIdsByOrgCodeNew(String orgCode) {
LambdaQueryWrapper<SysDepart> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysDepart::getOrgCode, orgCode);
List<SysDepart> sysDeparts = departMapper.selectList(queryWrapper);
if (CollUtil.isEmpty(sysDeparts)) {
return null;
}
return sysDeparts.get(0);
}
@Override @Override
public List<SysDepartModel> getAllSysDepart() { public List<SysDepartModel> getAllSysDepart() {
List<SysDepartModel> departModelList = new ArrayList<SysDepartModel>(); List<SysDepartModel> departModelList = new ArrayList<SysDepartModel>();