text
stringlengths
10
2.72M
package com.daikit.graphql.dynamicattribute; /** * Abstract super class for {@link GQLDynamicAttributeGetter} and * {@link GQLDynamicAttributeSetter} * * @author Thibaut Caselli * @param <ENTITY_TYPE> * the input object value holding type */ public abstract class GQLAbstractDynamicAttribute<ENTITY_TYPE> implements IGQLAbstractDynamicAttribute<ENTITY_TYPE> { private String name; // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- // CONSTRUCTORS // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- /** * Constructor */ public GQLAbstractDynamicAttribute() { // Nothing done } /** * Constructor * * @param name * the property name that will be available in GraphQL schema */ public GQLAbstractDynamicAttribute(final String name) { this.name = name; } // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- // GETTERS / SETTERS // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- /** * @return the name */ @Override public String getName() { return name; } /** * @param name * the name to set */ public void setName(final String name) { this.name = name; } }
package ifs_ints_and_loops; // Copyright (c) The League of Amazing Programmers 2013-2017 // Level 0 import javax.swing.JOptionPane; /** * Secret Message Box / Secure Messaging System * * You want to leave a message on one of the Mac computers so that only your * friend can read it. You set up the passcode and the secret message. Your * friend types in the passcode to retrieve the message. * */ public class SecretMessageBox { // 0. Make a main method and put steps 1-5 inside it public static void main(String[] args) { // 1. Set a password in a String variable String password = JOptionPane.showInputDialog("Type in a password."); // 2. Using a pop-up, ask the first person for a secret message and store it in // a variable String message = JOptionPane.showInputDialog("Type in a secret message."); // 3. Now use a pop-up to tell the NEXT user that they can only see the secret // message if they guess the password. JOptionPane.showMessageDialog(null, "Now, grab a friend."); JOptionPane.showMessageDialog(null, "Tell your friend that if he/she guesses the right password, the secret message will pop up."); String guessP = JOptionPane.showInputDialog("Guess the password."); while (!guessP.equals(password)) { JOptionPane.showMessageDialog(null, "INTRUDER!!!"); guessP = JOptionPane.showInputDialog("Guess the password."); } // 4. If their guess matches the password, show them the secret message JOptionPane.showMessageDialog(null, message); // 5. If the password does not match, pop-up "INTRUDER!!" } }
package byog.Core; public class Matrix { private int[][] body; private int height; private int width; Matrix(int w, int h) { body = new int[w][h]; height = h; width = w; } Matrix(int[][] m) { body = m; height = m[0].length; width = m.length; } // i row, j column public int getitem(int i, int j) { return body[i][j]; } public int getHeigh() { return height; } public int getWidth() { return width; } public void givenvalue(int i, int j, int value) { body[i][j] = value; } /** add another matrix onto this*/ public void matrixadding(Matrix another) { if (this.getHeigh() != another.getHeigh() || this.getWidth() != another.getWidth()) { throw new RuntimeException("matrix should be same size"); } for (int i = width - 1; i >= 0; i--) { for (int j = height - 1; j >= 0; j--) { this.givenvalue(i, j, (getitem(i, j) + another.getitem(i, j))); } } } public void print() { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { System.out.print(getitem(i, j) + " "); } System.out.println(); } System.out.println(); } }
package com.eduardo.rest.workspaces; import com.eduardo.grpc.main.WorkspaceClient; import com.eduardo.rest.workspaces.model.WorkspaceDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; @RestController @RequestMapping("/workspace") public class WorkspaceController { @Autowired private WorkspaceClient workspaceClient; @PostMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) String newWorkspace(@RequestBody @Valid WorkspaceDto newWorkspace) { return workspaceClient.createWorkspace(newWorkspace.getType(), newWorkspace.getSize()); } }
package net.darkwire.example.service; import retrofit.RestAdapter; import com.octo.android.robospice.retrofit.RetrofitGsonSpiceService; import net.darkwire.example.service.catalog.UrlCatalog; import net.darkwire.example.service.client.FiveHundredPxClient; /** * Created by fsiu on 3/21/14. */ public class FiveHundredPxGsonSpiceService extends RetrofitGsonSpiceService { @Override public void onCreate() { super.onCreate(); addRetrofitInterface(FiveHundredPx.class); } @Override protected String getServerUrl() { return UrlCatalog.FIVE_HUNDRED_PX_URL; } @Override protected RestAdapter.Builder createRestAdapterBuilder() { return super.createRestAdapterBuilder().setClient(FiveHundredPxClient.INSTANCE.getClient()); } }
package com.flightmanagement.domain; import com.fasterxml.jackson.annotation.JsonIgnore; import javax.persistence.*; /** * Created by z00382545 on 11/10/16. */ @Entity public class Passenger { @Id @GeneratedValue(strategy= GenerationType.AUTO) private long id; private String firstName; private String lastName; private String gender; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name="BOOKING_ID") @JsonIgnore private BookingRecord bookingRecord; public Passenger() { } public Passenger(String firstName, String lastName, String gender,BookingRecord bookingRecord ) { this.firstName = firstName; this.lastName = lastName; this.gender = gender; this.bookingRecord= bookingRecord; } public long getId() { return id; } public void setId(long id) { this.id = id; } public BookingRecord getBookingRecord() { return bookingRecord; } public void setBookingRecord(BookingRecord bookingRecord) { this.bookingRecord = bookingRecord; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } @Override public String toString() { return String.format("Passenger [id=%d, firstName=%s, lastName=%s, gender=%s]", id, firstName, lastName, gender); } }
package org.larrychina.lcm.conf; import org.larrychina.lcm.exception.LcmException; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; /** * Created by suning on 2018/5/4. * load properties */ public class LcmConfigration { public static String CONFIG_FILE = "/lcm.properties"; public static final String PATH_SEPARATOR = "/"; public static ConcurrentHashMap<String, LcmConfigration> configs = new ConcurrentHashMap(); private String appCode = ""; private String secretKey = ""; private String lcmServer = ""; private String zkServer = ""; // 设置配置文件路径 public static void setConfigFile(String configFile){ CONFIG_FILE = configFile ; } public static LcmConfigration getInstance(String configFile) { if(configs.containsKey(configFile)) { return (LcmConfigration)configs.get(configFile); } else { InputStream inputStream = LcmConfigration.class.getResourceAsStream(configFile); if(inputStream == null) { throw new LcmException("Can not load file " + configFile); } else { LcmConfigration var5; try { Properties properties = new Properties(); properties.load(inputStream); LcmConfigration config = new LcmConfigration(properties); LcmConfigration existed = (LcmConfigration)configs.putIfAbsent(configFile, config); if(existed != null) { config = existed; } var5 = config; } catch (Exception var14) { throw new LcmException("load scm config error", var14); } finally { try { inputStream.close(); } catch (IOException var13) { // logger.error("close stream error", var13); } } return var5; } } } public static LcmConfigration getInstance() { return getInstance(CONFIG_FILE); } private LcmConfigration(Properties properties) { this.appCode = (String)properties.get("appCode"); this.secretKey = (String)properties.get("secretKey"); this.zkServer = (String)properties.get("zkServer"); Properties localCached = new Properties(); } static { getInstance(); } public String getAppCode() { return appCode; } public void setAppCode(String appCode) { this.appCode = appCode; } public String getSecretKey() { return secretKey; } public void setSecretKey(String secretKey) { this.secretKey = secretKey; } public String getLcmServer() { return lcmServer; } public void setLcmServer(String lcmServer) { this.lcmServer = lcmServer; } public String getZkServer() { return zkServer; } public void setZkServer(String zkServer) { this.zkServer = zkServer; } }
/* * Origin of the benchmark: * repo: https://github.com/diffblue/cbmc.git * branch: develop * directory: regression/cbmc-java/tableswitch1 * The benchmark was taken from the repo: 24 January 2018 */ class Main { public static void main(String[] args) { int i, j; java.util.Random random = new java.util.Random(42); i=random.nextInt(); switch(i) { case -1: j=0; break; case 0: j=1; break; case 1: j=2; break; case 2: j=3; break; case 3: j=4; break; case 4: j=5; break; case 5: j=6; break; case 6: j=7; break; case 7: j=8; break; case 8: j=9; break; case 9: j=10; break; case 10: j=11; break; case 11: j=12; break; default: j=1000; } if(i>=-1 && i<=11) assert j==i+1; else assert j==1000; } }
package com.mycompany.ghhrkapp1.repositories; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; import com.mycompany.ghhrkapp1.entity.Locations; @RepositoryRestResource public interface LocationRepository extends JpaRepository<Locations, String>{ }
package com.needii.dashboard.dao; import java.util.List; import com.needii.dashboard.model.City; public interface CityDao { List<City> findAll(); Long count(); City findOne(int id); }
package com.nikita.recipiesapp.common.redux; /** * Actions must implement this class */ public interface Action {}
package base.javaThread.demoSync; /** * 多线程并发安全问题 * 当多个线程访问同一资源时,由于线程切换时机不确定, * 可能导致多个线程执行代码出现混乱,导致程序执行 * 出现问题,严重时可能导致系统瘫痪。 * * 解决并发安全问题,就是要将多个线程"抢"改为"排队" * 执行 * @author adminitartor * */ public class SyncDemo { public static void main(String[] args) { final Table table = new Table(); Thread t1 = new Thread(){ public void run(){ while(true){ int bean = table.getBean(); //模拟CPU执行到这里没有时间 Thread.yield(); System.out.println( getName()+":"+bean ); } } }; Thread t2 = new Thread(){ public void run(){ while(true){ int bean = table.getBean(); //模拟CPU执行到这里没有时间 Thread.yield(); System.out.println(getName()+":"+bean); } } }; t1.start(); t2.start(); } } class Table{ private int beans = 20; /** * 当一个方法被Synchronized修饰后,那么 * 该方法称为"同步方法",即多个线程不能同时 * 进入方法内部执行 * 方法上使用synchronized,那么锁对象就是 * 当前方法所属对象,即:this * @return */ public synchronized int getBean(){ if(beans==0){ throw new RuntimeException("没有豆子了!"); } //模拟CPU执行到这里没有时间 Thread.yield(); return beans--; } }
package cn.zhanghao90.demo20; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Build; import android.provider.MediaStore; import android.support.v4.content.FileProvider; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.URI; public class MainActivity extends AppCompatActivity { private Button button1; private ImageView imageView1; private Uri uri; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); imageView1 = (ImageView) findViewById(R.id.imageView1); button1 = (Button) findViewById(R.id.button1); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { File outputImage = new File(getExternalCacheDir(),"outputImage.jpg"); try{ if(outputImage.exists()){ outputImage.delete(); } outputImage.createNewFile(); } catch (IOException e){ e.printStackTrace(); } if(Build.VERSION.SDK_INT > 24){ uri = FileProvider.getUriForFile(getApplicationContext(),"cn.zhanghao90.demo20.fileProvider",outputImage); } else{ uri = Uri.fromFile(outputImage); } Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); intent.putExtra(MediaStore.EXTRA_OUTPUT,uri); startActivityForResult(intent,1); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode){ case 1: if(resultCode == RESULT_OK){ try{ InputStream inputStream = getContentResolver().openInputStream(uri); Bitmap bitmap = BitmapFactory.decodeStream(inputStream); imageView1.setImageBitmap(bitmap); } catch (FileNotFoundException e){ e.printStackTrace(); } } break; default: break; } } }
import java.util.Scanner; public class Test { public static void main(String[] args) { Rc4 rc4 = new Rc4(); Scanner in = new Scanner(System.in); System.out.println("请输入要加密的字符串"); String m = in.nextLine(); System.out.println("请输入加密的密匙"); String key = in.nextLine(); String c = rc4.encrypt(m, key); String d = rc4.encrypt(c, key); System.out.println("明文为:" + m + "\n密钥为:" + key + "\n密文为:" + c + "\n解密为:" + d); } }
package raft.server.storage; import java.nio.ByteBuffer; /** * Author: ylgrgyq * Date: 18/6/24 */ class Footer { static int tableFooterSize = BlockHandle.blockHandleSize + Long.BYTES; private BlockHandle indexBlockHandle; Footer(BlockHandle indexBlockHandle) { this.indexBlockHandle = indexBlockHandle; } BlockHandle getIndexBlockHandle() { return indexBlockHandle; } byte[] encode() { byte[] indexBlock = indexBlockHandle.encode(); ByteBuffer buffer = ByteBuffer.allocate(indexBlock.length + Long.BYTES); buffer.put(indexBlock); buffer.putLong(Constant.kTableMagicNumber); return buffer.array(); } static Footer decode(byte[] bytes) { ByteBuffer buffer = ByteBuffer.wrap(bytes); byte[] indexBlockHandleBytes = new byte[BlockHandle.blockHandleSize]; buffer.get(indexBlockHandleBytes); long magic = buffer.getLong(); if (magic != Constant.kTableMagicNumber) { throw new IllegalStateException("found invalid sstable during checking magic number"); } BlockHandle indexBlockHandle = BlockHandle.decode(indexBlockHandleBytes); return new Footer(indexBlockHandle); } }
package com.bistel.mq; public class MessageInfo { private byte[] message; private String routingKey; public MessageInfo() { } public MessageInfo(String message, String routingKey) { this.message = message.getBytes(); this.routingKey = routingKey; } public byte[] getMessage() { return message; } public void setMessage(byte[] message) { this.message = message; } public String getRoutingKey() { return routingKey; } public void setRoutingKey(String routingKey) { this.routingKey = routingKey; } }
package com.kwik.infra.exception; public class KwikCommunicationException extends RuntimeException { private static final long serialVersionUID = 2085232855539649247L; public KwikCommunicationException(String message, Throwable e) { super(message, e); } }
package pl.camp.it.anonymous; public class Service { }
package com.example.weatherapp; public class WeatherInfo { String countryName; String iconName; public WeatherInfo(String countryName, int iconNumber) { this.countryName = countryName; this.iconName = iconNumberToImageName(iconNumber); } private static String iconNumberToImageName(int iconNumber) { if (iconNumber < 1 || iconNumber > 38) return "tick_weather_010"; // ? image else return String.format("tick_weather_%03d", iconNumber); } }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package DAO; import Model.Usuario; import Util.OperacoesBancoDados; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; /** * * @author Emm */ public class UsuarioDAO { OperacoesBancoDados fabrica = new OperacoesBancoDados(); public List<Usuario> consultaUsuarios(Connection conn) throws ClassNotFoundException, SQLException { String sql = "SELECT * FROM tb_usuario;"; ResultSet rs = fabrica.executaQuerieResultSet(conn, sql); return this.extrairListaUsuarios(rs); } public Usuario findUsuario(Connection conn, int id_usuario) throws ClassNotFoundException, SQLException { String sql = "SELECT * FROM tb_usuario WHERE id_usuario = " + id_usuario + ";"; ResultSet rs = fabrica.executaQuerieResultSet(conn, sql); return this.extraiUsuarioResultSet(rs); } public Usuario findByLoginSenha(Connection conn, String login, String senha) throws ClassNotFoundException, SQLException { String sql = "SELECT * FROM tb_usuario WHERE LOGIN LIKE '" + login + "' AND PASSWORD LIKE '" + senha + "'"; ResultSet rs = fabrica.executaQuerieResultSet(conn, sql); return this.extraiUsuarioResultSet(rs); } public Usuario extraiUsuarioResultSet(ResultSet rs) throws SQLException, ClassNotFoundException { Usuario usuario = new Usuario(); while (rs.next()) { usuario.setIdUsuario(rs.getInt("id_usuario")); usuario.setNome(rs.getString("nome")); usuario.setDepartamento(rs.getString("departamento")); usuario.setLogin(rs.getString("login")); usuario.setPassword(rs.getString("password")); usuario.setDataAdmissao(rs.getDate("dataAdmissao")); usuario.setAtivo(rs.getBoolean("ATIVO")); usuario.setPapelUsuario(rs.getString("papelUsuario")); } rs.close(); return usuario; } public List<Usuario> extrairListaUsuarios(ResultSet rs) throws SQLException, ClassNotFoundException { List<Usuario> listaUsuarios = new ArrayList(); while (rs.next()) { Usuario usuario = new Usuario(); usuario.setIdUsuario(rs.getInt("id_usuario")); usuario.setNome(rs.getString("nome")); usuario.setDepartamento(rs.getString("departamento")); usuario.setLogin(rs.getString("login")); usuario.setPassword(rs.getString("password")); usuario.setDataAdmissao(rs.getDate("dataAdmissao")); usuario.setAtivo(rs.getBoolean("ATIVO")); usuario.setPapelUsuario(rs.getString("papelUsuario")); listaUsuarios.add(usuario); } rs.close(); return listaUsuarios; } }
package com.lsjr.zizisteward.http; /** * */ public enum ErrorType { backgroundError, localError, netError }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package senha.Testes; import java.io.IOException; import java.sql.ClientInfoStatus; import java.sql.Connection; import java.sql.SQLException; import senha.control.ConexaoJDBC; import senha.control.SenhaAtendimentoDAO; import senha.control.SenhaGerenciaDAO; import senha.model.SenhaAtendimento; import senha.model.SenhaGerencia; /** * * @author gustavosmc */ public class TesteDao { public static void main(String...args) throws SQLException, IOException{ Connection con = ConexaoJDBC.criarConexao(); System.out.println("Nome banco : " + con.getCatalog()); System.out.println(con.getMetaData().getURL()); System.out.println(con.getMetaData().getDatabaseProductName()); System.out.println(con.getMetaData().getTypeInfo()); con.close(); } }
package L4_ExerciciosListas; import java.util.Scanner; public class Ex04_L4 { public static void main3(String[] args) { char[] letrasScanner = new char[10]; char[] letrasVogais = {'a', 'e', 'i', 'o', 'u'}; int vogaisSoma = 0; Scanner myScanner = new Scanner(System.in); System.out.println("Escreva uma sequancia de letras (Ex: abcde...)"); String sequanciaLetras = myScanner.nextLine(); for(int i=0; i<letrasScanner.length; i++){ letrasScanner[i] = myScanner.next().charAt(0); } for (int i=0; i<letrasScanner.length; i++){ for (int j=0; j<5; j++){ if (letrasScanner[i] == letrasVogais[j]) { letrasScanner[i] = ' ';//Ganbiara vogaisSoma++; } } } for (int i=0; i<letrasScanner.length; i++){ if (letrasScanner[i] != ' ') { System.out.print(letrasScanner[i] + ", "); } } System.out.println("Total de Consoantes: " + (10-vogaisSoma)); } public static void main(String[] args){ Scanner myScanner = new Scanner(System.in); System.out.println("Escreva uma sequancia de letras (Ex: abcde...)"); String sequanciaLetras = myScanner.nextLine(); String sequanciaLetrasSemVogais = sequanciaLetras.replaceAll("[aeiou]",""); if (sequanciaLetras.length() != sequanciaLetrasSemVogais.length()){ System.out.printf("1: %d, 2: %d", sequanciaLetras.length(), sequanciaLetrasSemVogais.length()); }else{ System.out.println("deu ruim"); } } }
/* * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.r2dbc.core; import java.math.BigDecimal; import java.util.Date; import java.util.List; import io.r2dbc.spi.test.MockColumnMetadata; import io.r2dbc.spi.test.MockRow; import io.r2dbc.spi.test.MockRowMetadata; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; /** * Test for R2DBC-based {@link DataClassRowMapper}. * * @author Simon Baslé * @author Juergen Hoeller * @since 6.1 */ class R2dbcDataClassRowMapperTests { @Test void staticQueryWithDataClass() { MockRow mockRow = MOCK_ROW; // uses name, age, birth_date DataClassRowMapper<ConstructorPerson> mapper = new DataClassRowMapper<>(ConstructorPerson.class); ConstructorPerson person = mapper.apply(mockRow); assertThat(person.name).as("name").isEqualTo("Bubba"); assertThat(person.age).as("age").isEqualTo(22L); assertThat(person.birth_date).as("birth_date").isNotNull(); } @Test void staticQueryWithDataClassAndGenerics() { MockRow mockRow = buildMockRow("birth_date", true); // uses name, age, birth_date, balance (as list) // TODO validate actual R2DBC Row implementations would return something for balance if requesting a List DataClassRowMapper<ConstructorPersonWithGenerics> mapper = new DataClassRowMapper<>(ConstructorPersonWithGenerics.class); ConstructorPersonWithGenerics person = mapper.apply(mockRow); assertThat(person.name()).isEqualTo("Bubba"); assertThat(person.age()).isEqualTo(22L); assertThat(person.birth_date()).usingComparator(Date::compareTo).isEqualTo(new Date(1221222L)); assertThat(person.balance()).containsExactly(new BigDecimal("1234.56")); } @Test void staticQueryWithDataRecord() { MockRow mockRow = MOCK_ROW; // uses name, age, birth_date, balance DataClassRowMapper<RecordPerson> mapper = new DataClassRowMapper<>(RecordPerson.class); RecordPerson person = mapper.apply(mockRow); assertThat(person.name()).isEqualTo("Bubba"); assertThat(person.age()).isEqualTo(22L); assertThat(person.birth_date()).usingComparator(Date::compareTo).isEqualTo(new Date(1221222L)); assertThat(person.balance()).isEqualTo(new BigDecimal("1234.56")); } @Test void staticQueryWithDataClassAndSetters() { MockRow mockRow = buildMockRow("birthdate", false); // uses name, age, birthdate (no underscore), balance DataClassRowMapper<ConstructorPersonWithSetters> mapper = new DataClassRowMapper<>(ConstructorPersonWithSetters.class); ConstructorPersonWithSetters person = mapper.apply(mockRow); assertThat(person.name()).isEqualTo("BUBBA"); assertThat(person.age()).isEqualTo(22L); assertThat(person.birthDate()).usingComparator(Date::compareTo).isEqualTo(new Date(1221222L)); assertThat(person.balance()).isEqualTo(new BigDecimal("1234.56")); } static class ConstructorPerson { final String name; final long age; final Date birth_date; public ConstructorPerson(String name, long age, Date birth_date) { this.name = name; this.age = age; this.birth_date = birth_date; } public String name() { return this.name; } public long age() { return this.age; } public Date birth_date() { return this.birth_date; } } static class ConstructorPersonWithGenerics extends ConstructorPerson { private final List<BigDecimal> balance; public ConstructorPersonWithGenerics(String name, long age, Date birth_date, List<BigDecimal> balance) { super(name, age, birth_date); this.balance = balance; } public List<BigDecimal> balance() { return this.balance; } } static class ConstructorPersonWithSetters { private String name; private long age; private Date birthDate; private BigDecimal balance; public ConstructorPersonWithSetters(String name, long age, Date birthDate, BigDecimal balance) { this.name = name.toUpperCase(); this.age = age; this.birthDate = birthDate; this.balance = balance; } public void setName(String name) { this.name = name; } public void setAge(long age) { this.age = age; } public void setBirthDate(Date birthDate) { this.birthDate = birthDate; } public void setBalance(BigDecimal balance) { this.balance = balance; } public String name() { return this.name; } public long age() { return this.age; } public Date birthDate() { return this.birthDate; } public BigDecimal balance() { return this.balance; } } record RecordPerson(String name, long age, Date birth_date, BigDecimal balance) { } static final MockRow MOCK_ROW = buildMockRow("birth_date", false); private static MockRow buildMockRow(String birthDateColumnName, boolean balanceObjectIdentifier) { MockRow.Builder builder = MockRow.builder(); builder.metadata(MockRowMetadata.builder() .columnMetadata(MockColumnMetadata.builder().name("name").javaType(String.class).build()) .columnMetadata(MockColumnMetadata.builder().name("age").javaType(long.class).build()) .columnMetadata(MockColumnMetadata.builder().name(birthDateColumnName).javaType(Date.class).build()) .columnMetadata(MockColumnMetadata.builder().name("balance").javaType(BigDecimal.class).build()) .build()) .identified(0, String.class, "Bubba") .identified(1, long.class, 22) .identified(2, Date.class, new Date(1221222L)) .identified(3, BigDecimal.class, new BigDecimal("1234.56")); if (balanceObjectIdentifier) { builder.identified(3, Object.class, new BigDecimal("1234.56")); } return builder.build(); } }
package com.pwq.Stream; import java.io.DataOutput; import java.io.DataOutputStream; import java.io.FileOutputStream; import java.io.IOException; /** * Created by pwq on 2018/1/21. */ public class DateTest { public static void main(String[] args) throws IOException { DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream("data.txt")); dataOutputStream.writeInt(997); dataOutputStream.writeInt(998); dataOutputStream.writeInt(996); dataOutputStream.close(); } }
package com.gxtc.huchuan.http.service; import com.gxtc.huchuan.bean.FocusBean; import com.gxtc.huchuan.bean.MergeMessageBean; import com.gxtc.huchuan.bean.MessageBean; import com.gxtc.huchuan.bean.PersonInfoBean; import com.gxtc.huchuan.bean.SearchChatBean; import com.gxtc.huchuan.bean.dao.User; import com.gxtc.huchuan.http.ApiBuild; import com.gxtc.huchuan.http.ApiResponseBean; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import retrofit2.http.Field; import retrofit2.http.FieldMap; import retrofit2.http.FormUrlEncoded; import retrofit2.http.POST; import rx.Observable; /** * 来自 伍玉南 的装逼小尾巴 on 17/9/8. */ public class MessageApi { private static MessageApi.Service instance; public interface Service{ //搜索好友接口 @POST("publish/search/searchFriend.do") @FormUrlEncoded Observable<ApiResponseBean<List<SearchChatBean>>> searchFriends(@FieldMap Map<String,String> map); //搜索新的朋友接口 @POST("publish/search/searchFans.do") @FormUrlEncoded Observable<ApiResponseBean<List<FocusBean>>> searchNewFriends(@FieldMap Map<String,String> map); //获取群聊列表 @POST("publish/userGroup/listGroup.do") @FormUrlEncoded Observable<ApiResponseBean<List<MessageBean>>> getGroupList(@FieldMap Map<String,String> map); //搜索群聊列表 @POST("publish/userGroup/searchUserGroup.do") @FormUrlEncoded Observable<ApiResponseBean<List<MessageBean>>> searchGroup(@FieldMap Map<String,String> map); //搜索好友接口 @POST("publish/userGroup/createGroup.do") @FormUrlEncoded Observable<ApiResponseBean<MessageBean>> createGroup(@FieldMap Map<String,String> map); //获取群聊成员列表 @POST("publish/userGroup/listMember.do") @FormUrlEncoded Observable<ApiResponseBean<List<MessageBean>>> getGroupMembers(@Field("groupId") String groupId, @Field("start") int start, @Field("pageSize") int pageSize, @Field("loagTime") long loagTime); //获取群聊成员角色 @POST("publish/userGroup/getMemberByChat.do") @FormUrlEncoded Observable<ApiResponseBean<MessageBean>> getGroupRole(@Field("token") String token, @Field("groupChatId") String groupChatId); @POST("publish/userGroup/listMember.do") @FormUrlEncoded Observable<ApiResponseBean<List<FocusBean>>> getlistMember(@Field("start") int start, @Field("groupId") String groupChatId, @Field("loagTime") long loagTime); //280. 获取被申请好友数量 @POST("publish/newsFollow/newFriends.do") @FormUrlEncoded Observable<ApiResponseBean<Object>> getNewFriendsCount(@Field("token") String token); //251. 忽略好友申请接口 @POST("publish/newsFollow/overlook.do") @FormUrlEncoded Observable<ApiResponseBean<Object>> getOverlook(@Field("token") String token, @Field("userCode") String userCode); //251. 根据手机号获取用户信息接口 @POST("publish/member/phoneByUser.do") @FormUrlEncoded Observable<ApiResponseBean<ArrayList<PersonInfoBean>>> phoneByUser(@Field("token") String token, @Field("phone") List<String> phone); //普通成员退出群聊 @POST("publish/userGroup/quitGroup.do") @FormUrlEncoded Observable<ApiResponseBean<Object>> quitGroup(@Field("userCode") String userCode, @Field("groupChatId") String groupChatId); //群主退出群聊 @POST("publish/userGroup/dissolve.do") @FormUrlEncoded Observable<ApiResponseBean<Object>> dissolve(@Field("token") String token, @Field("groupChatId") String groupChatId); //修改群聊 @POST("publish/userGroup/update.do") @FormUrlEncoded Observable<ApiResponseBean<Object>> editGroupName(@FieldMap Map<String,String> map); //加入群聊 @POST("publish/userGroup/joinGroup.do") @FormUrlEncoded Observable<ApiResponseBean<Object>> joinGroup(@FieldMap Map<String,String> map); //踢人出群聊 @POST("publish/userGroup/clean.do") @FormUrlEncoded Observable<ApiResponseBean<Object>> cleanGroup(@FieldMap Map<String,String> map); //搜索成员 @POST("publish/userGroup/searchMember.do") @FormUrlEncoded Observable<ApiResponseBean<List<MessageBean>>> searchMember(@FieldMap Map<String,String> map); //保存要合并消息内容接口 @POST("publish/mergeMessage/saveMergeMessage.do") @FormUrlEncoded Observable<ApiResponseBean<MergeMessageBean>> saveMergeMessage(@Field("token") String token , @Field("uidArray") String uidArray); //获取合并消息内容接口 @POST("publish/mergeMessage/listMergeMessageDetailed.do") @FormUrlEncoded Observable<ApiResponseBean<List<MergeMessageBean>>> getMergeMessage(@FieldMap HashMap<String, String> map); } public static MessageApi.Service getInstance() { if (instance == null) { synchronized (DealApi.class) { if (instance == null) instance = ApiBuild.getRetrofit().create(MessageApi.Service.class); } } return instance; } }
package com.trump.auction.back.sys.dao.read; import java.util.HashMap; import java.util.List; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import com.trump.auction.back.sys.model.Module; import com.trump.auction.back.sys.model.ZTree; @Repository public interface ModuleReadDao { public List<Module> findAdminAll(HashMap<String, Object> params); public List<Module> findUserAll(HashMap<String, Object> params); public List<ZTree> findAdminTree(HashMap<String, Object> params); public List<ZTree> findUserTree(HashMap<String, Object> params); public List<ZTree> findAllTreeByParentId(@Param("moduleParentId") String moduleParentId); public List<ZTree> findUserAllTreeByParentId(@Param("parentId") String moduleParentId,@Param("userId") String userId); public Module findById(Integer id); public int findModuleByUrl(HashMap<String, Object> params); }
package com.needii.dashboard.utils; import java.io.File; import com.turo.pushy.apns.ApnsClient; import com.turo.pushy.apns.ApnsClientBuilder; public class APNSSingleton { private static APNSSingleton instance; private ApnsClient client; private APNSSingleton(ApnsClient client){ this.client = client; } public static synchronized APNSSingleton getInstance(){ if(instance == null){ try { ApnsClient client = new ApnsClientBuilder() //.setApnsServer("gateway.sandbox.push.apple.com", 2195) .setApnsServer(Constants.APNS_HOST) .setClientCredentials(new File(Constants.APNS_FILE_KEY_PATH), Constants.APNS_FILE_PASSWORD) .build(); instance = new APNSSingleton(client); } catch(Exception ex) { instance = null; } } return instance; } public ApnsClient getClient() { return this.client; } }
package ru.kurtov.jgrep; public class QueueItem { public static int TERMINATOR = 1; public static int DATA = 2; public static int NOT_FOUND = 3; public static int EOF = 4; String fileName; char[] data; int type; private QueueItem(String fileName, char[] data, int type) { this.fileName = fileName; this.data = data; this.type = type; } static QueueItem getTerminatorItem() { return new QueueItem(null, null, TERMINATOR); } static QueueItem getDataItem(String fileName, char[] data) { return new QueueItem(fileName, data, DATA); } static QueueItem getNotFoundItem(String fileName) { return new QueueItem(fileName, null, NOT_FOUND); } static QueueItem getEOFItem(String fileName) { return new QueueItem(fileName, null, EOF); } public boolean isTerminator() { return this.type == TERMINATOR; } public boolean isData() { return this.type == DATA; } public boolean isNotFound() { return this.type == NOT_FOUND; } public boolean isEOF() { return this.type == EOF; } public char[] getData() { return this.data; } public String getFileName() { return this.fileName; } }
package vn.elca.training.model.entity; import javax.persistence.*; import java.io.Serializable; import java.util.HashSet; import java.util.Set; @Entity public class Employee { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) long id; @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.MERGE, CascadeType.PERSIST}) @JoinColumn private User user; @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.MERGE, CascadeType.PERSIST}) @JoinColumn private Position position; @ManyToMany( targetEntity = Project.class, cascade = {CascadeType.MERGE, CascadeType.PERSIST}, mappedBy = "employees") private Set<Project> projects = new HashSet<>(); public Employee(){} public Employee(User user, Position position){ this.user = user; this.position = position; } public void setPosition(Position position) { this.position = position; } public void setId(long id) { this.id = id; } public void setUser(User user) { this.user = user; } public long getId() { return id; } public Position getPosition() { return position; } public User getUser() { return user; } }
package com.nycab.dao; import java.util.List; import com.nycab.model.Cab; public interface CabDao { public Boolean add(Cab cab); public List<Cab> getCabs(); }
package multithreading; public class ExampleThread2 { public static void main(String[] args) { Test te=new Test(); Test t1=new Test(); Test t2=new Test(); te.start(); try { te.join(); } catch( InterruptedException e) { System.out.println("exception is "+e.getMessage()); } t1.start(); t2.start(); } } class Test extends Thread { public void run() { for(int i=0;i<=4;i++) { System.out.println("running thread is "+Test.currentThread().getName()); System.out.println("i="+i); } } }
/******************************************************************************* * Copyright (c) 2012, Eka Heksanov Lie * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the organization nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ package com.ehxnv.pvm; import com.ehxnv.pvm.api.Process; import com.ehxnv.pvm.api.ProcessInstance; import com.ehxnv.pvm.api.data.BooleanData; import com.ehxnv.pvm.api.data.Data; import com.ehxnv.pvm.api.data.DecimalData; import com.ehxnv.pvm.api.execution.ProcessExecutionException; import com.ehxnv.pvm.api.io.ProcessDataModelException; import com.ehxnv.pvm.api.io.ProcessIOException; import com.ehxnv.pvm.api.io.ProcessReader; import com.ehxnv.pvm.api.io.ProcessStructureException; import com.ehxnv.pvm.io.ProcessReaderFactory; import org.junit.Test; import java.io.File; import java.math.BigDecimal; import java.util.HashSet; import java.util.Set; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; /** * Unit test for {@link BasicProcessVirtualMachine}. * * @author Eka Lie */ public class BasicProcessVirtualMachineTest { /** * Test of execute method, of class BasicProcessVirtualMachine. */ @Test public void testExecuteWithMarriedEqTrue() throws ProcessIOException, ProcessStructureException, ProcessDataModelException, ProcessExecutionException { ProcessReader processReader = ProcessReaderFactory.createJSONProcessReader(); File file = new File("src/test/resources/com/ehxnv/pvm/basic_1.0.zip"); Process basicProcess = processReader.readProcess(file); BasicProcessVirtualMachine machine = new BasicProcessVirtualMachine(); machine.start(); Set<Data> inputDatas = new HashSet<Data>(); inputDatas.add(new BooleanData("married", Boolean.TRUE)); inputDatas.add(new DecimalData("salary", new BigDecimal(10000))); ProcessInstance processInstance = machine.execute(basicProcess, inputDatas); Set<Data> outputDatas = processInstance.getOutputDatas(); assertEquals(3, outputDatas.size()); for (Data data : outputDatas) { if (data.getName().equals("score")) { assertEquals(60, data.getValue()); } else if (data.getName().equals("salary")) { assertEquals(BigDecimal.valueOf(100000.0d), data.getValue()); } else if (data.getName().equals("status")) { assertEquals("REJECTED", data.getValue()); } else { fail(); } } } /** * Test of execute method, of class BasicProcessVirtualMachine. */ @Test public void testExecuteWithMarriedEqFalse() throws ProcessIOException, ProcessStructureException, ProcessDataModelException, ProcessExecutionException { ProcessReader processReader = ProcessReaderFactory.createJSONProcessReader(); File file = new File("src/test/resources/com/ehxnv/pvm/basic_1.0.zip"); Process basicProcess = processReader.readProcess(file); BasicProcessVirtualMachine machine = new BasicProcessVirtualMachine(); machine.start(); Set<Data> inputDatas = new HashSet<Data>(); inputDatas.add(new BooleanData("married", Boolean.FALSE)); inputDatas.add(new DecimalData("salary", new BigDecimal(0))); ProcessInstance processInstance = machine.execute(basicProcess, inputDatas); Set<Data> outputDatas = processInstance.getOutputDatas(); assertEquals(3, outputDatas.size()); for (Data data : outputDatas) { if (data.getName().equals("score")) { assertEquals(110, data.getValue()); } else if (data.getName().equals("salary")) { assertEquals(BigDecimal.valueOf(0.0d), data.getValue()); } else if (data.getName().equals("status")) { assertEquals("REJECTED", data.getValue()); } else { fail(); } } }}
package com.esum.wp.ims.batchinstancelog.service; import com.esum.appframework.service.IBaseService; public interface IBatchInstanceLogService extends IBaseService{ }
package com.kjottkaker.hellohig; import java.util.Collections; import java.util.Stack; import android.os.Bundle; import android.app.Activity; //import android.content.Intent; import android.view.Menu; import android.view.View; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import com.kjottkaker.hellohig.QAPair; public class QuizMain extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Globals g = Globals.getInstance(); g.addQuestion(getResources().getString(R.string.q1), getResources().getString(R.string.a1), getResources().getString(R.string.w1n1), getResources().getString(R.string.w2n1), getResources().getString(R.string.w3n1)); g.addQuestion(getResources().getString(R.string.q2), getResources().getString(R.string.a2), getResources().getString(R.string.w1n2), getResources().getString(R.string.w2n2), getResources().getString(R.string.w3n2)); g.addQuestion(getResources().getString(R.string.q3), getResources().getString(R.string.a3), getResources().getString(R.string.w1n3), getResources().getString(R.string.w2n3), getResources().getString(R.string.w3n3)); g.addQuestion(getResources().getString(R.string.q4), getResources().getString(R.string.a4), getResources().getString(R.string.w1n4), getResources().getString(R.string.w2n4), getResources().getString(R.string.w3n4)); g.addQuestion(getResources().getString(R.string.q5), getResources().getString(R.string.a5), getResources().getString(R.string.w1n5), getResources().getString(R.string.w2n5), getResources().getString(R.string.w3n5)); g.addQuestion(getResources().getString(R.string.q6), getResources().getString(R.string.a6), getResources().getString(R.string.w1n6), getResources().getString(R.string.w2n6), getResources().getString(R.string.w3n6)); g.addQuestion(getResources().getString(R.string.q7), getResources().getString(R.string.a7), getResources().getString(R.string.w1n7), getResources().getString(R.string.w2n7), getResources().getString(R.string.w3n7)); g.addQuestion(getResources().getString(R.string.q8), getResources().getString(R.string.a8), getResources().getString(R.string.w1n8), getResources().getString(R.string.w2n8), getResources().getString(R.string.w3n8)); g.addQuestion(getResources().getString(R.string.q9), getResources().getString(R.string.a9), getResources().getString(R.string.w1n9), getResources().getString(R.string.w2n9), getResources().getString(R.string.w3n9)); g.addQuestion(getResources().getString(R.string.q10), getResources().getString(R.string.a10), getResources().getString(R.string.w1n10), getResources().getString(R.string.w2n10), getResources().getString(R.string.w3n10)); g.shuffle(); // Randomise the order of QAPs ask(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_quiz_main, menu); return true; } public void ask() { Globals g = Globals.getInstance(); QAPair q = g.getQuestion(); // Get a QAP setContentView(R.layout.activity_quiz_main); // Headline/Question text TextView question = (TextView) findViewById(R.id.question); question.setText(q.question); // Randomise answers Stack a = new Stack(); a.push(new String(q.answer)); a.push(new String(q.alternative1)); a.push(new String(q.alternative2)); a.push(new String(q.alternative3)); Collections.shuffle(a); // Radio buttons RadioButton answer1 = (RadioButton) findViewById(R.id.answer1); answer1.setText((String) a.pop()); RadioButton answer2 = (RadioButton) findViewById(R.id.answer2); answer2.setText((String) a.pop()); RadioButton answer3 = (RadioButton) findViewById(R.id.answer3); answer3.setText((String) a.pop()); RadioButton answer4 = (RadioButton) findViewById(R.id.answer4); answer4.setText((String)a.pop()); } public void next(View next){ Globals g = Globals.getInstance(); if (g.getAsked() >= 10) { //Intent i = new Intent(this, Result.class); //startActivity(i); return; } RadioGroup answers = (RadioGroup) findViewById(R.id.group1); int selected = answers.getCheckedRadioButtonId(); RadioButton answer = (RadioButton) findViewById(selected); if (answer.getText() == g.getAnswer()) g.right(); g.ask(); ask(); } }
package EXAMS.E05.spaceStation; import EXAMS.E05.spaceStation.core.Controller; import EXAMS.E05.spaceStation.core.ControllerImpl; import EXAMS.E05.spaceStation.core.Engine; import EXAMS.E05.spaceStation.core.EngineImpl; public class Main { public static void main(String[] args) { Controller controller = new ControllerImpl(); Engine engine = new EngineImpl(controller); engine.run(); } }
package com.evlj.searchmovie.shared.bindings; import android.databinding.BindingAdapter; import android.support.annotation.Nullable; import android.widget.ImageView; import com.squareup.picasso.Picasso; public final class ImageViewBindingAdapter { private ImageViewBindingAdapter() { throw new UnsupportedOperationException("This is a pure static class!"); } @BindingAdapter(value = {"imageUrl", "centerCrop"}, requireAll = false) public static void loadImage(ImageView imageView, @Nullable String url, boolean centerCrop) { Picasso.get() .load(url) .into(imageView); } }
package lawscraper.server.service; import lawscraper.server.entities.law.Law; import lawscraper.server.entities.law.LawDocumentPart; import java.util.List; /** * Created by erik, IT Bolaget Per & Per AB * Date: 1/2/12 * Time: 8:53 PM */ public interface LawService { Law find(Long id); List<Law> findAll(); HTMLWrapper findLawHTMLWrapped(Long id); HTMLWrapper findLawHTMLWrappedByLawKey(String lawKey); List<Law> findLawByQuery(String query); LawDocumentPart findLawDocumentPart(Long documentPartId); }
package org.kuali.ole.ingest; import org.kuali.ole.OLEConstants; import org.kuali.ole.OleOrderRecordHandler; import org.kuali.ole.OleOrderRecords; import org.kuali.ole.converter.MarcXMLConverter; import org.kuali.ole.converter.OLEEDIConverter; import org.kuali.ole.docstore.model.xmlpojo.ingest.Request; import org.kuali.ole.docstore.model.xmlpojo.ingest.RequestDocument; import org.kuali.ole.docstore.model.xstream.ingest.RequestHandler; import org.kuali.ole.describe.service.DocstoreHelperService; import org.kuali.ole.pojo.OleBibRecord; import org.kuali.ole.pojo.OleOrderRecord; import org.kuali.ole.select.service.impl.OleExposedWebServiceImpl; import org.kuali.ole.sys.context.SpringContext; import org.kuali.rice.core.api.config.property.ConfigContext; import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; import org.kuali.rice.krms.api.engine.EngineResults; import org.xml.sax.SAXException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; /** * IngestProcessor converts the marcFileContent in to marcXmlContent,ediFileContent in to ediXMLContent and also * creates Requisition and Purchase Order based on oleOrderRecordXml */ public class IngestProcessor extends AbstractIngestProcessor { /** * This method modify the marcFileContent in to marcXmlContent. * @param marcFileContent * @return modifiedXMLContent. */ @Override public String preProcessMarc(String marcFileContent) { String marcXMLContent = null; MarcXMLConverter marcXMLConverter = new MarcXMLConverter(); marcXMLContent = marcXMLConverter.convert(marcFileContent); //TODO: hack to get rid of the extra xmlns entry. Not sure why the second entry gets generated when calling marc4J in ole-docstore-utility. //TODO: the duplicate entry does not get genereated if its run directly in the ole-docstore-utilty project. String modifiedXMLContent = marcXMLContent. replace("collection xmlns=\"http://www.loc.gov/MARC21/slim\" xmlns=\"http://www.loc.gov/MARC21/slim", "collection xmlns=\"http://www.loc.gov/MARC21/slim"); return modifiedXMLContent; } /** * This method converts the ediFileContent in to ediXMLContent. * @param ediFileContent * @return ediXMLContent. */ @Override public String preProcessEDI(String ediFileContent) { String ediXMLContent = null; OLEEDIConverter oleEDIConverter = new OLEEDIConverter(); try { ediXMLContent = oleEDIConverter.convertToXML(ediFileContent); } catch (IOException e) { System.out.println(e.getMessage()); } catch (SAXException e) { System.out.println(e.getMessage()); } return ediXMLContent; } /** * This method creates Requisition and Purchase Order based on oleOrderRecordXml. * The oleExposedWebService will call the createReqAndPO method in oleRice1 and creates the requisition and PO. */ @Override public void postProcess() { OleOrderRecords oleOrderRecords = null; try { oleOrderRecords = new OleOrderRecords(); List<EngineResults> engineResults = getEngineResults(); List<OleOrderRecord> oleOrderRecordList = new ArrayList(); for (Iterator<EngineResults> iterator = engineResults.iterator(); iterator.hasNext(); ) { EngineResults results = iterator.next(); OleOrderRecord oleOrderRecord = (OleOrderRecord) results.getAttribute(OLEConstants.OLE_ORDER_RECORD); oleOrderRecordList.add(oleOrderRecord); } oleOrderRecords.setRecords(oleOrderRecordList); OleOrderRecordHandler oleEditorResponseHandler = new OleOrderRecordHandler(); String oleOrderRecordXml = oleEditorResponseHandler.toXML(oleOrderRecords); OleExposedWebServiceImpl oleExposedWebService = (OleExposedWebServiceImpl)SpringContext.getBean("oleExposedWebService"); oleExposedWebService.createReqAndPO(oleOrderRecordXml); } catch (Exception e) { System.out.println(e.getMessage()); String xmlForRollback = buildRequestForRollback(oleOrderRecords); DocstoreHelperService docstoreHelperService = GlobalResourceLoader.getService(OLEConstants.DOCSTORE_HELPER_SERVICE); try { docstoreHelperService.rollbackData(xmlForRollback); } catch (Exception e1) { System.out.println(e1.getMessage()); } } } /** * This method builds the request to Rollback the LinkedDocs for failure transactions. * @param oleOrderRecords * @return xml */ private String buildRequestForRollback(OleOrderRecords oleOrderRecords) { String xml = null; for (Iterator<OleOrderRecord> iterator = oleOrderRecords.getRecords().iterator(); iterator.hasNext(); ) { OleOrderRecord oleOrderRecord = iterator.next(); OleBibRecord oleBibRecord = oleOrderRecord.getOleBibRecord(); String bibUUID = oleBibRecord.getBibUUID(); RequestHandler requestHandler = new RequestHandler(); Request request = new Request(); request.setOperation("deleteWithLinkedDocs"); RequestDocument requestDocument = new RequestDocument(); requestDocument.setId(bibUUID); request.setRequestDocuments(Arrays.asList(requestDocument)); xml = requestHandler.toXML(request); } return xml; } /** * Gets the oleExposedWebService url from PropertyUtil. * @return url. */ public String getURL() { String url = ConfigContext.getCurrentContextConfig().getProperty("oleExposedWebService.url"); return url; } }
package io.papermc.hangar.security; import io.papermc.hangar.model.NamedPermission; import org.springframework.security.core.GrantedAuthority; /** * @deprecated Not used atm. This can be used if we want to store global roles on the auth model */ @Deprecated public class PermissionAuthority implements GrantedAuthority { private final NamedPermission permission; public PermissionAuthority(NamedPermission permission) { this.permission = permission; } @Override public int hashCode() { return this.permission.hashCode(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof PermissionAuthority) { return permission == (((PermissionAuthority) obj).permission); } return false; } @Override public String toString() { return permission.toString(); } @Override public String getAuthority() { return null; } }
package kz.greetgo.file_storage.impl; import java.sql.Connection; import java.sql.SQLException; import java.util.Map; import javax.sql.DataSource; import kz.greetgo.file_storage.impl.jdbc.Query; public class MultiDbOperationsOracle extends MultiDbOperationsPostgres { @Override protected String strType(int len) { return "varchar2(" + len + ")"; } @Override protected String timestampType() { return "timestamp"; } @Override protected String blobType() { return "blob"; } @Override protected String currentTimestampFunc() { return "systimestamp"; } @Override public void updateParam(String fileId, Map<String, String> param, DataSource dataSource, String tableName, TableFieldNamesForParam names) { try (Connection connection = dataSource.getConnection(); Query query = new Query(connection)) { { if (!param.isEmpty()) { param.forEach((key, value) -> { query.sql.append("merge into ").append(tableName).append(" source using (select "); query.sql.append("? ").append(names.id).append(", "); query.sql.append("? ").append(names.name).append(", "); query.sql.append("? ").append(names.value); query.sql.append(" from dual) val "); query.params.add(fileId); query.params.add(key); query.params.add(value); query.sql.append("on ( "); query.sql.append("source.").append(names.id).append(" = ").append("val.").append(names.id); query.sql.append(" and "); query.sql.append("source.").append(names.name).append(" = ").append("val.").append(names.name); query.sql.append(" ) "); query.sql.append("when matched then "); query.sql.append("update set "); query.sql.append("source.").append(names.value).append(" = ").append("val.").append(names.value); query.sql.append(" when not matched then "); query.sql.append("insert ( ").append(names.id).append(", ").append(names.name).append(", ").append(names.value).append(" ) "); query.sql.append("values ( "); query.sql.append("val.").append(names.id).append(", "); query.sql.append("val.").append(names.name).append(", "); query.sql.append("val.").append(names.value); query.sql.append(") "); try { query.update(); } catch (SQLException e) { throw new RuntimeException("e.getSQLState() = " + e.getSQLState() + " :: " + e.getMessage(), e); } }); } } } catch (SQLException e) { throw new RuntimeException("e.getSQLState() = " + e.getSQLState() + " :: " + e.getMessage(), e); } } }
package com.szhrnet.taoqiapp.utils; import android.util.Log; import com.szhrnet.taoqiapp.BuildConfig; /** * <pre> * author: MakeCodeFly * desc : LogUtils类 * email:15695947865@139.com * </pre> */ public class LogUtils { public static void d(String tag, String message) { if (BuildConfig.LOG_DEBUG) Log.d(tag, message); } public static void e(String tag, String message) { if (BuildConfig.LOG_DEBUG) Log.e(tag, message); } }
package ru.avokin.uidiff.diff.folderdiff.view; import ru.avokin.uidiff.diff.common.model.DiffSideModel; import ru.avokin.uidiff.diff.common.view.AbstractDiffSidePanel; import ru.avokin.uidiff.diff.folderdiff.model.DiffFileTreeNode; import ru.avokin.uidiff.diff.folderdiff.model.DiffTreeModel; import ru.avokin.uidiff.diff.folderdiff.model.FolderDiffSideModel; import javax.swing.*; import javax.swing.tree.TreePath; import java.awt.*; /** * User: Andrey Vokin * Date: 01.10.2010 */ public class FolderDiffSidePanel extends AbstractDiffSidePanel { private JTree tree; private JScrollPane scrollPane; public FolderDiffSidePanel(FolderDiffSideModel model, boolean left) { super(model, left); } @Override protected JComponent createDiffSideView(DiffSideModel model, boolean left) { FolderDiffSideModel folderDiffSideModel = (FolderDiffSideModel) model; tree = new JTree(folderDiffSideModel.getTreeModel()); FolderDiffTreeUI ui = new FolderDiffTreeUI(); tree.setUI(ui); tree.setCellRenderer(ui.getCellRenderer()); scrollPane = new JScrollPane(tree, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); if (left) { scrollPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } return scrollPane; } protected FolderDiffSideModel getModel() { return (FolderDiffSideModel) model; } @Override public void selectDifference(int number, boolean withScrolling) { DiffTreeModel treeModel = getModel().getTreeModel(); DiffFileTreeNode node = treeModel.getDifference(number); if (node != null) { TreePath tp = new TreePath(node.getPath()); tree.setSelectionPath(tp); tree.scrollPathToVisible(tp); } } @Override public JScrollBar getHorizontalScrollBar() { return scrollPane.getHorizontalScrollBar(); } @Override public JScrollBar getVerticalScrollBar() { return scrollPane.getVerticalScrollBar(); } public JTree getTree() { return tree; } }
package edu.uml.nschell; public class Encryption { public static String encryptText(String st) throws Exception { String encrypt = new StringBuilder(st).reverse().toString(); return encrypt; } }
package br.com.bd1start.aula2; import org.junit.Assert; import org.junit.Test; import br.com.db1start.aula2.ExercicioDeString; public class ExercicioDeStringTeste { // Exercicio String 1 @Test public void deveRetornarToUppercase() { ExercicioDeString exercicio = new ExercicioDeString(); String resultado = exercicio.devolverUppercase("Algoritmos"); Assert.assertEquals("ALGORITMOS", resultado); } // Exercicio String 2 @Test public void deveRetornaToLowercase() { ExercicioDeString exercicio = new ExercicioDeString(); String resultado = exercicio.devolverLowercase("ALGORITMOS"); Assert.assertEquals("algoritmos", resultado); } // Exercicio String 3 @Test public void deveRetornarQtDeLetras() { ExercicioDeString exercicio = new ExercicioDeString(); int resultado = exercicio.contarCaracteres("DB1START"); Assert.assertEquals(8, resultado); } // Exercicio String 4 @Test public void deveRetornarQtDeCaracteres2() { ExercicioDeString exercicio = new ExercicioDeString(); int resultado = exercicio.contarCaracteres(" DB1START "); Assert.assertEquals(10, resultado); } // Exercicio String 5 @Test public void contarSemEspaco() { ExercicioDeString exercicio = new ExercicioDeString(); int resultado = exercicio.contarLetrasSemEspacos(" DB1START "); Assert.assertEquals(8, resultado); } // Exercicio String 6 @Test public void letrasNome() { ExercicioDeString exercicio = new ExercicioDeString(); String texto = exercicio.textoCortado("Lana Ananias Tormena"); Assert.assertEquals("Lana", texto); } // Exercicio String 7 @Test public void letrasNomeTerceiraEmDiante() { ExercicioDeString exercicio = new ExercicioDeString(); String texto = exercicio.textoCortado2("Lana Ananias Tormena"); Assert.assertEquals("na Ananias Tormena", texto); } // Exercicio String 8 @Test public void letrasNome4Ultimas() { ExercicioDeString exercicio = new ExercicioDeString(); String texto = exercicio.textoCortado3("Lana Ananias Tormena"); Assert.assertEquals("mena", texto); } // Exercicio String 9 @Test public void substituirPrimeiroNomePorALUNA() { ExercicioDeString exercicio = new ExercicioDeString(); String texto = exercicio.substituirPrimeiroNome("Lana Ananias Tormena"); Assert.assertEquals("ALUNA Ananias Tormena", texto); } // Exercicio String 10 @Test public void stringOrdenada() { ExercicioDeString exercicio = new ExercicioDeString(); String[] texto = exercicio.StringOrdenada("banana,maçã,melancia"); Assert.assertArrayEquals(new String [] {"banana", "maçã", "melancia"}, texto); } // Exercicio String 11 @Test public void qtdeVogais() { ExercicioDeString exercicio = new ExercicioDeString(); int resultado = exercicio.contarVogais("Comunidade"); Assert.assertEquals(5, resultado); } // Exercicio String 12 @Test public void inversorDeString() { ExercicioDeString exercicio = new ExercicioDeString(); String texto = exercicio.stringInvertida("texto"); Assert.assertEquals("otxet", texto); } }
/* Copyright 2021 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package functions; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutureCallback; import com.google.api.core.ApiFutures; import com.google.api.services.cloudresourcemanager.CloudResourceManager; import com.google.cloud.compute.v1.Network; import com.google.cloud.compute.v1.Quota; import com.google.cloud.pubsub.v1.Publisher; import com.google.common.reflect.TypeToken; import com.google.common.util.concurrent.MoreExecutors; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.protobuf.ByteString; import com.google.pubsub.v1.PubsubMessage; import functions.eventpojos.Notification; import java.io.IOException; import java.lang.reflect.Type; import java.security.GeneralSecurityException; import java.util.Arrays; import java.util.HashMap; import java.util.SortedMap; import java.util.TreeMap; import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; /* * Helper class for ScanProject Cloud Function * */ public class ScanProjectHelper { // Max VPC Peering Count private static final Integer MAX_VPC_PEERING_COUNT = 25; // Max VPC Sub Network Count private static final Integer MAX_VPC_SUB_NETWORK_COUNT = 100; private static final Logger logger = Logger.getLogger(ScanProjectHelper.class.getName()); /* * API to get Cloud Resource Manager Service * */ static CloudResourceManager createCloudResourceManagerService() throws IOException, GeneralSecurityException { HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); GoogleCredential credential = GoogleCredential.getApplicationDefault(); if (credential.createScopedRequired()) { credential = credential.createScoped(Arrays.asList("https://www.googleapis.com/auth/cloud-platform")); } return new CloudResourceManager.Builder(httpTransport, jsonFactory, credential) .setApplicationName("Google-CloudResourceManagerSample/0.1") .build(); } /* * API to send notification * */ public static void sendNotification(Notification notification) throws InterruptedException, IOException { GsonBuilder gb = new GsonBuilder(); gb.serializeSpecialFloatingPointValues(); Gson gson = gb.create(); // Java object to JSON string String jsonInString = gson.toJson(notification); Publisher publisher = null; try { publisher = Publisher.newBuilder(ScanProject.NOTIFICATION_TOPIC).build(); ByteString data = ByteString.copyFromUtf8(jsonInString); PubsubMessage pubsubMessage = PubsubMessage.newBuilder().setData(data).build(); ApiFuture<String> messageIdFuture = publisher.publish(pubsubMessage); ApiFutures.addCallback( messageIdFuture, new ApiFutureCallback<String>() { public void onSuccess(String messageId) { logger.info("published notification with message id: " + messageId); } public void onFailure(Throwable t) { logger.log(Level.SEVERE, "Error publishing Pub/Sub message: " + t.getMessage(), t); } }, MoreExecutors.directExecutor()); } finally { if (publisher != null) { publisher.shutdown(); publisher.awaitTermination(1, TimeUnit.MINUTES); } } } /* * Build Json for BigQuery row for default quotas * * */ static String buildQuotaRowJson(Quota quota, String orgId, String projectId, String regionId) throws IOException, InterruptedException { SortedMap<String, String> elements = new TreeMap(); double consumption = (quota.getUsage() / quota.getLimit()) * 100; elements.put("threshold", ScanProject.THRESHOLD); elements.put("org_id", orgId); elements.put("project", projectId); elements.put("region", regionId); elements.put("metric", quota.getMetric()); elements.put("limit", String.valueOf(quota.getLimit())); elements.put("usage", String.valueOf(quota.getUsage())); elements.put("value", String.valueOf(consumption)); elements.put("addedAt", "AUTO"); elements.put("folder_id", "NA"); elements.put("vpc_name", "NA"); elements.put("targetpool_name", "NA"); Gson gson = new Gson(); Type gsonType = new TypeToken<HashMap>() {}.getType(); String gsonString = gson.toJson(elements, gsonType); Notification notification = new Notification(); notification.setConsumption(consumption); notification.setLimit(quota.getLimit()); notification.setMetric(quota.getMetric()); notification.setUsage(quota.getUsage()); ScanProject.checkThreshold(notification); return gsonString; } /* * Build Json for BigQuery row of Subnet Quota * @TODO Reduce QuotaRowJson APIs to single API * */ static String buildSubnetQuotaRowJson(Network network, String orgId, String projectId) { int vpcPeeringCount = network.getSubnetworksList() == null ? 0 : network.getSubnetworksList().size(); SortedMap<String, String> elements = new TreeMap(); elements.put("threshold", ScanProject.THRESHOLD); elements.put("org_id", orgId); elements.put("project", projectId); elements.put("region", "global"); elements.put("metric", "SUBNET_PER_VPC"); elements.put("limit", String.valueOf(MAX_VPC_SUB_NETWORK_COUNT)); elements.put("usage", String.valueOf(vpcPeeringCount)); elements.put("value", String.valueOf((vpcPeeringCount / MAX_VPC_SUB_NETWORK_COUNT) * 100)); elements.put("addedAt", "AUTO"); elements.put("folder_id", "NA"); elements.put("vpc_name", network.getName()); elements.put("targetpool_name", "NA"); Gson gson = new Gson(); Type gsonType = new TypeToken<HashMap>() {}.getType(); String gsonString = gson.toJson(elements, gsonType); return gsonString; } /* * Build Json for BigQuery row of VPC Quota * */ static String buildVPCQuotaRowJson(Network network, String orgId, String projectId) { int vpcPeeringCount = network.getPeeringsList() == null ? 0 : network.getPeeringsList().size(); SortedMap<String, String> elements = new TreeMap(); elements.put("threshold", ScanProject.THRESHOLD); elements.put("org_id", orgId); elements.put("project", projectId); elements.put("region", "global"); elements.put("metric", "VPC_PEERING"); elements.put("limit", String.valueOf(MAX_VPC_PEERING_COUNT)); elements.put("usage", String.valueOf(vpcPeeringCount)); elements.put("value", String.valueOf((vpcPeeringCount / MAX_VPC_PEERING_COUNT) * 100)); elements.put("addedAt", "AUTO"); elements.put("folder_id", "NA"); elements.put("vpc_name", network.getName()); elements.put("targetpool_name", "NA"); Gson gson = new Gson(); Type gsonType = new TypeToken<HashMap>() {}.getType(); String gsonString = gson.toJson(elements, gsonType); return gsonString; } }
package multithreading; import java.util.Scanner; class HusbandThread implements Runnable{ Thread husband; Bank b; HusbandThread(Bank b) { this.b=b; husband=new Thread(this,"depositthread"); husband.start(); } public void run() { b.deposit(); } } class WifeThread implements Runnable { Thread wife; Bank b; WifeThread(Bank b) { this.b=b; wife=new Thread(this,"withdrawthread"); wife.start(); } public void run() { b.withdraw(); } } class Bank { private volatile double balance=50000; private int withdraw; private int depositamt; public double deposit() { try{ Scanner sc = new Scanner(System.in); System.out.println("balance before deposit:"+balance); Thread.sleep(1000); System.out.println("Enter amount:"); depositamt=sc.nextInt(); Thread.sleep(1000); balance=balance+depositamt; Thread.sleep(1500); System.out.println("balance after deposit:"+balance); } catch(InterruptedException e) { e.printStackTrace(); } return balance; } public double withdraw() { try{ Scanner sc = new Scanner(System.in); System.out.println("balance before withdraw:"+balance); Thread.sleep(1000); System.out.println("Enter amount:"); withdraw=sc.nextInt(); Thread.sleep(1000); balance=balance-withdraw; Thread.sleep(1500); System.out.println("balance after withdraw:"+balance); } catch(Exception e){ e.printStackTrace(); } return balance; } } /*public class Synchronized Thread { public static void main(String args[]) { Bank b = new Bank(); HusbandThread ht = new HusbandThread(b); WifeThread wt = new WifeThread(b); } }*/
package it.uniroma3.siw.photo.controllers; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import it.uniroma3.siw.photo.models.Photo; import it.uniroma3.siw.photo.services.AlbumService; import it.uniroma3.siw.photo.services.PhotoService; import it.uniroma3.siw.photo.services.PhotographerService; @Controller public class GalleryController { @Autowired private PhotoService photoService; @Autowired private AlbumService albumService; @Autowired private PhotographerService photographerService; @GetMapping(value = "/galleryByPhotos") public String galleryByPhotos(@RequestParam(value = "filter", required = false) String filter, @RequestParam(value = "albumName", required = false) String albumName, @RequestParam(value = "photographerName", required = false) String photographerName, @RequestParam(value = "addedPhotoId", required = false) Long addedPhotoId, Model model, HttpSession session) { @SuppressWarnings("unchecked") List<Photo> selectedPhotos = (List<Photo>)session.getAttribute("selectedPhotos"); model.addAttribute("photosNumber", selectedPhotos.size()); if (filter != null) { model.addAttribute("photos", this.photoService.findByName(filter)); return "/guest/galleryByPhotos.html"; } else if (albumName != null) { model.addAttribute("photos", this.albumService.findByName(albumName).getPhotos()); return "/guest/galleryByPhotos.html"; } else if (photographerName != null) { model.addAttribute("photos", this.photographerService.findByName(photographerName).getPhotos()); return "/guest/galleryByPhotos.html"; } else if (addedPhotoId != null) { Photo ph = photoService.findById(addedPhotoId); boolean find = false; for(Photo photo : selectedPhotos) { if(ph.getId() == photo.getId()) find = true; } if(!find) { selectedPhotos.add(ph); session.setAttribute("selectedPhotos", selectedPhotos); model.addAttribute("photosNumber", selectedPhotos.size()); } } model.addAttribute("photos", this.photoService.findAll()); return "/guest/galleryByPhotos.html"; } @GetMapping(value = "/galleryByAlbums") public String galleryByAlbums(Model model) { model.addAttribute("albums", this.albumService.findAll()); return "/guest/galleryByAlbums.html"; } @GetMapping(value = "/galleryByPhotographers") public String galleryByPhotographers(Model model) { model.addAttribute("photographers", this.photographerService.findAll()); return "/guest/galleryByPhotographers.html"; } @RequestMapping(value = "/") public String index(Model model, HttpSession session) { List<Photo> selectedPhotos = new ArrayList<Photo>(); session.setAttribute("selectedPhotos", selectedPhotos); model.addAttribute("photosNumber", 0); model.addAttribute("photos", this.photoService.findAll()); return "/guest/galleryByPhotos.html"; } }
package com.binarysprite.evemat.page.blueprint.data; import java.io.Serializable; /** * * @author Tabunoki * */ public class GroupSelect implements Serializable { private final int id; private final String groupName; public GroupSelect(int id, String groupName) { super(); this.id = id; this.groupName = groupName; } /** * @return the id */ public int getId() { return id; } /** * @return the groupName */ public String getGroupName() { return groupName; } }
package org.springframework.stereotype; import java.lang.annotation.*; /** * @author kaiwen * @create 2019-05-14 17:08 * @since 1.0 **/ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Controller { String value() default ""; }
/** * File : RetrieveVideo.java * * Author : Elena Villalón * * Contents : It retrieves videos in table TbVideo of the Mckoi * database (see TableCreate) using PreparedStatemnt. * * * Uses: Video, */ package jmckoi; import jVideos.Video; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.Timestamp; import java.util.logging.Level; import java.util.logging.Logger; import Jama.Matrix; import cern.colt.matrix.impl.SparseDoubleMatrix2D; public class RetrieveVideo extends ConnectDataBase { Video vid; Timestamp ts = new Timestamp(System.currentTimeMillis()); String keySelect = "all"; String tabname ="TbVideoColt"; boolean colt = true; private static Logger mLog = Logger.getLogger(RetrieveVideo.class.getName()); private static boolean debug = false; public Video getVideo(){ return vid; } public String getkeySelect(){ return keySelect; } public Timestamp getTs() { return ts; } public void debug(){ if(!debug) mLog.setLevel(Level.WARNING); } public RetrieveVideo(){ debug(); vid = null; getVideo(); } public RetrieveVideo(String key){ debug(); keySelect = key.trim(); findVideo(); } public RetrieveVideo(String key, String tabname){ debug(); keySelect = key.trim(); this.tabname = tabname; if(!tabname.contentEquals("TbVideoColt")) this.colt = false; findVideo(); } public void findVideo( ){ tabname.trim(); if(!keySelect.equals("all")) mLog.info("Video url " + keySelect); else mLog.info("All videos in database selected"); String key=""; String desc=""; long nofrm=0; float stream = 0.0f; //connect to database Connection con = super.getConnection(); if(con == null) con = super.connection; Statement stmt=null; mLog.info("Sucessful connection..."); try { // Create a Statement object to execute the queries on, stmt = con.createStatement(); String query = "SELECT stmpt, "; //time-stamp if(!colt){ query = query + " redMat, " + //matrix R " greenMat, " + //matrix G " blueMat, "; //matrix B }else{ query = query + " redColt, " + //matrix R " greenColt, " + //matrix G " blueColt, " ; //matrix B } query = query + " formatDesc," + //format description " numFrm, " + //number of frames " tmStream," + //duration of stream " urlLoc"; //video url if(!colt) query = query + " FROM TbVideo "; else query = query + " FROM TbVideoColt "; mLog.info(""+ keySelect.trim().length()); if (keySelect.trim().length() > 0 && !keySelect.contentEquals("all")){ query = query + "WHERE urlLoc LIKE '" + keySelect + "'"; } ResultSet rs = stmt.executeQuery(query); while (rs.next()) { ts = rs.getTimestamp(1); Matrix red; Matrix green; Matrix blue; if(!colt){ red = (Matrix) rs.getObject(2); green = (Matrix) rs.getObject(3); blue = (Matrix) rs.getObject(4); }else{ SparseDoubleMatrix2D red2D = (SparseDoubleMatrix2D) rs.getObject(2); red = new Matrix(red2D.toArray()); SparseDoubleMatrix2D green2D = (SparseDoubleMatrix2D) rs.getObject(3); green = new Matrix(green2D.toArray()); SparseDoubleMatrix2D blue2D = (SparseDoubleMatrix2D) rs.getObject(4); blue = new Matrix(blue2D.toArray()); } desc = (String) rs.getString(5); nofrm = (long) rs.getLong(6); stream = (float) rs.getFloat(7); key = (String) rs.getString(8); if(debug) blue.print(1, 0); this.vid = new Video(red, green, blue, desc, nofrm, stream); this.vid.setPrimaryKey(key); } }catch (SQLException e) { mLog.severe( "An error occured\n" + "The SQLException message is: " + e.getMessage()); e.printStackTrace(); } // Close the the connection. try { con.close(); mLog.info("Connection to database close"); }catch (SQLException e2) { e2.printStackTrace(System.err); } } public static void main(String[] args) { RetrieveVideo vget; String keySelect = ""; String tabname = "TbVideoColt"; if(args.length == 0){ vget = new RetrieveVideo("all"); }else if (args.length == 1){ keySelect = new String(args[0]); keySelect = keySelect.trim(); mLog.info("Video url selection is " + keySelect); vget = new RetrieveVideo(keySelect); }else if (args.length > 1){ keySelect = new String(args[0]); keySelect = keySelect.trim(); tabname = args[1].trim(); mLog.info("Video url " + keySelect + "; table "+ tabname); vget = new RetrieveVideo(keySelect, tabname); } System.exit(0); } }
package io.qtechdigital.onlineTutoring.dto.hateoas; import com.fasterxml.jackson.annotation.JsonProperty; import org.springframework.hateoas.ResourceSupport; import java.io.Serializable; public class BaseResource extends ResourceSupport implements Serializable { @JsonProperty public Long id; public Long getBaseId() { return id; } public void setBaseId(Long id) { this.id = id; } }
package util; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JComponent; import javax.swing.JLabel; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.Vector; import util.LinkLabel; // mdb added 7/15/09 #166 - a URL-savvy graphical text box @SuppressWarnings("serial") // Prevent compiler warning for missing serialVersionUID public class TextBox extends JComponent { private static final Color bgColor = Color.yellow; private static final int INSET = 5; private static final int startWidth = 600; private static final int startHeight = 200; private boolean bFullSize = true; private int trueWidth = 0; public TextBox(Vector<String> text, Font font, int x, int y, int wrapLen, int truncLen) { this(text.toArray(new String[0]), font, x, y, wrapLen, truncLen); } public TextBox(String text, Font font, int x, int y, int wrapLen, int truncLen) { this(text.split("\n"), font, x, y, wrapLen, truncLen); } // WMN 1/12/12 modified to wrap and trucate, with considerable duplicated code private TextBox(String[] text, Font font, int x, int y,int wrapLen, int truncLen) { int width = 0; int tx = INSET; int ty = INSET; for (String line : text) { int urlIndex = line.indexOf("=http://"); if (urlIndex > -1) { // this line contains a URL String tag = line.substring(0, urlIndex); String url = line.substring(urlIndex+1); JLabel label = new LinkLabel(tag, Color.black, Color.red, url); label.setLocation(tx, ty); label.setFont(font); label.setSize(label.getMinimumSize()); add(label); ty += label.getHeight(); width = Math.max(width, label.getWidth() + INSET*2); trueWidth = Math.max(trueWidth, label.getWidth() + INSET*2); if (width > startWidth) { bFullSize = false; width = startWidth; } } else { if (line.length() <= wrapLen) { JLabel label = new JLabel(line); label.setLocation(tx, ty); label.setFont(font); label.setSize(label.getMinimumSize()); add(label); ty += label.getHeight(); width = Math.max(width, label.getWidth() + INSET*2); trueWidth = Math.max(trueWidth, label.getWidth() + INSET*2); if (width > startWidth) { bFullSize = false; width = startWidth; } } else { String[] words = line.split("\\s+"); StringBuffer curLine = new StringBuffer(); int totalLen = 0; for (int i = 0; i < words.length; i++) { curLine.append(" "); curLine.append(words[i]); totalLen += 1 + words[i].length(); int curLen = curLine.length(); if (curLen >= wrapLen || i == words.length - 1) { // done with this line, but add "..." if being truncated if (i < words.length - 1 && totalLen >= truncLen) { curLine.append("..."); } if (curLine.length() > 1.25*wrapLen) { curLine.delete((int)(1.25*wrapLen),curLine.length()); curLine.append("..."); } JLabel label = new JLabel(curLine.toString()); label.setLocation(tx, ty); label.setFont(font); label.setSize(label.getMinimumSize()); add(label); ty += label.getHeight(); width = Math.max(width, label.getWidth() + INSET*2); trueWidth = Math.max(trueWidth, label.getWidth() + INSET*2); if (width > startWidth) { bFullSize = false; width = startWidth; } if (totalLen >= truncLen) break; // note, don't truncate until filling a line curLine = new StringBuffer(); } } } } } if (false && !bFullSize) { JLabel label = new ExpandLabel("expand", this); label.setLocation(tx,ty); label.setFont(font); label.setSize(label.getMinimumSize()); add(label); ty += label.getHeight(); } setSize(width, ty + INSET); setLocation(x, y); } public void paintComponent(Graphics g) { //super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; int width = getWidth()-1; int height = getHeight()-1; // Draw rectangle g2.setColor(bgColor); g2.fillRect(0, 0, width, height); g2.setColor(Color.black); g2.drawRect(0, 0, width, height); paintComponents(g); // draw text } public void growShrink() { int curWidth = getWidth(); int curHeight = getHeight(); if (curWidth == trueWidth && trueWidth > startWidth) { setSize(startWidth,curHeight); } else if (curWidth < trueWidth) { setSize(trueWidth,curHeight); } paintComponent(getGraphics()); } }
package br.edu.unoescsmo.aluga.interfaces; import java.util.List; import br.edu.unoescsmo.aluga.model.Imovel; public interface ImovelInterface { void salvar(Imovel professor); void delete(Imovel professor); List<Imovel> listar(); Imovel buscarPorCodigo(Long codigo); }
package com.sri.googleimagesearch.model; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.util.List; import lombok.Getter; import lombok.Setter; @Getter @Setter @JsonIgnoreProperties(ignoreUnknown = true) public class SearchResult { private String kind; private Queries queries; private List<Item> items; }
package com.resjob.modules.app.utils; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.net.URLDecoder; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.URI; import org.apache.commons.httpclient.methods.GetMethod; public class HttpMsgSender{ static final String URL = "http://222.73.117.158/msg/";// 应用地址 static final String ACCOUNT = "chuxinkeji";// 账号 static final String PSWD = "Chuxinkeji123";// 密码 static final String MSG_SIGN = "【雏新科技】";// 短信签名 static final boolean NEEDSTATUS = true;// 是否需要状态报告,需要true,不需要false static final String EXTNO = null;// 扩展码 /** * * @param mobile 手机号码,多个号码使用","分割 * @param msg 短信内容 * @return * @throws Exception */ public static String batchSend(String mobile,String msg) throws Exception{ return batchSend(URL, ACCOUNT, PSWD, mobile, MSG_SIGN+msg, NEEDSTATUS, EXTNO); } /** * * @param url * 应用地址,类似于http://ip:port/msg/ * @param account * 账号 * @param pswd * 密码 * @param mobile * 手机号码,多个号码使用","分割 * @param msg * 短信内容 * @param needstatus * 是否需要状态报告,需要true,不需要false * @return * 返回值定义参见HTTP协议文档 * @throws Exception */ public static String batchSend(String url,String account,String pswd,String mobile,String msg,boolean needstatus, String extno) throws Exception{ HttpClient client=new HttpClient(); GetMethod method=new GetMethod(); try{ URI base=new URI(url,false); method.setURI(new URI(base,"HttpBatchSendSM",false)); method.setQueryString( new NameValuePair[]{ new NameValuePair("account",account), new NameValuePair("pswd",pswd), new NameValuePair("mobile",mobile), new NameValuePair("needstatus",String.valueOf(needstatus)), new NameValuePair("msg",msg), new NameValuePair("extno",extno) } ); int result=client.executeMethod(method); if(result==HttpStatus.SC_OK) { InputStream in=method.getResponseBodyAsStream(); ByteArrayOutputStream baos=new ByteArrayOutputStream(); byte[] buffer=new byte[1024]; int len=0; while((len=in.read(buffer))!=-1){ baos.write(buffer,0,len); } return URLDecoder.decode(baos.toString(),"UTF-8"); }else{ throw new Exception("HTTP ERROR Status: "+method.getStatusCode()+":"+method.getStatusText()); } }finally{ method.releaseConnection(); } } }
/* * Created on Mar 18, 2007 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.citibank.ods.persistence.pl.dao; import java.math.BigInteger; import com.citibank.ods.common.dataset.DataSet; import com.citibank.ods.entity.pl.TplProductFamilyPrvtEntity; /** * @author leonardo.nakada * * TODO To change the template for this generated type comment go to Window - * Preferences - Java - Code Style - Code Templates */ public interface TplProductFamilyPrvtDAO extends BaseTplProductFamilyPrvtDAO { public DataSet list( BigInteger prodFamlCode_, String prodFamlName_, String prodFamlText_ ); public TplProductFamilyPrvtEntity insert( TplProductFamilyPrvtEntity tplProductFamilyPrvtEntity_ ); public void update( TplProductFamilyPrvtEntity tplProductFamilyPrvtEntity_ ); public void delete( TplProductFamilyPrvtEntity tplProductFamilyPrvtEntity_ ); public boolean exists( TplProductFamilyPrvtEntity tplProductFamilyPrvtEntity_ ); public boolean existsActive( TplProductFamilyPrvtEntity tplProductFamilyPrvtEntity_ ); public DataSet loadDomain(); }
package com.leviathan143.craftingutils.common.items; import net.minecraft.item.Item; public class CUItems { public static Item ingredientList; public static void preInit() { ingredientList = new IngredientList(); } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package game; import javax.swing.JFrame; /** * * @author Nitro */ public class main { public static void main (String[] args) { JFrame frame = new Frame(); frame.setVisible(true); } }
package communication; import java.io.ObjectOutputStream; import java.io.Serializable; public class LogIn implements Serializable { public String name; public char[] password; public boolean isNew; public LogIn(String name, char[] password, boolean isNew){ this.name = name; this.password = password; this.isNew = isNew; } }
public class Quote { private String name; private String quote; public Quote(String line){ this.name = parseName(line.substring(0,line.indexOf(':'))); this.quote = parseQuote(line.substring(line.indexOf(':')+2)); } private String parseQuote(String quote) { //capitalize first letter: quote = quote.substring(0,1) + quote.substring(1,2).toUpperCase() + quote.substring(2); //add punctuation char lastChar = quote.charAt(quote.length()-2); if(lastChar!='!'){ quote = quote.replaceAll("\"$",".\""); } return quote; } private String parseName(String name) { //strip name from "" : name = name.replaceAll("\"",""); //capitalize first letter: name = name.substring(0,1).toUpperCase() + name.substring(1); //capitalize every letter after a space: for(int i=0 ;i<name.length();i++){ if(name.charAt(i)==' '){ name = name.substring(0,i+1) + name.substring(i+1,i+2).toUpperCase() + name.substring(i+2); } } return name; } public void print(){ System.out.println(quote + " -- " + name); } }
package dev.liambloom.softwareEngineering.chapter1; public class HelloWorld { // Class for hello world program public static void main () { // Main method /*System.out.println("Hello, world!\n"); System.out.print("This program "); System.out.print("doesn't "); System.out.println("produce four lines of output\n"); System.out.println("There is a tab here -->\t<--"); System.out.println("There's two here -->\t\t<--"); System.out.println("Here\n are\n some\n newlines"); System.out.println("The backslash (\\) escapes a character"); System.out.println("This is useful for things like \\\", which makes a double quote (\")");*/ System.out.println(" 8 + 4 = " + ("8" + "4")); System.out.println(" 15 / 5 = " + (15/5)); } }
package com.trump.auction.trade.core.impl; import java.math.BigDecimal; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.trump.auction.reactor.api.AuctionContextFactory; import com.trump.auction.reactor.api.model.AuctionContext; import com.trump.auction.reactor.api.model.AuctionStatus; import com.trump.auction.reactor.repository.BidRepository; import com.trump.auction.trade.domain.AuctionInfo; import com.trump.auction.trade.service.AuctionInfoService; import lombok.extern.slf4j.Slf4j; @Service @Slf4j public class AuctionContextFactoryImpl implements AuctionContextFactory { @Autowired private BidRepository bidRepository; @Autowired private AuctionInfoService auctionInfoService; @Override public AuctionContext create(String auctionNo) { AuctionContext context = bidRepository.getContext(auctionNo); if (context != null ) { if(context.getBidCountDown()<5){ context.setBidCountDown(10); } return context; } AuctionInfo auctionInfo = auctionInfoService.selectByPrimaryKey(Integer.valueOf(auctionNo)); if (null == auctionInfo.getCountDown()) { auctionInfo.setCountDown(10); } if (null == auctionInfo.getStartPrice()) { auctionInfo.setStartPrice(new BigDecimal("0")); } if (null == auctionInfo.getIncreasePrice()) { auctionInfo.setIncreasePrice(new BigDecimal("0.1")); } if (null == auctionInfo.getTotalBidCount()) { auctionInfo.setTotalBidCount(0); } context = AuctionContext.create(auctionNo) .setLastBidder(null) .setBidCountDown(auctionInfo.getCountDown()) .setExpectCount(auctionInfo.getFloorBidCount()) .setLastPrice(auctionInfo.getStartPrice().add(auctionInfo.getIncreasePrice().multiply(new BigDecimal(auctionInfo.getTotalBidCount())))) .setStepPrice(auctionInfo.getIncreasePrice()) .setTotalBidCount(auctionInfo.getTotalBidCount()) .setValidBidCount(auctionInfo.getValidBidCount()) .setStatus(2 == auctionInfo.getStatus() ? AuctionStatus.COMPLETE : AuctionStatus.ON); if(AuctionStatus.COMPLETE.equals(context.getStatus())){ return context; } bidRepository.saveContextIfAbsent(context); return bidRepository.getContext(auctionNo); } }
//////////////////////license & copyright header////////////////////////////////// // // // CueCatDecoder.java // // // // Copyright (c) 2000 by Tim Patton // // // //This program is free software; you can redistribute it and/or // //modify it under the terms of the GNU General Public License // //as published by the Free Software Foundation; either version 2 // //of the License, or (at your option) any later version. // // // //This program is distributed in the hope that it will be useful, // //but WITHOUT ANY WARRANTY; without even the implied warranty of // //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // //GNU General Public License for more details. // // // //You should have received a copy of the GNU General Public License // //along with this program; if not, write to the Free Software // //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // // // // // Tim Patton <guinsu@timpatton.com> // // // ////////////////////end license & copyright header//////////////////////////////// package net.datacrow.util.cuecat; import java.util.StringTokenizer; import net.datacrow.util.Base64; /** This class handles decoding a line of CueCat output and creating a CueCatCode object to store that data. CueCat output consists of 3 period separated pieces of information, simialr to this:<BR><BR> .C3nZC3nZC3nYDhv7D3DWCxnX.cGf2.ENr7C3b3DNbWChPXDxzZDNP6.<BR><BR> The first item is the CueCat device ID. The second is the barcode type. The third is the actual bar code that was scanned.<BR><BR> This class can be used to parse each item separately or all at once, returning Strings or a CueCatCode. <BR><BR> The following is the process that is used to undo the encoding performed by the CueCat: <UL> <LI>Swap all upper and lower case characters, replace '-' wirh '/' <LI>Base64 decode the String - note that the input is padded with '='s if the length is not divisible by 4. The Base 64 decoder used needs input lengths evenly divisible by 4. The '=' symbol is a blank or null in Base64. <LI>XOR each byte of the result with 67. </UL> @author Tim Patton (guinsu@timpatton.com) @version 1.0 @date 09 September 2000 */ public class CueCatDecoder { /** Decodes one item fromthe CueCat output @param encoded the CueCat encoded item, with no periods @return the decoded String */ public static String decodeToken(String encoded) { //pad out the input with ='s, our base64 decoder needs input //length divisibe by 4 char chars[]=padInput(encoded); //Swap upper case to lower case and vice versa, minuses to slashes swapUpperLower(chars); //Decode with base64 byte []decode_bytes=Base64.decode(chars); //Take each character XOR 67 for(int i=0;i<decode_bytes.length;i++) decode_bytes[i]=(byte)(decode_bytes[i] ^ 67); return new String(decode_bytes); } /** Swap upper case to lower case and vice versa, minuses to slashes. This method modifies the input array @param chars the character array to convert */ public static void swapUpperLower(char []chars) { int diff='a'-'A'; for(int i=0;i<chars.length;i++) { if(chars[i]>='a' && chars[i]<='z') chars[i]=(char)(chars[i]-diff); else if(chars[i]>='A' && chars[i]<='Z') chars[i]=(char)(chars[i]+diff); else if(chars[i]=='-') chars[i]=(char)'/'; } } /** Decode a while line of CueCat outout and create a CueCatCode object. This method only processes the first three period separated items, anything after is ignored. @param s the line if input from the CueCat @return a CueCatCode object holding all the parsed data */ public static CueCatCode decodeLine(String s) { StringTokenizer st=new StringTokenizer(s,"."); String temp; String token; int count=0; String cueCode=null,barCode=null,barType=null; //loop through each period separated item while(st.hasMoreTokens() &&count<3) { token=st.nextToken(); temp=decodeToken(token); if(count==0) cueCode=temp; else if (count==1) barType=temp; else if (count==2) barCode=temp; count++; } if(count<2) return null; else return new CueCatCode(cueCode,barType,barCode); } /** Adds '=' symbols to the end of any input until its length is evenly divisible by 4 @param encoded the String to be padded out @return a new char[] of the correct length */ public static char[] padInput(String encoded) { char chars[]; if(encoded.length()%4 !=0) { int new_len= ((int)(encoded.length()+3) /4)*4; chars=new char[new_len]; encoded.getChars(0,encoded.length(),chars,0); for(int i=encoded.length();i<chars.length;i++) chars[i]='='; } else chars=encoded.toCharArray(); return chars; } }
package com.practice.util; import java.io.IOException; import java.io.Reader; import java.util.List; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactoryBuilder; public abstract class AbstractDao <T> { protected static SqlSession sqlSession = null; static { Reader reader = null; if (sqlSession == null) { try { reader = Resources.getResourceAsReader("mybatis-config.xml"); } catch (IOException e) { e.printStackTrace(); } sqlSession = new SqlSessionFactoryBuilder().build(reader).openSession(); } } // 検索用 public abstract List<T> find(T dto); // 選択用 public abstract List<T> select(T dto); // 新規追加用 public abstract void insert(T dto); // 削除用 public abstract void delete(T dto); // 更新用 public abstract void update(T dto); }
package com.hr.calendar.service; import java.util.List; import java.util.Map; import com.hr.calendar.model.CalendarTask; import com.hr.schedule.model.FactSchedule; public interface CalendarService { void newTask(CalendarTask task); void edit(CalendarTask task); void delete(Integer no); List<CalendarTask> showTasksByEmpNo(String empNo); CalendarTask findTheTask(Integer no); List<FactSchedule> showShiftByEmpNo(String empNo); }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package josteo.model.paziente; import java.util.*; import josteo.infrastructure.DomainBase.*; /** * * @author cristiano */ public class Paziente extends EntityBase implements IAggregateRoot{ private List<Consulto> _consulti; private Anagrafica _anagrafica; private Address _address; private List<AnamnesiRemota> _anamnesiRemote; private String _nome; private String _cognome; private Date _dataNascita; private String _professione; private String _indirizzo; private String _citta; private String _cap; private String _prov; private String _telefono; private String _cellulare; private String _email; public String getNome(){return this._nome;} public void setNome(String val){ if(val.compareTo(this._nome)!=0){ this._nome=val; this.set_IsChanged(true); } } public String getCognome(){return this._cognome;} public void setCognome(String val){ if(val.compareTo(this._cognome)!=0){ this._cognome=val; this.set_IsChanged(true); } } public Date getDataNascita(){return this._dataNascita;} public void setDataNascita(Date val){ if(val.compareTo(this._dataNascita)!=0){ this._dataNascita=val; this.set_IsChanged(true); } } public String getProfessione(){return this._professione;} public void setProfessione(String val){ if(val.compareTo(this._professione)!=0){ this._professione=val; this.set_IsChanged(true); } } public String getIndirizzo(){return this._indirizzo;} public void setIndirizzo(String val){ if(val.compareTo(this._indirizzo)!=0){ this._indirizzo=val; this.set_IsChanged(true); } } public String getCitta(){return this._citta;} public void setCitta(String val){ if(val.compareTo(this._citta)!=0){ this._citta=val; this.set_IsChanged(true); } } public String getCap(){return this._cap;} public void setCap(String val){ if(val.compareTo(this._cap)!=0){ this._cap=val; this.set_IsChanged(true); } } public String getProv(){return this._prov;} public void setProv(String val){ if(val.compareTo(this._prov)!=0){ this._prov=val; this.set_IsChanged(true); } } public String getTelefono(){return this._telefono;} public void setTelefono(String val){ if(val.compareTo(this._telefono)!=0){ this._telefono=val; this.set_IsChanged(true); } } public String getCellulare(){return this._cellulare;} public void setCellulare(String val){ if(val.compareTo(this._cellulare)!=0){ this._cellulare=val; this.set_IsChanged(true); } } public String getEmail(){return this._email;} public void setEmail(String val){ if(val.compareTo(this._email)!=0){ this._email=val; this.set_IsChanged(true); } } public String getFullName(){ return this.getCognome() + ", " + this.getNome(); } public String getFullAddress(){ return this.getIndirizzo() + ", " + this.getCap() + " " + this.getCitta() + "(" + this.getProv() + ")"; } // public Anagrafica get_Anagrafica(){ return this._anagrafica;} // public void set_Anagrafica(Anagrafica val){ // if(!val.compareTo(this._anagrafica)){ // this._anagrafica=val; // this.set_IsChanged(true); // } // } // // public Address get_Address(){ return this._address;} // public void set_Address(Address val){ // if(!val.compareTo(this._address)){ // this._address=val; // this.set_IsChanged(true); // } // } public List<Consulto> get_Consulti(){ return this._consulti;} public List<AnamnesiRemota> get_AnamnesiRemote(){ return this._anamnesiRemote;} public Paziente(){ this(0); } public Paziente(int key){//, Anagrafica anagrafica, Address address super(key); // this._anagrafica = anagrafica; // this._address = address; this._consulti = new ArrayList<Consulto>(); this._anamnesiRemote = new ArrayList<AnamnesiRemota>(); this._nome=""; this._cognome=""; this._dataNascita=new Date(); this._professione=""; this._indirizzo=""; this._citta=""; this._cap=""; this._prov=""; this._telefono=""; this._cellulare=""; this._email=""; } @Override protected BrokenRuleMessages GetBrokenRuleMessages(){ return new ValutazioneRuleMessages(); } @Override protected void Validate(){ // if(this._anagrafica==null){ // this.get_BrokenRules().add(new BrokenRule("","")); // } // // if(this._address==null){ // this.get_BrokenRules().add(new BrokenRule("","")); // } if(this._nome.length()==0){ this.get_BrokenRules().add(new BrokenRule("Nome","cannot be empty")); } if(this._cognome.length()==0){ this.get_BrokenRules().add(new BrokenRule("Cognome","cannot be empty")); } if(this._dataNascita==new Date()){ this.get_BrokenRules().add(new BrokenRule("Data di nascita","is missing")); } if(this._professione.length()==0){ this.get_BrokenRules().add(new BrokenRule("Professione","cannot be empty")); } // if(this._address!=null && this._address.get_indirizzo().length()==0){ // this.get_BrokenRules().add(new BrokenRule("","")); // } if(this._citta.length()==0){ this.get_BrokenRules().add(new BrokenRule("Citta'","cannot be empty")); } if(this._prov.length()==0){ this.get_BrokenRules().add(new BrokenRule("Provincia","cannot be empty")); } } }
package be.openclinic.healthrecord; import be.mxs.common.util.db.MedwanQuery; import be.mxs.common.util.system.ScreenHelper; import java.sql.Connection; import java.sql.Timestamp; import java.sql.PreparedStatement; import java.sql.ResultSet; /** * Created by IntelliJ IDEA. * User: mxs_david * Date: 15-jan-2007 * Time: 11:14:06 * To change this template use Options | File Templates. */ public class Workplace { private int id; private String messageKey; private Timestamp deletedate; private Timestamp updatetime; private int updateuserid; private String NL; private String FR; private int active; private String serviceId; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getMessageKey() { return messageKey; } public void setMessageKey(String messageKey) { this.messageKey = messageKey; } public Timestamp getDeletedate() { return deletedate; } public void setDeletedate(Timestamp deletedate) { this.deletedate = deletedate; } public Timestamp getUpdatetime() { return updatetime; } public void setUpdatetime(Timestamp updatetime) { this.updatetime = updatetime; } public int getUpdateuserid() { return updateuserid; } public void setUpdateuserid(int updateuserid) { this.updateuserid = updateuserid; } public String getNL() { return NL; } public void setNL(String NL) { this.NL = NL; } public String getFR() { return FR; } public void setFR(String FR) { this.FR = FR; } public int getActive() { return active; } public void setActive(int active) { this.active = active; } public String getServiceId() { return serviceId; } public void setServiceId(String serviceId) { this.serviceId = serviceId; } public static void saveWorkplaceById( int iId,String sMessageKey,Timestamp deletedate,String sUpdateuserid,String sNL,String sFR,Integer intActive,String sServiceId){ PreparedStatement ps = null; String sUpdateSet = ""; if(sMessageKey.length() > 0){ sUpdateSet += " messageKey = ?,"; } if(deletedate!=null){ sUpdateSet += " deletedate = ?,"; } if(sUpdateuserid.length() > 0){ sUpdateSet += " updateuserid = ?,"; } if(sNL.length() > 0){ sUpdateSet += " NL = ?,"; } if(sFR.length() > 0){ sUpdateSet += " FR = ?,"; } if(intActive!=null){ sUpdateSet += " active = ?,"; } if(sServiceId.length() > 0){ sUpdateSet += " serviceId = ?,"; } String sUpdate = "UPDATE Workplaces SET " + sUpdateSet + " updatetime=? WHERE id=?"; int iIndex = 1; Connection oc_conn=MedwanQuery.getInstance().getOpenclinicConnection(); try{ ps = oc_conn.prepareStatement(sUpdate); if(sMessageKey.length() > 0){ ps.setString(iIndex++,sMessageKey); } if(deletedate!=null){ ps.setTimestamp(iIndex++,deletedate); } if(sUpdateuserid.length() > 0){ ps.setInt(iIndex++,Integer.parseInt(sUpdateuserid)); } if(sNL.length() > 0){ ps.setString(iIndex++,sNL); } if(sFR.length() > 0){ ps.setString(iIndex++,sFR); } if(intActive!=null){ ps.setInt(iIndex++,intActive.intValue()); } if(sServiceId.length() > 0){ ps.setString(iIndex++,sServiceId); } ps.setTimestamp(iIndex++,ScreenHelper.getSQLTime()); ps.setInt(iIndex++,iId); ps.executeUpdate(); ps.close(); }catch(Exception e){ e.printStackTrace(); }finally{ try{ if(ps!=null)ps.close(); oc_conn.close(); }catch(Exception e){ e.printStackTrace(); } } } public static Workplace selectWorkplace(int iId){ PreparedStatement ps = null; ResultSet rs = null; Workplace objWP = null; String sSelect = " SELECT * FROM Workplaces WHERE id = ?"; Connection oc_conn=MedwanQuery.getInstance().getOpenclinicConnection(); try{ ps = oc_conn.prepareStatement(sSelect); ps.setInt(1,iId); rs = ps.executeQuery(); if(rs.next()){ objWP = new Workplace(); objWP.setId(iId); objWP.setActive(rs.getInt("active")); objWP.setDeletedate(rs.getTimestamp("deletedate")); objWP.setFR(ScreenHelper.checkString("FR")); objWP.setNL(ScreenHelper.checkString("NL")); objWP.setMessageKey(ScreenHelper.checkString(rs.getString("messageKey"))); objWP.setServiceId(ScreenHelper.checkString(rs.getString("serviceId"))); objWP.setUpdatetime(rs.getTimestamp("updatetime")); objWP.setUpdateuserid(rs.getInt("updateuserid")); } rs.close(); ps.close(); }catch(Exception e){ e.printStackTrace(); }finally{ try{ if(rs!=null)rs.close(); if(ps!=null)ps.close(); oc_conn.close(); }catch(Exception e){ e.printStackTrace(); } } return objWP; } }
package com.javaee.ebook1.mybatis.dto; import lombok.Data; import java.util.List; /** * @author xuzihan * @version 1.0 * @description: TODO * @data 2021/5/8 **/ @Data public class UserDTO { String username; String password; List<RoleDto> roles; }
package nl.jasperNiels.twitter.model; import java.util.Observable; import android.text.SpannableString; public class Content extends Observable { private SpannableString text; public Content(SpannableString text) { this.text = text; } public SpannableString getText() { return text; } }
package br.com.demo.sqs.controller; import java.util.HashMap; import java.util.Map; import java.util.UUID; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.aws.messaging.core.QueueMessagingTemplate; import org.springframework.cloud.aws.messaging.listener.SqsMessageDeletionPolicy; import org.springframework.cloud.aws.messaging.listener.annotation.SqsListener; import org.springframework.messaging.support.MessageBuilder; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import lombok.extern.slf4j.Slf4j; @RestController @RequestMapping("/sqs") @Slf4j public class SqsController { @Autowired private QueueMessagingTemplate queueMessagingTemplate; @Value("${cloud.aws.sqs.queue-url}") private String sqsQueueUrl; @GetMapping public void sendMessage() { Map<String, String> headers = new HashMap<>(); headers.put("message-group-id", "1"); headers.put("message-deduplication-id", UUID.randomUUID().toString()); queueMessagingTemplate.send(sqsQueueUrl, MessageBuilder.withPayload("Hello from Spring Boot").copyHeaders(headers).build()); } @SqsListener(value = "${cloud.aws.sqs.queue-name}", deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS) public void getMessage(String message) throws Exception { log.info("Message received from SQS: {}", message); } }
package com.payroll.business; public class FullTime extends Employee { private int salary; public int getSalary() { return salary; } public void setSalary(int salary) { this.salary = salary; } public FullTime(String name, String email, int salary) { super(name, email); this.salary = salary; } @Override public double calcMonthlyPay() { return salary / 12.0; } public String toString() { return "FT: " + super.toString() + " salary=" + this.salary; } }
package exercises.chapter2.ex1; /** * @author Volodymyr Portianko * @date.created 01.03.2016 */ public class Test { private int intValue; private char charValue; public static void main(String[] args) { Test test = new Test(); System.out.println(test.intValue); System.out.println(new Integer(test.charValue)); } }
import java.util.Scanner; public class Main { public static void main(String []args) { Scanner in = new Scanner(System.in); WarShip warShip1 = new WarShip("Эсминец",15,"Макаров",0,10, 3,11,10); WarShip warShip2 = new WarShip("Крейсер",30,"Епифанцев",0,20, 5,2,5); UnderWaterShip warShip3 = new UnderWaterShip("Тополь М1",30,"Подводный",20,15, 5,2,3,20); /* warShip2.print(); warShip2.moveDown(); warShip2.shoot(warShip1); warShip2.print(); */ warShip3.print(); warShip3.dive(); warShip3.print(); } }
package org.sample.jsf.client.view.search; import javax.faces.bean.ViewScoped; import javax.inject.Inject; import javax.inject.Named; @Named @ViewScoped public class SearchModel { /** Serial version UID. */ private static final long serialVersionUID = -4966685387777336734L; /** The session. */ @Inject private SearchSessionScoped session; public SearchSessionScoped getSession() { return session; } public SearchCriteria getCriteria() { if(getSession().getCriteria() == null){ setCriteria(new SearchCriteria()); } return getSession().getCriteria(); } public void setCriteria(final SearchCriteria criteria) { getSession().setCriteria((SearchCriteria) criteria); } }
package com.waylau.spring.boot.security.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.core.userdetails.UserDetailsService; /** * Spring Security 配置类. * * @since 1.0.0 2017年3月8日 * @author <a href="https://waylau.com">Way Lau</a> */ @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) // 启用方法安全设置 public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private UserDetailsService userDetailsService; /** * 自定义配置 */ @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/css/**", "/js/**", "/fonts/**", "/index").permitAll() // 都可以访问 .antMatchers("/h2-console/**").permitAll() // 都可以访问 .antMatchers("/users/**").hasRole("USER") // 需要相应的角色才能访问 .antMatchers("/admins/**").hasRole("ADMIN") // 需要相应的角色才能访问 .and() .httpBasic() // 使用 Basic 认证 .and() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)// 无状态 .and() .exceptionHandling().accessDeniedPage("/403"); // 处理异常,拒绝访问就重定向到 403 页面 http.csrf().ignoringAntMatchers("/h2-console/**"); // 禁用 H2 控制台的 CSRF 防护 http.headers().frameOptions().sameOrigin(); // 允许来自同一来源的H2 控制台的请求 } /** * 认证信息管理 * @param auth * @throws Exception */ @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService); } }
package mum.cs472; import com.google.gson.Gson; import java.util.ArrayList; import java.util.List; public class Word { public static class Definition { private final String t; private final String d; public Definition (String type, String definition) { this.t = type; this.d = definition; } public String getType() { return t; } public String getDefinition() { return d; } } private final String word; private final List<Definition> definitions = new ArrayList<>(); public Word (String word) { this.word = word; } public void addDifition(String type, String definition) { definitions.add(new Definition(type, definition)); } public String getWord() { return word; } public List<Definition> getDefinitions() { return definitions; } public String toJSON() { Gson gson = new Gson(); return gson.toJson(this); } }
package com.bwie.juan_mao.jingdong_kanglijuan; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.os.Handler; import android.os.Message; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import com.bwie.juan_mao.jingdong_kanglijuan.base.BaseActivity; import com.bwie.juan_mao.jingdong_kanglijuan.base.BasePresenter; public class MainActivity extends BaseActivity { public static final int FLAG = 123; @SuppressLint("HandlerLeak") private Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); if (msg.what == FLAG) { startActivity(new Intent(MainActivity.this, HomeActivity.class)); finish(); } } }; @Override protected void initData() { handler.sendEmptyMessageDelayed(FLAG, 3000); } @Override protected BasePresenter providePresenter() { return null; } @Override protected int provideLayoutId() { return R.layout.activity_main; } @Override public Context getContext() { return this; } }
package com.fairytalener; import com.fairytalener.utilities.FileUtilities; import com.fairytalener.utilities.StanfordParser; import edu.stanford.nlp.trees.Tree; import java.io.*; import java.util.HashSet; import java.util.List; public class EvaluationNP { StanfordParser stanfordParser = new StanfordParser(); public void intercoder() throws IOException { File folders = new File("src/main/resources/Data/corpus/Test"); File[] listOfFiles = folders.listFiles(); int totaltruepost=0 ,totalfalsepos=0, totalfalseneg = 0, totaltrueneg=0; int totalAnnotatedChar =0, totalAnnotatedNotChar =0, totalPredictedChar = 0, totalPredictedNotChar =0; File newFile = new File("np_test.csv"); BufferedWriter bw = new BufferedWriter(new FileWriter(newFile)); int yes_yes=0, yes_no=0, no_yes=0, no_no=0; // File file = new File("src/main/resources/Data/corpus/train/187655076-THE-TALE-OF-THE-FLOPSY-BUNNIES-Beatrix-Potter.txt"); for(File file: listOfFiles) { FileUtilities fileUtilities = new FileUtilities(); String story = fileUtilities.readFile(file); List<Tree> storeTree = stanfordParser.parse(story); List<String> nounPhrases = stanfordParser.getNounPhrases(storeTree); File baselineFile = new File("src/main/resources/Data/baseline/test/" + file.getName()); HashSet<String> characterbaseline = getCharacters(baselineFile); File annotatedFile = new File("src/main/resources/Data/corpus/annotate/data/all/" + file.getName()); HashSet<String> characterExpected = getCharacters(annotatedFile); File predictedCharFile = new File("src/main/resources/Data/output.test/" + file.getName()); // File predictedCharFile = new File("src/main/resources/Data/baseline/test/" + file.getName()); HashSet<String> characterPredicted = getCharacters(predictedCharFile); int truePositive = 0, falsePositive = 0, falseNegative = 0, trueNegative = 0; System.out.println("Total noun phrases: " + nounPhrases.size()); System.out.println("Total annotated first: " + characterExpected.size()); System.out.println("Total annotated second:" + characterPredicted.size()); for (String nounPhrase : nounPhrases) { Boolean tp = false, tn=false, fp = false, fn = false; System.out.println("+++Noun phrase+++"+nounPhrase); Boolean containsAcharacterExpected=false, containsApredictedCharacter=false; for(String charExpected: characterExpected) { if (nounPhrase.toUpperCase().contains(charExpected)) { containsAcharacterExpected=true; if (characterPredicted.contains(charExpected)) { //no_yes++; System.out.println(charExpected+" tp here"); tp=true; }else { System.out.println(charExpected+" fn here "); fn=true; } if (characterPredicted.contains(charExpected) && !characterbaseline.contains(charExpected)) { no_yes++; System.out.println(charExpected+" tp here"); tp=true; }else if ((!characterPredicted.contains(charExpected) && characterbaseline.contains(charExpected))){ yes_no++; System.out.println(charExpected+" fn here "); fn=true; }else if( characterPredicted.contains(charExpected) && characterbaseline.contains(charExpected)){ yes_yes++; }else { no_no++; } } } for(String characterPred: characterPredicted){ if (nounPhrase.toUpperCase().contains(characterPred)) { System.out.println(characterPred+" is present in "+nounPhrase.toUpperCase()); containsApredictedCharacter = true; if (!characterExpected.contains(characterPred)) { System.out.println(characterPred + " fp here"); fp = true; } } } if(!containsAcharacterExpected && !containsApredictedCharacter) { tn=true; } if(tp) { System.out.println("this is true positive"); totaltruepost++; truePositive++; } else if(fp) { totalfalsepos++; System.out.println("this is false positive"); falsePositive++; } else if(fn) { totalfalseneg++; System.out.println("this is false negative"); falseNegative++; } else if(tn) { totaltrueneg++; System.out.println("this is true negative"); trueNegative++; } System.out.println("\n\n"); } System.out.println("\n\n" + "True Positive " + truePositive); System.out.println("False Positive " + falsePositive); System.out.println("False Negative " + falseNegative); System.out.println("True Negative " + trueNegative); Float precision = Float.valueOf(truePositive) / (truePositive + falsePositive); Float recall = Float.valueOf(truePositive) / (truePositive + falseNegative); Float f1 = 2 * precision * recall / (precision + recall); int a1_characters = truePositive + falseNegative; int a1_notCharac = falsePositive + trueNegative; int a2_character = truePositive + falsePositive; int a2_notChracters = falseNegative + trueNegative; int total = a1_characters + a1_notCharac; totalAnnotatedChar+=a1_characters; totalAnnotatedNotChar+=a1_notCharac; totalPredictedChar+=a2_character; totalPredictedNotChar+=a2_notChracters; //=((D8/D10)*(B10/D10))+((D9/D10)*(C10/D10)) float pE = ((Float.valueOf(a1_characters) / total) * (Float.valueOf(a2_character) / total)) + ((Float.valueOf(a1_notCharac) / total) * (Float.valueOf(a2_notChracters) / total)); float pA = (float) (truePositive + trueNegative) / total; //=(B16-B15)/(1-B15) float kappa = (pA - pE) / (1 - pE); System.out.println(file.getName() + "\n --- \nF1-measure = \n" + f1); System.out.println("precision = \n" + precision); System.out.println("recall = \n" + recall + "\n\n"); System.out.println("P(E) = " + pE); System.out.println("P(A) = " + pA); System.out.println("Kappa = " + kappa); try { bw.write(file.getName()+";"+precision+";"+recall+";"+f1+";"+kappa); bw.newLine(); } catch (IOException e) { e.printStackTrace(); } } System.out.println("True Positive: "+totaltruepost); System.out.println("True Negative: "+totaltrueneg); System.out.println("False Positive: "+totalfalsepos); System.out.println("False Negative: "+totalfalseneg); float totalprec = Float.valueOf(totaltruepost) / (totaltruepost + totalfalsepos); float totalrecal = Float.valueOf(totaltruepost) / (totaltruepost + totalfalseneg); float totalf1 = 2 * totalprec * totalrecal / (totalprec + totalrecal); int totalVal = totalAnnotatedChar+totalAnnotatedNotChar; float totalpE = ((Float.valueOf(totalAnnotatedChar) / totalVal) * (Float.valueOf(totalPredictedChar) / totalVal)) + ((Float.valueOf(totalAnnotatedNotChar) / totalVal) * (Float.valueOf(totalPredictedNotChar) / totalVal)); float totalpA = (float) (totaltruepost + totaltrueneg) / totalVal; //=(B16-B15)/(1-B15) float totalkappa = (totalpA - totalpE) / (1 - totalpE); System.out.println("Yes_Yes: "+yes_yes); System.out.println("Yes_No: "+yes_no); System.out.println("No_Yes: "+no_yes); System.out.println("No_No: "+no_no); bw.newLine(); bw.write("Overall"+";"+totalprec+";"+totalrecal+";"+totalf1+";"+totalkappa); bw.flush(); bw.close(); } private HashSet<String> getCharacters(File filename) { HashSet<String> allcharacter = new HashSet<>(); String filecontents = ""; try { BufferedReader br = new BufferedReader(new FileReader(filename)); String st; while ((st = br.readLine()) != null) { // while(!st.equals("TOTAL NC:") && st!=null) { if (st.contains("CHARACTER")) { st = br.readLine(); } if (!st.equals("")) { allcharacter.add(st.toUpperCase()); } } } catch (IOException e) { e.printStackTrace(); } System.out.println(allcharacter); return allcharacter; } public static void main(String args[]){ EvaluationNP interco = new EvaluationNP(); try { interco.intercoder(); } catch (IOException e) { e.printStackTrace(); } } }
package com.kymjs.event.util; public interface HasExecutionScope { Object getExecutionScope(); void setExecutionScope(Object executionScope); }
package DataInfo; import java.util.Date; import java.util.Properties; import DataInfo.EmailMessage; public class EmailMessageTest { public static void main(String[] args) throws Exception { String emailType = EnumType.SendEmailType; String subject = "first meeting"; String from = "from_email"; String to = "to_mail"; String content = "hello client"; Date sendDate = new Date(); String[] fileNames = null; String priority = "3"; EmailMessage em = new EmailMessage(emailType, subject, from, to, content, sendDate, fileNames, priority); em.printInfo(); System.out.println(); EmailMessage.getSingleEmailMessage(emailType, subject, from, to, content, sendDate, fileNames, priority).printInfo(); } }
package br.com.clean.arch.domain.usecase.sum; class SumUseCaseTest { void calculate() { } }
package co.project.bloodbankmgmt.adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import java.util.List; import co.project.bloodbankmgmt.R; import co.project.bloodbankmgmt.models.User; /** * Adapter for service list * Created by SuperCoders */ public class SearchDonorAdapter extends RecyclerView.Adapter<SearchDonorAdapter.ServiceHolder> { private Context mContext; private List<User> mUserList; public SearchDonorAdapter(Context context) { mContext = context; } @Override public SearchDonorAdapter.ServiceHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(mContext).inflate(R.layout.rv_item_donar_details, parent, false); return new ServiceHolder(view); } @Override public void onBindViewHolder(SearchDonorAdapter.ServiceHolder holder, int position) { holder.txtName.setText(mUserList.get(position).getFullname()); holder.txtAddress.setText(mUserList.get(position).getAddress()); holder.txtCall.setText(mUserList.get(position).getMobileNumber()); } @Override public int getItemCount() { return mUserList == null ? 0 : mUserList.size(); } /** * Notifies the list of adapter */ public void setData(List<User> serviceList) { this.mUserList = serviceList; notifyDataSetChanged(); } class ServiceHolder extends RecyclerView.ViewHolder { TextView txtName, txtAddress, txtCall; ServiceHolder(View itemView) { super(itemView); txtName = (TextView) itemView.findViewById(R.id.txt_name); txtAddress = (TextView) itemView.findViewById(R.id.txt_address); txtCall = (TextView) itemView.findViewById(R.id.txt_call); } } }
package com.minamid.accessiblememorygame; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.MenuItem; import com.minamid.accessiblememorygame.ui.MainFragment; import com.minamid.accessiblememorygame.util.Config; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Config.getInstance().CACHE_LOCATION = getApplicationContext().getCacheDir(); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .replace(R.id.container, MainFragment.newInstance()) .commitNow(); } } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId()==android.R.id.home) { super.onBackPressed(); } return super.onOptionsItemSelected(item); } public void setSupportActionBar(boolean shouldDisplayTopBackButton, String title) { ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(shouldDisplayTopBackButton); actionBar.setDisplayShowHomeEnabled(shouldDisplayTopBackButton); actionBar.setTitle(title); } }
package com.wang.aop.entity; import java.io.Serializable; /** * @author wxe * @since 1.0.0 */ @SuppressWarnings("serial") public class Agent implements Serializable{ private String id; private String name; private String sex; private String location; private String loginName; private String agentNo; private String creater; public Agent(){ } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public String getLoginName() { return loginName; } public void setLoginName(String loginName) { this.loginName = loginName; } public String getAgentNo() { return agentNo; } public void setAgentNo(String agentNo) { this.agentNo = agentNo; } public String getCreater() { return creater; } public void setCreater(String creater) { this.creater = creater; } public Agent( String id, String name, String sex, String location, String loginName, String agentNo, String creater) { super(); this.id = id; this.name = name; this.sex = sex; this.location = location; this.loginName = loginName; this.agentNo = agentNo; this.creater = creater; } }
package MVC.views; import java.awt.GridLayout; import java.sql.Timestamp; import java.util.Date; import java.util.concurrent.TimeUnit; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import MVC.controllers.showInvListController; import MVC.models.inventoryModel; public class invDetailView extends JFrame { private inventoryModel model; private JPanel detailPanel; private JPanel buttonPanel; private JLabel idLabel = new JLabel("ID: "); private JLabel nameLabel = new JLabel("Part Name: "); private JLabel locLabel = new JLabel("Location: "); private JLabel qLabel = new JLabel("Quantity: "); private JButton editButton = new JButton("Edit Part"); private JButton deleteButton = new JButton("Delete Part"); private String partName; private int id; private String loc; private String invloc; private int partq; private Date d; private Date date; public invDetailView(inventoryModel model) { // TODO Auto-generated constructor stub super("Inventory Part Detail"); this.model = model; GridLayout grid = new GridLayout(3,7); id = model.getCurrentInvId(); partName = model.getCurrentPartName(); partq = model.getCurrentInvQ(); loc = model.getCurrentLocation(); idLabel = new JLabel("ID: " + id);/*creates JLabels displaying values*/ nameLabel = new JLabel("Part Name: " + partName); qLabel = new JLabel("Location: " + loc); locLabel = new JLabel("Quantity: " + partq); this.setLayout(grid); this.add(idLabel);/*creates and adds buttons and labels to JFrame*/ this.add(nameLabel); this.add(locLabel); this.add(qLabel); this.add(editButton); this.add(deleteButton); } public void closeWindow(){ //System.out.println("closeWindowMethod"); //JOptionPane.showMessageDialog(null, "Closed Window"); //setVisible(false); //setVisable(false); //dispose(); this.closeWindow(); } public void registerListeners(showInvListController controller) { editButton.addActionListener(controller); deleteButton.addActionListener(controller); } }
/* * Copyright 2006-2016 CIRDLES.org. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.geosamples.results; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.geosamples.samples.Samples; import org.geosamples.XMLDocumentInterface; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = {}) @XmlRootElement(name = "results") public class Results implements XMLDocumentInterface{ public Results() { this.sample = new ArrayList<>(); } @XmlElement(required = false) protected List<Samples.Sample> sample; /** * Gets the value of the sample property. * * <p> * This accessor method returns a reference to the live list, not a * snapshot. Therefore any modification you make to the returned list will * be present inside the JAXB object. This is why there is not a * <CODE>set</CODE> method for the sample property. * * <p> * For example, to add a new item, do as follows: * <pre> * getSample().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Samples.Sample } * * * @return */ public List<Samples.Sample> getSample() { if (sample == null) { sample = new ArrayList<>(); } return this.sample; } @XmlElement(required = false) protected List<String> error; /** * Gets the value of the error property. * * <p> * This accessor method returns a reference to the live list, not a * snapshot. Therefore any modification you make to the returned list will * be present inside the JAXB object. This is why there is not a * <CODE>set</CODE> method for the sample property. * * <p> * For example, to add a new item, do as follows: * <pre> * getSample().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Samples.Sample } * * * @return */ public List<String> getError() { if (error == null) { error = new ArrayList<>(); } return this.error; } @XmlElement(name = "valid") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) private String valid; /** * @return the valid */ public String getValid() { return valid; } /** * @param valid the valid to set */ public void setValid(String valid) { this.valid = valid; } }
/* * Copyright (c) 2020 Nikifor Fedorov * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * SPDX-License-Identifier: Apache-2.0 * Contributors: * Nikifor Fedorov and others */ package ru.krivocraft.tortoise.core.rating; import ru.krivocraft.tortoise.core.api.settings.ReadOnlySettings; import ru.krivocraft.tortoise.core.model.Track; import ru.krivocraft.tortoise.core.model.TrackList; import ru.krivocraft.tortoise.core.data.TracksProvider; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; public class Shuffle { private final TracksProvider tracksStorageManager; private final ReadOnlySettings settings; public static final String KEY_SMART_SHUFFLE = "smartShuffle"; public Shuffle(TracksProvider tracksStorageManager, ReadOnlySettings settings) { this.tracksStorageManager = tracksStorageManager; this.settings = settings; } public List<Track.Reference> shuffle(TrackList trackList, Track.Reference firstTrack) { trackList.getTrackReferences().remove(firstTrack); List<Track.Reference> references = settings.read(KEY_SMART_SHUFFLE, true) ? smartShuffle(trackList) : basicShuffle(trackList); references.add(0, firstTrack); return references; } private List<Track.Reference> basicShuffle(TrackList trackList) { Collections.shuffle(trackList.getTrackReferences()); return trackList.getTrackReferences(); } private List<Track.Reference> smartShuffle(List<Track.Reference> references) { List<Track> tracks = tracksStorageManager.getTracks(references); Random random = new Random(System.currentTimeMillis()); List<Track> shuffled = new ArrayList<>(); List<Integer> pool = new ArrayList<>(); int min = Math.abs(Collections.min(ratings(tracks))) + 1; for (Track element : tracks) { for (int i = 0; i < element.getRating() + min; i++) { pool.add(tracks.indexOf(element)); } } while (pool.size() > 0) { int index = pool.get(random.nextInt(pool.size())); shuffled.add(tracks.get(index)); pool.removeAll(Collections.singleton(index)); } return tracksStorageManager.getReferences(shuffled); } private List<Integer> ratings(List<Track> tracks) { List<Integer> ratings = new ArrayList<>(); for (Track track : tracks) { ratings.add(track.getRating()); } return ratings; } private List<Track.Reference> smartShuffle(TrackList trackList) { return smartShuffle(trackList.getTrackReferences()); } }
package io.dcbn.backend.authentication.models; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import lombok.NoArgsConstructor; import org.checkerframework.common.aliasing.qual.Unique; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.crypto.password.PasswordEncoder; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.validation.constraints.Email; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.util.Collections; @Entity @Data @NoArgsConstructor public class DcbnUser { @Id @GeneratedValue private long id; @Unique @NotEmpty private String username; @Email @NotEmpty private String email; @JsonIgnore private String password; @NotNull private Role role; public DcbnUser(String username, String email, String password, Role role) { this.username = username; this.email = email; this.password = password; this.role = role; } public UserDetails toUserDetails() { return new User(username, password, Collections.singletonList(new SimpleGrantedAuthority(role.getName()))); } public DcbnUser withEncryptedPassword(PasswordEncoder encoder) { return new DcbnUser(username, email, encoder.encode(password), role); } }
package mekfarm.inventories; import mekfarm.capabilities.IFilterHandler; import mekfarm.common.IMachineAddon; import mekfarm.items.BaseAnimalFilterItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; /** * Created by CF on 2016-11-10. */ public class FiltersStackHandler extends FilteredStackHandler implements IFilterHandler { private TileEntity machine; public FiltersStackHandler(TileEntity machine, int size) { super(size); this.machine = machine; } @Override protected boolean acceptsStack(int slot, ItemStack stack, boolean internal) { return this.acceptsFilter(slot, stack); } @Override public boolean acceptsFilter(int slot, ItemStack filter) { if ((this.machine != null) && (filter != null) && !filter.isEmpty()) { Item item = filter.getItem(); if (item instanceof IMachineAddon) { return ((IMachineAddon) item).canBeAddedTo(this.machine); } } return false; } }
package craps_project; import java.io.BufferedReader; import java.io.InputStreamReader; public class HornMenu { static InputStreamReader ir = new InputStreamReader(System.in); static BufferedReader br = new BufferedReader(ir); CrapsTable ct = new CrapsTable(); Horn hb = new Horn(); HornH12 hb12 = new HornH12(); public HornMenu() { } public void coHornMenu() { Options opt = new Options(); try { System.out.println("_____________________________"); System.out.println("[1]Horn [6]Twelve"); System.out.println("[2]Horn High 12 [7]Eleven"); System.out.println("[3]Horn High 11 [8]Ace/Duece"); System.out.println("[4]Horn High 1/2 [9]Aces"); System.out.println("[5]Horn High 1/1 [10]Return"); System.out.println(" [0]Roll"); System.out.println("_____________________________"); while(true) { int select = Integer.parseInt(br.readLine()); switch(select) { case 1: hb.horn(); break; case 2: hb12.horn(); break; case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: opt.coMenu(); break; case 0: ct.pointOff(); break; default: break; } } }catch(Exception e) { System.out.println("Invalid Entry"); } } public void peHornMenu() { Options opt = new Options(); try { System.out.println("_____________________________"); System.out.println("[1]Horn [6]Twelve"); System.out.println("[2]Horn High 12 [7]Eleven"); System.out.println("[3]Horn High 11 [8]Ace/Duece"); System.out.println("[4]Horn High 1/2 [9]Aces"); System.out.println("[5]Horn High 1/1 [10]Return"); System.out.println(" [0]Roll"); System.out.println("_____________________________"); while(true) { int select = Integer.parseInt(br.readLine()); switch(select) { case 1: hb.horn(); break; case 2: hb12.horn(); break; case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: opt.peMenu(); break; case 0: ct.pointOn(); break; default: break; } } }catch(Exception e) { System.out.println("Invalid Entry"); } } }
import java.util.Vector; import java.io.BufferedWriter; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; public class VectorsInsertionSort { static void insert(Vector<Integer> arr) { int i, j, newValue; for (i = 1; i < arr.size(); i++) { newValue = arr.elementAt(i); j = i; while (j > 0 && arr.elementAt(j - 1) > newValue) { arr.set(j,arr.elementAt(j - 1)); j--; } arr.set(j,newValue); } } public static void main(String[] args) { for (int i = 0; i < 1; i++) { final Vector<Integer> in = GenerateVector.mVector(); Thread t = new Thread(new Runnable() { @Override public void run() { long startTime = System.currentTimeMillis(); //array is final. copying array Vector<Integer> sortedIn = in; insert(sortedIn); long finishTime = System.currentTimeMillis(); long time = finishTime - startTime; try (Writer writer = new PrintWriter(new BufferedWriter(new FileWriter("../../results.html", true)))) { writer.write("Java : InsertionSort-Vector: " + time + "\n"); } catch (IOException ex) { // handle me } } }); t.start(); } } }
package benchmark.java.metrics.json; import benchmark.java.entities.Friend; import benchmark.java.entities.Person; import benchmark.java.entities.PersonCollection; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonNode; import java.io.IOException; public class JacksonCustomDeserializator extends JsonDeserializer<PersonCollection> { @Override public PersonCollection deserialize(JsonParser jp, DeserializationContext dc) throws IOException, JsonProcessingException { PersonCollection personCollection = new PersonCollection(); JsonNode node = jp.getCodec().readTree(jp); for(JsonNode personNode : node.get("persons")) { Person person = new Person(); person.setId(personNode.get("id").asText()); person.setIndex(personNode.get("index").asInt()); person.setGuid(personNode.get("guid").asText()); person.setIsActive(personNode.get("isActive").asBoolean()); person.setBalance(personNode.get("balance").asText()); person.setPicture(personNode.get("picture").asText()); person.setAge(personNode.get("age").asInt()); person.setEyeColor(personNode.get("eyeColor").asText()); person.setName(personNode.get("name").asText()); person.setGender(personNode.get("gender").asText()); person.setCompany(personNode.get("company").asText()); person.setEmail(personNode.get("email").asText()); person.setPhone(personNode.get("phone").asText()); person.setAddress(personNode.get("address").asText()); person.setAbout(personNode.get("about").asText()); person.setRegistered(personNode.get("registered").asText()); person.setLatitude((float)personNode.get("latitude").asDouble()); person.setLongitude((float)personNode.get("longitude").asDouble()); for (JsonNode tagNode : personNode.get("tags")) { person.addTag(tagNode.asText()); } for (JsonNode friendNode : personNode.get("friends")) { Friend friend = new Friend(); friend.setId(friendNode.get("id").asInt()); friend.setName(friendNode.get("name").asText()); person.addFriend(friend); } person.setGreeting(personNode.get("greeting").asText()); person.setFavoriteFruit(personNode.get("favoriteFruit").asText()); personCollection.addPerson(person); } return personCollection; } }
package atm.parts; import atm.utils.*; public class CashDispenser { private Money availableCash; /* Constructors */ public CashDispenser(){ availableCash = new Money(0); } /* Instance methods */ /** * Lets you set the available cash in the cash dispenser tray * * @param the initial amount in the form of a Money object */ public void setAvailableCash(Money initialAmount){ availableCash = initialAmount; } /** * Gives the amount of cash left in the dispenser * * @return the available cash in the dispenser */ public Money getAvailableCash(){ return availableCash; } /** * Simulates a cash dispense * * @param the amount we want to dispense, in the form of a Money object */ public void dispenseMoney(Money amount){ try{ Thread.sleep(4000); } catch(InterruptedException e) {} availableCash.subtract(amount); } }
package pl.pjatk.rental.service.RentalService.movie.model; public enum MovieCategory { ACTION, HORROR, TRAGEDY, THRILLER }
package com.example.android.nusevents; import android.app.Activity; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Filter; import android.widget.TextView; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import com.example.android.nusevents.model.EventInfo; import java.util.ArrayList; import java.util.List; /** * Created by ronaklakhotia on 19/06/17. */ public class EventsList extends ArrayAdapter<EventInfo> { private Activity context; private List<EventInfo> EventList; private FriendFilter friendFilter; private List<EventInfo> filteredList; public EventsList(Activity context,List<EventInfo> EventList) { super(context,R.layout.events_display,EventList); this.context=context; this.EventList=EventList; this.filteredList=EventList; getFilter(); } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { LayoutInflater inflater=context.getLayoutInflater(); View listView = inflater.inflate(R.layout.events_display,null,true); TextView textViewName = (TextView)listView.findViewById(R.id.event); TextView textViewLoc = (TextView)listView.findViewById(R.id.eventloc); TextView textViewDate = (TextView)listView.findViewById(R.id.eventdat); TextView textViewTime = (TextView)listView.findViewById(R.id.eventtime); DateFormat sdf = new SimpleDateFormat("HH:mm"); String time=""; if(position<filteredList.size()) { EventInfo events = filteredList.get(position); Date netDate = (new Date(events.getTime())); time = sdf.format(netDate); textViewName.setText(events.getName()); textViewLoc.setText(events.getLocation()); textViewDate.setText(events.getDate()); textViewTime.setText(time); return listView; } else { listView.setVisibility(View.GONE); return listView; } } @Override public Filter getFilter() { if (friendFilter == null) { friendFilter = new FriendFilter(); } return friendFilter; } /** * Custom filter for friend list * Filter content in friend list according to the search text */ private class FriendFilter extends Filter { @Override protected FilterResults performFiltering(CharSequence constraint) { FilterResults filterResults = new FilterResults(); if (constraint!=null && constraint.length()>0) { ArrayList<EventInfo> tempList = new ArrayList<EventInfo>(); // search content in friend list for (EventInfo obj : EventList) { if (obj.getName().toLowerCase().contains(constraint.toString().toLowerCase())) { tempList.add(obj); } } filterResults.count = tempList.size(); filterResults.values = tempList; } else { filterResults.count = EventList.size(); filterResults.values = EventList; } return filterResults; } /** * Notify about filtered list to ui * @param constraint text * @param results filtered result */ @SuppressWarnings("unchecked") @Override protected void publishResults(CharSequence constraint, FilterResults results) { filteredList = (List<EventInfo>) results.values; notifyDataSetChanged(); } } }
package com.willian.Estoque.repository; import com.willian.Estoque.domain.Pedido; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface PedidoRepository extends JpaRepository<Pedido, Integer> { }
// ********************************************************** // 1. 제 목: SUBJECT INFORMATION USER BEAN // 2. 프로그램명: ProposeCourseBean.java // 3. 개 요: 과정안내 사용자 bean // 4. 환 경: JDK 1.3 // 5. 버 젼: 1.0 // 6. 작 성: 2004.01.14 // 7. 수 정: // ********************************************************** package com.ziaan.propose; import java.io.IOException; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Calendar; import java.util.Hashtable; //import java.util.StringTokenizer; import java.util.TimeZone; import com.ziaan.common.GetCodenm; import com.ziaan.library.AutoMailBean; import com.ziaan.library.ConfigSet; import com.ziaan.library.DBConnectionManager; import com.ziaan.library.DataBox; import com.ziaan.library.ErrorManager; import com.ziaan.library.FormatDate; import com.ziaan.library.FreeMailBean; import com.ziaan.library.ListSet; import com.ziaan.library.RequestBox; import com.ziaan.library.SQLString; import com.ziaan.library.StringManager; import com.ziaan.propose.email.SendRegisterCoursesEMail; import com.ziaan.propose.email.SendRegisterCoursesEMailImplBean; import com.ziaan.propose.email.log.EmailLog; import com.ziaan.propose.email.log.impl.EmailLogImplBean; import com.ziaan.scorm2004.ScormCourseBean; import com.ziaan.system.CodeAdminBean; import com.ziaan.system.SelectionData; public class ProposeCourseBean { public final static String GUBUN_CODE = "0049"; public final static String WORK_CODE = "W"; public final static String LANG_CODE = "L"; // private ConfigSet config; // private int row; public ProposeCourseBean() { try { //config = new ConfigSet(); //row = Integer.parseInt(config.getProperty("page.bulletin.row") ); // 이 모듈의 페이지당 row 수를 셋팅한다 } catch( Exception e ) { e.printStackTrace(); } } /** * 새로운 자료실 내용 등록 * @param box receive from the form object and session * @return isOk 1:insert success,0:insert fail * @throws Exception */ public int insertPds(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls = null; PreparedStatement pstmt1 = null; String sql1 = ""; int isOk1 = 1; String v_title = box.getString("p_title"); String v_content = box.getString("p_content"); String v_content1 = ""; String v_gubun = "02";//box.getString("p_gubun"); String v_enddate = box.getString("p_enddate"); String v_subj = box.getString("p_wantsubj"); String v_seq = box.getString("p_seq"); String s_userid = box.getSession("userid"); String s_usernm = box.getSession("name"); String s_orgnm = box.getSession("orgnm"); try { connMgr = new DBConnectionManager(); connMgr.setAutoCommit(false); //// //// //// //// //// //// //// //// // table 에 입력 //// //// //// //// //// //// //// //// //// //// //// //// //// //// //// //// /// sql1 = "insert into tz_subjwant_user(subj, year, userid,seq) "; sql1 += " values (?, to_char(sysdate, 'YYYY'), ?, ?) "; pstmt1 = connMgr.prepareStatement(sql1); pstmt1.setString(1, v_subj); pstmt1.setString(2, s_userid); pstmt1.setString(3, v_seq); isOk1 = pstmt1.executeUpdate(); if ( isOk1 > 0) connMgr.commit(); else connMgr.rollback(); } catch ( Exception ex ) { connMgr.rollback(); ErrorManager.getErrorStackTrace(ex, box, sql1); throw new Exception("sql = " + sql1 + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( pstmt1 != null ) { try { pstmt1.close(); } catch ( Exception e1 ) { } } if ( connMgr != null ) try { connMgr.setAutoCommit(true); } catch ( Exception e ) { } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch (Exception e10 ) { } } } return isOk1; } /** 사용자 - 수요조사 리스트보기 @param box receive from the form object and session @return ArrayList */ public ArrayList selectWantDateSubList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls1 = null; DataBox dbox = null; ArrayList list1 = null; String sql1 = ""; String ss_edustart = StringManager.replace(box.getStringDefault("s_edustart", ""), "-", ""); // 학습시작 String ss_eduend = StringManager.replace(box.getStringDefault("s_eduend", ""), "-", ""); // 학습종료 String ss_gyear = box.getStringDefault("s_gyear", FormatDate.getDate("yyyy")); //String ss_title = box.getString("s_title"); String v_searchtext = box.getString("p_searchtext"); try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); sql1 = " select year , seq , startdate , enddate, title from tz_subjwant_master \n"; sql1 += " where gubun = 'Y' \n"; sql1 += " and startdate <= to_char(sysdate, 'yyyyMMdd') "; sql1 += " and enddate >= to_char(sysdate, 'yyyyMMdd') "; if (!ss_gyear.equals("ALL")) { sql1 += " and year ='"+ss_gyear+"' \n"; // 시작일 if (!ss_edustart.equals("")) { sql1 += " and startdate >="+ss_edustart+" \n"; // 종료일 if (!ss_eduend.equals("")) { sql1 += " and enddate <='"+ss_eduend+"' \n"; } } } // 조사명 if (!v_searchtext.equals("")) { sql1 += " and title like '%" + v_searchtext + "%' \n"; } ls1 = connMgr.executeQuery(sql1); while(ls1.next()) { dbox = ls1.getDataBox(); list1.add(dbox); } } catch (Exception ex) { ErrorManager.getErrorStackTrace(ex, box, sql1); throw new Exception("sql1 = " + sql1 + "\r\n" + ex.getMessage()); } finally { if(ls1 != null) { try { ls1.close(); }catch (Exception e) {} } if(connMgr != null) { try { connMgr.freeConnection(); }catch (Exception e10) {} } } return list1; } /** 사용자 - 수요조사 @param box receive from the form object and session @return ArrayList */ public ArrayList selectSubjWantList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls1 = null; DataBox dbox = null; ArrayList list1 = null; String sql1 = ""; String v_user_id = box.getSession("userid"); String v_startdate = box.getString("s_startdate"); String v_enddate = box.getString("s_enddate"); // 개인의 회사 기준으로 과정 리스트 String v_comp = box.getSession("comp"); // 사이트의 GRCODE 로 과정 리스트 String v_grcode = box.getSession("tem_grcode"); String v_upperclass = box.getStringDefault("s_upperclass", "ALL"); String v_middleclass = box.getStringDefault("s_middleclass", "ALL"); String v_subjsearchkey = box.getString("p_searchtext"); String v_company = box.getStringDefault("s_company", "ALL"); String v_isessential = box.getStringDefault("s_isessential", "ALL"); String v_year = box.getString("p_year"); String v_seq = box.getString("p_seq"); String v_isonoff = box.getStringDefault("p_searchGu1", "ALL"); //교육구분 try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); /* sql1 = "select al.subj, subjnm, upperclass, middleclass, lowerclass, isonoff, \n"; sql1 +=" upperclassname, middleclassname,lowerclassname, subjcodenm, \n"; sql1 +=" edutimes, score, isessential , decode(gg.subj, '', 'N', 'Y') gubun \n"; sql1 +=" from ( select a.subj, a.subjnm, a.upperclass, a.lowerclass, a.isonoff, \n"; sql1 +=" c.classname as upperclassname, d.classname as middleclassname, a.middleclass, GET_SUBJCLASSNM(a.upperclass, a.middleclass, a.lowerclass) lowerclassname, e.codenm as subjcodenm, \n"; sql1 +=" a.cpsubj, a.edutimes, a.score, isessential \n"; sql1 +=" from tz_subj a \n"; sql1 +=" , (select upperclass, classname from tz_subjatt where middleclass = '000' and lowerclass = '000') c \n"; sql1 +=" , (select upperclass, middleclass, classname from tz_subjatt where lowerclass = '000') d \n"; sql1 +=" , (select code, codenm from tz_code where gubun = '0004') e \n"; //sql1 +=" , (select comp, compnm from tz_compclass) f \n"; sql1 +=" where a.upperclass = c.upperclass \n"; sql1 +=" and a.upperclass = d.upperclass \n"; sql1 +=" and a.middleclass = d.middleclass \n"; sql1 +=" and a.isonoff = e.code \n"; //sql1 +=" and a.cpsubj = f.comp(+) \n"; sql1 +=" and a.isvisible = 'Y' \n"; sql1 +=" union all \n"; sql1 +=" select b.course, b.coursenm, b.upperclass, b.middleclass, b.lowerclass) lowerclass, b.isonoff, \n"; sql1 +=" c.classname as upperclassname, d.classname as middleclassname, a.middleclass, GET_SUBJCLASSNM(b.upperclass, b.middleclass, b.lowerclass) lowerclass, e.codenm as subjcodenm, \n"; sql1 +=" b.cpsubj, 0 edutimes, 0 score, '' isessential \n"; sql1 +=" from tz_course b \n"; sql1 +=" , (select upperclass, classname from tz_subjatt where middleclass = '000' and lowerclass = '000') c \n"; sql1 +=" , (select upperclass, middleclass, classname from tz_subjatt where lowerclass = '000') d \n"; sql1 +=" , (select code, codenm from tz_code where gubun = '0004') e \n"; //sql1 +=" , (select comp, compnm from tz_compclass) f \n"; sql1 +=" where b.upperclass = c.upperclass \n"; sql1 +=" and b.upperclass = d.upperclass \n"; sql1 +=" and b.middleclass = d.middleclass \n"; sql1 +=" and b.isonoff = e.code \n"; //sql1 +=" and b.cpsubj = f.comp(+) \n"; sql1 +=" ) al ,(select subj from tz_subjwant_user where userid = "+SQLString.Format(v_user_id)+") gg, \n"; sql1 +=" (select subj from tz_subjwant_SUBJ where year = "+SQLString.Format(v_year)+" and seq = " + v_seq +") bl \n"; sql1 +=" where al.subj = gg.subj(+) \n"; sql1 +=" and al.subj = bl.subj "; */ sql1 = " select al.subj, subjnm, upperclass, middleclass, lowerclass, isonoff, \n "; sql1 += " upperclassname, middleclassname,lowerclassname, subjcodenm, \n "; sql1 += " edutimes, score, isessential , decode(gg.subj, '', 'N', 'Y') gubun \n "; sql1 += " from ( select a.subj, a.subjnm, a.upperclass, a.lowerclass, a.isonoff, \n "; sql1 += " c.classname as upperclassname, d.classname as middleclassname, a.middleclass, GET_SUBJCLASSNM(a.upperclass, a.middleclass, a.lowerclass) lowerclassname, e.codenm as subjcodenm, \n "; sql1 += " a.cpsubj, a.edutimes, a.score, isessential \n "; sql1 += " from tz_subj a \n "; sql1 += " , (select upperclass, classname from tz_subjatt where middleclass = '000' and lowerclass = '000') c \n "; sql1 += " , (select upperclass, middleclass, classname from tz_subjatt where lowerclass = '000') d \n "; sql1 += " , (select code, codenm from tz_code where gubun = '0004') e \n "; sql1 += " where a.upperclass = c.upperclass \n "; sql1 += " and a.upperclass = d.upperclass \n "; sql1 += " and a.middleclass = d.middleclass \n "; sql1 += " and a.isonoff = e.code \n "; sql1 += " and a.isvisible = 'Y' \n "; sql1 += " union all \n "; sql1 += " select b.course, b.coursenm, b.upperclass, b.lowerclass lowerclass, '' isonoff, \n "; sql1 += " c.classname as upperclassname, d.classname as middleclassname, b.middleclass, GET_SUBJCLASSNM(b.upperclass, b.middleclass, b.lowerclass) lowerclassname, '' as subjcodenm, \n "; sql1 += " '' cpsubj, 0 edutimes, 0 score, '' isessential \n "; sql1 += " from tz_course b \n "; sql1 += " , (select upperclass, classname from tz_subjatt where middleclass = '000' and lowerclass = '000') c \n "; sql1 += " , (select upperclass, middleclass, classname from tz_subjatt where lowerclass = '000') d \n "; //sql1 += " , (select code, codenm from tz_code where gubun = '0004') e \n "; sql1 += " where b.upperclass = c.upperclass \n "; sql1 += " and b.upperclass = d.upperclass \n "; sql1 += " and b.middleclass = d.middleclass \n "; //sql1 += " and b.isonoff = e.code \n "; sql1 += " ) al ,(select subj from tz_subjwant_user where userid = "+SQLString.Format(v_user_id)+" and year = "+SQLString.Format(v_year)+" and seq = "+v_seq+" ) gg, \n "; sql1 += " (select subj from tz_subjwant_SUBJ where year = "+SQLString.Format(v_year)+" and seq = " + v_seq +") bl \n "; sql1 += " where al.subj = bl.subj \n "; sql1 += " and bl.subj = gg.subj(+) \n "; //대분류 if(!v_upperclass.equals("ALL")) { sql1 += " and upperclass = " + SQLString.Format(v_upperclass); } //중분류 if(!v_middleclass.equals("ALL")) { sql1 += " and middleclass = " + SQLString.Format(v_middleclass); } //교육기관 if(!v_company.equals("ALL")) { sql1 += " and cpsubj = " + SQLString.Format(v_company); } //과정명 if(!v_subjsearchkey.equals("")) { sql1 += " and subjnm like '%" + v_subjsearchkey + "%'"; } //필수여부 if(!v_isessential.equals("ALL")) { sql1 += " and isessential = " + SQLString.Format(v_isessential); } //교육구분 if(!v_isonoff.equals("ALL")) { sql1 += " and isonoff = " + SQLString.Format(v_isonoff); } //과정유형 // if(!v_isonoff.equals("ALL")) { // sql1 += " and isonoff = " + SQLString.Format(v_isonoff); // } // 교육기간 - 시작 // if(!v_startdate.equals("")) { // sql1 += " and startdate <= '" + v_startdate+ "23' \n"; // } //교육기간 - 종료 // if(!v_enddate.equals("")) { // sql1 += " and enddate >= '" + v_enddate+ "00' \n"; // } sql1 +=" order by al.subj, al.subjnm \n"; ls1 = connMgr.executeQuery(sql1); while(ls1.next()) { dbox = ls1.getDataBox(); list1.add(dbox); } } catch (Exception ex) { ErrorManager.getErrorStackTrace(ex, box, sql1); throw new Exception("sql1 = " + sql1 + "\r\n" + ex.getMessage()); } finally { if(ls1 != null) { try { ls1.close(); }catch (Exception e) {} } if(connMgr != null) { try { connMgr.freeConnection(); }catch (Exception e10) {} } } return list1; } /** 수강과정 리스트 (온라인) @param box receive from the form object and session @return ArrayList */ public ArrayList selectSubjectList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox1 = null; ListSet ls1 = null; ArrayList list1 = null; StringBuffer sbSQL = new StringBuffer(""); // int iSysAdd = 0; String v_select = box.getStringDefault("p_select" , "ON" ); String v_gubun = box.getStringDefault("p_gubun" , WORK_CODE ); String v_user_id = box.getSession("userid"); String v_gadmin = box.getSession("gadmin"); // 개인의 회사 기준으로 과정 리스트 // String v_comp = box.getSession("comp" ); // 사이트의 GRCODE 로 과정 리스트 String v_grcode = box.getSession("tem_grcode"); // String gyear = box.getStringDefault("gyear",FormatDate.getDate("yyyy")); try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); // 수강신청 가능한 과정 sbSQL.append(" select distinct \n") .append(" a.subj \n") .append(" , a.subjnm \n") .append(" , a.isonoff \n") .append(" , a.scupperclass \n") .append(" , a.scmiddleclass \n") .append(" , a.sclowerclass \n") .append(" , usebook \n") .append(" , substr(a.specials, 1, 1) isnew \n") .append(" , substr(a.specials, 2, 1) ishit \n") .append(" , substr(a.specials, 3, 1) isrecom \n") .append(" , ( \n") .append(" select classname \n") .append(" from tz_subjatt x \n") .append(" where x.upperclass = a.scupperclass \n") .append(" and x.middleclass = '000' \n") .append(" and x.lowerclass = '000' \n") .append(" ) uclassnm \n") .append(" , ( \n") .append(" select classname \n") .append(" from tz_subjatt x \n") .append(" where x.upperclass = a.scupperclass \n") .append(" and x.middleclass = a.scmiddleclass \n") .append(" and x.lowerclass = '000' \n") .append(" ) mclassnm \n") .append(" from vz_scsubjseq a \n") .append(" where a.grcode = " + SQLString.Format(v_grcode ) + " \n") .append(" and a.isuse = 'Y' \n") .append(" and a.isonoff = " +SQLString.Format(v_select ) + " \n") .append(" and a.scupperclass in ( \n") .append(" select upperclass \n") .append(" from tz_classfymatch \n") .append(" where matchcode = " + SQLString.Format(v_gubun) + " \n") .append(" ) \n") .append(" and to_char(sysdate,'yyyymmddhh24miss') between a.propstart and a.propend \n"); if ( !v_gadmin.equals("A1") ) { sbSQL.append(" and subjvisible = 'Y' \n"); } // 지정된 마스터과정만 출력 sbSQL.append(" and a.subj + a.year + a.subjseq \n") .append(" not in ( \n") .append(" select distinct scsubj || scyear || scsubjseq \n") .append(" from vz_mastersubjseq \n") .append(" where scsubj + scyear + scsubjseq \n") .append(" not in ( \n") .append(" select a.subjcourse || a.year || a.subjseq \n") .append(" from tz_mastersubj a \n") .append(" , tz_edutarget b \n") .append(" where a.mastercd = b.mastercd \n") .append(" and a.grcode = " + SQLString.Format(v_grcode) + " \n") .append(" and b.userid = " + SQLString.Format(v_user_id) + " \n") .append(" ) \n") .append(" ) \n") .append(" order by a.scupperclass, a.scmiddleclass, a.subjnm \n"); ls1 = connMgr.executeQuery(sbSQL.toString()); while ( ls1.next() ) { dbox1 = ls1.getDataBox(); list1.add(dbox1); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return list1; } /** 수강과정 리스트 (오프라인) @param box receive from the form object and session @return ArrayList */ public ArrayList selectSubjectOffList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls1 = null; ArrayList list1 = null; StringBuffer sbSQL = new StringBuffer(""); String v_select = box.getStringDefault("p_select","OFF"); String v_user_id = box.getSession("userid"); String v_gadmin = box.getSession("gadmin"); // 사이트의 GRCODE 로 과정 리스트 String v_grcode = box.getSession("tem_grcode"); String gyear = box.getStringDefault("gyear", FormatDate.getDate("yyyy")); try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); // 수강신청 가능한 과정 sbSQL.append(" select distinct \n") .append(" subj \n") .append(" , subjnm \n") .append(" , isonoff \n") .append(" , scupperclass \n") .append(" , scmiddleclass \n") .append(" , sclowerclass \n") .append(" , usebook \n") .append(" , substr(a.specials, 1 ,1) isnew \n") .append(" , substr(a.specials, 2 ,1) ishit \n") .append(" , substr(a.specials, 3 ,1) isrecom \n") .append(" , ( \n") .append(" select classname \n") .append(" from tz_subjatt x \n") .append(" where x.upperclass = a.scupperclass \n") .append(" and x.middleclass = '000' \n") .append(" and x.lowerclass = '000' \n") .append(" ) uclassnm \n") .append(" , ( \n") .append(" select classname \n") .append(" from tz_subjatt x \n") .append(" where x.upperclass = a.scupperclass \n") .append(" and x.middleclass = a.scmiddleclass \n") .append(" and x.lowerclass = '000' \n") .append(" ) mclassnm \n") .append(" , ( \n") .append(" select count(subjseq) \n") .append(" from tz_subjseq x \n") .append(" where x.grcode = " + SQLString.Format(v_grcode) + " \n") .append(" and x.subj = a.subj \n") .append(" and x.gyear = a.gyear \n") .append(" ) totcnt \n") .append(" from vz_scsubjseq a \n") .append(" where grcode = " + SQLString.Format(v_grcode ) + " \n") .append(" and isuse = 'Y' \n") .append(" and a.scyear = " +SQLString.Format(gyear ) + " \n") .append(" and a.isonoff = " +SQLString.Format(v_select ) + " \n") .append(" and to_char(sysdate,'yyyymmddhh24miss') between a.propstart and a.propend \n"); // 총괄관리자의 경우에는 보여준다 if ( !v_gadmin.equals("A1") ) { sbSQL.append(" and subjvisible = 'Y' \n"); } // 지정된 마스터과정만 출력 sbSQL.append(" and a.subj || a.year || a.subjseq \n") .append(" not in ( \n") .append(" select distinct \n") .append(" scsubj || scyear || scsubjseq \n") .append(" from vz_mastersubjseq \n") .append(" where scsubj || scyear || scsubjseq \n") .append(" not in ( \n") .append(" select a.subjcourse || a.year || a.subjseq \n") .append(" from tz_mastersubj a \n") .append(" , tz_edutarget b \n") .append(" where a.mastercd = b.mastercd \n") .append(" and a.grcode = " + SQLString.Format(v_grcode ) + " \n") .append(" and b.userid = " + SQLString.Format(v_user_id) + " \n") .append(" ) \n") .append(" ) \n") .append(" order by scupperclass, scmiddleclass, subjnm \n"); ls1 = connMgr.executeQuery(sbSQL.toString()); while ( ls1.next() ) { dbox = ls1.getDataBox(); list1.add(dbox); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e, box, ""); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return list1; } /** 전체 과정 리스트 (온라인) @param box receive from the form object and session @return ArrayList */ public ArrayList selectSubjectListAll(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox1 = null; ListSet ls1 = null; ArrayList list1 = null; String sql1 = ""; MainSubjSearchBean bean = new MainSubjSearchBean(); String v_select = "ON"; // 온라인 전체과정 String v_user_id = box.getSession("userid"); String v_gadmin = box.getSession("gadmin"); // 개인의 회사 기준으로 과정 리스트 String v_comp = box.getSession("comp"); // 사이트의 GRCODE 로 과정 리스트 String v_grcode = box.getSession("tem_grcode"); // String gyear = box.getStringDefault("gyear",FormatDate.getDate("yyyy") ); try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); // 전체과정 리스트 sql1 = " select distinct a.subj, a.year, a.subjseq, a.subjnm, a.isonoff, a.scupperclass, a.scmiddleclass, a.sclowerclass, a.usebook, "; // a.aescontentid, "; sql1 += " a.propstart, a.propend, a.edustart, a.eduend, a.studentlimit, a.subjseqgr, a.preurl, contenttype, "; sql1 += " substr(a.specials,1,1) isnew, substr(a.specials,2,1) ishit, substr(a.specials,3,1) isrecom, "; sql1 += " (select classname from tz_subjatt x "; sql1 += " where x.upperclass = a.scupperclass and x.middleclass = '000' and x.lowerclass = '000' ) uclassnm, "; sql1 += " (select classname from tz_subjatt x "; sql1 += " where x.upperclass = a.scupperclass and x.middleclass = a.scmiddleclass and x.lowerclass = '000' ) mclassnm "; sql1 += " from VZ_SCSUBJSEQ a "; sql1 += " where a.grcode = " + SQLString.Format(v_grcode); // 개인기준인지 // sql1 += " where grcode in (select grcode from TZ_GRCOMP where comp like '" +v_comp + "%') "; sql1 += " and (select comp from tz_grseq where grcode =a.grcode and gyear = a.gyear and grseq = a.grseq) = " + SQLString.Format(v_comp); sql1 += " and a.isuse = 'Y' "; sql1 += " and a.isonoff = " +SQLString.Format(v_select); sql1 += " and to_char(sysdate,'yyyymmddhh24miss') between a.propstart and a.propend "; if ( !v_gadmin.equals("A1")) sql1 += " and subjvisible = 'Y' "; // 지정된 마스터과정만 출력 sql1 += " and a.subj||a.year||a.subjseq not in ( "; sql1 += " select distinct scsubj||scyear||scsubjseq from vz_mastersubjseq "; sql1 += " where scsubj||scyear||scsubjseq not in ( "; sql1 += " select a.subjcourse||a.year||a.subjseq from tz_mastersubj a , tz_edutarget b "; sql1 += " where a.mastercd = b.mastercd "; sql1 += " and a.grcode = " + SQLString.Format(v_grcode); sql1 += " and b.userid = " + SQLString.Format(v_user_id) + " ) "; sql1 += " ) "; sql1 += " order by a.scupperclass , a.scmiddleclass, a.subjnm "; ls1 = connMgr.executeQuery(sql1); while ( ls1.next() ) { dbox1 = ls1.getDataBox(); dbox1.put("d_ispropose", bean.getPropseStatus(box,ls1.getString("subj"),ls1.getString("subjseq"),ls1.getString("year"),v_user_id, "3") ); list1.add(dbox1); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql1); throw new Exception("sql1 = " + sql1 + "\r\n" + ex.getMessage() ); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list1; } /** 인기과정소개 @param box receive from the form object and session @return ArrayList 과정 리스트 */ public ArrayList selectSubjectListBest(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls1 = null; DataBox dbox1 = null; ArrayList list1 = null; StringBuffer sbSQL = new StringBuffer(""); // DataBox dbox = null; String v_select = "ON"; // 온라인 전체과정 String v_gubun = box.getStringDefault("p_gubun", WORK_CODE); // String v_user_id = box.getSession("userid"); // String v_gadmin = box.getSession("gadmin"); String v_comp = box.getSession("comp" ); // 개인의 회사 기준으로 과정 리스트 String v_grcode = box.getSession("tem_grcode" ); // 사이트의 GRCODE 로 과정 리스트 // String gyear = box.getStringDefault("gyear",FormatDate.getDate("yyyy") ); try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); // 전체과정 리스트 sbSQL.append(" select rownum \n") .append(" , subj \n") .append(" , subjnm \n") .append(" , isonoff \n") .append(" , scupperclass \n") .append(" , scmiddleclass \n") .append(" , sclowerclass \n") .append(" , uclassnm \n") .append(" , mclassnm \n") .append(" , cnt \n") .append(" from ( \n") .append(" select distinct \n") .append(" a.subj \n") .append(" , a.subjnm \n") .append(" , a.isonoff \n") .append(" , a.scupperclass \n") .append(" , a.scmiddleclass \n") .append(" , a.sclowerclass \n") .append(" , ( \n") .append(" select classname \n") .append(" from tz_subjatt x \n") .append(" where x.upperclass = a.scupperclass \n") .append(" and x.middleclass = '000' \n") .append(" and x.lowerclass = '000' \n") .append(" ) uclassnm \n") .append(" , ( \n") .append(" select classname \n") .append(" from tz_subjatt x \n") .append(" where x.upperclass = a.scupperclass \n") .append(" and x.middleclass = a.scmiddleclass \n") .append(" and x.lowerclass = '000' \n") .append(" ) mclassnm \n") .append(" , b.cnt \n") .append(" from vz_scsubjseq a \n") .append(" , ( \n") .append(" select subj \n") .append(" , count(userid) cnt \n") .append(" from tz_propose \n") .append(" where cancelkind is null \n") .append(" group by subj \n") .append(" ) b \n") .append(" where a.subj = b.subj \n") .append(" and a.grcode = " + SQLString.Format(v_grcode ) + " \n") .append(" and ( \n") .append(" select comp \n") .append(" from tz_grseq \n") .append(" where grcode = a.grcode \n") .append(" and gyear = a.gyear \n") .append(" and grseq = a.grseq \n") .append(" ) = " + SQLString.Format( v_comp ) + " \n") .append(" and a.isuse = 'Y' \n") .append(" and a.isonoff = " + SQLString.Format(v_select ) + " \n") .append(" and a.scupperclass in ( \n") .append(" select upperclass \n") .append(" from TZ_CLASSFYMATCH \n") .append(" where matchcode = " + SQLString.Format(v_gubun) + " \n") .append(" ) \n") .append(" order by b.cnt \n") .append(" ) \n") .append(" where rownum <= 5 \n"); ls1 = connMgr.executeQuery(sbSQL.toString()); while ( ls1.next() ) { dbox1 = ls1.getDataBox(); list1.add(dbox1); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return list1; } /** 과정상세보기 @param box receive from the form object and session @return ProposeCourseData */ public DataBox selectSubjectPreview(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls1 = null; StringBuffer sbSQL = new StringBuffer(""); String v_subj = box.getString("p_subj"); try { connMgr = new DBConnectionManager(); sbSQL.append(" select subj \n") .append(" , subjnm \n") .append(" , contenttype \n") .append(" , conturl \n") .append(" , subjtarget \n") .append(" , edudays \n") .append(" , edutimes \n") .append(" , place \n") .append(" , placejh \n") .append(" , edutype \n") .append(" , subjtarget \n") .append(" , edumans \n") .append(" , intro \n") .append(" , explain \n") .append(" , owner \n") .append(" , ownerman \n") .append(" , ownertel \n") .append(" , preurl \n") .append(" , bookfilenamereal \n") .append(" , bookfilenamenew \n") .append(" , muserid \n") .append(" , musertel \n") .append(" , isoutsourcing \n") .append(" , introducefilenamereal \n") .append(" , introducefilenamenew \n") .append(" , contenttype \n") .append(" , tutor \n") .append(" , tm.name tutornm \n") .append(" , nvl(( \n") .append(" select betacpnm \n") .append(" from tz_betacpinfo \n") .append(" where betacpno = ts.producer \n") .append(" ), nvl(( \n") .append(" select compnm \n") .append(" from tz_compclass \n") .append(" where comp = ts.producer \n") .append(" ), ( \n") .append(" select cpnm \n") .append(" from tz_cpinfo \n") .append(" where cpseq = ts.producer \n") .append(" ))) producernm \n") .append(" , nvl(( \n") .append(" select cpnm \n") .append(" from tz_cpinfo \n") .append(" where cpseq = ts.owner \n") .append(" ), ( \n") .append(" select compnm \n") .append(" from tz_compclass \n") .append(" where comp = ts.owner \n") .append(" )) ownernm \n") .append(" , biyong \n") .append(" , graduatednote \n") .append(" , usebook \n") .append(" , bookname \n") .append(" , isgoyong \n") .append(" from tz_subj ts, tz_member tm \n") .append(" where ts.tutor = tm.userid(+) \n") .append(" and ts.subj = " +SQLString.Format(v_subj) + " \n"); ls1 = connMgr.executeQuery(sbSQL.toString()); if ( ls1.next() ) { dbox = ls1.getDataBox(); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e, box, ""); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return dbox; } /** 기수정보상세보기 @param box receive from the form object and session @return ProposeCourseData */ public DataBox selectSubjSeqPreview(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls1 = null; String sql = ""; String v_subj = box.getString("p_subj"); String v_subjseq = box.getString("p_subjseq"); String v_year = box.getString("p_year"); // String gyear = box.getString("gyear"); // String v_isonoff = box.getString("p_isonoff"); try { connMgr = new DBConnectionManager(); sql = " select \n"; sql += " a.propstart, \n"; sql += " a.propend, \n"; sql += " a.edustart, \n"; sql += " a.eduend, \n"; sql += " a.studentlimit, \n"; sql += " a.subjseq, \n"; sql += " a.subjseqgr, \n"; sql += " a.subjnm, \n"; sql += " b.edutimes, \n"; sql += " a.biyong, \n"; sql += " a.gradscore, \n"; /* 수료기준-점수 */ sql += " a.gradstep, \n"; /* 수료기준-진도율 */ sql += " a.gradreport, \n"; /* 수료기준-과제 */ sql += " a.gradreportyn, \n"; /* 수료기준-과제제출미제출*/ sql += " a.gradexam, \n"; /* 수료기준-평가 */ sql += " a.gradftest, \n"; /* 수료기준-평가 */ sql += " a.gradhtest, \n"; /* 수료기준-평가 */ sql += " a.wstep, \n"; /* 가중치-진도율 */ sql += " a.wmtest, \n"; /* 가중치-중간평가 */ sql += " a.wftest, \n"; /* 가중치-최종평가 */ sql += " a.whtest, \n"; /* 가중치-형성평가 */ sql += " a.wreport, \n"; /* 가중치-REPORT */ sql += " a.wetc1, \n"; /* 가중치-REPORT */ sql += " a.wetc2, \n"; /* 가중치-REPORT */ sql += " a.isgoyong, \n"; sql += " a.place, \n"; sql += " a.placejh \n"; sql += " from \n"; sql += " tz_subjseq a, tz_subj b \n"; sql += " where \n"; sql += " a.subj = b.subj\n"; sql += " and a.subj = " +SQLString.Format(v_subj) + " \n"; sql += " and a.subjseq = " +SQLString.Format(v_subjseq) + " \n"; sql += " and a.year = " +SQLString.Format(v_year) + " \n"; // sql += " and gyear = " +SQLString.Format(gyear) + " \n"; ls1 = connMgr.executeQuery(sql); if ( ls1.next() ) { dbox = ls1.getDataBox(); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return dbox; } /** 개설기수 리스트 @param box receive from the form object and session @return ProposeCourseData */ public ArrayList selectSubjSeqList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; // DataBox dbox1 = null; ListSet ls1 = null; ArrayList list1 = null; StringBuffer sbSQL = new StringBuffer(""); MainSubjSearchBean bean = null; String v_subj = box.getString("p_subj" ); String v_subjseq = box.getString("p_subjseq" ); String v_year = box.getString("p_year" ); // String ss_upperclass = box.getStringDefault("p_upperclass", "A01"); String v_user_id = box.getSession("userid" ); String v_gadmin = box.getSession("gadmin" ); // 개인의 회사 기준으로 과정 리스트 // String v_comp = box.getSession("comp" ); // 사이트의 GRCODE 로 과정 리스트 String v_grcode = box.getSession("tem_grcode" ); String ss_userid = box.getSession("userid"); String ss_comp = box.getSession("comp"); try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); bean = new MainSubjSearchBean(); sbSQL.append(" select subj \n") .append(" , ( \n") .append(" select case when count(*) > 0 then 'Y' else 'N' end \n") .append(" from tz_propose \n") .append(" where subj = a.subj \n") .append(" and year = a.year \n") .append(" and subjseq = a.subjseq \n") .append(" and userid = " + StringManager.makeSQL(ss_userid) + " \n") .append(" group by subj, year, subjseq, userid \n") .append(" ) proposeyn \n") .append(" , subjseq \n") .append(" , year \n") .append(" , propstart \n") .append(" , propend \n") .append(" , edustart \n") .append(" , eduend \n") .append(" , studentlimit \n") .append(" , subjseqgr \n") .append(" , isonoff \n") .append(" , contenttype \n") .append(" , ( \n") .append(" select proposetype \n") .append(" from vz_mastersubjseq \n") .append(" where subj = a.subj \n") .append(" and subjseq = a.subjseq \n") .append(" and year = a.year \n") .append(" ) proposetype \n") .append(" , ( \n") .append(" select mastercd \n") .append(" from vz_mastersubjseq \n") .append(" where subj = a.subj \n") .append(" and subjseq = a.subjseq \n") .append(" and year = a.year \n") .append(" ) mastercd \n") .append(" , ( \n") .append(" select count(*) cnt \n") .append(" from tz_propose \n") .append(" where subj = a.subj \n") .append(" and year = a.year \n") .append(" and subjseq = a.subjseq \n") .append(" and nvl(cancelkind,' ') not in ('F','P') \n") .append(" ) propcnt \n") .append(" , ( \n") .append(" select ldate propose_date \n") //TO_CHAR(TO_DATE(ldate, 'YYYYMMDDHH24MISS'), 'MM\"월\" DD\"일\"') .append(" from tz_propose \n") .append(" where subj = a.subj \n") .append(" and year = a.year \n") .append(" and subjseq = a.subjseq \n") .append(" and userid = " + SQLString.Format(v_user_id) + " \n") .append(" and nvl(cancelkind,' ') not in ('F','P') \n") .append(" ) propose_date \n") .append(" , CASE WHEN WStep > 0 THEN WStep || '%' \n") .append(" ELSE '0%' \n") .append(" END WStep_Name \n") .append(" , CASE WHEN WMTest > 0 THEN WMTest || '%' \n") .append(" ELSE '0%' \n") .append(" END WMTest_Name \n") .append(" , CASE WHEN WHTest > 0 THEN WHTest || '%' \n") .append(" ELSE '0%' \n") .append(" END WHTest_Name \n") .append(" , CASE WHEN WFTest > 0 THEN WFTest || '%' \n") .append(" ELSE '0%' \n") .append(" END WFTest_Name \n") .append(" , CASE WHEN WReport > 0 THEN WReport || '%' \n") .append(" ELSE '0%' \n") .append(" END WReport_Name \n") .append(" , CASE WHEN WEtc1 > 0 THEN WEtc1 || '%' \n") .append(" ELSE '0%' \n") .append(" END WEtc1_Name \n") .append(" , CASE WHEN WEtc2 > 0 THEN WEtc2 || '%' \n") .append(" ELSE '0%' \n") .append(" END WEtc2_Name \n") .append(" , CASE WHEN GradStep > 0 THEN GradStep || '% 이상 진행 필수' \n") .append(" ELSE '' \n") .append(" END GradStep_Name \n") .append(" , CASE WHEN SGradScore > 0 THEN SGradScore || '점 이상 필수' \n") .append(" ELSE '' \n") .append(" END SGradScore_Name \n") .append(" , (case when GradExam_Flag = 'R' then '평가 필수' else ( \n") .append(" CASE WHEN WMTest > 0 THEN '평가 선택' \n") .append(" ELSE '' \n") .append(" END \n") .append(" ) end \n") .append(" ) GradExam_Name \n") .append(" , (case when GradHTest_Flag = 'R' then '평가 필수' else ( \n") .append(" CASE WHEN WHTest > 0 THEN '평가 선택' \n") .append(" ELSE '' \n") .append(" END \n") .append(" ) end \n") .append(" ) GradHTest_Name \n") .append(" , (case when GradFTest_Flag = 'R' then '평가 필수' else ( \n") .append(" CASE WHEN WFTest > 0 THEN '평가 선택' \n") .append(" ELSE '' \n") .append(" END \n") .append(" ) end \n") .append(" ) GradFTest_Name \n") .append(" , (case when GradReport_Flag = 'R' then '과제 제출 필수' else ( \n") .append(" CASE WHEN WFTest > 0 THEN '과제 제출 선택' \n") .append(" ELSE '' \n") .append(" END \n") .append(" ) end \n") .append(" ) GradReport_Name \n") .append(" , sgradscore \n") .append(" , gradstep \n") .append(" , gradexam \n") .append(" , gradftest \n") .append(" , gradreport \n") .append(" , biyong \n") .append(" , a.usebook, a.bookname, a.isgoyong \n") .append(" , a.placejh \n") .append(" from vz_scsubjseq a, tz_grcomp b \n") .append(" where scsubj = " + SQLString.Format(v_subj ) + " \n"); if ( !v_subjseq.equals("") ) { sbSQL.append(" and subjseq= " + SQLString.Format(v_subjseq ) + " \n"); } // sbSQL.append(" and grcode = " + SQLString.Format(v_grcode ) + " \n"); sbSQL.append(" and a.grcode = b.grcode \n"); sbSQL.append(" and b.comp = " + SQLString.Format(ss_comp) + " \n"); // .append(" and a.isblended = 'N' \n") // .append(" and a.isexpert = 'N' \n"); // 총괄관리자인경우에는 보여준다. if ( !v_gadmin.equals("A1") ) { sbSQL.append(" and seqvisible = 'Y' \n"); } if ( !v_year.equals("") ) { sbSQL.append(" and gyear = " + SQLString.Format(v_year ) + " \n"); } // 지정된 마스터과정만 출력 sbSQL.append(" and a.subj || a.year || a.subjseq \n") .append(" not in ( \n") .append(" select distinct \n") .append(" scsubj || scyear || scsubjseq \n") .append(" from vz_mastersubjseq \n") .append(" where scsubj || scyear || scsubjseq \n") .append(" not in ( \n") .append(" select a.subjcourse || a.year || a.subjseq \n") .append(" from tz_mastersubj a \n") .append(" , tz_edutarget b \n") .append(" , tz_grcomp c \n") .append(" where a.mastercd = b.mastercd \n") // .append(" and a.grcode = " + SQLString.Format(v_grcode ) + " \n") .append(" and a.grcode = c.grcode \n") .append(" and c.comp = " + SQLString.Format(ss_comp) + " \n") .append(" and b.userid = " + SQLString.Format(v_user_id) + " \n") .append(" ) \n") .append(" ) \n") .append(" order by subjseqgr \n"); ls1 = connMgr.executeQuery(sbSQL.toString()); //System.out.println(sbSQL.toString()); while ( ls1.next() ) { dbox = ls1.getDataBox(); dbox.put("d_ispropose", bean.getPropseStatus(box,ls1.getString("subj"), ls1.getString("subjseq"), ls1.getString("year"), v_user_id, "3")); list1.add(dbox); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return list1; } /** 선수과정 리스트 @param box receive from the form object and session @return ArrayList 선수과정 리스트 */ public ArrayList selectListPre(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ArrayList list = null; ListSet ls = null; String sql = ""; DataBox dbox = null; String v_subj = box.getString("p_subj"); try { connMgr = new DBConnectionManager(); list = new ArrayList(); sql = " select a.gubun, b.subjnm from tz_subjrelate a, tz_subj b "; sql += " where a.rsubj = b.subj "; sql += " and gubun = 'PRE' "; sql += " and a.subj = " + SQLString.Format(v_subj); ls = connMgr.executeQuery(sql); while ( ls.next() ) { dbox = ls.getDataBox(); list.add(dbox); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list; } /** 후수과정 리스트 @param box receive from the form object and session @return ArrayList 후수과정 리스트 */ public ArrayList selectListNext(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ArrayList list = null; ListSet ls = null; String sql = ""; DataBox dbox = null; String v_subj = box.getString("p_subj"); try { connMgr = new DBConnectionManager(); list = new ArrayList(); sql = " select a.gubun, b.subjnm from tz_subjrelate a, tz_subj b "; sql += " where a.rsubj = b.subj "; sql += " and gubun = 'NEXT' "; sql += " and a.subj = " + SQLString.Format(v_subj); ls = connMgr.executeQuery(sql); while ( ls.next() ) { dbox = ls.getDataBox(); list.add(dbox); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list; } /** 일차 리스트 @param box receive from the form object and session @return ArrayList */ public ArrayList selectLessonList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls = null; ArrayList list = null; StringBuffer sbSQL = new StringBuffer(""); // ProposeCourseData data = null; String v_subj = box.getString("p_subj"); // 과정 try { connMgr = new DBConnectionManager(); list = new ArrayList(); // select lesson,sdesc sbSQL.append(" select lesson \n") .append(" , sdesc \n") .append(" from tz_subjlesson \n") .append(" where subj = " + SQLString.Format(v_subj) + " \n") .append(" order by lesson \n"); ls = connMgr.executeQuery(sbSQL.toString()); while ( ls.next() ) { dbox = ls.getDataBox(); list.add(dbox); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return list; } /** 강좌 리스트 @param box receive from the form object and session @return ArrayList */ public ArrayList selectLectureList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls = null; ArrayList list = null; StringBuffer sbSQL = new StringBuffer(""); ProposeCourseData data = null; String v_subj = box.getString("p_subj" ); String v_year = box.getString("p_year" ); String v_subjseq = box.getString("p_subjseq" ); String v_lectdate = ""; String v_lectsttime = ""; try { connMgr = new DBConnectionManager(); list = new ArrayList(); sbSQL.append(" select lecture \n") .append(" , sdesc \n") .append(" , lectdate \n") .append(" , lectsttime \n") .append(" , ( \n") .append(" select name \n") .append(" from tz_tutor \n") .append(" where userid = a.tutorid \n") .append(" ) tutor \n") .append(" from tz_offsubjlecture a \n") .append(" where subj = " + SQLString.Format(v_subj ) + " \n") .append(" and year = " + SQLString.Format(v_year ) + " \n") .append(" and subjseq = " + SQLString.Format(v_subjseq ) + " \n") .append(" order by lecture \n"); ls = connMgr.executeQuery(sbSQL.toString()); while ( ls.next() ) { data = new ProposeCourseData(); v_lectdate = FormatDate.getFormatDate( ls.getString("lectdate"),"yyyy.MM.dd"); v_lectsttime= FormatDate.getFormatTime( ls.getString("lectsttime"),"HH:mm"); data.setLecture ( ls.getString("lecture") ); data.setSdesc ( ls.getString("sdesc" ) ); data.setLecturedate ( v_lectdate + " " +v_lectsttime ); data.setTutor ( ls.getString("tutor" ) ); list.add(data); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return list; } /** 신청자 리스트 @param box receive from the form object and session @return ArrayList */ public ArrayList selectProposeList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls1 = null; // ListSet ls2 = null; ArrayList list1 = null; // ArrayList list2 = null; StringBuffer sbSQL = new StringBuffer(""); String v_subj = box.getString("p_subj"); String v_comp = box.getSession("comp"); String gyear = box.getStringDefault("gyear",FormatDate.getDate("yyyy") ); v_comp = v_comp.substring(0,4); try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); sbSQL.append(" select c.subjseqgr \n") .append(" , b.name \n") .append(" , a.appdate \n") .append(" from tz_propose a \n") .append(" , tz_member b \n") .append(" , vz_scsubjseq c \n") .append(" where a.userid = b.userid \n") .append(" and a.subj = c.scsubj \n") .append(" and a.subjseq = c.scsubjseq \n") .append(" and a.year = c.year \n") .append(" and a.subj = " + SQLString.Format( v_subj ) + " \n") .append(" and a.year = " + SQLString.Format( gyear ) + " \n") .append(" and c.grcode in ( \n") .append(" select grcode \n") .append(" from tz_grcomp \n") .append(" where comp like " + SQLString.Format(v_comp + "%") + " \n") .append(" ) \n") .append(" and substr(to_char(sysdate,'yyyymmddhh24miss'), 1, 10) between c.propstart and c.edustart \n") .append(" order by c.subjseqgr, b.comp, b.name \n"); ls1 = connMgr.executeQuery(sbSQL.toString()); while ( ls1.next() ) { dbox = ls1.getDataBox(); list1.add(dbox); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return list1; } /** 수강신청 @param box receive from the form object and session @return int */ public int insertSubjectEduPropose(RequestBox box) throws Exception { EmailLog emailLog=new EmailLogImplBean(); DBConnectionManager connMgr = null; PreparedStatement pstmt = null; ListSet ls = null; ListSet ls2 = null; StringBuffer sbSQL = new StringBuffer(""); int isOk = 0; String v_subj = box.getString("p_subj" ); String v_year = box.getString("p_year" ); String v_subjseq = box.getString("p_subjseq" ); String v_user_id = box.getSession("userid" ); String v_comp = box.getSession("comp" ); String v_jik = box.getSession("jikup" ); String v_jit = box.getString("p_jit"); String v_proposetype = box.getString("p_proposetype"); String v_chkfinal = "B"; // 미처리(신청승인전, 수강신청시 셋팅값) String v_lec_sel_no = box.getString("p_lec_sel_no"); String v_is_attend = box.getString("p_is_attend"); if ("undefined".equals(v_is_attend)) { v_is_attend = ""; } int p_tabseq=0; try { connMgr = new DBConnectionManager(); p_tabseq=emailLog.getMaxTabseq(); box.put("p_tabseq", p_tabseq); //System.out.println("p_tabseq===========>"+p_tabseq); if ( GetCodenm.chkIsSubj(connMgr,v_subj).equals("S")){ sbSQL.setLength(0); sbSQL.append(" select subj \n") .append(" from tz_propose \n") .append(" where subj = " + SQLString.Format(v_subj ) + " \n") .append(" and year = " + SQLString.Format(v_year ) + " \n") .append(" and subjseq = " + SQLString.Format(v_subjseq) + " \n") .append(" and userid = " + SQLString.Format(v_user_id) + " \n"); ls = connMgr.executeQuery(sbSQL.toString()); if("RC".equals(box.getString("p_isonoff"))) { // 독서 통신 교육일 때 수강신청한 교재정보 넣어줌 int v_bookcnt = box.getInt("p_bookcnt"); for(int i=1; i <= v_bookcnt; i++) { int v_bookcode= box.getInt("p_" + i + "_radio"); // INSERT tz_proposesubj table sbSQL.setLength(0); sbSQL.append(" insert into tz_proposebook \n") .append(" ( \n") .append(" subj \n") .append(" , year \n") .append(" , subjseq \n") .append(" , userid \n") .append(" , month \n") .append(" , bookcode \n") .append(" , status \n") .append(" ) values ( \n") .append(" ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" ) \n"); pstmt = connMgr.prepareStatement(sbSQL.toString()); pstmt.setString(1, v_subj); pstmt.setString(2, v_year); pstmt.setString(3, v_subjseq); pstmt.setString(4, v_user_id); pstmt.setInt (5, i); pstmt.setInt (6, v_bookcode); pstmt.setString(7, "B"); // 상태값 B:미승인(사용자가 수강신청시), W:대기(운영자가 일괄처리시) isOk = pstmt.executeUpdate(); if ( pstmt != null ) pstmt.close(); } //System.out.println("수강신청시 sql===> "+sbSQL.toString()); } if("J".equals(v_jit)) { // JIT일 경우에는 수강신청 시 바로 승인 처리까지 되어야 함 v_chkfinal = "Y"; // INSERT Tz_Propose Table sbSQL.setLength(0); sbSQL.append(" insert into tz_propose \n") .append(" ( \n") .append(" subj \n") .append(" , year \n") .append(" , subjseq \n") .append(" , userid \n") .append(" , comp \n") .append(" , jik \n") .append(" , appdate \n") .append(" , chkfirst \n") .append(" , chkfinal \n") .append(" , luserid \n") .append(" , ldate \n") .append(" , lec_sel_no \n") .append(" , is_attend \n") .append(" , is_attend_dt \n") .append(" , gubun \n") .append(" ) values ( \n") .append(" ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , 'Y' \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" ) \n"); pstmt = connMgr.prepareStatement(sbSQL.toString()); pstmt.setString(1, v_subj ); pstmt.setString(2, v_year ); pstmt.setString(3, v_subjseq ); pstmt.setString(4, v_user_id ); pstmt.setString(5, v_comp ); pstmt.setString(6, v_jik ); pstmt.setString(7, v_chkfinal ); pstmt.setString(8, v_user_id ); pstmt.setString(9, v_lec_sel_no ); pstmt.setString(10, v_is_attend ); pstmt.setString(11, box.getString("p_pay_sel")); isOk = pstmt.executeUpdate(); if (pstmt != null) { try { pstmt.close(); } catch (Exception e) {} } if(isOk > 0) { Hashtable insertData = new Hashtable(); insertData.put("connMgr" , connMgr ); insertData.put("subj" , v_subj ); insertData.put("year" , v_year ); insertData.put("subjseq" , v_subjseq ); insertData.put("userid" , v_user_id ); insertData.put("isdinsert" , "N" ); insertData.put("chkfirst" , "" ); insertData.put("chkfinal" , "Y" ); insertData.put("box" , box ); ProposeBean propBean = new ProposeBean(); isOk = propBean.insertStudent(insertData); } } else { if(v_proposetype.equals("Y")){ v_chkfinal = "Y"; // INSERT Tz_Propose Table sbSQL.setLength(0); sbSQL.append(" insert into tz_propose \n") .append(" ( \n") .append(" subj \n") .append(" , year \n") .append(" , subjseq \n") .append(" , userid \n") .append(" , comp \n") .append(" , jik \n") .append(" , appdate \n") .append(" , chkfirst \n") .append(" , chkfinal \n") .append(" , luserid \n") .append(" , ldate \n") .append(" , lec_sel_no \n") .append(" , is_attend \n") .append(" , is_attend_dt \n") .append(" , gubun \n") .append(" ) values ( \n") .append(" ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , 'Y' \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" ) \n"); pstmt = connMgr.prepareStatement(sbSQL.toString()); pstmt.setString(1, v_subj ); pstmt.setString(2, v_year ); pstmt.setString(3, v_subjseq ); pstmt.setString(4, v_user_id ); pstmt.setString(5, v_comp ); pstmt.setString(6, v_jik ); pstmt.setString(7, v_chkfinal ); pstmt.setString(8, v_user_id ); pstmt.setString(9, v_lec_sel_no ); pstmt.setString(10, v_is_attend ); pstmt.setString(11, box.getString("p_pay_sel")); isOk = pstmt.executeUpdate(); if (pstmt != null) { try { pstmt.close(); } catch (Exception e) {} } if(isOk > 0) { Hashtable insertData = new Hashtable(); insertData.put("connMgr" , connMgr ); insertData.put("subj" , v_subj ); insertData.put("year" , v_year ); insertData.put("subjseq" , v_subjseq ); insertData.put("userid" , v_user_id ); insertData.put("isdinsert" , "N" ); insertData.put("chkfirst" , "" ); insertData.put("chkfinal" , "Y" ); insertData.put("box" , box ); ProposeBean propBean = new ProposeBean(); isOk = propBean.insertStudent(insertData); } } else{ // INSERT Tz_Propose Table sbSQL.setLength(0); sbSQL.append(" insert into tz_propose \n") .append(" ( \n") .append(" subj \n") .append(" , year \n") .append(" , subjseq \n") .append(" , userid \n") .append(" , comp \n") .append(" , jik \n") .append(" , appdate \n") .append(" , chkfirst \n") .append(" , chkfinal \n") .append(" , luserid \n") .append(" , ldate \n") .append(" , lec_sel_no \n") .append(" , is_attend \n") .append(" , is_attend_dt \n") .append(" , gubun \n") .append(" ) values ( \n") .append(" ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , 'Y' \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" ) \n"); pstmt = connMgr.prepareStatement(sbSQL.toString()); pstmt.setString(1, v_subj ); pstmt.setString(2, v_year ); pstmt.setString(3, v_subjseq ); pstmt.setString(4, v_user_id ); pstmt.setString(5, v_comp ); pstmt.setString(6, v_jik ); pstmt.setString(7, v_chkfinal ); pstmt.setString(8, v_user_id ); pstmt.setString(9, v_lec_sel_no ); pstmt.setString(10, v_is_attend ); pstmt.setString(11, box.getString("p_pay_sel")); isOk = pstmt.executeUpdate(); if (pstmt != null) { try { pstmt.close(); } catch (Exception e) {} } } } if("Y".equals(CodeAdminBean.getIsScorm(v_subj))) { try { // SCORM2004 : 사용자별 SeqInfo 객체 생성 ScormCourseBean scb = new ScormCourseBean(); String [] emp_id = { v_user_id }; boolean result = scb.processTreeObjectForUsers(v_subj, v_year, v_subjseq, emp_id ); } catch( IOException ioe ) { isOk = -3; } catch( Exception e ) { isOk = -3; } } if(isOk > 0) { // 메일 발송 if ( GetCodenm.chkIsSubj(connMgr,box.getString("p_subj")).equals("S")){ // AutoMailBean bean2 = new AutoMailBean(); // bean2.EnterSubjSendMail(box); //사용자가 수강신청시 자동메일 발송(승인대기) //SendRegisterCoursesEMail mail=new SendRegisterCoursesEMailImplBean(); //mail.sendRegisterCoursesMail(box); } } } else { sbSQL.setLength(0); sbSQL.append(" select subj, year, subjseq, isonoff \n"); sbSQL.append("from vz_scsubjseq \n"); sbSQL.append("where course = " + SQLString.Format(v_subj) + " \n"); sbSQL.append("and cyear = " + SQLString.Format(v_year) + " \n"); sbSQL.append("and courseseq = " + SQLString.Format(v_subjseq) + " \n"); ls2 = connMgr.executeQuery(sbSQL.toString()); while(ls2.next()) { v_subj = ls2.getString("subj"); v_year = ls2.getString("year"); v_subjseq = ls2.getString("subjseq"); if("RC".equals(ls2.getString("isonoff"))) { // 독서 통신 교육일 때 수강신청한 교재정보 넣어줌 int v_bookcnt = box.getInt("p_bookcnt"); for(int i=1; i <= v_bookcnt; i++) { int v_bookcode= box.getInt("p_" + i + "_radio"); // INSERT tz_proposesubj table sbSQL.setLength(0); sbSQL.append(" INSERT INTO TZ_PROPOSEBOOK \n") .append(" ( \n") .append(" subj \n") .append(" , year \n") .append(" , subjseq \n") .append(" , userid \n") .append(" , month \n") .append(" , bookcode \n") .append(" ) VALUES ( \n") .append(" ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" ) \n"); pstmt = connMgr.prepareStatement(sbSQL.toString()); pstmt.setString(1, v_subj); pstmt.setString(2, v_year); pstmt.setString(3, v_subjseq); pstmt.setString(4, v_user_id); pstmt.setInt(5, i); pstmt.setInt(6, v_bookcode); isOk = pstmt.executeUpdate(); if ( pstmt != null ) pstmt.close(); } } // INSERT Tz_Propose Table sbSQL.setLength(0); sbSQL.append(" INSERT INTO Tz_Propose \n") .append(" ( \n") .append(" subj \n") .append(" , year \n") .append(" , subjseq \n") .append(" , userid \n") .append(" , comp \n") .append(" , jik \n") .append(" , appdate \n") .append(" , chkfirst \n") .append(" , chkfinal \n") .append(" , luserid \n") .append(" , ldate \n") .append(" , lec_sel_no \n") .append(" , is_attend \n") .append(" , is_attend_dt \n") .append(" , gubun \n") .append(" ) VALUES ( \n") .append(" ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , 'Y' \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" ) \n"); pstmt = connMgr.prepareStatement(sbSQL.toString()); pstmt.setString(1, v_subj ); pstmt.setString(2, v_year ); pstmt.setString(3, v_subjseq ); pstmt.setString(4, v_user_id ); pstmt.setString(5, v_comp ); pstmt.setString(6, v_jik ); pstmt.setString(7, v_chkfinal ); pstmt.setString(8, v_user_id ); pstmt.setString(9, v_lec_sel_no ); pstmt.setString(10, v_is_attend ); pstmt.setString(11, box.getString("p_pay_sel")); isOk = pstmt.executeUpdate(); if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e ) { } } } } //정상 저장되면 결제정보에 넣어준다.(추가 - 서지한) - 무통장이나 교육청 일괄일때만 적용됨.(카드등은 다른 로직탐) if(isOk > 0){ PreparedStatement pstmt1 = null; String sql =" insert into pa_payment(order_id,userid,leccode,lecnumb,type,auth_date,year,enterance_dt, amount)"; sql+=" values(?,?,?,?,?,to_char(sysdate,'yyyymmddhh24miss'),to_char(sysdate,'yyyy'),?,?)"; pstmt1 = connMgr.prepareStatement(sql); int idx = 1; pstmt1.setString(idx++,box.getString("p_order_id"));//주문번호 pstmt1.setString(idx++,v_user_id);//회원아이디 pstmt1.setString(idx++,v_subj);//강좌코드 pstmt1.setString(idx++,v_subjseq);//차수 pstmt1.setString(idx++,box.getString("p_pay_sel"));//결제종류 pstmt1.setString(idx++,box.getString("p_enterance_dt"));//입금예정일 pstmt1.setString(idx++,box.getString("p_amount"));//금액 isOk = pstmt1.executeUpdate(); } //주문번호를 신청 테이블에 넣는다.(추가 - 서지한) - 무통장이나 교육청 일괄일때만 적용됨.(카드등은 다른 로직탐) if(isOk > 0){ PreparedStatement pstmt1 = null; String sql =" update tz_propose set order_id = ? "; sql+=" where subj = ? "; sql+=" and year = ? "; sql+=" and userid = ? "; sql+=" and subjseq = ? "; pstmt1 = connMgr.prepareStatement(sql); int idx = 1; pstmt1.setString(idx++,box.getString("p_order_id"));//주문번호 pstmt1.setString(idx++,v_subj);//강좌코드 pstmt1.setString(idx++,v_year);//회원아이디 pstmt1.setString(idx++,v_user_id);//회원아이디 pstmt1.setString(idx++,v_subjseq);//차수 isOk = pstmt1.executeUpdate(); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e, box, ""); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( ls2 != null ) { try { ls2.close(); } catch ( Exception e1 ) { } } if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return isOk; } /** 수강신청 @param box receive from the form object and session @return int */ public int insertSubjectEduProposePg(RequestBox box) throws Exception { EmailLog emailLog=new EmailLogImplBean(); DBConnectionManager connMgr = null; PreparedStatement pstmt = null; ListSet ls = null; ListSet ls2 = null; StringBuffer sbSQL = new StringBuffer(""); int isOk = 0; String v_subj = box.getString("p_subj" ); String v_year = box.getString("p_year" ); String v_subjseq = box.getString("p_subjseq" ); String v_user_id = box.getString("p_userid" ); String v_comp = box.getString("p_comp" ); String v_jik = box.getString("p_jikup" ); String v_jit = box.getString("p_jit"); String v_proposetype = box.getString("p_proposetype"); String v_chkfinal = "B"; // 미처리(신청승인전, 수강신청시 셋팅값) String v_lec_sel_no = box.getString("p_lec_sel_no"); String v_is_attend = box.getString("p_is_attend"); if ("undefined".equals(v_is_attend)) { v_is_attend = ""; } int p_tabseq=0; try { connMgr = new DBConnectionManager(); p_tabseq=emailLog.getMaxTabseq(); box.put("p_tabseq", p_tabseq); //System.out.println("p_tabseq===========>"+p_tabseq); if ( GetCodenm.chkIsSubj(connMgr,v_subj).equals("S")){ sbSQL.setLength(0); sbSQL.append(" select subj \n") .append(" from tz_propose \n") .append(" where subj = " + SQLString.Format(v_subj ) + " \n") .append(" and year = " + SQLString.Format(v_year ) + " \n") .append(" and subjseq = " + SQLString.Format(v_subjseq) + " \n") .append(" and userid = " + SQLString.Format(v_user_id) + " \n"); ls = connMgr.executeQuery(sbSQL.toString()); if("RC".equals(box.getString("p_isonoff"))) { // 독서 통신 교육일 때 수강신청한 교재정보 넣어줌 int v_bookcnt = box.getInt("p_bookcnt"); for(int i=1; i <= v_bookcnt; i++) { int v_bookcode= box.getInt("p_" + i + "_radio"); // INSERT tz_proposesubj table sbSQL.setLength(0); sbSQL.append(" insert into tz_proposebook \n") .append(" ( \n") .append(" subj \n") .append(" , year \n") .append(" , subjseq \n") .append(" , userid \n") .append(" , month \n") .append(" , bookcode \n") .append(" , status \n") .append(" ) values ( \n") .append(" ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" ) \n"); pstmt = connMgr.prepareStatement(sbSQL.toString()); pstmt.setString(1, v_subj); pstmt.setString(2, v_year); pstmt.setString(3, v_subjseq); pstmt.setString(4, v_user_id); pstmt.setInt (5, i); pstmt.setInt (6, v_bookcode); pstmt.setString(7, "B"); // 상태값 B:미승인(사용자가 수강신청시), W:대기(운영자가 일괄처리시) isOk = pstmt.executeUpdate(); if ( pstmt != null ) pstmt.close(); } //System.out.println("수강신청시 sql===> "+sbSQL.toString()); } if("J".equals(v_jit)) { // JIT일 경우에는 수강신청 시 바로 승인 처리까지 되어야 함 v_chkfinal = "Y"; // INSERT Tz_Propose Table sbSQL.setLength(0); sbSQL.append(" insert into tz_propose \n") .append(" ( \n") .append(" subj \n") .append(" , year \n") .append(" , subjseq \n") .append(" , userid \n") .append(" , comp \n") .append(" , jik \n") .append(" , appdate \n") .append(" , chkfirst \n") .append(" , chkfinal \n") .append(" , luserid \n") .append(" , ldate \n") .append(" , lec_sel_no \n") .append(" , is_attend \n") .append(" , is_attend_dt \n") .append(" , gubun \n") .append(" ) values ( \n") .append(" ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , 'Y' \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" ) \n"); pstmt = connMgr.prepareStatement(sbSQL.toString()); pstmt.setString(1, v_subj ); pstmt.setString(2, v_year ); pstmt.setString(3, v_subjseq ); pstmt.setString(4, v_user_id ); pstmt.setString(5, v_comp ); pstmt.setString(6, v_jik ); pstmt.setString(7, v_chkfinal ); pstmt.setString(8, v_user_id ); pstmt.setString(9, v_lec_sel_no ); pstmt.setString(10, v_is_attend ); pstmt.setString(11, box.getString("p_pay_sel")); isOk = pstmt.executeUpdate(); if (pstmt != null) { try { pstmt.close(); } catch (Exception e) {} } if(isOk > 0) { Hashtable insertData = new Hashtable(); insertData.put("connMgr" , connMgr ); insertData.put("subj" , v_subj ); insertData.put("year" , v_year ); insertData.put("subjseq" , v_subjseq ); insertData.put("userid" , v_user_id ); insertData.put("isdinsert" , "N" ); insertData.put("chkfirst" , "" ); insertData.put("chkfinal" , "Y" ); insertData.put("box" , box ); ProposeBean propBean = new ProposeBean(); isOk = propBean.insertStudent(insertData); } } else { if(v_proposetype.equals("Y")){ v_chkfinal = "Y"; // INSERT Tz_Propose Table sbSQL.setLength(0); sbSQL.append(" insert into tz_propose \n") .append(" ( \n") .append(" subj \n") .append(" , year \n") .append(" , subjseq \n") .append(" , userid \n") .append(" , comp \n") .append(" , jik \n") .append(" , appdate \n") .append(" , chkfirst \n") .append(" , chkfinal \n") .append(" , luserid \n") .append(" , ldate \n") .append(" , lec_sel_no \n") .append(" , is_attend \n") .append(" , is_attend_dt \n") .append(" , gubun \n") .append(" ) values ( \n") .append(" ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , 'Y' \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" ) \n"); pstmt = connMgr.prepareStatement(sbSQL.toString()); pstmt.setString(1, v_subj ); pstmt.setString(2, v_year ); pstmt.setString(3, v_subjseq ); pstmt.setString(4, v_user_id ); pstmt.setString(5, v_comp ); pstmt.setString(6, v_jik ); pstmt.setString(7, v_chkfinal ); pstmt.setString(8, v_user_id ); pstmt.setString(9, v_lec_sel_no ); pstmt.setString(10, v_is_attend ); pstmt.setString(11, box.getString("p_pay_sel")); isOk = pstmt.executeUpdate(); if (pstmt != null) { try { pstmt.close(); } catch (Exception e) {} } if(isOk > 0) { Hashtable insertData = new Hashtable(); insertData.put("connMgr" , connMgr ); insertData.put("subj" , v_subj ); insertData.put("year" , v_year ); insertData.put("subjseq" , v_subjseq ); insertData.put("userid" , v_user_id ); insertData.put("isdinsert" , "N" ); insertData.put("chkfirst" , "" ); insertData.put("chkfinal" , "Y" ); insertData.put("box" , box ); ProposeBean propBean = new ProposeBean(); isOk = propBean.insertStudent(insertData); } } else{ // INSERT Tz_Propose Table sbSQL.setLength(0); sbSQL.append(" insert into tz_propose \n") .append(" ( \n") .append(" subj \n") .append(" , year \n") .append(" , subjseq \n") .append(" , userid \n") .append(" , comp \n") .append(" , jik \n") .append(" , appdate \n") .append(" , chkfirst \n") .append(" , chkfinal \n") .append(" , luserid \n") .append(" , ldate \n") .append(" , lec_sel_no \n") .append(" , is_attend \n") .append(" , is_attend_dt \n") .append(" , gubun \n") .append(" ) values ( \n") .append(" ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , 'Y' \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" ) \n"); pstmt = connMgr.prepareStatement(sbSQL.toString()); pstmt.setString(1, v_subj ); pstmt.setString(2, v_year ); pstmt.setString(3, v_subjseq ); pstmt.setString(4, v_user_id ); pstmt.setString(5, v_comp ); pstmt.setString(6, v_jik ); pstmt.setString(7, v_chkfinal ); pstmt.setString(8, v_user_id ); pstmt.setString(9, v_lec_sel_no ); pstmt.setString(10, v_is_attend ); pstmt.setString(11, box.getString("p_pay_sel")); isOk = pstmt.executeUpdate(); if (pstmt != null) { try { pstmt.close(); } catch (Exception e) {} } } } if("Y".equals(CodeAdminBean.getIsScorm(v_subj))) { try { // SCORM2004 : 사용자별 SeqInfo 객체 생성 ScormCourseBean scb = new ScormCourseBean(); String [] emp_id = { v_user_id }; boolean result = scb.processTreeObjectForUsers(v_subj, v_year, v_subjseq, emp_id ); } catch( IOException ioe ) { isOk = -3; } catch( Exception e ) { isOk = -3; } } if(isOk > 0) { // 메일 발송 if ( GetCodenm.chkIsSubj(connMgr,box.getString("p_subj")).equals("S")){ // AutoMailBean bean2 = new AutoMailBean(); // bean2.EnterSubjSendMail(box); //사용자가 수강신청시 자동메일 발송(승인대기) //SendRegisterCoursesEMail mail=new SendRegisterCoursesEMailImplBean(); //mail.sendRegisterCoursesMail(box); } } } else { sbSQL.setLength(0); sbSQL.append(" select subj, year, subjseq, isonoff \n"); sbSQL.append("from vz_scsubjseq \n"); sbSQL.append("where course = " + SQLString.Format(v_subj) + " \n"); sbSQL.append("and cyear = " + SQLString.Format(v_year) + " \n"); sbSQL.append("and courseseq = " + SQLString.Format(v_subjseq) + " \n"); ls2 = connMgr.executeQuery(sbSQL.toString()); while(ls2.next()) { v_subj = ls2.getString("subj"); v_year = ls2.getString("year"); v_subjseq = ls2.getString("subjseq"); if("RC".equals(ls2.getString("isonoff"))) { // 독서 통신 교육일 때 수강신청한 교재정보 넣어줌 int v_bookcnt = box.getInt("p_bookcnt"); for(int i=1; i <= v_bookcnt; i++) { int v_bookcode= box.getInt("p_" + i + "_radio"); // INSERT tz_proposesubj table sbSQL.setLength(0); sbSQL.append(" INSERT INTO TZ_PROPOSEBOOK \n") .append(" ( \n") .append(" subj \n") .append(" , year \n") .append(" , subjseq \n") .append(" , userid \n") .append(" , month \n") .append(" , bookcode \n") .append(" ) VALUES ( \n") .append(" ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" ) \n"); pstmt = connMgr.prepareStatement(sbSQL.toString()); pstmt.setString(1, v_subj); pstmt.setString(2, v_year); pstmt.setString(3, v_subjseq); pstmt.setString(4, v_user_id); pstmt.setInt(5, i); pstmt.setInt(6, v_bookcode); isOk = pstmt.executeUpdate(); if ( pstmt != null ) pstmt.close(); } } // INSERT Tz_Propose Table sbSQL.setLength(0); sbSQL.append(" INSERT INTO Tz_Propose \n") .append(" ( \n") .append(" subj \n") .append(" , year \n") .append(" , subjseq \n") .append(" , userid \n") .append(" , comp \n") .append(" , jik \n") .append(" , appdate \n") .append(" , chkfirst \n") .append(" , chkfinal \n") .append(" , luserid \n") .append(" , ldate \n") .append(" , lec_sel_no \n") .append(" , is_attend \n") .append(" , is_attend_dt \n") .append(" , gubun \n") .append(" ) VALUES ( \n") .append(" ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , 'Y' \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" ) \n"); pstmt = connMgr.prepareStatement(sbSQL.toString()); pstmt.setString(1, v_subj ); pstmt.setString(2, v_year ); pstmt.setString(3, v_subjseq ); pstmt.setString(4, v_user_id ); pstmt.setString(5, v_comp ); pstmt.setString(6, v_jik ); pstmt.setString(7, v_chkfinal ); pstmt.setString(8, v_user_id ); pstmt.setString(9, v_lec_sel_no ); pstmt.setString(10, v_is_attend ); pstmt.setString(11, box.getString("p_pay_sel")); isOk = pstmt.executeUpdate(); if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e ) { } } } } //주문번호를 신청 테이블에 넣는다. if(isOk > 0){ PreparedStatement pstmt1 = null; String sql =" update tz_propose set order_id = ? "; sql+=" where subj = ? "; sql+=" and year = ? "; sql+=" and userid = ? "; sql+=" and subjseq = ? "; pstmt1 = connMgr.prepareStatement(sql); int idx = 1; pstmt1.setString(idx++,box.getString("p_oid"));//주문번호 pstmt1.setString(idx++,v_subj);//강좌코드 pstmt1.setString(idx++,v_year);//회원아이디 pstmt1.setString(idx++,v_user_id);//회원아이디 pstmt1.setString(idx++,v_subjseq);//차수 isOk = pstmt1.executeUpdate(); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e, box, ""); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( ls2 != null ) { try { ls2.close(); } catch ( Exception e1 ) { } } if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return isOk; } /** 수강신청 제약 체크 (별도 사용) @param box receive from the form object and session @return int */ public int checkSubjectEduPropose(RequestBox box) throws Exception { DBConnectionManager connMgr = null; StringBuffer sbSQL = new StringBuffer(""); String v_subj = box.getString("p_subj" ); String v_year = box.getString("p_year" ); String v_subjseq = box.getString("p_subjseq" ); String v_user_id = box.getSession("userid" ); String v_comp = box.getSession("comp" ); int v_jeyak = 0; // 제약조건 결과값 try { connMgr = new DBConnectionManager(); v_jeyak = jeyakCheck(connMgr, v_subj, v_year, v_subjseq, v_user_id, v_comp); } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e, box, ""); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return v_jeyak; } /** 수강신청 제약 체크 (별도 사용) pg사 결제시 session값 없어 별도처리 @param box receive from the form object and session @return int */ public int checkSubjectEduProposePg(RequestBox box) throws Exception { DBConnectionManager connMgr = null; StringBuffer sbSQL = new StringBuffer(""); String v_subj = box.getString("p_subj" ); String v_year = box.getString("p_year" ); String v_subjseq = box.getString("p_subjseq" ); String v_user_id = box.getString("p_userid" ); String v_comp = box.getString("p_comp" ); int v_jeyak = 0; // 제약조건 결과값 try { connMgr = new DBConnectionManager(); v_jeyak = jeyakCheck(connMgr, v_subj, v_year, v_subjseq, v_user_id, v_comp); } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e, box, ""); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return v_jeyak; } /** 연간 교육 일정 리스트 @param box receive from the form object and session @return ArrayList */ public ArrayList selectEducationYearlyList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls1 = null; ListSet ls2 = null; ArrayList list = null; ArrayList list2 = null; String sql1 = ""; // String sql2 = ""; // ProposeCourseData data1 = null; DataBox dbox= null; DataBox dbox2= null; // ProposeCourseData data2 = null; String v_gyear = box.getStringDefault("gyear",FormatDate.getDate("yyyy") ); // String v_user_id = box.getSession("userid"); // 개인의 회사 기준으로 과정 리스트 String v_comp = box.getSession("comp"); // 사이트의 GRCODE 로 과정 리스트 String v_grcode = box.getSession("tem_grcode"); String v_select = box.getString("p_select"); String v_proposetype = ""; String v_subj = ""; String v_year = ""; String v_subjseq = ""; String v_subjseqgr = ""; int v_propstart = 0; int v_propend = 0; int v_studentlimit = 0; int v_stucnt = 0; try { connMgr = new DBConnectionManager(); list = new ArrayList(); list2 = new ArrayList(); // sql1 = "select scupperclass, course, cyear, courseseq, coursenm, subj, year, subjseq, subjnm, isonoff, \n"; // sql1 += " edustart, eduend, subjseqgr, proposetype, studentlimit, propstart, propend, \n"; // sql1 += " (select count(subj) from TZ_PROPOSE where subj=A.subj and year=A.year and subjseq=A.subjseq) stucnt \n"; // sql1 += "from vz_scsubjseq A \n"; // sql1 += " where 1=1 \n"; //gyear=" +SQLString.Format(v_gyear); // // 개인기준인지 // sql1 += " and grcode in (select grcode from TZ_GRCOMP where comp = " + StringManager.makeSQL(v_comp) + ") \n"; // //sql1 += " and (select comp from tz_grseq where grcode =a.grcode and gyear = a.gyear and grseq = a.grseq) = " + SQLString.Format(v_comp); // // sql1 += " and a.grcode = " +SQLString.Format(v_grcode); // // sql1 += " and isuse = 'Y' \n"; // sql1 += " and subjvisible = 'Y' \n"; // sql1 += " and seqvisible= 'Y' \n"; // sql1 += " AND a.edustart is not null \n"; // sql1 += " and a.eduend is not null \n"; // sql1 += " and (substr(edustart,1,4) = " + SQLString.Format(v_gyear) + " or substr(eduend, 1,4) = " + SQLString.Format(v_gyear) + " ) \n"; // // /* // 화면 출력 위한 조건제한, 테스트 후 주석해제 // sql1 += " and nvl(edustart, '') != '' \n"; // sql1 += " and nvl(eduend, '') != '' \n"; // */ // // // sql1 += " and len(replace(edustart,chr(32),'')) > 0 "; // if ( v_select.equals("ON") || v_select.equals("OFF") || v_select.equals("RC") ) { // sql1 += " and A.isonoff = " +SQLString.Format(v_select); // } // /*---------------------------------- 코스 무시 -----------------------------------------*/ // sql1 += " order by scsubjnm, edustart, eduend \n"; sql1 = "select isonoff, subj, subjnm \n" + "from vz_scsubjseq A \n" + "where 1=1 \n" + "and grcode in (select grcode from TZ_GRCOMP where comp = " + StringManager.makeSQL(v_comp) + ") \n" + "and isuse = 'Y' \n" + "and subjvisible = 'Y' \n" + "and seqvisible= 'Y' \n" + "and edustart is not null \n" + "and eduend is not null \n" + "and (substr(edustart,1,4) = " + SQLString.Format(v_gyear) + " or substr(eduend, 1,4) = " + SQLString.Format(v_gyear) + " ) \n" + "and (GRCODE <> 'N000001' or GYEAR <> '2009' or GRSEQ <> '0031') \n" + "and (GRCODE <> 'N000007' or GYEAR <> '2009' or GRSEQ <> '0001') \n"; if ( v_select.equals("ON") || v_select.equals("OFF") || v_select.equals("RC") ) { sql1 += " and A.isonoff = " +SQLString.Format(v_select); } sql1+= "group by isonoff, subj, subjnm \n"; ls1 = connMgr.executeQuery(sql1); while ( ls1.next() ) { dbox = ls1.getDataBox(); sql1 = "select subj, year, subjseq, edustart, eduend \n" + "from vz_scsubjseq A \n" + "where 1=1 \n" + "and grcode in (select grcode from TZ_GRCOMP where comp = " + StringManager.makeSQL(v_comp) + ") \n" + "and isuse = 'Y' \n" + "and subjvisible = 'Y' \n" + "and seqvisible= 'Y' \n" + "and edustart is not null \n" + "and eduend is not null \n" + "and (substr(edustart,1,4) = " + SQLString.Format(v_gyear) + " or substr(eduend, 1,4) = " + SQLString.Format(v_gyear) + " ) \n" + "and subj = " + StringManager.makeSQL(ls1.getString("subj")) + " \n" + "and (GRCODE <> 'N000001' or GYEAR <> '2009' or GRSEQ <> '0031') \n" + "and (GRCODE <> 'N000007' or GYEAR <> '2009' or GRSEQ <> '0001') \n"; if ( v_gyear.equals("2009") && v_grcode.equals("")) { sql1 += " and A.grseq not in ('0016','0017','0018','0019','0020','0021','0022','0023')"; } sql1 += "order by subj, year, subjseq \n"; //System.out.println("sql1=\n"+sql1); ls2 = connMgr.executeQuery(sql1); while ( ls2.next() ) { dbox2 = ls2.getDataBox(); list2.add(dbox2); } dbox.put("d_periodList", list2); list.add(dbox); list2 = new ArrayList(); if ( ls2 != null ) { try { ls2.close(); } catch ( Exception e ) { } } } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql1); throw new Exception("sql1 = " + sql1 + "\r\n" + ex.getMessage() ); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( ls2 != null ) { try { ls2.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list; } /** 월간 교육 일정 리스트 @param box receive from the form object and session @return ArrayList */ public ArrayList selectEducationMonthlyList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls1 = null; ArrayList list = null; String sql1 = ""; ProposeCourseData data1 = null; String v_gyear = box.getStringDefault("gyear",FormatDate.getDate("yyyy") ); String v_selmonth = box.getStringDefault("p_month",FormatDate.getDate("MM") ); String v_select = box.getStringDefault("p_select", "TOTAL"); String v_condition = v_gyear + v_selmonth; DataBox dbox = null; String ss_comp = box.getSession("comp"); // String v_placejh = box.getStringDefault("p_placejh", "ALL"); StringBuffer sbSQL = new StringBuffer(""); int v_cnt = 0; // String v_grcode = box.getSession("tem_grcode"); try { connMgr = new DBConnectionManager(); list = new ArrayList(); // sbSQL.append("select count(comp) cnt, comp \n") // .append("from tz_grcomp \n") // .append("where comp = " + StringManager.makeSQL(ss_comp) + " \n") // .append("group by comp \n"); // ls1 = connMgr.executeQuery(sbSQL.toString()); // if(ls1.next()) { // v_cnt = ls1.getInt("cnt"); // } // // if ( ls1 != null ) { // try { // ls1.close(); // } catch ( Exception e ) { } // } // sql1 = "select distinct x.subj, x.subjnm, x.subjseq, x.edustart, x.eduend, x.placejh, x.year, x.isonoff \n" // + " , day1, day2, day3, day4, day5, day6, day7, day8, day9, day10 \n" // + " , day11, day12, day13, day14, day15, day16, day17, day18, day19, day20 \n" // + " , day21, day22, day23, day24, day25, day26, day27, day28, day29, day30, day31 \n" // + "from ( \n" // + " select a.subj, a.subjnm, a.subjseq, a.edustart, a.eduend, b.placejh, a.year, a.isonoff \n" // + " , case when '01' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day1 \n" // + " , case when '02' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day2 \n" // + " , case when '03' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day3 \n" // + " , case when '04' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day4 \n" // + " , case when '05' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day5 \n" // + " , case when '06' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day6 \n" // + " , case when '07' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day7 \n" // + " , case when '08' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day8 \n" // + " , case when '09' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day9 \n" // + " , case when '10' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day10 \n" // + " , case when '11' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day11 \n" // + " , case when '12' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day12 \n" // + " , case when '13' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day13 \n" // + " , case when '14' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day14 \n" // + " , case when '15' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day15 \n" // + " , case when '16' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day16 \n" // + " , case when '17' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day17 \n" // + " , case when '18' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day18 \n" // + " , case when '19' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day19 \n" // + " , case when '20' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day20 \n" // + " , case when '21' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day21 \n" // + " , case when '22' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day22 \n" // + " , case when '23' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day23 \n" // + " , case when '24' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day24 \n" // + " , case when '25' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day25 \n" // + " , case when '26' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day26 \n" // + " , case when '27' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day27 \n" // + " , case when '28' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day28 \n" // + " , case when '29' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day29 \n" // + " , case when '30' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day30 \n" // + " , case when '31' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day31 \n" // + " from vz_scsubjseq a inner join tz_subj b \n" // + " on a.subj = b.subj \n" // + " left outer join tz_grcomp c \n" // + " on a.grcode = c.grcode \n" // + " where a.isuse = 'Y' \n" // + " and a.subjvisible = 'Y' \n" // + " and a.seqvisible = 'Y' \n" // + " and length(a.edustart) > 7 \n" // + " and length(a.eduend) > 7 \n"; // //// + " and c.comp = " + SQLString.Format(ss_comp) + " \n" // if(!"".equals(v_grcode)) { // sql1 += " and a.grcode = " + SQLString.Format(v_grcode); // } else { // if(v_cnt > 0) { // sql1+= "and a.grcode in (select grcode from TZ_GRCOMP where comp = " + StringManager.makeSQL(ss_comp) + ")"; // } else { // sql1 +=" and a.grcode = " + SQLString.Format("N000001") + " \n"; // } // } // sql1+= " and a.gyear = " +SQLString.Format(v_gyear) + " \n" // + " and " +SQLString.Format(v_condition) + " between SUBSTR(edustart,1,6) and SUBSTR(eduend,1,6) \n"; // if(!"TOTAL".equals(v_select)) { // sql1+= " and b.isonoff = " +SQLString.Format(v_select) + " \n"; // } // sql1+= ") x \n" // + "where 1 = 1 \n"; // sql1 += "order by x.edustart, x.eduend, subjnm, subjseq \n"; sql1 = "select distinct x.subj, x.subjnm, x.subjseq, x.edustart, x.eduend, x.year, x.isonoff \n" + " , day1, day2, day3, day4, day5, day6, day7, day8, day9, day10 \n" + " , day11, day12, day13, day14, day15, day16, day17, day18, day19, day20 \n" + " , day21, day22, day23, day24, day25, day26, day27, day28, day29, day30, day31 \n" + "from ( \n" + " select a.subj, a.subjnm, a.subjseq, a.edustart, a.eduend, a.year, b.isonoff \n" // + " , case when '01' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day1 \n" // + " , case when '02' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day2 \n" // + " , case when '03' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day3 \n" // + " , case when '04' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day4 \n" // + " , case when '05' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day5 \n" // + " , case when '06' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day6 \n" // + " , case when '07' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day7 \n" // + " , case when '08' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day8 \n" // + " , case when '09' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day9 \n" // + " , case when '10' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day10 \n" // + " , case when '11' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day11 \n" // + " , case when '12' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day12 \n" // + " , case when '13' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day13 \n" // + " , case when '14' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day14 \n" // + " , case when '15' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day15 \n" // + " , case when '16' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day16 \n" // + " , case when '17' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day17 \n" // + " , case when '18' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day18 \n" // + " , case when '19' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day19 \n" // + " , case when '20' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day20 \n" // + " , case when '21' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day21 \n" // + " , case when '22' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day22 \n" // + " , case when '23' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day23 \n" // + " , case when '24' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day24 \n" // + " , case when '25' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day25 \n" // + " , case when '26' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day26 \n" // + " , case when '27' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day27 \n" // + " , case when '28' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day28 \n" // + " , case when '29' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day29 \n" // + " , case when '30' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day30 \n" // + " , case when '31' between SUBSTR(edustart, 7,2) and SUBSTR(eduend, 7,2) then 'Y' else 'N' end day31 \n" + " , case when substr(edustart,1,6) ||'01' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day1 \n" + " , case when substr(edustart,1,6) ||'02' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day2 \n" + " , case when substr(edustart,1,6) ||'03' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day3 \n" + " , case when substr(edustart,1,6) ||'04' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day4 \n" + " , case when substr(edustart,1,6) ||'05' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day5 \n" + " , case when substr(edustart,1,6) ||'06' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day6 \n" + " , case when substr(edustart,1,6) ||'07' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day7 \n" + " , case when substr(edustart,1,6) ||'08' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day8 \n" + " , case when substr(edustart,1,6) ||'09' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day9 \n" + " , case when substr(edustart,1,6) ||'10' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day10 \n" + " , case when substr(edustart,1,6) ||'11' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day11 \n" + " , case when substr(edustart,1,6) ||'12' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day12 \n" + " , case when substr(edustart,1,6) ||'13' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day13 \n" + " , case when substr(edustart,1,6) ||'14' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day14 \n" + " , case when substr(edustart,1,6) ||'15' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day15 \n" + " , case when substr(edustart,1,6) ||'16' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day16 \n" + " , case when substr(edustart,1,6) ||'17' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day17 \n" + " , case when substr(edustart,1,6) ||'18' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day18 \n" + " , case when substr(edustart,1,6) ||'19' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day19 \n" + " , case when substr(edustart,1,6) ||'20' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day20 \n" + " , case when substr(edustart,1,6) ||'21' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day21 \n" + " , case when substr(edustart,1,6) ||'22' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day22 \n" + " , case when substr(edustart,1,6) ||'23' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day23 \n" + " , case when substr(edustart,1,6) ||'24' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day24 \n" + " , case when substr(edustart,1,6) ||'25' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day25 \n" + " , case when substr(edustart,1,6) ||'26' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day26 \n" + " , case when substr(edustart,1,6) ||'27' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day27 \n" + " , case when substr(edustart,1,6) ||'28' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day28 \n" + " , case when substr(edustart,1,6) ||'29' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day29 \n" + " , case when substr(edustart,1,6) ||'30' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day30 \n" + " , case when substr(edustart,1,6) ||'31' between substr(edustart,1,8) and substr(eduend, 1,8) then 'Y' else 'N' end day31 \n" + " from tz_subjseq a inner join tz_subj b \n" + " on a.subj = b.subj \n" + " where b.isuse = 'Y' \n" + " and a.isvisible = 'Y' \n" + " and a.isvisible = 'Y' \n" + " and length(a.edustart) > 7 \n" + " and length(a.eduend) > 7 \n" + " and ((edustart between " +SQLString.Format(v_condition) + " || '01' and " +SQLString.Format(v_condition) + " || '31') or ( eduend between " +SQLString.Format(v_condition) + " || '01' and " +SQLString.Format(v_condition) + " || '31' )) \n" + " and a.grcode in (select grcode from TZ_GRCOMP where comp = " + StringManager.makeSQL(ss_comp) + ") \n" + " and a.gyear = " +SQLString.Format(v_gyear) + " \n"; if(!"TOTAL".equals(v_select)) { sql1+= " and b.isonoff = " +SQLString.Format(v_select) + " \n"; } sql1+= ") x \n" + "where 1 = 1 \n"; sql1 += "order by subjnm, subjseq \n"; ls1 = connMgr.executeQuery(sql1); while ( ls1.next() ) { dbox = ls1.getDataBox(); list.add(dbox); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql1); throw new Exception("sql1 = " + sql1 + "\r\n" + ex.getMessage() ); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list; } /** 월간 교육 일정 리스트 @param box receive from the form object and session @return ArrayList */ /* public ArrayList selectEducationMonthlyList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls1 = null; ArrayList list = null; String sql1 = ""; // String sql2 = ""; ProposeCourseData data1 = null; // ProposeCourseData data2 = null; String v_gyear = box.getStringDefault("gyear",FormatDate.getDate("yyyy") ); String v_selmonth = box.getStringDefault("p_month",FormatDate.getDate("MM") ); // String v_user_id = box.getSession("userid"); // 개인의 회사 기준으로 과정 리스트 String v_comp = box.getSession("comp"); // 사이트의 GRCODE 로 과정 리스트 String v_grcode = box.getSession("tem_grcode"); String v_select = box.getString("p_select"); String v_proposetype = ""; String v_subj = ""; String v_year = ""; String v_subjseq = ""; String v_subjseqgr = ""; String v_condition = v_gyear + v_selmonth; int v_propstart = 0; int v_propend = 0; int v_studentlimit = 0; int v_stucnt = 0; try { connMgr = new DBConnectionManager(); list = new ArrayList(); sql1 = "select scupperclass,course,cyear,courseseq,coursenm,subj,year,subjseq,subjnm,isonoff, "; sql1 += " edustart, eduend, subjseqgr, proposetype,studentlimit,propstart,propend, "; sql1 += "(select count(subj) from TZ_PROPOSE where subj=A.subj and year=A.year and subjseq=A.subjseq) stucnt "; sql1 += "from VZ_SCSUBJSEQ A "; sql1 += " where gyear=" +SQLString.Format(v_gyear); sql1 += " and " +SQLString.Format(v_condition) + " between substr(edustart,1,6) and substr(eduend,1,6) "; // 개인기준인지 sql1 += " and grcode in (select grcode from TZ_GRCOMP where comp =" +StringManager.makeSQL(v_comp) + ") \n"; //sql1 += " and (select comp from tz_grseq where grcode =a.grcode and gyear = a.gyear and grseq = a.grseq) = " + SQLString.Format(v_comp); // sql1 += " and a.grcode = " +SQLString.Format(v_grcode); sql1 += " and isuse = 'Y' "; sql1 += " and subjvisible = 'Y' "; sql1 += " and seqvisible= 'Y' "; //sql1 += " and len(edustart) > 7 \n"; //sql1 += " and len(eduend) > 7 \n"; sql1 += " and length(edustart) > 7 \n"; sql1 += " and length(eduend) > 7 \n"; // sql1 += " and len(replace(edustart,chr(32),'')) > 0 "; if ( v_select.equals("ON") || v_select.equals("OFF") || v_select.equals("RC") ) { sql1 += " and A.isonoff = " +SQLString.Format(v_select); // sql1 += " and INSTR(A.subjnm,'[통신]') = 0 "; } else if ( v_select.equals("COURSE") ) { sql1 += " and A.course != '000000' "; // sql1 += " and INSTR(A.subjnm,'[통신]') = 0 "; } if ( v_select.equals("REP") ) { sql1 += " and A.subjnm like '[통신]%' "; } // sql1 += " order by scupperclass,course,cyear,courseseq, subj,subjseq,edustart,eduend "; ---------------------------------- 코스 무시 ----------------------------------------- sql1 += " order by scsubjnm "; ls1 = connMgr.executeQuery(sql1); while ( ls1.next() ) { v_subj = ls1.getString("subj"); v_year = ls1.getString("year"); v_subjseq = ls1.getString("subjseq"); v_subjseqgr = ls1.getString("subjseqgr"); v_proposetype = ls1.getString("proposetype"); v_studentlimit = ls1.getInt("studentlimit"); v_stucnt = ls1.getInt("stucnt"); if ( ls1.getString("propstart").equals("") ) { v_propstart = 0000000000; } else { v_propstart = Integer.parseInt( ls1.getString("propstart") ); } if ( ls1.getString("propend").equals("") ) { v_propend = 0000000000; } else { v_propend = Integer.parseInt( ls1.getString("propend") ); } data1 = new ProposeCourseData(); data1.setCourse( ls1.getString("course") ); data1.setCyear( ls1.getString("cyear") ); data1.setCourseseq( ls1.getString("courseseq") ); data1.setCoursenm( ls1.getString("coursenm") ); data1.setSubj(v_subj); data1.setYear(v_year); data1.setSubjseq(v_subjseq); data1.setSubjseqgr(v_subjseqgr); data1.setSubjnm( ls1.getString("subjnm") ); data1.setEdustart( ls1.getString("edustart") ); data1.setEduend( ls1.getString("eduend") ); data1.setIsonoff( ls1.getString("isonoff") ); data1.setProposetype(v_proposetype); data1.setStudentlimit(v_studentlimit); data1.setStucnt(v_stucnt); list.add(data1); // 신청기간 전 여부 if ( v_propstart > Integer.parseInt(FormatDate.getDate("yyyyMMddHH"))) { data1.setProposestart("N"); } else { data1.setProposestart("Y"); } // 신청마감여부 if ( (v_stucnt < v_studentlimit) && (v_propstart <= Integer.parseInt(FormatDate.getDate("yyyyMMddHH")) && v_propend >= Integer.parseInt(FormatDate.getDate("yyyyMMddHH")))) { data1.setProposeend("N"); } else { data1.setProposeend("Y"); } // 수강완료여부 } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql1); throw new Exception("sql1 = " + sql1 + "\r\n" + ex.getMessage() ); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list; }*/ /** 코스에 해당하는 과정 리스트 @param box receive from the form object and session @return ArrayList */ public ArrayList selectCourseSubjList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls1 = null; ListSet ls2 = null; ArrayList list = null; String sql1 = ""; // String sql2 = ""; ProposeCourseData data1 = null; // ProposeCourseData data2 = null; // String v_user_id = box.getSession("userid"); String v_course = box.getString("p_course"); String v_cyear = box.getString("p_cyear"); String v_courseseq = box.getString("p_courseseq"); String v_proposetype = ""; String v_subj = ""; String v_year = ""; String v_subjseq = ""; int v_studentlimit = 0; int v_stucnt = 0; try { connMgr = new DBConnectionManager(); list = new ArrayList(); // select subj,year,subjseq,subjnm,edustart,eduend,isonoff, // proposetype,studentlimit,stucnt sql1 = "select subj,year,subjseq,subjnm,isonoff,"; sql1 += "edustart,eduend,"; sql1 += "proposetype,studentlimit, "; sql1 += "(select count(subj) from TZ_PROPOSE where subj=A.subj and year=A.year and subjseq=A.subjseq) stucnt "; sql1 += "from VZ_SCSUBJSEQ A "; sql1 += " where course=" +SQLString.Format(v_course); sql1 += " and cyear=" +SQLString.Format(v_cyear); sql1 += " and courseseq=" +SQLString.Format(v_courseseq); sql1 += " and isuse = 'Y' "; sql1 += " order by subj,subjseq,edustart,eduend "; ls1 = connMgr.executeQuery(sql1); while ( ls1.next() ) { v_subj = ls1.getString("subj"); v_year = ls1.getString("year"); v_subjseq = ls1.getString("subjseq"); v_proposetype = ls1.getString("proposetype"); v_studentlimit = ls1.getInt("studentlimit"); v_stucnt = ls1.getInt("stucnt"); data1 = new ProposeCourseData(); data1.setSubj(v_subj); data1.setYear(v_year); data1.setSubjseq(v_subjseq); data1.setSubjnm( ls1.getString("subjnm") ); data1.setEdustart( ls1.getString("edustart") ); data1.setEduend( ls1.getString("eduend") ); data1.setIsonoff( ls1.getString("isonoff") ); data1.setProposetype(v_proposetype); data1.setStudentlimit(v_studentlimit); data1.setStucnt(v_stucnt); list.add(data1); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql1); throw new Exception("sql1 = " + sql1 + "\r\n" + ex.getMessage() ); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( ls2 != null ) { try { ls2.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list; } public int datediff(String stdt, String eddt) { int returnValue = 0; long temp = 0; int year = Integer.parseInt(stdt.substring(0,4)); int month = Integer.parseInt(stdt.substring(4,6)); int day = Integer.parseInt(stdt.substring(6,8)); int year1 = Integer.parseInt(eddt.substring(0,4)); int month1 = Integer.parseInt(eddt.substring(4,6)); int day1 = Integer.parseInt(eddt.substring(6,8)); TimeZone tz = TimeZone.getTimeZone("Asia/Seoul"); Calendar cal=Calendar.getInstance(tz); cal.set((year-1900),(month-1),day); Calendar cal2=Calendar.getInstance(tz); cal2.set((year1-1900),(month1-1),day1); java.util.Date temp1 = cal.getTime(); java.util.Date temp2 = cal2.getTime(); temp = temp2.getTime() - temp1.getTime(); if ( (temp % 10) < 5) temp = temp - (temp % 10); else temp = temp + (10 - (temp % 10)); returnValue = (int)(temp / ( 1000 * 60 * 60 * 24)); return returnValue; } /** 교육그룹 리스트 @param box receive from the form object and session @return ArrayList */ public ArrayList selectGrcodeList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls1 = null; ArrayList list1 = null; String sql1 = ""; SelectionData data1= null; //String v_user_id = box.getSession("userid"); String v_comp = box.getSession("comp"); v_comp = v_comp.substring(0,4); //int l = 0; try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); // select code,name sql1 = "select distinct a.grcode code, substr(a.grcodenm,4,50) name, a.code_order "; sql1 += " from TZ_GRCODE a"; sql1 += " , tz_grcomp b"; sql1 += " where a.grcode=b.grcode "; sql1 += " and b.comp like " +SQLString.Format(v_comp+"%"); sql1 += " order by a.code_order "; ls1 = connMgr.executeQuery(sql1); while ( ls1.next() ) { data1 = new SelectionData(); data1.setCode( ls1.getString("code") ); data1.setName( ls1.getString("name") ); list1.add(data1); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql1); throw new Exception("sql1 = " + sql1 + "\r\n" + ex.getMessage() ); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list1; } /** 임시 comp, jikup 세션부여 @param box receive from the form object and session @return int */ public int setCreduSession(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls1 = null; String sql1 = ""; int result = 0; String v_userid = box.getSession("userid"); String v_comp = ""; String v_jik = ""; try { connMgr = new DBConnectionManager(); // select code,name sql1 = "select comp, jikup "; sql1 += " from TZ_MEMBER "; sql1 += " where userid="+SQLString.Format(v_userid); ls1 = connMgr.executeQuery(sql1); while ( ls1.next() ) { v_comp = ls1.getString("comp"); v_jik = ls1.getString("jikup"); box.setSession("comp", v_comp); box.setSession("jikup", v_jik); result = 1; } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql1); throw new Exception("sql1 = " + sql1 + "\r\n" + ex.getMessage() ); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return result; } /** 팀장정보 리턴 @param box receive from the form object and session @return ProposeCourseData */ public DataBox getSelectChief(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls1 = null; String sql = ""; String v_comp = box.getSession("comp"); try { connMgr = new DBConnectionManager(); // sql = " select deptmbirth_date,deptmname,deptmjikwi from tz_comp \n"; // sql += " where \n"; //sql = " select email, userid, name, comp, userid as cono from tz_member where userid in (select deptmbirth_date from tz_comp where comp = " +SQLString.Format(v_comp) + " ) \n"; ls1 = connMgr.executeQuery(sql); if ( ls1.next() ) { dbox = ls1.getDataBox(); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return dbox; } /** 팀장정보 리턴 @param box receive from the form object and session @return ProposeCourseData */ public DataBox getSelectChief(String userid) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls1 = null; String sql = ""; String v_comp = ""; Hashtable outputData = new Hashtable(); ProposeBean probean = new ProposeBean(); try { connMgr = new DBConnectionManager(); outputData = probean.getMeberInfo(userid); v_comp = (String)outputData.get("comp"); // sql = " select deptmbirth_date,deptmname,deptmjikwi from tz_comp \n"; // sql += " where \n"; //sql = " select email, userid, name, comp, cono from tz_member where userid in (select deptmbirth_date from tz_comp where comp = " +SQLString.Format(v_comp) + " ) \n"; ls1 = connMgr.executeQuery(sql); if ( ls1.next() ) { dbox = ls1.getDataBox(); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return dbox; } /** * 대분류 SELECT (ALL 제외) * @param box receive from the form object and session * @return ArrayList 대분류 리스트 */ public ArrayList getOnlyUpperClass(RequestBox box) throws Exception { DBConnectionManager connMgr = null; PreparedStatement pstmt = null; ListSet ls = null; ArrayList list = null; String sql = ""; DataBox dbox = null; String v_usergubun = box.getSession("usergubun"); //String v_isonoff = ""; ConfigSet conf = new ConfigSet(); if ( (v_usergubun.equals("RH")||v_usergubun.equals("RK")) && (!v_usergubun.equals(""))) { //v_isonoff = box.getStringDefault("p_isonoff", "OFF"); } else { //v_isonoff = box.getStringDefault("p_isonoff", "ON"); } try { String v_upperclass1 = conf.getProperty("main.cyber.upperclass1"); String v_upperclass2 = conf.getProperty("main.cyber.upperclass2"); String v_upperclass3 = conf.getProperty("main.cyber.upperclass3"); String isCourse = "N"; // 코스가 있어야 하는지 여부 connMgr = new DBConnectionManager(); list = new ArrayList(); sql = "select upperclass, classname"; sql += " from tz_subjatt"; sql += " where "; if ( (v_usergubun.equals("RH")||v_usergubun.equals("RK")) ) { sql += " substr(upperclass,0,1) = 'R'"; } else { sql += "(upperclass = " +SQLString.Format(v_upperclass1) + " or upperclass = " +SQLString.Format(v_upperclass2) + " or upperclass = " +SQLString.Format(v_upperclass3) + ")"; } sql += " and middleclass = '000'"; sql += " and lowerclass = '000'"; if ( isCourse.equals("N") ) { // 코스분류도 없다 sql += " and upperclass != 'COUR'"; } sql += " order by upperclass"; pstmt = connMgr.prepareStatement(sql, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ls = new ListSet(pstmt); // dbox = this.setAllSelectBox( ls); // list.add(dbox); while ( ls.next() ) { dbox = ls.getDataBox(); list.add(dbox); } } catch ( Exception ex ) { ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e1 ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list; } /** * 대분류 SELECT (ALL 제외) * @param box receive from the form object and session * @return ArrayList 대분류 리스트 */ public ArrayList getMainUpperClass(RequestBox box) throws Exception { DBConnectionManager connMgr = null; PreparedStatement pstmt = null; ListSet ls = null; ArrayList list = null; String sql = ""; DataBox dbox = null; ConfigSet conf = new ConfigSet(); try { // String isCourse = box.getStringDefault("isCourse", "N"); // 코스가 있어야 하는지 여부 // String v_indexclass = conf.getProperty("index.main.defaultclass"); String v_upperclass1 = conf.getProperty("main.cyber.upperclass1"); String v_upperclass2 = conf.getProperty("main.cyber.upperclass2"); String v_upperclass3 = conf.getProperty("main.cyber.upperclass3"); // String isCourse = "N"; // 코스가 있어야 하는지 여부 connMgr = new DBConnectionManager(); list = new ArrayList(); sql = "select upperclass, classname"; sql += " from tz_subjatt"; sql += " where "; sql += "(upperclass = " +SQLString.Format(v_upperclass1) + " or upperclass = " +SQLString.Format(v_upperclass2) + " or upperclass = " +SQLString.Format(v_upperclass3) + ")"; // sql += "upperclass in(" +v_indexclass + ")"; sql += " and middleclass = '000'"; sql += " and lowerclass = '000'"; sql += " order by upperclass"; pstmt = connMgr.prepareStatement(sql, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ls = new ListSet(pstmt); // dbox = this.setAllSelectBox( ls); // list.add(dbox); while ( ls.next() ) { dbox = ls.getDataBox(); list.add(dbox); } } catch ( Exception ex ) { ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e1 ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list; } /** * 구분 리스트 (온라인 / 오프라인) * @param box receive from the form object and session * @return ArrayList 대분류 리스트 */ public ArrayList getGubun(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls = null; ArrayList list = null; String sql = ""; DataBox dbox = null; try { connMgr = new DBConnectionManager(); list = new ArrayList(); sql = " select code, codenm from tz_code "; sql += " where gubun = " +SQLString.Format(GUBUN_CODE); sql += " order by code desc"; ls = connMgr.executeQuery(sql); while ( ls.next() ) { dbox = ls.getDataBox(); list.add(dbox); } } catch ( Exception ex ) { ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list; } /** * 제약조건 체크 * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @param p_tem_grcode 현재교육그룹코드 * @return result 제약조건결과 코드 */ public int jeyakCheck(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { ListSet ls = null; int result = 0; // String msg = ""; String v_subjtype = GetCodenm.chkIsSubj(connMgr,p_subj); try { // 비계열사는 개인별로 수강신청 무조건 안됨. -17 //result =jeyakCompYn(connMgr, p_subj, p_year, p_subjseq, p_userid, p_comp); //if ( result < 0) return result; // 수강신청기간 지남 -10 result =jeyakEndPeriod(connMgr, p_subj, p_year, p_subjseq, p_userid, p_comp); if ( result < 0) return result; // 정원초과 - 1 if ( v_subjtype.equals("S")){ result =jeyakStudentlimit(connMgr, p_subj, p_year, p_subjseq, p_userid, p_comp); //if ( result < 0) return result; } // 이미수료한과정이면 안됨 -14 if ( v_subjtype.equals("S")){ result =jeyakIsgraduated(connMgr, p_subj, p_year, p_subjseq, p_userid, p_comp); if ( result < 0) return result; } // 다른기수를 학습하고 있는 과정이면 안됨 -15 if ( v_subjtype.equals("S")){ result =jeyakStudentYn(connMgr, p_subj, p_year, p_subjseq, p_userid, p_comp); if ( result < 0) return result; } // 다른기수를 신청한 과정이면 안됨 -16 result =jeyakProposeYn(connMgr, p_subj, p_year, p_subjseq, p_userid, p_comp); if ( result < 0) return result; // 이미신청한과정 - 2 //result =jeyakPropose(connMgr, p_subj, p_year, p_subjseq, p_userid, p_comp); //if ( result < 0) return result; if ( v_subjtype.equals("S")){ result =jeyakRejectkind(connMgr, p_subj, p_year, p_subjseq, p_userid, p_comp); //수강신청데이터중에 반려데이터가있을경우 if ( result < 0) return result; } // 수강신청 과정수 제한 /* 수강신청시 제약 과정수 - 이러닝, 독서교육으로 구분됨. - 제약과정수는 공통코드의 '0105'에 등록해서 사용. - 이러닝은 'ON', 독서교육은 'RC' - 이러닝중에서 subj_gu 이 'J','M','E' 인거는 제외. - 기준은 교육시작월. - 교육시작월이 중복되면 안됨. (일반과정은 12개 초과될수 없음) */ if ( v_subjtype.equals("S")){ result =jeyakSubjCnt(connMgr, p_subj, p_year, p_subjseq, p_userid); if ( result < 0) return result; } // 고용보험 환급 과정인데 주민등록번호가 입력되어 있지 않은지 if ( v_subjtype.equals("S")){ result =jeyakNotbirth_date(connMgr, p_subj, p_year, p_subjseq, p_userid); if ( result < 0) return result; } // 직무제한 과정일 경우 해당 직무인 사람만 신청가능 //if ( GetCodenm.chkIsSubj(connMgr,p_subj).equals("S")){ // result =jeyakJikmu(connMgr, p_subj, p_year, p_userid); // if ( result < 0) return result; //} // // 수료한과정 - 3 (제약조건 제거) // if ( GetCodenm.chkIsSubj(connMgr,p_subj).equals("S")){ // result =jeyakStold(connMgr, p_subj, p_year, p_subjseq, p_userid, p_comp); // if ( result < 0) return result; // } // // // 마스터과정인지, 대상자인지 - 4 // if ( GetCodenm.chkIsSubj(connMgr,p_subj).equals("S")){ // result =jeyakMasterSubj(connMgr, p_subj, p_year, p_subjseq, p_userid, p_comp); // if ( result < 0) return result; // } // // 예산초과 - 5 (제약조건 제거) // // result =jeyakBudget(connMgr, p_subj, p_year, p_subjseq, p_userid, p_comp); // // if ( result < 0) return result; // // // 삼진아웃 대상인지 -5 if ( v_subjtype.equals("S")){ result =jeyakStrOut(connMgr, p_subj, p_year, p_subjseq, p_userid, p_comp); if ( result < 0) return result; } // // // 동시 수강 가능 과정수 초과 - 7 // if ( GetCodenm.chkIsSubj(connMgr,p_subj).equals("S")){ // result =jeyakSyncPropose(connMgr, p_userid, p_subj ); // if ( result < 0) return result; // } // // // 현재 복습이 가능한 과정인지 7 // if ( GetCodenm.chkIsSubj(connMgr,p_subj).equals("S")){ // result =jeyakIsReEdu(connMgr, p_subj, p_year, p_userid); // if ( result < 0) return result; // } } catch ( Exception ex ) { ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 정원초과 * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, 1 : 정원초과 */ public int jeyakStudentlimit(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { ListSet ls = null; String sql = ""; int result = 0; try { sql = " select count(*) cnt "; sql += " from tz_subjseq a "; sql += " where a.subj = " +SQLString.Format(p_subj); sql += " and a.year = " +SQLString.Format(p_year); sql += " and a.subjseq = " +SQLString.Format(p_subjseq); sql += " and a.studentlimit > (select count(userid) from tz_propose where subj = a.subj and subjseq = a.subjseq and year = a.year and chkfinal != 'N') "; // sql += " and (case when a.studentlimit = 0 then 1000000 else a.studentlimit end) > (select count(userid) from tz_propose where subj = a.subj and subjseq = a.subjseq and year = a.year and chkfinal != 'N') "; ls = connMgr.executeQuery(sql); if ( ls.next() ) { if ( ls.getInt("cnt") == 0) result = -1; } } catch ( Exception ex ) { ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 정원초과 * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, 1 : 정원초과 */ public int jeyakEndPeriod(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { ListSet ls = null; String sql = ""; int result = 0; try { if ( GetCodenm.chkIsSubj(connMgr,p_subj).equals("S")){ sql = " select count(*) cnt "; sql += " from tz_subjseq a "; sql += " where a.subj = " +SQLString.Format(p_subj); sql += " and a.year = " +SQLString.Format(p_year); sql += " and a.subjseq = " +SQLString.Format(p_subjseq); sql += " and to_char(sysdate, 'yyyymmddhh24') between a.propstart and a.propend "; //a.propend } else { sql = " select count(*) cnt "; sql += " from tz_courseseq a "; sql += " where a.course = " +SQLString.Format(p_subj); sql += " and a.cyear = " +SQLString.Format(p_year); sql += " and a.courseseq = " +SQLString.Format(p_subjseq); sql += " and to_char(sysdate, 'yyyymmddhh24') between a.propstart and a.propend "; } ls = connMgr.executeQuery(sql); if ( ls.next() ) { if ( ls.getInt("cnt") == 0) result = -10; } } catch ( Exception ex ) { ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 이미신청한과정 * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, 2 : 이미신청한과정 */ public int jeyakPropose(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { ListSet ls = null; String sql = ""; int result = 0; try { if ( GetCodenm.chkIsSubj(connMgr,p_subj).equals("S")){ sql = " select count(*) cnt "; sql += " from TZ_PROPOSE "; sql += " where subj = " + SQLString.Format(p_subj ); sql += " and year = " + SQLString.Format(p_year ); sql += " and subjseq = " + SQLString.Format(p_subjseq); sql += " and userid = " + SQLString.Format(p_userid ); sql += " and chkfinal != 'N'"; } else { sql = "select count(*) cnt \n" + "from tz_propose a \n" + "where exists ( \n" + " select 'X' \n" + " from vz_scsubjseq b \n" + " where a.subj = b.subj \n" + " and a.year = b.year \n" + " and a.subjseq = b.subjseq \n" + " and course =" + SQLString.Format(p_subj ) + " and cyear =" + SQLString.Format(p_year ) + " and courseseq = " + SQLString.Format(p_subjseq) + " and userid = " + SQLString.Format(p_userid ) + ") \n" + "and a.chkfinal != 'N' \n"; } ls = connMgr.executeQuery(sql); if ( ls.next() ) { if ( ls.getInt("cnt") > 0) result = -2; } } catch ( Exception ex ) { ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 반려된 수강정보가 있을경우 * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, 2 : 이미신청한과정 */ public int jeyakRejectkind(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { ListSet ls = null; String sql = ""; int result = 0; try { if ( GetCodenm.chkIsSubj(connMgr,p_subj).equals("S")){ sql = " select count(*) cnt "; sql += " from TZ_PROPOSE "; sql += " where subj = " + SQLString.Format(p_subj ); sql += " and year = " + SQLString.Format(p_year ); sql += " and subjseq = " + SQLString.Format(p_subjseq); sql += " and userid = " + SQLString.Format(p_userid ); sql += " and chkfinal = 'N'"; sql += " and CANCELKIND is not null"; //System.out.println("jeyakPropose === >"+sql); } ls = connMgr.executeQuery(sql); if ( ls.next() ) { if ( ls.getInt("cnt") > 0) result = -20; } } catch ( Exception ex ) { ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 재수강 * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, 1 : 정원초과 */ public int jeyakIsReEdu(DBConnectionManager connMgr, String p_subj, String p_year, String p_userid) throws Exception { ListSet ls = null; String sql = ""; int result = 0 ; String v_rtnvalue = ""; try { sql += " SELECT nvl(MAX(tsd.isgraduated), 'N') isReview \n"; sql += " FROM tz_stold tsd \n"; sql += " , tz_subjseq tss \n"; sql += " WHERE tsd.userid = " + SQLString.Format(p_userid ) + " \n"; sql += " AND tsd.subj = " + SQLString.Format(p_subj ) + " \n"; sql += " AND tsd.subj = tss.subj \n"; sql += " AND tsd.year = tss.year \n"; sql += " AND tsd.subjseq = tss.subjseq \n"; sql += " AND tsd.eduend >= to_char(sysdate - 365, 'yyyymmdd') \n"; ls = connMgr.executeQuery(sql); if ( ls.next() ) { v_rtnvalue = ls.getString("isreview"); } if ( v_rtnvalue.equals("Y") ) { result = 7; } else { result = 0; } } catch ( Exception ex ) { ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 수료한과정 * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, 3 : 수료한과정 */ public int jeyakStold(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { ListSet ls = null; String sql = ""; int result = 0; try { sql = " select nvl(MAX(isgraduated), 'N') isgraduated "; sql += " from TZ_STOLD "; sql += " where subj = " +SQLString.Format(p_subj); // sql += " and year = " +SQLString.Format(p_year); // sql += " and subjseq = " +SQLString.Format(p_subjseq); sql += " and userid = " +SQLString.Format(p_userid); ls = connMgr.executeQuery(sql); if ( ls.next() ) { if ( ls.getString("isgraduated").equals("Y") ) result = -3; } } catch ( Exception ex ) { ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 마스터과정인지, 대상자인지 * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, 4 :마스터과정인지, 대상자인지 */ public int jeyakMasterSubj(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { ListSet ls1 = null; ListSet ls2 = null; String sql1 = ""; String sql2 = ""; int result = 0; try { sql1 = " select count(*) cnt \n"; sql1 += " from TZ_MASTERSUBJ \n"; sql1 += " where subjcourse = " +SQLString.Format(p_subj ) + " \n"; sql1 += " and year = " +SQLString.Format(p_year ) + " \n"; sql1 += " and subjseq = " +SQLString.Format(p_subjseq ) + " \n"; ls1 = connMgr.executeQuery(sql1); if ( ls1.next() ) { // 마스터과정일경우 if ( ls1.getInt("cnt") > 0 ) { sql2 = " select count(*) cnt "; sql2 += " from tz_edutarget a, tz_mastersubj b "; sql2 += " where a.mastercd = b.mastercd "; sql2 += " and b.subjcourse = " +SQLString.Format(p_subj); sql2 += " and b.year = " +SQLString.Format(p_year); sql2 += " and b.subjseq = " +SQLString.Format(p_subjseq); sql2 += " and a.userid = " +SQLString.Format(p_userid); ls2 = connMgr.executeQuery(sql2); if ( ls2.next() ) { if ( ls2.getInt("cnt") == 0) result = -4; } ls2.close(); } } } catch ( Exception ex ) { ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( ls2 != null ) { try { ls2.close(); } catch ( Exception e ) { } } } return result; } /** * 예산초과 * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, 5 :예산초과 */ public int jeyakBudget(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { ListSet ls1 = null; ListSet ls2 = null; String sql1 = ""; String sql2 = ""; int result = 0; String v_propstart = ""; String v_propend = ""; String v_gubun = ""; long v_budget = 0; long v_totbiyong = 0; try { // 예산설정관련정보 sql1 = " select b.propstart, b.propend, b.budget, b.gubun "; sql1 += " from tz_subjseq a, tz_budget b, tz_subj c "; sql1 += " where a.grcode = b.grcode "; sql1 += " and a.gyear = b.gryear "; sql1 += " and a.grseq = b.grseq "; sql1 += " and a.subj = c.subj "; sql1 += " and b.gubun = (select matchcode from TZ_CLASSFYMATCH where upperclass = c.upperclass) "; sql1 += " and b.isuse ='Y' "; sql1 += " and substr(to_char(sysdate,'yyyymmddhh24miss'), 1, 10) between b.propstart and b.propend "; sql1 += " and a.subj = " +SQLString.Format(p_subj); sql1 += " and a.year = " +SQLString.Format(p_year); sql1 += " and a.subjseq = " +SQLString.Format(p_subjseq); ls1 = connMgr.executeQuery(sql1); while ( ls1.next() ) { // 예산설정 돼 있는경우 v_propstart = ls1.getString("propstart"); v_propend = ls1.getString("propend"); v_gubun = ls1.getString("gubun"); v_budget = ls1.getLong("budget"); sql2 = " select sum(c.biyong) totbiyong "; sql2 += " from tz_propose a, tz_member b, vz_scsubjseq c "; sql2 += " where a.userid = b.userid "; sql2 += " and c.grcode in (select grcode from TZ_GRCOMP where comp like " +SQLString.Format(p_subj) + " )"; sql2 += " and a.subj = c.subj and a.year = c.year and a.subjseq = c.subjseq "; sql2 += " and c.scupperclass in (select upperclass from TZ_CLASSFYMATCH where matchcode=" +SQLString.Format(v_gubun) + " )"; sql2 += " and appdate between " +SQLString.Format(v_propstart) + " and " +SQLString.Format(v_propend); ls2 = connMgr.executeQuery(sql2); if ( ls2.next() ) { v_totbiyong = ls2.getLong("totbiyong"); } // 예산 <= 현재비용 if ( v_budget <= v_totbiyong) result =-5; } } catch ( Exception ex ) { ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( ls2 != null ) { try { ls2.close(); } catch ( Exception e ) { } } } return result; } /** * 회사별 수강신청 제약설정 * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, 6 : 제약대상 */ public int jeyakCompcondition(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { ListSet ls1 = null; ListSet ls2 = null; ListSet ls3 = null; String sql1 = ""; String sql2 = ""; String sql3 = ""; int result = 0; String v_matchcode = ""; // 현재 신청한 과정의 어학,직무 구분코드 (W:직무, L:어학) // tz_compcondition에 설정된 값 int v_duty1 = 0; int v_language1 = 0; int v_allcondition1 = 0; int v_yearduty1 = 0; int v_yearlanguage1 = 0; // 사용자 값 int v_duty2 = 0; int v_language2 = 0; int v_allcondition2 = 0; int v_yearduty2 = 0; int v_yearlanguage2 = 0; try { // 신청한 과정의 어학, 직무 구분 sql1 = " select b.matchcode from tz_subjseq a, tz_classfymatch b, tz_subj c "; sql1 += " where b.upperclass = c.upperclass "; sql1 += " and a.subj = c.subj "; sql1 += " and a.subj = " +SQLString.Format(p_subj); sql1 += " and a.year = " +SQLString.Format(p_year); sql1 += " and a.subjseq = " +SQLString.Format(p_subjseq); ls1 = connMgr.executeQuery(sql1); if ( ls1.next() ) v_matchcode = ls1.getString("matchcode"); if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } // 제약내용 sql1 = " select duty, language, allcondition, yearduty, yearlanguage "; sql1 += " from tz_compcondition "; sql1 += " where comp = " +SQLString.Format(p_comp); ls1 = connMgr.executeQuery(sql1); if ( ls1.next() ) { v_duty1 = ls1.getInt("duty"); v_language1 = ls1.getInt("language"); v_allcondition1 = ls1.getInt("allcondition"); v_yearduty1 = ls1.getInt("yearduty"); v_yearlanguage1 = ls1.getInt("yearlanguage"); if ( v_duty1 == 0) v_duty1 = 10000; // 0일경우 체크를 안함 else if ( v_language1 == 0) v_language1 = 10000; // 0일경우 체크를 안함 else if ( v_allcondition1 == 0) v_allcondition1 = 10000; // 0일경우 체크를 안함 else if ( v_yearduty1 == 0) v_yearduty1 = 10000; // 0일경우 체크를 안함 else if ( v_yearlanguage1 == 0) v_yearlanguage1 = 10000; // 0일경우 체크를 안함 // 현재기수에 신청한 갯수 sql2 = " select sum(decode(c.matchcode, 'W', 1, 0)) duty, "; sql2 += " sum(decode(c.matchcode, 'L', 1, 0)) language "; sql2 += " from tz_propose a, tz_subjseq b, tz_classfymatch c, tz_subj d "; sql2 += " "; sql2 += " where a.subj = b.subj and a.year = b.year and a.subjseq = b.subjseq "; sql2 += " and c.upperclass = d.upperclass "; sql2 += " and b.subj = d.subj "; sql2 += " and b.grcode+b.gyear+b.grseq = (select grcode+gyear+grseq "; sql2 += " from tz_subjseq "; sql2 += " where subj = " +SQLString.Format(p_subj); sql2 += " and year = " +SQLString.Format(p_year); sql2 += " and subjseq = " +SQLString.Format(p_subjseq) + " ) "; sql2 += " and a.cancelkind is null "; sql2 += " and a.userid = " +SQLString.Format(p_userid); ls2 = connMgr.executeQuery(sql2); if ( ls2.next() ) { v_duty2 = ls2.getInt("duty"); v_language2 = ls2.getInt("language"); } else { v_duty2 = 0; v_language2 = 0; } v_allcondition2 = v_duty2 + v_language2; if ( v_allcondition1 <= v_allcondition2 ) { // 총신청갯수가 같은경우 result = -6; return result; } else if ( v_matchcode.equals("W") && (v_duty1 <= v_duty2) ) { // 직무신청갯수가 같은경우 result = -6; return result; } else if ( v_matchcode.equals("L") && (v_language1 <= v_language2)) { // 어학신청갯수가 같은경우 result = -6; return result; } // 현재년도에 신청한 갯수 sql3 = " select sum(decode(c.matchcode, 'W', 1, 0)) yearduty, "; sql3 += " sum(decode(c.matchcode, 'L', 1, 0)) yearlanguage "; sql3 += " from tz_propose a, "; sql3 += " (select grcode, gyear, grseq,scupperclass, subj, year, subjseq "; sql3 += " from vz_scsubjseq "; sql3 += " where subj = " +SQLString.Format(p_subj); sql3 += " and year = " +SQLString.Format(p_year) + " ) b, "; sql3 += " tz_classfymatch c "; sql3 += " where a.subj = b.subj and a.year = b.year and a.subjseq = b.subjseq "; sql3 += " and b.scupperclass = c.upperclass "; sql3 += " and a.cancelkind is null "; sql3 += " and a.userid = " +SQLString.Format(p_userid); ls3 = connMgr.executeQuery(sql3); if ( ls3.next() ) { v_yearduty2 = ls3.getInt("yearduty"); v_yearlanguage2 = ls3.getInt("yearlanguage"); } else { v_yearduty2 = 0; v_yearlanguage2 = 0; } if ( v_matchcode.equals("W") && (v_yearduty1 <= v_yearduty2) ) { // 직무신청갯수가 같은경우 result = -6; return result; } else if ( v_matchcode.equals("L") && (v_yearlanguage1 <= v_yearlanguage2)) { // 어학신청갯수가 같은경우 result = -6; return result; } } } catch ( Exception ex ) { ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( ls2 != null ) { try { ls2.close(); } catch ( Exception e ) { } } if ( ls3 != null ) { try { ls2.close(); } catch ( Exception e ) { } } } return result; } /** * 블랙리스트 제약설정 * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 제약대상 - 메세지 */ public String jeyakBlackcondition(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { // PreparedStatement pstmt = null; ListSet ls1 = null; ListSet ls2 = null; StringBuffer sbSQL = new StringBuffer(""); String result = ""; String v_conditioncode = ""; try { sbSQL.append(" select a.conditioncode \n") .append(" from tz_blacklist a \n") .append(" , tz_subjseq b \n") .append(" where a.grcode = b.grcode \n") .append(" and a.gryear = b.gyear \n") .append(" and a.grseq = b.grseq \n") .append(" and b.subj = " + SQLString.Format(p_subj ) + " \n") .append(" and b.year = " + SQLString.Format(p_year ) + " \n") .append(" and b.subjseq = " + SQLString.Format(p_subjseq) + " \n"); ls1 = connMgr.executeQuery(sbSQL.toString()); sbSQL.setLength(0); // 제약대상이면 if ( ls1.next() ) { v_conditioncode = ls1.getString("conditioncode"); // 제약대상 메세지 SELECT sbSQL.append(" select a.alertmsg \n") .append(" from tz_BlackCondition a \n") .append(" , tz_subjseq b \n") .append(" where a.grcode = b.grcode \n") .append(" and a.gryear = b.gyear \n") .append(" and a.grseq = b.grseq \n") .append(" and b.subj = " + SQLString.Format(p_subj ) + " \n") .append(" and b.year = " + SQLString.Format(p_year ) + " \n") .append(" and b.subjseq = " + SQLString.Format(p_subjseq ) + " \n") .append(" and a.conditioncode = " + SQLString.Format(v_conditioncode ) + " \n"); ls2 = connMgr.executeQuery(sbSQL.toString()); if ( ls2.next() ) { result = ls2.getString("alertmsg"); return result; } } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, null, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( ls2 != null ) { try { ls2.close(); } catch ( Exception e ) { } } } return result; } /** * 삼진 아웃 대상에 걸렸는지 여부 * @param connMgr DBConnectionManager * @param p_userid 유저아이디 * @return result 0 : 정상, -5 : 제약대상 */ public int jeyakStrOut(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { ListSet ls = null; StringBuffer sbSQL = new StringBuffer(""); int result = 0; String sql = ""; int v_cnt = 0; //String v_grcode = "N000001"; String v_gu = ""; try { /* sbSQL.append(" SELECT COUNT(*) Cnt \n") .append(" FROM Tz_Strout Ts \n") .append(" WHERE UserId = " + SQLString.Format(p_userid) + " \n") .append(" AND Grcode = " + SQLString.Format(v_grcode) + " \n") .append(" AND isstrout = 'Y' \n"); ls = connMgr.executeQuery(sbSQL.toString()); if ( ls.next() ) { v_cnt = ls.getInt("Cnt"); } if ( v_cnt > 0 ) { result = -5; } */ // 삼진아웃이 되는 과정의 교육종료일부터 수강신청할 교육시작월까지의 제약기간동안은 학습을 하지 못한다. sql = "\n select case when to_date(edustart,'yyyymmdd') < eduend then " + "\n 'N' " + "\n else 'Y' " + "\n end as gu " + "\n from ( " + "\n select ( " + "\n select add_months(to_date(substr(b.eduend,0,8),'yyyymmdd'), c.duemonth) " + "\n from tz_strout a " + "\n , tz_subjseq b " + "\n , tz_strout_setup c " + "\n where a.subj = b.subj " + "\n and a.year = b.year " + "\n and a.subjseq = b.subjseq " + "\n and a.isstrout = 'Y' " + "\n and a.userid = " + StringManager.makeSQL(p_userid) + "\n ) as eduend " + "\n , ( " + "\n select substr(edustart,0,8) " + "\n from tz_subjseq a, tz_subj b " + "\n where a.subj = " + StringManager.makeSQL(p_subj) + "\n and a.year = " + StringManager.makeSQL(p_year) + "\n and a.subjseq = " + StringManager.makeSQL(p_subjseq) + "\n and a.subj = b.subj " + "\n and (b.subj_gu is null or b.subj_gu = '' ) " + "\n ) as edustart " + "\n from dual " + "\n ) "; ls = connMgr.executeQuery(sql); if ( ls.next() ) { v_gu = ls.getString("gu"); } if ( "N".equals(v_gu) ) { result = -5; } } catch ( SQLException e ) { result = -5; ErrorManager.getErrorStackTrace(e, null, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { result = -5; ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 동시 수강 가능한 항목수 제약 설정 * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, -7 : 제약대상 */ public int jeyakSyncPropose(DBConnectionManager connMgr, String p_userid, String p_subj) throws Exception { ListSet ls = null; // StringBuffer sbSQL = new StringBuffer(""); int result = 0; int v_syncpropcnt = 2; int v_cnt = 0; SubjLimitBean bean = new SubjLimitBean(); DataBox dbox = bean.selectSubjLimit(null); String sql = ""; try { v_syncpropcnt = dbox.getInt("d_cnt"); sql = "select count(*) cnt \n" + "from tz_propose a, vz_scsubjseq b \n" + "where a.subj = b.subj \n" + "and a.year =b.year \n" + "and a.subjseq = b.subjseq \n" + "and to_char(sysdate, 'yyyymmddhh24') between b.propstart and b.propend \n" + "and (a.cancelkind is null or a.cancelkind not in ('F', 'P')) \n" + "and a.userid = "+ SQLString.Format(p_userid)+ " \n"; ls = connMgr.executeQuery(sql); if ( ls.next() ) { v_cnt = ls.getInt("cnt"); } // 동시 수강 가능 과정수 초과 여부 if( v_syncpropcnt > 0) { if ( v_cnt >= v_syncpropcnt ) { result = -7; } } } catch ( SQLException e ) { result = -7; ErrorManager.getErrorStackTrace(e, null, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { result = -7; ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 고용보험 환급 과정인데 주민등록번호가 입력되어 있지 않은 경우 * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, 1 : 정원초과 */ public int jeyakNotbirth_date(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid) throws Exception { ListSet ls = null; String sql = ""; int result = 0; try { sql = " select 'Y' \n" + "from tz_subjseq a, tz_member b \n" + "where subj = " + StringManager.makeSQL(p_subj) + " \n" + "and year= " +StringManager.makeSQL(p_year) + " \n" + "and subjseq = " + StringManager.makeSQL(p_subjseq) + " \n" + "and b.userid = " + StringManager.makeSQL(p_userid) + " \n" + "and (b.birth_date is null or trim(b.birth_date) is null) \n"; ls = connMgr.executeQuery(sql); if ( ls.next() ) { result = -11; } } catch ( SQLException e ) { result = -11; ErrorManager.getErrorStackTrace(e, null, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception ex ) { result = -11; ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 독서교육 과정의 경우 부서(tz_subj sel_dept), 직급(tz_subj sel_post)와 get_orggu(userid), post 값과 일치하는 사람으로 제한 * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, -12 : */ public int jeyakRC(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid) throws Exception { ListSet ls = null; String sql = ""; int result = 0; String v_isonoff = ""; try { sql = "select isonoff \n" + "from tz_subj a \n" + "where a.subj = " + StringManager.makeSQL(p_subj) + " \n"; ls = connMgr.executeQuery(sql); if ( ls.next() ) { v_isonoff = ls.getString("isonoff"); } if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if("RC".equals(v_isonoff)) { sql = "select 'Y' \n" + "from tz_subj a, tz_member b \n" + "where a.subj = " + StringManager.makeSQL(p_subj) + " \n" + "and b.userid = " + StringManager.makeSQL(p_userid) + " \n" + "and sel_dept like '%' || get_orggu(userid) || '%' \n" + "and sel_post like '%' || post || '%' \n"; ls = connMgr.executeQuery(sql); if ( !ls.next() ) { result = -12; } } } catch ( SQLException e ) { result = -12; ErrorManager.getErrorStackTrace(e, null, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception ex ) { result = -12; ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 수강신청시 제약 과정수 - 이러닝, 독서교육으로 구분됨. - 제약과정수는 공통코드의 '0105'에 등록해서 사용. - 이러닝은 'ON', 독서교육은 'RC' - 이러닝중에서 subj_gu 이 'J','M','E' 인거는 제외. - 기준은 교육시작월. - 교육시작월이 중복되면 안됨. (일반과정은 12개 초과될수 없음) * @return result */ public int jeyakSubjCnt(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid) throws Exception { ListSet ls = null; String sql = ""; int result = 0; String v_codegubun = "0105"; try { sql = " select isonoff, cnt, nvl(y.codenm, 999999999) comparecnt \n" + "from ( \n" + " select isonoff, count(*) cnt \n" + " from tz_propose a, vz_scsubjseq b \n" + " where a.subj = b.subj \n" + " and a.year= b.year \n" + " and a.subjseq= b.subjseq \n" + " and (subj_gu is null or subj_gu not in ('J','M','E')) \n" + " and (substr(b.edustart, 1,6), isonoff) in ( \n" + " select substr(edustart, 1, 6), isonoff \n" + " from vz_scsubjseq \n" + " where subj = " + StringManager.makeSQL(p_subj) + " \n" + " and year= " + StringManager.makeSQL(p_year) + " \n" + " and subjseq= " + StringManager.makeSQL(p_subjseq) + " \n" + " and (subj_gu is null or subj_gu not in ('J','M','E')) \n" + " ) \n" + " and userid = " + StringManager.makeSQL(p_userid) + " \n" + " and (a.cancelkind is null or a.cancelkind not in ('F', 'P')) \n" + " group by isonoff \n" + ") x, ( \n" + " select code, codenm \n" + " from tz_code \n" + " where gubun = " + StringManager.makeSQL(v_codegubun) + " \n" + ") y \n" + "where x.isonoff = y.code(+) \n" + "and cnt >= nvl(y.codenm, 999999999) \n"; ls = connMgr.executeQuery(sql); if ( ls.next() ) { result = -13; } } catch ( SQLException e ) { result = -13; ErrorManager.getErrorStackTrace(e, null, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception ex ) { result = -13; ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 제약메세지 * @param p_jeyak 제약코드 * @return result 메세지 */ public String jeyakMsg(int p_jeyak) { String msg = ""; if ( p_jeyak == -2) msg ="이미 신청한 과정입니다"; // 이미신청한과정 - 2 else if ( p_jeyak == -1) msg ="정원 초과입니다"; // 정원초과 - 1 else if ( p_jeyak == -3) msg ="수료한 과정입니다"; // 수료한과정 - 3 else if ( p_jeyak == -4) msg ="대상 과정이 아닙니다"; // 마스터과정인지, 대상자인지 - 4 else if ( p_jeyak == -5) msg ="삼진 아웃 대상입니다."; // 삼진 아웃 대상입니다. -5 else if ( p_jeyak == -6) msg ="이미 수강 신청하신 과정이 있습니다."; // // else if ( p_jeyak == -7) msg ="동시 수강이 가능한 과정수를 초과하셨습니다."; // 동시 수강이 가능한 과정수 추가 -7 else if ( p_jeyak == -10) msg ="수강신청이 마감되었습니다."; // 수강신청이 마감되었습니다. -1 else if ( p_jeyak == -11) msg ="고용보험 환급과정인데 주민등록번호가 없습니다."; // 고용보험 환급과정인데 주민등록번호가 없습니다. -11 else if ( p_jeyak == -12) msg ="특정 부서, 직급의 사람만 수강신청 가능한 과정입니다."; // 특정 부서, 직급의 사람만 수강신청 가능 -12 else if ( p_jeyak == -13) msg ="해당 교육월에 교육받을 수 있는 과정수를 초과하였습니다."; // 해당 교육월에 교육받을 수 있는 과정수 초과 -13 else if ( p_jeyak == -14) msg ="이미 수료한 과정이므로 수강신청 하실 수 없습니다."; else if ( p_jeyak == -15) msg ="이미 수강중인 과정입니다."; else if ( p_jeyak == -16) msg ="이미 수강신청하신 과정입니다."; else if ( p_jeyak == -17) msg ="단체 수강신청만 가능합니다."; else if ( p_jeyak == -18) msg ="대상직무만 신청할 수 있는 과정입니다."; return msg; } /** * 제약메세지 * @param p_jeyak 제약코드 * @return result 메세지 */ public String jeyakMsg(int p_jeyak, String p_subjnm, String p_name, String p_proposedate) { String msg = ""; if ( p_jeyak == -2) msg = "<span class=\"text_blueB\">" + p_name + "</span>" + "님께서는 이미 " + p_proposedate + " 수강 신청하셨습니다."; // 이미신청한과정 - 2 else if ( p_jeyak == -1) msg = "<span class=\"text_orange\">" + p_subjnm + "</span>" + " 과정은<br>정원 초과입니다."; // 정원초과 - 1 else if ( p_jeyak == -3) msg = "<span class=\"text_orange\">" + p_subjnm + "</span>" + "과정은<br>수료한 과정입니다"; // 수료한과정 - 3 else if ( p_jeyak == -4) msg = "<span class=\"text_orange\">" + p_subjnm + "</span>" + "과정은<br>대상 과정이 아닙니다"; // 마스터과정인지, 대상자인지 - 4 else if ( p_jeyak == -5) msg = "삼진아웃 대상입니다.<br>삼진 아웃 제약기간에 포함된 과정은 신청할 수 없습니다."; // -5 // else if ( p_jeyak == -6) msg = "이미 수강 신청하신 과정이 있습니다."; // else if ( p_jeyak == -7) msg = p_name + "님께서는 이미 동시 수강이 가능한<br>과정수를 초과하셨습니다."; // 동시 수강이 가능한 과정수 추가 -7 else if ( p_jeyak == -10) msg = "<span class=\"text_orange\">" + p_subjnm + "</span>" + "과정은<br>수강신청이 마감되었습니다."; // 수강신청이 마감되었습니다. -1 else if ( p_jeyak == -11) msg = "<span class=\"text_orange\">" + p_subjnm + "</span>" + "과정은<br>고용보험 환급과정이어서 주민등록번호 입력이 필요합니다."; // 고용보험 환급과정, 주민등록번호 필요 -11 else if ( p_jeyak == -12) msg = "<span class=\"text_orange\">" + p_subjnm + "</span>" + "과정은<br>특정 부서, 직급의 사람만이 수강신청이 가능한 과정입니다."; // 특정 부서, 직급 else if ( p_jeyak == -13) msg = "한달동안 교육받을 수 있는 과정수를 초과하여<br><span class=\"text_orange\">" + p_subjnm + "</span>" + "과정을<br>수강신청 하실 수 없습니다."; // 해당 교육월에 교육받을 수 있는 과정수 초과 else if ( p_jeyak == -14) msg = "<span class=\"text_orange\">" + p_subjnm + "</span>" + "과정은<br>이미 수료한 과정이므로 수강신청 하실 수 없습니다."; // 수료한과정은 다시 수강할 수 없음. else if ( p_jeyak == -15) msg = "<span class=\"text_orange\">" + p_subjnm + "</span>" + "과정은<br>이미 수강중인 과정입니다. "; // 미수료한과정은 다시 수강할 수 있음. 다른기수 수강중이면 신청할 수 없음. else if ( p_jeyak == -16) msg = "<span class=\"text_orange\">" + p_subjnm + "</span>" + "과정은<br>이미 수강신청하신 과정입니다. "; // 미수료한과정은 다시 수강할 수 있음. 다른기수 수강신청중이면 신청할 수 없음. else if ( p_jeyak == -17) msg = "단체 수강신청만 가능합니다. "; // 비계열사는 개별신청 불가능. else if ( p_jeyak == -18) msg = "대상직무만 신청할 수 있는 과정입니다."; else if ( p_jeyak == -20) msg = "수강신청과정중에 반려된과정이 있습니다.<br>운영장에게 문의하세요."; //else if ( p_jeyak == 7 ) msg = "<span class=\"text_orange\">" + p_subjnm + "</span>" + "과정은<br>현재 복습이 가능한 과정입니다.<br>다시 수강신청하시겠습니까?"; return msg; } /** 맛보기 로그 등록 @param box receive from the form object and session @return isOk 1:insert success,0:insert fail */ public int insertPreviewLog(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls = null; PreparedStatement pstmt = null; StringBuffer sbSQL = new StringBuffer(""); int isOk = 0; int v_seq = 0; String v_subj = box.getString("p_subj" ); String s_userid = box.getSession("userid" ); String tem_grcode = box.getStringDefault("tem_grcode", box.getSession("tem_grcode")); try { connMgr = new DBConnectionManager(); sbSQL.append(" select nvl(max(seq) + 1, 1) from tz_preview_log \n"); ls = connMgr.executeQuery(sbSQL.toString()); if ( ls.next() ) { v_seq = ls.getInt(1); } else { v_seq = 1; } ls.close(); sbSQL.setLength(0); sbSQL.append(" insert into tz_preview_log \n") .append(" ( seq \n") .append(" , addate \n") .append(" , subj \n") .append(" , userid \n") .append(" , luserid \n") .append(" , ldate \n") .append(" , grcode \n") .append(" ) values ( \n") .append(" ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" , ? \n") .append(" , ? \n") .append(" , to_char(sysdate,'yyyymmddhh24miss') \n") .append(" , ? \n") .append(" ) \n"); pstmt = connMgr.prepareStatement(sbSQL.toString()); pstmt.setInt (1, v_seq ); pstmt.setString(2, v_subj ); pstmt.setString(3, s_userid ); pstmt.setString(4, s_userid ); pstmt.setString(5, tem_grcode ); isOk = pstmt.executeUpdate(); } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e, box, ""); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return isOk; } /** 수강 신청을 위한 과정검색 @param box receive from the form object and session @return ArrayList 검색 결과 리스트 */ public ArrayList selectSubjForApply(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls1 = null; ArrayList list1 = null; // ArrayList list2 = null; DataBox dbox = null; StringBuffer sbSQL = new StringBuffer(""); //String gyear = box.getStringDefault("gyear",FormatDate.getDate("yyyy") ); // String gyear = box.getString("p_gyear"); String v_user_id = box.getSession("userid" ); // 개인의 회사 기준으로 과정 리스트 // String v_comp = box.getSession("comp" ); // 사이트의 GRCODE 로 과정 리스트 String v_grcode = box.getSession("tem_grcode" ); // String v_lsearch = box.getString ("p_lsearch" ); String v_lsearchtext = box.getString ("p_lsearchtext" ); String v_basis_upperclass = box.getString("p_basis_upperclass"); // int v_propstart = 0; // int v_propend = 0; // boolean ispossible = false; int v_pageno = box.getInt("p_pageno"); String ss_comp = box.getSession("comp"); try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); sbSQL.append(" select distinct a.subj \n") .append(" , a.scupperclass \n") .append(" , a.scmiddleclass \n") .append(" , a.isonoff \n") .append(" , b.classname \n") .append(" , a.subjnm \n") .append(" , a.edustart \n") .append(" , a.eduend \n") .append(" , a.studentlimit \n") .append(" , a.scyear \n") .append(" , a.scsubjseq \n") .append(" , a.propose_date \n") .append(" , a.usebook \n") .append(" , a.bookname \n") .append(" , (case when len(propstart) = 0 then propstart else substr(propstart, 0, 10) end) propstart\n") .append(" , (case when len(propend) = 0 then propend else substr(propend, 0, 10) end) propend \n") // .append(" , ( \n") // .append(" select substr(isnull(indate,'00000000000000'),0,4 ) \n") // .append(" from TZ_SUBJ \n") // .append(" where subj = a.subj \n") // .append(" ) indate \n") // .append(" , ( \n") // .append(" select isnull(avg(distcode1_avg), 0.0) \n") // .append(" from tz_suleach \n") // .append(" where subj = a.subj \n") // .append(" and grcode <> 'ALL' \n") // .append(" ) distcode1_avg \n") // .append(" , ( \n") // .append(" select isnull(avg(distcode_avg), 0.0) \n") // .append(" from tz_suleach \n") // .append(" where subj= a.subj \n") // .append(" and grcode = 'ALL' \n") // .append(" ) distcode_avg \n") .append(" , ( \n") .append(" select count(userid) CNTS \n") .append(" from tz_propose c \n") .append(" where c.subj = a.scsubj \n") .append(" and c.year = a.scyear \n") .append(" and c.subjseq = a.scsubjseq \n") .append(" ) proposecnt \n") .append(" , nvl(c.haspreviewobj, 'N') haspreviewobj \n") .append(" from ( \n") .append(" select tp.ldate propose_date, \n") .append(" tp.userid \n") .append(" , vs.* \n") .append(" , gr.comp \n") .append(" from vz_scsubjseq vs, tz_grcomp gr, tz_propose tp \n") .append(" where vs.grcode = gr.grcode \n") .append(" and vs.scsubj = tp.subj(+) \n") .append(" and vs.scyear = tp.year(+) \n") .append(" and vs.scsubjseq = tp.subjseq(+) \n") .append(" and tp.userid = " + SQLString.Format(v_user_id) + " \n") .append(" and gr.comp = " + SQLString.Format(ss_comp ) + " \n") .append(" and vs.isuse = 'Y' \n") .append(" and vs.subjvisible = 'Y' \n") .append(" and vs.isblended = 'N' \n") .append(" and vs.isexpert = 'N' \n") .append(" and substr(to_char(sysdate,'yyyymmddhh24miss'), 1, 10) between substr(propstart, 0, 10) and substr(eduend, 0, 10) \n") .append(" and nvl(tp.cancelkind, ' ') not in ('F', 'P') \n") .append(" ) a \n") .append(" ,( select upperclass \n") .append(" , middleclass \n") .append(" , classname \n") .append(" from tz_subjatt \n") .append(" where middleclass <> '000' \n") .append(" and lowerclass = '000' \n") .append(" ) b \n") .append(" , ( \n") .append(" select subj, (case when count(*)= 0 then 'N' else 'Y' end) haspreviewobj \n") .append(" from tz_previewobj \n") .append(" group by subj \n") .append(" ) c \n") .append(" where a.scupperclass = b.upperclass \n") .append(" and a.scmiddleclass = b.middleclass \n") .append(" and a.subj = c.subj(+) \n") .append(" and a.comp = " + SQLString.Format(ss_comp) + " \n") .append(" and a.isuse = 'Y' \n") .append(" and a.SEQVISIBLE = 'Y' \n") .append(" and substr(to_char(sysdate,'yyyymmddhh24miss'), 1, 10) between substr(propstart, 0, 10) and substr(a.eduend, 0, 10)\n"); //.append(" and a.gyear = " + SQLString.Format(gyear ) + " \n"); if( "global".equals(v_basis_upperclass) ) { sbSQL.append(" and a.scupperclass = 'A04' \n"); //sbSQL.append(" and a.contenttype != 'L' \n"); } else if( "common".equals(v_basis_upperclass) ) { sbSQL.append(" and a.scupperclass = 'A02' \n"); //sbSQL.append(" and a.contenttype != 'L' \n"); } else if( "future".equals(v_basis_upperclass) ) { sbSQL.append(" and a.scupperclass = 'A03' \n"); //sbSQL.append(" and a.contenttype != 'L' \n"); } else if( "cp".equals(v_basis_upperclass) ) { sbSQL.append(" and a.contenttype = 'L' \n"); } else { //business sbSQL.append(" and a.scupperclass = 'A01' \n"); //sbSQL.append(" and a.contenttype != 'L' \n"); } // ON/OFF 구분 /* if ( v_lsearch.equals("isonoff") ) { if ( v_lsearchtext.equals("온라인") ) { sbSQL.append(" and a.isonoff = 'ON' \n"); } else if ( v_lsearchtext.equals("오프라인") ) { sbSQL.append(" and a.isonoff = 'OFF' \n"); } else { sbSQL.append(" and a.isonoff like " + SQLString.Format( "%" + v_lsearchtext + "%" ) + " \n"); } } else if ( v_lsearch.equals("upperclass" )) { // 분류 sbSQL.append(" and upper(b.classname) like upper(" + SQLString.Format("%" + v_lsearchtext + "%") + ") \n"); } else */ //if ( v_lsearch.equals("subjnm" )) { // 과정명 if ( !"".equals(v_lsearchtext)) { // 과정명 sbSQL.append(" and upper(a.scsubjnm ) like upper(" + SQLString.Format("%" + v_lsearchtext + "%") + ") \n"); } //sbSQL.append(" order by propstart desc, isonoff desc, scupperclass, scmiddleclass, subjnm \n"); sbSQL.append(" order by propstart desc, isonoff, scupperclass, scmiddleclass, subjnm \n"); ls1 = connMgr.executeQuery(sbSQL.toString()); // ls1.setPageSize(15); // 페이지당 row 갯수를 세팅한다 // ls1.setCurrentPage(v_pageno); // 현재페이지번호를 세팅한다. // int total_page_count = ls1.getTotalPage(); // 전체 페이지 수를 반환한다 // int total_row_count = ls1.getTotalCount(); // 전체 row 수를 반환한다 MainSubjSearchBean bean = new MainSubjSearchBean(); while ( ls1.next() ) { dbox = ls1.getDataBox(); //// dbox.put("d_dispnum", new Integer(total_row_count - ls1.getRowNum() + 1)); //// dbox.put("d_totalpage", new Integer(total_page_count)); // box.put("d_rowcount", new Integer(15)); // dbox.put("distcode1_avg", new Double( ls1.getDouble("distcode1_avg" ))); // dbox.put("distcode_avg" , new Double( ls1.getDouble("distcode_avg" ))); dbox.put("d_ispropose", bean.getPropseStatus(box,ls1.getString("subj"), ls1.getString("scsubjseq"), ls1.getString("scyear"), v_user_id, "3")); list1.add(dbox); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sbSQL.toString()); throw new Exception("\n SQL : [\n" + sbSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return list1; } /** 수강신청을 위한 코스 @param box receive from the form object and session @return ArrayList 코스 리스트 */ public ArrayList selectCourseForApply(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls1 = null; ListSet ls2 = null; ArrayList list1 = null; ArrayList list2 = null; DataBox dbox = null; DataBox dbox2 = null; String sql = ""; String sql2 = ""; //String gyear = box.getStringDefault("gyear",FormatDate.getDate("yyyy") ); // String gyear = box.getString("p_gyear"); String v_user_id = box.getSession("userid" ); // 개인의 회사 기준으로 과정 리스트 // String v_comp = box.getSession("comp" ); // 사이트의 GRCODE 로 과정 리스트 String v_grcode = box.getSession("tem_grcode" ); // String v_lsearch = box.getString ("p_lsearch" ); String v_lsearchtext = box.getString ("p_lsearchtext" ); String v_basis_upperclass = box.getString("p_basis_upperclass"); // int v_propstart = 0; // int v_propend = 0; // boolean ispossible = false; int v_pageno = box.getInt("p_pageno"); String ss_comp = box.getSession("comp"); try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); list2 = new ArrayList(); sql ="select a.course, a.cyear, a.courseseq, max(coursenm) coursenm, max(edustart) edustart, max(eduend) eduend, max(propstart) propstart, max(propend) propend \n" + " , case when sum(cnts) > 0 then 'Y' else 'N' end ispropose, max(propose_date) propose_date \n" + "from vz_scsubjseq a, ( \n" + " select x.course, x.cyear, x.courseseq, max(y.ldate) propose_date, count(y.userid) CNTS \n" + " from vz_scsubjseq x, tz_propose y \n" + " where x.subj = y.subj(+) \n" + " and x.year = y.year(+) \n" + " and x.subjseq = y.subjseq(+) \n" + " and nvl(y.cancelkind, ' ') NOT IN ('F', 'P') \n" + " and y.userid = " + SQLString.Format(v_user_id) + " \n" + " and substr(to_char(sysdate,'yyyymmddhh24miss'), 1, 10) between substr(propstart, 0, 10) and substr(eduend, 0, 10) \n" + " and x.course !='000000' \n" // + " and grcode = " + StringManager.makeSQL(v_grcode) + " \n" + " and isuse = 'Y' \n" + " and subjvisible = 'Y' \n" + " group by x.course, x.cyear, x.courseseq \n" + ") b, tz_grcomp c \n" + "where a.course != '000000' \n" + "and substr(to_char(sysdate,'yyyymmddhh24miss'), 1, 10) between substr(propstart, 0, 10) and substr(eduend, 0, 10) \n" + "and a.grcode = c.grcode \n" + "and c.comp = " + SQLString.Format(ss_comp) + " \n" + "and isuse = 'Y' \n" + "and seqvisible = 'Y' \n" + "and a.course = b.course \n" + "and a.cyear = b.cyear \n" + "and a.courseseq = b.courseseq \n" + "group by a.course, a.cyear, a.courseseq \n"; ls1 = connMgr.executeQuery(sql); while ( ls1.next() ) { dbox = ls1.getDataBox(); sql2 = "select subj, year, subjseq, subjnm, isonoff \n" + "from vz_scsubjseq \n" + "where course = " + SQLString.Format(ls1.getString("course") ) + " \n" + "and cyear = " + SQLString.Format(ls1.getString("cyear")) + " \n" + "and courseseq = " + SQLString.Format(ls1.getString("courseseq")) + "\n"; ls2 = connMgr.executeQuery(sql2); while(ls2.next()) { dbox2 = ls2.getDataBox(); list2.add(dbox2); } dbox.put("subjList", list2); list2 = new ArrayList(); list1.add(dbox); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return list1; } /** 배송지 정보 @param box receive from the form object and session @return */ public DataBox selectDeliveryInfo(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls = null; String sql = ""; String ss_userid = box.getSession("userid"); String v_subj = box.getString("p_subj"); String v_year = box.getString("p_year"); String v_subjseq = box.getString("p_subjseq"); try { connMgr = new DBConnectionManager(); /* sql = "select b.userid, b.name, a.delivery_handphone \n" + " , a.delivery_post1, a.delivery_post2, a.delivery_address1 \n" + " , b.handphone, b.zip_cd, b.address \n" + " , get_compnm(b.comp) companynm \n" + " , b.position_nm as deptnm \n" + " , b.lvl_nm as jikwinm \n" + "from tz_delivery a, tz_member b \n" + "where a.userid = b.userid \n" + "and a.subj = " + StringManager.makeSQL(v_subj) + " \n" + "and a.year = " + StringManager.makeSQL(v_year) + " \n" + "and a.subjseq = " + StringManager.makeSQL(v_subjseq) + " \n" + "and a.userid = " + StringManager.makeSQL(ss_userid) + " \n"; */ sql = "select b.userid, b.name, a.delivery_handphone \n" + " , a.delivery_post1, a.delivery_post2, a.delivery_address1 \n" + " , b.handphone, b.zip_cd, b.address \n" + " , get_compnm(b.comp) companynm \n" + " , b.position_nm as deptnm \n" + " , b.lvl_nm as jikwinm \n" + "from tz_delivery a, tz_member b \n" + "where a.userid = b.userid \n" + "and a.userid = " + StringManager.makeSQL(ss_userid) + " \n" + "and a.ldate = (select max(ldate) from tz_delivery where userid = " + StringManager.makeSQL(ss_userid) + ") \n" + "and rownum = 1 \n"; ls = connMgr.executeQuery(sql); if ( ls.next() ) { dbox = ls.getDataBox(); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e, box, ""); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return dbox; } /** 배송지 정보 @param box receive from the form object and session @return */ public DataBox selectMemberInfo(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls = null; String sql = ""; String ss_userid = box.getSession("userid"); try { connMgr = new DBConnectionManager(); sql = "select b.userid, b.name \n" + " , b.handphone, b.zip_cd, b.address \n" + " , get_compnm(b.comp) companynm \n" + " , b.position_nm as deptnm \n" + " , b.lvl_nm as jikwinm \n" + "from tz_member b \n" + "where userid = " + StringManager.makeSQL(ss_userid) + " \n"; ls = connMgr.executeQuery(sql); if ( ls.next() ) { dbox = ls.getDataBox(); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e, box, ""); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return dbox; } /** 배송지 정보 수정 @param box receive from the form object and session @return isOk */ public int UpdateDelivery(RequestBox box) throws Exception { DBConnectionManager connMgr = null; PreparedStatement pstmt = null; String sql = ""; int isOk = 0; String ss_userid = box.getSession("userid"); try { connMgr = new DBConnectionManager(); connMgr.setAutoCommit(false); sql = "delete from TZ_DELIVERY \n" + "where subj = ? \n" + "and year = ? \n" + "and subjseq = ? \n" + "and userid = ? \n"; pstmt = connMgr.prepareStatement(sql); pstmt.setString(1, box.getString("p_subj")); pstmt.setString(2, box.getString("p_year")); pstmt.setString(3, box.getString("p_subjseq")); pstmt.setString(4, ss_userid); isOk = pstmt.executeUpdate(); if(pstmt != null) { try { pstmt.close(); } catch (Exception e) {} } sql = "insert into tz_delivery( " + " subj " + " , year " + " , subjseq " + " , userid " + " , delivery_post1 " + " , delivery_post2 " + " , delivery_address1 " + " , delivery_address2 " + " , delivery_handphone " + " , luserid " + " , ldate " + " ) " + "values(? " + " , ? " + " , ? " + " , ? " + " , ? " + " , ? " + " , ? " + " , ? " + " , ? " + " , ? " + " , to_char(sysdate, 'yyyymmddhh24miss') " + " ) "; pstmt = connMgr.prepareStatement(sql); pstmt.setString(1, box.getString("p_subj")); pstmt.setString(2, box.getString("p_year")); pstmt.setString(3, box.getString("p_subjseq")); pstmt.setString(4, ss_userid); pstmt.setString(5, box.getString("p_post1")); pstmt.setString(6, box.getString("p_post2")); pstmt.setString(7, box.getString("p_address1")); if("".equals(box.getString("p_post1"))) { pstmt.setString(8, box.getString("p_address")); } else { pstmt.setString(8, box.getString("p_address2")); } pstmt.setString(9, box.getString("p_delivery_handphone")); pstmt.setString(10, ss_userid); isOk = pstmt.executeUpdate(); if ( isOk > 0) { if ( connMgr != null ) { try { connMgr.commit(); } catch ( Exception e ) { } } } else { if ( connMgr != null ) { try { connMgr.rollback(); } catch ( Exception e ) { } } } } catch(Exception ex) { isOk = 0; if ( connMgr != null ) { try { connMgr.rollback(); } catch ( Exception e10 ) { } } ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage()); } finally { if(pstmt != null) { try { pstmt.close(); } catch (Exception e) {} } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return isOk; } /** 개월차 도서 @param box receive from the form object and session @return ArrayList */ public ArrayList selectMonthlyBookList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls = null; ListSet ls2 = null; ArrayList list = null; ArrayList list2 = null; String sql = ""; String sql2 = ""; DataBox dbox = null; String v_subj = box.getString("p_subj" ); String ss_userid = box.getSession("userid"); String v_year = box.getString("p_year"); String v_subjseq = box.getString("p_subjseq"); try { connMgr = new DBConnectionManager(); list = new ArrayList(); list2 = new ArrayList(); sql = "select subj, month \n" + "from tz_subjbook \n" + "where subj = " + StringManager.makeSQL(v_subj) + " \n" + "group by subj, month \n" + "order by subj, month \n"; ls = connMgr.executeQuery(sql); //System.out.println("sql:"+sql); while ( ls.next() ) { dbox = ls.getDataBox(); sql2 = "select a.subj, a.month, b.bookname, author, b.bookcode \n" + " , ( \n" + " select (case when count(*) > 0 then 'Y' else 'N' end) \n" + " from tz_proposebook \n" + " where subj = a.subj \n" + " and userid = " + StringManager.makeSQL(ss_userid) + " \n" + " and month = a.month \n" + " and bookcode = a.bookcode \n" + " and year = " + StringManager.makeSQL(v_year) + " \n" + " and subjseq = " + StringManager.makeSQL(v_subjseq) + " \n" + ") checkgubun \n" + " , ( \n" + " nvl(( select distinct 'Y' \n" + " from tz_proposebook \n" + " where subj = a.subj \n" + " and year = " + StringManager.makeSQL(v_year) + " \n" + " and subjseq = " + StringManager.makeSQL(v_subjseq) + " \n" + " and userid = " + StringManager.makeSQL(ss_userid) + " \n" + " ),'N') ) disablegubun \n" + "from tz_subjbook a, tz_bookinfo b \n" // 독서 과정별 도서 변경관련 임시 추가... and nvl(a.use_yn,'Y')='Y' + "where a.bookcode = b.bookcode and nvl(a.use_yn,'Y')='Y' \n" + "and a.subj = " + StringManager.makeSQL(ls.getString("subj")) + " \n" + "and a.month = " + SQLString.Format(ls.getString("month")) + " \n"; //System.out.println("sql2:"+sql2); ls2 = connMgr.executeQuery(sql2); while(ls2.next()) { DataBox dbox2 = ls2.getDataBox(); list2.add(dbox2); } dbox.put("d_bookinfo", list2); list2 = new ArrayList(); list.add(dbox); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( ls2 != null ) { try { ls2.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return list; } /** 도서 정보 @param box receive from the form object and session @return ProposeCourseData */ public DataBox selectBookInfo(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls1 = null; String sql = ""; int v_bookcode = box.getInt("p_bookcode"); try { connMgr = new DBConnectionManager(); sql = "select bookcode, bookname, author, publisher, price, core_contents, book_contents, realfile, savefile, refbook1, refbook2, bookimgurl \n" + "from tz_bookinfo \n" + "where bookcode = " + SQLString.Format(v_bookcode) + " \n"; ls1 = connMgr.executeQuery(sql); if ( ls1.next() ) { dbox = ls1.getDataBox(); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e, box, ""); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return dbox; } /** 과정 상세에서 수강신청 받을 수 있는 목록 @param box receive from the form object and session @return ProposeCourseData */ public ArrayList selectEduList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls1 = null; ArrayList list1 = null; String sql = ""; String v_subj = box.getString("p_subj"); String ss_userid = box.getSession("userid"); String ss_comp = box.getSession("comp"); try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); sql = "select a.subj, a.year, a.subjseq, a.subjnm, b.appdate propose_date \n" + " , a.edustart, a.eduend, a.propstart, a.propend, a.isonoff, usebook, bookname \n" + "from vz_scsubjseq a, tz_propose b \n" + "where a.subj = b.subj(+) \n" + "and a.year = b.year(+) \n" + "and a.subjseq = b.subjseq(+) \n" + "and b.userid= " + StringManager.makeSQL(ss_userid) + " \n" + "and substr(to_char(sysdate,'yyyymmddhh24miss'), 1, 10) between substr(propstart, 0, 10) and substr(propend, 0, 10) \n" + "and a.subj = " + StringManager.makeSQL(v_subj) + " \n" + "and grcode in ( select grcode from tz_grcomp where comp = " + StringManager.makeSQL(ss_comp) + ") \n" + "and isuse = 'Y' \n" + "and seqvisible = 'Y' \n"; ls1 = connMgr.executeQuery(sql); while ( ls1.next() ) { dbox = ls1.getDataBox(); list1.add(dbox); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return list1; } /** * 이미 수료한 과정이면 수강신청 안됨. * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, -14 : 안됨 */ public int jeyakIsgraduated(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { ListSet ls = null; String sql = ""; int result = 0; try { sql = "\n select decode(sign(count(*)),1,'N','Y') as gu " + "\n from tz_stold " + "\n where subj = " + SQLString.Format(p_subj) + "\n and userid = " + SQLString.Format(p_userid) + "\n and isgraduated = 'Y'"; ls = connMgr.executeQuery(sql); if ( ls.next() ) { if ( "N".equals(ls.getString("gu"))) result = -14; } } catch ( SQLException e ) { result = -14; ErrorManager.getErrorStackTrace(e, null, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception ex ) { result = -14; ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 다른기수를 학습하고 있는 과정이면 수강신청 안됨. * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, -15 : 안됨 */ public int jeyakStudentYn(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { ListSet ls = null; String sql = ""; int result = 0; try { sql = "\n select decode(sign(count(*)),1,'N','Y') as gu " + "\n from tz_student a " + "\n , (select subj " + "\n , year " + "\n , subjseq " + "\n , userid " + "\n from tz_stold " + "\n where isgraduated = 'N' " + "\n and subj = " + SQLString.Format(p_subj) + "\n and userid = " + SQLString.Format(p_userid) + ") b " + "\n where a.subj = " + SQLString.Format(p_subj) + "\n and a.userid = " + SQLString.Format(p_userid) + "\n and a.subj = b.subj(+) " + "\n and a.year = b.year(+) " + "\n and a.subjseq = b.subjseq(+) " + "\n and a.userid = b.userid(+) " + "\n and b.userid is null "; ls = connMgr.executeQuery(sql); if ( ls.next() ) { if ( "N".equals(ls.getString("gu"))) result = -15; } } catch ( SQLException e ) { result = -15; ErrorManager.getErrorStackTrace(e, null, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception ex ) { result = -15; ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 다른기수를 신청한 과정이면 수강신청 안됨. * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, -16 : 안됨 */ public int jeyakProposeYn(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { ListSet ls = null; String sql = ""; int result = 0; try { if ( GetCodenm.chkIsSubj(connMgr,p_subj).equals("S")){ sql = "\n select decode(sign(count(*)),1,'N','Y') as gu " + "\n from tz_propose a " + "\n , (select subj " + "\n , year " + "\n , subjseq " + "\n , userid " + "\n from tz_stold " + "\n where isgraduated = 'N' " + "\n and subj = " + SQLString.Format(p_subj) + "\n and userid = " + SQLString.Format(p_userid) + ") b " + "\n where a.subj = " + SQLString.Format(p_subj) + "\n and a.userid = " + SQLString.Format(p_userid) + "\n and a.subj = b.subj(+) " + "\n and a.year = b.year(+) " + "\n and a.subjseq = b.subjseq(+) " + "\n and a.userid = b.userid(+) " + "\n and b.userid is null " + "\n and a.chkfinal != 'N' "; } else { sql = "select decode(sign(count(*)),1,'N','Y') as gu \n" + "from tz_propose a \n" + "where exists ( \n" + " select 'X' \n" + " from vz_scsubjseq b \n" + " where a.subj = b.subj \n" + " and a.year = b.year \n" + " and a.subjseq = b.subjseq \n" + " and course =" + SQLString.Format(p_subj ) + " and cyear =" + SQLString.Format(p_year ) + " and courseseq = " + SQLString.Format(p_subjseq) + " and userid = " + SQLString.Format(p_userid ) + ") \n" + "and a.chkfinal != 'N' \n"; //System.out.println("sql====\n"+sql); } ls = connMgr.executeQuery(sql); if ( ls.next() ) { if ( "N".equals(ls.getString("gu"))) result = -16; } } catch ( SQLException e ) { result = -16; ErrorManager.getErrorStackTrace(e, null, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception ex ) { result = -16; ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 비계열사는 개인별 수강신청 안됨. * @param connMgr DBConnectionManager * @param p_subj 과정코드 * @param p_year 과정년도 * @param p_subjseq 과정기수 * @param p_userid 유저아이디 * @param p_comp 회사코드 * @return result 0 : 정상, -17 : 안됨 */ public int jeyakCompYn(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, String p_userid, String p_comp) throws Exception { ListSet ls = null; String sql = ""; int result = 0; try { sql = "\n select decode(sign(count(*)),1,'N','Y') as gu " + "\n from tz_member a, tz_compclass b " + "\n where a.userid = " + SQLString.Format(p_userid) + "\n and a.comp = b.comp " + "\n and b.gubun = '3' "; ls = connMgr.executeQuery(sql); if ( ls.next() ) { if ( "N".equals(ls.getString("gu"))) result = -17; } } catch ( SQLException e ) { result = -17; ErrorManager.getErrorStackTrace(e, null, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception ex ) { result = -17; ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } /** * 직무제한된 과정일 경우 해당 직무인 사람만 신청가능 * @param connMgr * @param p_subj * @param p_year * @param p_subjseq * @param p_userid * @return * @throws Exception */ public int jeyakJikmu(DBConnectionManager connMgr, String p_subj, String p_year, String p_userid) throws Exception { ListSet ls = null; String sql = ""; int result = 0; String v_limit = "N"; try { sql = "\n select nvl(jikmu_limit,'N') as limit " + "\n from tz_subj " + "\n where subj = " + StringManager.makeSQL(p_subj); ls = connMgr.executeQuery(sql); if ( ls.next() ) { v_limit = ls.getString("limit"); } if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ("Y".equals(v_limit)) { sql = "\n select decode(sign(count(*)),1,'Y','N') as gu " + "\n from tz_subjjikmu t1 " + "\n , tz_member t2 " + "\n where t1.job_cd = t2.job_cd " + "\n and t1.subj = " + StringManager.makeSQL(p_subj) + "\n and t1.year = " + StringManager.makeSQL(p_year) + "\n and t2.userid = " + StringManager.makeSQL(p_userid); ls = connMgr.executeQuery(sql); if ( ls.next() ) { if ( "N".equals(ls.getString("gu"))) result = -18; } } } catch ( SQLException e ) { result = -18; ErrorManager.getErrorStackTrace(e, null, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception ex ) { result = -18; ex.printStackTrace(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } return result; } public ArrayList selectAttendCd(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls = null; ListSet ls1 = null; ArrayList list1 = null; StringBuffer strSQL = null; String sql=""; String v_subj = box.getString("p_subj"); String v_subjseq = box.getString("p_subjseq"); String ss_userid = box.getSession("userid"); String ss_comp = box.getSession("comp"); String v_edustart = box.getString("p_edustart"); String v_eduend = box.getString("p_eduend"); String v_neweroom =""; String v_neweroom2 =""; String v_neweroom3 [] = null; try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); sql ="select neweroom from tz_subjseq where subj ='"+v_subj+"' and subjseq='"+v_subjseq+"' and edustart='"+v_edustart+"' and eduend='"+v_eduend+"' "; System.out.println("sql======>"+sql); ls = connMgr.executeQuery(sql); if ( ls.next() ) { v_neweroom = ls.getString(1); } ls.close(); if(!"".equals(v_neweroom)){ v_neweroom2 = v_neweroom.substring(0,(v_neweroom.length()-1)); } if("".equals(v_neweroom)){ strSQL = new StringBuffer(); strSQL.append("\n select '['||low_edumin||']'||school_nm codenm, seq code ") ; strSQL.append("\n from TZ_ATTEND_CD ") ; strSQL.append("\n where ISUSE = 'Y' ") ; if(!"0008".equals(v_subjseq) && !"0009".equals(v_subjseq)){ // 8,9기일때만 순천금당중학교 리스트 뿌려주도록 2010-05-18 strSQL.append("\n and seq <> 50 ") ; } strSQL.append("\n order by seq ") ; System.out.println("---------고사장1---" +strSQL.toString() ); ls1 = connMgr.executeQuery(strSQL.toString()); while ( ls1.next() ) { dbox = ls1.getDataBox(); list1.add(dbox); } }else{ strSQL = new StringBuffer(); strSQL.append("\n select '['||low_edumin||']'||school_nm codenm, seq code ") ; strSQL.append("\n from TZ_ATTEND_CD ") ; strSQL.append("\n where ISUSE = 'Y' ") ; strSQL.append("\n and seq in ("+v_neweroom2+" ) "); strSQL.append("\n order by seq ") ; ls1 = connMgr.executeQuery(strSQL.toString()); System.out.println("---------고사장2---" +strSQL.toString() ); while ( ls1.next() ) { dbox = ls1.getDataBox(); list1.add(dbox); } } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, strSQL.toString()); throw new Exception("\n SQL : [\n" + strSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return list1; } public String MakeOrderNo(RequestBox box) throws Exception{ DBConnectionManager connMgr = null; ListSet ls1 = null; String sql = ""; String order_id = ""; try { connMgr = new DBConnectionManager(); //밀리세컨드까지를 아이디로 본다.. sql = "SELECT TO_CHAR(SYSTIMESTAMP,'YYYYMMDDHH24MISSFF') AS ORDER_ID FROM DUAL "; ls1 = connMgr.executeQuery(sql); if( ls1.next() ) { order_id = ls1.getString("order_id"); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e, box, ""); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return order_id; } public int insertPGData(RequestBox box) throws Exception{ DBConnectionManager connMgr = null; PreparedStatement pstmt = null; String strSQL = ""; int isOk = 0; String p_oid = box.getString("p_oid");//주문번호 String p_userid = box.getString("p_userid");//아이디 String p_subj = box.getString("p_subj");//과목코드 String p_subjseq = box.getString("p_subjseq");//차수 String p_pay_sel = box.getString("p_pay_sel");//결제방법 String p_tid = box.getString("p_tid");//거래번호 String p_amount = box.getString("p_amount");//금액 String p_cardnumber = box.getString("p_cardnumber");//카드번호 String p_financename = box.getString("p_financename");//카드종류(이름) String p_cardperiod = box.getString("p_cardperiod");//할부개월수 String p_financecode = box.getString("p_financecode");//카드종류(숫자) String p_authnumber = box.getString("p_authnumber");//승인번호 //승인일자 String p_respcode = box.getString("p_respcode");//응답코드 //결제년도 // System.out.println("##################################################################################"); // System.out.println("##################################################################################"); // System.out.println("##################################################################################"); // System.out.println("##################################################################################"); // System.out.println("##################################################################################"); // System.out.println("p_oid ::::::"+p_oid ); // System.out.println("p_userid ::::::"+p_userid ); // System.out.println("p_subj ::::::"+p_subj ); // System.out.println("p_subjseq ::::::"+p_subjseq ); // System.out.println("p_pay_sel ::::::"+p_pay_sel ); // System.out.println("p_tid ::::::"+p_tid ); // System.out.println("p_amount ::::::"+p_amount ); // System.out.println("p_cardnumber ::::::"+p_cardnumber ); // System.out.println("p_financename ::::::"+p_financename ); // System.out.println("p_cardperiod ::::::"+p_cardperiod ); // System.out.println("p_financecode ::::::"+p_financecode ); // System.out.println("p_authnumber ::::::"+p_authnumber ); // System.out.println("p_respcode ::::::"+p_respcode ); // System.out.println("##################################################################################"); // System.out.println("##################################################################################"); // System.out.println("##################################################################################"); // System.out.println("##################################################################################"); int preIdx = 1; try { connMgr = new DBConnectionManager(); strSQL = " insert into pa_payment(" + " order_id,userid,leccode,lecnumb,type," + " transaction_id,amount,card_no,card_nm, card_period," + " card_type,auth_no, auth_date,response_code,year ) " + " values(?,?,?,?,?," + " ?,?,?,?,?," + " ?,?,to_char(sysdate,'yyyymmddhh24miss'),?,to_char(sysdate,'yyyy'))"; pstmt = connMgr.prepareStatement(strSQL.toString()); preIdx = 1; pstmt.setString(preIdx++, p_oid); pstmt.setString(preIdx++, p_userid); pstmt.setString(preIdx++, p_subj); pstmt.setString(preIdx++, p_subjseq); pstmt.setString(preIdx++, p_pay_sel); pstmt.setString(preIdx++, p_tid); pstmt.setString(preIdx++, p_amount); pstmt.setString(preIdx++, p_cardnumber); pstmt.setString(preIdx++, p_financename); pstmt.setString(preIdx++, p_cardperiod); pstmt.setString(preIdx++, p_financecode); pstmt.setString(preIdx++, p_authnumber); pstmt.setString(preIdx++, p_respcode); isOk = pstmt.executeUpdate(); } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, strSQL.toString()); throw new Exception("sql = " + strSQL.toString() + "\r\n" + ex.getMessage() ); } finally { if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.setAutoCommit(true); connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return isOk; } public DataBox selectAttendInfo(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls1 = null; String sql = ""; String v_subj = box.getString("p_subj"); String v_year = box.getString("p_year"); String v_subjseq = box.getString("p_subjseq"); String s_userid = box.getSession("userid"); try { connMgr = new DBConnectionManager(); sql = "select lec_sel_no, is_attend \n" + " from tz_propose \n" + "where subj = "+StringManager.makeSQL(v_subj)+" \n" + " and year = "+StringManager.makeSQL(v_year)+" \n" + " and subjseq = "+StringManager.makeSQL(v_subjseq)+" \n" + " and userid = "+StringManager.makeSQL(s_userid)+" \n"; ls1 = connMgr.executeQuery(sql); while ( ls1.next() ) { dbox = ls1.getDataBox(); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, sql); throw new Exception("\n SQL : [\n" + sql + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e, box, ""); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return dbox; } public ArrayList selectPayCd(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls1 = null; ArrayList list1 = null; StringBuffer strSQL = null; String v_user_id = box.getSession("userid"); String v_subj = box.getString("p_subj"); String v_year = box.getString("p_year"); String v_subjseq = box.getString("p_subjseq"); try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); strSQL = new StringBuffer(); strSQL.append("\n select order_id,leccode,type,lecnumb,TRANSACTION_ID from pa_payment where userid="+StringManager.makeSQL(v_user_id)+" and leccode="+StringManager.makeSQL(v_subj)+" and year="+StringManager.makeSQL(v_year)+" ") ; ls1 = connMgr.executeQuery(strSQL.toString()); System.out.println(strSQL); while ( ls1.next() ) { dbox = ls1.getDataBox(); list1.add(dbox); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, strSQL.toString()); throw new Exception("\n SQL : [\n" + strSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return list1; } public int UpdateSubjPropose(RequestBox box) throws Exception { DBConnectionManager connMgr = null; PreparedStatement pstmt = null; StringBuffer strSQL = null; int isOk = 0; String v_subj = box.getString("p_subj"); String v_year = box.getString("p_year"); String v_subjseq = box.getString("p_subjseq"); String v_lec_sel_no = box.getString("p_lec_sel_no"); String v_is_attend = box.getString("p_is_attend"); String s_userid = box.getSession("userid"); int preIdx = 1; try { connMgr = new DBConnectionManager(); connMgr.setAutoCommit(false); strSQL = new StringBuffer(); strSQL.append(" update tz_propose set lec_sel_no = ? "); strSQL.append(" , is_attend = ? "); strSQL.append(" , is_attend_dt = to_char(sysdate, 'YYYYDDMMHH24MISS') "); strSQL.append(" where subj = ? "); strSQL.append(" and year = ? "); strSQL.append(" and subjseq = ? "); strSQL.append(" and userid = ? "); pstmt = connMgr.prepareStatement(strSQL.toString()); preIdx = 1; pstmt.setString(preIdx++, v_lec_sel_no); pstmt.setString(preIdx++, v_is_attend); pstmt.setString(preIdx++, v_subj); pstmt.setString(preIdx++, v_year); pstmt.setString(preIdx++, v_subjseq); pstmt.setString(preIdx++, s_userid); isOk = pstmt.executeUpdate(); } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, strSQL.toString()); throw new Exception("sql = " + strSQL.toString() + "\r\n" + ex.getMessage() ); } finally { if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.setAutoCommit(true); connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return isOk; } public int UpdateLecselOn(RequestBox box) throws Exception { DBConnectionManager connMgr = null; PreparedStatement pstmt = null; StringBuffer strSQL = null; int isOk = 0; String v_subj = box.getString("p_subj"); String v_year = box.getString("p_year"); String v_subjseq = box.getString("p_subjseq"); String v_lec_sel_no = box.getString("p_lec_sel_no"); String v_is_attend = box.getString("p_is_attend"); String s_userid = box.getSession("userid"); int preIdx = 1; try { connMgr = new DBConnectionManager(); connMgr.setAutoCommit(false); strSQL = new StringBuffer(); strSQL.append(" update tz_propose set lec_sel_no = ? "); strSQL.append(" , is_attend = ? "); strSQL.append(" , is_attend_dt = to_char(sysdate, 'YYYYDDMMHH24MISS') "); strSQL.append(" where subj = ? "); strSQL.append(" and year = ? "); strSQL.append(" and subjseq = ? "); strSQL.append(" and userid = ? "); pstmt = connMgr.prepareStatement(strSQL.toString()); preIdx = 1; pstmt.setString(preIdx++, v_lec_sel_no); pstmt.setString(preIdx++, v_is_attend); pstmt.setString(preIdx++, v_subj); pstmt.setString(preIdx++, v_year); pstmt.setString(preIdx++, v_subjseq); pstmt.setString(preIdx++, s_userid); isOk = pstmt.executeUpdate(); } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, strSQL.toString()); throw new Exception("sql = " + strSQL.toString() + "\r\n" + ex.getMessage() ); } finally { if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.setAutoCommit(true); connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return isOk; } public int UpdateStatus(RequestBox box) throws Exception { DBConnectionManager connMgr = null; PreparedStatement pstmt = null; StringBuffer strSQL = null; int isOk = 0; String v_subj = box.getString("p_subj"); String v_year = box.getString("p_year"); String v_subjseq = box.getString("p_subjseq"); String s_userid = box.getSession("userid"); int preIdx = 1; try { connMgr = new DBConnectionManager(); connMgr.setAutoCommit(false); strSQL = new StringBuffer(); strSQL.append(" update TZ_BOOKDELIVERY "); strSQL.append(" set DELIVERY_STATUS='F' "); strSQL.append(" where subj = ? "); strSQL.append(" and year = ? "); strSQL.append(" and subjseq = ? "); strSQL.append(" and userid = ? "); pstmt = connMgr.prepareStatement(strSQL.toString()); preIdx = 1; pstmt.setString(preIdx++, v_subj); pstmt.setString(preIdx++, v_year); pstmt.setString(preIdx++, v_subjseq); pstmt.setString(preIdx++, s_userid); isOk = pstmt.executeUpdate(); } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, strSQL.toString()); throw new Exception("sql = " + strSQL.toString() + "\r\n" + ex.getMessage() ); } finally { if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.setAutoCommit(true); connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return isOk; } public ArrayList selectCashPrint(RequestBox box) throws Exception { DBConnectionManager connMgr = null; DataBox dbox = null; ListSet ls1 = null; ArrayList list1 = null; StringBuffer strSQL = null; String ss_userid = box.getSession("userid"); String v_subj = box.getString("p_subj"); String v_year = box.getString("p_year"); String v_subjseq = box.getString("p_subjseq"); try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); strSQL = new StringBuffer(); strSQL.append("\n select "); strSQL.append("\n (select mm.name from tz_member mm where tst.userid = mm.userid) as uname "); strSQL.append("\n ,(select mm.user_path from tz_member mm where tst.userid = mm.userid) as upass "); strSQL.append("\n ,(select fn_crypt('2', mm.birth_date, 'knise') birth_date from tz_member mm where tst.userid = mm.userid) as ujumin "); strSQL.append("\n ,tsj.subjnm "); //strSQL.append("\n ,(select proptxt from tz_propose p where tst.subj = p.subj and tst.year = p.year and tst.subjseq = p.subjseq and tst.userid = p.userid) as lecselno "); strSQL.append("\n ,substr(tsj.subjclass,0,3) subjclassnm "); strSQL.append("\n ,tsj.biyong "); strSQL.append("\n ,tss.edustart, tss.eduend "); strSQL.append("\n ,(select appdate from tz_propose p where tst.subj = p.subj and tst.year = p.year and tst.subjseq = p.subjseq and tst.userid = p.userid) as appdate "); strSQL.append("\n ,(select mm.cert from tz_member mm where tst.userid = mm.userid) as cert "); strSQL.append("\n from tz_student tst, tz_subj tsj, vz_scsubjseq tss "); strSQL.append("\n where tst.subj = "+StringManager.makeSQL(v_subj)+" "); strSQL.append("\n and tst.subjseq = "+StringManager.makeSQL(v_subjseq)+" "); strSQL.append("\n and tst.year = "+StringManager.makeSQL(v_year)+" "); strSQL.append("\n and tst.userid = "+StringManager.makeSQL(ss_userid)+" "); strSQL.append("\n and tst.subj = tsj.subj "); strSQL.append("\n and tst.subj = tss.subj "); strSQL.append("\n and tst.year = tss.year "); strSQL.append("\n and tst.subjseq = tss.subjseq "); strSQL.append("\n order by tss.course, tss.edustart desc , tss.subjnm "); //System.out.println("===>영수증\n"+strSQL.toString()); ls1 = connMgr.executeQuery(strSQL.toString()); while ( ls1.next() ) { dbox = ls1.getDataBox(); list1.add(dbox); } } catch ( SQLException e ) { ErrorManager.getErrorStackTrace(e, box, strSQL.toString()); throw new Exception("\n SQL : [\n" + strSQL.toString() + "]\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } catch ( Exception e ) { ErrorManager.getErrorStackTrace(e); throw new Exception("\n e.getMessage() : [\n" + e.getMessage() + "\n]"); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return list1; } //결제 승인시 수강승인처리 되도록 public int updateApprovalData(RequestBox box) throws Exception { DBConnectionManager connMgr = null; PreparedStatement pstmt = null; String sql = ""; int isOk = 0; String v_subj = box.getString("p_subj"); String v_year = box.getString("p_year"); String v_subjseq = box.getString("p_subjseq"); String v_userid = box.getString("p_userid"); String v_comp = box.getString("p_comp"); int preIdx = 1; try { connMgr = new DBConnectionManager(); connMgr.setAutoCommit(false); PreparedStatement pstmt1 = null; //신청 테이블 먼저 업데이트 sql =" update tz_propose set chkfinal = 'Y', ldate=to_char(sysdate,'yyyymmddhh24miss'), luserid= ? "; sql+=" where subj= ? and year = ? and subjseq = ? and userid = ? "; pstmt1 = connMgr.prepareStatement(sql); int index = 1; pstmt1.setString(index++, v_userid); pstmt1.setString(index++, v_subj); pstmt1.setString(index++, v_year); pstmt1.setString(index++, v_subjseq); pstmt1.setString(index++, v_userid); isOk = pstmt1.executeUpdate(); //북테이블도 업뎃 if(isOk > 0){ sql =" update TZ_PROPOSEBOOK set status = 'W' "; sql+=" where subj= ? and year = ? and subjseq = ? and userid = ? "; pstmt1 = connMgr.prepareStatement(sql); index = 1; pstmt1.setString(index++, v_subj); pstmt1.setString(index++, v_year); pstmt1.setString(index++, v_subjseq); pstmt1.setString(index++, v_userid); pstmt1.executeUpdate(); } //student 테이블 insert if(isOk > 0){ sql ="insert into tz_student ( " ; sql +=" subj, year, subjseq, userid, "; sql +=" class, comp, isdinsert, score, "; sql +=" tstep, mtest, ftest, report, "; sql +=" act, etc1, etc2, avtstep, "; sql +=" avmtest, avftest, avreport, avact, "; sql +=" avetc1, avetc2, isgraduated, isrestudy, "; sql +=" isb2c, edustart, eduend, branch, "; sql +=" confirmdate, eduno, luserid, ldate, "; sql +=" stustatus ) "; sql +=" values ( "; sql +=" ?, ?, ?, ?, "; sql +=" ?, ?, ?, ?, "; sql +=" ?, ?, ?, ?, "; sql +=" ?, ?, ?, ?, "; sql +=" ?, ?, ?, ?, "; sql +=" ?, ?, ?, ?, "; sql +=" ?, ?, ?, ?, "; sql +=" ?, ?, ?, ?, "; sql +=" ?) "; pstmt1 = connMgr.prepareStatement(sql); index = 1; pstmt1.setString(1, v_subj); pstmt1.setString(2, v_year); pstmt1.setString(3, v_subjseq); pstmt1.setString(4, v_userid); pstmt1.setString( 5, "0001"); // v_class pstmt1.setString( 6, v_comp); pstmt1.setString( 7, "Y"); // v_isdinsert pstmt1.setDouble( 8, 0); // v_score pstmt1.setDouble( 9, 0); // v_tstep pstmt1.setDouble(10, 0); // v_mtest pstmt1.setDouble(11, 0); // v_ftest pstmt1.setDouble(12, 0); // v_report pstmt1.setDouble(13, 0); // v_act pstmt1.setDouble(14, 0); // v_etc1 pstmt1.setDouble(15, 0); // v_etc2 pstmt1.setDouble(16, 0); // v_avtstep pstmt1.setDouble(17, 0); // v_avmtest pstmt1.setDouble(18, 0); // v_avftest pstmt1.setDouble(19, 0); // v_avreport pstmt1.setDouble(20, 0); // v_avact pstmt1.setDouble(21, 0); // v_avetc1 pstmt1.setDouble(22, 0); // v_avetc2 pstmt1.setString(23, "N"); // v_isgraduated pstmt1.setString(24, "N"); // v_isrestudy) pstmt1.setString(25, "N"); pstmt1.setString(26, ""); pstmt1.setString(27, ""); pstmt1.setInt(28, 99); // v_branch pstmt1.setString(29, ""); // v_confirmdate pstmt1.setInt (30, 0); // v_eduno pstmt1.setString(31, v_userid); pstmt1.setString(32, FormatDate.getDate("yyyyMMddHHmmss") ); // ldate pstmt1.setString(33, "Y"); // stustatus isOk = pstmt1.executeUpdate(); } if(isOk > 0){ connMgr.commit(); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql.toString()); throw new Exception("sql = " + sql.toString() + "\r\n" + ex.getMessage() ); } finally { if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.setAutoCommit(true); connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return isOk; } public ArrayList selectMemberAddr(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls1 = null; DataBox dbox = null; ArrayList list1 = null; String sql1 = ""; String v_userid = box.getSession("userid"); try { connMgr = new DBConnectionManager(); list1 = new ArrayList(); sql1 = " select hrdc,zip_cd,address,zip_cd1,address1 from tz_member where userid ='"+v_userid+"' "; //System.out.println(sql1); ls1 = connMgr.executeQuery(sql1); while(ls1.next()) { dbox = ls1.getDataBox(); list1.add(dbox); } } catch (Exception ex) { ErrorManager.getErrorStackTrace(ex, box, sql1); throw new Exception("sql1 = " + sql1 + "\r\n" + ex.getMessage()); } finally { if(ls1 != null) { try { ls1.close(); }catch (Exception e) {} } if(connMgr != null) { try { connMgr.freeConnection(); }catch (Exception e10) {} } } return list1; } public int modifyUserPop(RequestBox box) throws Exception { DBConnectionManager connMgr = null; PreparedStatement pstmt = null; String sql = ""; int isOk = 0; try { connMgr = new DBConnectionManager(); connMgr.setAutoCommit(false); String userid = box.getSession("userid"); String post1 = box.getString("p_post1").trim(); String post2 = box.getString("p_post2").trim(); String post = post1 + "-" + post2; String address1 = box.getString("p_address1"); String hrdc = box.getString("p_hrdc2"); /* System.out.println("userid==========>"+userid); System.out.println("post1==========>"+post1); System.out.println("post2==========>"+post2); System.out.println("post==========>"+post); System.out.println("address1==========>"+address1); System.out.println("hrdc==========>"+hrdc);*/ sql ="update TZ_MEMBER set \n"; if( "C".equals(hrdc)){ sql+=" zip_cd1 = ?, address1 = ?, hrdc=? \n"; }else{ sql+=" zip_cd = ?, address = ? , hrdc=? \n"; } sql+=" where userid = ? \n"; // System.out.println("sql----주소 업데이트::::" + sql); pstmt = connMgr.prepareStatement(sql); int params = 1; pstmt.setString(params++, post); pstmt.setString(params++, address1); pstmt.setString(params++, hrdc); pstmt.setString(params++, userid); isOk = pstmt.executeUpdate(); if ( isOk > 0 ) { connMgr.commit(); } else { connMgr.rollback(); } } catch ( Exception ex ) { isOk = 0; connMgr.rollback(); ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e1 ) { } } if ( connMgr != null ) { try { connMgr.setAutoCommit(true); } catch ( Exception e10 ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return isOk; } }
package com.sshfortress.common.beans; import java.io.Serializable; import java.util.Date; import org.springframework.format.annotation.DateTimeFormat; import com.fasterxml.jackson.annotation.JsonFormat; public class MemberInfo implements Serializable{ /** * <p class="detail"> * 功能:这里写描述 * </p> * @Fields serialVersionUID */ private static final long serialVersionUID = 351760748346458957L; private String userId; private String userName; private String name; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
/* * Copyright (c) 2013 MercadoLibre -- All rights reserved */ package com.zauberlabs.bigdata.lambdaoa.realtime.bolts; import static junit.framework.Assert.*; import java.util.Date; import java.util.List; import java.util.Map; import org.apache.commons.lang.time.DateUtils; import org.junit.Before; import org.junit.Test; import org.testng.collections.Lists; import backtype.storm.task.IOutputCollector; import backtype.storm.task.OutputCollector; import com.zauberlabs.bigdata.lambdaoa.realtime.fragstore.FragStore; import com.zauberlabs.bigdata.lambdaoa.realtime.util.VsCount; /** * {@link VsCountBolt} test * * * @since 05/07/2013 */ public class VsCountBoltTest { private VsCountBolt bolt; private IOutputCollector collector; @Before public final void setup() { this.bolt = new VsCountBolt(); this.bolt.prepare(null, null, new OutputCollector(collector)); } @Test public final void should_increment_counters() { bolt.incrementForDate(new Date(), "a", "b"); bolt.incrementForDate(new Date(), "a", "b"); bolt.incrementForDate(DateUtils.addDays(new Date(), -2), "b", "c"); final List<VsCount> counts = Lists.newArrayList(); this.bolt.setFragStore(new FragStore() { @Override public void updateFragVersusCount(VsCount fraggers) { counts.add(fraggers); } @Override public void updateFragCount(Map<String, Long> fraggers) { } }); bolt.writeToStoreFrom(DateUtils.addDays(new Date(), -1)); assertTrue(1 == counts.size()); assertTrue(1 == counts.get(0).getTarget().size()); assertTrue(2 == counts.get(0).getTarget().get("a", "b")); } @Test public final void should_not_explode_on_empty_flush_to_store() { final List<VsCount> counts = Lists.newArrayList(); this.bolt.setFragStore(new FragStore() { @Override public void updateFragVersusCount(VsCount fraggers) { counts.add(fraggers); } @Override public void updateFragCount(Map<String, Long> fraggers) { } }); bolt.writeToStoreFrom(DateUtils.addDays(new Date(), -1)); assertTrue(1 == counts.size()); assertTrue(counts.get(0).getTarget().isEmpty()); } }