|
|
@@ -15,6 +15,7 @@ import com.tuoheng.common.core.utils.*; |
|
|
|
import com.tuoheng.miniprogram.dao.*; |
|
|
|
import com.tuoheng.miniprogram.entity.*; |
|
|
|
import com.tuoheng.miniprogram.entity.query.InspectionQuery; |
|
|
|
import com.tuoheng.miniprogram.enums.UserTypeEnum; |
|
|
|
import com.tuoheng.miniprogram.service.IInspectionService; |
|
|
|
import com.tuoheng.miniprogram.utils.ShiroUtils; |
|
|
|
import com.tuoheng.miniprogram.vo.AirLineVO; |
|
|
@@ -68,7 +69,7 @@ public class InspectionServiceImpl implements IInspectionService { |
|
|
|
// String username = SecurityUserUtils.username(); |
|
|
|
//获取租户id |
|
|
|
String tenantId = ShiroUtils.getTenantId(); |
|
|
|
String username = "wangwang"; |
|
|
|
String username = "admin"; |
|
|
|
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() |
|
|
|
.eq(StringUtils.isNotEmpty(username), User::getUsername, username) |
|
|
|
.eq(User::getStatus, 1).eq(User::getMark, 1)); |
|
|
@@ -95,19 +96,15 @@ public class InspectionServiceImpl implements IInspectionService { |
|
|
|
} |
|
|
|
query.setStartTimeDate(startTime); |
|
|
|
query.setEndTimeDate(endTime); |
|
|
|
// 根据部门id获取此部门id和所有下级部门id封装list集合 |
|
|
|
List<String> deptLists = deptMapper.selectAllChildListById(query.getDeptId()); |
|
|
|
if (StringUtils.isEmpty(deptLists)){ |
|
|
|
Integer type = user.getType(); |
|
|
|
if(null == type){ |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
|
|
|
|
List<InspectionInfoVo> inspectionInfoVoList = new ArrayList<>(); |
|
|
|
|
|
|
|
for (int i = 0; i < deptLists.size(); i++) { |
|
|
|
String deptId = deptLists.get(i); |
|
|
|
query.setDeptId(deptId); |
|
|
|
IPage<InspectionInfoVo> pageData = inspectionMapper.queryPage(page,query); |
|
|
|
pageData.getRecords().stream().forEach(x->{ |
|
|
|
//用户角色判断 1超级管理员 2部门管理员 3普通用户 |
|
|
|
if(UserTypeEnum.SUPER_ADMIN.getCode()==type){ |
|
|
|
IPage<InspectionInfoVo> IPageData = inspectionMapper.queryPage(page, query); |
|
|
|
IPageData.getRecords().stream().forEach(x->{ |
|
|
|
int problemsFoundNum = 0; |
|
|
|
int problemsVerifiedNum = 0; |
|
|
|
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() |
|
|
@@ -119,25 +116,63 @@ public class InspectionServiceImpl implements IInspectionService { |
|
|
|
} |
|
|
|
problemsVerifiedNum = inspectionFileList.size(); |
|
|
|
for (InspectionFile inspectionFile : inspectionFileList) { |
|
|
|
if (5 == inspectionFile.getStatus()) { |
|
|
|
if (15 == inspectionFile.getStatus()) { |
|
|
|
problemsFoundNum += 1; |
|
|
|
} |
|
|
|
} |
|
|
|
//获取任务deptId1:1为部门任务 0为子部门任务 |
|
|
|
if(deptIdInt.equals(deptId)){ |
|
|
|
x.setFlag(1); |
|
|
|
}else { |
|
|
|
x.setFlag(0); |
|
|
|
} |
|
|
|
x.setFlag(1); |
|
|
|
x.setProblemsFoundNum(problemsFoundNum); |
|
|
|
x.setProblemsVerifiedNum(problemsVerifiedNum); |
|
|
|
}); |
|
|
|
List<InspectionInfoVo> records = pageData.getRecords(); |
|
|
|
List<InspectionInfoVo> records = IPageData.getRecords(); |
|
|
|
for (InspectionInfoVo record : records) { |
|
|
|
inspectionInfoVoList.add(record); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//登录用户角色为部门管理员或普通用户 |
|
|
|
if(UserTypeEnum.ADMIN.getCode()==type || UserTypeEnum.ORDINARY_USER.getCode()==type){ |
|
|
|
// 根据部门id获取此部门id和所有下级部门id封装list集合 |
|
|
|
List<String> deptLists = deptMapper.selectAllChildListById(query.getDeptId()); |
|
|
|
if (StringUtils.isEmpty(deptLists)){ |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
for (int i = 0; i < deptLists.size(); i++) { |
|
|
|
String deptId = deptLists.get(i); |
|
|
|
query.setDeptId(deptId); |
|
|
|
IPage<InspectionInfoVo> pageData = inspectionMapper.queryPage(page,query); |
|
|
|
pageData.getRecords().stream().forEach(x->{ |
|
|
|
int problemsFoundNum = 0; |
|
|
|
int problemsVerifiedNum = 0; |
|
|
|
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() |
|
|
|
.eq(StringUtils.isNotEmpty(x.getId()), InspectionFile::getInspectionId, x.getId()) |
|
|
|
.eq(InspectionFile::getTenantId, 0) |
|
|
|
.eq(InspectionFile::getMark,1)); |
|
|
|
if(StringUtils.isEmpty(inspectionFileList)){ |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
problemsVerifiedNum = inspectionFileList.size(); |
|
|
|
for (InspectionFile inspectionFile : inspectionFileList) { |
|
|
|
if (15 == inspectionFile.getStatus()) { |
|
|
|
problemsFoundNum += 1; |
|
|
|
} |
|
|
|
} |
|
|
|
//获取任务deptId1:1为部门任务 0为子部门任务 |
|
|
|
if(deptIdInt.equals(deptId)){ |
|
|
|
x.setFlag(1); |
|
|
|
}else { |
|
|
|
x.setFlag(0); |
|
|
|
} |
|
|
|
x.setProblemsFoundNum(problemsFoundNum); |
|
|
|
x.setProblemsVerifiedNum(problemsVerifiedNum); |
|
|
|
}); |
|
|
|
List<InspectionInfoVo> records = pageData.getRecords(); |
|
|
|
for (InspectionInfoVo record : records) { |
|
|
|
inspectionInfoVoList.add(record); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
pageDataVo.setRecords(inspectionInfoVoList); |
|
|
|
|
|
|
|
|