From 2d34d04feddbbb21f2fea6eca7015ea72e883aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=8E?= <125556714+Topfunplus@users.noreply.github.com> Date: Mon, 16 Jun 2025 10:33:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E7=94=9F=E4=BA=A7=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/utils/HttpPostOtherSysImpl.java | 23 ++++++++++++++ .../commen/itf/utils/IHttpPostOtherSys.java | 2 ++ .../openapi/mmpac/pmo/PmoResource.java | 30 +++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/ic/src/private/nccloud/pubift/commen/impl/utils/HttpPostOtherSysImpl.java b/ic/src/private/nccloud/pubift/commen/impl/utils/HttpPostOtherSysImpl.java index f0f76b8..8c167f9 100644 --- a/ic/src/private/nccloud/pubift/commen/impl/utils/HttpPostOtherSysImpl.java +++ b/ic/src/private/nccloud/pubift/commen/impl/utils/HttpPostOtherSysImpl.java @@ -2,12 +2,15 @@ package nccloud.pubift.commen.impl.utils; import com.alibaba.fastjson.JSONObject; +import nc.bs.dao.BaseDAO; import nc.bs.framework.common.InvocationInfoProxy; import nc.bs.logging.Log; import nc.hr.utils.PubEnv; import nc.itf.arap.goldentax.SysParaInitQuery; +import nc.jdbc.framework.processor.ColumnProcessor; import nc.vo.am.common.util.StringUtils; import nc.vo.pub.BusinessException; +import nc.vo.pubapp.pattern.pub.SqlBuilder; import nccloud.pubift.commen.itf.utils.IHttpPostOtherSys; import org.apache.http.Header; import org.apache.http.HttpEntity; @@ -39,6 +42,7 @@ public class HttpPostOtherSysImpl implements IHttpPostOtherSys { private static final Log obmlog = Log.getInstance(LOG_INFO_NAME); + private static final BaseDAO dao = new BaseDAO(); @Override public String callMes(String url, JSONObject json) { String mesip = SysParaInitQuery.getParaString(PubEnv.getPk_group(), "MESIP"); @@ -237,4 +241,23 @@ public class HttpPostOtherSysImpl implements IHttpPostOtherSys { } } + /** + * 根据主键查询编码 + */ + public String transferCodeByPk(String tableName, String selectField, String pkField, String pk) throws BusinessException { + if (pk == null || pk.trim().isEmpty()) { + return null; + } + SqlBuilder sqlBuilder = new SqlBuilder(); + sqlBuilder.append(" select " + selectField); + sqlBuilder.append(" from " + tableName); + sqlBuilder.append(" where "); + sqlBuilder.append(pkField, pk); + Object o = dao.executeQuery(sqlBuilder.toString(), new ColumnProcessor()); + if (o == null) { + throw new BusinessException("未查询到编码信息,sql【" + sqlBuilder + "】"); + } + return o.toString(); + } + } diff --git a/ic/src/public/nccloud/pubift/commen/itf/utils/IHttpPostOtherSys.java b/ic/src/public/nccloud/pubift/commen/itf/utils/IHttpPostOtherSys.java index 77dacb0..f9ba9e2 100644 --- a/ic/src/public/nccloud/pubift/commen/itf/utils/IHttpPostOtherSys.java +++ b/ic/src/public/nccloud/pubift/commen/itf/utils/IHttpPostOtherSys.java @@ -28,4 +28,6 @@ public interface IHttpPostOtherSys { public boolean checkIfExcludeUser(); public boolean checkIfIncludeOrg(String code) throws BusinessException; + + public String transferCodeByPk(String tableName, String selectField, String pkField, String pk) throws BusinessException; } diff --git a/mmpac/src/public/nccloud/openapi/mmpac/pmo/PmoResource.java b/mmpac/src/public/nccloud/openapi/mmpac/pmo/PmoResource.java index c3bd234..cf7f9cd 100644 --- a/mmpac/src/public/nccloud/openapi/mmpac/pmo/PmoResource.java +++ b/mmpac/src/public/nccloud/openapi/mmpac/pmo/PmoResource.java @@ -10,6 +10,7 @@ import javax.ws.rs.Produces; import nc.bs.dao.BaseDAO; import nc.bs.dao.DAOException; import nc.bs.framework.common.NCLocator; +import nc.bs.logging.Log; import nc.jdbc.framework.processor.MapListProcessor; import nc.util.mmf.framework.base.MMCollectionUtil; import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO; @@ -17,6 +18,8 @@ import nc.vo.pub.BusinessException; import nc.ws.opm.pub.utils.result.APIErrCodeEnum; import nccloud.api.mmpac.pmo.IAPIPmoMaintainService; import nccloud.api.rest.utils.ResultMessageUtil; +import nccloud.pubift.commen.itf.utils.IHttpPostOtherSys; +import nc.bs.mmpac.pmo.pac0002.bp.PMORowPutBP; import nccloud.ws.rest.resource.AbstractNCCRestResource; import org.json.JSONString; @@ -26,10 +29,13 @@ public class PmoResource extends AbstractNCCRestResource { private static String BODYTABLE = "mm_mo"; private static String GRANDTABLE = "mm_pmo_procedure"; private static final BaseDAO BASE_DAO = new BaseDAO(); + IHttpPostOtherSys httpPostOtherSys = NCLocator.getInstance().lookup(IHttpPostOtherSys.class); + private static final Log logger = Log.getInstance("pmoresoucelogger"); public PmoResource() { } + // 找投放 调哪个接口 拿到接口 根据审批状态和组织判断 自动投放 @POST @Path("save") @Consumes({"application/json"}) @@ -50,9 +56,33 @@ public class PmoResource extends AbstractNCCRestResource { IAPIPmoMaintainService serv = (IAPIPmoMaintainService) NCLocator.getInstance().lookup(IAPIPmoMaintainService.class); insertBills = serv.save(paramList); + + // 遍历paramList,判断组织是否需要自动投放 + for (Map map : paramList) { + Map head = (Map) map.get(HEADTABLE); + if (head == null) continue; + String pk_org = (String) head.get("pk_org"); + String orgCode = null; + orgCode = httpPostOtherSys.transferCodeByPk("org_orgs", "code", "pk_org", pk_org); + logger.debug("转换pk_org[" + pk_org + "]为组织编码[" + orgCode + "]"); + boolean isIncludeOrg = false; + isIncludeOrg = httpPostOtherSys.checkIfIncludeOrg(orgCode); + logger.debug("检查是否为电缆[" + orgCode + "]返回:" + isIncludeOrg); + if (isIncludeOrg) { + PMORowPutBP rowPutBP = NCLocator.getInstance().lookup(PMORowPutBP.class); + try { + rowPutBP.rowput(insertBills); + logger.info("自动投放完成,orgCode=" + orgCode); + } catch (Exception e) { + logger.error("自动投放失败,orgCode=" + orgCode, e); + } + } + } + return ResultMessageUtil.toJSON(insertBills, "流程生产订单保存成功"); } } catch (Exception e) { + logger.error("流程生产订单保存异常", e); return ResultMessageUtil.exceptionToJSON(e); } }