Commit a7bfb97c authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/develop' into develop

parents 0cc745ae c0485493
...@@ -86,7 +86,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper, ...@@ -86,7 +86,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
/** /**
* @param jsonString 客户原表数据 * @param jsonString 客户原表数据
* repeatFlag 默认 0:不允许重复导入已存在系统内的数据;1:允许重复导入 * repeatFlag 默认 0:不允许重复导入已存在系统内的数据;1:允许重复导入
* @Description: 普通工资上传 * @Description: 普通工资上传
* @Author: hgw * @Author: hgw
* @Date: 2019/9/4 15:58 * @Date: 2019/9/4 15:58
...@@ -128,127 +128,84 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper, ...@@ -128,127 +128,84 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
if (null == user || null == user.getId()) { if (null == user || null == user.getId()) {
return R.failed("获取登录用户信息失败!"); return R.failed("获取登录用户信息失败!");
} }
//薪资导入
if (CommonConstants.ZERO_STRING.equals(salaryType) && Common.isNotNull(configId)) {
TConfigSalary configSalary = new TConfigSalary();
if (Common.isNotNull(configId)) {
// 薪资配置-结算月、社保月等信息 // 薪资配置-结算月、社保月等信息
TConfigSalary configSalary = configSalaryService.getById(configId); configSalary = configSalaryService.getById(configId);
try { } else {
jsonString = URLDecoder.decode(jsonString, "UTF-8").replace("=", ""); configSalary = configSalaryService.getById(CommonConstants.ONE_STRING);
SalaryAccountUtil util1 = new SalaryAccountUtil(); }
try {
TSalaryEmployee empSearch = new TSalaryEmployee(); jsonString = URLDecoder.decode(jsonString, "UTF-8").replace("=", "");
empSearch.setUnitId(dept.getCustomerId()); SalaryAccountUtil util1 = new SalaryAccountUtil();
List<TSalaryEmployee> empList = employeeService.list(Wrappers.<TSalaryEmployee>query().lambda()
.eq(TSalaryEmployee::getUnitId, dept.getCustomerId())); TSalaryEmployee empSearch = new TSalaryEmployee();
Map<String, TSalaryEmployee> empIdCardMap = new HashMap<>(); empSearch.setUnitId(dept.getCustomerId());
Map<String, TSalaryEmployee> empNameMap = new HashMap<>(); List<TSalaryEmployee> empList = employeeService.list(Wrappers.<TSalaryEmployee>query().lambda()
boolean isDuplicateName = false; .eq(TSalaryEmployee::getUnitId, dept.getCustomerId()));
if (empList != null) { Map<String, TSalaryEmployee> empIdCardMap = new HashMap<>();
TSalaryEmployee es;//筛选人员,添加判断:非在职,或开户行为空,或 结算主体等于选择的结算主体且在职,都可以存入Map优先备用 Map<String, TSalaryEmployee> empNameMap = new HashMap<>();
for (TSalaryEmployee e : empList) { boolean isDuplicateName = false;
es = empIdCardMap.get(e.getEmpIdcard()); if (empList != null) {
if (es == null || CommonConstants.ZERO_INT != es.getFileStatus() || Common.isEmpty(es.getBankName()) TSalaryEmployee es;//筛选人员,添加判断:非在职,或开户行为空,或 结算主体等于选择的结算主体且在职,都可以存入Map优先备用
|| (e.getDeptId().equals(settleDepart) && CommonConstants.ZERO_INT == e.getFileStatus() for (TSalaryEmployee e : empList) {
&& Common.isNotNull(e.getBankName()))) { es = empIdCardMap.get(e.getEmpIdcard());
empIdCardMap.put(e.getEmpIdcard(), e); if (es == null || CommonConstants.ZERO_INT != es.getFileStatus() || Common.isEmpty(es.getBankName())
empNameMap.put(e.getEmpName().replace(" ", ""), e); || (e.getDeptId().equals(settleDepart) && CommonConstants.ZERO_INT == e.getFileStatus()
} && Common.isNotNull(e.getBankName()))) {
} empIdCardMap.put(e.getEmpIdcard(), e);
if (empNameMap.size() == empIdCardMap.size()) { empNameMap.put(e.getEmpName().replace(" ", ""), e);
isDuplicateName = true;
} }
} }
// 自有员工结算主体id,新员工使用 if (empNameMap.size() == empIdCardMap.size()) {
Map<String, Integer> ownDeptMap = tOwnDeptService.getOwnDeptMap(); isDuplicateName = true;
// 自有员工所在结算主体Map
Map<String, Integer> ownEmployeeMap = tOwnDeptService.getOwnEmpMap();
// 2.6.6:校验导入数据重复的Map格式:#身份证号_工资月份_报表类型_应发金额
Map<String, Integer> checkMap = tSalaryAccountService.getAccountCheckMap(dept.getId(), DateUtil.addMonth(configSalary.getSalaryMonth()));
util1.getJsonStringToList(user, jsonString,
dept, configSalary, salaryConfigMap, isMustMap, empIdCardMap, empNameMap, isDuplicateName
, salaryType, null,invoiceTitle, employeeService, checkMap, ownEmployeeMap, ownDeptMap, tSalaryAccountService);
List<TSalaryAccountVo> saList = util1.getEntityList();
if ((null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty())) {
return R.failed(util1.getErrorInfo());
} else {
if (null != saList && !saList.isEmpty()) {
// return R.ok(saList)
return this.saveAndSubmit(saList);
} else {
return R.failed("导入数据不可为空");
}
} }
} catch (Exception e) {
log.error(e.getMessage());
return R.failed("数据导入解析失败!");
} }
//劳务费导入 // 自有员工结算主体id,新员工使用
} else if (CommonConstants.THREE_STRING.equals(salaryType)) { Map<String, Integer> ownDeptMap = tOwnDeptService.getOwnDeptMap();
// 自有员工所在结算主体Map
Map<String, Integer> ownEmployeeMap = tOwnDeptService.getOwnEmpMap();
TConfigSalary configSalary = new TConfigSalary(); // 2.6.6:校验导入数据重复的Map格式:#身份证号_工资月份_报表类型_应发金额
// 薪资配置-结算月、社保月等信息 Map<String, Integer> checkMap = tSalaryAccountService.getAccountCheckMap(dept.getId(), DateUtil.addMonth(configSalary.getSalaryMonth()));
configSalary = configSalaryService.getById(CommonConstants.ONE_STRING);
try {
jsonString = URLDecoder.decode(jsonString, "UTF-8").replace("=", "");
SalaryAccountUtil util1 = new SalaryAccountUtil();
List<TSalaryEmployee> empList = employeeService.list(Wrappers.<TSalaryEmployee>query().lambda()
.eq(TSalaryEmployee::getUnitId, dept.getCustomerId()));
Map<String, TSalaryEmployee> empIdCardMap = new HashMap<>();
Map<String, TSalaryEmployee> empNameMap = new HashMap<>();
boolean isDuplicateName = false;
if (empList != null) {
TSalaryEmployee es;//筛选人员,添加判断:非在职,或开户行为空,或 结算主体等于选择的结算主体且在职,都可以存入Map优先备用
for (TSalaryEmployee e : empList) {
es = empIdCardMap.get(e.getEmpIdcard());
if (es == null || CommonConstants.ZERO_INT != es.getFileStatus() || Common.isEmpty(es.getBankName())
|| (e.getDeptId().equals(settleDepart) && CommonConstants.ZERO_INT == e.getFileStatus()
&& Common.isNotNull(e.getBankName()))) {
empIdCardMap.put(e.getEmpIdcard(), e);
empNameMap.put(e.getEmpName().replace(" ", ""), e);
}
}
if (empNameMap.size() == empIdCardMap.size()) {
isDuplicateName = true;
}
}
// 自有员工结算主体id,新员工使用
Map<String, Integer> ownDeptMap = tOwnDeptService.getOwnDeptMap();
// 自有员工所在结算主体Map
Map<String, Integer> ownEmployeeMap = tOwnDeptService.getOwnEmpMap();
List<String> checkListY = new ArrayList<>();
if (CommonConstants.THREE_STRING.equals(salaryType)) {
// 薪资类型互斥校验Map格式:本年度#身份证号_报表类型 // 薪资类型互斥校验Map格式:本年度#身份证号_报表类型
List<String> checkListY = new ArrayList<>();
if (Common.isNotNull(configSalary)) { if (Common.isNotNull(configSalary)) {
checkListY = tSalaryAccountService.getAccountYearCheckMap(dept.getId()); checkListY = tSalaryAccountService.getAccountYearCheckMap(dept.getId());
} }
// 校验导入数据重复的Map格式:#身份证号_工资月份_报表类型_应发金额 }
Map<String, Integer> checkMap = new HashMap<>();
if (Common.isNotNull(configSalary)) {
checkMap = tSalaryAccountService.getAccountCheckMap(dept.getId(), DateUtil.addMonth(configSalary.getSalaryMonth()));
}
util1.getJsonStringToList(user, jsonString, dept, !Common.isNotNull(configSalary) ? null: configSalary,
salaryConfigMap, isMustMap, empIdCardMap, empNameMap, isDuplicateName, salaryType,checkListY
,null, employeeService, checkMap, ownEmployeeMap, ownDeptMap, tSalaryAccountService);
List<TSalaryAccountVo> saList = util1.getEntityList();
if ((null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty())) { util1.getJsonStringToList(user, jsonString, dept, configSalary, salaryConfigMap, isMustMap,
return R.failed(util1.getErrorInfo()); empIdCardMap, empNameMap, isDuplicateName, salaryType, checkListY, invoiceTitle,
} else { employeeService, checkMap, ownEmployeeMap, ownDeptMap, tSalaryAccountService);
if (null != saList && !saList.isEmpty()) { List<TSalaryAccountVo> saList = util1.getEntityList();
if ((null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty())) {
return R.failed(util1.getErrorInfo());
} else {
if (null != saList && !saList.isEmpty()) {
// return R.ok(saList)
//薪资导入
if (CommonConstants.ZERO_STRING.equals(salaryType)) {
return this.saveAndSubmit(saList);
}
//劳务费导入
if (CommonConstants.THREE_STRING.equals(salaryType)) {
return this.saveLaborSubmit(saList, dept); return this.saveLaborSubmit(saList, dept);
} else {
return R.failed("导入数据不可为空");
} }
} else {
return R.failed("导入数据不可为空");
} }
} catch (Exception e) {
log.error(e.getMessage());
return R.failed("数据导入解析失败!");
} }
} catch (Exception e) {
log.error(e.getMessage());
return R.failed("数据导入解析失败!");
} }
} }
return R.failed("导入数据不可为空"); return R.failed("导入数据不可为空");
} }
...@@ -825,7 +782,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper, ...@@ -825,7 +782,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
salary.setHaveSpecialFlag(CommonConstants.ZERO_INT); salary.setHaveSpecialFlag(CommonConstants.ZERO_INT);
salary.setIsRepeat(CommonConstants.ZERO_INT); salary.setIsRepeat(CommonConstants.ZERO_INT);
salary.setStatus(SalaryConstants.AUDIT_STATUS[0]); salary.setStatus(SalaryConstants.AUDIT_STATUS[0]);
if (haveSalaryFlag || haveSpecialFlag || ownNum>0 || repeatFlag) { if (haveSalaryFlag || haveSpecialFlag || ownNum > 0 || repeatFlag) {
if (haveSalaryFlag) { if (haveSalaryFlag) {
salary.setHaveSalaryFlag(CommonConstants.ONE_INT); salary.setHaveSalaryFlag(CommonConstants.ONE_INT);
} }
...@@ -1104,7 +1061,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper, ...@@ -1104,7 +1061,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
BigDecimal money = SalaryConstants.B_ZERO; BigDecimal money = SalaryConstants.B_ZERO;
BigDecimal sub = SalaryConstants.B_ZERO; BigDecimal sub = SalaryConstants.B_ZERO;
if (isSocial && deptSet.getUnitSeriousIllnessProp() != null if (isSocial && deptSet.getUnitSeriousIllnessProp() != null
&& deptSet.getUnitSeriousIllnessProp().compareTo(SalaryConstants.B_ONEHUNDRED) == SalaryConstants.LESS_THAN) { && deptSet.getUnitSeriousIllnessProp().compareTo(SalaryConstants.B_ONEHUNDRED) == SalaryConstants.LESS_THAN) {
sub = (new BigDecimal("100").subtract(deptSet.getUnitSeriousIllnessProp())) sub = (new BigDecimal("100").subtract(deptSet.getUnitSeriousIllnessProp()))
.divide(SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP); .divide(SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
} }
...@@ -1112,7 +1069,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper, ...@@ -1112,7 +1069,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
money = this.getSocialFundMoney(idNumber, estmateList, isSocial, isPerson, socialList, fundList, money, sub); money = this.getSocialFundMoney(idNumber, estmateList, isSocial, isPerson, socialList, fundList, money, sub);
} }
// 缴费库没找到,从预估库找 // 缴费库没找到,从预估库找
if (CommonConstants.ONE_STRING.equals(socialFundType) && forecastList != null && !forecastList.isEmpty()) { if (CommonConstants.ONE_STRING.equals(socialFundType) && forecastList != null && !forecastList.isEmpty()) {
money = this.getSocialFundMoney(idNumber, forecastList, isSocial, isPerson, forecastSocialList, forecastFundList, money, sub); money = this.getSocialFundMoney(idNumber, forecastList, isSocial, isPerson, forecastSocialList, forecastFundList, money, sub);
} }
return money; return money;
...@@ -1529,7 +1486,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper, ...@@ -1529,7 +1486,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
TSalaryLock lockUpdate; TSalaryLock lockUpdate;
try { try {
// 薪资核心导入代码 // 薪资核心导入代码
return this.doLaborCoreSalary(savList, saiList, sai, dept, invoiceTitle, salary); return this.doLaborCoreSalary(savList, saiList, sai, dept, invoiceTitle, salary, user);
} catch (Exception e) { } catch (Exception e) {
lockUpdate = new TSalaryLock(); lockUpdate = new TSalaryLock();
lockUpdate.setId(lock.getId()); lockUpdate.setId(lock.getId());
...@@ -1560,7 +1517,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper, ...@@ -1560,7 +1517,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
* @return: com.yifu.cloud.v1.common.core.util.R * @return: com.yifu.cloud.v1.common.core.util.R
**/ **/
public R doLaborCoreSalary(List<TSalaryAccountVo> savList, List<TSalaryAccountItem> saiList, TSalaryAccountItem sai, public R doLaborCoreSalary(List<TSalaryAccountVo> savList, List<TSalaryAccountItem> saiList, TSalaryAccountItem sai,
TSettleDomainSelectVo dept, String invoiceTitle, TSalaryStandard salary) { TSettleDomainSelectVo dept, String invoiceTitle, TSalaryStandard salary, YifuUser user) {
List<TSalaryAccount> aList = new ArrayList<>(); List<TSalaryAccount> aList = new ArrayList<>();
TSalaryAccount a;//定库: TSalaryAccount a;//定库:
BigDecimal money = new BigDecimal(CommonConstants.ZERO_STRING); //初始化金额备用 BigDecimal money = new BigDecimal(CommonConstants.ZERO_STRING); //初始化金额备用
...@@ -1642,7 +1599,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper, ...@@ -1642,7 +1599,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
this.saveNewItems(sai, saiList, SalaryConstants.SALARY_TAX, this.saveNewItems(sai, saiList, SalaryConstants.SALARY_TAX,
SalaryConstants.SALARY_TAX_JAVA, SalaryConstants.SALARY_TAX_JAVA,
calculationLabor(saiList, asList calculationLabor(saiList, asList
, saiList,a), CommonConstants.ZERO_INT); , saiList, a), CommonConstants.ZERO_INT);
a.setSaiList(saiList); a.setSaiList(saiList);
aList.add(a); aList.add(a);
...@@ -1659,7 +1616,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper, ...@@ -1659,7 +1616,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
salary.setHaveSpecialFlag(CommonConstants.ZERO_INT); salary.setHaveSpecialFlag(CommonConstants.ZERO_INT);
salary.setIsRepeat(CommonConstants.ZERO_INT); salary.setIsRepeat(CommonConstants.ZERO_INT);
salary.setStatus(SalaryConstants.AUDIT_STATUS[0]); salary.setStatus(SalaryConstants.AUDIT_STATUS[0]);
if (haveSalaryFlag || haveSpecialFlag || ownNum>0 || repeatFlag) { if (haveSalaryFlag || haveSpecialFlag || ownNum > 0 || repeatFlag) {
if (haveSalaryFlag) { if (haveSalaryFlag) {
salary.setHaveSalaryFlag(CommonConstants.ONE_INT); salary.setHaveSalaryFlag(CommonConstants.ONE_INT);
} }
...@@ -1673,6 +1630,9 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper, ...@@ -1673,6 +1630,9 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
//保存工资表 //保存工资表
tSalaryStandardService.save(salary); tSalaryStandardService.save(salary);
// 获取上一个工资条顺序,复制:
tSalaryStandardSetService.copyLastSetByDeptId(salary.getId(), dept.getId(), String.valueOf(user.getId()));
salaryDetailVo.setSalary(salary); salaryDetailVo.setSalary(salary);
for (TSalaryAccount account : aList) { for (TSalaryAccount account : aList) {
...@@ -1733,10 +1693,10 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper, ...@@ -1733,10 +1693,10 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
nowTaxY = getNowTax(actualSalarySum); nowTaxY = getNowTax(actualSalarySum);
relaySalary = BigDecimalUtils.safeAdd(actualSalarySumNow, nowTaxT).setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP); relaySalary = BigDecimalUtils.safeAdd(actualSalarySumNow, nowTaxT).setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
BigDecimal salaryTax = BigDecimalUtils.safeSubtract(nowTaxY,BigDecimalUtils.safeAdd(nowTaxT,sumTax)); BigDecimal salaryTax = BigDecimalUtils.safeSubtract(nowTaxY, BigDecimalUtils.safeAdd(nowTaxT, sumTax));
a.setSalaryTax(salaryTax); a.setSalaryTax(salaryTax);
a.setSalaryTaxUnit(nowTaxT); a.setSalaryTaxUnit(nowTaxT);
a.setActualSalary(BigDecimalUtils.safeSubtract(actualSalarySumNow,salaryTax)); a.setActualSalary(BigDecimalUtils.safeSubtract(actualSalarySumNow, salaryTax));
} else { } else {
nowTaxY = getNowTax(actualSalarySum); nowTaxY = getNowTax(actualSalarySum);
if (sumTax.compareTo(BigDecimal.ZERO) != 0) { if (sumTax.compareTo(BigDecimal.ZERO) != 0) {
...@@ -1757,7 +1717,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper, ...@@ -1757,7 +1717,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
return nowTaxT; return nowTaxT;
} }
public static BigDecimal getNowTax (BigDecimal actualSalarySum) { public static BigDecimal getNowTax(BigDecimal actualSalarySum) {
BigDecimal nowTax; BigDecimal nowTax;
// 2022-3-3 11:24:20 运营中心郭华照提供的公式: // 2022-3-3 11:24:20 运营中心郭华照提供的公式:
// ROUND(IF(B7<=800,0,IF(B7<=3360,(B7-800)/4,IF(B7<=21000,0.16*B7/0.84,IF(B7<=49500,(0.24*B7-2000)/0.76,(0.32*B7-7000)/0.68)))),2) // ROUND(IF(B7<=800,0,IF(B7<=3360,(B7-800)/4,IF(B7<=21000,0.16*B7/0.84,IF(B7<=49500,(0.24*B7-2000)/0.76,(0.32*B7-7000)/0.68)))),2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment