|
|
@@ -443,12 +443,19 @@ public class QwGroupMsgServiceImpl implements IQwGroupMsgService
|
|
|
|
|
|
QwAddMsgTemplateResult qwAddMsgTemplateResult = qwApiService.addMsgTemplate(msgTemplate,qwGroupMsgParam.getCorpId());
|
|
|
|
|
|
- if (qwAddMsgTemplateResult.getErrCode()!=0){
|
|
|
+ if (qwAddMsgTemplateResult == null || qwAddMsgTemplateResult.getErrCode()!=0){
|
|
|
+ int errCode = qwAddMsgTemplateResult == null ? -1 : qwAddMsgTemplateResult.getErrCode();
|
|
|
+ String errMsg = qwAddMsgTemplateResult == null ? "返回结果为空" : qwAddMsgTemplateResult.getErrMsg();
|
|
|
+ logger.error("即时客户群群发失败, groupMsgId={}, corpId={}, sender={}, chatIdCount={}, errCode={}, errMsg={}, failList={}",
|
|
|
+ qwGroupMsg.getId(), qwGroupMsgParam.getCorpId(), qwUserid,
|
|
|
+ arrayList == null ? 0 : arrayList.size(),
|
|
|
+ errCode, errMsg,
|
|
|
+ qwAddMsgTemplateResult == null ? null : qwAddMsgTemplateResult.getFailList());
|
|
|
qwGroupMsg.setIsSend(0);
|
|
|
qwGroupMsg.setCreateTime(DateUtils.getNowDate());
|
|
|
//主表做记录
|
|
|
insertRecordsGroup(qwGroupMsg,qwGroupMsgItem,qwGroupMsgParam.getCorpId(),qwCompany.getId());
|
|
|
- return R.error("成员:"+qwUserid+"/群群发消息失败"+":"+qwAddMsgTemplateResult.getErrMsg());
|
|
|
+ return R.error("成员:"+qwUserid+"/群群发消息失败"+":"+errMsg);
|
|
|
}
|
|
|
else {
|
|
|
|
|
|
@@ -855,6 +862,10 @@ public class QwGroupMsgServiceImpl implements IQwGroupMsgService
|
|
|
QwGroupMsg qwGroupMsg=new QwGroupMsg();
|
|
|
|
|
|
List<QwGroupMsgVO> qwGroupMsgTask = qwGroupMsgMapper.getQwGroupMsgTask();
|
|
|
+ logger.info("定时客户群发任务开始, size={}", qwGroupMsgTask == null ? 0 : qwGroupMsgTask.size());
|
|
|
+ if (qwGroupMsgTask == null || qwGroupMsgTask.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
qwGroupMsgTask.stream().forEach(item->{
|
|
|
//文字+图片
|
|
|
if (item.getMsgType()==1){
|
|
|
@@ -918,8 +929,15 @@ public class QwGroupMsgServiceImpl implements IQwGroupMsgService
|
|
|
|
|
|
//发送消息
|
|
|
QwAddMsgTemplateResult qwAddMsgTemplateResult = qwApiService.addMsgTemplate(msgTemplate,item.getCorpId());
|
|
|
- if (qwAddMsgTemplateResult.getErrCode()!=0){
|
|
|
+ if (qwAddMsgTemplateResult == null || qwAddMsgTemplateResult.getErrCode()!=0){
|
|
|
//发送失败
|
|
|
+ int errCode = qwAddMsgTemplateResult == null ? -1 : qwAddMsgTemplateResult.getErrCode();
|
|
|
+ String errMsg = qwAddMsgTemplateResult == null ? "返回结果为空" : qwAddMsgTemplateResult.getErrMsg();
|
|
|
+ logger.error("定时客户群群发失败, groupMsgId={}, corpId={}, sender={}, chatIdCount={}, errCode={}, errMsg={}, failList={}",
|
|
|
+ item.getId(), item.getCorpId(), sender,
|
|
|
+ arrayList == null ? 0 : arrayList.size(),
|
|
|
+ errCode, errMsg,
|
|
|
+ qwAddMsgTemplateResult == null ? null : qwAddMsgTemplateResult.getFailList());
|
|
|
qwGroupMsg.setIsSend(0);
|
|
|
qwGroupMsgMapper.updateQwGroupMsg(qwGroupMsg);
|
|
|
|
|
|
@@ -1012,10 +1030,17 @@ public class QwGroupMsgServiceImpl implements IQwGroupMsgService
|
|
|
//发送消息
|
|
|
QwAddMsgTemplateResult qwAddMsgTemplateResult = qwApiService.addMsgTemplate(msgTemplate, item.getCorpId());
|
|
|
|
|
|
- qwGroupMsg.setMsgid(qwAddMsgTemplateResult.getMsgId() == null ? null : qwAddMsgTemplateResult.getMsgId());
|
|
|
+ qwGroupMsg.setMsgid(qwAddMsgTemplateResult == null || qwAddMsgTemplateResult.getMsgId() == null ? null : qwAddMsgTemplateResult.getMsgId());
|
|
|
|
|
|
- if (qwAddMsgTemplateResult.getErrCode()!=0){
|
|
|
+ if (qwAddMsgTemplateResult == null || qwAddMsgTemplateResult.getErrCode()!=0){
|
|
|
//发送失败 主表做记录
|
|
|
+ int errCode = qwAddMsgTemplateResult == null ? -1 : qwAddMsgTemplateResult.getErrCode();
|
|
|
+ String errMsg = qwAddMsgTemplateResult == null ? "返回结果为空" : qwAddMsgTemplateResult.getErrMsg();
|
|
|
+ logger.error("定时客户群发失败, groupMsgId={}, corpId={}, chatType=single, customerCount={}, errCode={}, errMsg={}, failList={}",
|
|
|
+ item.getId(), item.getCorpId(),
|
|
|
+ customerList == null ? 0 : customerList.size(),
|
|
|
+ errCode, errMsg,
|
|
|
+ qwAddMsgTemplateResult == null ? null : qwAddMsgTemplateResult.getFailList());
|
|
|
qwGroupMsg.setIsSend(0);
|
|
|
|
|
|
}
|