下载文件接口
附件对象存储字段请求类型修改
This commit is contained in:
@@ -98,11 +98,11 @@ public class ContractController implements BusinessControllerMarker {
|
||||
return success(contractService.delete(ids));
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PostMapping("/download")
|
||||
@Operation(summary = "下载文件 TODO")
|
||||
@Operation(summary = "下载文件")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:download')")
|
||||
public void download() {
|
||||
public void download(@RequestBody List<Long> ids) {
|
||||
contractService.download(ids);
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ContractSaveReqVO {
|
||||
|
||||
// 基础信息
|
||||
@Schema(description = "附件对象存储")
|
||||
private String fileObject;
|
||||
private JSONArray fileObject;
|
||||
|
||||
@Schema(description = "其它附件对象存储")
|
||||
private JSONArray fileObjectOther;
|
||||
|
||||
@@ -159,4 +159,11 @@ public interface ContractService {
|
||||
* @return 关联结果
|
||||
*/
|
||||
Boolean relation(RelationReqVo reqVo);
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*
|
||||
* @param ids 合同ID集合
|
||||
*/
|
||||
void download(List<Long> ids);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.zt.plat.module.contractorder.service.contract;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@@ -29,6 +31,8 @@ import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractSaveReqVO;
|
||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpContractDO;
|
||||
import com.zt.plat.module.erp.service.erp.ErpCompanyService;
|
||||
import com.zt.plat.module.erp.service.erp.ErpContractService;
|
||||
import com.zt.plat.module.infra.api.file.FileApi;
|
||||
import com.zt.plat.module.infra.api.file.dto.FileRespDTO;
|
||||
import com.zt.plat.module.system.api.user.AdminUserApi;
|
||||
import com.zt.plat.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -96,6 +100,8 @@ public class ContractServiceImpl implements ContractService {
|
||||
private ErpContractService erpContractService;
|
||||
@Resource
|
||||
private SystemRelativityMapper systemRelativityMapper;
|
||||
@Resource
|
||||
private FileApi fileApi;
|
||||
|
||||
@Override
|
||||
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
|
||||
@@ -1352,6 +1358,24 @@ public class ContractServiceImpl implements ContractService {
|
||||
return insert > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<Long> ids) {
|
||||
try {
|
||||
// 遍历合同ID集合
|
||||
ids.forEach(id -> {
|
||||
|
||||
// 查询合同信息
|
||||
ContractMainDO contractMainDO = contractMainMapper.selectById(id);
|
||||
JSONArray fileObjectOther = new JSONArray(contractMainDO.getFileObjectOther());
|
||||
System.out.println(fileObjectOther);
|
||||
CommonResult<FileRespDTO> fileRespDTOResult = fileApi
|
||||
.getFile(fileObjectOther.getJSONObject(0).getLong("id"));
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验合同内容
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user