From 911964634c665c193f38aa97712e2ec4f50bd65b Mon Sep 17 00:00:00 2001 From: dx <1242347652@qq.com> Date: Thu, 16 Jan 2025 08:48:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/app/TaskController.java | 3 +- .../controller/app/WeChatLoginController.java | 7 +- .../web/controller/app/vo/DeptController.java | 23 +++ .../controller/system/TasksController.java | 33 +++- .../ruoyi/common/core/domain/BaseEntity.java | 9 +- .../common/core/domain/entity/SysUser.java | 3 + .../com/ruoyi/common/core/page/PageParam.java | 32 ++++ .../framework/config/SecurityConfig.java | 2 +- .../web/service/SysLoginService.java | 16 +- .../src/main/resources/vm/java/domain.java.vm | 1 - .../system/domain/EnterpriseInspections.java | 167 ++++++++++++++++++ .../ruoyi/system/domain/TaskAssignments.java | 95 ++++++++++ .../ruoyi/system/domain/TaskEnterprises.java | 2 +- .../java/com/ruoyi/system/domain/Tasks.java | 3 + .../ruoyi/system/domain/dto/TaskPageDto.java | 17 ++ .../ruoyi/system/domain/vo/RegisterVo.java | 2 + .../system/domain/vo/TaskAppSelectVo.java | 21 +++ .../domain/vo/TaskInsertEnterprisesVo.java | 12 ++ .../ruoyi/system/domain/vo/TaskPageVo.java | 11 ++ .../ruoyi/system/domain/vo/TaskSaveVo.java | 2 + .../mapper/EnterpriseInspectionsMapper.java | 61 +++++++ .../ruoyi/system/mapper/SysDeptMapper.java | 32 ++-- .../system/mapper/TaskAssignmentsMapper.java | 14 ++ .../IEnterpriseInspectionsService.java | 14 ++ .../ruoyi/system/service/ISysDeptService.java | 33 ++-- .../service/ITaskAssignmentsService.java | 14 ++ .../ruoyi/system/service/ITasksService.java | 12 +- .../EnterpriseInspectionsServiceImpl.java | 21 +++ .../service/impl/SysDeptServiceImpl.java | 56 ++++-- .../impl/TaskAssignmentsServiceImpl.java | 20 +++ .../system/service/impl/TasksServiceImpl.java | 120 +++++++++++-- .../system/EnterpriseInspectionsMapper.xml | 99 +++++++++++ .../resources/mapper/system/SysUserMapper.xml | 16 +- 33 files changed, 884 insertions(+), 89 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/vo/DeptController.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageParam.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/EnterpriseInspections.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/TaskAssignments.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/TaskPageDto.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskAppSelectVo.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskInsertEnterprisesVo.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskPageVo.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/EnterpriseInspectionsMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/TaskAssignmentsMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IEnterpriseInspectionsService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/ITaskAssignmentsService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EnterpriseInspectionsServiceImpl.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskAssignmentsServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/system/EnterpriseInspectionsMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/TaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/TaskController.java index ecc62ad..c715cfe 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/TaskController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/TaskController.java @@ -17,8 +17,7 @@ public class TaskController { @RequestMapping("/list") public AjaxResult getTask() { - iTasksService.getAppTaskList(); - return AjaxResult.success(); + return AjaxResult.success(iTasksService.getAppTaskList()); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/WeChatLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/WeChatLoginController.java index 8c3275f..2bf6171 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/WeChatLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/WeChatLoginController.java @@ -65,9 +65,10 @@ public class WeChatLoginController { final SysDept sysDept = iSysDeptService.selectDeptById(user.getDeptId()); user.setDeptName(sysDept.getDeptName()); - final String userType = sysUserService.selectUserById(user.getUserId()).getUserType(); - user.setUserType(userType); - + final SysUser sysUser = sysUserService.selectUserById(user.getUserId()); + user.setUserType(sysUser.getUserType()); + user.setAvatar(sysUser.getAvatar()); + user.setRealName(sysUser.getRealName()); // 角色集合 Set roles = permissionService.getRolePermission(user); // 权限集合 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/vo/DeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/vo/DeptController.java new file mode 100644 index 0000000..b05a983 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/vo/DeptController.java @@ -0,0 +1,23 @@ +package com.ruoyi.web.controller.app.vo; + + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.system.service.ISysDeptService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/app/dept") +@Slf4j +public class DeptController { + @Autowired + private ISysDeptService iSysDeptService; + + @GetMapping("/list") + public AjaxResult deptList() { + return AjaxResult.success(iSysDeptService.selectSimpleList()); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TasksController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TasksController.java index 9a7dd92..9bc33bb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TasksController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TasksController.java @@ -3,6 +3,12 @@ package com.ruoyi.web.controller.system; import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.ruoyi.common.core.domain.entity.SysDictType; +import com.ruoyi.common.core.page.PageParam; +import com.ruoyi.system.domain.dto.TaskPageDto; +import com.ruoyi.system.domain.vo.TaskInsertEnterprisesVo; +import com.ruoyi.system.domain.vo.TaskPageVo; import com.ruoyi.system.domain.vo.TaskSaveVo; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; @@ -39,14 +45,22 @@ public class TasksController extends BaseController /** * 查询任务,用于存储所有的任务信息,任务可由不同用户创建并管理。列表 */ -// @PreAuthorize("@ss.hasPermi('system:tasks:list')") -// @GetMapping("/list") -// public TableDataInfo list(Tasks tasks) -// { -// startPage(); -// List list = tasksService.(tasks); -// return getDataTable(list); -// } + @PreAuthorize("@ss.hasPermi('system:tasks:list')") + @GetMapping("/list") + public TableDataInfo list(Tasks tasks) + { + startPage(); + List list = tasksService.getPage(); + return getDataTable(list); + } + + @PreAuthorize("@ss.hasPermi('system:tasks:list')") + @PostMapping("/insertEnterprises") + public AjaxResult taskInsertEnterprises(@RequestBody TaskInsertEnterprisesVo taskInsertEnterprisesVo){ + tasksService.taskInsertEnterprises(taskInsertEnterprisesVo); + return AjaxResult.success("保存成功"); + } + // // /** // * 导出任务,用于存储所有的任务信息,任务可由不同用户创建并管理。列表 @@ -79,7 +93,8 @@ public class TasksController extends BaseController @PostMapping public AjaxResult add(@RequestBody TaskSaveVo taskSaveVo) { - return toAjax(tasksService.insertTasks(taskSaveVo)); + tasksService.insertTasks(taskSaveVo); + return success("添加任务成功"); } // // /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java index 15bf66b..4874890 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java @@ -4,21 +4,26 @@ import java.io.Serializable; import java.util.Date; import java.util.HashMap; import java.util.Map; + +import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; /** * Entity基类 - * + * * @author ruoyi */ +@Data public class BaseEntity implements Serializable { private static final long serialVersionUID = 1L; /** 搜索值 */ @JsonIgnore + @TableField(exist = false) private String searchValue; /** 创建者 */ @@ -36,10 +41,12 @@ public class BaseEntity implements Serializable private Date updateTime; /** 备注 */ + @TableField(exist = false) private String remark; /** 请求参数 */ @JsonInclude(JsonInclude.Include.NON_EMPTY) + @TableField(exist = false) private Map params; public String getSearchValue() diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java index 1e1c807..415cb78 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java @@ -49,6 +49,9 @@ public class SysUser extends BaseEntity @Excel(name = "用户名称") private String nickName; + @Excel(name = "用户真实姓名") + private String realName; + /** 用户邮箱 */ @Excel(name = "用户邮箱") private String email; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageParam.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageParam.java new file mode 100644 index 0000000..cdddec1 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageParam.java @@ -0,0 +1,32 @@ +package com.ruoyi.common.core.page; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.Max; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +public class PageParam implements Serializable { + + private static final Integer PAGE_NO = 1; + private static final Integer PAGE_SIZE = 10; + + /** + * 每页条数 - 不分页 + * + * 例如说,导出接口,可以设置 {@link #pageSize} 为 -1 不分页,查询所有数据。 + */ + public static final Integer PAGE_SIZE_NONE = -1; + + @NotNull(message = "页码不能为空") + @Min(value = 1, message = "页码最小值为 1") + private Integer pageNo = PAGE_NO; + + @NotNull(message = "每页条数不能为空") + @Min(value = 1, message = "每页条数最小值为 1") + @Max(value = 100, message = "每页条数最大值为 100") + private Integer pageSize = PAGE_SIZE; + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index ae251c5..799bc52 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -111,7 +111,7 @@ public class SecurityConfig .authorizeHttpRequests((requests) -> { permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - requests.antMatchers("/admin/login", "/register","/app/login", "/captchaImage").permitAll() + requests.antMatchers("/login", "/register","/app/login", "/captchaImage").permitAll() // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index f3aa5fa..2a98cef 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -4,11 +4,13 @@ import javax.annotation.Resource; import com.alibaba.fastjson2.JSONObject; import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.framework.utils.WeChatUtils; import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.domain.vo.RegisterVo; +import com.ruoyi.system.mapper.SysDeptMapper; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.SysUserRoleMapper; import lombok.extern.slf4j.Slf4j; @@ -69,9 +71,10 @@ public class SysLoginService @Autowired private ISysUserService userService; - @Autowired private ISysConfigService configService; + @Autowired + private SysDeptMapper sysDeptMapper; // @Autowired // private SysPermissionService permissionService; @@ -238,12 +241,18 @@ public class SysLoginService if (sysUser == null) { throw new ServiceException("用户不存在"); } + if (registerVo.getDeptId() != null) { + final SysDept sysDept = sysDeptMapper.selectDeptById(registerVo.getDeptId()); + if (sysDept == null) { + throw new ServiceException("部门不存在"); + } + } // if (registerVo.getUserType() != null && "01".equals(registerVo.getUserType())) { // } - BeanUtils.copyProperties(registerVo, sysUser); + log.info("registerVo:{}", registerVo); + BeanUtils.copyProperties(registerVo, sysUser); // sysUser.setStatus("1"); - final int res = sysUserMapper.updateUser(sysUser); if (res < 0) { throw new ServiceException("添加失败"); @@ -326,7 +335,6 @@ public class SysLoginService recordLoginInfo(loginUser.getUserId()); // 生成token String token = tokenService.createToken(loginUser); -// map.put("token", token); return token; } } diff --git a/ruoyi-generator/src/main/resources/vm/java/domain.java.vm b/ruoyi-generator/src/main/resources/vm/java/domain.java.vm index 26bcc98..c8ea70e 100644 --- a/ruoyi-generator/src/main/resources/vm/java/domain.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/domain.java.vm @@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import com.rchuing.sis.common.annotation.Excel; #if($table.crud || $table.sub) import com.rchuing.sis.common.core.domain.BaseEntity; #elseif($table.tree) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/EnterpriseInspections.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/EnterpriseInspections.java new file mode 100644 index 0000000..aa8f48b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/EnterpriseInspections.java @@ -0,0 +1,167 @@ +package com.ruoyi.system.domain; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 企业检查记录,用于记录与企业相关的环保检查信息。对象 enterprise_inspections + * + * @author ruoyi + * @date 2025-01-15 + */ +@TableName("enterprise_inspections") +public class EnterpriseInspections extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 检查记录ID,主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 任务ID + */ + @Excel(name = "任务ID") + private Long taskId; + + /** + * 企业ID + */ + @Excel(name = "企业ID") + private Long enterpriseId; + + /** + * 检查状态 + */ + @Excel(name = "检查状态") + private String status; + + /** + * 检查日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "检查日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date date; + + /** + * 检查结果 + */ + @Excel(name = "检查结果") + private String result; + + /** + * 备注,检查执行或结果的详细说明 + */ + @Excel(name = "备注,检查执行或结果的详细说明") + private String remarks; + + /** + * 检查人员签到位置信息,格式:经纬度 + */ + @Excel(name = "检查人员签到位置信息,格式:经纬度") + private String gpsLocation; + + /** + * 检查人员ID + */ + @Excel(name = "检查人员ID") + private Long creator; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getTaskId() { + return taskId; + } + + public void setTaskId(Long taskId) { + this.taskId = taskId; + } + + public Long getEnterpriseId() { + return enterpriseId; + } + + public void setEnterpriseId(Long enterpriseId) { + this.enterpriseId = enterpriseId; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getGpsLocation() { + return gpsLocation; + } + + public void setGpsLocation(String gpsLocation) { + this.gpsLocation = gpsLocation; + } + + public Long getCreator() { + return creator; + } + + public void setCreator(Long creator) { + this.creator = creator; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("taskId", getTaskId()) + .append("enterpriseId", getEnterpriseId()) + .append("status", getStatus()) + .append("date", getDate()) + .append("result", getResult()) + .append("remarks", getRemarks()) + .append("gpsLocation", getGpsLocation()) + .append("creator", getCreator()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/TaskAssignments.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TaskAssignments.java new file mode 100644 index 0000000..d2f1935 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TaskAssignments.java @@ -0,0 +1,95 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 任务分配,用于记录每个任务的执行人员及其状态。对象 task_assignments + * + * @author ruoyi + * @date 2025-01-15 + */ +@TableName("task_assignments") +@Data +public class TaskAssignments extends BaseEntity +{ +private static final long serialVersionUID = 1L; + + /** 主键 */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + + /** 任务ID */ + private Long taskId; + + /** 执行人员ID */ + private Long userId; + + /** 重新分配人ID,可为空 */ + private Long reassignedBy; + + /** 任务状态 */ + private Integer status; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setTaskId(Long taskId) + { + this.taskId = taskId; + } + + public Long getTaskId() + { + return taskId; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setReassignedBy(Long reassignedBy) + { + this.reassignedBy = reassignedBy; + } + + public Long getReassignedBy() + { + return reassignedBy; + } + public void setStatus(Integer status) + { + this.status = status; + } + + public Integer getStatus() + { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("taskId", getTaskId()) + .append("userId", getUserId()) + .append("reassignedBy", getReassignedBy()) + .append("status", getStatus()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/TaskEnterprises.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TaskEnterprises.java index e6c031d..8b66889 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/TaskEnterprises.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TaskEnterprises.java @@ -14,7 +14,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; * @author ruoyi * @date 2025-01-14 */ -@TableName("tasks_enterprises") +@TableName("task_enterprises") @Data public class TaskEnterprises extends BaseEntity { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/Tasks.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/Tasks.java index bba0b0f..72c907d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/Tasks.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/Tasks.java @@ -49,6 +49,9 @@ public class Tasks extends BaseEntity implements Serializable { @TableField("`description`") private String description; + @TableField("`exec_cycle`") + private Integer execCycle; + /** * 任务类型,表示任务的类别,例如:1.发布任务、2.自动任务等 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/TaskPageDto.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/TaskPageDto.java new file mode 100644 index 0000000..3a2f0e8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/TaskPageDto.java @@ -0,0 +1,17 @@ +package com.ruoyi.system.domain.dto; + +import lombok.Data; + +@Data +public class TaskPageDto { + //任务 + private String title; + //执行周期 + private Integer execCycle; + //类型 + private Integer type; + //任务进度 + private String completionProgress; + //范围 + private Integer scope ; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RegisterVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RegisterVo.java index 9cd9765..b7e20c2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RegisterVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RegisterVo.java @@ -10,5 +10,7 @@ public class RegisterVo { private String sex; private String phonenumber; private Long deptId; + private String avatar; + private String realName; private String userType; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskAppSelectVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskAppSelectVo.java new file mode 100644 index 0000000..514f208 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskAppSelectVo.java @@ -0,0 +1,21 @@ +package com.ruoyi.system.domain.vo; + +import lombok.Data; + +@Data +public class TaskAppSelectVo { + //任务名称 + private String taskName; + //任务倒计时 + private String descTime; + //任务描述 + private String description; + //任务进度 + private String completionProgress; + //任务状态 + private String taskStatus; + //任务类型 + private String taskType; + //任务优先级 + private String taskPriority; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskInsertEnterprisesVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskInsertEnterprisesVo.java new file mode 100644 index 0000000..e2b9b6c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskInsertEnterprisesVo.java @@ -0,0 +1,12 @@ +package com.ruoyi.system.domain.vo; + +import lombok.Data; + +import java.time.LocalDate; +import java.util.List; + +@Data +public class TaskInsertEnterprisesVo { + private Long taskId; + private List enterprisesList; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskPageVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskPageVo.java new file mode 100644 index 0000000..a174a0c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskPageVo.java @@ -0,0 +1,11 @@ +package com.ruoyi.system.domain.vo; + +import com.ruoyi.common.core.page.PageParam; + +import java.time.LocalDate; + +public class TaskPageVo { + private String title; + private LocalDate startDate; + private LocalDate endDate; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskSaveVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskSaveVo.java index 1cb2aa9..f6b4e02 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskSaveVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskSaveVo.java @@ -13,6 +13,8 @@ public class TaskSaveVo { private Integer taskType; //任务优先级 private String priority; + //执行周期 + private Integer execCycle; //任务状态 private String status; //任务计划开始时间 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/EnterpriseInspectionsMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/EnterpriseInspectionsMapper.java new file mode 100644 index 0000000..8d037a2 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/EnterpriseInspectionsMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.system.domain.EnterpriseInspections; + +/** + * 企业检查记录,用于记录与企业相关的环保检查信息。Mapper接口 + * + * @author ruoyi + * @date 2025-01-15 + */ +public interface EnterpriseInspectionsMapper extends BaseMapper { + /** + * 查询企业检查记录,用于记录与企业相关的环保检查信息。 + * + * @param id 企业检查记录,用于记录与企业相关的环保检查信息。主键 + * @return 企业检查记录,用于记录与企业相关的环保检查信息。 + */ + public EnterpriseInspections selectEnterpriseInspectionsById(Long id); + + /** + * 查询企业检查记录,用于记录与企业相关的环保检查信息。列表 + * + * @param enterpriseInspections 企业检查记录,用于记录与企业相关的环保检查信息。 + * @return 企业检查记录,用于记录与企业相关的环保检查信息。集合 + */ + public List selectEnterpriseInspectionsList(EnterpriseInspections enterpriseInspections); + + /** + * 新增企业检查记录,用于记录与企业相关的环保检查信息。 + * + * @param enterpriseInspections 企业检查记录,用于记录与企业相关的环保检查信息。 + * @return 结果 + */ + public int insertEnterpriseInspections(EnterpriseInspections enterpriseInspections); + + /** + * 修改企业检查记录,用于记录与企业相关的环保检查信息。 + * + * @param enterpriseInspections 企业检查记录,用于记录与企业相关的环保检查信息。 + * @return 结果 + */ + public int updateEnterpriseInspections(EnterpriseInspections enterpriseInspections); + + /** + * 删除企业检查记录,用于记录与企业相关的环保检查信息。 + * + * @param id 企业检查记录,用于记录与企业相关的环保检查信息。主键 + * @return 结果 + */ + public int deleteEnterpriseInspectionsById(Long id); + + /** + * 批量删除企业检查记录,用于记录与企业相关的环保检查信息。 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEnterpriseInspectionsByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java index 384a9b6..8d1de02 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java @@ -1,19 +1,21 @@ package com.ruoyi.system.mapper; import java.util.List; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import com.ruoyi.common.core.domain.entity.SysDept; /** * 部门管理 数据层 - * + * * @author ruoyi */ -public interface SysDeptMapper +public interface SysDeptMapper extends BaseMapper { /** * 查询部门管理数据 - * + * * @param dept 部门信息 * @return 部门信息集合 */ @@ -21,7 +23,7 @@ public interface SysDeptMapper /** * 根据角色ID查询部门树信息 - * + * * @param roleId 角色ID * @param deptCheckStrictly 部门树选择项是否关联显示 * @return 选中部门列表 @@ -30,7 +32,7 @@ public interface SysDeptMapper /** * 根据部门ID查询信息 - * + * * @param deptId 部门ID * @return 部门信息 */ @@ -38,7 +40,7 @@ public interface SysDeptMapper /** * 根据ID查询所有子部门 - * + * * @param deptId 部门ID * @return 部门列表 */ @@ -46,7 +48,7 @@ public interface SysDeptMapper /** * 根据ID查询所有子部门(正常状态) - * + * * @param deptId 部门ID * @return 子部门数 */ @@ -54,7 +56,7 @@ public interface SysDeptMapper /** * 是否存在子节点 - * + * * @param deptId 部门ID * @return 结果 */ @@ -62,7 +64,7 @@ public interface SysDeptMapper /** * 查询部门是否存在用户 - * + * * @param deptId 部门ID * @return 结果 */ @@ -70,7 +72,7 @@ public interface SysDeptMapper /** * 校验部门名称是否唯一 - * + * * @param deptName 部门名称 * @param parentId 父部门ID * @return 结果 @@ -79,7 +81,7 @@ public interface SysDeptMapper /** * 新增部门信息 - * + * * @param dept 部门信息 * @return 结果 */ @@ -87,7 +89,7 @@ public interface SysDeptMapper /** * 修改部门信息 - * + * * @param dept 部门信息 * @return 结果 */ @@ -95,14 +97,14 @@ public interface SysDeptMapper /** * 修改所在部门正常状态 - * + * * @param deptIds 部门ID组 */ public void updateDeptStatusNormal(Long[] deptIds); /** * 修改子元素关系 - * + * * @param depts 子元素 * @return 结果 */ @@ -110,7 +112,7 @@ public interface SysDeptMapper /** * 删除部门管理信息 - * + * * @param deptId 部门ID * @return 结果 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TaskAssignmentsMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TaskAssignmentsMapper.java new file mode 100644 index 0000000..f0e4588 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TaskAssignmentsMapper.java @@ -0,0 +1,14 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.system.domain.TaskAssignments; + +/** + * 任务分配,用于记录每个任务的执行人员及其状态。Mapper接口 + * + * @author ruoyi + * @date 2025-01-15 + */ +public interface TaskAssignmentsMapper extends BaseMapper { +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IEnterpriseInspectionsService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IEnterpriseInspectionsService.java new file mode 100644 index 0000000..ab23d4c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IEnterpriseInspectionsService.java @@ -0,0 +1,14 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.EnterpriseInspections; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * 企业检查记录,用于记录与企业相关的环保检查信息。Service接口 + * + * @author ruoyi + * @date 2025-01-15 + */ +public interface IEnterpriseInspectionsService extends IService { +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java index f228208..907ac37 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java @@ -3,25 +3,28 @@ package com.ruoyi.system.service; import java.util.List; import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.entity.SysDept; +import com.ruoyi.system.domain.vo.LabelValueVo; /** * 部门管理 服务层 - * + * * @author ruoyi */ public interface ISysDeptService { /** * 查询部门管理数据 - * + * * @param dept 部门信息 * @return 部门信息集合 */ public List selectDeptList(SysDept dept); + public List selectSimpleList(); + /** * 查询部门树结构信息 - * + * * @param dept 部门信息 * @return 部门树信息集合 */ @@ -29,7 +32,7 @@ public interface ISysDeptService /** * 构建前端所需要树结构 - * + * * @param depts 部门列表 * @return 树结构列表 */ @@ -37,7 +40,7 @@ public interface ISysDeptService /** * 构建前端所需要下拉树结构 - * + * * @param depts 部门列表 * @return 下拉树结构列表 */ @@ -45,7 +48,7 @@ public interface ISysDeptService /** * 根据角色ID查询部门树信息 - * + * * @param roleId 角色ID * @return 选中部门列表 */ @@ -53,7 +56,7 @@ public interface ISysDeptService /** * 根据部门ID查询信息 - * + * * @param deptId 部门ID * @return 部门信息 */ @@ -61,7 +64,7 @@ public interface ISysDeptService /** * 根据ID查询所有子部门(正常状态) - * + * * @param deptId 部门ID * @return 子部门数 */ @@ -69,7 +72,7 @@ public interface ISysDeptService /** * 是否存在部门子节点 - * + * * @param deptId 部门ID * @return 结果 */ @@ -77,7 +80,7 @@ public interface ISysDeptService /** * 查询部门是否存在用户 - * + * * @param deptId 部门ID * @return 结果 true 存在 false 不存在 */ @@ -85,7 +88,7 @@ public interface ISysDeptService /** * 校验部门名称是否唯一 - * + * * @param dept 部门信息 * @return 结果 */ @@ -93,14 +96,14 @@ public interface ISysDeptService /** * 校验部门是否有数据权限 - * + * * @param deptId 部门id */ public void checkDeptDataScope(Long deptId); /** * 新增保存部门信息 - * + * * @param dept 部门信息 * @return 结果 */ @@ -108,7 +111,7 @@ public interface ISysDeptService /** * 修改保存部门信息 - * + * * @param dept 部门信息 * @return 结果 */ @@ -116,7 +119,7 @@ public interface ISysDeptService /** * 删除部门管理信息 - * + * * @param deptId 部门ID * @return 结果 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITaskAssignmentsService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITaskAssignmentsService.java new file mode 100644 index 0000000..ec01b8d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITaskAssignmentsService.java @@ -0,0 +1,14 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.TaskAssignments; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * 任务分配,用于记录每个任务的执行人员及其状态。Service接口 + * + * @author ruoyi + * @date 2025-01-15 + */ +public interface ITaskAssignmentsService extends IService { +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITasksService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITasksService.java index bf1d1c9..9f92bc1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITasksService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITasksService.java @@ -3,6 +3,9 @@ package com.ruoyi.system.service; import java.util.List; import com.ruoyi.system.domain.Tasks; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.system.domain.dto.TaskPageDto; +import com.ruoyi.system.domain.vo.TaskAppSelectVo; +import com.ruoyi.system.domain.vo.TaskInsertEnterprisesVo; import com.ruoyi.system.domain.vo.TaskSaveVo; /** @@ -12,8 +15,13 @@ import com.ruoyi.system.domain.vo.TaskSaveVo; * @date 2025-01-14 */ public interface ITasksService extends IService { - int insertTasks(TaskSaveVo taskSaveVo); - List getAppTaskList(); + void insertTasks(TaskSaveVo taskSaveVo); + //小程序端任务列表 + List getAppTaskList(); + + List getPage(); + + void taskInsertEnterprises(TaskInsertEnterprisesVo taskInsertEnterprisesVo); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EnterpriseInspectionsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EnterpriseInspectionsServiceImpl.java new file mode 100644 index 0000000..3ada9f0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EnterpriseInspectionsServiceImpl.java @@ -0,0 +1,21 @@ +package com.ruoyi.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.EnterpriseInspectionsMapper; +import com.ruoyi.system.domain.EnterpriseInspections; +import com.ruoyi.system.service.IEnterpriseInspectionsService; + +/** + * 企业检查记录,用于记录与企业相关的环保检查信息。Service业务层处理 + * + * @author ruoyi + * @date 2025-01-15 + */ +@Service +public class EnterpriseInspectionsServiceImpl extends ServiceImpl implements IEnterpriseInspectionsService { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 54b605d..1edaea1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -4,6 +4,10 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.ruoyi.system.domain.vo.LabelValueVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.annotation.DataScope; @@ -23,7 +27,7 @@ import com.ruoyi.system.service.ISysDeptService; /** * 部门管理 服务实现 - * + * * @author ruoyi */ @Service @@ -37,7 +41,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 查询部门管理数据 - * + * * @param dept 部门信息 * @return 部门信息集合 */ @@ -48,9 +52,27 @@ public class SysDeptServiceImpl implements ISysDeptService return deptMapper.selectDeptList(dept); } + @Override + public List selectSimpleList() { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.select("dept_id", "dept_name"); + wrapper.eq("del_flag", "0"); + final List sysDepts = deptMapper.selectList(wrapper); + List labelValueVoList = new ArrayList<>(); + sysDepts.forEach(item->{ + LabelValueVo labelValueVo = new LabelValueVo(); + labelValueVo.setValue(item.getDeptId()); + labelValueVo.setLabel(item.getDeptName()); + labelValueVoList.add(labelValueVo); + }); + + + return labelValueVoList; + } + /** * 查询部门树结构信息 - * + * * @param dept 部门信息 * @return 部门树信息集合 */ @@ -63,7 +85,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 构建前端所需要树结构 - * + * * @param depts 部门列表 * @return 树结构列表 */ @@ -90,7 +112,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 构建前端所需要下拉树结构 - * + * * @param depts 部门列表 * @return 下拉树结构列表 */ @@ -103,7 +125,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 根据角色ID查询部门树信息 - * + * * @param roleId 角色ID * @return 选中部门列表 */ @@ -116,7 +138,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 根据部门ID查询信息 - * + * * @param deptId 部门ID * @return 部门信息 */ @@ -128,7 +150,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 根据ID查询所有子部门(正常状态) - * + * * @param deptId 部门ID * @return 子部门数 */ @@ -140,7 +162,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 是否存在子节点 - * + * * @param deptId 部门ID * @return 结果 */ @@ -153,7 +175,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 查询部门是否存在用户 - * + * * @param deptId 部门ID * @return 结果 true 存在 false 不存在 */ @@ -166,7 +188,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 校验部门名称是否唯一 - * + * * @param dept 部门信息 * @return 结果 */ @@ -184,7 +206,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 校验部门是否有数据权限 - * + * * @param deptId 部门id */ @Override @@ -204,7 +226,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 新增保存部门信息 - * + * * @param dept 部门信息 * @return 结果 */ @@ -223,7 +245,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 修改保存部门信息 - * + * * @param dept 部门信息 * @return 结果 */ @@ -251,7 +273,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 修改该部门的父级部门状态 - * + * * @param dept 当前部门 */ private void updateParentDeptStatusNormal(SysDept dept) @@ -263,7 +285,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 修改子元素关系 - * + * * @param deptId 被修改的部门ID * @param newAncestors 新的父ID集合 * @param oldAncestors 旧的父ID集合 @@ -283,7 +305,7 @@ public class SysDeptServiceImpl implements ISysDeptService /** * 删除部门管理信息 - * + * * @param deptId 部门ID * @return 结果 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskAssignmentsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskAssignmentsServiceImpl.java new file mode 100644 index 0000000..8ad9900 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskAssignmentsServiceImpl.java @@ -0,0 +1,20 @@ +package com.ruoyi.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import java.util.List; + +import com.ruoyi.system.service.ITaskAssignmentsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.TaskAssignmentsMapper; +import com.ruoyi.system.domain.TaskAssignments; + +/** + * 任务分配,用于记录每个任务的执行人员及其状态。Service业务层处理 + * + * @author ruoyi + * @date 2025-01-15 + */ +@Service +public class TaskAssignmentsServiceImpl extends ServiceImpl implements ITaskAssignmentsService { +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TasksServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TasksServiceImpl.java index bfc2b42..ec70ad0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TasksServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TasksServiceImpl.java @@ -1,11 +1,20 @@ package com.ruoyi.system.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.system.domain.EnterpriseInspections; import com.ruoyi.system.domain.TaskEnterprises; +import com.ruoyi.system.domain.dto.TaskPageDto; +import com.ruoyi.system.domain.vo.TaskAppSelectVo; +import com.ruoyi.system.domain.vo.TaskInsertEnterprisesVo; import com.ruoyi.system.domain.vo.TaskSaveVo; +import com.ruoyi.system.mapper.EnterpriseInspectionsMapper; import com.ruoyi.system.mapper.TaskEnterprisesMapper; +import com.ruoyi.system.service.IEnterpriseInspectionsService; +import com.ruoyi.system.service.ITaskAssignmentsService; import com.ruoyi.system.service.ITaskEnterprisesService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -14,8 +23,10 @@ import com.ruoyi.system.mapper.TasksMapper; import com.ruoyi.system.domain.Tasks; import com.ruoyi.system.service.ITasksService; import com.ruoyi.system.mapper.TasksMapper; +import org.springframework.transaction.annotation.Transactional; import reactor.core.scheduler.Scheduler; +import java.util.ArrayList; import java.util.List; //import org.quartz.Scheduler; @@ -30,45 +41,126 @@ public class TasksServiceImpl extends ServiceImpl implements @Autowired private TaskEnterprisesMapper taskEnterprisesMapper; + @Autowired + private ITaskAssignmentsService iTaskAssignmentsService; + @Autowired + private ITaskEnterprisesService iTaskEnterprisesService; + + @Autowired + private IEnterpriseInspectionsService iEnterpriseInspectionsService; + @Autowired private TasksMapper tasksMapper; @Override - public int insertTasks(TaskSaveVo taskSaveVo) { + public void insertTasks(TaskSaveVo taskSaveVo) { //任务类型 Tasks tasks = new Tasks(); - BeanUtils.copyProperties(taskSaveVo, tasks); - final int insert = tasksMapper.insert(tasks); if (insert < 1) { throw new ServiceException("插入失败"); } - if (taskSaveVo.getTaskType() == 2) { - //自动执行 - +// if (taskSaveVo.getTaskType() == 2) { +// //自动执行 +// +// +// } else { +// +// } +// +// final List enterprisesList = taskSaveVo.getEnterprisesList(); +// for (Long id : enterprisesList) { +// TaskEnterprises enterprises = new TaskEnterprises(); +// enterprises.setTaskId(tasks.getId()); +// enterprises.setEnterpriseId(id); +// taskEnterprisesMapper.insert(enterprises); +// } +// +// return 0; + } + @Transactional + public void taskInsertEnterprises(TaskInsertEnterprisesVo taskInsertEnterprisesVo) { - } else { + final List enterprisesList = taskInsertEnterprisesVo.getEnterprisesList(); + if (enterprisesList.size() < 1) { + throw new ServiceException("任务不能为空"); + } + final Tasks tasks = tasksMapper.selectById(taskInsertEnterprisesVo.getTaskId()); + if (tasks == null) { + throw new ServiceException("任务不存在"); } - final List enterprisesList = taskSaveVo.getEnterprisesList(); for (Long id : enterprisesList) { TaskEnterprises enterprises = new TaskEnterprises(); enterprises.setTaskId(tasks.getId()); enterprises.setEnterpriseId(id); - taskEnterprisesMapper.insert(enterprises); + final int insert = taskEnterprisesMapper.insert(enterprises); + if (insert < 1) { + throw new ServiceException("插入失败"); + } + } + } + + @Override + public List getAppTaskList() { + final Long userId = SecurityUtils.getUserId(); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.apply("FIND_IN_SET({0}, user_id)", userId); + wrapper.groupBy("task_id"); + wrapper.select("task_id", "COUNT(enterprise_id) AS count"); + final List taskEnterprisesList = taskEnterprisesMapper.selectList(wrapper); + + List list = new ArrayList<>(); + + if (taskEnterprisesList.size() > 0) { + taskEnterprisesList.forEach(item -> { + TaskAppSelectVo taskAppSelectVo = new TaskAppSelectVo(); + list.add(taskAppSelectVo); + final Tasks tasks = tasksMapper.selectById(item.getTaskId()); + if (tasks == null) { + throw new ServiceException("任务不存在"); + } + taskAppSelectVo.setTaskName(tasks.getTitle()); + taskAppSelectVo.setDescription(tasks.getDescription()); + }); } - return 0; + + return list; } @Override - public List getAppTaskList() { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(Tasks::getTaskType, 1); - return tasksMapper.selectList(wrapper); + public List getPage() { + + List list = new ArrayList<>(); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("del_flag", 0); + final List tasks = tasksMapper.selectList(wrapper); + if (tasks.size() > 0) { + tasks.forEach(item->{ + TaskPageDto taskPageDto = new TaskPageDto(); + taskPageDto.setTitle(item.getTitle()); + taskPageDto.setType(item.getTaskType()); + taskPageDto.setExecCycle(item.getExecCycle()); + LambdaQueryWrapper taskEnterprisesLambdaQueryWrapper = new LambdaQueryWrapper<>(); + taskEnterprisesLambdaQueryWrapper.eq(item.getId() != null, TaskEnterprises::getTaskId, item.getId()); + final long count = iTaskEnterprisesService.count(); + taskPageDto.setScope((int) count); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(EnterpriseInspections::getStatus, 1); + queryWrapper.eq(item.getId() != null, EnterpriseInspections::getTaskId, item.getId()); + final long count1 = iEnterpriseInspectionsService.count(); + taskPageDto.setCompletionProgress(count1+"/"+count); + list.add(taskPageDto); + }); + } + + return list; } } diff --git a/ruoyi-system/src/main/resources/mapper/system/EnterpriseInspectionsMapper.xml b/ruoyi-system/src/main/resources/mapper/system/EnterpriseInspectionsMapper.xml new file mode 100644 index 0000000..7cf6871 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/EnterpriseInspectionsMapper.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + select id, task_id, enterprise_id, status, date, result, remarks, gps_location, creator, create_time, update_time from enterprise_inspections + + + + + + + + insert into enterprise_inspections + + task_id, + enterprise_id, + status, + date, + result, + remarks, + gps_location, + creator, + create_time, + update_time, + + + #{taskId}, + #{enterpriseId}, + #{status}, + #{date}, + #{result}, + #{remarks}, + #{gpsLocation}, + #{creator}, + #{createTime}, + #{updateTime}, + + + + + update enterprise_inspections + + task_id = #{taskId}, + enterprise_id = #{enterpriseId}, + status = #{status}, + date = #{date}, + result = #{result}, + remarks = #{remarks}, + gps_location = #{gpsLocation}, + creator = #{creator}, + create_time = #{createTime}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from enterprise_inspections where id = #{id} + + + + delete from enterprise_inspections where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index 0a8fdd8..ea6a912 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -49,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select u.user_id,u.user_type, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, + select u.user_id,u.user_type, u.dept_id, u.user_name,u.real_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status from sys_user u @@ -59,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"