|
|
@@ -18,6 +18,7 @@ import com.siwei.common.core.domain.R;
|
|
|
import com.siwei.common.core.exception.ServiceException;
|
|
|
import com.siwei.common.core.utils.StringUtils;
|
|
|
import com.siwei.spatial.api.RemoteSpatialFilesDbService;
|
|
|
+import com.siwei.system.api.domain.SysDictData;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
@@ -29,6 +30,8 @@ import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static com.siwei.apply.service.third.impl.DealExcelServiceImpl.allLandTypeList;
|
|
|
+
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
@@ -59,6 +62,95 @@ public class SupplyServiceImpl implements ISupplyService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<LandSupplyProjectVO> useTypeAndMethodList(String year,String useType,String supplyType) {
|
|
|
+ List<LandSupplyProjectVO> resList = new ArrayList<>();
|
|
|
+ {
|
|
|
+ GongdiJihuaFilterVo filterVo = new GongdiJihuaFilterVo();
|
|
|
+ filterVo.setYear(year);
|
|
|
+ filterVo.setPageSize(100000);
|
|
|
+
|
|
|
+ List<GongdiJihua> planList = gongdiJihuaMapper.getList(filterVo);
|
|
|
+ List<LandSupplyProjectVO> resList1 = planList.stream().map(item -> {
|
|
|
+ LandSupplyProjectVO vo = new LandSupplyProjectVO();
|
|
|
+ vo.setProjectPropertyId(String.valueOf(item.getGid()));
|
|
|
+ vo.setProjectName(item.getXmmc());
|
|
|
+ vo.setCompanyName("暂无");
|
|
|
+ vo.setSupplyMethod(item.getGyfs());
|
|
|
+ vo.setUseType(item.getTdyt());
|
|
|
+ vo.setSupplyType("1");
|
|
|
+ vo.setDateType("1");
|
|
|
+ vo.setGeom(item.getGeom());
|
|
|
+ return vo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //这里合并两部分数据
|
|
|
+ List<TdgyStatisticsRes> completeList = new ArrayList<>();
|
|
|
+ List<TdgyStatisticsRes> completeBusinessStatusList = dgyMapper.getListByYear(year, null, null, null);
|
|
|
+ List<TdgyStatisticsRes> completeSjgdList = dgyMapper.getSjgdListByYear(year, null, null, null);
|
|
|
+ if(CollectionUtils.isNotEmpty(completeBusinessStatusList)){
|
|
|
+ completeList.addAll(completeBusinessStatusList);
|
|
|
+ }
|
|
|
+ if(CollectionUtils.isNotEmpty(completeSjgdList)){
|
|
|
+ completeList.addAll(completeSjgdList);
|
|
|
+ }
|
|
|
+ List<LandSupplyProjectVO> resList2 = completeList.stream().map(item -> {
|
|
|
+ LandSupplyProjectVO vo = new LandSupplyProjectVO();
|
|
|
+ vo.setProjectPropertyId(item.getProjectId());
|
|
|
+ vo.setProjectName(item.getXmmc());
|
|
|
+ vo.setCompanyName(item.getCompany());
|
|
|
+ vo.setSupplyMethod(item.getGyfs());
|
|
|
+ vo.setUseType(item.getTdyt());
|
|
|
+ vo.setSupplyType("2");
|
|
|
+ vo.setDateType("2");
|
|
|
+ if(StringUtils.isBlank(item.getProjectId())){
|
|
|
+ vo.setDateType("3");
|
|
|
+ }
|
|
|
+ vo.setNodeId(item.getNodeId());
|
|
|
+ vo.setGeom(item.getGeom());
|
|
|
+ return vo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ if(CollectionUtils.isNotEmpty(resList1)) {
|
|
|
+ resList.addAll(resList1);
|
|
|
+ }
|
|
|
+ if(CollectionUtils.isNotEmpty(resList2)) {
|
|
|
+ resList.addAll(resList2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(supplyType)){
|
|
|
+ if("出让".equals(supplyType)||"划拨".equals(supplyType)){
|
|
|
+ resList = resList.stream().filter(o->o.getSupplyMethod().equals(supplyType)).collect(Collectors.toList());
|
|
|
+ }else {
|
|
|
+ resList = resList.stream().filter(o->!o.getSupplyMethod().equals("出让")).filter(o->!o.getSupplyMethod().equals("划拨")).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ } else if (StringUtils.isNotBlank(useType)) {
|
|
|
+ String code = getTdytCodeByName(useType);
|
|
|
+ if(StringUtils.isNotBlank(code)){
|
|
|
+ resList = resList.stream().filter(o->o.getUseType().equals(code)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return resList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public String getTdytCodeByName(String useName) {
|
|
|
+ if (allLandTypeList.isEmpty()) {
|
|
|
+ List<LandType> all = landTypeMapper.selectAll();
|
|
|
+ allLandTypeList.addAll(all);
|
|
|
+ }
|
|
|
+ String code = "";
|
|
|
+ // 转换为节点
|
|
|
+ Optional<LandType> filterRes = allLandTypeList.stream().filter(s -> s.getName().equalsIgnoreCase(useName)).findFirst();
|
|
|
+ if (filterRes.isPresent()) {
|
|
|
+ code = filterRes.get().getCode();
|
|
|
+ }
|
|
|
+ return code;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 年度统计
|
|
|
* @param year
|
|
|
@@ -86,11 +178,18 @@ public class SupplyServiceImpl implements ISupplyService {
|
|
|
completeList.addAll(completeSjgdList);
|
|
|
}
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(list)) {
|
|
|
- double completeRate =0;
|
|
|
- if(CollectionUtils.isNotEmpty(completeList)) {
|
|
|
- completeRate = (double) completeList.size() / list.size() * 100;
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ int size = 1;
|
|
|
+ if(CollectionUtils.isEmpty(list)){
|
|
|
+ list = new ArrayList<>();
|
|
|
+ }else {
|
|
|
+ size = list.size();
|
|
|
}
|
|
|
+ double completeRate =0;
|
|
|
+ completeRate = (double) completeList.size() / size * 100;
|
|
|
+
|
|
|
SupplyRateRes supplyRate = new SupplyRateRes();
|
|
|
//这里先计算一个供应率,后续可以根据实际需求计算其他数据
|
|
|
supplyRate.setCompleteRate((int) completeRate);
|
|
|
@@ -103,7 +202,6 @@ public class SupplyServiceImpl implements ISupplyService {
|
|
|
.mapToDouble(g -> g.getMjM().doubleValue())
|
|
|
.sum();
|
|
|
supplyRate.setPlanArea((float) planArea);
|
|
|
-
|
|
|
//完成的计算加总值
|
|
|
double completeArea = completeList.stream()
|
|
|
.filter(g -> g.getMjMu() != null)
|
|
|
@@ -247,9 +345,7 @@ public class SupplyServiceImpl implements ISupplyService {
|
|
|
int year = item.getGysj().getYear() + 1900;
|
|
|
double area = item.getMjMu() != null ? item.getMjMu().doubleValue() : 0.0;
|
|
|
String gyfs = item.getGyfs();
|
|
|
-
|
|
|
areaByYear.merge(year, area, Double::sum);
|
|
|
-
|
|
|
Map<String, Double> yearModeMap = modeAreaByYear.computeIfAbsent(year, k -> new HashMap<>());
|
|
|
if ("划拨".equals(gyfs)) {
|
|
|
yearModeMap.merge("allocate", area, Double::sum);
|
|
|
@@ -261,13 +357,27 @@ public class SupplyServiceImpl implements ISupplyService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- areaByYear.forEach((year, area) -> {
|
|
|
+ int tmpYear = 2015;
|
|
|
+ double tmpArea = 0d;
|
|
|
+ for (Map.Entry<Integer, Double> entry : areaByYear.entrySet()){
|
|
|
+ Integer year = entry.getKey();
|
|
|
+ Double area = entry.getValue();
|
|
|
+ if(year>tmpYear){
|
|
|
+ Map<String, Object> map = new LinkedHashMap<>();
|
|
|
+ map.put("year", year);
|
|
|
+ map.put("area", area);
|
|
|
+ areaTrendStatisticsList.add(map);
|
|
|
+ }else{
|
|
|
+ tmpArea+=area;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //2015年之前的数据折合到一个年份中
|
|
|
+ if(tmpArea>0d){
|
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
|
- map.put("year", year);
|
|
|
- map.put("area", area);
|
|
|
+ map.put("year", "2026年前");
|
|
|
+ map.put("area", tmpArea);
|
|
|
areaTrendStatisticsList.add(map);
|
|
|
- });
|
|
|
-
|
|
|
+ }
|
|
|
modeAreaByYear.forEach((year, modeAreas) -> {
|
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
|
map.put("year", year);
|