From cb9c1c38379b05da634f18b2e8a05fae0cce095d Mon Sep 17 00:00:00 2001 From: limingyu Date: Tue, 2 Apr 2024 17:05:41 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B6=88=E9=98=B2=E7=82=B9=E4=BD=8D?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E8=A1=A8=E7=AE=A1=E7=90=86=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E6=97=B6=E8=AE=BE=E5=A4=87=E6=95=B0=E9=87=8F=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datasource/firemanager/FirePreparedCheckListMapper.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/resources/mybatis/datasource/firemanager/FirePreparedCheckListMapper.xml b/src/main/resources/mybatis/datasource/firemanager/FirePreparedCheckListMapper.xml index d186509b..b5479cbe 100644 --- a/src/main/resources/mybatis/datasource/firemanager/FirePreparedCheckListMapper.xml +++ b/src/main/resources/mybatis/datasource/firemanager/FirePreparedCheckListMapper.xml @@ -113,7 +113,6 @@ LEFT JOIN sys_dictionaries d on fd.FIRE_DEVICE_TYPE_ID = d.BIANMA WHERE fpc.FIRE_CHECK_ID = #{FIRE_CHECK_ID} - AND fcs.ISDELETE = 0 AND fpc.ISDELETE = 0 AND fd.ISDELETE = 0 AND fr.ISDELETE = 0 From a93fc05ea502409336912ec4695df72f157de1ad Mon Sep 17 00:00:00 2001 From: liujun Date: Tue, 2 Apr 2024 17:06:03 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9B=BF=E8=B5=B5=E7=85=9C=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/LoginController.java | 49 +++-- .../java/com/zcloud/util/HttpClientUtil.java | 197 +++++++++++++----- 2 files changed, 176 insertions(+), 70 deletions(-) diff --git a/src/main/java/com/zcloud/controller/system/LoginController.java b/src/main/java/com/zcloud/controller/system/LoginController.java index 512463d5..5c93c4f0 100644 --- a/src/main/java/com/zcloud/controller/system/LoginController.java +++ b/src/main/java/com/zcloud/controller/system/LoginController.java @@ -70,7 +70,7 @@ public class LoginController extends BaseController { @Autowired private PhotoService photoService; -// @Value("${czks-useridentity}") + // @Value("${czks-useridentity}") // private String czksIdentity; // @Value("${czks-baseimgpath}") // private String czksBaseimgpath; @@ -126,6 +126,9 @@ public class LoginController extends BaseController { PageData pd = new PageData(); pd = this.getPageData(); + PageData loginPd = new PageData(); + loginPd.put("KEYDATA", pd.getString("KEYDATA")); + loginPd.put("tm", pd.getString("tm")); String loginData = pd.getString("KEYDATA"); if (!loginData.startsWith("qdkjchina")) { loginData = RSAUtils.decryptDataOnJava(loginData, RSAUtils.getPrivateKey()); @@ -178,6 +181,37 @@ public class LoginController extends BaseController { removeSession(USERNAME); if (pd != null) { + + //查询该用户或企业的图片和后端地址 + if (!Tools.isEmpty(pd.getString("CORPINFO_ID")) && !pd.getString("CORPINFO_ID").equals("1")) { + PageData pathData = corpPathService.getCorpPathByCorpId(pd); + map.put("baseImgPath",pathData.getString("PIC_PATH")); + map.put("USER_IDENTITY",pathData.getString("USER_IDENTITY")); + map.put("BACKENDADDR", pathData.getString("BACK_END_PATH")); + } else { + PageData pathData = corpPathService.getCorpPathByPersonInfo(pd); + map.put("baseImgPath",pathData.getString("PIC_PATH")); + map.put("USER_IDENTITY",pathData.getString("USER_IDENTITY")); + map.put("BACKENDADDR", pathData.getString("BACK_END_PATH")); + } + + // 如果用户不是港务局用户,则向对应分公司发送登录请求 + if (!map.get("USER_IDENTITY").toString().equals("GWJ")) { + Map backEndPath = HttpClientUtil.getPOSTTest(map.get("BACKENDADDR").toString() + "admin/check", loginPd); + if (backEndPath.get("result").toString().equals("success")) { + backEndPath.put("baseImgPath",map.get("baseImgPath").toString()); + backEndPath.put("USER_IDENTITY",map.get("USER_IDENTITY").toString()); + backEndPath.put("BACKENDADDR", map.get("BACKENDADDR").toString()); + System.out.println("登录返回参数:" + backEndPath); + return backEndPath; + } else { + map.put("result", "fail"); + map.put("msg", backEndPath.get("msg").toString()); + map.put("errorCode", errInfo); + map.put("failMsg", backEndPath.get("msg").toString()); + return map; + } + } if ("99".equals(pd.getString("STATUS"))) { errInfo = "userlock"; map.put("result", "fail"); @@ -236,6 +270,7 @@ public class LoginController extends BaseController { PageData rpd = roleService.findMaxRoleByRId(roleIds); map.put("ROLEID", rpd.getString("ROLE_ID")); map.put("ROLE_NAME", rpd.getString("ROLE_NAME")); + map.put("RNUMBER", rpd.getString("RNUMBER")); map.put("USERBZ", pd.getString("BZ")); PageData dpd = new PageData(); dpd.put("DEPARTMENT_ID", pd.getString("DEPARTMENT_ID")); @@ -288,18 +323,6 @@ public class LoginController extends BaseController { FHLOG.save(USERNAME, "成功登录系统", ip); //记录日志 - //查询该用户或企业的图片和后端地址 - if (!Tools.isEmpty(pd.getString("CORPINFO_ID")) && !pd.getString("CORPINFO_ID").equals("1")) { - PageData pathData = corpPathService.getCorpPathByCorpId(pd); - map.put("baseImgPath",pathData.getString("PIC_PATH")); - map.put("USER_IDENTITY",pathData.getString("USER_IDENTITY")); - map.put("BACKENDADDR", pathData.getString("BACK_END_PATH")); - } else { - PageData pathData = corpPathService.getCorpPathByPersonInfo(pd); - map.put("baseImgPath",pathData.getString("PIC_PATH")); - map.put("USER_IDENTITY",pathData.getString("USER_IDENTITY")); - map.put("BACKENDADDR", pathData.getString("BACK_END_PATH")); - } } } else { token.clear(); diff --git a/src/main/java/com/zcloud/util/HttpClientUtil.java b/src/main/java/com/zcloud/util/HttpClientUtil.java index 005f317f..066e6336 100644 --- a/src/main/java/com/zcloud/util/HttpClientUtil.java +++ b/src/main/java/com/zcloud/util/HttpClientUtil.java @@ -1,14 +1,9 @@ package com.zcloud.util; -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.*; import java.net.HttpURLConnection; import java.net.URL; +import java.net.URLEncoder; import java.security.KeyManagementException; import java.security.KeyStore; import java.security.KeyStoreException; @@ -19,10 +14,12 @@ import java.security.cert.CertificateException; import java.util.HashMap; import java.util.Map; +import com.alibaba.fastjson.JSONObject; import com.sun.net.ssl.HttpsURLConnection; import com.sun.net.ssl.KeyManagerFactory; import com.sun.net.ssl.SSLContext; import com.sun.net.ssl.TrustManagerFactory; +import com.zcloud.entity.PageData; public class HttpClientUtil { /** @@ -33,7 +30,7 @@ public class HttpClientUtil { public static final String JKS = "JKS"; public static final String PKCS12 = "PKCS12"; public static final String TLS = "TLS"; - + /** * get HttpURLConnection * @param strUrl url地址 @@ -47,7 +44,7 @@ public class HttpClientUtil { .openConnection(); return httpURLConnection; } - + /** * get HttpsURLConnection * @param strUrl url地址ַ @@ -61,7 +58,7 @@ public class HttpClientUtil { .openConnection(); return httpsURLConnection; } - + /** * 获取不带查询串的url * @param strUrl @@ -73,34 +70,34 @@ public class HttpClientUtil { int indexOf = strUrl.indexOf("?"); if(-1 != indexOf) { return strUrl.substring(0, indexOf); - } - + } + return strUrl; } - + return strUrl; - + } - + /** * 获取查询串 * @param strUrl * @return String */ public static String getQueryString(String strUrl) { - + if(null != strUrl) { int indexOf = strUrl.indexOf("?"); if(-1 != indexOf) { return strUrl.substring(indexOf+1, strUrl.length()); - } - + } + return ""; } - + return strUrl; } - + /** * 查询字符串转化为map * name1=key1&name2=key2&... @@ -111,18 +108,18 @@ public class HttpClientUtil { if(null == queryString || "".equals(queryString)) { return null; } - + Map m = new HashMap(); String[] strArray = queryString.split("&"); for(int index = 0; index < strArray.length; index++) { String pair = strArray[index]; HttpClientUtil.putMapByPair(pair, m); } - + return m; - + } - + /** * 把键值添加到map * pair:name=value @@ -130,11 +127,11 @@ public class HttpClientUtil { * @param m */ public static void putMapByPair(String pair, Map m) { - + if(null == pair || "".equals(pair)) { return; } - + int indexOf = pair.indexOf("="); if(-1 != indexOf) { String k = pair.substring(0, indexOf); @@ -160,7 +157,7 @@ public class HttpClientUtil { buf.append(line); buf.append("\r\n"); } - + return buf.toString(); } /** @@ -192,17 +189,17 @@ public class HttpClientUtil { } /** * 获取SSLContext - * @param trustFile + * @param trustFile * @param trustPasswd * @param keyFile * @param keyPasswd * @return - * @throws NoSuchAlgorithmException - * @throws KeyStoreException - * @throws IOException - * @throws CertificateException - * @throws UnrecoverableKeyException - * @throws KeyManagementException + * @throws NoSuchAlgorithmException + * @throws KeyStoreException + * @throws IOException + * @throws CertificateException + * @throws UnrecoverableKeyException + * @throws KeyManagementException */ public static SSLContext getSSLContext( FileInputStream trustFileInputStream, String trustPasswd, @@ -230,7 +227,7 @@ public class HttpClientUtil { return ctx; } - + /** * 字符串转换成char数组 * @param str @@ -238,14 +235,14 @@ public class HttpClientUtil { */ public static char[] str2CharArray(String str) { if(null == str) return null; - + return str.toCharArray(); } - + public static InputStream String2Inputstream(String str) { return new ByteArrayInputStream(str.getBytes()); } - + /** * InputStream转换成Byte * 注意:流关闭需要自行处理 @@ -253,23 +250,23 @@ public class HttpClientUtil { * @return byte * @throws Exception */ - public static byte[] InputStreamTOByte(InputStream in) throws IOException{ - - int BUFFER_SIZE = 4096; - ByteArrayOutputStream outStream = new ByteArrayOutputStream(); - byte[] data = new byte[BUFFER_SIZE]; - int count = -1; - - while((count = in.read(data,0,BUFFER_SIZE)) != -1) - outStream.write(data, 0, count); - - data = null; + public static byte[] InputStreamTOByte(InputStream in) throws IOException{ + + int BUFFER_SIZE = 4096; + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + byte[] data = new byte[BUFFER_SIZE]; + int count = -1; + + while((count = in.read(data,0,BUFFER_SIZE)) != -1) + outStream.write(data, 0, count); + + data = null; byte[] outByte = outStream.toByteArray(); outStream.close(); - - return outByte; - } - + + return outByte; + } + /** * InputStream转换成String * 注意:流关闭需要自行处理 @@ -278,10 +275,96 @@ public class HttpClientUtil { * @return String * @throws Exception */ - public static String InputStreamTOString(InputStream in,String encoding) throws IOException{ + public static String InputStreamTOString(InputStream in,String encoding) throws IOException{ return new String(InputStreamTOByte(in),encoding); - - } -} \ No newline at end of file + } + + public static Map getPOSTTest(String httpUrl , PageData pd ){ + HttpURLConnection connection = null; + InputStream is = null; + BufferedReader br = null; + StringBuffer result = new StringBuffer(); +// ?username=admin&password=234f3424be5a75ad898a1b55f6e34d9e&url_token_only=true + StringBuffer nameValue = new StringBuffer(); + Map map = (Map)pd; + System.out.print("参数:{"); + for(Map.Entry entry : map.entrySet()){ + System.out.print(entry.getKey().toString() + ":" + entry.getValue().toString() + ","); + nameValue.append(entry.getKey().toString()+"=" + entry.getValue().toString() + "&"); + } + System.out.println("}"); + String parameter = ""; + if(nameValue.length()>0){ + parameter = "?"+nameValue.toString().substring(0,nameValue.length()-1); + } + try { + String plusEncode = URLEncoder.encode("+", "UTF-8"); + parameter = parameter.replaceAll("\\+", plusEncode); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + + + System.out.println( "地址:"+httpUrl + parameter); + try { + //创建连接 + URL url = new URL(httpUrl + parameter); + connection = (HttpURLConnection) url.openConnection(); + //设置请求方式 + connection.setRequestMethod("POST"); + //设置连接超时时间 + connection.setReadTimeout(15000); + //开始连接 + connection.connect(); + //获取响应数据 + if (connection.getResponseCode() == 200) { + //获取返回的数据 + is = connection.getInputStream(); + if (null != is) { + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String temp = null; + while (null != (temp = br.readLine())) { + result.append(temp); + } + } + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (null != br) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != is) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + //关闭远程连接 + connection.disconnect(); + } +// return result.toString(); + + /** + * 转换成json,根据合法性返回json或者字符串 + */ + JSONObject jsonObject = null; + try{ + jsonObject = JSONObject.parseObject(result.toString()); + Map maps = new HashMap(); + maps = HttpClientService.parseJSON2Map(jsonObject); + return maps; + }catch (Exception e){ + e.printStackTrace(); + return null; + } + } + +} From 3adb8748b60dbc4f4d3845994fd1bebff0c54e42 Mon Sep 17 00:00:00 2001 From: liujun Date: Tue, 2 Apr 2024 18:58:35 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=9B=BF=E8=B5=B5=E7=85=9C=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zcloud/service/system/impl/CorpPathServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/zcloud/service/system/impl/CorpPathServiceImpl.java b/src/main/java/com/zcloud/service/system/impl/CorpPathServiceImpl.java index 10c7e473..9ba2e558 100644 --- a/src/main/java/com/zcloud/service/system/impl/CorpPathServiceImpl.java +++ b/src/main/java/com/zcloud/service/system/impl/CorpPathServiceImpl.java @@ -35,6 +35,7 @@ public class CorpPathServiceImpl implements CorpPathService { PageData result = new PageData(); result.put("PIC_PATH",defaultPicPath); result.put("BACK_END_PATH", defaultBackEndPath); + result.put("USER_IDENTITY","GWJ"); return result; } return data; @@ -53,6 +54,7 @@ public class CorpPathServiceImpl implements CorpPathService { PageData result = new PageData(); result.put("PIC_PATH",defaultPicPath); result.put("BACK_END_PATH", defaultBackEndPath); + result.put("USER_IDENTITY","GWJ"); return result; } return data; From b1f060afb53e70bea85499578b9689e8d2a8f072 Mon Sep 17 00:00:00 2001 From: liujun Date: Sun, 7 Apr 2024 14:05:02 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=AE=89=E7=9D=A3=E9=83=A8=E6=89=93?= =?UTF-8?q?=E5=9B=9E=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java | 1 + src/main/resources/mybatis/datasource/xgf/FlowMapper.xml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java b/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java index 24ff5055..cc0e8d35 100644 --- a/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java +++ b/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java @@ -226,6 +226,7 @@ public class XgfUserServiceImpl implements XgfUserService { condition.put("FOREIGN_KEY", x.getString("XGF_USER_ID")); condition.put("TYPE", "1"); condition.put("VALID_FLAG", "1"); + condition.put("END_FLAG", "0"); PageData flow = flowMapper.findByCondition(condition); if (flow == null || flow.size() == 0) { /* 保存审批流程信息 */ diff --git a/src/main/resources/mybatis/datasource/xgf/FlowMapper.xml b/src/main/resources/mybatis/datasource/xgf/FlowMapper.xml index 1c1b56e7..6a013cb7 100644 --- a/src/main/resources/mybatis/datasource/xgf/FlowMapper.xml +++ b/src/main/resources/mybatis/datasource/xgf/FlowMapper.xml @@ -101,6 +101,9 @@ and a.VALID_FLAG = #{VALID_FLAG} + + and a.END_FLAG = #{END_FLAG} +