ソースを参照

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

wangzhinan 5 年 前
コミット
dbe530d423

+ 37 - 1
business/base-service/src/main/java/com/yihu/jw/wechat/enterprise/EnterpriseService.java

@ -85,6 +85,42 @@ public class EnterpriseService {
        return token.getAccessToken();
    }
    public String getXCXToken(String enterpriseId)throws Exception{
        logger.info("getXCXToken");
        WxEnterpriseDO wxEnterpriseDO = wxEnterpriseDao.findOne(enterpriseId+"_xcx");
        List<WxEnterpriseTokenDO> wxEnterpriseTokenDOs = wxEnterpriseTokenDao.findByCodeOrderByCreateTimeDesc(enterpriseId+"_xcx");
        if(wxEnterpriseTokenDOs!=null&&wxEnterpriseTokenDOs.size()>0) {
            logger.info("token size:"+wxEnterpriseTokenDOs.size());
            WxEnterpriseTokenDO tokenDO = wxEnterpriseTokenDOs.get(0);
            if (tokenDO.getExpiresTime().after(new Date())) {
                return tokenDO.getAccessToken();
            }else{
                wxEnterpriseTokenDao.delete(wxEnterpriseTokenDOs);
            }
        }
        String result = HttpUtil.sendGet("https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid="+wxEnterpriseDO.getCorpid()+"&corpsecret="+wxEnterpriseDO.getCorpsecret());
        logger.info("getToken result:"+result);
        JSONObject json = JSONObject.parseObject(result);
        //保存当前token
        WxEnterpriseTokenDO token = new WxEnterpriseTokenDO();
        Date date = new Date();
        token.setAccessToken(json.getString("access_token"));
        token.setCreateTime(date);
        token.setExpiresTime(DateUtil.setDateHours(date,2));
        token.setCode(enterpriseId+"_xcx");
        wxEnterpriseTokenDao.save(token);
        return token.getAccessToken();
    }
    public String sendTextMes(String enterpriseId,String userId,String content)throws Exception{
        String url = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token="+getToken(enterpriseId);
@ -307,7 +343,7 @@ public class EnterpriseService {
     */
    public String sendXCXMes(String enterpriseId, String userId, String appid,String page, String title, String description, Boolean emphasis_first_item, String content_item)throws Exception{
        String mesurl = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token="+getToken(enterpriseId);
        String mesurl = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token="+getXCXToken(enterpriseId);
        JSONObject param = new JSONObject();
        param.put("touser",userId);

+ 4 - 2
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java

@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -88,9 +89,10 @@ public class WxTemplateService {
                        jsonObject.put("mobile",basePatientDO.getMobile());
                        jsonObject.put("openid",basePatientWechatDo.getOpenid());
                        String authCode = jsonObject.toJSONString();
                        String jm = RSAEncrypt.encrypt(authCode,getAuthCode);
                        String miniprogramUrl = "pages/room/room?patientCode="+reciver_id+"&doctorName="+sender_name+"&role=patient&roomID="+session_id+"&template=1v1&debugMode=false&cloudenv=PRO&authCode="+jm+"&code="+wechatId+"&appid="+basePatientDO.getId();
                        String jm = URLEncoder.encode(RSAEncrypt.encrypt(authCode,getAuthCode),"utf-8");
                        String miniprogramUrl = "pages/room/room?patientCode="+reciver_id+"&doctorName="+sender_name+"&role=patient&roomID="+session_id+"&template=1v1&debugMode=false&cloudenv=PRO&authCode="+jm+"&code="+wechatId+"&appId="+basePatientDO.getId();
                        //心脏中心模版消息推送接口
                        logger.info("心脏中心小程序跳转URL:"+miniprogramUrl);
                        xzzxEntranceService.sendXCXMes(wechatId,
                                basePatientDO.getId(),
                                basePatientDO.getIdcard(),

+ 2 - 2
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -1120,7 +1120,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        properties.put("kaptcha.textproducer.font.size", "45");
        properties.put("kaptcha.textproducer.char.length", "4");
        properties.put("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑");
        properties.put("kaptcha.textproducer.char.string","0123456789QWERTYUIOPLKJHGFDSAZXCVBNM");
        properties.put("kaptcha.textproducer.char.string","0123456789");
        Config config = new Config(properties);
        captchaProducer.setConfig(config);
        String captchaText = captchaProducer.createText();
@ -1330,7 +1330,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        } else {
            return ObjEnvelop.getError("验证码错误!");
        }
        String rs = registerService.updateDoctorPw(pw,mobile);
        String rs = registerService.updateDoctorPw(mobile,pw);
        if("ok".equals(rs)){
            return ObjEnvelop.getSuccess("修改成功!");
        }

+ 1 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java

@ -430,7 +430,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
							re.getString("doctor"),
							"wx53f6bb4ac081d840",
							roomUrl,
							p.getName()+"%20专家咨询","您的专家咨询有新的消息",false,"");
							p.getName()+"%20专家咨询","您有新的咨询消息",false,"");
				}else{}