|
@@ -58,6 +58,7 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
|
|
private final BladeRedis bladeRedis;
|
|
private final BladeRedis bladeRedis;
|
|
private final ProjectCostBudgetServiceImpl projectCostBudgetService;
|
|
private final ProjectCostBudgetServiceImpl projectCostBudgetService;
|
|
private final ProjectInfoServiceImpl projectInfoServiceImpl;
|
|
private final ProjectInfoServiceImpl projectInfoServiceImpl;
|
|
|
|
+ private final ProjectCostBudgetStatsServiceImpl projectCostBudgetStatsService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public IPage<TaskProcessInfoVO> taskPage(IPage<TaskProcessInfo> page, TaskProcessInfoDTO dto) {
|
|
public IPage<TaskProcessInfoVO> taskPage(IPage<TaskProcessInfo> page, TaskProcessInfoDTO dto) {
|
|
@@ -177,7 +178,7 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
|
|
EMFinancialReimbursementInfoVO voCW = BeanUtil.copyProperties(data, EMFinancialReimbursementInfoVO.class);
|
|
EMFinancialReimbursementInfoVO voCW = BeanUtil.copyProperties(data, EMFinancialReimbursementInfoVO.class);
|
|
if (voCW != null) {
|
|
if (voCW != null) {
|
|
if (ObjectUtil.isNotEmpty(voCW.getProjectId()) && ObjectUtil.isNotEmpty(voCW.getBudgetPlanIds())) { //如果预算ids不为空,那么证明有关联计划任务(单关联)
|
|
if (ObjectUtil.isNotEmpty(voCW.getProjectId()) && ObjectUtil.isNotEmpty(voCW.getBudgetPlanIds())) { //如果预算ids不为空,那么证明有关联计划任务(单关联)
|
|
- TaskPlanInfoVO planTaskInfoList2 = this.getPlanTaskInfoList(Long.parseLong(voCW.getBudgetPlanIds()), controlProjectInfos);
|
|
|
|
|
|
+ TaskPlanInfoVO planTaskInfoList2 = this.getPlanTaskInfoList(voCW.getBudgetPlanIds(), controlProjectInfos);
|
|
if (planTaskInfoList2 != null) {
|
|
if (planTaskInfoList2 != null) {
|
|
vo.setPlanTaskInfoList(Collections.singletonList(planTaskInfoList2));
|
|
vo.setPlanTaskInfoList(Collections.singletonList(planTaskInfoList2));
|
|
}
|
|
}
|
|
@@ -189,10 +190,21 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
|
|
}
|
|
}
|
|
}
|
|
}
|
|
voCW.setUserNameVesting(userMap.get(voCW.getCreateUser()));
|
|
voCW.setUserNameVesting(userMap.get(voCW.getCreateUser()));
|
|
|
|
+ //获取当前用户是否为财务人员,财务人员修改是否支付状态
|
|
|
|
+ if (ObjectUtil.isEmpty(SecureUtil.getUser())) {
|
|
|
|
+ throw new ServiceException("获取当前用户信息失败,请联系管理员");
|
|
|
|
+ }
|
|
|
|
+ R<Dept> dept = iSysClient.getDept(Long.parseLong(SecureUtil.getDeptId()));
|
|
|
|
+ if (dept != null && dept.getData() != null) {
|
|
|
|
+ Dept deptObj = dept.getData();
|
|
|
|
+ if (deptObj != null && (deptObj.getDeptName().contains("财务") || deptObj.getDeptName().contains("人事"))) {
|
|
|
|
+ voCW.setIsFinancialPersonnel(1); //财务人员
|
|
|
|
+ }
|
|
|
|
+ }
|
|
data = voCW;
|
|
data = voCW;
|
|
}
|
|
}
|
|
-
|
|
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case 3: //支付
|
|
case 3: //支付
|
|
data = jdbcTemplate.query("select * from c_expense_pay_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(EMPayInfo.class)).stream().findAny().orElse(null);
|
|
data = jdbcTemplate.query("select * from c_expense_pay_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(EMPayInfo.class)).stream().findAny().orElse(null);
|
|
break;
|
|
break;
|
|
@@ -208,8 +220,6 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
|
|
case 7: //发票
|
|
case 7: //发票
|
|
data = jdbcTemplate.query("select * from c_expense_invoice_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(EMInvoiceInfo.class)).stream().findAny().orElse(null);
|
|
data = jdbcTemplate.query("select * from c_expense_invoice_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(EMInvoiceInfo.class)).stream().findAny().orElse(null);
|
|
|
|
|
|
- //TODO 此处根据invoiceContentType查询发票字典,封装vo
|
|
|
|
-
|
|
|
|
break;
|
|
break;
|
|
case 8: //外包
|
|
case 8: //外包
|
|
data = jdbcTemplate.query("select * from c_expense_outsourcing_pay_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(EMOutsourcingPayInfo.class)).stream().findAny().orElse(null);
|
|
data = jdbcTemplate.query("select * from c_expense_outsourcing_pay_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(EMOutsourcingPayInfo.class)).stream().findAny().orElse(null);
|
|
@@ -220,15 +230,27 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
|
|
AttendanceTripInfoVO voCC = BeanUtil.copyProperties(data, AttendanceTripInfoVO.class);
|
|
AttendanceTripInfoVO voCC = BeanUtil.copyProperties(data, AttendanceTripInfoVO.class);
|
|
if (voCC != null) {
|
|
if (voCC != null) {
|
|
if (ObjectUtil.isNotEmpty(voCC.getProjectId()) && ObjectUtil.isNotEmpty(voCC.getBudgetPlanIds())) { //如果预算ids不为空,那么证明有关联计划任务(单关联)
|
|
if (ObjectUtil.isNotEmpty(voCC.getProjectId()) && ObjectUtil.isNotEmpty(voCC.getBudgetPlanIds())) { //如果预算ids不为空,那么证明有关联计划任务(单关联)
|
|
- TaskPlanInfoVO planTaskInfoList2 = this.getPlanTaskInfoList(Long.parseLong(voCC.getBudgetPlanIds()), controlProjectInfos);
|
|
|
|
|
|
+ TaskPlanInfoVO planTaskInfoList2 = this.getPlanTaskInfoList(voCC.getBudgetPlanIds(), controlProjectInfos);
|
|
if (planTaskInfoList2 != null) {
|
|
if (planTaskInfoList2 != null) {
|
|
vo.setPlanTaskInfoList(Collections.singletonList(planTaskInfoList2));
|
|
vo.setPlanTaskInfoList(Collections.singletonList(planTaskInfoList2));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
data = voCC;
|
|
data = voCC;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
+ case 10: //成本测算
|
|
|
|
+ List<ProjectCostBudget> query = jdbcTemplate.query("select * from c_project_cost_budget where id in(" + record.getExpenseInfoId() + ")", new BeanPropertyRowMapper<>(ProjectCostBudget.class));
|
|
|
|
+ if (query.size() > 0) {
|
|
|
|
+ Long projectId = query.stream().map(ProjectCostBudget::getProjectId).collect(Collectors.toList()).stream().findAny().orElse(null);
|
|
|
|
+ if (projectId != null) {
|
|
|
|
+ ProjectCostBudgetStats projectCostBudgetStats = jdbcTemplate.query("select * from c_project_cost_budget_stats where project_id = " + projectId, new BeanPropertyRowMapper<>(ProjectCostBudgetStats.class)).stream().findAny().orElse(null);
|
|
|
|
+ TaskProjectCostBudgetVO voCbCs = new TaskProjectCostBudgetVO();
|
|
|
|
+ voCbCs.setProjectCostBudgetList(query);
|
|
|
|
+ voCbCs.setProjectCostBudgetStats(projectCostBudgetStats);
|
|
|
|
+ data = voCbCs;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -600,6 +622,60 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
|
|
return resultMap;
|
|
return resultMap;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public boolean approveCostBudgetSubmit(String id) {
|
|
|
|
+ ProjectCostBudgetStats projectCostBudgetStats = projectCostBudgetStatsService.getBaseMapper().selectById(id);
|
|
|
|
+ if (projectCostBudgetStats != null) {
|
|
|
|
+ List<ProjectCostBudget> projectCostBudgetList = projectCostBudgetService.getBaseMapper().selectList(Wrappers.<ProjectCostBudget>lambdaQuery()
|
|
|
|
+ .eq(ProjectCostBudget::getProjectId, projectCostBudgetStats.getProjectId())
|
|
|
|
+ .eq(ProjectCostBudget::getApprove, 0));//未上报
|
|
|
|
+ if (projectCostBudgetList.size() > 0) {
|
|
|
|
+ //审批人(总经理)
|
|
|
|
+ List<String> auditUserIds = new LinkedList<>();
|
|
|
|
+ List<Dept> query = jdbcTemplate.query("select id from blade_dept where dept_name = '总经理' and tenant_id = 003077 and dept_type = 3", new BeanPropertyRowMapper<>(Dept.class));
|
|
|
|
+ if (query.size() == 1) {
|
|
|
|
+ Dept dept = query.get(0);
|
|
|
|
+ List<User> users = jdbcTemplate.query("select id from blade_user where dept_id like '%" + dept.getId() + "%' and tenant_id = 003077 and is_deleted = 0", new BeanPropertyRowMapper<>(User.class));
|
|
|
|
+ if (users.size() > 0) {
|
|
|
|
+ List<Long> ids = users.stream().map(User::getId).collect(Collectors.toList());
|
|
|
|
+ auditUserIds.add(StringUtils.join(ids, ","));
|
|
|
|
+ } else {
|
|
|
|
+ throw new ServiceException("未获取到总经理岗位人员信息,请联系管理员");
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ throw new ServiceException("未获取到总经理岗位信息,请联系管理员");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //创建审批任务
|
|
|
|
+ TaskProcessInfo taskProcessInfo = new TaskProcessInfo();
|
|
|
|
+ taskProcessInfo.setId(SnowFlakeUtil.getId());
|
|
|
|
+ taskProcessInfo.setStatus(1); //待审批
|
|
|
|
+ taskProcessInfo.setReportDate(new Date());
|
|
|
|
+ taskProcessInfo.setTaskType(10); //成本测算审批
|
|
|
|
+ taskProcessInfo.setTaskName("【" + SecureUtil.getUserName() + "】向您发起【成本测算】审批");
|
|
|
|
+ //上报人
|
|
|
|
+ taskProcessInfo.setReportUserId(SecureUtil.getUserId());
|
|
|
|
+
|
|
|
|
+ List<String> nonEmptyAuditUserIds = new LinkedList<>();
|
|
|
|
+ for (String userId : auditUserIds) {
|
|
|
|
+ if (StringUtils.isNotEmpty(userId)) {
|
|
|
|
+ nonEmptyAuditUserIds.add(userId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ taskProcessInfo.setAuditUserIds(StringUtils.join(nonEmptyAuditUserIds, ","));
|
|
|
|
+
|
|
|
|
+ this.save(taskProcessInfo);
|
|
|
|
+
|
|
|
|
+ //新增审批任务关联信息
|
|
|
|
+ List<String> ids = projectCostBudgetList.stream().map(ProjectCostBudget::getId).map(String::valueOf).collect(Collectors.toList());
|
|
|
|
+ String budgetIds = StringUtils.join(ids, ",");
|
|
|
|
+ jdbcTemplate.execute("insert into c_expense_task_record(id,task_id,expense_info_id,expense_info_type) values (" + SnowFlakeUtil.getId() + "," + taskProcessInfo.getId() + "," + budgetIds + ",10)");
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 修改业务审批状态
|
|
* 修改业务审批状态
|
|
*
|
|
*
|
|
@@ -607,7 +683,7 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
|
|
* @param taskStatus 计划任务状态
|
|
* @param taskStatus 计划任务状态
|
|
* @param dataId 业务id
|
|
* @param dataId 业务id
|
|
*/
|
|
*/
|
|
- private void updateTaskStatus(Integer businessDataType, Integer taskStatus, Long dataId) {
|
|
|
|
|
|
+ private void updateTaskStatus(Integer businessDataType, Integer taskStatus, String dataId) {
|
|
switch (businessDataType) {
|
|
switch (businessDataType) {
|
|
case 1: //计划任务
|
|
case 1: //计划任务
|
|
if (taskStatus == 2) {
|
|
if (taskStatus == 2) {
|
|
@@ -643,6 +719,16 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
|
|
case 9: //出差
|
|
case 9: //出差
|
|
jdbcTemplate.execute("update c_attendance_trip_info set status = " + taskStatus + " where id = " + dataId);
|
|
jdbcTemplate.execute("update c_attendance_trip_info set status = " + taskStatus + " where id = " + dataId);
|
|
break;
|
|
break;
|
|
|
|
+ case 10: //成本测算
|
|
|
|
+ if (taskStatus == 2) {
|
|
|
|
+ //已完成 = 已完成(修改成本测算的数据状态)dataId = ids
|
|
|
|
+ jdbcTemplate.execute("update c_project_cost_budget set approve = 1 where id in(" + dataId + ")");
|
|
|
|
+
|
|
|
|
+ } else if (taskStatus == 3) {
|
|
|
|
+ //已驳回 = 不做处理,驳回后依然是未上报
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -652,7 +738,7 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
|
|
* @param businessDataType 业务类型
|
|
* @param businessDataType 业务类型
|
|
* @param dataId 业务id
|
|
* @param dataId 业务id
|
|
*/
|
|
*/
|
|
- private void processTheServiceDataAfterTheApprovalClosedLoop(Integer businessDataType, Long dataId) {
|
|
|
|
|
|
+ private void processTheServiceDataAfterTheApprovalClosedLoop(Integer businessDataType, String dataId) {
|
|
switch (businessDataType) {
|
|
switch (businessDataType) {
|
|
case 1:
|
|
case 1:
|
|
//计划任务
|
|
//计划任务
|
|
@@ -717,7 +803,7 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
|
|
* @param controlProjectInfos
|
|
* @param controlProjectInfos
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private TaskPlanInfoVO getPlanTaskInfoList(Long id, List<ControlProjectInfo> controlProjectInfos) {
|
|
|
|
|
|
+ private TaskPlanInfoVO getPlanTaskInfoList(String id, List<ControlProjectInfo> controlProjectInfos) {
|
|
ProjectCostBudget planTask = jdbcTemplate.query("select * from c_project_cost_budget where id = " + id, new BeanPropertyRowMapper<>(ProjectCostBudget.class)).stream().findAny().orElse(null);
|
|
ProjectCostBudget planTask = jdbcTemplate.query("select * from c_project_cost_budget where id = " + id, new BeanPropertyRowMapper<>(ProjectCostBudget.class)).stream().findAny().orElse(null);
|
|
if (planTask != null) {
|
|
if (planTask != null) {
|
|
TaskPlanInfoVO planInfoVO = new TaskPlanInfoVO();
|
|
TaskPlanInfoVO planInfoVO = new TaskPlanInfoVO();
|