@@ -57,6 +57,13 @@ public class MhApiClient { | |||
private static final String PURCHASE_NOTICE = "/buy_notice/saveBuyNoticeList"; | |||
private static final String PURCHASE_NOTICE_GET = "/buy_notice/getBuyIdeaList"; | |||
/** | |||
* 信创符合性测评报告相关接口 | |||
*/ | |||
private static final String XCFHX_REPORT_LIST_UTL = "/access/getAccessList"; | |||
private static final String XCFHX_REPORT_DETAIL_UTL = "/access/getInfoById"; | |||
public MhRetDTO<List<MhUnitDTO>> queryUnits() { | |||
String requestUrl = mhApiHost + UNIT_URL; | |||
@@ -141,10 +148,9 @@ public class MhApiClient { | |||
}, false); | |||
if (retObj.isOk()) { | |||
return retObj.getData(); | |||
} else { | |||
log.error("获取字典信息失败:{} {}", dictType, retBody); | |||
throw BizException.wrap("获取字典【%s】失败", dictType.getVal()); | |||
} | |||
log.error("获取字典信息失败:{} {}", dictType, retBody); | |||
throw BizException.wrap("获取字典【%s】失败", dictType.getVal()); | |||
} | |||
public List<MhPurchaseIntentionDTO> listPurchaseNotice(Long unitId) { | |||
@@ -160,10 +166,27 @@ public class MhApiClient { | |||
}, false); | |||
if (retObj.isOk()) { | |||
return retObj.getData(); | |||
} | |||
log.error("获取采购意向失败:{} {}", unitId, retBody); | |||
throw BizException.wrap("获取采购意向失败"); | |||
} | |||
public List<MhXcfhxReportListDTO> pageXcfhxTestReport() { | |||
String retBody; | |||
if (!environmentUtil.isDevEnv()) { | |||
String url = mhApiHost + XCFHX_REPORT_LIST_UTL; | |||
retBody = HttpUtil.get(url); | |||
} else { | |||
log.error("获取采购意向失败:{} {}", unitId, retBody); | |||
throw BizException.wrap("获取采购意向失败"); | |||
retBody = new ClassPathResource("/response/ret-xcfhx-report.json").readUtf8Str(); | |||
} | |||
MhRetDTO<List<MhXcfhxReportListDTO>> retObj = JSONUtil.toBean(retBody, | |||
new TypeReference<MhRetDTO<List<MhXcfhxReportListDTO>>>() { | |||
}, false); | |||
if (retObj.isOk()) { | |||
return retObj.getData(); | |||
} | |||
log.error("获取测评报告失败:{}", retBody); | |||
throw BizException.wrap("获取测评报告失败"); | |||
} | |||
} |
@@ -1,6 +1,11 @@ | |||
package com.hz.pm.api.external; | |||
import cn.hutool.core.io.FileUtil; | |||
import cn.hutool.core.io.IoUtil; | |||
import cn.hutool.core.io.resource.ClassPathResource; | |||
import cn.hutool.core.lang.TypeReference; | |||
import cn.hutool.core.lang.UUID; | |||
import cn.hutool.core.util.RandomUtil; | |||
import cn.hutool.http.HttpRequest; | |||
import cn.hutool.http.HttpResponse; | |||
import cn.hutool.http.HttpUtil; | |||
@@ -16,6 +21,7 @@ import org.springframework.stereotype.Component; | |||
import javax.servlet.ServletOutputStream; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.File; | |||
import java.util.Arrays; | |||
import java.util.Collections; | |||
@@ -65,6 +71,27 @@ public class MhFileClient { | |||
} | |||
} | |||
public File downloadToTmpFile(String fileId) { | |||
String fileUrl = fileDownUrl + "/" + fileId; | |||
try { | |||
List<MhFileInfoDTO> files = listFileInfo(fileId); | |||
MhFileInfoDTO file = files.get(0); | |||
String tmpFilePath = FileUtil.getTmpDirPath() + file.getFileName() + "." + file.getFileSuffix(); | |||
File tmpFile = new File(tmpFilePath); | |||
long size = HttpUtil.downloadFile(fileUrl, tmpFile); | |||
log.info("下载文件:{},大小为:{}", fileId, size); | |||
return tmpFile; | |||
} catch (Exception e) { | |||
log.error("信创平台文件下载异常:{}", fileId, e); | |||
if (isProdEnv()) { | |||
throw BizException.wrap("下载文件失败"); | |||
} | |||
ClassPathResource resource = new ClassPathResource("/response/ret-xcfhx-report-file.pdf"); | |||
File destFile = new File(FileUtil.getTmpDirPath() + RandomUtil.randomString(20) + ".pdf"); | |||
return FileUtil.copy(resource.getFile(), destFile, true); | |||
} | |||
} | |||
public List<MhFileInfoDTO> listFileInfo(String fileIds) { | |||
String url = fileDetailUrl + "?ids=" + fileIds; | |||
try { | |||
@@ -1,7 +1,11 @@ | |||
package com.hz.pm.api.external.controller; | |||
import com.hz.pm.api.external.MhApiClient; | |||
import com.hz.pm.api.external.MhFileClient; | |||
import com.hz.pm.api.external.model.dto.MhDictDTO; | |||
import com.hz.pm.api.external.model.dto.MhFileInfoDTO; | |||
import com.hz.pm.api.external.model.dto.MhXcfhxReportListDTO; | |||
import com.hz.pm.api.external.model.enumeration.MhDictType; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
@@ -13,31 +17,47 @@ import java.util.List; | |||
/** | |||
* <p> | |||
* MhFileController | |||
* MhDictController | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 09:47 2023/12/29 | |||
* @since 10:28 2024/3/26 | |||
*/ | |||
@Api(tags = "信创平台文件管理") | |||
@RestController | |||
@Api(tags = "信产接口") | |||
@RequiredArgsConstructor | |||
@RequestMapping("/api/v1/mh/file") | |||
public class MhFileController { | |||
@RequestMapping("/api/v1/mh") | |||
public class MhApiController { | |||
private final MhApiClient mhApiClient; | |||
private final MhFileClient mhFileClient; | |||
@GetMapping("/download/{fileId}") | |||
@GetMapping("/dict/listByType/{dictType}") | |||
@ApiOperation("根据字典类型获取字典信息") | |||
public List<MhDictDTO> dictListByType(@PathVariable MhDictType dictType) { | |||
return mhApiClient.dictListByType(dictType); | |||
} | |||
@GetMapping("/file/download/{fileId}") | |||
@WebLog("下载信创平台文件") | |||
@ApiOperation("下载信创平台文件") | |||
public void download(@PathVariable String fileId, HttpServletResponse response) { | |||
mhFileClient.download(fileId, response); | |||
} | |||
@GetMapping("/listFileInfo") | |||
@GetMapping("/file/listFileInfo") | |||
@ApiOperation("获取文件详情") | |||
public List<MhFileInfoDTO> listFileInfo(@RequestParam String fileIds) { | |||
return mhFileClient.listFileInfo(fileIds); | |||
} | |||
@GetMapping("/pageXcfhxReport") | |||
@ApiOperation("信创符合性测评报告列表") | |||
public List<MhXcfhxReportListDTO> pageXcfhxReport() { | |||
return mhApiClient.pageXcfhxTestReport(); | |||
} | |||
} | |||
@@ -1,40 +0,0 @@ | |||
package com.hz.pm.api.external.controller; | |||
import com.hz.pm.api.external.MhApiClient; | |||
import com.hz.pm.api.external.model.dto.MhDictDTO; | |||
import com.hz.pm.api.external.model.enumeration.MhDictType; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.PathVariable; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* MhDictController | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 10:28 2024/3/26 | |||
*/ | |||
@RestController | |||
@Api(tags = "信产字典对接接口") | |||
@RequiredArgsConstructor | |||
@RequestMapping("/api/v1/mh/dict") | |||
public class MhDictController { | |||
private final MhApiClient mhApiClient; | |||
@GetMapping("/listByType/{dictType}") | |||
@ApiOperation("根据字典类型获取字典信息") | |||
public List<MhDictDTO> dictListByType(@PathVariable MhDictType dictType) { | |||
return mhApiClient.dictListByType(dictType); | |||
} | |||
} | |||
@@ -0,0 +1,51 @@ | |||
package com.hz.pm.api.external.model.dto; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.util.Date; | |||
/** | |||
* <p> | |||
* MhXcfhxReportListDTO | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 10:16 2024/4/25 | |||
*/ | |||
@Data | |||
public class MhXcfhxReportListDTO { | |||
private String id; | |||
@ApiModelProperty("系统名称") | |||
private String systemName; | |||
@ApiModelProperty("适配中心") | |||
private String adapterCenter; | |||
@ApiModelProperty("送测单位名称") | |||
private String unit; | |||
@ApiModelProperty("送测联系人") | |||
private String contact; | |||
@ApiModelProperty("送测联系电话") | |||
private String phone; | |||
@ApiModelProperty("测评报告附件") | |||
private String file; | |||
@ApiModelProperty("提交时间") | |||
private Date createTime; | |||
@ApiModelProperty("结果:S 不符合、Y 符合、N 基本符合、null 暂无") | |||
private String result; | |||
@ApiModelProperty("完成时间") | |||
private Date finishedTime; | |||
@ApiModelProperty("单位名称") | |||
private String companyName; | |||
} |
@@ -2,6 +2,9 @@ package com.hz.pm.api.projectdeclared.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.io.FileUtil; | |||
import cn.hutool.core.io.IoUtil; | |||
import cn.hutool.json.JSONUtil; | |||
import com.alibaba.excel.EasyExcel; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
@@ -17,6 +20,7 @@ import com.hz.pm.api.common.util.DecimalUtil; | |||
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.model.dto.DeclaredProjectExportDTO; | |||
import com.hz.pm.api.projectdeclared.model.dto.PaymentPlanSupplementDTO; | |||
import com.hz.pm.api.projectdeclared.model.dto.PreInsSaveDTO; | |||
@@ -48,20 +52,30 @@ 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; | |||
import com.ningdatech.file.controller.FileController; | |||
import com.ningdatech.file.entity.vo.result.FileResultVO; | |||
import com.ningdatech.file.service.FileService; | |||
import com.wflow.bean.entity.WflowModels; | |||
import com.wflow.workflow.bean.dto.OrgInfoDTO; | |||
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.springframework.beans.BeanUtils; | |||
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.File; | |||
import java.io.FileInputStream; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
import java.time.format.DateTimeFormatter; | |||
@@ -95,6 +109,8 @@ public class ConstructionManage { | |||
private final IProjectAnnualPaymentPlanService projectPaymentPlanService; | |||
private final TenderStateMachineUtil tenderStateMachineUtil; | |||
private final XcfhxStateMachineUtil xcfhxStateMachineUtil; | |||
private final FileController fileController; | |||
private final MhFileClient mhFileClient; | |||
/** | |||
* 待采购的-项目列表 | |||
@@ -583,7 +599,34 @@ public class ConstructionManage { | |||
purchase.setXcfhxApplyFiles(req.getXcfhxApplyFiles()); | |||
purchase.setMatchXcfhx(req.getMatchXcfhx()); | |||
purchase.setXcfhxApplyRemark(req.getXcfhxApplyRemark()); | |||
purchase.setXcfhxReportFiles(req.getXcfhxReportFiles()); | |||
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)); | |||
} | |||
purchase.setMhXcfhxReportRecordId(req.getMhXcfhxReportRecordId()); | |||
purchase.setMhXcfhxReportFile(req.getMhXcfhxReportFile()); | |||
xcfhxStateMachineUtil.pass(purchase); | |||
purchaseService.updateById(purchase); | |||
@@ -143,6 +143,12 @@ public class Purchase { | |||
@ApiModelProperty("信创符合性申请其他附件") | |||
private String xcfhxApplyFiles; | |||
@ApiModelProperty("信创符合性测评报告文件") | |||
private String mhXcfhxReportFile; | |||
@ApiModelProperty("信创符合性测评记录ID") | |||
private String mhXcfhxReportRecordId; | |||
@ApiModelProperty("信创报告") | |||
private String xcfhxReportFiles; | |||
@@ -3,6 +3,7 @@ package com.hz.pm.api.projectdeclared.model.req; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
@@ -24,6 +25,14 @@ public class XcfhxApplyReq { | |||
@NotNull(message = "标段ID不能为空") | |||
private Long bidId; | |||
@ApiModelProperty("信创符合性测评报告文件") | |||
@NotBlank(message = "信创符合性测评报告文件不能为空") | |||
private String mhXcfhxReportFile; | |||
@ApiModelProperty("信创符合性测评记录ID") | |||
@NotBlank(message = "信创符合性测评记录ID不能为空") | |||
private String mhXcfhxReportRecordId; | |||
@ApiModelProperty("是否符合信创符合性要求") | |||
@NotNull(message = "是否符合信创符合性要求不能为空") | |||
private Boolean matchXcfhx; | |||
@@ -134,6 +134,14 @@ public class PurchaseVO { | |||
@ApiModelProperty("信创报告") | |||
private String xcfhxReportFiles; | |||
@ApiModelProperty("信创符合性测评报告文件") | |||
@NotBlank(message = "信创符合性测评报告文件不能为空") | |||
private String mhXcfhxReportFile; | |||
@ApiModelProperty("信创符合性测评记录ID") | |||
@NotBlank(message = "信创符合性测评记录ID不能为空") | |||
private String mhXcfhxReportRecordId; | |||
@ApiModelProperty("初验材料") | |||
@NotBlank(message = "请提交初验材料") | |||
private String preliminaryInspectionMaterials; | |||