| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.jeecg.modules.mdc.entity.Equipment; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; |
| | | import org.jeecg.modules.mdc.entity.MdcSystemParameters; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.modules.mdc.entity.*; |
| | | import org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalInfoMapper; |
| | | import org.jeecg.modules.mdc.service.IEquipmentService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentRunningSectionService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalInfoService; |
| | | import org.jeecg.modules.mdc.service.IMdcSystemParametersService; |
| | | import org.jeecg.modules.mdc.service.*; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.system.service.ISysDictService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private IMdcSystemParametersService mdcSystemParametersService; |
| | | |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | |
| | | @Resource |
| | | private IEquipmentStatisticalInfoService equipmentStatisticalInfoService; |
| | | |
| | | /** |
| | | * 计算设备单日运行数据 |
| | |
| | | } |
| | | if (!result.isEmpty()) { |
| | | this.saveBatch(result); |
| | | List<DictModel> dictList = sysDictService.queryDictItemsByCode("data_synchronization_flag"); |
| | | if (dictList != null && !dictList.isEmpty() && "0".equals(dictList.get(0).getValue())) { |
| | | List<EquipmentStatisticalInfo> list = this.dataHandle(result); |
| | | equipmentStatisticalInfoService.saveBatch(list); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public MdcEquipmentStatisticalInfo findMdcEquipmentStatisticalInfo(String equipmentId, String date) { |
| | | return this.baseMapper.findMdcEquipmentStatisticalInfo(equipmentId, date.replaceAll("-", "")); |
| | | } |
| | | |
| | | private List<EquipmentStatisticalInfo> dataHandle(List<MdcEquipmentStatisticalInfo> list) { |
| | | List<EquipmentStatisticalInfo> result = new ArrayList<>(); |
| | | list.forEach(item -> { |
| | | EquipmentStatisticalInfo equipmentStatisticalInfo = new EquipmentStatisticalInfo(); |
| | | equipmentStatisticalInfo.setEquipment(item.getEquipmentId()); |
| | | equipmentStatisticalInfo.setTheDate(item.getTheDate()); |
| | | equipmentStatisticalInfo.setClosedLong(item.getCloseLong()); |
| | | equipmentStatisticalInfo.setOpeningLong(item.getOpenLong()); |
| | | equipmentStatisticalInfo.setErroringLong(item.getErrorLong()); |
| | | equipmentStatisticalInfo.setProcessingLong(item.getProcessLong()); |
| | | equipmentStatisticalInfo.setWaitingLong(item.getWaitLong()); |
| | | result.add(equipmentStatisticalInfo); |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | private List<MdcEquipmentStatisticalInfo> equipmentStatisticalProcess(Equipment equipment, String dateTime) { |
| | | Date initDate = null; |
| | | //取最后的统计数据 |