From 73e95717da3e737e0ddb76b0b432c2cdcd9d3ac3 Mon Sep 17 00:00:00 2001
From: churf <123456>
Date: Tue, 12 Sep 2023 05:22:48 +0000
Subject: [PATCH] 新工资-修复五险一金

---
 eladmin-web-master/src/views/salary/newSalary/index.vue                                                       |   93 ++++++++++++++++++++++++----------------------
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/impl/NewSalaryServiceImpl.java |    5 ++
 2 files changed, 53 insertions(+), 45 deletions(-)

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
index dd1f01b..06cc3ae 100644
--- 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
@@ -40,9 +40,11 @@
 import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria;
 import me.zhengjie.modules.treatment.domain.MeritLevel;
 import me.zhengjie.modules.treatment.domain.MeritWage;
+import me.zhengjie.modules.treatment.domain.UserInsurance;
 import me.zhengjie.modules.treatment.domain.UserLevelWage;
 import me.zhengjie.modules.treatment.repository.MeritLevelRepository;
 import me.zhengjie.modules.treatment.repository.MeritWageRepository;
+import me.zhengjie.modules.treatment.repository.UserInsuranceRepository;
 import me.zhengjie.modules.treatment.service.UserInsuranceService;
 import me.zhengjie.modules.treatment.service.UserLevelWageService;
 import me.zhengjie.modules.treatment.service.dto.UserInsuranceDto;
@@ -89,6 +91,8 @@
     // ==================== 以上为定时生成工资记录主要依赖 ====================
     private final MeritWageRepository meritWageRepository;
     private final MeritLevelRepository meritLevelRepository;
+    private final UserInsuranceRepository userInsuranceRepository;
+
     @Override
     public Map<String, Object> queryAll(NewSalaryQueryCriteria criteria, Pageable pageable) {
         // 判断工资查询类工资年月是否为空
@@ -354,6 +358,7 @@
         return resultMoney;
     }
 
+
     // 单个用户工资结算
     private void singleUserSalarySettlement(Long userId, String targetYearMonth) {
         // 日历类
diff --git a/eladmin-web-master/src/views/salary/newSalary/index.vue b/eladmin-web-master/src/views/salary/newSalary/index.vue
index fb72075..4be3174 100644
--- a/eladmin-web-master/src/views/salary/newSalary/index.vue
+++ b/eladmin-web-master/src/views/salary/newSalary/index.vue
@@ -123,28 +123,32 @@
           </el-form-item>
           <el-divider>业绩工资</el-divider>
           <el-form-item label="业绩完成度" prop="CompletedAchievementsRate">
-            <el-input v-model="form.CompletedAchievementsRate" style="width: 200px;" :disabled="true" @blur="achievementsParameterBlur" />
-          </el-form-item>
-          <el-form-item label="预计工资" prop="achievementsWage">
-            <money-input :key="form.meritMoney" v-model="form.meritMoney" :width="523" :disabled="true" @blur="achievementsWageBlur" />
-          </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 v-model="form.CompletedAchievementsRate" style="width: 200px;" :disabled="true" @blur="achievementsParameterBlur">
+              <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-form-item label="业绩工资" prop="achievementsWage">
+            <el-input :key="form.meritMoney" v-model="form.meritMoney" style="width: 200px" :disabled="true" @blur="achievementsWageBlur">
+              <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="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" />
@@ -452,7 +456,7 @@
 import constant from '../../../utils/constant'
 import crudUser from '@/api/system/user'
 import crudUserLevelWage from '@/api/treatment/userLevelWage'
-import crudUserLevelInsurance from '@/api/treatment/userInsurance'
+import crudUserLevelInsurance from '@/api/system/userLevelInsurance'
 import crudUserLevelOther from '@/api/system/userLevelOther'
 import crudAttendance from '@/api/attendance/attendance'
 import crudTaskDaliy from '@/api/task/taskDaliy'
@@ -912,12 +916,12 @@
         this.formLoading = true
         // 执行完以下内容才往下走:获取用户级别工资、获取用户级别保险、获取用户级别其他、获取工作天数、获取出勤小时数、获取达标工时、获取已完成工时
         Promise.all([
-          this.getUserLevelWage(), this.getUserLevelInsurance(), this.getUserLevelOther(), this.getWorkDays(), this.getAttendanceHours(),
-          this.getComplianceWork(), this.getCompletedWork()
+          this.getUserLevelWage(), this.getUserLevelOther(), this.getWorkDays(), this.getAttendanceHours(),
+          this.getComplianceWork(), this.getCompletedWork(), this.getUserLevelInsurance()
         ]).then(res => {
           // 表单加载
           this.formLoading = false
-        }).catch(() => {
+        }).catch((e) => {
           // 表单加载
           this.formLoading = false
         })
@@ -928,7 +932,6 @@
       return new Promise((resolve, reject) => {
         // 获取用户级别工资
         crudUserLevelWage.getTargetYearMonth({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
-          console.log(res)
           this.Level_now = res.level
           // 级别基本工资
           const basicWage = Number(res.basicWage.toFixed(2))
@@ -980,97 +983,97 @@
         // 获取用户级别保险
         crudUserLevelInsurance.getTargetYearMonth({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
           // 公积金基数
-          this.form.accumulationFund = Number(res.accumulationFund.toFixed(2))
+          this.form.accumulationFund = Number(res.accumulationRadix.toFixed(2))
           // 公积金基数随机数
           this.accumulationFundRandom = Math.random()
           // 公积金个人缴纳比例
-          this.form.accumulationFundPersonal = Number(res.accumulationFundPersonal.toFixed(2))
+          this.form.accumulationFundPersonal = Number(res.accumulationPersonalProportion.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.accumulationFundCompany = Number(res.accumulationCompanyProportion.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.form.retirementInsurance = Number(res.pensionRadix.toFixed(2))
           // 养老险基数随机数
           this.retirementInsuranceRandom = Math.random()
           // 养老险个人缴纳比例
-          this.form.retirementInsurancePersonal = Number(res.retirementInsurancePersonal.toFixed(2))
+          this.form.retirementInsurancePersonal = Number(res.pensionPersonalProportion.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.retirementInsuranceCompany = Number(res.pensionCompanyProportion.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.form.medicalInsurance = Number(res.medicalRadix.toFixed(2))
           // 医疗险基数随机数
           this.medicalInsuranceRandom = Math.random()
           // 医疗险个人缴纳比例
-          this.form.medicalInsurancePersonal = Number(res.medicalInsurancePersonal.toFixed(2))
+          this.form.medicalInsurancePersonal = Number(res.medicalPersonalProportion.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.medicalInsuranceCompany = Number(res.medicalCompanyProportion.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.form.unemploymentInsurance = Number(res.unemploymentRadix.toFixed(2))
           // 失业险基数随机数
           this.unemploymentInsuranceRandom = Math.random()
           // 失业险个人缴纳比例
-          this.form.unemploymentInsurancePersonal = Number(res.unemploymentInsurancePersonal.toFixed(2))
+          this.form.unemploymentInsurancePersonal = Number(res.unemploymentPersonalProportion.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.unemploymentInsuranceCompany = Number(res.unemploymentCompanyProportion.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.form.birthInsurance = Number(res.maternityRadix.toFixed(2))
           // 生育险基数随机数
           this.birthInsuranceRandom = Math.random()
           // 生育险个人缴纳比例
-          this.form.birthInsurancePersonal = Number(res.birthInsurancePersonal.toFixed(2))
+          this.form.birthInsurancePersonal = Number(res.maternityPersonalProportion.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.birthInsuranceCompany = Number(res.maternityCompanyProportion.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.form.employmentInsurance = Number(res.industrialInjuryRadix.toFixed(2))
           // 工伤险基数随机数
           this.employmentInsuranceRandom = Math.random()
           // 工伤险个人缴纳比例
-          this.form.employmentInsurancePersonal = Number(res.employmentInsurancePersonal.toFixed(2))
+          this.form.employmentInsurancePersonal = Number(res.industrialInjuryPersonalProportion.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.employmentInsuranceCompany = Number(res.industrialInjuryCompanyProportion.toFixed(2))
           // 工伤险公司缴纳金额
           this.form.employmentInsuranceCompanyAmount = Number((res.employmentInsurance * (res.employmentInsuranceCompany / 100)).toFixed(2))
           // 工伤险公司缴纳金额随机数
@@ -1206,7 +1209,7 @@
           // 应完成绩效工时
           this.form.needCompletedAchievementsHours = Number((res * 8).toFixed(2))
           this.form.CompletedAchievementsRate = Number(this.form.alreadyCompletedAchievementsHours / this.form.needCompletedAchievementsHours * 100).toFixed(2)
-          // this.form.CompletedAchievementsRate = 200
+          // this.form.CompletedAchievementsRate = 100.0
           crudNewSalary.getMeritWage(this.form.CompletedAchievementsRate, this.Level_now).then(res => {
             this.form.meritMoney = res
           })
@@ -1565,7 +1568,7 @@
     // 预计绩效工资变更
     achievementsWageBlur() {
       // 实际绩效工资 = 预计绩效工资 * (已完成绩效工时 / 应完成绩效工时)
-      this.form.actualAchievementsWage = Number((this.form.achievementsWage * (this.form.alreadyCompletedAchievementsHours / this.form.needCompletedAchievementsHours)).toFixed(2))
+      this.form.actualAchievementsWage = isNaN(Number((this.form.achievementsWage * (this.form.alreadyCompletedAchievementsHours / this.form.needCompletedAchievementsHours)).toFixed(2))) ? 0 : Number((this.form.achievementsWage * (this.form.alreadyCompletedAchievementsHours / this.form.needCompletedAchievementsHours)).toFixed(2))
       // 实际绩效工资随机数
       this.actualAchievementsWageRandom = Math.random()
       // 统计金额
@@ -1687,11 +1690,11 @@
     },
     // 统计金额
     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.form.preTaxAmount = this.form.actualBasicWage + this.form.actualAchievementsWage + this.form.actualPerformanceWage + this.form.actualTeamWage + this.form.pieceRate + this.form.travelAllowance + this.form.meritMoney
       // 税前金额随机数
       this.preTaxAmountRandom = Math.random()
+      this.getWorkDays()
       // 税前金额变更
       this.preTaxAmountBlur()
     },

--
Gitblit v1.9.3