diff --git a/arap/src/public/nc/api/arap/resource/GatheringbillRestResource.java b/arap/src/public/nc/api/arap/resource/GatheringbillRestResource.java index 2b21399..b917e31 100644 --- a/arap/src/public/nc/api/arap/resource/GatheringbillRestResource.java +++ b/arap/src/public/nc/api/arap/resource/GatheringbillRestResource.java @@ -7,8 +7,12 @@ 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; @@ -32,6 +36,7 @@ import java.util.Base64; import java.util.HashMap; import java.util.List; import java.util.TreeMap; +import java.util.stream.Collectors; import java.util.zip.GZIPInputStream; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; @@ -788,4 +793,309 @@ public class GatheringbillRestResource extends ArapBaseRestResource { return value.toString().trim(); } + + + /** + * 期初合同销售订单认领直接生成高级版收款单 + * + * @param str + * @return + */ + + @POST + @Path("/bipinsert1") + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + public JSONString bipInsertPaybill1(JSONString str) throws BusinessException { + InvocationInfoProxy.getInstance().setGroupId("0001A110000000000677"); + NCCRestUtils.initInvocationInfo(); + String json = str.toJSONString(); + Map billMap = (Map) fromJson(json, Map.class); + billMap.put("recaccount", billMap.get("ar_recaccount")); + GatheringBillVO headvo = (GatheringBillVO) fromJsonToVO(billMap, GatheringBillVO.class); + headvo.setDef28(headvo.getBilldate().toStdString());// 交易日期 + // 汇率为空时,默认为1 + if (headvo.getRate() == null) { + headvo.setRate(UFDouble.ONE_DBL); + } + // 结算方式名称 + Object balatypeName = ""; + // 金额 + UFDouble money = new UFDouble(0); + // 税率 + UFDouble ntaxrate = new UFDouble(0); + // 税码 + String ctaxcode = ""; + BaseDAO dao = new BaseDAO(); + // 销售订单号 从表体拿 +// String csaleorderid = ""; + + // 客户 从表体拿 + String customer = ""; + List> itemMaps = (List) billMap.get("items"); + List itemvos = new ArrayList(); + if (itemMaps != null && itemMaps.size() > 0) { + for (Map item : itemMaps) { + GatheringBillItemVO itemvo = (GatheringBillItemVO) fromJsonToVO(item, GatheringBillItemVO.class); + customer = itemvo.getCustomer(); + } + } + try { + HYPubBO hybo = new HYPubBO(); + headvo.setIsinit(new UFBoolean(false)); + // 默认 收款类型 默认合同收款单 + Object pk_billtypecode = hybo.findColValue("bd_billtype", "PK_BILLTYPECODE", "billtypename = '合同收款单' "); + headvo.setPk_tradetype(pk_billtypecode.toString()); + // 业务流程 默认【收款结算】 + Object pk_busitype = hybo.findColValue("bd_busitype", "busicode", "businame = '收款结算' "); + headvo.setPk_busitype(pk_busitype.toString()); + // 往来对象0-客户 2-部门 3-业务员 默认客户 + headvo.setObjtype(0); + headvo.setCustomer(customer); + + // pk_currtype 币种编码 默认人民币 + if (headvo.getPk_currtype() == null || headvo.getPk_currtype().isEmpty()) { + headvo.setPk_currtype("CNY"); + } + + // accessorynum 附件张数 默认2 + headvo.setAccessorynum(2); + // 制单人 默认BIP + headvo.setBillmaker("BIP"); + // 结算方式名称 + String balatypeCode = headvo.getPk_balatype(); + if (!StringUtils.isEmpty(balatypeCode)) { + Object pk_balatype = hybo.findColValue("bd_balatype", "pk_balatype", " code = '" + balatypeCode + "' "); +// headvo.setPk_balatype(pk_balatype.toString()); + if (pk_balatype != null) { + balatypeName = hybo.findColValue("bd_balatype", "name", " code = '" + balatypeCode + "' "); + } + + } + + // 银行收款账号 + // 原币金额 + // 单据状态 + headvo.setBillstatus(-1); + // 单据来源系统编码 + headvo.setSrc_syscode(17); + // 合同金额 + // 结算组织 + headvo.setSett_org(headvo.getPk_org()); + } catch (Exception e) { + return ResultMessageUtil.exceptionToJSON(e); + } + //根据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")) + .collect(Collectors.toList()), "zdy-001", headvo.getPk_org().toString())); + } + if (itemMaps.size() > 0) { + NCLocator.getInstance().lookup(IDefdocService.class).insertDefdocs(headvo.getPk_org(), createDefVO(itemMaps.stream() + .map(map -> (String) map.get("def2")) + .collect(Collectors.toList()), "BIP-ddh", headvo.getPk_org().toString())); + } + if (itemMaps.size() > 0) { + NCLocator.getInstance().lookup(IDefdocService.class).insertDefdocs(headvo.getPk_org(), createDefVO(itemMaps.stream() + .map(map -> (String) map.get("def3")) + .collect(Collectors.toList()), "zdy-023", headvo.getPk_org().toString())); + + createProjectHeadVO(itemMaps, headvo.getPk_org().toString()); + } + + if (itemMaps != null && itemMaps.size() > 0) { + for (Map item : itemMaps) { + GatheringBillItemVO itemvo = (GatheringBillItemVO) fromJsonToVO(item, GatheringBillItemVO.class); + + try { + HYPubBO hybo = new HYPubBO(); + itemvo.setRecaccount(headvo.getRecaccount()); + // pk_balatype 结算方式 表头带出 + itemvo.setPk_balatype(headvo.getPk_balatype()); + // 票据类型 checktype 结算方式:银行承兑汇票-电子、银行承兑汇票-纸质=银行承兑汇票;商业承兑汇票-电子、商业承兑汇票-纸质=商业承兑汇票 + String checktypeName = ""; + if ("银行承兑汇票-电子".equals(balatypeName)) { + checktypeName = "电子银行承兑汇票"; + } else if ("商业承兑汇票-电子".equals(balatypeName)) { + checktypeName = "电子商业承兑汇票"; + } else if ("商业承兑汇票-纸质".equals(balatypeName)) { + checktypeName = "商业承兑汇票"; + } else if ("银行承兑汇票-纸质".equals(balatypeName)) { + checktypeName = "银行承兑汇票"; + } + + if (checktypeName != "") { + Object checktypeCode = hybo.findColValue("bd_notetype", "code", + " name = '" + checktypeName + "' "); + itemvo.setChecktype(checktypeCode.toString()); + } + + // objtype 往来对象0-客户 2-部门 3-业务员 表头带出 + itemvo.setObjtype(headvo.getObjtype()); + // supplier 客户编码 表头带出 +// itemvo.setCustomer(headvo.getCustomer()); + // pk_dept 部门编码 表头带出 + itemvo.setPk_deptid(headvo.getPk_deptid()); + // pk_psndoc 业务员编码 表头带出 + itemvo.setPk_psndoc(headvo.getPk_psndoc()); + // pk_currtype 币种编码 表头带出 + itemvo.setPk_currtype(headvo.getPk_currtype()); + // prepay 收款性质 默认应收款 0 + itemvo.setPrepay(0); + // + UFDouble money_cr = itemvo.getMoney_cr(); + UFDouble local_tax_cr = money_cr.multiply(ntaxrate).div(100); + itemvo.setLocal_tax_cr(local_tax_cr); + // + UFDouble notax_cr = money_cr.sub(local_tax_cr); + itemvo.setNotax_cr(notax_cr); + // zhangxinah增加组织本币无税金额(贷方) + itemvo.setLocal_notax_cr(notax_cr); + // 汇率为空时,默认为1 + if (headvo.getRate() == null) { + itemvo.setRate(UFDouble.ONE_DBL); + } else { + itemvo.setRate(headvo.getRate()); + } + // + itemvo.setTaxcodeid(ctaxcode); + // + itemvo.setTaxrate(ntaxrate); + // 收支项目 + itemvo.setPk_subjcode("201"); + money = money.add(itemvo.getMoney_cr()); + itemvo.setLocal_money_cr( + itemvo.getMoney_cr().multiply(itemvo.getRate()).setScale(2, UFDouble.ROUND_HALF_UP)); + Object def2 = itemvo.getDef2(); + if (def2 != null) + itemvo.setDef2(hybo.findColValue("bd_defdoc", "pk_defdoc", " code = '" + def2 + "' ") + ""); + Object def3 = itemvo.getDef3(); + if (def3 != null) + itemvo.setDef3(hybo.findColValue("bd_defdoc", "pk_defdoc", " code = '" + def3 + "' ") + ""); + Object def6 = itemvo.getDef6(); + if (def6 != null) + itemvo.setDef6(hybo.findColValue("bd_defdoc", "pk_defdoc", " code = '" + def6 + "' ") + ""); +// 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, +// "vbillcode='" + def2 + "' and dr=0"); +// if (hvo == null || hvo.length == 0) { +// throw new BusinessException("该销售订单在ERP中被删除,订单号:" + def2); +// } +// SaleOrderBVO[] bvos = (SaleOrderBVO[]) dmo.queryByWhereClause(SaleOrderBVO.class, +// "csaleorderid='" + hvo[0].getPrimaryKey() + "'"); +// if (bvos != null) { +// itemvo.setSrc_billid(bvos[0].getCsaleorderid()); +// itemvo.setSrc_itemid(bvos[0].getCsaleorderbid()); +// itemvo.setSrc_billtype("30"); +// itemvo.setSrc_tradetype(hvo[0].getVtrantypecode()); +// itemvo.setTop_billid(bvos[0].getCsaleorderid()); +// itemvo.setTop_itemid(bvos[0].getCsaleorderbid()); +// itemvo.setTop_billtype("30"); +// } + + } catch (Exception e) { + return ResultMessageUtil.exceptionToJSON(e); + } + + itemvos.add(itemvo); + } + } + + headvo.setMoney(money); + headvo.setGloballocal(money); + // headvo.setRate(new UFDouble(1)); + headvo.setLocal_money(money.multiply(headvo.getRate()).setScale(2, UFDouble.ROUND_HALF_UP)); + AggGatheringBillVO bill = new AggGatheringBillVO(); + bill.setParentVO(headvo); + bill.setChildrenVO((CircularlyAccessibleValueObject[]) itemvos.toArray(new GatheringBillItemVO[0])); + try { + Map returnMap = ((IGatheringbillOpenService) NCLocator.getInstance() + .lookup(IGatheringbillOpenService.class)).saveBill(bill); + JSONString resultJson = ResultMessageUtil.toJSON(returnMap); + // 保存后动作 + JSONObject js_result = JSON.parseObject(resultJson.toJSONString()); + if (js_result.containsKey("success")) { + if (js_result.getString("success").equals("true")) { + if (js_result.containsKey("data")) { + JSONObject js_data = js_result.getJSONObject("data"); + String pk_gatherid = js_data.getString("pk_bill"); + String pk_org = js_data.getString("pk_org"); + GatheringBillItemVO[] billItemVOs = (GatheringBillItemVO[]) bill.getChildrenVO(); + for (GatheringBillItemVO gatheringBillItemVO : billItemVOs) { +// afterChangeMny(gatheringBillItemVO.getSrc_billid(), pk_org, billItemVOs[0].getDef6(), +// pk_gatherid); + } + } + } + } + return resultJson; + } catch (BusinessException e) { + return ResultMessageUtil.exceptionToJSON(e); + } + } + private DefdocVO[] createDefVO(List newhth, String defdoclistcode, String pk_org) throws BusinessException { + String sql = " select pk_defdoclist from bd_defdoclist where code='" + defdoclistcode + "' "; + + BaseDAO dao = new BaseDAO(); + String o = (String) dao.executeQuery(sql, new ColumnProcessor()); + HYPubBO hybo = new HYPubBO(); + + ArrayList arrvo = new ArrayList(); + for (int i = 0; i < newhth.size(); i++) { + + Object pk_defdoc = hybo.findColValue("bd_defdoc", "pk_defdoc", " code = '" + newhth.get(i) + "' "); + if (pk_defdoc != null) { + continue; + } + DefdocVO vo = new DefdocVO(); + vo.setEnablestate(2); + vo.setPk_defdoclist(o); + vo.setPk_org(pk_org); + vo.setCode(newhth.get(i)); + vo.setName(newhth.get(i)); + vo.setDataoriginflag(0); + vo.setDr(0); + vo.setPk_group(InvocationInfoProxy.getInstance().getGroupId()); + vo.setCreator(InvocationInfoProxy.getInstance().getUserId()); + vo.setCreationtime(new UFDateTime()); + + arrvo.add(vo); + } + + return arrvo.toArray(new DefdocVO[arrvo.size()]); + + } + private ProjectHeadVO[] createProjectHeadVO(List> newhth,String pk_org) throws BusinessException { + HYPubBO hybo = new HYPubBO(); + ArrayList arrvo = new ArrayList(); + for (int i = 0; i < newhth.size(); i++) { + Object pk_project = hybo.findColValue("bd_project", "pk_project", " PROJECT_CODE = '" + (String) newhth.get(i).get("def6") + "' "); + if (pk_project != null) { + continue; + } + ProjectHeadVO vo = new ProjectHeadVO(); + 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.setDr(0); + vo.setPk_group(InvocationInfoProxy.getInstance().getGroupId()); + vo.setCreator(InvocationInfoProxy.getInstance().getUserId()); + vo.setCreationtime(new UFDateTime()); + NCLocator.getInstance().lookup(IProjectServiceForPu.class).insertProject(vo); + + } + + return arrvo.toArray(new ProjectHeadVO[arrvo.size()]); + + } } diff --git a/cmp/src/client/nccloud/web/cmp/informer/informer/action/myBtnClickAction.java b/cmp/src/client/nccloud/web/cmp/informer/informer/action/myBtnClickAction.java index 1fab4c7..1fea126 100644 --- a/cmp/src/client/nccloud/web/cmp/informer/informer/action/myBtnClickAction.java +++ b/cmp/src/client/nccloud/web/cmp/informer/informer/action/myBtnClickAction.java @@ -62,7 +62,7 @@ public class myBtnClickAction extends InformerAction implements ICommonAction { JSONArray jsonArray = (JSONArray) maps.get("pks"); ArrayList pks = new ArrayList<>(Arrays.asList(jsonArray.toArray())); -// 使用 String.join 进行字符串拼接 + // 使用 String.join 进行字符串拼接 String result = ""; StringBuilder sb = new StringBuilder(); if (pks.size() > 1) { @@ -78,10 +78,10 @@ public class myBtnClickAction extends InformerAction implements ICommonAction { result = "'" + (String) pks.get(0) + "'"; } - System.out.println(result); + Logger.error(result); // 解析JSON数据为JSONObject对象 // 从JSON对象中提取账单编号 - System.out.println(json); + Logger.error(json); String urlpath; String appKey; String appSecret; @@ -125,7 +125,7 @@ public class myBtnClickAction extends InformerAction implements ICommonAction { return resultMap; } long timestampMillis = System.currentTimeMillis(); - System.out.println("当前时间戳(毫秒):" + timestampMillis); + Logger.error("当前时间戳(毫秒):" + timestampMillis); String dai = "appKey" + appKey + "timestamp" + timestampMillis; String signature = calculateHmacSHA256(dai, appSecret); SSLUtilities sas = new SSLUtilities(); @@ -149,14 +149,13 @@ public class myBtnClickAction extends InformerAction implements ICommonAction { response.append(inputLine); } - System.out.println(response); - System.out.println(response); + Logger.error(response); String jsonString = response.toString(); Map map = JSON.parseObject(jsonString, Map.class); - System.out.println(map); + Logger.error("jsonString = " + jsonString); - System.out.println(url); + Logger.error("url = " + url); // 获取当前年份 String sql = " select bz.code as nzcode,jstype.code as pk_balatype,ban.code bancode,ban.name as banname,bankname,bank.accnum as accnum,infodate,CASE direction " + @@ -165,7 +164,7 @@ public class myBtnClickAction extends InformerAction implements ICommonAction { "ELSE '不存在' " + "END as direction, 'CNY' as currencyCode,moneyy , bant.code as dfcode,bant.name as dfname,oppbankaccount,bankt.accnum dfaccnum " + ",pk_oppunit,org.code as orgcode,org.name as orgname,cmp.pk_informer " + - ",cmp.memo,cmp.transerial,df.name as ksmc,df.code as ksbm,cmp.note_no,vdef1,cmp.oppunitname " + + ",cmp.memo,cmp.transerial,df.name as ksmc,df.code as ksbm,cmp.note_no,vdef1,cmp.oppunitname, cmp.bankrelated_code " + "from cmp_informer cmp " + "left join bd_bankaccbas bank on cmp.pk_bankacc=bank.pk_bankaccbas " + "left join bd_bankdoc ban on cmp.pk_bank=ban.pk_bankdoc " + @@ -233,6 +232,7 @@ public class myBtnClickAction extends InformerAction implements ICommonAction { vmao.put("paymentMethod", "10"); } vmao.put("sourceId", row.get("pk_informer")); + vmao.put("bankrelated_code", row.get("bankrelated_code")); lists.add(vmao); } @@ -312,10 +312,7 @@ public class myBtnClickAction extends InformerAction implements ICommonAction { public static Map httpFW(String urlString, String jsonInputString) { -// String jsonInputString = "{\"key\": \"中文\"}"; // 你的 JSON 数据 -// String urlString = "http://example.com/api"; // 替换为你的 URL - System.out.println("请求值"); - System.out.println(jsonInputString); + Logger.error("请求值 = " + jsonInputString); try { URL url = new URL(urlString); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); diff --git a/ic/src/public/nccloud/resources/ic/ic/saleout/saveBeforeCheck.java b/ic/src/public/nccloud/resources/ic/ic/saleout/saveBeforeCheck.java index 7e33cda..55cecdc 100644 --- a/ic/src/public/nccloud/resources/ic/ic/saleout/saveBeforeCheck.java +++ b/ic/src/public/nccloud/resources/ic/ic/saleout/saveBeforeCheck.java @@ -26,6 +26,7 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.HashMap; import java.util.Map; +import java.util.Set; /** @@ -66,12 +67,13 @@ public class saveBeforeCheck implements IBusinessListener { return; } // 销售发票表头pk_billtypecode=30-Cxx-12 - if (valMap.get("pk_billtypecode").equals("30-Cxx-12") - || valMap.get("pk_billtypecode").equals("30-Cxx-02") - || valMap.get("pk_billtypecode").equals("30-Cxx-08") - || valMap.get("pk_billtypecode").equals("30-Cxx-13")) { + Set billTypeCodes = Set.of( + "30-Cxx-12", "30-Cxx-02", "30-Cxx-08", "30-Cxx-13", "30-Cxx-16" + ); + if (billTypeCodes.contains(valMap.get("pk_billtypecode"))) { return; } + // 销售发票表头vdef21=是 if (valMap.get("vdef20") == null || !valMap.get("vdef20").equals("Y")) { throw new BusinessException("销售出库单明细" + (i + 1) + ",销售发票验证不通过,无法保存!"); diff --git a/mmpac/src/private/nc/bs/mmpac/pickm/bp/rule/AfterApproveRuleSyncRZWMS.java b/mmpac/src/private/nc/bs/mmpac/pickm/bp/rule/AfterApproveRuleSyncRZWMS.java index e01fdf4..c316653 100644 --- a/mmpac/src/private/nc/bs/mmpac/pickm/bp/rule/AfterApproveRuleSyncRZWMS.java +++ b/mmpac/src/private/nc/bs/mmpac/pickm/bp/rule/AfterApproveRuleSyncRZWMS.java @@ -79,7 +79,7 @@ public class AfterApproveRuleSyncRZWMS implements IRule { //bomlx int BOM类型 必填 默认=0,即传入生产BOM(1为包装BOM)。 singleObj.put("bomlx", 0); - singleObj.put("dwyl", body.getNplanoutastnum().getDouble()); // 单位用量 + singleObj.put("dwyl", body.getNunituseastnum().getDouble()); // 单位用量 singleObj.put("djyl", body.getNplanoutastnum().getDouble()); // 单据用量 singleObj.put("clyl", body.getNplanoutastnum().getDouble()); // 材料用量 diff --git a/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/rule/AfterApproveRuleSyncMes.java b/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/rule/AfterApproveRuleSyncMes.java index 6ca5fdb..a22d28a 100644 --- a/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/rule/AfterApproveRuleSyncMes.java +++ b/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/rule/AfterApproveRuleSyncMes.java @@ -72,8 +72,10 @@ public class AfterApproveRuleSyncMes implements IRule { for (PMOItemVO item : bodys) { obmlog.debug("处理生产订单行 " + item.getVrowno()); obmlog.debug(item); - if (item.getVparentbillid() == null || item.getVparentbillid().equals("~")) { + if (!item.getVsrctype().equals("55A2")) { syncOrderItemToMes(head, item); + }else { + obmlog.warn("生产订单 " + head.getVbillcode() + " 行 " + item.getVrowno() + " 跳过同步:不是成品"); } } } diff --git a/obm/META-INF/.gitkeep b/obm/META-INF/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/obm/METADATA/.gitkeep b/obm/METADATA/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/obm/component.xml b/obm/component.xml new file mode 100644 index 0000000..ecf7745 --- /dev/null +++ b/obm/component.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/obm/resources/.gitkeep b/obm/resources/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/obm/script/.gitkeep b/obm/script/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/obm/src/client/.gitkeep b/obm/src/client/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/obm/src/private/nc/impl/obm/ebank/ObmEbankNccServiceImpl.java b/obm/src/private/nc/impl/obm/ebank/ObmEbankNccServiceImpl.java new file mode 100644 index 0000000..81caaf1 --- /dev/null +++ b/obm/src/private/nc/impl/obm/ebank/ObmEbankNccServiceImpl.java @@ -0,0 +1,654 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nc.impl.obm.ebank; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import nc.bs.dao.BaseDAO; +import nc.bs.framework.common.NCLocator; +import nc.bs.sec.esapi.NCESAPI; +import nc.bs.trade.business.HYPubBO; +import nc.itf.obm.IEbankbillinfoqueryMaintain; +import nc.itf.obm.IEbankdatadownloadMaintain; +import nc.itf.obm.IObmEvent; +import nc.itf.obm.PayStateVO; +import nc.itf.obm.ebank.IObmEbankNccService; +import nc.itf.obm.ebankecd.IEbankEcdService; +import nc.itf.uap.IUAPQueryBS; +import nc.jdbc.framework.SQLParameter; +import nc.jdbc.framework.processor.ArrayListProcessor; +import nc.md.persist.framework.IMDPersistenceQueryService; +import nc.md.persist.framework.MDPersistenceService; +import nc.vo.bd.currtype.CurrtypeVO; +import nc.vo.obm.ebankbillinfo.BillInfoQueryVO; +import nc.vo.obm.ebankbillinfoquery.AggEbankBillInfoQueryVO; +import nc.vo.obm.ebankbillinfoquery.EbankBillInfoQueryVO; +import nc.vo.obm.ebankdzd.DzdQueryInfoVO; +import nc.vo.obm.ebankdzd.EbankDzdVO; +import nc.vo.obm.ebankecd.EbankEcdVO; +import nc.vo.obm.log.ObmLog; +import nc.vo.obm.payroll.DfgzBVO; +import nc.vo.obm.payroll.DfgzBillVO; +import nc.vo.obm.payroll.DfgzHVO; +import nc.vo.obm.payroll.DfgzQueryCardInfoVO; +import nc.vo.obm.payroll.DfgzQueryInfoVO; +import nc.vo.obm.sql.StrWhereSqlUtils; +import nc.vo.org.OrgVO; +import nc.vo.pub.AggregatedValueObject; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFBoolean; +import nc.vo.pub.lang.UFDate; +import nc.vo.pub.lang.UFDateTime; +import nc.vo.pub.lang.UFDouble; +import nc.vo.tmpub.security.DefCommonClientSignForNCC; +import nc.vo.tmpub.security.SignAttributeNameVO; +import nc.vo.tmpub.util.SqlUtil; +import nccloud.commons.collections.CollectionUtils; +import nccloud.dto.obm.ebankbillinfo.vo.BillInfoDownloadVO; +import org.apache.commons.lang3.ArrayUtils; + +public class ObmEbankNccServiceImpl implements IObmEbankNccService { + private BaseDAO dao = null; + + public ObmEbankNccServiceImpl() { + } + + public boolean executeSql(String strSql) throws BusinessException { + if (this.dao == null) { + this.dao = new BaseDAO(); + } + + this.dao.executeUpdate(strSql); + return true; + } + + public boolean executeSql(String strSql, String[] values) throws BusinessException { + if (this.dao == null) { + this.dao = new BaseDAO(); + } + + SQLParameter params = new SQLParameter(); + + for(int i = 0; i < values.length; ++i) { + params.addParam(values[i]); + } + + this.dao.executeUpdate(strSql, params); + return true; + } + + public String[][] getData(String sqlStr) { + String[][] dataAray = null; + + try { + IUAPQueryBS query = (IUAPQueryBS)NCLocator.getInstance().lookup(IUAPQueryBS.class); + new ArrayList(); + ArrayListProcessor processor = new ArrayListProcessor(); + List rsList = (List)query.executeQuery(sqlStr, processor); + if (rsList.size() != 0) { + int lenrow = rsList.size(); + Object[] firstrow = rsList.get(0); + int lencol = firstrow.length; + dataAray = new String[lenrow][lencol]; + + for(int i = 0; i < lenrow; ++i) { + Object[] objs = rsList.get(i); + + for(int j = 0; j < lencol; ++j) { + if (null != objs[j]) { + dataAray[i][j] = objs[j].toString(); + } + } + } + } + } catch (Exception var12) { + } + + return dataAray; + } + + public EbankDzdVO[] queryByPks(String[] pks) throws BusinessException { + String var10000 = StrWhereSqlUtils.getInStr("pk_ebank_dzd", pks, new boolean[]{false}); + String strWhere = "isnull(dr,0)=0 and " + var10000; + HYPubBO hy = new HYPubBO(); + EbankDzdVO[] dzdvos = (EbankDzdVO[])hy.queryByCondition(EbankDzdVO.class, strWhere); + return dzdvos != null && dzdvos.length == 0 ? null : dzdvos; + } + + public EbankDzdVO[] queryEbankDzdByCondition(DzdQueryInfoVO info) throws BusinessException { + String var10000 = info.getBegdate(); + String strWhere = "isnull(dr,0)=0 and styleflag='A' and trans_date>='" + var10000 + "' and trans_date<='" + info.getEnddate() + "'"; + if (info.getCuracc() != null) { + strWhere = strWhere + " and curacc in (select accnum from bd_bankaccsub where " + SqlUtil.buildSqlForIn("pk_bankaccsub", info.getCuracc()) + ") "; + } + + if (!ArrayUtils.isEmpty(info.getOppacc())) { + strWhere = strWhere + " and oppacc ='" + NCESAPI.sqlEncode(info.getOppacc()[0]) + "' "; + } + + if (info.getC_ccynbr() != null) { + strWhere = strWhere + " and c_ccynbr ='" + info.getC_ccynbr() + "' "; + } + + if (info.getDbtrsamtlow() != null) { + strWhere = strWhere + " and ((curacc=dbtacc and trsamt >='" + info.getDbtrsamtlow() + "') or (curacc=crtacc and trsamt >='" + info.getCrtrsamtlow() + "'))"; + } + + if (info.getDbtrsamtup() != null) { + strWhere = strWhere + " and ((curacc=dbtacc and trsamt <='" + info.getDbtrsamtup() + "') or (curacc=crtacc and trsamt <='" + info.getCrtrsamtup() + "'))"; + } + + if (info.getTxseqid() != null) { + strWhere = strWhere + " and txseqid ='" + info.getTxseqid() + "' "; + } + + strWhere = strWhere + " and styleflag ='A' "; + HYPubBO hy = new HYPubBO(); + EbankDzdVO[] dzdvos = (EbankDzdVO[])hy.queryByCondition(EbankDzdVO.class, strWhere); + return dzdvos != null && dzdvos.length == 0 ? null : dzdvos; + } + + public DfgzBillVO[] queryEbankDfgzCardByCondition(DfgzQueryCardInfoVO info) throws BusinessException { + String[] pks = new String[1]; + pks[0] = info.getPk(); + String sqlWhere = StrWhereSqlUtils.getInStr("pk_dfgz", pks, new boolean[]{false}); + Collection result = ((IMDPersistenceQueryService)NCLocator.getInstance().lookup(IMDPersistenceQueryService.class)).queryBillOfVOByCond(DfgzBillVO.class, sqlWhere, true, false); + DfgzBillVO[] vos = CollectionUtils.isEmpty(result) ? new DfgzBillVO[0] : (DfgzBillVO[])result.toArray(new DfgzBillVO[0]); + return vos; + } + + public DfgzHVO[] queryEbankDfgzCardByPks(String[] pks) throws BusinessException { + String sqlWhere = StrWhereSqlUtils.getInStr("pk_dfgz", pks, new boolean[]{false}); + Collection result = ((IMDPersistenceQueryService)NCLocator.getInstance().lookup(IMDPersistenceQueryService.class)).queryBillOfVOByCond(DfgzHVO.class, sqlWhere, true, false); + DfgzBillVO[] billvos = CollectionUtils.isEmpty(result) ? new DfgzBillVO[0] : (DfgzBillVO[])result.toArray(new DfgzBillVO[0]); + if (billvos != null && billvos.length != 0) { + DfgzHVO[] vos = new DfgzHVO[billvos.length]; + + for(int i = 0; i < billvos.length; ++i) { + vos[i] = billvos[i].getParentVO(); + } + + return vos; + } else { + return null; + } + } + + public String getPkGroupByOrg(String pk_org) throws Exception { + HYPubBO hy = new HYPubBO(); + OrgVO orgvo = (OrgVO)hy.queryByPrimaryKey(OrgVO.class, pk_org); + String pk_group = orgvo.getPk_group(); + return pk_group; + } + + public String getPkCurrtypeByOrg(String pk_org) throws Exception { + HYPubBO hy = new HYPubBO(); + OrgVO orgvo = (OrgVO)hy.queryByPrimaryKey(OrgVO.class, pk_org); + String pk_currtype = orgvo.getPk_currtype(); + return pk_currtype; + } + + public DfgzHVO[] queryEbankDfgzByCondition(DfgzQueryInfoVO info) throws BusinessException { + String strWhere = "isnull(dr,0)=0 "; + if (info.getPk_org() != null) { + strWhere = strWhere + " and " + SqlUtil.buildSqlForIn("pk_org", info.getPk_org()); + } + + if (info.getPk_banktype() != null) { + strWhere = strWhere + " and " + SqlUtil.buildSqlForIn("pk_banktype", info.getPk_banktype()); + } + + if (info.getDbtacc() != null) { + strWhere = strWhere + " and dbtacc ='" + info.getDbtacc() + "' "; + } + + if (info.getBegdate() != null) { + strWhere = strWhere + " and billmakedate >='" + info.getBegdate() + "' "; + } + + if (info.getEnddate() != null) { + strWhere = strWhere + " and billmakedate<='" + info.getEnddate() + "' "; + } + + if (info.getPaytotalnumlow() != null) { + strWhere = strWhere + " and paytotalnum >='" + info.getPaytotalnumlow() + "' "; + } + + if (info.getPaytotalnumup() != null) { + strWhere = strWhere + " and paytotalnum <='" + info.getPaytotalnumup() + "' "; + } + + strWhere = strWhere + " and logflag=0"; + HYPubBO hy = new HYPubBO(); + DfgzHVO[] dfgzvos = (DfgzHVO[])hy.queryByCondition(DfgzHVO.class, strWhere); + return dfgzvos; + } + + public void dfgzApproveSignWithClient(String pk_user, DfgzBillVO[] aggDfgzVOs) throws Exception { + String constructClassName = "nc.vo.obm.payroll.DfgzBillEncryptVO"; + SignAttributeNameVO signAttributeNameVO = new SignAttributeNameVO(); + signAttributeNameVO.setParentAttributeName("encryptkey"); + DefCommonClientSignForNCC signner = new DefCommonClientSignForNCC(pk_user, constructClassName, signAttributeNameVO); + if (aggDfgzVOs != null && aggDfgzVOs.length > 0) { + for(int i = 0; i < aggDfgzVOs.length; ++i) { + this.trimDfgzBVO(aggDfgzVOs[i]); + signner.signWithClient(new AggregatedValueObject[]{aggDfgzVOs[i]}); + } + } + + } + + private void trimDfgzBVO(DfgzBillVO dfgzBillVO) { + DfgzBVO[] dfgzBVOs = (DfgzBVO[])dfgzBillVO.getChildrenVO(); + + for(DfgzBVO dfgzBVO : dfgzBVOs) { + if (dfgzBVO.getCrtidet() != null) { + dfgzBVO.setCrtidet(dfgzBVO.getCrtidet().trim()); + } + + if (dfgzBVO.getPersonname() != null) { + dfgzBVO.setPersonname(dfgzBVO.getPersonname().trim()); + } + + if (dfgzBVO.getIdentitynum() != null) { + dfgzBVO.setIdentitynum(dfgzBVO.getIdentitynum().trim()); + } + + if (dfgzBVO.getCrtacc() != null) { + dfgzBVO.setCrtacc(dfgzBVO.getCrtacc().trim()); + } + + if (dfgzBVO.getCrtaccname() != null) { + dfgzBVO.setCrtaccname(dfgzBVO.getCrtaccname().trim()); + } + + if (dfgzBVO.getBusnar() != null) { + dfgzBVO.setBusnar(dfgzBVO.getBusnar().trim()); + } + + if (dfgzBVO.getNusage() != null) { + dfgzBVO.setNusage(dfgzBVO.getNusage().trim()); + } + + if (dfgzBVO.getCrtbankname() != null) { + dfgzBVO.setCrtbankname(dfgzBVO.getCrtbankname().trim()); + } + } + + } + + private IMDPersistenceQueryService getMDQueryService() { + return MDPersistenceService.lookupPersistenceQueryService(); + } + + public Collection queryEbankDfgzByCondtion(String whereSQLOnly) throws BusinessException { + if (whereSQLOnly == null) { + whereSQLOnly = "1=1"; + } + + Collection results = null; + results = this.getMDQueryService().queryBillOfVOByCond(DfgzBillVO.class, whereSQLOnly, true, false); + return results; + } + + public EbankBillInfoQueryVO[] queryEbankBillInfoByPks(String[] pks) throws BusinessException { + String strWhere = "isnull(dr,0)=0 and " + SqlUtil.buildSqlForIn("pk_ebankbillinfoquery", pks); + HYPubBO hy = new HYPubBO(); + EbankBillInfoQueryVO[] billinfovos = (EbankBillInfoQueryVO[])hy.queryByCondition(EbankBillInfoQueryVO.class, strWhere); + return billinfovos != null && billinfovos.length == 0 ? null : billinfovos; + } + + public EbankBillInfoQueryVO[] queryEbankBillInfoByCondition(BillInfoQueryVO info) throws BusinessException { + String strWhere = "isnull(dr,0)=0 "; + if (info.getBegdate() != null) { + strWhere = strWhere + " and tradedate>='" + info.getBegdate() + "'"; + } + + if (info.getEnddate() != null) { + strWhere = strWhere + " and tradedate<='" + info.getEnddate() + "'"; + } + + if (info.getPk_org() != null) { + strWhere = strWhere + " and pk_org ='" + info.getPk_org() + "'"; + } + + if (info.getBanktype() != null) { + strWhere = strWhere + " and pk_banktype ='" + info.getBanktype() + "'"; + } + + if (info.getCuracc() != null) { + strWhere = strWhere + " and (account in (select accnum from bd_bankaccsub where pk_bankaccsub='" + info.getCuracc() + "') or payorgbankaccount in (select accnum from bd_bankaccsub where pk_bankaccsub='" + info.getCuracc() + "') )"; + } + + HYPubBO hy = new HYPubBO(); + EbankBillInfoQueryVO[] billinfovos = (EbankBillInfoQueryVO[])hy.queryByCondition(EbankBillInfoQueryVO.class, strWhere); + return billinfovos != null && billinfovos.length == 0 ? null : billinfovos; + } + + public EbankBillInfoQueryVO[] downloadEbankBillInfo(BillInfoDownloadVO info) throws Exception { + EbankEcdVO[] ecdvos = this.getEcdVOs(info); + IEbankEcdService ecdinfo = (IEbankEcdService)NCLocator.getInstance().lookup(IEbankEcdService.class); + EbankEcdVO[] recdvos = ecdinfo.queryEcdBillStatus(ecdvos); + AggEbankBillInfoQueryVO[] resultvos = this.getEcdBillInfoVOs(recdvos, info); + int len1 = 0; + if (resultvos == null) { + return null; + } else { + len1 = resultvos.length; + IEbankdatadownloadMaintain ecdmaininfo = (IEbankdatadownloadMaintain)NCLocator.getInstance().lookup(IEbankdatadownloadMaintain.class); + String strSql = ""; + String strWhere = ""; + String[] pks = new String[len1]; + + for(int vos = 0; vos < len1; ++vos) { + pks[vos] = resultvos[vos].getParentVO().getEbillnum(); + } + + strWhere = SqlUtil.buildSqlForIn("ebillnum", pks); + strSql = "delete from ebank_billinfoquery where " + strWhere; + ecdmaininfo.executeSql(strSql); + if (resultvos != null && resultvos.length > 0) { + IEbankbillinfoqueryMaintain billinfoquery = (IEbankbillinfoqueryMaintain)NCLocator.getInstance().lookup(IEbankbillinfoqueryMaintain.class); + resultvos = billinfoquery.insert(resultvos, (AggEbankBillInfoQueryVO[])null); + } + + len1 = resultvos.length; + EbankBillInfoQueryVO[] vos = new EbankBillInfoQueryVO[len1]; + + for(int i = 0; i < len1; ++i) { + vos[i] = resultvos[i].getParentVO(); + } + + return vos; + } + } + + private AggEbankBillInfoQueryVO[] getEcdBillInfoVOs(EbankEcdVO[] ecdvos, BillInfoDownloadVO info) throws Exception { + CurrtypeVO[] currTypeVo = (CurrtypeVO[])(new HYPubBO()).queryByCondition(CurrtypeVO.class, " code='CNY'"); + String pk_currtype = ""; + if (currTypeVo != null) { + pk_currtype = currTypeVo[0].getPk_currtype(); + } else { + pk_currtype = "1002Z0100000000001K1"; + } + + String pk_org = info.getPk_org(); + String pk_banktype = info.getPk_banktype(); + String strSql = "select pk_group from org_orgs where pk_org = '" + pk_org + "'"; + String[][] dataArray = this.getData(strSql); + String pk_group = dataArray[0][0]; + int len1 = ecdvos.length; + List aggvolist = new ArrayList(); + + for(int i = 0; i < len1; ++i) { + if (ecdvos[i].getTranflag().equals("1")) { + EbankBillInfoQueryVO hvo = new EbankBillInfoQueryVO(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + hvo.setStatus(2); + hvo.setPk_group(pk_group); + hvo.setPk_org(pk_org); + hvo.setSrcgroup(pk_group); + hvo.setSrcorg(pk_org); + hvo.setPk_banktype(pk_banktype); + hvo.setEbillnum((String)ecdvos[i].getAttributeValue("bklistno1")); + if (ecdvos[i].getAttributeValue("billamt") != null) { + hvo.setBillmoney(new UFDouble(ecdvos[i].getAttributeValue("billamt").toString())); + } else if (ecdvos[i].getAttributeValue("bkamt3") != null) { + hvo.setBillmoney(new UFDouble(ecdvos[i].getAttributeValue("bkamt3").toString())); + } else if (ecdvos[i].getAttributeValue("bkamt4") != null) { + hvo.setBillmoney(new UFDouble(ecdvos[i].getAttributeValue("bkamt4").toString())); + } + + if (ecdvos[i].getAttributeValue("billopendate") != null) { + hvo.setTradedate(new UFDate(ecdvos[i].getAttributeValue("billopendate").toString())); + } else if (ecdvos[i].getAttributeValue("bk8date3") != null) { + hvo.setTradedate(new UFDate(ecdvos[i].getAttributeValue("bk8date3").toString())); + } + + String billState = ""; + if (ecdvos[i].getAttributeValue("billstate") != null) { + billState = ecdvos[i].getAttributeValue("billstate").toString(); + } else if (ecdvos[i].getAttributeValue("bkflag1") != null) { + billState = ecdvos[i].getAttributeValue("bkflag1").toString(); + } + + hvo.setBillstatus(billState); + if (ecdvos[i].getAttributeValue("billtype") != null) { + hvo.setDef1(ecdvos[i].getAttributeValue("billtype").toString()); + } + + if (ecdvos[i].getAttributeValue("billopenacc") != null) { + hvo.setPayorgbankaccount((String)ecdvos[i].getAttributeValue("billopenacc")); + } + + if (ecdvos[i].getAttributeValue("billopenname") != null) { + hvo.setPayorg((String)ecdvos[i].getAttributeValue("billopenname")); + } + + if (ecdvos[i].getAttributeValue("billopenbank") != null) { + hvo.setPaybank((String)ecdvos[i].getAttributeValue("billopenbank")); + } + + if (ecdvos[i].getAttributeValue("recaccname") != null) { + hvo.setGatheorg((String)ecdvos[i].getAttributeValue("recaccname")); + } + + if (ecdvos[i].getAttributeValue("recbankname") != null) { + hvo.setGatherbank((String)ecdvos[i].getAttributeValue("recbankname")); + } + + if (ecdvos[i].getAttributeValue("recbankno") != null) { + hvo.setGatherorgbank((String)ecdvos[i].getAttributeValue("recbankno")); + } + + if (ecdvos[i].getAttributeValue("recaccno") != null) { + hvo.setAccount((String)ecdvos[i].getAttributeValue("recaccno")); + } + + if (ecdvos[i].getAttributeValue("acceptaccno") != null) { + hvo.setDef3((String)ecdvos[i].getAttributeValue("acceptaccno")); + } + + if (ecdvos[i].getAttributeValue("acceptaccname") != null) { + hvo.setDef4((String)ecdvos[i].getAttributeValue("acceptaccname")); + } + + if (ecdvos[i].getAttributeValue("acceptbank") != null) { + hvo.setDef5((String)ecdvos[i].getAttributeValue("acceptbank")); + } + + if (ecdvos[i].getAttributeValue("acceptdate") != null) { + hvo.setDef2(sdf.format(((UFDate)ecdvos[i].getAttributeValue("acceptdate")).toDate())); + } + + if (ecdvos[i].getAttributeValue("endflag") != null) { + hvo.setDef5((String)ecdvos[i].getAttributeValue("endflag")); + } + + if (ecdvos[i].getAttributeValue("billduedate") != null) { + hvo.setOutdate(new UFDate(sdf.parse(ecdvos[i].getAttributeValue("billduedate").toString()))); + } else if (ecdvos[i].getAttributeValue("bk8date2") != null) { + hvo.setOutdate(new UFDate(sdf.parse(ecdvos[i].getAttributeValue("bk8date2").toString()))); + } + + if (ecdvos[i].getAttributeValue("billholdname") != null) { + hvo.setOutbillorg(ecdvos[i].getAttributeValue("billholdname").toString()); + } + + if (ecdvos[i].getAttributeValue("contractno") != null) { + hvo.setTradecontractdate((String)ecdvos[i].getAttributeValue("contractno")); + } + + if (ecdvos[i].getAttributeValue("acceptno") != null) { + hvo.setCdxynum((String)ecdvos[i].getAttributeValue("acceptno")); + } + + if (ecdvos[i].getAttributeValue("billsystype") != null) { + hvo.setBillsystype((String)ecdvos[i].getAttributeValue("billsystype")); + } + + if (ecdvos[i].getAttributeValue("ecdsstatus") != null) { + hvo.setEcdsstatus((String)ecdvos[i].getAttributeValue("ecdsstatus")); + } + + if (ecdvos[i].getAttributeValue("billrangestart") != null) { + hvo.setBillrangestart((String)ecdvos[i].getAttributeValue("billrangestart")); + } + + if (ecdvos[i].getAttributeValue("billrangeend") != null) { + hvo.setBillrangeend((String)ecdvos[i].getAttributeValue("billrangeend")); + } + + if (ecdvos[i].getAttributeValue("billrange") != null) { + hvo.setBillrange((String)ecdvos[i].getAttributeValue("billrange")); + } + + if (ecdvos[i].getAttributeValue("ifsepflow") != null && "CS02".equals(ecdvos[i].getAttributeValue("ifsepflow"))) { + hvo.setSubcontractcirculation(UFBoolean.TRUE); + } else { + hvo.setSubcontractcirculation(UFBoolean.FALSE); + } + + hvo.setAttributeValue("dr", 0); + hvo.setPk_currtype(pk_currtype); + hvo.setMaketime(new UFDateTime(new Date())); + hvo.setCreationtime(new UFDateTime(new Date())); + hvo.setApprovestatus(-1); + hvo.setDef10((String)ecdvos[i].getAttributeValue("reqreserved10")); + AggEbankBillInfoQueryVO aggvo = new AggEbankBillInfoQueryVO(); + aggvo.setParentVO(hvo); + aggvolist.add(aggvo); + } + } + + if (aggvolist.size() > 0) { + AggEbankBillInfoQueryVO[] aggvos = (AggEbankBillInfoQueryVO[])aggvolist.toArray(new AggEbankBillInfoQueryVO[0]); + return aggvos; + } else { + String errmsg = ""; + if (ecdvos.length > 0) { + errmsg = ecdvos[0].getErrmsg(); + throw new Exception(errmsg); + } else { + return null; + } + } + } + + private EbankEcdVO[] getEcdVOs(BillInfoDownloadVO qvo) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + EbankEcdVO[] ecdvos = new EbankEcdVO[1]; + + try { + String pk_banktype = qvo.getPk_banktype(); + String pk_org = qvo.getPk_org(); + String strSql = "select pk_group from org_orgs where pk_org = '" + pk_org + "'"; + String[][] dataArray = this.getData(strSql); + String pk_group = dataArray[0][0]; + String startdate = sdf.format(qvo.getBegindate().toDate()); + String enddate = sdf.format(qvo.getEnddate().toDate()); + String accno = qvo.getCuracc(); + strSql = "select accnum from bd_bankaccsub where pk_bankaccsub ='" + accno + "'"; + dataArray = this.getData(strSql); + accno = dataArray[0][0]; + EbankEcdVO ecdvo = new EbankEcdVO(); + ecdvo.setPk_banktype(pk_banktype); + ecdvo.setPk_group(pk_group); + ecdvo.setPk_org(pk_org); + ecdvo.setAccNo(accno); + ecdvo.setBk8Date1(startdate); + ecdvo.setBk8Date2(enddate); + ecdvo.setBeginDate(startdate); + ecdvo.setEndDate(enddate); + ecdvo.setDateType("1"); + ecdvo.setPk_srcbill(""); + ecdvo.setPk_srcbilltype(""); + ecdvo.setVsrcbillno(""); + if (qvo.getBilltype() != null && !qvo.getBilltype().equals("")) { + ecdvo.setBillType(qvo.getBilltype()); + } + + if (qvo.getSendertype() != null && !qvo.getSendertype().equals("")) { + ecdvo.setSendertype(qvo.getSendertype()); + } + + ecdvos[0] = ecdvo; + } catch (Exception ex) { + ObmLog.error(ex.getMessage(), ex, this.getClass(), "getEcdVOs"); + } + + return ecdvos; + } + + public DfgzHVO[] queryEbankDfgzByConditionString(String strWhere) throws BusinessException { + if (strWhere == null) { + strWhere = "1=1"; + } + + HYPubBO hy = new HYPubBO(); + DfgzHVO[] dfgzvos = (DfgzHVO[])hy.queryByCondition(DfgzHVO.class, strWhere); + return dfgzvos; + } + + public String getInParameter(AggEbankBillInfoQueryVO[] resultvos, String parameter) { + StringBuffer sb = new StringBuffer(); + String returnString = ""; + if (resultvos.length == 0 || null == resultvos) { + returnString = sb.append(parameter).append("=''").toString(); + } + + sb.append(parameter); + + for(int i = 0; i < resultvos.length; ++i) { + sb.append("'"); + sb.append(resultvos[i].getParentVO().getEbillnum()); + sb.append("'"); + if (i >= 900 && i < resultvos.length - 1) { + if (i % 900 == 0) { + sb.append(") or "); + sb.append(parameter); + } else { + sb.append(","); + } + } else if (i < resultvos.length - 1) { + sb.append(","); + } + + if (i == resultvos.length - 1) { + sb.append(")"); + } + } + + returnString = sb.toString(); + return returnString; + } + + public void dfgzFireEvent(String yurref) throws Exception { + HYPubBO hy = new HYPubBO(); + String strWhere = " isNull(dr,0)=0 and logflag='1' and yurref='" + yurref + "' "; + DfgzHVO[] dfgzbillvos = (DfgzHVO[])hy.queryByCondition(DfgzHVO.class, strWhere); + PayStateVO[] sourcevos = new PayStateVO[dfgzbillvos.length]; + String eventType = "paystate_syn"; + String action = "download"; + String fireposition = "after_cx"; + + for(int i = 0; i < sourcevos.length; ++i) { + sourcevos[i] = new PayStateVO(); + sourcevos[i].setAction(action); + sourcevos[i].setFireposition(fireposition); + sourcevos[i].setYurref(dfgzbillvos[i].getYurref()); + sourcevos[i].setPayState(dfgzbillvos[i].getBillpaystate() == null ? -1 : dfgzbillvos[i].getBillpaystate()); + sourcevos[i].setMsg(dfgzbillvos[i].getPaymsg()); + sourcevos[i].setPk_user(dfgzbillvos[i].getModifier()); + } + + IObmEvent event = (IObmEvent)NCLocator.getInstance().lookup(IObmEvent.class); + event.fireEvent("dfgz", eventType, sourcevos); + } +} diff --git a/obm/src/public/.gitkeep b/obm/src/public/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/pu/src/client/nccloud/web/pp/supplierprice/action/SaveAction.java b/pu/src/client/nccloud/web/pp/supplierprice/action/SaveAction.java new file mode 100644 index 0000000..58018c6 --- /dev/null +++ b/pu/src/client/nccloud/web/pp/supplierprice/action/SaveAction.java @@ -0,0 +1,126 @@ +package nccloud.web.pp.supplierprice.action; + +import java.util.ArrayList; +import java.util.List; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +import nc.bs.framework.common.InvocationInfoProxy; +import nc.itf.pp.supplierprice.ISupplierPriceService; +import nc.vo.bd.meta.BatchOperateVO; +import nc.vo.pp.supplierprice.entity.SupplierPriceVO; +import nc.vo.pub.BusinessException; +import nc.vo.pub.VOStatus; +import nc.vo.pub.lang.UFDateTime; +import nc.vo.pubapp.AppContext; +import nc.vo.scmpub.util.StringUtil; +import nccloud.framework.core.exception.ExceptionUtils; +import nccloud.framework.service.ServiceLocator; +import nccloud.framework.web.action.itf.ICommonAction; +import nccloud.framework.web.container.IRequest; +import nccloud.framework.web.ui.pattern.grid.Grid; +import nccloud.framework.web.ui.pattern.grid.GridOperator; + +/** + * 供应商价目表新增修改 + * + * @author ligangt + * @date 2018-4-17 + * @version v1.0 + */ +public class SaveAction implements ICommonAction { + + @Override + public Object doAction(IRequest request) { + try { + // 转换前台json + GridOperator operator = new GridOperator(); + SupplierPriceVO[] vos = operator.toVos(request); + + // 处理前台传过来的修改字段数组,用于保存时校验 + String updateKeysjson = operator.getOriginGrid().getUserjson(); + // 获取修改时有来源的供应商价目表除失效日期外的字段,理应为0,如果有值说明有错误操作 + int updateKeysNum = StringUtil.isSEmptyOrNull(updateKeysjson) ? 0 + : ((JSONArray) JSONObject.parse(updateKeysjson)).size(); + + List addList = new ArrayList(); + List updateList = new ArrayList(); + List deleteList = new ArrayList(); + List unchangedList = new ArrayList(); + // 区分新增和修改 + //zhangxinah增加制单人制单日期修改人修改日期 + String cuserid = InvocationInfoProxy.getInstance().getUserId(); + List orderKey = new ArrayList<>(); + if (vos != null) { + for (SupplierPriceVO vo : vos) { + if (VOStatus.NEW == vo.getStatus()) { + //制单人 + vo.setAttributeValue("vbdef17", cuserid); + //制单日期 + vo.setAttributeValue("vbdef18", new UFDateTime()); + addList.add(vo); + } else if (VOStatus.UPDATED == vo.getStatus()) { + //修改人 + vo.setAttributeValue("vbdef19", cuserid); + //修改日期 + vo.setAttributeValue("vbdef20", new UFDateTime()); + orderKey.add(vo.getPk_supplierprice()); + updateList.add(vo); + } else if (VOStatus.DELETED == vo.getStatus()) { + deleteList.add(vo); + } else { + unchangedList.add(vo); + orderKey.add(vo.getPk_supplierprice()); + } + } + } + // 调用接口保存 + ISupplierPriceService service = ServiceLocator.find(ISupplierPriceService.class); + BatchOperateVO batchVO = new BatchOperateVO(); + batchVO.setAddObjs(addList.toArray()); + batchVO.setUpdObjs(updateList.toArray()); + batchVO.setDelObjs(deleteList.toArray()); + BatchOperateVO resvo = service.batchSave(batchVO, updateKeysNum); + // 转换成前台dto + List voList = new ArrayList(); + + for (String key : orderKey) { + if (resvo.getUpdObjs() != null) { + for (Object obj : resvo.getUpdObjs()) { + SupplierPriceVO vo = (SupplierPriceVO) obj; + if (key.equals(vo.getPk_supplierprice())) { + voList.add(vo); + } + } + for (SupplierPriceVO vo : unchangedList) { + if (key.equals(vo.getPk_supplierprice())) { + voList.add(vo); + } + } + } + } + if (resvo.getAddObjs() != null) { + Object[] addObjs = resvo.getAddObjs(); + for (Object obj : addObjs) { + voList.add((SupplierPriceVO) obj); + } + // voList.addAll(Arrays.asList(resvo.getAddObjs())); + } + + vos = voList.toArray(new SupplierPriceVO[voList.size()]); + if (vos != null && vos.length > 0) { + Grid grid = operator.toGrid(vos); + SupplierPricePrecisionProcessor util = new SupplierPricePrecisionProcessor(); + util.process(grid); + return grid; + } + + } catch (BusinessException e) { + ExceptionUtils.wrapException(e); + } + + return null; + } + +} diff --git a/so/src/public/nccloud/api/so/so/salepc/saleUpdateLJpc.java b/so/src/public/nccloud/api/so/so/salepc/saleUpdateLJpc.java index c56f9bf..92a900a 100644 --- a/so/src/public/nccloud/api/so/so/salepc/saleUpdateLJpc.java +++ b/so/src/public/nccloud/api/so/so/salepc/saleUpdateLJpc.java @@ -121,7 +121,7 @@ public class saleUpdateLJpc extends AbstractNCCRestResource { int succState = executeUpdate(sqlStr); - if (succState == arrayList.size()) { + if (succState == (arrayList.size() * 2)) { returnJson.put("state", 'Y'); returnJson.put("msg", "成功,已修改" + succState + "行"); diff --git a/sscivm/src/public/.gitkeep b/sscivm/src/public/.gitkeep index e69de29..7922f79 100644 --- a/sscivm/src/public/.gitkeep +++ b/sscivm/src/public/.gitkeep @@ -0,0 +1 @@ +com.yonyou.ucf.mdf.contract.utils.NCCAPIUtils:銆怤CCAPIUtils.runAPI.json銆:{"ar_recaccount":"15518401040029139","def4":"530245203711120250430001825098","def2":"264000","rate":1,"billdate":"2025-04-30 00:00:00","pk_currtype":"CNY","ID":"2261704180311261190","pk_balatype":"02","items":[{"def3":"ZK25030040","scomment":"null","def4":"138200","def2":"ZKD03002625","FOREIGNERKEY":"2261704180311261190","checkno":"530245203711120250430001825098","def36":"D闈掑矝鐗归攼寰风數姘旇偂浠芥湁闄愬叕鍙革紙婵槼楦挎鼎锛","project":"ZKWEQ0303125","def37":"1001A11000000FGRFLOC","money_cr":"125800","def6":"ZKWEQ0303125","pk_recpaytype":"姝e父涓氬姟"},{"def3":"ZK25030041","scomment":"null","def4":"138200","def2":"ZKD03002525","FOREIGNERKEY":"2261704180311261190","checkno":"530245203711120250430001825098","def36":"D闈掑矝鐗归攼寰风數姘旇偂浠芥湁闄愬叕鍙革紙澶忓簞锛","project":"ZKWEQ0303025","def37":"1001A11000000FGRFQ6F","money_cr":"232000","def6":"ZKWEQ0303025","pk_recpaytype":"姝e父涓氬姟"}],"pk_org":"C033"} \ No newline at end of file