diff --git a/pc-web/src/views/Home.vue b/pc-web/src/views/Home.vue
index 0e18b19..20fa5d3 100644
--- a/pc-web/src/views/Home.vue
+++ b/pc-web/src/views/Home.vue
@@ -194,6 +194,7 @@
class="home__danger-text"
type="text"
size="mini"
+
:loading="isDeleting(scope.row)"
:disabled="isSaving(scope.row) || isDeleting(scope.row)"
>
@@ -611,6 +612,7 @@ export default {
.home__danger-text {
color: #f56c6c;
+ margin-left: 10px;
}
:global(.home__message-box--mobile-center) {
diff --git a/server/src/main/java/com/reg/server/registration/Registration.java b/server/src/main/java/com/reg/server/registration/Registration.java
index ecae15b..ea0f466 100644
--- a/server/src/main/java/com/reg/server/registration/Registration.java
+++ b/server/src/main/java/com/reg/server/registration/Registration.java
@@ -9,6 +9,16 @@ public class Registration {
private String powerType;
private String note;
private String status;
+ private String msgId;
+
+ public String getMsgId() {
+ return msgId;
+ }
+
+ public void setMsgId(String msgId) {
+ this.msgId = msgId;
+ }
+
/**
* 文件访问链接
*/
diff --git a/server/src/main/java/com/reg/server/registration/RegistrationController.java b/server/src/main/java/com/reg/server/registration/RegistrationController.java
index 4209fe1..1eba3f8 100644
--- a/server/src/main/java/com/reg/server/registration/RegistrationController.java
+++ b/server/src/main/java/com/reg/server/registration/RegistrationController.java
@@ -1,6 +1,13 @@
package com.reg.server.registration;
import cn.hutool.core.util.RandomUtil;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.core.net.URLEncodeUtil;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+
import com.aliyun.tea.TeaException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -79,6 +86,31 @@ public class RegistrationController {
if ("已登记".equals(registration.getStatus().trim()) && registration.getFileName() != null) {
urlPath = RandomUtil.randomString(5);
registration.setUrlPath(urlPath);
+ // 发送短信通知
+ String smsUrl = "http://172.27.77.221:8060/send";
+
+ String text = "【国家电网】尊敬的" + registration.getCustomerName() + ",感谢您的支持!您咨询的业务办理详情可点击:" + "http://192.168.32.24:8080/#/getfile/"+urlPath+"查阅。";
+ String fullUrl = smsUrl + "?password=1&recipient=" + registration.getContact() + "&text=" + URLEncodeUtil.encode(text) + "&encoding=U";
+ String response = HttpUtil.get(fullUrl);
+ // 解析 XML 响应
+ try {
+ XPathFactory xPathFactory = XPathFactory.newInstance();
+ XPath xpath = xPathFactory.newXPath();
+ javax.xml.parsers.DocumentBuilderFactory factory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
+ javax.xml.parsers.DocumentBuilder builder = factory.newDocumentBuilder();
+ org.w3c.dom.Document doc = builder.parse(new org.xml.sax.InputSource(new java.io.StringReader(response)));
+ String error = xpath.evaluate("//send/error/text()", doc);
+ if (!"0".equals(error)) {
+ throw new Exception("短信发送失败!状态码:" + error);
+ }
+ String messageStatus = xpath.evaluate("//send/message_status/text()", doc);
+ String msgId = xpath.evaluate("//send/msg_id/text()", doc);
+ System.out.println("短信发送结果 error=" + error + ", message_status=" + messageStatus + "msgId=" + msgId);
+ registration.setMsgId(msgId);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return ResponseEntity.badRequest().build();
+ }
}
boolean updated = service.update(id, registration);
return updated ? ResponseEntity.noContent().build() : ResponseEntity.notFound().build();
diff --git a/server/src/main/resources/mapper/RegistrationMapper.xml b/server/src/main/resources/mapper/RegistrationMapper.xml
index 790a5dc..48a21f0 100644
--- a/server/src/main/resources/mapper/RegistrationMapper.xml
+++ b/server/src/main/resources/mapper/RegistrationMapper.xml
@@ -14,6 +14,7 @@
+
@@ -22,12 +23,12 @@
@@ -41,7 +42,8 @@
note = #{note},
status = #{status},
file_name = #{fileName},
- url_path = #{urlPath}
+ url_path = #{urlPath},
+ msg_id = #{msgId}
WHERE id = #{id}