|
@@ -36,6 +36,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.Duration;
|
|
|
import java.time.LocalDate;
|
|
@@ -161,8 +162,13 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
|
|
|
|
|
|
//获取计划任务更改状态记录信息
|
|
|
data = jdbcTemplate.query("select * from c_task_plan_update_status_info where approve_task_id = " + id, new BeanPropertyRowMapper<>(TaskPlanUpdateStatusInfo.class));
|
|
|
- break;
|
|
|
+ TaskPlanUpdateStatusInfoVO voRW = BeanUtil.copyProperties(data, TaskPlanUpdateStatusInfoVO.class);
|
|
|
+ if (voRW != null) {
|
|
|
+ voRW.setTransferObjectName(userMap.get(voRW.getTransferObject()));
|
|
|
+ data = voRW;
|
|
|
+ }
|
|
|
|
|
|
+ break;
|
|
|
case 2: //财务
|
|
|
data = jdbcTemplate.query("select * from c_expense_financial_reimbursement_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(EMFinancialReimbursementInfo.class)).stream().findAny().orElse(null);
|
|
|
EMFinancialReimbursementInfoVO voCW = BeanUtil.copyProperties(data, EMFinancialReimbursementInfoVO.class);
|
|
@@ -519,7 +525,7 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
|
|
|
* 修改业务审批状态
|
|
|
*
|
|
|
* @param businessDataType 业务类型
|
|
|
- * @param taskStatus 任务状态
|
|
|
+ * @param taskStatus 计划任务状态
|
|
|
* @param dataId 业务id
|
|
|
*/
|
|
|
private void updateTaskStatus(Integer businessDataType, Integer taskStatus, Long dataId) {
|
|
@@ -570,28 +576,81 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
|
|
|
*/
|
|
|
private void processTheServiceDataAfterTheApprovalClosedLoop(Integer businessDataType, Long dataId) {
|
|
|
switch (businessDataType) {
|
|
|
- case 1: //计划任务
|
|
|
- //TODO 处理计划任务List
|
|
|
+ case 1: //计划任务 计划任务金额统计、推送到对应项目中
|
|
|
+ ProjectCostBudget projectCostBudget = jdbcTemplate.query("select * from c_project_cost_budget where id = " + dataId, new BeanPropertyRowMapper<>(ProjectCostBudget.class)).stream().findAny().orElse(null);
|
|
|
+ if (projectCostBudget != null && projectCostBudget.getStatus().equals(4)) {
|
|
|
+ //已完成任务进行金额统计 budget_count_money(预算总金额) = actual_total_money(实际总金额)
|
|
|
+ projectCostBudgetService.update(Wrappers.<ProjectCostBudget>lambdaUpdate().set(ProjectCostBudget::getActualTotalMoney, projectCostBudget.getBudgetCountMoney()).eq(ProjectCostBudget::getId, projectCostBudget.getId()));
|
|
|
+ }
|
|
|
|
|
|
break;
|
|
|
- case 2: //财务 TODO 财务与预算计划关联
|
|
|
+ case 2: //财务
|
|
|
EMFinancialReimbursementInfo emFinancialReimbursementInfo = jdbcTemplate.query("select * from c_expense_financial_reimbursement_info where id = " + dataId, new BeanPropertyRowMapper<>(EMFinancialReimbursementInfo.class)).stream().findAny().orElse(null);
|
|
|
+ if (emFinancialReimbursementInfo != null && emFinancialReimbursementInfo.getStatus().equals(2)) {
|
|
|
+ //已审批财务报销进行金额统计
|
|
|
+
|
|
|
+ //处理借款抵扣金额(如果存在借款抵扣,那么扣除相应借款金额)
|
|
|
+ if (ObjectUtil.isNotEmpty(emFinancialReimbursementInfo.getFrMoney()) && emFinancialReimbursementInfo.getIsDeductLoan() == 1 && ObjectUtil.isNotEmpty(emFinancialReimbursementInfo.getDeductLoanId())) {
|
|
|
+ //获取借款金额(已审批、提交的借款金额数据)
|
|
|
+ EMLoanInfo emLoanInfo = jdbcTemplate.query("select id,loan_money from c_expense_loan_info where is_deleted = 0 and status = 2 and is_temp = 1 and id = " + emFinancialReimbursementInfo.getDeductLoanId(), new BeanPropertyRowMapper<>(EMLoanInfo.class)).stream().findAny().orElse(null);
|
|
|
+ if (emLoanInfo != null && ObjectUtil.isNotEmpty(emLoanInfo.getLoanMoney())) {
|
|
|
+ BigDecimal frMoney = emFinancialReimbursementInfo.getFrMoney(); //当前报销金额
|
|
|
+ BigDecimal loanMoney = emLoanInfo.getLoanMoney(); //当前借款金额
|
|
|
+ int result = frMoney.compareTo(loanMoney);
|
|
|
+ if (result < 0) { //如果借款金额大于报销金额,那么抵扣借款,无实际放款
|
|
|
+ BigDecimal difference = frMoney.subtract(loanMoney).abs(); //剩余借款金额
|
|
|
+ if (ObjectUtil.isNotEmpty(difference)) {
|
|
|
+ //借款
|
|
|
+ jdbcTemplate.execute("update from c_expense_loan_info set loan_money = " + difference + " where id = " + emLoanInfo.getId());
|
|
|
+ //实际报销金额
|
|
|
+ jdbcTemplate.execute("update from c_expense_financial_reimbursement_info set fr_money_actual = 0 where id = " + emFinancialReimbursementInfo.getId());
|
|
|
+ }
|
|
|
+ } else if (result == 0) { //相同,抵扣完成
|
|
|
+ //借款
|
|
|
+ jdbcTemplate.execute("update from c_expense_loan_info set loan_money = 0 where id = " + emLoanInfo.getId());
|
|
|
+ //实际报销金额
|
|
|
+ jdbcTemplate.execute("update from c_expense_financial_reimbursement_info set fr_money_actual = 0 where id = " + emFinancialReimbursementInfo.getId());
|
|
|
+ } else { //如果借款金额小于报销金额,那么抵扣完借款,还要实际放款
|
|
|
+ BigDecimal difference = frMoney.subtract(loanMoney).abs(); //实际放款金额
|
|
|
+ if (ObjectUtil.isNotEmpty(difference)) {
|
|
|
+ //借款
|
|
|
+ jdbcTemplate.execute("update from c_expense_loan_info set loan_money = 0 where id = " + emLoanInfo.getId());
|
|
|
+ //实际报销金额
|
|
|
+ jdbcTemplate.execute("update from c_expense_financial_reimbursement_info set fr_money_actual = " + difference + " where id = " + emFinancialReimbursementInfo.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
break;
|
|
|
case 3: //支付 TODO 请款金额与项目关联
|
|
|
EMPayInfo emPayInfo = jdbcTemplate.query("select * from c_expense_pay_info where id = " + dataId, new BeanPropertyRowMapper<>(EMPayInfo.class)).stream().findAny().orElse(null);
|
|
|
+ if (emPayInfo != null && emPayInfo.getStatus().equals(2)) {
|
|
|
+ //已审批支付审批进行金额统计
|
|
|
+ }
|
|
|
|
|
|
break;
|
|
|
case 4: //借款 TODO 借款与财务报销的抵消关联
|
|
|
EMLoanInfo emLoanInfo = jdbcTemplate.query("select * from c_expense_loan_info where id = " + dataId, new BeanPropertyRowMapper<>(EMLoanInfo.class)).stream().findAny().orElse(null);
|
|
|
+ if (emLoanInfo != null && emLoanInfo.getStatus().equals(2)) {
|
|
|
+ //已审批借款审批进行金额统计
|
|
|
+ }
|
|
|
|
|
|
break;
|
|
|
case 5: //采购 TODO 采购与经营预算关联
|
|
|
EMPurchaseInfo emPurchaseInfo = jdbcTemplate.query("select * from c_expense_purchase_info where id = " + dataId, new BeanPropertyRowMapper<>(EMPurchaseInfo.class)).stream().findAny().orElse(null);
|
|
|
+ if (emPurchaseInfo != null && emPurchaseInfo.getStatus().equals(2)) {
|
|
|
+ //已审批采购审批进行金额统计
|
|
|
+ }
|
|
|
|
|
|
break;
|
|
|
case 8: //外包 TODO 外包支付与项目关联
|
|
|
EMOutsourcingPayInfo emOutsourcingPayInfo = jdbcTemplate.query("select * from c_expense_outsourcing_pay_info where id = " + dataId, new BeanPropertyRowMapper<>(EMOutsourcingPayInfo.class)).stream().findAny().orElse(null);
|
|
|
+ if (emOutsourcingPayInfo != null && emOutsourcingPayInfo.getStatus().equals(2)) {
|
|
|
+ //已审批外包支付进行金额统计
|
|
|
+ }
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
}
|