From 623a3e7db701713ca34cbc50c8633487df568cdd Mon Sep 17 00:00:00 2001
From: 赵士淞 <zhaoss@yhzhg.cn>
Date: Wed, 04 Jan 2023 03:25:01 +0000
Subject: [PATCH] 工资管理
---
eladmin-web-master/src/api/system/userLevelOther.js | 10
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/repository/SalaryRepository.java | 28
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelWageRepository.java | 9
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelInsuranceServiceImpl.java | 21
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelWageController.java | 8
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/mapstruct/SalaryMapper.java | 32
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelInsuranceService.java | 7
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/SalaryQueryCriteria.java | 39 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelOtherQueryCriteria.java | 2
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysConfigHolidayQueryCriteria.java | 4
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/SalaryDto.java | 207 +++++
eladmin-web-master/src/api/salary/salary.js | 43 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/domain/Salary.java | 329 ++++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelWageServiceImpl.java | 21
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelOtherServiceImpl.java | 21
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelInsuranceRepository.java | 10
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelWageService.java | 7
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/SalaryService.java | 90 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelOtherService.java | 7
eladmin-web-master/src/api/system/userLevelWage.js | 10
eladmin-master/eladmin-system/src/main/java/me/zhengjie/utils/DateUtil.java | 130 +++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/rest/SalaryController.java | 103 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelOtherRepository.java | 9
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelInsuranceController.java | 8
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelOtherController.java | 8
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelWageQueryCriteria.java | 2
eladmin-web-master/src/api/system/userLevelInsurance.js | 10
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/impl/SalaryServiceImpl.java | 198 +++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelInsuranceQueryCriteria.java | 2
eladmin-web-master/src/views/salary/salary/index.vue | 796 +++++++++++++++++++++
30 files changed, 2,155 insertions(+), 16 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/domain/Salary.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/domain/Salary.java
new file mode 100644
index 0000000..0736e1f
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/domain/Salary.java
@@ -0,0 +1,329 @@
+/*
+* 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 me.zhengjie.base.BaseEntity;
+
+import javax.persistence.*;
+import javax.validation.constraints.*;
+import java.sql.Timestamp;
+import java.math.BigDecimal;
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author 赵士淞
+* @date 2023-01-03
+**/
+@Entity
+@Data
+@Table(name="salary")
+public class Salary 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 = "`salary_year_month`",nullable = false)
+ @NotBlank
+ @ApiModelProperty(value = "工资年月")
+ private String salaryYearMonth;
+
+ @Column(name = "`level_wage`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "级别工资")
+ private BigDecimal levelWage;
+
+ @Column(name = "`basic_wage_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "基本工资比例")
+ private Double basicWageProportion;
+
+ @Column(name = "`basic_wage`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "基本工资")
+ private BigDecimal basicWage;
+
+ @Column(name = "`full_days`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "全勤小时数")
+ private Double fullDays;
+
+ @Column(name = "`absence_days`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "缺勤小时数")
+ private Double absenceDays;
+
+ @Column(name = "`actual_basic_wage`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "实际基础工资")
+ private BigDecimal actualBasicWage;
+
+ @Column(name = "`achievements_wage_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "绩效工资比例")
+ private Double achievementsWageProportion;
+
+ @Column(name = "`achievements_wage`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "绩效工资")
+ private BigDecimal achievementsWage;
+
+ @Column(name = "`need_completed_achievements_hours`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "应完成绩效工时")
+ private Double needCompletedAchievementsHours;
+
+ @Column(name = "`already_completed_achievements_hours`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "已完成绩效工时")
+ private Double alreadyCompletedAchievementsHours;
+
+ @Column(name = "`actual_achievements_wage`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "实际绩效工资")
+ private BigDecimal actualAchievementsWage;
+
+ @Column(name = "`performance_wage_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "业绩工资比例")
+ private Double performanceWageProportion;
+
+ @Column(name = "`performance_wage`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "业绩工资")
+ private BigDecimal performanceWage;
+
+ @Column(name = "`personal_performance_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "个人业绩比例")
+ private Double personalPerformanceProportion;
+
+ @Column(name = "`need_completed_performance_hours`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "应完成业绩工时")
+ private Double needCompletedPerformanceHours;
+
+ @Column(name = "`already_completed_performance_hours`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "已完成业绩工时")
+ private Double alreadyCompletedPerformanceHours;
+
+ @Column(name = "`actual_performance_wage`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "实际业绩工资")
+ private BigDecimal actualPerformanceWage;
+
+ @Column(name = "`team_wage_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "团队工资比例")
+ private Double teamWageProportion;
+
+ @Column(name = "`team_wage`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "团队工资")
+ private BigDecimal teamWage;
+
+ @Column(name = "`actual_team_wage`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "实际团队工资")
+ private BigDecimal actualTeamWage;
+
+ @Column(name = "`accumulation_radix`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "公积金基数")
+ private BigDecimal accumulationRadix;
+
+ @Column(name = "`accumulation_personal_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "公积金个人缴纳比例")
+ private Double accumulationPersonalProportion;
+
+ @Column(name = "`accumulation_personal_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "公积金个人缴纳金额")
+ private BigDecimal accumulationPersonalAmount;
+
+ @Column(name = "`accumulation_company_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "公积金公司缴纳比例")
+ private Double accumulationCompanyProportion;
+
+ @Column(name = "`accumulation_company_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "公积金公司缴纳金额")
+ private BigDecimal accumulationCompanyAmount;
+
+ @Column(name = "`pension_radix`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "养老险基数")
+ private BigDecimal pensionRadix;
+
+ @Column(name = "`pension_personal_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "养老险个人缴纳比例")
+ private Double pensionPersonalProportion;
+
+ @Column(name = "`pension_personal_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "养老险个人缴纳金额")
+ private BigDecimal pensionPersonalAmount;
+
+ @Column(name = "`pension_company_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "养老险公司缴纳比例")
+ private Double pensionCompanyProportion;
+
+ @Column(name = "`pension_company_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "养老险公司缴纳金额")
+ private BigDecimal pensionCompanyAmount;
+
+ @Column(name = "`medical_radix`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "医疗险基数")
+ private BigDecimal medicalRadix;
+
+ @Column(name = "`medical_personal_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "医疗险个人缴纳比例")
+ private Double medicalPersonalProportion;
+
+ @Column(name = "`medical_personal_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "医疗险个人缴纳金额")
+ private BigDecimal medicalPersonalAmount;
+
+ @Column(name = "`medical_company_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "医疗险公司缴纳比例")
+ private Double medicalCompanyProportion;
+
+ @Column(name = "`medical_company_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "医疗险公司缴纳金额")
+ private BigDecimal medicalCompanyAmount;
+
+ @Column(name = "`unemployment_radix`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "失业险基数")
+ private BigDecimal unemploymentRadix;
+
+ @Column(name = "`unemployment_personal_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "失业险个人缴纳比例")
+ private Double unemploymentPersonalProportion;
+
+ @Column(name = "`unemployment_personal_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "失业险个人缴纳金额")
+ private BigDecimal unemploymentPersonalAmount;
+
+ @Column(name = "`unemployment_company_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "失业险公司缴纳比例")
+ private Double unemploymentCompanyProportion;
+
+ @Column(name = "`unemployment_company_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "失业险公司缴纳金额")
+ private BigDecimal unemploymentCompanyAmount;
+
+ @Column(name = "`maternity_radix`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "生育险基数")
+ private BigDecimal maternityRadix;
+
+ @Column(name = "`maternity_personal_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "生育险个人缴纳比例")
+ private Double maternityPersonalProportion;
+
+ @Column(name = "`maternity_personal_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "生育险个人缴纳金额")
+ private BigDecimal maternityPersonalAmount;
+
+ @Column(name = "`maternity_company_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "生育险公司缴纳比例")
+ private Double maternityCompanyProportion;
+
+ @Column(name = "`maternity_company_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "生育险公司缴纳金额")
+ private BigDecimal maternityCompanyAmount;
+
+ @Column(name = "`industrial_injury_radix`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "工伤险基数")
+ private BigDecimal industrialInjuryRadix;
+
+ @Column(name = "`industrial_injury_personal_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "工伤险个人缴纳比例")
+ private Double industrialInjuryPersonalProportion;
+
+ @Column(name = "`industrial_injury_personal_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "工伤险个人缴纳金额")
+ private BigDecimal industrialInjuryPersonalAmount;
+
+ @Column(name = "`industrial_injury_company_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "工伤险公司缴纳比例")
+ private Double industrialInjuryCompanyProportion;
+
+ @Column(name = "`industrial_injury_company_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "工伤险公司缴纳金额")
+ private BigDecimal industrialInjuryCompanyAmount;
+
+ @Column(name = "`pre_tax_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "税前金额")
+ private BigDecimal preTaxAmount;
+
+ @Column(name = "`individual_income_tax`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "个人所得税")
+ private BigDecimal individualIncomeTax;
+
+ @Column(name = "`after_tax_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "税后金额")
+ private BigDecimal afterTaxAmount;
+
+ @Column(name = "`remarks`")
+ @ApiModelProperty(value = "备注")
+ private String remarks;
+
+ public void copy(Salary source){
+ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
+ }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/repository/SalaryRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/repository/SalaryRepository.java
new file mode 100644
index 0000000..2384c2c
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/repository/SalaryRepository.java
@@ -0,0 +1,28 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.salary.repository;
+
+import me.zhengjie.modules.salary.domain.Salary;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2023-01-03
+**/
+public interface SalaryRepository extends JpaRepository<Salary, Long>, JpaSpecificationExecutor<Salary> {
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/rest/SalaryController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/rest/SalaryController.java
new file mode 100644
index 0000000..48f220c
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/rest/SalaryController.java
@@ -0,0 +1,103 @@
+/*
+* 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.Salary;
+import me.zhengjie.modules.salary.service.SalaryService;
+import me.zhengjie.modules.salary.service.dto.SalaryQueryCriteria;
+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-01-03
+**/
+@RestController
+@RequiredArgsConstructor
+@Api(tags = "工资记录管理")
+@RequestMapping("/api/salary")
+public class SalaryController {
+
+ private final SalaryService salaryService;
+
+ @Log("导出数据")
+ @ApiOperation("导出数据")
+ @GetMapping(value = "/download")
+ @PreAuthorize("@el.check('salary:download')")
+ public void exportSalary(HttpServletResponse response, SalaryQueryCriteria criteria) throws IOException {
+ salaryService.download(salaryService.queryAll(criteria), response);
+ }
+
+ @GetMapping
+ @Log("查询工资记录")
+ @ApiOperation("查询工资记录")
+ @PreAuthorize("@el.check('salary:list')")
+ public ResponseEntity<Object> querySalary(SalaryQueryCriteria criteria, Pageable pageable){
+ return new ResponseEntity<>(salaryService.queryAll(criteria,pageable),HttpStatus.OK);
+ }
+
+ @GetMapping(value = "/all")
+ @Log("查询工资记录")
+ @ApiOperation("查询工资记录")
+ @PreAuthorize("@el.check('salary:list')")
+ public ResponseEntity<Object> querySalary(SalaryQueryCriteria criteria){
+ return new ResponseEntity<>(salaryService.queryAll(criteria),HttpStatus.OK);
+ }
+
+ @PostMapping
+ @Log("新增工资记录")
+ @ApiOperation("新增工资记录")
+ @PreAuthorize("@el.check('salary:add')")
+ public ResponseEntity<Object> createSalary(@Validated @RequestBody Salary resources){
+ return new ResponseEntity<>(salaryService.create(resources),HttpStatus.CREATED);
+ }
+
+ @PutMapping
+ @Log("修改工资记录")
+ @ApiOperation("修改工资记录")
+ @PreAuthorize("@el.check('salary:edit')")
+ public ResponseEntity<Object> updateSalary(@Validated @RequestBody Salary resources){
+ salaryService.update(resources);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @DeleteMapping
+ @Log("删除工资记录")
+ @ApiOperation("删除工资记录")
+ @PreAuthorize("@el.check('salary:del')")
+ public ResponseEntity<Object> deleteSalary(@RequestBody Long[] ids) {
+ salaryService.deleteAll(ids);
+ return new ResponseEntity<>(HttpStatus.OK);
+ }
+
+ @GetMapping(value = "/workDays")
+ @Log("查询某月工作天数")
+ @ApiOperation("查询某月工作天数")
+ @PreAuthorize("@el.check('salary:list')")
+ public ResponseEntity<Object> queryWorkDays(SalaryQueryCriteria criteria){
+ return new ResponseEntity<>(salaryService.queryWorkDays(criteria),HttpStatus.OK);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/SalaryService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/SalaryService.java
new file mode 100644
index 0000000..12f2d24
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/SalaryService.java
@@ -0,0 +1,90 @@
+/*
+* 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.Salary;
+import me.zhengjie.modules.salary.service.dto.SalaryDto;
+import me.zhengjie.modules.salary.service.dto.SalaryQueryCriteria;
+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-01-03
+**/
+public interface SalaryService {
+
+ /**
+ * 查询数据分页
+ * @param criteria 条件
+ * @param pageable 分页参数
+ * @return Map<String,Object>
+ */
+ Map<String,Object> queryAll(SalaryQueryCriteria criteria, Pageable pageable);
+
+ /**
+ * 查询所有数据不分页
+ * @param criteria 条件参数
+ * @return List<SalaryDto>
+ */
+ List<SalaryDto> queryAll(SalaryQueryCriteria criteria);
+
+ /**
+ * 根据ID查询
+ * @param id ID
+ * @return SalaryDto
+ */
+ SalaryDto findById(Long id);
+
+ /**
+ * 创建
+ * @param resources /
+ * @return SalaryDto
+ */
+ SalaryDto create(Salary resources);
+
+ /**
+ * 编辑
+ * @param resources /
+ */
+ void update(Salary resources);
+
+ /**
+ * 多选删除
+ * @param ids /
+ */
+ void deleteAll(Long[] ids);
+
+ /**
+ * 导出数据
+ * @param all 待导出的数据
+ * @param response /
+ * @throws IOException /
+ */
+ void download(List<SalaryDto> all, HttpServletResponse response) throws IOException;
+
+ /**
+ * 查询某月工作天数
+ * @param criteria 条件参数
+ * @return List<SalaryDto>
+ */
+ Integer queryWorkDays(SalaryQueryCriteria criteria);
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/SalaryDto.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/SalaryDto.java
new file mode 100644
index 0000000..4fc9dbc
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/SalaryDto.java
@@ -0,0 +1,207 @@
+/*
+* 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.base.BaseDTO;
+
+import java.sql.Timestamp;
+import java.math.BigDecimal;
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author 赵士淞
+* @date 2023-01-03
+**/
+@Data
+public class SalaryDto extends BaseDTO implements Serializable {
+
+ /** ID */
+ private Long id;
+
+ /** 员工ID */
+ private Long userId;
+
+ /** 工资年月 */
+ private String salaryYearMonth;
+
+ /** 级别工资 */
+ private BigDecimal levelWage;
+
+ /** 基本工资比例 */
+ private Double basicWageProportion;
+
+ /** 基本工资 */
+ private BigDecimal basicWage;
+
+ /** 全勤小时数 */
+ private Double fullDays;
+
+ /** 缺勤小时数 */
+ private Double absenceDays;
+
+ /** 实际基础工资 */
+ private BigDecimal actualBasicWage;
+
+ /** 绩效工资比例 */
+ private Double achievementsWageProportion;
+
+ /** 绩效工资 */
+ private BigDecimal achievementsWage;
+
+ /** 应完成绩效工时 */
+ private Double needCompletedAchievementsHours;
+
+ /** 已完成绩效工时 */
+ private Double alreadyCompletedAchievementsHours;
+
+ /** 实际绩效工资 */
+ private BigDecimal actualAchievementsWage;
+
+ /** 业绩工资比例 */
+ private Double performanceWageProportion;
+
+ /** 业绩工资 */
+ private BigDecimal performanceWage;
+
+ /** 个人业绩比例 */
+ private Double personalPerformanceProportion;
+
+ /** 应完成业绩工时 */
+ private Double needCompletedPerformanceHours;
+
+ /** 已完成业绩工时 */
+ private Double alreadyCompletedPerformanceHours;
+
+ /** 实际业绩工资 */
+ private BigDecimal actualPerformanceWage;
+
+ /** 团队工资比例 */
+ private Double teamWageProportion;
+
+ /** 团队工资 */
+ private BigDecimal teamWage;
+
+ /** 实际团队工资 */
+ private BigDecimal actualTeamWage;
+
+ /** 公积金基数 */
+ 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 BigDecimal preTaxAmount;
+
+ /** 个人所得税 */
+ private BigDecimal individualIncomeTax;
+
+ /** 税后金额 */
+ private BigDecimal afterTaxAmount;
+
+ /** 备注 */
+ private String remarks;
+
+ /** 用户昵称 */
+ private String userNickName;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/SalaryQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/SalaryQueryCriteria.java
new file mode 100644
index 0000000..1e042f1
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/SalaryQueryCriteria.java
@@ -0,0 +1,39 @@
+/*
+* 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-01-03
+**/
+@Data
+public class SalaryQueryCriteria{
+
+ /** 精确 */
+ @Query
+ private Long userId;
+
+ /** 模糊 */
+ @Query(type = Query.Type.INNER_LIKE)
+ private String salaryYearMonth;
+
+ private String targetYearMonth;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/impl/SalaryServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/impl/SalaryServiceImpl.java
new file mode 100644
index 0000000..00943aa
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/impl/SalaryServiceImpl.java
@@ -0,0 +1,198 @@
+/*
+* 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.Salary;
+import me.zhengjie.modules.system.domain.SysConfigHoliday;
+import me.zhengjie.modules.system.domain.User;
+import me.zhengjie.modules.system.repository.SysConfigHolidayRepository;
+import me.zhengjie.modules.system.repository.UserRepository;
+import me.zhengjie.modules.system.service.dto.SysConfigHolidayQueryCriteria;
+import me.zhengjie.utils.*;
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.modules.salary.repository.SalaryRepository;
+import me.zhengjie.modules.salary.service.SalaryService;
+import me.zhengjie.modules.salary.service.dto.SalaryDto;
+import me.zhengjie.modules.salary.service.dto.SalaryQueryCriteria;
+import me.zhengjie.modules.salary.service.mapstruct.SalaryMapper;
+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.List;
+import java.util.Map;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.function.Function;
+
+/**
+* @website https://eladmin.vip
+* @description 服务实现
+* @author 赵士淞
+* @date 2023-01-03
+**/
+@Service
+@RequiredArgsConstructor
+public class SalaryServiceImpl implements SalaryService {
+
+ private final SalaryRepository salaryRepository;
+ private final SalaryMapper salaryMapper;
+ private final UserRepository userRepository;
+ private final SysConfigHolidayRepository sysConfigHolidayRepository;
+
+ @Override
+ public Map<String,Object> queryAll(SalaryQueryCriteria criteria, Pageable pageable){
+ Page<Salary> page = salaryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
+ // 将实体类转换为DTO(重写)
+ Function<Salary, SalaryDto> func = new Function<Salary, SalaryDto>(){
+ @Override
+ public SalaryDto apply(Salary t) {
+ // 将实体类转换成DTO
+ SalaryDto salaryDto = salaryMapper.toDto(t);
+ // 根据用户ID查询用户信息
+ User user = userRepository.findById(salaryDto.getUserId()).orElseGet(User::new);
+ ValidationUtil.isNull(user.getId(),"User","id",salaryDto.getUserId());
+ // 用户昵称
+ salaryDto.setUserNickName(user.getNickName());
+ // 返回处理好的DTO
+ return salaryDto;
+ }
+ };
+ return PageUtil.toPage(page.map(func));
+ }
+
+ @Override
+ public List<SalaryDto> queryAll(SalaryQueryCriteria criteria){
+ return salaryMapper.toDto(salaryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
+ }
+
+ @Override
+ @Transactional
+ public SalaryDto findById(Long id) {
+ Salary salary = salaryRepository.findById(id).orElseGet(Salary::new);
+ ValidationUtil.isNull(salary.getId(),"Salary","id",id);
+ return salaryMapper.toDto(salary);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public SalaryDto create(Salary resources) {
+ return salaryMapper.toDto(salaryRepository.save(resources));
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(Salary resources) {
+ Salary salary = salaryRepository.findById(resources.getId()).orElseGet(Salary::new);
+ ValidationUtil.isNull( salary.getId(),"Salary","id",resources.getId());
+ salary.copy(resources);
+ salaryRepository.save(salary);
+ }
+
+ @Override
+ public void deleteAll(Long[] ids) {
+ for (Long id : ids) {
+ salaryRepository.deleteById(id);
+ }
+ }
+
+ @Override
+ public void download(List<SalaryDto> all, HttpServletResponse response) throws IOException {
+ List<Map<String, Object>> list = new ArrayList<>();
+ for (SalaryDto salary : all) {
+ String userNickName = salary.getUserId() != null ? userRepository.findById(salary.getUserId()).orElseGet(User::new).getNickName() : "";
+ Map<String,Object> map = new LinkedHashMap<>();
+ map.put("员工姓名", userNickName);
+ map.put("工资年月", salary.getSalaryYearMonth());
+ map.put("级别工资", salary.getLevelWage());
+ map.put("基本工资比例", salary.getBasicWageProportion());
+ map.put("基本工资", salary.getBasicWage());
+ map.put("全勤小时数", salary.getFullDays());
+ map.put("缺勤小时数", salary.getAbsenceDays());
+ map.put("实际基础工资", salary.getActualBasicWage());
+ map.put("绩效工资比例", salary.getAchievementsWageProportion());
+ map.put("绩效工资", salary.getAchievementsWage());
+ map.put("应完成绩效工时", salary.getNeedCompletedAchievementsHours());
+ map.put("已完成绩效工时", salary.getAlreadyCompletedAchievementsHours());
+ map.put("实际绩效工资", salary.getActualAchievementsWage());
+ map.put("业绩工资比例", salary.getPerformanceWageProportion());
+ map.put("业绩工资", salary.getPerformanceWage());
+ map.put("个人业绩比例", salary.getPersonalPerformanceProportion());
+ map.put("应完成业绩工时", salary.getNeedCompletedPerformanceHours());
+ map.put("已完成业绩工时", salary.getAlreadyCompletedPerformanceHours());
+ map.put("实际业绩工资", salary.getActualPerformanceWage());
+ map.put("团队工资比例", salary.getTeamWageProportion());
+ map.put("团队工资", salary.getTeamWage());
+ map.put("实际团队工资", salary.getActualTeamWage());
+ map.put("公积金基数", salary.getAccumulationRadix());
+ map.put("公积金个人缴纳比例", salary.getAccumulationPersonalProportion());
+ map.put("公积金个人缴纳金额", salary.getAccumulationPersonalAmount());
+ map.put("公积金公司缴纳比例", salary.getAccumulationCompanyProportion());
+ map.put("公积金公司缴纳金额", salary.getAccumulationCompanyAmount());
+ map.put("养老险基数", salary.getPensionRadix());
+ map.put("养老险个人缴纳比例", salary.getPensionPersonalProportion());
+ map.put("养老险个人缴纳金额", salary.getPensionPersonalAmount());
+ map.put("养老险公司缴纳比例", salary.getPensionCompanyProportion());
+ map.put("养老险公司缴纳金额", salary.getPensionCompanyAmount());
+ map.put("医疗险基数", salary.getMedicalRadix());
+ map.put("医疗险个人缴纳比例", salary.getMedicalPersonalProportion());
+ map.put("医疗险个人缴纳金额", salary.getMedicalPersonalAmount());
+ map.put("医疗险公司缴纳比例", salary.getMedicalCompanyProportion());
+ map.put("医疗险公司缴纳金额", salary.getMedicalCompanyAmount());
+ map.put("失业险基数", salary.getUnemploymentRadix());
+ map.put("失业险个人缴纳比例", salary.getUnemploymentPersonalProportion());
+ map.put("失业险个人缴纳金额", salary.getUnemploymentPersonalAmount());
+ map.put("失业险公司缴纳比例", salary.getUnemploymentCompanyProportion());
+ map.put("失业险公司缴纳金额", salary.getUnemploymentCompanyAmount());
+ map.put("生育险基数", salary.getMaternityRadix());
+ map.put("生育险个人缴纳比例", salary.getMaternityPersonalProportion());
+ map.put("生育险个人缴纳金额", salary.getMaternityPersonalAmount());
+ map.put("生育险公司缴纳比例", salary.getMaternityCompanyProportion());
+ map.put("生育险公司缴纳金额", salary.getMaternityCompanyAmount());
+ map.put("工伤险基数", salary.getIndustrialInjuryRadix());
+ map.put("工伤险个人缴纳比例", salary.getIndustrialInjuryPersonalProportion());
+ map.put("工伤险个人缴纳金额", salary.getIndustrialInjuryPersonalAmount());
+ map.put("工伤险公司缴纳比例", salary.getIndustrialInjuryCompanyProportion());
+ map.put("工伤险公司缴纳金额", salary.getIndustrialInjuryCompanyAmount());
+ map.put("税前金额", salary.getPreTaxAmount());
+ map.put("个人所得税", salary.getIndividualIncomeTax());
+ map.put("税后金额", salary.getAfterTaxAmount());
+ map.put("备注", salary.getRemarks());
+ map.put("创建者", salary.getCreateBy());
+ map.put("创建时间", salary.getCreateTime());
+ map.put("更新者", salary.getUpdateBy());
+ map.put("更新时间", salary.getUpdateTime());
+ list.add(map);
+ }
+ FileUtil.downloadExcel(list, response);
+ }
+
+ @Override
+ public Integer queryWorkDays(SalaryQueryCriteria criteria){
+ // 国际时间转中国时间
+ String targetYearMonth = DateUtil.internationalTimeToChinaTime(criteria.getTargetYearMonth());
+ // 节日查询类
+ SysConfigHolidayQueryCriteria sysConfigHolidayQueryCriteria = new SysConfigHolidayQueryCriteria();
+ sysConfigHolidayQueryCriteria.setHolidayDateLike(targetYearMonth.substring(0,7));
+ // 获取某月节日数据
+ List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,sysConfigHolidayQueryCriteria,criteriaBuilder));
+ // 查询某月工作天数
+ return DateUtil.getWorkDayOfMonth(sysConfigHolidayList, targetYearMonth);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/mapstruct/SalaryMapper.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/mapstruct/SalaryMapper.java
new file mode 100644
index 0000000..e4932bf
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/mapstruct/SalaryMapper.java
@@ -0,0 +1,32 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.salary.service.mapstruct;
+
+import me.zhengjie.base.BaseMapper;
+import me.zhengjie.modules.salary.domain.Salary;
+import me.zhengjie.modules.salary.service.dto.SalaryDto;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2023-01-03
+**/
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
+public interface SalaryMapper extends BaseMapper<SalaryDto, Salary> {
+
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelInsuranceRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelInsuranceRepository.java
index 23902c3..e8b2e11 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelInsuranceRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelInsuranceRepository.java
@@ -16,7 +16,6 @@
package me.zhengjie.modules.system.repository;
import me.zhengjie.modules.system.domain.SysUserLevelInsurance;
-import me.zhengjie.modules.system.domain.SysUserLevelWage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
@@ -45,4 +44,13 @@
*/
@Query(value = "SELECT * FROM sys_user_level_insurance WHERE user_id = ?1", nativeQuery = true)
List<SysUserLevelInsurance> findByUserId(Long userId);
+
+ /**
+ * 根据用户ID、指定年月查询
+ * @param userId
+ * @param targetDate
+ * @return
+ */
+ @Query(value = "SELECT * FROM sys_user_level_insurance WHERE user_id = ?1 AND start_date <= ?2 AND (end_date IS NULL OR end_date >= ?2) ORDER BY start_date DESC, create_time DESC LIMIT 1", nativeQuery = true)
+ SysUserLevelInsurance findTargetYearMonth(Long userId, String targetDate);
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelOtherRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelOtherRepository.java
index 8047c7c..db55a0f 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelOtherRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelOtherRepository.java
@@ -43,4 +43,13 @@
* @return
*/
List<SysUserLevelOther> findByUserId(Long userId);
+
+ /**
+ * 根据用户ID、指定年月查询
+ * @param userId
+ * @param targetDate
+ * @return
+ */
+ @Query(value = "SELECT * FROM sys_user_level_other WHERE user_id = ?1 AND start_date <= ?2 AND (end_date IS NULL OR end_date >= ?2) ORDER BY start_date DESC, create_time DESC LIMIT 1", nativeQuery = true)
+ SysUserLevelOther findTargetYearMonth(Long userId, String targetDate);
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelWageRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelWageRepository.java
index ec34d4e..6b68897 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelWageRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelWageRepository.java
@@ -20,6 +20,7 @@
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
+import java.sql.Timestamp;
import java.util.List;
/**
@@ -53,4 +54,12 @@
@Query(value = "SELECT * FROM sys_user_level_wage WHERE user_id = ?1", nativeQuery = true)
List<SysUserLevelWage> findByUserId(Long userId);
+ /**
+ * 根据用户ID、指定年月查询
+ * @param userId
+ * @param targetDate
+ * @return
+ */
+ @Query(value = "SELECT * FROM sys_user_level_wage WHERE user_id = ?1 AND start_date <= ?2 AND (end_date IS NULL OR end_date >= ?2) ORDER BY start_date DESC, create_time DESC LIMIT 1", nativeQuery = true)
+ SysUserLevelWage findTargetYearMonth(Long userId, String targetDate);
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelInsuranceController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelInsuranceController.java
index 6da85e4..84d1ccd 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelInsuranceController.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelInsuranceController.java
@@ -67,6 +67,14 @@
return new ResponseEntity<>(sysUserLevelInsuranceService.queryAll(criteria),HttpStatus.OK);
}
+ @GetMapping(value = "/targetYearMonth")
+ @Log("查询指定年月用户级别保险")
+ @ApiOperation("查询指定年月用户级别保险")
+ @PreAuthorize("@el.check('sysUserLevelInsurance:list')")
+ public ResponseEntity<Object> queryTargetYearMonth(SysUserLevelInsuranceQueryCriteria criteria){
+ return new ResponseEntity<>(sysUserLevelInsuranceService.queryTargetYearMonth(criteria),HttpStatus.OK);
+ }
+
@PostMapping
@Log("新增用户级别保险")
@ApiOperation("新增用户级别保险")
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelOtherController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelOtherController.java
index f2e2a23..b54e3f3 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelOtherController.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelOtherController.java
@@ -67,6 +67,14 @@
return new ResponseEntity<>(sysUserLevelOtherService.queryAll(criteria),HttpStatus.OK);
}
+ @GetMapping(value = "/targetYearMonth")
+ @Log("查询指定年月用户级别其他")
+ @ApiOperation("查询指定年月用户级别其他")
+ @PreAuthorize("@el.check('sysUserLevelOther:list')")
+ public ResponseEntity<Object> queryTargetYearMonth(SysUserLevelOtherQueryCriteria criteria){
+ return new ResponseEntity<>(sysUserLevelOtherService.queryTargetYearMonth(criteria),HttpStatus.OK);
+ }
+
@PostMapping
@Log("新增用户级别其他")
@ApiOperation("新增用户级别其他")
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelWageController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelWageController.java
index 46dd415..610b1db 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelWageController.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelWageController.java
@@ -67,6 +67,14 @@
return new ResponseEntity<>(sysUserLevelWageService.queryAll(criteria),HttpStatus.OK);
}
+ @GetMapping(value = "/targetYearMonth")
+ @Log("查询指定年月用户级别工资")
+ @ApiOperation("查询指定年月用户级别工资")
+ @PreAuthorize("@el.check('sysUserLevelWage:list')")
+ public ResponseEntity<Object> queryTargetYearMonth(SysUserLevelWageQueryCriteria criteria){
+ return new ResponseEntity<>(sysUserLevelWageService.queryTargetYearMonth(criteria),HttpStatus.OK);
+ }
+
@PostMapping
@Log("新增用户级别工资")
@ApiOperation("新增用户级别工资")
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelInsuranceService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelInsuranceService.java
index 4bbbf8f..87f4c17 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelInsuranceService.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelInsuranceService.java
@@ -48,6 +48,13 @@
List<SysUserLevelInsuranceDto> queryAll(SysUserLevelInsuranceQueryCriteria criteria);
/**
+ * 查询指定年月用户级别保险
+ * @param criteria 条件参数
+ * @return List<SysUserLevelInsuranceDto>
+ */
+ SysUserLevelInsuranceDto queryTargetYearMonth(SysUserLevelInsuranceQueryCriteria criteria);
+
+ /**
* 根据ID查询
* @param id ID
* @return SysUserLevelInsuranceDto
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelOtherService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelOtherService.java
index c162f6e..84c6ce3 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelOtherService.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelOtherService.java
@@ -48,6 +48,13 @@
List<SysUserLevelOtherDto> queryAll(SysUserLevelOtherQueryCriteria criteria);
/**
+ * 查询指定年月用户级别其他
+ * @param criteria 条件参数
+ * @return List<SysUserLevelOtherDto>
+ */
+ SysUserLevelOtherDto queryTargetYearMonth(SysUserLevelOtherQueryCriteria criteria);
+
+ /**
* 根据ID查询
* @param id ID
* @return SysUserLevelOtherDto
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelWageService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelWageService.java
index fd1c42e..beada40 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelWageService.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelWageService.java
@@ -48,6 +48,13 @@
List<SysUserLevelWageDto> queryAll(SysUserLevelWageQueryCriteria criteria);
/**
+ * 查询指定年月用户级别工资
+ * @param criteria
+ * @return
+ */
+ SysUserLevelWageDto queryTargetYearMonth(SysUserLevelWageQueryCriteria criteria);
+
+ /**
* 根据ID查询
* @param id ID
* @return SysUserLevelWageDto
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysConfigHolidayQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysConfigHolidayQueryCriteria.java
index abfabe9..307a2bf 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysConfigHolidayQueryCriteria.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysConfigHolidayQueryCriteria.java
@@ -38,4 +38,8 @@
/** 精确 */
@Query
private String dateType;
+
+ /** 精确 */
+ @Query(propName = "holidayDate", type = Query.Type.INNER_LIKE)
+ private String holidayDateLike;
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelInsuranceQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelInsuranceQueryCriteria.java
index c5f95a2..51f008c 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelInsuranceQueryCriteria.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelInsuranceQueryCriteria.java
@@ -34,4 +34,6 @@
/** 精确 */
@Query
private Long levelId;
+
+ private String targetYearMonth;
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelOtherQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelOtherQueryCriteria.java
index 729e880..0412d00 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelOtherQueryCriteria.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelOtherQueryCriteria.java
@@ -34,4 +34,6 @@
/** 精确 */
@Query
private Long levelId;
+
+ private String targetYearMonth;
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelWageQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelWageQueryCriteria.java
index 63dbde5..9b04e5a 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelWageQueryCriteria.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelWageQueryCriteria.java
@@ -34,4 +34,6 @@
/** 精确 */
@Query
private Long levelId;
+
+ private String targetYearMonth;
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelInsuranceServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelInsuranceServiceImpl.java
index adeca97..6e35bf3 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelInsuranceServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelInsuranceServiceImpl.java
@@ -21,8 +21,7 @@
import me.zhengjie.modules.system.domain.User;
import me.zhengjie.modules.system.repository.SysLevelRepository;
import me.zhengjie.modules.system.repository.UserRepository;
-import me.zhengjie.utils.ValidationUtil;
-import me.zhengjie.utils.FileUtil;
+import me.zhengjie.utils.*;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.system.repository.SysUserLevelInsuranceRepository;
import me.zhengjie.modules.system.service.SysUserLevelInsuranceService;
@@ -33,8 +32,6 @@
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.sql.Timestamp;
import java.text.SimpleDateFormat;
@@ -90,6 +87,22 @@
}
@Override
+ public SysUserLevelInsuranceDto queryTargetYearMonth(SysUserLevelInsuranceQueryCriteria criteria){
+ // 国际时间转中国时间
+ String targetYearMonth = DateUtil.internationalTimeToChinaTime(criteria.getTargetYearMonth());
+ // 获取某年某月最后一天
+ String lastDayOfTargetYearMonth = DateUtil.getLastDayOfMonth(targetYearMonth);
+ // 根据用户ID、指定年月查询
+ SysUserLevelInsurance sysUserLevelInsurance = sysUserLevelInsuranceRepository.findTargetYearMonth(criteria.getUserId(), lastDayOfTargetYearMonth);
+ // 判断查询结果
+ if (sysUserLevelInsurance == null) {
+ throw new BadRequestException("没有获取到当前员工的级别信息!");
+ }
+ // 返回
+ return sysUserLevelInsuranceMapper.toDto(sysUserLevelInsurance);
+ }
+
+ @Override
@Transactional
public SysUserLevelInsuranceDto findById(Long id) {
SysUserLevelInsurance sysUserLevelInsurance = sysUserLevelInsuranceRepository.findById(id).orElseGet(SysUserLevelInsurance::new);
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelOtherServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelOtherServiceImpl.java
index a34e1e1..ae96df6 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelOtherServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelOtherServiceImpl.java
@@ -21,8 +21,7 @@
import me.zhengjie.modules.system.domain.User;
import me.zhengjie.modules.system.repository.SysLevelRepository;
import me.zhengjie.modules.system.repository.UserRepository;
-import me.zhengjie.utils.ValidationUtil;
-import me.zhengjie.utils.FileUtil;
+import me.zhengjie.utils.*;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.system.repository.SysUserLevelOtherRepository;
import me.zhengjie.modules.system.service.SysUserLevelOtherService;
@@ -33,8 +32,6 @@
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.sql.Timestamp;
import java.text.SimpleDateFormat;
@@ -90,6 +87,22 @@
}
@Override
+ public SysUserLevelOtherDto queryTargetYearMonth(SysUserLevelOtherQueryCriteria criteria){
+ // 国际时间转中国时间
+ String targetYearMonth = DateUtil.internationalTimeToChinaTime(criteria.getTargetYearMonth());
+ // 获取某年某月最后一天
+ String lastDayOfTargetYearMonth = DateUtil.getLastDayOfMonth(targetYearMonth);
+ // 根据用户ID、指定年月查询
+ SysUserLevelOther sysUserLevelOther = sysUserLevelOtherRepository.findTargetYearMonth(criteria.getUserId(), lastDayOfTargetYearMonth);
+ // 判断查询结果
+ if (sysUserLevelOther == null) {
+ throw new BadRequestException("没有获取到当前员工的级别信息!");
+ }
+ // 返回
+ return sysUserLevelOtherMapper.toDto(sysUserLevelOther);
+ }
+
+ @Override
@Transactional
public SysUserLevelOtherDto findById(Long id) {
SysUserLevelOther sysUserLevelOther = sysUserLevelOtherRepository.findById(id).orElseGet(SysUserLevelOther::new);
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelWageServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelWageServiceImpl.java
index 679b922..8c2aa30 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelWageServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelWageServiceImpl.java
@@ -21,8 +21,7 @@
import me.zhengjie.modules.system.domain.User;
import me.zhengjie.modules.system.repository.SysLevelRepository;
import me.zhengjie.modules.system.repository.UserRepository;
-import me.zhengjie.utils.ValidationUtil;
-import me.zhengjie.utils.FileUtil;
+import me.zhengjie.utils.*;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.system.repository.SysUserLevelWageRepository;
import me.zhengjie.modules.system.service.SysUserLevelWageService;
@@ -33,8 +32,6 @@
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.sql.Timestamp;
import java.text.SimpleDateFormat;
@@ -90,6 +87,22 @@
}
@Override
+ public SysUserLevelWageDto queryTargetYearMonth(SysUserLevelWageQueryCriteria criteria){
+ // 国际时间转中国时间
+ String targetYearMonth = DateUtil.internationalTimeToChinaTime(criteria.getTargetYearMonth());
+ // 获取某年某月最后一天
+ String lastDayOfTargetYearMonth = DateUtil.getLastDayOfMonth(targetYearMonth);
+ // 根据用户ID、指定年月查询
+ SysUserLevelWage sysUserLevelWage = sysUserLevelWageRepository.findTargetYearMonth(criteria.getUserId(), lastDayOfTargetYearMonth);
+ // 判断查询结果
+ if (sysUserLevelWage == null) {
+ throw new BadRequestException("没有获取到当前员工的级别信息!");
+ }
+ // 返回
+ return sysUserLevelWageMapper.toDto(sysUserLevelWage);
+ }
+
+ @Override
@Transactional
public SysUserLevelWageDto findById(Long id) {
SysUserLevelWage sysUserLevelWage = sysUserLevelWageRepository.findById(id).orElseGet(SysUserLevelWage::new);
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/utils/DateUtil.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/utils/DateUtil.java
new file mode 100644
index 0000000..be76cf5
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/utils/DateUtil.java
@@ -0,0 +1,130 @@
+package me.zhengjie.utils;
+
+import me.zhengjie.modules.constant.Constant;
+import me.zhengjie.modules.system.domain.SysConfigHoliday;
+import me.zhengjie.modules.system.service.dto.SysConfigHolidayQueryCriteria;
+
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Locale;
+
+public class DateUtil {
+
+ /**
+ * 国际时间转中国时间
+ * @param timeStr
+ * @return
+ */
+ public static String internationalTimeToChinaTime(String timeStr) {
+ // 判断是否空
+ if (!StringUtils.isBlank(timeStr)) {
+ // 判断是否为国际时间
+ if (timeStr.contains("T")) {
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH);
+ LocalDateTime ldt = LocalDateTime.parse(timeStr, df);
+ ZoneId currentZone = ZoneId.of("UTC");
+ ZoneId newZone = ZoneId.of("Asia/Shanghai");
+ timeStr = ldt.atZone(currentZone).withZoneSameInstant(newZone).toLocalDateTime().toString();
+ }
+ // 判断长度
+ if (timeStr.length() >= 10) {
+ return timeStr.substring(0, 10);
+ }
+ }
+ return timeStr;
+ }
+
+ /**
+ * 获取某年某月最后一天
+ * @param dateStr
+ * @return
+ */
+ public static String getLastDayOfMonth(String dateStr) {
+ // 日历类
+ Calendar cal = Calendar.getInstance();
+ // 设置年份
+ cal.set(Calendar.YEAR, Integer.valueOf(dateStr.substring(0,4)));
+ // 设置月份
+ cal.set(Calendar.MONTH, Integer.valueOf(dateStr.substring(5,7)) - 1);
+ // 获取本月最大天数
+ int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
+ // 设置天数为本月最大天数
+ cal.set(Calendar.DAY_OF_MONTH, lastDay);
+ // 格式化日期
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ return sdf.format(cal.getTime());
+ }
+
+ /**
+ * 获取某年某月工作天数
+ * @param holidayList
+ * @param dateStr
+ * @return
+ */
+ public static Integer getWorkDayOfMonth(List<SysConfigHoliday> holidayList, String dateStr) {
+ // 工作天数
+ Integer workDays = 0;
+ // 日历类
+ Calendar cal = Calendar.getInstance();
+ // 设置年份
+ cal.set(Calendar.YEAR, Integer.valueOf(dateStr.substring(0,4)));
+ // 设置月份
+ cal.set(Calendar.MONTH, Integer.valueOf(dateStr.substring(5,7)) - 1);
+ // 获取本月最大天数
+ int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
+ // 循环本月最大天数
+ for (int i = 1; i <= lastDay; i ++) {
+ // 设置天数
+ cal.set(Calendar.DAY_OF_MONTH, i);
+ // 设置时数
+ cal.set(Calendar.HOUR_OF_DAY, 0);
+ // 设置分数
+ cal.set(Calendar.MINUTE, 0);
+ // 设置秒数
+ cal.set(Calendar.SECOND, 0);
+ // 设置毫秒数
+ cal.set(Calendar.MILLISECOND, 0);
+ // 本日星期几
+ int week = cal.get(Calendar.DAY_OF_WEEK);
+ // 判断本月是否有节日
+ if (holidayList.size() != 0) {
+ // 循环本月节日列表
+ for (int j = 0; j < holidayList.size(); j ++) {
+ // 本节日
+ SysConfigHoliday sysConfigHoliday = holidayList.get(j);
+ // 判断本日是否为本节日
+ if (sysConfigHoliday.getHolidayDate().getTime() == cal.getTime().getTime()) {
+ // 判断本节日日期类型是否为工作日
+ if (Constant.DATE_TYPE_WEEKDAY.equals(sysConfigHoliday.getDateType())) {
+ // 工作天数
+ workDays ++;
+ }
+ // 终止
+ break;
+ }
+ // 判断循环是否结束
+ if (j == holidayList.size() - 1) {
+ // 判断本日是否不为周末
+ if (week != 1 && week != 7) {
+ // 工作天数
+ workDays ++;
+ }
+ }
+ }
+ } else {
+ // 判断本日是否不为周末
+ if (week != 1 && week != 7) {
+ // 工作天数
+ workDays ++;
+ }
+ }
+ }
+ // 工作天数
+ return workDays;
+ }
+}
diff --git a/eladmin-web-master/src/api/salary/salary.js b/eladmin-web-master/src/api/salary/salary.js
new file mode 100644
index 0000000..0ca8503
--- /dev/null
+++ b/eladmin-web-master/src/api/salary/salary.js
@@ -0,0 +1,43 @@
+import request from '@/utils/request'
+
+export function getAll(params) {
+ return request({
+ url: 'api/salary/all',
+ method: 'get',
+ params
+ })
+}
+
+export function add(data) {
+ return request({
+ url: 'api/salary',
+ method: 'post',
+ data
+ })
+}
+
+export function del(ids) {
+ return request({
+ url: 'api/salary/',
+ method: 'delete',
+ data: ids
+ })
+}
+
+export function edit(data) {
+ return request({
+ url: 'api/salary',
+ method: 'put',
+ data
+ })
+}
+
+export function workDays(params) {
+ return request({
+ url: 'api/salary/workDays',
+ method: 'get',
+ params
+ })
+}
+
+export default { getAll, add, edit, del, workDays }
diff --git a/eladmin-web-master/src/api/system/userLevelInsurance.js b/eladmin-web-master/src/api/system/userLevelInsurance.js
index f3e728f..308ee18 100644
--- a/eladmin-web-master/src/api/system/userLevelInsurance.js
+++ b/eladmin-web-master/src/api/system/userLevelInsurance.js
@@ -32,4 +32,12 @@
})
}
-export default { getAll, add, edit, del }
+export function getTargetYearMonth(params) {
+ return request({
+ url: 'api/sysUserLevelInsurance/targetYearMonth',
+ method: 'get',
+ params
+ })
+}
+
+export default { getAll, add, edit, del, getTargetYearMonth }
diff --git a/eladmin-web-master/src/api/system/userLevelOther.js b/eladmin-web-master/src/api/system/userLevelOther.js
index 010d44e..8bae1de 100644
--- a/eladmin-web-master/src/api/system/userLevelOther.js
+++ b/eladmin-web-master/src/api/system/userLevelOther.js
@@ -32,4 +32,12 @@
})
}
-export default { getAll, add, edit, del }
+export function getTargetYearMonth(params) {
+ return request({
+ url: 'api/sysUserLevelOther/targetYearMonth',
+ method: 'get',
+ params
+ })
+}
+
+export default { getAll, add, edit, del, getTargetYearMonth }
diff --git a/eladmin-web-master/src/api/system/userLevelWage.js b/eladmin-web-master/src/api/system/userLevelWage.js
index 29a8199..2b746f6 100644
--- a/eladmin-web-master/src/api/system/userLevelWage.js
+++ b/eladmin-web-master/src/api/system/userLevelWage.js
@@ -32,4 +32,12 @@
})
}
-export default { getAll, add, edit, del }
+export function getTargetYearMonth(params) {
+ return request({
+ url: 'api/sysUserLevelWage/targetYearMonth',
+ method: 'get',
+ params
+ })
+}
+
+export default { getAll, add, edit, del, getTargetYearMonth }
diff --git a/eladmin-web-master/src/views/salary/salary/index.vue b/eladmin-web-master/src/views/salary/salary/index.vue
new file mode 100644
index 0000000..f037921
--- /dev/null
+++ b/eladmin-web-master/src/views/salary/salary/index.vue
@@ -0,0 +1,796 @@
+<template>
+ <div class="app-container">
+ <!--工具栏-->
+ <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"
+ />
+ </el-select>
+ <el-input v-model="query.salaryYearMonth" 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="690px">
+ <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="110px">
+ <el-form-item label="所属员工" prop="userId">
+ <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 523px;" @change="getUserLevel">
+ <el-option
+ v-for="item in users"
+ :key="item.id"
+ :label="item.nickName"
+ :value="item.id"
+ :disabled="!item.enabled"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="工资年月" prop="salaryYearMonth">
+ <el-date-picker
+ v-model="form.salaryYearMonth"
+ type="month"
+ style="width: 200px;"
+ placeholder="请选择"
+ @change="getUserLevel"
+ />
+ </el-form-item>
+ <el-form-item label="级别工资" prop="levelWage">
+ <money-input :key="random" v-model="form.levelWage" :width="200" />
+ </el-form-item>
+ <el-divider>基本工资</el-divider>
+ <el-form-item label="工资比例" prop="basicWageProportion">
+ <el-input v-model="form.basicWageProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="预计工资" prop="basicWage">
+ <money-input :key="random" v-model="form.basicWage" :width="200" />
+ </el-form-item>
+ <el-form-item label="全勤小时数" prop="fullDays">
+ <el-input v-model="form.fullDays" style="width: 200px;">
+ <template slot="append">小时</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="缺勤小时数" prop="absenceDays">
+ <el-input v-model="form.absenceDays" style="width: 200px;">
+ <template slot="append">小时</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="实际工资" prop="actualBasicWage">
+ <money-input :key="random" v-model="form.actualBasicWage" :width="523" />
+ </el-form-item>
+ <el-divider>绩效工资</el-divider>
+ <el-form-item label="工资比例" prop="achievementsWageProportion">
+ <el-input v-model="form.achievementsWageProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="预计工资" prop="achievementsWage">
+ <money-input :key="random" v-model="form.achievementsWage" :width="200" />
+ </el-form-item>
+ <el-form-item label="应完成工时" prop="needCompletedAchievementsHours">
+ <el-input v-model="form.needCompletedAchievementsHours" style="width: 200px;">
+ <template slot="append">小时</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="已完成工时" prop="alreadyCompletedAchievementsHours">
+ <el-input v-model="form.alreadyCompletedAchievementsHours" style="width: 200px;">
+ <template slot="append">小时</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="实际工资" prop="actualAchievementsWage">
+ <money-input :key="random" v-model="form.actualAchievementsWage" :width="523" />
+ </el-form-item>
+ <el-divider>业绩工资</el-divider>
+ <el-form-item label="工资比例" prop="performanceWageProportion">
+ <el-input v-model="form.performanceWageProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="预计工资" prop="performanceWage">
+ <money-input :key="random" v-model="form.performanceWage" :width="200" />
+ </el-form-item>
+ <el-form-item label="个人业绩比例" prop="personalPerformanceProportion">
+ <el-input v-model="form.personalPerformanceProportion" style="width: 523px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="应完成工时" prop="needCompletedPerformanceHours">
+ <el-input v-model="form.needCompletedPerformanceHours" style="width: 200px;">
+ <template slot="append">小时</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="已完成工时" prop="alreadyCompletedPerformanceHours">
+ <el-input v-model="form.alreadyCompletedPerformanceHours" style="width: 200px;">
+ <template slot="append">小时</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="实际工资" prop="actualPerformanceWage">
+ <money-input :key="random" v-model="form.actualPerformanceWage" :width="523" />
+ </el-form-item>
+ <el-divider>团队工资</el-divider>
+ <el-form-item label="工资比例" prop="teamWageProportion">
+ <el-input v-model="form.teamWageProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="预计工资" prop="teamWage">
+ <money-input :key="random" v-model="form.teamWage" :width="200" />
+ </el-form-item>
+ <el-form-item label="实际工资" prop="actualTeamWage">
+ <money-input :key="random" v-model="form.actualTeamWage" :width="523" />
+ </el-form-item>
+ <el-divider>公积金</el-divider>
+ <el-form-item label="基数" prop="accumulationRadix">
+ <money-input :key="random" v-model="form.accumulationRadix" :width="523" />
+ </el-form-item>
+ <el-form-item label="个人缴纳比例" prop="accumulationPersonalProportion">
+ <el-input v-model="form.accumulationPersonalProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="个人缴纳金额" prop="accumulationPersonalAmount">
+ <money-input :key="random" v-model="form.accumulationPersonalAmount" :width="200" />
+ </el-form-item>
+ <el-form-item label="公司缴纳比例" prop="accumulationCompanyProportion">
+ <el-input v-model="form.accumulationCompanyProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="公司缴纳金额" prop="accumulationCompanyAmount">
+ <money-input :key="random" v-model="form.accumulationCompanyAmount" :width="200" />
+ </el-form-item>
+ <el-divider>养老险</el-divider>
+ <el-form-item label="基数" prop="pensionRadix">
+ <money-input :key="random" v-model="form.pensionRadix" :width="523" />
+ </el-form-item>
+ <el-form-item label="个人缴纳比例" prop="pensionPersonalProportion">
+ <el-input v-model="form.pensionPersonalProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="个人缴纳金额" prop="pensionPersonalAmount">
+ <money-input :key="random" v-model="form.pensionPersonalAmount" :width="200" />
+ </el-form-item>
+ <el-form-item label="公司缴纳比例" prop="pensionCompanyProportion">
+ <el-input v-model="form.pensionCompanyProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="公司缴纳金额" prop="pensionCompanyAmount">
+ <money-input :key="random" v-model="form.pensionCompanyAmount" :width="200" />
+ </el-form-item>
+ <el-divider>医疗险</el-divider>
+ <el-form-item label="基数" prop="medicalRadix">
+ <money-input :key="random" v-model="form.medicalRadix" :width="523" />
+ </el-form-item>
+ <el-form-item label="个人缴纳比例" prop="medicalPersonalProportion">
+ <el-input v-model="form.medicalPersonalProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="个人缴纳金额" prop="medicalPersonalAmount">
+ <money-input :key="random" v-model="form.medicalPersonalAmount" :width="200" />
+ </el-form-item>
+ <el-form-item label="公司缴纳比例" prop="medicalCompanyProportion">
+ <el-input v-model="form.medicalCompanyProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="公司缴纳金额" prop="medicalCompanyAmount">
+ <money-input :key="random" v-model="form.medicalCompanyAmount" :width="200" />
+ </el-form-item>
+ <el-divider>失业险</el-divider>
+ <el-form-item label="基数" prop="unemploymentRadix">
+ <money-input :key="random" v-model="form.unemploymentRadix" :width="523" />
+ </el-form-item>
+ <el-form-item label="个人缴纳比例" prop="unemploymentPersonalProportion">
+ <el-input v-model="form.unemploymentPersonalProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="个人缴纳金额" prop="unemploymentPersonalAmount">
+ <money-input :key="random" v-model="form.unemploymentPersonalAmount" :width="200" />
+ </el-form-item>
+ <el-form-item label="公司缴纳比例" prop="unemploymentCompanyProportion">
+ <el-input v-model="form.unemploymentCompanyProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="公司缴纳金额" prop="unemploymentCompanyAmount">
+ <money-input :key="random" v-model="form.unemploymentCompanyAmount" :width="200" />
+ </el-form-item>
+ <el-divider>生育险</el-divider>
+ <el-form-item label="基数" prop="maternityRadix">
+ <money-input :key="random" v-model="form.maternityRadix" :width="523" />
+ </el-form-item>
+ <el-form-item label="个人缴纳比例" prop="maternityPersonalProportion">
+ <el-input v-model="form.maternityPersonalProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="个人缴纳金额" prop="maternityPersonalAmount">
+ <money-input :key="random" v-model="form.maternityPersonalAmount" :width="200" />
+ </el-form-item>
+ <el-form-item label="公司缴纳比例" prop="maternityCompanyProportion">
+ <el-input v-model="form.maternityCompanyProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="公司缴纳金额" prop="maternityCompanyAmount">
+ <money-input :key="random" v-model="form.maternityCompanyAmount" :width="200" />
+ </el-form-item>
+ <el-divider>工伤险</el-divider>
+ <el-form-item label="基数" prop="industrialInjuryRadix">
+ <money-input :key="random" v-model="form.industrialInjuryRadix" :width="523" />
+ </el-form-item>
+ <el-form-item label="个人缴纳比例" prop="industrialInjuryPersonalProportion">
+ <el-input v-model="form.industrialInjuryPersonalProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="个人缴纳金额" prop="industrialInjuryPersonalAmount">
+ <money-input :key="random" v-model="form.industrialInjuryPersonalAmount" :width="200" />
+ </el-form-item>
+ <el-form-item label="公司缴纳比例" prop="industrialInjuryCompanyProportion">
+ <el-input v-model="form.industrialInjuryCompanyProportion" style="width: 200px;">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="公司缴纳金额" prop="industrialInjuryCompanyAmount">
+ <money-input :key="random" v-model="form.industrialInjuryCompanyAmount" :width="200" />
+ </el-form-item>
+ <el-divider>统计</el-divider>
+ <el-form-item label="税前金额" prop="preTaxAmount">
+ <money-input :key="random" v-model="form.preTaxAmount" :width="200" />
+ </el-form-item>
+ <el-form-item label="个人所得税" prop="individualIncomeTax">
+ <money-input :key="random" v-model="form.individualIncomeTax" :width="200" />
+ </el-form-item>
+ <el-form-item label="税后金额" prop="afterTaxAmount">
+ <money-input :key="random" v-model="form.afterTaxAmount" :width="523" />
+ </el-form-item>
+ <el-form-item label="备注">
+ <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 523px;" />
+ </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="userId" label="员工ID" />
+ <el-table-column prop="salaryYearMonth" label="工资年月" />
+ <el-table-column prop="levelWage" label="级别工资" />
+ <el-table-column prop="basicWageProportion" label="基本工资比例" />
+ <el-table-column prop="basicWage" label="基本工资" />
+ <el-table-column prop="fullDays" label="全勤小时数" />
+ <el-table-column prop="absenceDays" label="缺勤小时数" />
+ <el-table-column prop="actualBasicWage" label="实际基础工资" />
+ <el-table-column prop="achievementsWageProportion" label="绩效工资比例" />
+ <el-table-column prop="achievementsWage" label="绩效工资" />
+ <el-table-column prop="needCompletedAchievementsHours" label="应完成绩效工时" />
+ <el-table-column prop="alreadyCompletedAchievementsHours" label="已完成绩效工时" />
+ <el-table-column prop="actualAchievementsWage" label="实际绩效工资" />
+ <el-table-column prop="performanceWageProportion" label="业绩工资比例" />
+ <el-table-column prop="performanceWage" label="业绩工资" />
+ <el-table-column prop="personalPerformanceProportion" label="个人业绩比例" />
+ <el-table-column prop="needCompletedPerformanceHours" label="应完成业绩工时" />
+ <el-table-column prop="alreadyCompletedPerformanceHours" label="已完成业绩工时" />
+ <el-table-column prop="actualPerformanceWage" label="实际业绩工资" />
+ <el-table-column prop="teamWageProportion" label="团队工资比例" />
+ <el-table-column prop="teamWage" label="团队工资" />
+ <el-table-column prop="actualTeamWage" 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 prop="preTaxAmount" label="税前金额" />
+ <el-table-column prop="individualIncomeTax" label="个人所得税" />
+ <el-table-column prop="afterTaxAmount" label="税后金额" />
+ <el-table-column prop="remarks" label="备注" />
+ <el-table-column prop="createTime" label="创建时间" />
+ <el-table-column v-if="checkPer(['admin','salary:edit','salary: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 crudSalary from '@/api/salary/salary'
+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 moneyInput from '../../assembly/moneyInput/index.vue'
+import crudUser from '@/api/system/user'
+import crudUserLevelWage from '@/api/system/userLevelWage'
+import crudUserLevelInsurance from '@/api/system/userLevelInsurance'
+import crudUserLevelOther from '@/api/system/userLevelOther'
+
+const defaultForm = { id: null, userId: null, salaryYearMonth: null, levelWage: null, basicWageProportion: null, basicWage: null, fullDays: null, absenceDays: null, actualBasicWage: null, achievementsWageProportion: null, achievementsWage: null, needCompletedAchievementsHours: null, alreadyCompletedAchievementsHours: null, actualAchievementsWage: null, performanceWageProportion: null, performanceWage: null, personalPerformanceProportion: null, needCompletedPerformanceHours: null, alreadyCompletedPerformanceHours: null, actualPerformanceWage: null, teamWageProportion: null, teamWage: null, actualTeamWage: 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, preTaxAmount: null, individualIncomeTax: null, afterTaxAmount: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
+export default {
+ name: 'Salary',
+ components: { pagination, crudOperation, rrOperation, udOperation, moneyInput },
+ mixins: [presenter(), header(), form(defaultForm), crud()],
+ cruds() {
+ return CRUD({ title: '工资记录', url: 'api/salary', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSalary }})
+ },
+ data() {
+ // 工资(千万内)验证
+ var wageValidate = (rule, value, callback) => {
+ if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 10000000)) {
+ callback(new Error('请输入 一千万 以内的正整数或两位小数'))
+ } else {
+ callback()
+ }
+ }
+ // 比例(百内)验证
+ var proportionValidate = (rule, value, callback) => {
+ const reg = /^([0-9]|[1-9]\d)(\.\d{1,2})?$|100$/
+ if (value != null && value !== '' && !reg.test(value)) {
+ callback(new Error('请输入 一百 以内的正整数或两位小数'))
+ } else {
+ callback()
+ }
+ }
+ // 时长(千内)验证
+ var durationValidate = (rule, value, callback) => {
+ const reg = /^([0-9]|[1-9]\d{1,2})(\.\d{1,2})?$|1000$/
+ if (value != null && value !== '' && !reg.test(value)) {
+ callback(new Error('请输入 一千 以内的正整数或两位小数'))
+ } else {
+ callback()
+ }
+ }
+ return {
+ permission: {
+ add: ['admin', 'salary:add'],
+ edit: ['admin', 'salary:edit'],
+ del: ['admin', 'salary:del'],
+ download: ['admin', 'salary:download']
+ },
+ rules: {
+ userId: [
+ { required: true, message: '所属员工不能为空', trigger: 'change' }
+ ],
+ salaryYearMonth: [
+ { required: true, message: '工资年月不能为空', trigger: 'change' }
+ ],
+ levelWage: [
+ { required: true, message: '级别工资不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ basicWageProportion: [
+ { required: true, message: '基本工资比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ basicWage: [
+ { required: true, message: '预计基本工资不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ fullDays: [
+ { required: true, message: '全勤小时数不能为空', trigger: 'blur' },
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ absenceDays: [
+ { required: true, message: '缺勤小时数不能为空', trigger: 'blur' },
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ actualBasicWage: [
+ { required: true, message: '实际基础工资不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ achievementsWageProportion: [
+ { required: true, message: '绩效工资比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ achievementsWage: [
+ { required: true, message: '预计绩效工资不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ needCompletedAchievementsHours: [
+ { required: true, message: '应完成绩效工时不能为空', trigger: 'blur' },
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ alreadyCompletedAchievementsHours: [
+ { required: true, message: '已完成绩效工时不能为空', trigger: 'blur' },
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ actualAchievementsWage: [
+ { required: true, message: '实际绩效工资不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ performanceWageProportion: [
+ { required: true, message: '业绩工资比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ performanceWage: [
+ { required: true, message: '预计业绩工资不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ personalPerformanceProportion: [
+ { required: true, message: '个人业绩比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ needCompletedPerformanceHours: [
+ { required: true, message: '应完成业绩工时不能为空', trigger: 'blur' },
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ alreadyCompletedPerformanceHours: [
+ { required: true, message: '已完成业绩工时不能为空', trigger: 'blur' },
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ actualPerformanceWage: [
+ { required: true, message: '实际业绩工资不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ teamWageProportion: [
+ { required: true, message: '团队工资比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ teamWage: [
+ { required: true, message: '预计团队工资不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ actualTeamWage: [
+ { required: true, message: '实际团队工资不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ accumulationRadix: [
+ { required: true, message: '公积金基数不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ accumulationPersonalProportion: [
+ { required: true, message: '公积金个人缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ accumulationPersonalAmount: [
+ { required: true, message: '公积金个人缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ accumulationCompanyProportion: [
+ { required: true, message: '公积金公司缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ accumulationCompanyAmount: [
+ { required: true, message: '公积金公司缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ pensionRadix: [
+ { required: true, message: '养老险基数不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ pensionPersonalProportion: [
+ { required: true, message: '养老险个人缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ pensionPersonalAmount: [
+ { required: true, message: '养老险个人缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ pensionCompanyProportion: [
+ { required: true, message: '养老险公司缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ pensionCompanyAmount: [
+ { required: true, message: '养老险公司缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ medicalRadix: [
+ { required: true, message: '医疗险基数不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ medicalPersonalProportion: [
+ { required: true, message: '医疗险个人缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ medicalPersonalAmount: [
+ { required: true, message: '医疗险个人缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ medicalCompanyProportion: [
+ { required: true, message: '医疗险公司缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ medicalCompanyAmount: [
+ { required: true, message: '医疗险公司缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ unemploymentRadix: [
+ { required: true, message: '失业险基数不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ unemploymentPersonalProportion: [
+ { required: true, message: '失业险个人缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ unemploymentPersonalAmount: [
+ { required: true, message: '失业险个人缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ unemploymentCompanyProportion: [
+ { required: true, message: '失业险公司缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ unemploymentCompanyAmount: [
+ { required: true, message: '失业险公司缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ maternityRadix: [
+ { required: true, message: '生育险基数不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ maternityPersonalProportion: [
+ { required: true, message: '生育险个人缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ maternityPersonalAmount: [
+ { required: true, message: '生育险个人缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ maternityCompanyProportion: [
+ { required: true, message: '生育险公司缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ maternityCompanyAmount: [
+ { required: true, message: '生育险公司缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ industrialInjuryRadix: [
+ { required: true, message: '工伤险基数不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ industrialInjuryPersonalProportion: [
+ { required: true, message: '工伤险个人缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ industrialInjuryPersonalAmount: [
+ { required: true, message: '工伤险个人缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ industrialInjuryCompanyProportion: [
+ { required: true, message: '工伤险公司缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ industrialInjuryCompanyAmount: [
+ { required: true, message: '工伤险公司缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ preTaxAmount: [
+ { required: true, message: '税前金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ individualIncomeTax: [
+ { required: true, message: '个人所得税不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ afterTaxAmount: [
+ { required: true, message: '税后金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ]
+ },
+ queryTypeOptions: [
+ { key: 'userId', display_name: '所属员工' },
+ { key: 'salaryYearMonth', display_name: '工资年月' }
+ ],
+ // 用户列表
+ users: [],
+ // 随机数
+ random: 0
+ }
+ },
+ methods: {
+ // 钩子:在获取表格数据之前执行,false 则代表不获取数据
+ [CRUD.HOOK.beforeRefresh]() {
+ // 获取用户
+ this.getUser()
+ return true
+ },
+ // 获取用户
+ getUser() {
+ // 获取用户
+ crudUser.getAll().then(res => {
+ // 用户列表
+ this.users = res
+ })
+ },
+ // 钩子: 开始 "新建/编辑" - 之前
+ [CRUD.HOOK.beforeToCU]() {
+ // 随机数
+ this.random = Math.random()
+ },
+ // 获取用户级别数据
+ getUserLevel() {
+ // 判断所属员工、工资年月是否为空
+ if (this.form.userId != null && this.form.userId !== '' && this.form.salaryYearMonth != null && this.form.salaryYearMonth !== '') {
+ // 获取用户级别工资
+ this.getUserLevelWage()
+ // 获取用户级别保险
+ this.getUserLevelInsurance()
+ // 获取用户级别其他
+ this.getUserLevelOther()
+ // 获取工作天数
+ this.getWorkDays()
+ // 获取出勤天数
+ this.getAttendanceDays()
+ }
+ },
+ // 获取用户级别工资
+ getUserLevelWage() {
+ // 获取用户级别工资
+ crudUserLevelWage.getTargetYearMonth({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
+ // 级别工资
+ this.form.levelWage = res.levelWage
+ // 基本工资比例
+ this.form.basicWageProportion = res.basicWageProportion
+ // 预计基本工资
+ this.form.basicWage = (res.levelWage * (res.basicWageProportion / 100)).toFixed(2)
+ // 绩效工资比例
+ this.form.achievementsWageProportion = res.achievementsWageProportion
+ // 预计绩效工资
+ this.form.achievementsWage = (res.levelWage * (res.achievementsWageProportion / 100)).toFixed(2)
+ // 业绩工资比例
+ this.form.performanceWageProportion = res.performanceWageProportion
+ // 预计业绩工资
+ this.form.performanceWage = (res.levelWage * (res.performanceWageProportion / 100)).toFixed(2)
+ // 团队工资比例
+ this.form.teamWageProportion = res.teamWageProportion
+ // 预计团队工资
+ this.form.teamWage = (res.levelWage * (res.teamWageProportion / 100)).toFixed(2)
+ // 随机数
+ this.random = Math.random()
+ })
+ },
+ // 获取用户级别保险
+ getUserLevelInsurance() {
+ // 获取用户级别保险
+ crudUserLevelInsurance.getTargetYearMonth({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
+ // 公积金基数
+ this.form.accumulationRadix = res.accumulationRadix
+ // 公积金个人缴纳比例
+ this.form.accumulationPersonalProportion = res.accumulationPersonalProportion
+ // 公积金个人缴纳金额
+ this.form.accumulationPersonalAmount = (res.accumulationRadix * (res.accumulationPersonalProportion / 100)).toFixed(2)
+ // 公积金公司缴纳比例
+ this.form.accumulationCompanyProportion = res.accumulationCompanyProportion
+ // 公积金公司缴纳金额
+ this.form.accumulationCompanyAmount = (res.accumulationRadix * (res.accumulationCompanyProportion / 100)).toFixed(2)
+ // 养老险基数
+ this.form.pensionRadix = res.pensionRadix
+ // 养老险个人缴纳比例
+ this.form.pensionPersonalProportion = res.pensionPersonalProportion
+ // 养老险个人缴纳金额
+ this.form.pensionPersonalAmount = (res.pensionRadix * (res.pensionPersonalProportion / 100)).toFixed(2)
+ // 养老险公司缴纳比例
+ this.form.pensionCompanyProportion = res.pensionCompanyProportion
+ // 养老险公司缴纳金额
+ this.form.pensionCompanyAmount = (res.pensionRadix * (res.pensionCompanyProportion / 100)).toFixed(2)
+ // 医疗险基数
+ this.form.medicalRadix = res.medicalRadix
+ // 医疗险个人缴纳比例
+ this.form.medicalPersonalProportion = res.medicalPersonalProportion
+ // 医疗险个人缴纳金额
+ this.form.medicalPersonalAmount = (res.medicalRadix * (res.medicalPersonalProportion / 100)).toFixed(2)
+ // 医疗险公司缴纳比例
+ this.form.medicalCompanyProportion = res.medicalCompanyProportion
+ // 医疗险公司缴纳金额
+ this.form.medicalCompanyAmount = (res.medicalRadix * (res.medicalCompanyProportion / 100)).toFixed(2)
+ // 失业险基数
+ this.form.unemploymentRadix = res.unemploymentRadix
+ // 失业险个人缴纳比例
+ this.form.unemploymentPersonalProportion = res.unemploymentPersonalProportion
+ // 失业险个人缴纳金额
+ this.form.unemploymentPersonalAmount = (res.unemploymentRadix * (res.unemploymentPersonalProportion / 100)).toFixed(2)
+ // 失业险公司缴纳比例
+ this.form.unemploymentCompanyProportion = res.unemploymentCompanyProportion
+ // 失业险公司缴纳金额
+ this.form.unemploymentCompanyAmount = (res.unemploymentRadix * (res.unemploymentCompanyProportion / 100)).toFixed(2)
+ // 生育险基数
+ this.form.maternityRadix = res.maternityRadix
+ // 生育险个人缴纳比例
+ this.form.maternityPersonalProportion = res.maternityPersonalProportion
+ // 生育险个人缴纳金额
+ this.form.maternityPersonalAmount = (res.maternityRadix * (res.maternityPersonalProportion / 100)).toFixed(2)
+ // 生育险公司缴纳比例
+ this.form.maternityCompanyProportion = res.maternityCompanyProportion
+ // 生育险公司缴纳金额
+ this.form.maternityCompanyAmount = (res.maternityRadix * (res.maternityCompanyProportion / 100)).toFixed(2)
+ // 工伤险基数
+ this.form.industrialInjuryRadix = res.industrialInjuryRadix
+ // 工伤险个人缴纳比例
+ this.form.industrialInjuryPersonalProportion = res.industrialInjuryPersonalProportion
+ // 工伤险个人缴纳金额
+ this.form.industrialInjuryPersonalAmount = (res.industrialInjuryRadix * (res.industrialInjuryPersonalProportion / 100)).toFixed(2)
+ // 工伤险公司缴纳比例
+ this.form.industrialInjuryCompanyProportion = res.industrialInjuryCompanyProportion
+ // 工伤险公司缴纳金额
+ this.form.industrialInjuryCompanyAmount = (res.industrialInjuryRadix * (res.industrialInjuryCompanyProportion / 100)).toFixed(2)
+ // 随机数
+ this.random = Math.random()
+ })
+ },
+ // 获取用户级别其他
+ getUserLevelOther() {
+ // 获取用户级别其他
+ crudUserLevelOther.getTargetYearMonth({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
+ // 个人业绩比例
+ this.form.personalPerformanceProportion = res.personalPerformanceProportion
+ })
+ },
+ // 获取工作天数
+ getWorkDays() {
+ // 获取工作天数
+ crudSalary.workDays({ targetYearMonth: this.form.salaryYearMonth }).then(res => {
+ // 全勤小时数
+ this.form.fullDays = res * 8
+ // 应完成绩效工时
+ this.form.needCompletedAchievementsHours = res * 8
+ // 定时器
+ const interval = setInterval(() => {
+ // 判断个人业绩比例是否为空
+ if (this.form.personalPerformanceProportion != null && this.form.personalPerformanceProportion !== '') {
+ // 应完成业绩工时
+ this.form.needCompletedPerformanceHours = res * 8 * (1 + Number(this.form.personalPerformanceProportion) / 100)
+ // 清空定时器
+ clearInterval(interval)
+ }
+ }, 500)
+ })
+ },
+ // 获取出勤天数
+ getAttendanceDays() {
+
+ }
+ }
+}
+</script>
+
+<style scoped>
+
+</style>
--
Gitblit v1.9.3