收款单保存根据收款银行账户带出银行类别

This commit is contained in:
mzr 2025-06-20 21:40:09 +08:00
parent 4730228999
commit 88ff390b74
1 changed files with 1008 additions and 984 deletions

View File

@ -1,28 +1,47 @@
package nc.api.arap.resource; package nc.api.arap.resource;
import java.util.Map; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import nc.bs.dao.BaseDAO;
import nc.bs.dao.DAOException;
import nc.bs.framework.common.InvocationInfoProxy;
import nc.bs.framework.common.NCLocator;
import nc.bs.logging.Logger;
import nc.bs.trade.business.HYPubBO;
import nc.bs.trade.business.HYSuperDMO;
import nc.itf.bd.defdoc.IDefdocService;
import nc.itf.pmpub.project.pub.IProjectServiceForPu;
import nc.jdbc.framework.processor.ColumnProcessor;
import nc.jdbc.framework.processor.MapProcessor;
import nc.vo.arap.basebill.BaseAggVO;
import nc.vo.arap.gathering.AggGatheringBillVO;
import nc.vo.arap.gathering.GatheringBillItemVO;
import nc.vo.arap.gathering.GatheringBillVO;
import nc.vo.bd.bankaccount.BankAccbasVO;
import nc.vo.bd.defdoc.DefdocVO;
import nc.vo.pmpub.project.ProjectHeadVO;
import nc.vo.pub.BusinessException;
import nc.vo.pub.CircularlyAccessibleValueObject;
import nc.vo.pub.lang.UFBoolean;
import nc.vo.pub.lang.UFDateTime;
import nc.vo.pub.lang.UFDouble;
import nc.vo.pubapp.pattern.pub.MathTool;
import nc.vo.so.m30.entity.SaleOrderBVO;
import nc.vo.so.m30.entity.SaleOrderHVO;
import nccloud.api.rest.utils.NCCRestUtils;
import nccloud.api.rest.utils.ResultMessageUtil;
import nccloud.commons.lang.StringUtils;
import nccloud.pubitf.arap.openapi.IGatheringbillOpenService;
import org.json.JSONString;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import nc.bs.framework.common.NCLocator; import java.io.*;
import nc.bs.trade.business.HYSuperDMO;
import nc.itf.bd.defdoc.IDefdocService;
import nc.itf.pmpub.project.pub.IProjectServiceForPu;
import nc.vo.arap.basebill.BaseAggVO;
import nc.vo.pmpub.project.ProjectHeadVO;
import nc.vo.pub.BusinessException;
import nc.vo.pub.lang.UFDateTime;
import nccloud.api.rest.utils.NCCRestUtils;
import nccloud.api.rest.utils.ResultMessageUtil;
import nccloud.pubitf.arap.openapi.IGatheringbillOpenService;
import org.json.JSONString;
import com.google.gson.Gson;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
@ -31,34 +50,9 @@ import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException; import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.ArrayList; import java.util.*;
import java.util.Base64;
import java.util.HashMap;
import java.util.List;
import java.util.TreeMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import nc.bs.dao.BaseDAO;
import nc.bs.dao.DAOException;
import nc.bs.framework.common.InvocationInfoProxy;
import nc.bs.trade.business.HYPubBO;
import nc.jdbc.framework.processor.ColumnProcessor;
import nc.jdbc.framework.processor.MapProcessor;
import nc.vo.arap.gathering.AggGatheringBillVO;
import nc.vo.arap.gathering.GatheringBillItemVO;
import nc.vo.arap.gathering.GatheringBillVO;
import nc.vo.bd.defdoc.DefdocVO;
import nc.vo.pub.CircularlyAccessibleValueObject;
import nc.vo.pub.lang.UFBoolean;
import nc.vo.pub.lang.UFDouble;
import nc.vo.pubapp.pattern.pub.MathTool;
import nc.vo.so.m30.entity.SaleOrderBVO;
import nc.vo.so.m30.entity.SaleOrderHVO;
import nccloud.commons.lang.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@Path("arap/gatheringbill") @Path("arap/gatheringbill")
public class GatheringbillRestResource extends ArapBaseRestResource { public class GatheringbillRestResource extends ArapBaseRestResource {
@ -88,8 +82,11 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
NCCRestUtils.initInvocationInfo(); NCCRestUtils.initInvocationInfo();
String json = str.toJSONString(); String json = str.toJSONString();
Map<String, Object> billMap = (Map) fromJson(json, Map.class); Map<String, Object> billMap = (Map) fromJson(json, Map.class);
billMap.put("recaccount", billMap.get("ar_recaccount")); billMap.put("recaccount", billMap.get("ar_recaccount"));// 收款银行账户
GatheringBillVO headvo = (GatheringBillVO) fromJsonToVO(billMap, GatheringBillVO.class); GatheringBillVO headvo = (GatheringBillVO) fromJsonToVO(billMap, GatheringBillVO.class);
// 根据收款银行账户带出银行类别
String def5 = getBankTypeByAccount(headvo.getRecaccount());
headvo.setDef5(def5); // 银行类别
headvo.setDef28(headvo.getBilldate().toStdString());// 交易日期 headvo.setDef28(headvo.getBilldate().toStdString());// 交易日期
// 汇率为空时默认为1 // 汇率为空时默认为1
if (headvo.getRate() == null) { if (headvo.getRate() == null) {
@ -333,8 +330,8 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
} }
// 实际收款金额 01无约定预付款 02有约定已收到预付款 03有约定未收到款 // 实际收款金额 01无约定预付款 02有约定已收到预付款 03有约定未收到款
/** /**
*
* @param csaleorderid 销售订单id * @param csaleorderid 销售订单id
* @param pk_org 组织 * @param pk_org 组织
* @param ctid 合同id * @param ctid 合同id
@ -794,7 +791,6 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
} }
/** /**
* 期初合同销售订单认领直接生成高级版收款单 * 期初合同销售订单认领直接生成高级版收款单
* *
@ -813,6 +809,9 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
Map<String, Object> billMap = (Map) fromJson(json, Map.class); Map<String, Object> billMap = (Map) fromJson(json, Map.class);
billMap.put("recaccount", billMap.get("ar_recaccount")); billMap.put("recaccount", billMap.get("ar_recaccount"));
GatheringBillVO headvo = (GatheringBillVO) fromJsonToVO(billMap, GatheringBillVO.class); GatheringBillVO headvo = (GatheringBillVO) fromJsonToVO(billMap, GatheringBillVO.class);
// 根据收款银行账户带出银行类别
String def5 = getBankTypeByAccount(headvo.getRecaccount());
headvo.setDef5(def5); // 银行类别
headvo.setDef28(headvo.getBilldate().toStdString());// 交易日期 headvo.setDef28(headvo.getBilldate().toStdString());// 交易日期
// 汇率为空时默认为1 // 汇率为空时默认为1
if (headvo.getRate() == null) { if (headvo.getRate() == null) {
@ -1052,6 +1051,7 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
return ResultMessageUtil.exceptionToJSON(e); return ResultMessageUtil.exceptionToJSON(e);
} }
} }
private DefdocVO[] createDefVO(List<String> newhth, String defdoclistcode, String pk_org) throws BusinessException { private DefdocVO[] createDefVO(List<String> newhth, String defdoclistcode, String pk_org) throws BusinessException {
String sql = " select pk_defdoclist from bd_defdoclist where code='" + defdoclistcode + "' "; String sql = " select pk_defdoclist from bd_defdoclist where code='" + defdoclistcode + "' ";
@ -1084,6 +1084,7 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
return arrvo.toArray(new DefdocVO[arrvo.size()]); return arrvo.toArray(new DefdocVO[arrvo.size()]);
} }
private ProjectHeadVO[] createProjectHeadVO(List<Map<String, Object>> newhth, String pk_org) throws BusinessException { private ProjectHeadVO[] createProjectHeadVO(List<Map<String, Object>> newhth, String pk_org) throws BusinessException {
HYPubBO hybo = new HYPubBO(); HYPubBO hybo = new HYPubBO();
ArrayList<ProjectHeadVO> arrvo = new ArrayList<ProjectHeadVO>(); ArrayList<ProjectHeadVO> arrvo = new ArrayList<ProjectHeadVO>();
@ -1109,4 +1110,27 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
return arrvo.toArray(new ProjectHeadVO[arrvo.size()]); return arrvo.toArray(new ProjectHeadVO[arrvo.size()]);
} }
/**
* 根据收款银行账户带出银行类别
*
* @param recaccount 银行账户
*/
private String getBankTypeByAccount(String recaccount) {
if (StringUtils.isEmpty(recaccount) || "~".equals(recaccount)) {
return "";
}
String strWhere = " accnum = '[accnum]' and enablestate = 2";
strWhere = strWhere.replace("[accnum]", recaccount);
try {
BankAccbasVO[] vos = (BankAccbasVO[]) getSuperDMO().queryByWhereClause(BankAccbasVO.class, strWhere);
if (vos != null && vos.length > 0) {
Logger.error("pk_banktype = " + vos[0].getPk_banktype());
return vos[0].getPk_banktype();
}
} catch (DAOException e) {
Logger.error("getBankTypeByAccount-exp: " + e.getMessage(), e);
}
return null;
}
} }