106 files added
48 files modified
| | |
| | | public interface CacheKey { |
| | | |
| | | /** |
| | | * 数据 |
| | | */ |
| | | String TOTAL_USER = "user::total"; |
| | | /** |
| | | * 用户 |
| | | */ |
| | | String USER_ID = "user::id:"; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Map.Entry; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import 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.project.service.dto.ProjectTypeQueryCriteria; |
| | | import me.zhengjie.modules.system.domain.DictDetail; |
| | | import me.zhengjie.modules.system.domain.SysExchangeRate; |
| | | import me.zhengjie.modules.system.domain.SysGoalSetting; |
| | | import me.zhengjie.modules.system.repository.SysExchangeRateRepository; |
| | | import me.zhengjie.modules.system.repository.SysGoalSettingRepository; |
| | | import me.zhengjie.modules.system.service.SysExchangeRateService; |
| | | import me.zhengjie.modules.system.service.SysGoalSettingService; |
| | | import me.zhengjie.modules.system.service.dto.*; |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import me.zhengjie.modules.task.domain.TaskInterface; |
| | | import me.zhengjie.modules.task.service.TaskService; |
| | | import me.zhengjie.modules.task.service.dto.TaskDto; |
| | | import me.zhengjie.modules.task.service.dto.TaskQueryCriteria; |
| | | import me.zhengjie.modules.task.service.mapstruct.TaskMapper; |
| | | import me.zhengjie.utils.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.contract.repository.ContractProjectRepository; |
| | | import me.zhengjie.modules.cost.repository.CostRepository; |
| | | 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.ProjectSummary; |
| | | 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.repository.ProjectCostOtherRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectCostRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectPerformanceDetailRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectPerformanceRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectProgressRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectTaskRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectTypeRepository; |
| | | import me.zhengjie.modules.project.service.ProjectCostService; |
| | | 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.dto.ProjectTypeQueryCriteria; |
| | | import me.zhengjie.modules.project.service.mapstruct.ProjectMapper; |
| | | import me.zhengjie.modules.system.domain.DictDetail; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.RoleService; |
| | | import me.zhengjie.modules.system.service.SysExchangeRateService; |
| | | import me.zhengjie.modules.system.service.SysGoalSettingService; |
| | | import me.zhengjie.modules.system.service.dto.RoleSmallDto; |
| | | import me.zhengjie.modules.system.service.dto.SysExchangeRateDto; |
| | | import me.zhengjie.modules.system.service.dto.SysExchangeRateQueryCriteria; |
| | | import me.zhengjie.modules.system.service.dto.SysGoalSettingDto; |
| | | import me.zhengjie.modules.system.service.dto.SysGoalSettingQueryCriteria; |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import me.zhengjie.modules.task.domain.TaskInterface; |
| | | import me.zhengjie.modules.task.repository.TaskDaliyRepository; |
| | | import me.zhengjie.modules.task.repository.TaskRepository; |
| | | import me.zhengjie.modules.task.repository.TaskUserRepository; |
| | | import me.zhengjie.modules.task.service.TaskService; |
| | | import me.zhengjie.modules.task.service.dto.TaskDto; |
| | | import me.zhengjie.modules.task.service.mapstruct.TaskMapper; |
| | | import me.zhengjie.utils.DoubleUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.SecurityUtils; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.enums.DataScopeEnum; |
| | | |
| | | |
| | |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ProjectServiceImpl implements ProjectService { |
| | | public class ProjectServiceImpl implements ProjectService { // TODO redis化 |
| | | |
| | | private final ProjectRepository projectRepository; |
| | | private final ProjectMapper projectMapper; |
| | |
| | | private final CostRepository costRepository; |
| | | private final ContractProjectRepository contractProjectRepository; |
| | | private final SysGoalSettingService sysGoalSettingService; |
| | | private final TaskService taskService; |
| | | @Autowired |
| | | private TaskService taskService; |
| | | private final TaskMapper taskMapper; |
| | | private final SysExchangeRateService sysExchangeRateService; |
| | | |
| | |
| | | info.put(userId, new AttendanceMonth()); |
| | | info.get(userId).setAttendanceDate(Timestamp.valueOf(baseDate + "-01 00:00:00")); |
| | | info.get(userId).setUserId(userId); |
| | | info.get(userId).setCompanyId(user.getCompanyId()); |
| | | info.get(userId).setCompanyId(user.getCompany().getId()); |
| | | info.get(userId).setDeptId(user.getDept().getId()); |
| | | // 查询岗位 |
| | | if(user.getJobs().size() != 0){ |
| New file |
| | |
| | | /* |
| | | * 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.salary.domain; |
| | | |
| | | import lombok.Data; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="new_pay_monthly_reimbursement") |
| | | public class PayMonthlyReimbursement implements Serializable { |
| | | |
| | | @Id |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`user_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "员工ID") |
| | | private Long userId; |
| | | |
| | | @Column(name = "`date`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "年月日") |
| | | private String date; |
| | | |
| | | @Column(name = "`reimbursement_cost`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "报销金额") |
| | | private BigDecimal reimbursementCost; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备考") |
| | | private String remarks; |
| | | |
| | | public void copy(PayMonthlyReimbursement source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.domain; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | import javax.persistence.Column; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.GenerationType; |
| | | import javax.persistence.Id; |
| | | 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 |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="new_pay_monthly_salary") |
| | | public class PayMonthlySalary extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`user_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "员工ID") |
| | | private Long userId; |
| | | |
| | | @Column(name = "`year_month`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "工资年月") |
| | | private String yearMonth; |
| | | |
| | | @Column(name = "`full_hours`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "全勤小时数") |
| | | private Double fullHours = 0.0D; |
| | | |
| | | @Column(name = "`attendance_hours`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "出勤小时数") |
| | | private Double attendanceHours = 0.0D; |
| | | |
| | | @Column(name = "`performance_hours`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "绩效小时数") |
| | | private Double performanceHours = 0.0D; |
| | | |
| | | @Column(name = "`act_attendance_wage`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "实际出勤工资") |
| | | private BigDecimal actAttendanceWage = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`act_performance_wage`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "实际业绩工资") |
| | | private BigDecimal actPerformanceWage = BigDecimal.ZERO; |
| | | |
| | | // private List<PayMonthlyReimbursement> reimbursementList; |
| | | // |
| | | // private List<PayMonthlySubsidy> subsidyList; |
| | | |
| | | @Column(name = "`basic_wage`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "基本工资") |
| | | private BigDecimal basicWage = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`performance_wage`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "业绩工资") |
| | | private BigDecimal performanceWage = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`accumulation_radix`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金基数") |
| | | private BigDecimal accumulationRadix = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`accumulation_personal_proportion`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金个人缴纳比例") |
| | | private Double accumulationPersonalProportion = 0.0D; |
| | | |
| | | @Column(name = "`accumulation_personal_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金个人缴纳金额") |
| | | private BigDecimal accumulationPersonalAmount = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`accumulation_company_proportion`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金公司缴纳比例") |
| | | private Double accumulationCompanyProportion = 0.0D; |
| | | |
| | | @Column(name = "`accumulation_company_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金公司缴纳金额") |
| | | private BigDecimal accumulationCompanyAmount = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`pension_radix`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "养老险基数") |
| | | private BigDecimal pensionRadix = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`pension_personal_proportion`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "养老险个人缴纳比例") |
| | | private Double pensionPersonalProportion = 0.0D; |
| | | |
| | | @Column(name = "`pension_personal_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "养老险个人缴纳金额") |
| | | private BigDecimal pensionPersonalAmount = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`pension_company_proportion`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "养老险公司缴纳比例") |
| | | private Double pensionCompanyProportion = 0.0D; |
| | | |
| | | @Column(name = "`pension_company_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "养老险公司缴纳金额") |
| | | private BigDecimal pensionCompanyAmount = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`medical_radix`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "医疗险基数") |
| | | private BigDecimal medicalRadix = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`medical_personal_proportion`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "医疗险个人缴纳比例") |
| | | private Double medicalPersonalProportion = 0.0D; |
| | | |
| | | @Column(name = "`medical_personal_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "医疗险个人缴纳金额") |
| | | private BigDecimal medicalPersonalAmount = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`medical_company_proportion`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "医疗险公司缴纳比例") |
| | | private Double medicalCompanyProportion = 0.0D; |
| | | |
| | | @Column(name = "`medical_company_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "医疗险公司缴纳金额") |
| | | private BigDecimal medicalCompanyAmount = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`unemployment_radix`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "失业险基数") |
| | | private BigDecimal unemploymentRadix = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`unemployment_personal_proportion`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "失业险个人缴纳比例") |
| | | private Double unemploymentPersonalProportion = 0.0D; |
| | | |
| | | @Column(name = "`unemployment_personal_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "失业险个人缴纳金额") |
| | | private BigDecimal unemploymentPersonalAmount = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`unemployment_company_proportion`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "失业险公司缴纳比例") |
| | | private Double unemploymentCompanyProportion = 0.0D; |
| | | |
| | | @Column(name = "`unemployment_company_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "失业险公司缴纳金额") |
| | | private BigDecimal unemploymentCompanyAmount = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`maternity_radix`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "生育险基数") |
| | | private BigDecimal maternityRadix = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`maternity_personal_proportion`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "生育险个人缴纳比例") |
| | | private Double maternityPersonalProportion = 0.0D; |
| | | |
| | | @Column(name = "`maternity_personal_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "生育险个人缴纳金额") |
| | | private BigDecimal maternityPersonalAmount = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`maternity_company_proportion`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "生育险公司缴纳比例") |
| | | private Double maternityCompanyProportion = 0.0D; |
| | | |
| | | @Column(name = "`maternity_company_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "生育险公司缴纳金额") |
| | | private BigDecimal maternityCompanyAmount = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`industrial_injury_radix`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "工伤险基数") |
| | | private BigDecimal industrialInjuryRadix = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`industrial_injury_personal_proportion`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "工伤险个人缴纳比例") |
| | | private Double industrialInjuryPersonalProportion = 0.0D; |
| | | |
| | | @Column(name = "`industrial_injury_personal_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "工伤险个人缴纳金额") |
| | | private BigDecimal industrialInjuryPersonalAmount = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`industrial_injury_company_proportion`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "工伤险公司缴纳比例") |
| | | private Double industrialInjuryCompanyProportion = 0.0D; |
| | | |
| | | @Column(name = "`industrial_injury_company_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "工伤险公司缴纳金额") |
| | | private BigDecimal industrialInjuryCompanyAmount = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | @Column(name = "`publicity_status`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "公示状态") |
| | | private String publicityStatus; |
| | | |
| | | @Column(name = "`approve_status`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "承认状态") |
| | | private String approveStatus; |
| | | |
| | | public void copy(PayMonthlySalary source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.domain; |
| | | |
| | | import lombok.Data; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="new_pay_monthly_subsidy") |
| | | public class PayMonthlySubsidy implements Serializable { |
| | | |
| | | @Id |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`user_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "员工ID") |
| | | private Long userId; |
| | | |
| | | @Column(name = "`date`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "年月日") |
| | | private String date; |
| | | |
| | | @Column(name = "`subsidy_cost`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "补助金额") |
| | | private BigDecimal subsidyCost; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备考") |
| | | private String remarks; |
| | | |
| | | public void copy(PayMonthlySubsidy source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.repository; |
| | | |
| | | import me.zhengjie.modules.salary.domain.PayMonthlyReimbursement; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | public interface PayMonthlyReimbursementRepository extends JpaRepository<PayMonthlyReimbursement, Long>, JpaSpecificationExecutor<PayMonthlyReimbursement> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.repository; |
| | | |
| | | import me.zhengjie.modules.salary.domain.PayMonthlySalary; |
| | | |
| | | import java.util.Optional; |
| | | |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | public interface PayMonthlySalaryRepository extends JpaRepository<PayMonthlySalary, Long>, JpaSpecificationExecutor<PayMonthlySalary> { |
| | | |
| | | Optional<PayMonthlySalary> findByUserIdAndYearMonth(Long userId, String yearMonth); |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.repository; |
| | | |
| | | import me.zhengjie.modules.salary.domain.PayMonthlySubsidy; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | public interface PayMonthlySubsidyRepository extends JpaRepository<PayMonthlySubsidy, Long>, JpaSpecificationExecutor<PayMonthlySubsidy> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.salary.domain.PayMonthlyReimbursement; |
| | | import me.zhengjie.modules.salary.service.PayMonthlyReimbursementService; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlyReimbursementQueryCriteria; |
| | | 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-05-07 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "月度报销管理管理") |
| | | @RequestMapping("/api/payMonthlyReimbursement") |
| | | public class PayMonthlyReimbursementController { |
| | | |
| | | private final PayMonthlyReimbursementService payMonthlyReimbursementService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('payMonthlyReimbursement:list')") |
| | | public void exportPayMonthlyReimbursement(HttpServletResponse response, PayMonthlyReimbursementQueryCriteria criteria) throws IOException { |
| | | payMonthlyReimbursementService.download(payMonthlyReimbursementService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询月度报销管理") |
| | | @ApiOperation("查询月度报销管理") |
| | | @PreAuthorize("@el.check('payMonthlyReimbursement:list')") |
| | | public ResponseEntity<Object> queryPayMonthlyReimbursement(PayMonthlyReimbursementQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(payMonthlyReimbursementService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增月度报销管理") |
| | | @ApiOperation("新增月度报销管理") |
| | | @PreAuthorize("@el.check('payMonthlyReimbursement:add')") |
| | | public ResponseEntity<Object> createPayMonthlyReimbursement(@Validated @RequestBody PayMonthlyReimbursement resources){ |
| | | return new ResponseEntity<>(payMonthlyReimbursementService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改月度报销管理") |
| | | @ApiOperation("修改月度报销管理") |
| | | @PreAuthorize("@el.check('payMonthlyReimbursement:edit')") |
| | | public ResponseEntity<Object> updatePayMonthlyReimbursement(@Validated @RequestBody PayMonthlyReimbursement resources){ |
| | | payMonthlyReimbursementService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除月度报销管理") |
| | | @ApiOperation("删除月度报销管理") |
| | | @PreAuthorize("@el.check('payMonthlyReimbursement:del')") |
| | | public ResponseEntity<Object> deletePayMonthlyReimbursement(@RequestBody Long[] ids) { |
| | | payMonthlyReimbursementService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.salary.domain.PayMonthlySalary; |
| | | import me.zhengjie.modules.salary.service.PayMonthlySalaryService; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySalaryGenerateParam; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySalaryQueryCriteria; |
| | | 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-05-07 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "月度工资管理") |
| | | @RequestMapping("/api/payMonthlySalary") |
| | | public class PayMonthlySalaryController { |
| | | |
| | | private final PayMonthlySalaryService payMonthlySalaryService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('payMonthlySalary:list')") |
| | | public void exportPayMonthlySalary(HttpServletResponse response, PayMonthlySalaryQueryCriteria criteria) throws IOException { |
| | | payMonthlySalaryService.download(payMonthlySalaryService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询月度工资") |
| | | @ApiOperation("查询月度工资") |
| | | @PreAuthorize("@el.check('payMonthlySalary:list')") |
| | | public ResponseEntity<Object> queryPayMonthlySalary(PayMonthlySalaryQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(payMonthlySalaryService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增月度工资") |
| | | @ApiOperation("新增月度工资") |
| | | @PreAuthorize("@el.check('payMonthlySalary:add')") |
| | | public ResponseEntity<Object> createPayMonthlySalary(@Validated @RequestBody PayMonthlySalary resources){ |
| | | return new ResponseEntity<>(payMonthlySalaryService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PostMapping(value = "/generate") |
| | | @Log("新增月度工资") |
| | | @ApiOperation("新增月度工资") |
| | | @PreAuthorize("@el.check('payMonthlySalary:add')") |
| | | public ResponseEntity<Object> generatePayMonthlySalary(@Validated @RequestBody PayMonthlySalaryGenerateParam resources){ |
| | | payMonthlySalaryService.generate(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改月度工资") |
| | | @ApiOperation("修改月度工资") |
| | | @PreAuthorize("@el.check('payMonthlySalary:edit')") |
| | | public ResponseEntity<Object> updatePayMonthlySalary(@Validated @RequestBody PayMonthlySalary resources){ |
| | | payMonthlySalaryService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除月度工资") |
| | | @ApiOperation("删除月度工资") |
| | | @PreAuthorize("@el.check('payMonthlySalary:del')") |
| | | public ResponseEntity<Object> deletePayMonthlySalary(@RequestBody Long[] ids) { |
| | | payMonthlySalaryService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.salary.domain.PayMonthlySubsidy; |
| | | import me.zhengjie.modules.salary.service.PayMonthlySubsidyService; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySubsidyQueryCriteria; |
| | | 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-05-07 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "月度补助管理管理") |
| | | @RequestMapping("/api/payMonthlySubsidy") |
| | | public class PayMonthlySubsidyController { |
| | | |
| | | private final PayMonthlySubsidyService payMonthlySubsidyService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('payMonthlySubsidy:list')") |
| | | public void exportPayMonthlySubsidy(HttpServletResponse response, PayMonthlySubsidyQueryCriteria criteria) throws IOException { |
| | | payMonthlySubsidyService.download(payMonthlySubsidyService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询月度补助管理") |
| | | @ApiOperation("查询月度补助管理") |
| | | @PreAuthorize("@el.check('payMonthlySubsidy:list')") |
| | | public ResponseEntity<Object> queryPayMonthlySubsidy(PayMonthlySubsidyQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(payMonthlySubsidyService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增月度补助管理") |
| | | @ApiOperation("新增月度补助管理") |
| | | @PreAuthorize("@el.check('payMonthlySubsidy:add')") |
| | | public ResponseEntity<Object> createPayMonthlySubsidy(@Validated @RequestBody PayMonthlySubsidy resources){ |
| | | return new ResponseEntity<>(payMonthlySubsidyService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改月度补助管理") |
| | | @ApiOperation("修改月度补助管理") |
| | | @PreAuthorize("@el.check('payMonthlySubsidy:edit')") |
| | | public ResponseEntity<Object> updatePayMonthlySubsidy(@Validated @RequestBody PayMonthlySubsidy resources){ |
| | | payMonthlySubsidyService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除月度补助管理") |
| | | @ApiOperation("删除月度补助管理") |
| | | @PreAuthorize("@el.check('payMonthlySubsidy:del')") |
| | | public ResponseEntity<Object> deletePayMonthlySubsidy(@RequestBody Long[] ids) { |
| | | payMonthlySubsidyService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service; |
| | | |
| | | import me.zhengjie.modules.salary.domain.PayMonthlyReimbursement; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlyReimbursementDto; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlyReimbursementQueryCriteria; |
| | | 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-05-07 |
| | | **/ |
| | | public interface PayMonthlyReimbursementService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(PayMonthlyReimbursementQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<PayMonthlyReimbursementDto> |
| | | */ |
| | | List<PayMonthlyReimbursementDto> queryAll(PayMonthlyReimbursementQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return PayMonthlyReimbursementDto |
| | | */ |
| | | PayMonthlyReimbursementDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return PayMonthlyReimbursementDto |
| | | */ |
| | | PayMonthlyReimbursementDto create(PayMonthlyReimbursement resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(PayMonthlyReimbursement resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<PayMonthlyReimbursementDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service; |
| | | |
| | | import me.zhengjie.modules.salary.domain.PayMonthlySalary; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySalaryDto; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySalaryGenerateParam; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySalaryQueryCriteria; |
| | | 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-05-07 |
| | | **/ |
| | | public interface PayMonthlySalaryService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(PayMonthlySalaryQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<PayMonthlySalaryDto> |
| | | */ |
| | | List<PayMonthlySalaryDto> queryAll(PayMonthlySalaryQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return PayMonthlySalaryDto |
| | | */ |
| | | PayMonthlySalaryDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return PayMonthlySalaryDto |
| | | */ |
| | | PayMonthlySalaryDto create(PayMonthlySalary resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(PayMonthlySalary resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<PayMonthlySalaryDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | void generate(PayMonthlySalaryGenerateParam param); |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service; |
| | | |
| | | import me.zhengjie.modules.salary.domain.PayMonthlySubsidy; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySubsidyDto; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySubsidyQueryCriteria; |
| | | 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-05-07 |
| | | **/ |
| | | public interface PayMonthlySubsidyService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(PayMonthlySubsidyQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<PayMonthlySubsidyDto> |
| | | */ |
| | | List<PayMonthlySubsidyDto> queryAll(PayMonthlySubsidyQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return PayMonthlySubsidyDto |
| | | */ |
| | | PayMonthlySubsidyDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return PayMonthlySubsidyDto |
| | | */ |
| | | PayMonthlySubsidyDto create(PayMonthlySubsidy resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(PayMonthlySubsidy resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<PayMonthlySubsidyDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | import com.alibaba.fastjson.annotation.JSONField; |
| | | import com.alibaba.fastjson.serializer.ToStringSerializer; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class PayMonthlyReimbursementDto implements Serializable { |
| | | |
| | | /** ID */ |
| | | /** 防止精度丢失 */ |
| | | @JSONField(serializeUsing = ToStringSerializer.class) |
| | | private Long id; |
| | | |
| | | /** 员工ID */ |
| | | private Long userId; |
| | | |
| | | /** 年月日 */ |
| | | private String date; |
| | | |
| | | /** 报销金额 */ |
| | | private BigDecimal reimbursementCost; |
| | | |
| | | /** 备考 */ |
| | | private String remarks; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class PayMonthlyReimbursementQueryCriteria{ |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.sql.Timestamp; |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class PayMonthlySalaryDto implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 员工ID */ |
| | | private Long userId; |
| | | |
| | | /** 员工名称 */ |
| | | private String nickName; |
| | | |
| | | /** 基本工资 */ |
| | | private BigDecimal basicWage; |
| | | |
| | | /** 业绩工资 */ |
| | | private BigDecimal performanceWage; |
| | | |
| | | /** 公积金基数 */ |
| | | private BigDecimal accumulationRadix; |
| | | |
| | | /** 公积金个人缴纳比例 */ |
| | | private Double accumulationPersonalProportion; |
| | | |
| | | /** 公积金个人缴纳金额 */ |
| | | private BigDecimal accumulationPersonalAmount; |
| | | |
| | | /** 公积金公司缴纳比例 */ |
| | | private Double accumulationCompanyProportion; |
| | | |
| | | /** 公积金公司缴纳金额 */ |
| | | private BigDecimal accumulationCompanyAmount; |
| | | |
| | | /** 养老险基数 */ |
| | | private BigDecimal pensionRadix; |
| | | |
| | | /** 养老险个人缴纳比例 */ |
| | | private Double pensionPersonalProportion; |
| | | |
| | | /** 养老险个人缴纳金额 */ |
| | | private BigDecimal pensionPersonalAmount; |
| | | |
| | | /** 养老险公司缴纳比例 */ |
| | | private Double pensionCompanyProportion; |
| | | |
| | | /** 养老险公司缴纳金额 */ |
| | | private BigDecimal pensionCompanyAmount; |
| | | |
| | | /** 医疗险基数 */ |
| | | private BigDecimal medicalRadix; |
| | | |
| | | /** 医疗险个人缴纳比例 */ |
| | | private Double medicalPersonalProportion; |
| | | |
| | | /** 医疗险个人缴纳金额 */ |
| | | private BigDecimal medicalPersonalAmount; |
| | | |
| | | /** 医疗险公司缴纳比例 */ |
| | | private Double medicalCompanyProportion; |
| | | |
| | | /** 医疗险公司缴纳金额 */ |
| | | private BigDecimal medicalCompanyAmount; |
| | | |
| | | /** 失业险基数 */ |
| | | private BigDecimal unemploymentRadix; |
| | | |
| | | /** 失业险个人缴纳比例 */ |
| | | private Double unemploymentPersonalProportion; |
| | | |
| | | /** 失业险个人缴纳金额 */ |
| | | private BigDecimal unemploymentPersonalAmount; |
| | | |
| | | /** 失业险公司缴纳比例 */ |
| | | private Double unemploymentCompanyProportion; |
| | | |
| | | /** 失业险公司缴纳金额 */ |
| | | private BigDecimal unemploymentCompanyAmount; |
| | | |
| | | /** 生育险基数 */ |
| | | private BigDecimal maternityRadix; |
| | | |
| | | /** 生育险个人缴纳比例 */ |
| | | private Double maternityPersonalProportion; |
| | | |
| | | /** 生育险个人缴纳金额 */ |
| | | private BigDecimal maternityPersonalAmount; |
| | | |
| | | /** 生育险公司缴纳比例 */ |
| | | private Double maternityCompanyProportion; |
| | | |
| | | /** 生育险公司缴纳金额 */ |
| | | private BigDecimal maternityCompanyAmount; |
| | | |
| | | /** 工伤险基数 */ |
| | | private BigDecimal industrialInjuryRadix; |
| | | |
| | | /** 工伤险个人缴纳比例 */ |
| | | private Double industrialInjuryPersonalProportion; |
| | | |
| | | /** 工伤险个人缴纳金额 */ |
| | | private BigDecimal industrialInjuryPersonalAmount; |
| | | |
| | | /** 工伤险公司缴纳比例 */ |
| | | private Double industrialInjuryCompanyProportion; |
| | | |
| | | /** 工伤险公司缴纳金额 */ |
| | | private BigDecimal industrialInjuryCompanyAmount; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 公示状态 */ |
| | | private String publicityStatus; |
| | | |
| | | /** 承认状态 */ |
| | | private String approveStatus; |
| | | |
| | | /** 创建者 */ |
| | | private String createBy; |
| | | |
| | | /** 创建时间 */ |
| | | private Timestamp createTime; |
| | | |
| | | /** 更新者 */ |
| | | private String updateBy; |
| | | |
| | | /** 更新时间 */ |
| | | private Timestamp updateTime; |
| | | |
| | | /** 工资年月 */ |
| | | private String yearMonth; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service.dto; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.modules.system.service.dto.DeptUserNodeDto; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class PayMonthlySalaryGenerateParam implements Serializable { |
| | | |
| | | // 对象年月 |
| | | private String targetYearMonth; |
| | | // 员工ID |
| | | private List<DeptUserNodeDto> nodes; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class PayMonthlySalaryQueryCriteria { |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long userId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String yearMonth; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | import com.alibaba.fastjson.annotation.JSONField; |
| | | import com.alibaba.fastjson.serializer.ToStringSerializer; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class PayMonthlySubsidyDto implements Serializable { |
| | | |
| | | /** ID */ |
| | | /** 防止精度丢失 */ |
| | | @JSONField(serializeUsing = ToStringSerializer.class) |
| | | private Long id; |
| | | |
| | | /** 员工ID */ |
| | | private Long userId; |
| | | |
| | | /** 年月日 */ |
| | | private String date; |
| | | |
| | | /** 补助金额 */ |
| | | private BigDecimal subsidyCost; |
| | | |
| | | /** 备考 */ |
| | | private String remarks; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class PayMonthlySubsidyQueryCriteria{ |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service.impl; |
| | | |
| | | import me.zhengjie.modules.salary.domain.PayMonthlyReimbursement; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.salary.repository.PayMonthlyReimbursementRepository; |
| | | import me.zhengjie.modules.salary.service.PayMonthlyReimbursementService; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlyReimbursementDto; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlyReimbursementQueryCriteria; |
| | | import me.zhengjie.modules.salary.service.mapstruct.PayMonthlyReimbursementMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | 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-05-07 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class PayMonthlyReimbursementServiceImpl implements PayMonthlyReimbursementService { |
| | | |
| | | private final PayMonthlyReimbursementRepository payMonthlyReimbursementRepository; |
| | | private final PayMonthlyReimbursementMapper payMonthlyReimbursementMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(PayMonthlyReimbursementQueryCriteria criteria, Pageable pageable){ |
| | | Page<PayMonthlyReimbursement> page = payMonthlyReimbursementRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(payMonthlyReimbursementMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<PayMonthlyReimbursementDto> queryAll(PayMonthlyReimbursementQueryCriteria criteria){ |
| | | return payMonthlyReimbursementMapper.toDto(payMonthlyReimbursementRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public PayMonthlyReimbursementDto findById(Long id) { |
| | | PayMonthlyReimbursement payMonthlyReimbursement = payMonthlyReimbursementRepository.findById(id).orElseGet(PayMonthlyReimbursement::new); |
| | | ValidationUtil.isNull(payMonthlyReimbursement.getId(),"PayMonthlyReimbursement","id",id); |
| | | return payMonthlyReimbursementMapper.toDto(payMonthlyReimbursement); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public PayMonthlyReimbursementDto create(PayMonthlyReimbursement resources) { |
| | | Snowflake snowflake = IdUtil.createSnowflake(1, 1); |
| | | resources.setId(snowflake.nextId()); |
| | | return payMonthlyReimbursementMapper.toDto(payMonthlyReimbursementRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(PayMonthlyReimbursement resources) { |
| | | PayMonthlyReimbursement payMonthlyReimbursement = payMonthlyReimbursementRepository.findById(resources.getId()).orElseGet(PayMonthlyReimbursement::new); |
| | | ValidationUtil.isNull( payMonthlyReimbursement.getId(),"PayMonthlyReimbursement","id",resources.getId()); |
| | | payMonthlyReimbursement.copy(resources); |
| | | payMonthlyReimbursementRepository.save(payMonthlyReimbursement); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | payMonthlyReimbursementRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<PayMonthlyReimbursementDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (PayMonthlyReimbursementDto payMonthlyReimbursement : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("员工ID", payMonthlyReimbursement.getUserId()); |
| | | map.put("年月日", payMonthlyReimbursement.getDate()); |
| | | map.put("报销金额", payMonthlyReimbursement.getReimbursementCost()); |
| | | map.put("备考", payMonthlyReimbursement.getRemarks()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.attendance.service.AttendanceService; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceQueryCriteria; |
| | | 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.service.dto.ProjectCostOtherDto; |
| | | import me.zhengjie.modules.salary.domain.PayMonthlySalary; |
| | | import me.zhengjie.modules.salary.repository.PayMonthlySalaryRepository; |
| | | import me.zhengjie.modules.salary.service.PayMonthlySalaryService; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySalaryDto; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySalaryGenerateParam; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySalaryQueryCriteria; |
| | | import me.zhengjie.modules.salary.service.mapstruct.PayMonthlySalaryMapper; |
| | | import me.zhengjie.modules.system.domain.Job; |
| | | import me.zhengjie.modules.system.domain.PerformanceCoefficient; |
| | | import me.zhengjie.modules.system.domain.SysConfigHoliday; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.DeptRepository; |
| | | import me.zhengjie.modules.system.repository.PerformanceCoefficientRepository; |
| | | import me.zhengjie.modules.system.repository.SysConfigHolidayRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.DeptService; |
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigHolidayQueryCriteria; |
| | | import me.zhengjie.modules.system.service.dto.UserDto; |
| | | import me.zhengjie.modules.task.service.TaskDaliyService; |
| | | import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria; |
| | | import me.zhengjie.modules.treatment.domain.UserInsurance; |
| | | import me.zhengjie.modules.treatment.domain.UserLevelWage; |
| | | import me.zhengjie.modules.treatment.repository.UserInsuranceRepository; |
| | | import me.zhengjie.modules.treatment.repository.UserLevelWageRepository; |
| | | import me.zhengjie.utils.DateUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class PayMonthlySalaryServiceImpl implements PayMonthlySalaryService { |
| | | |
| | | private final PayMonthlySalaryRepository payMonthlySalaryRepository; |
| | | private final PayMonthlySalaryMapper payMonthlySalaryMapper; |
| | | private final UserRepository userRepository; |
| | | private final UserService userService; |
| | | private final DeptRepository deptRepository; |
| | | private final DeptService deptService; |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository; |
| | | private final AttendanceService attendanceService; |
| | | private final TaskDaliyService taskDaliyService; |
| | | private final UserLevelWageRepository userLevelWageRepository; |
| | | private final UserInsuranceRepository userInsuranceRepository; |
| | | private final PerformanceCoefficientRepository performanceCoefficientRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(PayMonthlySalaryQueryCriteria criteria, Pageable pageable){ |
| | | Page<PayMonthlySalary> page = payMonthlySalaryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | |
| | | // 将实体类转换为DTO(重写) |
| | | Function<PayMonthlySalary, PayMonthlySalaryDto> func = new Function<PayMonthlySalary, PayMonthlySalaryDto>() { |
| | | @Override |
| | | public PayMonthlySalaryDto apply(PayMonthlySalary payMonthlySalary) { |
| | | // 将实体类转换成DTO |
| | | PayMonthlySalaryDto payMonthlySalaryDto = payMonthlySalaryMapper.toDto(payMonthlySalary); |
| | | // 根据员工ID查询用户信息 |
| | | UserDto userDto = userService.findById(payMonthlySalary.getUserId()); |
| | | // 员工名称 |
| | | payMonthlySalaryDto.setNickName(userDto.getNickName()); |
| | | return payMonthlySalaryDto; |
| | | } |
| | | }; |
| | | |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<PayMonthlySalaryDto> queryAll(PayMonthlySalaryQueryCriteria criteria){ |
| | | return payMonthlySalaryMapper.toDto(payMonthlySalaryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public PayMonthlySalaryDto findById(Long id) { |
| | | PayMonthlySalary payMonthlySalary = payMonthlySalaryRepository.findById(id).orElseGet(PayMonthlySalary::new); |
| | | ValidationUtil.isNull(payMonthlySalary.getId(),"PayMonthlySalary","id",id); |
| | | return payMonthlySalaryMapper.toDto(payMonthlySalary); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public PayMonthlySalaryDto create(PayMonthlySalary resources) { |
| | | return payMonthlySalaryMapper.toDto(payMonthlySalaryRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(PayMonthlySalary resources) { |
| | | PayMonthlySalary payMonthlySalary = payMonthlySalaryRepository.findById(resources.getId()).orElseGet(PayMonthlySalary::new); |
| | | ValidationUtil.isNull( payMonthlySalary.getId(),"PayMonthlySalary","id",resources.getId()); |
| | | payMonthlySalary.copy(resources); |
| | | payMonthlySalaryRepository.save(payMonthlySalary); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | payMonthlySalaryRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<PayMonthlySalaryDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (PayMonthlySalaryDto payMonthlySalary : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("员工ID", payMonthlySalary.getUserId()); |
| | | map.put("基本工资", payMonthlySalary.getBasicWage()); |
| | | map.put("业绩工资", payMonthlySalary.getPerformanceWage()); |
| | | map.put("公积金基数", payMonthlySalary.getAccumulationRadix()); |
| | | map.put("公积金个人缴纳比例", payMonthlySalary.getAccumulationPersonalProportion()); |
| | | map.put("公积金个人缴纳金额", payMonthlySalary.getAccumulationPersonalAmount()); |
| | | map.put("公积金公司缴纳比例", payMonthlySalary.getAccumulationCompanyProportion()); |
| | | map.put("公积金公司缴纳金额", payMonthlySalary.getAccumulationCompanyAmount()); |
| | | map.put("养老险基数", payMonthlySalary.getPensionRadix()); |
| | | map.put("养老险个人缴纳比例", payMonthlySalary.getPensionPersonalProportion()); |
| | | map.put("养老险个人缴纳金额", payMonthlySalary.getPensionPersonalAmount()); |
| | | map.put("养老险公司缴纳比例", payMonthlySalary.getPensionCompanyProportion()); |
| | | map.put("养老险公司缴纳金额", payMonthlySalary.getPensionCompanyAmount()); |
| | | map.put("医疗险基数", payMonthlySalary.getMedicalRadix()); |
| | | map.put("医疗险个人缴纳比例", payMonthlySalary.getMedicalPersonalProportion()); |
| | | map.put("医疗险个人缴纳金额", payMonthlySalary.getMedicalPersonalAmount()); |
| | | map.put("医疗险公司缴纳比例", payMonthlySalary.getMedicalCompanyProportion()); |
| | | map.put("医疗险公司缴纳金额", payMonthlySalary.getMedicalCompanyAmount()); |
| | | map.put("失业险基数", payMonthlySalary.getUnemploymentRadix()); |
| | | map.put("失业险个人缴纳比例", payMonthlySalary.getUnemploymentPersonalProportion()); |
| | | map.put("失业险个人缴纳金额", payMonthlySalary.getUnemploymentPersonalAmount()); |
| | | map.put("失业险公司缴纳比例", payMonthlySalary.getUnemploymentCompanyProportion()); |
| | | map.put("失业险公司缴纳金额", payMonthlySalary.getUnemploymentCompanyAmount()); |
| | | map.put("生育险基数", payMonthlySalary.getMaternityRadix()); |
| | | map.put("生育险个人缴纳比例", payMonthlySalary.getMaternityPersonalProportion()); |
| | | map.put("生育险个人缴纳金额", payMonthlySalary.getMaternityPersonalAmount()); |
| | | map.put("生育险公司缴纳比例", payMonthlySalary.getMaternityCompanyProportion()); |
| | | map.put("生育险公司缴纳金额", payMonthlySalary.getMaternityCompanyAmount()); |
| | | map.put("工伤险基数", payMonthlySalary.getIndustrialInjuryRadix()); |
| | | map.put("工伤险个人缴纳比例", payMonthlySalary.getIndustrialInjuryPersonalProportion()); |
| | | map.put("工伤险个人缴纳金额", payMonthlySalary.getIndustrialInjuryPersonalAmount()); |
| | | map.put("工伤险公司缴纳比例", payMonthlySalary.getIndustrialInjuryCompanyProportion()); |
| | | map.put("工伤险公司缴纳金额", payMonthlySalary.getIndustrialInjuryCompanyAmount()); |
| | | map.put("备注", payMonthlySalary.getRemarks()); |
| | | map.put("公示状态", payMonthlySalary.getPublicityStatus()); |
| | | map.put("承认状态", payMonthlySalary.getApproveStatus()); |
| | | map.put("创建者", payMonthlySalary.getCreateBy()); |
| | | map.put("创建时间", payMonthlySalary.getCreateTime()); |
| | | map.put("更新者", payMonthlySalary.getUpdateBy()); |
| | | map.put("更新时间", payMonthlySalary.getUpdateTime()); |
| | | map.put("工资年月", payMonthlySalary.getYearMonth()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void generate(PayMonthlySalaryGenerateParam param) { |
| | | List<User> userList = null; |
| | | List<Long> deptIds = param.getNodes().stream().filter(node -> node.getLeaf() == false).map(node -> node.getId()).collect(Collectors.toList()); |
| | | List<Long> deptIdAlls = deptService.getDeptChildren(deptRepository.findByIdIn(deptIds)); |
| | | userList = userRepository.findByDeptIdInAndEnabled(deptIdAlls, true); |
| | | |
| | | // 节日查询类 |
| | | SysConfigHolidayQueryCriteria sysConfigHolidayQueryCriteria = new SysConfigHolidayQueryCriteria(); |
| | | sysConfigHolidayQueryCriteria.setHolidayDateLike(param.getTargetYearMonth()); |
| | | // 获取某月节日数据 |
| | | List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,sysConfigHolidayQueryCriteria,criteriaBuilder)); |
| | | // 查询某月工作天数 |
| | | Integer fullHours = DateUtil.getWorkDayOfMonth(sysConfigHolidayList, param.getTargetYearMonth()) * 8; |
| | | |
| | | List<Long> userIds = param.getNodes().stream().filter(node -> node.getLeaf() == true).map(node -> node.getId()).collect(Collectors.toList()); |
| | | userList.addAll(userRepository.findByIdIn(userIds)); |
| | | |
| | | userList.stream().forEach(user -> { |
| | | PayMonthlySalary payMonthlySalary = payMonthlySalaryRepository.findByUserIdAndYearMonth(user.getId(), param.getTargetYearMonth()).orElseGet(PayMonthlySalary::new); |
| | | payMonthlySalary.setUserId(user.getId()); |
| | | payMonthlySalary.setYearMonth(param.getTargetYearMonth()); |
| | | payMonthlySalary.setFullHours(new Double(fullHours)); |
| | | |
| | | // 考勤查询类 |
| | | AttendanceQueryCriteria attendanceQueryCriteria = new AttendanceQueryCriteria(); |
| | | attendanceQueryCriteria.setUserId(user.getId()); |
| | | attendanceQueryCriteria.setTargetYearMonth(param.getTargetYearMonth()); |
| | | // 查询某月出勤小时数 |
| | | Double attendanceHours = attendanceService.queryAttendanceHours(attendanceQueryCriteria); |
| | | payMonthlySalary.setAttendanceHours(attendanceHours); |
| | | |
| | | UserLevelWage userLevelWage = userLevelWageRepository.findByUserIdAndYearMonth(user.getId(), param.getTargetYearMonth()); |
| | | |
| | | if (userLevelWage != null) { |
| | | payMonthlySalary.setBasicWage(userLevelWage.getBasicWage().add(userLevelWage.getRankWage())); |
| | | BigDecimal attendanceWage = payMonthlySalary.getBasicWage().multiply(BigDecimal.valueOf(payMonthlySalary.getAttendanceHours())).divide(BigDecimal.valueOf(payMonthlySalary.getFullHours())); |
| | | payMonthlySalary.setActAttendanceWage(attendanceWage); |
| | | |
| | | // 任务日报查询类 |
| | | TaskDaliyQueryCriteria taskDaliyQueryCriteria = new TaskDaliyQueryCriteria(); |
| | | taskDaliyQueryCriteria.setUserId(user.getId()); |
| | | taskDaliyQueryCriteria.setTargetYearMonth(param.getTargetYearMonth()); |
| | | // 查询某月已完成工时 |
| | | Double performanceHours = taskDaliyService.queryCompletedWork(taskDaliyQueryCriteria, false); |
| | | payMonthlySalary.setPerformanceHours(performanceHours); |
| | | payMonthlySalary.setPerformanceWage(userLevelWage.getPerformanceWage()); |
| | | Double coefficient = performanceHours / fullHours; |
| | | |
| | | Long jobId = user.getJobs().toArray(new Job[0])[0].getId(); |
| | | List<PerformanceCoefficient> performanceCoefficientList = performanceCoefficientRepository.findByYearAndJobIdOrderByMultiplesAsc(param.getTargetYearMonth().substring(0, 4), jobId); |
| | | for (PerformanceCoefficient performanceCoefficient : performanceCoefficientList) { |
| | | if (performanceCoefficient.getMultiples().compareTo(BigDecimal.valueOf(coefficient)) > 0) { |
| | | payMonthlySalary.setActPerformanceWage(payMonthlySalary.getPerformanceWage().multiply(performanceCoefficient.getMonthCoefficient())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | Optional<UserInsurance> userInsuranceOpt = userInsuranceRepository.findByUserIdAndYearMonth(user.getId(), param.getTargetYearMonth()); |
| | | if (userInsuranceOpt.isPresent()) { |
| | | UserInsurance userInsurance = userInsuranceOpt.get(); |
| | | payMonthlySalary.setAccumulationRadix(userInsurance.getAccumulationFund()); |
| | | payMonthlySalary.setAccumulationCompanyProportion(userInsurance.getAccumulationFundCompany()); |
| | | payMonthlySalary.setAccumulationCompanyAmount(userInsurance.getAccumulationFund().multiply(BigDecimal.valueOf(userInsurance.getAccumulationFundCompany() / 100))); |
| | | payMonthlySalary.setAccumulationPersonalProportion(userInsurance.getAccumulationFundPersonal()); |
| | | payMonthlySalary.setAccumulationPersonalAmount(userInsurance.getAccumulationFund().multiply(BigDecimal.valueOf(userInsurance.getAccumulationFundPersonal() / 100))); |
| | | |
| | | payMonthlySalary.setMaternityRadix(userInsurance.getBirthInsurance()); |
| | | payMonthlySalary.setMaternityCompanyProportion(userInsurance.getBirthInsuranceCompany()); |
| | | payMonthlySalary.setMaternityCompanyAmount(userInsurance.getBirthInsurance().multiply(BigDecimal.valueOf(userInsurance.getBirthInsuranceCompany() / 100))); |
| | | payMonthlySalary.setMaternityPersonalProportion(userInsurance.getBirthInsurancePersonal()); |
| | | payMonthlySalary.setMaternityPersonalAmount(userInsurance.getBirthInsurance().multiply(BigDecimal.valueOf(userInsurance.getBirthInsurancePersonal() / 100))); |
| | | |
| | | payMonthlySalary.setIndustrialInjuryRadix(userInsurance.getEmploymentInsurance()); |
| | | payMonthlySalary.setIndustrialInjuryCompanyProportion(userInsurance.getEmploymentInsuranceCompany()); |
| | | payMonthlySalary.setIndustrialInjuryCompanyAmount(userInsurance.getEmploymentInsurance().multiply(BigDecimal.valueOf(userInsurance.getEmploymentInsuranceCompany() / 100))); |
| | | payMonthlySalary.setIndustrialInjuryPersonalProportion(userInsurance.getEmploymentInsurancePersonal()); |
| | | payMonthlySalary.setIndustrialInjuryPersonalAmount(userInsurance.getEmploymentInsurance().multiply(BigDecimal.valueOf(userInsurance.getEmploymentInsurancePersonal() / 100))); |
| | | |
| | | payMonthlySalary.setMedicalRadix(userInsurance.getMedicalInsurance()); |
| | | payMonthlySalary.setMedicalCompanyProportion(userInsurance.getMedicalInsuranceCompany()); |
| | | payMonthlySalary.setMedicalCompanyAmount(userInsurance.getMedicalInsurance().multiply(BigDecimal.valueOf(userInsurance.getMedicalInsuranceCompany() / 100))); |
| | | payMonthlySalary.setMedicalPersonalProportion(userInsurance.getMedicalInsurancePersonal()); |
| | | payMonthlySalary.setMedicalPersonalAmount(userInsurance.getMedicalInsurance().multiply(BigDecimal.valueOf(userInsurance.getMedicalInsurancePersonal() / 100))); |
| | | |
| | | payMonthlySalary.setPensionRadix(userInsurance.getRetirementInsurance()); |
| | | payMonthlySalary.setPensionCompanyProportion(userInsurance.getRetirementInsuranceCompany()); |
| | | payMonthlySalary.setPensionCompanyAmount(userInsurance.getRetirementInsurance().multiply(BigDecimal.valueOf(userInsurance.getRetirementInsuranceCompany() / 100))); |
| | | payMonthlySalary.setPensionPersonalProportion(userInsurance.getRetirementInsurancePersonal()); |
| | | payMonthlySalary.setPensionPersonalAmount(userInsurance.getRetirementInsurance().multiply(BigDecimal.valueOf(userInsurance.getRetirementInsurancePersonal() / 100))); |
| | | |
| | | payMonthlySalary.setUnemploymentRadix(userInsurance.getUnemploymentInsurance()); |
| | | payMonthlySalary.setUnemploymentCompanyProportion(userInsurance.getUnemploymentInsuranceCompany()); |
| | | payMonthlySalary.setUnemploymentCompanyAmount(userInsurance.getUnemploymentInsurance().multiply(BigDecimal.valueOf(userInsurance.getUnemploymentInsuranceCompany() / 100))); |
| | | payMonthlySalary.setUnemploymentPersonalProportion(userInsurance.getUnemploymentInsurancePersonal()); |
| | | payMonthlySalary.setUnemploymentPersonalAmount(userInsurance.getUnemploymentInsurance().multiply(BigDecimal.valueOf(userInsurance.getUnemploymentInsurancePersonal() / 100))); |
| | | } |
| | | |
| | | payMonthlySalary.setPublicityStatus(Constant.PUBLICITY_STATUS_NOT); |
| | | payMonthlySalary.setApproveStatus(Constant.APPROVE_STATUS_UNRECOGNIZED); |
| | | payMonthlySalaryRepository.save(payMonthlySalary); |
| | | }); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service.impl; |
| | | |
| | | import me.zhengjie.modules.salary.domain.PayMonthlySubsidy; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.salary.repository.PayMonthlySubsidyRepository; |
| | | import me.zhengjie.modules.salary.service.PayMonthlySubsidyService; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySubsidyDto; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySubsidyQueryCriteria; |
| | | import me.zhengjie.modules.salary.service.mapstruct.PayMonthlySubsidyMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | 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-05-07 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class PayMonthlySubsidyServiceImpl implements PayMonthlySubsidyService { |
| | | |
| | | private final PayMonthlySubsidyRepository payMonthlySubsidyRepository; |
| | | private final PayMonthlySubsidyMapper payMonthlySubsidyMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(PayMonthlySubsidyQueryCriteria criteria, Pageable pageable){ |
| | | Page<PayMonthlySubsidy> page = payMonthlySubsidyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(payMonthlySubsidyMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<PayMonthlySubsidyDto> queryAll(PayMonthlySubsidyQueryCriteria criteria){ |
| | | return payMonthlySubsidyMapper.toDto(payMonthlySubsidyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public PayMonthlySubsidyDto findById(Long id) { |
| | | PayMonthlySubsidy payMonthlySubsidy = payMonthlySubsidyRepository.findById(id).orElseGet(PayMonthlySubsidy::new); |
| | | ValidationUtil.isNull(payMonthlySubsidy.getId(),"PayMonthlySubsidy","id",id); |
| | | return payMonthlySubsidyMapper.toDto(payMonthlySubsidy); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public PayMonthlySubsidyDto create(PayMonthlySubsidy resources) { |
| | | Snowflake snowflake = IdUtil.createSnowflake(1, 1); |
| | | resources.setId(snowflake.nextId()); |
| | | return payMonthlySubsidyMapper.toDto(payMonthlySubsidyRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(PayMonthlySubsidy resources) { |
| | | PayMonthlySubsidy payMonthlySubsidy = payMonthlySubsidyRepository.findById(resources.getId()).orElseGet(PayMonthlySubsidy::new); |
| | | ValidationUtil.isNull( payMonthlySubsidy.getId(),"PayMonthlySubsidy","id",resources.getId()); |
| | | payMonthlySubsidy.copy(resources); |
| | | payMonthlySubsidyRepository.save(payMonthlySubsidy); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | payMonthlySubsidyRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<PayMonthlySubsidyDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (PayMonthlySubsidyDto payMonthlySubsidy : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("员工ID", payMonthlySubsidy.getUserId()); |
| | | map.put("年月日", payMonthlySubsidy.getDate()); |
| | | map.put("补助金额", payMonthlySubsidy.getSubsidyCost()); |
| | | map.put("备考", payMonthlySubsidy.getRemarks()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.salary.domain.PayMonthlyReimbursement; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlyReimbursementDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface PayMonthlyReimbursementMapper extends BaseMapper<PayMonthlyReimbursementDto, PayMonthlyReimbursement> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.salary.domain.PayMonthlySalary; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySalaryDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface PayMonthlySalaryMapper extends BaseMapper<PayMonthlySalaryDto, PayMonthlySalary> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.salary.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.salary.domain.PayMonthlySubsidy; |
| | | import me.zhengjie.modules.salary.service.dto.PayMonthlySubsidyDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface PayMonthlySubsidyMapper extends BaseMapper<PayMonthlySubsidyDto, PayMonthlySubsidy> { |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "岗位名称") |
| | | private String name; |
| | | |
| | | // @Column(name = "`performance_unit_wage`") |
| | | @ApiModelProperty(value = "绩效单金") |
| | | private Long performanceUnitWage = 11250L; |
| | | |
| | | // @Column(name = "`treatment_unit_wage`") |
| | | @ApiModelProperty(value = "五险一金核算单金") |
| | | private Long treatmentUnitWage = 1400L; |
| | | |
| | | @NotNull |
| | | @ApiModelProperty(value = "岗位排序") |
| | | private Long jobSort; |
| New file |
| | |
| | | /* |
| | | * 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 me.zhengjie.base.BaseEntity; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | 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-05-24 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="new_performance_coefficient") |
| | | public class PerformanceCoefficient extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | @Column(name = "`year`") |
| | | @ApiModelProperty(value = "年度") |
| | | private String year; |
| | | |
| | | @Column(name = "`job_id`") |
| | | @ApiModelProperty(value = "职能队列") |
| | | private Long jobId; |
| | | |
| | | @Column(name = "`multiples`") |
| | | @ApiModelProperty(value = "multiples") |
| | | private BigDecimal multiples; |
| | | |
| | | @Column(name = "`month_coefficient`") |
| | | @ApiModelProperty(value = "monthCoefficient") |
| | | private BigDecimal monthCoefficient; |
| | | |
| | | @Column(name = "`quarter_coefficient`") |
| | | @ApiModelProperty(value = "quarterCoefficient") |
| | | private BigDecimal quarterCoefficient; |
| | | |
| | | @Column(name = "`year_coefficient`") |
| | | @ApiModelProperty(value = "yearCoefficient") |
| | | private BigDecimal yearCoefficient; |
| | | |
| | | public void copy(PerformanceCoefficient source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| | |
| | | private Timestamp birthday; |
| | | |
| | | // 魏传栋 - 始 |
| | | @Column(name = "company_id") |
| | | @JoinColumn(name = "company_id") |
| | | @ManyToOne |
| | | @ApiModelProperty(value = "所属公司Id") |
| | | private Long companyId; |
| | | private SysCompany company; |
| | | // 魏传栋 - 终 |
| | | |
| | | @Email |
| | |
| | | * @return / |
| | | */ |
| | | List<Dept> findByPid(Long id); |
| | | |
| | | /** |
| | | * 根据 ID 查询 |
| | | * @param id |
| | | * @return / |
| | | */ |
| | | List<Dept> findByIdIn(List<Long> ids); |
| | | |
| | | /** |
| | | * 获取顶级部门 |
| New file |
| | |
| | | /* |
| | | * 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.PerformanceCoefficient; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-24 |
| | | **/ |
| | | public interface PerformanceCoefficientRepository extends JpaRepository<PerformanceCoefficient, Long>, JpaSpecificationExecutor<PerformanceCoefficient> { |
| | | |
| | | void deleteByYearAndJobId(String year, Long jobId); |
| | | |
| | | List<PerformanceCoefficient> findByYearAndJobId(String year, Long jobId); |
| | | |
| | | List<PerformanceCoefficient> findByYearAndJobIdOrderByMultiplesAsc(String year, Long jobId); |
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.Dept; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | |
| | | */ |
| | | @Query(value = "SELECT count(1) FROM sys_user WHERE level_id IN ?1", nativeQuery = true) |
| | | int countByLevels(Long[] ids); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param userIds |
| | | * @return |
| | | */ |
| | | List<User> findByIdIn(List<Long> userIds); |
| | | |
| | | /** |
| | | * 根据部门查询 |
| | | * @param dept |
| | | * @return |
| | | */ |
| | | List<User> findByDeptAndEnabled(Dept dept, Boolean enabled); |
| | | |
| | | @Query(value = "SELECT * FROM sys_user WHERE dept_id IN ?1 AND enabled = ?2", nativeQuery = true) |
| | | List<User> findByDeptIdInAndEnabled(List<Long> deptIds, Boolean enabled); |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.PerformanceCoefficient; |
| | | import me.zhengjie.modules.system.service.PerformanceCoefficientService; |
| | | import me.zhengjie.modules.system.service.dto.PerformanceCoefficientGenerateParam; |
| | | import me.zhengjie.modules.system.service.dto.PerformanceCoefficientQueryCriteria; |
| | | 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-05-24 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "绩效系数管理") |
| | | @RequestMapping("/api/performanceCoefficient") |
| | | public class PerformanceCoefficientController { |
| | | |
| | | private final PerformanceCoefficientService performanceCoefficientService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('performanceCoefficient:list')") |
| | | public void exportPerformanceCoefficient(HttpServletResponse response, PerformanceCoefficientQueryCriteria criteria) throws IOException { |
| | | performanceCoefficientService.download(performanceCoefficientService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询绩效系数") |
| | | @ApiOperation("查询绩效系数") |
| | | @PreAuthorize("@el.check('performanceCoefficient:list')") |
| | | public ResponseEntity<Object> queryPerformanceCoefficient(PerformanceCoefficientQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(performanceCoefficientService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增绩效系数") |
| | | @ApiOperation("新增绩效系数") |
| | | @PreAuthorize("@el.check('performanceCoefficient:add')") |
| | | public ResponseEntity<Object> createPerformanceCoefficient(@Validated @RequestBody PerformanceCoefficient resources){ |
| | | return new ResponseEntity<>(performanceCoefficientService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PostMapping(value = "/generate") |
| | | @Log("新增绩效系数") |
| | | @ApiOperation("新增绩效系数") |
| | | @PreAuthorize("@el.check('performanceCoefficient:add')") |
| | | public ResponseEntity<Object> uploadPerformanceCoefficient(@Validated @RequestBody PerformanceCoefficientGenerateParam resources) { |
| | | performanceCoefficientService.generate(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改绩效系数") |
| | | @ApiOperation("修改绩效系数") |
| | | @PreAuthorize("@el.check('performanceCoefficient:edit')") |
| | | public ResponseEntity<Object> updatePerformanceCoefficient(@Validated @RequestBody PerformanceCoefficient resources){ |
| | | performanceCoefficientService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除绩效系数") |
| | | @ApiOperation("删除绩效系数") |
| | | @PreAuthorize("@el.check('performanceCoefficient:del')") |
| | | public ResponseEntity<Object> deletePerformanceCoefficient(@RequestBody Long[] ids) { |
| | | performanceCoefficientService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @PostMapping(value = "/getCompName") |
| | | @Log("选择用户改变公司") |
| | | @ApiOperation("选择用户改变公司") |
| | | public ResponseEntity<Object> getCompName(@Validated @RequestBody SysCompanyDto resources){ |
| | | return new ResponseEntity<>(sysCompanyService.getCompName(resources), HttpStatus.OK); |
| | | } |
| | | // /** |
| | | // * 选择用户改变公司 |
| | | // * @return |
| | | // * @throws Exception |
| | | // */ |
| | | // @PostMapping(value = "/getCompName") |
| | | // @Log("选择用户改变公司") |
| | | // @ApiOperation("选择用户改变公司") |
| | | // public ResponseEntity<Object> getCompName(@Validated @RequestBody SysCompanyDto resources){ |
| | | // return new ResponseEntity<>(sysCompanyService.getCompName(resources), HttpStatus.OK); |
| | | // } |
| | | } |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.annotation.AnonymousAccess; |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.config.RsaProperties; |
| | | import me.zhengjie.modules.system.domain.Dept; |
| | |
| | | import me.zhengjie.modules.system.service.DeptService; |
| | | import me.zhengjie.modules.system.service.RoleService; |
| | | import me.zhengjie.modules.system.service.dto.DeptDto; |
| | | import me.zhengjie.modules.system.service.dto.DeptUserNodeDto; |
| | | import me.zhengjie.modules.system.service.dto.RoleSmallDto; |
| | | import me.zhengjie.modules.system.service.dto.UserDto; |
| | | import me.zhengjie.modules.system.service.dto.UserQueryCriteria; |
| | |
| | | public void exportUser(HttpServletResponse response, UserQueryCriteria criteria) throws IOException { |
| | | userService.download(userService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping(value = "/dept/{deptId}") |
| | | @AnonymousAccess |
| | | public ResponseEntity<Object> queryDeptUserByDeptId(@PathVariable Long deptId) { |
| | | return new ResponseEntity<>(userService.queryDeptUserByDeptId(deptId), HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询用户") |
| New file |
| | |
| | | /* |
| | | * 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.PerformanceCoefficient; |
| | | import me.zhengjie.modules.system.service.dto.PerformanceCoefficientDto; |
| | | import me.zhengjie.modules.system.service.dto.PerformanceCoefficientGenerateParam; |
| | | import me.zhengjie.modules.system.service.dto.PerformanceCoefficientQueryCriteria; |
| | | 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-05-24 |
| | | **/ |
| | | public interface PerformanceCoefficientService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(PerformanceCoefficientQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<PerformanceCoefficientDto> |
| | | */ |
| | | List<PerformanceCoefficientDto> queryAll(PerformanceCoefficientQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return PerformanceCoefficientDto |
| | | */ |
| | | PerformanceCoefficientDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return PerformanceCoefficientDto |
| | | */ |
| | | PerformanceCoefficientDto create(PerformanceCoefficient resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(PerformanceCoefficient resources); |
| | | |
| | | void generate(PerformanceCoefficientGenerateParam resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<PerformanceCoefficientDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| | |
| | | */ |
| | | void download(List<SysCompanyDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | SysCompany getCompName(SysCompanyDto resources); |
| | | // /** |
| | | // * 选择用户改变公司 |
| | | // * @param resources |
| | | // * @return |
| | | // */ |
| | | // SysCompany getCompName(SysCompanyDto resources); |
| | | } |
| | |
| | | |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.domain.vo.CalendarVo; |
| | | import me.zhengjie.modules.system.service.dto.DeptUserNodeDto; |
| | | import me.zhengjie.modules.system.service.dto.UserDto; |
| | | import me.zhengjie.modules.system.service.dto.UserLoginDto; |
| | | import me.zhengjie.modules.system.service.dto.UserQueryCriteria; |
| | |
| | | */ |
| | | Map getUserBaseInfo(Date yearMonth) throws ParseException; |
| | | |
| | | |
| | | List<DeptUserNodeDto> queryDeptUserByDeptId(Long deptId); |
| | | |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.system.service.dto; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * @author Zheng Jie |
| | | * @date 2019-04-10 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class DeptUserNodeDto implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | private String label; |
| | | |
| | | private Boolean leaf; |
| | | |
| | | } |
| | |
| | | |
| | | private String name; |
| | | |
| | | private Boolean enabled; |
| | | private Long performanceUnitWage; |
| | | |
| | | public JobDto(String name, Boolean enabled) { |
| | | this.name = name; |
| | | this.enabled = enabled; |
| | | } |
| | | private Long treatmentUnitWage; |
| | | |
| | | private Boolean enabled; |
| | | } |
| | |
| | | private Long id; |
| | | |
| | | private String name; |
| | | |
| | | private Long performanceUnitWage; |
| | | |
| | | private Long treatmentUnitWage; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-24 |
| | | **/ |
| | | @Data |
| | | public class PerformanceCoefficientDto implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | /** 年度 */ |
| | | private String year; |
| | | |
| | | /** 岗位 */ |
| | | private Long jobId; |
| | | |
| | | /** 岗位名称 */ |
| | | private String jobName; |
| | | |
| | | private BigDecimal multiples; |
| | | |
| | | private BigDecimal monthCoefficient; |
| | | |
| | | private BigDecimal quarterCoefficient; |
| | | |
| | | private BigDecimal yearCoefficient; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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 java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.modules.system.domain.PerformanceCoefficient; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-24 |
| | | **/ |
| | | @Data |
| | | public class PerformanceCoefficientGenerateParam implements Serializable { |
| | | |
| | | /** 年度 */ |
| | | private String year; |
| | | |
| | | /** 岗位 */ |
| | | private Long jobId; |
| | | |
| | | /** 绩效系数 */ |
| | | private List<PerformanceCoefficient> performanceCofficientList; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-24 |
| | | **/ |
| | | @Data |
| | | public class PerformanceCoefficientQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String year; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long jobId; |
| | | } |
| | |
| | | |
| | | /** 标签 */ |
| | | private String label; |
| | | |
| | | /** 用户id */ |
| | | private Long userId; |
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | |
| | | import com.alibaba.fastjson.annotation.JSONField; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import me.zhengjie.base.BaseDTO; |
| | | import me.zhengjie.modules.system.domain.SysRostering; |
| | | |
| | | import java.io.Serializable; |
| | | import java.sql.Timestamp; |
| | | import java.util.Date; |
| | | import java.util.Set; |
| | | |
| | | import com.alibaba.fastjson.annotation.JSONField; |
| | | |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | /** |
| | | * @author Zheng Jie |
| | |
| | | private Date pwdResetTime; |
| | | |
| | | // 魏传栋 - 始 |
| | | private Long companyId; |
| | | private SysCompanyDto company; |
| | | // 魏传栋 - 终 |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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 java.io.Serializable; |
| | | |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | /** |
| | | * @author Zheng Jie |
| | | * @date 2018-11-23 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class UserSmallDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | private Long deptId; |
| | | |
| | | private String nickName; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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 java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.system.domain.Job; |
| | | import me.zhengjie.modules.system.domain.PerformanceCoefficient; |
| | | import me.zhengjie.modules.system.repository.JobRepository; |
| | | import me.zhengjie.modules.system.repository.PerformanceCoefficientRepository; |
| | | import me.zhengjie.modules.system.service.PerformanceCoefficientService; |
| | | import me.zhengjie.modules.system.service.dto.PerformanceCoefficientDto; |
| | | import me.zhengjie.modules.system.service.dto.PerformanceCoefficientGenerateParam; |
| | | import me.zhengjie.modules.system.service.dto.PerformanceCoefficientQueryCriteria; |
| | | import me.zhengjie.modules.system.service.mapstruct.PerformanceCoefficientMapper; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 姚增春 |
| | | * @date 2023-05-24 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class PerformanceCoefficientServiceImpl implements PerformanceCoefficientService { |
| | | |
| | | private final PerformanceCoefficientRepository performanceCoefficientRepository; |
| | | private final PerformanceCoefficientMapper performanceCoefficientMapper; |
| | | private final JobRepository jobRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(PerformanceCoefficientQueryCriteria criteria, Pageable pageable){ |
| | | Page<PerformanceCoefficient> page = performanceCoefficientRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<PerformanceCoefficient, PerformanceCoefficientDto> func = new Function<PerformanceCoefficient, PerformanceCoefficientDto>(){ |
| | | @Override |
| | | public PerformanceCoefficientDto apply(PerformanceCoefficient t) { |
| | | // 将实体类转换成DTO |
| | | PerformanceCoefficientDto performanceCoefficientDto = performanceCoefficientMapper.toDto(t); |
| | | // 根据用户ID查询用户信息 |
| | | Job job = jobRepository.findById(t.getJobId()).orElseGet(Job::new); |
| | | ValidationUtil.isNull(job.getId(),"Job","id", t.getJobId()); |
| | | // 岗位名称 |
| | | performanceCoefficientDto.setJobName(job.getName()); |
| | | // 返回处理好的DTO |
| | | return performanceCoefficientDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<PerformanceCoefficientDto> queryAll(PerformanceCoefficientQueryCriteria criteria){ |
| | | return performanceCoefficientMapper.toDto(performanceCoefficientRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public PerformanceCoefficientDto findById(Long id) { |
| | | PerformanceCoefficient performanceCoefficient = performanceCoefficientRepository.findById(id).orElseGet(PerformanceCoefficient::new); |
| | | ValidationUtil.isNull(performanceCoefficient.getId(),"PerformanceCoefficient","id",id); |
| | | return performanceCoefficientMapper.toDto(performanceCoefficient); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public PerformanceCoefficientDto create(PerformanceCoefficient resources) { |
| | | return performanceCoefficientMapper.toDto(performanceCoefficientRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(PerformanceCoefficient resources) { |
| | | PerformanceCoefficient performanceCoefficient = performanceCoefficientRepository.findById(resources.getId()).orElseGet(PerformanceCoefficient::new); |
| | | ValidationUtil.isNull( performanceCoefficient.getId(),"PerformanceCoefficient","id",resources.getId()); |
| | | performanceCoefficient.copy(resources); |
| | | performanceCoefficientRepository.save(performanceCoefficient); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | performanceCoefficientRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<PerformanceCoefficientDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (PerformanceCoefficientDto performanceCoefficient : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("年度", performanceCoefficient.getYear()); |
| | | map.put(" multiples", performanceCoefficient.getMultiples()); |
| | | map.put(" monthCoefficient", performanceCoefficient.getMonthCoefficient()); |
| | | map.put(" quarterCoefficient", performanceCoefficient.getQuarterCoefficient()); |
| | | map.put(" yearCoefficient", performanceCoefficient.getYearCoefficient()); |
| | | map.put("职能队列", performanceCoefficient.getJobId()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | @Override |
| | | public void generate(PerformanceCoefficientGenerateParam resources) { |
| | | performanceCoefficientRepository.deleteByYearAndJobId(resources.getYear(), resources.getJobId()); |
| | | for (PerformanceCoefficient performanceCoefficient : resources.getPerformanceCofficientList()) { |
| | | performanceCoefficient.setYear(resources.getYear()); |
| | | performanceCoefficient.setJobId(resources.getJobId()); |
| | | performanceCoefficientRepository.save(performanceCoefficient); |
| | | } |
| | | } |
| | | } |
| | |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | @Override |
| | | public SysCompany getCompName(SysCompanyDto resources) { |
| | | // 查询用户表 |
| | | User user = userRepository.findById(Long.valueOf(resources.getUserId())).orElseGet(User::new); |
| | | // 查询公司表 |
| | | SysCompany sysCompany = sysCompanyRepository.findById(user.getId()).orElseGet(SysCompany::new); |
| | | return sysCompany; |
| | | } |
| | | // /** |
| | | // * 选择用户改变公司 |
| | | // * @param resources |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public SysCompany getCompName(SysCompanyDto resources) { |
| | | // // 查询用户表 |
| | | // User user = userRepository.findById(Long.valueOf(resources.getUserId())).orElseGet(User::new); |
| | | // // 查询公司表 |
| | | // SysCompany sysCompany = sysCompanyRepository.findById(user.getId()).orElseGet(SysCompany::new); |
| | | // return sysCompany; |
| | | // } |
| | | } |
| | |
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository; |
| | | private final SysCompanyRepository sysCompanyRepository; |
| | | private final TaskDaliyService taskDaliyService; |
| | | private final DeptRepository deptRepository; |
| | | |
| | | @Override |
| | | public Object queryAll(UserQueryCriteria criteria, Pageable pageable) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<DeptUserNodeDto> queryDeptUserByDeptId(Long deptId) { |
| | | List<DeptUserNodeDto> result = new ArrayList<DeptUserNodeDto>(); |
| | | Optional<Dept> deptOpt = deptRepository.findById(deptId); |
| | | if (deptOpt.isPresent()) { |
| | | Dept dept = deptOpt.get(); |
| | | List<Dept> subDeptList = deptRepository.findByPid(deptId); |
| | | subDeptList.forEach(subDept -> { |
| | | DeptUserNodeDto deptUserNodeDto = new DeptUserNodeDto(); |
| | | deptUserNodeDto.setId(subDept.getId()); |
| | | deptUserNodeDto.setLabel(subDept.getName()); |
| | | deptUserNodeDto.setLeaf(false); |
| | | result.add(deptUserNodeDto); |
| | | }); |
| | | List<User> userList = userRepository.findByDeptAndEnabled(dept, true); |
| | | userList.forEach(user -> { |
| | | DeptUserNodeDto deptUserNodeDto = new DeptUserNodeDto(); |
| | | deptUserNodeDto.setId(user.getId()); |
| | | deptUserNodeDto.setLabel(user.getNickName()); |
| | | deptUserNodeDto.setLeaf(true); |
| | | result.add(deptUserNodeDto); |
| | | }); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | @Cacheable(key = "'total'") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public List<UserDto> queryAll(UserQueryCriteria criteria) { |
| | | // 日历类 |
| | | Calendar calendar = Calendar.getInstance(); |
| | |
| | | if (userRepository.findByPhone(resources.getPhone()) != null) { |
| | | throw new EntityExistException(User.class, "phone", resources.getPhone()); |
| | | } |
| | | redisUtils.del(CacheKey.TOTAL_USER); |
| | | userRepository.save(resources); |
| | | // 判断用户级别变更 |
| | | checkUserLevel(resources.getId(), null, resources.getLevelId()); |
| | |
| | | user.setJobs(resources.getJobs()); |
| | | user.setPhone(resources.getPhone()); |
| | | user.setNickName(resources.getNickName()); |
| | | user.setCompanyId(resources.getCompanyId()); |
| | | user.setCompany(resources.getCompany()); |
| | | user.setGender(resources.getGender()); |
| | | user.setBirthday(resources.getBirthday()); |
| | | user.setAddress(resources.getAddress()); |
| | |
| | | UserDto user = findById(id); |
| | | delCaches(user.getId(), user.getUsername()); |
| | | } |
| | | redisUtils.del(CacheKey.TOTAL_USER); |
| | | userRepository.deleteAllByIdIn(ids); |
| | | } |
| | | |
| | |
| | | for (UserDto userDTO : queryAll) { |
| | | List<String> roles = userDTO.getRoles().stream().map(RoleSmallDto::getName).collect(Collectors.toList()); |
| | | String levelName = userDTO.getLevelId() != null ? sysLevelRepository.findById(userDTO.getLevelId()).orElseGet(SysLevel::new).getName() : ""; |
| | | SysCompany sysCompany = sysCompanyRepository.findById(userDTO.getCompanyId()).orElseGet(SysCompany::new); |
| | | SysCompany sysCompany = sysCompanyRepository.findById(userDTO.getCompany().getId()).orElseGet(SysCompany::new); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("用户名", userDTO.getUsername()); |
| | | map.put("角色", roles); |
| New file |
| | |
| | | /* |
| | | * 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.PerformanceCoefficient; |
| | | import me.zhengjie.modules.system.service.dto.PerformanceCoefficientDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-24 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface PerformanceCoefficientMapper extends BaseMapper<PerformanceCoefficientDto, PerformanceCoefficient> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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 org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.service.dto.UserSmallDto; |
| | | |
| | | /** |
| | | * @author Zheng Jie |
| | | * @date 2019-03-25 |
| | | */ |
| | | @Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface UserSmallMapper extends BaseMapper<UserSmallDto, User> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.task.domain; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.annotation.Version; |
| | | import org.springframework.data.mongodb.core.mapping.DBRef; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2022-12-27 |
| | | **/ |
| | | @Data |
| | | public class TaskAggrMongo implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "任务个数") |
| | | private Long count; |
| | | |
| | | @ApiModelProperty(value = "计划工时") |
| | | private Double planHours; |
| | | |
| | | @ApiModelProperty(value = "任务状态") |
| | | private String taskStatus; |
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.task.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.io.Serializable; |
| | | 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.Table; |
| | | 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 |
| | |
| | | @Column(name = "`fill_date`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "填写日期") |
| | | private Timestamp fillDate; |
| | | private Date fillDate; |
| | | |
| | | @Column(name = "`consumed_hours`",nullable = false) |
| | | @NotNull |
| New file |
| | |
| | | /* |
| | | * 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.task.domain; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2022-12-30 |
| | | **/ |
| | | @Data |
| | | @Document("task_daliy") |
| | | public class TaskDaliyMongo implements Serializable { |
| | | |
| | | // @Id |
| | | // @ApiModelProperty(value = "ID") |
| | | // private String id; |
| | | // |
| | | // @ApiModelProperty(value = "项目ID") |
| | | // private Long projectId; |
| | | // |
| | | // @ApiModelProperty(value = "任务ID") |
| | | // private String taskId; |
| | | // |
| | | // @ApiModelProperty(value = "员工ID") |
| | | // private Long userId; |
| | | |
| | | @ApiModelProperty(value = "填写日期") |
| | | private Date fillDate; |
| | | |
| | | @ApiModelProperty(value = "消耗工时") |
| | | private Double consumedHours; |
| | | |
| | | @ApiModelProperty(value = "任务进度") |
| | | private Double taskProgress; |
| | | |
| | | @ApiModelProperty(value = "结算状态") |
| | | private String settlementStatus; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.task.domain; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.annotation.Version; |
| | | import org.springframework.data.mongodb.core.mapping.DBRef; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2022-12-27 |
| | | **/ |
| | | @Data |
| | | @Document("task") |
| | | public class TaskMongo implements Serializable { |
| | | |
| | | @Id |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "项目ID") |
| | | private Long projectId; |
| | | |
| | | @ApiModelProperty(value = "名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "父任务") |
| | | @DBRef |
| | | private TaskMongo parent; |
| | | |
| | | private List<Long> userIdList = new ArrayList<Long>(); |
| | | |
| | | private List<String> tagList = new ArrayList<String>(); |
| | | |
| | | @ApiModelProperty(value = "绩效类型") |
| | | private String performanceType; |
| | | |
| | | @ApiModelProperty(value = "计划开始时间") |
| | | private Date planStartTime; |
| | | |
| | | @ApiModelProperty(value = "计划结束时间") |
| | | private Date planEndTime; |
| | | |
| | | @ApiModelProperty(value = "计划工时") |
| | | private Double planHours; |
| | | |
| | | @ApiModelProperty(value = "任务状态") |
| | | private String taskStatus; |
| | | |
| | | @ApiModelProperty(value = "描述") |
| | | private String description; |
| | | |
| | | @Version |
| | | private Long version; |
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.task.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.io.Serializable; |
| | | 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.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 |
| | |
| | | @Column(name = "`task_start_date`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "任务开始时间") |
| | | private Timestamp taskStartDate; |
| | | private Date taskStartDate; |
| | | |
| | | @Column(name = "`task_end_date`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "任务结束时间") |
| | | private Timestamp taskEndDate; |
| | | private Date taskEndDate; |
| | | |
| | | @Column(name = "`task_hours`",nullable = false) |
| | | @NotNull |
| New file |
| | |
| | | /* |
| | | * 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.task.domain; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.DBRef; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2022-12-28 |
| | | **/ |
| | | @Data |
| | | @Document("task_user") |
| | | public class TaskUserMongo implements Serializable { |
| | | |
| | | @Id |
| | | @ApiModelProperty(value = "ID") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "任务ID") |
| | | @DBRef |
| | | private TaskMongo task; |
| | | |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "任务分类") |
| | | private String taskClassification; |
| | | |
| | | @ApiModelProperty(value = "绩效类型") |
| | | private String performanceType; |
| | | |
| | | @ApiModelProperty(value = "用户ID") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "任务开始时间") |
| | | private Date taskStartDate; |
| | | |
| | | @ApiModelProperty(value = "任务结束时间") |
| | | private Date taskEndDate; |
| | | |
| | | @ApiModelProperty(value = "优先度") |
| | | private String priority; |
| | | |
| | | private List<TaskDaliyMongo> taskDaliyList = new LinkedList<TaskDaliyMongo>(); |
| | | |
| | | @ApiModelProperty(value = "任务工时") |
| | | private Double taskHours; |
| | | |
| | | @ApiModelProperty(value = "绩效工时") |
| | | private Double performanceHours; |
| | | |
| | | @ApiModelProperty(value = "任务状态") |
| | | private String taskStatus; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.task.repository; |
| | | |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import java.sql.Timestamp; |
| | | import java.time.LocalDate; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * FROM task_daliy WHERE project_id = ?1 AND task_id = ?2 AND user_id = ?3 AND fill_date < ?4 ORDER BY fill_date DESC LIMIT 1", nativeQuery = true) |
| | | TaskDaliy findPreviousByProjectIdAndTaskIdAndAndUserId(Long projectId, Long taskId, Long userId, Timestamp fillDate); |
| | | TaskDaliy findPreviousByProjectIdAndTaskIdAndAndUserId(Long projectId, Long taskId, Long userId, Date fillDate); |
| | | |
| | | /** |
| | | * 根据项目ID、任务ID、用户ID查询填报日期后最近的任务日报信息 |
| | |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * FROM task_daliy WHERE project_id = ?1 AND task_id = ?2 AND user_id = ?3 AND fill_date > ?4 ORDER BY fill_date ASC LIMIT 1", nativeQuery = true) |
| | | TaskDaliy findNextByProjectIdAndTaskIdAndAndUserId(Long projectId, Long taskId, Long userId, Timestamp fillDate); |
| | | TaskDaliy findNextByProjectIdAndTaskIdAndAndUserId(Long projectId, Long taskId, Long userId, Date 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) |
| | |
| | | * @return |
| | | */ |
| | | List<TaskDaliy> findByProjectIdAndTaskIdAndUserId(Long projectId, Long taskId, Long userId); |
| | | |
| | | /** |
| | | * 根据项目ID、任务ID、用户ID查询 |
| | | * @param projectId |
| | | * @param taskId |
| | | * @return |
| | | */ |
| | | List<TaskDaliy> findByProjectIdAndTaskIdAndUserIdOrderByFillDateDesc(Long projectId, Long taskId, Long userId); |
| | | |
| | | /** |
| | | * 根据项目ID查询任务日报信息 |
| | |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @param projectId |
| | | */ |
| | | void deleteByProjectId(Long projectId); |
| | | |
| | | List<TaskUser> findByTaskId(Long id); |
| | | } |
| | |
| | | package me.zhengjie.modules.task.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.domain.TaskMongo; |
| | | import me.zhengjie.modules.task.service.TaskService; |
| | | import me.zhengjie.modules.task.service.TaskUserService; |
| | | import me.zhengjie.modules.task.service.dto.TaskQueryCriteria; |
| | | import me.zhengjie.modules.task.service.dto.TaskUserDto; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | public class TaskController { |
| | | |
| | | private final TaskService taskService; |
| | | private final TaskUserService taskUserService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('task:download')") |
| | | public void exportTask(HttpServletResponse response, TaskQueryCriteria criteria) throws IOException { |
| | | taskService.download(taskService.queryAll(criteria), response); |
| | | // taskService.download(taskService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询任务") |
| | | @ApiOperation("查询任务") |
| | | @PreAuthorize("@el.check('task:list')") |
| | | public ResponseEntity<Object> queryTask(TaskQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(taskService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | public ResponseEntity<Object> queryTask(TaskQueryCriteria criteria, Pageable pageable) { |
| | | return new ResponseEntity<>(taskService.queryAll(criteria, pageable), HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/tags") |
| | | @Log("查询任务") |
| | | @ApiOperation("查询任务") |
| | | @PreAuthorize("@el.check('task:list')") |
| | | public ResponseEntity<Object> queryAllTags(String tagName){ |
| | | return new ResponseEntity<>(taskService.getAllTags(tagName), HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/names") |
| | | @Log("查询任务") |
| | | @ApiOperation("查询任务") |
| | | @PreAuthorize("@el.check('task:list')") |
| | | public ResponseEntity<Object> queryAllNames(Long projectId, String name){ |
| | | return new ResponseEntity<>(taskService.getAllNames(projectId, name), HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | |
| | | @Log("新增任务") |
| | | @ApiOperation("新增任务") |
| | | @PreAuthorize("@el.check('task:add')") |
| | | public ResponseEntity<Object> createTask(@Validated @RequestBody Task resources){ |
| | | public ResponseEntity<Object> createTask(@Validated @RequestBody TaskMongo resources){ |
| | | return new ResponseEntity<>(taskService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | |
| | | @Log("修改任务") |
| | | @ApiOperation("修改任务") |
| | | @PreAuthorize("@el.check('task:edit')") |
| | | public ResponseEntity<Object> updateTask(@Validated @RequestBody Task resources){ |
| | | taskService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | public ResponseEntity<Object> updateTask(@Validated @RequestBody TaskMongo resources){ |
| | | return new ResponseEntity<>(taskService.update(resources), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除任务") |
| | | @ApiOperation("删除任务") |
| | | @PreAuthorize("@el.check('task:del')") |
| | | public ResponseEntity<Object> deleteTask(@RequestBody Long[] ids) { |
| | | taskService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | public ResponseEntity<Object> deleteTask(@RequestBody String[] ids) { |
| | | return new ResponseEntity<>(taskService.deleteAll(ids), HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping(value = "/divide") |
| | | @Log("分配任务") |
| | | @ApiOperation("分配任务") |
| | | @PreAuthorize("@el.check('task:divide')") |
| | | public ResponseEntity<Object> divideTask(@Validated @RequestBody TaskUserDto resources) throws Exception { |
| | | taskUserService.divide(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @GetMapping(value = "/partake") |
| | | @Log("查询参与的任务") |
| | | @ApiOperation("查询参与的任务") |
| | | @PreAuthorize("@el.check('task:list')") |
| | | public ResponseEntity<Object> queryPartakeTaskAll(TaskQueryCriteria criteria){ |
| | | return new ResponseEntity<>(taskService.queryPartakeAll(criteria),HttpStatus.OK); |
| | | } |
| | | // @PostMapping(value = "/divide") |
| | | // @Log("分配任务") |
| | | // @ApiOperation("分配任务") |
| | | // @PreAuthorize("@el.check('task:divide')") |
| | | // public ResponseEntity<Object> divideTask(@Validated @RequestBody TaskUserDto resources) throws Exception { |
| | | // taskUserService.divide(resources); |
| | | // return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | // } |
| | | // |
| | | // @GetMapping(value = "/partake") |
| | | // @Log("查询参与的任务") |
| | | // @ApiOperation("查询参与的任务") |
| | | // @PreAuthorize("@el.check('task:list')") |
| | | // public ResponseEntity<Object> queryPartakeTaskAll(TaskQueryCriteria criteria){ |
| | | // return new ResponseEntity<>(taskService.queryPartakeAll(criteria),HttpStatus.OK); |
| | | // } |
| | | } |
| | |
| | | public ResponseEntity<Object> queryTaskUser(TaskUserQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(taskUserService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/sum") |
| | | @PreAuthorize("@el.check('taskUser:list')") |
| | | public ResponseEntity<Object> sumTotalByTask(String taskId) { |
| | | return new ResponseEntity<>(taskUserService.sumTotalByTask(taskId), HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询任务分配") |
| | |
| | | package me.zhengjie.modules.task.service; |
| | | |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.domain.TaskMongo; |
| | | import me.zhengjie.modules.task.service.dto.TaskDto; |
| | | import me.zhengjie.modules.task.service.dto.TaskMongoDto; |
| | | import me.zhengjie.modules.task.service.dto.TaskQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | |
| | | * @param criteria 条件参数 |
| | | * @return List<TaskDto> |
| | | */ |
| | | List<TaskDto> queryAll(TaskQueryCriteria criteria); |
| | | List<TaskMongo> queryAll(TaskQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 任务二次处理 |
| | |
| | | * @param criteria 条件参数 |
| | | * @return List<TaskDto> |
| | | */ |
| | | List<TaskDto> queryChildren(TaskQueryCriteria criteria); |
| | | List<TaskMongoDto> queryChildren(TaskQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return TaskDto |
| | | * @return TaskMongo |
| | | */ |
| | | TaskDto create(Task resources); |
| | | TaskMongo create(TaskMongo resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(Task resources); |
| | | TaskMongo update(TaskMongo resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | Boolean deleteAll(String[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | |
| | | */ |
| | | void download(List<TaskDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 查询所有参与的数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<ProjectDto> |
| | | */ |
| | | List<TaskDto> queryPartakeAll(TaskQueryCriteria criteria); |
| | | // /** |
| | | // * 查询所有参与的数据不分页 |
| | | // * @param criteria 条件参数 |
| | | // * @return List<ProjectDto> |
| | | // */ |
| | | // List<TaskDto> queryPartakeAll(TaskQueryCriteria criteria); |
| | | |
| | | List getAllTags(String tagName); |
| | | |
| | | List<Map<String, String>> getAllNames(Long projectId, String name); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<Long> queryTaskUserIds(TaskUserQueryCriteria criteria); |
| | | |
| | | List<Map> sumTotalByTask(String taskId); |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.task.service.dto; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.modules.task.domain.TaskMongo; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2022-12-27 |
| | | **/ |
| | | @Data |
| | | public class TaskMongoDto implements Serializable { |
| | | |
| | | /** ID */ |
| | | private String id; |
| | | |
| | | /** 项目ID */ |
| | | private Long projectId; |
| | | |
| | | /** 父任务ID */ |
| | | private TaskMongoDto parent; |
| | | |
| | | /** 名称 */ |
| | | private String name; |
| | | |
| | | /** 任务标签(分类等) */ |
| | | private List<String> tagList = new ArrayList<String>(); |
| | | |
| | | /** 绩效类型 */ |
| | | private String performanceType; |
| | | |
| | | /** 计划开始时间 */ |
| | | private Date planStartTime; |
| | | |
| | | /** 计划结束时间 */ |
| | | private Date planEndTime; |
| | | |
| | | /** 计划工时 */ |
| | | private Double planHours; |
| | | |
| | | /** 计划工时 */ |
| | | private Double sumPlanHours; |
| | | |
| | | // /** 消耗工时 */ |
| | | // private Double consumedHours; |
| | | // |
| | | // /** 绩效工时 */ |
| | | // private Double performanceHours; |
| | | |
| | | /** 任务状态 */ |
| | | private String taskStatus; |
| | | |
| | | /** 描述 */ |
| | | private String description; |
| | | |
| | | private Boolean leaf; |
| | | |
| | | private List<TaskMongoDto> children; |
| | | |
| | | private Long version; |
| | | } |
| | |
| | | @Query(type = Query.Type.IS_NULL, propName = "pid") |
| | | private Boolean pidIsNull; |
| | | |
| | | /** 不为空 */ |
| | | private String pid; |
| | | |
| | | private Boolean isTop; |
| | | |
| | | /** 精确 */ |
| | | @Query(propName = "id", type = Query.Type.IN) |
| | | private List<Long> idInList; |
| New file |
| | |
| | | /* |
| | | * 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.task.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | import me.zhengjie.modules.task.domain.TaskDaliyMongo; |
| | | import me.zhengjie.modules.task.domain.TaskMongo; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.DBRef; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2022-12-28 |
| | | **/ |
| | | @Data |
| | | public class TaskUserMongoDto implements Serializable { |
| | | |
| | | /** ID */ |
| | | private String id; |
| | | |
| | | /** 任务ID */ |
| | | private String taskId; |
| | | |
| | | private String name; |
| | | |
| | | /** 任务分类 */ |
| | | private String taskClassification; |
| | | |
| | | /** 绩效类型 */ |
| | | private String performanceType; |
| | | |
| | | /** 用户ID */ |
| | | private Long userId; |
| | | |
| | | /** 用户名称 */ |
| | | private String userNickName; |
| | | |
| | | /** 任务开始时间 */ |
| | | private Date taskStartDate; |
| | | |
| | | /** 任务结束时间 */ |
| | | private Date taskEndDate; |
| | | |
| | | /** 优先度 */ |
| | | private String priority; |
| | | |
| | | private List<TaskDaliyMongo> taskDaliyList = new LinkedList<TaskDaliyMongo>(); |
| | | |
| | | /** 任务工时 */ |
| | | private Double taskHours; |
| | | |
| | | /** 绩效工时 */ |
| | | private Double performanceHours; |
| | | |
| | | /** 任务状态 */ |
| | | private String taskStatus; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.task.service.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | |
| | | * @date 2022-12-28 |
| | | **/ |
| | | @Data |
| | | public class TaskUserQueryCriteria{ |
| | | public class TaskUserQueryCriteria { |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long projectId; |
| | | |
| | | /** 任务开始时间 */ |
| | | private Timestamp taskStartDate; |
| | | private Date taskStartDate; |
| | | |
| | | /** 任务结束时间 */ |
| | | private Timestamp taskEndDate; |
| | | private Date taskEndDate; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long taskId; |
| | | private String taskId; |
| | | |
| | | private String name; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String taskStatus; |
| | | private List<String> taskStatus; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | |
| | | criteria.setProjectId(resources.getProjectId()); |
| | | criteria.setTaskId(resources.getTaskId()); |
| | | criteria.setUserId(resources.getUserId()); |
| | | criteria.setFillDate(resources.getFillDate()); |
| | | // criteria.setFillDate(resources.getFillDate());// TODO |
| | | // 根据项目ID、任务ID、用户ID、填报日期查询 |
| | | List<TaskDaliy> taskDaliyList = taskDaliyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); |
| | | // 判断是否已有日报 |
| | |
| | | */ |
| | | package me.zhengjie.modules.task.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.bson.types.ObjectId; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.aggregation.Aggregation; |
| | | import org.springframework.data.mongodb.core.aggregation.AggregationResults; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.service.ProjectService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectDto; |
| | | import me.zhengjie.modules.system.domain.DictDetail; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.service.RoleService; |
| | | import me.zhengjie.modules.system.service.dto.DictDetailQueryCriteria; |
| | | import me.zhengjie.modules.system.service.dto.RoleSmallDto; |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.domain.TaskAggrMongo; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import me.zhengjie.modules.task.domain.TaskDaliyMongo; |
| | | import me.zhengjie.modules.task.domain.TaskMongo; |
| | | import me.zhengjie.modules.task.domain.TaskUser; |
| | | import me.zhengjie.modules.task.domain.TaskUserMongo; |
| | | import me.zhengjie.modules.task.repository.TaskDaliyRepository; |
| | | import me.zhengjie.modules.task.repository.TaskUserRepository; |
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.task.repository.TaskRepository; |
| | | import me.zhengjie.modules.task.repository.TaskUserRepository; |
| | | import me.zhengjie.modules.task.service.TaskService; |
| | | import me.zhengjie.modules.task.service.dto.TaskDto; |
| | | import me.zhengjie.modules.task.service.dto.TaskMongoDto; |
| | | import me.zhengjie.modules.task.service.dto.TaskQueryCriteria; |
| | | import me.zhengjie.modules.task.service.mapstruct.TaskMapper; |
| | | 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.util.*; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.SecurityUtils; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | private final TaskUserRepository taskUserRepository; |
| | | private final TaskDaliyRepository taskDaliyRepository; |
| | | private final RoleService roleService; |
| | | @Autowired |
| | | private ProjectService projectService; |
| | | private final MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public List getAllTags(String tagName) { |
| | | Criteria criteria = new Criteria(); |
| | | if (tagName != null && tagName.trim().length() > 0) { |
| | | criteria = criteria.and("tagList").regex("^.*" + tagName + ".*$"); |
| | | } |
| | | Aggregation customerAgg = Aggregation.newAggregation( |
| | | Aggregation.match(criteria), |
| | | Aggregation.project("tagList"), |
| | | Aggregation.unwind("tagList"), |
| | | Aggregation.group("tagList") |
| | | ); |
| | | |
| | | AggregationResults<Map> taskUserMongoList = mongoTemplate.aggregate(customerAgg, TaskMongo.class, Map.class); |
| | | // System.out.println(taskUserMongoList.getMappedResults().stream().flatMap(map -> map.values().stream()).collect(Collectors.toList())); |
| | | return (List) taskUserMongoList.getMappedResults().stream().flatMap(map -> map.values().stream()).collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, String>> getAllNames(Long projectId, String name) { |
| | | if (name == null || name.trim().length() == 0) { |
| | | return Collections.emptyList(); |
| | | } |
| | | Criteria criteria = new Criteria(); |
| | | if (name != null && name.trim().length() > 0) { |
| | | criteria = criteria.and("name").regex("^.*" + name + ".*$"); |
| | | } |
| | | criteria.and("projectId").is(projectId); |
| | | final List<Map<String, String>> result = new ArrayList<Map<String, String>>(); |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(new Query(criteria).with(Pageable.ofSize(10)), TaskMongo.class); |
| | | taskMongoList.forEach(item -> { |
| | | Map<String, String> itemMap = new LinkedHashMap<String, String>(); |
| | | itemMap.put("id", item.getName()); |
| | | itemMap.put("value", item.getName()); |
| | | itemMap.put("label", item.getName()); |
| | | result.add(itemMap); |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | public List<TaskAggrMongo> queryProjectTotal(Long projectId) { |
| | | Criteria criteriaMongo = new Criteria(); |
| | | criteriaMongo = criteriaMongo.and("projectId").is(projectId); |
| | | Aggregation customerAgg = Aggregation.newAggregation( |
| | | Aggregation.match(criteriaMongo), |
| | | Aggregation.project("taskStatus", "planHours"), |
| | | Aggregation.group("taskStatus").count().as("count").sum("taskHours").as("planHours") |
| | | ); |
| | | |
| | | AggregationResults<TaskAggrMongo> taskUserMongoList = mongoTemplate.aggregate(customerAgg, TaskMongo.class, TaskAggrMongo.class); |
| | | return taskUserMongoList.getMappedResults(); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(TaskQueryCriteria criteria, Pageable pageable){ |
| | | // 获取登录用户角色等级 |
| | | List<Integer> levels = roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()); |
| | | // 登录用户最大角色等级 |
| | | int min = Collections.min(levels); |
| | | // 判断角色等级 |
| | | if (min == Constant.ROLE_LEVEL_MANAGER || min == Constant.ROLE_LEVEL_LEADER || min == Constant.ROLE_LEVEL_ORDINARY) { |
| | | // 根据用户ID查询参与的项目ID |
| | | List<Long> taskUserProjectIdList = taskUserRepository.findProjectIdByUserId(SecurityUtils.getCurrentUserId()); |
| | | // 根据用户ID查询负责的项目ID |
| | | List<Long> projectIdList = projectRepository.findIdByLiableUserId(SecurityUtils.getCurrentUserId()); |
| | | // 检索条件 |
| | | List<Long> totalProjectIdList = Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList()); |
| | | if (totalProjectIdList.size() == 0) { |
| | | return PageUtil.toPage(Collections.emptyList(), 0); |
| | | } |
| | | criteria.setProjectIdInList(totalProjectIdList); |
| | | public Map<String,Object> queryAll(TaskQueryCriteria criteria, Pageable pageable) { |
| | | Criteria criteriaMongo = new Criteria(); |
| | | if (criteria.getProjectId() != null) { |
| | | criteriaMongo = criteriaMongo.and("projectId").is(criteria.getProjectId()); |
| | | } |
| | | // 判断检索条件 |
| | | if (criteria.getName() == null) { |
| | | // 检索条件 |
| | | criteria.setPidIsNull(true); |
| | | criteriaMongo = criteriaMongo.and("parent").exists(false); |
| | | } else { |
| | | criteriaMongo = criteriaMongo.and("name").regex(Pattern.compile("^.*" + criteria.getName() + ".*$", Pattern.CASE_INSENSITIVE)); |
| | | } |
| | | Page<Task> page = taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<Task, TaskDto> func = new Function<Task, TaskDto>(){ |
| | | @Override |
| | | public TaskDto apply(Task t) { |
| | | // 将实体类转换成DTO |
| | | TaskDto taskDto = taskMapper.toDto(t); |
| | | // 自定义处理 |
| | | taskDto = customHandle(taskDto); |
| | | // 返回处理好的DTO |
| | | return taskDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | Query query = new Query(criteriaMongo); |
| | | Long totalCount = mongoTemplate.count(query, TaskMongo.class); |
| | | if (totalCount == 0) { |
| | | return PageUtil.toPage(Collections.emptyList(), 0); |
| | | } |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(query.with(pageable), TaskMongo.class); |
| | | |
| | | List<TaskMongoDto> taskMongoDtoList; |
| | | if (criteria.getName() == null) { |
| | | taskMongoDtoList = createTree(null, taskMongoList); |
| | | } else { |
| | | taskMongoDtoList = createTreeWithoutChildren(null, taskMongoList); |
| | | } |
| | | return PageUtil.toPage(taskMongoDtoList, totalCount); |
| | | } |
| | | |
| | | private List<TaskMongoDto> createTreeWithoutChildren(String parentPath, List<TaskMongo> taskMongoList) { |
| | | List<TaskMongoDto> result = new ArrayList<TaskMongoDto>(); |
| | | for (TaskMongo taskMongo : taskMongoList) { |
| | | TaskMongoDto taskMongoDto = new TaskMongoDto(); |
| | | taskMongoDto.setId(taskMongo.getId()); |
| | | taskMongoDto.setName(taskMongo.getName()); |
| | | |
| | | taskMongoDto.setProjectId(taskMongo.getProjectId()); |
| | | |
| | | TaskMongoDto parentDto = new TaskMongoDto(); |
| | | parentDto.setId(taskMongo.getParent() == null ? null : taskMongo.getParent().getId()); |
| | | taskMongoDto.setParent(parentDto); |
| | | |
| | | taskMongoDto.setPerformanceType(taskMongo.getPerformanceType()); |
| | | taskMongoDto.setPlanStartTime(taskMongo.getPlanStartTime()); |
| | | taskMongoDto.setPlanEndTime(taskMongo.getPlanEndTime()); |
| | | taskMongoDto.setPlanHours(taskMongo.getPlanHours()); |
| | | taskMongoDto.setTaskStatus(taskMongo.getTaskStatus()); |
| | | taskMongoDto.setDescription(taskMongo.getDescription()); |
| | | |
| | | taskMongoDto.setTagList(taskMongo.getTagList()); |
| | | taskMongoDto.setVersion(taskMongo.getVersion()); |
| | | |
| | | Query query = new Query(Criteria.where("parent").is(taskMongo)); |
| | | List<TaskMongo> children = mongoTemplate.find(query, TaskMongo.class); |
| | | if (children == null || children.size() == 0) { |
| | | taskMongoDto.setSumPlanHours(taskMongo.getPlanHours()); |
| | | } else { |
| | | List<TaskMongoDto> childrenDto = createTree(null, children); |
| | | Double sumHours = BigDecimal.valueOf( |
| | | childrenDto.stream().collect( |
| | | Collectors.summingDouble(TaskMongoDto::getSumPlanHours))).round(new MathContext(2, RoundingMode.HALF_EVEN)).doubleValue(); |
| | | taskMongoDto.setSumPlanHours(sumHours); |
| | | } |
| | | result.add(taskMongoDto); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private List<TaskMongoDto> createTree(String parentPath, List<TaskMongo> taskMongoList) { |
| | | List<TaskMongoDto> result = new ArrayList<TaskMongoDto>(); |
| | | for (TaskMongo taskMongo : taskMongoList) { |
| | | TaskMongoDto taskMongoDto = new TaskMongoDto(); |
| | | taskMongoDto.setId(taskMongo.getId()); |
| | | taskMongoDto.setName(taskMongo.getName()); |
| | | |
| | | taskMongoDto.setProjectId(taskMongo.getProjectId()); |
| | | |
| | | TaskMongoDto parentDto = new TaskMongoDto(); |
| | | parentDto.setId(taskMongo.getParent() == null ? null : taskMongo.getParent().getId()); |
| | | taskMongoDto.setParent(parentDto); |
| | | |
| | | taskMongoDto.setPerformanceType(taskMongo.getPerformanceType()); |
| | | taskMongoDto.setPlanStartTime(taskMongo.getPlanStartTime()); |
| | | taskMongoDto.setPlanEndTime(taskMongo.getPlanEndTime()); |
| | | taskMongoDto.setPlanHours(taskMongo.getPlanHours()); |
| | | taskMongoDto.setTaskStatus(taskMongo.getTaskStatus()); |
| | | taskMongoDto.setDescription(taskMongo.getDescription()); |
| | | |
| | | taskMongoDto.setTagList(taskMongo.getTagList()); |
| | | |
| | | taskMongoDto.setVersion(taskMongo.getVersion()); |
| | | |
| | | // taskMongoDto.setConsumedHours(0.0D); |
| | | // taskMongoDto.setPerformanceHours(0.0D); |
| | | |
| | | // Query queryUser = new Query(Criteria.where("task").is(taskMongo)); |
| | | // List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(queryUser, TaskUserMongo.class); |
| | | // for (TaskUserMongo taskUserMongo : taskUserMongoList) { |
| | | // if (taskUserMongo.getTaskDaliyList().size() > 0) { |
| | | // Double total = taskUserMongo.getTaskDaliyList().stream().collect(Collectors.summingDouble(TaskDaliyMongo::getConsumedHours)); |
| | | // taskMongoDto.setConsumedHours(taskMongoDto.getConsumedHours() + total); |
| | | // TaskDaliyMongo taskDaliyMongo = taskUserMongo.getTaskDaliyList().get(0); |
| | | // taskMongoDto.setPerformanceHours(taskMongoDto.getPerformanceHours() + (taskUserMongo.getTaskHours() * taskDaliyMongo.getTaskProgress()/100)); |
| | | // } |
| | | // } |
| | | |
| | | Query query = new Query(Criteria.where("parent").is(taskMongo)); |
| | | List<TaskMongo> children = mongoTemplate.find(query, TaskMongo.class); |
| | | if (children == null || children.size() == 0) { |
| | | taskMongoDto.setSumPlanHours(taskMongo.getPlanHours()); |
| | | } else { |
| | | List<TaskMongoDto> childrenDto = createTree(null, children); |
| | | taskMongoDto.setChildren(childrenDto); |
| | | Double sumHours = BigDecimal.valueOf( |
| | | childrenDto.stream().collect( |
| | | Collectors.summingDouble(TaskMongoDto::getSumPlanHours))).round(new MathContext(2, RoundingMode.HALF_EVEN)).doubleValue(); |
| | | taskMongoDto.setSumPlanHours(sumHours); |
| | | |
| | | // Double consumedHours = BigDecimal.valueOf( |
| | | // childrenDto.stream().collect( |
| | | // Collectors.summingDouble(TaskMongoDto::getConsumedHours))).round(new MathContext(2, RoundingMode.HALF_EVEN)).doubleValue(); |
| | | // taskMongoDto.setConsumedHours(consumedHours + taskMongoDto.getConsumedHours()); |
| | | // |
| | | // Double performanceHours = BigDecimal.valueOf( |
| | | // childrenDto.stream().collect( |
| | | // Collectors.summingDouble(TaskMongoDto::getPerformanceHours))).round(new MathContext(2, RoundingMode.HALF_EVEN)).doubleValue(); |
| | | // taskMongoDto.setPerformanceHours(performanceHours + taskMongoDto.getPerformanceHours()); |
| | | } |
| | | result.add(taskMongoDto); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private TaskDto customHandle(TaskDto taskDto) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<TaskDto> queryAll(TaskQueryCriteria criteria){ |
| | | return taskMapper.toDto(taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | public List<TaskMongo> queryAll(TaskQueryCriteria criteria) { |
| | | |
| | | // 获取登录用户角色等级 |
| | | List<Integer> levels = roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()); |
| | | // 登录用户最大角色等级 |
| | | int min = Collections.min(levels); |
| | | // 判断角色等级 |
| | | if (min == Constant.ROLE_LEVEL_MANAGER || min == Constant.ROLE_LEVEL_LEADER || min == Constant.ROLE_LEVEL_ORDINARY) { |
| | | // // 根据用户ID查询参与的项目ID |
| | | // List<Long> taskUserProjectIdList = taskUserRepository.findProjectIdByUserId(SecurityUtils.getCurrentUserId()); |
| | | // 根据用户ID查询负责的项目ID |
| | | List<Long> projectIdList = projectRepository.findIdByLiableUserId(SecurityUtils.getCurrentUserId()); |
| | | // 检索条件 |
| | | List<Long> totalProjectIdList = Stream.of(projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList()); |
| | | if (totalProjectIdList.size() == 0) { |
| | | return Collections.emptyList(); |
| | | } |
| | | criteria.setProjectIdInList(totalProjectIdList); |
| | | } |
| | | |
| | | Criteria criteriaMongo = new Criteria(); |
| | | if (criteria.getProjectId() != null) { |
| | | criteriaMongo = criteriaMongo.and("projectId").is(criteria.getProjectId()); |
| | | } else if (criteria.getProjectIdInList() != null) { |
| | | criteriaMongo = criteriaMongo.and("projectId").in(criteria.getProjectIdInList().toArray()); |
| | | } |
| | | if (criteria.getName() != null) { |
| | | // criteriaMongo = criteriaMongo.and("parent").exists(false); |
| | | // } else { |
| | | criteriaMongo = criteriaMongo.and("name").regex(Pattern.compile("^.*" + criteria.getName() + ".*$", Pattern.CASE_INSENSITIVE)); |
| | | } |
| | | Query query = new Query(criteriaMongo); |
| | | Long totalCount = mongoTemplate.count(query, TaskMongo.class); |
| | | if (totalCount == 0) { |
| | | return Collections.emptyList(); |
| | | } |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(query, TaskMongo.class); |
| | | return taskMongoList; |
| | | } |
| | | |
| | | public List<TaskMongoDto> findByCompanyId(Long companyId) { |
| | | List<TaskMongo> taskMongoList; |
| | | if (companyId != null) { |
| | | Query query = new Query(Criteria.where("projectId").is(companyId).and("parent").exists(false)); |
| | | taskMongoList = mongoTemplate.find(query.limit(10), TaskMongo.class); |
| | | } else { |
| | | Query query = new Query(Criteria.where("parent").exists(false)); |
| | | taskMongoList = mongoTemplate.find(query.limit(10), TaskMongo.class); |
| | | } |
| | | return change2Dto(taskMongoList); |
| | | } |
| | | |
| | | private List<TaskMongoDto> change2Dto(List<TaskMongo> taskMongoList) { |
| | | List<TaskMongoDto> result = new ArrayList<TaskMongoDto>(); |
| | | for (TaskMongo taskMongo : taskMongoList) { |
| | | TaskMongoDto taskMongoDto = new TaskMongoDto(); |
| | | taskMongoDto.setId(taskMongo.getId()); |
| | | taskMongoDto.setName(taskMongo.getName()); |
| | | // taskMongoDto.setPid(taskMongo.getParent() == null ? null : taskMongo.getParent().getId()); |
| | | taskMongoDto.setProjectId(taskMongo.getProjectId()); |
| | | taskMongoDto.setPerformanceType(taskMongo.getPerformanceType()); |
| | | taskMongoDto.setPlanHours(taskMongo.getPlanHours()); |
| | | taskMongoDto.setPlanStartTime(taskMongo.getPlanStartTime()); |
| | | taskMongoDto.setPlanEndTime(taskMongo.getPlanEndTime()); |
| | | // taskMongoDto.setPriority(taskMongo.getPriority()); |
| | | // taskMongoDto.setTaskClassification(taskMongo.getTaskClassification()); |
| | | taskMongoDto.setTaskStatus(taskMongo.getTaskStatus()); |
| | | // taskMongoDto.setRemarks(taskMongo.getRemarks()); |
| | | Query query = new Query(Criteria.where("parent").is(taskMongo)); |
| | | List<TaskMongo> children = mongoTemplate.find(query, TaskMongo.class); |
| | | // taskMongoDto.setChildren(change2Dto(children)); |
| | | result.add(taskMongoDto); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Transactional |
| | | public void moveData() { |
| | | TaskQueryCriteria criteria = new TaskQueryCriteria(); |
| | | criteria.setPidIsNull(true); |
| | | List<Task> taskList = taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); |
| | | changeToMongo(null, taskList); |
| | | // List<TaskMongo> taskMongoList = |
| | | // for (TaskMongo taskMongo : taskMongoList) { |
| | | // mongoTemplate.save(taskMongo); |
| | | // } |
| | | } |
| | | |
| | | public void changeToMongo(TaskMongo parent, List<Task> taskList) { |
| | | DictDetailQueryCriteria criteria = new DictDetailQueryCriteria(); |
| | | criteria.setDictName("task_classification"); |
| | | List<DictDetail> dictDetailList = dictDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); |
| | | Map<String, String> dictDetailMap = dictDetailList.stream().collect(Collectors.toMap(DictDetail::getValue, DictDetail::getLabel)); |
| | | |
| | | for (Task task : taskList) { |
| | | TaskMongo taskMongo = new TaskMongo(); |
| | | |
| | | taskMongo.setProjectId(task.getProjectId()); |
| | | taskMongo.setName(task.getName()); |
| | | taskMongo.setParent(parent); |
| | | |
| | | taskMongo.setPlanHours(task.getPlanHours()); |
| | | taskMongo.setPlanStartTime(task.getPlanStartTime()); |
| | | taskMongo.setPlanEndTime(task.getPlanEndTime()); |
| | | |
| | | String classification = task.getTaskClassification(); |
| | | |
| | | taskMongo.setTagList(Collections.singletonList(dictDetailMap.get(classification))); |
| | | |
| | | taskMongo.setPerformanceType(task.getPerformanceType()); |
| | | taskMongo.setTaskStatus(task.getTaskStatus()); |
| | | |
| | | String[] userIds = projectRepository.findById(task.getProjectId()).get().getLiableUserId().replaceAll("-", "").split(","); |
| | | taskMongo.setUserIdList(Stream.of(userIds).map(userId -> Long.valueOf(userId)).collect(Collectors.toList())); |
| | | taskMongo = mongoTemplate.save(taskMongo); |
| | | |
| | | List<Task> taskListSub = getSubList(task); |
| | | changeToMongo(taskMongo, taskListSub); |
| | | |
| | | List<TaskUser> taskUserList = taskUserRepository.findByTaskId(task.getId()); |
| | | for (TaskUser taskUser : taskUserList) { |
| | | if (taskUser.getEnable()) { |
| | | TaskUserMongo taskUserMongo = new TaskUserMongo(); |
| | | taskUserMongo.setTask(taskMongo); |
| | | taskUserMongo.setUserId(taskUser.getUserId()); |
| | | taskUserMongo.setName(task.getName()); |
| | | taskUserMongo.setTaskClassification(task.getTaskClassification()); |
| | | taskUserMongo.setPerformanceType(task.getPerformanceType()); |
| | | taskUserMongo.setPriority(task.getPriority()); |
| | | taskUserMongo.setPerformanceHours(null); // TODO |
| | | taskUserMongo.setTaskHours(taskUser.getTaskHours()); |
| | | taskUserMongo.setTaskStartDate(taskUser.getTaskStartDate()); |
| | | taskUserMongo.setTaskEndDate(taskUser.getTaskEndDate()); |
| | | taskUserMongo.setTaskStatus(taskUser.getTaskStatus()); |
| | | taskUserMongo.setRemarks(taskUser.getRemarks()); |
| | | |
| | | List<TaskDaliy> taskDaliyList = taskDaliyRepository.findByProjectIdAndTaskIdAndUserIdOrderByFillDateDesc(taskMongo.getProjectId(), taskUser.getTaskId(), taskUser.getUserId()); |
| | | List<TaskDaliyMongo> taskDaliyMongoList = new ArrayList<TaskDaliyMongo>(); |
| | | for (TaskDaliy taskDaliy : taskDaliyList) { |
| | | TaskDaliyMongo taskDaliyMongo = new TaskDaliyMongo(); |
| | | taskDaliyMongo.setFillDate(taskDaliy.getFillDate()); |
| | | taskDaliyMongo.setConsumedHours(taskDaliy.getConsumedHours()); |
| | | taskDaliyMongo.setTaskProgress(taskDaliy.getTaskProgress()); |
| | | taskDaliyMongo.setSettlementStatus(taskDaliy.getSettlementStatus()); |
| | | taskDaliyMongo.setRemarks(taskDaliy.getRemarks()); |
| | | taskDaliyMongoList.add(taskDaliyMongo); |
| | | } |
| | | taskUserMongo.setTaskDaliyList(taskDaliyMongoList); |
| | | |
| | | mongoTemplate.save(taskUserMongo); |
| | | } |
| | | } |
| | | } |
| | | // return resultList; |
| | | } |
| | | |
| | | // public void changeRoute(TaskMongo taskMongo) { |
| | | // TaskMongo taskMongoDB = mongoTemplate.findById(new ObjectId(taskMongo.getId()), TaskMongo.class); |
| | | // List<TaskMongo> newChildren = taskMongo.getChildren(); |
| | | // List<TaskMongo> oldChildren = taskMongoDB.getChildren(); |
| | | // List<TaskMongo> insertList = newChildren.stream() |
| | | // .filter(item -> !oldChildren.contains(item)).collect(Collectors.toList()); |
| | | // List<TaskMongo> deleteList = oldChildren.stream() |
| | | // .filter(item -> !newChildren.contains(item)).collect(Collectors.toList()); |
| | | // |
| | | // |
| | | // // Pattern pattern = Pattern.compile("^.*" + taskMongoDB.getPath() + "/$", Pattern.CASE_INSENSITIVE); |
| | | //// Query query = new Query(Criteria.where("path").regex(pattern)); |
| | | //// List<TaskMongo> children = mongoTemplate.find(query, TaskMongo.class); |
| | | //// for (TaskMongo child : children) { |
| | | //// if (child.getPath().equals("/" + child.getName())) { |
| | | //// child.setPath(taskMongo.getPath() + child.getPath()); |
| | | //// } else { |
| | | //// child.setPath(child.getPath().replace(taskMongoDB.getPath(), taskMongo.getPath())); |
| | | //// } |
| | | //// mongoTemplate.save(child); |
| | | //// } |
| | | // mongoTemplate.save(taskMongo); |
| | | // } |
| | | |
| | | public List<Task> getSubList(Task task) { |
| | | return taskRepository.findByPid(task.getId()); |
| | | } |
| | | |
| | | @Override |
| | | public List<TaskDto> queryChildren(TaskQueryCriteria criteria){ |
| | | // 根据父级任务ID查询 |
| | | List<TaskDto> childrenTaskDtoList = taskMapper.toDto(taskRepository.findByPid(criteria.getId())); |
| | | // 循环子级任务列表 |
| | | for (int i = 0; i < childrenTaskDtoList.size(); i ++) { |
| | | // 自定义处理 |
| | | childrenTaskDtoList.set(i, customHandle(childrenTaskDtoList.get(i))); |
| | | public List<TaskMongoDto> queryChildren(TaskQueryCriteria criteria) { |
| | | Criteria criteriaMongo = new Criteria(); |
| | | if (criteria.getProjectId() != null) { |
| | | criteriaMongo = criteriaMongo.and("projectId").is(criteria.getProjectId()); |
| | | } |
| | | return childrenTaskDtoList; |
| | | if (criteria.getPid() == null) { |
| | | criteriaMongo = criteriaMongo.and("parent").exists(false); |
| | | } else { |
| | | TaskMongo parent = mongoTemplate.findById(new ObjectId(criteria.getPid()), TaskMongo.class); |
| | | criteriaMongo = criteriaMongo.and("parent").is(parent); |
| | | } |
| | | if (criteria.getName() != null) { |
| | | criteriaMongo = criteriaMongo.and("name").regex(Pattern.compile("^.*" + criteria.getName() + ".*$", Pattern.CASE_INSENSITIVE)); |
| | | } |
| | | Query query = new Query(criteriaMongo); |
| | | Long totalCount = mongoTemplate.count(query, TaskMongo.class); |
| | | if (totalCount == 0) { |
| | | return Collections.emptyList(); |
| | | } |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(query, TaskMongo.class); |
| | | |
| | | List<TaskMongoDto> taskMongoDtoList = new ArrayList<TaskMongoDto>(); |
| | | for (TaskMongo taskMongo : taskMongoList) { |
| | | TaskMongoDto taskMongoDto = new TaskMongoDto(); |
| | | |
| | | taskMongoDto.setId(taskMongo.getId()); |
| | | taskMongoDto.setName(taskMongo.getName()); |
| | | taskMongoDto.setProjectId(taskMongo.getProjectId()); |
| | | |
| | | Query childrenQuery = new Query(Criteria.where("parent").is(taskMongo)); |
| | | long children = mongoTemplate.count(childrenQuery, TaskMongo.class); |
| | | taskMongoDto.setLeaf(children == 0); |
| | | |
| | | taskMongoDtoList.add(taskMongoDto); |
| | | } |
| | | return taskMongoDtoList; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public TaskDto create(Task resources) { |
| | | return taskMapper.toDto(taskRepository.save(resources)); |
| | | public TaskMongo create(TaskMongo resources) { |
| | | return mongoTemplate.save(resources); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(Task resources) { |
| | | Task task = taskRepository.findById(resources.getId()).orElseGet(Task::new); |
| | | ValidationUtil.isNull( task.getId(),"Task","id",resources.getId()); |
| | | task.copy(resources); |
| | | taskRepository.save(task); |
| | | public TaskMongo update(TaskMongo resources) { |
| | | return mongoTemplate.save(resources); |
| | | } |
| | | |
| | | private Boolean deleteWithChildren(List<TaskMongo> taskMongoList) { |
| | | Boolean result = true; |
| | | if (taskMongoList.size() == 0) { |
| | | return result; |
| | | } |
| | | for (TaskMongo taskMongo : taskMongoList) { |
| | | List<TaskMongo> children = mongoTemplate.find(Query.query(Criteria.where("parent").is(taskMongo)), TaskMongo.class); |
| | | Boolean deleteFlg = deleteWithChildren(children); |
| | | if (!deleteFlg) { |
| | | result = false; |
| | | continue; |
| | | } |
| | | Long count = mongoTemplate.count(Query.query(Criteria.where("task").is(taskMongo)), TaskUserMongo.class); |
| | | if (count > 0) { |
| | | result = false; |
| | | continue; |
| | | } |
| | | mongoTemplate.remove(taskMongo); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | // 根据多任务ID查询任务分配列表 |
| | | List<TaskUser> taskUserList = taskUserRepository.findByTaskIdIn(Arrays.asList(ids)); |
| | | // 判断任务分配列表长度 |
| | | if (taskUserList.size() > 0) { |
| | | throw new BadRequestException("已分配的任务无法删除!"); |
| | | } |
| | | for (Long id : ids) { |
| | | taskRepository.deleteById(id); |
| | | } |
| | | public Boolean deleteAll(String[] ids) { |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(Criteria.where("id").in(Arrays.asList(ids))), TaskMongo.class); |
| | | return deleteWithChildren(taskMongoList); |
| | | } |
| | | |
| | | @Override |
| | |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | @Override |
| | | public List<TaskDto> queryPartakeAll(TaskQueryCriteria criteria){ |
| | | // 根据用户ID、项目ID查询任务ID |
| | | List<Long> partakeTaskIds = taskUserRepository.findTaskIdByUserIdAndProjectId(criteria.getTaskUserId(), criteria.getProjectId()); |
| | | // 判断长度 |
| | | if (partakeTaskIds.size() == 0) { |
| | | return new ArrayList<>(); |
| | | } |
| | | // 项目检索条件 |
| | | criteria.setIdInList(partakeTaskIds); |
| | | criteria.setTaskStatusNotEqual(Constant.TASK_STATUS_COMPLETED); |
| | | return taskMapper.toDto(taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | // @Override |
| | | // public List<TaskDto> queryPartakeAll(TaskQueryCriteria criteria){ |
| | | // // 根据用户ID、项目ID查询任务ID |
| | | // List<Long> partakeTaskIds = taskUserRepository.findTaskIdByUserIdAndProjectId(criteria.getTaskUserId(), criteria.getProjectId()); |
| | | // // 判断长度 |
| | | // if (partakeTaskIds.size() == 0) { |
| | | // return new ArrayList<>(); |
| | | // } |
| | | // // 项目检索条件 |
| | | // criteria.setIdInList(partakeTaskIds); |
| | | // criteria.setTaskStatusNotEqual(Constant.TASK_STATUS_COMPLETED); |
| | | // return taskMapper.toDto(taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | // } |
| | | } |
| | |
| | | import java.time.ZoneId; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.aggregation.Aggregation; |
| | | import org.springframework.data.mongodb.core.aggregation.AggregationResults; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.repository.SysConfigHolidayRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.RoleService; |
| | | import me.zhengjie.modules.system.service.dto.RoleSmallDto; |
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.system.service.dto.UserDto; |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import me.zhengjie.modules.task.domain.TaskMongo; |
| | | import me.zhengjie.modules.task.domain.TaskUser; |
| | | import me.zhengjie.modules.task.domain.TaskUserMongo; |
| | | import me.zhengjie.modules.task.repository.TaskDaliyRepository; |
| | | import me.zhengjie.modules.task.repository.TaskRepository; |
| | | import me.zhengjie.modules.task.repository.TaskUserRepository; |
| | | import me.zhengjie.modules.task.service.TaskUserService; |
| | | import me.zhengjie.modules.task.service.dto.TaskUserDto; |
| | | import me.zhengjie.modules.task.service.dto.TaskUserMongoDto; |
| | | import me.zhengjie.modules.task.service.dto.TaskUserQueryCriteria; |
| | | import me.zhengjie.modules.task.service.mapstruct.TaskUserMapper; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.SecurityUtils; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | |
| | | /** |
| | |
| | | private final TaskDaliyRepository taskDaliyRepository; |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository; |
| | | private final OpaiDingTalkService opaiDingTalkService; |
| | | private final RoleService roleService; |
| | | private final UserService userService; |
| | | private final MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(TaskUserQueryCriteria criteria, Pageable pageable){ |
| | | // 获取登录用户角色等级 |
| | | List<Integer> levels = roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()); |
| | | // 登录用户最大角色等级 |
| | | int min = Collections.min(levels); |
| | | // 判断角色等级 |
| | | if (min == Constant.ROLE_LEVEL_MANAGER || min == Constant.ROLE_LEVEL_LEADER || min == Constant.ROLE_LEVEL_ORDINARY) { |
| | | // 根据用户ID查询参与的项目ID |
| | | List<Long> taskUserProjectIdList = taskUserRepository.findProjectIdByUserId(SecurityUtils.getCurrentUserId()); |
| | | // 根据用户ID查询负责的项目ID |
| | | List<Long> projectIdList = projectRepository.findIdByLiableUserId(SecurityUtils.getCurrentUserId()); |
| | | // 检索条件 |
| | | List<Long> totalProjectIdList = Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList()); |
| | | if (totalProjectIdList.size() == 0) { |
| | | return PageUtil.toPage(Collections.emptyList(), 0); |
| | | } |
| | | criteria.setProjectIdInList(totalProjectIdList); |
| | | } |
| | | Page<TaskUser> page = taskUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<TaskUser, TaskUserDto> func = new Function<TaskUser, TaskUserDto>(){ |
| | | @Override |
| | | public TaskUserDto apply(TaskUser t) { |
| | | // 将实体类转换成DTO |
| | | TaskUserDto taskUserDto = taskUserMapper.toDto(t); |
| | | // 根据项目ID查询项目信息 |
| | | Project project = projectRepository.findById(taskUserDto.getProjectId()).orElseGet(Project::new); |
| | | ValidationUtil.isNull(project.getId(),"Project","id",taskUserDto.getProjectId()); |
| | | // 项目名称 |
| | | taskUserDto.setProjectName(project.getName()); |
| | | public List<Map> sumTotalByTask(String taskId) { |
| | | TaskMongo taskMongo = mongoTemplate.findById(taskId, TaskMongo.class); |
| | | Criteria criteria = Criteria.where("task").is(taskMongo); |
| | | |
| | | 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); |
| | | } |
| | | Aggregation customerAgg = Aggregation.newAggregation( |
| | | Aggregation.match(criteria), |
| | | Aggregation.project("taskStatus","taskHours"), |
| | | Aggregation.group("taskStatus").count().as("taskStatusCnt").sum("taskHours").as("taskHours") |
| | | ); |
| | | |
| | | // 根据任务ID查询任务信息 |
| | | Task task = taskRepository.findById(taskUserDto.getTaskId()).orElseGet(Task::new); |
| | | ValidationUtil.isNull(task.getId(),"Task","id",taskUserDto.getTaskId()); |
| | | // 任务名称 |
| | | taskUserDto.setTaskName(task.getName()); |
| | | // 任务工作量单位 |
| | | taskUserDto.setTaskWorkloadUnit(task.getPlanWorkloadUnit()); |
| | | // 任务绩效类型 |
| | | taskUserDto.setTaskPerformanceType(task.getPerformanceType()); |
| | | // 根据用户ID查询用户信息 |
| | | User user = userRepository.findById(taskUserDto.getUserId()).orElseGet(User::new); |
| | | ValidationUtil.isNull(user.getId(),"User","id",taskUserDto.getUserId()); |
| | | // 用户昵称 |
| | | taskUserDto.setUserNickName(user.getNickName()); |
| | | // 根据项目ID、任务ID、用户ID查询总消耗工时、总消耗工作量、最大任务进度 |
| | | TaskDailyInterface taskDailyInterface = taskDaliyRepository.findSumConsumedHoursAndSumConsumedWorkloadByProjectIdAndTaskIdAndUserId(taskUserDto.getProjectId(), taskUserDto.getTaskId(), taskUserDto.getUserId()); |
| | | // 消耗工时 |
| | | taskUserDto.setConsumedHours(taskDailyInterface.getConsumedHours()); |
| | | // 消耗工作量 |
| | | taskUserDto.setConsumedWorkload(taskDailyInterface.getConsumedWorkload()); |
| | | // 根据项目ID、任务ID、用户ID查询总消耗工时、总消耗工作量、最大任务进度 |
| | | taskDailyInterface = taskDaliyRepository.findMaxTaskProgressByProjectIdAndTaskIdAndUserId(taskUserDto.getProjectId(), taskUserDto.getTaskId(), taskUserDto.getUserId()); |
| | | // 任务进度 |
| | | taskUserDto.setTaskProgress(taskDailyInterface.getTaskProgress()); |
| | | // 返回处理好的DTO |
| | | return taskUserDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | AggregationResults<Map> taskUserMongoList = mongoTemplate.aggregate(customerAgg, TaskUserMongo.class, Map.class); |
| | | return taskUserMongoList.getMappedResults(); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(TaskUserQueryCriteria criteria, Pageable pageable) { |
| | | |
| | | Criteria criteriaMongo = new Criteria(); |
| | | if (criteria.getTaskId() != null) { |
| | | TaskMongo taskMongo = mongoTemplate.findById(criteria.getTaskId(), TaskMongo.class); |
| | | criteriaMongo.and("task").is(taskMongo); |
| | | } else { |
| | | return PageUtil.toPage(Collections.emptyList(), 0); |
| | | } |
| | | if (criteria.getName() != null) { |
| | | criteriaMongo = criteriaMongo.and("name").regex(Pattern.compile("^.*" + criteria.getName() + ".*$", Pattern.CASE_INSENSITIVE)); |
| | | } |
| | | if (criteria.getUserId() != null) { |
| | | criteriaMongo = criteriaMongo.and("userId").in(criteria.getUserId()); |
| | | } |
| | | if (criteria.getTaskStatus().size() > 0) { |
| | | criteriaMongo = criteriaMongo.and("taskStatus").in(criteria.getTaskStatus()); |
| | | } |
| | | Query query = new Query(criteriaMongo); |
| | | Long totalCount = mongoTemplate.count(query, TaskUserMongo.class); |
| | | if (totalCount == 0) { |
| | | return PageUtil.toPage(Collections.emptyList(), 0); |
| | | } |
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(query.with(pageable), TaskUserMongo.class); |
| | | |
| | | List<TaskUserMongoDto> taskUserMongoDtoList = new ArrayList<TaskUserMongoDto>(); |
| | | for (TaskUserMongo taskUserMongo : taskUserMongoList) { |
| | | TaskUserMongoDto taskUserMongoDto = new TaskUserMongoDto(); |
| | | taskUserMongoDto.setId(taskUserMongo.getId()); |
| | | taskUserMongoDto.setName(taskUserMongo.getName()); |
| | | taskUserMongoDto.setTaskClassification(taskUserMongo.getTaskClassification()); |
| | | |
| | | taskUserMongoDto.setUserId(taskUserMongo.getUserId()); |
| | | UserDto userDto = userService.findById(taskUserMongo.getUserId()); |
| | | taskUserMongoDto.setUserNickName(userDto.getNickName());; |
| | | |
| | | taskUserMongoDto.setTaskId(taskUserMongo.getTask().getId()); |
| | | taskUserMongoDto.setPerformanceType(taskUserMongo.getPerformanceType()); |
| | | taskUserMongoDto.setPriority(taskUserMongo.getPriority()); |
| | | taskUserMongoDto.setTaskStatus(taskUserMongo.getTaskStatus()); |
| | | |
| | | taskUserMongoDto.setTaskStartDate(taskUserMongo.getTaskStartDate()); |
| | | taskUserMongoDto.setTaskEndDate(taskUserMongo.getTaskEndDate()); |
| | | taskUserMongoDto.setTaskHours(taskUserMongo.getTaskHours()); |
| | | |
| | | taskUserMongoDto.setTaskDaliyList(taskUserMongo.getTaskDaliyList()); |
| | | |
| | | taskUserMongoDtoList.add(taskUserMongoDto); |
| | | } |
| | | return PageUtil.toPage(taskUserMongoDtoList, totalCount); |
| | | } |
| | | |
| | | // @Override |
| | | // public Map<String,Object> queryAll(TaskUserQueryCriteria criteria, Pageable pageable) { |
| | | // // 获取登录用户角色等级 |
| | | // List<Integer> levels = roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()); |
| | | // // 登录用户最大角色等级 |
| | | // int min = Collections.min(levels); |
| | | // // 判断角色等级 |
| | | // if (min == Constant.ROLE_LEVEL_MANAGER || min == Constant.ROLE_LEVEL_LEADER || min == Constant.ROLE_LEVEL_ORDINARY) { |
| | | // // 根据用户ID查询参与的项目ID |
| | | // List<Long> taskUserProjectIdList = taskUserRepository.findProjectIdByUserId(SecurityUtils.getCurrentUserId()); |
| | | // // 根据用户ID查询负责的项目ID |
| | | // List<Long> projectIdList = projectRepository.findIdByLiableUserId(SecurityUtils.getCurrentUserId()); |
| | | // // 检索条件 |
| | | // List<Long> totalProjectIdList = Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList()); |
| | | // if (totalProjectIdList.size() == 0) { |
| | | // return PageUtil.toPage(Collections.emptyList(), 0); |
| | | // } |
| | | // criteria.setProjectIdInList(totalProjectIdList); |
| | | // } |
| | | // Page<TaskUser> page = taskUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // // 将实体类转换为DTO(重写) |
| | | // Function<TaskUser, TaskUserDto> func = new Function<TaskUser, TaskUserDto>(){ |
| | | // @Override |
| | | // public TaskUserDto apply(TaskUser t) { |
| | | // // 将实体类转换成DTO |
| | | // TaskUserDto taskUserDto = taskUserMapper.toDto(t); |
| | | // // 根据项目ID查询项目信息 |
| | | // Project project = projectRepository.findById(taskUserDto.getProjectId()).orElseGet(Project::new); |
| | | // 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()); |
| | | // // 任务名称 |
| | | // taskUserDto.setTaskName(task.getName()); |
| | | // // 任务工作量单位 |
| | | // taskUserDto.setTaskWorkloadUnit(task.getPlanWorkloadUnit()); |
| | | // // 任务绩效类型 |
| | | // taskUserDto.setTaskPerformanceType(task.getPerformanceType()); |
| | | // // 根据用户ID查询用户信息 |
| | | // User user = userRepository.findById(taskUserDto.getUserId()).orElseGet(User::new); |
| | | // ValidationUtil.isNull(user.getId(),"User","id",taskUserDto.getUserId()); |
| | | // // 用户昵称 |
| | | // taskUserDto.setUserNickName(user.getNickName()); |
| | | // // 根据项目ID、任务ID、用户ID查询总消耗工时、总消耗工作量、最大任务进度 |
| | | // TaskDailyInterface taskDailyInterface = taskDaliyRepository.findSumConsumedHoursAndSumConsumedWorkloadByProjectIdAndTaskIdAndUserId(taskUserDto.getProjectId(), taskUserDto.getTaskId(), taskUserDto.getUserId()); |
| | | // // 消耗工时 |
| | | // taskUserDto.setConsumedHours(taskDailyInterface.getConsumedHours()); |
| | | // // 消耗工作量 |
| | | // taskUserDto.setConsumedWorkload(taskDailyInterface.getConsumedWorkload()); |
| | | // // 根据项目ID、任务ID、用户ID查询总消耗工时、总消耗工作量、最大任务进度 |
| | | // taskDailyInterface = taskDaliyRepository.findMaxTaskProgressByProjectIdAndTaskIdAndUserId(taskUserDto.getProjectId(), taskUserDto.getTaskId(), taskUserDto.getUserId()); |
| | | // // 任务进度 |
| | | // taskUserDto.setTaskProgress(taskDailyInterface.getTaskProgress()); |
| | | // // 返回处理好的DTO |
| | | // return taskUserDto; |
| | | // } |
| | | // }; |
| | | // return PageUtil.toPage(page.map(func)); |
| | | // } |
| | | |
| | | @Override |
| | | public List<TaskUserDto> queryAll(TaskUserQueryCriteria criteria) { |
| | |
| | | |
| | | @Override |
| | | public Double calculateHour(TaskUserQueryCriteria criteria) { |
| | | LocalDateTime localEndDateTime = criteria.getTaskEndDate().toLocalDateTime(); |
| | | ZoneId zoneId = ZoneId.systemDefault(); |
| | | LocalDateTime localEndDateTime = criteria.getTaskEndDate().toInstant().atZone(zoneId).toLocalDateTime(); |
| | | User user = userRepository.findById(criteria.getUserId()).orElseGet(User::new); |
| | | ValidationUtil.isNull(user.getId(),"User","id", criteria.getUserId()); |
| | | |
| | | List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findByHolidayDateBetween(criteria.getTaskStartDate(), criteria.getTaskEndDate()); |
| | | |
| | | Double totalHours = 0.0; |
| | | LocalDateTime toDayDateTime = criteria.getTaskStartDate().toLocalDateTime(); |
| | | LocalDateTime toDayDateTime = criteria.getTaskStartDate().toInstant().atZone(zoneId).toLocalDateTime(); |
| | | while (toDayDateTime.isBefore(localEndDateTime)) { |
| | | |
| | | String dateType = ""; |
| | |
| | | |
| | | @Override |
| | | public List<Long> queryTaskUserIds(TaskUserQueryCriteria criteria){ |
| | | return taskUserRepository.findUserIdByTaskId(criteria.getTaskId()); |
| | | return Collections.emptyList(); // taskUserRepository.findUserIdByTaskId(criteria.getTaskId()); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.domain; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseEntity; |
| | | import me.zhengjie.modules.system.domain.SysCompany; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-09 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="new_cmn_insurance") |
| | | public class CmnInsurance extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @ManyToOne |
| | | @JoinColumn(name = "`company_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公司区分") |
| | | private SysCompany company; |
| | | |
| | | @Column(name = "`accumulation_fund`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金基数") |
| | | private BigDecimal accumulationFund; |
| | | |
| | | @Column(name = "`accumulation_fund_personal`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金个人比例") |
| | | private Double accumulationFundPersonal; |
| | | |
| | | @Column(name = "`accumulation_fund_company`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金公司比例") |
| | | private Double accumulationFundCompany; |
| | | |
| | | @Column(name = "`retirement_insurance`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "养老险基数") |
| | | private BigDecimal retirementInsurance; |
| | | |
| | | @Column(name = "`retirement_insurance_personal`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金个人比例") |
| | | private Double retirementInsurancePersonal; |
| | | |
| | | @Column(name = "`retirement_insurance_company`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金公司比例") |
| | | private Double retirementInsuranceCompany; |
| | | |
| | | @Column(name = "`medical_insurance`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "医疗险基数") |
| | | private BigDecimal medicalInsurance; |
| | | |
| | | @Column(name = "`medical_insurance_personal`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "医疗险个人比例") |
| | | private Double medicalInsurancePersonal; |
| | | |
| | | @Column(name = "`medical_insurance_company`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "医疗险公司比例") |
| | | private Double medicalInsuranceCompany; |
| | | |
| | | @Column(name = "`unemployment_insurance`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "失业险基数") |
| | | private BigDecimal unemploymentInsurance; |
| | | |
| | | @Column(name = "`unemployment_insurance_personal`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "失业险个人比例") |
| | | private Double unemploymentInsurancePersonal; |
| | | |
| | | @Column(name = "`unemployment_insurance_company`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "失业险公司比例") |
| | | private Double unemploymentInsuranceCompany; |
| | | |
| | | @Column(name = "`birth_insurance`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "生育险基数") |
| | | private BigDecimal birthInsurance; |
| | | |
| | | @Column(name = "`birth_insurance_personal`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "生育险个人比例") |
| | | private Double birthInsurancePersonal; |
| | | |
| | | @Column(name = "`birth_insurance_company`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "生育险公司比例") |
| | | private Double birthInsuranceCompany; |
| | | |
| | | @Column(name = "`employment_insurance`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "工伤险基数") |
| | | private BigDecimal employmentInsurance; |
| | | |
| | | @Column(name = "`employment_insurance_personal`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "工伤险个人比例") |
| | | private Double employmentInsurancePersonal; |
| | | |
| | | @Column(name = "`employment_insurance_company`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "工伤险公司比例") |
| | | private Double employmentInsuranceCompany; |
| | | |
| | | public void copy(CmnInsurance source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.domain; |
| | | |
| | | import lombok.Data; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | import me.zhengjie.base.BaseEntity; |
| | | import me.zhengjie.modules.system.domain.Dept; |
| | | import me.zhengjie.modules.system.domain.Job; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="new_cmn_level") |
| | | public class CmnLevel extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @NotNull |
| | | @ApiModelProperty(value = "岗位") |
| | | @ManyToOne |
| | | @JoinColumn(name = "job_id", nullable = false) |
| | | private Job job; |
| | | |
| | | @Column(name = "`name`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "名称") |
| | | private String name; |
| | | |
| | | @OneToMany(mappedBy = "level", cascade= {CascadeType.PERSIST, CascadeType.REMOVE}) |
| | | private List<CmnLevelRank> cmnLevelRankList; |
| | | |
| | | @Column(name = "`basic_wage`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "基本工资") |
| | | private BigDecimal basicWage; |
| | | |
| | | @Column(name = "`rank_wage`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "浮动工资") |
| | | private BigDecimal rankWage; |
| | | |
| | | @Column(name = "`performance_wage`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "绩效工资") |
| | | private BigDecimal performanceWage; |
| | | |
| | | @Column(name = "`description`") |
| | | @ApiModelProperty(value = "描述") |
| | | private String description; |
| | | |
| | | public void copy(CmnLevel source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.domain; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | 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.NotNull; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | import me.zhengjie.base.BaseEntity; |
| | | import me.zhengjie.modules.system.domain.Job; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="new_cmn_level_rank") |
| | | public class CmnLevelRank extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @NotNull |
| | | @ApiModelProperty(value = "级别") |
| | | @ManyToOne |
| | | @JoinColumn(name = "level_id", nullable = false) |
| | | private CmnLevel level; |
| | | |
| | | @Column(name = "`min_rank_wage`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "最小等级工资") |
| | | private BigDecimal minRankWage; |
| | | |
| | | @Column(name = "`max_rank_wage`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "最大等级工资") |
| | | private BigDecimal maxRankWage; |
| | | |
| | | @Column(name = "`performance_coefficient`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "绩效系数") |
| | | private Double performanceCoefficient; |
| | | |
| | | public void copy(CmnLevelRank source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.domain; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseEntity; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | 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-05-07 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="new_user_insurance") |
| | | public class UserInsurance extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`user_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "用户ID") |
| | | private Long userId; |
| | | |
| | | @Column(name = "`year_month`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "年月") |
| | | private String yearMonth; |
| | | |
| | | @Column(name = "`accumulation_fund`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金基数") |
| | | private BigDecimal accumulationFund = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`accumulation_fund_personal`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金个人比例") |
| | | private Double accumulationFundPersonal = 0.0D; |
| | | |
| | | @Column(name = "`accumulation_fund_company`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金公司比例") |
| | | private Double accumulationFundCompany = 0.0D; |
| | | |
| | | @Column(name = "`retirement_insurance`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "养老险基数") |
| | | private BigDecimal retirementInsurance = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`retirement_insurance_personal`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金个人比例") |
| | | private Double retirementInsurancePersonal = 0.0D; |
| | | |
| | | @Column(name = "`retirement_insurance_company`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公积金公司比例") |
| | | private Double retirementInsuranceCompany = 0.0D; |
| | | |
| | | @Column(name = "`medical_insurance`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "医疗险基数") |
| | | private BigDecimal medicalInsurance = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`medical_insurance_personal`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "医疗险个人比例") |
| | | private Double medicalInsurancePersonal = 0.0D; |
| | | |
| | | @Column(name = "`medical_insurance_company`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "医疗险公司比例") |
| | | private Double medicalInsuranceCompany = 0.0D; |
| | | |
| | | @Column(name = "`unemployment_insurance`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "失业险基数") |
| | | private BigDecimal unemploymentInsurance = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`unemployment_insurance_personal`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "失业险个人比例") |
| | | private Double unemploymentInsurancePersonal = 0.0D; |
| | | |
| | | @Column(name = "`unemployment_insurance_company`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "失业险公司比例") |
| | | private Double unemploymentInsuranceCompany = 0.0D; |
| | | |
| | | @Column(name = "`birth_insurance`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "生育险基数") |
| | | private BigDecimal birthInsurance = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`birth_insurance_personal`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "生育险个人比例") |
| | | private Double birthInsurancePersonal = 0.0D; |
| | | |
| | | @Column(name = "`birth_insurance_company`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "生育险公司比例") |
| | | private Double birthInsuranceCompany = 0.0D; |
| | | |
| | | @Column(name = "`employment_insurance`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "工伤险基数") |
| | | private BigDecimal employmentInsurance = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`employment_insurance_personal`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "工伤险个人比例") |
| | | private Double employmentInsurancePersonal = 0.0D; |
| | | |
| | | @Column(name = "`employment_insurance_company`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "工伤险公司比例") |
| | | private Double employmentInsuranceCompany = 0.0D; |
| | | |
| | | public void copy(UserInsurance source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.domain; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseEntity; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | 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-05-07 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="new_user_level_wage") |
| | | public class UserLevelWage extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`user_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "用户ID") |
| | | private Long userId; |
| | | |
| | | @Column(name = "`year_month`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "年月") |
| | | private String yearMonth; |
| | | |
| | | @Column(name = "`level`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "级别") |
| | | private Long level; |
| | | |
| | | @Column(name = "`rank`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "等级") |
| | | private Long rank; |
| | | |
| | | @Column(name = "`basic_wage`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "级别基本工资") |
| | | private BigDecimal basicWage = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`rank_wage`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "级别等级工资") |
| | | private BigDecimal rankWage = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`performance_wage`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "绩效工资") |
| | | private BigDecimal performanceWage = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`performance_coefficient`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "团队工资比例") |
| | | private BigDecimal performanceCoefficient = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`locked`") |
| | | @ApiModelProperty(value = "锁定状态") |
| | | private Integer locked; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(UserLevelWage source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreProperties("id").setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysCompany; |
| | | import me.zhengjie.modules.treatment.domain.CmnInsurance; |
| | | |
| | | import java.util.Optional; |
| | | |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-09 |
| | | **/ |
| | | public interface CmnInsuranceRepository extends JpaRepository<CmnInsurance, Long>, JpaSpecificationExecutor<CmnInsurance> { |
| | | |
| | | Optional<CmnInsurance> findByCompany(SysCompany company); |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.repository; |
| | | |
| | | import me.zhengjie.modules.treatment.domain.CmnLevelRank; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | public interface CmnLevelRankRepository extends JpaRepository<CmnLevelRank, Long>, JpaSpecificationExecutor<CmnLevelRank> { |
| | | |
| | | void deleteByLevelId(Long levelId); |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.repository; |
| | | |
| | | import me.zhengjie.modules.treatment.domain.CmnLevel; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | public interface CmnLevelRepository extends JpaRepository<CmnLevel, Long>, JpaSpecificationExecutor<CmnLevel> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.repository; |
| | | |
| | | import me.zhengjie.modules.treatment.domain.UserInsurance; |
| | | |
| | | import java.util.Optional; |
| | | |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | public interface UserInsuranceRepository extends JpaRepository<UserInsurance, Long>, JpaSpecificationExecutor<UserInsurance> { |
| | | |
| | | Optional<UserInsurance> findByUserIdAndYearMonth(Long userId, String monthYear); |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.repository; |
| | | |
| | | import me.zhengjie.modules.treatment.domain.UserLevelWage; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | public interface UserLevelWageRepository extends JpaRepository<UserLevelWage, Long>, JpaSpecificationExecutor<UserLevelWage> { |
| | | |
| | | UserLevelWage findByUserIdAndYearMonth(Long userId, String yearMonth); |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.treatment.domain.CmnInsurance; |
| | | import me.zhengjie.modules.treatment.service.CmnInsuranceService; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnInsuranceQueryCriteria; |
| | | 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-05-09 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "五险一金管理") |
| | | @RequestMapping("/api/cmnInsurance") |
| | | public class CmnInsuranceController { |
| | | |
| | | private final CmnInsuranceService cmnInsuranceService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('cmnInsurance:list')") |
| | | public void exportCmnInsurance(HttpServletResponse response, CmnInsuranceQueryCriteria criteria) throws IOException { |
| | | cmnInsuranceService.download(cmnInsuranceService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询五险一金") |
| | | @ApiOperation("查询五险一金") |
| | | @PreAuthorize("@el.check('cmnInsurance:list')") |
| | | public ResponseEntity<Object> queryCmnInsurance(CmnInsuranceQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(cmnInsuranceService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询五险一金") |
| | | @ApiOperation("查询五险一金") |
| | | @PreAuthorize("@el.check('cmnInsurance:list')") |
| | | public ResponseEntity<Object> queryCmnInsurance(CmnInsuranceQueryCriteria criteria){ |
| | | return new ResponseEntity<>(cmnInsuranceService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增五险一金") |
| | | @ApiOperation("新增五险一金") |
| | | @PreAuthorize("@el.check('cmnInsurance:add')") |
| | | public ResponseEntity<Object> createCmnInsurance(@Validated @RequestBody CmnInsurance resources){ |
| | | return new ResponseEntity<>(cmnInsuranceService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改五险一金") |
| | | @ApiOperation("修改五险一金") |
| | | @PreAuthorize("@el.check('cmnInsurance:edit')") |
| | | public ResponseEntity<Object> updateCmnInsurance(@Validated @RequestBody CmnInsurance resources){ |
| | | cmnInsuranceService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除五险一金") |
| | | @ApiOperation("删除五险一金") |
| | | @PreAuthorize("@el.check('cmnInsurance:del')") |
| | | public ResponseEntity<Object> deleteCmnInsurance(@RequestBody Long[] ids) { |
| | | cmnInsuranceService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.system.service.dto.CustomerResourcesQueryCriteria; |
| | | import me.zhengjie.modules.treatment.domain.CmnLevel; |
| | | import me.zhengjie.modules.treatment.service.CmnLevelService; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelQueryCriteria; |
| | | 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-05-07 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "级别定义管理") |
| | | @RequestMapping("/api/cmnLevel") |
| | | public class CmnLevelController { |
| | | |
| | | private final CmnLevelService cmnLevelService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('cmnLevel:list')") |
| | | public void exportCmnLevel(HttpServletResponse response, CmnLevelQueryCriteria criteria) throws IOException { |
| | | cmnLevelService.download(cmnLevelService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询级别定义") |
| | | @ApiOperation("查询级别定义") |
| | | @PreAuthorize("@el.check('cmnLevel:list')") |
| | | public ResponseEntity<Object> queryCmnLevel(CmnLevelQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(cmnLevelService.queryAll(criteria,pageable), HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询级别定义") |
| | | @ApiOperation("查询级别定义") |
| | | @PreAuthorize("@el.check('cmnLevel:list')") |
| | | public ResponseEntity<Object> queryCmnLevel(CmnLevelQueryCriteria criteria){ |
| | | return new ResponseEntity<>(cmnLevelService.queryAll(criteria), HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增级别定义") |
| | | @ApiOperation("新增级别定义") |
| | | @PreAuthorize("@el.check('cmnLevel:add')") |
| | | public ResponseEntity<Object> createCmnLevel(@Validated @RequestBody CmnLevel resources){ |
| | | return new ResponseEntity<>(cmnLevelService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | // @Log("修改级别定义") |
| | | @ApiOperation("修改级别定义") |
| | | @PreAuthorize("@el.check('cmnLevel:edit')") |
| | | public ResponseEntity<Object> updateCmnLevel(@Validated @RequestBody CmnLevel resources){ |
| | | cmnLevelService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除级别定义") |
| | | @ApiOperation("删除级别定义") |
| | | @PreAuthorize("@el.check('cmnLevel:del')") |
| | | public ResponseEntity<Object> deleteCmnLevel(@RequestBody Long[] ids) { |
| | | cmnLevelService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.treatment.domain.CmnLevelRank; |
| | | import me.zhengjie.modules.treatment.service.CmnLevelRankService; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelRankQueryCriteria; |
| | | 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-05-07 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "级别等级定义管理") |
| | | @RequestMapping("/api/cmnLevelRank") |
| | | public class CmnLevelRankController { |
| | | |
| | | private final CmnLevelRankService cmnLevelRankService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('cmnLevelRank:list')") |
| | | public void exportCmnLevelRank(HttpServletResponse response, CmnLevelRankQueryCriteria criteria) throws IOException { |
| | | cmnLevelRankService.download(cmnLevelRankService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询级别等级定义") |
| | | @ApiOperation("查询级别等级定义") |
| | | @PreAuthorize("@el.check('cmnLevelRank:list')") |
| | | public ResponseEntity<Object> queryCmnLevelRank(CmnLevelRankQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(cmnLevelRankService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增级别等级定义") |
| | | @ApiOperation("新增级别等级定义") |
| | | @PreAuthorize("@el.check('cmnLevelRank:add')") |
| | | public ResponseEntity<Object> createCmnLevelRank(@Validated @RequestBody CmnLevelRank resources){ |
| | | return new ResponseEntity<>(cmnLevelRankService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改级别等级定义") |
| | | @ApiOperation("修改级别等级定义") |
| | | @PreAuthorize("@el.check('cmnLevelRank:edit')") |
| | | public ResponseEntity<Object> updateCmnLevelRank(@Validated @RequestBody CmnLevelRank resources){ |
| | | cmnLevelRankService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除级别等级定义") |
| | | @ApiOperation("删除级别等级定义") |
| | | @PreAuthorize("@el.check('cmnLevelRank:del')") |
| | | public ResponseEntity<Object> deleteCmnLevelRank(@RequestBody Long[] ids) { |
| | | cmnLevelRankService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.treatment.domain.UserInsurance; |
| | | import me.zhengjie.modules.treatment.service.UserInsuranceService; |
| | | import me.zhengjie.modules.treatment.service.dto.UserInsuranceGenerateParam; |
| | | import me.zhengjie.modules.treatment.service.dto.UserInsuranceQueryCriteria; |
| | | 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 java.util.List; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "个人五险一金管理") |
| | | @RequestMapping("/api/userInsurance") |
| | | public class UserInsuranceController { |
| | | |
| | | private final UserInsuranceService userInsuranceService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('userInsurance:list')") |
| | | public void exportUserInsurance(HttpServletResponse response, UserInsuranceQueryCriteria criteria) throws IOException { |
| | | userInsuranceService.download(userInsuranceService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询个人五险一金") |
| | | @ApiOperation("查询个人五险一金") |
| | | @PreAuthorize("@el.check('userInsurance:list')") |
| | | public ResponseEntity<Object> queryUserInsurance(UserInsuranceQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(userInsuranceService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增个人五险一金") |
| | | @ApiOperation("新增个人五险一金") |
| | | @PreAuthorize("@el.check('userInsurance:add')") |
| | | public ResponseEntity<Object> createUserInsurance(@Validated @RequestBody UserInsurance resources){ |
| | | return new ResponseEntity<>(userInsuranceService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改个人五险一金") |
| | | @ApiOperation("修改个人五险一金") |
| | | @PreAuthorize("@el.check('userInsurance:edit')") |
| | | public ResponseEntity<Object> updateUserInsurance(@Validated @RequestBody UserInsurance resources){ |
| | | userInsuranceService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @PutMapping(value = "generate") |
| | | @Log("生成个人五险一金") |
| | | @ApiOperation("生成个人五险一金") |
| | | @PreAuthorize("@el.check('userInsurance:generate')") |
| | | public ResponseEntity<Object> generateUserInsurance(@RequestBody UserInsuranceGenerateParam param) { |
| | | userInsuranceService.generate(param); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除个人五险一金") |
| | | @ApiOperation("删除个人五险一金") |
| | | @PreAuthorize("@el.check('userInsurance:del')") |
| | | public ResponseEntity<Object> deleteUserInsurance(@RequestBody Long[] ids) { |
| | | userInsuranceService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.treatment.domain.UserLevelWage; |
| | | import me.zhengjie.modules.treatment.service.UserLevelWageService; |
| | | import me.zhengjie.modules.treatment.service.dto.UserLevelWageQueryCriteria; |
| | | 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 java.util.List; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "个人级别工资管理") |
| | | @RequestMapping("/api/userLevelWage") |
| | | public class UserLevelWageController { |
| | | |
| | | private final UserLevelWageService userLevelWageService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('userLevelWage:list')") |
| | | public void exportUserLevelWage(HttpServletResponse response, UserLevelWageQueryCriteria criteria) throws IOException { |
| | | userLevelWageService.download(userLevelWageService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询个人级别工资") |
| | | @ApiOperation("查询个人级别工资") |
| | | @PreAuthorize("@el.check('userLevelWage:list')") |
| | | public ResponseEntity<Object> queryUserLevelWage(UserLevelWageQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(userLevelWageService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping(value = "/upload") |
| | | @Log("新增个人级别工资") |
| | | @ApiOperation("新增个人级别工资") |
| | | @PreAuthorize("@el.check('userLevelWage:add')") |
| | | public ResponseEntity<Object> uploadUserLevelWage(@Validated @RequestBody List<UserLevelWage> resources){ |
| | | userLevelWageService.upload(resources); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增个人级别工资") |
| | | @ApiOperation("新增个人级别工资") |
| | | @PreAuthorize("@el.check('userLevelWage:add')") |
| | | public ResponseEntity<Object> createUserLevelWage(@Validated @RequestBody UserLevelWage resources){ |
| | | return new ResponseEntity<>(userLevelWageService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改个人级别工资") |
| | | @ApiOperation("修改个人级别工资") |
| | | @PreAuthorize("@el.check('userLevelWage:edit')") |
| | | public ResponseEntity<Object> updateUserLevelWage(@Validated @RequestBody UserLevelWage resources){ |
| | | userLevelWageService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除个人级别工资") |
| | | @ApiOperation("删除个人级别工资") |
| | | @PreAuthorize("@el.check('userLevelWage:del')") |
| | | public ResponseEntity<Object> deleteUserLevelWage(@RequestBody Long[] ids) { |
| | | userLevelWageService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service; |
| | | |
| | | import me.zhengjie.modules.treatment.domain.CmnInsurance; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnInsuranceDto; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnInsuranceQueryCriteria; |
| | | 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-05-09 |
| | | **/ |
| | | public interface CmnInsuranceService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(CmnInsuranceQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<CmnInsuranceDto> |
| | | */ |
| | | List<CmnInsuranceDto> queryAll(CmnInsuranceQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return CmnInsuranceDto |
| | | */ |
| | | CmnInsuranceDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return CmnInsuranceDto |
| | | */ |
| | | CmnInsuranceDto create(CmnInsurance resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(CmnInsurance resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<CmnInsuranceDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service; |
| | | |
| | | import me.zhengjie.modules.treatment.domain.CmnLevelRank; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelRankDto; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelRankQueryCriteria; |
| | | 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-05-07 |
| | | **/ |
| | | public interface CmnLevelRankService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(CmnLevelRankQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<CmnLevelRankDto> |
| | | */ |
| | | List<CmnLevelRankDto> queryAll(CmnLevelRankQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return CmnLevelRankDto |
| | | */ |
| | | CmnLevelRankDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return CmnLevelRankDto |
| | | */ |
| | | CmnLevelRankDto create(CmnLevelRank resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(CmnLevelRank resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<CmnLevelRankDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service; |
| | | |
| | | import me.zhengjie.modules.treatment.domain.CmnLevel; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelDto; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelQueryCriteria; |
| | | 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-05-07 |
| | | **/ |
| | | public interface CmnLevelService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(CmnLevelQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<CmnLevelDto> |
| | | */ |
| | | List<CmnLevelDto> queryAll(CmnLevelQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return CmnLevelDto |
| | | */ |
| | | CmnLevelDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return CmnLevelDto |
| | | */ |
| | | CmnLevelDto create(CmnLevel resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(CmnLevel resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<CmnLevelDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service; |
| | | |
| | | import me.zhengjie.modules.treatment.domain.UserInsurance; |
| | | import me.zhengjie.modules.treatment.service.dto.UserInsuranceDto; |
| | | import me.zhengjie.modules.treatment.service.dto.UserInsuranceGenerateParam; |
| | | import me.zhengjie.modules.treatment.service.dto.UserInsuranceQueryCriteria; |
| | | 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-05-07 |
| | | **/ |
| | | public interface UserInsuranceService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(UserInsuranceQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<UserInsuranceDto> |
| | | */ |
| | | List<UserInsuranceDto> queryAll(UserInsuranceQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return UserInsuranceDto |
| | | */ |
| | | UserInsuranceDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return UserInsuranceDto |
| | | */ |
| | | UserInsuranceDto create(UserInsurance resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(UserInsurance resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<UserInsuranceDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | void generate(UserInsuranceGenerateParam param); |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service; |
| | | |
| | | import me.zhengjie.modules.treatment.domain.UserLevelWage; |
| | | import me.zhengjie.modules.treatment.service.dto.UserLevelWageDto; |
| | | import me.zhengjie.modules.treatment.service.dto.UserLevelWageQueryCriteria; |
| | | 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-05-07 |
| | | **/ |
| | | public interface UserLevelWageService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(UserLevelWageQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<UserLevelWageDto> |
| | | */ |
| | | List<UserLevelWageDto> queryAll(UserLevelWageQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return UserLevelWageDto |
| | | */ |
| | | UserLevelWageDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return UserLevelWageDto |
| | | */ |
| | | UserLevelWageDto create(UserLevelWage resources); |
| | | |
| | | /** |
| | | * 上传 |
| | | * @param resources / |
| | | */ |
| | | void upload(List<UserLevelWage> resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(UserLevelWage resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<UserLevelWageDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | void flushAll(Long[] ids); |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyDto; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-09 |
| | | **/ |
| | | @Data |
| | | public class CmnInsuranceDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 公司区分 */ |
| | | private SysCompanyDto company; |
| | | |
| | | /** 公积金基数 */ |
| | | private BigDecimal accumulationFund; |
| | | |
| | | /** 公积金个人比例 */ |
| | | private Double accumulationFundPersonal; |
| | | |
| | | /** 公积金公司比例 */ |
| | | private Double accumulationFundCompany; |
| | | |
| | | /** 养老险基数 */ |
| | | private BigDecimal retirementInsurance; |
| | | |
| | | /** 公积金个人比例 */ |
| | | private Double retirementInsurancePersonal; |
| | | |
| | | /** 公积金公司比例 */ |
| | | private Double retirementInsuranceCompany; |
| | | |
| | | /** 医疗险基数 */ |
| | | private BigDecimal medicalInsurance; |
| | | |
| | | /** 医疗险个人比例 */ |
| | | private Double medicalInsurancePersonal; |
| | | |
| | | /** 医疗险公司比例 */ |
| | | private Double medicalInsuranceCompany; |
| | | |
| | | /** 失业险基数 */ |
| | | private BigDecimal unemploymentInsurance; |
| | | |
| | | /** 失业险个人比例 */ |
| | | private Double unemploymentInsurancePersonal; |
| | | |
| | | /** 失业险公司比例 */ |
| | | private Double unemploymentInsuranceCompany; |
| | | |
| | | /** 生育险基数 */ |
| | | private BigDecimal birthInsurance; |
| | | |
| | | /** 生育险个人比例 */ |
| | | private Double birthInsurancePersonal; |
| | | |
| | | /** 生育险公司比例 */ |
| | | private Double birthInsuranceCompany; |
| | | |
| | | /** 工伤险基数 */ |
| | | private BigDecimal employmentInsurance; |
| | | |
| | | /** 工伤险个人比例 */ |
| | | private Double employmentInsurancePersonal; |
| | | |
| | | /** 工伤险公司比例 */ |
| | | private Double employmentInsuranceCompany; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-09 |
| | | **/ |
| | | @Data |
| | | public class CmnInsuranceQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query(joinName = "company", propName = "id") |
| | | private Long companyId; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.dto; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | import me.zhengjie.modules.system.service.dto.JobSmallDto; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class CmnLevelDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 岗位 */ |
| | | private JobSmallDto job; |
| | | |
| | | /** 名称 */ |
| | | private String name; |
| | | |
| | | /** 级别等级列表 */ |
| | | private List<CmnLevelRankSmallDto> cmnLevelRankList; |
| | | |
| | | /** 基本工资 */ |
| | | private BigDecimal basicWage; |
| | | |
| | | /** 浮动工资 */ |
| | | private BigDecimal rankWage; |
| | | |
| | | /** 绩效工资 */ |
| | | private BigDecimal performanceWage; |
| | | |
| | | /** 描述 */ |
| | | private String description; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class CmnLevelQueryCriteria { |
| | | |
| | | /** 精确 */ |
| | | @Query(joinName = "job", propName = "id") |
| | | private Long jobId; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String name; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.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-05-07 |
| | | **/ |
| | | @Data |
| | | public class CmnLevelRankDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 岗位ID */ |
| | | private CmnLevelDto level; |
| | | |
| | | /** 最小等级工资 */ |
| | | private BigDecimal minRankWage; |
| | | |
| | | /** 最大等级工资 */ |
| | | private BigDecimal maxRankWage; |
| | | |
| | | /** 绩效系数 */ |
| | | private Double performanceCoefficient; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class CmnLevelRankQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long levelId; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String name; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class CmnLevelRankSmallDto implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 最小等级工资 */ |
| | | private BigDecimal minRankWage; |
| | | |
| | | /** 最大等级工资 */ |
| | | private BigDecimal maxRankWage; |
| | | |
| | | /** 绩效系数 */ |
| | | private Double performanceCoefficient; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class UserInsuranceDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 用户ID */ |
| | | private Long userId; |
| | | |
| | | /** 用户昵称 */ |
| | | private String nickName; |
| | | |
| | | /** 年月 */ |
| | | private String yearMonth; |
| | | |
| | | /** 公积金基数 */ |
| | | private BigDecimal accumulationFund; |
| | | |
| | | /** 公积金个人比例 */ |
| | | private Double accumulationFundPersonal; |
| | | |
| | | /** 公积金公司比例 */ |
| | | private Double accumulationFundCompany; |
| | | |
| | | /** 养老险基数 */ |
| | | private BigDecimal retirementInsurance; |
| | | |
| | | /** 公积金个人比例 */ |
| | | private Double retirementInsurancePersonal; |
| | | |
| | | /** 公积金公司比例 */ |
| | | private Double retirementInsuranceCompany; |
| | | |
| | | /** 医疗险基数 */ |
| | | private BigDecimal medicalInsurance; |
| | | |
| | | /** 医疗险个人比例 */ |
| | | private Double medicalInsurancePersonal; |
| | | |
| | | /** 医疗险公司比例 */ |
| | | private Double medicalInsuranceCompany; |
| | | |
| | | /** 失业险基数 */ |
| | | private BigDecimal unemploymentInsurance; |
| | | |
| | | /** 失业险个人比例 */ |
| | | private Double unemploymentInsurancePersonal; |
| | | |
| | | /** 失业险公司比例 */ |
| | | private Double unemploymentInsuranceCompany; |
| | | |
| | | /** 生育险基数 */ |
| | | private BigDecimal birthInsurance; |
| | | |
| | | /** 生育险个人比例 */ |
| | | private Double birthInsurancePersonal; |
| | | |
| | | /** 生育险公司比例 */ |
| | | private Double birthInsuranceCompany; |
| | | |
| | | /** 工伤险基数 */ |
| | | private BigDecimal employmentInsurance; |
| | | |
| | | /** 工伤险个人比例 */ |
| | | private Double employmentInsurancePersonal; |
| | | |
| | | /** 工伤险公司比例 */ |
| | | private Double employmentInsuranceCompany; |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.treatment.service.dto; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.modules.system.service.dto.DeptUserNodeDto; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class UserInsuranceGenerateParam { |
| | | |
| | | // 对象年月 |
| | | private String targetYearMonth; |
| | | // 员工ID |
| | | private List<DeptUserNodeDto> nodes; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | import me.zhengjie.annotation.Query.Type; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class UserInsuranceQueryCriteria { |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long userId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String yearMonth; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.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-05-07 |
| | | **/ |
| | | @Data |
| | | public class UserLevelWageDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 用户ID */ |
| | | private Long userId; |
| | | |
| | | /** 用户名 */ |
| | | private String nickName; |
| | | |
| | | /** 年月 */ |
| | | private String yearMonth; |
| | | |
| | | /** 级别 */ |
| | | private Long level; |
| | | |
| | | /** 等级 */ |
| | | private Long rank; |
| | | |
| | | /** 级别基本工资 */ |
| | | private BigDecimal basicWage; |
| | | |
| | | /** 级别等级工资 */ |
| | | private BigDecimal rankWage; |
| | | |
| | | /** 绩效工资 */ |
| | | private BigDecimal performanceWage; |
| | | |
| | | /** 团队工资比例 */ |
| | | private BigDecimal performanceCoefficient; |
| | | |
| | | /** 锁定状态 */ |
| | | private Integer locked; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Data |
| | | public class UserLevelWageQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long userId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String yearMonth; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.impl; |
| | | |
| | | import me.zhengjie.modules.treatment.domain.CmnInsurance; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.treatment.repository.CmnInsuranceRepository; |
| | | import me.zhengjie.modules.treatment.service.CmnInsuranceService; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnInsuranceDto; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnInsuranceQueryCriteria; |
| | | import me.zhengjie.modules.treatment.service.mapstruct.CmnInsuranceMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | 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-05-09 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CmnInsuranceServiceImpl implements CmnInsuranceService { |
| | | |
| | | private final CmnInsuranceRepository cmnInsuranceRepository; |
| | | private final CmnInsuranceMapper cmnInsuranceMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CmnInsuranceQueryCriteria criteria, Pageable pageable){ |
| | | Page<CmnInsurance> page = cmnInsuranceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(cmnInsuranceMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<CmnInsuranceDto> queryAll(CmnInsuranceQueryCriteria criteria){ |
| | | return cmnInsuranceMapper.toDto(cmnInsuranceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public CmnInsuranceDto findById(Long id) { |
| | | CmnInsurance cmnInsurance = cmnInsuranceRepository.findById(id).orElseGet(CmnInsurance::new); |
| | | ValidationUtil.isNull(cmnInsurance.getId(),"CmnInsurance","id",id); |
| | | return cmnInsuranceMapper.toDto(cmnInsurance); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public CmnInsuranceDto create(CmnInsurance resources) { |
| | | return cmnInsuranceMapper.toDto(cmnInsuranceRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(CmnInsurance resources) { |
| | | CmnInsurance cmnInsurance = cmnInsuranceRepository.findById(resources.getId()).orElseGet(CmnInsurance::new); |
| | | ValidationUtil.isNull( cmnInsurance.getId(),"CmnInsurance","id",resources.getId()); |
| | | cmnInsurance.copy(resources); |
| | | cmnInsuranceRepository.save(cmnInsurance); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | cmnInsuranceRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<CmnInsuranceDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (CmnInsuranceDto cmnInsurance : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("公司", cmnInsurance.getCompany().getLabel()); |
| | | map.put("公积金基数", cmnInsurance.getAccumulationFund()); |
| | | map.put("公积金个人比例", cmnInsurance.getAccumulationFundPersonal()); |
| | | map.put("公积金公司比例", cmnInsurance.getAccumulationFundCompany()); |
| | | map.put("养老险基数", cmnInsurance.getRetirementInsurance()); |
| | | map.put("公积金个人比例", cmnInsurance.getRetirementInsurancePersonal()); |
| | | map.put("公积金公司比例", cmnInsurance.getRetirementInsuranceCompany()); |
| | | map.put("医疗险基数", cmnInsurance.getMedicalInsurance()); |
| | | map.put("医疗险个人比例", cmnInsurance.getMedicalInsurancePersonal()); |
| | | map.put("医疗险公司比例", cmnInsurance.getMedicalInsuranceCompany()); |
| | | map.put("失业险基数", cmnInsurance.getUnemploymentInsurance()); |
| | | map.put("失业险个人比例", cmnInsurance.getUnemploymentInsurancePersonal()); |
| | | map.put("失业险公司比例", cmnInsurance.getUnemploymentInsuranceCompany()); |
| | | map.put("生育险基数", cmnInsurance.getBirthInsurance()); |
| | | map.put("生育险个人比例", cmnInsurance.getBirthInsurancePersonal()); |
| | | map.put("生育险公司比例", cmnInsurance.getBirthInsuranceCompany()); |
| | | map.put("工伤险基数", cmnInsurance.getEmploymentInsurance()); |
| | | map.put("工伤险个人比例", cmnInsurance.getEmploymentInsurancePersonal()); |
| | | map.put("工伤险公司比例", cmnInsurance.getEmploymentInsuranceCompany()); |
| | | map.put("创建者", cmnInsurance.getCreateBy()); |
| | | map.put("创建日期", cmnInsurance.getCreateTime()); |
| | | map.put("更新者", cmnInsurance.getUpdateBy()); |
| | | map.put("更新时间", cmnInsurance.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.impl; |
| | | |
| | | import me.zhengjie.modules.treatment.domain.CmnLevelRank; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.treatment.repository.CmnLevelRankRepository; |
| | | import me.zhengjie.modules.treatment.service.CmnLevelRankService; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelRankDto; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelRankQueryCriteria; |
| | | import me.zhengjie.modules.treatment.service.mapstruct.CmnLevelRankMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | 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-05-07 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CmnLevelRankServiceImpl implements CmnLevelRankService { |
| | | |
| | | private final CmnLevelRankRepository cmnLevelRankRepository; |
| | | private final CmnLevelRankMapper cmnLevelRankMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CmnLevelRankQueryCriteria criteria, Pageable pageable){ |
| | | Page<CmnLevelRank> page = cmnLevelRankRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(cmnLevelRankMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<CmnLevelRankDto> queryAll(CmnLevelRankQueryCriteria criteria){ |
| | | return cmnLevelRankMapper.toDto(cmnLevelRankRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public CmnLevelRankDto findById(Long id) { |
| | | CmnLevelRank cmnLevelRank = cmnLevelRankRepository.findById(id).orElseGet(CmnLevelRank::new); |
| | | ValidationUtil.isNull(cmnLevelRank.getId(),"CmnLevelRank","id",id); |
| | | return cmnLevelRankMapper.toDto(cmnLevelRank); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public CmnLevelRankDto create(CmnLevelRank resources) { |
| | | return cmnLevelRankMapper.toDto(cmnLevelRankRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(CmnLevelRank resources) { |
| | | CmnLevelRank cmnLevelRank = cmnLevelRankRepository.findById(resources.getId()).orElseGet(CmnLevelRank::new); |
| | | ValidationUtil.isNull( cmnLevelRank.getId(),"CmnLevelRank","id",resources.getId()); |
| | | cmnLevelRank.copy(resources); |
| | | cmnLevelRankRepository.save(cmnLevelRank); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | cmnLevelRankRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<CmnLevelRankDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (CmnLevelRankDto cmnLevelRank : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("岗位", cmnLevelRank.getLevel().getJob().getName()); |
| | | map.put("级别", cmnLevelRank.getLevel().getName()); |
| | | // map.put("名称", cmnLevelRank.getName()); |
| | | // map.put("描述", cmnLevelRank.getDescription()); |
| | | // map.put("基本工资", cmnLevelRank.getBasicWage()); |
| | | // map.put("绩效工资", cmnLevelRank.getPerformanceWage()); |
| | | map.put("最小等级工资", cmnLevelRank.getMinRankWage()); |
| | | map.put("最大等级工资", cmnLevelRank.getMaxRankWage()); |
| | | map.put("绩效系数", cmnLevelRank.getPerformanceCoefficient()); |
| | | map.put("创建者", cmnLevelRank.getCreateBy()); |
| | | map.put("创建时间", cmnLevelRank.getCreateTime()); |
| | | map.put("更新者", cmnLevelRank.getUpdateBy()); |
| | | map.put("更新时间", cmnLevelRank.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.treatment.domain.CmnLevel; |
| | | import me.zhengjie.modules.treatment.domain.CmnLevelRank; |
| | | import me.zhengjie.modules.treatment.repository.CmnLevelRankRepository; |
| | | import me.zhengjie.modules.treatment.repository.CmnLevelRepository; |
| | | import me.zhengjie.modules.treatment.service.CmnLevelService; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelDto; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelQueryCriteria; |
| | | import me.zhengjie.modules.treatment.service.mapstruct.CmnLevelMapper; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CmnLevelServiceImpl implements CmnLevelService { |
| | | |
| | | private final CmnLevelRepository cmnLevelRepository; |
| | | private final CmnLevelRankRepository cmnLevelRankRepository; |
| | | private final CmnLevelMapper cmnLevelMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CmnLevelQueryCriteria criteria, Pageable pageable){ |
| | | Page<CmnLevel> page = cmnLevelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(cmnLevelMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<CmnLevelDto> queryAll(CmnLevelQueryCriteria criteria){ |
| | | return cmnLevelMapper.toDto(cmnLevelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public CmnLevelDto findById(Long id) { |
| | | CmnLevel cmnLevel = cmnLevelRepository.findById(id).orElseGet(CmnLevel::new); |
| | | ValidationUtil.isNull(cmnLevel.getId(),"CmnLevel","id",id); |
| | | return cmnLevelMapper.toDto(cmnLevel); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public CmnLevelDto create(CmnLevel resources) { |
| | | return cmnLevelMapper.toDto(cmnLevelRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(CmnLevel resources) { |
| | | CmnLevel cmnLevel = cmnLevelRepository.findById(resources.getId()).orElseGet(CmnLevel::new); |
| | | ValidationUtil.isNull( cmnLevel.getId(),"CmnLevel","id",resources.getId()); |
| | | cmnLevel.copy(resources); |
| | | for (CmnLevelRank cmnLevelRank : cmnLevel.getCmnLevelRankList()) { |
| | | cmnLevelRank.setLevel(cmnLevel); |
| | | } |
| | | cmnLevelRankRepository.deleteByLevelId(cmnLevel.getId()); |
| | | cmnLevelRepository.save(cmnLevel); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | cmnLevelRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<CmnLevelDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (CmnLevelDto cmnLevel : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("岗位", cmnLevel.getJob().getName()); |
| | | map.put("名称", cmnLevel.getName()); |
| | | map.put("描述", cmnLevel.getDescription()); |
| | | map.put("创建者", cmnLevel.getCreateBy()); |
| | | map.put("创建时间", cmnLevel.getCreateTime()); |
| | | map.put("更新者", cmnLevel.getUpdateBy()); |
| | | map.put("更新时间", cmnLevel.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.DeptRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.DeptService; |
| | | import me.zhengjie.modules.treatment.domain.CmnInsurance; |
| | | import me.zhengjie.modules.treatment.domain.UserInsurance; |
| | | import me.zhengjie.modules.treatment.repository.CmnInsuranceRepository; |
| | | import me.zhengjie.modules.treatment.repository.UserInsuranceRepository; |
| | | import me.zhengjie.modules.treatment.service.UserInsuranceService; |
| | | import me.zhengjie.modules.treatment.service.dto.UserInsuranceDto; |
| | | import me.zhengjie.modules.treatment.service.dto.UserInsuranceGenerateParam; |
| | | import me.zhengjie.modules.treatment.service.dto.UserInsuranceQueryCriteria; |
| | | import me.zhengjie.modules.treatment.service.mapstruct.UserInsuranceGenMapper; |
| | | import me.zhengjie.modules.treatment.service.mapstruct.UserInsuranceMapper; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class UserInsuranceServiceImpl implements UserInsuranceService { |
| | | |
| | | private final UserInsuranceRepository userInsuranceRepository; |
| | | private final CmnInsuranceRepository cmnInsuranceRepository; |
| | | private final UserInsuranceMapper userInsuranceMapper; |
| | | private final UserInsuranceGenMapper userInsuranceGenMapper; |
| | | private final UserRepository userRepository; |
| | | private final DeptRepository deptRepository; |
| | | private final DeptService deptService; |
| | | |
| | | @Override |
| | | public Map<String, Object> queryAll(UserInsuranceQueryCriteria criteria, Pageable pageable) { |
| | | Page<UserInsurance> page = userInsuranceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder), pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<UserInsurance, UserInsuranceDto> func = new Function<UserInsurance, UserInsuranceDto>() { |
| | | @Override |
| | | public UserInsuranceDto apply(UserInsurance t) { |
| | | // 将实体类转换成DTO |
| | | UserInsuranceDto userInsuranceDto = userInsuranceMapper.toDto(t); |
| | | // 根据用户ID查询用户信息 |
| | | User user = userRepository.findById(userInsuranceDto.getUserId()).orElseGet(User::new); |
| | | ValidationUtil.isNull(user.getId(),"User","id",userInsuranceDto.getUserId()); |
| | | // 用户昵称 |
| | | userInsuranceDto.setNickName(user.getNickName()); |
| | | // 返回处理好的DTO |
| | | return userInsuranceDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<UserInsuranceDto> queryAll(UserInsuranceQueryCriteria criteria){ |
| | | return userInsuranceMapper.toDto(userInsuranceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public UserInsuranceDto findById(Long id) { |
| | | UserInsurance userInsurance = userInsuranceRepository.findById(id).orElseGet(UserInsurance::new); |
| | | ValidationUtil.isNull(userInsurance.getId(),"UserInsurance","id",id); |
| | | return userInsuranceMapper.toDto(userInsurance); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public UserInsuranceDto create(UserInsurance resources) { |
| | | return userInsuranceMapper.toDto(userInsuranceRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(UserInsurance resources) { |
| | | UserInsurance userInsurance = userInsuranceRepository.findById(resources.getId()).orElseGet(UserInsurance::new); |
| | | ValidationUtil.isNull( userInsurance.getId(),"UserInsurance","id",resources.getId()); |
| | | userInsurance.copy(resources); |
| | | userInsuranceRepository.save(userInsurance); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | userInsuranceRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<UserInsuranceDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (UserInsuranceDto userInsurance : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("用户ID", userInsurance.getUserId()); |
| | | map.put("年月", userInsurance.getYearMonth()); |
| | | map.put("公积金基数", userInsurance.getAccumulationFund()); |
| | | map.put("公积金个人缴纳比例", userInsurance.getAccumulationFundPersonal()); |
| | | map.put("公积金公司缴纳比例", userInsurance.getAccumulationFundCompany()); |
| | | map.put("养老险基数", userInsurance.getRetirementInsurance()); |
| | | map.put("养老险个人缴纳比例", userInsurance.getRetirementInsurancePersonal()); |
| | | map.put("养老险公司缴纳比例", userInsurance.getRetirementInsuranceCompany()); |
| | | map.put("医疗险基数", userInsurance.getMedicalInsurance()); |
| | | map.put("医疗险个人缴纳比例", userInsurance.getMedicalInsurancePersonal()); |
| | | map.put("医疗险公司缴纳比例", userInsurance.getMedicalInsuranceCompany()); |
| | | map.put("失业险基数", userInsurance.getUnemploymentInsurance()); |
| | | map.put("失业险个人缴纳比例", userInsurance.getUnemploymentInsurancePersonal()); |
| | | map.put("失业险公司缴纳比例", userInsurance.getUnemploymentInsuranceCompany()); |
| | | map.put("生育险基数", userInsurance.getBirthInsurance()); |
| | | map.put("生育险个人缴纳比例", userInsurance.getBirthInsurancePersonal()); |
| | | map.put("生育险公司缴纳比例", userInsurance.getBirthInsuranceCompany()); |
| | | map.put("工伤险基数", userInsurance.getEmploymentInsurance()); |
| | | map.put("工伤险个人缴纳比例", userInsurance.getEmploymentInsurancePersonal()); |
| | | map.put("工伤险公司缴纳比例", userInsurance.getEmploymentInsuranceCompany()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void generate(UserInsuranceGenerateParam param) { |
| | | List<User> userList = null; |
| | | List<Long> deptIds = param.getNodes().stream().filter(node -> node.getLeaf() == false).map(node -> node.getId()).collect(Collectors.toList()); |
| | | List<Long> deptIdAlls = deptService.getDeptChildren(deptRepository.findByIdIn(deptIds)); |
| | | userList = userRepository.findByDeptIdInAndEnabled(deptIdAlls, true); |
| | | // if (param.getUserIds() != null && param.getUserIds().size() > 0) { |
| | | // userList = userRepository.findByIdIn(param.getUserIds()); |
| | | // } else { |
| | | // userList = userRepository.findAllByEnabled(true); |
| | | // } |
| | | List<Long> userIds = param.getNodes().stream().filter(node -> node.getLeaf() == true).map(node -> node.getId()).collect(Collectors.toList()); |
| | | userList.addAll(userRepository.findByIdIn(userIds)); |
| | | userList.stream().forEach(user -> { |
| | | Optional<CmnInsurance> cmnInsuranceOpt = cmnInsuranceRepository.findByCompany(user.getCompany()); |
| | | if (cmnInsuranceOpt.isPresent()) { |
| | | UserInsurance userInsuranceTarget = userInsuranceRepository.findByUserIdAndYearMonth(user.getId(), param.getTargetYearMonth()).orElseGet(UserInsurance::new); |
| | | UserInsurance userInsuranceSrc = userInsuranceGenMapper.cloneInsurance(cmnInsuranceOpt.get()); |
| | | userInsuranceTarget.copy(userInsuranceSrc); |
| | | userInsuranceTarget.setUserId(user.getId()); |
| | | userInsuranceTarget.setYearMonth(param.getTargetYearMonth()); |
| | | userInsuranceRepository.save(userInsuranceTarget); |
| | | } |
| | | }); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.function.Function; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.treatment.domain.UserInsurance; |
| | | import me.zhengjie.modules.treatment.domain.UserLevelWage; |
| | | import me.zhengjie.modules.treatment.repository.CmnInsuranceRepository; |
| | | import me.zhengjie.modules.treatment.repository.UserInsuranceRepository; |
| | | import me.zhengjie.modules.treatment.repository.UserLevelWageRepository; |
| | | import me.zhengjie.modules.treatment.service.UserLevelWageService; |
| | | import me.zhengjie.modules.treatment.service.dto.UserLevelWageDto; |
| | | import me.zhengjie.modules.treatment.service.dto.UserLevelWageQueryCriteria; |
| | | import me.zhengjie.modules.treatment.service.mapstruct.UserLevelWageMapper; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class UserLevelWageServiceImpl implements UserLevelWageService { |
| | | |
| | | private final UserLevelWageRepository userLevelWageRepository; |
| | | private final UserLevelWageMapper userLevelWageMapper; |
| | | private final UserRepository userRepository; |
| | | |
| | | private final UserInsuranceRepository userInsuranceRepository; |
| | | private final CmnInsuranceRepository cmnInsuranceRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(UserLevelWageQueryCriteria criteria, Pageable pageable){ |
| | | Page<UserLevelWage> page = userLevelWageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<UserLevelWage, UserLevelWageDto> func = new Function<UserLevelWage, UserLevelWageDto>() { |
| | | @Override |
| | | public UserLevelWageDto apply(UserLevelWage userLevelWage) { |
| | | // 将实体类转换成DTO |
| | | UserLevelWageDto userLevelWageDto = userLevelWageMapper.toDto(userLevelWage); |
| | | User user = userRepository.findById(userLevelWageDto.getUserId()).orElseGet(User::new); |
| | | ValidationUtil.isNull(userLevelWageDto.getId(),"User","id",userLevelWageDto.getUserId()); |
| | | userLevelWageDto.setNickName(user.getNickName()); |
| | | return userLevelWageDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<UserLevelWageDto> queryAll(UserLevelWageQueryCriteria criteria){ |
| | | return userLevelWageMapper.toDto(userLevelWageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public UserLevelWageDto findById(Long id) { |
| | | UserLevelWage userLevelWage = userLevelWageRepository.findById(id).orElseGet(UserLevelWage::new); |
| | | ValidationUtil.isNull(userLevelWage.getId(),"UserLevelWage","id",id); |
| | | return userLevelWageMapper.toDto(userLevelWage); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public UserLevelWageDto create(UserLevelWage resources) { |
| | | resources.setPerformanceCoefficient(calculatePerformanceCoefficient(resources)); |
| | | return userLevelWageMapper.toDto(userLevelWageRepository.save(resources)); |
| | | } |
| | | |
| | | private BigDecimal calculatePerformanceCoefficient(UserLevelWage resources) { |
| | | BigDecimal total = resources.getBasicWage().add(resources.getRankWage()).add(resources.getPerformanceWage()); |
| | | Optional<UserInsurance> userInsuranceOpt = userInsuranceRepository.findByUserIdAndYearMonth(resources.getUserId(), resources.getYearMonth()); |
| | | if (userInsuranceOpt.isPresent()) { |
| | | UserInsurance userInsurance = userInsuranceOpt.get(); |
| | | total = total.add(userInsurance.getAccumulationFund().multiply(BigDecimal.valueOf(userInsurance.getAccumulationFundCompany() / 100))) |
| | | .add(userInsurance.getBirthInsurance().multiply(BigDecimal.valueOf(userInsurance.getBirthInsuranceCompany() / 100))) |
| | | .add(userInsurance.getEmploymentInsurance().multiply(BigDecimal.valueOf(userInsurance.getEmploymentInsuranceCompany() / 100))) |
| | | .add(userInsurance.getMedicalInsurance().multiply(BigDecimal.valueOf(userInsurance.getMedicalInsuranceCompany() / 100))) |
| | | .add(userInsurance.getRetirementInsurance().multiply(BigDecimal.valueOf(userInsurance.getRetirementInsuranceCompany() / 100))) |
| | | .add(userInsurance.getUnemploymentInsurance().multiply(BigDecimal.valueOf(userInsurance.getUnemploymentInsuranceCompany() / 100))); |
| | | } |
| | | return total.divide(BigDecimal.valueOf(11250), 2, RoundingMode.UP); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void upload(List<UserLevelWage> resources) { |
| | | for (UserLevelWage userLevelWage : resources) { |
| | | UserLevelWage userLevelWageDB = userLevelWageRepository.findByUserIdAndYearMonth(userLevelWage.getUserId(), userLevelWage.getYearMonth()); |
| | | if (userLevelWageDB == null) { |
| | | userLevelWageRepository.save(userLevelWage); |
| | | } else { |
| | | userLevelWageDB.copy(userLevelWage); |
| | | userLevelWageRepository.save(userLevelWageDB); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(UserLevelWage resources) { |
| | | UserLevelWage userLevelWage = userLevelWageRepository.findById(resources.getId()).orElseGet(UserLevelWage::new); |
| | | ValidationUtil.isNull( userLevelWage.getId(),"UserLevelWage","id",resources.getId()); |
| | | userLevelWage.copy(resources); |
| | | userLevelWage.setPerformanceCoefficient(calculatePerformanceCoefficient(userLevelWage)); |
| | | userLevelWageRepository.save(userLevelWage); |
| | | } |
| | | |
| | | @Override |
| | | public void flushAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | UserLevelWage userLevelWage = userLevelWageRepository.findById(id).orElseGet(UserLevelWage::new); |
| | | userLevelWage.setPerformanceCoefficient(calculatePerformanceCoefficient(userLevelWage)); |
| | | userLevelWageRepository.save(userLevelWage); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | userLevelWageRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<UserLevelWageDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (UserLevelWageDto userLevelWage : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("用户ID", userLevelWage.getUserId()); |
| | | map.put("年月", userLevelWage.getYearMonth()); |
| | | map.put("级别", userLevelWage.getLevel()); |
| | | map.put("等级", userLevelWage.getRank()); |
| | | map.put("级别基本工资", userLevelWage.getBasicWage()); |
| | | map.put("级别等级工资", userLevelWage.getRankWage()); |
| | | map.put("绩效工资", userLevelWage.getPerformanceWage()); |
| | | map.put("团队工资比例", userLevelWage.getPerformanceCoefficient()); |
| | | map.put("锁定状态", userLevelWage.getLocked()); |
| | | map.put("备注", userLevelWage.getRemarks()); |
| | | map.put("创建者", userLevelWage.getCreateBy()); |
| | | map.put("创建时间", userLevelWage.getCreateTime()); |
| | | map.put("更新者", userLevelWage.getUpdateBy()); |
| | | map.put("更新时间", userLevelWage.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.treatment.domain.CmnInsurance; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnInsuranceDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-09 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface CmnInsuranceMapper extends BaseMapper<CmnInsuranceDto, CmnInsurance> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.treatment.domain.CmnLevel; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface CmnLevelMapper extends BaseMapper<CmnLevelDto, CmnLevel> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.treatment.domain.CmnLevelRank; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelRankDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface CmnLevelRankMapper extends BaseMapper<CmnLevelRankDto, CmnLevelRank> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.treatment.domain.CmnLevelRank; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelRankSmallDto; |
| | | |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface CmnLevelRankSmallMapper extends BaseMapper<CmnLevelRankSmallDto, CmnLevelRank> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.mapstruct; |
| | | |
| | | import me.zhengjie.modules.treatment.domain.CmnInsurance; |
| | | import me.zhengjie.modules.treatment.domain.UserInsurance; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface UserInsuranceGenMapper { |
| | | |
| | | @Mapping(target = "id", ignore = true) |
| | | UserInsurance cloneInsurance(CmnInsurance cmnInsurance); |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.treatment.domain.UserInsurance; |
| | | import me.zhengjie.modules.treatment.service.dto.UserInsuranceDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface UserInsuranceMapper extends BaseMapper<UserInsuranceDto, UserInsurance> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.treatment.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.treatment.domain.UserLevelWage; |
| | | import me.zhengjie.modules.treatment.service.dto.UserLevelWageDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface UserLevelWageMapper extends BaseMapper<UserLevelWageDto, UserLevelWage> { |
| | | |
| | | } |
| | |
| | | #配置数据源 |
| | | spring: |
| | | datasource: |
| | | druid: |
| | | db-type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy |
| | | url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.1.210}:${DB_PORT:3306}/${DB_NAME:pms_upgrade}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false |
| | | username: ${DB_USER:root} |
| | | password: ${DB_PWD:dlyh123456} |
| | | # 初始连接数 |
| | | initial-size: 5 |
| | | # 最小连接数 |
| | | min-idle: 15 |
| | | # 最大连接数 |
| | | max-active: 30 |
| | | # 超时时间(以秒数为单位) |
| | | remove-abandoned-timeout: 180 |
| | | # 获取连接超时时间 |
| | | max-wait: 3000 |
| | | # 连接有效性检测时间 |
| | | time-between-eviction-runs-millis: 60000 |
| | | # 连接在池中最小生存的时间 |
| | | min-evictable-idle-time-millis: 300000 |
| | | # 连接在池中最大生存的时间 |
| | | max-evictable-idle-time-millis: 900000 |
| | | # 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除 |
| | | test-while-idle: true |
| | | # 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个 |
| | | test-on-borrow: true |
| | | # 是否在归还到池中前进行检验 |
| | | test-on-return: false |
| | | # 检测连接是否有效 |
| | | validation-query: select 1 |
| | | # 配置监控统计 |
| | | webStatFilter: |
| | | enabled: true |
| | | stat-view-servlet: |
| | | enabled: true |
| | | url-pattern: /druid/* |
| | | reset-enable: false |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # 记录慢SQL |
| | | log-slow-sql: true |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | # 配置消息队列 |
| | | rabbitmq: |
| | | host: 114.116.101.63 |
| | | port: 31444 |
| | | username: admin |
| | | password: 7658757a@ |
| | | # 虚拟host 可以不设置,使用server默认host |
| | | virtual-host: / |
| | | |
| | | # 登录相关配置 |
| | | login: |
| | | # 是否限制单用户登录 |
| | | single-login: false |
| | | # Redis用户登录缓存配置 |
| | | user-cache: |
| | | # 存活时间/秒 |
| | | idle-time: 7200 |
| | | # 验证码 |
| | | login-code: |
| | | # 验证码类型配置 查看 LoginProperties 类 |
| | | code-type: arithmetic |
| | | # 登录图形验证码有效时间/分钟 |
| | | expiration: 2 |
| | | # 验证码高度 |
| | | width: 111 |
| | | # 验证码宽度 |
| | | height: 36 |
| | | # 内容长度 |
| | | length: 2 |
| | | # 字体名称,为空则使用默认字体 |
| | | font-name: |
| | | # 字体大小 |
| | | font-size: 25 |
| | | |
| | | #jwt |
| | | jwt: |
| | | header: Authorization |
| | | # 令牌前缀 |
| | | token-start-with: Bearer |
| | | # 必须使用最少88位的Base64对该令牌进行编码 |
| | | base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI= |
| | | # 令牌过期时间 此处单位/毫秒 ,默认4小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html |
| | | token-validity-in-seconds: 14400000 |
| | | # 在线用户key |
| | | online-key: online-token- |
| | | # 验证码 |
| | | code-key: code-key- |
| | | # token 续期检查时间范围(默认30分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期 |
| | | detect: 1800000 |
| | | # 续期时间范围,默认1小时,单位毫秒 |
| | | renew: 3600000 |
| | | |
| | | #是否允许生成代码,生产环境设置为false |
| | | generator: |
| | | enabled: true |
| | | |
| | | #是否开启 swagger-ui |
| | | swagger: |
| | | enabled: true |
| | | |
| | | # IP 本地解析 |
| | | ip: |
| | | local-parsing: true |
| | | |
| | | # 文件存储路径 |
| | | file: |
| | | mac: |
| | | path: ~/file/ |
| | | avatar: ~/avatar/ |
| | | linux: |
| | | path: /home/eladmin/file/ |
| | | avatar: /home/eladmin/avatar/ |
| | | windows: |
| | | path: C:\eladmin\file\ |
| | | avatar: C:\eladmin\avatar\ |
| | | # 文件大小 /M |
| | | maxSize: 100 |
| | | avatarMaxSize: 5 |
| | | |
| | | # Flowable |
| | | flowable: |
| | | url: http://localhost:8888 |
| | | #配置数据源
|
| | | spring:
|
| | | main:
allow-circular-references: true
|
| | | data:
|
| | | mongodb:
|
| | | uri: mongodb://mongoadmin:secret@114.116.101.63:32452/pms?authSource=admin&readPreference=primary&ssl=false&directConnection=true
|
| | | datasource:
|
| | | druid:
|
| | | db-type: com.alibaba.druid.pool.DruidDataSource
|
| | | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
| | | url: jdbc:log4jdbc:mysql://${DB_HOST:114.116.101.63}:${DB_PORT:31404}/${DB_NAME:pms_upgrade}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
| | | username: ${DB_USER:root}
|
| | | password: ${DB_PWD:123456}
|
| | | # 初始连接数
|
| | | initial-size: 5
|
| | | # 最小连接数
|
| | | min-idle: 15
|
| | | # 最大连接数
|
| | | max-active: 30
|
| | | # 超时时间(以秒数为单位)
|
| | | remove-abandoned-timeout: 180
|
| | | # 获取连接超时时间
|
| | | max-wait: 3000
|
| | | # 连接有效性检测时间
|
| | | time-between-eviction-runs-millis: 60000
|
| | | # 连接在池中最小生存的时间
|
| | | min-evictable-idle-time-millis: 300000
|
| | | # 连接在池中最大生存的时间
|
| | | max-evictable-idle-time-millis: 900000
|
| | | # 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
| | | test-while-idle: true
|
| | | # 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
| | | test-on-borrow: true
|
| | | # 是否在归还到池中前进行检验
|
| | | test-on-return: false
|
| | | # 检测连接是否有效
|
| | | validation-query: select 1
|
| | | # 配置监控统计
|
| | | webStatFilter:
|
| | | enabled: true
|
| | | stat-view-servlet:
|
| | | enabled: true
|
| | | url-pattern: /druid/*
|
| | | reset-enable: false
|
| | | filter:
|
| | | stat:
|
| | | enabled: true
|
| | | # 记录慢SQL
|
| | | log-slow-sql: true
|
| | | slow-sql-millis: 1000
|
| | | merge-sql: true
|
| | | wall:
|
| | | config:
|
| | | multi-statement-allow: true
|
| | | # 配置消息队列
|
| | | rabbitmq:
|
| | | host: 114.116.101.63
|
| | | port: 31444
|
| | | username: ${RABBITMQ_DEFAULT_USER:admin}
|
| | | password: ${RABBITMQ_DEFAULT_PASS:7658757a@}
|
| | | # 虚拟host 可以不设置,使用server默认host
|
| | | virtual-host: ${RABBITMQ_DEFAULT_VHOST:/}
|
| | | # 登录相关配置
|
| | | login:
|
| | | # 是否限制单用户登录
|
| | | single-login: false
|
| | | # Redis用户登录缓存配置
|
| | | user-cache:
|
| | | # 存活时间/秒
|
| | | idle-time: 7200
|
| | | # 验证码
|
| | | login-code:
|
| | | # 验证码类型配置 查看 LoginProperties 类
|
| | | code-type: arithmetic
|
| | | # 登录图形验证码有效时间/分钟
|
| | | expiration: 2
|
| | | # 验证码高度
|
| | | width: 111
|
| | | # 验证码宽度
|
| | | height: 36
|
| | | # 内容长度
|
| | | length: 2
|
| | | # 字体名称,为空则使用默认字体
|
| | | font-name:
|
| | | # 字体大小
|
| | | font-size: 25
|
| | |
|
| | | #jwt
|
| | | jwt:
|
| | | header: Authorization
|
| | | # 令牌前缀
|
| | | token-start-with: Bearer
|
| | | # 必须使用最少88位的Base64对该令牌进行编码
|
| | | base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI=
|
| | | # 令牌过期时间 此处单位/毫秒 ,默认4小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
|
| | | token-validity-in-seconds: 14400000
|
| | | # 在线用户key
|
| | | online-key: online-token-
|
| | | # 验证码
|
| | | code-key: code-key-
|
| | | # token 续期检查时间范围(默认30分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
|
| | | detect: 1800000
|
| | | # 续期时间范围,默认1小时,单位毫秒
|
| | | renew: 3600000
|
| | |
|
| | | #是否允许生成代码,生产环境设置为false
|
| | | generator:
|
| | | enabled: true
|
| | |
|
| | | #是否开启 swagger-ui
|
| | | swagger:
|
| | | enabled: true
|
| | |
|
| | | # IP 本地解析
|
| | | ip:
|
| | | local-parsing: true
|
| | |
|
| | | # 文件存储路径
|
| | | file:
|
| | | mac:
|
| | | path: ~/file/
|
| | | avatar: ~/avatar/
|
| | | linux:
|
| | | path: /home/eladmin/file/
|
| | | avatar: /home/eladmin/avatar/
|
| | | windows:
|
| | | path: C:\eladmin\file\
|
| | | avatar: C:\eladmin\avatar\
|
| | | # 文件大小 /M
|
| | | maxSize: 100
|
| | | avatarMaxSize: 5
|
| | |
|
| | | # Flowable
|
| | | flowable:
|
| | | url: http://localhost:8888
|
| | |
| | | enabled: false |
| | | # pid: |
| | | # file: /自行指定位置/eladmin.pid |
| | | |
| | | logging: |
| | | level: |
| | | org: |
| | | springframework: |
| | | data: |
| | | mongodb: |
| | | core: |
| | | MongoTemplate: DEBUG |
| | | #配置 Jpa |
| | | jpa: |
| | | hibernate: |
| | | ddl-auto: none |
| | | open-in-view: true |
| | | show-sql: false |
| | | properties: |
| | | hibernate: |
| | | dialect: org.hibernate.dialect.MySQL5InnoDBDialect |
| | |
| | | package me.zhengjie; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Map.Entry; |
| | | import java.util.TreeMap; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.bson.types.ObjectId; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | |
| | | import me.zhengjie.modules.task.domain.TaskDaliyMongo; |
| | | import me.zhengjie.modules.task.domain.TaskMongo; |
| | | import me.zhengjie.modules.task.domain.TaskUserMongo; |
| | | import me.zhengjie.modules.task.service.dto.TaskMongoDto; |
| | | import me.zhengjie.modules.task.service.impl.TaskServiceImpl; |
| | | import me.zhengjie.modules.task.service.impl.TaskUserServiceImpl; |
| | | |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) |
| | | public class EladminSystemApplicationTests { |
| | | |
| | | @Autowired |
| | | private TaskServiceImpl taskService; |
| | | @Autowired |
| | | private TaskUserServiceImpl taskUserService; |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Test |
| | | public void contextLoads() { |
| | | taskService.moveData(); |
| | | } |
| | | |
| | | @Test |
| | | public void findTagByName() { |
| | | List result = taskService.getAllTags(null); |
| | | System.out.println(result); |
| | | } |
| | | |
| | | @Test |
| | | public void findByTaskId() { |
| | | taskUserService.sumTotalByTask("6479fd8b9b0c681363840a20"); |
| | | } |
| | | |
| | | @Test |
| | | public void tryTwo() { |
| | | System.out.println(System.currentTimeMillis()); |
| | | List<TaskMongoDto> result = taskService.findByCompanyId(null); |
| | | for (TaskMongoDto taskMongoDto : result) { |
| | | System.out.println("==================================================================="); |
| | | System.out.println(taskMongoDto.getName()); |
| | | System.out.println("////////////////////////////////////////////////////////////////"); |
| | | // if (taskMongoDto.getChildren() != null && taskMongoDto.getChildren().size() > 0) { |
| | | // taskMongoDto.getChildren().stream().map(child -> child.getName()).forEach(System.out::println); |
| | | // } |
| | | System.out.println("-------------------------------------------------------------"); |
| | | } |
| | | System.out.println(System.currentTimeMillis()); |
| | | } |
| | | |
| | | @Test |
| | | public void findMonthInfo2() { |
| | | LocalDate date = LocalDate.of(2023, 3, 1); |
| | | Date searchDate = Date.from(date.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()); |
| | | LocalDate nextMonth = LocalDate.of(2023, 4, 1); |
| | | Date nextSearchDate = Date.from(nextMonth.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()); |
| | | Query query = new Query(Criteria.where("taskDallyList.fillDate").gte(searchDate).lt(nextSearchDate).and("userId").is(44)); |
| | | List<TaskUserMongo> result = mongoTemplate.find(query, TaskUserMongo.class); |
| | | // Map<Date, Double> resultMap = new TreeMap<Date, Double>(); |
| | | for (TaskUserMongo taskUserMongo : result) { |
| | | System.out.println("id : " + taskUserMongo.getId() + "\ttaskHours : " + taskUserMongo.getTaskHours()); |
| | | Double total = taskUserMongo.getTaskDaliyList().stream().collect(Collectors.summingDouble(TaskDaliyMongo::getConsumedHours)); |
| | | // for (TaskDaliyMongo taskDaliyMongo : taskUserMongo.getTaskDallyList()) { |
| | | // if (taskDaliyMongo.getFillDate().compareTo(searchDate) >= 0 && taskDaliyMongo.getFillDate().compareTo(nextSearchDate) < 0 ) { |
| | | // if (taskDaliyMongo.getFillDate().compareTo(new Date(2023, 2, 1)) == 0) { |
| | | // System.out.println(); |
| | | // } |
| | | // if (resultMap.containsKey(taskDaliyMongo.getFillDate())) { |
| | | // resultMap.put(taskDaliyMongo.getFillDate(), resultMap.get(taskDaliyMongo.getFillDate()) + taskDaliyMongo.getConsumedHours()); |
| | | // } else { |
| | | // resultMap.put(taskDaliyMongo.getFillDate(), taskDaliyMongo.getConsumedHours()); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | TaskDaliyMongo taskDaliyMongo = taskUserMongo.getTaskDaliyList().get(0); |
| | | System.out.println("consumedHours : " + total + "\tperformanceHours : " + taskUserMongo.getTaskHours() * taskDaliyMongo.getTaskProgress()); |
| | | } |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | // for (Entry<Date, Double> entry : resultMap.entrySet()) { |
| | | // System.out.println(sdf.format(entry.getKey()) + "\t" + entry.getValue()); |
| | | // } |
| | | } |
| | | |
| | | @Test |
| | | public void findMyToDoTask() { |
| | | Query query = new Query(Criteria.where("taskDaliyList.taskStatus").ne("task_status_completed")); // .and("userId").is(44) |
| | | List<TaskUserMongo> result = mongoTemplate.find(query.with(Sort.by("taskEndDate")).limit(5), TaskUserMongo.class); |
| | | for (TaskUserMongo taskUserMongo : result) { |
| | | System.out.print("id : " + taskUserMongo.getTask().getId() + "\t name : "); |
| | | TaskMongo task = taskUserMongo.getTask(); |
| | | String value = "/" + task.getName(); |
| | | while (task.getParent() != null) { |
| | | value = "/" + task.getParent().getName() + value; |
| | | task = task.getParent(); |
| | | } |
| | | System.out.println(value); |
| | | System.out.println("StartDate : " + taskUserMongo.getTaskStartDate()); |
| | | System.out.println("EndDate : " + taskUserMongo.getTaskEndDate()); |
| | | System.out.println("=================================================================="); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void findMonthInfo() { |
| | | LocalDate date = LocalDate.of(2023, 3, 1); |
| | | Date searchDate = Date.from(date.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()); |
| | | LocalDate nextMonth = LocalDate.of(2023, 4, 1); |
| | | Date nextSearchDate = Date.from(nextMonth.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()); |
| | | Query query = new Query(Criteria.where("taskDaliyList.fillDate").gte(searchDate).lt(nextSearchDate).and("userId").is(44)); |
| | | List<TaskUserMongo> result = mongoTemplate.find(query, TaskUserMongo.class); |
| | | Map<Date, Double> resultMap = new TreeMap<Date, Double>(); |
| | | for (TaskUserMongo taskUserMongo : result) { |
| | | for (TaskDaliyMongo taskDaliyMongo : taskUserMongo.getTaskDaliyList()) { |
| | | if (taskDaliyMongo.getFillDate().compareTo(searchDate) >= 0 && taskDaliyMongo.getFillDate().compareTo(nextSearchDate) < 0 ) { |
| | | if (resultMap.containsKey(taskDaliyMongo.getFillDate())) { |
| | | resultMap.put(taskDaliyMongo.getFillDate(), resultMap.get(taskDaliyMongo.getFillDate()) + taskDaliyMongo.getConsumedHours()); |
| | | } else { |
| | | resultMap.put(taskDaliyMongo.getFillDate(), taskDaliyMongo.getConsumedHours()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | for (Entry<Date, Double> entry : resultMap.entrySet()) { |
| | | System.out.println(sdf.format(entry.getKey()) + "\t" + entry.getValue()); |
| | | } |
| | | |
| | | System.out.println("======================================================="); |
| | | |
| | | for (TaskUserMongo taskUserMongo : result) { |
| | | System.out.println("id : " + taskUserMongo.getId() + "\ttaskHours : " + taskUserMongo.getTaskHours()); |
| | | Double total = taskUserMongo.getTaskDaliyList().stream().collect(Collectors.summingDouble(TaskDaliyMongo::getConsumedHours)); |
| | | TaskDaliyMongo taskDaliyMongo = taskUserMongo.getTaskDaliyList().get(0); |
| | | System.out.println("consumedHours : " + total + "\tpercent : " + taskDaliyMongo.getTaskProgress() + "\tperformanceHours : " + (taskUserMongo.getTaskHours() * taskDaliyMongo.getTaskProgress() / 100)); |
| | | System.out.println("----------------------------------------------------------"); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void top10Task() { |
| | | // Query query = new Query(Criteria.where("taskDallyList.settlementStatus").is("settlement_status_settled").and("userId").is(27)); |
| | | // List<TaskUserMongo> result = mongoTemplate.find(query.limit(4), TaskUserMongo.class); |
| | | |
| | | LocalDate date = LocalDate.of(2023, 2, 22); |
| | | Date searchDate = Date.from(date.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()); |
| | | Query query = new Query(Criteria.where("taskDallyList.fillDate").is(searchDate).and("userId").is(44)); |
| | | List<TaskUserMongo> result = mongoTemplate.find(query.limit(4), TaskUserMongo.class); |
| | | for (TaskUserMongo taskUserMongo : result) { |
| | | System.out.println("id : " + taskUserMongo.getId()); |
| | | for (TaskDaliyMongo taskDaliyMongo : taskUserMongo.getTaskDaliyList()) { |
| | | if (taskDaliyMongo.getFillDate().compareTo(searchDate) == 0) { |
| | | System.out.println(taskDaliyMongo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void tryOne() { |
| | | |
| | | // Pattern pattern = Pattern.compile("^.*" + "我们" + ".*$", Pattern.CASE_INSENSITIVE); |
| | | // Query query = new Query(Criteria.where("name").regex(pattern)); // .regex("%我们%") |
| | | Query query = new Query(Criteria.where("projectId").is(50).and("parent").exists(false)); |
| | | List<TaskMongo> result = mongoTemplate.find(query, TaskMongo.class); |
| | | |
| | | for (TaskMongo taskMongo : result) { |
| | | Query query1 = new Query(Criteria.where("projectId").is(50).and("parent").is(taskMongo)); |
| | | List<TaskMongo> children = mongoTemplate.find(query1, TaskMongo.class); |
| | | } |
| | | |
| | | System.out.println("==================================================="); |
| | | System.out.println(result.size()); |
| | | System.out.println(result); |
| | | System.out.println("==================================================="); |
| | | // TaskMongo taskMongo = mongoTemplate.findById(new ObjectId("6474a7c98943fb5cdf251767"), TaskMongo.class); |
| | | // System.out.println(taskMongo); |
| | | // 6474a7c98943fb5cdf251767 |
| | | System.out.println("==================================================="); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | } |
| | | |
| | | // @Test |
| | | // public void change() { |
| | | // TaskMongo taskMongo = mongoTemplate.findById(new ObjectId("6474bd88804d691dfe47c97d"), TaskMongo.class); |
| | | // taskMongo.getChildren().add(mongoTemplate.findById(new ObjectId("6474bd89804d691dfe47c980"), TaskMongo.class)); |
| | | // taskService.changeRoute(taskMongo); |
| | | // } |
| | | // |
| | | // @Test |
| | | // public void findParent() { |
| | | // TaskMongo child = mongoTemplate.findById(new ObjectId("6474bd89804d691dfe47c980"), TaskMongo.class); |
| | | // Query query = new Query(Criteria.where("children").is(child)); |
| | | // List<TaskMongo> taskMongoList = mongoTemplate.find(query, TaskMongo.class); |
| | | // System.out.println(taskMongoList); |
| | | // } |
| | | } |
| | | |
| | |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-mongodb</artifactId> |
| | | </dependency> |
| | | |
| | | <!--spring boot 集成redis所需common-pool2--> |
| | | <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 --> |
| | | <dependency> |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/payMonthlyReimbursement', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/payMonthlyReimbursement/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/payMonthlyReimbursement', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/payMonthlySalary', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function generate(data) { |
| | | return request({ |
| | | url: 'api/payMonthlySalary/generate', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/payMonthlySalary/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/payMonthlySalary', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, generate } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/payMonthlySubsidy', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/payMonthlySubsidy/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/payMonthlySubsidy', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/performanceCoefficient', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function generate(data) { |
| | | return request({ |
| | | url: 'api/performanceCoefficient/generate', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/performanceCoefficient/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/performanceCoefficient', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, generate } |
| | |
| | | }) |
| | | } |
| | | |
| | | export function getCompName(data) { |
| | | return request({ |
| | | url: 'api/sysCompany/getCompName', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | // export function getCompName(data) { |
| | | // return request({ |
| | | // url: 'api/sysCompany/getCompName', |
| | | // method: 'post', |
| | | // data |
| | | // }) |
| | | // } |
| | | |
| | | export default { add, edit, del, getAll, getCompName } |
| | | export default { add, edit, del, getAll } |
| | |
| | | import request from '@/utils/request' |
| | | import { encrypt } from '@/utils/rsaEncrypt' |
| | | import qs from 'qs' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/users/all', |
| | | method: 'get', |
| | | params |
| | | url: 'api/users/all' + '?' + qs.stringify(params, { indices: false }), |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export function getByDept(params) { |
| | | return request({ |
| | | url: 'api/users/dept/' + params, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del, get, getApprovalUsers, getUserCalendarInfo, getUserBaseInfo } |
| | | export default { getAll, add, edit, del, get, getApprovalUsers, getUserCalendarInfo, getUserBaseInfo, getByDept } |
| | |
| | | }) |
| | | } |
| | | |
| | | export function getTags(params) { |
| | | return request({ |
| | | url: 'api/task/tags', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function getNames(params) { |
| | | return request({ |
| | | url: 'api/task/names', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function getChildren(params) { |
| | | return request({ |
| | | url: 'api/task/children', |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, getChildren, add, edit, del, divide, getPartake } |
| | | export default { getAll, getTags, getNames, getChildren, add, edit, del, divide, getPartake } |
| | |
| | | }) |
| | | } |
| | | |
| | | export function getSum(params) { |
| | | return request({ |
| | | url: 'api/taskUser/sum', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function calcHours(params) { |
| | | return request({ |
| | | url: 'api/taskUser/calcHours', |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del, calcHours, getTaskUserIds } |
| | | export default { getAll, add, edit, del, calcHours, getTaskUserIds, getSum } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/cmnInsurance/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/cmnInsurance', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/cmnInsurance/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/cmnInsurance', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/cmnLevel/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/cmnLevel', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/cmnLevel/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/cmnLevel', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/cmnLevelRank', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/cmnLevelRank/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/cmnLevelRank', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/userInsurance', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/userInsurance/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/userInsurance', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function generate(data) { |
| | | return request({ |
| | | url: 'api/userInsurance/generate', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, generate } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/userLevelWage', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/userLevelWage/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/userLevelWage', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| | |
| | | const firstSheetName = workbook.SheetNames[0] |
| | | const worksheet = workbook.Sheets[firstSheetName] |
| | | const header = this.getHeaderRow(worksheet) |
| | | const results = XLSX.utils.sheet_to_json(worksheet) |
| | | const results = XLSX.utils.sheet_to_json(worksheet, { range: 1 }) |
| | | this.generateData({ header, results }) |
| | | this.loading = false |
| | | resolve() |
| | |
| | | const range = XLSX.utils.decode_range(sheet['!ref']) |
| | | let C |
| | | const R = range.s.r |
| | | console.log('111111111111111111111 : ', R) |
| | | /* start in the first row */ |
| | | for (C = range.s.c; C <= range.e.c; ++C) { /* walk every column in the range */ |
| | | console.log('XLSX.utils.encode_cell({ c: C, r: R }) : ', XLSX.utils.encode_cell({ c: C, r: R })) |
| | | const cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })] |
| | | const cell2 = sheet[XLSX.utils.encode_cell({ c: C, r: R + 1 })] |
| | | /* find the cell in the first row */ |
| | | let hdr = 'UNKNOWN ' + C // <-- replace with your desired default |
| | | if (cell && cell.t) hdr = XLSX.utils.format_cell(cell) |
| | | const hdr = { id: 'UNKNOWN ' + C, name: 'UNKNOWN ' + C } // <-- replace with your desired default |
| | | if (cell && cell.t) hdr.name = XLSX.utils.format_cell(cell) |
| | | if (cell2 && cell2.t) hdr.id = XLSX.utils.format_cell(cell2) |
| | | headers.push(hdr) |
| | | } |
| | | return headers |
| | |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" row-key="id" 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%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="userName" label="所属员工" fixed="left" width="100" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" row-key="id" 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%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="userName" label="申请人" width="100" fixed="left" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" row-key="id" 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%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="userName" label="申请人" min-width="100" show-overflow-tooltip fixed="left"> |
| | | <template slot-scope="scope"> |
| | |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" row-key="id" 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%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="userName" label="申请人" min-width="100" fixed="left" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | |
| | | <el-button :loading="successLoading" type="primary" size="mini" @click="revoke(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-show="scope.row.approvalUserId === $store.state.user.user.id" |
| | | slot="reference" |
| | | v-permission="permission.approve" |
| | | type="danger" |
| | | icon="el-icon-edit-outline" |
| | | size="mini" |
| | | :disabled="scope.row.approvalStatus === dictAppRovalStatusUnderAppover ? true : false" |
| | | >撤销 |
| | | >撤销{{ scope.row.id }} |
| | | </el-button> |
| | | </el-popover> |
| | | </template> |
| | |
| | | // }, |
| | | // 审批页面赋值 |
| | | toApprove(data, Number) { |
| | | console.log('11111111111111111111111111111111111 : ', Number) |
| | | if (Number !== '1') { |
| | | this.makeUpCardVisible = true |
| | | } |
| | |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" row-key="id" 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%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" fixed="left" width="55" /> |
| | | <el-table-column fixed="left" type="expand"> |
| | | <template slot-scope="scope"> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, 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="ID" prop="id"> |
| | | <el-input v-model="form.id" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="员工ID" prop="userId"> |
| | | <el-input v-model="form.userId" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="年月日" prop="date"> |
| | | <el-input v-model="form.date" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="报销金额" prop="reimbursementCost"> |
| | | <el-input v-model="form.reimbursementCost" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备考"> |
| | | <el-input v-model="form.remarks" 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 prop="id" label="ID" /> |
| | | <el-table-column prop="userId" label="员工ID" /> |
| | | <el-table-column prop="date" label="年月日" /> |
| | | <el-table-column prop="reimbursementCost" label="报销金额" /> |
| | | <el-table-column prop="remarks" label="备考" /> |
| | | <el-table-column v-if="checkPer(['admin','payMonthlyReimbursement:edit','payMonthlyReimbursement: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 crudPayMonthlyReimbursement from '@/api/salary/payMonthlyReimbursement' |
| | | 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' |
| | | |
| | | const defaultForm = { id: null, userId: null, date: null, reimbursementCost: null, remarks: null } |
| | | export default { |
| | | name: 'PayMonthlyReimbursement', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '员工月度报销', url: 'api/payMonthlyReimbursement', idField: 'id', sort: 'id,desc', crudMethod: { ...crudPayMonthlyReimbursement }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'payMonthlyReimbursement:add'], |
| | | edit: ['admin', 'payMonthlyReimbursement:edit'], |
| | | del: ['admin', 'payMonthlyReimbursement:del'] |
| | | }, |
| | | rules: { |
| | | id: [ |
| | | { required: true, message: 'ID不能为空', trigger: 'blur' } |
| | | ], |
| | | userId: [ |
| | | { required: true, message: '员工ID不能为空', trigger: 'blur' } |
| | | ], |
| | | date: [ |
| | | { required: true, message: '年月日不能为空', trigger: 'blur' } |
| | | ], |
| | | reimbursementCost: [ |
| | | { required: true, message: '报销金额不能为空', trigger: 'blur' } |
| | | ] |
| | | }} |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | return true |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <label class="el-form-item-label">员工</label> |
| | | <el-select v-model="query.userId" filterable clearable placeholder="请选择员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <label class="el-form-item-label">年月</label> |
| | | <el-date-picker v-model="query.yearMonth" clearable type="month" value-format="yyyy-MM" format="yyyy 年 MM 月" placeholder="请选择年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.generate" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-plus" |
| | | style="margin-right: 6px;" |
| | | @click="openGenerate" |
| | | >生成</el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <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="员工ID" prop="userId"> |
| | | <el-input v-model="form.userId" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="工资年月" prop="yearMonth"> |
| | | <el-input v-model="form.yearMonth" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="基本工资" prop="basicWage"> |
| | | <el-input v-model="form.basicWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="业绩工资" prop="performanceWage"> |
| | | <el-input v-model="form.performanceWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金基数" prop="accumulationRadix"> |
| | | <el-input v-model="form.accumulationRadix" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金个人缴纳比例" prop="accumulationPersonalProportion"> |
| | | <el-input v-model="form.accumulationPersonalProportion" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金个人缴纳金额" prop="accumulationPersonalAmount"> |
| | | <el-input v-model="form.accumulationPersonalAmount" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金公司缴纳比例" prop="accumulationCompanyProportion"> |
| | | <el-input v-model="form.accumulationCompanyProportion" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金公司缴纳金额" prop="accumulationCompanyAmount"> |
| | | <el-input v-model="form.accumulationCompanyAmount" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="养老险基数" prop="pensionRadix"> |
| | | <el-input v-model="form.pensionRadix" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="养老险个人缴纳比例" prop="pensionPersonalProportion"> |
| | | <el-input v-model="form.pensionPersonalProportion" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="养老险个人缴纳金额" prop="pensionPersonalAmount"> |
| | | <el-input v-model="form.pensionPersonalAmount" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="养老险公司缴纳比例" prop="pensionCompanyProportion"> |
| | | <el-input v-model="form.pensionCompanyProportion" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="养老险公司缴纳金额" prop="pensionCompanyAmount"> |
| | | <el-input v-model="form.pensionCompanyAmount" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险基数" prop="medicalRadix"> |
| | | <el-input v-model="form.medicalRadix" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险个人缴纳比例" prop="medicalPersonalProportion"> |
| | | <el-input v-model="form.medicalPersonalProportion" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险个人缴纳金额" prop="medicalPersonalAmount"> |
| | | <el-input v-model="form.medicalPersonalAmount" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险公司缴纳比例" prop="medicalCompanyProportion"> |
| | | <el-input v-model="form.medicalCompanyProportion" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险公司缴纳金额" prop="medicalCompanyAmount"> |
| | | <el-input v-model="form.medicalCompanyAmount" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="失业险基数" prop="unemploymentRadix"> |
| | | <el-input v-model="form.unemploymentRadix" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="失业险个人缴纳比例" prop="unemploymentPersonalProportion"> |
| | | <el-input v-model="form.unemploymentPersonalProportion" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="失业险个人缴纳金额" prop="unemploymentPersonalAmount"> |
| | | <el-input v-model="form.unemploymentPersonalAmount" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="失业险公司缴纳比例" prop="unemploymentCompanyProportion"> |
| | | <el-input v-model="form.unemploymentCompanyProportion" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="失业险公司缴纳金额" prop="unemploymentCompanyAmount"> |
| | | <el-input v-model="form.unemploymentCompanyAmount" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="生育险基数" prop="maternityRadix"> |
| | | <el-input v-model="form.maternityRadix" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="生育险个人缴纳比例" prop="maternityPersonalProportion"> |
| | | <el-input v-model="form.maternityPersonalProportion" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="生育险个人缴纳金额" prop="maternityPersonalAmount"> |
| | | <el-input v-model="form.maternityPersonalAmount" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="生育险公司缴纳比例" prop="maternityCompanyProportion"> |
| | | <el-input v-model="form.maternityCompanyProportion" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="生育险公司缴纳金额" prop="maternityCompanyAmount"> |
| | | <el-input v-model="form.maternityCompanyAmount" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险基数" prop="industrialInjuryRadix"> |
| | | <el-input v-model="form.industrialInjuryRadix" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险个人缴纳比例" prop="industrialInjuryPersonalProportion"> |
| | | <el-input v-model="form.industrialInjuryPersonalProportion" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险个人缴纳金额" prop="industrialInjuryPersonalAmount"> |
| | | <el-input v-model="form.industrialInjuryPersonalAmount" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险公司缴纳比例" prop="industrialInjuryCompanyProportion"> |
| | | <el-input v-model="form.industrialInjuryCompanyProportion" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险公司缴纳金额" prop="industrialInjuryCompanyAmount"> |
| | | <el-input v-model="form.industrialInjuryCompanyAmount" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" 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 prop="nickName" label="员工" /> |
| | | <el-table-column prop="yearMonth" label="工资年月" /> |
| | | <el-table-column prop="basicWage" label="基本工资" /> |
| | | <el-table-column prop="performanceWage" label="业绩工资" /> |
| | | <el-table-column prop="accumulationRadix" label="公积金基数" /> |
| | | <el-table-column prop="accumulationPersonalProportion" label="公积金个人缴纳比例" /> |
| | | <el-table-column prop="accumulationPersonalAmount" label="公积金个人缴纳金额" /> |
| | | <el-table-column prop="accumulationCompanyProportion" label="公积金公司缴纳比例" /> |
| | | <el-table-column prop="accumulationCompanyAmount" label="公积金公司缴纳金额" /> |
| | | <el-table-column prop="pensionRadix" label="养老险基数" /> |
| | | <el-table-column prop="pensionPersonalProportion" label="养老险个人缴纳比例" /> |
| | | <el-table-column prop="pensionPersonalAmount" label="养老险个人缴纳金额" /> |
| | | <el-table-column prop="pensionCompanyProportion" label="养老险公司缴纳比例" /> |
| | | <el-table-column prop="pensionCompanyAmount" label="养老险公司缴纳金额" /> |
| | | <el-table-column prop="medicalRadix" label="医疗险基数" /> |
| | | <el-table-column prop="medicalPersonalProportion" label="医疗险个人缴纳比例" /> |
| | | <el-table-column prop="medicalPersonalAmount" label="医疗险个人缴纳金额" /> |
| | | <el-table-column prop="medicalCompanyProportion" label="医疗险公司缴纳比例" /> |
| | | <el-table-column prop="medicalCompanyAmount" label="医疗险公司缴纳金额" /> |
| | | <el-table-column prop="unemploymentRadix" label="失业险基数" /> |
| | | <el-table-column prop="unemploymentPersonalProportion" label="失业险个人缴纳比例" /> |
| | | <el-table-column prop="unemploymentPersonalAmount" label="失业险个人缴纳金额" /> |
| | | <el-table-column prop="unemploymentCompanyProportion" label="失业险公司缴纳比例" /> |
| | | <el-table-column prop="unemploymentCompanyAmount" label="失业险公司缴纳金额" /> |
| | | <el-table-column prop="maternityRadix" label="生育险基数" /> |
| | | <el-table-column prop="maternityPersonalProportion" label="生育险个人缴纳比例" /> |
| | | <el-table-column prop="maternityPersonalAmount" label="生育险个人缴纳金额" /> |
| | | <el-table-column prop="maternityCompanyProportion" label="生育险公司缴纳比例" /> |
| | | <el-table-column prop="maternityCompanyAmount" label="生育险公司缴纳金额" /> |
| | | <el-table-column prop="industrialInjuryRadix" label="工伤险基数" /> |
| | | <el-table-column prop="industrialInjuryPersonalProportion" label="工伤险个人缴纳比例" /> |
| | | <el-table-column prop="industrialInjuryPersonalAmount" label="工伤险个人缴纳金额" /> |
| | | <el-table-column prop="industrialInjuryCompanyProportion" label="工伤险公司缴纳比例" /> |
| | | <el-table-column prop="industrialInjuryCompanyAmount" label="工伤险公司缴纳金额" /> |
| | | <el-table-column v-if="checkPer(['admin','payMonthlySalary:edit','payMonthlySalary:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="closeGenerate" :visible.sync="generateStatus" title="生成月度工资" width="500px"> |
| | | <el-form ref="generateForm" :model="generateForm" :rules="generateRules" size="small" label-width="80px"> |
| | | <el-form-item label="工资年月" prop="targetYearMonth"> |
| | | <el-date-picker |
| | | v-model="generateForm.targetYearMonth" |
| | | value-format="yyyy-MM" |
| | | format="yyyy 年 MM 月" |
| | | type="month" |
| | | style="width: 370px;" |
| | | placeholder="工资年月" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="员工" prop="userId"> |
| | | <el-tree |
| | | ref="tree" |
| | | :data="deptDatas" |
| | | :props="props" |
| | | :load="getDeptDatas" |
| | | lazy |
| | | :default-expanded-keys="[]" |
| | | show-checkbox |
| | | node-key="id" |
| | | @check="handleCheckChange" |
| | | /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="closeGenerate">取消</el-button> |
| | | <el-button :loading="generateLoading" type="primary" @click="submitGenerate">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudPayMonthlySalary from '@/api/salary/payMonthlySalary' |
| | | 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 crudUser from '@/api/system/user' |
| | | import { getDepts } from '@/api/system/dept' |
| | | |
| | | const defaultForm = { id: null, userId: null, basicWage: null, performanceWage: null, accumulationRadix: null, accumulationPersonalProportion: null, accumulationPersonalAmount: null, accumulationCompanyProportion: null, accumulationCompanyAmount: null, pensionRadix: null, pensionPersonalProportion: null, pensionPersonalAmount: null, pensionCompanyProportion: null, pensionCompanyAmount: null, medicalRadix: null, medicalPersonalProportion: null, medicalPersonalAmount: null, medicalCompanyProportion: null, medicalCompanyAmount: null, unemploymentRadix: null, unemploymentPersonalProportion: null, unemploymentPersonalAmount: null, unemploymentCompanyProportion: null, unemploymentCompanyAmount: null, maternityRadix: null, maternityPersonalProportion: null, maternityPersonalAmount: null, maternityCompanyProportion: null, maternityCompanyAmount: null, industrialInjuryRadix: null, industrialInjuryPersonalProportion: null, industrialInjuryPersonalAmount: null, industrialInjuryCompanyProportion: null, industrialInjuryCompanyAmount: null, remarks: null, publicityStatus: null, approveStatus: null, createBy: null, createTime: null, updateBy: null, updateTime: null, yearMonth: null } |
| | | export default { |
| | | name: 'PayMonthlySalary', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '员工月度工资', url: 'api/payMonthlySalary', idField: 'id', sort: 'yearMonth,desc', crudMethod: { ...crudPayMonthlySalary }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'payMonthlySalary:add'], |
| | | edit: ['admin', 'payMonthlySalary:edit'], |
| | | del: ['admin', 'payMonthlySalary:del'], |
| | | download: ['admin', 'payMonthlySalary:list'], |
| | | generate: ['admin', 'payMonthlySalary:add'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: '员工ID不能为空', trigger: 'blur' } |
| | | ], |
| | | yearMonth: [ |
| | | { required: true, message: '工资年月不能为空', trigger: 'blur' } |
| | | ], |
| | | basicWage: [ |
| | | { required: true, message: '基本工资不能为空', trigger: 'blur' } |
| | | ], |
| | | performanceWage: [ |
| | | { required: true, message: '业绩工资不能为空', trigger: 'blur' } |
| | | ], |
| | | accumulationRadix: [ |
| | | { required: true, message: '公积金基数不能为空', trigger: 'blur' } |
| | | ], |
| | | accumulationPersonalProportion: [ |
| | | { required: true, message: '公积金个人缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | accumulationPersonalAmount: [ |
| | | { required: true, message: '公积金个人缴纳金额不能为空', trigger: 'blur' } |
| | | ], |
| | | accumulationCompanyProportion: [ |
| | | { required: true, message: '公积金公司缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | accumulationCompanyAmount: [ |
| | | { required: true, message: '公积金公司缴纳金额不能为空', trigger: 'blur' } |
| | | ], |
| | | pensionRadix: [ |
| | | { required: true, message: '养老险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | pensionPersonalProportion: [ |
| | | { required: true, message: '养老险个人缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | pensionPersonalAmount: [ |
| | | { required: true, message: '养老险个人缴纳金额不能为空', trigger: 'blur' } |
| | | ], |
| | | pensionCompanyProportion: [ |
| | | { required: true, message: '养老险公司缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | pensionCompanyAmount: [ |
| | | { required: true, message: '养老险公司缴纳金额不能为空', trigger: 'blur' } |
| | | ], |
| | | medicalRadix: [ |
| | | { required: true, message: '医疗险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | medicalPersonalProportion: [ |
| | | { required: true, message: '医疗险个人缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | medicalPersonalAmount: [ |
| | | { required: true, message: '医疗险个人缴纳金额不能为空', trigger: 'blur' } |
| | | ], |
| | | medicalCompanyProportion: [ |
| | | { required: true, message: '医疗险公司缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | medicalCompanyAmount: [ |
| | | { required: true, message: '医疗险公司缴纳金额不能为空', trigger: 'blur' } |
| | | ], |
| | | unemploymentRadix: [ |
| | | { required: true, message: '失业险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | unemploymentPersonalProportion: [ |
| | | { required: true, message: '失业险个人缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | unemploymentPersonalAmount: [ |
| | | { required: true, message: '失业险个人缴纳金额不能为空', trigger: 'blur' } |
| | | ], |
| | | unemploymentCompanyProportion: [ |
| | | { required: true, message: '失业险公司缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | unemploymentCompanyAmount: [ |
| | | { required: true, message: '失业险公司缴纳金额不能为空', trigger: 'blur' } |
| | | ], |
| | | maternityRadix: [ |
| | | { required: true, message: '生育险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | maternityPersonalProportion: [ |
| | | { required: true, message: '生育险个人缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | maternityPersonalAmount: [ |
| | | { required: true, message: '生育险个人缴纳金额不能为空', trigger: 'blur' } |
| | | ], |
| | | maternityCompanyProportion: [ |
| | | { required: true, message: '生育险公司缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | maternityCompanyAmount: [ |
| | | { required: true, message: '生育险公司缴纳金额不能为空', trigger: 'blur' } |
| | | ], |
| | | industrialInjuryRadix: [ |
| | | { required: true, message: '工伤险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | industrialInjuryPersonalProportion: [ |
| | | { required: true, message: '工伤险个人缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | industrialInjuryPersonalAmount: [ |
| | | { required: true, message: '工伤险个人缴纳金额不能为空', trigger: 'blur' } |
| | | ], |
| | | industrialInjuryCompanyProportion: [ |
| | | { required: true, message: '工伤险公司缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | industrialInjuryCompanyAmount: [ |
| | | { required: true, message: '工伤险公司缴纳金额不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'userId', display_name: '员工' }, |
| | | { key: 'yearMonth', display_name: '年月' } |
| | | ], |
| | | // 员工 |
| | | users: [], |
| | | // 生成表单状态 |
| | | generateStatus: false, |
| | | // 生成表单加载 |
| | | generateLoading: false, |
| | | // 生成表单数据 |
| | | generateForm: { targetYearMonth: null, nodes: [] }, |
| | | // 生成表单验证 |
| | | generateRules: { |
| | | targetYearMonth: [ |
| | | { required: true, message: '工资年月不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | props: { |
| | | children: 'children', label: 'label', isLeaf: 'leaf' |
| | | }, |
| | | deptDatas: [] |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.getAllUser() |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | return true |
| | | }, |
| | | // 获取全部员工 |
| | | getAllUser() { |
| | | // 用户 |
| | | crudUser.getAll({ enabled: true }).then(res => { |
| | | this.users = res |
| | | }) |
| | | }, |
| | | // 生成表单打开 |
| | | openGenerate() { |
| | | // 生成表单数据 |
| | | this.generateForm = { targetYearMonth: null, nodes: [] } |
| | | // 生成表单状态 |
| | | this.generateStatus = true |
| | | }, |
| | | // 生成表单关闭 |
| | | closeGenerate() { |
| | | // 生成表单状态 |
| | | this.generateStatus = false |
| | | this.getDeptDatas({ level: 0 }) |
| | | // 清空表单 |
| | | this.$refs['generateForm'].clearValidate() |
| | | }, |
| | | // 生成表单提交 |
| | | submitGenerate() { |
| | | // 生成表单加载 |
| | | this.generateLoading = true |
| | | // 表单验证 |
| | | this.$refs['generateForm'].validate((valid) => { |
| | | if (valid) { |
| | | // 生成工资 |
| | | crudPayMonthlySalary.generate(this.generateForm).then(res => { |
| | | // 生成表单加载 |
| | | this.generateLoading = false |
| | | // 生成表单关闭 |
| | | this.closeGenerate() |
| | | // 搜索:刷新表格 |
| | | this.crud.toQuery() |
| | | // 消息提示 |
| | | this.crud.notify('生成成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | }).catch(() => { |
| | | // 生成表单加载 |
| | | this.generateLoading = false |
| | | }) |
| | | } else { |
| | | // 生成表单加载 |
| | | this.generateLoading = false |
| | | } |
| | | }) |
| | | }, |
| | | // 获取部门数据 |
| | | getDeptDatas(node, resolve) { |
| | | const sort = 'id,desc' |
| | | const params = { sort: sort } |
| | | if (node.level !== 0) { |
| | | crudUser.getByDept(node.level !== 0 ? node.data.id : null).then(res => { |
| | | if (resolve) { |
| | | resolve(res) |
| | | } else { |
| | | this.deptDatas = res.content |
| | | } |
| | | }) |
| | | } else { |
| | | getDepts(params).then(res => { |
| | | if (resolve) { |
| | | resolve(res.content) |
| | | } else { |
| | | this.deptDatas = res.content |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | handleCheckChange(data, status) { |
| | | this.generateForm.nodes = status.checkedNodes |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, 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="ID" prop="id"> |
| | | <el-input v-model="form.id" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="员工ID" prop="userId"> |
| | | <el-input v-model="form.userId" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="年月日" prop="date"> |
| | | <el-input v-model="form.date" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="补助金额" prop="subsidyCost"> |
| | | <el-input v-model="form.subsidyCost" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备考"> |
| | | <el-input v-model="form.remarks" 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 prop="id" label="ID" /> |
| | | <el-table-column prop="userId" label="员工ID" /> |
| | | <el-table-column prop="date" label="年月日" /> |
| | | <el-table-column prop="subsidyCost" label="补助金额" /> |
| | | <el-table-column prop="remarks" label="备考" /> |
| | | <el-table-column v-if="checkPer(['admin','payMonthlySubsidy:edit','payMonthlySubsidy: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 crudPayMonthlySubsidy from '@/api/salary/payMonthlySubsidy' |
| | | 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' |
| | | |
| | | const defaultForm = { id: null, userId: null, date: null, subsidyCost: null, remarks: null } |
| | | export default { |
| | | name: 'PayMonthlySubsidy', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '员工月度补助', url: 'api/payMonthlySubsidy', idField: 'id', sort: 'id,desc', crudMethod: { ...crudPayMonthlySubsidy }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'payMonthlySubsidy:add'], |
| | | edit: ['admin', 'payMonthlySubsidy:edit'], |
| | | del: ['admin', 'payMonthlySubsidy:del'] |
| | | }, |
| | | rules: { |
| | | id: [ |
| | | { required: true, message: 'ID不能为空', trigger: 'blur' } |
| | | ], |
| | | userId: [ |
| | | { required: true, message: '员工ID不能为空', trigger: 'blur' } |
| | | ], |
| | | date: [ |
| | | { required: true, message: '年月日不能为空', trigger: 'blur' } |
| | | ], |
| | | subsidyCost: [ |
| | | { required: true, message: '补助金额不能为空', trigger: 'blur' } |
| | | ] |
| | | }} |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | return true |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <label class="el-form-item-label">年度</label> |
| | | <el-date-picker v-model="query.year" clearable type="year" value-format="yyyy" format="yyyy 年" placeholder="年度" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <label class="el-form-item-label">岗位</label> |
| | | <el-select v-model="query.jobId" filterable clearable placeholder="岗位" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in jobs" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.generate" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-plus" |
| | | style="margin-right: 6px;" |
| | | @click="openGenerate" |
| | | >生成</el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="800px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="年度"> |
| | | <el-date-picker v-model="form.year" value-format="yyyy" format="yyyy 年" :disabled="crud.status.add == 0" clearable type="year" placeholder="年度" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="岗位"> |
| | | <el-select v-model="form.jobId" filterable clearable placeholder="所属岗位" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in jobs" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="绩效系数"> |
| | | <el-input v-model="form.multiples" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="月度系数"> |
| | | <el-input v-model="form.monthCoefficient" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="季度系数"> |
| | | <el-input v-model="form.quarterCoefficient" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="年度系数"> |
| | | <el-input v-model="form.yearCoefficient" 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 prop="year" label="年度"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.year }}年 |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="jobName" label="岗位" /> |
| | | <el-table-column prop="multiples" label="绩效系数" /> |
| | | <el-table-column prop="monthCoefficient" label="月度系数" /> |
| | | <el-table-column prop="quarterCoefficient" label="季度系数" /> |
| | | <el-table-column prop="yearCoefficient" label="年度系数" /> |
| | | <el-table-column v-if="checkPer(['admin','performanceCoefficient:edit','performanceCoefficient:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="closeGenerate" :visible.sync="generateStatus" title="生成绩效系数" width="640px"> |
| | | <el-form ref="generateForm" :model="generateForm" size="small" :rules="generateRules" label-width="80px"> |
| | | <el-form-item label="年度"> |
| | | <el-date-picker v-model="generateForm.year" value-format="yyyy" format="yyyy 年" clearable type="year" placeholder="年度" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="岗位"> |
| | | <el-select v-model="generateForm.jobId" filterable clearable placeholder="岗位" style="width: 200px;"> |
| | | <el-option |
| | | v-for="item in jobs" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <upload-excel-component :on-success="handleSuccess" :before-upload="beforeUpload" /> |
| | | <el-table :data="generateForm.performanceCofficientList" border highlight-current-row style="width: 100%;margin-top:20px;"> |
| | | <el-table-column v-for="item of tableHeader" :key="item.id" :prop="item.id" :label="item.name" /> |
| | | </el-table> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="closeGenerate">取消</el-button> |
| | | <el-button type="primary" :disabled="uploading" @click="submitGenerate">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudPerformanceCoefficient from '@/api/system/performanceCoefficient' |
| | | 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 UploadExcelComponent from '@/components/UploadExcel/index.vue' |
| | | import crudJob from '@/api/system/job' |
| | | |
| | | const defaultForm = { id: null, year: null, multiples: null, monthCoefficient: null, quarterCoefficient: null, yearCoefficient: null, createBy: null, createTime: null, updateBy: null, updateTime: null, jobId: null } |
| | | export default { |
| | | name: 'PerformanceCoefficient', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, UploadExcelComponent }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '绩效系数', url: 'api/performanceCoefficient', idField: 'id', sort: 'id,desc', crudMethod: { ...crudPerformanceCoefficient }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'performanceCoefficient:add'], |
| | | edit: ['admin', 'performanceCoefficient:edit'], |
| | | del: ['admin', 'performanceCoefficient:del'], |
| | | download: ['admin', 'performanceCoefficient:list'], |
| | | generate: ['admin', 'performanceCoefficient:add'] |
| | | }, |
| | | rules: { |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'year', display_name: '年度' }, |
| | | { key: 'jobId', display_name: '岗位' } |
| | | ], |
| | | // 生成表单状态 |
| | | generateStatus: false, |
| | | // 生成表单数据 |
| | | generateForm: { year: null, jobId: null, performanceCofficientList: [] }, |
| | | // 表头 |
| | | tableHeader: [], |
| | | // 表单验证 |
| | | generateRules: { |
| | | year: [ |
| | | { required: true, message: '年度不能为空', trigger: 'change' } |
| | | ], |
| | | jobId: [ |
| | | { required: true, message: '岗位不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | uploading: true, |
| | | // 岗位列表 |
| | | jobs: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取所有岗位 |
| | | this.getAllJob() |
| | | return true |
| | | }, |
| | | // 获取所有岗位 |
| | | getAllJob() { |
| | | // 获取所有岗位 |
| | | crudJob.getAll().then(res => { |
| | | // 岗位列表 |
| | | this.jobs = res |
| | | }).catch(() => { |
| | | |
| | | }) |
| | | }, |
| | | beforeUpload(file) { |
| | | const isLt1M = file.size / 1024 / 1024 < 1 |
| | | if (isLt1M) { |
| | | return true |
| | | } |
| | | this.crud.notify('请不要上传大于1m的文件.', CRUD.NOTIFICATION_TYPE.WARNING) |
| | | return false |
| | | }, |
| | | handleSuccess({ results, header }) { |
| | | this.generateForm.performanceCofficientList = results |
| | | this.tableHeader = header |
| | | this.uploading = false |
| | | }, |
| | | // 生成表单打开 |
| | | openGenerate() { |
| | | // 生成表单数据 |
| | | this.generateForm = { year: null, jobId: null, performanceCofficientList: [] } |
| | | // 生成表单状态 |
| | | this.generateStatus = true |
| | | }, |
| | | // 生成表单关闭 |
| | | closeGenerate() { |
| | | // 生成表单状态 |
| | | this.generateStatus = false |
| | | }, |
| | | // 生成表单提交 |
| | | submitGenerate() { |
| | | this.uploading = true |
| | | console.log('3333333333333333333 : ', this.generateForm) |
| | | crudPerformanceCoefficient.generate(this.generateForm).then(res => { |
| | | // 生成表单关闭 |
| | | this.closeGenerate() |
| | | // 搜索:刷新表格 |
| | | this.crud.toQuery() |
| | | this.uploading = false |
| | | this.crud.notify('生成成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | }).catch(err => { |
| | | this.uploading = false |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | // 根据员工选择公司 |
| | | getComp(data) { |
| | | if (data !== '') { |
| | | var form = JSON.stringify({ |
| | | 'userId': data |
| | | }) |
| | | crudSysCompany.getCompName(form).then(res => { |
| | | this.form.companyId = res.label |
| | | crudUser.getAll({ |
| | | id: data |
| | | }).then(res => { |
| | | this.form.companyId = res[0].company.id |
| | | }) |
| | | } else { |
| | | this.form.companyId = null |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-autocomplete v-model="query.name" class="filter-item" :fetch-suggestions="querySearch" placeholder="名称" style="width: 185px;" @select="crud.toQuery" /> |
| | | <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" style="width: 185px;" class="filter-item" @change="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.taskStatus" filterable clearable placeholder="任务状态" style="width: 185px;" class="filter-item" @change="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[taskStatus]" |
| | | :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="110px"> |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="所属项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 340px;" @change="projectChange"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :disabled="item.approveStatus == approveStatusUnrecognized" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="父级任务"> |
| | | <el-select v-if="pidTasks" v-model="form.parent.id" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in pidTasks" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :disabled="item.id == form.id" |
| | | /> |
| | | </el-select> |
| | | {{ this.form.parent.id }} |
| | | </el-form-item> |
| | | <el-form-item label="任务分类" prop="taskClassification"> |
| | | <el-tag |
| | | v-for="(tag, id) in form.tags" |
| | | :key="id" |
| | | closable |
| | | :disable-transitions="false" |
| | | @close="handleClose(id)" |
| | | > |
| | | {{ tag }} |
| | | </el-tag> |
| | | <el-select |
| | | v-if="inputVisible" |
| | | ref="saveTagInput" |
| | | v-model="inputValue" |
| | | class="input-new-tag" |
| | | filterable |
| | | clearable |
| | | allow-create |
| | | default-first-option |
| | | @keyup.enter.native="handleInputConfirm" |
| | | > |
| | | <el-option |
| | | v-for="(item, id) in tags" |
| | | :key="id" |
| | | :label="item" |
| | | :value="item" |
| | | /> |
| | | </el-select> |
| | | <el-button v-else class="button-new-tag" size="small" @click="showInput">+ New Tag</el-button> |
| | | </el-form-item> |
| | | <el-form-item label="绩效类型" prop="performanceType"> |
| | | <el-select v-model="form.performanceType" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in dict[performanceType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="描述"> |
| | | <el-input v-model="form.description" :rows="3" type="textarea" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划开始时间"> |
| | | <el-date-picker v-model="form.planStartTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workStartTime + ':00'" :picker-options="planStartTimePickerOptions" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划结束时间"> |
| | | <el-date-picker v-model="form.planEndTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workEndTime + ':00'" :picker-options="planEndTimePickerOptions" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划工时" prop="planHours"> |
| | | <el-input v-model="form.planHours" style="width: 340px;"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </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 |
| | | v-loading="crud.loading" |
| | | :data="crud.data" |
| | | size="small" |
| | | style="width: 100%;" |
| | | row-key="id" |
| | | :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" |
| | | @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"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.projectName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" label="计划工时" width="80"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.sumPlanHours }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="planStartTime" label="计划开始时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="planEndTime" label="计划结束时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskStatus" label="任务状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[taskStatus][scope.row.taskStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="performanceType" label="绩效类型" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[performanceType][scope.row.performanceType] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskClassification" label="任务分类" width="160"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[taskClassification][scope.row.taskClassification] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="description" label="描述" width="180" /> |
| | | <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 |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudTask from '@/api/task/task' |
| | | 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 crudProject from '@/api/project/project' |
| | | |
| | | const defaultForm = { id: null, name: null, projectId: null, parent: { id: null }, priority: null, tags: [], performanceType: null, description: null, planStartTime: null, planEndTime: null, planHours: null, pieceRate: 0, planWorkload: 0, planWorkloadUnit: null, taskStatus: null, remarks: null, version: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'Task', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.PRIORITY, constant.TAST_CLASSIFICATION, constant.PERFORMANCE_TYPE, constant.STANDARD_WORKLOAD_UNIT, constant.TASK_STATUS], |
| | | cruds() { |
| | | return CRUD({ title: '任务', url: 'api/task', idField: 'id', sort: 'planEndTime,asc', crudMethod: { ...crudTask }}) |
| | | }, |
| | | data() { |
| | | // 指针重指向 |
| | | const _this = this |
| | | // 时长(万内)验证 |
| | | var durationValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d{1,3})(\.\d{1,2})?$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 一万 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'task:add'], |
| | | edit: ['admin', 'task:edit'], |
| | | del: ['admin', 'task:del'], |
| | | download: ['admin', 'task:download'], |
| | | divide: ['admin', 'task:divide'], |
| | | seeDivide: ['admin', 'task:seeDivide'], |
| | | seeDaliy: ['admin', 'task:seeDaliy'] |
| | | }, |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' }, |
| | | { max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | ], |
| | | projectId: [ |
| | | { required: true, message: '所属项目不能为空', trigger: 'change' } |
| | | ], |
| | | performanceType: [ |
| | | { required: true, message: '绩效类型不能为空', trigger: 'change' } |
| | | ], |
| | | pieceRate: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | planHours: [ |
| | | { required: true, message: '计划工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | planWorkload: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | taskStatus: [ |
| | | { required: true, message: '任务状态不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'name', display_name: '名称' }, |
| | | { key: 'projectId', display_name: '所属项目' }, |
| | | { key: 'priority', display_name: '优先度' }, |
| | | { key: 'taskStatus', display_name: '任务状态' } |
| | | ], |
| | | // 计划开始时间选项 |
| | | planStartTimePickerOptions: { |
| | | // 禁用日期 |
| | | disabledDate(time) { |
| | | return _this.form.planEndTime != null && _this.form.planEndTime !== '' ? time.getTime() > new Date(_this.form.planEndTime).getTime() : false |
| | | } |
| | | }, |
| | | // 计划结束时间选项 |
| | | planEndTimePickerOptions: { |
| | | // 禁用日期 |
| | | disabledDate(time) { |
| | | return _this.form.planStartTime != null && _this.form.planStartTime !== '' ? time.getTime() < new Date(_this.form.planStartTime).getTime() - (86400000 - 1) : false |
| | | } |
| | | }, |
| | | // 字典:优先度 |
| | | priority: constant.PRIORITY, |
| | | // 字典:任务分类 |
| | | taskClassification: constant.TAST_CLASSIFICATION, |
| | | // 字典: 绩效类型 |
| | | performanceType: constant.PERFORMANCE_TYPE, |
| | | // 字典:标准工作量单位 |
| | | standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT, |
| | | // 字典:任务状态 |
| | | 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: [], |
| | | // 父级任务列表 |
| | | pidTasks: [], |
| | | // 用户列表 |
| | | tags: [], |
| | | // tag标签 |
| | | inputVisible: false, |
| | | inputValue: '' |
| | | } |
| | | }, |
| | | mounted() { |
| | | // 获取项目 |
| | | this.getProject() |
| | | this.getTags() |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 用户角色级别数组 |
| | | const userRolesLevel = this.$store.state.user.user.roles.map(({ level }) => level) |
| | | // 用户最大角色级别 |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel) |
| | | return true |
| | | }, |
| | | getTags() { |
| | | crudTask.getTags().then(res => { |
| | | // 项目列表 |
| | | this.tags = res |
| | | }) |
| | | }, |
| | | handleClose(id) { |
| | | this.form.tags.splice(id, 1) |
| | | }, |
| | | showInput() { |
| | | this.inputVisible = true |
| | | this.$nextTick(_ => { |
| | | this.$refs.saveTagInput.focus() // .$refs.input |
| | | }) |
| | | }, |
| | | handleInputConfirm() { |
| | | const inputValue = this.inputValue |
| | | if (inputValue) { |
| | | this.form.tags.push(inputValue) |
| | | } |
| | | this.inputVisible = false |
| | | this.inputValue = '' |
| | | }, |
| | | // handleInputClear() { |
| | | // let inputValue = this.inputValue |
| | | // if (!inputValue) { |
| | | // this.inputVisible = false |
| | | // } |
| | | // }, |
| | | handleSelect(item) { |
| | | this.inputValue = item.value |
| | | this.$refs.saveTagInput.$refs.input.focus() |
| | | }, |
| | | querySearchAsync(queryString, cb) { |
| | | crudTask.getTags(queryString ? { tagName: queryString } : {}).then(res => { |
| | | const tagMap = [] |
| | | res.forEach(tag => { |
| | | tagMap.push({ value: tag }) |
| | | }) |
| | | cb(tagMap) |
| | | }) |
| | | }, |
| | | // 获取项目 |
| | | getProject() { |
| | | // 获取项目 |
| | | crudProject.getRelevant().then(res => { |
| | | // 项目列表 |
| | | this.projects = res |
| | | }) |
| | | }, |
| | | // 树形表数据加载 |
| | | load(tree, treeNode, resolve) { |
| | | resolve(tree.children) |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 父级任务列表 |
| | | this.form.projectId = this.query.projectId |
| | | if (this.form.projectId) { |
| | | // 获取父级任务 |
| | | crudTask.getAll({ projectId: this.form.projectId }).then(res => { |
| | | // 父级任务列表 |
| | | this.pidTasks = res |
| | | }) |
| | | } else { |
| | | // 父级任务列表 |
| | | this.pidTasks = [] |
| | | } |
| | | }, |
| | | // 钩子:编辑 - 之前 |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | console.log('this.form.parent : ', this.form.parent) |
| | | // 获取父级任务 |
| | | crudTask.getAll({ projectId: this.form.projectId }).then(res => { |
| | | // 父级任务列表 |
| | | this.pidTasks = res |
| | | }) |
| | | }, |
| | | // 项目变更 |
| | | projectChange() { |
| | | // 表单赋值 |
| | | this.form.parent.id = null |
| | | // 判断表单项目是否为空 |
| | | if (this.form.projectId == null || this.form.projectId === '') { |
| | | // 父级任务列表 |
| | | this.pidTasks = [] |
| | | } else { |
| | | // 获取父级任务 |
| | | crudTask.getAll({ projectId: this.form.projectId }).then(res => { |
| | | // 父级任务列表 |
| | | this.pidTasks = res |
| | | }) |
| | | } |
| | | }, |
| | | // 输入框获取焦点时调用的方法 |
| | | async querySearch(queryString, cb) { |
| | | let results = [] |
| | | if (queryString === null || queryString == '') { |
| | | cb(results) |
| | | } else { |
| | | results = await crudTask.getNames({ name: queryString }) |
| | | cb(results) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .el-tag + .el-tag { |
| | | margin-left: 10px; |
| | | } |
| | | .button-new-tag { |
| | | margin-left: 10px; |
| | | height: 32px; |
| | | line-height: 30px; |
| | | padding-top: 0; |
| | | padding-bottom: 0; |
| | | } |
| | | .input-new-tag { |
| | | width: 90px; |
| | | margin-left: 10px; |
| | | vertical-align: bottom; |
| | | } |
| | | </style> |
| | |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <div> |
| | | <!-- 搜索 --> |
| | | <el-input v-model="query.name" clearable placeholder="名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.projectId" filterable placeholder="所属项目" style="width: 400px;" class="filter-item" @change="queryByProjectId"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.priority" filterable clearable placeholder="优先度" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[priority]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.taskClassification" filterable clearable placeholder="任务分类" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[taskClassification]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.taskStatus" filterable clearable placeholder="任务状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | </div> |
| | | <div style="margin-bottom: 20px;"> |
| | | <el-card class="box-card"> |
| | | <el-descriptions title="项目信息"> |
| | | <el-descriptions-item label="用户名">kooriookami</el-descriptions-item> |
| | | <el-descriptions-item label="手机号">18100000000</el-descriptions-item> |
| | | <el-descriptions-item label="居住地">苏州市</el-descriptions-item> |
| | | <el-descriptions-item label="备注"> |
| | | <el-tag size="small">学校</el-tag> |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="联系地址">江苏省苏州市吴中区吴中大道 1188 号</el-descriptions-item> |
| | | </el-descriptions> |
| | | </el-card> |
| | | </div> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-autocomplete v-model="query.name" class="filter-item" :fetch-suggestions="querySearch" placeholder="名称" style="width: 185px;" /> |
| | | <el-select v-model="query.taskStatus" filterable clearable placeholder="任务状态" style="width: 185px;" class="filter-item"> |
| | | <el-option |
| | | v-for="item in dict[taskStatus]" |
| | | :key="item.id" |
| | |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.performanceType" filterable clearable placeholder="绩效类型" style="width: 185px;" class="filter-item"> |
| | | <el-option |
| | | v-for="item in dict[performanceType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.userId" filterable clearable placeholder="所属员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.divide" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | :disabled="crud.selections.length !== 1" |
| | | @click="toDivide(crud.selections[0])" |
| | | > |
| | | 分配 |
| | | </el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.seeDivide" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | :disabled="crud.selections.length !== 1" |
| | | style="margin-left: 4px !important;" |
| | | @click="toSeeDivide(crud.selections[0])" |
| | | > |
| | | 查看分配 |
| | | </el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.seeDaliy" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | :disabled="crud.selections.length !== 1" |
| | | style="margin-left: 4px !important;" |
| | | @click="toSeeDaliy(crud.selections[0])" |
| | | > |
| | | 查看日报 |
| | | </el-button> |
| | | </crudOperation> |
| | | <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="110px"> |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="所属项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="crud.status.edit == crudStatusPrepared" @change="projectChange"> |
| | | <el-select v-model="form.projectId" disabled placeholder="请选择" style="width: 340px;" @change="projectChange"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :disabled="item.approveStatus == approveStatusUnrecognized" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="父级任务"> |
| | | <el-select v-model="form.pid" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <el-select v-if="pidTasks" v-model="form.parent.id" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in pidTasks" |
| | | :key="item.id" |
| | |
| | | :disabled="item.id == form.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="优先度" prop="priority"> |
| | | <el-select v-model="form.priority" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in dict[priority]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | {{ form.parent.id }} |
| | | </el-form-item> |
| | | <el-form-item label="任务分类" prop="taskClassification"> |
| | | <el-select v-model="form.taskClassification" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <el-tag |
| | | v-for="(tag, id) in form.tags" |
| | | :key="id" |
| | | closable |
| | | :disable-transitions="false" |
| | | @close="handleClose(id)" |
| | | > |
| | | {{ tag }} |
| | | </el-tag> |
| | | <el-select |
| | | v-if="inputVisible" |
| | | ref="saveTagInput" |
| | | v-model="inputValue" |
| | | class="input-new-tag" |
| | | filterable |
| | | clearable |
| | | allow-create |
| | | default-first-option |
| | | @keyup.enter.native="handleInputConfirm" |
| | | > |
| | | <el-option |
| | | v-for="item in dict[taskClassification]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | v-for="(item, id) in tags" |
| | | :key="id" |
| | | :label="item" |
| | | :value="item" |
| | | /> |
| | | </el-select> |
| | | <el-button v-else class="button-new-tag" size="small" @click="showInput">+ New Tag</el-button> |
| | | </el-form-item> |
| | | <el-form-item label="绩效类型" prop="performanceType"> |
| | | <el-select v-model="form.performanceType" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="计件单金" prop="pieceRate"> |
| | | <el-input v-model="form.pieceRate" style="width: 340px;"> |
| | | <template slot="append">元</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="计划工作量" prop="planWorkload"> |
| | | <el-input v-model="form.planWorkload" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划工作量单位"> |
| | | <el-select v-model="form.planWorkloadUnit" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="form.userIdList" multiple filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in dict[standardWorkloadUnit]" |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | > |
| | | <span style="float: left">{{ item.nickName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.levelName }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="任务状态" prop="taskStatus"> |
| | | <el-select v-model="form.taskStatus" filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in dict[taskStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 340px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | </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'}" |
| | | :summary-method="getSummaries" |
| | | show-summary |
| | | :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" |
| | | @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"> |
| | | <el-table-column :show-overflow-tooltip="true" label="计划工时" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.projectName }}</el-tag> |
| | | {{ scope.row.sumPlanHours }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="priority" label="优先度" width="80"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="planStartTime" label="计划开始时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="planEndTime" label="计划结束时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskStatus" label="任务状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[priority][scope.row.priority] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskClassification" label="任务分类" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[taskClassification][scope.row.taskClassification] }}</el-tag> |
| | | <el-tag>{{ dict.label[taskStatus][scope.row.taskStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="performanceType" label="绩效类型" width="80"> |
| | |
| | | <el-tag>{{ dict.label[performanceType][scope.row.performanceType] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="description" label="描述" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="planStartTime" label="计划开始时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="planEndTime" label="计划结束时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" label="已完成 / 已分配 / 计划工时" width="160"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskClassification" label="任务分类" width="160"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMaxTwoDecimalPlaces(scope.row.completedHours) }} / {{ scope.row.divideHours }} / {{ scope.row.planHours }} |
| | | <el-tag>{{ dict.label[taskClassification][scope.row.taskClassification] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" label="已完成 / 已分配 / 计划工作量" width="180"> |
| | | <template slot-scope="scope"> |
| | | <span> |
| | | {{ crud.toMaxTwoDecimalPlaces(scope.row.completedWorkload) }} / {{ scope.row.divideWorkload }} / {{ scope.row.planWorkload == null || scope.row.planWorkload == '' ? 0 : scope.row.planWorkload }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="planWorkloadUnit" label="计划工作量单位" width="110"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.planWorkloadUnit != null && scope.row.planWorkloadUnit != ''">{{ dict.label[standardWorkloadUnit][scope.row.planWorkloadUnit] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskStatus" label="任务状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[taskStatus][scope.row.taskStatus] }}</el-tag> |
| | | </template> |
| | | </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 :show-overflow-tooltip="true" prop="description" label="描述" width="180" /> |
| | | <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" |
| | | > |
| | | <el-button |
| | | slot="left" |
| | | v-permission="permission.divide" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | @click="toDivide(scope.row)" |
| | | /> |
| | | </udOperation> |
| | | <udOperation :data="scope.row" :permission="permission" /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | <!--表单组件(分配)--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="divideClose" :visible.sync="divideStatus" title="任务分配" width="500px"> |
| | | <el-form ref="divideForm" :model="divideForm" :rules="divideRules" size="small" label-width="110px"> |
| | | <el-form-item label="项目名称" prop="projectName"> |
| | | {{ divideForm.projectName }} |
| | | </el-form-item> |
| | | <el-form-item label="任务名称" prop="taskName"> |
| | | {{ divideForm.taskName }} |
| | | </el-form-item> |
| | | <el-form-item label="分配员工" prop="userIds"> |
| | | <el-select v-model="divideForm.userIds" filterable clearable multiple placeholder="请选择" style="width: 340px;" @change="calcHour"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled || divideForm.divideUserIds.includes(item.id)" |
| | | > |
| | | <span style="float: left">{{ item.nickName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.levelName }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="任务开始时间" prop="taskStartDate"> |
| | | <el-date-picker v-model="divideForm.taskStartDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workStartTime + ':00'" :picker-options="taskStartDatePickerOptions" style="width: 340px;" @change="calcHour" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务结束时间" prop="taskEndDate"> |
| | | <el-date-picker v-model="divideForm.taskEndDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workEndTime + ':00'" :picker-options="taskEndDatePickerOptions" style="width: 340px;" @change="calcHour" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务工时" prop="taskHours"> |
| | | <el-input v-model="divideForm.taskHours" style="width: 340px;"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="任务工作量" prop="taskWorkload"> |
| | | <el-input v-model="divideForm.taskWorkload" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务工作量单位" prop="taskWorkloadUnit"> |
| | | <span v-if="divideForm.taskWorkloadUnit != null && divideForm.taskWorkloadUnit != ''"> |
| | | {{ dict.label[standardWorkloadUnit][divideForm.taskWorkloadUnit] }} |
| | | </span> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="divideClose">取消</el-button> |
| | | <el-button :loading="divideLoading" type="primary" @click="divideSubmit">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudTask from '@/api/task/task' |
| | | import crudTaskUser from '@/api/task/taskUser' |
| | | 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 crudProject from '@/api/project/project' |
| | | import constant from '@/utils/constant' |
| | | import crudUser from '@/api/system/user' |
| | | import crudProject from '@/api/project/project' |
| | | |
| | | const defaultForm = { id: null, name: null, projectId: null, pid: null, priority: null, taskClassification: null, performanceType: null, description: null, planStartTime: null, planEndTime: null, planHours: null, pieceRate: 0, planWorkload: 0, planWorkloadUnit: null, taskStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, name: null, projectId: null, userIdList: [], parent: { id: null }, priority: null, tags: [], performanceType: null, description: null, planStartTime: null, planEndTime: null, planHours: null, pieceRate: 0, planWorkload: 0, planWorkloadUnit: null, taskStatus: null, remarks: null, version: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'Task', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | |
| | | projectId: [ |
| | | { required: true, message: '所属项目不能为空', trigger: 'change' } |
| | | ], |
| | | priority: [ |
| | | { required: true, message: '优先度不能为空', trigger: 'change' } |
| | | ], |
| | | taskClassification: [ |
| | | { required: true, message: '任务分类不能为空', trigger: 'change' } |
| | | ], |
| | | performanceType: [ |
| | | { required: true, message: '绩效类型不能为空', trigger: 'change' } |
| | | ], |
| | |
| | | { key: 'name', display_name: '名称' }, |
| | | { key: 'projectId', display_name: '所属项目' }, |
| | | { key: 'priority', display_name: '优先度' }, |
| | | { key: 'taskClassification', display_name: '任务分类' }, |
| | | { key: 'taskStatus', display_name: '任务状态' } |
| | | ], |
| | | // 计划开始时间选项 |
| | |
| | | projects: [], |
| | | // 父级任务列表 |
| | | pidTasks: [], |
| | | // 分配表单状态 |
| | | divideStatus: false, |
| | | // 分配表单加载 |
| | | divideLoading: false, |
| | | // 分配表单数据 |
| | | divideForm: { projectId: null, projectName: null, taskId: null, taskName: null, userIds: [], divideUserIds: [], taskStartDate: null, taskEndDate: null, taskHours: null, taskWorkload: null, taskStatus: null }, |
| | | // 分配表单验证 |
| | | divideRules: { |
| | | userIds: [ |
| | | { required: true, message: '分配员工不能为空', trigger: 'change' } |
| | | ], |
| | | taskStartDate: [ |
| | | { required: true, message: '任务开始时间不能为空', trigger: 'change' } |
| | | ], |
| | | taskEndDate: [ |
| | | { required: true, message: '任务结束时间不能为空', trigger: 'change' } |
| | | ], |
| | | taskHours: [ |
| | | { required: true, message: '任务工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | taskWorkload: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ] |
| | | }, |
| | | // 任务开始时间选项 |
| | | taskStartDatePickerOptions: { |
| | | // 禁用日期 |
| | | disabledDate(time) { |
| | | return _this.divideForm.taskEndDate != null && _this.divideForm.taskEndDate !== '' ? time.getTime() > new Date(_this.divideForm.taskEndDate).getTime() : false |
| | | } |
| | | }, |
| | | // 任务结束时间选项 |
| | | taskEndDatePickerOptions: { |
| | | // 禁用日期 |
| | | disabledDate(time) { |
| | | return _this.divideForm.taskStartDate != null && _this.divideForm.taskStartDate !== '' ? time.getTime() < new Date(_this.divideForm.taskStartDate).getTime() - (86400000 - 1) : false |
| | | } |
| | | }, |
| | | // 员工列表 |
| | | users: [], |
| | | // 用户列表 |
| | | users: [] |
| | | tags: [], |
| | | // tag标签 |
| | | inputVisible: false, |
| | | inputValue: '' |
| | | } |
| | | }, |
| | | created() { |
| | | this.crud.optShow.reset = false |
| | | }, |
| | | mounted() { |
| | | // 获取项目 |
| | | this.getProject() |
| | | // 获取员工 |
| | | this.getUser() |
| | | this.getTags() |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | if (!this.crud.query.projectId) { |
| | | return false |
| | | } |
| | | // 用户角色级别数组 |
| | | const userRolesLevel = this.$store.state.user.user.roles.map(({ level }) => level) |
| | | // 用户最大角色级别 |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel) |
| | | // 获取项目 |
| | | this.getProject() |
| | | // 获取用户 |
| | | this.getUser() |
| | | return true |
| | | }, |
| | | // 获取项目 |
| | | getProject() { |
| | | // 获取项目 |
| | | crudProject.getRelevant().then(res => { |
| | | [CRUD.HOOK.beforeSubmit]() { |
| | | if (this.form.parent.id === null || this.form.parent.id === '') { |
| | | this.form.parent = null |
| | | } |
| | | return true |
| | | }, |
| | | queryByProjectId(projectId) { |
| | | this.crud.resetQuery(false) |
| | | this.crud.query.projectId = projectId |
| | | this.crud.toQuery() |
| | | }, |
| | | getTags() { |
| | | crudTask.getTags().then(res => { |
| | | // 项目列表 |
| | | this.projects = res |
| | | this.tags = res |
| | | }) |
| | | }, |
| | | // 自动计算工时 |
| | | calcHour() { |
| | | if (this.divideForm.taskEndDate && this.divideForm.taskStartDate && this.divideForm.userIds && this.divideForm.userIds.length > 0 && !this.divideForm.taskHours) { |
| | | crudTaskUser.calcHours({ userId: this.divideForm.userIds[0], taskStartDate: this.divideForm.taskStartDate, taskEndDate: this.divideForm.taskEndDate }).then(res => { |
| | | this.divideForm.taskHours = res |
| | | }) |
| | | handleClose(id) { |
| | | this.form.tags.splice(id, 1) |
| | | }, |
| | | showInput() { |
| | | this.inputVisible = true |
| | | this.$nextTick(_ => { |
| | | this.$refs.saveTagInput.focus() // .$refs.input |
| | | }) |
| | | }, |
| | | handleInputConfirm() { |
| | | const inputValue = this.inputValue |
| | | if (inputValue) { |
| | | this.form.tags.push(inputValue) |
| | | } |
| | | this.inputVisible = false |
| | | this.inputValue = '' |
| | | }, |
| | | handleSelect(item) { |
| | | this.inputValue = item.value |
| | | this.$refs.saveTagInput.$refs.input.focus() |
| | | }, |
| | | querySearchAsync(queryString, cb) { |
| | | crudTask.getTags(queryString ? { tagName: queryString } : {}).then(res => { |
| | | const tagMap = [] |
| | | res.forEach(tag => { |
| | | tagMap.push({ value: tag }) |
| | | }) |
| | | cb(tagMap) |
| | | }) |
| | | }, |
| | | // 获取用户 |
| | | getUser() { |
| | |
| | | this.users = res |
| | | }) |
| | | }, |
| | | // 获取项目 |
| | | getProject() { |
| | | // 获取项目 |
| | | crudProject.getRelevant().then(res => { |
| | | // 项目列表 |
| | | this.projects = res |
| | | }) |
| | | }, |
| | | // 树形表数据加载 |
| | | load(tree, treeNode, resolve) { |
| | | // 获取子级任务 |
| | | crudTask.getChildren({ id: tree.id }).then(res => { |
| | | // 添加 |
| | | 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 |
| | | resolve(tree.children) |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | this.form.projectId = this.crud.query.projectId |
| | | // 父级任务列表 |
| | | this.pidTasks = [] |
| | | }, |
| | | // 钩子:编辑 - 之前 |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | // 获取父级任务 |
| | | crudTask.getAll({ projectId: this.form.projectId }).then(res => { |
| | | // 父级任务列表 |
| | | this.pidTasks = res |
| | |
| | | // 项目变更 |
| | | projectChange() { |
| | | // 表单赋值 |
| | | this.form.pid = null |
| | | this.form.parent.id = null |
| | | // 判断表单项目是否为空 |
| | | if (this.form.projectId == null || this.form.projectId === '') { |
| | | // 父级任务列表 |
| | |
| | | }) |
| | | } |
| | | }, |
| | | // 任务分配 |
| | | toDivide(data) { |
| | | // 分配表单数据 |
| | | this.divideForm.projectId = data.projectId |
| | | this.divideForm.projectName = data.projectName |
| | | this.divideForm.taskId = data.id |
| | | this.divideForm.taskName = data.name |
| | | this.divideForm.divideUserIds = data.divideUserIds |
| | | this.divideForm.taskWorkloadUnit = data.planWorkloadUnit |
| | | this.divideForm.taskStatus = constant.TASK_STATUS_NOT_STARTED |
| | | // 获取任务的计划开始时间结束时间 |
| | | if (data.planStartTime) { |
| | | this.divideForm.taskStartDate = data.planStartTime |
| | | } |
| | | if (data.planEndTime) { |
| | | this.divideForm.taskEndDate = data.planEndTime |
| | | } |
| | | // 分配表单状态 |
| | | this.divideStatus = true |
| | | }, |
| | | // 查看任务分配 |
| | | toSeeDivide(data) { |
| | | // 跳转页面 |
| | | this.$router.push({ |
| | | name: 'TaskUser', |
| | | params: { |
| | | projectId: data.projectId, |
| | | taskId: data.id |
| | | } |
| | | }) |
| | | }, |
| | | // 查看任务日报 |
| | | toSeeDaliy(data) { |
| | | // 跳转页面 |
| | | this.$router.push({ |
| | | name: 'TaskDaliy', |
| | | params: { |
| | | projectId: data.projectId, |
| | | taskId: data.id |
| | | } |
| | | }) |
| | | }, |
| | | // 分配表单关闭 |
| | | divideClose() { |
| | | // 分配表单状态 |
| | | this.divideStatus = false |
| | | // 分配表单加载 |
| | | this.divideLoading = false |
| | | // 分配表单数据 |
| | | this.divideForm = { projectId: null, projectName: null, taskId: null, taskName: null, userIds: [], divideUserIds: [], taskStartDate: null, taskEndDate: null, taskHours: null, taskWorkload: null, taskStatus: null } |
| | | // 清除表单验证 |
| | | this.$nextTick(() => { |
| | | this.$refs['divideForm'].clearValidate() |
| | | }) |
| | | }, |
| | | // 分配表单提交 |
| | | divideSubmit() { |
| | | // 分配表单加载 |
| | | this.divideLoading = true |
| | | // 表单验证 |
| | | 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 => { |
| | | // 分配表单关闭 |
| | | this.divideClose() |
| | | // 消息提示 |
| | | this.crud.notify('任务分配成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | // 刷新页面 |
| | | this.crud.refresh() |
| | | }) |
| | | } else { |
| | | // 分配表单加载 |
| | | this.divideLoading = false |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | // 钩子:提交 - 之前 |
| | | [CRUD.HOOK.beforeSubmit]() { |
| | | // 判断用户角色 |
| | | if (this.userRolesLevelMin === this.roleLevelSuper || this.userRolesLevelMin === this.roleLevelGeneral) { |
| | | return true |
| | | // 输入框获取焦点时调用的方法 |
| | | async querySearch(queryString, cb) { |
| | | let results = [] |
| | | if (queryString === null || queryString === '') { |
| | | cb(results) |
| | | } 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 |
| | | } |
| | | results = await crudTask.getNames({ projectId: this.crud.query.projectId, name: queryString }) |
| | | cb(results) |
| | | } |
| | | } |
| | | } |
| | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | .el-tag + .el-tag { |
| | | margin-left: 10px; |
| | | } |
| | | .button-new-tag { |
| | | margin-left: 10px; |
| | | height: 32px; |
| | | line-height: 30px; |
| | | padding-top: 0; |
| | | padding-bottom: 0; |
| | | } |
| | | .input-new-tag { |
| | | width: 90px; |
| | | margin-left: 10px; |
| | | vertical-align: bottom; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" style="width: 185px;" class="filter-item" @change="queryProjectChange" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.taskId" filterable clearable placeholder="所属任务" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in queryTasks" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.userId" filterable clearable placeholder="所属员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.taskStatus" filterable clearable placeholder="任务状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[taskStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <date-range-picker v-model="query.createTime" class="date-item" /> |
| | | <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="110px"> |
| | | <el-form-item label="所属项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="crud.status.edit == crudStatusPrepared || userRolesLevelMin == roleLevelOrdinary" @change="formProjectChange"> |
| | | <el-row :gutter="20"> |
| | | <!--侧边部门数据--> |
| | | <el-col :span="6"> |
| | | <div class="head-container"> |
| | | <div class="tree-scroll"> |
| | | <el-select v-model="projectId" filterable clearable placeholder="请先选择所属项目" style="width:100%" class="filter-item" @change="getTaskDatas"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :disabled="item.approveStatus == approveStatusUnrecognized" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属任务" prop="taskId"> |
| | | <el-select v-model="form.taskId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="crud.status.edit == crudStatusPrepared || userRolesLevelMin == roleLevelOrdinary" @change="formTaskChange"> |
| | | <el-option |
| | | v-for="item in formTasks" |
| | | v-for="item in projectDatas" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="crud.status.edit == crudStatusPrepared || userRolesLevelMin == roleLevelOrdinary" @change="calcHour"> |
| | | <el-input |
| | | v-model="taskName" |
| | | clearable |
| | | size="small" |
| | | placeholder="输入任务名称搜索" |
| | | prefix-icon="el-icon-search" |
| | | class="filter-item" |
| | | @change="getTaskDatas" |
| | | /> |
| | | </div> |
| | | </div> |
| | | <el-tree |
| | | v-loading="taskLoading" |
| | | :data="taskDatas" |
| | | :load="getTaskDatas" |
| | | :props="defaultProps" |
| | | class="flow-tree" |
| | | accordion |
| | | :expand-on-click-node="false" |
| | | lazy |
| | | @node-click="handleNodeClick" |
| | | > |
| | | <template slot-scope="{node}"> |
| | | <el-tooltip effect="dark" :content="node.label" placement="top-start" style="font-size:14px;"> |
| | | <div>{{ node.label }}</div> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-tree> |
| | | </el-col> |
| | | <!--任务分配数据--> |
| | | <el-col :span="18"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.userId" filterable clearable placeholder="所属员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled || form.divideUserIds.includes(item.id)" |
| | | > |
| | | <span style="float: left">{{ item.nickName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.levelName }}</span> |
| | | </el-option> |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="任务开始时间" prop="taskStartDate"> |
| | | <el-date-picker v-model="form.taskStartDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workStartTime + ':00'" :picker-options="taskStartDatePickerOptions" style="width: 340px;" :disabled="userRolesLevelMin == roleLevelOrdinary" @change="calcHour" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务结束时间" prop="taskEndDate"> |
| | | <el-date-picker v-model="form.taskEndDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workEndTime + ':00'" :picker-options="taskEndDatePickerOptions" style="width: 340px;" :disabled="userRolesLevelMin == roleLevelOrdinary" @change="calcHour" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务工时" prop="taskHours"> |
| | | <el-input v-model="form.taskHours" style="width: 340px;" :disabled="userRolesLevelMin == roleLevelOrdinary"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="任务工作量" prop="taskWorkload"> |
| | | <el-input v-model="form.taskWorkload" style="width: 340px;" :disabled="userRolesLevelMin == roleLevelOrdinary" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务工作量单位" prop="taskWorkloadUnit"> |
| | | {{ dict.label[standardWorkloadUnit][form.taskWorkloadUnit] }} |
| | | </el-form-item> |
| | | <el-form-item label="任务绩效类型" prop="taskPerformanceType"> |
| | | {{ dict.label[performanceType][form.taskPerformanceType] }} |
| | | </el-form-item> |
| | | <el-form-item label="强制更新" tool-tip prop="enable1"> |
| | | <el-tooltip content="不增减工作量的场合调整工时的话,需要选择此项。(有疑问请联系管理员,不要随便选。。。)" effect="dark" placement="bottom"> |
| | | <el-switch v-model="form.enable1" /> |
| | | </el-tooltip> |
| | | </el-form-item> |
| | | <el-form-item label="任务状态" prop="taskStatus"> |
| | | <el-select v-model="form.taskStatus" filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-select v-model="query.taskStatus" filterable clearable multiple collapse-tags placeholder="任务状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[taskStatus]" |
| | | :key="item.id" |
| | |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 340px;" :disabled="userRolesLevelMin == roleLevelOrdinary" /> |
| | | </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> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.generate" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-plus" |
| | | style="margin-right: 6px;" |
| | | @click="openGenerate" |
| | | >导入</el-button> |
| | | </crudOperation> |
| | | <div> |
| | | <span style="magin: right 10px;"> 当前任务: {{ selectedTaskName }}</span> |
| | | <span v-for="item in taskTotal" :key="item._id"> |
| | | <template v-if="item._id === 'task_status_not_started'"> |
| | | <b>未开始:</b>{{ item.taskStatusCnt }}件(合计:{{ item.taskHours }}小时) |
| | | </template> |
| | | <template v-if="item._id === 'task_status_in_hand'"> |
| | | <b>进行中:</b>{{ item.taskStatusCnt }}件(合计:{{ item.taskHours }}小时) |
| | | </template> |
| | | <template v-if="item._id === 'task_status_test'"> |
| | | <b>待测试:</b>{{ item.taskStatusCnt }}件(合计:{{ item.taskHours }}小时) |
| | | </template> |
| | | <template v-if="item._id === 'task_status_stop'"> |
| | | <b>已暂停:</b>{{ item.taskStatusCnt }}件(合计:{{ item.taskHours }}小时) |
| | | </template> |
| | | <template v-if="item._id === 'task_status_completed'"> |
| | | <b>已完成:</b>{{ item.taskStatusCnt }}件(合计:{{ item.taskHours }}小时) |
| | | </template> |
| | | </span> |
| | | </div> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <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"> |
| | | <el-tag>{{ scope.row.projectName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskName" label="所属任务" fixed="left" width="180"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.taskName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属员工" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.userNickName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskStartDate" label="任务开始时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskEndDate" label="任务结束时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" label="消耗 / 任务工时" width="110"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.consumedHours }} / {{ scope.row.taskHours }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" label="消耗 / 任务工作量" width="120"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.consumedWorkload }} / {{ scope.row.taskWorkload == null || scope.row.taskWorkload == '' ? 0 : scope.row.taskWorkload }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskWorkloadUnit" label="任务工作量单位" width="110"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.taskWorkloadUnit != null && scope.row.taskWorkloadUnit != ''">{{ dict.label[standardWorkloadUnit][scope.row.taskWorkloadUnit] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskPerformanceType" label="任务绩效类型" width="110"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.taskPerformanceType != null && scope.row.taskPerformanceType != ''">{{ dict.label[performanceType][scope.row.taskPerformanceType] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskProgress" label="任务进度" width="80"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.taskProgress }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskStatus" label="任务状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[taskStatus][scope.row.taskStatus] }}</el-tag> |
| | | </template> |
| | | </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','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" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | </div> |
| | | <!--表单渲染--> |
| | | <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="110px"> |
| | | <el-form-item label="所属任务" prop="taskId"> |
| | | <el-select v-model="form.taskId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="true" @change="formTaskChange"> |
| | | <el-option |
| | | v-for="item in formTasks" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="任务分类" prop="taskClassification"> |
| | | <el-select v-model="form.taskClassification" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in dict[taskClassification]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" @change="calcHour"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled || form.divideUserIds.includes(item.id)" |
| | | > |
| | | <span style="float: left">{{ item.nickName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.levelName }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="任务开始时间" prop="taskStartDate"> |
| | | <el-date-picker v-model="form.taskStartDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workStartTime + ':00'" :picker-options="taskStartDatePickerOptions" style="width: 340px;" @change="calcHour" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务结束时间" prop="taskEndDate"> |
| | | <el-date-picker v-model="form.taskEndDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workEndTime + ':00'" :picker-options="taskEndDatePickerOptions" style="width: 340px;" @change="calcHour" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务工时" prop="taskHours"> |
| | | <el-input v-model="form.taskHours" style="width: 340px;"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="任务绩效类型" prop="taskPerformanceType"> |
| | | {{ dict.label[performanceType][form.taskPerformanceType] }} |
| | | </el-form-item> |
| | | <el-form-item label="任务状态" prop="taskStatus"> |
| | | <el-select v-model="form.taskStatus" filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in dict[taskStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 340px;" /> |
| | | </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="name" label="名称" fixed="left" width="180"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.name }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属员工" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.userNickName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskClassification" label="任务分类" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[taskClassification][scope.row.taskClassification] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskStartDate" label="任务开始时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskEndDate" label="任务结束时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskHours" label="任务工时" width="110" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="performanceType" label="任务绩效类型" width="110"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.performanceType != null && scope.row.performanceType != ''">{{ dict.label[performanceType][scope.row.performanceType] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskProgress" label="任务进度" width="80"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.taskDaliyList.length === 0 ? 0 : scope.row.taskDaliyList[0].taskProgress }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskStatus" label="任务状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[taskStatus][scope.row.taskStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','taskUser:edit','taskUser:del'])" label="操作" width="150px" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="closeGenerate" :visible.sync="generateStatus" title="导入任务分配信息" width="720px"> |
| | | <el-form ref="generateForm" size="small" label-width="80px"> |
| | | <upload-excel-component :on-success="handleSuccess" :before-upload="beforeUpload" /> |
| | | <el-table :data="generateForm" border highlight-current-row style="width: 100%;margin-top:20px;"> |
| | | <el-table-column v-for="item of tableHeader" :key="item.id" :prop="item.id" :label="item.name" /> |
| | | </el-table> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="closeGenerate">取消</el-button> |
| | | <el-button :loading="generateLoading" type="primary" :disabled="uploading" @click="submitGenerate">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudTaskUser from '@/api/task/taskUser' |
| | | import crudProject from '@/api/project/project' |
| | | import crudTask from '@/api/task/task' |
| | | import crudUser from '@/api/system/user' |
| | | 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 { mapGetters } from 'vuex' |
| | | import constant from '../../../utils/constant' |
| | | 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: [] } |
| | | import Treeselect from '@riophae/vue-treeselect' |
| | | import { mapGetters } from 'vuex' |
| | | import constant from '@/utils/constant' |
| | | import UploadExcelComponent from '@/components/UploadExcel/index.vue' |
| | | const defaultForm = { id: null, userId: null, projectId: null, taskId: null, taskStartDate: null, taskEndDate: null, taskHours: 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, DateRangePicker }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.TASK_STATUS, constant.STANDARD_WORKLOAD_UNIT, constant.PERFORMANCE_TYPE], |
| | | components: { Treeselect, crudOperation, rrOperation, udOperation, pagination, DateRangePicker, UploadExcelComponent }, |
| | | cruds() { |
| | | return CRUD({ title: '任务分配', url: 'api/taskUser', idField: 'id', sort: 'taskStartDate,desc', crudMethod: { ...crudTaskUser }}) |
| | | return CRUD({ title: '任务分配', url: 'api/taskUser', crudMethod: { ...crudTaskUser }}) |
| | | }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | // 数据字典 |
| | | dicts: [constant.TASK_STATUS, constant.TAST_CLASSIFICATION, constant.STANDARD_WORKLOAD_UNIT, constant.PERFORMANCE_TYPE], |
| | | data() { |
| | | // 指针重指向 |
| | | const _this = this |
| | | // 时长(万内)验证 |
| | | var durationValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d{1,3})(\.\d{1,2})?$/ |
| | |
| | | } |
| | | } |
| | | return { |
| | | projectId: null, |
| | | projectDatas: [], |
| | | taskName: '', |
| | | selectedTaskName: '', |
| | | taskTotal: [], |
| | | taskDatas: [], |
| | | taskLoading: false, |
| | | defaultProps: { children: 'nodes', label: 'name', isLeaf: 'leaf' }, |
| | | permission: { |
| | | add: ['admin', 'taskUser:add'], |
| | | edit: ['admin', 'taskUser:edit'], |
| | | del: ['admin', 'taskUser:del'], |
| | | download: ['admin', 'taskUser:download'] |
| | | download: ['admin', 'taskUser:download'], |
| | | generate: ['admin', 'taskUser:add'] |
| | | }, |
| | | rules: { |
| | | projectId: [ |
| | |
| | | { required: true, message: '任务工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | taskWorkload: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | taskStatus: [ |
| | | { required: true, message: '任务状态不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'projectId', display_name: '所属项目' }, |
| | | { key: 'taskId', display_name: '所属任务' }, |
| | | { key: 'userId', display_name: '所属员工' }, |
| | | { key: 'taskStatus', display_name: '任务状态' }, |
| | | { key: 'createTime', display_name: '创建时间' } |
| | | ], |
| | | // 字典:任务状态 |
| | | taskStatus: constant.TASK_STATUS, |
| | | // 字典:任务分类 |
| | | taskClassification: constant.TAST_CLASSIFICATION, |
| | | // 字典:标准工作量单位 |
| | | standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT, |
| | | // 字典:绩效对象 |
| | | performanceType: constant.PERFORMANCE_TYPE, |
| | | // 字典:批准状态-未承认 |
| | | approveStatusUnrecognized: constant.APPROVE_STATUS_UNRECOGNIZED, |
| | | // CRUD状态 |
| | | crudStatusPrepared: CRUD.STATUS.PREPARED, |
| | | generateForm: [], |
| | | tableHeader: [], |
| | | users: [], |
| | | // 项目列表 |
| | | projects: [], |
| | | // 检索任务列表 |
| | | queryTasks: [], |
| | | // 表单任务列表 |
| | | formTasks: [], |
| | | // 生成表单状态 |
| | | generateStatus: false, |
| | | // 生成表单加载 |
| | | generateLoading: false, |
| | | uploading: true, |
| | | // 任务开始时间选项 |
| | | taskStartDatePickerOptions: { |
| | | // 禁用日期 |
| | |
| | | disabledDate(time) { |
| | | return _this.form.taskStartDate != null && _this.form.taskStartDate !== '' ? time.getTime() < new Date(_this.form.taskStartDate).getTime() - (86400000 - 1) : false |
| | | } |
| | | }, |
| | | // 字典:任务状态 |
| | | taskStatus: constant.TASK_STATUS, |
| | | // 字典:标准工作量单位 |
| | | standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT, |
| | | // 字典:绩效对象 |
| | | performanceType: constant.PERFORMANCE_TYPE, |
| | | // 字典:批准状态-未承认 |
| | | approveStatusUnrecognized: constant.APPROVE_STATUS_UNRECOGNIZED, |
| | | // 角色级别:超级管理员 |
| | | roleLevelSuper: constant.ROLE_LEVEL_SUPER, |
| | | // 角色级别:总经理 |
| | | roleLevelGeneral: constant.ROLE_LEVEL_GENERAL, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY, |
| | | // CRUD状态 |
| | | crudStatusPrepared: CRUD.STATUS.PREPARED, |
| | | // 用户最大角色级别 |
| | | userRolesLevelMin: null, |
| | | // 项目列表 |
| | | projects: [], |
| | | // 检索任务列表 |
| | | queryTasks: [], |
| | | // 表单任务列表 |
| | | formTasks: [], |
| | | // 用户列表 |
| | | users: [] |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | 'user' |
| | | ]) |
| | | }, |
| | | mounted() { |
| | | // const that = this |
| | | // window.onresize = function temp() { |
| | | // that.height = document.documentElement.clientHeight - 180 + 'px;' |
| | | // } |
| | | this.getAllProjectDatas() |
| | | this.getUser() |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 判断传参是否为空 |
| | | if (this.$route.params.projectId != null && this.$route.params.projectId !== '' && this.crud.query.projectId === undefined) { |
| | | // 检索条件赋值 |
| | | this.$set(this.crud.query, 'projectId', Number(this.$route.params.projectId)) |
| | | // 获取任务列表 |
| | | crudTask.getAll({ projectId: this.query.projectId }).then(res => { |
| | | // 检索任务列表 |
| | | this.queryTasks = res |
| | | }) |
| | | if (!this.query.taskId) { |
| | | return false |
| | | } |
| | | // 判断传参是否为空 |
| | | if (this.$route.params.taskId != null && this.$route.params.taskId !== '' && this.crud.query.taskId === undefined) { |
| | | // 检索条件赋值 |
| | | this.$set(this.crud.query, 'taskId', Number(this.$route.params.taskId)) |
| | | } |
| | | // 用户角色级别数组 |
| | | const userRolesLevel = this.user.roles.map(({ level }) => level) |
| | | // 用户最大角色级别 |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel) |
| | | // 获取项目 |
| | | this.getProject() |
| | | // 获取用户 |
| | | this.getUser() |
| | | return true |
| | | }, |
| | | // 获取项目 |
| | | getProject() { |
| | | // 获取项目 |
| | | crudProject.getRelevant().then(res => { |
| | | // 项目列表 |
| | | this.projects = res |
| | | }) |
| | | }, |
| | | // 获取用户 |
| | | getUser() { |
| | |
| | | this.users = res |
| | | }) |
| | | }, |
| | | getAllProjectDatas() { |
| | | crudProject.getAll().then(res => { |
| | | this.projectDatas = res |
| | | }) |
| | | }, |
| | | // 获取左侧部门数据 |
| | | getTaskDatas(node, resolve) { |
| | | const sort = 'id,desc' |
| | | const params = { sort: sort } |
| | | if (!this.projectId) { |
| | | return |
| | | } else { |
| | | params['projectId'] = this.projectId |
| | | } |
| | | if (typeof node === 'object' && node.level !== 0) { |
| | | params['pid'] = node.data.id |
| | | } else { |
| | | params['isTop'] = true |
| | | } |
| | | if (this.taskName) { |
| | | params['name'] = this.taskName |
| | | } |
| | | this.taskLoading = true |
| | | setTimeout(() => { |
| | | crudTask.getChildren(params).then(res => { |
| | | if (resolve) { |
| | | resolve(res) |
| | | } else { |
| | | this.taskDatas = res |
| | | } |
| | | this.taskLoading = false |
| | | }).catch(() => { |
| | | this.taskLoading = false |
| | | }) |
| | | }, 100) |
| | | }, |
| | | // 切换任务 |
| | | handleNodeClick(data) { |
| | | if (data.pid === 0) { |
| | | this.query.taskId = null |
| | | this.query.taskStatus = [] |
| | | this.selectedTaskName = null |
| | | this.taskTotal = [] |
| | | } else { |
| | | this.query.taskId = data.id |
| | | this.query.taskStatus = ['task_status_not_started', 'task_status_in_hand', 'task_status_test', 'task_status_stop'] |
| | | this.selectedTaskName = data.name |
| | | crudTaskUser.getSum({ 'taskId': this.query.taskId }).then(res => { |
| | | this.taskTotal = res |
| | | }) |
| | | } |
| | | this.crud.toQuery() |
| | | }, |
| | | beforeUpload(file) { |
| | | const isLt1M = file.size / 1024 / 1024 < 1 |
| | | if (isLt1M) { |
| | | return true |
| | | } |
| | | this.$message({ |
| | | message: '请不要上传大于1m的文件.', |
| | | type: 'warning' |
| | | }) |
| | | return false |
| | | }, |
| | | handleSuccess({ results, header }) { |
| | | this.uploading = false |
| | | this.generateForm = results |
| | | console.log('this.generateForm : ', results) |
| | | this.tableHeader = header |
| | | }, |
| | | // 生成表单打开 |
| | | openGenerate() { |
| | | // 生成表单数据 |
| | | this.generateForm = [] |
| | | // 生成表单状态 |
| | | this.generateStatus = true |
| | | }, |
| | | // 生成表单关闭 |
| | | closeGenerate() { |
| | | // 生成表单状态 |
| | | this.generateStatus = false |
| | | }, |
| | | // 生成表单提交 |
| | | submitGenerate() { |
| | | if (!this.generateForm.file.size) { |
| | | this.$message.warning('请选择上传的文件') |
| | | return |
| | | } |
| | | // 生成表单加载 |
| | | this.generateLoading = true |
| | | this.uploading = true |
| | | console.log('3333333333333333333 : ', this.generateForm) |
| | | // crudUserInsurance.generate(this.generateForm).then(res => { |
| | | // // 生成表单关闭 |
| | | // this.closeGenerate() |
| | | // // 生成表单加载 |
| | | // this.generateLoading = true |
| | | // // 搜索:刷新表格 |
| | | // this.crud.toQuery() |
| | | // this.crud.notify('生成成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | // }).catch(err=>{ |
| | | // this.uploading = false |
| | | // // 生成表单加载 |
| | | // this.generateLoading = false |
| | | // }) |
| | | }, |
| | | // 自动计算工时 |
| | | calcHour() { |
| | | if (this.form.taskEndDate && this.form.taskStartDate && this.form.userId && !this.form.taskHours) { |
| | | crudTaskUser.calcHours({ userId: this.form.userId, taskStartDate: this.form.taskStartDate, taskEndDate: this.form.taskEndDate }).then(res => { |
| | | this.form.taskHours = res |
| | | }) |
| | | } |
| | | }, |
| | | // 检索项目变更 |
| | | queryProjectChange() { |
| | | // 检索赋值 |
| | | this.$set(this.query, 'taskId', null) |
| | | // 判断检索项目是否为空 |
| | | if (this.query.projectId == null || this.query.projectId === '') { |
| | | // 检索任务列表 |
| | | this.queryTasks = [] |
| | | } else { |
| | | // 获取任务列表 |
| | | crudTask.getAll({ projectId: this.query.projectId }).then(res => { |
| | | // 检索任务列表 |
| | | this.queryTasks = res |
| | | }) |
| | | } |
| | | }, |
| | | // 表格统计 |
| | | 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]() { |
| | | // 表单赋值 |
| | | this.form.taskWorkloadUnit = null |
| | | this.form.taskPerformanceType = null |
| | | // 表单任务列表 |
| | | this.formTasks = [] |
| | | }, |
| | | // 钩子:编辑 - 之前 |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | // 获取父级任务 |
| | | crudTask.getAll({ projectId: this.form.projectId }).then(res => { |
| | | // 表单任务列表 |
| | | this.formTasks = res |
| | | // // 表单任务变更 |
| | | // this.formTaskChange() |
| | | }) |
| | | }, |
| | | // 表单项目变更 |
| | | formProjectChange() { |
| | | // 表单赋值 |
| | | this.form.taskId = null |
| | | // 判断表单项目是否为空 |
| | | if (this.form.projectId == null || this.form.projectId === '') { |
| | | // 表单任务列表 |
| | | this.formTasks = [] |
| | | } else { |
| | | // 获取父级任务 |
| | | crudTask.getAll({ projectId: this.form.projectId }).then(res => { |
| | | // 表单任务列表 |
| | | this.formTasks = res |
| | | }) |
| | | } |
| | | }, |
| | |
| | | this.form.taskPerformanceType = null |
| | | } |
| | | } |
| | | // 判断是否是否是新增 |
| | | if (this.crud.status.add === CRUD.STATUS.PREPARED) { |
| | | // 表单赋值 |
| | | this.form.userId = null |
| | | } |
| | | // 查询任务分配用户 |
| | | crudTaskUser.getTaskUserIds({ taskId: this.form.taskId }).then(res => { |
| | | // 表单赋值 |
| | | this.form.divideUserIds = res |
| | | }) |
| | | }, |
| | | // 钩子:提交 - 之前 |
| | | [CRUD.HOOK.beforeSubmit]() { |
| | | this.form.enable = this.form.enable1 |
| | | // 判断用户角色 |
| | | 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 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | <style rel="stylesheet/scss" lang="scss" scoped> |
| | | .tree-scroll { |
| | | height: 100%; |
| | | width: 100%; |
| | | } |
| | | |
| | | .flow-tree { |
| | | overflow-x: hidden; |
| | | overflow-y: auto; |
| | | max-height: 600px; |
| | | width: 100%; |
| | | |
| | | >>>.el-tree-node { |
| | | // height:40px; |
| | | > .el-tree-node__children { |
| | | overflow-y: visible !important; |
| | | } |
| | | > .el-tree-node__content { |
| | | height: 100%; |
| | | } |
| | | } |
| | | } |
| | | ::v-deep .vue-treeselect__control,::v-deep .vue-treeselect__placeholder,::v-deep .vue-treeselect__single-value { |
| | | height: 40px; |
| | | line-height: 40px; |
| | | } |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <label class="el-form-item-label">公司</label> |
| | | <el-select v-model="query.companyId" filterable clearable placeholder="公司" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in companys" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.id" |
| | | /> |
| | | </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="company.id"> |
| | | <el-select v-model="form.company.id" filterable clearable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in companys" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="公积金基数" prop="accumulationFund"> |
| | | <el-input v-model="form.accumulationFund" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金个人比例" prop="accumulationFundPersonal"> |
| | | <el-input v-model="form.accumulationFundPersonal" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="公积金公司比例" prop="accumulationFundCompany"> |
| | | <el-input v-model="form.accumulationFundCompany" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="养老险基数" prop="retirementInsurance"> |
| | | <el-input v-model="form.retirementInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金个人比例" prop="retirementInsurancePersonal"> |
| | | <el-input v-model="form.retirementInsurancePersonal" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="公积金公司比例" prop="retirementInsuranceCompany"> |
| | | <el-input v-model="form.retirementInsuranceCompany" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险基数" prop="medicalInsurance"> |
| | | <el-input v-model="form.medicalInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险个人比例" prop="medicalInsurancePersonal"> |
| | | <el-input v-model="form.medicalInsurancePersonal" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险公司比例" prop="medicalInsuranceCompany"> |
| | | <el-input v-model="form.medicalInsuranceCompany" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="失业险基数" prop="unemploymentInsurance"> |
| | | <el-input v-model="form.unemploymentInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="失业险个人比例" prop="unemploymentInsurancePersonal"> |
| | | <el-input v-model="form.unemploymentInsurancePersonal" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="失业险公司比例" prop="unemploymentInsuranceCompany"> |
| | | <el-input v-model="form.unemploymentInsuranceCompany" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="生育险基数" prop="birthInsurance"> |
| | | <el-input v-model="form.birthInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="生育险个人比例" prop="birthInsurancePersonal"> |
| | | <el-input v-model="form.birthInsurancePersonal" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="生育险公司比例" prop="birthInsuranceCompany"> |
| | | <el-input v-model="form.birthInsuranceCompany" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险基数" prop="employmentInsurance"> |
| | | <el-input v-model="form.employmentInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险个人比例" prop="employmentInsurancePersonal"> |
| | | <el-input v-model="form.employmentInsurancePersonal" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险公司比例" prop="employmentInsuranceCompany"> |
| | | <el-input v-model="form.employmentInsuranceCompany" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </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 prop="companyId" label="公司" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.company.label }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="accumulationFund" label="公积金基数" /> |
| | | <el-table-column prop="accumulationFundPersonal" label="公积金个人比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.accumulationFundPersonal }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="accumulationFundCompany" label="公积金公司比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.accumulationFundCompany }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="retirementInsurance" label="养老险基数" /> |
| | | <el-table-column prop="retirementInsurancePersonal" label="公积金个人比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.retirementInsurancePersonal }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="retirementInsuranceCompany" label="公积金公司比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.retirementInsuranceCompany }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="medicalInsurance" label="医疗险基数" /> |
| | | <el-table-column prop="medicalInsurancePersonal" label="医疗险个人比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.medicalInsurancePersonal }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="medicalInsuranceCompany" label="医疗险公司比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.medicalInsuranceCompany }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unemploymentInsurance" label="失业险基数" /> |
| | | <el-table-column prop="unemploymentInsurancePersonal" label="失业险个人比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.unemploymentInsurancePersonal }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unemploymentInsuranceCompany" label="失业险公司比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.unemploymentInsuranceCompany }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="birthInsurance" label="生育险基数" /> |
| | | <el-table-column prop="birthInsurancePersonal" label="生育险个人比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.birthInsurancePersonal }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="birthInsuranceCompany" label="生育险公司比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.birthInsuranceCompany }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="employmentInsurance" label="工伤险基数" /> |
| | | <el-table-column prop="employmentInsurancePersonal" label="工伤险个人比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.employmentInsurancePersonal }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="employmentInsuranceCompany" label="工伤险公司比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.employmentInsuranceCompany }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','cmnInsurance:edit','cmnInsurance: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 crudCmnInsurance from '@/api/treatment/cmnInsurance' |
| | | 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 crudSysCompany from '@/api/system/sysCompany' |
| | | |
| | | const defaultForm = { id: null, company: { id: null }, accumulationFund: null, accumulationFundPersonal: null, accumulationFundCompany: null, retirementInsurance: null, retirementInsurancePersonal: null, retirementInsuranceCompany: null, medicalInsurance: null, medicalInsurancePersonal: null, medicalInsuranceCompany: null, unemploymentInsurance: null, unemploymentInsurancePersonal: null, unemploymentInsuranceCompany: null, birthInsurance: null, birthInsurancePersonal: null, birthInsuranceCompany: null, employmentInsurance: null, employmentInsurancePersonal: null, employmentInsuranceCompany: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'CmnInsurance', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '五险一金', url: 'api/cmnInsurance', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCmnInsurance }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'cmnInsurance:add'], |
| | | edit: ['admin', 'cmnInsurance:edit'], |
| | | del: ['admin', 'cmnInsurance:del'], |
| | | download: ['admin', 'cmnInsurance:list'] |
| | | }, |
| | | rules: { |
| | | 'company.id': [ |
| | | { required: true, message: '公司不能为空', trigger: 'blur' } |
| | | ], |
| | | accumulationFund: [ |
| | | { required: true, message: '公积金基数不能为空', trigger: 'blur' } |
| | | ], |
| | | accumulationFundPersonal: [ |
| | | { required: true, message: '公积金个人比例不能为空', trigger: 'blur' } |
| | | ], |
| | | accumulationFundCompany: [ |
| | | { required: true, message: '公积金公司比例不能为空', trigger: 'blur' } |
| | | ], |
| | | retirementInsurance: [ |
| | | { required: true, message: '养老险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | retirementInsurancePersonal: [ |
| | | { required: true, message: '公积金个人比例不能为空', trigger: 'blur' } |
| | | ], |
| | | retirementInsuranceCompany: [ |
| | | { required: true, message: '公积金公司比例不能为空', trigger: 'blur' } |
| | | ], |
| | | medicalInsurance: [ |
| | | { required: true, message: '医疗险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | medicalInsurancePersonal: [ |
| | | { required: true, message: '医疗险个人比例不能为空', trigger: 'blur' } |
| | | ], |
| | | medicalInsuranceCompany: [ |
| | | { required: true, message: '医疗险公司比例不能为空', trigger: 'blur' } |
| | | ], |
| | | unemploymentInsurance: [ |
| | | { required: true, message: '失业险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | unemploymentInsurancePersonal: [ |
| | | { required: true, message: '失业险个人比例不能为空', trigger: 'blur' } |
| | | ], |
| | | unemploymentInsuranceCompany: [ |
| | | { required: true, message: '失业险公司比例不能为空', trigger: 'blur' } |
| | | ], |
| | | birthInsurance: [ |
| | | { required: true, message: '生育险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | birthInsurancePersonal: [ |
| | | { required: true, message: '生育险个人比例不能为空', trigger: 'blur' } |
| | | ], |
| | | birthInsuranceCompany: [ |
| | | { required: true, message: '生育险公司比例不能为空', trigger: 'blur' } |
| | | ], |
| | | employmentInsurance: [ |
| | | { required: true, message: '工伤险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | employmentInsurancePersonal: [ |
| | | { required: true, message: '工伤险个人比例不能为空', trigger: 'blur' } |
| | | ], |
| | | employmentInsuranceCompany: [ |
| | | { required: true, message: '工伤险公司比例不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'companyId', display_name: '公司' } |
| | | ], |
| | | // 公司 |
| | | companys: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getAllCompany() |
| | | return true |
| | | }, |
| | | // 获取所有公司 |
| | | getAllCompany() { |
| | | crudSysCompany.getAll().then(res => { |
| | | this.companys = res |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.jobId" filterable clearable placeholder="岗位" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in jobs" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-input v-model="query.name" clearable placeholder="名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <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="job.id"> |
| | | <el-select v-model="form.job.id" filterable clearable placeholder="岗位" :disabled="crud.status.edit === 1" style="width: 370px;" @change="changeJob"> |
| | | <el-option |
| | | v-for="item in jobs" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="级别基本工资" prop="basicWage"> |
| | | <el-input v-model="form.basicWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="级别浮动工资" prop="rankWage"> |
| | | <el-input v-model="form.rankWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="绩效工资" prop="performanceWage"> |
| | | <el-input v-model="form.performanceWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="描述"> |
| | | <el-input v-model="form.description" :autosize="{ minRows: 2, maxRows: 5}" type="textarea" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="子级别"> |
| | | <el-switch |
| | | v-model="form.hasChild" |
| | | active-text="存在子级别" |
| | | inactive-text="不存在子级别" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.hasChild" label="级别阶梯"> |
| | | <el-input-number v-model="form.step" :min="100" :step="100" step-strictly /> |
| | | <el-button style="margin-left:5px" type="success" round size="mini" @click="calcByStep">计算</el-button> |
| | | </el-form-item> |
| | | <el-divider v-if="form.hasChild" style="margin-top:10px"><b>级别阶梯详细</b></el-divider> |
| | | <el-form-item v-if="form.hasChild" label-width="0px"> |
| | | <el-table ref="miniTable" :data="form.cmnLevelRankList" size="small" style="width: 100%;"> |
| | | <el-table-column prop="basicWage" label="级别基本工资" width="100" fixed="left"> |
| | | <template> |
| | | <el-tag>{{ form.basicWage }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="rankWage" label="级别浮动工资" width="160" fixed="left"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.minRankWage }} ~ {{ scope.row.maxRankWage }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="performanceWage" label="绩效工资" width="100" fixed="left"> |
| | | <template> |
| | | <el-tag>{{ form.performanceWage }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="performanceCoefficient" label="绩效系数" /> |
| | | </el-table> |
| | | </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" fixed="left" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="jobName" label="岗位名称" width="100" fixed="left"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.job.name }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="名称" /> |
| | | <el-table-column prop="basicWage" label="级别基本工资" /> |
| | | <el-table-column prop="rankWage" label="级别浮动工资" /> |
| | | <el-table-column prop="performanceWage" label="绩效工资" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="description" label="描述" /> |
| | | <el-table-column v-if="checkPer(['admin','cmnLevel:edit','cmnLevel: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 crudCmnLevel from '@/api/treatment/cmnLevel' |
| | | 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 crudJob from '@/api/system/job' |
| | | |
| | | const defaultForm = { id: null, job: { id: null }, name: null, basicWage: null, rankWage: null, performanceWage: null, description: null, hasChild: false, step: null, cmnLevelRankList: [] } |
| | | export default { |
| | | name: 'CmnLevel', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '级别定义', url: 'api/cmnLevel', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCmnLevel }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'cmnLevel:add'], |
| | | edit: ['admin', 'cmnLevel:edit'], |
| | | del: ['admin', 'cmnLevel:del'], |
| | | download: ['admin', 'cmnLevel:download'] |
| | | }, |
| | | rules: { |
| | | 'job.id': [ |
| | | { required: true, message: '岗位不能为空', trigger: 'blur' } |
| | | ], |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' } |
| | | ], |
| | | basicWage: [ |
| | | { required: true, message: '级别基本工资不能为空', trigger: 'blur' } |
| | | ], |
| | | rankWage: [ |
| | | { required: true, message: '级别浮动工资不能为空', trigger: 'blur' } |
| | | ], |
| | | performanceWage: [ |
| | | { required: true, message: '绩效工资不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'jobId', display_name: '岗位' }, |
| | | { key: 'name', display_name: '名称' } |
| | | ], |
| | | // 岗位列表 |
| | | jobs: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取所有岗位 |
| | | this.getAllJob() |
| | | return true |
| | | }, |
| | | // 钩子: 在新增前执行 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | this.form.hasChild = this.form.cmnLevelRankList.length !== 0 |
| | | }, |
| | | // 获取所有岗位 |
| | | getAllJob() { |
| | | // 获取所有岗位 |
| | | crudJob.getAll().then(res => { |
| | | // 岗位列表 |
| | | this.jobs = res |
| | | }).catch(() => { |
| | | |
| | | }) |
| | | }, |
| | | // 岗位变更 |
| | | changeJob() { |
| | | this.form.name = null |
| | | }, |
| | | // 计算级别阶梯详细 |
| | | calcByStep() { |
| | | this.$refs['form'].validate((valid) => { |
| | | if (valid) { |
| | | this.form.cmnLevelRankList = [] |
| | | let totalCnt = this.form.rankWage |
| | | while (totalCnt > 0) { |
| | | const performanceCoefficient = (parseInt(this.form.basicWage) + parseInt(totalCnt) + parseInt(this.form.performanceWage)) / this.form.job.performanceUnitWage |
| | | this.form.cmnLevelRankList.push({ minRankWage: totalCnt - this.form.step, maxRankWage: totalCnt, performanceCoefficient: performanceCoefficient.toFixed(2) }) |
| | | // TODO performanceCoefficient 不需要在这里算出 |
| | | totalCnt = totalCnt - this.form.step |
| | | } |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.jobId" filterable clearable placeholder="岗位" style="width: 185px;" class="filter-item" @change="getLevels(query.jobId)"> |
| | | <el-option |
| | | v-for="item in jobs" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.levelId" filterable clearable placeholder="级别" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in levels" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-input v-model="query.name" clearable placeholder="名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <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="jobId"> |
| | | <el-select v-model="form.level.job.id" filterable clearable placeholder="岗位" style="width: 370px;" class="filter-item" @change="getLevelsUpd(form.level.job.id)"> |
| | | <el-option |
| | | v-for="item in jobs" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="级别" prop="levelId"> |
| | | <el-select v-model="form.level.id" filterable clearable placeholder="级别" style="width: 370px;" class="filter-item"> |
| | | <el-option |
| | | v-for="item in levelsUpd" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="描述"> |
| | | <el-input v-model="form.description" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="基本工资" prop="basicWage"> |
| | | <el-input v-model="form.basicWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="绩效工资" prop="performanceWage"> |
| | | <el-input v-model="form.performanceWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="最小等级工资" prop="minRankWage"> |
| | | <el-input v-model="form.minRankWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="最大等级工资" prop="maxRankWage"> |
| | | <el-input v-model="form.maxRankWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="绩效系数" prop="performanceCoefficient"> |
| | | <el-input v-model="form.performanceCoefficient" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" 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="jobName" label="岗位名称" width="100" fixed="left"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.level.job.name }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="levelName" label="级别名称" width="100" fixed="left"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.level.name }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="等级名称" /> |
| | | <el-table-column prop="description" label="描述" /> |
| | | <el-table-column prop="basicWage" label="基本工资" /> |
| | | <el-table-column prop="performanceWage" label="绩效工资" /> |
| | | <el-table-column prop="minRankWage" label="最小等级工资" /> |
| | | <el-table-column prop="maxRankWage" label="最大等级工资" /> |
| | | <el-table-column prop="performanceCoefficient" label="绩效系数" /> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | | <el-table-column v-if="checkPer(['admin','cmnLevelRank:edit','cmnLevelRank: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 crudCmnLevelRank from '@/api/treatment/cmnLevelRank' |
| | | 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 crudJob from '@/api/system/job' |
| | | import crudCmnLevel from '@/api/treatment/cmnLevel' |
| | | |
| | | const defaultForm = { id: null, level: { job: { id: null }}, name: null, description: null, basicWage: null, performanceWage: null, minRankWage: null, maxRankWage: null, performanceCoefficient: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'CmnLevelRank', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '级别等级定义', url: 'api/cmnLevelRank', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCmnLevelRank }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'cmnLevelRank:add'], |
| | | edit: ['admin', 'cmnLevelRank:edit'], |
| | | del: ['admin', 'cmnLevelRank:del'], |
| | | download: ['admin', 'cmnLevelRank:list'] |
| | | }, |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' } |
| | | ], |
| | | basicWage: [ |
| | | { required: true, message: '基本工资不能为空', trigger: 'blur' } |
| | | ], |
| | | performanceWage: [ |
| | | { required: true, message: '绩效工资不能为空', trigger: 'blur' } |
| | | ], |
| | | minRankWage: [ |
| | | { required: true, message: '最小等级工资不能为空', trigger: 'blur' } |
| | | ], |
| | | maxRankWage: [ |
| | | { required: true, message: '最大等级工资不能为空', trigger: 'blur' } |
| | | ], |
| | | performanceCoefficient: [ |
| | | { required: true, message: '绩效系数不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | // 岗位列表 |
| | | jobs: [], |
| | | // 级别列表 |
| | | levels: [], |
| | | levelsUpd: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getAllJob() |
| | | return true |
| | | }, |
| | | // 获取所有岗位 |
| | | getAllJob() { |
| | | // 获取所有岗位 |
| | | crudJob.getAll().then(res => { |
| | | // 岗位列表 |
| | | this.jobs = res |
| | | }).catch(() => { |
| | | this.jobs = [] |
| | | }) |
| | | }, |
| | | // 获取岗位对应的级别 |
| | | getLevels(jobId) { |
| | | // 获取岗位对应的级别 |
| | | crudCmnLevel.getAll({ jobId: jobId }).then(res => { |
| | | // 岗位列表 |
| | | this.levels = res |
| | | }).catch(() => { |
| | | this.levels = [] |
| | | }) |
| | | }, |
| | | // 获取岗位对应的级别 |
| | | getLevelsUpd(jobId) { |
| | | // 获取岗位对应的级别 |
| | | crudCmnLevel.getAll({ jobId: jobId }).then(res => { |
| | | // 岗位列表 |
| | | this.levelsUpd = res |
| | | }).catch(() => { |
| | | this.levelsUpd = [] |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <label class="el-form-item-label">员工</label> |
| | | <el-select v-model="query.userId" filterable clearable placeholder="请选择员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <label class="el-form-item-label">年月</label> |
| | | <el-date-picker v-model="query.yearMonth" clearable type="month" format="yyyy 年 MM 月" placeholder="请选择年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.generate" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-plus" |
| | | style="margin-right: 6px;" |
| | | @click="openGenerate" |
| | | >生成</el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <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="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择员工" style="width: 340px;" @change="changeUser"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | > |
| | | <span style="float: left">{{ item.nickName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.company.label }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | <el-button icon="el-icon-refresh" plain circle @click="loadCmnInsurance" /> |
| | | </el-form-item> |
| | | <el-form-item label="年月" prop="yearMonth"> |
| | | <el-date-picker v-model="form.yearMonth" value-format="yyyy-MM" format="yyyy 年 MM 月" clearable type="month" placeholder="请选择年月" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金基数" prop="accumulationFund"> |
| | | <el-input v-model="form.accumulationFund" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金个人比例" prop="accumulationFundPersonal"> |
| | | <el-input v-model="form.accumulationFundPersonal" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="公积金公司比例" prop="accumulationFundCompany"> |
| | | <el-input v-model="form.accumulationFundCompany" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="养老险基数" prop="retirementInsurance"> |
| | | <el-input v-model="form.retirementInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金个人比例" prop="retirementInsurancePersonal"> |
| | | <el-input v-model="form.retirementInsurancePersonal" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="公积金公司比例" prop="retirementInsuranceCompany"> |
| | | <el-input v-model="form.retirementInsuranceCompany" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险基数" prop="medicalInsurance"> |
| | | <el-input v-model="form.medicalInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险个人比例" prop="medicalInsurancePersonal"> |
| | | <el-input v-model="form.medicalInsurancePersonal" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险公司比例" prop="medicalInsuranceCompany"> |
| | | <el-input v-model="form.medicalInsuranceCompany" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="失业险基数" prop="unemploymentInsurance"> |
| | | <el-input v-model="form.unemploymentInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="失业险个人比例" prop="unemploymentInsurancePersonal"> |
| | | <el-input v-model="form.unemploymentInsurancePersonal" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="失业险公司比例" prop="unemploymentInsuranceCompany"> |
| | | <el-input v-model="form.unemploymentInsuranceCompany" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="生育险基数" prop="birthInsurance"> |
| | | <el-input v-model="form.birthInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="生育险个人比例" prop="birthInsurancePersonal"> |
| | | <el-input v-model="form.birthInsurancePersonal" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="生育险公司比例" prop="birthInsuranceCompany"> |
| | | <el-input v-model="form.birthInsuranceCompany" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险基数" prop="employmentInsurance"> |
| | | <el-input v-model="form.employmentInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险个人比例" prop="employmentInsurancePersonal"> |
| | | <el-input v-model="form.employmentInsurancePersonal" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险公司比例" prop="employmentInsuranceCompany"> |
| | | <el-input v-model="form.employmentInsuranceCompany" style="width: 370px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </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 prop="nickName" label="员工" /> |
| | | <el-table-column prop="yearMonth" label="年月" /> |
| | | <el-table-column prop="accumulationFund" label="公积金基数" /> |
| | | <el-table-column prop="accumulationFundPersonal" label="公积金个人比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.accumulationFundPersonal }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="accumulationFundCompany" label="公积金公司比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.accumulationFundCompany }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="retirementInsurance" label="养老险基数" /> |
| | | <el-table-column prop="retirementInsurancePersonal" label="公积金个人比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.retirementInsurancePersonal }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="retirementInsuranceCompany" label="公积金公司比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.retirementInsuranceCompany }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="medicalInsurance" label="医疗险基数" /> |
| | | <el-table-column prop="medicalInsurancePersonal" label="医疗险个人比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.medicalInsurancePersonal }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="medicalInsuranceCompany" label="医疗险公司比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.medicalInsuranceCompany }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unemploymentInsurance" label="失业险基数" /> |
| | | <el-table-column prop="unemploymentInsurancePersonal" label="失业险个人比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.unemploymentInsurancePersonal }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unemploymentInsuranceCompany" label="失业险公司比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.unemploymentInsuranceCompany }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="birthInsurance" label="生育险基数" /> |
| | | <el-table-column prop="birthInsurancePersonal" label="生育险个人比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.birthInsurancePersonal }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="birthInsuranceCompany" label="生育险公司比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.birthInsuranceCompany }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="employmentInsurance" label="工伤险基数" /> |
| | | <el-table-column prop="employmentInsurancePersonal" label="工伤险个人比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.employmentInsurancePersonal }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="employmentInsuranceCompany" label="工伤险公司比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.employmentInsuranceCompany }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','userInsurance:edit','userInsurance:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="closeGenerate" :visible.sync="generateStatus" title="生成五险一金" width="500px"> |
| | | <el-form ref="generateForm" :model="generateForm" :rules="generateRules" size="small" label-width="80px"> |
| | | <el-form-item label="工资年月" prop="targetYearMonth"> |
| | | <el-date-picker |
| | | v-model="generateForm.targetYearMonth" |
| | | value-format="yyyy-MM" |
| | | format="yyyy 年 MM 月" |
| | | type="month" |
| | | style="width: 370px;" |
| | | placeholder="工资年月" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="员工" prop="userId"> |
| | | <el-tree |
| | | ref="tree" |
| | | :data="deptDatas" |
| | | :props="props" |
| | | :load="getDeptDatas" |
| | | lazy |
| | | :default-expanded-keys="[]" |
| | | show-checkbox |
| | | node-key="id" |
| | | @check="handleCheckChange" |
| | | /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="closeGenerate">取消</el-button> |
| | | <el-button :loading="generateLoading" type="primary" @click="submitGenerate">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudUserInsurance from '@/api/treatment/userInsurance' |
| | | import crudCmnInsurance from '@/api/treatment/cmnInsurance' |
| | | 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 crudUser from '@/api/system/user' |
| | | import { getDepts } from '@/api/system/dept' |
| | | |
| | | const defaultForm = { id: null, userId: null, yearMonth: null, accumulationFund: null, accumulationFundPersonal: null, accumulationFundCompany: null, retirementInsurance: null, retirementInsurancePersonal: null, retirementInsuranceCompany: null, medicalInsurance: null, medicalInsurancePersonal: null, medicalInsuranceCompany: null, unemploymentInsurance: null, unemploymentInsurancePersonal: null, unemploymentInsuranceCompany: null, birthInsurance: null, birthInsurancePersonal: null, birthInsuranceCompany: null, employmentInsurance: null, employmentInsurancePersonal: null, employmentInsuranceCompany: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'UserInsurance', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '员工五险一金', url: 'api/userInsurance', idField: 'id', sort: 'id,desc', crudMethod: { ...crudUserInsurance }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin'], |
| | | edit: ['admin', 'userInsurance:edit'], |
| | | del: ['admin', 'userInsurance:del'], |
| | | download: ['admin', 'userInsurance:list'], |
| | | generate: ['admin', 'userInsurance:generate'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: '员工不能为空', trigger: 'blur' } |
| | | ], |
| | | yearMonth: [ |
| | | { required: true, message: '年月不能为空', trigger: 'blur' } |
| | | ], |
| | | accumulationFund: [ |
| | | { required: true, message: '公积金基数不能为空', trigger: 'blur' } |
| | | ], |
| | | accumulationFundPersonal: [ |
| | | { required: true, message: '公积金个人缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | accumulationFundCompany: [ |
| | | { required: true, message: '公积金公司缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | retirementInsurance: [ |
| | | { required: true, message: '养老险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | retirementInsurancePersonal: [ |
| | | { required: true, message: '养老险个人缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | retirementInsuranceCompany: [ |
| | | { required: true, message: '养老险公司缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | medicalInsurance: [ |
| | | { required: true, message: '医疗险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | medicalInsurancePersonal: [ |
| | | { required: true, message: '医疗险个人缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | medicalInsuranceCompany: [ |
| | | { required: true, message: '医疗险公司缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | unemploymentInsurance: [ |
| | | { required: true, message: '失业险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | unemploymentInsurancePersonal: [ |
| | | { required: true, message: '失业险个人缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | unemploymentInsuranceCompany: [ |
| | | { required: true, message: '失业险公司缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | birthInsurance: [ |
| | | { required: true, message: '生育险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | birthInsurancePersonal: [ |
| | | { required: true, message: '生育险个人缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | birthInsuranceCompany: [ |
| | | { required: true, message: '生育险公司缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | employmentInsurance: [ |
| | | { required: true, message: '工伤险基数不能为空', trigger: 'blur' } |
| | | ], |
| | | employmentInsurancePersonal: [ |
| | | { required: true, message: '工伤险个人缴纳比例不能为空', trigger: 'blur' } |
| | | ], |
| | | employmentInsuranceCompany: [ |
| | | { required: true, message: '工伤险公司缴纳比例不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'userId', display_name: '员工' }, |
| | | { key: 'yearMonth', display_name: '年月' } |
| | | ], |
| | | // 员工 |
| | | users: [], |
| | | // 生成表单状态 |
| | | generateStatus: false, |
| | | // 生成表单加载 |
| | | generateLoading: false, |
| | | // 生成表单数据 |
| | | generateForm: { targetYearMonth: null, nodes: [] }, |
| | | // 生成表单验证 |
| | | generateRules: { |
| | | targetYearMonth: [ |
| | | { required: true, message: '工资年月不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | props: { |
| | | children: 'children', label: 'label', isLeaf: 'leaf' |
| | | }, |
| | | deptDatas: [] |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.getAllUser() |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | return true |
| | | }, |
| | | // 获取全部员工 |
| | | getAllUser() { |
| | | // 用户 |
| | | crudUser.getAll({ enabled: true }).then(res => { |
| | | this.users = res |
| | | }) |
| | | }, |
| | | // 变更员工 |
| | | changeUser(userId) { |
| | | this.form.company = null |
| | | this.users.forEach(user => { |
| | | if (user.id === userId) { |
| | | this.form.company = user.company |
| | | } |
| | | }) |
| | | }, |
| | | // 生成表单打开 |
| | | openGenerate() { |
| | | // 生成表单数据 |
| | | this.generateForm = { targetYearMonth: null, nodes: [] } |
| | | // 生成表单状态 |
| | | this.generateStatus = true |
| | | }, |
| | | // 生成表单关闭 |
| | | closeGenerate() { |
| | | // 生成表单状态 |
| | | this.generateStatus = false |
| | | this.getDeptDatas({ level: 0 }) |
| | | // 清空表单 |
| | | this.$refs['generateForm'].clearValidate() |
| | | }, |
| | | // 生成表单提交 |
| | | submitGenerate() { |
| | | // 生成表单加载 |
| | | this.generateLoading = true |
| | | // 表单验证 |
| | | this.$refs['generateForm'].validate((valid) => { |
| | | if (valid) { |
| | | // 生成工资 |
| | | crudUserInsurance.generate(this.generateForm).then(res => { |
| | | // 生成表单加载 |
| | | this.generateLoading = false |
| | | // 生成表单关闭 |
| | | this.closeGenerate() |
| | | // 搜索:刷新表格 |
| | | this.crud.toQuery() |
| | | // 消息提示 |
| | | this.crud.notify('生成成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | }).catch(() => { |
| | | // 生成表单加载 |
| | | this.generateLoading = false |
| | | }) |
| | | } else { |
| | | // 生成表单加载 |
| | | this.generateLoading = false |
| | | } |
| | | }) |
| | | }, |
| | | // 加载企业五险一金 |
| | | loadCmnInsurance() { |
| | | if (this.form.company === undefined || this.form.company === null) { |
| | | return false |
| | | } |
| | | crudCmnInsurance.getAll({ companyId: this.form.company.id }).then(res => { |
| | | // 公积金基数 |
| | | if (this.form.accumulationFund === null || this.form.accumulationFund < res[0].accumulationFund) { |
| | | this.form.accumulationFund = res[0].accumulationFund |
| | | } |
| | | // 公积金个人比例 |
| | | if (this.form.accumulationFundPersonal === null || this.form.accumulationFundPersonal < res[0].accumulationFundPersonal) { |
| | | this.form.accumulationFundPersonal = res[0].accumulationFundPersonal |
| | | } |
| | | // 公积金公司比例 |
| | | if (this.form.accumulationFundCompany === null || this.form.accumulationFundCompany < res[0].accumulationFundCompany) { |
| | | this.form.accumulationFundCompany = res[0].accumulationFundCompany |
| | | } |
| | | // 养老保险基数 |
| | | if (this.form.retirementInsurance === null || this.form.retirementInsurance < res[0].retirementInsurance) { |
| | | this.form.retirementInsurance = res[0].retirementInsurance |
| | | } |
| | | // 养老保险个人比例 |
| | | if (this.form.retirementInsurancePersonal === null || this.form.retirementInsurancePersonal < res[0].retirementInsurancePersonal) { |
| | | this.form.retirementInsurancePersonal = res[0].retirementInsurancePersonal |
| | | } |
| | | // 养老保险公司比例 |
| | | if (this.form.retirementInsuranceCompany === null || this.form.retirementInsuranceCompany < res[0].retirementInsuranceCompany) { |
| | | this.form.retirementInsuranceCompany = res[0].retirementInsuranceCompany |
| | | } |
| | | // 医疗保险基数 |
| | | if (this.form.medicalInsurance === null || this.form.medicalInsurance < res[0].medicalInsurance) { |
| | | this.form.medicalInsurance = res[0].medicalInsurance |
| | | } |
| | | // 医疗保险个人比例 |
| | | if (this.form.medicalInsurancePersonal === null || this.form.medicalInsurancePersonal < res[0].medicalInsurancePersonal) { |
| | | this.form.medicalInsurancePersonal = res[0].medicalInsurancePersonal |
| | | } |
| | | // 医疗保险公司比例 |
| | | if (this.form.medicalInsuranceCompany === null || this.form.medicalInsuranceCompany < res[0].medicalInsuranceCompany) { |
| | | this.form.medicalInsuranceCompany = res[0].medicalInsuranceCompany |
| | | } |
| | | // 失业保险基数 |
| | | if (this.form.unemploymentInsurance === null || this.form.unemploymentInsurance < res[0].unemploymentInsurance) { |
| | | this.form.unemploymentInsurance = res[0].unemploymentInsurance |
| | | } |
| | | // 失业保险个人比例 |
| | | if (this.form.unemploymentInsurancePersonal === null || this.form.unemploymentInsurancePersonal < res[0].unemploymentInsurancePersonal) { |
| | | this.form.unemploymentInsurancePersonal = res[0].unemploymentInsurancePersonal |
| | | } |
| | | // 失业保险公司比例 |
| | | if (this.form.unemploymentInsuranceCompany === null || this.form.unemploymentInsuranceCompany < res[0].unemploymentInsuranceCompany) { |
| | | this.form.unemploymentInsuranceCompany = res[0].unemploymentInsuranceCompany |
| | | } |
| | | // 生育保险基数 |
| | | if (this.form.birthInsurance === null || this.form.birthInsurance < res[0].birthInsurance) { |
| | | this.form.birthInsurance = res[0].birthInsurance |
| | | } |
| | | // 生育保险个人比例 |
| | | if (this.form.birthInsurancePersonal === null || this.form.birthInsurancePersonal < res[0].birthInsurancePersonal) { |
| | | this.form.birthInsurancePersonal = res[0].birthInsurancePersonal |
| | | } |
| | | // 生育保险公司比例 |
| | | if (this.form.birthInsuranceCompany === null || this.form.birthInsuranceCompany < res[0].birthInsuranceCompany) { |
| | | this.form.birthInsuranceCompany = res[0].birthInsuranceCompany |
| | | } |
| | | // 工伤保险基数 |
| | | if (this.form.employmentInsurance === null || this.form.employmentInsurance < res[0].employmentInsurance) { |
| | | this.form.employmentInsurance = res[0].employmentInsurance |
| | | } |
| | | // 工伤保险个人比例 |
| | | if (this.form.employmentInsurancePersonal === null || this.form.employmentInsurancePersonal < res[0].employmentInsurancePersonal) { |
| | | this.form.employmentInsurancePersonal = res[0].employmentInsurancePersonal |
| | | } |
| | | // 工伤保险公司比例 |
| | | if (this.form.employmentInsuranceCompany === null || this.form.employmentInsuranceCompany < res[0].employmentInsuranceCompany) { |
| | | this.form.employmentInsuranceCompany = res[0].employmentInsuranceCompany |
| | | } |
| | | }) |
| | | }, |
| | | // 获取部门数据 |
| | | getDeptDatas(node, resolve) { |
| | | const sort = 'id,desc' |
| | | const params = { sort: sort } |
| | | if (node.level !== 0) { |
| | | crudUser.getByDept(node.level !== 0 ? node.data.id : null).then(res => { |
| | | if (resolve) { |
| | | resolve(res) |
| | | } else { |
| | | this.deptDatas = res.content |
| | | } |
| | | }) |
| | | } else { |
| | | getDepts(params).then(res => { |
| | | if (resolve) { |
| | | resolve(res.content) |
| | | } else { |
| | | this.deptDatas = res.content |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | handleCheckChange(data, status) { |
| | | this.generateForm.nodes = status.checkedNodes |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <label class="el-form-item-label">员工</label> |
| | | <el-select v-model="query.userId" filterable clearable placeholder="请选择员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <label class="el-form-item-label">年月</label> |
| | | <el-date-picker v-model="query.yearMonth" clearable type="month" value-format="yyyy-MM" format="yyyy 年 MM 月" placeholder="请选择年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.generate" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-plus" |
| | | style="margin-right: 6px;" |
| | | @click="openGenerate" |
| | | >生成</el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <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="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择员工" :disabled="crud.status.add == 0" style="width: 370px;" @change="changeUserId"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | > |
| | | <span style="float: left">{{ item.nickName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.company.label }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="年月" prop="yearMonth"> |
| | | <el-date-picker v-model="form.yearMonth" value-format="yyyy-MM" format="yyyy 年 MM 月" :disabled="crud.status.add == 0" clearable type="month" placeholder="请选择年月" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="级别" prop="level"> |
| | | <el-select v-model="form.level" filterable clearable placeholder="请选择级别" style="width: 370px;" @change="changeLevelId"> |
| | | <el-option |
| | | v-for="item in levels" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="级别基本工资" prop="basicWage"> |
| | | <el-input v-model="form.basicWage" style="width: 370px;" :disabled="true" /> |
| | | </el-form-item> |
| | | <el-form-item label="绩效工资" prop="performanceWage"> |
| | | <el-input v-model="form.performanceWage" style="width: 370px;" :disabled="true" /> |
| | | </el-form-item> |
| | | <el-form-item label="等级" prop="rank"> |
| | | <el-select v-model="form.rank" filterable clearable placeholder="请选择等级" style="width: 370px;" @change="changeRankId"> |
| | | <el-option |
| | | v-for="(item, index) in ranks" |
| | | :key="item.id" |
| | | :label="ranks.length - index + '级(' + item.minRankWage + '~' + item.maxRankWage + ')'" |
| | | :value="item.id" |
| | | > |
| | | <span style="float: left">{{ ranks.length - index + '级' }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.minRankWage }} ~ {{ item.maxRankWage }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="级别等级工资" prop="rankWage"> |
| | | <el-slider |
| | | v-model="form.rankWage" |
| | | style="width: 370px;" |
| | | :min="form.minRankWage" |
| | | :max="form.maxRankWage" |
| | | show-tooltip |
| | | show-stops |
| | | :step="100" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" 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 prop="nickName" label="员工" /> |
| | | <el-table-column prop="yearMonth" label="年月" /> |
| | | <el-table-column prop="basicWage" label="级别基本工资" /> |
| | | <el-table-column prop="rankWage" label="级别等级工资" /> |
| | | <el-table-column prop="performanceWage" label="绩效工资" /> |
| | | <el-table-column prop="performanceCoefficient" label="绩效系数" /> |
| | | <el-table-column prop="locked" label="锁定状态" /> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | | <el-table-column v-if="checkPer(['admin','userLevelWage:edit','userLevelWage:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="closeGenerate" :visible.sync="generateStatus" title="生成工资信息" width="720px"> |
| | | <el-form ref="generateForm" size="small" label-width="80px"> |
| | | <upload-excel-component :on-success="handleSuccess" :before-upload="beforeUpload" /> |
| | | <el-table :data="generateForm" border highlight-current-row style="width: 100%;margin-top:20px;"> |
| | | <el-table-column v-for="item of tableHeader" :key="item.id" :prop="item.id" :label="item.name" /> |
| | | </el-table> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="closeGenerate">取消</el-button> |
| | | <el-button :loading="generateLoading" type="primary" :disabled="uploading" @click="submitGenerate">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudUserLevelWage from '@/api/treatment/userLevelWage' |
| | | import crudCmnLevel from '@/api/treatment/cmnLevel' |
| | | 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 crudUser from '@/api/system/user' |
| | | import UploadExcelComponent from '@/components/UploadExcel/index.vue' |
| | | |
| | | const defaultForm = { id: null, userId: null, yearMonth: null, level: null, rank: null, basicWage: null, rankWage: null, performanceWage: null, locked: 0, remarks: null } |
| | | export default { |
| | | name: 'UserLevelWage', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, UploadExcelComponent }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '个人级别工资', url: 'api/userLevelWage', idField: 'id', sort: 'id,desc', crudMethod: { ...crudUserLevelWage }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'userLevelWage:add'], |
| | | edit: ['admin', 'userLevelWage:edit'], |
| | | del: ['admin', 'userLevelWage:del'], |
| | | download: ['admin', 'userLevelWage:list'], |
| | | generate: ['admin', 'userLevelWage:add'] |
| | | }, |
| | | generateForm: [], |
| | | tableHeader: [], |
| | | rules: { |
| | | yearMonth: [ |
| | | { required: true, message: '年月不能为空', trigger: 'blur' } |
| | | ], |
| | | level: [ |
| | | { required: true, message: '级别不能为空', trigger: 'blur' } |
| | | ], |
| | | rank: [ |
| | | { required: true, message: '等级不能为空', trigger: 'blur' } |
| | | ], |
| | | basicWage: [ |
| | | { required: true, message: '级别基本工资不能为空', trigger: 'blur' } |
| | | ], |
| | | rankWage: [ |
| | | { required: true, message: '级别等级工资不能为空', trigger: 'blur' } |
| | | ], |
| | | performanceWage: [ |
| | | { required: true, message: '绩效工资不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'userId', display_name: '员工' }, |
| | | { key: 'yearMonth', display_name: '年月' } |
| | | ], |
| | | // 员工 |
| | | users: [], |
| | | // 级别 |
| | | totalLevels: [], |
| | | levels: [], |
| | | // 等级 |
| | | ranks: [], |
| | | // 生成表单状态 |
| | | generateStatus: false, |
| | | // 生成表单加载 |
| | | generateLoading: false, |
| | | uploading: true |
| | | } |
| | | }, |
| | | watch: { |
| | | 'form.userId'(userId) { |
| | | // this.form.level = null |
| | | if (userId === null || userId === '') { |
| | | this.levels = [] |
| | | return false |
| | | } |
| | | this.users.forEach(user => { |
| | | if (user.id === userId) { |
| | | this.levels = this.totalLevels.filter((levels) => { |
| | | return levels.job.id === user.jobs[0].id |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | 'form.level'(levelId) { |
| | | // this.form.rank = null |
| | | this.form.basicWage = null |
| | | this.form.performanceWage = null |
| | | if (levelId === null || levelId === '') { |
| | | this.ranks = [] |
| | | return false |
| | | } |
| | | this.levels.forEach(level => { |
| | | if (level.id === levelId) { |
| | | this.ranks = level.cmnLevelRankList |
| | | this.form.basicWage = level.basicWage |
| | | this.form.performanceWage = level.performanceWage |
| | | } |
| | | }) |
| | | }, |
| | | 'form.rank'(rankId) { |
| | | if (rankId === null || rankId === '') { |
| | | this.form.minRankWage = 0 |
| | | this.form.maxRankWage = 100 |
| | | this.form.rankWage = 0 |
| | | return false |
| | | } |
| | | this.ranks.forEach(rank => { |
| | | if (rank.id === rankId) { |
| | | this.form.minRankWage = rank.minRankWage |
| | | this.form.maxRankWage = rank.maxRankWage |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | mounted() { |
| | | // 用户 |
| | | crudUser.getAll({ enabled: true }).then(res => { |
| | | this.users = res |
| | | }) |
| | | // 获取岗位级别 |
| | | crudCmnLevel.getAll().then(res => { |
| | | this.totalLevels = res |
| | | // this.levels = res |
| | | }) |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | return true |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 初始化年月 |
| | | const today = new Date() |
| | | const yyyy = today.getFullYear() |
| | | const mm = today.getMonth() + 1 |
| | | this.form.yearMonth = '' + yyyy + '-' + (mm >= 10 ? mm : '0' + mm) |
| | | }, |
| | | // 钩子: 在修改前执行 |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | this.users.forEach(user => { |
| | | if (user.id === this.form.userId) { |
| | | this.levels = this.totalLevels.filter((level) => { |
| | | return level.job.id === user.jobs[0].id |
| | | }) |
| | | this.levels.forEach(level => { |
| | | if (level.id === this.form.level) { |
| | | this.ranks = level.cmnLevelRankList |
| | | this.form.basicWage = level.basicWage |
| | | this.form.performanceWage = level.performanceWage |
| | | } |
| | | }) |
| | | this.ranks.forEach(rank => { |
| | | if (rank.minRankWage <= this.form.rankWage && this.form.rankWage <= rank.maxRankWage) { |
| | | this.form.minRankWage = rank.minRankWage |
| | | this.form.maxRankWage = rank.maxRankWage |
| | | this.form.rank = rank.id |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | // 员工变更 |
| | | changeUserId() { |
| | | this.form.level = null |
| | | }, |
| | | // 级别变更 |
| | | changeLevelId() { |
| | | this.form.rank = null |
| | | this.form.basicWage = null |
| | | this.form.performanceWage = null |
| | | }, |
| | | // 等级变更 |
| | | changeRankId(rankId) { |
| | | this.form.rankWage = 0 |
| | | this.ranks.forEach(rank => { |
| | | if (rank.id === rankId) { |
| | | this.form.rankWage = rank.minRankWage |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | beforeUpload(file) { |
| | | const isLt1M = file.size / 1024 / 1024 < 1 |
| | | if (isLt1M) { |
| | | return true |
| | | } |
| | | |
| | | this.$message({ |
| | | message: '请不要上传大于1m的文件.', |
| | | type: 'warning' |
| | | }) |
| | | return false |
| | | }, |
| | | handleSuccess({ results, header }) { |
| | | this.uploading = false |
| | | this.generateForm = results |
| | | console.log('this.generateForm : ', results) |
| | | this.tableHeader = header |
| | | }, |
| | | |
| | | // //文件状态改变触发 |
| | | // handleChange(file) { //(file,fileList)参数 |
| | | // this.uploading = false |
| | | // this.generateForm.file = file |
| | | // }, |
| | | // //文件超出个数限制 |
| | | // handleExceed() { |
| | | // this.$message.warning("仅允许上传一个文件!") |
| | | // }, |
| | | // //移除文件 |
| | | // handleRemove() { |
| | | // this.uploading = true |
| | | // }, |
| | | |
| | | // 生成表单打开 |
| | | openGenerate() { |
| | | // 生成表单数据 |
| | | this.generateForm = [] |
| | | // 生成表单状态 |
| | | this.generateStatus = true |
| | | }, |
| | | // 生成表单关闭 |
| | | closeGenerate() { |
| | | // 生成表单状态 |
| | | this.generateStatus = false |
| | | }, |
| | | // 生成表单提交 |
| | | submitGenerate() { |
| | | if (!this.generateForm.file.size) { |
| | | this.$message.warning('请选择上传的文件') |
| | | return |
| | | } |
| | | // 生成表单加载 |
| | | this.generateLoading = true |
| | | this.uploading = true |
| | | console.log('3333333333333333333 : ', this.generateForm) |
| | | // crudUserInsurance.generate(this.generateForm).then(res => { |
| | | // // 生成表单关闭 |
| | | // this.closeGenerate() |
| | | // // 生成表单加载 |
| | | // this.generateLoading = true |
| | | // // 搜索:刷新表格 |
| | | // this.crud.toQuery() |
| | | // this.crud.notify('生成成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | // }).catch(err=>{ |
| | | // this.uploading = false |
| | | // // 生成表单加载 |
| | | // this.generateLoading = false |
| | | // }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |