5cc3efe4e2fb37b5a7e36dd5dce10ca2c977b79e.svn-base 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010
  1. package com.sinosoft.lz.system.newsms.dao;
  2. import java.sql.Connection;
  3. import java.sql.PreparedStatement;
  4. import java.sql.SQLException;
  5. import java.util.ArrayList;
  6. import java.util.List;
  7. import java.util.Map;
  8. import org.apache.log4j.Logger;
  9. import com.formaction.Parameter;
  10. import com.formaction.vo.Msg;
  11. import com.formaction.vo.MsgDetail;
  12. import com.formaction.vo.NewMsg;
  13. import com.persistence.DbConnection;
  14. import com.persistence.service.assitant.generator.IdentityGenerator;
  15. import com.sinosoft.am.org.jdbcUtil.ORGTemplate;
  16. import com.sinosoft.common.excel.JsonPluginsUtil;
  17. import com.sinosoft.lz.system.sms.dao.ws.MsgDao;
  18. public class NewSmsDao {
  19. private Logger log = Logger.getLogger(this.getClass());
  20. /**
  21. * 2017-12-13 吴玉祥加
  22. * 保存消息都数据库
  23. * @param mg
  24. * @return
  25. * @throws ClassNotFoundException
  26. */
  27. public Msg saveMsg(NewMsg msg) throws ClassNotFoundException {
  28. Msg m=new Msg();
  29. Connection conn = null;
  30. PreparedStatement st = null;
  31. DbConnection db = new DbConnection();
  32. String sql = "INSERT INTO MSG_SEND_INFO"
  33. +"(FD_OBJECTID,MODULE,SUBMODULE,TASK_NAME,IS_EMERGENCY,EVENT_ID,SEND_TYPE,RECORDER_ID,RECORDER_ORG,SEND_TIME,MSG_CONTENT,MSG_TYPE,MSG_REPORT,PRIORITY,MSG_ACCESS,RECEIVER,RECEIVER_ORG,RECEIVER_PHONE)"
  34. + "VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  35. try {
  36. conn = db.getConnection();
  37. conn.setAutoCommit(false);
  38. st = conn.prepareStatement(sql);
  39. msg.setFd_objectId(IdentityGenerator.getIdentityGenerator().gerenalIdentity(99));
  40. st.setString(1, msg.getFd_objectId());
  41. st.setString(2, msg.getModule());
  42. st.setString(3, msg.getSubmodule());
  43. st.setString(4, msg.getTask_name());
  44. st.setString(5, msg.getIs_emergency());
  45. st.setString(6, msg.getEvent_id());
  46. st.setString(7, msg.getSend_type());
  47. st.setString(8, msg.getRecorder_id());
  48. st.setString(9, msg.getRecorder_org());
  49. st.setString(10, msg.getSend_time());
  50. st.setString(11, msg.getMsg_content());
  51. st.setString(12, msg.getMsg_type());
  52. st.setString(13, msg.getMsg_report());
  53. st.setString(14, msg.getPriority());
  54. st.setString(15, msg.getMsg_access());
  55. st.setString(16, msg.getReceiver());
  56. st.setString(17, msg.getReceiver_org());
  57. st.setString(18, msg.getReceiver_phone());
  58. //st.setString(19, msg.getSend_state());
  59. //st.setString(20, msg.getSend_result());
  60. //st.setString(21, msg.getReceipt());
  61. //st.setString(22, msg.getMsg_id());
  62. //st.setString(23, msg.getReceipt_time());
  63. //st.setString(24, msg.getError_code());
  64. int result = st.executeUpdate();
  65. if(result>0){
  66. log.info("保存成功");
  67. conn.commit();
  68. m.setSucsess(new Boolean(true).toString());
  69. m.setInfo(msg.getFd_objectId());
  70. return m;
  71. }else{
  72. m.setSucsess(new Boolean(false).toString());
  73. m.setInfo(Parameter.DELETE_FAILURE);
  74. // st.executeBatch();
  75. conn.rollback();
  76. log.info("保存失败");
  77. return m;}
  78. } catch (SQLException e) {
  79. this.log.error(e.getMessage(), e);
  80. throw new ClassNotFoundException("DAO Layou: 消息保存", e);
  81. } finally {
  82. db.close(st);
  83. db.close(conn);
  84. }
  85. }
  86. /*
  87. * 本地保存
  88. */
  89. public String saveMsgDetail(MsgDetail msgDetail) throws ClassNotFoundException {
  90. ORGTemplate template = new ORGTemplate();
  91. String sql = "INSERT INTO MSG_SEND_DETAIL"
  92. +"(FD_OBJECTID,TASK_NAME,RECEIVER_ID,RECEIVER_PHONE,SEND_RESULT,RECEIVE_TIME,INFO_ID,RECEIPT,ERROR_CODE,SEND_STATE,RECEIVER_ORG,RECEIVER_NAME)"
  93. + "VALUES(?,?,?,?,?,?,?,?,?,?,?,?)";
  94. try {
  95. msgDetail.setFd_objectId(IdentityGenerator.getIdentityGenerator().gerenalIdentity(99));
  96. /*st.setString(1, msgDetail.getFd_objectId());
  97. st.setString(2, msgDetail.getTask_name());
  98. st.setString(3, msgDetail.getReceiver_id());
  99. st.setString(4, msgDetail.getReceiver_phone());
  100. st.setString(5, msgDetail.getSend_result());
  101. st.setString(6, msgDetail.getReceive_time());
  102. st.setString(7, msgDetail.getInfo_id());
  103. //st.setString(8, msgDetail.getMsg_content());
  104. st.setString(8, msgDetail.getReceipt());
  105. st.setString(9, msgDetail.getError_code());
  106. st.setString(10, msgDetail.getSend_state());*/
  107. int result = template.update(sql, msgDetail.getFd_objectId(),msgDetail.getTask_name(), msgDetail.getReceiver_id()
  108. , msgDetail.getReceiver_phone(), msgDetail.getSend_result(), msgDetail.getReceive_time()
  109. , msgDetail.getInfo_id(), msgDetail.getReceipt(), msgDetail.getError_code(),
  110. msgDetail.getSend_state(),msgDetail.getReceiver_org(),msgDetail.getReceiver_name()
  111. );
  112. if(result>0){
  113. log.info("保存成功");
  114. return "1";
  115. }else{
  116. log.info("保存失败");
  117. return "0";}
  118. } catch (SQLException e) {
  119. this.log.error(e.getMessage(), e);
  120. throw new ClassNotFoundException("DAO Layou: 消息保存", e);
  121. }
  122. }
  123. /**
  124. * 用于保存短信明细(接口)
  125. * 2018-2-1吴玉祥添加
  126. * @param msgDetail
  127. * @return
  128. * @throws ClassNotFoundException
  129. */
  130. public String saveMsgDetail1(MsgDetail msgDetail) throws ClassNotFoundException {
  131. log.info("开始保存短信明细");
  132. ORGTemplate template = new ORGTemplate();
  133. MsgDao msgDao = new MsgDao();
  134. String sendMsg = "";
  135. String sql = "INSERT INTO MSG_SEND_DETAIL"
  136. +"(FD_OBJECTID,TASK_NAME,RECEIVER_ID,RECEIVER_PHONE,SEND_RESULT,RECEIVE_TIME,INFO_ID,RECEIPT,ERROR_CODE,SEND_STATE,RECEIVER_ORG,RECEIVER_NAME)"
  137. + "VALUES(?,?,?,?,?,?,?,?,?,?,?,?)";
  138. try {
  139. msgDetail.setFd_objectId(IdentityGenerator.getIdentityGenerator().gerenalIdentity(99));
  140. /*st.setString(1, msgDetail.getFd_objectId());
  141. st.setString(2, msgDetail.getTask_name());
  142. st.setString(3, msgDetail.getReceiver_id());
  143. st.setString(4, msgDetail.getReceiver_phone());
  144. st.setString(5, msgDetail.getSend_result());
  145. st.setString(6, msgDetail.getReceive_time());
  146. st.setString(7, msgDetail.getInfo_id());
  147. //st.setString(8, msgDetail.getMsg_content());
  148. st.setString(8, msgDetail.getReceipt());
  149. st.setString(9, msgDetail.getError_code());
  150. st.setString(10, msgDetail.getSend_state());*/
  151. int result = template.update(sql, msgDetail.getFd_objectId(),msgDetail.getTask_name(), msgDetail.getReceiver_id()
  152. , msgDetail.getReceiver_phone(), msgDetail.getSend_result(), msgDetail.getReceive_time()
  153. , msgDetail.getInfo_id(), msgDetail.getReceipt(), msgDetail.getError_code(),
  154. msgDetail.getSend_state(),msgDetail.getReceiver_org(),msgDetail.getReceiver_name()
  155. );
  156. if(result>0){
  157. log.info("保存短信明细成功,马上开始短信接口");
  158. String msgID=msgDetail.getFd_objectId();
  159. boolean flag = msgDao.sendShortMessage(msgDetail.getReceiver_phone(), msgDetail.getMsg_content(), msgID);
  160. if(flag) {
  161. msgDao.updateMsgDetail("DELIVRD",msgID);
  162. sendMsg = "1";//发送成功
  163. }else{
  164. msgDao.updateMsgDetail("fail",msgID);
  165. sendMsg = "0";//发送失败
  166. }
  167. }else{
  168. log.info("保存失败");
  169. }
  170. return sendMsg;
  171. } catch (SQLException e) {
  172. this.log.error(e.getMessage(), e);
  173. throw new ClassNotFoundException("DAO Layou: 消息保存", e);
  174. }
  175. }
  176. public String getSendData(String user_id){
  177. ORGTemplate template = new ORGTemplate();
  178. String sql ="select distinct a.fd_objectid,a.task_name,a.event_id,a.module,a.send_type,a.send_time,a.msg_content "
  179. + " from msg_send_info a,msg_send_detail b"
  180. + " where a.fd_objectid = b.info_id and a.recorder_id =? "
  181. + " order by a.send_time desc";
  182. String sql1 = "";
  183. String sql2 = "";
  184. log.info("sql=============="+sql);
  185. ArrayList<Map<String,String>> list = null;
  186. ArrayList<Map<String,String>> success = null;
  187. ArrayList<Map<String,String>> failure = null;
  188. StringBuffer json = new StringBuffer();
  189. try {
  190. list =template.getSerachResult(sql, user_id);
  191. for(int i=0;i<list.size();i++){
  192. sql1 = "select a.fd_objectId "
  193. + " from msg_send_detail a,msg_send_info b "
  194. + " where (a.send_result ='发送成功' or a.send_result ='重新发送成功') "
  195. + " and b.fd_objectid=?"
  196. + " and b.fd_objectid = a.info_id";
  197. sql2 = "select a.fd_objectId "
  198. + " from msg_send_detail a,msg_send_info b "
  199. + " where (a.send_result ='发送失败' or a.send_result ='重新发送失败') "
  200. + " and b.fd_objectid=?"
  201. + " and b.fd_objectid = a.info_id";
  202. success = template.getSerachResult(sql1, list.get(i).get("FD_OBJECTID"));
  203. failure = template.getSerachResult(sql2, list.get(i).get("FD_OBJECTID"));
  204. String send_result =(success.size())+"/"+(success.size()+failure.size());
  205. json.append("{");
  206. json.append("\"fd_objectId\":\""+list.get(i).get("FD_OBJECTID")+"\",");
  207. json.append("\"task_name\":\""+list.get(i).get("TASK_NAME").replaceAll("\"", "引号").replaceAll("\\\\", "斜杠")+"\",");
  208. json.append("\"event_id\":\""+list.get(i).get("EVENT_ID")+"\",");
  209. json.append("\"module\":\""+list.get(i).get("MODULE")+"\",");
  210. json.append("\"send_type\":\""+list.get(i).get("SEND_TYPE")+"\",");
  211. json.append("\"send_time\":\""+list.get(i).get("SEND_TIME")+"\",");
  212. json.append("\"send_result\":\""+send_result+"\",");
  213. json.append("\"msg_content\":\""+list.get(i).get("MSG_CONTENT").replaceAll("\n","<br>").replaceAll("\"", "引号").replaceAll("\\\\", "斜杠")+"\"");
  214. json.append("},");
  215. }
  216. if(list.size()>0){
  217. json.deleteCharAt(json.length()-1);
  218. }
  219. } catch (Exception e) {
  220. e.printStackTrace();
  221. }
  222. String result ="{\"rows\":["+json.toString()+"]}";
  223. log.info("result==========="+result);
  224. return result;
  225. }
  226. public String getReceiveData(String user_id){
  227. ORGTemplate template = new ORGTemplate();
  228. String sql ="select a.fd_objectid,a.task_name,a.event_id,a.module,a.send_type,a.send_time,c.real_name as recorder_name,a.msg_content "
  229. + " from msg_send_info a,msg_send_detail b,sys_user_info c "
  230. + " where a.fd_objectid = b.info_id and a.recorder_id = c.user_id and b.receiver_id=? "
  231. + " order by a.send_time desc";
  232. log.info("sql================="+sql);
  233. ArrayList<Map<String,String>> list = null;
  234. StringBuffer json = new StringBuffer();
  235. try {
  236. list =template.getSerachResult(sql, user_id);
  237. for(int i=0;i<list.size();i++){
  238. json.append("{");
  239. json.append("\"fd_objectId\":\""+list.get(i).get("FD_OBJECTID")+"\",");
  240. json.append("\"task_name\":\""+list.get(i).get("TASK_NAME").replaceAll("\"", "引号").replaceAll("\\\\", "斜杠")+"\",");
  241. json.append("\"event_id\":\""+list.get(i).get("EVENT_ID")+"\",");
  242. json.append("\"module\":\""+list.get(i).get("MODULE")+"\",");
  243. json.append("\"send_type\":\""+list.get(i).get("SEND_TYPE")+"\",");
  244. json.append("\"send_time\":\""+list.get(i).get("SEND_TIME")+"\",");
  245. json.append("\"recorder_name\":\""+list.get(i).get("RECORDER_NAME")+"\",");
  246. json.append("\"msg_content\":\""+list.get(i).get("MSG_CONTENT").replaceAll("\n","<br>").replaceAll("\"", "引号").replaceAll("\\\\", "斜杠")+"\"");
  247. json.append("},");
  248. }
  249. if(list.size()>0){
  250. json.deleteCharAt(json.length()-1);
  251. }
  252. } catch (Exception e) {
  253. e.printStackTrace();
  254. }
  255. String result ="{\"rows\":["+json.toString()+"]}";
  256. return result;
  257. }
  258. public String match(String phone){
  259. ORGTemplate template = new ORGTemplate();
  260. String sql = "select a.user_id,a.real_name,b.corp_name,b.dept_name from sys_user_info a,sys_department b "
  261. + "where a.dept_id = b.dept_id "
  262. + "and a.mobile = ?";
  263. log.info("sql========"+sql);
  264. ArrayList<Map<String,String>> list =null;
  265. StringBuffer json = new StringBuffer();
  266. try {
  267. list = template.getSerachResult(sql, phone);
  268. if(!(list==null||list.size()==0)){
  269. json.append("{");
  270. json.append("\"user_id\":\""+list.get(0).get("USER_ID")+"\",");
  271. json.append("\"user_name\":\""+list.get(0).get("REAL_NAME")+"\",");
  272. json.append("\"user_dept\":\""+list.get(0).get("DEPT_NAME")+"\",");
  273. json.append("\"user_corp\":\""+list.get(0).get("CORP_NAME")+"\"");
  274. json.append("}");
  275. }
  276. } catch (Exception e) {
  277. e.printStackTrace();
  278. }
  279. return json.toString();
  280. }
  281. public String getNumData(String user_id){
  282. ORGTemplate template = new ORGTemplate();
  283. String sTaskNum = "";
  284. String rTaskNum = "";
  285. String sMsgNum = "";
  286. String rMsgNum = "";
  287. //用户短信发送任务数
  288. String sql1 ="select count(fd_objectId) from msg_send_info where recorder_id = ?";
  289. //用户短信接收任务数
  290. String sql2 ="select count(a.fd_objectId) from msg_send_info a, msg_send_detail b where a.fd_objectId = b.info_id and b.receiver_id = ?";
  291. //用户短信发送条数
  292. String sql3 ="select count(b.fd_objectId) from msg_send_info a, msg_send_detail b where a.fd_objectId = b.info_id and a.recorder_id = ?";
  293. //用户短息接收条数
  294. String sql4 ="select count(fd_objectId) from msg_send_detail where receiver_id = ?";
  295. log.info("用户短信发送任务数sql1============="+sql1);
  296. log.info("用户短信接收任务数sql2============="+sql2);
  297. log.info("用户短信发送条数sql3============="+sql3);
  298. log.info("用户短信接收条数sql4============="+sql4);
  299. StringBuffer json = new StringBuffer();
  300. try {
  301. sTaskNum = template.getResultList(sql1, user_id).get(0);
  302. rTaskNum = template.getResultList(sql2, user_id).get(0);
  303. sMsgNum = template.getResultList(sql3, user_id).get(0);
  304. rMsgNum = template.getResultList(sql4, user_id).get(0);
  305. json.append("{");
  306. json.append("\"sTaskNum\":\""+sTaskNum+"\",");
  307. json.append("\"rTaskNum\":\""+rTaskNum+"\",");
  308. json.append("\"sMsgNum\":\""+sMsgNum+"\",");
  309. json.append("\"rMsgNum\":\""+rMsgNum+"\"");
  310. json.append("}");
  311. } catch (Exception e) {
  312. e.printStackTrace();
  313. }
  314. return json.toString();
  315. }
  316. public String getRecentData(String user_id, String name) {
  317. ORGTemplate template = new ORGTemplate();
  318. ArrayList<Map<String,String >> list = new ArrayList<Map<String,String>>();
  319. String sql ="";
  320. String nameCondition= " and (login_name like'%"+name+"%' or user_name like'%"+name+"%')";
  321. //本人发的短信的接收者
  322. String receiverSql ="select distinct top 200 b.receiver_id as user_id,d.real_name as user_name,d.login_name as login_name,c.corp_name as corp_name,c.dept_name as dept_name,d.mobile as phone,b.receive_time as temp_date"
  323. + " from msg_send_info a,msg_send_detail b,sys_department c,sys_user_info d"
  324. + " where a.recorder_id = ? and d.user_id = b.receiver_id and c.dept_id = d.dept_id";
  325. //本人收到的短信的发送者
  326. String recorderSql ="select distinct top 200 a.recorder_id as user_id,d.real_name as user_name,d.login_name as login_name,c.corp_name as corp_name,c.dept_name as dept_name,d.mobile as phone,b.receive_time as temp_date"
  327. + " from msg_send_info a,msg_send_detail b,sys_department c,sys_user_info d"
  328. + " where b.receiver_id = ? and d.user_id = b.receiver_id and c.dept_id = d.dept_id";
  329. //按时间倒序,按id去重
  330. String sql1 ="select user_id,login_name,user_name ,corp_name ,dept_name,phone,temp_date "
  331. + " from "
  332. + " ("
  333. + " select row_number() over(partition by user_id order by temp_date) as num, * "
  334. + " from"
  335. + " ("
  336. + receiverSql
  337. + " union "
  338. + recorderSql
  339. + " )"
  340. + " ) as t"
  341. + " where t.num =1";
  342. if("".equals(name)||name==null){//初始加载
  343. sql = sql1+ " order by temp_date desc";
  344. }else{
  345. sql = sql1+nameCondition+" order by temp_date desc";
  346. }
  347. log.info("sql============="+sql);
  348. StringBuffer json = new StringBuffer();
  349. try {
  350. list = template.getSerachResult(sql, user_id,user_id);
  351. for(int i=0;i<list.size();i++){
  352. String userId = list.get(i).get("USER_ID");
  353. String userName = list.get(i).get("USER_NAME");
  354. String org_name = list.get(i).get("CORP_NAME");
  355. String dept_name = list.get(i).get("DEPT_NAME");
  356. String phone = getReceivePhone(list.get(i).get("USER_ID"));
  357. json.append("{");
  358. json.append("\"type\":\""+"1"+"\",");
  359. json.append("\"userId\":\""+userId+"\",");
  360. json.append("\"userName\":\""+userName+"\",");
  361. json.append("\"org_name\":\""+org_name+"\",");
  362. json.append("\"dept_name\":\""+dept_name+"\",");
  363. if(phone==null||"".equals(phone)){
  364. json.append("\"phone\":\""+list.get(i).get("MOBILE")+"\"");
  365. }else{
  366. json.append("\"phone\":\""+phone+"\"");
  367. }
  368. json.append("},");
  369. }
  370. if(list.size()>0){
  371. json.deleteCharAt(json.length()-1);
  372. }
  373. } catch (Exception e) {
  374. e.printStackTrace();
  375. }
  376. String result = "{\"rows\":["+json.toString()+"]}";
  377. log.info("result========="+result);
  378. return result;
  379. }
  380. public String getOrgData(String dept_id) {
  381. if(!"".equals(dept_id)){
  382. dept_id = dept_id.replace("999|", "");
  383. }
  384. ORGTemplate template = new ORGTemplate();
  385. ArrayList<Map<String,String>> list = new ArrayList<Map<String, String>>();
  386. StringBuffer json = new StringBuffer();
  387. String sql ="select top 200 a.user_id ,a.real_name,b.corp_name,b.dept_name,a.mobile "
  388. + " from sys_user_info a,sys_department b "
  389. + " where a.dept_id =b.dept_id and a.dept_id = ? ";
  390. log.info("sql============="+sql);
  391. try {
  392. list = template.getSerachResult(sql, dept_id);
  393. } catch (Exception e) {
  394. e.printStackTrace();
  395. }
  396. for(int i=0;i<list.size();i++){
  397. String userId = list.get(i).get("USER_ID");
  398. String userName = list.get(i).get("REAL_NAME");
  399. String org_name = list.get(i).get("CORP_NAME");
  400. String dept_name = list.get(i).get("DEPT_NAME");
  401. String phone = getReceivePhone(list.get(i).get("USER_ID"));
  402. json.append("{");
  403. json.append("\"type\":\""+"2"+"\",");
  404. json.append("\"userId\":\""+userId+"\",");
  405. json.append("\"userName\":\""+userName+"\",");
  406. json.append("\"org_name\":\""+org_name+"\",");
  407. json.append("\"dept_name\":\""+dept_name+"\",");
  408. if(phone==null||"".equals(phone)){
  409. json.append("\"phone\":\""+list.get(i).get("MOBILE")+"\"");
  410. }else{
  411. json.append("\"phone\":\""+phone+"\"");
  412. }
  413. json.append("},");
  414. }
  415. if(list.size()>0){
  416. json.deleteCharAt(json.length()-1);
  417. }
  418. String result ="{\"rows\":["+json.toString()+"]}";
  419. return result;
  420. }
  421. public String getNameData(String name) {
  422. ORGTemplate template = new ORGTemplate();
  423. ArrayList<Map<String,String>> list = new ArrayList<Map<String, String>>();
  424. StringBuffer json = new StringBuffer();
  425. String sql ="select top 200 a.user_id ,a.real_name,b.corp_name,b.dept_name,a.mobile "
  426. + " from sys_user_info a,sys_department b "
  427. + " where a.dept_id = b.dept_id"
  428. + " and (a.login_name like '%"+name+"%' or a.real_name like '%"+name+"%')";
  429. log.info("sql============="+sql);
  430. try {
  431. list = template.getSerachResult(sql);
  432. } catch (Exception e) {
  433. e.printStackTrace();
  434. }
  435. for(int i=0;i<list.size();i++){
  436. String userId = list.get(i).get("USER_ID");
  437. String userName = list.get(i).get("REAL_NAME");
  438. String org_name = list.get(i).get("CORP_NAME");
  439. String dept_name = list.get(i).get("DEPT_NAME");
  440. String phone = getReceivePhone(list.get(i).get("USER_ID"));
  441. json.append("{");
  442. json.append("\"type\":\""+"2"+"\",");
  443. json.append("\"userId\":\""+userId+"\",");
  444. json.append("\"userName\":\""+userName+"\",");
  445. json.append("\"org_name\":\""+org_name+"\",");
  446. json.append("\"dept_name\":\""+dept_name+"\",");
  447. if(phone==null||"".equals(phone)){
  448. json.append("\"phone\":\""+list.get(i).get("MOBILE")+"\"");
  449. }else{
  450. json.append("\"phone\":\""+phone+"\"");
  451. }
  452. json.append("},");
  453. }
  454. if(list.size()>0){
  455. json.deleteCharAt(json.length()-1);
  456. }
  457. String result ="{\"rows\":["+json.toString()+"]}";
  458. return result;
  459. }
  460. public String getGroup(String user_id) {
  461. ORGTemplate template = new ORGTemplate();
  462. ArrayList<Map<String,String>> list = new ArrayList<Map<String,String>>();
  463. StringBuffer json = new StringBuffer();
  464. String sql ="select group_id ,group_name,update_time ,order_number,parent_id"
  465. + " from msg_group "
  466. + " where creater_id = ? and is_del = '0' "
  467. + " order by order_number,update_time desc";
  468. //应急指挥中心
  469. json.append("{");
  470. json.append("\"id\":\""+"0"+"\",");
  471. json.append("\"name\":\""+"贵州电网公司应急指挥中心"+"\",");
  472. json.append("\"order_number\":\""+"0"+"\",");
  473. json.append("\"parentId\":\""+""+"\",");
  474. json.append("\"parentId\":\""+""+"\",");
  475. json.append("\"open\":\""+"true"+"\",");
  476. json.append("\"icon\":\"/nwyj/scripts/qui/libs/icons/user_group.png\"");
  477. json.append("},");
  478. json.append("{");
  479. json.append("\"id\":\""+"1"+"\",");
  480. json.append("\"name\":\""+"贵州电网公司应急办"+"\",");
  481. json.append("\"order_number\":\""+""+"\",");
  482. json.append("\"parentId\":\""+"0"+"\",");
  483. json.append("\"icon\":\"/nwyj/scripts/qui/libs/icons/user_group.png\"");
  484. json.append("},");
  485. try {
  486. list = template.getSerachResult(sql, user_id);
  487. for(int i=0;i<list.size();i++){
  488. json.append("{");
  489. json.append("\"id\":\""+list.get(i).get("GROUP_ID")+"\",");
  490. json.append("\"name\":\""+list.get(i).get("GROUP_NAME")+"\",");
  491. json.append("\"order_number\":\""+list.get(i).get("ORDER_NUMBER")+"\",");
  492. json.append("\"parentId\":\""+list.get(i).get("PARENT_ID")+"\",");
  493. json.append("\"icon\":\"/nwyj/scripts/qui/libs/icons/user_group.png\"");
  494. json.append("},");
  495. }
  496. json.deleteCharAt(json.length()-1);
  497. } catch (Exception e) {
  498. e.printStackTrace();
  499. }
  500. String result = "{\"nodes\":["+json.toString()+"]}";
  501. return result;
  502. }
  503. public String getGroupData(String group_id) {
  504. ORGTemplate template = new ORGTemplate();
  505. ArrayList<Map<String,String>> list = new ArrayList<Map<String,String>>();
  506. String sql = "";
  507. StringBuffer json = new StringBuffer();
  508. if(group_id.equals("0")){//应急指挥中心
  509. sql = "select a.inlink_index as user_id,a.inlink_name as user_name,a.phone as mobile, d.corp_name as corp_name,d.dept_name "
  510. + " from emc_am_org_inlink a,SYS_USER_INFO b,sys_department d"
  511. + " where a.is_del='0' and virtual_org_id ='dd84a5d4d4b046cca28a52a2445ee55b' and a.inlink_index = b.user_id and b.dept_id = d.dept_id"
  512. + " order by sort_no asc";
  513. }else if(group_id.equals("1")){//应急办
  514. sql = "select a.inlink_index as user_id,a.inlink_name as user_name,a.phone as mobile, d.corp_name as corp_name,d.dept_name "
  515. + " from emc_am_org_inlink a,SYS_USER_INFO b,sys_department d"
  516. + " where a.is_del='0' and virtual_org_id ='9fe1b6fe993b48cfaeba714a25359d7c' and a.inlink_index = b.user_id and b.dept_id = d.dept_id"
  517. + " order by sort_no asc";
  518. }else{
  519. sql = "select a.user_id,a.user_name,a.update_time,c.corp_name,c.dept_name,b.mobile "
  520. + " from msg_group_data a,sys_user_info b,sys_department c "
  521. + " where a.group_id =? and a.user_id = b.user_id and b.dept_id = c.dept_id and a.is_del ='0'"
  522. + " order by a.update_time desc";
  523. }
  524. log.info("sql============="+sql);
  525. try {
  526. if(group_id.equals("0")||group_id.equals("1")){
  527. list = template.getSerachResult(sql);
  528. }else{
  529. list = template.getSerachResult(sql, group_id);
  530. }
  531. for(int i=0;i<list.size();i++){
  532. String userId = list.get(i).get("USER_ID");
  533. String userName = list.get(i).get("USER_NAME");
  534. String org_name = list.get(i).get("CORP_NAME");
  535. String dept_name = list.get(i).get("DEPT_NAME");
  536. String phone = getReceivePhone(list.get(i).get("USER_ID"));
  537. json.append("{");
  538. json.append("\"type\":\"3\",");
  539. json.append("\"group_id\":\""+group_id+"\",");
  540. json.append("\"userId\":\""+userId+"\",");
  541. json.append("\"userName\":\""+userName+"\",");
  542. json.append("\"org_name\":\""+org_name+"\",");
  543. json.append("\"dept_name\":\""+dept_name+"\",");
  544. if(phone==null||"".equals(phone)||"无".equals(phone)){
  545. json.append("\"phone\":\""+list.get(i).get("MOBILE")+"\"");
  546. }else{
  547. json.append("\"phone\":\""+phone+"\"");
  548. }
  549. json.append("},");
  550. }
  551. if(list.size()>0){
  552. json.deleteCharAt(json.length()-1);
  553. }
  554. } catch (Exception e) {
  555. e.printStackTrace();
  556. }
  557. String result ="{\"rows\":["+json.toString()+"]}";
  558. return result;
  559. }
  560. public String createGroup(String group_name, String creater_id,String now,String json,String parent_id) {
  561. ORGTemplate template = new ORGTemplate();
  562. String group_id = IdentityGenerator.getIdentityGenerator().gerenalIdentity(99);
  563. int flag1 = 0;
  564. int flag2 = 0;
  565. List<Map<String, String>> list = JsonPluginsUtil.jsonToMapList(json);
  566. int length = list.size();
  567. int num = 0;
  568. String sql ="select * from MSG_GROUP where is_del ='0'";
  569. String sql1 = "insert into msg_group (group_id,group_name,update_time,creater_id,is_del,order_number,parent_id) values (?,?,?,?,?,?,?)";
  570. String sql2 = "insert into msg_group_data(fd_objectid,user_id,user_name,group_id,update_time,is_del) values (?,?,?,?,?,?)";
  571. log.info("sql=============="+sql1);
  572. log.info("sql1============="+sql2);
  573. try {
  574. num = template.getSearchResult(sql).size();
  575. } catch (Exception e) {
  576. e.printStackTrace();
  577. }
  578. try {
  579. flag1 = template.update(sql1, group_id,group_name,now,creater_id,"0",num,parent_id);
  580. for(int i=0;i<list.size();i++){
  581. int result = template.update(sql2, IdentityGenerator.getIdentityGenerator().gerenalIdentity(99),
  582. list.get(i).get("id"), list.get(i).get("name"),
  583. group_id, now,"0");
  584. if (result > -1) {
  585. flag2++;
  586. }
  587. }
  588. } catch (Exception e) {
  589. e.printStackTrace();
  590. }
  591. log.info("flag1="+flag1+"||"+"flag2="+flag2+"||"+"length="+length);
  592. if(length==flag2&&flag1>-1){
  593. return "1";//成功
  594. }else{
  595. return "0";//失败
  596. }
  597. }
  598. public String updateGroup(String group_id, String group_name, String json,String now) {
  599. ORGTemplate template = new ORGTemplate();
  600. int flag1 = 0;
  601. int flag2 = 0;
  602. int flag3 = 0;
  603. String sql = "update msg_group set group_name='"+group_name+"' where group_id =? ";
  604. String sql1 = "update msg_group_data set is_del = '1' where group_id =?";
  605. String sql2 = "insert into msg_group_data(fd_objectid,user_id,user_name,group_id,update_time,is_del) values (?,?,?,?,?,?)";
  606. log.info("sql=============="+sql);
  607. log.info("sql1============="+sql1);
  608. log.info("sql2============="+sql2);
  609. List<Map<String,String>> list = JsonPluginsUtil.jsonToMapList(json);
  610. int length = list.size();
  611. try {
  612. flag1 = template.update(sql, group_id);
  613. flag2 = template.update(sql1, group_id);
  614. for(int i=0;i<list.size();i++){
  615. int num = template.update(sql2, IdentityGenerator.getIdentityGenerator().gerenalIdentity(99),
  616. list.get(i).get("id"), list.get(i).get("name"),
  617. group_id, now,"0");
  618. if(num>-1){
  619. flag3++;
  620. }
  621. }
  622. } catch (Exception e) {
  623. e.printStackTrace();
  624. }
  625. log.info("flag1="+flag1+"||"+"flag2="+flag2+"||"+"flag3+"+flag3+"||"+"length="+length);
  626. if(flag1>-1&&flag2>-1&&flag3==length){
  627. return "1";//成功
  628. }else{
  629. return "0";
  630. }
  631. }
  632. public String deleteGroup(String group_id) {
  633. ORGTemplate template = new ORGTemplate();
  634. String sql1 = "update msg_group set is_del ='1' where group_id =?";
  635. String sql2 = "update msg_group_data set is_del='1' where group_id =?";
  636. int flag1 = 0;
  637. int flag2 = 0;
  638. try {
  639. flag1 = template.update(sql1, group_id);
  640. flag2 = template.update(sql2, group_id);
  641. } catch (Exception e) {
  642. e.printStackTrace();
  643. }
  644. if(flag1>-1&&flag2>-1){
  645. return "1";
  646. }else{
  647. return "0";
  648. }
  649. }
  650. public String updateGroupOrder(String json,String targetNode) {
  651. List<Map<String,String>> list = JsonPluginsUtil.jsonToMapList(json);
  652. List<Map<String,String>> list1 = JsonPluginsUtil.jsonToMapList(targetNode);
  653. String sql = "update msg_group set order_number = ? where group_id = ?";
  654. String sql1 = "update msg_group set parent_id = ? where group_id = ?";
  655. ORGTemplate template = new ORGTemplate();
  656. String result = "";
  657. int flag1 = 0;
  658. int flag2 = 0;
  659. for(int i=0;i<list.size();i++){
  660. try {
  661. int num = template.update(sql, list.get(i).get("order_number"),list.get(i).get("id"));
  662. if(num>-1){
  663. flag1++;
  664. }
  665. } catch (SQLException e) {
  666. e.printStackTrace();
  667. }
  668. }
  669. try {
  670. int num = template.update(sql1, list1.get(0).get("parentId"),list1.get(0).get("id"));
  671. if(num>-1){
  672. flag2++;
  673. }
  674. } catch (Exception e) {
  675. e.printStackTrace();
  676. }
  677. if(flag1==list.size()&&flag2>0){
  678. result = "1";
  679. }
  680. return result;
  681. }
  682. public String updateGroupName(String group_id, String group_name) {
  683. ORGTemplate template = new ORGTemplate();
  684. String sql = "update msg_group set group_name =? where group_id =?";
  685. String result = "";
  686. log.info("sql========"+sql);
  687. try {
  688. int num = template.update(sql, group_name,group_id);
  689. if(num>0){
  690. result = "1";
  691. }
  692. } catch (Exception e) {
  693. e.printStackTrace();
  694. }
  695. return result;
  696. }
  697. public String updateUserPhone(String user_id, String real_name,String default_phone,
  698. String receive_phone, String all_phone) {
  699. String result ="";
  700. ORGTemplate template = new ORGTemplate();
  701. ArrayList<Map<String,String>> list = null;
  702. String sql1 = "select user_id from msg_user_phone where user_id = ?";
  703. String sql2 = "update msg_user_phone"
  704. + " set real_name=?,default_phone=?,receive_phone=?,all_phone=?"
  705. + " where user_id =?";
  706. String sql3 = "insert into msg_user_phone "
  707. + " (user_id,real_name,default_phone,receive_phone,is_del,all_phone) "
  708. + " values(?,?,?,?,?,?)";
  709. log.info("sql1=========="+sql1);
  710. log.info("sql2=========="+sql2);
  711. log.info("sql3=========="+sql3);
  712. int flag2 = 0;
  713. int flag3 = 0;
  714. try {
  715. list = template.getSerachResult(sql1, user_id);
  716. if(list.size()>0){//修改
  717. flag2 = template.update(sql2, real_name,default_phone,receive_phone,all_phone,user_id);
  718. }else{//新增
  719. flag3 = template.update(sql3, user_id,real_name,default_phone,receive_phone,0,all_phone);
  720. }
  721. } catch (Exception e) {
  722. e.printStackTrace();
  723. }
  724. log.info("flag2======="+flag2+",flag3==========="+flag3);
  725. if(flag2>0||flag3>0){
  726. result = "1";
  727. }
  728. return result;
  729. }
  730. public String getPhone(String user_id) {
  731. ORGTemplate template = new ORGTemplate();
  732. StringBuffer json = new StringBuffer();
  733. ArrayList<Map<String,String>> list = new ArrayList<Map<String,String>>();
  734. String sql = "select default_phone,receive_phone,all_phone from msg_user_phone where user_id = ?";
  735. log.info("sql==============="+sql);
  736. try {
  737. list = template.getSerachResult(sql, user_id);
  738. if(list.size()>0){
  739. json.append("{");
  740. json.append("\"default_phone\":\""+list.get(0).get("DEFAULT_PHONE")+"\",");
  741. json.append("\"receive_phone\":\""+list.get(0).get("RECEIVE_PHONE")+"\",");
  742. json.append("\"all_phone\":\""+list.get(0).get("ALL_PHONE")+"\"");
  743. json.append("}");
  744. }
  745. } catch (Exception e) {
  746. e.printStackTrace();
  747. }
  748. String result = json.toString();
  749. log.info("result======="+result);
  750. return result;
  751. }
  752. public String getDeptId(String user_id) {
  753. ORGTemplate template = new ORGTemplate();
  754. ArrayList<Map<String,String>> list = new ArrayList<Map<String,String>>();
  755. String sql ="select a.dept_id,b.corp_name from sys_user_info a,sys_department b where user_id =? and a.dept_id = b.dept_id";
  756. try {
  757. list = template.getSerachResult(sql, user_id);
  758. } catch (Exception e) {
  759. e.printStackTrace();
  760. }
  761. return "{"
  762. + "\"dept_id\":\""+list.get(0).get("DEPT_ID")+"\","
  763. + "\"corp_name\":\""+list.get(0).get("CORP_NAME")+"\""
  764. + "}";
  765. }
  766. public String getDataByTaskId(String task_id) {
  767. ORGTemplate template = new ORGTemplate();
  768. StringBuffer json = new StringBuffer();
  769. ArrayList<Map<String,String>> list = null;
  770. ArrayList<Map<String,String>> success = null;
  771. ArrayList<Map<String,String>> failure = null;
  772. String sql ="select distinct a.fd_objectid,a.task_name,a.module,a.submodule,a.is_emergency,a.event_id, a.send_type,c.real_name,a.recorder_org,a.send_time,a.msg_content"
  773. + " from msg_send_info a,msg_send_detail b ,sys_user_info c"
  774. + " where a.fd_objectid = b.info_id and a.recorder_id=c.user_id and a.fd_objectid =? "
  775. + " order by a.send_time desc";
  776. String sql1 = "select a.fd_objectId "
  777. + " from msg_send_detail a,msg_send_info b "
  778. + " where a.send_result <>'发送失败' "
  779. + " and b.fd_objectid=?"
  780. + " and b.fd_objectid = a.info_id";
  781. String sql2 = "select a.fd_objectId "
  782. + " from msg_send_detail a,msg_send_info b "
  783. + " where a.send_result ='发送失败' "
  784. + " and b.fd_objectid=?"
  785. + " and b.fd_objectid = a.info_id";
  786. log.info("sql==============="+sql);
  787. log.info("sql1=============="+sql1);
  788. log.info("sql2=============="+sql2);
  789. try {
  790. list = template.getSerachResult(sql, task_id);
  791. success = template.getSerachResult(sql1, task_id);
  792. failure = template.getSerachResult(sql2, task_id);
  793. String send_result =(success.size())+"/"+(success.size()+failure.size());
  794. if(list.size()>0){
  795. json.append("{");
  796. json.append("\"task_name\":\""+list.get(0).get("TASK_NAME").replaceAll("\"", "引号").replaceAll("\\\\", "斜杠")+"\",");
  797. json.append("\"module\":\""+list.get(0).get("MODULE")+"\",");
  798. json.append("\"submodule\":\""+list.get(0).get("SUBMODULE")+"\",");
  799. String is_emergency = list.get(0).get("IS_EMERGENCY");
  800. if("突发事件任务短信".equals(is_emergency)){
  801. is_emergency="是";
  802. }else{
  803. is_emergency="否";
  804. }
  805. json.append("\"is_emergency\":\""+is_emergency+"\",");
  806. json.append("\"event_name\":\""+list.get(0).get("EVENT_ID")+"\",");
  807. json.append("\"send_type\":\""+list.get(0).get("SEND_TYPE")+"\",");
  808. json.append("\"send_result\":\""+send_result+"\",");
  809. json.append("\"recorder_name\":\""+list.get(0).get("REAL_NAME")+"\",");
  810. json.append("\"recorder_org\":\""+list.get(0).get("RECORDER_ORG")+"\",");
  811. json.append("\"send_time\":\""+list.get(0).get("SEND_TIME")+"\",");
  812. json.append("\"msg_content\":\""+list.get(0).get("MSG_CONTENT").replaceAll("\n","<br>").replaceAll("\"", "引号").replaceAll("\\\\", "斜杠").replaceAll(" ", "&nbsp;")+"\"");
  813. json.append("}");
  814. }
  815. } catch (Exception e) {
  816. e.printStackTrace();
  817. }
  818. return json.toString();
  819. }
  820. public String getDetailByTaskId(String task_id) {
  821. ORGTemplate template = new ORGTemplate();
  822. ArrayList<Map<String,String>> list = new ArrayList<Map<String,String>>();
  823. StringBuffer json = new StringBuffer();
  824. String sql ="select a.fd_objectId,a.receiver_org,a.receiver_name,a.receiver_phone,a.receive_time,a.send_result,b.event_id,b.module from msg_send_detail a,msg_send_info b "
  825. + " where a.info_id = b.fd_objectId and a.info_id = ?"
  826. + " order by a.receive_time desc,b.event_id desc,b.module ";
  827. log.info("sql==========="+sql);
  828. try {
  829. list = template.getSerachResult(sql, task_id);
  830. for(int i=0;i<list.size();i++){
  831. json.append("{");
  832. json.append("\"fd_objectId\":\""+list.get(i).get("FD_OBJECTID")+"\",");
  833. json.append("\"receiver_org\":\""+list.get(i).get("RECEIVER_ORG")+"\",");
  834. json.append("\"receiver_name\":\""+list.get(i).get("RECEIVER_NAME")+"\",");
  835. json.append("\"receiver_phone\":\""+list.get(i).get("RECEIVER_PHONE")+"\",");
  836. json.append("\"receive_time\":\""+list.get(i).get("RECEIVE_TIME")+"\",");
  837. json.append("\"send_result\":\""+list.get(i).get("SEND_RESULT")+"\"");
  838. json.append("},");
  839. }
  840. if(list.size()>0){
  841. json.deleteCharAt(json.lastIndexOf(","));
  842. }
  843. } catch (Exception e) {
  844. e.printStackTrace();
  845. }
  846. String result ="{\"rows\":["+json.toString()+"]}";
  847. return result;
  848. }
  849. public String resend(String fd_objectId) {
  850. ORGTemplate template = new ORGTemplate();
  851. /*
  852. * 获取短信的相关信息
  853. */
  854. ArrayList<Map<String,String>> list = new ArrayList<Map<String,String>>();
  855. String getMsgInfo = "select a.*,b.msg_content from msg_send_detail a,msg_send_info b where a.fd_objectId = ? and a.info_id = b.fd_objectId";
  856. log.info("获取本条短信明细sql====getMsgInfo==="+getMsgInfo);
  857. try {
  858. list = template.getSerachResult(getMsgInfo, fd_objectId);
  859. } catch (Exception e) {
  860. e.printStackTrace();
  861. }
  862. String msg_content = list.get(0).get("MSG_CONTENT");
  863. String receive_phone = list.get(0).get("RECEIVER_PHONE");
  864. /*
  865. * 重新发送短信
  866. */
  867. MsgDao md = new MsgDao();
  868. boolean flag = md.sendShortMessage(msg_content,receive_phone,fd_objectId);
  869. int result = 0;
  870. if(flag==true){
  871. String sql ="update msg_send_detail set send_result = '重新发送成功' where fd_objectId =?";
  872. log.info("sql=========="+sql);
  873. try {
  874. result = template.update(sql, fd_objectId);
  875. } catch (Exception e) {
  876. e.printStackTrace();
  877. }
  878. }
  879. return String.valueOf(result);
  880. }
  881. public String getReceivePhone(String user_id) {
  882. ORGTemplate template = new ORGTemplate();
  883. String sql = "select receive_phone from msg_user_phone where user_id =?";
  884. log.info("getReceivePhone sql=============================="+sql);
  885. List<String> list = null;
  886. try {
  887. list=template.getResultList(sql, user_id);
  888. } catch (Exception e) {
  889. // TODO: handle exception
  890. }
  891. if(list.size()>0){
  892. return list.get(0);
  893. }else{
  894. return "";
  895. }
  896. }
  897. public String getRole(String user_id) {
  898. ORGTemplate template = new ORGTemplate();
  899. ArrayList<Map<String,String>> list =new ArrayList<Map<String,String>>();
  900. String sql = "select role_id from sys_user_role_rel where user_id =?";
  901. log.info("getRole sql=================="+sql);
  902. try {
  903. list = template.getSerachResult(sql, user_id);
  904. } catch (Exception e) {
  905. e.printStackTrace();
  906. }
  907. String role_id = "";
  908. for(int i=0;i<list.size();i++){
  909. role_id += list.get(i).get("ROLE_ID")+",";
  910. }
  911. if(list.size()>0){
  912. role_id = role_id.substring(0, role_id.length()-1);
  913. }
  914. String result ="{\"role_id\":\""+role_id+"\"}";
  915. return result;
  916. }
  917. public String saveRolePhone(String user_id, String receive_phone) {
  918. ORGTemplate template = new ORGTemplate();
  919. int flag1 = 0;
  920. int flag2 = 0;
  921. String result = "";
  922. String sql1 = "update sys_user_info set mobile = ? where user_id = ?";
  923. String sql2 = "update msg_user_phone set default_phone =?,receive_phone=? where user_id =?";
  924. log.info("sql1==================="+sql1);
  925. log.info("sql2==================="+sql2);
  926. try {
  927. flag1 = template.update(sql1, receive_phone.split(",")[0],user_id);
  928. flag2 = template.update(sql2, receive_phone.split(",")[0],receive_phone,user_id);
  929. log.info("flag1========================="+flag1);
  930. log.info("flag2========================="+flag2);
  931. } catch (Exception e) {
  932. e.printStackTrace();
  933. }
  934. if(flag1>0&&flag2>0){
  935. result = "success";
  936. }
  937. log.info("result====================="+result);
  938. return result;
  939. }
  940. }