|
|
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
import com.xunmei.common.core.domain.DateRange;
|
|
|
import com.xunmei.common.core.enums.CycleCommonEnum;
|
|
|
+import com.xunmei.common.core.enums.OrgTypeEnum;
|
|
|
import com.xunmei.common.core.exception.ServiceException;
|
|
|
import com.xunmei.common.core.utils.DateUtils;
|
|
|
import com.xunmei.common.core.utils.NumberUtils;
|
|
|
@@ -46,7 +47,7 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
SysOrg org = getOrgThrowIfNull(dto.getOrgId());
|
|
|
String orgPath = org.getPath();
|
|
|
List<TaskStatisticVo> list = cockpitMapper.resumption(date, DateUtil.endOfDay(new Date()), orgPath);
|
|
|
- return taskStatistic(list, dto.getOrgId());
|
|
|
+ return taskStatistic(list, org, Arrays.asList(OrgTypeEnum.LIHANG_ZIZHU_YINGHANG.getCode(), OrgTypeEnum.YINGYE_WANGDIAN.getCode()));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -111,7 +112,7 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
SysOrg org = getOrgThrowIfNull(dto.getOrgId());
|
|
|
String orgPath = org.getPath();
|
|
|
List<TaskStatisticVo> list = cockpitMapper.monitor(date, DateUtil.endOfDay(new Date()), orgPath);
|
|
|
- return taskStatistic(list, dto.getOrgId());
|
|
|
+ return taskStatistic(list, org, Arrays.asList(OrgTypeEnum.LIHANG_ZIZHU_YINGHANG.getCode(), OrgTypeEnum.YINGYE_WANGDIAN.getCode()));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -120,7 +121,7 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
SysOrg org = getOrgThrowIfNull(dto.getOrgId());
|
|
|
String orgPath = org.getPath();
|
|
|
List<TaskStatisticVo> list = cockpitMapper.edu(date, DateUtil.endOfDay(new Date()), orgPath);
|
|
|
- list = taskStatistic(list, dto.getOrgId());
|
|
|
+ list = taskStatistic(list, org, Arrays.asList(OrgTypeEnum.YINGYE_WANGDIAN.getCode()));
|
|
|
|
|
|
list.sort(Comparator.comparing(TaskStatisticVo::getCompletedRate));
|
|
|
Collections.reverse(list);
|
|
|
@@ -134,7 +135,7 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
SysOrg org = getOrgThrowIfNull(dto.getOrgId());
|
|
|
// String orgPath = org.getPath();
|
|
|
List<TaskStatisticVo> list = cockpitMapper.drill(date, DateUtil.endOfDay(new Date()), org.getPath());
|
|
|
- list = taskStatistic(list, dto.getOrgId());
|
|
|
+ list = taskStatistic(list, org, Arrays.asList(OrgTypeEnum.YINGYE_WANGDIAN.getCode()));
|
|
|
|
|
|
List<WebDrillInfoVo> r = list.stream().map(i -> {
|
|
|
WebDrillInfoVo vo = new WebDrillInfoVo();
|
|
|
@@ -156,7 +157,7 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
Date date = getStartDate(dto.getPeriod());
|
|
|
SysOrg org = getOrgThrowIfNull(dto.getOrgId());
|
|
|
List<WebGA38InfoDto> data = cockpitMapper.orgGA38(org.getPath(), date);
|
|
|
- List<OrgGA38StatisticVo> r = getGA38Children(dto.getOrgId());
|
|
|
+ List<OrgGA38StatisticVo> r = getGA38Children(org, Arrays.asList(OrgTypeEnum.LIHANG_ZIZHU_YINGHANG.getCode(), OrgTypeEnum.YINGYE_WANGDIAN.getCode()));
|
|
|
for (WebGA38InfoDto orgVo : data) {
|
|
|
for (OrgGA38StatisticVo statisticVo : r) {
|
|
|
if (orgVo.getPath().startsWith(statisticVo.getOrgPath())) {
|
|
|
@@ -281,21 +282,21 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
}
|
|
|
|
|
|
Optional<OrgMapDto> mapOption = orgMaps.stream().filter(o -> ObjectUtil.equal(orgId, o.getOrgId())).findFirst();
|
|
|
- if(!mapOption.isPresent()){
|
|
|
+ if (!mapOption.isPresent()) {
|
|
|
return vo;
|
|
|
}
|
|
|
|
|
|
vo.setMap(mapOption.get().getMap());
|
|
|
- List<OrgSiteInfo> sites= orgMaps.stream().filter(o->ObjectUtil.isNotNull(o.getLatitude()) && ObjectUtil.isNotNull(o.getLatitude()) )
|
|
|
- .map(o->new OrgSiteInfo(o.getLongitude(),o.getLatitude(),o.getOrgName()))
|
|
|
+ List<OrgSiteInfo> sites = orgMaps.stream().filter(o -> ObjectUtil.isNotNull(o.getLatitude()) && ObjectUtil.isNotNull(o.getLatitude()))
|
|
|
+ .map(o -> new OrgSiteInfo(o.getLongitude(), o.getLatitude(), o.getOrgName()))
|
|
|
.collect(Collectors.toList());
|
|
|
vo.setSites(sites);
|
|
|
|
|
|
return vo;
|
|
|
}
|
|
|
|
|
|
- private List<TaskStatisticVo> taskStatistic(List<TaskStatisticVo> data, Long orgId) {
|
|
|
- List<TaskStatisticVo> r = getTaskChildren(orgId);
|
|
|
+ private List<TaskStatisticVo> taskStatistic(List<TaskStatisticVo> data, SysOrg parent, List<Integer> hsChildType) {
|
|
|
+ List<TaskStatisticVo> r = getTaskChildren(parent, hsChildType);
|
|
|
for (TaskStatisticVo orgVo : data) {
|
|
|
for (TaskStatisticVo statisticVo : r) {
|
|
|
if (orgVo.getOrgPath().startsWith(statisticVo.getOrgPath())) {
|
|
|
@@ -337,12 +338,16 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
return new DateRange(start, end);
|
|
|
}
|
|
|
|
|
|
- private List<TaskStatisticVo> getTaskChildren(Long orgId) {
|
|
|
- List<SysOrg> children = remoteOrgService.selectChildrenFromDb(orgId, SecurityConstants.INNER);
|
|
|
+ private List<TaskStatisticVo> getTaskChildren(SysOrg parent, List<Integer> hsChildType) {
|
|
|
+ List<SysOrg> children = remoteOrgService.selectChildrenFromDb(parent.getId(), SecurityConstants.INNER);
|
|
|
// children.sort(Comparator.comparing(SysOrg::getSort));
|
|
|
List<TaskStatisticVo> list = new ArrayList<>();
|
|
|
|
|
|
for (SysOrg child : children) {
|
|
|
+ if (ObjectUtil.equal(parent.getType(), OrgTypeEnum.HANG_SHE.getCode()) &&
|
|
|
+ !hsChildType.contains(child.getType())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
TaskStatisticVo vo = new TaskStatisticVo();
|
|
|
vo.setOrgPath(child.getPath());
|
|
|
vo.setOrgId(child.getId());
|
|
|
@@ -359,10 +364,14 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
- private List<OrgGA38StatisticVo> getGA38Children(Long orgId) {
|
|
|
- List<SysOrg> children = remoteOrgService.selectChildrenFromDb(orgId, SecurityConstants.INNER);
|
|
|
+ private List<OrgGA38StatisticVo> getGA38Children(SysOrg parent, List<Integer> hsChildType) {
|
|
|
+ List<SysOrg> children = remoteOrgService.selectChildrenFromDb(parent.getId(), SecurityConstants.INNER);
|
|
|
List<OrgGA38StatisticVo> list = new ArrayList<>();
|
|
|
for (SysOrg child : children) {
|
|
|
+ if (ObjectUtil.equal(parent.getType(), OrgTypeEnum.HANG_SHE.getCode()) &&
|
|
|
+ !hsChildType.contains(child.getType())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
OrgGA38StatisticVo vo = new OrgGA38StatisticVo();
|
|
|
vo.setOrgPath(child.getPath());
|
|
|
vo.setOrgId(child.getId());
|