|
@@ -266,8 +266,9 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
|
}
|
|
|
MouldHistoryTimeExample mtExp = new MouldHistoryTimeExample();
|
|
|
mtExp.setOrderByClause("seq");
|
|
|
- mtExp.createCriteria().andHistoryIdIn(historyIds);
|
|
|
+ mtExp.createCriteria().andHistoryIdIn(historyIds).andTimeCostGreaterThan(0);
|
|
|
List<MouldHistoryTime> historyList = mouldHistoryTimeMapper.selectByExample(mtExp);
|
|
|
+
|
|
|
int avgTime = 0;
|
|
|
int totalTime = 0;
|
|
|
// if (historyList.size() == 1) {
|
|
@@ -283,12 +284,11 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
|
// }
|
|
|
// } else {
|
|
|
if (historyList.size() > 1) {
|
|
|
- for (int j = 0; j < historyList.size() - 1; j++) {
|
|
|
- totalTime += (historyList.get(j + 1).getOpenTime().getTime()
|
|
|
- - historyList.get(j).getOpenTime().getTime());
|
|
|
+ for (MouldHistoryTime mouldHistoryTime : historyList) {
|
|
|
+ totalTime += mouldHistoryTime.getTimeCost();
|
|
|
}
|
|
|
logger.info("totalTime" + totalTime);
|
|
|
- avgTime = (int) (totalTime / (historyList.size() - 1));
|
|
|
+ avgTime = (int) (totalTime / historyList.size());
|
|
|
}
|
|
|
// }
|
|
|
logger.info("avgTime-->" + avgTime);
|
|
@@ -350,8 +350,11 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
|
}
|
|
|
if (count > 0) {
|
|
|
TbMouldEquipment me = tbMouldEquipmentMapper.selectByExample(meqExp).get(0);
|
|
|
- me.setIsUse(packet.getIsUse());
|
|
|
- tbMouldEquipmentMapper.updateByPrimaryKeySelective(me);
|
|
|
+ TbMouldEquipment tme = new TbMouldEquipment();
|
|
|
+ tme.setId(me.getId());
|
|
|
+ tme.setIsUse(packet.getIsUse());
|
|
|
+ tbMouldEquipmentMapper.updateByPrimaryKeySelective(tme);
|
|
|
+ logger.info("将启用中的云模盒改为启用成功==>" + me.getEquipmentNo());
|
|
|
}
|
|
|
//下发完删除数据
|
|
|
mouldDownPacketMapper.deleteByPrimaryKey(packet.getId());
|