| @@ -204,13 +204,58 @@ public class JinMaoController extends BaseController { | |||||
| } | } | ||||
| @RequestMapping(value = "/dfh/testGetCode") | |||||
| public String testGetCode(HttpServletRequest request,HttpServletResponse response) throws Exception { | |||||
| String couponCode = request.getParameter("couponCode"); | |||||
| if (StringUtils.isBlank(couponCode)) { | |||||
| return "couponCode is null."; | |||||
| } | |||||
| return WxCouponOrderCVo.calcuteExpiredCouponOrderId(couponCode, 30); | |||||
| /** | |||||
| * 心跳 | |||||
| * @param request | |||||
| * @param response | |||||
| * @throws Exception | |||||
| */ | |||||
| @RequestMapping(value = "/dfh/heartBeat") | |||||
| public void heartBeat(HttpServletRequest request,HttpServletResponse response) throws Exception { | |||||
| InputStream inputStream = null; | |||||
| try { | |||||
| inputStream = request.getInputStream(); | |||||
| String paramStr = IOUtils.toString(inputStream, "utf-8"); | |||||
| logger.info("dfh heartBeat: {}",paramStr); | |||||
| if (StringUtils.isBlank(paramStr)) { | |||||
| generateResult(response,true,false, null, "参数不能为空paramStr", null, "参数非法"); | |||||
| return ; | |||||
| } | |||||
| Map param = JSON.parseObject(paramStr, Map.class); | |||||
| String keyStr = param.get("Key")==null?"":param.get("Key").toString(); | |||||
| if (StringUtils.isBlank(keyStr)) { | |||||
| generateResult(response,true,false, null, "参数非法Key"+keyStr, null, "参数非法"); | |||||
| return ; | |||||
| } | |||||
| PrintWriter out; | |||||
| try { | |||||
| Map retMap = new HashMap(); | |||||
| retMap.put("Key",keyStr); | |||||
| response.setContentType("application/json"); | |||||
| response.setCharacterEncoding("GB2312"); | |||||
| out = response.getWriter(); | |||||
| out.print("DATA="+JSON.toJSONString(retMap)); | |||||
| out.close(); | |||||
| } catch (IOException e) { | |||||
| logger.error(" jinmao writeResponse error.",e); | |||||
| } | |||||
| }catch(Exception e){ | |||||
| logger.error("JinMaoController --heartBeat",e); | |||||
| generateResult(response,true,false, null, "核销错误"+e.getMessage(), null, "核销错误"); | |||||
| return ; | |||||
| }finally { | |||||
| if (null != inputStream ) { | |||||
| inputStream.close(); | |||||
| } | |||||
| } | |||||
| } | } | ||||