Browse Source

任务相关

master
DX 4 days ago
parent
commit
911964634c
  1. 3
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/TaskController.java
  2. 7
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/WeChatLoginController.java
  3. 23
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/vo/DeptController.java
  4. 33
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TasksController.java
  5. 7
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java
  6. 3
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
  7. 32
      ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageParam.java
  8. 2
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
  9. 16
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
  10. 1
      ruoyi-generator/src/main/resources/vm/java/domain.java.vm
  11. 167
      ruoyi-system/src/main/java/com/ruoyi/system/domain/EnterpriseInspections.java
  12. 95
      ruoyi-system/src/main/java/com/ruoyi/system/domain/TaskAssignments.java
  13. 2
      ruoyi-system/src/main/java/com/ruoyi/system/domain/TaskEnterprises.java
  14. 3
      ruoyi-system/src/main/java/com/ruoyi/system/domain/Tasks.java
  15. 17
      ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/TaskPageDto.java
  16. 2
      ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RegisterVo.java
  17. 21
      ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskAppSelectVo.java
  18. 12
      ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskInsertEnterprisesVo.java
  19. 11
      ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskPageVo.java
  20. 2
      ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskSaveVo.java
  21. 61
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/EnterpriseInspectionsMapper.java
  22. 4
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
  23. 14
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/TaskAssignmentsMapper.java
  24. 14
      ruoyi-system/src/main/java/com/ruoyi/system/service/IEnterpriseInspectionsService.java
  25. 3
      ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
  26. 14
      ruoyi-system/src/main/java/com/ruoyi/system/service/ITaskAssignmentsService.java
  27. 12
      ruoyi-system/src/main/java/com/ruoyi/system/service/ITasksService.java
  28. 21
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EnterpriseInspectionsServiceImpl.java
  29. 22
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
  30. 20
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskAssignmentsServiceImpl.java
  31. 120
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TasksServiceImpl.java
  32. 99
      ruoyi-system/src/main/resources/mapper/system/EnterpriseInspectionsMapper.xml
  33. 16
      ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

3
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());
}
}

7
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<String> roles = permissionService.getRolePermission(user);
// 权限集合

23
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());
}
}

33
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<Tasks> list = tasksService.(tasks);
// return getDataTable(list);
// }
@PreAuthorize("@ss.hasPermi('system:tasks:list')")
@GetMapping("/list")
public TableDataInfo list(Tasks tasks)
{
startPage();
List<TaskPageDto> 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("添加任务成功");
}
//
// /**

7
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<String, Object> params;
public String getSearchValue()

3
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;

32
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;
}

2
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()

16
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;
}
}

1
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)

167
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();
}
}

95
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();
}
}

2
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
{

3
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.自动任务等
*/

17
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 ;
}

2
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;
}

21
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;
}

12
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<Long> enterprisesList;
}

11
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;
}

2
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;
//任务计划开始时间

61
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<EnterpriseInspections> {
/**
* 查询企业检查记录用于记录与企业相关的环保检查信息
*
* @param id 企业检查记录用于记录与企业相关的环保检查信息主键
* @return 企业检查记录用于记录与企业相关的环保检查信息
*/
public EnterpriseInspections selectEnterpriseInspectionsById(Long id);
/**
* 查询企业检查记录用于记录与企业相关的环保检查信息列表
*
* @param enterpriseInspections 企业检查记录用于记录与企业相关的环保检查信息
* @return 企业检查记录用于记录与企业相关的环保检查信息集合
*/
public List<EnterpriseInspections> 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);
}

4
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java

@ -1,6 +1,8 @@
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;
@ -9,7 +11,7 @@ import com.ruoyi.common.core.domain.entity.SysDept;
*
* @author ruoyi
*/
public interface SysDeptMapper
public interface SysDeptMapper extends BaseMapper<SysDept>
{
/**
* 查询部门管理数据

14
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<TaskAssignments> {
}

14
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<EnterpriseInspections> {
}

3
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java

@ -3,6 +3,7 @@ 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;
/**
* 部门管理 服务层
@ -19,6 +20,8 @@ public interface ISysDeptService
*/
public List<SysDept> selectDeptList(SysDept dept);
public List<LabelValueVo> selectSimpleList();
/**
* 查询部门树结构信息
*

14
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<TaskAssignments> {
}

12
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<Tasks> {
int insertTasks(TaskSaveVo taskSaveVo);
List<Tasks> getAppTaskList();
void insertTasks(TaskSaveVo taskSaveVo);
//小程序端任务列表
List<TaskAppSelectVo> getAppTaskList();
List<TaskPageDto> getPage();
void taskInsertEnterprises(TaskInsertEnterprisesVo taskInsertEnterprisesVo);
}

21
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<EnterpriseInspectionsMapper, EnterpriseInspections> implements IEnterpriseInspectionsService {
}

22
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;
@ -48,6 +52,24 @@ public class SysDeptServiceImpl implements ISysDeptService
return deptMapper.selectDeptList(dept);
}
@Override
public List<LabelValueVo> selectSimpleList() {
QueryWrapper<SysDept> wrapper = new QueryWrapper<>();
wrapper.select("dept_id", "dept_name");
wrapper.eq("del_flag", "0");
final List<SysDept> sysDepts = deptMapper.selectList(wrapper);
List<LabelValueVo> labelValueVoList = new ArrayList<>();
sysDepts.forEach(item->{
LabelValueVo labelValueVo = new LabelValueVo();
labelValueVo.setValue(item.getDeptId());
labelValueVo.setLabel(item.getDeptName());
labelValueVoList.add(labelValueVo);
});
return labelValueVoList;
}
/**
* 查询部门树结构信息
*

20
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<TaskAssignmentsMapper, TaskAssignments> implements ITaskAssignmentsService {
}

120
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<TasksMapper, Tasks> 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<Long> 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<Long> 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<Long> 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<TaskAppSelectVo> getAppTaskList() {
final Long userId = SecurityUtils.getUserId();
QueryWrapper<TaskEnterprises> 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<TaskEnterprises> taskEnterprisesList = taskEnterprisesMapper.selectList(wrapper);
return 0;
List<TaskAppSelectVo> 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 list;
}
@Override
public List<Tasks> getAppTaskList() {
LambdaQueryWrapper<Tasks> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Tasks::getTaskType, 1);
return tasksMapper.selectList(wrapper);
public List<TaskPageDto> getPage() {
List<TaskPageDto> list = new ArrayList<>();
QueryWrapper<Tasks> wrapper = new QueryWrapper<>();
wrapper.eq("del_flag", 0);
final List<Tasks> 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<TaskEnterprises> taskEnterprisesLambdaQueryWrapper = new LambdaQueryWrapper<>();
taskEnterprisesLambdaQueryWrapper.eq(item.getId() != null, TaskEnterprises::getTaskId, item.getId());
final long count = iTaskEnterprisesService.count();
taskPageDto.setScope((int) count);
LambdaQueryWrapper<EnterpriseInspections> 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;
}
}

99
ruoyi-system/src/main/resources/mapper/system/EnterpriseInspectionsMapper.xml

@ -0,0 +1,99 @@
<?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="com.ruoyi.system.mapper.EnterpriseInspectionsMapper">
<resultMap type="EnterpriseInspections" id="EnterpriseInspectionsResult">
<result property="id" column="id" />
<result property="taskId" column="task_id" />
<result property="enterpriseId" column="enterprise_id" />
<result property="status" column="status" />
<result property="date" column="date" />
<result property="result" column="result" />
<result property="remarks" column="remarks" />
<result property="gpsLocation" column="gps_location" />
<result property="creator" column="creator" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectEnterpriseInspectionsVo">
select id, task_id, enterprise_id, status, date, result, remarks, gps_location, creator, create_time, update_time from enterprise_inspections
</sql>
<select id="selectEnterpriseInspectionsList" parameterType="EnterpriseInspections" resultMap="EnterpriseInspectionsResult">
<include refid="selectEnterpriseInspectionsVo"/>
<where>
<if test="taskId != null "> and task_id = #{taskId}</if>
<if test="enterpriseId != null "> and enterprise_id = #{enterpriseId}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="date != null "> and date = #{date}</if>
<if test="result != null and result != ''"> and result = #{result}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
<if test="gpsLocation != null and gpsLocation != ''"> and gps_location = #{gpsLocation}</if>
<if test="creator != null "> and creator = #{creator}</if>
</where>
</select>
<select id="selectEnterpriseInspectionsById" parameterType="Long" resultMap="EnterpriseInspectionsResult">
<include refid="selectEnterpriseInspectionsVo"/>
where id = #{id}
</select>
<insert id="insertEnterpriseInspections" parameterType="EnterpriseInspections" useGeneratedKeys="true" keyProperty="id">
insert into enterprise_inspections
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskId != null">task_id,</if>
<if test="enterpriseId != null">enterprise_id,</if>
<if test="status != null and status != ''">status,</if>
<if test="date != null">date,</if>
<if test="result != null and result != ''">result,</if>
<if test="remarks != null">remarks,</if>
<if test="gpsLocation != null">gps_location,</if>
<if test="creator != null">creator,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskId != null">#{taskId},</if>
<if test="enterpriseId != null">#{enterpriseId},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="date != null">#{date},</if>
<if test="result != null and result != ''">#{result},</if>
<if test="remarks != null">#{remarks},</if>
<if test="gpsLocation != null">#{gpsLocation},</if>
<if test="creator != null">#{creator},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateEnterpriseInspections" parameterType="EnterpriseInspections">
update enterprise_inspections
<trim prefix="SET" suffixOverrides=",">
<if test="taskId != null">task_id = #{taskId},</if>
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="date != null">date = #{date},</if>
<if test="result != null and result != ''">result = #{result},</if>
<if test="remarks != null">remarks = #{remarks},</if>
<if test="gpsLocation != null">gps_location = #{gpsLocation},</if>
<if test="creator != null">creator = #{creator},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEnterpriseInspectionsById" parameterType="Long">
delete from enterprise_inspections where id = #{id}
</delete>
<delete id="deleteEnterpriseInspectionsByIds" parameterType="String">
delete from enterprise_inspections where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

16
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deptId" column="dept_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="realName" column="real_name" />
<result property="email" column="email" />
<result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" />
@ -49,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectUserVo">
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"
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.real_name,u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
<if test="userId != null and userId != 0">
@ -68,6 +69,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="realName != null and realName != ''">
AND u.real_name like concat('%', #{realName}, '%')
</if>
<if test="status != null and status != ''">
AND u.status = #{status}
</if>
@ -88,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
select distinct u.user_id, u.dept_id, u.user_name,u.real_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
@ -105,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
select distinct u.user_id, u.dept_id, u.user_name,u.real_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
@ -153,6 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="realName != null and realName != ''">real_name,</if>
<if test="email != null and email != ''">email,</if>
<if test="userType != null and userType != ''">user_type,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
@ -168,7 +173,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null and userId != ''">#{userId},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="realName != null and realName != ''">#{realName},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="userType != null and userType != ''">#{userType},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
@ -189,6 +196,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="realName != null and realName != ''">real_name = #{realName},</if>
<if test="email != null ">email = #{email},</if>
<if test="userType != null ">user_type = #{userType},</if>
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>

Loading…
Cancel
Save