From 3937adaccde2daae723f8299278e0155106e3274 Mon Sep 17 00:00:00 2001 From: pftian <953072562@qq.com> Date: Fri, 31 May 2019 14:34:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=99=E4=B8=AA=E6=97=A0=E9=99=90=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E5=B5=8C=E5=A5=97=EF=BC=8C=E5=8F=AA=E6=98=AF=E6=80=BB?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E7=9A=84=E4=B8=80=E9=83=A8=E5=88=86=E3=80=82?= =?UTF-8?q?=E3=80=82=E3=80=82=E6=88=91=E5=B7=B2=E7=BB=8F=E7=BB=95=E6=99=95?= =?UTF-8?q?=E5=9C=A8=E9=BB=84=E6=A1=B7=E6=B9=BE=E7=AB=8B=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- java/InfiniteCycle | 79 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 java/InfiniteCycle diff --git a/java/InfiniteCycle b/java/InfiniteCycle new file mode 100644 index 0000000..6af601c --- /dev/null +++ b/java/InfiniteCycle @@ -0,0 +1,79 @@ +// 这个无限循环嵌套,只是总循环的一部分。。。我已经绕晕在黄桷湾立交 +if (recordList.size() > start) { + for (int i = start; i < end; i++) { + Map map = recordList.get(i); + Map field11 = (Map) map.get("field"); //name -> code + Map record11 = (Map) map.get("record"); // code -> value + String catagory1 = map.get("categoryId").toString(); + // 查询第一种类型对应的其他类型 + SalaryDataVo ss = JSON.parseObject(JSON.toJSONString(map), SalaryDataVo.class); + Page page3 = salaryManagerService.getAllRecordsByCondition(ss); + if (page3.getRecords().size() > 0) { + List> salaryDataVos = page3.getRecords(); + salaryDataVos = this.reSetMap(salaryDataVos,null,null); + for (Map map2 : salaryDataVos) { + Map field2 = (Map) map2.get("field"); + Map record2 = (Map) map2.get("record"); + String catagory2 = map2.get("categoryId").toString(); + List groupList2 = salaryGroupService.getSalaryGroupsItems(this.getUserCorpId(), catagory2); + for (SalaryGroupVO cc : groupList2) { + cc.setCode(cc.getParentId() + cc.getCode()); + } + //计算 + for (Map.Entry entity : field2.entrySet()) { + String keyName = entity.getKey(); + for (SalaryGroupVO s2 : groupList2) { + if ("bigDecimal".equals(s2.getItemType()) && s2.getCode().equals(field2.get(keyName).toString()) && ("部门" != keyName) && ("姓名" != keyName) && StringUtils.isNotEmpty(s2.getItemType())) { + if (field11.containsKey(keyName)) { + if (field11.containsKey(keyName)) { + String code1 = field11.get(keyName).toString(); + Double newValue = 0.0; + Double oldValue=0.0; + if (!record11.get(code1).toString().matches("^[0-9]*$")) { + oldValue = Double.parseDouble(record11.get(code1).toString()); + if (record2.containsKey(entity.getValue().toString()) && (!record2.get(entity.getValue().toString()).toString().matches("^[0-9]*$"))) { + String value2 = record2.get(entity.getValue().toString()).toString(); + newValue = Double.parseDouble(value2); + } + record11.remove(field11.get(keyName).toString()); + } + if (code1.startsWith(catagory1)||code1.startsWith(catagory2)) { + String co = code1.replace(catagory1, "hz"); + field11.put(keyName, co); + record11.put(co , oldValue + newValue); + } + } + } else { + String code=entity.getValue().toString(); + String str=entity.getValue().toString(); + Object value2 = record2.get(entity.getValue().toString()); + if(str.startsWith(catagory1)&&str.replace(catagory1,"").startsWith("hz")){ + code=str.replace(catagory1,""); + }else if(str.startsWith(catagory2)&&str.replace(catagory2,"").startsWith("hz")){ + code= str.replace(catagory2,""); + } + field11.put(keyName, code); + record11.put(code, value2); + } + } + } + } + } + } + List sList=salaryGroupService.getSalaryGroupItemsByParentId(catagory1); + for(SalaryGroupVO s:sList){ + if(field11.containsKey(s.getName())&&s.getCode().startsWith("hz")){ + String k=field11.get(s.getName()).toString(); + + field11.put(s.getName(),s.getCode()); + String value=null; + if(record11.containsKey(k)){ + value=record11.get(k).toString(); + } + record11.put(s.getCode(),value); + } + } + resultList.add(map); + pageInfo.setRecords(resultList); + } + } \ No newline at end of file -- Gitee