PBidPlanSignDriver.java 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. /**
  2. * @(#)file BidPlanSignDriver.java
  3. * @(#)author Son hyungmin
  4. * @(#)version 1.0
  5. * @(#)date 2014-09-29
  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.Connection;
  14. import com.udapsoft.waf.system.HandlerStorage;
  15. import kr.co.hsnc.common.base.WAFLogger;
  16. import kr.co.hsnc.common.base.WAFMessages;
  17. import kr.co.hsnc.common.logger.Logger;
  18. import kr.co.hsnc.common.sql.Row;
  19. import kr.co.hsnc.common.sql.RowSet;
  20. import kr.co.hsnc.common.sql.RowSetImpl;
  21. import kr.co.hsnc.common.sql.WAFSQLException;
  22. import kr.co.hsnc.common.sql.persistent.Persistent;
  23. import kr.co.hsnc.common.sql.persistent.PersistentImpl;
  24. import kr.co.hsnc.common.sql.search.Search;
  25. import kr.co.hsnc.common.sql.search.SearchImpl;
  26. import kr.co.hsnc.common.sql.util.RowSetUtility;
  27. import kr.co.hsnc.common.util.ValueObject;
  28. import kr.co.udapsoft.common.commonSign.CommonSignInterface;
  29. import kr.co.udapsoft.common.sender.MessageSend;
  30. import oracle.toplink.internal.ox.StrBuffer;
  31. /**
  32. *
  33. * @version 1.0
  34. * @author Beomgeun Lee
  35. */
  36. public class PBidPlanSignDriver implements CommonSignInterface {
  37. /**
  38. * 테슽 파일
  39. *
  40. */
  41. public PBidPlanSignDriver() {
  42. super();
  43. }
  44. /*
  45. * (non-Javadoc)
  46. * @see kr.co.udap.ehr.common.sign.SignInterface#doCallSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  47. */
  48. public void doCallSign(Connection connection, ValueObject signDoc) throws Exception {
  49. WAFLogger.debug("!!doCallSign");
  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. WAFLogger.debug("!!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. WAFLogger.debug("!!doFirstFinishSign");
  65. ValueObject vo = new ValueObject();
  66. //String SITEDESC_FLAG = getSignSitedesc_flag(connection, signDoc);
  67. vo = getDemanded_kind(connection, signDoc);
  68. //signDoc.set("SITEDESC_FLAG", SITEDESC_FLAG);
  69. if("Y".equals(vo.get("ONBID_YN"))){
  70. String status = "";
  71. if("Y".equals(vo.get("SITEDESC_FLAG"))){
  72. status = "03";//현설의뢰
  73. }else{
  74. status = "04";//견적의뢰
  75. }
  76. success = updateMaster(connection, signDoc , status);
  77. }else{
  78. /*2014-12-08 오프라인 추가*/
  79. success = updateMaster(connection, signDoc , "06");
  80. }
  81. if(!"Y".equals(vo.get("SITEDESC_FLAG"))){
  82. UPDATE_EBID_STATUS(connection, signDoc,vo);
  83. }
  84. if(success){
  85. Send(signDoc,vo.get("SITEDESC_FLAG"));
  86. if("Y".equals(vo.get("ONBID_YN"))){
  87. Send_ToEtec(signDoc,vo.get("SITEDESC_FLAG")); //2020.03.23 담당자 메일발송 추가
  88. }
  89. }
  90. WAFLogger.debug("### 결재 End");
  91. }
  92. /*
  93. * (non-Javadoc)
  94. * @see kr.co.udap.ehr.common.sign.SignInterface#doFinishSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  95. */
  96. public void doFinishSign(Connection connection, ValueObject signDoc) throws Exception {
  97. WAFLogger.debug("!!doFinishSign");
  98. }
  99. /*
  100. * (non-Javadoc)
  101. * @see kr.co.udap.ehr.common.sign.SignInterface#doRejectSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  102. */
  103. public void doFirstRejectSign(Connection connection, ValueObject signDoc) throws Exception {
  104. WAFLogger.debug("!!반려");
  105. updateMasterReject(connection, signDoc);
  106. }
  107. /*
  108. * (non-Javadoc)
  109. * @see kr.co.udap.ehr.common.sign.SignInterface#doRejectSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  110. */
  111. public void doRejectSign(Connection connection, ValueObject signDoc) throws Exception {
  112. WAFLogger.debug("!!doRejectSign");
  113. }
  114. /*
  115. * (non-Javadoc)
  116. * @see kr.co.udap.ehr.common.sign.SignInterface#doCancelSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  117. */
  118. public void doCancelSign(Connection connection, ValueObject signDoc) throws Exception {
  119. WAFLogger.debug("!!doCancelSign");
  120. }
  121. /**
  122. * STATUS_CD 상태값을 업데이트해준다.
  123. * @param connection
  124. * @param valueObject
  125. * @throws Exception
  126. */
  127. public boolean updateMaster(Connection connection, ValueObject vo, String status) throws Exception {
  128. Persistent persistent = new PersistentImpl(connection);
  129. StringBuffer sqlstr = null;
  130. try {
  131. sqlstr = new StringBuffer();
  132. sqlstr.append(" UPDATE BID_MASTER \n");
  133. sqlstr.append(" SET STATUS_CD = ? \n");
  134. if("06".equals(status)){
  135. sqlstr.append(" , OPEN_DT = SYSDATE \n");
  136. }
  137. sqlstr.append(" , BID_APP_DATE = SYSDATE \n");
  138. sqlstr.append(" , BID_APP_NO = ? \n");
  139. sqlstr.append(" WHERE BID_NO = ? \n");
  140. sqlstr.append(" AND BID_DEG = ? \n");
  141. persistent.setStatement(sqlstr.toString());
  142. persistent.addParameter(status);
  143. persistent.addParameter(vo.get("SIGN_INTERFACE_ID"));
  144. persistent.addParameter(vo.get("KEY_COL1"));
  145. persistent.addParameter(vo.get("KEY_COL2"));
  146. persistent.execute();
  147. }
  148. catch(Exception e) {
  149. WAFLogger.error(this.getClass().getName() + " --> updateSac01001() : " + e.getMessage());
  150. WAFLogger.error("SQL : " + sqlstr);
  151. WAFLogger.error(e);
  152. return false;
  153. }
  154. return true;
  155. }
  156. /**
  157. * STATUS_CD 상태값을 업데이트해준다.
  158. * @param connection
  159. * @param valueObject
  160. * @throws Exception
  161. */
  162. public boolean updateMasterReject(Connection connection, ValueObject vo) throws Exception {
  163. Persistent persistent = new PersistentImpl(connection);
  164. StringBuffer sqlstr = null;
  165. try {
  166. sqlstr = new StringBuffer();
  167. sqlstr.append(" UPDATE BID_MASTER \n");
  168. sqlstr.append(" SET STATUS_CD = '94' \n");
  169. sqlstr.append(" WHERE BID_NO = ? \n");
  170. sqlstr.append(" AND BID_DEG = ? \n");
  171. persistent.setStatement(sqlstr.toString());
  172. persistent.addParameter(vo.get("KEY_COL1"));
  173. persistent.addParameter(vo.get("KEY_COL2"));
  174. persistent.execute();
  175. }
  176. catch(Exception e) {
  177. WAFLogger.error(this.getClass().getName() + " --> updateSac01001() : " + e.getMessage());
  178. WAFLogger.error("SQL : " + sqlstr);
  179. WAFLogger.error(e);
  180. return false;
  181. }
  182. return true;
  183. }
  184. /**
  185. * STATUS_CD 상태값을 업데이트해준다.
  186. * @param connection
  187. * @param valueObject
  188. * @throws Exception
  189. */
  190. public boolean UPDATE_EBID_STATUS(Connection connection, ValueObject vo, ValueObject BidMaster) throws Exception {
  191. Persistent persistent = new PersistentImpl(connection);
  192. StringBuffer sqlstr = null;
  193. try {
  194. if("B".equals(BidMaster.get("DEMANDED_KIND"))){
  195. sqlstr = new StringBuffer();
  196. sqlstr.append(" UPDATE ETECEPC.MR_REQ_PO \n");
  197. sqlstr.append(" SET EBID_STATUS = '03' --입찰 \n");
  198. sqlstr.append(" WHERE BUYREQNO = (SELECT DEMANDED_ID FROM BID_MASTER WHERE BID_NO = ? AND BID_DEG = ?) \n");
  199. persistent.setStatement(sqlstr.toString());
  200. persistent.addParameter(vo.get("KEY_COL1"));
  201. persistent.addParameter(vo.get("KEY_COL2"));
  202. persistent.execute();
  203. }else{
  204. /*
  205. * 2018.10.31 이인오 삭제 재확인필요
  206. sqlstr = new StringBuffer();
  207. sqlstr.append(" UPDATE PMM_DEMANDED_REQUEST \n");
  208. sqlstr.append(" SET EBID_STATUS_CD = ? \n");
  209. sqlstr.append(" WHERE DEMANDED_ID = (SELECT DEMANDED_ID FROM BID_MASTER WHERE BID_NO = ? AND BID_DEG = ?) \n");
  210. persistent.setStatement(sqlstr.toString());
  211. persistent.addParameter(BidMaster.get("STATUS_CD"));
  212. persistent.addParameter(vo.get("KEY_COL1"));
  213. persistent.addParameter(vo.get("KEY_COL2"));
  214. persistent.execute();
  215. */
  216. }
  217. }
  218. catch(Exception e) {
  219. WAFLogger.error(this.getClass().getName() + " --> updateSac01001() : " + e.getMessage());
  220. WAFLogger.error("SQL : " + sqlstr);
  221. WAFLogger.error(e);
  222. return false;
  223. }
  224. return true;
  225. }
  226. /**
  227. * 아이템 INSERT
  228. * @param connection
  229. * @param valueObject
  230. * @throws Exception
  231. */
  232. public boolean insert_BidItem(Connection connection, ValueObject valueObject) throws Exception {
  233. Persistent persistent = new PersistentImpl(connection);
  234. StrBuffer sqlstr = new StrBuffer();
  235. try {
  236. sqlstr.append("INSERT INTO BID_ITEM \n");
  237. sqlstr.append(" ( BID_NO \n");
  238. sqlstr.append(" ,BID_DEG \n");
  239. sqlstr.append(" ,MATERIAL_CD \n");
  240. sqlstr.append(" ,DEMANDED_QTY \n");
  241. sqlstr.append(" ,STD ) \n");
  242. sqlstr.append("SELECT ? AS A \n");
  243. sqlstr.append(" , ? AS B \n");
  244. sqlstr.append(" ,MATERIAL_CD \n");
  245. sqlstr.append(" ,1 \n");
  246. sqlstr.append(" ,'식' \n");
  247. sqlstr.append(" FROM BID_OUT_ITEM_MASTER \n");
  248. sqlstr.append(" WHERE DEPTH=4 \n");
  249. persistent.setStatement(sqlstr.toString());
  250. persistent.addParameter(valueObject.get("KEY_COL1"));
  251. persistent.addParameter(valueObject.get("KEY_COL2"));
  252. persistent.execute();
  253. }catch(Exception e) {
  254. WAFLogger.error(this.getClass().getName() + " --> insert_BidItem() : " + e.getMessage());
  255. WAFLogger.error("SQL : " + sqlstr);
  256. WAFLogger.error(e);
  257. WAFLogger.debug("Exception : " + e.getMessage());
  258. return false;
  259. }
  260. return true;
  261. }
  262. private ValueObject getDemanded_kind(Connection connection, ValueObject vo) throws Exception{
  263. Search search = new SearchImpl();
  264. RowSet rowSet = new RowSetImpl();
  265. ValueObject valueobject = null;
  266. StringBuffer sqlstr = new StringBuffer();
  267. try {
  268. sqlstr.append(" SELECT DEMANDED_KIND,STATUS_CD,ONBID_YN,SITEDESC_FLAG \n");
  269. sqlstr.append(" FROM BID_MASTER \n");
  270. sqlstr.append(" WHERE BID_NO = ? \n");
  271. sqlstr.append(" AND BID_DEG = ? \n");
  272. search.setStatement(sqlstr.toString());
  273. search.addParameter(vo.get("KEY_COL1"));
  274. search.addParameter(vo.get("KEY_COL2"));
  275. rowSet = search.execute();
  276. if (rowSet.size() > 0) {
  277. valueobject = RowSetUtility.getValueObject(search.execute().getRow(0));
  278. }
  279. }
  280. catch(WAFSQLException se) {
  281. Logger.err.println("SQL : \n" + se.getStatement());
  282. Logger.err.println("PARAM : \n" + se.getParameter());
  283. throw se;
  284. }
  285. finally {
  286. if (valueobject == null)
  287. valueobject = new ValueObject();
  288. return valueobject;
  289. }
  290. }
  291. private String getSignSitedesc_flag(Connection connection, ValueObject vo) throws Exception{
  292. Search search = new SearchImpl();
  293. RowSet rowSet = new RowSetImpl();
  294. String SITEDESC_FLAG = "";
  295. StringBuffer sqlstr = new StringBuffer();
  296. try {
  297. sqlstr.append(" SELECT SITEDESC_FLAG \n");
  298. sqlstr.append(" FROM BID_MASTER \n");
  299. sqlstr.append(" WHERE BID_NO = ? \n");
  300. sqlstr.append(" AND BID_DEG = ? \n");
  301. search.setStatement(sqlstr.toString());
  302. search.addParameter(vo.get("KEY_COL1"));
  303. search.addParameter(vo.get("KEY_COL2"));
  304. rowSet = search.execute();
  305. if (rowSet.size() > 0) {
  306. SITEDESC_FLAG = RowSetUtility.getValueObject(search.execute().getRow(0)).get("SITEDESC_FLAG");
  307. }
  308. }
  309. catch(WAFSQLException se) {
  310. Logger.err.println("SQL : \n" + se.getStatement());
  311. Logger.err.println("PARAM : \n" + se.getParameter());
  312. throw se;
  313. }
  314. finally {
  315. if (SITEDESC_FLAG == null)
  316. SITEDESC_FLAG = "";
  317. return SITEDESC_FLAG;
  318. }
  319. }
  320. public void Send(ValueObject params, String event) throws Exception {
  321. HandlerStorage Stroage = new HandlerStorage();
  322. MessageSend messageSend = new MessageSend(Stroage);
  323. if("Y".equals(event)){
  324. event = "03";
  325. }else{
  326. event = "04";//견적의뢰
  327. }
  328. RowSet SuppInfo = bid_supp_info(params);
  329. ValueObject bid_Master = bid_Master_info(params);
  330. for(int i=0;i < SuppInfo.size();i++){
  331. Row row = SuppInfo.getRow(i);
  332. if(!row.get("CHARGE_EMAIL").isEmpty()){
  333. if("Y".equals(bid_Master.get("ONBID_YN"))){
  334. boolean email = false;
  335. StringBuffer mailtitle = new StringBuffer();
  336. StringBuffer mailtitlein = new StringBuffer();
  337. StringBuffer mailContent = new StringBuffer();
  338. if("04".equals(event)){//견적의뢰
  339. mailtitle.append("* 입찰서 제출요청에 대한 공지 메일입니다.");
  340. mailtitlein.append("* 입찰서 제출요청에 대한 공지 메일입니다.");
  341. mailContent.append(row.get("VENDOR_NAME")+"님께 아래와 같은 내용으로 입찰서 제출을 요청드립니다.<br>협력업체포탈시스에 접속하시어 입찰서 작성 및 제출바랍니다.<br>입찰서 제출시 법인공인증서가 필요합니다.<br>");
  342. mailContent.append("<font style='width:auto; font-size:12px; line-height:18px; padding:5px; text-align:left;'>");
  343. mailContent.append("<br>");
  344. mailContent.append("1.프로젝트 : " + bid_Master.get("DEPT_NM") + "<br>");
  345. mailContent.append("2.공고번호 : " + bid_Master.get("BID_NO") + "<br>");
  346. mailContent.append("3.공고건명 : " + bid_Master.get("BID_MASTER_NM") + "<br>");
  347. mailContent.append("4.견적마감일시 : " + bid_Master.get("BID_TO_DT_NM") + "<br>");
  348. mailContent.append("5.입찰담당자 : " +bid_Master.get("BUSEO_NM")+" / "+ bid_Master.get("USER_NAME") +" (연락처 : " + bid_Master.get("PO_EMPNM") + ", 이메일 : " + bid_Master.get("E_MAIL") +")<br>");
  349. mailContent.append("</font>");
  350. email = true;
  351. }else if("03".equals(event)){//현설의뢰
  352. mailtitle.append("* 현장설명회에 대한 공지 메일입니다.");
  353. mailtitlein.append("* 현장설명회에 대한 공지 메일입니다.");
  354. mailContent.append(row.get("VENDOR_NAME")+"님께 아래와 같은 내용으로 현장설명회 참석을 요청드립니다.<br>협력업체포탈시스템에 접속하시어 현장설명회 내용 확인 후 참석의사를 입력해 주시기바랍니다.<br>");
  355. mailContent.append("<font style='width:auto; font-size:12px; line-height:18px; padding:5px; text-align:left;'>");
  356. mailContent.append("<br>");
  357. mailContent.append("1.프로젝트 : " + bid_Master.get("DEPT_NM") + "<br>");
  358. mailContent.append("2.공고번호 : " + bid_Master.get("BID_NO") + "<br>");
  359. mailContent.append("3.공고건명 : " + bid_Master.get("BID_MASTER_NM") + "<br>");
  360. mailContent.append("4.현설일시 : " + bid_Master.get("SITEDESCDATE_NM") + "<br>");
  361. mailContent.append("5.현설장소 : " + bid_Master.get("SITEDESCPLACE") + "<br>");
  362. mailContent.append("6.현설담당자 : " +bid_Master.get("SITEDESC_BUSEO_NM")+" / "+ bid_Master.get("SITEDESC_CRG_NM") +" (연락처 : " + bid_Master.get("SITEDESCTELNO") + ", 이메일 : " + bid_Master.get("SITEDESCEMAIL") +")<br>");
  363. mailContent.append("7.입찰담당자 : " +bid_Master.get("BUSEO_NM")+" / "+ bid_Master.get("USER_NAME") +" (연락처 : " + bid_Master.get("PO_EMPNM") + ", 이메일 : " + bid_Master.get("E_MAIL") +")<br>");
  364. mailContent.append("</font>");
  365. email = true;
  366. }
  367. if(email){
  368. messageSend.sendEmail(row.get("CHARGE_EMAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent);
  369. }
  370. }
  371. }
  372. if(!row.get("CHAGE_HP").isEmpty()){
  373. String smsContent = "";
  374. if("Y".equals(bid_Master.get("ONBID_YN"))){
  375. if("04".equals(event)){//견적의뢰
  376. smsContent = WAFMessages.getMessage("Submit.Estimate.request");
  377. }else if("03".equals(event)){//현설의뢰
  378. smsContent = WAFMessages.getMessage("Description.Announcements.site");
  379. }
  380. }else{
  381. if("Y".equals(bid_Master.get("SITEDESC_FLAG"))){
  382. /*2014-12-08 추가
  383. * 오프라인 현설의뢰 SMS 발송*/
  384. smsContent = "";
  385. }
  386. }
  387. String from_phon_no = bid_Master.get("PO_EMPNM").replace("-", "");
  388. String to_phon_no = row.get("CHAGE_HP").replace("-", ""); //받는사람 row.get("CHAGE_HP").replace("-", "");
  389. if(!smsContent.isEmpty()){
  390. messageSend.sendSMS(to_phon_no,from_phon_no, bid_Master.get("PUREMPNO"), smsContent); //2015.9.21 입찰담당자 번호.
  391. }
  392. }
  393. }
  394. //2020.03.23 담당자 메일발송 추가로 아래 주석
  395. //Send_to_etec(SuppInfo, bid_Master, event); //현설담당자 메일발송
  396. }
  397. /**
  398. * 견적 대상 업체 를 검색하여 리턴
  399. * @param Params
  400. * @return
  401. */
  402. public RowSet bid_supp_info(ValueObject param) {
  403. Search search = new SearchImpl();
  404. RowSet rowSet = new RowSetImpl();
  405. // String sqlstr = "";
  406. StrBuffer sqlstr = new StrBuffer();
  407. try{
  408. sqlstr.append(" SELECT A.CHARGE_NAME,A.CHARGE_EMAIL,A.CHAGE_HP,A.VENDOR_NAME, B.CORP_TEL \n");
  409. sqlstr.append(" FROM BID_SUPP A, SUPP_INFO B \n");
  410. sqlstr.append(" WHERE A.VENDOR_CD = B.CORP_ID AND A.BID_NO = ? \n");
  411. sqlstr.append(" AND A.BID_DEG = ? \n");
  412. search.setStatement(sqlstr.toString());
  413. search.addParameter(param.get("KEY_COL1"));
  414. search.addParameter(param.get("KEY_COL2"));
  415. search.setStatement(sqlstr.toString());
  416. rowSet = search.execute();
  417. }
  418. catch (WAFSQLException se) {
  419. Logger.err.println("SQL : \n" + se.getStatement());
  420. Logger.err.println("PARAM : \n" + se.getParameter());
  421. }
  422. finally {
  423. if(rowSet == null){
  424. rowSet = new RowSetImpl();
  425. }
  426. }
  427. WAFLogger.debug("### rowSet size : " + rowSet.size());
  428. return rowSet;
  429. }
  430. /**
  431. * 발주의뢰(외주) 접수를 검색하여 리턴
  432. * @param Params
  433. * @return
  434. */
  435. public ValueObject bid_Master_info(ValueObject param) {
  436. Search search = new SearchImpl();
  437. ValueObject valueobject = null;
  438. RowSet rowSet = new RowSetImpl();
  439. StrBuffer sqlstr = new StrBuffer();
  440. try{
  441. sqlstr.append(" SELECT A.BID_NO, \n");
  442. sqlstr.append(" A.BID_DEG, \n");
  443. sqlstr.append(" A.DEMANDED_ID, \n");
  444. sqlstr.append(" A.DEMANDED_NO, \n");
  445. sqlstr.append(" A.DEPT_CD, \n");
  446. sqlstr.append(" A.DEPT_NM, \n");
  447. sqlstr.append(" A.DEMANDED_TITLE, \n");
  448. sqlstr.append(" A.DEMANDED_KIND, \n");
  449. sqlstr.append(" A.DEMANDED_DATE, \n");
  450. sqlstr.append(" A.REQUEST_DATE, \n");
  451. sqlstr.append(" A.REQ_DEPT_CD, \n");
  452. sqlstr.append(" A.REQ_DEPT_NM, \n");
  453. sqlstr.append(" A.EMP_NO, \n");
  454. sqlstr.append(" A.EMP_NM, \n");
  455. sqlstr.append(" A.PAY_ITEM, \n");
  456. sqlstr.append(" A.COST_CODE, \n");
  457. sqlstr.append(" A.COST_TYPE, \n");
  458. sqlstr.append(" A.CONT_AMT, \n");
  459. sqlstr.append(" A.ACT_AMT, \n");
  460. sqlstr.append(" A.ACT_RATE, \n");
  461. sqlstr.append(" A.RECEIPT_DATE, \n");
  462. sqlstr.append(" A.ONBID_YN, \n");
  463. sqlstr.append(" A.CMPT_CD, \n");
  464. sqlstr.append(" A.SUCC_CD, \n");
  465. sqlstr.append(" A.NOTI_DY, \n");
  466. sqlstr.append(" A.SITEDESC_FLAG, \n");
  467. sqlstr.append(" A.SITEDESCCHRGPRSNID, \n");
  468. sqlstr.append(" NVL(A.SITEDESC_CRG_NM,(SELECT USER_NAME FROM PUB0120T WHERE ACCT_ID = A.SITEDESCCHRGPRSNID)) AS SITEDESC_CRG_NM, \n");
  469. sqlstr.append(" A.SITEDESCTELNO, \n");
  470. sqlstr.append(" A.SITEDESCEMAIL, \n");
  471. sqlstr.append(" A.SITEDESCDATE, \n");
  472. sqlstr.append(" TO_CHAR(A.SITEDESCDATE,'YYYY-MM-DD HH24:MI') AS SITEDESCDATE_NM, \n");
  473. sqlstr.append(" A.SITEDESCPLACE, \n");
  474. sqlstr.append(" A.BID_FROM_DT, \n");
  475. sqlstr.append(" A.BID_TO_DT, \n");
  476. sqlstr.append(" TO_CHAR(A.BID_TO_DT,'YYYY-MM-DD HH24:MI') AS BID_TO_DT_NM, \n");
  477. sqlstr.append(" A.PUREMPNO, \n");
  478. sqlstr.append(" A.PO_EMPNM, \n");
  479. sqlstr.append(" A.OPEN_EMPNM, \n");
  480. sqlstr.append(" A.OPEN_EMPID, \n");
  481. sqlstr.append(" A.OPEN_DT, \n");
  482. sqlstr.append(" A.TBE_FLAG, \n");
  483. sqlstr.append(" A.DELIVERY_CONDITION, \n");
  484. sqlstr.append(" A.DELIVERY_PLACE, \n");
  485. sqlstr.append(" A.INNER_REMARKS, \n");
  486. sqlstr.append(" A.OUTER_REMARKS, \n");
  487. sqlstr.append(" A.ATT_ID, \n");
  488. sqlstr.append(" A.BID_APP_DATE, \n");
  489. sqlstr.append(" A.BID_APP_NO, \n");
  490. sqlstr.append(" A.CONT_APP_DATE, \n");
  491. sqlstr.append(" A.CONT_APP_NO, \n");
  492. sqlstr.append(" A.DOC_ETC_IN, \n");
  493. sqlstr.append(" A.DOC_ETC_OUT, \n");
  494. sqlstr.append(" A.BID_MASTER_NM, \n");
  495. sqlstr.append(" A.POSTPONE_REASON, \n");
  496. sqlstr.append(" A.CANCEL_REASON, \n");
  497. sqlstr.append(" A.MODIFY_REASON, \n");
  498. sqlstr.append(" A.FIB_REASON, \n");
  499. sqlstr.append(" A.OUT_ITEM_CD, \n");
  500. sqlstr.append(" A.STATUS_CD, \n");
  501. sqlstr.append(" A.DIV_PO_YN, \n");
  502. sqlstr.append(" A.CURRENCY_GB, \n");
  503. sqlstr.append(" A.CURRENCY_GB_YN, \n");
  504. sqlstr.append(" A.PBC_CBE_TYPE_CD, \n");
  505. sqlstr.append(" A.PBC_INSTALL_YN, \n");
  506. sqlstr.append(" A.PBC_COMMISS_YN, \n");
  507. sqlstr.append(" A.PBC_SPETOOL_YN, \n");
  508. sqlstr.append(" A.PBC_TEST_YN, \n");
  509. sqlstr.append(" A.PBC_DOC_YN, \n");
  510. sqlstr.append(" A.PBC_PACK_YN, \n");
  511. sqlstr.append(" A.PBC_LANDTRAN_YN, \n");
  512. sqlstr.append(" A.DELIVERY_CONDITION_YN, \n");
  513. sqlstr.append(" A.PBC_FEE_YN, \n");
  514. sqlstr.append(" A.PBC_OPTION_COMMENT, \n");
  515. sqlstr.append(" A.PBC_OPTION_YN, \n");
  516. sqlstr.append(" A.CBC_DAMAGE_RATE, \n");
  517. sqlstr.append(" A.CBC_DAMAGE_MAXRATE, \n");
  518. sqlstr.append(" A.CBC_FIRST_RATE, \n");
  519. sqlstr.append(" A.PBC_FIRST_CONDI, \n");
  520. sqlstr.append(" A.CPC_MID_RATE, \n");
  521. sqlstr.append(" A.PBC_MID_CONDI, \n");
  522. sqlstr.append(" A.PBC_REST_RATE, \n");
  523. sqlstr.append(" A.PBC_REST_CONDI, \n");
  524. sqlstr.append(" A.PBC_FRSTGUAR_RATE, \n");
  525. sqlstr.append(" A.PBC_FRSTGUAR_CONDI, \n");
  526. sqlstr.append(" A.CONTFUL_RATE, \n");
  527. sqlstr.append(" A.CONTFUL_CONDI, \n");
  528. sqlstr.append(" A.WARR_RATE, \n");
  529. sqlstr.append(" A.WARR_CONDI, \n");
  530. sqlstr.append(" A.PBC_DEFECT_CONDI, \n");
  531. sqlstr.append(" A.CBC_DEFECT_DAY, \n");
  532. sqlstr.append(" A.CBC_DERECT_TERM_CD, \n");
  533. sqlstr.append(" A.DELI_FROM_DY, \n");
  534. sqlstr.append(" A.DELI_TO_DY, \n");
  535. sqlstr.append(" A.OBC_CONT_TYPE_CD, \n");
  536. sqlstr.append(" A.OBC_FRST_CASH_RATE, \n");
  537. sqlstr.append(" A.OBC_MID_CASH_RATE, \n");
  538. sqlstr.append(" A.OBC_MID_BILL_RATE, \n");
  539. sqlstr.append(" A.OBC_FIN_CASH_RATE, \n");
  540. sqlstr.append(" A.OBC_FIN_BILL_RATE, \n");
  541. sqlstr.append(" A.OBC_FRST_CONDI, \n");
  542. sqlstr.append(" A.OBC_MID_PAYDAY, \n");
  543. sqlstr.append(" A.OBC_FIN_PAYDAY, \n");
  544. sqlstr.append(" A.OBC_FRST_CNT_CONDI, \n");
  545. sqlstr.append(" A.OBC_MID_REQ_MONTH, \n");
  546. sqlstr.append(" A.OBC_MID_CNT, \n");
  547. sqlstr.append(" A.OBC_FIN_CONDI, \n");
  548. sqlstr.append(" A.OBC_EMP_RATE, \n");
  549. sqlstr.append(" A.OBC_EMP_YN, \n");
  550. sqlstr.append(" A.OBC_PENSION_RATE, \n");
  551. sqlstr.append(" A.OBC_PENSION_YN, \n");
  552. sqlstr.append(" A.OBC_HEALTH_RATE, \n");
  553. sqlstr.append(" A.OBC_HEALTH_YN, \n");
  554. sqlstr.append(" A.OBC_ELDER_RATE, \n");
  555. sqlstr.append(" A.OBC_ELDER_YN, \n");
  556. sqlstr.append(" A.OBC_WORK_RATE, \n");
  557. sqlstr.append(" A.OBC_WORK_YN, \n");
  558. sqlstr.append(" A.OBC_RESIGN_RATE, \n");
  559. sqlstr.append(" A.OBC_RESIGN_YN, \n");
  560. sqlstr.append(" A.OBC_SAFE_RATE, \n");
  561. sqlstr.append(" A.OBC_SAFE_YN, \n");
  562. sqlstr.append(" A.OBC_ENV_RATE, \n");
  563. sqlstr.append(" A.OBC_ENV_YN, \n");
  564. sqlstr.append(" A.OBC_SITE_RATE, \n");
  565. sqlstr.append(" A.OBC_SITE_YN, \n");
  566. sqlstr.append(" A.OBC_DUTY_RATE, \n");
  567. sqlstr.append(" A.OBC_DUTY_YN, \n");
  568. sqlstr.append(" A.PAY_DIV, \n");
  569. sqlstr.append(" A.MATERIAL_GB, \n");
  570. sqlstr.append(" A.DELI_START_DT, \n");
  571. sqlstr.append(" A.DELI_END_DT, \n");
  572. sqlstr.append(" A.DELI_END_PLACE, \n");
  573. sqlstr.append(" A.KRW_APPR_YN, \n");
  574. sqlstr.append(" B.USER_NAME, \n");
  575. sqlstr.append(" B.E_MAIL, \n");
  576. sqlstr.append(" D.E_MAIL EMP_MAIL, \n");
  577. sqlstr.append(" DECODE(NVL(A.SITEDESC_FLAG, 'N'), 'N', '미실시', TO_CHAR(A.SITEDESCDATE, 'YYYY-MM-DD HH24:MI') || ' / ' || A.SITEDESCPLACE) BID_INFO, \n");
  578. sqlstr.append(" (SELECT ACC_DEPT_NM FROM PUB0120T WHERE USER_SABUN = B.USER_SABUN) AS BUSEO_NM, \n");
  579. sqlstr.append(" C.EVAL_EMPNM, \n");
  580. sqlstr.append(" C.EVAL_TEL, \n");
  581. sqlstr.append(" (SELECT ACC_DEPT_NM FROM PUB0120T WHERE USER_SABUN = (SELECT USER_SABUN FROM PUB0120T WHERE ACCT_ID = C.EVAL_EMPID)) AS TBE_BUSEO_NM , \n");
  582. sqlstr.append(" (SELECT ACC_DEPT_NM FROM PUB0120T WHERE USER_SABUN = (SELECT USER_SABUN FROM PUB0120T WHERE ACCT_ID = A.SITEDESCCHRGPRSNID)) AS SITEDESC_BUSEO_NM \n");
  583. sqlstr.append(" FROM BID_MASTER A, PUB0120T B , TBE_INFO C , PUB0120T D \n");
  584. sqlstr.append(" WHERE A.PUREMPNO = B.ACCT_ID \n");
  585. sqlstr.append(" AND A.BID_NO = C.BID_NO(+) \n");
  586. sqlstr.append(" AND A.BID_DEG = C.BID_DEG(+) \n");
  587. sqlstr.append(" AND A.EMP_NO = D.ACCT_ID \n");
  588. sqlstr.append(" AND A.BID_NO = ? \n");
  589. sqlstr.append(" AND A.BID_DEG = ? \n");
  590. search.setStatement(sqlstr.toString());
  591. search.addParameter(param.get("KEY_COL1"));
  592. search.addParameter(param.get("KEY_COL2"));
  593. search.setStatement(sqlstr.toString());
  594. rowSet = search.execute();
  595. if( rowSet != null && rowSet.size() > 0 ){
  596. valueobject = RowSetUtility.getValueObject(rowSet.getRow(0));
  597. }
  598. }
  599. catch (WAFSQLException se) {
  600. Logger.err.println("SQL : \n" + se.getStatement());
  601. Logger.err.println("PARAM : \n" + se.getParameter());
  602. }
  603. return valueobject;
  604. }
  605. //2016.5.26 입찰계획 완료후 현설담당자에게 메일발송 (윤현석과장 요청)
  606. public void Send_to_etec(RowSet SuppInfo, ValueObject bid_Master, String event) throws Exception {
  607. HandlerStorage Stroage = new HandlerStorage();
  608. MessageSend messageSend = new MessageSend(Stroage);
  609. if(!"03".equals(event)){
  610. return ;
  611. } //현설일때만 처리
  612. boolean email = false;
  613. StringBuffer mailtitle = new StringBuffer();
  614. StringBuffer mailtitlein = new StringBuffer();
  615. StringBuffer mailContent = new StringBuffer();
  616. if(!bid_Master.get("SITEDESCEMAIL").isEmpty()){
  617. if("Y".equals(bid_Master.get("ONBID_YN"))){
  618. mailtitle.append("* 현장설명회에 대한 공지 메일입니다.");
  619. mailtitlein.append("* 현장설명회에 대한 공지 메일입니다.");
  620. mailContent.append(" 아래와 같이 현장설명회 일정 및 참석업체 안내 드리오니 업무 참조하시기 바랍니다. <br>");
  621. mailContent.append("<font style='width:auto; font-size:12px; line-height:18px; padding:5px; text-align:left;'>");
  622. mailContent.append("<br>");
  623. mailContent.append("1.프로젝트 : " + bid_Master.get("DEPT_NM") + "<br>");
  624. mailContent.append("2.공고번호 : " + bid_Master.get("BID_NO") + "<br>");
  625. mailContent.append("3.공고건명 : " + bid_Master.get("BID_MASTER_NM") + "<br>");
  626. mailContent.append("4.현설일시 : " + bid_Master.get("SITEDESCDATE_NM") + "<br>");
  627. mailContent.append("5.현설장소 : " + bid_Master.get("SITEDESCPLACE") + "<br>");
  628. mailContent.append("6.입찰참여업체 <br>");
  629. for(int i=0;i < SuppInfo.size();i++){
  630. Row row = SuppInfo.getRow(i);
  631. mailContent.append(" -" + row.get("VENDOR_NAME") + ", " +row.get("CHARGE_NAME") + ", " +row.get("CHAGE_HP") + ", " +row.get("CHARGE_EMAIL") + "<br>");
  632. }
  633. mailContent.append("(상기 업체별 담당자는 실제 참석 인원과 상이할 수 있습니다) <br>");
  634. mailContent.append("7.특기사항 : " + bid_Master.get("OUTER_REMARKS") + "<br>");
  635. mailContent.append("<br>");
  636. mailContent.append("일정 변경 및 기타 공지사항은 참여업체에 관련내용 통지 바랍니다 .<br>");
  637. mailContent.append("</font>");
  638. email = true;
  639. }
  640. }
  641. if(email){
  642. messageSend.sendEmail(bid_Master.get("SITEDESCEMAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent);
  643. }
  644. }
  645. //2020.03.23 담당자 메일발송 추가
  646. public void Send_ToEtec(ValueObject params, String event) throws Exception {
  647. HandlerStorage Stroage = new HandlerStorage();
  648. MessageSend messageSend = new MessageSend(Stroage);
  649. RowSet SuppInfo = bid_supp_info(params);
  650. ValueObject bid_Master = bid_Master_info(params);
  651. StringBuffer mailtitle = new StringBuffer();
  652. StringBuffer mailtitlein = new StringBuffer();
  653. StringBuffer mailContent = new StringBuffer();
  654. mailtitle.append("* [알림]입찰계획 승인");
  655. mailtitlein.append("* [알림]입찰계획 승인");
  656. mailContent.append(" 아래와 같이 현장설명회 일정 및 참석업체 안내 드리오니 업무 참조하시기 바랍니다. <br>");
  657. mailContent.append("<style type='text/css'>");
  658. mailContent.append("td {font-size:12px;}");
  659. mailContent.append("</style>");
  660. mailContent.append("<font style='width:auto; font-size:12px; line-height:18px; padding:5px; text-align:left;'>");
  661. mailContent.append("<br>");
  662. mailContent.append("1.프로젝트 명 : " + bid_Master.get("DEPT_NM") + "<br>");
  663. mailContent.append("2.입찰번호 : " + bid_Master.get("BID_NO") + "<br>");
  664. mailContent.append("3.발주명 : " + bid_Master.get("DEMANDED_TITLE") + "<br>");
  665. mailContent.append("4.구매담당자 : " + bid_Master.get("USER_NAME") + "<br>");
  666. mailContent.append("5.현장설명회 : " + bid_Master.get("BID_INFO") + "<br>");
  667. mailContent.append("6.입찰마감 : " + bid_Master.get("BID_TO_DT_NM") + " (입찰마감기한 변경 시 통보 바랍니다)<br>");
  668. mailContent.append("7.견적대상업체" );
  669. mailContent.append("<table width='700' cellspacing='0' cellpadding='0' bordercolordark='#FFFFFF' bordercolorlight='#AEAFAF' border='1'>" );
  670. mailContent.append("<tr><td align='Center' bgcolor='rgb(208,216,232)'>견적업체명</td><td align='Center' bgcolor='rgb(208,216,232)'>연락처</td><td align='Center' bgcolor='rgb(208,216,232)'>E-MAIL</td></tr>" );
  671. for(int j=0;j < SuppInfo.size();j++){
  672. mailContent.append("<tr><td align='Left'>&nbsp;" + SuppInfo.getRow(j).get("VENDOR_NAME") + "</td><td align='Left'>&nbsp;" + SuppInfo.getRow(j).get("CORP_TEL") + "</td><td align='Left'>&nbsp;" + SuppInfo.getRow(j).get("CHARGE_EMAIL") + "</td></tr>" );
  673. }
  674. mailContent.append("</table>" );
  675. mailContent.append("</font>");
  676. if(!bid_Master.get("E_MAIL").isEmpty()) {
  677. //구매담당자
  678. messageSend.sendEmail(bid_Master.get("E_MAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent, "1");
  679. }
  680. //발주의뢰자
  681. if(!bid_Master.get("EMP_MAIL").isEmpty()){ //
  682. messageSend.sendEmail(bid_Master.get("EMP_MAIL") , "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent, "1");
  683. }
  684. //현설담당자
  685. if(!bid_Master.get("SITEDESCEMAIL").isEmpty() && !bid_Master.get("SITEDESCEMAIL").equals(bid_Master.get("EMP_MAIL")) ){
  686. messageSend.sendEmail(bid_Master.get("SITEDESCEMAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent, "1");
  687. }
  688. }
  689. }