From 1937886b35d7610cf142e89b11fda29ccc49fa8b Mon Sep 17 00:00:00 2001 From: fs-danaus <danaus314@qq.com> Date: 星期三, 03 八月 2022 16:28:20 +0800 Subject: [PATCH] 德立账号绑定与解绑 --- src/com/yc/open/deli/entity/UserAccountEntity.java | 9 + src/com/yc/open/deli/entity/Constant.java | 3 src/com/yc/open/deli/service/v2/DeLiIfc.java | 3 src/com/yc/service/upload/AttachmentImpl.java | 24 ++- WebRoot/general/deliauth.jsp | 119 +++++++++++++++++++ src/com/yc/entity/DataSourceEntity.java | 36 +++++- src/com/yc/open/deli/controller/DeliController.java | 117 +++++++++++++++++++ src/com/yc/open/deli/service/v2/DeLiImplV2.java | 11 + WebRoot/home.jsp | 5 src/com/yc/open/mutual/service/MutualServiceImpl.java | 2 10 files changed, 310 insertions(+), 19 deletions(-) diff --git a/WebRoot/general/deliauth.jsp b/WebRoot/general/deliauth.jsp new file mode 100644 index 0000000..06bbfdb --- /dev/null +++ b/WebRoot/general/deliauth.jsp @@ -0,0 +1,119 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@page import="com.yc.sdk.shopping.util.SettingKey"%> +<%@page import="com.yc.factory.FactoryBean"%> +<%@page import="java.util.List"%> +<%@page import="java.util.Map"%> +<%@page import="com.yc.multiData.SpObserver"%> +<%@page import="java.text.SimpleDateFormat"%> +<%@page import="java.util.Date"%> +<%@page import="com.yc.utils.SessionKey"%> +<%@page import="com.yc.sdk.shopping.action.Maintaince"%> +<%@page import="com.yc.service.user.UserAccountServiceIfc"%> +<%@page import="com.yc.entity.UserAccountEntity"%> +<%@page import="com.yc.entity.DataSourceEntity"%> +<%@page import="com.yc.multiData.MultiDataSource"%> +<%@ page import="org.apache.commons.lang3.StringUtils" %> + +<% + String hostUrl = SettingKey.getHostUrl(request) ; + DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; +%> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta name="viewport" content="width=device-width, initial-scale=1.0 , maximum-scale=1.0, user-scalable=yes"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta http-equiv="pragma" content="no-cache"> +<meta http-equiv="cache-control" content="no-cache"> +<meta http-equiv="expires" content="0"> +<script src="<%=hostUrl%>/shopping/view/javascript/jquery/jquery-2.1.1.min.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/shopping/view/javascript/jquery/jquery-2.1.1.min.js")%>" type="text/javascript"></script> +<link href="<%=hostUrl%>/shopping/view/javascript/bootstrap/css/bootstrap.min.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/shopping/view/javascript/bootstrap/css/bootstrap.min.css")%>" rel="stylesheet" media="screen" /> +<script src="<%=hostUrl%>/shopping/view/javascript/bootstrap/js/bootstrap.min.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/shopping/view/javascript/bootstrap/js/bootstrap.min.js")%>" type="text/javascript"></script> +<link href="<%=hostUrl%>/shopping/view/javascript/font-awesome/css/font-awesome.min.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/shopping/view/javascript/font-awesome/css/font-awesome.min.css")%>" rel="stylesheet" type="text/css" /> + +<link href="<%=hostUrl%>/shopping/view/theme/default/stylesheet/googleapisFont.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/shopping/view/theme/default/stylesheet/googleapisFont.css")%>" rel="stylesheet" type="text/css" /> +<link href="<%=hostUrl%>/shopping/view/theme/default/stylesheet/stylesheet.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/shopping/view/theme/default/stylesheet/stylesheet.css")%>" rel="stylesheet"> +<script type="text/javascript" src="<%=hostUrl%>/js/hotkey.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/js/hotkey.js")%>" ></script> + +<title>寰风珛钀ラ攢绯荤粺璐﹀彿缁戝畾</title> + +</head> +<body> + +<div class="container"> +<div class="" id="collapse-messages"><div class="panel-body"></div></div> +<div class="row"> + <div id="content" class="col-sm-12"> + <h1>寰风珛钀ラ攢绯荤粺璐﹀彿缁戝畾涓庤В缁慬<%=dataSourceEntity.getDeliUserCode()%>]</h1><br> + <fieldset> + <div class="form-group required"> + <label class="col-sm-2 control-label" for="userName">璐﹀彿锛�</label> + <div class="col-sm-10"> + <input type="input" name="userName" value="" placeholder="杈撳叆寰风珛钀ラ攢绯荤粺璐﹀彿鍚嶇О" id="userName" class="form-control" /> + </div> + </div> + <div class="form-group required"> + <label class="col-sm-2 control-label" for="userPass">瀵嗙爜锛�</label> + <div class="col-sm-10"> + <input type="password" name="userPass" value="" placeholder="杈撳叆寰风珛钀ラ攢绯荤粺璐﹀彿瀵嗙爜" id="userPass" class="form-control" /> + </div> + </div> + </fieldset> + <div class="buttons clearfix"> + <div class="pull-left"> + <input type="button" value="缁戝畾璐﹀彿" id="button-bind" class="btn btn-primary" /> + </div> + <div class="pull-right"> + <input type="button" value="瑙g粦璐﹀彿" id="button-unbind" class="btn btn-primary" /> + </div> + </div> + </div> +</div> + +</div> +</body> +<script type="application/x-javascript"> + var isbind=<%=StringUtils.isNotBlank(dataSourceEntity.getDeliUserId())?true:false%>;//鏄惁宸茬粦瀹氫簡璐﹀彿 + $('#button-bind').attr("disabled",isbind); + $('#button-unbind').attr("disabled",!isbind); + $(document).delegate('#button-bind', 'click', function() { + var userName=$("#userName").val(); + var userPass=$("#userPass").val(); + if(userName==""){ + alert("璐﹀彿涓嶈兘涓虹┖"); + return; + } + else if(userPass==""){ + alert("瀵嗙爜涓嶈兘涓虹┖"); + return; + }else { + $.get("/deli/bindUserAccount.do?userPass=" + userPass + "&userName=" + userName, function (data) { + if (data != null) { + alert(data.msg);//鍥炶皟鎻愮ず + } + }); + } + }); + $(document).delegate('#button-unbind', 'click', function() { + var userName=$("#userName").val(); + var userPass=$("#userPass").val(); + if(userName==""){ + alert("璐﹀彿涓嶈兘涓虹┖"); + return false; + } + else if(userPass==""){ + alert("瀵嗙爜涓嶈兘涓虹┖"); + return false; + }else { + $.get("/deli/unbindUserAccount.do?userPass=" + userPass + "&userName=" + userName, function (data) { + if (data != null) { + alert(data.msg);//鍥炶皟鎻愮ず + } + }); + } + }); +</script> +</html> + diff --git a/WebRoot/home.jsp b/WebRoot/home.jsp index 11bf7c0..9d71591 100644 --- a/WebRoot/home.jsp +++ b/WebRoot/home.jsp @@ -434,7 +434,12 @@ <% } if ("1".equals(isSuperUser)) { + if("deli".equals(dataSourceEntity.getDockingSystem())){ %> + <div iconCls="icon-DataSourceSettings" onclick="addTab('寰风珛璐﹀彿缁戝畾','','','','/general/deliauth.jsp','','');"> + 寰风珛璐﹀彿缁戝畾 + </div> + <%}%> <div iconCls="icon-ActingReviewer" onclick="addTab('',9910,22)">璁剧疆浠g悊瀹℃牳浜�</div> <div iconCls="icon-userManagement"> <span>鐢ㄦ埛绠$悊璁剧疆</span> diff --git a/src/com/yc/entity/DataSourceEntity.java b/src/com/yc/entity/DataSourceEntity.java index 66d03e7..e9a29cd 100644 --- a/src/com/yc/entity/DataSourceEntity.java +++ b/src/com/yc/entity/DataSourceEntity.java @@ -1,10 +1,8 @@ package com.yc.entity; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Date; - import com.google.gson.Gson; + +import java.util.Date; public class DataSourceEntity { @@ -87,6 +85,24 @@ private String aliPayAppId;//鏀粯瀹滱PPId xin 2021-12-10 09:24:27 private Integer maintenanceFeeToDbId;//鏀跺彇缁存姢璐规墍灞炲叕鍙� xin 2021-12-10 09:24:27 private String MaintenanceFeeAcctCode;//缁存姢璐硅处鎴� xin 2021-12-18 09:50:10 + private String deliUserCode;//寰风珛绯荤粺璐﹀彿 + private String deliUserId;//涓巇eliUserCode缁戝畾鐨剈nid,鐢ㄤ簬鎺ㄩ�佹暟鎹椂闄勫姞鍥炲幓 + + public String getDeliUserCode() { + return deliUserCode; + } + + public void setDeliUserCode(String deliUserCode) { + this.deliUserCode = deliUserCode; + } + + public String getDeliUserId() { + return deliUserId; + } + + public void setDeliUserId(String deliUserId) { + this.deliUserId = deliUserId; + } public String getMaintenanceFeeAcctCode() { return MaintenanceFeeAcctCode; @@ -453,8 +469,16 @@ return this; } private Integer expiredDays = null ; //鏁版嵁婧愯繃鏈熷ぉ鏁帮細姝f暟琛ㄧず宸茬粡杩囨湡锛� null 鎴� 璐熸暟琛ㄧず鏈繃鏈� - - + private Integer expiredMinute = null ; //鏁版嵁婧愯繃鏈熷垎閽熸暟锛氭鏁拌〃绀哄凡缁忚繃鏈燂紝 null 鎴� 璐熸暟琛ㄧず鏈繃鏈� + + + public Integer getExpiredMinute() { + return expiredMinute; + } + + public void setExpiredMinute(Integer expiredMinute) { + this.expiredMinute = expiredMinute; + } public int getDbId() { return dbId; diff --git a/src/com/yc/open/deli/controller/DeliController.java b/src/com/yc/open/deli/controller/DeliController.java index 061ba90..029c7bf 100644 --- a/src/com/yc/open/deli/controller/DeliController.java +++ b/src/com/yc/open/deli/controller/DeliController.java @@ -1,5 +1,6 @@ package com.yc.open.deli.controller; +import com.alibaba.fastjson.JSON; import com.google.gson.Gson; import com.yc.action.grid.GridUtils; import com.yc.entity.DataSourceEntity; @@ -10,8 +11,8 @@ import com.yc.multiData.SpObserver; import com.yc.open.controller.BaseController; import com.yc.open.deli.entity.*; -import com.yc.open.deli.service.DeLiIfc; import com.yc.open.deli.service.PostDataBaseService; +import com.yc.open.deli.service.v2.DeLiIfc; import com.yc.open.init.Task; import com.yc.open.utils.ApiUtils; import com.yc.open.utils.CallBackMessageToObject; @@ -20,6 +21,7 @@ import com.yc.service.panel.SqlDBHelperIfc; import com.yc.utils.SessionKey; import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -51,6 +53,7 @@ @Autowired PostDataBaseService mPostDataBaseService; final Logger log = LoggerFactory.getLogger(this.getClass()); + /** * 鐢熸垚鏁板瓧绛惧悕鍙婄浉鍏崇殑鍏叡鍙傛暟 * @param request @@ -71,6 +74,8 @@ //鍙朼ccesskey,secretkey DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(dbid); String accessKey=dataSourceEntity.getSystemAccessKey(); + String outUserID=dataSourceEntity.getDeliUserId(); + concurrentHashMap.putIfAbsent("outUserID",outUserID); concurrentHashMap.putIfAbsent("accesskey",MD5Util.string2MD5(accessKey)); String sign= ApiUtils.SignRequest(concurrentHashMap,task.getAppSecret()); concurrentHashMap.putIfAbsent("sign",sign); @@ -81,6 +86,8 @@ .append(concurrentHashMap.get("nonce")).append("&") .append("accesskey").append("=") .append(concurrentHashMap.get("accesskey")).append("&") + .append("outUserID").append("=") + .append(concurrentHashMap.get("outUserID")).append("&") .append("sign").append("=") .append(concurrentHashMap.get("sign")); return stringBuilder.toString(); @@ -369,6 +376,114 @@ } /** + * + * 涓庡痉绔嬭惀閿�绯荤粺璐﹀彿杩涜缁戝畾 + * @return + */ + @RequestMapping(value="/deli/bindUserAccount.do", method = RequestMethod.GET) + public @ResponseBody Object bindUserAccount(String userName,String userPass,HttpServletRequest request, HttpServletResponse response){ + CallBackMessageToObject callMsg =new CallBackMessageToObject(); + try { + if(StringUtils.isBlank(userName)){ + throw new ApplicationException("璐﹀彿涓嶈兘涓虹┖"); + } + if(StringUtils.isBlank(userPass)){ + throw new ApplicationException("瀵嗙爜涓嶈兘涓虹┖"); + } + Object dbid = request.getSession().getAttribute(SessionKey.DATA_BASE_ID); + DeliController baseController = FactoryBean.getBean(DeliController.class); + UserAccountEntity userAccountEntity=new UserAccountEntity(); + userAccountEntity.setUserPass(userPass); + userAccountEntity.setUserName(userName); + String data= JSON.toJSONString(userAccountEntity); + //鐢熸垚绛惧悕 + String query = baseController.getSignByRequest(request, data, dbid+""); + //鎷夊彇浠g悊鍟嗘暟鎹紝鍙栧緱杩斿洖淇℃伅 + String msgs=baseController.doPostByParameter(Constant.BIND_USERACCOUNT_URL + query, data); + CallBackMessageToObject callBackMessageToObject =null; + callBackMessageToObject =new Gson().fromJson(msgs,new com.google.gson.reflect.TypeToken<CallBackMessageToObject>() {}.getType() ); + if(callBackMessageToObject==null||callBackMessageToObject.getState()==-1){ + return callMsg.sendErrorMessage(callBackMessageToObject.getMsg()); + } + if("{}".equals(callBackMessageToObject.getData())&&callBackMessageToObject.getState()==0){ + return callMsg.sendSuccessMessage("杩斿洖鏁版嵁缁撴灉涓虹┖"); + }else{ + //鎴愬姛鍒欏啓鍏ユ暟鎹簮琛ㄥ拰鏇存柊鍐呭瓨涓殑鏁版嵁婧� + DataSourceEntity dataSource=MultiDataSource.getDataSourceMap(dbid+""); + dataSource.setDeliUserCode(((Map)callBackMessageToObject.getData()).get("userName")+""); + dataSource.setDeliUserId(((Map)callBackMessageToObject.getData()).get("outUserID")+""); + try{ + SpObserver.setDBtoDemo(); + mDeLiIfc.bindUserAccount(dataSource); + return callMsg.sendSuccessMessage("缁戝畾鎴愬姛"); + }catch(Exception ex){ + return callMsg.sendErrorMessage(this.getErrorMsg(ex)); + }finally { + SpObserver.setDBtoInstance(); + } + } + + }catch (Exception ex){ + return callMsg.sendErrorMessage(this.getErrorMsg(ex)); + }finally { + SpObserver.setDBtoInstance(); + } + } + /** + * + * 涓庡痉绔嬭惀閿�绯荤粺璐﹀彿杩涜缁戝畾 + * @return + */ + @RequestMapping(value="/deli/unbindUserAccount.do", method = RequestMethod.GET) + public @ResponseBody Object unbindUserAccount(String userName,String userPass,HttpServletRequest request, HttpServletResponse response){ + CallBackMessageToObject callMsg =new CallBackMessageToObject(); + try { + if(StringUtils.isBlank(userName)){ + throw new ApplicationException("璐﹀彿涓嶈兘涓虹┖"); + } + if(StringUtils.isBlank(userPass)){ + throw new ApplicationException("瀵嗙爜涓嶈兘涓虹┖"); + } + Object dbid = request.getSession().getAttribute(SessionKey.DATA_BASE_ID); + DeliController baseController = FactoryBean.getBean(DeliController.class); + UserAccountEntity userAccountEntity=new UserAccountEntity(); + userAccountEntity.setUserPass(userPass); + userAccountEntity.setUserName(userName); + String data= JSON.toJSONString(userAccountEntity); + //鐢熸垚绛惧悕 + String query = baseController.getSignByRequest(request, data, dbid+""); + //鎷夊彇浠g悊鍟嗘暟鎹紝鍙栧緱杩斿洖淇℃伅 + String msgs=baseController.doPostByParameter(Constant.UNBIND_USERACCOUNT_URL + query, data); + CallBackMessageToObject callBackMessageToObject =null; + callBackMessageToObject =new Gson().fromJson(msgs,new com.google.gson.reflect.TypeToken<CallBackMessageToObject>() {}.getType() ); + if(callBackMessageToObject==null||callBackMessageToObject.getState()==-1){ + return callMsg.sendErrorMessage(callBackMessageToObject.getMsg()); + } + if("{}".equals(callBackMessageToObject.getData())&&callBackMessageToObject.getState()==0){ + return callMsg.sendSuccessMessage("杩斿洖鏁版嵁缁撴灉涓虹┖"); + }else{ + //鎴愬姛鍒欏啓鍏ユ暟鎹簮琛ㄥ拰鏇存柊鍐呭瓨涓殑鏁版嵁婧� + DataSourceEntity dataSource=MultiDataSource.getDataSourceMap(dbid+""); + dataSource.setDeliUserCode(((Map)callBackMessageToObject.getData()).get("userName")+""); + dataSource.setDeliUserId(((Map)callBackMessageToObject.getData()).get("outUserID")+""); + try{ + SpObserver.setDBtoDemo(); + mDeLiIfc.unbindUserAccount(dataSource); + return callMsg.sendSuccessMessage("瑙g粦鎴愬姛"); + }catch(Exception ex){ + return callMsg.sendErrorMessage(this.getErrorMsg(ex)); + }finally { + SpObserver.setDBtoInstance(); + } + } + + }catch (Exception ex){ + return callMsg.sendErrorMessage(this.getErrorMsg(ex)); + }finally { + SpObserver.setDBtoInstance(); + } + } + /** * 鎵嬪姩鎺ラ棬搴楄祫鏂� * 浠庡痉绔嬭惀閿�绯荤粺鎶婇棬搴楄祫鏂欒〃鎷夊彇缁欏反澹蒋浠� * @return diff --git a/src/com/yc/open/deli/entity/Constant.java b/src/com/yc/open/deli/entity/Constant.java index ef4218f..4ec8e82 100644 --- a/src/com/yc/open/deli/entity/Constant.java +++ b/src/com/yc/open/deli/entity/Constant.java @@ -54,6 +54,9 @@ * 鑾峰彇闂ㄥ簵鍒楄〃URL */ public final static String SHOPPING_URL =HOST+"/open/onbus/push/pushVenGateShop"; + + public final static String BIND_USERACCOUNT_URL =HOST+"/open/onbus/user/bindUserAccount"; + public final static String UNBIND_USERACCOUNT_URL =HOST+"/open/onbus/user/unBindUserAccount"; /** * 鍙栨秷閲囪喘鍗曞鏍窾RL */ diff --git a/src/com/yc/open/deli/entity/UserAccountEntity.java b/src/com/yc/open/deli/entity/UserAccountEntity.java new file mode 100644 index 0000000..42a04d3 --- /dev/null +++ b/src/com/yc/open/deli/entity/UserAccountEntity.java @@ -0,0 +1,9 @@ +package com.yc.open.deli.entity; + +import lombok.Data; + +@Data +public class UserAccountEntity { + String userName; + String userPass; +} diff --git a/src/com/yc/open/deli/service/v2/DeLiIfc.java b/src/com/yc/open/deli/service/v2/DeLiIfc.java index 98c32e3..cb6cb9a 100644 --- a/src/com/yc/open/deli/service/v2/DeLiIfc.java +++ b/src/com/yc/open/deli/service/v2/DeLiIfc.java @@ -1,5 +1,6 @@ package com.yc.open.deli.service.v2; +import com.yc.entity.DataSourceEntity; import com.yc.open.deli.entity.*; import com.yc.open.init.Task; @@ -66,4 +67,6 @@ public CanelEntity getCanelEntityByTableName(String hdtable,String dttable,String doccode,int formid); + Integer bindUserAccount(DataSourceEntity dataSource); + Integer unbindUserAccount(DataSourceEntity dataSource); } diff --git a/src/com/yc/open/deli/service/v2/DeLiImplV2.java b/src/com/yc/open/deli/service/v2/DeLiImplV2.java index 18a7aab..2b82205 100644 --- a/src/com/yc/open/deli/service/v2/DeLiImplV2.java +++ b/src/com/yc/open/deli/service/v2/DeLiImplV2.java @@ -1,6 +1,7 @@ package com.yc.open.deli.service.v2; import com.yc.action.grid.GridUtils; +import com.yc.entity.DataSourceEntity; import com.yc.exception.ApplicationException; import com.yc.factory.FactoryBean; import com.yc.open.deli.entity.*; @@ -1377,4 +1378,14 @@ } return results; } + + @Override + public Integer bindUserAccount(DataSourceEntity dataSource) { + return this.jdbcTemplate.update("set nocount on \n update a set a.DeliUserCode =? , a.DeliUserId =? from gsystem a where id=?",dataSource.getDeliUserCode(),dataSource.getDeliUserId(),dataSource.getDbId()); + } + + @Override + public Integer unbindUserAccount(DataSourceEntity dataSource) { + return this.jdbcTemplate.update("set nocount on \n update a set a.DeliUserCode =null , a.DeliUserId =null from gsystem a where id=?",dataSource.getDbId()); + } } diff --git a/src/com/yc/open/mutual/service/MutualServiceImpl.java b/src/com/yc/open/mutual/service/MutualServiceImpl.java index eee85a6..14b6c9e 100644 --- a/src/com/yc/open/mutual/service/MutualServiceImpl.java +++ b/src/com/yc/open/mutual/service/MutualServiceImpl.java @@ -622,7 +622,7 @@ @Override public DataSourceEntity getDataSourceByDbid(String dbId) { return this.jdbcTemplate.queryForObject("set nocount on \n" + - " select systemID,systemDescribe,DBConnectionStr,Protocol,domain,smsUid,smsKey,isnull(isShowAttendanceButton,0),isnull(LimitUserNumber,0),weixinID,systemType,ExpiredDate ,isnull(LimitDepartmentNumber,0),Remarks,isnull(DataCheckPageNum,0),CorpId,CorpContactsSecret,CorpAppSecret,CorpAppToken,CorpAppAesKey,CorpURL,MpAppId,MpSecret,MpToken,MpAesKey,MpOrgId,GeoWebApiKey,MpMchId,MpMchName,MpMchKey,isnull(CorpAppAgentId,0),isnull(isDisabledOpenNextPeriodId,0),InvitationCode,CorpAttendanceSecret,CorpSecret,CorpGroupSecret,CorpGroupName,MiniAppId,MiniAppSecret,MiniAppToken,MiniAppAesKey,MiniAppOrgId,SystemAccessKey,SystemSecretKey,DockingSystem,isnull(isUseAPP,0),isnull(isShowInLoginPage,0),OrgPassword,LogoIcon,TengXunMapLocationServiceKey,PaymentMethod,AbcMchId,DomainIpList,DomainStaticIpList,AliPayAppId,isnull(MaintenanceFeeToDbId,0),MaintenanceFeeAcctCode from gsystem where id=?", new BeanPropertyRowMapper<>(DataSourceEntity.class), dbId); + " select systemID,systemDescribe,DBConnectionStr,Protocol,domain,smsUid,smsKey,isnull(isShowAttendanceButton,0),isnull(LimitUserNumber,0),weixinID,systemType,ExpiredDate ,isnull(LimitDepartmentNumber,0),Remarks,isnull(DataCheckPageNum,0),CorpId,CorpContactsSecret,CorpAppSecret,CorpAppToken,CorpAppAesKey,CorpURL,MpAppId,MpSecret,MpToken,MpAesKey,MpOrgId,GeoWebApiKey,MpMchId,MpMchName,MpMchKey,isnull(CorpAppAgentId,0),isnull(isDisabledOpenNextPeriodId,0),InvitationCode,CorpAttendanceSecret,CorpSecret,CorpGroupSecret,CorpGroupName,MiniAppId,MiniAppSecret,MiniAppToken,MiniAppAesKey,MiniAppOrgId,SystemAccessKey,SystemSecretKey,DockingSystem,isnull(isUseAPP,0),isnull(isShowInLoginPage,0),OrgPassword,LogoIcon,TengXunMapLocationServiceKey,PaymentMethod,AbcMchId,DomainIpList,DomainStaticIpList,AliPayAppId,isnull(MaintenanceFeeToDbId,0),MaintenanceFeeAcctCode,deliUserId,deliUserCode from gsystem where id=?", new BeanPropertyRowMapper<>(DataSourceEntity.class), dbId); } @Override diff --git a/src/com/yc/service/upload/AttachmentImpl.java b/src/com/yc/service/upload/AttachmentImpl.java index d84e938..4ae8e8a 100644 --- a/src/com/yc/service/upload/AttachmentImpl.java +++ b/src/com/yc/service/upload/AttachmentImpl.java @@ -10,6 +10,7 @@ import com.yc.sdk.weixincp.util.UploadFiles; import com.yc.service.BaseService; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.RandomStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.dao.DataAccessException; @@ -80,6 +81,7 @@ return (ret!= null && !ret.equals(0)?true:false) ; } public String getdeleteAttachmentSql(PicEntity entity){ + String rand= "_"+RandomStringUtils.randomAlphanumeric(2); String tableName = ""; if (entity.getType() == 0 || entity.getType() == 1) { tableName = "_sys_attachment9"; @@ -99,29 +101,29 @@ if(org.apache.commons.lang3.StringUtils.isNotBlank(entity.getRowid())){ where+=" and rowid="+GridUtils.prossSqlParm(entity.getRowid()); } - String sql = " \n set nocount on \n declare @unid varchar(50)="+GridUtils.prossSqlParm(entity.getUuid())+" ,@seq int = "+entity.getSeq()+" \n" - + " declare @AcType varchar(50) = "+GridUtils.prossSqlParm(entity.getAction())+" \n" - + " declare @usercode varchar(50) = "+GridUtils.prossSqlParm(entity.getUserCode())+" \n" - + " declare @username varchar(50) = "+GridUtils.prossSqlParm(entity.getUserName())+" \n" - + " declare @ip varchar(50) ="+GridUtils.prossSqlParm(entity.getIp()) +" \n" - + " declare @mydelPicrowcount int = 0 \n" + String sql = " \n set nocount on \n declare @unid"+rand+" varchar(50)="+GridUtils.prossSqlParm(entity.getUuid())+" ,@seq"+rand+" int = "+entity.getSeq()+" \n" + + " declare @AcType"+rand+" varchar(50) = "+GridUtils.prossSqlParm(entity.getAction())+" \n" + + " declare @usercode"+rand+" varchar(50) = "+GridUtils.prossSqlParm(entity.getUserCode())+" \n" + + " declare @username"+rand+" varchar(50) = "+GridUtils.prossSqlParm(entity.getUserName())+" \n" + + " declare @ip"+rand+" varchar(50) ="+GridUtils.prossSqlParm(entity.getIp()) +" \n" + + " declare @mydelPicrowcount"+rand+" int = 0 \n" + " insert into _sys_attachmentlog(unid,seq,acType,usercode,username,downloadtime,ip," + " formid,doccode,rowid,fieldid,PhysicalPath,PhysicalFile,OriginalFileName,FileSize,\n" + " FileType,DownNums,ViewNums,UpdateNums,AuthorCode,AuthorName,UploadTime,LastUpdateTime,\n" + " smallPicPath,isSetPermission,lastfilename,SmallPicture,OriginalPicture,lastfilesize,\n" + " LastAuthorCode,lastauthorName,lastfileType,wxFileType,WxCreateTime,wxMediaId,wxPicUrl,Remark) \n" - + " select unid,seq,@acType,@usercode,@username,getdate(),@ip, \n" + + " select unid,seq,@acType"+rand+",@usercode"+rand+",@username"+rand+",getdate(),@ip"+rand+", \n" + " formid,doccode,rowid,fieldid,PhysicalPath,PhysicalFile,OriginalFileName,FileSize,\n" + " FileType,DownNums,ViewNums,UpdateNums,AuthorCode,AuthorName,UploadTime,LastUpdateTime,\n" + " smallPicPath,isSetPermission,lastfilename,SmallPicture,OriginalPicture,lastfilesize,\n" + " LastAuthorCode,lastauthorName,lastfileType,wxFileType,WxCreateTime,wxMediaId,wxPicUrl,Remark \n" - + " from " + tableName + " where unid =@unid and seq=@seq "+where+" \n" - + " delete " + tableName + " where unid =@unid and seq=@seq "+where+"\n"; + + " from " + tableName + " where unid =@unid"+rand+" and seq=@seq"+rand+" "+where+" \n" + + " delete " + tableName + " where unid =@unid"+rand+" and seq=@seq"+rand+" "+where+"\n"; if(org.apache.commons.lang3.StringUtils.isNotBlank(entity.getSql())){ sql+=" if @@rowcount>0 \n begin \n"+entity.getSql()+" \n end\n"; } - sql+=" set @mydelPicrowcount = @@rowcount \n" - + " select @mydelPicrowcount \n"; + sql+=" set @mydelPicrowcount"+rand+" = @@rowcount \n" + + " select @mydelPicrowcount"+rand+" \n"; return sql; } // 鍒犻櫎鏂囦欢鏁版嵁璁板綍 -- Gitblit v1.8.0