|
|
|
@ -117,21 +117,6 @@ public class OutEfcodeCpTaskServiceImpl implements IOutEfcodeCpTaskService { |
|
|
|
return baseMapper.updateById(update) > 0; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 修改任务已读状态 |
|
|
|
* |
|
|
|
* @param taskId 任务ID |
|
|
|
* @return 是否修改成功 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Boolean updateIsRead(String taskId) { |
|
|
|
LambdaUpdateWrapper<EfcodeCpTask> wrapper = Wrappers.lambdaUpdate(); |
|
|
|
wrapper.eq(EfcodeCpTask::getId, taskId) |
|
|
|
.set(EfcodeCpTask::getIsRead, 1) |
|
|
|
.set(EfcodeCpTask::getUpdateBy, LoginHelper.getUserId()) |
|
|
|
.set(EfcodeCpTask::getUpdateTime, new Date()); |
|
|
|
return baseMapper.update(null, wrapper) > 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -153,114 +138,22 @@ public class OutEfcodeCpTaskServiceImpl implements IOutEfcodeCpTaskService { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询我的任务列表 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<EfcodeCpTaskVo> queryMyTaskList(Long userId, Date planDate,String searchValue) { |
|
|
|
return baseMapper.selectMyTaskList(userId, planDate,searchValue); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询指定月份中有任务的日期列表 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<String> queryMyTaskDates(Long userId, String yearMonth) { |
|
|
|
return baseMapper.selectMyTaskDates(userId, yearMonth); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询我的任务详情 |
|
|
|
* 校验并批量删除行政执法检查计划-任务信息 |
|
|
|
* |
|
|
|
* @param ids 待删除的主键集合 |
|
|
|
* @param isValid 是否进行有效性校验 |
|
|
|
* @return 是否删除成功 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public EfcodeCpTaskVo queryMyTaskDetail(String planId) { |
|
|
|
EfcodeCpTaskVo detail = baseMapper.selectMyTaskDetail(planId); |
|
|
|
if (detail == null || StringUtils.isBlank(detail.getId())) { |
|
|
|
return detail; |
|
|
|
} |
|
|
|
// 查询同一 task_id 下其他单位的计划(排除当前 planId)
|
|
|
|
List<EfcodeCpPlan> otherPlans = cpPlanMapper.selectList( |
|
|
|
Wrappers.<EfcodeCpPlan>lambdaQuery() |
|
|
|
.eq(EfcodeCpPlan::getTaskId, detail.getId()) |
|
|
|
.ne(EfcodeCpPlan::getId, planId) |
|
|
|
.eq(EfcodeCpPlan::getIsDelete, 0L) |
|
|
|
); |
|
|
|
if (otherPlans != null && !otherPlans.isEmpty()) { |
|
|
|
List<EfcodeCpTaskVo.AssociatedPlan> associated = new ArrayList<>(); |
|
|
|
for (EfcodeCpPlan p : otherPlans) { |
|
|
|
EfcodeCpTaskVo.AssociatedPlan ap = new EfcodeCpTaskVo.AssociatedPlan(); |
|
|
|
ap.setBureauDeptName(p.getBureauDeptName()); |
|
|
|
ap.setEnforceUserNames(p.getEnforceUserNames()); |
|
|
|
ap.setEnforceUserTels(p.getEnforceUserTels()); |
|
|
|
ap.setEnforceContent(p.getEnforceContent()); |
|
|
|
associated.add(ap); |
|
|
|
} |
|
|
|
detail.setAssociatedPlans(associated); |
|
|
|
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) { |
|
|
|
if(isValid){ |
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
} |
|
|
|
return detail; |
|
|
|
return baseMapper.deleteByIds(ids) > 0; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 批量查询关联计划信息(用于列表页第二次请求加载联合执法关联单位信息) |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Map<String, List<EfcodeCpTaskVo.AssociatedPlan>> queryAssociatedPlansBatch(List<String> planIds) { |
|
|
|
Map<String, List<EfcodeCpTaskVo.AssociatedPlan>> result = new HashMap<>(); |
|
|
|
if (planIds == null || planIds.isEmpty()) { |
|
|
|
return result; |
|
|
|
} |
|
|
|
// 1. 查询这些planId对应的计划,获取各自的taskId
|
|
|
|
List<EfcodeCpPlan> sourcePlans = cpPlanMapper.selectList( |
|
|
|
Wrappers.<EfcodeCpPlan>lambdaQuery() |
|
|
|
.in(EfcodeCpPlan::getId, planIds) |
|
|
|
.eq(EfcodeCpPlan::getIsDelete, 0L) |
|
|
|
.isNotNull(EfcodeCpPlan::getTaskId) |
|
|
|
); |
|
|
|
if (sourcePlans == null || sourcePlans.isEmpty()) { |
|
|
|
return result; |
|
|
|
} |
|
|
|
// 2. 收集所有taskId,并建立 planId -> taskId 的映射
|
|
|
|
Map<String, String> planToTask = new HashMap<>(); |
|
|
|
List<String> taskIds = new ArrayList<>(); |
|
|
|
for (EfcodeCpPlan p : sourcePlans) { |
|
|
|
planToTask.put(p.getId(), p.getTaskId()); |
|
|
|
if (!taskIds.contains(p.getTaskId())) { |
|
|
|
taskIds.add(p.getTaskId()); |
|
|
|
} |
|
|
|
} |
|
|
|
// 3. 查询所有相关taskId下的计划(排除当前用户的planId)
|
|
|
|
List<EfcodeCpPlan> allRelatedPlans = cpPlanMapper.selectList( |
|
|
|
Wrappers.<EfcodeCpPlan>lambdaQuery() |
|
|
|
.in(EfcodeCpPlan::getTaskId, taskIds) |
|
|
|
.notIn(EfcodeCpPlan::getId, planIds) |
|
|
|
.eq(EfcodeCpPlan::getIsDelete, 0L) |
|
|
|
); |
|
|
|
if (allRelatedPlans == null || allRelatedPlans.isEmpty()) { |
|
|
|
return result; |
|
|
|
} |
|
|
|
// 4. 按taskId分组
|
|
|
|
Map<String, List<EfcodeCpPlan>> groupedByTask = allRelatedPlans.stream() |
|
|
|
.collect(Collectors.groupingBy(EfcodeCpPlan::getTaskId)); |
|
|
|
// 5. 映射回各planId
|
|
|
|
for (Map.Entry<String, String> entry : planToTask.entrySet()) { |
|
|
|
String planId = entry.getKey(); |
|
|
|
String taskId = entry.getValue(); |
|
|
|
List<EfcodeCpPlan> otherPlans = groupedByTask.get(taskId); |
|
|
|
if (otherPlans != null && !otherPlans.isEmpty()) { |
|
|
|
List<EfcodeCpTaskVo.AssociatedPlan> associated = new ArrayList<>(); |
|
|
|
for (EfcodeCpPlan p : otherPlans) { |
|
|
|
EfcodeCpTaskVo.AssociatedPlan ap = new EfcodeCpTaskVo.AssociatedPlan(); |
|
|
|
ap.setBureauDeptName(p.getBureauDeptName()); |
|
|
|
ap.setEnforceUserNames(p.getEnforceUserNames()); |
|
|
|
ap.setEnforceUserTels(p.getEnforceUserTels()); |
|
|
|
ap.setEnforceContent(p.getEnforceContent()); |
|
|
|
associated.add(ap); |
|
|
|
} |
|
|
|
result.put(planId, associated); |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 强制创建任务(忽略其他条件),根据计划信息直接生成任务记录并回写 plan.task_id |
|
|
|
@ -292,42 +185,4 @@ public class OutEfcodeCpTaskServiceImpl implements IOutEfcodeCpTaskService { |
|
|
|
return task.getId(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 校验并批量删除行政执法检查计划-任务信息 |
|
|
|
* |
|
|
|
* @param ids 待删除的主键集合 |
|
|
|
* @param isValid 是否进行有效性校验 |
|
|
|
* @return 是否删除成功 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) { |
|
|
|
if(isValid){ |
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
} |
|
|
|
return baseMapper.deleteByIds(ids) > 0; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 统计当前用户未读任务数量 |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Long countUnreadTasksForCurrentUser() { |
|
|
|
Integer platformType = LoginHelper.getPlatformType(); |
|
|
|
Long userId = LoginHelper.getUserId(); |
|
|
|
// 默认来源类型:执法任务
|
|
|
|
final Integer sourceType = 4; |
|
|
|
// 执法端:根据用户ID统计
|
|
|
|
if (PlatformTypeEnums.ENFORCEMENT.getKey().equals(platformType)) { |
|
|
|
if (userId == null) { |
|
|
|
log.warn("当前用户未登录,无法统计未读执法任务消息"); |
|
|
|
return 0L; |
|
|
|
} |
|
|
|
return baseMapper.countTasksForCurrentUser(userId,sourceType); |
|
|
|
} |
|
|
|
return 0L; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|