收款单保存根据收款银行账户带出银行类别
This commit is contained in:
parent
4730228999
commit
88ff390b74
|
@ -1,28 +1,47 @@
|
|||
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.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
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.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
@ -31,34 +50,9 @@ import java.nio.charset.Charset;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
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")
|
||||
public class GatheringbillRestResource extends ArapBaseRestResource {
|
||||
|
@ -81,15 +75,18 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
|
||||
@POST
|
||||
@Path("/bipinsert")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString bipInsertPaybill(JSONString str) {
|
||||
InvocationInfoProxy.getInstance().setGroupId("0001A110000000000677");
|
||||
NCCRestUtils.initInvocationInfo();
|
||||
String json = str.toJSONString();
|
||||
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);
|
||||
// 根据收款银行账户带出银行类别
|
||||
String def5 = getBankTypeByAccount(headvo.getRecaccount());
|
||||
headvo.setDef5(def5); // 银行类别
|
||||
headvo.setDef28(headvo.getBilldate().toStdString());// 交易日期
|
||||
// 汇率为空时,默认为1
|
||||
if (headvo.getRate() == null) {
|
||||
|
@ -333,8 +330,8 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
}
|
||||
|
||||
// 实际收款金额 01无约定预付款 02有约定已收到预付款 03有约定未收到款
|
||||
|
||||
/**
|
||||
*
|
||||
* @param csaleorderid 销售订单id
|
||||
* @param pk_org 组织
|
||||
* @param ctid 合同id
|
||||
|
@ -690,16 +687,16 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
|
||||
@POST
|
||||
@Path("/insert")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString insertBill(JSONString str) {
|
||||
return insertBill(str, false);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/insertandcommit")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString insertAndCommitBill(JSONString str) {
|
||||
return insertBill(str, true);
|
||||
}
|
||||
|
@ -724,8 +721,8 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
|
||||
@POST
|
||||
@Path("/uncommitanddelete")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString unCommitAndDelBill(JSONString str) {
|
||||
try {
|
||||
return unCommitAndDelBill(str, "pk_gatherbill", "F2");
|
||||
|
@ -736,24 +733,24 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
|
||||
@POST
|
||||
@Path("/query")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString queryBill(JSONString str) {
|
||||
return queryBill(str, "F2");
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/update")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString updateBill(JSONString str) {
|
||||
return updateBill(str, "F2");
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/delete")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString deleteBill(JSONString str) {
|
||||
try {
|
||||
return deleteBill(str, "pk_gatherbill", "F2");
|
||||
|
@ -764,8 +761,8 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
|
||||
@POST
|
||||
@Path("/commit")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString commitBill(JSONString str) {
|
||||
try {
|
||||
return commitBill(str, "pk_gatherbill", "F2");
|
||||
|
@ -776,8 +773,8 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
|
||||
@POST
|
||||
@Path("/uncommit")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString unCommitBill(JSONString str) {
|
||||
try {
|
||||
return unCommitBill(str, "pk_gatherbill", "F2");
|
||||
|
@ -794,7 +791,6 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 期初合同销售订单认领直接生成高级版收款单
|
||||
*
|
||||
|
@ -804,8 +800,8 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
|
||||
@POST
|
||||
@Path("/bipinsert1")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString bipInsertPaybill1(JSONString str) throws BusinessException {
|
||||
InvocationInfoProxy.getInstance().setGroupId("0001A110000000000677");
|
||||
NCCRestUtils.initInvocationInfo();
|
||||
|
@ -813,6 +809,9 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
Map<String, Object> billMap = (Map) fromJson(json, Map.class);
|
||||
billMap.put("recaccount", billMap.get("ar_recaccount"));
|
||||
GatheringBillVO headvo = (GatheringBillVO) fromJsonToVO(billMap, GatheringBillVO.class);
|
||||
// 根据收款银行账户带出银行类别
|
||||
String def5 = getBankTypeByAccount(headvo.getRecaccount());
|
||||
headvo.setDef5(def5); // 银行类别
|
||||
headvo.setDef28(headvo.getBilldate().toStdString());// 交易日期
|
||||
// 汇率为空时,默认为1
|
||||
if (headvo.getRate() == null) {
|
||||
|
@ -846,7 +845,7 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
HYPubBO hybo = new HYPubBO();
|
||||
// SELECT pk_adminorg FROM org_adminorg WHERE code='C042'
|
||||
|
||||
String org =hybo.findColValue("org_adminorg", "pk_adminorg", " code = '" + headvo.getPk_org() + "' ") + "";
|
||||
String org = hybo.findColValue("org_adminorg", "pk_adminorg", " code = '" + headvo.getPk_org() + "' ") + "";
|
||||
|
||||
headvo.setIsinit(new UFBoolean(false));
|
||||
// 默认 收款类型 默认合同收款单
|
||||
|
@ -892,10 +891,10 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
HYPubBO hybo1 = new HYPubBO();
|
||||
String org =hybo1.findColValue("org_adminorg", "pk_adminorg", " code = '" + headvo.getPk_org() + "' ") + "";
|
||||
//根据BIP传的值进行创建自定义档案 def2 合同销售订单号
|
||||
//def6 合同编号
|
||||
//def3 标前项目号
|
||||
String org = hybo1.findColValue("org_adminorg", "pk_adminorg", " code = '" + headvo.getPk_org() + "' ") + "";
|
||||
// 根据BIP传的值进行创建自定义档案 def2 合同销售订单号
|
||||
// def6 合同编号
|
||||
// def3 标前项目号
|
||||
if (itemMaps.size() > 0) {
|
||||
NCLocator.getInstance().lookup(IDefdocService.class).insertDefdocs(headvo.getPk_org(), createDefVO(itemMaps.stream()
|
||||
.map(map -> (String) map.get("def6"))
|
||||
|
@ -916,7 +915,7 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
|
||||
if (itemMaps != null && itemMaps.size() > 0) {
|
||||
for (Map<String, Object> item : itemMaps) {
|
||||
if(item.get("def7") != null){
|
||||
if (item.get("def7") != null) {
|
||||
item.put("def7", item.get("def7").toString());
|
||||
}
|
||||
GatheringBillItemVO itemvo = (GatheringBillItemVO) fromJsonToVO(item, GatheringBillItemVO.class);
|
||||
|
@ -992,7 +991,7 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
// Object def36 = itemvo.getDef36();
|
||||
// if (def36 != null)
|
||||
// itemvo.setDef36(hybo.findColValue("bd_defdoc", "pk_defdoc", " code = '" + def36 + "' ") + "");
|
||||
//新增自定义档案
|
||||
// 新增自定义档案
|
||||
|
||||
HYSuperDMO dmo = new HYSuperDMO();
|
||||
// SaleOrderHVO[] hvo = (SaleOrderHVO[]) dmo.queryByWhereClause(SaleOrderHVO.class,
|
||||
|
@ -1052,6 +1051,7 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
}
|
||||
|
||||
private DefdocVO[] createDefVO(List<String> newhth, String defdoclistcode, String pk_org) throws BusinessException {
|
||||
String sql = " select pk_defdoclist from bd_defdoclist where code='" + defdoclistcode + "' ";
|
||||
|
||||
|
@ -1084,7 +1084,8 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
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();
|
||||
ArrayList<ProjectHeadVO> arrvo = new ArrayList<ProjectHeadVO>();
|
||||
for (int i = 0; i < newhth.size(); i++) {
|
||||
|
@ -1096,8 +1097,8 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
vo.setEnablestate(2);
|
||||
vo.setPk_org(pk_org);
|
||||
vo.setProject_code((String) newhth.get(i).get("def6"));
|
||||
vo.setProject_name((String) newhth.get(i).get("def6")+(String) newhth.get(i).get("def36"));
|
||||
vo.setPk_eps(hybo.findColValue("pm_eps", "pk_eps", " eps_code = '"+01+"' ") + "");
|
||||
vo.setProject_name((String) newhth.get(i).get("def6") + (String) newhth.get(i).get("def36"));
|
||||
vo.setPk_eps(hybo.findColValue("pm_eps", "pk_eps", " eps_code = '" + 01 + "' ") + "");
|
||||
vo.setDr(0);
|
||||
vo.setPk_group(InvocationInfoProxy.getInstance().getGroupId());
|
||||
vo.setCreator(InvocationInfoProxy.getInstance().getUserId());
|
||||
|
@ -1109,4 +1110,27 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue