Commit 03d1c045 by wangweidong

土工平台修改

parent 7ed87be7
...@@ -85,6 +85,14 @@ public class SoilExpReportController extends ServiceController { ...@@ -85,6 +85,14 @@ public class SoilExpReportController extends ServiceController {
@ApiOperation("试验项目报告审核")
@PostMapping("/exp_report_approve")
public RestResult<Boolean> expReportCheckApprove(@RequestParam("ids") Long [] ids) {
return success(soilExpReportService.expReportCheckApprove(ids,getAccount()));
}
@ApiOperation("根据 ids 删除") @ApiOperation("根据 ids 删除")
@ApiImplicitParams({ @ApiImplicitParams({
......
...@@ -28,4 +28,6 @@ public interface ISoilExpReportService extends IBaseService<SoilExpReport> { ...@@ -28,4 +28,6 @@ public interface ISoilExpReportService extends IBaseService<SoilExpReport> {
SoilReport generateReport(Long entrustId, Long templateId, Long[] expReportIds); SoilReport generateReport(Long entrustId, Long templateId, Long[] expReportIds);
boolean expReportCheckSubmit(Long[] ids, Account account); boolean expReportCheckSubmit(Long[] ids, Account account);
boolean expReportCheckApprove(Long[] ids, Account account);
} }
...@@ -449,6 +449,64 @@ public class SoilExpReportServiceImpl extends BaseServiceImpl<SoilExpReportMappe ...@@ -449,6 +449,64 @@ public class SoilExpReportServiceImpl extends BaseServiceImpl<SoilExpReportMappe
} }
@Transactional(rollbackFor = Exception.class)
@Override
public boolean expReportCheckApprove(Long[] ids, Account account) {
RestAssert.fail(ArrayUtils.isEmpty(ids),"请选择要审核通过的试验报告");
SysFileSignature signature =sysUserClient.signature(account.getUserId()).serviceData();
if (null == signature){
return true;
}
List<SoilExpReport> reportList = list(Condition.create().in("id",ids));
try {
List<File> deletedList = new ArrayList<>();
List<SoilExpReport> updateReportList = new ArrayList<>();
for (SoilExpReport soilExpReport:reportList) {
XSSFWorkbook xssfWorkbook = HSSFWorkbookUtil.getWorkbookByIO(ossClient.download(soilExpReport.getObjectKey()));
Map<String,InputStream> inputStreamMap = new HashMap<>();
inputStreamMap.put("#{approve}}",ossClient.download(signature.getObjectKey()));
HSSFWorkbookUtil.insertImageByIO(xssfWorkbook,inputStreamMap,false);
FileOutputStream os = null;
File file = null;
String generated="试验项目报告"+soilExpReport.getId();
file = File.createTempFile(generated, ".xlsx");
os = new FileOutputStream(file);
xssfWorkbook.write(os);
os.flush();
OssFileResult ossFileResult = ossClient.upload(file);
deletedList.add(file);
os.close();
xssfWorkbook.close();
SoilExpReport expReport = new SoilExpReport();
expReport.setId(soilExpReport.getId());
expReport.setObjectKey(ossFileResult.getObjectKey());
expReport.setBucketName(ossFileResult.getBucketName());
expReport.setVersionId(ossFileResult.getVersionId());
expReport.setStatus(2);
expReport.setProgress(2);
updateReportList.add(expReport);
}
if (CollectionUtils.isNotEmpty(updateReportList)){
super.updateBatchById(updateReportList);
}
}catch (Exception e){
logger.error("复核试验报告插入电子签名失败"+e.getMessage());
}
return true;
}
public InputStream exportToExcelInputStream(XSSFWorkbook workbook) { public InputStream exportToExcelInputStream(XSSFWorkbook workbook) {
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment