|
|
@ -446,9 +446,8 @@ public class ScmSpecialrebateCheckapplyService extends MybatisBaseService<ScmSpe |
|
|
|
/** |
|
|
|
* 推送单车返利核对凭证 |
|
|
|
* |
|
|
|
* @param sid,tag (0代表核对申请通过推送,1代表重推功能) |
|
|
|
*/ |
|
|
|
public void pushSpecialRebateWithVoucher(String sid, String tag, Map<String, Integer> mapCheckState) { |
|
|
|
public void pushSpecialRebateWithVoucher(String sid) { |
|
|
|
String format = scmVehRebateWithApplyService.returnBusDate(new Date()); |
|
|
|
String summaryTag = "";//摘要前缀
|
|
|
|
ScmSpecialrebateCheckapply entity = fetchBySid(sid); |
|
|
@ -457,29 +456,20 @@ public class ScmSpecialrebateCheckapplyService extends MybatisBaseService<ScmSpe |
|
|
|
summaryTag = entity.getCheckApply(); |
|
|
|
} |
|
|
|
} |
|
|
|
List<ScmSpecialRebate> scmVehRebates = new ArrayList<>(); |
|
|
|
List<ScmSpecialrebateCheckapplydetailVo> scmVehrebateCheckapplydetailVos = scmSpecialrebateCheckapplydetailService.selByMainSid(sid); |
|
|
|
if (!scmVehrebateCheckapplydetailVos.isEmpty()) { |
|
|
|
for (ScmSpecialrebateCheckapplydetailVo s : scmVehrebateCheckapplydetailVos) { |
|
|
|
ScmSpecialRebate v = scmSpecialRebateService.fetchBySid(s.getSpecialRebateSid()); |
|
|
|
if (null != v) { |
|
|
|
scmVehRebates.add(v); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
List<ScmSpecialrebateCheckapplydetailVo> scmVehRebates = scmSpecialrebateCheckapplydetailService.selByMainSid(sid); |
|
|
|
//按照采购系统分组
|
|
|
|
if (!scmVehRebates.isEmpty()) { |
|
|
|
Map<String, List<ScmSpecialRebate>> map = scmVehRebates.stream().collect(Collectors.groupingBy(ScmSpecialRebate::getPurchaseSystemSid)); |
|
|
|
Map<String, List<ScmSpecialrebateCheckapplydetailVo>> map = scmVehRebates.stream().collect(Collectors.groupingBy(ScmSpecialrebateCheckapplydetailVo::getPurchaseSystemSid)); |
|
|
|
String finalSummaryTag = summaryTag; |
|
|
|
String[] split = finalSummaryTag.split("年"); |
|
|
|
String y1 = split[0]; //预提申请标题年份
|
|
|
|
for (Map.Entry<String, List<ScmSpecialRebate>> entry : map.entrySet()) { |
|
|
|
List<ScmSpecialRebate> v = entry.getValue(); |
|
|
|
for (Map.Entry<String, List<ScmSpecialrebateCheckapplydetailVo>> entry : map.entrySet()) { |
|
|
|
List<ScmSpecialrebateCheckapplydetailVo> v = entry.getValue(); |
|
|
|
GeneralVoucher generalVoucher = new GeneralVoucher(); |
|
|
|
generalVoucher.setBussDate(format); |
|
|
|
List<GeneralVoucher.GeneralVoucherDetail> voucherDetails = new ArrayList<>(); |
|
|
|
if (!v.isEmpty()) { |
|
|
|
for (ScmSpecialRebate rebate : v) { |
|
|
|
for (ScmSpecialrebateCheckapplydetailVo rebate : v) { |
|
|
|
BigDecimal yt = BigDecimal.ZERO;//预提
|
|
|
|
BigDecimal ytfl = BigDecimal.ZERO;//其中返利
|
|
|
|
BigDecimal ytqzzz = BigDecimal.ZERO;//其中支出费用
|
|
|
@ -535,29 +525,26 @@ public class ScmSpecialrebateCheckapplyService extends MybatisBaseService<ScmSpe |
|
|
|
if (null != rebate.getSecondItureCost()) { |
|
|
|
efpzc = rebate.getSecondItureCost(); |
|
|
|
} |
|
|
|
if (null != rebate.getTempItureCost()) { |
|
|
|
edfpzc = rebate.getTempItureCost(); |
|
|
|
} |
|
|
|
if (null != rebate.getSecondTreatCost()) { |
|
|
|
efpdzf = rebate.getSecondTreatCost(); |
|
|
|
} |
|
|
|
if (null != rebate.getTempTreatCost()) { |
|
|
|
edfpdzf = rebate.getTempTreatCost(); |
|
|
|
} |
|
|
|
if (null != rebate.getSecondSuppCost()) { |
|
|
|
efpdd = rebate.getSecondSuppCost(); |
|
|
|
} |
|
|
|
if (null != rebate.getTempSuppCost()) { |
|
|
|
edfpdd = rebate.getTempSuppCost(); |
|
|
|
} |
|
|
|
// if (null != rebate.getTempItureCost()) {
|
|
|
|
// edfpzc = rebate.getTempItureCost();
|
|
|
|
// }
|
|
|
|
// if (null != rebate.getSecondTreatCost()) {
|
|
|
|
// efpdzf = rebate.getSecondTreatCost();
|
|
|
|
// }
|
|
|
|
// if (null != rebate.getTempTreatCost()) {
|
|
|
|
// edfpdzf = rebate.getTempTreatCost();
|
|
|
|
// }
|
|
|
|
// if (null != rebate.getSecondSuppCost()) {
|
|
|
|
// efpdd = rebate.getSecondSuppCost();
|
|
|
|
// }
|
|
|
|
// if (null != rebate.getTempSuppCost()) {
|
|
|
|
// edfpdd = rebate.getTempSuppCost();
|
|
|
|
// }
|
|
|
|
efpfl = esc.subtract(efpzc).subtract(efpdzf).subtract(efpdd); |
|
|
|
edfpfl = ydqd.subtract(edfpzc).subtract(edfpdzf).subtract(edfpdd); |
|
|
|
Integer onceState = 0; |
|
|
|
if (tag.equals("0") && mapCheckState.size() > 0) { |
|
|
|
onceState = mapCheckState.get(rebate.getSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(rebate.getUseOrgSid())) { |
|
|
|
String useOrgSid = rebate.getUseOrgSid(); |
|
|
|
Integer onceState = rebate.getOnceCheckState(); |
|
|
|
if (StringUtils.isNotBlank(entity.getUseOrgSid())) { |
|
|
|
String useOrgSid = entity.getUseOrgSid(); |
|
|
|
SysOrganizationVo organizationVo = sysOrganizationFeign.fetchBySid(useOrgSid).getData(); |
|
|
|
if (null != organizationVo) { |
|
|
|
generalVoucher.setUseOrgCode(organizationVo.getOrgCode()); |
|
|
@ -584,7 +571,7 @@ public class ScmSpecialrebateCheckapplyService extends MybatisBaseService<ScmSpe |
|
|
|
} |
|
|
|
} |
|
|
|
if (!rebate.getRebateTypeValue().equals("行销政策")) { |
|
|
|
if (onceState.intValue() == 2 || tag.equals("1")) { |
|
|
|
if (onceState.intValue() == 0) { |
|
|
|
//没有进行过核对申请
|
|
|
|
if (ysc.compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
GeneralVoucher.GeneralVoucherDetail voucherDetail = new GeneralVoucher.GeneralVoucherDetail(); |
|
|
@ -718,7 +705,7 @@ public class ScmSpecialrebateCheckapplyService extends MybatisBaseService<ScmSpe |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (onceState.intValue() == 2 || tag.equals("1")) { |
|
|
|
if (onceState.intValue() == 0) { |
|
|
|
//没有进行过核对申请
|
|
|
|
if (ysc.compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
GeneralVoucher.GeneralVoucherDetail voucherDetail = new GeneralVoucher.GeneralVoucherDetail(); |
|
|
@ -898,11 +885,6 @@ public class ScmSpecialrebateCheckapplyService extends MybatisBaseService<ScmSpe |
|
|
|
Map<String, Integer> mapCheckState = new HashMap<>(); |
|
|
|
for (ScmSpecialrebateCheckapplydetailVo scmSpecialrebateCheckapplydetailVo : scmSpecialrebateCheckapplydetailVos) { |
|
|
|
ScmSpecialRebate scmSpecialRebate = scmSpecialRebateService.fetchBySid(scmSpecialrebateCheckapplydetailVo.getSpecialRebateSid()); |
|
|
|
if (scmSpecialRebate.getOnceCheckState().intValue() == 1) { |
|
|
|
mapCheckState.put(scmSpecialRebate.getSid(), 1); |
|
|
|
} else { |
|
|
|
mapCheckState.put(scmSpecialRebate.getSid(), 2); |
|
|
|
} |
|
|
|
if ("是".equals(scmSpecialRebate.getIsAdjustment())) { |
|
|
|
scmSpecialRebateService.updateState(scmSpecialrebateCheckapplydetailVo.getSpecialRebateSid(), 4); |
|
|
|
scmSpecialRebateService.updateAdjustmentState(scmSpecialrebateCheckapplydetailVo.getSpecialRebateSid(), 1); |
|
|
@ -912,7 +894,7 @@ public class ScmSpecialrebateCheckapplyService extends MybatisBaseService<ScmSpe |
|
|
|
scmSpecialRebateService.updateOnceCheckState(scmSpecialrebateCheckapplydetailVo.getSpecialRebateSid(), 1); |
|
|
|
} |
|
|
|
|
|
|
|
pushSpecialRebateWithVoucher(bv.getBusinessSid(), "0", mapCheckState); |
|
|
|
pushSpecialRebateWithVoucher(bv.getBusinessSid()); |
|
|
|
} |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} else { |
|
|
|