Commit 848e05755b509a10c0b80d23a60346ee255839e0

Authored by liquanyu
1 parent 5aab33005f

update code

Showing 2 changed files with 17 additions and 35 deletions

platform-msg-generate/src/main/java/com/lyms/platform/msg/remote/SaveMessageService.java View file @ 848e057
... ... @@ -11,7 +11,6 @@
11 11 import com.lyms.platform.common.utils.StringUtils;
12 12 import com.lyms.platform.msg.constants.ConfigInterface;
13 13 import com.lyms.platform.msg.utils.DateUtils;
14   -import com.lyms.platform.msg.utils.HttpsClientManager;
15 14 import net.sf.json.JSONArray;
16 15 import net.sf.json.JSONObject;
17 16 import org.apache.commons.httpclient.HttpClient;
18 17  
... ... @@ -27,15 +26,8 @@
27 26 */
28 27 public class SaveMessageService {
29 28  
30   - private static final Logger logger = LoggerFactory.getLogger(SaveMessageService.class);
  29 + private static final Logger resultLog = LoggerFactory.getLogger("GEN-RESULT");
31 30  
32   - private static HttpsClientManager https =new HttpsClientManager();
33   - {
34   - https.setConnTimeout(10000);
35   - https.setSoTimeout(120000);
36   - https.setMaxConnectionsPerHost(200);
37   - https.setMaxTotalConnections(300);
38   - }
39 31  
40 32  
41 33 /**
42 34  
43 35  
... ... @@ -46,20 +38,15 @@
46 38 public static boolean saveMsgCenter(MessageListRequest list)
47 39 {
48 40 String json = JsonUtil.obj2JsonString(list);
49   - String result = null;
50   - try {
51   - result = https.doPost(ConfigInterface.MSG_BASE_URL + "/biz-push-web/push", json, null);
52   -
53   - if (StringUtils.isNotEmpty(result))
  41 + //resultLog.info(json);
  42 + String result = HttpClientUtil.doPostSSL(ConfigInterface.MSG_BASE_URL+"/biz-push-web/push",json);
  43 + if (StringUtils.isNotEmpty(result))
  44 + {
  45 + Map<String,String> map = JsonUtil.str2Obj(result, Map.class);
  46 + if ("0".equals(String.valueOf(map.get("errorcode"))))
54 47 {
55   - Map<String,String> map = JsonUtil.str2Obj(result, Map.class);
56   - if ("0".equals(String.valueOf(map.get("errorcode"))))
57   - {
58   - return true;
59   - }
  48 + return true;
60 49 }
61   - } catch (Exception e) {
62   - logger.error("save msg is error",e);
63 50 }
64 51 return false;
65 52 }
66 53  
67 54  
... ... @@ -79,21 +66,16 @@
79 66 param.put("limit","10");
80 67 param.put("patientId",patientId);
81 68 param.put("tempId",tempId);
82   - String result = null;
83   - try {
84   - result = https.doGet(ConfigInterface.MSG_BASE_URL + "/biz-push-web/push", param,null);
85   - JSONObject jsonObject = JsonUtil.getObj(result);
86   - if (jsonObject != null && jsonObject.getJSONObject("pageInfo") != null)
  69 + String result = HttpClientUtil.doGet(ConfigInterface.MSG_BASE_URL + "/biz-push-web/push", param,"utf-8",null);
  70 + JSONObject jsonObject = JsonUtil.getObj(result);
  71 + if (jsonObject != null && jsonObject.getJSONObject("pageInfo") != null)
  72 + {
  73 + JSONObject jsonObject1 = jsonObject.getJSONObject("pageInfo");
  74 + int count = jsonObject1.getInt("count");
  75 + if (count > 0)
87 76 {
88   - JSONObject jsonObject1 = jsonObject.getJSONObject("pageInfo");
89   - int count = jsonObject1.getInt("count");
90   - if (count > 0)
91   - {
92   - return true;
93   - }
  77 + return true;
94 78 }
95   - } catch (Exception e) {
96   - logger.error("get msg is exist error,url="+ConfigInterface.MSG_BASE_URL + "/biz-push-web/push",e);
97 79 }
98 80 return false;
99 81 }
platform-msg-generate/src/main/resources/spring/applicationContext-quartz.xml View file @ 848e057
... ... @@ -29,7 +29,7 @@
29 29 <bean id="schedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
30 30 <property name="triggers" >
31 31 <list>
32   - <ref bean="msgGenerateWorkTrigger"/>
  32 + <!--<ref bean="msgGenerateWorkTrigger"/>-->
33 33 </list>
34 34 </property>
35 35 </bean>