Commit fd392830 authored by zhangqingle's avatar zhangqingle

增加调智信通知接口fallback

parent a0c10bdc
......@@ -86,6 +86,7 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
// 判断进度 是否大于数据库已经存在的进度
double now = brStudentChapter.getProgress();
if (now >= old){ // 进度大于以前的进度
now = now > 1 ? 1: now < 0 ? 0 : now;
currentProgress = (now*100)+"%";
if (brStudentChapterDto.getMaxPosition() != null){
brStudentChapter.setMaxPosition(brStudentChapterDto.getMaxPosition());
......@@ -93,6 +94,7 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
line = bRStudentChapterRepository.updateById(brStudentChapter);
}else { // 反之,只需更新最近看的时间
brStudentChapter.setProgress(old);
old = old > 1 ? 1: old < 0 ? 0 : old;
currentProgress = (old*100)+"%";
line = bRStudentChapterRepository.updateById(brStudentChapter);
}
......@@ -102,7 +104,9 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
brStudentChapter = this.dealBrstudentChapter(brStudentChapter, brStudentChapterDto);
brStudentChapter.setStudentId(brStudentChapterDto.getStudentId());
brStudentChapter.setChapterId(brStudentChapterDto.getChapterId());
currentProgress = (brStudentChapter.getProgress()*100)+"%";
// 规避 复数 和超100% 的情况
double progress = brStudentChapter.getProgress() > 1 ? 1: brStudentChapter.getProgress() < 0 ? 0 : brStudentChapter.getProgress();
currentProgress = (progress*100)+"%";
line = bRStudentChapterRepository.insertSelective(brStudentChapter);
}
}
......@@ -176,6 +180,7 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
line = bChapterRepository.updateByPrimaryKeySelective(bChapter) > line ? bChapterRepository.updateByPrimaryKeySelective(bChapter): line;
}
Map map = new HashMap();
// 规避 复数 和超100% 的情况
map.put("currentProgress", currentProgress);
return map;
}
......
package org.rcisoft.common.util.fallback;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.common.util.feignClient.MicroappFeignClient;
import org.rcisoft.common.util.feignDto.HaveJurisdictionReqDTO;
import org.rcisoft.core.result.Ret;
@Slf4j
public class MicroappFeignClientFallBack implements MicroappFeignClient {
@Override
public Ret isHaveApps(Long UserId, Long corpId, Long appId, String zxClientType, Long zxAccountId) {
log.error("---------------调智信接口 micro_app/isHaveApps 失败-------------------");
return new Ret();
}
@Override
public Ret haveJurisdictionUser(HaveJurisdictionReqDTO haveJurisdictionReqDTO, String zxClientType, Long zxAccountId) {
log.error("---------------调智信接口 /micro_app/haveJurisdictionUserFast(筛选有通知权限的人) 失败-------------------");
return new Ret();
}
@Override
public Ret haveJurisdictionUserFast(HaveJurisdictionReqDTO haveJurisdictionReqDTO, String zxClientType, Long zxAccountId) {
log.error("---------------调智信接口 /micro_app/haveJurisdictionUserFast(筛选有通知权限的人-优化) 失败-------------------");
return new Ret();
}
}
package org.rcisoft.common.util.fallback;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.common.util.feignClient.NotificationFeignClient;
import org.rcisoft.common.util.feignDto.MTNotificationSendReqDTO;
import org.rcisoft.core.result.NotiRet;
@Slf4j
public class NotificationFeignClientFallBack implements NotificationFeignClient {
@Override
public NotiRet sendMessage(MTNotificationSendReqDTO mtNotificationSendReqDTO, String zxClientType, Long zxAccountId) {
log.error("---------------发送通知接口报错------------------");
return new NotiRet();
}
}
package org.rcisoft.common.util.feignClient;
import org.rcisoft.common.util.fallback.MicroappFeignClientFallBack;
import org.rcisoft.common.util.feignDto.HaveJurisdictionReqDTO;
import org.rcisoft.common.util.feignDto.MTNotificationSendReqDTO;
import org.rcisoft.core.result.Ret;
......@@ -12,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
/**
* 智信消息客户端接口
*/
@FeignClient(value = "ZX-MICROAPP")
@FeignClient(value = "ZX-MICROAPP", fallback = MicroappFeignClientFallBack.class)
public interface MicroappFeignClient {
/**
......
package org.rcisoft.common.util.feignClient;
import org.rcisoft.common.util.fallback.NotificationFeignClientFallBack;
import org.rcisoft.core.result.NotiRet;
import org.rcisoft.core.result.Ret;
import org.rcisoft.common.util.feignDto.MTNotificationSendReqDTO;
......@@ -14,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* 智信消息客户端接口
*/
@Component
@FeignClient(value = "ZX-NOTIFICATION")
@FeignClient(value = "ZX-NOTIFICATION", fallback = NotificationFeignClientFallBack.class)
public interface NotificationFeignClient {
/**
......
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