|
@@ -3,6 +3,8 @@ package com.boman.web.core.service;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
|
|
+import com.aliyuncs.exceptions.ClientException;
|
|
|
import com.boman.common.core.utils.SecurityUtils;
|
|
|
import com.boman.common.core.utils.StringUtils;
|
|
|
import com.boman.common.core.utils.collection.CollectionUtils;
|
|
@@ -21,6 +23,7 @@ import com.boman.gen.api.RemoteGenTableColumnService;
|
|
|
import com.boman.gen.api.RemoteGenTableService;
|
|
|
import com.boman.jflow.api.RemoteJflowProcessService;
|
|
|
import com.boman.system.api.RemoteMenuService;
|
|
|
+import com.boman.system.api.RemoteUserService;
|
|
|
import com.boman.web.core.domain.ActionType;
|
|
|
import com.boman.web.core.domain.RowResult;
|
|
|
import com.boman.web.core.domain.TableContext;
|
|
@@ -32,6 +35,7 @@ import com.boman.web.core.service.update.IBaseUpdateService;
|
|
|
import com.boman.web.core.utils.ColumnUtils;
|
|
|
import com.boman.web.core.utils.IdUtils;
|
|
|
import com.boman.web.core.utils.JSONObjectUtils;
|
|
|
+import com.boman.web.core.utils.SendSmsUtils;
|
|
|
import com.boman.wechat.api.RemoteWechatService;
|
|
|
import com.google.common.base.Strings;
|
|
|
import com.google.common.collect.Lists;
|
|
@@ -39,6 +43,7 @@ import org.apache.commons.lang3.BooleanUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.aop.framework.AopContext;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Isolation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -94,6 +99,8 @@ public class TableServiceCmdService {
|
|
|
private RemoteJflowProcessService remoteJflowProcessService;
|
|
|
@Resource
|
|
|
private RemoteWechatService remoteWechatService;
|
|
|
+ @Resource
|
|
|
+ private RemoteUserService remoteUserService;
|
|
|
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(TableServiceCmdService.class);
|
|
@@ -211,6 +218,32 @@ public class TableServiceCmdService {
|
|
|
wxMsgDto.setParams(messageInfo);
|
|
|
LOGGER.info("收文人id:{}, 发送数据: {}", receiveUserIds, messageInfo);
|
|
|
remoteWechatService.pushMsg(wxMsgDto);
|
|
|
+ List<Long> userIds = new ArrayList<>(new HashSet(receiveUserIds));
|
|
|
+ AjaxResult userList = remoteUserService.selectUserByIds(userIds);
|
|
|
+ List<Map<String, Object>> users = (List<Map<String, Object>>) userList.get("data");
|
|
|
+ String accessKeyId = "LTAI5tNA2fcBJH6EWRH6Pxr6";
|
|
|
+ String accessKeySecret = "5WdaPEOvC3u9LC7pwy2DQ9pgmJvgUr";
|
|
|
+ String signName = "";
|
|
|
+ String templateCode = "";
|
|
|
+ //自定义的模板变量
|
|
|
+ String templateParam = "";
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ if (users != null && users.size() > 0) {
|
|
|
+ for (Map<String, Object> user : users) {
|
|
|
+ String phoneNumber = user.get("phonenumber").toString();
|
|
|
+ if (StringUtils.isNotBlank(phoneNumber)) {
|
|
|
+ sb.append(phoneNumber).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(sb.toString())) {
|
|
|
+ try {
|
|
|
+ String phoneNumbers = sb.toString().substring(0, sb.toString().length() - 1);
|
|
|
+ SendSmsUtils.sendSms(phoneNumbers, templateParam, accessKeyId, accessKeySecret, signName, templateCode);
|
|
|
+ } catch (ClientException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return AjaxResult.success(resultList);
|
|
|
}
|