From a1eede2f9f7c2590952ab1bdf34210020cdde7c6 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 02 Aug 2024 13:21:56 +0800
Subject: [PATCH] 三色任务和自查任务

---
 src/main/java/org/springblade/modules/customTask/dto/CustomTaskDTO.java                    |   34 +
 src/main/java/org/springblade/modules/eCallEventTwo/service/impl/EcOrderServiceImpl.java   |   42 +
 src/main/java/org/springblade/modules/task/entity/TaskPlaceSelfCheckEntity.java            |    2 
 src/main/java/org/springblade/modules/task/service/impl/TaskPlaceSelfCheckServiceImpl.java |   40 +
 src/main/java/org/springblade/modules/customTask/mapper/CustomTaskMapper.xml               |   94 ++++
 src/main/java/org/springblade/modules/customTask/entity/CustomTaskEntity.java              |  128 ++++++
 src/main/java/org/springblade/modules/task/service/impl/SelfExaminationTaskHandler.java    |   76 +++
 src/main/java/org/springblade/modules/place/mapper/PlaceMapper.java                        |    8 
 src/main/java/org/springblade/modules/place/service/IPlaceService.java                     |    4 
 src/main/java/org/springblade/modules/task/service/impl/VisitingTaskHandler.java           |   52 ++
 src/main/java/org/springblade/modules/task/mapper/TaskMapper.xml                           |    2 
 src/main/java/org/springblade/modules/task/entity/TaskEntity.java                          |    2 
 src/main/java/com/xxl/job/core/enums/taskHandlerEnum.java                                  |   35 +
 src/main/java/org/springblade/modules/task/service/impl/TaskServiceImpl.java               |   13 
 src/main/java/org/springblade/modules/customTask/vo/CustomTaskVO.java                      |   35 +
 src/main/java/org/springblade/modules/task/service/TaskHandle.java                         |    7 
 src/main/java/org/springblade/modules/customTask/service/impl/CustomTaskServiceImpl.java   |  137 ++++++
 src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java             |   13 
 src/main/java/org/springblade/modules/customTask/wrapper/CustomTaskWrapper.java            |   50 ++
 src/main/java/org/springblade/modules/system/entity/TreeNodeTwo.java                       |   12 
 src/main/java/org/springblade/modules/customTask/service/ICustomTaskService.java           |   75 +++
 src/main/resources/application-test.yml                                                    |    4 
 src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml                         |   79 +++
 src/main/java/org/springblade/xxljob/jobhandler/LabelHandleJob.java                        |    6 
 src/main/java/org/springblade/modules/customTask/controller/CustomTaskController.java      |  126 ++++++
 src/main/java/org/springblade/modules/system/mapper/DictBizMapper.xml                      |    4 
 src/main/java/org/springblade/modules/customTask/mapper/CustomTaskMapper.java              |   61 +++
 27 files changed, 1,094 insertions(+), 47 deletions(-)

diff --git a/src/main/java/com/xxl/job/core/enums/taskHandlerEnum.java b/src/main/java/com/xxl/job/core/enums/taskHandlerEnum.java
new file mode 100644
index 0000000..b02d09d
--- /dev/null
+++ b/src/main/java/com/xxl/job/core/enums/taskHandlerEnum.java
@@ -0,0 +1,35 @@
+package com.xxl.job.core.enums;
+
+/**
+ *
+ */
+public enum taskHandlerEnum {
+	VISITING_TASK("0", "VisitingTaskHandler"),
+	SELFEXAMINATION_TASK("1", "SelfExaminationTaskHandler");
+	final String code;
+
+	final String name;
+
+	public String getCode() {
+		return code;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	taskHandlerEnum(String code, String name) {
+		this.code = code;
+		this.name = name;
+	}
+
+	public static String getNameByCode(String code) {
+		taskHandlerEnum[] payHandlerEnums = values();
+		for (taskHandlerEnum payHandlerEnum : payHandlerEnums) {
+			if (payHandlerEnum.getCode().equals(code)) {
+				return payHandlerEnum.getName();
+			}
+		}
+		return null;
+	}
+}
diff --git a/src/main/java/org/springblade/modules/customTask/controller/CustomTaskController.java b/src/main/java/org/springblade/modules/customTask/controller/CustomTaskController.java
new file mode 100644
index 0000000..71852b3
--- /dev/null
+++ b/src/main/java/org/springblade/modules/customTask/controller/CustomTaskController.java
@@ -0,0 +1,126 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.customTask.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.secure.BladeUser;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.customTask.entity.CustomTaskEntity;
+import org.springblade.modules.customTask.vo.CustomTaskVO;
+import org.springblade.modules.customTask.wrapper.CustomTaskWrapper;
+import org.springblade.modules.customTask.service.ICustomTaskService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 自定义任务表 控制器
+ *
+ * @author BladeX
+ * @since 2024-07-30
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("blade-customTask/customTask")
+@Api(value = "自定义任务表", tags = "自定义任务表接口")
+public class CustomTaskController extends BladeController {
+
+	private final ICustomTaskService customTaskService;
+
+	/**
+	 * 自定义任务表 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入customTask")
+	public R<CustomTaskVO> detail(CustomTaskEntity customTask) {
+		CustomTaskEntity detail = customTaskService.getOne(Condition.getQueryWrapper(customTask));
+		return R.data(CustomTaskWrapper.build().entityVO(detail));
+	}
+	/**
+	 * 自定义任务表 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入customTask")
+	public R<IPage<CustomTaskVO>> list(CustomTaskEntity customTask, Query query) {
+		IPage<CustomTaskEntity> pages = customTaskService.page(Condition.getPage(query), Condition.getQueryWrapper(customTask));
+		return R.data(CustomTaskWrapper.build().pageVO(pages));
+	}
+
+	/**
+	 * 自定义任务表 自定义分页
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入customTask")
+	public R<IPage<CustomTaskVO>> page(CustomTaskVO customTask, Query query) {
+		IPage<CustomTaskVO> pages = customTaskService.selectCustomTaskPage(Condition.getPage(query), customTask);
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义任务表 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入customTask")
+	public R save(@Valid @RequestBody CustomTaskEntity customTask) {
+		return R.status(customTaskService.saveCustomTask(customTask));
+	}
+
+	/**
+	 * 自定义任务表 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入customTask")
+	public R update(@Valid @RequestBody CustomTaskEntity customTask) {
+		return R.status(customTaskService.updateCustomTask(customTask));
+	}
+
+	/**
+	 * 自定义任务表 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入customTask")
+	public R submit(@Valid @RequestBody CustomTaskEntity customTask) {
+		return R.status(customTaskService.saveOrUpdate(customTask));
+	}
+
+	/**
+	 * 自定义任务表 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(customTaskService.removeBatchByIds(Func.toLongList(ids)));
+	}
+
+
+}
diff --git a/src/main/java/org/springblade/modules/customTask/dto/CustomTaskDTO.java b/src/main/java/org/springblade/modules/customTask/dto/CustomTaskDTO.java
new file mode 100644
index 0000000..20b1c5a
--- /dev/null
+++ b/src/main/java/org/springblade/modules/customTask/dto/CustomTaskDTO.java
@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.customTask.dto;
+
+import org.springblade.modules.customTask.entity.CustomTaskEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 自定义任务表 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2024-07-30
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CustomTaskDTO extends CustomTaskEntity {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/customTask/entity/CustomTaskEntity.java b/src/main/java/org/springblade/modules/customTask/entity/CustomTaskEntity.java
new file mode 100644
index 0000000..9abce73
--- /dev/null
+++ b/src/main/java/org/springblade/modules/customTask/entity/CustomTaskEntity.java
@@ -0,0 +1,128 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.customTask.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import lombok.Data;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.util.Date;
+
+/**
+ * 自定义任务表对象 jczz_custom_task
+ *
+ * @author ${context.author}
+ * @date 2024-07-30 16:50:32
+ */
+@ApiModel(value = "CustomTask对象" , description = "自定义任务表")
+@Data
+@TableName("jczz_custom_task")
+public class CustomTaskEntity  {
+
+
+	private static final long serialVersionUID = 1L;
+
+
+	@JsonSerialize(using = ToStringSerializer.class)
+	@ApiModelProperty("主键id")
+	@TableId(value = "id", type = IdType.ASSIGN_ID)
+	private Long id;
+
+	/** 任务名称 */
+	@ApiModelProperty(value = "任务名称", example = "")
+	@TableField("name")
+	private String name;
+
+	/** 1.走访任务 2.自查任务 */
+	@ApiModelProperty(value = "1.走访任务 2.自查任务", example = "")
+	@TableField("task_type")
+	private String taskType;
+
+	/** 标签id */
+	@ApiModelProperty(value = "标签id", example = "")
+	@TableField("label_id")
+	private Integer labelId;
+
+	/** 标签颜色 */
+	@ApiModelProperty(value = "标签颜色", example = "")
+	@TableField("label_color")
+	private String labelColor;
+
+	/** 分类id */
+	@ApiModelProperty(value = "分类id", example = "")
+	@TableField("place_label")
+	private Integer placeLabel;
+
+
+	/** 分类id */
+	@ApiModelProperty(value = "分类id", example = "")
+	@TableField("place_small_label")
+	private Integer placeSmallLabel;
+
+	/** 九小类型 */
+	@ApiModelProperty(value = "九小类型", example = "")
+	@TableField("nineType")
+	private Integer nineType;
+
+	/** 0 :否  1 :是 */
+	@ApiModelProperty(value = "0 :否  1 :是", example = "")
+	@TableField("delete_flag")
+	private Integer deleteFlag;
+
+	/** 更新时间 */
+	@ApiModelProperty(value = "更新时间", example = "")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+	@TableField("update_time")
+	private Date updateTime;
+
+	/** 创建时间 */
+	@ApiModelProperty(value = "创建时间", example = "")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+	@TableField("create_time")
+	private Date createTime;
+
+	/** 创建人 */
+	@ApiModelProperty(value = "创建人", example = "")
+	@TableField("create_by")
+	private Long createBy;
+
+	/** 更新人 */
+	@ApiModelProperty(value = "更新人", example = "")
+	@TableField("update_by")
+	private Long updateBy;
+
+	@ApiModelProperty(value = "cron表达式", example = "")
+	@TableField("cron")
+	private String cron;
+
+	@ApiModelProperty(value = "任务状态", example = "")
+	@TableField("task_status")
+	private Integer taskStatus;
+
+	@ApiModelProperty(value = "任务id", example = "")
+	@TableField("job_id")
+	private Integer jobId;
+}
diff --git a/src/main/java/org/springblade/modules/customTask/mapper/CustomTaskMapper.java b/src/main/java/org/springblade/modules/customTask/mapper/CustomTaskMapper.java
new file mode 100644
index 0000000..883d3f3
--- /dev/null
+++ b/src/main/java/org/springblade/modules/customTask/mapper/CustomTaskMapper.java
@@ -0,0 +1,61 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.customTask.mapper;
+
+import org.apache.ibatis.annotations.Param;
+import org.springblade.modules.customTask.dto.CustomTaskDTO;
+import org.springblade.modules.customTask.entity.CustomTaskEntity;
+import org.springblade.modules.customTask.vo.CustomTaskVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 自定义任务表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2024-07-30
+ */
+public interface CustomTaskMapper extends BaseMapper<CustomTaskEntity> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param customTask
+	 * @return
+	 */
+	List<CustomTaskVO> selectCustomTaskPage(IPage page, @Param("customTask") CustomTaskVO customTask);
+
+
+	/**
+	 * 查询自定义任务表
+	 *
+	 * @param id 自定义任务表ID
+	 * @return 自定义任务表
+	 */
+	public CustomTaskDTO selectCustomTaskById(Integer id);
+
+	/**
+	 * 查询自定义任务表列表
+	 *
+	 * @param customTaskDTO 自定义任务表
+	 * @return 自定义任务表集合
+	 */
+	public List<CustomTaskDTO> selectCustomTaskList(CustomTaskDTO customTaskDTO);
+
+}
diff --git a/src/main/java/org/springblade/modules/customTask/mapper/CustomTaskMapper.xml b/src/main/java/org/springblade/modules/customTask/mapper/CustomTaskMapper.xml
new file mode 100644
index 0000000..ec87125
--- /dev/null
+++ b/src/main/java/org/springblade/modules/customTask/mapper/CustomTaskMapper.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.modules.customTask.mapper.CustomTaskMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="customTaskResultMap" type="org.springblade.modules.customTask.entity.CustomTaskEntity">
+    </resultMap>
+
+
+    <select id="selectCustomTaskPage" resultMap="customTaskResultMap">
+        <include refid="selectCustomTask"/>
+        <where>
+            <if test="customTask.id != null "> and id = #{customTask.id}</if>
+            <if test="customTask.name != null  and customTask.name != ''"> and name = #{customTask.name}</if>
+            <if test="customTask.taskType != null  and customTask.taskType != ''"> and task_type = #{customTask.taskType}</if>
+            <if test="customTask.labelId != null "> and label_id = #{customTask.labelId}</if>
+            <if test="customTask.labelColor != null  and customTask.labelColor != ''"> and label_color = #{customTask.labelColor}</if>
+            <if test="customTask.placeLabel != null "> and place_label = #{placeLabel}</if>
+            <if test="customTask.placeSmallLabel != null  and customTask.placeSmallLabel != ''"> and place_small_label = #{customTask.placeSmallLabel}</if>
+            <if test="customTask.nineType != null "> and nineType = #{customTask.nineType}</if>
+            <if test="customTask.deleteFlag != null "> and delete_flag = #{customTask.deleteFlag}</if>
+            <if test="customTask.updateTime != null "> and update_time = #{customTask.updateTime}</if>
+            <if test="customTask.createTime != null "> and create_time = #{customTask.createTime}</if>
+            <if test="customTask.createBy != null "> and create_by = #{customTask.createBy}</if>
+            <if test="customTask.updateBy != null "> and update_by = #{customTask.updateBy}</if>
+            <if test="customTask.cron != null  and customTask.cron != ''"> and cron = #{customTask.cron}</if>
+            <if test="customTask.taskStatus != null  and customTask.taskStatus != ''"> and task_status = #{customTask.taskStatus}</if>
+            <if test="customTask.jobId != null "> and job_id = #{customTask.jobId}</if>
+        </where>
+    </select>
+
+
+    <resultMap type="org.springblade.modules.customTask.dto.CustomTaskDTO" id="CustomTaskDTOResult">
+        <result property="id"    column="id"    />
+        <result property="name"    column="name"    />
+        <result property="taskType"    column="task_type"    />
+        <result property="labelId"    column="label_id"    />
+        <result property="labelColor"    column="label_color"    />
+        <result property="placeLabel"    column="place_label"    />
+        <result property="placeSmallLabel"    column="place_small_label"    />
+        <result property="nineType"    column="nineType"    />
+        <result property="deleteFlag"    column="delete_flag"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="cron"    column="cron"    />
+        <result property="taskStatus"    column="task_status"    />
+        <result property="jobId"    column="job_id"    />
+    </resultMap>
+
+    <sql id="selectCustomTask">
+        select
+            id,
+            name,
+            task_type,
+            label_id,
+            label_color,
+            category_id,
+            nineType,
+            delete_flag,
+            update_time,
+            create_time,
+            create_by,
+            update_by
+        from
+            jczz_custom_task
+    </sql>
+
+    <select id="selectCustomTaskById" parameterType="int" resultMap="CustomTaskDTOResult">
+        <include refid="selectCustomTask"/>
+        where
+        id = #{id}
+    </select>
+
+    <select id="selectCustomTaskList" parameterType="org.springblade.modules.customTask.dto.CustomTaskDTO" resultMap="CustomTaskDTOResult">
+        <include refid="selectCustomTask"/>
+        <where>
+            <if test="id != null "> and id = #{id}</if>
+            <if test="name != null  and name != ''"> and name = #{name}</if>
+            <if test="taskType != null  and taskType != ''"> and task_type = #{taskType}</if>
+            <if test="labelId != null "> and label_id = #{labelId}</if>
+            <if test="labelColor != null  and labelColor != ''"> and label_color = #{labelColor}</if>
+            <if test="categoryId != null "> and category_id = #{categoryId}</if>
+            <if test="nineType != null "> and nineType = #{nineType}</if>
+            <if test="deleteFlag != null "> and delete_flag = #{deleteFlag}</if>
+            <if test="updateTime != null "> and update_time = #{updateTime}</if>
+            <if test="createTime != null "> and create_time = #{createTime}</if>
+            <if test="createBy != null "> and create_by = #{createBy}</if>
+            <if test="updateBy != null "> and update_by = #{updateBy}</if>
+        </where>
+    </select>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/customTask/service/ICustomTaskService.java b/src/main/java/org/springblade/modules/customTask/service/ICustomTaskService.java
new file mode 100644
index 0000000..2e4d021
--- /dev/null
+++ b/src/main/java/org/springblade/modules/customTask/service/ICustomTaskService.java
@@ -0,0 +1,75 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.customTask.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.customTask.dto.CustomTaskDTO;
+import org.springblade.modules.customTask.entity.CustomTaskEntity;
+import org.springblade.modules.customTask.vo.CustomTaskVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.util.List;
+
+/**
+ * 自定义任务表 服务类
+ *
+ * @author BladeX
+ * @since 2024-07-30
+ */
+public interface ICustomTaskService extends IService<CustomTaskEntity> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param customTask
+	 * @return
+	 */
+	IPage<CustomTaskVO> selectCustomTaskPage(IPage<CustomTaskVO> page, CustomTaskVO customTask);
+
+
+	/**
+	 * 查询自定义任务表
+	 *
+	 * @param id 自定义任务表ID
+	 * @return 自定义任务表
+	 */
+	public CustomTaskDTO selectCustomTaskById(Integer id);
+
+	/**
+	 * 查询自定义任务表列表
+	 *
+	 * @param customTaskDTO 自定义任务表
+	 * @return 自定义任务表集合
+	 */
+	public List<CustomTaskDTO> selectCustomTaskList(CustomTaskDTO customTaskDTO);
+
+	/**
+	 * 新增自定义任务表
+	 * @param customTask
+	 * @return
+	 */
+	boolean saveCustomTask(CustomTaskEntity customTask);
+
+	/**
+	 * 修改自定义任务表
+	 * @param customTask
+	 * @return
+	 */
+	boolean updateCustomTask(CustomTaskEntity customTask);
+}
diff --git a/src/main/java/org/springblade/modules/customTask/service/impl/CustomTaskServiceImpl.java b/src/main/java/org/springblade/modules/customTask/service/impl/CustomTaskServiceImpl.java
new file mode 100644
index 0000000..5b65c5b
--- /dev/null
+++ b/src/main/java/org/springblade/modules/customTask/service/impl/CustomTaskServiceImpl.java
@@ -0,0 +1,137 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.customTask.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.modules.customTask.dto.CustomTaskDTO;
+import org.springblade.modules.customTask.entity.CustomTaskEntity;
+import org.springblade.modules.customTask.mapper.CustomTaskMapper;
+import org.springblade.modules.customTask.service.ICustomTaskService;
+import org.springblade.modules.customTask.vo.CustomTaskVO;
+import org.springblade.xxljob.entity.JobInfoEntity;
+import org.springblade.xxljob.service.IJobInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 自定义任务表 服务实现类
+ *
+ * @author BladeX
+ * @since 2024-07-30
+ */
+@Service
+public class CustomTaskServiceImpl extends ServiceImpl<CustomTaskMapper, CustomTaskEntity> implements ICustomTaskService {
+
+	@Override
+	public IPage<CustomTaskVO> selectCustomTaskPage(IPage<CustomTaskVO> page, CustomTaskVO customTask) {
+		return page.setRecords(baseMapper.selectCustomTaskPage(page, customTask));
+	}
+
+
+	/**
+	 * 查询自定义任务表
+	 *
+	 * @param id 自定义任务表ID
+	 * @return 自定义任务表
+	 */
+	@Override
+	public CustomTaskDTO selectCustomTaskById(Integer id) {
+		return this.baseMapper.selectCustomTaskById(id);
+	}
+
+	/**
+	 * 查询自定义任务表列表
+	 *
+	 * @param customTaskDTO 自定义任务表
+	 * @return 自定义任务表集合
+	 */
+	@Override
+	public List<CustomTaskDTO> selectCustomTaskList(CustomTaskDTO customTaskDTO) {
+		return this.baseMapper.selectCustomTaskList(customTaskDTO);
+	}
+
+	@Autowired
+	private IJobInfoService jobInfoService;
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public boolean updateCustomTask(CustomTaskEntity customTask) {
+		boolean update = updateById(customTask);
+		if (!update) {
+			return update;
+		}
+		JobInfoEntity jobInfoEntity = jobInfoService.getById(customTask.getJobId());
+		jobInfoEntity.setScheduleConf(customTask.getCron());
+		Integer taskStatus = customTask.getTaskStatus() - 1;
+		jobInfoEntity.setTriggerStatus(taskStatus.byteValue());
+		jobInfoEntity.setExecutorParam(JSON.toJSONString(customTask));
+		jobInfoEntity.setJobDesc(customTask.getName());
+		boolean update1 = jobInfoService.updateById(jobInfoEntity);
+		if (!update1) {
+			throw new RuntimeException("更新任务表失败");
+		}
+		return update;
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public boolean saveCustomTask(CustomTaskEntity customTask) {
+		// 保存自定义任务表
+		save(customTask);
+		// 保存任务表
+		JobInfoEntity jobInfoEntity = new JobInfoEntity();
+		jobInfoEntity.setJobDesc(customTask.getName());
+		jobInfoEntity.setScheduleConf(customTask.getCron());
+		jobInfoEntity.setJobGroup(1);
+		jobInfoEntity.setScheduleType("CRON");
+		jobInfoEntity.setExecutorRouteStrategy("FIRST");
+		jobInfoEntity.setExecutorHandler("threeColourJobHandler");
+		jobInfoEntity.setExecutorParam(JSON.toJSONString(customTask));
+		jobInfoEntity.setExecutorBlockStrategy("SERIAL_EXECUTION");
+		jobInfoEntity.setGlueType("BEAN");
+		jobInfoEntity.setGlueSource("");
+		jobInfoEntity.setGlueRemark("GLUE代码初始化");
+		Integer taskStatus = customTask.getTaskStatus() - 1;
+		jobInfoEntity.setTriggerStatus(taskStatus.byteValue());
+		jobInfoEntity.setTriggerLastTime(0L);
+		jobInfoEntity.setTriggerNextTime(0L);
+		jobInfoEntity.setAuthor("林伟");
+		jobInfoEntity.setAlarmEmail("872216696@qq.com");
+		jobInfoEntity.setExecutorFailRetryCount(0);
+		jobInfoEntity.setGlueUpdatetime(DateUtil.now());
+		jobInfoEntity.setAddTime(DateUtil.now());
+		jobInfoEntity.setUpdateTime(DateUtil.now());
+		jobInfoEntity.setMisfireStrategy("DO_NOTHING");
+		jobInfoEntity.setExecutorTimeout(0);
+		boolean save1 = jobInfoService.save(jobInfoEntity);
+		if (!save1) {
+			throw new RuntimeException("保存任务表失败");
+		}
+		customTask.setJobId(jobInfoEntity.getId());
+		boolean update = updateById(customTask);
+		if (!update) {
+			throw new RuntimeException("更新自定义任务表失败");
+		}
+		return update;
+	}
+}
diff --git a/src/main/java/org/springblade/modules/customTask/vo/CustomTaskVO.java b/src/main/java/org/springblade/modules/customTask/vo/CustomTaskVO.java
new file mode 100644
index 0000000..8e3ec87
--- /dev/null
+++ b/src/main/java/org/springblade/modules/customTask/vo/CustomTaskVO.java
@@ -0,0 +1,35 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.customTask.vo;
+
+import org.springblade.modules.customTask.entity.CustomTaskEntity;
+import org.springblade.core.tool.node.INode;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 自定义任务表 视图实体类
+ *
+ * @author BladeX
+ * @since 2024-07-30
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CustomTaskVO extends CustomTaskEntity {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/customTask/wrapper/CustomTaskWrapper.java b/src/main/java/org/springblade/modules/customTask/wrapper/CustomTaskWrapper.java
new file mode 100644
index 0000000..7154ee5
--- /dev/null
+++ b/src/main/java/org/springblade/modules/customTask/wrapper/CustomTaskWrapper.java
@@ -0,0 +1,50 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.customTask.wrapper;
+
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.modules.customTask.entity.CustomTaskEntity;
+import org.springblade.modules.customTask.vo.CustomTaskVO;
+import java.util.Objects;
+
+/**
+ * 自定义任务表 包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2024-07-30
+ */
+public class CustomTaskWrapper extends BaseEntityWrapper<CustomTaskEntity, CustomTaskVO>  {
+
+	public static CustomTaskWrapper build() {
+		return new CustomTaskWrapper();
+ 	}
+
+	@Override
+	public CustomTaskVO entityVO(CustomTaskEntity customTask) {
+		CustomTaskVO customTaskVO = Objects.requireNonNull(BeanUtil.copy(customTask, CustomTaskVO.class));
+
+		//User createUser = UserCache.getUser(customTask.getCreateUser());
+		//User updateUser = UserCache.getUser(customTask.getUpdateUser());
+		//customTaskVO.setCreateUserName(createUser.getName());
+		//customTaskVO.setUpdateUserName(updateUser.getName());
+
+		return customTaskVO;
+	}
+
+
+}
diff --git a/src/main/java/org/springblade/modules/eCallEventTwo/service/impl/EcOrderServiceImpl.java b/src/main/java/org/springblade/modules/eCallEventTwo/service/impl/EcOrderServiceImpl.java
index c16dfe0..35c5e79 100644
--- a/src/main/java/org/springblade/modules/eCallEventTwo/service/impl/EcOrderServiceImpl.java
+++ b/src/main/java/org/springblade/modules/eCallEventTwo/service/impl/EcOrderServiceImpl.java
@@ -1,7 +1,6 @@
 package org.springblade.modules.eCallEventTwo.service.impl;
 
 import cn.hutool.core.convert.Convert;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -142,6 +141,7 @@
 			recordEntityList.forEach(record -> {
 				long count1 = ecOrderService.count(Wrappers.<ECallEventTwoEntity>lambdaQuery().eq(ECallEventTwoEntity::getOrderCode, record.getOrderCode()));
 				if (count1 == 0) {
+					setGridInfo(record);
 					addList.add(record);
 				} else {
 					updateList.add(record);
@@ -172,24 +172,28 @@
 	 * @param ecOrderEntity
 	 */
 	public void setGridInfo(ECallEventTwoEntity ecOrderEntity) {
-		if (ecOrderEntity.getSceneGeoLng() == null || ecOrderEntity.getSceneGeoLat() == null) {
-			return;
-		}
-		// 根据位置设置网格,警格编号
-		IGridService gridService = SpringUtils.getBean(IGridService.class);
-		IPoliceAffairsGridService policeAffairsGridService = SpringUtils.getBean(IPoliceAffairsGridService.class);
-		String point = "'POINT(" + ecOrderEntity.getSceneGeoLng().toString() + " " + ecOrderEntity.getSceneGeoLat().toString() + ")'";
-		// 点坐标解析网格
-		List<GridEntity> gridEntityList = gridService.spatialAnalysis(point);
-		if (gridEntityList.size() > 0) {
-			GridEntity gridEntity = gridEntityList.get(0);
-			ecOrderEntity.setGridCode(gridEntity.getGridCode());
-		}
-		// 点坐标解析警格
-		List<PoliceAffairsGridEntity> policeAffairsGridEntityList = policeAffairsGridService.spatialAnalysis(point);
-		if (policeAffairsGridEntityList.size() > 0) {
-			PoliceAffairsGridEntity policeAffairsGridEntity = policeAffairsGridEntityList.get(0);
-			ecOrderEntity.setJwGridCode(policeAffairsGridEntity.getJwGridCode());
+		try {
+			if (ecOrderEntity.getSceneGeoLng() == null || ecOrderEntity.getSceneGeoLat() == null) {
+				return;
+			}
+			// 根据位置设置网格,警格编号
+			IGridService gridService = SpringUtils.getBean(IGridService.class);
+			IPoliceAffairsGridService policeAffairsGridService = SpringUtils.getBean(IPoliceAffairsGridService.class);
+			String point = "'POINT(" + ecOrderEntity.getSceneGeoLng().toString() + " " + ecOrderEntity.getSceneGeoLat().toString() + ")'";
+			// 点坐标解析网格
+			List<GridEntity> gridEntityList = gridService.spatialAnalysis(point);
+			if (gridEntityList.size() > 0) {
+				GridEntity gridEntity = gridEntityList.get(0);
+				ecOrderEntity.setGridCode(gridEntity.getGridCode());
+			}
+			// 点坐标解析警格
+			List<PoliceAffairsGridEntity> policeAffairsGridEntityList = policeAffairsGridService.spatialAnalysis(point);
+			if (policeAffairsGridEntityList.size() > 0) {
+				PoliceAffairsGridEntity policeAffairsGridEntity = policeAffairsGridEntityList.get(0);
+				ecOrderEntity.setJwGridCode(policeAffairsGridEntity.getJwGridCode());
+			}
+		} catch (Exception e) {
+			System.out.println("获取警格网格信息失败" + e);
 		}
 	}
 
diff --git a/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.java b/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.java
index 7a98db9..26617b8 100644
--- a/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.java
+++ b/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.java
@@ -53,6 +53,14 @@
 								  @Param("isAdministrator") Integer isAdministrator);
 
 	/**
+	 *  自定义分页
+	 * @param page
+	 * @param place
+	 * @return
+	 */
+	List<PlaceVO> getPlacePage(IPage page,  @Param("place") PlaceVO place);
+
+	/**
 	 * 九小场所档案
 	 *
 	 * @param page
diff --git a/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml b/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
index 318eea5..e1f65f4 100644
--- a/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
+++ b/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
@@ -1113,4 +1113,83 @@
         ORDER BY distance limit 60
     </select>
 
+
+    <select id="getPlacePage" resultType="org.springblade.modules.place.vo.PlaceVO">
+        select
+        jp.id,
+        jp.house_code,
+        jp.house_code_binds,
+        jp.building_code,
+        jp.principal_user_id,
+        jp.principal,
+        jp.principal_phone,
+        jp.principal_id_card,
+        jp.place_name,
+        jp.lng,
+        jp.lat,
+        jp.location,
+        jp.image_urls,
+        jp.grid_id,
+        jp.grid_code,
+        jp.jw_grid_code,
+        jp.source,
+        jp.status,
+        jp.is_scene,
+        jp.is_nine,
+        jp.nine_type,
+        jp.is_front,
+        jp.front_type,
+        jp.create_user,
+        jp.create_time,
+        jp.update_user,
+        jp.update_time,
+        jp.remark,
+        jp.is_deleted,
+        jp.aoi_code,
+        jp.three_fire_protection,
+        jp.no_explosion_category,
+        jp.principal_account,
+        jp.universal_account
+        from
+        jczz_place jp
+        LEFT JOIN jczz_place_poi_label jppl ON jppl.place_id = jp.id
+        <where>
+            <if test="place.id != null "> and id = #{place.id}</if>
+            <if test="place.houseCode != null  and place.houseCode != ''"> and house_code = #{place.houseCode}</if>
+            <if test="place.houseCodeBinds != null  and place.houseCodeBinds != ''"> and house_code_binds = #{place.houseCodeBinds}</if>
+            <if test="place.buildingCode != null  and place.buildingCode != ''"> and building_code = #{place.buildingCode}</if>
+            <if test="place.principalUserId != null "> and principal_user_id = #{place.principalUserId}</if>
+            <if test="place.principal != null  and place.principal != ''"> and principal = #{place.principal}</if>
+            <if test="place.principalPhone != null  and place.principalPhone != ''"> and principal_phone = #{place.principalPhone}</if>
+            <if test="place.principalIdCard != null  and place.principalIdCard != ''"> and principal_id_card = #{place.principalIdCard}</if>
+            <if test="place.placeName != null  and place.placeName != ''"> and place_name = #{place.placeName}</if>
+            <if test="place.lng != null  and place.lng != ''"> and lng = #{place.lng}</if>
+            <if test="place.lat != null  and place.lat != ''"> and lat = #{place.lat}</if>
+            <if test="place.location != null  and place.location != ''"> and location = #{place.location}</if>
+            <if test="place.imageUrls != null  and place.imageUrls != ''"> and image_urls = #{place.imageUrls}</if>
+            <if test="place.gridId != null "> and grid_id = #{place.gridId}</if>
+            <if test="place.gridCode != null  and place.gridCode != ''"> and grid_code = #{place.gridCode}</if>
+            <if test="place.jwGridCode != null  and place.jwGridCode != ''"> and jw_grid_code = #{place.jwGridCode}</if>
+            <if test="place.source != null "> and source = #{place.source}</if>
+            <if test="place.status != null "> and status = #{place.status}</if>
+            <if test="place.isScene != null "> and is_scene = #{place.isScene}</if>
+            <if test="place.isNine != null "> and is_nine = #{place.isNine}</if>
+            <if test="place.nineType != null "> and nine_type = #{place.nineType}</if>
+            <if test="place.isFront != null "> and is_front = #{place.isFront}</if>
+            <if test="place.frontType != null "> and front_type = #{place.frontType}</if>
+            <if test="place.createUser != null "> and create_user = #{place.createUser}</if>
+            <if test="place.createTime != null "> and create_time = #{place.createTime}</if>
+            <if test="place.updateUser != null "> and update_user = #{place.updateUser}</if>
+            <if test="place.updateTime != null "> and update_time = #{place.updateTime}</if>
+            <if test="place.remark != null  and place.remark != ''"> and remark = #{place.remark}</if>
+            <if test="place.isDeleted != null "> and is_deleted = #{place.isDeleted}</if>
+            <if test="place.aoiCode != null  and place.aoiCode != ''"> and aoi_code = #{place.aoiCode}</if>
+            <if test="place.threeFireProtection != null "> and three_fire_protection = #{place.threeFireProtection}</if>
+            <if test="place.noExplosionCategory != null "> and no_explosion_category = #{place.noExplosionCategory}</if>
+            <if test="place.principalAccount != null "> and principal_account = #{place.principalAccount}</if>
+            <if test="place.universalAccount != null "> and universal_account = #{place.universalAccount}</if>
+            <if test="place.poiCodes != null "> and jppl.poi_code = #{place.poiCodes}</if>
+        </where>
+    </select>
+
 </mapper>
diff --git a/src/main/java/org/springblade/modules/place/service/IPlaceService.java b/src/main/java/org/springblade/modules/place/service/IPlaceService.java
index f12abda..3fcb80e 100644
--- a/src/main/java/org/springblade/modules/place/service/IPlaceService.java
+++ b/src/main/java/org/springblade/modules/place/service/IPlaceService.java
@@ -17,6 +17,7 @@
 package org.springblade.modules.place.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.apache.ibatis.annotations.Param;
 import org.springblade.common.node.TreeStringNode;
 import org.springblade.modules.place.entity.PlaceEntity;
 import org.springblade.modules.place.excel.ExportPlaceExcel;
@@ -45,6 +46,9 @@
 	 */
 	IPage<PlaceVO> selectPlacePage(IPage<PlaceVO> page, PlaceVO place);
 
+
+	IPage<PlaceVO> getPlacePage(IPage<PlaceVO> page,   PlaceVO place);
+
 	/**
 	 * 查询场所集合信息
 	 *
diff --git a/src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java b/src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java
index 80b4eca..2580e9d 100644
--- a/src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java
+++ b/src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java
@@ -131,6 +131,19 @@
 	}
 
 	/**
+	 *  查询场所集合信息
+	 * @param page
+	 * @param place
+	 * @return
+	 */
+	@Override
+	public IPage<PlaceVO> getPlacePage(IPage<PlaceVO> page, PlaceVO place) {
+		List<PlaceVO> placeVOS = baseMapper.getPlacePage(page, place);
+		// 返回
+		return page.setRecords(placeVOS);
+	}
+
+	/**
 	 * 查询场所集合信息
 	 *
 	 * @param userId
diff --git a/src/main/java/org/springblade/modules/system/entity/TreeNodeTwo.java b/src/main/java/org/springblade/modules/system/entity/TreeNodeTwo.java
new file mode 100644
index 0000000..a06fbed
--- /dev/null
+++ b/src/main/java/org/springblade/modules/system/entity/TreeNodeTwo.java
@@ -0,0 +1,12 @@
+package org.springblade.modules.system.entity;
+
+
+import lombok.Data;
+import org.springblade.core.tool.node.TreeNode;
+
+@Data
+public class TreeNodeTwo extends TreeNode {
+
+	private String remark;
+
+}
diff --git a/src/main/java/org/springblade/modules/system/mapper/DictBizMapper.xml b/src/main/java/org/springblade/modules/system/mapper/DictBizMapper.xml
index 2a95d91..9264842 100644
--- a/src/main/java/org/springblade/modules/system/mapper/DictBizMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/DictBizMapper.xml
@@ -15,11 +15,12 @@
         <result column="is_deleted" property="isDeleted"/>
     </resultMap>
 
-    <resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode">
+    <resultMap id="treeNodeResultMap" type="org.springblade.modules.system.entity.TreeNodeTwo">
         <id column="id" property="id"/>
         <result column="parent_id" property="parentId"/>
         <result column="title" property="title"/>
         <result column="value" property="value"/>
+        <result column="remark" property="remark"/>
         <result column="key" property="key"/>
     </resultMap>
 
@@ -65,6 +66,7 @@
         dict_value AS title,
         id AS "value",
         dict_key AS "key",
+        remark,
         (
         SELECT
         CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
diff --git a/src/main/java/org/springblade/modules/task/entity/TaskEntity.java b/src/main/java/org/springblade/modules/task/entity/TaskEntity.java
index 9509d83..4f44985 100644
--- a/src/main/java/org/springblade/modules/task/entity/TaskEntity.java
+++ b/src/main/java/org/springblade/modules/task/entity/TaskEntity.java
@@ -63,7 +63,7 @@
 	private String houseCode;
 
 	/** 事件类型(1:取保候审,2.居住证申请 3 统战部事件上报 5二手交易 6.无诈 7.消防自查任务 8 九小整改任务) */
-	@ApiModelProperty(value = "事件类型(1:取保候审,2.居住证申请 3 统战部事件上报 4校园安全 5二手交易 6.无诈 7.消防自查任务 8 九小整改任务  )", example = "")
+	@ApiModelProperty(value = "事件类型(1:取保候审,2.居住证申请 3 统战部事件上报 4校园安全 5二手交易 6.无诈 7.消防自查任务 8 九小整改任务   )", example = "")
 	@TableField("report_type")
 	private Integer reportType;
 	/**
diff --git a/src/main/java/org/springblade/modules/task/entity/TaskPlaceSelfCheckEntity.java b/src/main/java/org/springblade/modules/task/entity/TaskPlaceSelfCheckEntity.java
index 72d1e5e..73bd522 100644
--- a/src/main/java/org/springblade/modules/task/entity/TaskPlaceSelfCheckEntity.java
+++ b/src/main/java/org/springblade/modules/task/entity/TaskPlaceSelfCheckEntity.java
@@ -125,7 +125,7 @@
 	private String imageUrls;
 
 	/** 任务状态: 1:待接收  2:审核中 3:审核通过 4:审核不通过 */
-	@ApiModelProperty(value = "任务状态: 1:待接收  2:审核中 3:审核通过 4:审核不通过", example = "")
+	@ApiModelProperty(value = "任务状态: 1:待接收  2:审核中 3:审核通过  4: 待提交(待接收)", example = "")
 	@TableField("status")
 	private Integer status;
 
diff --git a/src/main/java/org/springblade/modules/task/mapper/TaskMapper.xml b/src/main/java/org/springblade/modules/task/mapper/TaskMapper.xml
index 363dd84..164526f 100644
--- a/src/main/java/org/springblade/modules/task/mapper/TaskMapper.xml
+++ b/src/main/java/org/springblade/modules/task/mapper/TaskMapper.xml
@@ -156,7 +156,7 @@
                 and jt.report_type = #{task.reportType}
             </if>
             <if test="task.reportType == null">
-                and jt.report_type in ( 5,8)
+                and jt.report_type in ( 5,7,8)
             </if>
             and jt.is_deleted = 0
             and jt.house_code is not null
diff --git a/src/main/java/org/springblade/modules/task/service/TaskHandle.java b/src/main/java/org/springblade/modules/task/service/TaskHandle.java
new file mode 100644
index 0000000..1130365
--- /dev/null
+++ b/src/main/java/org/springblade/modules/task/service/TaskHandle.java
@@ -0,0 +1,7 @@
+package org.springblade.modules.task.service;
+
+import org.springblade.modules.customTask.entity.CustomTaskEntity;
+
+public interface TaskHandle {
+	void taskHandle(CustomTaskEntity customTask);
+}
diff --git a/src/main/java/org/springblade/modules/task/service/impl/SelfExaminationTaskHandler.java b/src/main/java/org/springblade/modules/task/service/impl/SelfExaminationTaskHandler.java
new file mode 100644
index 0000000..1a7439c
--- /dev/null
+++ b/src/main/java/org/springblade/modules/task/service/impl/SelfExaminationTaskHandler.java
@@ -0,0 +1,76 @@
+package org.springblade.modules.task.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.common.utils.SpringUtils;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.modules.customTask.entity.CustomTaskEntity;
+import org.springblade.modules.place.service.IPlaceService;
+import org.springblade.modules.place.vo.PlaceVO;
+import org.springblade.modules.task.entity.TaskEntity;
+import org.springblade.modules.task.entity.TaskPlaceSelfCheckEntity;
+import org.springblade.modules.task.service.ITaskPlaceSelfCheckService;
+import org.springblade.modules.task.service.ITaskService;
+import org.springblade.modules.task.service.TaskHandle;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+/**
+ * 自查任务ServiceImpl
+ */
+@Component("SelfExaminationTaskHandler")
+public class SelfExaminationTaskHandler implements TaskHandle {
+
+	@Autowired
+	private IPlaceService placeService;
+
+	@Autowired
+	private ITaskPlaceSelfCheckService taskPlaceSelfCheckService;
+
+	@Override
+	public void taskHandle(CustomTaskEntity customTask) {
+		try {
+			Query query = new Query();
+			IPage<PlaceVO> page = Condition.getPage(query);
+			PlaceVO placeVO = new PlaceVO();
+			placeVO.setPoiCodes(customTask.getPlaceLabel().toString());
+			placeVO.setNineType(customTask.getNineType());
+			IPage<PlaceVO> placePage = placeService.getPlacePage(page, placeVO);
+			ITaskService iTaskService = SpringUtils.getBean(ITaskService.class);
+			// 计算总页数
+			long pages = placePage.getPages();
+			for (int i = 1; i <= pages; i++) {
+				page = Condition.getPage(query);
+				page.setCurrent(i);
+				placePage = placeService.getPlacePage(page, placeVO);
+				placePage.getRecords().forEach(place -> {
+					TaskEntity taskEntity = new TaskEntity();
+					taskEntity.setType(1);
+					taskEntity.setName("自查");
+					taskEntity.setCreateTime(new Date());
+					taskEntity.setHouseCode(place.getHouseCode());
+					taskEntity.setReportType(7);
+					taskEntity.setStatus(4);
+					taskEntity.setFrequency(2);
+					// taskEntitiesList.add(taskEntity);
+					iTaskService.save(taskEntity);
+
+					TaskPlaceSelfCheckEntity taskPlaceSelfCheck = new TaskPlaceSelfCheckEntity();
+					taskPlaceSelfCheck.setTaskId(taskEntity.getId());
+					taskPlaceSelfCheck.setHouseCode(place.getHouseCode());
+					taskPlaceSelfCheck.setPlaceName(place.getPlaceName());
+					taskPlaceSelfCheck.setStatus(4);
+					taskPlaceSelfCheckService.save(taskPlaceSelfCheck);
+					// taskPlaceSelfCheckList.add(taskPlaceSelfCheck);
+				});
+			}
+		} catch (Exception e) {
+			System.out.println("自查任务异常" + e);
+		}
+		// iTaskService.saveBatch(taskEntitiesList);
+		// boolean save = taskPlaceSelfCheckService.saveBatch(taskPlaceSelfCheckList);
+
+	}
+}
diff --git a/src/main/java/org/springblade/modules/task/service/impl/TaskPlaceSelfCheckServiceImpl.java b/src/main/java/org/springblade/modules/task/service/impl/TaskPlaceSelfCheckServiceImpl.java
index bc76d30..3c11448 100644
--- a/src/main/java/org/springblade/modules/task/service/impl/TaskPlaceSelfCheckServiceImpl.java
+++ b/src/main/java/org/springblade/modules/task/service/impl/TaskPlaceSelfCheckServiceImpl.java
@@ -33,6 +33,7 @@
 import org.springblade.modules.system.entity.DictBiz;
 import org.springblade.modules.system.service.IDictBizService;
 import org.springblade.modules.task.dto.TaskPlaceSelfCheckDTO;
+import org.springblade.modules.task.entity.TaskEntity;
 import org.springblade.modules.task.entity.TaskPlaceRecordEntity;
 import org.springblade.modules.task.entity.TaskPlaceSelfCheckEntity;
 import org.springblade.modules.task.excel.TaskPlaceSelfCheckExcel;
@@ -157,27 +158,34 @@
 				isState.set(true);
 			}
 		}
-		if (StringUtils.isNotBlank(taskPlaceSelfCheck.getType()) && taskPlaceSelfCheck.getType().equals("2")) {
-			// 不存在隐患。状态直接为已审核
-			if (!isState.get()) {
-				taskPlaceSelfCheck.setStatus(2);
-				taskPlaceSelfCheck.setRectificationFlag(3);
+		if (taskPlaceSelfCheck.getTaskId() == null) {
+			if (StringUtils.isNotBlank(taskPlaceSelfCheck.getType()) && taskPlaceSelfCheck.getType().equals("2")) {
+				// 不存在隐患。状态直接为已审核
+				if (!isState.get()) {
+					taskPlaceSelfCheck.setStatus(2);
+					taskPlaceSelfCheck.setRectificationFlag(3);
+				} else {
+					taskPlaceSelfCheck.setStatus(1);
+					taskPlaceSelfCheck.setRectificationFlag(1);
+				}
+				restults = iTaskService.saveTask(CommonConstant.NUMBER_ONE, DictConstant.FIRE_SCHOOL_CHECK_NOTICE, 1,
+					"", AuthUtil.getUserId(), taskPlaceSelfCheck.getHouseCode(), CommonConstant.NUMBER_FOUR, taskPlaceSelfCheck.getStatus());
 			} else {
-				taskPlaceSelfCheck.setStatus(1);
-				taskPlaceSelfCheck.setRectificationFlag(1);
+				restults = iTaskService.saveTask(CommonConstant.NUMBER_ONE, DictConstant.FIRE_SELF_CHECK_NOTICE, 1,
+					"", AuthUtil.getUserId(), taskPlaceSelfCheck.getHouseCode(), CommonConstant.NUMBER_SEVEN, 1);
 			}
-			restults = iTaskService.saveTask(CommonConstant.NUMBER_ONE, DictConstant.FIRE_SCHOOL_CHECK_NOTICE, 1,
-				"", AuthUtil.getUserId(), taskPlaceSelfCheck.getHouseCode(), CommonConstant.NUMBER_FOUR, taskPlaceSelfCheck.getStatus());
+			if (restults <= 0) {
+				return false;
+			}
+			taskPlaceSelfCheck.setTaskId(restults);
 		} else {
-			restults = iTaskService.saveTask(CommonConstant.NUMBER_ONE, DictConstant.FIRE_SELF_CHECK_NOTICE, 1,
-				"", AuthUtil.getUserId(), taskPlaceSelfCheck.getHouseCode(), CommonConstant.NUMBER_SEVEN, 1);
+			iTaskService.update(Wrappers.<TaskEntity>lambdaUpdate()
+				.set(TaskEntity::getStatus, taskPlaceSelfCheck.getStatus())
+				.eq(TaskEntity::getId, taskPlaceSelfCheck.getTaskId()));
 		}
-		if (restults <= 0) {
-			return false;
-		}
-		taskPlaceSelfCheck.setTaskId(restults);
+
 		// 2.保存任务详情
-		boolean save = save(taskPlaceSelfCheck);
+		boolean save = saveOrUpdate(taskPlaceSelfCheck);
 		if (save) {
 			// 3.保存题目记录
 			taskPlaceRecordList.stream().forEach(item -> {
diff --git a/src/main/java/org/springblade/modules/task/service/impl/TaskServiceImpl.java b/src/main/java/org/springblade/modules/task/service/impl/TaskServiceImpl.java
index 4fa71e6..b892c18 100644
--- a/src/main/java/org/springblade/modules/task/service/impl/TaskServiceImpl.java
+++ b/src/main/java/org/springblade/modules/task/service/impl/TaskServiceImpl.java
@@ -26,6 +26,7 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.itextpdf.text.log.Logger;
 import com.itextpdf.text.log.LoggerFactory;
+import com.xxl.job.core.enums.taskHandlerEnum;
 import org.apache.commons.lang3.StringUtils;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.constant.DictConstant;
@@ -36,6 +37,7 @@
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.modules.category.entity.CategoryEntity;
 import org.springblade.modules.category.service.ICategoryService;
+import org.springblade.modules.customTask.entity.CustomTaskEntity;
 import org.springblade.modules.grid.entity.GridEntity;
 import org.springblade.modules.grid.entity.GridWorkLogEntity;
 import org.springblade.modules.grid.service.IGridService;
@@ -389,9 +391,10 @@
 	@Transactional(rollbackFor = Exception.class)
 	public boolean createTaskJob(String param) {
 		// 解析参数
-		JSONObject jsonParam = JSON.parseObject(param);
+		CustomTaskEntity customTaskEntity = JSON.parseObject(param, CustomTaskEntity.class);
+		// CustomTaskEntity customTaskEntity = new CustomTaskEntity();
 //		String params = jsonParam.getString("params");
-		boolean flag = false;
+// 		boolean flag = false;
 		// 校园安全自查任务生成
 //		createCampusReportingTask();
 		// 打金店/二手车/二手手机任务生成
@@ -399,9 +402,11 @@
 		// 旅馆安全自查任务生成
 //		createHotelReportingTask();
 		// 人员类-肇事肇祸精神障碍患者走访任务生成
-		createGridWordTask();
+		// createGridWordTask();
 		// 返回
-		return flag;
+		TaskHandle handler = (TaskHandle) SpringUtils.getBean(Objects.requireNonNull(taskHandlerEnum.getNameByCode(customTaskEntity.getTaskType())));
+		handler.taskHandle(customTaskEntity);
+		return true;
 	}
 
 
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..ce6820b
--- /dev/null
+++ b/src/main/java/org/springblade/modules/task/service/impl/VisitingTaskHandler.java
@@ -0,0 +1,52 @@
+package org.springblade.modules.task.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import org.springblade.modules.customTask.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.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));
+		List<GridWorkLogEntity> gridWorkLogEntities = new ArrayList<>();
+		list.forEach(userHouseLabelEntity -> {
+			// 创建任务
+			GridWorkLogEntity gridWorkLogEntity = new GridWorkLogEntity();
+			gridWorkLogEntity.setType(1);
+			gridWorkLogEntity.setHouseholdId(userHouseLabelEntity.getHouseholdId());
+			gridWorkLogEntity.setPersonType(1);
+			gridWorkLogEntity.setSource(2);
+			gridWorkLogEntity.setStatus(1);
+			gridWorkLogEntities.add(gridWorkLogEntity);
+		});
+		gridWorkLogService.saveBatch(gridWorkLogEntities);
+
+		// 遍历
+			// 创建任务
+	}
+}
diff --git a/src/main/java/org/springblade/xxljob/jobhandler/LabelHandleJob.java b/src/main/java/org/springblade/xxljob/jobhandler/LabelHandleJob.java
index 5646ec4..8b88b1c 100644
--- a/src/main/java/org/springblade/xxljob/jobhandler/LabelHandleJob.java
+++ b/src/main/java/org/springblade/xxljob/jobhandler/LabelHandleJob.java
@@ -35,8 +35,10 @@
      * 三色定时任务
      */
     @XxlJob("threeColourJobHandler")
-    public void threeColourJobHandler (String param){
-		XxlJobHelper.log("开始执行任务...");
+    public void threeColourJobHandler (){
+		String param = XxlJobHelper.getJobParam();
+
+		XxlJobHelper.log("开始执行任务..."+param);
 
 		// 校园安全检查
 		// 根据类型创建任务
diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml
index a249842..c9c9570 100644
--- a/src/main/resources/application-test.yml
+++ b/src/main/resources/application-test.yml
@@ -59,9 +59,9 @@
 # xxl-job
 xxl:
   job:
-    accessToken: ''
+    accessToken: 'yMDY5NSIsInJlYWxfbmFtZSI6Inpob25nIiwiYXZhdGFyIjpwZyIsImF1dGhvcml0aWVzIjb2xlX25hbWU'
     admin:
-      addresses: http://192.168.1.50:7009/xxl-job-admin
+      addresses: http://127.0.0.1:7009/xxl-job-admin
     executor:
       appname: blade-xxljob
       ip: 127.0.0.1

--
Gitblit v1.9.3