|
@@ -1,38 +1,46 @@
|
|
|
package com.qmth.sop.business.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.sop.business.bean.dto.DataPermissionDto;
|
|
|
import com.qmth.sop.business.bean.dto.UserArchivesAllocationDto;
|
|
|
+import com.qmth.sop.business.bean.result.ProjectMonitorCardResult;
|
|
|
import com.qmth.sop.business.bean.result.ProjectMonitorResult;
|
|
|
import com.qmth.sop.business.bean.result.ProjectMonitorUserResult;
|
|
|
+import com.qmth.sop.business.bean.result.UserArchivesProjectExperienceResult;
|
|
|
import com.qmth.sop.business.entity.SysUser;
|
|
|
import com.qmth.sop.business.entity.TBSopInfo;
|
|
|
+import com.qmth.sop.business.entity.TBUserArchives;
|
|
|
import com.qmth.sop.business.mapper.TBSopInfoMapper;
|
|
|
-import com.qmth.sop.business.service.ProjectMonitorService;
|
|
|
-import com.qmth.sop.business.service.SysUserService;
|
|
|
-import com.qmth.sop.business.service.TBUserArchivesAllocationService;
|
|
|
+import com.qmth.sop.business.service.*;
|
|
|
import com.qmth.sop.common.enums.CrmProcessEnum;
|
|
|
+import com.qmth.sop.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.sop.common.enums.SopRoleTypeEnum;
|
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class ProjectMonitorServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo> implements ProjectMonitorService {
|
|
|
|
|
|
@Resource
|
|
|
- private SysUserService sysUserService;
|
|
|
+ SysUserService sysUserService;
|
|
|
|
|
|
@Resource
|
|
|
- private TBUserArchivesAllocationService tbUserArchivesAllocationService;
|
|
|
+ TBUserArchivesAllocationService tbUserArchivesAllocationService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TBUserArchivesService tbUserArchivesService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private BasicAttachmentService basicAttachmentService;
|
|
|
|
|
|
@Override
|
|
|
public IPage<ProjectMonitorResult> pageProjectMonitor(Page<ProjectMonitorResult> page, Long serviceUnitId, Long customerId, CrmProcessEnum process) {
|
|
@@ -60,6 +68,37 @@ public class ProjectMonitorServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSo
|
|
|
return pageProjectMonitor;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ProjectMonitorCardResult getUserCard(Long userId) {
|
|
|
+ TBUserArchives userArchives = tbUserArchivesService.getById(userId);
|
|
|
+ if (Objects.isNull(userArchives)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("人员不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ ProjectMonitorCardResult userCard = new ProjectMonitorCardResult();
|
|
|
+ userCard.setName(userArchives.getName());
|
|
|
+ userCard.setCode(userArchives.getCode());
|
|
|
+ userCard.setMobileNumber(userArchives.getMobileNumber());
|
|
|
+ try {
|
|
|
+ if (StringUtils.isNotBlank(userArchives.getBasePhotoPath())) {
|
|
|
+ userCard.setPhotoPath(basicAttachmentService.filePreviewPath(userArchives.getBasePhotoPath()));
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("[项目监控-工作证]照片预览出错:" + e.getMessage());
|
|
|
+ userCard.setPhotoPath(null);
|
|
|
+ }
|
|
|
+ //项目经验
|
|
|
+ if (StringUtils.isNotBlank(userArchives.getProjectExperience())) {
|
|
|
+ List<UserArchivesProjectExperienceResult> resultList = JSONObject.parseArray(userArchives.getProjectExperience(),
|
|
|
+ UserArchivesProjectExperienceResult.class);
|
|
|
+ List<UserArchivesProjectExperienceResult> sortedExperienceList = resultList.stream()
|
|
|
+ .sorted(Comparator.comparingInt(UserArchivesProjectExperienceResult::getOrder)).collect(Collectors.toList());
|
|
|
+ userCard.setProjectExperience(sortedExperienceList);
|
|
|
+ }
|
|
|
+ return userCard;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private List<ProjectMonitorUserResult> filterUserArchivesAllocation(List<UserArchivesAllocationDto> allocationDtoList, SopRoleTypeEnum roleType) {
|
|
|
List<ProjectMonitorUserResult> monitorResultList = new ArrayList<>();
|
|
|
List<UserArchivesAllocationDto> filterUserList = allocationDtoList.stream().filter(user -> user.getSopRoleType().equals(roleType)).collect(
|