From ef7078fc2b5b1e0d24804186a6aacfd70fdeb858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=B5=B7=E4=BA=AE?= Date: Sun, 22 Sep 2024 19:17:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=B7=A5=E5=85=B7=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/nc/bs/pu/dhjyd/PfDhjydMasterVOCheck.class | Bin 2290 -> 2290 bytes ic/META-INF/ncc2egap.upm | 11 + .../nc/impl/ic/egap/INCCForEGAPImpl.java | 45 +++ .../formmode/webservices/SysFomForHttp.java | 133 +++++++++ ic/src/public/nc/bd/itf/tools/BFPubTools.java | 233 +++++++++++++++ .../nc/pubitf/ic/egap/INCCForEGAPIntf.java | 17 ++ .../AggDhjydMasterVOExcelOutputProcessor.java | 282 +++++++++--------- .../nc/bs/pu/dhjyd/PfDhjydMasterVOCheck.java | 106 +++---- 8 files changed, 634 insertions(+), 193 deletions(-) create mode 100644 ic/META-INF/ncc2egap.upm create mode 100644 ic/src/private/nc/impl/ic/egap/INCCForEGAPImpl.java create mode 100644 ic/src/private/weaver/formmode/webservices/SysFomForHttp.java create mode 100644 ic/src/public/nc/bd/itf/tools/BFPubTools.java create mode 100644 ic/src/public/nc/pubitf/ic/egap/INCCForEGAPIntf.java diff --git a/bin/nc/bs/pu/dhjyd/PfDhjydMasterVOCheck.class b/bin/nc/bs/pu/dhjyd/PfDhjydMasterVOCheck.class index eb91d387167db5b8bcc46241acc6be8052adb911..f53f296f21fcce79d5e7ca066ab9435ae7c5c131 100644 GIT binary patch delta 85 zcmew)_(^bsGCQN_WEJ)krjiVN3{njI3^EMj46+Q03~~(W3m0AEB6h5!Hn delta 85 zcmV~$u?;{#06@{NIvRrF1Q8d6AR$6;0}Z_?3}A&D!2-t6SjGh2``pjHGhz5T7tbWI o32+FJL?~iP5=K&HG8S@H3N|WsY7QDsTCL2>>JapJ4Ei;TA6bYEVgLXD diff --git a/ic/META-INF/ncc2egap.upm b/ic/META-INF/ncc2egap.upm new file mode 100644 index 0000000..28cee2a --- /dev/null +++ b/ic/META-INF/ncc2egap.upm @@ -0,0 +1,11 @@ + + + + + nc.pubitf.ic.egap.INCCForEGAPIntf + nc.impl.ic.egap.INCCForEGAPImpl + + + + + diff --git a/ic/src/private/nc/impl/ic/egap/INCCForEGAPImpl.java b/ic/src/private/nc/impl/ic/egap/INCCForEGAPImpl.java new file mode 100644 index 0000000..3e13fa4 --- /dev/null +++ b/ic/src/private/nc/impl/ic/egap/INCCForEGAPImpl.java @@ -0,0 +1,45 @@ +package nc.impl.ic.egap; + + + + +import nc.bs.dao.BaseDAO; +import nc.jdbc.framework.processor.ColumnProcessor; + +import nc.pubitf.ic.egap.INCCForEGAPIntf; + +import nc.vo.pub.BusinessException; + +import weaver.formmode.webservices.SysFomForHttp; + +public class INCCForEGAPImpl implements INCCForEGAPIntf { + + public BaseDAO dao=null; + + public BaseDAO getDao() { + if(dao==null) { + dao=new BaseDAO(); + } + return dao; + } + + + + @Override + public void sendEGAP(String json, String mothodCode,String pk) throws BusinessException { + String ulr=getUrl(mothodCode); + new SysFomForHttp().doPost(ulr,null,null,null,json,null); + } + + private String getUrl(String string) throws BusinessException { + String sql=" select url from pub_url where code='"+string+"' "; + + Object o=getDao().executeQuery(sql, new ColumnProcessor()); + if(o==null) { + throw new BusinessException("编码为"+string+"EPAP接口为空,请设置接口地址"); + } + return o.toString(); + } + + +} diff --git a/ic/src/private/weaver/formmode/webservices/SysFomForHttp.java b/ic/src/private/weaver/formmode/webservices/SysFomForHttp.java new file mode 100644 index 0000000..dd50616 --- /dev/null +++ b/ic/src/private/weaver/formmode/webservices/SysFomForHttp.java @@ -0,0 +1,133 @@ +package weaver.formmode.webservices; + + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +import nc.vo.pub.BusinessException; + +import org.apache.http.NameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; + + +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +import java.util.*; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; + +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.Charset; + + + + +public class SysFomForHttp { + + + + + + public String doPost(String baseUrl, Map paramMap, String mediaType, Map headers, String json,String pk) throws BusinessException{ + + HttpURLConnection urlConnection = null; + InputStream in = null; + OutputStream out = null; + BufferedReader bufferedReader = null; + String result = null; + + try { + StringBuffer sb = new StringBuffer(); + sb.append(baseUrl); + if (paramMap != null) { + sb.append("?"); + for (Map.Entry entry : paramMap.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + sb.append(key + "=" + value).append("&"); + } + baseUrl = sb.toString().substring(0, sb.toString().length() - 1); + } + + + URL urlObj = new URL(baseUrl); + urlConnection = (HttpURLConnection) urlObj.openConnection(); + urlConnection.setConnectTimeout(50000); + urlConnection.setRequestMethod("POST"); + urlConnection.setDoOutput(true); + urlConnection.setDoInput(true); + urlConnection.setUseCaches(false); + urlConnection.addRequestProperty("content-type", "multipart/form-data"); + if (headers != null) { + for (String key : headers.keySet()) { + urlConnection.addRequestProperty(key, headers.get(key)); + } + } + out = urlConnection.getOutputStream(); + out.write(json.getBytes("utf-8")); + out.flush(); + + int resCode = urlConnection.getResponseCode(); + if (resCode == HttpURLConnection.HTTP_OK || resCode == HttpURLConnection.HTTP_CREATED || resCode == HttpURLConnection.HTTP_ACCEPTED) { + in = urlConnection.getInputStream(); + } else { + in = urlConnection.getErrorStream(); + } + bufferedReader = new BufferedReader(new InputStreamReader(in, "utf-8")); + StringBuffer temp = new StringBuffer(); + String line = bufferedReader.readLine(); + while (line != null) { + temp.append(line).append("\r\n"); + line = bufferedReader.readLine(); + } + String ecod = urlConnection.getContentEncoding(); + if (ecod == null) { + ecod = Charset.forName("utf-8").name(); + } + result = new String(temp.toString().getBytes("utf-8"), ecod); + + } catch (Exception e) { + throw new BusinessException(e.getMessage()); + } finally { + + + if (null != bufferedReader) { + try { + bufferedReader.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != out) { + try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != in) { + try { + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + urlConnection.disconnect(); + } + return result; + } + +} \ No newline at end of file diff --git a/ic/src/public/nc/bd/itf/tools/BFPubTools.java b/ic/src/public/nc/bd/itf/tools/BFPubTools.java new file mode 100644 index 0000000..331a438 --- /dev/null +++ b/ic/src/public/nc/bd/itf/tools/BFPubTools.java @@ -0,0 +1,233 @@ +package nc.bd.itf.tools; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import nc.vo.pub.lang.UFBoolean; +import nc.vo.pub.lang.UFDate; +import nc.vo.pub.lang.UFDateTime; +import nc.vo.pub.lang.UFDouble; + +public class BFPubTools +{ + public static UFDouble ZERO = UFDouble.ZERO_DBL; + + public static boolean isEmpty(String value) + { + return (value == null) || (value.trim().length() == 0); + } + + public static UFBoolean getUFBoolean_NullAs(Object value, UFBoolean bDefautValue) + { + if ((value == null) || (value.toString().trim().equals(""))) + return bDefautValue; + if ((value instanceof UFBoolean)) { + return (UFBoolean)value; + } + return new UFBoolean(value.toString().trim()); + } + + public static UFDate getUFDate(Object value) + { + if ((value == null) || (value.toString().trim().equals(""))) + return null; + if ((value instanceof UFDate)) { + return (UFDate)value; + } + return new UFDate(value.toString().trim()); + } + + public static UFDateTime getUFDateTime(Object value) + { + if ((value == null) || (value.toString().trim().equals(""))) + return null; + if ((value instanceof UFDateTime)) { + return (UFDateTime)value; + } + return new UFDateTime(value.toString().trim()); + } + + public static UFDouble getUFDouble_NullAsZero(Object value) + { + if ((value == null) || (value.toString().trim().equals("")) || (value.toString().trim().equals("~"))) + return ZERO; + if ((value instanceof UFDouble)) + return (UFDouble)value; + if ((value instanceof BigDecimal)) { + return new UFDouble((BigDecimal)value); + } + return new UFDouble(value.toString().trim()); + } + + public static UFDouble getUFDouble_ValueAsValue(double dValue) + { + if (dValue == 0.0D) { + return ZERO; + } + return new UFDouble(dValue); + } + + public static UFDouble getUFDouble_ValueAsValue(Object value) + { + if ((value == null) || (value.toString().trim().equals(""))) + return null; + if ((value instanceof UFDouble)) + return (UFDouble)value; + if ((value instanceof BigDecimal)) { + return new UFDouble((BigDecimal)value); + } + return new UFDouble(value.toString().trim()); + } + + public static UFDouble getUFDouble_ZeroAsNull(double dValue) + { + if (dValue == 0.0D) { + return null; + } + return new UFDouble(dValue); + } + + public static UFDouble getUFDouble_ZeroAsNull(Object value) + { + UFDouble dValue = getUFDouble_NullAsZero(value); + if (dValue.compareTo(ZERO) == 0) { + return null; + } + return dValue; + } + + public static String getString_TrimZeroLenAsNull(Object value) + { + if ((value == null) || (value.toString().trim().length() == 0)) { + return null; + } + return value.toString().trim(); + } + + public static String getString_TrimZeroLenAs(Object value, String str) + { + if ((value == null) || (value.toString().trim().length() == 0)) { + return str; + } + return value.toString().trim(); + } + + public static String getString_TrimAsNull(Object value) { + if ((value == null) || (value.toString().trim().length() == 0)) { + return ""; + } + return value.toString().trim(); + } + + public static String getInStr(Collection coll) + { + String intStr = null; + if ((coll != null) && (coll.size() > 0)) { + StringBuilder sb = new StringBuilder(); + String[] values = (String[])coll.toArray(new String[0]); + for (int i = 0; i < values.length; i++) { + sb.append("'").append(values[i]).append("'"); + if (i < values.length - 1) + sb.append(","); + } + intStr = sb.toString(); + } + return intStr; + } + + public static String getInSqlWithOutAnd(String sFieldName, ArrayList alValue, int start, int num) + { + if ((sFieldName == null) || (sFieldName.trim().length() == 0) || + (alValue == null) || (start < 0) || (num < 0)) + return null; + StringBuffer sbSQL = new StringBuffer(200); + sbSQL.append(" (").append(sFieldName).append(" IN ("); + int end = start + num; + for (int i = start; i < end; i++) { + if ((alValue.get(i) != null) && + (alValue.get(i).toString().trim().length() > 0)) { + sbSQL.append("'").append(alValue.get(i)).append("'"); + if ((i != alValue.size() - 1) && ((i <= 0) || (i % 200 != 0))) + sbSQL.append(","); + } else { + return null; + } + if ((i > 0) && (i % 200 == 0)) + sbSQL.append(" ) OR ").append(sFieldName).append(" IN ( "); + } + sbSQL.append(" ) )"); + return sbSQL.toString(); + } + public static String getInSqlWithOutAnd(String sFieldName, List alValue, int start, int num) + { + if ((sFieldName == null) || (sFieldName.trim().length() == 0) || + (alValue == null) || (start < 0) || (num < 0)) + return null; + StringBuffer sbSQL = new StringBuffer(200); + sbSQL.append(" (").append(sFieldName).append(" IN ("); + int end = start + num; + for (int i = start; i < end; i++) { + if ((alValue.get(i) != null) && + (alValue.get(i).toString().trim().length() > 0)) { + sbSQL.append("'").append(alValue.get(i)).append("'"); + if ((i != alValue.size() - 1) && ((i <= 0) || (i % 200 != 0))) + sbSQL.append(","); + } else { + return null; + } + if ((i > 0) && (i % 200 == 0)) + sbSQL.append(" ) OR ").append(sFieldName).append(" IN ( "); + } + sbSQL.append(" ) )"); + return sbSQL.toString(); + } + public static String getInSqlWithOutAnd(String sFieldName, String[] saValue, int start, int num) + { + if ((sFieldName == null) || (sFieldName.trim().length() == 0) || + (saValue == null) || (start < 0) || (num < 0) || + (saValue.length < start + num)) + return null; + StringBuffer sbSQL = new StringBuffer(200); + sbSQL.append(" (").append(sFieldName).append(" IN ( "); + int end = start + num; + for (int i = start; i < end; i++) { + if ((saValue[i] != null) && (saValue[i].trim().length() > 0)) { + sbSQL.append("'").append(saValue[i]).append("'"); + if ((i != saValue.length - 1) && ((i <= 0) || (i % 200 != 0))) + sbSQL.append(","); + } else { + return null; + } + if ((i > 0) && (i % 200 == 0)) + sbSQL.append(" ) OR ").append(sFieldName).append(" IN ( "); + } + sbSQL.append(" ) )"); + return sbSQL.toString(); + } + + public static String getInSqlWithOutAnd(String sFieldName, Object[] oValue, int start, int num) { + if ((sFieldName == null) || (sFieldName.trim().length() == 0) || + (oValue == null) || (start < 0) || (num < 0) || + (oValue.length < start + num)) + return null; + StringBuffer sbSQL = new StringBuffer(200); + sbSQL.append(" (").append(sFieldName).append(" IN ( "); + int end = start + num; + for (int i = start; i < end; i++) { + String sValue = getString_TrimZeroLenAsNull(oValue); + if (oValue[i] != null) { + sbSQL.append("'").append(sValue).append("'"); + if ((i != oValue.length - 1) && ((i <= 0) || (i % 200 != 0))) + sbSQL.append(","); + } else { + return null; + } + if ((i > 0) && (i % 200 == 0)) + sbSQL.append(" ) OR ").append(sFieldName).append(" IN ( "); + } + sbSQL.append(" ) )"); + return sbSQL.toString(); + } +} \ No newline at end of file diff --git a/ic/src/public/nc/pubitf/ic/egap/INCCForEGAPIntf.java b/ic/src/public/nc/pubitf/ic/egap/INCCForEGAPIntf.java new file mode 100644 index 0000000..e4017cf --- /dev/null +++ b/ic/src/public/nc/pubitf/ic/egap/INCCForEGAPIntf.java @@ -0,0 +1,17 @@ +package nc.pubitf.ic.egap; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import com.alibaba.fastjson.JSONObject; + +import nc.vo.mmpac.dmo.entity.AggDmoVO; +import nc.vo.pu.m23.entity.ArriveVO; +import nc.vo.pub.BusinessException; +import nc.vo.bd.bankaccount.cust.CustBankaccUnionVO; +public interface INCCForEGAPIntf { + //json ,接口编码 ,单据pk + public void sendEGAP(String json,String mothodCode,String pk)throws BusinessException; + + +} diff --git a/pu/src/private/nc/impl/pu/dhjyd/dhjydmaster/AggDhjydMasterVOExcelOutputProcessor.java b/pu/src/private/nc/impl/pu/dhjyd/dhjydmaster/AggDhjydMasterVOExcelOutputProcessor.java index c7c7cb2..048b31b 100644 --- a/pu/src/private/nc/impl/pu/dhjyd/dhjydmaster/AggDhjydMasterVOExcelOutputProcessor.java +++ b/pu/src/private/nc/impl/pu/dhjyd/dhjydmaster/AggDhjydMasterVOExcelOutputProcessor.java @@ -1,141 +1,141 @@ - -package nc.impl.pu.dhjyd.dhjydmaster; - -import java.io.File; -import java.util.List; -import java.util.Map; - -import nc.md.MDBaseQueryFacade; -import nc.md.model.IBusinessEntity; -import nc.md.model.MetaDataException; -import nc.ui.bd.ref.AbstractRefModel; -import nc.bs.framework.common.NCLocator; -import nc.vo.platform.appsystemplate.AreaVO; -import nc.vo.platform.appsystemplate.FormPropertyVO; -import nc.vo.pub.BusinessException; -import nc.vo.pub.ExtendedAggregatedValueObject; -import nccloud.bs.excel.process.AbstractExcelOutputProcessor; -import nccloud.itf.trade.excelexport.convertor.IRefPropertyProcess; -import nccloud.itf.trade.excelimport.ExportDataInfo; -import nccloud.ui.trade.excelimport.InputItem; -import nccloud.vo.excel.scheme.BillDefination; - -import nc.vo.pu.dhjyd.AggDhjydMasterVO; -import nc.itf.pu.dhjyd.dhjydmaster.IDhjydMasterVOService; -/* - * 导出 - */ -public class AggDhjydMasterVOExcelOutputProcessor extends AbstractExcelOutputProcessor { - - @Override - public File writeExportData(String filename, Object[] values, List inputitems, - BillDefination billDefination) throws Exception { - return super.writeExportData(filename, values, inputitems, billDefination); - } - - @Override - public File writeExportData(String filename, Object[] values, List inputitems, - BillDefination billDefination, boolean isExportByTemp, Map areamap) throws Exception { - return super.writeExportData(filename, values, inputitems, billDefination, isExportByTemp, areamap); - } - - @Override - public Object[] getObjectValueByPks(String[] pks) throws BusinessException { - // 要改成调用接口根据前端传过来的pks参数查询对应VO返回 - AggDhjydMasterVO[] queryResult = getService().listAggDhjydMasterVOByPk(pks); - if (queryResult == null || queryResult.length <= 0) { - return null; - } - return queryResult; - } - - @Override - protected ExportDataInfo getValue(Object[] vos, List exportItems, BillDefination billdefination) - throws BusinessException { - ExtendedAggregatedValueObject[] aggvos = getConvertorForTemp(new DefRefPropertyProcess()) - .convertDataFromEditorData(billdefination, vos, exportItems); - return new ExportDataInfo(aggvos); - } - - @Override - public void setAreamap(Map areamap) { - super.setAreamap(areamap); - } - - private IDhjydMasterVOService getService() { - return NCLocator.getInstance().lookup(IDhjydMasterVOService.class); - } - class DefRefPropertyProcess implements IRefPropertyProcess{ - - @Override - public void ProcessRefProperty(AbstractRefModel refmodel) { - refmodel.setSealedDataShow(true); - } - - @Override - public AbstractRefModel getRefModelByProperty(FormPropertyVO property) { - String classid = property.getClassid(); - String pid = null; - try { - IBusinessEntity entity = (IBusinessEntity)MDBaseQueryFacade.getInstance().getBeanByID(classid); - pid = entity.getBizInterfaceMapInfo("nc.vo.bd.meta.IBDObject") == null ? null : entity.getBizInterfaceMapInfo("nc.vo.bd.meta.IBDObject").get("pid"); - } catch (MetaDataException e) { - throw new RuntimeException(e); - } - // 1、判断是否有树形上级参照自身字段 - if("04dd87e3-2bda-45d5-879b-3e320a4bc3d3".equals(classid) && pid != null && pid.equals(property.getCode())) { - DefAbstractRefModel refModel = new DefAbstractRefModel(property); - return refModel; - } - return null; - }} - class DefAbstractRefModel extends AbstractRefModel{ - FormPropertyVO property; - String tablename; - String pkcolname; - String pkattrname; - String codename; - String namename; - public DefAbstractRefModel(FormPropertyVO property) { - super(); - this.property = property; - String classid = property.getClassid(); - IBusinessEntity entity; - Map bizInterfaceMapInfo; - try { - entity = (IBusinessEntity)MDBaseQueryFacade.getInstance().getBeanByID(classid); - bizInterfaceMapInfo = entity.getBizInterfaceMapInfo("nc.vo.bd.meta.IBDObject"); - } catch (MetaDataException e) { - throw new RuntimeException(e); - } - tablename = entity.getTable().getName(); - pkcolname = entity.getKeyAttribute().getColumn().getName(); - pkattrname = entity.getKeyAttribute().getName(); - codename = bizInterfaceMapInfo.get("code"); - namename = bizInterfaceMapInfo.get("name"); - this.reset(); - } - @Override - public void reset() { - this.setFieldCode(new String[] {codename}); - this.setFieldName(new String[] {namename}); - this.setTableName(this.tablename); - this.setPkFieldCode(this.pkattrname); - this.setRefCodeField(codename); - this.setRefNameField(namename); - this.resetFieldName(); - } - @Override - public String[] getFieldCode() { - return new String[] {pkcolname, codename, namename}; - } - @Override - public String[] getFieldName() { - return new String[] {pkcolname, codename, namename}; - } - @Override - public String getWherePart() { - return " 1 = 1 "; - } - } -} + +package nc.impl.pu.dhjyd.dhjydmaster; + +import java.io.File; +import java.util.List; +import java.util.Map; + +import nc.md.MDBaseQueryFacade; +import nc.md.model.IBusinessEntity; +import nc.md.model.MetaDataException; +import nc.ui.bd.ref.AbstractRefModel; +import nc.bs.framework.common.NCLocator; +import nc.vo.platform.appsystemplate.AreaVO; +import nc.vo.platform.appsystemplate.FormPropertyVO; +import nc.vo.pub.BusinessException; +import nc.vo.pub.ExtendedAggregatedValueObject; +import nccloud.bs.excel.process.AbstractExcelOutputProcessor; +import nccloud.itf.trade.excelexport.convertor.IRefPropertyProcess; +import nccloud.itf.trade.excelimport.ExportDataInfo; +import nccloud.ui.trade.excelimport.InputItem; +import nccloud.vo.excel.scheme.BillDefination; + +import nc.vo.pu.dhjyd.AggDhjydMasterVO; +import nc.itf.pu.dhjyd.dhjydmaster.IDhjydMasterVOService; +/* + * 导出 + */ +public class AggDhjydMasterVOExcelOutputProcessor extends AbstractExcelOutputProcessor { +//z住宿 + @Override + public File writeExportData(String filename, Object[] values, List inputitems, + BillDefination billDefination) throws Exception { + return super.writeExportData(filename, values, inputitems, billDefination); + } + + @Override + public File writeExportData(String filename, Object[] values, List inputitems, + BillDefination billDefination, boolean isExportByTemp, Map areamap) throws Exception { + return super.writeExportData(filename, values, inputitems, billDefination, isExportByTemp, areamap); + } + + @Override + public Object[] getObjectValueByPks(String[] pks) throws BusinessException { + // 要改成调用接口根据前端传过来的pks参数查询对应VO返回 + AggDhjydMasterVO[] queryResult = getService().listAggDhjydMasterVOByPk(pks); + if (queryResult == null || queryResult.length <= 0) { + return null; + } + return queryResult; + } + + @Override + protected ExportDataInfo getValue(Object[] vos, List exportItems, BillDefination billdefination) + throws BusinessException { + ExtendedAggregatedValueObject[] aggvos = getConvertorForTemp(new DefRefPropertyProcess()) + .convertDataFromEditorData(billdefination, vos, exportItems); + return new ExportDataInfo(aggvos); + } + + @Override + public void setAreamap(Map areamap) { + super.setAreamap(areamap); + } + + private IDhjydMasterVOService getService() { + return NCLocator.getInstance().lookup(IDhjydMasterVOService.class); + } + class DefRefPropertyProcess implements IRefPropertyProcess{ + + @Override + public void ProcessRefProperty(AbstractRefModel refmodel) { + refmodel.setSealedDataShow(true); + } + + @Override + public AbstractRefModel getRefModelByProperty(FormPropertyVO property) { + String classid = property.getClassid(); + String pid = null; + try { + IBusinessEntity entity = (IBusinessEntity)MDBaseQueryFacade.getInstance().getBeanByID(classid); + pid = entity.getBizInterfaceMapInfo("nc.vo.bd.meta.IBDObject") == null ? null : entity.getBizInterfaceMapInfo("nc.vo.bd.meta.IBDObject").get("pid"); + } catch (MetaDataException e) { + throw new RuntimeException(e); + } + // 1、判断是否有树形上级参照自身字段 + if("04dd87e3-2bda-45d5-879b-3e320a4bc3d3".equals(classid) && pid != null && pid.equals(property.getCode())) { + DefAbstractRefModel refModel = new DefAbstractRefModel(property); + return refModel; + } + return null; + }} + class DefAbstractRefModel extends AbstractRefModel{ + FormPropertyVO property; + String tablename; + String pkcolname; + String pkattrname; + String codename; + String namename; + public DefAbstractRefModel(FormPropertyVO property) { + super(); + this.property = property; + String classid = property.getClassid(); + IBusinessEntity entity; + Map bizInterfaceMapInfo; + try { + entity = (IBusinessEntity)MDBaseQueryFacade.getInstance().getBeanByID(classid); + bizInterfaceMapInfo = entity.getBizInterfaceMapInfo("nc.vo.bd.meta.IBDObject"); + } catch (MetaDataException e) { + throw new RuntimeException(e); + } + tablename = entity.getTable().getName(); + pkcolname = entity.getKeyAttribute().getColumn().getName(); + pkattrname = entity.getKeyAttribute().getName(); + codename = bizInterfaceMapInfo.get("code"); + namename = bizInterfaceMapInfo.get("name"); + this.reset(); + } + @Override + public void reset() { + this.setFieldCode(new String[] {codename}); + this.setFieldName(new String[] {namename}); + this.setTableName(this.tablename); + this.setPkFieldCode(this.pkattrname); + this.setRefCodeField(codename); + this.setRefNameField(namename); + this.resetFieldName(); + } + @Override + public String[] getFieldCode() { + return new String[] {pkcolname, codename, namename}; + } + @Override + public String[] getFieldName() { + return new String[] {pkcolname, codename, namename}; + } + @Override + public String getWherePart() { + return " 1 = 1 "; + } + } +} diff --git a/pu/src/public/nc/bs/pu/dhjyd/PfDhjydMasterVOCheck.java b/pu/src/public/nc/bs/pu/dhjyd/PfDhjydMasterVOCheck.java index 2f335fe..27063ed 100644 --- a/pu/src/public/nc/bs/pu/dhjyd/PfDhjydMasterVOCheck.java +++ b/pu/src/public/nc/bs/pu/dhjyd/PfDhjydMasterVOCheck.java @@ -1,52 +1,54 @@ -package nc.bs.pu.dhjyd; - -import nc.bs.dao.BaseDAO; -import nc.bs.pub.pf.CheckStatusCallbackContext; -import nc.bs.pub.pf.ICheckStatusCallback; -import nc.itf.uap.pf.metadata.IFlowBizItf; -import nc.md.data.access.NCObject; -import nc.vo.pub.AggregatedValueObject; -import nc.vo.pub.BusinessException; -import nc.vo.pub.SuperVO; - -/** -* 对应单据类型中的审批流检查类。 -* 检查过程判断如果不是终止流程则会return返回。 -* 如果从流程实例管理节点终止流程实例,或者收回单据时会更新单据状态。 -*/ -public class PfDhjydMasterVOCheck implements ICheckStatusCallback { - - private BaseDAO baseDAO = null; - - @Override - public void callCheckStatus(CheckStatusCallbackContext cscc) throws BusinessException { - if (!cscc.isTerminate()||cscc.getBillVo()==null) { - return ; - } - NCObject ncObj = NCObject.newInstance(cscc.getBillVo()); - IFlowBizItf itf = ncObj.getBizInterface(IFlowBizItf.class); - String[] fields = new String[1]; - // 从上下文获取审批状态 - itf.setApproveStatus(cscc.getCheckStatus()); - // 审批状态的字段 - fields[0] = itf.getColumnName(IFlowBizItf.ATTRIBUTE_APPROVESTATUS); - - // 保存修改后数据 - SuperVO vo = (SuperVO) ((AggregatedValueObject) cscc.getBillVo()).getParentVO(); - if(vo==null){ - return; - } - // 更新vo - getBaseDAO().updateVO(vo, fields); - // 更新parentVO - vo = (SuperVO) getBaseDAO().retrieveByPK(vo.getClass(), vo.getPrimaryKey()); - ((AggregatedValueObject) cscc.getBillVo()).setParentVO(vo); - } - - private BaseDAO getBaseDAO() { - if (baseDAO == null) { - baseDAO = new BaseDAO(); - } - return baseDAO; - } -} +package nc.bs.pu.dhjyd; + +import nc.bs.dao.BaseDAO; +import nc.bs.pub.pf.CheckStatusCallbackContext; +import nc.bs.pub.pf.ICheckStatusCallback; +import nc.itf.uap.pf.metadata.IFlowBizItf; +import nc.md.data.access.NCObject; +import nc.vo.pub.AggregatedValueObject; +import nc.vo.pub.BusinessException; +import nc.vo.pub.SuperVO; + +/** +* 对应单据类型中的审批流检查类。 +* 检查过程判断如果不是终止流程则会return返回。 +* 如果从流程实例管理节点终止流程实例,或者收回单据时会更新单据状态。 +*/ +public class PfDhjydMasterVOCheck implements ICheckStatusCallback { + + + + private BaseDAO baseDAO = null; + + @Override + public void callCheckStatus(CheckStatusCallbackContext cscc) throws BusinessException { + if (!cscc.isTerminate()||cscc.getBillVo()==null) { + return ; + } + NCObject ncObj = NCObject.newInstance(cscc.getBillVo()); + IFlowBizItf itf = ncObj.getBizInterface(IFlowBizItf.class); + String[] fields = new String[1]; + // 从上下文获取审批状态 + itf.setApproveStatus(cscc.getCheckStatus()); + // 审批状态的字段 + fields[0] = itf.getColumnName(IFlowBizItf.ATTRIBUTE_APPROVESTATUS); + + // 保存修改后数据 + SuperVO vo = (SuperVO) ((AggregatedValueObject) cscc.getBillVo()).getParentVO(); + if(vo==null){ + return; + } + // 更新vo + getBaseDAO().updateVO(vo, fields); + // 更新parentVO + vo = (SuperVO) getBaseDAO().retrieveByPK(vo.getClass(), vo.getPrimaryKey()); + ((AggregatedValueObject) cscc.getBillVo()).setParentVO(vo); + } + + private BaseDAO getBaseDAO() { + if (baseDAO == null) { + baseDAO = new BaseDAO(); + } + return baseDAO; + } +}