Compare commits
12 Commits
Author | SHA1 | Date |
---|---|---|
|
95525f5d54 | |
|
e849cfee4a | |
|
25171b9b6f | |
|
4bb09bec02 | |
|
0f10e984e8 | |
|
09fe898087 | |
|
ff10ce3e8c | |
|
503101b20b | |
|
7ed645b5d4 | |
|
1e59a862ef | |
|
54734a4d70 | |
|
adffd21447 |
Binary file not shown.
|
@ -47,6 +47,8 @@
|
|||
<groupId>cc.casually</groupId>
|
||||
<artifactId>html-parse</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libs\html-parse-2.1.1.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.ruoyi.utils;
|
||||
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* 文件管理工具类
|
||||
|
@ -73,6 +74,6 @@ public class FileUtil {
|
|||
byte[] buffer = new byte[(int) file.length()];
|
||||
inputFile.read(buffer);
|
||||
inputFile.close();
|
||||
return new BASE64Encoder().encode(buffer);
|
||||
return Base64.getMimeEncoder().encodeToString(buffer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package com.ruoyi.utils;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import sun.misc.BASE64Decoder;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.imageio.ImageReadParam;
|
||||
|
@ -16,6 +15,7 @@ import java.net.MalformedURLException;
|
|||
import java.net.URL;
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* mergeImage 合成图拼
|
||||
|
@ -269,7 +269,7 @@ public class ImageUtils {
|
|||
// 将图片转化为base64并返回
|
||||
byte[] data = outputStream.toByteArray();
|
||||
// 此处一定要使用org.apache.tomcat.util.codec.binary.Base64,防止再linux上出现换行等特殊符号
|
||||
base64Image = Base64.encodeBase64String(data);
|
||||
base64Image = Base64.getEncoder().encodeToString(data);
|
||||
} catch (Exception e) {
|
||||
// 抛出异常
|
||||
throw e;
|
||||
|
@ -299,7 +299,7 @@ public class ImageUtils {
|
|||
return base64Image;
|
||||
}
|
||||
|
||||
static BASE64Decoder decoder = new BASE64Decoder();
|
||||
|
||||
|
||||
/**
|
||||
* base64压缩图片至指定大小
|
||||
|
@ -319,7 +319,7 @@ public class ImageUtils {
|
|||
ByteArrayInputStream inputStream = null;
|
||||
try {
|
||||
|
||||
byte[] bytes1 = decoder.decodeBuffer(imageBase);
|
||||
byte[] bytes1 = Base64.getDecoder().decode(imageBase);
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(bytes1);
|
||||
BufferedImage image = ImageIO.read(bais);
|
||||
|
||||
|
@ -355,7 +355,7 @@ public class ImageUtils {
|
|||
// 将图片转化为base64并返回
|
||||
byte[] data = outputStream.toByteArray();
|
||||
// 此处一定要使用org.apache.tomcat.util.codec.binary.Base64,防止再linux上出现换行等特殊符号
|
||||
base64Image = Base64.encodeBase64String(data);
|
||||
base64Image = Base64.getEncoder().encodeToString(data);
|
||||
if(StringUtils.isEmpty(base64Image)) {
|
||||
base64Image = imageBase;
|
||||
}
|
||||
|
@ -402,8 +402,8 @@ public class ImageUtils {
|
|||
}
|
||||
}
|
||||
// 加密
|
||||
BASE64Encoder encoder = new BASE64Encoder();
|
||||
return encoder.encode(data);
|
||||
|
||||
return Base64.getEncoder().encodeToString(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -26,7 +26,9 @@
|
|||
<dependency>
|
||||
<groupId>cc.casually</groupId>
|
||||
<artifactId>html-parse</artifactId>
|
||||
<version>2.1.5</version>
|
||||
<version>2.1.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libs\html-parse-2.1.1.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -2,8 +2,7 @@ package com.ruoyi.helmet.comp.encrypt;
|
|||
|
||||
|
||||
import com.ruoyi.helmet.comp.conf.ThreeAPIInfo;
|
||||
import sun.misc.BASE64Decoder;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
|
|
Binary file not shown.
|
@ -33,7 +33,9 @@
|
|||
<dependency>
|
||||
<groupId>cc.casually</groupId>
|
||||
<artifactId>html-parse</artifactId>
|
||||
<version>2.1.5</version>
|
||||
<version>2.1.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libs\html-parse-2.1.1.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -0,0 +1,513 @@
|
|||
package com.ruoyi.iot.api;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.iot.domain.TowerReqVo;
|
||||
import com.ruoyi.iot.enums.TowerTypeEnums;
|
||||
import com.ruoyi.iot.service.IIotDeviceInfoService;
|
||||
import com.ruoyi.utils.HttpUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 塔吊监测APIController
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/towerCrane")
|
||||
public class TowerCraneApiController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(TowerCraneApiController.class);
|
||||
|
||||
private final String HOST = "https://aqzg.makalu.cc";
|
||||
private final String DEVSOURCE = "YF";
|
||||
|
||||
private Map<String, Object> cacheMap = new HashMap<>();
|
||||
|
||||
@Autowired
|
||||
private IIotDeviceInfoService iIotDeviceInfoService;
|
||||
|
||||
/**
|
||||
* 塔吊监测++
|
||||
* 限流规则[60秒内最多请求10次,限流策略IP]
|
||||
* @param req 请求信息
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@PostMapping("/v1/push")
|
||||
public AjaxResult pushData(@Validated @RequestBody TowerReqVo req) {
|
||||
if(req.getType() == TowerTypeEnums.BASE.getCode()){
|
||||
this.pushConfigData(req);
|
||||
}else if(req.getType() == TowerTypeEnums.RUN.getCode()){
|
||||
this.pushRunData(req);
|
||||
}else if(req.getType() == TowerTypeEnums.ROUND.getCode()){
|
||||
this.pushRoundData(req);
|
||||
}else if(req.getType() == TowerTypeEnums.COLLIDE.getCode()){
|
||||
this.pushCollideData(req);
|
||||
}else if(req.getType() == TowerTypeEnums.LIMIT.getCode()){
|
||||
this.pushLimitData(req);
|
||||
}else if(req.getType() == TowerTypeEnums.LOCAL.getCode()){
|
||||
this.pushLocalData(req);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 塔机上报基本信息
|
||||
* @param req
|
||||
*/
|
||||
private void pushConfigData(TowerReqVo req){
|
||||
String sn = req.getContent().getDeviceKey();
|
||||
Map<String, Object> dataContent = req.getContent().getDataContent();
|
||||
|
||||
//将数据同步至马卡鲁安管平台
|
||||
JSONObject dataMap = new JSONObject();
|
||||
dataMap.put("data_source",DEVSOURCE);
|
||||
dataMap.put("device_sn",sn);
|
||||
double rate = Convert.toInt(cacheMap.get("rate_"+sn),2);
|
||||
dataMap.put("base",rate);
|
||||
dataMap.put("coordX",dataContent.get("coordinateX"));
|
||||
dataMap.put("coordY",dataContent.get("coordinateY"));
|
||||
dataMap.put("foreArmLength",Convert.toStr(dataContent.get("frontBrachium"),"60"));
|
||||
dataMap.put("postArmLength",Convert.toStr(dataContent.get("afterBrachium"),"12"));
|
||||
dataMap.put("hatHeight",dataContent.get("towerCapHeight"));
|
||||
double remotePullRod = Convert.toDouble(cacheMap.get("remotePullRod_"+sn),0.00);
|
||||
double nearPullRod = Convert.toDouble(cacheMap.get("nearPullRod_"+sn),0.00);
|
||||
double postPullRod = Convert.toDouble(cacheMap.get("postPullRod_"+sn),0.00);
|
||||
dataMap.put("remotePullRod",remotePullRod);
|
||||
dataMap.put("nearPullRod",nearPullRod);
|
||||
dataMap.put("postPullRod",postPullRod);
|
||||
dataMap.put("downHeight",dataContent.get("towerSectionHeight"));
|
||||
dataMap.put("updateTime", DateUtils.getTime());
|
||||
|
||||
String res = HttpUtils.commHttpPost(HOST+"/api/device/baseInfo",dataMap);
|
||||
log.info("/api/device/baseInfo...{}...{}",res,dataMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 塔机上报实时数据
|
||||
* @param req
|
||||
*/
|
||||
private void pushRunData(TowerReqVo req){
|
||||
String sn = req.getContent().getDeviceKey();
|
||||
Map<String, Object> dataContent = req.getContent().getDataContent();
|
||||
|
||||
// 将数据同步至马卡鲁安管平台
|
||||
JSONObject dataMap = new JSONObject();
|
||||
dataMap.put("data_source",DEVSOURCE);
|
||||
dataMap.put("deviceSn",sn);
|
||||
dataMap.put("thisTime",System.currentTimeMillis());
|
||||
dataMap.put("weightData",dataContent.get("load"));
|
||||
dataMap.put("tiltData",dataContent.get("leanAngleY"));
|
||||
dataMap.put("windSpeedData",dataContent.get("windSpeed"));
|
||||
String height = Convert.toStr(dataContent.get("height"));
|
||||
dataMap.put("heightData",height);
|
||||
dataMap.put("ampData",dataContent.get("range"));
|
||||
dataMap.put("torqueData",dataContent.get("momentPercent"));
|
||||
dataMap.put("angleData",dataContent.get("rotation"));
|
||||
String dingShengData = Convert.toStr(cacheMap.get("highLimitWarning_"+sn),height);
|
||||
dataMap.put("dingShengData",dingShengData);
|
||||
dataMap.put("walkData",dataContent.get("range"));
|
||||
|
||||
// 将报警数据同步至马卡鲁安管平台
|
||||
if(dataContent.get("warnings")!=null){
|
||||
this.pushWarnData(req);
|
||||
}
|
||||
HttpUtils.commHttpPost(HOST+"/api/device/runInfo",dataMap);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
JSONObject dataMap = new JSONObject();
|
||||
dataMap.put("data_source","YF");
|
||||
dataMap.put("deviceSn","E03C1CB382E61812");
|
||||
dataMap.put("thisTime",System.currentTimeMillis());
|
||||
dataMap.put("weightData","0.32");
|
||||
dataMap.put("tiltData","1.6");
|
||||
dataMap.put("windSpeedData","0.0");
|
||||
String height = "48.1";
|
||||
dataMap.put("heightData",height);
|
||||
dataMap.put("ampData","16.74");
|
||||
dataMap.put("torqueData","2");
|
||||
dataMap.put("angleData","127.1");
|
||||
String dingShengData = Convert.toStr("50",height);
|
||||
dataMap.put("dingShengData",dingShengData);
|
||||
dataMap.put("walkData","16.74");
|
||||
String str = HttpUtils.commHttpPost("https://aqzg.makalu.cc/api/device/runInfo", dataMap);
|
||||
System.out.println(str);
|
||||
}
|
||||
/**
|
||||
* 塔机上报循环数据
|
||||
* @param req
|
||||
*/
|
||||
private void pushRoundData(TowerReqVo req){
|
||||
String sn = req.getContent().getDeviceKey();
|
||||
Map<String, Object> dataContent = req.getContent().getDataContent();
|
||||
|
||||
// 将数据同步至马卡鲁安管平台
|
||||
JSONObject dataMap = new JSONObject();
|
||||
dataMap.put("data_source",DEVSOURCE);
|
||||
dataMap.put("deviceSn",sn);
|
||||
dataMap.put("dataId",System.currentTimeMillis());
|
||||
dataMap.put("startTime",dataContent.get("workStartTime"));
|
||||
dataMap.put("endTime",dataContent.get("workEndTime"));
|
||||
dataMap.put("maxWeight",dataContent.get("maxLoad"));
|
||||
dataMap.put("maxTorque",dataContent.get("maxMomentPercent"));
|
||||
dataMap.put("maxHeight",dataContent.get("maxHeight"));
|
||||
dataMap.put("minHeight",dataContent.get("minHeight"));
|
||||
dataMap.put("maxAmptitude",dataContent.get("maxRange"));
|
||||
dataMap.put("minAmptitude",dataContent.get("minRange"));
|
||||
dataMap.put("maxRotateAngle",dataContent.get("endRotation"));
|
||||
dataMap.put("minRotateAngle",dataContent.get("startRotation"));
|
||||
dataMap.put("createTime",System.currentTimeMillis());
|
||||
|
||||
String res = HttpUtils.commHttpPost(HOST+"/api/device/roundInfo",dataMap);
|
||||
log.info("/api/device/roundInfo...{}...{}",res,dataMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 塔机上报碰撞信息
|
||||
* @param req
|
||||
*/
|
||||
private void pushCollideData(TowerReqVo req){
|
||||
String sn = req.getContent().getDeviceKey();
|
||||
|
||||
// 将数据同步至马卡鲁安管平台
|
||||
JSONObject dataMap = new JSONObject();
|
||||
dataMap.put("data_source",DEVSOURCE);
|
||||
dataMap.put("deviceSn",sn);
|
||||
dataMap.put("warn_name","none");
|
||||
|
||||
dataMap.put("warn_type","2");
|
||||
dataMap.put("warn_context","注意碰撞!注意碰撞!");
|
||||
dataMap.put("warn_note","注意碰撞!注意碰撞!");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("collisionAngleAlarm_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("collisionAngleAlarm_"+sn),"0"));
|
||||
dataMap.put("warn_time",DateUtils.getTime());
|
||||
|
||||
String res = HttpUtils.commHttpPost(HOST+"/api/device/warnRecord",dataMap);
|
||||
log.info("/api/device/warnRecord...{}...{}",res,dataMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 塔机推送预警信息
|
||||
* @param req
|
||||
*/
|
||||
private void pushWarnData(TowerReqVo req){
|
||||
String sn = req.getContent().getDeviceKey();
|
||||
Map<String, Object> dataContent = req.getContent().getDataContent();
|
||||
|
||||
// 将数据同步至马卡鲁安管平台
|
||||
JSONObject dataMap = new JSONObject();
|
||||
dataMap.put("data_source",DEVSOURCE);
|
||||
dataMap.put("deviceSn",sn);
|
||||
dataMap.put("warn_name","none");
|
||||
if(dataContent.get("warnings")!=null){
|
||||
List<String> warnings = (List<String>)dataContent.get("warnings");
|
||||
for(String warning:warnings){
|
||||
switch (warning){
|
||||
case "1":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","高限位");
|
||||
dataMap.put("warn_note","高限位");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("highLimitWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("highLimitWarning_"+sn),"0"));
|
||||
break;
|
||||
case "2":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","低限位");
|
||||
dataMap.put("warn_note","低限位");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("lowLimitWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("lowLimitWarning_"+sn),"0"));
|
||||
break;
|
||||
case "3":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","远方限位");
|
||||
dataMap.put("warn_note","远方限位");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("frontLimitWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("frontLimitWarning_"+sn),"0"));
|
||||
break;
|
||||
case "4":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","近方限位");
|
||||
dataMap.put("warn_note","近方限位");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("backLimitWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("backLimitWarning_"+sn),"0"));
|
||||
break;
|
||||
case "5":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","左转限位");
|
||||
dataMap.put("warn_note","左转限位");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("leftLimitWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("leftLimitWarning_"+sn),"0"));
|
||||
break;
|
||||
case "6":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","右转限位");
|
||||
dataMap.put("warn_note","右转限位");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("rightLimitWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("rightLimitWarning_"+sn),"0"));
|
||||
break;
|
||||
case "7":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","重量预警 1");
|
||||
dataMap.put("warn_note","重量预警 1");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("loadWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("loadWarning_"+sn),"0"));
|
||||
break;
|
||||
case "8":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","重量预警 2");
|
||||
dataMap.put("warn_note","重量预警 2");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("loadWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("loadWarning_"+sn),"0"));
|
||||
break;
|
||||
case "9":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","重量预警 3");
|
||||
dataMap.put("warn_note","重量预警 3");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("loadWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("loadWarning_"+sn),"0"));
|
||||
break;
|
||||
case "10":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","力矩预警 1");
|
||||
dataMap.put("warn_note","力矩预警 1");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("momentWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("momentWarning_"+sn),"0"));
|
||||
break;
|
||||
case "11":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","力矩预警 2");
|
||||
dataMap.put("warn_note","力矩预警 2");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("momentWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("momentWarning_"+sn),"0"));
|
||||
break;
|
||||
case "12":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","力矩预警 3");
|
||||
dataMap.put("warn_note","力矩预警 3");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("momentWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("momentWarning_"+sn),"0"));
|
||||
break;
|
||||
case "13":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","风速过大");
|
||||
dataMap.put("warn_note","风速过大");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("windSpeedWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("windSpeedWarning_"+sn),"0"));
|
||||
break;
|
||||
case "14":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","倾角过大");
|
||||
dataMap.put("warn_note","倾角过大");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("leanWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("leanWarning_"+sn),"0"));
|
||||
break;
|
||||
case "15":
|
||||
dataMap.put("warn_type","1");
|
||||
dataMap.put("warn_context","碰撞预警");
|
||||
dataMap.put("warn_note","碰撞预警");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("collisionDistanceWarning_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("collisionDistanceWarning_"+sn),"0"));
|
||||
break;
|
||||
case "101":
|
||||
dataMap.put("warn_type","2");
|
||||
dataMap.put("warn_context","高限位");
|
||||
dataMap.put("warn_note","高限位");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("highLimitAlarm_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("highLimitAlarm_"+sn),"0"));
|
||||
break;
|
||||
case "102":
|
||||
dataMap.put("warn_type","2");
|
||||
dataMap.put("warn_context","远方限位");
|
||||
dataMap.put("warn_note","远方限位");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("frontLimitAlarm_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("frontLimitAlarm_"+sn),"0"));
|
||||
break;
|
||||
case "103":
|
||||
dataMap.put("warn_type","2");
|
||||
dataMap.put("warn_context","近方限位");
|
||||
dataMap.put("warn_note","近方限位");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("backLimitAlarm_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("backLimitAlarm_"+sn),"0"));
|
||||
break;
|
||||
case "104":
|
||||
dataMap.put("warn_type","2");
|
||||
dataMap.put("warn_context","左转限位");
|
||||
dataMap.put("warn_note","左转限位");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("leftLimitAlarm_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("leftLimitAlarm_"+sn),"0"));
|
||||
break;
|
||||
case "105":
|
||||
dataMap.put("warn_type","2");
|
||||
dataMap.put("warn_context","右转限位");
|
||||
dataMap.put("warn_note","右转限位");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("rightLimitAlarm_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("rightLimitAlarm_"+sn),"0"));
|
||||
break;
|
||||
case "106":
|
||||
dataMap.put("warn_type","2");
|
||||
dataMap.put("warn_context","重量超重!重量限制最大值");
|
||||
dataMap.put("warn_note","重量超重!重量限制最大值");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("loadAlarm_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("loadAlarm_"+sn),"0"));
|
||||
break;
|
||||
case "107":
|
||||
dataMap.put("warn_type","2");
|
||||
dataMap.put("warn_context","力矩超载!力矩限制最大值");
|
||||
dataMap.put("warn_note","力矩超载!力矩限制最大值");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("momentAlarm_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("momentAlarm_"+sn),"0"));
|
||||
break;
|
||||
case "108":
|
||||
dataMap.put("warn_type","2");
|
||||
dataMap.put("warn_context","风速过大");
|
||||
dataMap.put("warn_note","风速过大");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("windSpeedAlarm_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("windSpeedAlarm_"+sn),"0"));
|
||||
break;
|
||||
case "109":
|
||||
dataMap.put("warn_type","2");
|
||||
dataMap.put("warn_context","倾角过大");
|
||||
dataMap.put("warn_note","倾角过大");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("leanAlarm_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("leanAlarm_"+sn),"0"));
|
||||
break;
|
||||
case "110":
|
||||
dataMap.put("warn_type","2");
|
||||
dataMap.put("warn_context","碰撞报警");
|
||||
dataMap.put("warn_note","碰撞报警");
|
||||
dataMap.put("warn_data",Convert.toStr(cacheMap.get("collisionDistanceAlarm_"+sn),"0"));
|
||||
dataMap.put("real_data",Convert.toStr(cacheMap.get("collisionDistanceAlarm_"+sn),"0"));
|
||||
break;
|
||||
case "201":
|
||||
dataMap.put("warn_type","3");
|
||||
dataMap.put("warn_context","风速仪数据异常");
|
||||
dataMap.put("warn_note","风速仪数据异常");
|
||||
break;
|
||||
case "202":
|
||||
dataMap.put("warn_type","3");
|
||||
dataMap.put("warn_context","高度数据异常");
|
||||
dataMap.put("warn_note","高度数据异常");
|
||||
break;
|
||||
case "203":
|
||||
dataMap.put("warn_type","3");
|
||||
dataMap.put("warn_context","幅度数据异常");
|
||||
dataMap.put("warn_note","幅度数据异常");
|
||||
break;
|
||||
case "204":
|
||||
dataMap.put("warn_type","3");
|
||||
dataMap.put("warn_context","回转数据异常");
|
||||
dataMap.put("warn_note","回转数据异常");
|
||||
break;
|
||||
case "205":
|
||||
dataMap.put("warn_type","3");
|
||||
dataMap.put("warn_context","重量数据异常");
|
||||
dataMap.put("warn_note","重量数据异常");
|
||||
break;
|
||||
case "207":
|
||||
dataMap.put("warn_type","3");
|
||||
dataMap.put("warn_context","力矩数据异常");
|
||||
dataMap.put("warn_note","力矩数据异常");
|
||||
break;
|
||||
case "208":
|
||||
dataMap.put("warn_type","3");
|
||||
dataMap.put("warn_context","人脸识别摄像头异常");
|
||||
dataMap.put("warn_note","人脸识别摄像头异常");
|
||||
break;
|
||||
case "301":
|
||||
dataMap.put("warn_type","3");
|
||||
dataMap.put("warn_context","抽烟警报");
|
||||
dataMap.put("warn_note","抽烟警报");
|
||||
break;
|
||||
case "302":
|
||||
dataMap.put("warn_type","3");
|
||||
dataMap.put("warn_context","打电话警报");
|
||||
dataMap.put("warn_note","打电话警报");
|
||||
break;
|
||||
case "303":
|
||||
dataMap.put("warn_type","3");
|
||||
dataMap.put("warn_context","疲劳警报");
|
||||
dataMap.put("warn_note","疲劳警报");
|
||||
break;
|
||||
default:
|
||||
dataMap.put("warn_type",null);
|
||||
break;
|
||||
}
|
||||
dataMap.put("warn_time",DateUtils.getTime());
|
||||
|
||||
if(Objects.nonNull(dataMap.get("warn_type"))){
|
||||
String res = HttpUtils.commHttpPost(HOST+"/api/device/warnRecord",dataMap);
|
||||
log.info("/api/device/warnRecord...{}...{}",res,dataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 塔机上报限位信息
|
||||
* @param req
|
||||
*/
|
||||
private void pushLimitData(TowerReqVo req){
|
||||
String sn = req.getContent().getDeviceKey();
|
||||
Map<String, Object> dataContent = req.getContent().getDataContent();
|
||||
|
||||
cacheMap.put("loadWarning_"+sn,dataContent.get("loadWarning"));
|
||||
cacheMap.put("highLimitWarning_"+sn,dataContent.get("highLimitWarning"));
|
||||
cacheMap.put("windSpeedWarning_"+sn,dataContent.get("windSpeedWarning"));
|
||||
cacheMap.put("windSpeedAlarm_"+sn,dataContent.get("windSpeedAlarm"));
|
||||
cacheMap.put("loadAlarm_"+sn,dataContent.get("loadAlarm"));
|
||||
cacheMap.put("momentWarning_"+sn,dataContent.get("momentWarning"));
|
||||
cacheMap.put("momentAlarm_"+sn,dataContent.get("momentAlarm"));
|
||||
cacheMap.put("highLimitAlarm_"+sn,dataContent.get("highLimitAlarm"));
|
||||
cacheMap.put("lowLimitWarning_"+sn,dataContent.get("lowLimitWarning"));
|
||||
cacheMap.put("lowLimitAlarm_"+sn,dataContent.get("lowLimitAlarm"));
|
||||
cacheMap.put("leftLimitWarning_"+sn,dataContent.get("leftLimitWarning"));
|
||||
cacheMap.put("leftLimitAlarm_"+sn,dataContent.get("leftLimitAlarm"));
|
||||
cacheMap.put("rightLimitWarning_"+sn,dataContent.get("rightLimitWarning"));
|
||||
cacheMap.put("rightLimitAlarm_"+sn,dataContent.get("rightLimitAlarm"));
|
||||
cacheMap.put("frontLimitWarning_"+sn,dataContent.get("frontLimitWarning"));
|
||||
cacheMap.put("frontLimitAlarm_"+sn,dataContent.get("frontLimitAlarm"));
|
||||
cacheMap.put("backLimitWarning_"+sn,dataContent.get("backLimitWarning"));
|
||||
cacheMap.put("backLimitAlarm_"+sn,dataContent.get("backLimitAlarm"));
|
||||
cacheMap.put("collisionAngleWarning_"+sn,dataContent.get("collisionAngleWarning"));
|
||||
cacheMap.put("collisionAngleAlarm_"+sn,dataContent.get("collisionAngleAlarm"));
|
||||
cacheMap.put("collisionDistanceWarning_"+sn,dataContent.get("collisionDistanceWarning"));
|
||||
cacheMap.put("collisionDistanceAlarm_"+sn,dataContent.get("collisionDistanceAlarm"));
|
||||
cacheMap.put("hDistanceWarning_"+sn,dataContent.get("hDistanceWarning"));
|
||||
cacheMap.put("hDistanceAlarm_"+sn,dataContent.get("hDistanceAlarm"));
|
||||
cacheMap.put("vDistanceWarning_"+sn,dataContent.get("vDistanceWarning"));
|
||||
cacheMap.put("vDistanceAlarm_"+sn,dataContent.get("vDistanceAlarm"));
|
||||
cacheMap.put("leanWarning_"+sn,dataContent.get("leanWarning"));
|
||||
cacheMap.put("leanAlarm_"+sn,dataContent.get("leanAlarm"));
|
||||
cacheMap.put("rangeLimitStart_"+sn,dataContent.get("rangeLimitStart"));
|
||||
cacheMap.put("rangeLimitEnd_"+sn,dataContent.get("rangeLimitEnd"));
|
||||
cacheMap.put("heightLimitStart_"+sn,dataContent.get("heightLimitStart"));
|
||||
cacheMap.put("heightLimitEnd_"+sn,dataContent.get("heightLimitEnd"));
|
||||
cacheMap.put("rotationLimitStart_"+sn,dataContent.get("rotationLimitStart"));
|
||||
cacheMap.put("rotationLimitEnd_"+sn,dataContent.get("rotationLimitEnd"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 塔机上报标定位信息
|
||||
* @param req
|
||||
*/
|
||||
private void pushLocalData(TowerReqVo req){
|
||||
log.info("pushLocalData...");
|
||||
}
|
||||
}
|
|
@ -14,6 +14,12 @@ public class HzApiConf {
|
|||
* IOT配电箱数据获取HOST
|
||||
*/
|
||||
public static String IOT_POWER_HOST = "http://api.1357.cn/hz-condition-monitor";
|
||||
|
||||
/**
|
||||
* IOT配电箱数据获取HOST&&萨达
|
||||
*/
|
||||
public static String SD_IOT_POWER_HOST = "https://api.e.v1.i-sada.net";
|
||||
|
||||
/**
|
||||
* 标养室获取数据HOST
|
||||
*/
|
||||
|
|
|
@ -42,6 +42,10 @@ public class IotDeviceInfo extends BaseEntity
|
|||
|
||||
private String hzTenantId;
|
||||
private String hzProjectId;
|
||||
|
||||
private String factoryName;
|
||||
private String companyName;
|
||||
private String projectName;
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
|
@ -121,6 +125,30 @@ public class IotDeviceInfo extends BaseEntity
|
|||
this.hzProjectId = hzProjectId;
|
||||
}
|
||||
|
||||
public String getFactoryName() {
|
||||
return factoryName;
|
||||
}
|
||||
|
||||
public void setFactoryName(String factoryName) {
|
||||
this.factoryName = factoryName;
|
||||
}
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
package com.ruoyi.iot.domain;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 塔吊检测推送信息 请求内容
|
||||
*
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/01/13 12:21
|
||||
*/
|
||||
public class TowerContentReqVo {
|
||||
|
||||
/**
|
||||
* 数据产生的时间戳
|
||||
*/
|
||||
private Long time;
|
||||
|
||||
/**
|
||||
* 数据类型
|
||||
*/
|
||||
private String dataType;
|
||||
|
||||
/**
|
||||
* 设备序列号,唯一标识 84E0*****
|
||||
*/
|
||||
private String deviceKey;
|
||||
|
||||
/**
|
||||
* 上报内容
|
||||
*/
|
||||
private Map<String, Object> dataContent;
|
||||
|
||||
/**
|
||||
* 碰撞信息
|
||||
*/
|
||||
private Map<String, Object> localDeviceInfo;
|
||||
|
||||
/**
|
||||
* 碰撞塔吊设备信息
|
||||
*/
|
||||
private List<Map<String, Object>> collideTowers;
|
||||
|
||||
public Long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Long time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getDeviceKey() {
|
||||
return deviceKey;
|
||||
}
|
||||
|
||||
public void setDeviceKey(String deviceKey) {
|
||||
this.deviceKey = deviceKey;
|
||||
}
|
||||
|
||||
public Map<String, Object> getDataContent() {
|
||||
return dataContent;
|
||||
}
|
||||
|
||||
public void setDataContent(Map<String, Object> dataContent) {
|
||||
this.dataContent = dataContent;
|
||||
}
|
||||
|
||||
public Map<String, Object> getLocalDeviceInfo() {
|
||||
return localDeviceInfo;
|
||||
}
|
||||
|
||||
public void setLocalDeviceInfo(Map<String, Object> localDeviceInfo) {
|
||||
this.localDeviceInfo = localDeviceInfo;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getCollideTowers() {
|
||||
return collideTowers;
|
||||
}
|
||||
|
||||
public void setCollideTowers(List<Map<String, Object>> collideTowers) {
|
||||
this.collideTowers = collideTowers;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.ruoyi.iot.domain;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 塔吊检测推送信息 请求参数
|
||||
*
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/01/13 12:21
|
||||
*/
|
||||
public class TowerReqVo {
|
||||
|
||||
/**
|
||||
* 上报类型
|
||||
*/
|
||||
@NotNull(message = "上报类型不能为空")
|
||||
private int type;
|
||||
|
||||
/**
|
||||
* 上报内容
|
||||
*/
|
||||
@NotNull(message = "上报内容不能为空")
|
||||
private TowerContentReqVo content;
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public TowerContentReqVo getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(TowerContentReqVo content) {
|
||||
this.content = content;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.ruoyi.iot.enums;
|
||||
|
||||
/**
|
||||
* 塔吊数据类型
|
||||
*/
|
||||
public enum TowerTypeEnums {
|
||||
|
||||
BASE(118,"塔机上报基本信息"),
|
||||
RUN(111,"塔机上报实时数据"),
|
||||
ROUND(119,"塔机上报工作循环数据"),
|
||||
COLLIDE(116,"塔机上报碰撞信息"),
|
||||
LIMIT(120,"塔机上报限位信息"),
|
||||
LOCAL(121,"塔机上报标定位信息");
|
||||
|
||||
private final int code;
|
||||
private final String info;
|
||||
|
||||
TowerTypeEnums(int code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,882 @@
|
|||
package com.ruoyi.iot.task;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.security.Md5Utils;
|
||||
import okhttp3.*;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component("attendanceJgwTask")
|
||||
//@RestController
|
||||
//@RequestMapping("/jgw")
|
||||
public class AttendanceJgwTask {
|
||||
static String host="http://api.gongyoumishu.com:80/gomeetapi/";
|
||||
static String appId="6a6f24fe35b04ee0bcf31cfb46ed1051";
|
||||
static String secret="sxyzxx2024suc";
|
||||
static String projectId="6ffba4b6f18743f690b76b5b81d10052";
|
||||
static String phone="13572235102";
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("---1--");
|
||||
// asyncProContractor();
|
||||
}
|
||||
public static String getToken(){
|
||||
String grantType="client_credential";
|
||||
String path="/webapi/credential";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("appId",appId);
|
||||
params.put("secret", Base64.encode(secret));
|
||||
params.put("grantType",grantType);
|
||||
Request request = new Request.Builder()
|
||||
.url(host+path)
|
||||
.post(toFormBody(params))
|
||||
.build();
|
||||
String data=getResult(request);
|
||||
JSONObject jo=JSON.parseObject(data);
|
||||
JSONObject joData= jo.getJSONObject("data");
|
||||
if(joData!=null){
|
||||
return joData.getString("token");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 参建单位同步
|
||||
*/
|
||||
//@GetMapping("/asyncProContractor")
|
||||
public AjaxResult asyncProContractor(){
|
||||
String token=getToken();
|
||||
if(StrUtil.isBlank(token)){
|
||||
return AjaxResult.success();
|
||||
}
|
||||
String path="/webapi/project/findProContractorByProjectId";
|
||||
String time = System.currentTimeMillis() + "";
|
||||
String startId="0";
|
||||
String url=host+path+"?appId=" + appId + "&tokenSign=" + token +"×tamp=" + time;
|
||||
String tokenSign = Md5Utils.hash(url);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("appId",appId);
|
||||
params.put("timestamp",time);
|
||||
params.put("tokenSign",tokenSign);
|
||||
params.put("projectId",projectId);
|
||||
params.put("rowId",startId);
|
||||
url=host+path+"?appId="+appId+"&tokenSign="+tokenSign+"&projectId="+projectId+"×tamp="+time+"&rowId="+startId;
|
||||
String data=HttpUtil.get(url);
|
||||
JSONObject j= JSON.parseObject(data);
|
||||
JSONObject joData= j.getJSONObject("data");
|
||||
JSONArray arr=joData.getJSONArray("proContractorList");
|
||||
JSONArray unitList=getUnitList();
|
||||
if(arr.size()>0){
|
||||
for(int i=0;i<arr.size();i++){
|
||||
JSONObject json=arr.getJSONObject(i);
|
||||
callApiSaveParticipatings(json,unitList);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 队伍信息同步
|
||||
*/
|
||||
//@GetMapping("/asyncGroup")
|
||||
public AjaxResult asyncGroup(){
|
||||
JSONArray unitList=getUnitList();
|
||||
JSONArray groupList=getGroupList();
|
||||
for(int i=0;i<unitList.size();i++){
|
||||
JSONObject unit=unitList.getJSONObject(i);
|
||||
if(!unitHasGroup(unit,groupList)){
|
||||
JSONObject jo=new JSONObject();
|
||||
jo.put("unitId",unit.getString("id"));
|
||||
jo.put("uninName", unit.getString("enterpriseName"));
|
||||
jo.put("groupName","西电队伍");
|
||||
jo.put("projectId",mklPrjId);
|
||||
callSaveGroupInfo(jo);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 参建单位是否已有队伍
|
||||
* @param unit
|
||||
* @param groupList
|
||||
* @return
|
||||
*/
|
||||
private boolean unitHasGroup(JSONObject unit, JSONArray groupList) {
|
||||
for(int i=0;i<groupList.size();i++){
|
||||
JSONObject group=groupList.getJSONObject(i);
|
||||
if(group.getString("unitId").equals(unit.getString("id"))){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询参建单位
|
||||
*/
|
||||
private void doSyncProContractor(String token, long startId) {
|
||||
String path="/webapi/project/findProContractorByProjectId";
|
||||
String time = System.currentTimeMillis() + "";
|
||||
String url=host+path+"?appId=" + appId + "&tokenSign=" + token +"×tamp=" + time;
|
||||
|
||||
String tokenSign = Md5Utils.hash(url);
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("appId",appId);
|
||||
params.put("timestamp",time);
|
||||
params.put("tokenSign",tokenSign);
|
||||
params.put("projectId",projectId);
|
||||
params.put("rowId",startId);
|
||||
url=host+path+"?appId="+appId+"&tokenSign="+tokenSign+"&projectId="+projectId+"×tamp="+time+"&rowId="+startId;
|
||||
String data=HttpUtil.get(url);
|
||||
JSONObject j= JSON.parseObject(data);
|
||||
JSONObject joData= j.getJSONObject("data");
|
||||
JSONArray arr=joData.getJSONArray("proContractorList");
|
||||
if(arr.size()>0){
|
||||
long rowId=0;
|
||||
for(int i=0;i<arr.size();i++){
|
||||
JSONObject json=arr.getJSONObject(i);
|
||||
rowId=json.getLong("id");
|
||||
}
|
||||
if(rowId>0){
|
||||
doSyncProContractor(token,rowId+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询班组直隶
|
||||
* @param token
|
||||
*/
|
||||
private void doSyncDirectlyUnderGroup(String token, long startId,JSONArray groupList,JSONArray unitList,JSONArray teamList) {
|
||||
String subcontractorId=getSubcontractor(token);
|
||||
String path="/webapi/project/findDirectlyUnderTeam";
|
||||
String time = System.currentTimeMillis() + "";
|
||||
String url=host+path+"?appId=" + appId + "&tokenSign=" + token +"×tamp=" + time;
|
||||
|
||||
String tokenSign = Md5Utils.hash(url);
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("appId",appId);
|
||||
params.put("timestamp",time);
|
||||
params.put("tokenSign",tokenSign);
|
||||
params.put("projectId",projectId);
|
||||
params.put("subcontractorId",subcontractorId);
|
||||
params.put("rowId",startId);
|
||||
String data= HttpRequest.post(host+path)
|
||||
.header("Content-Type", "application/x-www-form-urlencoded")
|
||||
.form(params).execute().body();
|
||||
JSONObject j= JSON.parseObject(data);
|
||||
JSONObject joData= j.getJSONObject("data");
|
||||
JSONArray arr=joData.getJSONArray("teamList");
|
||||
if(arr.size()>0){
|
||||
long rowId=0;
|
||||
for(int i=0;i<arr.size();i++){
|
||||
JSONObject json=arr.getJSONObject(i);
|
||||
if(!hasAddTeam(json,teamList)){
|
||||
JSONObject group=getTeamGroup(json,groupList);
|
||||
if(group!=null){
|
||||
callSaveTeamInfoList(json,group,unitList);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(rowId>0){
|
||||
doSyncDirectlyUnderGroup(token,rowId+1,groupList,unitList,teamList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取负责人ID
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
private String getSubcontractor(String token) {
|
||||
String path="/webapi/project/querySubcontractorByPhone";
|
||||
String time = System.currentTimeMillis() + "";
|
||||
String url=host+path+"?appId=" + appId + "&tokenSign=" + token +"×tamp=" + time;
|
||||
System.out.println(url);
|
||||
String tokenSign = Md5Utils.hash(url);
|
||||
System.out.println(tokenSign);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("appId",appId);
|
||||
params.put("timestamp",time);
|
||||
params.put("tokenSign",tokenSign);
|
||||
params.put("phone",phone);
|
||||
String data= HttpRequest.post(host+path)
|
||||
.header("Content-Type", "application/x-www-form-urlencoded")
|
||||
.form(params).execute().body();
|
||||
System.out.println(data);
|
||||
JSONObject j= JSON.parseObject(data);
|
||||
JSONObject jd=j.getJSONObject("data");
|
||||
JSONArray arr=jd.getJSONArray("subcontractorList");
|
||||
if(arr.size()>0){
|
||||
JSONObject jo=arr.getJSONObject(0);
|
||||
String tmp=jo.getString("subcontractorId");
|
||||
return tmp;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String getWorkType(String leaderTeamId,String subcontractorId,String findWrokId){
|
||||
String token=getToken();
|
||||
if(StrUtil.isBlank(token)){
|
||||
return "";
|
||||
}
|
||||
String path="/webapi/project/findWorkerByLeader";
|
||||
String time = System.currentTimeMillis() + "";
|
||||
String url=host+path+"?appId=" + appId + "&tokenSign=" + token +"×tamp=" + time;
|
||||
String tokenSign = Md5Utils.hash(url);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("appId",appId);
|
||||
params.put("timestamp",time);
|
||||
params.put("tokenSign",tokenSign);
|
||||
params.put("leaderTeamId",leaderTeamId);
|
||||
params.put("subcontractorId",subcontractorId);
|
||||
String data= HttpRequest.post(host+path)
|
||||
.header("Content-Type", "application/x-www-form-urlencoded")
|
||||
.form(params).execute().body();
|
||||
JSONObject j= JSON.parseObject(data);
|
||||
JSONObject jd=j.getJSONObject("data");
|
||||
JSONArray arr=jd.getJSONArray("recordList");
|
||||
if(arr!=null && arr.size()>0) {
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
String workerId = json.getString("workerId");
|
||||
if(workerId.equals(findWrokId)){
|
||||
return json.getString("jobType");
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 班组信息同步
|
||||
*/
|
||||
//@GetMapping("/asyncTeam")
|
||||
public AjaxResult asyncTeam(){
|
||||
String token=getToken();
|
||||
if(StrUtil.isBlank(token)){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
JSONArray teamList=getTeamList();
|
||||
|
||||
String path="webapi/project/findTeamByProjectId";
|
||||
String time = System.currentTimeMillis() + "";
|
||||
String startId="0";
|
||||
String url=host+path+"?appId=" + appId + "&tokenSign=" + token +"×tamp=" + time;
|
||||
|
||||
String tokenSign = Md5Utils.hash(url);
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("appId",appId);
|
||||
params.put("timestamp",time);
|
||||
params.put("tokenSign",tokenSign);
|
||||
params.put("projectId",projectId);
|
||||
params.put("rowId",startId);
|
||||
url=host+path+"?appId="+appId+"&tokenSign="+tokenSign+"&projectId="+projectId+"×tamp="+time+"&rowId="+startId;
|
||||
String data=HttpUtil.get(url);
|
||||
JSONObject j= JSON.parseObject(data);
|
||||
JSONObject joData= j.getJSONObject("data");
|
||||
JSONArray arr=joData.getJSONArray("teamList");
|
||||
JSONArray groupList=getGroupList();
|
||||
JSONArray unitList=getUnitList();
|
||||
if(arr.size()>0){
|
||||
for(int i=0;i<arr.size();i++){
|
||||
JSONObject json=arr.getJSONObject(i);
|
||||
if(!hasAddTeam(json,teamList)){
|
||||
JSONObject group=getTeamGroup(json,groupList);
|
||||
if(group!=null){
|
||||
callSaveTeamInfoList(json,group,unitList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
doSyncDirectlyUnderGroup(token,0l,groupList,unitList,teamList);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
private JSONObject getTeamGroup(JSONObject json,JSONArray groupList) {
|
||||
String unitName=json.getString("corpName");
|
||||
for(int i=0;i<groupList.size();i++){
|
||||
JSONObject group=groupList.getJSONObject(i);
|
||||
if(group.getString("uninName").equals(unitName)){
|
||||
return group;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否已增加班组信息
|
||||
*
|
||||
* @param json
|
||||
* @param teamList
|
||||
* @return
|
||||
*/
|
||||
private boolean hasAddTeam(JSONObject json, JSONArray teamList) {
|
||||
String unitName=json.getString("corpName");
|
||||
String teamName=json.getString("teamName");
|
||||
for(int i=0;i<teamList.size();i++){
|
||||
JSONObject j=teamList.getJSONObject(i);
|
||||
if(j.getString("uninName").equals(unitName) && j.getString("teamName").equals(teamName)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员信息同步
|
||||
*/
|
||||
//@GetMapping("/asyncWorker")
|
||||
public AjaxResult asyncWorker(){
|
||||
String token=getToken();
|
||||
if(StrUtil.isBlank(token)){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
JSONArray userList=getUserInfoList();
|
||||
JSONArray teamList=getTeamList();
|
||||
JSONArray wrokTypeList=getWorkTypeList();
|
||||
doSyncWorker(token,0l,userList,teamList,wrokTypeList);
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
private void doSyncWorker(String token, long startId,JSONArray userList,JSONArray teamList,JSONArray wrokTypeList) {
|
||||
String path="/webapi/project/findAddWorkerByProject";
|
||||
String time = System.currentTimeMillis() + "";
|
||||
String url=host+path+"?appId=" + appId + "&tokenSign=" + token +"×tamp=" + time;
|
||||
|
||||
String tokenSign = Md5Utils.hash(url);
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("appId",appId);
|
||||
params.put("timestamp",time);
|
||||
params.put("tokenSign",tokenSign);
|
||||
params.put("projectId",projectId);
|
||||
params.put("startId",startId);
|
||||
String data= HttpRequest.post(host+path)
|
||||
.header("Content-Type", "application/x-www-form-urlencoded")
|
||||
.form(params).execute().body();
|
||||
JSONObject j= JSON.parseObject(data);
|
||||
JSONObject joData= j.getJSONObject("data");
|
||||
long endId= joData.getLong("endId");
|
||||
JSONArray arr=joData.getJSONArray("workerList");
|
||||
if(arr.size()>0) {
|
||||
for(int i=0;i<arr.size();i++){
|
||||
JSONObject json=arr.getJSONObject(i);
|
||||
String idNumber=json.getString("idNumber");
|
||||
if(!existsIdNumberInList(idNumber,userList)){
|
||||
JSONObject joTeam=getWrokerTeam(json.getString("subcontractorId"),teamList);
|
||||
if(joTeam!=null){
|
||||
callApiPersonSync(json,joTeam,wrokTypeList);
|
||||
}
|
||||
}
|
||||
}
|
||||
doSyncWorker(token,endId,userList,teamList,wrokTypeList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private JSONObject getWrokerTeam(String subcontractorId, JSONArray teamList) {
|
||||
for(int i=0;i<teamList.size();i++){
|
||||
JSONObject j=teamList.getJSONObject(i);
|
||||
if(j.getString("captainIdcard").equals(subcontractorId)){
|
||||
return j;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询身份证是否已存在
|
||||
* @param idNumber
|
||||
* @param userList
|
||||
* @return
|
||||
*/
|
||||
private boolean existsIdNumberInList(String idNumber, JSONArray userList) {
|
||||
for(int i=0;i<userList.size();i++){
|
||||
JSONObject j=userList.getJSONObject(i);
|
||||
if(j.getString("idcardnum").equals(idNumber)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步当天数据
|
||||
*/
|
||||
//@GetMapping("/asyncAttendanceData")
|
||||
public AjaxResult asyncAttendanceData(){
|
||||
String dtStart= DateUtil.format(new Date(),"yyyy-MM-dd");
|
||||
String dtEnd=dtStart;
|
||||
JSONArray userList=getUserInfoList();
|
||||
syncAttendanceData(dtStart,dtEnd,userList);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
/**
|
||||
* 同步7天之内数据
|
||||
*/
|
||||
//@GetMapping("/syncLastWeekAttendanceData")
|
||||
public void syncLastWeekAttendanceData(){
|
||||
String dtEnd=DateUtil.format(new Date(),"yyyy-MM-dd");
|
||||
String dtStart=DateUtil.format(DateUtil.offsetDay(new Date(),-7),"yyyy-MM-dd");
|
||||
JSONArray userList=getUserInfoList();
|
||||
syncAttendanceData(dtStart,dtEnd,userList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步30天内数据
|
||||
*/
|
||||
//@GetMapping("/syncLast30DayAttendanceData")
|
||||
public void syncLast30DayAttendanceData(){
|
||||
String dtEnd=DateUtil.format(new Date(),"yyyy-MM-dd");
|
||||
String dtStart=DateUtil.format(DateUtil.offsetDay(new Date(),-300),"yyyy-MM-dd");
|
||||
JSONArray userList=getUserInfoList();
|
||||
syncAttendanceData(dtStart,dtEnd,userList);
|
||||
}
|
||||
|
||||
//@GetMapping("/syncLast202406to202410DayAttendanceData")
|
||||
public void syncLast202406to202410DayAttendanceData(){
|
||||
String dtStart="2024-06-01";
|
||||
String dtEnd="2024-07-01";
|
||||
JSONArray userList=getUserInfoList();
|
||||
syncAttendanceData(dtStart,dtEnd,userList);
|
||||
dtStart="2024-07-01";
|
||||
dtEnd="2024-08-01";
|
||||
syncAttendanceData(dtStart,dtEnd,userList);
|
||||
dtStart="2024-08-01";
|
||||
dtEnd="2024-09-01";
|
||||
syncAttendanceData(dtStart,dtEnd,userList);
|
||||
dtStart="2024-09-01";
|
||||
dtEnd="2024-10-01";
|
||||
syncAttendanceData(dtStart,dtEnd,userList);
|
||||
dtStart="2024-10-01";
|
||||
dtEnd="2024-11-01";
|
||||
syncAttendanceData(dtStart,dtEnd,userList);
|
||||
}
|
||||
private void syncAttendanceData(String dtStart, String dtEnd, JSONArray userList) {
|
||||
String token=getToken();
|
||||
if(StrUtil.isBlank(token)){
|
||||
return;
|
||||
}
|
||||
JSONObject jo=new JSONObject();
|
||||
jo.put("token",token);
|
||||
jo.put("startTime",dtStart);
|
||||
jo.put("endTime",dtEnd);
|
||||
doSyncAttendanceData(jo,"0",userList);
|
||||
}
|
||||
|
||||
private void doSyncAttendanceData(JSONObject jo, String startId, JSONArray userList) {
|
||||
String token=jo.getString("token");
|
||||
String startTime=jo.getString("startTime");
|
||||
String endTime=jo.getString("endTime");
|
||||
String path="/webapi/project/findAttendanceByProject";
|
||||
String time = System.currentTimeMillis() + "";
|
||||
String url=host+path+"?appId=" + appId + "&tokenSign=" + token +"×tamp=" + time;
|
||||
|
||||
String tokenSign = Md5Utils.hash(url);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("appId",appId);
|
||||
params.put("timestamp",time);
|
||||
params.put("tokenSign",tokenSign);
|
||||
params.put("projectId",projectId);
|
||||
params.put("startId",startId);
|
||||
params.put("startTime",startTime);
|
||||
params.put("endTime",endTime);
|
||||
String data=HttpRequest.post(host+path)
|
||||
.header("Content-Type", "application/x-www-form-urlencoded")
|
||||
.form(params).execute().body();
|
||||
System.out.println(data);
|
||||
JSONObject j= JSON.parseObject(data);
|
||||
JSONObject joData= j.getJSONObject("data");
|
||||
String endId= joData.getString("endId");
|
||||
JSONArray arr=joData.getJSONArray("workerAttList");
|
||||
if(arr!=null && arr.size()>0){
|
||||
for(int i=0;i<arr.size();i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
callApiclockData(json,userList);
|
||||
}
|
||||
doSyncAttendanceData(jo,endId,userList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static RequestBody toFormBody(Map<String, Object> params ){
|
||||
FormBody.Builder builder=new FormBody.Builder();
|
||||
for(String key :params.keySet()){
|
||||
builder.add(key,params.get(key).toString());
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
public static String getResult(Request request) {
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Response response;
|
||||
try {
|
||||
response = client.newCall(request).execute();
|
||||
if (response.body() != null) {
|
||||
return response.body().string();
|
||||
} else {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
private static String mklAppId="4465a89944f94397897ba897abc5607e";
|
||||
private static String mklAppsecret="BE6FC933B83C4BE78A3BD8F85E026E3B";
|
||||
private static long mklPrjId=229;
|
||||
public static String getMklSign(){
|
||||
String tmp=mklAppsecret+"appid"+mklAppId+mklAppsecret;
|
||||
return Md5Utils.hash(tmp).toUpperCase();
|
||||
}
|
||||
|
||||
public static String getMklSign2(){
|
||||
String tmp=mklAppsecret+"appid"+mklAppId+"projectId"+mklPrjId+mklAppsecret;
|
||||
return Md5Utils.hash(tmp).toUpperCase();
|
||||
}
|
||||
|
||||
private static String postJson(String url,JSONObject jo){
|
||||
return HttpUtil.createPost(url)
|
||||
.body(jo.toJSONString()) // 设置请求体为JSON字符串
|
||||
.contentType("application/json") // 设置Content-Type为application/json
|
||||
.execute() // 执行请求
|
||||
.body(); // 获取响应体
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取队伍信息
|
||||
* @return
|
||||
*/
|
||||
private JSONArray getGroupList(){
|
||||
String url="http://smz.makalu.cc/mkl/basic/getGroupList?appid="+mklAppId+"&sign="+getMklSign2()+"&projectId="+mklPrjId;
|
||||
String data= HttpUtil.get(url);
|
||||
JSONObject jo= JSON.parseObject(data);
|
||||
return jo.getJSONArray("data");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参建单位信息
|
||||
* @return
|
||||
*/
|
||||
private JSONArray getUnitList(){
|
||||
String url="http://smz.makalu.cc/mkl/basic/getUnitList?appid="+mklAppId+"&sign="+getMklSign2()+"&projectId="+mklPrjId;
|
||||
String data= HttpUtil.get(url);
|
||||
JSONObject jo= JSON.parseObject(data);
|
||||
return jo.getJSONArray("data");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取人员信息
|
||||
* @return
|
||||
*/
|
||||
private JSONArray getUserInfoList(){
|
||||
String url="http://smz.makalu.cc/mkl/basic/getUserInfoList?appid="+mklAppId+"&sign="+getMklSign2()+"&projectId="+mklPrjId;
|
||||
String data= HttpUtil.get(url);
|
||||
JSONObject jo= JSON.parseObject(data);
|
||||
return jo.getJSONArray("data");
|
||||
}
|
||||
/**
|
||||
* 获取班组信息
|
||||
* @return
|
||||
*/
|
||||
private JSONArray getTeamList(){
|
||||
String url="http://smz.makalu.cc/mkl/basic/getTeamList?appid="+mklAppId+"&sign="+getMklSign2()+"&projectId="+mklPrjId;
|
||||
String data= HttpUtil.get(url);
|
||||
JSONObject jo= JSON.parseObject(data);
|
||||
return jo.getJSONArray("data");
|
||||
}
|
||||
private JSONArray getWorkTypeList(){
|
||||
String url="http://smz.makalu.cc/mkl/basic/getWorkTypeList?appid="+mklAppId+"&sign="+getMklSign2()+"&projectId="+mklPrjId;
|
||||
String data= HttpUtil.get(url);
|
||||
JSONObject jo= JSON.parseObject(data);
|
||||
return jo.getJSONArray("data");
|
||||
}
|
||||
|
||||
/**
|
||||
* 参建单位已增加
|
||||
* @param jo
|
||||
* @param unitList
|
||||
* @return
|
||||
*/
|
||||
private boolean hasAddUnit(JSONObject jo,JSONArray unitList){
|
||||
String code=jo.getString("corpCode");
|
||||
for(int i=0;i<unitList.size();i++){
|
||||
JSONObject json=unitList.getJSONObject(i);
|
||||
if(json.getString("creditCode").equals(code)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 队伍信息同步
|
||||
* @param jo
|
||||
*/
|
||||
private void callSaveGroupInfo(JSONObject joPost) {
|
||||
String url="http://smz.makalu.cc/mkl/api/saveGroupInfo";
|
||||
joPost.put("sign",getMklSign());
|
||||
joPost.put("appid",mklAppId);
|
||||
String result= postJson(url,joPost);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加参建单位
|
||||
* @param json
|
||||
* @param unitList
|
||||
*/
|
||||
private void callApiSaveParticipatings(JSONObject json,JSONArray unitList) {
|
||||
if(hasAddUnit(json,unitList)){
|
||||
return;
|
||||
}
|
||||
String url="http://smz.makalu.cc/mkl/api/saveParticipatings";
|
||||
JSONObject jo=new JSONObject();
|
||||
jo.put("project_id",mklPrjId);
|
||||
jo.put("enterprise_name",json.getString("corpName"));
|
||||
jo.put("credit_code",json.getString("corpCode"));
|
||||
jo.put("unit_typeid",getMklUnitType(json.getString("corpType")));
|
||||
jo.put("business_scope","");
|
||||
jo.put("contact_name",json.getString("pmName"));
|
||||
jo.put("contact_phone",json.getString("pmPhone"));
|
||||
jo.put("regist_addr",json.getString("registerAddress"));
|
||||
jo.put("regist_date",json.getString("registeredTime"));
|
||||
jo.put("corporation_name",json.getString("pmName"));
|
||||
jo.put("corporation_cardnum",json.getString("pmIdcardNumber"));
|
||||
jo.put("corporation_phone",json.getString("pmPhone"));
|
||||
jo.put("entrusted_agent_name",json.getString("pmName"));
|
||||
jo.put("entrusted_agent_phone",json.getString("pmPhone"));
|
||||
jo.put("entrusted_agent_education_level","");
|
||||
jo.put("id_card_front","");
|
||||
jo.put("id_card_back","");
|
||||
jo.put("half_body_photo","");
|
||||
jo.put("entrusted_agent_cardnum",json.getString("pmIdcardNumber"));
|
||||
JSONArray data=new JSONArray();
|
||||
data.add(jo);
|
||||
JSONObject joPost=new JSONObject();
|
||||
joPost.put("data",data);
|
||||
joPost.put("sign",getMklSign());
|
||||
joPost.put("appid",mklAppId);
|
||||
String result= postJson(url,joPost);
|
||||
}
|
||||
|
||||
/**
|
||||
* 班组信息同步
|
||||
* @param json
|
||||
* @param groupList
|
||||
*/
|
||||
private void callSaveTeamInfoList(JSONObject json, JSONObject group,JSONArray unitList) {
|
||||
String url="http://smz.makalu.cc/mkl/api/saveTeamInfoList";
|
||||
JSONObject jo=new JSONObject();
|
||||
jo.put("projectId",mklPrjId);
|
||||
jo.put("unitId",group.getIntValue("unitId"));
|
||||
jo.put("uninName",group.getString("uninName"));
|
||||
jo.put("groupId",group.getIntValue("id"));
|
||||
jo.put("teamName",json.getString("teamName"));
|
||||
String unitTypeid=getUnitTyeId(group.getString("unitId"),unitList);
|
||||
jo.put("teamType","1".equals(unitTypeid)||"8".equals(unitTypeid)?"2":"1");
|
||||
jo.put("captainName",json.getString("resPersonName"));
|
||||
jo.put("captainIdcard",json.getString("subcontractorId"));
|
||||
jo.put("captainPhone",json.getString("resPersonPhone"));
|
||||
jo.put("sign",getMklSign());
|
||||
jo.put("appid",mklAppId);
|
||||
JSONArray data=new JSONArray();
|
||||
data.add(jo);
|
||||
JSONObject joPost=new JSONObject();
|
||||
joPost.put("data",data);
|
||||
joPost.put("sign",getMklSign());
|
||||
joPost.put("appid",mklAppId);
|
||||
String result= postJson(url,joPost);
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员信息同步
|
||||
* @param json
|
||||
* @param joTeam
|
||||
*/
|
||||
private void callApiPersonSync(JSONObject json, JSONObject joTeam,JSONArray workTypeList) {
|
||||
String url="http://smz.makalu.cc/mkl/api/personSync";
|
||||
JSONObject jo=new JSONObject();
|
||||
String teamLeaderId=json.getString("teamLeaderId");
|
||||
String subcontractorId=joTeam.getString("captainIdcard");
|
||||
String workId=json.getString("workerId");
|
||||
//String jobType=getWorkType(teamLeaderId,subcontractorId,workId);
|
||||
String jobType=json.getString("jobtype");
|
||||
jo.put("projectId",mklPrjId);
|
||||
jo.put("idcardnum",json.getString("idNumber"));
|
||||
jo.put("name",json.getString("name"));
|
||||
jo.put("teamid",joTeam.getIntValue("id"));
|
||||
jo.put("userphone",json.getString("phone"));
|
||||
jo.put("userphoto",json.getString("headImage"));
|
||||
jo.put("enterdate",json.getString("scannerTime"));
|
||||
jo.put("worktypeid",getMKLWorkType(jobType,workTypeList));
|
||||
jo.put("sex","1".equals(json.getString("sex"))?"男":"女");
|
||||
jo.put("nation",json.getString("minor"));
|
||||
jo.put("birthday",json.getString("birthday"));
|
||||
jo.put("address",json.getString("address"));
|
||||
jo.put("organization",workId);
|
||||
jo.put("useStarttime",json.getString("expiryday"));
|
||||
jo.put("useEndtime",json.getString("expiryday"));
|
||||
jo.put("idcardimg",json.getString("idFront"));
|
||||
jo.put("idcardimg2",json.getString("idBack"));
|
||||
jo.put("information_path","");
|
||||
jo.put("signature","");
|
||||
jo.put("sign",getMklSign());
|
||||
jo.put("appid",mklAppId);
|
||||
String result= postJson(url,jo);
|
||||
|
||||
}
|
||||
|
||||
private void callApiclockData(JSONObject json, JSONArray userList) {
|
||||
String url="http://smz.makalu.cc/mkl/api/clockData";
|
||||
JSONObject jo=new JSONObject();
|
||||
String workerId=json.getString("workerId");
|
||||
JSONObject joUser=findUserByWorkId(workerId,userList);
|
||||
if(joUser==null){
|
||||
return;
|
||||
}
|
||||
jo.put("sign",getMklSign());
|
||||
jo.put("appid",mklAppId);
|
||||
jo.put("projectId",mklPrjId);
|
||||
jo.put("user_cardnum",joUser.getString("idcardnum"));
|
||||
jo.put("user_name",joUser.getString("name"));
|
||||
jo.put("ic_num","");
|
||||
jo.put("team_id",joUser.getIntValue("teamid"));
|
||||
jo.put("workscope","");
|
||||
jo.put("equipmentid",json.getString("deviceSerialNo"));
|
||||
jo.put("clockin_type",getSignType(json.getString("signType")));
|
||||
jo.put("clockinTime",json.getString("checkinTime"));
|
||||
jo.put("faceimg",json.getString("signimg"));
|
||||
jo.put("latitude",json.getString("latitude"));
|
||||
jo.put("longitude",json.getString("longitude"));
|
||||
jo.put("unionid",json.getString("attendanceId"));
|
||||
jo.put("address",json.getString("projectCoordinate"));
|
||||
jo.put("recommend","");
|
||||
jo.put("state",json.getString("machineType").equals("3")?"O":"E");
|
||||
|
||||
String result= postJson(url,jo);
|
||||
}
|
||||
|
||||
private String getSignType(String signType) {
|
||||
//01:定位 02:短信 03:NFC 签到 04:二维码;05:考勤机;06:WeChat;07:刷脸签到;08 非活体 00:没有
|
||||
if("01".equals(signType)){
|
||||
return "定位";
|
||||
}
|
||||
if("02".equals(signType)){
|
||||
return "短信";
|
||||
}
|
||||
if("03".equals(signType)){
|
||||
return "NFC 签到";
|
||||
}
|
||||
if("04".equals(signType)){
|
||||
return "二维码";
|
||||
}
|
||||
if("05".equals(signType)){
|
||||
return "考勤机";
|
||||
}
|
||||
if("06".equals(signType)){
|
||||
return "WeChat";
|
||||
}
|
||||
if("07".equals(signType)){
|
||||
return "刷脸签到";
|
||||
}
|
||||
if("08".equals(signType)){
|
||||
return "非活体";
|
||||
}
|
||||
|
||||
return "没有";
|
||||
}
|
||||
|
||||
private JSONObject findUserByWorkId(String workerId, JSONArray userList) {
|
||||
for(int i=0;i<userList.size();i++){
|
||||
JSONObject jo=userList.getJSONObject(i);
|
||||
if(jo.getString("organization").equals(workerId)){
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private int getMKLWorkType(String jobtype, JSONArray workTypeList) {
|
||||
for(int i=0;i<workTypeList.size();i++){
|
||||
JSONObject jo=workTypeList.getJSONObject(i);
|
||||
String wk=jo.getString("workType");
|
||||
if(wk.contains(jobtype)||jobtype.contains(wk)){
|
||||
return jo.getIntValue("id");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
private String getUnitTyeId(String unitId, JSONArray unitList) {
|
||||
for(int i=0;i<unitList.size();i++){
|
||||
JSONObject json=unitList.getJSONObject(i);
|
||||
if(json.getString("id").equals(unitId)){
|
||||
return json.getString("unitTypeid");
|
||||
}
|
||||
}
|
||||
return "12";
|
||||
}
|
||||
|
||||
private int getMklUnitType(String corpType) {
|
||||
if(corpType.equals("001")){
|
||||
return 2;
|
||||
}
|
||||
if(corpType.equals("002")){
|
||||
return 4;
|
||||
}
|
||||
if(corpType.equals("003")){
|
||||
return 5;
|
||||
}
|
||||
if(corpType.equals("004")){
|
||||
return 6;
|
||||
}
|
||||
if(corpType.equals("005")){
|
||||
return 7;
|
||||
}
|
||||
if(corpType.equals("006")){
|
||||
return 3;
|
||||
}
|
||||
if(corpType.equals("007")){
|
||||
return 8;
|
||||
}
|
||||
if(corpType.equals("009")){
|
||||
return 1;
|
||||
}
|
||||
if(corpType.equals("010")){
|
||||
return 10;
|
||||
}
|
||||
if(corpType.equals("011")){
|
||||
return 11;
|
||||
}
|
||||
return 12;
|
||||
}
|
||||
}
|
|
@ -30,7 +30,6 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.beans.Transient;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
@ -87,85 +86,87 @@ public class GainHzDataTask {
|
|||
iotDeviceInfo.setDeviceName("配电箱");
|
||||
List<IotDeviceInfo> iotDeviceInfos = iIotDeviceInfoService.selectIotDeviceInfoList(iotDeviceInfo);
|
||||
iotDeviceInfos.forEach(item -> {
|
||||
if(item.getHzTenantId() != null && item.getHzProjectId() != null) {
|
||||
JSONObject body = new JSONObject();
|
||||
body.put("tenantId", item.getHzTenantId());
|
||||
body.put("projectId", item.getHzProjectId());
|
||||
body.put("startTime", startTime);
|
||||
body.put("endTime", endTime);
|
||||
String res_str = HttpRequest.post(HzApiConf.IOT_POWER_HOST + HzApiConf.DISTRIBUTION_BOX_PAGE_REAL_DATA)
|
||||
.header("appId", HzApiConf.APP_ID).header("appSecret", HzApiConf.APP_SECRET)
|
||||
.body(body.toString())
|
||||
.execute().body();
|
||||
JSONObject res = JSONObject.parseObject(res_str);
|
||||
if(Objects.isNull(item.getFactoryName()) || !Objects.equals("萨达",item.getFactoryName())){
|
||||
if(item.getHzTenantId() != null && item.getHzProjectId() != null) {
|
||||
JSONObject body = new JSONObject();
|
||||
body.put("tenantId", item.getHzTenantId());
|
||||
body.put("projectId", item.getHzProjectId());
|
||||
body.put("startTime", startTime);
|
||||
body.put("endTime", endTime);
|
||||
String res_str = HttpRequest.post(HzApiConf.IOT_POWER_HOST + HzApiConf.DISTRIBUTION_BOX_PAGE_REAL_DATA)
|
||||
.header("appId", HzApiConf.APP_ID).header("appSecret", HzApiConf.APP_SECRET)
|
||||
.body(body.toString())
|
||||
.execute().body();
|
||||
JSONObject res = JSONObject.parseObject(res_str);
|
||||
|
||||
//2. 解析数据
|
||||
System.out.println(res_str);
|
||||
JSONArray content = res.getJSONObject("data").getJSONArray("content");
|
||||
System.out.println(content);
|
||||
List<IotWarningInfo> iotWarningInfos = new ArrayList<>(16);
|
||||
List<IotPower> iotPowers = new ArrayList<>(16);
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
//2. 解析数据
|
||||
System.out.println(res_str);
|
||||
JSONArray content = res.getJSONObject("data").getJSONArray("content");
|
||||
System.out.println(content);
|
||||
List<IotWarningInfo> iotWarningInfos = new ArrayList<>(16);
|
||||
List<IotPower> iotPowers = new ArrayList<>(16);
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
|
||||
//3.数据转换
|
||||
JSONObject tmp = content.getJSONObject(i);
|
||||
IotPower iotPower = new IotPower();
|
||||
iotPower.setUid(tmp.getString("deviceSn"));
|
||||
iotPower.setTime(tmp.getDate("createTime"));
|
||||
iotPower.setPower(BigDecimal.valueOf(tmp.getFloat("totalPower")));
|
||||
iotPower.setLeak(BigDecimal.valueOf(tmp.getFloat("leftElectric")));
|
||||
iotPower.setC1(BigDecimal.valueOf(tmp.getFloat("currentElectric1")));
|
||||
iotPower.setC2(BigDecimal.valueOf(tmp.getFloat("currentElectric2")));
|
||||
iotPower.setC3(BigDecimal.valueOf(tmp.getFloat("currentElectric3")));
|
||||
iotPower.setV1(BigDecimal.valueOf(tmp.getFloat("currentVoltage1")));
|
||||
iotPower.setV2(BigDecimal.valueOf(tmp.getFloat("currentVoltage2")));
|
||||
iotPower.setV3(BigDecimal.valueOf(tmp.getFloat("currentVoltage3")));
|
||||
iotPower.setT1(BigDecimal.valueOf(tmp.getFloat("monitorTem1")));
|
||||
iotPower.setT2(BigDecimal.valueOf(tmp.getFloat("monitorTem2")));
|
||||
iotPower.setT3(BigDecimal.valueOf(tmp.getFloat("monitorTem3")));
|
||||
iotPower.setT4(BigDecimal.valueOf(tmp.getFloat("monitorTem4")));
|
||||
if (t % 2 == 0 && !warrning[t]) {
|
||||
warrning = new Boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
warrning[t] = true;
|
||||
if (iotPower.getLeak().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_LEAK) {
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("漏电预警");
|
||||
iotWarningInfo.setContent(String.format("设备存在漏电,当前剩余电流:%s", iotPower.getLeak()));
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
//3.数据转换
|
||||
JSONObject tmp = content.getJSONObject(i);
|
||||
IotPower iotPower = new IotPower();
|
||||
iotPower.setUid(tmp.getString("deviceSn"));
|
||||
iotPower.setTime(tmp.getDate("createTime"));
|
||||
iotPower.setPower(BigDecimal.valueOf(tmp.getFloat("totalPower")));
|
||||
iotPower.setLeak(BigDecimal.valueOf(tmp.getFloat("leftElectric")));
|
||||
iotPower.setC1(BigDecimal.valueOf(tmp.getFloat("currentElectric1")));
|
||||
iotPower.setC2(BigDecimal.valueOf(tmp.getFloat("currentElectric2")));
|
||||
iotPower.setC3(BigDecimal.valueOf(tmp.getFloat("currentElectric3")));
|
||||
iotPower.setV1(BigDecimal.valueOf(tmp.getFloat("currentVoltage1")));
|
||||
iotPower.setV2(BigDecimal.valueOf(tmp.getFloat("currentVoltage2")));
|
||||
iotPower.setV3(BigDecimal.valueOf(tmp.getFloat("currentVoltage3")));
|
||||
iotPower.setT1(BigDecimal.valueOf(tmp.getFloat("monitorTem1")));
|
||||
iotPower.setT2(BigDecimal.valueOf(tmp.getFloat("monitorTem2")));
|
||||
iotPower.setT3(BigDecimal.valueOf(tmp.getFloat("monitorTem3")));
|
||||
iotPower.setT4(BigDecimal.valueOf(tmp.getFloat("monitorTem4")));
|
||||
if (t % 2 == 0 && !warrning[t]) {
|
||||
warrning = new Boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
warrning[t] = true;
|
||||
if (iotPower.getLeak().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_LEAK) {
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("漏电预警");
|
||||
iotWarningInfo.setContent(String.format("设备存在漏电,当前剩余电流:%s", iotPower.getLeak()));
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
|
||||
if (iotPower.getT1().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP
|
||||
|| iotPower.getT2().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP
|
||||
|| iotPower.getT3().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP
|
||||
|| iotPower.getT4().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP) {
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("温度异常");
|
||||
iotWarningInfo.setContent(String.format("设备当前温度:%s,%s,%s,%s,有温度高于70度", iotPower.getT1(), iotPower.getT2(), iotPower.getT3(), iotPower.getT4()));
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
}
|
||||
|
||||
if (iotPower.getT1().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP
|
||||
|| iotPower.getT2().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP
|
||||
|| iotPower.getT3().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP
|
||||
|| iotPower.getT4().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP) {
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("温度异常");
|
||||
iotWarningInfo.setContent(String.format("设备当前温度:%s,%s,%s,%s,有温度高于70度", iotPower.getT1(), iotPower.getT2(), iotPower.getT3(), iotPower.getT4()));
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
//4. 数据入库
|
||||
iotPowers.add(iotPower);
|
||||
|
||||
Request request = new Request();
|
||||
request.setUri("https://aqzg.makalu.cc/api/iot/power/save");
|
||||
request.addBody(JSONObject.parseObject(JSONObject.toJSONString(iotPower), HashMap.class));
|
||||
try {
|
||||
HttpClient.json(request);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
//4. 数据入库
|
||||
iotPowers.add(iotPower);
|
||||
|
||||
Request request = new Request();
|
||||
request.setUri("https://aqzg.makalu.cc/api/iot/power/save");
|
||||
request.addBody(JSONObject.parseObject(JSONObject.toJSONString(iotPower), HashMap.class));
|
||||
try {
|
||||
HttpClient.json(request);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
if (iotPowers.size() > 0) {
|
||||
iotPowerService.batchInsertPower(iotPowers);
|
||||
}
|
||||
if (iotWarningInfos.size() > 0) {
|
||||
iotWarningInfoService.batchInsertWarning(iotWarningInfos);
|
||||
}
|
||||
}
|
||||
if (iotPowers.size() > 0) {
|
||||
iotPowerService.batchInsertPower(iotPowers);
|
||||
}
|
||||
if (iotWarningInfos.size() > 0) {
|
||||
iotWarningInfoService.batchInsertWarning(iotWarningInfos);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
package com.ruoyi.iot.task;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.iot.conf.HzApiConf;
|
||||
import com.ruoyi.iot.domain.IotDeviceInfo;
|
||||
import com.ruoyi.iot.domain.IotPower;
|
||||
import com.ruoyi.iot.domain.IotWarningInfo;
|
||||
import com.ruoyi.iot.service.IIotDeviceInfoService;
|
||||
import com.ruoyi.iot.service.IIotPowerService;
|
||||
import com.ruoyi.iot.service.IIotWarningInfoService;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 萨达配电箱数据定时任务
|
||||
* @Title: SadaHzDataTask
|
||||
* @Package com.yanzhu.xd.system.task
|
||||
* @Author: JiangYuQi
|
||||
* @Copyright 版权归"陕西马卡鲁信息技术有限公司(或个⼈)"所有
|
||||
* @CreateTime: 2024/10/26 17:05
|
||||
*/
|
||||
@Component("sadaHzDataTask")
|
||||
public class SadaHzDataTask {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SadaHzDataTask.class);
|
||||
|
||||
@Autowired
|
||||
private IIotPowerService iotPowerService;
|
||||
|
||||
@Autowired
|
||||
private IIotWarningInfoService iotWarningInfoService;
|
||||
|
||||
@Autowired
|
||||
private IIotDeviceInfoService iIotDeviceInfoService;
|
||||
|
||||
public static Boolean[] warrning_power_sd = new Boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
|
||||
@Test
|
||||
public void getPowerData() {
|
||||
//获取当前时间是否需要预警两小时预警一次0,2,4,6,8,10,12,14,16,18,20,22
|
||||
Integer t = Integer.valueOf(new SimpleDateFormat("HH").format(new Date()));
|
||||
|
||||
//1.通过接口获取数据
|
||||
Long endTime = System.currentTimeMillis();
|
||||
Long startTime = endTime - HzApiConf.INTERVAL_TIME;
|
||||
|
||||
IotDeviceInfo iotDeviceInfo = new IotDeviceInfo();
|
||||
iotDeviceInfo.setDeviceName("配电箱");
|
||||
iotDeviceInfo.setFactoryName("萨达");
|
||||
List<IotDeviceInfo> iotDeviceInfos = iIotDeviceInfoService.selectIotDeviceInfoList(iotDeviceInfo);
|
||||
iotDeviceInfos.forEach(item -> {
|
||||
String res_str = HttpRequest.get(HzApiConf.SD_IOT_POWER_HOST + "/metric/box/"+item.getDeviceId())
|
||||
.execute().body();
|
||||
JSONObject res = JSONObject.parseObject(res_str).getJSONObject("result");
|
||||
// 电能检测数据
|
||||
JSONObject metric = res.getJSONObject("metric");
|
||||
// 温度检测数据
|
||||
JSONArray temperatures = res.getJSONArray("temperatures");
|
||||
// 漏电检测数据
|
||||
JSONArray leakages = res.getJSONArray("leakages");
|
||||
// 报警数据
|
||||
JSONObject ticketStatus = res.getJSONObject("ticketStatus");
|
||||
List<IotPower> iotPowers = new ArrayList<>(16);
|
||||
List<IotWarningInfo> iotWarningInfos = new ArrayList<>(16);
|
||||
IotPower iotPower = new IotPower();
|
||||
iotPower.setUid(item.getDeviceId());
|
||||
iotPower.setTime(DateUtils.getNowDate());
|
||||
BigDecimal power = metric.getBigDecimal("power_a").add(metric.getBigDecimal("power_b")).add(metric.getBigDecimal("power_c"));
|
||||
iotPower.setPower(power.divide(new BigDecimal(3), 2, BigDecimal.ROUND_HALF_UP));
|
||||
int leak = 0;
|
||||
for (int i = 0; i < leakages.size(); i++) {
|
||||
JSONObject leakage = leakages.getJSONObject(i);
|
||||
if(Convert.toInt(leakage.get("leakage"),0)>leak){
|
||||
leak = leakage.getInteger("leakage");
|
||||
}
|
||||
}
|
||||
iotPower.setLeak(BigDecimal.valueOf(leak));
|
||||
iotPower.setC1(BigDecimal.valueOf(metric.getFloat("current_a")));
|
||||
iotPower.setC2(BigDecimal.valueOf(metric.getFloat("current_b")));
|
||||
iotPower.setC3(BigDecimal.valueOf(metric.getFloat("current_c")));
|
||||
iotPower.setV1(BigDecimal.valueOf(metric.getFloat("voltage_a")));
|
||||
iotPower.setV2(BigDecimal.valueOf(metric.getFloat("voltage_b")));
|
||||
iotPower.setV3(BigDecimal.valueOf(metric.getFloat("voltage_c")));
|
||||
BigDecimal data = temperatures.getJSONObject(0).getBigDecimal("temperature");
|
||||
iotPower.setT1(data);
|
||||
iotPower.setT2(data);
|
||||
iotPower.setT3(data);
|
||||
iotPower.setT4(data);
|
||||
|
||||
// 预警数据
|
||||
if (t % 2 == 0 && !warrning_power_sd[t]) {
|
||||
warrning_power_sd = new Boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
warrning_power_sd[t] = true;
|
||||
|
||||
if(ticketStatus.getInteger("is_blackout")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("断电预警");
|
||||
iotWarningInfo.setContent("设备触发断电,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_smoke")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("烟感报警");
|
||||
iotWarningInfo.setContent("设备烟感报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_overload")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("过载报警");
|
||||
iotWarningInfo.setContent("设备过载报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_disconnect")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("断开报警");
|
||||
iotWarningInfo.setContent("设备断开报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_overheat")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType(" 高温报警");
|
||||
iotWarningInfo.setContent("设备高温报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_leakage")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType(" 漏电报警");
|
||||
iotWarningInfo.setContent("设备漏电报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
}
|
||||
|
||||
iotPowers.add(iotPower);
|
||||
|
||||
if (iotPowers.size() > 0) {
|
||||
iotPowerService.batchInsertPower(iotPowers);
|
||||
}
|
||||
if (iotWarningInfos.size() > 0) {
|
||||
iotWarningInfoService.batchInsertWarning(iotWarningInfos);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -14,10 +14,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="typeName" column="type_name" />
|
||||
<result property="hzTenantId" column="hz_tenant_id" />
|
||||
<result property="hzProjectId" column="hz_project_id" />
|
||||
<result property="factoryName" column="factory_name" />
|
||||
<result property="companyName" column="company_name" />
|
||||
<result property="projectName" column="project_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectIotDeviceInfoVo">
|
||||
select id, device_id, device_name, state, project_id, points,type_name,hz_tenant_id,hz_project_id from iot_device_info
|
||||
select id, device_id, device_name, state, project_id, points, type_name, hz_tenant_id, hz_project_id, factory_name, company_name, project_name from iot_device_info
|
||||
</sql>
|
||||
|
||||
<select id="selectIotDeviceInfoList" parameterType="IotDeviceInfo" resultMap="IotDeviceInfoResult">
|
||||
|
@ -29,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="projectId != null "> and project_id = #{projectId}</if>
|
||||
<if test="points != null "> and points = #{points}</if>
|
||||
<if test="typeName != null "> and type_name = #{typeName}</if>
|
||||
<if test="factoryName != null and factoryName != ''"> and factory_name = #{factoryName}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
@ -48,6 +52,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="typeName != null">type_name,</if>
|
||||
<if test="hzTenantId != null">hz_tenant_id,</if>
|
||||
<if test="hzProjectId != null">hz_project_id,</if>
|
||||
<if test="factoryName != null">factory_name,</if>
|
||||
<if test="companyName != null">company_name,</if>
|
||||
<if test="projectName != null">project_name,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
|
||||
|
@ -58,6 +65,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="typeName != null">#{typeName},</if>
|
||||
<if test="hzTenantId != null">#{hzTenantId},</if>
|
||||
<if test="hzProjectId != null">#{hzProjectId},</if>
|
||||
<if test="factoryName != null">#{factoryName},</if>
|
||||
<if test="companyName != null">#{companyName},</if>
|
||||
<if test="projectName != null">#{projectName},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
Binary file not shown.
|
@ -29,7 +29,9 @@
|
|||
<dependency>
|
||||
<groupId>cc.casually</groupId>
|
||||
<artifactId>html-parse</artifactId>
|
||||
<version>2.1.5</version>
|
||||
<version>2.1.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libs\html-parse-2.1.1.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.ruoyi.weixin.service.IEnvironmentService;
|
|||
import com.ruoyi.weixin.service.ISmzTeamLeaderNameService;
|
||||
import com.ruoyi.weixin.util.GetRequestJsonUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.omg.CORBA.OBJ_ADAPTER;
|
||||
//import org.omg.CORBA.OBJ_ADAPTER;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
|
@ -14,8 +14,8 @@ import com.ruoyi.weixin.mapper.EnvironmentMapper;
|
|||
import com.ruoyi.weixin.service.IEnvironmentService;
|
||||
import com.ruoyi.weixin.util.RequestUtils;
|
||||
import org.jasig.cas.client.util.CommonUtils;
|
||||
import org.omg.CORBA.MARSHAL;
|
||||
import org.omg.CORBA.Request;
|
||||
//import org.omg.CORBA.MARSHAL;
|
||||
//import org.omg.CORBA.Request;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak="></script>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak=5M76qMCiVjSG7bGOTcYmZdg0MQinsKve"></script>
|
||||
<script src="https://cdn.makalu.cc/js/vue/vue.js"></script>
|
||||
<script src="https://cdn.makalu.cc/js/element-ui/index.js"></script>
|
||||
<script src="/js/jquery-3.0.0.min.js"></script>
|
||||
|
|
|
@ -158,7 +158,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak="></script>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak=5M76qMCiVjSG7bGOTcYmZdg0MQinsKve"></script>
|
||||
<script src="https://cdn.makalu.cc/js/vue/vue.js"></script>
|
||||
<script src="https://cdn.makalu.cc/js/element-ui/index.js"></script>
|
||||
<script src="/js/jquery-3.0.0.min.js"></script>
|
||||
|
|
|
@ -555,7 +555,7 @@
|
|||
|
||||
|
||||
</body>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak="></script>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak=5M76qMCiVjSG7bGOTcYmZdg0MQinsKve"></script>
|
||||
<script src="https://cdn.makalu.cc/js/vue/vue.js"></script>
|
||||
<script src="https://cdn.makalu.cc/js/element-ui/index.js"></script>
|
||||
<script src="/js/jquery-3.0.0.min.js"></script>
|
||||
|
|
|
@ -390,7 +390,7 @@
|
|||
|
||||
|
||||
</body>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak="></script>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak=5M76qMCiVjSG7bGOTcYmZdg0MQinsKve"></script>
|
||||
<script src="https://cdn.makalu.cc/js/vue/vue.js"></script>
|
||||
<script src="https://cdn.makalu.cc/js/element-ui/index.js"></script>
|
||||
<script src="/js/echarts.js"></script>
|
||||
|
|
|
@ -328,7 +328,7 @@
|
|||
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak="></script>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak=5M76qMCiVjSG7bGOTcYmZdg0MQinsKve"></script>
|
||||
<script src="https://cdn.makalu.cc/js/vue/vue.js"></script>
|
||||
<script src="https://cdn.makalu.cc/js/element-ui/index.js"></script>
|
||||
<script src="/js/jquery-3.0.0.min.js"></script>
|
||||
|
|
|
@ -823,7 +823,7 @@
|
|||
</div>
|
||||
</body>
|
||||
<script src="https://cdn.makalu.cc/js/moment/2.24.0/moment.min.js"></script>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak="></script>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak=5M76qMCiVjSG7bGOTcYmZdg0MQinsKve"></script>
|
||||
<script src="https://cdn.makalu.cc/js/moment/2.24.0/moment.min.js"></script>
|
||||
<script src="https://cdn.makalu.cc/js/vue/vue.js"></script>
|
||||
<script src="https://cdn.makalu.cc/js/element-ui/index.js"></script>
|
||||
|
|
|
@ -2,15 +2,14 @@ package com.ruoyi.api.controller;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.api.service.ApiService;
|
||||
import com.sun.org.apache.xpath.internal.operations.Mod;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* @ClassName:ApiController
|
||||
|
|
|
@ -6,9 +6,33 @@ spring:
|
|||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/mkl_cas_v1?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://rm-wz91cyo73auob3500o.mysql.rds.aliyuncs.com:3306/mkl_cas_demonstration?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
|
||||
# username: weihu
|
||||
# password: mkl!2021
|
||||
url: jdbc:mysql://10.4.9.233:3306/mkl_cas_v1?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: root
|
||||
password: Makalu2024
|
||||
# url: jdbc:mysql://rm-wz91cyo73auob3500o.mysql.rds.aliyuncs.com:3306/mkl_cas_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
|
||||
# username: weihu
|
||||
# password: mkl!2021
|
||||
# url: jdbc:mysql://192.168.31.130:3306/mkl_cas_v1?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
|
||||
# username: root
|
||||
# password: root
|
||||
# url: jdbc:mysql://rm-wz91cyo73auob3500o.mysql.rds.aliyuncs.com:3306/mkl_aqsc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
|
||||
# username: weihu
|
||||
# password: mkl!2021
|
||||
# url: jdbc:mysql://rm-wz91cyo73auob3500o.mysql.rds.aliyuncs.com:3306/mkl_cas_v1?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
|
||||
# username: weihu
|
||||
# password: mkl!2021
|
||||
# url: jdbc:mysql://127.0.0.1:3306/mkl_aqsc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
|
||||
# username: root
|
||||
# password: root
|
||||
#中铁三局数字三局
|
||||
# url: jdbc:mysql://rm-wz91s59439vhza70ho.mysql.rds.aliyuncs.com/mkl_cas_ztsj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
|
||||
# username: weihu
|
||||
# password: mkl!2021
|
||||
|
||||
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
|
|
@ -11,8 +11,10 @@ ruoyi:
|
|||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
#中铁一局建安公司
|
||||
profile: /mnt/data/typt/uploadPath
|
||||
# 安全生产、数字三局
|
||||
# profile: /mnt/typt/uploadPath
|
||||
# 本地
|
||||
# profile: D://mnt/typt/uploadPath
|
||||
# profile: D://mnt/typt/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: true
|
||||
|
||||
|
@ -142,17 +144,43 @@ swagger:
|
|||
# cas配置
|
||||
cas:
|
||||
client-name: CasClientTYPT
|
||||
# client-name: CasClientTYPTSJ
|
||||
# client-name: aqscClient
|
||||
server:
|
||||
url: http://localhost:8080/cas
|
||||
# url: https://cas-ty.makalu.cc/cas
|
||||
# url: https://cas-sj.makalu.cc/cas
|
||||
url: https://jaszpt-cas.crfeb.com.cn/cas
|
||||
# url: http://localhost:8080/cas
|
||||
project:
|
||||
url: http://127.0.0.1:9004
|
||||
# url: http://typt-t.makalu.cc
|
||||
# url: https://typt-t1.makalu.cc
|
||||
# url: https://szh.makalu.cc
|
||||
# url: https://aqsc.makalu.cc
|
||||
# url: http://127.0.0.1:9004
|
||||
url: https://jaszpt.crfeb.com.cn
|
||||
# url:https://sz-test.makalu.cc/
|
||||
# url: https://ztsj.makalu.cc/
|
||||
# url: https://szsj.makalu.cc/
|
||||
user-center:
|
||||
# url: https://user-center-sj.makalu.cc
|
||||
url: https://jaszpt-usercenter.crfeb.com.cn
|
||||
# url: https://user-center.makalu.cc
|
||||
# url: 127.0.0.1:8099
|
||||
# helmet文件下载路径路径配置
|
||||
helmet:
|
||||
#建安公司数字化集成管控平台
|
||||
#建安公司数字化集成管控平台
|
||||
localFilePath: /mnt/data/aqm/
|
||||
downloadFileHost: http://127.0.0.1:9004/typt/
|
||||
downloadFileHost: https://jaszpt.crfeb.com.cn/typt/
|
||||
downloadWritePath: /mnt/data/typt/
|
||||
templateFilePath: /mnt/data/temporary/
|
||||
|
||||
#一局三公司安全生产 、数字三局
|
||||
# localFilePath: /mnt/aqm/
|
||||
# downloadFileHost: https://filedown.makalu.cc/
|
||||
# downloadWritePath: /mnt/typt/
|
||||
# templateFilePath: /mnt/temporary/
|
||||
|
||||
|
||||
#本地
|
||||
# localFilePath: D:/aqm/
|
||||
# downloadFileHost: D:/mnt/typt/
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="./logs" />
|
||||
<property name="log.path" value="./logs" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-info.log</file>
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
|
@ -33,16 +33,16 @@
|
|||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-error.log</file>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
|
@ -50,16 +50,16 @@
|
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 用户访问日志输出 -->
|
||||
|
||||
<!-- 用户访问日志输出 -->
|
||||
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-user.log</file>
|
||||
<file>${log.path}/sys-user.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 按天回滚 daily -->
|
||||
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
|
@ -70,23 +70,23 @@
|
|||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.ruoyi" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.ruoyi" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
|
||||
<!--系统用户操作日志-->
|
||||
|
||||
<!--系统用户操作日志-->
|
||||
<logger name="sys-user" level="info">
|
||||
<appender-ref ref="sys-user"/>
|
||||
</logger>
|
||||
|
|
Binary file not shown.
|
@ -160,8 +160,10 @@
|
|||
|
||||
<dependency>
|
||||
<groupId>com.aspose</groupId>
|
||||
<artifactId>cells</artifactId>
|
||||
<artifactId>aspose-cells</artifactId>
|
||||
<version>8.5.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libs\aspose-cells-8.5.2.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
Loading…
Reference in New Issue