Browse Source

更新清空命令接口以及列表接口和下发报文注释代码

wutt 5 năm trước cách đây
mục cha
commit
eaa6b2c377

+ 33 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldDownPacketController.java

@@ -1,8 +1,14 @@
 package com.hssx.cloudmodel.controller;
 
 
+import com.hssx.cloudmodel.entity.EquipmentSendCommand;
+import com.hssx.cloudmodel.service.EquipmentSendCommandService;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+import com.hssx.cloudmodel.util.PageUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
 /**
@@ -16,6 +22,33 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/mould-down-packet")
 public class MouldDownPacketController {
+    @Autowired
+    private EquipmentSendCommandService equipmentSendCommandService;
+
+    /**
+     * 下发某些指令,如清空指令
+     * 参数:equipmentNo 云模盒的ccid(云模盒编号),uid 当前操作人的id,
+     * state 指令类型(0-清空,1-待定)
+     * @return
+     */
+
+    @RequestMapping("/sendCommand")
+    @ResponseBody
+    public HttpRespMsg sendCommand(EquipmentSendCommand equipmentSendCommand) {
+        return equipmentSendCommandService.sendCommand(equipmentSendCommand);
+    }
+
+    /**
+     * 获取下发命令的列表
+     * token 当前人唯一权限 pageNum 当前页码,pageSize 每页条数
+     * @return
+     */
+
+    @RequestMapping("/sendCommandList")
+    @ResponseBody
+    public HttpRespMsg sendCommandList(EquipmentSendCommand equipmentSendCommand,PageUtil page,String token) {
+        return equipmentSendCommandService.sendCommandList(equipmentSendCommand,page,token);
+    }
 
 }
 

+ 12 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/AppVersion.java

@@ -3,9 +3,12 @@ package com.hssx.cloudmodel.entity;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+import java.util.Date;
 
 /**
  * <p>
@@ -90,4 +93,13 @@ public class AppVersion extends Model<AppVersion> {
         ", url=" + url +
         "}";
     }
+
+    public static void main(String[] args) {
+        Date now = new Date(2020,03,16,10,29,25);
+        System.out.println(now);
+
+        //规则是, 运动状态下,上次接受,超过1.5个小时,不到6个小时的模具设备,状态设置为5-异常,6小时以上的,状态设置为掉线
+        now.setMinutes(now.getMinutes()-150);
+        System.out.println(now);
+    }
 }

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldHistoryServiceImpl.java

@@ -131,7 +131,7 @@ public class MouldHistoryServiceImpl extends ServiceImpl<MouldHistoryMapper, Mou
         InjectionMolding molding = injectionMoldingMapper.selectOne(new QueryWrapper<InjectionMolding>().eq("mould_id", mould.getId()));
         Integer cycle = 0;
         if (molding != null) {
-            cycle = (null == molding.getCycle()) ? 40000 : Integer.parseInt(molding.getCycle());
+            cycle = (null == molding.getCycle()) ? 40000 : Integer.parseInt(molding.getCycle())*1000;
         } else {
             cycle = 40000;
         }

+ 0 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/ProjectServiceImpl.java

@@ -560,7 +560,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     public HttpRespMsg getModelListByUser(UserVO userVO, PageUtil page) {
         HttpRespMsg msg = new HttpRespMsg();
         List<Integer> set = new ArrayList<>();
-        set.add(-1);
         List<MouldVO> moulds = new ArrayList<>();
         if (userVO.getId() != null) {
             //资产方管理员,获取他公司下的所有模具

+ 3 - 3
cloud-model/src/main/java/com/hssx/cloudmodel/util/CodeGenerator.java

@@ -92,11 +92,11 @@ public class CodeGenerator {
 
         // 数据源配置
         DataSourceConfig dsc = new DataSourceConfig();
-        dsc.setUrl("jdbc:mysql://118.190.47.230:3306/cloud_model_test?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8");
+        dsc.setUrl("jdbc:mysql://localhost:3306/cloud_mould?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8");
 //        dsc.setSchemaName("public");
         dsc.setDriverName("com.mysql.cj.jdbc.Driver");
         dsc.setUsername("root");
-        dsc.setPassword("p011430seya1026");
+        dsc.setPassword("102345..");
         mpg.setDataSource(dsc);
 
         // 包配置
@@ -204,7 +204,7 @@ public class CodeGenerator {
         //若想要生成的实体类继承某个Controller,则可打开下面注释。写上需要继承的Controller的位置即可
 //        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
         //此处user是表名,多个英文逗号分割
-        strategy.setInclude("injection_molding");
+        strategy.setInclude("equipment_send_command");
 //        strategy.setExclude();//数据库表全生成
 //        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
         strategy.setControllerMappingHyphenStyle(true);

+ 8 - 8
cloud-model/src/main/resources/application-prod.properties

@@ -1,9 +1,9 @@
 # ####################################################################################################
 # 服务端配置
 #云模端口
-#server.port=9099
-#火石端口
-server.port=8092
+server.port=9099
+##火石端口
+#server.port=8092
 server.servlet.context-path=/
 server.tomcat.uri-encoding=UTF-8
 server.tomcat.max-http-post-size=-1
@@ -19,12 +19,12 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
 # 云模服务器对应的数据库
 #spring.datasource.url=jdbc:mysql://118.190.47.230:3306/cloud_model?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
 # 我们测试的自己服务器数据库
-spring.datasource.url=jdbc:mysql://118.190.47.230:3306/cloud_mould?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
-spring.datasource.username=root
-spring.datasource.password=p011430seya1026
-#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/cloud_mould?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+#spring.datasource.url=jdbc:mysql://118.190.47.230:3306/cloud_mould?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
 #spring.datasource.username=root
-#spring.datasource.password=Hssx2019.!
+#spring.datasource.password=p011430seya1026
+spring.datasource.url=jdbc:mysql://127.0.0.1:3306/cloud_mould?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+spring.datasource.username=root
+spring.datasource.password=Hssx2019.!
 #spring.datasource.druid.test-on-borrow=true
 #spring.datasource.druid.test-while-idle=true
 # ####################################################################################################

+ 28 - 23
cloud-socket/src/com/js/kbt/UserTempGenConfig.xml

@@ -1,24 +1,29 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >
-<generatorConfiguration >
-	<properties resource="jdbc.properties" />
-	<classPathEntry location="${classPath}"/>
-  <context id="context1" targetRuntime="MyBatis3">
-  
-    <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://118.190.47.230:3306/cloud_model"
-     userId="root" password="p011430seya1026" >
-    </jdbcConnection>
-    <javaModelGenerator targetPackage="com.js.kbt.model" targetProject="cloud-socket" />
-    <sqlMapGenerator targetPackage="com.js.kbt.mapper" targetProject="cloud-socket" />
-    <javaClientGenerator targetPackage="com.js.kbt.mapper" targetProject="cloud-socket" type="XMLMAPPER" />
-    <table schema="cloud_model" tableName="time_calibration_record" >
-    	<generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/>
-    </table>
-<!--     <table schema="cloud_model" tableName="tb_mould_equipment" > -->
-<!--     	<generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
-<!--     </table> -->
-<!--     <table schema="cloud_model" tableName="tb_factory" > -->
-<!--     	<generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
-<!--     </table> -->
-  </context>
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >
+<generatorConfiguration >
+	<properties resource="jdbc.properties" />
+	<classPathEntry location="${classPath}"/>
+	<!-- 下面这行相当于以上两行 -->
+	<!-- <classPathEntry location="D:/mysql-connector-java-5.1.31-bin.jar"/> -->
+  <context id="context1" targetRuntime="MyBatis3">
+  
+    <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://118.190.47.230:3306/cloud_model"
+     userId="root" password="p011430seya1026" >
+    </jdbcConnection>
+     <!-- <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/cloud_mould"
+     userId="root" password="102345.." > 
+    </jdbcConnection> -->
+    <javaModelGenerator targetPackage="com.js.kbt.model" targetProject="cloud-socket" />
+    <sqlMapGenerator targetPackage="com.js.kbt.mapper" targetProject="cloud-socket" />
+    <javaClientGenerator targetPackage="com.js.kbt.mapper" targetProject="cloud-socket" type="XMLMAPPER" />
+    <table schema="cloud_mould" tableName="equipment_send_command" >
+    	<generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/>
+    </table>
+<!--     <table schema="cloud_model" tableName="tb_mould_equipment" > -->
+<!--     	<generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
+<!--     </table> -->
+<!--     <table schema="cloud_model" tableName="tb_factory" > -->
+<!--     	<generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/> -->
+<!--     </table> -->
+  </context>
 </generatorConfiguration>

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 207 - 140
cloud-socket/src/com/js/kbt/socket/UserHandler.java


+ 2 - 2
cloud-socket/src/com/js/kbt/task/MyTask.java

@@ -24,8 +24,8 @@ public class MyTask {
 	public void doTask() throws Exception {
 		Date now = new Date();
 		log.info("定时任务:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(now));
-		//规则是, 运动状态下,上次接受,超过1.5个小时,不到6个小时的模具设备,状态设置为5-异常,6小时以上的,状态设置为掉线
-		now.setHours(now.getHours() -1);
+		//规则是, 运动状态下,上次接受,超过2.5个小时,不到6个小时的模具设备,状态设置为5-异常,6小时以上的,状态设置为掉线
+		now.setHours(now.getHours() -2);
 		now.setMinutes(now.getMinutes()-30);
 		TbMouldExample example = new TbMouldExample();
 		example.createCriteria().andStateEqualTo("1").andLastRecTimeLessThanOrEqualTo(now);

+ 4 - 4
cloud-socket/src/jdbc.properties

@@ -1,9 +1,9 @@
-#classPath=D:/model/cloud-socket/WebContent/WEB-INF/lib/mysql-connector-java-5.1.31-bin.jar
-classPath=D:/workspace/yunsu/cloud-socket/WebContent/WEB-INF/lib/mysql-connector-java-5.1.31-bin.jar
+classPath=D:/mysql-connector-java-5.1.31-bin.jar
+#classPath=D:/workspace/yunsu/cloud-socket/WebContent/WEB-INF/lib/mysql-connector-java-5.1.31-bin.jar
 driver=com.mysql.jdbc.Driver
-url=jdbc:mysql://118.190.47.230:3306/cloud_model?autoReconnect=true&rewriteBatchedStatements=TRUE&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8
+url=jdbc:mysql://localhost:3306/cloud_model?autoReconnect=true&rewriteBatchedStatements=TRUE&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8
 username=root
-password=p011430seya1026
+password=102345..
 maxActive=255
 maxIdle=20
 maxWait=100