Parcourir la source

feat(app): 增加场地运行状态判断逻辑

- 在获取场地信息方法中,增加运行状态判断逻辑
- 根据场地的运行类型和时间,判断场地是否处于运行中
- 优化场地信息对象,添加运行状态字段
SheepHy il y a 3 semaines
Parent
commit
e051bd3a08

+ 10 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/DetailServiceImpl.java

@@ -78,6 +78,7 @@ public class DetailServiceImpl implements IDetailService {
     public PlaceInfoVO getPlaceInfo(String id) {
         AppSite appSite = appSiteMapper.selectById(id);
         PlaceInfoVO placeInfo = appSiteMapper.getPlaceInfo(id);
+
         List<DictModel> dictModels = sysDictMapper.queryDictItemsByCode(FACILITY_INFO);
         List<String> facilityInfo = new ArrayList<>();
         if(null != placeInfo.getFacility()){
@@ -109,6 +110,15 @@ public class DetailServiceImpl implements IDetailService {
             }
         }
         placeInfo.setInstructorVOList(instructorVOList);
+        placeInfo.setRunStatus((appSite.getRunStatus() == 0) && (
+                (appSite.getRunType() == 0) ||
+                        (appSite.getRunType() == 1 &&
+                                appSite.getStartTime() != null &&
+                                appSite.getEndTime() != null &&
+                                new Date().after(appSite.getStartTime()) &&
+                                new Date().before(appSite.getEndTime()))
+        ));
+
         if(appSite.getType() == 0){
             List<PlaceInfoVO.PlaceInfoMsgVO> placeInfoMsgVOS = new ArrayList<>();
             appSitePlaceMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getSiteId, id)