| New file |
| | |
| | | package org.springblade.modules.task.service.impl; |
| | | |
| | | import org.springblade.modules.threeColorTask.entity.CustomTaskEntity; |
| | | import org.springblade.modules.grid.entity.GridWorkLogEntity; |
| | | import org.springblade.modules.grid.service.IGridWorkLogService; |
| | | import org.springblade.modules.house.entity.UserHouseLabelEntity; |
| | | import org.springblade.modules.house.service.IUserHouseLabelService; |
| | | import org.springblade.modules.house.vo.UserHouseLabelVO; |
| | | import org.springblade.modules.task.service.TaskHandle; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 走访任务ServiceImpl |
| | | */ |
| | | @Component("VisitingTaskHandler") |
| | | public class VisitingTaskHandler implements TaskHandle { |
| | | |
| | | @Autowired |
| | | private IUserHouseLabelService userHouseLabelService; |
| | | |
| | | @Autowired |
| | | private IGridWorkLogService gridWorkLogService; |
| | | @Override |
| | | public void taskHandle(CustomTaskEntity customTask) { |
| | | System.out.println("走访任务"); |
| | | // 查询有标签的颜色的人 |
| | | // List<UserHouseLabelEntity> list = userHouseLabelService.list(Wrappers.<UserHouseLabelEntity>lambdaQuery() |
| | | // .eq(UserHouseLabelEntity::getLableType, 1) |
| | | // .eq(UserHouseLabelEntity::getLabelId, customTask.getLabelId()) |
| | | // .eq(UserHouseLabelEntity::getColor, customTask.getLabelColor()) |
| | | // .isNotNull(UserHouseLabelEntity::getHouseholdId)); |
| | | UserHouseLabelVO userHouseLabelVO = new UserHouseLabelVO(); |
| | | userHouseLabelVO.setLabelId(customTask.getLabelId().longValue()); |
| | | userHouseLabelVO.setColor(customTask.getLabelColor()); |
| | | userHouseLabelVO.setTaskRange(customTask.getTaskRange()); |
| | | List<UserHouseLabelEntity> list = userHouseLabelService.getUserHouseLabelList(userHouseLabelVO); |
| | | List<GridWorkLogEntity> gridWorkLogEntities = new ArrayList<>(); |
| | | list.forEach(userHouseLabelEntity -> { |
| | | // 创建任务 |
| | | GridWorkLogEntity gridWorkLogEntity = new GridWorkLogEntity(); |
| | | gridWorkLogEntity.setType(2); |
| | | gridWorkLogEntity.setHouseholdId(userHouseLabelEntity.getHouseholdId()); |
| | | gridWorkLogEntity.setPersonType(customTask.getLabelId()); |
| | | gridWorkLogEntity.setSource(2); |
| | | gridWorkLogEntity.setStatus(1); |
| | | gridWorkLogEntities.add(gridWorkLogEntity); |
| | | }); |
| | | gridWorkLogService.saveBatch(gridWorkLogEntities); |
| | | |
| | | // 遍历 |
| | | // 创建任务 |
| | | } |
| | | } |