13 files modified
14 files added
| New file |
| | |
| | | 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; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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))); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | |
| | | } |
| New file |
| | |
| | | <?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> |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | 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); |
| | |
| | | * @param ecOrderEntity |
| | | */ |
| | | public void setGridInfo(ECallEventTwoEntity ecOrderEntity) { |
| | | try { |
| | | if (ecOrderEntity.getSceneGeoLng() == null || ecOrderEntity.getSceneGeoLat() == null) { |
| | | return; |
| | | } |
| | |
| | | PoliceAffairsGridEntity policeAffairsGridEntity = policeAffairsGridEntityList.get(0); |
| | | ecOrderEntity.setJwGridCode(policeAffairsGridEntity.getJwGridCode()); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("获取警格网格信息失败" + e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @Param("isAdministrator") Integer isAdministrator); |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * @param page |
| | | * @param place |
| | | * @return |
| | | */ |
| | | List<PlaceVO> getPlacePage(IPage page, @Param("place") PlaceVO place); |
| | | |
| | | /** |
| | | * 九小场所档案 |
| | | * |
| | | * @param page |
| | |
| | | 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> |
| | |
| | | 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; |
| | |
| | | */ |
| | | IPage<PlaceVO> selectPlacePage(IPage<PlaceVO> page, PlaceVO place); |
| | | |
| | | |
| | | IPage<PlaceVO> getPlacePage(IPage<PlaceVO> page, PlaceVO place); |
| | | |
| | | /** |
| | | * 查询场所集合信息 |
| | | * |
| | |
| | | |
| | | /** |
| | | * 查询场所集合信息 |
| | | * @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 |
| | | * @return |
| New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | <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> |
| | | |
| | |
| | | dict_value AS title, |
| | | id AS "value", |
| | | dict_key AS "key", |
| | | remark, |
| | | ( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | |
| | | 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; |
| | | |
| | |
| | | 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 |
| New file |
| | |
| | | package org.springblade.modules.task.service; |
| | | |
| | | import org.springblade.modules.customTask.entity.CustomTaskEntity; |
| | | |
| | | public interface TaskHandle { |
| | | void taskHandle(CustomTaskEntity customTask); |
| | | } |
| New file |
| | |
| | | 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); |
| | | |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | isState.set(true); |
| | | } |
| | | } |
| | | if (taskPlaceSelfCheck.getTaskId() == null) { |
| | | if (StringUtils.isNotBlank(taskPlaceSelfCheck.getType()) && taskPlaceSelfCheck.getType().equals("2")) { |
| | | // 不存在隐患。状态直接为已审核 |
| | | if (!isState.get()) { |
| | |
| | | return false; |
| | | } |
| | | taskPlaceSelfCheck.setTaskId(restults); |
| | | } else { |
| | | iTaskService.update(Wrappers.<TaskEntity>lambdaUpdate() |
| | | .set(TaskEntity::getStatus, taskPlaceSelfCheck.getStatus()) |
| | | .eq(TaskEntity::getId, taskPlaceSelfCheck.getTaskId())); |
| | | } |
| | | |
| | | // 2.保存任务详情 |
| | | boolean save = save(taskPlaceSelfCheck); |
| | | boolean save = saveOrUpdate(taskPlaceSelfCheck); |
| | | if (save) { |
| | | // 3.保存题目记录 |
| | | taskPlaceRecordList.stream().forEach(item -> { |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | @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(); |
| | | // 打金店/二手车/二手手机任务生成 |
| | |
| | | // 旅馆安全自查任务生成 |
| | | // createHotelReportingTask(); |
| | | // 人员类-肇事肇祸精神障碍患者走访任务生成 |
| | | createGridWordTask(); |
| | | // createGridWordTask(); |
| | | // 返回 |
| | | return flag; |
| | | TaskHandle handler = (TaskHandle) SpringUtils.getBean(Objects.requireNonNull(taskHandlerEnum.getNameByCode(customTaskEntity.getTaskType()))); |
| | | handler.taskHandle(customTaskEntity); |
| | | return true; |
| | | } |
| | | |
| | | |
| New file |
| | |
| | | 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); |
| | | |
| | | // 遍历 |
| | | // 创建任务 |
| | | } |
| | | } |
| | |
| | | * 三色定时任务 |
| | | */ |
| | | @XxlJob("threeColourJobHandler") |
| | | public void threeColourJobHandler (String param){ |
| | | XxlJobHelper.log("开始执行任务..."); |
| | | public void threeColourJobHandler (){ |
| | | String param = XxlJobHelper.getJobParam(); |
| | | |
| | | XxlJobHelper.log("开始执行任务..."+param); |
| | | |
| | | // 校园安全检查 |
| | | // 根据类型创建任务 |
| | |
| | | # 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 |