Browse Source

Merge branch 'develop' of gitadmin/tuoheng_freeway into release

tags/V1.3.3
wanjing 1 year ago
parent
commit
003af0fa84
2 changed files with 16 additions and 35 deletions
  1. +11
    -19
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionServiceImpl.java
  2. +5
    -16
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java

+ 11
- 19
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionServiceImpl.java View File

package com.tuoheng.miniprogram.service.impl; package com.tuoheng.miniprogram.service.impl;


import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
*/ */
@Override @Override
public JsonResult index(InspectionQuery query) { public JsonResult index(InspectionQuery query) {
log.info("获取任务分页列表,query={}", query);
if (null == query.getLimit() && null == query.getPage()) { if (null == query.getLimit() && null == query.getPage()) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//登录用户信息 //登录用户信息
User userInfo = CurrentUserUtil.getUserInfo();
String username = userInfo.getUsername();
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(StringUtils.isNotEmpty(username), User::getUsername, username)
.eq(User::getStatus, 1).eq(User::getMark, 1));
if (ObjectUtil.isNull(user)) {
return null;
User user = CurrentUserUtil.getUserInfo();
Integer type = user.getDataPermission();
if (null == type) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
String tenantId = user.getTenantId(); String tenantId = user.getTenantId();
if (StringUtils.isEmpty(tenantId)) {
return null;
}

query.setTenantId(tenantId); query.setTenantId(tenantId);
query.setDeptId(user.getDeptId());
query.setType(1); query.setType(1);
//查询部门及下级部门列表
List<Dept> list = deptMapper.selectList(Wrappers.<Dept>lambdaQuery()
.eq(Dept::getMark, 1));

//初始部门id //初始部门id
String deptIdInt = query.getDeptId(); String deptIdInt = query.getDeptId();

//获取当前部门对应的巡检任务 //获取当前部门对应的巡检任务
//获取分页数据 //获取分页数据
IPage<Inspection> page = new Page<>(query.getPage(), query.getLimit()); IPage<Inspection> page = new Page<>(query.getPage(), query.getLimit());
} }
query.setStartTimeDate(startTime); query.setStartTimeDate(startTime);
query.setEndTimeDate(endTime); query.setEndTimeDate(endTime);
Integer type = user.getDataPermission();
if (null == type) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}

List<InspectionInfoVo> inspectionInfoVoList = new ArrayList<>(); List<InspectionInfoVo> inspectionInfoVoList = new ArrayList<>();
//用户角色判断 1超级管理员 2部门管理员 3普通用户 //用户角色判断 1超级管理员 2部门管理员 3普通用户
if (DataPermissionEnum.ALL.getCode() == type) { if (DataPermissionEnum.ALL.getCode() == type) {


pageDataVo.setRecords(inspectionInfoVoList); pageDataVo.setRecords(inspectionInfoVoList);


log.info("获取任务分页列表,pageDataVo={}", pageDataVo);


return JsonResult.success(pageDataVo); return JsonResult.success(pageDataVo);
} }


} }



/** /**
* 递归获取部门的子集 * 递归获取部门的子集
* *

+ 5
- 16
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java View File

*/ */
@Override @Override
public JsonResult getTodoList(WorkOrderQuery query) { public JsonResult getTodoList(WorkOrderQuery query) {
log.info("获取代办工单列表,query={}", query);
if (query.getLimit() == null && query.getPage() == null) { if (query.getLimit() == null && query.getPage() == null) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//登录用户信息 //登录用户信息
User userInfo1 = CurrentUserUtil.getUserInfo();
String username = userInfo1.getUsername();
if (null == username) {
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(), WorkOrderEnum.USER_NAME_IS_NULL.getMsg());
}
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(User::getMark, 1)
.eq(User::getUsername, username));
if (ObjectUtil.isNull(user)) {
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(), WorkOrderEnum.USER_IS_NOT_EXIST.getMsg());
}
String tenantId = userInfo1.getTenantId();
if (null == tenantId) {
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(), WorkOrderEnum.DEPT_ID_IS_NULL.getMsg());
}
User user = CurrentUserUtil.getUserInfo();
String tenantId = user.getTenantId();

query.setTenantId(tenantId); query.setTenantId(tenantId);
//获取分页数据 //获取分页数据
IPage<WorkOrder> page = new Page<>(query.getPage(), query.getLimit()); IPage<WorkOrder> page = new Page<>(query.getPage(), query.getLimit());
.like(StringUtils.isNotEmpty(user.getId()), WorkOrder::getAssignUser, user.getId()) .like(StringUtils.isNotEmpty(user.getId()), WorkOrder::getAssignUser, user.getId())
.eq(WorkOrder::getTenantId, tenantId) .eq(WorkOrder::getTenantId, tenantId)
.between(null != query.getOrderStartTime() && null != query.getOrderEndTime(), WorkOrder::getCreateTime, query.getOrderStartTime(), query.getOrderEndTime()) .between(null != query.getOrderStartTime() && null != query.getOrderEndTime(), WorkOrder::getCreateTime, query.getOrderStartTime(), query.getOrderEndTime())
.eq(WorkOrder::getMark, 1)
.eq(WorkOrder::getMark, MarkEnum.VALID.getCode())
.orderByDesc(WorkOrder::getCreateTime)); .orderByDesc(WorkOrder::getCreateTime));
if (null == workPageData.getRecords()) { if (null == workPageData.getRecords()) {
return null; return null;

Loading…
Cancel
Save