|
楼主 |
发表于 2017-4-17 10:26:14
|
显示全部楼层
当 aggregate 设置如下:SUM(HX_ProjectApply.fContactValue) as ConValue,
SUM(HX_ProjectApply.fMargin) as Margin,
SUM(HX_ProjectApply.fQMGZK) as QMGZK,
SUM(HX_ProjectApply.fSXRZE) as SXRZE,
SUM(HX_ProjectApply.fContactValue*HX_ProjectApply.fYJIRR)/SUM(HX_ProjectApply.fContactValue) as IRR,
SUM(SQL.isnull((select sum(FI_RentWriteOff.fIncome) from FI_RentWriteOff FI_RentWriteOff where FI_RentWriteOff.fXJLID in (select HX_YJXJL from HX_YJXJL HX_YJXJL where HX_YJXJL.fLXID = HX_ProjectApply AND HX_YJXJL.fQC <> 0 ) ), 0)) as yszf
报错选下:2017-04-17 08:35:50 excute stream action, params:{"accept":"application/json","action":"queryHX_ProjectApplyAction","actionFlag":"__action_0__","activity":"LoanCompleteActivity","contentType":"json","executeContext":"","executor":"","parameters":{"aggregateColumns":"ConValue,IRR,Margin,QMGZK,SXRZE,ysz","columns":"HX_ProjectApply,WSZJ,YSZLF,fAttachment,fBLDYRY,fBLDYSJ,fBZJCLFS,fBusinessType,fConHireDate,fContact,fContactValue,fContractDate,fContractMode,fContractNo,fContractPerson,fCustomCode,fCustomName,fCustomShortName,fDYDJSBH,fDYHTBH,fDeviceNo,fDevicePrice,fDuration,fEndDate,fEndFlag,fFirstPayment,fFirstPaymentRatio,fFlag,fGuaranteeType,fGuarantor,fGuarantorID,fHanding,fHandingRate,fHireDate,fIntentCode,fLoanCompleteMark,fLoanType,fMQFKR,fMargin,fMarginRate,fMortgage,fPrefix,fProcessName,fProjectCode,fQMGZK,fRFXL,fRepayCyc,fResidence,fSBFZDD,fSBGG,fSBLX,fSBMC,fSBSCS,fSBXH,fSBXSS,fSSBZ,fSXRZE,fSupShortName,fSupplier,fSupplierNo,fTrackNo,fValue,fYJIRR,fZLQMCLFS,version","filter":"(HX_ProjectApply.fFlag ='1' and HX_ProjectApply.fEndFlag ='0' and HX_ProjectApply.fLoanType ='分次放款' and HX_ProjectApply.fLoanCompleteMark ='0')","limit":-1,"offset":0,"variables":{}},"process":"/FinancialLease/HD/process/Lease/leaseProcess","translateParameter":{"cellnameByRelation":false,"dataType":"row-list","includeState":true,"rowsConfig":{"concept":"HX_ProjectApply","sequence":"HX_ProjectApply,WSZJ,YSZLF,fAttachment,fBLDYRY,fBLDYSJ,fBZJCLFS,fBusinessType,fConHireDate,fContact,fContactValue,fContractDate,fContractMode,fContractNo,fContractPerson,fCustomCode,fCustomName,fCustomShortName,fDYDJSBH,fDYHTBH,fDeviceNo,fDevicePrice,fDuration,fEndDate,fEndFlag,fFirstPayment,fFirstPaymentRatio,fFlag,fGuaranteeType,fGuarantor,fGuarantorID,fHanding,fHandingRate,fHireDate,fIntentCode,fLoanCompleteMark,fLoanType,fMQFKR,fMargin,fMarginRate,fMortgage,fPrefix,fProcessName,fProjectCode,fQMGZK,fRFXL,fRepayCyc,fResidence,fSBFZDD,fSBGG,fSBLX,fSBMC,fSBSCS,fSBXH,fSBXSS,fSSBZ,fSXRZE,fSupShortName,fSupplier,fSupplierNo,fTrackNo,fValue,fYJIRR,fZLQMCLFS,version"},"transformIdcolumn":true,"useNamespace":true}}
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.justep.system.action.Engine.invokeActions(Native Method)
at com.justep.system.action.Engine.invokeActions(Unknown Source)
at com.justep.business.server.BusinessServer.doAction(Unknown Source)
at com.justep.business.server.BusinessServer.doExcute(Unknown Source)
at com.justep.business.server.BusinessServer.excute(Unknown Source)
at com.justep.business.server.BusinessServer.excute(Unknown Source)
at com.justep.business.server.BusinessServerServlet.execService(Unknown Source)
at com.justep.business.server.BusinessServerServlet.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at com.justep.x.bs.BusinessServerServlet.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.justep.exception.BusinessException: 编码: JUSTEP150210; 提示: 执行KSQL出错, KSQL: SELECT SUM(HX_ProjectApply.fContactValue) as ConValue,
SUM(HX_ProjectApply.fMargin) as Margin,
SUM(HX_ProjectApply.fQMGZK) as QMGZK,
SUM(HX_ProjectApply.fSXRZE) as SXRZE,
SUM(HX_ProjectApply.fContactValue*HX_ProjectApply.fYJIRR)/SUM(HX_ProjectApply.fContactValue) as IRR,
SUM(SQL.isnull((select sum(FI_RentWriteOff.fIncome) from FI_RentWriteOff FI_RentWriteOff where FI_RentWriteOff.fXJLID in (select HX_YJXJL from HX_YJXJL HX_YJXJL where HX_YJXJL.fLXID = HX_ProjectApply AND HX_YJXJL.fQC <> 0 ) ), 0)) as ysz FROM HX_ProjectApply HX_ProjectApply WHERE ((HX_ProjectApply.fFlag ='1' and HX_ProjectApply.fEndFlag ='0' and HX_ProjectApply.fLoanType ='分次放款' and HX_ProjectApply.fLoanCompleteMark ='0'))
--> sql: SELECT SUM(HX_ProjectApply.FCONTACTVALUE) AS ConValue, SUM(HX_ProjectApply.FMARGIN) AS Margin, SUM(HX_ProjectApply.FQMGZK) AS QMGZK, SUM(HX_ProjectApply.FSXRZE) AS SXRZE, ( SUM(( HX_ProjectApply.FCONTACTVALUE * HX_ProjectApply.FYJIRR )) / SUM(HX_ProjectApply.FCONTACTVALUE) ) AS IRR, SUM(isnull((SELECT SUM(FI_RentWriteOff.FINCOME) FROM FI_RENTWRITEOFF FI_RentWriteOff WHERE FI_RentWriteOff.FXJLID IN (SELECT HX_YJXJL.fID FROM HX_YJXJL HX_YJXJL WHERE (HX_YJXJL.FLXID = HX_ProjectApply.fID) AND (HX_YJXJL.FQC <> ?) )), ?)) AS ysz FROM HX_ProjectApply HX_ProjectApply WHERE (HX_ProjectApply.FFLAG = ?) AND (HX_ProjectApply.FENDFLAG = ?) AND (HX_ProjectApply.FLOANTYPE = ?) AND (HX_ProjectApply.FLOANCOMPLETEMARK = ?)
--> binds: [0, 0, 1, 0, 分次放款, 0]
at com.justep.exception.BusinessException.create(Unknown Source)
at com.justep.system.data.impl.TableUtilsImplement.ksqlSelect(Unknown Source)
at com.justep.system.data.impl.TableUtilsImplement.ksqlSelect(Unknown Source)
at com.justep.system.data.impl.TableUtilsImplement.ksqlSelect(Unknown Source)
at com.justep.system.data.BizData.query(Unknown Source)
at BizProcedure.query(BizProcedure.java:12)
... 27 more
Caused by: com.justep.exception.BusinessException: 编码: JUSTEP150039; 提示: 执行sql: SELECT SUM(HX_ProjectApply.FCONTACTVALUE) AS ConValue, SUM(HX_ProjectApply.FMARGIN) AS Margin, SUM(HX_ProjectApply.FQMGZK) AS QMGZK, SUM(HX_ProjectApply.FSXRZE) AS SXRZE, ( SUM(( HX_ProjectApply.FCONTACTVALUE * HX_ProjectApply.FYJIRR )) / SUM(HX_ProjectApply.FCONTACTVALUE) ) AS IRR, SUM(isnull((SELECT SUM(FI_RentWriteOff.FINCOME) FROM FI_RENTWRITEOFF FI_RentWriteOff WHERE FI_RentWriteOff.FXJLID IN (SELECT HX_YJXJL.fID FROM HX_YJXJL HX_YJXJL WHERE (HX_YJXJL.FLXID = HX_ProjectApply.fID) AND (HX_YJXJL.FQC <> ?) )), ?)) AS ysz FROM HX_ProjectApply HX_ProjectApply WHERE (HX_ProjectApply.FFLAG = ?) AND (HX_ProjectApply.FENDFLAG = ?) AND (HX_ProjectApply.FLOANTYPE = ?) AND (HX_ProjectApply.FLOANCOMPLETEMARK = ?) , binds: [0, 0, 1, 0, 分次放款, 0]出错
at com.justep.exception.BusinessException.create(Unknown Source)
at com.justep.system.ksql.KSQLUtils.execSqlSelect(Unknown Source)
... 32 more
Caused by: java.sql.SQLException: 不能对包含聚合或子查询的表达式执行聚合函数。
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:628)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:418)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:693)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
... 33 more
请问下,KSQL中的YSZLF,WSZJ的汇总我该如何处理?
|
|