PDA任务大厅修改

This commit is contained in:
秦鸿展
2026-05-27 17:11:10 +08:00
parent 1280bdd67d
commit 7a2174d626
4 changed files with 46 additions and 23 deletions
@@ -45,10 +45,7 @@ public class DeliveTaskApplicationService {
public List<DeliveTaskPO> queryListApp(DeliveTaskDO deliveTaskDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
deliveTaskDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
applyPdaOrganizationScope(deliveTaskDO, loginUser);
applyPdaWarehouseScope(deliveTaskDO, loginUser);
Long tabType = deliveTaskDO.getTabType();
if (tabType != null && tabType == 1L) {
@@ -113,16 +110,28 @@ public class DeliveTaskApplicationService {
public DeliveTaskPO querySum(DeliveTaskDO deliveTaskDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
deliveTaskDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
deliveTaskDO.setOperatorsBy(loginUser.getUserid());
}
applyPdaOrganizationScope(deliveTaskDO, loginUser);
deliveTaskDO.setOperatorsBy(loginUser.getUserid());
applyPdaWarehouseScope(deliveTaskDO, loginUser);
}
return deliveTaskDomainService.querySum(deliveTaskDO);
}
/**
* PDA:按当前用户 organization_id 过滤(与 delive_task.organization_id 一致);
* 平台超管(topOrganizationId=1) 不按组织过滤。
*/
private static void applyPdaOrganizationScope(DeliveTaskDO deliveTaskDO, LoginUser loginUser) {
if (loginUser.getUserPo() == null) {
return;
}
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
deliveTaskDO.setTopOrganizationId(null);
deliveTaskDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
}
}
/** PDA:按用户绑定仓库过滤任务(与收货/上架等 App 列表一致) */
private static void applyPdaWarehouseScope(DeliveTaskDO deliveTaskDO, LoginUser loginUser) {
if (deliveTaskDO.getWarehouseId() != null) {
@@ -183,6 +183,12 @@ public class DeliveTaskImpl extends ServiceImpl<DeliveTaskMapper, DeliveTask> im
for (DeliveTaskDO deliveTaskDO : deliveTaskDOList){
DeliveTask deliveTask = new DeliveTask();
BeanUtils.copyProperties(deliveTaskDO,deliveTask);
if (deliveTask.getTaskStatus() == null) {
deliveTask.setTaskStatus(0);
}
if (deliveTask.getDelFlag() == null) {
deliveTask.setDelFlag(1);
}
deliveTaskList.add(deliveTask);
NoticeMessageLoggingDto noticeMessageLoggingDto = new NoticeMessageLoggingDto();
noticeMessageLoggingDto.setUserId(deliveTaskDO.getOperatorsBy());
@@ -31,8 +31,8 @@ public class DeliveTaskAppApi extends BaseController {
private DeliveTaskAssembler deliveTaskAssembler;
/**
* 分页查询下发任务列表。条件:del_flag=1、当前一级组织、绑定仓库(未传 warehouseId 时取用户仓库绑定)、
* {@code tabType=2} 任务大厅(operators_by 为空,含收货/上架/拣货等自动下发任务)、
* 分页查询下发任务列表。条件:del_flag=1、当前用户 organization_id、绑定仓库(未传 warehouseId 时取用户仓库绑定)、
* {@code tabType=2} 任务大厅(operators_name 为空,含收货/上架/拣货等自动下发任务)、
* {@code tabType=1} 指派给我的(operators_by=当前用户);不按 task_status 默认过滤。
*/
@ApiOperation("查询下发任务列表")
@@ -54,6 +54,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select deliver_task_id, task_number, tracking_number, organization_id, organization_name, top_organization_id, warehouse_id, warehouse_code, warehouse_name, task_type, task_status, task_distribution, task_distribution_time, task_distribution_id, task_distribution_name, operators_by, operators_name, remark, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag, reassign_time, reassign_by_id, reassign_by_name from delive_task
</sql>
<!-- taskStatus=0 未接收:历史数据 task_status 可能为 NULL,与 0 等价 -->
<sql id="deliveTaskStatusFilter">
<if test="taskStatus != null and taskStatus == 0">
and (task_status = 0 OR task_status IS NULL)
</if>
<if test="taskStatus != null and taskStatus != 0">
and task_status = #{taskStatus}
</if>
</sql>
<!-- 任务大厅 tabType=2:未指派作业人(按 operators_name 判断,与现场查询口径一致) -->
<sql id="deliveTaskHallUnassignedFilter">
and (operators_name IS NULL OR operators_name = '')
</sql>
<sql id="selectDeliveTaskPo1">
<where>
del_flag = 1
@@ -99,9 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskType != null and taskType == 7 and handoverQueryType == 2">
and EXISTS (SELECT 1 FROM handover_task_order hto WHERE hto.task_number = delive_task.tracking_number AND hto.del_flag = 1 AND hto.status = 2)
</if>
<if test="taskStatus != null ">
and task_status = #{taskStatus}
</if>
<include refid="deliveTaskStatusFilter"/>
<if test="taskDistribution != null ">
and task_distribution = #{taskDistribution}
</if>
@@ -181,9 +194,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskType != null and taskType == 7 and handoverQueryType == 2">
and EXISTS (SELECT 1 FROM handover_task_order hto WHERE hto.task_number = delive_task.tracking_number AND hto.del_flag = 1 AND hto.status = 2)
</if>
<if test="taskStatus != null ">
and task_status = #{taskStatus}
</if>
<include refid="deliveTaskStatusFilter"/>
<if test="taskDistribution != null ">
and task_distribution = #{taskDistribution}
</if>
@@ -200,7 +211,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and operators_by = #{operatorsBy}
</if>
<if test="tabType != null and tabType==2">
and operators_by IS NULL
<include refid="deliveTaskHallUnassignedFilter"/>
</if>
<if test="operatorsName != null and operatorsName != ''">
and operators_name like concat('%', #{operatorsName}, '%')
@@ -254,9 +265,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskType != null and taskType == 7 and handoverQueryType == 2">
and EXISTS (SELECT 1 FROM handover_task_order hto WHERE hto.task_number = delive_task.tracking_number AND hto.del_flag = 1 AND hto.status = 2)
</if>
<if test="taskStatus != null ">
and task_status = #{taskStatus}
</if>
<include refid="deliveTaskStatusFilter"/>
<if test="taskDistribution != null ">
and task_distribution = #{taskDistribution}
</if>
@@ -386,8 +395,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delive_task
WHERE
del_flag = 1
AND (operators_by = ''
OR operators_by IS NULL)
<include refid="deliveTaskHallUnassignedFilter"/>
<include refid="selectDeliveTaskPo2"/>
) taskSum