|
@@ -8,6 +8,7 @@ import cn.com.ty.lift.batch.applet.dao.model.request.CommonRequest;
|
|
|
import cn.com.ty.lift.batch.applet.util.DataStatisticsUtil;
|
|
|
import cn.com.ty.lift.common.constants.ApiConstants;
|
|
|
import cn.com.xwy.boot.web.dto.RestResponse;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -84,7 +85,7 @@ public class AnnualInspectionDataService {
|
|
|
List<AnnualInspectionDataModel> annualInspectionDataModelList = getAnnualInspectionDataListFromRedis(
|
|
|
annualInspectionDataRequest);
|
|
|
Map<Integer, Long> annualStatusToNum = DataStatisticsConstants.ANNUAL_STATUS_TO_NUM;
|
|
|
- if(annualInspectionDataModelList != null && annualInspectionDataModelList.size() > 0){
|
|
|
+ if (annualInspectionDataModelList != null && annualInspectionDataModelList.size() > 0) {
|
|
|
//设置计划年检条数
|
|
|
annualStatusToNum.put(1, annualInspectionDataModelList.stream().count());
|
|
|
//设置完成年检条数
|
|
@@ -106,7 +107,7 @@ public class AnnualInspectionDataService {
|
|
|
* @date 2020/2/5 4:11 下午
|
|
|
*/
|
|
|
public RestResponse annualProgress(AnnualInspectionDataRequest annualInspectionDataRequest) {
|
|
|
- List<AnnualInspectionDataModel> annualInspectionDataModelList = getProjectAnnualProgress(
|
|
|
+ List<AnnualInspectionDataModel> annualInspectionDataModelList = getProjectAnnualProgress(
|
|
|
annualInspectionDataRequest, "top5");
|
|
|
return RestResponse.success(annualInspectionDataModelList, ApiConstants.RESULT_SUCCESS, "获取统计数据成功");
|
|
|
}
|
|
@@ -118,7 +119,7 @@ public class AnnualInspectionDataService {
|
|
|
* @date 2020/2/5 4:14 下午
|
|
|
*/
|
|
|
public RestResponse allProjectAnnualProgress(AnnualInspectionDataRequest annualInspectionDataRequest) {
|
|
|
- List<AnnualInspectionDataModel> annualInspectionDataModelList = getProjectAnnualProgress(
|
|
|
+ List<AnnualInspectionDataModel> annualInspectionDataModelList = getProjectAnnualProgress(
|
|
|
annualInspectionDataRequest, "all");
|
|
|
return RestResponse.success(annualInspectionDataModelList, ApiConstants.RESULT_SUCCESS, "获取统计数据成功");
|
|
|
}
|
|
@@ -134,19 +135,28 @@ public class AnnualInspectionDataService {
|
|
|
//从redis中获取当前公司年检数据
|
|
|
List<AnnualInspectionDataModel> annualInspectionDataModelList = getAnnualInspectionDataListFromRedis(
|
|
|
annualInspectionDataRequest);
|
|
|
- //获取全部项目的年检进度
|
|
|
- if ("all".equals(countFlag)) {
|
|
|
- //获取所有项目的年检进度,按照计划年检时间顺序排列
|
|
|
- annualInspectionDataModelList = annualInspectionDataModelList.stream()
|
|
|
- .sorted(Comparator.comparing(AnnualInspectionDataModel::getPlanDate))
|
|
|
- .collect(Collectors.toList());
|
|
|
- } else {
|
|
|
- //获取计划年检时间前五的项目的年检进度,按照计划年检时间顺序排列
|
|
|
- annualInspectionDataModelList = annualInspectionDataModelList.stream()
|
|
|
- .sorted(Comparator.comparing(AnnualInspectionDataModel::getPlanDate)).limit(5)
|
|
|
- .collect(Collectors.toList());
|
|
|
+ if (annualInspectionDataModelList != null && annualInspectionDataModelList.size() > 0) {
|
|
|
+ //获取全部项目的年检进度
|
|
|
+ if ("all".equals(countFlag)) {
|
|
|
+ if (StringUtils.isNotBlank(annualInspectionDataRequest.getProjectName())) {
|
|
|
+ //通过项目名称模糊查询
|
|
|
+ annualInspectionDataModelList = annualInspectionDataModelList.stream()
|
|
|
+ //通过名称模糊匹配
|
|
|
+ .filter(a -> DataStatisticsUtil.strMatch(
|
|
|
+ annualInspectionDataRequest.getProjectName(), a.getProjectName()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ //获取所有项目的年检进度,按照计划年检时间顺序排列
|
|
|
+ annualInspectionDataModelList = annualInspectionDataModelList.stream()
|
|
|
+ .sorted(Comparator.comparing(AnnualInspectionDataModel::getPlanDate))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ } else {
|
|
|
+ //获取计划年检时间前五的项目的年检进度,按照计划年检时间顺序排列
|
|
|
+ annualInspectionDataModelList = annualInspectionDataModelList.stream()
|
|
|
+ .sorted(Comparator.comparing(AnnualInspectionDataModel::getPlanDate)).limit(5)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
}
|
|
|
return annualInspectionDataModelList;
|
|
|
-
|
|
|
}
|
|
|
}
|