fix(flow): 修正待办事项查询逻辑并新增统计功能

- 修正待办事项查询条件,使用用户ID替代用户名
- 新增待办事项统计接口及实现逻辑
- 调整项目订单信息字段拼写错误(order_tpye → order_type)
- 在XML映射文件中增加approveUser查询条件判断
- 实现按流程类型分组统计数据功能
master
chenhao 2025-12-09 09:10:05 +08:00
parent b4984e6e4b
commit 2899c05e95
5 changed files with 39 additions and 3 deletions

View File

@ -48,7 +48,7 @@ public class TodoController extends BaseController {
@ResponseBody
public TableDataInfo todoList( Todo todo) {
startPage();
todo.setApproveUserName(getSysUser().getUserName());
todo.setApproveUser(getSysUser().getUserId().toString());
List<Todo> list = todoService.selectTodoList(todo);
return getDataTable(list);
}
@ -61,7 +61,7 @@ public class TodoController extends BaseController {
@ResponseBody
public TableDataInfo editSave( Todo todo) {
startPage();
todo.setApproveUserName(getSysUser().getUserName());
todo.setApproveUser(getSysUser().getUserId().toString());
List<Todo> list = todoService.selectTodoCompletedList(todo);
return getDataTable(list);
}
@ -110,4 +110,10 @@ public class TodoController extends BaseController {
public AjaxResult statistics(@RequestBody Todo todo){
return todoService.statistics(todo);
}
@GetMapping("/todo/statistics")
@ResponseBody
public AjaxResult statisticsTodo(){
return todoService.statisticsTodo();
}
}

View File

@ -136,4 +136,9 @@ public interface TodoService
void fillOrderApproveNode(List<ProjectOrderInfo> list);
void fillPurchaseOrderApproveNode(List<OmsPurchaseOrder> list);
AjaxResult statisticsTodo();
}

View File

@ -370,6 +370,29 @@ public class TodoServiceImpl implements TodoService {
}
}
@Override
public AjaxResult statisticsTodo() {
Long userId = ShiroUtils.getUserId();
if (userId == null) {
return AjaxResult.success();
}
List<String> orderKeyList = Arrays.asList(processConfig.getDefinition().getOrderApproveOffline(), processConfig.getDefinition().getOrderApproveOnline());
Todo todo = new Todo();
todo.setApproveUser(userId.toString());
List<Todo> todoList = todoMapper.selectTodoList(todo);
Map<String, Long> map = todoList.stream().collect(Collectors.groupingBy(Todo::getProcessKey, Collectors.counting()));
HashMap<String, Long> resultMap = new HashMap<>();
for (Map.Entry<String, Long> entry : map.entrySet()) {
String key = orderKeyList.contains(entry.getKey()) ? "order_approve" : entry.getKey();
resultMap.compute(key, (k, v) -> {
Long value = entry.getValue() == null ? 0L : entry.getValue();
return v == null ? value : v + value;
});
}
return AjaxResult.success(resultMap);
}
/**
*
*/

View File

@ -44,6 +44,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="taskName != null and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if>
<if test="approveUserName != null and approveUserName != ''">and approve_user_name = #{approveUserName}
</if>
<if test="approveUser != null and approveUser != ''">and approve_user = #{approveUser}
</if>
<if test="applyUserName != null and applyUserName != ''">and apply_user_name like concat('%',
#{applyUserName}, '%')

View File

@ -50,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<sql id="selectProjectOrderInfoRelationVo">
select t1.id, t1.project_id,t1.province, t1.city, t1.business_person, t1.business_email, t1.business_phone, t1.order_code, t1.currencyType,
t1.shipment_amount, t1.actual_purchase_amount, t1.order_end_time, t1.delivery_time, t1.company_delivery, t1.notifier,t1.order_tpye,
t1.shipment_amount, t1.actual_purchase_amount, t1.order_end_time, t1.delivery_time, t1.company_delivery, t1.notifier,t1.order_type,
t1.notifier_email, t1.notifier_phone, t1.duty, t1.duty_email, t1.duty_phone, t1.order_channel, t1.partner_code, t1.supplier,
t1.remark, t1.order_status, t1.create_by, t1.create_time, t1.update_by, t1.update_time,t1.partner_user_name,t1.partner_email
,t1.partner_phone,t1.version_code,t1.process_type,t1.process_template,t1.discount_fold,t1.notifier_address,t1.finance_status,