Explorar o código

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

# Conflicts:
#	target/classes/main/resources/mapper/MouldEquipmentMapper.xml
#	target/classes/main/resources/mapper/MouldMapper.xml
%!s(int64=5) %!d(string=hai) anos
pai
achega
cf7617c6c7

+ 6 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldEquipmentServiceImpl.java

@@ -99,7 +99,13 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
         HttpRespMsg msg = new HttpRespMsg();
         //16进制的转化
         String lowPowerLimitStr = Integer.toHexString(mouldEquipment.getLowPowerLimit());
+        if(lowPowerLimitStr.length()==1){
+            lowPowerLimitStr = "0"+lowPowerLimitStr;
+        }
         String hotAlarmLimitStr = Integer.toHexString(mouldEquipment.getHotAlarmLimit());
+        if(hotAlarmLimitStr.length()==1){
+            hotAlarmLimitStr = "0"+hotAlarmLimitStr;
+        }
         String isUseStr = "0"+Integer.toHexString(mouldEquipment.getIsUse());
         //判断是不是超级管理员,是才可操作
         if (user.getParentId() == 0) {

+ 4 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/util/MD5Util.java

@@ -33,6 +33,10 @@ public class MD5Util {
     }
 
     public static void main(String[] args) throws ParseException {
+        String s = Integer.toHexString(1);
+        s = s.length()==1?"0"+s : s;
+        System.out.println(s);
+
         String a = "1.0.1";
         String b = "1.0.2";
         int i = b.compareTo(a);

+ 2 - 2
cloud-model/src/main/resources/mapper/MouldMapper.xml

@@ -90,7 +90,7 @@
         tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbc.company_name companyName,tbco.company_name produceCompany,tbm.pre_update_id,
         tbp.manager mangerName,tbco.company_address area,tbmp.hill_number hillNumber,tbm.oc_cycle oc_cycle,tbp.manager_id managerId,tbmp.equipment_name equipmentName,
         tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times,
-        tbmp.lng,tbmp.lat,tbmp.stage,(SELECT open_time FROM `mould_history_time` WHERE equipment_no=equipmentNo ORDER BY indate DESC LIMIT 1) lastopentime
+        tbmp.lng,tbmp.lat,tbmp.stage,(SELECT open_time FROM `mould_history_time` WHERE equipment_no=equipmentNo ORDER BY open_time DESC LIMIT 1) lastopentime
         ,(SELECT battery  FROM `mould_history` WHERE equipmentNo = equipment_no ORDER BY indate DESC LIMIT 1) hill_number,
         (SELECT temperature  FROM `mould_history` WHERE equipment_no = equipmentNo ORDER BY indate DESC LIMIT 1) temperature
         from
@@ -139,7 +139,7 @@
         tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbc.company_name companyName,tbm.holes,tbm.pre_update_id,tbco.company_name produceCompany,
         tbp.manager mangerName,tbco.company_address area,tbm.oc_cycle oc_cycle,tbm.creator_id creator_id,tbmp.equipment_name equipmentName,
         tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times,
-        tbmp.lng,tbmp.lat,tbmp.stage,(SELECT open_time FROM `mould_history_time` WHERE equipment_no=equipmentNo ORDER BY indate DESC LIMIT 1) lastopentime,
+        tbmp.lng,tbmp.lat,tbmp.stage,(SELECT open_time FROM `mould_history_time` WHERE equipment_no=equipmentNo ORDER BY open_time DESC LIMIT 1) lastopentime,
         (SELECT battery  FROM `mould_history` WHERE equipmentNo = equipment_no ORDER BY indate DESC LIMIT 1) hill_number,
         (SELECT temperature  FROM `mould_history` WHERE equipment_no = equipmentNo ORDER BY indate DESC LIMIT 1) temperature
         from

+ 6 - 3
cloud-socket/src/com/js/kbt/socket/UserHandler.java

@@ -184,17 +184,20 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
 		}
 		// 统计该模盒的平均开合周期
 		MouldHistoryTimeExample exp = new MouldHistoryTimeExample();
-		exp.createCriteria().andEquipmentNoEqualTo(item.getEquipmentNo());
+		exp.createCriteria().andEquipmentNoEqualTo(item.getEquipmentNo()).andTimeCostGreaterThanOrEqualTo(0);
 		List<MouldHistoryTime> list = mouldHistoryTimeMapper.selectByExample(exp);
 		int avgTime = 0;
 		int totalTime = 0;
 		for (MouldHistoryTime t : list) {
-			totalTime += t.getTimeCost();
+				//删选掉负值的数据
+				totalTime += t.getTimeCost();
+			
 		}
 		if (list.size() == 0) {
 			avgTime = 0;
 		} else {
-			avgTime = totalTime / list.size();
+				avgTime = totalTime / list.size();
+			
 		}
 		handleModLogic(item, avgTime);
 		// 判断预留字节的

+ 2 - 2
target/classes/main/resources/mapper/MouldMapper.xml

@@ -90,7 +90,7 @@
         tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbc.company_name companyName,tbco.company_name produceCompany,tbm.pre_update_id,
         tbp.manager mangerName,tbco.company_address area,tbmp.hill_number hillNumber,tbm.oc_cycle oc_cycle,tbp.manager_id managerId,tbmp.equipment_name equipmentName,
         tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times,
-        tbmp.lng,tbmp.lat,tbmp.stage,(SELECT open_time FROM `mould_history_time` WHERE equipment_no=equipmentNo ORDER BY indate DESC LIMIT 1) lastopentime
+        tbmp.lng,tbmp.lat,tbmp.stage,(SELECT open_time FROM `mould_history_time` WHERE equipment_no=equipmentNo ORDER BY open_time DESC LIMIT 1) lastopentime
         ,(SELECT battery  FROM `mould_history` WHERE equipmentNo = equipment_no ORDER BY indate DESC LIMIT 1) hill_number,
         (SELECT temperature  FROM `mould_history` WHERE equipment_no = equipmentNo ORDER BY indate DESC LIMIT 1) temperature
         from
@@ -139,7 +139,7 @@
         tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbc.company_name companyName,tbm.holes,tbm.pre_update_id,tbco.company_name produceCompany,
         tbp.manager mangerName,tbco.company_address area,tbm.oc_cycle oc_cycle,tbm.creator_id creator_id,tbmp.equipment_name equipmentName,
         tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times,
-        tbmp.lng,tbmp.lat,tbmp.stage,(SELECT open_time FROM `mould_history_time` WHERE equipment_no=equipmentNo ORDER BY indate DESC LIMIT 1) lastopentime,
+        tbmp.lng,tbmp.lat,tbmp.stage,(SELECT open_time FROM `mould_history_time` WHERE equipment_no=equipmentNo ORDER BY open_time DESC LIMIT 1) lastopentime,
         (SELECT battery  FROM `mould_history` WHERE equipmentNo = equipment_no ORDER BY indate DESC LIMIT 1) hill_number,
         (SELECT temperature  FROM `mould_history` WHERE equipment_no = equipmentNo ORDER BY indate DESC LIMIT 1) temperature
         from