Browse Source

统计接口新增排序、详情接口新增筛选排序

master
Jinyuanyuan 2 months ago
parent
commit
705eb6e18f
  1. 6
      huzhou/pom.xml
  2. 29
      huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/HuzhouProjectController.java
  3. 1
      huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouProjectinfoMapper.java
  4. 9
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/IHuzhouProjectinfoService.java
  5. 288
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java
  6. 15
      huzhou/src/main/java/com/easy/admin/modules/huzhou/vo/ImportTypeOV.java

6
huzhou/pom.xml

@ -47,6 +47,12 @@
<groupId>com.easy.admin</groupId>
<artifactId>easy-activiti</artifactId>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-spring-boot-starter</artifactId>
<version>4.4.0</version>
</dependency>
</dependencies>
<build>
<resources>

29
huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/HuzhouProjectController.java

@ -301,23 +301,33 @@ public class HuzhouProjectController {
@GetMapping("/getProjectSummaryPage")
public Result<?> getProjectSummaryPage(HuzhouProjectinfoOV projectinfo,
@RequestParam(name="current", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
IPage<ProjectSummaryOV> result = projectinfoService.getProjectSummaryPage(projectinfo,pageNo,pageSize);
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@RequestParam(name="sortField", defaultValue="") String orderBy,
@RequestParam(name="sortOrder", defaultValue="") String orderDir){
IPage<ProjectSummaryOV> result = projectinfoService.getProjectSummaryPage(projectinfo,pageNo,pageSize,orderBy,orderDir);
return Result.ok(result);
}
@GetMapping("/getProjectSummaryPageByTask")
public Result<?> getProjectSummaryPageByTask(HuzhouProjectinfoOV projectinfo,
@RequestParam(name="current", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
IPage<ProjectSummaryOV> result = projectinfoService.getProjectSummaryPageByTask(projectinfo,pageNo,pageSize);
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@RequestParam(name="sortField", defaultValue="") String orderBy,
@RequestParam(name="sortOrder", defaultValue="") String orderDir){
IPage<ProjectSummaryOV> result = projectinfoService.getProjectSummaryPageByTask(projectinfo,pageNo,pageSize,orderBy,orderDir);
return Result.ok(result);
}
@GetMapping("/getProjectDetailPage")
public Result<?> getProjectDetailPage(HuzhouProjectinfoOV projectinfo,
@RequestParam(name="stage", defaultValue="") String stage,
@RequestParam(name="current", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
IPage<ProjectDetailOV> result = projectinfoService.getProjectDetailPage(projectinfo,stage, pageNo, pageSize);
@RequestParam(name="current", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@RequestParam(name="sortField", defaultValue="") String orderBy,
@RequestParam(name="sortOrder", defaultValue="") String orderDir,
@RequestParam(name="projectStage", defaultValue="") String projectStage,
@RequestParam(name="stepName", defaultValue="") String stepName,
@RequestParam(name="isUpload", defaultValue="") String isUpload,
@RequestParam(name="isOffline", defaultValue="") String isOffline){
IPage<ProjectDetailOV> result = projectinfoService.getProjectDetailPage(projectinfo, pageNo, pageSize,orderBy,orderDir,projectStage,stepName,isUpload,isOffline);
return Result.ok(result);
}
@GetMapping("/countStage")
@ -325,4 +335,9 @@ public class HuzhouProjectController {
List<CountStageOV> result = projectinfoService.countStage(projectinfo);
return Result.ok(result);
}
@GetMapping("/import")
public Result<?> tryImport(@RequestParam("file")MultipartFile file) throws Exception {
projectinfoService.updateTypeByImportFile(file);
return Result.ok("更新成功");
}//测试的时候Body选择form-data,key写file,value选择需要导入的文件
}

1
huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouProjectinfoMapper.java

@ -89,4 +89,5 @@ public interface HuzhouProjectinfoMapper extends BaseMapper<HuzhouProjectinfo> {
Map<String,BigDecimal> getMoneyById(@Param("projectId") String projectId);
List<String> getIds(@Param("reformName") String reformName,@Param("superLeader") String superLeader);
}

9
huzhou/src/main/java/com/easy/admin/modules/huzhou/service/IHuzhouProjectinfoService.java

@ -189,14 +189,17 @@ public interface IHuzhouProjectinfoService extends IService<HuzhouProjectinfo> {
FundByTypeOV countSupportingFound();
IPage<ProjectSummaryOV> getProjectSummaryPage(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize);
IPage<ProjectSummaryOV> getProjectSummaryPage(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize,String orderBy,String orderDir);
IPage<ProjectSummaryOV> getProjectSummaryPageByTask(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize);
IPage<ProjectSummaryOV> getProjectSummaryPageByTask(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize,String orderBy,String orderDir);
IPage<ProjectDetailOV> getProjectDetailPage(HuzhouProjectinfo projectInfo,String stage, Integer pageNo, Integer pageSize);
IPage<ProjectDetailOV> getProjectDetailPage(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize,String orderBy,String orderDir,
String projectStage,String stepName,String isUpload,String isOffline);
List<CountStageOV> countStage(HuzhouProjectinfo projectInfo);
void updateTypeByImportFile (MultipartFile file) throws Exception;
}

288
huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java

@ -1,5 +1,8 @@
package com.easy.admin.modules.huzhou.service.impl;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -18,6 +21,7 @@ import com.easy.admin.modules.huzhou.service.*;
import com.easy.admin.modules.huzhou.vo.*;
import com.easy.admin.sys.model.SysDict;
import com.easy.admin.sys.service.SysDictService;
import groovy.util.logging.Slf4j;
import kotlin.collections.EmptyList;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
@ -1401,7 +1405,8 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
//
// }
public IPage<ProjectSummaryOV> getProjectSummaryPage(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize){
@Override
public IPage<ProjectSummaryOV> getProjectSummaryPage(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize,String orderBy,String orderDir){
IPage<ProjectSummaryOV> result = new Page<>();
//只要入库项目
projectInfo.setType("1");
@ -1416,13 +1421,25 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
String progress = this.countProgress(projectIds);
p.setProjectProgress(progress);
}
//手动分页
int fromIndex = (pageNo - 1) * pageSize;
List<ProjectSummaryOV> currentPageData = projectSummaryPageList.subList(fromIndex, Math.min(fromIndex + pageSize, projectSummaryPageList.size()));
result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(projectSummaryPageList.size());
//排序
if(!orderBy.equals("")&&!orderDir.equals("")){
List<ProjectSummaryOV> summarySortedList = this.getSummarySortedList(projectSummaryPageList, orderBy, orderDir);
//手动分页
int fromIndex = (pageNo - 1) * pageSize;
List<ProjectSummaryOV> currentPageData = summarySortedList.subList(fromIndex, Math.min(fromIndex + pageSize, summarySortedList.size()));
result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(summarySortedList.size());
}else {
//手动分页
int fromIndex = (pageNo - 1) * pageSize;
List<ProjectSummaryOV> currentPageData = projectSummaryPageList.subList(fromIndex, Math.min(fromIndex + pageSize, projectSummaryPageList.size()));
result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(projectSummaryPageList.size());
}
return result;
}
public IPage<ProjectSummaryOV> getProjectSummaryPageByTask(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize){
@Override
public IPage<ProjectSummaryOV> getProjectSummaryPageByTask(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize,String orderBy,String orderDir){
IPage<ProjectSummaryOV> result = new Page<>();
//只要入库项目
projectInfo.setType("1");
@ -1437,13 +1454,26 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
String progress = this.countProgress(projectIds);
p.setProjectProgress(progress);
}
//手动分页
int fromIndex = (pageNo - 1) * pageSize;
List<ProjectSummaryOV> currentPageData = projectSummaryPageList.subList(fromIndex, Math.min(fromIndex + pageSize, projectSummaryPageList.size()));
result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(projectSummaryPageList.size());
//排序
if(!orderBy.equals("")&&!orderDir.equals("")){
List<ProjectSummaryOV> summarySortedList = this.getSummarySortedList(projectSummaryPageList, orderBy, orderDir);
//手动分页
int fromIndex = (pageNo - 1) * pageSize;
List<ProjectSummaryOV> currentPageData = summarySortedList.subList(fromIndex, Math.min(fromIndex + pageSize, summarySortedList.size()));
result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(summarySortedList.size());
}else {
//手动分页
int fromIndex = (pageNo - 1) * pageSize;
List<ProjectSummaryOV> currentPageData = projectSummaryPageList.subList(fromIndex, Math.min(fromIndex + pageSize, projectSummaryPageList.size()));
result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(projectSummaryPageList.size());
}
return result;
}
public IPage<ProjectDetailOV> getProjectDetailPage(HuzhouProjectinfo projectInfo,String stage, Integer pageNo, Integer pageSize){
@Override
public IPage<ProjectDetailOV> getProjectDetailPage(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize,String orderBy,String orderDir,
String projectStage,String stepName,String isUpload,String isOffline){
IPage<ProjectDetailOV> result = new Page<>();
List<ProjectDetailOV> records=new ArrayList<>();
HashMap<String,String> stageMap=new HashMap<>();
@ -1492,18 +1522,18 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
query1.eq(HuzhouPlaninfo::getProjectId,p.getId());
query1.eq(HuzhouPlaninfo::getIsfinish,"1");
List<String[]> onGoingLevelList = planinfoService.list(query1).stream().map(x -> x.getTaskLevel().split("\\.")).collect(Collectors.toList());
String stepName="";
String isUpload="";
String isOffline="0";
String defaultStepName="";
String defaultIsUpload="";
String defaultIsOffline="0";
if(!onGoingLevelList.isEmpty()){//有1取1,多1取最大
List<String[]> onGoingKeyList = onGoingLevelList.stream().filter(x -> x.length == 2).collect(Collectors.toList());
int firstMax = onGoingKeyList.stream().mapToInt(x -> Integer.parseInt(x[0])).summaryStatistics().getMax();
List<String[]> onGoingKeyFilterList = onGoingKeyList.stream().filter(x -> x[0].equals(String.valueOf(firstMax))).collect(Collectors.toList());
int secondMax = onGoingKeyFilterList.stream().mapToInt(x -> Integer.parseInt(x[1])).summaryStatistics().getMax();
String level=firstMax+"."+secondMax;
stepName=planinfoMapper.getTaskName(p.getId(),level);
isOffline = planinfoMapper.getIsOffline(p.getId(), level);
isUpload="1";
defaultStepName=planinfoMapper.getTaskName(p.getId(),level);
defaultIsUpload = planinfoMapper.getIsOffline(p.getId(), level);
defaultIsOffline="1";
}
else if(onGoingLevelList.isEmpty() && !levelList.isEmpty()){//没有1,有2
List<String[]> keyList = levelList.stream().filter(x -> x.length == 2).collect(Collectors.toList());
@ -1511,13 +1541,13 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
List<String[]> onGoingKeyFilterList = keyList.stream().filter(x -> x[0].equals(String.valueOf(firstMax))).collect(Collectors.toList());
int secondMax = onGoingKeyFilterList.stream().mapToInt(x -> Integer.parseInt(x[1])).summaryStatistics().getMax();
String level=firstMax+"."+secondMax;
stepName=planinfoMapper.getTaskName(p.getId(),level);
isOffline = planinfoMapper.getIsOffline(p.getId(), level);
isUpload="1";
defaultStepName=planinfoMapper.getTaskName(p.getId(),level);
defaultIsUpload = planinfoMapper.getIsOffline(p.getId(), level);
defaultIsOffline="1";
}
projectDetail.setStepName(stepName);
projectDetail.setIsUpload(isUpload);
projectDetail.setIsOffline(isOffline);
projectDetail.setStepName(defaultStepName);
projectDetail.setIsUpload(defaultIsUpload);
projectDetail.setIsOffline(defaultIsOffline);
// 进度
List<String> projectIds=new ArrayList<>();
projectIds.add(p.getId());
@ -1527,22 +1557,182 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
}
//项目阶段筛选
if(!Objects.equals(stage, "")){
String queryStage = stageMap.get(stage);
List<ProjectDetailOV> filterRecords=records.stream().filter(x->x.getProjectStage().equals(queryStage)).collect(Collectors.toList());
//手动分页
int fromIndex = (pageNo - 1) * pageSize;
List<ProjectDetailOV> currentPageData = filterRecords.subList(fromIndex, Math.min(fromIndex + pageSize, filterRecords.size()));
result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(filterRecords.size());
//先筛再排
// List<ProjectDetailOV> filteredList=new ArrayList<>();
List<ProjectDetailOV> detailSortedList=new ArrayList<>();
List<String> conditionList=new ArrayList<>();
//筛选条件集合
HashMap<String,String> filterMap= new HashMap<>();
filterMap.put("projectStage",projectStage);
filterMap.put("stepName",stepName);
filterMap.put("isUpload",isUpload);
filterMap.put("isOffline",isOffline);
for (Map.Entry<String, String> entry : filterMap.entrySet()){
if (!entry.getValue().equals("")){
conditionList.add(entry.getKey());
}
}
//筛选
if(!conditionList.isEmpty()){
List<ProjectDetailOV> tempList=new ArrayList<>();
tempList.addAll(records);
List<ProjectDetailOV> filteredList=new ArrayList<>();
for(String condition:conditionList){
if(condition.equals("projectStage")){
filteredList = tempList.stream().filter(x -> x.getProjectStage().equals(stageMap.get(projectStage))).collect(Collectors.toList());
}else if (condition.equals("stepName")){
filteredList = tempList.stream().filter(x -> x.getStepName().equals(stepName)).collect(Collectors.toList());
} else if (condition.equals("isUpload")) {
filteredList = tempList.stream().filter(x -> x.getIsUpload().equals(isUpload)).collect(Collectors.toList());
} else if (condition.equals("isOffline")) {
filteredList = tempList.stream().filter(x -> x.getIsOffline().equals(isOffline)).collect(Collectors.toList());
}
tempList.clear();
tempList.addAll(filteredList);
}
records=filteredList;
}
if(!orderBy.equals("")&&!orderDir.equals("")){
detailSortedList = this.getDetailSortedList(records, orderBy, orderDir);
}else {
//手动分页
int fromIndex = (pageNo - 1) * pageSize;
List<ProjectDetailOV> currentPageData = records.subList(fromIndex, Math.min(fromIndex + pageSize, records.size()));
result.setCurrent(pageNo).setSize(pageSize).setRecords(currentPageData).setTotal(records.size());
detailSortedList=records;
}
//手动分页
int fromIndex = (pageNo - 1) * pageSize;
List<ProjectDetailOV> currentPageData = detailSortedList.subList(fromIndex, Math.min(fromIndex + pageSize, detailSortedList.size()));
result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(detailSortedList.size());
return result;
}
public List<ProjectSummaryOV> getSummarySortedList(List<ProjectSummaryOV> originalList,String orderBy,String orderDir){
List<ProjectSummaryOV> sortedList=new ArrayList<>();
List<Integer> projectNumList = originalList.stream().map(x -> x.getProjectNum()).collect(Collectors.toList());
List<BigDecimal> totalMoneyList = originalList.stream().map(x -> x.getTotalMoney()).collect(Collectors.toList());
List<BigDecimal> centralMoneyList = originalList.stream().map(x -> x.getCentralMoney()).collect(Collectors.toList());
List<BigDecimal> estimateMoneyList = originalList.stream().map(x -> x.getEstimateMoney()).collect(Collectors.toList());
List<BigDecimal> contractMoneyList = originalList.stream().map(x -> x.getContractMoney()).collect(Collectors.toList());
List<BigDecimal> contractCentralMoneyList = originalList.stream().map(x -> x.getContractCentralMoney()).collect(Collectors.toList());
List<String> projectProgressList = originalList.stream().map(x -> x.getProjectProgress()).collect(Collectors.toList());
List<ProjectSummaryOV> empList=new ArrayList<>();
if (Objects.equals(orderBy, "projectNum")&& Objects.equals(orderDir, "descend")){
sortedList=projectNumList.isEmpty()?originalList:originalList.stream().sorted(Comparator.comparing(ProjectSummaryOV::getProjectNum).reversed()).collect(Collectors.toList());
} else if (Objects.equals(orderBy, "projectNum") && Objects.equals(orderDir, "ascend")) {
sortedList=projectNumList.isEmpty()?originalList:originalList.stream().sorted(Comparator.comparing(ProjectSummaryOV::getProjectNum)).collect(Collectors.toList());
}else if (Objects.equals(orderBy, "totalMoney")&& Objects.equals(orderDir, "descend")){
sortedList=totalMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getTotalMoney()!=null).sorted(Comparator.comparing(ProjectSummaryOV::getTotalMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getTotalMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
} else if (Objects.equals(orderBy, "totalMoney") && Objects.equals(orderDir, "ascend")) {
sortedList=totalMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getTotalMoney()!=null).sorted(Comparator.comparing(ProjectSummaryOV::getTotalMoney)).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getTotalMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "centralMoney")&& Objects.equals(orderDir, "descend")){
sortedList=centralMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getContractMoney()!=null).sorted(Comparator.comparing(ProjectSummaryOV::getCentralMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getContractMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "centralMoney")&& Objects.equals(orderDir, "ascend")){
sortedList=centralMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getContractMoney()!=null).sorted(Comparator.comparing(ProjectSummaryOV::getCentralMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getContractMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "estimateMoney")&& Objects.equals(orderDir, "descend")){
sortedList=estimateMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getEstimateMoney()!=null).sorted(Comparator.comparing(ProjectSummaryOV::getEstimateMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getEstimateMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
} else if (Objects.equals(orderBy, "estimateMoney") && Objects.equals(orderDir, "ascend")) {
sortedList=estimateMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getEstimateMoney()!=null).sorted(Comparator.comparing(ProjectSummaryOV::getEstimateMoney)).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getEstimateMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "contractMoney")&& Objects.equals(orderDir, "descend")){
sortedList=contractMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getContractMoney()!=null).sorted(Comparator.comparing(ProjectSummaryOV::getContractMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getContractMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "contractMoney")&& Objects.equals(orderDir, "ascend")){
sortedList=contractMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getContractMoney()!=null).sorted(Comparator.comparing(ProjectSummaryOV::getContractMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getContractMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "contractCentralMoney")&& Objects.equals(orderDir, "descend")){
sortedList=contractCentralMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getContractCentralMoney()!=null).sorted(Comparator.comparing(ProjectSummaryOV::getContractCentralMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getContractCentralMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "contractCentralMoney")&& Objects.equals(orderDir, "ascend")){
sortedList=contractCentralMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getContractCentralMoney()!=null).sorted(Comparator.comparing(ProjectSummaryOV::getContractCentralMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getContractCentralMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "projectProgress")&& Objects.equals(orderDir, "descend")){
sortedList=projectProgressList.isEmpty()?originalList:originalList.stream().filter(x->x.getProjectProgress()!=null).sorted(Comparator.comparing(ProjectSummaryOV::getProjectProgress).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getProjectProgress() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "projectProgress")&& Objects.equals(orderDir, "ascend")){
sortedList=projectProgressList.isEmpty()?originalList:originalList.stream().filter(x->x.getProjectProgress()!=null).sorted(Comparator.comparing(ProjectSummaryOV::getProjectProgress).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getProjectProgress() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}
return sortedList;
}
public List<ProjectDetailOV> getDetailSortedList(List<ProjectDetailOV> originalList,String orderBy,String orderDir){
List<ProjectDetailOV> sortedList=new ArrayList<>();
List<Double> totalMoneyList = originalList.stream().map(x -> x.getTotalMoney()).collect(Collectors.toList());
List<Double> centralMoneyList = originalList.stream().map(x -> x.getCentralMoney()).collect(Collectors.toList());
List<Double> estimateMoneyList = originalList.stream().map(x -> x.getEstimateMoney()).collect(Collectors.toList());
List<BigDecimal> contractMoneyList = originalList.stream().map(x -> x.getContractMoney()).collect(Collectors.toList());
List<BigDecimal> contractCentralMoneyList = originalList.stream().map(x -> x.getContractCentralMoney()).collect(Collectors.toList());
List<String> projectProgressList = originalList.stream().map(x -> x.getProjectProgress()).collect(Collectors.toList());
List<ProjectDetailOV> empList=new ArrayList<>();
if (Objects.equals(orderBy, "totalMoney")&& Objects.equals(orderDir, "descend")){
sortedList=totalMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getTotalMoney()!=null).sorted(Comparator.comparing(ProjectDetailOV::getTotalMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getTotalMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
} else if (Objects.equals(orderBy, "totalMoney") && Objects.equals(orderDir, "ascend")) {
sortedList=totalMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getTotalMoney()!=null).sorted(Comparator.comparing(ProjectDetailOV::getTotalMoney)).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getTotalMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "centralMoney")&& Objects.equals(orderDir, "descend")){
sortedList=centralMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getCentralMoney()!=null).sorted(Comparator.comparing(ProjectDetailOV::getCentralMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getCentralMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "centralMoney")&& Objects.equals(orderDir, "ascend")){
sortedList=centralMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getCentralMoney()!=null).sorted(Comparator.comparing(ProjectDetailOV::getCentralMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getCentralMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "estimateMoney")&& Objects.equals(orderDir, "descend")){
sortedList=estimateMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getEstimateMoney()!=null).sorted(Comparator.comparing(ProjectDetailOV::getEstimateMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getEstimateMoney()== null).collect(Collectors.toList());
sortedList.addAll(empList);
} else if (Objects.equals(orderBy, "estimateMoney") && Objects.equals(orderDir, "ascend")) {
sortedList=estimateMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getEstimateMoney()!=null).sorted(Comparator.comparing(ProjectDetailOV::getEstimateMoney)).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getEstimateMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "contractMoney")&& Objects.equals(orderDir, "descend")){
sortedList=contractMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getContractMoney()!=null).sorted(Comparator.comparing(ProjectDetailOV::getContractMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getContractMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "contractMoney")&& Objects.equals(orderDir, "ascend")){
sortedList=contractMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getContractMoney()!=null).sorted(Comparator.comparing(ProjectDetailOV::getContractMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getContractMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "contractCentralMoney")&& Objects.equals(orderDir, "descend")){
sortedList=contractCentralMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getContractCentralMoney()!=null).sorted(Comparator.comparing(ProjectDetailOV::getContractCentralMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getContractCentralMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "contractCentralMoney")&& Objects.equals(orderDir, "ascend")){
sortedList=contractCentralMoneyList.isEmpty()?originalList:originalList.stream().filter(x->x.getContractCentralMoney()!=null).sorted(Comparator.comparing(ProjectDetailOV::getContractCentralMoney).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getContractCentralMoney() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "projectProgress")&& Objects.equals(orderDir, "descend")){
sortedList=projectProgressList.isEmpty()?originalList:originalList.stream().filter(x->x.getProjectProgress()!=null).sorted(Comparator.comparing(ProjectDetailOV::getProjectProgress).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getProjectProgress() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}else if (Objects.equals(orderBy, "projectProgress")&& Objects.equals(orderDir, "ascend")){
sortedList=projectProgressList.isEmpty()?originalList:originalList.stream().filter(x->x.getProjectProgress()!=null).sorted(Comparator.comparing(ProjectDetailOV::getProjectProgress).reversed()).collect(Collectors.toList());
empList = originalList.stream().filter(x -> x.getProjectProgress() == null).collect(Collectors.toList());
sortedList.addAll(empList);
}
return sortedList;
}
@Override
public List<CountStageOV> countStage(HuzhouProjectinfo projectInfo){
List<CountStageOV> result = new ArrayList<>();
HashMap<String,Integer> stageMap=new HashMap<>();
@ -1588,4 +1778,32 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
}
@Override
public void updateTypeByImportFile (MultipartFile file) throws Exception {
ImportParams importParams = new ImportParams();
HashMap<String,String> typeMap=new HashMap<>();
typeMap.put("入库项目","1");
typeMap.put("配套项目","2");
//表格标题行数,默认0
importParams.setTitleRows(0);
//是否需要校验上传的Excel
importParams.setNeedVerify(true);
ExcelImportResult<ImportTypeOV> result = ExcelImportUtil.importExcelMore(file.getInputStream(),ImportTypeOV.class,importParams);
if (!result.getList().isEmpty()) {
for (ImportTypeOV request : result.getList()) {
HuzhouProjectinfo projectInfo=new HuzhouProjectinfo();
projectInfo.setProjectName(request.getName());
String s = typeMap.get(request.getType());
projectInfo.setType(s);
LambdaUpdateWrapper<HuzhouProjectinfo> updateWrapper=new LambdaUpdateWrapper<>();
updateWrapper.set(null,projectInfo);
projectinfoMapper.updateById(projectInfo);
}
for (ImportTypeOV request : result.getFailList()) {
System.out.println(request);
}
}
}
}

15
huzhou/src/main/java/com/easy/admin/modules/huzhou/vo/ImportTypeOV.java

@ -0,0 +1,15 @@
package com.easy.admin.modules.huzhou.vo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
@Data
public class ImportTypeOV {
@Excel(name = "项目名称")
private String name;
@Excel(name = "项目类型")
private String type;
}
Loading…
Cancel
Save