|
@@ -99,14 +99,32 @@ public class UserSalaryManageServiceImpl extends ServiceImpl<UserSalaryManageMap
|
|
|
|
|
|
//再处理新数据
|
|
|
//计算工资
|
|
|
+ BigDecimal ratio;
|
|
|
+ if (ObjectUtil.equals(dto.getEmployeeType(), 10)) {
|
|
|
+ Integer internshipRatio = dto.getInternshipRatio();
|
|
|
+ if (ObjectUtil.isEmpty(internshipRatio)) {
|
|
|
+ internshipRatio = oldUserSalary.getInternshipRatio();
|
|
|
+ }
|
|
|
+ ratio = BigDecimal.valueOf(internshipRatio / 100);
|
|
|
+ } else if (ObjectUtil.equals(dto.getEmployeeType(), 20)) {
|
|
|
+ Integer probationRatio = dto.getProbationRatio();
|
|
|
+ if (ObjectUtil.isEmpty(probationRatio)) {
|
|
|
+ probationRatio = oldUserSalary.getProbationRatio();
|
|
|
+ }
|
|
|
+ ratio = BigDecimal.valueOf(probationRatio / 100);
|
|
|
+ } else if (ObjectUtil.equals(dto.getEmployeeType(), 30)) {
|
|
|
+ ratio = BigDecimal.valueOf(1);
|
|
|
+ } else {
|
|
|
+ throw new ServiceException("未知劳动关系!");
|
|
|
+ }
|
|
|
BigDecimal amount = dto.getUserSalaryDetailList().stream()
|
|
|
.filter(item -> ObjectUtil.equals(item.getType(), 10))
|
|
|
.map(UserSalaryDetail::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
BigDecimal perfAmount = dto.getUserSalaryDetailList().stream()
|
|
|
.filter(item -> ObjectUtil.equals(item.getType(), 20))
|
|
|
.map(UserSalaryDetail::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- dto.setAmount(amount);
|
|
|
- dto.setPerfAmount(perfAmount);
|
|
|
+ dto.setAmount(amount.multiply(ratio).setScale(4, BigDecimal.ROUND_HALF_UP));
|
|
|
+ dto.setPerfAmount(perfAmount.multiply(ratio).setScale(4, BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
|
dataVer++;//版本号+1
|
|
|
this.updateById(dto);
|