Selaa lähdekoodia

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wsl 2 vuotta sitten
vanhempi
commit
e9bc41d3b7

+ 13 - 25
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/patient/PatientNoLoginEndPoint.java

@ -17,7 +17,7 @@ import com.yihu.jw.wechat.service.WechatInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.axis.utils.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
@ -61,8 +61,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
     * @return
     */
    @RequestMapping(value = "/getXOpenidByCode", method = {RequestMethod.POST, RequestMethod.GET})
    public Envelop getXOpenidByCode(String code, @RequestParam(value = "patientId", required = false)String patientId) throws Exception {
    public Envelop getXOpenidByCode(String code){
        try {
            //通过redis获取openid, 获取不到,则调用微信接口去取
            String key = wxId+":code";
@ -71,30 +70,19 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                return success(PatientRequestMapping.Wechat.api_success,openid);
            }
            org.json.JSONObject json = wechatInfoService.getXOpenidByCode(code, wxId);
            if (!StringUtils.isEmpty(patientId)){
            if(json.has("openid")){
                openid = json.getString("openid");
                String unionid = json.getString("unionid");
                List<BasePatientWechatDo> list = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patientId);
                if (list!=null&&list.size()>0){
                    for (BasePatientWechatDo basePatientWechatDo:list){
                        basePatientWechatDo.setXopenid(openid);
                        basePatientWechatDo.setUnionid(unionid);
                        basePatientWechatDao.save(basePatientWechatDo);
                    }
                }else {
                    BasePatientWechatDo basePatientWechatDo = new BasePatientWechatDo();
                    basePatientWechatDo.setPatientId(patientId);
                    basePatientWechatDo.setWechatId(wxId);
                    basePatientWechatDo.setCreateTime(new Date());
                    basePatientWechatDo.setXopenid(openid);
                    basePatientWechatDo.setUnionid(unionid);
                    basePatientWechatDao.save(basePatientWechatDo);
                }
                JSONObject res = new JSONObject();
                res.put("openid",openid);
                res.put("unionid",json.getString("unionid"));
                res.put("session_key",json.getString("session_key"));
                redisTemplate.opsForValue().set(key,openid);
                redisTemplate.expire(key,10, TimeUnit.SECONDS);
                return success(PatientRequestMapping.Wechat.api_success,res);
            }else {
                return Envelop.getError("获取失败");
            }
            redisTemplate.opsForValue().set(key,openid);
            redisTemplate.expire(key,10, TimeUnit.SECONDS);
            return success(PatientRequestMapping.Wechat.api_success,json);
        } catch (Exception e){
            return  failedException2(e);
        }

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/wechat/WeiXinEventProcess.java

@ -179,7 +179,7 @@ public class WeiXinEventProcess {
        Map<String, String> oldzhaohuService = new HashMap<>();
        // 图文URL
        String urlOld = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=https%3A%2F%2Fzhyzh.gongshu.gov.cn%2Fhlwyy%2Fmedical-care-patient%2FtoGround%2Findex%3FVNK%3Db80dd777";
        String urlOld = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=https%3A%2F%2Fzhyzh.gongshu.gov.cn%2Fmedical-care-patient%2FtoGround%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        urlOld = urlOld.replace("{appId}", appId);
        oldzhaohuService.put("Url", urlOld);
        oldzhaohuService.put("Title", "老人照护服务介绍");

+ 3 - 3
svr/svr-cloud-care/src/main/resources/application.yml

@ -258,9 +258,9 @@ es:
  host:  http://172.26.0.112:9000
  tHost: 172.26.0.112:9300
  clusterName: jkzl
  securityUser: lion:jkzlehr
  user: lion
  password: jkzlehr
  securityUser: zjxl:6Dbq&fHg
  user: zjxl
  password: 6Dbq&fHg
# 上传文件临时路径配置
FileTempPath: