Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Daniels project
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Daniel Quadras
Daniels project
Commits
084e4f9f
Commit
084e4f9f
authored
Aug 28, 2023
by
daniel.quadras@proteustech.in
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Subs renew changes
parent
3bcaeb3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
952 additions
and
0 deletions
+952
-0
Daniel Directory_SubscriptionRenewalIC__1_.java
Daniel Directory_SubscriptionRenewalIC__1_.java
+952
-0
No files found.
Daniel Directory_SubscriptionRenewalIC__1_.java
0 → 100644
View file @
084e4f9f
package
ibase
.
webitm
.
ejb
.
sys
;
import
java.rmi.RemoteException
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
ibase.utility.BaseLogger
;
import
ibase.utility.E12GenericUtility
;
import
ibase.webitm.ejb.ValidatorEJB
;
import
ibase.webitm.utility.ITMException
;
public
class
SubscriptionRenewalIC
extends
ValidatorEJB
{
E12GenericUtility
genereicutility
=
new
E12GenericUtility
();
public
String
itemChanged
(
String
xmlString
,
String
xmlString1
,
String
xmlString2
,
String
objContext
,
String
currentColumn
,
String
editFlag
,
String
xtraParams
)
throws
RemoteException
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
" inside itemchange domparsing method"
);
org
.
w3c
.
dom
.
Document
dom
=
null
;
org
.
w3c
.
dom
.
Document
dom1
=
null
;
org
.
w3c
.
dom
.
Document
dom2
=
null
;
String
errString
=
null
;
String
valueXmlString
=
""
;
try
{
if
(
xmlString
!=
null
&&
xmlString
.
trim
().
length
()
!=
0
)
{
dom
=
genereicutility
.
parseString
(
xmlString
);
}
if
(
xmlString1
!=
null
&&
xmlString1
.
trim
().
length
()
!=
0
)
{
dom1
=
genereicutility
.
parseString
(
xmlString1
);
}
if
(
xmlString2
!=
null
&&
xmlString2
.
trim
().
length
()
!=
0
)
{
dom2
=
genereicutility
.
parseString
(
xmlString2
);
}
valueXmlString
=
itemChanged
(
dom
,
dom1
,
dom2
,
objContext
,
currentColumn
,
editFlag
,
xtraParams
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" ErrString :"
+
valueXmlString
);
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
" Exception :SfaTime :itemChanged(String,String):"
+
e
.
getMessage
());
valueXmlString
=
genereicutility
.
createErrorString
(
e
);
}
BaseLogger
.
log
(
"3"
,
null
,
null
,
"returning from SfaTime itemChanged"
);
return
valueXmlString
;
}
public
String
itemChanged
(
org
.
w3c
.
dom
.
Document
dom
,
org
.
w3c
.
dom
.
Document
dom1
,
org
.
w3c
.
dom
.
Document
dom2
,
String
objContext
,
String
currentColumn
,
String
editFlag
,
String
xtraParams
)
throws
RemoteException
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
" Inside itemchange"
);
Connection
con
=
null
;
SimpleDateFormat
sdf
,
simpledateformat
;
int
currentFormNo
=
0
,
chrg_amtValues
=
0
;
String
tranId
=
""
,
newDateString
=
""
,
user_lic_type
=
""
,
enterprise
=
""
,
getValidUptoString
=
""
,
valid_upto
=
""
,
valid_upto_date
=
""
,
sql
=
""
,
sql3
=
""
,
sql4
=
""
,
renewPeriodLowerCase
=
""
,
enterprisesql
=
""
,
validuptostring
=
""
,
validupto
=
""
,
sql2
=
""
,
renewPeriod
=
""
,
enterpriseLowerCse
=
""
,
validuptoDateString
=
""
,
demoDate
=
"11-AUG-23"
;
List
<
String
>
enterprisesqllist
=
new
ArrayList
<>();
List
<
String
>
userLicenseTypelist
=
new
ArrayList
<>();
PreparedStatement
pstmt
=
null
,
pstmt2
=
null
,
pstmt3
=
null
,
pstmt4
=
null
;
int
chrg_amt
,
chrg_amtTotal
=
0
,
users_count
=
0
;
ResultSet
rs
=
null
,
rs2
=
null
,
rs3
=
null
,
rs4
=
null
;
Date
validuptoDate
=
null
;
StringBuffer
valueXmlString
=
new
StringBuffer
();
try
{
Calendar
currentDate
=
Calendar
.
getInstance
();
simpledateformat
=
new
SimpleDateFormat
(
genereicutility
.
getApplDateFormat
());
String
sysDate
=
simpledateformat
.
format
(
currentDate
.
getTime
());
Date
datee
=
Calendar
.
getInstance
().
getTime
();
Date
date
=
new
Date
();
con
=
getConnection
();
String
currentdate
=
simpledateformat
.
format
(
date
);
List
<
Integer
>
chrg_amountlist
=
new
ArrayList
<>();
Date
currentDatee
=
new
Date
();
String
currntDate
=
simpledateformat
.
format
(
currentDatee
);
if
(
objContext
!=
null
&&
objContext
.
trim
().
length
()
>
0
)
{
currentFormNo
=
Integer
.
parseInt
(
objContext
);
}
valueXmlString
=
new
StringBuffer
(
"<?xml version=\"1.0\"?><Root><header><editFlag>"
);
valueXmlString
.
append
(
editFlag
).
append
(
"</editFlag></header>"
);
switch
(
currentFormNo
)
{
case
1
:
valueXmlString
.
append
(
"<Detail1>"
);
if
(
currentColumn
.
trim
().
equalsIgnoreCase
(
"itm_default"
))
{
String
enterpriseDb
=
""
;
sql
=
"select enterprise from users where code = ?"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
userId
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
enterpriseDb
=
checkNull
(
rs
.
getString
(
"enterprise"
));
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
BaseLogger
.
log
(
"3"
,
null
,
null
,
"inside itm_default"
);
tranId
=
checkNull
(
genereicutility
.
getColumnValue
(
"tran_id"
,
dom
));
valueXmlString
.
append
(
"<enterprise><![CDATA["
).
append
(
enterpriseDb
).
append
(
"]]></enterprise>\r\n"
);
valueXmlString
.
append
(
"<tran_date><![CDATA["
).
append
(
sysDate
).
append
(
"]]></tran_date>\r\n"
);
valueXmlString
.
append
(
"<tran_id><![CDATA["
).
append
(
tranId
).
append
(
"]]></tran_id>\r\n"
);
}
else
if
(
"itm_defaultedit"
.
equalsIgnoreCase
(
currentColumn
.
trim
()))
{
}
else
if
(
"enterprise"
.
equalsIgnoreCase
(
currentColumn
.
trim
()))
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
" inside enterprise.equalsignorecase(correctcolumn.trim)"
);
enterprise
=
checkNull
(
genereicutility
.
getColumnValue
(
"enterprise"
,
dom
));
BaseLogger
.
log
(
"3"
,
null
,
null
,
" enterprise value"
+
enterprise
);
sql
=
"select enterprise from entp_subs_renew"
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
"sql to get enterprise from entp_subs_renew"
+
sql
);
pstmt
=
con
.
prepareStatement
(
sql
);
rs
=
pstmt
.
executeQuery
();
while
(
rs
.
next
())
{
enterprisesql
=
rs
.
getString
(
"enterprise"
);
enterprisesqllist
.
add
(
enterprisesql
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" enterprisesql"
+
enterprisesql
);
}
BaseLogger
.
log
(
"3"
,
null
,
null
,
" enterprisesqllist outside while "
+
enterprisesqllist
);
rs
.
close
();
rs
=
null
;
pstmt
.
close
();
pstmt
=
null
;
if
(
enterprisesqllist
.
contains
(
enterprise
))
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
" enterprisesql.contains(enterprise)"
);
// sql2 = "select max(valid_upto) from entp_subs_renew where enterprise = '"+enterprise+"' ";
// BaseLogger.log("3", null, null, "sql for max(validupto) "+sql2 );
// pstmt2 = con.prepareStatement(sql2);
// rs2 = pstmt2.executeQuery();
//
// if(rs2.next()) {
//
// validuptoDate = rs2.getDate("max(valid_upto)");
// BaseLogger.log("3", null, null, " validupto"+validuptoDate );
//
// }
// rs2.close();
// rs2 = null;
// pstmt2.close();
// pstmt2 = null;
validuptoDate
=
getValidUpto
(
enterprise
);
validuptostring
=
simpledateformat
.
format
(
validuptoDate
);
// validuptostring = getValidUpto(enterprise);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" validuptostring"
+
validuptostring
);
renewPeriod
=
checkNull
(
genereicutility
.
getColumnValue
(
"renew_prd"
,
dom
));
BaseLogger
.
log
(
"3"
,
null
,
null
,
" renewperiod"
+
renewPeriod
);
if
(
renewPeriod
.
contains
(
"Y"
))
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
" inside renewperiod.contains(Y)"
);
int
monthyearvalue
=
getMOnthOrYearVAlue
(
renewPeriod
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" getMOnthOrYearVAlue returning value "
+
monthyearvalue
);
Date
dt
=
simpledateformat
.
parse
(
validuptostring
);
currentDate
.
setTime
(
dt
);
currentDate
.
add
(
Calendar
.
YEAR
,
monthyearvalue
);
Date
newdate
=
currentDate
.
getTime
();
newDateString
=
simpledateformat
.
format
(
newdate
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" newdatestring "
+
newDateString
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" validuptostring inside renewperiod.contains(Y) "
+
validuptostring
);
}
else
if
(
renewPeriod
.
contains
(
"M"
))
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
" inside renewperiod.contains(M)"
);
int
monthyearvalue
=
getMOnthOrYearVAlue
(
renewPeriod
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" getMOnthOrYearVAlue returning value "
+
monthyearvalue
);
Date
dt
=
simpledateformat
.
parse
(
validuptostring
);
currentDate
.
setTime
(
dt
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" below currendate.settime in else if condition "
+
newDateString
);
currentDate
.
add
(
Calendar
.
MONTH
,
monthyearvalue
);
Date
newdate
=
currentDate
.
getTime
();
newDateString
=
simpledateformat
.
format
(
newdate
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" newdatestring IN ELSE IF "
+
newDateString
);
}
}
else
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"inside else condition "
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" currendate "
+
currntDate
);
renewPeriod
=
checkNull
(
genereicutility
.
getColumnValue
(
"renew_prd"
,
dom
));
BaseLogger
.
log
(
"3"
,
null
,
null
,
" renewperiod"
+
renewPeriod
);
if
(
renewPeriod
.
contains
(
"Y"
))
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
" inside renewperiod.contains(Y) in else condition"
);
int
monthyearvalue
=
getMOnthOrYearVAlue
(
renewPeriod
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" getMOnthOrYearVAlue returning value "
+
monthyearvalue
);
Date
dt
=
simpledateformat
.
parse
(
currntDate
);
currentDate
.
setTime
(
dt
);
currentDate
.
add
(
Calendar
.
YEAR
,
monthyearvalue
);
Date
newdate
=
currentDate
.
getTime
();
newDateString
=
simpledateformat
.
format
(
newdate
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" newdatestring "
+
newDateString
);
}
else
if
(
renewPeriod
.
contains
(
"M"
))
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
" inside renewperiod.contains(M) in else condition"
);
int
monthyearvalue
=
getMOnthOrYearVAlue
(
renewPeriod
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" getMOnthOrYearVAlue returning value "
+
monthyearvalue
);
Date
dt
=
simpledateformat
.
parse
(
currntDate
);
currentDate
.
setTime
(
dt
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" below currendate.settime in else if condition "
+
newDateString
);
currentDate
.
add
(
Calendar
.
MONTH
,
monthyearvalue
);
Date
newdate
=
currentDate
.
getTime
();
newDateString
=
simpledateformat
.
format
(
newdate
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" newdatestring IN ELSE IF "
+
newDateString
);
}
}
// add method here from 287 to 333
sql3
=
"select * from entp_user_lic_chrgs where enterprise = '"
+
enterprise
+
"' "
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
" sql3"
+
sql3
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" enterprise value from entp_user_lic_chrgs"
+
enterprise
);
pstmt3
=
con
.
prepareStatement
(
sql3
);
rs3
=
pstmt3
.
executeQuery
();
while
(
rs3
.
next
())
{
user_lic_type
=
rs3
.
getString
(
"user_lic_type"
);
userLicenseTypelist
.
add
(
user_lic_type
);
}
rs3
.
close
();
rs3
=
null
;
pstmt3
.
close
();
pstmt3
=
null
;
for
(
String
userlicensevalue
:
userLicenseTypelist
)
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
" items insdie userLicenseTypelist "
+
userlicensevalue
);
sql4
=
"select CHRG_AMT from usertype_lic_chrgs WHERE USER_LIC_TYPE = '"
+
userlicensevalue
+
"' "
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
" sql4"
+
sql3
);
pstmt4
=
con
.
prepareStatement
(
sql4
);
rs4
=
pstmt4
.
executeQuery
();
while
(
rs4
.
next
())
{
chrg_amtTotal
+=
rs4
.
getInt
(
"chrg_amt"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" chrg_amtTotal "
+
chrg_amtTotal
);
users_count
++;
}
}
BaseLogger
.
log
(
"3"
,
null
,
null
,
" chrg_amtTotal from users for a enterprise"
+
chrg_amtTotal
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" usercount::: "
+
users_count
);
chrg_amtTotal
=
chrg_amtTotal
*
12
;
// method closes here
valueXmlString
.
append
(
"<valid_upto><![CDATA["
).
append
(
newDateString
).
append
(
"]]></valid_upto>\r\n"
);
valueXmlString
.
append
(
"<renew_amt><![CDATA["
).
append
(
chrg_amtTotal
).
append
(
"]]></renew_amt>\r\n"
);
}
else
if
(
"renew_prd"
.
equalsIgnoreCase
(
currentColumn
.
trim
()))
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Inside renew_prd itemchange"
);
enterprise
=
checkNull
(
genereicutility
.
getColumnValue
(
"enterprise"
,
dom
));
BaseLogger
.
log
(
"3"
,
null
,
null
,
" enterprise Line no 344::["
+
enterprise
+
"]"
);
String
enterpriseString
=
getEnterprise
(
enterprise
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" getValidUptoString line no 348 ==["
+
getValidUptoString
+
"]"
);
// if enterprise is available
if
(
enterpriseString
.
trim
().
length
()
>
0
)
{
// get validupto string TO GET MONTH
// then addition of datending n value selected from dropdown
// getvalidupto date from mehotd plus value from dropdown
// get charges and mulitply as per value from dropdown X3 for 3 months X6 for 6
// months etc
renewPeriod
=
checkNull
(
genereicutility
.
getColumnValue
(
"renew_prd"
,
dom
));
BaseLogger
.
log
(
"3"
,
null
,
null
,
" renewperiodvalue line no 360 ==["
+
renewPeriod
+
"]"
);
// value selected from dropdown contain Y - Year
if
(
renewPeriod
.
contains
(
"Y"
))
{
validuptoDate
=
getValidUpto
(
enterprise
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" validuptoDate gsb ==["
+
validuptoDate
+
"]"
);
// valid_upto_date = simpledateformat.format(validuptoDate);
valid_upto_date
=
simpledateformat
.
format
(
currentDatee
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" valid_upto_date gsb["
+
valid_upto_date
+
"]"
);
chrg_amtTotal
=
ChargeAmoutValue
(
enterprise
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" chrg_amtTotal ["
+
chrg_amtTotal
+
"]"
);
if
(
renewPeriod
.
equalsIgnoreCase
(
"1Y"
))
{
chrg_amtTotal
=
chrg_amtTotal
*
12
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
" chrg_amtTotal line no 379 ==["
+
chrg_amtTotal
+
"]"
);
}
else
if
(
renewPeriod
.
equalsIgnoreCase
(
"3Y"
))
{
chrg_amtTotal
=
chrg_amtTotal
*
36
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
" chrg_amtTotal line no 387 ==["
+
chrg_amtTotal
+
"]"
);
}
// method will return either 1,3 to add to years or 1,3,6 to add to months
int
monthyearvalue
=
getMOnthOrYearVAlue
(
renewPeriod
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" getMOnthOrYearVAlue line 395 ["
+
monthyearvalue
+
"]"
);
Date
dt
=
simpledateformat
.
parse
(
valid_upto_date
);
currentDate
.
setTime
(
dt
);
currentDate
.
add
(
Calendar
.
YEAR
,
monthyearvalue
);
Date
newdate
=
currentDate
.
getTime
();
newDateString
=
simpledateformat
.
format
(
newdate
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" newdatestring renew_prd condition 400:["
+
newDateString
+
"]"
);
valueXmlString
.
append
(
"<renew_amt><![CDATA["
).
append
(
chrg_amtTotal
)
.
append
(
"]]></renew_amt>\r\n"
);
valueXmlString
.
append
(
"<valid_upto><![CDATA["
).
append
(
newDateString
)
.
append
(
"]]></valid_upto>\r\n"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" below valuexmlstring line no 453 "
+
valueXmlString
);
}
// value selected from dropdown is M - Months
else
if
(
renewPeriod
.
contains
(
"M"
))
{
validuptoDate
=
getValidUpto
(
enterprise
);
valid_upto_date
=
simpledateformat
.
format
(
currentDatee
);
chrg_amtTotal
=
ChargeAmoutValue
(
enterprise
);
if
(
renewPeriod
.
equalsIgnoreCase
(
"1M"
))
{
chrg_amtTotal
=
chrg_amtTotal
*
1
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
" chrg_amtTotal line 417["
+
chrg_amtTotal
+
"]"
);
}
else
if
(
renewPeriod
.
equalsIgnoreCase
(
"3M"
))
{
chrg_amtTotal
=
chrg_amtTotal
*
3
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
" chrg_amtTotal line 426["
+
chrg_amtTotal
+
"]"
);
}
else
if
(
renewPeriod
.
equalsIgnoreCase
(
"6M"
))
{
chrg_amtTotal
=
chrg_amtTotal
*
6
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
" chrg_amtotal inside M line 433"
+
chrg_amtTotal
);
}
int
monthyearvalue
=
getMOnthOrYearVAlue
(
renewPeriod
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" monthyearvalue 439 line no["
+
monthyearvalue
+
"]"
);
Date
dt
=
simpledateformat
.
parse
(
valid_upto_date
);
currentDate
.
setTime
(
dt
);
currentDate
.
add
(
Calendar
.
MONTH
,
monthyearvalue
);
Date
newdate
=
currentDate
.
getTime
();
newDateString
=
simpledateformat
.
format
(
newdate
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" newdatestring line 446 ["
+
newDateString
+
"]"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" above valuexmlstring["
+
newDateString
+
"]"
);
valueXmlString
.
append
(
"<renew_amt><![CDATA["
).
append
(
chrg_amtTotal
)
.
append
(
"]]></renew_amt>\r\n"
);
valueXmlString
.
append
(
"<valid_upto><![CDATA["
).
append
(
newDateString
)
.
append
(
"]]></valid_upto>\r\n"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" below valuexmlstring line no 453 "
+
valueXmlString
);
}
}
// if enterprise is not available
else
{
// no validupto string then get currentdate
}
}
/*
*
*
* else if("renew_prd".equalsIgnoreCase(currentColumn.trim())) {
*
* BaseLogger.log("3", null, null, " inside renew_prd itmchange code" );
*
* enterprise = checkNull(genereicutility.getColumnValue("enterprise",dom));
* BaseLogger.log("3", null, null,
* " enterprise insiderenew_prd .equalsIgnoreCase(currentColumn.trim()"
* +enterprise );
*
* getValidUptoString = getEnterprise(enterprise); BaseLogger.log("3", null,
* null, " getValidUptoString"+getValidUptoString );
*
* getValidUptoString = enterprise name if(getValidUptoString.trim().length() ==
* 0 && getValidUptoString.isEmpty() ) {
*
* renewPeriod = checkNull(genereicutility.getColumnValue("renew_prd",dom));
* BaseLogger.log("3", null, null,
* " renewperiod in getvaliduptostring"+renewPeriod );
*
* if(renewPeriod. contains("Y")) {
*
*
* // validuptoDate = getValidUpto(enterprise); valid_upto_date =
* simpledateformat.format(currentDatee);
*
* BaseLogger.log("3", null, null,
* " inside renewperiod.contains(Y) in renewprd else condition" );
*
* //chrg_amtTotal = ChargeAmoutValue(enterprise); BaseLogger.log("3", null,
* null, " chrg_amtotal"+chrg_amtTotal );
*
* int monthyearvalue = getMOnthOrYearVAlue(renewPeriod); BaseLogger.log("3",
* null, null,
* " getMOnthOrYearVAlue returning value else of renewprd condition "
* +monthyearvalue );
*
* Date dt = simpledateformat.parse(currntDate); BaseLogger.log("3", null, null,
* " inside renewprd Y currntDate "+currntDate );
*
* currentDate.setTime(dt); currentDate.add(Calendar.YEAR, monthyearvalue); Date
* newdate = currentDate.getTime(); newDateString =
* simpledateformat.format(newdate); BaseLogger.log("3", null, null,
* " newdatestring renew_prd condition"+newDateString );
*
*
* }
*
* else if(renewPeriod. contains("M")) { BaseLogger.log("3", null, null,
* " inside renewperiod.contains(M) in renew_prd condition condition" );
*
* validuptoDate = getValidUpto(enterprise);//if empty nothing add todays date
* in below variable valid_upto_date = simpledateformat.format(currentDatee);
* //if nothing add todays date if else here
*
*
* BaseLogger.log("3", null, null,
* " chrg_amtotal inside renewPeriod. containsM"+chrg_amtTotal );
*
*
* BaseLogger.log("3", null, null,
* " chrg_amtotal inside renewPeriod. containsM"+chrg_amtTotal );
*
* int monthyearvalue = getMOnthOrYearVAlue(renewPeriod); BaseLogger.log("3",
* null, null,
* " getMOnthOrYearVAlue returning value renew_prd condition"+monthyearvalue );
*
* Date dt = simpledateformat.parse(currntDate); BaseLogger.log("3", null, null,
* " inside renewprd M currntDate "+currntDate );
*
* currentDate.setTime(dt); BaseLogger.log("3", null, null,
* " below currendate.settime in renew_prd condition "+newDateString );
*
* currentDate.add(Calendar.MONTH, monthyearvalue);
*
* Date newdate = currentDate.getTime(); newDateString =
* simpledateformat.format(newdate); BaseLogger.log("3", null, null,
* " newdatestring IN ELSE IF of renew_prd condition "+newDateString );
*
*
*
* }
*
*
* }
*
* // //
*
*
*
*
* // if(!enterprisesqllist.contains(enterprise)) // { //
*
* // BaseLogger.log("3", null, null,
* " inside !enterprisesqllist.contains(enterprise)" ); // // renewPeriod =
* checkNull(genereicutility.getColumnValue("renew_prd",dom)); // // //
* if(renewPeriod. contains("Y")) { // // // validuptoDate =
* getValidUpto(enterprise); // valid_upto_date =
* simpledateformat.format(currentDatee); // // BaseLogger.log("3", null, null,
* " inside renewperiod.contains(Y) in renewprd else condition" ); // //
* //chrg_amtTotal = ChargeAmoutValue(enterprise); // BaseLogger.log("3", null,
* null, " chrg_amtotal"+chrg_amtTotal ); // // int monthyearvalue =
* getMOnthOrYearVAlue(renewPeriod); // BaseLogger.log("3", null, null,
* " getMOnthOrYearVAlue returning value else of renewprd condition "
* +monthyearvalue ); // // Date dt = simpledateformat.parse(currntDate); //
* BaseLogger.log("3", null, null, " inside renewprd Y currntDate "+currntDate
* ); // // currentDate.setTime(dt); // currentDate.add(Calendar.YEAR,
* monthyearvalue); // Date newdate = currentDate.getTime(); // newDateString =
* simpledateformat.format(newdate); // BaseLogger.log("3", null, null,
* " newdatestring renew_prd condition"+newDateString ); // // // } // // else
* if(renewPeriod. contains("M")) { // BaseLogger.log("3", null, null,
* " inside renewperiod.contains(M) in renew_prd condition condition" ); // //
* validuptoDate = getValidUpto(enterprise); // valid_upto_date =
* simpledateformat.format(currentDatee); // // BaseLogger.log("3", null, null,
* " chrg_amtotal inside renewPeriod. containsM"+chrg_amtTotal ); // // int
* monthyearvalue = getMOnthOrYearVAlue(renewPeriod); // BaseLogger.log("3",
* null, null,
* " getMOnthOrYearVAlue returning value renew_prd condition"+monthyearvalue );
* // // Date dt = simpledateformat.parse(currntDate); // BaseLogger.log("3",
* null, null, " inside renewprd M currntDate "+currntDate ); // //
* currentDate.setTime(dt); // BaseLogger.log("3", null, null,
* " below currendate.settime in renew_prd condition "+newDateString ); // //
* currentDate.add(Calendar.MONTH, monthyearvalue); // // Date newdate =
* currentDate.getTime(); // newDateString = simpledateformat.format(newdate);
* // BaseLogger.log("3", null, null,
* " newdatestring IN ELSE IF of renew_prd condition "+newDateString ); // //
* // // } // //
* valueXmlString.append("<valid_upto><![CDATA[").append(newDateString).append(
* "]]></valid_upto>\r\n");; // // // } //till here
*
*
*
*
*
* // // valid_upto =
* checkNull(genereicutility.getColumnValue("valid_upto",dom)); //
* BaseLogger.log("3", null, null,
* " valid_upto inside valid_upto. equalsignorecase inside renew_prd"+valid_upto
* ); // // if(valid_upto.trim().length() == 0) // { // //
* valueXmlString.append("<valid_upto><![CDATA[").append("").append(
* "]]></valid_upto>\r\n");; // // }
*
*
*
*
* //IF ENTERPRISE IS PRESENT else {
*
*
* renewPeriod = checkNull(genereicutility.getColumnValue("renew_prd",dom));
* BaseLogger.log("3", null, null,
* " inside else of renew_prd.equalsignorecase renewPeriod:: "+renewPeriod );
*
* enterprise = checkNull(genereicutility.getColumnValue("enterprise", dom));
* BaseLogger.log("3", null, null,
* " enterprise value in renew_prd.equalsignorecase:: " );
*
*
* if(renewPeriod. contains("Y")) {
*
*
* //validuptoDate = validuptoDate = getValidUpto(enterprise); valid_upto_date =
* simpledateformat.format(validuptoDate); //CHECK IF empty logic to be added
* here
*
*
* BaseLogger.log("3", null, null,
* " inside renewperiod.contains(Y) in renewprd else condition 521 LINE NO" );
*
* chrg_amtTotal = ChargeAmoutValue(enterprise); BaseLogger.log("3", null, null,
* " chrg_amtotal 524 LINENO"+chrg_amtTotal );
*
* if (renewPeriod.equalsIgnoreCase("1Y")) {
*
*
* chrg_amtTotal = chrg_amtTotal * 12; BaseLogger.log("3", null, null,
* " chrg_amtotal"+chrg_amtTotal );
*
* }
*
* else if (renewPeriod.equalsIgnoreCase("3Y")) {
*
* chrg_amtTotal = chrg_amtTotal * 36; }
*
* int monthyearvalue = getMOnthOrYearVAlue(renewPeriod); BaseLogger.log("3",
* null, null,
* " getMOnthOrYearVAlue returning value else of renewprd condition "
* +monthyearvalue );
*
*
* Date dt = simpledateformat.parse(valid_upto_date);
*
* currentDate.setTime(dt); currentDate.add(Calendar.YEAR, monthyearvalue); Date
* newdate = currentDate.getTime(); newDateString =
* simpledateformat.format(newdate); BaseLogger.log("3", null, null,
* " newdatestring renew_prd condition"+newDateString );
*
*
*
* }
*
* else if(renewPeriod. contains("M")) { BaseLogger.log("3", null, null,
* " inside renewperiod.contains(M) in renew_prd condition condition" );
*
* validuptoDate = getValidUpto(enterprise); valid_upto_date =
* simpledateformat.format(validuptoDate); //valid_upto_date =
* getValidUpto(enterprise);
*
* chrg_amtTotal = ChargeAmoutValue(enterprise); BaseLogger.log("3", null, null,
* " chrg_amtotal inside renewPeriod. containsM"+chrg_amtTotal );
*
*
* if(renewPeriod.equalsIgnoreCase("1M")) {
*
* chrg_amtTotal = chrg_amtTotal * 1;
*
* }
*
* else if (renewPeriod.equalsIgnoreCase("3M")) {
*
* chrg_amtTotal = chrg_amtTotal * 3; }
*
* else if (renewPeriod.equalsIgnoreCase("6M")) {
*
* chrg_amtTotal = chrg_amtTotal * 6; BaseLogger.log("3", null, null,
* " chrg_amtotal inside M"+chrg_amtTotal );
*
* }
*
*
* int monthyearvalue = getMOnthOrYearVAlue(renewPeriod); BaseLogger.log("3",
* null, null,
* " getMOnthOrYearVAlue returning value renew_prd condition"+monthyearvalue );
*
*
* Date dt = simpledateformat.parse(valid_upto_date); currentDate.setTime(dt);
* BaseLogger.log("3", null, null,
* " below currendate.settime in renew_prd condition "+newDateString );
*
* currentDate.add(Calendar.MONTH, monthyearvalue);
*
* Date newdate = currentDate.getTime(); newDateString =
* simpledateformat.format(newdate); BaseLogger.log("3", null, null,
* " newdatestring IN ELSE IF of renew_prd condition "+newDateString );
*
*
*
* }
*
*
* }
*
* BaseLogger.log("3", null, null,
* " above valuexmlstring <valid_upto><![CD "+newDateString );
*
* valueXmlString.append("<renew_amt><![CDATA[").append(chrg_amtTotal).append(
* "]]></renew_amt>\r\n");;
* valueXmlString.append("<valid_upto><![CDATA[").append(newDateString).append(
* "]]></valid_upto>\r\n");; BaseLogger.log("3", null, null,
* " above valuexmlstring line no 618 "+valueXmlString );
*
*
* } //end of else if renew_prd
*/
valueXmlString
.
append
(
"</Detail1>\r\n"
);
}
valueXmlString
.
append
(
"</Root>\r\n"
);
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Dan exception e "
+
e
);
e
.
printStackTrace
();
}
finally
{
try
{
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
con
!=
null
)
{
con
.
close
();
con
=
null
;
}
if
(
rs2
!=
null
)
{
rs2
.
close
();
rs2
=
null
;
}
if
(
pstmt2
!=
null
)
{
pstmt2
.
close
();
pstmt2
=
null
;
}
if
(
rs3
!=
null
)
{
rs3
.
close
();
rs3
=
null
;
}
if
(
pstmt3
!=
null
)
{
pstmt3
.
close
();
pstmt3
=
null
;
}
if
(
rs4
!=
null
)
{
rs4
.
close
();
rs4
=
null
;
}
if
(
pstmt4
!=
null
)
{
pstmt4
.
close
();
pstmt4
=
null
;
}
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Dan exception e "
+
ex
);
}
}
return
valueXmlString
.
toString
();
}
public
int
ChargeAmoutValue
(
String
enterprise
)
throws
RemoteException
,
ITMException
{
String
sql3
=
""
,
user_lic_type
=
""
,
sql4
=
""
;
PreparedStatement
pstmt3
,
pstmt4
;
int
chrg_amtTotal
=
0
,
users_count
=
0
;
ResultSet
rs3
,
rs4
;
Connection
con2
=
null
;
List
<
String
>
userLicenseTypelist
=
new
ArrayList
<>();
con2
=
getConnection
();
sql3
=
"select * from entp_user_lic_chrgs where enterprise = '"
+
enterprise
+
"' "
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
" sql3"
+
sql3
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" enterprise value from entp_user_lic_chrgs inside chargeamountvalue method"
+
enterprise
);
try
{
pstmt3
=
con2
.
prepareStatement
(
sql3
);
rs3
=
pstmt3
.
executeQuery
();
BaseLogger
.
log
(
"3"
,
null
,
null
,
" below rs3 chargeamount value"
);
while
(
rs3
.
next
())
{
user_lic_type
=
rs3
.
getString
(
"user_lic_type"
);
userLicenseTypelist
.
add
(
user_lic_type
);
}
rs3
.
close
();
rs3
=
null
;
pstmt3
.
close
();
pstmt3
=
null
;
for
(
String
userlicensevalue
:
userLicenseTypelist
)
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
" items insdie userLicenseTypelist "
+
userlicensevalue
);
sql4
=
"select CHRG_AMT from usertype_lic_chrgs WHERE USER_LIC_TYPE = '"
+
userlicensevalue
+
"' "
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
" sql4"
+
sql3
);
pstmt4
=
con2
.
prepareStatement
(
sql4
);
rs4
=
pstmt4
.
executeQuery
();
while
(
rs4
.
next
())
{
chrg_amtTotal
+=
rs4
.
getInt
(
"chrg_amt"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" chrg_amtTotal "
+
chrg_amtTotal
);
users_count
++;
}
}
BaseLogger
.
log
(
"3"
,
null
,
null
,
" chrg_amtTotal from users for a enterprise"
+
chrg_amtTotal
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" usercount::: "
+
users_count
);
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
return
chrg_amtTotal
;
}
public
static
int
getMOnthOrYearVAlue
(
String
renewPrd
)
{
char
renewPrdValue
=
renewPrd
.
charAt
(
0
);
System
.
out
.
println
(
"renewPrdValue"
+
renewPrdValue
);
int
value
=
Integer
.
parseInt
(
String
.
valueOf
(
renewPrdValue
));
return
value
;
}
public
Date
getValidUpto
(
String
enterprise
)
throws
SQLException
,
RemoteException
,
ITMException
{
String
sql2
=
""
,
validUptoDateString
=
""
;
PreparedStatement
pstmt2
=
null
;
ResultSet
rs2
=
null
;
Connection
con
;
Date
validuptoDate
=
null
;
con
=
getConnection
();
// sql2 = "select max(valid_upto) from entp_subs_renew where enterprise =
// '"+enterprise+"' ";
// new changes
sql2
=
"select lic_valid_upto from enterprise where enterprise ='"
+
enterprise
+
"' "
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
"sql to get lic_valid_upto "
+
sql2
);
try
{
pstmt2
=
con
.
prepareStatement
(
sql2
);
rs2
=
pstmt2
.
executeQuery
();
if
(
rs2
.
next
())
{
// validuptoDate = rs2.getDate("max(valid_upto)");
validuptoDate
=
rs2
.
getDate
(
"lic_valid_upto"
);
// checkNull(rs2.getDate("lic_valid_upto"));
BaseLogger
.
log
(
"3"
,
null
,
null
,
" lic_valid_upto"
+
validuptoDate
);
}
// validUptoDateString = checkNull(validuptoDate.toString());
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
rs2
.
close
();
rs2
=
null
;
pstmt2
.
close
();
pstmt2
=
null
;
return
validuptoDate
;
}
public
String
getEnterprise
(
String
enterprise
)
throws
SQLException
,
RemoteException
,
ITMException
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"inside getenterprise"
+
enterprise
);
String
sql2
=
""
,
validUptoDateString
=
""
,
enterpriseString
=
""
;
PreparedStatement
pstmt2
=
null
;
ResultSet
rs2
=
null
;
Connection
con
;
Date
validuptoDate
=
null
;
con
=
getConnection
();
// sql2 = "select max(valid_upto) from entp_subs_renew where enterprise =
// '"+enterprise+"' ";
// sql2 = "select lic_valid_upto from enterprise where enterprise
// ='"+enterprise+"' ";
sql2
=
"select enterprise from enterprise where enterprise ='"
+
enterprise
+
"' "
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
"sql to get lic_valid_upto "
+
sql2
);
try
{
pstmt2
=
con
.
prepareStatement
(
sql2
);
rs2
=
pstmt2
.
executeQuery
();
if
(
rs2
.
next
())
{
// validuptoDate = rs2.getDate("max(valid_upto)");
// validuptoDate = rs2.getDate("lic_valid_upto");
enterpriseString
=
rs2
.
getString
(
"enterprise"
);
// checkNull(rs2.getDate("lic_valid_upto"));
BaseLogger
.
log
(
"3"
,
null
,
null
,
" lic_valid_upto"
+
validuptoDate
);
}
// validUptoDateString = checkNull(validuptoDate.toString());
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
rs2
.
close
();
rs2
=
null
;
pstmt2
.
close
();
pstmt2
=
null
;
return
enterpriseString
;
}
public
String
checkNull
(
String
inputStr
)
throws
ITMException
{
try
{
if
(
inputStr
!=
null
&&
inputStr
.
trim
().
length
()
>
0
)
{
return
inputStr
.
trim
();
}
else
{
return
""
;
}
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Exception in checknull--["
+
e
.
getMessage
()
+
"]"
);
e
.
printStackTrace
();
throw
new
ITMException
(
e
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment