|
@@ -12,17 +12,14 @@ import com.qmth.distributed.print.business.bean.dto.professional.MatrixDto;
|
|
|
import com.qmth.distributed.print.business.bean.dto.professional.MatrixRequirementDto;
|
|
|
import com.qmth.distributed.print.business.bean.dto.professional.MatrixSubRequirementDto;
|
|
|
import com.qmth.distributed.print.business.bean.dto.professional.ProfessionalExportHead;
|
|
|
-import com.qmth.distributed.print.business.entity.TPCourse;
|
|
|
-import com.qmth.distributed.print.business.entity.TPMatrix;
|
|
|
-import com.qmth.distributed.print.business.entity.TPProfessional;
|
|
|
-import com.qmth.distributed.print.business.entity.TPRequirement;
|
|
|
+import com.qmth.distributed.print.business.entity.*;
|
|
|
import com.qmth.distributed.print.business.mapper.TPMatrixMapper;
|
|
|
-import com.qmth.distributed.print.business.service.TPCourseService;
|
|
|
-import com.qmth.distributed.print.business.service.TPMatrixService;
|
|
|
-import com.qmth.distributed.print.business.service.TPProfessionalService;
|
|
|
-import com.qmth.distributed.print.business.service.TPRequirementService;
|
|
|
+import com.qmth.distributed.print.business.service.*;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
+import com.qmth.teachcloud.common.entity.SysPrivilege;
|
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
+import com.qmth.teachcloud.common.enums.RoleTypeEnum;
|
|
|
+import com.qmth.teachcloud.common.service.SysPrivilegeService;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -58,21 +55,38 @@ public class TPMatrixServiceImpl extends ServiceImpl<TPMatrixMapper, TPMatrix> i
|
|
|
private TPCourseService tpCourseService;
|
|
|
@Resource
|
|
|
private TPRequirementService tpRequirementService;
|
|
|
+ @Resource
|
|
|
+ private SysPrivilegeService sysPrivilegeService;
|
|
|
+ @Resource
|
|
|
+ private TeachCourseService teachCourseService;
|
|
|
|
|
|
@Override
|
|
|
public List<MatrixDto> getMatrix(Long professionalId) {
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
List<TPMatrix> tpMatrixList = this.baseMapper.listMatrix(professionalId);
|
|
|
if (CollectionUtils.isNotEmpty(tpMatrixList)) {
|
|
|
+ List<SysPrivilege> sysPrivileges = sysPrivilegeService.getClientUrlByUserId(sysUser.getId());
|
|
|
+ boolean canEditCourse = sysPrivileges.stream().filter(m -> m.getId() == 2056L && "canEditCourse".equals(m.getUrl())).count() > 0;
|
|
|
+ List<String> codeList = new ArrayList<>();
|
|
|
+ if (!canEditCourse) {
|
|
|
+ List<TeachCourse> teachCourseList = teachCourseService.list(new QueryWrapper<TeachCourse>().lambda().eq(TeachCourse::getUserId, sysUser.getId()));
|
|
|
+ if (CollectionUtils.isNotEmpty(teachCourseList)) {
|
|
|
+ codeList = teachCourseList.stream().map(TeachCourse::getCourseCode).distinct().collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
List<MatrixDto> matrixDtoList = new ArrayList<>();
|
|
|
LinkedMultiValueMap<Long, TPMatrix> courseMap = new LinkedMultiValueMap<>();
|
|
|
for (TPMatrix tpMatrix : tpMatrixList) {
|
|
|
courseMap.add(tpMatrix.getCourseId(), tpMatrix);
|
|
|
}
|
|
|
+ List<String> finalCodeList = codeList;
|
|
|
courseMap.entrySet().stream().forEach(entry -> {
|
|
|
TPCourse tpCourse = tpCourseService.getById(entry.getKey());
|
|
|
MatrixDto matrixDto = new MatrixDto();
|
|
|
matrixDto.setCourseCode(tpCourse.getCourseCode());
|
|
|
matrixDto.setCourseName(tpCourse.getCourseName());
|
|
|
+ matrixDto.setCanEdit(canEditCourse || finalCodeList.contains(tpCourse.getCourseCode()));
|
|
|
List<MatrixRequirementDto> matrixRequirementDtoList = new ArrayList<>();
|
|
|
LinkedMultiValueMap<Long, TPMatrix> requirementMap = new LinkedMultiValueMap<>();
|
|
|
for (TPMatrix tpMatrix : entry.getValue()) {
|