@@ -137,6 +137,12 @@ public class PurchaseController { | |||
return purchaseManage.addSystem(dto); | |||
} | |||
@GetMapping("/xcfhxReportFiles/{code}") | |||
@ApiOperation("获取信创文件预览") | |||
public String xcfhxReportFiles(@PathVariable String code) { | |||
return purchaseManage.xcfhxReportFiles(code); | |||
} | |||
@GetMapping("/purchaseIntention/{unitId}") | |||
@ApiOperation("获取采购意向") | |||
public List<PurchaseNoticeTenderDTO> listPurchaseIntention(@PathVariable Long unitId) { | |||
@@ -0,0 +1,69 @@ | |||
package com.hz.pm.api.projectdeclared.helper; | |||
import cn.hutool.core.io.FileUtil; | |||
import cn.hutool.json.JSONUtil; | |||
import com.hz.pm.api.common.util.StrUtils; | |||
import com.hz.pm.api.external.MhFileClient; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.model.ApiResponse; | |||
import com.ningdatech.file.controller.FileController; | |||
import com.ningdatech.file.entity.vo.result.FileResultVO; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.io.IOUtils; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.mock.web.MockMultipartFile; | |||
import org.springframework.stereotype.Component; | |||
import java.io.File; | |||
import java.io.FileInputStream; | |||
import java.io.IOException; | |||
/** | |||
* @Classname MhXchxFileHelper | |||
* @Description | |||
* @Date 2024/7/3 10:41 | |||
* @Author PoffyZhang | |||
*/ | |||
@Component | |||
@RequiredArgsConstructor | |||
@Slf4j | |||
public class MhXchxFileHelper { | |||
private final MhFileClient mhFileClient; | |||
private final FileController fileController; | |||
public String getXchxFile(String reportFile,String fileName) { | |||
if (StrUtils.isBlank(reportFile)) { | |||
throw BizException.wrap("信创报告文件不能为空"); | |||
} | |||
ApiResponse<FileResultVO> retFileInfo; | |||
File tmpFile = null; | |||
FileInputStream fis = null; | |||
try { | |||
tmpFile = mhFileClient.downloadToTmpFile(reportFile); | |||
if(StringUtils.isNotBlank(fileName)){ | |||
fileName = fileName + FileUtil.getSuffix(tmpFile); | |||
}else{ | |||
fileName = tmpFile.getName(); | |||
} | |||
fis = new FileInputStream(tmpFile); | |||
String mimeType = FileUtil.getMimeType(tmpFile.getPath()); | |||
MockMultipartFile multipartFile = new MockMultipartFile(fileName, fileName, mimeType, fis); | |||
retFileInfo = fileController.upload(multipartFile, "default"); | |||
} catch (IOException e) { | |||
log.error("信创报告上传失败", e); | |||
throw BizException.wrap("信创符合性测评报告上传失败"); | |||
} finally { | |||
if (tmpFile != null) { | |||
tmpFile.deleteOnExit(); | |||
} | |||
if (fis != null) { | |||
IOUtils.closeQuietly(fis); | |||
} | |||
} | |||
return JSONUtil.toJsonStr(retFileInfo); | |||
} | |||
} |
@@ -21,6 +21,7 @@ import com.hz.pm.api.common.util.ExcelDownUtil; | |||
import com.hz.pm.api.common.util.ExcelExportStyle; | |||
import com.hz.pm.api.common.util.StrUtils; | |||
import com.hz.pm.api.external.MhFileClient; | |||
import com.hz.pm.api.projectdeclared.helper.MhXchxFileHelper; | |||
import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; | |||
import com.hz.pm.api.projectdeclared.model.dto.PaymentPlanSupplementDTO; | |||
import com.hz.pm.api.projectdeclared.model.dto.PreInsSaveDTO; | |||
@@ -112,6 +113,8 @@ public class ConstructionManage { | |||
private final FileController fileController; | |||
private final MhFileClient mhFileClient; | |||
private final MhXchxFileHelper mhXchxFileHelper; | |||
/** | |||
* 待采购的-项目列表 | |||
* | |||
@@ -602,28 +605,8 @@ public class ConstructionManage { | |||
if (Boolean.TRUE.equals(req.getMatchXcfhx())) { | |||
if (StrUtils.isBlank(purchase.getMhXcfhxReportFile()) || | |||
req.getMhXcfhxReportFile().equals(purchase.getMhXcfhxReportFile())) { | |||
ApiResponse<FileResultVO> retFileInfo; | |||
File tmpFile = null; | |||
FileInputStream fis = null; | |||
try { | |||
tmpFile = mhFileClient.downloadToTmpFile(req.getMhXcfhxReportFile()); | |||
String fileName = purchase.getBidName() + "-信创符合性测评报告." + FileUtil.getSuffix(tmpFile); | |||
fis = new FileInputStream(tmpFile); | |||
String mimeType = FileUtil.getMimeType(tmpFile.getPath()); | |||
MockMultipartFile multipartFile = new MockMultipartFile(fileName, fileName, mimeType, fis); | |||
retFileInfo = fileController.upload(multipartFile, "default"); | |||
} catch (IOException e) { | |||
log.error("信创报告上传失败", e); | |||
throw BizException.wrap("信创符合性测评报告上传失败"); | |||
} finally { | |||
if (tmpFile != null) { | |||
tmpFile.deleteOnExit(); | |||
} | |||
if (fis != null) { | |||
IOUtils.closeQuietly(fis); | |||
} | |||
} | |||
purchase.setXcfhxReportFiles(JSONUtil.toJsonStr(retFileInfo)); | |||
String fileName = purchase.getBidName() + "-信创符合性测评报告."; | |||
purchase.setXcfhxReportFiles(mhXchxFileHelper.getXchxFile(req.getMhXcfhxReportFile(),fileName)); | |||
} | |||
purchase.setMhXcfhxReportRecordId(req.getMhXcfhxReportRecordId()); | |||
purchase.setMhXcfhxReportFile(req.getMhXcfhxReportFile()); | |||
@@ -24,16 +24,14 @@ import com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent; | |||
import com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent; | |||
import com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent; | |||
import com.hz.pm.api.common.statemachine.util.*; | |||
import com.hz.pm.api.common.util.BizUtils; | |||
import com.hz.pm.api.common.util.EnvironmentUtil; | |||
import com.hz.pm.api.common.util.ExcelDownUtil; | |||
import com.hz.pm.api.common.util.ExcelExportStyle; | |||
import com.hz.pm.api.common.util.*; | |||
import com.hz.pm.api.datascope.model.DataScopeDTO; | |||
import com.hz.pm.api.datascope.utils.DataScopeUtil; | |||
import com.hz.pm.api.external.MhApiClient; | |||
import com.hz.pm.api.external.MhFileClient; | |||
import com.hz.pm.api.external.model.dto.MhPurchaseIntentionDTO; | |||
import com.hz.pm.api.external.model.dto.MhPurchaseNoticeDTO; | |||
import com.hz.pm.api.projectdeclared.helper.MhXchxFileHelper; | |||
import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; | |||
import com.hz.pm.api.projectdeclared.model.dto.PurchaseSaveDTO; | |||
import com.hz.pm.api.projectdeclared.model.dto.XcfhxApplySaveDTO; | |||
@@ -68,6 +66,7 @@ import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.ApiResponse; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
@@ -80,13 +79,16 @@ import com.wflow.workflow.bean.vo.ProcessStartParamsVo; | |||
import com.wflow.workflow.service.ProcessInstanceService; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.io.IOUtils; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.mock.web.MockMultipartFile; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.io.FileInputStream; | |||
import java.io.IOException; | |||
import java.math.BigDecimal; | |||
import java.math.RoundingMode; | |||
@@ -134,6 +136,8 @@ public class PurchaseManage { | |||
private final IXinchuangService xinchuangService; | |||
private final MhXchxFileHelper mhXchxFileHelper; | |||
private boolean buildPurchaseQueryPermission(LambdaQueryWrapper<Purchase> query, UserFullInfoDTO user) { | |||
boolean queryState = true; | |||
Optional<DataScopeDTO> datascope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); | |||
@@ -818,8 +822,18 @@ public class PurchaseManage { | |||
Xinchuang xinchuang = BeanUtil.copyProperties(dto, Xinchuang.class); | |||
xinchuang.setSourceType(PurchaseSourceTypeEnum.MANUAL_ADDITION.getCode()); | |||
if(xinchuangService.save(xinchuang)){ | |||
if (Boolean.TRUE.equals(dto.getMatchXcfhx())) { | |||
if (StrUtils.isNotBlank(dto.getMhXcfhxReportFile())) { | |||
String fileName = xinchuang.getBidName() + "-信创符合性测评报告."; | |||
xinchuang.setXcfhxReportFiles(mhXchxFileHelper.getXchxFile(dto.getMhXcfhxReportFile(), fileName)); | |||
} | |||
} | |||
return xinchuang.getId(); | |||
} | |||
throw BizException.wrap("新增失败"); | |||
} | |||
public String xcfhxReportFiles(String code) { | |||
return mhXchxFileHelper.getXchxFile(code, null); | |||
} | |||
} |
@@ -1,5 +1,6 @@ | |||
package com.hz.pm.api.projectdeclared.model.dto; | |||
import com.hz.pm.api.projectdeclared.model.enumerization.PurchaseSourceTypeEnum; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.AllArgsConstructor; | |||