|
@@ -1,5 +1,7 @@
|
|
package com.huimv.env.service.impl;
|
|
package com.huimv.env.service.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
|
+import cn.hutool.core.date.DateUnit;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
@@ -13,9 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Project : huimv.shiwan
|
|
* @Project : huimv.shiwan
|
|
@@ -283,6 +284,7 @@ public class EnvironmentServiceImpl implements IEnvironmentService {
|
|
JSONObject zsJo = new JSONObject();
|
|
JSONObject zsJo = new JSONObject();
|
|
zsJa.add(zsJo);
|
|
zsJa.add(zsJo);
|
|
zsJo.put("zsid", zsid);
|
|
zsJo.put("zsid", zsid);
|
|
|
|
+ zsJo.put("jqid",environmentDataRepo.findByZsid(zsid));
|
|
zsJo.put("isQuanKong",false);
|
|
zsJo.put("isQuanKong",false);
|
|
if (zsid == 367 || zsid == 378 || zsid == 379){
|
|
if (zsid == 367 || zsid == 378 || zsid == 379){
|
|
zsJo.put("isQuanKong",true);
|
|
zsJo.put("isQuanKong",true);
|
|
@@ -458,4 +460,78 @@ public class EnvironmentServiceImpl implements IEnvironmentService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private XtHkQtsbInfoRepo XtHkQtsbInfoRepo ;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private XtDgdskzRepo dgdskzRepo ;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @DS("slave")
|
|
|
|
+ public Result findByJqid(String jqid) {
|
|
|
|
+ XtDgdskz xtDgdskz = dgdskzRepo.findByJQIDOrderByXGSJ(jqid);
|
|
|
|
+ if (xtDgdskz == null){
|
|
|
|
+ return new Result(10001,"没有数据",false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String zm = xtDgdskz.getPZNR();
|
|
|
|
+ if (zm == null){
|
|
|
|
+ return new Result(10001,"没有数据",false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String[] split = zm.split(",");
|
|
|
|
+ String startTime = split[0];
|
|
|
|
+ String durations = split[1];
|
|
|
|
+ String begin = cn.hutool.core.date.DateUtil.format(xtDgdskz.getXGSJ(),"yyyy:MM:dd")
|
|
|
|
+ + " " + startTime.substring(0,2) + ":" + startTime.substring(2) + ":00";
|
|
|
|
+ Date beginDate = cn.hutool.core.date.DateUtil.parse(begin, "yyyy:MM:dd HH:mm:ss");
|
|
|
|
+ Date endDate = cn.hutool.core.date.DateUtil.offsetMinute(beginDate, Integer.parseInt(durations));
|
|
|
|
+
|
|
|
|
+ String beginStr = cn.hutool.core.date.DateUtil.format(beginDate, "HH:mm");
|
|
|
|
+ String endStr = cn.hutool.core.date.DateUtil.format(endDate, "HH:mm");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
+ jsonObject.put("startTime",beginStr);
|
|
|
|
+ jsonObject.put("endTime",endStr);
|
|
|
|
+ return new Result(ResultCode.SUCCESS,jsonObject);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @DS("slave")
|
|
|
|
+ public Result add(String JQID,String ZSMC, String startTime,Long duration) {
|
|
|
|
+ XtHkQtsbInfo hkQtsbInfo = new XtHkQtsbInfo();
|
|
|
|
+ XtDgdskz xtDgdskz = new XtDgdskz();
|
|
|
|
+
|
|
|
|
+ xtDgdskz.setJQID(JQID);
|
|
|
|
+ hkQtsbInfo.setZSMC(ZSMC);
|
|
|
|
+
|
|
|
|
+// String format = cn.hutool.core.date.DateUtil.format(starTime, "yyyy-MM-dd HH:mm");
|
|
|
|
+// long durations = cn.hutool.core.date.DateUtil.between(starTime, endTime, DateUnit.MINUTE);
|
|
|
|
+ hkQtsbInfo.setBeginTime(startTime);
|
|
|
|
+ hkQtsbInfo.setDurations(duration);
|
|
|
|
+// String time = format.split(" ")[1].replace(":", "");
|
|
|
|
+ String replace = startTime.replace(":", "");
|
|
|
|
+ String zm = replace + "," + duration;
|
|
|
|
+ xtDgdskz.setPZNR(zm);
|
|
|
|
+
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ xtDgdskz.setXGSJ(date);
|
|
|
|
+ xtDgdskz.setBZ("2");
|
|
|
|
+ hkQtsbInfo.setXGSJ(date);
|
|
|
|
+
|
|
|
|
+ dgdskzRepo.save(xtDgdskz);
|
|
|
|
+ XtHkQtsbInfoRepo.save(hkQtsbInfo);
|
|
|
|
+ return new Result(10000,"修改成功",true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @DS("slave")
|
|
|
|
+ public Result getZMInfo() {
|
|
|
|
+ List<XtHkQtsbInfo> zmInfo = XtHkQtsbInfoRepo.getZMInfo();
|
|
|
|
+ return new Result(ResultCode.SUCCESS,zmInfo);
|
|
|
|
+ }
|
|
}
|
|
}
|