xiejun
2023-08-14 885baab441cf03e1d3ea02400f9eee9aa530c7fa
Source/UBCS/ubcs-codeApply/src/main/java/com/vci/ubcs/codeapply/CodeApplyPanelFor410.java
@@ -12,9 +12,10 @@
import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
import com.vci.ubcs.codeapply.object.CodeClassify;
import com.vci.ubcs.codeapply.object.R;
import com.vci.ubcs.codeapply.object.TokenUserObject;
import com.vci.ubcs.codeapply.utils.ConfigUtils;
import com.vci.ubcs.codeapply.utils.HttpUtil;
import com.vci.ubcs.system.user.entity.User;
import lombok.SneakyThrows;
import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
@@ -45,7 +46,7 @@
   private VCIJLabel applylbl = new VCIJLabel("申请码值:");
   public VCIJTextField applyTxt = new VCIJTextField(40);
   private JComboBox codeItemCombo = new JComboBox();
   private User userObj = null;;
   private TokenUserObject tokenUserObject = null;;
   private CodeClassifyTemplateVO currentCodeClassifyTemplateVO;
   private boolean isIntegrate = false; //集成时不显示批量申请按钮
@@ -66,18 +67,22 @@
   //左侧树
   private CodeApplyFor410TreePanel typeTreePanel = null;
   private TransmitTreeObject transmitTreeObject = new TransmitTreeObject();
   private String url=ConfigUtils.getConfigValue("410.code.url","http://127.0.0.1:36014/codeApplySwingController");
   /***
    *
    * @param userObj
    * @param tokenUserObject
    * @param isIntegrate
    * @param clsfName
    * @param deptName
    * @param libName
    */
   public CodeApplyPanelFor410(CodeApplyFor410Dialog owner , User userObj, boolean isIntegrate, String clsfName, String deptName, String[] libName){
      this.userObj = userObj;
   public CodeApplyPanelFor410(CodeApplyFor410Dialog owner , TokenUserObject tokenUserObject, boolean isIntegrate, String clsfName, String deptName, String[] libName){
      this.tokenUserObject = tokenUserObject;
      this.owner =owner;
      rightMainPanel = new CodeApplyFor410MainPanel(transmitTreeObject,userObj,getCurrentCodeClassifyTemplateVO());
      rightMainPanel = new CodeApplyFor410MainPanel(transmitTreeObject,tokenUserObject,getCurrentCodeClassifyTemplateVO());
      this.isIntegrate = isIntegrate;
      this.clsfName = clsfName;
      this.deptName = deptName;
@@ -160,13 +165,14 @@
      CodeClassifyVO [] codeClassifyVOS = new CodeClassifyVO[0];
      Map<String,String> condtionMap=new HashMap<>();
      //condtionMap.put("parentOid",);
      String url=ConfigUtils.getConfigValue("410.PDM.item.url","http://127.0.0.1:36014/codeApplySwingController/getRMLibByName");
      //String url=ConfigUtils.getConfigValue("410.code.url","http://127.0.0.1:36014/codeApplySwingController");
      /**系统只加载代码项  如果libName不为空,直接获取对应的代码项**/
      if(libName.length>0) {
         condtionMap.put("libName", StringUtils.join(libName,",") );
      }
      R r=HttpUtil.sendGet(url,condtionMap,new HashMap<>());
      Map<String,String> headerMap=new HashMap<>();
      headerMap.put("Blade-Auth",this.tokenUserObject.getAccess_token());
      R r= HttpUtil.sendGet(url+"/getRMLibByName",condtionMap,headerMap);
      List<CodeClassify> codeClassifyList = new ArrayList<>();
      if(r.isSuccess()){
         Object object= r.getData();
@@ -230,7 +236,7 @@
      String  libName=currentCodeClassify.getName();
      String classOid=currentCodeClassify.getOid();
      final CodeApplyPanelFor410 self = this;
      typeTreePanel = new CodeApplyFor410TreePanel(currentCodeClassify,userObj,clsfName, libName) {
      typeTreePanel = new CodeApplyFor410TreePanel(currentCodeClassify,tokenUserObject,clsfName, libName) {
         private static final long serialVersionUID = 8121108576137012228L;
         @Override
         public void tree_valueChanged(TreeSelectionEvent e) {
@@ -257,11 +263,14 @@
            CodeClassify codeClassify=(CodeClassify)node;
            classOid = codeClassify.getOid();
            String url = ConfigUtils.getConfigValue("410.PDM.clsfTemplate.url", "http://127.0.0.1:36014/codeApplySwingController/getUsedTemplateByClassifyOid");
            //String url = ConfigUtils.getConfigValue("410.PDM.clsfTemplate.url", "http://127.0.0.1:36014/codeApplySwingController/getUsedTemplateByClassifyOid");
            /**系统只加载代码项  如果libName不为空,直接获取对应的代码项**/
            Map<String, String> condtionMap = new HashMap<>();
            condtionMap.put("codeClassifyOid", classOid);
            R r = HttpUtil.sendGet(url, condtionMap, new HashMap<>());
            Map<String,String> headerMap=new HashMap<>();
            headerMap.put("Blade-Auth",this.tokenUserObject.getAccess_token());
            R r = HttpUtil.sendGet(url+"/getUsedTemplateByClassifyOid", condtionMap, headerMap);
            boolean res = false;
            if (r.isSuccess()) {
               //List<CodeClassifyTemplateVO> codeClassifyTemplateVOList=new ArrayList<>();
@@ -279,13 +288,13 @@
                     e.printStackTrace();
                  }
               }
            }else{
            }/*else{
               VCIOptionPane.showMessage(this,r.getMsg());
            }
            }*/
            initBtnStatus(res);
         }
      }
      rightMainPanel = new CodeApplyFor410MainPanel(transmitTreeObject,userObj,deptName,getCurrentCodeClassifyTemplateVO());
      rightMainPanel = new CodeApplyFor410MainPanel(transmitTreeObject,tokenUserObject,deptName,getCurrentCodeClassifyTemplateVO());
      scrollPane.setViewportView(rightMainPanel);
      rightMainPanel.buildMainPanel(1);
      int location = jspLeftToRight.getDividerLocation();
@@ -302,11 +311,14 @@
      boolean res=false;
      if(obj instanceof CodeClassify) {
         CodeClassify curentCodeClassify=(CodeClassify)obj;
         String url=ConfigUtils.getConfigValue("410.PDM.clsfTemplate.url","http://127.0.0.1:36014/codeApplySwingController/getUsedTemplateByClassifyOid");
         //String url=ConfigUtils.getConfigValue("410.PDM.clsfTemplate.url","http://127.0.0.1:36014/codeApplySwingController/getUsedTemplateByClassifyOid");
         /**系统只加载代码项  如果libName不为空,直接获取对应的代码项**/
         Map<String,String> condtionMap=new HashMap<>();
         condtionMap.put("codeClassifyOid",curentCodeClassify.getOid());
         R r=HttpUtil.sendGet(url,condtionMap,new HashMap<>() );
         Map<String,String> headerMap=new HashMap<>();
         headerMap.put("Blade-Auth",this.tokenUserObject.getAccess_token());
         R r=HttpUtil.sendGet(url+"/getUsedTemplateByClassifyOid",condtionMap,headerMap);
         if(r.isSuccess()) {
            CodeClassifyTemplateVO codeClassifyTemplateVO=new CodeClassifyTemplateVO();
            Object object= r.getData();
@@ -322,9 +334,9 @@
                  e1.printStackTrace();
               }
            }
         }else{
         }/*else{
            VCIOptionPane.showMessage(this.owner,r.getMsg());
         }
         }*/
      }
      initBtnStatus(res);
@@ -347,7 +359,7 @@
      transmitTreeObject.setCurrentTreeNode(selectedTreeNode);
      if(selectedTreeNode.isRoot() && selectedTreeNode.getObj() instanceof String) return;
      scrollPane = new JScrollPane();
      rightMainPanel = new CodeApplyFor410MainPanel(transmitTreeObject,userObj,deptName,getCurrentCodeClassifyTemplateVO());
      rightMainPanel = new CodeApplyFor410MainPanel(transmitTreeObject,tokenUserObject,deptName,getCurrentCodeClassifyTemplateVO());
      scrollPane.setViewportView(rightMainPanel);
      rightMainPanel.buildMainPanel(1);
      VCIJPanel rightPanel = new VCIJPanel();
@@ -378,6 +390,14 @@
      this.applyTxt.setText(codeVal);
   }
   public VCIJTextField getApplyTxt() {
      return applyTxt;
   }
   public void setApplyTxt(VCIJTextField applyTxt) {
      this.applyTxt = applyTxt;
   }
   public CodeClassifyTemplateVO getCurrentCodeClassifyTemplateVO() {
      return currentCodeClassifyTemplateVO;
   }
@@ -385,4 +405,28 @@
   public void setCurrentCodeClassifyTemplateVO(CodeClassifyTemplateVO currentCodeClassifyTemplateVO) {
      this.currentCodeClassifyTemplateVO = currentCodeClassifyTemplateVO;
   }
   public CodeApplyFor410MainPanel getRightMainPanel() {
      return rightMainPanel;
   }
   public void setRightMainPanel(CodeApplyFor410MainPanel rightMainPanel) {
      this.rightMainPanel = rightMainPanel;
   }
   public TransmitTreeObject getTransmitTreeObject() {
      return transmitTreeObject;
   }
   public void setTransmitTreeObject(TransmitTreeObject transmitTreeObject) {
      this.transmitTreeObject = transmitTreeObject;
   }
   public TokenUserObject getTokenUserObject() {
      return tokenUserObject;
   }
   public void setTokenUserObject(TokenUserObject tokenUserObject) {
      this.tokenUserObject = tokenUserObject;
   }
}