Browse Source

Merge remote-tracking branch 'origin/dev' into dev

tags/24080901
WendyYang 6 months ago
parent
commit
f081c87fab
6 changed files with 34 additions and 21 deletions
  1. +3
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java
  2. +4
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/helper/MhXchxFileHelper.java
  3. +15
    -16
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java
  4. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/XcfhxApplyEditDTO.java
  5. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/XcfhxApplySaveDTO.java
  6. +6
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/XinchuangVO.java

+ 3
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/PurchaseController.java View File

@@ -23,6 +23,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;


import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.util.List; import java.util.List;


/** /**
@@ -127,7 +128,7 @@ public class PurchaseController {


@GetMapping("/pageXcfhxApply-detail/{id}") @GetMapping("/pageXcfhxApply-detail/{id}")
@ApiOperation("获取信创符合性申请列表") @ApiOperation("获取信创符合性申请列表")
public XinchuangVO pageXcfhxApply(@PathVariable Long id) {
public XinchuangVO detailXcfhxApply(@PathVariable Long id) {
return purchaseManage.detailXcfhxApply(id); return purchaseManage.detailXcfhxApply(id);
} }


@@ -153,7 +154,7 @@ public class PurchaseController {


@GetMapping("/exportXcfhFile/{code}") @GetMapping("/exportXcfhFile/{code}")
@ApiOperation("直接导出信创文件") @ApiOperation("直接导出信创文件")
public void exportXcfhFile(@PathVariable String code,HttpServletResponse response) {
public void exportXcfhFile(@PathVariable String code,HttpServletResponse response) throws UnsupportedEncodingException {
purchaseManage.exportXcfhFile(code,response); purchaseManage.exportXcfhFile(code,response);
} }




+ 4
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/helper/MhXchxFileHelper.java View File

@@ -18,6 +18,7 @@ import org.springframework.stereotype.Component;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.net.URLEncoder;
import java.nio.file.Files; import java.nio.file.Files;


/** /**
@@ -67,15 +68,15 @@ public class MhXchxFileHelper {
return JSONUtil.toJsonStr(retFileInfo); return JSONUtil.toJsonStr(retFileInfo);
} }


public void exportReport(String reportFile, HttpServletResponse response){
public void exportReport(String reportFile, HttpServletResponse response) throws UnsupportedEncodingException {
if (StrUtils.isBlank(reportFile)) { if (StrUtils.isBlank(reportFile)) {
throw BizException.wrap("信创报告文件不能为空"); throw BizException.wrap("信创报告文件不能为空");
} }


File file = mhFileClient.downloadToTmpFile(reportFile); File file = mhFileClient.downloadToTmpFile(reportFile);
// 设置响应的内容类型和头信息 // 设置响应的内容类型和头信息
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=\"" + file.getName() + "\"");
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment;filename=\"" + URLEncoder.encode(file.getName(),"utf-8") + "\"");


// 使用ServletOutputStream写文件内容 // 使用ServletOutputStream写文件内容
try (InputStream in = Files.newInputStream(file.toPath()); try (InputStream in = Files.newInputStream(file.toPath());


+ 15
- 16
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java View File

@@ -80,6 +80,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -724,32 +725,30 @@ public class PurchaseManage {
* @return * @return
*/ */
public Long addSystem(XcfhxApplySaveDTO dto) { public Long addSystem(XcfhxApplySaveDTO dto) {
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());

Xinchuang xinchuang = BeanUtil.copyProperties(dto, Xinchuang.class); Xinchuang xinchuang = BeanUtil.copyProperties(dto, Xinchuang.class);
xinchuang.setSourceType(PurchaseSourceTypeEnum.MANUAL_ADDITION.getCode()); xinchuang.setSourceType(PurchaseSourceTypeEnum.MANUAL_ADDITION.getCode());
xinchuang.setBuildOrgCode(userFullInfo.getMhUnitIdStr());
xinchuang.setBuildOrgName(userFullInfo.getMhUnitName());
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));
}
if (Boolean.TRUE.equals(dto.getMatchXcfhx())) {
if (StrUtils.isNotBlank(dto.getMhXcfhxReportFile())) {
String fileName = xinchuang.getBidName() + "-信创符合性测评报告.";
xinchuang.setXcfhxReportFiles(mhXchxFileHelper.getXchxFile(dto.getMhXcfhxReportFile(), fileName));
} }
}
if(xinchuangService.save(xinchuang)){
return xinchuang.getId(); return xinchuang.getId();
} }
throw BizException.wrap("新增失败"); throw BizException.wrap("新增失败");
} }


public Long updateSystem(XcfhxApplyEditDTO dto) { public Long updateSystem(XcfhxApplyEditDTO dto) {
Xinchuang old = xinchuangService.getById(dto.getId());
VUtils.isTrue(Objects.isNull(old)).throwMessage("数据不存在");
Xinchuang xinchuang = BeanUtil.copyProperties(dto, Xinchuang.class); Xinchuang xinchuang = BeanUtil.copyProperties(dto, Xinchuang.class);
if (Boolean.TRUE.equals(dto.getMatchXcfhx()) && StrUtils.isNotBlank(dto.getMhXcfhxReportFile()) &&
!dto.getMhXcfhxReportFile().equals(old.getMhXcfhxReportFile())) {
String fileName = xinchuang.getBidName() + "-信创符合性测评报告.";
xinchuang.setXcfhxReportFiles(mhXchxFileHelper.getXchxFile(dto.getMhXcfhxReportFile(), fileName));
}
if(xinchuangService.updateById(xinchuang)){ if(xinchuangService.updateById(xinchuang)){
if (Boolean.TRUE.equals(dto.getMatchXcfhx()) && StrUtils.isNotBlank(dto.getMhXcfhxReportFile()) &&
!dto.getMatchXcfhx().equals(xinchuang.getMatchXcfhx())) {
String fileName = xinchuang.getBidName() + "-信创符合性测评报告.";
xinchuang.setXcfhxReportFiles(mhXchxFileHelper.getXchxFile(dto.getMhXcfhxReportFile(), fileName));
}
return xinchuang.getId(); return xinchuang.getId();
} }
throw BizException.wrap("编辑失败"); throw BizException.wrap("编辑失败");
@@ -759,7 +758,7 @@ public class PurchaseManage {
return mhXchxFileHelper.getXchxFile(code, null); return mhXchxFileHelper.getXchxFile(code, null);
} }


public void exportXcfhFile(String code,HttpServletResponse response) {
public void exportXcfhFile(String code,HttpServletResponse response) throws UnsupportedEncodingException {
mhXchxFileHelper.exportReport(code, response); mhXchxFileHelper.exportReport(code, response);
} }
} }

+ 3
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/XcfhxApplyEditDTO.java View File

@@ -50,4 +50,7 @@ public class XcfhxApplyEditDTO {


@ApiModelProperty("资源类型 1手动新增 2系统生成 3大数据局") @ApiModelProperty("资源类型 1手动新增 2系统生成 3大数据局")
private Integer sourceType; private Integer sourceType;

@ApiModelProperty("单位名称")
private String buildOrgName;
} }

+ 3
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/XcfhxApplySaveDTO.java View File

@@ -48,4 +48,7 @@ public class XcfhxApplySaveDTO {


@ApiModelProperty("资源类型 1手动新增 2系统生成 3大数据局") @ApiModelProperty("资源类型 1手动新增 2系统生成 3大数据局")
private Integer sourceType; private Integer sourceType;

@ApiModelProperty("单位名称")
private String buildOrgName;
} }

+ 6
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/XinchuangVO.java View File

@@ -26,6 +26,12 @@ public class XinchuangVO {
@ApiModelProperty("系统名称") @ApiModelProperty("系统名称")
private String bidName; private String bidName;


@ApiModelProperty("单位code")
private String buildOrgCode;

@ApiModelProperty("单位名称")
private String buildOrgName;

@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
private LocalDateTime createOn; private LocalDateTime createOn;


Loading…
Cancel
Save