|
@@ -0,0 +1,181 @@
|
|
|
|
+/**
|
|
|
|
+ * @(#)file PricesysListSaveBiz.java
|
|
|
|
+ * @(#)author TC40335
|
|
|
|
+ * @(#)date 2024.10.16
|
|
|
|
+ *
|
|
|
|
+ * Copyright (c) www.udapsoft.co.kr, Inc.
|
|
|
|
+ * All rights reserved.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ package kr.co.udapsoft.ebid.buyer.cont.purchase.biz;
|
|
|
|
+
|
|
|
|
+import java.sql.Connection;
|
|
|
|
+import java.sql.PreparedStatement;
|
|
|
|
+import java.sql.SQLException;
|
|
|
|
+
|
|
|
|
+import kr.co.hsnc.common.base.WAFLogger;
|
|
|
|
+import kr.co.hsnc.common.util.ValueObject;
|
|
|
|
+import kr.co.udapsoft.ebid.buyer.common.file.FileManager;
|
|
|
|
+
|
|
|
|
+import com.udapsoft.modular.web.ibsheet7.IBSheet7Factory;
|
|
|
|
+import com.udapsoft.modular.web.ibsheet7.util.IBSheet7Utils;
|
|
|
|
+import com.udapsoft.waf.system.Biz;
|
|
|
|
+import com.udapsoft.waf.system.HandlerStorage;
|
|
|
|
+
|
|
|
|
+public class PricesysListSaveBiz extends Biz {
|
|
|
|
+
|
|
|
|
+ public PricesysListSaveBiz(HandlerStorage storage) {
|
|
|
|
+ super(storage);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void doBiz() throws Exception {
|
|
|
|
+ if (storage.compareEvent("SAVE_PRICESYS_LIST")) {
|
|
|
|
+
|
|
|
|
+ boolean success = false;
|
|
|
|
+ String[] status = super.gets("sheet4.STATUS");
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ super.conn.begin();
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < status.length; i++) {
|
|
|
|
+
|
|
|
|
+ if (IBSheet7Utils.equalStatusInsert(status[i])) {
|
|
|
|
+ success = saveData(super.conn.getConnection(), IBSheet7Utils.getIBSheet7SqlParams("SHEET4", params, i));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (IBSheet7Utils.equalStatusUpdate(status[i])) {
|
|
|
|
+ success = updateData(super.conn.getConnection(), IBSheet7Utils.getIBSheet7SqlParams("SHEET4", params, i));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (IBSheet7Utils.equalStatusDelete(status[i])) {
|
|
|
|
+ FileManager fileManager = new FileManager();
|
|
|
|
+ fileManager.delFileMapProc(conn.getConnection(), "PUR_PRICESYS_DOC", IBSheet7Utils.getIBSheet7SqlParams("SHEET4", params, i).get("PRICE_SYS_ID"));
|
|
|
|
+ success = deleteData(super.conn.getConnection(), IBSheet7Utils.getIBSheet7SqlParams("SHEET4", params, i));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ super.storage.setSuccess(success);
|
|
|
|
+ storage.addObject("ibsheet7Data", IBSheet7Factory.createIBSheet7(params, storage.request));
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ WAFLogger.error(e);
|
|
|
|
+ super.conn.setRollback();
|
|
|
|
+ throw new Exception(e);
|
|
|
|
+
|
|
|
|
+ } finally {
|
|
|
|
+ super.conn.close();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private boolean saveData(Connection connection, ValueObject sqlParams) throws Exception {
|
|
|
|
+ PreparedStatement pstmt = null;
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ StringBuffer sql = new StringBuffer();
|
|
|
|
+
|
|
|
|
+ sql.append(" INSERT INTO PRICE_SYS( \n");
|
|
|
|
+ sql.append(" PRICE_SYS_ID \n");
|
|
|
|
+ sql.append(" ,PRICE_SYS_YN \n");
|
|
|
|
+ sql.append(" ,CONT_MOD_ID \n");
|
|
|
|
+ sql.append(" ,CORP_REG_NO \n");
|
|
|
|
+ sql.append(" ,CORP_NAME \n");
|
|
|
|
+ sql.append(" ,CONT_NO \n");
|
|
|
|
+ sql.append(" ,MOD_NO \n");
|
|
|
|
+ sql.append(" )VALUES( \n");
|
|
|
|
+ sql.append(" PRICE_SYS_ID_S.NEXTVAL \n");
|
|
|
|
+ sql.append(" ,? \n");
|
|
|
|
+ sql.append(" ,? \n");
|
|
|
|
+ sql.append(" ,? \n");
|
|
|
|
+ sql.append(" ,? \n");
|
|
|
|
+ sql.append(" ,? \n");
|
|
|
|
+ sql.append(" ,? \n");
|
|
|
|
+ sql.append(" ) \n");
|
|
|
|
+
|
|
|
|
+ pstmt = connection.prepareStatement(sql.toString());
|
|
|
|
+ int paramIdx = 1;
|
|
|
|
+
|
|
|
|
+ pstmt.setString(paramIdx++, sqlParams.get("PRICE_SYS_YN"));
|
|
|
|
+ pstmt.setString(paramIdx++, params.get("PUR_CONT_MOD_ID"));
|
|
|
|
+ pstmt.setString(paramIdx++, params.get("C_VENDCD"));
|
|
|
|
+ pstmt.setString(paramIdx++, params.get("C_MEMBER_NAME"));
|
|
|
|
+ pstmt.setString(paramIdx++, params.get("ORD_DOC_NO"));
|
|
|
|
+ pstmt.setString(paramIdx++, params.get("MOD_NO"));
|
|
|
|
+
|
|
|
|
+ pstmt.executeUpdate();
|
|
|
|
+ return true;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ WAFLogger.error(e);
|
|
|
|
+ throw new Exception(e);
|
|
|
|
+ } finally {
|
|
|
|
+ try {
|
|
|
|
+ if(pstmt != null) pstmt.close();
|
|
|
|
+ } catch(SQLException se) {
|
|
|
|
+ WAFLogger.error(se);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private boolean updateData(Connection connection, ValueObject sqlParams) throws Exception {
|
|
|
|
+ PreparedStatement pstmt = null;
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ StringBuffer sql = new StringBuffer();
|
|
|
|
+ sql.append(" UPDATE PRICE_SYS SET \n");
|
|
|
|
+ sql.append(" ,PRICE_SYS_YN= ? \n");
|
|
|
|
+ sql.append(" ,CONT_MOD_ID = ? \n");
|
|
|
|
+ sql.append(" ,CORP_REG_NO = ? \n");
|
|
|
|
+ sql.append(" ,CORP_NAME = ? \n");
|
|
|
|
+ sql.append(" ,CONT_NO = ? \n");
|
|
|
|
+ sql.append(" ,MOD_NO = ? \n");
|
|
|
|
+ sql.append(" WHERE PRICE_SYS_ID = ? \n");
|
|
|
|
+
|
|
|
|
+ pstmt = connection.prepareStatement(sql.toString());
|
|
|
|
+ int paramIdx = 1;
|
|
|
|
+
|
|
|
|
+ pstmt.setString(paramIdx++, sqlParams.get("PRICE_SYS_GB"));
|
|
|
|
+ pstmt.setString(paramIdx++, params.get("PUR_CONT_MOD_ID"));
|
|
|
|
+ pstmt.setString(paramIdx++, params.get("C_VENDCD"));
|
|
|
|
+ pstmt.setString(paramIdx++, params.get("C_MEMBER_NAME"));
|
|
|
|
+ pstmt.setString(paramIdx++, params.get("ORD_DOC_NO"));
|
|
|
|
+ pstmt.setString(paramIdx++, params.get("MOD_NO"));
|
|
|
|
+ pstmt.setString(paramIdx++, sqlParams.get("PRICE_SYS_ID"));
|
|
|
|
+
|
|
|
|
+ pstmt.executeUpdate();
|
|
|
|
+ return true;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ WAFLogger.error(e);
|
|
|
|
+ throw new Exception(e);
|
|
|
|
+ } finally {
|
|
|
|
+ try {
|
|
|
|
+ if(pstmt != null) pstmt.close();
|
|
|
|
+ } catch(SQLException se) {
|
|
|
|
+ WAFLogger.error(se);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private boolean deleteData(Connection connection, ValueObject sqlParams) throws Exception {
|
|
|
|
+ PreparedStatement pstmt = null;
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ StringBuffer sql = new StringBuffer();
|
|
|
|
+ sql.append(" DELETE FROM PRICE_SYS WHERE PRICE_SYS_ID = ? \n ");
|
|
|
|
+
|
|
|
|
+ pstmt = connection.prepareStatement(sql.toString());
|
|
|
|
+ int paramIdx = 1;
|
|
|
|
+ pstmt.setInt(paramIdx++, sqlParams.getInt("PRICE_SYS_ID"));
|
|
|
|
+
|
|
|
|
+ pstmt.executeUpdate();
|
|
|
|
+ return true;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ WAFLogger.error(e);
|
|
|
|
+ throw new Exception(e);
|
|
|
|
+ } finally {
|
|
|
|
+ try {
|
|
|
|
+ if(pstmt != null) pstmt.close();
|
|
|
|
+ } catch(SQLException se) {
|
|
|
|
+ WAFLogger.error(se);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|