text
stringlengths
10
2.72M
package com.chuxin.family.views.reminder; import com.chuxin.family.app.CxRootActivity; import com.chuxin.family.widgets.NiceSelector; import com.chuxin.family.R; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class ReminderEditTargetActivity extends CxRootActivity { private static final String TITLE = "ReminderEditTargetView"; private Button mReturnButton; private NiceSelector mTargetSelector; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.cx_fa_view_reminder_edit_target); init(); } private void fillData() { ReminderController controller = ReminderController.getInstance(); int target = controller.getTarget(); String[] selection = new String[] { String.valueOf(target) }; mTargetSelector.setSelection(selection); } private boolean saveUserInput() { String target = mTargetSelector.getSelection()[0]; ReminderController controller = ReminderController.getInstance(); controller.setTarget(Integer.valueOf(target)); return true; } private void init() { mReturnButton = (Button) findViewById(R.id.cx_fa_activity_title_back); mTargetSelector = (NiceSelector) findViewById(R.id.cx_fa_view_reminder_edit_target__selector); mReturnButton.setText(getString(R.string.cx_fa_navi_save_and_back)); mReturnButton.setPadding(30, 0, 10, 0); mReturnButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if (saveUserInput()) { Intent intent = new Intent(ReminderEditTargetActivity.this, ReminderCreateActivity.class); startActivity(intent); finish(); overridePendingTransition(R.anim.tran_pre_in, R.anim.tran_pre_out); } else { Toast.makeText(ReminderEditTargetActivity.this, "Validation Check failed!", Toast.LENGTH_SHORT) .show(); } } }); fillData(); } public boolean onKeyDown(int keyCode, android.view.KeyEvent event) { if (keyCode == android.view.KeyEvent.KEYCODE_BACK) { if (saveUserInput()) { Intent intent = new Intent(ReminderEditTargetActivity.this, ReminderCreateActivity.class); startActivity(intent); finish(); overridePendingTransition(R.anim.tran_pre_in, R.anim.tran_pre_out); } else { Toast.makeText(ReminderEditTargetActivity.this, "Validation Check failed!", Toast.LENGTH_SHORT) .show(); } return false; } return super.onKeyDown(keyCode, event); }; }
package Fichi; //import ua.nic.Cursova.model.*; import java.util.ArrayList; import java.util.List; public class HelpCode { public static List<String[]> helpCode(){ String s; String s1; List<String[]> retList = new ArrayList(); String[] ret = new String[2]; ret[0] = ""; ret[1] = ""; retList.add(ret.clone()); ret[0] = ""; ret[1] = ""; return retList; } }
package com.cxjd.nvwabao.bean; /** * Created by 李超 on 2017/10/29. * * TabSpec的封装类,每一个底部菜单块都是一个TabSpec * */ public class Tab { //每个菜单块的描述 private int titile; //菜单块儿的图片 private int icon; //每个菜单块对应的碎片 private Class fragment; public int getTitile() { return titile; } public void setTitile(int titile) { this.titile = titile; } public Tab(int titile, int icon, Class fragment) { this.titile = titile; this.icon = icon; this.fragment = fragment; } public int getIcon() { return icon; } public void setIcon(int icon) { this.icon = icon; } public Class getFragment() { return fragment; } public void setFragment(Class fragment) { this.fragment = fragment; } }
package com.testing.class3_2; import java.util.Scanner; public class SwitchTest { public static void main(String[] args) { System.out.println("WILL恋爱历险记:"); System.out.println("请输入要送的礼物:"); Scanner sc = new Scanner(System.in); String gift=sc.nextLine(); //好感度 int exp=50; switch (gift) { case "口红": System.out.println("WILL送了一个口红"); exp += 10; break; case "包": System.out.println("WILL送了一个包"); exp += 30; break; case "房子": System.out.println("WILL送了一个房子"); exp += 100; break; default: System.out.println("WILL送了个迷之礼物"); exp-=10; } System.out.println("好感度为:" + exp); } }
package yao.servlet.wordMeaningServlet; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class AddWordMeaningFormServlet extends HttpServlet { private static final String ADD_WORDMEANING_FORM = "add_wordmeaning.jsp"; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request,response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); request.getRequestDispatcher(ADD_WORDMEANING_FORM).forward(request,response); } }
package com.danielstone.materialaboutlibrary.items; public abstract class MaterialAboutItem { public abstract int getType(); }
package Pageobjects; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; public class PageElement { public WebDriver Idriver; public PageElement(WebDriver rdriver) { Idriver = rdriver; PageFactory.initElements(rdriver, this); } @FindBy(xpath = "// input[@id='Email']") WebElement txtEmail; @FindBy(xpath = "//input[@id='Password']") WebElement txtPassword; @FindBy(xpath = "// button[@type='submit']") WebElement submitbtn; @FindBy(xpath = "//a[contains(text(),'Logout')]") WebElement logoutbtn; public void setusername(String uname) { txtEmail.clear(); txtEmail.sendKeys(uname); } public void setpassword(String pwd) { txtPassword.clear(); txtPassword.sendKeys(pwd); } public void loginsubmit() throws InterruptedException { submitbtn.click(); Thread.sleep(3000); } public void logout() { logoutbtn.click(); } }
/* * #%L * Organisation: diozero * Project: diozero - Core * Filename: SchedulerTest.java * * This file is part of the diozero project. More information about this project * can be found at https://www.diozero.com/. * %% * Copyright (C) 2016 - 2023 diozero * %% * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * #L% */ package com.diozero.util; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; public class SchedulerTest { static int scheduler_instance = 0; static long last_call = 0; public static void main(String[] args) { test1(); test2(); test3(); test4(); } private static void test1() { ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(0, new TestThreadFactory(false)); ScheduledFuture<?> future1 = scheduler.scheduleAtFixedRate(() -> { long now = System.currentTimeMillis(); long diff = now - last_call; last_call = now; System.out.format("Thread 1: %s, Time between calls: %d%n", Thread.currentThread().getName(), Long.valueOf(diff)); }, 100, 100, TimeUnit.MILLISECONDS); ScheduledFuture<?> future2 = scheduler.scheduleAtFixedRate(() -> { long now = System.currentTimeMillis(); long diff = now - last_call; last_call = now; System.out.format("Thread 2: %s, Time between calls: %d%n", Thread.currentThread().getName(), Long.valueOf(diff)); }, 100, 100, TimeUnit.MILLISECONDS); ScheduledFuture<?> future3 = scheduler.scheduleAtFixedRate(() -> { long now = System.currentTimeMillis(); long diff = now - last_call; last_call = now; System.out.format("Thread 3: %s, Time between calls: %d%n", Thread.currentThread().getName(), Long.valueOf(diff)); }, 100, 100, TimeUnit.MILLISECONDS); SleepUtil.sleepSeconds(2); future1.cancel(true); future2.cancel(true); future3.cancel(true); try { future1.get(); } catch (Exception e) { // Ignore System.out.println("Error: " + e); } try { future2.get(); } catch (Exception e) { // Ignore System.out.println("Error: " + e); } try { future3.get(); } catch (Exception e) { // Ignore System.out.println("Error: " + e); } scheduler.shutdownNow(); System.out.println("test1 finished"); } private static void test2() { ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(0); Future<?> future1 = scheduler.submit(() -> { while (true) { SleepUtil.sleepMillis(100); System.out.println("Thread 1 running"); } }); Future<?> future2 = scheduler.submit(() -> { while (true) { SleepUtil.sleepMillis(100); System.out.println("Thread 2 running"); } }); Future<?> future3 = scheduler.submit(() -> { while (true) { SleepUtil.sleepMillis(100); System.out.println("Thread 3 running"); } }); SleepUtil.sleepSeconds(2); future1.cancel(true); try { future1.get(); } catch (Exception e) { // Ignore System.out.println("Error: " + e); } SleepUtil.sleepSeconds(1); future2.cancel(true); try { future2.get(); } catch (Exception e) { // Ignore System.out.println("Error: " + e); } SleepUtil.sleepSeconds(1); future3.cancel(true); try { future3.get(); } catch (Exception e) { // Ignore System.out.println("Error: " + e); } scheduler.shutdownNow(); System.out.println("test2 finished"); } private static void test3() { ExecutorService executor = Executors.newScheduledThreadPool(0); executor.execute(() -> { try { while (true) { Thread.sleep(100); System.out.println("Thread 1 running"); } } catch (InterruptedException e) { // Ignore System.out.println("Interrupted"); } }); executor.execute(() -> { try { while (true) { Thread.sleep(100); System.out.println("Thread 2 running"); } } catch (InterruptedException e) { // Ignore System.out.println("Interrupted"); } }); executor.execute(() -> { try { while (true) { Thread.sleep(100); System.out.println("Thread 3 running"); } } catch (InterruptedException e) { // Ignore System.out.println("Interrupted"); } }); SleepUtil.sleepSeconds(2); executor.shutdownNow(); System.out.println("test3 finished"); } private static void test4() { ExecutorService executor = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 0, TimeUnit.SECONDS, new SynchronousQueue<Runnable>()); Future<?> future1 = executor.submit(() -> { while (true) { SleepUtil.sleepMillis(100); System.out.println("Thread 1 running"); } }); Future<?> future2 = executor.submit(() -> { while (true) { SleepUtil.sleepMillis(100); System.out.println("Thread 2 running"); } }); Future<?> future3 = executor.submit(() -> { while (true) { SleepUtil.sleepMillis(100); System.out.println("Thread 3 running"); } }); SleepUtil.sleepSeconds(2); future1.cancel(true); future2.cancel(true); future3.cancel(true); try { future1.get(); } catch (Exception e) { // Ignore System.out.println("Error: " + e); } try { future2.get(); } catch (Exception e) { // Ignore System.out.println("Error: " + e); } try { future3.get(); } catch (Exception e) { // Ignore System.out.println("Error: " + e); } executor.shutdownNow(); System.out.println("test4 finished"); } } class TestThreadFactory implements ThreadFactory { private static final AtomicInteger poolNumber = new AtomicInteger(1); private final ThreadGroup group; private final AtomicInteger threadNumber = new AtomicInteger(1); private final String namePrefix; private final boolean daemon; TestThreadFactory(boolean daemon) { SecurityManager s = System.getSecurityManager(); group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup(); namePrefix = "daemon-pool-" + poolNumber.getAndIncrement() + "-thread-"; this.daemon = daemon; } @Override public Thread newThread(Runnable r) { Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0); t.setDaemon(daemon); return t; } }
package pl.czyzycki.towerdef.gameplay.entities; import pl.czyzycki.towerdef.TowerDef; import pl.czyzycki.towerdef.TowerDef.Particle; import pl.czyzycki.towerdef.gameplay.GameplayScreen; import pl.czyzycki.towerdef.gameplay.helpers.Circle; import pl.czyzycki.towerdef.menus.OptionsScreen; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Animation; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.StringBuilder; /** * Wróg zmierzający do bazy gracza. * */ public class Enemy { public static Sprite basicSprite; public static Animation leftWalkingAnimation; public static Animation rightWalkingAnimation; public static Animation downWalkingAnimation; public static Animation upWalkingAnimation; public static Animation leftFlyingAnimation; public static Animation rightFlyingAnimation; public static Animation downFlyingAnimation; public static Animation upFlyingAnimation; int sideWalking = 0; // 0=left, 1=right, 2=down else up GameplayScreen screen; Base base; Field slowdownField; Circle hitZone; Array.ArrayIterator<Vector2> pathIter; Vector2 pos, direction, currentWaypoint; Sprite sprite; float speed, maxSpeed, hp, maxHp, timer; int damage, points, money; boolean flying, alive, hitBase; StringBuilder hpText; float time = 0; // TODO public Enemy() {} static public void loadAnimations(AssetManager assetMgr) { Texture texture = assetMgr.get("images/enemy-anim.png", Texture.class); TextureRegion[][] tmp = TextureRegion.split(texture, 80, 80); float animSpeed = 0.15f; // TODO Poprawić poruszanie sie góra/dół TextureRegion[] upWalkFrames = new TextureRegion[4]; upWalkFrames[0] = tmp[0][0]; upWalkFrames[1] = tmp[0][1]; upWalkFrames[2] = tmp[0][0]; upWalkFrames[3] = tmp[0][2]; upWalkingAnimation = new Animation(animSpeed, upWalkFrames); TextureRegion[] leftWalkFrames = new TextureRegion[4]; leftWalkFrames[0] = tmp[1][0]; leftWalkFrames[1] = tmp[1][1]; leftWalkFrames[2] = tmp[1][0]; leftWalkFrames[3] = tmp[1][2]; leftWalkingAnimation = new Animation(animSpeed, leftWalkFrames); TextureRegion[] rightWalkFrames = new TextureRegion[4]; rightWalkFrames[0] = tmp[2][0]; rightWalkFrames[1] = tmp[2][1]; rightWalkFrames[2] = tmp[2][0]; rightWalkFrames[3] = tmp[2][2]; rightWalkingAnimation = new Animation(animSpeed, rightWalkFrames); TextureRegion[] downWalkFrames = new TextureRegion[4]; downWalkFrames[0] = tmp[3][0]; downWalkFrames[1] = tmp[3][1]; downWalkFrames[2] = tmp[3][0]; downWalkFrames[3] = tmp[3][2]; downWalkingAnimation = new Animation(animSpeed, downWalkFrames); texture = assetMgr.get("images/flying.png", Texture.class); tmp = TextureRegion.split(texture, 150, 150); TextureRegion[] upFlyFrames = new TextureRegion[1]; upFlyFrames[0] = tmp[0][0]; upFlyingAnimation = new Animation(animSpeed, upFlyFrames); TextureRegion[] leftFlyFrames = new TextureRegion[1]; leftFlyFrames[0] = tmp[0][2]; leftFlyingAnimation = new Animation(animSpeed, leftFlyFrames); TextureRegion[] rightFlyFrames = new TextureRegion[1]; rightFlyFrames[0] = tmp[1][0]; rightFlyingAnimation = new Animation(animSpeed, rightFlyFrames); TextureRegion[] downFlyFrames = new TextureRegion[1]; downFlyFrames[0] = tmp[0][1]; downFlyingAnimation = new Animation(animSpeed, downFlyFrames); } public Enemy(Enemy enemy, float timer) { hitZone = new Circle(); pos = new Vector2(); direction = new Vector2(); currentWaypoint = new Vector2(); sprite = new Sprite(basicSprite); hpText = new StringBuilder(); hitZone.pos = pos; hitZone.radius = enemy.hitZone.radius; speed = enemy.speed; maxSpeed = speed; hp = enemy.hp; maxHp = hp; damage = enemy.damage; points = enemy.points; money = enemy.money; flying = enemy.flying; alive = true; this.timer = timer; } public void set(Vector2 pos, Array.ArrayIterator<Vector2> pathIter, GameplayScreen screen) { this.screen = screen; this.pos.set(pos); this.pathIter = pathIter; pathIter.next(); // Pominięcie pozycji spawna currentWaypoint = pathIter.next(); direction.set(currentWaypoint.tmp().sub(this.pos).nor()); sprite.setRotation(direction.angle()-90f); sprite.setPosition(this.pos.x-sprite.getWidth()/2f,this.pos.y-sprite.getHeight()/2f); base = screen.getBase(); } /** * @return Do usunięcia? */ public boolean update(float dt) { if(!alive) return true; time += dt; // Sekcja update'owania aktualnie działającego pola spowalniającego if((slowdownField != null) && (!slowdownField.active || !Circle.colliding(hitZone, slowdownField.range))) slowdownField = null; Field strongerField = screen.fieldInRange(hitZone, (slowdownField != null) ? slowdownField.tower.getMultiplier() : 1.f); if(strongerField != null) slowdownField = strongerField; if(slowdownField != null) speed = maxSpeed*slowdownField.tower.getMultiplier(); else speed = maxSpeed; float toGo = pos.tmp().sub(currentWaypoint).len(); // Osiągnięto waypoint if(toGo <= dt*speed) { if(!pathIter.hasNext()) { // W teorii nie powinno się zdarzyć alive = false; return true; } dt = (dt*speed - toGo)/speed; pos.set(currentWaypoint); currentWaypoint = pathIter.next(); direction.set(currentWaypoint.tmp().sub(pos).nor()); sprite.setRotation(direction.angle()-90f); } // Kolizja z bazą if(Circle.colliding(hitZone, base.hitZone)) { alive = false; base.takeHit(damage); hitBase = true; if(OptionsScreen.vibrationEnabled()) Gdx.input.vibrate(200); return true; } if(direction.x < 0) sideWalking = 0; else if(direction.x > 0) sideWalking = 1; else if(direction.y > 0) sideWalking = 2; else sideWalking = 3; pos.add(direction.tmp().mul(dt*speed)); sprite.setPosition(pos.x-sprite.getWidth()/2f,pos.y-sprite.getHeight()/2f); return false; } public void draw(SpriteBatch batch) { Animation anim = flying ? upFlyingAnimation : upWalkingAnimation; if(sideWalking == 0) anim = flying ? leftFlyingAnimation : leftWalkingAnimation; else if(sideWalking == 1) anim = flying ? rightFlyingAnimation : rightWalkingAnimation; else if(sideWalking == 2) anim = flying ? downFlyingAnimation : downWalkingAnimation; TextureRegion currentFrame = anim.getKeyFrame(time, true); batch.draw(currentFrame, pos.x-currentFrame.getRegionWidth()/2.0f, pos.y-currentFrame.getRegionHeight()/2.0f); //sprite.draw(batch); } public void takeHit(float damage) { hp -= damage; if(hp <= 0f) { alive = false; TowerDef.getGame().createParticle(Particle.ENEMY_DESTROYED, pos.x, pos.y); } } public void debugDraw(ShapeRenderer shapeRenderer) { shapeRenderer.setColor(1, 0, 0, 0.2f); hitZone.draw(shapeRenderer); } public void debugText(SpriteBatch batch, BitmapFont debugFont) { hpText.length = 0; hpText.append(hp); hpText.append('/'); hpText.append(maxHp); debugFont.draw(batch, hpText, pos.x + 30f, pos.y - 30f); } public Circle getHitZone() { return hitZone; } public Vector2 getPos() { return pos; } public int getPoints() { return points; } public int getMoney() { return money; } public boolean hitTheBase() { return hitBase; } }
package com.daw.club.services; import com.daw.club.qualifiers.DAOMap; import static java.util.Arrays.asList; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; import jakarta.security.enterprise.identitystore.Pbkdf2PasswordHash; /** * Sample Authentication service with in memory encrypted passwords * * @author jrbalsas */ @ApplicationScoped @DAOMap public class ClubAuthServiceMap implements ClubAuthService { private static final Logger logger = Logger.getLogger(ClubAuthServiceMap.class.getName()); //Encryption algorithm @Inject private Pbkdf2PasswordHash passwordHash; //Sample user credentials in memory repository, use App users DAO on real app private Map<String, UserAuthInfo> users; @PostConstruct public void init() { //Configure encryption algorithm Map<String, String> parameters = new HashMap<>(); parameters.put("Pbkdf2PasswordHash.Iterations", "3072"); parameters.put("Pbkdf2PasswordHash.Algorithm", "PBKDF2WithHmacSHA512"); parameters.put("Pbkdf2PasswordHash.SaltSizeBytes", "64"); passwordHash.initialize(parameters); //Create sample user credentials users = new HashMap<>(); users.put("22222222-B", new UserAuthInfo(encryptPassword("secreto"), new String[]{"ADMINISTRADORES"})); users.put("33333333-C", new UserAuthInfo(encryptPassword("secreto"), new String[]{"USUARIOS"})); users.put("44444444-D", new UserAuthInfo(encryptPassword("secreto"), new String[]{"ADMINISTRADORES"})); users.put("11111111-A", new UserAuthInfo(encryptPassword("secreto"), new String[]{"ADMINISTRADORES"})); } @Override /*Retrieve users credentials from persistence repository and compare with provided in parameters*/ public boolean authUser(String username, String password) { boolean result = false; UserAuthInfo user = users.get(username); //Check password with encrypted version if (user != null && verifyPassword(password, user.getPassHash())) { result=true; logger.log(Level.INFO, String.format("Authenticated %s", username)); } else { logger.log(Level.WARNING, String.format("Authenticated error for %s", username)); } return result; } @Override /*Retrived set with username roles from persistence repository*/ public Set<String> getRoles(String username) { Set<String> roles = new HashSet<>(); if (users.containsKey(username)) { roles=new HashSet<>(asList(users.get(username).getRoles())); } return roles; } @Override public boolean verifyPassword(String password, String hashedPassword) { return passwordHash.verify(password.toCharArray(), hashedPassword); } @Override public String encryptPassword(String password) { String encryptedPass = passwordHash.generate(password.toCharArray()); logger.log(Level.INFO, "Clave cifrada: {0}", encryptedPass); return encryptedPass; } } //Simple temporary class for saving information in users Map class UserAuthInfo { private String passHash; private String[] roles; public UserAuthInfo(String passHash, String[] roles) { this.passHash = passHash; this.roles = roles; } public String[] getRoles() { return roles; } public String getPassHash() { return passHash; } }
package org.sero.cash.superzk.crypto.ecc; import java.math.BigInteger; import org.sero.cash.superzk.util.Arrays; import org.spongycastle.util.encoders.Hex; public class Constants { public static BigInteger ONE = BigInteger.ONE; public static BigInteger TWO = BigInteger.valueOf(2); public static BigInteger FQ_MODULUS = new BigInteger("21888242871839275222246405745257275088548364400416034343698204186575808495617"); public static BigInteger FR_MODULUS = new BigInteger("2736030358979909402780800718157159386076813972158567259200215660948447373041"); public static BigInteger ECC_A = new BigInteger("168700"); public static BigInteger ECC_D = new BigInteger("168696"); public static byte[] CRS = Arrays.reverse(Hex.decode("096b36a5804bfacef1691e173c366a47ff5ba84a44f26ddd7e8d9f79d5b42df0")); }
package com.szcinda.express; import com.szcinda.express.dto.CreatePathDto; import com.szcinda.express.dto.FileCreateDto; import com.szcinda.express.dto.FileDto; import com.szcinda.express.params.QueryFileParams; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.LinkOption; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributeView; import java.nio.file.attribute.BasicFileAttributes; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; @Service @Transactional public class FileServiceImpl implements FileService { @Value("${share.file.path}") private String absDirectory; @Value("${bak.file.path}") private String bakFilePath; private DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd-HHmmss"); private DateTimeFormatter df2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); public FileServiceImpl() { } @Override public List<FileDto> query(QueryFileParams params) { List<FileDto> fileDtos = new ArrayList<>(); File file = new File(params.getPath()); File[] files = file.listFiles();// 获取目录下的所有文件或文件夹 if (files != null && files.length > 0) { // 遍历,目录下的所有文件 for (File f : files) { FileDto fileDto = new FileDto(); fileDto.setName(f.getName()); try { Path path = Paths.get(f.getAbsolutePath()); BasicFileAttributeView basicview = Files.getFileAttributeView(path, BasicFileAttributeView.class, LinkOption.NOFOLLOW_LINKS); BasicFileAttributes attr = basicview.readAttributes(); long createTimeLong = attr.creationTime().toMillis(); LocalDateTime instantToLocalDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(createTimeLong), ZoneId.systemDefault()); fileDto.setCreateTime(df2.format(instantToLocalDateTime)); } catch (Exception e) { e.printStackTrace(); long modifyTimeLong = file.lastModified(); LocalDateTime instantToLocalDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(modifyTimeLong), ZoneId.systemDefault()); fileDto.setCreateTime(df2.format(instantToLocalDateTime)); } fileDto.setPath(f.getAbsolutePath().replace(absDirectory, "")); if (f.isFile()) { fileDto.setType(FileType.FILE); } else if (f.isDirectory()) { fileDto.setType(FileType.DIRECTORY); } fileDtos.add(fileDto); } } return fileDtos; } @Override public void delete(CreatePathDto deleteFileDto) { String absPath = absDirectory + java.io.File.separator + deleteFileDto.getPath(); java.io.File ioFile = new java.io.File(absPath); if (FileType.DIRECTORY.equals(deleteFileDto.getType())) { java.io.File[] fileList = ioFile.listFiles(); Assert.isTrue(fileList == null || fileList.length == 0, String.format("此[%s]目录下存在文件,不能删除", deleteFileDto.getName())); ioFile.delete(); } else { ioFile.delete(); } } @Override public void deleteFile(CreatePathDto deleteFileDto) { String absPath = absDirectory + java.io.File.separator + deleteFileDto.getPath(); java.io.File ioFile = new java.io.File(absPath); if (ioFile.exists()) { ioFile.delete(); } } @Override public void uploadFile(FileCreateDto createDto) throws Exception { // 如果出现同名文件,需要备份原来文件,以当天日期时分秒为基础 String absFilePath = createDto.getPath() + java.io.File.separator + createDto.getName(); java.io.File existFile = new java.io.File(absFilePath); if (existFile.exists()) { String time = df.format(LocalDateTime.now()); String name = existFile.getName(); String[] strings = name.split("\\."); String newFileName = strings[0] + "-" + time + "." + strings[1]; String newFilePath = bakFilePath + java.io.File.separator + newFileName; java.io.File bakFile = new java.io.File(newFilePath); copyFile(existFile, bakFile); existFile.delete(); } // 复制文件流到文件 OutputStream outStream = new FileOutputStream(absFilePath); byte[] buffer = new byte[8 * 1024]; int bytesRead; while ((bytesRead = createDto.getInputStream().read(buffer)) != -1) { outStream.write(buffer, 0, bytesRead); } } private void copyFile(java.io.File source, java.io.File dest) throws Exception { Files.copy(source.toPath(), dest.toPath()); } @Override public void createPath(CreatePathDto pathDto) { String path = absDirectory + java.io.File.separator + pathDto.getPath() + File.separator + pathDto.getName(); path = path.replace("根目录", ""); java.io.File filePath = new java.io.File(path); Assert.isTrue(!filePath.exists(), String.format("此[%s]目录已经存在", pathDto.getPath() + File.separator + pathDto.getName())); filePath.mkdir(); } }
package ba.bitcamp.LabS06D02; public class TernarniOperator { public static void main(String[] args) { int a = TextIO.getlnInt(); int b = TextIO.getlnInt(); int c; if (a>b) { c=a; } else { c = b; } System.out.println("Veci je: "+ c); c = (a > b) ? a : b; //Ternarni operator c = Math.max(a, b); //Math } }
import java.io.*; public class GoodCodingPractices { public float calculateSimpleInterest(int principalAmount, float simpleInterestRate, int numberOfYears ) { float simpleInterest = ( principalAmount * simpleInterestRate * numberOfYears ) /100; return simpleInterest; } }
/* * 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 j1.s.p0001; import java.util.Scanner; /** * * @author Thinh */ public class J1SP0001 { /** * @param args the command line arguments */ private static final Scanner in = new Scanner(System.in); public static void main(String[] args) { int n = inputSizeOfArray(); int[] a = inputValueOfArray(n); sortArrayBubbleSort(a); print(a); } private static int checkInput(){ while(true){ try{ int result = Integer.parseInt(in.nextLine().trim()); return result; }catch(NumberFormatException e){ System.err.println("Please input number: "); System.out.print("Enter again: "); } } } private static int inputSizeOfArray(){ System.out.print("Enter of array: "); int n = checkInput(); return n; } private static int[] inputValueOfArray(int n){ int[] a = new int[n]; for (int i = 0; i < n; i++){ System.out.print("Enter a[" + i + "] = "); a[i] = checkInput(); } return a; } private static void sortArrayBubbleSort(int[] a){ System.out.println("Unsort Array:"); for (int i = 0; i < a.length; i++){ System.out.print(a[i] + " "); } for (int i = 0; i < a.length; i++){ for (int j = 0; j < a.length - i - 1; j++){ if (a[j] > a[j+1]){ int tmp = a[j]; a[j] = a[j+1]; a[j+1] = tmp; } } } System.out.println(""); } private static void print(int[] a){ System.out.println("Sorted array"); for (int i = 0; i < a.length; i++){ System.out.print(a[i] + " "); } } }
package AI; import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class LaptopBatteryLife { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(System.in); double timeCharged = in.nextDouble(); File k = new File("../source/trainingdata.txt"); Scanner scan = new Scanner(k); String a = scan.nextLine(); String[] b = a.split(","); double g1 = Double.parseDouble(b[0]); double g2 = Double.parseDouble(b[1]); while(scan.hasNext()){ String y = scan.nextLine(); String[] h = a.split(","); double q1 = Double.parseDouble(h[0]); double q2 = Double.parseDouble(h[1]); g1 += q1; g2 += q2; } System.out.println(g1*timeCharged/g2); } }
package io.cir.demoapp; import android.content.Intent; import android.graphics.BitmapFactory; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ListView; import java.util.List; import java.util.ArrayList; import io.cir.demoapp.adapter.CartListViewAdapter; import io.cir.demoapp.dao.ItemDao; import io.cir.demoapp.dao.PurchaseDao; import io.cir.demoapp.dto.CartListViewDto; import io.cir.demoapp.entity.ItemEntity; import io.cir.demoapp.entity.PurchaseEntity; /** * カート画面用Activity */ public class CartActivity extends ActionBarActivity { private ListView listView = null; private List<CartListViewDto> cartListViewDtos = new ArrayList<CartListViewDto>(); private ItemDao itemDao; private PurchaseDao purchaseDao; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cart); DemoAppSQLiteOpenHelper helper = new DemoAppSQLiteOpenHelper(getApplicationContext()); itemDao = new ItemDao(helper.getWritableDatabase()); purchaseDao = new PurchaseDao(helper.getWritableDatabase()); // 画面表示用のDTOを生成する final List<PurchaseEntity> purchaseEntities = purchaseDao.findAll(); for (PurchaseEntity purchaseEntity: purchaseEntities) { if (purchaseEntity.getPurchaseState() != PurchaseEntity.PURCHASE_STATE.IN_CART){ continue; } CartListViewDto cartListViewDto = new CartListViewDto(); ItemEntity itemEntity = itemDao.findById(purchaseEntity.getItemId()); cartListViewDto.setItemImage(BitmapFactory.decodeResource(getResources(), itemEntity.getImageId())); cartListViewDto.setItemName(itemEntity.getName()); cartListViewDto.setPurchaseQuantity(String.valueOf(purchaseEntity.getQuantity()) + "個"); cartListViewDto.setTotalAmount(String.valueOf(itemEntity.getPrice() * purchaseEntity.getQuantity()) + "円"); cartListViewDtos.add(cartListViewDto); } // Adapterを用いでListViewの設定をする CartListViewAdapter cartListViewAdapter = new CartListViewAdapter(this, 0, cartListViewDtos); ListView listView = (ListView)findViewById(R.id.cartListView); listView.setAdapter(cartListViewAdapter); } /** * カートに入っているItemを全て購入する * * @param view */ public void buyItems (View view) { // カートに入っているPurchaseを購入済みステータスにする List<PurchaseEntity> purchaseEntities = purchaseDao.findAll(); for (PurchaseEntity purchaseEntity: purchaseEntities) { if (purchaseEntity.getPurchaseState() != PurchaseEntity.PURCHASE_STATE.IN_CART) { continue; } purchaseEntity.setPurchaseState(PurchaseEntity.PURCHASE_STATE.BOUGHT); purchaseDao.update(purchaseEntity); } Intent intent = new Intent(getApplicationContext(), thanksActivity.class); startActivity(intent); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_cart, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
package com.serkowski.bookings.domain; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; @EqualsAndHashCode(callSuper = true) @Data @NoArgsConstructor public class BookingDetailsDTO extends BookingDetails { private String timeStamp; }
package br.com.bytebank.banco.teste; import br.com.bytebank.banco.modelo.ContaCorrente;; public class TesteSaca { public static void main(String[] args) { try (ContaCorrente conta = new ContaCorrente(111, 00)){ conta.deposita(200.0); conta.saca(100); } catch (Exception e) { System.out.println(e.getMessage()); } } }
package br.org.funcate.glue.event; import java.util.EventObject; import br.org.funcate.glue.model.ContextToGroupMap; @SuppressWarnings("serial") public class SetThematicContextEvent extends EventObject{ private ContextToGroupMap parameters; public SetThematicContextEvent(Object source, ContextToGroupMap parameters) { super(source); this.setParameters(parameters); } public ContextToGroupMap getParameters() { return parameters; } public void setParameters(ContextToGroupMap parameters) { this.parameters = parameters; } }
package ca.antonious.habittracker.viewcells; import android.view.View; import android.widget.Button; import android.widget.TextView; import java.util.Date; import ca.antonious.habittracker.DaysToDescriptionMapper; import ca.antonious.habittracker.R; import ca.antonious.habittracker.models.Habit; import ca.antonious.viewcelladapter.annotations.BindListener; import ca.antonious.viewcelladapter.viewcells.BaseViewHolder; import ca.antonious.viewcelladapter.viewcells.GenericViewCell; /** * Created by George on 2017-02-27. */ public class HabitViewCell extends GenericViewCell<HabitViewCell.HabitViewHolder, Habit> { public HabitViewCell(Habit habit) { super(habit); } @Override public int getLayoutId() { return R.layout.habit_list_item; } @Override public void bindViewCell(HabitViewHolder viewHolder) { Habit habit = getModel(); if (habit.hasBeenCompletedOnDay(new Date())) { viewHolder.setCompleted(); } else { viewHolder.setNotCompleted(); } viewHolder.setTitle(habit.getName()); viewHolder.setDatesDescription(new DaysToDescriptionMapper().map(habit.getDaysToComplete())); } public interface OnHabitClickedListener { void onHabitClicked(Habit habit, int position); } public interface OnCompleteClickedListener { void onComplete(Habit habit, int position); } @BindListener public void bindOnHabitClickedListener(final HabitViewHolder viewHolder, final OnHabitClickedListener listener) { viewHolder.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.onHabitClicked(getModel(), viewHolder.getLayoutPosition()); } }); } @BindListener public void bindOnCompleteClickedListener(final HabitViewHolder viewHolder, final OnCompleteClickedListener listener) { viewHolder.setOnCompleteClickedListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.onComplete(getModel(), viewHolder.getAdapterPosition()); } }); } public static class HabitViewHolder extends BaseViewHolder { private TextView title; private TextView dateToRepeat; private Button completeButton; private View completionIndicator; public HabitViewHolder(View view) { super(view); title = (TextView) view.findViewById(R.id.habit_title); dateToRepeat = (TextView) view.findViewById(R.id.habit_dates); completeButton = (Button) view.findViewById(R.id.complete_button); completionIndicator = view.findViewById(R.id.completion_indicator); } public void setTitle(String title) { this.title.setText(title); } public void setDatesDescription(String description) { dateToRepeat.setText(description); } public void setOnCompleteClickedListener(View.OnClickListener onClickListener) { completeButton.setOnClickListener(onClickListener); } public void setOnClickListener(View.OnClickListener onClickListener) { itemView.setOnClickListener(onClickListener); } public void setCompleted() { completionIndicator.setVisibility(View.VISIBLE); } public void setNotCompleted() { completionIndicator.setVisibility(View.GONE); } } }
package code; import code.arithmetic.ArithmeticExpression; import errors.BadArgumentsError; import errors.BadTableUsingException; import errors.BadTypeError; import errors.NotInicializedVariableException; import errors.ZeroDivideException; import interpretator.Interpretator; public class VariableUse extends Instruction { private String id; private ArithmeticExpression index; private Boolean table; public VariableUse() { table = false; } public String getId() { return id; } public void setId(String id) { this.id = id; } public ArithmeticExpression getIndex() { return index; } public void setIndex(ArithmeticExpression index) { this.index = index; } public Boolean getTable() { return table; } public void setTable(Boolean table) { this.table = table; } @Override public void execute() { } @Override public SpecyficValue getValue() throws BadTypeError, BadTableUsingException, NumberFormatException, BadArgumentsError, ZeroDivideException, NotInicializedVariableException { Variable variable = Interpretator.getVariable(id); if(table) { SpecyficValue i = index.getValue(); if(variable.getTable() && i.getType() == Type.LiczbaNaturalna) return variable.tableValue.get(i.getIntValue()); else { BadTableUsingException error = new BadTableUsingException(); error.setInfo("Zle odowlanie do tabeli " + variable.getId()); throw error; } } return variable.getValue(); } }
package com.tencent.mm.pluginsdk.g.a.a; import com.tencent.mm.a.g; import com.tencent.mm.a.q; import com.tencent.mm.jni.utils.UtilsJni; import com.tencent.mm.plugin.game.f$k; import com.tencent.mm.pluginsdk.g.a.d.a; import com.tencent.mm.protocal.MMProtocalJni; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import java.io.File; final class l { private final int bIC; private final int bID; private final int bIE; private final boolean bIF; private final boolean bIJ; final String filePath; private final String qBB; private final int qBC; private final byte[] qBD; private final String qBE; private final long qBG; private final String qBH; private final int qBI; private final int qBJ; final String qBy; volatile String qCH = null; volatile String qCI = null; final boolean qCf; final boolean qCg; volatile int state = -1; private final String url; l(int i, int i2, String str, boolean z, boolean z2, String str2, int i3, boolean z3, boolean z4, byte[] bArr, String str3, String str4, long j, String str5, int i4, int i5, int i6) { this.qBy = i.ex(i, i2); this.bIC = i; this.bID = i2; this.filePath = str; this.qCg = z; this.qCf = z2; this.qBB = str2; this.qBC = i3; this.qBD = bArr; this.qBE = str3; this.bIJ = z3; this.bIF = z4; this.qBH = str4; this.qBG = j; this.url = str5; this.qBI = i4; this.qBJ = i5; this.bIE = i6; } final l ccw() { Throwable e; x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decrypt(), file_state = %s, before do decrypt, inPath = %s, outPath = %s, (key == empty) = %b", new Object[]{this.qBy, ccz(), this.qCH, this.qCI, Boolean.valueOf(bi.oW(this.qBB))}); if (1 == this.state) { if (bi.oW(this.qBB)) { x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decrypt(), invalid encrypt key", new Object[]{this.qBy}); this.qCH = null; this.state = 8; j.n(this.qBG, 54); j.n(this.qBG, 45); } else { boolean z; try { String str = this.qCH; String str2 = this.qCI; String str3 = this.qBB; File file = new File(str); if (file.exists() && file.isFile()) { file = new File(str2); file.getParentFile().mkdirs(); file.delete(); byte[] Tq = a.Tq(str); if (bi.bC(Tq)) { x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "read bytes empty"); j.n(this.qBG, 56); j.n(this.qBG, 45); j.n(this.qBG, 18); z = false; } else { Tq = MMProtocalJni.aesDecrypt(Tq, str3.getBytes()); if (bi.bC(Tq)) { x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "decrypted bytes empty"); j.n(this.qBG, 55); j.n(this.qBG, 45); j.n(this.qBG, 18); z = false; } else { z = a.v(str2, Tq); if (!z) { x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "decrypt write bytes fail"); j.n(this.qBG, 57); j.n(this.qBG, 45); j.n(this.qBG, 18); } } } } else { x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "inFile(%s) not exists", new Object[]{str}); z = false; } try { x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decrypt(), decrypt done, ret = %b", new Object[]{this.qBy, Boolean.valueOf(z)}); } catch (Exception e2) { e = e2; x.printErrStackTrace("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", e, "", new Object[0]); x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decrypt(), error = %s", new Object[]{this.qBy, e}); j.n(this.qBG, 45); j.n(this.qBG, 18); x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decrypt(), after try-catch, ret = %b", new Object[]{this.qBy, Boolean.valueOf(z)}); if (z) { j.n(this.qBG, 17); this.qCH = this.qCI; if (this.qCf) { this.qCI = this.filePath + ".decompressed"; this.state = 2; } else { this.state = 4; } } else { this.qCH = null; this.state = 8; } return this; } } catch (Exception e3) { e = e3; z = false; x.printErrStackTrace("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", e, "", new Object[0]); x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decrypt(), error = %s", new Object[]{this.qBy, e}); j.n(this.qBG, 45); j.n(this.qBG, 18); x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decrypt(), after try-catch, ret = %b", new Object[]{this.qBy, Boolean.valueOf(z)}); if (z) { j.n(this.qBG, 17); this.qCH = this.qCI; if (this.qCf) { this.qCI = this.filePath + ".decompressed"; this.state = 2; } else { this.state = 4; } } else { this.qCH = null; this.state = 8; } return this; } x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decrypt(), after try-catch, ret = %b", new Object[]{this.qBy, Boolean.valueOf(z)}); if (z) { this.qCH = null; this.state = 8; } else { j.n(this.qBG, 17); this.qCH = this.qCI; if (this.qCf) { this.qCI = this.filePath + ".decompressed"; this.state = 2; } else { this.state = 4; } } } } return this; } final l ccx() { Throwable e; x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decompress(), file_state = %s, before do decompress, inPath = %s, outPath = %s", new Object[]{this.qBy, ccz(), this.qCH, this.qCI}); if (2 == this.state) { boolean z; try { String str = this.qCH; String str2 = this.qCI; File file = new File(str); if (file.exists() && file.isFile()) { new File(str2).delete(); byte[] x = q.x(a.Tq(str)); if (bi.bC(x)) { x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "uncompressed bytes empty"); z = false; } else { z = a.v(str2, x); } } else { x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "inFile(%s) not exists", new Object[]{str}); z = false; } try { x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decompress(), decompress done, ret = %b", new Object[]{this.qBy, Boolean.valueOf(z)}); } catch (Exception e2) { e = e2; x.printErrStackTrace("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", e, "", new Object[0]); x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decompress(), error = %s", new Object[]{this.qBy, e}); x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decompress(), after try-catch, ret = %b", new Object[]{this.qBy, Boolean.valueOf(z)}); if (z) { this.qCH = this.qCI; this.state = 4; j.n(this.qBG, 19); } else { this.qCH = null; this.state = 8; j.n(this.qBG, 20); j.n(this.qBG, 46); if (this.qCg) { j.a(this.bIC, this.bID, this.qBC, this.bIJ, true, false, false, this.qBH); } else if (this.qCf && this.bIF) { j.a(this.bIC, this.bID, this.url, this.bIE, this.qBI > this.qBJ ? j.a.qCz : j.a.qCx, false, this.bIJ, false, this.qBH); } } return this; } } catch (Exception e3) { e = e3; z = false; x.printErrStackTrace("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", e, "", new Object[0]); x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decompress(), error = %s", new Object[]{this.qBy, e}); x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decompress(), after try-catch, ret = %b", new Object[]{this.qBy, Boolean.valueOf(z)}); if (z) { this.qCH = null; this.state = 8; j.n(this.qBG, 20); j.n(this.qBG, 46); if (this.qCg) { j.a(this.bIC, this.bID, this.qBC, this.bIJ, true, false, false, this.qBH); } else if (this.qCf && this.bIF) { j.a(this.bIC, this.bID, this.url, this.bIE, this.qBI > this.qBJ ? j.a.qCz : j.a.qCx, false, this.bIJ, false, this.qBH); } } else { this.qCH = this.qCI; this.state = 4; j.n(this.qBG, 19); } return this; } x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: decompress(), after try-catch, ret = %b", new Object[]{this.qBy, Boolean.valueOf(z)}); if (z) { this.qCH = this.qCI; this.state = 4; j.n(this.qBG, 19); } else { this.qCH = null; this.state = 8; j.n(this.qBG, 20); j.n(this.qBG, 46); if (this.qCg) { j.a(this.bIC, this.bID, this.qBC, this.bIJ, true, false, false, this.qBH); } else if (this.qCf && this.bIF) { j.a(this.bIC, this.bID, this.url, this.bIE, this.qBI > this.qBJ ? j.a.qCz : j.a.qCx, false, this.bIJ, false, this.qBH); } } } else if (8 == this.state && this.qCg) { j.a(this.bIC, this.bID, this.qBC, this.bIJ, false, false, false, this.qBH); } return this; } final String ccy() { x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: checkSum(), state " + ccz(), new Object[]{this.qBy}); if (16 == this.state) { return this.qCH; } if (4 != this.state && 32 != this.state) { return null; } String str; if (!bi.oW(this.qCH)) { String str2; String str3 = "MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer"; String str4 = "%s: checkSumImpl(), state = %s, originalMd5 = %s, eccSig.size = %s"; Object[] objArr = new Object[4]; objArr[0] = this.qBy; objArr[1] = ccz(); objArr[2] = this.qBE; if (this.qBD == null) { str2 = "null"; } else { str2 = String.valueOf(this.qBD.length); } objArr[3] = str2; x.i(str3, str4, objArr); if (bi.oW(this.qBE) || !bi.oV(g.cu(this.qCH)).equals(this.qBE)) { if (this.state == 4) { j.n(this.qBG, 24); } if (!bi.bC(this.qBD) && UtilsJni.doEcdsaSHAVerify(i.qCi, a.Tq(this.qCH), this.qBD) > 0) { x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: checkSumImpl(), state = %s, ecc check ok", new Object[]{this.qBy, ccz()}); if (this.state == 4) { j.n(this.qBG, 25); } str = this.qCH; x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: checkSumImpl return = %s", new Object[]{this.qBy, str}); if (this.state == 4) { return str; } if (bi.oW(str) && !this.qCf) { j.n(this.qBG, 58); j.n(this.qBG, 45); } if (bi.oW(str)) { if (this.qCg) { j.a(this.bIC, this.bID, this.qBC, this.bIJ, true, true, false, this.qBH); return str; } else if (!this.qCf || !this.bIF) { return str; } else { j.a(this.bIC, this.bID, this.url, this.bIE, this.qBI > this.qBJ ? j.a.qCz : j.a.qCx, false, this.bIJ, true, this.qBH); return str; } } else if (this.qCg) { j.a(this.bIC, this.bID, this.qBC, this.bIJ, true, true, true, this.qBH); return str; } else if (!this.qCf || !this.bIF) { return str; } else { j.a(this.bIC, this.bID, this.url, this.bIE, this.qBI > this.qBJ ? j.a.qCz : j.a.qCx, true, this.bIJ, true, this.qBH); return str; } } else if (this.state == 4) { j.n(this.qBG, 26); } } else { x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: checkSumImpl(), state = %s, md5 ok", new Object[]{this.qBy, ccz()}); if (this.state == 4) { j.n(this.qBG, 23); } str = this.qCH; x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: checkSumImpl return = %s", new Object[]{this.qBy, str}); if (this.state == 4) { return str; } if (bi.oW(str) && !this.qCf) { j.n(this.qBG, 58); j.n(this.qBG, 45); } if (bi.oW(str)) { if (this.qCg) { j.a(this.bIC, this.bID, this.qBC, this.bIJ, true, true, false, this.qBH); return str; } else if (!this.qCf || !this.bIF) { return str; } else { j.a(this.bIC, this.bID, this.url, this.bIE, this.qBI > this.qBJ ? j.a.qCz : j.a.qCx, false, this.bIJ, true, this.qBH); return str; } } else if (this.qCg) { j.a(this.bIC, this.bID, this.qBC, this.bIJ, true, true, true, this.qBH); return str; } else if (!this.qCf || !this.bIF) { return str; } else { j.a(this.bIC, this.bID, this.url, this.bIE, this.qBI > this.qBJ ? j.a.qCz : j.a.qCx, true, this.bIJ, true, this.qBH); return str; } } } str = null; x.i("MicroMsg.ResDownloader.CheckResUpdate.FileDecryptPerformer", "%s: checkSumImpl return = %s", new Object[]{this.qBy, str}); if (this.state == 4) { return str; } if (bi.oW(str) && !this.qCf) { j.n(this.qBG, 58); j.n(this.qBG, 45); } if (bi.oW(str)) { if (this.qCg) { j.a(this.bIC, this.bID, this.qBC, this.bIJ, true, true, false, this.qBH); return str; } else if (!this.qCf || !this.bIF) { return str; } else { j.a(this.bIC, this.bID, this.url, this.bIE, this.qBI > this.qBJ ? j.a.qCz : j.a.qCx, false, this.bIJ, true, this.qBH); return str; } } else if (this.qCg) { j.a(this.bIC, this.bID, this.qBC, this.bIJ, true, true, true, this.qBH); return str; } else if (!this.qCf || !this.bIF) { return str; } else { j.a(this.bIC, this.bID, this.url, this.bIE, this.qBI > this.qBJ ? j.a.qCz : j.a.qCx, true, this.bIJ, true, this.qBH); return str; } } final String ccz() { switch (this.state) { case 1: return "state_decrypt"; case 2: return "state_decompress"; case 4: return "state_check_sum"; case 8: return "state_file_invalid"; case 16: return "state_file_valid"; case f$k.AppCompatTheme_actionModeCutDrawable /*32*/: return "state_pre_verify_check_sum"; default: return this.state; } } }
package capstone.abang.com.Car_Owner.Endorse; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ListView; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import android.widget.Toast; import capstone.abang.com.Models.CategoryFile; import capstone.abang.com.R; import capstone.abang.com.Utils.CustomAdapter; import capstone.abang.com.Utils.FirebaseHelper; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.vlk.multimager.adapters.GalleryImagesAdapter; import com.vlk.multimager.utils.Constants; import com.vlk.multimager.utils.Image; import com.vlk.multimager.utils.Params; import com.vlk.multimager.utils.Utils; import java.util.ArrayList; public class SelectCategory extends AppCompatActivity { Toolbar toolbar; TextView toolbar_title; ArrayList<String> list = new ArrayList<>(); ListView listview; DatabaseReference dref; ArrayAdapter<String> adapter; Integer [] imageId = {R.drawable.imagelogo}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_select_category); toolbar = findViewById(R.id.toolbar); toolbar_title = findViewById(R.id.toolbar_title); RecyclerView recyclerView = findViewById(R.id.recycler_view); Intent intent = this.getIntent(); final ArrayList<Image> imagesList = intent.getParcelableArrayListExtra(Constants.KEY_BUNDLE_LIST); recyclerView.setHasFixedSize(true); StaggeredGridLayoutManager mLayoutManager = new StaggeredGridLayoutManager(4, GridLayoutManager.VERTICAL); mLayoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS); recyclerView.setLayoutManager(mLayoutManager); GalleryImagesAdapter imageAdapter = new GalleryImagesAdapter(this, imagesList, 1, new Params()); recyclerView.setAdapter(imageAdapter); Utils.initToolBar(this, toolbar, true); toolbar_title.setText("Gallery"); listview = findViewById(R.id.ListView); FirebaseHelper helper = new FirebaseHelper(); CustomAdapter adapter = new CustomAdapter(SelectCategory.this, helper.retrieve()); listview.setAdapter(adapter); listview.setOnItemClickListener(new AdapterView.OnItemClickListener(){ @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { CategoryFile cat = (CategoryFile) adapterView.getAdapter().getItem(i); Intent intent = new Intent(SelectCategory.this,AddDents.class); intent.putParcelableArrayListExtra(Constants.KEY_BUNDLE_LIST, imagesList); String CodeHolder = cat.getCatCode(); intent.putExtra("KEY",CodeHolder); startActivity(intent); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.select_category_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { setResult(RESULT_CANCELED); finish(); return true; } return true; } }
/** * Created by Zortrox on 10/26/2016. */ package com.foxslash.cs396_project3; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ListAdapter; import android.widget.TextView; import java.text.NumberFormat; import java.util.ArrayList; //adapter to add custom layout to customer order listview public class OrderAdapter extends BaseAdapter implements ListAdapter { private Context context; private ArrayList<OrderItem> listOrders = null; public OrderAdapter(ArrayList<OrderItem> list, Context context) { listOrders = list; this.context = context; } @Override public int getCount() { return listOrders.size(); } @Override public Object getItem(int pos) { return listOrders.get(pos); } @Override public long getItemId(int pos) { //return list.get(pos).getId(); return 0; } //create custom layout @Override public View getView(final int position, View convertView, ViewGroup parent) { View nowView = convertView; if (nowView == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); nowView = inflater.inflate(R.layout.item_wrapper, null); } final View view = nowView; //create currency formatter NumberFormat formatter = NumberFormat.getCurrencyInstance(); //set new food item name TextView listItemName = (TextView)view.findViewById(R.id.item_name); listItemName.setText(listOrders.get(position).getName()); //set new food item price TextView listItemPrice = (TextView)view.findViewById(R.id.item_price); String strPrice = formatter.format(listOrders.get(position).getPrice()); listItemPrice.setText(strPrice); //set new quantity ordered TextView listItemQuantity = (TextView)view.findViewById(R.id.item_quantity); String strQuantity = String.valueOf(listOrders.get(position).getQuantity()); listItemQuantity.setText(strQuantity); //set total cost for item (quantity * price) TextView listItemTotal = (TextView)view.findViewById(R.id.item_total); String strTotal = formatter.format(listOrders.get(position).getPrice() * listOrders.get(position).getQuantity()); listItemTotal.setText(strTotal); return view; } //remove an item from the listview public void removeItem(int position) { listOrders.remove(position); notifyDataSetChanged(); } }
/* Natalie Suboc * Oct 4, 2017 * Contains the pair programming task written in class, * ProcessingNumbers */ import java.util.*; public class PairProgramming { public static void main(String[] args) { processingNumbers(); } public static void processingNumbers() { Scanner userInput = new Scanner(System.in); int max = 0; int min = 0; int sum = 0; int evenMax = 0; boolean done = false; boolean first = true; do { System.out.print("Input a number: "); int num = userInput.nextInt(); if (first) { max = num; min = num; first = false; } else { if (num > max) { max = num; } if (num < min) { min = num; } } if (num % 2 == 0) { sum += num; if (num > evenMax) { evenMax = num; } } System.out.println("Are we finished? If so, type 'yes'."); String finished = userInput.next(); if (finished.equals("yes")) { done = true; } } while (!done); System.out.println("Max: " + max + "\nMin: " + min); System.out.println("Sum of even numbers: " + sum + "\nLargest even number: " + evenMax); userInput.close(); } }
// 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 edu.iu.dsc.tws.examples.batch.kmeans; import java.util.Arrays; import java.util.HashMap; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import edu.iu.dsc.tws.api.JobConfig; import edu.iu.dsc.tws.api.Twister2Submitter; import edu.iu.dsc.tws.api.job.Twister2Job; import edu.iu.dsc.tws.api.task.Collector; import edu.iu.dsc.tws.api.task.ComputeConnection; import edu.iu.dsc.tws.api.task.Receptor; import edu.iu.dsc.tws.api.task.TaskGraphBuilder; import edu.iu.dsc.tws.api.task.TaskWorker; import edu.iu.dsc.tws.common.config.Config; import edu.iu.dsc.tws.common.resource.WorkerComputeResource; import edu.iu.dsc.tws.data.api.DataType; import edu.iu.dsc.tws.dataset.DataSet; import edu.iu.dsc.tws.dataset.Partition; import edu.iu.dsc.tws.executor.api.ExecutionPlan; import edu.iu.dsc.tws.rsched.core.ResourceAllocator; import edu.iu.dsc.tws.rsched.core.SchedulerContext; import edu.iu.dsc.tws.task.api.IFunction; import edu.iu.dsc.tws.task.api.IMessage; import edu.iu.dsc.tws.task.batch.BaseBatchSink; import edu.iu.dsc.tws.task.batch.BaseBatchSource; import edu.iu.dsc.tws.task.graph.DataFlowTaskGraph; import edu.iu.dsc.tws.task.graph.OperationMode; public class KMeansJob extends TaskWorker { private static final Logger LOG = Logger.getLogger(KMeansJob.class.getName()); public static void main(String[] args) { LOG.log(Level.INFO, "KMeans job"); // first load the configurations from command line and config files Config config = ResourceAllocator.loadConfig(new HashMap<>()); // build JobConfig HashMap<String, Object> configurations = new HashMap<>(); configurations.put(SchedulerContext.THREADS_PER_WORKER, 8); // build JobConfig JobConfig jobConfig = new JobConfig(); jobConfig.putAll(configurations); Twister2Job.BasicJobBuilder jobBuilder = Twister2Job.newBuilder(); jobBuilder.setName("kmeans-job"); jobBuilder.setWorkerClass(KMeansJob.class.getName()); jobBuilder.setRequestResource(new WorkerComputeResource(2, 1024), 4); jobBuilder.setConfig(jobConfig); // now submit the job Twister2Submitter.submitJob(jobBuilder.build(), config); } @SuppressWarnings("unchecked") @Override public void execute() { LOG.log(Level.INFO, "Task worker starting: " + workerId); //this.jobParameters = KMeansJobParameters.build(config); /*int numberOfIterations = this.jobParameters.getIterations(); String inputFileName = this.jobParameters.getPointFile(); String centroidFileName = this.jobParameters.getCenterFile();*/ KMeansSourceTask kMeansSourceTask = new KMeansSourceTask(); KMeansAllReduceTask kMeansAllReduceTask = new KMeansAllReduceTask(); TaskGraphBuilder graphBuilder = TaskGraphBuilder.newBuilder(config); graphBuilder.addSource("source", kMeansSourceTask, 4); ComputeConnection computeConnection = graphBuilder.addSink("sink", kMeansAllReduceTask, 4); computeConnection.allreduce("source", "all-reduce", new CentroidAggregator(), DataType.OBJECT); graphBuilder.setMode(OperationMode.BATCH); //Store datapoints and centroids DataSet<Object> datapoints = new DataSet<>(0); DataSet<Object> centroids = new DataSet<>(1); //Set the configuration values in the configuration parameters. KMeansDataGenerator.generateDataPointsFile("/home/kgovind/hadoop-2.9.0/input.txt", 100, 2, 100, 500); KMeansDataGenerator.generateCentroidFile("/home/kgovind/hadoop-2.9.0/centroids.txt", 4, 2, 100, 500); //Reading File KMeansFileReader kMeansFileReader = new KMeansFileReader(); double[][] dataPoint = kMeansFileReader.readDataPoints( "/home/kgovind/hadoop-2.9.0/kmeans-input.txt", 2); double[][] centroid = kMeansFileReader.readCentroids( "/home/kgovind/hadoop-2.9.0/kmeans-centroid.txt", 2, 4); DataFlowTaskGraph graph = graphBuilder.build(); for (int i = 0; i < 2; i++) { datapoints.addPartition(0, dataPoint); centroids.addPartition(1, centroid); ExecutionPlan plan = taskExecutor.plan(graph); taskExecutor.addInput(graph, plan, "source", "points", datapoints); taskExecutor.addInput(graph, plan, "source", "centroids", centroids); taskExecutor.execute(graph, plan); DataSet<Object> dataSet = taskExecutor.getOutput(graph, plan, "sink"); Set<Object> values = dataSet.getData(); for (Object value : values) { KMeansCenters kMeansCenters = (KMeansCenters) value; centroid = kMeansCenters.getCenters(); LOG.info("%%% New centroid Values Received: %%%" + Arrays.deepToString(centroid)); } } } private static class KMeansSourceTask extends BaseBatchSource implements Receptor { private static final long serialVersionUID = -254264120110286748L; private DataSet<Object> input; private double[][] centroid = null; private double[][] datapoints = null; private KMeansCalculator kMeansCalculator = null; @Override public void execute() { int startIndex = context.taskIndex() * datapoints.length / context.getParallelism(); int endIndex = startIndex + datapoints.length / context.getParallelism(); LOG.fine("Original Centroid Value::::" + Arrays.deepToString(centroid)); kMeansCalculator = new KMeansCalculator(datapoints, centroid, context.taskIndex(), 2, startIndex, endIndex); KMeansCenters kMeansCenters = kMeansCalculator.calculate(); LOG.fine("Task Index:::" + context.taskIndex() + "\t" + "Calculated Centroid Value::::" + Arrays.deepToString(centroid)); context.writeEnd("all-reduce", kMeansCenters); } @SuppressWarnings("unchecked") @Override public void add(String name, DataSet<Object> data) { LOG.log(Level.INFO, "Received input: " + name); input = data; int id = input.getId(); if (id == 0) { Set<Object> dataPoints = input.getData(); this.datapoints = (double[][]) dataPoints.iterator().next(); } if (id == 1) { Set<Object> centroids = input.getData(); this.centroid = (double[][]) centroids.iterator().next(); } } } private static class KMeansAllReduceTask extends BaseBatchSink implements Collector<Object> { private static final long serialVersionUID = -5190777711234234L; private double[][] centroids; private double[][] newCentroids; @Override public boolean execute(IMessage message) { LOG.log(Level.FINE, "Received message: " + message.getContent()); centroids = ((KMeansCenters) message.getContent()).getCenters(); newCentroids = new double[centroids.length][centroids[0].length - 1]; for (int i = 0; i < centroids.length; i++) { for (int j = 0; j < centroids[0].length - 1; j++) { double newVal = centroids[i][j] / centroids[i][centroids[0].length - 1]; newCentroids[i][j] = newVal; } } LOG.fine("New Centroid Values:" + Arrays.deepToString(newCentroids)); return true; } @Override public Partition<Object> get() { return new Partition<>(context.taskIndex(), new KMeansCenters().setCenters(newCentroids)); } } /** * This class aggregates the cluster centroid values and sum the new centroid values. */ public class CentroidAggregator implements IFunction { private static final long serialVersionUID = -254264120110286748L; /** * The actual message callback * * @param object1 the actual message * @param object2 the actual message */ @Override public Object onMessage(Object object1, Object object2) throws ArrayIndexOutOfBoundsException { KMeansCenters kMeansCenters = (KMeansCenters) object1; KMeansCenters kMeansCenters1 = (KMeansCenters) object2; LOG.fine("Kmeans Centers 1:" + Arrays.deepToString(kMeansCenters.getCenters())); LOG.fine("Kmeans Centers 2:" + Arrays.deepToString(kMeansCenters1.getCenters())); KMeansCenters ret = new KMeansCenters(); double[][] newCentroids = new double[kMeansCenters.getCenters().length] [kMeansCenters.getCenters()[0].length]; if (kMeansCenters.getCenters().length != kMeansCenters1.getCenters().length) { throw new RuntimeException("Center sizes not equal " + kMeansCenters.getCenters().length + " != " + kMeansCenters1.getCenters().length); } for (int j = 0; j < kMeansCenters.getCenters().length; j++) { for (int k = 0; k < kMeansCenters.getCenters()[0].length; k++) { double newVal = kMeansCenters.getCenters()[j][k] + kMeansCenters1.getCenters()[j][k]; newCentroids[j][k] = newVal; } } ret.setCenters(newCentroids); LOG.fine("Kmeans Centers final:" + Arrays.deepToString(newCentroids)); return ret; } } }
/* * 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 entities; import java.io.Serializable; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * * @author emilt */ @Entity public class SchoolSignedUp implements Serializable { //Fields private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String grade; @Temporal(TemporalType.DATE) private Date passedDate; @ManyToOne private SchoolStudent student; @ManyToOne private SchoolClass schoolClass; // public SchoolSignedUp() { } public SchoolSignedUp(String grade, Date passedDate, SchoolStudent student, SchoolClass schoolClass) { this.grade = grade; this.passedDate = passedDate; this.student = student; this.schoolClass = schoolClass; } //Methods public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getGrade() { return grade; } public void setGrade(String grade) { this.grade = grade; } public Date getPassedDate() { return passedDate; } public void setPassedDate(Date passedDate) { this.passedDate = passedDate; } public SchoolStudent getStudent() { return student; } public void setStudent(SchoolStudent student) { this.student = student; } public SchoolClass getSchoolClass() { return schoolClass; } public void setSchoolClass(SchoolClass schoolClass) { this.schoolClass = schoolClass; } }
package com.lingnet.vocs.service.finance; import java.util.HashMap; import com.lingnet.common.service.BaseService; import com.lingnet.util.Pager; import com.lingnet.vocs.entity.Refund; public interface RefundService extends BaseService<Refund, String> { /** * @Title: saveOrUpdate * @param refund * @author zy * @since 2017年7月21日 V 1.0 */ void saveOrUpdate(Refund refund); /** * @Title: getListData * @param pager * @return * @author zy * @since 2017年7月21日 V 1.0 */ @SuppressWarnings("rawtypes") HashMap getListData(Pager pager,String id); /** * @Title: changeVerifyStatus * @param amId * @param verifyStatus * @return * @throws Exception * @author zy * @since 2017年7月21日 V 1.0 */ String changeVerifyStatus(String id, String verifyStatus) throws Exception; }
package com.shangcai.view.common; import java.util.List; import irille.view.BaseView; import lombok.Getter; import lombok.Setter; @Getter @Setter public class CategoryView implements BaseView { private Integer pkey; private String name; private Integer sort; private Integer parent; private List<CategoryView> subs; }
package com.dlq.servlet; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; /** *@program: Java_Web *@description: *@author: Hasee *@create: 2021-01-14 12:30 */ public class ResponseIOServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { //System.out.println(resp.getCharacterEncoding()); //ISO-8859-1 //它会同时设置服务器与客户端都使用UTF-8字符集,还设置了响应头 //此方法一定要在获取流对象之前调用才有效 resp.setContentType("text/html; charset=UTF-8"); System.out.println(resp.getCharacterEncoding()); //要求:往客户端回传字符串数据。 PrintWriter writer = resp.getWriter(); //writer.println(); writer.write("哈哈哈哈哈哈哈哈哈!!!"); } }
package fr.lteconsulting.formations.client.services; import com.google.gwt.core.client.GWT; import fr.lteconsulting.angular2gwt.client.JSON; import fr.lteconsulting.angular2gwt.client.JsArray; import fr.lteconsulting.angular2gwt.client.JsObject; import fr.lteconsulting.angular2gwt.client.interop.ng.http.Headers; import fr.lteconsulting.angular2gwt.client.interop.ng.http.Http; import fr.lteconsulting.angular2gwt.client.interop.promise.Promise; import fr.lteconsulting.angular2gwt.ng.core.Injectable; import fr.lteconsulting.formations.client.dto.DemandeFormationDTO; import jsinterop.annotations.JsType; @Injectable @JsType public class DemandeFormationService { private Http http; private static final String baseUrl = "rs/demandeformations"; private static final Headers headers = new Headers(); static { headers.append( "Content-Type", "application/json" ); } public DemandeFormationService( Http http ) { this.http = http; } public Promise<JsArray<DemandeFormationDTO>> getAll() { return http.get( baseUrl ) .toPromise() .<JsArray<DemandeFormationDTO>> then( response -> response.json() ) .onCatch( this::handleError ); } public Promise<JsArray<DemandeFormationDTO>> findByCollaborateur( Integer id ) { return http.get( baseUrl + "/byCollaborateur/" + id ) .toPromise() .<JsArray<DemandeFormationDTO>> then( response -> response.json() ) .onCatch( this::handleError ); } public Promise<DemandeFormationDTO> getOne( int id ) { return http.get( baseUrl + "/" + id ) .toPromise() .<DemandeFormationDTO> then( response -> response.json() ) .onCatch( this::handleError ); } public Promise<DemandeFormationDTO> delete( Integer id ) { return http.delete( baseUrl + "/" + id ) .toPromise() .<DemandeFormationDTO> then( response -> response == null || response.text().isEmpty() ? null : response.json() ) .onCatch( this::handleError ); } public Promise<DemandeFormationDTO> createOrUpdate( DemandeFormationDTO demandeFormation ) { return http.post( baseUrl, JSON.stringify( demandeFormation ), new JsObject().set( "headers", headers ) ) .toPromise() .<DemandeFormationDTO> then( response -> response.json() ) .onCatch( this::handleError ); } private Promise<?> handleError( Object error ) { // for demo purposes only, one should do more things here ! GWT.log( "An error occurred" + error ); return Promise.reject( error ); } }
package org.firstinspires.ftc.teamcode; import com.qualcomm.hardware.lynx.LynxModule; import com.qualcomm.hardware.rev.RevBlinkinLedDriver; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.util.ElapsedTime; public abstract class CypherAutoMethods extends CypherMethods { protected SkystoneDetector detector = new SkystoneDetector(); int[] skystonePos = new int[2]; public void runOpMode() throws InterruptedException { super.runOpMode(); changeColor(RevBlinkinLedDriver.BlinkinPattern.CP1_2_COLOR_WAVES); setCacheMode(LynxModule.BulkCachingMode.AUTO); resetEncoders(); //controlFoundation(FoundationState.RELEASE); maybe resets servos???? builders would preferably want it } protected void initVision(LinearOpMode opMode) { detector.activate(opMode); telemetry.addLine("init done"); telemetry.update(); } protected void initEverything() { initializeIMU(); detector.activate(this); while (!imu.isGyroCalibrated() && !isStopRequested()) { if (isStopRequested()) stopEverything(); } } protected void loadingAuto(Team team, int amount) { double distTravelled; //releaseIntake(); //DONT U DARE UNCOMMENT THIS LINE IT WILL BREAK THE SLIDES NO TOUCH THIS int factor = -1; if (team == Team.RED) factor = 1; //let the intake thingy out controlIntakeMotors(0.4); double angle = getRotationDimension(); getInPos(team); //go get ready and scan for skystones double angleOther = getRotationDimension(); skystonePos = detector.getSkystonePositions(); //find out positions for them //does not clear the telemetry for the stone positions!1!!11!! telemetry.addData("first skystone", skystonePos[0]).setRetained(true); telemetry.addData("second skystone", skystonePos[1]).setRetained(true); telemetry.update(); distTravelled = moveToStone(skystonePos[0], team); //go get it turnAbsolute((angle + angleOther) / 2); //rotate back to original angle (hitting the stones messes it up a bit) controlIntakeMotors(0.3); autoMove(-(TILE_LENGTH * 3.7 + distTravelled) * factor, 0); //move to other side turnAbsolute(90); //turn //aquire foundation autoMove(-TILE_LENGTH * (2d / 3) + 4, 0); controlFoundation(FoundationState.DRAG); waitMilli(500); grabStone(ArmState.DROP); autoMove(TILE_LENGTH * 2, 0); controlIntakeMotors(-0.3); if(team == Team.BLUE) { turnAbsolute(180); } else turnAbsolute(0); controlIntakeMotors(0); autoMove(-25, 0); //ok who needs foundation anymore controlFoundation(FoundationState.RELEASE); waitMilli(400); //2nd stone time if (amount == 2) { //blah blah blah idfk code works //maybe autoMove(findDistToSkystone(skystonePos[1]) + (TILE_LENGTH * 3.8), 0); grabSkystone(team, 2); controlIntakeMotors(0.3); autoMove(-(findDistToSkystone(skystonePos[1]) + (TILE_LENGTH * 3.5)), 0); grabStone(ArmState.DROP); turnRelative(90); //if it breaks prob thia line right here controlIntakeMotors(-0.3); waitMilli(300); controlIntakeMotors(0); autoMove(0, -TILE_LENGTH * 1.5); } else { autoMove(40, 0); } } protected void waitControlIntake(double power) { ElapsedTime time = new ElapsedTime(); controlIntakeMotors(power); while (time.milliseconds() < 40 && opModeIsActive()) { if (shouldStop()) { stopEverything(); break; } } } private void waitMoveFoundation(FoundationState state) { ElapsedTime time = new ElapsedTime(); if (state.equals(FoundationState.DRAG)) { moveFoundation(0.1); } else { moveFoundation(1); } while (time.milliseconds() < 200 && opModeIsActive()) { if (shouldStop()) { stopEverything(); } } } private boolean isSame(double right1, double top1, double right2, double top2) { double rightDiff = Math.abs(right1 - right2); double topDiff = Math.abs(top1 - top2); final int TOLERANCE = 100; return (rightDiff <= TOLERANCE) && (topDiff <= TOLERANCE); } protected void getFoundation(int factor, Side side) { //changed from protected to private, so warnings can stop yelling //turnRelative(180); autoMove(-30, 0); autoMove(0, -10 * factor); controlFoundation(FoundationState.DRAG); ElapsedTime timer = new ElapsedTime(); while (timer.seconds() < 1 && opModeIsActive()) { if (shouldStop()) stopEverything(); } autoMove(30, 0); turnRelative(90 * factor); timer.reset(); controlFoundation(FoundationState.RELEASE); autoMove(-15,0); while (timer.seconds() < 1 && opModeIsActive()) { if (shouldStop()) stopEverything(); } if (side == Side.BRIDGE) autoMove(40, 0); else { autoMove(0, 25); autoMove(40, 0); } //turnRelative(90); //bruh its charged oh my } void selfCorrectStrafe(double forward, double left) { int forwardMovement = convertInchToEncoder(forward); int leftMovement = convertInchToEncoder(left); resetEncoders(); double P = 1 / 1333d; double I = 0; double tolerance = 15; double angleTolerance = 7; double minSpeed = 0.01; double maxSpeed = 0.2333333333333333333333333333; double negSpeed, posSpeed; double currentNegPos, currentPosPos; double currentAngle; double negError, posError; double negSum = 0, posSum = 0; double angleError; double startAngle = getRotationDimension(); //double startAngle = getRotationDimension('Z'); int negTarget = forwardMovement - leftMovement; int posTarget = forwardMovement + leftMovement; do { if (shouldStop()) stopEverything(); //currentAngle = getRotationDimension('Z'); currentAngle = getRotationDimension(); angleError = currentAngle - startAngle; //P = tuner(P); if (Math.abs(angleError) > angleTolerance) { turnAbsolute(startAngle); } if (shouldStop()) stopEverything(); currentNegPos = getNegPos(); currentPosPos = getPosPos(); negError = currentNegPos - negTarget; posError = currentPosPos - posTarget; negSum += negError; posSum += posError; negSpeed = clip(P * negError + I * negSum, minSpeed, maxSpeed); posSpeed = clip(P * posError + I * posSum, minSpeed, maxSpeed); setStrafeMotors(negSpeed, posSpeed); telemetry.addData("neg current", currentNegPos); telemetry.addData("pos current", currentPosPos); telemetry.addData("neg error", negError); telemetry.addData("pos error", posError); telemetry.addData("neg speed", negSpeed); telemetry.addData("pos speed", posSpeed); telemetry.addData("forward", forwardMovement); telemetry.addData("left", leftMovement); telemetry.update(); } while (opModeIsActive() && (Math.abs(negError) > tolerance || Math.abs(posError) > tolerance)); setDriveMotors(0); } protected void betterSelfCorrectStrafe(double forward, double left) { int forwardMovement = convertInchToEncoder(forward); int leftMovement = convertInchToEncoder(left); int negTarget = forwardMovement - leftMovement; int posTarget = forwardMovement + leftMovement; double P = 1d / 1333; double turnP = 1d / 1222; double tolerance = 1d / 3; double turnTolerance = 10; double minSpeed = 0.01; double maxSpeed = 0.2; double maxTurnSpeed = 0.3; double negError, posError; double negPos, posPos; double angleError; double startAngle = getRotationDimension(); double currentAngle; double negSpeed, posSpeed, rotateSpeed; do { if (shouldStop()) stopEverything(); currentAngle = getRotationDimension(); negPos = getNegPos(); posPos = getPosPos(); negError = negTarget - negPos; posError = posTarget - posPos; angleError = currentAngle - startAngle; negSpeed = clip(P * negError, minSpeed, maxSpeed); posSpeed = clip(P * posError, minSpeed, maxSpeed); if (Math.abs(angleError) > tolerance) { rotateSpeed = clip(angleError * turnP, minSpeed, maxTurnSpeed); } else { rotateSpeed = 0; } turnStrafe(negSpeed, posSpeed, rotateSpeed); } while (opModeIsActive() && (Math.abs(negError) > tolerance || Math.abs(posError) > tolerance || Math.abs(angleError) > turnTolerance)); setDriveMotors(0); } protected void getInPos(Team team) { int factor = -1; if (team == Team.RED) factor = 1; autoMove(0, -(TILE_LENGTH * (1d / 2) + 4)); ElapsedTime time = new ElapsedTime(); while (time.milliseconds() < 900) { if (team == Team.BLUE) detector.determineOrder(); else detector.determineOrder23(); } autoMove(0, -(TILE_LENGTH * (2d / 3) - 4)); } protected double moveToStone(int pos, Team team) { int factor = 1; int idkWhatToCallThis; double dist = 0; //we need to test out some values for this /* whats needed where will we tell the robot to go to see the first 2 or first 3 stones how far does the robot need to travel backwards to get to a stone how far does the robot need to strafe to knock others out of its way how far does the robot need to move to actually get the stone in the intake */ if (team == Team.RED) factor = -1; if (pos == 3) { dist = -8 * factor; } else if (pos < 4) { idkWhatToCallThis = 4 - pos; dist = factor * (idkWhatToCallThis * 6); } else { idkWhatToCallThis = pos - 4; dist = -idkWhatToCallThis * 5 * factor; } if (team == Team.RED) autoMove(dist, 0); else { if (pos == 3) { autoMove(-20, 0); dist = -20; } else autoMove(-dist, 0); //Bill was here lol } grabSkystone(team,1); dist += -10 * factor; //now u can run the proper auto!!!11!!! return dist; } protected void grabSkystone(Team team, int num) { if(team == Team.BLUE && num == 1) { autoMove(0, -(TILE_LENGTH * (2d / 3d) + 4)); waitControlIntake(0.7777777777777777777); autoMove(8, 0); autoMove(0, (TILE_LENGTH * (2d / 3d) + 8)); } else if((team == Team.BLUE && num == 2)) { autoMove(0, ((TILE_LENGTH * (2d / 3d) + 4) * 2) - 6); waitControlIntake(0.7777777777777777777); autoMove(8, 0); autoMove(0, -((TILE_LENGTH * (2d / 3d) + 10) * 2) - 6); } else if(team == Team.RED) { autoMove(0, (TILE_LENGTH * (2d / 3d) + 4)); waitControlIntake(0.7777777777777777777); autoMove(8, 0); autoMove(0, -(TILE_LENGTH * (2d / 3d) + 10)); } grabStone(ArmState.PICK); } //will find the dist compared to the tile in either (5,2) or (2,2) //only call this when robot is facing loading zone protected double findDistToSkystone(int pos) { double dist; int idkWhatToCallThis; if (pos == 3) { dist = -2.5; } else if (pos < 4) { idkWhatToCallThis = 4 - pos; dist = -(idkWhatToCallThis * 6 + 3); } else { idkWhatToCallThis = pos - 4; dist = idkWhatToCallThis * 3.5; } return dist; } protected enum Team { RED, BLUE } protected enum Side { BRIDGE, WALL } /* why we still this IDK void emergencyMove(String side, String color) { ElapsedTime timer = new ElapsedTime(); double factor; if (side.equals("loading")) { if (color.equals("red")) factor = 1; else factor = -1; } else { if (color.equals("red")) factor = -1; else factor = 1; } telemetry.addData("EMERGENCY", "ROBOT DOES NOT WORK NORMALLY"); //the robot is always like that wdym //ok boomer telemetry.update(); timer.reset(); do { if (shouldStop()) { stopEverything(); } setStrafeMotors(-0.4 * factor, 0.4 * factor); } while (timer.seconds() < 2 && opModeIsActive()); setDriveMotors(0); } /* protected void buildingAuto(String side) { int factor = 1; switch (side) { case "red": factor = 1; break; case "blue": factor = -1; break; } Tile oldPos; moveToPos(currentPos.getX() - .5 * factor, currentPos.getY(), dir); //move forward a small bit turnRelative(180); //turn around so we can pick up foundation dir = 90 * factor; if (factor == 1) moveToPos(redFoundation, dir); //go to foundation else moveToPos(blueFoundation, dir); waitMoveFoundation(FoundationState.DRAG); if (factor == 1) moveToPos(redBuildSite, dir); else moveToPos(blueBuildSite, dir); waitMoveFoundation(FoundationState.RELEASE); moveFoundation(0); if (factor == 1) moveToPos(redQuarry, dir); //go to red quarry else moveToPos(blueQuarry, dir); turnRelative(-90 * factor); dir = 180; for (int i = 0; i < 2; i++) { //repeat twice for 2 skystones skystoneFindPls(factor); //center with skystone currentPos.add(0, -convertInchToTile(convertEncoderToInch(getPos()))); //find how far we travelled to find skystone oldPos = new Tile(currentPos); moveToPos(currentPos.getX() - convertInchToTile(factor), currentPos.getY(), dir); //move to be right behind/infront/whatever of skystone //pick up skystone and move into it controlIntakeMotors(1); autoMove(2, 0); currentPos.add(0, convertInchToTile(-2)); moveToPos(currentPos.getX() + factor, currentPos.getY(), dir); //move a bit to prevent hitting the neutral bridge moveToPos(currentPos.getX(), currentPos.getY() + 2, dir); //move to other side turnRelative(-90 * factor); //turn to release skystone and not have it in the way dir = -90 * factor; waitControlIntake(-.5); //release skystone controlIntakeMotors(0); turnRelative(90 * factor); //turn back dir = 180; if (i == 0) //if that was the first skystone move back to where we got the first one to look for second ome moveToPos(oldPos, dir); } if (factor == 1) moveToPos(redBridge, dir); //go to red bridge else moveToPos(blueBridge, dir); //or blue bridge stopEverything(); } */ /* private void moveToPos(double x2, double y2, int dir) { moveToPos(new Tile(x2, y2), dir); } private void moveToPos(Tile end, int dir) { double[] move = getDist(currentPos, end, dir); autoMove(move[0], move[1]); currentPos.setLocation(end); } */ /*@Override protected void autoMove(double forward, double left) { if (left < forward) { testPIDThingy(0, left); testPIDThingy(forward, 0); } else { testPIDThingy(forward, 0); testPIDThingy(0, left); } } */ /* private double[] getDist(Tile start, Tile end, int dir) { /* The angle manipulation is assuming that the degrees become negative right after it crosses 180 degrees. For instance, this assumption implies that one degree after 180 degrees is -1 degree because 90 more then becomes -90. It also assumes that the degree system stays negative from -90 and 90 degrees onward from that: */ /* Actual Attempt at angle stuff: int actualDir; double forward; double left; double endHorzShift; double endVertShift; double begHorzShift; double begVertShift; if (dir >= 0) { actualDir = -dir + 90; } else { actualDir = dir - 90; } endHorzShift = end.getX()*Math.cos(actualDir) + end.getY()*Math.sin(actualDir); endVertShift = -end.getX()*Math.sin(actualDir) + end.getY()*Math.cos(actualDir); begHorzShift = start.getX()*Math.cos(actualDir) + start.getY()*Math.sin(actualDir); begVertzShift = -start.getX()*Math.sin(actualDir) + start.getY()*Math.cos(actualDir); forward = endHorzShift - begHorzShift; left = endVertShift - begVertShift; return new double[]{tilesToInch(forward), tilesToInch(left)}; */ /* If it does not work, it's probably a result of one of the two things: 1.) The way the angle system works, such as when it turns negative. 2.) Switching forward and left from each other, in which case, just swap the forward and let declaration statements. double forward, left; switch (dir) { case 90: forward = end.getX() - start.getX(); left = end.getY() - start.getY(); break; case 180: forward = start.getY() - end.getY(); left = end.getX() - start.getX(); break; case -90: forward = start.getX() - end.getX(); left = end.getY() - start.getY(); return new double[]{tilesToInch(forward), tilesToInch(left)}; default: forward = end.getY() - start.getY(); left = end.getX() - start.getX(); break; } return new double[]{tilesToInch(forward), tilesToInch(left)}; } */ //we don't even use this and we use own park methods so getting rid of it prob /* protected void park(Team team, Side side) { switch (team) { case RED: switch (side) { case BRIDGE: autoMove(30, 0); case WALL: autoMove(0, -10); autoMove(30, 0); } case BLUE: switch (side) { case BRIDGE: autoMove(30, 0); case WALL: autoMove(0, 10); autoMove(30, 0); } } } */ }
package com.hoc.client.handlers; import com.hoc.service.impl.EmailService; import com.hoc.service.impl.EmailService.EmailType; import com.hoc.service.interfaces.InvoiceService; import com.hoc.service.interfaces.UserService; import java.util.Map; import javax.mail.Address; import org.springframework.context.ApplicationContext; /** * * @author patience */ public abstract class EmailHandler { private EmailHandler successor; private final EmailType type; protected InvoiceService invoiceService; protected UserService userService; public EmailHandler(ApplicationContext ctx, EmailType type) { this.type = type; invoiceService = (InvoiceService) ctx.getBean("invoiceService"); userService = (UserService) ctx.getBean("userService"); } public boolean sendEmail(EmailType emailType, Address email, Map data) { if (type.equals(emailType)) { return sendMessage(email, data); } else { return successor != null ? successor.sendEmail(emailType, email, data) : false; } } public abstract boolean sendMessage(Address email, Map data); public void setSuccessor(EmailHandler successor) { this.successor = successor; } }
package hr.unipu.java; import java.io.*; public class Main { public static void main (String[] args) { String Argument1 = args[0]; String Argument2 = args[1]; boolean Argument3 = args.length > 2 (args[2].equals("-p")) || args[2].equals("-print"); try (FileReader fin = new FileReader(Argument1); BufferedReader in = new BufferedReader(fin); FileWriter writer = new FileWriter(Argument2)) { String line; while ((line = in.readLine() ) != null) { if (Argument3) System.out.println(line); writer.write(line + " "); } System.out.println(" Datoteka je uspješno prepisana!"); } catch ( (FileNotFoundException e) { System.out.println(" Datoteka ne postoji!"); } catch (IOException e) { } } }
package com.giga.controller; import com.giga.entity.Product; import com.giga.service.IProductService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import java.util.List; @Controller @RequestMapping("/product") public class ProductController { @Autowired IProductService productService; @GetMapping() public String home() { return "product/index"; } @GetMapping("/create") public String create(Model model) { model.addAttribute("product", new Product()); return "product/create"; } @PostMapping("/create") public String createProduct(@ModelAttribute Product product, RedirectAttributes redirectAttributes) { productService.create(product); redirectAttributes.addFlashAttribute("success", "Create Product successfully"); return "redirect:/product/view"; } @GetMapping("/view") public String view(Model model) { List<Product> productList = productService.display(); model.addAttribute("productList", productList); return "product/view"; } @GetMapping("/delete") public String delete(@RequestParam String id) { productService.delete(id); return "redirect:/product/view"; } @GetMapping("/update/{id}") public String update(@PathVariable String id, Model model) { Product product = productService.getProduct(id); model.addAttribute("product", product); return "product/update"; } @PostMapping("/update") public String updateProduct(@ModelAttribute Product product) { productService.update(product); return "redirect:/product/view"; } }
package securiteL3; import java.io.BufferedReader; import java.io.FileReader; import java.io.File; import java.io.FileNotFoundException; public class Util{ /** * Supprime les accents et mets tout en minuscule * @param s le mot a editer * @return le nouveau mot */ public static String replaceAccent(String s){ s = s.replaceAll("[èéêëÈÉÊË]","e"); s = s.replaceAll("[ûùÛÙ]","u"); s = s.replaceAll("[ïîÏÎ]","i"); s = s.replaceAll("[àâÀÂ]","a"); s = s.replaceAll("[ôÔ]","o"); return s.toLowerCase(); } /** * Ouvre un buffer de lecture sur le nom de fichier en argument * @param name nom de fichier * @return le buffer de lecture */ public static BufferedReader open(String name){ FileReader f = null; try{ f = new FileReader(new File(name)); }catch(FileNotFoundException e){ System.err.println(e.getMessage()); System.exit(1); } return new BufferedReader(f); } }
package com.gtfs.util; import java.io.Serializable; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class FinYearCalculation implements Serializable{ public static String getFiscalYear(){ String strFinancialYear=""; String currentYear=""; String currentMonth=""; try { java.util.Date nowDate = new java.util.Date(); SimpleDateFormat formatNowYear = new SimpleDateFormat("yyyy"); currentYear = formatNowYear.format(nowDate); java.sql.Date nowDate2 = new java.sql.Date((new Date()).getTime()); DateFormat formatMonth = new SimpleDateFormat ("MM"); currentMonth = formatMonth.format(nowDate2); Integer intmOnth=Integer.parseInt(currentMonth); Integer intYear=Integer.parseInt(currentYear); if( intmOnth >= 4 ) { strFinancialYear=currentYear+"-"+(intYear+1); } else { strFinancialYear=(intYear-1)+"-"+currentYear; } } catch(Exception ex) { strFinancialYear=""; } return strFinancialYear; } }
package la.opi.verificacionciudadana.parser; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import la.opi.verificacionciudadana.api.EndPoint; import la.opi.verificacionciudadana.models.State; import la.opi.verificacionciudadana.models.Town; import la.opi.verificacionciudadana.util.Config; /** * Created by Jhordan on 25/02/15. */ public class ParserStatesSpinner { private static HashMap<Integer, String> statehashMap; public static HashMap<Integer, String> getStatehashMap() { return statehashMap; } public static ArrayList<State> paserState(String response) { statehashMap = new HashMap<>(); ArrayList<State> arrayListState = new ArrayList<>(); try { final JSONArray jsonArray = new JSONArray(response); for (int i = 0; i < jsonArray.length(); i++) { State estado = new State(); JSONObject state = jsonArray.getJSONObject(i); estado.setId(state.getString(EndPoint.PARSER_ID_STATE)); estado.setName(state.getString(EndPoint.PARSER_NAME_STATE)); arrayListState.add(estado); statehashMap.put(i, estado.getId()); ArrayList<Town> arrayListTown = new ArrayList<>(); JSONArray municipios = state.getJSONArray(EndPoint.PARSER_LIST_NAME_TOWN); for (int j = 0; j < municipios.length(); j++) { Town town = new Town(); JSONObject towns = municipios.getJSONObject(j); town.setName(towns.getString(EndPoint.PARSER_NAME_TOWN)); town.setId(towns.getString(EndPoint.PARSER_ID_TOWN)); arrayListTown.add(town); } estado.setTown(getTown(arrayListTown)); estado.setTownArrayList(arrayListTown); } } catch (JSONException e) { Log.e(Config.ERROR_PARSER, e.toString()); } return arrayListState; } private static ArrayList<String> getTown(ArrayList<Town> arrayListTowns) { ArrayList<String> townArrayListMex = new ArrayList<>(); for (Town town : arrayListTowns) { townArrayListMex.add(town.getName()); } return townArrayListMex; } public static class CustomComparator implements Comparator<Town> { @Override public int compare(Town town1, Town town2) { return town1.getName().compareTo(town2.getName()); } } }
public class SearchInABinarySearchTree { public static TreeNode searchBST1(TreeNode root, int val) { TreeNode blankNode =new TreeNode(0); if (root.val == val){ return root; } else { if (root.left != null){ blankNode = searchBST(root.left,val); } else if (root.right != null){ blankNode = searchBST(root.right,val); } else { return blankNode; } } return blankNode; } public static TreeNode searchBST(TreeNode root, int val) { if(root == null) return null; if (root.val == val){ return root; } if (val< root.val){ return searchBST(root.left,val); } else { return searchBST(root.right,val); } } public static void main(String[] args) { TreeNode node1 = new TreeNode(1); TreeNode node3 = new TreeNode(3); TreeNode node2 = new TreeNode(2,node1,node3); TreeNode node7 = new TreeNode(7); TreeNode node4 = new TreeNode(4,node2,node7); System.out.println(searchBST(node4,2)); } }
package jie.android.ip; import jie.android.ip.database.DBAccess; import jie.android.ip.playservice.PlayService; public class PlayEventListener { private final IPGame game; private final PlayService playService; private final DBAccess dbAccess; public PlayEventListener(final IPGame game) { this.game = game; playService = this.game.getPlayService(); dbAccess = this.game.getDBAccess(); } public void onPackItemPlaySucc(int packId, int itemId, int score) { if (playService != null) { playService.submitLeaderboardScore(getLeaderboardIdByItemId(itemId), score); onLeaderboardUpdate(packId, itemId, score); if (dbAccess.isPackAllUnlock(packId)) { playService.unlockAchievement(getAchievementIdByPackId(packId)); onAchievementUnlock(packId); } } } public void unlockTrackerAchievement(int id) { playService.unlockAchievement(getAchievementIdByTrackerId(id)); } private void onAchievementUnlock(int packId) { } private void onLeaderboardUpdate(int packId, int itemId, int score) { } private final String getAchievementIdByPackId(int packId) { return dbAccess.getPlayServiceId(packId, 0); } private final String getLeaderboardIdByItemId(int itemId) { return dbAccess.getPlayServiceId(itemId, 1); } private final String getAchievementIdByTrackerId(int id) { return dbAccess.getPlayServiceId(id, 2); } }
package algorithms.tasks; /** * TODO: Intersection of two sets. * Given two arrays a[] and b[], each containing n distinct 2D points in the plane, * design a subquadratic algorithm to count the number of points that are contained both in array a[] and array b[]. */ public class TwoSetsIntersection { }
package no.hvl.dat100; import static javax.swing.JOptionPane.*; public class Oppg4 { public static void main(String[] args) { float bruttoInntekt = Integer.parseInt(showInputDialog("Hva er brutto lønnen din?")); if(bruttoInntekt <= 164100) { System.out.println("Du betlaer ingen trinnskatt."); } else if(bruttoInntekt <= 230950) { System.out.println("Du betlaer 0,93% i trinnskatt. Det utgjør " + bruttoInntekt * 0.0093 + " av lønnen din."); } else if(bruttoInntekt <= 580650) { System.out.println("Du betaler 2,41% i trinnskatt. Det utgjør " + bruttoInntekt * 0.0241 + " av lønnen din."); } else if(bruttoInntekt <= 934050) { System.out.println("Du betaler 11,52 i trinnskatt. Det utgjør " + bruttoInntekt * 0.1152 + " av lønnen din."); } else if(bruttoInntekt <= 934051) { System.out.println("Du betaler 14,52% i trinnskatt. Det utgjør " + bruttoInntekt * 0.1452 + " av lønnen din."); } } }
package com.trs.om.api.ws.synuser; import java.security.NoSuchAlgorithmException; import com.trs.om.bean.User; public interface UserSynService { /** * 根据用户名查询用户是否已经存在 * @param userName * @return true 存在 false 不存在 */ public boolean queryUserByusername(String userName); /** * 增加用户 * @param user * @return */ public boolean addUser(User user); /** * 更新用户 * @return */ public boolean updateUser(User user); /** * 根据用户名查询指定用户 * @param userName * @return */ public User getUser(String userName); }
package com.mochasoft.fk.security.service; import com.mochasoft.fk.security.entity.PermissionResource; import com.mochasoft.fk.service.BaseService; public interface IPermissionResourceService extends BaseService<PermissionResource> { }
package com.cnk.travelogix.sapintegrations.accdocpost.data; import java.math.BigDecimal; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.datatype.XMLGregorianCalendar; public class ZifstVendor { @XmlElement(name = "Bschl", required = true) protected String bschl; @XmlElement(name = "Lifnr", required = true) protected String lifnr; @XmlElement(name = "Umskz", required = true) protected String umskz; @XmlElement(name = "Wrbtr", required = true) protected BigDecimal wrbtr; @XmlElement(name = "Prctr", required = true) protected String prctr; @XmlElement(name = "Wmwst", required = true) protected BigDecimal wmwst; @XmlElement(name = "Mwskz", required = true) protected String mwskz; @XmlElement(name = "Xmwst", required = true) protected String xmwst; @XmlElement(name = "Zterm", required = true) protected String zterm; @XmlElement(name = "Zfbdt", required = true) @XmlSchemaType(name = "date") protected XMLGregorianCalendar zfbdt; @XmlElement(name = "Zlspr", required = true) protected String zlspr; @XmlElement(name = "Zlsch", required = true) protected String zlsch; @XmlElement(name = "Pycur", required = true) protected String pycur; @XmlElement(name = "Pyamt", required = true) protected BigDecimal pyamt; @XmlElement(name = "Bvtyp", required = true) protected String bvtyp; @XmlElement(name = "Fdlev", required = true) protected String fdlev; @XmlElement(name = "Zuonr", required = true) protected String zuonr; @XmlElement(name = "Vbel2", required = true) protected String vbel2; @XmlElement(name = "Posn2", required = true) protected String posn2; @XmlElement(name = "Sgtxt", required = true) protected String sgtxt; @XmlElement(name = "Qsskz", required = true) protected String qsskz; @XmlElement(name = "Bupla", required = true) protected String bupla; @XmlElement(name = "Secco", required = true) protected String secco; /** * Gets the value of the bschl property. * * @return possible object is {@link String } * */ public String getBschl() { return bschl; } /** * Sets the value of the bschl property. * * @param value * allowed object is {@link String } * */ public void setBschl(final String value) { this.bschl = value; } /** * Gets the value of the lifnr property. * * @return possible object is {@link String } * */ public String getLifnr() { return lifnr; } /** * Sets the value of the lifnr property. * * @param value * allowed object is {@link String } * */ public void setLifnr(final String value) { this.lifnr = value; } /** * Gets the value of the umskz property. * * @return possible object is {@link String } * */ public String getUmskz() { return umskz; } /** * Sets the value of the umskz property. * * @param value * allowed object is {@link String } * */ public void setUmskz(final String value) { this.umskz = value; } /** * Gets the value of the wrbtr property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getWrbtr() { return wrbtr; } /** * Sets the value of the wrbtr property. * * @param value * allowed object is {@link BigDecimal } * */ public void setWrbtr(final BigDecimal value) { this.wrbtr = value; } /** * Gets the value of the prctr property. * * @return possible object is {@link String } * */ public String getPrctr() { return prctr; } /** * Sets the value of the prctr property. * * @param value * allowed object is {@link String } * */ public void setPrctr(final String value) { this.prctr = value; } /** * Gets the value of the wmwst property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getWmwst() { return wmwst; } /** * Sets the value of the wmwst property. * * @param value * allowed object is {@link BigDecimal } * */ public void setWmwst(final BigDecimal value) { this.wmwst = value; } /** * Gets the value of the mwskz property. * * @return possible object is {@link String } * */ public String getMwskz() { return mwskz; } /** * Sets the value of the mwskz property. * * @param value * allowed object is {@link String } * */ public void setMwskz(final String value) { this.mwskz = value; } /** * Gets the value of the xmwst property. * * @return possible object is {@link String } * */ public String getXmwst() { return xmwst; } /** * Sets the value of the xmwst property. * * @param value * allowed object is {@link String } * */ public void setXmwst(final String value) { this.xmwst = value; } /** * Gets the value of the zterm property. * * @return possible object is {@link String } * */ public String getZterm() { return zterm; } /** * Sets the value of the zterm property. * * @param value * allowed object is {@link String } * */ public void setZterm(final String value) { this.zterm = value; } /** * Gets the value of the zfbdt property. * * @return possible object is {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getZfbdt() { return zfbdt; } /** * Sets the value of the zfbdt property. * * @param value * allowed object is {@link XMLGregorianCalendar } * */ public void setZfbdt(final XMLGregorianCalendar value) { this.zfbdt = value; } /** * Gets the value of the zlspr property. * * @return possible object is {@link String } * */ public String getZlspr() { return zlspr; } /** * Sets the value of the zlspr property. * * @param value * allowed object is {@link String } * */ public void setZlspr(final String value) { this.zlspr = value; } /** * Gets the value of the zlsch property. * * @return possible object is {@link String } * */ public String getZlsch() { return zlsch; } /** * Sets the value of the zlsch property. * * @param value * allowed object is {@link String } * */ public void setZlsch(final String value) { this.zlsch = value; } /** * Gets the value of the pycur property. * * @return possible object is {@link String } * */ public String getPycur() { return pycur; } /** * Sets the value of the pycur property. * * @param value * allowed object is {@link String } * */ public void setPycur(final String value) { this.pycur = value; } /** * Gets the value of the pyamt property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getPyamt() { return pyamt; } /** * Sets the value of the pyamt property. * * @param value * allowed object is {@link BigDecimal } * */ public void setPyamt(final BigDecimal value) { this.pyamt = value; } /** * Gets the value of the bvtyp property. * * @return possible object is {@link String } * */ public String getBvtyp() { return bvtyp; } /** * Sets the value of the bvtyp property. * * @param value * allowed object is {@link String } * */ public void setBvtyp(final String value) { this.bvtyp = value; } /** * Gets the value of the fdlev property. * * @return possible object is {@link String } * */ public String getFdlev() { return fdlev; } /** * Sets the value of the fdlev property. * * @param value * allowed object is {@link String } * */ public void setFdlev(final String value) { this.fdlev = value; } /** * Gets the value of the zuonr property. * * @return possible object is {@link String } * */ public String getZuonr() { return zuonr; } /** * Sets the value of the zuonr property. * * @param value * allowed object is {@link String } * */ public void setZuonr(final String value) { this.zuonr = value; } /** * Gets the value of the vbel2 property. * * @return possible object is {@link String } * */ public String getVbel2() { return vbel2; } /** * Sets the value of the vbel2 property. * * @param value * allowed object is {@link String } * */ public void setVbel2(final String value) { this.vbel2 = value; } /** * Gets the value of the posn2 property. * * @return possible object is {@link String } * */ public String getPosn2() { return posn2; } /** * Sets the value of the posn2 property. * * @param value * allowed object is {@link String } * */ public void setPosn2(final String value) { this.posn2 = value; } /** * Gets the value of the sgtxt property. * * @return possible object is {@link String } * */ public String getSgtxt() { return sgtxt; } /** * Sets the value of the sgtxt property. * * @param value * allowed object is {@link String } * */ public void setSgtxt(final String value) { this.sgtxt = value; } /** * Gets the value of the qsskz property. * * @return possible object is {@link String } * */ public String getQsskz() { return qsskz; } /** * Sets the value of the qsskz property. * * @param value * allowed object is {@link String } * */ public void setQsskz(final String value) { this.qsskz = value; } /** * Gets the value of the bupla property. * * @return possible object is {@link String } * */ public String getBupla() { return bupla; } /** * Sets the value of the bupla property. * * @param value * allowed object is {@link String } * */ public void setBupla(final String value) { this.bupla = value; } /** * Gets the value of the secco property. * * @return possible object is {@link String } * */ public String getSecco() { return secco; } /** * Sets the value of the secco property. * * @param value * allowed object is {@link String } * */ public void setSecco(final String value) { this.secco = value; } }
package Unidade3.persistencia; public class Diretor { }
package com.jun.nettydemo.handlerorder; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; public class ServerHandler2 extends ChannelInboundHandlerAdapter { @Override public void channelRead(ChannelHandlerContext ctx, Object msg) { System.out.println(2); ctx.fireChannelRead(msg); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { cause.printStackTrace(); ctx.close(); } }
import java.util.*; public class RationalSequence2 { public static void main(String[] args) { Scanner nya = new Scanner(System.in); } }
package View; import java.awt.Color; import java.awt.Font; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingConstants; @SuppressWarnings("serial") public class MenuWindow extends JFrame { public MenuWindow() { setResizable(false); setLocationByPlatform(true); setBounds(new Rectangle(1000, 1000, 1000, 1000)); this.setLocationRelativeTo(null); getContentPane().setLayout(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().setBackground(new Color(46,46,46)); JLabel lblMainMenu = new JLabel("Welcome To Java Trivia Game"); lblMainMenu.setHorizontalAlignment(SwingConstants.CENTER); lblMainMenu.setFont(new Font("Snap ITC", Font.BOLD, 20)); lblMainMenu.setForeground(new Color(255, 255, 255)); lblMainMenu.setBounds(262, 189, 480, 62); getContentPane().add(lblMainMenu); JButton StartGame = new JButton("Start Game"); StartGame.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); ScreenManagement.ShowGetPlayersWindow(); } }); StartGame.setBackground(new Color(255, 127, 80)); StartGame.setFont(new Font("Snap ITC", Font.BOLD, 17)); StartGame.setBounds(407, 298, 190, 62); getContentPane().add(StartGame); JButton Instruction = new JButton("Instructions"); Instruction.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); ScreenManagement.ShowInstructionsWindow(); } }); Instruction.setFont(new Font("Snap ITC", Font.BOLD, 17)); Instruction.setBackground(new Color(255, 127, 80)); Instruction.setBounds(407, 369, 190, 62); getContentPane().add(Instruction); JButton PlayerStatisticsButton = new JButton("<html><center>Players" + "<br>" + "Statistics</center></html>"); PlayerStatisticsButton.setFont(new Font("Snap ITC", Font.BOLD, 17)); PlayerStatisticsButton.setBackground(new Color(255, 127, 80)); PlayerStatisticsButton.setBounds(407, 442, 190, 62); getContentPane().add(PlayerStatisticsButton); PlayerStatisticsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); ScreenManagement.ShowPlayersStatisticsWindow(); } }); JButton Ex = new JButton("Exit"); Ex.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); ScreenManagement.ShowExitWindow(); } }); Ex.setFont(new Font("Snap ITC", Font.BOLD, 17)); Ex.setBackground(new Color(255, 127, 80)); Ex.setBounds(407, 514, 190, 62); getContentPane().add(Ex); } }
package com.thatredhead.jmath.obj; public interface Expression extends Evaluable { }
package geeksforgeeks.mustdo; import java.util.Scanner; /** * Created by joetomjob on 12/7/18. */ public class SubarraySum { private static void subSum(int[] A, int n, int s){ int curr_sum = A[0]; int trail = 0; int end = -1; for(int i=1; i<n; i++){ curr_sum += A[i]; while(curr_sum > s){ curr_sum -= A[trail]; trail ++; } if(curr_sum == s){ end = i+1; break; } } if(end == -1){ System.out.println(-1); } else { System.out.print(trail+1); System.out.print(" "); System.out.print(end); System.out.println(); } } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int k = sc.nextInt(); for(int i = 0; i< k; i++){ int n = sc.nextInt(); int s = sc.nextInt(); int[] A = new int[n]; for(int j = 0; j< n; j++){ A[j] = sc.nextInt(); } subSum(A, n, s); } } }
package pl.dostrzegaj.soft.flicloader; import org.scribe.model.Token; interface AuthWrapper { UserAccount authorise(String token, String tokenSecret); Token authoriseNewToken(); }
package com.qr_market.activity; import android.content.Intent; import android.os.Bundle; import android.provider.AlarmClock; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Toast; import com.beardedhen.androidbootstrap.BootstrapButton; import com.beardedhen.androidbootstrap.BootstrapEditText; import com.facebook.AccessToken; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; import com.facebook.FacebookSdk; import com.facebook.appevents.AppEventsLogger; import com.facebook.login.LoginResult; import com.facebook.login.widget.LoginButton; import com.qr_market.Guppy; import com.qr_market.R; import com.qr_market.db.DBHandler; import com.qr_market.http.HttpHandler; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author Kemal Sami KARACA * @since 04.03.2015 * @version v1.01 */ public class LoginActivity extends ActionBarActivity implements View.OnClickListener { private CallbackManager callbackManager; private static View view; public static View getView() { return view; } public static void setView(View view) { LoginActivity.view = view; } /** *********************************************************************************************** *********************************************************************************************** * OVERRIDE METHODS *********************************************************************************************** *********************************************************************************************** */ // FACEBOOK LOGIN TUTORIAL PAGE // - https://developers.facebook.com/docs/facebook-login/android/v2.2 // - https://developers.facebook.com/docs/android/getting-started#login_share @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // FACEBOOK INITIALIZATION FacebookSdk.sdkInitialize(getApplicationContext()); callbackManager = CallbackManager.Factory.create(); setContentView(R.layout.activity_login); final DBHandler dbHelper = new DBHandler(getApplicationContext()); setView(this.getWindow().getDecorView().findViewById(android.R.id.content)); BootstrapButton login = (BootstrapButton) findViewById(R.id.guppyLogin); BootstrapButton register = (BootstrapButton) findViewById(R.id.guppyRegister); final BootstrapEditText cduName = (BootstrapEditText) findViewById(R.id.TextUsrname); final BootstrapEditText cduPass = (BootstrapEditText) findViewById(R.id.TextPsw); // FACEBOOK LOGIN // ----------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------- List<String> permissionList = new ArrayList<>(); permissionList.add("user_friends"); permissionList.add("email"); permissionList.add("user_about_me"); permissionList.add("public_profile"); permissionList.add("user_photos"); LoginButton facebookLoginButton = (LoginButton) this.findViewById(R.id.facebook_login_button); facebookLoginButton.setReadPermissions(permissionList); // **** If using in a fragment **** // facebookLoginButton.setFragment(this); // Callback registration facebookLoginButton.registerCallback( callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Toast.makeText(getApplicationContext(),"Facebook login success " + AccessToken.getCurrentAccessToken().getUserId(),Toast.LENGTH_LONG).show(); Log.i("AAAAAAAAAAAAAA","AAAAAAAAAAAAAA"); //Intent intent = new Intent( getApplicationContext() , MarketActivity.class); //intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); //startActivity(intent); } @Override public void onCancel() { Toast.makeText(getApplicationContext(),"Facebook login cancelled ",Toast.LENGTH_LONG).show(); Log.i("BBBBBBBBBBBBBBB","BBBBBBBBBBBBBBB"); } @Override public void onError(FacebookException exception) { Toast.makeText(getApplicationContext(),"Facebook login error occur ",Toast.LENGTH_LONG).show(); Log.i("CCCCCCCCCCCCCCC","CCCCCCCCCCCCCCC"); } }); // GUPPY // ----------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------- login.setOnClickListener(this); login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Map parameters = new HashMap(); parameters.put("authDo", "carpeLogin"); parameters.put("cduMail", cduName.getText().toString()); parameters.put("cduPass", cduPass.getText().toString()); Map operationInfo = new HashMap(); operationInfo.put(Guppy.http_Map_OP_TYPE, HttpHandler.HTTP_OP_LOGIN); operationInfo.put(Guppy.http_Map_OP_URL, Guppy.url_Servlet_Auth); new HttpHandler(getApplicationContext()).execute( operationInfo , parameters ); } }); register.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { Toast.makeText(getApplicationContext() , "Register button does not work for now" , Toast.LENGTH_LONG); } }); // TEST ACTIONS // ----------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------- /* Button twitter = (Button) findViewById(R.id.twitter); Button facebook = (Button) findViewById(R.id.fb); TextView registration = (TextView) findViewById(R.id.registration); TextView forget = (TextView) findViewById(R.id.forget); twitter.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // ** INFO ** shortcut to pass second Activity goToMarketActivity(true); } }); facebook.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // ** INFO ** Sample -1- //createAlarm("Deneme" , 6 , 2); // Gets the data repository in write mode SQLiteDatabase db = dbHelper.getWritableDatabase(); // Create a new map of values, where column names are the keys ContentValues values = new ContentValues(); values.put(GuppyContract.GuppyUser.COLUMN_NAME_USER_TOKEN , "token-1234-1452"); values.put(GuppyContract.GuppyUser.COLUMN_NAME_USER_NAME , "kemal sami"); values.put(GuppyContract.GuppyUser.COLUMN_NAME_USER_MAIL , "kemal"); values.put(GuppyContract.GuppyUser.COLUMN_NAME_USER_PASSWORD , "kemal"); long newRowId = db.insert( GuppyContract.GuppyUser.TABLE_NAME, null , values); Log.i("DB-OPERATION", "" + newRowId); Toast.makeText(getApplicationContext(), "Add new user called", Toast.LENGTH_SHORT).show(); } }); registration.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SQLiteDatabase db = dbHelper.getReadableDatabase(); String[] projection = { GuppyContract.GuppyUser._ID, GuppyContract.GuppyUser.COLUMN_NAME_USER_NAME, GuppyContract.GuppyUser.COLUMN_NAME_USER_MAIL, GuppyContract.GuppyUser.COLUMN_NAME_USER_TOKEN }; Cursor c = db.query( true , GuppyContract.GuppyUser.TABLE_NAME, projection, null, null, null, null,null,null ); if (c.moveToFirst()) { do { String userName = c.getString(c.getColumnIndex(GuppyContract.GuppyUser.COLUMN_NAME_USER_NAME)); Log.i("CURSOR" , userName); } while (c.moveToNext()); } Toast.makeText(getApplicationContext() , "Get user operation called" , Toast.LENGTH_SHORT).show(); } }); forget.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String name = Environment.getExternalStorageDirectory().getName(); Log.i("Environmet" , name); File folder = new File(Environment.getExternalStorageDirectory() + "/Guppy"); boolean success = true; if (!folder.exists()) { success = folder.mkdir(); } if (success) { Log.i("Operation" , "OK"); } else { // Do something else on failure Log.i("Operation" , "FAIL"); } // Check is there db for user DBHandler dbHelper = new DBHandler(MainActivity.getMainContext()); MainActivity.getMainContext().deleteDatabase(dbHelper.DATABASE_NAME); Toast.makeText(getApplicationContext() , "DB Deleted" , Toast.LENGTH_SHORT).show(); } }); */ // ----------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------- // TEST ACTIONS } @Override protected void onResume() { super.onResume(); // FACEBOOK analytics AppEventsLogger.activateApp(this); } @Override protected void onPause() { super.onPause(); // FACEBOOK analytics AppEventsLogger.deactivateApp(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_login, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @Override public void onClick(View v) { } /** * FACEBOOK CALLBACK HANDLER */ @Override protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); callbackManager.onActivityResult(requestCode, resultCode, data); } /** *********************************************************************************************** *********************************************************************************************** * UTIL FUNCTIONs *********************************************************************************************** *********************************************************************************************** */ public void goToMarketActivity(boolean isAuthSuccess){ if(isAuthSuccess){ Intent intent = new Intent( this, MarketActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); // Problem-1- /** * İkinci Activity sonrasında back tuşuna basılması durumunda Activity1 e dönmez.Ancak * activity uykumoduna geçip tekrak uyandırıldığında Activity1 açılır. */ } } public void createAlarm(String message, int hour, int minutes) { Intent intent = new Intent(AlarmClock.ACTION_SET_ALARM) .putExtra(AlarmClock.EXTRA_MESSAGE, message) .putExtra(AlarmClock.EXTRA_HOUR, hour) .putExtra(AlarmClock.EXTRA_MINUTES, minutes); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } } }
package commandline.language.syntax; import org.jetbrains.annotations.Nullable; /** * User: gno Date: 28.06.13 Time: 15:51 */ public abstract class CommandNameSyntaxValidator { public CommandNameSyntaxValidator() { super(); } public abstract void validate(@Nullable String name); public abstract boolean isValid(@Nullable String name); }
package com.tencent.mm.modelsimple; import com.tencent.mm.ab.j; import com.tencent.mm.protocal.k.d; import com.tencent.mm.protocal.k.e; import com.tencent.mm.protocal.o.a; import com.tencent.mm.protocal.o.b; public class f$a extends j { private final a efa = new a(); private final b efb = new b(); protected final d Ic() { return this.efa; } public final e Id() { return this.efb; } public final int getType() { return 10; } public final String getUri() { return null; } }
package repository; import org.springframework.data.repository.CrudRepository; import model.List; public interface ListRepository extends CrudRepository<List, Long> { }
package org.basic.comp.adapter; import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; import javax.swing.table.TableModel; public interface ParentPagingInterface extends TableModel { public void setPaging(PagingInterface paging); public void loadJumlahData(ODatabaseDocumentTx db); public void reload(ODatabaseDocumentTx db); }
/* * Copyright (C) 2015 Miquel Sas * * 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 3 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, see * <http://www.gnu.org/licenses/>. */ package com.qtplaf.library.trading.pattern.candle; import java.util.ArrayList; import java.util.List; import com.qtplaf.library.ai.fuzzy.Control; import com.qtplaf.library.ai.fuzzy.Segment; import com.qtplaf.library.ai.fuzzy.function.Linear; import com.qtplaf.library.trading.data.Data; import com.qtplaf.library.trading.data.DataList; import com.qtplaf.library.trading.pattern.Pattern; import com.qtplaf.library.util.NumberUtils; import com.qtplaf.library.util.list.ListUtils; /** * Root class of candlestick patterns. To correctly calculate proportions and ranges, it receives the average range * (hig-low) and its standard deviation. * <p> * Candle patterns are calculated comparing factors. For instance if the range factor is greater than or equal to big * and the body factor is also greater than or equal to big, and the candle is bullish, then it is a big bullish candle. * <p> * The fuzzy control to determine sizes and positions is configured pretty simple, big, medium, smal and top, middle, * bottom. For further detail about the position within a segment, the segment factor can be used again through the * control. * * @author Miquel Sas */ public abstract class CandlePattern extends Pattern { /** * Enum the proportional sizes. */ public interface Size { String VeryBig = "6"; String Big = "5"; String MediumBig = "4"; String Medium = "3"; String MediumSmall = "2"; String Small = "1"; String VerySmall = "0"; } /** * Enum proportional positions. */ public interface Position { String Top = "6"; String QuasiTop = "5"; String MiddleUp = "4"; String Middle = "3"; String MiddleDown = "2"; String QuasiBottom = "1"; String Bottom = "0"; } /** Average range statistically calculated for the time frame. */ private double rangeAverage; /** Range standard deviation also statistically calculated for the time frame. */ private double rangeStdDev; /** The fuzzy size control to check sizes in a range of 0 to 1. */ private Control control; /** * Contructor. */ public CandlePattern() { super(); } /** * Returns the maximum range for calculations, a rangeAverage + (2 * rangeStdDev) * * @return The maximum range for calculations. */ public double getMaximumRange() { return rangeAverage + (2 * rangeStdDev); } /** * Returns the fuzzy control to check sizes in a range of 0 to 1, normally used with factors like range, body, * shadow factors. * * @return The fuzzy control. */ public Control getControl() { if (control == null) { List<Segment> segments = new ArrayList<>(); addSegment(segments, Size.VerySmall, 0.10, -1); addSegment(segments, Size.Small, 0.25, -1); addSegment(segments, Size.MediumSmall, 0.40, -1); addSegment(segments, Size.Medium, 0.60, 0); addSegment(segments, Size.MediumBig, 0.75, 1); addSegment(segments, Size.Big, 0.90, 1); addSegment(segments, Size.VeryBig, 1.00, 1); control = new Control(segments); } return control; } /** * Convenience method to build the list of segments. * * @param segments The list of segments. * @param label The label. * @param maximum The maximum value. * @param sign The sign. */ private void addSegment(List<Segment> segments, String label, double maximum, int sign) { double minimum = 0.00; if (!segments.isEmpty()) { minimum = Math.nextUp(ListUtils.getLast(segments).getMaximum()); } segments.add(new Segment(label, maximum, minimum, sign, new Linear())); } /** * Returns the average range. * * @return The average range. */ public double getRangeAverage() { return rangeAverage; } /** * Set the average range. * * @param rangeAverage The average range. */ public void setRangeAverage(double rangeAverage) { this.rangeAverage = rangeAverage; } /** * Returns the range standard deviation. * * @return The range standard deviation. */ public double getRangeStdDev() { return rangeStdDev; } /** * Set the range standard deviation. * * @param rangeStdDev The range standard deviation. */ public void setRangeStdDev(double rangeStdDev) { this.rangeStdDev = rangeStdDev; } /** * Convenience method to check a pattern from anothe pattern. * * @param pattern The pattern to check. * @param dataList The data list. * @param index The index. * @return A boolean. */ public boolean isPattern(CandlePattern pattern, DataList dataList, int index) { pattern.setRangeAverage(getRangeAverage()); pattern.setRangeStdDev(getRangeStdDev()); return pattern.isPattern(dataList, index); } /** * Returns the open value. * * @param data The data element. * @return The open value. */ public double getOpen(Data data) { return Data.getOpen(data); } /** * Returns the high value. * * @param data The data element. * @return The high value. */ public double getHigh(Data data) { return Data.getHigh(data); } /** * Returns the low value. * * @param data The data element. * @return The low value. */ public double getLow(Data data) { return Data.getLow(data); } /** * Returns the close value. * * @param data The data element. * @return The open value. */ public double getClose(Data data) { return Data.getClose(data); } /** * Returns the body of the candle. * * @param data The data element. * @return The body. */ public double getBody(Data data) { double open = getOpen(data); double close = getClose(data); return Math.abs(close - open); } /** * Returns the body high. * * @param data The data element. * @return The body high. */ public double getBodyHigh(Data data) { double open = getOpen(data); double close = getClose(data); return Math.max(close, open); } /** * Returns the body low. * * @param data The data element. * @return The body low. */ public double getBodyLow(Data data) { double open = getOpen(data); double close = getClose(data); return Math.min(close, open); } /** * Returns the body factor (0 to 1) relating the body with the range. * * @param data The data element. * @return The body factor. */ public double getBodyFactor(Data data) { double body = getBody(data); double range = getRange(data); return Math.min(1.0, NumberUtils.zeroDiv(body, range)); } /** * Returns the body center. * * @param data The data element. * @return The body center. */ public double getBodyCenter(Data data) { double open = getOpen(data); double close = getClose(data); return (open + close) / 2; } /** * Returns the body center factors that indicates the body position. * * @param data The data element. * @return The body center factor. */ public double getBodyCenterFactor(Data data) { double center = getBodyCenter(data); double low = getLow(data); double range = getRange(data); return NumberUtils.zeroDiv(center - low, range); } /** * Returns the candle range (high - low) of the list of data elements. * * @param datas The list data elements. * @return The range (high - low). */ public double getRange(Data... datas) { double high = NumberUtils.MIN_DOUBLE; double low = NumberUtils.MAX_DOUBLE; for (Data data : datas) { high = Math.max(high, getHigh(data)); low = Math.min(low, getLow(data)); } return high - low; } /** * Returns the range unitary factor (0 to 1) by comparing the range with an estimated maximum range. * * @param data The data element. * @return The range factor (range / maxRange). */ public double getRangeFactor(Data data) { return Math.min(1.0, NumberUtils.zeroDiv(getRange(data), getMaximumRange())); } /** * Returns the shadows factor (1 - body factor). * * @param data The data element. * @return The shadow factor. */ public double getShadowsFactor(Data data) { return 1.0 - getBodyFactor(data); } /** * Returns the the lower shadow of the candle. * * @param data The data element. * @return Tha lower shadow. */ public double getShadowLower(Data data) { double low = getLow(data); double open = getOpen(data); double close = getClose(data); return Math.min(open, close) - low; } /** * Returns the lower shadow factor related to the range. * * @param data The data element. * @return The lower shadow factor. */ public double getShadowLowerFactor(Data data) { double shadow = getShadowLower(data); double range = getRange(data); return Math.min(1.0, NumberUtils.zeroDiv(shadow, range)); } /** * Returns the the upper shadow of the candle. * * @param data The data element. * @return Tha upper shadow. */ public double getShadowUpper(Data data) { double high = getHigh(data); double open = getOpen(data); double close = getClose(data); return high - Math.max(open, close); } /** * Returns the upper shadow factor related to the range. * * @param data The data element. * @return The upper shadow factor. */ public double getShadowUpperFactor(Data data) { double shadow = getShadowUpper(data); double range = getRange(data); return Math.min(1.0, NumberUtils.zeroDiv(shadow, range)); } /** * Check bearish * * @param data The data element. * @return A boolean. */ public boolean isBearish(Data data) { return Data.isBearish(data); } /** * Check bullish * * @param data The data element. * @return A boolean. */ public boolean isBullish(Data data) { return Data.isBullish(data); } }
package ch05; import ch04.Dish; import ch04.Menu; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; import static java.util.stream.Collectors.toList; public class Mapping { public static void main(String[] args) { Menu menu = new Menu(); List<Dish> menus = menu.getMenus(); List<String> dishNames = menus.stream() .map(Dish::getName) .collect(toList()); System.out.println("DishName: " + dishNames.toString()); List<Integer> dishNameLengths = menus.stream() .map(Dish::getName) .map(String::length) .collect(toList()); System.out.println("DishNameLength: " + dishNameLengths); List<String> words = Arrays.asList("Hello", "World"); List<String[]> mappedWords = words.stream() // String.split의 반환타입이 String[]이므로, 애초 원했던 List<String>의 형태가 아니다. .map(word -> word.split("")) .distinct() .collect(toList()); for (String[] arr : mappedWords) { System.out.println("Mapped Words-Item: " + Arrays.toString(arr)); } /* flatMap: 각 배열을 스트림이 아니라 스트림의 컨텐츠로 변환한다. * map과정에서 split된 String[]을 Stream 형태로 변환한 Stream<String[]>이 출력되고 * flatMap과정에서 Stream<String>으로 변환되어 출력된다. * 즉 flatMap은 스트림의 각 원소들을 또다른 스트림으로 변환하고, (Stream<String[]> -> Stream<String>, Stream<String>, Stream<String>, ...) * 모든 스트림을 하나의 스트림으로 연결하여 반환한다. (... -> Stream<String>) */ List<String> mappedWords2 = words.stream() .map(word -> word.split("")) .flatMap(Arrays::stream) .distinct() .collect(toList()); System.out.println("Mapped Words: " + mappedWords2); } }
package Chapter2.LinkedLists.ReserveSingleSubList; import Chapter2.LinkedLists.Node; public class Solution { public static void main(String[] args) { // init the linked list var root = new Node(1); root.next = new Node(2); root.next.next = new Node(3); root.next.next.next = new Node(4); root.next.next.next.next = new Node(5); var result = reverseSubListV2(root, 1, 4); // print the result var current = result; while (current != null) { System.out.println(current.data); current = current.next; } } public static Node found(Node root, int data) { var current = root; while (current != null) { if (current.data == data) { System.out.println("found"); return current; } current = current.next; } return null; } public static Node reverseSublist(Node root, int start, int end) { if (start == end) return root; var current = root; var count = 0; Node startNode = null, endNode = null; while (current != null) { if (count == start) { startNode = current; } if (count == end) { endNode = current; break; } current = current.next; count++; } // append the rest; // reserve from start node to end node Node prev = current.next; var curr = startNode; var currentCount = start; while (currentCount <= end) { var forward = curr.next; curr.next = prev; prev = curr; curr = forward; currentCount++; } var anotherCurrent = root; while (anotherCurrent != null) { if (anotherCurrent.next == startNode) { anotherCurrent.next = endNode; break; } anotherCurrent = anotherCurrent.next; } return root; } public static Node reverseSubListV2(Node root, int start, int finish) { if (start == finish) return root; Node dummyHead = root; var sublistHead = dummyHead; int k = 1; while (k++ < start) { sublistHead = sublistHead.next; } // Reverse list var sublistIter = sublistHead.next; while (start++ < finish) { var temp = sublistIter.next; sublistIter.next = temp.next; temp.next = sublistHead.next; sublistHead.next = temp; } return dummyHead.next; } }
package weighting; import java.util.HashMap; import java.util.List; import java.util.Map; import org.json.JSONArray; import org.json.JSONObject; import questionnaire.expert.ExpertQuestionnaireDAO; import questionnaire.monitor.MonitorQuestionnaireDAO; import questionnaire.resident.ResidentQuestionnaireDAO; public class EristPoints { private List<EristPoint> eristPoints; private List<Double> questionnaireWeights; private List<Double> levelWeights; public List<Double> getQuestionnaireWeights() { return questionnaireWeights; } public void setQuestionnaireWeights(List<Double> questionnaireWeights) { this.questionnaireWeights = questionnaireWeights; } public void setEristPoints(List<EristPoint> eristPoints) { this.eristPoints = eristPoints; } public List<Double> getLevelWeights() { return levelWeights; } public void setLevelWeights(List<Double> levelWeights) { this.levelWeights = levelWeights; } public EristPoints getExpertWeights(ExpertQuestionnaireDAO dao) { for (EristPoint eristPoint : eristPoints) { eristPoint.setExpertWeight(dao.getWeightByLL(eristPoint.getLongitude(), eristPoint.getLatitude())); } return this; } public EristPoints getMonitorWeights(MonitorQuestionnaireDAO dao) { for (EristPoint eristPoint : eristPoints) { eristPoint.setMonitorWeight(dao.getWeightByLL(eristPoint.getLongitude(), eristPoint.getLatitude())); } return this; } public EristPoints getResidentWeights(ResidentQuestionnaireDAO dao) { for (EristPoint eristPoint : eristPoints) { eristPoint.setResidentWeight(dao.getWeightByLL(eristPoint.getLongitude(), eristPoint.getLatitude())); } return this; } public EristPoints solveWeights() { for (EristPoint eristPoint : eristPoints) { double sum=0; double regular=0; if (eristPoint.getExpertWeight()>=0){ sum+=eristPoint.getExpertWeight()*questionnaireWeights.get(0); regular+=questionnaireWeights.get(0); } if (eristPoint.getMonitorWeight()>=0){ sum+=eristPoint.getMonitorWeight()*questionnaireWeights.get(1); regular+=questionnaireWeights.get(1); } if (eristPoint.getResidentWeight()>=0){ sum+=eristPoint.getResidentWeight()*questionnaireWeights.get(2); regular+=questionnaireWeights.get(2); } eristPoint.setFinalWeight(sum/regular); } return this; } public List<EristPoint> gEristPoints() { return eristPoints; } public EristPoints getLevels() { for (EristPoint eristPoint : eristPoints) { for (int i=0; i<levelWeights.size(); i++){ if (eristPoint.getFinalWeight()>=levelWeights.get(i)){ eristPoint.setLevel(i); break; } } } return this; } public String toJsonByLevel(int level) { JSONArray jArray=new JSONArray(); for (EristPoint eristPoint : eristPoints) { if (eristPoint.getLevel()==level){ Map<String, String> map=new HashMap<>(); map.put("longitude", eristPoint.getLongitude()+""); map.put("latitude", eristPoint.getLatitude()+""); jArray.put(map); } } JSONObject jObject=new JSONObject(); jObject.put("points", jArray); return jObject.toString(); } public String toJson() { return null; } }
package org.sbbs.app.gen.dao.hibernate; import org.sbbs.app.gen.model.GenEntity; import org.sbbs.app.gen.dao.GenEntityDao; import org.sbbs.base.dao.hibernate.BaseDaoHibernate; import org.springframework.stereotype.Repository; @Repository("genEntityDao") public class GenEntityDaoHibernate extends BaseDaoHibernate<GenEntity, Long> implements GenEntityDao { public GenEntityDaoHibernate() { super(GenEntity.class); } }
package com.module.controllers.veterandialog.tables; import com.module.model.entity.WorkPlaceEntity; import javafx.fxml.FXML; import javafx.scene.control.TextField; import javafx.stage.Stage; import org.springframework.stereotype.Component; @Component public class AddWorkPlaceController { @FXML private TextField departmentPhoneNumberField; @FXML private TextField localityField; @FXML private TextField organizationField; @FXML private TextField positionField; private Stage dialogStage; private boolean saveClicked = false; private WorkPlaceEntity workPlaceEntity; @FXML public void initialize() { } public boolean isSaveClicked() { return saveClicked; } public void setDialogStage(Stage dialogStage) { this.dialogStage = dialogStage; } public void setWorkPlaceEntity(WorkPlaceEntity workPlaceEntity) { this.workPlaceEntity = workPlaceEntity; localityField.setText(this.workPlaceEntity.getLocality()); positionField.setText(this.workPlaceEntity.getPosition()); departmentPhoneNumberField.setText(workPlaceEntity.getOrganization()); } @FXML private void cancelButtonClick() { dialogStage.close(); } @FXML private void saveButtonClick() { setNewFamilyMemberEntity(); saveClicked = true; dialogStage.close(); } private void setNewFamilyMemberEntity() { this.workPlaceEntity.setLocality(localityField.getText()); this.workPlaceEntity.setOrganization(organizationField.getText()); this.workPlaceEntity.setPosition(positionField.getText()); this.workPlaceEntity.setHrNumber(departmentPhoneNumberField.getText()); } }
package com.vilio.fms.generator.pojo; import java.util.ArrayList; import java.util.List; /** * 合同上的参数 */ public class ContractModelParam { //进件信息的唯一标识 private String bmsLoanCode = ""; //合同抵押方式 01:联抵联押 02:分抵分押 private String mortgageType = ""; //主借款人姓名 private String customerName = ""; //主借款人证件号码 private String customerIdNo = ""; //主借款人地址 private String customerAddress = ""; //主借款人联系方式 private String customerPhone = ""; //借款期限名称 private String loanPeriodName = ""; //放款方式名称 private String creditTypeName = ""; //产品名称 private String productName = ""; //申请金额 private String loanAmount = ""; //意向金 private String intentionMoney = ""; //业务编号 private String businessCode = ""; //放款账户开户行 private String loanAccountBank = ""; //放款账户名 private String loanAccountName = ""; //放款账号 private String loanAccount = ""; //借款人列表 List<ContractUser> borrowerList = new ArrayList<>(); //抵押物列表 List<ContractMortgage> mortgageList = new ArrayList<>(); }
package manju; import java.util.*; public class Solutions{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while(t-- > 0) { //Map<Integer,Integer> map = new HashMap<>(); int[] a = new int[5]; for(int i = 0; i < 5; i++) { a[i] = scan.nextInt(); //map.put(a[i],i); } int[] b = a.clone(); Arrays.sort(a); if(b[0] == a[4]) { System.out.println("Champions"); } else { System.out.println(-1); } } } }
package icehs.science.chapter03; public class Hello_Yoon { public static void main(String[] args) { // TODO Auto-generated method stub } }
package ceasarcypher; import javax.swing.JOptionPane; public class CeasarCypherApp { public static void main(String[] args) { String ptext = JOptionPane.showInputDialog("Enter your text to encrypt."); CeasarCypher encrypted = new CeasarCypher(ptext); encrypted.encrypt(); System.out.println(encrypted.getCyText()); } }
import javax.swing.SwingUtilities; import spi.movieorganizer.display.MovieOrganizer; import exane.osgi.jexlib.data.manager.AbstractExaneDataManager; public class MainClass { public static void main(final String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { AbstractExaneDataManager.setDefaultThreadOwnerPolicy(null); new MovieOrganizer(); } }); } }
#include<stdio.h> int main() { int a,b,sum=0,val=0,i; scanf("%d%d",&a,&b); for(i=1;i<=a;i++) { if(a%i==0) { sum=sum+i; } } for(i=1;i<=b;i++) { if(b%i==0) { val=val+i; } } if(sum/a==val/b) printf("Friendly Pair"); else printf("Not Friendly Pair"); return 0; }
package com.rahul.splitwise.controller; import com.rahul.splitwise.model.User; import com.rahul.splitwise.model.UserWithGiveOrTake; import com.rahul.splitwise.service.IUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * The type User controller. */ @RestController("user") public class UserController { /** * The User service. */ @Autowired IUserService iUserService; /** * Gets all data user need to take. * * @param userId the user id * @return the all data user need to take */ @RequestMapping(value = "/getAllDataUserNeedToTake", method = RequestMethod.GET) public List<UserWithGiveOrTake> getAllDataUserNeedToTake(int userId) { return iUserService.getAllDataUserNeedToTake(userId); } /** * Gets all data user need to give. * * @param userId the user id * @return the all data user need to give */ @RequestMapping(value = "/getAllDataUserNeedToGive", method = RequestMethod.GET) public List<UserWithGiveOrTake> getAllDataUserNeedToGive(int userId) { return iUserService.getAllDataUserNeedToGive(userId); } /** * Add user user. * * @param user the user * @return the user */ @RequestMapping(value = "/addUser", method = RequestMethod.POST) public User addUser(@RequestBody User user) { return iUserService.addUser(user); } /** * Edit user user. * * @param user the user * @return the user */ @RequestMapping(value = "/updateUser", method = RequestMethod.PUT) public User editUser(@RequestBody User user) { return iUserService.editUser(user); } /** * Delete user user. * * @param user the user * @return the user */ @RequestMapping(value = "/deleteUser", method = RequestMethod.DELETE) public User deleteUser(@RequestBody User user) { return iUserService.deleteUser(user); } /** * Gets all user. * * @return the all user */ @RequestMapping(value = "/getAllUser", method = RequestMethod.GET) public List<User> getAllUser() { return iUserService.getAllUser(); } }
package customer.gajamove.com.gajamove_customer; import androidx.appcompat.app.AppCompatActivity; import customer.gajamove.com.gajamove_customer.adapter.BigSidePointAdapter; import customer.gajamove.com.gajamove_customer.adapter.MultiLocationAdapter; import customer.gajamove.com.gajamove_customer.adapter.PriceServiceListAdapter; import customer.gajamove.com.gajamove_customer.adapter.SidePointAdapter; import customer.gajamove.com.gajamove_customer.adapter.StopInfoAdapter; import customer.gajamove.com.gajamove_customer.models.PlaceOrderObj; import customer.gajamove.com.gajamove_customer.models.Prediction; import customer.gajamove.com.gajamove_customer.utils.Constants; import customer.gajamove.com.gajamove_customer.utils.UtilsManager; import cz.msebera.android.httpclient.Header; import android.app.ProgressDialog; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.loopj.android.http.AsyncHttpClient; import com.loopj.android.http.AsyncHttpResponseHandler; import com.loopj.android.http.RequestParams; import com.squareup.picasso.Picasso; import org.json.JSONObject; import java.io.File; import java.util.ArrayList; import java.util.Date; public class ReviewOrder extends BaseActivity { private static final String TAG = "ReviewOrder"; private void includeActionBar(){ ImageView back = findViewById(R.id.backBtn); TextView title = findViewById(R.id.title); title.setVisibility(View.VISIBLE); title.setText(getResources().getString(R.string.review_order)); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } PlaceOrderObj placeOrderObj = null; private TextView service_name_txt,selected_date,pickup_location_txt,extra_km_txt, destination_location_txt,order_total_txt,pick_header_text,destination_header_text; private ImageView vehicle_image; private Button pay_now; private ListView price_list_view,side_point_list,stop_list; private PriceServiceListAdapter priceServiceListAdapter; LinearLayout basic_side_point; StopInfoAdapter stopInfoAdapter; BigSidePointAdapter sidePointAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_review_order); includeActionBar(); Constants.enableSSL(asyncHttpClient); try { placeOrderObj = (PlaceOrderObj) getIntent().getSerializableExtra("order"); service_name_txt = findViewById(R.id.service_name); selected_date = findViewById(R.id.selected_date); side_point_list = findViewById(R.id.side_point_list); stop_list = findViewById(R.id.stop_list); basic_side_point = findViewById(R.id.basic_side_point); ArrayList<Prediction> predictions = new ArrayList<>(); // predictions.add(placeOrderObj.getPickup()); if (placeOrderObj.isMulti()) { for (int i = 0; i < placeOrderObj.getStopList().size(); i++) { predictions.add(placeOrderObj.getStopList().get(i)); } } // predictions.add(placeOrderObj.getDestination()); MultiLocationAdapter multiLocationAdapter = new MultiLocationAdapter(predictions,this); stop_list.setAdapter(multiLocationAdapter); /*stopInfoAdapter = new StopInfoAdapter(this, predictions); stop_list.setAdapter(stopInfoAdapter); */ stop_list.setVisibility(View.VISIBLE); UtilsManager.setListViewHeightBasedOnItems(stop_list); /* if (placeOrderObj.isMulti()) { sidePointAdapter = new BigSidePointAdapter(placeOrderObj.getStopList().size() + 2, this); side_point_list.setAdapter(sidePointAdapter); UtilsManager.setListViewHeightBasedOnChildren(side_point_list); side_point_list.setVisibility(View.VISIBLE); basic_side_point.setVisibility(View.GONE); }*/ /* pickup_location_txt = findViewById(R.id.pickup_location_name); destination_location_txt = findViewById(R.id.destination_location_name); pick_header_text = findViewById(R.id.pickup_header_text); destination_header_text = findViewById(R.id.destination_header_text); */ extra_km_txt = findViewById(R.id.extra_km_label); order_total_txt = findViewById(R.id.vehicle_price_label); price_list_view = findViewById(R.id.services_prices_list); vehicle_image = findViewById(R.id.vehicle_image); Picasso.with(this).load(placeOrderObj.getSelected_service_image()).placeholder(R.drawable.bike).into(vehicle_image); pay_now = findViewById(R.id.place_order_btn); priceServiceListAdapter = new PriceServiceListAdapter(placeOrderObj.getPriceServiceList(), ReviewOrder.this); price_list_view.setAdapter(priceServiceListAdapter); UtilsManager.updateListHeight(this,40,price_list_view,placeOrderObj.getPriceServiceList().size()); pay_now.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //startActivity(new Intent(ReviewOrder.this,PaymentScreen.class)); SaveBumbleRideOrderApi(); /*startActivity(new Intent(ReviewOrder.this,FindDriverScreen.class) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); finish();*/ } }); service_name_txt.setText(placeOrderObj.getService_name()); selected_date.setText(placeOrderObj.getDisplay_date()); // pickup_location_txt.setText(placeOrderObj.getPickup().getLocation_name()); // destination_location_txt.setText(placeOrderObj.getDestination().getLocation_name()); /*try { String[] pick_header = placeOrderObj.getPickup().getLocation_name().split("\\s+"); String[] dest_header = placeOrderObj.getDestination().getLocation_name().split("\\s+"); pick_header_text.setText((pick_header[0] + " " + pick_header[1]).replaceAll(",", "")); destination_header_text.setText((dest_header[0] + " " + dest_header[1]).replaceAll(",", "")); } catch (Exception e) { e.printStackTrace(); }*/ /* starting_price_txt.setText("RM"+placeOrderObj.getStarting_price()); extra_km_txt.setText("RM"+placeOrderObj.getExtra_km());*/ order_total_txt.setText("RM" + placeOrderObj.getOrder_total()); extra_km_txt.setText(placeOrderObj.getExtra_km() + "KM"); } catch (Exception e){ e.printStackTrace(); Toast.makeText(ReviewOrder.this,e.getMessage(),Toast.LENGTH_SHORT).show(); } } private ProgressDialog progressDialog; private void showDialog(String message) { progressDialog = new ProgressDialog(ReviewOrder.this); progressDialog.setMessage(message); progressDialog.setCanceledOnTouchOutside(false); progressDialog.show(); } private void hideDialog() { if (progressDialog!=null) progressDialog.dismiss(); } AsyncHttpClient asyncHttpClient = new AsyncHttpClient(); private void SaveBumbleRideOrderApi() { asyncHttpClient.setConnectTimeout(20000); asyncHttpClient.setTimeout(20000); String customer_id = getSharedPreferences(Constants.PREFS_NAME,MODE_PRIVATE).getString(Constants.PREFS_CUSTOMER_ID,"20"); RequestParams params = new RequestParams(); params.put("service_id", placeOrderObj.getService_id()); params.put("service_type_id", placeOrderObj.getService_type_id()); params.put("key", UtilsManager.getApiKey(ReviewOrder.this)); params.put("customer_id",customer_id); params.put("booking_type","Scheduled"); params.put("payment_type","online"); params.put("request_type","0"); params.put("valid_amount",placeOrderObj.isValid()); params.put("amount",placeOrderObj.getPayment_amount()); if (placeOrderObj.isImmediate()) { params.put("meetup_datetime", placeOrderObj.getDate().toLowerCase().replace("am","").replace("pm","")); }else { params.put("meetup_datetime", placeOrderObj.getDate()); } params.put("meet_location", placeOrderObj.getStopList().get(0).getLocation_name()); params.put("destination", placeOrderObj.getStopList().get(placeOrderObj.getStopList().size()-1).getLocation_name()); if (placeOrderObj.getStopList().size() > 2){ params.put("multiple_locations", "1"); int index = 0; for (int i=0;i<placeOrderObj.getStopList().size();i++){ if (i!=0 && i!=placeOrderObj.getStopList().size()-1) { params.put("stop_name[" + index + "]", placeOrderObj.getStopList().get(i).getLocation_name()); params.put("stop_lat[" + index + "]", placeOrderObj.getStopList().get(i).getLat()); params.put("stop_lng[" + index + "]", placeOrderObj.getStopList().get(i).getLng()); params.put("stop_contact[" + index + "]", "0060" + placeOrderObj.getStopList().get(i).getContact()); params.put("stop_address[" + index + "]", placeOrderObj.getStopList().get(i).getAddress()); index++; } } }else { params.put("multiple_locations", "2"); } params.put("loc_lat", placeOrderObj.getStopList().get(0).getLat()+""); params.put("loc_lng", placeOrderObj.getStopList().get(0).getLng()+""); params.put("dis_lat", placeOrderObj.getStopList().get(placeOrderObj.getStopList().size()-1).getLat()+""); params.put("dis_lng", placeOrderObj.getStopList().get(placeOrderObj.getStopList().size()-1).getLng()+""); params.put("pickup_address", placeOrderObj.getStopList().get(0).getAddress()); params.put("destination_address", placeOrderObj.getStopList().get(placeOrderObj.getStopList().size()-1).getAddress()); params.put("pickup_contact", "0060"+placeOrderObj.getStopList().get(0).getContact()); params.put("destination_contact", "0060"+placeOrderObj.getStopList().get(placeOrderObj.getStopList().size()-1).getContact()); asyncHttpClient.post(ReviewOrder.this, Constants.Host_Address + "orders/place_bumble_order", params, new AsyncHttpResponseHandler() { @Override public void onStart() { super.onStart(); showDialog("Placing Order"); } @Override public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) { try { hideDialog(); String response = new String(responseBody); JSONObject response_object = new JSONObject(response); Log.e(TAG,response); if (response_object.getString("status").equalsIgnoreCase("success")) { String order_id = response_object.getJSONObject("data").getString("order_id"); SharedPreferences sharedPreferences = getSharedPreferences(getString(R.string.FCM_PREF),MODE_PRIVATE); String seleted_language = sharedPreferences.getString(Constants.LANGUAGE_CODE,"en"); String ipay_url = ""; if (response_object.getJSONObject("data").has("url")) { ipay_url = response_object.getJSONObject("data").getString("url"); startActivity(new Intent(ReviewOrder.this, PaymentScreen.class) .putExtra("url", ipay_url+"&lang="+seleted_language+"") .putExtra("order_id", order_id)); return; }else { startActivity(new Intent(ReviewOrder.this, FindDriverScreen.class) .putExtra("order_id", order_id) .putExtra("customer_id", customer_id) ); finish(); } } else { UtilsManager.showAlertMessage(ReviewOrder.this,"","Invalid api response"); } } catch (Exception e) { e.printStackTrace(); } } @Override public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) { try { hideDialog(); String response = new String(responseBody); JSONObject jsonObject = new JSONObject(response); Log.e("bumble_ride_failed",response); } catch (Exception e) { e.printStackTrace(); } } }); } @Override protected void onResume() { super.onResume(); } }
package com.luban.command.highriskengineer.service.impl; import com.luban.command.highriskengineer.service.HighRiskEngineeringService; import org.springframework.stereotype.Service; /** * @ClassName HighRiskEngineeringServiceImpl * @Author yuanlei * @Date 2018/10/16 10:32 * @Version 1.0 **/ @Service("highriskengineeringService") public class HighRiskEngineeringServiceImpl implements HighRiskEngineeringService { @Override public String getHighRiskEngineering() { return null; } }
package exam_module5.demo.controller; import exam_module5.demo.model.Start; import exam_module5.demo.model.Type; import exam_module5.demo.service.StartService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @CrossOrigin(origins = "*") @RestController @RequestMapping(value = "/start/api/v1") public class StartRestController { @Autowired private StartService startService; @GetMapping public ResponseEntity<List<Start>> getStartList(){ List<Start> startList = startService.findAll(); if (startList.isEmpty()){ return new ResponseEntity<>(HttpStatus.NO_CONTENT); } return new ResponseEntity<>(startList, HttpStatus.OK); } }
import java.util.Objects; public class Coca { private Integer tamanho; private Double preco; public Coca (Integer tamanho, Double preco){ this.tamanho = tamanho; this.preco = preco; } @Override public boolean equals(Object coca){ if (this==coca){ return true; } if (coca == null){ return false; } if (coca.getClass() != this.getClass()){ return false; } Coca cocacola = (Coca) coca; return Objects.equals(this.tamanho, cocacola.tamanho) && Objects.equals(this.preco, cocacola.preco); } public Integer getTamanho() { return tamanho; } public void setTamanho(Integer tamanho) { this.tamanho = tamanho; } public Double getPreco() { return preco; } public void setPreco(Double preco) { this.preco = preco; } }
package javabasico.aula17labs; /** * @author Kim Tsunoda * Objetivo O Sr. Manoel Joaquim possui uma grande loja de artigos de R$ 1,99,com cerca de 10 caixas. Para agilizar o cálculo de quanto cada clientedeve pagar ele desenvolveu um * tabela que contém o número de itens que o cliente comprou e ao lado o valor da conta. Desta forma a atendente do caixa precisa apenas contar quantos itens o cliente está levando * e olhar na tabela de preços. Você foi contratado para desenvolver o programa que monta esta tabela de preços, que conterá os preços de 1 até 50 produtos, conforme o exemplo abaixo: */ public class Exercicio23 { public static void main(String[] args) { double valor = 1.99; double total = 0; System.out.println ("Loja Quase Dois Tabela de Preco "); for (int i=1; i<=50; i++) { total = valor * i; System.out.println (i + " - R$ " + total); } } }
package Clases; public class Planes { //atributos private int Norte; private int Sur; private int Cordillera; private int Costa; //constructor public Planes(){ Norte=35000; Sur=45000; Cordillera=20000; Costa=20000; } //accesadores public int getNorte(){ return Norte; } public int getSur(){ return Sur; } public int getCordillera(){ return Cordillera; } public int getCosta(){ return Costa; } }
package com.walkerwang.algorithm.bigcompany; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; /*微信红包 * 题目描述 春节期间小明使用微信收到很多个红包,非常开心。在查看领取红包记录时发现, 某个红包金额出现的次数超过了红包总数的一半。请帮小明找到该红包金额。 写出具体算法思路和代码实现,要求算法尽可能高效。 给定一个红包的金额数组gifts及它的大小n,请返回所求红包的金额。 若没有金额超过总数的一半,返回0。 测试样例: [1,2,3,2,2],5 返回:2 */ public class Tecent04_Gift { public static void main(String[] args) { int[] gifts = { 1, 2, 2, 3, 3, 3 }; int n = 6; System.out.println(new Tecent04_Gift().getValue2(gifts, n)); } public int getValue(int[] gifts, int n) { Map<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < n; i++) { if (map.containsKey(gifts[i])) { map.put(gifts[i], map.get(gifts[i]) + 1); } else { map.put(gifts[i], 1); } } List<Map.Entry<Integer, Integer>> list = new ArrayList<Map.Entry<Integer, Integer>>(map.entrySet()); Collections.sort(list, new Comparator<Map.Entry<Integer, Integer>>() { public int compare(Entry<Integer, Integer> o1, Entry<Integer, Integer> o2) { return o2.getValue().compareTo(o1.getValue()); } }); for (Entry<Integer, Integer> e : list) { System.out.println(e.getKey() + ":" + e.getValue()); } int count1 = list.get(0).getValue(); int count2 = list.get(1).getValue(); if (count1 == count2 || count1 <= n / 2) { return 0; } else { return list.get(0).getKey(); } } /* * 还未看懂 */ public int getValue2(int[] gifts, int n) { int count = 1; int re = gifts[0]; for (int i = 1; i < n; i++) { if (gifts[i] != re) { count--; if (count == 0) { count = 1; re = gifts[i]; } } else { count++; } } System.out.println("count:"+count); count = 0; for (int i = 0; i < n; i++) { if (gifts[i] == re) { count++; } } if (count > n / 2) { return re; } else return 0; } /* * 先排序,如果要求个数过半,则说明中间的的那个数一定是出现次数最多的红包 */ public int getValue3(int[] gifts, int n) { // Arrays.sort(gifts); quicksort(gifts, 0, n-1); int ans = gifts[n / 2]; int num = 0; for (int i = 0; i < gifts.length; i++) { if (gifts[i] == ans) { num++; } } return num <= n / 2 ? 0 : ans; } //快排 public void quicksort(int[] arr, int left, int rihgt){ if(left >= rihgt) return; int tmp = arr[left]; int i = left; int j = rihgt; while(i != j) { while(i<j && arr[j]>=tmp){ j--; } while(i<j && arr[i]<=tmp) { i++; } if(i < j) { // swap(arr, i, j); int a = arr[i]; arr[i] = arr[j]; arr[j] = arr[i]; } } arr[left] = arr[i]; arr[i] = tmp; quicksort(arr, left, i-1); quicksort(arr, i+1, rihgt); } }
package game.square; import core.GameObject; import core.GameObjectManager; import core.Vector2D; import java.util.Vector; public class MatrixSquare extends GameObject{ String[][] s = { {"*","*","*"}, {"*","*"," "}, {" ","*"," "}, {" ","*"," "}, {" ","*","*"} }; Vector<Square> vector; Vector2D velocity; float y; float vX=2.0f; boolean goDown; public MatrixSquare() { vector = new Vector<>(); velocity = new Vector2D(vX,0.0f); for (int i =0;i<s.length;i++){ for (int j=0;j<s[0].length;j++){ if (s[i][j].equalsIgnoreCase("*")){ Square square = GameObjectManager.instance.recycle(Square.class); square.position.set(20*j+10,20*i+10); vector.add(square); } } } this.goDown=false; } @Override public void run() { super.run(); for (Square square: vector){ if (square.position.x <= 0||square.position.x>=400) { if (!this.goDown) { this.y = square.position.y; this.goDown=true; } this.velocity.set(0.0f,3.0f); if (square.position.y==y+15.0f){ this.vX=-this.vX; this.velocity.set(vX,0.0f); this.goDown=false; // System.out.println("rfhvdf"); } break; } } for (Square square: vector){ square.velocity.set(this.velocity); } } }
package com.game.common.server.handler; import com.game.common.exception.GameException; import com.game.common.pb.object.GameObject; /** * @author tangjp * */ public abstract class GameBaseHandler { public abstract GameObject.GamePbObject handlerRequest(GameObject.GamePbObject msg) throws GameException; }
/* * 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 dto; /** * * @author Asus */ public class EmployeeTRReportDTO { private String empid; private String name; private String date; private String reason; public EmployeeTRReportDTO() { } public EmployeeTRReportDTO(String empid, String name, String date, String reason) { this.empid = empid; this.name = name; this.date = date; this.reason = reason; } public String getReason() { return reason; } public void setReason(String reason) { this.reason = reason; } public String getEmpid() { return empid; } public void setEmpid(String empid) { this.empid = empid; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } }
package com.kzw.leisure.contract; import com.kzw.leisure.base.BaseModel; import com.kzw.leisure.base.BasePresenter; import com.kzw.leisure.base.BaseView; import com.kzw.leisure.bean.BookBean; import com.kzw.leisure.bean.BookSourceRule; import com.kzw.leisure.bean.Query; import com.kzw.leisure.bean.SearchBookBean; import io.reactivex.Flowable; /** * author: kang4 * Date: 2019/12/5 * Description: */ public interface BookDetailContract { interface Model extends BaseModel { Flowable<BookBean> getBook(Query query, BookSourceRule sourceRule, SearchBookBean searchBookBean); } interface View extends BaseView { void returnResult(BookBean list); } abstract class Presenter extends BasePresenter<View, Model> { public abstract void getBook(Query query, BookSourceRule sourceRule, SearchBookBean searchBookBean); } }
package com.company; import java.io.PrintStream; import java.util.ArrayList; import java.util.List; public class Document { String title; Photo photo; List<Section> sections = new ArrayList<>(); Document(String _title) { this.title = _title; } public Document setTitle(String _title){ this.title = _title; return this; } public Document setPhoto(String _photoUrl){ this.photo = new Photo(_photoUrl); return this; } public Section addSection(String _sectionTitle){ Section section = new Section(_sectionTitle); sections.add(section); return section; } public Document addSection(Section s){ sections.add(s); return this; } public void writeHTML(PrintStream out) { out.printf("<html>%n"); out.printf("<head>%n"); out.printf("<title>%s</title>%n", title); out.printf("<meta charset=\"UTF-8\">%n"); out.printf("</head>%n"); out.printf("<body>%n"); out.printf("<h1>%s</h1>%n", title); photo.writeHTML(out); sections.forEach(section -> section.writeHTML(out)); out.printf("</body>%n"); out.printf("</html>%n"); } }
package using; import pubsub.OnReceived; import pubsub.Envelop; class Subscriber<T> { int id; public Subscriber(int id) { this.id = id; } @OnReceived private void onReceived(Envelop<T> envelop) { System.out.printf("Subscriber[%d] received: %s%n", id, envelop.open()); } }
package com.duanxr.yith.easy; import com.duanxr.yith.define.listNode.ListNode; /** * @author 段然 2021/3/11 */ public class LiangGeLianBiaoDeDiYiGeGongGongJieDianLcof { /** * English description is not available for the problem. * * 输入两个链表,找出它们的第一个公共节点。 * * 如下面的两个链表: * * * * 在节点 c1 开始相交。 * *   * * 示例 1: * * * * 输入:intersectVal = 8, listA = [4,1,8,4,5], listB = [5,0,1,8,4,5], skipA = 2, skipB = 3 * 输出:Reference of the node with value = 8 * 输入解释:相交节点的值为 8 (注意,如果两个列表相交则不能为 0)。从各自的表头开始算起,链表 A 为 [4,1,8,4,5],链表 B 为 [5,0,1,8,4,5]。在 A 中,相交节点前有 2 个节点;在 B 中,相交节点前有 3 个节点。 *   * * 示例 2: * * * * 输入:intersectVal = 2, listA = [0,9,1,2,4], listB = [3,2,4], skipA = 3, skipB = 1 * 输出:Reference of the node with value = 2 * 输入解释:相交节点的值为 2 (注意,如果两个列表相交则不能为 0)。从各自的表头开始算起,链表 A 为 [0,9,1,2,4],链表 B 为 [3,2,4]。在 A 中,相交节点前有 3 个节点;在 B 中,相交节点前有 1 个节点。 *   * * 示例 3: * * * * 输入:intersectVal = 0, listA = [2,6,4], listB = [1,5], skipA = 3, skipB = 2 * 输出:null * 输入解释:从各自的表头开始算起,链表 A 为 [2,6,4],链表 B 为 [1,5]。由于这两个链表不相交,所以 intersectVal 必须为 0,而 skipA 和 skipB 可以是任意值。 * 解释:这两个链表不相交,因此返回 null。 *   * * 注意: * * 如果两个链表没有交点,返回 null. * 在返回结果后,两个链表仍须保持原有的结构。 * 可假定整个链表结构中没有循环。 * 程序尽量满足 O(n) 时间复杂度,且仅用 O(1) 内存。 * 本题与主站 160 题相同:https://leetcode-cn.com/problems/intersection-of-two-linked-lists/ * */ public class Solution { public ListNode getIntersectionNode(ListNode headA, ListNode headB) { if (headA == null || headB == null) { return null; } int aSize = 1; int bSize = 1; ListNode nodeA = headA; ListNode nodeB = headB; while (nodeA != null) { nodeA = nodeA.next; aSize++; } while (nodeB != null) { nodeB = nodeB.next; bSize++; } nodeA = headA; nodeB = headB; while (aSize > bSize) { nodeA = nodeA.next; aSize--; } while (bSize > aSize) { nodeB = nodeB.next; bSize--; } for (int i = 0; i < aSize; i++) { if (nodeA == nodeB) { return nodeA; } nodeA = nodeA.next; nodeB = nodeB.next; } return null; } } }
package ru.molkov.dao; import java.util.List; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Repository; import ru.molkov.core.ModelWorker; import ru.molkov.model.TakenItem; @Repository public class TakenItemDaoImpl extends ModelWorker<TakenItem> implements TakenItemDao { public TakenItemDaoImpl() { super(TakenItem.class); } @SuppressWarnings("unchecked") public List<TakenItem> getTakenItemsByUser(Integer userId) { return getSession().createCriteria(TakenItem.class) .add(Restrictions.eq("takenItemPK.userId", userId)).list(); } }
package com.space.smarthive.home; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.view.View; import com.gyf.immersionbar.ImmersionBar; import com.space.smarthive.R; import com.space.smarthive.databinding.ActivityHomeBinding; import com.space.smarthive.f_feed.InfoFragment; import com.space.smarthive.f_myhives.HivesFragment; import com.space.smarthive.f_user.UserFragment; import com.space.smarthive.utils.ColorUtil; import java.util.ArrayList; import java.util.List; import me.majiajie.pagerbottomtabstrip.NavigationController; public class HomeActivity extends AppCompatActivity { private static final String TAG = "HomeActivity"; private static final int OPEN_BLE = 321; private ActivityHomeBinding viewBinding; private NavigationController bottomStrip; private HomeFragsAdapter pagerAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_home); viewBinding = ActivityHomeBinding.inflate(getLayoutInflater()); setContentView(viewBinding.getRoot()); ImmersionBar.with(this) .statusBarColor(R.color.darkWhite) .navigationBarColor(R.color.darkWhite) .fitsSystemWindows(true) .autoDarkModeEnable(true) .init(); initViews(); initFragments(); } private void initViews(){ bottomStrip = viewBinding.bottomStripMain.material() .addItem(R.mipmap.main_hives, "蜂箱", ColorUtil.getColor(this, R.color.main_bottom_check_color)) .addItem(R.mipmap.main_info, "资讯", ColorUtil.getColor(this, R.color.main_bottom_check_color)) .addItem(R.mipmap.main_user, "我的", ColorUtil.getColor(this, R.color.main_bottom_check_color)) .setDefaultColor( ColorUtil.getColor(this, R.color.main_bottom_default_color)) .enableAnimateLayoutChanges() .build(); View.OnClickListener clickListener = new View.OnClickListener() { @Override public void onClick(View v) { switch (v.getId()){ } } }; pagerAdapter = new HomeFragsAdapter(getSupportFragmentManager(), HomeFragsAdapter.BEHAVIOR_SET_USER_VISIBLE_HINT); viewBinding.pagerMain.setAdapter(pagerAdapter); bottomStrip.setupWithViewPager(viewBinding.pagerMain); } private void initFragments(){ List<Fragment> frags = new ArrayList<>(); Fragment f1 = new HivesFragment(); Fragment f2 = new InfoFragment(); Fragment f3 = new UserFragment(); frags.add(f1); frags.add(f2); frags.add(f3); pagerAdapter.setData(frags); } @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case OPEN_BLE: Log.i(TAG, "onActivityResult: "+resultCode); break; } } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { Intent i = new Intent(Intent.ACTION_MAIN); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addCategory(Intent.CATEGORY_HOME); startActivity(i); return true; } return super.onKeyDown(keyCode, event); } }
package game; import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.HashMap; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import castle.Castle; import castle.Room; import view.View; public class Game { private HashMap<String, Handler> handlers = new HashMap<String, Handler>(); private Castle theCastle; private View theView; private String cmdContext; private boolean isStart = false; public Game() { handlers.put("go", new Handler(){ @Override public void doCmd(String word) { goRoom(word); } }); theView = new View(); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setTitle("CastleGame"); frame.add(theView,BorderLayout.SOUTH); JPanel panel1 = new JPanel(); JButton btnStart = new JButton("开始游戏"); btnStart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { start(); } }); JButton btnStop = new JButton("结束游戏"); btnStop.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { bye(); } }); JButton btnHelp = new JButton("帮助"); btnHelp.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showHelp(); } }); panel1.setLayout(new FlowLayout(FlowLayout.LEFT,5,5)); panel1.add(btnStart); panel1.add(btnStop); panel1.add(btnHelp); frame.add(panel1,BorderLayout.NORTH); JPanel panel2 = new JPanel(); JTextField cmdInput = new JTextField(20); JButton btnStep = new JButton("执行"); btnStep.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cmdContext = cmdInput.getText(); step(); } }); panel2.setLayout(new FlowLayout(FlowLayout.LEFT,5,5)); panel2.add(cmdInput); panel2.add(btnStep); frame.add(panel2,BorderLayout.CENTER); frame.pack(); frame.setVisible(true); frame.setLocationRelativeTo(null); } private void start(){ if(isStart){ theView.displayInfo(""); theView.displayInfo("游戏已经开始,无需再次点击'开始游戏'按钮。"); } else { theCastle = new Castle(); isStart = true; printWelcome(); } } private void printWelcome() { theView.displayInfo(""); theView.displayInfo("欢迎来到城堡!"); theView.displayInfo("这是一个超级无聊的游戏。"); theView.displayInfo("如果需要帮助,请点击'帮助'按钮 。"); showPrompt(); } public void showPrompt(){ theView.displayInfo(""); theView.displayInfo("现在你在" + theCastle.getCurrentRoom()); theView.displayInfo("出口有:"); theView.displayInfo(theCastle.getCurrentRoom().getExitDesc()); } public void showHelp(){ if(!isStart) { theView.displayInfo(""); theView.displayInfo("你可以先点击'开始游戏'按钮。"); theView.displayInfo("然后在输入框中输入go命令并点击执行,"); theView.displayInfo("如:\tgo east"); theView.displayInfo("如果你不想玩了,可以点击'结束游戏'按钮。"); } else { theView.displayInfo(""); theView.displayInfo("迷路了吗?你可以在输入框中输入go命令并点击执行,"); theView.displayInfo("如:\tgo east"); theView.displayInfo("如果你不想玩了,可以点击'结束游戏'按钮。"); } } public void bye(){ if(isStart) { isStart = false; theView.displayInfo(""); theView.displayInfo("感谢您的光临,再见!"); } else { theView.displayInfo(""); theView.displayInfo("你还没有开始游戏,你可以点击'开始游戏'按钮进入游戏。"); } } public void step(){ if(isStart) { String line = cmdContext; String[] words = line.split(" "); Handler handler = handlers.get(words[0]); String value = ""; if(words.length>1) value = words[1]; if(handler != null){ handler.doCmd(value); } } else { theView.displayInfo(""); theView.displayInfo("你还没有开始游戏,你可以点击'开始游戏'按钮进入游戏。"); } } // public void play(){ // Scanner in = new Scanner(System.in); // while ( true ) { // String line = in.nextLine(); // String[] words = line.split(" "); // Handler handler = handlers.get(words[0]); // String value = ""; // if(words.length>1) // value = words[1]; // if(handler != null){ // handler.doCmd(value); // if(handler.isBye()) // break; // } // } // in.close(); // } // 以下为用户命令 public void goRoom(String direction) { Room nextRoom = theCastle.goRoom(direction); if (nextRoom == null) { theView.displayInfo(""); theView.displayInfo("那里没有门!"); } else { showPrompt(); } } public static void main(String[] args) { Game game = new Game(); } }
package com.finix.dao.impl; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.sql.Blob; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Types; import java.text.DateFormat; import java.text.DecimalFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; import javax.imageio.ImageIO; import org.apache.commons.io.FileUtils; import org.apache.log4j.Logger; import org.apache.struts2.dispatcher.SessionMap; import org.apache.struts2.dojo.components.Tree; import com.finix.bean.BillingDetailsBean; import com.finix.bean.ProducerBean; import com.finix.bean.ScreenDetailBean; import com.finix.bean.TemplateBean; import com.finix.bean.TheaterDetailBean; import com.finix.bean.TheaterOwnerBean; import com.finix.bean.TicketCounterBean; import com.finix.dao.ITheaterOwnerDao; import com.finix.dao.utils.ConnectionManager; import com.finix.rabbitmq.Ticket_QueueMain; import com.finix.utils.MobileRandomNum; import com.finix.utils.MyStringRandomGen; import com.finix.utils.UniqueId; public class TheaterOwnerDaoImpl implements ITheaterOwnerDao { private static ConnectionManager connectionManager = ConnectionManager.getConnectionManager(); final Logger debugLog = Logger.getLogger("debugLogger"); private SessionMap<String, Object> sessionMap; private void catchMethodLogger(String str, Exception e) { long startTime1; startTime1 = System.currentTimeMillis(); Date date = new Date(startTime1); DateFormat formatter = new SimpleDateFormat("HH:mm:ss:SSS"); String dateFormatted = formatter.format(date); debugLog.error("***************" ); debugLog.error("Theater Owner Dao Impl :Method Name "+str ); debugLog.error("Exception Occured Time " +dateFormatted); debugLog.error("Type of Exception"+e); debugLog.error("***************" ); } //setRegistrationDetails public TheaterOwnerBean setRegistrationDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; try { conn = connectionManager.getConnection(); String mail_pin = ""; String sms_pin = ""; mail_pin = MyStringRandomGen.generateRandomString(); sms_pin = MobileRandomNum.mobileRandomNum(); String id=""; String uniqueId=UniqueId.getAckId(id); uniqueId = "TO"+uniqueId; String sql = "{CALL Ticket_TO_setRegistrationDetails(?,?,?,?,?,?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setString(1, theaterOwnerBean.getTheater_owner_first_name()); cl.setString(2, theaterOwnerBean.getTheater_owner_last_name()); cl.setString(3, theaterOwnerBean.getTheater_owner_email()); cl.setString(4, theaterOwnerBean.getTheater_owner_mobile()); cl.setString(5, theaterOwnerBean.getPassowrd()); cl.setString(6, mail_pin); cl.setString(7, sms_pin); cl.registerOutParameter(8, Types.INTEGER); cl.setString(9, uniqueId); cl.execute(); theaterOwnerBean.setTheater_owner_id(cl.getInt(8)); theaterOwnerBean.setMail_pin(mail_pin); theaterOwnerBean.setSms_pin(sms_pin); theaterOwnerBean.setStatus("success"); theaterOwnerBean.setMail_pin_status("not_success"); theaterOwnerBean.setSms_pin_status("not_success"); theaterOwnerBean.setUnique_id(uniqueId); } catch (Exception e) { e.printStackTrace(); String str = "setRegistrationDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getRegistrationMailTemplate public TemplateBean getRegistrationMailTemplate(TemplateBean templateBean) throws Exception { Connection conn = null; CallableStatement cl = null; int i = 1; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getRegistrationMailTemplate(?)}"; cl = conn.prepareCall(sql); cl.setString(1, "mail_activation"); boolean result = cl.execute(); while(result) { ResultSet rs = cl.getResultSet(); if(i==1) { while(rs.next()) { templateBean.setTemplate(rs.getString("template_value")); } } i++; result = cl.getMoreResults(); } } catch (Exception e) { e.printStackTrace(); String str = "getRegistrationMailTemplate"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return templateBean; } //checkTheaterOwnerEmail public String checkTheaterOwnerEmail(String email) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; String status = ""; try { conn = connectionManager.getConnection(); String sql = "SELECT email FROM login WHERE email = ?"; ps = conn.prepareStatement(sql); ps.setString(1, email); rs = ps.executeQuery(); if(rs.next()) { status = "Not_Available"; } else { status = "Available"; } } catch (Exception e) { e.printStackTrace(); String str = "getRegistrationMailTemplate"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return status; } //setAccountActivationDetails - Created by hemalatha - 19-07-2018 public TheaterOwnerBean setAccountActivationDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_setAccountActivationDetails(?,?,?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setString(1, theaterOwnerBean.getMail_pin()); cl.setString(2, theaterOwnerBean.getSms_pin()); cl.setInt(3, theaterOwnerBean.getTheater_owner_id()); cl.registerOutParameter(4, Types.VARCHAR); cl.registerOutParameter(5, Types.VARCHAR); cl.registerOutParameter(6, Types.VARCHAR); cl.execute(); theaterOwnerBean.setMail_pin_status(cl.getString(4)); theaterOwnerBean.setSms_pin_status(cl.getString(5)); theaterOwnerBean.setStatus(cl.getString(6)); } catch (Exception e) { e.printStackTrace(); String str = "setAccountActivationDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //setMailDetails public TheaterOwnerBean setMailDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; try { conn = connectionManager.getConnection(); String mail_pin = ""; mail_pin = MyStringRandomGen.generateRandomString(); String sql = "{CALL Ticket_TO_setMailDetails(?,?,?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.setString(2, mail_pin); cl.registerOutParameter(3, Types.VARCHAR); cl.registerOutParameter(4, Types.VARCHAR); cl.registerOutParameter(5, Types.VARCHAR); cl.registerOutParameter(6, Types.VARCHAR); cl.execute(); theaterOwnerBean.setTheater_owner_first_name(cl.getString(3)); theaterOwnerBean.setTheater_owner_last_name(cl.getString(4)); theaterOwnerBean.setTheater_owner_email(cl.getString(5)); theaterOwnerBean.setMail_pin(cl.getString(6)); } catch (Exception e) { e.printStackTrace(); String str = "setMailDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //setSMSDetails public TheaterOwnerBean setSMSDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; try { conn = connectionManager.getConnection(); String sms_pin = ""; sms_pin = MobileRandomNum.mobileRandomNum(); String sql = "{CALL Ticket_TO_setSMSDetails(?,?,?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.setString(2, sms_pin); cl.registerOutParameter(3, Types.VARCHAR); cl.registerOutParameter(4, Types.VARCHAR); cl.registerOutParameter(5, Types.VARCHAR); cl.registerOutParameter(6, Types.VARCHAR); cl.execute(); theaterOwnerBean.setTheater_owner_first_name(cl.getString(3)); theaterOwnerBean.setTheater_owner_last_name(cl.getString(4)); theaterOwnerBean.setTheater_owner_mobile(cl.getString(5)); theaterOwnerBean.setSms_pin(cl.getString(6)); } catch (Exception e) { e.printStackTrace(); String str = "setMailDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getTheaterOwnerDetails public TheaterOwnerBean getTheaterOwnerDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; int i =1; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getTheaterOwnerDetails(?,?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.registerOutParameter(2, Types.VARCHAR); cl.registerOutParameter(3, Types.VARCHAR); cl.registerOutParameter(4, Types.VARCHAR); cl.registerOutParameter(5, Types.VARCHAR); boolean res = cl.execute(); while(res) { ResultSet rs = cl.getResultSet(); if(i==1) { while(rs.next()) { theaterOwnerBean.setTheater_owner_first_name(rs.getString("theater_owner_first_name")); theaterOwnerBean.setTheater_owner_last_name(rs.getString("theater_owner_last_name")); theaterOwnerBean.setTheater_owner_email(rs.getString("theater_owner_email")); theaterOwnerBean.setTheater_owner_mobile(rs.getString("theater_owner_mobile")); theaterOwnerBean.setTheater_owner_address(rs.getString("theater_owner_address")); theaterOwnerBean.setState_name(cl.getString(2)); theaterOwnerBean.setCity_name(cl.getString(3)); theaterOwnerBean.setProfile_path(cl.getString(4)); theaterOwnerBean.setInbox_count(Integer.parseInt(cl.getString(5))); if(rs.getString("mail_pin_status").equals("Y")) { theaterOwnerBean.setMail_pin_status("success"); } else { theaterOwnerBean.setMail_pin_status("not_success"); } if(rs.getString("sms_pin_status").equals("Y")) { theaterOwnerBean.setSms_pin_status("success"); } else { theaterOwnerBean.setSms_pin_status("not_success"); } } } i++; res = cl.getMoreResults(); } } catch (Exception e) { e.printStackTrace(); String str = "getTheaterOwnerDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getProfileViewPage public TheaterOwnerBean getProfileViewPage(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; ResultSet rs = null; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getProfileViewPage(?,?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.registerOutParameter(2, Types.VARCHAR); cl.registerOutParameter(3, Types.VARCHAR); cl.registerOutParameter(4, Types.VARCHAR); cl.registerOutParameter(5, Types.VARCHAR); cl.execute(); rs = cl.executeQuery(); while(rs.next()) { theaterOwnerBean.setTheater_owner_id(rs.getInt("theater_owner_id")); theaterOwnerBean.setTheater_owner_first_name(rs.getString("theater_owner_first_name")); theaterOwnerBean.setTheater_owner_last_name(rs.getString("theater_owner_last_name")); theaterOwnerBean.setTheater_owner_email(rs.getString("theater_owner_email")); theaterOwnerBean.setTheater_owner_mobile(rs.getString("theater_owner_mobile")); theaterOwnerBean.setTheater_owner_address(rs.getString("theater_owner_address")); theaterOwnerBean.setState_id(rs.getInt("theater_owner_state_id")); theaterOwnerBean.setState_name(cl.getString(2)); theaterOwnerBean.setCity_id(rs.getInt("theater_owner_city_id")); theaterOwnerBean.setDistrict_name(cl.getString(4)); theaterOwnerBean.setDistrict_id(rs.getInt("theater_owner_district_id")); theaterOwnerBean.setCity_name(cl.getString(3)); String profilePath = cl.getString(5); if(profilePath != null) { theaterOwnerBean.setStatus("Success"); theaterOwnerBean.setProfile_path(profilePath); } else { theaterOwnerBean.setStatus("notSuccess"); } } } catch (Exception e) { e.printStackTrace(); String str = "getProfileViewPage"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getStateDetail - Created by Nachimuthu 25-07-2018 public Map<Integer, String> getStateDetail() throws Exception { Connection conn=null; PreparedStatement ps=null; ResultSet rs=null; Map<Integer,String> stateMap=new HashMap<Integer, String>(); try{ conn=connectionManager.getConnection(); String sql = "SELECT state_id,state_name FROM state"; ps = conn.prepareStatement(sql); rs = ps.executeQuery(); while(rs.next()) { stateMap.put(rs.getInt("state_id"), rs.getString("state_name")); } } catch(Exception e) { e.printStackTrace(); String str = "getStateDetail"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return stateMap; } //getCityDetails - Created by Nachimuthu 25-07-2018 public Map<Integer, String> getCityDetails() throws Exception { Connection conn=null; PreparedStatement ps=null; ResultSet rs=null; Map<Integer,String> cityMap=new HashMap<Integer, String>(); try { conn=connectionManager.getConnection(); String city="SELECT city_id,city_name FROM city"; ps=conn.prepareStatement(city); rs=ps.executeQuery(); while(rs.next()) { cityMap.put(rs.getInt("city_id"), rs.getString("city_name")); } } catch(Exception e) { e.printStackTrace(); String str = "getCityDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return cityMap; } //getUpdatePageDetails - Created by Nachimuthu 25-07-2018 public TheaterOwnerBean getUpdatePageDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; PreparedStatement ps1 = null; ResultSet rs1 = null; PreparedStatement ps2 = null; try { conn = connectionManager.getConnection(); String sql = "UPDATE theater_owner_detail SET theater_owner_first_name=?,theater_owner_last_name=?,theater_owner_mobile=?,theater_owner_address=?,theater_owner_state_id=?,theater_owner_city_id=?,theater_owner_district_id = ? WHERE theater_owner_id=?"; ps = conn.prepareStatement(sql); ps.setString(1, theaterOwnerBean.getTheater_owner_first_name()); ps.setString(2, theaterOwnerBean.getTheater_owner_last_name()); ps.setString(3, theaterOwnerBean.getTheater_owner_mobile()); ps.setString(4, theaterOwnerBean.getTheater_owner_address()); ps.setInt(5, theaterOwnerBean.getState_id()); ps.setInt(6, theaterOwnerBean.getCity_id()); ps.setInt(7, theaterOwnerBean.getDistrict_id()); ps.setInt(8, theaterOwnerBean.getTheater_owner_id()); ps.executeUpdate(); if(theaterOwnerBean.getFile_name().equals("") || theaterOwnerBean.getFile_name() == null) { String sql1 = "SELECT profile_path FROM theater_owner_profile_detail WHERE theater_owner_id = ?"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs1 = ps1.executeQuery(); if(rs1.next()) { theaterOwnerBean.setProfile_path(rs1.getString("profile_path")); } theaterOwnerBean.setStatus("Success"); }else { Object path=theaterOwnerBean.getPath(); String strpath=(String)path; String fileName = theaterOwnerBean.getFile_name(); String folderName = "owner-profile-images"; String docPath = strpath+"/"+theaterOwnerBean.getTheater_owner_first_name()+"-"+theaterOwnerBean.getTheater_owner_id()+"//"+folderName+"//"; File pathFile = new File(docPath); if(pathFile.isDirectory()) { }else { pathFile.mkdir(); } File createFile = new File(docPath+fileName); FileUtils.copyFile(theaterOwnerBean.getProfile_photo(), createFile); int i = 0; String sql1 = "SELECT profile_path FROM theater_owner_profile_detail WHERE theater_owner_id = ?"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs1 = ps1.executeQuery(); if(rs1.next()) { String sql2 = "UPDATE theater_owner_profile_detail SET profile_path = ? WHERE theater_owner_id = ?"; ps2 = conn.prepareStatement(sql2); ps2.setString(1, docPath+fileName); ps2.setInt(2, theaterOwnerBean.getTheater_owner_id()); i = ps2.executeUpdate(); } else { String sql2 = "INSERT INTO theater_owner_profile_detail(profile_path,theater_owner_id,created_on) VALUES(?,?,now())"; ps2 = conn.prepareStatement(sql2); ps2.setString(1, docPath+fileName); ps2.setInt(2, theaterOwnerBean.getTheater_owner_id()); i = ps2.executeUpdate(); } if(i > 0){ theaterOwnerBean.setStatus("Success"); theaterOwnerBean.setProfile_path(docPath+fileName); } else{ theaterOwnerBean.setStatus("Failure"); } } } catch (Exception e) { e.printStackTrace(); String str = "getUpdatePageDetails"; catchMethodLogger(str, e); } finally { if (conn != null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //profile_images public Map<Integer, byte[]> profile_images(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; ResultSet rs = null; Map<Integer, byte[]> imageMap = new HashMap<Integer,byte[]>(); try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_profile_images(?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.execute(); rs = cl.executeQuery(); if(rs.next()) { imageMap.put(rs.getInt("theater_owner_id"), rs.getBytes("profile")); } } catch(Exception e) { e.printStackTrace(); String str = "Thetare owner Dao Impl : profile_images"; catchMethodLogger(str, e); } finally { if (conn != null) { connectionManager.releaseConnection(conn); } } return imageMap; } //checkOldPassword -created by Babu25-7-2018 public String checkOldPasswordAvailable(String oldPassword, TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; String status = null; try { conn = connectionManager.getConnection(); String sql="SELECT email FROM login WHERE theater_owner_id=? AND PASSWORD=?"; ps=conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); ps.setString(2,oldPassword); rs=ps.executeQuery(); if(rs.next()) { status = "match"; } else { status = "misMatch"; } } catch(Exception e) { e.printStackTrace(); String str = "Thetare owner Dao Impl :checkOldPasswordAvailable"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return status; } //updatePassWordDetails -created by Babu25-7-2018 public TheaterOwnerBean updatePasswordDetails( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { conn=connectionManager.getConnection(); String select="SELECT password FROM login WHERE theater_owner_id=? AND password=?"; ps=conn.prepareStatement(select); ps.setInt(1,theaterOwnerBean.getTheater_owner_id()); ps.setString(2, theaterOwnerBean.getOld_password()); rs=ps.executeQuery(); if(rs.next()) { String update="update login set password=? where theater_owner_id=?"; ps=conn.prepareStatement(update); ps.setString(1, theaterOwnerBean.getPassword()); ps.setInt(2, theaterOwnerBean.getTheater_owner_id()); int s=ps.executeUpdate(); if(s==1) { theaterOwnerBean.setStatus("success"); } } else { theaterOwnerBean.setStatus("error"); } } catch(Exception e) { e.printStackTrace(); String str = "updatePasswordDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getStateWiseCityDetails - Created by Nachimuthu 25-07-2018 public TheaterOwnerBean getStateWiseCityDetails( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; Map<Integer, String> cityMap = new HashMap<Integer,String>(); try { conn = connectionManager.getConnection(); String sql = "SELECT district_id,district_name FROM district WHERE state_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getState_id()); rs = ps.executeQuery(); while(rs.next()) { cityMap.put(rs.getInt("district_id"), rs.getString("district_name")); } theaterOwnerBean.setCityMap(cityMap); } catch (Exception e) { e.printStackTrace(); String str = "getStateWiseCityDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getTheaterScreenDetails public TheaterOwnerBean getTheaterScreenDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; PreparedStatement ps = null; ResultSet rs = null; PreparedStatement ps1 = null; ResultSet rs1 = null; PreparedStatement ps2 = null; ResultSet rs2 = null; PreparedStatement ps3 = null; Map<Integer, String> theaterMap = new HashMap<Integer,String>(); Map<Integer, String> categoryMap = new HashMap<Integer,String>(); Map<Integer, String> screenMap = new HashMap<Integer,String>(); int i = 1; try { conn = connectionManager.getConnection(); /* String sql = "{CALL Ticket_TO_getTheaterScreenDetails(?,?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.registerOutParameter(2, Types.INTEGER); cl.registerOutParameter(3, Types.INTEGER); cl.registerOutParameter(4, Types.VARCHAR); cl.registerOutParameter(5, Types.VARCHAR); boolean result = cl.execute(); if(result) { theaterOwnerBean.setTheater_id(cl.getInt(2)); theaterOwnerBean.setScreen_id(cl.getInt(3)); theaterOwnerBean.setTheater_name(cl.getString(4)); theaterOwnerBean.setScreen_layout_path(cl.getString(5)); theaterOwnerBean.setStatus("success"); while(result) { ResultSet rs = cl.getResultSet(); if(i==1) { while(rs.next()) { theaterMap.put(rs.getInt("theater_id"), rs.getString("theater_name")); } } theaterOwnerBean.setTheaterMap(theaterMap); if(i==2) { while(rs.next()) { screenMap.put(rs.getInt("screen_id"), rs.getString("screen_name")); } } theaterOwnerBean.setScreenMap(screenMap); if(i==3) { while(rs.next()) { categoryMap.put(rs.getInt("seat_category_id"), rs.getString("seat_category")); } } theaterOwnerBean.setTicketCategoryMap(categoryMap); i++; result = cl.getMoreResults(); } } else { theaterOwnerBean.setStatus("failure"); }*/ String theaterId = ""; String screenId = ""; String sql = "SELECT theater_id,theater_name FROM theater_detail WHERE theater_owner_id = ? AND STATUS = 'Active' AND is_deleted = 'N'"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs = ps.executeQuery(); while(rs.next()) { screenMap = new HashMap<Integer,String>(); int n = 0; int j = 0; String sql1 = "SELECT screen_id,screen_name FROM screen_detail WHERE theater_id = ? AND STATUS = 'Active' AND is_deleted = 'N'"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, rs.getInt("theater_id")); rs1 = ps1.executeQuery(); while(rs1.next()) { String sql2 = "SELECT screen_floor_plan_id FROM screen_floor_plan_detail WHERE screen_id = ?"; ps2 = conn.prepareStatement(sql2); ps2.setInt(1, rs1.getInt("screen_id")); rs2 = ps2.executeQuery(); if(rs2.next()) { } else{ screenMap.put(rs1.getInt("screen_id"), rs1.getString("screen_name")); screenId += rs1.getInt("screen_id")+","; j = 1; } n = 1; } if(n == 1 && j == 1){ theaterMap.put(rs.getInt("theater_id"), rs.getString("theater_name")); theaterId += rs.getInt("theater_id")+","; } } if(theaterId != "" && screenId != ""){ theaterId = theaterId.substring(0 ,theaterId.length()-1); screenId = screenId.substring(0 ,screenId.length()-1); String sql3 = "SELECT theater_id,theater_name FROM theater_detail WHERE theater_id IN ("+theaterId+") ORDER BY theater_id DESC LIMIT 1"; ps1 = conn.prepareStatement(sql3); rs1 = ps1.executeQuery(); if(rs1.next()) { theaterOwnerBean.setTheater_id(rs1.getInt("theater_id")); theaterOwnerBean.setTheater_name(rs1.getString("theater_name")); String sql6 = "SELECT screen_id,screen_layout_path FROM screen_detail WHERE theater_id = ? AND screen_id IN("+screenId+") ORDER BY screen_id DESC LIMIT 1"; ps2 = conn.prepareStatement(sql6); ps2.setInt(1, theaterOwnerBean.getTheater_id()); rs2 = ps2.executeQuery(); if(rs2.next()) { theaterOwnerBean.setScreen_id(rs2.getInt("screen_id")); theaterOwnerBean.setScreen_layout_path(rs2.getString("screen_layout_path")); } } /*String sql6 = "SELECT screen_id,screen_name FROM screen_detail WHERE theater_id = ?"; ps2 = conn.prepareStatement(sql6); ps2.setInt(1, theaterOwnerBean.getTheater_id()); rs2 = ps2.executeQuery(); while(rs2.next()) { screenMap.put(rs2.getInt("screen_id"), rs2.getString("screen_name")); }*/ theaterOwnerBean.setStatus("success"); } else{ theaterOwnerBean.setStatus("failure"); } String sql4 = "SELECT seat_category_id,seat_category FROM seat_category"; ps = conn.prepareStatement(sql4); rs = ps.executeQuery(); while(rs.next()) { categoryMap.put(rs.getInt("seat_category_id"), rs.getString("seat_category")); } theaterOwnerBean.setScreenMap(screenMap); theaterOwnerBean.setTheaterMap(theaterMap); theaterOwnerBean.setTicketCategoryMap(categoryMap); } catch (Exception e) { e.printStackTrace(); String str = "getTheaterScreenDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getScreenImage public Map<Integer, byte[]> getScreenImage(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; Map<Integer, byte[]> imageMap = new HashMap<Integer,byte[]>(); try { conn = connectionManager.getConnection(); String sql = "SELECT screen_id,screen_layout FROM screen_detail WHERE screen_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getScreen_id()); rs = ps.executeQuery(); while(rs.next()) { imageMap.put(rs.getInt("screen_id"), rs.getBytes("screen_layout")); } } catch (Exception e) { e.printStackTrace(); String str = "getScreenImage"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return imageMap; } //getTheaterAgainstScreen public TheaterOwnerBean getTheaterAgainstScreen(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; ResultSet rs = null; Map<Integer, String> screenMap = new HashMap<Integer,String>(); try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getTheaterAgainstScreen(?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_id()); cl.registerOutParameter(2, Types.INTEGER); cl.registerOutParameter(3, Types.VARCHAR); cl.registerOutParameter(4, Types.VARCHAR); cl.execute(); rs = cl.executeQuery(); theaterOwnerBean.setScreen_id(cl.getInt(2)); theaterOwnerBean.setTheater_name(cl.getString(3)); theaterOwnerBean.setScreen_layout_path(cl.getString(4)); while(rs.next()) { screenMap.put(rs.getInt("screen_id"), rs.getString("screen_name")); } theaterOwnerBean.setScreenMap(screenMap); } catch (Exception e) { e.printStackTrace(); String str = "getTheaterAgainstScreen"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //setTheaterWiseScreenDetailSubmit public TheaterOwnerBean setTheaterWiseScreenDetailSubmit(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; TheaterDetailBean theaterDetailBean = new TheaterDetailBean(); ArrayList<TheaterDetailBean> theaterDetailList = new ArrayList<TheaterDetailBean>(); Map<Integer, String> seatCategoryMap = new HashMap<Integer,String>(); Map<Integer, String> ticketCategoryMap = new HashMap<Integer,String>(); try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_setTheaterWiseScreenDetailSubmit(?,?,?,?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.setInt(2, theaterOwnerBean.getTheater_id()); cl.setInt(3, theaterOwnerBean.getScreen_id()); cl.setInt(4, theaterOwnerBean.getPassage_count()); cl.setInt(5, theaterOwnerBean.getCategory_from_id()); cl.setInt(6, theaterOwnerBean.getCategory_to_id()); cl.setInt(7, theaterOwnerBean.getOrder_id()); boolean result = cl.execute(); int i = 1; while(result) { ResultSet rs = cl.getResultSet(); if(i==1) { while(rs.next()) { theaterDetailBean = new TheaterDetailBean(); theaterDetailBean.setCategory_name(rs.getString("catryName")); theaterDetailBean.setCategory_id(rs.getInt("catId")); theaterDetailBean.setCol_count(rs.getInt("cnt")); theaterDetailList.add(theaterDetailBean); } } theaterOwnerBean.setTheaterRowList(theaterDetailList); if(i==2) { while(rs.next()) { ticketCategoryMap.put(rs.getInt("seat_category_id"), rs.getString("seat_category")); } } theaterOwnerBean.setTicketCategoryMap(ticketCategoryMap); if(i==3) { while(rs.next()) { seatCategoryMap.put(rs.getInt("seating_order_id"), rs.getString("seating_order")); } } theaterOwnerBean.setSeatCategoryMap(seatCategoryMap); i++; result = cl.getMoreResults(); } } catch (Exception e) { e.printStackTrace(); String str = "setTheateriseScreenDetailSubmit"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //setTheaterSeatCountDetailSubmit public TheaterOwnerBean setTheaterSeatCountDetailSubmit(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_setTheaterSeatCountDetailSubmit(?,?,?,?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setString(1, theaterOwnerBean.getSeatCountDetail()); cl.setString(2, theaterOwnerBean.getSeatCategoryDetail()); cl.setString(3, "-"); cl.setString(4, "_"); cl.setInt(5, theaterOwnerBean.getTheater_id()); cl.setInt(6, theaterOwnerBean.getScreen_id()); cl.setInt(7, theaterOwnerBean.getTheater_owner_id()); boolean res = cl.execute(); if(res) { theaterOwnerBean.setStatus("success"); } else { theaterOwnerBean.setStatus("failure"); } } catch (Exception e) { e.printStackTrace(); String str = "setTheaterSeatCountDetailSubmit"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getSeatingArrangementDetails public TheaterOwnerBean getSeatingArrangementDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; PreparedStatement ps1 = null; ResultSet rs = null; ResultSet rs1 = null; /*ArrayList<TheaterDetailBean> finalList = new ArrayList<TheaterDetailBean>(); ArrayList<ScreenDetailBean> subList = new ArrayList<ScreenDetailBean>();*/ ArrayList<TheaterDetailBean> seatcategoryPriceList = new ArrayList<TheaterDetailBean>(); TheaterDetailBean theaterDetailBean = null; TicketCounterBean ticketCounterBean = null; ScreenDetailBean screenDetailBean = null; DecimalFormat df = new DecimalFormat("#.##"); try { conn = connectionManager.getConnection(); String sql2 = "SELECT list_seat_category_price_id,seat_category_name,price FROM list_seat_category_price_detail WHERE theater_id =? AND screen_id=?"; ps = conn.prepareStatement(sql2); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, theaterOwnerBean.getScreen_id()); rs = ps.executeQuery(); while(rs.next()){ theaterDetailBean = new TheaterDetailBean(); theaterDetailBean.setSeat_category_price(Double.parseDouble(df.format(rs.getDouble("price")))); theaterDetailBean.setSeat_category_name(rs.getString("seat_category_name")); String sq1 = "SELECT DISTINCT(total_seat_count) FROM screen_floor_plan_detail WHERE theater_id = ? AND screen_id = ?"; ps1 = conn.prepareStatement(sq1); ps1.setInt(1, theaterOwnerBean.getTheater_id()); ps1.setInt(2, theaterOwnerBean.getScreen_id()); rs1 = ps1.executeQuery(); while(rs1.next()){ theaterDetailBean.setSeat_count(rs1.getInt("total_seat_count")); } ArrayList<TicketCounterBean> categoryList = new ArrayList<TicketCounterBean>(); String sql1 = "SELECT DISTINCT(l.seat_category_id),l.seat_id,l.seat_status_id,l.total_seat_count,s.seat_category FROM screen_floor_plan_detail l INNER JOIN seat_category s ON s.seat_category_id = l.seat_category_id WHERE l.theater_id=? AND l.screen_id=? AND l.list_seat_category_price_id=?"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterOwnerBean.getTheater_id()); ps1.setInt(2, theaterOwnerBean.getScreen_id()); ps1.setInt(3, rs.getInt("list_seat_category_price_id")); rs1 = ps1.executeQuery(); while(rs1.next()){ ticketCounterBean = new TicketCounterBean(); int seatCount = rs1.getInt("total_seat_count"); String[] seat = rs1.getString("seat_id").split(","); String[] status = rs1.getString("seat_status_id").split(","); int emptySeatCount = 0; ArrayList<ScreenDetailBean> seatList = new ArrayList<ScreenDetailBean>(); for(int i =0;i <= seatCount-1;i++){ screenDetailBean = new ScreenDetailBean(); screenDetailBean.setSeatName(seat[i]); screenDetailBean.setSeatStatus(Integer.parseInt(status[i])); if(Integer.parseInt(status[i]) == 0){ emptySeatCount += 1; } seatList.add(screenDetailBean); } if(emptySeatCount == seatCount){ ticketCounterBean.setCategory_name("-"); } else{ ticketCounterBean.setCategory_name(rs1.getString("seat_category")); } ticketCounterBean.setSeatList(seatList); categoryList.add(ticketCounterBean); } theaterDetailBean.setCategoryList(categoryList); seatcategoryPriceList.add(theaterDetailBean); } theaterOwnerBean.setTheaterRowList(seatcategoryPriceList); String sql3 = "SELECT screen_layout_path FROM screen_detail WHERE theater_id =? AND screen_id =?"; ps = conn.prepareStatement(sql3); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, theaterOwnerBean.getScreen_id()); rs = ps.executeQuery(); while(rs.next()){ theaterOwnerBean.setScreen_layout_path(rs.getString("screen_layout_path")); } /*String sql = "{CALL Ticket_TO_getSeatingArrangementDetails(?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_id()); cl.setInt(2, theaterOwnerBean.getScreen_id()); cl.setInt(3, theaterOwnerBean.getTheater_owner_id()); cl.registerOutParameter(4, Types.INTEGER); cl.execute(); rs = cl.executeQuery(); while(rs.next()) { TheaterDetailBean theaterDetailBean = new TheaterDetailBean(); subList = new ArrayList<ScreenDetailBean>(); theaterDetailBean.setCategory_name(rs.getString("seatCatName")); theaterDetailBean.setCol_count(rs.getInt("pasCount")); theaterDetailBean.setTotal_seat_count(cl.getInt(4)); String strArr[] = rs.getString("seatingValue").split(","); for(String str : strArr) { ScreenDetailBean screenDetailBean = new ScreenDetailBean(); String strArr1[] = str.split("-"); screenDetailBean.setSeat_count(Integer.parseInt(strArr1[0].trim())); screenDetailBean.setOrder_id(Integer.parseInt(strArr1[1].trim())); subList.add(screenDetailBean); } theaterDetailBean.setScreenList(subList); finalList.add(theaterDetailBean); } theaterOwnerBean.setTheaterRowList(finalList);*/ } catch (Exception e) { e.printStackTrace(); String str = "getSeatingArrangementDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getDistrictDetails created by ramya - 30-07-08 public Map<Integer, String> getDistrictDetails() throws Exception { Connection conn = null; CallableStatement cl = null; Map<Integer, String> districtMap = new HashMap<Integer,String>(); int i =1; try { conn = connectionManager.getConnection(); String sql = "CALL Ticket_TO_getDistrictDetails()"; cl = conn.prepareCall(sql); boolean result = cl.execute(); while(result) { ResultSet rs = cl.getResultSet(); if(i==1) { while(rs.next()) { districtMap.put(rs.getInt("district_id"), rs.getString("district_name")); } } result = cl.getMoreResults(); i++; } } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return districtMap; } //getDistrictWiseCityDetail public Map<Integer, String> getDistrictWiseCityDetail( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; Map<Integer, String> cityMap = new HashMap<Integer,String>(); int i =1; try { conn = connectionManager.getConnection(); String sql1 = "{CALL Ticket_TO_getDistrictWiseCityDetail(?)}"; cl = conn.prepareCall(sql1); cl.setInt(1, theaterOwnerBean.getDistrict_id()); boolean result = cl.execute(); while(result) { ResultSet rs = cl.getResultSet(); if(i==1) { while(rs.next()) { cityMap.put(rs.getInt("city_id"), rs.getString("city_name")); } } result = cl.getMoreResults(); i++; } } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return cityMap; } //getTheaterDetails public TheaterOwnerBean getEditTheaterDetails( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; PreparedStatement ps1 = null; ResultSet rs1 = null; ArrayList<TheaterDetailBean> theaterDetailList = new ArrayList<TheaterDetailBean>(); TheaterDetailBean theaterDetailBean = null; ScreenDetailBean screenDetailBean = null; try { conn = connectionManager.getConnection(); int totalTheatreCount = 0; String sql2 = "SELECT COUNT(theater_id) AS 'TheatreCount' FROM theater_detail WHERE theater_owner_id = ? AND STATUS= 'Active' AND is_deleted = 'N'"; ps = conn.prepareStatement(sql2); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs = ps.executeQuery(); while(rs.next()) { totalTheatreCount = rs.getInt("TheatreCount"); } String sql = "SELECT theater_id,theater_name,address,city_id,taluk_id,district_id,theater_license_number,theater_license_number,theater_tin_number,gst_number,total_number_of_seats FROM theater_detail WHERE theater_owner_id = ? AND STATUS= 'Active' AND is_deleted = 'N' ORDER BY theater_id DESC"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs = ps.executeQuery(); while(rs.next()) { theaterDetailBean = new TheaterDetailBean(); theaterDetailBean.setCount(totalTheatreCount); theaterDetailBean.setTheater_id(rs.getInt("theater_id")); theaterDetailBean.setTheater_name(rs.getString("theater_name")); theaterDetailBean.setAddress(rs.getString("address")); theaterDetailBean.setCity_id(rs.getInt("city_id")); theaterDetailBean.setDistrict_id(rs.getInt("district_id")); theaterDetailBean.setTheater_license_number(rs.getString("theater_license_number")); theaterDetailBean.setTheater_gst_number(rs.getString("gst_number")); theaterDetailBean.setTheater_tin_number(rs.getString("theater_tin_number")); theaterDetailBean.setNumber_of_seats(rs.getInt("total_number_of_seats")); theaterDetailBean.setTaluk_id(rs.getInt("taluk_id")); ArrayList<ScreenDetailBean> screenDetailList = new ArrayList<ScreenDetailBean>(); String sql1 = "SELECT screen_id,screen_name,seat_count,screen_layout_path FROM screen_detail WHERE theater_id = ? AND theater_owner_id = ? AND STATUS = 'Active' AND is_deleted = 'N'"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterDetailBean.getTheater_id()); ps1.setInt(2, theaterOwnerBean.getTheater_owner_id()); rs1 = ps1.executeQuery(); while(rs1.next()) { screenDetailBean = new ScreenDetailBean(); screenDetailBean.setScreen_id(rs1.getInt("screen_id")); screenDetailBean.setScreen_name(rs1.getString("screen_name")); screenDetailBean.setSeat_count(rs1.getInt("seat_count")); if(rs1.getString("screen_layout_path") == null || rs1.getString("screen_layout_path").equals("")){ screenDetailBean.setScreen_layout_status("No"); } else{ screenDetailBean.setScreen_layout_status("Yes"); screenDetailBean.setScreen_layout_path(rs1.getString("screen_layout_path")); } screenDetailList.add(screenDetailBean); } theaterDetailBean.setScreen_count(screenDetailList.size()); theaterDetailBean.setScreenList(screenDetailList); theaterDetailList.add(theaterDetailBean); totalTheatreCount = totalTheatreCount-1; } if(theaterDetailList.size()>1) { theaterOwnerBean.setStatus("Yes"); } else { theaterOwnerBean.setStatus("No"); } theaterOwnerBean.setTheater_count(theaterDetailList.size()); theaterOwnerBean.setTheatre_add_count(theaterDetailList.size()-1); theaterOwnerBean.setTheaterDetailList(theaterDetailList); } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //setAddTheaterDetails public TheaterOwnerBean setAddTheaterDetails( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; PreparedStatement ps1 = null; ResultSet rs1 = null; try { conn = connectionManager.getConnection(); for(TheaterDetailBean theaterDetailBean : theaterOwnerBean.getTheaterDetailList()){ String sql = "INSERT INTO theater_detail (theater_name,theater_owner_id,address,city_id,taluk_id,district_id,theater_license_number,theater_tin_number,gst_number,booking_block_status,STATUS,is_deleted,created_on) VALUES (?,?,?,?,?,?,?,?,?,'No','Active','N',NOW())"; ps = conn.prepareStatement(sql, ps.RETURN_GENERATED_KEYS); ps.setString(1, theaterDetailBean.getTheater_name()); ps.setInt(2, theaterOwnerBean.getTheater_owner_id()); ps.setString(3, theaterDetailBean.getAddress()); ps.setInt(4, theaterDetailBean.getCity_id()); ps.setInt(5, theaterDetailBean.getTaluk_id()); ps.setInt(6, theaterDetailBean.getDistrict_id()); ps.setString(7, theaterDetailBean.getTheater_license_number()); ps.setString(8, theaterDetailBean.getTheater_tin_number()); ps.setString(9, theaterDetailBean.getTheater_gst_number()); ps.executeUpdate(); rs = ps.getGeneratedKeys(); if(rs.next()){ theaterDetailBean.setTheater_id(rs.getInt(1)); } int total_seats_count = 0; //screen layout path Object path=theaterOwnerBean.getPath(); String strpath=(String)path; String folderName = "theater-screen-layout-images"; String docPath = strpath+"/"+theaterOwnerBean.getTheater_owner_first_name()+"-"+theaterOwnerBean.getTheater_owner_id()+"//"+folderName+"//"+theaterDetailBean.getTheater_name()+"-"+theaterDetailBean.getTheater_id()+"//"; File pathFile = new File(docPath); if(pathFile.isDirectory()) { }else { pathFile.mkdir(); } for(ScreenDetailBean screenDetailBean : theaterDetailBean.getScreenList()){ total_seats_count = total_seats_count+screenDetailBean.getSeat_count(); if(screenDetailBean.getScreen_layout() == null || screenDetailBean.getFile_name().equals("")){ String sql1 = "INSERT INTO screen_detail (screen_name,seat_count,theater_id,theater_owner_id,STATUS,is_deleted,created_on) VALUES (?,?,?,?,'Active','N',NOW())"; ps1 = conn.prepareStatement(sql1); ps1.setString(1, screenDetailBean.getScreen_name()); ps1.setInt(2, screenDetailBean.getSeat_count()); ps1.setInt(3, theaterDetailBean.getTheater_id()); ps1.setInt(4, theaterOwnerBean.getTheater_owner_id()); ps1.executeUpdate(); } else{ String fileName = screenDetailBean.getFile_name(); File createFile = new File(docPath+fileName); FileUtils.copyFile(screenDetailBean.getScreen_layout(), createFile); String sql1 = "INSERT INTO screen_detail (screen_name,seat_count,screen_layout_path,theater_id,theater_owner_id,STATUS,is_deleted,created_on) VALUES (?,?,?,?,?,'Active','N',NOW())"; ps1 = conn.prepareStatement(sql1); ps1.setString(1, screenDetailBean.getScreen_name()); ps1.setInt(2, screenDetailBean.getSeat_count()); ps1.setString(3, docPath+fileName); ps1.setInt(4, theaterDetailBean.getTheater_id()); ps1.setInt(5, theaterOwnerBean.getTheater_owner_id()); ps1.executeUpdate(); } } String sql2 = "UPDATE theater_detail SET total_number_of_seats = ? WHERE theater_id = ?"; ps1 = conn.prepareStatement(sql2); ps1.setInt(1, total_seats_count); ps1.setInt(2, theaterDetailBean.getTheater_id()); ps1.executeUpdate(); } } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getAddTheaterAvailableStatusDetails - created by ramya 31-07-18 public TheaterOwnerBean getAddTheaterAvailableStatusDetails( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; int i =1; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getAddTheaterAvailableStatusDetails(?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); boolean result = cl.execute(); while(result) { ResultSet rs = cl.getResultSet(); if(i==1) { if(rs.next()) { theaterOwnerBean.setStatus("Success"); } else{ theaterOwnerBean.setStatus("Faliure"); } } result = cl.getMoreResults(); i++; } } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getTheaterOwnerTheaterDetails public Map<Integer, String> getTheaterOwnerTheater( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; Map<Integer, String> theaterMap = new HashMap<Integer,String>(); int i =1; try { conn = connectionManager.getConnection(); String sql = "CALL Ticket_TO_getTheaterOwnerTheater(?)"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); boolean result = cl.execute(); while(result) { ResultSet rs = cl.getResultSet(); if(i==1) { while(rs.next()) { theaterMap.put(rs.getInt("theater_id"), rs.getString("theater_name")); } } result = cl.getMoreResults(); i++; } } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterMap; } //getTheaterAllDetails created by ramya 01-08-18 public TheaterDetailBean getTheaterAllDetails( TheaterDetailBean theaterDetailBean) throws Exception { Connection conn = null; CallableStatement cl = null; Map<Integer, String> screenMap = new HashMap<Integer, String>(); int i =1; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getTheaterDetails(?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterDetailBean.getTheater_id()); boolean res = cl.execute(); while(res) { ResultSet rs = cl.getResultSet(); switch (i) { case 1: if(rs.next()) { theaterDetailBean.setTheater_id(rs.getInt("theater_id")); theaterDetailBean.setTheater_name(rs.getString("theater_name")); theaterDetailBean.setAddress(rs.getString("address")); theaterDetailBean.setTheater_license_number(rs.getString("theater_license_number")); theaterDetailBean.setTheater_tin_number(rs.getString("theater_tin_number")); theaterDetailBean.setTheater_gst_number(rs.getString("gst_number")); theaterDetailBean.setNumber_of_seats(rs.getInt("total_number_of_seats")); theaterDetailBean.setDistrict_name(rs.getString("district_name")); theaterDetailBean.setCity_name(rs.getString("city_name")); theaterDetailBean.setTaluk_name(rs.getString("taluk_name")); } break; case 2: int scrCount = 0; while(rs.next()) { scrCount = scrCount+1; screenMap.put(rs.getInt("screen_id"), rs.getString("screen_name")); } theaterDetailBean.setScreenMap(screenMap); theaterDetailBean.setScreen_count(scrCount); break; case 3: if(rs.next()) { theaterDetailBean.setScreen_id(rs.getInt("screen_id")); theaterDetailBean.setScreen_name(rs.getString("screen_name")); theaterDetailBean.setSeat_count(rs.getInt("seat_count")); if(rs.getString("screen_layout_path") == null || rs.getString("screen_layout_path").equals("")){ theaterDetailBean.setScreen_layout_status("No"); } else{ theaterDetailBean.setScreen_layout_status("Yes"); theaterDetailBean.setScreen_layout_path(rs.getString("screen_layout_path")); } } break; } i++; res = cl.getMoreResults(); } } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterDetailBean; } //getTheaterBasicScreendetail public TheaterDetailBean getTheaterBasicScreendetail( TheaterDetailBean theaterDetailBean) throws Exception { Connection conn = null; CallableStatement cl = null; int i =1; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getTheaterBasicScreendetail(?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterDetailBean.getTheater_id()); cl.setInt(2, theaterDetailBean.getScreen_id()); boolean res = cl.execute(); while(res) { ResultSet rs = cl.getResultSet(); if(i==1) { if(rs.next()) { theaterDetailBean.setScreen_id(rs.getInt("screen_id")); theaterDetailBean.setScreen_name(rs.getString("screen_name")); theaterDetailBean.setSeat_count(rs.getInt("seat_count")); if(rs.getString("screen_layout_path") == null || rs.getString("screen_layout_path").equals("")){ theaterDetailBean.setScreen_layout_status("No"); } else{ theaterDetailBean.setScreen_layout_status("Yes"); theaterDetailBean.setScreen_layout_path(rs.getString("screen_layout_path")); } } } i++; res = cl.getMoreResults(); } } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterDetailBean; } //setDeleteTheaterDetail public TheaterOwnerBean setDeleteTheaterDetail( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_setDeleteTheaterDetail(?,?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.setInt(2, theaterOwnerBean.getTheater_id()); cl.registerOutParameter(3, Types.VARCHAR); cl.execute(); theaterOwnerBean.setTheater_status(cl.getString(3)); } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //setUpdateTheaterDetails created by ramya 03-08-184 public TheaterOwnerBean setUpdateTheaterDetails( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; PreparedStatement ps1 = null; try { conn = connectionManager.getConnection(); for(TheaterDetailBean theaterDetailBean : theaterOwnerBean.getTheaterDetailList()){ int total_seats_count = 0; if(theaterDetailBean.getTheater_id() != 0){ String sql = "UPDATE theater_detail SET theater_name=?,theater_owner_id=?,theater_license_number=?,theater_tin_number=?,gst_number=? WHERE theater_id = ?"; ps = conn.prepareStatement(sql); ps.setString(1, theaterDetailBean.getTheater_name()); ps.setInt(2, theaterOwnerBean.getTheater_owner_id()); ps.setString(3, theaterDetailBean.getTheater_license_number()); ps.setString(4, theaterDetailBean.getTheater_tin_number()); ps.setString(5, theaterDetailBean.getTheater_gst_number()); ps.setInt(6, theaterDetailBean.getTheater_id()); ps.executeUpdate(); //screen layout path Object path=theaterOwnerBean.getPath(); String strpath=(String)path; String folderName = "theater-screen-layout-images"; String docPath = strpath+"/"+theaterOwnerBean.getTheater_owner_first_name()+"-"+theaterOwnerBean.getTheater_owner_id()+"//"+folderName+"//"+theaterDetailBean.getTheater_name()+"-"+theaterDetailBean.getTheater_id()+"//"; File pathFile = new File(docPath); if(pathFile.isDirectory()) { }else { pathFile.mkdir(); } for(ScreenDetailBean screenDetailBean : theaterDetailBean.getScreenList()){ total_seats_count = total_seats_count+screenDetailBean.getSeat_count(); if(screenDetailBean.getScreen_id() != 0){ if(screenDetailBean.getScreen_layout() == null || screenDetailBean.getFile_name().equals("")){ String sql1 = "UPDATE screen_detail SET screen_name =?,seat_count=? WHERE screen_id =? AND theater_id =? AND theater_owner_id =?"; ps1 = conn.prepareStatement(sql1); ps1.setString(1, screenDetailBean.getScreen_name()); ps1.setInt(2, screenDetailBean.getSeat_count()); ps1.setInt(3, screenDetailBean.getScreen_id()); ps1.setInt(4, theaterDetailBean.getTheater_id()); ps1.setInt(5, theaterOwnerBean.getTheater_owner_id()); ps1.executeUpdate(); } else{ String fileName = screenDetailBean.getFile_name(); File createFile = new File(docPath+fileName); FileUtils.copyFile(screenDetailBean.getScreen_layout(), createFile); String sql1 = "UPDATE screen_detail SET screen_name =?,seat_count=?,screen_layout_path=? WHERE screen_id =? AND theater_id =? AND theater_owner_id =?"; ps1 = conn.prepareStatement(sql1); ps1.setString(1, screenDetailBean.getScreen_name()); ps1.setInt(2, screenDetailBean.getSeat_count()); ps1.setString(3, docPath+fileName); ps1.setInt(4, screenDetailBean.getScreen_id()); ps1.setInt(5, theaterDetailBean.getTheater_id()); ps1.setInt(6, theaterOwnerBean.getTheater_owner_id()); ps1.executeUpdate(); } } else{ String filepath = ""; if(screenDetailBean.getScreen_layout() == null || screenDetailBean.getFile_name().equals("")){ filepath = null; } else{ String fileName = screenDetailBean.getFile_name(); File createFile = new File(docPath+fileName); FileUtils.copyFile(screenDetailBean.getScreen_layout(), createFile); filepath =docPath+fileName; } String sql2 = "INSERT INTO screen_detail (screen_name,seat_count,screen_layout_path,theater_id,theater_owner_id,STATUS,is_deleted,created_on) VALUES (?,?,?,?,?,'Active','N',NOW())"; ps1 = conn.prepareStatement(sql2); ps1.setString(1, screenDetailBean.getScreen_name()); ps1.setInt(2, screenDetailBean.getSeat_count()); ps1.setString(3, filepath); ps1.setInt(4, theaterDetailBean.getTheater_id()); ps1.setInt(5, theaterOwnerBean.getTheater_owner_id()); ps1.executeUpdate(); } } } else{ String sql = "INSERT INTO theater_detail (theater_name,theater_owner_id,address,city_id,taluk_id,district_id,theater_license_number,theater_tin_number,gst_number,booking_block_status,STATUS,is_deleted,created_on) VALUES (?,?,?,?,?,?,?,?,?,'No','Active','N',NOW())"; ps = conn.prepareStatement(sql, ps.RETURN_GENERATED_KEYS); ps.setString(1, theaterDetailBean.getTheater_name()); ps.setInt(2, theaterOwnerBean.getTheater_owner_id()); ps.setString(3, theaterDetailBean.getAddress()); ps.setInt(4, theaterDetailBean.getCity_id()); ps.setInt(5, theaterDetailBean.getTaluk_id()); ps.setInt(6, theaterDetailBean.getDistrict_id()); ps.setString(7, theaterDetailBean.getTheater_license_number()); ps.setString(8, theaterDetailBean.getTheater_tin_number()); ps.setString(9, theaterDetailBean.getTheater_gst_number()); ps.executeUpdate(); rs = ps.getGeneratedKeys(); if(rs.next()){ theaterDetailBean.setTheater_id(rs.getInt(1)); } //screen layout path Object path=theaterOwnerBean.getPath(); String strpath=(String)path; String folderName = "theater-screen-layout-images"; String docPath = strpath+"/"+theaterOwnerBean.getTheater_owner_first_name()+"-"+theaterOwnerBean.getTheater_owner_id()+"//"+folderName+"//"+theaterDetailBean.getTheater_name()+"-"+theaterDetailBean.getTheater_id()+"//"; File pathFile = new File(docPath); if(pathFile.isDirectory()) { }else { pathFile.mkdir(); } for(ScreenDetailBean screenDetailBean : theaterDetailBean.getScreenList()){ total_seats_count = total_seats_count+screenDetailBean.getSeat_count(); String filepath = ""; if(screenDetailBean.getScreen_layout() == null || screenDetailBean.getFile_name().equals("")){ filepath = null; } else{ String fileName = screenDetailBean.getFile_name(); File createFile = new File(docPath+fileName); FileUtils.copyFile(screenDetailBean.getScreen_layout(), createFile); filepath =docPath+fileName; } String sql1 = "INSERT INTO screen_detail (screen_name,seat_count,screen_layout_path,theater_id,theater_owner_id,STATUS,is_deleted,created_on) VALUES (?,?,?,?,?,'Active','N',NOW())"; ps1 = conn.prepareStatement(sql1); ps1.setString(1, screenDetailBean.getScreen_name()); ps1.setInt(2, screenDetailBean.getSeat_count()); ps1.setString(3, filepath); ps1.setInt(4, theaterDetailBean.getTheater_id()); ps1.setInt(5, theaterOwnerBean.getTheater_owner_id()); ps1.executeUpdate(); } } String sql2 = "UPDATE theater_detail SET total_number_of_seats = ? WHERE theater_id = ?"; ps1 = conn.prepareStatement(sql2); ps1.setInt(1, total_seats_count); ps1.setInt(2, theaterDetailBean.getTheater_id()); ps1.executeUpdate(); } } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } @Override public Map<Integer, String> getUserRoleMap() throws Exception { Map<Integer, String> userRoleMap=new HashMap<Integer,String>(); PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; try { conn = connectionManager.getConnection(); String employee_role="select theatre_employee_role_id,theatre_employee_role_name from theatre_employee_role"; ps = conn.prepareStatement(employee_role); rs = ps.executeQuery(); while(rs.next()) { //districtMap.put(rs.getInt("district_id"), rs.getString("district_name")); userRoleMap.put(rs.getInt("theatre_employee_role_id"), rs.getString("theatre_employee_role_name")); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return userRoleMap; } //set theater employee details public TheaterOwnerBean settTheaterAddUserSubmit(TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; Connection conn=null; try { conn = connectionManager.getConnection(); //screen layout path Object path=theaterOwnerBean.getPath(); String strpath=(String)path; String folderName = "ticket-counter-person-images"; String docPath = strpath+"/"+theaterOwnerBean.getTheater_owner_first_name()+"-"+theaterOwnerBean.getTheater_owner_id()+"//"+folderName+"//"+"theaterId-"+theaterOwnerBean.getTheater_id()+"//"; File pathFile = new File(docPath); if(pathFile.isDirectory()) { }else { pathFile.mkdir(); } String filepath = ""; if(theaterOwnerBean.getProfile_image() == null || theaterOwnerBean.getFile_name().equals("")){ filepath = null; } else{ String fileName = theaterOwnerBean.getFile_name(); File createFile = new File(docPath+fileName); FileUtils.copyFile(theaterOwnerBean.getProfile_image(), createFile); filepath =docPath+fileName; } String employee_details="insert into theater_employee_details(theater_employee_name,theater_employee_mail,theater_employee_mobile,gender_id,employee_dob,theater_employee_role_id,employee_profile_path,is_deleted,status,created_user_id,employee_id,theater_id,created_date) values(?,?,?,?,?,?,?,?,?,?,?,?,now())"; ps = conn.prepareStatement(employee_details, ps.RETURN_GENERATED_KEYS); ps.setString(1, theaterOwnerBean.getFirst_name()); ps.setString(2, theaterOwnerBean.getEmail_id()); ps.setString(3, theaterOwnerBean.getPhone_number()); ps.setInt(4, theaterOwnerBean.getGender_id()); ps.setString(5, theaterOwnerBean.getDate_of_birth()); ps.setInt(6, theaterOwnerBean.getTheatre_employee_role_id()); ps.setString(7,filepath); ps.setString(8, "N"); ps.setString(9, "Active"); ps.setInt(10, theaterOwnerBean.getTheater_owner_id()); ps.setString(11, theaterOwnerBean.getEmployee_id()); ps.setInt(12, theaterOwnerBean.getTheater_id()); ps.executeUpdate(); rs = ps.getGeneratedKeys(); if(rs.next()) { //theatre_employee_id theaterOwnerBean.setTheatre_employee_id(rs.getInt(1)); theaterOwnerBean.setNav_bar_user_status("Yes"); String id = ""+theaterOwnerBean.getTheatre_employee_id(); String uniqueid = UniqueId.getAckId(id); theaterOwnerBean.setUniqueId(uniqueid); String employee_login="insert into login(email,password,theater_employee_id,activation,status,unique_id,is_deleted,role_id,mobile,created_date) values(?,?,?,?,?,?,?,?,?,now())"; ps1 = conn.prepareStatement(employee_login); ps1.setString(1, theaterOwnerBean.getEmail_id()); ps1.setString(2, "User123$"); ps1.setInt(3, theaterOwnerBean.getTheatre_employee_id()); ps1.setString(4, "Y"); ps1.setString(5, "Active"); ps1.setString(6, theaterOwnerBean.getUniqueId()); ps1.setString(7, "N"); ps1.setInt(8, 2); ps1.setString(9, theaterOwnerBean.getPhone_number()); ps1.executeUpdate(); } String sql="SELECT theater_name FROM theater_detail WHERE theater_id = ?"; ps1 = conn.prepareStatement(sql); ps1.setInt(1, theaterOwnerBean.getTheater_id()); rs1 = ps1.executeQuery(); while(rs1.next()){ theaterOwnerBean.setTheater_name(rs1.getString("theater_name")); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //get invite template public TemplateBean getEmployeeInviteTemplate(TemplateBean templateBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; try { conn = connectionManager.getConnection(); String sql="select template_value from template where description='invite_employee'"; ps = conn.prepareStatement(sql); rs = ps.executeQuery(); while(rs.next()) { templateBean.setTemplate(rs.getString("template_value")); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return templateBean; } public ArrayList<TheaterOwnerBean> getTheaterEmployeeList(TheaterOwnerBean theaterOwnerBean) throws Exception { ArrayList<TheaterOwnerBean> theaterEmployeeList=new ArrayList<TheaterOwnerBean>(); PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; Connection conn=null; try { conn = connectionManager.getConnection(); String employeeList="SELECT t.employee_id,t.theater_employee_id,t.theater_employee_name,t.employee_dob,t.theater_employee_mail,t.theater_employee_mobile,t.employee_profile_path,t.theater_employee_role_id ,r.theatre_employee_role_name,t.employee_profile,s.theater_name,o.password FROM theater_employee_details t INNER JOIN theatre_employee_role r ON t.theater_employee_role_id=r.theatre_employee_role_id INNER JOIN theater_detail s ON t.theater_id = s.theater_id INNER JOIN login o ON t.theater_employee_id = o.theater_employee_id WHERE t.status ='Active' AND t.is_deleted='N' AND t.created_user_id=?"; ps = conn.prepareStatement(employeeList); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs = ps.executeQuery(); while(rs.next()) { theaterOwnerBean = new TheaterOwnerBean(); theaterOwnerBean.setEmployee_id(rs.getString("employee_id")); theaterOwnerBean.setTheatre_employee_id(rs.getInt("theater_employee_id")); theaterOwnerBean.setFirst_name(rs.getString("theater_employee_name")); theaterOwnerBean.setEmail_id(rs.getString("theater_employee_mail")); theaterOwnerBean.setDate_of_birth(rs.getString("employee_dob")); theaterOwnerBean.setPhone_number(rs.getString("theater_employee_mobile")); theaterOwnerBean.setEmployee_role(rs.getString("theatre_employee_role_name")); theaterOwnerBean.setTheater_name(rs.getString("theater_name")); theaterOwnerBean.setPassowrd(rs.getString("password")); if(rs.getString("employee_profile_path") != null) { theaterOwnerBean.setStatus("Success"); theaterOwnerBean.setEmployee_profile_path(rs.getString("employee_profile_path")); } else{ theaterOwnerBean.setStatus("notSuccess"); } theaterEmployeeList.add(theaterOwnerBean); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterEmployeeList; } //get employee details public TheaterOwnerBean getEmployeeEditDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; try { conn = connectionManager.getConnection(); String employeeList="SELECT t.theater_employee_id,t.theater_employee_name,t.employee_dob,t.theater_employee_mail,t.theater_employee_mobile,t.employee_profile_path,t.theater_employee_role_id ,r.theatre_employee_role_name,t.gender_id,t.employee_profile,t.theater_id,t.employee_id FROM theater_employee_details t INNER JOIN theatre_employee_role r ON t.theater_employee_role_id=r.theatre_employee_role_id WHERE t.theater_employee_id=? AND status='Active' AND is_deleted='N'"; ps = conn.prepareStatement(employeeList); ps.setInt(1, theaterOwnerBean.getTheatre_employee_id()); rs = ps.executeQuery(); while(rs.next()) { //theaterOwnerBean.setEmployee_id(rs.getInt("theater_employee_id")); theaterOwnerBean.setTheatre_employee_id(rs.getInt("theater_employee_id")); theaterOwnerBean.setFirst_name(rs.getString("theater_employee_name")); theaterOwnerBean.setEmail_id(rs.getString("theater_employee_mail")); theaterOwnerBean.setDate_of_birth(rs.getString("employee_dob")); theaterOwnerBean.setPhone_number(rs.getString("theater_employee_mobile")); theaterOwnerBean.setEmployee_role(rs.getString("theatre_employee_role_name")); theaterOwnerBean.setTheatre_employee_role_id(rs.getInt("theater_employee_role_id")); theaterOwnerBean.setGender_id(rs.getInt("gender_id")); theaterOwnerBean.setTheater_id(rs.getInt("theater_id")); theaterOwnerBean.setEmployee_id(rs.getString("employee_id")); if(rs.getString("employee_profile_path") != null) { theaterOwnerBean.setStatus("Success"); theaterOwnerBean.setEmployee_profile_path(rs.getString("employee_profile_path")); } else{ theaterOwnerBean.setStatus("notSuccess"); } } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //set employee edit details public TheaterOwnerBean setTheaterEmployeeDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; try { conn = connectionManager.getConnection(); //screen layout path Object path=theaterOwnerBean.getPath(); String strpath=(String)path; String folderName = "ticket-counter-person-images"; String docPath = strpath+"/"+theaterOwnerBean.getTheater_owner_first_name()+"-"+theaterOwnerBean.getTheater_owner_id()+"//"+folderName+"//"+"theaterId-"+theaterOwnerBean.getTheater_id()+"//"; File pathFile = new File(docPath); if(pathFile.isDirectory()) { }else { pathFile.mkdir(); } if(theaterOwnerBean.getProfile_image() == null || theaterOwnerBean.getFile_name().equals("")) { String updateEmployee="UPDATE theater_employee_details SET theater_employee_name=?,gender_id=?,employee_dob=?,theater_employee_role_id=?,theater_id=?,employee_id=? WHERE theater_employee_id=?"; ps = conn.prepareStatement(updateEmployee); ps.setString(1, theaterOwnerBean.getFirst_name()); ps.setInt(2, theaterOwnerBean.getGender_id()); ps.setString(3, theaterOwnerBean.getDate_of_birth()); ps.setInt(4, theaterOwnerBean.getTheatre_employee_role_id()); ps.setInt(5, theaterOwnerBean.getTheater_id()); ps.setString(6, theaterOwnerBean.getEmployee_id()); ps.setInt(7, theaterOwnerBean.getTheatre_employee_id()); ps.executeUpdate(); } else{ String fileName = theaterOwnerBean.getFile_name(); File createFile = new File(docPath+fileName); FileUtils.copyFile(theaterOwnerBean.getProfile_image(), createFile); String updateEmployee="UPDATE theater_employee_details SET theater_employee_name=?,gender_id=?,employee_dob=?,theater_employee_role_id=?,employee_profile_path=?,theater_id=?,employee_id=? WHERE theater_employee_id=?"; ps = conn.prepareStatement(updateEmployee); ps.setString(1, theaterOwnerBean.getFirst_name()); ps.setInt(2, theaterOwnerBean.getGender_id()); ps.setString(3, theaterOwnerBean.getDate_of_birth()); ps.setInt(4, theaterOwnerBean.getTheatre_employee_role_id()); ps.setString(5, docPath+fileName); ps.setInt(6, theaterOwnerBean.getTheater_id()); ps.setString(7, theaterOwnerBean.getEmployee_id()); ps.setInt(8, theaterOwnerBean.getTheatre_employee_id()); ps.executeUpdate(); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } @Override public TheaterOwnerBean deleteTheaterEmployeeDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; try { conn = connectionManager.getConnection(); String deleteEmployee="UPDATE theater_employee_details SET status=?,is_deleted=? WHERE theater_employee_id=?"; ps = conn.prepareStatement(deleteEmployee); ps.setString(1, "InActive"); ps.setString(2, "Y"); ps.setInt(3, theaterOwnerBean.getTheatre_employee_id()); ps.executeUpdate(); String sql="UPDATE login SET STATUS = 'InActive',is_deleted = 'Y' WHERE theater_employee_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheatre_employee_id()); ps.executeUpdate(); } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //get movie languge public Map<Integer, String> getMovieLanguages() throws Exception { Map<Integer, String> movieLangMap=new HashMap<Integer,String>(); PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; try { conn = connectionManager.getConnection(); String movie_lang="select language_id,language_name from movie_languge"; ps = conn.prepareStatement(movie_lang); rs = ps.executeQuery(); while(rs.next()) { movieLangMap.put(rs.getInt("language_id"), rs.getString("language_name")); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieLangMap; } //get movie genre public Map<Integer, String> getMovieGenre() throws Exception { Map<Integer, String> movieGenreMap=new HashMap<Integer,String>(); PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; try { conn = connectionManager.getConnection(); String movie_genre="select genre_id,genre_name from movie_genre"; ps = conn.prepareStatement(movie_genre); rs = ps.executeQuery(); while(rs.next()) { movieGenreMap.put(rs.getInt("genre_id"), rs.getString("genre_name")); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieGenreMap; } //get movie format public Map<Integer, String> getMovieFormat() throws Exception { Map<Integer, String> movieFormatMap=new HashMap<Integer,String>(); PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; try { conn = connectionManager.getConnection(); String movie_format="select movie_format_id,format_name from movie_format"; ps = conn.prepareStatement(movie_format); rs = ps.executeQuery(); while(rs.next()) { movieFormatMap.put(rs.getInt("movie_format_id"), rs.getString("format_name")); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieFormatMap; } //set movie details submit public TheaterOwnerBean setMovieDetailsSubit(TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; try { conn = connectionManager.getConnection(); int movie_generated_id = 0; /*Object path=theaterOwnerBean.getPath(); String strpath=(String)path; String fileName = theaterOwnerBean.getFile_name(); String folderName = "movie-images"; String docPath = strpath+"/"+theaterOwnerBean.getTheater_owner_first_name()+"-"+theaterOwnerBean.getTheater_owner_id()+"//"+folderName+"//"; File pathFile = new File(docPath); if(pathFile.isDirectory()) { }else { pathFile.mkdir(); } File createFile = new File(docPath+fileName); FileUtils.copyFile(theaterOwnerBean.getMovie_poster(), createFile);*/ String sql="SELECT movie_details_id FROM movie_details ORDER BY movie_details_id DESC LIMIT 1"; ps = conn.prepareStatement(sql); rs = ps.executeQuery(); if(rs.next()){ movie_generated_id = rs.getInt("movie_details_id"); } else{ movie_generated_id = 1; } String movie_id = "MV"+movie_generated_id; /* SimpleDateFormat date = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); Date reldate = date.parse(theaterOwnerBean.getMovie_release_date()); String releaseDate = dateformat.format(reldate); String movie_details="INSERT INTO movie_details(master_movie_id,movie_language_id,genre_id,Format_id,movie_duration,movie_poster_path,movie_release_date,theater_owner_id,is_deleted,STATUS,movie_id,certification_id,created_date) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,NOW())"; ps = conn.prepareStatement(movie_details, ps.RETURN_GENERATED_KEYS); ps.setInt(1, theaterOwnerBean.getMaster_movie_id()); ps.setInt(2, theaterOwnerBean.getMovie_language_id()); ps.setInt(3, theaterOwnerBean.getMovie_genre_id()); ps.setInt(4, theaterOwnerBean.getMovie_format_id()); ps.setString(5, theaterOwnerBean.getMovie_duration()); ps.setString(6, docPath+fileName); ps.setString(7, releaseDate); ps.setInt(8,theaterOwnerBean.getTheater_owner_id()); ps.setString(9, "N"); ps.setString(10, "Active"); ps.setString(11, movie_id); ps.setInt(12, theaterOwnerBean.getMovie_certification_id()); ps.executeUpdate(); rs = ps.getGeneratedKeys(); if(rs.next()) { theaterOwnerBean.setMovie_details_id(rs.getInt(1)); theaterOwnerBean.setNav_bar_movie_status("Yes"); theaterOwnerBean.setNav_bar_mv_arrangement_status("Yes"); } */ SimpleDateFormat date = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); Date bookdate = date.parse(theaterOwnerBean.getBooking_open_date()); String bookOpenDate = dateformat.format(bookdate); String movie_details="INSERT INTO movie_details(master_movie_id,movie_language_id,Format_id,theater_owner_id,booking_open_date,is_deleted,STATUS,movie_id,created_date) VALUES(?,?,?,?,?,?,?,?,NOW())"; ps = conn.prepareStatement(movie_details, ps.RETURN_GENERATED_KEYS); ps.setInt(1, theaterOwnerBean.getMaster_movie_id()); ps.setInt(2, theaterOwnerBean.getMovie_language_id()); ps.setInt(3, theaterOwnerBean.getMovie_format_id()); ps.setInt(4,theaterOwnerBean.getTheater_owner_id()); ps.setString(5, bookOpenDate); ps.setString(6, "N"); ps.setString(7, "Active"); ps.setString(8, movie_id); ps.executeUpdate(); rs = ps.getGeneratedKeys(); if(rs.next()) { theaterOwnerBean.setMovie_details_id(rs.getInt(1)); theaterOwnerBean.setNav_bar_movie_status("Yes"); theaterOwnerBean.setNav_bar_mv_arrangement_status("Yes"); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } public ArrayList<TheaterOwnerBean> getMovieDetailList(TheaterOwnerBean theaterOwnerBean) throws Exception { ArrayList<TheaterOwnerBean> movieList=new ArrayList<TheaterOwnerBean>(); PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; Connection conn=null; try { conn = connectionManager.getConnection(); SimpleDateFormat date = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); String movie_list="SELECT k.movie_certification_name,m.movie_id,m.movie_details_id,m.movie_language_id,l.language_name,m.Format_id,f.format_name,n.release_date,n.movie_name,n.genre_id_str,n.duration,n.movie_poster_path,n.release_date,m.booking_open_date FROM movie_details m" + " INNER JOIN movie_languge l ON m.movie_language_id=l.language_id INNER JOIN movie_format f ON f.movie_format_id=m.Format_id INNER JOIN master_movie_detail n ON n.master_movie_id = m.master_movie_id INNER JOIN movie_certification k ON k.movie_certification_id = n.certification_id WHERE m.theater_owner_id = ? AND m.is_deleted='N'"; ps = conn.prepareStatement(movie_list); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs = ps.executeQuery(); while(rs.next()){ theaterOwnerBean=new TheaterOwnerBean(); theaterOwnerBean.setMovie_details_id(rs.getInt("movie_details_id")); theaterOwnerBean.setMovie_name(rs.getString("movie_name")); theaterOwnerBean.setMovie_languge_name(rs.getString("language_name")); theaterOwnerBean.setMovie_format_name(rs.getString("format_name")); theaterOwnerBean.setMovie_certification_name(rs.getString("movie_certification_name")); theaterOwnerBean.setMovie_duration(rs.getString("duration")); theaterOwnerBean.setMovie_poster_path(rs.getString("movie_poster_path")); theaterOwnerBean.setMovie_id(rs.getString("movie_id")); Date reldate = dateformat.parse(rs.getString("release_date")); String releaseDate = date.format(reldate); theaterOwnerBean.setMovie_release_date(releaseDate); if(rs.getString("booking_open_date") != null) { Date bookdate = dateformat.parse(rs.getString("booking_open_date")); String bookOpenDate = date.format(bookdate); theaterOwnerBean.setBooking_open_date(bookOpenDate); } String genre = rs.getString("genre_id_str"); if(genre != "") { String sql1 = "SELECT GROUP_CONCAT(genre_name) AS 'genreName' FROM movie_genre WHERE genre_id IN ("+genre+")"; ps1 = conn.prepareStatement(sql1); rs1 = ps1.executeQuery(); while(rs1.next()) { theaterOwnerBean.setMovie_genre_name(rs1.getString("genreName")); } } movieList.add(theaterOwnerBean); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieList; } public Map<Integer, byte[]> getMoviePosterImage(TheaterOwnerBean theaterOwnerBean) throws Exception { Map<Integer, byte[]> movieImgeMap = new HashMap<Integer,byte[]>(); PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; Connection conn=null; try { conn = connectionManager.getConnection(); String movie_poster="select movie_details_id,movie_poster from movie_details where movie_details_id =?"; ps = conn.prepareStatement(movie_poster); ps.setInt(1, theaterOwnerBean.getMovie_details_id()); rs = ps.executeQuery(); while(rs.next()) { if(rs.getBytes("movie_poster") != null) { movieImgeMap.put(rs.getInt("movie_details_id"), rs.getBytes("movie_poster")); } } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieImgeMap; } //setDeleteScreenLayoutDetail created by ramya -03-08-18 public TheaterDetailBean setDeleteScreenLayoutDetail( TheaterDetailBean theaterDetailBean) throws Exception { Connection conn = null; CallableStatement cl = null; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_setDeleteScreenLayoutDetail(?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterDetailBean.getTheater_owner_id()); cl.setInt(2, theaterDetailBean.getTheater_id()); cl.setInt(3, theaterDetailBean.getScreen_id()); cl.registerOutParameter(4, Types.VARCHAR); cl.execute(); theaterDetailBean.setScreen_status(cl.getString(4)); } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterDetailBean; } //getEmployeProfileImage created by ramya -04-08-18 public Map<Integer, byte[]> getEmployeProfileImage( TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; Map<Integer, byte[]> imageMap = new HashMap<Integer,byte[]>(); try { conn = connectionManager.getConnection(); String sql = "SELECT theater_employee_id,employee_profile FROM theater_employee_details WHERE created_user_id =? AND theater_employee_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1,theaterOwnerBean.getTheater_owner_id()); ps.setInt(2, theaterOwnerBean.getTheatre_employee_id()); rs = ps.executeQuery(); while(rs.next()) { if(rs.getBytes("employee_profile") != null) { imageMap.put(rs.getInt("theater_employee_id"), rs.getBytes("employee_profile")); } } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return imageMap; } //edit movie details public TheaterOwnerBean setMovieEditDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; Connection conn=null; try { conn = connectionManager.getConnection(); /*SimpleDateFormat date = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); String movie_details="SELECT k.movie_name,m.certification_id,m.format_id,m.movie_language_id,m.movie_details_id,m.master_movie_id,m.movie_language_id,m.genre_id,m.Format_id,m.movie_duration,m.movie_poster_path,l.language_name,f.format_name,g.genre_name,m.movie_release_date FROM movie_details m " + "INNER JOIN movie_languge l ON m.movie_language_id=l.language_id INNER JOIN movie_genre g ON g.genre_id=m.genre_id INNER JOIN movie_format f ON f.movie_format_id=m.Format_id INNER JOIN master_movie_detail k ON k.master_movie_id = m.master_movie_id WHERE m.is_deleted='N' AND m.theater_owner_id=? AND m.movie_details_id =?" ; ps = conn.prepareStatement(movie_details); ps.setInt(1,theaterOwnerBean.getTheater_owner_id()); ps.setInt(2, theaterOwnerBean.getMovie_details_id()); rs = ps.executeQuery(); while(rs.next()) { theaterOwnerBean.setMovie_name(rs.getString("movie_name")); theaterOwnerBean.setMovie_certification_id(rs.getInt("certification_id")); theaterOwnerBean.setMovie_format_id(rs.getInt("format_id")); theaterOwnerBean.setMovie_language_id(rs.getInt("movie_language_id")); theaterOwnerBean.setMovie_details_id(rs.getInt("movie_details_id")); theaterOwnerBean.setMaster_movie_id(rs.getInt("master_movie_id")); theaterOwnerBean.setMovie_languge_name(rs.getString("language_name")); theaterOwnerBean.setMovie_genre_name(rs.getString("genre_name")); theaterOwnerBean.setMovie_genre_id(rs.getInt("genre_id")); theaterOwnerBean.setMovie_format_name(rs.getString("format_name")); theaterOwnerBean.setMovie_duration(rs.getString("movie_duration")); Date reldate = dateformat.parse(rs.getString("movie_release_date")); String releaseDate = date.format(reldate); theaterOwnerBean.setMovie_release_date(releaseDate); theaterOwnerBean.setMovie_poster_path(rs.getString("movie_poster_path")); } */ SimpleDateFormat date = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); String movie_details="SELECT k.movie_name,k.certification_id,m.Format_id,m.movie_language_id,m.movie_details_id,m.master_movie_id,k.duration,k.movie_poster_path,l.language_name,f.format_name,k.release_date,k.genre_id_str,m.booking_open_date FROM movie_details m " + "INNER JOIN movie_languge l ON m.movie_language_id=l.language_id INNER JOIN movie_format f ON f.movie_format_id=m.Format_id INNER JOIN master_movie_detail k ON k.master_movie_id = m.master_movie_id WHERE m.is_deleted='N' AND m.theater_owner_id=? AND m.movie_details_id =?"; ps = conn.prepareStatement(movie_details); ps.setInt(1,theaterOwnerBean.getTheater_owner_id()); ps.setInt(2, theaterOwnerBean.getMovie_details_id()); rs = ps.executeQuery(); while(rs.next()) { theaterOwnerBean.setMovie_name(rs.getString("movie_name")); theaterOwnerBean.setMovie_certification_id(rs.getInt("certification_id")); theaterOwnerBean.setMovie_format_id(rs.getInt("Format_id")); theaterOwnerBean.setMovie_language_id(rs.getInt("movie_language_id")); theaterOwnerBean.setMovie_details_id(rs.getInt("movie_details_id")); theaterOwnerBean.setMaster_movie_id(rs.getInt("master_movie_id")); theaterOwnerBean.setMovie_languge_name(rs.getString("language_name")); theaterOwnerBean.setMovie_format_name(rs.getString("format_name")); theaterOwnerBean.setMovie_duration(rs.getString("duration")); Date reldate = dateformat.parse(rs.getString("release_date")); String releaseDate = date.format(reldate); theaterOwnerBean.setMovie_release_date(releaseDate); theaterOwnerBean.setMovie_poster_path(rs.getString("movie_poster_path")); if(rs.getString("booking_open_date") != null) { Date bookdate = dateformat.parse(rs.getString("booking_open_date")); String bookOpenDate = date.format(bookdate); theaterOwnerBean.setBooking_open_date(bookOpenDate); } String sql11 = "SELECT GROUP_CONCAT(genre_name) AS 'genreName' FROM movie_genre WHERE genre_id IN ("+rs.getString("genre_id_str")+")"; ps1 = conn.prepareStatement(sql11); rs1 = ps1.executeQuery(); while(rs1.next()) { theaterOwnerBean.setMovie_genre_name(rs1.getString("genreName")); } } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //edit movie submit public TheaterOwnerBean setMovieEditDetailSubmit(TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; try { conn = connectionManager.getConnection(); /* SimpleDateFormat date = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); Date reldate = date.parse(theaterOwnerBean.getMovie_release_date()); String releaseDate = dateformat.format(reldate); if(theaterOwnerBean.getMovie_poster()!=null) { Object path=theaterOwnerBean.getPath(); String strpath=(String)path; String fileName = theaterOwnerBean.getFile_name(); String folderName = "movie-images"; String docPath = strpath+"/"+theaterOwnerBean.getTheater_owner_first_name()+"-"+theaterOwnerBean.getTheater_owner_id()+"//"+folderName+"//"; File pathFile = new File(docPath); if(pathFile.isDirectory()) { }else { pathFile.mkdir(); } File createFile = new File(docPath+fileName); FileUtils.copyFile(theaterOwnerBean.getMovie_poster(), createFile); String update_movie="UPDATE movie_details SET movie_language_id=?,genre_id=?,Format_id=?,movie_duration=?,movie_poster_path=?,movie_release_date=?,certification_id=? WHERE movie_details_id=? and theater_owner_id=?"; ps = conn.prepareStatement(update_movie); ps.setInt(1, theaterOwnerBean.getMovie_language_id()); ps.setInt(2, theaterOwnerBean.getMovie_genre_id()); ps.setInt(3, theaterOwnerBean.getMovie_format_id()); ps.setString(4, theaterOwnerBean.getMovie_duration()); ps.setString(5,docPath+fileName); ps.setString(6, releaseDate); ps.setInt(7, theaterOwnerBean.getMovie_certification_id()); ps.setInt(8, theaterOwnerBean.getMovie_details_id()); ps.setInt(9, theaterOwnerBean.getTheater_owner_id()); ps.executeUpdate(); } else{ String update_movie="UPDATE movie_details SET movie_language_id=?,genre_id=?,Format_id=?,movie_duration=?,movie_release_date=?,certification_id=? WHERE movie_details_id=? and theater_owner_id=?"; ps = conn.prepareStatement(update_movie); ps.setInt(1, theaterOwnerBean.getMovie_language_id()); ps.setInt(2, theaterOwnerBean.getMovie_genre_id()); ps.setInt(3, theaterOwnerBean.getMovie_format_id()); ps.setString(4, theaterOwnerBean.getMovie_duration()); ps.setString(5, releaseDate); ps.setInt(6, theaterOwnerBean.getMovie_certification_id()); ps.setInt(7, theaterOwnerBean.getMovie_details_id()); ps.setInt(8, theaterOwnerBean.getTheater_owner_id()); ps.executeUpdate(); } */ SimpleDateFormat date = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); Date bookdate = date.parse(theaterOwnerBean.getBooking_open_date()); String bookOpenDate = dateformat.format(bookdate); String update_movie="UPDATE movie_details SET movie_language_id=?,Format_id=?,booking_open_date=? WHERE movie_details_id=? and theater_owner_id=?"; ps = conn.prepareStatement(update_movie); ps.setInt(1, theaterOwnerBean.getMovie_language_id()); ps.setInt(2, theaterOwnerBean.getMovie_format_id()); ps.setString(3, bookOpenDate); ps.setInt(4, theaterOwnerBean.getMovie_details_id()); ps.setInt(5, theaterOwnerBean.getTheater_owner_id()); ps.executeUpdate(); } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //delete movie details public TheaterOwnerBean deleteMovieDetailsSubmit(TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; try { conn = connectionManager.getConnection(); String deleteEmployee="UPDATE movie_details SET status=?,is_deleted=? WHERE movie_details_id=?"; ps = conn.prepareStatement(deleteEmployee); ps.setString(1, "InActive"); ps.setString(2, "Y"); ps.setInt(3, theaterOwnerBean.getMovie_details_id()); ps.executeUpdate(); } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getTheaterMapDetail created by ramya - 06-08-18 public Map<Integer, String> getTheaterMapDetail( TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; Map<Integer, String> theaterMap = new HashMap<Integer, String>(); try { conn = connectionManager.getConnection(); String sql = "SELECT theater_id,theater_name FROM theater_detail WHERE theater_owner_id = ? AND STATUS='Active' AND is_deleted='N'"; ps = conn.prepareStatement(sql); ps.setInt(1,theaterOwnerBean.getTheater_owner_id()); rs = ps.executeQuery(); while(rs.next()) { theaterMap.put(rs.getInt("theater_id"), rs.getString("theater_name")); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterMap; } //getTheaterScreenDetailsForView public TheaterOwnerBean getTheaterScreenDetailsForView(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; Map<Integer, String> theaterMap = new HashMap<Integer,String>(); Map<Integer, String> screenMap = new HashMap<Integer,String>(); Map<Integer, String> categoryMap = new HashMap<Integer,String>(); int i = 1; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getTheaterScreenDetails_View(?,?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.registerOutParameter(2, Types.INTEGER); cl.registerOutParameter(3, Types.INTEGER); cl.registerOutParameter(4, Types.VARCHAR); cl.registerOutParameter(5, Types.VARCHAR); boolean result = cl.execute(); if(result) { theaterOwnerBean.setTheater_id(cl.getInt(2)); theaterOwnerBean.setScreen_id(cl.getInt(3)); theaterOwnerBean.setTheater_name(cl.getString(4)); theaterOwnerBean.setScreen_layout_path(cl.getString(5)); theaterOwnerBean.setStatus("success"); while(result) { ResultSet rs = cl.getResultSet(); if(i==1) { while(rs.next()) { theaterMap.put(rs.getInt("theater_id"), rs.getString("theater_name")); } } theaterOwnerBean.setTheaterMap(theaterMap); if(i==2) { while(rs.next()) { screenMap.put(rs.getInt("screen_id"), rs.getString("screen_name")); } } theaterOwnerBean.setScreenMap(screenMap); if(i==3) { while(rs.next()) { categoryMap.put(rs.getInt("seat_category_id"), rs.getString("seat_category")); } } theaterOwnerBean.setTicketCategoryMap(categoryMap); i++; result = cl.getMoreResults(); } } else { theaterOwnerBean.setStatus("failure"); } } catch (Exception e) { e.printStackTrace(); String str = "getTheaterScreenDetailsForView"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getTheaterAgainstScreenForview public TheaterOwnerBean getTheaterAgainstScreenForview(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; ResultSet rs = null; Map<Integer, String> screenMap = new HashMap<Integer,String>(); try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getTheaterAgainstScreen_View(?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_id()); cl.registerOutParameter(2, Types.INTEGER); cl.registerOutParameter(3, Types.VARCHAR); cl.registerOutParameter(4, Types.VARCHAR); cl.execute(); rs = cl.executeQuery(); theaterOwnerBean.setScreen_id(cl.getInt(2)); theaterOwnerBean.setTheater_name(cl.getString(3)); theaterOwnerBean.setScreen_layout_path(cl.getString(4)); while(rs.next()) { screenMap.put(rs.getInt("screen_id"), rs.getString("screen_name")); } theaterOwnerBean.setScreenMap(screenMap); } catch (Exception e) { e.printStackTrace(); String str = "getTheaterAgainstScreenForview"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getEditScreenDetails public TheaterOwnerBean getEditScreenDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; int i = 1; Map<Integer, String> categoryMap = new HashMap<Integer,String>(); try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getEditScreenDetails(?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getScreen_id()); boolean res = cl.execute(); while(res) { ResultSet rs = cl.getResultSet(); if(i==1) { if(rs.next()) { theaterOwnerBean.setCategory_from_id(rs.getInt("seat_category_start_id")); theaterOwnerBean.setCategory_to_id(rs.getInt("seat_category_end_id")); theaterOwnerBean.setOrder_id(rs.getInt("order_id")); theaterOwnerBean.setPassage_count(rs.getInt("passage_count")); } } if(i==2) { while(rs.next()) { categoryMap.put(rs.getInt("seat_category_id"), rs.getString("seat_category")); } } theaterOwnerBean.setSeatCategoryMap(categoryMap); i++; res = cl.getMoreResults(); } } catch (Exception e) { e.printStackTrace(); String str = "getEditScreenDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getDistrictWiseCityDetails public TheaterOwnerBean getDistrictWiseCityDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; Map<Integer, String> cityMap = new HashMap<Integer,String>(); try { conn = connectionManager.getConnection(); String sql = "SELECT city_id,city_name FROM city WHERE district_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getDistrict_id()); rs = ps.executeQuery(); while(rs.next()) { cityMap.put(rs.getInt("city_id"), rs.getString("city_name")); } theaterOwnerBean.setCityMap(cityMap); } catch (Exception e) { e.printStackTrace(); String str = "getDistrictWiseCityDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getNavBarScreenDetails public TheaterOwnerBean getNavBarScreenDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getNavBarScreenDetails(?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.registerOutParameter(2, Types.VARCHAR); cl.execute(); theaterOwnerBean.setNavBarScreenStatus(cl.getString(2)); } catch (Exception e) { e.printStackTrace(); String str = "getNavBarScreenDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getMovieIdDetails created by ramya 10-08-18 public Map<Integer, String> getMovieIdDetails( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; Map<Integer, String> movieIdMap = new HashMap<Integer,String>(); int i =1; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getMovieIdDetails(?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); boolean res = cl.execute(); while(res) { ResultSet rs = cl.getResultSet(); if(i==1) { while(rs.next()) { movieIdMap.put(rs.getInt("movie_details_id"), rs.getString("movie_name")+" - "+rs.getString("language_name")); } } i++; res = cl.getMoreResults(); } } catch (Exception e) { e.printStackTrace(); String str = "getMovieIdDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieIdMap; } //setMovieScreenShowTimeDetail created by ramya 10-08-18 public TheaterOwnerBean setMovieScreenShowTimeDetail( TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; try { conn = connectionManager.getConnection(); String[] date = theaterOwnerBean.getShow_date().split("-"); String startDate = date[0].trim(); String endDate = date[1].trim(); if(startDate.equals(endDate)){ SimpleDateFormat date_Format = new SimpleDateFormat("yyyy/MM/dd"); SimpleDateFormat date_Format1 = new SimpleDateFormat("yyyy-MM-dd"); Date date1 = date_Format.parse(startDate); String singleStrtDate = date_Format1.format(date1); String sql1="INSERT INTO theater_show_details (theater_id,theater_owner_id,screen_id,movie_detail_id,show_date,show_date_id,creation_date) VALUES(?,?,?,?,?,?,NOW())"; ps = conn.prepareStatement(sql1,ps.RETURN_GENERATED_KEYS); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, theaterOwnerBean.getTheater_owner_id()); ps.setInt(3, theaterOwnerBean.getScreen_id()); ps.setInt(4, theaterOwnerBean.getMovie_details_id()); ps.setString(5, singleStrtDate); ps.setInt(6, Integer.parseInt(startDate.replaceAll("/", "").trim())); ps.executeUpdate(); rs = ps.getGeneratedKeys(); int show_detail_id = 0; if(rs.next()){ show_detail_id = rs.getInt(1); theaterOwnerBean.setShow_detail_id(show_detail_id); } for (String showTime : theaterOwnerBean.getShowTimingList()) { String sql2="INSERT INTO show_timing (show_details_id,show_timing,STATUS,is_deleted) VALUES(?,?,'Active','N')"; ps = conn.prepareStatement(sql2); ps.setInt(1, theaterOwnerBean.getShow_detail_id()); ps.setString(2, showTime); ps.executeUpdate(); } } else{ ArrayList<Date> datetList = new ArrayList<Date>(); datetList = searchBetweenDates( new SimpleDateFormat("yyyy/MM/dd").parse(startDate), new SimpleDateFormat("yyyy/MM/dd").parse(endDate)); String[] comboDates = new String[datetList.size()]; for(int i=0; i<datetList.size(); i++){ comboDates[i] = new SimpleDateFormat("yyyy-MM-dd").format(((Date)datetList.get(i))); } for(int i=0; i<comboDates.length; i++) { String sql1="INSERT INTO theater_show_details (theater_id,theater_owner_id,screen_id,movie_detail_id,show_date,show_date_id,creation_date) VALUES(?,?,?,?,?,?,NOW())"; ps = conn.prepareStatement(sql1,ps.RETURN_GENERATED_KEYS); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, theaterOwnerBean.getTheater_owner_id()); ps.setInt(3, theaterOwnerBean.getScreen_id()); ps.setInt(4, theaterOwnerBean.getMovie_details_id()); ps.setString(5, comboDates[i]); ps.setInt(6, Integer.parseInt(comboDates[i].replaceAll("-", "").trim())); ps.executeUpdate(); rs = ps.getGeneratedKeys(); int show_detail_id = 0; if(rs.next()){ show_detail_id = rs.getInt(1); theaterOwnerBean.setShow_detail_id(show_detail_id); } for (String showTime : theaterOwnerBean.getShowTimingList()) { String sql2="INSERT INTO show_timing (show_details_id,show_timing,STATUS,is_deleted) VALUES(?,?,'Active','N')"; ps = conn.prepareStatement(sql2); ps.setInt(1, theaterOwnerBean.getShow_detail_id()); ps.setString(2, showTime); ps.executeUpdate(); } } } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //searchBetweenDates private ArrayList<Date> searchBetweenDates(Date startDate, Date endDate) { Date begin = new Date(startDate.getTime()); ArrayList<Date> list = new ArrayList<Date>(); list.add(new Date(begin.getTime())); while(begin.compareTo(endDate)<0) { begin = new Date(begin.getTime() + 86400000); list.add(new Date(begin.getTime())); } return list; } //getMovieScreenShowDetail created by ramya-11-08-18 public TheaterOwnerBean getMovieScreenShowDetail( TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; PreparedStatement ps2=null; ResultSet rs2=null; Connection conn=null; TheaterDetailBean theaterDetailBean = null; ScreenDetailBean screenDetailBean = null; TicketCounterBean ticketCounterBean = null; ArrayList<TheaterDetailBean> movieList = new ArrayList<TheaterDetailBean>(); try { conn = connectionManager.getConnection(); String date = ""; String date1 = ""; SimpleDateFormat date_Format1 = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat date_Format = new SimpleDateFormat("yyyy-MM-dd"); if(theaterOwnerBean.getStatus_id() == 1){ Date pdate = date_Format1.parse(theaterOwnerBean.getDate()); date = date_Format.format(pdate); } else{ Date today = new Date(); date = date_Format.format(today); date1 = date_Format1.format(today); } theaterOwnerBean.setDate(date1); int dateId = Integer.parseInt(date.replace("-", "")); String sql="SELECT DISTINCT(s.movie_details_id),n.movie_poster_path,n.movie_name,s.movie_id,l.theater_name,l.theater_id FROM movie_details s INNER JOIN theater_show_details m ON s.movie_details_id = m.movie_detail_id INNER JOIN theater_detail l ON l.theater_id = m.theater_id INNER JOIN master_movie_detail n ON n.master_movie_id = s.master_movie_id WHERE m.theater_owner_id = ? AND m.show_date_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); ps.setInt(2, dateId); rs = ps.executeQuery(); while(rs.next()){ theaterDetailBean = new TheaterDetailBean(); int i = 0; int j = 0; theaterDetailBean.setMovie_detail_id(rs.getInt("movie_details_id")); theaterDetailBean.setMovie_name(rs.getString("movie_name")); theaterDetailBean.setMovie_id(rs.getString("movie_id")); theaterDetailBean.setTheater_name(rs.getString("theater_name")); theaterDetailBean.setTheater_id(rs.getInt("theater_id")); theaterDetailBean.setMovie_poster_path(rs.getString("movie_poster_path")); ArrayList<ScreenDetailBean> screenList = new ArrayList<ScreenDetailBean>(); String sql1="SELECT DISTINCT(s.screen_id),s.screen_name FROM screen_detail s INNER JOIN theater_show_details m ON s.screen_id = m.screen_id WHERE m.movie_detail_id = ? AND m.theater_id = ? AND m.show_date_id = ?"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterDetailBean.getMovie_detail_id()); ps1.setInt(2, theaterDetailBean.getTheater_id()); ps1.setInt(3, dateId); rs1 = ps1.executeQuery(); while(rs1.next()){ screenDetailBean = new ScreenDetailBean(); screenDetailBean.setScreen_id(rs1.getInt("screen_id")); screenDetailBean.setScreen_name(rs1.getString("screen_name")); String showDetailId = ""; String sql6="SELECT m.show_details_id FROM screen_detail s INNER JOIN theater_show_details m ON s.screen_id = m.screen_id WHERE m.movie_detail_id = ? AND m.theater_id = ? AND s.screen_id = ? AND m.show_date_id = ?"; ps2 = conn.prepareStatement(sql6); ps2.setInt(1, theaterDetailBean.getMovie_detail_id()); ps2.setInt(2, theaterDetailBean.getTheater_id()); ps2.setInt(3, screenDetailBean.getScreen_id()); ps2.setInt(4, dateId); rs2 = ps2.executeQuery(); while(rs2.next()){ showDetailId += rs2.getInt("show_details_id")+","; } if(showDetailId != "") { showDetailId = showDetailId.substring(0,showDetailId.length()-1); } ArrayList<TicketCounterBean> showTimingList = new ArrayList<TicketCounterBean>(); String sql2="SELECT show_timing_id,show_timing FROM show_timing WHERE show_details_id IN ("+showDetailId+") AND STATUS = 'Active' AND is_deleted = 'N'"; ps2 = conn.prepareStatement(sql2); rs2 = ps2.executeQuery(); while(rs2.next()){ ticketCounterBean = new TicketCounterBean(); ticketCounterBean.setShow_timing_id(rs2.getInt("show_timing_id")); SimpleDateFormat date24Format = new SimpleDateFormat("HH:mm"); SimpleDateFormat date12Format = new SimpleDateFormat("hh:mm a"); String showTime = date12Format.format(date24Format.parse(rs2.getString("show_timing"))); ticketCounterBean.setShow_timing(showTime); showTimingList.add(ticketCounterBean); i = 1; } screenDetailBean.setShowTimingList(showTimingList); if(i == 1){ screenList.add(screenDetailBean); } j = 1; } theaterDetailBean.setScreenList(screenList); if(i == 1 && j == 1){ movieList.add(theaterDetailBean); } } theaterOwnerBean.setTheaterDetailList(movieList); } catch(Exception e) { e.printStackTrace(); String str = "getMovieScreenShowDetail"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getScreenMapDetail created by ramya-11-08-18 public Map<Integer, String> getScreenMapDetail( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; Map<Integer, String> screenMap = new HashMap<Integer,String>(); int i =1; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getScreenMapDetail(?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_id()); boolean res = cl.execute(); while(res) { ResultSet rs = cl.getResultSet(); if(i==1) { while(rs.next()) { screenMap.put(rs.getInt("screen_id"), rs.getString("screen_name")); } } i++; res = cl.getMoreResults(); } } catch (Exception e) { e.printStackTrace(); String str = "getScreenMapDetail"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return screenMap; } //setDeleteShowTime created by ramya-11-08-18 public TheaterOwnerBean setDeleteShowTime( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_setDeleteShowTime(?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getShow_timing_id()); cl.registerOutParameter(2, Types.VARCHAR); cl.execute(); theaterOwnerBean.setShow_time_status(cl.getString(2)); } catch (Exception e) { e.printStackTrace(); String str = "setDeleteShowTime"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getMovieIDDetails public TheaterOwnerBean getMovieIDDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { conn = connectionManager.getConnection(); String sql = "SELECT movie_name,movie_id FROM movie_details WHERE movie_details_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getMovie_details_id()); rs = ps.executeQuery(); if(rs.next()) { theaterOwnerBean.setMovie_name(rs.getString("movie_name")); theaterOwnerBean.setMovie_id(rs.getString("movie_id")); } } catch (Exception e) { e.printStackTrace(); String str = "getMovieIDDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getNavBarMovieDetails created by ramya -13-08-18 public TheaterOwnerBean getNavBarMovieDetails( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getNavBarMovieDetails(?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.registerOutParameter(2, Types.VARCHAR); cl.execute(); theaterOwnerBean.setNav_bar_movie_status(cl.getString(2)); } catch (Exception e) { e.printStackTrace(); String str = "getNavBarMovieDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getNavBarUserDetails created by ramya -13-08-18 public TheaterOwnerBean getNavBarUserDetails( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getNavBarUserDetails(?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.registerOutParameter(2, Types.VARCHAR); cl.execute(); theaterOwnerBean.setNav_bar_user_status(cl.getString(2)); } catch (Exception e) { e.printStackTrace(); String str = "getNavBarUserDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //get movie date public TreeMap<Integer, String> getMovieDate(TheaterOwnerBean theaterOwnerBean) throws Exception { TreeMap<Integer, String> movieDateMap=new TreeMap<Integer,String>(); PreparedStatement ps=null; Connection conn=null; ResultSet rs=null; try { SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat showDateFr = new SimpleDateFormat("dd-MM-yyyy"); Date today = new Date(); String curr_date = date.format(today); int dateKey = Integer.parseInt(curr_date.replace("-", "")); conn = connectionManager.getConnection(); String datemap="SELECT DISTINCT(show_date_id),show_date FROM theater_show_details WHERE movie_detail_id=? AND show_date_id >= ?"; ps = conn.prepareStatement(datemap); ps.setInt(1, theaterOwnerBean.getMovie_details_id()); ps.setInt(2, dateKey); rs = ps.executeQuery(); while(rs.next()) { Date date1 = date.parse(rs.getString("show_date")); String showDate = showDateFr.format(date1); movieDateMap.put(rs.getInt("show_date_id"), showDate); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieDateMap; } //get show details public HashMap<Integer, String> getMovieShows(TheaterOwnerBean theaterOwnerBean) throws Exception { HashMap<Integer, String> movieShowMap=new HashMap<Integer,String>(); PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; try { conn = connectionManager.getConnection(); String movieshow="SELECT s.screen_id,t.show_timing FROM theater_show_details s INNER JOIN show_timing t ON t.show_details_id=s.show_details_id WHERE s.movie_detail_id=?"; ps = conn.prepareStatement(movieshow); ps.setInt(1, theaterOwnerBean.getMovie_details_id()); rs = ps.executeQuery(); if(rs.next()) { //screenMap.put(rs.getInt("screen_id"), rs.getString("screen_name")); movieShowMap.put(rs.getInt("screen_id"),rs.getString("show_timing")); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieShowMap; } @Override public ArrayList<TheaterOwnerBean> getMovieShowList(TheaterOwnerBean theaterOwnerBean) throws Exception { ArrayList<TheaterOwnerBean> movieShowList=new ArrayList<TheaterOwnerBean>(); ArrayList<ScreenDetailBean> showTimingList=new ArrayList<ScreenDetailBean>(); PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; PreparedStatement ps2=null; ResultSet rs2=null; Connection conn=null; ScreenDetailBean screenDetailBean = new ScreenDetailBean(); try { conn = connectionManager.getConnection(); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); String d = dateFormat.format(date); int todayInt = Integer.parseInt(d.replaceAll("-", "")); int selectDate = theaterOwnerBean.getDate_id(); String movieshow="SELECT DISTINCT(s.show_details_id),s.screen_id,s.movie_detail_id,s.theater_id FROM theater_show_details s INNER JOIN show_timing t ON t.show_details_id=s.show_details_id WHERE s.movie_detail_id=? AND s.theater_id =? AND s.show_date_id = ? AND t.status = 'Active' AND t.is_deleted = 'N'"; ps = conn.prepareStatement(movieshow); ps.setInt(1, theaterOwnerBean.getMovie_details_id()); ps.setInt(2, theaterOwnerBean.getTheater_id()); ps.setInt(3, theaterOwnerBean.getDate_id()); rs = ps.executeQuery(); while(rs.next()) { theaterOwnerBean=new TheaterOwnerBean(); theaterOwnerBean.setShow_detail_id(rs.getInt("show_details_id")); theaterOwnerBean.setScreen_id(rs.getInt("screen_id")); theaterOwnerBean.setMovie_details_id(rs.getInt("movie_detail_id")); theaterOwnerBean.setTheater_id(rs.getInt("theater_id")); String sql = "SELECT screen_name FROM screen_detail WHERE screen_id = ?"; ps1 = conn.prepareStatement(sql); ps1.setInt(1, theaterOwnerBean.getScreen_id()); rs1 = ps1.executeQuery(); while(rs1.next()) { theaterOwnerBean.setScreen_name(rs1.getString("screen_name")); } String sql1 = "SELECT show_timing_id,show_timing FROM show_timing WHERE show_details_id = ?"; ps2 = conn.prepareStatement(sql1); ps2.setInt(1, theaterOwnerBean.getShow_detail_id()); rs2 = ps2.executeQuery(); while(rs2.next()) { screenDetailBean = new ScreenDetailBean(); screenDetailBean.setShow_id(rs2.getInt("show_timing_id")); SimpleDateFormat date24Format = new SimpleDateFormat("HH:mm"); SimpleDateFormat date12Format = new SimpleDateFormat("hh:mm a"); String showTime = date12Format.format(date24Format.parse(rs2.getString("show_timing"))); screenDetailBean.setShow_timing(showTime); if(selectDate == todayInt) { Calendar date1 = Calendar.getInstance(); date1.set(Calendar.HOUR_OF_DAY, date1.getTime().getHours() ); date1.set(Calendar.MINUTE, date1.getTime().getMinutes() ); date1.set(Calendar.SECOND, 0); String reference = rs2.getString("show_timing"); String[] parts = reference.split(":"); Calendar date2 = Calendar.getInstance(); date2.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parts[0])); date2.set(Calendar.MINUTE, Integer.parseInt(parts[1])); date2.set(Calendar.SECOND, 0); if (date1.before(date2)) { screenDetailBean.setShow_time_status("Active"); } else { screenDetailBean.setShow_time_status("InActive"); } } showTimingList.add(screenDetailBean); } theaterOwnerBean.setMovieShowTimingList(showTimingList); movieShowList.add(theaterOwnerBean); } /*String movieshow="SELECT s.show_details_id,s.screen_id,s.movie_detail_id,s.theater_id,t.show_timing_id,t.show_timing FROM theater_show_details s INNER JOIN show_timing t ON t.show_details_id=s.show_details_id WHERE s.movie_detail_id=? AND s.theater_id =? AND s.show_date_id = ? AND t.status = 'Active' AND t.is_deleted = 'N'"; ps = conn.prepareStatement(movieshow); ps.setInt(1, theaterOwnerBean.getMovie_details_id()); ps.setInt(2, theaterOwnerBean.getTheater_id()); ps.setInt(3, theaterOwnerBean.getDate_id()); rs = ps.executeQuery(); while(rs.next()) { theaterOwnerBean=new TheaterOwnerBean(); theaterOwnerBean.setShow_detail_id(rs.getInt("show_details_id")); theaterOwnerBean.setScreen_id(rs.getInt("screen_id")); theaterOwnerBean.setMovie_details_id(rs.getInt("movie_detail_id")); theaterOwnerBean.setTheater_id(rs.getInt("theater_id")); theaterOwnerBean.setShow_timing_id(rs.getInt("show_timing_id")); SimpleDateFormat date24Format = new SimpleDateFormat("HH:mm"); SimpleDateFormat date12Format = new SimpleDateFormat("hh:mm a"); String showTime = date12Format.format(date24Format.parse(rs.getString("show_timing"))); theaterOwnerBean.setShow_time(showTime); if(selectDate == todayInt) { Calendar date1 = Calendar.getInstance(); date1.set(Calendar.HOUR_OF_DAY, date1.getTime().getHours() ); date1.set(Calendar.MINUTE, date1.getTime().getMinutes() ); date1.set(Calendar.SECOND, 0); String reference = rs.getString("show_timing"); String[] parts = reference.split(":"); Calendar date2 = Calendar.getInstance(); date2.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parts[0])); date2.set(Calendar.MINUTE, Integer.parseInt(parts[1])); date2.set(Calendar.SECOND, 0); if (date1.before(date2)) { theaterOwnerBean.setShow_time_status("Active"); } else { theaterOwnerBean.setShow_time_status("InActive"); } } movieShowList.add(theaterOwnerBean); }*/ } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieShowList; } //getScreenwiseSeatingDetails public TheaterOwnerBean getScreenwiseSeatingDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; Connection conn=null; /*ArrayList<TheaterDetailBean> finalList = new ArrayList<TheaterDetailBean>(); ArrayList<ScreenDetailBean> subList = new ArrayList<ScreenDetailBean>(); ArrayList<TicketCounterBean> seatList = new ArrayList<TicketCounterBean>(); ArrayList<String> soldedSeatsList = new ArrayList<String>();*/ ArrayList<String> soldedSeatsList = new ArrayList<String>(); ArrayList<TheaterDetailBean> seatcategoryPriceList = new ArrayList<TheaterDetailBean>(); TheaterDetailBean theaterDetailBean = null; TicketCounterBean ticketCounterBean = null; ScreenDetailBean screenDetailBean = null; try { conn = connectionManager.getConnection(); String solded_seats = ""; String sql6 = "SELECT seat_id FROM movie_ticket_sold_details WHERE theater_id =? AND screen_id =? AND show_timing_id = ? AND movie_detail_id = ? AND show_detail_id = ? AND show_date_id = ? AND STATUS = 'Active' AND is_deleted = 'N'"; ps = conn.prepareStatement(sql6); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, theaterOwnerBean.getScreen_id()); ps.setInt(3, theaterOwnerBean.getShow_timing_id()); ps.setInt(4, theaterOwnerBean.getMovie_details_id()); ps.setInt(5, theaterOwnerBean.getShow_detail_id()); ps.setInt(6, theaterOwnerBean.getDate_id()); rs = ps.executeQuery(); while(rs.next()) { solded_seats = rs.getString("seat_id"); } String soldedSeatsArray[] = solded_seats.split(","); for(int j=0;j < soldedSeatsArray.length;j++) { soldedSeatsList.add(soldedSeatsArray[j]); } /*String sql = "SELECT seat_category_start_id,seat_category_end_id,order_id FROM screen_seat_category_detail WHERE screen_id = ? AND theater_id = ? AND theater_owner_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getScreen_id()); ps.setInt(2, theaterOwnerBean.getTheater_id()); ps.setInt(3, theaterOwnerBean.getTheater_owner_id()); rs = ps.executeQuery(); while(rs.next()) { seat_category_start_id = rs.getInt("seat_category_start_id"); seat_category_end_id = rs.getInt("seat_category_end_id"); order_id = rs.getInt("order_id"); } String sql2 = "SELECT passage_count FROM screen_detail WHERE screen_id = ? AND theater_id = ?"; ps = conn.prepareStatement(sql2); ps.setInt(1, theaterOwnerBean.getScreen_id()); ps.setInt(2, theaterOwnerBean.getTheater_id()); rs = ps.executeQuery(); while(rs.next()) { passage_count = rs.getInt("passage_count"); } String sql4 = "SELECT seat_count FROM `floor_plan_detail` WHERE theater_id = ? AND screen_id = ? ORDER BY seat_count DESC LIMIT 1"; ps = conn.prepareStatement(sql4); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, theaterOwnerBean.getScreen_id()); rs = ps.executeQuery(); while(rs.next()) { seat_count = rs.getInt("seat_count"); }*/ String sql8 = "SELECT list_seat_category_price_id,seat_category_name,price FROM list_seat_category_price_detail WHERE theater_id =? AND screen_id=?"; ps = conn.prepareStatement(sql8); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, theaterOwnerBean.getScreen_id()); rs = ps.executeQuery(); while(rs.next()){ theaterDetailBean = new TheaterDetailBean(); theaterDetailBean.setSeat_category_price(rs.getInt("price")); theaterDetailBean.setSeat_category_name(rs.getString("seat_category_name")); String sq1 = "SELECT DISTINCT(total_seat_count) FROM screen_floor_plan_detail WHERE theater_id = ? AND screen_id = ?"; ps1 = conn.prepareStatement(sq1); ps1.setInt(1, theaterOwnerBean.getTheater_id()); ps1.setInt(2, theaterOwnerBean.getScreen_id()); rs1 = ps1.executeQuery(); while(rs1.next()){ theaterDetailBean.setSeat_count(rs1.getInt("total_seat_count")); } ArrayList<TicketCounterBean> categoryList = new ArrayList<TicketCounterBean>(); String sql1 = "SELECT DISTINCT(l.seat_category_id),l.seat_id,l.seat_status_id,l.total_seat_count,s.seat_category FROM screen_floor_plan_detail l INNER JOIN seat_category s ON s.seat_category_id = l.seat_category_id WHERE l.theater_id=? AND l.screen_id=? AND l.list_seat_category_price_id=?"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterOwnerBean.getTheater_id()); ps1.setInt(2, theaterOwnerBean.getScreen_id()); ps1.setInt(3, rs.getInt("list_seat_category_price_id")); rs1 = ps1.executeQuery(); while(rs1.next()){ ticketCounterBean = new TicketCounterBean(); int seatCount = rs1.getInt("total_seat_count"); String[] seat = rs1.getString("seat_id").split(","); String[] status = rs1.getString("seat_status_id").split(","); int emptySeatCount = 0; ArrayList<ScreenDetailBean> seatList = new ArrayList<ScreenDetailBean>(); for(int i =0;i <= seatCount-1;i++){ screenDetailBean = new ScreenDetailBean(); screenDetailBean.setSeatName(seat[i]); screenDetailBean.setSeatStatus(Integer.parseInt(status[i])); if(soldedSeatsList.contains(seat[i])){ screenDetailBean.setSeat_active_status_id(3); } if(Integer.parseInt(status[i]) == 0){ emptySeatCount += 1; } seatList.add(screenDetailBean); } if(seatCount == emptySeatCount){ ticketCounterBean.setCategory_name("-"); } else{ ticketCounterBean.setCategory_name(rs1.getString("seat_category")); } ticketCounterBean.setSeatList(seatList); categoryList.add(ticketCounterBean); } theaterDetailBean.setCategoryList(categoryList); seatcategoryPriceList.add(theaterDetailBean); } theaterOwnerBean.setTheaterRowList(seatcategoryPriceList); /* if(order_id == 1) { String sql1 = "SELECT seat_category,seat_category_id FROM seat_category WHERE seat_category_id BETWEEN ? AND ? ORDER BY seat_category_id ASC"; ps = conn.prepareStatement(sql1); ps.setInt(1, seat_category_start_id); ps.setInt(2, seat_category_end_id); rs = ps.executeQuery(); while(rs.next()) { TheaterDetailBean theaterDetailBean = new TheaterDetailBean(); subList = new ArrayList<ScreenDetailBean>(); theaterDetailBean.setCategory_name(rs.getString("seat_category")); theaterDetailBean.setCol_count(passage_count); theaterDetailBean.setTotal_seat_count(seat_count); String sql5 = "SELECT seat_count,seating_order_id FROM floor_plan_detail WHERE screen_id = ? AND theater_id = ? AND seat_category_id = ? ORDER BY column_id ASC"; String sql5 = "SELECT seat_id,seat_count,seating_order_id FROM floor_plan_detail WHERE screen_id = ? AND theater_id = ? AND seat_category_id = ? ORDER BY column_id ASC"; ps1 = conn.prepareStatement(sql5); ps1.setInt(1, theaterOwnerBean.getScreen_id()); ps1.setInt(2, theaterOwnerBean.getTheater_id()); ps1.setInt(3, rs.getInt("seat_category_id")); rs1 = ps1.executeQuery(); while(rs1.next()) { seatList = new ArrayList<TicketCounterBean>(); ScreenDetailBean screenDetailBean = new ScreenDetailBean(); screenDetailBean.setSeat_count(rs1.getInt("seat_count")); screenDetailBean.setOrder_id(rs1.getInt("seating_order_id")); String seat_id_str = rs1.getString("seat_id"); String array[] = seat_id_str.split(","); for(int i=0;i < seat_id_str.length();i++) { TicketCounterBean ticketCounterBean = new TicketCounterBean(); if(soldedSeatsList.contains(array[i])){ ticketCounterBean.setSeat_status_id(3); } ticketCounterBean.setSeat_name_str(array[i]); seatList.add(ticketCounterBean); } screenDetailBean.setSeatList(seatList); subList.add(screenDetailBean); } theaterDetailBean.setScreenList(subList); finalList.add(theaterDetailBean); } } else { String sql1 = "SELECT seat_category,seat_category_id FROM seat_category WHERE seat_category_id BETWEEN ? AND ? ORDER BY seat_category_id DESC;"; ps = conn.prepareStatement(sql1); ps.setInt(1, seat_category_start_id); ps.setInt(2, seat_category_end_id); rs = ps.executeQuery(); while(rs.next()) { TheaterDetailBean theaterDetailBean = new TheaterDetailBean(); subList = new ArrayList<ScreenDetailBean>(); theaterDetailBean.setCategory_name(rs.getString("seat_category")); theaterDetailBean.setCol_count(passage_count); theaterDetailBean.setTotal_seat_count(seat_count); String sql5 = "SELECT seat_count,seating_order_id FROM floor_plan_detail WHERE screen_id = ? AND theater_id = ? AND seat_category_id = ? ORDER BY column_id ASC"; String sql5 = "SELECT seat_id,seat_count,seating_order_id FROM floor_plan_detail WHERE screen_id = ? AND theater_id = ? AND seat_category_id = ? ORDER BY column_id ASC"; ps1 = conn.prepareStatement(sql5); ps1.setInt(1, theaterOwnerBean.getScreen_id()); ps1.setInt(2, theaterOwnerBean.getTheater_id()); ps1.setInt(3, rs.getInt("seat_category_id")); rs1 = ps1.executeQuery(); while(rs1.next()) { seatList = new ArrayList<TicketCounterBean>(); ScreenDetailBean screenDetailBean = new ScreenDetailBean(); screenDetailBean.setSeat_count(rs1.getInt("seat_count")); screenDetailBean.setOrder_id(rs1.getInt("seating_order_id")); String seat_id_str = rs1.getString("seat_id"); String array[] = seat_id_str.split(","); for(int i=0;i < array.length;i++) { TicketCounterBean ticketCounterBean = new TicketCounterBean(); if(soldedSeatsList.contains(array[i])){ ticketCounterBean.setSeat_status_id(3); } ticketCounterBean.setSeat_name_str(array[i].trim()); seatList.add(ticketCounterBean); } screenDetailBean.setSeatList(seatList); subList.add(screenDetailBean); } theaterDetailBean.setScreenList(subList); finalList.add(theaterDetailBean); } } theaterOwnerBean.setTheaterRowList(finalList);*/ } catch (Exception e) { e.printStackTrace(); String str = "getSeatingArrangementDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getMasterMovieDetails created by ramya 15-08-18 public Map<Integer, String> getMasterMovieDetails() throws Exception { Connection conn = null; CallableStatement cl = null; Map<Integer, String> movieIdMap = new HashMap<Integer,String>(); int i =1; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getMasterMovieDetails()}"; cl = conn.prepareCall(sql); boolean res = cl.execute(); while(res) { ResultSet rs = cl.getResultSet(); if(i==1) { while(rs.next()) { movieIdMap.put(rs.getInt("master_movie_id"), rs.getString("movie_name")); } } i++; res = cl.getMoreResults(); } } catch (Exception e) { e.printStackTrace(); String str = "getMasterMovieDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieIdMap; } //getMovieCertificationDetails created by ramya 15-08-18 public Map<Integer, String> getMovieCertificationDetails() throws Exception { Connection conn = null; CallableStatement cl = null; Map<Integer, String> movieCertificationMap = new HashMap<Integer,String>(); int i =1; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getMovieCertificationDetails()}"; cl = conn.prepareCall(sql); boolean res = cl.execute(); while(res) { ResultSet rs = cl.getResultSet(); if(i==1) { while(rs.next()) { movieCertificationMap.put(rs.getInt("movie_certification_id"), rs.getString("movie_certification_name")); } } i++; res = cl.getMoreResults(); } } catch (Exception e) { e.printStackTrace(); String str = "getMovieCertificationDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieCertificationMap; } //ticket details public TheaterOwnerBean getTicketDetail(TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; PreparedStatement ps2=null; ResultSet rs2=null; Connection conn=null; try { conn = connectionManager.getConnection(); SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat showDateFr = new SimpleDateFormat("dd-MM-yyyy"); String sql="SELECT t.theater_name,s.screen_name FROM theater_detail t INNER JOIN screen_detail s ON s.theater_id=t.theater_id WHERE t.theater_id=? AND s.screen_id=?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, theaterOwnerBean.getScreen_id()); /*ps.setInt(3, theaterOwnerBean.getShow_timing_id()); ps.setInt(4, theaterOwnerBean.getMovie_details_id()); ps.setInt(5, theaterOwnerBean.getShow_detail_id());*/ rs = ps.executeQuery(); while(rs.next()) { theaterOwnerBean.setTheater_name(rs.getString("theater_name")); theaterOwnerBean.setScreen_name(rs.getString("screen_name")); } String movie_name="SELECT m.movie_name FROM master_movie_detail m INNER JOIN movie_details d ON d.master_movie_id = m.master_movie_id WHERE d.movie_details_id = ?"; ps1 = conn.prepareStatement(movie_name); ps1.setInt(1, theaterOwnerBean.getMovie_details_id()); rs1 = ps1.executeQuery(); while(rs1.next()) { theaterOwnerBean.setMovie_name(rs1.getString("movie_name")); } String show_name="SELECT s.show_date,s.show_date_id,t.show_timing FROM theater_show_details s INNER JOIN show_timing t ON t.show_details_id=s.show_details_id WHERE s.theater_id=? AND s.screen_id=? AND t.show_timing_id=?"; ps2 = conn.prepareStatement(show_name); ps2.setInt(1, theaterOwnerBean.getTheater_id()); ps2.setInt(2, theaterOwnerBean.getScreen_id()); ps2.setInt(3, theaterOwnerBean.getShow_timing_id()); rs2 = ps2.executeQuery(); while(rs2.next()) { Date date1 = date.parse(rs2.getString("show_date")); String showDate = showDateFr.format(date1); theaterOwnerBean.setShow_date(showDate); theaterOwnerBean.setShow_date_id(rs2.getString("show_date_id")); SimpleDateFormat date24Format = new SimpleDateFormat("HH:mm"); SimpleDateFormat date12Format = new SimpleDateFormat("hh:mm a"); String showTime = date12Format.format(date24Format.parse(rs2.getString("show_timing"))); theaterOwnerBean.setShow_time(showTime); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //tickt booking details @SuppressWarnings("unused") public TheaterOwnerBean getTicketSoldDetail(TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; PreparedStatement ps2=null; ResultSet rs2=null; String seatStr = ""; String bookingSeatStr = ""; Connection conn=null; try { /* String ticket_status=Ticket_QueueMain.ticketQueue(theaterOwnerBean); return theaterOwnerBean;*/ String status = insertTicketDetails(theaterOwnerBean); theaterOwnerBean.setStatus(status); } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getTaxMap public Map<Integer, String> getTaxMap(TheaterOwnerBean theaterOwnerBean) throws Exception { HashMap<Integer, String> taxMap=new HashMap<Integer,String>(); PreparedStatement ps=null; ResultSet rs=null; Connection conn=null; try { conn = connectionManager.getConnection(); String sql="SELECT theater_id,theater_name FROM theater_detail WHERE theater_owner_id=? AND STATUS='Active' AND is_deleted='N'"; ps = conn.prepareStatement(sql); ps.setInt(1,theaterOwnerBean.getTheater_owner_id()); rs = ps.executeQuery(); while(rs.next()) { taxMap.put(rs.getInt("theater_id"), rs.getString("theater_name")); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return taxMap; } //getTheatreOwnersTaxDetail public TheaterOwnerBean getTheatreOwnersTaxDetail(TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; Connection conn=null; DecimalFormat df = new DecimalFormat("#.##"); try { conn = connectionManager.getConnection(); String[] date = theaterOwnerBean.getDate().split("-"); int startDate = Integer.parseInt(date[0].replace("/", "").trim()); int endDate = Integer.parseInt(date[1].replace("/", "").trim()); String sql= "SELECT t.theater_name,COUNT(s.screen_name) AS screen_count FROM theater_detail t INNER JOIN screen_detail s ON t.theater_id = s.theater_id WHERE t.theater_id=? AND s.status = 'Active' AND s.is_deleted= 'N'"; ps = conn.prepareStatement(sql); ps.setInt(1,theaterOwnerBean.getTheatre_id()); rs = ps.executeQuery(); while(rs.next()) { theaterOwnerBean.setTheater_name(rs.getString("theater_name")); theaterOwnerBean.setScreen_count(rs.getInt("screen_count")); } String sql1="SELECT SUM(total_payable_amount) AS 'totalCollectionAmount' ,SUM(cgst_tax) AS 'cgstAmnt',SUM(sgst_tax) AS 'sgstAmnt',SUM(et_tax) AS 'etAmnt',SUM(convenient_fee) AS 'convinentAmnt' FROM report_theatre_wise_tax_detail WHERE created_date_key BETWEEN ? AND ? AND theatre_id=?"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, startDate); ps1.setInt(2, endDate); ps1.setInt(3,theaterOwnerBean.getTheatre_id()); rs1 = ps1.executeQuery(); while(rs1.next()) { theaterOwnerBean.setTotal_amount(Double.parseDouble(df.format(Double.parseDouble(rs1.getString("totalCollectionAmount"))))); theaterOwnerBean.setCgst_tax(Double.parseDouble(df.format(Double.parseDouble(rs1.getString("cgstAmnt"))))); theaterOwnerBean.setSgst_tax(Double.parseDouble(df.format(Double.parseDouble(rs1.getString("sgstAmnt"))))); theaterOwnerBean.setEt_tax(Double.parseDouble(df.format(Double.parseDouble(rs1.getString("etAmnt"))))); theaterOwnerBean.setConvenient_amount(Double.parseDouble(df.format(Double.parseDouble(rs1.getString("convinentAmnt"))))); } String sql2="SELECT cgst_percentage,sgst_percentage,et_percentage,convenient_charge FROM tax_charge_percentage_detail WHERE STATUS = 1"; ps = conn.prepareStatement(sql2); rs = ps.executeQuery(); while(rs.next()){ theaterOwnerBean.setCgst_percentage(rs.getDouble("cgst_percentage")); theaterOwnerBean.setSgst_percentage(rs.getDouble("sgst_percentage")); theaterOwnerBean.setEt_percentage(rs.getDouble("et_percentage")); theaterOwnerBean.setConvenient_tax(rs.getDouble("convenient_charge")); } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getTheaterOwnerMoviewiseDetails public ArrayList<TheaterOwnerBean> getTheaterOwnerMoviewiseDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; PreparedStatement ps1 = null; ResultSet rs1 = null; ArrayList<TheaterOwnerBean>theatreOwnerMovieList=new ArrayList<TheaterOwnerBean>(); try { conn = connectionManager.getConnection(); String[] date = theaterOwnerBean.getDate().split("-"); int startDate = Integer.parseInt(date[0].replace("/", "").trim()); int endDate = Integer.parseInt(date[1].replace("/", "").trim()); int Theater_Owner_Id =theaterOwnerBean.getTheater_owner_id(); String sql4="SELECT theater_id,theater_name FROM theater_detail WHERE theater_owner_id=? AND STATUS = 'Active' AND is_deleted = 'N'"; ps1 = conn.prepareStatement(sql4); ps1.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs1 = ps1.executeQuery(); while(rs1.next()) { int i =0; theaterOwnerBean = new TheaterOwnerBean(); theaterOwnerBean.setTheater_id(rs1.getInt("theater_id")); theaterOwnerBean.setTheater_name(rs1.getString("theater_name")); if(startDate == endDate){ String sql ="SELECT DISTINCT(s.movie_name),SUM(i.ticket_amount) AS 'TickerAmt',GROUP_CONCAT(i.seat_id) AS 'Seat' FROM movie_details m INNER JOIN individual_movie_ticket_sold_details i ON m.movie_details_id=i.movie_detail_id INNER JOIN master_movie_detail s ON s.master_movie_id = m.master_movie_id INNER JOIN theater_detail t ON t.theater_id=i.theatre_id WHERE i.theatre_id=? AND i.show_date_id=? AND t.theater_owner_id=?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, startDate); ps.setInt(3, Theater_Owner_Id); } else{ String sql ="SELECT DISTINCT(s.movie_name),SUM(i.ticket_amount) AS 'TickerAmt',GROUP_CONCAT(i.seat_id) AS 'Seat' FROM movie_details m INNER JOIN individual_movie_ticket_sold_details i ON m.movie_details_id=i.movie_detail_id INNER JOIN master_movie_detail s ON s.master_movie_id = m.master_movie_id INNER JOIN theater_detail t ON t.theater_id=i.theatre_id WHERE i.theatre_id=? AND i.show_date_id BETWEEN ? AND ? AND t.theater_owner_id=?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, startDate); ps.setInt(3, endDate); ps.setInt(4, Theater_Owner_Id); } rs = ps.executeQuery(); while(rs.next()) { if(rs.getString("movie_name") != "" && rs.getString("movie_name") != null){ theaterOwnerBean = new TheaterOwnerBean(); theaterOwnerBean.setMovie_name(rs.getString("movie_name")); theaterOwnerBean.setTicket_amount(Double.parseDouble(rs.getString("TickerAmt"))); String seatStr = rs.getString("Seat"); if(seatStr !="" && seatStr != null) { String[] seat = seatStr.split(","); theaterOwnerBean.setSeat_count(seat.length); i +=1; } if(i > 0){ theatreOwnerMovieList.add(theaterOwnerBean); } } } } } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theatreOwnerMovieList; } //getTheaterOwnerMovieScreenwiseDetails public ArrayList<TheaterOwnerBean> getTheaterOwnerMovieScreenwiseDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; PreparedStatement ps1 = null; ResultSet rs = null; ResultSet rs1 = null; ArrayList<TheaterOwnerBean>screenwiseList=new ArrayList<TheaterOwnerBean>(); TheaterDetailBean theaterDetailBean = new TheaterDetailBean(); try { conn = connectionManager.getConnection(); int showdateId = Integer.parseInt(theaterOwnerBean.getDate().replace("-","")); String sql = "SELECT s.screen_id,s.screen_name,GROUP_CONCAT(t.seat_id) AS 'Seat',SUM(t.ticket_amount) AS ticketAmount FROM screen_detail s INNER JOIN individual_movie_ticket_sold_details t ON s.screen_id=t.screen_id WHERE s.theater_owner_id=? AND show_date_id=?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); ps.setInt(2, showdateId); rs = ps.executeQuery(); while(rs.next()) { theaterOwnerBean = new TheaterOwnerBean(); theaterOwnerBean.setScreen_id(rs.getInt("screen_id")); theaterOwnerBean.setScreen_name(rs.getString("screen_name")); theaterOwnerBean.setTicket_amount(Double.parseDouble(rs.getString("ticketAmount"))); String seatStr = rs.getString("Seat"); if(seatStr !="") { String[] seat = seatStr.split(","); theaterOwnerBean.setSeat_count(seat.length); } ArrayList<TheaterDetailBean>showwiseList=new ArrayList<TheaterDetailBean>(); String sql1 = "SELECT s.screen_name,sh.show_timing,SUM(i.ticket_amount) AS 'ticketAmt' FROM screen_detail s INNER JOIN individual_movie_ticket_sold_details i ON s.screen_id=i.screen_id INNER JOIN show_timing sh ON sh.show_timing_id=i.show_timing_id WHERE s.screen_id=? GROUP BY i.show_timing_id"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterOwnerBean.getScreen_id()); rs1 = ps1.executeQuery(); while(rs1.next()) { //TheaterDetailBean theaterDetailBean = new TheaterDetailBean(); theaterDetailBean = new TheaterDetailBean(); theaterDetailBean.setScreen_name(rs1.getString("screen_name")); String ticketAmt = rs1.getString("ticketAmt"); if(ticketAmt != null) { theaterDetailBean.setTicket_amount(Double.parseDouble(ticketAmt)); } SimpleDateFormat date24Format = new SimpleDateFormat("HH:mm"); SimpleDateFormat date12Format = new SimpleDateFormat("hh:mm a"); String showTime = date12Format.format(date24Format.parse(rs1.getString("show_timing"))); theaterDetailBean.setShow_timing(showTime); showwiseList.add(theaterDetailBean); } theaterOwnerBean.setShowwiseList(showwiseList); screenwiseList.add(theaterOwnerBean); } } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return screenwiseList; } //getSeatCategoryJsonMap created by ramya - 02-09-19 public TheaterOwnerBean getSeatCategoryJsonMap( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; ArrayList<TheaterDetailBean> ticketCategoryList = new ArrayList<TheaterDetailBean>(); Map<Integer, String> ticketCategoryMap = new HashMap<Integer,String>(); TheaterDetailBean theaterDetailBean = null; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getSeatCategoryJsonMap(?,?,?,?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.setInt(2, theaterOwnerBean.getTheater_id()); cl.setInt(3, theaterOwnerBean.getScreen_id()); cl.setInt(4, theaterOwnerBean.getPassage_count()); /*cl.setInt(5, theaterOwnerBean.getCategory_from_id()); cl.setInt(6, theaterOwnerBean.getCategory_to_id());*/ cl.setInt(5, theaterOwnerBean.getOrder_id()); boolean result = cl.execute(); int i = 1; while(result) { ResultSet rs = cl.getResultSet(); if(i==1) { while(rs.next()) { theaterDetailBean = new TheaterDetailBean(); theaterDetailBean.setSeat_category_id(rs.getInt("seat_category_id")); theaterDetailBean.setSeat_category_name(rs.getString("seat_category")); ticketCategoryList.add(theaterDetailBean); ticketCategoryMap.put(rs.getInt("seat_category_id"), rs.getString("seat_category")); } } theaterOwnerBean.setSeatCategoryDetailList(ticketCategoryList); theaterOwnerBean.setTicketCategoryMap(ticketCategoryMap); i++; result = cl.getMoreResults(); } } catch (Exception e) { e.printStackTrace(); String str = "getSeatCategoryJsonMap"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //setSeatCategoryPriceDetail created by ramya - 05-09-18 public TheaterOwnerBean setSeatCategoryPriceDetail( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; PreparedStatement ps1 = null; ResultSet rs = null; ResultSet rs1 = null; ArrayList<TheaterDetailBean> seatCategoryList = new ArrayList<TheaterDetailBean>(); TheaterDetailBean theaterDetailBean = new TheaterDetailBean(); DecimalFormat df = new DecimalFormat("#.##"); try { conn = connectionManager.getConnection(); String sql = "SELECT seat_category_from_id FROM list_seat_category_price_detail WHERE theater_id = ? AND screen_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, theaterOwnerBean.getScreen_id()); rs = ps.executeQuery(); if(rs.next()) { String sql1 = "DELETE FROM list_seat_category_price_detail WHERE theater_id = ? AND screen_id = ?"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterOwnerBean.getTheater_id()); ps1.setInt(2, theaterOwnerBean.getScreen_id()); ps1.executeUpdate(); } String seatCat[] = theaterOwnerBean.getSeatCategoryDetail().split(","); int j = 0; for(int i = 0;i < seatCat.length;i++){ String seatCatValue[] = seatCat[i].split("_"); System.out.print("Double "+ Double.parseDouble(seatCatValue[2])); String sql1 = "INSERT INTO list_seat_category_price_detail (seat_category_name,screen_id,theater_id,seat_category_from_id,seat_category_to_id,price,created_on) VALUES(?,?,?,?,?,?,NOW())"; ps1 = conn.prepareStatement(sql1); ps1.setString(1, seatCatValue[3]); ps1.setInt(2, theaterOwnerBean.getScreen_id()); ps1.setInt(3, theaterOwnerBean.getTheater_id()); ps1.setInt(4, Integer.parseInt(seatCatValue[0])); ps1.setInt(5, Integer.parseInt(seatCatValue[1])); ps1.setDouble(6, Double.parseDouble(df.format(Double.parseDouble(seatCatValue[2])))); j = ps1.executeUpdate(); } if(j > 0){ String sql1 = "SELECT list_seat_category_price_id,seat_category_name,seat_category_from_id,seat_category_to_id,price FROM list_seat_category_price_detail WHERE theater_id = ? AND screen_id = ?"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterOwnerBean.getTheater_id()); ps1.setInt(2, theaterOwnerBean.getScreen_id()); rs1 = ps1.executeQuery(); while(rs1.next()) { theaterDetailBean = new TheaterDetailBean(); theaterDetailBean.setSeat_category_price_detail_id(rs1.getInt("list_seat_category_price_id")); theaterDetailBean.setCategory_name(rs1.getString("seat_category_name")); theaterDetailBean.setSeat_category_from_id(rs1.getInt("seat_category_from_id")); theaterDetailBean.setSeat_category_to_id(rs1.getInt("seat_category_to_id")); theaterDetailBean.setSeat_category_price(Double.parseDouble(df.format(rs1.getDouble("price")))); seatCategoryList.add(theaterDetailBean); } theaterOwnerBean.setSeatCountList(seatCategoryList); } } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //setScreenFloorPlanSeatDetail created by ramya - 05-09-18 public TheaterOwnerBean setScreenFloorPlanSeatDetail( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; PreparedStatement ps1 = null; ResultSet rs = null; /*ResultSet rs1 = null; PreparedStatement ps2 = null; ResultSet rs2 = null; ArrayList<TheaterDetailBean> seatcategoryPriceList = new ArrayList<TheaterDetailBean>(); TheaterDetailBean theaterDetailBean = null; TicketCounterBean ticketCounterBean = null; ScreenDetailBean screenDetailBean = null;*/ try { conn = connectionManager.getConnection(); String sql = "SELECT screen_floor_plan_id FROM screen_floor_plan_detail WHERE theater_id =? AND screen_id=?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, theaterOwnerBean.getScreen_id()); rs = ps.executeQuery(); if(rs.next()) { String sql1 = "DELETE FROM screen_floor_plan_detail WHERE theater_id =? AND screen_id=?"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterOwnerBean.getTheater_id()); ps1.setInt(2, theaterOwnerBean.getScreen_id()); ps1.executeUpdate(); } String floorPlanVal[] = theaterOwnerBean.getFloor_plan_seat().split("\\$"); for(String str : floorPlanVal) { String[] key = str.split("\\|"); int seatCategoryId = Integer.parseInt(key[0]); int seatCategoryPricingId = 0; String seatName = ""; String statusId = ""; String[] seat = key[1].split(","); int seatCount = 0; for(String str1 : seat) { String[] seatVal = str1.split("_"); seatName += seatVal[1]+","; statusId += seatVal[2]+","; seatCategoryPricingId = Integer.parseInt(seatVal[3]); seatCount += 1; } seatName = seatName.substring(0, seatName.length()-1); statusId = statusId.substring(0, statusId.length()-1); String sql1 = "INSERT INTO screen_floor_plan_detail (theater_id,screen_id,list_seat_category_price_id,seat_category_id,total_seat_count,seat_id,seat_status_id,create_on) VALUES(?,?,?,?,?,?,?,NOW())"; ps = conn.prepareStatement(sql1); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, theaterOwnerBean.getScreen_id()); ps.setInt(3, seatCategoryPricingId); ps.setInt(4, seatCategoryId); ps.setInt(5, seatCount); ps.setString(6, seatName); ps.setString(7, statusId); ps.executeUpdate(); } /* String sql2 = "SELECT list_seat_category_price_id,seat_category_name,price FROM list_seat_category_price_detail WHERE theater_id =? AND screen_id=?"; ps2 = conn.prepareStatement(sql2); ps2.setInt(1, theaterOwnerBean.getTheater_id()); ps2.setInt(2, theaterOwnerBean.getScreen_id()); rs2 = ps2.executeQuery(); while(rs2.next()){ theaterDetailBean = new TheaterDetailBean(); theaterDetailBean.setSeat_category_price(rs2.getInt("price")); theaterDetailBean.setSeat_category_name(rs2.getString("seat_category_name")); ArrayList<TicketCounterBean> categoryList = new ArrayList<TicketCounterBean>(); String sql1 = "SELECT DISTINCT(l.seat_category_id),l.seat_id,l.seat_status_id,l.total_seat_count,s.seat_category FROM screen_floor_plan_detail l INNER JOIN seat_category s ON s.seat_category_id = l.seat_category_id WHERE l.theater_id=? AND l.screen_id=? AND l.list_seat_category_price_id=?"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterOwnerBean.getTheater_id()); ps1.setInt(2, theaterOwnerBean.getScreen_id()); ps1.setInt(3, rs2.getInt("list_seat_category_price_id")); rs1 = ps1.executeQuery(); while(rs1.next()){ ticketCounterBean = new TicketCounterBean(); ticketCounterBean.setCategory_name(rs1.getString("seat_category")); int seatCount = rs1.getInt("total_seat_count"); String[] seat = rs1.getString("seat_id").split(","); String[] status = rs1.getString("seat_status_id").split(","); ArrayList<ScreenDetailBean> seatList = new ArrayList<ScreenDetailBean>(); for(int i =0;i <= seatCount-1;i++){ screenDetailBean = new ScreenDetailBean(); screenDetailBean.setSeatName(seat[i]); screenDetailBean.setSeatStatus(Integer.parseInt(status[i])); seatList.add(screenDetailBean); } ticketCounterBean.setSeatList(seatList); categoryList.add(ticketCounterBean); } theaterDetailBean.setCategoryList(categoryList); seatcategoryPriceList.add(theaterDetailBean); } theaterOwnerBean.setTheaterRowList(seatcategoryPriceList);*/ } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getScreenPath public TheaterOwnerBean getScreenPath(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { conn = connectionManager.getConnection(); String sql = "SELECT screen_layout_path FROM screen_detail WHERE screen_id=?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getScreen_id()); rs = ps.executeQuery(); while(rs.next()) { theaterOwnerBean.setScreen_layout_path(rs.getString("screen_layout_path")); } } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getNavBarViewFloorPalnDetails public TheaterOwnerBean getNavBarViewFloorPalnDetails( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getNavBarViewFloorPalnDetails(?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.registerOutParameter(2, Types.VARCHAR); cl.execute(); theaterOwnerBean.setNav_bar_view_scrn_status(cl.getString(2)); } catch (Exception e) { e.printStackTrace(); String str = "getNavBarViewFloorPalnDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getMvArrangementStatusDetails public TheaterOwnerBean getMvArrangementStatusDetails( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getMvArrangementStatusDetails(?,?)}"; cl = conn.prepareCall(sql); cl.setInt(1, theaterOwnerBean.getTheater_owner_id()); cl.registerOutParameter(2, Types.VARCHAR); cl.execute(); theaterOwnerBean.setNav_bar_mv_arrangement_status(cl.getString(2)); } catch (Exception e) { e.printStackTrace(); String str = "getMvArrangementStatusDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getTheaterCount public TheaterOwnerBean getTheaterCount(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; PreparedStatement ps1 = null; PreparedStatement ps2 = null; ResultSet rs = null; ResultSet rs1 = null; ResultSet rs2 = null; DecimalFormat df = new DecimalFormat("#.##"); try { conn=connectionManager.getConnection(); String sql="SELECT COUNT(theater_name)AS theater_count FROM theater_detail WHERE theater_owner_id=? AND STATUS = 'Active' AND is_deleted = 'N'"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs = ps.executeQuery(); while(rs.next()) { theaterOwnerBean.setTheater_count(rs.getInt("theater_count")); } String sql1 ="SELECT COUNT(screen_name)AS screen_count FROM screen_detail WHERE theater_owner_id=? AND STATUS = 'Active' AND is_deleted = 'N'"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs1 = ps1.executeQuery(); while(rs1.next()) { theaterOwnerBean.setScreen_count(rs1.getInt("screen_count")); } String sql2="SELECT SUM(i.ticket_amount)AS total_income,t.theater_id FROM individual_movie_ticket_sold_details i INNER JOIN theater_detail t ON i.theatre_id=t.theater_id WHERE t.theater_owner_id=? AND t.status = 'Active' AND t.is_deleted = 'N'"; ps2 = conn.prepareStatement(sql2); ps2.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs2 = ps2.executeQuery(); while(rs2.next()) { theaterOwnerBean.setTotal_amount(Double.parseDouble(df.format(Double.parseDouble(rs2.getString("total_income"))))); } } catch (Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getScreenFloorPlanSeatDetail public TheaterOwnerBean getScreenFloorPlanSeatDetail( TheaterOwnerBean theaterOwnerBean) throws Exception{ Connection conn = null; PreparedStatement ps1 = null; ResultSet rs1 = null; PreparedStatement ps2 = null; ResultSet rs2 = null; ArrayList<TheaterDetailBean> seatcategoryPriceList = new ArrayList<TheaterDetailBean>(); TheaterDetailBean theaterDetailBean = null; TicketCounterBean ticketCounterBean = null; ScreenDetailBean screenDetailBean = null; DecimalFormat df = new DecimalFormat("#.##"); try { conn = connectionManager.getConnection(); String sql2 = "SELECT list_seat_category_price_id,seat_category_name,price FROM list_seat_category_price_detail WHERE theater_id =? AND screen_id=?"; ps2 = conn.prepareStatement(sql2); ps2.setInt(1, theaterOwnerBean.getTheater_id()); ps2.setInt(2, theaterOwnerBean.getScreen_id()); rs2 = ps2.executeQuery(); while(rs2.next()){ theaterDetailBean = new TheaterDetailBean(); theaterDetailBean.setSeat_category_price(rs2.getInt("price")); theaterDetailBean.setSeat_category_name(rs2.getString("seat_category_name")); theaterDetailBean.setSeat_category_price(Double.parseDouble(df.format(rs2.getDouble("price")))); String sq1 = "SELECT DISTINCT(total_seat_count) FROM screen_floor_plan_detail WHERE theater_id = ? AND screen_id = ?"; ps1 = conn.prepareStatement(sq1); ps1.setInt(1, theaterOwnerBean.getTheater_id()); ps1.setInt(2, theaterOwnerBean.getScreen_id()); rs1 = ps1.executeQuery(); while(rs1.next()){ theaterDetailBean.setSeat_count(rs1.getInt("total_seat_count")); } ArrayList<TicketCounterBean> categoryList = new ArrayList<TicketCounterBean>(); String sql1 = "SELECT DISTINCT(l.seat_category_id),l.seat_id,l.seat_status_id,l.total_seat_count,s.seat_category FROM screen_floor_plan_detail l INNER JOIN seat_category s ON s.seat_category_id = l.seat_category_id WHERE l.theater_id=? AND l.screen_id=? AND l.list_seat_category_price_id=?"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterOwnerBean.getTheater_id()); ps1.setInt(2, theaterOwnerBean.getScreen_id()); ps1.setInt(3, rs2.getInt("list_seat_category_price_id")); rs1 = ps1.executeQuery(); while(rs1.next()){ ticketCounterBean = new TicketCounterBean(); int seatCount = rs1.getInt("total_seat_count"); String[] seat = rs1.getString("seat_id").split(","); String[] status = rs1.getString("seat_status_id").split(","); int emptySeatCount = 0; ArrayList<ScreenDetailBean> seatList = new ArrayList<ScreenDetailBean>(); for(int i =0;i <= seatCount-1;i++){ screenDetailBean = new ScreenDetailBean(); screenDetailBean.setSeatName(seat[i]); screenDetailBean.setSeatStatus(Integer.parseInt(status[i])); if(Integer.parseInt(status[i]) == 0){ emptySeatCount += 1; } seatList.add(screenDetailBean); } if(seatCount == emptySeatCount){ ticketCounterBean.setCategory_name("-"); } else{ ticketCounterBean.setCategory_name(rs1.getString("seat_category")); } ticketCounterBean.setSeatList(seatList); categoryList.add(ticketCounterBean); } theaterDetailBean.setCategoryList(categoryList); seatcategoryPriceList.add(theaterDetailBean); } theaterOwnerBean.setTheaterRowList(seatcategoryPriceList); } catch (Exception e) { e.printStackTrace(); } return theaterOwnerBean; } //getTheatreOwnerInboxDetail public TheaterOwnerBean getTheatreOwnerInboxDetail(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; PreparedStatement ps1 = null; ResultSet rs1 = null; PreparedStatement ps2 = null; ResultSet rs2 = null; ArrayList<ProducerBean> inbox_list = new ArrayList<ProducerBean>(); ProducerBean producerBean = null; try { conn = connectionManager.getConnection(); String sql = "SELECT COUNT(sender_id) AS 'Count' FROM communication_inbox_detail WHERE receiver_id = ? AND is_deleted = 'No'"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs = ps.executeQuery(); if(rs.next()) { theaterOwnerBean.setInbox_count(rs.getInt("Count")); } if(theaterOwnerBean.getInbox_count() !=0 ) { String sql1 = "SELECT c.communication_inbox_id,c.mail_subject,c.created_on,c.read_status,c.sender_id,c.read_status,r.role_id,r.role FROM communication_inbox_detail c INNER JOIN user_role r ON r.role_id = c.sender_role_id WHERE c.receiver_id = ? AND c.is_deleted = 'No'"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs1 = ps1.executeQuery(); while(rs1.next()) { producerBean = new ProducerBean(); producerBean.setMsg_id(rs1.getInt("communication_inbox_id")); producerBean.setMsg_subject(rs1.getString("mail_subject")); String[] recDate = rs1.getString("created_on").split(" "); String msgReceiveDate = dateFormatAnotherChangeFunction(recDate[0]); SimpleDateFormat date24Format = new SimpleDateFormat("HH:mm:ss"); SimpleDateFormat date12Format = new SimpleDateFormat("hh:mm a"); String msgReceiveTime = date12Format.format(date24Format.parse(recDate[1])); producerBean.setMsg_date(msgReceiveDate+" - "+msgReceiveTime); producerBean.setRole(rs1.getString("role")); producerBean.setRole_xid(rs1.getInt("role_id")); producerBean.setProducer_id(rs1.getInt("sender_id")); producerBean.setMsg_read_status(rs1.getString("read_status")); switch (producerBean.getRole_xid()) { case 6: String sql2 = "SELECT producer_name,producer_email,producer_mobile FROM producer_register WHERE producer_id = ?"; ps2 = conn.prepareStatement(sql2); ps2.setInt(1, producerBean.getProducer_id()); rs2 = ps2.executeQuery(); while(rs2.next()) { producerBean.setProducer_name(rs2.getString("producer_name")); producerBean.setMobile_number(rs2.getString("producer_mobile")); producerBean.setMail(rs2.getString("producer_email")); } break; case 7: String sql3 = "SELECT distributer_name,distributer_email,distributer_mobile FROM distributer_register_details WHERE distributer_id = ?"; ps2 = conn.prepareStatement(sql3); ps2.setInt(1, producerBean.getProducer_id()); rs2 = ps2.executeQuery(); while(rs2.next()) { producerBean.setProducer_name(rs2.getString("distributer_name")); producerBean.setMobile_number(rs2.getString("distributer_mobile")); producerBean.setMail(rs2.getString("distributer_email")); } break; } inbox_list.add(producerBean); } theaterOwnerBean.setInbox_sub_list(inbox_list); } } catch (Exception e) { e.printStackTrace(); String str = "getTheatreOwnerInboxDetail"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getActivationStatus public TheaterOwnerBean getActivationStatus( TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { conn = connectionManager.getConnection(); String sql = "SELECT mail_pin_status,sms_pin_status FROM theater_owner_detail WHERE theater_owner_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs = ps.executeQuery(); while(rs.next()) { if(rs.getString("mail_pin_status").equals("N") && rs.getString("sms_pin_status").equals("N")){ theaterOwnerBean.setStatus("Not Activated"); } else if(rs.getString("mail_pin_status").equals("Y") && rs.getString("sms_pin_status").equals("N")){ theaterOwnerBean.setStatus("SMS Not Activated"); } else if(rs.getString("mail_pin_status").equals("N") && rs.getString("sms_pin_status").equals("Y")){ theaterOwnerBean.setStatus("Mail Not Activated"); } } } catch (Exception e) { e.printStackTrace(); String str = "getActivationStatus"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getTheatrewiseMovieDetailList public ArrayList<TheaterOwnerBean> getTheatrewiseMovieDetailList( TheaterOwnerBean theaterOwnerBean) throws Exception { ArrayList<TheaterOwnerBean> movieList=new ArrayList<TheaterOwnerBean>(); PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; Connection conn=null; try { conn = connectionManager.getConnection(); String mv_id_str = ""; String sql="SELECT DISTINCT(s.movie_details_id) FROM theater_show_details l INNER JOIN movie_details s ON l.movie_detail_id = s.movie_details_id WHERE l.theater_id = ? AND s.STATUS = 'Active' AND s.is_deleted = 'N'"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_id()); rs = ps.executeQuery(); while(rs.next()){ mv_id_str += rs.getInt("movie_details_id")+","; } if(mv_id_str != ""){ mv_id_str = mv_id_str.substring(0, mv_id_str.length()-1); } DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); String movie_list="SELECT m.movie_details_id,k.movie_certification_name,n.movie_name,m.movie_id,m.movie_language_id,m.genre_id,m.Format_id,n.duration,n.movie_poster_path,l.language_name,f.format_name,n.release_date,n.genre_id_str,m.booking_open_date FROM movie_details m" + " INNER JOIN movie_languge l ON m.movie_language_id=l.language_id INNER JOIN movie_format f ON f.movie_format_id=m.Format_id INNER JOIN master_movie_detail n ON n.master_movie_id = m.master_movie_id INNER JOIN movie_certification k ON k.movie_certification_id = n.certification_id WHERE m.movie_details_id IN ("+mv_id_str+")"; ps = conn.prepareStatement(movie_list); rs = ps.executeQuery(); while(rs.next()){ theaterOwnerBean=new TheaterOwnerBean(); String sql1 = "SELECT s.show_timing_id,s.show_timing FROM show_timing s INNER JOIN theater_show_details t ON t.show_details_id = s.show_details_id WHERE t.movie_detail_id = ? AND s.status = 'Active' AND s.is_deleted = 'N'"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, rs.getInt("movie_details_id")); rs1 = ps1.executeQuery(); if(rs1.next()){ theaterOwnerBean.setMovie_details_id(rs.getInt("movie_details_id")); theaterOwnerBean.setMovie_name(rs.getString("movie_name")); theaterOwnerBean.setMovie_languge_name(rs.getString("language_name")); theaterOwnerBean.setMovie_format_name(rs.getString("format_name")); theaterOwnerBean.setMovie_certification_name(rs.getString("movie_certification_name")); theaterOwnerBean.setMovie_duration(rs.getString("duration")); theaterOwnerBean.setMovie_poster_path(rs.getString("movie_poster_path")); theaterOwnerBean.setMovie_id(rs.getString("movie_id")); theaterOwnerBean.setMovie_release_date(rs.getString("release_date")); String sql11 = "SELECT GROUP_CONCAT(genre_name) AS 'genreName' FROM movie_genre WHERE genre_id IN ("+rs.getString("genre_id_str")+")"; ps1 = conn.prepareStatement(sql11); rs1 = ps1.executeQuery(); while(rs1.next()) { theaterOwnerBean.setMovie_genre_name(rs1.getString("genreName")); } if(rs.getString("booking_open_date") != null) { Date booking_date = dateFormat.parse(rs.getString("booking_open_date")); if (booking_date.equals(date)) { movieList.add(theaterOwnerBean); } else if (booking_date.before(date)) { movieList.add(theaterOwnerBean); } } } } } catch(Exception e) { e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieList; } //getMovieShowTmDetail public TheaterOwnerBean getMovieShowTmDetail(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; PreparedStatement ps1 = null; ResultSet rs1 = null; ArrayList<String> showTimeList = new ArrayList<String>(); try { conn = connectionManager.getConnection(); String[] dateRange = theaterOwnerBean.getShow_date().split("-"); int startDate = Integer.parseInt(dateRange[0].replaceAll("/", "").trim()); int endDate =Integer.parseInt(dateRange[1].replaceAll("/", "").trim()); Date date = new Date(); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); if(startDate == endDate) { /*String sql = "SELECT s.show_timing FROM show_timing s INNER JOIN theater_show_details l ON s.show_details_id = l.show_details_id WHERE l.theater_owner_id =? AND l.theater_id=? AND l.screen_id=? AND l.movie_detail_id =? AND l.show_date_id = ? AND s.status = 'Active' AND s.is_deleted = 'N'";*/ String sql = "SELECT s.show_timing FROM show_timing s INNER JOIN theater_show_details l ON s.show_details_id = l.show_details_id WHERE l.theater_owner_id =? AND l.theater_id=? AND l.screen_id=? AND l.show_date_id = ? AND s.status = 'Active' AND s.is_deleted = 'N'"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); ps.setInt(2, theaterOwnerBean.getTheater_id()); ps.setInt(3, theaterOwnerBean.getScreen_id()); /*ps.setInt(4, theaterOwnerBean.getMovie_details_id());*/ ps.setInt(4, startDate); Date start_date = dateFormat.parse(dateRange[0].trim()); if (date.compareTo(start_date) >= 0) { String currTime = sdf.format(new Date()); theaterOwnerBean.setStatus("Yes"); theaterOwnerBean.setCurrent_time(currTime); } } else { Date start_date = dateFormat.parse(dateRange[0].trim()); Date end_date = dateFormat.parse(dateRange[1].trim()); if (date.compareTo(start_date) >= 0) { if (date.compareTo(end_date) <= 0) { String currTime = sdf.format(new Date()); theaterOwnerBean.setStatus("Yes"); theaterOwnerBean.setCurrent_time(currTime); } } /*String sql = "SELECT s.show_timing FROM show_timing s INNER JOIN theater_show_details l ON s.show_details_id = l.show_details_id WHERE l.theater_owner_id =? AND l.theater_id=? AND l.screen_id=? AND l.movie_detail_id =? AND l.show_date_id >= ? AND l.show_date_id <= ? AND s.status = 'Active' AND s.is_deleted = 'N'";*/ String sql = "SELECT s.show_timing FROM show_timing s INNER JOIN theater_show_details l ON s.show_details_id = l.show_details_id WHERE l.theater_owner_id =? AND l.theater_id=? AND l.screen_id=? AND l.show_date_id >= ? AND l.show_date_id <= ? AND s.status = 'Active' AND s.is_deleted = 'N'"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); ps.setInt(2, theaterOwnerBean.getTheater_id()); ps.setInt(3, theaterOwnerBean.getScreen_id()); /*ps.setInt(4, theaterOwnerBean.getMovie_details_id());*/ ps.setInt(4, startDate); ps.setInt(5, endDate); } rs = ps.executeQuery(); while(rs.next()) { showTimeList.add(rs.getString("show_timing")); } theaterOwnerBean.setShowTimingList(showTimeList); } catch (Exception e) { e.printStackTrace(); String str = "getMovieShowTmDetail"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getMovieDurationAndReleaseDate public TheaterOwnerBean getMovieDurationAndReleaseDate(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { conn = connectionManager.getConnection(); Date date = new Date(); SimpleDateFormat date_Format1 = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat date_Format = new SimpleDateFormat("yyyy/MM/dd"); String sql1 = "SELECT l.duration,l.release_date,s.booking_open_date FROM master_movie_detail l INNER JOIN movie_details s ON s.master_movie_id = l.master_movie_id WHERE s.movie_details_id = ?"; ps = conn.prepareStatement(sql1); ps.setInt(1, theaterOwnerBean.getMovie_details_id()); rs = ps.executeQuery(); while(rs.next()) { theaterOwnerBean.setMovie_duration(rs.getString("duration")); if(rs.getString("booking_open_date") != null) { Date booking_date = date_Format1.parse(rs.getString("booking_open_date")); String bookingDate = ""; if (booking_date.before(date)) { bookingDate = date_Format.format(date); } else{ bookingDate = date_Format.format(booking_date); } theaterOwnerBean.setMovie_release_date(bookingDate); } else { Date date1= date_Format1.parse(rs.getString("release_date")); String releaseDate = date_Format.format(date1); theaterOwnerBean.setMovie_release_date(releaseDate); } } } catch (Exception e) { e.printStackTrace(); String str = "getMovieDurationAndReleaseDate"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getViewTheatreMovieArrangementDetails public TheaterOwnerBean getViewTheatreMovieArrangementDetails( TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; PreparedStatement ps2=null; ResultSet rs2=null; Connection conn=null; TheaterDetailBean theaterDetailBean = null; ScreenDetailBean screenDetailBean = null; TicketCounterBean ticketCounterBean = null; ArrayList<TheaterDetailBean> movieList = new ArrayList<TheaterDetailBean>(); try { conn = connectionManager.getConnection(); SimpleDateFormat date_Format = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat date_Format1 = new SimpleDateFormat("yyyy-MM-dd"); Date date1 = date_Format.parse(theaterOwnerBean.getShow_date()); String date = date_Format1.format(date1); int dateId = Integer.parseInt(date.replace("-", "")); String sql="SELECT DISTINCT(s.movie_details_id),n.movie_poster_path,n.movie_name,s.movie_id,l.theater_name,l.theater_id,f.format_name,c.movie_certification_name,k.language_name,n.genre_id_str FROM movie_details s INNER JOIN theater_show_details m ON s.movie_details_id = m.movie_detail_id INNER JOIN theater_detail l ON l.theater_id = m.theater_id INNER JOIN master_movie_detail n ON n.master_movie_id = s.master_movie_id INNER JOIN movie_format f ON f.movie_format_id = s.Format_id INNER JOIN movie_certification c ON n.certification_id = c.movie_certification_id INNER JOIN movie_languge k ON s.movie_language_id = k.language_id WHERE m.theater_owner_id = ? AND m.theater_id = ? AND m.show_date_id = ? AND s.status = 'Active' AND s.is_deleted = 'N'"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); ps.setInt(2, theaterOwnerBean.getTheater_id()); ps.setInt(3, dateId); rs = ps.executeQuery(); while(rs.next()){ theaterDetailBean = new TheaterDetailBean(); int i = 0; int j = 0; theaterDetailBean.setMovie_detail_id(rs.getInt("movie_details_id")); theaterDetailBean.setMovie_name(rs.getString("movie_name")); theaterDetailBean.setMovie_id(rs.getString("movie_id")); theaterOwnerBean.setTheater_name(rs.getString("theater_name")); theaterDetailBean.setTheater_id(rs.getInt("theater_id")); theaterDetailBean.setMovie_poster_path(rs.getString("movie_poster_path")); theaterDetailBean.setMovie_format(rs.getString("format_name")); theaterDetailBean.setMovie_certification_name(rs.getString("movie_certification_name")); theaterDetailBean.setMovie_language(rs.getString("language_name")); String sql11 = "SELECT GROUP_CONCAT(genre_name) AS 'genreName' FROM movie_genre WHERE genre_id IN ("+rs.getString("genre_id_str")+")"; ps1 = conn.prepareStatement(sql11); rs1 = ps1.executeQuery(); while(rs1.next()) { theaterDetailBean.setMovie_genre(rs1.getString("genreName")); } ArrayList<ScreenDetailBean> screenList = new ArrayList<ScreenDetailBean>(); int screenCount = 0; String sql1="SELECT s.screen_id,s.screen_name FROM screen_detail s INNER JOIN theater_show_details m ON s.screen_id = m.screen_id WHERE m.movie_detail_id = ? AND m.theater_id = ? AND m.show_date_id = ? GROUP BY (m.screen_id)"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterDetailBean.getMovie_detail_id()); ps1.setInt(2, theaterDetailBean.getTheater_id()); ps1.setInt(3, dateId); rs1 = ps1.executeQuery(); while(rs1.next()){ screenDetailBean = new ScreenDetailBean(); screenDetailBean.setScreen_id(rs1.getInt("screen_id")); screenDetailBean.setScreen_name(rs1.getString("screen_name")); ArrayList<TicketCounterBean> showTimingList = new ArrayList<TicketCounterBean>(); String showDetailId = ""; String sql6="SELECT m.show_details_id FROM screen_detail s INNER JOIN theater_show_details m ON s.screen_id = m.screen_id WHERE m.movie_detail_id = ? AND m.theater_id = ? AND s.screen_id = ? AND m.show_date_id = ?"; ps2 = conn.prepareStatement(sql6); ps2.setInt(1, theaterDetailBean.getMovie_detail_id()); ps2.setInt(2, theaterDetailBean.getTheater_id()); ps2.setInt(3, screenDetailBean.getScreen_id()); ps2.setInt(4, dateId); rs2 = ps2.executeQuery(); while(rs2.next()){ showDetailId += rs2.getInt("show_details_id")+","; } if(showDetailId != "") { showDetailId = showDetailId.substring(0,showDetailId.length()-1); } String sql2="SELECT show_timing_id,show_timing FROM show_timing WHERE show_details_id IN ("+showDetailId+") AND STATUS = 'Active' AND is_deleted = 'N'"; ps2 = conn.prepareStatement(sql2); rs2 = ps2.executeQuery(); while(rs2.next()){ ticketCounterBean = new TicketCounterBean(); ticketCounterBean.setShow_timing_id(rs2.getInt("show_timing_id")); SimpleDateFormat date24Format = new SimpleDateFormat("HH:mm"); SimpleDateFormat date12Format = new SimpleDateFormat("hh:mm a"); String showTime = date12Format.format(date24Format.parse(rs2.getString("show_timing"))); ticketCounterBean.setShow_timing(showTime); showTimingList.add(ticketCounterBean); i = 1; } screenDetailBean.setShowTimingList(showTimingList); if(i == 1){ screenList.add(screenDetailBean); } j = 1; screenCount++; } theaterDetailBean.setScreenList(screenList); theaterDetailBean.setScreen_count(screenCount); if(i == 1 && j == 1){ movieList.add(theaterDetailBean); } } theaterOwnerBean.setTheaterDetailList(movieList); } catch(Exception e) { e.printStackTrace(); String str = "getViewTheatreMovieArrangementDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //dateFormatAnotherChangeFunction private String dateFormatAnotherChangeFunction(String passDate) throws ParseException { String date = ""; SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat Format = new SimpleDateFormat("dd MMM"); SimpleDateFormat myFormat = new SimpleDateFormat("EEEEE, dd MMM"); Calendar calendar = Calendar.getInstance(); Date today = calendar.getTime(); calendar.add(Calendar.DAY_OF_YEAR, 1); String td_date = dateFormat.format(today); Date mdate = dateFormat.parse(passDate); String mydate = dateFormat.format(mdate); if(td_date.equals(mydate)){ date = "Today, "+ Format.format(mdate); } else{ date = myFormat.format(mdate); } return date; } //getTheatreOwnerInboxDetails public ProducerBean getTheatreOwnerInboxDetails(ProducerBean producerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; PreparedStatement ps1 = null; ResultSet rs1 = null; PreparedStatement ps2 = null; ResultSet rs2 = null; try { conn = connectionManager.getConnection(); String sql = "UPDATE communication_inbox_detail SET read_status = 'Yes' WHERE communication_inbox_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, producerBean.getMsg_id()); ps.executeUpdate(); String sql1 = "SELECT c.communication_inbox_id,c.mail_subject,c.created_on,c.read_status,c.sender_id,c.mail_body,r.role_id,r.role FROM communication_inbox_detail c INNER JOIN user_role r ON r.role_id = c.sender_role_id WHERE c.receiver_id = ? AND c.communication_inbox_id = ? AND c.is_deleted = 'No'"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, producerBean.getTheater_owner_id()); ps1.setInt(2, producerBean.getMsg_id()); rs1 = ps1.executeQuery(); while(rs1.next()) { producerBean.setMsg_id(rs1.getInt("communication_inbox_id")); producerBean.setMsg_content(rs1.getString("mail_body")); producerBean.setMsg_subject(rs1.getString("mail_subject")); String[] recDate = rs1.getString("created_on").split(" "); String msgReceiveDate = dateFormatAnotherChangeFunction(recDate[0]); SimpleDateFormat date24Format = new SimpleDateFormat("HH:mm:ss"); SimpleDateFormat date12Format = new SimpleDateFormat("hh:mm a"); String msgReceiveTime = date12Format.format(date24Format.parse(recDate[1])); producerBean.setMsg_date(msgReceiveDate+" - "+msgReceiveTime); producerBean.setMsg_read_status(rs1.getString("read_status")); producerBean.setRole(rs1.getString("role")); producerBean.setRole_xid(rs1.getInt("role_id")); producerBean.setProducer_id(rs1.getInt("sender_id")); switch (producerBean.getRole_xid()) { case 3: String sql7 = " SELECT government_user_name,government_user_email,government_user_mobile FROM government_user_detail WHERE government_user_id = ?"; ps2 = conn.prepareStatement(sql7); ps2.setInt(1, producerBean.getProducer_id()); rs2 = ps2.executeQuery(); while(rs2.next()) { producerBean.setProducer_name(rs2.getString("government_user_name")); producerBean.setMobile_number(rs2.getString("government_user_mobile")); producerBean.setMail(rs2.getString("government_user_email")); } break; case 6: String sql2 = "SELECT producer_name,producer_email,producer_mobile FROM producer_register WHERE producer_id = ?"; ps2 = conn.prepareStatement(sql2); ps2.setInt(1, producerBean.getProducer_id()); rs2 = ps2.executeQuery(); while(rs2.next()) { producerBean.setProducer_name(rs2.getString("producer_name")); producerBean.setMobile_number(rs2.getString("producer_mobile")); producerBean.setMail(rs2.getString("producer_email")); } break; case 7: String sql3 = "SELECT distributer_name,distributer_email,distributer_mobile FROM distributer_register_details WHERE distributer_id = ?"; ps2 = conn.prepareStatement(sql3); ps2.setInt(1, producerBean.getProducer_id()); rs2 = ps2.executeQuery(); while(rs2.next()) { producerBean.setProducer_name(rs2.getString("distributer_name")); producerBean.setMobile_number(rs2.getString("distributer_mobile")); producerBean.setMail(rs2.getString("distributer_email")); } break; case 8: String sql4 = "SELECT district_administrator_name,district_administrator_email,district_administrator_mobile FROM district_administrator_detail WHERE district_administrator_id = ?"; ps2 = conn.prepareStatement(sql4); ps2.setInt(1, producerBean.getProducer_id()); rs2 = ps2.executeQuery(); while(rs2.next()) { producerBean.setProducer_name(rs2.getString("district_administrator_name")); producerBean.setMobile_number(rs2.getString("district_administrator_mobile")); producerBean.setMail(rs2.getString("district_administrator_email")); } break; case 9: String sql5 = "SELECT taluk_administrator_name,taluk_administrator_email,taluk_administrator_mobile FROM taluk_administrator_detail WHERE taluk_administrator_id = ?"; ps2 = conn.prepareStatement(sql5); ps2.setInt(1, producerBean.getProducer_id()); rs2 = ps2.executeQuery(); while(rs2.next()) { producerBean.setProducer_name(rs2.getString("taluk_administrator_name")); producerBean.setMobile_number(rs2.getString("taluk_administrator_mobile")); producerBean.setMail(rs2.getString("taluk_administrator_email")); } break; } } } catch (Exception e) { e.printStackTrace(); String str = "getTheatreOwnerInboxDetail"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return producerBean; } //setUpdateDeleteInboxNotification public TheaterOwnerBean setUpdateDeleteInboxNotification(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { conn = connectionManager.getConnection(); String sql = "UPDATE communication_inbox_detail SET is_deleted = 'Yes' WHERE communication_inbox_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getInbox_msg_id()); ps.executeUpdate(); String sql1 = "SELECT COUNT(sender_id) AS 'Count' FROM communication_inbox_detail WHERE receiver_id = ? AND is_deleted = 'No'"; ps = conn.prepareStatement(sql1); ps.setInt(1, theaterOwnerBean.getTheater_owner_id()); rs = ps.executeQuery(); if(rs.next()) { theaterOwnerBean.setInbox_count(rs.getInt("Count")); } } catch (Exception e) { e.printStackTrace(); String str = "setUpdateDeleteInboxNotification"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //insertTicketDetails public static String insertTicketDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; PreparedStatement ps2=null; ResultSet rs2=null; PreparedStatement ps3=null; ResultSet rs3=null; String seatStr = ""; String bookingSeatStr = ""; Connection conn=null; String status = ""; int i = 0; int j = 0; try { conn = connectionManager.getConnection(); SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat Format = new SimpleDateFormat("yyyy-MM-dd"); Date mdate = dateFormat.parse(theaterOwnerBean.getBooking_date()); String date = Format.format(mdate); //individual_movie_ticket_sold_details String insert_ticket="insert into individual_movie_ticket_sold_details(theatre_id,screen_id,show_timing_id,movie_detail_id,show_date_id,user_id,user_role_id,seat_id,ticket_amount,is_deleted,status,booking_id,qr_code,qr_code_path,create_date) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,now())"; ps3= conn.prepareStatement(insert_ticket); ps3.setInt(1, theaterOwnerBean.getTheater_id()); ps3.setInt(2, theaterOwnerBean.getScreen_id()); ps3.setInt(3, theaterOwnerBean.getShow_timing_id()); ps3.setInt(4, theaterOwnerBean.getMovie_details_id()); ps3.setString(5, date.replaceAll("-", "")); ps3.setInt(6, theaterOwnerBean.getTicket_counter_person_id()); ps3.setString(7, theaterOwnerBean.getUser_role()); ps3.setString(8, theaterOwnerBean.getBooking_seat()); ps3.setString(9, String.valueOf(theaterOwnerBean.getTotal_transaction_amount())); ps3.setString(10,"N"); ps3.setString(11,"Active"); ps3.setString(12, theaterOwnerBean.getBooking_id()); ps3.setString(13, theaterOwnerBean.getQr_code()); ps3.setString(14, theaterOwnerBean.getQr_code_path()); i = ps3.executeUpdate(); /* String sql1="SELECT seat_id,ticket_amount FROM individual_movie_ticket_sold_details WHERE theatre_id = ? AND screen_id = ? AND show_timing_id =? AND movie_detail_id = ? AND show_date_id = ? AND user_id = ?"; ps1 = conn.prepareStatement(sql1); ps1.setInt(1, theaterOwnerBean.getTheater_id()); ps1.setInt(2, theaterOwnerBean.getScreen_id()); ps1.setInt(3, theaterOwnerBean.getShow_timing_id()); ps1.setInt(4, theaterOwnerBean.getMovie_details_id()); ps1.setString(5, date.replaceAll("-", "")); ps1.setInt(6, theaterOwnerBean.getTicket_counter_person_id()); rs1 = ps1.executeQuery(); if(rs1.next()) { double totalTickAmountDouble = 0.00; String seat = rs1.getString("seat_id"); String crtBookingSeatStr=seat+","; crtBookingSeatStr=crtBookingSeatStr.concat(theaterOwnerBean.getBooking_seat()); totalTickAmountDouble = Double.parseDouble(theaterOwnerBean.getTotal_price())+Double.parseDouble(rs1.getString("ticket_amount")); String sql2="UPDATE individual_movie_ticket_sold_details SET seat_id = ?,ticket_amount = ? WHERE theatre_id = ? AND screen_id = ? AND show_timing_id =? AND movie_detail_id = ? AND show_date_id = ? AND user_id = ?"; ps1 = conn.prepareStatement(sql2); ps1.setString(1, crtBookingSeatStr); ps1.setString(2, String.valueOf(totalTickAmountDouble)); ps1.setInt(3, theaterOwnerBean.getTheater_id()); ps1.setInt(4, theaterOwnerBean.getScreen_id()); ps1.setInt(5, theaterOwnerBean.getShow_timing_id()); ps1.setInt(6, theaterOwnerBean.getMovie_details_id()); ps1.setString(7, date.replaceAll("-", "")); ps1.setInt(8, theaterOwnerBean.getTicket_counter_person_id()); i = ps1.executeUpdate(); } else{ String insert_ticket="insert into individual_movie_ticket_sold_details(theatre_id,screen_id,show_timing_id,movie_detail_id,show_date_id,user_id,user_role_id,seat_id,ticket_amount,is_deleted,status,create_date) values(?,?,?,?,?,?,?,?,?,?,?,now())"; ps3= conn.prepareStatement(insert_ticket); ps3.setInt(1, theaterOwnerBean.getTheater_id()); ps3.setInt(2, theaterOwnerBean.getScreen_id()); ps3.setInt(3, theaterOwnerBean.getShow_timing_id()); ps3.setInt(4, theaterOwnerBean.getMovie_details_id()); ps3.setString(5, date.replaceAll("-", "")); ps3.setInt(6, theaterOwnerBean.getTicket_counter_person_id()); ps3.setString(7, theaterOwnerBean.getUser_role()); ps3.setString(8, theaterOwnerBean.getBooking_seat()); ps3.setString(9, theaterOwnerBean.getTotal_price()); ps3.setString(10,"N"); ps3.setString(11,"Active"); i = ps3.executeUpdate(); }*/ //movie_ticket_sold_details String sql= "SELECT seat_id FROM movie_ticket_sold_details WHERE theater_id=? AND screen_id=? AND show_timing_id=? AND show_date_id =? AND movie_detail_id=? AND show_detail_id = ?"; ps1 = conn.prepareStatement(sql); ps1.setInt(1, theaterOwnerBean.getTheater_id()); ps1.setInt(2, theaterOwnerBean.getScreen_id()); ps1.setInt(3, theaterOwnerBean.getShow_timing_id()); ps1.setString(4, date.replaceAll("-", "")); ps1.setInt(5, theaterOwnerBean.getMovie_details_id()); ps1.setInt(6, theaterOwnerBean.getShow_detail_id()); rs1 = ps1.executeQuery(); if(rs1.next()) { seatStr=rs1.getString("seat_id"); bookingSeatStr=seatStr+","; bookingSeatStr=bookingSeatStr.concat(theaterOwnerBean.getBooking_seat()); String update_ticket="UPDATE movie_ticket_sold_details SET seat_id=? WHERE theater_id=? AND screen_id=? AND show_timing_id=? AND show_date_id =? AND movie_detail_id=? AND show_detail_id = ?"; ps2 = conn.prepareStatement(update_ticket); ps2.setString(1,bookingSeatStr); ps2.setInt(2, theaterOwnerBean.getTheater_id()); ps2.setInt(3, theaterOwnerBean.getScreen_id()); ps2.setInt(4, theaterOwnerBean.getShow_timing_id()); ps2.setString(5, date.replaceAll("-", "")); ps2.setInt(6, theaterOwnerBean.getMovie_details_id()); ps2.setInt(7, theaterOwnerBean.getShow_detail_id()); j = ps2.executeUpdate(); } else { String ticket_details="insert into movie_ticket_sold_details(theater_id,screen_id,show_timing_id,show_date_id,movie_detail_id,show_detail_id,seat_id,is_deleted,status,created_on) values(?,?,?,?,?,?,?,?,?,now())"; ps = conn.prepareStatement(ticket_details); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, theaterOwnerBean.getScreen_id()); ps.setInt(3, theaterOwnerBean.getShow_timing_id()); ps.setString(4, date.replaceAll("-", "")); ps.setInt(5, theaterOwnerBean.getMovie_details_id()); ps.setInt(6, theaterOwnerBean.getShow_detail_id()); ps.setString(7, theaterOwnerBean.getBooking_seat()); ps.setString(8,"N"); ps.setString(9,"Active"); j = ps.executeUpdate(); } String taxStatus = insertGovernmentTaxDetails(theaterOwnerBean); if(taxStatus == "success" && i > 0 && j > 0) { status = "success"; } else { status = "failure"; } } catch(Exception e) { e.printStackTrace(); } return status; } //Government tax public static String insertGovernmentTaxDetails(TheaterOwnerBean theaterOwnerBean)throws Exception { Connection conn=null; PreparedStatement ps=null; ResultSet rs=null; PreparedStatement ps1=null; ResultSet rs1=null; PreparedStatement ps2=null; ResultSet rs2=null; PreparedStatement ps3=null; ResultSet rs3=null; DecimalFormat twoDForm = new DecimalFormat("#.##"); String status = ""; int i = 0; int j = 0; int k = 0; try { conn = connectionManager.getConnection(); SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat Format = new SimpleDateFormat("yyyy-MM-dd"); Date mdate = dateFormat.parse(theaterOwnerBean.getBooking_date()); String date = Format.format(mdate); Date today = new Date(); SimpleDateFormat date_Format = new SimpleDateFormat("yyyy-MM-dd"); int todayDateKey = Integer.parseInt(date_Format.format(today).replaceAll("-", "")); String todayDate = date_Format.format(today); double totalTaxAmount = 0.00; double totalTickAmountDouble = 0.00; double convinentFee = 0.00; /*String sql1="SELECT ticket_amount FROM individual_movie_ticket_sold_details WHERE theatre_id = ? AND screen_id = ? AND show_date_id = ?"; ps = conn.prepareStatement(sql1); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, theaterOwnerBean.getScreen_id()); ps.setString(3, date.replaceAll("-", "")); rs = ps.executeQuery(); while(rs.next()) { totalTicketAmount = rs.getString("ticket_amount"); totalTickAmountDouble = totalTickAmountDouble+Double.parseDouble(totalTicketAmount); }*/ double sgstPercentage = 0.00; double cgstPercentage = 0.00; double etPercentage = 0.00; //get tax percentage String sql20="SELECT cgst_percentage,sgst_percentage,et_percentage,convenient_charge FROM tax_charge_percentage_detail WHERE STATUS = 1"; ps = conn.prepareStatement(sql20); rs = ps.executeQuery(); while(rs.next()){ cgstPercentage = rs.getDouble("cgst_percentage"); sgstPercentage = rs.getDouble("sgst_percentage"); etPercentage = rs.getDouble("et_percentage"); } String sql1="SELECT total_amount,convenient_fee FROM report_theatre_wise_tax_detail WHERE theatre_id =? AND screen_id = ? AND date_key = ? AND created_date_key = ?"; ps = conn.prepareStatement(sql1); ps.setInt(1, theaterOwnerBean.getTheater_id()); ps.setInt(2, theaterOwnerBean.getScreen_id()); ps.setString(3, date.replaceAll("-", "")); ps.setInt(4, todayDateKey); rs = ps.executeQuery(); if(rs.next()) { totalTickAmountDouble = rs.getDouble("total_amount")+Double.parseDouble(theaterOwnerBean.getTotal_price()); convinentFee = rs.getDouble("convenient_fee")+theaterOwnerBean.getConvenient_amount(); } else{ totalTickAmountDouble = Double.parseDouble(theaterOwnerBean.getTotal_price()); convinentFee = theaterOwnerBean.getConvenient_amount(); } double sgst = totalTickAmountDouble*sgstPercentage/100; double cgst = totalTickAmountDouble*cgstPercentage/100; double et = totalTickAmountDouble*etPercentage/100; totalTaxAmount = totalTickAmountDouble+sgst+cgst+et+convinentFee; String sql="SELECT theatre_id FROM report_theatre_wise_tax_detail WHERE theatre_id = ? AND screen_id = ? AND date_key = ? AND created_date_key = ?"; ps1 = conn.prepareStatement(sql); ps1.setInt(1, theaterOwnerBean.getTheater_id()); ps1.setInt(2, theaterOwnerBean.getScreen_id()); ps1.setInt(3, Integer.parseInt(date.replaceAll("-", ""))); ps1.setInt(4, todayDateKey); rs1 = ps1.executeQuery(); if(rs1.next()) { String update_tax="UPDATE report_theatre_wise_tax_detail SET total_amount=?,cgst_tax=?,sgst_tax=?,et_tax=?,total_payable_amount=?,convenient_fee=?,created_date=NOW() WHERE theatre_id=? AND screen_id=? AND date_key=? AND created_date_key = ?"; ps2 = conn.prepareStatement(update_tax); ps2.setString(1, twoDForm.format(totalTickAmountDouble)); ps2.setString(2, twoDForm.format(cgst)); ps2.setString(3, twoDForm.format(sgst)); ps2.setString(4, twoDForm.format(et)); ps2.setString(5, twoDForm.format(totalTaxAmount)); ps2.setString(6, twoDForm.format(convinentFee)); ps2.setInt(7, theaterOwnerBean.getTheater_id()); ps2.setInt(8, theaterOwnerBean.getScreen_id()); ps2.setInt(9, Integer.parseInt(date.replaceAll("-", ""))); ps2.setInt(10, todayDateKey); i = ps2.executeUpdate(); } else { String insert_tax="INSERT INTO report_theatre_wise_tax_detail (theatre_id,screen_id,DATE,date_key,total_amount,cgst_tax,sgst_tax,et_tax,total_payable_amount,convenient_fee,created_date_key,created_date) VALUES(?,?,?,?,?,?,?,?,?,?,?,NOW())"; ps3 = conn.prepareStatement(insert_tax); ps3.setInt(1, theaterOwnerBean.getTheater_id()); ps3.setInt(2, theaterOwnerBean.getScreen_id()); ps3.setString(3, date); ps3.setInt(4, Integer.parseInt(date.replaceAll("-", ""))); ps3.setString(5, twoDForm.format(totalTickAmountDouble)); ps3.setString(6, twoDForm.format(cgst)); ps3.setString(7, twoDForm.format(sgst)); ps3.setString(8, twoDForm.format(et)); ps3.setString(9, twoDForm.format(totalTaxAmount)); ps3.setString(10, twoDForm.format(convinentFee)); ps3.setInt(11, todayDateKey); i = ps3.executeUpdate(); } //consolidated report detail int talukId = 0; int districtId = 0; int stateId = 0; String sql2="SELECT l.taluk_id,l.district_id,d.state_id FROM theater_detail l INNER JOIN district d ON l.district_id = d.district_id WHERE l.theater_id = ?"; ps1 = conn.prepareStatement(sql2); ps1.setInt(1, theaterOwnerBean.getTheater_id()); rs1 = ps1.executeQuery(); while(rs1.next()) { talukId = rs1.getInt("taluk_id"); districtId = rs1.getInt("district_id"); stateId = rs1.getInt("state_id"); } double gstAmnt = theaterOwnerBean.getSgst_amount()+theaterOwnerBean.getCgst_amount(); String sql14="SELECT total_transcation_amount,gst_amount,et_amount,convenient_charge_amount FROM booking_consolidated_report_detail WHERE theatre_id = ? AND transaction_date_key = ?"; ps1 = conn.prepareStatement(sql14); ps1.setInt(1, theaterOwnerBean.getTheater_id()); ps1.setInt(2, todayDateKey); rs1 = ps1.executeQuery(); if(rs1.next()) { double totalTransAmnt = rs1.getDouble("total_transcation_amount")+theaterOwnerBean.getTotal_transaction_amount(); double totalGstAmnt = rs1.getDouble("gst_amount")+gstAmnt; double totalEtAmnt = rs1.getDouble("et_amount")+theaterOwnerBean.getEt_amount(); double totalConvenientAmnt = rs1.getDouble("convenient_charge_amount")+theaterOwnerBean.getConvenient_amount(); String sql3="UPDATE booking_consolidated_report_detail SET total_transcation_amount=?,gst_amount=?,et_amount=?,convenient_charge_amount=? WHERE theatre_id = ? AND transaction_date_key = ?"; ps2 = conn.prepareStatement(sql3); ps2.setDouble(1, totalTransAmnt); ps2.setDouble(2, totalGstAmnt); ps2.setDouble(3, totalEtAmnt); ps2.setDouble(4, totalConvenientAmnt); ps2.setInt(5, theaterOwnerBean.getTheater_id()); ps2.setInt(6, todayDateKey); j = ps2.executeUpdate(); } else { String sql4="INSERT INTO booking_consolidated_report_detail (transaction_date,transaction_date_key,taluk_id,district_id,state_id,theatre_id,total_transcation_amount,gst_amount,et_amount,convenient_charge_amount) VALUES (?,?,?,?,?,?,?,?,?,?)"; ps2 = conn.prepareStatement(sql4); ps2.setString(1, todayDate); ps2.setInt(2, todayDateKey); ps2.setInt(3, talukId); ps2.setInt(4, districtId); ps2.setInt(5, stateId); ps2.setInt(6, theaterOwnerBean.getTheater_id()); ps2.setDouble(7, theaterOwnerBean.getTotal_transaction_amount()); ps2.setDouble(8, gstAmnt); ps2.setDouble(9, theaterOwnerBean.getEt_amount()); ps2.setDouble(10, theaterOwnerBean.getConvenient_amount()); j = ps2.executeUpdate(); } //provider type consolidate report String sql15="SELECT total_transcation_amount,gst_amount,et_amount FROM booktype_provider_consolidated_report_detail WHERE booktype_provider_id = ? AND transaction_date_key = ?"; ps1 = conn.prepareStatement(sql15); ps1.setInt(1, 1); ps1.setInt(2, todayDateKey); rs1 = ps1.executeQuery(); if(rs1.next()) { double totalTransAmnt = rs1.getDouble("total_transcation_amount")+theaterOwnerBean.getTotal_transaction_amount(); double totalGstAmnt = rs1.getDouble("gst_amount")+gstAmnt; double totalEtAmnt = rs1.getDouble("et_amount")+theaterOwnerBean.getEt_amount(); String sql3="UPDATE booktype_provider_consolidated_report_detail SET total_transcation_amount=?,gst_amount=?,et_amount=? WHERE booktype_provider_id=? AND transaction_date_key = ?"; ps2 = conn.prepareStatement(sql3); ps2.setDouble(1, totalTransAmnt); ps2.setDouble(2, totalGstAmnt); ps2.setDouble(3, totalEtAmnt); ps2.setInt(4, 1); ps2.setInt(5, todayDateKey); k = ps2.executeUpdate(); } else { String sql4="INSERT INTO booktype_provider_consolidated_report_detail (booktype_provider_id,transaction_date,transaction_date_key,total_transcation_amount,gst_amount,et_amount) VALUES (?,?,?,?,?,?)"; ps2 = conn.prepareStatement(sql4); ps2.setInt(1, 1); ps2.setString(2, todayDate); ps2.setInt(3, todayDateKey); ps2.setDouble(4, theaterOwnerBean.getTotal_transaction_amount()); ps2.setDouble(5, gstAmnt); ps2.setDouble(6, theaterOwnerBean.getEt_amount()); k = ps2.executeUpdate(); } if(i > 0 && j > 0 && k > 0) { status = "success"; } else { status = "failure"; } } catch(Exception e) { e.printStackTrace(); } return status; } //getMovieMappingLanguageList public Map<Integer, String> getMovieMappingLanguageList(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; PreparedStatement ps1 = null; ResultSet rs1 = null; Map<Integer, String> movieLangMap=new HashMap<Integer, String>(); try { conn = connectionManager.getConnection(); String sql = "SELECT language_id_str FROM master_movie_detail WHERE master_movie_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getMaster_movie_id()); rs = ps.executeQuery(); while(rs.next()) { String sql1 = "SELECT language_id,language_name FROM movie_languge WHERE language_id IN ("+rs.getString("language_id_str")+")"; ps1 = conn.prepareStatement(sql1); rs1 = ps1.executeQuery(); while(rs1.next()) { movieLangMap.put(rs1.getInt("language_id"), rs1.getString("language_name")); } } } catch (Exception e) { e.printStackTrace(); String str = "getMovieMappingLanguageList"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieLangMap; } //getMovieMappingFormatList public Map<Integer, String> getMovieMappingFormatList(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; PreparedStatement ps1 = null; ResultSet rs1 = null; Map<Integer, String> movieFormatMap=new HashMap<Integer, String>(); try { conn = connectionManager.getConnection(); String sql = "SELECT format_id FROM master_movie_detail WHERE master_movie_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getMaster_movie_id()); rs = ps.executeQuery(); while(rs.next()) { String sql1 = "SELECT movie_format_id,format_name FROM movie_format WHERE movie_format_id IN ("+rs.getString("format_id")+")"; ps1 = conn.prepareStatement(sql1); rs1 = ps1.executeQuery(); while(rs1.next()) { movieFormatMap.put(rs1.getInt("movie_format_id"), rs1.getString("format_name")); } } } catch (Exception e) { e.printStackTrace(); String str = "getMovieMappingFormatList"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieFormatMap; } //getMasterMovieNameDetails public ArrayList<TheaterOwnerBean> getMasterMovieNameDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; CallableStatement cl = null; ArrayList<TheaterOwnerBean> movieList =new ArrayList<TheaterOwnerBean>(); int i = 0; try { conn = connectionManager.getConnection(); String sql = "{CALL Ticket_TO_getMasterMovieDetails()}"; cl = conn.prepareCall(sql); boolean res = cl.execute(); while(res) { ResultSet rs = cl.getResultSet(); if(i==1) { while(rs.next()) { theaterOwnerBean.setMaster_movie_id(rs.getInt("master_movie_id")); theaterOwnerBean.setMovie_name(rs.getString("movie_name")); movieList.add(theaterOwnerBean); } } i++; res = cl.getMoreResults(); } } catch (Exception e) { e.printStackTrace(); String str = "getMasterMovieNameDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return movieList; } //getmvReleasedDate public TheaterOwnerBean getmvReleasedDate(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { conn = connectionManager.getConnection(); SimpleDateFormat date = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); String sql = "SELECT release_date FROM master_movie_detail WHERE master_movie_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getMaster_movie_id()); rs = ps.executeQuery(); while(rs.next()) { Date reldate = dateformat.parse(rs.getString("release_date")); String releaseDate = date.format(reldate); theaterOwnerBean.setMovie_release_date(releaseDate); } } catch (Exception e) { e.printStackTrace(); String str = "getMovieMappingLanguageList"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getDistrictWiseTalukDetails public TheaterOwnerBean getDistrictWiseTalukDetails(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; Map<Integer, String> talukMap = new HashMap<Integer,String>(); try { conn = connectionManager.getConnection(); String sql = "SELECT taluk_id,taluk_name FROM taluk WHERE district_id = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, theaterOwnerBean.getDistrict_id()); rs = ps.executeQuery(); while(rs.next()) { talukMap.put(rs.getInt("taluk_id"), rs.getString("taluk_name")); } theaterOwnerBean.setTalukMap(talukMap); } catch (Exception e) { e.printStackTrace(); String str = "getDistrictWiseTalukDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //getTalukDetails public Map<Integer, String> getTalukDetails() throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; Map<Integer, String> talukMap = new HashMap<Integer,String>(); try { conn = connectionManager.getConnection(); String sql = "SELECT taluk_id,taluk_name FROM taluk"; ps = conn.prepareStatement(sql); rs = ps.executeQuery(); while(rs.next()) { talukMap.put(rs.getInt("taluk_id"), rs.getString("taluk_name")); } } catch (Exception e) { e.printStackTrace(); String str = "getTalukDetails"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return talukMap; } //pricing plan information public BillingDetailsBean getUserPaymentDetails(TheaterOwnerBean theaterOwnerBean, BillingDetailsBean billingDetailsBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; PreparedStatement ps1 = null; ResultSet rs1 = null; String order_id = ""; String transcation_id = ""; DecimalFormat twoDForm = new DecimalFormat("#.00"); try{ conn = connectionManager.getConnection(); String id=""+theaterOwnerBean.getTheater_owner_id(); String uniqueId=UniqueId.getOrderRandNum("U_"+id); order_id = uniqueId; //order_id = "S0M1PXO4OQU_37"; transcation_id=UniqueId.getTarckingId(); //transcation_id = "1321911577"; double taxAmount = theaterOwnerBean.getTheatre_et_amount(); /*taxAmount = round(theaterOwnerBean.getTheatre_et_amount(), 2) ;*/ billingDetailsBean.setAmount(Double.parseDouble(twoDForm.format(taxAmount))); Date today = new Date(); SimpleDateFormat date_Format = new SimpleDateFormat("dd-MM-yy HH:mm"); String date = date_Format.format(today); String sql1 = "select theater_owner_id from theater_transcation_order_detail where theater_id = ? and theater_owner_id=? and status = 'Pending'"; ps = conn.prepareStatement(sql1); ps.setInt(1, theaterOwnerBean.getTheatre_id()); ps.setInt(2, theaterOwnerBean.getTheater_owner_id()); rs = ps.executeQuery(); if(rs.next()) { String sql2 = "update theater_transcation_order_detail set order_id = ?,transcation_id=?,request_date=? where theater_id = ? and theater_owner_id=? and status = 'Pending'"; ps1 = conn.prepareStatement(sql2); ps1.setString(1, order_id); ps1.setString(2, transcation_id); ps1.setString(3, date); ps1.setInt(4, theaterOwnerBean.getTheatre_id()); ps1.setInt(5, theaterOwnerBean.getTheater_owner_id()); ps1.executeUpdate(); billingDetailsBean.setOrder_id(order_id); billingDetailsBean.setTranscation_id(transcation_id); } else { String sql2 = "insert into theater_transcation_order_detail (theater_id,theater_owner_id,status,order_id,transcation_id,request_date) values (?,?,?,?,?,?)"; ps1 = conn.prepareStatement(sql2); ps1.setInt(1, theaterOwnerBean.getTheatre_id()); ps1.setInt(2,theaterOwnerBean.getTheater_owner_id()); ps1.setString(3, "Pending"); ps1.setString(4, order_id); ps1.setString(5, transcation_id); ps1.setString(6, date); ps1.executeUpdate(); billingDetailsBean.setOrder_id(order_id); billingDetailsBean.setTranscation_id(transcation_id); } String sql3= "SELECT theater_owner_email,theater_owner_first_name,theater_owner_mobile,theater_owner_state_id,theater_owner_city_id FROM theater_owner_detail WHERE theater_owner_id=? AND STATUS = 'Active' AND is_deleted='N'"; ps=conn.prepareStatement(sql3); ps.setInt(1,theaterOwnerBean.getTheater_owner_id()); rs = ps.executeQuery(); while(rs.next()) { billingDetailsBean.setFirstname(rs.getString("theater_owner_first_name")); billingDetailsBean.setEmail(rs.getString("theater_owner_email")); billingDetailsBean.setMobile(rs.getString("theater_owner_mobile")); billingDetailsBean.setCountry_id(103); billingDetailsBean.setState_id(rs.getInt("theater_owner_state_id")); billingDetailsBean.setCity_id(rs.getInt("theater_owner_city_id")); } String sql4 = "select country_name from country where country_id = ?"; ps = conn.prepareStatement(sql4); ps.setInt(1, billingDetailsBean.getCountry_id()); rs = ps.executeQuery(); while(rs.next()) { billingDetailsBean.setCountry(rs.getString("country_name")); } String sql5 = "select state_name from state where state_id=?"; ps = conn.prepareStatement(sql5); ps.setInt(1, billingDetailsBean.getState_id()); rs = ps.executeQuery(); while(rs.next()) { billingDetailsBean.setState(rs.getString("state_name")); } String sql6 = "select city_name from city where city_id = ?"; ps = conn.prepareStatement(sql6); ps.setInt(1, billingDetailsBean.getCity_id()); rs = ps.executeQuery(); while(rs.next()) { billingDetailsBean.setCity(rs.getString("city_name")); } } catch(Exception e){ e.printStackTrace(); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return billingDetailsBean; } //getCountryDetail public Map<Integer, String> getCountryDetail() throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; Map<Integer, String> countryMap = new HashMap<Integer,String>(); try { conn = connectionManager.getConnection(); String sql = "SELECT country_id,country_name FROM country"; ps = conn.prepareStatement(sql); rs = ps.executeQuery(); while(rs.next()) { countryMap.put(rs.getInt("country_id"), rs.getString("country_name")); } } catch (Exception e) { e.printStackTrace(); String str = "getCountryDetail"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return countryMap; } //theatrePrincingPaymentRedirect public TheaterOwnerBean theatrePrincingPaymentRedirect(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { conn = connectionManager.getConnection(); Map<String, String> responseMap = theaterOwnerBean.getResponseMap(); if(responseMap.get("order_status").equals("Success")) { String sql = "update theater_transcation_order_detail set status = 'Completed',order_status=?,payment_mode=?,amount=?,card_name=?,bank_ref_no=?,transcation_date=?,tracking_id=? where order_id=?"; ps = conn.prepareStatement(sql); ps.setString(1, responseMap.get("order_status")); ps.setString(2, responseMap.get("payment_mode")); ps.setString(3, responseMap.get("mer_amount")); ps.setString(4, responseMap.get("card_name")); ps.setString(5, responseMap.get("bank_ref_no")); ps.setString(6, responseMap.get("trans_date")); ps.setString(7, responseMap.get("tracking_id")); ps.setString(8, responseMap.get("order_id")); ps.executeUpdate(); theaterOwnerBean.setPayment_status("Success"); } else { theaterOwnerBean.setPayment_status("Failure"); } } catch (Exception e) { e.printStackTrace(); String str = "theatrePrincingPaymentRedirect"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } //round public static double round(double value, int places) { if (places < 0) throw new IllegalArgumentException(); long factor = (long) Math.pow(10, places); value = value * factor; long tmp = Math.round(value); return (double) tmp / factor; } //checkTheaterEmployeeMobile public TheaterOwnerBean checkTheaterEmployeeMobile(TheaterOwnerBean theaterOwnerBean) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { conn = connectionManager.getConnection(); String sql = "SELECT mobile FROM login where mobile = ?"; ps = conn.prepareStatement(sql); ps.setString(1, theaterOwnerBean.getPhone_number()); rs = ps.executeQuery(); if(rs.next()) { theaterOwnerBean.setStatus("Active"); } else { theaterOwnerBean.setStatus("InActive"); } } catch (Exception e) { e.printStackTrace(); String str = "checkTheaterEmployeeMobile"; catchMethodLogger(str, e); } finally { if(conn!=null) { connectionManager.releaseConnection(conn); } } return theaterOwnerBean; } }
package com.shakeboy.pojo; import com.baomidou.mybatisplus.annotation.*; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.util.Date; @Data @NoArgsConstructor @AllArgsConstructor @TableName("friends") public class Friend { @TableId(type = IdType.AUTO) private int friendId; private int userIdo; private int userIdt; @TableField(fill = FieldFill.INSERT) private Date createTime; @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateTime; }
package net.drs.myapp.resource; import java.security.Principal; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; 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.context.request.WebRequest; import net.drs.myapp.api.INotifyByEmail; import net.drs.myapp.api.IRegistrationService; import net.drs.myapp.constants.ApplicationConstants; import net.drs.myapp.dto.CompleteRegistrationDTO; import net.drs.myapp.dto.EmailDTO; import net.drs.myapp.dto.SMSDTO; import net.drs.myapp.dto.UserDTO; import net.drs.myapp.model.Role; import net.drs.myapp.model.User; import net.drs.myapp.notification.NotificationDataConstants; import net.drs.myapp.notification.NotificationRequest; import net.drs.myapp.notification.NotificationTemplate; import net.drs.myapp.notification.NotificationType; import net.drs.myapp.response.handler.ExeceptionHandler; import net.drs.myapp.response.handler.SuccessMessageHandler; @CrossOrigin @RequestMapping("/v1/guest") //@RestController public class RegistrationResource extends GenericService { private static final Logger logger = LoggerFactory.getLogger(RegistrationResource.class); @Autowired IRegistrationService registrationService; @Autowired INotifyByEmail notificationByEmailService; @Value("${notificationByEmail.or.SMS}") private String notifyByEmailOrSMS; // this is just for test case purpose. This should not be used by external // calls @PostMapping("/addAdmin") public ResponseEntity<?> addAdmin(@AuthenticationPrincipal Principal principal, @RequestBody UserDTO userDTO, BindingResult bindingResult) { java.util.Date uDate = new java.util.Date(); userDTO.setDateOfCreation(new java.sql.Date(uDate.getTime())); userDTO.setLastUpdated(new java.sql.Date(uDate.getTime())); try { Set<Role> roles = new HashSet(); Role role = new Role(); role.setRole(ApplicationConstants.ROLE_ADMIN); roles.add(role); Role role1 = new Role(); role1.setRole(ApplicationConstants.ROLE_USER); roles.add(role1); userDTO = registrationService.adduser(userDTO, roles); SuccessMessageHandler messageHandler = new SuccessMessageHandler(new Date(), "User Added Successfully", ""); return new ResponseEntity<>(messageHandler, HttpStatus.CREATED); } catch (Exception e) { e.printStackTrace(); ExeceptionHandler errorDetails = new ExeceptionHandler(new Date(), e.getMessage(), ""); return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST); } } @PostMapping("/addUser") public ResponseEntity<?> addUser(@RequestBody UserDTO userDTO, BindingResult bindingResult, WebRequest request) { java.util.Date uDate = new java.util.Date(); Set<Role> roles = new HashSet<>(); Long notificationId = 0L; userDTO.setDateOfCreation(new java.sql.Date(uDate.getTime())); userDTO.setLastUpdated(new java.sql.Date(uDate.getTime())); userDTO.setCreatedBy(ApplicationConstants.USER_GUEST); userDTO.setCreationDate(new java.sql.Date(uDate.getTime())); userDTO.setUpdatedBy(ApplicationConstants.USER_GUEST); userDTO.setUpdatedDate(new java.sql.Date(uDate.getTime())); try { NotificationRequest notificationReq = null; Map<String, String> data = new HashMap<String, String>(); Role role = new Role(); role.setRole(ApplicationConstants.ROLE_USER); roles.add(role); User user = registrationService.adduserandGetId(userDTO, roles); if (user != null && user.getUserId() > 0 && notifyByEmailOrSMS.equalsIgnoreCase(NotificationType.EMAIL.getNotificationType())) { EmailDTO emailDto = new EmailDTO(); emailDto.setEmailId(userDTO.getEmailAddress()); emailDto.setCreatedBy(ApplicationConstants.USER_SYSTEM); emailDto.setCreationDate(new java.sql.Date(uDate.getTime())); emailDto.setUpdatedBy(ApplicationConstants.USER_SYSTEM); emailDto.setUpdatedDate(new java.sql.Date(uDate.getTime())); emailDto.setEmailTemplateId(NotificationTemplate.NEW_REGISTRATION.getNotificationType()); emailDto.setUserID(user.getUserId()); emailDto.setNeedtoSendEmail(true); notificationId = notificationByEmailService.insertDatatoDBforNotification(emailDto); data.put(NotificationDataConstants.USER_NAME, userDTO.getFirstName()); data.put(NotificationDataConstants.TEMPERORY_ACTIVATION_STRING, user.getTemporaryActivationString()); notificationReq = new NotificationRequest(notificationId, emailDto.getEmailId(), null, data, NotificationTemplate.NEW_REGISTRATION, NotificationType.EMAIL); // rabbitMqService.publishSMSMessage(notificationReq); } else if (user != null && user.getUserId() > 0 && notifyByEmailOrSMS.equalsIgnoreCase(NotificationType.SMS.getNotificationType())) { SMSDTO smsDTO = new SMSDTO(user.getUserId(), user.getMobileNumber(), "otp message"); smsDTO = notificationByEmailService.insertDatatoDBforNotification(smsDTO); notificationReq = new NotificationRequest(smsDTO.getId(), null, userDTO.getMobileNumber(), data, NotificationTemplate.NEW_REGISTRATION, NotificationType.SMS); } // rabbitMqService.publishSMSMessage(notificationReq); String successMessage = String.format("User Added Successfully. Email Sent to the provided Email id: %s. " + "Activate your account by using code sent to your email ID", userDTO.getEmailAddress()); SuccessMessageHandler messageHandler = new SuccessMessageHandler(new Date(), successMessage, ""); return new ResponseEntity<>(messageHandler, HttpStatus.CREATED); } catch (Exception e) { ExeceptionHandler errorDetails = new ExeceptionHandler(new Date(), e.getMessage(), ""); return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST); } } @PostMapping("/activateUser") public ResponseEntity<?> activateAccount(@RequestBody UserDTO userDTO, BindingResult bindingResult) { logger.debug("Activating the user for the email id " + userDTO.getEmailAddress()); try { registrationService.activateUserAccount(userDTO); SuccessMessageHandler messageHandler = new SuccessMessageHandler(new Date(), "User Added Successfully. Email Sent to the provided Email id. " + "Please activate the account by clicking the link that is sent", ""); return new ResponseEntity<>(messageHandler, HttpStatus.CREATED); } catch (Exception e) { e.printStackTrace(); ExeceptionHandler errorDetails = new ExeceptionHandler(new Date(), e.getMessage(), ""); return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST); } } @PostMapping("/forgotPassword") public ResponseEntity<?> forgotPassword(@RequestBody String emailId, BindingResult bindingResult) { try { registrationService.forgotPassword(emailId); SuccessMessageHandler messageHandler = new SuccessMessageHandler(new Date(), "User Added Successfully", ""); return new ResponseEntity<>(messageHandler, HttpStatus.CREATED); } catch (Exception e) { e.printStackTrace(); ExeceptionHandler errorDetails = new ExeceptionHandler(new Date(), e.getMessage(), ""); return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST); } } @PostMapping("/resetPassword") public ResponseEntity<?> resetPassword(@RequestBody UserDTO userDTO, BindingResult bindingResult) { try { java.util.Date uDate = new java.util.Date(); if (!userDTO.getPassword().equalsIgnoreCase(userDTO.getConfirmPassword())) { throw new Exception("Password and Confirm Password doesnt match. Please try again with correct password"); } registrationService.resetPassword(userDTO); SuccessMessageHandler messageHandler = new SuccessMessageHandler(new Date(), "Password Resetted Successfully", ""); return new ResponseEntity<>(messageHandler, HttpStatus.CREATED); } catch (Exception e) { e.printStackTrace(); ExeceptionHandler errorDetails = new ExeceptionHandler(new Date(), e.getMessage(), ""); return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST); } } @PostMapping("/completeRegistration") public ResponseEntity<?> completeRegistration(@RequestBody CompleteRegistrationDTO completeRegistrationDTO, BindingResult bindingResult) { java.util.Date uDate = new java.util.Date(); Set<Role> roles = new HashSet(); completeRegistrationDTO.setCreatedDate(new java.sql.Date(uDate.getTime())); completeRegistrationDTO.setUpdatedDate(new java.sql.Date(uDate.getTime())); completeRegistrationDTO.setCreatedBy(ApplicationConstants.USER_SYSTEM); completeRegistrationDTO.setUpdatedBy(ApplicationConstants.USER_SYSTEM); // USER_SYSTEM means my user registration. try { Role role = new Role(); role.setRole(ApplicationConstants.ROLE_USER); roles.add(role); boolean result = registrationService.completeRegistration(completeRegistrationDTO); if (result) { SuccessMessageHandler messageHandler = new SuccessMessageHandler(new Date(), "User Details added Successfully", ""); return new ResponseEntity<>(messageHandler, HttpStatus.ACCEPTED); } else { ExeceptionHandler errorDetails = new ExeceptionHandler(new Date(), "Unable to store user details. Please try after some time...", ""); return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST); } } catch (Exception e) { e.printStackTrace(); ExeceptionHandler errorDetails = new ExeceptionHandler(new Date(), e.getMessage(), ""); return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST); } } @GetMapping("/all") // @PreAuthorize("hasAnyRole('USER')") public String hello(@AuthenticationPrincipal Principal principal) { principal.getName(); return "Hello Youtube"; } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); double v = scan.nextDouble(); if (v < 0 || v > 100){ System.out.println("Fora de intervalo"); }else if (v > 75.000001){ System.out.println("Intervalo (75,100]"); }else if (v > 50.000001) { System.out.println("Intervalo (50,75]"); }else if (v > 25.000001) { System.out.println("Intervalo (25,50]"); }else { System.out.println("Intervalo [0,25]"); } } }
package com.example.yudipratistha.dompetku.model; import android.provider.BaseColumns; public class KategoriContract implements BaseColumns { public static final String TABLE_NAME = "kategoris"; public static final String COLUMN_ID_USER = "id_user"; public static final String COLUMN_NAMA_KATEGORI = "nama_kategori"; public static final String COLUMN_ICON = "icon"; public static final String COLUMN_TIPE= "tipe"; public static final String COLUMN_STATUS_SYNC = "status_sync"; public static final String COLUMN_STATUS_UPDATE = "status_update"; public static final String COLUMN_STATUS_DELETE = "status_delete"; public static final String COLUMN_CREATED_AT = "created_at"; public static final String COLUMN_UPDATED_AT = "updated_at"; public static final String SQL_CREATE_ENTRIES = "CREATE TABLE " + KategoriContract.TABLE_NAME + " (" + KategoriContract._ID + " INTEGER PRIMARY KEY," + KategoriContract.COLUMN_ID_USER + " INTEGER," + KategoriContract.COLUMN_NAMA_KATEGORI + " TEXT," + KategoriContract.COLUMN_ICON + " TEXT," + KategoriContract.COLUMN_TIPE + " TEXT," + KategoriContract.COLUMN_STATUS_SYNC + " INTEGER," + TransaksiContract.COLUMN_STATUS_UPDATE + " INTEGER," + TransaksiContract.COLUMN_STATUS_DELETE + " INTEGER," + KategoriContract.COLUMN_CREATED_AT + " TEXT," + KategoriContract.COLUMN_UPDATED_AT + " TEXT)"; public static final String SQL_DELETE_ENTRIES = "DROP TABLE IF EXISTS " + KategoriContract.TABLE_NAME; }
package com.fixit.external; /** * Created by konstantin on 5/10/2017. */ public class ExternalLogin { enum Status { SUCCESS, ERROR, CANCELED, NO_PROFILE, NO_EMAIL } enum Source { FACEBOOK, GOOGLE } interface Callback { void onLoggedIn(Source source, Status status, String firstName, String lastName, String email); } }
package com.jk.jkproject.ui.dialog; import android.content.Context; import android.graphics.Typeface; import android.os.Bundle; import android.view.Gravity; import android.view.View; import android.widget.TextView; import com.jk.jkproject.R; import com.jk.jkproject.utils.SPUtils; import com.jk.jkproject.utils.ScreenUtils; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import butterknife.Unbinder; public class DialogLiveRoomLackBalance extends BaseDialog { @BindView(R.id.tv_1) TextView tv1; @BindView(R.id.tv_2) TextView tv2; @BindView(R.id.tv_cancel) TextView tvCancel; @BindView(R.id.tv_top_up) TextView tvTopUp; private Unbinder bind; private DialogReturnListener listener; private Context mContext; private int mType; private String titleName; private int type; private String userName; private String time, cause; public DialogLiveRoomLackBalance(Context context, int mType) { super(context); this.mContext = context; this.type = mType; } public DialogLiveRoomLackBalance(Context context, int mType, String time) { super(context); this.mContext = context; this.type = mType; this.time = time; } private void init() { switch (type) { default: break; case 4: case 3: break; case 2: tv1.setText("确定进入直播间?"); tv2.setText("进入直播间将导致您目前的直播关闭!"); tvTopUp.setText("确认"); break; case 1: tv1.setText("余额不足"); tv2.setText("您的账户余额不足是否去充值"); tvTopUp.setText("立即充值"); break; case 6: tv1.setVisibility(View.GONE); tv2.setText("确定要将该用户踢出房间吗?"); tvTopUp.setText("确认"); break; case 7: tv1.setVisibility(View.GONE); tv2.setText("确定要将该用户禁言吗?"); tvTopUp.setText("确认"); break; case 8: tv1.setVisibility(View.GONE); tv2.setText("确定要将该用户取消禁言吗?"); tvTopUp.setText("确认"); break; case 9: tv1.setVisibility(View.GONE); tv2.setText("确定要将该用户设为管理员吗?"); tvTopUp.setText("确认"); break; case 10: tv1.setVisibility(View.GONE); tv2.setText("确定要将该用户取消管理员吗?"); tvTopUp.setText("确认"); break; case 11: tv1.setText("实名认证"); tv2.setText("请先实名认证"); tvTopUp.setText("确认"); break; case 12: tv1.setText("实名认证"); tv2.setText("实名认证正在审核中"); tvTopUp.setText("确定"); tvCancel.setVisibility(View.GONE); break; case 13: tv1.setText("审核未通过"); tv2.setText(SPUtils.getStatusMessage()); tvTopUp.setText("重新认证"); tvCancel.setText("取消"); break; case 14: tv1.setVisibility(View.GONE); tv2.setText("您的账号在其他设备登录了,请\n" + "重新登录~"); tvTopUp.setText("确定"); tvCancel.setVisibility(View.GONE); break; case 15: tv1.setText("提示"); tv2.setText("确定退出登录吗?"); tvTopUp.setText("确定"); tvCancel.setText("取消"); break; case 16: tv1.setText("是否进行拉黑?"); tv2.setText("拉黑后,Ta不能进入你的直播间,也不能关注"); tv2.setTextSize(14); tvTopUp.setText("确定"); tvCancel.setText("取消"); tv1.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); tv2.setTypeface(Typeface.DEFAULT); break; case 17: tv1.setText("是否取消拉黑?"); tv2.setText("取消拉黑后功能恢复正常"); tvTopUp.setText("确定"); tv2.setTextSize(14); tv1.setTextSize(16); tv1.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); tv2.setTypeface(Typeface.DEFAULT); tvCancel.setText("取消"); break; case 18: tv1.setText("取消连麦"); tv1.setTextSize(21); tv1.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); tv2.setText("是否取消与主播连麦?"); tv2.setTypeface(Typeface.DEFAULT); tv2.setTextSize(13); tv2.setTextColor(mContext.getResources().getColor(R.color.color_969696)); tvCancel.setText("取消"); tvTopUp.setText("确定"); tvCancel.setTextSize(13); tvTopUp.setTextSize(13); break; case 19: tv1.setText("关闭直播间"); tv2.setText("确定要关闭直播间吗?"); tvTopUp.setText("确认"); tv2.setTextSize(14); tv1.setTextSize(14); tv1.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); tv2.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); tvTopUp.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); tvCancel.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); tvCancel.setText("取消"); tvTopUp.setTextColor(context.getResources().getColor(R.color.color_FC5E8E)); break; } } protected void create(Bundle paramBundle) { setContentView(R.layout.dialog_live_room_balance); this.bind = ButterKnife.bind(this); setCanceledOnTouchOutside(true); this.mWidthScale = 0.95F; this.mDimAmount = 0.6F; this.h = 161; this.gravity = Gravity.CENTER; } protected void initView() { init(); } protected void onStart() { super.onStart(); getWindow().setLayout(ScreenUtils.dp2px(getContext(), 301), ScreenUtils.dp2px(getContext(), 145)); } @OnClick({R.id.tv_cancel, R.id.tv_top_up}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.tv_cancel: switch (type) { case 11: case 13: listener.onClick(-1); dismiss(); break; default: dismiss(); break; } break; case R.id.tv_top_up: if (listener != null) { listener.onClick(type); dismiss(); } break; } } public void setDialogClickListener(DialogReturnListener paramDialogReturnListener) { this.listener = paramDialogReturnListener; } public static interface DialogReturnListener { void onClick(int type); } }
package com.dayuanit.shop.Enum; import com.dayuanit.shop.exception.ShopException; public enum GoodsStatusEnum { GOODSUP(1, "商品上架"), GOODSDOWN(2, "商品下架"); private Integer code; private String value; public Integer getCode() { return code; } public String getValue() { return value; } private GoodsStatusEnum(Integer code, String value) { this.code = code; this.value = value; } public static GoodsStatusEnum getEnum(Integer code) { for (GoodsStatusEnum ofe : GoodsStatusEnum.values()) { if (code == ofe.getCode()) { return ofe; } } throw new ShopException("商品上架下架状态--未找到"); } }
package com.gtfs.controller; import java.io.Serializable; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class LoginController implements Serializable { @RequestMapping("/login") public String login(){ return "login"; } @RequestMapping("/dashboard") public String dashboard(){ return "dashboard"; } }
package interpreter.ast.nodes; import interpreter.Visitor; public class IntegerLiteral implements Expression { public String value; public IntegerLiteral(String value) { this.value = value; } @Override public Object accept(Visitor v, Object o) { // TODO Auto-generated method stub return v.visit(this, o); } }
package dino.command; import dino.exception.EmptyListException; import dino.task.TaskList; import dino.util.Storage; /** * Represents the command for which the user wants to view the list of tasks */ public class ListCommand extends Command { /** * Executes the command to display the task list to the user * * @param storage the local storage file * @param taskList the current task list to be displayed * @return the output message after execution */ @Override public String execute(Storage storage, TaskList taskList) { return taskList.printTaskList(); } }
package display; import java.awt.Graphics; import platform.Agent; import platform.PrintablePanel; /** * generic class of Panels that display informations about an agent * @author simon */ public class EnvPanel extends PrintablePanel{ private static final long serialVersionUID = 1L; protected Agent agent; public EnvPanel(Agent a){ super(); agent=a; } /** * change the agent */ public void setAgent(Agent a){ agent=a; } /** * print the displayed image in a pdf file */ public void drawPDF(Graphics g){ paintComponent(g); } public void paintComponent(Graphics g){ } }