Commit d06699bd authored by renandong's avatar renandong 🇨🇳

1.单推推送日志兼容群推

parent 95873b51
...@@ -12,6 +12,7 @@ import com.weface.dto.InformForm; ...@@ -12,6 +12,7 @@ import com.weface.dto.InformForm;
import com.weface.entity.PushLogEntity; import com.weface.entity.PushLogEntity;
import com.weface.service.PushLogService; import com.weface.service.PushLogService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -38,10 +39,16 @@ public class PushLogServiceImpl extends ServiceImpl<PushLogDao, PushLogEntity> i ...@@ -38,10 +39,16 @@ public class PushLogServiceImpl extends ServiceImpl<PushLogDao, PushLogEntity> i
pushLogEntity.setAppName(informForm.getEquipmentType()); pushLogEntity.setAppName(informForm.getEquipmentType());
pushLogEntity.setTaskId(key); pushLogEntity.setTaskId(key);
pushLogEntity.setResult(data.toString()); pushLogEntity.setResult(data.toString());
DES des = DES.getInstanceDes(); String phone = informForm.getPhone();
pushLogEntity.setPhone(des.encrypt(informForm.getPhone())); if (StringUtils.isNotEmpty(phone)){
pushLogEntity.setMessageTemplate(informForm.getMessageTemplate()); DES des = DES.getInstanceDes();
pushLogEntity.setPushTarget(informForm.getCid()); pushLogEntity.setPhone(des.encrypt(phone));
}
Integer messageTemplate = informForm.getMessageTemplate();
if (messageTemplate!=null){
pushLogEntity.setMessageTemplate(messageTemplate);
}
pushLogEntity.setPushTarget(informForm.getCid() == null ? "all" : informForm.getCid());
pushLogEntity.setPushContent(informForm.getBody()); pushLogEntity.setPushContent(informForm.getBody());
pushLogEntity.setArriveStatus(1001); pushLogEntity.setArriveStatus(1001);
pushLogEntity.setUpdateTime(new Date()); pushLogEntity.setUpdateTime(new Date());
......
...@@ -62,6 +62,9 @@ public class UserTagsTask { ...@@ -62,6 +62,9 @@ public class UserTagsTask {
*/ */
private static final Integer TIME = 2; private static final Integer TIME = 2;
/**
* 查询未推送消息成功记录,发送短信通知
*/
@Scheduled(cron = "0 0 0/1 * * ? ") @Scheduled(cron = "0 0 0/1 * * ? ")
public void sendMessage() { public void sendMessage() {
try { try {
...@@ -73,18 +76,21 @@ public class UserTagsTask { ...@@ -73,18 +76,21 @@ public class UserTagsTask {
DES des = DES.getInstanceDes(); DES des = DES.getInstanceDes();
for (PushLogEntity pushLogEntity : list) { for (PushLogEntity pushLogEntity : list) {
String phone = pushLogEntity.getPhone(); String phone = pushLogEntity.getPhone();
if (CommonUtil.isBase64(phone)) { if (StringUtils.isNotEmpty(phone)){
phone = des.decrypt(phone); if (CommonUtil.isBase64(phone)) {
} phone = des.decrypt(phone);
String pushContent = pushLogEntity.getPushContent(); }
Integer messageTemplate = pushLogEntity.getMessageTemplate(); String pushContent = pushLogEntity.getPushContent();
Integer arriveStatus = pushLogEntity.getArriveStatus(); Integer messageTemplate = pushLogEntity.getMessageTemplate();
if (1001 == arriveStatus) { Integer arriveStatus = pushLogEntity.getArriveStatus();
boolean b = ShortMsgSend.sendMobileByRegister(pushContent, phone, messageTemplate); if (1001 == arriveStatus) {
if (b) { boolean b = ShortMsgSend.sendMobileByRegister(pushContent, phone, messageTemplate);
log.info("执行短信发送成功"); if (b) {
pushLogEntity.setArriveStatus(1003); log.info("执行短信发送成功");
updateBatch.add(pushLogEntity); pushLogEntity.setArriveStatus(1003);
pushLogEntity.setUpdateTime(new Date());
updateBatch.add(pushLogEntity);
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment