|
@@ -4,8 +4,11 @@ package org.springblade.land.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.Data;
|
|
|
+import lombok.extern.log4j.Log4j;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
@@ -44,6 +47,7 @@ import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
|
public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAgreementInfoMapper, ClearingAgreementInfo> implements IClearingAgreementInfoService {
|
|
@@ -156,7 +160,14 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
|
|
|
//----------------------生成通用值--------------------------//
|
|
|
//周期格式
|
|
|
String stage = info.getStage();
|
|
|
- stage = stage.substring(1,stage.length()-1);
|
|
|
+ String regex = "第" + "(.*?)" + "期";
|
|
|
+ java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(regex);
|
|
|
+ java.util.regex.Matcher matcher = pattern.matcher(stage);
|
|
|
+ if (matcher.find()) {
|
|
|
+ stage = matcher.group(1);
|
|
|
+ }else {
|
|
|
+ stage = "未获取到期数信息,请在期数中包含[第XXX期]";
|
|
|
+ }
|
|
|
//项目名称
|
|
|
String projectName = jdbcTemplate.queryForObject("select project_name from m_project_info where id = " + info.getProjectId(), String.class);
|
|
|
//当前时间
|
|
@@ -303,7 +314,7 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
|
|
|
Map<Long, List<TableDataVO>> map = voList.stream().collect(Collectors.groupingBy(TableDataVO::getPKeyId));
|
|
|
//取出84(地面)数据集合
|
|
|
List<TableDataVO> voList2 = new ArrayList<>();
|
|
|
- if (allDataMap.get(84) != null){
|
|
|
+ if (allDataMap.get(84) != null) {
|
|
|
voList2 = allDataMap.get(84);
|
|
|
}
|
|
|
//重置数据顺序,先按表单分组,再按照行顺序重新装入集合
|
|
@@ -369,27 +380,28 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
|
|
|
keys.addAll(voList3.stream().sorted(Comparator.comparing(TableDataVO::getDictRow)).map(l -> l.getTabKey()).collect(Collectors.toList()));
|
|
|
//判断数据长度是否超过单表总行数
|
|
|
List<List<Object>> lists = CommonUtils.splitList(values, oneTableRows);
|
|
|
- //多页分开存入
|
|
|
- for (int i = 0; i < tableTotal; i++) {
|
|
|
- Map<String, Object> DataInfo = dataInfos.get(tableIds.get(i));
|
|
|
- List<Object> data2 = lists.get(i);
|
|
|
- for (int j = 0; j < data2.size(); j++) {
|
|
|
- DataInfo.put(keys.get(j), data2.get(j));
|
|
|
- }
|
|
|
- if (dict == 82) {
|
|
|
- //土地
|
|
|
- big2.put(tableIds.get(i),data2.stream().map(l -> new BigDecimal(l + "")).reduce(BigDecimal.valueOf(0), BigDecimal::add));
|
|
|
- } else
|
|
|
- if (dict == 400) {
|
|
|
- big3.put(tableIds.get(i),data2.stream().map(l -> new BigDecimal(l + "")).reduce(BigDecimal.valueOf(0), BigDecimal::add));
|
|
|
- } else
|
|
|
- if (dict == 85) {
|
|
|
- //时段
|
|
|
- big4.put(tableIds.get(i),data2.stream().map(l -> new BigDecimal(l + "")).reduce(BigDecimal.valueOf(0), BigDecimal::add));
|
|
|
- } else
|
|
|
- //如果是合计的就要添加进总合计
|
|
|
- if (dict == 86) {
|
|
|
- big.put(tableIds.get(i),data2.stream().map(l -> new BigDecimal(l + "")).reduce(BigDecimal.valueOf(0), BigDecimal::add));
|
|
|
+ if (lists.size() != 0) {
|
|
|
+ //多页分开存入
|
|
|
+ for (int i = 0; i < tableTotal; i++) {
|
|
|
+ Map<String, Object> DataInfo = dataInfos.get(tableIds.get(i));
|
|
|
+ log.info(i + "----" + lists);
|
|
|
+ List<Object> data2 = lists.get(i);
|
|
|
+ for (int j = 0; j < data2.size(); j++) {
|
|
|
+ DataInfo.put(keys.get(j), data2.get(j));
|
|
|
+ }
|
|
|
+ if (dict == 82) {
|
|
|
+ //土地
|
|
|
+ big2.put(tableIds.get(i), data2.stream().map(l -> new BigDecimal(l + "")).reduce(BigDecimal.valueOf(0), BigDecimal::add));
|
|
|
+ } else if (dict == 400) {
|
|
|
+ big3.put(tableIds.get(i), data2.stream().map(l -> new BigDecimal(l + "")).reduce(BigDecimal.valueOf(0), BigDecimal::add));
|
|
|
+ } else if (dict == 85) {
|
|
|
+ //时段
|
|
|
+ big4.put(tableIds.get(i), data2.stream().map(l -> new BigDecimal(l + "")).reduce(BigDecimal.valueOf(0), BigDecimal::add));
|
|
|
+ } else
|
|
|
+ //如果是合计的就要添加进总合计
|
|
|
+ if (dict == 86) {
|
|
|
+ big.put(tableIds.get(i), data2.stream().map(l -> new BigDecimal(l + "")).reduce(BigDecimal.valueOf(0), BigDecimal::add));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -467,6 +479,7 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
throw new ServiceException("生成:"+linkTable.getTableName()+"失败");
|
|
|
}
|
|
|
}
|