diff --git a/.classpath b/.classpath index 8501716..74cbf75 100644 --- a/.classpath +++ b/.classpath @@ -1,5 +1,10 @@ + + + + + diff --git a/mmpub/META-INF/.gitkeep b/mmpub/META-INF/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/METADATA/.gitkeep b/mmpub/METADATA/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/component.xml b/mmpub/component.xml new file mode 100644 index 0000000..d1df635 --- /dev/null +++ b/mmpub/component.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/mmpub/config/billcodepredata/.gitkeep b/mmpub/config/billcodepredata/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/config/doc-lucene-config/.gitkeep b/mmpub/config/doc-lucene-config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/config/pfxx/.gitkeep b/mmpub/config/pfxx/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/config/tabconfig/.gitkeep b/mmpub/config/tabconfig/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/designmodel/ace/.gitkeep b/mmpub/designmodel/ace/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/designmodel/coderule/.gitkeep b/mmpub/designmodel/coderule/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/designmodel/funcmodel/.gitkeep b/mmpub/designmodel/funcmodel/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/designmodel/systemplatebase/.gitkeep b/mmpub/designmodel/systemplatebase/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/designmodel/templet/.gitkeep b/mmpub/designmodel/templet/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/doc/.gitkeep b/mmpub/doc/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/resources/.gitkeep b/mmpub/resources/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/script/business/.gitkeep b/mmpub/script/business/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/script/conf/.gitkeep b/mmpub/script/conf/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/script/dbcreate/.gitkeep b/mmpub/script/dbcreate/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/script/dbml/.gitkeep b/mmpub/script/dbml/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/src/client/.gitkeep b/mmpub/src/client/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/src/private/.gitkeep b/mmpub/src/private/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/SetAnalysisBP.java b/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/SetAnalysisBP.java new file mode 100644 index 0000000..8d989d1 --- /dev/null +++ b/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/SetAnalysisBP.java @@ -0,0 +1,85 @@ +package nc.bs.mmpub.setanalysis.bp; + +import nc.bs.mmpub.setanalysis.bp.log.SaMemoryBP; +import nc.bs.mmpub.setanalysis.bp.utils.SaLogger; +import nc.bs.mmpub.setanalysis.proxy.SaServiceProxy; +import nc.vo.mmpub.setanalysis.entity.AggAnalysisVO; +import nc.vo.mmpub.setanalysis.entity.SaContext; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFDateTime; +import nc.vo.pubapp.pattern.exception.ExceptionUtils; +import nc.bs.mmpub.setanalysis.bp.rule.analysisAfterCheckRule; +import nc.vo.mmpub.setanalysis.entity.SaAnalysisVO; +import nc.vo.mmpub.setanalysis.utils.SaMeasureUtil; +import nc.bs.mmpub.setanalysis.bp.utils.SaScaleUtil; +import nc.bs.mmpub.setanalysis.bp.utils.SaVOUtils; + +public class SetAnalysisBP { + private SaContext context; + + public SetAnalysisBP(SaContext context) { + this.context = context; + } + + public AggAnalysisVO[] doSetAnalysis() { + try { + addBeforeRule(); + SaLogger.init(); + UFDateTime tstarttime1 = new UFDateTime(); + SaLogger.debug("0.分析开始^^^^^^^^^^^^^^^^^^^^^^^^^^"); + + createMd5Function(); + + UFDateTime tstarttime2 = new UFDateTime(); + SaLogger.debug("1.收集数据"); + SaMemoryBP.printMemory(); + SaServiceProxy.getAnalysisService().gather_RequiresNew(this.context); + SaLogger.debug("数据收集共耗时:" + SaLogger.getRunTime(tstarttime2)); + + UFDateTime tstarttime3 = new UFDateTime(); + SaLogger.debug("2.执行匹配开始"); + SaServiceProxy.getAnalysisService().match_RequiresNew(this.context); + SaLogger.debug("匹配共耗时:" + SaLogger.getRunTime(tstarttime3)); + + UFDateTime tstarttime4 = new UFDateTime(); + SaLogger.debug("3.反算齐套开始"); + SaServiceProxy.getAnalysisService().multiStorey_RequiresNew(this.context); + SaLogger.debug("反算齐套结束,共耗时:" + SaLogger.getRunTime(tstarttime4)); + SaMemoryBP.printMemory(); + this.result(this.context.getAggs()); + this.analysisAfterCheckRule();// 分析后调用回写 + SaLogger.debug("齐套分析算法结束,共耗时:" + SaLogger.getRunTime(tstarttime1)); + return this.context.getAggs(); + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + SaLogger.error(e.getMessage()); + + return null; + } + } + + private void result(AggAnalysisVO[] aggs) { + SaScaleUtil scale = new SaScaleUtil(); + SaAnalysisVO[] savos = SaVOUtils.construcVOs(aggs); + scale.setScaleSuperVOs(savos, "cmeasureid", new String[] { "nsetsnum" }); + SaMeasureUtil.setAnalysisAssNum(aggs); + } + + private void printMemory(String operation) { + long totalMemory = Runtime.getRuntime().totalMemory() / 1024L / 1024L; + long freeMemory = Runtime.getRuntime().freeMemory() / 1024L / 1024L; + SaLogger.debug(operation + ":totalMemory->" + operation + "MB,freeMemory->" + totalMemory + "MB"); + } + + private void createMd5Function() { + (new SaFunctionBP()).createMD5(); + } + + private void addBeforeRule() { + + } + + private void analysisAfterCheckRule() { + (new analysisAfterCheckRule()).process(this.context.getAggs()); + } +} diff --git a/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/rule/analysisAfterCheckRule.java b/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/rule/analysisAfterCheckRule.java new file mode 100644 index 0000000..e898745 --- /dev/null +++ b/mmpub/src/private/nc/bs/mmpub/setanalysis/bp/rule/analysisAfterCheckRule.java @@ -0,0 +1,45 @@ +package nc.bs.mmpub.setanalysis.bp.rule; + +import nc.bs.dao.BaseDAO; +import nc.impl.pubapp.pattern.rule.IRule; +import nc.vo.mmpub.setanalysis.entity.AggAnalysisVO; +import nc.vo.mmpub.setanalysis.entity.SaAnalysisVO; +import nc.vo.pub.BusinessException; + +public class analysisAfterCheckRule implements IRule { + + @Override + public void process(AggAnalysisVO[] aggAnalysisVOS) { + try { + for (AggAnalysisVO vo : aggAnalysisVOS) { + SaAnalysisVO saAnalysisVO = vo.getParentVO(); + String cdemandbillbid = saAnalysisVO.getCdemandbillbid();//需求单据明细nsetsnum + Object ntotaloutnumsObj = saAnalysisVO.getNsetsnum();//齐套主数量ndemandnum + String ntotaloutnums = (ntotaloutnumsObj != null) ? ntotaloutnumsObj.toString() : ""; + double ntotaloutnum = + (ntotaloutnums.isEmpty()) ? 0 : Double.parseDouble(ntotaloutnums);//齐套主数量 + Object ndemandnumObj = saAnalysisVO.getNdemandnum();//分析主数量 + String ndemandnums = (ndemandnumObj != null) ? ndemandnumObj.toString() : ""; + double ndemandnum = + (ndemandnums.isEmpty()) ? 0 : Double.parseDouble(ndemandnums);//分析数量 + double vdef4 = 0; + if (ndemandnum != 0) { + vdef4 = ntotaloutnum / ndemandnum; + } + String update = + " update mm_mo set vdef6=" + ntotaloutnum + ",vdef4=" + vdef4 + " where cmoid='" + + cdemandbillbid + "' "; + updateSaleBSQty(update); + } + } catch (BusinessException e) { + throw new RuntimeException(e); + } + } + + private int updateSaleBSQty(String sql) throws BusinessException { + BaseDAO baseDAO = new BaseDAO(); + int succInt = baseDAO.executeUpdate(sql); + return succInt; + } + +} diff --git a/mmpub/src/public/.gitkeep b/mmpub/src/public/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/mmpub/src/test/.gitkeep b/mmpub/src/test/.gitkeep new file mode 100644 index 0000000..e69de29