Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Showing
with 1397 additions and 0 deletions
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 348.333 348.334" style="enable-background:new 0 0 348.333 348.334;" xml:space="preserve">
<g>
<path d="M336.559,68.611L231.016,174.165l105.543,105.549c15.699,15.705,15.699,41.145,0,56.85 c-7.844,7.844-18.128,11.769-28.407,11.769c-10.296,0-20.581-3.919-28.419-11.769L174.167,231.003L68.609,336.563 c-7.843,7.844-18.128,11.769-28.416,11.769c-10.285,0-20.563-3.919-28.413-11.769c-15.699-15.698-15.699-41.139,0-56.85 l105.54-105.549L11.774,68.611c-15.699-15.699-15.699-41.145,0-56.844c15.696-15.687,41.127-15.687,56.829,0l105.563,105.554 L279.721,11.767c15.705-15.687,41.139-15.687,56.832,0C352.258,27.466,352.258,52.912,336.559,68.611z" fill="#D80027"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18"><defs><style>.cls-1{fill:#ff7e00;}</style></defs><title>Asset 1</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M0,14.2V18H3.8l11-11.1L11,3.1ZM17.7,4a1,1,0,0,0,0-1.4L15.4.3A1,1,0,0,0,14,.3L12.2,2.1,16,5.9C15.9,5.9,17.7,4,17.7,4Z"/></g></g></svg>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFDA44;}
</style>
<g>
<g id="star">
<polygon class="st0" points="256,403.8 414.2,499.2 372.4,319.3 512,198.2 327.9,182.5 256,12.8 184.1,182.5 0,198.2 139.6,319.3
97.8,499.2 "/>
</g>
</g>
</svg>
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 510 510" style="enable-background:new 0 0 510 510;" xml:space="preserve">
<g>
<g id="star">
<polygon points="255,402.212 412.59,497.25 370.897,318.011 510,197.472 326.63,181.738 255,12.75 183.371,181.738 0,197.472 139.103,318.011 97.41,497.25 " fill="#c7c7c7"/>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 500 500" style="enable-background:new 0 0 500 500;" xml:space="preserve" width="512px" height="512px">
<g>
<path d="M250,0c14,0,24,10,24,24v94c0,14-10,25-24,25s-25-11-25-25V24C225,10,236,0,250,0z" fill="#FFDA44"/>
<path d="M137,53l55,76c12,16,0,39-20,39c-8,0-14-3-19-10L98,82c-8-11-6-26,5-34S129,42,137,53z" fill="#FFDA44"/>
<path d="M28,204c-13-4-20-18-16-31s18-20,31-16l89,29c13,4,20,18,16,31c-3,10-14,17-24,17c-3,0-4-1-7-2 L28,204z" fill="#FFDA44"/>
<path d="M148,283c4,13-3,27-16,31l-89,29c-3,1-5,1-8,1c-10,0-20-7-23-17c-4-13,3-27,16-31l89-29 C130,263,144,270,148,283z" fill="#FFDA44"/>
<path d="M187,337c11,8,13,23,5,34l-55,76c-5,7-12,10-20,10c-20,0-31-23-19-39l55-76C161,331,176,329,187,337 z" fill="#FFDA44"/>
<path d="M250,357c14,0,24,11,24,25v93c0,14-10,25-24,25s-25-11-25-25v-93C225,368,236,357,250,357z" fill="#FFDA44"/>
<path d="M347,342l55,76c12,16,0,39-20,39c-8,0-14-3-19-10l-55-76c-8-11-6-26,5-34S339,331,347,342z" fill="#FFDA44"/>
<path d="M472,296c13,4,20,18,16,31c-3,10-14,17-24,17c-3,0-4,0-7-1l-89-29c-13-4-20-18-16-31s18-20,31-16 L472,296z" fill="#FFDA44"/>
<path d="M352,217c-4-13,3-27,16-31l89-29c13-4,27,3,31,16s-3,27-16,31l-89,28c-3,1-5,2-8,2 C365,234,355,227,352,217z" fill="#FFDA44"/>
<path d="M327,168c-20,0-31-23-19-39l55-76c8-11,23-13,34-5s13,23,5,34l-55,76C342,165,335,168,327,168z" fill="#FFDA44"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
TugasBesar2_2017/WebApp/src/main/webapp/img/logo.png

20.9 KiB

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="114" height="114">
<path stroke="#000" stroke-width="7" fill="none" d="m7,20h98v72H7zl44,44q5,4 10,0l44-44M7,92l36-36m26,0 36,36"/>
</svg>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 -256 1792 1792"
id="svg3013"
version="1.1"
inkscape:version="0.48.3.1 r9886"
width="100%"
height="100%"
sodipodi:docname="phone_font_awesome.svg">
<metadata
id="metadata3023">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3021" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="640"
inkscape:window-height="480"
id="namedview3019"
showgrid="false"
inkscape:zoom="0.13169643"
inkscape:cx="896"
inkscape:cy="896"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-maximized="0"
inkscape:current-layer="svg3013" />
<g
transform="matrix(1,0,0,-1,159.45763,1293.0169)"
id="g3015">
<path
d="m 1408,296 q 0,-27 -10,-70.5 Q 1388,182 1377,157 1356,107 1255,51 1161,0 1069,0 1042,0 1016.5,3.5 991,7 959,16 927,25 911.5,30.5 896,36 856,51 816,66 807,69 709,104 632,152 504,231 367.5,367.5 231,504 152,632 104,709 69,807 66,816 51,856 36,896 30.5,911.5 25,927 16,959 7,991 3.5,1016.5 0,1042 0,1069 q 0,92 51,186 56,101 106,122 25,11 68.5,21 43.5,10 70.5,10 14,0 21,-3 18,-6 53,-76 11,-19 30,-54 19,-35 35,-63.5 16,-28.5 31,-53.5 3,-4 17.5,-25 14.5,-21 21.5,-35.5 7,-14.5 7,-28.5 0,-20 -28.5,-50 -28.5,-30 -62,-55 -33.5,-25 -62,-53 -28.5,-28 -28.5,-46 0,-9 5,-22.5 5,-13.5 8.5,-20.5 3.5,-7 14,-24 10.5,-17 11.5,-19 76,-137 174,-235 98,-98 235,-174 2,-1 19,-11.5 17,-10.5 24,-14 7,-3.5 20.5,-8.5 13.5,-5 22.5,-5 18,0 46,28.5 28,28.5 53,62 25,33.5 55,62 30,28.5 50,28.5 14,0 28.5,-7 14.5,-7 35.5,-21.5 21,-14.5 25,-17.5 25,-15 53.5,-31 28.5,-16 63.5,-35 35,-19 54,-30 70,-35 76,-53 3,-7 3,-21 z"
id="path3017"
inkscape:connector-curvature="0"
style="fill:currentColor" />
</g>
</svg>
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
viewBox="0 0 31.49 31.49" style="enable-background:new 0 0 31.49 31.49;" xml:space="preserve">
<path style="fill:#1E201D;" d="M21.205,5.007c-0.429-0.444-1.143-0.444-1.587,0c-0.429,0.429-0.429,1.143,0,1.571l8.047,8.047H1.111
C0.492,14.626,0,15.118,0,15.737c0,0.619,0.492,1.127,1.111,1.127h26.554l-8.047,8.032c-0.429,0.444-0.429,1.159,0,1.587
c0.444,0.444,1.159,0.444,1.587,0l9.952-9.952c0.444-0.429,0.444-1.143,0-1.571L21.205,5.007z"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
TugasBesar2_2017/WebApp/src/main/webapp/img/run.png

7.02 KiB

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 49 49" style="enable-background:new 0 0 49 49;" xml:space="preserve" width="512px" height="512px">
<g>
<rect x="27.5" y="5" width="6" height="10" fill="#0f3b99"/>
<path d="M39.914,0H0.5v49h48V8.586L39.914,0z M10.5,2h26v16h-26V2z M39.5,47h-31V26h31V47z" fill="#0f3b99"/>
<path d="M13.5,32h7c0.553,0,1-0.447,1-1s-0.447-1-1-1h-7c-0.553,0-1,0.447-1,1S12.947,32,13.5,32z" fill="#0f3b99"/>
<path d="M13.5,36h10c0.553,0,1-0.447,1-1s-0.447-1-1-1h-10c-0.553,0-1,0.447-1,1S12.947,36,13.5,36z" fill="#0f3b99"/>
<path d="M26.5,36c0.27,0,0.52-0.11,0.71-0.29c0.18-0.19,0.29-0.45,0.29-0.71s-0.11-0.521-0.29-0.71c-0.37-0.37-1.04-0.37-1.41,0 c-0.19,0.189-0.3,0.439-0.3,0.71c0,0.27,0.109,0.52,0.29,0.71C25.979,35.89,26.229,36,26.5,36z" fill="#0f3b99"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
<%--
Created by IntelliJ IDEA.
User: kennethhalim
Date: 11/2/17
Time: 6:46 PM
To change this template use File | Settings | File Templates.
--%>
<%
request.getRequestDispatcher("/index").forward(request,response);
%>
var ajaxFlag =false;
function sendRequest(url, method, data, callbackFunction) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if(this.readyState == 4 && this.status == 200) {
callbackFunction;
}
};
xhttp.open(method, url, true);
xhttp.send(data);
}
function callBackReload() {
location.reload();
}
function usernameAJAX() {
var status = document.getElementById("username-check-status");
status.innerHTML = "<div class='ajax-validator-loading'></div>";
var username = document.getElementById('username-form').value;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
if(validateUsername() && (xhttp.responseText)) {
status.innerHTML = "<div class='ajax-validator-ok'></div>";
ajaxFlag = true;
} else {
status.innerHTML = "<div class='ajax-validator-not-ok'></div>";
ajaxFlag = false;
}
} else {
status.innerHTML = "<div class='ajax-validator-not-ok'></div>";
ajaxFlag = false;
}
};
xhttp.open("GET", "app/username_check.php?username="+username, true);
xhttp.send();
}
function emailAJAX() {
var status = document.getElementById("email-check-status");
status.innerHTML = "<div class='ajax-validator-loading'></div>"
var email = document.getElementById('email-form').value;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
if(validateEmail() && xhttp.responseText) {
status.innerHTML = "<div class='ajax-validator-ok'></div>";
ajaxFlag = true;
} else {
status.innerHTML = "<div class='ajax-validator-not-ok'></div>";
ajaxFlag = false;
}
} else {
status.innerHTML = "<div class='ajax-validator-not-ok'></div>";
ajaxFlag = false;
}
};
xhttp.open("GET", "app/email_check.php?email="+email, true);
xhttp.send();
if (validateEmail() && (xhttp.responseText)) {
return true;
} else {
return false;
}
}
function addErrorText(element, errorText) {
var childs= element.getElementsByClassName('error-text');
if(!childs.length) {
element.innerHTML = element.innerHTML + "<span class=error-text>" + errorText + "</span>";
} else {
childs[0].innerHTML= errorText;
}
}
function deleteErrorText(element) {
var childs= element.getElementsByClassName('error-text');
if(childs.length) {
childs[0].innerHTML="";
}
}
function validateName() {
var input = document.getElementsByName('name')[0];
var str = input.value;
var parent = input.parentElement;
input.style.border = "1px solid #CC0000";
if(!str.length) {
addErrorText(parent, "Nama harus diisi");
return false;
} else if(str.length >20) {
addErrorText(parent, "Nama tidak boleh lebih dari 20 karakter");
return false;
}
input.style.border = "1px solid #00782d";
deleteErrorText(parent);
return true;
}
function validateUsername() {
var input = document.getElementsByName('username')[0];
var str = input.value;
var parent = input.parentElement;
if(!str.length) {
input.style.border = "1px solid #CC0000";
addErrorText(parent, "Username harus diisi")
return false;
}
input.style.border = "1px solid #00782d";
deleteErrorText(parent);
return true;
}
function validateEmail() {
var input = document.getElementsByName('email')[0];
var str = input.value;
var parent = input.parentElement;
input.style.border = "1px solid #CC0000";
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if(!str.length ) {
addErrorText(parent, "Email harus diisi")
return false;
} else if(!re.test(str)){
addErrorText(parent, "Email tidak sesuai format");
return false;
}
input.style.border = "1px solid #00782d";
deleteErrorText(parent);
return true;
}
function validatePassword() {
var input = document.getElementsByName('password')[0];
var confirm = document.getElementById('confirm-password');
var str1 = input.value;
var str2 = confirm.value;
var parent = input.parentElement;
var cparent = confirm.parentElement;
input.style.border = "1px solid #CC0000";
confirm.style.border = "1px solid #CC0000";
if(!str1.length) {
addErrorText(parent, "Password harus diisi");
return false;
} else if(!str2.length){
addErrorText(cparent, "Confirm Password harus diisi");
return false;
} else if(str1 != str2) {
addErrorText(cparent, "Confirm Password harus sama dengan Password");
return false;
}
input.style.border = "1px solid #00782d";
confirm.style.border = "1px solid #00782d";
deleteErrorText(parent);
return true;
}
function validatePhone() {
var input = document.getElementsByName('phoneNumber')[0];
var str = input.value;
var parent = input.parentElement;
input.style.border = "1px solid #CC0000";
if(!str.length) {
addErrorText(parent, "Phone Number harus diisi")
return false;
} else if(str.length < 9 && str.length >12 ) {
addErrorText(parent, "Phone Number harus antara 9-12 digit");
return false;
}
input.style.border = "1px solid #00782d";
deleteErrorText(parent);
return true;
}
function validateSignUpForm() {
var f=true;
f = !!validateEmail() && f;
f = !!validateName() && f;
f = !!validatePassword() && f;
f = !!validatePhone() && f;
f = !!validateUsername() && f;
f = f && ajaxFlag;
if(f)
return true;
else
return false;
}
function toggleActive(tagId) {
document.getElementById(tagId).classList.toggle("active");
}
function renderStar(rate) {
document.getElementById('rating-value').value = rate;
var parent = document.getElementById('rating-system');
var childs = parent.getElementsByTagName('span');
for(var i = 0;i<rate;i++) {
childs[i].className = 'gold-star';
}
for(var j = rate; j<5; j++) {
childs[j].className = 'grey-star';
}
}
function toggleEdit(id) {
button = document.getElementById("edit-button-"+id);
input = document.getElementById("edit-input-"+id);
newbutton = document.createElement("button");
newbutton.setAttribute("type","submit");
newbutton.setAttribute("form","form-update-"+id)
newbutton.classList.add("save-button");
//newbutton.setAttribute("onclick", "savePreferences("+id+")");
input.removeAttribute("disabled");
button.parentElement.appendChild(newbutton);
button.parentElement.removeChild(button);
}
function savePreferences(id) {
if(confirm("Are You Sure?")) {
input = document.getElementById("edit-input-"+id);
var data = {};
data.position = id;
data.location = input.value;
var payload = "position="+id+"&"+"location="+input.value;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if(this.status == 200 && this.readyState == 4) {
console.log(this.responseText)
//location.reload();
}
}
xhr.open("PUT","/preferred_location",true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send(payload);
} else {
}
}
function deletePreferences(id) {
if(confirm("Are You Sure?")) {
input = document.getElementById("edit-input-"+id);
var data = {};
data.position = id;
data.location = input.value;
var payload = "position="+id+"&"+"location="+input.value;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if(this.status == 200 && this.readyState == 4) {
console.log(this.responseText)
//location.reload();
}
}
xhr.open("DELETE","http://httpbin.org/put",true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send(payload);
} else {
}
}
function userHide(id) {
orderId = id;
var json = JSON.stringify(orderId);
sendRequest("app/user_hide_history.php", "PATCH", json, callBackReload());
}
function driverHide(id) {
orderId = id;
var json = JSON.stringify(orderId);
sendRequest("app/driver_hide_history.php", "PATCH", json, callBackReload());
}
function validateForm(form) {
inputs = form.querySelectorAll("input , textarea");
f=true;
for(i=0;i<inputs.length;i++) {
if(inputs[i].getAttribute("optional") == null) {
if(!inputs[i].value) {
f= false;
inputs[i].style.border = "1px solid #CC0000";
} else if(inputs[i].name == "phoneNumber") {
inputs[i].style.border = "1px solid #CC0000";
f= !isNaN(inputs[i].value)
}
else {
inputs[i].style.border = "1px solid #00782d";
}
} else {
inputs[i].style.border = "1px solid #00782d";
}
}
return f;
}
plugins {
id 'java'
id 'war'
id 'org.akhikhl.gretty'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':SharedLibrary')
// https://mvnrepository.com/artifact/junit/junit
testCompile 'junit:junit:4.12'
// https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api
providedCompile 'javax.servlet:javax.servlet-api:4.0.0'
// https://mvnrepository.com/artifact/com.google.code.gson/gson
compile 'com.google.code.gson:gson:2.8.2'
// https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-ri
gretty 'com.sun.xml.ws:jaxws-ri:2.3.0'
// https://mvnrepository.com/artifact/mysql/mysql-connector-java
gretty 'mysql:mysql-connector-java:8.0.8-dmr'
}
package com.adaapa.ojekservice;
import com.adaapa.ojekservice.handlers.DriverHandler;
import com.adaapa.ojekservice.handlers.OrderHandler;
import com.adaapa.ojekservice.handlers.ProfileHandler;
import com.google.gson.Gson;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
@SOAPBinding(style = SOAPBinding.Style.RPC)
@WebService()
public class OjekOnline {
private Gson gson = new Gson();
@WebMethod(operationName = "getProfile")
public String getProfile(@WebParam(name = "access_token") String access_token)
{
return ProfileHandler.doGetProfile(access_token);
}
@WebMethod
public String addUser(
@WebParam(name = "access_token") String access_token,
@WebParam(name = "user") String user) {
//Redone registering user here, without password but with isdriver status
return ProfileHandler.doAddUser(access_token, user);
}
@WebMethod
public String getDriverProfile(@WebParam(name = "access_token") String access_token) {
return DriverHandler.doGetDriverProfile(access_token);
}
@WebMethod(operationName = "getPreferredLocation")
public String getPreferredLocations(
@WebParam(name = "access_token") String access_token) {
return DriverHandler.doGetPreferredLocation(access_token);
}
@WebMethod
public String addPreferredLocation(
@WebParam(name = "access_token") String access_token,
@WebParam(name = "location") String location) {
return DriverHandler.doAddPreferredLocation(access_token, location);
}
@WebMethod
public String editProfile(
@WebParam(name = "access_token") String access_token,
@WebParam(name = "user") String user) {
return ProfileHandler.doEditProfile(access_token,user);
}
@WebMethod
public String findDriver (
@WebParam(name = "access_token") String access_token,
@WebParam(name = "driver_name") String driver_name) {
return OrderHandler.doFindDriver(access_token, driver_name);
}
@WebMethod
public String findDriverByPreferredLocation (
@WebParam(name ="access_token") String access_token,
@WebParam(name = "pickup") String pickup,
@WebParam(name = "destination") String destination){
return OrderHandler.doFindDriverByPreferredLocation(access_token, pickup, destination);
}
@WebMethod
public String completeOrder(
@WebParam(name = "access_token") String access_token,
@WebParam(name = "order") String order) {
return OrderHandler.doCompleteOrder(access_token, order);
}
@WebMethod
public String getUserHistory(
@WebParam(name = "access_token") String access_token
) {
return OrderHandler.doGetUserHistory(access_token);
}
@WebMethod
public String getDriverHistory(
@WebParam(name = "access_token") String access_token
) {
return OrderHandler.doGetDriverHistory(access_token);
}
@WebMethod
public String hideDriverHistory(
@WebParam(name = "access_token") String access_token,
@WebParam(name = "order_id") Integer order_id) {
return OrderHandler.doDriverHideHistory(access_token, order_id);
}
@WebMethod
public String hideUserHistory(
@WebParam(name = "access_token") String access_token,
@WebParam(name = "order_id") Integer order_id) {
return OrderHandler.doUserHideHistory(access_token, order_id);
}
@WebMethod
public String deletePreferredLocation(
@WebParam(name = "access_token") String access_token,
@WebParam(name = "position") Integer position
) {
return DriverHandler.doDeletePreferredLocation(access_token,position);
}
@WebMethod
public String editPreferredLocation(
@WebParam(name = "access_token") String access_token,
@WebParam(name = "position") Integer position,
@WebParam(name = "location") String location
) {
return DriverHandler.doUpdatePreferredLocation(access_token, position, location);
}
@WebMethod
public String findDriverByUsername(String access_token, String username) {
return DriverHandler.doFindDriverByUsername(access_token, username);
}
}
package com.adaapa.ojekservice.handlers;
import com.adaapa.bean.DriverBean;
import com.adaapa.bean.PreferredLocationBean;
import com.adaapa.bean.UserBean;
import com.adaapa.bean.WebServiceBean;
import com.adaapa.ojekservice.models.DriverModel;
import com.adaapa.ojekservice.models.UserModel;
import com.adaapa.ojekservice.services.TokenVerificationService;
import com.google.gson.Gson;
import java.sql.ResultSet;
import java.util.ArrayList;
public class DriverHandler {
public static String doGetPreferredLocation(String access_token) {
try {
WebServiceBean response = new WebServiceBean();
UserModel userModel = new UserModel();
UserBean validUser = TokenVerificationService.verifyToken(access_token);
if(validUser != null) {
DriverModel driverModel = new DriverModel();
ArrayList<PreferredLocationBean> preferredLocationArray = driverModel.findPreferredLocation(validUser.getUsername());
response.setStatus(WebServiceBean.STATUS_VALID);
response.setBody(new Gson().toJson(preferredLocationArray));
} else {
response.setStatus(WebServiceBean.STATUS_INVALID);
}
return new Gson().toJson(response);
}catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String doGetDriverProfile(String access_token) {
try {
WebServiceBean response = new WebServiceBean();
UserModel userModel = new UserModel();
UserBean validUser = TokenVerificationService.verifyToken(access_token);
if(validUser != null) {
DriverModel driverModel = new DriverModel();
DriverBean driverBean = new DriverBean();
driverBean.setVote(driverModel.countVote(validUser.username));
driverBean.setName(validUser.getName());
driverBean.setRating(driverModel.calculateRating(validUser.username));
response.setStatus(WebServiceBean.STATUS_VALID);
response.setBody(new Gson().toJson(driverBean));
} else {
response.setStatus(WebServiceBean.STATUS_INVALID);
}
return new Gson().toJson(response);
}catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String doAddPreferredLocation(String access_token, String location) {
try {
WebServiceBean response = new WebServiceBean();
UserBean validUser = TokenVerificationService.verifyToken(access_token);
if(validUser == null) {
response.setStatus(WebServiceBean.STATUS_INVALID);
} else {
response.setStatus(WebServiceBean.STATUS_VALID);
UserModel userModel = new UserModel();
DriverModel driverModel = new DriverModel();
UserBean wsUser = userModel.findUserByUsername(validUser.username);
ResultSet rs = driverModel.query(String.format("SELECT MAX(position) as max FROM preferred_locations WHERE id= %d",wsUser.getId()));
int curr = rs.next() ? rs.getInt("max") + 1 : 1;
driverModel.queryUpdate(
String.format("INSERT INTO preferred_locations VALUES (%d,%d,'%s')",
wsUser.getId(), curr,location));
}
return new Gson().toJson(response);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static String doDeletePreferredLocation(String access_token, Integer position) {
try {
WebServiceBean response = new WebServiceBean();
UserBean validUser = TokenVerificationService.verifyToken(access_token);
if(validUser == null) {
response.setStatus(WebServiceBean.STATUS_INVALID);
} else {
response.setStatus(WebServiceBean.STATUS_VALID);
UserModel userModel = new UserModel();
DriverModel driverModel = new DriverModel();
UserBean wsUser = userModel.findUserByUsername(validUser.getUsername());
ResultSet rs = driverModel.queryUpdate(String.format(
"DELETE FROM preferred_locations WHERE id=%d and position=%d",
wsUser.getId(),position
));
}
return new Gson().toJson(response);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static String doUpdatePreferredLocation(String access_token, Integer position, String location) {
try {
WebServiceBean response = new WebServiceBean();
UserBean validUser = TokenVerificationService.verifyToken(access_token);
if(validUser == null) {
response.setStatus(WebServiceBean.STATUS_INVALID);
} else {
response.setStatus(WebServiceBean.STATUS_VALID);
UserModel userModel = new UserModel();
DriverModel driverModel = new DriverModel();
UserBean wsUser = userModel.findUserByUsername(validUser.getUsername());
ResultSet rs = driverModel.queryUpdate(String.format(
"UPDATE preferred_locations SET location = '%s' WHERE id=%d AND position=%d",
location,wsUser.getId(),position
));
}
return new Gson().toJson(response);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static String doFindDriverByUsername(String access_token, String username) {
try {
UserBean validUser = TokenVerificationService.verifyToken(access_token);
Gson gson = new Gson();
WebServiceBean response = new WebServiceBean();
if(validUser != null) {
response.setStatus(WebServiceBean.STATUS_VALID);
response.setBody(gson.toJson(new UserModel().findUserByUsername(username)));
} else {
response.setStatus(WebServiceBean.STATUS_INVALID);
}
return gson.toJson(response);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
package com.adaapa.ojekservice.handlers;
import com.adaapa.bean.DriverBean;
import com.adaapa.bean.OrderBean;
import com.adaapa.bean.UserBean;
import com.adaapa.bean.WebServiceBean;
import com.adaapa.ojekservice.models.DriverModel;
import com.adaapa.ojekservice.models.UserModel;
import com.adaapa.ojekservice.services.TokenVerificationService;
import com.google.gson.Gson;
import java.util.ArrayList;
/**
* Created by ireneedriadr on 11/5/17.
*/
public class OrderHandler {
public static String doGetUserHistory(String access_token) {
try {
WebServiceBean response = new WebServiceBean();
UserModel userModel = new UserModel();
UserBean validUser = TokenVerificationService.verifyToken(access_token);
if(validUser != null) {
ArrayList<OrderBean> userHistoryArray = userModel.findPrevOrder(userModel.findOrderByUsername(validUser.getUsername()));
response.setStatus(WebServiceBean.STATUS_VALID);
response.setBody(new Gson().toJson(userHistoryArray));
} else {
response.setStatus(WebServiceBean.STATUS_INVALID);
}
return new Gson().toJson(response);
}catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String doFindDriver(String access_token, String driver_name){
try {
Gson gson = new Gson();
WebServiceBean webServiceBean = new WebServiceBean();
UserBean validUser = TokenVerificationService.verifyToken(access_token);
if (validUser == null) {
webServiceBean.setStatus(WebServiceBean.STATUS_INVALID);
return gson.toJson(webServiceBean);
} else {
webServiceBean.setStatus(WebServiceBean.STATUS_VALID);
UserModel userModel = new UserModel();
DriverModel driverModel = new DriverModel();
ArrayList<DriverBean> driverBeans = driverModel.findDriverByName(validUser.getUsername(),driver_name);
webServiceBean.setBody(gson.toJson(driverBeans));
return gson.toJson(webServiceBean);
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String doGetDriverHistory(String access_token) {
try {
WebServiceBean response = new WebServiceBean();
UserModel userModel = new UserModel();
UserBean validUser = TokenVerificationService.verifyToken(access_token);
if(validUser != null) {
ArrayList<OrderBean> userHistoryArray = userModel.findPrevDriverOrder(userModel.findOrderByUsername(validUser.getUsername()));
response.setStatus(WebServiceBean.STATUS_VALID);
response.setBody(new Gson().toJson(userHistoryArray));
} else {
response.setStatus(WebServiceBean.STATUS_INVALID);
}
return new Gson().toJson(response);
}catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String doFindDriverByPreferredLocation(String access_token, String pickup, String destination){
try {
Gson gson = new Gson();
WebServiceBean webServiceBean = new WebServiceBean();
UserBean validUser = TokenVerificationService.verifyToken(access_token);
if (validUser == null) {
webServiceBean.setStatus(WebServiceBean.STATUS_INVALID);
return gson.toJson(webServiceBean);
} else {
webServiceBean.setStatus(WebServiceBean.STATUS_VALID);
UserModel userModel = new UserModel();
DriverModel driverModel = new DriverModel();
ArrayList<DriverBean> driverBeans = driverModel.findDriverByPreferredLocation(validUser.getUsername(), pickup, destination);
webServiceBean.setBody(gson.toJson(driverBeans));
return gson.toJson(webServiceBean);
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String doCompleteOrder(String access_token, String order) {
try{
Gson gson = new Gson();
WebServiceBean webServiceBean = new WebServiceBean();
UserBean validUser = TokenVerificationService.verifyToken(access_token);
if (validUser == null) {
webServiceBean.setStatus(WebServiceBean.STATUS_INVALID);
} else {
webServiceBean.setStatus(WebServiceBean.STATUS_VALID);
OrderBean orderBean = gson.fromJson(order, OrderBean.class);
DriverModel driverModel = new DriverModel();
driverModel.queryUpdate(String.format(
"INSERT INTO orders (user_id,driver_id,pickup,destination,rating,comment) VALUES"
+ "(%d,%d,'%s','%s','%d','%s')",
validUser.getId(),orderBean.getDriverId(),orderBean.getPickup(),orderBean.getDestination(),
orderBean.getRating().intValue(), orderBean.getComment()
));
}
return gson.toJson(webServiceBean);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String doUserHideHistory(String access_token, Integer orderId) {
try{
Gson gson = new Gson();
WebServiceBean webServiceBean = new WebServiceBean();
UserBean validUser = TokenVerificationService.verifyToken(access_token);
if (validUser == null) {
webServiceBean.setStatus(WebServiceBean.STATUS_INVALID);
} else {
webServiceBean.setStatus(WebServiceBean.STATUS_VALID);
UserModel userModel = new UserModel();
userModel.queryUpdate(String.format("UPDATE orders SET user_hidden=1 WHERE id=%d",orderId));
}
return gson.toJson(webServiceBean);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String doDriverHideHistory(String access_token, Integer orderId) {
try{
Gson gson = new Gson();
WebServiceBean webServiceBean = new WebServiceBean();
UserBean validUser = TokenVerificationService.verifyToken(access_token);
if (validUser == null) {
webServiceBean.setStatus(WebServiceBean.STATUS_INVALID);
} else {
webServiceBean.setStatus(WebServiceBean.STATUS_VALID);
UserModel userModel = new UserModel();
userModel.queryUpdate(String.format("UPDATE orders SET driver_hidden=1 WHERE id=%d",orderId));
}
return gson.toJson(webServiceBean);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
package com.adaapa.ojekservice.handlers;
import com.adaapa.bean.UserBean;
import com.adaapa.bean.WebServiceBean;
import com.adaapa.ojekservice.models.UserModel;
import com.adaapa.ojekservice.services.TokenVerificationService;
import com.google.gson.Gson;
public class ProfileHandler {
static Gson gson = new Gson();
public static String doGetProfile(String access_token){
try {
WebServiceBean webServiceBean = new WebServiceBean();
UserBean resUser = TokenVerificationService.verifyToken(access_token);
if (resUser == null) {
webServiceBean.setStatus(WebServiceBean.STATUS_INVALID);
return gson.toJson(webServiceBean);
} else {
webServiceBean.setStatus(WebServiceBean.STATUS_VALID);
UserModel userModel = new UserModel();
UserBean user = userModel.findUserByUsername(resUser.getUsername());
if (user == null) {
resUser.isDriver = false;
userModel.saveUser(resUser);
webServiceBean.setBody(gson.toJson(resUser));
} else {
webServiceBean.setBody(gson.toJson(user));
}
return gson.toJson(webServiceBean);
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String doEditProfile(String access_token, String user) {
try {
WebServiceBean webServiceBean = new WebServiceBean();
UserBean resUser = TokenVerificationService.verifyToken(access_token);
if (resUser == null) {
webServiceBean.setStatus(WebServiceBean.STATUS_INVALID);
} else {
UserBean userBean = gson.fromJson(user, UserBean.class);
userBean.username = resUser.username;
UserModel userModel = new UserModel();
userModel.updateUser(userBean);
webServiceBean.setStatus(WebServiceBean.STATUS_VALID);
}
return gson.toJson(webServiceBean);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String doAddUser(String access_token, String user) {
try {
WebServiceBean webServiceBean = new WebServiceBean();
UserBean validUser = TokenVerificationService.verifyToken(access_token);
if (validUser == null) {
webServiceBean.setStatus(WebServiceBean.STATUS_INVALID);
} else {
UserBean userBean = gson.fromJson(user, UserBean.class);
UserModel userModel = new UserModel();
userModel.saveUser(userBean);
webServiceBean.setStatus(WebServiceBean.STATUS_VALID);
}
return gson.toJson(webServiceBean);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
package com.adaapa.ojekservice.models;
import com.adaapa.bean.DriverBean;
import com.adaapa.bean.PreferredLocationBean;
import com.adaapa.models.BaseModel;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Base64;
public class DriverModel extends BaseModel {
public static String ORDER_TABLE = "orders";
public static String USER_TABLE = "users";
public static String PREFERRED_TABLE = "preferred_locations";
public DriverModel() {
super("users","id");
}
public Integer countVote(String username) {
try {
ResultSet rs = query(String.format(
"SELECT COUNT(rating) as vote FROM %s inner join %s on (%s.driver_id = %s.id) where users.username = '%s'",
ORDER_TABLE, USER_TABLE, ORDER_TABLE, USER_TABLE, username));
if(rs.next()) {
return rs.getInt("vote");
} else {
return 0;
}
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
public DriverBean parseDriverBean(ResultSet resultSet) throws SQLException {
String username = resultSet.getString("username");
DriverBean driverBean = new DriverBean();
driverBean.setRating(calculateRating(username));
driverBean.setName(resultSet.getString("name"));
driverBean.setVote(countVote(username));
driverBean.setId(resultSet.getInt("id"));
driverBean.setUsername(username);
try {
driverBean.setImage("data:image/jpeg;charset=utf-8;base64,"+ Base64.getEncoder().encodeToString(resultSet.getBytes("image")));
} catch (Exception e){
System.out.println("User has no profile image");
}
return driverBean;
}
public Double calculateRating (String username) {
try {
ResultSet rs = query(String.format(
"SELECT AVG(rating) as rating FROM %s inner join %s on (%s.driver_id = %s.id) where users.username = '%s'",
ORDER_TABLE, USER_TABLE, ORDER_TABLE, USER_TABLE, username));
if(rs.next()) {
return rs.getDouble("rating");
} else {
return 0.0;
}
} catch (Exception e) {
e.printStackTrace();
return 0.0;
}
}
public ArrayList<PreferredLocationBean> findPreferredLocation (String username ) {
ArrayList<PreferredLocationBean> preferredLocationBeanArray = new ArrayList<>();
try {
ResultSet rs = query(String.format(
"SELECT position,location FROM %s NATURAL JOIN %s WHERE users.username = '%s'",
PREFERRED_TABLE,USER_TABLE, username
));
while (rs.next()) {
PreferredLocationBean preferredLocationBean = new PreferredLocationBean();
preferredLocationBean.setLocation(rs.getString("location"));
preferredLocationBean.setPosition(rs.getInt("position"));
preferredLocationBeanArray.add(preferredLocationBean);
}
return preferredLocationBeanArray;
} catch (Exception e) {
e.printStackTrace();
return preferredLocationBeanArray;
}
}
public ArrayList<DriverBean> findDriverByName(String username, String name) {
ResultSet resultSet = null;
ArrayList<DriverBean> driverBeans = new ArrayList<>();
int i = 0;
try {
resultSet = query("SELECT * FROM users WHERE username != '"+username+"' AND name LIKE '%"+name+"%' and is_driver=1");
while (resultSet.next()) {
driverBeans.add(parseDriverBean(resultSet));
}
} catch (Exception e) {
e.printStackTrace();
}
return driverBeans;
}
public ArrayList<DriverBean> findDriverByPreferredLocation(String username, String pickup, String destination) {
ResultSet resultSet = null;
ArrayList<DriverBean> driverBeans = new ArrayList<>();
int i = 0;
try {
resultSet = query(String.format(
"SELECT DISTINCT users.name, users.username, users.id, users.image "
+ "FROM users NATURAL JOIN preferred_locations WHERE username!= '%s' and (location='%s' or location='%s')",
username,pickup,destination
));
while (resultSet.next()) {
driverBeans.add(parseDriverBean(resultSet));
}
} catch (Exception e) {
e.printStackTrace();
}
return driverBeans;
}
}
package com.adaapa.ojekservice.models;
import com.adaapa.bean.OrderBean;
import com.adaapa.bean.UserBean;
import com.adaapa.models.BaseModel;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Base64;
public class UserModel extends BaseModel{
public UserModel(){
super("users","id");
}
public UserBean parseUserBean(ResultSet resultSet)throws SQLException {
UserBean ubean = new UserBean();
ubean.id = resultSet.getInt("id");
ubean.email = resultSet.getString("email");
ubean.phoneNumber = resultSet.getString("phone");
ubean.name = resultSet.getString("name");
ubean.isDriver = resultSet.getBoolean("is_driver");
ubean.username = resultSet.getString("username");
try {
ubean.image = "data:image/jpeg;charset=utf-8;base64,"+Base64.getEncoder().encodeToString(resultSet.getBytes("image"));
} catch (Exception e) {
System.out.println("User has no image");
}
return ubean;
}
public OrderBean parseUserOrder(ResultSet resultSet)throws SQLException {
OrderBean obean = new OrderBean();
obean.setId(resultSet.getInt("id"));
obean.setUserId(resultSet.getInt("user_id"));
obean.setDriverId(resultSet.getInt("driver_id"));
obean.setPickup(resultSet.getString("pickup"));
obean.setDestination(resultSet.getString("destination"));
obean.setRating(resultSet.getDouble("rating"));
obean.setComment(resultSet.getString("comment"));
obean.setName(resultSet.getString("name"));
obean.setTimestamp(resultSet.getTimestamp("timestamp"));
try {
obean.setImage("data:image/jpeg;charset=utf-8;base64,"+Base64.getEncoder().encodeToString(resultSet.getBytes("image")));
} catch (Exception e) {
System.out.println("User has no image");
}
return obean;
}
public UserBean findUserByUsername(String username) {
UserBean userBean = null;
ResultSet resultSet = null;
try {
resultSet = query(String.format("SELECT * FROM %s WHERE username='%s'", tableName, username));
if(resultSet.next()) {
userBean = parseUserBean(resultSet);
}
} catch (Exception e) {
e.printStackTrace();
}
return userBean;
}
public OrderBean findOrderByUsername(String username) {
OrderBean orderBean = null;
ResultSet resultSet = null;
try {
resultSet = query(String.format(
"SELECT * FROM orders JOIN users ON users.id = orders.driver_id WHERE username='%s'",
username));
if (resultSet.next()) {
orderBean = parseUserOrder(resultSet);
}
} catch (Exception e) {
e.printStackTrace();
}
return orderBean;
}
public Boolean saveUser(UserBean userBean) {
ResultSet resultSet = null;
try {
resultSet = queryUpdate(String.format(
"INSERT INTO %s (name,email,phone,username,is_driver)"
+ "VALUES ('%s','%s','%s','%s','%d')",
tableName,userBean.name,userBean.email,userBean.phoneNumber,userBean.username,userBean.isDriver ? 1 : 0
));
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public void updateImage(String username, String image) throws SQLException {
PreparedStatement statement = db
.prepareStatement("UPDATE users SET image=? WHERE username = ?");
statement.setBytes(1, Base64.getDecoder().decode(image));
statement.setString(2,username);
statement.executeUpdate();
}
public void updateUser(UserBean updatedUser) {
try {
PreparedStatement statement = db
.prepareStatement("UPDATE users SET name=?, phone=?,is_driver=? WHERE username = ?");
statement.setString(1, updatedUser.getName());
statement.setString(2, updatedUser.phoneNumber);
statement.setBoolean(3,updatedUser.isDriver);
statement.setString(4, updatedUser.getUsername());
statement.executeUpdate();
if(updatedUser.getImage() != null) {
updateImage(updatedUser.username, updatedUser.image);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public ArrayList<OrderBean> findPrevOrder(OrderBean driver) {
ArrayList<OrderBean> res = new ArrayList<>();
try {
ResultSet rs = query(String.format("SELECT * FROM orders JOIN users ON users.id = orders.driver_id WHERE user_id = '%s' and not user_hidden ORDER BY timestamp desc",driver.getDriverId()));
while (rs.next()) {
res.add(parseUserOrder(rs));
}
} catch (Exception e) {
e.printStackTrace();
}
return res;
}
public ArrayList<OrderBean> findPrevDriverOrder(OrderBean driver) {
ArrayList<OrderBean> res = new ArrayList<>();
try {
ResultSet rs = query(String.format("SELECT * FROM orders JOIN users ON users.id = orders.user_id WHERE driver_id = '%s' and not driver_hidden ORDER BY timestamp desc",driver.getDriverId()));
while (rs.next()) {
res.add(parseUserOrder(rs));
}
} catch (Exception e) {
e.printStackTrace();
}
return res;
}
}