From 31cfa4fca68e06f38a824bad644503ff71831785 Mon Sep 17 00:00:00 2001 From: tangfutang Date: Fri, 21 Jun 2019 19:53:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E9=87=91=E5=AE=9E=E6=94=B6=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E6=94=B9=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../query_report/pengyuandata.jsp | 3 + .../rentcollection/FundIncomeReport.jsp | 267 +- .../fileTemplate/资金实收报表导出3.xlsx | Bin 0 -> 10826 bytes .../action/ContractSignAction.java | 5232 ++++++++--------- .../commcheck/MakingContractCarCheck.java | 2 +- 5 files changed, 2754 insertions(+), 2750 deletions(-) create mode 100644 WebContent/fileTemplate/资金实收报表导出3.xlsx diff --git a/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuandata.jsp b/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuandata.jsp index 32a43eecb..434330f09 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuandata.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuandata.jsp @@ -112,6 +112,9 @@ <% } finally { diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/FundIncomeReport.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/FundIncomeReport.jsp index 0e83b5f84..6bb823e58 100644 --- a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/FundIncomeReport.jsp +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/FundIncomeReport.jsp @@ -1,134 +1,135 @@ -<%@ page contentType="text/html; charset=GBK"%> -<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> -<%@ page import="org.apache.commons.lang.StringUtils" %> -<% - /* - Author: undefined 2018-10-30 - Content: - History Log: - */ - String userid=CurUser.getUserID(); - ASObjectModel doTemp = new ASObjectModel("FundIncomeReport"); - - //¼ÓȨÏÞ - BizObjectManager manager = JBOFactory.getBizObjectManager("jbo.awe.USER_ROLE"); - List roleListObject = manager.createQuery("userid=:userid").setParameter("userid", userid).getResultList(false); - List roleList = new ArrayList(); - String roleid = ""; - for(BizObject bo : roleListObject){ - roleid = bo.getAttribute("roleid").toString(); - roleList.add(roleid); - } - //roleid:800R00000044 ±±²ÆºÏ×÷·½ - //String roleId = "800R00000044"; - - //roleid:800R00000045 rolename: bccuishou - //Èç¹ûµÇ¼ÈËÊôÓÚbccuishou½ÇÉ«£¬¿ÉÒÔ¿´µ½±±²ÆÏµÄËùÓеĺÏͬ - /* if(roleList.contains("800R00000045")){ - List userObjectList = manager.createQuery("roleid=:roleid").setParameter("roleid", roleId).getResultList(false); - String userId = ""; - List useridList = new ArrayList(); - for(BizObject bo : userObjectList){ - userId = bo.getAttribute("userid").toString(); - useridList.add("'"+userId+"'"); - } - String useridStr = StringUtils.join(useridList.toArray(), ","); - doTemp.appendJboWhere(" and O.project_manage in (" + useridStr + ")"); - } */ - - //µ¼³öÄ£°å±àºÅ - String template = ""; - - //µÇ¼ÈËÊôÓÚ¾­ÏúÉ̽ÇÉ« 401£º¾­ÏúÉÌroleid - if(roleList.contains("401") && !roleList.contains("800R00000051")){ - doTemp.appendJboWhere(" and lci.project_manage='"+userid+"'"); - //µ¼³öÓÐȨÏÞ - template = "2cd25a9b1c6248c8abacaeeaf7cda303"; - }else{ - //µ¼³öÎÞȨÏÞ - template = "a87e9bea25694013b9cc39216cac831e"; - } - String belongorg = Sqlca.getString("select belongorg from user_info where userid='"+userid+"'"); - String distributor_no = Sqlca.getString("select distributor_no from distributor_info where orgid='"+belongorg+"'"); - - if(roleList.contains("800R00000051")){ - doTemp.appendJboWhere(" and lci.distributor_id='"+distributor_no+"'"); - template = "2cd25a9b1c6248c8abacaeeaf7cda303"; - }else{ - template = "a87e9bea25694013b9cc39216cac831e"; - } - - ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); - dwTemp.Style="1"; //--ÉèÖÃΪGrid·ç¸ñ-- - dwTemp.ReadOnly = "1"; //Ö»¶Áģʽ - dwTemp.ShowSummary="1"; //»ã×Ü - dwTemp.setPageSize(10); - dwTemp.genHTMLObjectWindow(""); - - //0¡¢ÊÇ·ñչʾ 1¡¢ ȨÏÞ¿ØÖÆ 2¡¢ չʾÀàÐÍ 3¡¢°´Å¥ÏÔʾÃû³Æ 4¡¢°´Å¥½âÊÍÎÄ×Ö 5¡¢°´Å¥´¥·¢Ê¼þ´úÂë 6¡¢ 7¡¢ 8¡¢ 9¡¢Í¼±ê£¬CSS²ãµþÑùʽ 10¡¢·ç¸ñ - String sButtons[][] = { - //{"true","All","Button","ÐÂÔö","ÐÂÔö","newRecord()","","","","btn_icon_add",""}, - //{"true","","Button","ÏêÇé","ÏêÇé","viewAndEdit()","","","","btn_icon_detail",""}, - {"true","","Button","µ¼³öexcel","µ¼³öexcel","exportExcel()","","","","btn_icon_up",""}, - //{"true","","Button","ɾ³ý","ɾ³ý","if(confirm('ȷʵҪɾ³ýÂð?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, - }; -%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> - +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@ page import="org.apache.commons.lang.StringUtils" %> +<% + /* + Author: undefined 2018-10-30 + Content: + History Log: + */ + String userid=CurUser.getUserID(); + ASObjectModel doTemp = new ASObjectModel("FundIncomeReport"); + + //¼ÓȨÏÞ + BizObjectManager manager = JBOFactory.getBizObjectManager("jbo.awe.USER_ROLE"); + List roleListObject = manager.createQuery("userid=:userid").setParameter("userid", userid).getResultList(false); + List roleList = new ArrayList(); + String roleid = ""; + for(BizObject bo : roleListObject){ + roleid = bo.getAttribute("roleid").toString(); + roleList.add(roleid); + } + //roleid:800R00000044 ±±²ÆºÏ×÷·½ + //String roleId = "800R00000044"; + + //roleid:800R00000045 rolename: bccuishou + //Èç¹ûµÇ¼ÈËÊôÓÚbccuishou½ÇÉ«£¬¿ÉÒÔ¿´µ½±±²ÆÏµÄËùÓеĺÏͬ + /* if(roleList.contains("800R00000045")){ + List userObjectList = manager.createQuery("roleid=:roleid").setParameter("roleid", roleId).getResultList(false); + String userId = ""; + List useridList = new ArrayList(); + for(BizObject bo : userObjectList){ + userId = bo.getAttribute("userid").toString(); + useridList.add("'"+userId+"'"); + } + String useridStr = StringUtils.join(useridList.toArray(), ","); + doTemp.appendJboWhere(" and O.project_manage in (" + useridStr + ")"); + } */ + + //µ¼³öÄ£°å±àºÅ + String template = ""; + + + String belongorg = Sqlca.getString("select belongorg from user_info where userid='"+userid+"'"); + String distributor_no = Sqlca.getString("select distributor_no from distributor_info where orgid='"+belongorg+"'"); + +// if("DSTB20190516003654".equals(distributor_no)){//²âÊÔ»·¾³18 + if("DSTB20190510003636".equals(distributor_no)){//Õýʽ»·¾³ + doTemp.appendJboWhere(" and lci.distributor_id ='"+distributor_no+"'"); + template = "56c237b623a54732b61196c0b64b8238"; + + }else if(roleList.contains("401")){ + doTemp.appendJboWhere(" and lci.project_manage='"+userid+"'"); + //µ¼³öÓÐȨÏÞ + template = "2cd25a9b1c6248c8abacaeeaf7cda303"; + }else{ + //µ¼³öÎÞȨÏÞ + template = "a87e9bea25694013b9cc39216cac831e"; + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--ÉèÖÃΪGrid·ç¸ñ-- + dwTemp.ReadOnly = "1"; //Ö»¶Áģʽ + dwTemp.ShowSummary="1"; //»ã×Ü + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0¡¢ÊÇ·ñչʾ 1¡¢ ȨÏÞ¿ØÖÆ 2¡¢ չʾÀàÐÍ 3¡¢°´Å¥ÏÔʾÃû³Æ 4¡¢°´Å¥½âÊÍÎÄ×Ö 5¡¢°´Å¥´¥·¢Ê¼þ´úÂë 6¡¢ 7¡¢ 8¡¢ 9¡¢Í¼±ê£¬CSS²ãµþÑùʽ 10¡¢·ç¸ñ + String sButtons[][] = { + //{"true","All","Button","ÐÂÔö","ÐÂÔö","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","ÏêÇé","ÏêÇé","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","µ¼³öexcel","µ¼³öexcel","exportExcel()","","","","btn_icon_up",""}, + //{"true","","Button","ɾ³ý","ɾ³ý","if(confirm('ȷʵҪɾ³ýÂð?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/fileTemplate/资金实收报表导出3.xlsx b/WebContent/fileTemplate/资金实收报表导出3.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..c957fe64cfda0d83c44b322c0babccf1b3f5fe91 GIT binary patch literal 10826 zcmeHtRa9NevNrAn5AIHI3-0dj?(P~OxVyU(+}+(>f@^>v!QBE}NY2^W$=Uae`}~i; zADEN1O1i(A^Xpn&B_j?D0tN6o0;M*2Ua$WikS{j|*7`Db);9JuGB0AtFCRes5W9nR zeP#y)0I&uE0D%9yn68ZtwTq=idd!#@Fdef0jn4^ub;W*UP+T%HZ(q1dWpiXQyQK~Z zWYc{1mFh|(ygRURd$>=et`U$UMYFAQj6I7xDN$2Tgef|Np90QPlSL%W)#F<-7vckd^_S)*d&dK)@zdKlK`G|FjVU}H7M zEG(+=#|O73YkHXtOvFQy)db|jn%H?~y9Qkhq^*+s)idvgLkX#dTv<|LvuV2K;c;ta zuCL>8XKK+SJUYw|eXOk*%T9CfCUf$&CXgTfYy8g8sYCi>s#9yz9Q`rBP-rR zi|oG+`piG%mYU~ZinebkkSIHe zgtyZgW zqJa2;p=zCzNRXdhI90wrS)j!Q%g;WUbW0U9%GV?3y4d1sc+fd%CORy_6K)sWT0Y)# zlw!;`cfC>;$9$-Y_}~IOM&lEN5}-d9b3g5s1`b`&AGV@&gXYEhh17K^QMZOEClcneU39l zmVhS*Ok(&p8ASnCYQaDe-CeG(A7a*3Ed8$1ZSe5o-ffJ#G4w2)rALhl;w#~s*2Rwo zPFYo1Ek}fkUGPGEr6V>7x!Y(>7d-V!tyBS@)I;yjLx(Qa(cJQ8!D!K3Oc`>>e`7A;tl1)d+6nCvt{65_@)zu)3&xV=WCO_{;PUrOB%yGFW%n zZ!;fBeBlJK*Hzj9Um^WxS^<86)WzZlq5QMJo1X&C)^_IhCWeL%f0EDlS;(Z#7b`R` zf@uFC`$L89HAvygn)bQO$Q~yW&%iwoKtP_+Rc$qrDaZAz%rlo;s(_0|KtW=5BKHSw z#P}94O9s4hG)~vsGJheVoo^uwNq|e06 zTWodE?R&0#d|qw-x~YnTCXXXf__d##Y<9&jd-P3d4*dpfNw)ETpdiXhhzA*Fmx+~# zB6`1UEyO#u&+Xwhgzdy&>qjABt7nHQRcecPKJf~?Pv(}Hee9pqZnCeZedcWIwo zjNR^C448*2DCoP0*NgDB6iwtYC+J~kx;RQKkWKhXLqc}-F93nw(>4|4P<~ELE*B3f zl25C*^sSHPRdQBMgA_=>mv0a*a&Z(!xoR-40fHk~DZcGn;)LVN)HqRH+>y0RbVr!+kQUW|HDCVO%xabvt zE_e4`9p=$m;|{M2>++O-k(KM6baY8ie;~_h4Y$ifGRlLmk3x)2xvx>HAH?a2qQ6tk ziQ?s~k=ddxBIRy-B05uZP@cY;)QWAECHosG5jLP&Z12)?So#B&Nw#sIF(^4&2Jbn9 zgf1~@!QuwQdg8oL2`C>-wpuH>5*>uhy(kVoZ6^nl)je{E2-z&NB!q0oxJ4#K9aC6v zwEYn4LswI2yn{pd23FYgI8?REqZT@vvi0U&>TtzWgODeHw+&b=!DGNR zqKQK97G)mm@!r$EJyaZf_>81WBkpov9X|I38abep|2wTv6#k}DSWsY43mpME!N*z% znbrw?W`PxTkf3G49sXYFE!nsHy}NXJtOD-ngi8Fq6Z!&d0^jL{qM&6x)4enb?;U~c z@DHq!qM$WBGrcq*9%uns$uWJpJ|td!DzA9bX<1WfD*%|QKwzcn!c)+`mdf6snr=e3 z(DC4yT~tmgl3EZrVaN_@Ux)m9{wP%#dgA=;Jn+(|Rpi7kj}+VC3twZQ1jwwYGA0py zF*5Hbf!F{l~zmbW` zVHL5j4Rvo*Z`9*@f&j9mc$Wzb_IYr`5~|JbQgw9s+ZnVb>eb$FN%G_ z%w$`32JFgOQC|5pY{G55>KUl`h)m5Pxm1cGFd#>dRQ;C3qr^f7Bjr{xrL@K(xqQcX zEIIR=_7Hq?_U4DaMI7>R(}-phH+|4F5m!|L;WppYw*--zzVPg@cKqrQsjH zS8kuM;KRWH0Fp3&rgVRa{Sf|CXcs_GsnF)dEw zq=(w?_BnGcO0~2~E^iSL_42s!^0l6Nd5NZiAZ}%5>zlxsJ_BhlJ15%PXCEnfdkHGq z8+(3#e0;n&-`)Jgj==vQATqp_ugs}^1|RIfm1jG7X?5AMJI6tU5)qhmmc-ab9=-M{ z{ARr+XkJl-z(>b}a^7|ZI$mrpF(D7GM=bY^d|}$|Q*|@4 zE`}RfKSER+7lv$R)-Lzc<#~y4$BGAl=bBJ|ZjYC2X&%mL@}B9NUR9II9$Q7iZH4+| zo`)nRPM!DL;2w6uu0gs*Iyw7_qXX(ojg5ZuGlCLSD(WipOqmXv%{nYv%p8KWgUL!Q zb^ZQjY3+ctOpyl;Y)4W|1;zjiH@x!i#G{SMT9hme8KLnWSfpDti%){8G~vkL zHxG1bA-}?+-?V5!ZU;N96NAdk#=|(@o2C@vPzu$f>TYP-1L6TjS7H=0ONm0b#!p&i z!GH*10&bPE(d~b8XJ;jH!8eV{C@Xo=1H!L2y4Uvc`slz|dh)Y(SV7Vrtrr&=rsbjH}dzTHSqxBJ_^ z+(_+@7nLCGCo@4J4&hi?oH*WA{j}xV26$2pIkTg`$}Qv z3Cho`pvZ6xJ4a%dBTCz3B#^1TxD$tAZM@kn?Gr2lEH}{tg}x!Rl^NHN2x;UDyBTq5 zusv+7XAsRYGveJ}Xvanr9@Pxc_XkEq^1sBwMUu-|r4qw#IhN7384`wC%_;OZEfT$V z*Z`Tfm|_m^q?w^l@0yLUbh65MYiy`y9qoY%3F)mGeCpAS#h}%X=tXe&BljYJ{w=K2$33qDF!6j&5;p5 z_Os>GY6Oz}VIEOu3P*vh4vOV4zSVlHwfLj_2FO$u)pHA6^0`o(=WfI{f6_B*@6x38 zoHfNgXOyLf3FSS(CiiPcSEZ0_v4eo#>!tjQh_}pZgu^P*lITqok|$KUz!*-tG8GKQ z(lNNbG4ME!B*4Jns1O!&cwMu?3jS^Iq>~NGoRUOQiv+lc$l;o{?RqFM zNe$~6N+Fa5!h(4?arB#kTER+QQ#GddiV8Z_fgaMIw1p>DLu9x@7Gg^ZzeSCW?c2-R zXZkkc2zSR~`hk#zqDMc@YyOiJ2_5vt(vWg@z+=^rMYa3Rm{5LFDu`m^W2IB3{6Z0M zaFiMJ$Yel3vKYTtUrKDeXVV)a&Uc_<#ZyChDyqIZw*z?q?9JuGxd>;9Q;Yrxmh2BH z336Pr0+-!i05K|q7kV~6Vi#vkM2R(?(W3BnbY7*^*C*SB+NU`5iPQPkY$XxnOO2FC zO;N^Dtsv)VfL$oT!#TW*UnO(?peQk%8BNhg`;=LfbA#0Aqk?V*cWWa`Njsf9ec333 zA4n1B_xS|M1WV$`%f$PgR#HHgPl?$D)nNNmJ*%;4Qf)wN-cl|gBJwpM3KXAHHf8c2 zdw>elY73=k0wO(vBD^w*(jnj?X=#P|M)BG*Co*4Qs##0|pf5Xy=doJ~uP@Jg);@Q8 z3f1RN&eVHZd5vJIHQ(gP3r_>H)~l0PCD}%GgT#knr@{@k(no0 zL6)yd=I`dx`bVxLSWY)v`)QNj3qWcR;XlG%b5pnrNuV9T)=k`G)f3!4@*(+FdKYpT zW5VS@=V4>iYg z)nTifn4KO@A^T^`Iz`b%&~YcBc#dxRE^q8n-7e~M$JN%tnrun`p4g^Ci%gom?0GOU z006K*H#vI;R|`Y?*PLcn!_sKUzV@nJkKGtkrSQi(s|d5p=F@uo^D3#j)pYt>nEif#Ch;j!Jv&LAMGA@~I3# zSvq)8o{`xcAfBkPyLZhf$ga?G{uamDKE-e>jbFrgQQ|mbHX|( z<<~L0yZW32J=JoLJc&K z8J!F9u-{Qx#t9vt35pI#b9Ea^`==Gt7M?(;VfO*&N1k9WJ01x4KJyz(yMfcg_cWQ@ zz0TP6zVJz6AdbMAJsh8$udyfKCi@Vp=nO^GP4@d1Z|@3XxmPpY&$LoFo4$pz$&T-I zbJ-~%R&MBY6saXR=C-T%7rzyv%H>U_OG*E<9GqS~drvmtyn!(i`W9_T6 zjgNDq4<%`WOCx-D)`0D*fkx?p2^xrUeM7{OtO0liC@%8-)7%gOj1LD|LGE6{pa=9Z z7sL`N3amXrD$ibv6lyk$$r*n|bFsi1jON7m2l=MV6m>$mx)>ioBkQjB$0FwIA}!HI z=1;#O?g}V%l3(klRAW4xW%1W+!1a0DwRf+OTq_2u%$Ljx)#;fD^^Fd29S_<$+7rjo zt0rC4;mSh|8)ikdgO=~WuDEV@?!*=FqJuq4nVDCt^-Z~v0Y*-K%P^-9H zbN-Ej<-U|C&qdVejuUa$sJ)HbaJ-sbYd8&4@iK7&&-dN=-CG=t=?`318E#I2q{*~p zt2e&Xhiv2yJp+E|#7(trUzge-c4WQnZGyB2pCQJIzmuImoaP_Y!ns!*buY_NB6JXl zE|mF%7v*DMZ-x`ovlf8p90(CRysL|r1={Mep@#xEMROK{+}wWN-HHf!lDV$A9~3pX zh(;RRBP5NU6}Iux_hR&l`({AS>yvi?cddz;Bq)Nn@{tY=AOxb{<=$x?{nA*Hh|mI< zDgezfSL1!LTKG0`$A%^-^4bAlIhgH#~PO8uY30Na7Qf230Eb zaN5hI)8J2eXEx6A#6g2hcMfRHQSI+3C}2se1W?Lwup04w3Fghnl~Z#?bq2B5y-}*Q zDg=^$bcCQ52ERA&d=*{qi#6}K`GFPmORhv}u7s9s1`eHekpXpY!x!L?t z!#}0jh%VsquFe<6+$3$045S}gQs}cxRSrrO6LE_C-i7G%lUh+=23ZRw|RSA2O z6xTbGO0fqSfKeX4o!wsBCQBk%`D1y>@_`~7Pz@v@%&6sf!4P$Jvcs%&b8t0X-fqC6 zJZuPkJRT0xmQ6I1rZR#uYu`CJcs~>?xpK%^5I#0={c++*bH>wC2<3|qzZhUhNF&E4 z5wxa+GT=2mpKT!31+Ao>pe30vz(r;JL{lOyNzvO&lDaixx}WE>Mauafr{=w*)pW^+ zl!v;dB$}Ljca;2TcwSte?^9bG>`a%HVHpIkdyu-FtuVVE@wJ=|+n(espUE6;TEg$~ zZYl=sW1t<7B7s!1MB?mQ4Wu5UzklAh2B2JVMmh>^nJcLgZ`~z{B8cPXwpsI`B6a`* z%6unFgBU-mniMhoX=f)!CXG;U?{YlN>x&UEtUr4jL58MiO1uvargd?T@kGD$nrv)- z_8}Y=YDNnIEa;mh3FxrrM}ynLU2ckJq6A(-3KCyw1E~>{uh!(4!>1z?1J8}`?;rP1 z_j88^a3ee)lYu}}ZO~>h^94xZOb2$Y$v&Tj2KGEe>O(3VB!j?2$yfCw%B-_Mx@TBn z?45SCB~IYNcwUVRfuGn@=isC)cEbfoieo@)3g{!`3k>WI7SzE!yS>d7oI!MAAC)6| zI zP7g~Oxx1AsGeu_jM0*Mco7+_v`xbf$fn%O7_Tzzd?2I!~EP*3HJyC5D9gw|WwTW~v zf4R6R-Tj`!`57*9V?0!_0>K2m)C2p+`}r?!Cw%I~h~~jTBKQl) ziMOmD&msMc9Bzi-GLnCH?wjioM`-UnH zY|etn^qIMYjlfw)Q-dJRj9ruh$C-ZFrcgWwOtE5SVoT-=u^o;N83IBP zFh67P;9hJ?E;lz0*X`=*Q`?lVHc2&s8$hK1bDfwkZP_$IZt-*iA^8R6B0<>(uQlWw zIYlE6_(f2JxWR}gSGMK{!7x;5xh67k_0H3?i|vn9XkC}GdU|#@s5F_Jk^%xyUFBW^ zL`>CDa)_!yAleczMTVjVNKZW#v8PZv>bo2)Nf^-v@I1jOpW7pf5bnTAs1ccpWJULK zLfr{FI_Wj3a0mL^Wh}cE_y>Q}`0gTCsq2#u@J_mjGW9WWS zJkv1~81KgC4#o&(hg6@c;we91$ODw@dyzW~N@ROMd+AwDKDgjGx3h^Rfv zYwr0RWKkv-oA&LEJYjWRNbG2S4{dGa(rG6+S8_(!k+-&H%RElwRN3}O{_vV79CsI> zYk_my{>m9)X--k~jdfOFv`B*`uCTS==^=b8g>R>6G57LvQEH1@Lj4rk2_rMiYPnU? zZ2D?=@zm1dYTanHl2se*70jc=THRI%-G#iXM*-4p_IfBY`)OG0`T;Ap+x5WtXbk$Z z1`b)%+h!YOp7c)}*45^c@ee#3g!G93%y+o#vQV*^XUk8xzbB=`LQEW*FQ=`EFIBSF zlem{76?+q1J3|9`2RlsO+n@Of>I1!qQ-Fe1X=b;(Vwk^%FwmzW~QCEeXsd8Dz&Ahk)_ssmpIb<*s7v8M}>g1A0}AWf*xa& z8z}o&)2JJ7x=6X)JVd_r;+8!cpAqda$A&#naecE`D2~=i9p4Tr+s_ftK?Y$}1X0+x zh7Qpy>i9hzg`MT#wlCqBdI<;IucDZqwYB+=lg}7U>26x&fD_5@aCKjlnEQpJEC?}V zgM;yNTr}qy<|gaJ)v><2O)z7lg`E}eUJSXdF{T~ciE?$SWGf1|X=WnI1n=;b5#Hb1 zIkV>XvgNbHs__ck=TE<*#Ew0tC#k+ZJL& zkBud%zalk%FP(pOm=JEuzFILmOBL6Pj{@cLb!FmE+$cg@*Awm-9m-OJXUnkcA;*3d zlJCUi0sPzi*MUXtik)^zXB31*2O5GyNdphBB#Gxq5~LW_ zqxLplS<27N;E~C9JE`mL1}&JYcv^J%5v@LsvOYZ4gHG+Tr|vE)t3D#7ZL`3x3O3y! zE#J=d9{hZFIO3M5iJ~>#_;)*|H(JWgKF87A2Paz+}~pP64;OPBfL6&%6^aMdRJ&;z=o9svrjVbO~#bqLyz=) zF%8UT7h}9&J()c_ZN_r?Q`-+7E?|Ndn!4&Ilbv25frn34&jDqIO#+THv4|+bU}ifX z3z)t#IVBLR=f;Ze^Bb!U%j~c17^`PXZMl^6Xu}Q~rF>ICgBZ|*{>FH@`Msl_W`tw_ zHPh2+?>59ge+i6ojdkz?Q8%-~AehmSND!}fpsN~6K%kPAeGb|I@xuVqkt%)nkO$?J z3yC;PDieCU2aA08Akx4m!I%UIW^vm6aNTL*r0ss%#H7nZ8lyir#M%{tGd(BrKsf!!2>V9o}h`)!6Za|@vDJrG_3gt?mlG_Jwy!I35 zg>!}R?>On@A%+K?o|GgS$Z$K>;0DY6R2~EBLRmJXLUU9N5>{KxI1}a}p~ZGX*@YK| z7|#?{g@T6(TTuZP8xJf|xTMn`0>1*hO9nj&B!AF3DPh(2);r+iaC#I29q8JL(@A43 zi5FzLjCtjk4M;n>3cmB!ymfO@914S>tq;0m!$~&f6rUir<7mQ`avhlc;wZK-D8&Nb z8~C32`hD1O?#w?9&pG?#V?gQdf|6okWB7GJJunUC(}3ceg<4lFF}(1mdL_Gjh_n;kC*AcIeUFue~#ClvDfjp_Ojpo z{n=plD*V$Q>EG4<)o%7DM1OWo{nCzldA$E}`tKg9Kh^(i0Q#j4@XDznWiOm;28l`5mQPg1=GMpA-F)<6a&8L}~c%YX8A_f7HYFJ|97=t1-?J0{Ab4W z%Rm$E55Iqh?Y~X>wO{Gyc#W{j&j|n4z4ZIc|Lk9S)%_W@y#LVs)y?$h^#81R|FY5w z@z?bK)j##)@}u|R|8AxJ<>`Eh+uzpl!^)33x{NsJYZmjeNgx5lzRWqB`1Qa40niq# At^fc4 literal 0 HcmV?d00001 diff --git a/src/com/tenwa/channelportal/action/ContractSignAction.java b/src/com/tenwa/channelportal/action/ContractSignAction.java index e5a35a59a..cc380e0ba 100644 --- a/src/com/tenwa/channelportal/action/ContractSignAction.java +++ b/src/com/tenwa/channelportal/action/ContractSignAction.java @@ -1,2617 +1,2617 @@ -package com.tenwa.channelportal.action; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.MalformedURLException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - -import jbo.app.tenwa.customer.CUSTOMER_FAMILY_TEMP; -import jbo.app.tenwa.customer.CUSTOMER_PERSON; -import jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP; -import jbo.app.tenwa.doc.LB_DOCATTRIBUTE; -import jbo.app.tenwa.doc.LB_DOCLIBRARY; -import jbo.app.tenwa.doc.LB_DOCRELATIVE; -import jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST; -import jbo.app.tenwa.doc.LB_ONEDIMENSIONALCODE; -import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT; -import jbo.com.tenwa.lease.carbrand.BUSINESS_STATUS; -import jbo.com.tenwa.lease.carbrand.LB_CONTRACT_SIGN_LOG; -import jbo.com.tenwa.lease.comm.LB_CONTRACT_TEMPLATE; -import jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT_TEMP; -import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO; -import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP; -import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE; -import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE_TEMP; -import jbo.sys.CODE_LIBRARY; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.util.StringFunction; -import com.amarsoft.awe.Configure; -import com.amarsoft.awe.util.ASResultSet; -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; -import com.caucho.hessian.client.HessianProxyFactory; -import com.tenwa.app.dao.ContractSignInfo; -import com.tenwa.lease.app.service.HttpRequestAppService; -import com.tenwa.lease.flow.contract.contractapproval.ContractTemplateCache; -import com.tenwa.makeContract.util.MakeOneCodeAndContractModel; -import com.tenwa.channelportal.action.generativecontract.Word2PdfUtil; -import com.tenwa.channelportal.action.generativecontract.WordToPDFUtil; -import com.tenwa.comm.util.date.DateAssistant; -import com.tenwa.comm.util.jboutil.DataOperatorUtil; -import com.tenwa.doc.util.BASE64; -import com.tenwa.officetempalte.util.FileOperatorUtil; -import com.tenwa.quartz.DateUtil; -import com.tenwa.reckon.util.UUIDUtil; - -public class ContractSignAction{ - public String file_id; - public String cust_phone; - public String cust_id; - public String library_id; - public String customerType; - public String CurUserID; - public String ProjectId; - public String contract_id; - public String FlowUnid; - public String InputOrgid; - public String id; - private String attrId; - public String flagType; - public HessianProxyFactory factory = new HessianProxyFactory(); - public HttpRequestAppService requestService; - public String PAYMENT_NUMBER; - public String PLAN_LIST; - public String Ttype; - public String contractNo; - public String leasform; - private static Logger logger=Logger.getLogger(ContractSignAction.class); - @SuppressWarnings("deprecation") - public static String getConfigRequestUrl() throws Exception{ - return Configure.getInstance().getConfigure("RequestHessionUrl"); - } - @SuppressWarnings("deprecation") - public static String getFileSavePath() throws Exception{ - return Configure.getInstance().getConfigure("FileSavePath"); - } - - public String getCurUserID() { - return CurUserID; - } - - public String getContract_id() { - return contract_id; - } - - public void setContract_id(String contract_id) { - this.contract_id = contract_id; - } - - public void setCurUserID(String curUserID) { - CurUserID = curUserID; - } - - public String getCustomerType() { - return customerType; - } - - public void setCustomerType(String customerType) { - this.customerType = customerType; - } - - public String getFile_id() { - return file_id; - } - - public void setFile_id(String file_id) { - this.file_id = file_id; - } - - - public String getCust_id() { - return cust_id; - } - - public void setCust_id(String cust_id) { - this.cust_id = cust_id; - } - - public String getCust_phone() { - return cust_phone; - } - public void setCust_phone(String cust_phone) { - this.cust_phone = cust_phone; - } - - public String getLibrary_id() { - return library_id; - } - public void setLibrary_id(String library_id) { - this.library_id = library_id; - } - - public String getProjectId() { - return ProjectId; - } - - public void setProjectId(String projectId) { - ProjectId = projectId; - } - - public String getFlowUnid() { - return FlowUnid; - } - - public void setFlowUnid(String flowUnid) { - FlowUnid = flowUnid; - } - - public String getInputOrgid() { - return InputOrgid; - } - - public void setInputOrgid(String inputOrgid) { - InputOrgid = inputOrgid; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - //ÀàÐÍ - public String getFlagType() { - return flagType; - } - - public void setFlagType(String flagType) { - this.flagType = flagType; - } - public String getAttrId() { - return attrId; - } - public void setAttrId(String attrId) { - this.attrId = attrId; - } - - - public String getPAYMENT_NUMBER() { - return PAYMENT_NUMBER; - } - public void setPAYMENT_NUMBER(String pAYMENT_NUMBER) { - PAYMENT_NUMBER = pAYMENT_NUMBER; - } - public String getPLAN_LIST() { - return PLAN_LIST; - } - public void setPLAN_LIST(String pLAN_LIST) { - PLAN_LIST = pLAN_LIST; - } - public String getTtype() { - return Ttype; - } - public void setTtype(String ttype) { - Ttype = ttype; - } - public String getContractNo() { - return contractNo; - } - public void setContractNo(String contractNo) { - this.contractNo = contractNo; - } - public String getLeasform() { - return leasform; - } - public void setLeasform(String leasform) { - this.leasform = leasform; - } - /** - * ×ÔÈ»È˵ç×ÓǩԼ - * - * @author tenwa518 - * @param tx - * @return - * @throws Exception - */ - @SuppressWarnings("unchecked") - public String signIng(JBOTransaction tx) throws Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - //BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx); - BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME, tx); - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - BizObjectManager lcslBom = JBOFactory.getBizObjectManager(LB_CONTRACT_SIGN_LOG.CLASS_NAME,tx); - Map> map = new HashMap>(); - ContractSignInfo con = null; - List bo = null; - BizObject ldclBo = null; - try { - //BizObject pbo = pbm.createQuery("id=:id").setParameter("id", ProjectId).getSingleResult(true); - BizObject pbo = pbm.createQuery("FLOWUNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(true); - // ²éѯlb_doc_contract_list±í - bo = contBom.createQuery("project_id=:projectId and file_flag='yes' and (sendprocess='0' or sendprocess='2' ) ").setParameter("projectId", ProjectId).getResultList(true); - for (BizObject keys : bo) { - String info = keys.getAttribute("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString(); - StringBuffer manyPeople = this.manyPeople(); - if(manyPeople.length()>0){ - info=info+"@applicant,"+manyPeople.deleteCharAt(manyPeople.length() - 1); - } - List list = map.get(info); - if (list == null) { - list = new ArrayList(); - map.put(info, list); - } - con = new ContractSignInfo(); - con.setCustname(keys.getAttribute("DOC_NAME").toString()); - con.setCustphone(keys.getAttribute("TELEPHONE").toString()); - con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString()); - con.setFilename(keys.getAttribute("FILENAME").toString()); - // »ñÈ¡Éú³ÉÎļþ·¾¶ - String makefullPath = keys.getAttribute("FULLPATH").toString(); - File file = new File(makefullPath); - if (!file.exists()) { - throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); - } - con.setInputfile(BASE64.encodeImgageToBase64(file)); - list.add(con); - } - Map fromCondtion = new HashMap(); - Map otherProperty = new HashMap(); - Map resultMap = requestService.createContractSign(map); - if (!resultMap.containsKey("error")) { - for (String key : resultMap.keySet()) { - // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid - if (key.indexOf("contract_") == -1) { - fromCondtion.clear(); - otherProperty.clear(); - // ÆõÔ¼ËøºÏͬºÅ - String contractId = resultMap.get("contract_" + key); - String sendProcess = resultMap.get("contract_" + contractId); - ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); - ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); - ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); - ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); - ldclBo.setAttributeValue("SENDPROCESS", sendProcess); - contBom.saveObject(ldclBo); - - String contractDocId = ldclBo.getAttribute("id").toString(); - fromCondtion.put("id", contractDocId); - otherProperty.put("SIGNPROCESS", "0");// ·¢Æðµç×ÓǩԼ - otherProperty.put("CONTRACTDOCID", contractDocId);// ·¢Æðµç×ÓǩԼ - otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); - //¿½±íµÄ·½·¨ - DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, - otherProperty, tx); - } - } - pbo.setAttributeValue("DATA_STATE", "8");// ״̬¸Ä³Éµç×ÓǩԼ£¬Ç©ÊðÖÐ - pbm.saveObject(pbo); - //¼Ç¼ÏîÄ¿½ø³ÌÈÕÖ¾ - /*Transaction tran = Transaction.createTransaction(tx); - ASUser user = ASUser.getUser(CurUserID, tran); - JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME,tx) - .createQuery("UPDATE O SET BUSINESS_STATUS='8',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' WHERE CONTRACT_NUMBER=(SELECT LPI.CONTRACT_NUMBER FROM "+LB_PROJECT_INFO.CLASS_NAME+" LPI WHERE LPI.ID='"+ProjectId+"')").executeUpdate(); - SqlObject so = new SqlObject("INSERT INTO BUSINESS_DETAIL(ID,CONTRACT_NUMBER,BUSINESS_STATUS,INPUTUSERID,INPUTORGID,INPUTTIME) SELECT SYS_GUID(),CONTRACT_NUMBER,'8','"+user.getUserID()+"','"+user.getOrgID()+"','"+StringFunction.getTodayNow().replaceAll(":", "¡÷")+"' FROM LB_PROJECT_INFO WHERE ID='"+ProjectId+"'"); - so.setDebugSql(so.getDebugSql().replaceAll("¡÷", ":")); - so.setOriginalSql(so.getOriginalSql().replaceAll("¡÷", ":")); - so.setRunSql(so.getRunSql().replaceAll("¡÷", ":")); - tran.executeSQL(so);*/ - return "success"; - } else { - Boolean flag = false; - String getMessage = resultMap.get("error"); - logger.info("ÆõÔ¼Ëø·´À¡µÄÒì³£ÐÅÏ¢" + getMessage); - for (String key : resultMap.keySet()) { - // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid - if (key.indexOf("contract_") == -1 && !"error".equals(key)) { - fromCondtion.clear(); - otherProperty.clear(); - // ÆõÔ¼ËøºÏͬºÅ - String contractId = resultMap.get("contract_" + key); - String sendProcess = resultMap.get("contract_" + contractId); - ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); - ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); - ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); - ldclBo.setAttributeValue("SENDPROCESS", sendProcess); - if ("1".equals(sendProcess)) { - flag = true; - ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); - }else if("2".equals(sendProcess)){ - ldclBo.setAttributeValue("MESSAGE",getMessage ); - } - contBom.saveObject(ldclBo); - - String contractDocId = ldclBo.getAttribute("id").toString(); - fromCondtion.put("ID", contractDocId); - otherProperty.put("SIGNPROCESS", "0");//·¢Æðµç×ÓǩԼ - otherProperty.put("CONTRACTDOCID",contractDocId);//·¢Æðµç×ÓǩԼ - otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); - DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, - otherProperty, tx); - } - } - // Åжϲ»Í¬µÄÒì³£·´À¡¸øÇ°¶Ë - if (getMessage.indexOf("Óû§ÈÏÖ¤ÐÅÏ¢ÓëºÏͬǩÊð·½ÐÅÏ¢²»Æ¥Åä") != -1) { - getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3); - return flag + "@" + getMessage; - } else if (getMessage.indexOf("contractId²»ÄÜΪ¿Õ") != -1) { - return flag + "@" + getMessage; - } else { - return flag + "@" + "error"; - } - } - } catch (Exception e) { - tx.rollback(); - e.printStackTrace(); - logger.info("×ÔÈ»È˵ç×ÓǩԼÒì³£:" + e.getMessage()); - return "flase@error"; - } - } - /** - * ·¨È˿ͻ§ÔÚÉú³ÉºÏͬÊÇÖ±½Ó¸ÇÕ - * @param tx - * @return - * @throws Exception - */ - - @SuppressWarnings("unchecked") - public String compnySignIng(JBOTransaction tx) throws Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - //BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx); - BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME, tx); - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - Map map = new HashMap(); - ContractSignInfo con = null; - List bo = null; - BizObject ldclBo = null; - try { - //BizObject pbo = pbm.createQuery("id=:id").setParameter("id", ProjectId).getSingleResult(true); - BizObject pbo = pbm.createQuery("FLOWUNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(true); - // ²éѯlb_doc_contract_list±í - bo = contBom.createQuery("project_id=:projectId and file_flag='yes' and (sendprocess='0' or sendprocess='2' ) ").setParameter("projectId", ProjectId).getResultList(true); - for (BizObject keys : bo) { - String info = keys.getAttribute("id").toString(); - con = new ContractSignInfo(); - con.setCustname(keys.getAttribute("DOC_NAME").toString()); - con.setCustphone(keys.getAttribute("TELEPHONE").toString()); - con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString()); - con.setFilename(keys.getAttribute("FILENAME").toString()); - // »ñÈ¡Éú³ÉÎļþ·¾¶ - String makefullPath = keys.getAttribute("FULLPATH").toString(); - File file = new File(makefullPath); - if (!file.exists()) { - throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); - } - con.setInputfile(BASE64.encodeImgageToBase64(file)); - map.put(info, con); - } - Map fromCondtion = new HashMap(); - Map otherProperty = new HashMap(); - Map resultMap = requestService.compnySign(map); - if (!resultMap.containsKey("error")) { - for (String key : resultMap.keySet()) { - // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid - if (key.indexOf("contract_") == -1) { - fromCondtion.clear(); - otherProperty.clear(); - // ÆõÔ¼ËøºÏͬºÅ - String contractId = resultMap.get("contract_" + key); - String sendProcess = resultMap.get("contract_" + contractId); - ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); - ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); - ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); - ldclBo.setAttributeValue("SIGN_TYPE", "COMPLETE");//·¨È˿ͻ§µ±¸ÇÍêÕ¸ÄΪÍê³É״̬ - ldclBo.setAttributeValue("SENDPROCESS", sendProcess); - contBom.saveObject(ldclBo); - - String contractDocId = ldclBo.getAttribute("id").toString(); - fromCondtion.put("id", contractDocId); - otherProperty.put("SIGNPROCESS", "0");// ·¢Æðµç×ÓǩԼ - otherProperty.put("CONTRACTDOCID", contractDocId);// ·¢Æðµç×ÓǩԼ - otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); - //¿½±íµÄ·½·¨ - DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, - otherProperty, tx); - } - } - pbo.setAttributeValue("DATA_STATE", "8");// ״̬¸Ä³Éµç×ÓǩԼ£¬Ç©ÊðÖÐ - pbm.saveObject(pbo); - downloadDoc(tx); - return "success"; - } else { - Boolean flag = false; - String getMessage = resultMap.get("error"); - logger.info("ÆõÔ¼Ëø·´À¡µÄÒì³£ÐÅÏ¢" + getMessage); - for (String key : resultMap.keySet()) { - // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid - if (key.indexOf("contract_") == -1 && !"error".equals(key)) { - fromCondtion.clear(); - otherProperty.clear(); - // ÆõÔ¼ËøºÏͬºÅ - String contractId = resultMap.get("contract_" + key); - String sendProcess = resultMap.get("contract_" + contractId); - ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); - ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); - ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); - ldclBo.setAttributeValue("SENDPROCESS", sendProcess); - if ("1".equals(sendProcess)) { - flag = true; - ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); - }else if("2".equals(sendProcess)){ - ldclBo.setAttributeValue("MESSAGE",getMessage ); - } - contBom.saveObject(ldclBo); - - String contractDocId = ldclBo.getAttribute("id").toString(); - fromCondtion.put("ID", contractDocId); - otherProperty.put("SIGNPROCESS", "0");//·¢Æðµç×ÓǩԼ - otherProperty.put("CONTRACTDOCID",contractDocId);//·¢Æðµç×ÓǩԼ - otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); - DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, - otherProperty, tx); - } - } - // Åжϲ»Í¬µÄÒì³£·´À¡¸øÇ°¶Ë - if (getMessage.indexOf("Óû§ÈÏÖ¤ÐÅÏ¢ÓëºÏͬǩÊð·½ÐÅÏ¢²»Æ¥Åä") != -1) { - getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3); - return flag + "@" + getMessage; - } else if (getMessage.indexOf("contractId²»ÄÜΪ¿Õ") != -1) { - return flag + "@" + getMessage; - } else { - return flag + "@" + "error"; - } - } - } catch (Exception e) { - tx.rollback(); - e.printStackTrace(); - logger.info("·¨È˿ͻ§Éú³ÉºÏͬ¸ÇÕÂʧ°Ü" + e.getMessage()); - return "flase@error"; - } - } - - //»ñÈ¡µç×ÓǩԼÈËÔ±Áбí - public StringBuffer manyPeople() throws JBOException{ - //»ñÈ¡µ£±£ÈËÐÅÏ¢ - StringBuffer info = new StringBuffer(); - BizObjectManager cptm = JBOFactory.getBizObjectManager(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME); - List cpts = cptm.createQuery("select * from O where flowunid=:flowUnid").setParameter("flowUnid", FlowUnid).getResultList(false); - for(BizObject cpt:cpts){ - String name = cpt.getAttribute("FULLNAME").toString(); - String mobile = cpt.getAttribute("mobile").toString(); - if(name.length()>0 && mobile.length()>0){ - info.append(name+"@"+mobile+"@guarantee,"); - } - } - //»ñÈ¡¹²Í¬ÉêÇëÈ˵ÄÐÅÏ¢ - BizObjectManager cftm = JBOFactory.getBizObjectManager(CUSTOMER_FAMILY_TEMP.CLASS_NAME); - BizObject cft = cftm.createQuery("flowunid=:FLowUnid and Partner_='Y'").setParameter("FLowUnid", FlowUnid).getSingleResult(false); - if(cft!=null){ - String name = cft.getAttribute("name").toString(); - String mobile = cft.getAttribute("tel").toString(); - if(name.length()>0 && mobile.length()>0){ - info.append(name+"@"+mobile+"@comm,"); - } - } - - return info; - } - - /** - * ·¨ÈË×â½ðίÍдú³¥µç×ÓǩԼ - * @author tenwa518 - * @param tx - * @return - * @throws Exception - */ - @SuppressWarnings("unchecked") - public String companySignIng(JBOTransaction tx) throws Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx); - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - Map> map = new HashMap>(); - ContractSignInfo con = null; - List bo = null; - BizObject ldclBo = null; - try { - BizObject pbo = pbm.createQuery("id=:id").setParameter("id", ProjectId).getSingleResult(true); - // ²éѯlb_doc_contract_list±í - bo = contBom.createQuery("project_id=:projectId and file_flag='yes' and (sendprocess='0' or sendprocess='2' ) and doc_name='×â½ð´ú³¥º¯'").setParameter("projectId", ProjectId).getResultList(true); - for (BizObject keys : bo) { - String info = keys.getAttribute("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString(); - List list = map.get(info); - if (list == null) { - list = new ArrayList(); - map.put(info, list); - } - con = new ContractSignInfo(); - con.setCustname(keys.getAttribute("CUSTOMERNAME").toString()); - con.setCustphone(keys.getAttribute("TELEPHONE").toString()); - con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString()); - con.setFilename(keys.getAttribute("FILENAME").toString()); - // »ñÈ¡Éú³ÉÎļþ·¾¶ - String makefullPath = keys.getAttribute("FULLPATH").toString(); - File file = new File(makefullPath); - if (!file.exists()) { - throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); - } - con.setInputfile(BASE64.encodeImgageToBase64(file)); - list.add(con); - } - - Map fromCondtion=new HashMap(); - MapotherProperty=new HashMap(); - Map resultMap = requestService.createComContractSign(map); - if (!resultMap.containsKey("error")) { - for (String key : resultMap.keySet()) { - // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid - if (key.indexOf("contract_") == -1) { - fromCondtion.clear(); - otherProperty.clear(); - //ÆõÔ¼ËøºÏͬºÅ - String contractId=resultMap.get("contract_" + key); - String sendProcess=resultMap.get("contract_" + contractId); - ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); - ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); - ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); - ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); - ldclBo.setAttributeValue("SENDPROCESS",sendProcess); - contBom.saveObject(ldclBo); - - String contractDocId =ldclBo .getAttribute("id").toString(); - fromCondtion.put("id", contractDocId); - otherProperty.put("SIGNPROCESS", "0");// ·¢Æðµç×ÓǩԼ - otherProperty.put("CONTRACTDOCID", contractDocId);// ·¢Æðµç×ÓǩԼ - otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); - //¿½±íµÄ·½·¨ - DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion,LB_CONTRACT_SIGN_LOG.CLASS_NAME, - null,otherProperty,tx); - } - } - pbo.setAttributeValue("project_status","8");//״̬¸Ä³Éµç×ÓǩԼ£¬Ç©ÊðÖÐ - pbm.saveObject(pbo); - //¼Ç¼ÏîÄ¿½ø³ÌÈÕÖ¾ - Transaction tran = Transaction.createTransaction(tx); - ASUser user = ASUser.getUser(CurUserID, tran); - JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME,tx) - .createQuery("UPDATE O SET BUSINESS_STATUS='8',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' WHERE CONTRACT_NUMBER=(SELECT LPI.CONTRACT_NUMBER FROM "+LB_PROJECT_INFO.CLASS_NAME+" LPI WHERE LPI.ID='"+ProjectId+"')").executeUpdate(); - SqlObject so = new SqlObject("INSERT INTO BUSINESS_DETAIL(ID,CONTRACT_NUMBER,BUSINESS_STATUS,INPUTUSERID,INPUTORGID,INPUTTIME) SELECT SYS_GUID(),CONTRACT_NUMBER,'8','"+user.getUserID()+"','"+user.getOrgID()+"','"+StringFunction.getTodayNow().replaceAll(":", "¡÷")+"' FROM LB_PROJECT_INFO WHERE ID='"+ProjectId+"'"); - so.setDebugSql(so.getDebugSql().replaceAll("¡÷", ":")); - so.setOriginalSql(so.getOriginalSql().replaceAll("¡÷", ":")); - so.setRunSql(so.getRunSql().replaceAll("¡÷", ":")); - tran.executeSQL(so); - return "success"; - } else { - Boolean falg=false; - String getMessage = resultMap.get("error"); - logger.info("ÆõÔ¼Ëø·´À¡µÄÒì³£ÐÅÏ¢" + getMessage); - for (String key : resultMap.keySet()) { - // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid - if (key.indexOf("contract_") == -1 && !"error".equals(key)) { - fromCondtion.clear(); - otherProperty.clear(); - // ÆõÔ¼ËøºÏͬºÅ - String contractId = resultMap.get("contract_" + key); - String sendProcess = resultMap.get("contract_" + contractId); - ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); - ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); - ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); - ldclBo.setAttributeValue("SENDPROCESS", sendProcess); - if ("1".equals(sendProcess)) { - falg=true; - ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); - }else if ("2".equals(sendProcess)) { - ldclBo.setAttributeValue("MESSAGE", getMessage); - } - contBom.saveObject(ldclBo); - - String contractDocId=ldclBo.getAttribute("id").toString(); - fromCondtion.put("id", contractDocId); - otherProperty.put("SIGNPROCESS", "0");//·¢Æðµç×ÓǩԼ - otherProperty.put("CONTRACTDOCID",contractDocId);//·¢Æðµç×ÓǩԼ - otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); - DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, - otherProperty, tx); - } - } - // Åжϲ»Í¬µÄÒì³£·´À¡¸øÇ°¶Ë - if (getMessage.indexOf("Óû§ÈÏÖ¤ÐÅÏ¢ÓëºÏͬǩÊð·½ÐÅÏ¢²»Æ¥Åä") != -1) { - getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3); - return getMessage; - } else if (getMessage.indexOf("contractId²»ÄÜΪ¿Õ") != -1) { - return getMessage; - } else { - return "error"; - } - } - } catch (Exception e) { - tx.rollback(); - e.printStackTrace(); - return "error"; - } - - } - - /** - * (¿Û¿î¿¨±ä¸ü)×ÔÈ»ÈËίÍпۿîÊÚȨÊéµç×ÓǩԼ,»¹ÓÐ×â½ð´ú³¥º¯ - * @author tenwa518 - * @param tx - * @return - * @throws Exception - */ - public String PersonDeductSignIng(JBOTransaction tx) throws Exception{ - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - Map> map = new HashMap>(); - ContractSignInfo con = null; - List bo = null; - BizObject ldclBo = null; - try { - // ²éѯlb_doc_contract_list±í - bo = contBom.createQuery("flow_unid=:flow_unid and (sendprocess='0' or sendprocess='2' ) and file_flag='yes'").setParameter("flow_unid", FlowUnid).getResultList(true); - - for (BizObject keys : bo) { - String info = keys.getAttribute("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString(); - List list = map.get(info); - if (list == null) { - list = new ArrayList(); - map.put(info, list); - } - con = new ContractSignInfo(); - con.setCustname(keys.getAttribute("CUSTOMERNAME").toString()); - con.setCustphone(keys.getAttribute("TELEPHONE").toString()); - con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString()); - con.setFilename(keys.getAttribute("FILENAME").toString()); - // »ñÈ¡Éú³ÉÎļþ·¾¶ - String makefullPath = keys.getAttribute("FULLPATH").toString(); - File file = new File(makefullPath); - if (!file.exists()) { - throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); - } - con.setInputfile(BASE64.encodeImgageToBase64(file)); - list.add(con); - } - - - Map fromCondtion=new HashMap(); - MapotherProperty=new HashMap(); - Map resultMap = null; - if ("01".equals(customerType)) { - resultMap = requestService.createComContractSign(map); - } else { - resultMap = requestService.createEntrustmentSign(map); - } - if (!resultMap.containsKey("error")) { - for (String key : resultMap.keySet()) { - if (key.indexOf("contract_") == -1) { - fromCondtion.clear(); - otherProperty.clear(); - //ÆõÔ¼ËøºÏͬºÅ - String contractId=resultMap.get("contract_" + key); - String sendProcess=resultMap.get("contract_" + contractId); - ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); - ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); - ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); - ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); - ldclBo.setAttributeValue("SENDPROCESS",sendProcess); - contBom.saveObject(ldclBo); - - String contractDocId = ldclBo.getAttribute("id").toString(); - fromCondtion.put("id", contractDocId); - otherProperty.put("SIGNPROCESS", "0");// ·¢Æðµç×ÓǩԼ - otherProperty.put("CONTRACTDOCID", contractDocId);// ·¢Æðµç×ÓǩԼ - otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); - //¿½±íµÄ·½·¨ - DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, - otherProperty, tx); - } - } - - return "success"; - - } else { - Boolean flag = false; - String getMessage = resultMap.get("error"); - logger.info("ÆõÔ¼Ëø·´À¡µÄÒì³£ÐÅÏ¢" + getMessage); - for (String key : resultMap.keySet()) { - // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid - if (key.indexOf("contract_") == -1 && !"error".equals(key)) { - fromCondtion.clear(); - otherProperty.clear(); - // ÆõÔ¼ËøºÏͬºÅ - String contractId = resultMap.get("contract_" + key); - String sendProcess = resultMap.get("contract_" + contractId); - ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); - ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); - ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); - ldclBo.setAttributeValue("SENDPROCESS", sendProcess); - if ("1".equals(sendProcess)) { - flag = true; - ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); - }else if("2".equals(sendProcess)){ - ldclBo.setAttributeValue("MESSAGE",getMessage ); - } - contBom.saveObject(ldclBo); - - - String contractDocId = ldclBo.getAttribute("id").toString(); - fromCondtion.put("ID", contractDocId); - otherProperty.put("SIGNPROCESS", "0");//·¢Æðµç×ÓǩԼ - otherProperty.put("CONTRACTDOCID",contractDocId);//·¢Æðµç×ÓǩԼ - otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); - DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, - otherProperty, tx); - } - } - // Åжϲ»Í¬µÄÒì³£·´À¡¸øÇ°¶Ë - if (getMessage.indexOf("Óû§ÈÏÖ¤ÐÅÏ¢ÓëºÏͬǩÊð·½ÐÅÏ¢²»Æ¥Åä") != -1) { - getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3); - return getMessage; - } else if (getMessage.indexOf("contractId²»ÄÜΪ¿Õ") != -1) { - return getMessage; - } else { - return "error"; - } - } - } catch (Exception e) { - tx.rollback(); - e.printStackTrace(); - return "error"; - } - } - - /** - * Ìáǰ½áÇå ÉêÇëÊé½øÐеç×ÓǩԼ - * - * @author - * @param - * @return - * @throws Exception - */ - public String AdjustFordSignIng(JBOTransaction tx) throws Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - Map> map = new HashMap>(); - ContractSignInfo con = null; - List bo = null; - BizObject ldclBo = null; - try { - // ²éѯlb_doc_contract_list±í - bo = contBom.createQuery("flow_unid=:flow_unid and file_flag='yes'").setParameter("flow_unid", FlowUnid).getResultList(true); - for (BizObject keys : bo) { - String info = keys.getAttribute("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString(); - List list = map.get(info); - if (list == null) { - list = new ArrayList(); - map.put(info, list); - } - con = new ContractSignInfo(); - con.setCustname(keys.getAttribute("CUSTOMERNAME").toString()); - con.setCustphone(keys.getAttribute("TELEPHONE").toString()); - con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString()); - con.setFilename(keys.getAttribute("FILENAME").toString()); - // »ñÈ¡Éú³ÉÎļþ·¾¶ - String makefullPath = keys.getAttribute("FULLPATH").toString(); - File file = new File(makefullPath); - if (!file.exists()) { - throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); - } - con.setInputfile(BASE64.encodeImgageToBase64(file)); - list.add(con); - } - Map fromCondtion = new HashMap(); - Map otherProperty = new HashMap(); - Map resultMap = null; - resultMap = requestService.createAdjustFordContractDSign(map); - if (!resultMap.containsKey("error")) { - for (String key : resultMap.keySet()) { - if (key.indexOf("contract_") == -1) { - fromCondtion.clear(); - otherProperty.clear(); - // ÆõÔ¼ËøºÏͬºÅ - String contractId = resultMap.get("contract_" + key); - String sendProcess = resultMap.get("contract_" + contractId); - ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); - ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); - ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); - ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); - ldclBo.setAttributeValue("SENDPROCESS", sendProcess); -// ldclBo.setAttributeValue("PROCESS", "4"); - contBom.saveObject(ldclBo); - - String contractDocId = ldclBo.getAttribute("id").toString(); - fromCondtion.put("id", contractDocId); - otherProperty.put("SIGNPROCESS", "0");// ·¢Æðµç×ÓǩԼ - otherProperty.put("CONTRACTDOCID", contractDocId);// ·¢Æðµç×ÓǩԼ - otherProperty.put("INPUTTIME", DateAssistant.getTodayNow()); - // ¿½±íµÄ·½·¨ - DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, - otherProperty, tx); - } - } - return "success"; - } else { - Boolean flag = false; - String getMessage = resultMap.get("error"); - logger.info("ÆõÔ¼Ëø·´À¡µÄÒì³£ÐÅÏ¢" + getMessage); - for (String key : resultMap.keySet()) { - // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid - if (key.indexOf("contract_") == -1 && !"error".equals(key)) { - fromCondtion.clear(); - otherProperty.clear(); - // ÆõÔ¼ËøºÏͬºÅ - String contractId = resultMap.get("contract_" + key); - String sendProcess = resultMap.get("contract_" + contractId); - ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); - ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); - ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); - ldclBo.setAttributeValue("SENDPROCESS", sendProcess); - if ("1".equals(sendProcess)) { - flag = true; - ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); - } else if ("2".equals(sendProcess)) { - ldclBo.setAttributeValue("MESSAGE", getMessage); - } - contBom.saveObject(ldclBo); - String contractDocId = ldclBo.getAttribute("id").toString(); - fromCondtion.put("ID", contractDocId); - otherProperty.put("SIGNPROCESS", "0");// ·¢Æðµç×ÓǩԼ - otherProperty.put("CONTRACTDOCID", contractDocId); - otherProperty.put("INPUTTIME", DateAssistant.getTodayNow()); - DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, - otherProperty, tx); - } - } - // Åжϲ»Í¬µÄÒì³£·´À¡¸øÇ°¶Ë - if (getMessage.indexOf("Óû§ÈÏÖ¤ÐÅÏ¢ÓëºÏͬǩÊð·½ÐÅÏ¢²»Æ¥Åä") != -1) { - getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3); - return getMessage; - } else if (getMessage.indexOf("contractId²»ÄÜΪ¿Õ") != -1) { - return getMessage; - } else { - return "error"; - } - } - } catch (Exception e) { - tx.rollback(); - e.printStackTrace(); - return "error"; - } - - } -/** - * Ìáǰ½áÇå²éѯǩԼ״̬ - * @param tx - * @return - * @throws Exception - */ - public String getAdjustFordSignStatus(JBOTransaction tx) throws Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - BizObjectManager ldclBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - BizObjectManager clBom = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME, tx); - List ldclBoList = ldclBom.createQuery("flow_unid='" + FlowUnid + "' and file_flag='yes' and " - + "sendprocess='1'").getResultList(true); - String signContractId = ""; - String customerName = ""; - String contractDocId = ""; - StringBuffer result = new StringBuffer(); - Map fromCondtion = new HashMap(); - Map otherProperty = new HashMap(); - for (BizObject key : ldclBoList) { - signContractId = key.getAttribute("singcontract_id").toString(); - customerName = key.getAttribute("customername").toString(); - contractDocId = key.getAttribute("id").toString(); - try { - String signType = requestService.getContractSignStatus(signContractId); - String signstatus = clBom.createQuery("itemno='" + signType + "'").getSingleResult(false).getAttribute("itemname").toString(); - key.setAttributeValue("sign_type", signType); - if("COMPLETE".equals(signType)){ - key.setAttributeValue("PROCESS", "5.1"); - } - ldclBom.saveObject(key); - result.append("," + customerName + "µç×ÓǩԼ״̬:" + signstatus); - //ÈÕÖ¾¼Ç¼ - - fromCondtion.put("ID", contractDocId); - otherProperty.put("SIGNPROCESS", "1");// ²éѯ״̬ - otherProperty.put("CONTRACTDOCID", contractDocId); - otherProperty.put("INPUTTIME", DateAssistant.getTodayNow()); - DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, - otherProperty, tx); - } catch (Exception e) { - fromCondtion.put("ID", contractDocId); - otherProperty.put("SIGNPROCESS", "1");// ²éѯ״̬ - otherProperty.put("CONTRACTDOCID", contractDocId); - otherProperty.put("MESSAGE", e.getMessage()); - otherProperty.put("INPUTTIME", DateAssistant.getTodayNow()); - DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, - otherProperty, tx); - return "error"+"@"+e.getMessage(); - } - - } - return result.toString().substring(1); - } - - /** - * (¿Û¿î¿¨±ä¸ü)×ÔÈ»ÈËίÍпۿîÊÚȨÊé»ñÈ¡µç×ÓǩԼ״̬ ,·¨ÈË×â½ð´ú³¥ - * - * @throws Exception - */ - public String contractSignStatusForContract(JBOTransaction tx) throws Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - BizObjectManager ldclBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - BizObjectManager clBom = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME, tx); - List ldclBoList = ldclBom.createQuery("flow_unid='" + FlowUnid + "' and file_flag='yes' and " - + "sendprocess='1'").getResultList(true); - String signContractId = ""; - String customerName = ""; - String contractDocId = ""; - StringBuffer result = new StringBuffer(); - Map fromCondtion = new HashMap(); - Map otherProperty = new HashMap(); - for (BizObject key : ldclBoList) { - signContractId = key.getAttribute("singcontract_id").toString(); - customerName = key.getAttribute("customername").toString(); - contractDocId = key.getAttribute("id").toString(); - try { - String signType = requestService.getContractSignStatus(signContractId); - String signstatus = clBom.createQuery("itemno='" + signType + "'").getSingleResult(false).getAttribute("itemname").toString(); - key.setAttributeValue("sign_type", signType); - if("COMPLETE".equals(signType)){ - key.setAttributeValue("PROCESS", "5.1"); - } - ldclBom.saveObject(key); - result.append("," + customerName + "µç×ÓǩԼ״̬:" + signstatus); - //ÈÕÖ¾¼Ç¼ - - fromCondtion.put("ID", contractDocId); - otherProperty.put("SIGNPROCESS", "1");// ²éѯ״̬ - otherProperty.put("CONTRACTDOCID", contractDocId); - otherProperty.put("INPUTTIME", DateAssistant.getTodayNow()); - DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, - otherProperty, tx); - } catch (Exception e) { - fromCondtion.put("ID", contractDocId); - otherProperty.put("SIGNPROCESS", "1");// ²éѯ״̬ - otherProperty.put("CONTRACTDOCID", contractDocId); - otherProperty.put("MESSAGE", e.getMessage()); - otherProperty.put("INPUTTIME", DateAssistant.getTodayNow()); - DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, - otherProperty, tx); - return "error"+"@"+e.getMessage(); - } - - } - return result.toString().substring(1); - } - - /** - * »ñÈ¡µç×ÓǩԼ״̬ - * - * @throws Exception - */ - public String contractSignStatus(JBOTransaction tx) throws Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - //BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx); - BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME, tx); - BizObjectManager clBom = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME, tx); - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - BizObjectManager ldBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx); - //BizObject pbo = pbm.createQuery("id=:id").setParameter("id", ProjectId).getSingleResult(true); - BizObject pbo = pbm.createQuery("FLOWUNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(true); - String status = ""; - String peopleStatus=""; - String sql = ""; - if ("01".equals(customerType)) { - sql = "project_id=:projectId and file_flag='yes' and doc_name='×â½ð´ú³¥º¯' and sendprocess='1'"; - } else { - sql = "project_id=:projectId and file_flag='yes' and sendprocess='1'"; - } - @SuppressWarnings("unchecked") - List bo = contBom.createQuery(sql).setParameter("projectId", ProjectId).getResultList(true); - if (bo != null) { - boolean flag = true; - Map map = new HashMap(); - for (BizObject keys : bo) { - map.put(keys.getAttribute("singcontract_id").toString(), keys.getAttribute("customername").toString()); - } - for (String key : map.keySet()) { - try { - String signStatu = requestService.getContractSignStatus(key); - int index = signStatu.indexOf("$"); - String signStatus = signStatu.substring(0, index); - peopleStatus = signStatu.substring(index+1); - String signStatusName = - clBom.createQuery("itemno='" + signStatus + "'").getSingleResult(false).getAttribute("itemname").toString(); - List ldclList = - contBom.createQuery("project_id=:projectId and file_flag='yes' and singcontract_id='" + key + "'") - .setParameter("projectId", ProjectId).getResultList(true); - for (BizObject keys : ldclList) { - keys.setAttributeValue("SIGN_TYPE", signStatus); - // ¿Í»§Ç©ÊðÍê³É£¬ºÏÍ¬ÖÆ×÷¹ý³ÌΪ4 - if ("REQUIRED".equals(signStatus)) { - this.sign(tx); - downloadDoc(tx); - keys.setAttributeValue("PROCESS", "4"); - } - contBom.saveObject(keys); - } - if (!"REQUIRED".equals(signStatus) && !"COMPLETE".equals(signStatus) ) { - flag = false; - } - if ("REQUIRED".equals(signStatus)) { - status += ";
¿Í»§" + map.get(key) + "ǩԼ״̬:ÒÑÇ©Ãû"; - } else { - status += ";
¿Í»§" + map.get(key) + "ǩԼ״̬:" + signStatusName; - } - } catch (Exception e) { - e.printStackTrace(); - return "»ñȡǩԼ״̬ʧ°Ü!"; - } - } - // ºÏͬǩԼÒÑÍê³É - if (flag) { - pbo.setAttributeValue("DATA_STATE", "4");// ״̬¸Ä³ÉÒÑÍê³Éµç×ÓǩԼ - pbm.saveObject(pbo); - // ¼Ç¼ÏîÄ¿½ø³ÌÈÕÖ¾ - /* Transaction tran = Transaction.createTransaction(tx); - ASUser user = ASUser.getUser(CurUserID, tran); - JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME, tx) - .createQuery("UPDATE O SET BUSINESS_STATUS='4',UPDATEUSERID='" + user.getUserID() + "',UPDATEORGID='" - + user.getOrgID() + "',UPDATETIME='" + StringFunction.getTodayNow() - + "' WHERE CONTRACT_NUMBER=(SELECT LPI.CONTRACT_NUMBER FROM " + LB_PROJECT_INFO.CLASS_NAME - + " LPI WHERE LPI.ID='" + ProjectId + "')") - .executeUpdate(); - SqlObject so = new SqlObject( - "INSERT INTO BUSINESS_DETAIL(ID,CONTRACT_NUMBER,BUSINESS_STATUS,INPUTUSERID,INPUTORGID,INPUTTIME) SELECT SYS_GUID(),CONTRACT_NUMBER,'4','" - + user.getUserID() + "','" + user.getOrgID() + "','" + StringFunction.getTodayNow().replaceAll(":", "¡÷") - + "' FROM LB_PROJECT_INFO WHERE ID='" + ProjectId + "'"); - so.setDebugSql(so.getDebugSql().replaceAll("¡÷", ":")); - so.setOriginalSql(so.getOriginalSql().replaceAll("¡÷", ":")); - so.setRunSql(so.getRunSql().replaceAll("¡÷", ":")); - tran.executeSQL(so);*/ - for (BizObject keys : bo) { - /* ldBom.createQuery("update O set status='' where id='" + keys.getAttribute("attribute_id").toString() + "'") - .executeUpdate();*/ - } - status = ";
ÒѾ­Íê³Éµç×ÓǩԼ"; - } - } - if (status.length() < 1) { - return "»ñȡǩԼ״̬ʧ°Ü,ûÓкÏͬÎļþ"; - } else { - status = status.substring(5); - String[] peopleStat = peopleStatus.split(","); - if(peopleStat.length>1){ - status = status+"
"; - for(int i=0;i map = new HashMap(); - - map.put(ldb.getAttribute("TEMPLATE_ID").toString(),lul.getAttribute("CUSTOMER_NAME").toString()); - - for (String key : map.keySet()) { - try { - String signStatu = requestService.getContractSignStatus(key); - int index = signStatu.indexOf("$"); - String signStatus = signStatu.substring(0, index); - peopleStatus = signStatu.substring(index+1); - String signStatusName = - clBom.createQuery("itemno='" + signStatus + "'").getSingleResult(false).getAttribute("itemname").toString(); - BizObject ldl = ldlMange.createQuery("RELATIVE_ID=:relativeid").setParameter("relativeid", ldb.getAttribute("ID").getString()).getSingleResult(false); - lda = ldaMange.createQuery("LIBRARY_ID=:libraryid").setParameter("libraryid", ldl.getAttribute("ID").getString()).getSingleResult(true); - if (signStatu.indexOf("ÒÑÇ©Êð")>0) { - signStatus = "REQUIRED"; - }else{ - flag = false; - } - if ("REQUIRED".equals(signStatus)) { - status += ";
¿Í»§" + map.get(key) + "ǩԼ״̬:ÒÑÇ©Ãû"; - } else { - status += ";
¿Í»§" + map.get(key) + "ǩԼ״̬:" + signStatusName; - } - } catch (Exception e) { - e.printStackTrace(); - return "»ñȡǩԼ״̬ʧ°Ü!"; - } - } - // ºÏͬǩԼÒÑÍê³É - if (flag) { - lda.setAttributeValue("REMARK", "COMPLETE");// ״̬¸Ä³ÉÒÑÍê³Éµç×ÓǩԼ - BizObjectManager ldclManage=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); - BizObject ldcl = ldclManage.createQuery(" FLOW_UNID=:flowunid and CONTRACT_ID=:contractid and file_flag='yes' ").setParameter("flowunid", FlowUnid).setParameter("contractid", contract_id).getSingleResult(true); - if(ldcl != null){ - ldcl.setAttributeValue("sign_type", "COMPLETE"); - ldclManage.saveObject(ldcl); - } - ldaMange.saveObject(lda); - status = ";
ÒѾ­Íê³Éµç×ÓǩԼ"; - changedownloadDoc(tx); - } - } - - if (status.length() < 1) { - return "»ñȡǩԼ״̬ʧ°Ü,ûÓкÏͬÎļþ"; - } else { - status = status.substring(5); - String[] peopleStat = peopleStatus.split(","); - if(peopleStat.length>1){ - status = status+"
"; - for(int i=0;i contractIds = new ArrayList(); - if ("01".equals(customerType)) { - sql = "project_id=:projectId and file_flag='yes' and doc_name='×â½ð´ú³¥º¯' and sendprocess='1'"; - } else { - sql = "project_id=:projectId and file_flag='yes' and sendprocess='1'"; - } - @SuppressWarnings("unchecked") - List bo = contBom.createQuery(sql).setParameter("projectId", ProjectId).getResultList(true); - if (bo != null) { - boolean flag = true; - Map map = new HashMap(); - for (BizObject keys : bo) { - map.put(keys.getAttribute("singcontract_id").toString(), keys.getAttribute("customername").toString()); - contractIds.add(keys.getAttribute("singcontract_id").toString()); - } - - Map resultMap = requestService.getContractSignListStatus(contractIds); - } - return ""; - } - - /** - * ¸ÇÆóÒµÕ - * - * @param tx - * @return - * @throws MalformedURLException - * @throws Exception - */ - public String sign(JBOTransaction tx) throws MalformedURLException, Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - @SuppressWarnings("unchecked") - List bo = contBom.createQuery("project_id=:projectId and file_flag='yes'") - .setParameter("projectId", ProjectId).getResultList(true); - if (bo != null) { - Map> map = new HashMap>(); - for (BizObject keys : bo) { - List list = map.get(keys.getAttribute("singcontract_id").toString()); - if (list == null) { - list = new ArrayList(); - } - list.add(keys.getAttribute("DOCUMENT_ID").toString()+"@"+keys.getAttribute("doc_name").toString()); - map.put(keys.getAttribute("singcontract_id").toString(), list); - } - Map resultMap = requestService.Sign(map); - String statu = resultMap.get("error"); - if (statu == null) { - return "success"; - } - } - - return "error"; - } - - /** - * ¸ù¾Ýdocument_idÏÂÔØºÏͬ - * - * @param tx - * @return - * @throws Exception - * @throws MalformedURLException - */ - public String downloadDoc(JBOTransaction tx) throws MalformedURLException, Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - String sql = ""; - if ("01".equals(customerType)) { - sql = "project_id=:projectId and file_flag='yes' and doc_name='×â½ð´ú³¥º¯'"; - } else { - sql = "project_id=:projectId and file_flag='yes'"; - } - try { - - @SuppressWarnings("unchecked") - List bo = contBom.createQuery(sql).setParameter("projectId", ProjectId).getResultList(true); - if (bo != null) { - Map map = new HashMap(); - for (BizObject keys : bo) { - map.put(keys.getAttribute("DOCUMENT_ID").toString(), keys.getAttribute("FULLPATH").toString()); - } - Map result = requestService.downloadDoc(map); - if (!result.containsKey("error")) { - for (String contractId : map.keySet()) { - try { - if ("success".equals(result.get(contractId))) { - String fileString = result.get("file_" + contractId); - InputStream fileInput = BASE64.encodeFileToBase64(fileString); - OutputStream fileOut = new FileOutputStream(map.get(contractId));// TODO - byte[] buffByte = new byte[1024]; - int size = 0; - while ((size = fileInput.read(buffByte)) != -1) { - fileOut.write(buffByte, 0, size); - } - fileInput.close(); - fileOut.close(); - } else if ("error".equals(result.get(contractId))) { - return "error"; - } - } catch (Exception e) { - e.printStackTrace(); - - } - } - return "success"; - } else { - return "error"; - } - } - } catch (Exception e) { - return "error"; - } - return "success"; - } - - /** - * ¿Û¿î¿¨ÐÅÏ¢±ä¸ü¸ù¾Ýdocument_idÏÂÔØºÏͬ - * - * @param tx - * @return - * @throws Exception - * @throws MalformedURLException - */ - public String changedownloadDoc(JBOTransaction tx) throws MalformedURLException, Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - BizObjectManager ldMange = JBOFactory.getBizObjectManager(LB_DOCRELATIVE.CLASS_NAME, tx); - String sql = "OBJECTTYPE='ChangeCar' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid "; - @SuppressWarnings("unchecked") - BizObject ldb = ldMange.createQuery(sql).setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(true); - BizObjectManager clBom = JBOFactory.getBizObjectManager(LB_DOCLIBRARY.CLASS_NAME, tx); - try { - if (ldb != null) { - BizObject ldl = clBom.createQuery("RELATIVE_ID=:relativeid").setParameter("relativeid", ldb.getAttribute("ID").getString()).getSingleResult(false); - BizObjectManager ldaMange = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx); - BizObject lda = ldaMange.createQuery("LIBRARY_ID=:libraryid").setParameter("libraryid", ldl.getAttribute("ID").getString()).getSingleResult(false); - Map map = new HashMap(); - map.put(ldl.getAttribute("REMARK").toString(), lda.getAttribute("FULLPATH").toString()); - Map result = requestService.downloadDoc(map); - if (!result.containsKey("error")) { - for (String contractId : map.keySet()) { - try { - if ("success".equals(result.get(contractId))) { - String fileString = result.get("file_" + contractId); - InputStream fileInput = BASE64.encodeFileToBase64(fileString); - OutputStream fileOut = new FileOutputStream(map.get(contractId));// TODO - byte[] buffByte = new byte[1024]; - int size = 0; - while ((size = fileInput.read(buffByte)) != -1) { - fileOut.write(buffByte, 0, size); - } - fileInput.close(); - fileOut.close(); - } else if ("error".equals(result.get(contractId))) { - return "error"; - } - } catch (Exception e) { - e.printStackTrace(); - - } - } - return "success"; - } else { - return "error"; - } - } - } catch (Exception e) { - return "error"; - } - return "success"; - } - -//¿Û¿î¿¨±ä¸üÏÂÔØºÏͬ - public String downloadDocContract(JBOTransaction tx) throws MalformedURLException, Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - String sql = ""; - sql = "flow_unid=:flow_unid and file_flag='yes'"; - String attributeId = ""; - try { - @SuppressWarnings("unchecked") - List bo = contBom.createQuery(sql).setParameter("flow_unid", FlowUnid).getResultList(true); - if (bo != null) { - Map map = new HashMap(); - for (BizObject keys : bo) { - map.put(keys.getAttribute("DOCUMENT_ID").toString(), keys.getAttribute("FULLPATH").toString()); - attributeId = keys.getAttribute("ATTRIBUTE_ID").toString(); - } - Map result = requestService.downloadDoc(map); - - if (!result.containsKey("error")) { - for (String contractId : map.keySet()) { - try { - if ("success".equals(result.get(contractId))) { - String fileString = result.get("file_" + contractId); - InputStream fileInput = BASE64.encodeFileToBase64(fileString); - OutputStream fileOut = new FileOutputStream(map.get(contractId));// TODO - byte[] buffByte = new byte[1024]; - int size = 0; - while ((size = fileInput.read(buffByte)) != -1) { - fileOut.write(buffByte, 0, size); - } - fileInput.close(); - fileOut.close(); - } else if ("error".equals(result.get(contractId))) { - return "error@"; - } - } catch (Exception e) { - e.printStackTrace(); - - } - } - return "success@" + attributeId; - } else { - return "error@"; - } - } else { - System.out.println("ûÓÐÎļþ¿ÉÏÂÔØ"); - return "error@"; - } - } catch (Exception e) { - e.printStackTrace(); - return "error@"; - } - } - -/** - * ¿Û¿î¿¨±ä¸üÏÂÔØzipºÏͬ - * @param tx - * @return - * @throws Exception - * @throws MalformedURLException - */ -public String downloadZipContract(JBOTransaction tx) throws MalformedURLException, Exception{ - requestService = (HttpRequestAppService) factory.create( - HttpRequestAppService.class, this.getConfigRequestUrl()); - BizObjectManager contBom=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - try{ - String path=null; - @SuppressWarnings("unchecked") - String sql=""; - sql="flow_unid=:flow_unid and file_flag='yes'"; - @SuppressWarnings("unchecked") - List bo = contBom.createQuery(sql).setParameter("flow_unid",FlowUnid).getResultList(true); - - if(bo!=null){ - Map map=new HashMap(); - for(BizObject keys:bo){ - path="D://"+keys.getAttribute("singcontract_id").toString()+"DocList.zip"; - map.put(keys.getAttribute("singcontract_id").toString(),path); - } - String result=requestService.download(map); - if(result.equals("success")){ - return "success"; - }else{ - return "error"; - } - } - }catch(Exception e){ - return "error"; - } - return "success"; -} - - -/** - * ¸ù¾Ýcontract_idÏÂÔØºÏͬ - * @param tx - * @return - * @throws Exception - * @throws MalformedURLException - */ -public String download(JBOTransaction tx) throws MalformedURLException, Exception{ - requestService = (HttpRequestAppService) factory.create( - HttpRequestAppService.class, this.getConfigRequestUrl()); - BizObjectManager contBom=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - try{ - String path=null; - @SuppressWarnings("unchecked") - List bo = contBom.createQuery("project_id=:projectId and file_flag='yes'").setParameter("projectId",ProjectId).getResultList(true); - if(bo!=null){ - Map map=new HashMap(); - for(BizObject keys:bo){ - path="D://"+keys.getAttribute("singcontract_id").toString()+"DocList.zip"; - map.put(keys.getAttribute("singcontract_id").toString(),path); - } - String result=requestService.download(map); - if(result.equals("success")){ - return "success"; - }else{ - return "error"; - } - } - }catch(Exception e){ - return "error"; - } - return "success"; -} - -/** - *jar°ü·½Ê½wordת»»pdf - *ÓÃjar·½·¨ - *wordת»»pdf - */ -public void wordToPdfJar(JBOTransaction tx){ - try { - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); - String sql=""; - if(flagType==null || "word".equals(flagType)){ - sql="project_id='"+ProjectId+"' and file_flag='yes' and process='1'"; - }else if("contract".equals(flagType)){ - sql="contract_id='"+contract_id+"' and file_flag='yes' and process='1'"; - }else if("pdfFalse".equals(flagType)){ - sql="project_id='"+ProjectId+"' and file_flag='yes' and process='3'"; - }else if ("flowunid".equals(flagType)){ - sql = "flow_unid='"+FlowUnid+"' and file_flag='yes' and process='1'"; - } - List bo = contBom.createQuery(sql).getResultList(false); - if(bo!=null){ - for(BizObject key:bo){ - String lastFilePath= key.getAttribute("FULLPATH").toString().replace(".docx", ".pdf"); - try { - WordToPdfThread wtpt = new WordToPdfThread(key.getAttribute("FULLPATH").toString(),lastFilePath,key.getAttribute("ATTRIBUTE_ID").toString()); - wtpt.start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - } catch (JBOException e) { - e.printStackTrace(); - - } -} -/** - * LibreOfficeʵÏÖwordת»»pdf - * wordת»»pdf - * @throws JBOException - */ - @SuppressWarnings({ "unchecked", "static-access" }) - public void wordToPdf(JBOTransaction tx) throws JBOException { - try { - BizObjectManager fbo = JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME, tx); - BizObject fbos = fbo.createQuery("FLOW_UNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(false); - //»ñÈ¡Óû§ÐÅÏ¢ - BizObjectManager lult = JBOFactory.getBizObjectManager(LB_UNION_LESSEE_TEMP.CLASS_NAME); - BizObjectManager customer = JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME); - BizObject lults = lult.createQuery("flowunid=:flowUnid").setParameter("flowUnid", FlowUnid).getSingleResult(false); - BizObject cust = customer.createQuery("flowunid=:flowUnid and customerid=:customerid").setParameter("flowUnid", FlowUnid).setParameter("customerid", lults.getAttribute("customer_id").toString()).getSingleResult(false); - String customername = null; - String telephone = null; - String ids =null; - - if(cust!=null){ - customername = cust.getAttribute("FULLNAME").toString(); - telephone = cust.getAttribute("mobile").toString(); - ids = cust.getAttribute("CUSTOMERID").toString(); - } - - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - BizObjectManager attrBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx); - WordToPDFUtil wordTopdf = new WordToPDFUtil(); - File file = null; - Boolean result = null; - String sql = ""; - /*if (flagType == null || "word".equals(flagType)) { - sql = "project_id='" + ProjectId + "' and file_flag='yes' and process='1'"; - } else if ("contract".equals(flagType)) { - sql = "contract_id='" + contract_id + "' and file_flag='yes' and process='1'"; - } else if ("pdfFalse".equals(flagType)) { - sql = "project_id='" + ProjectId + "' and file_flag='yes' and process='3'"; - } else if ("flowunid".equals(flagType)){ - sql = "flow_unid='"+FlowUnid+"' and file_flag='yes' and (process='1' or process='3')"; - }*/ - List bo = contBom.createQuery("flow_unid=:flowUnid and file_flag='yes' and process='1'").setParameter("flowUnid", FlowUnid).getResultList(true); - if (bo != null) { - for (BizObject contBo : bo) { - String attrId = contBo.getAttribute("ATTRIBUTE_ID").toString(); - BizObject attrBo = attrBom.createQuery("id='" +attrId+"'").getSingleResult(true); - String path = attrBo.getAttribute("FULLPATH").toString(); - String lastFilePath = path.replace(".docx", ".pdf"); - File filePath = new File(path); - if(!filePath.exists()){ - logger.info("wordת»»pdfµÄÔ´Îļþ²»´æÔÚ"); - continue; - } - String lastFilePathpdf = filePath.getParent(); - try { - result = wordTopdf.Word2Pdf(path, lastFilePathpdf); - } catch (Exception e) { - result = false; - e.printStackTrace(); - } - if (result) { - file =new File(lastFilePath); - contBo.setAttributeValue("FULLPATH",lastFilePath); - contBo.setAttributeValue("FILENAME",contBo.getAttribute("FILENAME").toString().replace(".docx",".pdf" )); - contBo.setAttributeValue("FILEPATH",contBo.getAttribute("FILEPATH").toString().replace(".docx", ".pdf")); - contBo.setAttributeValue("CONTENT_TYPE","application/pdf"); - contBo.setAttributeValue("PROCESS","2"); - contBo.setAttributeValue("PROJECT_ID",fbos.getAttribute("proj_id").toString()); - contBo.setAttributeValue("CUSTOMERNAME",customername); - contBo.setAttributeValue("TELEPHONE",telephone); - contBo.setAttributeValue("IDS",ids); - contBom.saveObject(contBo); - attrBo.setAttributeValue("FULLPATH",attrBo.getAttribute("FULLPATH").toString().replace(".docx", ".pdf")); - attrBo.setAttributeValue("FILENAME",attrBo.getAttribute("FILENAME").toString().replace(".docx", ".pdf")); - attrBo.setAttributeValue("FILEPATH",attrBo.getAttribute("FILEPATH").toString().replace(".docx", ".pdf")); - attrBo.setAttributeValue("FileSize",file.length()); - attrBo.setAttributeValue("CONTENT_TYPE","application/pdf"); - attrBom.saveObject(attrBo); - }else{ - contBo.setAttributeValue("PROCESS","3"); - contBom.saveObject(contBo); - } - } - } - } catch (JBOException e) { - e.printStackTrace(); - } - } - - /** - * ×â½ð֪ͨÊ鸽¼þÓÃLibreOfficeʵÏÖwordת»»pdf - * wordת»»pdf - * @throws JBOException - */ - @SuppressWarnings({ "unchecked", "static-access" }) - public String wordToPdfAnnex(JBOTransaction tx) throws JBOException { - - PLAN_LIST=PLAN_LIST.split("\\.")[0]; - BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME); - BizObject DOCRELATIVE = null; - if("null".equals(PLAN_LIST)){ - DOCRELATIVE=bom.createQuery("plan_number=:plan_number").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false); - }else if("rights".equals(PLAN_LIST)){ - DOCRELATIVE = bom.createQuery("CONTRACT_ID=:CONTRACT_ID and objecttype='rights'").setParameter("CONTRACT_ID",contract_id).getSingleResult(false); - }else if("settle".equals(PLAN_LIST)){ - DOCRELATIVE = bom.createQuery("CONTRACT_ID=:CONTRACT_ID and objecttype='settle'").setParameter("CONTRACT_ID",contract_id).getSingleResult(false); - }else if("TX".equals(PLAN_LIST)){ - DOCRELATIVE=bom.createQuery("plan_number=:plan_number and objecttype='AdjustInterst' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false); - }else if("ChangeCar".equals(PLAN_LIST)){ - DOCRELATIVE=bom.createQuery(" OBJECTTYPE='ChangeCar' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false); - }else if("transfer".equals(PLAN_LIST)){ - DOCRELATIVE=bom.createQuery(" OBJECTTYPE='transfer' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false); - }else if("AdjustmentNotice".equals(PLAN_LIST)){ - DOCRELATIVE=bom.createQuery(" OBJECTTYPE='AdjustmentNotice' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false); - }else if("TriditionCollection".equals(PLAN_LIST)){ - DOCRELATIVE=bom.createQuery(" OBJECTTYPE='TriditionCollection' and plan_number=:plan_number").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false); - }else if("TriditionSuspension".equals(PLAN_LIST)){ - DOCRELATIVE=bom.createQuery(" OBJECTTYPE='TriditionSuspension' and FLOW_UNID=:flowunid ").setParameter("flowunid",FlowUnid).getSingleResult(false); - }else if("settletradition".equals(PLAN_LIST)){ - DOCRELATIVE=bom.createQuery(" OBJECTTYPE='settletradition' and FLOW_UNID=:flowunid ").setParameter("flowunid",FlowUnid).getSingleResult(false); - }else if("LetterApprova".equals(PLAN_LIST)){ - DOCRELATIVE=bom.createQuery(" OBJECTTYPE='LetterApprova' and PROJ_ID=:projectId ").setParameter("projectId",ProjectId).getSingleResult(false); - }else if("LoanNotice".equals(PLAN_LIST)){ - DOCRELATIVE=bom.createQuery(" OBJECTTYPE='LoanNotice' and PROJ_ID=:projectId ").setParameter("projectId",ProjectId).getSingleResult(false); - } - else{ - DOCRELATIVE=bom.createQuery("plan_number=:plan_number and plan_list=:plan_list").setParameter("plan_number",PAYMENT_NUMBER).setParameter("plan_list", PLAN_LIST).getSingleResult(false); - } - - BizObjectManager attrBom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCATTRIBUTE.CLASS_NAME); - BizObject attrBo=null; - WordToPDFUtil wordTopdf = new WordToPDFUtil(); - File file = null; - Boolean result = null; - String sql = ""; - try { - if (DOCRELATIVE != null) { - - String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString(); - BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME); - String DOCLIBRARYid=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(false).getAttribute("id").toString(); - attrBo = attrBom.createQuery("library_id=:library_id").setParameter("library_id", DOCLIBRARYid).getSingleResult(true); - - String path = attrBo.getAttribute("FULLPATH").toString(); - String lastFilePath = path.replace(".docx", ".pdf"); - File filePath = new File(path); - if(!filePath.exists()){ - logger.info("wordת»»pdfµÄÔ´Îļþ²»´æÔÚ"); - } - String lastFilePathpdf = filePath.getParent(); - try { - result = wordTopdf.Word2Pdf(path, lastFilePathpdf); - } catch (Exception e) { - result = false; - e.printStackTrace(); - } - if (result) { - file =new File(lastFilePath); - attrBo.setAttributeValue("FULLPATH",attrBo.getAttribute("FULLPATH").toString().replace(".docx", ".pdf")); - attrBo.setAttributeValue("FILENAME",attrBo.getAttribute("FILENAME").toString().replace(".docx", ".pdf")); - attrBo.setAttributeValue("FILEPATH",attrBo.getAttribute("FILEPATH").toString().replace(".docx", ".pdf")); - attrBo.setAttributeValue("FileSize",file.length()); - attrBo.setAttributeValue("CONTENT_TYPE","application/pdf"); - attrBom.saveObject(attrBo); - }else{ - } - if("ChangeCar".equals(PLAN_LIST)){ - BizObjectManager ldclManage=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); - BizObject ldcl = ldclManage.createQuery(" FLOW_UNID=:flowunid and CONTRACT_ID=:contractid and file_flag='yes' ").setParameter("flowunid", FlowUnid).setParameter("contractid", contract_id).getSingleResult(true); - file =new File(lastFilePath); - ldcl.setAttributeValue("FULLPATH",lastFilePath); - ldcl.setAttributeValue("FILENAME",ldcl.getAttribute("FILENAME").toString().replace(".docx",".pdf" )); - ldcl.setAttributeValue("FILEPATH",ldcl.getAttribute("FILEPATH").toString().replace(".docx", ".pdf")); - ldcl.setAttributeValue("CONTENT_TYPE","application/pdf"); - ldcl.setAttributeValue("PROCESS","2"); - ldclManage.saveObject(ldcl); - } - } - - } catch (JBOException e) { - e.printStackTrace(); - } - return attrBo.getAttribute("ID").toString(); - } - /** - * ¶àÏß³Ìwordת»»pdf - * @author tenwa518 - * - */ -class WordToPdfThread extends Thread{ - final String fullPath; - final String lastFilePath; - final String attrId; - public WordToPdfThread(String fullPath,String lastFilePath,String attrId){ - this.fullPath = fullPath; - this.lastFilePath = lastFilePath; - this.attrId = attrId; - - } - @Override - public void run() { - Word2PdfUtil wP = new Word2PdfUtil(); -// WordToPDFUtil w2P = new WordToPDFUtil(); - try { -// w2P.Word2Pdf(fullPath, lastFilePathpdf); - wP.doc2pdf(fullPath,lastFilePath,attrId); - } catch (Exception e) { - e.printStackTrace(); - } - } -} -/** - * ²é¿´wordÎļþÊÇ·ñ¶¼×ªÎªpdf - * @param tx - * @return - * @throws JBOException - */ -public String getMakeContractProcess(JBOTransaction tx) throws JBOException{ - BizObjectManager ldclBom=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - int wordIng=0; - int pdfFalse=0; - int pdfTrue=0; - List ldclBo2=ldclBom.createQuery("project_id='"+ProjectId+"' and file_flag='yes' ").getResultList(false); - if(ldclBo2.size()>0){ - for(BizObject key:ldclBo2){ - String process = key.getAttribute("process").toString(); - if("1".equals(process)){ - wordIng++; -// return "error"; - }else if("2".equals(process)){ - pdfTrue++; -// return "wording"; - }else if("3".equals(process)){ - pdfFalse++; -// return "success"; - } - } - }else{ - //ÖÆ×÷ºÏͬ - return "0"; - } - if(wordIng>0 && pdfFalse>0 && pdfTrue>0){ - //wordת»»PDF²¿·Öʧ°Ü - return "1"; - }else if(wordIng==0 && pdfFalse>0 && pdfTrue>0){ - //wordתPDFʧ°Ü - return "2"; - }else if(wordIng==0 && pdfFalse>0 && pdfTrue>0){ - //wordת»»PDF²¿·Öʧ°Ü£¬ - return "3"; - }else if(wordIng>0 && pdfFalse==0 && pdfTrue>0){ - //wordÕýÔÚת»»pdf - return "4"; - }else if(wordIng>0 && pdfFalse==0 && pdfTrue==0){ - //wordûÓÐת»»pdf - return "5"; - }else if(wordIng==0 && pdfFalse==0 && pdfTrue>0){ - //wordת»»PDF³É¹¦ - return "6"; - } - return "error"; -} -//(¿Û¿î¿¨±ä¸ü)¸ù¾ÝºÏͬºÅ»ñÈ¡Îļþ״̬ -public String getMakeContractProcessContract(JBOTransaction tx) throws JBOException{ - BizObjectManager ldclBom=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - BizObject ldclBo = null; - ldclBo=ldclBom.createQuery("flow_unid='"+FlowUnid+"'and file_flag='yes' ").getSingleResult(false); - if(ldclBo!=null){ - String process = ldclBo.getAttribute("process").toString(); - String signType = ldclBo.getAttribute("sign_type").toString(); - if("1".equals(process)){ - return "isDoc"; - }else if("2".equals(process)&&"DRAFT".equals(signType)){ - return "isPdf"; - }else if("COMPLETE".equals(signType)){ - return "complete"; - }else if("SIGNING".equals(signType)){ - return "isSigning"; - } - } - //±íʾ²»´æÔÚÕâ¸öÎļþ - return "notExsit"; -} -/** - * תÕËÊÚȨÉêÇëÊé - * @param tx - * @return - * @throws InterruptedException - */ -@SuppressWarnings("unchecked") -public String AccountAccreditSign(JBOTransaction tx){ - try{ - this.wordToPdf(tx); - tx.commit(); - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - List boList = contBom.createQuery("file_flag='yes' and (process='2' or process='5') and flow_unid='"+FlowUnid+"'").getResultList(true); - if(boList.size()>0){ - try { - String result =this.accountSign(tx,FlowUnid,InputOrgid); - if("success".equals(result)){ - return "success"; - }else{ - return "error"; - } - } catch (Exception e) { - e.printStackTrace(); - return "error"; - } - }else{ - return "error"; - } - } catch (JBOException e) { - e.printStackTrace(); - return "error"; - } -} -public String accountSign(JBOTransaction tx,String flowunid,String orgid) throws Exception{ - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - BizObjectManager ldclBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); - BizObjectManager attrBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME,tx); - Map map=new HashMap(); - ContractSignInfo con=null; - BizObject ldclBo=null; - try{ - //²éѯlb_doc_contract_list±í - ldclBo = ldclBom.createQuery("file_flag='yes' and process='2' and flow_unid='" + flowunid + "'").getSingleResult(true); - if (ldclBo != null) { - con = new ContractSignInfo(); - con.setFileid(ldclBo.getAttribute("ATTRIBUTE_ID").toString()); - con.setFilename(ldclBo.getAttribute("FILENAME").toString()); - // »ñÈ¡Éú³ÉÎļþ·¾¶ - String makefullPath = ldclBo.getAttribute("FULLPATH").toString(); - File file = new File(makefullPath); - if (!file.exists()) { - throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); - } - con.setInputfile(BASE64.encodeImgageToBase64(file)); - map.put(flowunid, con); - Map resultMap = null; - if (orgid.indexOf("8002003001") >= 0) { - // Î÷³ÇתÕËÊÚȨ - resultMap = requestService.createAccountContractSign(map); - } else { - // ¶«³ÇתÕËÊÚȨ - resultMap = requestService.createAccountContractDSign(map); - } - if (!resultMap.containsKey("error")) { - for (String key : resultMap.keySet()) { - if (key.indexOf("contract_") == -1) { - ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); - ldclBo.setAttributeValue("SINGCONTRACT_ID", resultMap.get("contract_" + key)); - } - } - ldclBo.setAttributeValue("PROCESS", "5"); - ldclBom.saveObject(ldclBo); - tx.commit(); - } else { - return "error"; - } - } - //À­È¡Îļþ - ldclBo = ldclBom.createQuery("file_flag='yes' and process='5' and flow_unid='" + flowunid + "'").getSingleResult(true); - if (ldclBo != null) { - BizObject attrBo = attrBom.createQuery("id='"+ldclBo.getAttribute("attribute_id")+"'").getSingleResult(true); - Map mapFile = new HashMap(); - String fileName = ldclBo.getAttribute("FILENAME").toString(); - String fullPath =FileOperatorUtil.getuploadFileDir(this.getFileSavePath())+UUIDUtil.getUUID()+"_"+fileName; - String filePath = fullPath.replaceAll(this.getFileSavePath(),""); - mapFile.put(ldclBo.getAttribute("DOCUMENT_ID").toString(),fullPath); - Map result = requestService.downloadDoc(mapFile); - if (!result.containsKey("error")) { - for (String documentId : mapFile.keySet()) { - try { - if ("success".equals(result.get(documentId))) { - String fileString = result.get("file_" + documentId); - InputStream fileInput = BASE64.encodeFileToBase64(fileString); - OutputStream fileOut = new FileOutputStream(mapFile.get(documentId));// TODO - byte[] buffByte = new byte[1024]; - int size = 0; - while ((size = fileInput.read(buffByte)) != -1) { - fileOut.write(buffByte, 0, size); - } - fileInput.close(); - fileOut.close(); - } else if ("error".equals(result.get(documentId))) { - return "error"; - } - } catch (Exception e) { - e.printStackTrace(); - } - } - ldclBo.setAttributeValue("FILEPATH",filePath); - ldclBo.setAttributeValue("FULLPATH",fullPath); - ldclBo.setAttributeValue("PROCESS", "6"); - ldclBom.saveObject(ldclBo); - attrBo.setAttributeValue("FILEPATH",filePath); - attrBo.setAttributeValue("FULLPATH",fullPath); - attrBo.setAttributeValue("FileSize",new File(fullPath).length()); - attrBom.saveObject(attrBo); - return "success"; - } else { - return "error"; - } - } else { - return "error"; - } - } catch (Exception e) { - e.printStackTrace(); - return "error"; - } - -} -public String getFlowUnid(JBOTransaction tx) throws JBOException{ - BizObjectManager fboBom=JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME,tx); - BizObject fboBo=fboBom.createQuery("CHANNELAPPLYID='"+id+"'").getSingleResult(false); - return fboBo.getAttribute("flow_unid").toString(); -} - -/* - * ÖØÐ·¢ËͶÌÐÅ - * */ -public String sendMessageAgain(JBOTransaction tx) { - try{ - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - List bo = null; - String file = new String(); - Map contractmap = new HashMap(); - List list = new ArrayList(); - bo = contBom.createQuery("select singcontract_id,filename from O where project_id =:projectId" - +" and file_flag = 'yes' and sendprocess = '1' and sign_type = 'SIGNING'") - .setParameter("projectId", ProjectId).getResultList(true); - for (BizObject temp : bo) { - String singcontractid = temp.getAttribute("singcontract_id").toString(); - String filename = temp.getAttribute("filename").toString(); - contractmap.put(singcontractid, filename); - } - list.addAll(contractmap.keySet()); - Map map = requestService.sendNotice(list); - if(!map.containsKey("error")){ - return "success"; - }else{ - for(String singcontractid:map.keySet()){ - String sendStatus = map.get(singcontractid); - if("2"==sendStatus){ - file += contractmap.get(singcontractid)+";"; - } - } - return file; - } - - } catch (Exception e) { - try { - tx.rollback(); - } catch (JBOException e1) { - e1.printStackTrace(); - } - e.printStackTrace(); - return "error"; - } -} - - /* - * ¿Û¿î¿¨ÐÅÏ¢±ä¸üÖØÐ·¢ËͶÌÐÅ - * */ - public String ChangesendMessageAgain(JBOTransaction tx) { - try{ - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - List bo = null; - String file = new String(); - Map contractmap = new HashMap(); - List list = new ArrayList(); - BizObjectManager ldMange = JBOFactory.getBizObjectManager(LB_DOCRELATIVE.CLASS_NAME, tx); - String status = ""; - String peopleStatus=""; - String sql = "OBJECTTYPE='ChangeCar' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid "; - @SuppressWarnings("unchecked") - BizObject ldb = ldMange.createQuery(sql).setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(true); - if(ldb!=null){ - String singcontractid = ldb.getAttribute("TEMPLATE_ID").toString(); - contractmap.put(singcontractid, "Ö±×â¸öÈËÊÚȨЭÒéÊé.pdf"); - } - list.addAll(contractmap.keySet()); - Map map = requestService.sendNotice(list); - if(!map.containsKey("error")){ - return "success"; - }else{ - for(String singcontractid:map.keySet()){ - String sendStatus = map.get(singcontractid); - if("2"==sendStatus){ - file += contractmap.get(singcontractid)+";"; - } - } - return file; - } - - } catch (Exception e) { - try { - tx.rollback(); - } catch (JBOException e1) { - e1.printStackTrace(); - } - e.printStackTrace(); - return "error"; - } - } - -public String getProcess(JBOTransaction tx){ - try { - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); - BizObject bo = contBom.createQuery("file_flag='yes' and process is not null and flow_unid='"+FlowUnid+"'").getSingleResult(false); - if(bo==null){ - return "success"; - }else{ - return bo.getAttribute("PROCESS").toString(); - } - } catch (JBOException e) { - e.printStackTrace(); - return "error"; - } - -} - -public String claimSign(JBOTransaction tx) throws Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - ContractSignInfo con = null; - BizObject bo = null; - String doc_name = new String(); - String[] attrIdList=attrId.split("@"); - try{ - for(String attribute_id:attrIdList){ - Map map=new HashMap(); - bo = contBom.createQuery("file_flag='yes' and process='2' and flow_unid='" + FlowUnid + "' and attribute_id= '"+attribute_id+"'").getSingleResult(true); - if(bo != null){ - con = new ContractSignInfo(); - con.setFileid(attribute_id); - con.setFilename(bo.getAttribute("FILENAME").toString()); - String makefullPath = bo.getAttribute("FULLPATH").toString(); - File file = new File(makefullPath); - if (!file.exists()) { - throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); - } - con.setInputfile(BASE64.encodeImgageToBase64(file)); - map.put(FlowUnid, con); - Map resultMap = null; - //µ÷´úÀíµÄ½Ó¿Ú - doc_name = bo.getAttribute("doc_name").toString(); - if("×â½ðÖ§¸¶±í".equals(doc_name)){ - //×â½ðÖ§¸¶±í - resultMap = requestService.createPaymentofHireSign(map); - } - if (!resultMap.containsKey("error")) { - for (String key : resultMap.keySet()) { - if (key.indexOf("contract_") == -1) { - bo.setAttributeValue("SINGCONTRACT_ID",resultMap.get("contract_" + key)); - bo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); - } - } - bo.setAttributeValue("PROCESS", "5"); - contBom.saveObject(bo); - tx.commit(); - } else { - return "error"; - } - } - bo = contBom.createQuery("file_flag='yes' and process='5' and flow_unid='" + FlowUnid + "' and attribute_id= '"+attribute_id+"'").getSingleResult(true); - if (bo != null) { - Map map1 = new HashMap(); - map1.put(bo.getAttribute("DOCUMENT_ID").toString(), bo.getAttribute("FULLPATH").toString()); - Map result1 = requestService.downloadDoc(map1); - if (!result1.containsKey("error")) { - for (String contractId : map1.keySet()) { - try { - if ("success".equals(result1.get(contractId))) { - String fileString = result1.get("file_" + contractId); - InputStream fileInput = BASE64.encodeFileToBase64(fileString); - OutputStream fileOut = new FileOutputStream(map1.get(contractId));// TODO - byte[] buffByte = new byte[1024]; - int size = 0; - while ((size = fileInput.read(buffByte)) != -1) { - fileOut.write(buffByte, 0, size); - } - fileInput.close(); - fileOut.close(); - } else if ("error".equals(result1.get(contractId))) { - return "error"; - } - } catch (Exception e) { - e.printStackTrace(); - - } - } - bo.setAttributeValue("PROCESS", "6"); - contBom.saveObject(bo); - } else { - return "error"; - } - } else { - return "error"; - } - } - return "success"; - } catch (Exception e) { - e.printStackTrace(); - return "error"; - } -} - - /** - * ´òÓ¡×â½ð֪ͨÊé²¢·¢¶ÌПø¿Í»§ - * @param tx - * @return - * @throws Exception - */ - public String claimSignA(JBOTransaction tx) throws Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - String libraryid=""; - PLAN_LIST=PLAN_LIST.split("\\.")[0]; - BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME); - BizObject DOCRELATIVE=bom.createQuery("plan_number=:plan_number and plan_list=:plan_list").setParameter("plan_number",PAYMENT_NUMBER).setParameter("plan_list", PLAN_LIST).getSingleResult(false); - if (DOCRELATIVE != null) { - String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString(); - BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME); - libraryid=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(false).getAttribute("id").toString(); - } - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx); - ContractSignInfo con = null; - BizObject bo = null; -// String contract_id=""; - String info=""; - try{ - //»ñÈ¡³Ð×âÈ˵ÄÐÕÃûºÍµç»°ºÅ - BizObjectManager lulManager = JBOFactory.getBizObjectManager(LB_UNION_LESSEE.CLASS_NAME, tx); - String customerid = lulManager.createQuery("CONTRACT_ID=:contractId").setParameter("contractId", contract_id).getSingleResult(false).getAttribute("CUSTOMER_ID").toString(); - BizObjectManager crManage = JBOFactory.getBizObjectManager(CUSTOMER_PERSON.CLASS_NAME, tx); - BizObject cr = crManage.createQuery("CUSTOMERID=:customerid").setParameter("customerid", customerid).getSingleResult(false); - if(cr != null){ - info = cr.getAttribute("FULLNAME").toString() + "@" + cr.getAttribute("mobile").toString()+"@"+flagType; - }else{ - info = "flagType@flagType@"+flagType; - } - //»ñÈ¡ÐèÒª¸ÇÕµÄÎļþÐÅÏ¢ - Map map=new HashMap(); - bo = contBom.createQuery("library_id=:libraryid").setParameter("libraryid", libraryid).getSingleResult(true); - if(bo != null){ - id = bo.getAttribute("id").toString(); - con = new ContractSignInfo(); - con.setFileid(id); - con.setFilename(bo.getAttribute("FILENAME").toString()); - String makefullPath = bo.getAttribute("FULLPATH").toString(); - File file = new File(makefullPath); - if (!file.exists()) { - throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); - } - con.setInputfile(BASE64.encodeImgageToBase64(file)); - map.put(info, con); - Map resultMap = null; - //µ÷´úÀíµÄ½Ó¿Ú -// doc_name = bo.getAttribute("doc_name").toString(); -// if("×â½ðÖ§¸¶±í".equals(doc_name)){ - //×â½ðÖ§¸¶±í - resultMap = requestService.createPaymentofHireSign(map); -// } - if (!resultMap.containsKey("error")) { - for (String key : resultMap.keySet()) { - if (key.indexOf("contract_") == -1) { -// bo.setAttributeValue("SINGCONTRACT_ID",resultMap.get("contract_" + key)); -// bo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); - contract_id = resultMap.get(key); - } - } -// bo.setAttributeValue("PROCESS", "5"); -// contBom.saveObject(bo); -// tx.commit(); - } else { - return "error"; - } - } -// bo = contBom.createQuery("file_flag='yes' and process='5' and flow_unid='" + FlowUnid + "' and attribute_id= '"+attribute_id+"'").getSingleResult(true); - if (bo != null) { - Map map1 = new HashMap(); - map1.put(contract_id, bo.getAttribute("FULLPATH").toString()); - Map result1 = requestService.downloadDoc(map1); - if (!result1.containsKey("error")) { - for (String contractId : map1.keySet()) { - try { - if ("success".equals(result1.get(contractId))) { - String fileString = result1.get("file_" + contractId); - InputStream fileInput = BASE64.encodeFileToBase64(fileString); - OutputStream fileOut = new FileOutputStream(map1.get(contractId));// TODO - byte[] buffByte = new byte[1024]; - int size = 0; - while ((size = fileInput.read(buffByte)) != -1) { - fileOut.write(buffByte, 0, size); - } - fileInput.close(); - fileOut.close(); - } else if ("error".equals(result1.get(contractId))) { - return "error"; - } - } catch (Exception e) { - e.printStackTrace(); - - } - } -// bo.setAttributeValue("PROCESS", "6"); -// contBom.saveObject(bo); - } else { - return "error"; - } - } else { - return "error"; - } - - return "success"; - } catch (Exception e) { - e.printStackTrace(); - return "error"; - } - } - - /** - * ¿Û¿î¿¨ÐÅÏ¢±ä¸ü·¢µç×ÓǩԼ - * @param tx - * @return - * @throws Exception - */ - public String changeCarSignA(JBOTransaction tx) throws Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - String libraryid=""; - BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME,tx); - BizObjectManager bom1=null; - BizObject DOCRELATIVE= null; - BizObject library= null; - DOCRELATIVE=bom.createQuery("OBJECTTYPE='ChangeCar' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(true); - if (DOCRELATIVE != null) { - String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString(); - bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME,tx); - library=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(true); - libraryid = library.getAttribute("id").toString(); - } - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx); - ContractSignInfo con = null; - BizObject bo = null; -// String contract_id=""; - String info=""; - try{ - //»ñÈ¡³Ð×âÈ˵ÄÐÕÃûºÍµç»°ºÅ - BizObjectManager lulManager = JBOFactory.getBizObjectManager(LB_UNION_LESSEE.CLASS_NAME, tx); - String customerid = lulManager.createQuery("CONTRACT_ID=:contractId").setParameter("contractId", contract_id).getSingleResult(false).getAttribute("CUSTOMER_ID").toString(); - BizObjectManager crManage = JBOFactory.getBizObjectManager(CUSTOMER_PERSON.CLASS_NAME, tx); - BizObject cr = crManage.createQuery("CUSTOMERID=:customerid").setParameter("customerid", customerid).getSingleResult(false); - if(cr != null){ - info = cr.getAttribute("FULLNAME").toString() + "@" + cr.getAttribute("mobile").toString()+"@"+flagType; - }else{ - return "error"; - } - //»ñÈ¡ÐèÒª¸ÇÕµÄÎļþÐÅÏ¢ - Map map=new HashMap(); - bo = contBom.createQuery("library_id=:libraryid").setParameter("libraryid", libraryid).getSingleResult(true); - if(bo != null){ - id = bo.getAttribute("id").toString(); - con = new ContractSignInfo(); - con.setFileid(id); - con.setFilename(bo.getAttribute("FILENAME").toString()); - String makefullPath = bo.getAttribute("FULLPATH").toString(); - File file = new File(makefullPath); - if (!file.exists()) { - throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); - } - con.setInputfile(BASE64.encodeImgageToBase64(file)); - map.put(info, con); - Map resultMap = null; - resultMap = requestService.createAccountContractDSign(map); - - if (!resultMap.containsKey("error")) { - BizObjectManager ldclManage=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); - BizObject ldcl = ldclManage.createQuery(" FLOW_UNID=:flowunid and CONTRACT_ID=:contractid and file_flag='yes' ").setParameter("flowunid", FlowUnid).setParameter("contractid", contract_id).getSingleResult(true); - if(ldcl != null){ - ldcl.setAttributeValue("sign_type", "SIGNING"); - ldclManage.saveObject(ldcl); - } - for (String key : resultMap.keySet()) { - if (key.indexOf("contract_") == -1) { -// DOCRELATIVE.setAttributeValue("SINGCONTRACT_ID",resultMap.get("contract_" + key)); - DOCRELATIVE.setAttributeValue("TEMPLATE_ID", resultMap.get("contract_" + key)); - library.setAttributeValue("REMARK",resultMap.get(key)); - bo.setAttributeValue("REMARK","SIGNING"); - contract_id = resultMap.get(key); - } - } - bom.saveObject(DOCRELATIVE); - bom1.saveObject(library); - contBom.saveObject(bo); - tx.commit(); - } else { - return "error"; - } - } - return "success"; - } catch (Exception e) { - e.printStackTrace(); - return "error"; - } - } - - /** - * ´ßÊÕº¯¸Ç¹«Ë¾Õ - * @param tx - * @return - * @throws Exception - */ - public String collectionSignA(JBOTransaction tx) throws Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - String libraryid=""; - BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME); - BizObject DOCRELATIVE = null; - if("settle".equals(flagType)){ - DOCRELATIVE=bom.createQuery("CONTRACT_ID=:contractid and objecttype='settle' ").setParameter("contractid",contract_id).getSingleResult(false); - }else if("LetterApprova".equals(flagType)){ - DOCRELATIVE=bom.createQuery("PROJ_ID=:projectId and objecttype='LetterApprova' ").setParameter("projectId",ProjectId).getSingleResult(false); - }else{ - DOCRELATIVE=bom.createQuery("plan_number=:plan_number and objecttype LIKE '%´òÓ¡´ß¿îº¯%' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false); - } - if (DOCRELATIVE != null) { - String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString(); - BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME); - libraryid=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(false).getAttribute("id").toString(); - } - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx); - ContractSignInfo con = null; - BizObject bo = null; - String info=""; - try{ - info = libraryid + "@" + libraryid+"@"+flagType; - //»ñÈ¡ÐèÒª¸ÇÕµÄÎļþÐÅÏ¢ - Map map=new HashMap(); - bo = contBom.createQuery("library_id=:libraryid").setParameter("libraryid", libraryid).getSingleResult(true); - if(bo != null){ - id = bo.getAttribute("id").toString(); - con = new ContractSignInfo(); - con.setFileid(id); - con.setFilename(bo.getAttribute("FILENAME").toString()); - String makefullPath = bo.getAttribute("FULLPATH").toString(); - File file = new File(makefullPath); - if (!file.exists()) { - throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); - } - con.setInputfile(BASE64.encodeImgageToBase64(file)); - map.put(info, con); - Map resultMap = null; - resultMap = requestService.createPaymentofHireSign(map); - if (!resultMap.containsKey("error")) { - for (String key : resultMap.keySet()) { - if (key.indexOf("contract_") == -1) { - contract_id = resultMap.get(key); - } - } - } else { - return "error"; - } - } - if (bo != null) { - Map map1 = new HashMap(); - map1.put(contract_id, bo.getAttribute("FULLPATH").toString()); - Map result1 = requestService.downloadDoc(map1); - if (!result1.containsKey("error")) { - for (String contractId : map1.keySet()) { - try { - if ("success".equals(result1.get(contractId))) { - String fileString = result1.get("file_" + contractId); - InputStream fileInput = BASE64.encodeFileToBase64(fileString); - OutputStream fileOut = new FileOutputStream(map1.get(contractId));// TODO - byte[] buffByte = new byte[1024]; - int size = 0; - while ((size = fileInput.read(buffByte)) != -1) { - fileOut.write(buffByte, 0, size); - } - fileInput.close(); - fileOut.close(); - } else if ("error".equals(result1.get(contractId))) { - return "error"; - } - } catch (Exception e) { - e.printStackTrace(); - - } - } - } else { - return "error"; - } - } else { - return "error"; - } - - return "success"; - } catch (Exception e) { - e.printStackTrace(); - return "error"; - } - } - - - - /*** - * ÒѾ­Éú³ÉµÄºÏͬ£¬×÷·Ï£¬ - * @param tx - * @return - * @throws JBOException - */ - - public String updateDocContractStatus(JBOTransaction tx) throws JBOException{ -// BizObjectManager attBom=JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME,tx);ProjectId - BizObjectManager lclManager=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); - BizObjectManager lpiManager=JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME,tx); - try{ -// BizObject lcl = lclManager.createQuery("file_flag='yes' and attribute_id='"+file_id+"'").getSingleResult(true); - - lclManager.createQuery("update O set file_flag='no',message='1' where attribute_id=:attributeid").setParameter("attributeid",file_id).executeUpdate(); - lpiManager.createQuery("update O set PROJECT_STATUS=13 where id=:id").setParameter("id",ProjectId).executeUpdate(); - //attBom.createQuery("update O set status='1' WHERE id='"+key.getAttribute("ATTRIBUTE_ID").toString()+"'").executeUpdate(); - tx.commit(); - }catch(Exception e){ - tx.rollback(); - e.printStackTrace(); - System.out.println(e.getMessage()); - return "error"; - } - return "success"; - } - - public String companyUpdateDocContractStatus(JBOTransaction tx) throws Exception{ - BizObjectManager fboManger=JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME,tx); - BizObjectManager lctManger=JBOFactory.getBizObjectManager(LB_CONTRACT_TEMPLATE.CLASS_NAME,tx); - BizObject fbo = fboManger.createQuery("flow_unid=:flowunid").setParameter("flowunid",FlowUnid).getSingleResult(false); - BizObject lct = lctManger.createQuery("Contract_id=:contractid").setParameter("contractid", fbo.getAttribute("CONTRACT_ID").getString()).getSingleResult(false); - String attId = ContractTemplateCache.getContractTemplateID(lct.getAttribute("ID").getString()); - lctManger.deleteObject(lct); - BizObjectManager lclManager=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); - BizObjectManager lpiManager=JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME,tx); - try{ - lclManager.createQuery("update O set file_flag='no',message='1' where attribute_id=:attributeid").setParameter("attributeid",attId).executeUpdate(); - lpiManager.createQuery("update O set PROJECT_STATUS=13 where id=:id").setParameter("id",ProjectId).executeUpdate(); - //attBom.createQuery("update O set status='1' WHERE id='"+key.getAttribute("ATTRIBUTE_ID").toString()+"'").executeUpdate(); - tx.commit(); - }catch(Exception e){ - tx.rollback(); - e.printStackTrace(); - System.out.println(e.getMessage()); - return "error"; - } - return "success"; - } - - /** - * ´«Í³ºÏͬ¸ÇÕ - * @param tx - * @return - * @throws Exception - - */ - public String TcollectionSignA(JBOTransaction tx) throws Exception { - requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); - String libraryid=""; - BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME); - BizObject DOCRELATIVE = null; - if("transfer".equals(flagType)){ - DOCRELATIVE=bom.createQuery(" OBJECTTYPE='transfer' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false); - }else if("AdjustmentNotice".equals(flagType)){ - DOCRELATIVE=bom.createQuery(" OBJECTTYPE='AdjustmentNotice' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false); - }else if("TriditionCollection".equals(flagType)){ - DOCRELATIVE=bom.createQuery("plan_number=:plan_number and objecttype='TriditionCollection' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false); - }else if("TriditionSuspension".equals(flagType)){ - DOCRELATIVE=bom.createQuery(" OBJECTTYPE='TriditionSuspension' and FLOW_UNID=:flowunid ").setParameter("flowunid",FlowUnid).getSingleResult(false); - }else if("settletradition".equals(flagType)){ - DOCRELATIVE=bom.createQuery(" OBJECTTYPE='settletradition' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false); - }else if("LoanNotice".equals(flagType)){ - DOCRELATIVE=bom.createQuery(" OBJECTTYPE='LoanNotice' and PROJ_ID=:projectId ").setParameter("projectId",ProjectId).getSingleResult(false); - }else{ - DOCRELATIVE=bom.createQuery("plan_number=:plan_number and objecttype LIKE '%´òÓ¡´ß¿îº¯%' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false); - } - if (DOCRELATIVE != null) { - String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString(); - BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME); - libraryid=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(false).getAttribute("id").toString(); - } - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx); - ContractSignInfo con = null; - BizObject bo = null; - String info=""; - try{ - info = libraryid + "@" + libraryid+"@"+flagType; - //»ñÈ¡ÐèÒª¸ÇÕµÄÎļþÐÅÏ¢ - Map map=new HashMap(); - bo = contBom.createQuery("library_id=:libraryid").setParameter("libraryid", libraryid).getSingleResult(true); - if(bo != null){ - id = bo.getAttribute("id").toString(); - con = new ContractSignInfo(); - con.setFileid(id); - con.setFilename(bo.getAttribute("FILENAME").toString()); - String makefullPath = bo.getAttribute("FULLPATH").toString(); - File file = new File(makefullPath); - if (!file.exists()) { - throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); - } - con.setInputfile(BASE64.encodeImgageToBase64(file)); - map.put(info, con); - Map resultMap = null; - resultMap = requestService.createPaymentofHireSign(map); - if (!resultMap.containsKey("error")) { - for (String key : resultMap.keySet()) { - if (key.indexOf("contract_") == -1) { - contract_id = resultMap.get(key); - } - } - } else { - return "error"; - } - } - if (bo != null) { - Map map1 = new HashMap(); - map1.put(contract_id, bo.getAttribute("FULLPATH").toString()); - Map result1 = requestService.downloadDoc(map1); - if (!result1.containsKey("error")) { - for (String contractId : map1.keySet()) { - try { - if ("success".equals(result1.get(contractId))) { - String fileString = result1.get("file_" + contractId); - InputStream fileInput = BASE64.encodeFileToBase64(fileString); - OutputStream fileOut = new FileOutputStream(map1.get(contractId));// TODO - byte[] buffByte = new byte[1024]; - int size = 0; - while ((size = fileInput.read(buffByte)) != -1) { - fileOut.write(buffByte, 0, size); - } - fileInput.close(); - fileOut.close(); - } else if ("error".equals(result1.get(contractId))) { - return "error"; - } - } catch (Exception e) { - e.printStackTrace(); - - } - } - } else { - return "error"; - } - } else { - return "error"; - } - - return "success"; - } catch (Exception e) { - e.printStackTrace(); - return "error"; - } - } - //Éú³Éһά - public String SystemMakeOneDimensionalCode(JBOTransaction tx){ - Configure CurConfig = Configure.getInstance(); - try { - String diskPath=CurConfig.getConfigure("OneDimensionalCode"); - MakeOneCodeAndContractModel mocacm = new MakeOneCodeAndContractModel(); - BizObjectManager loManage = JBOFactory.getBizObjectManager(LB_ONEDIMENSIONALCODE.CLASS_NAME,tx); - BizObject lom = loManage.createQuery(" PROJECT_ID=:projectid and CONTRACT_NO=:contractNo and CONTRACT_ID=:contractId").setParameter("projectid", ProjectId).setParameter("contractNo", contractNo).setParameter("contractId", contract_id).getSingleResult(false); - if(lom == null){ - //Éú³ÉһάÂë - mocacm.MOneDimensionalCode(contractNo, contract_id, ProjectId, diskPath, tx); - } - String outPdfFile = CurConfig.getConfigure("BQcontract"); - mocacm.pdfAndMark(outPdfFile, "", contract_id,leasform, tx); - }catch (Exception e) { - e.printStackTrace(); - return "error"; - } - return "success"; - } +package com.tenwa.channelportal.action; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.MalformedURLException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + +import jbo.app.tenwa.customer.CUSTOMER_FAMILY_TEMP; +import jbo.app.tenwa.customer.CUSTOMER_PERSON; +import jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP; +import jbo.app.tenwa.doc.LB_DOCATTRIBUTE; +import jbo.app.tenwa.doc.LB_DOCLIBRARY; +import jbo.app.tenwa.doc.LB_DOCRELATIVE; +import jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST; +import jbo.app.tenwa.doc.LB_ONEDIMENSIONALCODE; +import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT; +import jbo.com.tenwa.lease.carbrand.BUSINESS_STATUS; +import jbo.com.tenwa.lease.carbrand.LB_CONTRACT_SIGN_LOG; +import jbo.com.tenwa.lease.comm.LB_CONTRACT_TEMPLATE; +import jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT_TEMP; +import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO; +import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP; +import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE; +import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE_TEMP; +import jbo.sys.CODE_LIBRARY; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.util.StringFunction; +import com.amarsoft.awe.Configure; +import com.amarsoft.awe.util.ASResultSet; +import com.amarsoft.awe.util.SqlObject; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; +import com.caucho.hessian.client.HessianProxyFactory; +import com.tenwa.app.dao.ContractSignInfo; +import com.tenwa.lease.app.service.HttpRequestAppService; +import com.tenwa.lease.flow.contract.contractapproval.ContractTemplateCache; +import com.tenwa.makeContract.util.MakeOneCodeAndContractModel; +import com.tenwa.channelportal.action.generativecontract.Word2PdfUtil; +import com.tenwa.channelportal.action.generativecontract.WordToPDFUtil; +import com.tenwa.comm.util.date.DateAssistant; +import com.tenwa.comm.util.jboutil.DataOperatorUtil; +import com.tenwa.doc.util.BASE64; +import com.tenwa.officetempalte.util.FileOperatorUtil; +import com.tenwa.quartz.DateUtil; +import com.tenwa.reckon.util.UUIDUtil; + +public class ContractSignAction{ + public String file_id; + public String cust_phone; + public String cust_id; + public String library_id; + public String customerType; + public String CurUserID; + public String ProjectId; + public String contract_id; + public String FlowUnid; + public String InputOrgid; + public String id; + private String attrId; + public String flagType; + public HessianProxyFactory factory = new HessianProxyFactory(); + public HttpRequestAppService requestService; + public String PAYMENT_NUMBER; + public String PLAN_LIST; + public String Ttype; + public String contractNo; + public String leasform; + private static Logger logger=Logger.getLogger(ContractSignAction.class); + @SuppressWarnings("deprecation") + public static String getConfigRequestUrl() throws Exception{ + return Configure.getInstance().getConfigure("RequestHessionUrl"); + } + @SuppressWarnings("deprecation") + public static String getFileSavePath() throws Exception{ + return Configure.getInstance().getConfigure("FileSavePath"); + } + + public String getCurUserID() { + return CurUserID; + } + + public String getContract_id() { + return contract_id; + } + + public void setContract_id(String contract_id) { + this.contract_id = contract_id; + } + + public void setCurUserID(String curUserID) { + CurUserID = curUserID; + } + + public String getCustomerType() { + return customerType; + } + + public void setCustomerType(String customerType) { + this.customerType = customerType; + } + + public String getFile_id() { + return file_id; + } + + public void setFile_id(String file_id) { + this.file_id = file_id; + } + + + public String getCust_id() { + return cust_id; + } + + public void setCust_id(String cust_id) { + this.cust_id = cust_id; + } + + public String getCust_phone() { + return cust_phone; + } + public void setCust_phone(String cust_phone) { + this.cust_phone = cust_phone; + } + + public String getLibrary_id() { + return library_id; + } + public void setLibrary_id(String library_id) { + this.library_id = library_id; + } + + public String getProjectId() { + return ProjectId; + } + + public void setProjectId(String projectId) { + ProjectId = projectId; + } + + public String getFlowUnid() { + return FlowUnid; + } + + public void setFlowUnid(String flowUnid) { + FlowUnid = flowUnid; + } + + public String getInputOrgid() { + return InputOrgid; + } + + public void setInputOrgid(String inputOrgid) { + InputOrgid = inputOrgid; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + //ÀàÐÍ + public String getFlagType() { + return flagType; + } + + public void setFlagType(String flagType) { + this.flagType = flagType; + } + public String getAttrId() { + return attrId; + } + public void setAttrId(String attrId) { + this.attrId = attrId; + } + + + public String getPAYMENT_NUMBER() { + return PAYMENT_NUMBER; + } + public void setPAYMENT_NUMBER(String pAYMENT_NUMBER) { + PAYMENT_NUMBER = pAYMENT_NUMBER; + } + public String getPLAN_LIST() { + return PLAN_LIST; + } + public void setPLAN_LIST(String pLAN_LIST) { + PLAN_LIST = pLAN_LIST; + } + public String getTtype() { + return Ttype; + } + public void setTtype(String ttype) { + Ttype = ttype; + } + public String getContractNo() { + return contractNo; + } + public void setContractNo(String contractNo) { + this.contractNo = contractNo; + } + public String getLeasform() { + return leasform; + } + public void setLeasform(String leasform) { + this.leasform = leasform; + } + /** + * ×ÔÈ»È˵ç×ÓǩԼ + * + * @author tenwa518 + * @param tx + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public String signIng(JBOTransaction tx) throws Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + //BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx); + BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME, tx); + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + BizObjectManager lcslBom = JBOFactory.getBizObjectManager(LB_CONTRACT_SIGN_LOG.CLASS_NAME,tx); + Map> map = new HashMap>(); + ContractSignInfo con = null; + List bo = null; + BizObject ldclBo = null; + try { + //BizObject pbo = pbm.createQuery("id=:id").setParameter("id", ProjectId).getSingleResult(true); + BizObject pbo = pbm.createQuery("FLOWUNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(true); + // ²éѯlb_doc_contract_list±í + bo = contBom.createQuery("project_id=:projectId and file_flag='yes' and (sendprocess='0' or sendprocess='2' ) ").setParameter("projectId", ProjectId).getResultList(true); + for (BizObject keys : bo) { + String info = keys.getAttribute("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString(); + StringBuffer manyPeople = this.manyPeople(); + if(manyPeople.length()>0){ + info=info+"@applicant,"+manyPeople.deleteCharAt(manyPeople.length() - 1); + } + List list = map.get(info); + if (list == null) { + list = new ArrayList(); + map.put(info, list); + } + con = new ContractSignInfo(); + con.setCustname(keys.getAttribute("DOC_NAME").toString()); + con.setCustphone(keys.getAttribute("TELEPHONE").toString()); + con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString()); + con.setFilename(keys.getAttribute("FILENAME").toString()); + // »ñÈ¡Éú³ÉÎļþ·¾¶ + String makefullPath = keys.getAttribute("FULLPATH").toString(); + File file = new File(makefullPath); + if (!file.exists()) { + throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); + } + con.setInputfile(BASE64.encodeImgageToBase64(file)); + list.add(con); + } + Map fromCondtion = new HashMap(); + Map otherProperty = new HashMap(); + Map resultMap = requestService.createContractSign(map); + if (!resultMap.containsKey("error")) { + for (String key : resultMap.keySet()) { + // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid + if (key.indexOf("contract_") == -1) { + fromCondtion.clear(); + otherProperty.clear(); + // ÆõÔ¼ËøºÏͬºÅ + String contractId = resultMap.get("contract_" + key); + String sendProcess = resultMap.get("contract_" + contractId); + ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); + ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); + ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); + ldclBo.setAttributeValue("SENDPROCESS", sendProcess); + contBom.saveObject(ldclBo); + + String contractDocId = ldclBo.getAttribute("id").toString(); + fromCondtion.put("id", contractDocId); + otherProperty.put("SIGNPROCESS", "0");// ·¢Æðµç×ÓǩԼ + otherProperty.put("CONTRACTDOCID", contractDocId);// ·¢Æðµç×ÓǩԼ + otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); + //¿½±íµÄ·½·¨ + DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, + otherProperty, tx); + } + } + pbo.setAttributeValue("DATA_STATE", "8");// ״̬¸Ä³Éµç×ÓǩԼ£¬Ç©ÊðÖÐ + pbm.saveObject(pbo); + //¼Ç¼ÏîÄ¿½ø³ÌÈÕÖ¾ + /*Transaction tran = Transaction.createTransaction(tx); + ASUser user = ASUser.getUser(CurUserID, tran); + JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME,tx) + .createQuery("UPDATE O SET BUSINESS_STATUS='8',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' WHERE CONTRACT_NUMBER=(SELECT LPI.CONTRACT_NUMBER FROM "+LB_PROJECT_INFO.CLASS_NAME+" LPI WHERE LPI.ID='"+ProjectId+"')").executeUpdate(); + SqlObject so = new SqlObject("INSERT INTO BUSINESS_DETAIL(ID,CONTRACT_NUMBER,BUSINESS_STATUS,INPUTUSERID,INPUTORGID,INPUTTIME) SELECT SYS_GUID(),CONTRACT_NUMBER,'8','"+user.getUserID()+"','"+user.getOrgID()+"','"+StringFunction.getTodayNow().replaceAll(":", "¡÷")+"' FROM LB_PROJECT_INFO WHERE ID='"+ProjectId+"'"); + so.setDebugSql(so.getDebugSql().replaceAll("¡÷", ":")); + so.setOriginalSql(so.getOriginalSql().replaceAll("¡÷", ":")); + so.setRunSql(so.getRunSql().replaceAll("¡÷", ":")); + tran.executeSQL(so);*/ + return "success"; + } else { + Boolean flag = false; + String getMessage = resultMap.get("error"); + logger.info("ÆõÔ¼Ëø·´À¡µÄÒì³£ÐÅÏ¢" + getMessage); + for (String key : resultMap.keySet()) { + // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid + if (key.indexOf("contract_") == -1 && !"error".equals(key)) { + fromCondtion.clear(); + otherProperty.clear(); + // ÆõÔ¼ËøºÏͬºÅ + String contractId = resultMap.get("contract_" + key); + String sendProcess = resultMap.get("contract_" + contractId); + ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); + ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); + ldclBo.setAttributeValue("SENDPROCESS", sendProcess); + if ("1".equals(sendProcess)) { + flag = true; + ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); + }else if("2".equals(sendProcess)){ + ldclBo.setAttributeValue("MESSAGE",getMessage ); + } + contBom.saveObject(ldclBo); + + String contractDocId = ldclBo.getAttribute("id").toString(); + fromCondtion.put("ID", contractDocId); + otherProperty.put("SIGNPROCESS", "0");//·¢Æðµç×ÓǩԼ + otherProperty.put("CONTRACTDOCID",contractDocId);//·¢Æðµç×ÓǩԼ + otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); + DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, + otherProperty, tx); + } + } + // Åжϲ»Í¬µÄÒì³£·´À¡¸øÇ°¶Ë + if (getMessage.indexOf("Óû§ÈÏÖ¤ÐÅÏ¢ÓëºÏͬǩÊð·½ÐÅÏ¢²»Æ¥Åä") != -1) { + getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3); + return flag + "@" + getMessage; + } else if (getMessage.indexOf("contractId²»ÄÜΪ¿Õ") != -1) { + return flag + "@" + getMessage; + } else { + return flag + "@" + "error"; + } + } + } catch (Exception e) { + tx.rollback(); + e.printStackTrace(); + logger.info("×ÔÈ»È˵ç×ÓǩԼÒì³£:" + e.getMessage()); + return "flase@error"; + } + } + /** + * ·¨È˿ͻ§ÔÚÉú³ÉºÏͬÊÇÖ±½Ó¸ÇÕ + * @param tx + * @return + * @throws Exception + */ + + @SuppressWarnings("unchecked") + public String compnySignIng(JBOTransaction tx) throws Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + //BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx); + BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME, tx); + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + Map map = new HashMap(); + ContractSignInfo con = null; + List bo = null; + BizObject ldclBo = null; + try { + //BizObject pbo = pbm.createQuery("id=:id").setParameter("id", ProjectId).getSingleResult(true); + BizObject pbo = pbm.createQuery("FLOWUNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(true); + // ²éѯlb_doc_contract_list±í + bo = contBom.createQuery("project_id=:projectId and file_flag='yes' and (sendprocess='0' or sendprocess='2' ) ").setParameter("projectId", ProjectId).getResultList(true); + for (BizObject keys : bo) { + String info = keys.getAttribute("id").toString(); + con = new ContractSignInfo(); + con.setCustname(keys.getAttribute("DOC_NAME").toString()); + con.setCustphone(keys.getAttribute("TELEPHONE").toString()); + con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString()); + con.setFilename(keys.getAttribute("FILENAME").toString()); + // »ñÈ¡Éú³ÉÎļþ·¾¶ + String makefullPath = keys.getAttribute("FULLPATH").toString(); + File file = new File(makefullPath); + if (!file.exists()) { + throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); + } + con.setInputfile(BASE64.encodeImgageToBase64(file)); + map.put(info, con); + } + Map fromCondtion = new HashMap(); + Map otherProperty = new HashMap(); + Map resultMap = requestService.compnySign(map); + if (!resultMap.containsKey("error")) { + for (String key : resultMap.keySet()) { + // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid + if (key.indexOf("contract_") == -1) { + fromCondtion.clear(); + otherProperty.clear(); + // ÆõÔ¼ËøºÏͬºÅ + String contractId = resultMap.get("contract_" + key); + String sendProcess = resultMap.get("contract_" + contractId); + ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); + ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); + ldclBo.setAttributeValue("SIGN_TYPE", "COMPLETE");//·¨È˿ͻ§µ±¸ÇÍêÕ¸ÄΪÍê³É״̬ + ldclBo.setAttributeValue("SENDPROCESS", sendProcess); + contBom.saveObject(ldclBo); + + String contractDocId = ldclBo.getAttribute("id").toString(); + fromCondtion.put("id", contractDocId); + otherProperty.put("SIGNPROCESS", "0");// ·¢Æðµç×ÓǩԼ + otherProperty.put("CONTRACTDOCID", contractDocId);// ·¢Æðµç×ÓǩԼ + otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); + //¿½±íµÄ·½·¨ + DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, + otherProperty, tx); + } + } + pbo.setAttributeValue("DATA_STATE", "8");// ״̬¸Ä³Éµç×ÓǩԼ£¬Ç©ÊðÖÐ + pbm.saveObject(pbo); + downloadDoc(tx); + return "success"; + } else { + Boolean flag = false; + String getMessage = resultMap.get("error"); + logger.info("ÆõÔ¼Ëø·´À¡µÄÒì³£ÐÅÏ¢" + getMessage); + for (String key : resultMap.keySet()) { + // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid + if (key.indexOf("contract_") == -1 && !"error".equals(key)) { + fromCondtion.clear(); + otherProperty.clear(); + // ÆõÔ¼ËøºÏͬºÅ + String contractId = resultMap.get("contract_" + key); + String sendProcess = resultMap.get("contract_" + contractId); + ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); + ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); + ldclBo.setAttributeValue("SENDPROCESS", sendProcess); + if ("1".equals(sendProcess)) { + flag = true; + ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); + }else if("2".equals(sendProcess)){ + ldclBo.setAttributeValue("MESSAGE",getMessage ); + } + contBom.saveObject(ldclBo); + + String contractDocId = ldclBo.getAttribute("id").toString(); + fromCondtion.put("ID", contractDocId); + otherProperty.put("SIGNPROCESS", "0");//·¢Æðµç×ÓǩԼ + otherProperty.put("CONTRACTDOCID",contractDocId);//·¢Æðµç×ÓǩԼ + otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); + DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, + otherProperty, tx); + } + } + // Åжϲ»Í¬µÄÒì³£·´À¡¸øÇ°¶Ë + if (getMessage.indexOf("Óû§ÈÏÖ¤ÐÅÏ¢ÓëºÏͬǩÊð·½ÐÅÏ¢²»Æ¥Åä") != -1) { + getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3); + return flag + "@" + getMessage; + } else if (getMessage.indexOf("contractId²»ÄÜΪ¿Õ") != -1) { + return flag + "@" + getMessage; + } else { + return flag + "@" + "error"; + } + } + } catch (Exception e) { + tx.rollback(); + e.printStackTrace(); + logger.info("·¨È˿ͻ§Éú³ÉºÏͬ¸ÇÕÂʧ°Ü" + e.getMessage()); + return "flase@error"; + } + } + + //»ñÈ¡µç×ÓǩԼÈËÔ±Áбí + public StringBuffer manyPeople() throws JBOException{ + //»ñÈ¡µ£±£ÈËÐÅÏ¢ + StringBuffer info = new StringBuffer(); + BizObjectManager cptm = JBOFactory.getBizObjectManager(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME); + List cpts = cptm.createQuery("select * from O where flowunid=:flowUnid").setParameter("flowUnid", FlowUnid).getResultList(false); + for(BizObject cpt:cpts){ + String name = cpt.getAttribute("FULLNAME").toString(); + String mobile = cpt.getAttribute("mobile").toString(); + if(name.length()>0 && mobile.length()>0){ + info.append(name+"@"+mobile+"@guarantee,"); + } + } + //»ñÈ¡¹²Í¬ÉêÇëÈ˵ÄÐÅÏ¢ + BizObjectManager cftm = JBOFactory.getBizObjectManager(CUSTOMER_FAMILY_TEMP.CLASS_NAME); + BizObject cft = cftm.createQuery("flowunid=:FLowUnid and Partner_='Y'").setParameter("FLowUnid", FlowUnid).getSingleResult(false); + if(cft!=null){ + String name = cft.getAttribute("name").toString(); + String mobile = cft.getAttribute("tel").toString(); + if(name.length()>0 && mobile.length()>0){ + info.append(name+"@"+mobile+"@comm,"); + } + } + + return info; + } + + /** + * ·¨ÈË×â½ðίÍдú³¥µç×ÓǩԼ + * @author tenwa518 + * @param tx + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public String companySignIng(JBOTransaction tx) throws Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx); + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + Map> map = new HashMap>(); + ContractSignInfo con = null; + List bo = null; + BizObject ldclBo = null; + try { + BizObject pbo = pbm.createQuery("id=:id").setParameter("id", ProjectId).getSingleResult(true); + // ²éѯlb_doc_contract_list±í + bo = contBom.createQuery("project_id=:projectId and file_flag='yes' and (sendprocess='0' or sendprocess='2' ) and doc_name='×â½ð´ú³¥º¯'").setParameter("projectId", ProjectId).getResultList(true); + for (BizObject keys : bo) { + String info = keys.getAttribute("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString(); + List list = map.get(info); + if (list == null) { + list = new ArrayList(); + map.put(info, list); + } + con = new ContractSignInfo(); + con.setCustname(keys.getAttribute("CUSTOMERNAME").toString()); + con.setCustphone(keys.getAttribute("TELEPHONE").toString()); + con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString()); + con.setFilename(keys.getAttribute("FILENAME").toString()); + // »ñÈ¡Éú³ÉÎļþ·¾¶ + String makefullPath = keys.getAttribute("FULLPATH").toString(); + File file = new File(makefullPath); + if (!file.exists()) { + throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); + } + con.setInputfile(BASE64.encodeImgageToBase64(file)); + list.add(con); + } + + Map fromCondtion=new HashMap(); + MapotherProperty=new HashMap(); + Map resultMap = requestService.createComContractSign(map); + if (!resultMap.containsKey("error")) { + for (String key : resultMap.keySet()) { + // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid + if (key.indexOf("contract_") == -1) { + fromCondtion.clear(); + otherProperty.clear(); + //ÆõÔ¼ËøºÏͬºÅ + String contractId=resultMap.get("contract_" + key); + String sendProcess=resultMap.get("contract_" + contractId); + ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); + ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); + ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); + ldclBo.setAttributeValue("SENDPROCESS",sendProcess); + contBom.saveObject(ldclBo); + + String contractDocId =ldclBo .getAttribute("id").toString(); + fromCondtion.put("id", contractDocId); + otherProperty.put("SIGNPROCESS", "0");// ·¢Æðµç×ÓǩԼ + otherProperty.put("CONTRACTDOCID", contractDocId);// ·¢Æðµç×ÓǩԼ + otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); + //¿½±íµÄ·½·¨ + DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion,LB_CONTRACT_SIGN_LOG.CLASS_NAME, + null,otherProperty,tx); + } + } + pbo.setAttributeValue("project_status","8");//״̬¸Ä³Éµç×ÓǩԼ£¬Ç©ÊðÖÐ + pbm.saveObject(pbo); + //¼Ç¼ÏîÄ¿½ø³ÌÈÕÖ¾ + Transaction tran = Transaction.createTransaction(tx); + ASUser user = ASUser.getUser(CurUserID, tran); + JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME,tx) + .createQuery("UPDATE O SET BUSINESS_STATUS='8',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' WHERE CONTRACT_NUMBER=(SELECT LPI.CONTRACT_NUMBER FROM "+LB_PROJECT_INFO.CLASS_NAME+" LPI WHERE LPI.ID='"+ProjectId+"')").executeUpdate(); + SqlObject so = new SqlObject("INSERT INTO BUSINESS_DETAIL(ID,CONTRACT_NUMBER,BUSINESS_STATUS,INPUTUSERID,INPUTORGID,INPUTTIME) SELECT SYS_GUID(),CONTRACT_NUMBER,'8','"+user.getUserID()+"','"+user.getOrgID()+"','"+StringFunction.getTodayNow().replaceAll(":", "¡÷")+"' FROM LB_PROJECT_INFO WHERE ID='"+ProjectId+"'"); + so.setDebugSql(so.getDebugSql().replaceAll("¡÷", ":")); + so.setOriginalSql(so.getOriginalSql().replaceAll("¡÷", ":")); + so.setRunSql(so.getRunSql().replaceAll("¡÷", ":")); + tran.executeSQL(so); + return "success"; + } else { + Boolean falg=false; + String getMessage = resultMap.get("error"); + logger.info("ÆõÔ¼Ëø·´À¡µÄÒì³£ÐÅÏ¢" + getMessage); + for (String key : resultMap.keySet()) { + // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid + if (key.indexOf("contract_") == -1 && !"error".equals(key)) { + fromCondtion.clear(); + otherProperty.clear(); + // ÆõÔ¼ËøºÏͬºÅ + String contractId = resultMap.get("contract_" + key); + String sendProcess = resultMap.get("contract_" + contractId); + ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); + ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); + ldclBo.setAttributeValue("SENDPROCESS", sendProcess); + if ("1".equals(sendProcess)) { + falg=true; + ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); + }else if ("2".equals(sendProcess)) { + ldclBo.setAttributeValue("MESSAGE", getMessage); + } + contBom.saveObject(ldclBo); + + String contractDocId=ldclBo.getAttribute("id").toString(); + fromCondtion.put("id", contractDocId); + otherProperty.put("SIGNPROCESS", "0");//·¢Æðµç×ÓǩԼ + otherProperty.put("CONTRACTDOCID",contractDocId);//·¢Æðµç×ÓǩԼ + otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); + DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, + otherProperty, tx); + } + } + // Åжϲ»Í¬µÄÒì³£·´À¡¸øÇ°¶Ë + if (getMessage.indexOf("Óû§ÈÏÖ¤ÐÅÏ¢ÓëºÏͬǩÊð·½ÐÅÏ¢²»Æ¥Åä") != -1) { + getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3); + return getMessage; + } else if (getMessage.indexOf("contractId²»ÄÜΪ¿Õ") != -1) { + return getMessage; + } else { + return "error"; + } + } + } catch (Exception e) { + tx.rollback(); + e.printStackTrace(); + return "error"; + } + + } + + /** + * (¿Û¿î¿¨±ä¸ü)×ÔÈ»ÈËίÍпۿîÊÚȨÊéµç×ÓǩԼ,»¹ÓÐ×â½ð´ú³¥º¯ + * @author tenwa518 + * @param tx + * @return + * @throws Exception + */ + public String PersonDeductSignIng(JBOTransaction tx) throws Exception{ + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + Map> map = new HashMap>(); + ContractSignInfo con = null; + List bo = null; + BizObject ldclBo = null; + try { + // ²éѯlb_doc_contract_list±í + bo = contBom.createQuery("flow_unid=:flow_unid and (sendprocess='0' or sendprocess='2' ) and file_flag='yes'").setParameter("flow_unid", FlowUnid).getResultList(true); + + for (BizObject keys : bo) { + String info = keys.getAttribute("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString(); + List list = map.get(info); + if (list == null) { + list = new ArrayList(); + map.put(info, list); + } + con = new ContractSignInfo(); + con.setCustname(keys.getAttribute("CUSTOMERNAME").toString()); + con.setCustphone(keys.getAttribute("TELEPHONE").toString()); + con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString()); + con.setFilename(keys.getAttribute("FILENAME").toString()); + // »ñÈ¡Éú³ÉÎļþ·¾¶ + String makefullPath = keys.getAttribute("FULLPATH").toString(); + File file = new File(makefullPath); + if (!file.exists()) { + throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); + } + con.setInputfile(BASE64.encodeImgageToBase64(file)); + list.add(con); + } + + + Map fromCondtion=new HashMap(); + MapotherProperty=new HashMap(); + Map resultMap = null; + if ("01".equals(customerType)) { + resultMap = requestService.createComContractSign(map); + } else { + resultMap = requestService.createEntrustmentSign(map); + } + if (!resultMap.containsKey("error")) { + for (String key : resultMap.keySet()) { + if (key.indexOf("contract_") == -1) { + fromCondtion.clear(); + otherProperty.clear(); + //ÆõÔ¼ËøºÏͬºÅ + String contractId=resultMap.get("contract_" + key); + String sendProcess=resultMap.get("contract_" + contractId); + ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); + ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); + ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); + ldclBo.setAttributeValue("SENDPROCESS",sendProcess); + contBom.saveObject(ldclBo); + + String contractDocId = ldclBo.getAttribute("id").toString(); + fromCondtion.put("id", contractDocId); + otherProperty.put("SIGNPROCESS", "0");// ·¢Æðµç×ÓǩԼ + otherProperty.put("CONTRACTDOCID", contractDocId);// ·¢Æðµç×ÓǩԼ + otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); + //¿½±íµÄ·½·¨ + DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, + otherProperty, tx); + } + } + + return "success"; + + } else { + Boolean flag = false; + String getMessage = resultMap.get("error"); + logger.info("ÆõÔ¼Ëø·´À¡µÄÒì³£ÐÅÏ¢" + getMessage); + for (String key : resultMap.keySet()) { + // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid + if (key.indexOf("contract_") == -1 && !"error".equals(key)) { + fromCondtion.clear(); + otherProperty.clear(); + // ÆõÔ¼ËøºÏͬºÅ + String contractId = resultMap.get("contract_" + key); + String sendProcess = resultMap.get("contract_" + contractId); + ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); + ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); + ldclBo.setAttributeValue("SENDPROCESS", sendProcess); + if ("1".equals(sendProcess)) { + flag = true; + ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); + }else if("2".equals(sendProcess)){ + ldclBo.setAttributeValue("MESSAGE",getMessage ); + } + contBom.saveObject(ldclBo); + + + String contractDocId = ldclBo.getAttribute("id").toString(); + fromCondtion.put("ID", contractDocId); + otherProperty.put("SIGNPROCESS", "0");//·¢Æðµç×ÓǩԼ + otherProperty.put("CONTRACTDOCID",contractDocId);//·¢Æðµç×ÓǩԼ + otherProperty.put("INPUTTIME",DateAssistant.getTodayNow()); + DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, + otherProperty, tx); + } + } + // Åжϲ»Í¬µÄÒì³£·´À¡¸øÇ°¶Ë + if (getMessage.indexOf("Óû§ÈÏÖ¤ÐÅÏ¢ÓëºÏͬǩÊð·½ÐÅÏ¢²»Æ¥Åä") != -1) { + getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3); + return getMessage; + } else if (getMessage.indexOf("contractId²»ÄÜΪ¿Õ") != -1) { + return getMessage; + } else { + return "error"; + } + } + } catch (Exception e) { + tx.rollback(); + e.printStackTrace(); + return "error"; + } + } + + /** + * Ìáǰ½áÇå ÉêÇëÊé½øÐеç×ÓǩԼ + * + * @author + * @param + * @return + * @throws Exception + */ + public String AdjustFordSignIng(JBOTransaction tx) throws Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + Map> map = new HashMap>(); + ContractSignInfo con = null; + List bo = null; + BizObject ldclBo = null; + try { + // ²éѯlb_doc_contract_list±í + bo = contBom.createQuery("flow_unid=:flow_unid and file_flag='yes'").setParameter("flow_unid", FlowUnid).getResultList(true); + for (BizObject keys : bo) { + String info = keys.getAttribute("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString(); + List list = map.get(info); + if (list == null) { + list = new ArrayList(); + map.put(info, list); + } + con = new ContractSignInfo(); + con.setCustname(keys.getAttribute("CUSTOMERNAME").toString()); + con.setCustphone(keys.getAttribute("TELEPHONE").toString()); + con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString()); + con.setFilename(keys.getAttribute("FILENAME").toString()); + // »ñÈ¡Éú³ÉÎļþ·¾¶ + String makefullPath = keys.getAttribute("FULLPATH").toString(); + File file = new File(makefullPath); + if (!file.exists()) { + throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); + } + con.setInputfile(BASE64.encodeImgageToBase64(file)); + list.add(con); + } + Map fromCondtion = new HashMap(); + Map otherProperty = new HashMap(); + Map resultMap = null; + resultMap = requestService.createAdjustFordContractDSign(map); + if (!resultMap.containsKey("error")) { + for (String key : resultMap.keySet()) { + if (key.indexOf("contract_") == -1) { + fromCondtion.clear(); + otherProperty.clear(); + // ÆõÔ¼ËøºÏͬºÅ + String contractId = resultMap.get("contract_" + key); + String sendProcess = resultMap.get("contract_" + contractId); + ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); + ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); + ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); + ldclBo.setAttributeValue("SENDPROCESS", sendProcess); +// ldclBo.setAttributeValue("PROCESS", "4"); + contBom.saveObject(ldclBo); + + String contractDocId = ldclBo.getAttribute("id").toString(); + fromCondtion.put("id", contractDocId); + otherProperty.put("SIGNPROCESS", "0");// ·¢Æðµç×ÓǩԼ + otherProperty.put("CONTRACTDOCID", contractDocId);// ·¢Æðµç×ÓǩԼ + otherProperty.put("INPUTTIME", DateAssistant.getTodayNow()); + // ¿½±íµÄ·½·¨ + DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, + otherProperty, tx); + } + } + return "success"; + } else { + Boolean flag = false; + String getMessage = resultMap.get("error"); + logger.info("ÆõÔ¼Ëø·´À¡µÄÒì³£ÐÅÏ¢" + getMessage); + for (String key : resultMap.keySet()) { + // ´æ´¢ÆõÔ¼Ëø·µ»ØµÄºÏͬidºÍºÏͬÎļþid + if (key.indexOf("contract_") == -1 && !"error".equals(key)) { + fromCondtion.clear(); + otherProperty.clear(); + // ÆõÔ¼ËøºÏͬºÅ + String contractId = resultMap.get("contract_" + key); + String sendProcess = resultMap.get("contract_" + contractId); + ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); + ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); + ldclBo.setAttributeValue("SENDPROCESS", sendProcess); + if ("1".equals(sendProcess)) { + flag = true; + ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); + } else if ("2".equals(sendProcess)) { + ldclBo.setAttributeValue("MESSAGE", getMessage); + } + contBom.saveObject(ldclBo); + String contractDocId = ldclBo.getAttribute("id").toString(); + fromCondtion.put("ID", contractDocId); + otherProperty.put("SIGNPROCESS", "0");// ·¢Æðµç×ÓǩԼ + otherProperty.put("CONTRACTDOCID", contractDocId); + otherProperty.put("INPUTTIME", DateAssistant.getTodayNow()); + DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, + otherProperty, tx); + } + } + // Åжϲ»Í¬µÄÒì³£·´À¡¸øÇ°¶Ë + if (getMessage.indexOf("Óû§ÈÏÖ¤ÐÅÏ¢ÓëºÏͬǩÊð·½ÐÅÏ¢²»Æ¥Åä") != -1) { + getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3); + return getMessage; + } else if (getMessage.indexOf("contractId²»ÄÜΪ¿Õ") != -1) { + return getMessage; + } else { + return "error"; + } + } + } catch (Exception e) { + tx.rollback(); + e.printStackTrace(); + return "error"; + } + + } +/** + * Ìáǰ½áÇå²éѯǩԼ״̬ + * @param tx + * @return + * @throws Exception + */ + public String getAdjustFordSignStatus(JBOTransaction tx) throws Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager ldclBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + BizObjectManager clBom = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME, tx); + List ldclBoList = ldclBom.createQuery("flow_unid='" + FlowUnid + "' and file_flag='yes' and " + + "sendprocess='1'").getResultList(true); + String signContractId = ""; + String customerName = ""; + String contractDocId = ""; + StringBuffer result = new StringBuffer(); + Map fromCondtion = new HashMap(); + Map otherProperty = new HashMap(); + for (BizObject key : ldclBoList) { + signContractId = key.getAttribute("singcontract_id").toString(); + customerName = key.getAttribute("customername").toString(); + contractDocId = key.getAttribute("id").toString(); + try { + String signType = requestService.getContractSignStatus(signContractId); + String signstatus = clBom.createQuery("itemno='" + signType + "'").getSingleResult(false).getAttribute("itemname").toString(); + key.setAttributeValue("sign_type", signType); + if("COMPLETE".equals(signType)){ + key.setAttributeValue("PROCESS", "5.1"); + } + ldclBom.saveObject(key); + result.append("," + customerName + "µç×ÓǩԼ״̬:" + signstatus); + //ÈÕÖ¾¼Ç¼ + + fromCondtion.put("ID", contractDocId); + otherProperty.put("SIGNPROCESS", "1");// ²éѯ״̬ + otherProperty.put("CONTRACTDOCID", contractDocId); + otherProperty.put("INPUTTIME", DateAssistant.getTodayNow()); + DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, + otherProperty, tx); + } catch (Exception e) { + fromCondtion.put("ID", contractDocId); + otherProperty.put("SIGNPROCESS", "1");// ²éѯ״̬ + otherProperty.put("CONTRACTDOCID", contractDocId); + otherProperty.put("MESSAGE", e.getMessage()); + otherProperty.put("INPUTTIME", DateAssistant.getTodayNow()); + DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, + otherProperty, tx); + return "error"+"@"+e.getMessage(); + } + + } + return result.toString().substring(1); + } + + /** + * (¿Û¿î¿¨±ä¸ü)×ÔÈ»ÈËίÍпۿîÊÚȨÊé»ñÈ¡µç×ÓǩԼ״̬ ,·¨ÈË×â½ð´ú³¥ + * + * @throws Exception + */ + public String contractSignStatusForContract(JBOTransaction tx) throws Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager ldclBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + BizObjectManager clBom = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME, tx); + List ldclBoList = ldclBom.createQuery("flow_unid='" + FlowUnid + "' and file_flag='yes' and " + + "sendprocess='1'").getResultList(true); + String signContractId = ""; + String customerName = ""; + String contractDocId = ""; + StringBuffer result = new StringBuffer(); + Map fromCondtion = new HashMap(); + Map otherProperty = new HashMap(); + for (BizObject key : ldclBoList) { + signContractId = key.getAttribute("singcontract_id").toString(); + customerName = key.getAttribute("customername").toString(); + contractDocId = key.getAttribute("id").toString(); + try { + String signType = requestService.getContractSignStatus(signContractId); + String signstatus = clBom.createQuery("itemno='" + signType + "'").getSingleResult(false).getAttribute("itemname").toString(); + key.setAttributeValue("sign_type", signType); + if("COMPLETE".equals(signType)){ + key.setAttributeValue("PROCESS", "5.1"); + } + ldclBom.saveObject(key); + result.append("," + customerName + "µç×ÓǩԼ״̬:" + signstatus); + //ÈÕÖ¾¼Ç¼ + + fromCondtion.put("ID", contractDocId); + otherProperty.put("SIGNPROCESS", "1");// ²éѯ״̬ + otherProperty.put("CONTRACTDOCID", contractDocId); + otherProperty.put("INPUTTIME", DateAssistant.getTodayNow()); + DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, + otherProperty, tx); + } catch (Exception e) { + fromCondtion.put("ID", contractDocId); + otherProperty.put("SIGNPROCESS", "1");// ²éѯ״̬ + otherProperty.put("CONTRACTDOCID", contractDocId); + otherProperty.put("MESSAGE", e.getMessage()); + otherProperty.put("INPUTTIME", DateAssistant.getTodayNow()); + DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null, + otherProperty, tx); + return "error"+"@"+e.getMessage(); + } + + } + return result.toString().substring(1); + } + + /** + * »ñÈ¡µç×ÓǩԼ״̬ + * + * @throws Exception + */ + public String contractSignStatus(JBOTransaction tx) throws Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + //BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx); + BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME, tx); + BizObjectManager clBom = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME, tx); + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + BizObjectManager ldBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx); + //BizObject pbo = pbm.createQuery("id=:id").setParameter("id", ProjectId).getSingleResult(true); + BizObject pbo = pbm.createQuery("FLOWUNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(true); + String status = ""; + String peopleStatus=""; + String sql = ""; + if ("01".equals(customerType)) { + sql = "project_id=:projectId and file_flag='yes' and doc_name='×â½ð´ú³¥º¯' and sendprocess='1'"; + } else { + sql = "project_id=:projectId and file_flag='yes' and sendprocess='1'"; + } + @SuppressWarnings("unchecked") + List bo = contBom.createQuery(sql).setParameter("projectId", ProjectId).getResultList(true); + if (bo != null) { + boolean flag = true; + Map map = new HashMap(); + for (BizObject keys : bo) { + map.put(keys.getAttribute("singcontract_id").toString(), keys.getAttribute("customername").toString()); + } + for (String key : map.keySet()) { + try { + String signStatu = requestService.getContractSignStatus(key); + int index = signStatu.indexOf("$"); + String signStatus = signStatu.substring(0, index); + peopleStatus = signStatu.substring(index+1); + String signStatusName = + clBom.createQuery("itemno='" + signStatus + "'").getSingleResult(false).getAttribute("itemname").toString(); + List ldclList = + contBom.createQuery("project_id=:projectId and file_flag='yes' and singcontract_id='" + key + "'") + .setParameter("projectId", ProjectId).getResultList(true); + for (BizObject keys : ldclList) { + keys.setAttributeValue("SIGN_TYPE", signStatus); + // ¿Í»§Ç©ÊðÍê³É£¬ºÏÍ¬ÖÆ×÷¹ý³ÌΪ4 + if ("REQUIRED".equals(signStatus)) { + this.sign(tx); + downloadDoc(tx); + keys.setAttributeValue("PROCESS", "4"); + } + contBom.saveObject(keys); + } + if (!"REQUIRED".equals(signStatus) && !"COMPLETE".equals(signStatus) ) { + flag = false; + } + if ("REQUIRED".equals(signStatus)) { + status += ";
¿Í»§" + map.get(key) + "ǩԼ״̬:ÒÑÇ©Ãû"; + } else { + status += ";
¿Í»§" + map.get(key) + "ǩԼ״̬:" + signStatusName; + } + } catch (Exception e) { + e.printStackTrace(); + return "»ñȡǩԼ״̬ʧ°Ü!"; + } + } + // ºÏͬǩԼÒÑÍê³É + if (flag) { + pbo.setAttributeValue("DATA_STATE", "4");// ״̬¸Ä³ÉÒÑÍê³Éµç×ÓǩԼ + pbm.saveObject(pbo); + // ¼Ç¼ÏîÄ¿½ø³ÌÈÕÖ¾ + /* Transaction tran = Transaction.createTransaction(tx); + ASUser user = ASUser.getUser(CurUserID, tran); + JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME, tx) + .createQuery("UPDATE O SET BUSINESS_STATUS='4',UPDATEUSERID='" + user.getUserID() + "',UPDATEORGID='" + + user.getOrgID() + "',UPDATETIME='" + StringFunction.getTodayNow() + + "' WHERE CONTRACT_NUMBER=(SELECT LPI.CONTRACT_NUMBER FROM " + LB_PROJECT_INFO.CLASS_NAME + + " LPI WHERE LPI.ID='" + ProjectId + "')") + .executeUpdate(); + SqlObject so = new SqlObject( + "INSERT INTO BUSINESS_DETAIL(ID,CONTRACT_NUMBER,BUSINESS_STATUS,INPUTUSERID,INPUTORGID,INPUTTIME) SELECT SYS_GUID(),CONTRACT_NUMBER,'4','" + + user.getUserID() + "','" + user.getOrgID() + "','" + StringFunction.getTodayNow().replaceAll(":", "¡÷") + + "' FROM LB_PROJECT_INFO WHERE ID='" + ProjectId + "'"); + so.setDebugSql(so.getDebugSql().replaceAll("¡÷", ":")); + so.setOriginalSql(so.getOriginalSql().replaceAll("¡÷", ":")); + so.setRunSql(so.getRunSql().replaceAll("¡÷", ":")); + tran.executeSQL(so);*/ + for (BizObject keys : bo) { + /* ldBom.createQuery("update O set status='' where id='" + keys.getAttribute("attribute_id").toString() + "'") + .executeUpdate();*/ + } + status = ";
ÒѾ­Íê³Éµç×ÓǩԼ"; + } + } + if (status.length() < 1) { + return "»ñȡǩԼ״̬ʧ°Ü,ûÓкÏͬÎļþ"; + } else { + status = status.substring(5); + String[] peopleStat = peopleStatus.split(","); + if(peopleStat.length>1){ + status = status+"
"; + for(int i=0;i map = new HashMap(); + + map.put(ldb.getAttribute("TEMPLATE_ID").toString(),lul.getAttribute("CUSTOMER_NAME").toString()); + + for (String key : map.keySet()) { + try { + String signStatu = requestService.getContractSignStatus(key); + int index = signStatu.indexOf("$"); + String signStatus = signStatu.substring(0, index); + peopleStatus = signStatu.substring(index+1); + String signStatusName = + clBom.createQuery("itemno='" + signStatus + "'").getSingleResult(false).getAttribute("itemname").toString(); + BizObject ldl = ldlMange.createQuery("RELATIVE_ID=:relativeid").setParameter("relativeid", ldb.getAttribute("ID").getString()).getSingleResult(false); + lda = ldaMange.createQuery("LIBRARY_ID=:libraryid").setParameter("libraryid", ldl.getAttribute("ID").getString()).getSingleResult(true); + if (signStatu.indexOf("ÒÑÇ©Êð")>0) { + signStatus = "REQUIRED"; + }else{ + flag = false; + } + if ("REQUIRED".equals(signStatus)) { + status += ";
¿Í»§" + map.get(key) + "ǩԼ״̬:ÒÑÇ©Ãû"; + } else { + status += ";
¿Í»§" + map.get(key) + "ǩԼ״̬:" + signStatusName; + } + } catch (Exception e) { + e.printStackTrace(); + return "»ñȡǩԼ״̬ʧ°Ü!"; + } + } + // ºÏͬǩԼÒÑÍê³É + if (flag) { + lda.setAttributeValue("REMARK", "COMPLETE");// ״̬¸Ä³ÉÒÑÍê³Éµç×ÓǩԼ + BizObjectManager ldclManage=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); + BizObject ldcl = ldclManage.createQuery(" FLOW_UNID=:flowunid and CONTRACT_ID=:contractid and file_flag='yes' ").setParameter("flowunid", FlowUnid).setParameter("contractid", contract_id).getSingleResult(true); + if(ldcl != null){ + ldcl.setAttributeValue("sign_type", "COMPLETE"); + ldclManage.saveObject(ldcl); + } + ldaMange.saveObject(lda); + status = ";
ÒѾ­Íê³Éµç×ÓǩԼ"; + changedownloadDoc(tx); + } + } + + if (status.length() < 1) { + return "»ñȡǩԼ״̬ʧ°Ü,ûÓкÏͬÎļþ"; + } else { + status = status.substring(5); + String[] peopleStat = peopleStatus.split(","); + if(peopleStat.length>1){ + status = status+"
"; + for(int i=0;i contractIds = new ArrayList(); + if ("01".equals(customerType)) { + sql = "project_id=:projectId and file_flag='yes' and doc_name='×â½ð´ú³¥º¯' and sendprocess='1'"; + } else { + sql = "project_id=:projectId and file_flag='yes' and sendprocess='1'"; + } + @SuppressWarnings("unchecked") + List bo = contBom.createQuery(sql).setParameter("projectId", ProjectId).getResultList(true); + if (bo != null) { + boolean flag = true; + Map map = new HashMap(); + for (BizObject keys : bo) { + map.put(keys.getAttribute("singcontract_id").toString(), keys.getAttribute("customername").toString()); + contractIds.add(keys.getAttribute("singcontract_id").toString()); + } + + Map resultMap = requestService.getContractSignListStatus(contractIds); + } + return ""; + } + + /** + * ¸ÇÆóÒµÕ + * + * @param tx + * @return + * @throws MalformedURLException + * @throws Exception + */ + public String sign(JBOTransaction tx) throws MalformedURLException, Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + @SuppressWarnings("unchecked") + List bo = contBom.createQuery("project_id=:projectId and file_flag='yes'") + .setParameter("projectId", ProjectId).getResultList(true); + if (bo != null) { + Map> map = new HashMap>(); + for (BizObject keys : bo) { + List list = map.get(keys.getAttribute("singcontract_id").toString()); + if (list == null) { + list = new ArrayList(); + } + list.add(keys.getAttribute("DOCUMENT_ID").toString()+"@"+keys.getAttribute("doc_name").toString()); + map.put(keys.getAttribute("singcontract_id").toString(), list); + } + Map resultMap = requestService.Sign(map); + String statu = resultMap.get("error"); + if (statu == null) { + return "success"; + } + } + + return "error"; + } + + /** + * ¸ù¾Ýdocument_idÏÂÔØºÏͬ + * + * @param tx + * @return + * @throws Exception + * @throws MalformedURLException + */ + public String downloadDoc(JBOTransaction tx) throws MalformedURLException, Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + String sql = ""; + if ("01".equals(customerType)) { + sql = "project_id=:projectId and file_flag='yes' and doc_name='×â½ð´ú³¥º¯'"; + } else { + sql = "project_id=:projectId and file_flag='yes'"; + } + try { + + @SuppressWarnings("unchecked") + List bo = contBom.createQuery(sql).setParameter("projectId", ProjectId).getResultList(true); + if (bo != null) { + Map map = new HashMap(); + for (BizObject keys : bo) { + map.put(keys.getAttribute("DOCUMENT_ID").toString(), keys.getAttribute("FULLPATH").toString()); + } + Map result = requestService.downloadDoc(map); + if (!result.containsKey("error")) { + for (String contractId : map.keySet()) { + try { + if ("success".equals(result.get(contractId))) { + String fileString = result.get("file_" + contractId); + InputStream fileInput = BASE64.encodeFileToBase64(fileString); + OutputStream fileOut = new FileOutputStream(map.get(contractId));// TODO + byte[] buffByte = new byte[1024]; + int size = 0; + while ((size = fileInput.read(buffByte)) != -1) { + fileOut.write(buffByte, 0, size); + } + fileInput.close(); + fileOut.close(); + } else if ("error".equals(result.get(contractId))) { + return "error"; + } + } catch (Exception e) { + e.printStackTrace(); + + } + } + return "success"; + } else { + return "error"; + } + } + } catch (Exception e) { + return "error"; + } + return "success"; + } + + /** + * ¿Û¿î¿¨ÐÅÏ¢±ä¸ü¸ù¾Ýdocument_idÏÂÔØºÏͬ + * + * @param tx + * @return + * @throws Exception + * @throws MalformedURLException + */ + public String changedownloadDoc(JBOTransaction tx) throws MalformedURLException, Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager ldMange = JBOFactory.getBizObjectManager(LB_DOCRELATIVE.CLASS_NAME, tx); + String sql = "OBJECTTYPE='ChangeCar' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid "; + @SuppressWarnings("unchecked") + BizObject ldb = ldMange.createQuery(sql).setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(true); + BizObjectManager clBom = JBOFactory.getBizObjectManager(LB_DOCLIBRARY.CLASS_NAME, tx); + try { + if (ldb != null) { + BizObject ldl = clBom.createQuery("RELATIVE_ID=:relativeid").setParameter("relativeid", ldb.getAttribute("ID").getString()).getSingleResult(false); + BizObjectManager ldaMange = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx); + BizObject lda = ldaMange.createQuery("LIBRARY_ID=:libraryid").setParameter("libraryid", ldl.getAttribute("ID").getString()).getSingleResult(false); + Map map = new HashMap(); + map.put(ldl.getAttribute("REMARK").toString(), lda.getAttribute("FULLPATH").toString()); + Map result = requestService.downloadDoc(map); + if (!result.containsKey("error")) { + for (String contractId : map.keySet()) { + try { + if ("success".equals(result.get(contractId))) { + String fileString = result.get("file_" + contractId); + InputStream fileInput = BASE64.encodeFileToBase64(fileString); + OutputStream fileOut = new FileOutputStream(map.get(contractId));// TODO + byte[] buffByte = new byte[1024]; + int size = 0; + while ((size = fileInput.read(buffByte)) != -1) { + fileOut.write(buffByte, 0, size); + } + fileInput.close(); + fileOut.close(); + } else if ("error".equals(result.get(contractId))) { + return "error"; + } + } catch (Exception e) { + e.printStackTrace(); + + } + } + return "success"; + } else { + return "error"; + } + } + } catch (Exception e) { + return "error"; + } + return "success"; + } + +//¿Û¿î¿¨±ä¸üÏÂÔØºÏͬ + public String downloadDocContract(JBOTransaction tx) throws MalformedURLException, Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + String sql = ""; + sql = "flow_unid=:flow_unid and file_flag='yes'"; + String attributeId = ""; + try { + @SuppressWarnings("unchecked") + List bo = contBom.createQuery(sql).setParameter("flow_unid", FlowUnid).getResultList(true); + if (bo != null) { + Map map = new HashMap(); + for (BizObject keys : bo) { + map.put(keys.getAttribute("DOCUMENT_ID").toString(), keys.getAttribute("FULLPATH").toString()); + attributeId = keys.getAttribute("ATTRIBUTE_ID").toString(); + } + Map result = requestService.downloadDoc(map); + + if (!result.containsKey("error")) { + for (String contractId : map.keySet()) { + try { + if ("success".equals(result.get(contractId))) { + String fileString = result.get("file_" + contractId); + InputStream fileInput = BASE64.encodeFileToBase64(fileString); + OutputStream fileOut = new FileOutputStream(map.get(contractId));// TODO + byte[] buffByte = new byte[1024]; + int size = 0; + while ((size = fileInput.read(buffByte)) != -1) { + fileOut.write(buffByte, 0, size); + } + fileInput.close(); + fileOut.close(); + } else if ("error".equals(result.get(contractId))) { + return "error@"; + } + } catch (Exception e) { + e.printStackTrace(); + + } + } + return "success@" + attributeId; + } else { + return "error@"; + } + } else { + System.out.println("ûÓÐÎļþ¿ÉÏÂÔØ"); + return "error@"; + } + } catch (Exception e) { + e.printStackTrace(); + return "error@"; + } + } + +/** + * ¿Û¿î¿¨±ä¸üÏÂÔØzipºÏͬ + * @param tx + * @return + * @throws Exception + * @throws MalformedURLException + */ +public String downloadZipContract(JBOTransaction tx) throws MalformedURLException, Exception{ + requestService = (HttpRequestAppService) factory.create( + HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager contBom=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + try{ + String path=null; + @SuppressWarnings("unchecked") + String sql=""; + sql="flow_unid=:flow_unid and file_flag='yes'"; + @SuppressWarnings("unchecked") + List bo = contBom.createQuery(sql).setParameter("flow_unid",FlowUnid).getResultList(true); + + if(bo!=null){ + Map map=new HashMap(); + for(BizObject keys:bo){ + path="D://"+keys.getAttribute("singcontract_id").toString()+"DocList.zip"; + map.put(keys.getAttribute("singcontract_id").toString(),path); + } + String result=requestService.download(map); + if(result.equals("success")){ + return "success"; + }else{ + return "error"; + } + } + }catch(Exception e){ + return "error"; + } + return "success"; +} + + +/** + * ¸ù¾Ýcontract_idÏÂÔØºÏͬ + * @param tx + * @return + * @throws Exception + * @throws MalformedURLException + */ +public String download(JBOTransaction tx) throws MalformedURLException, Exception{ + requestService = (HttpRequestAppService) factory.create( + HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager contBom=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + try{ + String path=null; + @SuppressWarnings("unchecked") + List bo = contBom.createQuery("project_id=:projectId and file_flag='yes'").setParameter("projectId",ProjectId).getResultList(true); + if(bo!=null){ + Map map=new HashMap(); + for(BizObject keys:bo){ + path="D://"+keys.getAttribute("singcontract_id").toString()+"DocList.zip"; + map.put(keys.getAttribute("singcontract_id").toString(),path); + } + String result=requestService.download(map); + if(result.equals("success")){ + return "success"; + }else{ + return "error"; + } + } + }catch(Exception e){ + return "error"; + } + return "success"; +} + +/** + *jar°ü·½Ê½wordת»»pdf + *ÓÃjar·½·¨ + *wordת»»pdf + */ +public void wordToPdfJar(JBOTransaction tx){ + try { + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); + String sql=""; + if(flagType==null || "word".equals(flagType)){ + sql="project_id='"+ProjectId+"' and file_flag='yes' and process='1'"; + }else if("contract".equals(flagType)){ + sql="contract_id='"+contract_id+"' and file_flag='yes' and process='1'"; + }else if("pdfFalse".equals(flagType)){ + sql="project_id='"+ProjectId+"' and file_flag='yes' and process='3'"; + }else if ("flowunid".equals(flagType)){ + sql = "flow_unid='"+FlowUnid+"' and file_flag='yes' and process='1'"; + } + List bo = contBom.createQuery(sql).getResultList(false); + if(bo!=null){ + for(BizObject key:bo){ + String lastFilePath= key.getAttribute("FULLPATH").toString().replace(".docx", ".pdf"); + try { + WordToPdfThread wtpt = new WordToPdfThread(key.getAttribute("FULLPATH").toString(),lastFilePath,key.getAttribute("ATTRIBUTE_ID").toString()); + wtpt.start(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } catch (JBOException e) { + e.printStackTrace(); + + } +} +/** + * LibreOfficeʵÏÖwordת»»pdf + * wordת»»pdf + * @throws JBOException + */ + @SuppressWarnings({ "unchecked", "static-access" }) + public void wordToPdf(JBOTransaction tx) throws JBOException { + try { + BizObjectManager fbo = JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME, tx); + BizObject fbos = fbo.createQuery("FLOW_UNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(false); + //»ñÈ¡Óû§ÐÅÏ¢ + BizObjectManager lult = JBOFactory.getBizObjectManager(LB_UNION_LESSEE_TEMP.CLASS_NAME); + BizObjectManager customer = JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME); + BizObject lults = lult.createQuery("flowunid=:flowUnid").setParameter("flowUnid", FlowUnid).getSingleResult(false); + BizObject cust = customer.createQuery("flowunid=:flowUnid and customerid=:customerid").setParameter("flowUnid", FlowUnid).setParameter("customerid", lults.getAttribute("customer_id").toString()).getSingleResult(false); + String customername = null; + String telephone = null; + String ids =null; + + if(cust!=null){ + customername = cust.getAttribute("FULLNAME").toString(); + telephone = cust.getAttribute("mobile").toString(); + ids = cust.getAttribute("CUSTOMERID").toString(); + } + + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + BizObjectManager attrBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx); + WordToPDFUtil wordTopdf = new WordToPDFUtil(); + File file = null; + Boolean result = null; + String sql = ""; + /*if (flagType == null || "word".equals(flagType)) { + sql = "project_id='" + ProjectId + "' and file_flag='yes' and process='1'"; + } else if ("contract".equals(flagType)) { + sql = "contract_id='" + contract_id + "' and file_flag='yes' and process='1'"; + } else if ("pdfFalse".equals(flagType)) { + sql = "project_id='" + ProjectId + "' and file_flag='yes' and process='3'"; + } else if ("flowunid".equals(flagType)){ + sql = "flow_unid='"+FlowUnid+"' and file_flag='yes' and (process='1' or process='3')"; + }*/ + List bo = contBom.createQuery("flow_unid=:flowUnid and file_flag='yes' and process='1'").setParameter("flowUnid", FlowUnid).getResultList(true); + if (bo != null) { + for (BizObject contBo : bo) { + String attrId = contBo.getAttribute("ATTRIBUTE_ID").toString(); + BizObject attrBo = attrBom.createQuery("id='" +attrId+"'").getSingleResult(true); + String path = attrBo.getAttribute("FULLPATH").toString(); + String lastFilePath = path.replace(".docx", ".pdf"); + File filePath = new File(path); + if(!filePath.exists()){ + logger.info("wordת»»pdfµÄÔ´Îļþ²»´æÔÚ"); + continue; + } + String lastFilePathpdf = filePath.getParent(); + try { + result = wordTopdf.Word2Pdf(path, lastFilePathpdf); + } catch (Exception e) { + result = false; + e.printStackTrace(); + } + if (result) { + file =new File(lastFilePath); + contBo.setAttributeValue("FULLPATH",lastFilePath); + contBo.setAttributeValue("FILENAME",contBo.getAttribute("FILENAME").toString().replace(".docx",".pdf" )); + contBo.setAttributeValue("FILEPATH",contBo.getAttribute("FILEPATH").toString().replace(".docx", ".pdf")); + contBo.setAttributeValue("CONTENT_TYPE","application/pdf"); + contBo.setAttributeValue("PROCESS","2"); + contBo.setAttributeValue("PROJECT_ID",fbos.getAttribute("proj_id").toString()); + contBo.setAttributeValue("CUSTOMERNAME",customername); + contBo.setAttributeValue("TELEPHONE",telephone); + contBo.setAttributeValue("IDS",ids); + contBom.saveObject(contBo); + attrBo.setAttributeValue("FULLPATH",attrBo.getAttribute("FULLPATH").toString().replace(".docx", ".pdf")); + attrBo.setAttributeValue("FILENAME",attrBo.getAttribute("FILENAME").toString().replace(".docx", ".pdf")); + attrBo.setAttributeValue("FILEPATH",attrBo.getAttribute("FILEPATH").toString().replace(".docx", ".pdf")); + attrBo.setAttributeValue("FileSize",file.length()); + attrBo.setAttributeValue("CONTENT_TYPE","application/pdf"); + attrBom.saveObject(attrBo); + }else{ + contBo.setAttributeValue("PROCESS","3"); + contBom.saveObject(contBo); + } + } + } + } catch (JBOException e) { + e.printStackTrace(); + } + } + + /** + * ×â½ð֪ͨÊ鸽¼þÓÃLibreOfficeʵÏÖwordת»»pdf + * wordת»»pdf + * @throws JBOException + */ + @SuppressWarnings({ "unchecked", "static-access" }) + public String wordToPdfAnnex(JBOTransaction tx) throws JBOException { + + PLAN_LIST=PLAN_LIST.split("\\.")[0]; + BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME); + BizObject DOCRELATIVE = null; + if("null".equals(PLAN_LIST)){ + DOCRELATIVE=bom.createQuery("plan_number=:plan_number and OBJECTTYPE='´òÓ¡´ß¿îº¯' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false); + }else if("rights".equals(PLAN_LIST)){ + DOCRELATIVE = bom.createQuery("CONTRACT_ID=:CONTRACT_ID and objecttype='rights'").setParameter("CONTRACT_ID",contract_id).getSingleResult(false); + }else if("settle".equals(PLAN_LIST)){ + DOCRELATIVE = bom.createQuery("CONTRACT_ID=:CONTRACT_ID and objecttype='settle'").setParameter("CONTRACT_ID",contract_id).getSingleResult(false); + }else if("TX".equals(PLAN_LIST)){ + DOCRELATIVE=bom.createQuery("plan_number=:plan_number and objecttype='AdjustInterst' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false); + }else if("ChangeCar".equals(PLAN_LIST)){ + DOCRELATIVE=bom.createQuery(" OBJECTTYPE='ChangeCar' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false); + }else if("transfer".equals(PLAN_LIST)){ + DOCRELATIVE=bom.createQuery(" OBJECTTYPE='transfer' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false); + }else if("AdjustmentNotice".equals(PLAN_LIST)){ + DOCRELATIVE=bom.createQuery(" OBJECTTYPE='AdjustmentNotice' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false); + }else if("TriditionCollection".equals(PLAN_LIST)){ + DOCRELATIVE=bom.createQuery(" OBJECTTYPE='TriditionCollection' and plan_number=:plan_number").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false); + }else if("TriditionSuspension".equals(PLAN_LIST)){ + DOCRELATIVE=bom.createQuery(" OBJECTTYPE='TriditionSuspension' and FLOW_UNID=:flowunid ").setParameter("flowunid",FlowUnid).getSingleResult(false); + }else if("settletradition".equals(PLAN_LIST)){ + DOCRELATIVE=bom.createQuery(" OBJECTTYPE='settletradition' and FLOW_UNID=:flowunid ").setParameter("flowunid",FlowUnid).getSingleResult(false); + }else if("LetterApprova".equals(PLAN_LIST)){ + DOCRELATIVE=bom.createQuery(" OBJECTTYPE='LetterApprova' and PROJ_ID=:projectId ").setParameter("projectId",ProjectId).getSingleResult(false); + }else if("LoanNotice".equals(PLAN_LIST)){ + DOCRELATIVE=bom.createQuery(" OBJECTTYPE='LoanNotice' and PROJ_ID=:projectId ").setParameter("projectId",ProjectId).getSingleResult(false); + } + else{ + DOCRELATIVE=bom.createQuery("plan_number=:plan_number and plan_list=:plan_list").setParameter("plan_number",PAYMENT_NUMBER).setParameter("plan_list", PLAN_LIST).getSingleResult(false); + } + + BizObjectManager attrBom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCATTRIBUTE.CLASS_NAME); + BizObject attrBo=null; + WordToPDFUtil wordTopdf = new WordToPDFUtil(); + File file = null; + Boolean result = null; + String sql = ""; + try { + if (DOCRELATIVE != null) { + + String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString(); + BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME); + String DOCLIBRARYid=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(false).getAttribute("id").toString(); + attrBo = attrBom.createQuery("library_id=:library_id").setParameter("library_id", DOCLIBRARYid).getSingleResult(true); + + String path = attrBo.getAttribute("FULLPATH").toString(); + String lastFilePath = path.replace(".docx", ".pdf"); + File filePath = new File(path); + if(!filePath.exists()){ + logger.info("wordת»»pdfµÄÔ´Îļþ²»´æÔÚ"); + } + String lastFilePathpdf = filePath.getParent(); + try { + result = wordTopdf.Word2Pdf(path, lastFilePathpdf); + } catch (Exception e) { + result = false; + e.printStackTrace(); + } + if (result) { + file =new File(lastFilePath); + attrBo.setAttributeValue("FULLPATH",attrBo.getAttribute("FULLPATH").toString().replace(".docx", ".pdf")); + attrBo.setAttributeValue("FILENAME",attrBo.getAttribute("FILENAME").toString().replace(".docx", ".pdf")); + attrBo.setAttributeValue("FILEPATH",attrBo.getAttribute("FILEPATH").toString().replace(".docx", ".pdf")); + attrBo.setAttributeValue("FileSize",file.length()); + attrBo.setAttributeValue("CONTENT_TYPE","application/pdf"); + attrBom.saveObject(attrBo); + }else{ + } + if("ChangeCar".equals(PLAN_LIST)){ + BizObjectManager ldclManage=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); + BizObject ldcl = ldclManage.createQuery(" FLOW_UNID=:flowunid and CONTRACT_ID=:contractid and file_flag='yes' ").setParameter("flowunid", FlowUnid).setParameter("contractid", contract_id).getSingleResult(true); + file =new File(lastFilePath); + ldcl.setAttributeValue("FULLPATH",lastFilePath); + ldcl.setAttributeValue("FILENAME",ldcl.getAttribute("FILENAME").toString().replace(".docx",".pdf" )); + ldcl.setAttributeValue("FILEPATH",ldcl.getAttribute("FILEPATH").toString().replace(".docx", ".pdf")); + ldcl.setAttributeValue("CONTENT_TYPE","application/pdf"); + ldcl.setAttributeValue("PROCESS","2"); + ldclManage.saveObject(ldcl); + } + } + + } catch (JBOException e) { + e.printStackTrace(); + } + return attrBo.getAttribute("ID").toString(); + } + /** + * ¶àÏß³Ìwordת»»pdf + * @author tenwa518 + * + */ +class WordToPdfThread extends Thread{ + final String fullPath; + final String lastFilePath; + final String attrId; + public WordToPdfThread(String fullPath,String lastFilePath,String attrId){ + this.fullPath = fullPath; + this.lastFilePath = lastFilePath; + this.attrId = attrId; + + } + @Override + public void run() { + Word2PdfUtil wP = new Word2PdfUtil(); +// WordToPDFUtil w2P = new WordToPDFUtil(); + try { +// w2P.Word2Pdf(fullPath, lastFilePathpdf); + wP.doc2pdf(fullPath,lastFilePath,attrId); + } catch (Exception e) { + e.printStackTrace(); + } + } +} +/** + * ²é¿´wordÎļþÊÇ·ñ¶¼×ªÎªpdf + * @param tx + * @return + * @throws JBOException + */ +public String getMakeContractProcess(JBOTransaction tx) throws JBOException{ + BizObjectManager ldclBom=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + int wordIng=0; + int pdfFalse=0; + int pdfTrue=0; + List ldclBo2=ldclBom.createQuery("project_id='"+ProjectId+"' and file_flag='yes' ").getResultList(false); + if(ldclBo2.size()>0){ + for(BizObject key:ldclBo2){ + String process = key.getAttribute("process").toString(); + if("1".equals(process)){ + wordIng++; +// return "error"; + }else if("2".equals(process)){ + pdfTrue++; +// return "wording"; + }else if("3".equals(process)){ + pdfFalse++; +// return "success"; + } + } + }else{ + //ÖÆ×÷ºÏͬ + return "0"; + } + if(wordIng>0 && pdfFalse>0 && pdfTrue>0){ + //wordת»»PDF²¿·Öʧ°Ü + return "1"; + }else if(wordIng==0 && pdfFalse>0 && pdfTrue>0){ + //wordתPDFʧ°Ü + return "2"; + }else if(wordIng==0 && pdfFalse>0 && pdfTrue>0){ + //wordת»»PDF²¿·Öʧ°Ü£¬ + return "3"; + }else if(wordIng>0 && pdfFalse==0 && pdfTrue>0){ + //wordÕýÔÚת»»pdf + return "4"; + }else if(wordIng>0 && pdfFalse==0 && pdfTrue==0){ + //wordûÓÐת»»pdf + return "5"; + }else if(wordIng==0 && pdfFalse==0 && pdfTrue>0){ + //wordת»»PDF³É¹¦ + return "6"; + } + return "error"; +} +//(¿Û¿î¿¨±ä¸ü)¸ù¾ÝºÏͬºÅ»ñÈ¡Îļþ״̬ +public String getMakeContractProcessContract(JBOTransaction tx) throws JBOException{ + BizObjectManager ldclBom=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + BizObject ldclBo = null; + ldclBo=ldclBom.createQuery("flow_unid='"+FlowUnid+"'and file_flag='yes' ").getSingleResult(false); + if(ldclBo!=null){ + String process = ldclBo.getAttribute("process").toString(); + String signType = ldclBo.getAttribute("sign_type").toString(); + if("1".equals(process)){ + return "isDoc"; + }else if("2".equals(process)&&"DRAFT".equals(signType)){ + return "isPdf"; + }else if("COMPLETE".equals(signType)){ + return "complete"; + }else if("SIGNING".equals(signType)){ + return "isSigning"; + } + } + //±íʾ²»´æÔÚÕâ¸öÎļþ + return "notExsit"; +} +/** + * תÕËÊÚȨÉêÇëÊé + * @param tx + * @return + * @throws InterruptedException + */ +@SuppressWarnings("unchecked") +public String AccountAccreditSign(JBOTransaction tx){ + try{ + this.wordToPdf(tx); + tx.commit(); + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + List boList = contBom.createQuery("file_flag='yes' and (process='2' or process='5') and flow_unid='"+FlowUnid+"'").getResultList(true); + if(boList.size()>0){ + try { + String result =this.accountSign(tx,FlowUnid,InputOrgid); + if("success".equals(result)){ + return "success"; + }else{ + return "error"; + } + } catch (Exception e) { + e.printStackTrace(); + return "error"; + } + }else{ + return "error"; + } + } catch (JBOException e) { + e.printStackTrace(); + return "error"; + } +} +public String accountSign(JBOTransaction tx,String flowunid,String orgid) throws Exception{ + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager ldclBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); + BizObjectManager attrBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME,tx); + Map map=new HashMap(); + ContractSignInfo con=null; + BizObject ldclBo=null; + try{ + //²éѯlb_doc_contract_list±í + ldclBo = ldclBom.createQuery("file_flag='yes' and process='2' and flow_unid='" + flowunid + "'").getSingleResult(true); + if (ldclBo != null) { + con = new ContractSignInfo(); + con.setFileid(ldclBo.getAttribute("ATTRIBUTE_ID").toString()); + con.setFilename(ldclBo.getAttribute("FILENAME").toString()); + // »ñÈ¡Éú³ÉÎļþ·¾¶ + String makefullPath = ldclBo.getAttribute("FULLPATH").toString(); + File file = new File(makefullPath); + if (!file.exists()) { + throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); + } + con.setInputfile(BASE64.encodeImgageToBase64(file)); + map.put(flowunid, con); + Map resultMap = null; + if (orgid.indexOf("8002003001") >= 0) { + // Î÷³ÇתÕËÊÚȨ + resultMap = requestService.createAccountContractSign(map); + } else { + // ¶«³ÇתÕËÊÚȨ + resultMap = requestService.createAccountContractDSign(map); + } + if (!resultMap.containsKey("error")) { + for (String key : resultMap.keySet()) { + if (key.indexOf("contract_") == -1) { + ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + ldclBo.setAttributeValue("SINGCONTRACT_ID", resultMap.get("contract_" + key)); + } + } + ldclBo.setAttributeValue("PROCESS", "5"); + ldclBom.saveObject(ldclBo); + tx.commit(); + } else { + return "error"; + } + } + //À­È¡Îļþ + ldclBo = ldclBom.createQuery("file_flag='yes' and process='5' and flow_unid='" + flowunid + "'").getSingleResult(true); + if (ldclBo != null) { + BizObject attrBo = attrBom.createQuery("id='"+ldclBo.getAttribute("attribute_id")+"'").getSingleResult(true); + Map mapFile = new HashMap(); + String fileName = ldclBo.getAttribute("FILENAME").toString(); + String fullPath =FileOperatorUtil.getuploadFileDir(this.getFileSavePath())+UUIDUtil.getUUID()+"_"+fileName; + String filePath = fullPath.replaceAll(this.getFileSavePath(),""); + mapFile.put(ldclBo.getAttribute("DOCUMENT_ID").toString(),fullPath); + Map result = requestService.downloadDoc(mapFile); + if (!result.containsKey("error")) { + for (String documentId : mapFile.keySet()) { + try { + if ("success".equals(result.get(documentId))) { + String fileString = result.get("file_" + documentId); + InputStream fileInput = BASE64.encodeFileToBase64(fileString); + OutputStream fileOut = new FileOutputStream(mapFile.get(documentId));// TODO + byte[] buffByte = new byte[1024]; + int size = 0; + while ((size = fileInput.read(buffByte)) != -1) { + fileOut.write(buffByte, 0, size); + } + fileInput.close(); + fileOut.close(); + } else if ("error".equals(result.get(documentId))) { + return "error"; + } + } catch (Exception e) { + e.printStackTrace(); + } + } + ldclBo.setAttributeValue("FILEPATH",filePath); + ldclBo.setAttributeValue("FULLPATH",fullPath); + ldclBo.setAttributeValue("PROCESS", "6"); + ldclBom.saveObject(ldclBo); + attrBo.setAttributeValue("FILEPATH",filePath); + attrBo.setAttributeValue("FULLPATH",fullPath); + attrBo.setAttributeValue("FileSize",new File(fullPath).length()); + attrBom.saveObject(attrBo); + return "success"; + } else { + return "error"; + } + } else { + return "error"; + } + } catch (Exception e) { + e.printStackTrace(); + return "error"; + } + +} +public String getFlowUnid(JBOTransaction tx) throws JBOException{ + BizObjectManager fboBom=JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME,tx); + BizObject fboBo=fboBom.createQuery("CHANNELAPPLYID='"+id+"'").getSingleResult(false); + return fboBo.getAttribute("flow_unid").toString(); +} + +/* + * ÖØÐ·¢ËͶÌÐÅ + * */ +public String sendMessageAgain(JBOTransaction tx) { + try{ + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + List bo = null; + String file = new String(); + Map contractmap = new HashMap(); + List list = new ArrayList(); + bo = contBom.createQuery("select singcontract_id,filename from O where project_id =:projectId" + +" and file_flag = 'yes' and sendprocess = '1' and sign_type = 'SIGNING'") + .setParameter("projectId", ProjectId).getResultList(true); + for (BizObject temp : bo) { + String singcontractid = temp.getAttribute("singcontract_id").toString(); + String filename = temp.getAttribute("filename").toString(); + contractmap.put(singcontractid, filename); + } + list.addAll(contractmap.keySet()); + Map map = requestService.sendNotice(list); + if(!map.containsKey("error")){ + return "success"; + }else{ + for(String singcontractid:map.keySet()){ + String sendStatus = map.get(singcontractid); + if("2"==sendStatus){ + file += contractmap.get(singcontractid)+";"; + } + } + return file; + } + + } catch (Exception e) { + try { + tx.rollback(); + } catch (JBOException e1) { + e1.printStackTrace(); + } + e.printStackTrace(); + return "error"; + } +} + + /* + * ¿Û¿î¿¨ÐÅÏ¢±ä¸üÖØÐ·¢ËͶÌÐÅ + * */ + public String ChangesendMessageAgain(JBOTransaction tx) { + try{ + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + List bo = null; + String file = new String(); + Map contractmap = new HashMap(); + List list = new ArrayList(); + BizObjectManager ldMange = JBOFactory.getBizObjectManager(LB_DOCRELATIVE.CLASS_NAME, tx); + String status = ""; + String peopleStatus=""; + String sql = "OBJECTTYPE='ChangeCar' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid "; + @SuppressWarnings("unchecked") + BizObject ldb = ldMange.createQuery(sql).setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(true); + if(ldb!=null){ + String singcontractid = ldb.getAttribute("TEMPLATE_ID").toString(); + contractmap.put(singcontractid, "Ö±×â¸öÈËÊÚȨЭÒéÊé.pdf"); + } + list.addAll(contractmap.keySet()); + Map map = requestService.sendNotice(list); + if(!map.containsKey("error")){ + return "success"; + }else{ + for(String singcontractid:map.keySet()){ + String sendStatus = map.get(singcontractid); + if("2"==sendStatus){ + file += contractmap.get(singcontractid)+";"; + } + } + return file; + } + + } catch (Exception e) { + try { + tx.rollback(); + } catch (JBOException e1) { + e1.printStackTrace(); + } + e.printStackTrace(); + return "error"; + } + } + +public String getProcess(JBOTransaction tx){ + try { + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); + BizObject bo = contBom.createQuery("file_flag='yes' and process is not null and flow_unid='"+FlowUnid+"'").getSingleResult(false); + if(bo==null){ + return "success"; + }else{ + return bo.getAttribute("PROCESS").toString(); + } + } catch (JBOException e) { + e.printStackTrace(); + return "error"; + } + +} + +public String claimSign(JBOTransaction tx) throws Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + ContractSignInfo con = null; + BizObject bo = null; + String doc_name = new String(); + String[] attrIdList=attrId.split("@"); + try{ + for(String attribute_id:attrIdList){ + Map map=new HashMap(); + bo = contBom.createQuery("file_flag='yes' and process='2' and flow_unid='" + FlowUnid + "' and attribute_id= '"+attribute_id+"'").getSingleResult(true); + if(bo != null){ + con = new ContractSignInfo(); + con.setFileid(attribute_id); + con.setFilename(bo.getAttribute("FILENAME").toString()); + String makefullPath = bo.getAttribute("FULLPATH").toString(); + File file = new File(makefullPath); + if (!file.exists()) { + throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); + } + con.setInputfile(BASE64.encodeImgageToBase64(file)); + map.put(FlowUnid, con); + Map resultMap = null; + //µ÷´úÀíµÄ½Ó¿Ú + doc_name = bo.getAttribute("doc_name").toString(); + if("×â½ðÖ§¸¶±í".equals(doc_name)){ + //×â½ðÖ§¸¶±í + resultMap = requestService.createPaymentofHireSign(map); + } + if (!resultMap.containsKey("error")) { + for (String key : resultMap.keySet()) { + if (key.indexOf("contract_") == -1) { + bo.setAttributeValue("SINGCONTRACT_ID",resultMap.get("contract_" + key)); + bo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + } + } + bo.setAttributeValue("PROCESS", "5"); + contBom.saveObject(bo); + tx.commit(); + } else { + return "error"; + } + } + bo = contBom.createQuery("file_flag='yes' and process='5' and flow_unid='" + FlowUnid + "' and attribute_id= '"+attribute_id+"'").getSingleResult(true); + if (bo != null) { + Map map1 = new HashMap(); + map1.put(bo.getAttribute("DOCUMENT_ID").toString(), bo.getAttribute("FULLPATH").toString()); + Map result1 = requestService.downloadDoc(map1); + if (!result1.containsKey("error")) { + for (String contractId : map1.keySet()) { + try { + if ("success".equals(result1.get(contractId))) { + String fileString = result1.get("file_" + contractId); + InputStream fileInput = BASE64.encodeFileToBase64(fileString); + OutputStream fileOut = new FileOutputStream(map1.get(contractId));// TODO + byte[] buffByte = new byte[1024]; + int size = 0; + while ((size = fileInput.read(buffByte)) != -1) { + fileOut.write(buffByte, 0, size); + } + fileInput.close(); + fileOut.close(); + } else if ("error".equals(result1.get(contractId))) { + return "error"; + } + } catch (Exception e) { + e.printStackTrace(); + + } + } + bo.setAttributeValue("PROCESS", "6"); + contBom.saveObject(bo); + } else { + return "error"; + } + } else { + return "error"; + } + } + return "success"; + } catch (Exception e) { + e.printStackTrace(); + return "error"; + } +} + + /** + * ´òÓ¡×â½ð֪ͨÊé²¢·¢¶ÌПø¿Í»§ + * @param tx + * @return + * @throws Exception + */ + public String claimSignA(JBOTransaction tx) throws Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + String libraryid=""; + PLAN_LIST=PLAN_LIST.split("\\.")[0]; + BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME); + BizObject DOCRELATIVE=bom.createQuery("plan_number=:plan_number and plan_list=:plan_list").setParameter("plan_number",PAYMENT_NUMBER).setParameter("plan_list", PLAN_LIST).getSingleResult(false); + if (DOCRELATIVE != null) { + String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString(); + BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME); + libraryid=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(false).getAttribute("id").toString(); + } + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx); + ContractSignInfo con = null; + BizObject bo = null; +// String contract_id=""; + String info=""; + try{ + //»ñÈ¡³Ð×âÈ˵ÄÐÕÃûºÍµç»°ºÅ + BizObjectManager lulManager = JBOFactory.getBizObjectManager(LB_UNION_LESSEE.CLASS_NAME, tx); + String customerid = lulManager.createQuery("CONTRACT_ID=:contractId").setParameter("contractId", contract_id).getSingleResult(false).getAttribute("CUSTOMER_ID").toString(); + BizObjectManager crManage = JBOFactory.getBizObjectManager(CUSTOMER_PERSON.CLASS_NAME, tx); + BizObject cr = crManage.createQuery("CUSTOMERID=:customerid").setParameter("customerid", customerid).getSingleResult(false); + if(cr != null){ + info = cr.getAttribute("FULLNAME").toString() + "@" + cr.getAttribute("mobile").toString()+"@"+flagType; + }else{ + info = "flagType@flagType@"+flagType; + } + //»ñÈ¡ÐèÒª¸ÇÕµÄÎļþÐÅÏ¢ + Map map=new HashMap(); + bo = contBom.createQuery("library_id=:libraryid").setParameter("libraryid", libraryid).getSingleResult(true); + if(bo != null){ + id = bo.getAttribute("id").toString(); + con = new ContractSignInfo(); + con.setFileid(id); + con.setFilename(bo.getAttribute("FILENAME").toString()); + String makefullPath = bo.getAttribute("FULLPATH").toString(); + File file = new File(makefullPath); + if (!file.exists()) { + throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); + } + con.setInputfile(BASE64.encodeImgageToBase64(file)); + map.put(info, con); + Map resultMap = null; + //µ÷´úÀíµÄ½Ó¿Ú +// doc_name = bo.getAttribute("doc_name").toString(); +// if("×â½ðÖ§¸¶±í".equals(doc_name)){ + //×â½ðÖ§¸¶±í + resultMap = requestService.createPaymentofHireSign(map); +// } + if (!resultMap.containsKey("error")) { + for (String key : resultMap.keySet()) { + if (key.indexOf("contract_") == -1) { +// bo.setAttributeValue("SINGCONTRACT_ID",resultMap.get("contract_" + key)); +// bo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + contract_id = resultMap.get(key); + } + } +// bo.setAttributeValue("PROCESS", "5"); +// contBom.saveObject(bo); +// tx.commit(); + } else { + return "error"; + } + } +// bo = contBom.createQuery("file_flag='yes' and process='5' and flow_unid='" + FlowUnid + "' and attribute_id= '"+attribute_id+"'").getSingleResult(true); + if (bo != null) { + Map map1 = new HashMap(); + map1.put(contract_id, bo.getAttribute("FULLPATH").toString()); + Map result1 = requestService.downloadDoc(map1); + if (!result1.containsKey("error")) { + for (String contractId : map1.keySet()) { + try { + if ("success".equals(result1.get(contractId))) { + String fileString = result1.get("file_" + contractId); + InputStream fileInput = BASE64.encodeFileToBase64(fileString); + OutputStream fileOut = new FileOutputStream(map1.get(contractId));// TODO + byte[] buffByte = new byte[1024]; + int size = 0; + while ((size = fileInput.read(buffByte)) != -1) { + fileOut.write(buffByte, 0, size); + } + fileInput.close(); + fileOut.close(); + } else if ("error".equals(result1.get(contractId))) { + return "error"; + } + } catch (Exception e) { + e.printStackTrace(); + + } + } +// bo.setAttributeValue("PROCESS", "6"); +// contBom.saveObject(bo); + } else { + return "error"; + } + } else { + return "error"; + } + + return "success"; + } catch (Exception e) { + e.printStackTrace(); + return "error"; + } + } + + /** + * ¿Û¿î¿¨ÐÅÏ¢±ä¸ü·¢µç×ÓǩԼ + * @param tx + * @return + * @throws Exception + */ + public String changeCarSignA(JBOTransaction tx) throws Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + String libraryid=""; + BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME,tx); + BizObjectManager bom1=null; + BizObject DOCRELATIVE= null; + BizObject library= null; + DOCRELATIVE=bom.createQuery("OBJECTTYPE='ChangeCar' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(true); + if (DOCRELATIVE != null) { + String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString(); + bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME,tx); + library=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(true); + libraryid = library.getAttribute("id").toString(); + } + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx); + ContractSignInfo con = null; + BizObject bo = null; +// String contract_id=""; + String info=""; + try{ + //»ñÈ¡³Ð×âÈ˵ÄÐÕÃûºÍµç»°ºÅ + BizObjectManager lulManager = JBOFactory.getBizObjectManager(LB_UNION_LESSEE.CLASS_NAME, tx); + String customerid = lulManager.createQuery("CONTRACT_ID=:contractId").setParameter("contractId", contract_id).getSingleResult(false).getAttribute("CUSTOMER_ID").toString(); + BizObjectManager crManage = JBOFactory.getBizObjectManager(CUSTOMER_PERSON.CLASS_NAME, tx); + BizObject cr = crManage.createQuery("CUSTOMERID=:customerid").setParameter("customerid", customerid).getSingleResult(false); + if(cr != null){ + info = cr.getAttribute("FULLNAME").toString() + "@" + cr.getAttribute("mobile").toString()+"@"+flagType; + }else{ + return "error"; + } + //»ñÈ¡ÐèÒª¸ÇÕµÄÎļþÐÅÏ¢ + Map map=new HashMap(); + bo = contBom.createQuery("library_id=:libraryid").setParameter("libraryid", libraryid).getSingleResult(true); + if(bo != null){ + id = bo.getAttribute("id").toString(); + con = new ContractSignInfo(); + con.setFileid(id); + con.setFilename(bo.getAttribute("FILENAME").toString()); + String makefullPath = bo.getAttribute("FULLPATH").toString(); + File file = new File(makefullPath); + if (!file.exists()) { + throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); + } + con.setInputfile(BASE64.encodeImgageToBase64(file)); + map.put(info, con); + Map resultMap = null; + resultMap = requestService.createAccountContractDSign(map); + + if (!resultMap.containsKey("error")) { + BizObjectManager ldclManage=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); + BizObject ldcl = ldclManage.createQuery(" FLOW_UNID=:flowunid and CONTRACT_ID=:contractid and file_flag='yes' ").setParameter("flowunid", FlowUnid).setParameter("contractid", contract_id).getSingleResult(true); + if(ldcl != null){ + ldcl.setAttributeValue("sign_type", "SIGNING"); + ldclManage.saveObject(ldcl); + } + for (String key : resultMap.keySet()) { + if (key.indexOf("contract_") == -1) { +// DOCRELATIVE.setAttributeValue("SINGCONTRACT_ID",resultMap.get("contract_" + key)); + DOCRELATIVE.setAttributeValue("TEMPLATE_ID", resultMap.get("contract_" + key)); + library.setAttributeValue("REMARK",resultMap.get(key)); + bo.setAttributeValue("REMARK","SIGNING"); + contract_id = resultMap.get(key); + } + } + bom.saveObject(DOCRELATIVE); + bom1.saveObject(library); + contBom.saveObject(bo); + tx.commit(); + } else { + return "error"; + } + } + return "success"; + } catch (Exception e) { + e.printStackTrace(); + return "error"; + } + } + + /** + * ´ßÊÕº¯¸Ç¹«Ë¾Õ + * @param tx + * @return + * @throws Exception + */ + public String collectionSignA(JBOTransaction tx) throws Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + String libraryid=""; + BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME); + BizObject DOCRELATIVE = null; + if("settle".equals(flagType)){ + DOCRELATIVE=bom.createQuery("CONTRACT_ID=:contractid and objecttype='settle' ").setParameter("contractid",contract_id).getSingleResult(false); + }else if("LetterApprova".equals(flagType)){ + DOCRELATIVE=bom.createQuery("PROJ_ID=:projectId and objecttype='LetterApprova' ").setParameter("projectId",ProjectId).getSingleResult(false); + }else{ + DOCRELATIVE=bom.createQuery("plan_number=:plan_number and objecttype LIKE '%´òÓ¡´ß¿îº¯%' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false); + } + if (DOCRELATIVE != null) { + String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString(); + BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME); + libraryid=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(false).getAttribute("id").toString(); + } + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx); + ContractSignInfo con = null; + BizObject bo = null; + String info=""; + try{ + info = libraryid + "@" + libraryid+"@"+flagType; + //»ñÈ¡ÐèÒª¸ÇÕµÄÎļþÐÅÏ¢ + Map map=new HashMap(); + bo = contBom.createQuery("library_id=:libraryid").setParameter("libraryid", libraryid).getSingleResult(true); + if(bo != null){ + id = bo.getAttribute("id").toString(); + con = new ContractSignInfo(); + con.setFileid(id); + con.setFilename(bo.getAttribute("FILENAME").toString()); + String makefullPath = bo.getAttribute("FULLPATH").toString(); + File file = new File(makefullPath); + if (!file.exists()) { + throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); + } + con.setInputfile(BASE64.encodeImgageToBase64(file)); + map.put(info, con); + Map resultMap = null; + resultMap = requestService.createPaymentofHireSign(map); + if (!resultMap.containsKey("error")) { + for (String key : resultMap.keySet()) { + if (key.indexOf("contract_") == -1) { + contract_id = resultMap.get(key); + } + } + } else { + return "error"; + } + } + if (bo != null) { + Map map1 = new HashMap(); + map1.put(contract_id, bo.getAttribute("FULLPATH").toString()); + Map result1 = requestService.downloadDoc(map1); + if (!result1.containsKey("error")) { + for (String contractId : map1.keySet()) { + try { + if ("success".equals(result1.get(contractId))) { + String fileString = result1.get("file_" + contractId); + InputStream fileInput = BASE64.encodeFileToBase64(fileString); + OutputStream fileOut = new FileOutputStream(map1.get(contractId));// TODO + byte[] buffByte = new byte[1024]; + int size = 0; + while ((size = fileInput.read(buffByte)) != -1) { + fileOut.write(buffByte, 0, size); + } + fileInput.close(); + fileOut.close(); + } else if ("error".equals(result1.get(contractId))) { + return "error"; + } + } catch (Exception e) { + e.printStackTrace(); + + } + } + } else { + return "error"; + } + } else { + return "error"; + } + + return "success"; + } catch (Exception e) { + e.printStackTrace(); + return "error"; + } + } + + + + /*** + * ÒѾ­Éú³ÉµÄºÏͬ£¬×÷·Ï£¬ + * @param tx + * @return + * @throws JBOException + */ + + public String updateDocContractStatus(JBOTransaction tx) throws JBOException{ +// BizObjectManager attBom=JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME,tx);ProjectId + BizObjectManager lclManager=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); + BizObjectManager lpiManager=JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME,tx); + try{ +// BizObject lcl = lclManager.createQuery("file_flag='yes' and attribute_id='"+file_id+"'").getSingleResult(true); + + lclManager.createQuery("update O set file_flag='no',message='1' where attribute_id=:attributeid").setParameter("attributeid",file_id).executeUpdate(); + lpiManager.createQuery("update O set PROJECT_STATUS=13 where id=:id").setParameter("id",ProjectId).executeUpdate(); + //attBom.createQuery("update O set status='1' WHERE id='"+key.getAttribute("ATTRIBUTE_ID").toString()+"'").executeUpdate(); + tx.commit(); + }catch(Exception e){ + tx.rollback(); + e.printStackTrace(); + System.out.println(e.getMessage()); + return "error"; + } + return "success"; + } + + public String companyUpdateDocContractStatus(JBOTransaction tx) throws Exception{ + BizObjectManager fboManger=JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME,tx); + BizObjectManager lctManger=JBOFactory.getBizObjectManager(LB_CONTRACT_TEMPLATE.CLASS_NAME,tx); + BizObject fbo = fboManger.createQuery("flow_unid=:flowunid").setParameter("flowunid",FlowUnid).getSingleResult(false); + BizObject lct = lctManger.createQuery("Contract_id=:contractid").setParameter("contractid", fbo.getAttribute("CONTRACT_ID").getString()).getSingleResult(false); + String attId = ContractTemplateCache.getContractTemplateID(lct.getAttribute("ID").getString()); + lctManger.deleteObject(lct); + BizObjectManager lclManager=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx); + BizObjectManager lpiManager=JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME,tx); + try{ + lclManager.createQuery("update O set file_flag='no',message='1' where attribute_id=:attributeid").setParameter("attributeid",attId).executeUpdate(); + lpiManager.createQuery("update O set PROJECT_STATUS=13 where id=:id").setParameter("id",ProjectId).executeUpdate(); + //attBom.createQuery("update O set status='1' WHERE id='"+key.getAttribute("ATTRIBUTE_ID").toString()+"'").executeUpdate(); + tx.commit(); + }catch(Exception e){ + tx.rollback(); + e.printStackTrace(); + System.out.println(e.getMessage()); + return "error"; + } + return "success"; + } + + /** + * ´«Í³ºÏͬ¸ÇÕ + * @param tx + * @return + * @throws Exception + + */ + public String TcollectionSignA(JBOTransaction tx) throws Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + String libraryid=""; + BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME); + BizObject DOCRELATIVE = null; + if("transfer".equals(flagType)){ + DOCRELATIVE=bom.createQuery(" OBJECTTYPE='transfer' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false); + }else if("AdjustmentNotice".equals(flagType)){ + DOCRELATIVE=bom.createQuery(" OBJECTTYPE='AdjustmentNotice' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false); + }else if("TriditionCollection".equals(flagType)){ + DOCRELATIVE=bom.createQuery("plan_number=:plan_number and objecttype='TriditionCollection' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false); + }else if("TriditionSuspension".equals(flagType)){ + DOCRELATIVE=bom.createQuery(" OBJECTTYPE='TriditionSuspension' and FLOW_UNID=:flowunid ").setParameter("flowunid",FlowUnid).getSingleResult(false); + }else if("settletradition".equals(flagType)){ + DOCRELATIVE=bom.createQuery(" OBJECTTYPE='settletradition' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false); + }else if("LoanNotice".equals(flagType)){ + DOCRELATIVE=bom.createQuery(" OBJECTTYPE='LoanNotice' and PROJ_ID=:projectId ").setParameter("projectId",ProjectId).getSingleResult(false); + }else{ + DOCRELATIVE=bom.createQuery("plan_number=:plan_number and objecttype LIKE '%´òÓ¡´ß¿îº¯%' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false); + } + if (DOCRELATIVE != null) { + String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString(); + BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME); + libraryid=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(false).getAttribute("id").toString(); + } + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx); + ContractSignInfo con = null; + BizObject bo = null; + String info=""; + try{ + info = libraryid + "@" + libraryid+"@"+flagType; + //»ñÈ¡ÐèÒª¸ÇÕµÄÎļþÐÅÏ¢ + Map map=new HashMap(); + bo = contBom.createQuery("library_id=:libraryid").setParameter("libraryid", libraryid).getSingleResult(true); + if(bo != null){ + id = bo.getAttribute("id").toString(); + con = new ContractSignInfo(); + con.setFileid(id); + con.setFilename(bo.getAttribute("FILENAME").toString()); + String makefullPath = bo.getAttribute("FULLPATH").toString(); + File file = new File(makefullPath); + if (!file.exists()) { + throw new RuntimeException("Òª¶ÁÈ¡µÄÎļþ²»´æÔÚ"); + } + con.setInputfile(BASE64.encodeImgageToBase64(file)); + map.put(info, con); + Map resultMap = null; + resultMap = requestService.createPaymentofHireSign(map); + if (!resultMap.containsKey("error")) { + for (String key : resultMap.keySet()) { + if (key.indexOf("contract_") == -1) { + contract_id = resultMap.get(key); + } + } + } else { + return "error"; + } + } + if (bo != null) { + Map map1 = new HashMap(); + map1.put(contract_id, bo.getAttribute("FULLPATH").toString()); + Map result1 = requestService.downloadDoc(map1); + if (!result1.containsKey("error")) { + for (String contractId : map1.keySet()) { + try { + if ("success".equals(result1.get(contractId))) { + String fileString = result1.get("file_" + contractId); + InputStream fileInput = BASE64.encodeFileToBase64(fileString); + OutputStream fileOut = new FileOutputStream(map1.get(contractId));// TODO + byte[] buffByte = new byte[1024]; + int size = 0; + while ((size = fileInput.read(buffByte)) != -1) { + fileOut.write(buffByte, 0, size); + } + fileInput.close(); + fileOut.close(); + } else if ("error".equals(result1.get(contractId))) { + return "error"; + } + } catch (Exception e) { + e.printStackTrace(); + + } + } + } else { + return "error"; + } + } else { + return "error"; + } + + return "success"; + } catch (Exception e) { + e.printStackTrace(); + return "error"; + } + } + //Éú³Éһά + public String SystemMakeOneDimensionalCode(JBOTransaction tx){ + Configure CurConfig = Configure.getInstance(); + try { + String diskPath=CurConfig.getConfigure("OneDimensionalCode"); + MakeOneCodeAndContractModel mocacm = new MakeOneCodeAndContractModel(); + BizObjectManager loManage = JBOFactory.getBizObjectManager(LB_ONEDIMENSIONALCODE.CLASS_NAME,tx); + BizObject lom = loManage.createQuery(" PROJECT_ID=:projectid and CONTRACT_NO=:contractNo and CONTRACT_ID=:contractId").setParameter("projectid", ProjectId).setParameter("contractNo", contractNo).setParameter("contractId", contract_id).getSingleResult(false); + if(lom == null){ + //Éú³ÉһάÂë + mocacm.MOneDimensionalCode(contractNo, contract_id, ProjectId, diskPath, tx); + } + String outPdfFile = CurConfig.getConfigure("BQcontract"); + mocacm.pdfAndMark(outPdfFile, "", contract_id,leasform, tx); + }catch (Exception e) { + e.printStackTrace(); + return "error"; + } + return "success"; + } } \ No newline at end of file diff --git a/src_tenwa/com/tenwa/lease/flow/project/commcheck/MakingContractCarCheck.java b/src_tenwa/com/tenwa/lease/flow/project/commcheck/MakingContractCarCheck.java index f5997e2df..d5c56ba7d 100644 --- a/src_tenwa/com/tenwa/lease/flow/project/commcheck/MakingContractCarCheck.java +++ b/src_tenwa/com/tenwa/lease/flow/project/commcheck/MakingContractCarCheck.java @@ -42,7 +42,7 @@ public class MakingContractCarCheck extends DefaultBussinessCheck { if(ldcl!=null){ BizObject psl = psltMange.createQuery("productid=:productid").setParameter("productid", lcit.getAttribute("PRODUCT_ID").getString()).getSingleResult(false); if(psl!=null){ - if("03".equals(ci.getAttribute("CUSTOMERTYPE").getString())&&!"BAIC_MOTOR".equals(psl.getAttribute("operationType").toString())&&!"DYCD".equals(psl.getAttribute("operationType").toString())&&!"ZYC".equals(psl.getAttribute("operationType").toString())&&!"KJZL".equals(psl.getAttribute("operationType").toString())){ + if("03".equals(ci.getAttribute("CUSTOMERTYPE").getString())&&!"BAIC_MOTOR".equals(psl.getAttribute("operationType").toString())&&!"DYCD".equals(psl.getAttribute("operationType").toString())&&!"ZYC".equals(psl.getAttribute("operationType").toString())&&!"KJZL".equals(psl.getAttribute("operationType").toString())&&!"KHSQ".equals(psl.getAttribute("operationType").toString())){ if("4".equals(ldcl.getAttribute("PROCESS").getString())){ putMsg("ÒÑÍê³Éµç×ÓǩԼ£¡"); setPass(true);