Browse Source

发送消息的配置

xiaochan 11 months ago
parent
commit
5049d906d3

+ 1 - 0
src/main/java/thyyxxk/webserver/config/envionment/Other.java

@@ -11,4 +11,5 @@ import org.springframework.stereotype.Component;
 @NoArgsConstructor
 public class Other {
     private String mobileAddress;
+    private Integer mobileAgentid;
 }

+ 3 - 0
src/main/java/thyyxxk/webserver/config/exception/ExceptionEnum.java

@@ -30,6 +30,9 @@ public enum ExceptionEnum {
     NO_DATA_EXIST(1005, "没有查询到符合条件的数据。"),
     ABNORMAL_YZ_ACT_ORDER(1006, "此患者存在异常状态医嘱。"),
     INVALID_PARAM(1007, "参数异常,请检查。"),
+    NO_PERMISSION_TO_VIEW(1008, "无权查看。"),
+    UNAUTHORIZED_OPERATION(1009, "无权操作。"),
+
     // 以下是需要弹窗提示的错误
     LOGICAL_ERROR(2001, "错误。"),
     NEED_PROOFREAD(2002, "错误。"),

+ 12 - 8
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/emr/EmrControlRuleSever.java

@@ -82,9 +82,17 @@ public class EmrControlRuleSever {
         String date = DateUtil.formatDate(param.getApplicationTime(), df);
 
         String description = StrFormatter.format("<div class=\"gray\">{}</div> <div class=\"normal\">理由:{}</div><div class=\"highlight\">解锁:【{}】</div>", date, param.getRequestRemarks(), param.getUnlockJson());
-        String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wwf0b23c8b36012b34&redirect_uri=" + other.getMobileAddress() + "/login?page=unlockemr" + "&response_type=code&scope=snsapi_privateinfo&state=STATE&agentid=1000051#wechat_redirect";
+        JSONObject js = getMessageJson(data, description);
 
-        JSONObject js = new JSONObject() {{
+        mobileService.post("/wecom/sendMsg")
+                .addBody(js)
+                .execute();
+    }
+
+    private @NotNull JSONObject getMessageJson(String data, String description) {
+        String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wwf0b23c8b36012b34&redirect_uri=" + other.getMobileAddress() + "/login?page=unlockemr" + "&response_type=code&scope=snsapi_privateinfo&state=STATE&agentid=" + other.getMobileAgentid() + "#wechat_redirect";
+
+        return new JSONObject() {{
             put("touser", data);
             put("msgtype", "textcard");
             put("enable_id_trans", 0);
@@ -97,15 +105,11 @@ public class EmrControlRuleSever {
                 put("url", url);
             }});
         }};
-        dao.getYiWuBuUser();
-        mobileService.post("/wecom/sendMsg")
-                .addBody(js)
-                .execute();
     }
 
     public ResultVo<IPage<EmrLimitUnlock>> getApplicationData(SelectUnlockParam param) {
         if (publicServer.noNeedRule(38)) {
-            return ResultVoUtil.success(new Page<>(1, 1));
+            return ResultVoUtil.fail(ExceptionEnum.NO_PERMISSION_TO_VIEW);
         }
         IPage<EmrLimitUnlock> iPage = new Page<>(param.getCurrentPage(), param.getPageSize(), param.getTotal() == 0);
         QueryWrapper<EmrLimitUnlock> qw = getEmrLimitUnlockQueryWrapper(param);
@@ -157,7 +161,7 @@ public class EmrControlRuleSever {
 
     public ResultVo<String> reviewMedicalRecordsToUnlock(EmrLimitUnlock param) {
         if (publicServer.noNeedRule(38)) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您没有审核权限。");
+            return ResultVoUtil.fail(ExceptionEnum.UNAUTHORIZED_OPERATION);
         }
         EmrLimitUnlock emrLimitUnlock = dao.selectUnlockById(param.getId());
         if (emrLimitUnlock.getState().equals(3)) {

+ 1 - 1
src/main/resources/application-cytest.yml

@@ -188,4 +188,4 @@ thyy:
     path: "Z:\\"
   other:
     mobile-address: "https://emr.hnthyy.cn:8081"
-
+    mobile-agentid: 1000051

+ 1 - 0
src/main/resources/application-dameng.yml

@@ -181,3 +181,4 @@ thyy:
     path: "Z:\\"
   other:
     mobile-address: "https://emr.hnthyy.cn:8081"
+    mobile-agentid: 1000051

+ 1 - 0
src/main/resources/application-dev.yml

@@ -174,3 +174,4 @@ thyy:
     path: "Z:\\"
   other:
     mobile-address: "https://emr.hnthyy.cn:8081"
+    mobile-agentid: 1000051

+ 1 - 0
src/main/resources/application-prod.yml

@@ -155,3 +155,4 @@ thyy:
     recovery-task-url: "http://172.16.32.167:8077/thyy/archive/archiveRecovery"
   other:
     mobile-address: "https://emr.hnthyy.cn:8080"
+    mobile-agentid: 1000050

+ 1 - 0
src/main/resources/application-tz.yml

@@ -174,4 +174,5 @@ thyy:
     path: "Z:\\"
   other:
     mobile-address: "https://emr.hnthyy.cn:8081"
+    mobile-agentid: 1000051