lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java
@@ -16,6 +16,7 @@
import org.activiti.engine.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.activiti.entity.AssignFileStream;
import org.jeecg.modules.activiti.entity.ToEquipmentTask;
@@ -38,6 +39,9 @@
import org.jeecg.modules.dnc.utils.ValidateUtil;
import org.jeecg.modules.dnc.utils.date.DateUtil;
import org.jeecg.modules.dnc.utils.file.FileUtilS;
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.data.redis.core.StringRedisTemplate;
@@ -92,7 +96,10 @@
    private IDncPassLogService dncPassLogService;
    @Autowired
    private IDeviceCharactersService iDeviceCharactersService;
    @Autowired
    private IMdcEquipmentService iMdcEquipmentService;
    @Autowired
    private IMdcProductionService iMdcProductionService;
    @Autowired
    private StringRedisTemplate redisTemplate;
@@ -135,15 +142,17 @@
     * 设备ID,文件ID
     */
    public String getDeviceSpecialChar(String deviceId, String fileId){
        DeviceInfo deviceInfo = deviceInfoService.getById(deviceId);
        if(deviceInfo == null)
        //替换为mdc设备表
//        DeviceInfo deviceInfo = deviceInfoService.getById(deviceId);
        MdcEquipment mdcEquipment = iMdcEquipmentService.getById(deviceId);
        if(mdcEquipment == null)
            ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE);
//        DocFile docFile = docFileService.getById(fileId);
        DocInfo docInfo = docInfoService.getOne(new QueryWrapper<DocInfo>().eq("publish_file_id",fileId));
        if(docInfo == null)
            ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR);
        List<DeviceCharacters> deviceCharactersList=iDeviceCharactersService.list(
                new LambdaQueryWrapper<DeviceCharacters>().eq(DeviceCharacters::getDeviceNo,deviceInfo.getDeviceNo()));
                new LambdaQueryWrapper<DeviceCharacters>().eq(DeviceCharacters::getDeviceNo,mdcEquipment.getEquipmentId()));
        if (deviceCharactersList.isEmpty()){
            return "";
        }else {
@@ -311,7 +320,7 @@
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        if(!ValidateUtil.validateString(stream.getDeviceId()))
            ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE);
                LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        if(!ValidateUtil.validateString(userId))
            ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST);
@@ -319,8 +328,9 @@
        if(docInfo == null || docInfo.getDocStatus() == 3)
            ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR);
        DeviceInfo deviceInfo = deviceInfoService.getById(stream.getDeviceId());
        if(deviceInfo == null)
        MdcEquipment mdcEquipment = iMdcEquipmentService.getById(stream.getDeviceId());
//        DeviceInfo deviceInfo = deviceInfoService.getById(stream.getDeviceId());
        if(mdcEquipment == null)
            ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE);
        DocFile docFile = docFileService.getById(stream.getFileId());
        if(docFile == null)
@@ -328,10 +338,10 @@
        DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 4, stream.getDeviceId());
        if(deviceDoc != null) {
            // 删除 备份  覆盖 原有的
            List<String> strings =  deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId());
            List<String> strings=iMdcProductionService.findListParentTreeAll(mdcEquipment.getId());
            if (strings != null && !strings.isEmpty()) {
                String path = StringUtils.join(strings.toArray(), "/");
                boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ deviceInfo.getDeviceNo(),
                boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ mdcEquipment.getEquipmentId(),
                        docFile.getFileName(), docFile.getFileSuffix());
            }
        }
@@ -394,16 +404,16 @@
        //TODO
        //插入文件传输任务表
        List<String> strings =  deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId());
        List<String> strings=iMdcProductionService.findListParentTreeAll(mdcEquipment.getId());
        if (strings != null && !strings.isEmpty()) {
            String path = StringUtils.join(strings.toArray(), "/");
            boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ deviceInfo.getDeviceNo(),
            boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ mdcEquipment.getEquipmentId(),
                    docFile.getFileEncodeName(),
                    docFile.getFileName(),docFile.getFileSuffix());
            if (!copyFileNc) {
                ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR);
            } else {
                FileUtilS.deleteZipFromToSend(path + "/"+ deviceInfo.getDeviceNo(),
                FileUtilS.deleteZipFromToSend(path + "/"+ mdcEquipment.getEquipmentId(),
                        docFile.getFileName(),docFile.getFileSuffix());
            }
@@ -462,10 +472,10 @@
            dncPassLogService.save(passInfoNc);
            NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo();
            ncTxt.setEquipmentId(deviceInfo.getDeviceNo());
            ncTxt.setEquipmentId(mdcEquipment.getEquipmentId());
            ncTxt.setFileNcName("02A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequenceNc);
            ncTxt.setFileTxtName("02A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequence);
            ncTxt.setFilePath(path + "/"+ deviceInfo.getDeviceNo() + "/" );
            ncTxt.setFilePath(path + "/"+ mdcEquipment.getEquipmentId() + "/" );
            ncTxt.setOrigFileName(docFile.getFileName());
            ncTxt.setOrigFileSuffix(docFile.getFileSuffix());
            ncTxt.setFileAddOrDelete(1);
@@ -494,7 +504,7 @@
                        localFilePath + "\\" + ncTxt.getFileNcName(),
                        docFile.getFileSuffix());
*/
                boolean copyFileNc = FileUtilS.copyFileUpName(path + "/"+ deviceInfo.getDeviceNo() +"/send/" +
                boolean copyFileNc = FileUtilS.copyFileUpName(path + "/"+ mdcEquipment.getEquipmentId() +"/send/" +
                                docFile.getFileName(),
                        localFilePath  + ncTxt.getFileNcName(),
//                        localFilePath + "\\" + ncTxt.getFileNcName(),
@@ -511,8 +521,8 @@
    }
    @Override
    public List<ActTaskExt> getUndoTaskList() {
                LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    public IPage<ActTaskExt> getUndoTaskList(Integer pageNo,Integer pageSize) {
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        if(!ValidateUtil.validateString(userId))
            return null;
@@ -536,7 +546,10 @@
                ext.setAssignFileStream(streamDetail);
            extList.add(ext);
        });
        return extList;
        //封装Page
        IPage<ActTaskExt> page = new Page<>(pageNo,pageSize);
        page.setRecords(extList);
        return page;
    }
    @Override
@@ -551,7 +564,7 @@
    public boolean approveAssignFile(String taskId, String streamId, AssignFileStream stream) {
        if(!ValidateUtil.validateString(taskId) || !ValidateUtil.validateString(streamId) || stream == null)
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
                LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        if(!ValidateUtil.validateString(userId))
            ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST);
@@ -693,7 +706,7 @@
    }
    @Override
    public QueryPageResponseResult<AssignFileStreamExt> findPageList(int page, int size, AssignFileStreamQueryRequest request) {
    public Result<?> findPageList(int page, int size, AssignFileStreamQueryRequest request) {
        if(page < 1 || size < 1) {
            ExceptionCast.cast(CommonCode.INVALID_PAGE);
        }
@@ -716,7 +729,7 @@
            }
        }
        IPage<AssignFileStreamExt> streamExtIPage = super.getBaseMapper().findByPage(pageData, lambdaQueryWrapper);
        return new QueryPageResponseResult<>(CommonCode.SUCCESS, streamExtIPage);
        return Result.ok(streamExtIPage);
    }
    @Override