1 files added
17 files modified
| | |
| | | @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 |
| | |
| | | */ |
| | | 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 |
| | |
| | | @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)); |
| | | } |
| | |
| | | @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 |
| | |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | |
| | | * @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; |
| | | } |
| | |
| | | |
| | | /** 绩效单金 */ |
| | | private BigDecimal performancePrice; |
| | | |
| | | /** 绩效目标 */ |
| | | private Double performanceObjectives; |
| | | |
| | | /** 合同金额 */ |
| | | private BigDecimal contractPrice; |
| | |
| | | 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 |
| | |
| | | /** 本周消化工作量 */ |
| | | private Double workLastCost; |
| | | |
| | | /** 计划总成本 */ |
| | | private BigDecimal moneyTotalInit; |
| | | |
| | | /** 总消耗成本 */ |
| | | private BigDecimal moneyTotalCost; |
| | | |
| | | /** 上周进度 */ |
| | | private ProjectProgress lastProjectProcess; |
| | | |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | /** 标准单价币种 */ |
| | | private String standardUnitCurrency; |
| | | |
| | | /** 标准单价金额 */ |
| | | private BigDecimal standardUnitPrice; // TODO |
| | | /** 标准报价单金 */ |
| | | private BigDecimal standardQuotationPrice; |
| | | |
| | | /** 标准利润金额 */ |
| | | private BigDecimal standardProfitPrice; // TODO |
| | | /** 标准绩效单金 */ |
| | | private BigDecimal standardPerformancePrice; |
| | | |
| | | /** 标准绩效目标 */ |
| | | private Double standardPerformanceObjectives; |
| | | |
| | | /** 标准工作量单位 */ |
| | | private String standardWorkloadUnit; |
| | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String name; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String standardUnitCurrency; |
| | | } |
| | |
| | | } |
| | | |
| | | @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(); |
| | | // 工资 |
| | |
| | | |
| | | 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(); |
| | |
| | | |
| | | 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())) { |
| | |
| | | } |
| | | } |
| | | |
| | | 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)); |
| | |
| | | .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()); |
| | |
| | | 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; |
| | |
| | | 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){ |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateProjectAdmit(Long[] ids){ |
| | | for (Long id : ids) { |
| | | Project project = projectRepository.findByIdUpdate(id); |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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()); |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | private final TaskRepository taskRepository; |
| | | |
| | | private final TaskDaliyRepository taskDaliyRepository; |
| | | |
| | | private final ProjectCostService projectCostService; |
| | | |
| | | /** |
| | | * 生成周报 |
| | |
| | | // 真实时长 |
| | | 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()); |
| | |
| | | projectProgress.setWorkTotalCost(workTotalCost); |
| | | // 总工作量 |
| | | projectProgress.setWorkTotalInit(workTotalInit); |
| | | // 计划总成本 |
| | | projectProgress.setMoneyTotalInit(project.getPerformancePrice().multiply(BigDecimal.valueOf(timeTotalInit))); |
| | | // 总消耗成本 |
| | | projectProgress.setMoneyTotalCost(totalCost); |
| | | |
| | | // 存在则更新,不存在则插入 |
| | | projectProgressRepository.save(projectProgress); |
| New file |
| | |
| | | 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(); |
| | | } |
| | |
| | | |
| | | 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; |
| | |
| | | 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); |
| | | |
| | | /** |
| | |
| | | * @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); |
| | | } |
| | |
| | | :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" |
| | |
| | | <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" |
| | |
| | | </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"> |
| | | <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"> |
| | | <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"> |
| | |
| | | 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() |
| | | } |
| | |
| | | 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() |
| | | } |
| | |
| | | { 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' } |
| | |
| | | // 单价币种赋值 |
| | | 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() |
| | | }) |
| | | }, |
| | |
| | | <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"> |
| | |
| | | <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'--> |
| | |
| | | /> |
| | | </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;"> |
| | |
| | | <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="标准工作量单位"> |
| | |
| | | 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 }, |
| | |
| | | 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 { |
| | |
| | | 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, |