|
|
@@ -8,7 +8,7 @@ import com.tuoheng.admin.entity.InspectionFile; |
|
|
|
import com.tuoheng.admin.entity.QuestionType; |
|
|
|
import com.tuoheng.admin.entity.User; |
|
|
|
import com.tuoheng.admin.enums.DataPermissionEnum; |
|
|
|
import com.tuoheng.admin.enums.code.inspectionfile.ListByDeptUserTypeEnum; |
|
|
|
import com.tuoheng.admin.enums.MarkEnum; |
|
|
|
import com.tuoheng.admin.enums.code.questiontype.QuestionTypeEnum; |
|
|
|
import com.tuoheng.admin.mapper.DeptMapper; |
|
|
|
import com.tuoheng.admin.mapper.InspectionFileMapper; |
|
|
@@ -79,135 +79,93 @@ public class QueryInspectionFileListByDeptUserTypeService { |
|
|
|
Integer reticularCrackNum = 0; |
|
|
|
//5块状裂纹 |
|
|
|
Integer massiveCrack = 0; |
|
|
|
|
|
|
|
|
|
|
|
List<InspectionFile> inspectionFileList = null; |
|
|
|
|
|
|
|
//若角色为超级管理员,查看状态为已生成工单和和问题已处理 |
|
|
|
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) { |
|
|
|
//直接查问题列表 |
|
|
|
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() |
|
|
|
.eq(InspectionFile::getMark, 1) |
|
|
|
inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() |
|
|
|
.eq(InspectionFile::getMark, MarkEnum.VALID.getCode()) |
|
|
|
.eq(InspectionFile::getTenantId, user.getTenantId()) |
|
|
|
.in(InspectionFile::getStatus, 20, 25)); |
|
|
|
//根据状态类型分类 |
|
|
|
if (null == inspectionFileList) { |
|
|
|
return JsonResult.error(ListByDeptUserTypeEnum.INSPECTION_TYPE_LIST_IS_NULL.getCode(), ListByDeptUserTypeEnum.INSPECTION_TYPE_LIST_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
for (InspectionFile inspectionFile : inspectionFileList) { |
|
|
|
if (StringUtils.isEmpty(inspectionFile.getQuestionCode())) { |
|
|
|
return JsonResult.error(ListByDeptUserTypeEnum.QUESTION_ID_IS_NULL.getCode(), ListByDeptUserTypeEnum.QUESTION_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
//查找问题类型 |
|
|
|
QuestionType questionType = questionTypeMapper.selectOne(Wrappers.<QuestionType>lambdaQuery() |
|
|
|
.eq(QuestionType::getMark, 1) |
|
|
|
.eq(QuestionType::getCode, inspectionFile.getQuestionCode())); |
|
|
|
if (ObjectUtil.isNull(questionType)) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
Integer name = questionType.getName(); |
|
|
|
if (name == QuestionTypeEnum.ABEAM_CRACK_NAME.getCode()) { |
|
|
|
//1横向裂缝 |
|
|
|
abeamCrackNum += 1; |
|
|
|
} else if (name == QuestionTypeEnum.RETICULAR_CRACK_NAME.getCode()) { |
|
|
|
//3网状裂纹 |
|
|
|
reticularCrackNum += 1; |
|
|
|
} else if (name == QuestionTypeEnum.PIT_GROOVE_NAME.getCode()) { |
|
|
|
//4坑槽 |
|
|
|
pitGrooveNum += 1; |
|
|
|
} else if (name == QuestionTypeEnum.MASSIVE_CRACK_NAME.getCode()) { |
|
|
|
//5块状裂纹 |
|
|
|
massiveCrack += 1; |
|
|
|
} else if (name == QuestionTypeEnum.PON_DING_NAME.getCode()) { |
|
|
|
//6积水 |
|
|
|
ponDingNum += 1; |
|
|
|
} else if (name == QuestionTypeEnum.LONGITUDINAL_CRACK_NAME.getCode()) { |
|
|
|
//0纵向裂缝 |
|
|
|
longitudinalCrackNum += 1; |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setType(QuestionTypeEnum.ABEAM_CRACK_NAME.getCode()); |
|
|
|
vo.setNum(abeamCrackNum); |
|
|
|
vo1.setType(QuestionTypeEnum.RETICULAR_CRACK_NAME.getCode()); |
|
|
|
vo1.setNum(reticularCrackNum); |
|
|
|
vo2.setType(QuestionTypeEnum.PIT_GROOVE_NAME.getCode()); |
|
|
|
vo2.setNum(pitGrooveNum); |
|
|
|
vo3.setType(QuestionTypeEnum.MASSIVE_CRACK_NAME.getCode()); |
|
|
|
vo3.setNum(massiveCrack); |
|
|
|
vo4.setType(QuestionTypeEnum.PON_DING_NAME.getCode()); |
|
|
|
vo4.setNum(ponDingNum); |
|
|
|
vo5.setType(QuestionTypeEnum.LONGITUDINAL_CRACK_NAME.getCode()); |
|
|
|
vo5.setNum(longitudinalCrackNum); |
|
|
|
Collections.addAll(list, vo, vo1, vo2, vo3, vo4, vo5); |
|
|
|
} |
|
|
|
//若角色为部门管理员或普通用户 |
|
|
|
if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission() || DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) { |
|
|
|
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission() || DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) { |
|
|
|
//若角色为部门管理员或普通用户 |
|
|
|
//获取用户对应的部门 |
|
|
|
String deptId = user.getDeptId(); |
|
|
|
if (StringUtils.isEmpty(deptId)) { |
|
|
|
return JsonResult.error(ListByDeptUserTypeEnum.DEPT_ID_IS_NULL.getCode(), ListByDeptUserTypeEnum.DEPT_ID_IS_NULL.getMsg()); |
|
|
|
log.info("部门id为空"); |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
//根据部门id获取部门id列表 |
|
|
|
List<String> deptIdList = deptMapper.selectAllChildListById(deptId); |
|
|
|
if (CollectionUtil.isEmpty(deptIdList)) { |
|
|
|
return JsonResult.error(ListByDeptUserTypeEnum.DEPT_LIST_IS_NULL.getCode(), ListByDeptUserTypeEnum.DEPT_LIST_IS_NULL.getMsg()); |
|
|
|
log.info("部门列表为空"); |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
//根据部门id列表查多条任务 |
|
|
|
List<Inspection> inspectionList = inspectionMapper.selectListByDeptIdList(deptIdList); |
|
|
|
if (CollectionUtil.isEmpty(inspectionList)) { |
|
|
|
return JsonResult.error(ListByDeptUserTypeEnum.INSPECTION_LIST_IS_NULL.getCode(), ListByDeptUserTypeEnum.INSPECTION_LIST_IS_NULL.getMsg()); |
|
|
|
log.info("任务列表为空"); |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
List<String> inspectionIdList = inspectionList.stream().map(o -> o.getId()).collect(Collectors.toList()); |
|
|
|
//根据任务id列表查找多条问题 |
|
|
|
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectListByInspectIdList(inspectionIdList); |
|
|
|
//根据状态类型分类 |
|
|
|
if (null == inspectionFileList) { |
|
|
|
return JsonResult.error(ListByDeptUserTypeEnum.INSPECTION_TYPE_LIST_IS_NULL.getCode(), ListByDeptUserTypeEnum.INSPECTION_TYPE_LIST_IS_NULL.getMsg()); |
|
|
|
inspectionFileList = inspectionFileMapper.selectListByInspectIdList(inspectionIdList); |
|
|
|
} |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(inspectionFileList)) { |
|
|
|
log.info("问题列表为空"); |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
for (InspectionFile inspectionFile : inspectionFileList) { |
|
|
|
if (StringUtils.isEmpty(inspectionFile.getQuestionCode())) { |
|
|
|
log.info("问题类型为空"); |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
for (InspectionFile inspectionFile : inspectionFileList) { |
|
|
|
if (StringUtils.isEmpty(inspectionFile.getQuestionCode())) { |
|
|
|
return JsonResult.error(ListByDeptUserTypeEnum.QUESTION_ID_IS_NULL.getCode(), ListByDeptUserTypeEnum.QUESTION_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
//查找问题类型 |
|
|
|
QuestionType questionType = questionTypeMapper.selectOne(Wrappers.<QuestionType>lambdaQuery() |
|
|
|
.eq(QuestionType::getMark, 1) |
|
|
|
.eq(QuestionType::getCode, inspectionFile.getQuestionCode())); |
|
|
|
if (ObjectUtil.isNull(questionType)) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
Integer name = questionType.getName(); |
|
|
|
if (name == QuestionTypeEnum.ABEAM_CRACK_NAME.getCode()) { |
|
|
|
//1横向裂缝 |
|
|
|
abeamCrackNum += 1; |
|
|
|
} else if (name == QuestionTypeEnum.RETICULAR_CRACK_NAME.getCode()) { |
|
|
|
//3网状裂纹 |
|
|
|
reticularCrackNum += 1; |
|
|
|
} else if (name == QuestionTypeEnum.PIT_GROOVE_NAME.getCode()) { |
|
|
|
//4坑槽 |
|
|
|
pitGrooveNum += 1; |
|
|
|
} else if (name == QuestionTypeEnum.MASSIVE_CRACK_NAME.getCode()) { |
|
|
|
//5块状裂纹 |
|
|
|
massiveCrack += 1; |
|
|
|
} else if (name == QuestionTypeEnum.PON_DING_NAME.getCode()) { |
|
|
|
//6积水 |
|
|
|
ponDingNum += 1; |
|
|
|
} else if (name == QuestionTypeEnum.LONGITUDINAL_CRACK_NAME.getCode()) { |
|
|
|
//0纵向裂缝 |
|
|
|
longitudinalCrackNum += 1; |
|
|
|
} |
|
|
|
//查找问题类型 |
|
|
|
QuestionType questionType = questionTypeMapper.selectOne(Wrappers.<QuestionType>lambdaQuery() |
|
|
|
.eq(QuestionType::getMark, 1) |
|
|
|
.eq(QuestionType::getCode, inspectionFile.getQuestionCode())); |
|
|
|
if (ObjectUtil.isNull(questionType)) { |
|
|
|
log.info("问题类型不存在, questionCode={}", inspectionFile.getQuestionCode()); |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
Integer name = questionType.getName(); |
|
|
|
if (name == QuestionTypeEnum.ABEAM_CRACK_NAME.getCode()) { |
|
|
|
//1横向裂缝 |
|
|
|
abeamCrackNum += 1; |
|
|
|
} else if (name == QuestionTypeEnum.RETICULAR_CRACK_NAME.getCode()) { |
|
|
|
//3网状裂纹 |
|
|
|
reticularCrackNum += 1; |
|
|
|
} else if (name == QuestionTypeEnum.PIT_GROOVE_NAME.getCode()) { |
|
|
|
//4坑槽 |
|
|
|
pitGrooveNum += 1; |
|
|
|
} else if (name == QuestionTypeEnum.MASSIVE_CRACK_NAME.getCode()) { |
|
|
|
//5块状裂纹 |
|
|
|
massiveCrack += 1; |
|
|
|
} else if (name == QuestionTypeEnum.PON_DING_NAME.getCode()) { |
|
|
|
//6积水 |
|
|
|
ponDingNum += 1; |
|
|
|
} else if (name == QuestionTypeEnum.LONGITUDINAL_CRACK_NAME.getCode()) { |
|
|
|
//0纵向裂缝 |
|
|
|
longitudinalCrackNum += 1; |
|
|
|
} |
|
|
|
vo.setType(QuestionTypeEnum.ABEAM_CRACK_NAME.getCode()); |
|
|
|
vo.setNum(abeamCrackNum); |
|
|
|
vo1.setType(QuestionTypeEnum.RETICULAR_CRACK_NAME.getCode()); |
|
|
|
vo1.setNum(reticularCrackNum); |
|
|
|
vo2.setType(QuestionTypeEnum.PIT_GROOVE_NAME.getCode()); |
|
|
|
vo2.setNum(pitGrooveNum); |
|
|
|
vo3.setType(QuestionTypeEnum.MASSIVE_CRACK_NAME.getCode()); |
|
|
|
vo3.setNum(massiveCrack); |
|
|
|
vo4.setType(QuestionTypeEnum.PON_DING_NAME.getCode()); |
|
|
|
vo4.setNum(ponDingNum); |
|
|
|
vo5.setType(QuestionTypeEnum.LONGITUDINAL_CRACK_NAME.getCode()); |
|
|
|
vo5.setNum(longitudinalCrackNum); |
|
|
|
Collections.addAll(list, vo, vo1, vo2, vo3, vo4, vo5); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
vo.setType(QuestionTypeEnum.ABEAM_CRACK_NAME.getCode()); |
|
|
|
vo.setNum(abeamCrackNum); |
|
|
|
vo1.setType(QuestionTypeEnum.RETICULAR_CRACK_NAME.getCode()); |
|
|
|
vo1.setNum(reticularCrackNum); |
|
|
|
vo2.setType(QuestionTypeEnum.PIT_GROOVE_NAME.getCode()); |
|
|
|
vo2.setNum(pitGrooveNum); |
|
|
|
vo3.setType(QuestionTypeEnum.MASSIVE_CRACK_NAME.getCode()); |
|
|
|
vo3.setNum(massiveCrack); |
|
|
|
vo4.setType(QuestionTypeEnum.PON_DING_NAME.getCode()); |
|
|
|
vo4.setNum(ponDingNum); |
|
|
|
vo5.setType(QuestionTypeEnum.LONGITUDINAL_CRACK_NAME.getCode()); |
|
|
|
vo5.setNum(longitudinalCrackNum); |
|
|
|
Collections.addAll(list, vo, vo1, vo2, vo3, vo4, vo5); |
|
|
|
return JsonResult.success(list); |
|
|
|
} |
|
|
|
|