|
|
@@ -11,13 +11,16 @@ import com.sckw.core.model.enums.MessageLogEnum;
|
|
|
import com.sckw.core.model.page.PageRes;
|
|
|
import com.sckw.core.utils.IdWorker;
|
|
|
import com.sckw.core.web.response.PhpResult;
|
|
|
+
|
|
|
import com.sckw.slope.detection.dao.mysql.KwsDeviceReferenceMapper;
|
|
|
import com.sckw.slope.detection.dao.mysql.KwsDictMapper;
|
|
|
import com.sckw.slope.detection.dao.mysql.KwsLogMapper;
|
|
|
import com.sckw.slope.detection.model.dos.mysql.KwsDeviceReference;
|
|
|
import com.sckw.slope.detection.model.dos.mysql.KwsLog;
|
|
|
+import com.sckw.slope.detection.model.dos.tdengine.SlopeData;
|
|
|
import com.sckw.slope.detection.model.dto.HeaderData;
|
|
|
import com.sckw.slope.detection.model.dto.SystemDict;
|
|
|
+import com.sckw.slope.detection.model.vo.DeviceIntegrationVo;
|
|
|
import com.sckw.slope.detection.model.vo.QueryDictTypePageReqVo;
|
|
|
import com.sckw.slope.detection.service.api.DetectionApiService;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
@@ -26,13 +29,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
+import com.sckw.slope.detection.dao.tdengine.SlopeDataMapper;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.Base64;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @author lfdc
|
|
|
@@ -59,6 +59,9 @@ public class CommonService {
|
|
|
@Autowired
|
|
|
KwsLogMapper logMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ SlopeDataMapper slopeDataMapper;
|
|
|
+
|
|
|
public HeaderData getHeaderData(HttpServletRequest request) {
|
|
|
/**
|
|
|
* {"companyId":"198","companyName":"四川金顶集团","createBy":"2","createName":"600678","updateBy":"2","updateName":"600678","mountainId":"198"}
|
|
|
@@ -248,4 +251,37 @@ public class CommonService {
|
|
|
log.setCreateTime(LocalDateTime.now());
|
|
|
return logMapper.insert(log);
|
|
|
}
|
|
|
+
|
|
|
+ //集成要数判断
|
|
|
+ public double returnIntegrationData(String snCode, List<SlopeData> data, DeviceIntegrationVo inter){
|
|
|
+
|
|
|
+ BigDecimal offsetValue = new BigDecimal("0.00");
|
|
|
+ BigDecimal subtract = new BigDecimal(data.get(0).getVal()).subtract(new BigDecimal(data.get(1).getVal()));
|
|
|
+ Date newD = data.get(0).getTs();
|
|
|
+ Date oldD = data.get(1).getTs();
|
|
|
+ double diff = (newD.getTime()-oldD.getTime())/(1000*60*60.0);
|
|
|
+ //判断集成要素
|
|
|
+ if(DictItemEnum.LONGITUDE_X.getValue().equals(inter.getPartNames())){
|
|
|
+ List<SlopeData> y = slopeDataMapper.selectListByTwoLine(snCode, DictItemEnum.LATITUDE_Y.getValue());
|
|
|
+ double angleInRadians = Double.parseDouble(y.get(1).getVal());
|
|
|
+ double cosValue = Math.cos(angleInRadians);
|
|
|
+
|
|
|
+ double doubleValue = subtract.divide(new BigDecimal("360"), 9, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ offsetValue = new BigDecimal(equatorial_circumference).multiply(new BigDecimal(cosValue)).multiply(new BigDecimal(doubleValue));
|
|
|
+ }
|
|
|
+ if (DictItemEnum.LATITUDE_Y.getValue().equals(inter.getPartNames())) {
|
|
|
+ offsetValue = new BigDecimal(LATITUDE_REFERENCE).multiply(subtract);
|
|
|
+ }
|
|
|
+ if (DictItemEnum.ALTITUDE_Z.getValue().equals(inter.getPartNames())) {
|
|
|
+ offsetValue = subtract.divide(new BigDecimal(1000), 9, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+ if(inter.getFormula().equals(String.valueOf(NumberConstant.ONE))){//加速度(a-a’)/t² formula=1
|
|
|
+ BigDecimal t = new BigDecimal(diff).multiply(new BigDecimal(diff));
|
|
|
+ return offsetValue.divide(t,9, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+
|
|
|
+ }else if(inter.getFormula().equals(String.valueOf(NumberConstant.TWO))){//速度(a-a’)/t formula=2
|
|
|
+ return offsetValue.divide(new BigDecimal(diff),9, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|