Commit 804a49d7 by jianan

N22薪资单列表接口

parent bb8d1f8c
...@@ -362,9 +362,106 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -362,9 +362,106 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
@Override @Override
public PayScaleQueryResponseVO payScaleListQuery(PayScaleQueryRequestVO requestVO) { public PayScaleQueryResponseVO payScaleListQuery(PayScaleQueryRequestVO requestVO) {
PayScaleQueryResponseVO responseVO = new PayScaleQueryResponseVO(); PayScaleQueryResponseVO responseVO = new PayScaleQueryResponseVO();
String isHistory = requestVO.getIsHistory();
List<PayScaleInfo> resultList = new ArrayList<>();
List<PayScaleInfo> listFromN22 = null;
List<PayScaleInfo> historyEG = null;
try {
listFromN22 = this.queryPayScaleListFromN22(requestVO);
// 查询全部才需要执行
if ("1".equals(isHistory)) {
historyEG = this.historyEG(requestVO);
}
} catch (Exception e) {
e.printStackTrace();
}
if (CollectionUtils.isNotEmpty(listFromN22)) {
resultList.addAll(listFromN22);
}
if (CollectionUtils.isNotEmpty(historyEG)) {
resultList.addAll(historyEG);
}
// 排序
resultList.sort(Comparator.comparing(PayScaleInfo :: getMonDtlPeriod).reversed());
responseVO.setPayScaleInfos(resultList);
responseVO.setCommonResult(new CommonResult(true,ZHBErrorConfig.getErrorInfo("800000")));
return responseVO;
}
private List<PayScaleInfo> queryPayScaleListFromN22(PayScaleQueryRequestVO requestVO) throws Exception {
Long practitionerId = requestVO.getPractitionerId();
String isHistory = requestVO.getIsHistory();
String mobileNo = aclPractitionerDALService.findMobileNoByPractitionerId(practitionerId);
Staff staff = n22StaffService.queryN22StaffByMobileNo(mobileNo);
if (staff == null && StringUtils.isBlank(staff.getAgent_id())) {
throw new Exception("未查询到N22LoginName");
}
// 1.根据Agent_id当前经纪人的佣金明细
SalaryDetailsSearchRequestBody salaryDetailsSearchRequestBody = new SalaryDetailsSearchRequestBody();
salaryDetailsSearchRequestBody.setLoginName(staff.getAgent_id());
salaryDetailsSearchRequestBody.setSearchType("1");
if ("0".equals(isHistory)) {
salaryDetailsSearchRequestBody.setStartDate(CommonUtil.getBeginDayOfYear());
salaryDetailsSearchRequestBody.setEndDate(CommonUtil.getEndDayOfYear());
}
SalaryDetailsSearchResponseVO salaryDetailsSearchResponseVO = n22SalaryService.salaryDetailsSearch(salaryDetailsSearchRequestBody);
if (!"查询成功".equals(salaryDetailsSearchResponseVO.getResponseHead().getMessage())){
throw new Exception(salaryDetailsSearchResponseVO.getResponseHead().getMessage());
}
List<SalaryDetails> salaryDetailsList = salaryDetailsSearchResponseVO.getResponseBody().getSalaryDetailsLIST();
// list分组
Map<String, List<SalaryDetails>> group = this.groupByCheckDate(salaryDetailsList);
// 组装返回参数
List<PayScaleInfo> resultList = new ArrayList<>();
// 应发佣金
Double monDtlAmount = 0D;
// 应发佣金
Double monDtlRAmount = 0D;
// loginName
String loginName = "";
for (String key : group.keySet()) {
System.out.println("Key = " + key);
List<SalaryDetails> list = group.get(key);
if (CollectionUtils.isNotEmpty(list)) {
monDtlAmount = list.get(0).getSumcommission();
monDtlRAmount = list.get(0).getTax_free_comis();
loginName = list.get(0).getLoginName();
}
PayScaleInfo payScaleInfo = new PayScaleInfo();
payScaleInfo.setMonDtlAmount(monDtlAmount);
payScaleInfo.setMonDtlItem("实发薪水");
payScaleInfo.setMonDtlRAmount(monDtlRAmount);
payScaleInfo.setDrpTitleCode(list.get(0).getGrade());
payScaleInfo.setMonDtlPeriod(key);
payScaleInfo.setLoginName(loginName);
resultList.add(payScaleInfo);
}
resultList.sort(Comparator.comparing(PayScaleInfo :: getMonDtlPeriod).reversed());
return resultList;
}
private List<PayScaleInfo> historyEG(PayScaleQueryRequestVO requestVO) {
String practitionerIdEG = requestVO.getPractitionerIdEG(); String practitionerIdEG = requestVO.getPractitionerIdEG();
Long practitionerId = requestVO.getPractitionerId(); Long practitionerId = requestVO.getPractitionerId();
Map<Long,PayScaleInfo> payScaleInfoMap = new HashMap<>();
Map<String,PayScaleInfo> payScaleInfoMap = new HashMap<>();
if(!Strings.isNullOrEmpty(practitionerIdEG)){ if(!Strings.isNullOrEmpty(practitionerIdEG)){
List<PayScaleInfo> payScaleInfoListAll = aclPractitionerDALService.findPayScaleByPractitionerEG(practitionerIdEG); List<PayScaleInfo> payScaleInfoListAll = aclPractitionerDALService.findPayScaleByPractitionerEG(practitionerIdEG);
...@@ -377,7 +474,7 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -377,7 +474,7 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
titleList.forEach(i->titleMap.put(i.getTitleCode(),i.getTitleName())); titleList.forEach(i->titleMap.put(i.getTitleCode(),i.getTitleName()));
PayScaleInfo payScaleInfo; PayScaleInfo payScaleInfo;
Long time; String time;
for(PayScaleInfo item : payScaleInfoListAll){ for(PayScaleInfo item : payScaleInfoListAll){
time = item.getMonDtlPeriod(); time = item.getMonDtlPeriod();
if(payScaleInfoMap.containsKey(time)){ if(payScaleInfoMap.containsKey(time)){
...@@ -406,11 +503,9 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -406,11 +503,9 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
translateObj(list, resultList); translateObj(list, resultList);
// 排序 // 排序
resultList.sort(Comparator.comparingLong(PayScaleInfo :: getMonDtlPeriod).reversed()); resultList.sort(Comparator.comparing(PayScaleInfo :: getMonDtlPeriod).reversed());
responseVO.setPayScaleInfos(resultList);
responseVO.setCommonResult(new CommonResult(true,ZHBErrorConfig.getErrorInfo("800000"))); return resultList;
return responseVO;
} }
/** /**
...@@ -418,18 +513,14 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -418,18 +513,14 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
*/ */
private Map<String, List<SalaryDetails>> groupByCheckDate(List<SalaryDetails> salaryDetailsList) { private Map<String, List<SalaryDetails>> groupByCheckDate(List<SalaryDetails> salaryDetailsList) {
Map<String, List<SalaryDetails>> result = new HashMap<String, List<SalaryDetails>>(); Map<String, List<SalaryDetails>> result = new HashMap<String, List<SalaryDetails>>();
int year = 0; String checkDate = "";
String month = "";
String key = "";
for (SalaryDetails SalaryDetails : salaryDetailsList) { for (SalaryDetails SalaryDetails : salaryDetailsList) {
year = SalaryDetails.getYear(); checkDate = SalaryDetails.getCheckDate();
month = SalaryDetails.getMonth();
key = year + month;
List<SalaryDetails> childList = result.get(key); List<SalaryDetails> childList = result.get(checkDate);
if (childList == null) { if (childList == null) {
childList = new ArrayList<SalaryDetails>(); childList = new ArrayList<SalaryDetails>();
result.put(key, childList); result.put(checkDate, childList);
} }
childList.add(SalaryDetails); childList.add(SalaryDetails);
...@@ -444,7 +535,7 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -444,7 +535,7 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
payScaleInfo = new PayScaleInfo(); payScaleInfo = new PayScaleInfo();
payScaleInfo.setMonShId(salary.getId()); payScaleInfo.setMonShId(salary.getId());
payScaleInfo.setPdfOssPath(salary.getPdfOssPath()); payScaleInfo.setPdfOssPath(salary.getPdfOssPath());
payScaleInfo.setMonDtlPeriod(Long.valueOf(salary.getYearMonth())); payScaleInfo.setMonDtlPeriod(salary.getYearMonth());
payScaleInfo.setMonDtlAmount(salary.getPayableAmount().doubleValue()); payScaleInfo.setMonDtlAmount(salary.getPayableAmount().doubleValue());
payScaleInfo.setMonDtlRAmount(salary.getNetAmount().doubleValue()); payScaleInfo.setMonDtlRAmount(salary.getNetAmount().doubleValue());
......
...@@ -6,12 +6,13 @@ public class PayScaleInfo { ...@@ -6,12 +6,13 @@ public class PayScaleInfo {
private String drpTitleCode; private String drpTitleCode;
private String monDtlType; private String monDtlType;
private String monDtlItem; private String monDtlItem;
private Long monDtlPeriod; private String monDtlPeriod;
private Double monDtlAmount; private Double monDtlAmount;
private Double monDtlRAmount; private Double monDtlRAmount;
private String createDate; private String createDate;
private String createUser; private String createUser;
private String pdfOssPath; private String pdfOssPath;
private String loginName;
public Long getMonShId() { public Long getMonShId() {
return monShId; return monShId;
...@@ -85,11 +86,11 @@ public class PayScaleInfo { ...@@ -85,11 +86,11 @@ public class PayScaleInfo {
this.createUser = createUser; this.createUser = createUser;
} }
public Long getMonDtlPeriod() { public String getMonDtlPeriod() {
return monDtlPeriod; return monDtlPeriod;
} }
public void setMonDtlPeriod(Long monDtlPeriod) { public void setMonDtlPeriod(String monDtlPeriod) {
this.monDtlPeriod = monDtlPeriod; this.monDtlPeriod = monDtlPeriod;
} }
...@@ -100,4 +101,12 @@ public class PayScaleInfo { ...@@ -100,4 +101,12 @@ public class PayScaleInfo {
public void setPdfOssPath(String pdfOssPath) { public void setPdfOssPath(String pdfOssPath) {
this.pdfOssPath = pdfOssPath; this.pdfOssPath = pdfOssPath;
} }
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
} }
...@@ -5,6 +5,11 @@ public class PayScaleQueryRequestVO { ...@@ -5,6 +5,11 @@ public class PayScaleQueryRequestVO {
private Long practitionerId; private Long practitionerId;
/**
* 0-查本年 1-查全部
*/
private String isHistory;
public String getPractitionerIdEG() { public String getPractitionerIdEG() {
return practitionerIdEG; return practitionerIdEG;
} }
...@@ -20,4 +25,12 @@ public class PayScaleQueryRequestVO { ...@@ -20,4 +25,12 @@ public class PayScaleQueryRequestVO {
public void setPractitionerId(Long practitionerId) { public void setPractitionerId(Long practitionerId) {
this.practitionerId = practitionerId; this.practitionerId = practitionerId;
} }
public String getIsHistory() {
return isHistory;
}
public void setIsHistory(String isHistory) {
this.isHistory = 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