|
@@ -49,6 +49,7 @@ import org.springblade.manager.vo.ReportResult;
|
|
|
import org.springblade.meter.dto.*;
|
|
|
import org.springblade.meter.entity.*;
|
|
|
import org.springblade.meter.mapper.MiddleMeterApplyMapper;
|
|
|
+import org.springblade.meter.service.IInterimPayCertificateService;
|
|
|
import org.springblade.meter.service.IMaterialStartStatementService;
|
|
|
import org.springblade.meter.service.impl.*;
|
|
|
import org.springblade.meter.utils.CollectionUtils;
|
|
@@ -110,7 +111,7 @@ public class TaskController extends BladeController {
|
|
|
private final ChangeTokenInventoryServiceTaskImpl changeTokenInventoryServiceTask;
|
|
|
|
|
|
private final IMaterialStartStatementService materialStartStatementService;
|
|
|
-
|
|
|
+ private final IInterimPayCertificateService interimPayCertificateService;
|
|
|
// 计量公式入口
|
|
|
private final FormulaClient formulaClient;
|
|
|
|
|
@@ -668,8 +669,7 @@ public class TaskController extends BladeController {
|
|
|
taskParallel.setStatus(1);
|
|
|
taskParallel.setIsDeleted(0);
|
|
|
|
|
|
- sortList.add(maxSort);
|
|
|
- taskParallel.setSort(maxSort);
|
|
|
+ taskParallel.setSort(sort); //sort固定
|
|
|
|
|
|
taskClient.saveTaskParallel(taskParallel);
|
|
|
|
|
@@ -754,15 +754,6 @@ public class TaskController extends BladeController {
|
|
|
List<TaskParallel> taskParallels = jdbcTemplate.query("SELECT * FROM u_task_parallel WHERE process_instance_id = '" + processInstanceId + "' ORDER BY sort", new BeanPropertyRowMapper<>(TaskParallel.class));
|
|
|
List<String> taskParallelsUserIds = taskParallels.stream().map(TaskParallel::getTaskUser).collect(Collectors.toList());
|
|
|
List<String> name = new ArrayList<>();
|
|
|
-
|
|
|
- /*平行签废除,首先排除相同sort,只判断自己的顺序*/
|
|
|
- TaskParallel current = taskParallels.stream().filter(f -> f.getTaskUser().equals(SecureUtil.getUserId().toString())).findAny().orElse(null);
|
|
|
- if (current == null) {
|
|
|
- throw new ServiceException("获取当前用户任务信息失败");
|
|
|
- }
|
|
|
- Integer currentSort = current.getSort();
|
|
|
- taskParallels.removeIf(f -> f.getSort().equals(currentSort) && !f.getTaskUser().equals(SecureUtil.getUserId().toString()));
|
|
|
-
|
|
|
for (TaskParallel parallel : taskParallels) {
|
|
|
if (parallel.getTaskUser().equals(SecureUtil.getUserId().toString())) {
|
|
|
break;
|
|
@@ -2156,25 +2147,46 @@ public class TaskController extends BladeController {
|
|
|
if (isCurrentUserLastApprove) {
|
|
|
//TODO 重新生成报表,执行电签(电签失败直接return或抛出异常,不修改下方状态)
|
|
|
Long reportId = 0L;
|
|
|
- MaterialStartStatement materialS = materialStartStatementService.getBaseMapper().selectOne(Wrappers.<MaterialStartStatement>lambdaQuery().eq(MaterialStartStatement::getContractId, task.getContractId()).eq(MaterialStartStatement::getMeterPeriodId, task.getFormDataId()).eq(MaterialStartStatement::getType, 1));
|
|
|
- if (materialS == null || Func.isNull(materialS)) {
|
|
|
- MeterPeriod me = periodService.getById(task.getFormDataId());
|
|
|
- MaterialStartStatement data = new MaterialStartStatement();
|
|
|
- data.setMeterPeriodId(Func.toLong(task.getFormDataId()));
|
|
|
- data.setContractId(Func.toLong(task.getContractId()));
|
|
|
- data.setMeterPeriodId(Func.toLong(task.getFormDataId()));
|
|
|
- data.setPrintDate(me.getFormPrintDate());
|
|
|
- data.setRepaymentCause("材料预付款");
|
|
|
- data.setStatementName("材料预付款--" + me.getPeriodName());
|
|
|
-
|
|
|
- //计量任务类型 1=中间计量申请,2=材料计量单,3=开工预付款计量单,4=变更令
|
|
|
- if (task.getMeterTaskType() == 2) {
|
|
|
- data.setType(1);
|
|
|
+ if(task.getMeterTaskType()==3 || task.getMeterTaskType()==2){ //2材料,3开工
|
|
|
+ MaterialStartStatement materialS = materialStartStatementService.getBaseMapper().selectOne(Wrappers.<MaterialStartStatement>lambdaQuery().eq(MaterialStartStatement::getContractId, task.getContractId()).eq(MaterialStartStatement::getMeterPeriodId, task.getFormDataId()).eq(MaterialStartStatement::getType, task.getMeterTaskType()-1));
|
|
|
+ if (materialS == null || Func.isNull(materialS)) {
|
|
|
+ MeterPeriod me = periodService.getById(task.getFormDataId());
|
|
|
+ MaterialStartStatement data = new MaterialStartStatement();
|
|
|
+ data.setMeterPeriodId(Func.toLong(task.getFormDataId()));
|
|
|
+ data.setContractId(Func.toLong(task.getContractId()));
|
|
|
+ data.setMeterPeriodId(Func.toLong(task.getFormDataId()));
|
|
|
+ data.setPrintDate(me.getFormPrintDate());
|
|
|
+ if(task.getMeterTaskType()==2){
|
|
|
+ data.setRepaymentCause("材料预付款");
|
|
|
+ data.setStatementName("材料预付款--" + me.getPeriodName());
|
|
|
+ data.setType(1);
|
|
|
+ }
|
|
|
+ //计量任务类型 1=中间计量申请,2=材料计量单,3=开工预付款计量单,4=变更令
|
|
|
+ if(task.getMeterTaskType()==3){
|
|
|
+ data.setRepaymentCause("开工预付款");
|
|
|
+ data.setStatementName("开工预付款--" + me.getPeriodName());
|
|
|
+ data.setType(2);
|
|
|
+ }
|
|
|
+ materialStartStatementService.saveOrUpdate(data);
|
|
|
+ reportId = data.getId();
|
|
|
+ } else {
|
|
|
+ reportId = materialS.getId();
|
|
|
}
|
|
|
- materialStartStatementService.addOrUpdate(data);
|
|
|
- reportId = data.getId();
|
|
|
- } else {
|
|
|
- reportId = materialS.getId();
|
|
|
+ } else if ( task.getMeterTaskType()==1) { // 1中间
|
|
|
+ InterimPayCertificate inData = interimPayCertificateService.getBaseMapper().selectOne(Wrappers.<InterimPayCertificate>lambdaQuery().eq(InterimPayCertificate::getContractId,task.getContractId()).eq(InterimPayCertificate::getContractPeriodId ,task.getFormDataId()));
|
|
|
+ if (inData == null || Func.isNull(inData)) {
|
|
|
+ InterimPayCertificate inData2 = new InterimPayCertificate();
|
|
|
+ ContractMeterPeriod me = contractMeterPeriodService.getById(task.getFormDataId());
|
|
|
+ inData2.setProjectId(me.getProjectId());
|
|
|
+ inData2.setContractId(me.getContractId());
|
|
|
+ inData2.setContractPeriodId(Func.toLong(task.getFormDataId()));
|
|
|
+ inData2.setCertificateNumber(task.getFormDataId());
|
|
|
+ inData2.setPeriodNumber(me.getPeriodNumber());
|
|
|
+ inData2.setPrintDate(me.getFormPrintDate());
|
|
|
+ interimPayCertificateService.save(inData2);
|
|
|
+ reportId = inData2.getId();
|
|
|
+ }
|
|
|
+ reportId = inData.getId();
|
|
|
}
|
|
|
/**计量公式执行 0中间,1材料,2开工*/
|
|
|
meterPdfInfo(reportId + "", 1);
|
|
@@ -2567,129 +2579,7 @@ public class TaskController extends BladeController {
|
|
|
return R.fail("操作失败");
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/meterPdfInfoOld")
|
|
|
- @ApiOperationSupport(order = 22)
|
|
|
- @ApiOperation(value = "计量生成Pdf", notes = "计量生成Pdf")
|
|
|
- public R meterPdfInfo(@RequestParam String ContractId, @RequestParam String FormDataId, @RequestParam Integer type) {
|
|
|
- String file_path = CollectionUtils.getSysLocalFileUrl();
|
|
|
- String fileUrl = "";
|
|
|
- Long sid = 0l;
|
|
|
- MaterialStartStatement materialS = materialStartStatementService.getBaseMapper().selectOne(Wrappers.<MaterialStartStatement>lambdaQuery().eq(MaterialStartStatement::getContractId, ContractId).eq(MaterialStartStatement::getMeterPeriodId, FormDataId).eq(MaterialStartStatement::getType, 1));
|
|
|
- if (materialS == null || Func.isNull(materialS)) {
|
|
|
- MeterPeriod me = periodService.getById(FormDataId);
|
|
|
- MaterialStartStatement data = new MaterialStartStatement();
|
|
|
- data.setMeterPeriodId(Func.toLong(FormDataId));
|
|
|
- data.setPrintDate(me.getFormPrintDate());
|
|
|
-
|
|
|
- data.setRepaymentCause("材料预付款");
|
|
|
- data.setStatementName("材料预付款--" + me.getPeriodName());
|
|
|
- materialStartStatementService.addOrUpdate(data);
|
|
|
- sid = data.getId();
|
|
|
- } else {
|
|
|
- sid = materialS.getId();
|
|
|
- }
|
|
|
- List<ReportResult> sul = new ArrayList<>();
|
|
|
- // 材料生成pdf
|
|
|
-
|
|
|
- sul = formulaClient.formulaExecute3(Long.parseLong(ContractId), sid, type);
|
|
|
- // 获取填报数据
|
|
|
- List<String> dataListPdf = new ArrayList<>();
|
|
|
-
|
|
|
- if (sul != null && sul.size() >= 1) {
|
|
|
- for (ReportResult data : sul) {
|
|
|
- Long excelId = data.getExcelId();
|
|
|
- String exSql = "SELECT * from m_excel_tab where id=" + excelId + "";
|
|
|
- Map<String, Object> exMap = jdbcTemplate.queryForMap(exSql);
|
|
|
- if (exMap == null) {
|
|
|
- return R.fail("未获取到该表单的信息");
|
|
|
- }
|
|
|
- if (exMap.get("file_url") == null) {
|
|
|
- return R.fail("htmlUrl is null");
|
|
|
- }
|
|
|
- String pkeyId = sid + "" + excelId;
|
|
|
- String pdfPath = file_path + "/pdf//" + pkeyId + ".pdf";
|
|
|
- String excelPath = file_path + "/pdf//" + pkeyId + ".xlsx";
|
|
|
-
|
|
|
- String excelUrl = exMap.get("file_url") + "";
|
|
|
-
|
|
|
- File tabPdf = null;
|
|
|
- try {
|
|
|
- tabPdf = ResourceUtil.getFile(pdfPath);
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- if (tabPdf.exists()) {
|
|
|
- tabPdf.delete();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //获取excel流 和 html流
|
|
|
- try {
|
|
|
- InputStream exceInp = CommonUtil.getOSSInputStream(excelUrl);
|
|
|
- Workbook workbook = null;
|
|
|
- int index = excelUrl.lastIndexOf(".");
|
|
|
- String suffix = excelUrl.substring(index).toLowerCase();
|
|
|
-
|
|
|
- if (".xls".equals(suffix)) {
|
|
|
- workbook = new XSSFWorkbook(exceInp);
|
|
|
- } else if (".xlsx".equals(suffix)) {
|
|
|
- workbook = new XSSFWorkbook(exceInp);
|
|
|
- }
|
|
|
- //获取工作表
|
|
|
- Sheet sheet = workbook.getSheetAt(0);
|
|
|
- sheet.setForceFormulaRecalculation(true);
|
|
|
-
|
|
|
- // 写入数据
|
|
|
- List<Map<String, Object>> dataData = data.getData();
|
|
|
- if (dataData != null && dataData.size() >= 1) {
|
|
|
- for (Map<String, Object> dama : dataData) {
|
|
|
-
|
|
|
- // 循环Key
|
|
|
- for (String keys : dama.keySet()) {
|
|
|
- int y1 = Func.toInt(keys.split("_")[0]);
|
|
|
- int x1 = Func.toInt(keys.split("_")[1]);
|
|
|
- Row row = sheet.getRow(y1 - 1);
|
|
|
- if (row != null) {
|
|
|
- Cell cell = row.getCell(x1 - 1);
|
|
|
- String dataval = dama.get(keys) + "";
|
|
|
- if (dataval.indexOf("第") >= 0 && dataval.indexOf("次支付") >= 0) {
|
|
|
- String datare = dataval.replace("第", "").replace("次交付", "");
|
|
|
- dataval = datare.replace("次支付", "");
|
|
|
- }
|
|
|
- cell.setCellValue(dataval);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- //输出流
|
|
|
- FileOutputStream outputStream = new FileOutputStream(excelPath);
|
|
|
- workbook.write(outputStream);
|
|
|
- CollectionUtils.excelToPdf(excelPath, pdfPath);
|
|
|
- dataListPdf.add(pdfPath);
|
|
|
- //关闭流
|
|
|
- IoUtil.closeQuietly(outputStream);
|
|
|
- IoUtil.closeQuietly(exceInp);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Long dataId = SnowFlakeUtil.getId();
|
|
|
- String lasPdf = file_path + "/pdf//" + dataId + "_last.pdf";
|
|
|
-
|
|
|
- if (dataListPdf.size() > 0) {
|
|
|
- CollectionUtils.mergePdfPublicMethods(dataListPdf, lasPdf);
|
|
|
- BladeFile bladeFile2 = newIOSSClient.uploadFile(dataId + "_last.pdf", lasPdf);
|
|
|
- fileUrl = bladeFile2.getLink();
|
|
|
- }
|
|
|
-
|
|
|
- String upSql = "update s_material_start_statement set raw_url='" + fileUrl + "' where contract_id=" + ContractId + " and type=1 and meter_period_id=" + FormDataId + "";
|
|
|
- jdbcTemplate.execute(upSql);
|
|
|
-
|
|
|
- return R.success(fileUrl);
|
|
|
- }
|
|
|
|
|
|
@GetMapping("/meterPdfInfo")
|
|
|
@ApiOperationSupport(order = 22)
|
|
@@ -2886,10 +2776,10 @@ public class TaskController extends BladeController {
|
|
|
e.printStackTrace();
|
|
|
return "无效地址";
|
|
|
}
|
|
|
- }, (v1, v2) -> v1, LinkedHashMap::new));
|
|
|
- String upSql = "update " + REPORT_TYPE[this.type] + " set raw_url=?,file_url_list=? where id=" + this.id;
|
|
|
- jdbcTemplate.update(upSql, this.pdfUrl, JSON.toJSONString(fileListMap));
|
|
|
- return this.pdfUrl;
|
|
|
+ },(v1,v2)->v1,LinkedHashMap::new));
|
|
|
+ String upSql = "update "+REPORT_TYPE[this.type]+" set raw_url=?,file_url_list=? ,calculate_date=SYSDATE() where id="+this.id;
|
|
|
+ jdbcTemplate.update(upSql,this.pdfUrl , JSON.toJSONString(fileListMap));
|
|
|
+ return this.pdfUrl;
|
|
|
}
|
|
|
|
|
|
public Report(Long id, Integer type) {
|