|
@ -1,9 +1,12 @@
|
|
|
package com.yihu.jw.care.endpoint.common;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.care.aop.ObserverRequired;
|
|
|
import com.yihu.jw.care.service.message.PatientMessageService;
|
|
|
import com.yihu.jw.care.util.MessageDigestUtil;
|
|
|
import com.yihu.jw.care.util.MessageUtil;
|
|
|
import com.yihu.jw.care.util.WeatherUtil;
|
|
|
import com.yihu.jw.entity.base.wx.WxWechatDO;
|
|
|
import com.yihu.jw.entity.care.weather.BaseWeatherDayDO;
|
|
|
import com.yihu.jw.entity.care.weather.BaseWeatherWeekDO;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
@ -12,9 +15,13 @@ import com.yihu.jw.restmodel.web.Envelop;
|
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
import com.yihu.jw.rm.patient.PatientRequestMapping;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.wechat.dao.WechatDao;
|
|
|
import com.yihu.jw.wechat.service.WechatInfoService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -23,7 +30,10 @@ import org.springframework.http.MediaType;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
/**
|
|
|
* Created by yeshijie on 2022/7/28.
|
|
@ -41,6 +51,44 @@ public class CommonController extends EnvelopRestEndpoint {
|
|
|
private PatientMessageService patientMessageService;
|
|
|
@Resource
|
|
|
private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
|
|
|
@Resource
|
|
|
private WechatInfoService wechatInfoService;
|
|
|
@Resource
|
|
|
private WechatDao wechatDao;
|
|
|
|
|
|
@PostMapping(value = "open/getSign")
|
|
|
@ApiOperation(value = "获取微信签名", notes = "获取微信签名")
|
|
|
@ObserverRequired
|
|
|
public Envelop getSign(@ApiParam(name = "pageUrl", value = "授权页面")
|
|
|
@RequestParam(value = "pageUrl", required = true)String pageUrl,
|
|
|
@ApiParam(name = "wxId", value = "微信id")
|
|
|
@RequestParam(value = "wxId", required = true)String wxId){
|
|
|
try{
|
|
|
logger.info("pageUrl="+pageUrl);
|
|
|
logger.info("wxId="+wxId);
|
|
|
String ticket = wechatInfoService.getJsapi_ticketByToken(wxId);
|
|
|
WxWechatDO wxWechatDO = wechatDao.findById(wxId);
|
|
|
Map<Object, Object> map = new HashMap<Object, Object>();
|
|
|
if (ticket != null) {
|
|
|
String noncestr = UUID.randomUUID().toString();
|
|
|
long timestamp = System.currentTimeMillis() / 1000;
|
|
|
String url = pageUrl;
|
|
|
logger.info("getSign.url="+url);
|
|
|
String str = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url;
|
|
|
logger.info("getSign.str="+str);
|
|
|
// sha1加密
|
|
|
String signature = MessageDigestUtil.SHA1(str);
|
|
|
map.put("noncestr", noncestr);
|
|
|
map.put("timestamp", timestamp);
|
|
|
map.put("signature", signature);
|
|
|
map.put("appid", wxWechatDO.getAppId());
|
|
|
return success(PatientRequestMapping.Wechat.api_success,map);
|
|
|
}
|
|
|
return failed(PatientRequestMapping.Wechat.api_error);
|
|
|
}catch (Exception e){
|
|
|
return failedException2(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "open/getCloudCareUrl")
|
|
|
@ApiOperation(value = "获取云照护url")
|