OBidSuccessSignDriver.java 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. /**
  2. * @(#)file PoDeciSignDriver.java
  3. * @(#)author Lee beomgeun
  4. * @(#)version 1.0
  5. * @(#)date Aug 1, 2005
  6. * @(#)since JDK 1.4.2
  7. *
  8. * Copyright (c) www.dcchem.co.kr, Inc.
  9. * All rights reserved.
  10. * This software is the proprietary information of dcchem, Inc.
  11. */
  12. package kr.co.udapsoft.common.commonSign.driver;
  13. import java.sql.CallableStatement;
  14. import java.sql.Connection;
  15. import com.udapsoft.waf.system.HandlerStorage;
  16. import kr.co.hsnc.common.base.WAFLogger;
  17. import kr.co.hsnc.common.base.WAFMessages;
  18. import kr.co.hsnc.common.logger.Logger;
  19. import kr.co.hsnc.common.sql.Row;
  20. import kr.co.hsnc.common.sql.RowSet;
  21. import kr.co.hsnc.common.sql.RowSetImpl;
  22. import kr.co.hsnc.common.sql.WAFSQLException;
  23. import kr.co.hsnc.common.sql.persistent.Persistent;
  24. import kr.co.hsnc.common.sql.persistent.PersistentImpl;
  25. import kr.co.hsnc.common.sql.search.Search;
  26. import kr.co.hsnc.common.sql.search.SearchImpl;
  27. import kr.co.hsnc.common.sql.util.RowSetUtility;
  28. import kr.co.hsnc.common.util.ValueObject;
  29. import kr.co.udapsoft.common.commonSign.CommonSignInterface;
  30. import kr.co.udapsoft.common.sender.MessageSend;
  31. import kr.co.udapsoft.ebid.buyer.bid.outside.biz.InterfaceOutERPiU;
  32. import oracle.toplink.internal.ox.StrBuffer;
  33. /**
  34. *
  35. * @version 1.0
  36. * @author Beomgeun Lee
  37. */
  38. public class OBidSuccessSignDriver implements CommonSignInterface {
  39. /**
  40. * 테슽 파일
  41. *
  42. */
  43. public OBidSuccessSignDriver() {
  44. super();
  45. }
  46. /*
  47. * (non-Javadoc)
  48. * @see kr.co.udap.ehr.common.sign.SignInterface#doCallSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  49. */
  50. public void doCallSign(Connection connection, ValueObject signDoc) throws Exception {
  51. }
  52. /*
  53. * (non-Javadoc)
  54. * @see kr.co.udap.ehr.common.sign.SignInterface#doStartSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  55. */
  56. public void doStartSign(Connection connection, ValueObject signDoc) throws Exception {
  57. System.out.println("!!doStartSign");
  58. }
  59. /*
  60. * (non-Javadoc)
  61. * @see kr.co.udap.ehr.common.sign.SignInterface#doFirstFinishSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  62. */
  63. public void doFirstFinishSign(Connection connection, ValueObject signDoc) throws Exception {
  64. boolean success = true;
  65. System.out.println("!!doFirstFinishSign");
  66. System.out.println("### 결재 Strart");
  67. try {
  68. saveProc(connection,signDoc);
  69. success = update_BidMaster(connection, signDoc , "10");//결재
  70. ValueObject vo = getDemanded_kind(connection, signDoc);
  71. if("B".equals(vo.get("DEMANDED_KIND"))){
  72. UPDATE_EBID_STATUS(connection, signDoc, vo);
  73. }else {
  74. String demandedId = InterfaceOutERPiU.getDemandedId(signDoc.get("KEY_COL1"), signDoc.get("KEY_COL2"));
  75. InterfaceOutERPiU.updateStatusPMM(demandedId, "10");
  76. }
  77. if(success){
  78. if("Y".equals(vo.get("ONBID_YN"))){
  79. Send(signDoc,"10"); //낙찰업체 메일전송 2016.12.9 패찰업체 메일전송 추가.
  80. }
  81. Send_ToeTEC(signDoc,"10"); //발주의뢰자, 현설담당자, 외주 담당자 메일발송
  82. }
  83. }catch (Exception e) {
  84. WAFLogger.error(this.getClass().getName() + " --> doFirstFinishSign() : " + e.getMessage());
  85. WAFLogger.error(e);
  86. throw e; //2017.2.24추가
  87. }
  88. System.out.println("### 결재 End");
  89. }
  90. /*
  91. * (non-Javadoc)
  92. * @see kr.co.udap.ehr.common.sign.SignInterface#doFinishSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  93. */
  94. public void doFinishSign(Connection connection, ValueObject signDoc) throws Exception {
  95. System.out.println("!!doFinishSign");
  96. }
  97. /*
  98. * (non-Javadoc)
  99. * @see kr.co.udap.ehr.common.sign.SignInterface#doRejectSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  100. */
  101. public void doFirstRejectSign(Connection connection, ValueObject signDoc) throws Exception {
  102. System.out.println("!!반려");
  103. update_BidMaster(connection, signDoc , "95");//반려
  104. }
  105. /*
  106. * (non-Javadoc)
  107. * @see kr.co.udap.ehr.common.sign.SignInterface#doRejectSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  108. */
  109. public void doRejectSign(Connection connection, ValueObject signDoc) throws Exception {
  110. System.out.println("!!doRejectSign");
  111. }
  112. /*
  113. * (non-Javadoc)
  114. * @see kr.co.udap.ehr.common.sign.SignInterface#doCancelSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  115. */
  116. public void doCancelSign(Connection connection, ValueObject signDoc) throws Exception {
  117. }
  118. /**
  119. * SP_BID_TO_OUTCONT 프로시저 호출
  120. * @param connection
  121. * @param valueObject
  122. * @throws Exception
  123. */
  124. public void saveProc(Connection connection, ValueObject vo) throws Exception {
  125. ValueObject rtnVo = new ValueObject();
  126. CallableStatement cs = null;
  127. String pssql = "";
  128. try{
  129. pssql = "{call SP_BID_TO_OUTCONT(?,?,?,?)}";
  130. cs = connection.prepareCall(pssql);
  131. cs.setString(1, vo.get("KEY_COL1"));
  132. cs.setString(2, vo.get("KEY_COL2"));
  133. cs.registerOutParameter(3, java.sql.Types.VARCHAR);
  134. cs.registerOutParameter(4, java.sql.Types.VARCHAR);
  135. cs.execute();
  136. rtnVo.set("OUT_SUCCESS_CD",cs.getString(3));
  137. rtnVo.set("OUT_MESSAGE",cs.getString(4));
  138. System.out.println("CODE : " + cs.getString(3));
  139. if("N".equals(cs.getString(3))){
  140. throw new Exception(cs.getString(4));
  141. }
  142. }
  143. catch(Exception e) {
  144. WAFLogger.error(this.getClass().getName() + " --> saveProc() : " + e.getMessage());
  145. WAFLogger.error(e);
  146. throw e;
  147. }
  148. }
  149. /**
  150. * BID_MASTER 상태값 업데이트.
  151. * @param connection
  152. * @param valueObject
  153. * @throws Exception
  154. */
  155. public boolean update_BidMaster(Connection connection, ValueObject valueObject , String status) throws Exception {
  156. Persistent persistent = new PersistentImpl(connection);
  157. StrBuffer sqlstr = new StrBuffer();
  158. try {
  159. sqlstr.append(" UPDATE BID_MASTER \n");
  160. sqlstr.append(" SET STATUS_CD = ? \n");
  161. //sqlstr.append(" ,UPD_BY = ? \n");
  162. //sqlstr.append(" ,UPD_DATE = SYSDATE \n");
  163. sqlstr.append(" WHERE BID_NO = ? \n");
  164. sqlstr.append(" AND BID_DEG = ? \n");
  165. persistent.setStatement(sqlstr.toString());
  166. persistent.addParameter(status);
  167. //persistent.addParameter(valueObject.get("KEY_COL3"));
  168. persistent.addParameter(valueObject.get("KEY_COL1"));
  169. persistent.addParameter(valueObject.get("KEY_COL2"));
  170. persistent.execute();
  171. }
  172. catch(Exception e) {
  173. WAFLogger.error(this.getClass().getName() + " --> update_BidMaster() : " + e.getMessage());
  174. WAFLogger.error("SQL : " + sqlstr);
  175. WAFLogger.error(e);
  176. System.out.println("Exception : " + e.getMessage());
  177. return false;
  178. }
  179. return true;
  180. }
  181. public void Send(ValueObject params, String event) throws Exception {
  182. HandlerStorage Stroage = new HandlerStorage();
  183. MessageSend messageSend = new MessageSend(Stroage);
  184. RowSet SuppInfo = bid_supp_info(params);
  185. ValueObject bid_Master = bid_Master_info(params);
  186. for(int i=0;i < SuppInfo.size();i++){
  187. Row row = SuppInfo.getRow(i);
  188. boolean email = false;
  189. String CURRENCY_GB = "";
  190. StringBuffer mailtitle = new StringBuffer();
  191. StringBuffer mailtitlein = new StringBuffer();
  192. StringBuffer mailContent = new StringBuffer();
  193. if(row.get("SUCC_YN").equals("Y")){
  194. if(!row.get("CHARGE_EMAIL").isEmpty()){
  195. if(!row.get("CURRENCY_GB").isEmpty())
  196. CURRENCY_GB = " ("+row.get("CURRENCY_GB")+")";
  197. mailtitle.append("* 참여하신 입찰의 낙찰 통보 메일입니다.");
  198. mailtitlein.append("* 참여하신 입찰의 낙찰 통보 메일입니다.");
  199. mailContent.append(row.get("VENDOR_NAME")+"님이 참여하신 다음의 입찰에 낙찰업체로 선정되었음을 알려드립니다.<br>");
  200. mailContent.append("<font style='width:auto; font-size:12px; line-height:18px; padding:5px; text-align:left;'>");
  201. mailContent.append("<br>");
  202. mailContent.append("1.프로젝트 : " + bid_Master.get("DEPT_NM") + "<br>");
  203. mailContent.append("2.공고번호 : " + bid_Master.get("BID_NO") + "<br>");
  204. mailContent.append("3.공고건명 : " + bid_Master.get("BID_MASTER_NM") + "<br>");
  205. mailContent.append("4.낙찰금액 : " + row.get("TOT_AMT") + CURRENCY_GB + "<br>" );
  206. mailContent.append("5.입찰담당자 : " +bid_Master.get("BUSEO_NM")+" / "+ bid_Master.get("USER_NAME") +" (연락처 : " + bid_Master.get("PO_EMPNM") + ", 이메일 : " + bid_Master.get("E_MAIL") +")<br>");
  207. mailContent.append("</font><br>");
  208. mailContent.append("<font style='color:red; width:auto; font-size:13px;'>[유의사항]</font><br>");
  209. mailContent.append("<font style='text-decoration:underline; width:auto; font-size:12px;'>");
  210. mailContent.append("본 낙찰통지를 받은 후 낙찰업체는 당사가 계약서에 서명을 요청한 날로부터 15일 내에 <br>");
  211. mailContent.append("계약 관련 제반 서류(수입인지, 근재보험증권, 계약이행증권)를 제출하여 계약서에 서명하시기 바랍니다.<br>");
  212. mailContent.append("<br>");
  213. mailContent.append("만약 낙찰 업체가 서명 요청을 받은 날로부터 15일 내에 계약 서명 및 제반서류를 제출하지 못 할 경우<br>");
  214. mailContent.append("당사의 판단에 따라 해당 낙찰 및 계약이 취소될 수 있습니다.<br>");
  215. mailContent.append("</font>");
  216. email = true;
  217. if(email){
  218. messageSend.sendEmail(row.get("CHARGE_EMAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent);
  219. }
  220. }
  221. if(!row.get("CHAGE_HP").isEmpty()){
  222. String smsContent = WAFMessages.getMessage("Bidder.Selection.Guide");
  223. String from_phon_no = bid_Master.get("PO_EMPNM").replace("-", "");
  224. String to_phon_no = row.get("CHAGE_HP").replace("-", "");
  225. if(!smsContent.isEmpty()){
  226. messageSend.sendSMS(to_phon_no,from_phon_no, bid_Master.get("ACCT_ID"), smsContent); //2015.9.21 입찰담당자번호
  227. }
  228. }
  229. }else{
  230. if(!row.get("CHARGE_EMAIL").isEmpty()){
  231. mailtitle.append("* 입찰 결과 통보 메일입니다.");
  232. mailtitlein.append("* 입찰 결과 통보 메일입니다.");
  233. mailContent.append("안녕하십니까. SGC이앤씨(주) 입니다.<br>");
  234. mailContent.append("당사에서 실시한 입찰 결과를 다음과 같이 통보드립니다.<br>");
  235. mailContent.append("<font style='width:auto; font-size:12px; line-height:18px; padding:5px; text-align:left;'>");
  236. mailContent.append("<br>");
  237. mailContent.append("1.프로젝트 : " + bid_Master.get("DEPT_NM") + "<br>");
  238. mailContent.append("2.공고건명 : " + bid_Master.get("BID_MASTER_NM") + "<br>");
  239. mailContent.append("3.입찰결과 : 미선정 <br>" );
  240. mailContent.append("<br>");
  241. mailContent.append("성실히 입찰에 참여해 주심에 깊은 감사의 뜻을 전하며 귀사에 무궁한 발전이 있기를 기원합니다.<br>");
  242. mailContent.append("</font>");
  243. email = true;
  244. if(email){
  245. messageSend.sendEmail(row.get("CHARGE_EMAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent); // 2016.12.9
  246. }
  247. }
  248. }//end of fail
  249. }//end of for
  250. }
  251. /**
  252. * 견적 대상 업체 를 검색하여 리턴
  253. * @param Params
  254. * @return
  255. */
  256. public RowSet bid_supp_info(ValueObject param) {
  257. Search search = new SearchImpl();
  258. RowSet rowSet = new RowSetImpl();
  259. // String sqlstr = "";
  260. StrBuffer sqlstr = new StrBuffer();
  261. try{
  262. sqlstr.append(" SELECT MAX(A.CHARGE_NAME) AS CHARGE_NAME \n");
  263. sqlstr.append(" ,MAX(A.CHARGE_EMAIL) AS CHARGE_EMAIL \n");
  264. sqlstr.append(" ,MAX(A.CHAGE_HP) AS CHAGE_HP \n");
  265. sqlstr.append(" ,A.VENDOR_NAME \n");
  266. sqlstr.append(" ,MAX(NVL(A.CURRENCY_GB,B.CURRENCY_GB)) AS CURRENCY_GB \n");
  267. sqlstr.append(" ,'0' AS TOT_AMT \n");
  268. sqlstr.append(" ,MAX(NVL(A.SUCC_YN, 'N')) AS SUCC_YN \n");
  269. sqlstr.append(" FROM BID_SUPP A,BID_MASTER B,BID_SUPP C \n");
  270. sqlstr.append(" WHERE A.BID_NO = B.BID_NO \n");
  271. sqlstr.append(" AND A.BID_DEG = B.BID_DEG \n");
  272. sqlstr.append(" AND A.BID_NO = C.BID_NO(+) \n");
  273. sqlstr.append(" AND A.VENDOR_CD = C.VENDOR_CD(+) \n");
  274. sqlstr.append(" AND A.BID_NO = ? \n");
  275. sqlstr.append(" AND C.BID_DEG(+) = ? \n");
  276. sqlstr.append(" AND C.SUCC_YN(+) = 'Y' \n");
  277. sqlstr.append(" AND C.VENDOR_CD IS NULL \n");
  278. sqlstr.append(" AND NVL(A.SUCC_YN, 'N') = 'N' \n");
  279. sqlstr.append(" GROUP BY A.VENDOR_CD, A.VENDOR_NAME \n");
  280. sqlstr.append(" UNION ALL \n");
  281. sqlstr.append(" SELECT A.CHARGE_NAME \n");
  282. sqlstr.append(" ,A.CHARGE_EMAIL \n");
  283. sqlstr.append(" ,A.CHAGE_HP \n");
  284. sqlstr.append(" ,A.VENDOR_NAME \n");
  285. sqlstr.append(" ,NVL(A.CURRENCY_GB,B.CURRENCY_GB) AS CURRENCY_GB \n");
  286. sqlstr.append(" ,DECODE(A.ESTI_TOT_AMT,-1,'단가계약',F_GET_D_CURRENCY(A.ESTI_TOT_AMT,F_GET_CURRENCY_DIGIT(NVL(A.CURRENCY_GB,B.CURRENCY_GB)))) AS TOT_AMT \n");
  287. sqlstr.append(" ,NVL(A.SUCC_YN, 'N') SUCC_YN \n");
  288. sqlstr.append(" FROM BID_SUPP A,BID_MASTER B \n");
  289. sqlstr.append(" WHERE A.BID_NO = B.BID_NO \n");
  290. sqlstr.append(" AND A.BID_DEG = B.BID_DEG \n");
  291. sqlstr.append(" AND A.BID_NO = ? \n");
  292. sqlstr.append(" AND A.BID_DEG = ? \n");
  293. sqlstr.append(" AND A.SUCC_YN = 'Y' \n");//2016.12.9 패찰통보 추가 2017.08.16 1차-최종차수까지 참여모든 업체 패찰메일
  294. search.setStatement(sqlstr.toString());
  295. search.addParameter(param.get("KEY_COL1"));
  296. search.addParameter(param.get("KEY_COL2"));
  297. search.addParameter(param.get("KEY_COL1"));
  298. search.addParameter(param.get("KEY_COL2"));
  299. search.setStatement(sqlstr.toString());
  300. rowSet = search.execute();
  301. }
  302. catch (WAFSQLException se) {
  303. Logger.err.println("SQL : \n" + se.getStatement());
  304. Logger.err.println("PARAM : \n" + se.getParameter());
  305. }
  306. finally {
  307. if(rowSet == null){
  308. rowSet = new RowSetImpl();
  309. }
  310. }
  311. System.out.println("### rowSet size : " + rowSet.size());
  312. return rowSet;
  313. }
  314. /**
  315. * 발주의뢰(외주) 접수를 검색하여 리턴
  316. * @param Params
  317. * @return
  318. */
  319. public ValueObject bid_Master_info(ValueObject param) {
  320. Search search = new SearchImpl();
  321. ValueObject valueobject = null;
  322. RowSet rowSet = new RowSetImpl();
  323. StrBuffer sqlstr = new StrBuffer();
  324. try{
  325. sqlstr.append(" SELECT A.BID_NO, \n");
  326. sqlstr.append(" TO_CHAR(A.BID_TO_DT,'YYYY-MM-DD HH24:MI') AS BID_TO_DT_NM, \n");
  327. sqlstr.append(" A.PO_EMPNM, \n");
  328. sqlstr.append(" A.DEPT_CD, \n");
  329. sqlstr.append(" A.DEPT_NM, \n");
  330. sqlstr.append(" A.BID_MASTER_NM, \n");
  331. sqlstr.append(" B.USER_NAME, \n");
  332. sqlstr.append(" B.E_MAIL, \n");
  333. sqlstr.append(" B.ACCT_ID, \n");
  334. sqlstr.append(" A.DEMANDED_NO, A.DEMANDED_TITLE, C.E_MAIL EMP_MAIL,SITEDESCEMAIL, \n");
  335. sqlstr.append(" TO_CHAR(TO_DATE(A.DELI_START_DT),'YYYY-MM-DD') AS WORK_FROM_DT, \n");
  336. sqlstr.append(" TO_CHAR(TO_DATE(A.DELI_END_DT),'YYYY-MM-DD') AS WORK_END_DT, \n");
  337. sqlstr.append(" (SELECT ACC_DEPT_NM FROM PUB0120T WHERE USER_SABUN = B.USER_SABUN) AS BUSEO_NM \n");
  338. sqlstr.append(" FROM BID_MASTER A, PUB0120T B, PUB0120T C \n");
  339. sqlstr.append(" WHERE A.PUREMPNO = B.ACCT_ID \n");
  340. sqlstr.append(" AND A.EMP_NO = C.ACCT_ID \n");
  341. sqlstr.append(" AND A.BID_NO = ? \n");
  342. sqlstr.append(" AND A.BID_DEG = ? \n");
  343. search.setStatement(sqlstr.toString());
  344. search.addParameter(param.get("KEY_COL1"));
  345. search.addParameter(param.get("KEY_COL2"));
  346. search.setStatement(sqlstr.toString());
  347. rowSet = search.execute();
  348. if( rowSet != null && rowSet.size() > 0 ){
  349. valueobject = RowSetUtility.getValueObject(rowSet.getRow(0));
  350. }
  351. }
  352. catch (WAFSQLException se) {
  353. Logger.err.println("SQL : \n" + se.getStatement());
  354. Logger.err.println("PARAM : \n" + se.getParameter());
  355. }
  356. return valueobject;
  357. }
  358. /**
  359. * STATUS_CD 상태값을 업데이트해준다.
  360. * @param connection
  361. * @param valueObject
  362. * @throws Exception
  363. */
  364. public boolean UPDATE_EBID_STATUS(Connection connection, ValueObject vo, ValueObject BidMaster) throws Exception {
  365. Persistent persistent = new PersistentImpl(connection);
  366. StringBuffer sqlstr = null;
  367. try {
  368. sqlstr = new StringBuffer();
  369. sqlstr.append(" UPDATE ETECEPC.MR_REQ_PO \n");
  370. sqlstr.append(" SET EBID_STATUS = '05' --결재 \n");
  371. sqlstr.append(" , REQ_STATUS = '5' --결재 \n");
  372. sqlstr.append(" WHERE DEMANDED_ID = (SELECT DEMANDED_ID FROM BID_MASTER WHERE BID_NO = ? AND BID_DEG = ?) \n");
  373. persistent.setStatement(sqlstr.toString());
  374. persistent.addParameter(vo.get("KEY_COL1"));
  375. persistent.addParameter(vo.get("KEY_COL2"));
  376. persistent.execute();
  377. }
  378. catch(Exception e) {
  379. WAFLogger.error(this.getClass().getName() + " --> updateSac01001() : " + e.getMessage());
  380. WAFLogger.error("SQL : " + sqlstr);
  381. WAFLogger.error(e);
  382. return false;
  383. }
  384. return true;
  385. }
  386. private ValueObject getDemanded_kind(Connection connection, ValueObject vo) throws Exception{
  387. Search search = new SearchImpl();
  388. RowSet rowSet = new RowSetImpl();
  389. ValueObject valueobject = null;
  390. StringBuffer sqlstr = new StringBuffer();
  391. try {
  392. sqlstr.append(" SELECT DEMANDED_KIND,STATUS_CD,ONBID_YN \n");
  393. sqlstr.append(" FROM BID_MASTER \n");
  394. sqlstr.append(" WHERE BID_NO = ? \n");
  395. sqlstr.append(" AND BID_DEG = ? \n");
  396. search.setStatement(sqlstr.toString());
  397. search.addParameter(vo.get("KEY_COL1"));
  398. search.addParameter(vo.get("KEY_COL2"));
  399. rowSet = search.execute();
  400. if (rowSet.size() > 0) {
  401. valueobject = RowSetUtility.getValueObject(search.execute().getRow(0));
  402. }
  403. }
  404. catch(WAFSQLException se) {
  405. Logger.err.println("SQL : \n" + se.getStatement());
  406. Logger.err.println("PARAM : \n" + se.getParameter());
  407. throw se;
  408. }
  409. finally {
  410. if (valueobject == null)
  411. valueobject = new ValueObject();
  412. return valueobject;
  413. }
  414. }
  415. //2016.6.16 시행결의완료후 결재완료 알림. 발주의뢰자, 견적설명회 담당자
  416. public void Send_ToeTEC(ValueObject params, String event) throws Exception {
  417. HandlerStorage Stroage = new HandlerStorage();
  418. MessageSend messageSend = new MessageSend(Stroage);
  419. RowSet SuppInfo = bid_supp_info(params);
  420. RowSet relEmpInfo = relation_emp_info(params);
  421. ValueObject bid_Master = bid_Master_info(params);
  422. StringBuffer mailtitle = new StringBuffer();
  423. StringBuffer mailtitlein = new StringBuffer();
  424. StringBuffer mailContent = new StringBuffer();
  425. mailtitle.append("* [알림]시행결의 승인");
  426. mailtitlein.append("* 시행결의 승인");
  427. mailContent.append("아래와 같이 시행결의가 완료되었음을 알려드립니다.<br>");
  428. mailContent.append("<font style='width:auto; font-size:12px; line-height:18px; padding:5px; text-align:left;'>");
  429. mailContent.append("<br>");
  430. mailContent.append("1.프로젝트 : " + bid_Master.get("DEPT_NM") + "<br>");
  431. mailContent.append("2.발주번호 : " + bid_Master.get("DEMANDED_NO") + "<br>");
  432. mailContent.append("3.발주건명 : " + bid_Master.get("DEMANDED_TITLE") + "<br>");
  433. mailContent.append("4.외주담당자 : " + bid_Master.get("USER_NAME") + "<br>" );
  434. for(int i=0;i < SuppInfo.size();i++){
  435. if (SuppInfo.getRow(i).get("SUCC_YN").equals("Y")){
  436. mailContent.append("5.낙찰업체 : " + SuppInfo.getRow(i).get("VENDOR_NAME") + "<br>" );
  437. mailContent.append("6.낙찰금액 : " + SuppInfo.getRow(i).get("TOT_AMT") + SuppInfo.getRow(i).get("CURRENCY_GB") + "<br>" );
  438. }
  439. }
  440. mailContent.append("7.계약기간 : " +bid_Master.get("WORK_FROM_DT")+" ~ "+ bid_Master.get("WORK_END_DT")+ "<br>");
  441. mailContent.append("8.비고 <br>");
  442. mailContent.append("&nbsp;1)계약서는 시행결의 승인 후 1~2일 내 낙찰업체에 전달됩니다. <br>");
  443. mailContent.append("&nbsp;2)계약 완료 후 계약서 및 관련 서류는 전자조달시스템의 외주-계약결과에서 조회 가능합니다. <br>");
  444. mailContent.append("&nbsp;3)공사의 경우 계약 완료 전까지 현장 개설 불가합니다. <br>");
  445. mailContent.append("</font><br>");
  446. //외주담당자
  447. messageSend.sendEmail(bid_Master.get("E_MAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent, "1");
  448. //발주의뢰자
  449. if(!bid_Master.get("EMP_MAIL").isEmpty()){//
  450. messageSend.sendEmail(bid_Master.get("EMP_MAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent, "1");
  451. }
  452. //현설담당자
  453. if(!bid_Master.get("SITEDESCEMAIL").isEmpty() && !bid_Master.get("SITEDESCEMAIL").equals(bid_Master.get("EMP_MAIL")) ){
  454. messageSend.sendEmail(bid_Master.get("SITEDESCEMAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent, "1");
  455. }
  456. //유관부서 담당자
  457. if(relEmpInfo.size() > 0){
  458. for(int i=0;i < relEmpInfo.size();i++){
  459. Row row = relEmpInfo.getRow(i);
  460. messageSend.sendEmail(row.get("E_MAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent, "1");
  461. }
  462. }
  463. }
  464. public RowSet relation_emp_info(ValueObject param) {
  465. Search search = new SearchImpl();
  466. RowSet rowSet = new RowSetImpl();
  467. // String sqlstr = "";
  468. StrBuffer sqlstr = new StrBuffer();
  469. try{
  470. sqlstr.append(" SELECT A.EMP_ID \n");
  471. sqlstr.append(" , B.E_MAIL \n");
  472. sqlstr.append(" FROM BID_DECIDE_MAIL_LIST A, PUB0120T B \n");
  473. sqlstr.append(" WHERE A.EMP_ID = B.ACCT_ID \n");
  474. sqlstr.append(" AND A.BID_NO = ? \n");
  475. sqlstr.append(" AND A.BID_DEG = ? \n");
  476. search.setStatement(sqlstr.toString());
  477. search.addParameter(param.get("KEY_COL1"));
  478. search.addParameter(param.get("KEY_COL2"));
  479. search.setStatement(sqlstr.toString());
  480. rowSet = search.execute();
  481. }
  482. catch (WAFSQLException se) {
  483. Logger.err.println("SQL : \n" + se.getStatement());
  484. Logger.err.println("PARAM : \n" + se.getParameter());
  485. }
  486. finally {
  487. if(rowSet == null){
  488. rowSet = new RowSetImpl();
  489. }
  490. }
  491. System.out.println("### rowSet size : " + rowSet.size());
  492. return rowSet;
  493. }
  494. }