ソースを参照

云短信代码合并

donggaosheng 1 年間 前
コミット
be6f7b1319

+ 36 - 5
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/RemoteSmsService.java

@@ -1,15 +1,12 @@
 package com.zd.laboratory.api.feign;
 
 import com.zd.laboratory.api.feign.fallback.RemoteSmsFallbackFactory;
+import com.zd.laboratory.api.vo.TextMessageVo;
 import com.zd.model.constant.ApplicationConstants;
 import com.zd.model.domain.ResultData;
-import io.swagger.annotations.ApiOperation;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import java.util.List;
-import java.util.Map;
+import org.springframework.web.bind.annotation.PostMapping;
 
 /**
  * @Author donggaosheng
@@ -33,4 +30,38 @@ public interface RemoteSmsService {
     @GetMapping("/getVoiceReport")
     ResultData getVoiceReport();
 
+
+    /**
+     * 发送模版消息
+     * @param textMessageBo
+     * @return
+     */
+    @PostMapping(value = "/sendTemplateMessage")
+    ResultData sendTemplateMessage(TextMessageVo textMessageBo);
+
+
+    /**
+     * 发送语音消息
+     * @param textMessageBo
+     * @return
+     */
+    @PostMapping(value = "/sendVoiceMessage")
+    ResultData sendVoiceMessage(TextMessageVo textMessageBo);
+
+
+    /**
+     * 发送语音或者短信接口
+     * @param textMessageBo
+     * @return
+     */
+    @PostMapping(value = "/sendMsgVoice")
+    ResultData send(TextMessageVo textMessageBo);
+
+
+    /**
+     * 获取余额
+     * @return
+     */
+    @PostMapping(value = "/getMessageBalance")
+    ResultData getMessageBalance();
 }

+ 21 - 0
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/fallback/RemoteAlarmLogFallbackFactory.java

@@ -1,6 +1,7 @@
 package com.zd.laboratory.api.feign.fallback;
 
 import com.zd.laboratory.api.feign.RemoteSmsService;
+import com.zd.laboratory.api.vo.TextMessageVo;
 import com.zd.model.domain.ResultData;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -25,6 +26,26 @@ public class RemoteAlarmLogFallbackFactory implements FallbackFactory<RemoteSmsS
             public ResultData getVoiceReport() {
                 return ResultData.fail("语音回执调用失败 !");
             }
+
+            @Override
+            public ResultData sendTemplateMessage(TextMessageVo textMessageBo) {
+                return ResultData.fail("短信模版消息发送失败 !");
+            }
+
+            @Override
+            public ResultData sendVoiceMessage(TextMessageVo textMessageBo) {
+                return ResultData.fail("语音回执调用失败 !");
+            }
+
+            @Override
+            public ResultData send(TextMessageVo textMessageBo) {
+                return null;
+            }
+
+            @Override
+            public ResultData getMessageBalance() {
+                return ResultData.fail("获取余额失败 !");
+            }
         };
     }
 }

+ 57 - 19
zd-modules/zd-airbottle/src/main/java/com/zd/airbottle/service/impl/AlarmRecordServiceImpl.java

@@ -29,10 +29,8 @@ import com.zd.laboratory.api.dto.WarningConfigDto;
 import com.zd.laboratory.api.dto.WarningNoticeLogDto;
 import com.zd.laboratory.api.entity.LabMessageContent;
 import com.zd.laboratory.api.entity.LabSubjectEntity;
-import com.zd.laboratory.api.feign.RemoteLabHardwareService;
-import com.zd.laboratory.api.feign.RemoteLaboratoryService;
-import com.zd.laboratory.api.feign.RemoteMessageContentService;
-import com.zd.laboratory.api.feign.RemoteSubQueryService;
+import com.zd.laboratory.api.feign.*;
+import com.zd.laboratory.api.vo.TextMessageVo;
 import com.zd.model.constant.HttpStatus;
 import com.zd.model.domain.AjaxResult;
 import com.zd.model.domain.DTO.UserPhoneInfo;
@@ -45,12 +43,14 @@ import com.zd.model.entity.TemplateResult;
 import com.zd.system.api.feign.RemoteUserService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.concurrent.BasicThreadFactory;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import javax.xml.soap.Text;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.*;
@@ -106,6 +106,9 @@ public class AlarmRecordServiceImpl implements IAlarmRecordService {
     @Autowired
     private RemoteMessageService remoteMessageService;
 
+    @Autowired
+    private RemoteSmsService remoteSmsService;
+
     @Resource
     private RedisTemplate<String, HardwareRfid> redisTemplate;
 
@@ -216,7 +219,10 @@ public class AlarmRecordServiceImpl implements IAlarmRecordService {
                 //按照配置预警
                 if (illegalRemoval != null) {
                     String text = "【实验室安全系统】"+warningNoticeLogDto.getSubName()+"-实验人员违规携带"+warningNoticeLogDto.getName()+"气瓶离开房间,发生时间:" + LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss") + ",请尽快确认。";
-
+                    List<String> paramList=new ArrayList<>();
+                    paramList.add(warningNoticeLogDto.getSubName());
+                    paramList.add(warningNoticeLogDto.getName());
+                    paramList.add(LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss"));
                     //系统通知
                     if (illegalRemoval.contains("1")) {
                         LabMessageContent labMessageContent = new LabMessageContent();
@@ -240,10 +246,20 @@ public class AlarmRecordServiceImpl implements IAlarmRecordService {
                                 log.info("获取实验室管理员和安全员信息失败!{}",JSON.toJSONString(listResultData));
                             }
                             List<UserPhoneInfo> userPhoneInfoList = listResultData.getData();
-                            AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.SMS.toString(), text);
-                            alarmEntrty.setLogId(logId);
-                            alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
-                            remoteAlarmService.send(alarmEntrty);
+                            //AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.SMS.toString(), text);
+                            TextMessageVo textMessageVo=new TextMessageVo();
+                            List<String> phoneList=new ArrayList<>();
+                            userPhoneInfoList.forEach(a->{
+                                phoneList.add(a.getPhone());
+                            });
+                            textMessageVo.setTempContent(text);
+//                            alarmEntrty.setLogId(logId);
+                            textMessageVo.setVariableList(paramList);
+                            textMessageVo.setPhoneList(phoneList);
+//                            alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
+//                            remoteAlarmService.send(alarmEntrty);
+                            //// TODO: 2024/4/9
+                            remoteSmsService.sendTemplateMessage(textMessageVo);
                             log.info("气瓶发送短信打电话消息推送完成!");
                         }
                     }
@@ -374,12 +390,20 @@ public class AlarmRecordServiceImpl implements IAlarmRecordService {
         String airName = storageRVo.getAirName();
         //电话报警
         AlarmEntrty alarmEntrty = new AlarmEntrty();
-        alarmEntrty.setRoute(Routes.NoticePush);
-        alarmEntrty.setType(SendTypes.Call + "");
-        alarmEntrty.setTo(phones.toArray(new String[]{}));
-        alarmEntrty.setText(subjectName + airName + "气瓶被违规带离,请尽快确认");
-        AjaxResult result = remoteAlarmService.send(alarmEntrty);
-        if (!result.get(AjaxResult.CODE_TAG).equals(HttpStatus.SUCCESS)){
+//        alarmEntrty.setRoute(Routes.NoticePush);
+//        alarmEntrty.setType(SendTypes.Call + "");
+//        alarmEntrty.setTo(phones.toArray(new String[]{}));
+//        alarmEntrty.setText(subjectName + airName + "气瓶被违规带离,请尽快确认");
+//        AjaxResult result = remoteAlarmService.send(alarmEntrty);
+        //// TODO: 2024/4/9
+        TextMessageVo textMessageVo=new TextMessageVo();
+        textMessageVo.setTempContent(subjectName + airName + "气瓶被违规带离,请尽快确认");
+        textMessageVo.setPhoneList(phones);
+        ResultData result=remoteSmsService.sendVoiceMessage(textMessageVo);
+//        if (!result.get(AjaxResult.CODE_TAG).equals(HttpStatus.SUCCESS)){
+//            log.error("电话报警异常:发送实验室【{}】,实验室ID【{}】,接收用户手机号【{}】",subjectName,storageRVo.getSubjectId(), phones);
+//        }
+        if (result.getCode()!=(HttpStatus.SUCCESS)){
             log.error("电话报警异常:发送实验室【{}】,实验室ID【{}】,接收用户手机号【{}】",subjectName,storageRVo.getSubjectId(), phones);
         }
     }
@@ -545,10 +569,24 @@ public class AlarmRecordServiceImpl implements IAlarmRecordService {
                             log.info("获取实验室管理员和安全员信息失败!{}",JSON.toJSONString(listResultData));
                         }
                         List<UserPhoneInfo> userPhoneInfoList = listResultData.getData();
-                        AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.SMS.toString(), text);
-                        alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
-                        alarmEntrty.setLogId(logId);
-                        remoteAlarmService.send(alarmEntrty);
+                        List<String> phoneList=new ArrayList<>();
+                        userPhoneInfoList.forEach(a->{
+                            phoneList.add(a.getPhone());
+                        });
+                        List<String> paramList=new ArrayList<>();
+                        paramList.add(warningNoticeLogDto.getSubName());
+                        paramList.add(warningNoticeLogDto.getApplyUser());
+                        paramList.add(warningNoticeLogDto.getName());
+                        paramList.add(LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss"));
+//                      AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.SMS.toString(), text);
+//                        alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
+//                        alarmEntrty.setLogId(logId);
+//                        remoteAlarmService.send(alarmEntrty);
+                        TextMessageVo textMessageVo=new TextMessageVo();
+                        textMessageVo.setPhoneList(phoneList);
+                        textMessageVo.setTempContent(text);
+                        textMessageVo.setVariableList(paramList);
+                        remoteSmsService.sendTemplateMessage(textMessageVo);
                         log.info("气瓶超时未归还发送短信打电话消息推送完成!");
                     }
                 }

+ 16 - 2
zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/HxpChemicalServiceImpl.java

@@ -19,6 +19,8 @@ import com.zd.common.core.annotation.DataScope;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.redis.RedisService;
 import com.zd.common.core.utils.*;
+import com.zd.laboratory.api.feign.RemoteSmsService;
+import com.zd.laboratory.api.vo.TextMessageVo;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.system.api.entity.SysDictData;
 import net.sourceforge.pinyin4j.PinyinHelper;
@@ -28,6 +30,7 @@ import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
 import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
 import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.formula.functions.T;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -65,6 +68,9 @@ public class HxpChemicalServiceImpl implements IHxpChemicalService {
     private HxpAlarmRecordMapper hxpAlarmRecordMapper;
     @Autowired
     private RemoteAlarmService remoteAlarmService;
+    @Autowired
+    private RemoteSmsService remoteSmsService;
+
     @Resource
     private SmsSydUtil smsSydUtil;
     @Autowired
@@ -605,9 +611,17 @@ public class HxpChemicalServiceImpl implements IHxpChemicalService {
                     String subName = subInfo.get("name") == null ? "" : subInfo.get("name") + "";
                     String content = subName + "房间内危化品已定为重大危险源,请确认安全存放量!";
                     if (HxpStockServiceImpl.phoneMode == 0) {
+                        //AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, content);
+                        //remoteAlarmService.send(alarmEntrty);
+                        List<String> paramList=new ArrayList<>();
+                        TextMessageVo textMessageVo=new TextMessageVo();
+                        textMessageVo.setPhoneList(Arrays.asList(strings));
+                        paramList.add(subName);
+                        textMessageVo.setVariableList(paramList);
+                        textMessageVo.setTempContent(content);
+                        remoteSmsService.sendVoiceMessage(textMessageVo);
+                        remoteSmsService.sendTemplateMessage(textMessageVo);
 
-                        AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, content);
-                        remoteAlarmService.send(alarmEntrty);
                     } else if (HxpStockServiceImpl.phoneMode == 1) {
                         try {
                             smsSydUtil.sendSydSms(content, 1, null, strings);

+ 59 - 15
zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/HxpStockServiceImpl.java

@@ -37,6 +37,8 @@ import com.zd.laboratory.api.entity.LabMessageContent;
 import com.zd.laboratory.api.feign.RemoteLabHardwareService;
 import com.zd.laboratory.api.feign.RemoteLaboratoryService;
 import com.zd.laboratory.api.feign.RemoteMessageContentService;
+import com.zd.laboratory.api.feign.RemoteSmsService;
+import com.zd.laboratory.api.vo.TextMessageVo;
 import com.zd.model.constant.HttpStatus;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.domain.AjaxResult;
@@ -138,6 +140,9 @@ public class HxpStockServiceImpl implements IHxpStockService {
     @Autowired
     private RemoteUserService remoteUserService;
 
+    @Autowired
+    private RemoteSmsService remoteSmsService;
+
     /**
      * 查询库存管理
      *
@@ -887,8 +892,12 @@ public class HxpStockServiceImpl implements IHxpStockService {
             }
             Long logId = (Long) result.getData();
             String text = "【实验室安全系统】" + warningNoticeLogDto.getSubName() + "-" + warningNoticeLogDto.getName() + "即将过期,发生时间:" + LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss") + ",请尽快确认。";
+            List<String> paramList=new ArrayList<>();
+            paramList.add(warningNoticeLogDto.getSubName());
+            paramList.add(warningNoticeLogDto.getName());
+            paramList.add(LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss"));
             //发送通知
-            sendNotice(hxpStock, userIdStr, phones, warningConfigDto.getUnexpired(),text,logId);
+            sendNotice(hxpStock, userIdStr, phones, warningConfigDto.getUnexpired(),text,logId,paramList);
         });
     }
 
@@ -943,8 +952,11 @@ public class HxpStockServiceImpl implements IHxpStockService {
             }
             Long logId = (Long)result.getData();
             String text =  "【实验室安全系统】"+warningNoticeLogDto.getSubName()+"-"+warningNoticeLogDto.getName()+"已过期,请尽快确认。";
+            List<String> parmList=new ArrayList<>();
+            parmList.add(warningNoticeLogDto.getSubName());
+            parmList.add(warningNoticeLogDto.getName());
             //发送通知
-            sendNotice(hxpStock, userIdStr, phones, warningConfigDto.getExpired(), text, logId);
+            sendNotice(hxpStock, userIdStr, phones, warningConfigDto.getExpired(), text, logId,parmList);
         });
 
         List<Long> stockIds = expiredStock.stream().filter(i -> 1 == i.getStatus()).map(HxpStockVO::getId).collect(Collectors.toList());
@@ -957,7 +969,7 @@ public class HxpStockServiceImpl implements IHxpStockService {
         }
     }
 
-    private void sendNotice(HxpStockVO hxpStock, StringBuffer userIdStr, StringBuffer phones, String expired,String text,Long logId) {
+    private void sendNotice(HxpStockVO hxpStock, StringBuffer userIdStr, StringBuffer phones, String expired,String text,Long logId,List<String> paramList) {
         if (expired.contains("1")) {
             //系统通知
             LabMessageContent labMessageContent = new LabMessageContent();
@@ -980,10 +992,19 @@ public class HxpStockServiceImpl implements IHxpStockService {
                     logger.info("获取实验室管理员和安全员信息失败!{}",JSON.toJSONString(listResultData));
                 }
                 List<UserPhoneInfo> userPhoneInfoList = listResultData.getData();
-                AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.SMS.toString(), text);
-                alarmEntrty.setLogId(logId);
-                alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
-                remoteAlarmService.send(alarmEntrty);
+                //AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.SMS.toString(), text);
+//                alarmEntrty.setLogId(logId);
+//                alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
+//                remoteAlarmService.send(alarmEntrty);
+                List<String> phoneList=new ArrayList<>();
+                userPhoneInfoList.forEach(a->{
+                    phoneList.add(a.getPhone());
+                });
+                TextMessageVo textMessageVo=new TextMessageVo();
+                textMessageVo.setPhoneList(phoneList);
+                textMessageVo.setTempContent(text);
+                textMessageVo.setVariableList(paramList);
+                remoteSmsService.sendTemplateMessage(textMessageVo);
                 logger.info("化学品已过期发送短信打电话消息推送完成!");
             }
         }
@@ -1077,6 +1098,11 @@ public class HxpStockServiceImpl implements IHxpStockService {
                         remoteMessageContentService.sendMessage(labMessageContent);
                     }
                     if (timeout.contains("2")) {
+                        List<String> paramList=new ArrayList<>();
+                        paramList.add(warningNoticeLogDto.getSubName());
+                        paramList.add(warningNoticeLogDto.getApplyUser());
+                        paramList.add(warningNoticeLogDto.getName());
+                        paramList.add(LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss"));
                         //短信通知
                         String[] strings = Stream.of(phones.toString().split(",")).filter(a -> StrUtil.isNotBlank(a)).collect(Collectors.joining(",")).split(",");
                         if (strings != null) {
@@ -1086,10 +1112,20 @@ public class HxpStockServiceImpl implements IHxpStockService {
                                 logger.info("获取实验室管理员和安全员信息失败!{}",JSON.toJSONString(listResultData));
                             }
                             List<UserPhoneInfo> userPhoneInfoList = listResultData.getData();
-                            AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.SMS.name(), text);
-                            alarmEntrty.setLogId(logId);
-                            alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
-                            remoteAlarmService.send(alarmEntrty);
+//                            AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.SMS.name(), text);
+//                            alarmEntrty.setLogId(logId);
+//                            alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
+//                            remoteAlarmService.send(alarmEntrty);
+                            //此处改成发短信模式
+                            List<String> phoneList=new ArrayList<>();
+                            userPhoneInfoList.forEach(a->{
+                                phoneList.add(a.getPhone());
+                            });
+                            TextMessageVo textMessageVo=new TextMessageVo();
+                            textMessageVo.setPhoneList(phoneList);
+                            textMessageVo.setTempContent(text);
+                            textMessageVo.setVariableList(paramList);
+                            remoteSmsService.sendTemplateMessage(textMessageVo);
                             logger.info("化学品超时未归还发送短信打电话消息推送完成!");
                         }
                     }
@@ -1103,10 +1139,18 @@ public class HxpStockServiceImpl implements IHxpStockService {
                                 logger.info("获取实验室管理员和安全员信息失败!{}",JSON.toJSONString(listResultData));
                             }
                             List<UserPhoneInfo> userPhoneInfoList = listResultData.getData();
-                            AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.Call.name(), text);
-                            alarmEntrty.setLogId(logId);
-                            alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
-                            remoteAlarmService.send(alarmEntrty);
+//                            AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.Call.name(), text);
+//                            alarmEntrty.setLogId(logId);
+//                            alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
+//                            remoteAlarmService.send(alarmEntrty);
+                            List<String> phoneList=new ArrayList<>();
+                            userPhoneInfoList.forEach(a->{
+                                phoneList.add(a.getPhone());
+                            });
+                            TextMessageVo textMessageVo=new TextMessageVo();
+                            textMessageVo.setPhoneList(phoneList);
+                            textMessageVo.setTempContent(text);
+                            remoteSmsService.sendVoiceMessage(textMessageVo);
                             logger.info("化学品超时未归还打电话消息推送完成!");
                         }
                     }

+ 56 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabSmsController.java

@@ -1,12 +1,13 @@
 package com.zd.laboratory.controller;
 
+import com.alibaba.fastjson.JSONObject;
+import com.zd.laboratory.api.vo.TextMessageVo;
 import com.zd.laboratory.service.ILabMessageService;
 import com.zd.model.domain.ResultData;
 import io.swagger.annotations.ApiOperation;
+import org.apache.http.HttpStatus;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * @Author donggaosheng
@@ -38,4 +39,56 @@ public class LabSmsController {
     public ResultData getVoiceReport() {
         return ResultData.success(labMessageService.getVoiceReport());
     }
+
+
+    @ApiOperation(value = "助通短信发送消息", notes = "参数说明: tempId,phoneList-电话集合,variableList-变量集合(必填)")
+    @PostMapping(value = "/send")
+    public ResultData send(@RequestBody TextMessageVo textMessageBo) {
+        JSONObject jsonObject=labMessageService.sendMessageTemp(textMessageBo);
+        if(jsonObject.getIntValue("code")== HttpStatus.SC_OK){
+            JSONObject jsonData=new JSONObject();
+            jsonData.put("tempId",jsonObject.getString("tpId"));
+            jsonData.put("msgId",jsonObject.getString("msgId"));
+            jsonData.put("invalidList",jsonObject.getJSONArray("jsonObject"));
+            return ResultData.success(jsonData);
+        }
+        return ResultData.fail(500,jsonObject.getString("msg"));
+    }
+
+
+
+    @ApiOperation(value = "助通短信发送消息", notes = "参数说明: tempId,phoneList-电话集合,variableList-变量集合(必填)")
+    @PostMapping(value = "/sendTemplateMessage")
+    public ResultData sendTemplateMessage(@RequestBody TextMessageVo textMessageBo) {
+        JSONObject jsonObject=labMessageService.sendMessageTemp(textMessageBo);
+        if(jsonObject.getIntValue("code")== HttpStatus.SC_OK){
+            JSONObject jsonData=new JSONObject();
+            jsonData.put("tempId",jsonObject.getString("tpId"));
+            jsonData.put("msgId",jsonObject.getString("msgId"));
+            jsonData.put("invalidList",jsonObject.getJSONArray("jsonObject"));
+            return ResultData.success(jsonData);
+        }
+        return ResultData.fail(500,jsonObject.getString("msg"));
+    }
+
+    @ApiOperation(value = "助通发送语音消息", notes = "参数说明: tempContent-模版内容,phoneList-电话集合(必填)")
+    @PostMapping(value = "/sendVoiceMessage")
+    public ResultData sendVoiceMessage(@RequestBody TextMessageVo textMessageBo) {
+        JSONObject jsonObject=labMessageService.sendMessageVoice(textMessageBo);
+        if(jsonObject.getIntValue("code")== HttpStatus.SC_OK){
+            return ResultData.success(jsonObject.getJSONObject("data"));
+        }
+        return ResultData.fail("发送语音短信失败"+jsonObject.getString("msg")+"!");
+    }
+
+
+    @ApiOperation(value = "助通获取已通过的模版列表信息", notes = "参数说明: 无")
+    @PostMapping(value = "/getMessageBalance")
+    public ResultData getMessageBalance() {
+        JSONObject jsonObject=labMessageService.getMessageBalance();
+        if(jsonObject.getIntValue("code")== HttpStatus.SC_OK){
+            return ResultData.success(jsonObject.getJSONObject("data"));
+        }
+        return ResultData.fail(jsonObject.getString("msg"));
+    }
 }

+ 11 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabMessageContentServiceImpl.java

@@ -13,6 +13,8 @@ import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SaveUtil;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.laboratory.api.entity.LabMessageContent;
+import com.zd.laboratory.api.feign.RemoteSmsService;
+import com.zd.laboratory.api.vo.TextMessageVo;
 import com.zd.laboratory.domain.LabRiskPlanAbnormalGroup;
 import com.zd.laboratory.domain.LabRiskPlanLevel;
 import com.zd.laboratory.domain.LabSubject;
@@ -94,6 +96,9 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
     @Autowired
     private LabHardwareStateMapper hardwareStateMapper;
 
+    @Autowired
+    private RemoteSmsService remoteSmsService;
+
     public Integer phoneMode;
 
     @Value("${phoneMode:0}")
@@ -282,14 +287,17 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
                 List<String> alarms = Arrays.asList(labRiskPlanLevel.getAlarmType().split(","));
                 if (alarms.contains(callType) && alarms.contains(smsType)) {
                     alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, format);
+                    //// TODO: 2024/4/9
+                    TextMessageVo textMessageVo=new TextMessageVo();
+                    remoteSmsService.sendVoiceMessage(textMessageVo);
                 }else if(alarms.contains(callType)){
                     alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.Call.toString(),format);
                 }else if(alarms.contains(smsType)) {
                     alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.SMS.toString(),format);
                 }
-                alarmEntrty.setUserPhoneInfo(userPhoneInfos);
-                alarmEntrty.setLogId(logId);
-                remoteAlarmService.send(alarmEntrty);
+//                alarmEntrty.setUserPhoneInfo(userPhoneInfos);
+//                alarmEntrty.setLogId(logId);
+//                remoteAlarmService.send(alarmEntrty);
                 logger.info("发送短信打电话消息推送完成!topic={},msg={}",MqttConstants.TOPIC_ALERT + labRiskPlanLevel.getRiskPlanId() + "/" + subject.getId(),JSON.toJSONString(alarmEntrty));
                 try {
                     if (subject.getAdminId() != null) {

+ 16 - 1
zd-modules/zd-security/pom.xml

@@ -64,6 +64,21 @@
             <groupId>com.zd.security</groupId>
             <artifactId>zd-security-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.zd.laboratory</groupId>
+            <artifactId>zd-laboratory-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.deepoove</groupId>
+            <artifactId>poi-tl</artifactId>
+            <version>1.10.2</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+            <version>1.2.6</version>
+        </dependency>
     </dependencies>
 
     <build>
@@ -87,4 +102,4 @@
         </plugins>
     </build>
 
-</project>
+</project>