|
@@ -13,17 +13,21 @@ import com.hjy.common.core.page.TableDataInfo;
|
|
|
import com.hjy.common.utils.PageUtils;
|
|
|
import com.hjy.common.utils.file.FileUploadUtils;
|
|
|
import com.hjy.common.utils.file.FileUtils;
|
|
|
+import com.hjy.module.domain.midwest.NeighborProvince;
|
|
|
+import com.hjy.module.domain.midwest.TbMidwest;
|
|
|
import com.hjy.module.domain.report.ReportDTO;
|
|
|
import com.hjy.module.domain.report.ReportRecord;
|
|
|
import com.hjy.module.domain.report.ReportWord;
|
|
|
import com.hjy.module.domain.reportsetting.ReportSetting;
|
|
|
import com.hjy.module.domain.template.ExcelOutInTotal;
|
|
|
import com.hjy.module.mapper.template.ExcelOutInTotalMapper;
|
|
|
+import com.hjy.module.service.midwest.ITbMidwestService;
|
|
|
import com.hjy.module.service.report.IReportRecordService;
|
|
|
import com.hjy.module.service.report.IReportTemplateService;
|
|
|
import com.hjy.module.service.report.IReportWordService;
|
|
|
import com.hjy.module.service.reportsetting.IReportSettingService;
|
|
|
import com.hjy.module.service.template.IExcelOutInTotalService;
|
|
|
+import com.hjy.module.vo.midwest.TbMidwestVo;
|
|
|
import com.hjy.module.vo.report.ReportRecordVo;
|
|
|
import com.hjy.module.vo.report.ReportTemplateVo;
|
|
|
import com.hjy.module.vo.template.ExcelOutInTotalVo;
|
|
@@ -59,7 +63,8 @@ public class ExcelOutInTotalServiceImpl extends ServiceImpl<ExcelOutInTotalMappe
|
|
|
@Resource
|
|
|
private IReportSettingService reportSettingService;
|
|
|
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private ITbMidwestService tbMidwestService;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -123,11 +128,67 @@ public class ExcelOutInTotalServiceImpl extends ServiceImpl<ExcelOutInTotalMappe
|
|
|
|
|
|
List<String> zongbaoList = arrayList.stream().filter(str -> str.contains("综合保税区")).collect(Collectors.toList());
|
|
|
List<ExcelOutInTotal> excelDTOList = buildDTO(zongbaoList, currentMonth, cumulativeMonth);
|
|
|
-
|
|
|
//全国综保区数据
|
|
|
ExcelOutInTotal totalDTO = excelDTOList.get(0);
|
|
|
+ String allTotalInc = totalDTO.getTotalInc();
|
|
|
+ double inc = new BigDecimal(allTotalInc).doubleValue();
|
|
|
+ String incDesc = inc > 0 ? "增长" : "下降";
|
|
|
+ reportDTO.setAllAsyncDesc("全国综保区进出口总值为" + totalDTO.getTotalCumulativeMonth() + "亿元,同比" + incDesc + Math.abs(inc) + "%。");
|
|
|
reportRecord.setNactionForeignTrade(totalDTO.getTotalCumulativeMonth())
|
|
|
.setNactionForeignTradeInc(totalDTO.getTotalInc());
|
|
|
+ //中西部名单
|
|
|
+ List<TbMidwestVo> tbMidwestVos = tbMidwestService.queryAll(new TbMidwestVo());
|
|
|
+ List<String> midWestNameList = tbMidwestVos.stream().map(TbMidwest::getName).collect(Collectors.toList());
|
|
|
+ //中西部进出口总值列表
|
|
|
+ List<ExcelOutInTotal> midWestList = excelDTOList.stream()
|
|
|
+ .filter(m->midWestNameList.contains(m.getName())).collect(Collectors.toList())
|
|
|
+ .stream().sorted(Comparator.comparingDouble(e -> Double.parseDouble(e.getTotalCumulativeMonth())))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ //计算排名
|
|
|
+ int i = midWestNameList.size();
|
|
|
+ for (ExcelOutInTotal excelOutInTotal : midWestList) {
|
|
|
+ excelOutInTotal.setIndex(i);
|
|
|
+ i--;
|
|
|
+ }
|
|
|
+ //挑出广西在中西部排名
|
|
|
+ StringBuilder midwestSortDesc=new StringBuilder("中西部综保区排名情况:");
|
|
|
+ midWestList.stream().filter(str->{
|
|
|
+ String name = str.getName();
|
|
|
+ return name.contains(nn) || name.contains(wz) || name.contains(qz) || name.contains(bh) || name.contains(px);
|
|
|
+ }).forEach(excelOutInTotal -> {
|
|
|
+ midwestSortDesc.append(excelOutInTotal.getName())
|
|
|
+ .append("进出口总值").append(excelOutInTotal.getTotalCumulativeMonth())
|
|
|
+ .append("亿元,排名第").append(excelOutInTotal.getIndex()).append(";");
|
|
|
+ });
|
|
|
+ reportDTO.setMidwestSortDesc(midwestSortDesc.toString());
|
|
|
+ //临省
|
|
|
+ List<NeighborProvince> neighborProvinces = new ArrayList<>();
|
|
|
+ tbMidwestVos.stream()
|
|
|
+ .filter(w -> w.getNeighbor() == 1)
|
|
|
+ .collect(Collectors.groupingBy(TbMidwest::getProvince))
|
|
|
+ .forEach((province, provinceList) -> {
|
|
|
+ List<String> nameList = provinceList.stream().map(TbMidwest::getName).collect(Collectors.toList());
|
|
|
+ List<ExcelOutInTotal> neighborList = midWestList.stream().filter(m->nameList.contains(m.getName())).collect(Collectors.toList());
|
|
|
+ Long provinceSum = neighborList.stream()
|
|
|
+ .collect(Collectors.summarizingLong(e -> Long.parseLong(e.getTotalCumulativeMonth())))
|
|
|
+ .getSum();
|
|
|
+ NeighborProvince neighborProvince = new NeighborProvince();
|
|
|
+ neighborProvince.setProvinceName(province).setTotal(provinceSum);
|
|
|
+ neighborProvinces.add(neighborProvince);
|
|
|
+ });
|
|
|
+ List<NeighborProvince> sortList = neighborProvinces.stream()
|
|
|
+ .sorted(Comparator.comparingLong(NeighborProvince::getTotal))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ i = sortList.size();
|
|
|
+ StringBuilder sb = new StringBuilder("相邻省份排名情况:");
|
|
|
+ for (NeighborProvince neighborProvince : sortList) {
|
|
|
+ sb.append(neighborProvince.getProvinceName())
|
|
|
+ .append("进出口总值").append(neighborProvince.getTotal())
|
|
|
+ .append("亿元,排名").append(i).append(";");
|
|
|
+ neighborProvince.setIndex(i);
|
|
|
+ i--;
|
|
|
+ }
|
|
|
+ reportDTO.setNeighborProvinceDesc(sb.toString());
|
|
|
List<ExcelOutInTotal> gxList = excelDTOList.stream().filter(str -> {
|
|
|
String name = str.getName();
|
|
|
return name.contains(nn) || name.contains(wz) || name.contains(qz) || name.contains(bh) || name.contains(px);
|
|
@@ -190,7 +251,7 @@ public class ExcelOutInTotalServiceImpl extends ServiceImpl<ExcelOutInTotalMappe
|
|
|
BigDecimal tradeTotalMoneyPercent = new BigDecimal(tradeTotalMoney)
|
|
|
.divide(tenThousand, 1, RoundingMode.UP)
|
|
|
.divide(new BigDecimal(gxTradeTotalMoney), 3, RoundingMode.UP);
|
|
|
- reportDTO.setTradeTotalMoneyPercent(tradeTotalMoneyPercent.multiply(hundred)+"%");
|
|
|
+ reportDTO.setTradeTotalMoneyPercent(tradeTotalMoneyPercent.multiply(hundred) + "%");
|
|
|
}
|
|
|
//同比增长
|
|
|
double tradeTotalMoneyInc = (BigDecimal.valueOf(tradeTotalMoney).subtract(BigDecimal.valueOf(beforeTotalCumulativeMonth)))
|
|
@@ -225,7 +286,6 @@ public class ExcelOutInTotalServiceImpl extends ServiceImpl<ExcelOutInTotalMappe
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
private List<ExcelOutInTotal> buildDTO(List<String> list, String currentMonth, String cumulativeMonth) {
|
|
|
List<ExcelOutInTotal> excelDTOList = new ArrayList<>();
|
|
|
list.forEach(str -> {
|
|
@@ -235,7 +295,7 @@ public class ExcelOutInTotalServiceImpl extends ServiceImpl<ExcelOutInTotalMappe
|
|
|
excelDTO.setCurrentMonth(currentMonth);
|
|
|
excelDTO.setCumulativeMonth(cumulativeMonth);
|
|
|
excelDTO.setTotalCurrentMonth("-".equals(split[1]) ? "0.0" : split[1]);
|
|
|
- excelDTO.setTotalCumulativeMonth("-".equals(split[2]) ? "0.0" : split[2]);
|
|
|
+ excelDTO.setTotalCumulativeMonth("-".equals(split[2]) ? "0.0" : new BigDecimal(split[2]).divide(BigDecimal.valueOf(10000),2,RoundingMode.HALF_UP)+"");
|
|
|
excelDTO.setOutCurrentMonth("-".equals(split[3]) ? "0.0" : split[3]);
|
|
|
excelDTO.setOutCumulativeMonth("-".equals(split[4]) ? "0.0" : split[4]);
|
|
|
excelDTO.setInCurrentMonth("-".equals(split[5]) ? "0.0" : split[5]);
|