xiejun
2023-08-14 f9249db0d544a8c378db0793bc03a95d6ff8673b
Source/UBCS/ubcs-codeApply/src/main/java/com/vci/ubcs/codeapply/CodeApplyPanelFor410ActionListener.java
@@ -83,6 +83,8 @@
      //  检查模板各属性的输入值是否满足要求
      String[][] inputValues = this.owner.getRightMainPanel().checkInputValues();
      //获取属性名称和值的集合
      Map<String, String> attrNameAndValMap = getAttrMap(inputValues);
      String[] fields = inputValues[0];
      String[] values = inputValues[1];
      String[] dataTypes = inputValues[2];
@@ -113,17 +115,45 @@
      Object object = JSONObject.toJSON(codeOrderDTO);
      Map<String,String> headerMap=new HashMap<>();
      headerMap.put("content-type","application/json");
      R r= HttpUtil.sendPost(url+"/addSaveCode",object.toString(),headerMap);
      headerMap.put("Blade-Auth",this.owner.getTokenUserObject().getAccess_token());
      String code="";
      //校验关键属性存在的数据直接返回编码
      R checkKeyAttrOnOrderR= HttpUtil.sendPost(url+"/checkKeyAttrOnOrderFordatas",object.toString(),headerMap);
      if(checkKeyAttrOnOrderR.isSuccess()){
         List<Map> list=(List)checkKeyAttrOnOrderR.getData();
         if(!CollectionUtils.isEmpty(list)) {
            code=list.get(0).get("id")!=null?list.get(0).get("id").toString():"";
            this.owner.setApplyCode(code);
            this.owner.getApplyTxt().requestFocusInWindow();
            this.owner.getApplyTxt().selectAll();
            this.owner.setAttrNameAndValMap(attrNameAndValMap);
            return;
         }
      }
      R r= HttpUtil.sendPost(url+"/addSaveCode",object.toString(),headerMap);
      if(r.isSuccess()){
         code=r.getData().toString();
         this.owner.setApplyCode(code);
         this.owner.getApplyTxt().requestFocusInWindow();
         this.owner.getApplyTxt().selectAll();
         this.owner.setAttrNameAndValMap(attrNameAndValMap);
      }else{
         VCIOptionPane.showMessage(this.owner,r.getMsg());
      }
   }
   private Map<String, String>  getAttrMap(String[][] inputValues) {
      Map<String, String> attrNameAndValMap = new LinkedHashMap<String, String>();
      String[] fields = inputValues[0];
      String[] values = inputValues[1];
      String[] outNames = inputValues[3];
      for(int k = 0;k < fields.length;k++) {
         attrNameAndValMap.put(fields[k], values[k]);//属性内部名称
         attrNameAndValMap.put(outNames[k], values[k]);//属性外部名称
      }
      return attrNameAndValMap;
   }
   /***
    * 清空属性
    */