|
@@ -20,12 +20,10 @@ import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.time.Duration;
|
|
import java.time.Duration;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -52,7 +50,7 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
private TBCrmService tbCrmService;
|
|
private TBCrmService tbCrmService;
|
|
|
|
|
|
@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) {
|
|
|
|
|
|
+ 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 {
|
|
if (city != null && city.length() > 0) {
|
|
if (city != null && city.length() > 0) {
|
|
city = SystemConstant.translateSpecificSign(city);
|
|
city = SystemConstant.translateSpecificSign(city);
|
|
}
|
|
}
|
|
@@ -65,8 +63,12 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
authRole.add(RoleTypeEnum.REGION_COORDINATOR);
|
|
authRole.add(RoleTypeEnum.REGION_COORDINATOR);
|
|
authRole.add(RoleTypeEnum.ASSISTANT_ENGINEER);
|
|
authRole.add(RoleTypeEnum.ASSISTANT_ENGINEER);
|
|
|
|
|
|
- Long remainValidTime = SystemConstant.processMiniutePlus(Duration.ofDays(remainValidDay));
|
|
|
|
- IPage<UserArchivesResult> page = this.baseMapper.findUserArchivesPage(new Page<>(pageNumber, pageSize), city, supplierId, archivesName, roleType, authenticationStatus, archivesTimeStart, archivesTimeEnd, remainValidTime, System.currentTimeMillis());
|
|
|
|
|
|
+ Long remainValidTime = null;
|
|
|
|
+ if (remainValidDay != null && remainValidDay > 0) {
|
|
|
|
+ remainValidTime = SystemConstant.processMiniutePlus(Duration.ofDays(remainValidDay));
|
|
|
|
+ }
|
|
|
|
+ Long currentTime = System.currentTimeMillis();
|
|
|
|
+ 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<RoleTypeEnum> roleTypeEnumList = new ArrayList<>();
|
|
Long userId = record.getUserId();
|
|
Long userId = record.getUserId();
|
|
@@ -79,10 +81,34 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
record.setRoleTypeList(roleTypeEnumList);
|
|
record.setRoleTypeList(roleTypeEnumList);
|
|
|
|
+ record.setAge(this.getAgeByIdentity(record.getIdentity()));
|
|
|
|
+ record.setAuthenticationStatus(record.getAuthenticationValidTime() != null && record.getAuthenticationValidTime() > currentTime);
|
|
}
|
|
}
|
|
return page;
|
|
return page;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 根据身份证号解析年龄
|
|
|
|
+ *
|
|
|
|
+ * @param identity identity
|
|
|
|
+ * @return 年龄
|
|
|
|
+ * @throws ParseException 异常
|
|
|
|
+ */
|
|
|
|
+ private Integer getAgeByIdentity(String identity) throws ParseException {
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
+ int currentYear = calendar.get(Calendar.YEAR);
|
|
|
|
+ // 提取身份证号中的出生日期
|
|
|
|
+ String birthDateStr = identity.substring(6, 14);
|
|
|
|
+ // 将出生日期字符串转换为Date类型
|
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
+ Date birthDate = dateFormat.parse(birthDateStr);
|
|
|
|
+ // 计算年龄
|
|
|
|
+ calendar.setTime(birthDate);
|
|
|
|
+ int birthYear = calendar.get(Calendar.YEAR);
|
|
|
|
+ // 打印年龄
|
|
|
|
+ return currentYear - birthYear;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
public Long editUserArchives(UserArchivesParam userArchivesParam, SysUser requestUser) {
|
|
public Long editUserArchives(UserArchivesParam userArchivesParam, SysUser requestUser) {
|
|
@@ -212,7 +238,6 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
} else {
|
|
} else {
|
|
sysUser.setLoginName(name);
|
|
sysUser.setLoginName(name);
|
|
sysUser.setRealName(name);
|
|
sysUser.setRealName(name);
|
|
- sysUser.setPasswordInfo(sysUser.getMobileNumber());
|
|
|
|
}
|
|
}
|
|
sysUser.setMobileNumber(mobileNumber);
|
|
sysUser.setMobileNumber(mobileNumber);
|
|
sysUser.setGender(gender);
|
|
sysUser.setGender(gender);
|
|
@@ -223,11 +248,22 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public UserArchivesSubTotalResult findUserArchivesSubTotal() {
|
|
|
|
|
|
+ public UserArchivesSubTotalResult findUserArchivesSubTotal(String city, Long supplierId, String archivesName, RoleTypeEnum roleType, Boolean authenticationStatus, Long archivesTimeStart, Long archivesTimeEnd, Integer remainValidDay) {
|
|
UserArchivesSubTotalResult result = new UserArchivesSubTotalResult();
|
|
UserArchivesSubTotalResult result = new UserArchivesSubTotalResult();
|
|
- List<UserArchivesResult> userArchivesResultList = this.baseMapper.findSubTotal();
|
|
|
|
|
|
+ if (city != null && city.length() > 0) {
|
|
|
|
+ city = SystemConstant.translateSpecificSign(city);
|
|
|
|
+ }
|
|
|
|
+ if (archivesName != null && archivesName.length() > 0) {
|
|
|
|
+ archivesName = SystemConstant.translateSpecificSign(archivesName);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Long remainValidTime = null;
|
|
|
|
+ if (remainValidDay != null && remainValidDay > 0) {
|
|
|
|
+ remainValidTime = SystemConstant.processMiniutePlus(Duration.ofDays(remainValidDay));
|
|
|
|
+ }
|
|
|
|
+ Long currentTime = System.currentTimeMillis();
|
|
|
|
+ List<UserArchivesResult> userArchivesResultList = this.baseMapper.findUserArchivesList(city, supplierId, archivesName, roleType, authenticationStatus, archivesTimeStart, archivesTimeEnd, remainValidTime, currentTime);
|
|
if (CollectionUtils.isNotEmpty(userArchivesResultList)) {
|
|
if (CollectionUtils.isNotEmpty(userArchivesResultList)) {
|
|
- Long currentTime = System.currentTimeMillis();
|
|
|
|
Integer totalCount = userArchivesResultList.size();
|
|
Integer totalCount = userArchivesResultList.size();
|
|
List<UserArchivesResult> validList = userArchivesResultList.stream()
|
|
List<UserArchivesResult> validList = userArchivesResultList.stream()
|
|
.filter(e -> e.getAuthenticationValidTime() != null && e.getAuthenticationValidTime() > currentTime)
|
|
.filter(e -> e.getAuthenticationValidTime() != null && e.getAuthenticationValidTime() > currentTime)
|
|
@@ -241,25 +277,28 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
|
|
|
|
List<Long> userIdList = validList.stream().map(UserArchivesResult::getUserId).distinct().collect(Collectors.toList());
|
|
List<Long> userIdList = validList.stream().map(UserArchivesResult::getUserId).distinct().collect(Collectors.toList());
|
|
List<SysUser> effectEngineer = sysUserService.findUserListByRoleType(RoleTypeEnum.EFFECT_ENGINEER);
|
|
List<SysUser> effectEngineer = sysUserService.findUserListByRoleType(RoleTypeEnum.EFFECT_ENGINEER);
|
|
|
|
+ Integer effectEngineerCount = 0;
|
|
if (CollectionUtils.isNotEmpty(effectEngineer)) {
|
|
if (CollectionUtils.isNotEmpty(effectEngineer)) {
|
|
List<Long> effectEngineerIdList = effectEngineer.stream().map(BaseEntity::getId).distinct().collect(Collectors.toList());
|
|
List<Long> effectEngineerIdList = effectEngineer.stream().map(BaseEntity::getId).distinct().collect(Collectors.toList());
|
|
- Integer effectEngineerCount = (int) userIdList.stream().filter(effectEngineerIdList::contains).count();
|
|
|
|
- result.setEffectEngineerCount(effectEngineerCount);
|
|
|
|
|
|
+ effectEngineerCount = (int) userIdList.stream().filter(effectEngineerIdList::contains).count();
|
|
}
|
|
}
|
|
|
|
+ result.setEffectEngineerCount(effectEngineerCount);
|
|
|
|
|
|
List<SysUser> regionCoordinator = sysUserService.findUserListByRoleType(RoleTypeEnum.REGION_COORDINATOR);
|
|
List<SysUser> regionCoordinator = sysUserService.findUserListByRoleType(RoleTypeEnum.REGION_COORDINATOR);
|
|
|
|
+ Integer regionCoordinatorCount = 0;
|
|
if (CollectionUtils.isNotEmpty(regionCoordinator)) {
|
|
if (CollectionUtils.isNotEmpty(regionCoordinator)) {
|
|
List<Long> regionCoordinatorIdList = regionCoordinator.stream().map(BaseEntity::getId).distinct().collect(Collectors.toList());
|
|
List<Long> regionCoordinatorIdList = regionCoordinator.stream().map(BaseEntity::getId).distinct().collect(Collectors.toList());
|
|
- Integer effectEngineerCount = (int) userIdList.stream().filter(regionCoordinatorIdList::contains).count();
|
|
|
|
- result.setEffectEngineerCount(effectEngineerCount);
|
|
|
|
|
|
+ regionCoordinatorCount = (int) userIdList.stream().filter(regionCoordinatorIdList::contains).count();
|
|
}
|
|
}
|
|
|
|
+ result.setRegionCoordinatorCount(regionCoordinatorCount);
|
|
|
|
|
|
List<SysUser> assistantEngineer = sysUserService.findUserListByRoleType(RoleTypeEnum.ASSISTANT_ENGINEER);
|
|
List<SysUser> assistantEngineer = sysUserService.findUserListByRoleType(RoleTypeEnum.ASSISTANT_ENGINEER);
|
|
|
|
+ Integer assistantEngineerCount = 0;
|
|
if (CollectionUtils.isNotEmpty(assistantEngineer)) {
|
|
if (CollectionUtils.isNotEmpty(assistantEngineer)) {
|
|
List<Long> assistantEngineerIdList = assistantEngineer.stream().map(BaseEntity::getId).distinct().collect(Collectors.toList());
|
|
List<Long> assistantEngineerIdList = assistantEngineer.stream().map(BaseEntity::getId).distinct().collect(Collectors.toList());
|
|
- Integer assistantEngineerCount = (int) userIdList.stream().filter(assistantEngineerIdList::contains).count();
|
|
|
|
- result.setAssistantEngineerCount(assistantEngineerCount);
|
|
|
|
|
|
+ assistantEngineerCount = (int) userIdList.stream().filter(assistantEngineerIdList::contains).count();
|
|
}
|
|
}
|
|
|
|
+ result.setAssistantEngineerCount(assistantEngineerCount);
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
@@ -272,7 +311,10 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
|
|
if (archivesName != null && archivesName.length() > 0) {
|
|
if (archivesName != null && archivesName.length() > 0) {
|
|
archivesName = SystemConstant.translateSpecificSign(archivesName);
|
|
archivesName = SystemConstant.translateSpecificSign(archivesName);
|
|
}
|
|
}
|
|
- Long remainValidTime = SystemConstant.processMiniutePlus(Duration.ofDays(remainValidDay));
|
|
|
|
|
|
+ Long remainValidTime = null;
|
|
|
|
+ if (remainValidDay != null && remainValidDay > 0) {
|
|
|
|
+ remainValidTime = SystemConstant.processMiniutePlus(Duration.ofDays(remainValidDay));
|
|
|
|
+ }
|
|
List<UserArchivesImportDto> userArchivesImportDtoList = this.baseMapper.findExportData(city, supplierId, archivesName, roleType, authenticationStatus,
|
|
List<UserArchivesImportDto> userArchivesImportDtoList = this.baseMapper.findExportData(city, supplierId, archivesName, roleType, authenticationStatus,
|
|
archivesTimeStart, archivesTimeEnd, remainValidTime, System.currentTimeMillis());
|
|
archivesTimeStart, archivesTimeEnd, remainValidTime, System.currentTimeMillis());
|
|
|
|
|