|
@@ -22,12 +22,15 @@ import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.commons.lang.time.DateUtils;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
+import org.jsoup.Jsoup;
|
|
|
+import org.jsoup.select.Elements;
|
|
|
import org.springblade.business.entity.FixedFlow;
|
|
|
import org.springblade.business.entity.FixedFlowLink;
|
|
|
import org.springblade.business.entity.Task;
|
|
|
import org.springblade.business.entity.TaskParallel;
|
|
|
import org.springblade.business.feign.TaskClient;
|
|
|
import org.springblade.common.constant.ClientIdConstant;
|
|
|
+import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.utils.BaseUtils;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
@@ -44,6 +47,7 @@ import org.springblade.core.tool.utils.DateUtil;
|
|
|
import org.springblade.feign.ArchiveFileTaskClient;
|
|
|
import org.springblade.manager.entity.ContractInfo;
|
|
|
import org.springblade.manager.entity.ContractRelationJlyz;
|
|
|
+import org.springblade.manager.entity.TextdictInfo;
|
|
|
import org.springblade.manager.feign.FormulaClient;
|
|
|
import org.springblade.manager.vo.ReportResult;
|
|
|
import org.springblade.meter.dto.*;
|
|
@@ -56,6 +60,7 @@ import org.springblade.meter.utils.CollectionUtils;
|
|
|
import org.springblade.meter.vo.*;
|
|
|
import org.springblade.producer.bean.PushMessage;
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
|
+import org.springblade.system.cache.ParamCache;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
@@ -250,7 +255,7 @@ public class TaskController extends BladeController {
|
|
|
try {
|
|
|
this.buildTaskInfo(taskId, approvalDTO, aopParamsSet, 1);
|
|
|
} catch (Exception e) {
|
|
|
- throw new ServiceException("创建审批任务异常,操作失败:" + e.getMessage());
|
|
|
+ throw new ServiceException("创建审批任务异常," + e.getMessage());
|
|
|
}
|
|
|
|
|
|
/*修改数据源状态为=待审批*/
|
|
@@ -320,7 +325,7 @@ public class TaskController extends BladeController {
|
|
|
try {
|
|
|
this.buildTaskInfo(taskId, approvalDTO, aopParamsSet, 2);
|
|
|
} catch (Exception e) {
|
|
|
- throw new ServiceException("创建审批任务异常,操作失败:" + e.getMessage());
|
|
|
+ throw new ServiceException("创建审批任务异常," + e.getMessage());
|
|
|
}
|
|
|
|
|
|
/*修改数据源状态为=待审批*/
|
|
@@ -385,7 +390,7 @@ public class TaskController extends BladeController {
|
|
|
try {
|
|
|
this.buildTaskInfo(taskId, approvalDTO, aopParamsSet, 3);
|
|
|
} catch (Exception e) {
|
|
|
- throw new ServiceException("创建审批任务异常,操作失败:" + e.getMessage());
|
|
|
+ throw new ServiceException("创建审批任务异常," + e.getMessage());
|
|
|
}
|
|
|
|
|
|
/*修改数据源状态为=待审批*/
|
|
@@ -483,7 +488,7 @@ public class TaskController extends BladeController {
|
|
|
try {
|
|
|
this.buildTaskInfo(taskId, approvalDTO, aopParamsSet, 4);
|
|
|
} catch (Exception e) {
|
|
|
- throw new ServiceException("创建审批任务异常,操作失败:" + e.getMessage());
|
|
|
+ throw new ServiceException("创建审批任务异常," + e.getMessage());
|
|
|
}
|
|
|
|
|
|
return R.data(200, aopParamsSet, "操作成功");
|
|
@@ -530,7 +535,7 @@ public class TaskController extends BladeController {
|
|
|
}
|
|
|
R<Object> objectR = archiveFileTaskClient.checkTaskUserCertificateInfo(approvalDTO.getTaskUserIds());
|
|
|
if (!objectR.isSuccess()) {
|
|
|
- throw new ServiceException("选择的任务人没有签字证书信息,请联系管理员");
|
|
|
+ throw new ServiceException(objectR.getMsg());
|
|
|
}
|
|
|
|
|
|
/*主任务*/
|
|
@@ -2195,13 +2200,12 @@ public class TaskController extends BladeController {
|
|
|
|
|
|
/*单条业务数据状态*/
|
|
|
updateCopyDataStatus(task, dto);
|
|
|
-
|
|
|
+ String reportId = null;
|
|
|
/*最终审批轮次*/
|
|
|
if (isCurrentUserLastApprove) {
|
|
|
//TODO 重新生成报表,执行电签(电签失败直接return或抛出异常,不修改下方状态)
|
|
|
- Long reportId = 0L;
|
|
|
- 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(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();
|
|
@@ -2209,7 +2213,9 @@ public class TaskController extends BladeController {
|
|
|
data.setContractId(Func.toLong(task.getContractId()));
|
|
|
data.setMeterPeriodId(Func.toLong(task.getFormDataId()));
|
|
|
data.setPrintDate(me.getFormPrintDate());
|
|
|
- if (task.getMeterTaskType() == 2) {
|
|
|
+ data.setPeriodNumber(me.getPeriodNumber());
|
|
|
+ data.setProjectId(me.getProjectId());
|
|
|
+ if(task.getMeterTaskType()==2){
|
|
|
data.setRepaymentCause("材料预付款");
|
|
|
data.setStatementName("材料预付款--" + me.getPeriodName());
|
|
|
data.setType(1);
|
|
@@ -2221,9 +2227,9 @@ public class TaskController extends BladeController {
|
|
|
data.setType(2);
|
|
|
}
|
|
|
materialStartStatementService.saveOrUpdate(data);
|
|
|
- reportId = data.getId();
|
|
|
+ reportId = data.getId()+"";
|
|
|
} else {
|
|
|
- reportId = materialS.getId();
|
|
|
+ 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()));
|
|
@@ -2236,14 +2242,13 @@ public class TaskController extends BladeController {
|
|
|
inData2.setCertificateNumber(task.getFormDataId());
|
|
|
inData2.setPeriodNumber(me.getPeriodNumber());
|
|
|
inData2.setPrintDate(me.getFormPrintDate());
|
|
|
+ inData2.setProjectId(me.getProjectId());
|
|
|
interimPayCertificateService.save(inData2);
|
|
|
- reportId = inData2.getId();
|
|
|
+ reportId = inData2.getId()+"";
|
|
|
}
|
|
|
- reportId = inData.getId();
|
|
|
+ reportId = inData.getId()+"";
|
|
|
}
|
|
|
/**计量公式执行 0中间,1材料,2开工*/
|
|
|
- meterPdfInfo(reportId + "", 1);
|
|
|
-
|
|
|
/*复制业务数据状态>主任务状态>替换数据*/
|
|
|
updateCopyDataApproveStatus(task, dto).updateTaskStatus(task).displace(task, dto);
|
|
|
}
|
|
@@ -2256,6 +2261,11 @@ public class TaskController extends BladeController {
|
|
|
String param = taskParallel.getTaskUser() + "," + task.getProjectId() + "," + task.getContractId();
|
|
|
aopParamsSet.add(param);
|
|
|
}
|
|
|
+ //
|
|
|
+ if(reportId!=null && StringUtils.isNotEmpty(reportId) && (task.getMeterTaskType()==3 ||task.getMeterTaskType()==1 || task.getMeterTaskType()==2)){
|
|
|
+ meterPdfInfo(reportId + "", task.getMeterTaskType()-1);
|
|
|
+ }
|
|
|
+
|
|
|
return R.data(200, aopParamsSet, "操作成功");
|
|
|
}
|
|
|
return R.fail("操作失败");
|
|
@@ -2314,6 +2324,7 @@ public class TaskController extends BladeController {
|
|
|
isCurrentUserLastApprover = true;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
return isCurrentUserLastApprover;
|
|
|
}
|
|
|
|
|
@@ -2736,6 +2747,8 @@ public class TaskController extends BladeController {
|
|
|
}
|
|
|
/*设置表头*/
|
|
|
setTitle(sheet, tile);
|
|
|
+ /*添加电签*/
|
|
|
+ setDQInfo(sheet,rs.getUrl());
|
|
|
//去掉表格虚线
|
|
|
sheet.setPrintGridlines(false);
|
|
|
//设置 整个工作表为一页
|
|
@@ -2804,6 +2817,55 @@ public class TaskController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 添加电签信息数据
|
|
|
+ public void setDQInfo(Sheet sheet, String htmlUrl) {
|
|
|
+ String file_path = CollectionUtils.getSysLocalFileUrl();
|
|
|
+ // 添加电签关键字Id
|
|
|
+ String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
|
|
|
+ File file = null;
|
|
|
+ InputStream fileInputStream;
|
|
|
+ try {
|
|
|
+ file = ResourceUtil.getFile(htmlUrl);
|
|
|
+ if (file.exists()) {
|
|
|
+ fileInputStream = new FileInputStream(file);
|
|
|
+ } else {
|
|
|
+ String path = sys_file_net_url + htmlUrl.replaceAll("//", "/").replaceAll(file_path, "");
|
|
|
+ fileInputStream = CommonUtil.getOSSInputStream(path);
|
|
|
+ }
|
|
|
+ String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
+ org.jsoup.nodes.Document htmldoc = Jsoup.parse(htmlString);
|
|
|
+ Elements dqlist = htmldoc.getElementsByAttribute("dqid");
|
|
|
+ if(dqlist!=null && !dqlist.isEmpty()){
|
|
|
+ dqlist.forEach(element -> {
|
|
|
+ int y1 = Func.toInt(element.attr("y1"));
|
|
|
+ int x1 = Func.toInt(element.attr("x1"));
|
|
|
+
|
|
|
+ Row row = sheet.getRow(y1 - 1);
|
|
|
+ if (row != null) {
|
|
|
+ Cell cell = row.getCell(x1 - 1);
|
|
|
+ if (cell != null) {
|
|
|
+
|
|
|
+ cell.setCellValue(element.attr("dqid"));
|
|
|
+
|
|
|
+ Workbook workbook = cell.getSheet().getWorkbook();
|
|
|
+ CellStyle cellStyle = workbook.createCellStyle();
|
|
|
+ cellStyle.cloneStyleFrom(cell.getCellStyle());
|
|
|
+
|
|
|
+ Font newFont = workbook.createFont();
|
|
|
+ newFont.setColor(IndexedColors.WHITE.getIndex());
|
|
|
+ newFont.setFontHeightInPoints((short) 2);
|
|
|
+ cellStyle.setFont(newFont);
|
|
|
+
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Data
|
|
|
class Report {
|
|
|
public final String[] REPORT_TYPE = new String[]{"s_interim_pay_certificate", "s_material_start_statement", "s_material_start_statement"};
|
|
@@ -2920,7 +2982,7 @@ public class TaskController extends BladeController {
|
|
|
String resultString = StringUtils.join(userIds, ",");
|
|
|
R<Object> objectR = archiveFileTaskClient.checkTaskUserCertificateInfo(resultString);
|
|
|
if (!objectR.isSuccess()) {
|
|
|
- throw new ServiceException("预设流程选择的任务人没有签字证书信息");
|
|
|
+ throw new ServiceException(objectR.getMsg());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3031,7 +3093,7 @@ public class TaskController extends BladeController {
|
|
|
String resultString = StringUtils.join(userIds, ",");
|
|
|
R<Object> objectR = archiveFileTaskClient.checkTaskUserCertificateInfo(resultString);
|
|
|
if (!objectR.isSuccess()) {
|
|
|
- throw new ServiceException("预设流程选择的任务人没有签字证书信息");
|
|
|
+ throw new ServiceException(objectR.getMsg());
|
|
|
}
|
|
|
}
|
|
|
|