|
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -741,5 +742,39 @@ public class ProtDataServiceImpl extends ServiceImpl<ProtDataMapper, ProtData> i
|
|
|
return new Result(ResultCode.SUCCESS,jsonObject);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result listScreen(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
+ String farmId = paramsMap.get("farmId");
|
|
|
+ QueryWrapper<ProtData> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("farm_id", farmId);
|
|
|
+ Integer count = protDataMapper.selectCount(queryWrapper);//监测数据条数
|
|
|
+ QueryWrapper<ProtWarningInfo> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.eq("farm_id", farmId);
|
|
|
+ Integer count1 = protWarningInfoMapper.selectCount(queryWrapper1);//及时报警条数
|
|
|
+
|
|
|
+
|
|
|
+ //得到监测保障天数
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ long day = 0;
|
|
|
+ try {
|
|
|
+ Date now = new Date();
|
|
|
+ String nowTime = sdf.format(now);
|
|
|
+ System.out.println(now);
|
|
|
+ Date date = sdf.parse("2023-01-01");//指定日期
|
|
|
+ Date mydate = sdf.parse(nowTime);//当前日期
|
|
|
+ day = (mydate.getTime() - date.getTime()) / (24 * 60 * 60 * 1000);
|
|
|
+ System.out.println(day);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return new Result(ResultCode.SUCCESS, "");
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("locCount", 27);
|
|
|
+ jsonObject.put("ProtCount", count);
|
|
|
+ jsonObject.put("WarningCount", count1);
|
|
|
+ jsonObject.put("day", day);
|
|
|
+ return new Result(ResultCode.SUCCESS,jsonObject);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|