Kaynağa Gözat

微信公众号关注测试类删除

郭齐峰 1 yıl önce
ebeveyn
işleme
3d2509ecbf

+ 0 - 273
src/custom/beans/wechatIndex/ReturnHandle.java

@@ -1,273 +0,0 @@
-package beans.wechatIndex;
-
-import common.YosException;
-import utility.wechat.work.Parameter;
-import utility.wechat.work.receive.core.GetXmlValues;
-
-/**
- * 处理用户发来的信息,并进行反馈
- *
- * @author Administrator
- */
-public class ReturnHandle {
-    String finalxml;
-    String ToUserName;
-    String FromUserName;
-    String CreateTime;
-    String Content;
-    String MsgId;
-    String returnXML;// 反馈的xml
-    String Event;
-    String EventKey;
-    String PicUrl;
-    String MediaId;
-    String Format;
-    String ThumbMediaId;
-    String Location_X;
-    String Location_Y;
-    String Scale;
-    String Label;
-    String Latitude;
-    String Longitude;
-    String Precision;
-    String ScanType;
-    String ScanResult;
-    String systemclient;
-
-    public ReturnHandle(String systemclient, String finalxml) {
-        this.finalxml = finalxml;
-        this.systemclient = systemclient;
-        ToUserName = GetXmlValues.get(finalxml, "ToUserName");
-        FromUserName = GetXmlValues.get(finalxml, "FromUserName");
-        CreateTime = GetXmlValues.get(finalxml, "CreateTime");
-        if (getMsgType().equalsIgnoreCase(Parameter.MsgType.text)) {
-            // 如果是text类型的消息,则获取相应的参数
-            Content = GetXmlValues.get(finalxml, "Content");
-            MsgId = GetXmlValues.get(finalxml, "MsgId");
-            // 根据Content(消息内容)及AgentID(应用ID)判断进行不同的反馈。
-            switchTextMsg(Content);
-        } else if (getMsgType().equalsIgnoreCase(Parameter.MsgType.location)) {
-            // 如果是location类型的消息,则获取相应的参数
-            Location_X = GetXmlValues.get(finalxml, "Location_X");
-            Location_Y = GetXmlValues.get(finalxml, "Location_Y");
-            Scale = GetXmlValues.get(finalxml, "Scale");
-            Label = GetXmlValues.get(finalxml, "Label");
-            MsgId = GetXmlValues.get(finalxml, "MsgId");
-            switchLocationMsg(Location_X, Location_Y, Scale, Label);
-        } else if (getMsgType().equalsIgnoreCase(Parameter.MsgType.image)) {
-            // 如果是image类型的消息,则获取相应的参数
-            PicUrl = GetXmlValues.get(finalxml, "PicUrl");
-            MediaId = GetXmlValues.get(finalxml, "MediaId");
-            MsgId = GetXmlValues.get(finalxml, "MsgId");
-            switchImageMsg(PicUrl, MediaId);
-        } else if (getMsgType().equalsIgnoreCase(Parameter.MsgType.voice)) {
-            // 如果是voice类型的消息,则获取相应的参数
-            MediaId = GetXmlValues.get(finalxml, "MediaId");
-            Format = GetXmlValues.get(finalxml, "Format");
-            MsgId = GetXmlValues.get(finalxml, "MsgId");
-            switchVoiceMsg(MediaId, Format);
-        } else if (getMsgType().equalsIgnoreCase(Parameter.MsgType.video)) {
-            // 如果是video类型的消息,则获取相应的参数
-            MediaId = GetXmlValues.get(finalxml, "MediaId");
-            ThumbMediaId = GetXmlValues.get(finalxml, "ThumbMediaId");
-            MsgId = GetXmlValues.get(finalxml, "MsgId");
-            switchVideoMsg(MediaId, ThumbMediaId);
-        } else if (getMsgType().equalsIgnoreCase(Parameter.MsgType.shortvideo)) {
-            // 如果是shortvideo类型的消息,则获取相应的参数
-            MediaId = GetXmlValues.get(finalxml, "MediaId");
-            ThumbMediaId = GetXmlValues.get(finalxml, "ThumbMediaId");
-            MsgId = GetXmlValues.get(finalxml, "MsgId");
-            switchShortvideoMsg(MediaId, ThumbMediaId);
-        } else if (getMsgType().equalsIgnoreCase(Parameter.MsgType.event)) {
-            Event = GetXmlValues.get(finalxml, "Event");// 时间类型,按钮、链接
-            // 如果是event类型的消息,则获取相应的参数
-            String eventtype = getEventType();
-            if (eventtype.equalsIgnoreCase(Parameter.EventType.CLICK)) {// 按钮点击事件
-                EventKey = GetXmlValues.get(finalxml, "EventKey");// 事件值,根据不同的值做出相应的响应
-                switchClickEventMsg(EventKey);
-            } else if (eventtype
-                    .contains(Parameter.EventType.subscribe)) {// 成员关注/取消关注事件
-                switchSubscribeEventMsg(eventtype);
-            } else if (eventtype.equalsIgnoreCase(Parameter.EventType.LOCATION)) {// 上报地理位置事件
-                Latitude = GetXmlValues.get(finalxml, "Latitude");
-                Longitude = GetXmlValues.get(finalxml, "Longitude");
-                Precision = GetXmlValues.get(finalxml, "Precision");
-                switchLocationEventMsg(Latitude, Longitude, Precision);
-            } else if (eventtype.equalsIgnoreCase(Parameter.EventType.VIEW)) {// 按钮点击事件
-                EventKey = GetXmlValues.get(finalxml, "EventKey");// 网址
-                switchViewEventMsg(EventKey);
-            } else if (eventtype
-                    .equalsIgnoreCase(Parameter.EventType.scancode_push)) {// 扫码推事件的事件推送
-                EventKey = GetXmlValues.get(finalxml, "EventKey");
-                ScanType = GetXmlValues.get(finalxml, "ScanType");
-                ScanResult = GetXmlValues.get(finalxml, "ScanResult");
-                switchScancode_pushEventMsg(EventKey, ScanType, ScanResult);
-            } else if (eventtype
-                    .equalsIgnoreCase(Parameter.EventType.scancode_waitmsg)) {// 扫码推事件且弹出“消息接收中”提示框的事件推送
-                EventKey = GetXmlValues.get(finalxml, "EventKey");
-                ScanType = GetXmlValues.get(finalxml, "ScanType");
-                ScanResult = GetXmlValues.get(finalxml, "ScanResult");
-                switchScancode_waitmsgEventMsg(EventKey, ScanType, ScanResult);
-            }
-
-        }
-    }
-
-    /**
-     * 处理文字消息
-     *
-     * @param Content 文字内容
-     */
-    private void switchTextMsg(String Content) {
-        returnXML = getAppClass().switchTextMsg(Content, FromUserName,
-                ToUserName);
-    }
-
-    /**
-     * 处理点击事件消息
-     *
-     * @param EventKey 事件值
-     * @throws ClassNotFoundException
-     * @throws IllegalAccessException
-     * @throws InstantiationException
-     */
-    private void switchClickEventMsg(String EventKey) {
-        returnXML = getAppClass().switchClickEventMsg(EventKey, FromUserName,
-                ToUserName);
-    }
-
-    /**
-     * 点击菜单跳转链接的事件推送
-     *
-     * @param EventKey
-     */
-    private void switchViewEventMsg(String EventKey) {
-        returnXML = getAppClass().switchViewEventMsg(EventKey, FromUserName,
-                ToUserName);
-    }
-
-    /**
-     * 成员进入应用的事件推送
-     *
-     * @param EventKey
-     */
-    private void switchEnter_agentEventMsg(String EventKey) {
-        returnXML = getAppClass().switchEnter_agentEventMsg(EventKey,
-                FromUserName, ToUserName);
-
-    }
-
-    /**
-     * 扫码推事件的事件推送
-     *
-     * @param EventKey
-     */
-    private void switchScancode_pushEventMsg(String EventKey, String ScanType,
-                                             String ScanResult) {
-
-        returnXML = getAppClass().switchScancode_pushEventMsg(EventKey,
-                ScanType, ScanResult, FromUserName, ToUserName);
-    }
-
-    /**
-     * 扫码推事件且弹出“消息接收中”提示框的事件推送
-     *
-     * @param EventKey
-     */
-    private void switchScancode_waitmsgEventMsg(String EventKey,
-                                                String ScanType, String ScanResult) {
-        returnXML = getAppClass().switchScancode_waitmsgEventMsg(EventKey,
-                ScanType, ScanResult, FromUserName, ToUserName);
-    }
-
-    /**
-     * 关注取消关注
-     */
-    private void switchSubscribeEventMsg(String eventtype) {
-        returnXML = getAppClass().switchSubscribeEventMsg(FromUserName, ToUserName, eventtype);
-    }
-
-    /**
-     * 位置
-     *
-     * @param Latitude
-     * @param Longitude
-     * @param Precision
-     */
-    private void switchLocationEventMsg(String Latitude, String Longitude,
-                                        String Precision) {
-        returnXML = getAppClass().switchLocationEventMsg(Latitude,
-                Longitude, Precision, FromUserName, ToUserName);
-    }
-
-    /**
-     * 处理图片消息
-     */
-    private void switchImageMsg(String PicUrl, String MediaId) {
-        returnXML = getAppClass().switchImageMsg(PicUrl, MediaId, FromUserName,
-                ToUserName);
-    }
-
-    /**
-     * 处理音频消息
-     *
-     * @param MediaId 语音媒体文件id,可以调用获取媒体文件接口拉取数据
-     * @param Format  语音格式,如amr,speex等
-     */
-    private void switchVoiceMsg(String MediaId, String Format) {
-        returnXML = getAppClass().switchVoiceMsg(MediaId, Format, FromUserName,
-                ToUserName);
-    }
-
-    /**
-     * 处理视频消息
-     */
-    private void switchVideoMsg(String MediaId,
-                                String ThumbMediaId) {
-        returnXML = getAppClass().switchVideoMsg(MediaId, ThumbMediaId,
-                FromUserName, ToUserName);
-    }
-
-    /**
-     * 处理短视频消息
-     */
-    private void switchShortvideoMsg(String MediaId,
-                                     String ThumbMediaId) {
-        returnXML = getAppClass().switchShortvideoMsg(MediaId, ThumbMediaId,
-                FromUserName, ToUserName);
-    }
-
-    /**
-     * 处理位置消息
-     */
-    private void switchLocationMsg(String Location_X,
-                                   String Location_Y, String Scale, String Label) {
-        returnXML = getAppClass().switchLocationMsg(Location_X, Location_Y,
-                Scale, Label, FromUserName, ToUserName);
-    }
-
-    private String getMsgType() {
-        return GetXmlValues.get(finalxml, "MsgType");
-    }
-
-    private String getEventType() {
-        return GetXmlValues.get(finalxml, "Event");
-    }
-
-    public String getReturnXML() {
-        return returnXML;
-    }
-
-    private WechatServiceMsgRecevier getAppClass() {
-        WechatServiceMsgRecevier wechatServiceMsgRecevier = null;
-        try {
-            String work_messagingclasspath = Parameter.getWorkParameter(systemclient).getString("work_messagingclasspath");
-            work_messagingclasspath = work_messagingclasspath.equals("") ? "beans.wechatIndex.WechatService" : work_messagingclasspath;
-            Class<?> clazz = Class.forName(work_messagingclasspath);
-            wechatServiceMsgRecevier = (WechatServiceMsgRecevier) clazz.newInstance();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return wechatServiceMsgRecevier;
-    }
-}

+ 0 - 60
src/custom/beans/wechatIndex/WechatIndex.java

@@ -1,60 +0,0 @@
-package beans.wechatIndex;
-
-import common.data.Rows;
-import common.data.db.DBConnect;
-import utility.wechat.wechatservice.core.wechatIndex;
-import utility.wechat.work.receive.base.WXBizMsgCrypt;
-
-import javax.servlet.annotation.WebServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.*;
-import java.nio.charset.StandardCharsets;
-
-public class WechatIndex extends wechatIndex {
-
-    @Override
-    public String getSystemClient() {
-        return "wservice";
-    }
-
-
-    @Override
-    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
-        InputStream is = request.getInputStream();
-        String timestamp = request.getParameter("timestamp");
-        String nonce = request.getParameter("nonce");
-        String msg_signature = request.getParameter("msg_signature");
-
-        BufferedReader reader = new BufferedReader(new InputStreamReader(is,
-                StandardCharsets.UTF_8));
-        StringBuilder sb = new StringBuilder();
-        String line = null;
-        while ((line = reader.readLine()) != null) {
-            sb.append(line + "\n");
-        }
-        is.close();
-        try {
-            DBConnect dbConnect = new DBConnect();
-            Rows rows = dbConnect.runSqlQuery("select * from sys_wechatapp where systemclient='" + getSystemClient() + "'");
-            if (rows.size() == 1) {
-                WXBizMsgCrypt wxcpt = new WXBizMsgCrypt(rows.get(0).getString("work_token"),
-                        rows.get(0).getString("work_encodingaeskey"), rows.get(0).getString("work_corpid"));
-                String finalxml = wxcpt.decryptMsg(msg_signature, timestamp, nonce,
-                        sb.toString());
-                ReturnHandle returnHandle = new ReturnHandle(getSystemClient(), finalxml);
-                String xml = returnHandle.getReturnXML();
-                if (xml != null && !xml.equals("")) {
-                    String finalreturnxml = wxcpt.encryptMsg(xml, timestamp, nonce);
-                    response.setCharacterEncoding("utf-8");
-                    PrintWriter out = response.getWriter();
-                    out.print(finalreturnxml);
-                    out.flush();
-                    out.close();
-                }
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-}

+ 0 - 306
src/custom/beans/wechatIndex/WechatService.java

@@ -1,306 +0,0 @@
-package beans.wechatIndex;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.sun.org.apache.regexp.internal.RE;
-import common.BaseClass;
-import common.YosException;
-import common.data.*;
-import common.data.db.DBConnect;
-import utility.tools.WebRequest;
-import utility.wechat.miniprogram.WechatUserID;
-import utility.wechat.work.receive.core.CreateMsg;
-
-import java.util.Calendar;
-import java.util.HashMap;
-
-/**
- * 微信公众号
- */
-public class WechatService extends WechatServiceMsgRecevier {
-
-    //有效期2小时,需定时刷新,重复获取将导致上次获取的失效
-    private static HashMap<String, String> access_tokenMap = new HashMap<>();
-    private static HashMap<String, Long> access_token_timelimitMap = new HashMap<>();
-
-    String appid;
-    String secret;
-    String systemclient;
-
-    private static CreateMsg createMsg = new CreateMsg();
-
-    /**
-     * 构造函数
-     *
-     * @param systemclient 系统注册的微信应用操作端
-     */
-    public WechatService(String systemclient) throws YosException {
-        Rows rows = new DBConnect().runSqlQuery("select appid,secret from sys_wechatapp where systemclient='" + systemclient + "'");
-        if (rows.isNotEmpty()) {
-            this.appid = rows.get(0).getString("appid");
-            this.secret = rows.get(0).getString("secret");
-        }
-        this.systemclient = systemclient;
-    }
-
-    private String getAccessToken() throws YosException {
-        long nowtime = Calendar.getInstance().getTimeInMillis();
-        if (!access_tokenMap.containsKey(systemclient) || access_tokenMap.get(systemclient).equals("") || !access_token_timelimitMap.containsKey(systemclient) || access_token_timelimitMap.get(systemclient) < nowtime) {
-            String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + this.appid + "&secret=" + this.secret;
-            String res = new WebRequest().doGet(url);
-            JSONObject resobject = JSONObject.parseObject(res);
-            if (resobject.containsKey("access_token")) {
-                access_tokenMap.put(systemclient, resobject.getString("access_token"));
-                access_token_timelimitMap.put(systemclient, nowtime + 1000 * resobject.getIntValue("expires_in"));
-            } else {
-                access_tokenMap.put(systemclient, "");
-            }
-        }
-        return access_tokenMap.get(systemclient);
-    }
-
-    public JSONArray getTemplate_List() throws YosException {
-        String url = "https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=" + getAccessToken();
-        String result = new WebRequest().doGet(url);
-        JSONObject object = JSONObject.parseObject(result);
-        if (object.getStringValue("errcode").equals("40001")) {
-            access_token_timelimitMap.remove(systemclient);
-        }
-        if (object.containsKey("template_list")) {
-            return object.getJSONArray("template_list");
-        }
-        return new JSONArray();
-    }
-
-    /**
-     * @param userid
-     * @param template_id
-     * @param client_msg_id          本地消息ID
-     * @param tourl
-     * @param datamap
-     * @param tominiprogram_appid
-     * @param tominiprogram_pagepath
-     * @throws YosException
-     */
-    public void send(long userid, String template_id, String client_msg_id, String tourl, HashMap<String, String> datamap, String tominiprogram_appid, String tominiprogram_pagepath) throws YosException {
-        Rows rows = new DBConnect().runSqlQuery("select openid from sys_wechatapp_openids where systemclient='" + systemclient + "' and userid=" + userid);
-        for (Row row : rows) {
-            JSONObject object = new JSONObject();
-            object.put("touser", row.getString("openid"));
-            object.put("template_id", template_id);
-            if (!tourl.equals("")) {
-                object.put("tourl", tourl);
-            }
-            if (!tominiprogram_appid.equals("") && !tominiprogram_pagepath.equals("")) {
-                JSONObject miniprogramObject = new JSONObject();
-                miniprogramObject.put("appid", tominiprogram_appid);
-                miniprogramObject.put("pagepath", tominiprogram_pagepath);
-                object.put("miniprogram", miniprogramObject);
-            }
-            object.put("client_msg_id", client_msg_id);
-            JSONObject dataobject = new JSONObject();
-            for (String keyword : datamap.keySet()) {
-                JSONObject keyObject = new JSONObject();
-                keyObject.put("value", datamap.get(keyword));
-                dataobject.put(keyword, keyObject);
-            }
-            object.put("data", dataobject);
-
-            String url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + getAccessToken();
-            new WebRequest().doPost(object.toString(), url);
-        }
-    }
-
-
-    /**
-     * 根据code获取微信的openid和unionid
-     *
-     * @param wechat_code
-     * @return
-     */
-    public WechatUserID getWechatUserID(String wechat_code) throws YosException {
-        WechatUserID wechatUserID = new WechatUserID();
-        WebRequest request = new WebRequest();
-        String result = request.doGet("https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + appid + "&secret=" + secret + "&code=" + wechat_code + "&grant_type=authorization_code");
-        JSONObject openidobject = JSONObject.parseObject(result);
-        wechatUserID.setSucc(openidobject.containsKey("openid"));
-        if (openidobject.containsKey("openid")) {
-            wechatUserID.setOpenid(openidobject.getString("openid"));
-
-            String result2 = request.doGet("https://api.weixin.qq.com/cgi-bin/user/info?access_token=" + getAccessToken() + "&openid=" + openidobject.getString("openid") + "&lang=zh_CN");
-            JSONObject unionidobject = JSONObject.parseObject(result2);
-
-            if (unionidobject.containsKey("unionid")) {
-                wechatUserID.setUnionid(unionidobject.getString("unionid"));
-            }
-        }
-        wechatUserID.setResult(result);
-        return wechatUserID;
-    }
-
-
-    @Override
-    public String switchTextMsg(String Content, String FromUserName,
-                                String ToUserName) {
-        return createMsg.createTextMsg(Content, FromUserName,
-                ToUserName);
-    }
-
-    @Override
-    public String switchClickEventMsg(String EventKey, String FromUserName,
-                                      String ToUserName) {
-        return createMsg.createTextMsg("您点击的按钮键值是:" + EventKey,
-                FromUserName, ToUserName);
-    }
-
-    @Override
-    public String switchImageMsg(String PicUrl, String MediaId,
-                                 String FromUserName, String ToUserName) {
-        return createMsg.createTextMsg("图片地址:" + PicUrl, FromUserName,
-                ToUserName);
-        /*
-         * String savefile = Parameter.SaveFile.Image + FromUserName + "_" +
-         * Calendar.getInstance().getTimeInMillis() + ".jpg";// 文件保存地址 DownLoad
-         * downLoad = new DownLoad(MediaId, savefile); return
-         * createMsg.createTextMsg("图片上传成功\n大小:" + downLoad.getfilesize() +
-         * "\n网络地址:" + PicUrl, FromUserName, ToUserName);
-         */
-    }
-
-    @Override
-    public String switchVoiceMsg(String MediaId, String Format,
-                                 String FromUserName, String ToUserName) {
-        return createMsg.createTextMsg("媒体ID:" + MediaId, FromUserName,
-                ToUserName);
-        /*
-         * String savefile = Parameter.SaveFile.Voice + FromUserName + "_" +
-         * Calendar.getInstance().getTimeInMillis() + "." + Format;// 文件保存地址
-         * DownLoad downLoad = new DownLoad(MediaId, savefile); return
-         * createMsg.createTextMsg("音频上传成功\n格式:" + Format + "\n大小:" +
-         * downLoad.getfilesize(), FromUserName, ToUserName);
-         */
-    }
-
-    @Override
-    public String switchVideoMsg(String MediaId, String ThumbMediaId,
-                                 String FromUserName, String ToUserName) {
-        return createMsg.createTextMsg("媒体ID:" + MediaId, FromUserName,
-                ToUserName);
-        /*
-         * String savefile = Parameter.SaveFile.video + FromUserName + "_" +
-         * Calendar.getInstance().getTimeInMillis() + ".rm";// 文件保存地址 DownLoad
-         * downLoad = new DownLoad(MediaId, savefile); return
-         * createMsg.createTextMsg("视频上传成功\n大小:" + downLoad.getfilesize(),
-         * FromUserName, ToUserName);
-         */
-    }
-
-    @Override
-    public String switchShortvideoMsg(String MediaId, String ThumbMediaId,
-                                      String FromUserName, String ToUserName) {
-        return createMsg.createTextMsg("媒体ID:" + MediaId, FromUserName,
-                ToUserName);
-        /*
-         * String savefile = Parameter.SaveFile.shortvideo + FromUserName + "_"
-         * + Calendar.getInstance().getTimeInMillis() + ".rm";// 文件保存地址 DownLoad
-         * downLoad = new DownLoad(MediaId, savefile);
-         *
-         * return createMsg.createTextMsg("小视频上传成功\n大小:" +
-         * downLoad.getfilesize(), FromUserName, ToUserName);
-         */
-    }
-
-    @Override
-    public String switchLocationMsg(String Location_X, String Location_Y,
-                                    String Scale, String Label, String FromUserName, String ToUserName) {
-        return createMsg.createTextMsg("纬度:" + Location_X + "\n经度:"
-                + Location_Y + "\n位置描述:" + Label, FromUserName, ToUserName);
-    }
-
-    /**
-     * 成员关注/取消关注事件
-     */
-    @Override
-    public String switchSubscribeEventMsg(String FromUserName, String ToUserName, String eventtype) {
-        CreateMsg createMsg = new CreateMsg();
-        BaseClass controller = new BaseClass();
-        try {
-            if (eventtype.equalsIgnoreCase("subscribe")) {
-                Rows rows1 = controller.dbConnect.runSqlQuery("select * from sys_wechatapp_openids where openid='" + FromUserName + "'");
-                if (rows1.isEmpty()) {
-                    return createMsg.createTextMsg("此微信未关联E订单系统,请先关联E订单系统", FromUserName, ToUserName);
-                }
-                long sys_wechatapp_openids = controller.createTableID("sys_wechatapp_openids");
-                InsertSQL insert = SQLFactory.createInsertSQL(controller.dbConnect, "sys_wechatapp_openids");
-                insert.setValue("wechatapp_openidsid", sys_wechatapp_openids);
-                insert.setValue("systemclient", systemclient);
-                insert.setValue("openid", FromUserName);
-                insert.setValue("userid", rows1.get(0).getLong("userid"));
-                insert.setValue("userinfo", rows1.get(0).getString("userinfo"));
-                insert.insert();
-                return createMsg.createTextMsg("绑定成功", FromUserName, ToUserName);
-            } else {
-                DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(controller.dbConnect, "sys_wechatapp_openids");
-                deleteSQL.setWhere("systemclient", systemclient);
-                deleteSQL.setWhere("openid", FromUserName);
-                deleteSQL.delete();
-                return "";
-            }
-        } catch (YosException e) {
-            System.out.println(e.getMessage());
-            return "";
-        }
-
-    }
-
-    @Override
-    public String switchViewEventMsg(String EventKey, String FromUserName,
-                                     String ToUserName) {
-        return null;
-    }
-
-    @Override
-    public String switchScancode_pushEventMsg(String EventKey, String ScanType,
-                                              String ScanResult, String FromUserName, String ToUserName) {
-
-        String strs[] = ScanResult.split(",");
-        return createMsg.createTextMsg("类型:" + ScanType + "\n条码格式:" + strs[0]
-                + "\n条码内容:" + strs[1], FromUserName, ToUserName);
-    }
-
-    @Override
-    public String switchScancode_waitmsgEventMsg(String EventKey,
-                                                 String ScanType, String ScanResult, String FromUserName,
-                                                 String ToUserName) {
-
-        if (ScanType.equals("barcode")) {
-            String strs[] = ScanResult.split(",");
-            return createMsg.createTextMsg("类型:" + ScanType + "\n条码格式:"
-                    + strs[0] + "\n条码内容:" + strs[1], FromUserName, ToUserName);
-        } else {
-            return createMsg.createTextMsg("类型:" + ScanType + "\n条码内容:"
-                    + ScanResult, FromUserName, ToUserName);
-        }
-
-    }
-
-    @Override
-    public String switchEnter_agentEventMsg(String EventKey,
-                                            String FromUserName, String ToUserName) {
-        return null;
-    }
-
-    /**
-     * 位置事件
-     */
-    @Override
-    public String switchLocationEventMsg(String Latitude,
-                                         String Longitude, String Precision, String FromUserName,
-                                         String ToUserName) {
-        return createMsg.createTextMsg("您当前所处的位置是\n纬度:" + Latitude + "\n经度:"
-                + Longitude, FromUserName, ToUserName);
-
-    }
-
-
-}

+ 0 - 176
src/custom/beans/wechatIndex/WechatServiceMsgRecevier.java

@@ -1,176 +0,0 @@
-package beans.wechatIndex;
-
-import common.YosException;
-import utility.wechat.work.receive.core.CreateMsg;
-
-public abstract class WechatServiceMsgRecevier {
-	public CreateMsg createMsg;
-	public WechatServiceMsgRecevier() {
-		createMsg = new CreateMsg();
-	}
-	/**
-	 * 文字消息处理
-	 *
-	 * @param Content
-	 *            文字消息内容
-	 * @param FromUserName
-	 * @param ToUserName
-	 * @return 返回的xml内容
-	 */
-	public abstract String switchTextMsg(String Content, String FromUserName,
-			String ToUserName);
-
-	/**
-	 * 图片消息处理
-	 *
-	 * @param PicUrl
-	 *            图片的地址
-	 * @param MediaId
-	 * @param FromUserName
-	 * @param ToUserName
-	 * @return 返回的xml内容
-	 */
-	public abstract String switchImageMsg(String PicUrl, String MediaId,
-			String FromUserName, String ToUserName);
-
-	/**
-	 * 音频消息处理
-	 *
-	 * @param MediaId
-	 * @param Format
-	 *            语音格式
-	 * @param FromUserName
-	 * @param ToUserName
-	 * @return
-	 */
-	public abstract String switchVoiceMsg(String MediaId, String Format,
-			String FromUserName, String ToUserName);
-
-	/**
-	 * 视频消息处理
-	 *
-	 * @param MediaId
-	 * @param ThumbMediaId
-	 *            视频消息缩略图的媒体id,可以调用获取媒体文件接口拉取数据
-	 * @param FromUserName
-	 * @param ToUserName
-	 * @return
-	 */
-	public abstract String switchVideoMsg(String MediaId, String ThumbMediaId,
-			String FromUserName, String ToUserName);
-
-	/**
-	 * 小视频消息处理
-	 *
-	 * @param MediaId
-	 * @param ThumbMediaId
-	 *            视频消息缩略图的媒体id,可以调用获取媒体文件接口拉取数据
-	 * @param FromUserName
-	 * @param ToUserName
-	 * @return
-	 */
-	public abstract String switchShortvideoMsg(String MediaId,
-			String ThumbMediaId, String FromUserName, String ToUserName);
-
-	/**
-	 * 位置消息处理
-	 *
-	 * @param Location_X
-	 *            纬度
-	 * @param Location_Y
-	 *            经度
-	 * @param Scale
-	 *            地图缩放大小
-	 * @param Label
-	 *            地理位置信息
-	 * @param FromUserName
-	 * @param ToUserName
-	 * @return
-	 */
-	public abstract String switchLocationMsg(String Location_X,
-			String Location_Y, String Scale, String Label, String FromUserName,
-			String ToUserName);
-
-	/**
-	 * 成员关注取消事件处理
-	 *
-	 * @param FromUserName
-	 * @param ToUserName
-	 * @return
-	 */
-	public abstract String switchSubscribeEventMsg(
-			String FromUserName, String ToUserName,String eventtype);
-
-	/**
-	 * 上报地理位置事件处理(自动上报)
-	 *
-	 * @param Latitude 纬度
-	 * @param Longitude 经度
-	 * @param Precision 精度
-	 * @param FromUserName
-	 * @param ToUserName
-	 * @return
-	 */
-	public abstract String switchLocationEventMsg(
-			String Latitude, String Longitude, String Precision,
-			String FromUserName, String ToUserName);
-
-	/**
-	 * 点击菜单按钮的事件处理
-	 *
-	 * @param EventKey
-	 *            事件KEY值,与自定义菜单接口中KEY值对应
-	 * @param FromUserName
-	 * @param ToUserName
-	 * @return
-	 */
-	public abstract String switchClickEventMsg(String EventKey,
-			String FromUserName, String ToUserName);
-
-	/**
-	 * 点击菜单跳转链接的事件处理
-	 * @param EventKey 事件KEY值,设置的跳转URL
-	 * @param FromUserName
-	 * @param ToUserName
-	 * @return
-	 */
-	public abstract String switchViewEventMsg(String EventKey,
-			String FromUserName, String ToUserName);
-
-	/**
-	 * 成员进入应用的事件处理
-	 * @param EventKey 事件KEY值,此事件该值为空
-	 * @param FromUserName
-	 * @param ToUserName
-	 * @return
-	 */
-	public abstract String switchEnter_agentEventMsg(String EventKey,
-			String FromUserName, String ToUserName);
-
-	/**
-	 * 扫码推事件的事件处理
-	 * @param EventKey 事件KEY值,由开发者在创建菜单时设定
-	 * @param ScanType 扫描类型,一般是qrcode
-	 * @param ScanResult 扫描结果,即二维码对应的字符串信息
-	 * @param FromUserName
-	 * @param ToUserName
-	 * @return
-	 */
-	public abstract String switchScancode_pushEventMsg(String EventKey,
-			String ScanType, String ScanResult, String FromUserName,
-			String ToUserName);
-
-	/**
-	 * 扫码推事件且弹出“消息接收中”提示框的事件处理
-	 * @param EventKey 事件KEY值,由开发者在创建菜单时设定
-	 * @param ScanType 扫描类型,一般是qrcode
-	 * @param ScanResult 扫描结果,即二维码对应的字符串信息
-	 * @param FromUserName
-	 * @param ToUserName
-	 * @return
-	 */
-	public abstract String switchScancode_waitmsgEventMsg(String EventKey,
-			String ScanType, String ScanResult, String FromUserName,
-			String ToUserName);
-
-}

+ 0 - 10
web/WEB-INF/web.xml

@@ -41,16 +41,6 @@
         <url-pattern>/servlet/index</url-pattern>
     </servlet-mapping>
 
-    <servlet>
-        <servlet-name>wechatServlet</servlet-name>
-        <servlet-class>beans.wechatIndex.WechatIndex</servlet-class>
-        <load-on-startup>2</load-on-startup>
-    </servlet>
-
-    <servlet-mapping>
-        <servlet-name>wechatServlet</servlet-name>
-        <url-pattern>/weChat/wechat</url-pattern>
-    </servlet-mapping>
 
 <!--    <context-param>-->
 <!--        <param-name>BIRT_VIEWER_LOCALE</param-name>-->