yaozc
2023-01-17 5df93a0bf12bfc95d9f3c4a67067fd2852603d02
项目修改
1 files added
17 files modified
482 ■■■■■ changed files
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/domain/Project.java 5 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/domain/ProjectProgress.java 34 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/domain/ProjectType.java 17 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectCostService.java 4 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectDto.java 3 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectProgressDto.java 12 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectTypeDto.java 17 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectTypeQueryCriteria.java 3 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectCostServiceImpl.java 103 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectProgressServiceImpl.java 2 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectServiceImpl.java 9 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectTypeServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/WeekReportMethod.java 39 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/domain/TaskDaliyCostGroupByUserInterface.java 22 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java 20 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/project/project/index.vue 76 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/project/projectProgress/index.vue 32 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/project/projectType/index.vue 79 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/domain/Project.java
@@ -77,6 +77,11 @@
    @NotNull
    @ApiModelProperty(value = "绩效单金")
    private BigDecimal performancePrice;
    @Column(name = "`performance_objectives`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "绩效目标")
    private Double performanceObjectives;
    @Column(name = "`contract_price`",nullable = false)
    @NotNull
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/domain/ProjectProgress.java
@@ -15,16 +15,26 @@
*/
package me.zhengjie.modules.project.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseEntity;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import me.zhengjie.base.BaseEntity;
/**
* @website https://eladmin.vip
@@ -100,6 +110,14 @@
    @Column(name = "`work_total_cost`")
    @ApiModelProperty(value = "总消耗工作量")
    private Double workTotalCost;
    @Column(name = "`money_total_init`")
    @ApiModelProperty(value = "计划总成本")
    private BigDecimal moneyTotalInit;
    @Column(name = "`money_total_cost`")
    @ApiModelProperty(value = "总消耗成本")
    private BigDecimal moneyTotalCost;
    public void copy(ProjectProgress source) {
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/domain/ProjectType.java
@@ -54,15 +54,20 @@
    @ApiModelProperty(value = "标准单价币种")
    private String standardUnitCurrency;
    @Column(name = "`standard_unit_price`",nullable = false)
    @Column(name = "`standard_quotation_price`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "标准单价金额") // TODO
    private BigDecimal standardUnitPrice;
    @ApiModelProperty(value = "标准报价单金")
    private BigDecimal standardQuotationPrice;
    @Column(name = "`standard_profit_price`",nullable = false)
    @Column(name = "`standard_performance_price`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "标准利润金额") // TODO
    private BigDecimal standardProfitPrice;
    @ApiModelProperty(value = "标准绩效单金")
    private BigDecimal standardPerformancePrice;
    @Column(name = "`standard_performance_objectives`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "标准绩效目标")
    private Double standardPerformanceObjectives;
    @Column(name = "`standard_workload_unit`",nullable = false)
    @NotBlank
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectCostService.java
@@ -24,6 +24,8 @@
import java.util.Map;
import java.util.List;
import java.io.IOException;
import java.math.BigDecimal;
import javax.servlet.http.HttpServletResponse;
/**
@@ -84,4 +86,6 @@
    * @throws IOException /
    */
    void download(List<ProjectCostDto> all, HttpServletResponse response) throws IOException;
    BigDecimal calcUserCostByDate(Long userId, String enterProjectTime, String exitProjectTime, Map<String, Double> costHoursMap) throws Exception;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectDto.java
@@ -54,6 +54,9 @@
    /** 绩效单金 */
    private BigDecimal performancePrice;
    /** 绩效目标 */
    private Double performanceObjectives;
    /** 合同金额 */
    private BigDecimal contractPrice;
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectProgressDto.java
@@ -16,10 +16,11 @@
package me.zhengjie.modules.project.service.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;
import me.zhengjie.base.BaseDTO;
import me.zhengjie.modules.project.domain.Project;
import me.zhengjie.modules.project.domain.ProjectProgress;
/**
* @website https://eladmin.vip
@@ -78,4 +79,13 @@
    /** 本周消化工作量 */
    private Double workLastCost;
    /** 计划总成本 */
    private BigDecimal moneyTotalInit;
    /** 总消耗成本 */
    private BigDecimal moneyTotalCost;
    /** 上周进度 */
    private ProjectProgress lastProjectProcess;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectTypeDto.java
@@ -19,6 +19,12 @@
import me.zhengjie.base.BaseDTO;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.io.Serializable;
@@ -40,11 +46,14 @@
    /** 标准单价币种 */
    private String standardUnitCurrency;
    /** 标准单价金额 */
    private BigDecimal standardUnitPrice; // TODO
    /** 标准报价单金 */
    private BigDecimal standardQuotationPrice;
    /** 标准利润金额 */
    private BigDecimal standardProfitPrice; // TODO
    /** 标准绩效单金 */
    private BigDecimal standardPerformancePrice;
    /** 标准绩效目标 */
    private Double standardPerformanceObjectives;
    /** 标准工作量单位 */
    private String standardWorkloadUnit;
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectTypeQueryCriteria.java
@@ -35,7 +35,4 @@
    @Query(type = Query.Type.INNER_LIKE)
    private String name;
    /** 精确 */
    @Query
    private String standardUnitCurrency;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectCostServiceImpl.java
@@ -151,6 +151,95 @@
    }
    @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();
        // 工资
@@ -186,14 +275,14 @@
        List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findByHolidayDateBetween(simpleDateFormat.parse(criteria.getEnterProjectTime()), simpleDateFormat.parse(criteria.getExitProjectTime()));
        Map<Long, Long> sysUserLevelWageHoursMap = new HashMap<Long, Long>();
        Map<Long, Double> sysUserLevelWageHoursMap = new HashMap<Long, Double>();
        for (SysUserLevelWage sysUserLevelWage : sysUserLevelWages) {
            sysUserLevelWageHoursMap.put(sysUserLevelWage.getLevelId(), 0L);
            sysUserLevelWageHoursMap.put(sysUserLevelWage.getLevelId(), 0.0);
        }
        Map<Long, Long> sysUserLevelInsuranceHoursMap = new HashMap<Long, Long>();
        Map<Long, Double> sysUserLevelInsuranceHoursMap = new HashMap<Long, Double>();
        for (SysUserLevelInsurance sysUserLevelInsurance : sysUserLevelInsurances) {
            sysUserLevelInsuranceHoursMap.put(sysUserLevelInsurance.getLevelId(), 0L);
            sysUserLevelInsuranceHoursMap.put(sysUserLevelInsurance.getLevelId(), 0.0);
        }
        for (LocalDate currentLocalDate = enterProject.toLocalDate();
@@ -215,7 +304,7 @@
            Date currentDate = Date.from(currentLocalDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
            Long costHours = 0L;
            Double costHours = 0.0;
            SysRosteringDto sysRostering = user.getSysRostering();
            if (currentLocalDate.isEqual(enterProject.toLocalDate())) {
@@ -259,12 +348,12 @@
            }
        }
        for (Entry<Long, Long> entry : sysUserLevelWageHoursMap.entrySet()) {
        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, Long> entry : sysUserLevelInsuranceHoursMap.entrySet()) {
        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));
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectProgressServiceImpl.java
@@ -87,7 +87,7 @@
                                        .minusDays(7);
                Optional<ProjectProgress> projectProgressOpl = projectProgressRepository.findByBelongYearAndBelongWeekAndProjectId(localDate.get(wfs.weekBasedYear()), localDate.get(wfs.weekOfWeekBasedYear()), projectProgressDto.getProject().getId());
                projectProgressDto.setLastProjectProcess(projectProgressOpl.orElseGet(ProjectProgress::new));
                if (!projectProgressOpl.isPresent()) {
                    projectProgressDto.setTimeLastCost(projectProgressDto.getTimeTotalCost());
                    projectProgressDto.setWorkLastCost(projectProgressDto.getWorkTotalCost());
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectServiceImpl.java
@@ -49,6 +49,7 @@
import me.zhengjie.modules.system.repository.UserRepository;
import me.zhengjie.modules.system.service.RoleService;
import me.zhengjie.modules.task.domain.Task;
import me.zhengjie.modules.task.repository.TaskRepository;
import me.zhengjie.modules.task.repository.TaskUserRepository;
import me.zhengjie.modules.task.service.TaskService;
import me.zhengjie.utils.FileUtil;
@@ -76,6 +77,7 @@
    private final RoleService roleService;
    private final TaskUserRepository taskUserRepository;
    private final ProjectCostRepository projectCostRepository;
    private final TaskRepository taskRepository;
    @Override
    public Map<String,Object> queryAll(ProjectQueryCriteria criteria, Pageable pageable){
@@ -150,6 +152,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateProjectAdmit(Long[] ids){
        for (Long id : ids) {
            Project project = projectRepository.findByIdUpdate(id);
@@ -176,7 +179,11 @@
                        task.setRemarks(list.get(i).getRemarks());
                    }
                    task.setPriority(Constant.PRIORITY_LOW);
                    taskService.create(task);
                    // 未开始
                    task.setTaskStatus(Constant.TASK_STATUS_NOT_STARTED);
                    task.setPlanStartTime(list.get(i).getPlanStartTime());
                    task.setPlanEndTime(list.get(i).getPlanEndTime());
                    taskRepository.save(task);
                }
            }
        }
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectTypeServiceImpl.java
@@ -108,8 +108,9 @@
            Map<String,Object> map = new LinkedHashMap<>();
            map.put("名称", projectType.getName());
            map.put("标准单价币种", unitCurrency);
            map.put("标准单价金额", projectType.getStandardUnitPrice());
            map.put("标准利润金额", projectType.getStandardProfitPrice());
            map.put("标准报价单金", projectType.getStandardQuotationPrice());
            map.put("标准绩效单金", projectType.getStandardPerformancePrice());
            map.put("标准绩效目标", projectType.getStandardPerformanceObjectives());
            map.put("标准工作量单位", workloadUnit);
            map.put("备注", projectType.getRemarks());
            map.put("创建者", projectType.getCreateBy());
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/WeekReportMethod.java
@@ -1,12 +1,17 @@
package me.zhengjie.modules.quartz.task;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.temporal.WeekFields;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -18,7 +23,9 @@
import me.zhengjie.modules.project.domain.ProjectProgress;
import me.zhengjie.modules.project.repository.ProjectProgressRepository;
import me.zhengjie.modules.project.repository.ProjectRepository;
import me.zhengjie.modules.project.service.ProjectCostService;
import me.zhengjie.modules.task.domain.Task;
import me.zhengjie.modules.task.domain.TaskDaliy;
import me.zhengjie.modules.task.domain.TaskDaliyCollectInterface;
import me.zhengjie.modules.task.repository.TaskDaliyRepository;
import me.zhengjie.modules.task.repository.TaskRepository;
@@ -39,6 +46,8 @@
    private final TaskRepository taskRepository;
    private final TaskDaliyRepository taskDaliyRepository;
    private final ProjectCostService projectCostService;
    /**
     * 生成周报
@@ -86,6 +95,32 @@
            // 真实时长
            Double realLastCost = 0.0;
            List<Task> taskList = taskRepository.findByProjectIdUntilDate(project.getId(), projectProgress.getBelongDate());
//            List<TaskDaliyCostGroupByUserInterface> taskDaliyCostGroupByUserList = taskDaliyRepository.collectCostByProjectIdGroupUser(project.getId());
//            for (TaskDaliyCostGroupByUserInterface taskDaliyCostGroupByUser : taskDaliyCostGroupByUserList) {
//
//            }
            List<TaskDaliy> taskDaliyList = taskDaliyRepository.findByProjectId(project.getId());
            Map<Long, List<TaskDaliy>> collectMap = taskDaliyList.stream().collect(Collectors.groupingBy(TaskDaliy::getUserId));
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            BigDecimal totalCost = BigDecimal.valueOf(0.0);
            for (Entry<Long, List<TaskDaliy>> entry : collectMap.entrySet()) {
                List<TaskDaliy> taskDaliyListSub = entry.getValue();
                Map<String, Double> costHourMap = new HashMap<String, Double>();
                taskDaliyListSub.forEach(taskDaliy -> {
                    costHourMap.put(sdf.format(taskDaliy.getFillDate()), taskDaliy.getConsumedHours());
                });
                String startDate = sdf.format(taskDaliyListSub.get(0).getFillDate());
                String endDate = sdf.format(taskDaliyListSub.get(taskDaliyListSub.size() - 1).getFillDate());
                try {
                    totalCost = totalCost.add(projectCostService.calcUserCostByDate(entry.getKey(), startDate + " 00:00:00", endDate + " 00:00:00", costHourMap));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            for (Task task : taskList) {
                timeTotalInit = timeTotalInit + task.getPlanHours();
                workTotalInit = workTotalInit + (task.getPlanWorkload() == null ? 0.0 : task.getPlanWorkload());
@@ -109,6 +144,10 @@
            projectProgress.setWorkTotalCost(workTotalCost);
            // 总工作量
            projectProgress.setWorkTotalInit(workTotalInit);
            // 计划总成本
            projectProgress.setMoneyTotalInit(project.getPerformancePrice().multiply(BigDecimal.valueOf(timeTotalInit)));
            // 总消耗成本
            projectProgress.setMoneyTotalCost(totalCost);
            // 存在则更新,不存在则插入
            projectProgressRepository.save(projectProgress);
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/domain/TaskDaliyCostGroupByUserInterface.java
New file
@@ -0,0 +1,22 @@
package me.zhengjie.modules.task.domain;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2022-12-30
**/
public interface TaskDaliyCostGroupByUserInterface {
    /**
     * 用户ID
     * @return
     */
    Long getUserId();
    /**
     * 消耗工时
     * @return
     */
    Double getConsumedHours();
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
@@ -17,6 +17,7 @@
import me.zhengjie.modules.task.domain.TaskDaliy;
import me.zhengjie.modules.task.domain.TaskDaliyCollectInterface;
import me.zhengjie.modules.task.domain.TaskDaliyCostGroupByUserInterface;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@@ -51,7 +52,7 @@
    TaskDaliy findNextByProjectIdAndTaskIdAndAndUserId(Long projectId, Long taskId, Long userId, Timestamp fillDate);
    @Query(value = "SELECT avg(task_progress) as taskProgress, COALESCE(sum(consumed_workload), 0.0) as consumedWorkload, sum(consumed_hours) as consumedHours FROM task_daliy WHERE task_id = ?1 AND create_time < ?2", nativeQuery = true)
    @Query(value = "SELECT COALESCE(avg(task_progress), 0.0) as taskProgress, COALESCE(sum(consumed_workload), 0.0) as consumedWorkload, COALESCE(sum(consumed_hours), 0.0) as consumedHours FROM task_daliy WHERE task_id = ?1 AND create_time < ?2", nativeQuery = true)
    TaskDaliyCollectInterface collectTaskDaliyUntilDate(Long taskId, Date belongDate);
    /**
@@ -79,4 +80,21 @@
     * @return
     */
    List<TaskDaliy> findByProjectIdAndTaskId(Long projectId, Long taskId);
    /**
     * 根据项目ID查询任务日报信息
     * @param projectId
     * @return
     */
    @Query(value = "SELECT * FROM task_daliy WHERE project_id = ?1 ORDER BY user_id, fill_date ASC", nativeQuery = true)
    List<TaskDaliy> findByProjectId(Long projectId);
    /**
     * 根据项目ID、任务ID查询
     * @param projectId
     * @param taskId
     * @return
     */
    @Query(value = "SELECT user_id AS userId, COALESCE(SUM(consumed_hours), 0) AS consumedHours FROM task_daliy WHERE project_id = ?1 GROUP BY user_id", nativeQuery = true)
    List<TaskDaliyCostGroupByUserInterface> collectCostByProjectIdGroupUser(Long projectId);
}
eladmin-web-master/src/views/project/project/index.vue
@@ -13,14 +13,6 @@
            :value="item.id"
          />
        </el-select>
        <el-select v-model="query.unitCurrency" clearable filterable placeholder="请选择单价币种" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[standardUnitCurrency]"
            :key="item.id"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-select v-model="query.liableUserId" clearable filterable placeholder="请选择责任人" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in userList"
@@ -32,14 +24,6 @@
        <el-select v-model="query.projectStatus" clearable filterable placeholder="请选择项目状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[projectStatus]"
            :key="item.id"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-select v-model="query.approveStatus" clearable filterable placeholder="请选择批准状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[approveStatus]"
            :key="item.id"
            :label="item.label"
            :value="item.value"
@@ -183,21 +167,31 @@
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column prop="performancePrice" label="预算金额" width="120">
        <el-table-column prop="performancePrice" label="绩效金额" width="120">
          <template slot-scope="scope">
            <el-tooltip class="item" effect="dark" :content="scope.row.performancePrice + ' * ' + scope.row.totalTaskTime" placement="top">
              <span>{{ scope.row.performancePrice != null && scope.row.performancePrice != '' ? crud.toMoney(scope.row.performancePrice * scope.row.totalTaskTime) : 0 }}</span>
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column prop="totalLaborCost" label="人力成本预算" width="120">
        <el-table-column prop="totalLaborCost" label="项目成本" align="center" width="120">
          <template slot-scope="scope">
            {{ scope.row.totalLaborCost != null && scope.row.totalLaborCost != '' ? crud.toMoney(scope.row.totalLaborCost) : '' }}
            <el-tag v-if="scope.row.performancePrice * scope.row.totalTaskTime < scope.row.totalLaborCost" type="danger">
              {{ scope.row.totalLaborCost != null && scope.row.totalLaborCost != '' ? crud.toMoney(scope.row.totalLaborCost) : '' }}
            </el-tag>
            <span v-else>
              {{ scope.row.totalLaborCost != null && scope.row.totalLaborCost != '' ? crud.toMoney(scope.row.totalLaborCost) : '' }}
            </span>
          </template>
        </el-table-column>
        <el-table-column prop="performanceObjectives" label="绩效目标" width="120">
        <el-table-column prop="performanceObjectives" label="绩效目标" align="center" width="120">
          <template slot-scope="scope">
            {{ (scope.row.performanceObjectives ? scope.row.performanceObjectives : 0) + '%' }}
            <el-tag v-if="scope.row.performancePrice * scope.row.totalTaskTime * (1 - scope.row.performanceObjectives / 100) < scope.row.totalLaborCost" type="warning">
              {{ (scope.row.performanceObjectives ? scope.row.performanceObjectives : 0) + '%' }}
            </el-tag>
            <span v-else>
              {{ (scope.row.performanceObjectives ? scope.row.performanceObjectives : 0) + '%' }}
            </span>
          </template>
        </el-table-column>
        <el-table-column prop="liableUserName" label="责任人" width="80">
@@ -279,15 +273,15 @@
    return CRUD({ title: '项目', url: 'api/project', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProject }})
  },
  data() {
    var checkUnitPrice = (rule, value, callback) => {
    var quotationPrice = (rule, value, callback) => {
      if (value !== null) {
        if (isNaN(Number(value))) {
          callback(new Error('单价金额必须是数字'))
          callback(new Error('报价单金必须是数字'))
        } else {
          if (value <= 0) {
            callback(new Error('单价金额必须大于0'))
            callback(new Error('报价单金必须大于0'))
          } else if (value >= 10000000000) {
            callback(new Error('单价金额必须小于1百亿'))
            callback(new Error('报价单金必须小于1百亿'))
          } else {
            callback()
          }
@@ -296,19 +290,28 @@
        callback(new Error('单价金额不能为空'))
      }
    }
    var checkTotalPrice = (rule, value, callback) => {
    var performancePrice = (rule, value, callback) => {
      if (value !== null) {
        if (isNaN(Number(value))) {
          callback(new Error('报价金额必须是数字'))
          callback(new Error('绩效单金必须是数字'))
        } else {
          if (value < 0) {
            callback(new Error('报价金额必须大于0'))
            callback(new Error('绩效单金必须大于0'))
          } else if (value >= 10000000000) {
            callback(new Error('报价金额必须小于1百亿'))
            callback(new Error('绩效单金必须小于1百亿'))
          } else {
            callback()
          }
        }
      } else {
        callback()
      }
    }
    // 比例(百内)验证
    var proportionValidate = (rule, value, callback) => {
      const reg = /^([0-9]|[1-9]\d)(\.\d{1,2})?$|100$/
      if (value != null && value !== '' && !reg.test(value)) {
        callback(new Error('请输入 一百 以内的正整数或两位小数'))
      } else {
        callback()
      }
@@ -336,10 +339,13 @@
          { required: true, message: '单价币种不能为空', trigger: 'change' }
        ],
        quotationPrice: [
          { required: true, validator: checkUnitPrice, trigger: 'blur' }
          { required: true, validator: quotationPrice, trigger: 'blur' }
        ],
        contractPrice: [
          { validator: checkTotalPrice, trigger: 'blur' }
        performancePrice: [
          { required: true, validator: performancePrice, trigger: 'blur' }
        ],
        performanceObjectives: [
          { required: true, validator: proportionValidate, trigger: 'blur' }
        ],
        projectStatus: [
          { required: true, message: '项目状态不能为空', trigger: 'change' }
@@ -428,9 +434,11 @@
        // 单价币种赋值
        this.form.unitCurrency = res[0].standardUnitCurrency
        // 单价金额赋值
        this.form.quotationPrice = res[0].standardUnitPrice
        this.form.quotationPrice = res[0].standardQuotationPrice
        // 单价金额赋值
        this.form.performancePrice = res[0].standardProfitPrice
        this.form.performancePrice = res[0].standardPerformancePrice
        //
        this.form.performanceObjectives = res[0].standardPerformanceObjectives
        this.random = Math.random()
      })
    },
eladmin-web-master/src/views/project/projectProgress/index.vue
@@ -118,13 +118,31 @@
            <el-tag>{{ dict.label[approveStatus][scope.row.approveStatus] }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="timeTotalInit" label="总绩效工时" align="center" width="100" />
        <el-table-column prop="timeTotalCost" label="总消耗绩效工时" align="center" width="120" />
        <el-table-column prop="timeLastCost" label="本周消化绩效工时" align="center" width="120" />
        <el-table-column prop="realLastCost" label="实际消化工时" align="center" width="100" />
        <el-table-column prop="workTotalInit" label="总工作量" align="center" width="100" />
        <el-table-column prop="workTotalCost" label="总消耗工作量" align="center" width="100" />
        <el-table-column prop="workLastCost" label="本周消化工作量" align="center" width="110" />
        <el-table-column prop="moneyTotalInit" label="计划总成本" align="center" width="100">
          <template slot-scope="scope">
            {{ scope.row.moneyTotalInit != null && scope.row.moneyTotalInit != '' ? crud.toMoney(scope.row.moneyTotalInit) : 0 }}
            ({{ scope.row.lastProjectProcess.moneyTotalInit != null && scope.row.lastProjectProcess.moneyTotalInit != '' ? crud.toMoney(scope.row.moneyTotalInit - scope.row.lastProjectProcess.moneyTotalInit) : 0 }})
          </template>
        </el-table-column>
        <el-table-column prop="moneyTotalCost" label="总消耗成本" align="center" width="100">
          <template slot-scope="scope">
            {{ scope.row.moneyTotalCost != null && scope.row.moneyTotalCost != '' ? crud.toMoney(scope.row.moneyTotalCost) : 0 }}
            ({{ scope.row.lastProjectProcess.moneyTotalCost != null && scope.row.lastProjectProcess.moneyTotalCost != '' ? crud.toMoney(scope.row.moneyTotalCost - scope.row.lastProjectProcess.moneyTotalCost) : 0 }})
          </template>
        </el-table-column>
        <el-table-column prop="realLastCost" label="本周消化工时" align="center" width="100" />
        <el-table-column prop="workTotalInit" label="总工作量" align="center" width="100">
          <template slot-scope="scope">
            {{ scope.row.workTotalInit != null && scope.row.workTotalInit != '' ? crud.toMoney(scope.row.workTotalInit) : 0 }}
            ({{ scope.row.lastProjectProcess.workTotalInit != null && scope.row.lastProjectProcess.workTotalInit != '' ? crud.toMoney(scope.row.workTotalInit - scope.row.lastProjectProcess.workTotalInit) : 0 }})
          </template>
        </el-table-column>
        <el-table-column prop="workTotalCost" label="总消耗工作量" align="center" width="100">
          <template slot-scope="scope">
            {{ scope.row.workTotalCost != null && scope.row.workTotalCost != '' ? crud.toMoney(scope.row.workTotalCost) : 0 }}
            ({{ scope.row.lastProjectProcess.workTotalCost != null && scope.row.lastProjectProcess.workTotalCost != '' ? crud.toMoney(scope.row.workTotalCost - scope.row.lastProjectProcess.workTotalCost) : 0 }})
          </template>
        </el-table-column>
        <el-table-column prop="remarks" label="备注" show-overflow-tooltip />
        <el-table-column v-if="checkPer(['admin','projectProgress:edit','projectProgress:del'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
eladmin-web-master/src/views/project/projectType/index.vue
@@ -5,14 +5,6 @@
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <el-input v-model="query.name" clearable placeholder="请输入名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <el-select v-model="query.standardUnitCurrency" filterable placeholder="请选择标准单价币种" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[standardUnitCurrency]"
            :key="item.id"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <rrOperation />
      </div>
      <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
@@ -33,11 +25,16 @@
              />
            </el-select>
          </el-form-item>
          <el-form-item label="标准单价金额" prop="standardUnitPrice">
            <money-input :key="random" v-model="form.standardUnitPrice" :width="330" />
          <el-form-item label="标准报价单金" prop="standardQuotationPrice">
            <money-input :key="random" v-model="form.standardQuotationPrice" :width="330" />
          </el-form-item>
          <el-form-item label="标准利润金额" prop="standardProfitPrice">
            <money-input :key="random" v-model="form.standardProfitPrice" :width="330" />
          <el-form-item label="标准绩效单金" prop="standardPerformancePrice">
            <money-input :key="random" v-model="form.standardPerformancePrice" :width="330" />
          </el-form-item>
          <el-form-item label="标准绩效目标" prop="standardPerformanceObjectives">
            <el-input v-model="form.standardPerformanceObjectives" filterable placeholder="请输入绩效目标" style="width: 330px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="标准工作量单位" prop="standardWorkloadUnit">
            <el-select v-model="form.standardWorkloadUnit" filterable placeholder="请选择" style="width: 330px;">
@@ -67,14 +64,19 @@
            <el-tag>{{ dict.label[standardUnitCurrency][scope.row.standardUnitCurrency] }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="standardUnitPrice" label="标准单价金额">
        <el-table-column prop="standardQuotationPrice" label="标准报价单金">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.standardUnitPrice) }}
            {{ crud.toMoney(scope.row.standardQuotationPrice) }}
          </template>
        </el-table-column>
        <el-table-column prop="standardProfitPrice" label="标准利润金额">
        <el-table-column prop="standardPerformancePrice" label="标准绩效单金">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.standardProfitPrice) }}
            {{ crud.toMoney(scope.row.standardPerformancePrice) }}
          </template>
        </el-table-column>
        <el-table-column prop="standardPerformanceObjectives" label="标准绩效目标">
          <template slot-scope="scope">
            {{ scope.row.standardPerformanceObjectives }}%
          </template>
        </el-table-column>
        <el-table-column prop="standardWorkloadUnit" label="标准工作量单位">
@@ -109,7 +111,7 @@
import moneyInput from '../../assembly/moneyInput/index.vue'
import constant from '../../../utils/constant'
const defaultForm = { id: null, name: null, standardUnitCurrency: null, standardUnitPrice: null, standardProfitPrice: null, standardWorkloadUnit: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
const defaultForm = { id: null, name: null, standardUnitCurrency: null, standardQuotationPrice: null, standardPerformancePrice: null, standardPerformanceObjectives: null, standardWorkloadUnit: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
export default {
  name: 'ProjectType',
  components: { pagination, crudOperation, rrOperation, udOperation, moneyInput },
@@ -119,38 +121,47 @@
    return CRUD({ title: '项目类型', url: 'api/projectType', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProjectType }})
  },
  data() {
    var checkStandardUnitPricet = (rule, value, callback) => {
    var checkStandardQuotationPrice = (rule, value, callback) => {
      if (value !== null) {
        if (isNaN(Number(value))) {
          callback(new Error('标准单价金额必须是数字'))
          callback(new Error('标准报价单金必须是数字'))
        } else {
          if (value <= 0) {
            callback(new Error('标准单价金额必须大于0'))
            callback(new Error('标准报价单金必须大于0'))
          } else if (value >= 10000000000) {
            callback(new Error('标准单价金额必须小于1百亿'))
            callback(new Error('标准报价单金必须小于1百亿'))
          } else {
            callback()
          }
        }
      } else {
        callback(new Error('标准单价金额不能为空'))
        callback(new Error('标准报价单金不能为空'))
      }
    }
    var checkStandardProfitPrice = (rule, value, callback) => {
    var checkStandardPerformancePrice = (rule, value, callback) => {
      if (value !== null) {
        if (isNaN(Number(value))) {
          callback(new Error('标准利润金额必须是数字'))
          callback(new Error('标准绩效单金必须是数字'))
        } else {
          if (value <= 0) {
            callback(new Error('标准利润金额必须大于0'))
            callback(new Error('标准绩效单金必须大于0'))
          } else if (value >= 10000000000) {
            callback(new Error('标准利润金额必须小于1百亿'))
            callback(new Error('标准绩效单金必须小于1百亿'))
          } else {
            callback()
          }
        }
      } else {
        callback(new Error('标准利润金额不能为空'))
        callback(new Error('标准绩效单金不能为空'))
      }
    }
    // 比例(百内)验证
    var proportionValidate = (rule, value, callback) => {
      const reg = /^([0-9]|[1-9]\d)(\.\d{1,2})?$|100$/
      if (value != null && value !== '' && !reg.test(value)) {
        callback(new Error('请输入 一百 以内的正整数或两位小数'))
      } else {
        callback()
      }
    }
    return {
@@ -168,19 +179,21 @@
        standardUnitCurrency: [
          { required: true, message: '标准单价币种不能为空', trigger: 'blur' }
        ],
        standardUnitPrice: [
          { required: true, validator: checkStandardUnitPricet, trigger: 'blur' }
        standardQuotationPrice: [
          { required: true, validator: checkStandardQuotationPrice, trigger: 'blur' }
        ],
        standardProfitPrice: [
          { required: true, validator: checkStandardProfitPrice, trigger: 'blur' }
        standardPerformancePrice: [
          { required: true, validator: checkStandardPerformancePrice, trigger: 'blur' }
        ],
        standardPerformanceObjectives: [
          { required: true, validator: proportionValidate, trigger: 'blur' }
        ],
        standardWorkloadUnit: [
          { required: true, message: '标准工作量单位不能为空', trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'name', display_name: '名称' },
        { key: 'standardUnitCurrency', display_name: '标准单价币种' }
        { key: 'name', display_name: '名称' }
      ],
      // 标准单价币种
      standardUnitCurrency: constant.STANDARD_UNIT_CURRENCY,