Преглед изворни кода

Merge branch 'dev' of yeshijie/wlyy2.0 into dev

叶仕杰 пре 3 година
родитељ
комит
f59ce2b926

+ 21 - 2
common/common-util/src/main/java/com/yihu/jw/util/wechat/WeiXinMessageReplyUtils.java

@ -1,6 +1,5 @@
package com.yihu.jw.util.wechat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -26,7 +25,7 @@ public class WeiXinMessageReplyUtils {
        result.append("<xml>");
        result.append("<ToUserName>" + toUser + "</ToUserName>");
        result.append("<FromUserName>" + fromUser + "</FromUserName>");
        result.append("<CreateTime>" + new Date().getTime() + "</CreateTime>");
        result.append("<CreateTime>" + System.currentTimeMillis() + "</CreateTime>");
        result.append("<MsgType>news</MsgType>");
        result.append("<ArticleCount>" + articles.size() + "</ArticleCount>");
        result.append("<Articles>");
@ -45,4 +44,24 @@ public class WeiXinMessageReplyUtils {
        return result.toString();
    }
    /**
     * 文本消息
     * @param toUser
     * @param fromUser
     * @param articles
     * @return
     * @throws Exception
     */
    public static String replyMessage(String toUser,String fromUser,String articles) throws Exception {
        StringBuilder result = new StringBuilder();
        result.append("<xml>");
        result.append("<ToUserName>" + toUser + "</ToUserName>");
        result.append("<FromUserName>" + fromUser + "</FromUserName>");
        result.append("<CreateTime>" + System.currentTimeMillis() + "</CreateTime>");
        result.append("<MsgType>text</MsgType>");
        result.append("<Content>" + articles + "</Content>");
        result.append("</xml>");
        return result.toString();
    }
}

+ 9 - 0
svr/svr-cloud-care/sql/init.sql

@ -4,3 +4,12 @@ INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('hz_yxyzh_wx_sms_signName', NULL, 'hz_yxyzh_wx_sms', 'signName', '朝晖云照护', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('hz_yxyzh_wx_sms_smsSdkAppId', NULL, 'hz_yxyzh_wx_sms', 'smsSdkAppId', '1400526119', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('hz_yxyzh_wx_sms_VerificationCode', NULL, 'hz_yxyzh_wx_sms', 'VerificationCode', '969545', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('808080eb791c71820179644adf58003e', NULL, 'orderPayStatus', '1', '待审核', '', '1', NULL, '2021-05-13 13:54:59.032', '123', NULL, '2021-05-13 13:54:59.032', '123', NULL, '', '订单支付状态');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('808080eb791c71820179644b2373003f', NULL, 'orderPayStatus', '2', '待支付', '', '2', NULL, '2021-05-13 13:55:16.467', '123', NULL, '2021-05-13 13:55:16.467', '123', NULL, '', '订单支付状态');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('808080eb791c71820179644b50730040', NULL, 'orderPayStatus', '3', '已支付', '', '3', NULL, '2021-05-13 13:55:27.987', '123', NULL, '2021-05-13 13:55:27.987', '123', NULL, '', '订单支付状态');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('808080eb791c71820179644bbddc0041', NULL, 'orderPayStatus', '4', '审核未通过', '', '4', NULL, '2021-05-13 13:55:55.996', '123', NULL, '2021-05-13 13:55:55.996', '123', NULL, '', '订单支付状态');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('808080eb791c71820179644c4e7a0043', NULL, 'orderPayStatus', '5', '已退款', '', '5', NULL, '2021-05-13 13:56:33.018', '123', NULL, '2021-05-13 16:02:53.057', '123', NULL, '', '订单支付状态');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('808080eb797db4ce01797e3f387a0003', NULL, 'orderPayStatus', '6', '退款中', '', '6', NULL, '2021-05-18 14:52:23.034', '123', NULL, '2021-05-18 14:52:23.034', '123', NULL, '', '订单支付状态');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('808080eb797db4ce01797e4111060004', NULL, 'orderPayStatus', '7', '已取消', '', '7', NULL, '2021-05-18 14:54:24.006', '123', NULL, '2021-05-18 14:54:24.006', '123', NULL, '', '订单支付状态');

+ 8 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/RecruitStudentsDao.java

@ -1,9 +1,14 @@
package com.yihu.jw.care.dao.course;
import com.yihu.jw.entity.care.course.RecruitStudentsDO;
import com.yihu.jw.entity.followup.Followup;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
@ -13,4 +18,7 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 */
public interface RecruitStudentsDao extends PagingAndSortingRepository<RecruitStudentsDO, String>, JpaSpecificationExecutor<RecruitStudentsDO> {
    @Query("select a from RecruitStudentsDO a where a.orgCode = ?1 and a.startTime < ?2 and a.endTime >?2 and a.del = 1")
    List<RecruitStudentsDO> findByOrgCode(String orgCode, Date nowDate);
}

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

@ -93,6 +93,7 @@ public class WechatCoreController extends EnvelopRestEndpoint {
            if (validate(signature, timestamp, nonce)) {
                String xmlStr = weiXinCoreService.messageProcess(request, wxAccessTokenDO.getAccessToken());
                // 判断返回值是xml、json格式(取关是空串)
                System.out.println("xmlStr==="+xmlStr);
                Boolean flag = weiXinCoreService.isXML(xmlStr);
                if (xmlStr == "error") {
                    // 服务器错误
@ -101,7 +102,6 @@ public class WechatCoreController extends EnvelopRestEndpoint {
                    JSONObject json = new JSONObject(xmlStr);
                    if (json.has("openId")) {
                        if (StringUtils.isNotEmpty(json.getString("openId")) && !("undefined".equals(json.getString("openId")))) {
                            logger.info("调用眼科微信模板消息接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+json.getString(""));
                            WxTemplateConfigDO wxTemplateConfigDO = new WxTemplateConfigDO();
                            wxTemplateConfigDO.setRemark(json.toString());
                            weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), json.getString("openId"), wxTemplateConfigDO);

+ 8 - 19
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java

@ -437,21 +437,21 @@ public class CourseService {
        List<Map<String , Object>> positionList = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = new ArrayList<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String nowDate = sdf.format(new Date());
        if (positionList.size() > 0){
            for (int i=0;i<positionList.size();i++){
                String sql1 = "SELECT id,code,`name`,mobile,photo,address,longitude,latitude ,funDistance("+positionList.get(i).get("latitude")+","+positionList.get(i).get("longitude")+","+lat2+","+lon2+") funDistance FROM base.base_org where id = '"+positionList.get(i).get("id")+"'";
                List<Map<String , Object>> mapList = jdbcTemplate.queryForList(sql1);
//                base_recruit_students
                String allNumSql = "SELECT num FROM base_recruit_students WHERE org_code = '"+mapList.get(0).get("code")+"' AND del = 1 ";
                Integer allNum = jdbcTemplate.queryForObject(allNumSql,Integer.class);
                String recruitIdSql = "SELECT id FROM base_recruit_students WHERE org_code = '"+mapList.get(0).get("code")+"' AND del = 1 ";
                String recruitId = jdbcTemplate.queryForObject(recruitIdSql,String.class);
                Integer allNum = 0;
                String recruitId = "";
                String orgCode = String.valueOf(mapList.get(0).get("code"));
                List<RecruitStudentsDO> recruitStudentsDOList = recruitStudentsDao.findByOrgCode(orgCode,new Date());
                Integer num = 0;
                // 判断该机构是否开放报名
                String ksbm = "SELECT COUNT(1) a FROM base_recruit_students WHERE '"+nowDate+"' > start_time AND '"+nowDate+"' < end_time AND del = 1 AND org_code = '"+mapList.get(0).get("code")+"'";
                num = jdbcTemplate.queryForObject(ksbm,Integer.class);
                if (num > 0){
                if (recruitStudentsDOList.size()>0){
                    RecruitStudentsDO recruitStudentsDO = recruitStudentsDOList.get(0);
                    allNum = recruitStudentsDO.getNum();
                    recruitId = recruitStudentsDO.getId();
                    String sqlNum = "SELECT allm.id,allm.num - bbm.num num\n" +
                            "FROM (SELECT id,num FROM base_recruit_students WHERE org_code = '"+mapList.get(0).get("code")+"' AND del = 1 ) allm,(\n" +
                            "SELECT rs.id,COUNT(rsr.id) num FROM base_recruit_students rs,base_recruit_students_record rsr WHERE rsr.org_code =  '"+mapList.get(0).get("code")+"'\n" +
@ -493,17 +493,6 @@ public class CourseService {
                });
            }
            object.put("object",list);
//            List<Map<String , Object>> currentPageList = new ArrayList<>();
//            if (list.size() > 0 ){
//                if (list != null && list.size() > 0) {
//                    int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
//                    for (int i = 0; i < pageSize && i < list.size() - currIdx; i++) {
//                        Map<String, Object> data = list.get(currIdx + i);
//                        currentPageList.add(data);
//                    }
//                }
//            }
//            object.put("object",currentPageList);
        }
        return object;
    }

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

@ -29,6 +29,8 @@ public class WeiXinEventProcess {
    @Value("${wechat.id}")
    private String wechatId;
    @Value("${wechat.appId}")
    private String appId;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
@ -49,9 +51,9 @@ public class WeiXinEventProcess {
                if (message.containsKey("EventKey") && StringUtils.isNotEmpty(message.get("EventKey")) && message.containsKey("Ticket")
                        && StringUtils.isNotEmpty(message.get("Ticket"))) {
                    result = scanEventProcess(message);
                } /*else {
                } else {
                    result = subscribeEventProcess(message);
                }*/
                }
                break;
            /*case WeiXinMessageUtils.EVENT_TYPE_UNSUBSCRIBE: // 取消订阅事件
                 result = unsubscribeEventProcess(message);
@ -65,6 +67,24 @@ public class WeiXinEventProcess {
        return result;
    }
    /**
     * 关注事件消息构建回复消息体(图文消息xml,模板消息json串)
     *
     * @param message
     * @return
     * @throws Exception
     */
    private String subscribeEventProcess(Map<String, String> message) throws Exception {
        String result = "";
        // 场景值
        String eventKey = message.get("EventKey");
        List<Map<String, String>> articles = new ArrayList<>();
        setUrlItems(articles);
        result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        return result;
    }
    /**
     * 微信扫码事件处理(封装图文消息体)
     *
@ -93,17 +113,11 @@ public class WeiXinEventProcess {
            }
            // 医生二维码跳转URL
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                url = "https://intel.yanketong.com/ims-wx/#/doctorInfo?doctorCode="+keys[0];
                picUrl = "https://intel.yanketong.com/"+picUrl;
                article.put("Url", url);
                article.put("Title", keys[1] + "医生个人诊间");
                article.put("Description", "厦门眼科中心医院互联网医院");
                article.put("PicUrl", picUrl);
                articles.add(article);
            }else {
                url = "https://intm/ims-wx/#/doctorInfo?doctorCode="+keys[0];
                picUrl = "https://im/"+picUrl;
                article.put("Url", url);
                article.put("Title", keys[1] + "医生个人诊间");
                article.put("Description", "海沧医院互联网医院");
                article.put("Description", "医养云照护");
                article.put("PicUrl", picUrl);
                articles.add(article);
            }
@ -122,5 +136,46 @@ public class WeiXinEventProcess {
        return result;
    }
    /**
     * 设置微信公共的图文消息
     *
     * @param articles
     */
    public void setUrlItems(List<Map<String, String>> articles) {
        Map<String, String> articleBooking = new HashMap<>();
        // 图文URL
        String urlBooking = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=http%3A%2F%2Fhzijk.cityihealth.com%2Fmedical-care-patient%2Fhome%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        urlBooking = urlBooking.replace("{appId}", appId);
        articleBooking.put("Url", urlBooking);
        articleBooking.put("Title", "你好啊,欢迎来到朝晖云照护!");
        articleBooking.put("Description", "这里是智慧养老和健康管理服务社区+幼儿成长教育服务平台\n" +
                "我们陪你一起,关爱老人,呵护孩子!\n" +
                "感谢关注,点击下方菜单直接进入朝晖云照护平台");
        articleBooking.put("PicUrl", "http://hzijk.cityihealth.com/image/index.png");
        articles.add(articleBooking);
        Map<String, String> articleDevice = new HashMap<>();
        // 图文URL
        String urlDevice = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=http%3A%2F%2Fhzijk.cityihealth.com%2Fmedical-care-patient%2FonlineRegistration%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        urlDevice = urlDevice.replace("{appId}", appId);
        articleDevice.put("Url", urlDevice);
        articleDevice.put("Title", "在线入园");
        articleDevice.put("Description", "申请专业托育机构入园资格");
        articleDevice.put("PicUrl", "http://hzijk.cityihealth.com/image/doorCoach.png");
        articles.add(articleDevice);
        Map<String, String> articleFamily = new HashMap<>();
        // 图文URL
        String urlFamily = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=http%3A%2F%2Fhzijk.cityihealth.com%2Fmedical-care-patient%2FlifeCare%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        urlFamily = urlFamily.replace("{appId}", appId);
        articleFamily.put("Url", urlFamily);
        articleFamily.put("Title", "上门预约");
        articleFamily.put("Description", "预约幼儿教育专家上门育儿指导");
        articleFamily.put("PicUrl", "http://hzijk.cityihealth.com/image/online.png");
        articles.add(articleFamily);
    }
}

BIN
svr/svr-cloud-care/src/main/resources/image/doorCoach.png


BIN
svr/svr-cloud-care/src/main/resources/image/index.png


BIN
svr/svr-cloud-care/src/main/resources/image/online.png