Commit 1863ccc3 authored by hongguangwu's avatar hongguangwu

优化

parent 0b397ac1
...@@ -588,10 +588,10 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -588,10 +588,10 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
//档案柜存在就自动归档 //档案柜存在就自动归档
if (Common.isNotNull(tEmployeeContractInfo.getAttaList())) { if (Common.isNotNull(tEmployeeContractInfo.getAttaList())) {
this.updateFileMainId(tEmployeeContractInfo); this.updateFileMainId(tEmployeeContractInfo);
this.setFileInfo(tEmployeeContractInfo.getId(), "添加附件"); this.setFileInfo(tEmployeeContractInfo.getId(), "");
tEmployeeContractInfo.setIsFile(CommonConstants.ZERO_STRING); tEmployeeContractInfo.setIsFile(CommonConstants.ZERO_STRING);
} else { } else {
this.setFileInfo(tEmployeeContractInfo.getId(), "清空附件"); this.setFileInfo(tEmployeeContractInfo.getId(), "");
tEmployeeContractInfo.setIsFile(CommonConstants.ONE_STRING); tEmployeeContractInfo.setIsFile(CommonConstants.ONE_STRING);
} }
this.updateById(tEmployeeContractInfo); this.updateById(tEmployeeContractInfo);
......
...@@ -210,27 +210,27 @@ public class SalaryAccountUtil implements Serializable { ...@@ -210,27 +210,27 @@ public class SalaryAccountUtil implements Serializable {
} }
field = fieldsMap.get(scs.getJavaFiedName()); field = fieldsMap.get(scs.getJavaFiedName());
if (field == null) { if (field == null) {
try {
cellValueBig = new BigDecimal(cellValueStr);
cellValueBig = cellValueBig.setScale(2, BigDecimal.ROUND_HALF_UP); //四舍五入
if (cellValueBig.toString().length() > 11) {
error = "第" + (i + 2) + "行金额太大了,请检查一下:" + cellValueBig;
errorList.add(new ErrorMessage((i + 2), error));
break;
}
sai = new TSalaryAccountItemVo(); sai = new TSalaryAccountItemVo();
sai.setCnName(dbFiedName); sai.setCnName(dbFiedName);
sai.setJavaFiedName(scs.getJavaFiedName()); sai.setJavaFiedName(scs.getJavaFiedName());
sai.setSalaryMoney(cellValueBig);
if (scs.getIsTax() != null) { if (scs.getIsTax() != null) {
sai.setIsTax(scs.getIsTax()); sai.setIsTax(scs.getIsTax());
} else { } else {
sai.setIsTax(CommonConstants.ZERO_INT); sai.setIsTax(CommonConstants.ZERO_INT);
} }
saiList.add(sai); try {
cellValueBig = new BigDecimal(cellValueStr);
cellValueBig = cellValueBig.setScale(2, BigDecimal.ROUND_HALF_UP); //四舍五入
if (cellValueBig.toString().length() > 11) {
sai.setTextValue(cellValueBig.toString());
} else {
sai.setSalaryMoney(cellValueBig);
}
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
sai.setTextValue(cellValueStr);
//非数字,不保存 //非数字,不保存
} }
saiList.add(sai);
} else { } else {
attr = field.getAnnotation(ExcelAttribute.class); attr = field.getAnnotation(ExcelAttribute.class);
error = validateUtil(cellValueStr, attr, (i + 2)); error = validateUtil(cellValueStr, attr, (i + 2));
......
...@@ -1468,7 +1468,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1468,7 +1468,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
sysBaseSetInfoMapper.updateById(sysBaseSetInfo); sysBaseSetInfoMapper.updateById(sysBaseSetInfo);
} }
for (TSocialFundInfo socialFundInfo : socialFundInfoMap.values()) { for (TSocialFundInfo socialFundInfo : socialFundInfoMap.values()) {
this.updateForecastLibaryCore(socialFundInfo, socialFundInfo.getDoMonth(), true); this.updateForecastLibaryCore(socialFundInfo, socialFundInfo.getDoMonth(), true, false);
socialFundInfoMapper.updateById(socialFundInfo); socialFundInfoMapper.updateById(socialFundInfo);
} }
} }
...@@ -1483,7 +1483,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1483,7 +1483,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
**/ **/
@Override @Override
public R<String> updateToneForecastLibary(TSocialFundInfo socialFundInfo, String doMonth) { public R<String> updateToneForecastLibary(TSocialFundInfo socialFundInfo, String doMonth) {
return this.updateForecastLibaryCore(socialFundInfo, doMonth, false); return this.updateForecastLibaryCore(socialFundInfo, doMonth, false, false);
} }
/** /**
...@@ -1495,7 +1495,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1495,7 +1495,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
**/ **/
@Override @Override
public R<String> updateForecastLibaryByDispatch(TSocialFundInfo socialFundInfo) { public R<String> updateForecastLibaryByDispatch(TSocialFundInfo socialFundInfo) {
return this.updateForecastLibaryCore(socialFundInfo, null, false); return this.updateForecastLibaryCore(socialFundInfo, null, false, true);
} }
/** /**
...@@ -1615,6 +1615,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1615,6 +1615,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
} }
/** /**
* @param isDispatch 是否是派单,是:区分社保数据与公积金数据
* @param isOnly 是否仅更新传过来的社保公积金,true:是(同时,true时,是户调基,要判断断缴) * @param isOnly 是否仅更新传过来的社保公积金,true:是(同时,true时,是户调基,要判断断缴)
* @param socialFundInfo * @param socialFundInfo
* @Description: 根据社保公积金信息表更新预估库 * @Description: 根据社保公积金信息表更新预估库
...@@ -1622,7 +1623,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1622,7 +1623,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
* @Date: 2022/7/26 19:01 * @Date: 2022/7/26 19:01
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/ **/
private R<String> updateForecastLibaryCore(TSocialFundInfo socialFundInfo, String doMonth, boolean isOnly) { private R<String> updateForecastLibaryCore(TSocialFundInfo socialFundInfo, String doMonth, boolean isOnly, boolean isDispatch) {
String empIdCard = socialFundInfo.getEmpIdcard(); String empIdCard = socialFundInfo.getEmpIdcard();
//定义未推送的按条件查询得到的预估数据 //定义未推送的按条件查询得到的预估数据
List<TForecastLibrary> librarySocialList = null; List<TForecastLibrary> librarySocialList = null;
...@@ -1670,6 +1671,31 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1670,6 +1671,31 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
} }
//查询出所有对应条件的预估数、社保数据、公积金数据据用于重新生成 //查询出所有对应条件的预估数、社保数据、公积金数据据用于重新生成
if (Common.isNotNull(empIdCard)) { if (Common.isNotNull(empIdCard)) {
if (isDispatch) {
if (socialFundInfo.getSocialStartDate() != null) {
payMonthList = new ArrayList<>();
// 获取最小的起缴月
Date minStartDate = this.getMinSocialDate(socialFundInfo);
// 再计算月份
monthDiff = DateUtil.getMonthDiff(minStartDate, new Date()) + 2;
if (monthDiff <= 0) {
return R.failed("派单同步预估库,社保起缴月份无法生成,monthDiff=" + monthDiff);
}
for (int i = 0; i < monthDiff; i++) {
payMonthList.add(DateUtil.addMonth(1 - i));
}
librarySocialList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ZERO_INT));
librarySocialListTemp = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT));
}
} else {
librarySocialList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda() librarySocialList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard) .eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT) .eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
...@@ -1680,6 +1706,32 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1680,6 +1706,32 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT) .eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList) .in(TForecastLibrary::getSocialPayMonth, payMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)); .eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT));
}
if (isDispatch) {
if (socialFundInfo.getProvidentStart() != null) {
payMonthList = new ArrayList<>();
// 获取最小的起缴月
Date minStartDate = socialFundInfo.getProvidentStart();
// 再计算月份
monthDiff = DateUtil.getMonthDiff(minStartDate, new Date()) + 2;
if (monthDiff <= 0) {
return R.failed("派单同步预估库,公积金起缴月份无法生成,monthDiff=" + monthDiff);
}
for (int i = 0; i < monthDiff; i++) {
payMonthList.add(DateUtil.addMonth(1 - i));
}
libraryFundList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ZERO_INT));
libraryFundListTemp = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT));
}
} else {
libraryFundList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda() libraryFundList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard) .eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT) .eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
...@@ -1690,6 +1742,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1690,6 +1742,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT) .eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList) .in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)); .eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT));
}
if (isOnly) { if (isOnly) {
if (Common.isNotNull(socialFundInfo.getSocialId())) { if (Common.isNotNull(socialFundInfo.getSocialId())) {
socialInfoList = new ArrayList<>(); socialInfoList = new ArrayList<>();
......
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