From 6ce54886f77a679ed1e4d7e0e96e9c0602eca263 Mon Sep 17 00:00:00 2001
From: churf <123456>
Date: Wed, 06 Sep 2023 03:28:11 +0000
Subject: [PATCH] Merge branch 'ZLH-new' into crf
---
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/rest/NewSalaryController.java | 131 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/UserLevelWageRepository.java | 1
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/dto/UserInsuranceQueryCriteria.java | 2
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/domain/NewSalary.java | 323 +++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/domain/UserInsurance.java | 4
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/NewSalaryQueryCriteria.java | 53
eladmin-web-master/src/api/treatment/userLevelWage.js | 10
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/dto/UserLevelWageQueryCriteria.java | 2
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/mapstruct/NewSalaryMapper.java | 31
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/UserInsuranceService.java | 9
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/NewSalaryDto.java | 319 ++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/rest/UserLevelWageController.java | 67
eladmin-web-master/src/views/salary/newSalary/index.vue | 1729 +++++++++++++++++++++++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/UserLevelWageService.java | 9
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/repository/NewSalaryRepository.java | 51
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/NewSalaryService.java | 133 ++
eladmin-web-master/src/api/salary/newSalary.js | 67 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/impl/UserLevelWageServiceImpl.java | 156 +-
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/impl/NewSalaryServiceImpl.java | 665 ++++++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/impl/UserInsuranceServiceImpl.java | 27
20 files changed, 3,679 insertions(+), 110 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/domain/NewSalary.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/domain/NewSalary.java
new file mode 100644
index 0000000..cbec7c0
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/domain/NewSalary.java
@@ -0,0 +1,323 @@
+/*
+* 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 cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.bean.copier.CopyOptions;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import me.zhengjie.base.BaseEntity;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+
+/**
+ * @author ZLH
+ * @date 2023-08-23
+ **/
+@Entity
+@Data
+@Table(name="new_salary")
+public class NewSalary 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 Timestamp salaryYearMonth;
+
+ @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`",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`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "业绩工资")
+ private BigDecimal performanceWage;
+
+ @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`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "团队工资")
+ private BigDecimal teamWage;
+
+ @Column(name = "`actual_compliance_team_hours`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "实达标团队工时")
+ private Double actualComplianceTeamHours;
+
+ @Column(name = "`already_completed_team_hours`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "已完成团队工时")
+ private Double alreadyCompletedTeamHours;
+
+ @Column(name = "`actual_team_wage`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "实际团队工资")
+ private BigDecimal actualTeamWage;
+
+ @Column(name = "`piece_rate`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "计件工资")
+ private BigDecimal pieceRate;
+
+ @Column(name = "`accumulation_fund`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "公积金基数")
+ private BigDecimal accumulationFund = BigDecimal.ZERO;
+
+ @Column(name = "`accumulation_fund_personal`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "公积金个人比例")
+ private Double accumulationFundPersonal = 0.0D;
+
+ @Column(name = "`accumulation_fund_personal_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "公积金个人缴纳金额")
+ private BigDecimal accumulationFundPersonalAmount = BigDecimal.ZERO;
+
+ @Column(name = "`accumulation_fund_company`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "公积金公司比例")
+ private Double accumulationFundCompany = 0.0D;
+
+ @Column(name = "`accumulation_fund_company_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "公积金公司缴纳金额")
+ private BigDecimal accumulationFundCompanyAmount = BigDecimal.ZERO;
+
+ @Column(name = "`retirement_insurance`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "养老险基数")
+ private BigDecimal retirementInsurance = BigDecimal.ZERO;
+
+ @Column(name = "`retirement_insurance_personal`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "养老险个人比例")
+ private Double retirementInsurancePersonal = 0.0D;
+
+ @Column(name = "`retirement_insurance_personal_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "养老险个人缴纳金额")
+ private BigDecimal retirementInsurancePersonalAmount;
+
+ @Column(name = "`retirement_insurance_company`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "养老险公司比例")
+ private Double retirementInsuranceCompany = 0.0D;
+
+ @Column(name = "`retirement_insurance_company_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "养老险公司缴纳金额")
+ private BigDecimal retirementInsuranceCompanyAmount;
+
+ @Column(name = "`medical_insurance`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "医疗险基数")
+ private BigDecimal medicalInsurance = BigDecimal.ZERO;
+
+ @Column(name = "`medical_insurance_personal`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "医疗险个人比例")
+ private Double medicalInsurancePersonal = 0.0D;
+
+ @Column(name = "`medical_insurance_personal_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "医疗险个人缴纳金额")
+ private BigDecimal medicalInsurancePersonalAmount;
+
+ @Column(name = "`medical_insurance_company`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "医疗险公司比例")
+ private Double medicalInsuranceCompany = 0.0D;
+
+ @Column(name = "`medical_insurance_company_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "医疗险公司缴纳金额")
+ private BigDecimal medicalInsuranceCompanyAmount;
+
+ @Column(name = "`unemployment_insurance`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "失业险基数")
+ private BigDecimal unemploymentInsurance = BigDecimal.ZERO;
+
+ @Column(name = "`unemployment_insurance_personal`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "失业险个人比例")
+ private Double unemploymentInsurancePersonal = 0.0D;
+
+ @Column(name = "`unemployment_insurance_personal_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "失业险个人缴纳金额")
+ private BigDecimal unemploymentInsurancePersonalAmount;
+
+ @Column(name = "`unemployment_insurance_company`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "失业险公司比例")
+ private Double unemploymentInsuranceCompany = 0.0D;
+
+ @Column(name = "`unemployment_insurance_company_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "失业险公司缴纳金额")
+ private BigDecimal unemploymentInsuranceCompanyAmount;
+
+ @Column(name = "`birth_insurance`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "生育险基数")
+ private BigDecimal birthInsurance = BigDecimal.ZERO;
+
+ @Column(name = "`birth_insurance_personal`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "生育险个人比例")
+ private Double birthInsurancePersonal = 0.0D;
+
+ @Column(name = "`birth_insurance_personal_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "生育险个人缴纳金额")
+ private BigDecimal birthInsurancePersonalAmount;
+
+ @Column(name = "`birth_insurance_company`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "生育险公司比例")
+ private Double birthInsuranceCompany = 0.0D;
+
+ @Column(name = "`birth_insurance_company_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "生育险公司缴纳金额")
+ private BigDecimal birthInsuranceCompanyAmount;
+
+ @Column(name = "`employment_insurance`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "工伤险基数")
+ private BigDecimal employmentInsurance = BigDecimal.ZERO;
+
+ @Column(name = "`employment_insurance_personal`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "工伤险个人比例")
+ private Double employmentInsurancePersonal = 0.0D;
+
+ @Column(name = "`employment_insurance_personal_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "工伤险个人缴纳金额")
+ private BigDecimal employmentInsurancePersonalAmount;
+
+ @Column(name = "`employment_insurance_company`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "工伤险公司比例")
+ private Double employmentInsuranceCompany = 0.0D;
+
+ @Column(name = "`employment_insurance_company_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "工伤险公司缴纳金额")
+ private BigDecimal employmentInsuranceCompanyAmount;
+
+ @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;
+
+ @Column(name = "`publicity_status`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "公示状态")
+ private String publicityStatus;
+
+ @Column(name = "`approve_status`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "承认状态")
+ private String approveStatus;
+
+ public void copy(NewSalary source){
+ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
+ }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/repository/NewSalaryRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/repository/NewSalaryRepository.java
new file mode 100644
index 0000000..507bbb4
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/repository/NewSalaryRepository.java
@@ -0,0 +1,51 @@
+/*
+ * 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.NewSalary;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+
+import java.sql.Timestamp;
+import java.util.List;
+
+/**
+ * @author ZLH
+ * @date 2023-08-23
+ **/
+public interface NewSalaryRepository extends JpaRepository<NewSalary, Long>, JpaSpecificationExecutor<NewSalary> {
+
+ /**
+ * 根据用户ID和工资年月查询
+ *
+ * @param userId
+ * @param salaryYearMonth
+ * @return
+ */
+ List<NewSalary> findByUserIdAndSalaryYearMonth(Long userId, Timestamp salaryYearMonth);
+
+ /**
+ * 根据用户ID和工资年月删除
+ *
+ * @param userId
+ * @param salaryYearMonth
+ */
+ @Modifying
+ @Query(value = "DELETE FROM salary WHERE user_id = ?1 AND salary_year_month LIKE CONCAT(?2, '%')", nativeQuery = true)
+ void deleteByUserIdAndSalaryYearMonth(Long userId, String salaryYearMonth);
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/rest/NewSalaryController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/rest/NewSalaryController.java
new file mode 100644
index 0000000..7dc87ff
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/rest/NewSalaryController.java
@@ -0,0 +1,131 @@
+/*
+ * 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 io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.annotation.Log;
+import me.zhengjie.modules.salary.domain.NewSalary;
+import me.zhengjie.modules.salary.service.NewSalaryService;
+import me.zhengjie.modules.salary.service.dto.NewSalaryQueryCriteria;
+import org.springframework.data.domain.Pageable;
+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 javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author ZLH
+ * @date 2023-08-23
+ **/
+@RestController
+@RequiredArgsConstructor
+@Api(tags = "工资记录管理")
+@RequestMapping("/api/newSalary")
+public class NewSalaryController {
+
+ private final NewSalaryService newSalaryService;
+
+ @Log("导出数据")
+ @ApiOperation("导出数据")
+ @GetMapping(value = "/download")
+ @PreAuthorize("@el.check('newSalary:download')")
+ public void exportNewSalary(HttpServletResponse response, NewSalaryQueryCriteria criteria) throws IOException {
+ newSalaryService.download(newSalaryService.queryAll(criteria), response);
+ }
+
+ @GetMapping
+ @Log("查询工资记录")
+ @ApiOperation("查询工资记录")
+ @PreAuthorize("@el.check('newSalary:list')")
+ public ResponseEntity<Object> queryNewSalary(NewSalaryQueryCriteria criteria, Pageable pageable) {
+ return new ResponseEntity<>(newSalaryService.queryAll(criteria, pageable), HttpStatus.OK);
+ }
+
+ @GetMapping(value = "/all")
+ @Log("查询工资记录")
+ @ApiOperation("查询工资记录")
+ @PreAuthorize("@el.check('newSalary:list')")
+ public ResponseEntity<Object> queryNewSalary(NewSalaryQueryCriteria criteria) {
+ return new ResponseEntity<>(newSalaryService.queryAll(criteria), HttpStatus.OK);
+ }
+
+ @PostMapping
+ @Log("新增工资记录")
+ @ApiOperation("新增工资记录")
+ @PreAuthorize("@el.check('newSalary:add')")
+ public ResponseEntity<Object> createNewSalary(@Validated @RequestBody NewSalary resources) {
+ return new ResponseEntity<>(newSalaryService.create(resources), HttpStatus.CREATED);
+ }
+
+ @PutMapping
+ @Log("修改工资记录")
+ @ApiOperation("修改工资记录")
+ @PreAuthorize("@el.check('newSalary:edit')")
+ public ResponseEntity<Object> updateNewSalary(@Validated @RequestBody NewSalary resources) {
+ newSalaryService.update(resources);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @DeleteMapping
+ @Log("删除工资记录")
+ @ApiOperation("删除工资记录")
+ @PreAuthorize("@el.check('newSalary:del')")
+ public ResponseEntity<Object> deleteNewSalary(@RequestBody Long[] ids) {
+ newSalaryService.deleteAll(ids);
+ return new ResponseEntity<>(HttpStatus.OK);
+ }
+
+ @GetMapping(value = "/workDays")
+ @Log("查询某月工作天数")
+ @ApiOperation("查询某月工作天数")
+ @PreAuthorize("@el.check('newSalary:list')")
+ public ResponseEntity<Object> queryWorkDays(NewSalaryQueryCriteria criteria) {
+ return new ResponseEntity<>(newSalaryService.queryWorkDays(criteria), HttpStatus.OK);
+ }
+
+ @PutMapping(value = "/publicity")
+ @Log("公示工资记录")
+ @ApiOperation("公示工资记录")
+ @PreAuthorize("@el.check('newSalary:publicity')")
+ public ResponseEntity<Object> publicityNewSalary(@RequestBody Long[] ids) {
+ newSalaryService.publicity(ids);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @PutMapping(value = "/approve")
+ @Log("承认工资记录")
+ @ApiOperation("承认工资记录")
+ @PreAuthorize("@el.check('newSalary:approve')")
+ public ResponseEntity<Object> approveNewSalary(@RequestBody Long[] ids) {
+ newSalaryService.approve(ids);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @PutMapping(value = "/generate")
+ @Log("生成工资记录")
+ @ApiOperation("生成工资记录")
+ @PreAuthorize("@el.check('newSalary:generate')")
+ public ResponseEntity<Object> generateNewSalary(@Validated @RequestBody NewSalaryQueryCriteria criteria) {
+ newSalaryService.generate(criteria);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/NewSalaryService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/NewSalaryService.java
new file mode 100644
index 0000000..2403bbc
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/NewSalaryService.java
@@ -0,0 +1,133 @@
+/*
+ * 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.NewSalary;
+import me.zhengjie.modules.salary.service.dto.NewSalaryDto;
+import me.zhengjie.modules.salary.service.dto.NewSalaryQueryCriteria;
+import org.springframework.data.domain.Pageable;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author ZLH
+ * @date 2023-08-23
+ **/
+public interface NewSalaryService {
+
+ /**
+ * 查询数据分页
+ *
+ * @param criteria 条件
+ * @param pageable 分页参数
+ * @return Map<String, Object>
+ */
+ Map<String, Object> queryAll(NewSalaryQueryCriteria criteria, Pageable pageable);
+
+ /**
+ * 查询所有数据不分页
+ *
+ * @param criteria 条件参数
+ * @return List<SalaryDto>
+ */
+ List<NewSalaryDto> queryAll(NewSalaryQueryCriteria criteria);
+
+ /**
+ * 根据ID查询
+ *
+ * @param id ID
+ * @return SalaryDto
+ */
+ NewSalaryDto findById(Long id);
+
+ /**
+ * 创建
+ *
+ * @param resources /
+ * @return SalaryDto
+ */
+ NewSalaryDto create(NewSalary resources);
+
+ /**
+ * 编辑
+ *
+ * @param resources /
+ */
+ void update(NewSalary resources);
+
+ /**
+ * 多选删除
+ *
+ * @param ids /
+ */
+ void deleteAll(Long[] ids);
+
+ /**
+ * 导出数据
+ *
+ * @param all 待导出的数据
+ * @param response /
+ * @throws IOException /
+ */
+ void download(List<NewSalaryDto> all, HttpServletResponse response) throws IOException;
+
+ /**
+ * 查询某月工作天数
+ *
+ * @param criteria 条件参数
+ * @return List<SalaryDto>
+ */
+ Integer queryWorkDays(NewSalaryQueryCriteria criteria);
+
+ /**
+ * 根据用户ID和工资年月删除
+ *
+ * @param resources
+ */
+ void deleteByUserIdAndSalaryYearMonthAndCreateNew(NewSalary resources);
+
+ /**
+ * 公示工资记录
+ *
+ * @param ids /
+ */
+ void publicity(Long[] ids);
+
+ /**
+ * 承认工资记录
+ *
+ * @param ids /
+ */
+ void approve(Long[] ids);
+
+ /**
+ * 生成工资记录
+ *
+ * @param criteria /
+ */
+ void generate(NewSalaryQueryCriteria criteria);
+
+ /**
+ * 用户工资结算
+ *
+ * @param userId
+ * @param targetYearMonth
+ */
+ void userSalarySettlement(Long userId, String targetYearMonth);
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/NewSalaryDto.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/NewSalaryDto.java
new file mode 100644
index 0000000..f8e2da4
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/NewSalaryDto.java
@@ -0,0 +1,319 @@
+/*
+ * 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 io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import me.zhengjie.base.BaseDTO;
+
+import javax.persistence.Column;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+
+/**
+ * @author ZLH
+ * @date 2023-08-23
+ **/
+@Data
+public class NewSalaryDto extends BaseDTO implements Serializable {
+
+ /**
+ * ID
+ */
+ private Long id;
+
+ /**
+ * 员工ID
+ */
+ private Long userId;
+
+ /**
+ * 工资年月
+ */
+ private Timestamp salaryYearMonth;
+
+ /**
+ * 基本工资
+ */
+ private BigDecimal basicWage;
+
+ /**
+ * 全勤小时数
+ */
+ private Double fullDays;
+
+ /**
+ * 缺勤小时数
+ */
+ private Double absenceDays;
+
+ /**
+ * 实际基础工资
+ */
+ private BigDecimal actualBasicWage;
+
+ /**
+ * 绩效工资
+ */
+ private BigDecimal achievementsWage;
+
+ /**
+ * 应完成绩效工时
+ */
+ private Double needCompletedAchievementsHours;
+
+ /**
+ * 已完成绩效工时
+ */
+ private Double alreadyCompletedAchievementsHours;
+
+ /**
+ * 实际绩效工资
+ */
+ private BigDecimal actualAchievementsWage;
+
+ /**
+ * 业绩工资
+ */
+ private BigDecimal performanceWage;
+
+ /**
+ * 应完成业绩工时
+ */
+ private Double needCompletedPerformanceHours;
+
+ /**
+ * 已完成业绩工时
+ */
+ private Double alreadyCompletedPerformanceHours;
+
+ /**
+ * 实际业绩工资
+ */
+ private BigDecimal actualPerformanceWage;
+
+ /**
+ * 团队工资
+ */
+ private BigDecimal teamWage;
+
+ /**
+ * 实达标团队工时
+ */
+ private Double actualComplianceTeamHours;
+
+ /**
+ * 已完成团队工时
+ */
+ private Double alreadyCompletedTeamHours;
+
+ /**
+ * 实际团队工资
+ */
+ private BigDecimal actualTeamWage;
+
+ /**
+ * 计件工资
+ */
+ private BigDecimal pieceRate;
+
+ /**
+ * 公积金基数
+ */
+ private BigDecimal accumulationFund = BigDecimal.ZERO;
+
+ /**
+ * 公积金个人比例
+ */
+ private Double accumulationFundPersonal = 0.0D;
+
+ /**
+ * 公积金个人缴纳金额
+ */
+ private BigDecimal accumulationFundPersonalAmount = BigDecimal.ZERO;
+
+ /**
+ * 公积金公司比例
+ */
+ private Double accumulationFundCompany = 0.0D;
+
+ /**
+ * 公积金公司缴纳金额
+ */
+ private BigDecimal accumulationFundCompanyAmount = BigDecimal.ZERO;
+
+ /**
+ * 养老险基数
+ */
+ private BigDecimal retirementInsurance = BigDecimal.ZERO;
+
+ /**
+ * 养老险个人比例
+ */
+ private Double retirementInsurancePersonal = 0.0D;
+
+ /**
+ * 养老险个人缴纳金额
+ */
+ private BigDecimal retirementInsurancePersonalAmount;
+
+ /**
+ * 养老险公司比例
+ */
+ private Double retirementInsuranceCompany = 0.0D;
+
+ /**
+ * 养老险公司缴纳金额
+ */
+ private BigDecimal retirementInsuranceCompanyAmount;
+
+ /**
+ * 医疗险基数
+ */
+ private BigDecimal medicalInsurance = BigDecimal.ZERO;
+
+ /**
+ * 医疗险个人比例
+ */
+ private Double medicalInsurancePersonal = 0.0D;
+
+ /**
+ * 医疗险个人缴纳金额
+ */
+ private BigDecimal medicalInsurancePersonalAmount;
+
+ /**
+ * 医疗险公司比例
+ */
+ private Double medicalInsuranceCompany = 0.0D;
+
+ /**
+ * 医疗险公司缴纳金额
+ */
+ private BigDecimal medicalInsuranceCompanyAmount;
+
+ /**
+ * 失业险基数
+ */
+ private BigDecimal unemploymentInsurance = BigDecimal.ZERO;
+
+ /**
+ * 失业险个人比例
+ */
+ private Double unemploymentInsurancePersonal = 0.0D;
+
+ /**
+ * 失业险个人缴纳金额
+ */
+ private BigDecimal unemploymentInsurancePersonalAmount;
+
+ /**
+ * 失业险公司比例
+ */
+ private Double unemploymentInsuranceCompany = 0.0D;
+
+ /**
+ * 失业险公司缴纳金额
+ */
+ private BigDecimal unemploymentInsuranceCompanyAmount;
+
+ /**
+ * 生育险基数
+ */
+ private BigDecimal birthInsurance = BigDecimal.ZERO;
+
+ /**
+ * 生育险个人比例
+ */
+ private Double birthInsurancePersonal = 0.0D;
+
+ /**
+ * 生育险个人缴纳金额
+ */
+ private BigDecimal birthInsurancePersonalAmount;
+
+ /**
+ * 生育险公司比例
+ */
+ private Double birthInsuranceCompany = 0.0D;
+
+ /**
+ * 生育险公司缴纳金额
+ */
+ private BigDecimal birthInsuranceCompanyAmount;
+
+ /**
+ * 工伤险基数
+ */
+ private BigDecimal employmentInsurance = BigDecimal.ZERO;
+
+ /**
+ * 工伤险个人比例
+ */
+ private Double employmentInsurancePersonal = 0.0D;
+
+ /**
+ * 工伤险个人缴纳金额
+ */
+ private BigDecimal employmentInsurancePersonalAmount;
+
+ /**
+ * 工伤险公司比例
+ */
+ private Double employmentInsuranceCompany = 0.0D;
+
+ /**
+ * 工伤险公司缴纳金额
+ */
+ private BigDecimal employmentInsuranceCompanyAmount;
+
+ /**
+ * 税前金额
+ */
+ private BigDecimal preTaxAmount;
+
+ /**
+ * 个人所得税
+ */
+ private BigDecimal individualIncomeTax;
+
+ /**
+ * 税后金额
+ */
+ private BigDecimal afterTaxAmount;
+
+ /**
+ * 备注
+ */
+ private String remarks;
+
+ /**
+ * 公示状态
+ */
+ private String publicityStatus;
+
+ /**
+ * 承认状态
+ */
+ private String approveStatus;
+
+ /**
+ * 用户昵称
+ */
+ 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/NewSalaryQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/NewSalaryQueryCriteria.java
new file mode 100644
index 0000000..cf63fd1
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/NewSalaryQueryCriteria.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2019-2020 Zheng Jie
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package me.zhengjie.modules.salary.service.dto;
+
+import lombok.Data;
+import me.zhengjie.annotation.Query;
+
+/**
+ * @author ZLH
+ * @date 2023-08-23
+ **/
+@Data
+public class NewSalaryQueryCriteria {
+
+ /**
+ * 精确
+ */
+ @Query
+ private Long userId;
+
+ /**
+ * 模糊
+ */
+ @Query(type = Query.Type.INNER_LIKE)
+ private String salaryYearMonth;
+
+ /**
+ * 精确
+ */
+ @Query
+ private String publicityStatus;
+
+ /**
+ * 精确
+ */
+ @Query
+ private String approveStatus;
+
+ 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/NewSalaryServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/impl/NewSalaryServiceImpl.java
new file mode 100644
index 0000000..eb8f86e
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/impl/NewSalaryServiceImpl.java
@@ -0,0 +1,665 @@
+/*
+ * 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 lombok.RequiredArgsConstructor;
+import me.zhengjie.exception.BadRequestException;
+import me.zhengjie.modules.attendance.service.AttendanceService;
+import me.zhengjie.modules.attendance.service.dto.AttendanceQueryCriteria;
+import me.zhengjie.modules.constant.Constant;
+import me.zhengjie.modules.project.service.ProjectPerformanceDetailService;
+import me.zhengjie.modules.project.service.dto.ProjectPerformanceDetailQueryCriteria;
+import me.zhengjie.modules.salary.domain.NewSalary;
+import me.zhengjie.modules.salary.repository.NewSalaryRepository;
+import me.zhengjie.modules.salary.service.NewSalaryService;
+import me.zhengjie.modules.salary.service.dto.NewSalaryDto;
+import me.zhengjie.modules.salary.service.dto.NewSalaryQueryCriteria;
+import me.zhengjie.modules.salary.service.mapstruct.NewSalaryMapper;
+import me.zhengjie.modules.system.domain.SysConfigHoliday;
+import me.zhengjie.modules.system.domain.User;
+import me.zhengjie.modules.system.repository.DictDetailRepository;
+import me.zhengjie.modules.system.repository.SysConfigHolidayRepository;
+import me.zhengjie.modules.system.repository.UserRepository;
+import me.zhengjie.modules.system.service.*;
+import me.zhengjie.modules.system.service.dto.*;
+import me.zhengjie.modules.task.service.TaskDaliyService;
+import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria;
+import me.zhengjie.modules.treatment.domain.UserLevelWage;
+import me.zhengjie.modules.treatment.service.UserInsuranceService;
+import me.zhengjie.modules.treatment.service.UserLevelWageService;
+import me.zhengjie.modules.treatment.service.dto.UserInsuranceDto;
+import me.zhengjie.modules.treatment.service.dto.UserInsuranceQueryCriteria;
+import me.zhengjie.modules.treatment.service.dto.UserLevelWageDto;
+import me.zhengjie.modules.treatment.service.dto.UserLevelWageQueryCriteria;
+import me.zhengjie.utils.*;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+/**
+ * @author ZLH
+ * @date 2023-08-23
+ **/
+@Service
+@RequiredArgsConstructor
+public class NewSalaryServiceImpl implements NewSalaryService {
+
+ private final NewSalaryRepository newSalaryRepository;
+ private final NewSalaryMapper newSalaryMapper;
+ private final UserRepository userRepository;
+ private final SysConfigHolidayRepository sysConfigHolidayRepository;
+ private final RoleService roleService;
+ private final DictDetailRepository dictDetailRepository;
+ // ==================== 以下为定时生成工资记录主要依赖 ====================
+ private final UserService userService;
+ private final UserLevelWageService userLevelWageService;
+ private final UserInsuranceService userInsuranceService;
+ private final SysUserLevelOtherService sysUserLevelOtherService;
+ private final AttendanceService attendanceService;
+ private final TaskDaliyService taskDaliyService;
+ private final SysConfigIndividualIncomeTaxService sysConfigIndividualIncomeTaxService;
+ private final ProjectPerformanceDetailService projectPerformanceDetailService;
+ // ==================== 以上为定时生成工资记录主要依赖 ====================
+
+ @Override
+ public Map<String, Object> queryAll(NewSalaryQueryCriteria criteria, Pageable pageable) {
+ // 判断工资查询类工资年月是否为空
+ if (criteria.getSalaryYearMonth() != null && !"".equals(criteria.getSalaryYearMonth())) {
+ // 工资年月:国际时间转中国时间
+ criteria.setSalaryYearMonth(DateUtil.internationalTimeToChinaTime(criteria.getSalaryYearMonth()));
+ }
+ // 获取登录用户角色等级
+ List<Integer> levels = roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList());
+ // 登录用户最大角色等级
+ int min = Collections.min(levels);
+ // 判断角色等级
+ if (min == Constant.ROLE_LEVEL_MANAGER || min == Constant.ROLE_LEVEL_LEADER || min == Constant.ROLE_LEVEL_ORDINARY) {
+ // 工资查询类
+ criteria.setUserId(SecurityUtils.getCurrentUserId());
+ criteria.setPublicityStatus(Constant.PUBLICITY_STATUS_YES);
+ }
+ Page<NewSalary> page = newSalaryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
+ // 将实体类转换为DTO(重写)
+ Function<NewSalary, NewSalaryDto> func = new Function<NewSalary, NewSalaryDto>() {
+ @Override
+ public NewSalaryDto apply(NewSalary t) {
+ // 将实体类转换成DTO
+ NewSalaryDto newSalaryDto = newSalaryMapper.toDto(t);
+ // 根据用户ID查询用户信息
+ User user = userRepository.findById(newSalaryDto.getUserId()).orElseGet(User::new);
+ ValidationUtil.isNull(user.getId(), "User", "id", newSalaryDto.getUserId());
+ // 用户昵称
+ newSalaryDto.setUserNickName(user.getNickName());
+ // 返回处理好的DTO
+ return newSalaryDto;
+ }
+ };
+ return PageUtil.toPage(page.map(func));
+ }
+
+ @Override
+ public List<NewSalaryDto> queryAll(NewSalaryQueryCriteria criteria) {
+ return newSalaryMapper.toDto(newSalaryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
+ }
+
+ @Override
+ @Transactional
+ public NewSalaryDto findById(Long id) {
+ NewSalary newSalary = newSalaryRepository.findById(id).orElseGet(NewSalary::new);
+ ValidationUtil.isNull(newSalary.getId(), "NewSalary", "id", id);
+ return newSalaryMapper.toDto(newSalary);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public NewSalaryDto create(NewSalary resources) {
+ // 根据用户ID和工资年月查询
+ List<NewSalary> newSalaryList = newSalaryRepository.findByUserIdAndSalaryYearMonth(resources.getUserId(), resources.getSalaryYearMonth());
+ // 判断列表长度
+ if (newSalaryList.size() > 0) {
+ throw new BadRequestException("找到相同用户相同年月的工资记录!");
+ }
+ return newSalaryMapper.toDto(newSalaryRepository.save(resources));
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(NewSalary resources) {
+ // 根据用户ID和工资年月查询
+ List<NewSalary> newSalaryList = newSalaryRepository.findByUserIdAndSalaryYearMonth(resources.getUserId(), resources.getSalaryYearMonth());
+ // 判断列表长度
+ if (newSalaryList.size() > 1) {
+ throw new BadRequestException("找到相同用户相同年月的工资记录!");
+ } else if (newSalaryList.size() == 1) {
+ // 判断是否是同一条记录
+ if (newSalaryList.get(0).getId().longValue() != resources.getId().longValue()) {
+ throw new BadRequestException("找到相同用户相同年月的工资记录!");
+ }
+ }
+ NewSalary newSalary = newSalaryRepository.findById(resources.getId()).orElseGet(NewSalary::new);
+ // 判断承认状态
+ if (Constant.APPROVE_STATUS_ACKNOWLEDGED.equals(newSalary.getApproveStatus())) {
+ throw new BadRequestException("已承认的工资记录无法进行修改!");
+ }
+ ValidationUtil.isNull(newSalary.getId(), "Salary", "id", resources.getId());
+ newSalary.copy(resources);
+ newSalaryRepository.save(newSalary);
+ }
+
+ @Override
+ public void deleteAll(Long[] ids) {
+ for (Long id : ids) {
+ newSalaryRepository.deleteById(id);
+ }
+ }
+
+ @Override
+ public void download(List<NewSalaryDto> all, HttpServletResponse response) throws IOException {
+ List<Map<String, Object>> list = new ArrayList<>();
+ for (NewSalaryDto newSalaryDto : all) {
+ String userNickName = newSalaryDto.getUserId() != null ? userRepository.findById(newSalaryDto.getUserId()).orElseGet(User::new).getNickName() : "";
+ String publicityStatus = newSalaryDto.getPublicityStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PUBLICITY_STATUS, newSalaryDto.getPublicityStatus()).getLabel() : "";
+ String approveStatus = newSalaryDto.getApproveStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.APPROVE_STATUS, newSalaryDto.getApproveStatus()).getLabel() : "";
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("员工姓名", userNickName);
+ map.put("工资年月", newSalaryDto.getSalaryYearMonth());
+ map.put("基本工资", newSalaryDto.getBasicWage());
+ map.put("全勤小时数", newSalaryDto.getFullDays());
+ map.put("缺勤小时数", newSalaryDto.getAbsenceDays());
+ map.put("实际基础工资", newSalaryDto.getActualBasicWage());
+ map.put("绩效工资", newSalaryDto.getAchievementsWage());
+ map.put("应完成绩效工时", newSalaryDto.getNeedCompletedAchievementsHours());
+ map.put("已完成绩效工时", newSalaryDto.getAlreadyCompletedAchievementsHours());
+ map.put("实际绩效工资", newSalaryDto.getActualAchievementsWage());
+ map.put("业绩工资", newSalaryDto.getPerformanceWage());
+ map.put("应完成业绩工时", newSalaryDto.getNeedCompletedPerformanceHours());
+ map.put("已完成业绩工时", newSalaryDto.getAlreadyCompletedPerformanceHours());
+ map.put("实际业绩工资", newSalaryDto.getActualPerformanceWage());
+ map.put("团队工资", newSalaryDto.getTeamWage());
+ map.put("实达标团队工时", newSalaryDto.getActualComplianceTeamHours());
+ map.put("已完成团队工时", newSalaryDto.getAlreadyCompletedTeamHours());
+ map.put("实际团队工资", newSalaryDto.getActualTeamWage());
+ map.put("公积金基数", newSalaryDto.getAccumulationFund());
+ map.put("公积金个人缴纳比例", newSalaryDto.getAccumulationFundPersonal());
+ map.put("公积金个人缴纳金额", newSalaryDto.getAccumulationFundPersonalAmount());
+ map.put("公积金公司缴纳比例", newSalaryDto.getAccumulationFundCompany());
+ map.put("公积金公司缴纳金额", newSalaryDto.getAccumulationFundCompanyAmount());
+ map.put("养老险基数", newSalaryDto.getRetirementInsurance());
+ map.put("养老险个人缴纳比例", newSalaryDto.getRetirementInsurancePersonal());
+ map.put("养老险个人缴纳金额", newSalaryDto.getRetirementInsurancePersonalAmount());
+ map.put("养老险公司缴纳比例", newSalaryDto.getRetirementInsuranceCompany());
+ map.put("养老险公司缴纳金额", newSalaryDto.getRetirementInsuranceCompanyAmount());
+ map.put("医疗险基数", newSalaryDto.getMedicalInsurance());
+ map.put("医疗险个人缴纳比例", newSalaryDto.getMedicalInsurancePersonal());
+ map.put("医疗险个人缴纳金额", newSalaryDto.getMedicalInsurancePersonalAmount());
+ map.put("医疗险公司缴纳比例", newSalaryDto.getMedicalInsuranceCompany());
+ map.put("医疗险公司缴纳金额", newSalaryDto.getMedicalInsuranceCompanyAmount());
+ map.put("失业险基数", newSalaryDto.getUnemploymentInsurance());
+ map.put("失业险个人缴纳比例", newSalaryDto.getUnemploymentInsurancePersonal());
+ map.put("失业险个人缴纳金额", newSalaryDto.getUnemploymentInsurancePersonalAmount());
+ map.put("失业险公司缴纳比例", newSalaryDto.getUnemploymentInsuranceCompany());
+ map.put("失业险公司缴纳金额", newSalaryDto.getUnemploymentInsuranceCompanyAmount());
+ map.put("生育险基数", newSalaryDto.getBirthInsurance());
+ map.put("生育险个人缴纳比例", newSalaryDto.getBirthInsurancePersonal());
+ map.put("生育险个人缴纳金额", newSalaryDto.getBirthInsurancePersonalAmount());
+ map.put("生育险公司缴纳比例", newSalaryDto.getBirthInsuranceCompany());
+ map.put("生育险公司缴纳金额", newSalaryDto.getBirthInsuranceCompanyAmount());
+ map.put("工伤险基数", newSalaryDto.getEmploymentInsurance());
+ map.put("工伤险个人缴纳比例", newSalaryDto.getEmploymentInsurancePersonal());
+ map.put("工伤险个人缴纳金额", newSalaryDto.getEmploymentInsurancePersonalAmount());
+ map.put("工伤险公司缴纳比例", newSalaryDto.getEmploymentInsuranceCompany());
+ map.put("工伤险公司缴纳金额", newSalaryDto.getEmploymentInsuranceCompanyAmount());
+ map.put("税前金额", newSalaryDto.getPreTaxAmount());
+ map.put("个人所得税", newSalaryDto.getIndividualIncomeTax());
+ map.put("税后金额", newSalaryDto.getAfterTaxAmount());
+ map.put("备注", newSalaryDto.getRemarks());
+ map.put("公示状态", publicityStatus);
+ map.put("承认状态", approveStatus);
+ map.put("创建者", newSalaryDto.getCreateBy());
+ map.put("创建时间", newSalaryDto.getCreateTime());
+ map.put("更新者", newSalaryDto.getUpdateBy());
+ map.put("更新时间", newSalaryDto.getUpdateTime());
+ list.add(map);
+ }
+ FileUtil.downloadExcel(list, response);
+ }
+
+ @Override
+ public Integer queryWorkDays(NewSalaryQueryCriteria 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);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void deleteByUserIdAndSalaryYearMonthAndCreateNew(NewSalary resources) {
+ // 根据用户ID和工资年月删除
+ newSalaryRepository.deleteByUserIdAndSalaryYearMonth(resources.getUserId(), resources.getSalaryYearMonth().toString().substring(0, 7));
+ // 保存
+ newSalaryRepository.save(resources);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void publicity(Long[] ids) {
+ // 循环ID列表
+ for (Long id : ids) {
+ // 查询工资
+ NewSalary newSalary = newSalaryRepository.findById(id).orElseGet(NewSalary::new);
+ ValidationUtil.isNull(newSalary.getId(), "Salary", "id", id);
+ // 公示状态
+ newSalary.setPublicityStatus(Constant.PUBLICITY_STATUS_YES);
+ // 保存
+ newSalaryRepository.save(newSalary);
+ }
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void approve(Long[] ids) {
+ // 循环ID列表
+ for (Long id : ids) {
+ // 查询工资
+ NewSalary newSalary = newSalaryRepository.findById(id).orElseGet(NewSalary::new);
+ ValidationUtil.isNull(newSalary.getId(), "Salary", "id", id);
+ // 承认状态
+ newSalary.setApproveStatus(Constant.APPROVE_STATUS_ACKNOWLEDGED);
+ // 保存
+ newSalaryRepository.save(newSalary);
+ }
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void generate(NewSalaryQueryCriteria criteria) {
+ // 用户工资结算
+ userSalarySettlement(criteria.getUserId(), DateUtil.internationalTimeToChinaTime(criteria.getTargetYearMonth()));
+ }
+
+ // ==================== 以下为定时生成工资记录主要逻辑 ====================
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void userSalarySettlement(Long userId, String targetYearMonth) {
+ // 判断用户ID是否为空
+ if (userId != null) {
+ // 单个用户工资结算
+ singleUserSalarySettlement(userId, targetYearMonth);
+ } else {
+ // 用户检索类
+ UserQueryCriteria userQueryCriteria = new UserQueryCriteria();
+ userQueryCriteria.setEnabled(true);
+ // 获取用户列表
+ List<UserDto> userDtoList = userService.queryAll(userQueryCriteria);
+ // 循环用户列表
+ for (int i = 0; i < userDtoList.size(); i++) {
+ try {
+ // 单个用户工资结算
+ singleUserSalarySettlement(userDtoList.get(i).getId(), targetYearMonth);
+ } catch (Exception e) {
+ // 跳过本次循环
+ continue;
+ }
+ }
+ }
+ }
+
+ // 单个用户工资结算
+ private void singleUserSalarySettlement(Long userId, String targetYearMonth) {
+ // 日历类
+ Calendar cal = Calendar.getInstance();
+ // 设置年份
+ cal.set(Calendar.YEAR, Integer.valueOf(targetYearMonth.substring(0, 4)));
+ // 设置月份
+ cal.set(Calendar.MONTH, Integer.valueOf(targetYearMonth.substring(5, 7)) - 1);
+ // 设置日份
+ cal.set(Calendar.DAY_OF_MONTH, 1);
+ // 设置时数
+ cal.set(Calendar.HOUR_OF_DAY, 0);
+ // 设置分数
+ cal.set(Calendar.MINUTE, 0);
+ // 设置秒数
+ cal.set(Calendar.SECOND, 0);
+ // 设置毫秒数
+ cal.set(Calendar.MILLISECOND, 0);
+ // 工资实体类
+ NewSalary newSalary = new NewSalary();
+ newSalary.setUserId(userId);
+ newSalary.setSalaryYearMonth(new Timestamp(cal.getTime().getTime()));
+ newSalary.setPublicityStatus(Constant.PUBLICITY_STATUS_NOT);
+ newSalary.setApproveStatus(Constant.APPROVE_STATUS_UNRECOGNIZED);
+ // 获取用户级别工资
+ newSalary = getUserLevelWage(userId, targetYearMonth, newSalary);
+ // 获取用户级别保险
+ newSalary = getUserLevelInsurance(userId, targetYearMonth, newSalary);
+ // 获取用户级别其他
+ newSalary = getUserLevelOther(userId, targetYearMonth, newSalary);
+ // 获取工作天数
+ newSalary = getWorkDays(targetYearMonth, newSalary);
+ // 获取出勤小时数
+ newSalary = getAttendanceHours(userId, targetYearMonth, newSalary);
+ // 获取达标工时
+ newSalary = getComplianceWork(userId, targetYearMonth, newSalary);
+ // 获取已完成工时
+ newSalary = getCompletedWork(userId, targetYearMonth, newSalary);
+ try {
+ // 保存
+ create(newSalary);
+ } catch (Exception e) {
+ // 删除
+ deleteByUserIdAndSalaryYearMonthAndCreateNew(newSalary);
+ }
+ }
+
+ // 获取用户级别工资
+ private NewSalary getUserLevelWage(Long userId, String targetYearMonth, NewSalary newSalary) {
+ // 用户级别工资检索类
+ UserLevelWageQueryCriteria userLevelWageQueryCriteria = new UserLevelWageQueryCriteria();
+ userLevelWageQueryCriteria.setUserId(userId);
+ userLevelWageQueryCriteria.setTargetYearMonth(targetYearMonth);
+ // 查询指定年月用户级别工资
+ UserLevelWageDto userLevelWageDto = userLevelWageService.queryTargetYearMonth(userLevelWageQueryCriteria);
+ // 级别基本工资
+ BigDecimal basicWage = userLevelWageDto.getBasicWage();
+ // 级别等级工资
+ BigDecimal rankWage = userLevelWageDto.getRankWage();
+ // 设置工资条的基本工资
+ newSalary.setBasicWage(basicWage.add(rankWage));
+ // 绩效工资
+ BigDecimal performanceWage = userLevelWageDto.getPerformanceWage();
+ // 设置工资条的基本工资
+ newSalary.setAchievementsWage(performanceWage);
+ // 设置工资条的业绩工资
+ newSalary.setPerformanceWage(BigDecimal.ZERO);
+ // 设置工资条的基本工资
+ newSalary.setTeamWage(BigDecimal.ZERO);
+ // 返回
+ return newSalary;
+ }
+
+ // 获取用户级别保险
+ private NewSalary getUserLevelInsurance(Long userId, String targetYearMonth, NewSalary newSalary) {
+ // 用户级别保险查询类
+ UserInsuranceQueryCriteria criteria = new UserInsuranceQueryCriteria();
+ criteria.setUserId(userId);
+ criteria.setTargetYearMonth(targetYearMonth);
+ // 查询指定年月用户级别保险
+ UserInsuranceDto userInsuranceDto = userInsuranceService.queryTargetYearMonth(criteria);
+ // 公积金基数
+ newSalary.setAccumulationFund(userInsuranceDto.getAccumulationFund());
+ // 公积金个人缴纳比例
+ newSalary.setAccumulationFundPersonal(userInsuranceDto.getAccumulationFundPersonal());
+ // 公积金个人缴纳金额
+ newSalary.setAccumulationFundPersonalAmount(userInsuranceDto.getAccumulationFund().multiply(new BigDecimal(userInsuranceDto.getAccumulationFundPersonal() / 100)));
+ // 公积金公司缴纳比例
+ newSalary.setAccumulationFundCompany(userInsuranceDto.getAccumulationFundCompany());
+ // 公积金公司缴纳金额
+ newSalary.setAccumulationFundCompanyAmount(userInsuranceDto.getAccumulationFund().multiply(new BigDecimal(userInsuranceDto.getAccumulationFundCompany() / 100)));
+ // 养老险基数
+ newSalary.setRetirementInsurance(userInsuranceDto.getRetirementInsurance());
+ // 养老险个人缴纳比例
+ newSalary.setRetirementInsurancePersonal(userInsuranceDto.getRetirementInsurancePersonal());
+ // 养老险个人缴纳金额
+ newSalary.setRetirementInsurancePersonalAmount(userInsuranceDto.getRetirementInsurance().multiply(new BigDecimal(userInsuranceDto.getRetirementInsurancePersonal() / 100)));
+ // 养老险公司缴纳比例
+ newSalary.setRetirementInsuranceCompany(userInsuranceDto.getRetirementInsuranceCompany());
+ // 养老险公司缴纳金额
+ newSalary.setRetirementInsuranceCompanyAmount(userInsuranceDto.getRetirementInsurance().multiply(new BigDecimal(userInsuranceDto.getRetirementInsuranceCompany() / 100)));
+ // 医疗险基数
+ newSalary.setMedicalInsurance(userInsuranceDto.getMedicalInsurance());
+ // 医疗险个人缴纳比例
+ newSalary.setMedicalInsurancePersonal(userInsuranceDto.getMedicalInsurancePersonal());
+ // 医疗险个人缴纳金额
+ newSalary.setMedicalInsurancePersonalAmount(userInsuranceDto.getMedicalInsurance().multiply(new BigDecimal(userInsuranceDto.getMedicalInsurancePersonal() / 100)));
+ // 医疗险公司缴纳比例
+ newSalary.setMedicalInsuranceCompany(userInsuranceDto.getMedicalInsuranceCompany());
+ // 医疗险公司缴纳金额
+ newSalary.setMedicalInsuranceCompanyAmount(userInsuranceDto.getMedicalInsurance().multiply(new BigDecimal(userInsuranceDto.getMedicalInsuranceCompany() / 100)));
+ // 失业险基数
+ newSalary.setUnemploymentInsurance(userInsuranceDto.getUnemploymentInsurance());
+ // 失业险个人缴纳比例
+ newSalary.setUnemploymentInsurancePersonal(userInsuranceDto.getUnemploymentInsurancePersonal());
+ // 失业险个人缴纳金额
+ newSalary.setUnemploymentInsurancePersonalAmount(userInsuranceDto.getUnemploymentInsurance().multiply(new BigDecimal(userInsuranceDto.getUnemploymentInsurancePersonal() / 100)));
+ // 失业险公司缴纳比例
+ newSalary.setUnemploymentInsuranceCompany(userInsuranceDto.getUnemploymentInsuranceCompany());
+ // 失业险公司缴纳金额
+ newSalary.setUnemploymentInsuranceCompanyAmount(userInsuranceDto.getUnemploymentInsurance().multiply(new BigDecimal(userInsuranceDto.getUnemploymentInsuranceCompany() / 100)));
+ // 生育险基数
+ newSalary.setBirthInsurance(userInsuranceDto.getBirthInsurance());
+ // 生育险个人缴纳比例
+ newSalary.setBirthInsurancePersonal(userInsuranceDto.getBirthInsurancePersonal());
+ // 生育险个人缴纳金额
+ newSalary.setBirthInsurancePersonalAmount(userInsuranceDto.getBirthInsurance().multiply(new BigDecimal(userInsuranceDto.getBirthInsurancePersonal() / 100)));
+ // 生育险公司缴纳比例
+ newSalary.setBirthInsuranceCompany(userInsuranceDto.getBirthInsuranceCompany());
+ // 生育险公司缴纳金额
+ newSalary.setBirthInsuranceCompanyAmount(userInsuranceDto.getBirthInsurance().multiply(new BigDecimal(userInsuranceDto.getBirthInsuranceCompany() / 100)));
+ // 工伤险基数
+ newSalary.setEmploymentInsurance(userInsuranceDto.getEmploymentInsurance());
+ // 工伤险个人缴纳比例
+ newSalary.setEmploymentInsurancePersonal(userInsuranceDto.getEmploymentInsurancePersonal());
+ // 工伤险个人缴纳金额
+ newSalary.setEmploymentInsurancePersonalAmount(userInsuranceDto.getEmploymentInsurance().multiply(new BigDecimal(userInsuranceDto.getEmploymentInsurancePersonal() / 100)));
+ // 工伤险公司缴纳比例
+ newSalary.setEmploymentInsuranceCompany(userInsuranceDto.getEmploymentInsuranceCompany());
+ // 工伤险公司缴纳金额
+ newSalary.setEmploymentInsuranceCompanyAmount(userInsuranceDto.getEmploymentInsurance().multiply(new BigDecimal(userInsuranceDto.getEmploymentInsuranceCompany() / 100)));
+ // 返回
+ return newSalary;
+ }
+
+ // 获取用户级别其他
+ private NewSalary getUserLevelOther(Long userId, String targetYearMonth, NewSalary newSalary) {
+ // 用户级别其他查询类
+ SysUserLevelOtherQueryCriteria sysUserLevelOtherQueryCriteria = new SysUserLevelOtherQueryCriteria();
+ sysUserLevelOtherQueryCriteria.setUserId(userId);
+ sysUserLevelOtherQueryCriteria.setTargetYearMonth(targetYearMonth);
+ // 查询指定年月用户级别其他
+ SysUserLevelOtherDto sysUserLevelOtherDto = sysUserLevelOtherService.queryTargetYearMonth(sysUserLevelOtherQueryCriteria);
+ // 个人业绩比例
+// newSalary.setPersonalPerformanceProportion(sysUserLevelOtherDto.getPersonalPerformanceProportion());
+ // 返回
+ return newSalary;
+ }
+
+ // 获取工作天数
+ private NewSalary getWorkDays(String targetYearMonth, NewSalary newSalary) {
+ // 工资查询类
+ NewSalaryQueryCriteria newSalaryQueryCriteria = new NewSalaryQueryCriteria();
+ newSalaryQueryCriteria.setTargetYearMonth(targetYearMonth);
+ // 查询某月工作天数
+ Integer workDays = queryWorkDays(newSalaryQueryCriteria);
+ // 全勤小时数
+ newSalary.setFullDays(Double.valueOf(workDays * 8));
+ // 应完成绩效工时
+ newSalary.setNeedCompletedAchievementsHours(Double.valueOf(workDays * 8));
+
+ newSalary.setNeedCompletedPerformanceHours(Double.valueOf(workDays * 8 * 1.1));
+ // 返回
+ return newSalary;
+ }
+
+ // 获取出勤小时数
+ private NewSalary getAttendanceHours(Long userId, String targetYearMonth, NewSalary newSalary) {
+ // 考勤查询类
+ AttendanceQueryCriteria attendanceQueryCriteria = new AttendanceQueryCriteria();
+ attendanceQueryCriteria.setUserId(userId);
+ attendanceQueryCriteria.setTargetYearMonth(targetYearMonth);
+ // 查询某月出勤小时数
+ Double attendanceHours = attendanceService.queryAttendanceHours(attendanceQueryCriteria);
+ // 定时器
+ while (true) {
+ // 判断预计基础工资、全勤小时数是否为空
+ if (newSalary.getBasicWage() != null && newSalary.getFullDays() != null) {
+ // 缺勤小时数
+ newSalary.setAbsenceDays(newSalary.getFullDays() > attendanceHours ? Double.valueOf(newSalary.getFullDays() - attendanceHours) : 0);
+ // 小时工资
+ BigDecimal hourWage = newSalary.getBasicWage().divide(new BigDecimal(newSalary.getFullDays()), 2);
+ // 缺勤小时数
+ BigDecimal absenceDays = new BigDecimal(newSalary.getAbsenceDays());
+ // 实际基础工资
+ newSalary.setActualBasicWage(newSalary.getBasicWage().subtract(hourWage.multiply(absenceDays)));
+ // 清空定时器
+ break;
+ }
+ }
+ // 返回
+ return newSalary;
+ }
+
+ // 获取达标工时
+ private NewSalary getComplianceWork(Long userId, String targetYearMonth, NewSalary newSalary) {
+ // 任务日报查询类
+ ProjectPerformanceDetailQueryCriteria taskDaliyQueryCriteria = new ProjectPerformanceDetailQueryCriteria();
+ taskDaliyQueryCriteria.setUserId(userId);
+ taskDaliyQueryCriteria.setYearMonth(Timestamp.valueOf(targetYearMonth + " 00:00:00"));
+ // 查询某月已达标工时
+ Double complianceWork = projectPerformanceDetailService.queryComplianceWork(taskDaliyQueryCriteria);
+ // 实达标团队工时
+ newSalary.setActualComplianceTeamHours(complianceWork);
+ // 返回
+ return newSalary;
+ }
+
+ // 获取已完成工时
+ private NewSalary getCompletedWork(Long userId, String targetYearMonth, NewSalary newSalary) {
+ // 任务日报查询类
+ TaskDaliyQueryCriteria taskDaliyQueryCriteria = new TaskDaliyQueryCriteria();
+ taskDaliyQueryCriteria.setUserId(userId);
+ taskDaliyQueryCriteria.setTargetYearMonth(targetYearMonth);
+ // 查询某月已完成工时
+ Double completedWork = taskDaliyService.queryCompletedWork(taskDaliyQueryCriteria, false);
+ // 已完成绩效工时
+ newSalary.setAlreadyCompletedAchievementsHours(completedWork);
+ // 已完成业绩工时
+ newSalary.setAlreadyCompletedPerformanceHours(completedWork);
+ // 已完成团队工时
+ newSalary.setAlreadyCompletedTeamHours(completedWork);
+
+ Double otherWage = taskDaliyService.queryOtherWage(taskDaliyQueryCriteria);
+ newSalary.setPieceRate(BigDecimal.valueOf(otherWage));
+ // 绩效定时器
+ while (true) {
+ // 判断预计绩效工资、应完成绩效工时是否为空
+ if (newSalary.getAchievementsWage() != null && newSalary.getNeedCompletedAchievementsHours() != null) {
+ // 实际绩效工资
+ newSalary.setActualAchievementsWage(newSalary.getAchievementsWage().multiply(new BigDecimal(completedWork / newSalary.getNeedCompletedAchievementsHours())));
+ // 清空绩效定时器
+ break;
+ }
+ }
+ // 业绩定时器
+ while (true) {
+ // 判断预计业绩工资、应完成业绩工时是否为空
+ if (newSalary.getPerformanceWage() != null && newSalary.getNeedCompletedPerformanceHours() != null) {
+ // 实际业绩工资
+ newSalary.setActualPerformanceWage(completedWork >= newSalary.getNeedCompletedPerformanceHours() ? newSalary.getPerformanceWage() : new BigDecimal(0));
+ }
+ // 清空业绩定时器
+ break;
+ }
+ // 团队定时器
+ while (true) {
+ // 判断预计团队工资、实达标团队工时是否为空
+ if (newSalary.getTeamWage() != null && newSalary.getActualComplianceTeamHours() != null) {
+ // 实际团队工资
+ newSalary.setActualTeamWage(newSalary.getActualComplianceTeamHours() != 0 ? newSalary.getTeamWage().multiply(new BigDecimal(newSalary.getActualComplianceTeamHours() / completedWork)) : new BigDecimal(0));
+ // 清空团队定时器
+ break;
+ }
+ }
+ // 统计定时器
+ while (true) {
+ // 判断 实际基础工资、实际绩效工资、实际业绩工资、实际团队工资、公积金个人缴纳金额、养老险个人缴纳金额、
+ // 医疗险个人缴纳金额、失业险个人缴纳金额、生育险个人缴纳金额、工伤险个人缴纳金额 是否为空
+ if (
+ newSalary.getActualBasicWage() != null &&
+ newSalary.getActualAchievementsWage() != null &&
+ newSalary.getActualPerformanceWage() != null &&
+ newSalary.getActualTeamWage() != null &&
+ newSalary.getAccumulationFundPersonalAmount() != null &&
+ newSalary.getRetirementInsurancePersonalAmount() != null &&
+ newSalary.getMedicalInsurancePersonalAmount() != null &&
+ newSalary.getUnemploymentInsurancePersonalAmount() != null &&
+ newSalary.getBirthInsurancePersonalAmount() != null &&
+ newSalary.getEmploymentInsurancePersonalAmount() != null
+ ) {
+ // 税前金额
+ newSalary.setPreTaxAmount(newSalary.getActualBasicWage().add(newSalary.getActualAchievementsWage()).add(newSalary.getActualPerformanceWage()).add(newSalary.getActualTeamWage()));
+ // 查询个人所得税列表
+ List<SysConfigIndividualIncomeTaxDto> sysConfigIndividualIncomeTaxDtoList = sysConfigIndividualIncomeTaxService.queryAll(new SysConfigIndividualIncomeTaxQueryCriteria());
+ // 税额
+ BigDecimal taxAmount = new BigDecimal(0);
+ // 计税金额
+ BigDecimal taxableAmount = newSalary.getPreTaxAmount().subtract(newSalary.getAccumulationFundPersonalAmount()).subtract(newSalary.getRetirementInsurancePersonalAmount())
+ .subtract(newSalary.getMedicalInsurancePersonalAmount()).subtract(newSalary.getUnemploymentInsurancePersonalAmount()).subtract(newSalary.getBirthInsurancePersonalAmount())
+ .subtract(newSalary.getEmploymentInsurancePersonalAmount());
+ // 循环个人所得税列表
+ for (int i = 0; i < sysConfigIndividualIncomeTaxDtoList.size(); i++) {
+ // 判断计税金额所在个人所得税范围
+ if (sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd() != null &&
+ taxableAmount.compareTo(sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd()) == 1) {
+ // 税额
+ taxAmount.add(
+ (sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd().subtract(sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountStart()))
+ .multiply(new BigDecimal(sysConfigIndividualIncomeTaxDtoList.get(i).getTaxRate()).divide(new BigDecimal(100), 2))
+ );
+ } else if (
+ (taxableAmount.compareTo(sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountStart()) == 1 ||
+ taxableAmount.compareTo(sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountStart()) == 0) &&
+ (sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd() == null ||
+ taxableAmount.compareTo(sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd()) == -1 ||
+ taxableAmount.compareTo(sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd()) == 0)
+ ) {
+ // 税额
+ taxAmount.add(
+ (taxableAmount.subtract(sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountStart()))
+ .multiply(new BigDecimal(sysConfigIndividualIncomeTaxDtoList.get(i).getTaxRate()).divide(new BigDecimal(100), 2))
+ );
+ }
+ // 判断循环是否结束
+ if (i == sysConfigIndividualIncomeTaxDtoList.size() - 1) {
+ // 个人所得税
+ newSalary.setIndividualIncomeTax(taxAmount);
+ // 税后金额
+ newSalary.setAfterTaxAmount(taxableAmount.subtract(taxAmount).compareTo(new BigDecimal(0)) == -1 ? new BigDecimal(0) : taxableAmount.subtract(taxAmount));
+ }
+ }
+ // 清空统计定时器
+ break;
+ }
+ }
+ // 返回
+ return newSalary;
+ }
+ // ==================== 以上为定时生成工资记录主要逻辑 ====================
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/mapstruct/NewSalaryMapper.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/mapstruct/NewSalaryMapper.java
new file mode 100644
index 0000000..5f2ad83
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/mapstruct/NewSalaryMapper.java
@@ -0,0 +1,31 @@
+/*
+ * 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.NewSalary;
+import me.zhengjie.modules.salary.service.dto.NewSalaryDto;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+
+/**
+ * @author ZLH
+ * @date 2023-08-23
+ **/
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
+public interface NewSalaryMapper extends BaseMapper<NewSalaryDto, NewSalary> {
+
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/domain/UserInsurance.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/domain/UserInsurance.java
index f01a327..71b6e93 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/domain/UserInsurance.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/domain/UserInsurance.java
@@ -75,12 +75,12 @@
@Column(name = "`retirement_insurance_personal`",nullable = false)
@NotNull
- @ApiModelProperty(value = "公积金个人比例")
+ @ApiModelProperty(value = "养老险个人比例")
private Double retirementInsurancePersonal = 0.0D;
@Column(name = "`retirement_insurance_company`",nullable = false)
@NotNull
- @ApiModelProperty(value = "公积金公司比例")
+ @ApiModelProperty(value = "养老险公司比例")
private Double retirementInsuranceCompany = 0.0D;
@Column(name = "`medical_insurance`",nullable = false)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/UserLevelWageRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/UserLevelWageRepository.java
index b1db0b0..31ba988 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/UserLevelWageRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/UserLevelWageRepository.java
@@ -15,6 +15,7 @@
*/
package me.zhengjie.modules.treatment.repository;
+import me.zhengjie.modules.system.domain.SysUserLevelWage;
import me.zhengjie.modules.treatment.domain.UserLevelWage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/rest/UserLevelWageController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/rest/UserLevelWageController.java
index 73487f2..d5a389c 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/rest/UserLevelWageController.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/rest/UserLevelWageController.java
@@ -1,42 +1,43 @@
/*
-* 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.
-*/
+ * Copyright 2019-2020 Zheng Jie
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package me.zhengjie.modules.treatment.rest;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.treatment.domain.UserLevelWage;
import me.zhengjie.modules.treatment.service.UserLevelWageService;
import me.zhengjie.modules.treatment.service.dto.UserLevelWageQueryCriteria;
import org.springframework.data.domain.Pageable;
-import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import io.swagger.annotations.*;
+
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
/**
-* @website https://eladmin.vip
-* @author 姚增春
-* @date 2023-05-07
-**/
+ * @author 姚增春
+ * @website https://eladmin.vip
+ * @date 2023-05-07
+ **/
@RestController
@RequiredArgsConstructor
@Api(tags = "个人级别工资管理")
@@ -57,16 +58,24 @@
@Log("查询个人级别工资")
@ApiOperation("查询个人级别工资")
@PreAuthorize("@el.check('userLevelWage:list')")
- public ResponseEntity<Object> queryUserLevelWage(UserLevelWageQueryCriteria criteria, Pageable pageable){
- return new ResponseEntity<>(userLevelWageService.queryAll(criteria,pageable),HttpStatus.OK);
+ public ResponseEntity<Object> queryUserLevelWage(UserLevelWageQueryCriteria criteria, Pageable pageable) {
+ return new ResponseEntity<>(userLevelWageService.queryAll(criteria, pageable), HttpStatus.OK);
+ }
+
+ @GetMapping(value = "/targetYearMonth")
+ @Log("查询指定年月用户级别工资")
+ @ApiOperation("查询指定年月用户级别工资")
+ @PreAuthorize("@el.check('userLevelWage:list')")
+ public ResponseEntity<Object> queryTargetYearMonth(UserLevelWageQueryCriteria criteria) {
+ return new ResponseEntity<>(userLevelWageService.queryTargetYearMonth(criteria), HttpStatus.OK);
}
@PostMapping(value = "/upload")
@Log("新增个人级别工资")
@ApiOperation("新增个人级别工资")
@PreAuthorize("@el.check('userLevelWage:add')")
- public ResponseEntity<Object> uploadUserLevelWage(@Validated @RequestBody List<UserLevelWage> resources){
- userLevelWageService.upload(resources);
+ public ResponseEntity<Object> uploadUserLevelWage(@Validated @RequestBody List<UserLevelWage> resources) {
+ userLevelWageService.upload(resources);
return new ResponseEntity<>(HttpStatus.OK);
}
@@ -74,15 +83,15 @@
@Log("新增个人级别工资")
@ApiOperation("新增个人级别工资")
@PreAuthorize("@el.check('userLevelWage:add')")
- public ResponseEntity<Object> createUserLevelWage(@Validated @RequestBody UserLevelWage resources){
- return new ResponseEntity<>(userLevelWageService.create(resources),HttpStatus.CREATED);
+ public ResponseEntity<Object> createUserLevelWage(@Validated @RequestBody UserLevelWage resources) {
+ return new ResponseEntity<>(userLevelWageService.create(resources), HttpStatus.CREATED);
}
@PutMapping
@Log("修改个人级别工资")
@ApiOperation("修改个人级别工资")
@PreAuthorize("@el.check('userLevelWage:edit')")
- public ResponseEntity<Object> updateUserLevelWage(@Validated @RequestBody UserLevelWage resources){
+ public ResponseEntity<Object> updateUserLevelWage(@Validated @RequestBody UserLevelWage resources) {
userLevelWageService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/UserInsuranceService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/UserInsuranceService.java
index 94975c4..e241324 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/UserInsuranceService.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/UserInsuranceService.java
@@ -15,6 +15,8 @@
*/
package me.zhengjie.modules.treatment.service;
+import me.zhengjie.modules.system.service.dto.SysUserLevelInsuranceDto;
+import me.zhengjie.modules.system.service.dto.SysUserLevelInsuranceQueryCriteria;
import me.zhengjie.modules.treatment.domain.UserInsurance;
import me.zhengjie.modules.treatment.service.dto.UserInsuranceDto;
import me.zhengjie.modules.treatment.service.dto.UserInsuranceGenerateParam;
@@ -49,6 +51,13 @@
List<UserInsuranceDto> queryAll(UserInsuranceQueryCriteria criteria);
/**
+ * 查询指定年月用户级别保险
+ * @param criteria 条件参数
+ * @return List<SysUserLevelInsuranceDto>
+ */
+ UserInsuranceDto queryTargetYearMonth(UserInsuranceQueryCriteria criteria);
+
+ /**
* 根据ID查询
* @param id ID
* @return UserInsuranceDto
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/UserLevelWageService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/UserLevelWageService.java
index f475a1d..f47e5cb 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/UserLevelWageService.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/UserLevelWageService.java
@@ -15,6 +15,8 @@
*/
package me.zhengjie.modules.treatment.service;
+import me.zhengjie.modules.system.service.dto.SysUserLevelWageDto;
+import me.zhengjie.modules.system.service.dto.SysUserLevelWageQueryCriteria;
import me.zhengjie.modules.treatment.domain.UserLevelWage;
import me.zhengjie.modules.treatment.service.dto.UserLevelWageDto;
import me.zhengjie.modules.treatment.service.dto.UserLevelWageQueryCriteria;
@@ -48,6 +50,13 @@
List<UserLevelWageDto> queryAll(UserLevelWageQueryCriteria criteria);
/**
+ * 查询指定年月用户级别工资
+ * @param criteria
+ * @return
+ */
+ UserLevelWageDto queryTargetYearMonth(UserLevelWageQueryCriteria criteria);
+
+ /**
* 根据ID查询
* @param id ID
* @return UserLevelWageDto
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/dto/UserInsuranceQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/dto/UserInsuranceQueryCriteria.java
index e4c015c..8bebe4d 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/dto/UserInsuranceQueryCriteria.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/dto/UserInsuranceQueryCriteria.java
@@ -35,4 +35,6 @@
/** 精确 */
@Query
private String yearMonth;
+
+ private String targetYearMonth;
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/dto/UserLevelWageQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/dto/UserLevelWageQueryCriteria.java
index 541f55e..15bd2f3 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/dto/UserLevelWageQueryCriteria.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/dto/UserLevelWageQueryCriteria.java
@@ -34,4 +34,6 @@
/** 精确 */
@Query
private String yearMonth;
+
+ private String targetYearMonth;
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/impl/UserInsuranceServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/impl/UserInsuranceServiceImpl.java
index 28cee7f..0e9b00c 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/impl/UserInsuranceServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/impl/UserInsuranceServiceImpl.java
@@ -26,6 +26,11 @@
import javax.servlet.http.HttpServletResponse;
+import me.zhengjie.exception.BadRequestException;
+import me.zhengjie.modules.system.domain.SysUserLevelInsurance;
+import me.zhengjie.modules.system.service.dto.SysUserLevelInsuranceDto;
+import me.zhengjie.modules.system.service.dto.SysUserLevelInsuranceQueryCriteria;
+import me.zhengjie.utils.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -46,10 +51,6 @@
import me.zhengjie.modules.treatment.service.dto.UserInsuranceQueryCriteria;
import me.zhengjie.modules.treatment.service.mapstruct.UserInsuranceGenMapper;
import me.zhengjie.modules.treatment.service.mapstruct.UserInsuranceMapper;
-import me.zhengjie.utils.FileUtil;
-import me.zhengjie.utils.PageUtil;
-import me.zhengjie.utils.QueryHelp;
-import me.zhengjie.utils.ValidationUtil;
/**
* @website https://eladmin.vip
@@ -96,6 +97,24 @@
}
@Override
+ public UserInsuranceDto queryTargetYearMonth(UserInsuranceQueryCriteria criteria) {
+ // 国际时间转中国时间
+ String targetYearMonth = criteria.getTargetYearMonth();
+ // 获取某年某月最后一天
+ String yearMonth = targetYearMonth.substring(0,7);
+ // 根据用户ID、指定年月查询
+ Optional<UserInsurance> userInsuranceOpt = userInsuranceRepository.findByUserIdAndYearMonth(criteria.getUserId(), yearMonth);
+ // 判断查询结果
+ if (userInsuranceOpt.isPresent()) {
+ UserInsurance userInsurance = userInsuranceOpt.get();
+ // 返回
+ return userInsuranceMapper.toDto(userInsurance);
+ } else {
+ throw new BadRequestException("没有获取到当前员工的级别信息!");
+ }
+ }
+
+ @Override
@Transactional
public UserInsuranceDto findById(Long id) {
UserInsurance userInsurance = userInsuranceRepository.findById(id).orElseGet(UserInsurance::new);
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/impl/UserLevelWageServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/impl/UserLevelWageServiceImpl.java
index f056ceb..d46d22c 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/impl/UserLevelWageServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/impl/UserLevelWageServiceImpl.java
@@ -1,38 +1,22 @@
/*
-* 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.
-*/
+ * Copyright 2019-2020 Zheng Jie
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package me.zhengjie.modules.treatment.service.impl;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.function.Function;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
import lombok.RequiredArgsConstructor;
+import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.system.domain.User;
import me.zhengjie.modules.system.repository.UserRepository;
import me.zhengjie.modules.treatment.domain.UserInsurance;
@@ -44,17 +28,25 @@
import me.zhengjie.modules.treatment.service.dto.UserLevelWageDto;
import me.zhengjie.modules.treatment.service.dto.UserLevelWageQueryCriteria;
import me.zhengjie.modules.treatment.service.mapstruct.UserLevelWageMapper;
-import me.zhengjie.utils.FileUtil;
-import me.zhengjie.utils.PageUtil;
-import me.zhengjie.utils.QueryHelp;
-import me.zhengjie.utils.ValidationUtil;
+import me.zhengjie.utils.*;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
+import java.util.function.Function;
/**
-* @website https://eladmin.vip
-* @description 服务实现
-* @author 姚增春
-* @date 2023-05-07
-**/
+ * @author 姚增春
+ * @website https://eladmin.vip
+ * @description 服务实现
+ * @date 2023-05-07
+ **/
@Service
@RequiredArgsConstructor
public class UserLevelWageServiceImpl implements UserLevelWageService {
@@ -67,16 +59,16 @@
private final CmnInsuranceRepository cmnInsuranceRepository;
@Override
- public Map<String,Object> queryAll(UserLevelWageQueryCriteria criteria, Pageable pageable){
- Page<UserLevelWage> page = userLevelWageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
+ public Map<String, Object> queryAll(UserLevelWageQueryCriteria criteria, Pageable pageable) {
+ Page<UserLevelWage> page = userLevelWageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
// 将实体类转换为DTO(重写)
Function<UserLevelWage, UserLevelWageDto> func = new Function<UserLevelWage, UserLevelWageDto>() {
@Override
public UserLevelWageDto apply(UserLevelWage userLevelWage) {
// 将实体类转换成DTO
- UserLevelWageDto userLevelWageDto = userLevelWageMapper.toDto(userLevelWage);
+ UserLevelWageDto userLevelWageDto = userLevelWageMapper.toDto(userLevelWage);
User user = userRepository.findById(userLevelWageDto.getUserId()).orElseGet(User::new);
- ValidationUtil.isNull(userLevelWageDto.getId(),"User","id",userLevelWageDto.getUserId());
+ ValidationUtil.isNull(userLevelWageDto.getId(), "User", "id", userLevelWageDto.getUserId());
userLevelWageDto.setNickName(user.getNickName());
return userLevelWageDto;
}
@@ -85,59 +77,75 @@
}
@Override
- public List<UserLevelWageDto> queryAll(UserLevelWageQueryCriteria criteria){
- return userLevelWageMapper.toDto(userLevelWageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
+ public List<UserLevelWageDto> queryAll(UserLevelWageQueryCriteria criteria) {
+ return userLevelWageMapper.toDto(userLevelWageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
+ }
+
+ @Override
+ public UserLevelWageDto queryTargetYearMonth(UserLevelWageQueryCriteria criteria) {
+ // 国际时间转中国时间
+ String targetYearMonth = criteria.getTargetYearMonth();
+ // 获取某年某月最后一天
+ String yearMonth = targetYearMonth.substring(0,7);
+ // 根据用户ID、指定年月查询
+ UserLevelWage userLevelWage = userLevelWageRepository.findByUserIdAndYearMonth(criteria.getUserId(), yearMonth);
+ // 判断查询结果
+ if (userLevelWage == null) {
+ throw new BadRequestException("没有获取到当前员工的级别信息!");
+ }
+ // 返回
+ return userLevelWageMapper.toDto(userLevelWage);
}
@Override
@Transactional
public UserLevelWageDto findById(Long id) {
UserLevelWage userLevelWage = userLevelWageRepository.findById(id).orElseGet(UserLevelWage::new);
- ValidationUtil.isNull(userLevelWage.getId(),"UserLevelWage","id",id);
+ ValidationUtil.isNull(userLevelWage.getId(), "UserLevelWage", "id", id);
return userLevelWageMapper.toDto(userLevelWage);
}
@Override
@Transactional(rollbackFor = Exception.class)
public UserLevelWageDto create(UserLevelWage resources) {
- resources.setPerformanceCoefficient(calculatePerformanceCoefficient(resources));
+ resources.setPerformanceCoefficient(calculatePerformanceCoefficient(resources));
return userLevelWageMapper.toDto(userLevelWageRepository.save(resources));
}
private BigDecimal calculatePerformanceCoefficient(UserLevelWage resources) {
- BigDecimal total = resources.getBasicWage().add(resources.getRankWage()).add(resources.getPerformanceWage());
- Optional<UserInsurance> userInsuranceOpt = userInsuranceRepository.findByUserIdAndYearMonth(resources.getUserId(), resources.getYearMonth());
- if (userInsuranceOpt.isPresent()) {
- UserInsurance userInsurance = userInsuranceOpt.get();
- total = total.add(userInsurance.getAccumulationFund().multiply(BigDecimal.valueOf(userInsurance.getAccumulationFundCompany() / 100)))
- .add(userInsurance.getBirthInsurance().multiply(BigDecimal.valueOf(userInsurance.getBirthInsuranceCompany() / 100)))
- .add(userInsurance.getEmploymentInsurance().multiply(BigDecimal.valueOf(userInsurance.getEmploymentInsuranceCompany() / 100)))
- .add(userInsurance.getMedicalInsurance().multiply(BigDecimal.valueOf(userInsurance.getMedicalInsuranceCompany() / 100)))
- .add(userInsurance.getRetirementInsurance().multiply(BigDecimal.valueOf(userInsurance.getRetirementInsuranceCompany() / 100)))
- .add(userInsurance.getUnemploymentInsurance().multiply(BigDecimal.valueOf(userInsurance.getUnemploymentInsuranceCompany() / 100)));
- }
- return total.divide(BigDecimal.valueOf(11250), 2, RoundingMode.UP);
+ BigDecimal total = resources.getBasicWage().add(resources.getRankWage()).add(resources.getPerformanceWage());
+ Optional<UserInsurance> userInsuranceOpt = userInsuranceRepository.findByUserIdAndYearMonth(resources.getUserId(), resources.getYearMonth());
+ if (userInsuranceOpt.isPresent()) {
+ UserInsurance userInsurance = userInsuranceOpt.get();
+ total = total.add(userInsurance.getAccumulationFund().multiply(BigDecimal.valueOf(userInsurance.getAccumulationFundCompany() / 100)))
+ .add(userInsurance.getBirthInsurance().multiply(BigDecimal.valueOf(userInsurance.getBirthInsuranceCompany() / 100)))
+ .add(userInsurance.getEmploymentInsurance().multiply(BigDecimal.valueOf(userInsurance.getEmploymentInsuranceCompany() / 100)))
+ .add(userInsurance.getMedicalInsurance().multiply(BigDecimal.valueOf(userInsurance.getMedicalInsuranceCompany() / 100)))
+ .add(userInsurance.getRetirementInsurance().multiply(BigDecimal.valueOf(userInsurance.getRetirementInsuranceCompany() / 100)))
+ .add(userInsurance.getUnemploymentInsurance().multiply(BigDecimal.valueOf(userInsurance.getUnemploymentInsuranceCompany() / 100)));
+ }
+ return total.divide(BigDecimal.valueOf(11250), 2, RoundingMode.UP);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void upload(List<UserLevelWage> resources) {
- for (UserLevelWage userLevelWage : resources) {
- UserLevelWage userLevelWageDB = userLevelWageRepository.findByUserIdAndYearMonth(userLevelWage.getUserId(), userLevelWage.getYearMonth());
- if (userLevelWageDB == null) {
- userLevelWageRepository.save(userLevelWage);
- } else {
- userLevelWageDB.copy(userLevelWage);
- userLevelWageRepository.save(userLevelWageDB);
- }
- }
+ for (UserLevelWage userLevelWage : resources) {
+ UserLevelWage userLevelWageDB = userLevelWageRepository.findByUserIdAndYearMonth(userLevelWage.getUserId(), userLevelWage.getYearMonth());
+ if (userLevelWageDB == null) {
+ userLevelWageRepository.save(userLevelWage);
+ } else {
+ userLevelWageDB.copy(userLevelWage);
+ userLevelWageRepository.save(userLevelWageDB);
+ }
+ }
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(UserLevelWage resources) {
UserLevelWage userLevelWage = userLevelWageRepository.findById(resources.getId()).orElseGet(UserLevelWage::new);
- ValidationUtil.isNull( userLevelWage.getId(),"UserLevelWage","id",resources.getId());
+ ValidationUtil.isNull(userLevelWage.getId(), "UserLevelWage", "id", resources.getId());
userLevelWage.copy(resources);
userLevelWage.setPerformanceCoefficient(calculatePerformanceCoefficient(userLevelWage));
userLevelWageRepository.save(userLevelWage);
@@ -146,9 +154,9 @@
@Override
public void flushAll(Long[] ids) {
for (Long id : ids) {
- UserLevelWage userLevelWage = userLevelWageRepository.findById(id).orElseGet(UserLevelWage::new);
- userLevelWage.setPerformanceCoefficient(calculatePerformanceCoefficient(userLevelWage));
- userLevelWageRepository.save(userLevelWage);
+ UserLevelWage userLevelWage = userLevelWageRepository.findById(id).orElseGet(UserLevelWage::new);
+ userLevelWage.setPerformanceCoefficient(calculatePerformanceCoefficient(userLevelWage));
+ userLevelWageRepository.save(userLevelWage);
}
}
@@ -163,7 +171,7 @@
public void download(List<UserLevelWageDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (UserLevelWageDto userLevelWage : all) {
- Map<String,Object> map = new LinkedHashMap<>();
+ Map<String, Object> map = new LinkedHashMap<>();
map.put("用户ID", userLevelWage.getUserId());
map.put("年月", userLevelWage.getYearMonth());
map.put("级别", userLevelWage.getLevel());
diff --git a/eladmin-web-master/src/api/salary/newSalary.js b/eladmin-web-master/src/api/salary/newSalary.js
new file mode 100644
index 0000000..4404646
--- /dev/null
+++ b/eladmin-web-master/src/api/salary/newSalary.js
@@ -0,0 +1,67 @@
+import request from '@/utils/request'
+
+export function getAll(params) {
+ return request({
+ url: 'api/newSalary/all',
+ method: 'get',
+ params
+ })
+}
+
+export function add(data) {
+ return request({
+ url: 'api/newSalary',
+ method: 'post',
+ data
+ })
+}
+
+export function del(ids) {
+ return request({
+ url: 'api/newSalary/',
+ method: 'delete',
+ data: ids
+ })
+}
+
+export function edit(data) {
+ return request({
+ url: 'api/newSalary',
+ method: 'put',
+ data
+ })
+}
+
+export function workDays(params) {
+ return request({
+ url: 'api/newSalary/workDays',
+ method: 'get',
+ params
+ })
+}
+
+export function publicity(ids) {
+ return request({
+ url: 'api/newSalary/publicity/',
+ method: 'put',
+ data: ids
+ })
+}
+
+export function approve(ids) {
+ return request({
+ url: 'api/newSalary/approve/',
+ method: 'put',
+ data: ids
+ })
+}
+
+export function generate(data) {
+ return request({
+ url: 'api/newSalary/generate',
+ method: 'put',
+ data
+ })
+}
+
+export default { getAll, add, edit, del, workDays, publicity, approve, generate }
diff --git a/eladmin-web-master/src/api/treatment/userLevelWage.js b/eladmin-web-master/src/api/treatment/userLevelWage.js
index 8b725ca..0eb3746 100644
--- a/eladmin-web-master/src/api/treatment/userLevelWage.js
+++ b/eladmin-web-master/src/api/treatment/userLevelWage.js
@@ -24,4 +24,12 @@
})
}
-export default { add, edit, del }
+export function getTargetYearMonth(params) {
+ return request({
+ url: 'api/userLevelWage/targetYearMonth',
+ method: 'get',
+ params
+ })
+}
+
+export default { add, edit, del, getTargetYearMonth }
diff --git a/eladmin-web-master/src/views/salary/newSalary/index.vue b/eladmin-web-master/src/views/salary/newSalary/index.vue
new file mode 100644
index 0000000..cb13855
--- /dev/null
+++ b/eladmin-web-master/src/views/salary/newSalary/index.vue
@@ -0,0 +1,1729 @@
+<template>
+ <div class="app-container">
+ <!--工具栏-->
+ <div class="head-container">
+ <div v-if="crud.props.searchToggle">
+ <!-- 搜索 -->
+ <el-select v-model="query.userId" v-permission="permission.queryUserId" 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-date-picker v-model="query.salaryYearMonth" type="month" 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-button
+ slot="right"
+ v-permission="permission.publicity"
+ class="filter-item"
+ size="mini"
+ type="primary"
+ icon="el-icon-s-check"
+ :disabled="crud.selections.length === 0"
+ style="margin-right: 6px;"
+ @click="multiplePublicity(crud.selections)"
+ >公示</el-button>
+ <el-button
+ slot="right"
+ v-permission="permission.approve"
+ class="filter-item"
+ size="mini"
+ type="primary"
+ icon="el-icon-finished"
+ :disabled="crud.selections.length === 0"
+ style="margin-right: 6px;"
+ @click="multipleApprove(crud.selections)"
+ >承认</el-button>
+ <el-button
+ slot="right"
+ v-permission="permission.generate"
+ class="filter-item"
+ size="mini"
+ type="primary"
+ icon="el-icon-plus"
+ style="margin-right: 6px;"
+ @click="openGenerate"
+ >生成</el-button>
+ </crudOperation>
+ <!--表单组件-->
+ <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="690px">
+ <el-form ref="form" v-loading="formLoading" :inline="true" :model="form" :rules="rules" size="small" label-width="110px">
+ <el-form-item label="工资年月" prop="salaryYearMonth">
+ <el-date-picker
+ v-model="form.salaryYearMonth"
+ type="month"
+ style="width: 523px;"
+ placeholder="请选择"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ :disabled="disabledFlagByApprove"
+ @change="getUserLevel"
+ />
+ </el-form-item>
+ <el-form-item label="所属员工" prop="userId">
+ <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 523px;" :disabled="disabledFlagByApprove" @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-divider>基本工资</el-divider>
+ <el-form-item label="全勤小时数" prop="fullDays">
+ <el-input v-model="form.fullDays" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="basicParameterBlur">
+ <template slot="append">小时</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="缺勤小时数" prop="absenceDays">
+ <el-input v-model="form.absenceDays" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="basicParameterBlur">
+ <template slot="append">小时</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="预计工资" prop="basicWage">
+ <money-input :key="basicWageRandom" v-model="form.basicWage" :width="523" :disabled="disabledFlagByApprove" @blur="basicWageBlur" />
+ </el-form-item>
+ <el-form-item label="实际工资" prop="actualBasicWage">
+ <money-input :key="actualBasicWageRandom" v-model="form.actualBasicWage" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-divider>绩效工资</el-divider>
+ <el-form-item label="应完成工时" prop="needCompletedAchievementsHours">
+ <el-input v-model="form.needCompletedAchievementsHours" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="achievementsParameterBlur">
+ <template slot="append">小时</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="已完成工时" prop="alreadyCompletedAchievementsHours">
+ <el-input v-model="form.alreadyCompletedAchievementsHours" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="achievementsParameterBlur">
+ <template slot="append">小时</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="预计工资" prop="achievementsWage">
+ <money-input :key="achievementsWageRandom" v-model="form.achievementsWage" :width="523" :disabled="disabledFlagByApprove" @blur="achievementsWageBlur" />
+ </el-form-item>
+ <el-form-item label="实际工资" prop="actualAchievementsWage">
+ <money-input :key="actualAchievementsWageRandom" v-model="form.actualAchievementsWage" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-divider>业绩工资</el-divider>
+ <el-form-item label="应完成工时" prop="needCompletedPerformanceHours">
+ <el-input v-model="form.needCompletedPerformanceHours" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="performanceParameterBlur">
+ <template slot="append">小时</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="已完成工时" prop="alreadyCompletedPerformanceHours">
+ <el-input v-model="form.alreadyCompletedPerformanceHours" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="performanceParameterBlur">
+ <template slot="append">小时</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="预计工资" prop="performanceWage">
+ <money-input :key="performanceWageRandom" v-model="form.performanceWage" :width="523" :disabled="disabledFlagByApprove" @blur="performanceWageBlur" />
+ </el-form-item>
+ <el-form-item label="实际工资" prop="actualPerformanceWage">
+ <money-input :key="actualPerformanceWageRandom" v-model="form.actualPerformanceWage" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-divider>团队工资</el-divider>
+ <el-form-item label="实达标工时" prop="actualComplianceTeamHours">
+ <el-input v-model="form.actualComplianceTeamHours" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="teamParameterBlur">
+ <template slot="append">小时</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="已完成工时" prop="alreadyCompletedTeamHours">
+ <el-input v-model="form.alreadyCompletedTeamHours" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="teamParameterBlur">
+ <template slot="append">小时</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="预计工资" prop="teamWage">
+ <money-input :key="teamWageRandom" v-model="form.teamWage" :width="523" :disabled="disabledFlagByApprove" @blur="teamWageBlur" />
+ </el-form-item>
+ <el-form-item label="实际工资" prop="actualTeamWage">
+ <money-input :key="actualTeamWageRandom" v-model="form.actualTeamWage" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-divider>其他工资</el-divider>
+ <el-form-item label="计件工资" prop="pieceRate">
+ <money-input :key="pieceRateRandom" v-model="form.pieceRate" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-form-item label="出差补助工资" prop="travelAllowance">
+ <money-input :key="travelAllowanceRandom" v-model="form.travelAllowance" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-divider>公积金</el-divider>
+ <el-form-item label="基数" prop="accumulationFund">
+ <money-input :key="accumulationFundRandom" v-model="form.accumulationFund" :width="523" :disabled="disabledFlagByApprove" @blur="accumulationParameterBlur" />
+ </el-form-item>
+ <el-form-item label="个人缴纳比例" prop="accumulationFundPersonal">
+ <el-input v-model="form.accumulationFundPersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="accumulationParameterBlur">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="个人缴纳金额" prop="accumulationFundPersonalAmount">
+ <money-input :key="accumulationFundPersonalAmountRandom" v-model="form.accumulationFundPersonalAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-form-item label="公司缴纳比例" prop="accumulationFundCompany">
+ <el-input v-model="form.accumulationFundCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="accumulationParameterBlur">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="公司缴纳金额" prop="accumulationFundCompanyAmount">
+ <money-input :key="accumulationFundCompanyAmountRandom" v-model="form.accumulationFundCompanyAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-divider>养老险</el-divider>
+ <el-form-item label="基数" prop="retirementInsurance">
+ <money-input :key="retirementInsuranceRandom" v-model="form.retirementInsurance" :width="523" :disabled="disabledFlagByApprove" @blur="pensionParameterBlur" />
+ </el-form-item>
+ <el-form-item label="个人缴纳比例" prop="retirementInsurancePersonal">
+ <el-input v-model="form.retirementInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="pensionParameterBlur">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="个人缴纳金额" prop="retirementInsurancePersonalAmount">
+ <money-input :key="retirementInsurancePersonalAmountRandom" v-model="form.retirementInsurancePersonalAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-form-item label="公司缴纳比例" prop="retirementInsuranceCompany">
+ <el-input v-model="form.retirementInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="pensionParameterBlur">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="公司缴纳金额" prop="retirementInsuranceCompanyAmount">
+ <money-input :key="retirementInsuranceCompanyAmountRandom" v-model="form.retirementInsuranceCompanyAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-divider>医疗险</el-divider>
+ <el-form-item label="基数" prop="medicalInsurance">
+ <money-input :key="medicalInsuranceRandom" v-model="form.medicalInsurance" :width="523" :disabled="disabledFlagByApprove" @blur="medicalParameterBlur" />
+ </el-form-item>
+ <el-form-item label="个人缴纳比例" prop="medicalInsurancePersonal">
+ <el-input v-model="form.medicalInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="medicalParameterBlur">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="个人缴纳金额" prop="medicalInsurancePersonalAmount">
+ <money-input :key="medicalInsurancePersonalAmountRandom" v-model="form.medicalInsurancePersonalAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-form-item label="公司缴纳比例" prop="medicalInsuranceCompany">
+ <el-input v-model="form.medicalInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="medicalParameterBlur">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="公司缴纳金额" prop="medicalInsuranceCompanyAmount">
+ <money-input :key="medicalInsuranceCompanyAmountRandom" v-model="form.medicalInsuranceCompanyAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-divider>失业险</el-divider>
+ <el-form-item label="基数" prop="unemploymentInsurance">
+ <money-input :key="unemploymentInsuranceRandom" v-model="form.unemploymentInsurance" :width="523" :disabled="disabledFlagByApprove" @blur="unemploymentParameterBlur" />
+ </el-form-item>
+ <el-form-item label="个人缴纳比例" prop="unemploymentInsurancePersonal">
+ <el-input v-model="form.unemploymentInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="unemploymentParameterBlur">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="个人缴纳金额" prop="unemploymentInsurancePersonalAmount">
+ <money-input :key="unemploymentInsurancePersonalAmountRandom" v-model="form.unemploymentInsurancePersonalAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-form-item label="公司缴纳比例" prop="unemploymentInsuranceCompany">
+ <el-input v-model="form.unemploymentInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="unemploymentParameterBlur">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="公司缴纳金额" prop="unemploymentInsuranceCompanyAmount">
+ <money-input :key="unemploymentInsuranceCompanyAmountRandom" v-model="form.unemploymentInsuranceCompanyAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-divider>生育险</el-divider>
+ <el-form-item label="基数" prop="birthInsurance">
+ <money-input :key="birthInsuranceRandom" v-model="form.birthInsurance" :width="523" :disabled="disabledFlagByApprove" @blur="maternityParameterBlur" />
+ </el-form-item>
+ <el-form-item label="个人缴纳比例" prop="birthInsurancePersonal">
+ <el-input v-model="form.birthInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="maternityParameterBlur">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="个人缴纳金额" prop="birthInsurancePersonalAmount">
+ <money-input :key="birthInsurancePersonalAmountRandom" v-model="form.birthInsurancePersonalAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-form-item label="公司缴纳比例" prop="birthInsuranceCompany">
+ <el-input v-model="form.birthInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="maternityParameterBlur">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="公司缴纳金额" prop="birthInsuranceCompanyAmount">
+ <money-input :key="birthInsuranceCompanyAmountRandom" v-model="form.birthInsuranceCompanyAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-divider>工伤险</el-divider>
+ <el-form-item label="基数" prop="employmentInsurance">
+ <money-input :key="employmentInsuranceRandom" v-model="form.employmentInsurance" :width="523" :disabled="disabledFlagByApprove" @blur="industrialInjuryParameterBlur" />
+ </el-form-item>
+ <el-form-item label="个人缴纳比例" prop="employmentInsurancePersonal">
+ <el-input v-model="form.employmentInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="industrialInjuryParameterBlur">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="个人缴纳金额" prop="employmentInsurancePersonalAmount">
+ <money-input :key="employmentInsurancePersonalAmountRandom" v-model="form.employmentInsurancePersonalAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-form-item label="公司缴纳比例" prop="employmentInsuranceCompany">
+ <el-input v-model="form.employmentInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="industrialInjuryParameterBlur">
+ <template slot="append">%</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="公司缴纳金额" prop="employmentInsuranceCompanyAmount">
+ <money-input :key="employmentInsuranceCompanyAmountRandom" v-model="form.employmentInsuranceCompanyAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
+ </el-form-item>
+ <el-divider>统计</el-divider>
+ <el-form-item label="税前金额" prop="preTaxAmount">
+ <money-input :key="preTaxAmountRandom" v-model="form.preTaxAmount" :width="200" :disabled="disabledFlagByApprove" @blur="preTaxAmountBlur" />
+ </el-form-item>
+ <el-form-item label="个人所得税" prop="individualIncomeTax">
+ <money-input :key="individualIncomeTaxRandom" v-model="form.individualIncomeTax" :width="200" :disabled="disabledFlagByApprove" @blur="individualIncomeTaxBlur" />
+ </el-form-item>
+ <el-form-item label="税后金额" prop="afterTaxAmount">
+ <money-input :key="afterTaxAmountRandom" v-model="form.afterTaxAmount" :width="523" :disabled="disabledFlagByApprove" />
+ </el-form-item>
+ <el-form-item label="备注">
+ <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 523px;" :disabled="disabledFlagByApprove" />
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button type="text" @click="crud.cancelCU">取消</el-button>
+ <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
+ </div>
+ </el-dialog>
+ <!--表格渲染-->
+ <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
+ <el-table-column type="selection" width="55" />
+ <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属员工" fixed="left" width="100">
+ <template slot-scope="scope">
+ <el-tag>{{ scope.row.userNickName }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="salaryYearMonth" label="工资年月" fixed="left" width="100">
+ <template slot-scope="scope">
+ {{ crud.toMonth(scope.row.salaryYearMonth) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="actualBasicWage" label="基础工资" width="100">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.actualBasicWage) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="actualAchievementsWage" label="绩效工资" width="100">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.actualAchievementsWage) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="actualPerformanceWage" label="业绩工资" width="100">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.actualPerformanceWage) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="actualTeamWage" label="团队工资" width="100">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.actualTeamWage) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="accumulationFundPersonalAmount" label="公积金·个人缴纳金额" width="100">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.accumulationFundPersonalAmount) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="retirementInsurancePersonalAmount" label="养老险·个人缴纳金额" width="100">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.retirementInsurancePersonalAmount) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="medicalInsurancePersonalAmount" label="医疗险·个人缴纳金额" width="100">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.medicalInsurancePersonalAmount) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="unemploymentInsurancePersonalAmount" label="失业险·个人缴纳金额" width="100">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.unemploymentInsurancePersonalAmount) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="birthInsurancePersonalAmount" label="生育险·个人缴纳金额" width="100">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.birthInsurancePersonalAmount) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="employmentInsurancePersonalAmount" label="工伤险·个人缴纳金额" width="100">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.employmentInsurancePersonalAmount) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="preTaxAmount" label="税前金额" width="100">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.preTaxAmount) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="individualIncomeTax" label="个人所得税" width="100">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.individualIncomeTax) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="afterTaxAmount" label="税后金额" width="100">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.afterTaxAmount) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" width="140" />
+ <el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建时间" width="140" />
+ <el-table-column :show-overflow-tooltip="true" prop="publicityStatus" label="公示状态" width="80" fixed="right">
+ <template slot-scope="scope">
+ <el-tag>{{ dict.label[publicityStatus][scope.row.publicityStatus] }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="approveStatus" label="承认状态" width="80" fixed="right">
+ <template slot-scope="scope">
+ <el-tag>{{ dict.label[approveStatus][scope.row.approveStatus] }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column v-if="checkPer(['admin','salary:edit','salary:del','salary:publicity','salary:approve'])" label="操作" width="210px" align="center" fixed="right">
+ <template slot-scope="scope">
+ <udOperation
+ :data="scope.row"
+ :permission="permission"
+ >
+ <el-popover slot="left" :ref="`publicity_${scope.row.id}`" v-permission="permission.publicity" placement="top" width="180">
+ <p>确定公示本条数据吗?</p>
+ <div style="text-align: right; margin: 0">
+ <el-button size="mini" type="text" @click="publicityCancel(scope.row)">取消</el-button>
+ <el-button :loading="publicityLoading" type="primary" size="mini" @click="doPublicity(scope.row)">确定</el-button>
+ </div>
+ <el-button slot="reference" type="primary" icon="el-icon-s-check" size="mini" />
+ </el-popover>
+ <el-popover slot="left" :ref="`approve_${scope.row.id}`" v-permission="permission.approve" placement="top" width="180">
+ <p>确定承认本条数据吗?</p>
+ <div style="text-align: right; margin: 0">
+ <el-button size="mini" type="text" @click="approveCancel(scope.row)">取消</el-button>
+ <el-button :loading="approveLoading" type="primary" size="mini" @click="doApprove(scope.row)">确定</el-button>
+ </div>
+ <el-button slot="reference" type="primary" icon="el-icon-finished" size="mini" style="margin-left: 3px;" />
+ </el-popover>
+ </udOperation>
+ </template>
+ </el-table-column>
+ </el-table>
+ <!--分页组件-->
+ <pagination />
+ <!--表单组件-->
+ <el-dialog :close-on-click-modal="false" :before-close="closeGenerate" :visible.sync="generateStatus" title="生成工资记录" width="500px">
+ <el-form ref="generateForm" :model="generateForm" :rules="generateRules" size="small" label-width="80px">
+ <el-form-item label="工资年月" prop="targetYearMonth">
+ <el-date-picker
+ v-model="generateForm.targetYearMonth"
+ type="month"
+ style="width: 370px;"
+ placeholder="请选择"
+ />
+ </el-form-item>
+ <el-form-item label="所属员工" prop="userId">
+ <el-select v-model="generateForm.userId" filterable clearable placeholder="请选择" style="width: 370px;">
+ <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>
+ <div slot="footer" class="dialog-footer">
+ <el-button type="text" @click="closeGenerate">取消</el-button>
+ <el-button :loading="generateLoading" type="primary" @click="submitGenerate">确认</el-button>
+ </div>
+ </el-dialog>
+ </div>
+ </div>
+</template>
+
+<script>
+import crudNewSalary from '@/api/salary/newSalary'
+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 constant from '../../../utils/constant'
+import crudUser from '@/api/system/user'
+import crudUserLevelWage from '@/api/treatment/userLevelWage'
+import crudUserLevelInsurance from '@/api/treatment/userInsurance'
+import crudUserLevelOther from '@/api/system/userLevelOther'
+import crudAttendance from '@/api/attendance/attendance'
+import crudTaskDaliy from '@/api/task/taskDaliy'
+import crudProjectPerformanceDetail from '@/api/project/projectPerformanceDetail'
+import crudSysConfigIndividualIncomeTax from '@/api/system/configIndividualIncomeTax'
+
+const defaultForm = { id: null, userId: null, salaryYearMonth: null, basicWage: null, fullDays: null, absenceDays: null, actualBasicWage: null, achievementsWage: null, needCompletedAchievementsHours: null, alreadyCompletedAchievementsHours: null, actualAchievementsWage: null, performanceWage: null, personalPerformanceProportion: null, needCompletedPerformanceHours: null, alreadyCompletedPerformanceHours: null, actualPerformanceWage: null, teamWage: null, actualComplianceTeamHours: null, alreadyCompletedTeamHours: null, actualTeamWage: null, pieceRate: 0, travelAllowance: 0, accumulationFund: null, accumulationFundPersonal: null, accumulationFundPersonalAmount: null, accumulationFundCompany: null, accumulationFundCompanyAmount: null, retirementInsurance: null, retirementInsurancePersonal: null, retirementInsurancePersonalAmount: null, retirementInsuranceCompany: null, retirementInsuranceCompanyAmount: null, medicalInsurance: null, medicalInsurancePersonal: null, medicalInsurancePersonalAmount: null, medicalInsuranceCompany: null, medicalInsuranceCompanyAmount: null, unemploymentInsurance: null, unemploymentInsurancePersonal: null, unemploymentInsurancePersonalAmount: null, unemploymentInsuranceCompany: null, unemploymentInsuranceCompanyAmount: null, birthInsurance: null, birthInsurancePersonal: null, birthInsurancePersonalAmount: null, birthInsuranceCompany: null, birthInsuranceCompanyAmount: null, employmentInsurance: null, employmentInsurancePersonal: null, employmentInsurancePersonalAmount: null, employmentInsuranceCompany: null, employmentInsuranceCompanyAmount: null, preTaxAmount: null, individualIncomeTax: null, afterTaxAmount: null, remarks: null, publicityStatus: constant.PUBLICITY_STATUS_NOT, approveStatus: constant.APPROVE_STATUS_UNRECOGNIZED, createBy: null, createTime: null, updateBy: null, updateTime: null }
+export default {
+ name: 'NewSalary',
+ components: { pagination, crudOperation, rrOperation, udOperation, moneyInput },
+ mixins: [presenter(), header(), form(defaultForm), crud()],
+ dicts: [constant.PUBLICITY_STATUS, constant.APPROVE_STATUS],
+ cruds() {
+ return CRUD({ title: '工资记录', url: 'api/newSalary', idField: 'id', sort: 'salaryYearMonth,desc', crudMethod: { ...crudNewSalary }})
+ },
+ 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', 'newSalary:add'],
+ edit: ['admin', 'newSalary:edit'],
+ del: ['admin', 'newSalary:del'],
+ download: ['admin', 'newSalary:download'],
+ publicity: ['admin', 'newSalary:publicity'],
+ approve: ['admin', 'newSalary:approve'],
+ generate: ['admin', 'newSalary:generate'],
+ queryUserId: ['admin', 'newSalary:queryUserId']
+ },
+ rules: {
+ userId: [
+ { required: true, message: '所属员工不能为空', trigger: 'change' }
+ ],
+ salaryYearMonth: [
+ { required: true, message: '工资年月不能为空', trigger: 'change' }
+ ],
+ 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' }
+ ],
+ 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' }
+ ],
+ 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' }
+ ],
+ teamWage: [
+ { required: true, message: '预计团队工资不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ actualComplianceTeamHours: [
+ { required: true, message: '实达标团队工时不能为空', trigger: 'blur' },
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ alreadyCompletedTeamHours: [
+ { required: true, message: '已完成团队工时不能为空', trigger: 'blur' },
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ actualTeamWage: [
+ { required: true, message: '实际团队工资不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ accumulationFund: [
+ { required: true, message: '公积金基数不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ accumulationFundPersonal: [
+ { required: true, message: '公积金个人缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ accumulationFundPersonalAmount: [
+ { required: true, message: '公积金个人缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ accumulationFundCompany: [
+ { required: true, message: '公积金公司缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ accumulationFundCompanyAmount: [
+ { required: true, message: '公积金公司缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ retirementInsurance: [
+ { required: true, message: '养老险基数不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ retirementInsurancePersonal: [
+ { required: true, message: '养老险个人缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ retirementInsurancePersonalAmount: [
+ { required: true, message: '养老险个人缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ retirementInsuranceCompany: [
+ { required: true, message: '养老险公司缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ retirementInsuranceCompanyAmount: [
+ { required: true, message: '养老险公司缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ medicalInsurance: [
+ { required: true, message: '医疗险基数不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ medicalInsurancePersonal: [
+ { required: true, message: '医疗险个人缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ medicalInsurancePersonalAmount: [
+ { required: true, message: '医疗险个人缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ medicalInsuranceCompany: [
+ { required: true, message: '医疗险公司缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ medicalInsuranceCompanyAmount: [
+ { required: true, message: '医疗险公司缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ unemploymentInsurance: [
+ { required: true, message: '失业险基数不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ unemploymentInsurancePersonal: [
+ { required: true, message: '失业险个人缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ unemploymentInsurancePersonalAmount: [
+ { required: true, message: '失业险个人缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ unemploymentInsuranceCompany: [
+ { required: true, message: '失业险公司缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ unemploymentInsuranceCompanyAmount: [
+ { required: true, message: '失业险公司缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ birthInsurance: [
+ { required: true, message: '生育险基数不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ birthInsurancePersonal: [
+ { required: true, message: '生育险个人缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ birthInsurancePersonalAmount: [
+ { required: true, message: '生育险个人缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ birthInsuranceCompany: [
+ { required: true, message: '生育险公司缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ birthInsuranceCompanyAmount: [
+ { required: true, message: '生育险公司缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ employmentInsurance: [
+ { required: true, message: '工伤险基数不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ employmentInsurancePersonal: [
+ { required: true, message: '工伤险个人缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ employmentInsurancePersonalAmount: [
+ { required: true, message: '工伤险个人缴纳金额不能为空', trigger: 'blur' },
+ { validator: wageValidate, trigger: 'blur' }
+ ],
+ employmentInsuranceCompany: [
+ { required: true, message: '工伤险公司缴纳比例不能为空', trigger: 'blur' },
+ { validator: proportionValidate, trigger: 'blur' }
+ ],
+ employmentInsuranceCompanyAmount: [
+ { 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: '工资年月' }
+ ],
+ // 字典:公示状态
+ publicityStatus: constant.PUBLICITY_STATUS,
+ // 字典:承认状态
+ approveStatus: constant.APPROVE_STATUS,
+ // 用户列表
+ users: [],
+ // 表单加载
+ formLoading: false,
+ // 公示弹窗加载
+ publicityLoading: false,
+ // 承认弹窗加载
+ approveLoading: false,
+ // 表单禁用标记(承认状态)
+ disabledFlagByApprove: false,
+ // 生成表单状态
+ generateStatus: false,
+ // 生成表单加载
+ generateLoading: false,
+ // 生成表单数据
+ generateForm: { targetYearMonth: null, userId: null },
+ // 生成表单验证
+ generateRules: {
+ targetYearMonth: [
+ { required: true, message: '工资年月不能为空', trigger: 'change' }
+ ]
+ },
+ // 预计基本工资随机数
+ basicWageRandom: 0,
+ // 实际基本工资随机数
+ actualBasicWageRandom: 0,
+ // 预计绩效工资随机数
+ achievementsWageRandom: 0,
+ // 实际绩效工资随机数
+ actualAchievementsWageRandom: 0,
+ // 预计业绩工资随机数
+ performanceWageRandom: 0,
+ // 实际业绩工资随机数
+ actualPerformanceWageRandom: 0,
+ // 预计团队工资随机数
+ teamWageRandom: 0,
+ // 实际团队工资随机数
+ actualTeamWageRandom: 0,
+ // 计件工资随机数
+ pieceRateRandom: 0,
+ // 出差补助工资随机数
+ travelAllowanceRandom: 0,
+ // 公积金基数随机数
+ accumulationFundRandom: 0,
+ // 公积金个人缴纳金额随机数
+ accumulationFundPersonalAmountRandom: 0,
+ // 公积金公司缴纳金额随机数
+ accumulationFundCompanyAmountRandom: 0,
+ // 养老险基数随机数
+ retirementInsuranceRandom: 0,
+ // 养老险个人缴纳金额随机数
+ retirementInsurancePersonalAmountRandom: 0,
+ // 养老险公司缴纳金额随机数
+ retirementInsuranceCompanyAmountRandom: 0,
+ // 医疗险基数随机数
+ medicalInsuranceRandom: 0,
+ // 医疗险个人缴纳金额随机数
+ medicalInsurancePersonalAmountRandom: 0,
+ // 医疗险公司缴纳金额随机数
+ medicalInsuranceCompanyAmountRandom: 0,
+ // 失业险基数随机数
+ unemploymentInsuranceRandom: 0,
+ // 失业险个人缴纳金额随机数
+ unemploymentInsurancePersonalAmountRandom: 0,
+ // 失业险公司缴纳金额随机数
+ unemploymentInsuranceCompanyAmountRandom: 0,
+ // 生育险基数随机数
+ birthInsuranceRandom: 0,
+ // 生育险个人缴纳金额随机数
+ birthInsurancePersonalAmountRandom: 0,
+ // 生育险公司缴纳金额随机数
+ birthInsuranceCompanyAmountRandom: 0,
+ // 工伤险基数随机数
+ employmentInsuranceRandom: 0,
+ // 工伤险个人缴纳金额随机数
+ employmentInsurancePersonalAmountRandom: 0,
+ // 工伤险公司缴纳金额随机数
+ employmentInsuranceCompanyAmountRandom: 0,
+ // 税前金额随机数
+ preTaxAmountRandom: 0,
+ // 个人所得税随机数
+ individualIncomeTaxRandom: 0,
+ // 税后金额随机数
+ afterTaxAmountRandom: 0
+ }
+ },
+ methods: {
+ // 钩子:在获取表格数据之前执行,false 则代表不获取数据
+ [CRUD.HOOK.beforeRefresh]() {
+ // 获取用户
+ this.getUser()
+ return true
+ },
+ // 获取用户
+ getUser() {
+ // 获取用户
+ crudUser.getAll().then(res => {
+ // 用户列表
+ this.users = res
+ })
+ },
+ // 钩子: 开始 "新建/编辑" - 之前
+ [CRUD.HOOK.beforeToCU]() {
+ // 判断表单承认状态
+ if (this.form.approveStatus === constant.APPROVE_STATUS_ACKNOWLEDGED) {
+ // 表单禁用标记(承认状态)
+ this.disabledFlagByApprove = true
+ } else {
+ // 表单禁用标记(承认状态)
+ this.disabledFlagByApprove = false
+ }
+ // 预计基本工资随机数
+ this.basicWageRandom = Math.random()
+ // 实际基本工资随机数
+ this.actualBasicWageRandom = Math.random()
+ // 预计绩效工资随机数
+ this.achievementsWageRandom = Math.random()
+ // 实际绩效工资随机数
+ this.actualAchievementsWageRandom = Math.random()
+ // 预计业绩工资随机数
+ this.performanceWageRandom = Math.random()
+ // 实际业绩工资随机数
+ this.actualPerformanceWageRandom = Math.random()
+ // 预计团队工资随机数
+ this.teamWageRandom = Math.random()
+ // 实际团队工资随机数
+ this.actualTeamWageRandom = Math.random()
+ // 公积金基数随机数
+ this.accumulationFundRandom = Math.random()
+ // 公积金个人缴纳金额随机数
+ this.accumulationFundPersonalAmountRandom = Math.random()
+ // 公积金公司缴纳金额随机数
+ this.accumulationFundCompanyAmountRandom = Math.random()
+ // 养老险基数随机数
+ this.retirementInsuranceRandom = Math.random()
+ // 养老险个人缴纳金额随机数
+ this.retirementInsurancePersonalAmountRandom = Math.random()
+ // 养老险公司缴纳金额随机数
+ this.retirementInsuranceCompanyAmountRandom = Math.random()
+ // 医疗险基数随机数
+ this.medicalInsuranceRandom = Math.random()
+ // 医疗险个人缴纳金额随机数
+ this.medicalInsurancePersonalAmountRandom = Math.random()
+ // 医疗险公司缴纳金额随机数
+ this.medicalInsuranceCompanyAmountRandom = Math.random()
+ // 失业险基数随机数
+ this.unemploymentInsuranceRandom = Math.random()
+ // 失业险个人缴纳金额随机数
+ this.unemploymentInsurancePersonalAmountRandom = Math.random()
+ // 失业险公司缴纳金额随机数
+ this.unemploymentInsuranceCompanyAmountRandom = Math.random()
+ // 生育险基数随机数
+ this.birthInsuranceRandom = Math.random()
+ // 生育险个人缴纳金额随机数
+ this.birthInsurancePersonalAmountRandom = Math.random()
+ // 生育险公司缴纳金额随机数
+ this.birthInsuranceCompanyAmountRandom = Math.random()
+ // 工伤险基数随机数
+ this.employmentInsuranceRandom = Math.random()
+ // 工伤险个人缴纳金额随机数
+ this.employmentInsurancePersonalAmountRandom = Math.random()
+ // 工伤险公司缴纳金额随机数
+ this.employmentInsuranceCompanyAmountRandom = Math.random()
+ // 税前金额随机数
+ this.preTaxAmountRandom = Math.random()
+ // 个人所得税随机数
+ this.individualIncomeTaxRandom = Math.random()
+ // 税后金额随机数
+ this.afterTaxAmountRandom = Math.random()
+ },
+ // 钩子: 编辑 - 之前
+ // [CRUD.HOOK.beforeToEdit]() {
+ // // 表单加载
+ // this.formLoading = true
+ // },
+ // 获取用户级别数据
+ getUserLevel() {
+ // 判断所属员工、工资年月是否为空
+ if (this.form.userId != null && this.form.userId !== '' && this.form.salaryYearMonth != null && this.form.salaryYearMonth !== '') {
+ // 表单加载
+ this.formLoading = true
+ // 执行完以下内容才往下走:获取用户级别工资、获取用户级别保险、获取用户级别其他、获取工作天数、获取出勤小时数、获取达标工时、获取已完成工时
+ Promise.all([
+ this.getUserLevelWage(), this.getUserLevelInsurance(), this.getUserLevelOther(), this.getWorkDays(), this.getAttendanceHours(),
+ this.getComplianceWork(), this.getCompletedWork()
+ ]).then(res => {
+ // 表单加载
+ this.formLoading = false
+ }).catch(() => {
+ // 表单加载
+ this.formLoading = false
+ })
+ }
+ },
+ // 获取用户级别工资
+ getUserLevelWage() {
+ return new Promise((resolve, reject) => {
+ // 获取用户级别工资
+ crudUserLevelWage.getTargetYearMonth({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
+ console.log(res)
+ // 级别基本工资
+ const basicWage = Number(res.basicWage.toFixed(2))
+ // 级别等级工资
+ const rankWage = Number(res.rankWage.toFixed(2))
+ // 预计基本工资
+ this.form.basicWage = Number((basicWage + rankWage).toFixed(2))
+ // 预计基本工资随机数
+ this.basicWageRandom = Math.random()
+ // 预计绩效工资
+ this.form.achievementsWage = Number(res.performanceWage.toFixed(2))
+ // 预计绩效工资随机数
+ this.achievementsWageRandom = Math.random()
+ // 预计业绩工资
+ this.form.performanceWage = 0
+ // 预计业绩工资随机数
+ this.performanceWageRandom = Math.random()
+ // 预计团队工资
+ this.form.teamWage = 0
+ // 预计团队工资随机数
+ this.teamWageRandom = Math.random()
+ // 成功
+ resolve()
+ }).catch(() => {
+ // 预计基本工资
+ this.form.basicWage = 0
+ // 预计基本工资随机数
+ this.basicWageRandom = Math.random()
+ // 预计绩效工资
+ this.form.achievementsWage = 0
+ // 预计绩效工资随机数
+ this.achievementsWageRandom = Math.random()
+ // 预计业绩工资
+ this.form.performanceWage = 0
+ // 预计业绩工资随机数
+ this.performanceWageRandom = Math.random()
+ // 预计团队工资
+ this.form.teamWage = 0
+ // 预计团队工资随机数
+ this.teamWageRandom = Math.random()
+ // 失败
+ reject()
+ })
+ })
+ },
+ // 获取用户级别保险
+ getUserLevelInsurance() {
+ return new Promise((resolve, reject) => {
+ // 获取用户级别保险
+ crudUserLevelInsurance.getTargetYearMonth({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
+ // 公积金基数
+ this.form.accumulationFund = Number(res.accumulationFund.toFixed(2))
+ // 公积金基数随机数
+ this.accumulationFundRandom = Math.random()
+ // 公积金个人缴纳比例
+ this.form.accumulationFundPersonal = Number(res.accumulationFundPersonal.toFixed(2))
+ // 公积金个人缴纳金额
+ this.form.accumulationFundPersonalAmount = Number((res.accumulationFund * (res.accumulationFundPersonal / 100)).toFixed(2))
+ // 公积金个人缴纳金额随机数
+ this.accumulationFundPersonalAmountRandom = Math.random()
+ // 公积金公司缴纳比例
+ this.form.accumulationFundCompany = Number(res.accumulationFundCompany.toFixed(2))
+ // 公积金公司缴纳金额
+ this.form.accumulationFundCompanyAmount = Number((res.accumulationFund * (res.accumulationFundCompany / 100)).toFixed(2))
+ // 公积金公司缴纳金额随机数
+ this.accumulationFundCompanyAmountRandom = Math.random()
+ // 养老险基数
+ this.form.retirementInsurance = Number(res.retirementInsurance.toFixed(2))
+ // 养老险基数随机数
+ this.retirementInsuranceRandom = Math.random()
+ // 养老险个人缴纳比例
+ this.form.retirementInsurancePersonal = Number(res.retirementInsurancePersonal.toFixed(2))
+ // 养老险个人缴纳金额
+ this.form.retirementInsurancePersonalAmount = Number((res.retirementInsurance * (res.retirementInsurancePersonal / 100)).toFixed(2))
+ // 养老险个人缴纳金额随机数
+ this.retirementInsurancePersonalAmountRandom = Math.random()
+ // 养老险公司缴纳比例
+ this.form.retirementInsuranceCompany = Number(res.retirementInsuranceCompany.toFixed(2))
+ // 养老险公司缴纳金额
+ this.form.retirementInsuranceCompanyAmount = Number((res.retirementInsurance * (res.retirementInsuranceCompany / 100)).toFixed(2))
+ // 养老险公司缴纳金额随机数
+ this.retirementInsuranceCompanyAmountRandom = Math.random()
+ // 医疗险基数
+ this.form.medicalInsurance = Number(res.medicalInsurance.toFixed(2))
+ // 医疗险基数随机数
+ this.medicalInsuranceRandom = Math.random()
+ // 医疗险个人缴纳比例
+ this.form.medicalInsurancePersonal = Number(res.medicalInsurancePersonal.toFixed(2))
+ // 医疗险个人缴纳金额
+ this.form.medicalInsurancePersonalAmount = Number((res.medicalInsurance * (res.medicalInsurancePersonal / 100)).toFixed(2))
+ // 医疗险个人缴纳金额随机数
+ this.medicalInsurancePersonalAmountRandom = Math.random()
+ // 医疗险公司缴纳比例
+ this.form.medicalInsuranceCompany = Number(res.medicalInsuranceCompany.toFixed(2))
+ // 医疗险公司缴纳金额
+ this.form.medicalInsuranceCompanyAmount = Number((res.medicalInsurance * (res.medicalInsuranceCompany / 100)).toFixed(2))
+ // 医疗险公司缴纳金额随机数
+ this.medicalInsuranceCompanyAmountRandom = Math.random()
+ // 失业险基数
+ this.form.unemploymentInsurance = Number(res.unemploymentInsurance.toFixed(2))
+ // 失业险基数随机数
+ this.unemploymentInsuranceRandom = Math.random()
+ // 失业险个人缴纳比例
+ this.form.unemploymentInsurancePersonal = Number(res.unemploymentInsurancePersonal.toFixed(2))
+ // 失业险个人缴纳金额
+ this.form.unemploymentInsurancePersonalAmount = Number((res.unemploymentInsurance * (res.unemploymentInsurancePersonal / 100)).toFixed(2))
+ // 失业险个人缴纳金额随机数
+ this.unemploymentInsurancePersonalAmountRandom = Math.random()
+ // 失业险公司缴纳比例
+ this.form.unemploymentInsuranceCompany = Number(res.unemploymentInsuranceCompany.toFixed(2))
+ // 失业险公司缴纳金额
+ this.form.unemploymentInsuranceCompanyAmount = Number((res.unemploymentInsurance * (res.unemploymentInsuranceCompany / 100)).toFixed(2))
+ // 失业险公司缴纳金额随机数
+ this.unemploymentInsuranceCompanyAmountRandom = Math.random()
+ // 生育险基数
+ this.form.birthInsurance = Number(res.birthInsurance.toFixed(2))
+ // 生育险基数随机数
+ this.birthInsuranceRandom = Math.random()
+ // 生育险个人缴纳比例
+ this.form.birthInsurancePersonal = Number(res.birthInsurancePersonal.toFixed(2))
+ // 生育险个人缴纳金额
+ this.form.birthInsurancePersonalAmount = Number((res.birthInsurance * (res.birthInsurancePersonal / 100)).toFixed(2))
+ // 生育险个人缴纳金额随机数
+ this.birthInsurancePersonalAmountRandom = Math.random()
+ // 生育险公司缴纳比例
+ this.form.birthInsuranceCompany = Number(res.birthInsuranceCompany.toFixed(2))
+ // 生育险公司缴纳金额
+ this.form.birthInsuranceCompanyAmount = Number((res.birthInsurance * (res.birthInsuranceCompany / 100)).toFixed(2))
+ // 生育险公司缴纳金额随机数
+ this.birthInsuranceCompanyAmountRandom = Math.random()
+ // 工伤险基数
+ this.form.employmentInsurance = Number(res.employmentInsurance.toFixed(2))
+ // 工伤险基数随机数
+ this.employmentInsuranceRandom = Math.random()
+ // 工伤险个人缴纳比例
+ this.form.employmentInsurancePersonal = Number(res.employmentInsurancePersonal.toFixed(2))
+ // 工伤险个人缴纳金额
+ this.form.employmentInsurancePersonalAmount = Number((res.employmentInsurance * (res.employmentInsurancePersonal / 100)).toFixed(2))
+ // 工伤险个人缴纳金额随机数
+ this.employmentInsurancePersonalAmountRandom = Math.random()
+ // 工伤险公司缴纳比例
+ this.form.employmentInsuranceCompany = Number(res.employmentInsuranceCompany.toFixed(2))
+ // 工伤险公司缴纳金额
+ this.form.employmentInsuranceCompanyAmount = Number((res.employmentInsurance * (res.employmentInsuranceCompany / 100)).toFixed(2))
+ // 工伤险公司缴纳金额随机数
+ this.employmentInsuranceCompanyAmountRandom = Math.random()
+ // 成功
+ resolve()
+ }).catch(() => {
+ // 公积金基数
+ this.form.accumulationFund = 0
+ // 公积金基数随机数
+ this.accumulationFundRandom = Math.random()
+ // 公积金个人缴纳比例
+ this.form.accumulationFundPersonal = 0
+ // 公积金个人缴纳金额
+ this.form.accumulationFundPersonalAmount = 0
+ // 公积金个人缴纳金额随机数
+ this.accumulationFundPersonalAmountRandom = Math.random()
+ // 公积金公司缴纳比例
+ this.form.accumulationFundCompany = 0
+ // 公积金公司缴纳金额
+ this.form.accumulationFundCompanyAmount = 0
+ // 公积金公司缴纳金额随机数
+ this.accumulationFundCompanyAmountRandom = Math.random()
+ // 养老险基数
+ this.form.retirementInsurance = 0
+ // 养老险基数随机数
+ this.retirementInsuranceRandom = Math.random()
+ // 养老险个人缴纳比例
+ this.form.retirementInsurancePersonal = 0
+ // 养老险个人缴纳金额
+ this.form.retirementInsurancePersonalAmount = 0
+ // 养老险个人缴纳金额随机数
+ this.retirementInsurancePersonalAmountRandom = Math.random()
+ // 养老险公司缴纳比例
+ this.form.retirementInsuranceCompany = 0
+ // 养老险公司缴纳金额
+ this.form.retirementInsuranceCompanyAmount = 0
+ // 养老险公司缴纳金额随机数
+ this.retirementInsuranceCompanyAmountRandom = Math.random()
+ // 医疗险基数
+ this.form.medicalInsurance = 0
+ // 医疗险基数随机数
+ this.medicalInsuranceRandom = Math.random()
+ // 医疗险个人缴纳比例
+ this.form.medicalInsurancePersonal = 0
+ // 医疗险个人缴纳金额
+ this.form.medicalInsurancePersonalAmount = 0
+ // 医疗险个人缴纳金额随机数
+ this.medicalInsurancePersonalAmountRandom = Math.random()
+ // 医疗险公司缴纳比例
+ this.form.medicalInsuranceCompany = 0
+ // 医疗险公司缴纳金额
+ this.form.medicalInsuranceCompanyAmount = 0
+ // 医疗险公司缴纳金额随机数
+ this.medicalInsuranceCompanyAmountRandom = Math.random()
+ // 失业险基数
+ this.form.unemploymentInsurance = 0
+ // 失业险基数随机数
+ this.unemploymentInsuranceRandom = Math.random()
+ // 失业险个人缴纳比例
+ this.form.unemploymentInsurancePersonal = 0
+ // 失业险个人缴纳金额
+ this.form.unemploymentInsurancePersonalAmount = 0
+ // 失业险个人缴纳金额随机数
+ this.unemploymentInsurancePersonalAmountRandom = Math.random()
+ // 失业险公司缴纳比例
+ this.form.unemploymentInsuranceCompany = 0
+ // 失业险公司缴纳金额
+ this.form.unemploymentInsuranceCompanyAmount = 0
+ // 失业险公司缴纳金额随机数
+ this.unemploymentInsuranceCompanyAmountRandom = Math.random()
+ // 生育险基数
+ this.form.birthInsurance = 0
+ // 生育险基数随机数
+ this.birthInsuranceRandom = Math.random()
+ // 生育险个人缴纳比例
+ this.form.birthInsurancePersonal = 0
+ // 生育险个人缴纳金额
+ this.form.birthInsurancePersonalAmount = 0
+ // 生育险个人缴纳金额随机数
+ this.birthInsurancePersonalAmountRandom = Math.random()
+ // 生育险公司缴纳比例
+ this.form.birthInsuranceCompany = 0
+ // 生育险公司缴纳金额
+ this.form.birthInsuranceCompanyAmount = 0
+ // 生育险公司缴纳金额随机数
+ this.birthInsuranceCompanyAmountRandom = Math.random()
+ // 工伤险基数
+ this.form.employmentInsurance = 0
+ // 工伤险基数随机数
+ this.employmentInsuranceRandom = Math.random()
+ // 工伤险个人缴纳比例
+ this.form.employmentInsurancePersonal = 0
+ // 工伤险个人缴纳金额
+ this.form.employmentInsurancePersonalAmount = 0
+ // 工伤险个人缴纳金额随机数
+ this.employmentInsurancePersonalAmountRandom = Math.random()
+ // 工伤险公司缴纳比例
+ this.form.employmentInsuranceCompany = 0
+ // 工伤险公司缴纳金额
+ this.form.employmentInsuranceCompanyAmount = 0
+ // 工伤险公司缴纳金额随机数
+ this.employmentInsuranceCompanyAmountRandom = Math.random()
+ // 失败
+ reject()
+ })
+ })
+ },
+ // 获取用户级别其他
+ getUserLevelOther() {
+ return new Promise((resolve, reject) => {
+ // 获取用户级别其他
+ crudUserLevelOther.getTargetYearMonth({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
+ // 个人业绩比例
+ this.form.personalPerformanceProportion = Number(res.personalPerformanceProportion.toFixed(2))
+ // 成功
+ resolve()
+ }).catch(() => {
+ // 个人业绩比例
+ this.form.personalPerformanceProportion = 0
+ // 失败
+ reject()
+ })
+ })
+ },
+ // 获取工作天数
+ getWorkDays() {
+ return new Promise((resolve, reject) => {
+ // 获取工作天数
+ crudNewSalary.workDays({ targetYearMonth: this.form.salaryYearMonth }).then(res => {
+ // 全勤小时数
+ this.form.fullDays = Number((res * 8).toFixed(2))
+ // 应完成绩效工时
+ this.form.needCompletedAchievementsHours = Number((res * 8).toFixed(2))
+ // 定时器
+ const interval = setInterval(() => {
+ // 判断个人业绩比例是否为空
+ if (this.form.personalPerformanceProportion != null && this.form.personalPerformanceProportion !== '') {
+ // 应完成业绩工时
+ this.form.needCompletedPerformanceHours = Number((res * 8 * (1 + this.form.personalPerformanceProportion / 100)).toFixed(2))
+ // 清空定时器
+ clearInterval(interval)
+ // 成功
+ resolve()
+ }
+ }, 500)
+ }).catch(() => {
+ // 全勤小时数
+ this.form.fullDays = 0
+ // 应完成绩效工时
+ this.form.needCompletedAchievementsHours = 0
+ // 应完成业绩工时
+ this.form.needCompletedPerformanceHours = 0
+ // 失败
+ reject()
+ })
+ })
+ },
+ // 获取出勤小时数
+ getAttendanceHours() {
+ return new Promise((resolve, reject) => {
+ // 获取出勤小时数
+ crudAttendance.attendanceHours({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
+ // 定时器
+ const interval = setInterval(() => {
+ // 判断预计基础工资、全勤小时数是否为空
+ if (this.form.basicWage != null && this.form.basicWage !== '' && this.form.fullDays != null && this.form.fullDays !== '') {
+ // 缺勤小时数
+ this.form.absenceDays = Number((this.form.fullDays - res).toFixed(2))
+ // 实际基础工资
+ this.form.actualBasicWage = Number((this.form.basicWage - (this.form.basicWage / this.form.fullDays) * (this.form.fullDays - res)).toFixed(2))
+ // 实际基本工资随机数
+ this.actualBasicWageRandom = Math.random()
+ // 清空定时器
+ clearInterval(interval)
+ // 成功
+ resolve()
+ }
+ }, 500)
+ }).catch(() => {
+ // 缺勤小时数
+ this.form.absenceDays = 0
+ // 实际基础工资
+ this.form.actualBasicWage = 0
+ // 实际基本工资随机数
+ this.actualBasicWageRandom = Math.random()
+ // 失败
+ reject()
+ })
+ })
+ },
+ // 获取达标工时
+ getComplianceWork() {
+ return new Promise((resolve, reject) => {
+ // 获取达标工时
+ crudProjectPerformanceDetail.complianceWork({ userId: this.form.userId, yearMonth: this.form.salaryYearMonth }).then(res => {
+ // 实达标团队工时
+ this.form.actualComplianceTeamHours = Number(res.toFixed(2))
+ // 成功
+ resolve()
+ }).catch(() => {
+ // 实达标团队工时
+ this.form.actualComplianceTeamHours = 0
+ // 失败
+ reject()
+ })
+ })
+ },
+ // 获取已完成工时
+ getCompletedWork() {
+ return new Promise((resolve, reject) => {
+ // 获取已完成工时
+ crudTaskDaliy.completedWork({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
+ // 已完成绩效工时
+ this.form.alreadyCompletedAchievementsHours = Number(res.toFixed(2))
+ // 已完成业绩工时
+ this.form.alreadyCompletedPerformanceHours = Number(res.toFixed(2))
+ // 已完成团队工时
+ this.form.alreadyCompletedTeamHours = Number(res.toFixed(2))
+ // 绩效定时器
+ const achievementsInterval = setInterval(() => {
+ // 判断预计绩效工资、应完成绩效工时是否为空
+ if (this.form.achievementsWage != null && this.form.achievementsWage !== '' && this.form.needCompletedAchievementsHours != null && this.form.needCompletedAchievementsHours !== '') {
+ // 实际绩效工资
+ this.form.actualAchievementsWage = Number((this.form.achievementsWage * (res / this.form.needCompletedAchievementsHours)).toFixed(2))
+ // 实际绩效工资随机数
+ this.actualAchievementsWageRandom = Math.random()
+ // 清空绩效定时器
+ clearInterval(achievementsInterval)
+ }
+ }, 500)
+ // 业绩定时器
+ const performanceInterval = setInterval(() => {
+ // 判断预计业绩工资、应完成业绩工时是否为空
+ if (this.form.performanceWage != null && this.form.performanceWage !== '' && this.form.needCompletedPerformanceHours != null && this.form.needCompletedPerformanceHours !== '') {
+ // 实际业绩工资
+ this.form.actualPerformanceWage = Number((res >= this.form.needCompletedPerformanceHours ? this.form.performanceWage : 0).toFixed(2))
+ // 实际业绩工资随机数
+ this.actualPerformanceWageRandom = Math.random()
+ // 清空业绩定时器
+ clearInterval(performanceInterval)
+ }
+ }, 500)
+ // 团队定时器
+ const teamInterval = setInterval(() => {
+ // 判断预计团队工资、实达标团队工时是否为空
+ if (this.form.teamWage != null && this.form.teamWage !== '' && this.form.actualComplianceTeamHours != null && this.form.actualComplianceTeamHours !== '') {
+ // 实际团队工资
+ this.form.actualTeamWage = Number(this.form.actualComplianceTeamHours !== 0 ? (this.form.teamWage * (this.form.actualComplianceTeamHours / this.form.needCompletedAchievementsHours)).toFixed(2) : 0)
+ // 实际团队工资随机数
+ this.actualTeamWageRandom = Math.random()
+ // 清空团队定时器
+ clearInterval(teamInterval)
+ }
+ }, 500)
+ // 统计定时器
+ const statisticsInterval = setInterval(() => {
+ // 判断 实际基础工资、实际绩效工资、实际业绩工资、实际团队工资、公积金个人缴纳金额、
+ // 养老险个人缴纳金额、医疗险个人缴纳金额、失业险个人缴纳金额、生育险个人缴纳金额、工伤险个人缴纳金额 是否为空
+ if (
+ this.form.actualBasicWage != null && this.form.actualBasicWage !== '' &&
+ this.form.actualAchievementsWage != null && this.form.actualAchievementsWage !== '' &&
+ this.form.actualPerformanceWage != null && this.form.actualPerformanceWage !== '' &&
+ this.form.actualTeamWage != null && this.form.actualTeamWage !== '' &&
+ this.form.accumulationFundPersonalAmount != null && this.form.accumulationFundPersonalAmount !== '' &&
+ this.form.retirementInsurancePersonalAmount != null && this.form.retirementInsurancePersonalAmount !== '' &&
+ this.form.medicalInsurancePersonalAmount != null && this.form.medicalInsurancePersonalAmount !== '' &&
+ this.form.unemploymentInsurancePersonalAmount != null && this.form.unemploymentInsurancePersonalAmount !== '' &&
+ this.form.birthInsurancePersonalAmount != null && this.form.birthInsurancePersonalAmount !== '' &&
+ this.form.employmentInsurancePersonalAmount != null && this.form.employmentInsurancePersonalAmount !== ''
+ ) {
+ // 统计金额
+ this.statisticalAmount()
+ // 清空统计定时器
+ clearInterval(statisticsInterval)
+ // 成功
+ resolve()
+ }
+ }, 500)
+ }).catch(() => {
+ // 已完成绩效工时
+ this.form.alreadyCompletedAchievementsHours = 0
+ // 已完成业绩工时
+ this.form.alreadyCompletedPerformanceHours = 0
+ // 已完成团队工时
+ this.form.alreadyCompletedTeamHours = 0
+ // 实际绩效工资
+ this.form.actualAchievementsWage = 0
+ // 实际绩效工资随机数
+ this.actualAchievementsWageRandom = Math.random()
+ // 实际业绩工资
+ this.form.actualPerformanceWage = 0
+ // 实际业绩工资随机数
+ this.actualPerformanceWageRandom = Math.random()
+ // 实际团队工资
+ this.form.actualTeamWage = 0
+ // 实际团队工资随机数
+ this.actualTeamWageRandom = Math.random()
+ // 税前金额
+ this.form.preTaxAmount = 0
+ // 税前金额随机数
+ this.preTaxAmountRandom = Math.random()
+ // 个人所得税
+ this.form.individualIncomeTax = 0
+ // 个人所得税随机数
+ this.individualIncomeTaxRandom = Math.random()
+ // 税后金额
+ this.form.afterTaxAmount = 0
+ // 税后金额随机数
+ this.afterTaxAmountRandom = Math.random()
+ // 失败
+ reject()
+ })
+ })
+ },
+ // 公示弹窗关闭
+ publicityCancel(data) {
+ // 公示弹窗隐藏
+ this.$refs[`publicity_${data.id}`].showPopper = false
+ },
+ // 公示弹窗确认
+ doPublicity(data) {
+ // 公示弹窗加载
+ this.publicityLoading = true
+ // 公示工资
+ crudNewSalary.publicity([data.id]).then(res => {
+ // 搜索:刷新表格
+ this.crud.toQuery()
+ // 消息提示
+ this.crud.notify('公示成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
+ // 公示弹窗加载
+ this.publicityLoading = false
+ // 公示弹窗隐藏
+ this.$refs[`publicity_${data.id}`].showPopper = false
+ }).catch(() => {
+ // 公示弹窗加载
+ this.publicityLoading = false
+ })
+ },
+ // 多工资公示
+ multiplePublicity(data) {
+ // 确认框
+ this.$confirm('此操作将公示 ' + data.length + ' 条工资, 是否继续?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'success'
+ }).then(() => {
+ // ID列表
+ const ids = []
+ // 循环数据
+ for (let i = 0; i < data.length; i++) {
+ // ID列表
+ ids.push(data[i].id)
+ // 判断循环是否结束
+ if (i === data.length - 1) {
+ // 公示工资
+ crudNewSalary.publicity(ids).then(res => {
+ // 搜索:刷新表格
+ this.crud.toQuery()
+ // 消息提示
+ this.crud.notify('公示成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
+ })
+ }
+ }
+ })
+ },
+ // 承认弹窗关闭
+ approveCancel(data) {
+ // 承认弹窗隐藏
+ this.$refs[`approve_${data.id}`].showPopper = false
+ },
+ // 承认弹窗确认
+ doApprove(data) {
+ // 承认弹窗加载
+ this.approveLoading = true
+ // 承认工资
+ crudNewSalary.approve([data.id]).then(res => {
+ // 搜索:刷新表格
+ this.crud.toQuery()
+ // 消息提示
+ this.crud.notify('承认成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
+ // 承认弹窗加载
+ this.approveLoading = false
+ // 承认弹窗隐藏
+ this.$refs[`approve_${data.id}`].showPopper = false
+ }).catch(() => {
+ // 承认弹窗加载
+ this.approveLoading = false
+ })
+ },
+ // 多工资承认
+ multipleApprove(data) {
+ // 确认框
+ this.$confirm('此操作将承认 ' + data.length + ' 条工资, 是否继续?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'success'
+ }).then(() => {
+ // ID列表
+ const ids = []
+ // 循环数据
+ for (let i = 0; i < data.length; i++) {
+ // ID列表
+ ids.push(data[i].id)
+ // 判断循环是否结束
+ if (i === data.length - 1) {
+ // 承认工资
+ crudNewSalary.approve(ids).then(res => {
+ // 搜索:刷新表格
+ this.crud.toQuery()
+ // 消息提示
+ this.crud.notify('承认成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
+ })
+ }
+ }
+ })
+ },
+ // 生成表单打开
+ openGenerate() {
+ // 生成表单状态
+ this.generateStatus = true
+ },
+ // 生成表单关闭
+ closeGenerate() {
+ // 生成表单状态
+ this.generateStatus = false
+ // 生成表单数据
+ this.generateForm = { targetYearMonth: null, userId: null }
+ // 清空表单
+ this.$refs['generateForm'].clearValidate()
+ },
+ // 生成表单提交
+ submitGenerate() {
+ // 生成表单加载
+ this.generateLoading = true
+ // 表单验证
+ this.$refs['generateForm'].validate((valid) => {
+ if (valid) {
+ // 生成工资
+ crudNewSalary.generate(this.generateForm).then(res => {
+ // 生成表单加载
+ this.generateLoading = false
+ // 生成表单关闭
+ this.closeGenerate()
+ // 搜索:刷新表格
+ this.crud.toQuery()
+ // 消息提示
+ this.crud.notify('生成成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
+ }).catch(() => {
+ // 生成表单加载
+ this.generateLoading = false
+ })
+ } else {
+ // 生成表单加载
+ this.generateLoading = false
+ }
+ })
+ },
+ // 基本参数变更
+ basicParameterBlur() {
+ // 实际基础工资 = 预计基本工资 - (预计基本工资 / 全勤小时数) * 缺勤小时数
+ this.form.actualBasicWage = Number((this.form.basicWage - (this.form.basicWage / this.form.fullDays) * this.form.absenceDays).toFixed(2))
+ // 实际基本工资随机数
+ this.actualBasicWageRandom = Math.random()
+ // 统计金额
+ this.statisticalAmount()
+ },
+ // 预计基本工资变更
+ basicWageBlur() {
+ // 实际基础工资 = 预计基本工资 - (预计基本工资 / 全勤小时数) * 缺勤小时数
+ this.form.actualBasicWage = Number((this.form.basicWage - (this.form.basicWage / this.form.fullDays) * this.form.absenceDays).toFixed(2))
+ // 实际基本工资随机数
+ this.actualBasicWageRandom = Math.random()
+ // 统计金额
+ this.statisticalAmount()
+ },
+ // 绩效参数变更
+ achievementsParameterBlur() {
+ // 实际绩效工资 = 预计绩效工资 * (已完成绩效工时 / 应完成绩效工时)
+ this.form.actualAchievementsWage = Number((this.form.achievementsWage * (this.form.alreadyCompletedAchievementsHours / this.form.needCompletedAchievementsHours)).toFixed(2))
+ // 实际绩效工资随机数
+ this.actualAchievementsWageRandom = Math.random()
+ // 统计金额
+ this.statisticalAmount()
+ },
+ // 预计绩效工资变更
+ achievementsWageBlur() {
+ // 实际绩效工资 = 预计绩效工资 * (已完成绩效工时 / 应完成绩效工时)
+ this.form.actualAchievementsWage = Number((this.form.achievementsWage * (this.form.alreadyCompletedAchievementsHours / this.form.needCompletedAchievementsHours)).toFixed(2))
+ // 实际绩效工资随机数
+ this.actualAchievementsWageRandom = Math.random()
+ // 统计金额
+ this.statisticalAmount()
+ },
+ // 业绩参数变更
+ performanceParameterBlur() {
+ // 实际业绩工资 = 已完成业绩工时 >= 应完成业绩工时 ? 预计业绩工资 : 0
+ this.form.actualPerformanceWage = Number((this.form.alreadyCompletedPerformanceHours >= this.form.needCompletedPerformanceHours ? this.form.performanceWage : 0).toFixed(2))
+ // 实际业绩工资随机数
+ this.actualPerformanceWageRandom = Math.random()
+ // 统计金额
+ this.statisticalAmount()
+ },
+ // 预计业绩工资变更
+ performanceWageBlur() {
+ // 实际业绩工资 = 已完成业绩工时 >= 应完成业绩工时 ? 预计业绩工资 : 0
+ this.form.actualPerformanceWage = Number((this.form.alreadyCompletedPerformanceHours >= this.form.needCompletedPerformanceHours ? this.form.performanceWage : 0).toFixed(2))
+ // 实际业绩工资随机数
+ this.actualPerformanceWageRandom = Math.random()
+ // 统计金额
+ this.statisticalAmount()
+ },
+ // 团队参数变更
+ teamParameterBlur() {
+ // 实际团队工资 = 预计团队工资 * (实达标团队工时 / 已完成团队工时)
+ this.form.actualTeamWage = Number(this.form.actualComplianceTeamHours !== 0 ? (this.form.teamWage * (this.form.actualComplianceTeamHours / this.form.alreadyCompletedTeamHours)).toFixed(2) : 0)
+ // 实际团队工资随机数
+ this.actualTeamWageRandom = Math.random()
+ // 统计金额
+ this.statisticalAmount()
+ },
+ // 预计团队工资变更
+ teamWageBlur() {
+ // 实际团队工资 = 预计团队工资 * (实达标团队工时 / 已完成团队工时)
+ this.form.actualTeamWage = Number(this.form.actualComplianceTeamHours !== 0 ? (this.form.teamWage * (this.form.actualComplianceTeamHours / this.form.alreadyCompletedTeamHours)).toFixed(2) : 0)
+ // 实际团队工资随机数
+ this.actualTeamWageRandom = Math.random()
+ // 统计金额
+ this.statisticalAmount()
+ },
+ // 公积金参数变更
+ accumulationParameterBlur() {
+ // 公积金个人缴纳金额 = 公积金基数 * (公积金个人缴纳比例 / 100)
+ this.form.accumulationFundPersonalAmount = Number((this.form.accumulationFund * (this.form.accumulationFundPersonal / 100)).toFixed(2))
+ // 公积金个人缴纳金额随机数
+ this.accumulationFundPersonalAmountRandom = Math.random()
+ // 公积金公司缴纳金额 = 公积金基数 * (公积金公司缴纳比例 / 100)
+ this.form.accumulationFundCompanyAmount = Number((this.form.accumulationFund * (this.form.accumulationFundCompany / 100)).toFixed(2))
+ // 公积金公司缴纳金额随机数
+ this.accumulationFundCompanyAmountRandom = Math.random()
+ // 统计金额
+ this.statisticalAmount()
+ },
+ // 养老险参数变更
+ pensionParameterBlur() {
+ // 养老险个人缴纳金额 = 养老险基数 * (养老险个人缴纳比例 / 100)
+ this.form.retirementInsurancePersonalAmount = Number((this.form.retirementInsurance * (this.form.retirementInsurancePersonal / 100)).toFixed(2))
+ // 养老险个人缴纳金额随机数
+ this.retirementInsurancePersonalAmountRandom = Math.random()
+ // 养老险公司缴纳金额 = 养老险基数 * (养老险公司缴纳比例 / 100)
+ this.form.retirementInsuranceCompanyAmount = Number((this.form.retirementInsurance * (this.form.retirementInsuranceCompany / 100)).toFixed(2))
+ // 养老险公司缴纳金额随机数
+ this.retirementInsuranceCompanyAmountRandom = Math.random()
+ // 统计金额
+ this.statisticalAmount()
+ },
+ // 医疗险参数变更
+ medicalParameterBlur() {
+ // 医疗险个人缴纳金额 = 医疗险基数 * (医疗险个人缴纳比例 / 100)
+ this.form.medicalInsurancePersonalAmount = Number((this.form.medicalInsurance * (this.form.medicalInsurancePersonal / 100)).toFixed(2))
+ // 医疗险个人缴纳金额随机数
+ this.medicalInsurancePersonalAmountRandom = Math.random()
+ // 医疗险公司缴纳金额 = 医疗险基数 * (医疗险公司缴纳比例 / 100)
+ this.form.medicalInsuranceCompanyAmount = Number((this.form.medicalInsurance * (this.form.medicalInsuranceCompany / 100)).toFixed(2))
+ // 医疗险公司缴纳金额随机数
+ this.medicalInsuranceCompanyAmountRandom = Math.random()
+ // 统计金额
+ this.statisticalAmount()
+ },
+ // 失业险参数变更
+ unemploymentParameterBlur() {
+ // 失业险个人缴纳金额 = 失业险基数 * (失业险个人缴纳比例 / 100)
+ this.form.unemploymentInsurancePersonalAmount = Number((this.form.unemploymentInsurance * (this.form.unemploymentInsurancePersonal / 100)).toFixed(2))
+ // 失业险个人缴纳金额随机数
+ this.unemploymentInsurancePersonalAmountRandom = Math.random()
+ // 失业险公司缴纳金额 = 失业险基数 * (失业险公司缴纳比例 / 100)
+ this.form.unemploymentInsuranceCompanyAmount = Number((this.form.unemploymentInsurance * (this.form.unemploymentInsuranceCompany / 100)).toFixed(2))
+ // 失业险公司缴纳金额随机数
+ this.unemploymentInsuranceCompanyAmountRandom = Math.random()
+ // 统计金额
+ this.statisticalAmount()
+ },
+ // 生育险参数变更
+ maternityParameterBlur() {
+ // 生育险个人缴纳金额 = 生育险基数 * (生育险个人缴纳比例 / 100)
+ this.form.birthInsurancePersonalAmount = Number((this.form.birthInsurance * (this.form.birthInsurancePersonal / 100)).toFixed(2))
+ // 生育险个人缴纳金额随机数
+ this.birthInsurancePersonalAmountRandom = Math.random()
+ // 生育险公司缴纳金额 = 生育险基数 * (生育险公司缴纳比例 / 100)
+ this.form.birthInsuranceCompanyAmount = Number((this.form.birthInsurance * (this.form.birthInsuranceCompany / 100)).toFixed(2))
+ // 生育险公司缴纳金额随机数
+ this.birthInsuranceCompanyAmountRandom = Math.random()
+ // 统计金额
+ this.statisticalAmount()
+ },
+ // 工伤险参数变更
+ industrialInjuryParameterBlur() {
+ // 工伤险个人缴纳金额 = 工伤险基数 * (工伤险个人缴纳比例 / 100)
+ this.form.employmentInsurancePersonalAmount = Number((this.form.employmentInsurance * (this.form.employmentInsurancePersonal / 100)).toFixed(2))
+ // 工伤险个人缴纳金额随机数
+ this.employmentInsurancePersonalAmountRandom = Math.random()
+ // 工伤险公司缴纳金额 = 工伤险基数 * (工伤险公司缴纳比例 / 100)
+ this.form.employmentInsuranceCompanyAmount = Number((this.form.employmentInsurance * (this.form.employmentInsuranceCompany / 100)).toFixed(2))
+ // 工伤险公司缴纳金额随机数
+ this.employmentInsuranceCompanyAmountRandom = Math.random()
+ // 统计金额
+ this.statisticalAmount()
+ },
+ // 统计金额
+ statisticalAmount() {
+ console.log('统计金额')
+ // 税前金额
+ this.form.preTaxAmount = this.form.actualBasicWage + this.form.actualAchievementsWage + this.form.actualPerformanceWage + this.form.actualTeamWage + this.form.pieceRate + this.form.travelAllowance
+ // 税前金额随机数
+ this.preTaxAmountRandom = Math.random()
+ // 税前金额变更
+ this.preTaxAmountBlur()
+ },
+ // 税前金额变更
+ preTaxAmountBlur() {
+ // 查询个人所得税列表
+ crudSysConfigIndividualIncomeTax.getAll().then(res => {
+ // 税额
+ let taxAmount = 0
+ // 计税金额 = 税前金额 - 五险一金个人缴纳金额
+ const taxableAmount = this.form.preTaxAmount - this.form.accumulationFundPersonalAmount - this.form.retirementInsurancePersonalAmount - this.form.medicalInsurancePersonalAmount - this.form.unemploymentInsurancePersonalAmount - this.form.birthInsurancePersonalAmount - this.form.employmentInsurancePersonalAmount
+ // 循环个人所得税列表
+ for (let i = 0; i < res.length; i++) {
+ // 判断计税金额所在个人所得税范围
+ if (res[i].gearAmountEnd != null && res[i].gearAmountEnd !== '' && taxableAmount > res[i].gearAmountEnd) {
+ // 税额
+ taxAmount += (res[i].gearAmountEnd - res[i].gearAmountStart) * (res[i].taxRate / 100)
+ } else if (taxableAmount >= res[i].gearAmountStart && (res[i].gearAmountEnd == null || res[i].gearAmountEnd === '' || taxableAmount <= res[i].gearAmountEnd)) {
+ // 税额
+ taxAmount += (taxableAmount - res[i].gearAmountStart) * (res[i].taxRate / 100)
+ }
+ // 判断循环是否结束
+ if (i === res.length - 1) {
+ // 个人所得税 = 税额
+ this.form.individualIncomeTax = taxAmount
+ // 个人所得税随机数
+ this.individualIncomeTaxRandom = Math.random()
+ // 税后金额 = 计税金额 - 税额
+ this.form.afterTaxAmount = (taxableAmount - taxAmount) < 0 ? 0 : taxableAmount - taxAmount
+ // 税后金额随机数
+ this.afterTaxAmountRandom = Math.random()
+ }
+ }
+ })
+ },
+ // 个人所得税变更
+ individualIncomeTaxBlur() {
+ // 计税金额 = 税前金额 - 五险一金个人缴纳金额
+ const taxableAmount = this.form.preTaxAmount - this.form.accumulationFundPersonalAmount - this.form.retirementInsurancePersonalAmount - this.form.medicalInsurancePersonalAmount - this.form.unemploymentInsurancePersonalAmount - this.form.birthInsurancePersonalAmount - this.form.employmentInsurancePersonalAmount
+ // 税后金额 = 计税金额 - 个人所得税
+ this.form.afterTaxAmount = (taxableAmount - this.form.individualIncomeTax) < 0 ? 0 : taxableAmount - this.form.individualIncomeTax
+ // 税后金额随机数
+ this.afterTaxAmountRandom = Math.random()
+ }
+ }
+}
+</script>
+
+<style scoped>
+
+</style>
--
Gitblit v1.9.3