/*
|
* Copyright 2019-2020 Zheng Jie
|
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
* you may not use this file except in compliance with the License.
|
* You may obtain a copy of the License at
|
*
|
* http://www.apache.org/licenses/LICENSE-2.0
|
*
|
* Unless required by applicable law or agreed to in writing, software
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* See the License for the specific language governing permissions and
|
* limitations under the License.
|
*/
|
package me.zhengjie.modules.project.service.impl;
|
|
import java.io.IOException;
|
import java.math.BigDecimal;
|
import java.text.ParseException;
|
import java.text.SimpleDateFormat;
|
import java.time.DayOfWeek;
|
import java.time.LocalDate;
|
import java.time.LocalDateTime;
|
import java.time.ZoneId;
|
import java.time.format.DateTimeFormatter;
|
import java.time.temporal.ChronoUnit;
|
import java.util.ArrayList;
|
import java.util.Date;
|
import java.util.HashMap;
|
import java.util.LinkedHashMap;
|
import java.util.List;
|
import java.util.Map;
|
import java.util.Map.Entry;
|
import java.util.function.Function;
|
import java.util.stream.Collectors;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Pageable;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import lombok.RequiredArgsConstructor;
|
import me.zhengjie.exception.BadRequestException;
|
import me.zhengjie.modules.constant.Constant;
|
import me.zhengjie.modules.project.domain.Project;
|
import me.zhengjie.modules.project.domain.ProjectCost;
|
import me.zhengjie.modules.project.repository.ProjectCostRepository;
|
import me.zhengjie.modules.project.repository.ProjectRepository;
|
import me.zhengjie.modules.project.service.ProjectCostService;
|
import me.zhengjie.modules.project.service.dto.ProjectCostDto;
|
import me.zhengjie.modules.project.service.dto.ProjectCostQueryCriteria;
|
import me.zhengjie.modules.project.service.mapstruct.ProjectCostMapper;
|
import me.zhengjie.modules.system.domain.SysConfigHoliday;
|
import me.zhengjie.modules.system.domain.SysLevel;
|
import me.zhengjie.modules.system.domain.SysUserLevelInsurance;
|
import me.zhengjie.modules.system.domain.SysUserLevelWage;
|
import me.zhengjie.modules.system.domain.User;
|
import me.zhengjie.modules.system.repository.SysConfigHolidayRepository;
|
import me.zhengjie.modules.system.repository.SysLevelRepository;
|
import me.zhengjie.modules.system.repository.SysUserLevelInsuranceRepository;
|
import me.zhengjie.modules.system.repository.SysUserLevelWageRepository;
|
import me.zhengjie.modules.system.repository.UserRepository;
|
import me.zhengjie.modules.system.service.UserService;
|
import me.zhengjie.modules.system.service.dto.SysRosteringDto;
|
import me.zhengjie.modules.system.service.dto.UserDto;
|
import me.zhengjie.utils.FileUtil;
|
import me.zhengjie.utils.PageUtil;
|
import me.zhengjie.utils.QueryHelp;
|
import me.zhengjie.utils.ValidationUtil;
|
|
/**
|
* @website https://eladmin.vip
|
* @description 服务实现
|
* @author HuaZhe
|
* @date 2022-12-27
|
**/
|
@Service
|
@RequiredArgsConstructor
|
public class ProjectCostServiceImpl implements ProjectCostService {
|
|
private final ProjectCostRepository projectCostRepository;
|
private final ProjectCostMapper projectCostMapper;
|
private final ProjectRepository projectRepository;
|
private final UserRepository userRepository;
|
private final SysUserLevelWageRepository sysUserLevelWageRepository;
|
private final SysUserLevelInsuranceRepository sysUserLevelInsuranceRepository;
|
private final SysConfigHolidayRepository sysConfigHolidayRepository;
|
private final UserService userService;
|
|
private final SysLevelRepository sysLevelRepository;
|
|
@Override
|
public Map<String,Object> queryAll(ProjectCostQueryCriteria criteria, Pageable pageable){
|
Page<ProjectCost> page = projectCostRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
// 将实体类转换为DTO(重写)
|
Function<ProjectCost, ProjectCostDto> func = new Function<ProjectCost, ProjectCostDto>() {
|
@Override
|
public ProjectCostDto apply(ProjectCost projectCost) {
|
// 将实体类转换成DTO
|
ProjectCostDto projectCostDto = projectCostMapper.toDto(projectCost);
|
// 根据项目ID查询项目信息
|
Project project = projectRepository.findById(projectCostDto.getProjectId()).orElseGet(Project::new);
|
ValidationUtil.isNull(projectCostDto.getId(),"Project","id",projectCostDto.getProjectId());
|
// 项目名称
|
projectCostDto.setProjectName(project.getName());
|
User user = userRepository.findById(projectCostDto.getUserId()).orElseGet(User::new);
|
ValidationUtil.isNull(projectCostDto.getId(),"User","id",projectCostDto.getUserId());
|
projectCostDto.setUserName(user.getNickName());
|
return projectCostDto;
|
}
|
};
|
return PageUtil.toPage(page.map(func));
|
}
|
|
@Override
|
public List<ProjectCostDto> queryAll(ProjectCostQueryCriteria criteria){
|
return projectCostMapper.toDto(projectCostRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
}
|
|
@Override
|
@Transactional
|
public ProjectCostDto findById(Long id) {
|
ProjectCost projectCost = projectCostRepository.findById(id).orElseGet(ProjectCost::new);
|
ValidationUtil.isNull(projectCost.getId(),"ProjectCost","id",id);
|
return projectCostMapper.toDto(projectCost);
|
}
|
|
@Override
|
@Transactional(rollbackFor = Exception.class)
|
public ProjectCostDto create(ProjectCost resources) {
|
return projectCostMapper.toDto(projectCostRepository.save(resources));
|
}
|
|
@Override
|
@Transactional(rollbackFor = Exception.class)
|
public void update(ProjectCost resources) {
|
ProjectCost projectCost = projectCostRepository.findById(resources.getId()).orElseGet(ProjectCost::new);
|
ValidationUtil.isNull( projectCost.getId(),"ProjectCost","id",resources.getId());
|
projectCost.copy(resources);
|
projectCostRepository.save(projectCost);
|
}
|
|
@Override
|
public void deleteAll(Long[] ids) {
|
for (Long id : ids) {
|
projectCostRepository.deleteById(id);
|
}
|
}
|
|
@Override
|
public BigDecimal calcUserCostByDate(Long userId, String enterProjectTime, String exitProjectTime, Map<String, Double> costHoursMap) throws Exception {
|
// 工资
|
BigDecimal wageCost = BigDecimal.valueOf(0);
|
// 工作天数
|
LocalDateTime enterProject = LocalDateTime.parse(enterProjectTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
LocalDateTime exitProject = LocalDateTime.parse(exitProjectTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
Date startDate = simpleDateFormat.parse(enterProjectTime);
|
Date endDate = simpleDateFormat.parse(exitProjectTime);
|
|
// 通过id获取用户级别工资
|
List<SysUserLevelWage> sysUserLevelWages = sysUserLevelWageRepository.findByUserId(userId)
|
.stream().filter(sysUserLevelWage -> !((sysUserLevelWage.getEndDate() != null && sysUserLevelWage.getEndDate().before(startDate)) || sysUserLevelWage.getStartDate().after(endDate)))
|
.collect(Collectors.toList());
|
// 通过id获取用户级别保险
|
List<SysUserLevelInsurance> sysUserLevelInsurances = sysUserLevelInsuranceRepository.findByUserId(userId)
|
.stream().filter(sysUserLevelInsurance -> !((sysUserLevelInsurance.getEndDate() != null && sysUserLevelInsurance.getEndDate().before(startDate)) || sysUserLevelInsurance.getStartDate().after(endDate)))
|
.collect(Collectors.toList());
|
|
// 判断是否有用户级别工资
|
if(sysUserLevelWages.size() <= 0){
|
throw new BadRequestException("此用户暂无级别工资");
|
}
|
// 判断是否有用户级别保险
|
if(sysUserLevelInsurances.size() <= 0){
|
throw new BadRequestException("此用户暂无级别保险");
|
}
|
|
Map<Long, Double> sysUserLevelWageHoursMap = new HashMap<Long, Double>();
|
for (SysUserLevelWage sysUserLevelWage : sysUserLevelWages) {
|
sysUserLevelWageHoursMap.put(sysUserLevelWage.getId(), 0.0);
|
}
|
|
Map<Long, Double> sysUserLevelInsuranceHoursMap = new HashMap<Long, Double>();
|
for (SysUserLevelInsurance sysUserLevelInsurance : sysUserLevelInsurances) {
|
sysUserLevelInsuranceHoursMap.put(sysUserLevelInsurance.getId(), 0.0);
|
}
|
|
for (LocalDate currentLocalDate = enterProject.toLocalDate();
|
currentLocalDate.isBefore(exitProject.toLocalDate()) || currentLocalDate.isEqual(exitProject.toLocalDate());
|
currentLocalDate = currentLocalDate.plusDays(1)) {
|
|
String dateStr = currentLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
if (!costHoursMap.containsKey(dateStr)) {
|
continue;
|
}
|
|
Date currentDate = Date.from(currentLocalDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
|
|
Double costHours = costHoursMap.get(dateStr);
|
|
for (SysUserLevelWage sysUserLevelWage : sysUserLevelWages) {
|
if (sysUserLevelWage.getEndDate() == null || sysUserLevelWage.getEndDate().after(currentDate) || sysUserLevelWage.getEndDate().equals(currentDate)) {
|
sysUserLevelWageHoursMap.put(sysUserLevelWage.getId(), costHours + sysUserLevelWageHoursMap.get(sysUserLevelWage.getId()));
|
break;
|
}
|
}
|
|
for (SysUserLevelInsurance sysUserLevelInsurance : sysUserLevelInsurances) {
|
if (sysUserLevelInsurance.getEndDate() == null || sysUserLevelInsurance.getEndDate().after(currentDate) || sysUserLevelInsurance.getEndDate().equals(currentDate)) {
|
sysUserLevelInsuranceHoursMap.put(sysUserLevelInsurance.getId(), costHours + sysUserLevelInsuranceHoursMap.get(sysUserLevelInsurance.getId()));
|
break;
|
}
|
}
|
}
|
|
for (Entry<Long, Double> entry : sysUserLevelWageHoursMap.entrySet()) {
|
SysUserLevelWage sysLevel = sysUserLevelWageRepository.findById(entry.getKey()).orElseGet(SysUserLevelWage::new);
|
wageCost = wageCost.add(sysLevel.getLevelWage().multiply(BigDecimal.valueOf(entry.getValue())).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING));
|
}
|
|
for (Entry<Long, Double> entry : sysUserLevelInsuranceHoursMap.entrySet()) {
|
SysUserLevelInsurance sysLevel = sysUserLevelInsuranceRepository.findById(entry.getKey()).orElseGet(SysUserLevelInsurance::new);
|
|
BigDecimal accumulationRadix = sysLevel.getAccumulationRadix().multiply(BigDecimal.valueOf(sysLevel.getAccumulationCompanyProportion() / 100));
|
BigDecimal pensionRadix = sysLevel.getPensionRadix().multiply(BigDecimal.valueOf(sysLevel.getPensionCompanyProportion() / 100));
|
BigDecimal medicalRadix = sysLevel.getMedicalRadix().multiply(BigDecimal.valueOf(sysLevel.getMedicalCompanyProportion() / 100));
|
BigDecimal unemploymentRadix = sysLevel.getUnemploymentRadix().multiply(BigDecimal.valueOf(sysLevel.getUnemploymentCompanyProportion() / 100));
|
BigDecimal maternityRadix = sysLevel.getMaternityRadix().multiply(BigDecimal.valueOf(sysLevel.getMaternityCompanyProportion() / 100));
|
BigDecimal industrialInjuryRadix = sysLevel.getIndustrialInjuryRadix().multiply(BigDecimal.valueOf(sysLevel.getIndustrialInjuryCompanyProportion() / 100));
|
|
wageCost = wageCost.add(accumulationRadix.add(pensionRadix).add(medicalRadix).add(unemploymentRadix).add(maternityRadix).add(industrialInjuryRadix).multiply(BigDecimal.valueOf(entry.getValue())).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING));
|
}
|
|
return wageCost;
|
}
|
|
@Override
|
public ProjectCost getCost(ProjectCostQueryCriteria criteria) throws ParseException {
|
ProjectCost projectCost = new ProjectCost();
|
// 工资
|
BigDecimal wageCost = BigDecimal.valueOf(0);
|
// 工作天数
|
LocalDateTime enterProject = LocalDateTime.parse(criteria.getEnterProjectTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
LocalDateTime exitProject = LocalDateTime.parse(criteria.getExitProjectTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
Date startDate = simpleDateFormat.parse(criteria.getEnterProjectTime());
|
Date endDate = simpleDateFormat.parse(criteria.getExitProjectTime());
|
|
|
// 通过id获取用户信息
|
UserDto user = userService.findById(criteria.getUserId());
|
// 通过id获取用户级别工资
|
List<SysUserLevelWage> sysUserLevelWages = sysUserLevelWageRepository.findByUserId(criteria.getUserId())
|
.stream().filter(sysUserLevelWage -> !((sysUserLevelWage.getEndDate() != null && sysUserLevelWage.getEndDate().before(startDate)) || sysUserLevelWage.getStartDate().after(endDate)))
|
.collect(Collectors.toList());
|
// 通过id获取用户级别保险
|
List<SysUserLevelInsurance> sysUserLevelInsurances = sysUserLevelInsuranceRepository.findByUserId(criteria.getUserId())
|
.stream().filter(sysUserLevelInsurance -> !((sysUserLevelInsurance.getEndDate() != null && sysUserLevelInsurance.getEndDate().before(startDate)) || sysUserLevelInsurance.getStartDate().after(endDate)))
|
.collect(Collectors.toList());
|
|
// 判断是否有用户级别工资
|
if(sysUserLevelWages.size() <= 0){
|
throw new BadRequestException("此用户暂无级别工资");
|
}
|
// 判断是否有用户级别保险
|
if(sysUserLevelInsurances.size() <= 0){
|
throw new BadRequestException("此用户暂无级别保险");
|
}
|
|
List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findByHolidayDateBetween(simpleDateFormat.parse(criteria.getEnterProjectTime()), simpleDateFormat.parse(criteria.getExitProjectTime()));
|
|
Map<Long, Double> sysUserLevelWageHoursMap = new HashMap<Long, Double>();
|
for (SysUserLevelWage sysUserLevelWage : sysUserLevelWages) {
|
sysUserLevelWageHoursMap.put(sysUserLevelWage.getLevelId(), 0.0);
|
}
|
|
Map<Long, Double> sysUserLevelInsuranceHoursMap = new HashMap<Long, Double>();
|
for (SysUserLevelInsurance sysUserLevelInsurance : sysUserLevelInsurances) {
|
sysUserLevelInsuranceHoursMap.put(sysUserLevelInsurance.getLevelId(), 0.0);
|
}
|
|
for (LocalDate currentLocalDate = enterProject.toLocalDate();
|
currentLocalDate.isBefore(exitProject.toLocalDate()) || currentLocalDate.isEqual(exitProject.toLocalDate());
|
currentLocalDate = currentLocalDate.plusDays(1)) {
|
String dateType = "";
|
for (SysConfigHoliday sysConfigHoliday : sysConfigHolidayList) {
|
if (currentLocalDate.isEqual(sysConfigHoliday.getHolidayDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate())) {
|
dateType = sysConfigHoliday.getDateType();
|
break;
|
}
|
}
|
if ("".equals(dateType)) {
|
dateType = currentLocalDate.getDayOfWeek() == DayOfWeek.SATURDAY || currentLocalDate.getDayOfWeek() == DayOfWeek.SUNDAY ? Constant.DATE_TYPE_WEEKEND : Constant.DATE_TYPE_WEEKDAY;
|
}
|
if (Constant.DATE_TYPE_WEEKEND.equals(dateType) || Constant.DATE_TYPE_LEGAL_HOLIDAYS.equals(dateType)) {
|
continue;
|
}
|
|
Date currentDate = Date.from(currentLocalDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
|
|
Double costHours = 0.0;
|
SysRosteringDto sysRostering = user.getSysRostering();
|
|
if (currentLocalDate.isEqual(enterProject.toLocalDate())) {
|
if (enterProject.toLocalTime().compareTo(sysRostering.getWorkStartTime()) <= 0) {
|
costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS);
|
} else if (enterProject.toLocalTime().compareTo(sysRostering.getWorkStartTime()) > 0 && enterProject.toLocalTime().compareTo(sysRostering.getLunchStartTime()) <= 0) {
|
costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + enterProject.toLocalTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS);
|
} else if (enterProject.toLocalTime().compareTo(sysRostering.getLunchStartTime()) > 0 && enterProject.toLocalTime().compareTo(sysRostering.getWorkEndTime()) < 0) {
|
if (enterProject.toLocalTime().compareTo(sysRostering.getLunchEndTime()) < 0) {
|
enterProject = enterProject.with(sysRostering.getLunchEndTime());
|
}
|
costHours = costHours + enterProject.toLocalTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS);
|
}
|
} else if (currentLocalDate.isEqual(exitProject.toLocalDate())) {
|
if (exitProject.toLocalTime().compareTo(sysRostering.getWorkStartTime()) > 0 && exitProject.toLocalTime().compareTo(sysRostering.getLunchEndTime()) <= 0) {
|
if (exitProject.toLocalTime().compareTo(sysRostering.getLunchStartTime()) > 0) {
|
exitProject = exitProject.with(sysRostering.getLunchStartTime());
|
}
|
costHours = costHours + sysRostering.getWorkStartTime().until(exitProject.toLocalTime(), ChronoUnit.HOURS);
|
} else if (exitProject.toLocalTime().compareTo(sysRostering.getLunchEndTime()) > 0 && exitProject.toLocalTime().compareTo(sysRostering.getWorkEndTime()) < 0) {
|
costHours = costHours + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS) + sysRostering.getLunchEndTime().until(exitProject.toLocalTime(), ChronoUnit.HOURS);
|
} else if (exitProject.toLocalTime().compareTo(sysRostering.getWorkEndTime()) >= 0) {
|
costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS);
|
}
|
} else {
|
costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS);
|
}
|
|
for (SysUserLevelWage sysUserLevelWage : sysUserLevelWages) {
|
if (sysUserLevelWage.getEndDate() == null || sysUserLevelWage.getEndDate().after(currentDate) || sysUserLevelWage.getEndDate().equals(currentDate)) {
|
sysUserLevelWageHoursMap.put(sysUserLevelWage.getLevelId(), costHours + sysUserLevelWageHoursMap.get(sysUserLevelWage.getLevelId()));
|
break;
|
}
|
}
|
|
for (SysUserLevelInsurance sysUserLevelInsurance : sysUserLevelInsurances) {
|
if (sysUserLevelInsurance.getEndDate() == null || sysUserLevelInsurance.getEndDate().after(currentDate) || sysUserLevelInsurance.getEndDate().equals(currentDate)) {
|
sysUserLevelInsuranceHoursMap.put(sysUserLevelInsurance.getLevelId(), costHours + sysUserLevelInsuranceHoursMap.get(sysUserLevelInsurance.getLevelId()));
|
break;
|
}
|
}
|
}
|
|
for (Entry<Long, Double> entry : sysUserLevelWageHoursMap.entrySet()) {
|
SysLevel sysLevel = sysLevelRepository.findById(entry.getKey()).orElseGet(SysLevel::new);
|
wageCost = wageCost.add(sysLevel.getLevelWage().multiply(BigDecimal.valueOf(entry.getValue())).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING));
|
}
|
|
for (Entry<Long, Double> entry : sysUserLevelInsuranceHoursMap.entrySet()) {
|
SysLevel sysLevel = sysLevelRepository.findById(entry.getKey()).orElseGet(SysLevel::new);
|
|
BigDecimal accumulationRadix = sysLevel.getAccumulationRadix().multiply(BigDecimal.valueOf(sysLevel.getAccumulationCompanyProportion() / 100));
|
BigDecimal pensionRadix = sysLevel.getPensionRadix().multiply(BigDecimal.valueOf(sysLevel.getPensionCompanyProportion() / 100));
|
BigDecimal medicalRadix = sysLevel.getMedicalRadix().multiply(BigDecimal.valueOf(sysLevel.getMedicalCompanyProportion() / 100));
|
BigDecimal unemploymentRadix = sysLevel.getUnemploymentRadix().multiply(BigDecimal.valueOf(sysLevel.getUnemploymentCompanyProportion() / 100));
|
BigDecimal maternityRadix = sysLevel.getMaternityRadix().multiply(BigDecimal.valueOf(sysLevel.getMaternityCompanyProportion() / 100));
|
BigDecimal industrialInjuryRadix = sysLevel.getIndustrialInjuryRadix().multiply(BigDecimal.valueOf(sysLevel.getIndustrialInjuryCompanyProportion() / 100));
|
|
wageCost = wageCost.add(accumulationRadix.add(pensionRadix).add(medicalRadix).add(unemploymentRadix).add(maternityRadix).add(industrialInjuryRadix).multiply(BigDecimal.valueOf(entry.getValue())).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING));
|
}
|
|
projectCost.setProjectCost(wageCost);
|
return projectCost;
|
}
|
|
@Override
|
public void download(List<ProjectCostDto> all, HttpServletResponse response) throws IOException {
|
List<Map<String, Object>> list = new ArrayList<>();
|
for (ProjectCostDto projectCost : all) {
|
String projectName = projectCost.getProjectId() != null ? projectRepository.findById(projectCost.getProjectId()).orElseGet(Project::new).getName() : "";
|
String user = projectCost.getUserId() != null ? userRepository.findById(projectCost.getUserId()).orElseGet(User::new).getNickName() : "";
|
Map<String,Object> map = new LinkedHashMap<>();
|
map.put("项目", projectName);
|
map.put("用户", user);
|
map.put("进入项目时间", projectCost.getEnterProjectTime());
|
map.put("退出项目时间", projectCost.getExitProjectTime());
|
map.put("项目成本", projectCost.getProjectCost());
|
map.put("备注", projectCost.getRemarks());
|
map.put("创建者", projectCost.getCreateBy());
|
map.put("创建时间", projectCost.getCreateTime());
|
map.put("更新者", projectCost.getUpdateBy());
|
map.put("更新时间", projectCost.getUpdateTime());
|
list.add(map);
|
}
|
FileUtil.downloadExcel(list, response);
|
}
|
}
|