|
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.qmth.sop.business.bean.dto.UserArchivesImportDto;
|
|
import com.qmth.sop.business.bean.dto.UserArchivesImportDto;
|
|
import com.qmth.sop.business.bean.params.UserArchivesParam;
|
|
import com.qmth.sop.business.bean.params.UserArchivesParam;
|
|
import com.qmth.sop.business.bean.result.ArchivesSourceResult;
|
|
import com.qmth.sop.business.bean.result.ArchivesSourceResult;
|
|
|
|
+import com.qmth.sop.business.bean.result.RoleResult;
|
|
import com.qmth.sop.business.bean.result.UserArchivesResult;
|
|
import com.qmth.sop.business.bean.result.UserArchivesResult;
|
|
import com.qmth.sop.business.bean.result.UserArchivesSubTotalResult;
|
|
import com.qmth.sop.business.bean.result.UserArchivesSubTotalResult;
|
|
import com.qmth.sop.business.entity.*;
|
|
import com.qmth.sop.business.entity.*;
|
|
@@ -48,6 +49,8 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
private TBServiceService tbServiceService;
|
|
private TBServiceService tbServiceService;
|
|
@Resource
|
|
@Resource
|
|
private TBCrmService tbCrmService;
|
|
private TBCrmService tbCrmService;
|
|
|
|
+ @Resource
|
|
|
|
+ private SysRoleService sysRoleService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public IPage<UserArchivesResult> findUserArchivesPage(String city, Long supplierId, String archivesName, RoleTypeEnum roleType, Boolean authenticationStatus, Long archivesTimeStart, Long archivesTimeEnd, Integer remainValidDay, Integer pageNumber, Integer pageSize) throws ParseException {
|
|
public IPage<UserArchivesResult> findUserArchivesPage(String city, Long supplierId, String archivesName, RoleTypeEnum roleType, Boolean authenticationStatus, Long archivesTimeStart, Long archivesTimeEnd, Integer remainValidDay, Integer pageNumber, Integer pageSize) throws ParseException {
|
|
@@ -70,17 +73,20 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
Long currentTime = System.currentTimeMillis();
|
|
Long currentTime = System.currentTimeMillis();
|
|
IPage<UserArchivesResult> page = this.baseMapper.findUserArchivesPage(new Page<>(pageNumber, pageSize), city, supplierId, archivesName, roleType, authenticationStatus, archivesTimeStart, archivesTimeEnd, remainValidTime, currentTime);
|
|
IPage<UserArchivesResult> page = this.baseMapper.findUserArchivesPage(new Page<>(pageNumber, pageSize), city, supplierId, archivesName, roleType, authenticationStatus, archivesTimeStart, archivesTimeEnd, remainValidTime, currentTime);
|
|
for (UserArchivesResult record : page.getRecords()) {
|
|
for (UserArchivesResult record : page.getRecords()) {
|
|
- List<RoleTypeEnum> roleTypeEnumList = new ArrayList<>();
|
|
|
|
|
|
+ List<RoleResult> roleResultList = new ArrayList<>();
|
|
Long userId = record.getUserId();
|
|
Long userId = record.getUserId();
|
|
if (userId != null && userId > 0) {
|
|
if (userId != null && userId > 0) {
|
|
for (RoleTypeEnum roleTypeEnum : authRole) {
|
|
for (RoleTypeEnum roleTypeEnum : authRole) {
|
|
// TODO: 2023/8/14 可优化查询
|
|
// TODO: 2023/8/14 可优化查询
|
|
if (sysUserRoleService.userContainsRoles(userId, roleTypeEnum)) {
|
|
if (sysUserRoleService.userContainsRoles(userId, roleTypeEnum)) {
|
|
- roleTypeEnumList.add(roleTypeEnum);
|
|
|
|
|
|
+ RoleResult roleResult = sysRoleService.findRoleInfoByArchivesType(roleTypeEnum);
|
|
|
|
+ if (Objects.nonNull(roleResult)) {
|
|
|
|
+ roleResultList.add(roleResult);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- record.setRoleTypeList(roleTypeEnumList);
|
|
|
|
|
|
+ record.setRoleInfoList(roleResultList);
|
|
record.setAge(this.getAgeByIdentity(record.getIdentity()));
|
|
record.setAge(this.getAgeByIdentity(record.getIdentity()));
|
|
record.setAuthenticationStatus(record.getAuthenticationValidTime() != null && record.getAuthenticationValidTime() > currentTime);
|
|
record.setAuthenticationStatus(record.getAuthenticationValidTime() != null && record.getAuthenticationValidTime() > currentTime);
|
|
}
|
|
}
|
|
@@ -362,6 +368,12 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
return userArchivesImportDtoList;
|
|
return userArchivesImportDtoList;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Transactional
|
|
|
|
+ @Override
|
|
|
|
+ public void cancelUserArchives(List<Long> userArchivesIdList) {
|
|
|
|
+ // TODO: 2023/8/23 档案作废具体逻辑
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public TBUserArchives findByUserId(Long userId) {
|
|
public TBUserArchives findByUserId(Long userId) {
|
|
SysUser sysUser = sysUserService.getById(userId);
|
|
SysUser sysUser = sysUserService.getById(userId);
|
|
@@ -424,12 +436,9 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
.peek(e -> {
|
|
.peek(e -> {
|
|
Long userId = e.getUserId();
|
|
Long userId = e.getUserId();
|
|
int count = Math.toIntExact(tbCrmList.stream().filter(c -> userId.equals(c.getRegionCoordinatorId())).count());
|
|
int count = Math.toIntExact(tbCrmList.stream().filter(c -> userId.equals(c.getRegionCoordinatorId())).count());
|
|
- if (count > rate) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("区域协调人分配超额异常");
|
|
|
|
- }
|
|
|
|
e.setRemainCount(rate - count);
|
|
e.setRemainCount(rate - count);
|
|
})
|
|
})
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
- return list;
|
|
|
|
|
|
+ return list.stream().filter(e -> e.getRemainCount() > 0).collect(Collectors.toList());
|
|
}
|
|
}
|
|
}
|
|
}
|