| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jeecg.modules.dnc.entity.DeviceInfo; |
| | | import org.jeecg.modules.dnc.entity.DncPassLog; |
| | | import org.jeecg.modules.dnc.entity.DocInfo; |
| | | import org.jeecg.modules.dnc.entity.DocRelative; |
| | | import org.jeecg.modules.dnc.exception.ExceptionCast; |
| | |
| | | |
| | | import org.jeecg.modules.dnc.utils.file.FileUtilS; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Value("${securedoc.localFilePath}") |
| | | private String localFilePath; |
| | | @Autowired |
| | | private IDncPassLogService dncPassLogService; |
| | | private IMdcEquipmentService iMdcEquipmentService; |
| | | @Autowired |
| | | private IMdcProductionService iMdcProductionService; |
| | | |
| | | |
| | | @Override |
| | |
| | | |
| | | if (b && docRel) { |
| | | DocInfo info = docInfoMapper.selectById(docId); |
| | | DeviceInfo deviceInfo = deviceInfoService.getById(attrId); |
| | | List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); |
| | | //todo 修改为mdc设备 |
| | | MdcEquipment mdcEquipment=iMdcEquipmentService.getById(attrId); |
| | | List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); |
| | | if (strings != null && !strings.isEmpty()) { |
| | | String path = StringUtils.join(strings.toArray(), "/"); |
| | | boolean deleteFile = FileUtilS.deleteFilePathZip(path + "/"+ deviceInfo.getDeviceNo(), |
| | | boolean deleteFile = FileUtilS.deleteFilePathZip(path + "/"+ mdcEquipment.getEquipmentId(), |
| | | info.getDocName(), info.getDocSuffix()); |
| | | if (!deleteFile) { |
| | | return false; |
| | | } |
| | | DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY)); |
| | | Integer fileTxt = 0, fileNc =0; |
| | | if (dncPassLog !=null) { |
| | | fileTxt = dncPassLog.getSequenceNumber() + 1; |
| | | fileNc = fileTxt + 1; |
| | | } else { |
| | | fileTxt = 1; |
| | | fileNc = fileTxt + 1; |
| | | } |
| | | String sequence = String.format("%06d",fileTxt); |
| | | DncPassLog passInfoNc = new DncPassLog(); |
| | | passInfoNc.setSequenceNumber(fileNc); |
| | | passInfoNc.setSequenceOrder(sequence); |
| | | passInfoNc.setDayTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY)); |
| | | passInfoNc.setPassType("02"); |
| | | passInfoNc.setPassName(info.getDocName()+"."+info.getDocSuffix()); |
| | | passInfoNc.setCreateTime(DateUtil.getNow()); |
| | | dncPassLogService.save(passInfoNc); |
| | | //处理文件名称 文件路径 |
| | | |
| | | NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo(); |
| | | ncTxt.setEquipmentId(deviceInfo.getDeviceNo()); |
| | | ncTxt.setFilePath(path + "/"+ deviceInfo.getDeviceNo() + "/" ); |
| | | ncTxt.setFileTxtName("02A"+DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY)+sequence); |
| | | ncTxt.setEquipmentId(mdcEquipment.getEquipmentId()); |
| | | ncTxt.setFilePath(path + "/"+ mdcEquipment.getEquipmentId() + "/" ); |
| | | ncTxt.setFileTxtName("02A"+DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY)); |
| | | ncTxt.setOrigFileName(info.getDocName()); |
| | | ncTxt.setOrigFileSuffix(info.getDocSuffix()); |
| | | ncTxt.setFileAddOrDelete(2); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public List<DeviceInfo> findDeviceByDocId(String docId) { |
| | | public List<MdcEquipment> findDeviceByDocId(String docId) { |
| | | if(!ValidateUtil.validateString(docId)) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | return super.getBaseMapper().findDeviceByDocId(docId); |