优化
This commit is contained in:
parent
462da67a04
commit
9aa39ddc1c
@ -11,7 +11,6 @@ import com.xkrs.straw.model.bean.FirePointQueryResultBean;
|
|||||||
import com.xkrs.straw.model.entity.FirePointOrdinaryEntity;
|
import com.xkrs.straw.model.entity.FirePointOrdinaryEntity;
|
||||||
import com.xkrs.straw.model.entity.SysUserEntity;
|
import com.xkrs.straw.model.entity.SysUserEntity;
|
||||||
import com.xkrs.straw.model.helper.PushHelper;
|
import com.xkrs.straw.model.helper.PushHelper;
|
||||||
import com.xkrs.straw.model.helper.SMSHelper;
|
|
||||||
import com.xkrs.straw.model.vo.AllFirePointVo;
|
import com.xkrs.straw.model.vo.AllFirePointVo;
|
||||||
import com.xkrs.straw.utils.FirePointConvertUtils;
|
import com.xkrs.straw.utils.FirePointConvertUtils;
|
||||||
import com.xkrs.straw.utils.FirePointQueryManager;
|
import com.xkrs.straw.utils.FirePointQueryManager;
|
||||||
@ -58,9 +57,6 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
@Resource
|
@Resource
|
||||||
private StreetService streetService;
|
private StreetService streetService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private SMSHelper smsHelper;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PushHelper pushHelper;
|
private PushHelper pushHelper;
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ import com.xkrs.model.validation.SysUserQoUpdate;
|
|||||||
import com.xkrs.service.RedisService;
|
import com.xkrs.service.RedisService;
|
||||||
import com.xkrs.straw.dao.SysUserDao;
|
import com.xkrs.straw.dao.SysUserDao;
|
||||||
import com.xkrs.straw.model.entity.SysUserEntity;
|
import com.xkrs.straw.model.entity.SysUserEntity;
|
||||||
import com.xkrs.straw.model.helper.SMSHelper;
|
|
||||||
import com.xkrs.straw.model.qo.SysUserQo;
|
import com.xkrs.straw.model.qo.SysUserQo;
|
||||||
import com.xkrs.straw.model.qo.SysUserReceiveSmsQo;
|
import com.xkrs.straw.model.qo.SysUserReceiveSmsQo;
|
||||||
import com.xkrs.straw.model.qo.SysUserRemarkQo;
|
import com.xkrs.straw.model.qo.SysUserRemarkQo;
|
||||||
@ -56,9 +55,6 @@ public class SysUserController {
|
|||||||
@Resource
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private SMSHelper smsHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新(批量)系统用户信息
|
* 更新(批量)系统用户信息
|
||||||
*
|
*
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
package com.xkrs.straw.model.helper;
|
|
||||||
|
|
||||||
import com.xkrs.straw.model.entity.SysUserEntity;
|
|
||||||
import com.xkrs.straw.model.vo.AllFirePointVo;
|
|
||||||
import com.xkrs.utils.SMSUtils;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class SMSHelper {
|
|
||||||
|
|
||||||
public static Logger log = LoggerFactory.getLogger(SMSHelper.class);
|
|
||||||
|
|
||||||
public SMSHelper() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispatchSMSMessage(List<SysUserEntity> smsReceiverList, String[] templateParamArray, AllFirePointVo[] detailParamArray) {
|
|
||||||
if (smsReceiverList != null && smsReceiverList.size() > 0) {
|
|
||||||
String[] telephoneArray = new String[smsReceiverList.size()];
|
|
||||||
for (int i = 0; i < smsReceiverList.size(); i++) {
|
|
||||||
telephoneArray[i] = "86" + smsReceiverList.get(i).getUserName();
|
|
||||||
}
|
|
||||||
xingkeSMSMessage(telephoneArray, templateParamArray, detailParamArray);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 星科瑞升向用户发送短信
|
|
||||||
*/
|
|
||||||
private void xingkeSMSMessage(String[] telephoneArray, String[] templateParamArray, AllFirePointVo[] detailParamArray) {
|
|
||||||
int resValue = SMSUtils.sendSmsToUser(telephoneArray, "1425995", templateParamArray);
|
|
||||||
String sendResult = resValue == 0 ? "短信通知发送成功!" : "短信通知发送失败!";
|
|
||||||
//记录短信通知日志
|
|
||||||
StringBuilder stringBuilder = new StringBuilder("发送人:青岛星科瑞升信息科技有限公司\n");
|
|
||||||
for (String telephone : telephoneArray) {
|
|
||||||
stringBuilder.append("接收人:").append(telephone).append("\n");
|
|
||||||
}
|
|
||||||
for (String templateParam : templateParamArray) {
|
|
||||||
stringBuilder.append("模板参数:").append(templateParam).append("\n");
|
|
||||||
}
|
|
||||||
for (AllFirePointVo detailParam : detailParamArray) {
|
|
||||||
stringBuilder.append("超级详细的参数:").append(detailParam.toString()).append("\n");
|
|
||||||
}
|
|
||||||
stringBuilder.append(sendResult);
|
|
||||||
log.info(stringBuilder.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -7,9 +7,9 @@ import com.xkrs.straw.model.entity.FirePointOrdinaryEntity;
|
|||||||
import com.xkrs.straw.model.entity.FirePointPreciseEntity;
|
import com.xkrs.straw.model.entity.FirePointPreciseEntity;
|
||||||
import com.xkrs.straw.model.entity.SysUserEntity;
|
import com.xkrs.straw.model.entity.SysUserEntity;
|
||||||
import com.xkrs.straw.model.helper.PushHelper;
|
import com.xkrs.straw.model.helper.PushHelper;
|
||||||
import com.xkrs.straw.model.helper.SMSHelper;
|
|
||||||
import com.xkrs.straw.model.vo.AllFirePointVo;
|
import com.xkrs.straw.model.vo.AllFirePointVo;
|
||||||
import com.xkrs.utils.FirePointCodeUtils;
|
import com.xkrs.utils.FirePointCodeUtils;
|
||||||
|
import com.xkrs.utils.SMSUtils;
|
||||||
import com.xkrs.utils.WDWxSendMsgUtil;
|
import com.xkrs.utils.WDWxSendMsgUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -29,9 +29,6 @@ public class FirePointPushManager {
|
|||||||
@Resource
|
@Resource
|
||||||
private CountyCodeWeiXinDao countyCodeWeiXinDao;
|
private CountyCodeWeiXinDao countyCodeWeiXinDao;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private SMSHelper smsHelper;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PushHelper pushHelper;
|
private PushHelper pushHelper;
|
||||||
|
|
||||||
@ -58,8 +55,29 @@ public class FirePointPushManager {
|
|||||||
// } catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
// }
|
// }
|
||||||
//分发短信通知
|
String[] templateParamArray = new String[]{firePoint.getFirePointAddress()};
|
||||||
smsHelper.dispatchSMSMessage(smsReceiverList, new String[]{firePoint.getFirePointAddress()}, new AllFirePointVo[]{firePoint});
|
AllFirePointVo[] detailParamArray = new AllFirePointVo[]{firePoint};
|
||||||
|
if (smsReceiverList.size() > 0) {
|
||||||
|
String[] telephoneArray = new String[smsReceiverList.size()];
|
||||||
|
for (int i = 0; i < smsReceiverList.size(); i++) {
|
||||||
|
telephoneArray[i] = "86" + smsReceiverList.get(i).getUserName();
|
||||||
|
}
|
||||||
|
int resValue = SMSUtils.sendSmsToUser(telephoneArray, "1425995", templateParamArray);
|
||||||
|
String sendResult = resValue == 0 ? "短信通知发送成功!" : "短信通知发送失败!";
|
||||||
|
//记录短信通知日志
|
||||||
|
StringBuilder stringBuilder = new StringBuilder("发送人:青岛星科瑞升信息科技有限公司\n");
|
||||||
|
for (String telephone : telephoneArray) {
|
||||||
|
stringBuilder.append("接收人:").append(telephone).append("\n");
|
||||||
|
}
|
||||||
|
for (String templateParam : templateParamArray) {
|
||||||
|
stringBuilder.append("模板参数:").append(templateParam).append("\n");
|
||||||
|
}
|
||||||
|
for (AllFirePointVo detailParam : detailParamArray) {
|
||||||
|
stringBuilder.append("超级详细的参数:").append(detailParam.toString()).append("\n");
|
||||||
|
}
|
||||||
|
stringBuilder.append(sendResult);
|
||||||
|
log.info(stringBuilder.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user