|
|
@@ -2,7 +2,9 @@ package com.tuoheng.admin.service.inspectionfile.query; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.tuoheng.admin.conver.QuestionTypeConverMapper; |
|
|
|
import com.tuoheng.admin.entity.Inspection; |
|
|
|
import com.tuoheng.admin.entity.InspectionFile; |
|
|
|
import com.tuoheng.admin.entity.QuestionType; |
|
|
@@ -17,6 +19,7 @@ import com.tuoheng.admin.mapper.QuestionTypeMapper; |
|
|
|
import com.tuoheng.admin.query.InspectionFileQuery; |
|
|
|
import com.tuoheng.admin.utils.CurrentUserUtil; |
|
|
|
import com.tuoheng.admin.vo.ListByDeptUserTypeVo; |
|
|
|
import com.tuoheng.admin.vo.QuestionTypeVo; |
|
|
|
import com.tuoheng.common.core.enums.ServiceExceptionEnum; |
|
|
|
import com.tuoheng.common.core.exception.ServiceException; |
|
|
|
import com.tuoheng.common.core.utils.JsonResult; |
|
|
@@ -59,30 +62,14 @@ public class QueryInspectionFileListByDeptUserTypeService { |
|
|
|
if (null == user.getDataPermission()) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
List<ListByDeptUserTypeVo> list = new ArrayList<>(); |
|
|
|
ListByDeptUserTypeVo vo = new ListByDeptUserTypeVo(); |
|
|
|
ListByDeptUserTypeVo vo1 = new ListByDeptUserTypeVo(); |
|
|
|
ListByDeptUserTypeVo vo2 = new ListByDeptUserTypeVo(); |
|
|
|
ListByDeptUserTypeVo vo3 = new ListByDeptUserTypeVo(); |
|
|
|
ListByDeptUserTypeVo vo4 = new ListByDeptUserTypeVo(); |
|
|
|
ListByDeptUserTypeVo vo5 = new ListByDeptUserTypeVo(); |
|
|
|
//坑槽 积水 裂缝 |
|
|
|
//0纵向裂缝 |
|
|
|
Integer longitudinalCrackNum = 0; |
|
|
|
//4坑槽 |
|
|
|
Integer pitGrooveNum = 0; |
|
|
|
//6积水 |
|
|
|
Integer ponDingNum = 0; |
|
|
|
//1横向裂缝 |
|
|
|
Integer abeamCrackNum = 0; |
|
|
|
//3网状裂纹 |
|
|
|
Integer reticularCrackNum = 0; |
|
|
|
//5块状裂纹 |
|
|
|
Integer massiveCrack = 0; |
|
|
|
|
|
|
|
List<QuestionType> questionTypeList = questionTypeMapper.selectList(new LambdaQueryWrapper<QuestionType>() |
|
|
|
.eq(QuestionType::getMark, MarkEnum.VALID.getCode())); |
|
|
|
if (CollectionUtil.isEmpty(questionTypeList)) { |
|
|
|
log.info("问题类型为空"); |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
|
|
|
|
List<InspectionFile> inspectionFileList = null; |
|
|
|
|
|
|
|
//若角色为超级管理员,查看状态为已生成工单和和问题已处理 |
|
|
|
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) { |
|
|
|
//直接查问题列表 |
|
|
@@ -119,71 +106,24 @@ public class QueryInspectionFileListByDeptUserTypeService { |
|
|
|
log.info("问题列表为空"); |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
for (InspectionFile inspectionFile : inspectionFileList) { |
|
|
|
if (StringUtils.isEmpty(inspectionFile.getQuestionCode())) { |
|
|
|
log.info("问题类型为空"); |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
//查找问题类型 |
|
|
|
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(); |
|
|
|
|
|
|
|
List<QuestionTypeVo> questionTypeVoList = QuestionTypeConverMapper.INSTANCE.fromUListToVoList(questionTypeList); |
|
|
|
for (QuestionTypeVo questionTypeVo : questionTypeVoList) { |
|
|
|
if (ObjectUtil.isEmpty(questionTypeVo.getNum())) { |
|
|
|
questionTypeVo.setNum(0); |
|
|
|
} |
|
|
|
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; |
|
|
|
for (InspectionFile inspectionFile : inspectionFileList) { |
|
|
|
if (StringUtils.isEmpty(inspectionFile.getQuestionCode())) { |
|
|
|
log.info("问题类型为空"); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (questionTypeVo.getCode().equals(inspectionFile.getQuestionCode())) { |
|
|
|
questionTypeVo.setNum(questionTypeVo.getNum() + 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); |
|
|
|
return JsonResult.success(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据用户自己的数据权限,查询对应部门的数据 |
|
|
|
* |
|
|
|
* @param user |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private List<String> getDeptIdList(User user) { |
|
|
|
List<String> deptIdList = new ArrayList<>(); |
|
|
|
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) { |
|
|
|
return null; |
|
|
|
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) { |
|
|
|
deptIdList = deptMapper.selectAllChildListById(user.getDeptId()); |
|
|
|
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) { |
|
|
|
deptIdList.add(user.getDeptId()); |
|
|
|
} |
|
|
|
return deptIdList; |
|
|
|
return JsonResult.success(questionTypeVoList); |
|
|
|
} |
|
|
|
|
|
|
|
} |