mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 03:46:50 +08:00
修改案例推荐列表重新推送逻辑代码
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.xboe.module.boecase.service;
|
package com.xboe.module.boecase.service;
|
||||||
|
|
||||||
import com.xboe.core.CurrentUser;
|
import com.xboe.core.CurrentUser;
|
||||||
|
import com.xboe.module.boecase.entity.CasesRecommend;
|
||||||
import com.xboe.module.boecase.entity.CasesRecommendPushRecord;
|
import com.xboe.module.boecase.entity.CasesRecommendPushRecord;
|
||||||
import com.xboe.module.boecase.vo.CasesRecommendLaunchVo;
|
import com.xboe.module.boecase.vo.CasesRecommendLaunchVo;
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ public interface ICasesRecommendPushRecordService {
|
|||||||
/**
|
/**
|
||||||
* 重新推送或撤回
|
* 重新推送或撤回
|
||||||
* @param isWithdraw 是否撤回
|
* @param isWithdraw 是否撤回
|
||||||
* @param casesRecommendId 案例推荐ID
|
* @param casesRecommend 案例推荐
|
||||||
*/
|
*/
|
||||||
void rePushOrWithdraw(boolean isWithdraw, String casesRecommendId);
|
void rePushOrWithdraw(boolean isWithdraw, CasesRecommend casesRecommend);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.xboe.module.boecase.service.impl;
|
package com.xboe.module.boecase.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.xboe.api.ThirdApi;
|
import com.xboe.api.ThirdApi;
|
||||||
import com.xboe.api.vo.*;
|
import com.xboe.api.vo.*;
|
||||||
@@ -168,6 +169,7 @@ public class CasesRecommendPushRecordServiceImpl implements ICasesRecommendPushR
|
|||||||
private void sendCasesRecommend(CasesRecommend casesRecommend) {
|
private void sendCasesRecommend(CasesRecommend casesRecommend) {
|
||||||
List<Integer> pushStatusList = new ArrayList<>();
|
List<Integer> pushStatusList = new ArrayList<>();
|
||||||
pushStatusList.add(CasesPushStatusEnum.WAIT_PUSH.getStatus());
|
pushStatusList.add(CasesPushStatusEnum.WAIT_PUSH.getStatus());
|
||||||
|
pushStatusList.add(CasesPushStatusEnum.PUSH_REVOKE.getStatus());
|
||||||
List<CasesRecommendPushRecord> casesRecommendPushRecords = casesRecommendPushRecordDao.getGenericDao().findList(CasesRecommendPushRecord.class, FieldFilters.in("pushStatus", pushStatusList));
|
List<CasesRecommendPushRecord> casesRecommendPushRecords = casesRecommendPushRecordDao.getGenericDao().findList(CasesRecommendPushRecord.class, FieldFilters.in("pushStatus", pushStatusList));
|
||||||
if (CollectionUtils.isEmpty(casesRecommendPushRecords)) {
|
if (CollectionUtils.isEmpty(casesRecommendPushRecords)) {
|
||||||
//修改为推送完成 --- 无数据 无需推送
|
//修改为推送完成 --- 无数据 无需推送
|
||||||
@@ -206,22 +208,25 @@ public class CasesRecommendPushRecordServiceImpl implements ICasesRecommendPushR
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rePushOrWithdraw(boolean isWithdraw, String casesRecommendId) {
|
public void rePushOrWithdraw(boolean isWithdraw, CasesRecommend casesRecommend) {
|
||||||
if (StringUtils.isEmpty(casesRecommendId)) {
|
if (ObjectUtil.isEmpty(casesRecommend)) {
|
||||||
throw new RuntimeException("缺少必要参数");
|
throw new RuntimeException("缺少必要参数");
|
||||||
}
|
}
|
||||||
List<CasesRecommendPushRecord> recordList = findAllByRecommendId(casesRecommendId);
|
|
||||||
if (isWithdraw) {
|
if (isWithdraw) {
|
||||||
|
List<CasesRecommendPushRecord> recordList = findAllByRecommendId(casesRecommend.getId());
|
||||||
recordList.stream().forEach(record ->
|
recordList.stream().forEach(record ->
|
||||||
record.setPushStatus(CasesPushStatusEnum.PUSH_REVOKE.getStatus())
|
record.setPushStatus(CasesPushStatusEnum.PUSH_REVOKE.getStatus())
|
||||||
);
|
);
|
||||||
|
if (CollectionUtil.isNotEmpty(recordList)) {
|
||||||
|
casesRecommendPushRecordDao.saveList(recordList);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
recordList.stream().filter(it -> CasesPushStatusEnum.PUSH_SUCCESS.getStatus() != it.getPushStatus()).forEach(record ->
|
try {
|
||||||
record.setPushStatus(CasesPushStatusEnum.WAIT_PUSH.getStatus())
|
//发送推送案例消息
|
||||||
);
|
sendCasesRecommend(casesRecommend);
|
||||||
}
|
} catch (Exception e) {
|
||||||
if (CollectionUtil.isNotEmpty(recordList)) {
|
log.error("推送失败", e);
|
||||||
casesRecommendPushRecordDao.saveList(recordList);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,14 +66,13 @@ public class CasesRecommendServiceImpl implements ICasesRecommendService {
|
|||||||
|| CasesPushStatusEnum.PUSH_ING.getStatus().equals(db.getPushProgress())
|
|| CasesPushStatusEnum.PUSH_ING.getStatus().equals(db.getPushProgress())
|
||||||
){
|
){
|
||||||
// 当为推送成功时为
|
// 当为推送成功时为
|
||||||
iCasesRecommendPushRecordService.rePushOrWithdraw(true, casesRecommendPushVo.getCasesRecommendId());
|
iCasesRecommendPushRecordService.rePushOrWithdraw(true, db);
|
||||||
db.setPushProgress(CasesPushStatusEnum.PUSH_REVOKE.getStatus());
|
db.setPushProgress(CasesPushStatusEnum.PUSH_REVOKE.getStatus());
|
||||||
|
casesRecommendDao.update(db);
|
||||||
}else if (CasesPushStatusEnum.PUSH_FAIL.getStatus().equals(db.getPushProgress())
|
}else if (CasesPushStatusEnum.PUSH_FAIL.getStatus().equals(db.getPushProgress())
|
||||||
|| CasesPushStatusEnum.PUSH_REVOKE.getStatus().equals(db.getPushProgress())){
|
|| CasesPushStatusEnum.PUSH_REVOKE.getStatus().equals(db.getPushProgress())){
|
||||||
// 推送失败或者已撤回时
|
// 推送失败或者已撤回时
|
||||||
iCasesRecommendPushRecordService.rePushOrWithdraw(false, casesRecommendPushVo.getCasesRecommendId());
|
iCasesRecommendPushRecordService.rePushOrWithdraw(false, db);
|
||||||
db.setPushProgress(CasesPushStatusEnum.WAIT_PUSH.getStatus());
|
|
||||||
}
|
}
|
||||||
casesRecommendDao.update(db);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user