Browse Source

第三方调用接口

wujunjie 7 years ago
parent
commit
f0ff3a0e57

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/feedback/AppealService.java

@ -261,7 +261,7 @@ public class AppealService extends BaseService {
                //wlyy给医生发送系统消息
                //wlyy给医生发送系统消息
                Doctor doctor = doctorDao.findByCode(creater);
                Doctor doctor = doctorDao.findByCode(creater);
                String doctorOpenID = doctor.getOpenid();
                String doctorOpenID = doctor.getOpenid();
                String url = wlyyService + "/doctor/feedback/sendMessage";
                String url = wlyyService + "/third/template/sendMessage";
                List<NameValuePair> params = new ArrayList<>();
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("receiver", creater));
                params.add(new BasicNameValuePair("receiver", creater));
                params.add(new BasicNameValuePair("title", title));
                params.add(new BasicNameValuePair("title", title));

+ 3 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/feedback/FeedbackService.java

@ -217,8 +217,9 @@ public class FeedbackService extends BaseService {
                String patientName = patient.getName();
                String patientName = patient.getName();
                String patientOpendID = patient.getOpenid();
                String patientOpendID = patient.getOpenid();
                if (StringUtils.isNotEmpty(patientOpendID)) {
                if (StringUtils.isNotEmpty(patientOpendID)) {
                    String url = wlyyService + "/patient/feedback/sendTemplate";
                    String url = wlyyService + "/third/template/sendTemplate";
                    List<NameValuePair> params = new ArrayList<>();
                    List<NameValuePair> params = new ArrayList<>();
                    params.add(new BasicNameValuePair("type", "2"));
                    params.add(new BasicNameValuePair("toUser", patientOpendID));
                    params.add(new BasicNameValuePair("toUser", patientOpendID));
                    params.add(new BasicNameValuePair("url", null));
                    params.add(new BasicNameValuePair("url", null));
                    params.add(new BasicNameValuePair("first", "您好!您提交的意见反馈已处理"));
                    params.add(new BasicNameValuePair("first", "您好!您提交的意见反馈已处理"));
@ -252,7 +253,7 @@ public class FeedbackService extends BaseService {
                //wlyy给医生发送系统消息
                //wlyy给医生发送系统消息
                Doctor doctor = doctorDao.findByCode(creater);
                Doctor doctor = doctorDao.findByCode(creater);
                String doctorOpenID = doctor.getOpenid();
                String doctorOpenID = doctor.getOpenid();
                String url = wlyyService + "/doctor/feedback/sendMessage";
                String url = wlyyService + "/third/template/sendMessage";
                List<NameValuePair> params = new ArrayList<>();
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("receiver", creater));
                params.add(new BasicNameValuePair("receiver", creater));
                params.add(new BasicNameValuePair("title", title));
                params.add(new BasicNameValuePair("title", title));

+ 32 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/template/ThirdTemplateController.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.web.third.template;
package com.yihu.wlyy.web.third.template;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.wechat.util.WeiXinTempMsgSendUtils;
import com.yihu.wlyy.wechat.util.WeiXinTempMsgSendUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
@ -24,6 +25,8 @@ public class ThirdTemplateController extends BaseController {
    @Autowired
    @Autowired
    private WeiXinTempMsgSendUtils tempMsgSendUtils;
    private WeiXinTempMsgSendUtils tempMsgSendUtils;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Value("${wechat.message.template_doctor_survey}")
    @Value("${wechat.message.template_doctor_survey}")
    private String template_doctor_survey;
    private String template_doctor_survey;
@ -60,10 +63,35 @@ public class ThirdTemplateController extends BaseController {
        }
        }
    }
    }
    /**
     * 医生端发送系统消息
     * @param receiver 接受者
     * @param title 标题
     * @param content 内容
     * @return
     */
    @RequestMapping(value = "/sendMessage", method = RequestMethod.POST)
    @ApiOperation(value = "医生端发送系统消息")
    @ResponseBody
    @ObserverRequired
    public String saveFeedback(
            @RequestParam String receiver,
            @RequestParam String title,
            @RequestParam String type,
            @RequestParam String content) {
        try {
            pushMsgTask.put(receiver, type, title, content, "");
            return write(200, "发送成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "发送失败!");
        }
    }
    /**
    /**
     * 根据第三方type 匹配对应模板ID
     * 根据第三方type 匹配对应模板ID
     *
     *
     * @param type 1.代办事项
     * @param type 1.代办事项 2.处理结果通知(模板未定)
     * @return
     * @return
     */
     */
    private String getTemplateId(String type) throws Exception {
    private String getTemplateId(String type) throws Exception {
@ -72,6 +100,9 @@ public class ThirdTemplateController extends BaseController {
            case "1":
            case "1":
                templateId = template_doctor_survey;
                templateId = template_doctor_survey;
                break;
                break;
            case "2":
                templateId = "";
                break;
            default:
            default:
                templateId = template_doctor_survey;
                templateId = template_doctor_survey;
                break;
                break;