Browse Source

Merge branch 'develop' of gitadmin/tuoheng_freeway into release

tags/v1.1.0^2
wanjing 1 year ago
parent
commit
132fb04701
5 changed files with 136 additions and 5 deletions
  1. +27
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/InspectionExecutionStatusEnum.java
  2. +6
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java
  3. +98
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/handle/EditHandle.java
  4. +0
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/handle/ExecuteHandle.java
  5. +5
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/inspection/InspectionVo.java

+ 27
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/InspectionExecutionStatusEnum.java View File

@@ -0,0 +1,27 @@
package com.tuoheng.admin.enums;

import lombok.Getter;

/**
* 任务执行状态枚举:1:未执行,2:已执行
*
* @author wanjing
* @team tuoheng
* @date 2023-02-02
*/
public enum InspectionExecutionStatusEnum {

UNEXECUTED(1,"未执行"),
EXECUTED(2,"已执行");

InspectionExecutionStatusEnum(int code, String description){
this.code = code;
this.description = description;
}

@Getter
private int code;

@Getter
private String description;
}

+ 6
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java View File

@@ -81,6 +81,10 @@ public class QueryInspectionPageListService {
@Qualifier("deleteHandle")
private GenerateInspectionFieldHander deleteHandle;

@Autowired
@Qualifier("editHandle")
private GenerateInspectionFieldHander editHandle;

@PostConstruct
public void start() {
executeHandle.setNextHandler(liveHandle);
@@ -89,7 +93,8 @@ public class QueryInspectionPageListService {
problemVerifyHandleHandle.setNextHandler(problemDetailsHandleHandle);
problemDetailsHandleHandle.setNextHandler(problemCountHandle);
problemCountHandle.setNextHandler(deleteHandle);
deleteHandle.setNextHandler(resubmitHandle);
deleteHandle.setNextHandler(editHandle);
editHandle.setNextHandler(resubmitHandle);
}

public JsonResult getPageList(QueryInspectionPageListRequest request) {

+ 98
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/handle/EditHandle.java View File

@@ -0,0 +1,98 @@
package com.tuoheng.admin.service.inspection.query.handle;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.*;
import com.tuoheng.admin.enums.code.inspection.EditInspectionCodeEnum;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.vo.inspection.InspectionVo;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service("editHandle")
public class EditHandle implements GenerateInspectionFieldHander {

private GenerateInspectionFieldHander handler;

@Autowired
private UserMapper userMapper;

@Override
public void setNextHandler(GenerateInspectionFieldHander handler) {
this.handler = handler;
}

/**
*
* 判断是否有编辑权限
* 1、机场任务:
* 1)、只有本部门管理员(上上级部门管理员不可编辑)和创建用户才能编辑;
* 2)、待执行任务,执行后不可编辑;
* 3)、编辑信息包括,任务地点,路段,巡检机场,巡检路线,巡检时间,执行时间
* 2、飞手任务不能编辑。
*
*
* @param user
* @param dept
* @param inspectionVo
*/
@Override
public void handler(User user, Dept dept, InspectionVo inspectionVo) {
// log.info("处理编辑字段");
if (InspectionTypeEnum.AIRPORT.getCode() != inspectionVo.getInspectionType()) {
if (null != handler) {
handler.handler(user, dept, inspectionVo);
}
return;
}
if (InspectionStatusEnum.WAIT_FLIGHT.getCode() != inspectionVo.getStatus()) {
// 待执行任务
if (null != handler) {
handler.handler(user, dept, inspectionVo);
}
return;
}
if (InspectionExecutionStatusEnum.EXECUTED.getCode() == inspectionVo.getExecutionStatus()) {
// 执行后不可编辑
if (null != handler) {
handler.handler(user, dept, inspectionVo);
}
return;
}
if (user.getId().equals(inspectionVo.getCreateUser())) {
// 自己创建的任务
inspectionVo.setEdit(true);
} else {
// 非本人创建,判断该用户是不是该部门管理员
// 本部门主管编辑本部门任务
// 查询部门管理员,若是部门管理员可修改,非部门管理员不能修改
User userTmp = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(User::getDeptId, user.getDeptId())
.eq(User::getRoleId, RoleEnum.ADMIN.getCode())
.eq(User::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(userTmp)) {
if (null != handler) {
handler.handler(user, dept, inspectionVo);
return;
}
}
if (!user.getId().equals(userTmp.getId())) {
if (null != handler) {
handler.handler(user, dept, inspectionVo);
return;
}
}
inspectionVo.setEdit(true);
}

if (null != handler) {
handler.handler(user, dept, inspectionVo);
return;
}
}
}

+ 0
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/handle/ExecuteHandle.java View File

@@ -61,12 +61,8 @@ public class ExecuteHandle implements GenerateInspectionFieldHander {
inspectionVo.setExecute(true);
}
}

if (null != handler) {
handler.handler(user, dept, inspectionVo);
}
}



}

+ 5
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/inspection/InspectionVo.java View File

@@ -317,4 +317,9 @@ public class InspectionVo extends BaseEntity {
*/
private boolean delete;

/**
* 编辑
*/
private boolean edit;

}

Loading…
Cancel
Save