linwe
2024-09-03 764d883b5ea3bdc06abbec548b6df0511e567978
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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);
 
        // 遍历
            // 创建任务
    }
}