diff --git a/arap/src/private/nc/bs/arap/actions/GatheringbillEditSaveBatchBSAction.java b/arap/src/private/nc/bs/arap/actions/GatheringbillEditSaveBatchBSAction.java index 27127ea..5bf8ae8 100644 --- a/arap/src/private/nc/bs/arap/actions/GatheringbillEditSaveBatchBSAction.java +++ b/arap/src/private/nc/bs/arap/actions/GatheringbillEditSaveBatchBSAction.java @@ -31,6 +31,7 @@ public class GatheringbillEditSaveBatchBSAction extends BillUpdateBatchBSAction this.validatorCode.add(93); this.validatorCode.add(94); this.validatorCode.add(100); + this.validatorCode.remove(44); } protected void doBeforeUpdate(AggregatedValueObject[] bills, AggregatedValueObject[] orginBills) throws BusinessException { @@ -41,34 +42,34 @@ public class GatheringbillEditSaveBatchBSAction extends BillUpdateBatchBSAction } /** - * 收款单保存校验关联的销售订单实际收款金额是否超过价税合计 + * 鏀舵鍗曚繚瀛樻牎楠屽叧鑱旂殑閿鍞鍗曞疄闄呮敹娆鹃噾棰濇槸鍚﹁秴杩囦环绋庡悎璁 */ int i = 0; for(AggregatedValueObject bill : bills) { AggregatedValueObject oriBill = orginBills[i++]; - BaseBillVO billVO = (BaseBillVO) bill.getParentVO(); //修改的收款单 - BaseBillVO billOriVO = (BaseBillVO) oriBill.getParentVO(); //之前的收款单 - UFDouble money = billVO.getMoney(); //修改后的金额 - UFDouble oriMoney = billOriVO.getMoney(); //修改前的金额 + BaseBillVO billVO = (BaseBillVO) bill.getParentVO(); //淇敼鐨勬敹娆惧崟 + BaseBillVO billOriVO = (BaseBillVO) oriBill.getParentVO(); //涔嬪墠鐨勬敹娆惧崟 + UFDouble money = billVO.getMoney(); //淇敼鍚庣殑閲戦 + UFDouble oriMoney = billOriVO.getMoney(); //淇敼鍓嶇殑閲戦 String pk_tradetype = billVO.getPk_tradetype(); if(!"F2-Cxx-02".equals(pk_tradetype)){ continue; } - String def3 = billVO.getDef3(); //收款单对应的销售订单id + String def3 = billVO.getDef3(); //鏀舵鍗曞搴旂殑閿鍞鍗昳d if(StringUtil.isEmpty(def3) || "N".equals(def3) || "~".equals(def3)){ - //无绑定的销售订单则下一次循环 + //鏃犵粦瀹氱殑閿鍞鍗曞垯涓嬩竴娆″惊鐜 continue; } - //计算收款单金额差值 + //璁$畻鏀舵鍗曢噾棰濆樊鍊 UFDouble changeMoney = money.sub(oriMoney); - //根据销售订单id去查询销售订单 + //鏍规嵁閿鍞鍗昳d鍘绘煡璇㈤攢鍞鍗 BaseDAO dao = new BaseDAO(); String sql = "select nreceivedmny,ntotalorigmny from so_saleorder where dr = 0 and csaleorderid = '" +def3+"'"; Map saleMap = (Map)dao.executeQuery(sql, new MapProcessor()); - //销售订单价税合计 + //閿鍞鍗曚环绋庡悎璁 UFDouble ntotalorigmny = UFDouble.ZERO_DBL; - //销售订单实际收款金额 + //閿鍞鍗曞疄闄呮敹娆鹃噾棰 UFDouble nreceivedmny = UFDouble.ZERO_DBL; if(saleMap != null) { nreceivedmny = new UFDouble(saleMap.get("nreceivedmny") == null ? "0" : saleMap.get("nreceivedmny").toString()); @@ -76,7 +77,7 @@ public class GatheringbillEditSaveBatchBSAction extends BillUpdateBatchBSAction } UFDouble moreMoney = nreceivedmny.add(changeMoney).sub(ntotalorigmny); if(nreceivedmny.add(changeMoney).compareTo(ntotalorigmny) > 0){ - throw new BusinessException("【该笔收款已超销售订单"+ moreMoney +"元,无法传输!请检查订单累计收款金额!】"); + throw new BusinessException("銆愯绗旀敹娆惧凡瓒呴攢鍞鍗"+ moreMoney +"鍏冿紝鏃犳硶浼犺緭锛佽妫鏌ヨ鍗曠疮璁℃敹娆鹃噾棰濓紒銆"); } } diff --git a/arap/src/private/nc/bs/arap/actions/GatheringbillSaveBatchBSAction.java b/arap/src/private/nc/bs/arap/actions/GatheringbillSaveBatchBSAction.java index 0bb5e58..70c8334 100644 --- a/arap/src/private/nc/bs/arap/actions/GatheringbillSaveBatchBSAction.java +++ b/arap/src/private/nc/bs/arap/actions/GatheringbillSaveBatchBSAction.java @@ -30,7 +30,7 @@ public class GatheringbillSaveBatchBSAction extends BillInsertBatchBSAction { this.validatorCode.add(8); this.validatorCode.add(24); this.validatorCode.add(28); - this.validatorCode.add(44); +// this.validatorCode.add(44); this.validatorCode.add(46); this.validatorCode.add(31); this.validatorCode.add(36); @@ -59,29 +59,29 @@ public class GatheringbillSaveBatchBSAction extends BillInsertBatchBSAction { ArapBillVOUtils.setDefaultSettleFlag(bills); /** - * 收款单保存校验关联的销售订单实际收款金额是否超过价税合计 + * 鏀舵鍗曚繚瀛樻牎楠屽叧鑱旂殑閿鍞鍗曞疄闄呮敹娆鹃噾棰濇槸鍚﹁秴杩囦环绋庡悎璁 */ for(AggregatedValueObject bill : bills) { - BaseBillVO billVO = (BaseBillVO) bill.getParentVO(); //修改的收款单 - UFDouble money = billVO.getMoney(); //金额 + BaseBillVO billVO = (BaseBillVO) bill.getParentVO(); //淇敼鐨勬敹娆惧崟 + UFDouble money = billVO.getMoney(); //閲戦 String pk_tradetype = billVO.getPk_tradetype(); if(!"F2-Cxx-02".equals(pk_tradetype)){ continue; } - String def3 = billVO.getDef3(); //收款单对应的销售订单id + String def3 = billVO.getDef3(); //鏀舵鍗曞搴旂殑閿鍞鍗昳d if(StringUtil.isEmpty(def3) || "N".equals(def3) || "~".equals(def3)){ - //无绑定的销售订单则下一次循环 + //鏃犵粦瀹氱殑閿鍞鍗曞垯涓嬩竴娆″惊鐜 continue; } - //根据销售订单id去查询销售订单 + //鏍规嵁閿鍞鍗昳d鍘绘煡璇㈤攢鍞鍗 BaseDAO dao = new BaseDAO(); String sql = "select nreceivedmny,ntotalorigmny from so_saleorder where dr = 0 and csaleorderid = '" +def3+"'"; Map saleMap = (Map)dao.executeQuery(sql, new MapProcessor()); - //销售订单价税合计 + //閿鍞鍗曚环绋庡悎璁 UFDouble ntotalorigmny = UFDouble.ZERO_DBL; - //销售订单实际收款金额 + //閿鍞鍗曞疄闄呮敹娆鹃噾棰 UFDouble nreceivedmny = UFDouble.ZERO_DBL; if(saleMap != null) { nreceivedmny = new UFDouble(saleMap.get("nreceivedmny") == null ? "0" : saleMap.get("nreceivedmny").toString()); @@ -89,7 +89,7 @@ public class GatheringbillSaveBatchBSAction extends BillInsertBatchBSAction { } UFDouble moreMoney = nreceivedmny.add(money).sub(ntotalorigmny); if(nreceivedmny.add(money).compareTo(ntotalorigmny) > 0){ - throw new BusinessException("【该笔收款已超销售订单"+ moreMoney +"元,无法传输!请检查订单累计收款金额!】"); + throw new BusinessException("銆愯绗旀敹娆惧凡瓒呴攢鍞鍗"+ moreMoney +"鍏冿紝鏃犳硶浼犺緭锛佽妫鏌ヨ鍗曠疮璁℃敹娆鹃噾棰濓紒銆"); } } } diff --git a/gl/src/client/nccloud/web/gl/accountrep/action/AccountBalanceTotalQueryAction.java b/gl/src/client/nccloud/web/gl/accountrep/action/AccountBalanceTotalQueryAction.java new file mode 100644 index 0000000..202009d --- /dev/null +++ b/gl/src/client/nccloud/web/gl/accountrep/action/AccountBalanceTotalQueryAction.java @@ -0,0 +1,306 @@ +package nccloud.web.gl.accountrep.action; + +import nc.bs.logging.Logger; +import nc.vo.pub.BusinessException; +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.container.SessionContext; +import nccloud.framework.web.json.JsonFactory; +import nccloud.pubitf.gl.account.IAccountReportWebService; + +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class AccountBalanceTotalQueryAction implements ICommonAction { + public AccountBalanceTotalQueryAction() { + } + public Object doAction(IRequest request) { + String json = request.read(); + Logger.info("busiParam:" + json); + Map paraMap = (Map) JsonFactory.create().fromJson(json, Map.class); + this.setAppcode(paraMap); + + try { + return this.doQuery(getParaMap(paraMap)); + } catch (BusinessException e) { + ExceptionUtils.wrapException(e); + return null; + } + } + public Object doQuery(Map paraMap) throws BusinessException { + + // 科目余额表数据 + Map result = ((IAccountReportWebService) ServiceLocator.find(IAccountReportWebService.class)).queryAccBalance((Map) paraMap.get("second")); + // 科目辅助余额表数据 + Map result1 = ((IAccountReportWebService) ServiceLocator.find(IAccountReportWebService.class)).querySubjAssBalanceBooks((Map) paraMap.get("first")); + List> data = (List>) result.get("data"); + List> data1 = (List>) result1.get("data"); + + // 过滤掉 data1 中 assname 为空的数据 + data1 = data1.stream() + .filter(item -> item.get("assname") != null && !item.get("assname").toString().trim().isEmpty()) + .collect(Collectors.toList()); + + // 创建一个映射,根据 acccode 快速查找 data 中的元素 + Map> dataMap = data.stream() + .collect(Collectors.toMap(item -> (String) item.get("acccode"), item -> item)); + for (Map item : data) { + String endorint = (String) item.get("endorint"); + BigDecimal endlocamount = parseEndlocamount((String) item.get("endlocamount")) ; + if ("贷".equals(endorint)) { + item.put("endlocamount", endlocamount.negate()); + } + } + // 构造新的 Map,存储每个父级科目的期末余额之和 + Map sumMap = new HashMap<>(); + + // 构造新的列表 + List> mergedList = new ArrayList<>(); + DecimalFormat decimalFormat = new DecimalFormat("#,##0.00"); + List bigDecimals = new ArrayList<>(); + for (Map item : data1) { + Map linkMap = (Map) item.get("link"); + String acccode = (String) linkMap.get("acccode"); + + String accname = (String) item.get("accname"); + String parentAcccode = acccode; + Map parentItem = dataMap.get(parentAcccode); + + if (parentItem != null) { + String endlocamountStr = (String) item.get("endlocamount"); + String endorint = (String) item.get("endorint"); + BigDecimal endlocamount = parseEndlocamount(endlocamountStr); + // 构造新的 Map + Map newItem = new HashMap<>(); + newItem.put("endlocamount", decimalFormat.format(endlocamount)); + + // 根据 endorint 调整 endlocamount 的符号 + if ("贷".equals(endorint)) { + endlocamount = endlocamount.negate(); + } + bigDecimals.add(endlocamount); + // 更新 sumMap + sumMap.put(parentAcccode, sumMap.getOrDefault(parentAcccode, BigDecimal.ZERO).add(endlocamount)); + + newItem.put("pacccode", parentAcccode); + newItem.put("pendorint", parentItem.get("endorint")); + newItem.put("paccname", parentItem.get("accname")); + newItem.put("pendlocamount", parentItem.get("endlocamount")); + newItem.put("acccode", acccode); + newItem.put("accname", accname); // 假设 data1 中没有 accname,使用父级的 accname + newItem.put("assname", item.get("assname")); + newItem.put("endorint", item.get("endorint")); +// newItem.put("endlocamount", decimalFormat.format(endlocamount)); + mergedList.add(newItem); + } + } + BigDecimal sum=BigDecimal.valueOf(0); + for (BigDecimal bigDecimal : bigDecimals){ + sum=sum.add(bigDecimal); + } + List> toBeRemoved = new ArrayList<>(); +// 计算每个父级科目的 endlocamount 和所有关联 data1 中 endlocamount 的差值 + for (Map item : mergedList) { + String parentAcccode = (String) item.get("pacccode"); + BigDecimal endlocamount =BigDecimal.ZERO; + if( item.get("pendlocamount") instanceof String){ + String endlocamountStr = (String) item.get("pendlocamount"); + endlocamount = parseEndlocamount(endlocamountStr); + }else if( item.get("pendlocamount") instanceof BigDecimal){ + endlocamount = (BigDecimal) item.get("pendlocamount"); + } + +// BigDecimal endlocamount = (BigDecimal) item.get("pendlocamount"); + BigDecimal sumEndlocamount = sumMap.get(parentAcccode); + BigDecimal difference = sumEndlocamount.subtract(endlocamount); + if (difference.compareTo(BigDecimal.ZERO) == 0) { + toBeRemoved.add(item); + } else { + if(endlocamount.compareTo(BigDecimal.ZERO) < 0){ + item.put("pendlocamount",decimalFormat.format(endlocamount.negate()) ); + }else{ + item.put("pendlocamount",decimalFormat.format(endlocamount) ); + } + item.put("difference", decimalFormat.format(difference)); + } + } + mergedList.removeAll(toBeRemoved); +// for (int i = 1; i < mergedList.size(); i++) { +// mergedList.get(i).put("pacccode", ""); +// mergedList.get(i).put("paccname", ""); +// mergedList.get(i).put("pendlocamount", ""); +// mergedList.get(i).put("difference", ""); +// } + //{"busiParamJson":"{\"pk_accountingbook\":[\"1001A110000000001PFH\"],\"pk_unit\":[],\"multbusi\":false,\"usesubjversion\":\"N\",\"versiondate\":\"2025-01-02\",\"startlvl\":\"1\",\"endlvl\":\"1\",\"isleave\":true,\"isoutacc\":\"N\",\"startyear\":\"2024\",\"endyear\":\"2024\",\"startperiod\":\"12\",\"endperiod\":\"12\",\"startdate\":\"2024-12-01\",\"endtdate\":\"2024-12-31\",\"includeuntally\":\"N\",\"includeerror\":\"N\",\"includeplcf\":\"Y\",\"includerc\":\"N\",\"pk_currtype\":\"本币\",\"returncurr\":\"1\",\"mutibook\":\"N\",\"showzerooccur\":\"N\",\"showzerobalanceoccur\":\"Y\",\"sumbysubjtype\":\"N\",\"showupsubj\":\"N\",\"currplusacc\":\"Y\",\"balanceori\":\"-1\",\"twowaybalance\":\"N\",\"istree\":\"Y\",\"qryObjs\":[],\"pk_accasoa\":[\"1001A1100000000017SV\"]}","sysParamJson":{"busiaction":"科目辅助余额表-查询","appcode":"20028003","tabid":"","ts":1735815136860,"from":"","pagecs":1735804016325}} + + // 输出合并后的列表 + for (Map item : mergedList) { + System.out.println(item); + } + return mergedList; + } + + // 解析 endlocamount 字符串为 double 类型 + private static BigDecimal parseEndlocamount(String endlocamountStr) { + if (endlocamountStr == null || endlocamountStr.isEmpty()) { + return BigDecimal.ZERO; + } + // 去除逗号 + endlocamountStr = endlocamountStr.replace(",", ""); + try { + return BigDecimal.valueOf(Double.parseDouble(endlocamountStr)); + } catch (NumberFormatException e) { + return BigDecimal.ZERO; + } + } + private Map getParaMap(Map params) { + // 获取传入的参数 + List pkAccountingBook = (List) params.get("pk_accountingbook"); +//1001A1100000000017TP + List pkAccasoa = (List) params.get("pk_accasoa"); +// pkAccasoa.add("1001A1100000000017TP"); + String startYear = (String) params.get("startyear"); + String endYear = (String) params.get("endyear"); + String startPeriod = (String) params.get("startperiod"); + String endPeriod = (String) params.get("endperiod"); + String startDate = (String) params.get("startdate"); + String endDate = (String) params.get("enddate"); + String isleave = (String) params.get("isleave"); + + // 创建第一个 Map 对象 + Map firstBusiParamJson = new HashMap<>(); + firstBusiParamJson.put("pk_accountingbook", pkAccountingBook); + firstBusiParamJson.put("pk_unit", new ArrayList(){}); + firstBusiParamJson.put("multbusi", false); + firstBusiParamJson.put("usesubjversion", "N"); + // 获取当前日期 + LocalDate currentDate = LocalDate.now(); +// 格式化日期为 "yyyy-MM-dd" 格式 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + String formattedDate = currentDate.format(formatter); + +// 设置 versiondate 为当前日期 + firstBusiParamJson.put("versiondate", formattedDate); + firstBusiParamJson.put("startlvl", "1"); + firstBusiParamJson.put("endlvl", "1"); + firstBusiParamJson.put("isleave", isleave); + firstBusiParamJson.put("isoutacc", "N"); + firstBusiParamJson.put("startyear", startYear); + firstBusiParamJson.put("endyear", endYear); + firstBusiParamJson.put("startperiod", startPeriod); + firstBusiParamJson.put("endperiod", endPeriod); + firstBusiParamJson.put("startdate", startDate); + firstBusiParamJson.put("enddate", endDate); + firstBusiParamJson.put("includeuntally", "N"); + firstBusiParamJson.put("includeerror", "N"); + firstBusiParamJson.put("includeplcf", "Y"); + firstBusiParamJson.put("includerc", "N"); + firstBusiParamJson.put("pk_currtype", "本币"); + firstBusiParamJson.put("returncurr", "1"); + firstBusiParamJson.put("mutibook", "N"); + firstBusiParamJson.put("showzerooccur", "N"); + firstBusiParamJson.put("showzerobalanceoccur", "Y"); + firstBusiParamJson.put("sumbysubjtype", "N"); + firstBusiParamJson.put("showupsubj", "N"); + firstBusiParamJson.put("currplusacc", "Y"); + firstBusiParamJson.put("balanceori", "-1"); + firstBusiParamJson.put("twowaybalance", "N"); + firstBusiParamJson.put("istree", "Y"); + firstBusiParamJson.put("qryObjs", new ArrayList(){}); + firstBusiParamJson.put("pk_accasoa", pkAccasoa); + if(pkAccasoa.isEmpty() || pkAccasoa.get(0).equals("")){ + firstBusiParamJson.put("isleave", "N"); + firstBusiParamJson.put("pk_accasoa", new ArrayList(){}); + }else{ + firstBusiParamJson.put("isleave", null); + + } +// firstBusiParamJson.put("pk_accasoa", pkAccasoa);//1001A1100000000017SV + + Map firstSysParamJson = new HashMap<>(); + firstSysParamJson.put("busiaction", "科目辅助余额表-查询"); + firstSysParamJson.put("appcode", "20028003"); + firstSysParamJson.put("tabid", ""); + firstSysParamJson.put("ts", System.currentTimeMillis()); + firstSysParamJson.put("from", ""); + firstSysParamJson.put("pagecs", System.currentTimeMillis()); + + // 创建第二个 Map 对象 + Map secondBusiParamJson = new HashMap<>(); + secondBusiParamJson.put("pk_accountingbook", pkAccountingBook); + secondBusiParamJson.put("pk_unit",new ArrayList()); + secondBusiParamJson.put("multbusi", false); + secondBusiParamJson.put("usesubjversion", "N"); + secondBusiParamJson.put("versiondate", null); + secondBusiParamJson.put("startlvl", "1"); + secondBusiParamJson.put("endlvl", "1"); + secondBusiParamJson.put("isleave", isleave); + secondBusiParamJson.put("isoutacc", "N"); + secondBusiParamJson.put("startyear", startYear); + secondBusiParamJson.put("endyear", endYear); + secondBusiParamJson.put("startperiod", startPeriod); + secondBusiParamJson.put("endperiod", endPeriod); + secondBusiParamJson.put("startdate", startDate); +// secondBusiParamJson.put("endtdate", endDate); + secondBusiParamJson.put("enddate", endDate); + secondBusiParamJson.put("includeuntally", "N"); + secondBusiParamJson.put("includeerror", "N"); + secondBusiParamJson.put("includeplcf", "Y"); + secondBusiParamJson.put("includerc", "N"); + secondBusiParamJson.put("pk_currtype", "本币"); + secondBusiParamJson.put("returncurr", "1"); + secondBusiParamJson.put("mutibook", "N"); + secondBusiParamJson.put("showzerooccur", "N"); + secondBusiParamJson.put("showzerobalanceoccur", "Y"); + secondBusiParamJson.put("currplusacc", "Y"); + secondBusiParamJson.put("sumbysubjtype", "N"); + secondBusiParamJson.put("balanceori", "-1"); + secondBusiParamJson.put("twowaybalance", "N"); + secondBusiParamJson.put("querybyperiod", true); + secondBusiParamJson.put("pk_accasoa", pkAccasoa);//1001A1100000000017SV + if(pkAccasoa.isEmpty() || pkAccasoa.get(0).equals("")){ + secondBusiParamJson.put("isleave", "N"); + secondBusiParamJson.put("pk_accasoa", new ArrayList(){}); + }else{ + secondBusiParamJson.put("isleave", null); + + } + secondBusiParamJson.put("appcode", "20023005"); + Map secondSysParamJson = new HashMap<>(); + secondSysParamJson.put("busiaction", "科目余额表-查询"); + secondSysParamJson.put("appcode", "20023005"); + secondSysParamJson.put("tabid", ""); + secondSysParamJson.put("ts", System.currentTimeMillis()); + secondSysParamJson.put("from", ""); + secondSysParamJson.put("pagecs", System.currentTimeMillis()); + Map paraMap = new HashMap<>(); + Map first = new HashMap<>(); + first.put("busiParamJson", firstBusiParamJson); + first.put("sysParamJson", firstSysParamJson); + Map second = new HashMap<>(); + second.put("busiParamJson2", secondBusiParamJson); + second.put("sysParamJson2", secondSysParamJson); + paraMap.put("first",firstBusiParamJson); + paraMap.put("second",secondBusiParamJson); + return paraMap; + } + private void setAppcode(Map paraMap) { + String appcode = SessionContext.getInstance().getAppcode(); + if (appcode.startsWith("2002305010")) { + appcode = (String)paraMap.get("pk_multicol"); + } else if (appcode.startsWith("2002308010")) { + appcode = (String)paraMap.get("pk_report"); + } + + paraMap.put("appcode", appcode); + } +} diff --git a/gl/src/client/yyconfig/modules/gl/accountrep/config/action/action.xml b/gl/src/client/yyconfig/modules/gl/accountrep/config/action/action.xml new file mode 100644 index 0000000..c346217 --- /dev/null +++ b/gl/src/client/yyconfig/modules/gl/accountrep/config/action/action.xml @@ -0,0 +1,404 @@ + + + + gl.accountrep.accbalquery + + nccloud.web.gl.accountrep.action.AccountBalanceQueryAction + + + + gl.accountrep.triaccquery + + nccloud.web.gl.accountrep.action.TriAccbooksQueryAction + + + + gl.accountrep.detailbookquery + + nccloud.web.gl.accountrep.action.DetailBookQueryAction + + + + gl.accountrep.subjassemblequery + + nccloud.web.gl.accountrep.action.SubjAssembleQueryAction + + + + gl.accountrep.summarylistquery + + nccloud.web.gl.accountrep.action.SummaryListQueryAction + + + + gl.accountrep.multibookformatquery + + nccloud.web.gl.accountrep.action.MultiBookFormatQueryAction + + + gl.accountrep.multibookformatcopy + + nccloud.web.gl.accountrep.action.MultiBookFormatCopyAction + + + gl.accountrep.multibookformatsave + + nccloud.web.gl.accountrep.action.MultiBookFormatSaveAction + + + gl.accountrep.multibookformatdelete + + nccloud.web.gl.accountrep.action.MultiBookFormatDeleteAction + + + gl.accountrep.multibookformatpreview + + nccloud.web.gl.accountrep.action.MultiBookFormatPreviewAction + + + gl.accountrep.multibookquery + + nccloud.web.gl.accountrep.action.MultiBookQueryAction + + + gl.accountrep.multibookpage + + nccloud.web.gl.accountrep.action.MultiBookPageAction + + + gl.accountrep.assanalysisreportquery + + nccloud.web.gl.accountrep.action.AssAnalysisReportQueryAction + + + gl.accountrep.assanalysisreportsave + + nccloud.web.gl.accountrep.action.AssAnalysisReportSaveAction + add,edit,alter + + + gl.accountrep.assanalysisreportdelete + + nccloud.web.gl.accountrep.action.AssAnalysisReportDeleteAction + delete + + + gl.accountrep.assanalysisquery + + nccloud.web.gl.accountrep.action.AssAnalysisQueryAction + directprint + + + gl.accountrep.diarybookspage + + nccloud.web.gl.accountrep.action.DiaryBooksPageAction + + + gl.accountrep.diarybooksquery + + nccloud.web.gl.accountrep.action.DiaryBooksQueryAction + + + + gl.accountrep.dailyreportquery + + nccloud.web.gl.accountrep.action.DailyReportQueryAction + + + + gl.accountrep.assattqueryobject + + nccloud.web.gl.accountrep.action.AssAttrQueryObjectAction + + + gl.accountrep.assattquerybalance + + nccloud.web.gl.accountrep.action.AssAttBalanceQueryAction + directprint + + + + gl.accountrep.multianalysisqueryobject + + nccloud.web.gl.accountrep.action.MultiAnalysisQueryObjectAction + + + gl.accountrep.multianalysisquerybook + + nccloud.web.gl.accountrep.action.MultiAnalysisBookQueryAction + directprint + + + gl.accountrep.subjassbalancebooksquery + + nccloud.web.gl.accountrep.action.SubjAssBalanceBooksQueryAction + + + gl.accountrep.assbalancequery + + nccloud.web.gl.accountrep.action.AssBalanceQueryAction + + + gl.accountrep.cashdiaryquery + + nccloud.web.gl.accountrep.action.CashDiaryQueryAction + + + gl.accountrep.sequencebooksquery + + nccloud.web.gl.accountrep.action.SequenceBooksQueryAction + + + + gl.accountrep.balancebookprint + + nccloud.web.gl.accountrep.action.BalanceBookPrintAction + print + + + gl.accountrep.balancebookoutput + + nccloud.web.gl.accountrep.action.BalanceBookOutputAction + directprint + + + gl.accountrep.assbalanceprint + + nccloud.web.gl.accountrep.action.AssBalancePrintAction + print + + + gl.accountrep.assbalanceoutput + + nccloud.web.gl.accountrep.action.AssBalanceOutputAction + directprint,templateOutput + + + gl.accountrep.assdetailprint + + nccloud.web.gl.accountrep.action.AssDetailPrintAction + print + + + gl.accountrep.assdetailoutput + + nccloud.web.gl.accountrep.action.AssDetailOutputAction + + + gl.accountrep.assdetailoutput + + nccloud.web.gl.accountrep.action.AssDetailOutputAction + directprint,templateOutput + + + gl.accountrep.triaccbookprint + + nccloud.web.gl.accountrep.action.TriAccBookPrintAction + print + + + gl.accountrep.triaccbookoutput + + nccloud.web.gl.accountrep.action.TriAccBookOutputAction + directprint,templateOutput + + + gl.accountrep.triaccdetailprint + + nccloud.web.gl.accountrep.action.DetailBookPrintAction + print + + + gl.accountrep.triaccdetailoutput + + nccloud.web.gl.accountrep.action.DetailBookOutputAction + directprint,templateOutput + + + gl.accountrep.sequencebookprint + + nccloud.web.gl.accountrep.action.SequenceBookPrintAction + print + + + gl.accountrep.sequencebookoutput + + nccloud.web.gl.accountrep.action.SequenceBookOutputAction + + + gl.accountrep.multibookprint + + nccloud.web.gl.accountrep.action.MultiBookPrintAction + print + + + gl.accountrep.multibookoutput + + nccloud.web.gl.accountrep.action.MultiBookOutputAction + directprint,templateOutput + + + gl.accountrep.subjassbalanceprint + + nccloud.web.gl.accountrep.action.SubjAssBalanceBookPrintAction + print + + + gl.accountrep.subjassbalanceoutput + + nccloud.web.gl.accountrep.action.SubjAssBalanceBookOutputAction + directprint + + + gl.accountrep.diarybooksprint + + nccloud.web.gl.accountrep.action.DiaryBooksPrintAction + print + + + gl.accountrep.diarybooksoutput + + nccloud.web.gl.accountrep.action.DiaryBooksOutputAction + printexcel,printoutput + + + gl.accountrep.cashdiaryprint + + nccloud.web.gl.accountrep.action.BankDiaryPrintAction + print + + + gl.accountrep.cashdiaryoutput + + nccloud.web.gl.accountrep.action.BankDiaryOutputAction + directprint,templateOutput + + + gl.accountrep.bankdiaryprint + + nccloud.web.gl.accountrep.action.BankDiaryPrintAction + + + gl.accountrep.bankdiaryoutput + + nccloud.web.gl.accountrep.action.BankDiaryOutputAction + + + gl.accountrep.subjassembleprint + + nccloud.web.gl.accountrep.action.SubjAssemblePrintAction + print + + + gl.accountrep.subjassembleoutput + + nccloud.web.gl.accountrep.action.SubjAssembleOutputAction + directprint + + + gl.accountrep.summarylistprint + + nccloud.web.gl.accountrep.action.SummaryListPrintAction + print + + + gl.accountrep.summarylistoutput + + nccloud.web.gl.accountrep.action.SummaryListOutputAction + + + gl.accountrep.dailyreportprint + + nccloud.web.gl.accountrep.action.DailyReportPrintAction + print + + + gl.accountrep.dailyreportoutput + + nccloud.web.gl.accountrep.action.DailyReportOutputAction + directprint,templateOutput + + + gl.accountrep.capitalreportprint + + nccloud.web.gl.accountrep.action.DailyReportPrintAction + print + + + gl.accountrep.capitalreportoutput + + nccloud.web.gl.accountrep.action.DailyReportOutputAction + directprint + + + gl.accountrep.assbalancequeryobject + + nccloud.web.gl.accountrep.action.AssBalanceQueryObjectAction + + + gl.accountrep.assdetailquery + + nccloud.web.gl.accountrep.action.AssDetailQueryAction + + + gl.accountrep.budgetlink + + nccloud.web.gl.accountreplink.action.BudgetLinkAction + + + gl.accountrep.voucherlinksequence + + nccloud.web.gl.accountreplink.action.VoucherLinkSequenceAction + + + gl.accountrep.directprint + + nccloud.web.gl.accountrep.action.DirectPrintAction + directprint,print + + + gl.accountrep.queryaccount + + nccloud.web.gl.accountrep.action.AccountQueryAction + + + gl.accountrep.queryassitembyaccountpk + + nccloud.web.gl.accountrep.action.QueryAssItemByAccountPKAction + + + gl.accountrep.summarylistqueryassitem + + nccloud.web.gl.accountrep.action.SummaryListQueryAssItemAction + + + gl.accountrep.ufolink + + nccloud.web.gl.accountrep.action.UFOLinkAction + + + gl.accountrep.expandfun + + nccloud.web.gl.accountrep.action.ExpendFunAction + + + gl.accountrep.checkparam + + nccloud.web.gl.accountrep.action.CheckParamAction + + + gl.accountrep.glproviderdesign + + nccloud.web.gl.accountrep.action.GLProviderDesignAction + + + gl.accountrep.AdaptAccountRepLinkParam + + nccloud.web.gl.accountreplink.action.AdaptAccountRepLinkParamAction + + + gl.accountrep.accountbalancetotal + + nccloud.web.gl.accountrep.action.AccountBalanceTotalQueryAction + + diff --git a/gl/src/client/yyconfig/modules/gl/app/config/authorize/reckon.xml b/gl/src/client/yyconfig/modules/gl/app/config/authorize/reckon.xml new file mode 100644 index 0000000..e3d4916 --- /dev/null +++ b/gl/src/client/yyconfig/modules/gl/app/config/authorize/reckon.xml @@ -0,0 +1,44 @@ + + + + 20020BATCL,20020RECON,20020RECOQ,20020TRYBL,2002BATCHRECON,2002CLACC,101006,101007 + + + gl.reckoning.refreshperiod + + gl.reckoning.reckoningreport + + gl.reckoning.reckoning + + gl.reckoning.unreckoning + + gl.reckoning.closereport + + gl.reckoning.reckoningstatus + + gl.reckoning.batchreckoningquery + + gl.reckoning.batchreckoning + + gl.reckoning.batchunreckoning + + gl.settled.closereportprint + + gl.accountrep.closereportoutput + + gl.accountrep.reckoningreportprint + + gl.accountrep.reckoningreportoutput + + gl.voucher.calculation + + gl.voucher.checkbalanceprint + + gl.pfxx.taxcloudupload + + gl.pfxx.taxcloudconfig + gl.accountrep.accountbalancetotal + + + + diff --git a/mmpac/src/private/nc/bs/mmpac/pickm/bp/PickmInsertForScBP.java b/mmpac/src/private/nc/bs/mmpac/pickm/bp/PickmInsertForScBP.java new file mode 100644 index 0000000..80c71cf --- /dev/null +++ b/mmpac/src/private/nc/bs/mmpac/pickm/bp/PickmInsertForScBP.java @@ -0,0 +1,176 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nc.bs.mmpac.pickm.bp; + +import nc.bs.mmpac.pickm.plugin.PickmPluginPoint; +import nc.bs.mmpac.pickm.rule.*; +import nc.bs.mmpac.pickm.rule.ic.PickmATPCheckRule; +import nc.bs.mmpac.pickm.rule.ic.PickmAutoReserveRule; +import nc.bs.mmpac.pickm.rule.sc.PickmSetDeftValueForScRule; +import nc.bs.mmpac.pickm.rule.sc.PickmSetItemDeftValueForScRule; +import nc.bs.mmpub.rule.MMAutoMaterialAssignRule; +import nc.bs.pubapp.pub.rule.FieldLengthCheckRule; +import nc.bs.pubapp.pub.rule.OrgDisabledCheckRule; +import nc.bsutil.mmpac.pickm.PickmSagasUtil; +import nc.impl.pubapp.bd.userdef.UserDefSaveRule; +import nc.impl.pubapp.pattern.data.bill.template.BillInsertOperator; +import nc.impl.pubapp.pattern.data.bill.template.InsertBPTemplate; +import nc.impl.pubapp.pattern.data.bill.tool.BillTransferTool; +import nc.impl.pubapp.pattern.rule.IRule; +import nc.impl.pubapp.pattern.rule.processer.AroundProcesser; +import nc.impl.pubapp.pattern.rule.template.IOperator; +import nc.util.mmf.busi.rule.MMBillCodeCheckAndTrantypeRule; +import nc.util.mmf.busi.rule.MMCreateBillcodeAndTrantypecodeRule; +import nc.util.mmf.framework.base.MMValueCheck; +import nc.vo.mmpac.pickm.entity.AggPickmVO; +import nc.vo.mmpac.pickm.entity.PickmHeadVO; +import nc.vo.mmpac.pickm.entity.PickmItemVO; +import nc.vo.mmpac.pickm.enumeration.FsourcetypeEnum; + +import java.util.ArrayList; +import java.util.List; + +public class PickmInsertForScBP { + public PickmInsertForScBP() { + } + + public void savePickmForSc(PickmHeadVO[] headVOs) { + if (!MMValueCheck.isEmpty(headVOs)) { + List aggPickmVOList = new ArrayList(); + AggPickmVO aggPickmVO = null; + + for(PickmHeadVO headVO : headVOs) { + headVO.setFsourcetype(FsourcetypeEnum.WWBILL_STATE.toInteger()); + aggPickmVO = new AggPickmVO(); + aggPickmVO.setParent(headVO); + aggPickmVOList.add(aggPickmVO); + } + + AggPickmVO[] retVOs = this.savePickmForSc((AggPickmVO[])aggPickmVOList.toArray(new AggPickmVO[0])); + IRule pickmAutoApproveRule = new PickmAutoApproveAfterSaveRule(); + pickmAutoApproveRule.process(retVOs); + } + } + + public void savePickmForSc2(AggPickmVO[] vos) { + if (!MMValueCheck.isEmpty(vos)) { + AggPickmVO[] retVOs = this.savePickmForSc(vos); + IRule pickmAutoApproveRule = new PickmAutoApproveAfterSaveRule(); + pickmAutoApproveRule.process(retVOs); + } + } + + private void addAfterRule(AroundProcesser processor) { + IRule billCodeCheckRule = new MMBillCodeCheckAndTrantypeRule("55A3", "vbillcode", "pk_group", "pk_org", "vbusitype"); + processor.addAfterRule(billCodeCheckRule); + IRule atpCheckRule = new PickmATPCheckRule(false, (AggPickmVO[])null); + processor.addAfterRule(atpCheckRule); + IRule autoReserveRule = new PickmAutoReserveRule(); + processor.addAfterRule(autoReserveRule); + } + + private void addBeforeRule(AroundProcesser processor) { + IRule orgRule = new OrgDisabledCheckRule("pk_org", "FACTORYTYPE000000000"); + processor.addBeforeRule(orgRule); + IRule getMakeDateRule = new PickmMakeDateRule(); + processor.addBeforeRule(getMakeDateRule); + IRule setForScRule = new PickmSetDeftValueForScRule(); + processor.addBeforeRule(setForScRule); + + IRule billcodeRule = new MMCreateBillcodeAndTrantypecodeRule("55A3", "vbillcode", "pk_group", "pk_org", "vbusitype"); + processor.addBeforeRule(billcodeRule); + IRule createSubItemRule = new PickmCreateSubItemRule(false); + processor.addBeforeRule(createSubItemRule); + IRule setItemForScRule = new PickmSetItemDeftValueForScRule(); + processor.addBeforeRule(setItemForScRule); + IRule sameRule = new PickmCheckSameStockRule(); + processor.addBeforeRule(sameRule); + + IRule checkSameRow = new PickmRowNoRule(); + processor.addBeforeRule(checkSameRow); + IRule lengthCheckRule = new FieldLengthCheckRule(); + processor.addBeforeRule(lengthCheckRule); + IRule autoHMaterialAssignRule = new MMAutoMaterialAssignRule("cmaterialvid", (String)null, new String[]{"pk_org"}, (String[])null); + processor.addBeforeFinalRule(autoHMaterialAssignRule); + IRule autobMaterialAssignRule = new MMAutoMaterialAssignRule((String)null, "cbmaterialvid", new String[]{"pk_org"}, new String[]{"cdeliverorgid", "csupplyorgid"}); + processor.addBeforeFinalRule(autobMaterialAssignRule); + IRule marperRule = new PickmCheckMaterialPermissionRule(); + processor.addBeforeRule(marperRule); + IRule bmarperRule = new PickmCheckItemMaterialPermissionRule(); + processor.addBeforeRule(bmarperRule); + IRule pickmSaveRule = new PickmSaveRule(); + processor.addBeforeRule(pickmSaveRule); + IRule atpCheckRule = new PickmATPCheckRule(true, (AggPickmVO[])null); + processor.addBeforeRule(atpCheckRule); + IRule userDefSaveRule = new UserDefSaveRule(new String[]{"vdef", "vbdef"}, new Class[]{PickmHeadVO.class, PickmItemVO.class}); + processor.addBeforeRule(userDefSaveRule); + } + + private AggPickmVO[] savePickmForSc(AggPickmVO[] vos) { + if (MMValueCheck.isEmpty(vos)) { + return null; + } else { + new BillTransferTool(vos); + InsertBPTemplate bp = new InsertBPTemplate(PickmPluginPoint.INSERTFORSC); + this.addBeforeRule(bp.getAroundProcesser()); + this.addAfterRule(bp.getAroundProcesser()); + bp.getAroundProcesser().before(vos); + IOperator operator = new BillInsertOperator(); + AggPickmVO[] aggvos = (AggPickmVO[])operator.operate(vos); + PickmSagasUtil.addSagaAndCompensate4Insert(aggvos); + bp.getAroundProcesser().after(aggvos); + return aggvos; + } + } + + public void savePickmForScSagasCheck(PickmHeadVO[] headVOs) { + if (!MMValueCheck.isEmpty(headVOs)) { + List aggPickmVOList = new ArrayList(); + AggPickmVO aggPickmVO = null; + + for(PickmHeadVO headVO : headVOs) { + headVO.setFsourcetype(FsourcetypeEnum.WWBILL_STATE.toInteger()); + aggPickmVO = new AggPickmVO(); + aggPickmVO.setParent(headVO); + aggPickmVOList.add(aggPickmVO); + } + + new BillTransferTool((AggPickmVO[])aggPickmVOList.toArray(new AggPickmVO[0])); + InsertBPTemplate bp = new InsertBPTemplate(PickmPluginPoint.INSERTFORSC); + this.addBeforeRuleSagasCheck(bp.getAroundProcesser()); + bp.getAroundProcesser().before((AggPickmVO[])aggPickmVOList.toArray(new AggPickmVO[0])); + } + } + + private void addBeforeRuleSagasCheck(AroundProcesser processor) { + IRule orgRule = new OrgDisabledCheckRule("pk_org", "FACTORYTYPE000000000"); + processor.addBeforeRule(orgRule); + IRule getMakeDateRule = new PickmMakeDateRule(); + processor.addBeforeRule(getMakeDateRule); + IRule setForScRule = new PickmSetDeftValueForScRule(); + processor.addBeforeRule(setForScRule); + IRule createSubItemRule = new PickmCreateSubItemRule(false); + processor.addBeforeRule(createSubItemRule); + IRule setItemForScRule = new PickmSetItemDeftValueForScRule(); + processor.addBeforeRule(setItemForScRule); + IRule sameRule = new PickmCheckSameStockRule(); + processor.addBeforeRule(sameRule); + IRule checkSameRow = new PickmRowNoRule(); + processor.addBeforeRule(checkSameRow); + IRule lengthCheckRule = new FieldLengthCheckRule(); + processor.addBeforeRule(lengthCheckRule); + IRule marperRule = new PickmCheckMaterialPermissionRule(); + processor.addBeforeRule(marperRule); + IRule bmarperRule = new PickmCheckItemMaterialPermissionRule(); + processor.addBeforeRule(bmarperRule); + IRule pickmSaveRule = new PickmSaveRule(); + processor.addBeforeRule(pickmSaveRule); + IRule atpCheckRule = new PickmATPCheckRule(true, (AggPickmVO[])null); + processor.addBeforeRule(atpCheckRule); + IRule userDefSaveRule = new UserDefSaveRule(new String[]{"vdef", "vbdef"}, new Class[]{PickmHeadVO.class, PickmItemVO.class}); + processor.addBeforeRule(userDefSaveRule); + } +} diff --git a/sc/src/private/nc/impl/sc/m61/action/maintain/rule/SCOrderPushMoRule.java b/sc/src/private/nc/impl/sc/m61/action/maintain/rule/SCOrderPushMoRule.java new file mode 100644 index 0000000..281b16d --- /dev/null +++ b/sc/src/private/nc/impl/sc/m61/action/maintain/rule/SCOrderPushMoRule.java @@ -0,0 +1,110 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nc.impl.sc.m61.action.maintain.rule; + + +import nc.bs.framework.common.NCLocator; +import nc.impl.pubapp.pattern.rule.IRule; +import nc.itf.mmpac.pickm.IPickmMaintainService; +import nc.itf.sc.m61.compenstate.IScOrderSagasCompensate; +import nc.itf.sc.reference.mm.PubMMPACService; +import nc.itf.scmpub.reference.uap.pf.PfServiceScmUtil; +import nc.vo.mmpac.pickm.entity.AggPickmVO; +import nc.vo.mmpac.pickm.entity.PickmHeadVO; +import nc.vo.pub.BusinessException; +import nc.vo.pubapp.pattern.exception.ExceptionUtils; +import nc.vo.sc.m61.entity.SCOrderItemVO; +import nc.vo.sc.m61.entity.SCOrderVO; +import nc.vo.scmpub.res.billtype.MMBillType; +import nc.vo.scmpub.res.billtype.SCBillType; +import nc.vo.scmpub.util.ArrayUtil; +import nccloud.commons.lang.ArrayUtils; +import nccloud.pubitf.sc.pub.util.ScSagasUtil; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class SCOrderPushMoRule implements IRule { + public SCOrderPushMoRule() { + } + + public void process(SCOrderVO[] vos) { + if (!ArrayUtils.isEmpty(vos)) { + try { + // 鍒嗙粍澶勭悊閫昏緫 + List specialList = new ArrayList<>(); + List normalList = new ArrayList<>(); + for (SCOrderVO vo : vos) { + // 鍋囪閫氳繃 getBilltype() 鑾峰彇鍗曟嵁绫诲瀷锛岃鏍规嵁瀹為檯瀛楁璋冩暣 + if ("61-Cxx-01".equals(vo.getParentVO().getVtrantypecode()) ){ + specialList.add(vo); + } else { + normalList.add(vo); + } + } + + List headList = new ArrayList<>(); + // 鐗规畩绫诲瀷澶勭悊 + if (!specialList.isEmpty()) { + AggPickmVO[] specialPickVos = (AggPickmVO[]) PfServiceScmUtil.exeVOChangeByBillItfDef( + "61-Cxx-01", // 鐗规畩绫诲瀷缂栫爜 + MMBillType.PickMo.getCode(), + vos); + IPickmMaintainService ipickmMaintainService = NCLocator.getInstance().lookup(IPickmMaintainService.class); + ipickmMaintainService.insert(specialPickVos); + } + + // 甯歌澶勭悊 + if (!normalList.isEmpty()) { + AggPickmVO[] normalPickVos = (AggPickmVO[]) PfServiceScmUtil.exeVOChangeByBillItfDef( + SCBillType.Order.getCode(), + MMBillType.PickMo.getCode(), + normalList.toArray(new SCOrderVO[0])); + for(AggPickmVO vo : normalPickVos) { + PickmHeadVO head = (PickmHeadVO)vo.getParent(); + headList.add(head); + } + } + if (headList.size() > 0) { + this.addSagaAndCompensate(vos); + PubMMPACService.pushMMPac((PickmHeadVO[])headList.toArray(new PickmHeadVO[headList.size()])); + } + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + + } + } + + private void addSagaAndCompensate(SCOrderVO[] vos) { + ScSagasUtil.frozenAndAddSaga(vos, "pickMo", SCBillType.Order.getCode()); + if (!ArrayUtil.isEmpty(vos)) { + Map map = new HashMap(); + map.put("opertaion", "pickMo"); + List bids = new ArrayList(); + + for(SCOrderVO scOrderVO : vos) { + SCOrderItemVO[] itemVOs = scOrderVO.getChildrenVO(); + + for(SCOrderItemVO bvo : itemVOs) { + bids.add(bvo.getPk_order_b()); + } + } + + map.put("pk_order_b", bids.toArray(new String[0])); + + try { + ScSagasUtil.compensate(IScOrderSagasCompensate.class, map); + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + } + + } +} diff --git a/so/META-INF/saleorder.rest b/so/META-INF/saleorder.rest new file mode 100644 index 0000000..fc460ed --- /dev/null +++ b/so/META-INF/saleorder.rest @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/so/src/private/nc/bs/so/m32/maintain/rule/delete/SyncBipBillRuleForDelete.java b/so/src/private/nc/bs/so/m32/maintain/rule/delete/SyncBipBillRuleForDelete.java index 6afdea8..13202d1 100644 --- a/so/src/private/nc/bs/so/m32/maintain/rule/delete/SyncBipBillRuleForDelete.java +++ b/so/src/private/nc/bs/so/m32/maintain/rule/delete/SyncBipBillRuleForDelete.java @@ -39,7 +39,7 @@ public class SyncBipBillRuleForDelete implements IRule { private String appSecret = ""; private String baseUrl = "https://www.tkkfbip.com"; private String tokenUrl = "/iuap-api-auth/open-auth/selfAppAuth/getAccessToken"; - private String toBipUrl = "/iuap-api-gateway/oxp4h3x6/current_yonbip_default_sys/KKAPI/invoiceApplication/updateInvoice?access_token="; + private String toBipUrl = ""; @Override public void process(SaleInvoiceVO[] vos) { @@ -59,6 +59,7 @@ public class SyncBipBillRuleForDelete implements IRule { baseUrl = bipParamMap.get("baseUrl"); appKey = bipParamMap.get("appKey"); appSecret = bipParamMap.get("appSecret"); + toBipUrl = bipParamMap.get("updateInvoice"); NCCForUAPLogger.debug(String.format("SyncBipBillRuleForDelete-baseUrl = [%s],appKey1 = [%s],appSecret = [%s],", baseUrl, appKey, appSecret)); String access_token = getAccessToken(); @@ -86,7 +87,8 @@ public class SyncBipBillRuleForDelete implements IRule { updateJson.put("id", vdef38); updateJson.put("saleInvoiceId", ""); updateJson.put("contractInvoiceApplicationDetailList", childrenList); - String bipRes = doPost(baseUrl + toBipUrl + access_token, updateJson); + String url = baseUrl + toBipUrl + "?access_token=" + access_token; + String bipRes = doPost(url, updateJson); NCCForUAPLogger.debug("SyncBipBillRuleForDelete-bipRes = " + bipRes); } } diff --git a/sscivm/src/client/nccloud/web/sscivm/ivsale/sale/action/InvoiceDownloadAction.java b/sscivm/src/client/nccloud/web/sscivm/ivsale/sale/action/InvoiceDownloadAction.java new file mode 100644 index 0000000..d4f0182 --- /dev/null +++ b/sscivm/src/client/nccloud/web/sscivm/ivsale/sale/action/InvoiceDownloadAction.java @@ -0,0 +1,253 @@ +package nccloud.web.sscivm.ivsale.sale.action; + +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.net.URLEncoder; + +import com.alibaba.fastjson.JSONObject; +import com.google.gson.Gson; + +import java.io.ByteArrayInputStream; +import java.io.IOException; + +import org.apache.http.client.config.CookieSpecs; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.util.EntityUtils; +import com.yonyou.cloud.utils.StringUtils; + +import nc.bs.trade.business.HYSuperDMO; +import nc.util.mmf.framework.base.MMValueCheck; +import nc.vo.pub.BusinessException; +import nc.vo.pubapp.pattern.exception.ExceptionUtils; +import nc.vo.sscivm.invoice.IVMInvoiceHeadVO; +import nc.vo.sscivm.ivsale.IVApplicationHeadVO; +import nc.vo.sscivm.ivsale.IVApplogVO; +import nccloud.framework.core.io.WebFile; +import nccloud.framework.service.ServiceLocator; +import nccloud.framework.web.action.itf.ICommonAction; +import nccloud.framework.web.container.IRequest; +import nccloud.itf.sscivm.ivsale.service.IVSaleQueryService; +import nccloud.pubitf.platform.attachment.IAttachmentService; + +public class InvoiceDownloadAction implements ICommonAction { + + IAttachmentService ncservice = ServiceLocator.find(IAttachmentService.class); + + @Override + public Object doAction(IRequest request) { + + Map params_1 = request.readParameters(); + + String[] pk = params_1.get("pk"); + String[] invoiceTypes = params_1.get("invoiceType"); + String isdoc = "z"; + WebFile file = null; + try { + List headVOList =ServiceLocator.find(IVSaleQueryService.class).queryIVMInvoiceHeadVOsByPks(new String[] {pk[0]}); + IVMInvoiceHeadVO headVO = headVOList.get(0); + String invoiceType = invoiceTypes[0]; + + + // 鑾峰彇鏃楄埌鐗堢殑token + String appKey = "8c9eb1ea1ba54b3f9683a8b355f8e615"; + String appSecret = "999e15c2a13ee4eab480534be4bf52fdf9032a6d"; + String tokenUrl="https://c2.yonyoucloud.com/iuap-api-auth/open-auth/selfAppAuth/getAccessToken"; + String getbsfileUrl="https://c2.yonyoucloud.com/iuap-api-gateway/yonbip/tax/output-tax/api/einvoice/getbsfile?access_token="; + + Map params = new HashMap<>(); + + // 闄ょ鍚嶅鐨勫叾浠栧弬鏁 + params.put("appKey", appKey); + String timestamp = String.valueOf(System.currentTimeMillis()); + params.put("timestamp", timestamp); + // 璁$畻绛惧悕 + Map treeMap; + if (params instanceof TreeMap) { + treeMap = params; + } else { + treeMap = new TreeMap<>(params); + } + StringBuilder stringBuilder = new StringBuilder(); + for (Map.Entry entry : treeMap.entrySet()) { + stringBuilder.append(entry.getKey()).append(entry.getValue()); + } + Mac mac = Mac.getInstance("HmacSHA256"); + + mac.init(new SecretKeySpec(appSecret.getBytes(StandardCharsets.UTF_8), "HmacSHA256")); + byte[] signData = mac.doFinal(stringBuilder.toString().getBytes(StandardCharsets.UTF_8)); + String base64String = Base64.getEncoder().encodeToString(signData); + String signature = URLEncoder.encode(base64String, "UTF-8"); + params.put("signature", signature); +// String responseString = doGet( +// "https://c1.yonyoucloud.com/iuap-api-auth/open-auth/selfAppAuth/getAccessToken", params); + String responseString = doGet(tokenUrl, params); + Gson gson = new Gson(); + Map result = gson.fromJson(responseString, Map.class); + + if (StringUtils.equals("00000", result.get("code").toString())) { + + Map tokenInfo = (Map) result.get("data"); + String access_token = (String) tokenInfo.get("access_token"); + // 绋庡姟鏈嶅姟-璋冪敤閿椤瑰彂绁ㄧ鐞-宸插紑绁-鐗堝紡鏂囦欢鏌ヨ鎺ュ彛 + Map map = new HashMap<>(); + // 鍙戠エ绫诲瀷 1锛氬鍊肩◣鐢靛瓙鏅氬彂绁紱 2锛氬鍊肩◣鐢靛瓙涓撶敤鍙戠エ锛 3锛氬鍊肩◣鏅氬彂绁紱 4锛氬鍊肩◣涓撶敤鍙戠エ 銆佸鍊肩◣涓撶敤鍙戠エ(鏈哄姩杞)锛 5锛氭満鍔ㄨ溅閿鍞粺涓鍙戠エ锛 8锛氬鍊肩◣鐢靛瓙鏅氬彂绁紙鎴愬搧娌癸級锛 10锛氭垚鍝佹补鏅氬彂绁紱 11锛氭垚鍝佹补涓撶敤鍙戠エ锛 15锛氫簩鎵嬭溅閿鍞粺涓鍙戠エ锛 31锛氭暟鐢典笓鐢ㄥ彂绁紱 32锛氭暟鐢垫櫘閫氬彂绁紱 33锛氭暟鐢电焊璐ㄥ彂绁(澧炲肩◣涓撶敤鍙戠エ)锛 34锛氭暟鐢电焊璐ㄥ彂绁(鏅氬彂绁)锛 + map.put("fplx", headVO.getInvoice_type()); + // 鏁扮數鍙戠エ鍙风爜 + map.put("slfphm", headVO.getFphm()); + // 鐢ㄥ弸鑷敾pdf + map.put("yypdf", "0"); + // 绋庡眬pdf + map.put("taxpdf", "1".equals(invoiceType) ? "1" : "0"); + // 绋庡眬xml + map.put("taxxml", "2".equals(invoiceType) ? "1" : "0"); + // 绋庡眬ofd + map.put("taxofd", "3".equals(invoiceType) ? "1" : "0"); +// String resString = doPost( +// "https://c1.yonyoucloud.com/iuap-api-gateway/yonbip/tax/output-tax/api/einvoice/getbsfile?access_token=" + access_token, +// map); + + String resString = doPost(getbsfileUrl + access_token,map); + gson = new Gson(); + + Map resultMap = gson.fromJson(resString, Map.class); + if (StringUtils.equals("200", resultMap.get("code").toString())) { + Map infoMap = (Map) resultMap.get("data"); + String tax = "1".equals(invoiceType) ? (String) infoMap.get("taxpdf") : "2".equals(invoiceType) ? (String) infoMap.get("taxxml") : "3".equals(invoiceType) ? (String) infoMap.get("taxofd") : ""; + if (MMValueCheck.isEmpty(tax)) { + throw new Exception("鏈煡璇㈠埌鍙戠エ淇℃伅"); + } + byte[] imageBytes = javax.xml.bind.DatatypeConverter.parseBase64Binary(tax); + InputStream ins = new ByteArrayInputStream(imageBytes); + String Fphm = headVO.getFphm(); + + //鍙戠エ鍙风爜+鍗曚綅鍚嶇О+鍚堝悓鍙凤紙寮绁ㄧ敵璇峰瓧娈碉級+閲戦锛堝彂绁ㄤ笂鐨勪环绋庡悎璁★級 + String filename = "1".equals(invoiceType) ? ".pdf" : "2".equals(invoiceType) ? ".xml" : "3".equals(invoiceType) ? ".ofd" : ""; + + + String ctcode=""; + HYSuperDMO dmo = new HYSuperDMO(); + IVApplogVO[] ivApplogVO=(IVApplogVO[]) dmo.queryByWhereClause(IVApplogVO.class, "fphm='"+Fphm+"' and dr=0 "); + if(ivApplogVO!=null&&ivApplogVO.length>0) { + ivApplogVO[0].getLyid();//寮绁ㄧ敵璇峰崟涓婚敭 + IVApplicationHeadVO ivApplicationHeadVO =(IVApplicationHeadVO) dmo.queryByPrimaryKey(IVApplicationHeadVO.class, ivApplogVO[0].getLyid()); + ctcode=ivApplicationHeadVO.getDef2();//鍚堝悓鍙 + } + //鍙戠エ鍙风爜+鍗曚綅鍚嶇О+鍚堝悓鍙凤紙寮绁ㄧ敵璇峰瓧娈碉級+閲戦锛堝彂绁ㄤ笂鐨勪环绋庡悎璁★級 鍚堝悓鍙穇鍗曚綅鍚嶇О_鍙戠エ鍙风爜_閲戦 + +// 鍚堝悓鍙穇鍗曚綅鍚嶇О_鍙戠エ鍙风爜_閲戦 + + String name = ctcode+"_"+headVO.getGmfmc()+"_"+Fphm+"_"+String.valueOf(headVO.getJshj().toDouble()) + filename; + +// String name = Fphm+"_"+headVO.getGmfmc()+"_"+ctcode+"_"+String.valueOf(headVO.getJshj().toDouble()) + filename; + file = new WebFile(name, ins); + } else { + throw new Exception("鑾峰彇鍙戠エ淇℃伅澶辫触"); + } + + }else { + throw new Exception("鑾峰彇access_token澶辫触"); + } +// String url = ""; +// IVMInvoiceHeadVO headVO = headVOList.get(0); +// +// if (headVOList != null && headVOList.size() > 0) { +// url = headVO.getViewurl(); +// } +// InputStream ins = this.ncservice.download(isdoc, url, "sscivm"); +// String Fpdm = headVO.getFpdm(); +// String Fphm = headVO.getFphm(); +// String name = headVO.getFilename(); +// String filename = ".pdf"; +// if(name!=null && name.endsWith(".ofd")){ +// filename = ".ofd"; +// } +// file = new WebFile(Fpdm + "_" + Fphm + filename, ins); + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } catch (NoSuchAlgorithmException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InvalidKeyException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return file; + } + + + private String doPost(String requestUrl, Map param) throws IOException { + PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); + cm.setMaxTotal(500); + cm.setDefaultMaxPerRoute(50); + + RequestConfig globalConfig = RequestConfig.custom().setConnectionRequestTimeout(5000) // 杩炴帴姹犺幏鍙栬繛鎺ヨ秴鏃 + .setConnectTimeout(5000) // 杩炴帴寤虹珛瓒呮椂 + .setSocketTimeout(20000) // 绛夊緟鍝嶅簲瓒呮椂 + .setCookieSpec(CookieSpecs.IGNORE_COOKIES).build(); + + CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm) + .setDefaultRequestConfig(globalConfig).build(); + HttpPost post = new HttpPost(requestUrl); + post.setHeader("Content-Type", "application/json;charset=UTF-8"); + post.setEntity(new StringEntity(JSONObject.toJSONString(param), "utf-8")); + String responseString = httpClient.execute(post, response -> EntityUtils.toString(response.getEntity())); + return responseString; + + } + + + private String doGet(String requestUrl, Map paramMap) throws IOException { + PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); + cm.setMaxTotal(500); + cm.setDefaultMaxPerRoute(50); + + RequestConfig globalConfig = RequestConfig.custom().setConnectionRequestTimeout(5000) // 杩炴帴姹犺幏鍙栬繛鎺ヨ秴鏃 + .setConnectTimeout(5000) // 杩炴帴寤虹珛瓒呮椂 + .setSocketTimeout(20000) // 绛夊緟鍝嶅簲瓒呮椂 + .setCookieSpec(CookieSpecs.IGNORE_COOKIES).build(); + + CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm) + .setDefaultRequestConfig(globalConfig).build(); + StringBuilder param = new StringBuilder("?"); + if (paramMap != null) { + for (Map.Entry entry : paramMap.entrySet()) { + param.append(entry.getKey()); + param.append("="); + param.append(entry.getValue()); + param.append("&"); + } + param.deleteCharAt(param.length() - 1); + } + String url = requestUrl + param; + HttpGet get = new HttpGet(url); + String responseString = httpClient.execute(get, response -> EntityUtils.toString(response.getEntity())); + get.releaseConnection(); + return responseString; + } + +} diff --git a/ssctp/src/public/nc/bs/ssctp/sscbd/tasktype/query/convertor/BlurConvertor.java b/ssctp/src/public/nc/bs/ssctp/sscbd/tasktype/query/convertor/BlurConvertor.java new file mode 100644 index 0000000..a2c4fa2 --- /dev/null +++ b/ssctp/src/public/nc/bs/ssctp/sscbd/tasktype/query/convertor/BlurConvertor.java @@ -0,0 +1,148 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nc.bs.ssctp.sscbd.tasktype.query.convertor; + +import nc.bs.ssctp.sscbd.tasktype.config.TaskTypeConfigFactory; +import nc.bs.ssctp.sscbd.tasktype.query.SSCTaskQueryCondition; + +import java.util.ArrayList; +import java.util.List; + +public class BlurConvertor implements ITaskQueryConditionConvertor { + public BlurConvertor() { + } + + public String getWherePart(SSCTaskQueryCondition condition) { + StringBuilder whereSql = new StringBuilder(); + whereSql.append(" "); + if (TaskTypeConfigFactory.QUERYCONDITION_BLUR.equals(condition.getQueryField())) { + String blur = condition.getQueryFieldValue(); + if (blur == null || "".equals(blur)) { + return ""; + } + + String[] blurs = blur.split(","); + List vas = new ArrayList(); + + for(String str : blurs) { + vas.add(str); + } + + if (vas != null && vas.size() > 0) { + for(String s : vas) { + whereSql.append(" and ( NODETASKS.busiid in ( "); + if (s.contains("=")) { + String[] strs = s.split("="); + whereSql.append(" SELECT a.busiid FROM sscrp_bill a,sscrp_detail b WHERE a.pk_bill = b.pk_bill AND CODE = '" + strs[0] + "' AND VALUE like '%" + strs[1].replaceAll("'", "") + "%' "); + whereSql.append(" UNION ALL "); + whereSql.append(" SELECT a.busiid FROM sscrp_bill_done a,sscrp_detail_done b WHERE a.pk_bill = b.pk_bill AND CODE = '" + strs[0] + "' AND VALUE like '%" + strs[1].replaceAll("'", "") + "%' "); + } else { + whereSql.append(" SELECT a.busiid FROM sscrp_bill a,sscrp_detail b WHERE a.pk_bill = b.pk_bill AND VALUE like '%" + s.replaceAll("'", "") + "%' "); + whereSql.append(" UNION ALL "); + whereSql.append(" SELECT a.busiid FROM sscrp_bill_done a,sscrp_detail_done b WHERE a.pk_bill = b.pk_bill AND VALUE like '%" + s.replaceAll("'", "") + "%' "); + } + + whereSql.append(" ) "); + + + // 鏂板鍥涗釜EXISTS鏉′欢 //鑱旀煡 浠樻鍗曘佹敹娆惧崟銆佷富鎶ラ攢鍗曘佷富鍊熸鍗 鍥涘紶鍗曞瓙 + whereSql.append(" OR EXISTS (SELECT 1 FROM AR_GATHERITEM bill JOIN BD_BALATYPE bala ON bala.pk_balatype = bill.pk_balatype WHERE NODETASKS.busiid = bill.pk_gatherbill AND bala.name LIKE '%" + s.replaceAll("'", "") + "%')"); + whereSql.append(" OR EXISTS (SELECT 1 FROM ap_paybill bill JOIN AP_PAYITEM item ON item.pk_paybill = bill.pk_paybill JOIN BD_BALATYPE bala ON bala.pk_balatype = item.pk_balatype WHERE NODETASKS.busiid = bill.pk_paybill AND bala.name LIKE '%" + s.replaceAll("'", "") + "%')"); + whereSql.append(" OR EXISTS (SELECT 1 FROM er_bxzb bill JOIN BD_BALATYPE bala ON bala.pk_balatype = bill.jsfs WHERE NODETASKS.busiid = bill.pk_jkbx AND bala.name LIKE '%" + s.replaceAll("'", "") + "%')"); + whereSql.append(" OR EXISTS (SELECT 1 FROM er_jkzb bill JOIN BD_BALATYPE bala ON bala.pk_balatype = bill.jsfs WHERE NODETASKS.busiid = bill.pk_jkbx AND bala.name LIKE '%" + s.replaceAll("'", "") + "%')"); + whereSql.append(" ) "); + } + } + } + + return whereSql.toString(); + } + + public String getWhere(String condition, Object blur) { + StringBuilder whereSql = new StringBuilder(); + whereSql.append(condition); + List vas = new ArrayList(); + if (blur != null && !blur.toString().equals("")) { + for(Object c : (List)blur) { + vas.add((String)c); + } + } + + for(String str : vas) { + vas.add(str); + } + + if (vas != null && vas.size() > 0) { + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT TASK.busiid "); + sql.append(" FROM SSCTP_TASK TASK "); + sql.append(" LEFT JOIN SSCTP_CURRENTTASK CURTASK "); + sql.append(" ON CURTASK.PK_CURRENTTASK = TASK.PK_CURRENTTASK "); + sql.append(" LEFT JOIN SSCTP_TASKEXTENDINFO EXTENDINFO "); + sql.append(" ON EXTENDINFO.PK_CURRENTTASK = TASK.PK_CURRENTTASK "); + sql.append(" WHERE " + condition + " and TASK.dr=0 and (CURTASK.saga_frozen is null or CURTASK.saga_frozen <> 1) "); + + for(String s : vas) { + whereSql.append(" and nodetasks.busiid in ( "); + if (s.contains("=")) { + String[] strs = s.split("="); + whereSql.append(" SELECT a.busiid FROM sscrp_bill a,sscrp_detail b WHERE a.pk_bill = b.pk_bill AND CODE = '" + strs[0] + "' AND VALUE like '%" + strs[1].replaceAll("'", "") + "%' AND a.busiid IN (" + sql.toString() + ") "); + whereSql.append(" UNION ALL "); + whereSql.append(" SELECT a.busiid FROM sscrp_bill_done a,sscrp_detail_done b WHERE a.pk_bill = b.pk_bill AND CODE = '" + strs[0] + "' AND VALUE like '%" + strs[1].replaceAll("'", "") + "%' AND a.busiid IN (" + sql.toString() + ") "); + } else { + String var10001 = s.replaceAll("'", ""); + whereSql.append(" SELECT a.busiid FROM sscrp_bill a,sscrp_detail b WHERE a.pk_bill = b.pk_bill AND VALUE like '%" + var10001 + "%' AND a.busiid IN (" + sql.toString() + ") "); + whereSql.append(" UNION ALL "); + var10001 = s.replaceAll("'", ""); + whereSql.append(" SELECT a.busiid FROM sscrp_bill_done a,sscrp_detail_done b WHERE a.pk_bill = b.pk_bill AND VALUE like '%" + var10001 + "%' AND a.busiid IN (" + sql.toString() + ") "); + } + + whereSql.append(" ) "); + } + } + + return whereSql.toString(); + } + + public String getWhere4QM(String condition, Object blur) { + StringBuilder whereSql = new StringBuilder(); + whereSql.append(condition); + List vas = new ArrayList(); + if (blur != null && !blur.toString().equals("")) { + for(Object c : (List)blur) { + vas.add((String)c); + } + } + + for(String str : vas) { + vas.add(str); + } + + if (vas != null && vas.size() > 0) { + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT TASK.busiid "); + sql.append(" FROM SSCTP_TASK TASK "); + sql.append(" LEFT JOIN SSCTP_CURRENTTASK CURTASK "); + sql.append(" ON CURTASK.PK_CURRENTTASK = TASK.PK_CURRENTTASK "); + sql.append(" LEFT JOIN SSCTP_TASKEXTENDINFO EXTENDINFO "); + sql.append(" ON EXTENDINFO.PK_CURRENTTASK = TASK.PK_CURRENTTASK "); + sql.append(" WHERE " + condition + " and TASK.dr=0 and (CURTASK.saga_frozen is null or CURTASK.saga_frozen <> 1) "); + + for(String s : vas) { + whereSql.append(" and nodetasks.busiid in ( "); + whereSql.append(" select id from sscqm_check_bill where pk_bill in ( "); + String var10001 = s.replaceAll("'", ""); + whereSql.append(" SELECT a.busiid FROM sscrp_bill a,sscrp_detail b WHERE a.pk_bill = b.pk_bill AND VALUE like '%" + var10001 + "%' AND a.busiid IN (" + sql.toString() + ") "); + whereSql.append(" UNION ALL "); + var10001 = s.replaceAll("'", ""); + whereSql.append(" SELECT a.busiid FROM sscrp_bill_done a,sscrp_detail_done b WHERE a.pk_bill = b.pk_bill AND VALUE like '%" + var10001 + "%' AND a.busiid IN (" + sql.toString() + ") "); + whereSql.append(" ) )"); + } + } + + return whereSql.toString(); + } +}