Commit 9c7cdb8a by jianan

薪资单-历史薪资加全部,A+B+C = "SalaryType": "业绩佣金" + "SalaryType": "加扣款项"

parent f1880701
...@@ -70,6 +70,7 @@ import com.yd.util.CommonUtil; ...@@ -70,6 +70,7 @@ import com.yd.util.CommonUtil;
import com.yd.util.config.ZHBErrorConfig; import com.yd.util.config.ZHBErrorConfig;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -374,27 +375,22 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -374,27 +375,22 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
String isHistory = requestVO.getIsHistory(); String isHistory = requestVO.getIsHistory();
List<PayScaleInfo> resultList = new ArrayList<>(); List<PayScaleInfo> resultList = new ArrayList<>();
List<PayScaleInfo> listFromN22 = null;
List<PayScaleInfo> historyEG = null;
try { try {
if ("0".equals(isHistory)) { if ("0".equals(isHistory)) {
listFromN22 = this.queryPayScaleListFromN22(requestVO); // 查询本年
} resultList = this.queryPayScaleListFromN22(requestVO);
// 查询历史才需要执行 } else if ("1".equals(isHistory)) {
if ("1".equals(isHistory)) { // 查询历史才需要执行
historyEG = this.historyEG(requestVO); resultList = this.historyEG(requestVO);
} else {
// 查询全部,把N22和历史集合合并到一起
resultList = this.queryAll(requestVO);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
if (CollectionUtils.isNotEmpty(listFromN22)) {
resultList.addAll(listFromN22);
}
if (CollectionUtils.isNotEmpty(historyEG)) {
resultList.addAll(historyEG);
}
// 排序 // 排序
resultList.sort(Comparator.comparing(PayScaleInfo :: getMonDtlPeriod).reversed()); resultList.sort(Comparator.comparing(PayScaleInfo :: getMonDtlPeriod).reversed());
...@@ -403,6 +399,26 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -403,6 +399,26 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
return responseVO; return responseVO;
} }
private List<PayScaleInfo> queryAll(PayScaleQueryRequestVO requestVO) throws Exception {
List<PayScaleInfo> listN22 = this.queryPayScaleListFromN22(requestVO);
List<PayScaleInfo> historyEG = this.historyEG(requestVO);
Map<String, PayScaleInfo> map = new HashMap<>();
String yearMonth = "";
for (PayScaleInfo infoN22 : listN22) {
yearMonth = infoN22.getYears() + infoN22.getMonth();
map.put(yearMonth, infoN22);
}
for (PayScaleInfo infoEG : historyEG) {
yearMonth = infoEG.getYears() + infoEG.getMonth();
if (!map.containsKey(yearMonth)) {
map.put(yearMonth, infoEG);
}
}
return new ArrayList<>(map.values());
}
private List<PayScaleInfo> queryPayScaleListFromN22(PayScaleQueryRequestVO requestVO) throws Exception { private List<PayScaleInfo> queryPayScaleListFromN22(PayScaleQueryRequestVO requestVO) throws Exception {
Long practitionerId = requestVO.getPractitionerId(); Long practitionerId = requestVO.getPractitionerId();
...@@ -790,7 +806,11 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -790,7 +806,11 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
List<SalaryDetails> salaryDetailsList = staffSalaryDetails.getSalaryDetailsLIST(); List<SalaryDetails> salaryDetailsList = staffSalaryDetails.getSalaryDetailsLIST();
// 1.过滤掉SalaryName=FYC的元素 // 1.过滤掉SalaryName=FYC的元素
salaryDetailsList = salaryDetailsList.stream() salaryDetailsList = salaryDetailsList.stream()
.filter((SalaryDetails i) -> !"FYC".equals(i.getSalaryName())) .filter((SalaryDetails i) ->
("业绩佣金".equals(i.getSalaryType())
|| "加扣款项".equals(i.getSalaryType())
)
)
.collect(Collectors.toList()); .collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(salaryDetailsList)) { if (CollectionUtils.isNotEmpty(salaryDetailsList)) {
...@@ -803,10 +823,6 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -803,10 +823,6 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
responseVO.setRate(rate); responseVO.setRate(rate);
// 佣金合计 // 佣金合计
for (SalaryDetails item : salaryDetailsList) { for (SalaryDetails item : salaryDetailsList) {
if ("d771080c-5424-11e9-9745-00163e0040a8".equals(item.getProject_id())) {
// 过滤掉salaryName: "二年续期佣金"
continue;
}
abc = abc.add(BigDecimal.valueOf(item.getCommission())); abc = abc.add(BigDecimal.valueOf(item.getCommission()));
} }
responseVO.setAbc(abc.toString()); responseVO.setAbc(abc.toString());
......
...@@ -6,7 +6,7 @@ public class PayScaleQueryRequestVO { ...@@ -6,7 +6,7 @@ public class PayScaleQueryRequestVO {
private Long practitionerId; private Long practitionerId;
/** /**
* 0-查本年 1-查历史 * 0-查本年 1-查历史 2-查全部
*/ */
private String isHistory; private String isHistory;
......
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