From ce4ce8d55b2a5d66e37ac8852b63d5f54d338d91 Mon Sep 17 00:00:00 2001 From: mzr Date: Tue, 9 Sep 2025 09:10:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=90=AF=E6=BA=90=E7=9A=84?= =?UTF-8?q?=E7=B4=AF=E8=AE=A1=E5=BC=80=E7=A5=A8=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ic/m45/m25/Bill45For25Rewrite.java | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 ic/src/private/nc/pubimpl/ic/m45/m25/Bill45For25Rewrite.java diff --git a/ic/src/private/nc/pubimpl/ic/m45/m25/Bill45For25Rewrite.java b/ic/src/private/nc/pubimpl/ic/m45/m25/Bill45For25Rewrite.java new file mode 100644 index 0000000..b7607f9 --- /dev/null +++ b/ic/src/private/nc/pubimpl/ic/m45/m25/Bill45For25Rewrite.java @@ -0,0 +1,101 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nc.pubimpl.ic.m45.m25; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import nc.bs.ic.pub.rewrite.RewriteBPTemplate; +import nc.bs.logging.Log; +import nc.bs.logging.Logger; +import nc.bs.uapbd.util.MyHelper; +import nc.bs.uapbd.util.ThirdPartyPostRequestUtil; +import nc.vo.ic.m45.entity.PurchaseInBodyVO; +import nc.vo.ic.pub.util.NCBaseTypeUtils; +import nc.vo.ml.NCLangRes4VoTransl; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFDouble; +import nccloud.baseapp.core.log.NCCForUAPLogger; + +import java.util.Map; + +public class Bill45For25Rewrite extends RewriteBPTemplate { + private static final Log logger = Log.getInstance("qyMesLog"); + private static final String reqUrl = "/IF_QyErpApi.ashx?action=addRkdFpxx"; + + public Bill45For25Rewrite() { + super(PurchaseInBodyVO.class); + this.additionalFields(new String[]{"nnum"}); + this.addUpdateField("nsignnum"); + } + + protected void reWriteAfterProcess(PurchaseInBodyVO[] vos) throws BusinessException { + UFDouble dvalue = null; + UFDouble num = null; + UFDouble nsignnum = null; + + for (PurchaseInBodyVO vo : vos) { + num = NCBaseTypeUtils.abs(vo.getNnum()); + nsignnum = NCBaseTypeUtils.abs(vo.getNsignnum()); + dvalue = NCBaseTypeUtils.sub(num, new UFDouble[]{nsignnum}); + if (NCBaseTypeUtils.isLtZero(dvalue)) { + throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008002_0", "04008002-0092")); + } + } + + super.reWriteAfterProcess(vos); + this.syncQyMes(vos); + } + + /** + * 同步启源的累计开票数量 + * + * @param vos + * @throws BusinessException + */ + protected void syncQyMes(PurchaseInBodyVO[] vos) throws BusinessException { + JSONArray contentParam = new JSONArray(); + for (PurchaseInBodyVO vo : vos) { + // 启源入库单行主键 + String vbdef20 = vo.getVbdef20(); + if (vbdef20 == null || vbdef20.isEmpty() || "~".equals(vbdef20)) { + continue; + } + String nsignnum = vo.getNsignnum().toString(); + JSONObject param = new JSONObject(); + param.put("rkqdid", vbdef20); // 启源入库单行主键 + param.put("ydyfpsl", nsignnum);// 累计开票数量 + contentParam.add(param); + } + if (!contentParam.isEmpty()) { + JSONObject data = new JSONObject(); + data.put("batchid", System.currentTimeMillis()); + data.put("Content", contentParam); + pushData(data); + } + } + + /** + * 推送同步数据 + */ + private void pushData(JSONObject param) throws BusinessException { + Map configParams = MyHelper.getConfigParams("jm-config", null); + String jsonStr = JSON.toJSONString(param); + logger.error("qyMes-purchasein-param = " + jsonStr); + NCCForUAPLogger.debug("qyMes-purchasein-param = " + jsonStr); + String baseUrl = configParams.get("qmsBaseUrl"); + String requestUrl = baseUrl + reqUrl; + logger.error("qyMes-purchasein-url = " + requestUrl); + String result = ThirdPartyPostRequestUtil.sendPostRequest(requestUrl, jsonStr); + NCCForUAPLogger.debug("qyMes-purchasein-result = " + result); + JSONObject resultObj = JSONObject.parseObject(result); + logger.error("qyMes-purchasein-res = " + result); + + if (!"true".equals(resultObj.getString("success"))) { + Logger.error("qyMes-purchasein-error,result[" + resultObj.toJSONString() + "]"); + } + } +}