|
|
@@ -10,7 +10,6 @@ import com.xunmei.common.core.exception.ServiceException;
|
|
|
import com.xunmei.common.core.utils.DateUtils;
|
|
|
import com.xunmei.common.core.utils.NumberUtils;
|
|
|
import com.xunmei.common.core.utils.StringUtils;
|
|
|
-import com.xunmei.core.board.dto.app.AppSyntheticQuestionDto;
|
|
|
import com.xunmei.core.board.dto.web.TaskStatisticDto;
|
|
|
import com.xunmei.core.board.dto.web.WebGA38InfoDto;
|
|
|
import com.xunmei.core.board.dto.web.WebSyntheticQuestionDto;
|
|
|
@@ -43,7 +42,7 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
@Override
|
|
|
public List<TaskStatisticVo> resumption(TaskStatisticDto dto) {
|
|
|
Date date = getStartDate(dto.getPeriod());
|
|
|
- SysOrg org = remoteOrgService.selectOrgById(dto.getOrgId(), SecurityConstants.INNER);
|
|
|
+ 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());
|
|
|
@@ -52,10 +51,10 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
@Override
|
|
|
public List<WebSafetyCheckVo> safetyCheck(TaskStatisticDto dto) {
|
|
|
Date date = getStartDate(dto.getPeriod());
|
|
|
- SysOrg org = remoteOrgService.selectOrgById(dto.getOrgId(), SecurityConstants.INNER);
|
|
|
+ SysOrg org = getOrgThrowIfNull(dto.getOrgId());
|
|
|
|
|
|
// String orgPath = org.getPath();
|
|
|
- List<WebSafetyCheckVo> list = cockpitMapper.safetyCheck(date, DateUtil.endOfDay(new Date()), dto.getOrgPath());
|
|
|
+ List<WebSafetyCheckVo> list = cockpitMapper.safetyCheck(date, DateUtil.endOfDay(new Date()), org.getPath());
|
|
|
List<SysDictData> dicts = remoteDictDataService.selectDictByeType("check_type", SecurityConstants.INNER);
|
|
|
List<WebSafetyCheckVo> r = dicts.stream().map(d -> {
|
|
|
Optional<WebSafetyCheckVo> voOpt = list.stream().filter(i -> ObjectUtil.equal(i.getType(), d.getDictValue())).findFirst();
|
|
|
@@ -77,27 +76,27 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
@Obsolete
|
|
|
public List<TaskStatisticVo> monitor(TaskStatisticDto dto) {
|
|
|
Date date = getStartDate(dto.getPeriod());
|
|
|
- SysOrg org = remoteOrgService.selectOrgById(dto.getOrgId(), SecurityConstants.INNER);
|
|
|
+ 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, dto.getOrgId());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<TaskStatisticVo> edu(TaskStatisticDto dto) {
|
|
|
Date date = getStartDate(dto.getPeriod());
|
|
|
- SysOrg org = remoteOrgService.selectOrgById(dto.getOrgId(), SecurityConstants.INNER);
|
|
|
+ SysOrg org = getOrgThrowIfNull(dto.getOrgId());
|
|
|
String orgPath = org.getPath();
|
|
|
List<TaskStatisticVo> list = cockpitMapper.edu(date, DateUtil.endOfDay(new Date()), orgPath);
|
|
|
- return taskStatistic(list, dto.getOrgId());
|
|
|
+ return taskStatistic(list, dto.getOrgId());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<WebDrillInfoVo> drill(TaskStatisticDto dto) {
|
|
|
Date date = getStartDate(dto.getPeriod());
|
|
|
-// SysOrg org = remoteOrgService.selectOrgById(dto.getOrgId(), SecurityConstants.INNER);
|
|
|
+ SysOrg org = getOrgThrowIfNull(dto.getOrgId());
|
|
|
// String orgPath = org.getPath();
|
|
|
- List<TaskStatisticVo> list = cockpitMapper.drill(date, DateUtil.endOfDay(new Date()), dto.getOrgPath());
|
|
|
+ List<TaskStatisticVo> list = cockpitMapper.drill(date, DateUtil.endOfDay(new Date()), org.getPath());
|
|
|
list = taskStatistic(list, dto.getOrgId());
|
|
|
|
|
|
List<WebDrillInfoVo> r = list.stream().map(i -> {
|
|
|
@@ -114,16 +113,16 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
@Override
|
|
|
public List<OrgGA38StatisticVo> orgGA38(TaskStatisticDto dto) {
|
|
|
Date date = getStartDate(dto.getPeriod());
|
|
|
- SysOrg org = remoteOrgService.selectOrgById(dto.getOrgId(), SecurityConstants.INNER);
|
|
|
+ SysOrg org = getOrgThrowIfNull(dto.getOrgId());
|
|
|
List<WebGA38InfoDto> data = cockpitMapper.orgGA38(org.getPath(), date);
|
|
|
List<OrgGA38StatisticVo> r = getGA38Children(dto.getOrgId());
|
|
|
for (WebGA38InfoDto orgVo : data) {
|
|
|
for (OrgGA38StatisticVo statisticVo : r) {
|
|
|
if (orgVo.getPath().startsWith(statisticVo.getOrgPath())) {
|
|
|
statisticVo.setTotal(1 + statisticVo.getTotal());
|
|
|
- statisticVo.setGa382021(1 + statisticVo.getGa382021());
|
|
|
- statisticVo.setGa382021(1 + statisticVo.getGa382021());
|
|
|
- if (statisticVo.getGa382021() > 0 || statisticVo.getGa382015() > 0) {
|
|
|
+ statisticVo.setGa382021(orgVo.getGa382021() + statisticVo.getGa382021());
|
|
|
+ statisticVo.setGa382015(orgVo.getGa382015() + statisticVo.getGa382015());
|
|
|
+ if (orgVo.getGa382021() > 0 || orgVo.getGa382015() > 0) {
|
|
|
statisticVo.setReachCount(1 + statisticVo.getReachCount());
|
|
|
}
|
|
|
// statisticVo.setReachCount(orgVo.getReachCount() + statisticVo.getReachCount());
|
|
|
@@ -138,7 +137,7 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
r.sort(new Comparator<OrgGA38StatisticVo>() {
|
|
|
@Override
|
|
|
public int compare(OrgGA38StatisticVo o1, OrgGA38StatisticVo o2) {
|
|
|
- return -NumberUtil.compare(o2.getReachRate(), o1.getReachRate());
|
|
|
+ return NumberUtil.compare(o2.getReachRate(), o1.getReachRate());
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -152,8 +151,24 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public OrgInfoVo orgInfo(String orgPath) {
|
|
|
- return cockpitMapper.orgInfo(orgPath);
|
|
|
+ public OrgInfoVo orgInfo(Long orgId) {
|
|
|
+ SysOrg org = getOrgThrowIfNull(orgId);
|
|
|
+ return cockpitMapper.orgInfo(org.getPath());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 机构信息
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public OrgSecurityInfoVo orgSecurityInfo(Long orgId) {
|
|
|
+ SysOrg org = getOrgThrowIfNull(orgId);
|
|
|
+ OrgSecurityInfoVo vo = cockpitMapper.orgSecurityInfo(org.getPath());
|
|
|
+ vo.setEquippedRate(NumberUtils.computeRate(vo.getEquippedCount() + vo.getUnequippedCount(), vo.getEquippedCount()));
|
|
|
+ vo.setUnequippedRate(NumberUtils.computeRate(vo.getEquippedCount() + vo.getUnequippedCount(), vo.getUnequippedCount()));
|
|
|
+
|
|
|
+ return vo;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -163,9 +178,10 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public VisitInfoVo currentMonthVisitInfo(String orgPath) {
|
|
|
+ public VisitInfoVo currentMonthVisitInfo(Long orgId) {
|
|
|
+ SysOrg org = getOrgThrowIfNull(orgId);
|
|
|
DateRange range = DateUtils.getStartAndEnd(new Date(), CycleCommonEnum.MONTHLY);
|
|
|
- VisitInfoVo vo = cockpitMapper.currentMonthVisitInfo(orgPath, range.getStartTime());
|
|
|
+ VisitInfoVo vo = cockpitMapper.currentMonthVisitInfo(org.getPath(), range.getStartTime());
|
|
|
int total = vo.getPaperCount() + vo.getElectronicCount() + vo.getUrgencyCount();
|
|
|
vo.setElectronicRate(NumberUtils.computeRate(total, vo.getElectronicCount()));
|
|
|
vo.setUrgencyRate(NumberUtils.computeRate(total, vo.getUrgencyCount()));
|
|
|
@@ -176,13 +192,14 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
|
|
|
@Override
|
|
|
public QuestionStatisticVo question(TaskStatisticDto dto) {
|
|
|
+ SysOrg org = getOrgThrowIfNull(dto.getOrgId());
|
|
|
Date date = getStartDate(dto.getPeriod());
|
|
|
|
|
|
- WebSyntheticQuestionDto questionDto = cockpitMapper.selectQuestion(dto.getOrgPath(), date);
|
|
|
+ WebSyntheticQuestionDto questionDto = cockpitMapper.selectQuestion(org.getPath(), date);
|
|
|
if (ObjectUtil.isNull(questionDto)) {
|
|
|
questionDto = new WebSyntheticQuestionDto();
|
|
|
}
|
|
|
- Map<String, Long> overdueCount = cockpitMapper.selectOverDueQuestionCount(dto.getOrgPath(), date);
|
|
|
+ Map<String, Long> overdueCount = cockpitMapper.selectOverDueQuestionCount(org.getPath(), date);
|
|
|
|
|
|
QuestionStatisticVo vo = new QuestionStatisticVo();
|
|
|
vo.setTotal(questionDto.getTotal());
|
|
|
@@ -193,9 +210,9 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
vo.setReformed(NumberUtils.computeRate(questionDto.getTotal(), questionDto.getReformedCount()));
|
|
|
|
|
|
if (overdueCount.size() > 0) {
|
|
|
- Long count=overdueCount.get("count");
|
|
|
- Long overdue=overdueCount.get("overdueCount");
|
|
|
- vo.setClosed(NumberUtils.computeRate(count.intValue(),overdue.intValue() ));
|
|
|
+ Long count = overdueCount.get("count");
|
|
|
+ Long overdue = overdueCount.get("overdueCount");
|
|
|
+ vo.setClosed(NumberUtils.computeRate(count.intValue(), overdue.intValue()));
|
|
|
} else {
|
|
|
vo.setClosed(1f);
|
|
|
}
|
|
|
@@ -241,14 +258,14 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private DateRange getStartAndEnd(Integer period) {
|
|
|
- Date start = getStartDate(period);
|
|
|
- Date end = DateUtil.endOfDay(new Date());
|
|
|
- return new DateRange(start, end);
|
|
|
- }
|
|
|
+// private DateRange getStartAndEnd(Integer period) {
|
|
|
+// Date start = getStartDate(period);
|
|
|
+// Date end = DateUtil.endOfDay(new Date());
|
|
|
+// return new DateRange(start, end);
|
|
|
+// }
|
|
|
|
|
|
private List<TaskStatisticVo> getTaskChildren(Long orgId) {
|
|
|
- List<SysOrg> children = remoteOrgService.selectOrgTreeListByCurOrgId(orgId, SecurityConstants.INNER);
|
|
|
+ List<SysOrg> children = remoteOrgService.selectChildrenFromDb(orgId, SecurityConstants.INNER);
|
|
|
List<TaskStatisticVo> list = new ArrayList<>();
|
|
|
|
|
|
for (SysOrg child : children) {
|
|
|
@@ -269,7 +286,7 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
}
|
|
|
|
|
|
private List<OrgGA38StatisticVo> getGA38Children(Long orgId) {
|
|
|
- List<SysOrg> children = remoteOrgService.selectOrgTreeListByCurOrgId(orgId, SecurityConstants.INNER);
|
|
|
+ List<SysOrg> children = remoteOrgService.selectChildrenFromDb(orgId, SecurityConstants.INNER);
|
|
|
List<OrgGA38StatisticVo> list = new ArrayList<>();
|
|
|
for (SysOrg child : children) {
|
|
|
OrgGA38StatisticVo vo = new OrgGA38StatisticVo();
|
|
|
@@ -288,6 +305,15 @@ public class CockpitServiceImpl implements CockpitService {
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
+ private SysOrg getOrgThrowIfNull(Long orgId) {
|
|
|
+ SysOrg org = remoteOrgService.selectOrgById(orgId, SecurityConstants.INNER);
|
|
|
+ if (ObjectUtil.isNull(org)) {
|
|
|
+ throw new ServiceException("机构不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ return org;
|
|
|
+ }
|
|
|
//
|
|
|
// private List<SysOrg> getChildren(SysOrg org) {
|
|
|
// List<SysOrg> children=remoteOrgService.selectOrgTreeListByCurOrgId(org.getId(), SecurityConstants.INNER);
|