| | |
| | | Map second = JsonUtil.jsonToPojo(JsonUtil.jsonToString(s), Map.class); |
| | | List<ParamJoinTemplate> collectSecond = paramJoinTemplates.stream().filter(p -> Objects.equals(s.getId(), p.getTechnologyOperationParamId())).collect(Collectors.toList()); |
| | | if(collectSecond.size()>0){ |
| | | second.put("paramValue",collectSecond.get(0).getDefaultValue()); |
| | | s.setParamValue(String.valueOf(second.get("paramValue"))); |
| | | System.out.println("第二层遍历前=====》"+collectSecond.get(0).getDefaultValue()); |
| | | if(!org.springframework.util.StringUtils.hasText(collectSecond.get(0).getDefaultValue())){ |
| | | s.setParamValue(""); |
| | | }else { |
| | | second.put("paramValue",collectSecond.get(0).getDefaultValue()); |
| | | s.setParamValue(collectSecond.get(0).getDefaultValue()); |
| | | } |
| | | }else { |
| | | second.put("paramValue",""); |
| | | s.setParamValue(String.valueOf(second.get("paramValue"))); |
| | | s.setParamValue(""); |
| | | } |
| | | System.out.println("第二层遍历后=====》"+s.getParamValue()); |
| | | Optional.ofNullable(second.get("type")).ifPresent(o->{ |
| | | List<SysDictItem> collect1 = dict.stream().filter(d -> Objects.equals(String.valueOf(d.getValue()), second.get("type"))).collect(Collectors.toList()); |
| | | if(collect1.size()>0){ |
| | |
| | | queryWrapperThird.lambda().eq(ParamJoinTemplate::getParentId,Long.valueOf(String.valueOf(s.getId()))); |
| | | List<ParamJoinTemplate> paramJoinTemplates2 = paramJoinTemplateMapper.selectList(queryWrapperThird); |
| | | third.removeIf(t -> paramJoinTemplates2.stream().noneMatch(p->Objects.equals(p.getTechnologyOperationParamId(),t.getId()))); |
| | | System.out.println("=11111111111111111==========================================>"+Objects.equals(s.getParamValue(),"null")); |
| | | boolean thirdIsNull =third.isEmpty(); |
| | | if(third.isEmpty()){ |
| | | Param p = new Param(); |
| | | p.setType(s.getType()); |
| | |
| | | third.add(p); |
| | | } |
| | | third.forEach(t->{ |
| | | if(thirdIsNull){ |
| | | System.out.println("第二层到第三层======》"+t.getParamValue()); |
| | | } |
| | | Optional.ofNullable(t.getType()).ifPresent(o->{ |
| | | List<SysDictItem> collect1 = dict.stream().filter(d -> Objects.equals(String.valueOf(d.getValue()), t.getType())).collect(Collectors.toList()); |
| | | if(collect1.size()>0){ |
| | |
| | | }); |
| | | Map<String,Object> allMap = new HashMap<>(); |
| | | List<ParamJoinTemplate> collectThird = paramJoinTemplates.stream().filter(p -> Objects.equals(t.getId(), p.getTechnologyOperationParamId())).collect(Collectors.toList()); |
| | | if(collectThird.size()>0){ |
| | | allMap.put("paramValue",collectThird.get(0).getDefaultValue()); |
| | | if(collectThird.size()>0&&!thirdIsNull){ |
| | | System.out.println("第三层====================》"+collectThird.get(0)); |
| | | if(!org.springframework.util.StringUtils.hasText(collectThird.get(0).getDefaultValue())){ |
| | | t.setParamValue(""); |
| | | }else { |
| | | t.setParamValue(collectThird.get(0).getDefaultValue()); |
| | | } |
| | | }else { |
| | | allMap.put("paramValue",""); |
| | | if(!thirdIsNull) { |
| | | t.setParamValue(""); |
| | | } |
| | | } |
| | | allMap.put("code",pojo.get("code")); |
| | | allMap.put("paramItem", com.chinaztt.mes.common.util.StringUtils.defaultString((String) pojo.get("parameterItem"),"")); |
| | |
| | | //allMap.put("paramFormat", com.chinaztt.mes.common.util.StringUtils.defaultString(t.getParameterFormat(),"")); |
| | | allMap.put("unit", com.chinaztt.mes.common.util.StringUtils.defaultString(t.getUnit(),"")); |
| | | allMap.put("parentId",t.getParentId()); |
| | | allMap.put("paramValue",t.getParamValue()); |
| | | allMap.put("paramValue",com.chinaztt.mes.common.util.StringUtils.defaultString(t.getParamValue(),"")); |
| | | all.add(allMap); |
| | | }); |
| | | }); |