Browse Source

部门信息简报查询最新五条任务列表

tags/v1.0.0^2
chengwang 1 year ago
parent
commit
d5b5e83f59
5 changed files with 21 additions and 20 deletions
  1. +3
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionController.java
  2. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspectionfile/ListByDeptUserTypeEnum.java
  3. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/IInspectionService.java
  4. +3
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/InspectionServiceImpl.java
  5. +11
    -11
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryNewInspectionListService.java

+ 3
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionController.java View File

@@ -143,12 +143,12 @@ public class InspectionController {

/**
* 根据用户id获取最新的五条任务信息
* @param query
* @param
* @return
*/
@GetMapping("/getNewInspectionList")
public JsonResult getNewInspectionList(InspectionFileQuery query){
return iInspectionService.getNewInspectionList(query);
public JsonResult getNewInspectionList(){
return iInspectionService.getNewInspectionList();
}

}

+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspectionfile/ListByDeptUserTypeEnum.java View File

@@ -12,7 +12,8 @@ public enum ListByDeptUserTypeEnum {
INSPECTION_TYPE_LIST_IS_NULL(1100303, "问题列表为空"),
INSPECTION_LIST_IS_NULL(1100304, "任务列表为空"),
DEPT_ID_IS_NULL(1100305, "部门id为空"),
QUESTION_ID_IS_NULL(1100306, "问题列表为空");
QUESTION_ID_IS_NULL(1100306, "问题列表为空"),
TENANT_ID_IS_NULL(1100307, "租户id为空");

/**
* 错误码

+ 2
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/IInspectionService.java View File

@@ -109,9 +109,9 @@ public interface IInspectionService {

/**
* 根据用户id获取最新的五条任务信息
* @param query
* @param
* @return
*/
JsonResult getNewInspectionList(InspectionFileQuery query);
JsonResult getNewInspectionList();

}

+ 3
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/InspectionServiceImpl.java View File

@@ -210,12 +210,12 @@ public class InspectionServiceImpl implements IInspectionService {

/**
* 根据用户id获取最新的五条任务信息
* @param query
* @param
* @return
*/
@Override
public JsonResult getNewInspectionList(InspectionFileQuery query) {
return queryNewInspectionListService.getList(query);
public JsonResult getNewInspectionList() {
return queryNewInspectionListService.getList();
}

}

+ 11
- 11
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryNewInspectionListService.java View File

@@ -40,23 +40,23 @@ public class QueryNewInspectionListService {



public JsonResult getList(InspectionFileQuery query) {
if(null == query.getUserId()){
JsonResult.error(ListByDeptUserTypeEnum.QUERY_IS_FAILED.getCode(),ListByDeptUserTypeEnum.QUERY_IS_FAILED.getMsg());
}
public JsonResult getList() {
//获取登录用户信息
//String username = SecurityUserUtils.username();
// String username = "admin";
// if(StringUtils.isEmpty(username)){
// JsonResult.error(ListByDeptUserTypeEnum.USER_NAME_IS_NULL.getCode(),ListByDeptUserTypeEnum.USER_NAME_IS_NULL.getMsg());
// }
String username = "admin";
if(StringUtils.isEmpty(username)){
JsonResult.error(ListByDeptUserTypeEnum.USER_NAME_IS_NULL.getCode(),ListByDeptUserTypeEnum.USER_NAME_IS_NULL.getMsg());
}
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(User::getId, query.getUserId()).eq(User::getMark, 1));
.eq(User::getUsername, username).eq(User::getMark, 1));
if(ObjectUtil.isNull(user)){
JsonResult.error(ListByDeptUserTypeEnum.USER_IS_NULL.getCode(),ListByDeptUserTypeEnum.USER_IS_NULL.getMsg());
}
String tenantId = user.getTenantId();
String deptId = user.getDeptId();
if(StringUtils.isEmpty(tenantId)){
JsonResult.error(ListByDeptUserTypeEnum.TENANT_ID_IS_NULL.getCode(),ListByDeptUserTypeEnum.TENANT_ID_IS_NULL.getMsg());
}

//判断用户角色 1超级管理员 2部门管理员 3普通用户
if(null == user.getType()){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
@@ -82,7 +82,7 @@ public class QueryNewInspectionListService {

//若角色为部门管理员或普通用户,查询最新五条数据
if(UserTypeEnum.ADMIN.getCode()==user.getType() || UserTypeEnum.ORDINARY_USER.getCode()==user.getType()){
String deptId = user.getDeptId();
if(StringUtils.isEmpty(deptId)){
JsonResult.error(QueryInspectionListServiceEnum.DEPT_ID_IS_NULL.getCode(),QueryInspectionListServiceEnum.DEPT_ID_IS_NULL.getMsg());
}

Loading…
Cancel
Save