| | |
| | | package com.vci.ubcs.codeapply; |
| | | |
| | | import com.vci.base.common.resource.CommonProperties; |
| | | import com.alibaba.cloud.commons.lang.StringUtils; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.vci.base.ui.swing.VCIOptionPane; |
| | | import com.vci.base.ui.swing.VCISwingUtil; |
| | | import com.vci.base.ui.swing.components.VCIJButton; |
| | | import com.vci.base.ui.swing.components.VCIJDialog; |
| | | import com.vci.base.ui.swing.components.VCIJPanel; |
| | | import com.vci.ubcs.codeapply.object.TokenUserObject; |
| | | import com.vci.ubcs.codeapply.object.UserObject; |
| | | import com.vci.ubcs.codeapply.utils.ConfigUtils; |
| | | import com.vci.ubcs.system.user.entity.User; |
| | | |
| | | import com.vci.ubcs.codeapply.utils.HttpUtil; |
| | | import javax.swing.*; |
| | | import java.awt.*; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | |
| | | private static final long serialVersionUID = -3286164100581857853L; |
| | | private static User userOb = new User(); |
| | | private static TokenUserObject tokenUserObject = new TokenUserObject(); |
| | | private String userName = null; |
| | | private String codeValue = null; |
| | | private CodeApplyFor410DialogActionListener actionListener = new CodeApplyFor410DialogActionListener(this); |
| | |
| | | private CodeApplyPanelFor410 mainPal = null; |
| | | private Component parentComponet = null; |
| | | private Map<String, String> attrNameAndValMap = new LinkedHashMap();//存储属性名称(包含内部名称和外部名称)和对应的值 |
| | | private String tokenUrl= ConfigUtils.getConfigValue("410.code.token.url","http://127.0.0.1:37000/ubcs-auth/oauth/token"); |
| | | |
| | | /** |
| | | * 存储分类的Map,key:分类名称,value:分类值 |
| | |
| | | } |
| | | } |
| | | |
| | | private void initUserInfo() { |
| | | // userOb.set("127.0.0.1"); |
| | | // userOb.setModules("TC集成代码申请"); |
| | | // userOb.setUserName(userName); |
| | | private void initUserInfo() throws Exception { |
| | | /*userOb.set("127.0.0.1"); |
| | | userOb.setModules("TC集成代码申请"); |
| | | userOb.setUserName(userName);*/ |
| | | Map<String,String> headerMap=new HashMap<>(); |
| | | headerMap.put("Tenant-Id",ConfigUtils.getConfigValue("410.code.token.tenantId","000000")); |
| | | headerMap.put("Authorization",ConfigUtils.getConfigValue("410.code.token.authorization","Basic c3dvcmQ6c3dvcmRfc2VjcmV0")); |
| | | headerMap.put("Content-Type",ConfigUtils.getConfigValue("410.code.token.contentType","application/x-www-form-urlencoded")); |
| | | |
| | | UserObject userObject=new UserObject(); |
| | | Map<String,String> parmarMap=new HashMap<>(); |
| | | //userObject.set("Tenant-Id",ConfigUtils.getConfigValue("410.code.token.tenantId","000000")); |
| | | /*userObject.setUsername("admin"); |
| | | userObject.setPassword("21232f297a57a5a743894a0e4a801fc3"); |
| | | userObject.setGrant_type("password"); |
| | | userObject.setScope("all"); |
| | | Object object = JSONObject.toJSON(userObject);*/ |
| | | parmarMap.put("username","admin"); |
| | | parmarMap.put("password","21232f297a57a5a743894a0e4a801fc3"); |
| | | parmarMap.put("scope","all"); |
| | | parmarMap.put("grant_type","password"); |
| | | String result=HttpUtil.sendFormPost(tokenUrl,parmarMap,headerMap); |
| | | if (StringUtils.isNotBlank(result)) { |
| | | tokenUserObject = JSONObject.toJavaObject(JSONObject.parseObject(result), TokenUserObject.class); |
| | | }else{ |
| | | throw new Exception("验证用户鉴权信息失败!"); |
| | | } |
| | | } |
| | | |
| | | public void buildDialog() { |
| | |
| | | private void bulidPal() throws Exception { |
| | | this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); |
| | | this.setTitle("代码申请"); |
| | | mainPal = new CodeApplyPanelFor410(this,userOb, true, clsfName, deptName,libName); |
| | | mainPal = new CodeApplyPanelFor410(this,tokenUserObject, true, clsfName, deptName,libName); |
| | | |
| | | VCIJPanel btnPal = new VCIJPanel(); |
| | | btnPal.add(okBtn); |