| | |
| | |
|
| | | import java.io.BufferedReader;
|
| | | import java.io.IOException;
|
| | | import java.io.PrintWriter;
|
| | | import java.security.SignatureException;
|
| | | import java.util.Date;
|
| | |
|
| | |
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
|
| | | import com.yeshi.fanli.dto.push.PushContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState;
|
| | | import com.yeshi.fanli.entity.config.push.PushMsgFactory;
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgDeviceReadStateService;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | | @Controller
|
| | | @RequestMapping("client/v1/callback")
|
| | | public class CallBackController {
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private PushService pushService;
|
| | |
|
| | | @Resource
|
| | | private MsgDeviceReadStateService msgDeviceReadStateService;
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | LogHelper.test("美洽:body----" + sb.toString());
|
| | |
|
| | | String sign = "";
|
| | | try {
|
| | | sign = sign(sb.toString());
|
| | |
| | | else if (contentType.equalsIgnoreCase("audio"))
|
| | | msg = "[语音]";
|
| | | String customizedId = json.optJSONObject("customizedData").optString("设备标识");
|
| | | String uid = json.optJSONObject("customizedData").optString("用户ID");
|
| | | msgDeviceReadStateService.addUnreadDeviceMsg(MsgDeviceReadState.TYPE_KEFU, customizedId,
|
| | | "android".equalsIgnoreCase(deviceOS) ? 1 : 2, 1, msg,new Date());
|
| | | "android".equalsIgnoreCase(deviceOS) ? 1 : 2, 1, msg, new Date());
|
| | | if (!StringUtil.isNullOrEmpty(uid))// 推送客服消息
|
| | | {
|
| | | PushContentDTO dto = PushMsgFactory.createMsgKefu();
|
| | | try {
|
| | | pushService.pushZNX(Long.parseLong(uid), dto.getTitle(), dto.getContent(), null, null);
|
| | | } catch (NumberFormatException e) {
|
| | | e.printStackTrace();
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | LogHelper.test("美洽:body----" + sb.toString());
|
| | | }
|
| | |
|
| | | public String sign(String raw_body) throws java.security.SignatureException {
|
| | |
| | | return "meiqia_sign:" + result;
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "test")
|
| | | public void test(PrintWriter out) {
|
| | | configService.getConfig(1L);
|
| | | out.print("success");
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "vip")
|
| | | public void VIP(PrintWriter out) {
|
| | | out.print("success");
|
| | | }
|
| | |
|
| | | }
|