From b542bb002d9dc8e12cf4bd8bb54dc4aa0b4bb67d Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期一, 01 六月 2026 14:02:54 +0800
Subject: [PATCH] 新境上报发送短信、专家发送短信、外链相关接口
---
ruoyi-project/src/main/java/com/ruoyi/project/service/impl/GiLinkService.java | 74 +++++++++++++++++++++++++++++++++++-
1 files changed, 71 insertions(+), 3 deletions(-)
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/GiLinkService.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/GiLinkService.java
index f05f430..f3aaecd 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/GiLinkService.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/GiLinkService.java
@@ -1,20 +1,88 @@
package com.ruoyi.project.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.utils.SmsUtils;
import com.ruoyi.project.domain.GiLink;
import com.ruoyi.project.mapper.ApiMapper;
import com.ruoyi.project.mapper.GiLinkMapper;
import com.ruoyi.project.service.IGiLinkService;
+import com.ruoyi.system.service.ISysUserService;
+import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
+
+import java.util.Random;
@Service
public class GiLinkService extends ServiceImpl<GiLinkMapper, GiLink> implements IGiLinkService {
@Autowired
GiLinkMapper mapper;
+ @Autowired
+ private ISysUserService userService;
+ @Autowired
+ private IGiLinkService linkService;
+ @Value("${link.report_url}")
+ private String reportUrl;
+ @Value("${link.expert_url}")
+ private String expertUrl;
+ public String Add(GiLink model) {
+ Integer maxid = mapper.getMaxID();
+ Random rand = new Random();
+ String code = maxid + String.format("%x", rand.nextInt(100));
+ model.setCode(code);
+ Integer res = mapper.insert(model);
+ if (res == 1)
+ return code;
+ else
+ return "";
+ }
+ /**
+ * 涓婃姤鍙戦�佺煭淇�
+ * @param id 涓婃姤id
+ * @param coordinatorNo 鍗忚皟鍛樼紪鍙�
+ * @param toHospital 涓婃姤鍖婚櫌
+ */
+ public String SendReport(Long id,String coordinatorNo,String toHospital){
+ String res="";
+ SysUser user= userService.selectUserByUserName(coordinatorNo);
+ if(user!=null&& ObjectUtils.isNotEmpty(user.getPhonenumber())) {
+ GiLink link=new GiLink();
+ link.setUserName(user.getUserName());
+ link.setUserPhone(user.getPhonenumber());
+ link.setExtContent("{\"id\":\""+id+"\"}");
+ String code=linkService.Add(link);
+ reportUrl += "?code=" + code;
+ String content = "妗堜緥涓婃姤閫氱煡锛氥�愰潚宀涘ぇ瀛﹂檮灞炲尰闄€��" + toHospital
+ + "涓婃姤娼滃湪鎹愮尞妗堜緥锛岃鐧诲綍OPO绯荤粺鏌ョ湅璇︾粏淇℃伅锛屽強鏃惰繘琛屽鎺ャ�傜櫥褰曢摼鎺ワ細" + reportUrl + " 銆�";
+ SmsUtils sms=new SmsUtils();
+ res=sms.send(user.getPhonenumber(),content);
+ }
+ return res;
+ }
- public Long Add(GiLink model){
-
- return 1L;
+ /**
+ * 涓撳鍙戦�佺煭淇�
+ * @param id 涓撳鎰忚id
+ * @param expertNo 涓撳缂栧彿
+ * @param infoId 妗堜緥id
+ */
+ public String SendExpert(String id,String expertNo,String infoId){
+ String res="";
+ SysUser user= userService.selectUserByUserName(expertNo);
+ if(user!=null&& ObjectUtils.isNotEmpty(user.getPhonenumber())) {
+ GiLink link=new GiLink();
+ link.setUserName(user.getUserName());
+ link.setUserPhone(user.getPhonenumber());
+ link.setExtContent("{\"id\":\""+id+"\",\"type\": \"review\",\"status\": \"1\",\"infoId\": \""+infoId+"\"}");
+ String code=linkService.Add(link);
+ expertUrl += "?code=" + code;
+ String content = "浼︾悊涓撳瀹℃煡閫氱煡锛氥�愰潚宀涘ぇ瀛﹂檮灞炲尰闄€�戝皧鏁殑涓撳鎮ㄥソ锛佹偍鏈夌揣鎬ヤ汉浣撳櫒瀹樼Щ妞嶄鸡鐞嗗鏌ョ敵璇峰緟澶勭悊锛�" +
+ "璇峰姟蹇呬簬1灏忔椂鍐呯櫥褰曞尰闄PO绯荤粺杩涜瀹℃壒銆傜櫥褰曢摼鎺ワ細 " + expertUrl + "銆傝阿璋� 銆�";
+ SmsUtils sms=new SmsUtils();
+ res=sms.send(user.getPhonenumber(),content);
+ }
+ return res;
}
}
--
Gitblit v1.9.3