|
|
|
|
|
|
|
|
import com.tuoheng.miniprogram.dao.*; |
|
|
import com.tuoheng.miniprogram.dao.*; |
|
|
import com.tuoheng.miniprogram.entity.*; |
|
|
import com.tuoheng.miniprogram.entity.*; |
|
|
import com.tuoheng.miniprogram.entity.query.InspectionQuery; |
|
|
import com.tuoheng.miniprogram.entity.query.InspectionQuery; |
|
|
|
|
|
import com.tuoheng.miniprogram.enums.UserTypeEnum; |
|
|
import com.tuoheng.miniprogram.service.IInspectionService; |
|
|
import com.tuoheng.miniprogram.service.IInspectionService; |
|
|
import com.tuoheng.miniprogram.utils.ShiroUtils; |
|
|
import com.tuoheng.miniprogram.utils.ShiroUtils; |
|
|
import com.tuoheng.miniprogram.vo.AirLineVO; |
|
|
import com.tuoheng.miniprogram.vo.AirLineVO; |
|
|
|
|
|
|
|
|
// String username = SecurityUserUtils.username(); |
|
|
// String username = SecurityUserUtils.username(); |
|
|
//获取租户id |
|
|
//获取租户id |
|
|
String tenantId = ShiroUtils.getTenantId(); |
|
|
String tenantId = ShiroUtils.getTenantId(); |
|
|
String username = "wangwang"; |
|
|
|
|
|
|
|
|
String username = "admin"; |
|
|
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() |
|
|
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() |
|
|
.eq(StringUtils.isNotEmpty(username), User::getUsername, username) |
|
|
.eq(StringUtils.isNotEmpty(username), User::getUsername, username) |
|
|
.eq(User::getStatus, 1).eq(User::getMark, 1)); |
|
|
.eq(User::getStatus, 1).eq(User::getMark, 1)); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
query.setStartTimeDate(startTime); |
|
|
query.setStartTimeDate(startTime); |
|
|
query.setEndTimeDate(endTime); |
|
|
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); |
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<InspectionInfoVo> inspectionInfoVoList = new ArrayList<>(); |
|
|
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 problemsFoundNum = 0; |
|
|
int problemsVerifiedNum = 0; |
|
|
int problemsVerifiedNum = 0; |
|
|
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() |
|
|
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
problemsVerifiedNum = inspectionFileList.size(); |
|
|
problemsVerifiedNum = inspectionFileList.size(); |
|
|
for (InspectionFile inspectionFile : inspectionFileList) { |
|
|
for (InspectionFile inspectionFile : inspectionFileList) { |
|
|
if (5 == inspectionFile.getStatus()) { |
|
|
|
|
|
|
|
|
if (15 == inspectionFile.getStatus()) { |
|
|
problemsFoundNum += 1; |
|
|
problemsFoundNum += 1; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
//获取任务deptId1:1为部门任务 0为子部门任务 |
|
|
|
|
|
if(deptIdInt.equals(deptId)){ |
|
|
|
|
|
x.setFlag(1); |
|
|
|
|
|
}else { |
|
|
|
|
|
x.setFlag(0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
x.setFlag(1); |
|
|
x.setProblemsFoundNum(problemsFoundNum); |
|
|
x.setProblemsFoundNum(problemsFoundNum); |
|
|
x.setProblemsVerifiedNum(problemsVerifiedNum); |
|
|
x.setProblemsVerifiedNum(problemsVerifiedNum); |
|
|
}); |
|
|
}); |
|
|
List<InspectionInfoVo> records = pageData.getRecords(); |
|
|
|
|
|
|
|
|
List<InspectionInfoVo> records = IPageData.getRecords(); |
|
|
for (InspectionInfoVo record : records) { |
|
|
for (InspectionInfoVo record : records) { |
|
|
inspectionInfoVoList.add(record); |
|
|
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); |
|
|
pageDataVo.setRecords(inspectionInfoVoList); |
|
|
|
|
|
|
|
|
|
|
|
|