新增多个异常检测位置
This commit is contained in:
parent
e81b4f46c2
commit
78e746ece1
@ -5,9 +5,14 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="ec76006e-5a88-4766-9722-bc8eda172857" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/commoms/core/src/main/java/com/evotech/hd/core/enums/SwapBatteryStepEnum.java" beforeDir="false" afterPath="$PROJECT_DIR$/commoms/core/src/main/java/com/evotech/hd/core/enums/SwapBatteryStepEnum.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/web-server/src/main/java/com/evotech/hd/webserver/mqtt/MessageTopic.java" beforeDir="false" afterPath="$PROJECT_DIR$/web-server/src/main/java/com/evotech/hd/webserver/mqtt/MessageTopic.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/commoms/core/src/main/resources/application-core.yml" beforeDir="false" afterPath="$PROJECT_DIR$/commoms/core/src/main/resources/application-core.yml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/commoms/mongodb/src/main/resources/application-mongoDev.yml" beforeDir="false" afterPath="$PROJECT_DIR$/commoms/mongodb/src/main/resources/application-mongoDev.yml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/web-server/src/main/java/com/evotech/hd/webserver/controller/TestController.java" beforeDir="false" afterPath="$PROJECT_DIR$/web-server/src/main/java/com/evotech/hd/webserver/controller/TestController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/web-server/src/main/java/com/evotech/hd/webserver/job/service/ExecutionBatterySwapService.java" beforeDir="false" afterPath="$PROJECT_DIR$/web-server/src/main/java/com/evotech/hd/webserver/job/service/ExecutionBatterySwapService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/web-server/src/main/java/com/evotech/hd/webserver/service/impl/BatteryCompartmentServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/web-server/src/main/java/com/evotech/hd/webserver/service/impl/BatteryCompartmentServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/web-server/src/main/java/com/evotech/hd/webserver/utils/ParamUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/web-server/src/main/java/com/evotech/hd/webserver/utils/ParamUtils.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/web-server/src/main/java/com/evotech/hd/webserver/utils/sendCloud/CloudSendInfoUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/web-server/src/main/java/com/evotech/hd/webserver/utils/sendCloud/CloudSendInfoUtils.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/web-server/src/main/resources/application-dev.yml" beforeDir="false" afterPath="$PROJECT_DIR$/web-server/src/main/resources/application-dev.yml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -31,8 +36,7 @@
|
||||
<component name="MavenImportPreferences">
|
||||
<option name="generalSettings">
|
||||
<MavenGeneralSettings>
|
||||
<option name="localRepository" value="D:\andy\apache-maven-3.6.3\repository" />
|
||||
<option name="userSettingsFile" value="D:\andy\apache-maven-3.6.3\conf\settings.xml" />
|
||||
<option name="userSettingsFile" value="E:\andy\apache-maven-3.6.3\conf\settings.xml" />
|
||||
</MavenGeneralSettings>
|
||||
</option>
|
||||
</component>
|
||||
@ -86,8 +90,9 @@
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"Spring Boot.WebServerApplication.executor": "Debug",
|
||||
"git-widget-placeholder": "master",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "D:/andy/ideaWorker/station-control/web-server/src/main/resources/mapper",
|
||||
"last_opened_file_path": "E:/andy/ideaWorker/station-control",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
@ -96,7 +101,7 @@
|
||||
"project.structure.last.edited": "Project",
|
||||
"project.structure.proportion": "0.15",
|
||||
"project.structure.side.proportion": "0.2",
|
||||
"settings.editor.selected.configurable": "fileTemplates",
|
||||
"settings.editor.selected.configurable": "MavenSettings",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}</component>
|
||||
@ -216,9 +221,9 @@
|
||||
<list>
|
||||
<item itemvalue="Application.CloudSendInfoUtils" />
|
||||
<item itemvalue="Application.DataUtils" />
|
||||
<item itemvalue="Application.test111" />
|
||||
<item itemvalue="Application.TestController" />
|
||||
<item itemvalue="Application.XmlRpcHttpDirectCall" />
|
||||
<item itemvalue="Application.test111" />
|
||||
<item itemvalue="Spring Boot.WebServerApplication" />
|
||||
</list>
|
||||
<recent_temporary>
|
||||
@ -380,7 +385,30 @@
|
||||
<workItem from="1768987212149" duration="43024000" />
|
||||
<workItem from="1769503255745" duration="104829000" />
|
||||
<workItem from="1771808159438" duration="2384000" />
|
||||
<workItem from="1771813138867" duration="22007000" />
|
||||
<workItem from="1771813138867" duration="29469000" />
|
||||
<workItem from="1772069861662" duration="592000" />
|
||||
<workItem from="1772074387857" duration="28620000" />
|
||||
<workItem from="1773017896803" duration="2333000" />
|
||||
<workItem from="1773111217952" duration="612000" />
|
||||
<workItem from="1773219373047" duration="6000" />
|
||||
<workItem from="1773476095685" duration="4000" />
|
||||
<workItem from="1773481286873" duration="11510000" />
|
||||
<workItem from="1773816984584" duration="14780000" />
|
||||
<workItem from="1774492006073" duration="11336000" />
|
||||
<workItem from="1776328369112" duration="2210000" />
|
||||
<workItem from="1776475073840" duration="6622000" />
|
||||
<workItem from="1777001049911" duration="2561000" />
|
||||
<workItem from="1777017231989" duration="596000" />
|
||||
<workItem from="1777076946116" duration="150000" />
|
||||
<workItem from="1777250309275" duration="637000" />
|
||||
<workItem from="1778145530415" duration="7000" />
|
||||
<workItem from="1779694307815" duration="46000" />
|
||||
<workItem from="1779694510296" duration="216000" />
|
||||
<workItem from="1780020423057" duration="300000" />
|
||||
<workItem from="1780288599862" duration="312000" />
|
||||
<workItem from="1780302770434" duration="4721000" />
|
||||
<workItem from="1780360636111" duration="2172000" />
|
||||
<workItem from="1780449070480" duration="778000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@ -390,11 +418,24 @@
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<line-breakpoint enabled="true" type="java-method">
|
||||
<url>file://$PROJECT_DIR$/web-server/src/main/java/com/evotech/hd/webserver/controller/TestController.java</url>
|
||||
<line>1480</line>
|
||||
<line>73</line>
|
||||
<properties class="com.evotech.hd.webserver.controller.TestController" method="sendCloud">
|
||||
<option name="EMULATED" value="true" />
|
||||
<option name="WATCH_EXIT" value="false" />
|
||||
</properties>
|
||||
<option name="timeStamp" value="3" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-method">
|
||||
<url>file://$PROJECT_DIR$/web-server/src/main/java/com/evotech/hd/webserver/controller/TestController.java</url>
|
||||
<line>491</line>
|
||||
<properties class="com.evotech.hd.webserver.controller.TestController" method="stop">
|
||||
<option name="EMULATED" value="true" />
|
||||
<option name="WATCH_EXIT" value="false" />
|
||||
</properties>
|
||||
<option name="timeStamp" value="4" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
<watches-manager>
|
||||
|
||||
@ -2,4 +2,4 @@
|
||||
ythd:
|
||||
cloud-private-key: MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALEbx7j2XmAo3NiviJIk8/Mo1RF4yT/MYmZdZRnB9iSh4koIiu/KKCGSwvViFGfmP/q8TNLWsvpTVo3MxWBFJkWaALuo/iPu5RJ+tU1l0YXA35zZNxMuiDbmnI7wODRePUY1g5fa1ZNy5oDUQumfrXhDCoFC2AMUBn9KiMr+QQ97AgMBAAECgYAk/lF8X/Gckkx28ktLg251Nu0yZhFbQxy2lwF8HNiGFE5I+nnS1l4FjTstuBvdC+oHPHerfm8J/IhSvBfqIOd6PulJyuh5s31cdc+2SDWUzh8sBm48YHlDfjltZG2ijgM7h/+uvw1gHwXH8JQGF7ZjWguD3TJfqZ/jPFsuxoLKOQJBAOsp+f7kS5VXg6ziKzCMlWOAEfrsAO5ZhLJNMtoirbMQZYUfYxUc3KFWQMT9i9O2M752NXoeUed8a1DjmfyxaX8CQQDAzPs5EPNfpfuGsvJ79lGsH8mZcw7VdjDzmwNVVLLnSOaJxQIPTusjEJ2YmBs+ifCF30VIDpkRd/DGaj4yNgAFAkEAorh1B+6objoUHviQshNU+3iO+HV9X3AJ5eaNHWuJjbH2zVqekOlbsTehsa1Pp7sXqt7YuhtoySjKiTo0PynzuQJBAJsvovsBANQ5VubJ/NH4py6je3LPIN6Cvs4mNJ2nikUN8bps38aQoEVeJ2ve6vcAsqAe4bYpQd3ErAIZHCzwOD0CQF8hDwEGx1S4nJQpB9rmSQhoNzaEJuJKXgpAxNCQ9g4kLRZE+hpZk1kPw+VjGalyyZkY5ilXkWnqsvrprn+wW7Y=
|
||||
cloud-public-key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCxG8e49l5gKNzYr4iSJPPzKNUReMk/zGJmXWUZwfYkoeJKCIrvyighksL1YhRn5j/6vEzS1rL6U1aNzMVgRSZFmgC7qP4j7uUSfrVNZdGFwN+c2TcTLog25pyO8Dg0Xj1GNYOX2tWTcuaA1ELpn614QwqBQtgDFAZ/SojK/kEPewIDAQAB
|
||||
static-public-key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC32MZ8u1bK66Uj+Uh3eTfDLcGy4TosSLfksYvJBavX6fckS6vdV8VeYj9gQvTrB6b3VKIdsqf/uP4AjgiKlP34GVMfDr0bEPEccurEhs23QWSHGrVSJG5HPG0B1PBbRMMUwUkmQJxo65Ml6SSPyS/4ebdZ0qeY2/cWaK8laYj7sQIDAQAB
|
||||
static-public-key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDdc3YXAeVRGUCDjKLlc62i5tojX42DoIENqvfCX8Z2lFkalfgh0I01Qx+WeaxWxqnovv4gy32RN2bPxjKXNhK2krZ4Or9uXcbkC66rowBACesrYs/MNcFvmVZH7tLVIXTkBkE2XS20FNYeoyc0dCZ3/kgXlfxty6ztIwCmRGQpAQIDAQAB
|
||||
@ -1,6 +1,6 @@
|
||||
yt:
|
||||
base_properties:
|
||||
host: 192.168.5.112
|
||||
host: 192.168.5.232
|
||||
port: 27017
|
||||
#用于账号密码验证的库
|
||||
authentication-database: admin
|
||||
|
||||
@ -206,11 +206,17 @@ public class TestController {
|
||||
Boolean result = false;
|
||||
do{
|
||||
Thread.sleep(ParamUtils.getInstructionIntervalRequestMilliseconds());
|
||||
errorCenCheck(rgvNo, category, 0);
|
||||
if (checkJt(rgvNo, category, 0)) {
|
||||
return;
|
||||
}
|
||||
if(result = InstructionReadUtils.getCenRbDoorOpenStatus()){
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format("%s 开合门已打开", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
}
|
||||
}while (!result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
stopRgv(rgvNo, category, "打开开合门出现异常=="+e.getMessage());
|
||||
throw new RuntimeException("打开开合门出现异常:",e);
|
||||
}
|
||||
}
|
||||
@ -276,33 +282,6 @@ public class TestController {
|
||||
return;
|
||||
}
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format("第[%s]次执行: 执行时间:[%s]; RRG:[%s], 电池仓位[%s]>>>>>存入操作完成", (runNun+1), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()), rgvNo, targetPositionNo))));
|
||||
// InstructionWriteUtils.rgvResetToZero(rgvNo);
|
||||
// openResult = false;
|
||||
// do{
|
||||
// errorCheck(rgvNo, category, runNun);
|
||||
// if(checkJt(rgvNo, category, runNun)){
|
||||
// return;
|
||||
// }
|
||||
// Thread.sleep(ParamUtils.getInstructionIntervalRequestMilliseconds());
|
||||
// //跳开查询
|
||||
// if(openResult = executionBatterySwapService.executionOpenResult(rgvNo)){
|
||||
// WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format("第[%s]次执行: 执行时间:[%s]; RRG:[%s]>>>>>执行归位操作", (runNun+1), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()),rgvNo))));
|
||||
// endResult = false;
|
||||
// do{
|
||||
// errorCheck(rgvNo, category, runNun);
|
||||
// if(checkJt(rgvNo, category, runNun)){
|
||||
// return;
|
||||
// }
|
||||
// Thread.sleep(ParamUtils.getInstructionIntervalRequestMilliseconds());
|
||||
// //执行结束查询
|
||||
// if(endResult = executionBatterySwapService.executionResult(rgvNo)){
|
||||
// //输出
|
||||
// WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format("第[%s]次执行: 执行时间:[%s]; RRG:[%s]>>>>>归位操作完成",(runNun+1), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()), rgvNo))));
|
||||
// errorCheck(rgvNo, category, runNun);
|
||||
// }
|
||||
// }while(!endResult);
|
||||
// }
|
||||
// }while (!openResult);
|
||||
}
|
||||
}while(!endResult);
|
||||
}
|
||||
@ -319,8 +298,12 @@ public class TestController {
|
||||
message = JSONObject.toJSONString(error);
|
||||
}
|
||||
closeRunMap.put(rgvNo, new AtomicBoolean(true));
|
||||
e.printStackTrace();
|
||||
stopRgv(rgvNo, category, "执行取存电池出现异常=="+e.getMessage());
|
||||
throw new RuntimeException(String.format(" 执行时间:[%s]; RRG:[%s] 出现异常; 机构区间为:{%s}; 执行类型为:{%s}; 执行次数为:{%s}; 异常信息为:{%s}",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()), rgvNo, category, "取存", (runNun+1), message), e);
|
||||
} catch (InstructionException ex) {
|
||||
ex.printStackTrace();
|
||||
stopRgv(rgvNo, category, "执行取存电池出现异常=="+ex.getMessage());
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
@ -375,32 +358,6 @@ public class TestController {
|
||||
return;
|
||||
}
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data", String.format("第[%s]次执行: 执行时间:[%s]; RRG:[%s]>>>>>执行装电池操作完成", (runNun+1),new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()), rgvNo))));
|
||||
// InstructionWriteUtils.rgvResetToZero(rgvNo);
|
||||
// openResult = false;
|
||||
// do {
|
||||
// errorCheck(rgvNo, category, runNun);
|
||||
// if(checkJt(rgvNo, category, runNun)){
|
||||
// return;
|
||||
// }
|
||||
// Thread.sleep(ParamUtils.getInstructionIntervalRequestMilliseconds());
|
||||
// //跳开查询
|
||||
// if (openResult = executionBatterySwapService.executionOpenResult(rgvNo)) {
|
||||
// WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data", String.format("第[%s]次执行: 执行时间:[%s]; RRG:[%s]>>>>>执行归位操作", (runNun+1),new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()), rgvNo))));
|
||||
// result = false;
|
||||
// do{
|
||||
// errorCheck(rgvNo, category, runNun);
|
||||
// if(checkJt(rgvNo, category, runNun)){
|
||||
// return;
|
||||
// }
|
||||
// Thread.sleep(ParamUtils.getInstructionIntervalRequestMilliseconds());
|
||||
// if(result = executionBatterySwapService.executionResult(rgvNo)){
|
||||
// //输出
|
||||
// WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format("第[%s]次执行: 执行时间:[%s]; RRG:[%s]>>>>>归位操作完成",(runNun+1), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()), rgvNo))));
|
||||
// errorCheck(rgvNo, category, runNun);
|
||||
// }
|
||||
// }while (!result);
|
||||
// }
|
||||
// }while (!openResult);
|
||||
}
|
||||
}while(!result);
|
||||
}
|
||||
@ -416,9 +373,13 @@ public class TestController {
|
||||
if(Collections.isNotEmpty(error)){
|
||||
message = JSONObject.toJSONString(error);
|
||||
}
|
||||
e.printStackTrace();
|
||||
stopRgv(rgvNo, category, "执行拆装电池操作=="+e.getMessage());
|
||||
closeRunMap.put(rgvNo, new AtomicBoolean(true));
|
||||
throw new RuntimeException(String.format(" 执行时间:[%s]; RRG:[%s] 出现异常; 机构区间为:{%s}; 执行类型为:{%s}; 执行次数为:{%s}; 异常信息为:{%s}",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()), rgvNo, category, "拆装", (runNun+1), message), e);
|
||||
} catch (InstructionException ex) {
|
||||
ex.printStackTrace();
|
||||
stopRgv(rgvNo, category, "执行拆装电池操作=="+ex.getMessage());
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
@ -434,12 +395,18 @@ public class TestController {
|
||||
InstructionWriteUtils.closeCenDoor();
|
||||
Boolean result = false;
|
||||
do{
|
||||
errorCenCheck(rgvNo, category, 0);
|
||||
if (checkJt(rgvNo, category, 0)) {
|
||||
return;
|
||||
}
|
||||
Thread.sleep(ParamUtils.getInstructionIntervalRequestMilliseconds());
|
||||
if(result = InstructionReadUtils.getCenRbDoorCloseStatus()){
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format("%s 开合门已关闭", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
}
|
||||
}while (!result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
stopRgv(rgvNo, category, "关闭开合门出现异常=="+e.getMessage());
|
||||
throw new RuntimeException("关闭开合门出现异常:", e);
|
||||
}
|
||||
}
|
||||
@ -506,6 +473,16 @@ public class TestController {
|
||||
|
||||
}
|
||||
|
||||
public void errorCenCheck(final String rgvNo, final String category, final Integer runNun) throws Exception {
|
||||
Map<String, Object> error = executionBatterySwapService.checkCenErrorInfo();
|
||||
if(Collections.isNotEmpty(error)){
|
||||
String message = JSONObject.toJSONString(error);
|
||||
stopRgv(rgvNo, rgvNo, String.valueOf(error.get("errorMsg")));
|
||||
throw new RuntimeException(String.format("RRG:[%s] 出现异常; 机构区间为:{%s}; 执行类型为:{%s}; 执行次数为:{%s}; 异常信息为:{%s}",rgvNo, category, "取存", (runNun+1), message));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -514,13 +491,14 @@ public class TestController {
|
||||
@ApiLog(value = "结束", type = LogTypeEnum.OPERATION)
|
||||
public Result stop(@PathVariable("category") final String category, @RequestParam("rgvNo") final String rgvNo) throws Exception {
|
||||
//检查RGV是否运作
|
||||
if(executionBatterySwapService.executionResult(rgvNo) && taskRgvMap.containsKey(rgvNo)){
|
||||
//睡了1秒再次检查, 防止空闲冲突
|
||||
Thread.sleep(1000);
|
||||
if(executionBatterySwapService.executionResult(rgvNo)){
|
||||
taskRgvMap.remove(rgvNo);
|
||||
}
|
||||
}else{
|
||||
// if(executionBatterySwapService.executionResult(rgvNo) && taskRgvMap.containsKey(rgvNo)){
|
||||
// //睡了1秒再次检查, 防止空闲冲突
|
||||
// Thread.sleep(1000);
|
||||
// if(executionBatterySwapService.executionResult(rgvNo)){
|
||||
// taskRgvMap.remove(rgvNo);
|
||||
// }
|
||||
// }else{
|
||||
//不管rgv是否运作, 直接停止
|
||||
CompletableFuture<Void> future = taskRgvMap.get(rgvNo);
|
||||
future.cancel(true);
|
||||
closeRunMap.put(rgvNo, new AtomicBoolean(true));
|
||||
@ -617,7 +595,7 @@ public class TestController {
|
||||
taskRgvMap.remove(rgvNo);
|
||||
}
|
||||
});
|
||||
}
|
||||
// }
|
||||
|
||||
return Result.getInstance().success();
|
||||
}
|
||||
@ -733,13 +711,25 @@ public class TestController {
|
||||
InstructionWriteUtils.startCorrectInstitution();
|
||||
Boolean openResult = false;
|
||||
do {
|
||||
errorCenCheck(rgv, category, finalRunNun);
|
||||
if (checkJt(rgv, category, finalRunNun)) {
|
||||
return false;
|
||||
}
|
||||
//检查是否存在异常
|
||||
if (openResult = executionBatterySwapService.checkCenOpenExecutionResult()) {
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format(" 执行时间:[%s]; 对中机构正在执行", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
Boolean result = false;
|
||||
do {
|
||||
errorCenCheck(rgv, category, finalRunNun);
|
||||
if (checkJt(rgv, category, finalRunNun)) {
|
||||
return false;
|
||||
}
|
||||
if(result = executionBatterySwapService.checkCenExecutionResult()){
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format(" 执行时间:[%s]; 对中机构已锁定", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
errorCenCheck(rgv, category, finalRunNun);
|
||||
if (checkJt(rgv, category, finalRunNun)) {
|
||||
return false;
|
||||
}
|
||||
// 推送云端, 并查询是否存在异常 没有异常, 开始启动换电
|
||||
return true;
|
||||
}
|
||||
@ -748,6 +738,8 @@ public class TestController {
|
||||
}
|
||||
}while (!openResult);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
stopRgv(rgv, finalSplitStorageRgv, "启动对中机构出现异常=="+e.getMessage());
|
||||
throw new RuntimeException("启动对中机构出现异常:",e);
|
||||
}
|
||||
return false;
|
||||
@ -764,13 +756,23 @@ public class TestController {
|
||||
InstructionWriteUtils.openCenDoor();
|
||||
Boolean result = false;
|
||||
do{
|
||||
errorCenCheck(rgv, category, finalRunNun);
|
||||
if (checkJt(rgv, category, finalRunNun)) {
|
||||
return false;
|
||||
}
|
||||
Thread.sleep(ParamUtils.getInstructionIntervalRequestMilliseconds());
|
||||
if(result = InstructionReadUtils.getCenRbDoorOpenStatus()){
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format(" 执行时间:[%s]; 开合门已打开", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
errorCenCheck(rgv, category, finalRunNun);
|
||||
if (checkJt(rgv, category, finalRunNun)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}while (!result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
stopRgv(rgv, finalSplitStorageRgv, "打开开合门出现异常=="+e.getMessage());
|
||||
throw new RuntimeException("打开开合门出现异常:",e);
|
||||
}
|
||||
}
|
||||
@ -1048,14 +1050,24 @@ public class TestController {
|
||||
InstructionWriteUtils.closeCenDoor();
|
||||
Boolean result = false;
|
||||
do{
|
||||
errorCenCheck(rgv, category, finalRunNun);
|
||||
if (checkJt(rgv, category, finalRunNun)) {
|
||||
return false;
|
||||
}
|
||||
Thread.sleep(ParamUtils.getInstructionIntervalRequestMilliseconds());
|
||||
if(result = InstructionReadUtils.getCenRbDoorCloseStatus()){
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format("%s 开合门已关闭", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
errorCenCheck(rgv, category, finalRunNun);
|
||||
if (checkJt(rgv, category, finalRunNun)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}while (!result);
|
||||
//开门完成
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
stopRgv(rgv, finalLoadingRgv, "关闭开合门出现异常=="+e.getMessage());
|
||||
throw new RuntimeException("关闭开合门出现异常:", e);
|
||||
}
|
||||
}
|
||||
@ -1073,14 +1085,26 @@ public class TestController {
|
||||
InstructionWriteUtils.closeCorrectInstitution();
|
||||
Boolean openResult = false;
|
||||
do {
|
||||
errorCenCheck(rgv, category, finalRunNun);
|
||||
if (checkJt(rgv, category, finalRunNun)) {
|
||||
return false;
|
||||
}
|
||||
//检查是否存在异常
|
||||
if (openResult = executionBatterySwapService.checkCenOpenExecutionResult()) {
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format(" 执行时间:[%s]; 对中机构正在执行", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
Boolean result = false;
|
||||
do {
|
||||
errorCenCheck(rgv, category, finalRunNun);
|
||||
if (checkJt(rgv, category, finalRunNun)) {
|
||||
return false;
|
||||
}
|
||||
if(result = executionBatterySwapService.checkCenExecutionResult()){
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format(" 执行时间:[%s]; 对中机构已释放", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
// 推送云端, 并查询是否存在异常 没有异常, 开始启动换电
|
||||
errorCenCheck(rgv, category, finalRunNun);
|
||||
if (checkJt(rgv, category, finalRunNun)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}while (!result);
|
||||
@ -1088,6 +1112,8 @@ public class TestController {
|
||||
}
|
||||
}while (!openResult);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
stopRgv(rgv, finalLoadingRgv, e.getMessage());
|
||||
throw new RuntimeException("释放对中机构出现异常:",e);
|
||||
}
|
||||
}
|
||||
@ -1159,13 +1185,14 @@ public class TestController {
|
||||
String rgv = splitStorageRgvNo+"_"+takePackRgvNo;
|
||||
|
||||
//检查RGV是否运作
|
||||
if(executionBatterySwapService.executionResult(splitStorageRgvNo) && executionBatterySwapService.executionResult(takePackRgvNo) && taskRgvMap.containsKey(rgv)){
|
||||
//睡了1秒再次检查, 防止空闲冲突
|
||||
Thread.sleep(1000);
|
||||
if(executionBatterySwapService.executionResult(splitStorageRgvNo) && executionBatterySwapService.executionResult(takePackRgvNo)){
|
||||
taskRgvMap.remove(rgv);
|
||||
}
|
||||
}else{
|
||||
// if(executionBatterySwapService.executionResult(splitStorageRgvNo) && executionBatterySwapService.executionResult(takePackRgvNo) && taskRgvMap.containsKey(rgv)){
|
||||
// //睡了1秒再次检查, 防止空闲冲突
|
||||
// Thread.sleep(1000);
|
||||
// if(executionBatterySwapService.executionResult(splitStorageRgvNo) && executionBatterySwapService.executionResult(takePackRgvNo)){
|
||||
// taskRgvMap.remove(rgv);
|
||||
// }
|
||||
// }else{
|
||||
//无论rgv是否运作, 直接定制
|
||||
CompletableFuture<Void> future = taskRgvMap.get(rgv);
|
||||
if(future == null){
|
||||
return Result.getInstance().success("当前任务已停止");
|
||||
@ -1277,7 +1304,7 @@ public class TestController {
|
||||
taskRgvMap.remove(rgv);
|
||||
}
|
||||
});
|
||||
}
|
||||
// }
|
||||
|
||||
return Result.getInstance().success();
|
||||
}
|
||||
@ -1304,19 +1331,30 @@ public class TestController {
|
||||
return;
|
||||
}
|
||||
//执行开门
|
||||
int finalRunNun = runNun;
|
||||
CompletableFuture<Boolean> openFuture = CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method", "testRgv" + category, "data", String.format(" 执行时间:[%s]; 下发打开开合门命令", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
InstructionWriteUtils.openCenDoor();
|
||||
Boolean result = false;
|
||||
do {
|
||||
errorCheck("door", category, finalRunNun);
|
||||
if(checkJt("door", category, finalRunNun)){
|
||||
return false;
|
||||
}
|
||||
Thread.sleep(ParamUtils.getInstructionIntervalRequestMilliseconds());
|
||||
if (result = InstructionReadUtils.getCenRbDoorOpenStatus()) {
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method", "testRgv" + category, "data", String.format(" 执行时间:[%s]; 开合门已打开", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
errorCheck("door", category, finalRunNun);
|
||||
if(checkJt("door", category, finalRunNun)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} while (!result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
stopRgv("door", category, "打开开合门出现异常=="+e.getMessage());
|
||||
throw new RuntimeException("打开开合门出现异常:", e);
|
||||
}
|
||||
return false;
|
||||
@ -1331,14 +1369,24 @@ public class TestController {
|
||||
InstructionWriteUtils.closeCenDoor();
|
||||
Boolean result = false;
|
||||
do {
|
||||
errorCheck("door", category, finalRunNun);
|
||||
if(checkJt("door", category, finalRunNun)){
|
||||
return false;
|
||||
}
|
||||
Thread.sleep(ParamUtils.getInstructionIntervalRequestMilliseconds());
|
||||
if (result = InstructionReadUtils.getCenRbDoorCloseStatus()) {
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method", "testRgv" + category, "data", String.format("%s 开合门已关闭", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
errorCheck("door", category, finalRunNun);
|
||||
if(checkJt("door", category, finalRunNun)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} while (!result);
|
||||
//开门完成
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
stopRgv("door", category, "关闭开合门出现异常=="+e.getMessage());
|
||||
throw new RuntimeException("关闭开合门出现异常:", e);
|
||||
}
|
||||
return false;
|
||||
@ -1458,13 +1506,25 @@ public class TestController {
|
||||
InstructionWriteUtils.startCorrectInstitution();
|
||||
Boolean openResult = false;
|
||||
do {
|
||||
errorCenCheck(rgv, category, 0);
|
||||
if (checkJt(rgv, category, 0)) {
|
||||
return false;
|
||||
}
|
||||
//检查是否存在异常
|
||||
if (openResult = executionBatterySwapService.checkCenOpenExecutionResult()) {
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format(" 执行时间:[%s]; 对中机构正在执行", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
Boolean result = false;
|
||||
do {
|
||||
errorCenCheck(rgv, category, 0);
|
||||
if (checkJt(rgv, category, 0)) {
|
||||
return false;
|
||||
}
|
||||
if(result = executionBatterySwapService.checkCenExecutionResult()){
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format(" 执行时间:[%s]; 对中机构已锁定", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
errorCenCheck(rgv, category, 0);
|
||||
if (checkJt(rgv, category, 0)) {
|
||||
return false;
|
||||
}
|
||||
// 推送云端, 并查询是否存在异常 没有异常, 开始启动换电
|
||||
return true;
|
||||
}
|
||||
@ -1473,6 +1533,8 @@ public class TestController {
|
||||
}
|
||||
}while (!openResult);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
stopRgv(rgv, category, "启动对中机构出现异常=="+e.getMessage());
|
||||
throw new RuntimeException("启动对中机构出现异常:",e);
|
||||
}
|
||||
return false;
|
||||
@ -1489,13 +1551,23 @@ public class TestController {
|
||||
InstructionWriteUtils.openCenDoor();
|
||||
Boolean result = false;
|
||||
do{
|
||||
errorCenCheck(rgv, category, 0);
|
||||
if (checkJt(rgv, category, 0)) {
|
||||
return false;
|
||||
}
|
||||
Thread.sleep(ParamUtils.getInstructionIntervalRequestMilliseconds());
|
||||
if(result = InstructionReadUtils.getCenRbDoorOpenStatus()){
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format(" 执行时间:[%s]; 开合门已打开", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
errorCenCheck(rgv, category, 0);
|
||||
if (checkJt(rgv, category, 0)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}while (!result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
stopRgv(rgv, category, "打开开合门出现异常=="+e.getMessage());
|
||||
throw new RuntimeException("打开开合门出现异常:",e);
|
||||
}
|
||||
}
|
||||
@ -1723,14 +1795,24 @@ public class TestController {
|
||||
InstructionWriteUtils.closeCenDoor();
|
||||
Boolean result = false;
|
||||
do{
|
||||
errorCenCheck(rgv, category, 0);
|
||||
if (checkJt(rgv, category, 0)) {
|
||||
return false;
|
||||
}
|
||||
Thread.sleep(ParamUtils.getInstructionIntervalRequestMilliseconds());
|
||||
if(result = InstructionReadUtils.getCenRbDoorCloseStatus()){
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format("%s 开合门已关闭", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
errorCenCheck(rgv, category, 0);
|
||||
if (checkJt(rgv, category, 0)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}while (!result);
|
||||
//开门完成
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
stopRgv(rgv, category, "关闭开合门出现异常=="+e.getMessage());
|
||||
throw new RuntimeException("关闭开合门出现异常:", e);
|
||||
}
|
||||
}
|
||||
@ -1748,11 +1830,19 @@ public class TestController {
|
||||
InstructionWriteUtils.closeCorrectInstitution();
|
||||
Boolean openResult = false;
|
||||
do {
|
||||
errorCenCheck(rgv, category, 0);
|
||||
if (checkJt(rgv, category, 0)) {
|
||||
return false;
|
||||
}
|
||||
//检查是否存在异常
|
||||
if (openResult = executionBatterySwapService.checkCenOpenExecutionResult()) {
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format(" 执行时间:[%s]; 对中机构正在执行", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
Boolean result = false;
|
||||
do {
|
||||
errorCenCheck(rgv, category, 0);
|
||||
if (checkJt(rgv, category, 0)) {
|
||||
return false;
|
||||
}
|
||||
if(result = executionBatterySwapService.checkCenExecutionResult()){
|
||||
WebSocketUtils.broadCastMessage(JSONObject.toJSONString(Collections.asMap("method","testRgv"+category,"data",String.format(" 执行时间:[%s]; 对中机构已释放", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())))));
|
||||
// 推送云端, 并查询是否存在异常 没有异常, 开始启动换电
|
||||
@ -1763,6 +1853,8 @@ public class TestController {
|
||||
}
|
||||
}while (!openResult);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
stopRgv(rgv, category, "释放对中机构出现异常=="+e.getMessage());
|
||||
throw new RuntimeException("释放对中机构出现异常:",e);
|
||||
}
|
||||
}
|
||||
@ -1830,21 +1922,22 @@ public class TestController {
|
||||
String rgv = splitStorageRgvNo;
|
||||
|
||||
//检查RGV是否运作
|
||||
if(executionBatterySwapService.executionResult(splitStorageRgvNo) && taskRgvMap.containsKey(rgv)){
|
||||
//睡了1秒再次检查, 防止空闲冲突
|
||||
Thread.sleep(1000);
|
||||
if(executionBatterySwapService.executionResult(splitStorageRgvNo)){
|
||||
CompletableFuture<Void> future = taskRgvMap.get(rgv);
|
||||
if(future == null){
|
||||
return Result.getInstance().success("当前任务已停止");
|
||||
}
|
||||
future.cancel(true);
|
||||
closeRunMap.put(rgv, new AtomicBoolean(true));
|
||||
InstructionWriteUtils.rgvStopMove(splitStorageRgvNo);
|
||||
checkJt(rgv, category, 0);
|
||||
taskRgvMap.remove(rgv);
|
||||
}
|
||||
}else{
|
||||
// if(executionBatterySwapService.executionResult(splitStorageRgvNo) && taskRgvMap.containsKey(rgv)){
|
||||
// //睡了1秒再次检查, 防止空闲冲突
|
||||
// Thread.sleep(1000);
|
||||
// if(executionBatterySwapService.executionResult(splitStorageRgvNo)){
|
||||
// CompletableFuture<Void> future = taskRgvMap.get(rgv);
|
||||
// if(future == null){
|
||||
// return Result.getInstance().success("当前任务已停止");
|
||||
// }
|
||||
// future.cancel(true);
|
||||
// closeRunMap.put(rgv, new AtomicBoolean(true));
|
||||
// InstructionWriteUtils.rgvStopMove(splitStorageRgvNo);
|
||||
// checkJt(rgv, category, 0);
|
||||
// taskRgvMap.remove(rgv);
|
||||
// }
|
||||
// }else{
|
||||
//无论rgv是否运作, 直接停止
|
||||
CompletableFuture<Void> future = taskRgvMap.get(rgv);
|
||||
if(future == null){
|
||||
return Result.getInstance().success("当前任务已停止");
|
||||
@ -1944,7 +2037,7 @@ public class TestController {
|
||||
taskRgvMap.remove(rgv);
|
||||
}
|
||||
});
|
||||
}
|
||||
// }
|
||||
|
||||
return Result.getInstance().success();
|
||||
}
|
||||
|
||||
@ -693,6 +693,11 @@ public class ExecutionBatterySwapService {
|
||||
//如果为0, 则执行结束
|
||||
return Collections.isNotEmpty(executionResult(ParamUtils.getCenErrorCode()));
|
||||
}
|
||||
|
||||
public Map<String, Object> checkCenErrorInfo() throws InstructionException {
|
||||
//如果为0, 则执行结束
|
||||
return executionResult(ParamUtils.getCenErrorCode());
|
||||
}
|
||||
//对中机构异常查询
|
||||
public Boolean checkCenError(SwapBatteryStepEnum swapBatteryStep) throws InstructionException {
|
||||
//如果为0, 则执行结束
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.evotech.hd.webserver.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONException;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -19,12 +20,15 @@ import com.evotech.hd.core.entity.business.OrderCharging;
|
||||
import com.evotech.hd.core.enums.ChargerStatusEnums;
|
||||
import com.evotech.hd.exception.InstructionException;
|
||||
import com.evotech.hd.utils.Collections;
|
||||
import com.evotech.hd.utils.DateUtils;
|
||||
import com.evotech.hd.webserver.mapper.BatteryCompartmentMapper;
|
||||
import com.evotech.hd.webserver.mqtt.MqttPublishUtils;
|
||||
import com.evotech.hd.webserver.service.BatteryCompartmentService;
|
||||
import com.evotech.hd.webserver.service.BatteryService;
|
||||
import com.evotech.hd.webserver.service.BatteryStrategyService;
|
||||
import com.evotech.hd.webserver.service.OrderChargingService;
|
||||
import com.evotech.hd.webserver.utils.AccessStrategyUtil;
|
||||
import com.evotech.hd.webserver.utils.ParamUtils;
|
||||
import com.evotech.hd.webserver.utils.instruction.InstructionReadUtils;
|
||||
import com.evotech.hd.webserver.utils.instruction.InstructionWriteUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@ -56,10 +60,44 @@ public class BatteryCompartmentServiceImpl extends ServiceImpl<BatteryCompartmen
|
||||
|
||||
@Override
|
||||
public Result<Boolean> init(Integer maxNo) {
|
||||
String stationCode = ParamUtils.findStationCode();
|
||||
cn.hutool.json.JSONObject bc = new cn.hutool.json.JSONObject();
|
||||
bc.put("stationCode", stationCode);
|
||||
cn.hutool.json.JSONObject b = new cn.hutool.json.JSONObject();
|
||||
b.put("sourceFrom", 1); //默认来源为站
|
||||
b.put("sourceCode", stationCode); //默认编码为换电站编号
|
||||
b.put("pointType", 1); //默认轨迹点类型为电站
|
||||
b.put("pointCode", stationCode); //默认轨迹点编码为换电站编号
|
||||
for (int i=1; i <= maxNo; i++){
|
||||
try {
|
||||
if(buildCompartmentResult(i)){
|
||||
batteryService.buildBattery(i);
|
||||
BatteryCompartment batteryCompartment = buildCompartment(i);
|
||||
if(ObjectUtils.isNotEmpty(batteryCompartment)){
|
||||
try {
|
||||
//电池仓推送云端
|
||||
bc.put("dccNo", batteryCompartment.getBatteryCompartmentNo());
|
||||
bc.put("status", batteryCompartment.getStatus());
|
||||
MqttPublishUtils.sendState("batteryCompartment",bc);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
log.error("电池仓推送云端出现异常>>>>>>>>>", e.getCause());
|
||||
}
|
||||
//初始化电池
|
||||
Battery battery = batteryService.buildBattery(i);
|
||||
//如果仓存存在电池, 推送电池数据
|
||||
if(battery != null){
|
||||
// b.put("typeCode", ); //电池型号编码
|
||||
// b.put("typeName",); //电池型号名称
|
||||
b.put("batCode", battery.getBatteryCode()); //电池编码
|
||||
// b.put("productionDate",); //生产日期
|
||||
b.put("registrationDate", DateUtils.parseDateToStr("yyyyMMdd",battery.getCreateTime())); //注册时间
|
||||
b.put("status", getStatus(battery.getBatteryMode())); //状态
|
||||
// b.put("pointName",); //轨迹点名称
|
||||
b.put("soc", battery.getSoc()); //当前电量
|
||||
b.put("dccNo", i); //电池仓位号
|
||||
MqttPublishUtils.sendState("battery",b);
|
||||
}
|
||||
|
||||
//电池推送云端
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
@ -71,6 +109,24 @@ public class BatteryCompartmentServiceImpl extends ServiceImpl<BatteryCompartmen
|
||||
return Result.getInstance().build(Boolean.class).success(true);
|
||||
}
|
||||
|
||||
Integer getStatus(String mode){
|
||||
if(StringUtils.isEmpty(mode)){
|
||||
return 5;
|
||||
}
|
||||
switch (mode){
|
||||
case "0":
|
||||
return 3;
|
||||
case "3":
|
||||
case "4":
|
||||
return 2;
|
||||
case "7":
|
||||
case "8":
|
||||
return 4;
|
||||
default:
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<BatteryCompartmentDTO> findPageList(Page<BatteryCompartmentDTO> page, QueryWrapper queryWrapper) {
|
||||
queryWrapper.orderByAsc("a.id");// 根据预约日期和预约时间段倒序排序
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.evotech.hd.webserver.utils;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.evotech.hd.core.dtos.system.ParamsDTO;
|
||||
import com.evotech.hd.webserver.service.BatteryCompartmentService;
|
||||
import com.evotech.hd.webserver.service.ParamsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -377,6 +379,7 @@ public class ParamUtils {
|
||||
return paramService.getParamsDTOByCode(code);
|
||||
}
|
||||
|
||||
|
||||
public static void encryptKeyReq(cn.hutool.json.JSONObject jsonObject){
|
||||
try {
|
||||
String encryptVector = jsonObject.getStr("encryptVector");
|
||||
@ -387,6 +390,9 @@ public class ParamUtils {
|
||||
if(StringUtils.isNotEmpty(encryptKey)){
|
||||
paramService.getOrUpdateParamsDTO("站点AES公钥", ParamsConstant.STATION_AES_PUBLIC_KEY,encryptKey,"软件初始安装时, 直接初始化");
|
||||
}
|
||||
//每次跟换站控编码, 检测是否存在电池仓数据信息, 如果不存在,需要初始化电池仓信息, 并且同步通知到云端
|
||||
//默认100个电池仓
|
||||
SpringUtil.getBean(BatteryCompartmentService.class).init(jsonObject.getInt("dccNum"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("更新站控的AES秘钥出现异常", e.getMessage());
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.evotech.hd.webserver.utils.sendCloud;
|
||||
|
||||
import cn.hutool.crypto.symmetric.SymmetricCrypto;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
@ -9,7 +10,9 @@ import com.evotech.hd.utils.Collections;
|
||||
import com.evotech.hd.webserver.logging.AsyncLogService;
|
||||
import com.evotech.hd.webserver.logging.LogUtils;
|
||||
import com.evotech.hd.webserver.mqtt.MessageTopic;
|
||||
import com.evotech.hd.webserver.mqtt.MessageUtilService;
|
||||
import com.evotech.hd.webserver.mqtt.MqttPublishUtils;
|
||||
import com.evotech.hd.webserver.mqtt.MyMqttMessage;
|
||||
import com.evotech.hd.webserver.service.MessageMqttService;
|
||||
import com.evotech.hd.webserver.utils.ParamUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -44,9 +47,12 @@ public class CloudSendInfoUtils {
|
||||
|
||||
private static MessageMqttService messageMqttService;
|
||||
|
||||
public CloudSendInfoUtils(AsyncLogService asyncLogService, MessageMqttService messageMqttService) {
|
||||
private static MessageUtilService messageUtilService;
|
||||
|
||||
public CloudSendInfoUtils(AsyncLogService asyncLogService, MessageMqttService messageMqttService, MessageUtilService messageUtilService) {
|
||||
this.asyncLogService = asyncLogService;
|
||||
this.messageMqttService = messageMqttService;
|
||||
this.messageUtilService =messageUtilService;
|
||||
}
|
||||
|
||||
|
||||
@ -175,18 +181,11 @@ public class CloudSendInfoUtils {
|
||||
json.put("stationCode", stationCode);
|
||||
json.put("stationName", stationName);
|
||||
json.put("timestamp", timestamp);
|
||||
String sign = null;
|
||||
try {
|
||||
sign = RsaEcbPkcsFullUtil.sign(json.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Map<String, Object> map = Collections.emptyMap();
|
||||
map.put("stationCode", stationCode);
|
||||
map.put("stationName", stationName);
|
||||
map.put("sign", sign);
|
||||
map.put("data", json.toString());
|
||||
SymmetricCrypto aes = messageUtilService.getAes(stationCode);
|
||||
map.put("data", aes.encryptBase64(json.toString()));
|
||||
JSONObject result = doPost(ParamUtils.getCloudRequestUrl(), map, Collections.asMap("Content-Type", "application/json","Accept-Language", "zh-CN"));
|
||||
messageMqttService.update(null,new MessageTopic(json.getString("method"), "HTTP"), "-1", 1, JSONUtil.parseObj(map));
|
||||
asyncLogService.saveLog(LogUtils.getSendCloudLog(functionName, (System.currentTimeMillis()-startTime), json, (result == null ? "" : result.toString()), null));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
spring:
|
||||
redis:
|
||||
host: 192.168.5.112
|
||||
host: 192.168.5.232
|
||||
port: 6379
|
||||
database: 13
|
||||
password: hbyt2025
|
||||
@ -17,7 +17,7 @@ spring:
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
mqtt:
|
||||
broker: tcp://192.168.5.112:1883 # MQTT服务器地址(如Mosquitto默认端口1883)
|
||||
broker: tcp://192.168.5.232:1883 # MQTT服务器地址(如Mosquitto默认端口1883)
|
||||
client-id: springboot-mqtt-${random.value} # 客户端ID(添加随机数确保唯一)
|
||||
username: admin # 可选,MQTT服务器认证用户名
|
||||
password: hbyt12345 # 可选,MQTT服务器认证密码
|
||||
|
||||
Loading…
Reference in New Issue
Block a user