|
@@ -26,6 +26,7 @@ import javax.validation.Valid;
|
|
|
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
+import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
@@ -79,7 +80,7 @@ public class AlbumController extends BladeController {
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiOperation(value = "分页", notes = "传入album")
|
|
|
public R<IPage<AlbumVO>> page(Long projectId,Long contractId,Query query) {
|
|
|
- IPage<AlbumVO> pages = albumService.selectPage(projectId,contractId,Condition.getPage(query));
|
|
|
+ IPage<AlbumVO> pages = albumService.selectPage1(projectId,contractId,Condition.getPage(query));
|
|
|
return R.data(pages);
|
|
|
}
|
|
|
|
|
@@ -102,15 +103,29 @@ public class AlbumController extends BladeController {
|
|
|
@ApiOperationSupport(order = 4)
|
|
|
@ApiOperation(value = "新增", notes = "传入album")
|
|
|
public R save(@Valid @RequestBody AlbumDTO albumDTO) {
|
|
|
- String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
- String mergeName = SnowFlakeUtil.getId() + ".pdf", mergeUrl = file_path + "/print//" + mergeName;
|
|
|
- FileUtils.mergePdfPublicMethods(albumDTO.getMargePdfUrls(), mergeUrl);
|
|
|
- BladeFile bladeFile = this.newIOSSClient.uploadFile(mergeName, mergeUrl);
|
|
|
+ if(albumDTO.getMargePdfUrls().isEmpty()){
|
|
|
+ throw new ServiceException("相册不能为空");
|
|
|
+ }
|
|
|
Album album=new Album();
|
|
|
BeanUtil.copy(albumDTO,album);
|
|
|
- if (bladeFile != null && ObjectUtils.isNotEmpty(bladeFile.getLink())) {
|
|
|
- album.setImagesPdf(bladeFile.getLink());
|
|
|
+ String dateValue = albumDTO.getDateValue();
|
|
|
+ String[] strings = dateValue.split("~");
|
|
|
+ album.setStartDate(strings[0]);
|
|
|
+ album.setEndDate(strings[1]);
|
|
|
+ if(albumDTO.getMargePdfUrls().size()>1){
|
|
|
+ String file_path = FileUtils.getSysLocalFileUrl();
|
|
|
+ Long id = SnowFlakeUtil.getId();
|
|
|
+ String mergeName=id+".pdf";
|
|
|
+ String mergeUrl = file_path + "/nodePDF/"+id+".pdf";;
|
|
|
+ FileUtils.mergePdfPublicMethods(albumDTO.getMargePdfUrls(), mergeUrl);
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(mergeName, mergeUrl);
|
|
|
+ if (bladeFile != null && ObjectUtils.isNotEmpty(bladeFile.getLink())) {
|
|
|
+ album.setImagesPdf(bladeFile.getLink());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ album.setImagesPdf(albumDTO.getMargePdfUrls().get(0));
|
|
|
}
|
|
|
+
|
|
|
return R.status(albumService.save(album));
|
|
|
}
|
|
|
|
|
@@ -120,7 +135,13 @@ public class AlbumController extends BladeController {
|
|
|
@PostMapping("/update")
|
|
|
@ApiOperationSupport(order = 5)
|
|
|
@ApiOperation(value = "修改", notes = "传入album")
|
|
|
- public R update(@Valid @RequestBody Album album) {
|
|
|
+ public R update(@Valid @RequestBody AlbumDTO albumDTO) {
|
|
|
+ Album album=new Album();
|
|
|
+ BeanUtil.copy(albumDTO,album);
|
|
|
+ String dateValue = albumDTO.getDateValue();
|
|
|
+ String[] strings = dateValue.split("~");
|
|
|
+ album.setStartDate(strings[0]);
|
|
|
+ album.setEndDate(strings[1]);
|
|
|
return R.status(albumService.updateById(album));
|
|
|
}
|
|
|
|