|
@@ -1,16 +1,25 @@
|
|
|
package com.yunfeiyun.agmp.fms.service.impl;
|
|
package com.yunfeiyun.agmp.fms.service.impl;
|
|
|
|
|
|
|
|
|
|
+import com.yunfeiyun.agmp.common.constant.ErrorCode;
|
|
|
|
|
+import com.yunfeiyun.agmp.common.constant.ResConstants;
|
|
|
|
|
+import com.yunfeiyun.agmp.common.enums.CommonEnums;
|
|
|
|
|
+import com.yunfeiyun.agmp.common.exception.BizException;
|
|
|
|
|
+import com.yunfeiyun.agmp.common.framework.manager.ResManager;
|
|
|
|
|
+import com.yunfeiyun.agmp.common.utils.SecurityUtils;
|
|
|
|
|
+import com.yunfeiyun.agmp.common.utils.StringUtils;
|
|
|
|
|
+import com.yunfeiyun.agmp.common.web.system.domain.SysRes;
|
|
|
|
|
+import com.yunfeiyun.agmp.fms.domain.FmsPeriod;
|
|
|
import com.yunfeiyun.agmp.fms.domain.dto.FmsScreenPlanStatDto;
|
|
import com.yunfeiyun.agmp.fms.domain.dto.FmsScreenPlanStatDto;
|
|
|
import com.yunfeiyun.agmp.fms.domain.reqvo.FmsScreenStatReqVo;
|
|
import com.yunfeiyun.agmp.fms.domain.reqvo.FmsScreenStatReqVo;
|
|
|
import com.yunfeiyun.agmp.fms.domain.resvo.*;
|
|
import com.yunfeiyun.agmp.fms.domain.resvo.*;
|
|
|
import com.yunfeiyun.agmp.fms.mapper.FmsScreenMapper;
|
|
import com.yunfeiyun.agmp.fms.mapper.FmsScreenMapper;
|
|
|
|
|
+import com.yunfeiyun.agmp.fms.service.IFmsPeriodService;
|
|
|
|
|
+import com.yunfeiyun.agmp.fms.service.IFmsPlanService;
|
|
|
import com.yunfeiyun.agmp.fms.service.IFmsScreenService;
|
|
import com.yunfeiyun.agmp.fms.service.IFmsScreenService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
-import java.time.LocalDate;
|
|
|
|
|
-import java.time.LocalTime;
|
|
|
|
|
-import java.time.ZoneId;
|
|
|
|
|
|
|
+import java.time.*;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
@@ -18,6 +27,16 @@ import java.util.List;
|
|
|
public class FmsScreenServiceImpl implements IFmsScreenService {
|
|
public class FmsScreenServiceImpl implements IFmsScreenService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private FmsScreenMapper fmsScreenMapper;
|
|
private FmsScreenMapper fmsScreenMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IFmsPlanService fmsPlanService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IFmsPeriodService fmsPeriodService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ResManager resManager;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 查询基地统计信息
|
|
* 查询基地统计信息
|
|
|
*
|
|
*
|
|
@@ -98,4 +117,33 @@ public class FmsScreenServiceImpl implements IFmsScreenService {
|
|
|
public List<FmsScreenTaskStatResVo> taskStat(FmsScreenStatReqVo reqVo) {
|
|
public List<FmsScreenTaskStatResVo> taskStat(FmsScreenStatReqVo reqVo) {
|
|
|
return fmsScreenMapper.taskStat(reqVo);
|
|
return fmsScreenMapper.taskStat(reqVo);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public FmsScreenBlockPlanInfoResVo blockPlanInfo(String blockId) {
|
|
|
|
|
+ if(StringUtils.isEmpty(blockId)){
|
|
|
|
|
+ throw new BizException(ErrorCode.INVALID_PARAMETER.getCode(), "参数异常");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ FmsScreenBlockPlanInfoResVo fmsScreenBlockPlanInfoResVo = new FmsScreenBlockPlanInfoResVo();
|
|
|
|
|
+
|
|
|
|
|
+ FmsPlanResVo fmsPlanResVo = fmsPlanService.selectFmsPlanByBlockId(blockId);
|
|
|
|
|
+ if(fmsPlanResVo == null){
|
|
|
|
|
+ return fmsScreenBlockPlanInfoResVo;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String cropId = fmsPlanResVo.getCropId();
|
|
|
|
|
+ String startTime = fmsPlanResVo.getPlanPlanstartdate();
|
|
|
|
|
+ Duration duration = Duration.between(LocalDateTime.parse(startTime,
|
|
|
|
|
+ DateTimeFormatter.ofPattern(CommonEnums.PATTERN_DATETIME.getCode())), LocalDateTime.now());
|
|
|
|
|
+ fmsPlanResVo.setDays(duration.toDays() + "");
|
|
|
|
|
+ String tid = SecurityUtils.getTid();
|
|
|
|
|
+ List<FmsPeriod> fmsPeriods = fmsPeriodService.selectFmsPeriodByCropId(cropId, tid);
|
|
|
|
|
+
|
|
|
|
|
+ List<SysRes> videoList = resManager.queryRes(cropId, ResConstants.BizType.CROP_VIDEO, ResConstants.mediaType.VIDEO);
|
|
|
|
|
+
|
|
|
|
|
+ fmsScreenBlockPlanInfoResVo.setPlanInfo(fmsPlanResVo);
|
|
|
|
|
+ fmsScreenBlockPlanInfoResVo.setFmsPeriodList(fmsPeriods);
|
|
|
|
|
+ fmsScreenBlockPlanInfoResVo.setVideoList(videoList);
|
|
|
|
|
+ return fmsScreenBlockPlanInfoResVo;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|