Пример #1
0
  /**
   * 图文模板查询Ajax
   *
   * @param menuinfo 菜单信息
   * @return
   */
  @RequestMapping("/modualqueryajaxInvoke.do")
  @ResponseBody
  public String modualquey(HttpServletRequest request) {
    List<HashMap<String, Object>> list;
    String modualdata = "";
    try {
      HashMap<String, Object> map = new HashMap<String, Object>();
      logger.info(
          "当前登录人ID:" + request.getSession().getAttribute(SessionConstant.USERID).toString());
      String userId = request.getSession().getAttribute(SessionConstant.USERID).toString();
      Map<String, String> usermap = null;
      String wxid = "";
      usermap = this.commonService.getWXaccount(userId); // 	SessionConstant.USERID取值
      if (usermap != null) {
        wxid = usermap.get("wxid");
      }
      map.put("wxid", wxid);
      map.put("modualid", request.getParameter("modualid"));
      map.put("searchtext", request.getParameter("searchtext"));
      list = this.modualService.queryDatabyID(map);

      for (int m = 0; m < list.size(); m++) {
        HashMap<String, Object> map1 = list.get(m);
        String modualcontent = "";
        if (request.getParameter("modualid") != null
            && !"".equals(request.getParameter("modualid"))) {
          // 根据modualid从ftp上获取模板正文内容
          if (map1.get("modual_url") != null) {
            modualcontent =
                getModualContent(
                    map1.get("modualid").toString(), map1.get("modual_url").toString());
            modualcontent = modualcontent.replaceAll("\"", "\\\\\"");
          }
        }
        modualdata =
            modualdata
                + map1.get("modualid")
                + ";&&;||;"
                + map1.get("modual_title")
                + ";&&;||;"
                + map1.get("modual_desc")
                + ";&&;||;"
                + map1.get("modual_picurl")
                + ";&&;||;"
                + modualcontent
                + "**##**";
      }
      if (!"".equals(modualdata)) {
        modualdata = modualdata.substring(0, modualdata.lastIndexOf("**##**"));
      }

      // 处理查询结果
      String jsonmsg = "{datas:[{\"modualdata\":\"" + modualdata + "\"}]}";
      return CommonMsg.getObjectJson(StatusCode.SUCCESS, jsonmsg);

    } catch (Exception e) {
      e.printStackTrace();
      return CommonMsg.getMsgJson(StatusCode.FAIL, e.getMessage());
    }
  }
Пример #2
0
 /**
  * 客服接口测试(需认证)
  *
  * @return
  */
 @RequestMapping("/testInvoke.do")
 @ResponseBody
 public String testkfjk(HttpServletRequest request) {
   try {
     int resultret = -1;
     // 组装文本客服消息
     String jsonTextMsg =
         AdvancedUtil.makeTextCustomMessage(
             request.getParameter("openid").toString(),
             request.getParameter("textcontent").toString());
     // 发送客服消息
     logger.info(
         "当前登录人ID:" + request.getSession().getAttribute(SessionConstant.USERID).toString());
     String userId = request.getSession().getAttribute(SessionConstant.USERID).toString();
     Map<String, String> usermap = new HashMap<String, String>();
     String wxid = "";
     usermap = this.commonService.getWXaccount(userId); // 	SessionConstant.USERID取值
     if (usermap != null) {
       wxid = usermap.get("wxid");
       String accesstoken = "";
       accesstoken = CommonUtil.getToken(wxid);
       if (!"".equals(accesstoken)) {
         AdvancedUtil.sendCustomMessage(accesstoken, jsonTextMsg);
         resultret = 1;
       }
     }
     return CommonMsg.getMsgJson(StatusCode.SUCCESS, String.valueOf(resultret));
   } catch (Exception e) {
     e.printStackTrace();
     return CommonMsg.getMsgJson(StatusCode.FAIL, e.getMessage());
   }
 }
Пример #3
0
 /**
  * 菜单发布
  *
  * @param menuinfo 菜单信息
  * @return
  */
 @RequestMapping("/menupublish.do")
 @ResponseBody
 public String publishmenu(HttpServletRequest request) {
   int resultret = -1;
   List<HashMap<String, Object>> list;
   logger.info("当前登录人ID:" + request.getSession().getAttribute(SessionConstant.USERID).toString());
   String userId = request.getSession().getAttribute(SessionConstant.USERID).toString();
   HashMap<String, Object> map = new HashMap<String, Object>();
   Map<String, String> usermap = null;
   String wxid = "";
   usermap = this.commonService.getWXaccount(userId); // 	SessionConstant.USERID取值
   if (usermap != null) {
     wxid = usermap.get("wxid");
   }
   map.put("wxid", wxid);
   try {
     list = this.menuService.queryData(map);
     if (list != null) {
       // 菜单发布
       boolean resultbool = MenuManager.publishMenu(list, wxid);
       if (resultbool == true) {
         resultret = 1;
       }
     }
     return CommonMsg.getObjectJson(StatusCode.SUCCESS, String.valueOf(resultret));
   } catch (Exception e) {
     e.printStackTrace();
     return CommonMsg.getMsgJson(StatusCode.FAIL, e.getMessage());
   }
 }
Пример #4
0
  /**
   * 自定义菜单查询Ajax
   *
   * @param menuinfo 菜单信息
   * @return
   */
  @RequestMapping("/menuqueryajaxInvoke.do")
  @ResponseBody
  public String menuquey(HttpServletRequest request) {
    List<HashMap<String, Object>> list;
    String menudata = "";
    logger.info("当前登录人ID:" + request.getSession().getAttribute(SessionConstant.USERID).toString());
    String userId = request.getSession().getAttribute(SessionConstant.USERID).toString();
    HashMap<String, Object> map = new HashMap<String, Object>();
    Map<String, String> usermap = null;
    String wxid = "";
    usermap = this.commonService.getWXaccount(userId); // 	SessionConstant.USERID取值
    if (usermap != null) {
      wxid = usermap.get("wxid");
    }
    map.put("wxid", wxid);
    // request.getSession().getAttribute(SessionConstant.LOGINID);
    try {
      if ("".equals(request.getParameter("menuid")) || (request.getParameter("menuid") == null)) {
        list = this.menuService.queryData(map);
      } else {

        map.put("menuid", request.getParameter("menuid"));
        list = this.menuService.queryDatabyID(map);
      }
      for (int m = 0; m < list.size(); m++) {
        HashMap<String, Object> map1 = list.get(m);
        /*Blob blob = list.getBlob("content");
        int bolblen = (int) blob.length();
        byte[] data = blob.getBytes(1, bolblen);
        String content = new String(data);*/
        menudata =
            menudata
                + map1.get("menuid")
                + ";"
                + map1.get("menu_name")
                + ";"
                + map1.get("menu_level")
                + ";"
                + map1.get("parent_menu")
                + ";"
                + map1.get("opt_type")
                + ";"
                + map1.get("opt_content")
                + ";"
                + map1.get("ifzjtz")
                + "|";
      }
      if (!"".equals(menudata)) {
        menudata = menudata.substring(0, menudata.length() - 1);
      }
      // 处理查询结果
      String jsonmsg = "{datas:[{\"menudata\":\"" + menudata + "\"}]}";
      return CommonMsg.getObjectJson(StatusCode.SUCCESS, jsonmsg);

    } catch (Exception e) {
      e.printStackTrace();
      return CommonMsg.getMsgJson(StatusCode.FAIL, e.getMessage());
    }
  }
Пример #5
0
 /**
  * 粉丝信息获取(需认证)
  *
  * @return
  */
 @RequestMapping("/getuserinfo.do")
 @ResponseBody
 public String getuserinfo(HttpServletRequest request) {
   String openid = request.getParameter("openid").toString();
   try {
     String resultret = "";
     logger.info(
         "当前登录人ID:" + request.getSession().getAttribute(SessionConstant.USERID).toString());
     String userId = request.getSession().getAttribute(SessionConstant.USERID).toString();
     Map<String, String> usermap = null;
     String wxid = "";
     usermap = this.commonService.getWXaccount(userId); // 	SessionConstant.USERID取值
     if (usermap != null) {
       wxid = usermap.get("wxid");
       String accesstoken = "";
       accesstoken = CommonUtil.getToken(wxid);
       if (!"".equals(accesstoken)) {
         WeixinUserInfo user = AdvancedUtil.getUserInfo(accesstoken, openid);
         System.out.println("OpenID:" + user.getOpenId());
         System.out.println("关注状态:" + user.getSubscribe());
         System.out.println("关注时间:" + user.getSubscribeTime());
         System.out.println("昵称:" + user.getNickname());
         System.out.println("性别:" + user.getSex());
         System.out.println("国家:" + user.getCountry());
         System.out.println("省份:" + user.getProvince());
         System.out.println("城市:" + user.getCity());
         System.out.println("语言:" + user.getLanguage());
         System.out.println("头像:" + user.getHeadImgUrl());
         resultret =
             "关注状态:"
                 + user.getSubscribe()
                 + ";关注时间:"
                 + user.getSubscribeTime()
                 + ";昵称:"
                 + user.getNickname()
                 + ";性别:"
                 + user.getSex()
                 + ";国家:"
                 + user.getCountry()
                 + ";省份:"
                 + user.getProvince()
                 + ";城市:"
                 + user.getCity()
                 + ";语言:"
                 + user.getLanguage()
                 + ";头像:"
                 + user.getHeadImgUrl();
       }
     }
     // 处理查询结果
     String jsonmsg = "{datas:[{\"resultret\":\"" + resultret + "\"}]}";
     return CommonMsg.getObjectJson(StatusCode.SUCCESS, jsonmsg);
   } catch (Exception e) {
     e.printStackTrace();
     return CommonMsg.getMsgJson(StatusCode.FAIL, e.getMessage());
   }
 }
Пример #6
0
  /**
   * 上传文件
   *
   * @param menuinfo 菜单信息
   * @return
   */
  @RequestMapping("/uppic.do")
  @ResponseBody
  public String uploadfile(
      @RequestParam(value = "uploadfileurl", required = false) MultipartFile uploadfileurl,
      HttpServletRequest request) {
    String returnurl = "";
    try {
      if (!uploadfileurl.getContentType().toLowerCase().startsWith("image/")) {
        return CommonMsg.getMsgJson(StatusCode.FAIL, "请上传正确的封面图片");
      }
      if (uploadfileurl.getSize() / 1024.0 / 1024.0 > 2) {
        return CommonMsg.getMsgJson(StatusCode.FAIL, "图片文件不能大于2M");
      }
      Date d = new Date();
      SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
      String dateNowStr = sdf.format(d);
      String serverpath =
          PropertyHelper.getWebAppPath()
              + "ueditor"
              + File.separator
              + "jsp"
              + File.separator
              + "upload"
              + File.separator
              + "image"
              + File.separator
              + dateNowStr
              + File.separator;
      // 创建文件目录
      File logosavedir = new File(serverpath);
      // 如果目录不存在就创建
      if (!logosavedir.exists()) {
        logosavedir.mkdirs();
      }
      // String ext =
      // uploadfileurl.getOriginalFilename().substring(uploadfileurl.getOriginalFilename().lastIndexOf("."));
      String ext = ".png";
      String filename = UUID.randomUUID() + ext;
      File dest = new File(serverpath + filename);
      try {
        uploadfileurl.transferTo(dest);
        // 压缩图片
        CompressPicUtil mypic = new CompressPicUtil();
        mypic.compressPic(serverpath, serverpath, filename, filename, 200, 200, true);
        returnurl = "/ueditor/jsp/upload/image/" + dateNowStr + "/" + filename;
        return CommonMsg.getMsgJson(StatusCode.SUCCESS, returnurl);
      } catch (Exception e1) {
        return CommonMsg.getMsgJson(StatusCode.FAIL, "无效的封面图片");
      }

    } catch (Exception e) {
      return CommonMsg.getMsgJson(StatusCode.FAIL, "无效的封面图片");
    }
  }
Пример #7
0
  /**
   * 微信公众号配置保存Ajax
   *
   * @param
   * @return
   */
  @RequestMapping("/settingajaxInvoke.do")
  @ResponseBody
  public String savesetting(HttpServletRequest request) {
    HashMap<String, Object> map = new HashMap<String, Object>();
    Map<String, String> usermap = null;
    String settingdata = "";
    settingdata = request.getParameter("settinginfo");
    String account_id = settingdata.split("000ASDFG111")[0].toString();
    String account_name = settingdata.split("000ASDFG111")[1].toString();
    String appid = settingdata.split("000ASDFG111")[2].toString();
    String appsecret = settingdata.split("000ASDFG111")[3].toString();
    String token = settingdata.split("000ASDFG111")[4].toString();
    String severurl = settingdata.split("000ASDFG111")[5].toString();
    String wxoriginalid = settingdata.split("000ASDFG111")[6].toString();

    map.put("account_id", account_id);
    map.put("account_name", account_name);
    map.put("token", token);
    map.put("appid", appid);
    map.put("appsecret", appsecret);
    map.put("severurl", severurl);
    map.put("wxoriginalid", wxoriginalid);

    String wxid = "";
    int resultret = -1;
    logger.info("当前登录人ID:" + SessionConstant.USERID);
    String userId = request.getSession().getAttribute(SessionConstant.USERID).toString();
    usermap = this.commonService.getWXaccount(userId); // 	SessionConstant.USERID取值	
    if (usermap != null) {
      wxid = usermap.get("wxid");
      map.put("wxid", wxid);
      // 先查询有没有设置关注自动回复 ,如果设置了,则update,否则insert
      Map<String, String> settingmap = this.commonService.getWXinfo(map);
      if (settingmap == null) {
        resultret = this.commonService.insertWXinfo(map);
      } else {
        resultret = this.commonService.updateWXinfo(map);
      }
      return CommonMsg.getObjectJson(StatusCode.SUCCESS, String.valueOf(resultret));
    } else {
      // 获取前台页面输入的wxid,插入微信和用户关系表account_user
      Date date = new Date();
      wxid = String.valueOf(date.getTime());
      map.put("wxid", wxid);
      try {
        map.put("userid", userId);
        resultret = this.commonService.insertWX(map);
        return CommonMsg.getObjectJson(StatusCode.SUCCESS, String.valueOf(resultret));
      } catch (Exception e) {
        return CommonMsg.getObjectJson(StatusCode.SUCCESS, String.valueOf(resultret));
      }
    }
  }
Пример #8
0
 /**
  * 快速回复用户消息
  *
  * @param
  * @return
  */
 @RequestMapping("/replymessageInvoke.do")
 @ResponseBody
 public String replyMsg(HttpServletRequest request) {
   Map<String, String> usermap = new HashMap<String, String>();
   try {
     int resultret = -1;
     // 组装文本客服消息
     String jsonTextMsg =
         AdvancedUtil.makeTextCustomMessage(
             request.getParameter("openid").toString(),
             request.getParameter("messagecontent").toString());
     // 发送客服消息
     logger.info(
         "当前登录人ID:" + request.getSession().getAttribute(SessionConstant.USERID).toString());
     String userId = request.getSession().getAttribute(SessionConstant.USERID).toString();
     String wxid = "";
     usermap = this.commonService.getWXaccount(userId); // 	SessionConstant.USERID取值
     if (usermap != null) {
       wxid = usermap.get("wxid");
       String accesstoken = "";
       accesstoken = CommonUtil.getToken(wxid);
       if (!"".equals(accesstoken)) {
         Boolean ret = AdvancedUtil.sendCustomMessage(accesstoken, jsonTextMsg);
         if (ret == true) {
           resultret = 1;
           try {
             // 更新数据库中的 ifreply和replycontent
             Map<String, Object> params = new HashMap<String, Object>();
             params.put("wxid", wxid);
             params.put("msgid", System.currentTimeMillis());
             params.put("ifreply", "1");
             params.put("oldmsgid", request.getParameter("msgid").toString());
             params.put("msg_type", "text");
             params.put("text_content", request.getParameter("messagecontent").toString());
             this.commonService.saveWXMessage(params);
           } catch (Exception e) {
             logger.debug("更新数据库中回复内容失败,失败原因:" + e);
           }
         } else {
           resultret = -1;
         }
       }
     }
     return CommonMsg.getMsgJson(StatusCode.SUCCESS, String.valueOf(resultret));
   } catch (Exception e) {
     e.printStackTrace();
     return CommonMsg.getMsgJson(StatusCode.FAIL, e.getMessage());
   }
 }
Пример #9
0
 /**
  * 关注自动回复查询Ajax
  *
  * @param replyinfo 回复信息
  * @return
  */
 @RequestMapping("/replyQueryInvoke.do")
 @ResponseBody
 public String queryreply(HttpServletRequest request) {
   HashMap<String, Object> map = null;
   Map<String, String> usermap = null;
   String wxid = "";
   map = new HashMap<String, Object>();
   logger.info("当前登录人ID:" + request.getSession().getAttribute(SessionConstant.USERID).toString());
   String userId = request.getSession().getAttribute(SessionConstant.USERID).toString();
   usermap = this.commonService.getWXaccount(userId); // 	SessionConstant.USERID取值
   if (usermap != null) {
     wxid = usermap.get("wxid");
   }
   map.put("wxid", wxid);
   HashMap<String, Object> replymap = this.replyService.queryData(map);
   String replydata = "";
   if (replymap != null) {
     replydata =
         replydata
             + replymap.get("opt_type")
             + "00ASDFGH00"
             + replymap.get("opt_content")
             + "99LKJHGF99";
     if (!"".equals(replydata)) {
       replydata = replydata.substring(0, replydata.lastIndexOf("99LKJHGF99"));
     }
   }
   // 处理查询结果
   String jsonmsg = "{datas:[{\"replydata\":\"" + replydata + "\"}]}";
   return CommonMsg.getObjectJson(StatusCode.SUCCESS, jsonmsg);
 }
Пример #10
0
 /**
  * 关注自动回复Ajax
  *
  * @param replyinfo 回复信息
  * @return
  */
 @RequestMapping("/replyajaxInvoke.do")
 @ResponseBody
 public String savereply(HttpServletRequest request) {
   HashMap<String, Object> map = null;
   Map<String, String> usermap = null;
   String wxid = "";
   int resultret = -1;
   map = new HashMap<String, Object>();
   System.out.println("当前登录人ID:" + SessionConstant.USERID);
   String userId = request.getSession().getAttribute(SessionConstant.USERID).toString();
   usermap = this.commonService.getWXaccount(userId); // 	SessionConstant.USERID取值	
   if (usermap != null) {
     wxid = usermap.get("wxid");
   }
   map.put("wxid", wxid);
   // 先查询有没有设置关注自动回复 ,如果设置了,则update,否则insert
   HashMap<String, Object> replymap = this.replyService.queryData(map);
   String replydata = "";
   replydata = request.getParameter("replyinfo");
   String opt_type = replydata.split("000ASDFG111")[0].toString();
   String opt_content = replydata.split("000ASDFG111")[1].toString();
   if (" ".equals(opt_type)) {
     map.put("opt_type", null);
   } else {
     map.put("opt_type", opt_type);
   }
   map.put("opt_content", opt_content);
   if (replymap == null) {
     resultret = this.replyService.insertData(map);
   } else {
     resultret = this.replyService.updData(map);
   }
   return CommonMsg.getObjectJson(StatusCode.SUCCESS, String.valueOf(resultret));
 }
Пример #11
0
  /**
   * 粉丝列表获取(需认证)
   *
   * @return
   */
  @RequestMapping("/getuserlist.do")
  @ResponseBody
  public String getuserlist(HttpServletRequest request) {
    try {
      String resultret = "";
      logger.info(
          "当前登录人ID:" + request.getSession().getAttribute(SessionConstant.USERID).toString());
      String userId = request.getSession().getAttribute(SessionConstant.USERID).toString();
      Map<String, String> usermap = null;
      String wxid = "";
      usermap = this.commonService.getWXaccount(userId); // 	SessionConstant.USERID取值
      if (usermap != null) {
        wxid = usermap.get("wxid");
        String accesstoken = "";
        accesstoken = CommonUtil.getToken(wxid);
        if (!"".equals(accesstoken)) {
          WeixinUserList weixinUserList = AdvancedUtil.getUserList(accesstoken, "");
          System.out.println("总关注用户数:" + weixinUserList.getTotal());
          System.out.println("本次获取用户数:" + weixinUserList.getCount());
          System.out.println("OpenID列表:" + weixinUserList.getOpenIdList().toString());
          System.out.println("next_openid:" + weixinUserList.getNextOpenId());

          resultret =
              "总关注用户数:"
                  + weixinUserList.getTotal()
                  + ";本次获取用户数:"
                  + weixinUserList.getCount()
                  + ";OpenID列表:"
                  + weixinUserList.getOpenIdList().toString();
        }
      }
      // 处理查询结果
      String jsonmsg = "{datas:[{\"resultret\":\"" + resultret + "\"}]}";
      return CommonMsg.getObjectJson(StatusCode.SUCCESS, jsonmsg);
    } catch (Exception e) {
      e.printStackTrace();
      return CommonMsg.getMsgJson(StatusCode.FAIL, e.getMessage());
    }
  }
Пример #12
0
 /**
  * 微信公众号配置查询Ajax
  *
  * @param replyinfo 回复信息
  * @return
  */
 @RequestMapping("/settingQueryInvoke.do")
 @ResponseBody
 public String querysetting(HttpServletRequest request) {
   HashMap<String, Object> map = null;
   Map<String, String> usermap = null;
   String wxid = "";
   map = new HashMap<String, Object>();
   logger.info("当前登录人ID:" + request.getSession().getAttribute(SessionConstant.USERID).toString());
   String userId = request.getSession().getAttribute(SessionConstant.USERID).toString();
   usermap = this.commonService.getWXaccount(userId); // 	SessionConstant.USERID取值
   if (usermap != null) {
     wxid = usermap.get("wxid");
   }
   map.put("wxid", wxid);
   Map<String, String> settingmap = this.commonService.getWXinfo(map);
   String settingdata = "";
   if (settingmap != null) {
     settingdata =
         settingdata
             + settingmap.get("account_id")
             + "00ASDFGH00"
             + settingmap.get("account_name")
             + "00ASDFGH00"
             + settingmap.get("token")
             + "00ASDFGH00"
             + settingmap.get("appid")
             + "00ASDFGH00"
             + settingmap.get("appsecret")
             + "00ASDFGH00"
             + settingmap.get("severurl")
             + "00ASDFGH00"
             + settingmap.get("wxoriginalid")
             + "99LKJHGF99";
     if (!"".equals(settingdata)) {
       settingdata = settingdata.substring(0, settingdata.lastIndexOf("99LKJHGF99"));
     }
   }
   // 处理查询结果
   String jsonmsg = "{datas:[{\"settingdata\":\"" + settingdata + "\"}]}";
   return CommonMsg.getObjectJson(StatusCode.SUCCESS, jsonmsg);
 }
Пример #13
0
  /**
   * 统计分析Ajax
   *
   * @param tjtype 统计分析类型
   * @return
   */
  @RequestMapping("/ajaxInvoke.do")
  @ResponseBody
  public String query(HttpServletRequest request) {
    HashMap<String, Object> map = null;
    map = new HashMap<String, Object>();
    map.put("tjtype", request.getParameter("tjtype"));
    map.put("datetype", request.getParameter("datetype"));
    map.put("sdate", request.getParameter("sdate"));
    map.put("edate", request.getParameter("edate"));
    List<HashMap<String, Object>> list;
    try {
      list = this.tjfxService.queryData(map);
      // 处理查询结果
      String xaxis = "";
      String retdata = "";
      String datetype = request.getParameter("datetype");
      List<HashMap<String, Object>> datelist = new ArrayList<HashMap<String, Object>>();
      if (!"0".equals(datetype)) {
        for (int i = Integer.parseInt("-" + datetype); i < 0; i++) {
          String dates = yesteday(i);
          xaxis = xaxis + dates + ",";
          map = new HashMap<String, Object>();
          map.put("tjdate", dates);
          datelist.add(map);
        }
        if (!"".equals(xaxis)) {
          xaxis = xaxis.substring(0, xaxis.length() - 1);
        }
      } else {
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
        String str = sf.format(cal.getTime());
        int startbetween = daysBetween(str, request.getParameter("sdate"));
        int endbetween = daysBetween(str, request.getParameter("edate"));
        for (int i = startbetween; i < endbetween + 1; i++) {
          String dates = yesteday(i);
          xaxis = xaxis + dates + ",";
          map = new HashMap<String, Object>();
          map.put("tjdate", dates);
          datelist.add(map);
        }
        if (!"".equals(xaxis)) {
          xaxis = xaxis.substring(0, xaxis.length() - 1);
        }
      }
      if ("yy".equals(request.getParameter("tjtype"))) {
        String returninfo4yy = "";
        String returninfo4kp = "";
        String returninfo4lp = "";
        for (int i = 0; i < datelist.size(); i++) {
          HashMap<String, Object> dataMap = new HashMap<String, Object>();
          String dates = datelist.get(i).get("tjdate").toString();
          dataMap.put(dates + "_" + SessionConstant.yyzt_yyy, "0");
          dataMap.put(dates + "_" + SessionConstant.yyzt_ykp, "0");
          dataMap.put(dates + "_" + SessionConstant.yyzt_ylp, "0");
          for (int m = 0; m < list.size(); m++) {
            HashMap<String, Object> map1 = list.get(m);
            if (dates.equals(map1.get("RESV_TIME"))) {
              dataMap.put(dates + "_" + map1.get("RESV_STATUS"), map1.get("tjcount"));
            }
          }
          returninfo4yy = returninfo4yy + dataMap.get(dates + "_" + SessionConstant.yyzt_yyy) + ",";
          returninfo4kp = returninfo4kp + dataMap.get(dates + "_" + SessionConstant.yyzt_ykp) + ",";
          returninfo4lp = returninfo4lp + dataMap.get(dates + "_" + SessionConstant.yyzt_ylp) + ",";
        }
        if (!"".equals(returninfo4yy)) {
          returninfo4yy = returninfo4yy.substring(0, returninfo4yy.length() - 1);
        }
        if (!"".equals(returninfo4kp)) {
          returninfo4kp = returninfo4kp.substring(0, returninfo4kp.length() - 1);
        }
        if (!"".equals(returninfo4lp)) {
          returninfo4lp = returninfo4kp.substring(0, returninfo4lp.length() - 1);
        }
        retdata = returninfo4yy + "|" + returninfo4kp + "|" + returninfo4lp;
      } else if ("fs".equals(request.getParameter("tjtype"))) {
        String returninfo4fstotal = "";
        // 查询时间范围分别按日期添加数据
        for (int i = 0; i < datelist.size(); i++) {
          HashMap<String, Object> dataMap = new HashMap<String, Object>();
          String dates = datelist.get(i).get("tjdate").toString();
          dataMap.put(dates + "_" + SessionConstant.fs_total, "0");
          for (int m = 0; m < list.size(); m++) {
            HashMap<String, Object> map1 = list.get(m);
            if (dates.equals(map1.get("subscribe_time"))) {
              dataMap.put(dates + "_" + SessionConstant.fs_total, map1.get("tjcount"));
            }
          }
          returninfo4fstotal =
              returninfo4fstotal + dataMap.get(dates + "_" + SessionConstant.fs_total) + ",";
        }
        if (!"".equals(returninfo4fstotal)) {
          returninfo4fstotal = returninfo4fstotal.substring(0, returninfo4fstotal.length() - 1);
        }
        retdata = returninfo4fstotal;
      } else if ("xx".equals(request.getParameter("tjtype"))) {

      }

      String jsonmsg = "{datas:[{\"xAxis\":\"" + xaxis + "\",\"retdata\":\"" + retdata + "\"}]}";
      return CommonMsg.getObjectJson(StatusCode.SUCCESS, jsonmsg);
    } catch (Exception e) {
      e.printStackTrace();
      return CommonMsg.getMsgJson(StatusCode.FAIL, e.getMessage());
    }
  }
Пример #14
0
  /**
   * 自定义模板Ajax
   *
   * @return
   */
  @RequestMapping("/modualajaxInvoke.do")
  @ResponseBody
  public String savemodual(HttpServletRequest request) {
    HashMap<String, Object> map = null;
    map = new HashMap<String, Object>();
    map.put("opttype", request.getParameter("opttype"));
    logger.info("当前登录人ID:" + request.getSession().getAttribute(SessionConstant.USERID).toString());
    String userId = request.getSession().getAttribute(SessionConstant.USERID).toString();
    Map<String, String> usermap = null;
    String wxid = "";
    usermap = this.commonService.getWXaccount(userId); // 	SessionConstant.USERID取值
    if (usermap != null) {
      wxid = usermap.get("wxid");
    }
    map.put("wxid", wxid);
    int resultret = -1;
    if ((SessionConstant.modual_insert).equals(request.getParameter("opttype"))
        || (SessionConstant.modual_upd).equals(request.getParameter("opttype"))) {
      String modualinfo = request.getParameter("modualinfo");
      String dir = request.getParameter("dir");
      String modualid = modualinfo.split("\\;\\&\\&\\;\\|\\|\\;")[0].toString();
      String modual_title = modualinfo.split("\\;\\&\\&\\;\\|\\|\\;")[1].toString();
      String modual_desc = modualinfo.split("\\;\\&\\&\\;\\|\\|\\;")[2].toString();
      String modual_picurl = modualinfo.split("\\;\\&\\&\\;\\|\\|\\;")[3].toString();
      String modual_textcontent = modualinfo.split("\\;\\&\\&\\;\\|\\|\\;")[4].toString();
      String urlmodual_textcontent =
          "<!DOCTYPE html> <html> <head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head><body>"
              + modual_textcontent
              + "</body></html>";

      // 第一步:先将正文文本存成服务器上指定路径的文件
      map.put("modualid", modualid);
      map.put("modual_title", modual_title);
      map.put("modual_desc", modual_desc);
      map.put("modual_picurl", modual_picurl);
      map.put("modual_url", "");
      Date d = new Date();
      SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
      String dateNowStr = sdf.format(d);
      // 存放到ftp(txt文本文件+html文件)
      // 服务器路径
      String servertxtpath =
          PropertyHelper.getWebAppPath() + "ueditor" + File.separator + modualid + ".txt";
      String serverhtmlpath =
          PropertyHelper.getWebAppPath() + "ueditor" + File.separator + modualid + ".html";
      // ftp路径
      String ftpurl = "/jsp/upload/file/" + dateNowStr;
      if ((!"".equals(modual_textcontent)) && (!" ".equals(modual_textcontent))) {
        saveModualContent(modual_textcontent, modualid, servertxtpath, ftpurl); // 存txt
        saveModualContent(urlmodual_textcontent, modualid, serverhtmlpath, ftpurl); // 存html
        map.put("modual_url", ftpurl + "/" + modualid + ".txt");
      }
      resultret = this.modualService.updateData(map);
    } else if ((SessionConstant.modual_del).equals(request.getParameter("opttype"))) {
      String modualid = request.getParameter("modualid");
      map.put("modualid", modualid);
      // 删除ftp上正文文本

      resultret = this.modualService.updateData(map);
    }
    return CommonMsg.getObjectJson(StatusCode.SUCCESS, String.valueOf(resultret));
  }
Пример #15
0
  /**
   * 自定义菜单Ajax
   *
   * @param menuinfo 菜单信息
   * @return
   */
  @RequestMapping("/menuajaxInvoke.do")
  @ResponseBody
  public String savemenu(HttpServletRequest request) {
    HashMap<String, Object> map = null;
    map = new HashMap<String, Object>();
    logger.info("当前登录人ID:" + request.getSession().getAttribute(SessionConstant.USERID).toString());
    String userId = request.getSession().getAttribute(SessionConstant.USERID).toString();
    Map<String, String> usermap = null;
    String wxid = "";
    usermap = this.commonService.getWXaccount(userId); // 	SessionConstant.USERID取值
    if (usermap != null) {
      wxid = usermap.get("wxid");
    }
    map.put("wxid", wxid);
    map.put("opttype", request.getParameter("opttype"));
    String menuinfo = request.getParameter("menuinfo");
    int resultret = -1;
    if ((SessionConstant.menu_insert).equals(request.getParameter("opttype"))) {
      String menuid = menuinfo.split(";")[0].toString();
      String menu_name = menuinfo.split(";")[1].toString();
      String menu_level = menuinfo.split(";")[2].toString();
      String parent_menu = menuinfo.split(";")[3].toString();
      String opt_type = menuinfo.split(";")[4].toString();
      String opt_content = menuinfo.split(";")[5].toString();
      map.put("menuid", menuid);
      map.put("menu_name", menu_name);
      map.put("menu_level", menu_level);
      map.put("parent_menu", parent_menu);
      if (" ".equals(opt_type)) {
        map.put("opt_type", null);
      } else {
        map.put("opt_type", opt_type);
        if ("1".equals(opt_type)) {
          String ifzjtz = menuinfo.split(";")[6].toString(); // 是否网页直接跳转
          map.put("ifzjtz", ifzjtz);
        }
      }
      map.put("opt_content", opt_content);

      resultret = this.menuService.updateData(map);
    } else if ((SessionConstant.menu_upd).equals(request.getParameter("opttype"))) {
      String menuid = menuinfo.split(";")[0].toString();
      String menu_name = menuinfo.split(";")[1].toString();
      String opt_type = menuinfo.split(";")[2].toString();
      String opt_content = menuinfo.split(";")[3].toString();
      map.put("menuid", menuid);
      map.put("menu_name", menu_name);
      map.put("opt_type", opt_type);
      if (" ".equals(opt_type)) {
        map.put("opt_type", null);
      } else {
        map.put("opt_type", opt_type);
        if ("1".equals(opt_type)) {
          String ifzjtz = menuinfo.split(";")[4].toString(); // 是否网页直接跳转
          map.put("ifzjtz", ifzjtz);
        }
      }
      if (" ".equals(opt_content)) {
        map.put("opt_content", null);
      } else {
        map.put("opt_content", opt_content);
      }
      resultret = this.menuService.updateData(map);
    } else if ((SessionConstant.menu_rename).equals(request.getParameter("opttype"))) {
      String menuid = menuinfo.split(";")[0].toString();
      String menu_name = menuinfo.split(";")[1].toString();
      map.put("menuid", menuid);
      map.put("menu_name", menu_name);
      resultret = this.menuService.renameData(map);
    } else if ((SessionConstant.menu_del).equals(request.getParameter("opttype"))) {
      map.put("menuid", menuinfo);
      resultret = this.menuService.updateData(map);
    }

    // String jsonmsg="{datas:[{\"retdata\":\"" +resultret+ "\"}]}";
    return CommonMsg.getObjectJson(StatusCode.SUCCESS, String.valueOf(resultret));
  }
Пример #16
0
  /**
   * 消息查询Ajax
   *
   * @param
   * @return
   */
  @RequestMapping("/messageQuery.do")
  @ResponseBody
  public String queryMsg(HttpServletRequest request) {

    HashMap<String, Object> map = null;
    Map<String, String> usermap = null;
    String wxid = "";
    map = new HashMap<String, Object>();
    map.put("datetype", request.getParameter("datetype"));
    map.put("sdate", request.getParameter("sdate"));
    map.put("edate", request.getParameter("edate"));
    logger.info("当前登录人ID:" + request.getSession().getAttribute(SessionConstant.USERID).toString());
    String userId = request.getSession().getAttribute(SessionConstant.USERID).toString();
    usermap = this.commonService.getWXaccount(userId); // 	SessionConstant.USERID取值
    if (usermap != null) {
      wxid = usermap.get("wxid");
    }
    map.put("wxid", wxid);
    List<Map<String, Object>> messagelist = this.commonService.getWXMessage(map);
    String messagedata = "";
    if (messagelist != null) {
      for (int i = 0; i < messagelist.size(); i++) {
        Map<String, Object> messageMap = new HashMap<String, Object>();
        messageMap = messagelist.get(i);
        messagedata =
            messagedata
                + messageMap.get("fromuser").toString()
                + "00ASDFGH00"
                + messageMap.get("touser").toString()
                + "00ASDFGH00"
                + messageMap.get("msg_type").toString()
                + "00ASDFGH00"
                + messageMap.get("msgid").toString()
                + "00ASDFGH00"
                + messageMap
                    .get("create_time")
                    .toString()
                    .substring(0, messageMap.get("create_time").toString().lastIndexOf("."));
        if (MessageUtil.REQ_MESSAGE_TYPE_TEXT.equals(messageMap.get("msg_type").toString())) {
          messagedata = messagedata + "00ASDFGH00" + messageMap.get("text_content").toString();
        } else if (MessageUtil.REQ_MESSAGE_TYPE_IMAGE.equals(
            messageMap.get("msg_type").toString())) {
          messagedata =
              messagedata
                  + "00ASDFGH00"
                  + messageMap.get("image_mediaid").toString()
                  + "00ASDFGH00"
                  + messageMap.get("image_picurl").toString();
        } else if (MessageUtil.REQ_MESSAGE_TYPE_VOICE.equals(
            messageMap.get("msg_type").toString())) {
          messagedata =
              messagedata
                  + "00ASDFGH00"
                  + messageMap.get("voice_mediaid").toString()
                  + "00ASDFGH00"
                  + messageMap.get("voice_format").toString();
        } else if (MessageUtil.REQ_MESSAGE_TYPE_VIDEO.equals(
            messageMap.get("msg_type").toString())) {
          messagedata =
              messagedata
                  + "00ASDFGH00"
                  + messageMap.get("video_mediaid").toString()
                  + "00ASDFGH00"
                  + messageMap.get("video_thumbmediaid").toString();
        } else if (MessageUtil.REQ_MESSAGE_TYPE_LOCATION.equals(
            messageMap.get("msg_type").toString())) {
          messagedata =
              messagedata
                  + "00ASDFGH00"
                  + messageMap.get("location_x").toString()
                  + "00ASDFGH00"
                  + messageMap.get("location_y").toString()
                  + "00ASDFGH00"
                  + messageMap.get("location_scale").toString()
                  + "00ASDFGH00"
                  + messageMap.get("location_label").toString();
        } else if (MessageUtil.REQ_MESSAGE_TYPE_LINK.equals(
            messageMap.get("msg_type").toString())) {
          messagedata =
              messagedata
                  + "00ASDFGH00"
                  + messageMap.get("link_title").toString()
                  + "00ASDFGH00"
                  + messageMap.get("link_description").toString()
                  + "00ASDFGH00"
                  + messageMap.get("link_url").toString();
        }
        messagedata = messagedata + "99LKJHGF99";
      }
      if (!"".equals(messagedata)) {
        messagedata = messagedata.substring(0, messagedata.lastIndexOf("99LKJHGF99"));
      }
    }
    // 处理查询结果
    String jsonmsg = "{datas:[{\"messagedata\":\"" + messagedata + "\"}]}";
    return CommonMsg.getObjectJson(StatusCode.SUCCESS, jsonmsg);
  }