|
|
@ -66,9 +66,7 @@ import org.springframework.web.bind.annotation.*; |
|
|
|
import javax.validation.Valid; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
@Api(tags = "单据调用金蝶的暂存接口") |
|
|
|
@RestController("com.yxt.anrui.fin.biz.kingdee.FinKingDeeFeignRest") |
|
|
@ -436,6 +434,14 @@ public class FinKingDeeFeignRest implements FinKingDeeFeign { |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); |
|
|
|
Voucher newVoucher = new Voucher(); |
|
|
|
String payType = ""; |
|
|
|
String remarks1 = ""; |
|
|
|
String remarks2 = ""; |
|
|
|
String remarks3 = ""; |
|
|
|
StringBuffer sb = new StringBuffer(); |
|
|
|
Set<String> setString = new HashSet<>(); |
|
|
|
BigDecimal amountAll = new BigDecimal(0); |
|
|
|
int check = 0; |
|
|
|
Date date = null; |
|
|
|
List<Voucher.VoucherResultDetailDto> resultDetails = new ArrayList<>(); |
|
|
|
if (StringUtils.isNotBlank(voucher.getUseOrgCode())) { |
|
|
|
newVoucher.setAccountBook(voucher.getUseOrgCode()); |
|
|
@ -456,11 +462,15 @@ public class FinKingDeeFeignRest implements FinKingDeeFeign { |
|
|
|
for (CollectionVoucher.CollectionVoucherDetail voucherDetail : voucherDetails) { |
|
|
|
if (StringUtils.isNotBlank(voucherDetail.getPayCostTitleValue())) { |
|
|
|
String payCostTitleValue = voucherDetail.getPayCostTitleValue(); |
|
|
|
date = voucherDetail.getDataTime(); |
|
|
|
amountAll = amountAll.add(voucherDetail.getAmount()); |
|
|
|
if (payCostTitleValue.equals("月还") || payCostTitleValue.equals("资方逾期利息")) { |
|
|
|
Voucher.VoucherResultDetailDto dto1 = new Voucher.VoucherResultDetailDto(); //借方
|
|
|
|
if (payCostTitleValue.equals("月还")) { |
|
|
|
setString.add("月还"); |
|
|
|
} else if (payCostTitleValue.equals("资方逾期利息")) { |
|
|
|
setString.add("逾期利息"); |
|
|
|
} |
|
|
|
Voucher.VoucherResultDetailDto dto2 = new Voucher.VoucherResultDetailDto(); //贷方
|
|
|
|
dto1.setSummary("收月还(" + sdf.format(voucherDetail.getDataTime()) + ")"); |
|
|
|
dto1.setSubjectNo(payType); |
|
|
|
if (voucherDetail.getSceneCode().equals(SceneCodeEnum.INDIRECT_VOUCHER1.getCode())) { |
|
|
|
//未逾期
|
|
|
|
dto2.setSummary("收" + voucherDetail.getCustomerName() + "月还"); |
|
|
@ -470,46 +480,23 @@ public class FinKingDeeFeignRest implements FinKingDeeFeign { |
|
|
|
dto2.setSummary("收" + voucherDetail.getCustomerName() + "累欠"); |
|
|
|
dto2.setSubjectNo("1201.02.03"); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(voucher.getBankAccount())) { |
|
|
|
dto1.setBankAccount(voucher.getBankAccount()); |
|
|
|
} |
|
|
|
dto2.setDimensionDept(voucherDetail.getDeptCode()); |
|
|
|
dto2.setDimensionCustom(voucherDetail.getCustomerCode()); |
|
|
|
dto1.setDebit(String.valueOf(voucherDetail.getAmount())); |
|
|
|
dto2.setCredit(String.valueOf(voucherDetail.getAmount())); |
|
|
|
resultDetails.add(dto1); |
|
|
|
resultDetails.add(dto2); |
|
|
|
} else if (payCostTitleValue.equals("资金占用费")) { |
|
|
|
Voucher.VoucherResultDetailDto dto1 = new Voucher.VoucherResultDetailDto(); //借方
|
|
|
|
setString.add("累欠"); |
|
|
|
Voucher.VoucherResultDetailDto dto2 = new Voucher.VoucherResultDetailDto(); //贷方
|
|
|
|
if (voucherDetail.getSceneCode().equals(SceneCodeEnum.FUND_VOUCHER1.getCode())) { |
|
|
|
dto1.setSummary("收累欠(" + sdf.format(voucherDetail.getDataTime()) + ")"); |
|
|
|
dto1.setSubjectNo(payType); |
|
|
|
dto2.setSummary("收逾期利息(" + sdf.format(voucherDetail.getDataTime()) + ")"); |
|
|
|
dto2.setSubjectNo("1201.02.02"); |
|
|
|
if (StringUtils.isNotBlank(voucher.getBankAccount())) { |
|
|
|
dto1.setBankAccount(voucher.getBankAccount()); |
|
|
|
} |
|
|
|
dto2.setDimensionDept(voucherDetail.getDeptCode()); |
|
|
|
dto2.setDimensionCustom(voucherDetail.getCustomerCode()); |
|
|
|
} else if (voucherDetail.getSceneCode().equals(SceneCodeEnum.FUND_VOUCHER2.getCode())) { |
|
|
|
//确认收入
|
|
|
|
SimpleDateFormat sdfnew = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
String date = sdfnew.format(voucherDetail.getDataTime()); |
|
|
|
String[] split = date.split("-"); |
|
|
|
String month = split[1]; |
|
|
|
dto1.setSummary(month + "月逾期利息确认收入"); |
|
|
|
dto1.setSubjectNo("2191.05.00"); |
|
|
|
dto1.setDimensionDept(voucherDetail.getDeptCode()); |
|
|
|
dto2.setSummary(month + "月逾期利息确认收入"); |
|
|
|
dto2.setSubjectNo("6002.01.19"); |
|
|
|
dto2.setDimensionDept(voucherDetail.getDeptCode()); |
|
|
|
} |
|
|
|
dto1.setDebit(String.valueOf(voucherDetail.getAmount())); |
|
|
|
dto2.setCredit(String.valueOf(voucherDetail.getAmount())); |
|
|
|
resultDetails.add(dto1); |
|
|
|
resultDetails.add(dto2); |
|
|
|
} else if (payCostTitleValue.equals("资方退还垫款")) { |
|
|
|
check = 1; |
|
|
|
Voucher.VoucherResultDetailDto dto1 = new Voucher.VoucherResultDetailDto(); //借方
|
|
|
|
Voucher.VoucherResultDetailDto dto2 = new Voucher.VoucherResultDetailDto(); //贷方
|
|
|
|
dto1.setSummary("收中车经销商垫款退回"); |
|
|
@ -529,10 +516,43 @@ public class FinKingDeeFeignRest implements FinKingDeeFeign { |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
newVoucher.setResultDetails(resultDetails); |
|
|
|
if (check == 0) { |
|
|
|
if (!setString.isEmpty()) { |
|
|
|
for (String s : setString) { |
|
|
|
if (s.equals("月还")) { |
|
|
|
remarks1 = "月还"; |
|
|
|
} else if (s.equals("累欠")) { |
|
|
|
remarks2 = "累欠"; |
|
|
|
} else if (s.equals("逾期利息")) { |
|
|
|
remarks3 = "逾期利息"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(remarks1)) { |
|
|
|
sb.append(remarks1).append("、"); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(remarks2)) { |
|
|
|
sb.append(remarks2).append("、"); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(remarks3)) { |
|
|
|
sb.append(remarks3).append("、"); |
|
|
|
} |
|
|
|
Voucher.VoucherResultDetailDto dto1 = new Voucher.VoucherResultDetailDto(); //借方
|
|
|
|
if (StringUtils.isNotBlank(voucher.getBankAccount())) { |
|
|
|
dto1.setBankAccount(voucher.getBankAccount()); |
|
|
|
} |
|
|
|
dto1.setSubjectNo(payType); |
|
|
|
if (sb.length() > 0) { |
|
|
|
sb.delete(sb.length() - 1, sb.length()); |
|
|
|
dto1.setSummary("收" + sb + "(" + sdf.format(date) + ")"); |
|
|
|
} |
|
|
|
dto1.setDebit(String.valueOf(amountAll)); |
|
|
|
resultDetails.add(0, dto1); |
|
|
|
newVoucher.setResultDetails(resultDetails); |
|
|
|
} |
|
|
|
} |
|
|
|
log.info("FinKingDeeFeignRest-saveVoucher:{}", JSONObject.toJSONString(newVoucher)); |
|
|
|
return voucherService.saveVoucher(newVoucher); |
|
|
|
return voucherService.saveVoucher(newVoucher); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -642,7 +662,7 @@ public class FinKingDeeFeignRest implements FinKingDeeFeign { |
|
|
|
newVoucher.setResultDetails(resultDetails); |
|
|
|
} |
|
|
|
log.info("FinKingDeeFeignRest-saveVoucher:{}", JSONObject.toJSONString(newVoucher)); |
|
|
|
return voucherService.saveVoucher(newVoucher); |
|
|
|
return voucherService.saveVoucher(newVoucher); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|