|
@@ -34,7 +34,8 @@ import java.util.stream.Collectors;
|
|
|
* @since 2023-08-01
|
|
|
*/
|
|
|
@Service
|
|
|
-public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper, TBUserArchives> implements TBUserArchivesService {
|
|
|
+public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper, TBUserArchives>
|
|
|
+ implements TBUserArchivesService {
|
|
|
|
|
|
@Resource
|
|
|
private SysUserRoleService sysUserRoleService;
|
|
@@ -71,8 +72,8 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
|
|
|
@Override
|
|
|
public IPage<UserArchivesResult> findUserArchivesPage(String city, Long supplierId, String archivesName,
|
|
|
- RoleTypeEnum roleType, Boolean authenticationStatus, Long archivesTimeStart, Long archivesTimeEnd, Integer remainValidDay,
|
|
|
- Boolean unUploadPic, Integer pageNumber, Integer pageSize) throws Exception {
|
|
|
+ RoleTypeEnum roleType, Boolean authenticationStatus, Long archivesTimeStart, Long archivesTimeEnd,
|
|
|
+ Integer remainValidDay, Boolean unUploadPic, Integer pageNumber, Integer pageSize) throws Exception {
|
|
|
if (city != null && city.length() > 0) {
|
|
|
city = SystemConstant.translateSpecificSign(city);
|
|
|
}
|
|
@@ -109,7 +110,8 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
}
|
|
|
record.setRoleInfoList(roleResultList);
|
|
|
record.setAge(this.getAgeByIdentity(record.getIdentity()));
|
|
|
- record.setAuthenticationStatus(record.getAuthenticationValidTime() != null && record.getAuthenticationValidTime() > currentTime);
|
|
|
+ record.setAuthenticationStatus(
|
|
|
+ record.getAuthenticationValidTime() != null && record.getAuthenticationValidTime() > currentTime);
|
|
|
String basePhotoPath = record.getBasePhotoPath();
|
|
|
if (basePhotoPath != null && basePhotoPath.length() > 0) {
|
|
|
record.setBasePhotoPreviewPath(basicAttachmentService.filePreviewPath(basePhotoPath));
|
|
@@ -275,9 +277,9 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
roleTypeList.add(RoleTypeEnum.ASSISTANT_ENGINEER);
|
|
|
roleTypeList.add(RoleTypeEnum.REGION_COORDINATOR);
|
|
|
|
|
|
- List<Long> sysRoleIds = sysRoleService.listRolesByUserId(userId).stream().filter(e -> !roleTypeList.contains(e.getType())).map(
|
|
|
- RoleDto::getId).distinct().collect(
|
|
|
- Collectors.toList());
|
|
|
+ List<Long> sysRoleIds = sysRoleService.listRolesByUserId(userId).stream()
|
|
|
+ .filter(e -> !roleTypeList.contains(e.getType())).map(RoleDto::getId).distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
roleIds.addAll(sysRoleIds);
|
|
|
}
|
|
|
sysUser.setLoginName(mobileNumber);
|
|
@@ -292,7 +294,8 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
|
|
|
@Override
|
|
|
public UserArchivesSubTotalResult findUserArchivesSubTotal(String city, Long supplierId, String archivesName,
|
|
|
- RoleTypeEnum roleType, Boolean authenticationStatus, Long archivesTimeStart, Long archivesTimeEnd, Integer remainValidDay, Boolean unUploadPic) {
|
|
|
+ RoleTypeEnum roleType, Boolean authenticationStatus, Long archivesTimeStart, Long archivesTimeEnd,
|
|
|
+ Integer remainValidDay, Boolean unUploadPic) {
|
|
|
UserArchivesSubTotalResult result = new UserArchivesSubTotalResult();
|
|
|
if (city != null && city.length() > 0) {
|
|
|
city = SystemConstant.translateSpecificSign(city);
|
|
@@ -321,27 +324,34 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
result.setValidCount(validCount);
|
|
|
result.setInvalidCount(inValidCount);
|
|
|
|
|
|
- List<Long> userIdList = validList.stream().map(UserArchivesResult::getUserId).distinct().collect(Collectors.toList());
|
|
|
- List<SysUserBriefResult> effectEngineer = sysUserService.findUserListByRoleType(RoleTypeEnum.EFFECT_ENGINEER);
|
|
|
+ List<Long> userIdList = validList.stream().map(UserArchivesResult::getUserId).distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<SysUserBriefResult> effectEngineer = sysUserService.findUserListByRoleType(
|
|
|
+ RoleTypeEnum.EFFECT_ENGINEER);
|
|
|
int effectEngineerCount = 0;
|
|
|
if (CollectionUtils.isNotEmpty(effectEngineer)) {
|
|
|
- List<Long> effectEngineerIdList = effectEngineer.stream().map(SysUserBriefResult::getId).distinct().collect(Collectors.toList());
|
|
|
+ List<Long> effectEngineerIdList = effectEngineer.stream().map(SysUserBriefResult::getId).distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
effectEngineerCount = (int) userIdList.stream().filter(effectEngineerIdList::contains).count();
|
|
|
}
|
|
|
result.setEffectEngineerCount(effectEngineerCount);
|
|
|
|
|
|
- List<SysUserBriefResult> regionCoordinator = sysUserService.findUserListByRoleType(RoleTypeEnum.REGION_COORDINATOR);
|
|
|
+ List<SysUserBriefResult> regionCoordinator = sysUserService.findUserListByRoleType(
|
|
|
+ RoleTypeEnum.REGION_COORDINATOR);
|
|
|
int regionCoordinatorCount = 0;
|
|
|
if (CollectionUtils.isNotEmpty(regionCoordinator)) {
|
|
|
- List<Long> regionCoordinatorIdList = regionCoordinator.stream().map(SysUserBriefResult::getId).distinct().collect(Collectors.toList());
|
|
|
+ List<Long> regionCoordinatorIdList = regionCoordinator.stream().map(SysUserBriefResult::getId)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
regionCoordinatorCount = (int) userIdList.stream().filter(regionCoordinatorIdList::contains).count();
|
|
|
}
|
|
|
result.setRegionCoordinatorCount(regionCoordinatorCount);
|
|
|
|
|
|
- List<SysUserBriefResult> assistantEngineer = sysUserService.findUserListByRoleType(RoleTypeEnum.ASSISTANT_ENGINEER);
|
|
|
+ List<SysUserBriefResult> assistantEngineer = sysUserService.findUserListByRoleType(
|
|
|
+ RoleTypeEnum.ASSISTANT_ENGINEER);
|
|
|
int assistantEngineerCount = 0;
|
|
|
if (CollectionUtils.isNotEmpty(assistantEngineer)) {
|
|
|
- List<Long> assistantEngineerIdList = assistantEngineer.stream().map(SysUserBriefResult::getId).distinct().collect(Collectors.toList());
|
|
|
+ List<Long> assistantEngineerIdList = assistantEngineer.stream().map(SysUserBriefResult::getId)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
assistantEngineerCount = (int) userIdList.stream().filter(assistantEngineerIdList::contains).count();
|
|
|
}
|
|
|
result.setAssistantEngineerCount(assistantEngineerCount);
|
|
@@ -350,7 +360,8 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<UserArchivesImportDto> findExportData(String city, Long supplierId, String archivesName, RoleTypeEnum roleType, Boolean authenticationStatus, Long archivesTimeStart, Long archivesTimeEnd,
|
|
|
+ public List<UserArchivesImportDto> findExportData(String city, Long supplierId, String archivesName,
|
|
|
+ RoleTypeEnum roleType, Boolean authenticationStatus, Long archivesTimeStart, Long archivesTimeEnd,
|
|
|
Integer remainValidDay, Boolean unUploadPic) {
|
|
|
if (city != null && city.length() > 0) {
|
|
|
city = SystemConstant.translateSpecificSign(city);
|
|
@@ -421,7 +432,8 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
Long validTime = userArchivesResult.getAuthenticationValidTime();
|
|
|
// 作废校验1 - 认证状态失效
|
|
|
if (validTime != null && currentTime < validTime) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("[%s]的认证状态为有效,不能作废", userArchivesResult.getName()));
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(
|
|
|
+ String.format("[%s]的认证状态为有效,不能作废", userArchivesResult.getName()));
|
|
|
}
|
|
|
// 作废校验2 - 没有进行中的SOP
|
|
|
List<SopInfoResult> sopInfoResultList = tbSopInfoService.findFlowByServiceId(null);
|
|
@@ -436,13 +448,15 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
if (!isCoordinator) {
|
|
|
// 不是区域协调人直接判断非空闲即可作废
|
|
|
if (UserArchivesStatusEnum.OCCUPIED.equals(status)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("[%s]为非空闲,不能作废", userArchivesResult.getName()));
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(
|
|
|
+ String.format("[%s]为非空闲,不能作废", userArchivesResult.getName()));
|
|
|
}
|
|
|
} else {
|
|
|
// 包含区域协调人判断该区域协调人涉及的所有派单均完成
|
|
|
if (tbCrmService.list(new QueryWrapper<TBCrm>().lambda().eq(TBCrm::getRegionCoordinatorId, userId)
|
|
|
.ne(TBCrm::getStatus, CrmStatusEnum.FINISH)).size() > 0) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("区域协调人[%s]有未完成的派单,不能作废", userArchivesResult.getName()));
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(
|
|
|
+ String.format("区域协调人[%s]有未完成的派单,不能作废", userArchivesResult.getName()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -461,7 +475,8 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
String mobileNumber = sysUser.getMobileNumber();
|
|
|
|
|
|
List<TBUserArchives> tbUserArchivesList = this.list(
|
|
|
- new QueryWrapper<TBUserArchives>().lambda().eq(TBUserArchives::getMobileNumber, mobileNumber).eq(TBUserArchives::getEnable, true));
|
|
|
+ new QueryWrapper<TBUserArchives>().lambda().eq(TBUserArchives::getMobileNumber, mobileNumber)
|
|
|
+ .eq(TBUserArchives::getEnable, true));
|
|
|
if (CollectionUtils.isEmpty(tbUserArchivesList)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("不存在档案");
|
|
|
}
|
|
@@ -511,7 +526,8 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
throw ExceptionResultEnum.ERROR.exception("该方法只支持查询实施工程师和助理工程师");
|
|
|
}
|
|
|
|
|
|
- List<ArchivesSourceResult> list = new ArrayList<>(this.findArchivesSourceByType(roleType));
|
|
|
+ List<ArchivesSourceResult> list = new ArrayList<>(
|
|
|
+ this.findArchivesSourceByType(new HashSet<>(Arrays.asList(roleType))));
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
Long currentTime = System.currentTimeMillis();
|
|
|
list = list.stream()
|
|
@@ -532,7 +548,8 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ArchivesSourceResult> findFreeCoordinatorByServiceId(Long serviceUnitId, String crmNo, boolean verifyRate) {
|
|
|
+ public List<ArchivesSourceResult> findFreeCoordinatorByServiceId(Long serviceUnitId, String crmNo,
|
|
|
+ boolean verifyRate) {
|
|
|
List<ArchivesSourceResult> result = new ArrayList<>();
|
|
|
TBService tbService = tbServiceService.getById(serviceUnitId);
|
|
|
if (Objects.isNull(tbService)) {
|
|
@@ -543,9 +560,11 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
new QueryWrapper<TBCrm>().lambda().eq(TBCrm::getServiceId, serviceUnitId));
|
|
|
|
|
|
Long currentTime = System.currentTimeMillis();
|
|
|
- List<ArchivesSourceResult> list = this.findArchivesSourceByType(RoleTypeEnum.REGION_COORDINATOR);
|
|
|
+ List<ArchivesSourceResult> list = this.findArchivesSourceByType(
|
|
|
+ new HashSet<>(Arrays.asList(RoleTypeEnum.REGION_COORDINATOR)));
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
- list = list.stream().filter(e -> e.getAuthenticationValidTime() != null && e.getAuthenticationValidTime() >= currentTime).peek(e -> {
|
|
|
+ list = list.stream().filter(e -> e.getAuthenticationValidTime() != null
|
|
|
+ && e.getAuthenticationValidTime() >= currentTime).peek(e -> {
|
|
|
Long userId = e.getUserId();
|
|
|
int count = Math.toIntExact(
|
|
|
tbCrmList.stream().filter(c -> userId.equals(c.getRegionCoordinatorId())).count());
|
|
@@ -559,16 +578,19 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
|
|
|
// 调配选人列表查询的特殊处理
|
|
|
if (crmNo != null && crmNo.length() > 0) {
|
|
|
- List<TBCrm> temp = tbCrmList.stream().filter(e -> e.getCrmNo().equals(crmNo)).collect(Collectors.toList());
|
|
|
+ List<TBCrm> temp = tbCrmList.stream().filter(e -> e.getCrmNo().equals(crmNo))
|
|
|
+ .collect(Collectors.toList());
|
|
|
if (CollectionUtils.isEmpty(temp)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("派单号[%s]不存在在服务单元[%s]下", crmNo, tbService.getName()));
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(
|
|
|
+ String.format("派单号[%s]不存在在服务单元[%s]下", crmNo, tbService.getName()));
|
|
|
}
|
|
|
TBCrm chooseCrm = temp.get(0);
|
|
|
Long coordinatorId = chooseCrm.getRegionCoordinatorId();
|
|
|
Long regionLeaderId = chooseCrm.getLeadId();
|
|
|
- if (!Objects.equals(coordinatorId, regionLeaderId)){
|
|
|
+ if (!Objects.equals(coordinatorId, regionLeaderId)) {
|
|
|
// 不是由大区经理兼任的再去查档案,否则会报错(不存在档案)
|
|
|
- if (coordinatorId != null && !list.stream().map(ArchivesSourceResult::getUserId).collect(Collectors.toList()).contains(coordinatorId)) {
|
|
|
+ if (coordinatorId != null && !list.stream().map(ArchivesSourceResult::getUserId)
|
|
|
+ .collect(Collectors.toList()).contains(coordinatorId)) {
|
|
|
TBUserArchives chooseArchives = tbUserArchivesService.findByUserId(coordinatorId);
|
|
|
ArchivesSourceResult choose = new ArchivesSourceResult();
|
|
|
choose.setArchivesId(chooseArchives.getId());
|
|
@@ -585,8 +607,8 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ArchivesSourceResult> findArchivesSourceByType(RoleTypeEnum roleType) {
|
|
|
- return this.baseMapper.findArchivesSourceByType(roleType);
|
|
|
+ public List<ArchivesSourceResult> findArchivesSourceByType(Set<RoleTypeEnum> roleTypes) {
|
|
|
+ return this.baseMapper.findArchivesSourceByType(roleTypes);
|
|
|
}
|
|
|
|
|
|
@Override
|