From 764d883b5ea3bdc06abbec548b6df0511e567978 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Tue, 03 Sep 2024 09:46:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/binlog' into binlog

---
 src/main/java/org/springblade/modules/task/service/impl/VisitingTaskHandler.java |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/src/main/java/org/springblade/modules/task/service/impl/VisitingTaskHandler.java b/src/main/java/org/springblade/modules/task/service/impl/VisitingTaskHandler.java
new file mode 100644
index 0000000..925b23d
--- /dev/null
+++ b/src/main/java/org/springblade/modules/task/service/impl/VisitingTaskHandler.java
@@ -0,0 +1,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);
+
+		// 遍历
+			// 创建任务
+	}
+}

--
Gitblit v1.9.3