|
@@ -17,13 +17,16 @@
|
|
|
package org.springblade.manager.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import io.swagger.annotations.*;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
|
+import org.springblade.business.entity.TrialSelfInspectionRecord;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.manager.entity.ExcelTab;
|
|
|
import org.springblade.manager.entity.TableFile;
|
|
|
import org.springblade.manager.entity.WbsTreeContract;
|
|
@@ -39,7 +42,9 @@ import org.springblade.manager.vo.TableFileVO;
|
|
|
import org.springblade.manager.service.ITableFileService;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
+import java.rmi.ServerException;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 表单附件信息 控制器
|
|
@@ -113,22 +118,18 @@ public class TableFileController extends BladeController {
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiOperation(value = "逻辑删除", notes = "传入当前文件ids、tableType、合同段Id、当前自检记录id")
|
|
|
public R removeTrial(@RequestParam String ids, @RequestParam Integer tableType, @RequestParam String contractId, @RequestParam Long id) throws Exception {
|
|
|
- // 查出基本信息
|
|
|
+ //基本信息
|
|
|
TableFile tableFile = tableFileService.getById(ids);
|
|
|
|
|
|
- // 删除数据
|
|
|
- tableFileService.delDataById(ids, id);
|
|
|
-
|
|
|
- String sql = "select *,domain_url as url from m_table_file where is_deleted = 0 and type = 2 and tab_id = " + ids + " and trial_record_id = " + id;
|
|
|
- List<TableFileVO> fileVOList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TableFileVO.class));
|
|
|
-
|
|
|
- //该文本无附件,修改状态
|
|
|
- if (fileVOList.size() <= 0) {
|
|
|
- String updateSql = "update u_trial_self_data_record set is_tab_file_type = 1 where tab_id = " + ids + " and record_id = " + id;
|
|
|
- jdbcTemplate.execute(updateSql);
|
|
|
+ if (ObjectUtil.isEmpty(tableFile)) {
|
|
|
+ throw new ServerException("未获取到对应元素表信息");
|
|
|
}
|
|
|
|
|
|
+ //删除数据
|
|
|
+ tableFileService.delDataById(ids, id);
|
|
|
+
|
|
|
Long pkeyId = Long.parseLong(tableFile.getTabId() + "");
|
|
|
+ //单pdf
|
|
|
excelTabService.getBussPDFTrial(pkeyId, contractId, id);
|
|
|
|
|
|
WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
|
|
@@ -145,7 +146,38 @@ public class TableFileController extends BladeController {
|
|
|
} else if (dataInfo.equals("4") || dataInfo.equals("5") || dataInfo.equals("6")) {
|
|
|
classify = "2";
|
|
|
}
|
|
|
- excelTabService.getBussPDFSTrial(wbsTreePrivate1.getPKeyId() + "", tableType, classify, contractId, wbsTreePrivate.getProjectId(), id, tableFile.getTabId());
|
|
|
+
|
|
|
+ //查询关联表
|
|
|
+ String sqlQuery = "select table_ids from u_trial_self_inspection_record where id = " + id;
|
|
|
+ List<TrialSelfInspectionRecord> query = jdbcTemplate.query(sqlQuery, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class));
|
|
|
+ List<String> collect = query.stream().map(TrialSelfInspectionRecord::getTableIds).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //合并pdf
|
|
|
+ String bussPDFSTrial = excelTabService.getBussPDFSTrial(wbsTreePrivate1.getPKeyId() + "", tableType, classify, contractId, wbsTreePrivate.getProjectId(), id, org.apache.commons.lang.StringUtils.join(collect, ","));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(bussPDFSTrial)) {
|
|
|
+ //修改合并pdf
|
|
|
+ String sql = "update u_trial_self_inspection_record set pdf_url = '" + bussPDFSTrial + "' where id = " + id;
|
|
|
+ jdbcTemplate.execute(sql);
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取当前记录下的文本元素表的附件文件信息
|
|
|
+ List<TableFile> fileList = this.tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>lambdaQuery()
|
|
|
+ .eq(TableFile::getType, 2)
|
|
|
+ .eq(TableFile::getTabId, pkeyId)
|
|
|
+ .eq(TableFile::getTrialRecordId, id)
|
|
|
+ );
|
|
|
+
|
|
|
+ //修改按钮状态
|
|
|
+ String updateSql;
|
|
|
+ if (fileList.size() == 0) {
|
|
|
+ //无附件
|
|
|
+ updateSql = "update u_trial_self_data_record set is_tab_file_type = 1 where tab_id = " + pkeyId + " and record_id = " + id;
|
|
|
+ } else {
|
|
|
+ //有附件
|
|
|
+ updateSql = "update u_trial_self_data_record set is_tab_file_type = 2 where tab_id = " + pkeyId + " and record_id = " + id;
|
|
|
+ }
|
|
|
+ jdbcTemplate.execute(updateSql);
|
|
|
|
|
|
return R.status(true);
|
|
|
}
|