|
@@ -62,9 +62,7 @@ import org.springblade.manager.vo.ReportResult;
|
|
|
import org.springblade.meter.config.MyJdbcTemplate;
|
|
|
import org.springblade.meter.dto.*;
|
|
|
import org.springblade.meter.entity.*;
|
|
|
-import org.springblade.meter.mapper.ContractMeterPeriodMapper;
|
|
|
-import org.springblade.meter.mapper.MiddleMeterApplyMapper;
|
|
|
-import org.springblade.meter.mapper.MiddleMeterApplyTaskMapper;
|
|
|
+import org.springblade.meter.mapper.*;
|
|
|
import org.springblade.meter.service.IContractMeterPeriodService;
|
|
|
import org.springblade.meter.service.IInterimPayCertificateService;
|
|
|
import org.springblade.meter.service.IMaterialStartStatementService;
|
|
@@ -130,6 +128,10 @@ public class TaskController extends BladeController {
|
|
|
private final AttachmentFormServiceTaskImpl attachmentFormServiceTask;
|
|
|
private final MiddleMeterApplyMapper middleMeterApplyMapper;
|
|
|
|
|
|
+ private final MaterialMeterFormTaskMapper materialMeterFormTaskMapper;
|
|
|
+ private final StartPayMeterFormTaskMapper startPayMeterFormTaskMapper;
|
|
|
+ private final MeterPeriodMapper meterPeriodMapper;
|
|
|
+
|
|
|
private final WbsTreePrivateClient wbsTreePrivateClient;
|
|
|
private final ExcelTabClient excelTabClient;
|
|
|
private final EVisaClient eVisaClient;
|
|
@@ -206,6 +208,13 @@ public class TaskController extends BladeController {
|
|
|
if (ObjectUtil.isEmpty(approvalDTO.getTaskUserIds()) && ObjectUtil.isEmpty(approvalDTO.getFixedFlowId())) {
|
|
|
throw new ServiceException("未获取到任务人信息,操作失败");
|
|
|
}
|
|
|
+ //如果要升级审计意见单则校验是否存在
|
|
|
+ if (approvalDTO.getIsBuildAudit() != null && approvalDTO.getIsBuildAudit() == 1){
|
|
|
+ R<WbsTreePrivate> r = wbsTreePrivateClient.getProjectOpinionNode(approvalDTO.getProjectId());
|
|
|
+ if (r.getCode() != 200) {
|
|
|
+ return R.fail(400, "请联系管理员:"+r.getMsg());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/*加锁*/
|
|
|
String redisValue = bladeRedis.get("meter:report:contractId-" + approvalDTO.getContractId());
|
|
@@ -589,6 +598,7 @@ public class TaskController extends BladeController {
|
|
|
task.setProjectId(approvalDTO.getProjectId().toString());
|
|
|
task.setBatch(approvalDTO.getBatch());
|
|
|
task.setMeterTaskType(meterTaskType); //计量任务类型 1=中间计量申请,2=材料计量单,3=开工预付款计量单、4=变更令
|
|
|
+ task.setIsBuildAudit(approvalDTO.getIsBuildAudit());
|
|
|
|
|
|
task.setType(1);
|
|
|
task.setApprovalType(5); //计量
|
|
@@ -1295,68 +1305,98 @@ public class TaskController extends BladeController {
|
|
|
}
|
|
|
vo.setTaskProcessInfo(taskProcessInfo);
|
|
|
}
|
|
|
- /*中间计量申请,返回值增加:上报总金额,本期进度款,审计意见*/
|
|
|
- if (task.getMeterTaskType() != null && task.getMeterTaskType() == 1){
|
|
|
+ /*中间计量申请,开工预付款,材料,返回值增加:上报总金额,本期进度款,审计意见*/
|
|
|
+ if (task.getMeterTaskType() != null && Arrays.asList(1,2,3).contains(task.getMeterTaskType())){
|
|
|
+ BigDecimal reportAllMoney = null;
|
|
|
//实时查询上报总金额
|
|
|
- BigDecimal reportAllMoney = middleMeterApplyTaskMapper.selectAllMoney(task.getId());
|
|
|
- if (reportAllMoney == null){
|
|
|
+ if (task.getMeterTaskType() == 1) {
|
|
|
+ //中间计量
|
|
|
+ reportAllMoney = middleMeterApplyTaskMapper.selectAllMoney(task.getId());
|
|
|
+ }else if (task.getMeterTaskType() == 2){
|
|
|
+ //材料计量
|
|
|
+ reportAllMoney = materialMeterFormTaskMapper.selectAllMoney(task.getId());
|
|
|
+ }else if (task.getMeterTaskType() == 3){
|
|
|
+ //开工计量
|
|
|
+ reportAllMoney = startPayMeterFormTaskMapper.selectAllMoney(task.getId());
|
|
|
+ }
|
|
|
+ if (reportAllMoney == null || reportAllMoney.compareTo(BigDecimal.ZERO) == 0){
|
|
|
throw new ServiceException("上报金额不能为0");
|
|
|
}
|
|
|
- ContractMeterPeriod period = contractMeterPeriodService.getById(task.getFormDataId());
|
|
|
- if (period == null){
|
|
|
- throw new ServiceException("未获取到计量期信息");
|
|
|
- }
|
|
|
vo.setReportAllMoney(reportAllMoney);
|
|
|
- vo.setProgressMoney(task.getTaskCommonMoney() == null ? BigDecimal.ZERO : task.getTaskCommonMoney());
|
|
|
- vo.setPdfUrl(task.getAttachmentPdfUrl());
|
|
|
- String html = this.getExcelHtmlByBuss(Long.valueOf(task.getProjectId()));
|
|
|
- if (html != null) {
|
|
|
- vo.setTableHtml(html);
|
|
|
- if (auditFlow != null){
|
|
|
- //查看当前用户是否在审计流程
|
|
|
- if (currentUserFlow != null && currentUserFlow.equals(auditFlow)) {
|
|
|
- //是意见人,设置意见为1,查询已经填写的值,如果没有则返回默认值
|
|
|
- vo.setOpinionType(1);
|
|
|
- R<WbsTreePrivate> r = wbsTreePrivateClient.getProjectOpinionNode(Long.valueOf(task.getProjectId()));
|
|
|
- if (r.getCode() != 200) {
|
|
|
- throw new ServiceException(r.getMsg());
|
|
|
- }
|
|
|
- WbsTreePrivate aPrivate = r.getData();
|
|
|
- //获取所有的key
|
|
|
- Map<String, String> map = FileUtils.getHtmlAllKey(aPrivate.getHtmlUrl());
|
|
|
+ if (task.getIsBuildAudit() == 1) {
|
|
|
+ PeriodVO periodVO = null;
|
|
|
+ if (task.getMeterTaskType() == 1) {
|
|
|
+ //中间计量
|
|
|
+ periodVO = contractMeterPeriodMapper.getById(task.getFormDataId());
|
|
|
+ }else if (task.getMeterTaskType() == 2 || task.getMeterTaskType() == 3){
|
|
|
+ //材料计量,开工计量
|
|
|
+ periodVO = meterPeriodMapper.getById(task.getFormDataId());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (periodVO == null) {
|
|
|
+ throw new ServiceException("未获取到计量期信息");
|
|
|
+ }
|
|
|
+ vo.setProgressMoney(task.getTaskCommonMoney() == null ? BigDecimal.ZERO : task.getTaskCommonMoney());
|
|
|
+ vo.setPdfUrl(task.getAttachmentPdfUrl());
|
|
|
+ String html = this.getExcelHtmlByBuss(Long.valueOf(task.getProjectId()));
|
|
|
+ if (html != null) {
|
|
|
+ vo.setTableHtml(html);
|
|
|
+ if (auditFlow != null) {
|
|
|
+ //查看当前用户是否在审计流程
|
|
|
+ if (currentUserFlow != null && currentUserFlow.equals(auditFlow)) {
|
|
|
+ //是意见人,设置意见为1,查询已经填写的值,如果没有则返回默认值
|
|
|
+ vo.setOpinionType(1);
|
|
|
+ R<WbsTreePrivate> r = wbsTreePrivateClient.getProjectOpinionNode(Long.valueOf(task.getProjectId()));
|
|
|
+ if (r.getCode() != 200) {
|
|
|
+ throw new ServiceException(r.getMsg());
|
|
|
+ }
|
|
|
+ WbsTreePrivate aPrivate = r.getData();
|
|
|
+ //获取所有的key
|
|
|
+ Map<String, String> map = FileUtils.getHtmlAllKey(aPrivate.getHtmlUrl());
|
|
|
// Map<String, String> map = FileUtils.getHtmlAllKey("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1802649593746292736.html");
|
|
|
- if (map.size() == 0){
|
|
|
- throw new ServiceException("未获取到html中的keyName");
|
|
|
- }
|
|
|
- //实体数据
|
|
|
- Map<String, Object> dataInfo = getBussDataInfo(aPrivate, task.getId());
|
|
|
- //todo 目前直接把key写死在代码里面,后面有空再去动态获取key
|
|
|
- Map<String, Object> tableData = new HashMap<>();
|
|
|
- if (dataInfo.size() == 0) {
|
|
|
- tableData.put(map.get("项目名称:"), projectClient.getById(task.getProjectId()).getProjectName() + contractClient.getContractById(Long.valueOf(task.getContractId())).getContractName());
|
|
|
- tableData.put(map.get("要求付款额度"), reportAllMoney);
|
|
|
- tableData.put(map.get("意见发出日期:"), DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
|
|
|
- tableData.put(map.get("造价机构现场咨询意见_本期审核进度款(元)"), reportAllMoney);
|
|
|
- //获取本期之前所有计量期金额
|
|
|
- BigDecimal beforeMoney = contractMeterPeriodMapper.getBeforeMoney(period);
|
|
|
- if (beforeMoney != null){
|
|
|
- tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)"),beforeMoney);
|
|
|
+ if (map.size() == 0) {
|
|
|
+ throw new ServiceException("未获取到html中的keyName");
|
|
|
+ }
|
|
|
+ //实体数据
|
|
|
+ Map<String, Object> dataInfo = getBussDataInfo(aPrivate, task.getId());
|
|
|
+ //todo 目前直接把key写死在代码里面,后面有空再去动态获取key
|
|
|
+ Map<String, Object> tableData = new HashMap<>();
|
|
|
+ if (dataInfo.size() == 0) {
|
|
|
+ tableData.put(map.get("项目名称:"), projectClient.getById(task.getProjectId()).getProjectName() + contractClient.getContractById(Long.valueOf(task.getContractId())).getContractName());
|
|
|
+ tableData.put(map.get("要求付款额度"), reportAllMoney);
|
|
|
+ tableData.put(map.get("意见发出日期:"), DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
|
|
|
+ tableData.put(map.get("造价机构现场咨询意见_本期审核进度款(元)"), reportAllMoney);
|
|
|
+ BigDecimal beforeMoney = null;
|
|
|
+ //获取本期之前所有计量期金额
|
|
|
+ if (task.getMeterTaskType() == 1) {
|
|
|
+ //中间计量
|
|
|
+ beforeMoney = contractMeterPeriodMapper.getBeforeMoney(periodVO);
|
|
|
+ }else if (task.getMeterTaskType() == 2 || task.getMeterTaskType() == 3){
|
|
|
+ //材料计量,开工计量
|
|
|
+ beforeMoney = meterPeriodMapper.getBeforeMoney(periodVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (beforeMoney != null) {
|
|
|
+ tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)"), beforeMoney);
|
|
|
+ }
|
|
|
+ tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), beforeMoney == null ? reportAllMoney : beforeMoney.add(reportAllMoney));
|
|
|
+ } else {
|
|
|
+ tableData = dataInfo;
|
|
|
}
|
|
|
- tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), beforeMoney == null ? reportAllMoney : beforeMoney.add(reportAllMoney));
|
|
|
+ vo.setTableData(tableData);
|
|
|
} else {
|
|
|
- tableData = dataInfo;
|
|
|
+ if (StringUtils.isNotBlank(task.getAttachmentPdfUrl())) {
|
|
|
+ vo.setOpinionType(2);
|
|
|
+ } else {
|
|
|
+ //不是意见人,判断PDF是否生成,生成了类型为2,没有生成类型为3
|
|
|
+ vo.setOpinionType(3);
|
|
|
+ }
|
|
|
}
|
|
|
- vo.setTableData(tableData);
|
|
|
} else {
|
|
|
- if (StringUtils.isNotBlank(task.getAttachmentPdfUrl())) {
|
|
|
- vo.setOpinionType(2);
|
|
|
- } else {
|
|
|
- //不是意见人,判断PDF是否生成,生成了类型为2,没有生成类型为3
|
|
|
- vo.setOpinionType(3);
|
|
|
- }
|
|
|
+ vo.setOpinionType(3);
|
|
|
}
|
|
|
- }else {
|
|
|
- vo.setOpinionType(3);
|
|
|
+ } else {
|
|
|
+ vo.setOpinionType(4);
|
|
|
}
|
|
|
}else {
|
|
|
vo.setOpinionType(4);
|
|
@@ -2360,8 +2400,11 @@ public class TaskController extends BladeController {
|
|
|
String sql_2 = "SELECT * FROM u_task_parallel WHERE process_instance_id = ? ORDER BY sort";
|
|
|
List<TaskParallel> taskParallels = jdbcTemplate.query(sql_2, new Object[]{task.getProcessInstanceId()}, new BeanPropertyRowMapper<>(TaskParallel.class));
|
|
|
|
|
|
- //如果当前是中间计量申请,并且是第一流程,则保存表单但数据,若第一流程所有人都已审批则生成PDF,并且设置task对应值
|
|
|
- checkMiddleApp(dto,task,taskParallels);
|
|
|
+ //如果要生成审计意见单
|
|
|
+ //如果当前是中间计量,材料计量,开工计量,并且是第一流程,则保存表单数据,若第一流程所有人都已审批则生成PDF,并且设置task对应值
|
|
|
+ if (task.getIsBuildAudit() == 1) {
|
|
|
+ checkMiddleApp(dto, task, taskParallels);
|
|
|
+ }
|
|
|
|
|
|
boolean isCurrentUserLastApprove = checkTheTaskPersonSort(taskParallels);
|
|
|
/*单条业务数据状态*/
|
|
@@ -2450,7 +2493,7 @@ public class TaskController extends BladeController {
|
|
|
private void checkMiddleApp(TaskApproveDTO dto, Task task, List<TaskParallel> taskParallels) {
|
|
|
String html = this.getExcelHtmlByBuss(Long.valueOf(task.getProjectId()));
|
|
|
if (html != null) {
|
|
|
- if (task.getMeterTaskType() != null && task.getMeterTaskType() == 1) {
|
|
|
+ if (task.getMeterTaskType() != null && Arrays.asList(1,2,3).contains(task.getMeterTaskType())) {
|
|
|
//判断当前用户所属流程,只处理审计流程
|
|
|
Integer currentUserFlow = null;
|
|
|
Integer auditFlow = null;
|