475 lines
18 KiB
Java
475 lines
18 KiB
Java
//package com.base.util;
|
||
//
|
||
//import java.text.DecimalFormat;
|
||
//import java.util.Calendar;
|
||
//import java.util.HashMap;
|
||
//import java.util.Map;
|
||
//
|
||
//import jbo.com.tenwa.entity.comm.serialutil.T_SERIAL_DISCARD_NUMBER;
|
||
//import jbo.com.tenwa.entity.comm.serialutil.T_SERIAL_NUMBER;
|
||
//
|
||
//import com.amarsoft.are.jbo.BizObject;
|
||
//import com.amarsoft.are.jbo.BizObjectManager;
|
||
//import com.amarsoft.are.jbo.BizObjectQuery;
|
||
//import com.amarsoft.are.jbo.JBOFactory;
|
||
//import com.amarsoft.are.jbo.JBOTransaction;
|
||
//import com.amarsoft.are.lang.StringX;
|
||
//import com.tenwa.comm.util.date.DateAssistant;
|
||
//import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||
//
|
||
//public class SerialNumberUtil {
|
||
// public static synchronized String getInvoiceSerialNo(JBOTransaction tx)
|
||
// throws Exception {
|
||
// return SerialNumberUtil.getSerialNumber(
|
||
// "PR{year}{month}{maxOrderNumber}", 6, null, "데앴뵀", null, tx);
|
||
// }
|
||
//
|
||
// public static synchronized String getAssetsDisposalApplyNo(JBOTransaction tx)
|
||
// throws Exception {
|
||
// return SerialNumberUtil.getSerialNumber("FW{year}{maxOrderNumber}", 4,
|
||
// null, "栗끓뇹零<EB87B9>헝긍뵀", null, tx);
|
||
// }
|
||
//
|
||
// public static synchronized String getRiskAlertNumber(JBOTransaction tx)
|
||
// throws Exception {
|
||
// return SerialNumberUtil.getSerialNumber("{year}루麴渡쒸{maxOrderNumber}",
|
||
// 4, null, "루麴渡쒸뵀", null, tx);
|
||
// }
|
||
//
|
||
// public static synchronized String getFileBorrowingNumber(JBOTransaction tx)
|
||
// throws Exception {
|
||
// return SerialNumberUtil.getSerialNumber("{year}썼敦데{maxOrderNumber}", 4,
|
||
// null, "썼敦데직彊뵀", null, tx);
|
||
// }
|
||
//
|
||
// public static synchronized String getProjectSerialNumber(String orgId,
|
||
// JBOTransaction tx) throws Exception {
|
||
// return SerialNumberUtil.getSerialNumber(
|
||
// "P{year}{month}{day}{maxOrderNumber}", 6, null, "淃커긍뵀" + orgId,
|
||
// null, tx);
|
||
// }
|
||
//
|
||
// // 밟댕북谿긍뵀
|
||
// public static synchronized String getContractSerialNumber(String leasForm,
|
||
// String orgId, JBOTransaction tx) throws Exception {
|
||
// String currentDateTime = DateAssistant.getTodayNow();
|
||
// String currentYear = currentDateTime.substring(0, 4);
|
||
// String month = currentDateTime.substring(5, 7);
|
||
// return SerialNumberUtil.getSerialNumber("{year}{month}-" + leasForm
|
||
// + "{maxOrderNumber}", 5, null, currentYear + month + leasForm,
|
||
// null, tx);
|
||
// }
|
||
//
|
||
// public static synchronized String getEbankSerialNumber(String orgId,
|
||
// JBOTransaction tx) throws Exception {
|
||
// return SerialNumberUtil.getSerialNumber(
|
||
// "E-{year}{month}{maxOrderNumber}", 3, null, "貢陵긍뵀" + orgId,
|
||
// null, tx);
|
||
// }
|
||
//
|
||
// public static synchronized String getOutNoNumber(JBOTransaction tx)
|
||
// throws Exception {
|
||
// return SerialNumberUtil.getSerialNumber(
|
||
// "PF{year}{month}{maxOrderNumber}", 4, null, "", null, tx);
|
||
// }
|
||
//
|
||
// public static synchronized String getRentOutNoNumber(JBOTransaction tx)
|
||
// throws Exception {
|
||
// return SerialNumberUtil.getSerialNumber(
|
||
// "PR{year}{month}{maxOrderNumber}", 4, null, "", null, tx);
|
||
// }
|
||
//
|
||
// public static synchronized String getGroupCompanyNumber(JBOTransaction tx)
|
||
// throws Exception {
|
||
// return SerialNumberUtil.getSerialNumber(
|
||
// "G{year}{month}{day}{maxOrderNumber}", 8, null, "섞考긍뵀", null,
|
||
// tx);
|
||
// }
|
||
//
|
||
// public static synchronized String getPlannumber(String sSerialType,
|
||
// String calType, JBOTransaction tx) throws Exception {
|
||
// String sSerialType2 = "";
|
||
// if (calType.equals("proj_process")) {
|
||
// sSerialType2 = sSerialType + "{maxOrderNumber}";
|
||
// return SerialNumberUtil.getSerialNumber(sSerialType2, 2, null,
|
||
// sSerialType + "렘갭긍뵀", null, tx);
|
||
// } else if (calType.equals("pay_process")) {
|
||
// sSerialType2 = sSerialType + "-{maxOrderNumber}";
|
||
// return SerialNumberUtil.getSerialNumber(sSerialType2, 2, null,
|
||
// sSerialType + "尻렴긍뵀", null, tx);
|
||
// } else {
|
||
// sSerialType2 = sSerialType + "{maxOrderNumber}";
|
||
// return SerialNumberUtil.getContractNumber(sSerialType2, 2, null,
|
||
// sSerialType, null, tx);
|
||
// }
|
||
// }
|
||
//
|
||
// public static synchronized String getProjectSerialNumber1(String orgId,
|
||
// JBOTransaction tx) throws Exception {
|
||
// return SerialNumberUtil.getSerialNumber("P{year}{maxOrderNumber}", 7,
|
||
// null, "淃커긍뵀" + orgId, null, tx);
|
||
// }
|
||
//
|
||
// /*
|
||
// * public static String getContractSerialNaumber(String
|
||
// * sSerialType,JBOTransaction tx) throws Exception { String
|
||
// * projectno=sSerialType; sSerialType=sSerialType+"-{maxOrderNumber}";
|
||
// * return SerialNumberUtil.getSerialNumber(sSerialType,4,null,projectno,
|
||
// * null, tx); }
|
||
// */
|
||
// protected static synchronized String getContractNumber(
|
||
// String serialNumberPattern, int numberCount,
|
||
// Map<String, String> model, String type, Integer queryYear,
|
||
// JBOTransaction tx) throws Exception {
|
||
// String currentDateTime = DateAssistant.getTodayNow();
|
||
// String currentYear = currentDateTime.substring(0, 4);
|
||
// String month = currentDateTime.substring(5, 7);
|
||
// String day = currentDateTime.substring(8, 10);
|
||
// String hour = currentDateTime.substring(11, 13);
|
||
// String minute = currentDateTime.substring(14, 16);
|
||
// String second = currentDateTime.substring(17, 19);
|
||
//
|
||
// Integer year = Integer.parseInt(currentYear);
|
||
// if (null != queryYear) {
|
||
// year = queryYear;
|
||
// }
|
||
// Map<String, String> paramMap = new HashMap<String, String>();
|
||
// paramMap.put("year", year + "");
|
||
// paramMap.put("month", month + "");
|
||
// paramMap.put("day", day + "");
|
||
// paramMap.put("hour", hour + "");
|
||
// paramMap.put("minute", minute + "");
|
||
// paramMap.put("second", second + "");
|
||
//
|
||
// int maxOrderNumber = getMaxOrderNumber(type, queryYear, tx);
|
||
//
|
||
// BizObject contract = JBOFactory
|
||
// .createBizObjectQuery(
|
||
// "jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO_TEMP",
|
||
// "contract_no=:contractid")
|
||
// .setParameter("contractid", type).getSingleResult(false);
|
||
//
|
||
// BizObject proj = JBOFactory
|
||
// .createBizObjectQuery(
|
||
// "jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP",
|
||
// "id=:id")
|
||
// .setParameter("id",
|
||
// contract.getAttribute("project_id").getString())
|
||
// .getSingleResult(false);
|
||
//
|
||
// int max = getMaxOrderNumber(proj.getAttribute("PROJECT_NO").getString()
|
||
// + "렘갭긍뵀", queryYear, tx);
|
||
//
|
||
// maxOrderNumber = max > maxOrderNumber ? max : maxOrderNumber;
|
||
//
|
||
// StringBuffer numberFormat = new StringBuffer();
|
||
// for (int i = 0; i < numberCount; i++) {
|
||
// numberFormat.append("0");
|
||
// }
|
||
//
|
||
// DecimalFormat df = new DecimalFormat(numberFormat.toString());
|
||
// String serialNumberFormat = df.format(maxOrderNumber);
|
||
// paramMap.put("maxOrderNumber", serialNumberFormat);
|
||
// if (null != model) {
|
||
// paramMap.putAll(model);
|
||
// }
|
||
// String serialNumberString = getSerialNumber(paramMap,
|
||
// serialNumberPattern);
|
||
//
|
||
// return serialNumberString;
|
||
// }
|
||
//
|
||
// protected static synchronized String getSerialNumber(
|
||
// String serialNumberPattern, int numberCount,
|
||
// Map<String, String> model, String type, Integer queryYear,
|
||
// JBOTransaction tx) throws Exception
|
||
//
|
||
// {
|
||
// String currentDateTime = DateAssistant.getTodayNow();
|
||
// String currentYear = currentDateTime.substring(0, 4);
|
||
// String month = currentDateTime.substring(5, 7);
|
||
// String day = currentDateTime.substring(8, 10);
|
||
// String hour = currentDateTime.substring(11, 13);
|
||
// String minute = currentDateTime.substring(14, 16);
|
||
// String second = currentDateTime.substring(17, 19);
|
||
//
|
||
// Integer year = Integer.parseInt(currentYear);
|
||
// if (null != queryYear) {
|
||
// year = queryYear;
|
||
// }
|
||
// Map<String, String> paramMap = new HashMap<String, String>();
|
||
// paramMap.put("year", year + "");
|
||
// paramMap.put("month", month + "");
|
||
// paramMap.put("day", day + "");
|
||
// paramMap.put("hour", hour + "");
|
||
// paramMap.put("minute", minute + "");
|
||
// paramMap.put("second", second + "");
|
||
//
|
||
// int maxOrderNumber = getMaxOrderNumber(type, queryYear, tx);
|
||
// StringBuffer numberFormat = new StringBuffer();
|
||
// for (int i = 0; i < numberCount; i++) {
|
||
// numberFormat.append("0");
|
||
// }
|
||
//
|
||
// DecimalFormat df = new DecimalFormat(numberFormat.toString());
|
||
// String serialNumberFormat = df.format(maxOrderNumber);
|
||
// paramMap.put("maxOrderNumber", serialNumberFormat);
|
||
// if (null != model) {
|
||
// paramMap.putAll(model);
|
||
// }
|
||
// String serialNumberString = getSerialNumber(paramMap,
|
||
// serialNumberPattern);
|
||
//
|
||
// return serialNumberString;
|
||
// }
|
||
//
|
||
// protected static synchronized String getSerialNumber(
|
||
// Map<String, String> paramMap, String serialNumberPattern) {
|
||
// for (String key : paramMap.keySet()) {
|
||
// if (serialNumberPattern.indexOf("{" + key + "}") >= 0) {
|
||
// serialNumberPattern = serialNumberPattern.replace("{" + key
|
||
// + "}", paramMap.get(key));
|
||
// }
|
||
// }
|
||
// return serialNumberPattern;
|
||
// }
|
||
//
|
||
// /***
|
||
// * serialNumberPattern튈토令 {year}->쾨룀,흔벎꽝鑒year槨왕橙혤뎠품쾨 {month}->뎠품墩 {day}->뎠품휑
|
||
// * {hour}->珂 {minute}->롸 {second}->취 {maxOrderNumber}->뎠품離댕埼뵀
|
||
// *
|
||
// * **/
|
||
// protected static synchronized String getSerialNumberByMonth(
|
||
// String serialNumberPattern, int numberCount,
|
||
// Map<String, String> model, String type, Integer queryYear,
|
||
// Integer queryMonth, JBOTransaction tx) throws Exception {
|
||
// String currentDateTime = DateAssistant.getTodayNow();
|
||
// String currentYear = currentDateTime.substring(0, 4);
|
||
// String monthStr = currentDateTime.substring(5, 7);
|
||
// String day = currentDateTime.substring(8, 10);
|
||
// String hour = currentDateTime.substring(11, 13);
|
||
// String minute = currentDateTime.substring(14, 16);
|
||
// String second = currentDateTime.substring(17, 19);
|
||
//
|
||
// int year = Integer.parseInt(currentYear);
|
||
// int month = Integer.parseInt(monthStr);
|
||
// if (null != queryYear) {
|
||
// year = queryYear;
|
||
// }
|
||
// if (null != queryMonth) {
|
||
// month = queryMonth;
|
||
// }
|
||
// Map<String, String> paramMap = new HashMap<String, String>();
|
||
// paramMap.put("year", year + "");
|
||
// paramMap.put("month", monthStr + "");
|
||
// paramMap.put("day", day + "");
|
||
// paramMap.put("hour", hour + "");
|
||
// paramMap.put("minute", minute + "");
|
||
// paramMap.put("second", second + "");
|
||
//
|
||
// int maxOrderNumber = getMaxOrderNumberByMonth(type, year, month, tx);
|
||
// StringBuffer numberFormat = new StringBuffer();
|
||
// for (int i = 0; i < numberCount; i++) {
|
||
// numberFormat.append("0");
|
||
// }
|
||
//
|
||
// DecimalFormat df = new DecimalFormat(numberFormat.toString());
|
||
// String serialNumberFormat = df.format(maxOrderNumber);
|
||
// paramMap.put("maxOrderNumber", serialNumberFormat);
|
||
// if (null != model) {
|
||
// paramMap.putAll(model);
|
||
// }
|
||
//
|
||
// String serialNumberString = getSerialNumber(paramMap,
|
||
// serialNumberPattern);
|
||
//
|
||
// return serialNumberString;
|
||
// }
|
||
//
|
||
// // 옘쪄깻랙헙워극伎꽃痰谿꼍샙齡
|
||
// @SuppressWarnings("unchecked")
|
||
// protected static synchronized int getMaxOrderNumber(String type,
|
||
// Integer queryYear, JBOTransaction tx) throws Exception {
|
||
// int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
||
// BizObjectManager tNumberManager = JBOFactory
|
||
// .getBizObjectManager(T_SERIAL_NUMBER.CLASS_NAME);
|
||
// tx.join(tNumberManager);
|
||
// Map<String, String> searchCondtion = new HashMap<String, String>();
|
||
// if (!StringX.isEmpty(type)) {
|
||
// searchCondtion.put("type_", type);
|
||
// }
|
||
// if (null != queryYear) {
|
||
// searchCondtion.put("year_", queryYear.toString());
|
||
//
|
||
// }
|
||
// String querySql = DataOperatorUtil.getQuerySql(searchCondtion);
|
||
// BizObjectQuery bqDest = tNumberManager.createQuery(querySql);
|
||
// for (String key : searchCondtion.keySet()) {
|
||
// bqDest.setParameter(key, searchCondtion.get(key).toString());
|
||
// }
|
||
// BizObject serialNumber = null;
|
||
// serialNumber = bqDest.getSingleResult(true);// 커깃JBO,矜狼隣뫘劤꾸鱗
|
||
//
|
||
// if (null == serialNumber) {
|
||
//
|
||
// serialNumber = tNumberManager.newObject();
|
||
// if (null != queryYear) {
|
||
// currentYear = queryYear;
|
||
// }
|
||
// serialNumber.setAttributeValue("year_", currentYear);
|
||
// serialNumber.setAttributeValue("type_", type);
|
||
// serialNumber.setAttributeValue("order_number_", "0");
|
||
// }
|
||
// int maxOrderNumber = Integer.valueOf(serialNumber.getAttribute(
|
||
// "order_number_").getInt()) + 1;
|
||
// serialNumber.setAttributeValue("order_number_", maxOrderNumber);
|
||
// tNumberManager.saveObject(serialNumber);
|
||
// return maxOrderNumber;
|
||
// }
|
||
//
|
||
// // 옘쪄깻랙헙워극伎꽃痰谿꼍샙齡
|
||
// @SuppressWarnings("unchecked")
|
||
// protected static synchronized int getMaxOrderNumberByMonth(String type,
|
||
// Integer queryYear, Integer queryMonth, JBOTransaction tx)
|
||
// throws Exception {
|
||
//
|
||
// int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
||
// int currentMonth = Calendar.getInstance().get(Calendar.MONTH);
|
||
// BizObjectManager tNumberManager = JBOFactory
|
||
// .getBizObjectManager(T_SERIAL_NUMBER.CLASS_NAME);
|
||
// tx.join(tNumberManager);
|
||
// Map<String, String> searchCondtion = new HashMap<String, String>();
|
||
// if (!StringX.isEmpty(type)) {
|
||
// searchCondtion.put("type_", type);
|
||
// }
|
||
// if (null != queryYear) {
|
||
// searchCondtion.put("year_", queryYear.toString());
|
||
//
|
||
// }
|
||
// if (null != queryMonth) {
|
||
// searchCondtion.put("month_", queryMonth.toString());
|
||
//
|
||
// }
|
||
// String querySql = DataOperatorUtil.getQuerySql(searchCondtion);
|
||
// BizObjectQuery bqDest = tNumberManager.createQuery(querySql);
|
||
// for (String key : searchCondtion.keySet()) {
|
||
// bqDest.setParameter(key, searchCondtion.get(key).toString());
|
||
// }
|
||
// BizObject serialNumber = null;
|
||
// serialNumber = bqDest.getSingleResult(true);// 커깃JBO,矜狼隣뫘劤꾸鱗
|
||
//
|
||
// if (null == serialNumber) {
|
||
//
|
||
// serialNumber = tNumberManager.newObject();
|
||
// if (null != queryYear) {
|
||
// currentYear = queryYear;
|
||
// }
|
||
// if (null != queryMonth) {
|
||
// currentMonth = queryMonth;
|
||
// }
|
||
// serialNumber.setAttributeValue("year_", currentYear);
|
||
// serialNumber.setAttributeValue("month_", currentMonth);
|
||
// serialNumber.setAttributeValue("type_", type);
|
||
// serialNumber.setAttributeValue("order_number_", "0");
|
||
// }
|
||
// int maxOrderNumber = Integer.valueOf(serialNumber.getAttribute(
|
||
// "order_number_").getInt()) + 1;
|
||
// serialNumber.setAttributeValue("order_number_", maxOrderNumber);
|
||
// tNumberManager.saveObject(serialNumber);
|
||
// return maxOrderNumber;
|
||
// }
|
||
//
|
||
// /**
|
||
// * 膽邱닒뵀쯤록폴넥櫓혤뵀,흔벎뵀쯤록폴넥櫓청唐덤혤뵀찐,橙몽앴埼죗뵀<ECA397>냥
|
||
// *
|
||
// * @param serialNumberPattern
|
||
// * @param numberCount
|
||
// * @param model
|
||
// * @param type
|
||
// * @param queryYear
|
||
// * @param hibernateTemplate
|
||
// * @param jdbcTemplate
|
||
// * @return
|
||
// * @throws Exception
|
||
// */
|
||
// protected static synchronized String getSerialNumberFirstDiscard(
|
||
// String serialNumberPattern, int numberCount,
|
||
// Map<String, String> model, String type, Integer queryYear,
|
||
// JBOTransaction tx) throws Exception {
|
||
// String currentDateTime = DateAssistant.getTodayNow();
|
||
// String currentYear = currentDateTime.substring(0, 4);
|
||
// String month = currentDateTime.substring(5, 7);
|
||
// String day = currentDateTime.substring(8, 10);
|
||
// String hour = currentDateTime.substring(11, 13);
|
||
// String minute = currentDateTime.substring(14, 16);
|
||
// String second = currentDateTime.substring(17, 19);
|
||
//
|
||
// int year = Integer.parseInt(currentYear);
|
||
// if (null != queryYear) {
|
||
// year = queryYear;
|
||
// }
|
||
// Map<String, String> paramMap = new HashMap<String, String>();
|
||
// paramMap.put("year", year + "");
|
||
// paramMap.put("month", month + "");
|
||
// paramMap.put("day", day + "");
|
||
// paramMap.put("hour", hour + "");
|
||
// paramMap.put("minute", minute + "");
|
||
// paramMap.put("second", second + "");
|
||
//
|
||
// int maxOrderNumber = 0;
|
||
// // 닒록폴넥꿴冷옵痰뵀쯤
|
||
// maxOrderNumber = getMinDiscardNumber(type, queryYear, tx);
|
||
// if (maxOrderNumber < 0) {// 록폴넥櫓청唐鑒앴
|
||
// maxOrderNumber = getMaxOrderNumber(type, year, tx);
|
||
// }
|
||
// StringBuffer numberFormat = new StringBuffer();
|
||
// for (int i = 0; i < numberCount; i++) {
|
||
// numberFormat.append("0");
|
||
// }
|
||
// DecimalFormat df = new DecimalFormat(numberFormat.toString());
|
||
// String serialNumberFormat = df.format(maxOrderNumber);
|
||
// paramMap.put("maxOrderNumber", serialNumberFormat);
|
||
// if (null != model) {
|
||
// paramMap.putAll(model);
|
||
// }
|
||
//
|
||
// String serialNumberString = getSerialNumber(paramMap,
|
||
// serialNumberPattern);
|
||
//
|
||
// return serialNumberString;
|
||
// }
|
||
//
|
||
// @SuppressWarnings("unchecked")
|
||
// protected static synchronized int getMinDiscardNumber(String type,
|
||
// Integer queryYear, JBOTransaction tx) throws Exception {
|
||
// BizObjectManager tNumberManager = JBOFactory
|
||
// .getBizObjectManager(T_SERIAL_DISCARD_NUMBER.CLASS_NAME);
|
||
// tx.join(tNumberManager);
|
||
// Map<String, String> searchCondtion = new HashMap<String, String>();
|
||
// if (!StringX.isEmpty(type)) {
|
||
// searchCondtion.put("type_", type);
|
||
// }
|
||
// if (null != queryYear) {
|
||
// searchCondtion.put("year_", queryYear.toString());
|
||
//
|
||
// }
|
||
//
|
||
// String querySql = DataOperatorUtil.getQuerySql(searchCondtion);
|
||
// BizObjectQuery bqDest = tNumberManager.createQuery(querySql);
|
||
// for (String key : searchCondtion.keySet()) {
|
||
// bqDest.setParameter(key, searchCondtion.get(key).toString());
|
||
// }
|
||
// BizObject serialNumber = null;
|
||
// serialNumber = bqDest.getSingleResult(true);// 커깃JBO,矜狼隣뫘劤꾸鱗
|
||
//
|
||
// if (null != serialNumber) {
|
||
// int minOrderNumber = serialNumber.getAttribute("discard_number_")
|
||
// .getInt();
|
||
// tNumberManager.deleteObject(serialNumber);
|
||
// return minOrderNumber;
|
||
// }
|
||
// return -1;
|
||
// }
|
||
//
|
||
//}
|