Commit 12c80e4554ce9c49b10159327bcfffe3177ed9b3

Authored by liquanyu
1 parent 3784d165da

update code

Showing 12 changed files with 643 additions and 47 deletions

platform-common/src/main/java/com/lyms/platform/common/utils/HttpClientUtil.java View file @ 12c80e4
... ... @@ -6,14 +6,19 @@
6 6  
7 7 import org.apache.http.HttpEntity;
8 8 import org.apache.http.HttpResponse;
  9 +import org.apache.http.HttpStatus;
9 10 import org.apache.http.NameValuePair;
10 11 import org.apache.http.client.HttpClient;
  12 +import org.apache.http.client.config.RequestConfig;
11 13 import org.apache.http.client.entity.UrlEncodedFormEntity;
12 14 import org.apache.http.client.methods.HttpGet;
13 15 import org.apache.http.client.methods.HttpPost;
  16 +import org.apache.http.entity.StringEntity;
  17 +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
14 18 import org.apache.http.message.BasicNameValuePair;
15 19 import org.apache.http.util.EntityUtils;
16 20  
  21 +import java.io.IOException;
17 22 import java.util.*;
18 23 import java.util.Map.Entry;
19 24  
... ... @@ -22,6 +27,30 @@
22 27 */
23 28 public class HttpClientUtil {
24 29  
  30 + private static PoolingHttpClientConnectionManager connMgr;
  31 + private static RequestConfig requestConfig;
  32 + private static final int MAX_TIMEOUT = 7000;
  33 +
  34 + static {
  35 + // 设置连接池
  36 + connMgr = new PoolingHttpClientConnectionManager();
  37 + // 设置连接池大小
  38 + connMgr.setMaxTotal(10);
  39 + connMgr.setDefaultMaxPerRoute(connMgr.getMaxTotal());
  40 +
  41 + RequestConfig.Builder configBuilder = RequestConfig.custom();
  42 + // 设置连接超时
  43 + configBuilder.setConnectTimeout(MAX_TIMEOUT);
  44 + // 设置读取超时
  45 + configBuilder.setSocketTimeout(MAX_TIMEOUT);
  46 + // 设置从连接池获取连接实例的超时
  47 + configBuilder.setConnectionRequestTimeout(MAX_TIMEOUT);
  48 + // 在提交请求之前 测试连接是否可用
  49 + configBuilder.setStaleConnectionCheckEnabled(true);
  50 + requestConfig = configBuilder.build();
  51 + }
  52 +
  53 +
25 54 public static String doPost(String url,Map<String,String> map,String charset){
26 55 HttpClient httpClient = null;
27 56 HttpPost httpPost = null;
... ... @@ -62,6 +91,10 @@
62 91 while(keys.hasNext()){
63 92 String key = keys.next();
64 93 String value = params.get(key);
  94 + if (!StringUtils.isNotEmpty(value))
  95 + {
  96 + continue;
  97 + }
65 98 if(sb.length()==0)sb.append("?");
66 99 else sb.append("&");
67 100 sb.append(key+"="+value);
... ... @@ -77,6 +110,13 @@
77 110 httpGet.addHeader("Authorization", authorization);
78 111 HttpResponse response = httpClient.execute(httpGet);
79 112 if(response != null){
  113 +
  114 + int statusCode = response.getStatusLine().getStatusCode();
  115 + System.out.println("return code = "+ HttpStatus.SC_OK);
  116 + if (statusCode != HttpStatus.SC_OK) {
  117 + return null;
  118 + }
  119 +
80 120 HttpEntity resEntity = response.getEntity();
81 121 if(resEntity != null){
82 122 result = EntityUtils.toString(resEntity,charset);
83 123  
... ... @@ -88,16 +128,49 @@
88 128 return result;
89 129 }
90 130  
91   - public static void main(String[] args) throws Exception {
92 131  
93   - Map<String,String> map = new HashMap<String, String>();
94   - map.put("vcCardNo","C40064690");
95   - map.put("sortType","1");
96   - long start = System.currentTimeMillis();
97   - String s = doGet("https://area-qhd-api.healthbaby.com.cn:18019/getLisAndRisData", map, "utf-8","luc805966f6591ff8a51e5186cfee32e58e");
98   - long end = System.currentTimeMillis();
99   - System.out.print(end -start);
100   - System.out.println(s);
  132 + /**
  133 + * 发送 SSL POST 请求(HTTPS),JSON形式
  134 + * @param apiUrl API接口URL
  135 + * @param json JSON对象
  136 + * @return
  137 + */
  138 + public static String doPostSSL(String apiUrl, Object json) {
  139 + HttpClient httpClient = null;
  140 + HttpPost httpPost = new HttpPost(apiUrl);
  141 + HttpResponse response = null;
  142 + String httpStr = null;
  143 +
  144 + try {
  145 + httpClient = new SSLClient();
  146 + httpPost.setConfig(requestConfig);
  147 + StringEntity stringEntity = new StringEntity(json.toString(),"UTF-8");//解决中文乱码问题
  148 + stringEntity.setContentEncoding("UTF-8");
  149 + stringEntity.setContentType("application/json");
  150 + httpPost.setEntity(stringEntity);
  151 + response = httpClient.execute(httpPost);
  152 + int statusCode = response.getStatusLine().getStatusCode();
  153 + System.out.println("return code = "+ HttpStatus.SC_OK);
  154 + if (statusCode != HttpStatus.SC_OK) {
  155 + return null;
  156 + }
  157 + HttpEntity entity = response.getEntity();
  158 + if (entity == null) {
  159 + return null;
  160 + }
  161 + httpStr = EntityUtils.toString(entity, "utf-8");
  162 + } catch (Exception e) {
  163 + e.printStackTrace();
  164 + } finally {
  165 + if (response != null) {
  166 + try {
  167 + EntityUtils.consume(response.getEntity());
  168 + } catch (IOException e) {
  169 + e.printStackTrace();
  170 + }
  171 + }
  172 + }
  173 + return httpStr;
101 174 }
102 175 }
platform-msg-generate/src/main/java/com/lyms/platform/msg/remote/SaveMessageService.java View file @ 12c80e4
1 1 package com.lyms.platform.msg.remote;
2 2  
3 3 import com.lyms.platform.beans.MessageListRequest;
  4 +import com.lyms.platform.beans.MessageRequest;
  5 +import com.lyms.platform.common.enums.MsgStatusEnums;
4 6 import com.lyms.platform.common.enums.ProjectTypeEnums;
  7 +import com.lyms.platform.common.enums.SmsTimeTypeEnums;
  8 +import com.lyms.platform.common.utils.HttpClientUtil;
5 9 import com.lyms.platform.common.utils.HttpRequest;
6 10 import com.lyms.platform.common.utils.JsonUtil;
7 11 import com.lyms.platform.common.utils.StringUtils;
8 12 import com.lyms.platform.msg.constants.ConfigInterface;
  13 +import com.lyms.platform.msg.utils.DateUtils;
9 14 import net.sf.json.JSONArray;
10 15 import net.sf.json.JSONObject;
  16 +import org.apache.commons.httpclient.HttpClient;
11 17  
12   -import java.util.Map;
  18 +import java.util.*;
13 19  
14 20 /**
15 21 * Created by Administrator on 2016/7/5.
16 22  
... ... @@ -25,11 +31,11 @@
25 31 public static boolean saveMsgCenter(MessageListRequest list)
26 32 {
27 33 String json = JsonUtil.obj2JsonString(list);
28   - String result = HttpRequest.sendPost(ConfigInterface.CENTER_BASE_URL+"saveCreatedSMS",json,ConfigInterface.CENTER_TOKEN);
  34 + String result = HttpClientUtil.doPostSSL(ConfigInterface.CENTER_BASE_URL+"/biz-push-web/push",json);
29 35 if (StringUtils.isNotEmpty(result))
30 36 {
31 37 Map<String,String> map = JsonUtil.str2Obj(result, Map.class);
32   - if ("0".equals(map.get("errorcode")))
  38 + if ("0".equals(String.valueOf(map.get("errorcode"))))
33 39 {
34 40 return true;
35 41 }
36 42  
37 43  
... ... @@ -47,15 +53,18 @@
47 53 public static boolean isExistMsg(String patientId,String tempId)
48 54 {
49 55  
50   - String param = "typeId="+ ProjectTypeEnums.YNXT.getId()+"&ext2="+StringUtils.emptyStr(tempId)+"&ext3="+StringUtils.emptyStr(patientId)+"&page=1&limit=10";
51   - String result = HttpRequest.sendGet(ConfigInterface.CENTER_BASE_URL + "messages", param, ConfigInterface.CENTER_TOKEN);
52   -
  56 + Map<String,String> param = new HashMap<>();
  57 + param.put("page","1");
  58 + param.put("limit","10");
  59 + param.put("patientId",patientId);
  60 + param.put("tempId",tempId);
  61 + String result = HttpClientUtil.doGet(ConfigInterface.CENTER_BASE_URL + "/biz-push-web/push", param,"utf-8",null);
53 62 JSONObject jsonObject = JsonUtil.getObj(result);
54   - if (jsonObject != null && jsonObject.getJSONArray("list") != null)
  63 + if (jsonObject != null && jsonObject.getJSONObject("pageInfo") != null)
55 64 {
56   - JSONArray jsonArray = jsonObject.getJSONArray("list");
57   - String list = jsonArray.toString();
58   - if (StringUtils.isNotEmpty(list) && !"[]".equals(list))
  65 + JSONObject jsonObject1 = jsonObject.getJSONObject("pageInfo");
  66 + int count = jsonObject1.getInt("count");
  67 + if (count > 0)
59 68 {
60 69 return true;
61 70 }
... ... @@ -65,6 +74,45 @@
65 74  
66 75 public static void main(String[] areg)
67 76 {
  77 +// MessageListRequest list = new MessageListRequest();
  78 +//
  79 +//
  80 +// List<MessageRequest> messages = new ArrayList<>();
  81 +//
  82 +//
  83 +// MessageRequest request = new MessageRequest();
  84 +// //平台ID
  85 +// request.setTypeId(ProjectTypeEnums.YNXT.getId());
  86 +// //服务对象 1孕妇 2儿童 3产妇
  87 +// request.setObjType(1);
  88 +// request.setPhone("154568526845");
  89 +// //计划发送时间
  90 +// request.setPlanTime(DateUtils.getDateStr(new Date(), DateUtils.Y_M_D) + " " + ConfigInterface.SEND_TIME +":00");
  91 +//
  92 +// request.setSubTypeId(1);
  93 +// request.setStatus(MsgStatusEnums.NO_SEND.getId());
  94 +// request.setTimeType(SmsTimeTypeEnums.NO_ONTIME.getId());
  95 +// request.setHospitalId("1");
  96 +// request.setPatientId("2");
  97 +// request.setTempId("2");
  98 +// request.setWxTempId("bbb");
  99 +// request.setCreated(DateUtils.getDateStr(new Date(), DateUtils.Y_M_D_H_M_S));
  100 +//
  101 +// request.setFirst("aaa");
  102 +// request.setKeyword1("bbb");
  103 +// request.setKeyword2("cc");
  104 +// request.setRemark("ddd");
  105 +//
  106 +//
  107 +// messages.add(request);
  108 +//
  109 +// list.setMessages(messages);
  110 +// list.setTypeId(ProjectTypeEnums.YNXT.getId());
  111 +//
  112 +// saveMsgCenter( list);
  113 +
  114 +
  115 + isExistMsg("2","2");
68 116 }
69 117 }
platform-msg-generate/src/main/resources/config.properties View file @ 12c80e4
1   -#短信中心url
  1 +#消息中心url
2 2 #center_base_url=http://sms.healthbaby.com.cn/v1/
3   -center_base_url=http://sms.api.stage.platform.healthbaby.com.cn/v1/
  3 +center_base_url=https://push.stage.platform.healthbaby.com.cn
4 4  
5 5 #区域平台访问短信中心的token
6 6 center_token=e0c56363-00d6-42ee-bbe0-23c553583062
platform-msg-generate/src/main/resources/spring/applicationContext.xml View file @ 12c80e4
... ... @@ -41,6 +41,6 @@
41 41  
42 42 <import resource="classpath:/spring/applicationContext_biz_patient.xml"/>
43 43 <import resource="classpath:/spring/applicationContext-dal.xml"/>
44   - <import resource="classpath:/spring/applicationContext-quartz.xml"/>
  44 + <!--<import resource="classpath:/spring/applicationContext-quartz.xml"/>-->
45 45 </beans>
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AreaCountController.java View file @ 12c80e4
... ... @@ -24,9 +24,6 @@
24 24 @Autowired
25 25 private AreaCountFacade areaCountFacade;
26 26  
27   - /**=============================================***/
28   -
29   -
30 27 /**
31 28 * 产检节点统计
32 29 * @param request
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SmsConfigController.java View file @ 12c80e4
... ... @@ -196,7 +196,20 @@
196 196 }
197 197  
198 198  
199   -
  199 + /**
  200 + * 查询短信列表
  201 + * @param hospitalName
  202 + * @param phone
  203 + * @param smsType
  204 + * @param smsStatus
  205 + * @param objType
  206 + * @param content
  207 + * @param planTime
  208 + * @param actualTime
  209 + * @param page
  210 + * @param limit
  211 + * @return
  212 + */
200 213 @RequestMapping(value = "/querySmsList", method = RequestMethod.GET)
201 214 @ResponseBody
202 215 public BaseResponse querySmsList(@RequestParam(required = false) String hospitalName,
203 216  
204 217  
205 218  
206 219  
... ... @@ -223,19 +236,71 @@
223 236 * @param content
224 237 * @param planTime
225 238 * @param actualTime
226   -
227 239 */
228 240 @RequestMapping(value = "/exportSmsList", method = RequestMethod.GET)
229 241 public void exportSmsList(HttpServletResponse httpServletResponse,@RequestParam(required = false) String hospitalName,
  242 + @RequestParam(required = false) String phone,
  243 + @RequestParam(required = false) Integer smsType,
  244 + @RequestParam(required = false) Integer smsStatus,
  245 + @RequestParam(required = false) Integer objType,
  246 + @RequestParam(required = false) String content,
  247 + @RequestParam(required = false) String planTime,
  248 + @RequestParam(required = false) String actualTime) {
  249 + smsConfigFacade.exportSmsList(hospitalName, phone, smsType, smsStatus, content, planTime, actualTime, objType, httpServletResponse);
  250 + }
  251 +
  252 +
  253 + /**
  254 + * 查询推送消息列表
  255 + * @param hospitalId
  256 + * @param phone
  257 + * @param smsType
  258 + * @param smsStatus
  259 + * @param objType
  260 + * @param planTime
  261 + * @param actualTime
  262 + * @param page
  263 + * @param limit
  264 + * @return
  265 + */
  266 + @RequestMapping(value = "/queryMsgList", method = RequestMethod.GET)
  267 + @ResponseBody
  268 + public BaseResponse queryMsgList(@RequestParam(required = false) String hospitalId,
230 269 @RequestParam(required = false) String phone,
231 270 @RequestParam(required = false) Integer smsType,
232 271 @RequestParam(required = false) Integer smsStatus,
233 272 @RequestParam(required = false) Integer objType,
234   - @RequestParam(required = false) String content,
235 273 @RequestParam(required = false) String planTime,
236   - @RequestParam(required = false) String actualTime) {
237   - smsConfigFacade.exportSmsList(hospitalName, phone, smsType, smsStatus, content, planTime, actualTime, objType, httpServletResponse);
  274 + @RequestParam(required = false) String actualTime,
  275 + @RequestParam(required = false) Integer page,
  276 + @RequestParam(required = false) Integer limit) {
  277 + return smsConfigFacade.queryMsgList(hospitalId, phone, smsType, smsStatus, planTime, actualTime, objType, page, limit);
238 278 }
  279 +
  280 +
  281 + /**
  282 + * 导出推送
  283 + * @param hospitalId
  284 + * @param phone
  285 + * @param smsType
  286 + * @param smsStatus
  287 + * @param objType
  288 + * @param planTime
  289 + * @param actualTime
  290 + */
  291 + @RequestMapping(value = "/exportMsgList", method = RequestMethod.GET)
  292 + public void exportMsgList(HttpServletResponse httpServletResponse,@RequestParam(required = false) String hospitalId,
  293 + @RequestParam(required = false) String phone,
  294 + @RequestParam(required = false) Integer smsType,
  295 + @RequestParam(required = false) Integer smsStatus,
  296 + @RequestParam(required = false) Integer objType,
  297 + @RequestParam(required = false) String planTime,
  298 + @RequestParam(required = false) String actualTime) {
  299 + smsConfigFacade.exportMsgList(hospitalId, phone, smsType, smsStatus, planTime, actualTime, objType, httpServletResponse);
  300 + }
  301 +
  302 +
  303 +
239 304  
240 305  
241 306  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AreaCountFacade.java View file @ 12c80e4
... ... @@ -6,7 +6,6 @@
6 6 import com.lyms.platform.biz.service.DataPermissionService;
7 7 import com.lyms.platform.biz.service.PatientsService;
8 8 import com.lyms.platform.common.constants.ErrorCodeConstants;
9   -import com.lyms.platform.common.dao.operator.MongoQuery;
10 9 import com.lyms.platform.common.enums.YnEnums;
11 10 import com.lyms.platform.common.result.BaseListResponse;
12 11 import com.lyms.platform.common.result.BaseObjectResponse;
13 12  
14 13  
15 14  
16 15  
17 16  
... ... @@ -15,31 +14,23 @@
15 14 import com.lyms.platform.common.utils.StringUtils;
16 15 import com.lyms.platform.operate.web.utils.CommonsHelper;
17 16 import com.lyms.platform.operate.web.utils.FunvCommonUtil;
18   -import com.lyms.platform.operate.web.worker.AntExRecordWorker;
19 17 import com.lyms.platform.operate.web.worker.CheckPointCountWorker;
20 18 import com.lyms.platform.permission.model.Organization;
21 19 import com.lyms.platform.permission.model.OrganizationQuery;
22 20 import com.lyms.platform.permission.model.Users;
23   -import com.lyms.platform.permission.service.CouponService;
24 21 import com.lyms.platform.permission.service.OrganizationService;
25 22 import com.lyms.platform.permission.service.UsersService;
26   -import com.lyms.platform.pojo.AntExChuModel;
27   -import com.lyms.platform.pojo.BasicConfig;
28 23 import com.lyms.platform.pojo.DataPermissionsModel;
29 24 import com.lyms.platform.pojo.Patients;
30   -import com.lyms.platform.query.AntExChuQuery;
31   -import com.lyms.platform.query.AntExQuery;
32 25 import com.lyms.platform.query.DataPermissionsModelQuery;
33 26 import com.lyms.platform.query.PatientsQuery;
34 27 import org.apache.commons.collections.CollectionUtils;
35   -import org.apache.commons.lang.*;
36 28 import org.springframework.beans.factory.annotation.Autowired;
37 29 import org.springframework.beans.factory.annotation.Qualifier;
38 30 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
39 31 import org.springframework.stereotype.Component;
40 32 import java.util.*;
41 33 import java.util.concurrent.Future;
42   -import java.util.concurrent.TimeUnit;
43 34  
44 35  
45 36 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SmsConfigFacade.java View file @ 12c80e4
... ... @@ -932,5 +932,142 @@
932 932 e.printStackTrace();
933 933 }
934 934 }
  935 +
  936 + public BaseListResponse queryMsgList(String hospitalId, String phone, Integer smsType, Integer smsStatus,
  937 + String planTime, String actualTime, Integer objType, Integer page, Integer limit) {
  938 +
  939 + String planTimeStart = "";
  940 + String planTimeEnd = "";
  941 + if (StringUtils.isNotEmpty(planTime))
  942 + {
  943 + planTimeStart = String.valueOf(DateUtil.getSecond(DateUtil.parseYMD(planTime.split(" - ")[0])) +" 00:00:00");
  944 + planTimeEnd = String.valueOf(DateUtil.getSecond(DateUtil.parseYMD(planTime.split(" - ")[1]))+" 00:00:00");
  945 + }
  946 +
  947 + String actualTimeStart = "";
  948 + String actualTimeEnd = "";
  949 + if (StringUtils.isNotEmpty(actualTime))
  950 + {
  951 +
  952 + actualTimeStart = String.valueOf(DateUtil.getSecond(DateUtil.parseYMD(actualTime.split(" - ")[0]))+" 00:00:00");
  953 + actualTimeEnd = String.valueOf(DateUtil.getSecond(DateUtil.parseYMD(actualTime.split(" - ")[1])) + " 00:00:00");
  954 + }
  955 + List<Map<String,String>> list = new ArrayList<>();
  956 +
  957 + MsgResult sms = MessageCenterService.queryMsgList(hospitalId, phone, smsType, smsStatus, planTimeStart,
  958 + planTimeEnd, actualTimeStart, actualTimeEnd, objType, page, limit);
  959 +
  960 + if (sms != null && sms.getData() != null )
  961 + {
  962 + List<MsgObj> msgObjs = sms.getData();
  963 + if (CollectionUtils.isNotEmpty(msgObjs))
  964 + {
  965 + for(MsgObj obj : msgObjs)
  966 + {
  967 + if (obj != null)
  968 + {
  969 + Map<String,String> map = new HashMap<>();
  970 + if (StringUtils.isNotEmpty(obj.getHospitalId()))
  971 + {
  972 + Organization org= organizationService.getOrganization(Integer.parseInt(obj.getHospitalId()));
  973 + if(null!=org){
  974 + map.put("hospitalName",org.getName());
  975 + }else{
  976 + map.put("hospitalName","");
  977 + }
  978 + }
  979 + else
  980 + {
  981 + map.put("hospitalName","");
  982 + }
  983 + map.put("smsType",SmsServiceEnums.getSmsServiceById(obj.getSubTypeId()));
  984 + map.put("phone",obj.getPhone());
  985 + map.put("objType",ServiceObjEnums.getServiceObjById(obj.getObjtype()));
  986 + map.put("planTime", obj.getPlanTime());
  987 + map.put("actualTime", obj.getActualTime() == null ? "" : obj.getActualTime());
  988 + map.put("timeType",SmsTimeTypeEnums.getNameById(obj.getTimeType()));
  989 + map.put("smsStatus", SmsStatusEnums.getNameById(obj.getStatus()));
  990 + map.put("first", obj.getFirst());
  991 + map.put("keyword1", obj.getKeyword1());
  992 + map.put("keyword2",obj.getKeyword2());
  993 + map.put("remark", obj.getRemark());
  994 + list.add(map);
  995 + }
  996 + }
  997 + }
  998 + }
  999 +
  1000 + BaseListResponse objectResponse = new BaseListResponse();
  1001 + objectResponse.setData(list);
  1002 + objectResponse.setPageInfo(sms == null ? new PageInfo() : sms.getPageInfo());
  1003 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  1004 + objectResponse.setErrormsg("成功");
  1005 + return objectResponse;
  1006 + }
  1007 +
  1008 +
  1009 + /**
  1010 + * 导出推送列表
  1011 + *
  1012 + * @param hospitalId 医院id
  1013 + * @param phone 手机号码
  1014 + * @param smsType 短信类型
  1015 + * @param smsStatus 短信状态
  1016 + * @param planTime 计划发送时间
  1017 + * @param actualTime 实际发送时间
  1018 + * @param objType 发送短信
  1019 + * @param httpServletResponse
  1020 + */
  1021 + public void exportMsgList(String hospitalId, String phone, Integer smsType, Integer smsStatus, String planTime, String actualTime, Integer objType,HttpServletResponse httpServletResponse) {
  1022 +
  1023 + try
  1024 + {
  1025 + BaseListResponse list = queryMsgList(hospitalId, phone, smsType, smsStatus, planTime, actualTime, objType, 1, 999999999);
  1026 + List<Map<String, Object>> datas = new ArrayList<>();
  1027 + List<Map<String,String>> results = list.getData();
  1028 +
  1029 + if (CollectionUtils.isNotEmpty(results))
  1030 + {
  1031 + for(Map<String,String> map : results)
  1032 + {
  1033 + Map<String, Object> data = new HashMap<>();
  1034 + data.put("hospitalName",map.get("hospitalName"));
  1035 + data.put("objType",map.get("objType"));
  1036 + data.put("smsType",map.get("smsType"));
  1037 + data.put("phone",map.get("phone"));
  1038 + data.put("planTime",map.get("planTime"));
  1039 + data.put("actualTime",map.get("actualTime"));
  1040 + data.put("smsStatus",map.get("smsStatus"));
  1041 + data.put("timeType",map.get("timeType"));
  1042 + map.put("first", map.get("first"));
  1043 + map.put("keyword1", map.get("keyword1"));
  1044 + map.put("keyword2",map.get("keyword2"));
  1045 + map.put("remark", map.get("remark"));
  1046 + datas.add(data);
  1047 + }
  1048 + }
  1049 +
  1050 + OutputStream out = httpServletResponse.getOutputStream();
  1051 + Map<String, String> cnames = new LinkedHashMap<>();
  1052 + cnames.put("hospitalName", "医院");
  1053 + cnames.put("objType", "发送对象");
  1054 + cnames.put("smsType", "短信类型");
  1055 + cnames.put("phone", "电话号码");
  1056 + cnames.put("first", "推送内容");
  1057 + cnames.put("keyword1","推送标题");
  1058 + cnames.put("keyword2","推送时间");
  1059 + cnames.put("remark", "推送备注");
  1060 + cnames.put("planTime", "计划发送时间");
  1061 + cnames.put("actualTime", "实际发送时间");
  1062 + cnames.put("smsStatus", "状态");
  1063 + cnames.put("timeType", "是否及时");
  1064 + httpServletResponse.setContentType("application/octet-stream");
  1065 + httpServletResponse.setCharacterEncoding("UTF-8");
  1066 + httpServletResponse.setHeader("Content-Disposition", "attachment;fileName=msg.xls");
  1067 + ExcelUtil.toExcel(out, datas, cnames);
  1068 + } catch (IOException e) {
  1069 + e.printStackTrace();
  1070 + }
  1071 + }
935 1072 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/MsgObj.java View file @ 12c80e4
  1 +package com.lyms.platform.operate.web.result;
  2 +
  3 +/**
  4 + * Created by Administrator on 2017-07-24.
  5 + */
  6 +public class MsgObj {
  7 + private int id;
  8 + private String memberId;
  9 + private int typeId;
  10 + private String msgId;
  11 + private int status;
  12 + private String created;
  13 + private String planTime;
  14 + private String actualTime;
  15 + private String hospitalId;
  16 + private String patientId;
  17 + private String wxTempId;
  18 + private String tempId;
  19 + private int subTypeId;
  20 + private int timeType;
  21 + private String first;
  22 + private String keyword1;
  23 + private String keyword2;
  24 + private int objtype;
  25 + private String phone;
  26 + private String remark;
  27 +
  28 + public int getId() {
  29 + return id;
  30 + }
  31 +
  32 + public void setId(int id) {
  33 + this.id = id;
  34 + }
  35 +
  36 + public String getMemberId() {
  37 + return memberId;
  38 + }
  39 +
  40 + public void setMemberId(String memberId) {
  41 + this.memberId = memberId;
  42 + }
  43 +
  44 + public int getTypeId() {
  45 + return typeId;
  46 + }
  47 +
  48 + public void setTypeId(int typeId) {
  49 + this.typeId = typeId;
  50 + }
  51 +
  52 + public String getMsgId() {
  53 + return msgId;
  54 + }
  55 +
  56 + public void setMsgId(String msgId) {
  57 + this.msgId = msgId;
  58 + }
  59 +
  60 + public int getStatus() {
  61 + return status;
  62 + }
  63 +
  64 + public void setStatus(int status) {
  65 + this.status = status;
  66 + }
  67 +
  68 + public String getCreated() {
  69 + return created;
  70 + }
  71 +
  72 + public void setCreated(String created) {
  73 + this.created = created;
  74 + }
  75 +
  76 + public String getPlanTime() {
  77 + return planTime;
  78 + }
  79 +
  80 + public void setPlanTime(String planTime) {
  81 + this.planTime = planTime;
  82 + }
  83 +
  84 + public String getActualTime() {
  85 + return actualTime;
  86 + }
  87 +
  88 + public void setActualTime(String actualTime) {
  89 + this.actualTime = actualTime;
  90 + }
  91 +
  92 + public String getHospitalId() {
  93 + return hospitalId;
  94 + }
  95 +
  96 + public void setHospitalId(String hospitalId) {
  97 + this.hospitalId = hospitalId;
  98 + }
  99 +
  100 + public String getPatientId() {
  101 + return patientId;
  102 + }
  103 +
  104 + public void setPatientId(String patientId) {
  105 + this.patientId = patientId;
  106 + }
  107 +
  108 + public String getWxTempId() {
  109 + return wxTempId;
  110 + }
  111 +
  112 + public void setWxTempId(String wxTempId) {
  113 + this.wxTempId = wxTempId;
  114 + }
  115 +
  116 + public String getTempId() {
  117 + return tempId;
  118 + }
  119 +
  120 + public void setTempId(String tempId) {
  121 + this.tempId = tempId;
  122 + }
  123 +
  124 + public int getSubTypeId() {
  125 + return subTypeId;
  126 + }
  127 +
  128 + public void setSubTypeId(int subTypeId) {
  129 + this.subTypeId = subTypeId;
  130 + }
  131 +
  132 + public int getTimeType() {
  133 + return timeType;
  134 + }
  135 +
  136 + public void setTimeType(int timeType) {
  137 + this.timeType = timeType;
  138 + }
  139 +
  140 + public String getFirst() {
  141 + return first;
  142 + }
  143 +
  144 + public void setFirst(String first) {
  145 + this.first = first;
  146 + }
  147 +
  148 + public String getKeyword1() {
  149 + return keyword1;
  150 + }
  151 +
  152 + public void setKeyword1(String keyword1) {
  153 + this.keyword1 = keyword1;
  154 + }
  155 +
  156 + public String getKeyword2() {
  157 + return keyword2;
  158 + }
  159 +
  160 + public void setKeyword2(String keyword2) {
  161 + this.keyword2 = keyword2;
  162 + }
  163 +
  164 + public int getObjtype() {
  165 + return objtype;
  166 + }
  167 +
  168 + public void setObjtype(int objtype) {
  169 + this.objtype = objtype;
  170 + }
  171 +
  172 + public String getPhone() {
  173 + return phone;
  174 + }
  175 +
  176 + public void setPhone(String phone) {
  177 + this.phone = phone;
  178 + }
  179 +
  180 + public String getRemark() {
  181 + return remark;
  182 + }
  183 +
  184 + public void setRemark(String remark) {
  185 + this.remark = remark;
  186 + }
  187 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/MsgResult.java View file @ 12c80e4
  1 +package com.lyms.platform.operate.web.result;
  2 +
  3 +import com.lyms.platform.common.base.PageInfo;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * Created by Administrator on 2017-07-24.
  9 + */
  10 +public class MsgResult {
  11 +
  12 + private String errormsg;
  13 + private String errorcode;
  14 + private Object object;
  15 +
  16 + private PageInfo pageInfo;
  17 +
  18 + private List<MsgObj> data;
  19 +
  20 + public String getErrormsg() {
  21 + return errormsg;
  22 + }
  23 +
  24 + public void setErrormsg(String errormsg) {
  25 + this.errormsg = errormsg;
  26 + }
  27 +
  28 + public String getErrorcode() {
  29 + return errorcode;
  30 + }
  31 +
  32 + public void setErrorcode(String errorcode) {
  33 + this.errorcode = errorcode;
  34 + }
  35 +
  36 + public PageInfo getPageInfo() {
  37 + return pageInfo;
  38 + }
  39 +
  40 + public void setPageInfo(PageInfo pageInfo) {
  41 + this.pageInfo = pageInfo;
  42 + }
  43 +
  44 + public List<MsgObj> getData() {
  45 + return data;
  46 + }
  47 +
  48 + public void setData(List<MsgObj> data) {
  49 + this.data = data;
  50 + }
  51 +
  52 + public Object getObject() {
  53 + return object;
  54 + }
  55 +
  56 + public void setObject(Object object) {
  57 + this.object = object;
  58 + }
  59 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MessageCenterService.java View file @ 12c80e4
... ... @@ -4,16 +4,17 @@
4 4 import com.lyms.platform.common.enums.ProjectTypeEnums;
5 5 import com.lyms.platform.common.enums.SmsStatusEnums;
6 6 import com.lyms.platform.common.utils.*;
  7 +import com.lyms.platform.common.utils.HttpClientUtil;
7 8 import com.lyms.platform.operate.web.request.MessageListRequest;
8 9 import com.lyms.platform.operate.web.request.MessageRequest;
  10 +import com.lyms.platform.operate.web.result.*;
9 11 import com.lyms.platform.operate.web.result.Config;
10   -import com.lyms.platform.operate.web.result.SmsObj;
11   -import com.lyms.platform.operate.web.result.SmsResult;
12 12 import net.sf.json.JSONArray;
13 13 import net.sf.json.JSONObject;
14 14 import org.apache.commons.collections.CollectionUtils;
15 15  
16 16 import java.util.ArrayList;
  17 +import java.util.HashMap;
17 18 import java.util.List;
18 19 import java.util.Map;
19 20  
20 21  
... ... @@ -173,9 +174,47 @@
173 174 return map;
174 175 }
175 176  
  177 +
  178 + public static MsgResult queryMsgList(String hospitalId, String phone,Integer smsType,
  179 + Integer smsStatus,String planTimeStart,
  180 + String planTimeEnd,String actualTimeStart,
  181 + String actualTimeEnd,Integer objType ,
  182 + Integer page, Integer limit)
  183 + {
  184 + Map<String,String> param = new HashMap<>();
  185 + param.put("page",page == null ? null : String.valueOf(page));
  186 + param.put("limit",limit == null ? null : String.valueOf(limit));
  187 + param.put("hospitalId",hospitalId);
  188 + param.put("phone",phone);
  189 + param.put("subTypeId",smsType == null ? null : String.valueOf(smsType));
  190 + param.put("status",smsStatus == null ? null : String.valueOf(smsStatus));
  191 + param.put("planTimeStart",planTimeStart);
  192 + param.put("planTimeEnd",planTimeEnd);
  193 + param.put("actualTimeStart",actualTimeStart);
  194 + param.put("actualTimeEnd",actualTimeEnd);
  195 + param.put("objType",objType == null ? null : String.valueOf(objType));
  196 + String result = HttpClientUtil.doGet("https://push.stage.platform.healthbaby.com.cn/biz-push-web/push", param, "utf-8", null);
  197 + if (result != null)
  198 + {
  199 + MsgResult map = JsonUtil.str2Obj(result, MsgResult.class);
  200 +
  201 + JSONObject jsonObject = JsonUtil.getObj(result);
  202 + if (jsonObject != null && jsonObject.getJSONArray("data") != null)
  203 + {
  204 + JSONArray jsonArray = jsonObject.getJSONArray("data");
  205 + String list = jsonArray.toString();
  206 + map.setData(JsonUtil.toList(list, MsgObj.class));
  207 + }
  208 +
  209 + return map;
  210 + }
  211 +
  212 + return null;
  213 + }
  214 +
176 215 public static void main(String[] args){
177 216 // String param = "phone=&page=1&limit=100&typeId=4&ext1=196";
178   -//
  217 +//d
179 218 // MessageListRequest list = new MessageListRequest();
180 219 // List<MessageRequest> messages = new ArrayList<>();
181 220 // MessageRequest request = new MessageRequest();
... ... @@ -210,7 +249,11 @@
210 249 // map.setList(JsonUtil.toList(list, SmsObj.class));
211 250 // System.out.print(map);
212 251  
213   -
  252 + queryMsgList("1", null,null,
  253 + null,null,
  254 + null,null,
  255 + null,null ,
  256 + 1,10);
214 257  
215 258 }
216 259 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/CheckWeeksNumWorker.java View file @ 12c80e4
... ... @@ -43,9 +43,6 @@
43 43 @Override
44 44 public Map<String,Integer> call() throws Exception {
45 45 Map<String,Integer> map = new HashMap<>();
46   -
47   - long start = System.currentTimeMillis();
48   -
49 46 if (week == 0)
50 47 {
51 48 int itemnum12 = antenatalExaminationService.queryWeekPointCount(0, 12, hospitalId, startTime, endTime, pointType);
... ... @@ -71,7 +68,6 @@
71 68 int itemnum40 = antenatalExaminationService.queryWeekPointCount(37, 40, hospitalId, startTime,endTime, pointType);
72 69 map.put("itemnum40",itemnum40);
73 70 }
74   - System.out.println(week+"==="+hospitalId+"---------"+ (System.currentTimeMillis()-start));
75 71 return map;
76 72 }
77 73 }