|
|
@@ -52,6 +52,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Validator;
|
|
|
import java.net.URLEncoder;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.ZoneId;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -710,6 +713,25 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
return userMapper.select(user);
|
|
|
}
|
|
|
|
|
|
+ public String calculateWorkExperience(Date workStartDate) {
|
|
|
+ LocalDate startDate = workStartDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
+ LocalDate currentDate = LocalDate.now();
|
|
|
+
|
|
|
+ long years = ChronoUnit.YEARS.between(startDate, currentDate);
|
|
|
+ LocalDate anniversary = startDate.plusYears(years);
|
|
|
+
|
|
|
+ long months = ChronoUnit.MONTHS.between(anniversary, currentDate);
|
|
|
+
|
|
|
+ if(years == 0){
|
|
|
+ return months + "个月";
|
|
|
+ }else{
|
|
|
+ if(months == 0){
|
|
|
+ return years + "年";
|
|
|
+ }else{
|
|
|
+ return years + "年" + months + "个月";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
@Override
|
|
|
public List<SecurityUserExport> downSecurityUser() {
|
|
|
SysOrg sysOrg2 = orgService.selectSysOrgById(SecurityUtils.getLoginUser().getOrgId());
|
|
|
@@ -757,6 +779,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
s.setEducationType(sysEducationType);
|
|
|
String sysDuties = iSysDictDataService.selectDictLabel("sys_duties", s.getResponsibilitiesLeaderDuties());
|
|
|
s.setResponsibilitiesLeaderDuties(sysDuties);
|
|
|
+ //工作年限
|
|
|
+ String workDuration = calculateWorkExperience(s.getWorkTime());
|
|
|
+ s.setWorkDuration(workDuration);
|
|
|
});
|
|
|
return securityUserExports;
|
|
|
}
|