yaozc
2023-03-22 d4c1742fc81de272e026211d751597c8ed5253e1
Merge branch 'zhaoss' of http://192.168.1.110:5678/r/pms-upgrade into master
14 files added
25 files modified
1768 ■■■■■ changed files
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/domain/Project.java 2 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/domain/ProjectSummary.java 10 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/repository/ProjectRepository.java 12 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/rest/ProjectController.java 17 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectService.java 15 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectDto.java 6 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectQueryCriteria.java 6 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectServiceImpl.java 197 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/impl/SalaryServiceImpl.java 2 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysGoalSetting.java 69 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysGoalSettingRepository.java 28 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysGoalSettingController.java 95 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysGoalSettingService.java 83 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysGoalSettingDto.java 48 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysGoalSettingQueryCriteria.java 38 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysGoalSettingServiceImpl.java 144 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java 13 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysGoalSettingMapper.java 32 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/rest/TaskDaliyController.java 2 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/TaskDaliyService.java 2 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskDto.java 3 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskUserDto.java 3 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskUserQueryCriteria.java 3 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskDaliyServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskServiceImpl.java 16 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskUserServiceImpl.java 16 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/temp/Temp.java 48 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/api/project/project.js 18 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/api/system/goalSetting.js 35 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/components/Crud/crud.js 13 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/dashboard/PanelGroup.vue 4 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/project/chart/subgroupTurnover.vue 125 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/project/index.vue 86 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/project/project/index.vue 100 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/project/projectCost/index.vue 26 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/project/projectTask/index.vue 24 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/system/goalSetting/index.vue 156 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/task/task/index.vue 155 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/task/taskUser/index.vue 111 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/domain/Project.java
@@ -89,7 +89,7 @@
    @Column(name = "`liable_user_id`")
    @ApiModelProperty(value = "责任人ID")
    private Long liableUserId;
    private String liableUserId;
    @Column(name = "`plan_start_date`")
    @ApiModelProperty(value = "计划开始日期")
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/domain/ProjectSummary.java
New file
@@ -0,0 +1,10 @@
package me.zhengjie.modules.project.domain;
import java.math.BigDecimal;
public interface ProjectSummary {
    String getProjectDistinguish();
    BigDecimal getContractPrice();
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/repository/ProjectRepository.java
@@ -15,12 +15,14 @@
*/
package me.zhengjie.modules.project.repository;
import me.zhengjie.modules.project.domain.ProjectSummary;
import org.springframework.data.jpa.repository.Query;
import me.zhengjie.modules.project.domain.Project;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
import java.util.Map;
/**
* @website https://eladmin.vip
@@ -48,6 +50,14 @@
     * @param liableUserId
     * @return
     */
    @Query(value = "SELECT id FROM project WHERE liable_user_id = ?1", nativeQuery = true)
    @Query(value = "SELECT id FROM project WHERE liable_user_id LIKE concat('%-',?1,'-%')", nativeQuery = true)
    List<Long> findIdByLiableUserId(Long liableUserId);
    /**
     * 根据目标年份查询分组营业额
     * @param targetYear
     * @return
     */
    @Query(value = "SELECT project_distinguish AS projectDistinguish, COALESCE(sum(contract_price), 0) AS contractPrice FROM project WHERE plan_start_date LIKE concat(?1,'%') GROUP BY project_distinguish", nativeQuery = true)
    List<ProjectSummary> findSubgroupTurnoverByTargetYear(String targetYear);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/rest/ProjectController.java
@@ -113,6 +113,15 @@
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    @PutMapping("/disavow")
    @Log("修改项目(未承认)")
    @ApiOperation("修改项目(未承认)")
    @PreAuthorize("@el.check('project:admit')")
    public ResponseEntity<Object> updateProjectDisavow(@RequestBody Long[] ids){
        projectService.updateProjectDisavow(ids);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    @GetMapping(value = "/partake")
    @Log("查询参与的项目")
    @ApiOperation("查询参与的项目")
@@ -120,4 +129,12 @@
    public ResponseEntity<Object> queryPartakeProjectAll(ProjectQueryCriteria criteria){
        return new ResponseEntity<>(projectService.queryPartakeAll(criteria),HttpStatus.OK);
    }
    @GetMapping(value = "/subgroupTurnover")
    @Log("查询项目分组营业额")
    @ApiOperation("查询项目分组营业额")
    @PreAuthorize("@el.check('project:list')")
    public ResponseEntity<Object> querySubgroupTurnover(ProjectQueryCriteria criteria){
        return new ResponseEntity<>(projectService.querySubgroupTurnover(criteria),HttpStatus.OK);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectService.java
@@ -19,6 +19,8 @@
import me.zhengjie.modules.project.service.dto.ProjectDto;
import me.zhengjie.modules.project.service.dto.ProjectQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.math.BigDecimal;
import java.util.Map;
import java.util.List;
import java.io.IOException;
@@ -87,6 +89,12 @@
    void updateProjectAdmit(Long[] ids);
    /**
     * 项目未承认
     * @param ids /
     */
    void updateProjectDisavow(Long[] ids);
    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
@@ -100,4 +108,11 @@
     * @return List<ProjectDto>
     */
    List<ProjectDto> queryPartakeAll(ProjectQueryCriteria criteria);
    /**
     * 查询项目分组营业额
     * @param criteria
     * @return
     */
    List<Map<String, Object>> querySubgroupTurnover(ProjectQueryCriteria criteria);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectDto.java
@@ -21,6 +21,7 @@
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.List;
/**
* @website https://eladmin.vip
@@ -80,7 +81,10 @@
    private BigDecimal actualOtherCost;
    /** 责任人ID */
    private Long liableUserId;
    private String liableUserId;
    /** 责任人ID列表 */
    private List<Long> liableUserIdList;
    /** 计划开始日期 */
    private Timestamp planStartDate;
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectQueryCriteria.java
@@ -49,8 +49,8 @@
    private String unitCurrency;
    /** 精确 */
    @Query
    private Long liableUserId;
    @Query(type = Query.Type.INNER_LIKE)
    private String liableUserId;
    /** 精确 */
    @Query(type = Query.Type.BETWEEN)
@@ -73,4 +73,6 @@
    private List<Long> idInList;
    private Long taskUserId;
    private String targetYear;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectServiceImpl.java
@@ -30,8 +30,15 @@
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.contract.repository.ContractProjectRepository;
import me.zhengjie.modules.cost.repository.CostRepository;
import me.zhengjie.modules.project.domain.*;
import me.zhengjie.modules.project.repository.*;
import me.zhengjie.modules.project.service.ProjectCostService;
import me.zhengjie.modules.system.domain.DictDetail;
import me.zhengjie.modules.system.domain.SysGoalSetting;
import me.zhengjie.modules.system.repository.SysGoalSettingRepository;
import me.zhengjie.modules.system.service.SysGoalSettingService;
import me.zhengjie.modules.system.service.dto.SysGoalSettingDto;
import me.zhengjie.modules.system.service.dto.SysGoalSettingQueryCriteria;
import me.zhengjie.modules.task.domain.TaskDailyInterface;
import me.zhengjie.modules.task.domain.TaskDaliy;
import me.zhengjie.modules.task.domain.TaskInterface;
@@ -42,12 +49,6 @@
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.constant.Constant;
import me.zhengjie.modules.project.domain.Project;
import me.zhengjie.modules.project.domain.ProjectCostOther;
import me.zhengjie.modules.project.domain.ProjectCostSummary;
import me.zhengjie.modules.project.domain.ProjectTask;
import me.zhengjie.modules.project.domain.ProjectTaskSummary;
import me.zhengjie.modules.project.domain.ProjectType;
import me.zhengjie.modules.project.service.ProjectService;
import me.zhengjie.modules.project.service.dto.ProjectDto;
import me.zhengjie.modules.project.service.dto.ProjectQueryCriteria;
@@ -97,6 +98,7 @@
    private final ProjectPerformanceDetailRepository projectPerformanceDetailRepository;
    private final CostRepository costRepository;
    private final ContractProjectRepository contractProjectRepository;
    private final SysGoalSettingService sysGoalSettingService;
    @Override
    public Map<String,Object> queryAll(ProjectQueryCriteria criteria, Pageable pageable) {
@@ -116,7 +118,7 @@
                if (totalProjectIdList.size() == 0) {
                    return PageUtil.toPage(Collections.emptyList(), 0);
                }
                criteria.setLiableUserId(userId);
                criteria.setLiableUserId("-" + userId + "-");
            }
        }
@@ -134,11 +136,28 @@
                projectDto.setProjectTypeName(projectType.getName());
                // 判断是否有负责人
                if(projectDto.getLiableUserId() != null) {
                    // 根据负责人ID查询用户信息
                    User user = userRepository.findById(projectDto.getLiableUserId()).orElseGet(User::new);
                    ValidationUtil.isNull(project.getId(),"User","id",projectDto.getLiableUserId());
                    // 负责人名称
                    projectDto.setLiableUserName(user.getNickName());
                    String liableUserName = null;
                    // 负责人ID列表
                    List<Long> liableUserIdList = new ArrayList<>();
                    // 负责人ID
                    String handleLiableUserId = projectDto.getLiableUserId().replace("-", "");
                    // 负责人ID列表
                    String[] handleLiableUserIdList = handleLiableUserId.split(",");
                    // 循环负责人ID列表
                    for (String liableUserId : handleLiableUserIdList) {
                        // 负责人ID列表
                        liableUserIdList.add(Long.valueOf(liableUserId));
                        // 根据负责人ID查询用户信息
                        User user = userRepository.findById(Long.valueOf(liableUserId)).orElseGet(User::new);
                        ValidationUtil.isNull(project.getId(),"User","id",projectDto.getLiableUserId());
                        // 判断负责人名称
                        liableUserName = liableUserName == null ? user.getNickName() : liableUserName + "," + user.getNickName();
                    }
                    // 负责人ID列表
                    projectDto.setLiableUserIdList(liableUserIdList);
                    // 负责人名称
                    projectDto.setLiableUserName(liableUserName);
                }
                ProjectTaskSummary projectTaskSummary = projectTaskRepository.findSummaryByProjectId(project.getId());
@@ -195,7 +214,7 @@
            // 查询用户角色
            List<RoleSmallDto> roleSet = roleService.findByUsersId(userId);
            if (roleSet.stream().anyMatch(role -> DataScopeEnum.find(role.getDataScope()) == DataScopeEnum.THIS_LEVEL)) {
                criteria.setLiableUserId(userId);
                criteria.setLiableUserId("-" + userId + "-");
            }
        }
        return projectMapper.toDto(projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
@@ -220,7 +239,30 @@
            }
            criteria.setIdInList(totalProjectIdList);
        }
        return projectMapper.toDto(projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
        // 项目列表
        List<ProjectDto> projectDtoList = projectMapper.toDto(projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
        // 循环项目列表
        for (int i = 0; i < projectDtoList.size(); i ++) {
            // 项目
            ProjectDto projectDto = projectDtoList.get(i);
            if (projectDto.getLiableUserId() != null && !"".equals(projectDto.getLiableUserId())) {
                // 负责人ID列表
                List<Long> liableUserIdList = new ArrayList<>();
                // 负责人ID
                String handleLiableUserId = projectDto.getLiableUserId().replace("-", "");
                // 负责人ID列表
                String[] handleLiableUserIdList = handleLiableUserId.split(",");
                // 循环负责人ID列表
                for (String liableUserId : handleLiableUserIdList) {
                    // 负责人ID列表
                    liableUserIdList.add(Long.valueOf(liableUserId));
                }
                // 负责人ID列表
                projectDto.setLiableUserIdList(liableUserIdList);
            }
        }
        return projectDtoList;
    }
    @Override
@@ -275,39 +317,58 @@
    @Transactional(rollbackFor = Exception.class)
    public void updateProjectAdmit(Long[] ids){
        for (Long id : ids) {
            // 查询项目
            Project project = projectRepository.findByIdUpdate(id);
            project.setApproveStatus(Constant.APPROVE_STATUS_ACKNOWLEDGED);
            // 更新项目
            update(project);
            List<ProjectTask> list= projectTaskRepository.findByProjectId(id);
            if(list.size()>0){
                for(int i = 0;i<list.size();i++){
            // 查询项目任务
            List<ProjectTask> projectTaskList = projectTaskRepository.findByProjectId(id);
            // 查询任务
            List<Task> taskList = taskRepository.findByProjectId(id);
            // 判断项目任务数量和任务数量
            if(projectTaskList.size() != 0 && taskList.size() == 0) {
                // 从项目任务拷贝到任务中
                for(int i = 0; i < projectTaskList.size(); i++){
                    Task task = new Task();
                    task.setProjectId(list.get(i).getProjectId());
                    task.setName(list.get(i).getName());
                    task.setTaskClassification(list.get(i).getTaskClassification());
                    if(list.get(i).getDescription() != null){
                        task.setDescription(list.get(i).getDescription());
                    task.setProjectId(projectTaskList.get(i).getProjectId());
                    task.setName(projectTaskList.get(i).getName());
                    task.setTaskClassification(projectTaskList.get(i).getTaskClassification());
                    if(projectTaskList.get(i).getDescription() != null){
                        task.setDescription(projectTaskList.get(i).getDescription());
                    }
                    task.setPlanHours(list.get(i).getPlanHours());
                    if(list.get(i).getPlanWorkload()!=null){
                        task.setPlanWorkload(list.get(i).getPlanWorkload());
                    task.setPlanHours(projectTaskList.get(i).getPlanHours());
                    if(projectTaskList.get(i).getPlanWorkload() != null){
                        task.setPlanWorkload(projectTaskList.get(i).getPlanWorkload());
                    }
                    if(list.get(i).getPlanWorkloadUnit() != null){
                        task.setPlanWorkloadUnit(list.get(i).getPlanWorkloadUnit());
                    if(projectTaskList.get(i).getPlanWorkloadUnit() != null){
                        task.setPlanWorkloadUnit(projectTaskList.get(i).getPlanWorkloadUnit());
                    }
                    if(list.get(i).getRemarks() != null ){
                        task.setRemarks(list.get(i).getRemarks());
                    if(projectTaskList.get(i).getRemarks() != null ){
                        task.setRemarks(projectTaskList.get(i).getRemarks());
                    }
                    task.setPriority(Constant.PRIORITY_LOW);
                    // 绩效区分
                    task.setPerformanceType(list.get(i).getPerformanceType());
                    task.setPerformanceType(projectTaskList.get(i).getPerformanceType());
                    // 未开始
                    task.setTaskStatus(Constant.TASK_STATUS_NOT_STARTED);
                    task.setPlanStartTime(list.get(i).getPlanStartTime());
                    task.setPlanEndTime(list.get(i).getPlanEndTime());
                    task.setPlanStartTime(projectTaskList.get(i).getPlanStartTime());
                    task.setPlanEndTime(projectTaskList.get(i).getPlanEndTime());
                    taskRepository.save(task);
                }
            }
        }
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateProjectDisavow(Long[] ids){
        for (Long id : ids) {
            // 查询项目
            Project project = projectRepository.findByIdUpdate(id);
            project.setApproveStatus(Constant.APPROVE_STATUS_UNRECOGNIZED);
            // 更新项目
            update(project);
        }
    }
@@ -320,7 +381,23 @@
            String projectStatus = project.getProjectStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PROJECT_STATUS, project.getProjectStatus()).getLabel() : "";
            String approveStatus = project.getApproveStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.APPROVE_STATUS, project.getApproveStatus()).getLabel() : "";
            String unitCurrency = project.getUnitCurrency() != null ? dictDetailRepository.findByDictNameAndValue(Constant.STANDARD_UNIT_CURRENCY, project.getUnitCurrency()).getLabel() : "";
            String getLiableUser = project.getLiableUserId() != null ? userRepository.findById(project.getLiableUserId()).orElseGet(User::new).getNickName() : "";
            // 负责人名称
            String liableUserName = null;
            if (project.getLiableUserId() != null && !"".equals(project.getLiableUserId())) {
                // 处理后负责人ID
                String handleLiableUserId = project.getLiableUserId().replace("-", "");
                // 处理后负责人ID列表
                String[] handleLiableUserIdList = handleLiableUserId.split(",");
                // 循环处理后负责人ID列表
                for (String liableUserId : handleLiableUserIdList) {
                    // 根据负责人ID查询用户信息
                    User user = userRepository.findById(Long.valueOf(liableUserId)).orElseGet(User::new);
                    // 判断负责人名称
                    liableUserName = liableUserName == null ? user.getNickName() : liableUserName + "," + user.getNickName();
                }
            }
            Map<String,Object> map = new LinkedHashMap<>();
            map.put("名称", project.getName());
            map.put("项目类型",projectTypeName);
@@ -330,7 +407,7 @@
            // TODO
//            map.put("单价金额", project.getUnitPrice());
//            map.put("报价金额", project.getTotalPrice());
            map.put("责任人", getLiableUser);
            map.put("责任人", liableUserName);
            map.put("计划开始日期", project.getPlanStartDate());
            map.put("计划结束日期", project.getPlanEndDate());
            map.put("项目状态", projectStatus);
@@ -357,4 +434,58 @@
        criteria.setIdInList(partakeProjectIds);
        return projectMapper.toDto(projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
    }
    @Override
    public List<Map<String, Object>> querySubgroupTurnover(ProjectQueryCriteria criteria){
        // 根据字典名称查询
        List<DictDetail> dictDetailList = dictDetailRepository.findByDictName(Constant.PROJECT_DISTINGUISH);
        // 根据目标年份查询分组营业额
        List<ProjectSummary> projectSummaryList = projectRepository.findSubgroupTurnoverByTargetYear(criteria.getTargetYear());
        // 根据目标年份查询分组目标金额
        SysGoalSettingQueryCriteria sysGoalSettingQueryCriteria = new SysGoalSettingQueryCriteria();
        sysGoalSettingQueryCriteria.setTargetYear(criteria.getTargetYear());
        List<SysGoalSettingDto> sysGoalSettingDtoList = sysGoalSettingService.queryAll(sysGoalSettingQueryCriteria);
        // 返回列表
        List<Map<String, Object>> returnList = new ArrayList<>();
        // 循环项目区分
        for (int i = 0; i < dictDetailList.size(); i ++) {
            // 返回集合
            Map<String, Object> returnMap = new HashMap<>();
            // 当前项目区分
            DictDetail dictDetail = dictDetailList.get(i);
            // 返回集合
            returnMap.put("projectDistinguish", dictDetail.getLabel());
            // 循环分组营业额
            for (int j = 0; j < projectSummaryList.size(); j ++) {
                // 判断与项目区分是否一致
                if (dictDetail.getValue().equals(projectSummaryList.get(j).getProjectDistinguish())) {
                    // 返回集合
                    returnMap.put("contractPrice", projectSummaryList.get(j).getContractPrice());
                    break;
                }
                // 判断循环是否结束
                if (j == projectSummaryList.size() - 1) {
                    // 返回集合
                    returnMap.put("contractPrice", new BigDecimal(0));
                }
            }
            // 循环分组目标金额
            for (int j = 0; j < sysGoalSettingDtoList.size(); j ++) {
                // 判断与项目区分是否一致
                if (dictDetail.getValue().equals(sysGoalSettingDtoList.get(j).getProjectDistinguish())) {
                    // 返回集合
                    returnMap.put("targetAmount", sysGoalSettingDtoList.get(j).getTargetAmount());
                    break;
                }
                // 判断循环是否结束
                if (j == sysGoalSettingDtoList.size() - 1) {
                    // 返回集合
                    returnMap.put("targetAmount", new BigDecimal(0));
                }
            }
            // 返回列表
            returnList.add(returnMap);
        }
        return returnList;
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/impl/SalaryServiceImpl.java
@@ -598,7 +598,7 @@
        taskDaliyQueryCriteria.setUserId(userId);
        taskDaliyQueryCriteria.setTargetYearMonth(targetYearMonth);
        // 查询某月已完成工时
        Double completedWork = taskDaliyService.queryCompletedWork(taskDaliyQueryCriteria);
        Double completedWork = taskDaliyService.queryCompletedWork(taskDaliyQueryCriteria, false);
        // 已完成绩效工时
        salary.setAlreadyCompletedAchievementsHours(completedWork);
        // 已完成业绩工时
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysGoalSetting.java
New file
@@ -0,0 +1,69 @@
/*
*  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.system.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.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2023-03-21
**/
@Entity
@Data
@Table(name="sys_goal_setting")
public class SysGoalSetting extends BaseEntity implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "ID")
    private Long id;
    @Column(name = "`target_year`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "目标年度")
    private Timestamp targetYear;
    @Column(name = "`project_distinguish`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "项目区分")
    private String projectDistinguish;
    @Column(name = "`target_amount`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "目标金额")
    private BigDecimal targetAmount;
    @Column(name = "`remarks`")
    @ApiModelProperty(value = "备注")
    private String remarks;
    public void copy(SysGoalSetting source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysGoalSettingRepository.java
New file
@@ -0,0 +1,28 @@
/*
*  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.system.repository;
import me.zhengjie.modules.system.domain.SysGoalSetting;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-03-21
**/
public interface SysGoalSettingRepository extends JpaRepository<SysGoalSetting, Long>, JpaSpecificationExecutor<SysGoalSetting> {
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysGoalSettingController.java
New file
@@ -0,0 +1,95 @@
/*
*  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.system.rest;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.system.domain.SysGoalSetting;
import me.zhengjie.modules.system.service.SysGoalSettingService;
import me.zhengjie.modules.system.service.dto.SysGoalSettingQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-03-21
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "目标设定管理")
@RequestMapping("/api/sysGoalSetting")
public class SysGoalSettingController {
    private final SysGoalSettingService sysGoalSettingService;
    @Log("导出数据")
    @ApiOperation("导出数据")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('sysGoalSetting:download')")
    public void exportSysGoalSetting(HttpServletResponse response, SysGoalSettingQueryCriteria criteria) throws IOException {
        sysGoalSettingService.download(sysGoalSettingService.queryAll(criteria), response);
    }
    @GetMapping
    @Log("查询目标设定")
    @ApiOperation("查询目标设定")
    @PreAuthorize("@el.check('sysGoalSetting:list')")
    public ResponseEntity<Object> querySysGoalSetting(SysGoalSettingQueryCriteria criteria, Pageable pageable){
        return new ResponseEntity<>(sysGoalSettingService.queryAll(criteria,pageable),HttpStatus.OK);
    }
    @GetMapping(value = "/all")
    @Log("查询目标设定")
    @ApiOperation("查询目标设定")
    @PreAuthorize("@el.check('sysGoalSetting:list')")
    public ResponseEntity<Object> querySysGoalSetting(SysGoalSettingQueryCriteria criteria){
        return new ResponseEntity<>(sysGoalSettingService.queryAll(criteria),HttpStatus.OK);
    }
    @PostMapping
    @Log("新增目标设定")
    @ApiOperation("新增目标设定")
    @PreAuthorize("@el.check('sysGoalSetting:add')")
    public ResponseEntity<Object> createSysGoalSetting(@Validated @RequestBody SysGoalSetting resources) throws Exception{
        return new ResponseEntity<>(sysGoalSettingService.create(resources),HttpStatus.CREATED);
    }
    @PutMapping
    @Log("修改目标设定")
    @ApiOperation("修改目标设定")
    @PreAuthorize("@el.check('sysGoalSetting:edit')")
    public ResponseEntity<Object> updateSysGoalSetting(@Validated @RequestBody SysGoalSetting resources) throws Exception{
        sysGoalSettingService.update(resources);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    @DeleteMapping
    @Log("删除目标设定")
    @ApiOperation("删除目标设定")
    @PreAuthorize("@el.check('sysGoalSetting:del')")
    public ResponseEntity<Object> deleteSysGoalSetting(@RequestBody Long[] ids) {
        sysGoalSettingService.deleteAll(ids);
        return new ResponseEntity<>(HttpStatus.OK);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysGoalSettingService.java
New file
@@ -0,0 +1,83 @@
/*
*  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.system.service;
import me.zhengjie.modules.system.domain.SysGoalSetting;
import me.zhengjie.modules.system.service.dto.SysGoalSettingDto;
import me.zhengjie.modules.system.service.dto.SysGoalSettingQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务接口
* @author 赵士淞
* @date 2023-03-21
**/
public interface SysGoalSettingService {
    /**
    * 查询数据分页
    * @param criteria 条件
    * @param pageable 分页参数
    * @return Map<String,Object>
    */
    Map<String,Object> queryAll(SysGoalSettingQueryCriteria criteria, Pageable pageable);
    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<SysGoalSettingDto>
    */
    List<SysGoalSettingDto> queryAll(SysGoalSettingQueryCriteria criteria);
    /**
     * 根据ID查询
     * @param id ID
     * @return SysGoalSettingDto
     */
    SysGoalSettingDto findById(Long id);
    /**
    * 创建
    * @param resources /
    * @return SysGoalSettingDto
    */
    SysGoalSettingDto create(SysGoalSetting resources) throws Exception;
    /**
    * 编辑
    * @param resources /
    */
    void update(SysGoalSetting resources) throws Exception;
    /**
    * 多选删除
    * @param ids /
    */
    void deleteAll(Long[] ids);
    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<SysGoalSettingDto> all, HttpServletResponse response) throws IOException;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysGoalSettingDto.java
New file
@@ -0,0 +1,48 @@
/*
*  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.system.service.dto;
import lombok.Data;
import me.zhengjie.base.BaseDTO;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2023-03-21
**/
@Data
public class SysGoalSettingDto extends BaseDTO implements Serializable {
    /** ID */
    private Long id;
    /** 目标年度 */
    private Timestamp targetYear;
    /** 项目区分 */
    private String projectDistinguish;
    /** 目标金额 */
    private BigDecimal targetAmount;
    /** 备注 */
    private String remarks;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysGoalSettingQueryCriteria.java
New file
@@ -0,0 +1,38 @@
/*
*  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.system.service.dto;
import lombok.Data;
import java.sql.Timestamp;
import java.util.List;
import me.zhengjie.annotation.Query;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-03-21
**/
@Data
public class SysGoalSettingQueryCriteria{
    /** 精确 */
    @Query(type = Query.Type.INNER_LIKE)
    private String targetYear;
    /** 精确 */
    @Query
    private String projectDistinguish;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysGoalSettingServiceImpl.java
New file
@@ -0,0 +1,144 @@
/*
*  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.system.service.impl;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.constant.Constant;
import me.zhengjie.modules.system.domain.SysGoalSetting;
import me.zhengjie.modules.system.repository.DictDetailRepository;
import me.zhengjie.utils.*;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.system.repository.SysGoalSettingRepository;
import me.zhengjie.modules.system.service.SysGoalSettingService;
import me.zhengjie.modules.system.service.dto.SysGoalSettingDto;
import me.zhengjie.modules.system.service.dto.SysGoalSettingQueryCriteria;
import me.zhengjie.modules.system.service.mapstruct.SysGoalSettingMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author 赵士淞
* @date 2023-03-21
**/
@Service
@RequiredArgsConstructor
public class SysGoalSettingServiceImpl implements SysGoalSettingService {
    private final SysGoalSettingRepository sysGoalSettingRepository;
    private final SysGoalSettingMapper sysGoalSettingMapper;
    private final DictDetailRepository dictDetailRepository;
    @Override
    public Map<String,Object> queryAll(SysGoalSettingQueryCriteria criteria, Pageable pageable){
        // 判断目标查询类目标年度是否为空
        if (criteria.getTargetYear() != null && !"".equals(criteria.getTargetYear())) {
            // 目标年度:国际时间转中国时间
            criteria.setTargetYear(DateUtil.internationalTimeToChinaTime(criteria.getTargetYear()));
        }
        Page<SysGoalSetting> page = sysGoalSettingRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
        return PageUtil.toPage(page.map(sysGoalSettingMapper::toDto));
    }
    @Override
    public List<SysGoalSettingDto> queryAll(SysGoalSettingQueryCriteria criteria){
        return sysGoalSettingMapper.toDto(sysGoalSettingRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
    }
    @Override
    @Transactional
    public SysGoalSettingDto findById(Long id) {
        SysGoalSetting sysGoalSetting = sysGoalSettingRepository.findById(id).orElseGet(SysGoalSetting::new);
        ValidationUtil.isNull(sysGoalSetting.getId(),"SysGoalSetting","id",id);
        return sysGoalSettingMapper.toDto(sysGoalSetting);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public SysGoalSettingDto create(SysGoalSetting resources) throws Exception {
        createOrUpdateCheck(resources);
        return sysGoalSettingMapper.toDto(sysGoalSettingRepository.save(resources));
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void update(SysGoalSetting resources) throws Exception {
        SysGoalSetting sysGoalSetting = sysGoalSettingRepository.findById(resources.getId()).orElseGet(SysGoalSetting::new);
        ValidationUtil.isNull( sysGoalSetting.getId(),"SysGoalSetting","id",resources.getId());
        sysGoalSetting.copy(resources);
        createOrUpdateCheck(sysGoalSetting);
        sysGoalSettingRepository.save(sysGoalSetting);
    }
    @Override
    public void deleteAll(Long[] ids) {
        for (Long id : ids) {
            sysGoalSettingRepository.deleteById(id);
        }
    }
    @Override
    public void download(List<SysGoalSettingDto> all, HttpServletResponse response) throws IOException {
        List<Map<String, Object>> list = new ArrayList<>();
        for (SysGoalSettingDto sysGoalSetting : all) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
            String targetYear = sdf.format(sysGoalSetting.getTargetYear());
            String projectDistinguish = sysGoalSetting.getProjectDistinguish() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PROJECT_DISTINGUISH, sysGoalSetting.getProjectDistinguish()).getLabel() : "";
            Map<String,Object> map = new LinkedHashMap<>();
            map.put("目标年度", targetYear);
            map.put("项目区分", projectDistinguish);
            map.put("目标金额", sysGoalSetting.getTargetAmount());
            map.put("备注", sysGoalSetting.getRemarks());
            map.put("创建者", sysGoalSetting.getCreateBy());
            map.put("创建时间", sysGoalSetting.getCreateTime());
            map.put("更新者", sysGoalSetting.getUpdateBy());
            map.put("更新时间", sysGoalSetting.getUpdateTime());
            list.add(map);
        }
        FileUtil.downloadExcel(list, response);
    }
    private void createOrUpdateCheck(SysGoalSetting resources) throws Exception {
        // 日期格式化
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String targetYear = sdf.format(resources.getTargetYear());
        // 目标检索类
        SysGoalSettingQueryCriteria criteria = new SysGoalSettingQueryCriteria();
        criteria.setTargetYear(DateUtil.internationalTimeToChinaTime(targetYear));
        criteria.setProjectDistinguish(resources.getProjectDistinguish());
        // 查询目标数据
        List<SysGoalSettingDto> sysGoalSettingDtoList = queryAll(criteria);
        // 判断目标数据
        if (sysGoalSettingDtoList.size() > 1) {
            throw new BadRequestException("目标年度已有此项目区分数据!");
        } else if (sysGoalSettingDtoList.size() == 1) {
            if (sysGoalSettingDtoList.get(0).getId() != resources.getId()) {
                throw new BadRequestException("目标年度已有此项目区分数据!");
            }
        }
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
@@ -41,6 +41,8 @@
import me.zhengjie.modules.system.service.mapstruct.UserMapper;
import me.zhengjie.modules.task.domain.TaskDaliy;
import me.zhengjie.modules.task.repository.TaskDaliyRepository;
import me.zhengjie.modules.task.service.TaskDaliyService;
import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria;
import me.zhengjie.utils.*;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.cache.annotation.CacheConfig;
@@ -95,6 +97,7 @@
    private final AttendanceGoOutRepository attendanceGoOutRepository;
    private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository;
    private final SysCompanyRepository sysCompanyRepository;
    private final TaskDaliyService taskDaliyService;
    @Override
    public Object queryAll(UserQueryCriteria criteria, Pageable pageable) {
@@ -486,6 +489,16 @@
            bussTimes = bussTimes + attendanceBusinessTravel.getTravelDuration();
        }
        returnData.put("Times", attCheckOnDuration + attCheckOffDuration + goOutTimes + (bussTimes * 8));
        // 任务日报查询类
        TaskDaliyQueryCriteria taskDaliyQueryCriteria = new TaskDaliyQueryCriteria();
        taskDaliyQueryCriteria.setUserId(userId);
        taskDaliyQueryCriteria.setTargetYearMonth(baseDate);
        // 查询某月已完成工时
        Double completedWork = taskDaliyService.queryCompletedWork(taskDaliyQueryCriteria, true);
        // 月初到今天绩效时长
        returnData.put("achievementsTime", completedWork);
        return returnData;
    }
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysGoalSettingMapper.java
New file
@@ -0,0 +1,32 @@
/*
*  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.system.service.mapstruct;
import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.system.domain.SysGoalSetting;
import me.zhengjie.modules.system.service.dto.SysGoalSettingDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-03-21
**/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SysGoalSettingMapper extends BaseMapper<SysGoalSettingDto, SysGoalSetting> {
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/rest/TaskDaliyController.java
@@ -106,7 +106,7 @@
    @ApiOperation("查询某月已完成工时")
    @PreAuthorize("@el.check('taskDaliy:list')")
    public ResponseEntity<Object> queryCompletedWork(TaskDaliyQueryCriteria criteria){
        return new ResponseEntity<>(taskDaliyService.queryCompletedWork(criteria),HttpStatus.OK);
        return new ResponseEntity<>(taskDaliyService.queryCompletedWork(criteria, false),HttpStatus.OK);
    }
    @GetMapping(value = "/taskTotalConsumedHours")
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/TaskDaliyService.java
@@ -94,7 +94,7 @@
     * @param criteria 条件参数
     * @return List<TaskDaliyDto>
     */
    Double queryCompletedWork(TaskDaliyQueryCriteria criteria);
    Double queryCompletedWork(TaskDaliyQueryCriteria criteria, Boolean readOnly);
    /**
     * 查询某月已完成工时
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskDto.java
@@ -87,6 +87,9 @@
    /** 项目名称 */
    private String projectName;
    /** 项目责任人ID */
    private List<Long> projectLiableUserIdList;
    /** 父任务名称 */
    private String pidName;
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskUserDto.java
@@ -70,6 +70,9 @@
    /** 项目名称 */
    private String projectName;
    /** 项目责任人ID */
    private List<Long> projectLiableUserIdList;
    /** 任务名称 */
    private String taskName;
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskUserQueryCriteria.java
@@ -58,4 +58,7 @@
    /** 包含 */
    @Query(propName = "projectId", type = Query.Type.IN)
    private List<Long> projectIdInList;
    @Query(type = Query.Type.BETWEEN)
    private List<Timestamp> createTime;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskDaliyServiceImpl.java
@@ -400,7 +400,7 @@
    }
    @Override
    public Double queryCompletedWork(TaskDaliyQueryCriteria criteria){
    public Double queryCompletedWork(TaskDaliyQueryCriteria criteria, Boolean readOnly){
        // 已完成工时
        Double completedWork = 0D;
        // 国际时间转中国时间
@@ -462,6 +462,8 @@
                        completedWork += taskDaliyDay.getConsumedHours();
                    }
                    // 是否只读
                    if (!readOnly) {
                    // 本日任务日报
                    taskDaliyDay.setSettlementStatus(Constant.SETTLEMENT_STATUS_SETTLED);
                    // 保存本日任务日报
@@ -469,6 +471,7 @@
                }
            }
        }
        }
        // 请假检索类
        AttendanceLeaveQueryCriteria attendanceLeaveQueryCriteria = new AttendanceLeaveQueryCriteria();
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskServiceImpl.java
@@ -112,6 +112,22 @@
        ValidationUtil.isNull(project.getId(),"Project","id",taskDto.getProjectId());
        // 项目名称
        taskDto.setProjectName(project.getName());
        if (project.getLiableUserId() != null && !"".equals(project.getLiableUserId())) {
            // 负责人ID列表
            List<Long> projectLiableUserIdList = new ArrayList<>();
            // 项目责任人ID
            String projectLiableUserId = project.getLiableUserId().replace("-", "");
            String[] projectLiableUserIds = projectLiableUserId.split(",");
            // 循环负责人ID列表
            for (String liableUserId : projectLiableUserIds) {
                // 负责人ID列表
                projectLiableUserIdList.add(Long.valueOf(liableUserId));
            }
            // 项目责任人ID
            taskDto.setProjectLiableUserIdList(projectLiableUserIdList);
        }
        // 判断父级任务ID是否为空
        if (taskDto.getPid() != null) {
            // 根据父级任务ID查询任务信息
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskUserServiceImpl.java
@@ -120,6 +120,22 @@
                ValidationUtil.isNull(project.getId(),"Project","id",taskUserDto.getProjectId());
                // 项目名称
                taskUserDto.setProjectName(project.getName());
                if (project.getLiableUserId() != null && !"".equals(project.getLiableUserId())) {
                    // 负责人ID列表
                    List<Long> projectLiableUserIdList = new ArrayList<>();
                    // 项目责任人ID
                    String projectLiableUserId = project.getLiableUserId().replace("-", "");
                    String[] projectLiableUserIds = projectLiableUserId.split(",");
                    // 循环负责人ID列表
                    for (String liableUserId : projectLiableUserIds) {
                        // 负责人ID列表
                        projectLiableUserIdList.add(Long.valueOf(liableUserId));
                    }
                    // 项目责任人ID
                    taskUserDto.setProjectLiableUserIdList(projectLiableUserIdList);
                }
                // 根据任务ID查询任务信息
                Task task = taskRepository.findById(taskUserDto.getTaskId()).orElseGet(Task::new);
                ValidationUtil.isNull(task.getId(),"Task","id",taskUserDto.getTaskId());
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/temp/Temp.java
New file
@@ -0,0 +1,48 @@
package me.zhengjie.modules.temp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.annotation.rest.AnonymousPutMapping;
import me.zhengjie.modules.project.domain.Project;
import me.zhengjie.modules.project.repository.ProjectRepository;
import me.zhengjie.modules.project.repository.ProjectTypeRepository;
import me.zhengjie.modules.project.service.ProjectService;
import me.zhengjie.modules.project.service.dto.ProjectDto;
import me.zhengjie.modules.project.service.dto.ProjectQueryCriteria;
import me.zhengjie.modules.project.service.mapstruct.ProjectMapper;
import me.zhengjie.utils.QueryHelp;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequiredArgsConstructor
@Api(tags = "临时接口")
@RequestMapping("/api/temp")
public class Temp {
    private final ProjectRepository projectRepository;
    @AnonymousPutMapping(value = "/updateProjectLiableUserId")
    @Log("修改项目责任人ID")
    @ApiOperation("修改项目责任人ID")
    public ResponseEntity<Object> updateProjectLiableUserId(){
        ProjectQueryCriteria criteria = new ProjectQueryCriteria();
        List<Project> projectList = projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder));
        for (int i = 0; i < projectList.size(); i ++) {
            Project project = projectList.get(i);
            if (project.getLiableUserId() != null && !"".equals(project.getLiableUserId())) {
                project.setLiableUserId("-" + project.getLiableUserId() + "-");
                projectRepository.save(project);
            }
        }
        return new ResponseEntity<>("", HttpStatus.OK);
    }
}
eladmin-web-master/src/api/project/project.js
@@ -40,6 +40,14 @@
  })
}
export function editDisavow(ids) {
  return request({
    url: 'api/project/disavow',
    method: 'put',
    data: ids
  })
}
export function getPartake(params) {
  return request({
    url: 'api/project/partake',
@@ -56,4 +64,12 @@
  })
}
export default { getAll, add, edit, del, editAdmit, getPartake, getRelevant }
export function getSubgroupTurnover(params) {
  return request({
    url: 'api/project/subgroupTurnover',
    method: 'get',
    params
  })
}
export default { getAll, add, edit, del, editAdmit, editDisavow, getPartake, getRelevant, getSubgroupTurnover }
eladmin-web-master/src/api/system/goalSetting.js
New file
@@ -0,0 +1,35 @@
import request from '@/utils/request'
export function getAll(params) {
  return request({
    url: 'api/sysGoalSetting/all',
    method: 'get',
    params
  })
}
export function add(data) {
  return request({
    url: 'api/sysGoalSetting',
    method: 'post',
    data
  })
}
export function del(ids) {
  return request({
    url: 'api/sysGoalSetting/',
    method: 'delete',
    data: ids
  })
}
export function edit(data) {
  return request({
    url: 'api/sysGoalSetting',
    method: 'put',
    data
  })
}
export default { getAll, add, edit, del }
eladmin-web-master/src/components/Crud/crud.js
@@ -531,6 +531,19 @@
      })
    },
    /**
     * 年份格式化
     * @param {Object} timestamp 时间戳
     */
    toYear(timestamp) {
      if (timestamp == null) {
        return
      } else {
        const system = new Date(timestamp)
        const year = system.getFullYear()
        return year
      }
    },
    /**
     * 年月格式化
     * @param {Object} timestamp 时间戳
     */
eladmin-web-master/src/views/dashboard/PanelGroup.vue
@@ -63,9 +63,7 @@
          <div class="card-panel-text">
            当月绩效时长
          </div>
          <count-to :start-val="0" :end-val="userInfo.Times" :decimals="2" :duration="3600" class="card-panel-num" />
          <span class="card-panel-texts">/</span>
          <count-to :start-val="0" :end-val="userInfo.Time" :duration="3600" class="card-panel-num" />
          <count-to :start-val="0" :end-val="userInfo.achievementsTime" :decimals="2" :duration="3600" class="card-panel-num" />
        </div>
      </div>
    </el-col>
eladmin-web-master/src/views/project/chart/subgroupTurnover.vue
New file
@@ -0,0 +1,125 @@
<template>
  <div :class="className" :style="{ height: height, width: width }" />
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import { debounce } from '@/utils'
import crudProject from '@/api/project/project'
export default {
  props: {
    className: {
      type: String,
      default: 'chart'
    },
    width: {
      type: String,
      default: '100%'
    },
    height: {
      type: String,
      default: '400px'
    },
    targetYear: {
      type: String,
      default: null
    }
  },
  data() {
    return {
      chart: null
    }
  },
  mounted() {
    this.initChart()
    this.__resizeHandler = debounce(() => {
      if (this.chart) {
        this.chart.resize()
      }
    }, 100)
    window.addEventListener('resize', this.__resizeHandler)
  },
  beforeDestroy() {
    if (!this.chart) {
      return
    }
    window.removeEventListener('resize', this.__resizeHandler)
    this.chart.dispose()
    this.chart = null
  },
  methods: {
    initChart() {
      this.chart = echarts.init(this.$el, 'macarons')
      crudProject.getSubgroupTurnover({ targetYear: this.targetYear }).then(res => {
        // 图表项目区分类目
        const projectDistinguishData = []
        // 图表营业额类目
        const contractPriceData = []
        // 图表目标金额类目
        const targetAmountData = []
        // 遍历资产收入数据
        for (let i = 0; i < res.length; i++) {
          // 图表项目区分类目
          projectDistinguishData.push(res[i].projectDistinguish)
          // 图表营业额类目
          contractPriceData.push(res[i].contractPrice)
          // 图表目标金额类目
          targetAmountData.push(res[i].targetAmount)
        }
        this.chart.setOption({
          title: {
            text: '项目区分营业额与目标金额对比',
            subtext: '',
            left: 'left'
          },
          tooltip: {
            trigger: 'axis',
            axisPointer: {
              type: 'shadow'
            }
          },
          legend: {
            data: ['营业额', '目标金额'],
            right: '10%'
          },
          xAxis: [
            {
              type: 'category',
              axisTick: { show: false },
              data: projectDistinguishData
            }
          ],
          yAxis: [
            {
              type: 'value'
            }
          ],
          series: [
            {
              name: '营业额',
              type: 'bar',
              barGap: 0,
              emphasis: {
                focus: 'series'
              },
              data: contractPriceData
            },
            {
              name: '目标金额',
              type: 'bar',
              emphasis: {
                focus: 'series'
              },
              data: targetAmountData
            }
          ]
        })
      })
    }
  }
}
</script>
eladmin-web-master/src/views/project/index.vue
New file
@@ -0,0 +1,86 @@
<template>
  <div class="dashboard-container">
    <div class="dashboard-editor-container">
      <el-row :gutter="32">
        <el-col :xs="24" :sm="24" :lg="12">
          <div class="chart-wrapper">
            <div class="wrapper-div">
              <el-date-picker v-model="stTargetYear" type="year" clearable placeholder="目标年度" style="width: 185px;" @change="stTargetYearChange" />
            </div>
            <subgroup-turnover :key="stRandom" :target-year="stParameter" />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="12">
          <div class="chart-wrapper" />
        </el-col>
      </el-row>
    </div>
  </div>
</template>
<script>
import SubgroupTurnover from './chart/subgroupTurnover.vue'
export default {
  name: 'ProjectChart',
  components: { SubgroupTurnover },
  data() {
    return {
      // 目标年度
      stTargetYear: new Date(),
      // 随机数
      stRandom: 0,
      // 传参
      stParameter: new Date().getFullYear().toString()
    }
  },
  created() {
  },
  methods: {
    // 目标年度变更
    stTargetYearChange() {
      // 传参
      this.stParameter = this.stTargetYear.getFullYear().toString()
      // 随机数
      this.stRandom = Math.random()
    }
  }
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
  .dashboard-editor-container {
    padding: 32px;
    position: relative;
    .github-corner {
      position: absolute;
      top: 0;
      border: 0;
      right: 0;
    }
    .search-wrapper {
      text-align: right;
    }
    .chart-wrapper {
      background: #fff;
      padding: 16px 16px 0;
      margin-bottom: 32px;
      overflow: auto;
      .wrapper-div {
        text-align: right;
        margin: 0px 15px 15px 15px ;
      }
    }
  }
  @media (max-width:1024px) {
    .chart-wrapper {
      padding: 8px;
    }
  }
</style>
eladmin-web-master/src/views/project/project/index.vue
@@ -55,10 +55,21 @@
          class="filter-item"
          size="mini"
          type="primary"
          icon="el-icon-share"
          icon="el-icon-check"
          :disabled="crud.selections.length === 0"
          @click="projectAdmit(crud.selections)"
        >承认</el-button>
        <el-button
          slot="right"
          v-permission="permission.admit"
          class="filter-item"
          size="mini"
          type="primary"
          icon="el-icon-close"
          :disabled="crud.selections.length === 0"
          style="margin-left: 4px !important;"
          @click="projectDisavow(crud.selections)"
        >未承认</el-button>
        <el-button
          slot="right"
          v-permission="permission.seeTask"
@@ -169,7 +180,7 @@
            <el-date-picker v-model="form.planEndDate" type="date" :picker-options="pickerOptionsEnd" placeholder="选择日期" style="width: 200px;" />
          </el-form-item>
          <el-form-item label="责任人">
            <el-select v-model="form.liableUserId" clearable filterable placeholder="请选择" style="width: 200px;">
            <el-select v-model="form.liableUserIdList" clearable filterable multiple placeholder="请选择" style="width: 200px;">
              <el-option
                v-for="item in userList"
                :key="item.id"
@@ -324,7 +335,7 @@
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" width="140" />
        <el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建时间" width="140" />
        <el-table-column v-if="checkPer(['admin','project:edit','project:del'])" label="操作" width="180px" align="center" fixed="right">
        <el-table-column v-if="checkPer(['admin','project:edit','project:del'])" label="操作" width="210px" align="center" fixed="right">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
@@ -332,7 +343,7 @@
            >
              <el-popover
                slot="left"
                :ref="`popover_${scope.row.id}`"
                :ref="`admit_${scope.row.id}`"
                v-permission="permission.admit"
                width="160"
                placement="top"
@@ -342,7 +353,21 @@
                  <el-button size="mini" type="text" @click="canel(scope.row)">取消</el-button>
                  <el-button type="primary" size="mini" @click="projectAdmit(scope.row)">确定</el-button>
                </div>
                <el-button slot="reference" type="primary" icon="el-icon-share" size="mini" />
                <el-button slot="reference" type="primary" icon="el-icon-check" size="mini" />
              </el-popover>
              <el-popover
                slot="left"
                :ref="`disavow_${scope.row.id}`"
                v-permission="permission.admit"
                width="170"
                placement="top"
              >
                <p>确定未承认此项目吗?</p>
                <div style="text-align: right; margin: 0">
                  <el-button size="mini" type="text" @click="canel(scope.row)">取消</el-button>
                  <el-button type="primary" size="mini" @click="projectDisavow(scope.row)">确定</el-button>
                </div>
                <el-button slot="reference" type="primary" icon="el-icon-close" size="mini" style="margin-left: 3px;" />
              </el-popover>
            </udOperation>
          </template>
@@ -367,7 +392,7 @@
import moneyInput from '@/views/assembly/moneyInput/index.vue'
import constant from '@/utils/constant'
const defaultForm = { id: null, name: null, projectTypeId: null, projectDistinguish: null, requirement: null, unitCurrency: null, performanceObjectives: null, quotationPrice: null, performancePrice: null, contractPrice: null, liableUserId: null, planStartDate: null, planEndDate: null, projectStatus: null, approveStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
const defaultForm = { id: null, name: null, projectTypeId: null, projectDistinguish: null, requirement: null, unitCurrency: null, performanceObjectives: null, quotationPrice: null, performancePrice: null, contractPrice: null, liableUserId: null, liableUserIdList: [], planStartDate: null, planEndDate: null, projectStatus: null, approveStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
export default {
  name: 'Project',
  components: { pagination, crudOperation, rrOperation, udOperation, moneyInput },
@@ -557,7 +582,8 @@
    },
    // 取消
    canel(data) {
      this.$refs[`popover_${data.id}`].showPopper = false
      this.$refs[`admit_${data.id}`].showPopper = false
      this.$refs[`disavow_${data.id}`].showPopper = false
    },
    // 项目承认
    projectAdmit(row) {
@@ -565,7 +591,7 @@
      this.ids = []
      // 判断是多个项目承认还是单个项目承认
      if (row.id !== undefined) {
        this.$refs[`popover_${row.id}`].showPopper = false
        this.$refs[`admit_${row.id}`].showPopper = false
        // 选中的id
        this.ids.push(row.id)
        // 项目承认
@@ -607,6 +633,54 @@
        })
      }
    },
    // 项目未承认
    projectDisavow(row) {
      // 选中的id
      this.ids = []
      // 判断是多个项目未承认还是单个项目未承认
      if (row.id !== undefined) {
        this.$refs[`disavow_${row.id}`].showPopper = false
        // 选中的id
        this.ids.push(row.id)
        // 项目未承认
        crudProject.editDisavow(this.ids).then(res => {
          // 刷新数据
          this.crud.refresh()
        })
      } else {
        // 确认框
        this.$confirm('此操作将未承认' + row.length + '个项目, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'success'
        }).then(() => {
          // 循环选中数据
          for (let i = 0; i < row.length; i++) {
            // 选中的id
            this.ids.push(row[i].id)
            // 判断循环是否结束
            if (i === row.length - 1) {
              // 项目承认
              crudProject.editDisavow(this.ids).then(res => {
                // 消息提示
                this.$message({
                  type: 'success',
                  message: '项目未承认!'
                })
                // 刷新数据
                this.crud.refresh()
              })
            }
          }
        }).catch(() => {
          // 消息提示
          this.$message({
            type: 'info',
            message: '已取消项目未承认'
          })
        })
      }
    },
    // 查看任务
    toSeeTask(data) {
      // 跳转页面
@@ -636,6 +710,16 @@
          projectId: data.id
        }
      })
    },
    // 钩子:提交 - 之前
    [CRUD.HOOK.beforeSubmit]() {
      // 责任人ID
      this.form.liableUserId = null
      // 循环责任人ID列表
      for (let i = 0; i < this.form.liableUserIdList.length; i++) {
        // 责任人ID
        this.form.liableUserId = this.form.liableUserId === null ? '-' + this.form.liableUserIdList[i] + '-' : this.form.liableUserId + ',' + '-' + this.form.liableUserIdList[i] + '-'
      }
    }
  }
}
eladmin-web-master/src/views/project/projectCost/index.vue
@@ -74,7 +74,7 @@
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" show-summary :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
      <el-table ref="table" v-loading="crud.loading" :summary-method="getSummaries" show-summary :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="projectName" label="所属项目" show-overflow-tooltip>
          <template slot-scope="scope">
@@ -280,6 +280,30 @@
          this.randomCost = Math.random()
        })
      }
    },
    // 表格统计
    getSummaries(param) {
      const { columns, data } = param
      const sums = []
      columns.forEach((column, index) => {
        // 5/6号单元格
        if (index === 5 || index === 6) {
          const values = data.map(item => Number(item[column.property]))
          if (!values.every(value => isNaN(value))) {
            sums[index] = this.crud.toMoney(
              values.reduce((prev, curr) => {
                const value = Number(curr)
                if (!isNaN(value)) {
                  return prev + curr
                } else {
                  return prev
                }
              }, 0)
            )
          }
        }
      })
      return sums
    }
  }
}
eladmin-web-master/src/views/project/projectTask/index.vue
@@ -87,7 +87,7 @@
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" show-summary :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
      <el-table ref="table" v-loading="crud.loading" :summary-method="getSummaries" show-summary :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column show-overflow-tooltip prop="name" label="名称" width="180" />
        <el-table-column show-overflow-tooltip prop="projectName" label="所属项目" width="180">
@@ -249,6 +249,28 @@
        // 项目列表
        this.projectList = res
      })
    },
    // 表格统计
    getSummaries(param) {
      const { columns, data } = param
      const sums = []
      columns.forEach((column, index) => {
        // 7/8号单元格
        if (index === 7 || index === 8) {
          const values = data.map(item => Number(item[column.property]))
          if (!values.every(value => isNaN(value))) {
            sums[index] = values.reduce((prev, curr) => {
              const value = Number(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
          }
        }
      })
      return sums
    }
  }
}
eladmin-web-master/src/views/system/goalSetting/index.vue
New file
@@ -0,0 +1,156 @@
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <el-date-picker v-model="query.targetYear" type="year" clearable placeholder="目标年度" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <el-select v-model="query.projectDistinguish" filterable clearable placeholder="项目区分" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[projectDistinguish]"
            :key="item.id"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <rrOperation :crud="crud" />
      </div>
      <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
          <el-form-item label="目标年度" prop="targetYear">
            <el-date-picker v-model="form.targetYear" type="year" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="项目区分" prop="projectDistinguish">
            <el-select v-model="form.projectDistinguish" filterable placeholder="请选择" style="width: 370px;">
              <el-option
                v-for="item in dict[projectDistinguish]"
                :key="item.id"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="目标金额" prop="targetAmount">
            <money-input :key="random" v-model="form.targetAmount" :width="370" />
          </el-form-item>
          <el-form-item label="备注">
            <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 370px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column :show-overflow-tooltip="true" prop="targetYear" label="目标年度">
          <template slot-scope="scope">
            {{ crud.toYear(scope.row.targetYear) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="projectDistinguish" label="项目区分">
          <template slot-scope="scope">
            {{ dict.label[projectDistinguish][scope.row.projectDistinguish] }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="targetAmount" label="目标金额">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.targetAmount) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" />
        <el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建时间" />
        <el-table-column v-if="checkPer(['admin','sysGoalSetting:edit','sysGoalSetting:del'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>
<script>
import crudSysGoalSetting from '@/api/system/goalSetting'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import constant from '../../../utils/constant'
import moneyInput from '../../assembly/moneyInput/index.vue'
const defaultForm = { id: null, targetYear: null, projectDistinguish: null, targetAmount: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
export default {
  name: 'SysGoalSetting',
  components: { pagination, crudOperation, rrOperation, udOperation, moneyInput },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  dicts: [constant.PROJECT_DISTINGUISH],
  cruds() {
    return CRUD({ title: '目标管理', url: 'api/sysGoalSetting', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysGoalSetting }})
  },
  data() {
    // 金额(十亿内)验证
    var amountValidate = (rule, value, callback) => {
      if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 1000000000)) {
        callback(new Error('请输入 十亿 以内的正整数或两位小数'))
      } else {
        callback()
      }
    }
    return {
      permission: {
        add: ['admin', 'sysGoalSetting:add'],
        edit: ['admin', 'sysGoalSetting:edit'],
        del: ['admin', 'sysGoalSetting:del'],
        download: ['admin', 'sysGoalSetting:download']
      },
      rules: {
        targetYear: [
          { required: true, message: '目标年度不能为空', trigger: 'change' }
        ],
        projectDistinguish: [
          { required: true, message: '项目区分不能为空', trigger: 'change' }
        ],
        targetAmount: [
          { required: true, message: '目标金额不能为空', trigger: 'blur' },
          { validator: amountValidate, trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'targetYear', display_name: '目标年度' },
        { key: 'projectDistinguish', display_name: '项目区分' }
      ],
      // 字典:项目区分
      projectDistinguish: constant.PROJECT_DISTINGUISH,
      // 随机数
      random: 0
    }
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    },
    // 钩子: 开始 "新建/编辑" - 之前
    [CRUD.HOOK.beforeToCU]() {
      // 随机数
      this.random = Math.random()
    }
  }
}
</script>
<style scoped>
</style>
eladmin-web-master/src/views/task/task/index.vue
@@ -190,7 +190,20 @@
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" row-key="id" lazy :load="load" :tree-props="{children: 'children', hasChildren: 'hasChildren'}" @selection-change="crud.selectionChangeHandler">
      <el-table
        ref="table"
        v-loading="crud.loading"
        :data="crud.data"
        size="small"
        style="width: 100%;"
        row-key="id"
        lazy
        :load="load"
        :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
        :summary-method="getSummaries"
        show-summary
        @selection-change="crud.selectionChangeHandler"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column :show-overflow-tooltip="true" prop="name" label="名称" fixed="left" width="180" />
        <el-table-column :show-overflow-tooltip="true" prop="projectName" label="所属项目" width="140">
@@ -243,6 +256,7 @@
        <el-table-column v-if="checkPer(['admin','task:divide','task:edit','task:del'])" label="操作" width="180px" align="center" fixed="right">
          <template slot-scope="scope">
            <udOperation
              v-if="userRolesLevelMin == roleLevelSuper || userRolesLevelMin == roleLevelGeneral || scope.row.projectLiableUserIdList.indexOf($store.state.user.user.id) != -1"
              :data="scope.row"
              :permission="permission"
            >
@@ -419,8 +433,14 @@
      taskStatus: constant.TASK_STATUS,
      // 字典:批准状态-未承认
      approveStatusUnrecognized: constant.APPROVE_STATUS_UNRECOGNIZED,
      // 角色级别:超级管理员
      roleLevelSuper: constant.ROLE_LEVEL_SUPER,
      // 角色级别:总经理
      roleLevelGeneral: constant.ROLE_LEVEL_GENERAL,
      // CRUD状态
      crudStatusPrepared: CRUD.STATUS.PREPARED,
      // 用户最大角色级别
      userRolesLevelMin: null,
      // 项目列表
      projects: [],
      // 父级任务列表
@@ -471,6 +491,10 @@
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      // 用户角色级别数组
      const userRolesLevel = this.$store.state.user.user.roles.map(({ level }) => level)
      // 用户最大角色级别
      this.userRolesLevelMin = Math.min(...userRolesLevel)
      // 获取项目
      this.getProject()
      // 获取用户
@@ -508,6 +532,100 @@
        // 添加
        resolve(res)
      })
    },
    // 表格统计
    getSummaries(param) {
      const { columns, data } = param
      const sums = []
      columns.forEach((column, index) => {
        // 9号单元格
        if (index === 9) {
          // 已完成工时
          let completedHours = 0
          const completedHoursValues = data.map(item => Number(item['completedHours']))
          if (!completedHoursValues.every(value => isNaN(value))) {
            completedHours = completedHoursValues.reduce((prev, curr) => {
              const value = Number(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
          }
          // 已分配工时
          let divideHours = 0
          const divideHoursValues = data.map(item => Number(item['divideHours']))
          if (!divideHoursValues.every(value => isNaN(value))) {
            divideHours = divideHoursValues.reduce((prev, curr) => {
              const value = Number(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
          }
          // 计划工时
          let planHours = 0
          const planHoursValues = data.map(item => Number(item['planHours']))
          if (!planHoursValues.every(value => isNaN(value))) {
            planHours = planHoursValues.reduce((prev, curr) => {
              const value = Number(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
          }
          sums[index] = completedHours + ' / ' + divideHours + ' / ' + planHours
        }
        // 10号单元格
        if (index === 10) {
          // 已完成工作量
          let completedWorkload = 0
          const completedWorkloadValues = data.map(item => Number(item['completedWorkload']))
          if (!completedWorkloadValues.every(value => isNaN(value))) {
            completedWorkload = completedWorkloadValues.reduce((prev, curr) => {
              const value = Number(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
          }
          // 已分配工作量
          let divideWorkload = 0
          const divideWorkloadValues = data.map(item => Number(item['divideWorkload']))
          if (!divideWorkloadValues.every(value => isNaN(value))) {
            divideWorkload = divideWorkloadValues.reduce((prev, curr) => {
              const value = Number(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
          }
          // 计划工作量
          let planWorkload = 0
          const planWorkloadValues = data.map(item => Number(item['planWorkload']))
          if (!planWorkloadValues.every(value => isNaN(value))) {
            planWorkload = planWorkloadValues.reduce((prev, curr) => {
              const value = Number(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
          }
          sums[index] = completedWorkload + ' / ' + divideWorkload + ' / ' + planWorkload
        }
      })
      return sums
    },
    // 钩子:新建 - 之前
    [CRUD.HOOK.beforeToAdd]() {
@@ -600,6 +718,21 @@
      // 表单验证
      this.$refs['divideForm'].validate((valid) => {
        if (valid) {
          // 判断用户角色
          if (this.userRolesLevelMin !== this.roleLevelSuper && this.userRolesLevelMin !== this.roleLevelGeneral) {
            // 检索选中项目信息
            const chooseProject = this.projects.filter((item) => {
              return item.id === this.divideForm.projectId
            })
            // 判断是否是项目责任人
            if (chooseProject.length !== 1 || chooseProject[0].liableUserIdList.indexOf(this.$store.state.user.user.id) === -1) {
              // 消息提示
              this.crud.notify('您不是当前项目责任人,无法进行任务分配操作', CRUD.NOTIFICATION_TYPE.WARNING)
              // 分配表单加载
              this.divideLoading = false
              return false
            }
          }
          // 分配任务
          crudTask.divide(this.divideForm).then(res => {
            // 分配表单关闭
@@ -615,6 +748,26 @@
          return false
        }
      })
    },
    // 钩子:提交 - 之前
    [CRUD.HOOK.beforeSubmit]() {
      // 判断用户角色
      if (this.userRolesLevelMin === this.roleLevelSuper || this.userRolesLevelMin === this.roleLevelGeneral) {
        return true
      } else {
        // 检索选中项目信息
        const chooseProject = this.projects.filter((item) => {
          return item.id === this.form.projectId
        })
        // 判断是否是项目责任人
        if (chooseProject.length === 1 && chooseProject[0].liableUserIdList.indexOf(this.$store.state.user.user.id) !== -1) {
          return true
        } else {
          // 消息提示
          this.crud.notify('您不是当前项目责任人,无法添加/修改任务详情', CRUD.NOTIFICATION_TYPE.WARNING)
          return false
        }
      }
    }
  }
}
eladmin-web-master/src/views/task/taskUser/index.vue
@@ -36,6 +36,7 @@
            :value="item.value"
          />
        </el-select>
        <date-range-picker v-model="query.createTime" class="date-item" />
        <rrOperation :crud="crud" />
      </div>
      <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
@@ -120,7 +121,16 @@
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
      <el-table
        ref="table"
        v-loading="crud.loading"
        :data="crud.data"
        size="small"
        style="width: 100%;"
        :summary-method="getSummaries"
        show-summary
        @selection-change="crud.selectionChangeHandler"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column :show-overflow-tooltip="true" prop="projectName" label="所属项目" fixed="left" width="140">
          <template slot-scope="scope">
@@ -169,6 +179,7 @@
        <el-table-column v-if="checkPer(['admin','taskUser:edit','taskUser:del'])" label="操作" width="150px" align="center" fixed="right">
          <template slot-scope="scope">
            <udOperation
              v-if="userRolesLevelMin == roleLevelSuper || userRolesLevelMin == roleLevelGeneral || scope.row.projectLiableUserIdList.indexOf($store.state.user.user.id) != -1 || scope.row.userId == $store.state.user.user.id"
              :data="scope.row"
              :permission="permission"
            />
@@ -193,11 +204,12 @@
import crudProject from '@/api/project/project'
import crudTask from '@/api/task/task'
import crudUser from '@/api/system/user'
import DateRangePicker from '@/components/DateRangePicker'
const defaultForm = { id: null, userId: null, projectId: null, taskId: null, taskStartDate: null, taskEndDate: null, taskHours: null, taskWorkload: null, taskStatus: null, enable1: false, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, divideUserIds: [] }
export default {
  name: 'TaskUser',
  components: { pagination, crudOperation, rrOperation, udOperation },
  components: { pagination, crudOperation, rrOperation, udOperation, DateRangePicker },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  dicts: [constant.TASK_STATUS, constant.STANDARD_WORKLOAD_UNIT],
  cruds() {
@@ -253,7 +265,8 @@
        { key: 'projectId', display_name: '所属项目' },
        { key: 'taskId', display_name: '所属任务' },
        { key: 'userId', display_name: '所属员工' },
        { key: 'taskStatus', display_name: '任务状态' }
        { key: 'taskStatus', display_name: '任务状态' },
        { key: 'createTime', display_name: '创建时间' }
      ],
      // 任务开始时间选项
      taskStartDatePickerOptions: {
@@ -275,6 +288,10 @@
      standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT,
      // 字典:批准状态-未承认
      approveStatusUnrecognized: constant.APPROVE_STATUS_UNRECOGNIZED,
      // 角色级别:超级管理员
      roleLevelSuper: constant.ROLE_LEVEL_SUPER,
      // 角色级别:总经理
      roleLevelGeneral: constant.ROLE_LEVEL_GENERAL,
      // 角色级别:普通用户
      roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY,
      // CRUD状态
@@ -364,6 +381,74 @@
        })
      }
    },
    // 表格统计
    getSummaries(param) {
      const { columns, data } = param
      const sums = []
      columns.forEach((column, index) => {
        // 6号单元格
        if (index === 6) {
          // 消耗工时
          let consumedHours = 0
          const consumedHoursValues = data.map(item => Number(item['consumedHours']))
          if (!consumedHoursValues.every(value => isNaN(value))) {
            consumedHours = consumedHoursValues.reduce((prev, curr) => {
              const value = Number(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
          }
          // 任务工时
          let taskHours = 0
          const taskHoursValues = data.map(item => Number(item['taskHours']))
          if (!taskHoursValues.every(value => isNaN(value))) {
            taskHours = taskHoursValues.reduce((prev, curr) => {
              const value = Number(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
          }
          sums[index] = consumedHours + ' / ' + taskHours
        }
        // 7号单元格
        if (index === 7) {
          // 消耗工作量
          let consumedWorkload = 0
          const consumedWorkloadValues = data.map(item => Number(item['consumedWorkload']))
          if (!consumedWorkloadValues.every(value => isNaN(value))) {
            consumedWorkload = consumedWorkloadValues.reduce((prev, curr) => {
              const value = Number(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
          }
          // 任务工作量
          let taskWorkload = 0
          const taskWorkloadValues = data.map(item => Number(item['taskWorkload']))
          if (!taskWorkloadValues.every(value => isNaN(value))) {
            taskWorkload = taskWorkloadValues.reduce((prev, curr) => {
              const value = Number(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
          }
          sums[index] = consumedWorkload + ' / ' + taskWorkload
        }
      })
      return sums
    },
    // 钩子:新建 - 之前
    [CRUD.HOOK.beforeToAdd]() {
      // 表单赋值
@@ -433,6 +518,26 @@
        // 表单赋值
        this.form.divideUserIds = res
      })
    },
    // 钩子:提交 - 之前
    [CRUD.HOOK.beforeSubmit]() {
      // 判断用户角色
      if (this.userRolesLevelMin === this.roleLevelSuper || this.userRolesLevelMin === this.roleLevelGeneral) {
        return true
      } else {
        // 检索选中项目信息
        const chooseProject = this.projects.filter((item) => {
          return item.id === this.form.projectId
        })
        // 判断是否是项目责任人
        if ((chooseProject.length === 1 && chooseProject[0].liableUserIdList.indexOf(this.$store.state.user.user.id) !== -1) || this.form.userId === this.$store.state.user.user.id) {
          return true
        } else {
          // 消息提示
          this.crud.notify('您不是当前项目责任人,无法添加/修改任务分配', CRUD.NOTIFICATION_TYPE.WARNING)
          return false
        }
      }
    }
  }
}