|
@@ -82,15 +82,11 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
|
|
|
compensationInfoService.batchUpdateStatus(Func.toLongList(agreementInfo.getAgreementIds()), 0);
|
|
|
}
|
|
|
//复制一份当前合同下对应的结算协议到中间表
|
|
|
-
|
|
|
- //先新增中间表,
|
|
|
List<WbsTreePrivate> tables = compensationInfoService.getTables(info.getProjectId(), info.getType() + 3);
|
|
|
List<AgreementLinkTable> linkTables = tables.stream().map(l -> {
|
|
|
AgreementLinkTable table = new AgreementLinkTable();
|
|
|
table.setTableId(Long.parseLong(l.getInitTableId()));
|
|
|
table.setProjectId(info.getProjectId());
|
|
|
-// table.setTableDataId(SnowFlakeUtil.getId());
|
|
|
-// table.setId(SnowFlakeUtil.getId());
|
|
|
table.setAgreementId(info.getId());
|
|
|
table.setPrivateId(l.getId());
|
|
|
table.setSort(l.getSort());
|
|
@@ -99,8 +95,9 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
|
|
|
table.setTableName(l.getNodeName());
|
|
|
return table;
|
|
|
}).collect(Collectors.toList());
|
|
|
+ //先保存中间表
|
|
|
linkTableService.saveBatch(linkTables);
|
|
|
- //批量修改选中的状态
|
|
|
+ //批量修改补偿协议状态
|
|
|
compensationInfoService.batchUpdateStatus(ids, 1);
|
|
|
//获取所有选中的补偿协议
|
|
|
List<CompensationInfo> compensationInfos = compensationInfoService.listByIds(ids);
|
|
@@ -129,91 +126,50 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
|
|
|
} else {
|
|
|
this.updateById(info);
|
|
|
}
|
|
|
- //循环结算协议的统计字段,把补偿协议统计出来的字段设置到结算协议
|
|
|
- //生成封面
|
|
|
- buildPdf1(linkTables.get(0), info.getStage());
|
|
|
- //生成补偿结算表
|
|
|
- buildPdf2(linkTables.get(1),info.getAreaId());
|
|
|
- //生成补偿费发放统计表
|
|
|
- buildPdf3(linkTables.get(2),ids);
|
|
|
- //生成补偿费明细表
|
|
|
- buildPdf4(linkTables.get(3),ids,info.getStage());
|
|
|
- //生成补偿资金数量分配表
|
|
|
-// buildPdf5(linkTables.get(4),ids);
|
|
|
- //生成面积统计明细表
|
|
|
+ //自动生成后管配置的所有结算表单,超过一页自动分页
|
|
|
+ buildPdf(linkTables,info);
|
|
|
//合并PDF
|
|
|
-// try {
|
|
|
this.mergePdfs(info.getId());
|
|
|
-// }catch (Exception e){
|
|
|
-// throw new ServiceException("合并PDF失败");
|
|
|
-// }
|
|
|
- }
|
|
|
-
|
|
|
-// private void buildPdf5(AgreementLinkTable linkTable, List<Long> ids) {
|
|
|
-//
|
|
|
-// }
|
|
|
|
|
|
- private void buildPdf4(AgreementLinkTable linkTable, List<Long> ids,String stage) {
|
|
|
- try {
|
|
|
- //周期格式
|
|
|
- stage = stage.substring(1,stage.length()-1);
|
|
|
- //获取项目名称
|
|
|
- String projectName = jdbcTemplate.queryForObject("select project_name from m_project_info where id = " + linkTable.getProjectId(), String.class);
|
|
|
- List<WbsFormElement> list = baseMapper.getTableElement(linkTable.getTableId());
|
|
|
- Map<Long,Map<String, Object>> dataInfos = new LinkedHashMap<>();
|
|
|
- //获取所有的补偿协议映射表中的发放表
|
|
|
- List<AgreementLinkTable> assignTable = baseMapper.getAllAssignTable(ids, "发放表");
|
|
|
- List<Long> longs = assignTable.stream().map(l -> l.getTableDataId()).collect(Collectors.toList());
|
|
|
- //获取发放表的配置
|
|
|
- List<WbsFormElement> dataElements = baseMapper.getTableElement(assignTable.get(0).getTableId());
|
|
|
- if (dataElements == null || dataElements.size() == 0){
|
|
|
- compensationInfoService.getBussPdfInfo(linkTable.getId(), null);
|
|
|
- }
|
|
|
- Map<String, Integer> dataMap = dataElements.stream().collect(Collectors.toMap(WbsFormElement::getEKey, WbsFormElement::getDynamicDict));
|
|
|
- //获取所有补偿费发放表中的数据
|
|
|
- List<TableDataVO> dataVOS = compensationInfoMapper.getBussDataInfoByDataIds(longs);
|
|
|
- dataVOS = dataVOS.stream().filter(l -> dataMap.get(l.getDictKey()) != null).collect(Collectors.toList());
|
|
|
- if (dataVOS.size() == 0){
|
|
|
- compensationInfoService.getBussPdfInfo(linkTable.getId(), null);
|
|
|
- }
|
|
|
- dataVOS.stream().forEach(l->l.setDictValue(dataMap.get(l.getDictKey())));
|
|
|
- Map<Integer, List<TableDataVO>> listMap = dataVOS.stream().collect(Collectors.groupingBy(TableDataVO::getDictValue));
|
|
|
-
|
|
|
- if (list != null && list.size() > 0) {
|
|
|
- //字典为key,位置为value
|
|
|
- Map<Integer, String> elementMap = list.stream().collect(Collectors.toMap(WbsFormElement::getDynamicDict, WbsFormElement::getEKey));
|
|
|
- //位置为key,字典为value
|
|
|
- Map<String, Integer> overMap = list.stream().collect(Collectors.toMap(WbsFormElement::getEKey, WbsFormElement::getDynamicDict));
|
|
|
- //解析html获取所以实际的key
|
|
|
- Document doc = Jsoup.parse(new File(linkTable.getHtmlUrl()), "utf-8");
|
|
|
-// Document doc = Jsoup.parse(new File("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1704076903561822208.html"), "utf-8");
|
|
|
- Element table = doc.select("table").first();
|
|
|
- //此表key重复,直接获取所有
|
|
|
- List<TableDataVO> allKey = table.getElementsByAttribute("id").stream().map(l -> {
|
|
|
- TableDataVO vo = new TableDataVO();
|
|
|
- String s = l.attr("id");
|
|
|
- vo.setTabKey(s);
|
|
|
- if (s.contains("__")) {
|
|
|
- String[] s1 = s.split("__");
|
|
|
- vo.setDictKey(s1[0]);
|
|
|
- String[] s2 = s1[1].split("_");
|
|
|
- vo.setDictRow(Integer.parseInt(s2[0]));
|
|
|
- }
|
|
|
- return vo;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- allKey = allKey.stream().filter(l -> overMap.get(l.getDictKey()) != null).collect(Collectors.toList());
|
|
|
- if (allKey.size() == 0){
|
|
|
- compensationInfoService.getBussPdfInfo(linkTable.getId(), null);
|
|
|
- }
|
|
|
- allKey.stream().forEach(l->l.setDictValue(overMap.get(l.getDictKey())));
|
|
|
- Map<Integer, List<TableDataVO>> listMap2 = allKey.stream().collect(Collectors.groupingBy(TableDataVO::getDictValue));
|
|
|
+ }
|
|
|
|
|
|
- //确定长度的key的字典,因为其他字段可能为空,姓名不为空,所以通过姓名获取数据长度
|
|
|
- Integer nameDict = 80;
|
|
|
- //重复key的字典
|
|
|
- List<Integer> batchKey2 = Arrays.asList(82, 400, 85, 86);
|
|
|
- //重复key需要统计总和的字典
|
|
|
- List<Integer> batchKey3 = Arrays.asList(82, 400, 85, 86);
|
|
|
+ /**
|
|
|
+ * 整合生成所有结算PDF
|
|
|
+ */
|
|
|
+ private void buildPdf(List<AgreementLinkTable> list,ClearingAgreementInfo info){
|
|
|
+ List<Long> agreeIds = Func.toLongList(info.getAgreementIds());
|
|
|
+ //获取选择的补偿协议下所有的填报数据
|
|
|
+ List<TableDataVO> dataVOS = baseMapper.getAllDataByAgreeIds(agreeIds);
|
|
|
+ //填报数据按照字典分组
|
|
|
+ Map<Integer, List<TableDataVO>> allDataMap = dataVOS.stream().collect(Collectors.groupingBy(TableDataVO::getDictValue));
|
|
|
+ //获取结算协议所有表单的配置
|
|
|
+ List<Long> endTableIds = list.stream().map(l -> l.getTableId()).collect(Collectors.toList());
|
|
|
+ List<WbsFormElement> endConfigs = compensationInfoMapper.getTableElement(endTableIds);
|
|
|
+ //配置按照tableId分组
|
|
|
+ Map<String, List<WbsFormElement>> endAllConfigMap = endConfigs.stream().collect(Collectors.groupingBy(WbsFormElement::getFId));
|
|
|
+ //----------------------生成通用值--------------------------//
|
|
|
+ //周期格式
|
|
|
+ String stage = info.getStage();
|
|
|
+ stage = stage.substring(1,stage.length()-1);
|
|
|
+ //项目名称
|
|
|
+ String projectName = jdbcTemplate.queryForObject("select project_name from m_project_info where id = " + info.getProjectId(), String.class);
|
|
|
+ //当前时间
|
|
|
+ String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
|
|
|
+ //被征收土地桩号
|
|
|
+ String areaNumber = "当前区域未配置桩号";
|
|
|
+ RegionTreeInfo treeInfo = treeInfoService.getById(info.getAreaId());
|
|
|
+ if (StringUtils.isNotBlank(treeInfo.getStakeMark())){
|
|
|
+ areaNumber = treeInfo.getStakeMark();
|
|
|
+ }
|
|
|
+ //----------------------字典分类--------------------------//
|
|
|
+ //确定长度的key的字典,因为其他字段可能为空,姓名不为空,所以通过姓名获取数据长度
|
|
|
+ Integer nameDict = 80;
|
|
|
+ //重复key的字典,目前只根据发放表,到时候根据主表附表再分配
|
|
|
+ //80户主姓名,81身份证号,82土地金额,83青苗金额,84地上金额,(400为83,84合并统计)85时段奖,86补偿金额合计,87银行卡号
|
|
|
+ List<Integer> batchKey2 = Arrays.asList(81,82,400,85, 86);
|
|
|
+ //------------------循环表单,为每张表生成值-----------------//
|
|
|
+ for (AgreementLinkTable linkTable : list) {
|
|
|
+ try {
|
|
|
//统计补偿总和
|
|
|
Map<Long,BigDecimal> big = new HashMap<>();
|
|
|
//土地总和
|
|
@@ -232,358 +188,83 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
|
|
|
Integer tableTotal = 0;
|
|
|
//表单id,按顺序
|
|
|
LinkedList<Long> tableIds = new LinkedList<>();
|
|
|
- //先设置姓名,查看一共有多少条数据
|
|
|
- if (listMap.get(nameDict) != null && listMap.get(nameDict).size() > 0) {
|
|
|
- List<TableDataVO> voList = listMap.get(nameDict);
|
|
|
- //重置数据顺序,先按表单分组,再按照行顺序重新装入集合
|
|
|
- Map<Long, List<TableDataVO>> map = voList.stream().collect(Collectors.groupingBy(TableDataVO::getPKeyId));
|
|
|
- List<Long> collect = map.keySet().stream().sorted().collect(Collectors.toList());
|
|
|
- List<Object> data = new ArrayList<>();
|
|
|
- for (Long aLong : collect) {
|
|
|
- List<TableDataVO> vos = map.get(aLong);
|
|
|
- tableRows.put(aLong, vos.size());
|
|
|
- vos = vos.stream().sorted(Comparator.comparing(TableDataVO::getDictRow)).collect(Collectors.toList());
|
|
|
- oneRows = vos.get(0).getDictRow();
|
|
|
- data.addAll(vos.stream().map(l -> l.getTabVal()).collect(Collectors.toList()));
|
|
|
- }
|
|
|
- //取出位置集合
|
|
|
- List<TableDataVO> voList2 = listMap2.get(nameDict);
|
|
|
- List<String> keys = new ArrayList<>();
|
|
|
- voList2 = voList2.stream().sorted(Comparator.comparing(TableDataVO::getDictRow)).collect(Collectors.toList());
|
|
|
- keys.addAll(voList2.stream().map(l -> l.getTabKey()).collect(Collectors.toList()));
|
|
|
- //单表总行数
|
|
|
- oneTableRows = keys.size();
|
|
|
- //判断数据长度是否超过单表总行数
|
|
|
- List<List<Object>> lists = CommonUtils.splitList(data, oneTableRows);
|
|
|
- tableTotal = lists.size();
|
|
|
- for (int i = 0; i < tableTotal; i++) {
|
|
|
- Map<String, Object> DataInfo = new HashMap<>();
|
|
|
- if (i == 0){
|
|
|
- dataInfos.put(linkTable.getId(),DataInfo);
|
|
|
- tableIds.add(linkTable.getId());
|
|
|
- }else {
|
|
|
- //复制表,返回表id
|
|
|
- Long aLong = this.copyTable(linkTable);
|
|
|
- dataInfos.put(aLong,DataInfo);
|
|
|
- tableIds.add(aLong);
|
|
|
- }
|
|
|
- }
|
|
|
- //为多表的统计字段设置默认值
|
|
|
- for (Long id : tableIds) {
|
|
|
- big.put(id,new BigDecimal(0));
|
|
|
- big2.put(id,new BigDecimal(0));
|
|
|
- big3.put(id,new BigDecimal(0));
|
|
|
- big4.put(id,new BigDecimal(0));
|
|
|
- }
|
|
|
-
|
|
|
- //多页分开存入
|
|
|
- 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));
|
|
|
- }
|
|
|
- }
|
|
|
- elementMap.remove(nameDict);
|
|
|
- }else {
|
|
|
- compensationInfoService.getBussPdfInfo(linkTable.getId(), null);
|
|
|
- }
|
|
|
- //先设置批量字段,最后设置统计字段
|
|
|
- for (Integer dict : elementMap.keySet()) {
|
|
|
- if (batchKey2.contains(dict)) {
|
|
|
- List<Object> values = new ArrayList<>();
|
|
|
- if (dict.equals(400)) {
|
|
|
- //单独处理青苗+地面
|
|
|
- //取出83(青苗)数据集合
|
|
|
- List<TableDataVO> voList = new ArrayList<>();
|
|
|
- if (listMap.get(83) != null) {
|
|
|
- voList = listMap.get(83);
|
|
|
- }
|
|
|
- //重置数据顺序,先按表单分组,再按照行顺序重新装入集合
|
|
|
- Map<Long, List<TableDataVO>> map = voList.stream().collect(Collectors.groupingBy(TableDataVO::getPKeyId));
|
|
|
- //取出84(地面)数据集合
|
|
|
- List<TableDataVO> voList2 = new ArrayList<>();
|
|
|
- if (listMap.get(84) != null){
|
|
|
- voList2 = listMap.get(84);
|
|
|
- }
|
|
|
- //重置数据顺序,先按表单分组,再按照行顺序重新装入集合
|
|
|
- Map<Long, List<TableDataVO>> map2 = voList2.stream().collect(Collectors.groupingBy(TableDataVO::getPKeyId));
|
|
|
- //根据总行数和起始位置,生成青苗+地面的集合
|
|
|
- for (Long aLong : tableRows.keySet()) {
|
|
|
- Integer ro = tableRows.get(aLong);
|
|
|
- //获取当前表青苗集合,并且按照行转换为map
|
|
|
- List<TableDataVO> vos = new ArrayList<>();
|
|
|
- //因为可能整张表都没填写,所以为null
|
|
|
- if (map.size() != 0 && map.get(aLong) != null) {
|
|
|
- vos = map.get(aLong);
|
|
|
- }
|
|
|
- Map<Integer, BigDecimal> map3 = vos.stream().collect(Collectors.groupingBy(TableDataVO::getDictRow,
|
|
|
- Collectors.mapping(l -> new BigDecimal(l.getTabVal()), Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
|
|
|
- //获取当前表地面集合
|
|
|
- List<TableDataVO> vos2 = new ArrayList<>();
|
|
|
- if (map2.size() != 0 && map2.get(aLong) != null) {
|
|
|
- vos2 = map2.get(aLong);
|
|
|
- }
|
|
|
- Map<Integer, BigDecimal> map4 = vos2.stream().collect(Collectors.groupingBy(TableDataVO::getDictRow,
|
|
|
- Collectors.mapping(l -> new BigDecimal(l.getTabVal()), Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
|
|
|
- for (int i = oneRows; i < (oneRows + ro); i++) {
|
|
|
- BigDecimal value = new BigDecimal(0);
|
|
|
- if (map3.size() != 0 && map3.get(i) != null) {
|
|
|
- value = value.add(map3.get(i));
|
|
|
- }
|
|
|
- if (map4.size() != 0 && map4.get(i) != null) {
|
|
|
- value = value.add(map4.get(i));
|
|
|
- }
|
|
|
- values.add(value);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- //取出数据
|
|
|
- List<TableDataVO> voList = new ArrayList<>();
|
|
|
- if (listMap.get(dict) != null) {
|
|
|
- voList = listMap.get(dict);
|
|
|
- }
|
|
|
- //重置数据顺序,先按表单分组,再按照行顺序重新装入集合
|
|
|
- Map<Long, List<TableDataVO>> map = voList.stream().collect(Collectors.groupingBy(TableDataVO::getPKeyId));
|
|
|
- for (Long aLong : tableRows.keySet()) {
|
|
|
- Integer ro = tableRows.get(aLong);
|
|
|
- //获取当前表青苗集合,并且按照行转换为map
|
|
|
- List<TableDataVO> vos = new ArrayList<>();
|
|
|
- if (map.size() != 0 && map.get(aLong) != null) {
|
|
|
- vos = map.get(aLong);
|
|
|
- }
|
|
|
- Map<Integer, BigDecimal> map3 = vos.stream().collect(Collectors.groupingBy(TableDataVO::getDictRow,
|
|
|
- Collectors.mapping(l -> new BigDecimal(l.getTabVal()), Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
|
|
|
- for (int i = oneRows; i < (oneRows + ro); i++) {
|
|
|
- BigDecimal value = new BigDecimal(0);
|
|
|
- if (map3.size() != 0 && map3.get(i) != null) {
|
|
|
- value = value.add(map3.get(i));
|
|
|
- }
|
|
|
- values.add(value);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //取出位置集合
|
|
|
- List<TableDataVO> voList3 = listMap2.get(dict);
|
|
|
- List<String> keys = new ArrayList<>();
|
|
|
- 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));
|
|
|
- }
|
|
|
- if (dict == 400) {
|
|
|
- big3.put(tableIds.get(i),data2.stream().map(l -> new BigDecimal(l + "")).reduce(BigDecimal.valueOf(0), BigDecimal::add));
|
|
|
- }
|
|
|
- if (dict == 85) {
|
|
|
- //时段
|
|
|
- big4.put(tableIds.get(i),data2.stream().map(l -> new BigDecimal(l + "")).reduce(BigDecimal.valueOf(0), BigDecimal::add));
|
|
|
- }
|
|
|
- //如果是合计的就要添加进总合计
|
|
|
- if (dict == 86) {
|
|
|
- big.put(tableIds.get(i),data2.stream().map(l -> new BigDecimal(l + "")).reduce(BigDecimal.valueOf(0), BigDecimal::add));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- for (Integer dict : elementMap.keySet()) {
|
|
|
- if (!batchKey2.contains(dict)) {
|
|
|
- TableDataVO vo = listMap2.get(dict).get(0);
|
|
|
- for (int i = 0; i < tableTotal; i++) {
|
|
|
- Map<String, Object> DataInfo = dataInfos.get(tableIds.get(i));
|
|
|
- switch (dict) {
|
|
|
- case 197:
|
|
|
- //项目名称
|
|
|
- DataInfo.put(vo.getTabKey(), projectName);
|
|
|
- break;
|
|
|
- case 198:
|
|
|
- //当天日期
|
|
|
- DataInfo.put(vo.getTabKey(), LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")));
|
|
|
- break;
|
|
|
- case 199:
|
|
|
- //周期
|
|
|
- DataInfo.put(vo.getTabKey(), stage);
|
|
|
- break;
|
|
|
- case 301:
|
|
|
- //合计补偿总计
|
|
|
- DataInfo.put(vo.getTabKey(), big.get(tableIds.get(i)));
|
|
|
- break;
|
|
|
- case 401:
|
|
|
- //制表人
|
|
|
- DataInfo.put(vo.getTabKey(), "王文");
|
|
|
- break;
|
|
|
- case 402:
|
|
|
- //总计土地
|
|
|
- DataInfo.put(vo.getTabKey(), big2.get(tableIds.get(i)));
|
|
|
- break;
|
|
|
- case 403:
|
|
|
- //总计青苗及地上
|
|
|
- DataInfo.put(vo.getTabKey(), big3.get(tableIds.get(i)));
|
|
|
- break;
|
|
|
- case 404:
|
|
|
- //总计时段奖
|
|
|
- DataInfo.put(vo.getTabKey(), big4.get(tableIds.get(i)));
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- for (Long aLong : dataInfos.keySet()) {
|
|
|
- compensationInfoService.getBussPdfInfo(aLong, dataInfos.get(aLong));
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- throw new ServiceException("补偿费明细表生成失败:"+e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void buildPdf3(AgreementLinkTable linkTable,List<Long> ids) {
|
|
|
- try {
|
|
|
- //获取项目名称
|
|
|
- String projectName = jdbcTemplate.queryForObject("select project_name from m_project_info where id = " + linkTable.getProjectId(), String.class);
|
|
|
- List<WbsFormElement> list = baseMapper.getTableElement(linkTable.getTableId());
|
|
|
- Map<Long,Map<String, Object>> dataInfos = new LinkedHashMap<>();
|
|
|
- //获取所有的补偿协议映射表中的发放表
|
|
|
- List<AgreementLinkTable> assignTable = baseMapper.getAllAssignTable(ids, "发放表");
|
|
|
- List<Long> longs = assignTable.stream().map(l -> l.getTableDataId()).collect(Collectors.toList());
|
|
|
- //获取发放表的配置
|
|
|
- List<WbsFormElement> dataElements = baseMapper.getTableElement(assignTable.get(0).getTableId());
|
|
|
- if (dataElements == null || dataElements.size() == 0){
|
|
|
- compensationInfoService.getBussPdfInfo(linkTable.getId(), null);
|
|
|
- }
|
|
|
- Map<String, Integer> dataMap = dataElements.stream().collect(Collectors.toMap(WbsFormElement::getEKey, WbsFormElement::getDynamicDict));
|
|
|
- //获取所有补偿费发放表中的数据
|
|
|
- List<TableDataVO> dataVOS = compensationInfoMapper.getBussDataInfoByDataIds(longs);
|
|
|
- dataVOS = dataVOS.stream().filter(l -> dataMap.get(l.getDictKey()) != null).collect(Collectors.toList());
|
|
|
- if (dataVOS.size() == 0){
|
|
|
- compensationInfoService.getBussPdfInfo(linkTable.getId(), null);
|
|
|
- }
|
|
|
- dataVOS.stream().forEach(l->l.setDictValue(dataMap.get(l.getDictKey())));
|
|
|
- Map<Integer, List<TableDataVO>> listMap = dataVOS.stream().collect(Collectors.groupingBy(TableDataVO::getDictValue));
|
|
|
-
|
|
|
- if (list != null && list.size() > 0) {
|
|
|
- //字典为key,位置为value
|
|
|
- Map<Integer, String> elementMap = list.stream().collect(Collectors.toMap(WbsFormElement::getDynamicDict, WbsFormElement::getEKey));
|
|
|
- //位置为key,字典为value
|
|
|
- Map<String, Integer> overMap = list.stream().collect(Collectors.toMap(WbsFormElement::getEKey, WbsFormElement::getDynamicDict));
|
|
|
- //解析html获取所以实际的key
|
|
|
- Document doc = Jsoup.parse(new File(linkTable.getHtmlUrl()), "utf-8");
|
|
|
-// Document doc = Jsoup.parse(new File("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1704076712393834496.html"), "utf-8");
|
|
|
- Element table = doc.select("table").first();
|
|
|
- //此表key重复,直接获取所有
|
|
|
- List<TableDataVO> allKey = table.getElementsByAttribute("id").stream().map(l -> {
|
|
|
- TableDataVO vo = new TableDataVO();
|
|
|
- String s = l.attr("id");
|
|
|
- vo.setTabKey(s);
|
|
|
- if (s.contains("__")) {
|
|
|
- String[] s1 = s.split("__");
|
|
|
- vo.setDictKey(s1[0]);
|
|
|
- String[] s2 = s1[1].split("_");
|
|
|
- vo.setDictRow(Integer.parseInt(s2[0]));
|
|
|
- }
|
|
|
- return vo;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- allKey = allKey.stream().filter(l -> overMap.get(l.getDictKey()) != null).collect(Collectors.toList());
|
|
|
- if (allKey.size() == 0){
|
|
|
- compensationInfoService.getBussPdfInfo(linkTable.getId(), null);
|
|
|
- }
|
|
|
- allKey.stream().forEach(l->l.setDictValue(overMap.get(l.getDictKey())));
|
|
|
- Map<Integer, List<TableDataVO>> listMap2 = allKey.stream().collect(Collectors.groupingBy(TableDataVO::getDictValue));
|
|
|
- //确定长度的key的字典,因为其他字段可能为空,姓名不为空,所以通过姓名获取数据长度
|
|
|
- Integer nameDict = 80;
|
|
|
- //重复key的字典
|
|
|
- List<Integer> batchKey = Arrays.asList(80, 81, 86, 87);
|
|
|
- //当前数据的第一行
|
|
|
- Integer oneRows = 0;
|
|
|
- //生成结算表有多少行,用于跨页后复制表单
|
|
|
- Integer oneTableRows = 0;
|
|
|
- //判断每一张表有多少行,合并表时用于填充统计
|
|
|
- Map<Long,Integer> tableRows = new LinkedHashMap<>();
|
|
|
- //一共需要多少表
|
|
|
- Integer tableTotal = 0;
|
|
|
- //统计补偿总和
|
|
|
- Map<Long,BigDecimal> big = new HashMap<>();
|
|
|
- //表单id,按顺序
|
|
|
- LinkedList<Long> tableIds = new LinkedList<>();
|
|
|
- //先设置姓名,查看一共有多少条数据
|
|
|
- if (listMap.get(nameDict) != null && listMap.get(nameDict).size() > 0) {
|
|
|
- List<TableDataVO> voList = listMap.get(nameDict);
|
|
|
- //重置数据顺序,先按表单分组,再按照行顺序重新装入集合
|
|
|
- Map<Long, List<TableDataVO>> map = voList.stream().collect(Collectors.groupingBy(TableDataVO::getPKeyId));
|
|
|
- List<Long> collect = map.keySet().stream().sorted().collect(Collectors.toList());
|
|
|
- List<Object> data = new ArrayList<>();
|
|
|
- for (Long aLong : collect) {
|
|
|
- List<TableDataVO> vos = map.get(aLong);
|
|
|
- tableRows.put(aLong, vos.size());
|
|
|
- vos = vos.stream().sorted(Comparator.comparing(TableDataVO::getDictRow)).collect(Collectors.toList());
|
|
|
- oneRows = vos.get(0).getDictRow();
|
|
|
- data.addAll(vos.stream().map(l -> l.getTabVal()).collect(Collectors.toList()));
|
|
|
- }
|
|
|
- //取出位置集合
|
|
|
- List<TableDataVO> voList2 = listMap2.get(nameDict);
|
|
|
- List<String> keys = new ArrayList<>();
|
|
|
- voList2 = voList2.stream().sorted(Comparator.comparing(TableDataVO::getDictRow)).collect(Collectors.toList());
|
|
|
- keys.addAll(voList2.stream().map(l -> l.getTabKey()).collect(Collectors.toList()));
|
|
|
- //单表总行数
|
|
|
- oneTableRows = keys.size();
|
|
|
- //判断数据长度是否超过单表总行数
|
|
|
- List<List<Object>> lists = CommonUtils.splitList(data, oneTableRows);
|
|
|
- tableTotal = lists.size();
|
|
|
- for (int i = 0; i < tableTotal; i++) {
|
|
|
- Map<String, Object> DataInfo = new HashMap<>();
|
|
|
- if (i == 0){
|
|
|
- dataInfos.put(linkTable.getId(),DataInfo);
|
|
|
- tableIds.add(linkTable.getId());
|
|
|
- }else {
|
|
|
- //复制表,返回表id
|
|
|
- Long aLong = this.copyTable(linkTable);
|
|
|
- dataInfos.put(aLong,DataInfo);
|
|
|
- tableIds.add(aLong);
|
|
|
- }
|
|
|
- }
|
|
|
- //为多表的统计字段设置默认值
|
|
|
- for (Long id : tableIds) {
|
|
|
- big.put(id,new BigDecimal(0));
|
|
|
- }
|
|
|
-
|
|
|
- //多页分开存入
|
|
|
- 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));
|
|
|
+ Map<Long,Map<String, Object>> dataInfos = new LinkedHashMap<>();
|
|
|
+ //获取本表配置
|
|
|
+ List<WbsFormElement> configList = endAllConfigMap.get(linkTable.getTableId()+"");
|
|
|
+ //------------------当前表单没有配置字典直接跳过-----------------//
|
|
|
+ if (configList != null && configList.size() > 0) {
|
|
|
+ //字典为key,位置为value
|
|
|
+ Map<Integer, String> elementMap = configList.stream().collect(Collectors.toMap(WbsFormElement::getDynamicDict, WbsFormElement::getEKey));
|
|
|
+ //位置为key,字典为value
|
|
|
+ Map<String, Integer> overMap = configList.stream().collect(Collectors.toMap(WbsFormElement::getEKey, WbsFormElement::getDynamicDict));
|
|
|
+ //解析html获取所以实际的key
|
|
|
+ Document doc = Jsoup.parse(new File(linkTable.getHtmlUrl()), "utf-8");
|
|
|
+// Document doc = Jsoup.parse(new File("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1704076903561822208.html"), "utf-8");
|
|
|
+ Element table = doc.select("table").first();
|
|
|
+ //此表key重复,直接获取所有
|
|
|
+ List<TableDataVO> allKey = table.getElementsByAttribute("id").stream().map(l -> {
|
|
|
+ TableDataVO vo = new TableDataVO();
|
|
|
+ String s = l.attr("id");
|
|
|
+ vo.setTabKey(s);
|
|
|
+ if (s.contains("__")) {
|
|
|
+ String[] s1 = s.split("__");
|
|
|
+ vo.setDictKey(s1[0]);
|
|
|
+ String[] s2 = s1[1].split("_");
|
|
|
+ vo.setDictRow(Integer.parseInt(s2[0]));
|
|
|
}
|
|
|
+ return vo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ allKey = allKey.stream().filter(l -> overMap.get(l.getDictKey()) != null).collect(Collectors.toList());
|
|
|
+ if (allKey.size() == 0) {
|
|
|
+ continue;
|
|
|
}
|
|
|
- elementMap.remove(nameDict);
|
|
|
- }else {
|
|
|
- compensationInfoService.getBussPdfInfo(linkTable.getId(), null);
|
|
|
- }
|
|
|
- for (Integer dict : elementMap.keySet()) {
|
|
|
- if (batchKey.contains(dict)) {
|
|
|
- //取出数据集合
|
|
|
- List<TableDataVO> voList = listMap.get(dict);
|
|
|
+ allKey.stream().forEach(l -> l.setDictValue(overMap.get(l.getDictKey())));
|
|
|
+ Map<Integer, List<TableDataVO>> listMap2 = allKey.stream().collect(Collectors.groupingBy(TableDataVO::getDictValue));
|
|
|
+ //------------------有姓名,先生成姓名,姓名决定行数与是否分表-----------------//
|
|
|
+ if (elementMap.get(nameDict) != null && StringUtils.isNotBlank(elementMap.get(nameDict))
|
|
|
+ && allDataMap.get(nameDict) != null && allDataMap.get(nameDict).size() > 0) {
|
|
|
+ List<TableDataVO> voList = allDataMap.get(nameDict);
|
|
|
//重置数据顺序,先按表单分组,再按照行顺序重新装入集合
|
|
|
Map<Long, List<TableDataVO>> map = voList.stream().collect(Collectors.groupingBy(TableDataVO::getPKeyId));
|
|
|
List<Long> collect = map.keySet().stream().sorted().collect(Collectors.toList());
|
|
|
List<Object> data = new ArrayList<>();
|
|
|
for (Long aLong : collect) {
|
|
|
List<TableDataVO> vos = map.get(aLong);
|
|
|
- data.addAll(vos.stream().sorted(Comparator.comparing(TableDataVO::getDictRow)).map(l -> l.getTabVal()).collect(Collectors.toList()));
|
|
|
+ tableRows.put(aLong, vos.size());
|
|
|
+ vos = vos.stream().sorted(Comparator.comparing(TableDataVO::getDictRow)).collect(Collectors.toList());
|
|
|
+ oneRows = vos.get(0).getDictRow();
|
|
|
+ data.addAll(vos.stream().map(l -> l.getTabVal()).collect(Collectors.toList()));
|
|
|
}
|
|
|
//取出位置集合
|
|
|
- List<TableDataVO> voList2 = listMap2.get(dict);
|
|
|
+ List<TableDataVO> voList2 = listMap2.get(nameDict);
|
|
|
List<String> keys = new ArrayList<>();
|
|
|
- keys.addAll(voList2.stream().sorted(Comparator.comparing(TableDataVO::getDictRow)).map(l -> l.getTabKey()).collect(Collectors.toList()));
|
|
|
+ voList2 = voList2.stream().sorted(Comparator.comparing(TableDataVO::getDictRow)).collect(Collectors.toList());
|
|
|
+ keys.addAll(voList2.stream().map(l -> l.getTabKey()).collect(Collectors.toList()));
|
|
|
+ //单表总行数
|
|
|
+ oneTableRows = keys.size();
|
|
|
//判断数据长度是否超过单表总行数
|
|
|
List<List<Object>> lists = CommonUtils.splitList(data, oneTableRows);
|
|
|
+ tableTotal = lists.size();
|
|
|
+ for (int i = 0; i < tableTotal; i++) {
|
|
|
+ Map<String, Object> DataInfo = new HashMap<>();
|
|
|
+ if (i == 0){
|
|
|
+ dataInfos.put(linkTable.getId(),DataInfo);
|
|
|
+ tableIds.add(linkTable.getId());
|
|
|
+ }else {
|
|
|
+ //复制表,返回表id
|
|
|
+ Long aLong = this.copyTable(linkTable);
|
|
|
+ dataInfos.put(aLong,DataInfo);
|
|
|
+ tableIds.add(aLong);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //为多表的统计字段设置默认值
|
|
|
+ for (Long id : tableIds) {
|
|
|
+ big.put(id,new BigDecimal(0));
|
|
|
+ big2.put(id,new BigDecimal(0));
|
|
|
+ big3.put(id,new BigDecimal(0));
|
|
|
+ big4.put(id,new BigDecimal(0));
|
|
|
+ }
|
|
|
+
|
|
|
//多页分开存入
|
|
|
for (int i = 0; i < tableTotal; i++) {
|
|
|
Map<String, Object> DataInfo = dataInfos.get(tableIds.get(i));
|
|
@@ -591,158 +272,201 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
|
|
|
for (int j = 0; j < data2.size(); j++) {
|
|
|
DataInfo.put(keys.get(j), data2.get(j));
|
|
|
}
|
|
|
- //如果是合计的就要添加进总合计
|
|
|
- if (dict == 86) {
|
|
|
- big.put(tableIds.get(i),data2.stream().map(l -> new BigDecimal(l + "")).reduce(BigDecimal.valueOf(0), BigDecimal::add));
|
|
|
+ }
|
|
|
+ elementMap.remove(nameDict);
|
|
|
+ }else {
|
|
|
+ //没有姓名代表数据只有单表
|
|
|
+ tableTotal = 1;
|
|
|
+ Map<String, Object> DataInfo = new HashMap<>();
|
|
|
+ dataInfos.put(linkTable.getId(),DataInfo);
|
|
|
+ tableIds.add(linkTable.getId());
|
|
|
+ }
|
|
|
+ //------------------先设置批量字段,最后设置统计字段-----------------//
|
|
|
+ for (Integer dict : elementMap.keySet()) {
|
|
|
+ if (batchKey2.contains(dict)) {
|
|
|
+ //获取本表数据
|
|
|
+ List<Object> values = new ArrayList<>();
|
|
|
+ if (dict.equals(400)) {
|
|
|
+ //单独处理青苗+地面
|
|
|
+ //取出83(青苗)数据集合
|
|
|
+ List<TableDataVO> voList = new ArrayList<>();
|
|
|
+ if (allDataMap.get(83) != null) {
|
|
|
+ voList = allDataMap.get(83);
|
|
|
+ }
|
|
|
+ //重置数据顺序,先按表单分组,再按照行顺序重新装入集合
|
|
|
+ Map<Long, List<TableDataVO>> map = voList.stream().collect(Collectors.groupingBy(TableDataVO::getPKeyId));
|
|
|
+ //取出84(地面)数据集合
|
|
|
+ List<TableDataVO> voList2 = new ArrayList<>();
|
|
|
+ if (allDataMap.get(84) != null){
|
|
|
+ voList2 = allDataMap.get(84);
|
|
|
+ }
|
|
|
+ //重置数据顺序,先按表单分组,再按照行顺序重新装入集合
|
|
|
+ Map<Long, List<TableDataVO>> map2 = voList2.stream().collect(Collectors.groupingBy(TableDataVO::getPKeyId));
|
|
|
+ //根据总行数和起始位置,生成青苗+地面的集合
|
|
|
+ for (Long aLong : tableRows.keySet()) {
|
|
|
+ Integer ro = tableRows.get(aLong);
|
|
|
+ //获取当前表青苗集合,并且按照行转换为map
|
|
|
+ List<TableDataVO> vos = new ArrayList<>();
|
|
|
+ //因为可能整张表都没填写,所以为null
|
|
|
+ if (map.size() != 0 && map.get(aLong) != null) {
|
|
|
+ vos = map.get(aLong);
|
|
|
+ }
|
|
|
+ Map<Integer, BigDecimal> map3 = vos.stream().collect(Collectors.groupingBy(TableDataVO::getDictRow,
|
|
|
+ Collectors.mapping(l -> new BigDecimal(l.getTabVal()), Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
|
|
|
+ //获取当前表地面集合
|
|
|
+ List<TableDataVO> vos2 = new ArrayList<>();
|
|
|
+ if (map2.size() != 0 && map2.get(aLong) != null) {
|
|
|
+ vos2 = map2.get(aLong);
|
|
|
+ }
|
|
|
+ Map<Integer, BigDecimal> map4 = vos2.stream().collect(Collectors.groupingBy(TableDataVO::getDictRow,
|
|
|
+ Collectors.mapping(l -> new BigDecimal(l.getTabVal()), Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
|
|
|
+ for (int i = oneRows; i < (oneRows + ro); i++) {
|
|
|
+ BigDecimal value = new BigDecimal(0);
|
|
|
+ if (map3.size() != 0 && map3.get(i) != null) {
|
|
|
+ value = value.add(map3.get(i));
|
|
|
+ }
|
|
|
+ if (map4.size() != 0 && map4.get(i) != null) {
|
|
|
+ value = value.add(map4.get(i));
|
|
|
+ }
|
|
|
+ values.add(value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //取出数据
|
|
|
+ List<TableDataVO> voList = new ArrayList<>();
|
|
|
+ if (allDataMap.get(dict) != null) {
|
|
|
+ voList = allDataMap.get(dict);
|
|
|
+ }
|
|
|
+ //重置数据顺序,先按表单分组,再按照行顺序重新装入集合
|
|
|
+ Map<Long, List<TableDataVO>> map = voList.stream().collect(Collectors.groupingBy(TableDataVO::getPKeyId));
|
|
|
+ for (Long aLong : tableRows.keySet()) {
|
|
|
+ Integer ro = tableRows.get(aLong);
|
|
|
+ //获取当前表青苗集合,并且按照行转换为map
|
|
|
+ List<TableDataVO> vos = new ArrayList<>();
|
|
|
+ if (map.size() != 0 && map.get(aLong) != null) {
|
|
|
+ vos = map.get(aLong);
|
|
|
+ }
|
|
|
+ Map<Integer, BigDecimal> map3 = vos.stream().collect(Collectors.groupingBy(TableDataVO::getDictRow,
|
|
|
+ Collectors.mapping(l -> new BigDecimal(l.getTabVal()), Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
|
|
|
+ for (int i = oneRows; i < (oneRows + ro); i++) {
|
|
|
+ BigDecimal value = new BigDecimal(0);
|
|
|
+ if (map3.size() != 0 && map3.get(i) != null) {
|
|
|
+ value = value.add(map3.get(i));
|
|
|
+ }
|
|
|
+ values.add(value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //取出位置集合
|
|
|
+ List<TableDataVO> voList3 = listMap2.get(dict);
|
|
|
+ List<String> keys = new ArrayList<>();
|
|
|
+ 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));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- for (Integer dict : elementMap.keySet()) {
|
|
|
- if (!batchKey.contains(dict)) {
|
|
|
- for (int i = 0; i < tableTotal; i++) {
|
|
|
- Map<String, Object> DataInfo = dataInfos.get(tableIds.get(i));
|
|
|
+ //------------------再设置单个字段与统计字段----------------//
|
|
|
+ for (Integer dict : elementMap.keySet()) {
|
|
|
+ if (!batchKey2.contains(dict)) {
|
|
|
TableDataVO vo = listMap2.get(dict).get(0);
|
|
|
- switch (dict) {
|
|
|
- case 301:
|
|
|
- //合计补偿总计
|
|
|
- DataInfo.put(vo.getTabKey(), big.get(tableIds.get(i)));
|
|
|
- break;
|
|
|
- case 300:
|
|
|
- //统计员
|
|
|
- DataInfo.put(vo.getTabKey(), "王文");
|
|
|
- break;
|
|
|
- case 197:
|
|
|
- //项目名称
|
|
|
- DataInfo.put(vo.getTabKey(), projectName);
|
|
|
- break;
|
|
|
+ for (int i = 0; i < tableTotal; i++) {
|
|
|
+ Map<String, Object> DataInfo = dataInfos.get(tableIds.get(i));
|
|
|
+ switch (dict) {
|
|
|
+ case 197:
|
|
|
+ //项目名称
|
|
|
+ DataInfo.put(vo.getTabKey(), projectName);
|
|
|
+ break;
|
|
|
+ case 198:
|
|
|
+ //当天日期
|
|
|
+ DataInfo.put(vo.getTabKey(), date);
|
|
|
+ break;
|
|
|
+ case 199:
|
|
|
+ //周期
|
|
|
+ DataInfo.put(vo.getTabKey(), stage);
|
|
|
+ break;
|
|
|
+ case 200:
|
|
|
+ //申请单位
|
|
|
+ DataInfo.put(vo.getTabKey(),"重庆申请单位");
|
|
|
+ break;
|
|
|
+ case 201:
|
|
|
+ //申请次数
|
|
|
+ DataInfo.put(vo.getTabKey(),5);
|
|
|
+ break;
|
|
|
+ case 202:
|
|
|
+ //被征收土地桩号
|
|
|
+ DataInfo.put(vo.getTabKey(),areaNumber);
|
|
|
+ break;
|
|
|
+ case 203:
|
|
|
+ //被征收土地单位
|
|
|
+ DataInfo.put(vo.getTabKey(),"重庆被征收单位");
|
|
|
+ break;
|
|
|
+ case 204:
|
|
|
+ //本期补偿金额
|
|
|
+ DataInfo.put(vo.getTabKey(),"9000");
|
|
|
+ break;
|
|
|
+ case 205:
|
|
|
+ //累计补偿金额
|
|
|
+ DataInfo.put(vo.getTabKey(),"15000");
|
|
|
+ break;
|
|
|
+ case 301:
|
|
|
+ //合计补偿总计
|
|
|
+ DataInfo.put(vo.getTabKey(), big.get(tableIds.get(i)));
|
|
|
+ break;
|
|
|
+ case 401:
|
|
|
+ //制表人
|
|
|
+ DataInfo.put(vo.getTabKey(), "王文");
|
|
|
+ break;
|
|
|
+ case 402:
|
|
|
+ //总计土地
|
|
|
+ DataInfo.put(vo.getTabKey(), big2.get(tableIds.get(i)));
|
|
|
+ break;
|
|
|
+ case 403:
|
|
|
+ //总计青苗及地上
|
|
|
+ DataInfo.put(vo.getTabKey(), big3.get(tableIds.get(i)));
|
|
|
+ break;
|
|
|
+ case 404:
|
|
|
+ //总计时段奖
|
|
|
+ DataInfo.put(vo.getTabKey(), big4.get(tableIds.get(i)));
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- for (Long aLong : dataInfos.keySet()) {
|
|
|
- compensationInfoService.getBussPdfInfo(aLong, dataInfos.get(aLong));
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- throw new ServiceException("补偿费发放统计表生成失败");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void buildPdf2(AgreementLinkTable linkTable,Long areaId) {
|
|
|
- List<WbsFormElement> list = baseMapper.getTableElement(linkTable.getTableId());
|
|
|
- Map<String, Object> DataInfo = new HashMap<>();
|
|
|
- try {
|
|
|
- if (list != null && list.size() > 0) {
|
|
|
- //字典为key,位置为value
|
|
|
- Map<Integer, String> elementMap = list.stream().collect(Collectors.toMap(WbsFormElement::getDynamicDict, WbsFormElement::getEKey));
|
|
|
- //解析html获取所以实际的key
|
|
|
- Document doc = Jsoup.parse(new File(linkTable.getHtmlUrl()), "utf-8");
|
|
|
-// Document doc = Jsoup.parse(new File("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1711593963032412160.html"), "utf-8");
|
|
|
- Element table = doc.select("table").first();
|
|
|
- //因为此表的key不会重复,所以直接转map
|
|
|
- Map<String,String> tableKeys = new HashMap<>();
|
|
|
- table.getElementsByAttribute("id").stream().forEach(l -> {
|
|
|
- String s = l.attr("id");
|
|
|
- if (s.contains("__")) {
|
|
|
- String[] s1 = s.split("__");
|
|
|
- tableKeys.put(s1[0], s);
|
|
|
- }
|
|
|
- });
|
|
|
- for (Integer dict : elementMap.keySet()) {
|
|
|
- String s1 = tableKeys.get(elementMap.get(dict));
|
|
|
- switch (dict){
|
|
|
- case 198:
|
|
|
- //当天日期
|
|
|
- DataInfo.put(s1,LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")));
|
|
|
- break;
|
|
|
- case 200:
|
|
|
- //申请单位
|
|
|
- DataInfo.put(s1,"重庆申请单位");
|
|
|
- break;
|
|
|
- case 201:
|
|
|
- //申请次数
|
|
|
- DataInfo.put(s1,5);
|
|
|
- break;
|
|
|
- case 202:
|
|
|
- //被征收土地桩号
|
|
|
- RegionTreeInfo treeInfo = treeInfoService.getById(areaId);
|
|
|
- if (StringUtils.isBlank(treeInfo.getStakeMark())){
|
|
|
- DataInfo.put(s1,"当前区域未配置桩号");
|
|
|
- }else {
|
|
|
- DataInfo.put(s1, treeInfo.getStakeMark());
|
|
|
- }
|
|
|
- break;
|
|
|
- case 203:
|
|
|
- //被征收土地单位
|
|
|
- DataInfo.put(s1,"重庆被征收单位");
|
|
|
- break;
|
|
|
- case 204:
|
|
|
- //本期补偿金额
|
|
|
- DataInfo.put(s1,"9000");
|
|
|
- break;
|
|
|
- case 205:
|
|
|
- //累计补偿金额
|
|
|
- DataInfo.put(s1,"15000");
|
|
|
- break;
|
|
|
+ //------------------分别为表单生成PDF----------------//
|
|
|
+ for (Long aLong : dataInfos.keySet()) {
|
|
|
+ compensationInfoService.getBussPdfInfo(aLong, dataInfos.get(aLong));
|
|
|
}
|
|
|
}
|
|
|
+ }catch (Exception e){
|
|
|
+ throw new ServiceException("生成:"+linkTable.getTableName()+"失败");
|
|
|
}
|
|
|
- compensationInfoService.getBussPdfInfo(linkTable.getId(), DataInfo);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new ServiceException("补偿结算表生成失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 生成封面
|
|
|
- *
|
|
|
- * @param linkTable 表单信息
|
|
|
- * @param stage 第几期
|
|
|
- */
|
|
|
- private void buildPdf1(AgreementLinkTable linkTable, String stage) {
|
|
|
- //周期格式
|
|
|
- stage = stage.substring(1,stage.length()-1);
|
|
|
- List<WbsFormElement> list = baseMapper.getTableElement(linkTable.getTableId());
|
|
|
- Map<String, Object> DataInfo = new HashMap<>();
|
|
|
- try {
|
|
|
- if (list != null && list.size() > 0) {
|
|
|
- //字典为key,位置为value
|
|
|
- Map<Integer, String> elementMap = list.stream().collect(Collectors.toMap(WbsFormElement::getDynamicDict, WbsFormElement::getEKey));
|
|
|
- //解析html获取所以实际的key
|
|
|
- Document doc = Jsoup.parse(new File(linkTable.getHtmlUrl()), "utf-8");
|
|
|
-// Document doc = Jsoup.parse(new File("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1711593963032412160.html"), "utf-8");
|
|
|
- Element table = doc.select("table").first();
|
|
|
- //因为此表的key不会重复,所以直接转map
|
|
|
- Map<String,String> tableKeys = new HashMap<>();
|
|
|
- table.getElementsByAttribute("id").stream().forEach(l -> {
|
|
|
- String s = l.attr("id");
|
|
|
- if (s.contains("__")) {
|
|
|
- String[] s1 = s.split("__");
|
|
|
- tableKeys.put(s1[0], s);
|
|
|
- }
|
|
|
- });
|
|
|
- for (Integer dict : elementMap.keySet()) {
|
|
|
- String s1 = tableKeys.get(elementMap.get(dict));
|
|
|
- switch (dict){
|
|
|
- case 198:
|
|
|
- //当天日期
|
|
|
- DataInfo.put(s1,LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")));
|
|
|
- break;
|
|
|
- case 199:
|
|
|
- //周期
|
|
|
- DataInfo.put(s1,stage);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- compensationInfoService.getBussPdfInfo(linkTable.getId(), DataInfo);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new ServiceException("生成封面失败");
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 分页查询结算周期
|