|
@@ -33,9 +33,6 @@ import com.ruoyi.system.mapper.InvestigateTableMapper;
|
|
|
import com.ruoyi.system.domain.InvestigateTable;
|
|
|
import com.ruoyi.system.service.IInvestigateTableService;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-
|
|
|
import static com.ruoyi.common.config.RuoYiConfig.getProfile;
|
|
|
|
|
|
/**
|
|
@@ -147,7 +144,7 @@ public class InvestigateTableServiceImpl implements IInvestigateTableService {
|
|
|
investigateUser.setInvestigateId(investigateTable.getInvestigateTableId());
|
|
|
}
|
|
|
investigateUserMapper.batchDispositionUser(investigateUserList);
|
|
|
- //发送短信
|
|
|
+ //发送短信 新增不能立刻发送短信
|
|
|
sendBatchSmsTable(investigateTableId, investigateUserList);
|
|
|
}
|
|
|
|
|
@@ -222,7 +219,60 @@ public class InvestigateTableServiceImpl implements IInvestigateTableService {
|
|
|
investigateDispositionTableMapper.batchDispositionTable(investigateDispositionTableList);
|
|
|
}
|
|
|
|
|
|
- public static void sendBatchSmsTable(Long investigateTableId, List<InvestigateUser> investigateUserList) {
|
|
|
+ @Override
|
|
|
+ public void sendBatchSmsTable(Long investigateTableId, List<InvestigateUser> investigateUserList) {
|
|
|
+ for (InvestigateUser investigateUser : investigateUserList) {
|
|
|
+ StringBuffer phoneNumberJson = new StringBuffer();
|
|
|
+ StringBuffer templateParamJson = new StringBuffer();
|
|
|
+ StringBuffer signNameJson = new StringBuffer();
|
|
|
+ phoneNumberJson.append("[");
|
|
|
+ templateParamJson.append("[");
|
|
|
+ signNameJson.append("[");
|
|
|
+
|
|
|
+ // 防止有空行,手机号是必须要有的
|
|
|
+ String phone = investigateUser.getPhonenumber();
|
|
|
+ if (StringUtils.isEmpty(phone)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ phoneNumberJson.append("\"" + phone + "\",");
|
|
|
+ signNameJson.append("\"中新云\",");
|
|
|
+ //发送短信
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("number", investigateTableId);
|
|
|
+ templateParamJson.append(jsonObject).append(",");
|
|
|
+
|
|
|
+
|
|
|
+ phoneNumberJson.deleteCharAt(phoneNumberJson.length() - 1);//移除最后一个逗号字符,
|
|
|
+ templateParamJson.deleteCharAt(templateParamJson.length() - 1);//移除最后一个逗号字符
|
|
|
+ signNameJson.deleteCharAt(signNameJson.length() - 1);
|
|
|
+ phoneNumberJson.append("]");
|
|
|
+ templateParamJson.append("]");
|
|
|
+ signNameJson.append("]");
|
|
|
+
|
|
|
+ SendBatchSmsRequest sendBatchSmsRequest = new SendBatchSmsRequest();
|
|
|
+ //组装电话号码
|
|
|
+ sendBatchSmsRequest.setPhoneNumberJson(phoneNumberJson.toString());
|
|
|
+ //签名名称
|
|
|
+ sendBatchSmsRequest.setSignNameJson(signNameJson.toString());
|
|
|
+ //替换参数
|
|
|
+ sendBatchSmsRequest.setTemplateParamJson(templateParamJson.toString());
|
|
|
+ //固定的模板名称
|
|
|
+ sendBatchSmsRequest.setTemplateCode("SMS_463622836");
|
|
|
+ long startTimeSend = System.currentTimeMillis();
|
|
|
+ SendBatchSmsResponse sendBatchSmsResponse = SendSmsUtils.sendBatchSms(sendBatchSmsRequest);
|
|
|
+ long endTimeSend = System.currentTimeMillis() - startTimeSend;
|
|
|
+ System.out.println("执行批量下发短信接口请求:" + endTimeSend + "ms");
|
|
|
+ String code = sendBatchSmsResponse.getBody().getCode();
|
|
|
+ if (sendBatchSmsResponse.getBody().getCode() != null && "OK".equals(code)) {
|
|
|
+ System.out.println("批量短信发送成功");
|
|
|
+ } else {
|
|
|
+ System.out.println("批量短信发送失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void sendBatchSmsTableUpdate(Long investigateTableId, List<InvestigateUser> investigateUserList) {
|
|
|
for (InvestigateUser investigateUser : investigateUserList) {
|
|
|
StringBuffer phoneNumberJson = new StringBuffer();
|
|
|
StringBuffer templateParamJson = new StringBuffer();
|
|
@@ -251,7 +301,6 @@ public class InvestigateTableServiceImpl implements IInvestigateTableService {
|
|
|
templateParamJson.append("]");
|
|
|
signNameJson.append("]");
|
|
|
|
|
|
- long startTimeSql = System.currentTimeMillis();
|
|
|
SendBatchSmsRequest sendBatchSmsRequest = new SendBatchSmsRequest();
|
|
|
//组装电话号码
|
|
|
sendBatchSmsRequest.setPhoneNumberJson(phoneNumberJson.toString());
|