|
@@ -2647,6 +2647,84 @@ public class TaskController extends BladeController {
|
|
|
return R.fail("操作失败");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @GetMapping("/rebuildAuditPdf")
|
|
|
+ @ApiOperationSupport(order = 20)
|
|
|
+ @ApiOperation(value = "刷数据接口-重新生成报表审计单", notes = "传入任务id")
|
|
|
+ public R<String> rebuildAuditPdf(Long taskId) {
|
|
|
+ //查询出当前任务
|
|
|
+ Task task = jdbcTemplate.query("SELECT * FROM u_task WHERE id = " + taskId, new BeanPropertyRowMapper<>(Task.class)).stream().findAny().orElse(null);
|
|
|
+ //判断是否需要生成审计意见
|
|
|
+ if (task == null){
|
|
|
+ return R.fail("未查询到任务信息");
|
|
|
+ }
|
|
|
+ //判断是否审批完成
|
|
|
+ if (task.getStatus() != 2){
|
|
|
+ return R.fail("当前任务还未完成");
|
|
|
+ }
|
|
|
+ /** 重新生成审计PDF */
|
|
|
+ //查询出项目审计意见节点的基本信息
|
|
|
+ R r = wbsTreePrivateClient.getProjectOpinionNode(Long.valueOf(task.getProjectId()));
|
|
|
+ if (r.getCode() != 200) {
|
|
|
+ throw new ServiceException(r.getMsg());
|
|
|
+ }
|
|
|
+ WbsTreePrivate aPrivate = (WbsTreePrivate) r.getData();
|
|
|
+ //获取所有的key
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ String os = System.getProperty("os.name").toLowerCase();
|
|
|
+ if (os.contains("win")) {
|
|
|
+ map = FileUtils.getHtmlAllKey("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1808342640173776896.html");
|
|
|
+ } else {
|
|
|
+ map = FileUtils.getHtmlAllKey(aPrivate.getHtmlUrl());
|
|
|
+ }
|
|
|
+ if (map.size() == 0) {
|
|
|
+ throw new ServiceException("未获取到html中的keyName");
|
|
|
+ }
|
|
|
+ //审计流程所有用户id,后面PDF权限校验
|
|
|
+ Map<Long, String> flowIds = new HashMap<>();
|
|
|
+ List<FixedFlowLink> query = jdbcTemplate.query("SELECT a.id,a.fixed_flow_link,a.flow_task_type,a.fixed_flow_link_sort,a.fixed_flow_link_user,a.fixed_flow_link_user_name,a.fixed_flow_link_type,fixed_flow_branch_sort,b.status from u_fixed_flow_link a ,u_task_parallel b where a.fixed_flow_branch_sort= b.sort and a.fixed_flow_link_user=b.task_user and b.process_instance_id=? and fixed_flow_id=? ", new Object[]{task.getProcessInstanceId(),task.getFixedFlowId()}, new BeanPropertyRowMapper<>(FixedFlowLink.class));
|
|
|
+ List<Integer> auditFlow = new ArrayList<>();
|
|
|
+ for (FixedFlowLink link : query) {
|
|
|
+ if (link.getFlowTaskType() == 2) {
|
|
|
+ auditFlow.add(link.getFixedFlowBranchSort());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ flowIds = query.stream().filter(l -> auditFlow.contains(l.getFixedFlowBranchSort())).collect(Collectors.toMap(l -> l.getFixedFlowLinkUser(), l -> l.getFixedFlowLinkUserName()));
|
|
|
+ //实体数据
|
|
|
+ Map<String, Object> dataInfo = getBussDataInfo(aPrivate, task.getId());
|
|
|
+ //todo 目前直接把key写死在代码里面,后面有空再去动态获取key
|
|
|
+ Map<String, Object> tableData = dataInfo;
|
|
|
+ //要求付款额度
|
|
|
+ this.addYuan(map.get("要求付款额度"), tableData);
|
|
|
+ //本期审核进度款
|
|
|
+ this.addYuan(map.get("造价机构现场咨询意见_本期审核进度款(元)"), tableData);
|
|
|
+ //截至上期累计进度款
|
|
|
+ this.addYuan(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)"), tableData);
|
|
|
+ //截至本期累计进度款
|
|
|
+ this.addYuan(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), tableData);
|
|
|
+ if (flowIds.size() == 0) {
|
|
|
+ throw new ServiceException("未找到流程人信息");
|
|
|
+ }
|
|
|
+ if (tableData.get((map.get("意见发出日期:"))) == null)
|
|
|
+ tableData.put(map.get("意见发出日期:"), DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
|
|
|
+ tableData.put(map.get("项目名称:"), projectClient.getById(task.getProjectId()).getProjectName() + contractClient.getContractById(Long.valueOf(task.getContractId())).getContractName());
|
|
|
+ //申请书收到时间
|
|
|
+ if (tableData.get((map.get("申请书收到时间:"))) == null)
|
|
|
+ tableData.put(map.get("申请书收到时间:"), DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
|
|
|
+ //申请进度时间
|
|
|
+// tableData.put(map.get("申请进度款摘录_摘录人_时间"), DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
|
|
|
+ //电签单位日期
|
|
|
+ tableData.put(map.get("建设单位签收_日期"), DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
|
|
|
+ String pdfUrl = "";
|
|
|
+ try {
|
|
|
+ pdfUrl = getEntrustPDFTrial(aPrivate, task.getContractId(), tableData, flowIds);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new ServiceException("生成咨询意见时失败:" + e.getMessage());
|
|
|
+ }
|
|
|
+ return R.data(pdfUrl);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private void saveOpinion(TaskApproveDTO dto) {
|
|
|
MeterApproveOpinion opinion = dto.getMeterApproveOpinion();
|
|
|
//获取最新的意见单
|