|
@@ -206,11 +206,7 @@ public class AnalysisSynthesizeServiceImpl {
|
|
|
* @param organizationId
|
|
|
* @return
|
|
|
*/
|
|
|
- public SynthesizeCompanyVo organizationVisit(String type, String organizationId,String createTime,String endTime,List<String> personId) {
|
|
|
- //存在人员,统计人员
|
|
|
- if (!CollectionUtils.isEmpty(personId)){
|
|
|
- organizationId = null;
|
|
|
- }
|
|
|
+ public SynthesizeCompanyVo organizationVisit(String type, String organizationId,String createTime,String endTime) {
|
|
|
//开始时间和结束时间都不为空,按照选中时间过滤,忽略type
|
|
|
if (!StringUtils.isEmpty(createTime) && !StringUtils.isEmpty(endTime)){
|
|
|
type = null;
|
|
@@ -219,20 +215,20 @@ public class AnalysisSynthesizeServiceImpl {
|
|
|
int year = calendar.get(Calendar.YEAR);
|
|
|
SynthesizeCompanyVo result;
|
|
|
if ("total".equals(type)) {
|
|
|
- result = analysisSynthesizeMapper.organizationVisit(null, null, organizationId,personId);
|
|
|
+ result = analysisSynthesizeMapper.organizationVisit(null, null, organizationId);
|
|
|
} else if ("year".equals(type)) {
|
|
|
result = analysisSynthesizeMapper.organizationVisit(DateUtils.format(DateUtils.getFirstOfYear(year)),
|
|
|
- DateUtils.format(DateUtils.getLastOfYear(year)), organizationId,personId);
|
|
|
+ DateUtils.format(DateUtils.getLastOfYear(year)), organizationId);
|
|
|
} else if ("month".equals(type)) {
|
|
|
int month = calendar.get(Calendar.MONTH);
|
|
|
String firstOfMonth = DateUtils.getFirstOfMonth(year, month + 1, 15);
|
|
|
String lastOfMonth = DateUtils.getLastOfMonth(year, month + 1, 15);
|
|
|
- result = analysisSynthesizeMapper.organizationVisit(firstOfMonth, lastOfMonth, organizationId,personId);
|
|
|
+ result = analysisSynthesizeMapper.organizationVisit(firstOfMonth, lastOfMonth, organizationId);
|
|
|
} else {
|
|
|
- result = analysisSynthesizeMapper.organizationVisit(createTime, endTime, organizationId,personId);
|
|
|
+ result = analysisSynthesizeMapper.organizationVisit(createTime, endTime, organizationId);
|
|
|
}
|
|
|
//人员是空,查出来一定是部门信息
|
|
|
- if (CollectionUtils.isEmpty(personId)){
|
|
|
+
|
|
|
String deptPath = pvLogMapper.findAllDeptIdByDeptId(organizationId);
|
|
|
if (StringUtils.isNotEmpty(deptPath)) {
|
|
|
deptPath = deptPath.substring(deptPath.indexOf(".") + 1);
|
|
@@ -246,10 +242,7 @@ public class AnalysisSynthesizeServiceImpl {
|
|
|
result.setOrganization(organization);
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
- String fullName = personId.parallelStream().map(e -> userService.queryOsUserDto(e).getFullName()).collect(Collectors.joining(","));
|
|
|
- result.setOrganization(fullName);
|
|
|
- }
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -258,10 +251,61 @@ public class AnalysisSynthesizeServiceImpl {
|
|
|
* @param personVisitDto
|
|
|
* @return
|
|
|
*/
|
|
|
- public SynthesizeCompanyVo personVisit(PersonVisitDto personVisitDto) {
|
|
|
- //如果组织id不为空,人员id为空情况下,显示组织访问量
|
|
|
- SynthesizeCompanyVo synthesizeCompanyVo = this.organizationVisit(personVisitDto.getType(), personVisitDto.getOrganizationId(),
|
|
|
- personVisitDto.getCreateTime(),personVisitDto.getEndTime(),personVisitDto.getPersonId());
|
|
|
- return synthesizeCompanyVo;
|
|
|
+ public List<SynthesizeCompanyVo> personVisit(PersonVisitDto personVisitDto) {
|
|
|
+ List<SynthesizeCompanyVo> synthesizeCompanyVos = new ArrayList<>();
|
|
|
+ //开始时间和结束时间都不为空,按照选中时间过滤,忽略type
|
|
|
+ if (!StringUtils.isEmpty(personVisitDto.getCreateTime()) && !StringUtils.isEmpty(personVisitDto.getEndTime())){
|
|
|
+ personVisitDto.setType(null);
|
|
|
+ }
|
|
|
+ //查询人员
|
|
|
+ if (!CollectionUtils.isEmpty(personVisitDto.getPersonId())){
|
|
|
+ personVisitDto.setOrganizationId(null);
|
|
|
+ synthesizeCompanyVos = personSynthesizeValue(personVisitDto.getPersonId(),personVisitDto.getType(),personVisitDto.getCreateTime(),personVisitDto.getEndTime(),1);
|
|
|
+ } else {
|
|
|
+ //查询部门
|
|
|
+ String[] split = personVisitDto.getOrganizationId().split(",");
|
|
|
+ List<String> organizationIdList = Arrays.asList(split);
|
|
|
+ synthesizeCompanyVos = personSynthesizeValue(organizationIdList,personVisitDto.getType(),personVisitDto.getCreateTime(),personVisitDto.getEndTime(),2);
|
|
|
+ }
|
|
|
+ return synthesizeCompanyVos;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 综合统计赋值
|
|
|
+ * @param list
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<SynthesizeCompanyVo> personSynthesizeValue(List<String> list,String type,String createTime,String endTime,Integer round){
|
|
|
+
|
|
|
+ List<SynthesizeCompanyVo> result = list.parallelStream().map(e -> {
|
|
|
+ //获取当前年
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ int year = calendar.get(Calendar.YEAR);
|
|
|
+ SynthesizeCompanyVo synthesizeCompanyVo = new SynthesizeCompanyVo();
|
|
|
+ //查询知识分类下创建的知识数量(纬度:年 最近1个月 全部)
|
|
|
+ if (type.equals("total")) {
|
|
|
+ synthesizeCompanyVo = analysisSynthesizeMapper.personSynthesizeValue(e, null, null,round);
|
|
|
+ } else if (type.equals("year")) {
|
|
|
+ synthesizeCompanyVo = analysisSynthesizeMapper.personSynthesizeValue(e, DateUtils.format(DateUtils.getFirstOfYear(year)),
|
|
|
+ DateUtils.format(DateUtils.getLastOfYear(year)),round);
|
|
|
+ } else if (type.equals("month")) {
|
|
|
+ int month = calendar.get(Calendar.MONTH);
|
|
|
+ String firstOfMonth = DateUtils.getFirstOfMonth(year, month + 1, 15);
|
|
|
+ String lastOfMonth = DateUtils.getLastOfMonth(year, month + 1, 15);
|
|
|
+ synthesizeCompanyVo = analysisSynthesizeMapper.personSynthesizeValue(e, firstOfMonth, lastOfMonth,round);
|
|
|
+ } else {
|
|
|
+ synthesizeCompanyVo = analysisSynthesizeMapper.personSynthesizeValue(e,createTime, endTime, round);
|
|
|
+ }
|
|
|
+ if (round == 1){
|
|
|
+ synthesizeCompanyVo.setOrganization(userService.queryOsUserDto(e).getFullName());
|
|
|
+ } else {
|
|
|
+ synthesizeCompanyVo.setOrganization(userService.findDeptByDeptId(e).getName());
|
|
|
+ }
|
|
|
+ return synthesizeCompanyVo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return result;
|
|
|
+
|
|
|
}
|
|
|
}
|