fix(bpm): 修复报销和借款相关问题

- 修改报销查询条件,使用月份格式比较时间- 更新报销和借款关联方式,使用 LEFT JOIN
- 在报销流程中添加工厂 ID 变量- 优化借款查询 SQL,移除不必要的条件
This commit is contained in:
furongxin 2025-04-10 01:20:06 +08:00
parent c80164578b
commit f1b88b349a
3 changed files with 7 additions and 8 deletions

View File

@ -112,6 +112,7 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
String type = bpmOAExpensesItemDOS.stream().map(item -> item.getType().toString()).collect(Collectors.joining(",")); String type = bpmOAExpensesItemDOS.stream().map(item -> item.getType().toString()).collect(Collectors.joining(","));
processInstanceVariables.put("type", type); processInstanceVariables.put("type", type);
processInstanceVariables.put("factoryType", expenses.getFactoryType()); processInstanceVariables.put("factoryType", expenses.getFactoryType());
processInstanceVariables.put("factory_id", bpmOAExpensesItemDOS.get(0).getDeptId());
String processInstanceId = processInstanceService.createProcessInstance(userId, String processInstanceId = processInstanceService.createProcessInstance(userId,
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY) new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(expenses.getId()))); .setVariables(processInstanceVariables).setBusinessKey(String.valueOf(expenses.getId())));

View File

@ -52,10 +52,10 @@
</if> </if>
<if test="pageReqVO.endTime != null and pageReqVO.endTime.length > 0"> <if test="pageReqVO.endTime != null and pageReqVO.endTime.length > 0">
<if test="pageReqVO.endTime[0] != null"> <if test="pageReqVO.endTime[0] != null">
and c.end_time &gt;= #{pageReqVO.endTime[0]} and DATE_FORMAT(c.end_time, '%Y-%m') &gt;= #{pageReqVO.endTime[0]}
</if> </if>
<if test="pageReqVO.endTime[1] != null"> <if test="pageReqVO.endTime[1] != null">
and c.end_time &lt;= #{pageReqVO.endTime[1]} and DATE_FORMAT(c.end_time, '%Y-%m') &lt;= #{pageReqVO.endTime[1]}
</if> </if>
</if> </if>
ORDER BY c.end_time DESC, a.expenses_id ORDER BY c.end_time DESC, a.expenses_id
@ -68,8 +68,8 @@
SUM(a.total_money) - SUM(a.amount_paid) AS remainingPayable SUM(a.total_money) - SUM(a.amount_paid) AS remainingPayable
FROM FROM
bpm_oa_expenses a bpm_oa_expenses a
JOIN bpm_oa_expenses_item b ON b.expenses_id = b.id LEFT JOIN bpm_oa_expenses_item b ON b.expenses_id = a.id
JOIN bpm_process_instance_ext c ON c.process_instance_id = a.process_instance_id LEFT JOIN bpm_process_instance_ext c ON c.process_instance_id = a.process_instance_id
WHERE WHERE
a.deleted = 0 a.deleted = 0
AND b.deleted = 0 AND b.deleted = 0
@ -88,10 +88,10 @@
</if> </if>
<if test="pageReqVO.endTime != null and pageReqVO.endTime.length > 0"> <if test="pageReqVO.endTime != null and pageReqVO.endTime.length > 0">
<if test="pageReqVO.endTime[0] != null"> <if test="pageReqVO.endTime[0] != null">
and c.end_time &gt;= #{pageReqVO.endTime[0]} and DATE_FORMAT(c.end_time, '%Y-%m') &gt;= #{pageReqVO.endTime[0]}
</if> </if>
<if test="pageReqVO.endTime[1] != null"> <if test="pageReqVO.endTime[1] != null">
and c.end_time &lt;= #{pageReqVO.endTime[1]} and DATE_FORMAT(c.end_time, '%Y-%m') &lt;= #{pageReqVO.endTime[1]}
</if> </if>
</if> </if>
</select> </select>

View File

@ -59,7 +59,6 @@
1 AS type 1 AS type
FROM FROM
bpm_oa_expenses e bpm_oa_expenses e
JOIN bpm_oa_loan l ON e.user_id = l.user_id AND l.sf_user_id = #{pageReqVO.staffId}
LEFT JOIN system_users u ON e.user_id = u.id LEFT JOIN system_users u ON e.user_id = u.id
LEFT JOIN system_dept d ON u.dept_id = d.id LEFT JOIN system_dept d ON u.dept_id = d.id
LEFT JOIN bpm_process_instance_ext p ON e.process_instance_id = p.process_instance_id LEFT JOIN bpm_process_instance_ext p ON e.process_instance_id = p.process_instance_id
@ -67,7 +66,6 @@
e.deleted = 0 e.deleted = 0
AND e.result = 2 AND e.result = 2
AND e.status = 2 AND e.status = 2
AND l.deleted = 0
AND u.deleted = 0 AND u.deleted = 0
AND d.deleted = 0 AND d.deleted = 0
AND p.deleted = 0 AND p.deleted = 0