发送短信接口
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
<result column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="type" jdbcType="VARCHAR" property="type"/>
|
||||
<result column="template_id" jdbcType="VARCHAR" property="templateId"/>
|
||||
<result column="send_content" jdbcType="VARCHAR" property="sendContent"/>
|
||||
<result column="receiver_company_id" jdbcType="VARCHAR" property="receiverCompanyId"/>
|
||||
<result column="receiver_company_name" jdbcType="VARCHAR" property="receiverCompanyName"/>
|
||||
<result column="receiver_account" jdbcType="VARCHAR" property="receiverAccount"/>
|
||||
@ -18,5 +19,7 @@
|
||||
<result column="section_name" jdbcType="VARCHAR" property="sectionName"/>
|
||||
<result column="assess_room_id" jdbcType="VARCHAR" property="assessRoomId"/>
|
||||
<result column="assess_room_sort" jdbcType="INTEGER" property="assessRoomSort"/>
|
||||
<result column="sender_user_id" jdbcType="VARCHAR" property="senderUserId"/>
|
||||
<result column="sender_user_name" jdbcType="VARCHAR" property="senderUserName"/>
|
||||
</resultMap>
|
||||
</mapper>
|
@ -43,6 +43,12 @@ public class BizSendMsgLog implements Serializable {
|
||||
@ApiModelProperty(value = "模板ID")
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* 发送内容
|
||||
*/
|
||||
@ApiModelProperty(value = "发送内容")
|
||||
private String sendContent;
|
||||
|
||||
/**
|
||||
* 接收人机构ID
|
||||
*/
|
||||
@ -112,5 +118,17 @@ public class BizSendMsgLog implements Serializable {
|
||||
@ApiModelProperty(value = "评审室排序")
|
||||
private Integer assessRoomSort;
|
||||
|
||||
/**
|
||||
* 发送人用户ID
|
||||
*/
|
||||
@ApiModelProperty(value = "发送人用户ID")
|
||||
private String senderUserId;
|
||||
|
||||
/**
|
||||
* 发送人用户名称
|
||||
*/
|
||||
@ApiModelProperty(value = "发送人用户名称")
|
||||
private String senderUserName;
|
||||
|
||||
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class BizSendMsgTemplateServiceImpl extends ServiceImpl<BizSendMsgTemplat
|
||||
//任务形式:realtime实时;timing-定时
|
||||
String taskForm = msgTemplate.getTaskForm();
|
||||
if (StringUtils.equals("realtime", taskForm)) {
|
||||
//发送
|
||||
//发送短信
|
||||
sendSms( msgInfo, receiver, magContent);
|
||||
}
|
||||
else if (StringUtils.equals("timing", taskForm)) {
|
||||
@ -80,8 +80,10 @@ public class BizSendMsgTemplateServiceImpl extends ServiceImpl<BizSendMsgTemplat
|
||||
.setReceiverCompanyName(receiver.getReceiverCompanyName())
|
||||
.setReceiverAccount(receiver.getReceiverAccount());
|
||||
LambdaQueryWrapper<BizSendMsgLog> queryWrapper = Wrappers.lambdaQuery(msgLog);
|
||||
//定时短信,查询当前收信人是或否发送过,发送过则不再发送短信
|
||||
List<BizSendMsgLog> msgLogList = msgLogService.list(queryWrapper);
|
||||
if (msgLogList.isEmpty()){
|
||||
//发送短信
|
||||
sendSms( msgInfo, receiver, magContent);
|
||||
}
|
||||
}
|
||||
@ -95,11 +97,18 @@ public class BizSendMsgTemplateServiceImpl extends ServiceImpl<BizSendMsgTemplat
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
* @param msgInfo
|
||||
* @param receiver
|
||||
* @param magContent
|
||||
* @return
|
||||
*/
|
||||
public boolean sendSms(BizSendMsgInfo msgInfo, BizReceiverVO receiver, String magContent) {
|
||||
boolean result = false;
|
||||
//当前用户userId
|
||||
String userId = "ex-yueyang10";//cacheUserService.getCacheUser().getUserId();
|
||||
String userName = "岳洋";//cacheUserService.getCacheUser().getFullName();
|
||||
String userId = cacheUserService.getCacheUser().getUserId();//"ex-wanghy623";
|
||||
String userName = cacheUserService.getCacheUser().getFullName();//"曹鹏";
|
||||
BizSendMsgVO msgVO = new BizSendMsgVO();
|
||||
msgVO.setSendUid(userId)
|
||||
.setSendUName(userName)
|
||||
@ -108,7 +117,7 @@ public class BizSendMsgTemplateServiceImpl extends ServiceImpl<BizSendMsgTemplat
|
||||
//发送短信
|
||||
result = msgService.sendMsg(msgVO);
|
||||
//保存日志
|
||||
savaLog(msgInfo, result, receiver);
|
||||
savaLog(msgInfo, result, receiver, magContent);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -118,12 +127,16 @@ public class BizSendMsgTemplateServiceImpl extends ServiceImpl<BizSendMsgTemplat
|
||||
* @param result
|
||||
* @param receiverVO
|
||||
*/
|
||||
public void savaLog(BizSendMsgInfo msgInfo, boolean result, BizReceiverVO receiverVO) {
|
||||
public void savaLog(BizSendMsgInfo msgInfo, boolean result, BizReceiverVO receiverVO, String magContent) {
|
||||
//当前用户userId
|
||||
String userId = cacheUserService.getCacheUser().getUserId();//"ex-wanghy623";
|
||||
String userName = cacheUserService.getCacheUser().getFullName();//"曹鹏";
|
||||
BizSendMsgLog msgLog = new BizSendMsgLog();
|
||||
String id = PropertyUtils.getSnowflakeId();
|
||||
msgLog.setId(id)
|
||||
.setType(msgInfo.getType())
|
||||
.setTemplateId(msgInfo.getTemplateId())
|
||||
.setSendContent(magContent)
|
||||
.setReceiverCompanyId(receiverVO.getReceiverCompanyId())
|
||||
.setReceiverCompanyName(receiverVO.getReceiverCompanyName())
|
||||
.setReceiverAccount(receiverVO.getReceiverAccount())
|
||||
@ -134,7 +147,9 @@ public class BizSendMsgTemplateServiceImpl extends ServiceImpl<BizSendMsgTemplat
|
||||
.setSectionId(msgInfo.getSectionId())
|
||||
.setSectionName(msgInfo.getSectionName())
|
||||
.setAssessRoomId(msgInfo.getAssessRoomId())
|
||||
.setAssessRoomSort(msgInfo.getAssessRoomSort());
|
||||
.setAssessRoomSort(msgInfo.getAssessRoomSort())
|
||||
.setSenderUserId(userId)
|
||||
.setSenderUserName(userName);
|
||||
log.info("sendMsgLog传入数据:"+ JsonUtils.objectToJson(msgLog));
|
||||
msgLogService.save(msgLog);
|
||||
}
|
||||
|
Reference in New Issue
Block a user