public void saveAppDiff(AppDiff entity) { if (StringUtils.isEmpty(entity.getId())) { initEntity(entity); } // save apk if (entity.getDiffAttachment() != null && StringUtils.isNotEmpty(entity.getDiffAttachment().getFileName())) { try { String distPath = "/attachment/content/" + new SimpleDateFormat("yyyy/MM").format(new Date()); File distFile = new File(explodedPath + distPath); if (!distFile.exists()) { FileUtils.forceMkdir(distFile); } entity.setDiff( distPath + "/" + entity.getDiffAttachment().getTempFileName() + "." + FilenameUtils.getExtension(entity.getDiffAttachment().getFileName())); entity.setDiffFilename(entity.getDiffAttachment().getFileName()); FileUtils.copyFile( new File(tempPath + "/" + entity.getDiffAttachment().getTempFileName()), new File(explodedPath + entity.getDiff())); } catch (IOException e) { e.printStackTrace(); } } appDiffDao.save(entity); }
public void deleteAppDiff(String id) { AppDiff appDiff = getAppDiff(id); appDiff.setDeleteFlag(1); appDiffDao.save(appDiff); }