PBidSuccessSignDriver.java 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  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 oracle.toplink.internal.ox.StrBuffer;
  32. /**
  33. *
  34. * @version 1.0
  35. * @author Beomgeun Lee
  36. */
  37. public class PBidSuccessSignDriver implements CommonSignInterface {
  38. /**
  39. * 테슽 파일
  40. *
  41. */
  42. public PBidSuccessSignDriver() {
  43. super();
  44. }
  45. /*
  46. * (non-Javadoc)
  47. * @see kr.co.udap.ehr.common.sign.SignInterface#doCallSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  48. */
  49. public void doCallSign(Connection connection, ValueObject signDoc) throws Exception {
  50. }
  51. /*
  52. * (non-Javadoc)
  53. * @see kr.co.udap.ehr.common.sign.SignInterface#doStartSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  54. */
  55. public void doStartSign(Connection connection, ValueObject signDoc) throws Exception {
  56. System.out.println("!!doStartSign");
  57. }
  58. /*
  59. * (non-Javadoc)
  60. * @see kr.co.udap.ehr.common.sign.SignInterface#doFirstFinishSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  61. */
  62. public void doFirstFinishSign(Connection connection, ValueObject signDoc) throws Exception {
  63. boolean success = true;
  64. System.out.println("!!doFirstFinishSign");
  65. System.out.println("### 결재 Strart");
  66. //try { //2015.11.27 오류처리
  67. success = saveProc(connection,signDoc);
  68. success = update_BidSupp(connection, signDoc , "10");//결재
  69. ValueObject vo = getDemanded_kind(connection, signDoc);
  70. ValueObject vo2 = getBidMaster(connection, signDoc);
  71. if(vo2.get("CNT").equals("0") ){
  72. success = update_BidMaster(connection, signDoc , "10");//결재
  73. }
  74. UPDATE_EBID_STATUS(connection, signDoc, vo);
  75. if(success){
  76. if("Y".equals(vo.get("ONBID_YN"))){
  77. Send(signDoc,"10");
  78. Send_ToeTEC(signDoc,"10"); //2020.03.23 담당자 메일발송 추가
  79. }
  80. }
  81. /*} catch (Exception e) {
  82. WAFLogger.error(this.getClass().getName() + " --> doFirstFinishSign() : " + e.getMessage());
  83. WAFLogger.error(e);
  84. }2016.5.18 오류있어도 계약서 생성. 오라클SEQ공번호가 너무 많이 발생함. */
  85. System.out.println("### 결재 End");
  86. }
  87. /*
  88. * (non-Javadoc)
  89. * @see kr.co.udap.ehr.common.sign.SignInterface#doFinishSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  90. */
  91. public void doFinishSign(Connection connection, ValueObject signDoc) throws Exception {
  92. System.out.println("!!doFinishSign");
  93. }
  94. /*
  95. * (non-Javadoc)
  96. * @see kr.co.udap.ehr.common.sign.SignInterface#doRejectSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  97. */
  98. public void doFirstRejectSign(Connection connection, ValueObject signDoc) throws Exception {
  99. System.out.println("!!반려");
  100. update_BidSupp(connection, signDoc , "95");//반려
  101. }
  102. /*
  103. * (non-Javadoc)
  104. * @see kr.co.udap.ehr.common.sign.SignInterface#doRejectSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  105. */
  106. public void doRejectSign(Connection connection, ValueObject signDoc) throws Exception {
  107. System.out.println("!!doRejectSign");
  108. }
  109. /*
  110. * (non-Javadoc)
  111. * @see kr.co.udap.ehr.common.sign.SignInterface#doCancelSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  112. */
  113. public void doCancelSign(Connection connection, ValueObject signDoc) throws Exception {
  114. }
  115. /**
  116. * SP_BID_TO_PURCONT 프로시저 호출
  117. * @param connection
  118. * @param valueObject
  119. * @throws Exception
  120. */
  121. public boolean saveProc(Connection connection, ValueObject vo) throws Exception {
  122. ValueObject rtnVo = new ValueObject();
  123. CallableStatement cs = null;
  124. String pssql = "";
  125. try{
  126. pssql = "{call SP_BID_TO_PURCONT(?,?,?,?,?)}";
  127. cs = connection.prepareCall(pssql);
  128. cs.setString(1, vo.get("KEY_COL1"));
  129. cs.setString(2, vo.get("KEY_COL2"));
  130. cs.setString(3, vo.get("KEY_COL3"));
  131. cs.registerOutParameter(4, java.sql.Types.VARCHAR);
  132. cs.registerOutParameter(5, java.sql.Types.VARCHAR);
  133. cs.execute();
  134. rtnVo.set("OUT_SUCCESS_CD",cs.getString(4));
  135. rtnVo.set("OUT_MESSAGE",cs.getString(5));
  136. System.out.println("CODE : " + cs.getString(4));
  137. System.out.println("MSG : " + cs.getString(5));
  138. if("N".equals(cs.getString(4))){
  139. throw new Exception(cs.getString(5));
  140. }
  141. return true;
  142. }
  143. catch(Exception e) {
  144. WAFLogger.error(this.getClass().getName() + " --> saveProc() : " + e.getMessage());
  145. WAFLogger.error(e);
  146. return false;
  147. }
  148. }
  149. /**
  150. * BID_MASTER 상태값 업데이트.
  151. * @param connection
  152. * @param valueObject
  153. * @throws Exception
  154. */
  155. public boolean update_BidSupp(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_SUPP \n");
  160. sqlstr.append(" SET BID_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. sqlstr.append(" AND VENDOR_CD = ? \n");
  166. persistent.setStatement(sqlstr.toString());
  167. persistent.addParameter(status);
  168. //persistent.addParameter(valueObject.get("KEY_COL3"));
  169. persistent.addParameter(valueObject.get("KEY_COL1"));
  170. persistent.addParameter(valueObject.get("KEY_COL2"));
  171. persistent.addParameter(valueObject.get("KEY_COL3"));
  172. persistent.execute();
  173. return true;
  174. }
  175. catch(Exception e) {
  176. WAFLogger.error(this.getClass().getName() + " --> update_BidMaster() : " + e.getMessage());
  177. WAFLogger.error("SQL : " + sqlstr);
  178. WAFLogger.error(e);
  179. System.out.println("Exception : " + e.getMessage());
  180. return false;
  181. }
  182. }
  183. /**
  184. * BID_MASTER 상태값 업데이트.
  185. * @param connection
  186. * @param valueObject
  187. * @throws Exception
  188. */
  189. public boolean update_BidMaster(Connection connection, ValueObject valueObject , String status) throws Exception {
  190. Persistent persistent = new PersistentImpl(connection);
  191. StrBuffer sqlstr = new StrBuffer();
  192. try {
  193. sqlstr.append(" UPDATE BID_MASTER \n");
  194. sqlstr.append(" SET STATUS_CD = ? \n");
  195. //sqlstr.append(" ,UPD_BY = ? \n");
  196. //sqlstr.append(" ,UPD_DATE = SYSDATE \n");
  197. sqlstr.append(" WHERE BID_NO = ? \n");
  198. sqlstr.append(" AND BID_DEG = ? \n");
  199. persistent.setStatement(sqlstr.toString());
  200. persistent.addParameter(status);
  201. //persistent.addParameter(valueObject.get("KEY_COL3"));
  202. persistent.addParameter(valueObject.get("KEY_COL1"));
  203. persistent.addParameter(valueObject.get("KEY_COL2"));
  204. persistent.execute();
  205. return true;
  206. }
  207. catch(Exception e) {
  208. WAFLogger.error(this.getClass().getName() + " --> update_BidMaster() : " + e.getMessage());
  209. WAFLogger.error("SQL : " + sqlstr);
  210. WAFLogger.error(e);
  211. System.out.println("Exception : " + e.getMessage());
  212. return false;
  213. }
  214. }
  215. public void Send(ValueObject params, String event) throws Exception {
  216. HandlerStorage Stroage = new HandlerStorage();
  217. MessageSend messageSend = new MessageSend(Stroage);
  218. RowSet SuppInfo = bid_supp_info(params);
  219. ValueObject bid_Master = bid_Master_info(params);
  220. for(int i=0;i < SuppInfo.size();i++){
  221. Row row = SuppInfo.getRow(i);
  222. if(!row.get("CHARGE_EMAIL").isEmpty()){
  223. boolean email = false;
  224. String CURRENCY_GB = "";
  225. StringBuffer mailtitle = new StringBuffer();
  226. StringBuffer mailtitlein = new StringBuffer();
  227. StringBuffer mailContent = new StringBuffer();
  228. if(!row.get("CURRENCY_GB").isEmpty())
  229. CURRENCY_GB = " ("+row.get("CURRENCY_GB")+")";
  230. mailtitle.append("* 참여하신 입찰의 낙찰 통보 메일입니다.");
  231. mailtitlein.append("* 참여하신 입찰의 낙찰 통보 메일입니다.");
  232. mailContent.append(row.get("VENDOR_NAME")+"님이 참여하신 다음의 입찰에 낙찰업체로 선정되었음을 알려드립니다.<br>");
  233. mailContent.append("<font style='width:auto; font-size:12px; line-height:18px; padding:5px; text-align:left;'>");
  234. mailContent.append("<br>");
  235. mailContent.append("1.프로젝트 : " + bid_Master.get("DEPT_NM") + "<br>");
  236. mailContent.append("2.공고번호 : " + bid_Master.get("BID_NO") + "<br>");
  237. mailContent.append("3.공고건명 : " + bid_Master.get("BID_MASTER_NM") + "<br>");
  238. // mailContent.append("4.낙찰금액 : " + row.get("TOT_AMT") + CURRENCY_GB + "<br>" ); //2022.02.15 구매팀 요청
  239. mailContent.append("4.입찰담당자 : " +bid_Master.get("BUSEO_NM")+" / "+ bid_Master.get("USER_NAME") +" (연락처 : " + bid_Master.get("PO_EMPNM") + ", 이메일 : " + bid_Master.get("E_MAIL") +")<br>");
  240. mailContent.append("</font>");
  241. email = true;
  242. if(email){
  243. messageSend.sendEmail(row.get("CHARGE_EMAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent);
  244. }
  245. }
  246. if(!row.get("CHAGE_HP").isEmpty()){
  247. String smsContent = WAFMessages.getMessage("Bidder.Selection.Guide");
  248. String from_phon_no = bid_Master.get("PO_EMPNM").replace("-", "");
  249. String to_phon_no = row.get("CHAGE_HP").replace("-", "");
  250. if(!smsContent.isEmpty()){
  251. messageSend.sendSMS(to_phon_no,from_phon_no, bid_Master.get("ACCT_ID"), smsContent); //2015.9.21 낙찰통보메일. 입찰담당자번호.
  252. }
  253. }
  254. }
  255. }
  256. /**
  257. * 견적 대상 업체 를 검색하여 리턴
  258. * @param Params
  259. * @return
  260. */
  261. public RowSet bid_supp_info(ValueObject param) {
  262. Search search = new SearchImpl();
  263. RowSet rowSet = new RowSetImpl();
  264. // String sqlstr = "";
  265. StrBuffer sqlstr = new StrBuffer();
  266. try{
  267. sqlstr.append(" SELECT A.CHARGE_NAME \n");
  268. sqlstr.append(" ,A.CHARGE_EMAIL \n");
  269. sqlstr.append(" ,A.CHAGE_HP \n");
  270. sqlstr.append(" ,A.VENDOR_NAME \n");
  271. sqlstr.append(" ,NVL(C.CURRENCY_GB,B.CURRENCY_GB) AS CURRENCY_GB \n");
  272. //2020.01.07 낙찰통보메일에서 분할낙찰인 경우 실제 선정금액으로 낙찰금액 발송되도록 수정(송영주 과장)
  273. //sqlstr.append(" ,DECODE(A.ESTI_TOT_AMT,-1,'단가계약',F_GET_D_CURRENCY(A.ESTI_TOT_AMT,F_GET_CURRENCY_DIGIT(NVL(C.CURRENCY_GB,B.CURRENCY_GB)))) AS TOT_AMT \n");
  274. sqlstr.append(" ,DECODE(A.ESTI_TOT_AMT,-1,'단가계약',F_GET_D_CURRENCY(DECODE(DIV_CONT_YN,'Y',A.SELECT_TOT_AMT,A.ESTI_TOT_AMT),F_GET_CURRENCY_DIGIT(NVL(C.CURRENCY_GB,B.CURRENCY_GB)))) AS TOT_AMT \n");
  275. sqlstr.append(" FROM BID_SUPP A,BID_MASTER B,BID_PUR_CONDI C \n");
  276. sqlstr.append(" WHERE A.BID_NO = ? \n");
  277. sqlstr.append(" AND A.BID_DEG = ? \n");
  278. sqlstr.append(" AND A.BID_NO = B.BID_NO \n");
  279. sqlstr.append(" AND A.BID_DEG = B.BID_DEG \n");
  280. sqlstr.append(" AND A.BID_NO = C.BID_NO \n");
  281. sqlstr.append(" AND A.BID_DEG = C.BID_DEG \n");
  282. sqlstr.append(" AND A.VENDOR_CD = C.VENDOR_CD \n");
  283. sqlstr.append(" AND A.SUCC_YN = 'Y' \n");
  284. sqlstr.append(" AND A.VENDOR_CD = ? \n"); //2017.10.31 추가
  285. search.setStatement(sqlstr.toString());
  286. search.addParameter(param.get("KEY_COL1"));
  287. search.addParameter(param.get("KEY_COL2"));
  288. search.addParameter(param.get("KEY_COL3"));
  289. search.setStatement(sqlstr.toString());
  290. rowSet = search.execute();
  291. }
  292. catch (WAFSQLException se) {
  293. Logger.err.println("SQL : \n" + se.getStatement());
  294. Logger.err.println("PARAM : \n" + se.getParameter());
  295. }
  296. finally {
  297. if(rowSet == null){
  298. rowSet = new RowSetImpl();
  299. }
  300. }
  301. System.out.println("### rowSet size : " + rowSet.size());
  302. return rowSet;
  303. }
  304. /**
  305. * 발주의뢰(외주) 접수를 검색하여 리턴
  306. * @param Params
  307. * @return
  308. */
  309. public ValueObject bid_Master_info(ValueObject param) {
  310. Search search = new SearchImpl();
  311. ValueObject valueobject = null;
  312. RowSet rowSet = new RowSetImpl();
  313. StrBuffer sqlstr = new StrBuffer();
  314. try{
  315. sqlstr.append(" SELECT A.BID_NO, \n");
  316. sqlstr.append(" TO_CHAR(A.BID_TO_DT,'YYYY-MM-DD HH24:MI') AS BID_TO_DT_NM, \n");
  317. sqlstr.append(" A.PO_EMPNM, \n");
  318. sqlstr.append(" A.DEPT_CD, \n");
  319. sqlstr.append(" A.DEPT_NM, \n");
  320. sqlstr.append(" A.BID_MASTER_NM, \n");
  321. sqlstr.append(" B.USER_NAME, \n");
  322. sqlstr.append(" B.E_MAIL, \n");
  323. sqlstr.append(" B.ACCT_ID, \n");
  324. sqlstr.append(" A.DEMANDED_NO, \n");
  325. sqlstr.append(" A.DEMANDED_TITLE, \n");
  326. sqlstr.append(" C.E_MAIL EMP_MAIL, \n");
  327. sqlstr.append(" SITEDESCEMAIL, \n");
  328. sqlstr.append(" TO_CHAR(TO_DATE(A.DELI_FROM_DY),'YYYY-MM-DD') AS WORK_FROM_DT, \n");
  329. sqlstr.append(" TO_CHAR(TO_DATE(A.DELI_TO_DY),'YYYY-MM-DD') AS WORK_END_DT, \n");
  330. sqlstr.append(" (SELECT ACC_DEPT_NM FROM PUB0120T WHERE USER_SABUN = B.USER_SABUN) AS BUSEO_NM \n");
  331. sqlstr.append(" FROM BID_MASTER A, PUB0120T B, PUB0120T C \n");
  332. sqlstr.append(" WHERE A.PUREMPNO = B.ACCT_ID \n");
  333. sqlstr.append(" AND A.EMP_NO = C.ACCT_ID \n");
  334. sqlstr.append(" AND A.BID_NO = ? \n");
  335. sqlstr.append(" AND A.BID_DEG = ? \n");
  336. search.setStatement(sqlstr.toString());
  337. search.addParameter(param.get("KEY_COL1"));
  338. search.addParameter(param.get("KEY_COL2"));
  339. search.setStatement(sqlstr.toString());
  340. rowSet = search.execute();
  341. if( rowSet != null && rowSet.size() > 0 ){
  342. valueobject = RowSetUtility.getValueObject(rowSet.getRow(0));
  343. }
  344. }
  345. catch (WAFSQLException se) {
  346. Logger.err.println("SQL : \n" + se.getStatement());
  347. Logger.err.println("PARAM : \n" + se.getParameter());
  348. }
  349. return valueobject;
  350. }
  351. /**
  352. * STATUS_CD 상태값을 업데이트해준다.
  353. * @param connection
  354. * @param valueObject
  355. * @throws Exception
  356. */
  357. public boolean UPDATE_EBID_STATUS(Connection connection, ValueObject vo, ValueObject BidMaster) throws Exception {
  358. Persistent persistent = new PersistentImpl(connection);
  359. StringBuffer sqlstr = null;
  360. try {
  361. if("B".equals(BidMaster.get("DEMANDED_KIND"))){
  362. sqlstr = new StringBuffer();
  363. sqlstr.append(" UPDATE ETECEPC.MR_REQ_PO \n");
  364. sqlstr.append(" SET EBID_STATUS = '05' --입찰 \n");
  365. //sqlstr.append(" --, REQ_STATUS = '5' --결재 \n");
  366. sqlstr.append(" WHERE BUYREQNO = (SELECT DEMANDED_ID FROM BID_MASTER WHERE BID_NO = ? AND BID_DEG = ?) \n");
  367. persistent.setStatement(sqlstr.toString());
  368. persistent.addParameter(vo.get("KEY_COL1"));
  369. persistent.addParameter(vo.get("KEY_COL2"));
  370. persistent.execute();
  371. }
  372. }
  373. catch(Exception e) {
  374. WAFLogger.error(this.getClass().getName() + " --> updateSac01001() : " + e.getMessage());
  375. WAFLogger.error("SQL : " + sqlstr);
  376. WAFLogger.error(e);
  377. return false;
  378. }
  379. return true;
  380. }
  381. private ValueObject getDemanded_kind(Connection connection, ValueObject vo) throws Exception{
  382. Persistent persistent = new PersistentImpl(connection);
  383. RowSet rowSet = new RowSetImpl();
  384. ValueObject valueobject = null;
  385. StringBuffer sqlstr = new StringBuffer();
  386. try {
  387. sqlstr.append(" SELECT DEMANDED_KIND,STATUS_CD,ONBID_YN \n");
  388. sqlstr.append(" FROM BID_MASTER \n");
  389. sqlstr.append(" WHERE BID_NO = ? \n");
  390. sqlstr.append(" AND BID_DEG = ? \n");
  391. persistent.setStatement(sqlstr.toString());
  392. persistent.addParameter(vo.get("KEY_COL1"));
  393. persistent.addParameter(vo.get("KEY_COL2"));
  394. rowSet = persistent.query();
  395. if (rowSet.size() > 0) {
  396. valueobject = RowSetUtility.getValueObject(persistent.query().getRow(0));
  397. }
  398. }
  399. catch(WAFSQLException se) {
  400. Logger.err.println("SQL : \n" + se.getStatement());
  401. Logger.err.println("PARAM : \n" + se.getParameter());
  402. throw se;
  403. }
  404. finally {
  405. if (valueobject == null)
  406. valueobject = new ValueObject();
  407. return valueobject;
  408. }
  409. }
  410. private ValueObject getBidMaster(Connection connection, ValueObject vo) throws Exception{
  411. Persistent persistent = new PersistentImpl(connection);
  412. RowSet rowSet = new RowSetImpl();
  413. ValueObject valueobject = null;
  414. StringBuffer sqlstr = new StringBuffer();
  415. try {
  416. sqlstr.append(" SELECT COUNT(*) AS CNT \n");
  417. sqlstr.append(" FROM BID_SUPP \n");
  418. sqlstr.append(" WHERE BID_NO = ? \n");
  419. sqlstr.append(" AND BID_DEG = ? \n");
  420. sqlstr.append(" AND BID_STATUS_CD != '10' \n");
  421. sqlstr.append(" AND SUCC_YN = 'Y' \n");
  422. persistent.setStatement(sqlstr.toString());
  423. persistent.addParameter(vo.get("KEY_COL1"));
  424. persistent.addParameter(vo.get("KEY_COL2"));
  425. rowSet = persistent.query();
  426. if (rowSet.size() > 0) {
  427. valueobject = RowSetUtility.getValueObject(persistent.query().getRow(0));
  428. }
  429. }
  430. catch(WAFSQLException se) {
  431. Logger.err.println("SQL : \n" + se.getStatement());
  432. Logger.err.println("PARAM : \n" + se.getParameter());
  433. throw se;
  434. }
  435. finally {
  436. if (valueobject == null)
  437. valueobject = new ValueObject();
  438. return valueobject;
  439. }
  440. }
  441. //2020.03.23 담당자 메일발송 추가
  442. public void Send_ToeTEC(ValueObject params, String event) throws Exception {
  443. HandlerStorage Stroage = new HandlerStorage();
  444. MessageSend messageSend = new MessageSend(Stroage);
  445. ValueObject bid_Master = bid_Master_info(params);
  446. RowSet SuppInfo = bid_supp_info2(params);
  447. RowSet relEmpInfo = relation_emp_info(params);
  448. StringBuffer mailtitle = new StringBuffer();
  449. StringBuffer mailtitlein = new StringBuffer();
  450. StringBuffer mailContent = new StringBuffer();
  451. mailtitle.append("* [알림]시행결의 승인");
  452. mailtitlein.append("* 시행결의 승인");
  453. mailContent.append("아래와 같이 시행결의가 완료되었음을 알려드립니다.<br>");
  454. mailContent.append("<font style='width:auto; font-size:12px; line-height:18px; padding:5px; text-align:left;'>");
  455. mailContent.append("<br>");
  456. mailContent.append("1.프로젝트 명 : " + bid_Master.get("DEPT_NM") + "<br>");
  457. mailContent.append("2.발주번호 : " + bid_Master.get("DEMANDED_NO") + "<br>");
  458. mailContent.append("3.발주명 : " + bid_Master.get("DEMANDED_TITLE") + "<br>");
  459. mailContent.append("4.구매담당자 : " + bid_Master.get("USER_NAME") + "<br>" );
  460. mailContent.append("5.계약기간 : " +bid_Master.get("WORK_FROM_DT")+" ~ "+ bid_Master.get("WORK_END_DT")+ "<br>");
  461. for(int i=0;i < SuppInfo.size();i++){
  462. Row row = SuppInfo.getRow(i);
  463. if(SuppInfo.size()==1){
  464. mailContent.append("6.발주업체 : "+row.get("VENDOR_NAME")+"<br>");
  465. mailContent.append("7.발주금액 : "+row.get("TOT_AMT")+"("+row.get("CURRENCY_GB")+")"+"<br>");
  466. }else{
  467. if(i==0) mailContent.append("6.발주업체정보(발주업체, 발주금액)"+"<br>");
  468. else mailContent.append(" "+i+1+")"+row.get("VENDOR_NAME")+" : "+row.get("TOT_AMT")+"("+row.get("CURRENCY_GB")+")"+"<br>");
  469. }
  470. }
  471. mailContent.append("</font><br>");
  472. //구매담당자
  473. if(!bid_Master.get("E_MAIL").isEmpty()) {
  474. messageSend.sendEmail(bid_Master.get("E_MAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent, "1");
  475. }
  476. //발주의뢰자
  477. if(!bid_Master.get("EMP_MAIL").isEmpty()){//
  478. messageSend.sendEmail(bid_Master.get("EMP_MAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent, "1");
  479. }
  480. //현설담당자
  481. if(!bid_Master.get("SITEDESCEMAIL").isEmpty() && !bid_Master.get("SITEDESCEMAIL").equals(bid_Master.get("EMP_MAIL")) ){
  482. messageSend.sendEmail(bid_Master.get("SITEDESCEMAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent, "1");
  483. }
  484. //유관부서 담당자
  485. if(relEmpInfo.size() > 0){
  486. for(int i=0;i < relEmpInfo.size();i++){
  487. Row row = relEmpInfo.getRow(i);
  488. messageSend.sendEmail(row.get("E_MAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent, "1");
  489. }
  490. }
  491. }
  492. public RowSet bid_supp_info2(ValueObject param) {
  493. Search search = new SearchImpl();
  494. RowSet rowSet = new RowSetImpl();
  495. // String sqlstr = "";
  496. StrBuffer sqlstr = new StrBuffer();
  497. try{
  498. sqlstr.append(" SELECT A.CHARGE_NAME \n");
  499. sqlstr.append(" ,A.CHARGE_EMAIL \n");
  500. sqlstr.append(" ,A.CHAGE_HP \n");
  501. sqlstr.append(" ,A.VENDOR_NAME \n");
  502. sqlstr.append(" ,NVL(C.CURRENCY_GB,B.CURRENCY_GB) AS CURRENCY_GB \n");
  503. sqlstr.append(" ,DECODE(A.ESTI_TOT_AMT,-1,'단가계약',F_GET_D_CURRENCY(DECODE(DIV_CONT_YN,'Y',A.SELECT_TOT_AMT,A.ESTI_TOT_AMT),F_GET_CURRENCY_DIGIT(NVL(C.CURRENCY_GB,B.CURRENCY_GB)))) AS TOT_AMT \n");
  504. sqlstr.append(" FROM BID_SUPP A,BID_MASTER B,BID_PUR_CONDI C \n");
  505. sqlstr.append(" WHERE A.BID_NO = ? \n");
  506. sqlstr.append(" AND A.BID_DEG = ? \n");
  507. sqlstr.append(" AND A.BID_NO = B.BID_NO \n");
  508. sqlstr.append(" AND A.BID_DEG = B.BID_DEG \n");
  509. sqlstr.append(" AND A.BID_NO = C.BID_NO \n");
  510. sqlstr.append(" AND A.BID_DEG = C.BID_DEG \n");
  511. sqlstr.append(" AND A.VENDOR_CD = C.VENDOR_CD \n");
  512. sqlstr.append(" AND A.SUCC_YN = 'Y' \n");
  513. sqlstr.append(" AND A.VENDOR_CD = ? \n");
  514. sqlstr.append(" ORDER BY DECODE (DIV_CONT_YN, 'Y', A.SELECT_TOT_AMT, A.ESTI_TOT_AMT), A.VENDOR_NAME \n");
  515. search.setStatement(sqlstr.toString());
  516. search.addParameter(param.get("KEY_COL1"));
  517. search.addParameter(param.get("KEY_COL2"));
  518. search.addParameter(param.get("KEY_COL3"));
  519. search.setStatement(sqlstr.toString());
  520. rowSet = search.execute();
  521. }
  522. catch (WAFSQLException se) {
  523. Logger.err.println("SQL : \n" + se.getStatement());
  524. Logger.err.println("PARAM : \n" + se.getParameter());
  525. }
  526. finally {
  527. if(rowSet == null){
  528. rowSet = new RowSetImpl();
  529. }
  530. }
  531. System.out.println("### rowSet size : " + rowSet.size());
  532. return rowSet;
  533. }
  534. public RowSet relation_emp_info(ValueObject param) {
  535. Search search = new SearchImpl();
  536. RowSet rowSet = new RowSetImpl();
  537. // String sqlstr = "";
  538. StrBuffer sqlstr = new StrBuffer();
  539. try{
  540. sqlstr.append(" SELECT A.EMP_ID \n");
  541. sqlstr.append(" , B.E_MAIL \n");
  542. sqlstr.append(" FROM BID_DECIDE_MAIL_LIST A, PUB0120T B \n");
  543. sqlstr.append(" WHERE A.EMP_ID = B.ACCT_ID \n");
  544. sqlstr.append(" AND A.BID_NO = ? \n");
  545. sqlstr.append(" AND A.BID_DEG = ? \n");
  546. search.setStatement(sqlstr.toString());
  547. search.addParameter(param.get("KEY_COL1"));
  548. search.addParameter(param.get("KEY_COL2"));
  549. search.setStatement(sqlstr.toString());
  550. rowSet = search.execute();
  551. }
  552. catch (WAFSQLException se) {
  553. Logger.err.println("SQL : \n" + se.getStatement());
  554. Logger.err.println("PARAM : \n" + se.getParameter());
  555. }
  556. finally {
  557. if(rowSet == null){
  558. rowSet = new RowSetImpl();
  559. }
  560. }
  561. System.out.println("### rowSet size : " + rowSet.size());
  562. return rowSet;
  563. }
  564. }