|
@@ -72,6 +72,7 @@ import org.springblade.meter.config.MyJdbcTemplate;
|
|
|
import org.springblade.meter.dto.*;
|
|
|
import org.springblade.meter.entity.*;
|
|
|
import org.springblade.meter.mapper.*;
|
|
|
+import org.springblade.meter.service.IInterimPayCertificateItemService;
|
|
|
import org.springblade.meter.service.IInterimPayCertificateService;
|
|
|
import org.springblade.meter.service.IMaterialStartStatementService;
|
|
|
import org.springblade.meter.service.ITaskRepealMessageService;
|
|
@@ -107,6 +108,7 @@ import java.util.concurrent.ExecutionException;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.stream.IntStream;
|
|
|
|
|
|
@RestController
|
|
|
@AllArgsConstructor
|
|
@@ -159,6 +161,7 @@ public class TaskController extends BladeController {
|
|
|
|
|
|
private final IMaterialStartStatementService materialStartStatementService;
|
|
|
private final IInterimPayCertificateService interimPayCertificateService;
|
|
|
+ private final IInterimPayCertificateItemService interimPayCertificateItemService;
|
|
|
// 计量公式入口
|
|
|
private final FormulaClient formulaClient;
|
|
|
|
|
@@ -172,6 +175,7 @@ public class TaskController extends BladeController {
|
|
|
@ApiOperation(value = "获取任务名称", notes = "传入合同段contractId、期数id(变更令传勾选的id字符串英文逗号拼接)、type=1(中间计量申请)、=2(材料计量单)、3=(开工预付款计量单)、=4(变更令)")
|
|
|
public R<Object> name(@RequestParam String contractId, @RequestParam String id, @RequestParam String type) {
|
|
|
String name = null;
|
|
|
+ BigDecimal bigDecimal=null;
|
|
|
if (ObjectUtil.isNotEmpty(contractId) && ObjectUtil.isNotEmpty(id)) {
|
|
|
ContractInfo contractInfo = jdbcTemplate.query("SELECT contract_name FROM m_contract_info WHERE id = " + contractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
|
|
|
String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
|
@@ -200,10 +204,15 @@ public class TaskController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ bigDecimal = middleMeterApplyTaskMapper.selectSubmitApprovalMoney(Long.valueOf(contractId), Long.valueOf(id));
|
|
|
}
|
|
|
- return R.data(200, name, "操作成功");
|
|
|
+ Map<String,Object> map=new HashMap<>();
|
|
|
+ map.put("name",name);
|
|
|
+ map.put("submitApprovalMoney",bigDecimal);
|
|
|
+ return R.data(200, map, "操作成功");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@PostMapping("/report")
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiOperation(value = "任务上报", notes = "(中期计量申请、材料计量单、开工预付款计量单、变更令)传入MeterApprovalDTO")
|
|
@@ -320,7 +329,41 @@ public class TaskController extends BladeController {
|
|
|
/*修改计量期的审批状态=待审批*/
|
|
|
contractMeterPeriodService.update(Wrappers.<ContractMeterPeriod>lambdaUpdate().set(ContractMeterPeriod::getApproveStatus, 1).eq(ContractMeterPeriod::getId, approvalDTO.getPeriodId()));
|
|
|
//修改报表状态,如果不存在则创建报表,因为任务要查看报表
|
|
|
- this.updateStatement(Long.valueOf(approvalDTO.getPeriodId()),1,1);
|
|
|
+ Long id = this.updateStatement(Long.valueOf(approvalDTO.getPeriodId()), 1, 1);
|
|
|
+ //修改报表项
|
|
|
+ if(ObjectUtil.isNotEmpty(id)){
|
|
|
+ InterimPayCertificateItem item = new InterimPayCertificateItem();
|
|
|
+ item.setId(SnowFlakeUtil.getId());
|
|
|
+ item.setCertificateId(id);
|
|
|
+ item.setChapterSeq("施工单位送审金额");
|
|
|
+ item.setCurrentPeriodPay(approvalDTO.getSubmitApprovalMoney()+"");
|
|
|
+ String sql="Select * from s_contract_meter_period where contract_id="+approvalDTO.getContractId()+" and is_deleted=0"+" order by start_date";
|
|
|
+ List<ContractMeterPeriod> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ContractMeterPeriod.class));
|
|
|
+ if (list.size()>0) {
|
|
|
+ //上期末施工单位金额
|
|
|
+ BigDecimal shangqimo=BigDecimal.ZERO;
|
|
|
+ OptionalInt index= IntStream.range(0, list.size())
|
|
|
+ .filter(i -> list.get(i).getId().equals(approvalDTO.getPeriodId()))
|
|
|
+ .findFirst();
|
|
|
+ if(index.isPresent()){
|
|
|
+ int j = index.getAsInt();
|
|
|
+ //j>0表示前面有数据
|
|
|
+ if(j>0){
|
|
|
+ //上一期的到本期末
|
|
|
+ BigDecimal bigDecimal = middleMeterApplyTaskMapper.selectSubmitApprovalMoneyPre(approvalDTO.getContractId(), list.get(j - 1).getId());
|
|
|
+ if(ObjectUtil.isNotEmpty(bigDecimal)){
|
|
|
+ shangqimo=shangqimo.add(bigDecimal);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(shangqimo.compareTo(BigDecimal.ZERO)!=0){
|
|
|
+ item.setPreviousPeriodEndPay(shangqimo+"");
|
|
|
+ }
|
|
|
+ item.setCurrentPeriodEndPay(shangqimo.add(approvalDTO.getSubmitApprovalMoney())+"");
|
|
|
+ }
|
|
|
+ item.setSort(24);
|
|
|
+ interimPayCertificateItemService.saveOrUpdate(item);
|
|
|
+ }
|
|
|
return R.data(200, aopParamsSet, "操作成功");
|
|
|
}
|
|
|
|
|
@@ -1484,6 +1527,12 @@ public class TaskController extends BladeController {
|
|
|
}
|
|
|
reportAllMoney = reportAllMoney.setScale(0, RoundingMode.HALF_UP);
|
|
|
vo.setReportAllMoney(reportAllMoney);
|
|
|
+ //施工单位送审金额
|
|
|
+ BigDecimal submitApprovalMoney = null;
|
|
|
+ if(task.getMeterTaskType() == 1){
|
|
|
+ submitApprovalMoney=middleMeterApplyTaskMapper.selectSubmitApprovalMoney(Long.valueOf(task.getContractId()),Long.valueOf(task.getFormDataId()));
|
|
|
+ }
|
|
|
+ vo.setSubmitApprovalMoney(submitApprovalMoney);
|
|
|
if (task.getIsBuildAudit() == 1) {
|
|
|
PeriodVO periodVO = null;
|
|
|
if (task.getMeterTaskType() == 1) {
|
|
@@ -1784,7 +1833,8 @@ public class TaskController extends BladeController {
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
- private void updateStatement(Long periodId,Integer type,Integer status) {
|
|
|
+ private Long updateStatement(Long periodId,Integer type,Integer status) {
|
|
|
+ Long InterimPayCertificateId=null;
|
|
|
if (type == 1) {
|
|
|
List<InterimPayCertificate> list = interimPayCertificateService.list(new LambdaQueryWrapper<InterimPayCertificate>().eq(InterimPayCertificate::getContractPeriodId, periodId));
|
|
|
if (list.size() > 1) {
|
|
@@ -1793,6 +1843,7 @@ public class TaskController extends BladeController {
|
|
|
interimPayCertificateService.update(new LambdaUpdateWrapper<InterimPayCertificate>()
|
|
|
.eq(InterimPayCertificate::getId,list.get(0).getId())
|
|
|
.set(InterimPayCertificate::getApproveStatus,status));
|
|
|
+ InterimPayCertificateId=list.get(0).getId();
|
|
|
} else {
|
|
|
ContractMeterPeriod period = contractMeterPeriodService.getById(periodId);
|
|
|
//新增报表
|
|
@@ -1809,7 +1860,7 @@ public class TaskController extends BladeController {
|
|
|
interimPayCertificateService.save(certificate);
|
|
|
//10代表不走电签,其他都会自动审批
|
|
|
this.calculate(certificate.getId() + "", 0, 10);
|
|
|
-
|
|
|
+ InterimPayCertificateId=certificate.getId();
|
|
|
}
|
|
|
} else {
|
|
|
List<MaterialStartStatement> list = materialStartStatementService.list(new LambdaQueryWrapper<MaterialStartStatement>().eq(MaterialStartStatement::getMeterPeriodId, periodId));
|
|
@@ -1838,6 +1889,7 @@ public class TaskController extends BladeController {
|
|
|
this.calculate(statement.getId() + "", 1, 10);
|
|
|
}
|
|
|
}
|
|
|
+ return InterimPayCertificateId;
|
|
|
}
|
|
|
|
|
|
@GetMapping("/data/detail")
|
|
@@ -3701,10 +3753,10 @@ public class TaskController extends BladeController {
|
|
|
try {
|
|
|
String delTaskPall = "DELETE from u_task_parallel where process_instance_id in (SELECT process_instance_id from u_task where form_data_id ='" + periodId + "') ";
|
|
|
String delTask = "DELETE from u_task where form_data_id ='" + periodId + "'";
|
|
|
-
|
|
|
+ Integer type1=type+5;
|
|
|
//查询出当前计量期对应的任务
|
|
|
- String selectTask = "SELECT * from u_task WHERE approval_type = 5 and form_data_id = ? and is_deleted = 0 and status in (1,2)";
|
|
|
- List<Task> list = jdbcTemplate.query(selectTask, new BeanPropertyRowMapper<>(Task.class), periodId);
|
|
|
+ String selectTask = "SELECT * from u_task WHERE approval_type =? and form_data_id = ? and is_deleted = 0 and status in (1,2)";
|
|
|
+ List<Task> list = jdbcTemplate.query(selectTask, new BeanPropertyRowMapper<>(Task.class), type1,periodId);
|
|
|
if (list.size() == 0){
|
|
|
return R.fail("撤销失败:未查出当前计量期对应任务信息");
|
|
|
}
|