Browse Source

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

liubing 3 years ago
parent
commit
4dd8f3a90a

+ 0 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SpringSecurityAuditorAware.java

@ -7,12 +7,6 @@ import org.springframework.data.domain.AuditorAware;
public class SpringSecurityAuditorAware implements AuditorAware {
    @Override
    public Object getCurrentAuditor() {
//        return Optional.ofNullable(SecurityContextHolder.getContext())
//                .map(SecurityContext::getAuthentication)
//                .filter(Authentication::isAuthenticated)
//                .map(Authentication::getPrincipal);
////                .map(Authentication::getDetails);
        return "123";
    }
}

+ 0 - 30
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/TencentSmsConfig.java

@ -1,30 +0,0 @@
//package com.yihu.jw.care.config;
//
//import java.util.HashMap;
//import java.util.Map;
//import java.util.logging.Handler;
//
///**
// * 腾讯云SMS配置
// * Created by Bing on 2021/5/19.
// */
//public class TencentSmsConfig {
//
//    public static final String SecretId= "AKIDjGXYIlyua080cy3rOfgRv96mBLDo8ByU";
//    public static final String SecretKey= "GEwOZS5SYNvCCuLVO0LQFm21jAKCn7Bz";
//
//    public static final String host = "sms.tencentcloudapi.com";//
//
//    public static final Map<String,String> templateId= new HashMap<>();
//
//    public static final Long overTime = 24L;
//
//    {
//        templateId.put("VerificationCode","验证码模板id");//验证码模板id
//    }
//
//    public static String getTemplateId(String key){
//        return templateId.get(key);
//    }
//}
//

+ 7 - 7
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/PatientCourseEndpoint.java

@ -122,7 +122,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
//            @ApiParam(name = "currentPage", value = "当前页面", defaultValue = "1") @RequestParam(value = "currentPage", required = true) int currentPage
    ) {
        try {
            JSONObject json = courseService.getCourseByOrg(longitude,latitude);//, pageSize, currentPage
            JSONObject json = courseService.getCourseByOrg(longitude,latitude);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
@ -139,7 +139,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
//            @ApiParam(name = "currentPage", value = "当前页面", defaultValue = "1") @RequestParam(value = "currentPage", required = true) int currentPage
    ) {
        try {
            JSONObject json = courseService.getCourseByteacher(longitude,latitude);//, pageSize, currentPage
            JSONObject json = courseService.getCourseByteacher(longitude,latitude);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
@ -153,7 +153,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "id", value = "课程id", defaultValue = "808080eb7861c327017861d18d070011") @RequestParam(value = "id", required = true) String id
    ) {
        try {
            JSONObject json = courseService.getCourseInfo(id);//, pageSize, currentPage
            JSONObject json = courseService.getCourseInfo(id);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
@ -168,7 +168,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "patient", value = "居民code", defaultValue = "808080eb7955aa9301795b8bad3f0078") @RequestParam(value = "patient", required = true) String patient
    ) {
        try {
            JSONObject json = courseService.getCatalogue(id,patient);//, pageSize, currentPage
            JSONObject json = courseService.getCatalogue(id,patient);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
@ -182,7 +182,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "id", value = "机构id", defaultValue = "808080eb7861c327017861d18d070011") @RequestParam(value = "id", required = true) String id
    ) {
        try {
            JSONObject json = courseService.getOrgInfoById(id);//, pageSize, currentPage
            JSONObject json = courseService.getOrgInfoById(id);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
@ -199,7 +199,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "size", value = "size", defaultValue = "10") @RequestParam(value = "size", required = true) int size
    ) {
        try {
            JSONObject json = courseService.getTecInfoById(doctor,orgCode,page,size);//, pageSize, currentPage
            JSONObject json = courseService.getTecInfoById(doctor,orgCode,page,size);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
@ -216,7 +216,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "size", value = "size", defaultValue = "10") @RequestParam(value = "size", required = true) int size
    ) {
        try {
            JSONObject json = courseService.getCoursrOrderStatusByPatient(patient,status,page,size);//, pageSize, currentPage
            JSONObject json = courseService.getCoursrOrderStatusByPatient(patient,status,page,size);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();

+ 3 - 71
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/wechat/WechatCoreController.java

@ -76,71 +76,6 @@ public class WechatCoreController extends EnvelopRestEndpoint {
        }
    }
  /* *//*
     * 接收居民微信回复的消息
     *
     * @return
    *//*
    @RequestMapping(method = RequestMethod.POST)
    @ResponseBody
    public void receiveMessages(HttpServletRequest request, HttpServletResponse response) {
        try {
            String signature = request.getParameter("signature").toString();
            String timestamp = request.getParameter("timestamp").toString();
            String nonce = request.getParameter("nonce").toString();
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            if (validate(signature, timestamp, nonce)) {
                String xmlStr = weiXinCoreService.messageProcess(request, wxAccessTokenDO.getAccessToken());
                // 判断返回值是xml、json格式(取关是空串)
                Boolean flag = weiXinCoreService.isXML(xmlStr);
                if (xmlStr == "error") {
                    // 服务器错误
                    response.setStatus(500);
                } else if (!flag && StringUtils.isNotEmpty(xmlStr)) {
                    JSONObject json = new JSONObject(xmlStr);
                    if (json.has("openId")) {
                        if (StringUtils.isNotEmpty(json.getString("openId")) && !("undefined".equals(json.getString("openId")))) {
                                try {
                                    logger.info("调用眼科微信模板消息接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+json.getString(""));
                                    weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), json.getString("openId"), json);
                                    logger.info("发送成功");
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    logger.info("发送失败,error="+e.getMessage());
                                }
                                //保存发送模板记录,
                                WxPushLogDO wxPushLogDO = new WxPushLogDO();
                                wxPushLogDO.setCreateTime(new Date());
                                wxPushLogDO.setOpenid(json.getString("openId"));
                                wxPushLogDO.setReceiver(null);
                                wxPushLogDO.setWechatId(wechatId);
                                wxPushLogDO.setReceiverName(null);
                                wxPushLogDO.setScene(null);
                                wxPushLogDao.save(wxPushLogDO);
                            }
                        }
                    }
                } else {
                    // 返回消息(图文消息)
                    response.setHeader("Content-type", "text/html;charset=UTF-8");
                    //这句话的意思,是告诉servlet用UTF-8转码,而不是用默认的ISO8859
                    response.setCharacterEncoding("UTF-8");
                    response.getWriter().print(null);
                }
            } else {
                // 验证失败
                response.setStatus(401);
            }
        } catch (Exception e) {
            e.printStackTrace();
            // 服务器错误
            response.setStatus(500);
        }
    }*/
    /**
     * 接收居民微信回复的消息
     *
@ -193,8 +128,7 @@ public class WechatCoreController extends EnvelopRestEndpoint {
            response.setStatus(500);
        }
    }
     /*
     * 微信推送消息验证
     /** 微信推送消息验证
     *
     * @param signature
     * @param timestamp
@ -227,8 +161,7 @@ public class WechatCoreController extends EnvelopRestEndpoint {
        }
    }
    /*
     * 将字节数组转换为字符串
    /** 将字节数组转换为字符串
     *
     * @param byteArray
     * @return
@ -243,8 +176,7 @@ public class WechatCoreController extends EnvelopRestEndpoint {
    /*
     * 将字节转换为字符
    /** 将字节转换为字符
     *
     * @param mByte
     * @return

+ 22 - 8
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/ConstantUtil.java

@ -43,6 +43,13 @@ public class ConstantUtil {
     emergency_reason //紧急预警工单发起原因
     emergency_treatment_status //紧急预警工单处理结果
     emergency_cancel //紧急预警工单取消状态
     courseStatus 课程状态
     courseType 课程类型
     pay_type 付款方式
     orderPayStatus //订单支付状态
     liveStatus 直播状态
     intake 摄入量
     refundStatus 退款状态
     */
    public static final String DICT_ARCHIVETYPE = "archiveType";
    public static final String DICT_ARCHIVESTATUS = "archiveStatus";
@ -55,15 +62,22 @@ public class ConstantUtil {
    public static final String DICT_SERVICE_TYPE = "service_type";
    public static final String DICT_LABEL_TYPE = "label_type";
    public static final String DICT_LEVEL_CONCLUSION = "level_conclusion";
    public static final String DICT_SERVICEPACKAGESTATUS= "servicePackageStatus";
    public static final String DICT_CAPACITY_AGREE_STATUS= "capacity_agree_status";
    public static final String DICT_SEX= "sex";
    public static final String DICT_EMERGENCY_ASSISTANCE_MESSAGE= "emergency_assistance_message";
    public static final String DICT_EMERGENCY_ASSISTANCE_CALL= "emergency_assistance_call";
    public static final String DICT_FOODCLASSIFICATION= "foodClassification";
    public static final String DICT_SERVICEPACKAGESTATUS = "servicePackageStatus";
    public static final String DICT_CAPACITY_AGREE_STATUS = "capacity_agree_status";
    public static final String DICT_SEX = "sex";
    public static final String DICT_EMERGENCY_ASSISTANCE_MESSAGE = "emergency_assistance_message";
    public static final String DICT_EMERGENCY_ASSISTANCE_CALL = "emergency_assistance_call";
    public static final String DICT_FOODCLASSIFICATION = "foodClassification";
    public static final String DICT_EMERGENCY_REASON = "emergency_reason";
    public static final String DICT_EMERGENCY_TREATMENT_STATUS= "emergency_treatment_status";
    public static final String DICT_EMERGENCY_CANCEL= "emergency_cancel";
    public static final String DICT_EMERGENCY_TREATMENT_STATUS = "emergency_treatment_status";
    public static final String DICT_EMERGENCY_CANCEL = "emergency_cancel";
    public static final String DICT_course_Status = "courseStatus";
    public static final String DICT_course_type = "courseType";
    public static final String DICT_pay_type = "pay_type";
    public static final String DICT_porderPayStatus = "orderPayStatus";
    public static final String DICT_liveStatus = "liveStatus";
    public static final String DICT_intake = "intake";
    public static final String DICT_refundStatus = "refundStatus";
}

+ 0 - 142
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/TencentSmsUtil.java

@ -1,142 +0,0 @@
//package com.yihu.jw.care.util;
//
//import com.tencentcloudapi.common.Credential;
//import com.tencentcloudapi.common.exception.TencentCloudSDKException;
//import com.tencentcloudapi.common.profile.ClientProfile;
//import com.tencentcloudapi.common.profile.HttpProfile;
//import com.tencentcloudapi.sms.v20190711.SmsClient;
//import com.tencentcloudapi.sms.v20190711.models.SendSmsRequest;
//import com.tencentcloudapi.sms.v20190711.models.SendSmsResponse;
//import com.yihu.jw.care.config.TencentSmsConfig;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.StringRedisTemplate;
//import org.springframework.stereotype.Component;
//
//import java.util.Iterator;
//import java.util.List;
//import java.util.concurrent.TimeUnit;
//
///**
// * Created by Bing on 2021/5/19.
// */
//@Component
//public class TencentSmsUtil {
//
//    @Autowired
//    private StringRedisTemplate redisTemplate;
//    private TencentSmsConfig tencentSmsConfig = new TencentSmsConfig();
//
//    /**
//     *  获取短信验证码
//     * @param phoneNumberList 手机列表
//     * @param templateParamList 参数列表
//     * @param type 模板key VerificationCode:手机验证码
//     * @return
//     */
//    public String SendSms(List<String> phoneNumberList, List<String> templateParamList,String type) {
//        try {
//            Iterator<String> iterator = phoneNumberList.iterator();
//            if ("VerificationCode".equals(type)){//超过10次无法再发送短信验证码
//                while (iterator.hasNext()) {
//                    String phone = iterator.next();
//                    if (redisTemplate.hasKey("tencentSmsVFCode-" + phone)) {//验证码每天上限10次
//                        Integer count = Integer.valueOf(redisTemplate.opsForValue().get("tencentSmsVFCode-" + phone));
//                        if (count > 10) {
//                            iterator.remove();
//                        }else {
//                            count++;
//                            Long expire = redisTemplate.boundHashOps("tencentSmsVFCode-" + phone).getExpire();
//                            redisTemplate.opsForValue().set("tencentSmsVFCode-" + phone,count+"",expire, TimeUnit.SECONDS);
//                        }
//                    }
//                    else {
//                        int count =1;
//                        redisTemplate.opsForValue().set("tencentSmsVFCode-" + phone,count+"",tencentSmsConfig.overTime, TimeUnit.HOURS);
//                    }
//                }
//            }
//            String[] phoneNumbers = phoneNumberList.toArray(new String[0]);
//            String[] templateParams = templateParamList!=null?templateParamList.toArray(new String[0]):null;
//            Credential cred = new Credential(tencentSmsConfig.SecretId, tencentSmsConfig.SecretKey);
//            HttpProfile httpProfile = new HttpProfile();
//            // 设置代理
////            httpProfile.setProxyHost("host");
////            httpProfile.setProxyPort(port);
//            httpProfile.setReqMethod("POST");
//            httpProfile.setConnTimeout(60);
//            httpProfile.setEndpoint("sms.tencentcloudapi.com");
//            ClientProfile clientProfile = new ClientProfile();
//
//            /** SDK默认用TC3-HMAC-SHA256进行签名
//             * 非必要请不要修改这个字段 */
//            clientProfile.setSignMethod("HmacSHA256");
//            clientProfile.setHttpProfile(httpProfile);
//
//            /** 实例化要请求产品(以sms为例)的client对象
//             * 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,或者引用预设的常量 */
//            SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);
//            SendSmsRequest req = new SendSmsRequest();
//
//            /* 短信应用ID: 短信SdkAppid在 [短信控制台] 添加应用后生成的实际SdkAppid,示例如1400006666 */
//            String appid = "1400009099";
//            req.setSmsSdkAppid(appid);
//
//            /* 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名,签名信息可登录 [短信控制台] 查看 */
//            String sign = "签名内容";
//            req.setSign(sign);
//
//            /* 模板 ID: 必须填写已审核通过的模板 ID。模板ID可登录 [短信控制台] 查看 */
//            String templateID = tencentSmsConfig.getTemplateId(type);
//            req.setTemplateID(templateID);
//
//            /** 下发手机号码,采用 e.164 标准,+[国家或地区码][手机号]
//             * 示例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号
//             * */
//            req.setPhoneNumberSet(phoneNumbers);
//
//            /** 模板参数: 若无模板参数,则设置为空
//             String[] templateParams = {"5678"};*/
//            req.setTemplateParamSet(templateParams);
//
//            /** 通过 client 对象调用 SendSms 方法发起请求。注意请求方法名与请求对象是对应的
//             * 返回的 res 是一个 SendSmsResponse 类的实例,与请求对象对应 */
//            SendSmsResponse res = client.SendSms(req);
//
//            // 输出json格式的字符串回包
//            System.out.println(SendSmsResponse.toJsonString(res));
//            // 也可以取出单个值,你可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义
//            System.out.println(res.getRequestId());
//            return SendSmsResponse.toJsonString(null);
//        } catch (TencentCloudSDKException e) {
//            e.printStackTrace();
//            return null;
//        }
//    }
//}
///**        返回值
// *{
// *   "Response": {
// *     "SendStatusSet": [
// *       {
// *         "SerialNo": "5000:1045710669157053657849499619", 发送流水号。
// *         "PhoneNumber": "+8618511122233",
// *         "Fee": 1, 计费条数,计费规则请查询
// *         "SessionContext": "test",
// *         "Code": "Ok", 短信请求状态码
// *         "Message": "send success",
// *         "IsoCode": "CN"
// *       },
// *       {
// *         "SerialNo": "5000:104571066915705365784949619",
// *         "PhoneNumber": "+8618511122266",
// *         "Fee": 1,
// *         "SessionContext": "test",
// *         "Code": "Ok",
// *         "Message": "send success",
// *         "IsoCode": "CN"
// *       }
// *     ],
// *     "RequestId": "a0aabda6-cf91-4f3e-a81f-9198114a2279"
// *   }
// * }
// */