Explorar el Código

添加租户判断

tags/v1.0.0^2
wanjing hace 1 año
padre
commit
844925630e
Se han modificado 19 ficheros con 54 adiciones y 6 borrados
  1. +5
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspection/QueryInspectionPageListRequest.java
  2. +4
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFileDistributionListRequest.java
  3. +5
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFilePageListRequest.java
  4. +0
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFileWorkOrderPageListRequest.java
  5. +6
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/report/QueryReportPageListRequest.java
  6. +5
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/workorder/QueryWorkOrderPageListRequest.java
  7. +4
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryListTreeService.java
  8. +1
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java
  9. +2
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFileDistributionListService.java
  10. +5
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListByWorkOrderIdService.java
  11. +5
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListService.java
  12. +1
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryReportPageListService.java
  13. +0
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/UserServiceImpl.java
  14. +3
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/query/QueryUserListByDeptIdService.java
  15. +2
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/workorder/query/QueryWorkOrderPageListService.java
  16. +2
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml
  17. +1
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionMapper.xml
  18. +1
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/ReportMapper.xml
  19. +2
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/WorkOrderMapper.xml

+ 5
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspection/QueryInspectionPageListRequest.java Ver fichero

@@ -60,4 +60,9 @@ public class QueryInspectionPageListRequest extends BaseQuery {
*/
private List<String> deptIdList;

/**
* 租户Id
*/
private String tenantId;

}

+ 4
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFileDistributionListRequest.java Ver fichero

@@ -34,4 +34,8 @@ public class QueryInspectionFileDistributionListRequest {
*/
private List<String> deptIdList;

/**
* 租户Id
*/
private String tenantId;
}

+ 5
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFilePageListRequest.java Ver fichero

@@ -57,4 +57,9 @@ public class QueryInspectionFilePageListRequest extends BaseQuery {
*/
private List<String> deptIdList;

/**
* 租户ID
*/
private String tenantId;

}

+ 0
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFileWorkOrderPageListRequest.java Ver fichero

@@ -19,5 +19,4 @@ public class QueryInspectionFileWorkOrderPageListRequest extends BaseQuery {
* 工单ID
*/
private String workOrderId;

}

+ 6
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/report/QueryReportPageListRequest.java Ver fichero

@@ -33,4 +33,10 @@ public class QueryReportPageListRequest extends BaseQuery {
*/
private String createUser;

/**
* 租户Id
*/
private String tenantId;


}

+ 5
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/workorder/QueryWorkOrderPageListRequest.java Ver fichero

@@ -57,4 +57,9 @@ public class QueryWorkOrderPageListRequest extends BaseQuery {
*/
private List<String> deptIdList;

/**
* 租户Id
*/
private String tenantId;

}

+ 4
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryListTreeService.java Ver fichero

@@ -6,6 +6,7 @@ import com.tuoheng.admin.conver.DeptConverMapper;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.enums.code.dept.QueryDeptTreeListCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.dept.DeptTreeVo;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
@@ -39,8 +40,11 @@ public class QueryListTreeService {
public JsonResult getListTree() {
List<DeptTreeVo> deptTreeVoList = new ArrayList<>();

String tenantId = CurrentUserUtil.getTenantId();

// 查询所有有效的部门数据
List<Dept> deptList = deptMapper.selectList(new LambdaQueryWrapper<Dept>()
.eq(Dept::getTenantId, tenantId)
.eq(Dept::getMark, 1));

if (CollectionUtil.isEmpty(deptList)) {

+ 1
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java Ver fichero

@@ -97,6 +97,7 @@ public class QueryInspectionPageListService {

String userId = CurrentUserUtil.getUserId();
String tenantId = CurrentUserUtil.getTenantId();
request.setTenantId(tenantId);

JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) {

+ 2
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFileDistributionListService.java Ver fichero

@@ -52,6 +52,8 @@ public class QueryInspectionFileDistributionListService {
log.info("进入查询任务问题分布列表业务, request:{}", request.toString());

String userId = CurrentUserUtil.getUserId();
String tenantId = CurrentUserUtil.getTenantId();
request.setTenantId(tenantId);

JsonResult result = this.check(request);
if (0 != result.getCode()) {

+ 5
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListByWorkOrderIdService.java Ver fichero

@@ -65,11 +65,14 @@ public class QueryInspectionFilePageListByWorkOrderIdService {
return result;
}

String tenantId = CurrentUserUtil.getTenantId();

// 设置分页参数
IPage<WorkOrderFile> page = new Page<>(request.getPage(), request.getLimit());
// 查询结果
IPage<WorkOrderFile> pageData = workOrderFileMapper.selectPage(page, new LambdaQueryWrapper<WorkOrderFile>()
.eq(WorkOrderFile::getWorkOrderId, request.getWorkOrderId()));
.eq(WorkOrderFile::getTenantId, tenantId)
.eq(WorkOrderFile::getWorkOrderId, request.getWorkOrderId()));

if (null == pageData || pageData.getTotal() == 0) {
log.info("根据工单ID查询工单问题列表业务:获取任务分页列表为空");
@@ -82,6 +85,7 @@ public class QueryInspectionFilePageListByWorkOrderIdService {

List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>()
.in(InspectionFile::getId, inspectionFileIdList)
.eq(InspectionFile::getTenantId, tenantId)
.eq(InspectionFile::getMark, 1));

// 构造返回结果对象

+ 5
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListService.java Ver fichero

@@ -57,6 +57,8 @@ public class QueryInspectionFilePageListService {
log.info("进入查询任务问题分页列表业务, request:{}", request.toString());

String userId = CurrentUserUtil.getUserId();
String tenantId = CurrentUserUtil.getTenantId();
request.setTenantId(tenantId);

JsonResult result = this.check(request);
if (0 != result.getCode()) {
@@ -65,7 +67,7 @@ public class QueryInspectionFilePageListService {
}

// 获取部门Id的查询范围
List<String> deptIdList = this.getDeptIdList(userId, request.getDeptId());
List<String> deptIdList = this.getDeptIdList(userId, tenantId, request.getDeptId());
request.setDeptIdList(deptIdList);

// 设置分页参数
@@ -112,7 +114,7 @@ public class QueryInspectionFilePageListService {
* @param deptId
* @return
*/
private List<String> getDeptIdList(String userId, String deptId) {
private List<String> getDeptIdList(String userId, String tenantId, String deptId) {
List<String> deptIdList = new ArrayList<>();
if (!StringUtils.isEmpty(deptId)) {
deptIdList.add(deptId);
@@ -120,6 +122,7 @@ public class QueryInspectionFilePageListService {
}
User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(User::getId, userId)
.eq(User::getTenantId, tenantId)
.eq(User::getMark, 1));
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) {
return null;

+ 1
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryReportPageListService.java Ver fichero

@@ -53,6 +53,7 @@ public class QueryReportPageListService {

String userId = CurrentUserUtil.getUserId();
String tenantId = CurrentUserUtil.getTenantId();
request.setTenantId(tenantId);

JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) {

+ 0
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/UserServiceImpl.java Ver fichero

@@ -76,7 +76,6 @@ public class UserServiceImpl implements IUserService {
/**
* 获取用户详情
*
* @param username
* @return
*/
@Override

+ 3
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/query/QueryUserListByDeptIdService.java Ver fichero

@@ -9,6 +9,7 @@ import com.tuoheng.admin.enums.code.dept.QueryDeptChildListCodeEnum;
import com.tuoheng.admin.enums.code.user.QueryUserListByDeptIdCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
@@ -46,8 +47,9 @@ public class QueryUserListByDeptIdService {
log.info("根据根据部门id查询用户列表业业务:校验失败:{}", result.getMsg());
return result;
}
String tenantId = CurrentUserUtil.getTenantId();
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
.eq(User::getTenantId, tenantId)
.eq(User::getDeptId, deptId)
.ne(User::getRoleId, RoleEnum.SUPER_ADMIN.getCode())
.eq(User::getMark, 1));

+ 2
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/workorder/query/QueryWorkOrderPageListService.java Ver fichero

@@ -56,6 +56,8 @@ public class QueryWorkOrderPageListService {
log.info("进入查询工单分页列表业务, request:{}", request.toString());

String userId = CurrentUserUtil.getUserId();
String tenantId = CurrentUserUtil.getTenantId();
request.setTenantId(tenantId);

JsonResult result = this.check(request);
if (0 != result.getCode()) {

+ 2
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml Ver fichero

@@ -196,6 +196,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="1 == 1"> and tif.mark = 1 </if>
<if test="request.key != null and request.key != ''"> and (ti.code like concat('%', #{request.key}, '%') or ti.name like concat('%', #{request.key}, '%')) </if>
<if test="request.tenantId != null and request.tenantId != ''"> and tenant_id = #{request.tenantId} </if>
<if test="request.questionCode != null and request.questionCode != ''"> and tif.question_Code = #{request.questionCode} </if>
<choose>
<when test="request.status != null and request.status != 0">
@@ -228,6 +229,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="1 == 1"> and tif.mark = 1 </if>
<if test="request.inspectionName != null and request.inspectionName != ''"> and ti.name like concat('%', #{request.inspectionName}, '%') </if>
<if test="request.tenantId != null and request.tenantId != ''"> and tenant_id = #{request.tenantId} </if>
<if test="request.questionCode != null and request.questionCode != ''"> and tif.question_code = #{request.questionCode} </if>
<if test="request.status != null">
<choose>

+ 1
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionMapper.xml Ver fichero

@@ -93,6 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="1 == 1"> and mark = 1 </if>
<if test="request.code != null and request.code != ''"> and code like concat('%', #{request.code}, '%') </if>
<if test="request.tenantId != null and request.tenantId != ''"> and tenant_id = #{request.tenantId} </if>
<if test="request.airportId != null and request.airportId != 0"> and airport_id = #{request.airportId} </if>
<if test="request.inspectionLine != null and request.inspectionLine != 0"> and inspection_line = #{request.inspectionLine} </if>
<if test="request.type != null and request.type != 0"> and type = #{request.type} </if>

+ 1
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/ReportMapper.xml Ver fichero

@@ -73,6 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectReportVo"/>
<where>
<if test="1 == 1"> and mark = 1 </if>
<if test="request.tenantId != null and request.tenantId != ''"> and tenant_id = #{request.tenantId} </if>
<if test="request.inspectionCode!= null and request.inspectionCode != ''"> and inspection_code like concat('%', #{request.inspectionCode}, '%') </if>
<if test="request.airportId != null and request.airportId != 0"> and airport_id = #{request.airportId} </if>
<if test="request.type != null and request.type != 0"> and type = #{request.type} </if>

+ 2
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/WorkOrderMapper.xml Ver fichero

@@ -45,7 +45,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPageList" parameterType="com.tuoheng.admin.request.workorder.QueryWorkOrderPageListRequest" resultMap="WorkOrderResult">
<include refid="selectThWorkOrderVo"/>
<where>
<if test="1 == 1"> and mark = 1 </if>
<if test="request.tenantId != null and request.tenantId != ''"> and tenant_id = #{request.tenantId} </if>
<if test="request.code != null and request.code != 0"> and code = #{request.code} </if>
<if test="request.status != null and request.status != ''"> and status = #{request.status} </if>
<if test="(request.userDeptId != null and request.userDeptId != '') or (request.deptIdList != null and request.deptIdList.size() > 0)">

Cargando…
Cancelar
Guardar