|
@@ -31,6 +31,7 @@ import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.api.ResultCode;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.IoUtil;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
@@ -49,6 +50,7 @@ import org.springblade.resource.vo.NewBladeFile;
|
|
|
import org.springblade.system.entity.Dict;
|
|
|
import org.springblade.system.feign.IDictClient;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.mock.web.MockMultipartFile;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
@@ -80,6 +82,7 @@ import static org.springblade.common.utils.CommonUtil.replaceOssUrl;
|
|
|
@Api(tags = "影音资料接口(客户端)")
|
|
|
public class ImageClassificationFileController extends BladeController {
|
|
|
|
|
|
+ @Autowired
|
|
|
private final IImageClassificationFileService imageClassificationFileService;
|
|
|
|
|
|
private final ImageClassificationShowService imageClassificationShowService;
|
|
@@ -160,7 +163,8 @@ public class ImageClassificationFileController extends BladeController {
|
|
|
List<String> result = new ArrayList<>();
|
|
|
if (excelTab != null) {
|
|
|
//获取数据
|
|
|
- List<ImageClassificationFile> fileResult = this.imageClassificationFileService.list(Wrappers.<ImageClassificationFile>lambdaQuery().in(ImageClassificationFile::getId, Arrays.asList(ids.split(","))));
|
|
|
+ List<String> strings = Arrays.asList(ids.split(","));
|
|
|
+ List<ImageClassificationFile> fileResult = this.imageClassificationFileService.list(Wrappers.<ImageClassificationFile>query().lambda().in(ImageClassificationFile::getId, strings));
|
|
|
|
|
|
try {
|
|
|
if (fileResult != null && fileResult.size() > 0) {
|
|
@@ -609,8 +613,10 @@ public class ImageClassificationFileController extends BladeController {
|
|
|
@ApiOperation(value = "修改影音资料信息", notes = "传入表单数据")
|
|
|
public R<Boolean> update(@Valid @RequestBody ImageClassificationFileVO fileVO) {
|
|
|
ImageClassificationFile newData = this.copyBeanData(fileVO, false);
|
|
|
- newData.setMargePdfUrl("");
|
|
|
- return R.data(this.imageClassificationFileService.updateById(newData));
|
|
|
+ boolean update = this.imageClassificationFileService.updateById(newData);
|
|
|
+ // 生成合并pdfUrl
|
|
|
+ generateMergePdfUrl(update, newData);
|
|
|
+ return R.data(update);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -637,8 +643,12 @@ public class ImageClassificationFileController extends BladeController {
|
|
|
newFile.setClassifyId(fileVO.getClassifyId());
|
|
|
newFile.setContractId(fileVO.getContractId());
|
|
|
newFile.setProjectId(fileVO.getProjectId());
|
|
|
+ // 新增操作
|
|
|
+ boolean save = this.imageClassificationFileService.save(newFile);
|
|
|
+ // 生成合并pdfUrl
|
|
|
+ generateMergePdfUrl(save, newFile);
|
|
|
//落库数据
|
|
|
- return R.status(this.imageClassificationFileService.save(newFile));
|
|
|
+ return R.status(save);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -777,4 +787,30 @@ public class ImageClassificationFileController extends BladeController {
|
|
|
return R.data(this.imageClassificationFileService.getFileTitleName(pKeyId));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 生成合并PdfUrl
|
|
|
+ * 写这个方法是因为声像资料同步那边,一定要有可以预览的东西,
|
|
|
+ * 以前的逻辑是有前端点击查看按钮时,才会根据type等条件调用preview()这个方法
|
|
|
+ */
|
|
|
+ private void generateMergePdfUrl(Boolean flag, ImageClassificationFile newFile){
|
|
|
+ if(true){
|
|
|
+ // 文件类型为图片时
|
|
|
+ if(newFile.getType() == 2){
|
|
|
+ // 生成合并的pdfUrl
|
|
|
+ R<String> preview = preview(newFile.getId().toString());
|
|
|
+ if(preview.getCode() == ResultCode.SUCCESS.getCode()){
|
|
|
+ // 获得合并后的pdfUrl
|
|
|
+ /**后续要多注意preview()这个方法所返回回来的值,现在固定的返回集合中的第一个**/
|
|
|
+ String data = preview.getData();
|
|
|
+ // 获取pdf页码
|
|
|
+ String pdfPage = commonFileClient.getPdfNum(data);
|
|
|
+ // 更新mergePdfUrl
|
|
|
+ this.imageClassificationFileService.update(Wrappers.<ImageClassificationFile>lambdaUpdate()
|
|
|
+ .set(ImageClassificationFile::getMargePdfUrl, preview.getData())
|
|
|
+ .set(ImageClassificationFile::getFilePage, Integer.valueOf(pdfPage))
|
|
|
+ .eq(ImageClassificationFile::getId, newFile.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|