Commit bcb5168a authored by ymohite's avatar ymohite

Changes done for Tag count , Vision UI change, JsonData Method updated in Dashbaord util,

subtitle  change in Landing Dashbord.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@207744 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 06f840ba
......@@ -6,10 +6,8 @@ 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.Arrays;
import java.util.Date;
import java.util.List;
import javax.naming.InitialContext;
......@@ -288,6 +286,12 @@ public class DashboardUtil
try
{
JSONObject valueObj = new JSONObject(value);
if(userInfo != null)
{
String transDB = userInfo.getTransDB();
String enterprise = userInfo.getEnterprise();
valueObj = updateJsonData(valueObj, transDB, enterprise);
}
JSONArray quicklinks = valueObj.optJSONArray("quicklinks");
JSONArray quicklinksFinal=new JSONArray();
for(int i = 0, size = quicklinks.length(); i < size; i++) {
......@@ -1321,5 +1325,75 @@ public class DashboardUtil
}
return conn;
}
private JSONObject updateJsonData(JSONObject valueObj, String transDB, String enterprise)
{
System.out.println("indside get updateJsonData");
PreparedStatement pstmt = null;
ResultSet rs = null;
Connection conn = null;
System.out.println("transdb ::::::::::" + transDB);
System.out.println("enterprise" + enterprise);
ConnDriver connDriver = new ConnDriver();
StringBuffer sql = new StringBuffer();
sql.append("SELECT enterprise_descr, ent_tagline, ent_logo")
.append(" FROM enterprise ")
.append(" WHERE enterprise ='" + enterprise + "'");
System.out.println("Enterprise sql :::: " + sql);
try
{
conn = connDriver.getConnectDB(transDB);
pstmt = conn.prepareStatement(sql.toString());
rs = pstmt.executeQuery();
if (rs.next())
{
String enterpriseDescription = checkNull(rs.getString("enterprise_descr") );
String enterpriseTagline = checkNull(rs.getString("ent_tagline") );
String enterpriselogo = checkNull(rs.getString("ent_logo") );
System.out.println("enterprise _Description " + enterpriseDescription);
System.out.println("ENTERPRISE_TAGLINE " + enterpriseTagline);
System.out.println("enterprise_logo " + enterpriselogo);
valueObj.put("image", enterpriselogo);
valueObj.put("title", enterpriseDescription);
valueObj.put("subtitle", enterpriseTagline);
}
}
catch (SQLException | JSONException e)
{
System.out.println("Exception in updateJsonData::: " + e.getMessage());
e.printStackTrace();
}
catch (Exception e)
{
System.out.println("Exception in updateJsonData::: " + e.getMessage());
e.printStackTrace();
}
finally {
try {
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (rs != null) {
rs.close();
rs = null;
}
if (conn != null) {
conn.close();
conn = null;
}
} catch (Exception e) {
System.out.println("Exception in finally updateJsonData :: " + e.getMessage());
e.printStackTrace();
}
}
System.out.println("updateJsonData ::: " + valueObj);
return valueObj;
}
}
package ibase.dashboard.common.hibernate.dao;
import java.io.PrintStream;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
......@@ -12,6 +13,7 @@ import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import org.apache.poi.util.SystemOutLogger;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
......@@ -66,7 +68,7 @@ public class UserHistoryDAO
{
System.out.println(" inside rs device history");
JSONObject allDeviceHisJson = new JSONObject();
String userId = rs.getString("user_id");
String deviceOs = rs.getString("device_os");
String deviceType = rs.getString("device_type");
......@@ -76,7 +78,7 @@ public class UserHistoryDAO
String active = rs.getString("active");
String chgTerm = rs.getString("chg_term");
String chgDate = rs.getString("chg_date");
allDeviceHisJson.put("USER_ID", userId);
allDeviceHisJson.put("DEVICE_OS", deviceOs);
allDeviceHisJson.put("DEVICE_TYPE", deviceType);
......@@ -89,9 +91,9 @@ public class UserHistoryDAO
System.out.println(" allDeviceHisJson ["+allDeviceHisJson+"]");
getDeviceHistory.put(allDeviceHisJson);
System.out.println(" getDeviceHistory ["+getDeviceHistory+"]");
System.out.println(" getDeviceHistory [" + getDeviceHistory + "]");
}
}
}
catch(Exception e)
{
......@@ -128,14 +130,13 @@ public class UserHistoryDAO
return getDeviceHistory;
}
public JSONArray getPassChgHistory(String loginUser, String transDB) throws Exception
{
public JSONArray getPassChgHistory(String loginUser, String transDB) throws Exception {
System.out.println("indside getPassHisObject");
java.sql.PreparedStatement pstmt = null;
ResultSet rs = null;
Connection conn =null;
Connection conn = null;
JSONArray userPasswdHisArr = new JSONArray();
try
{
......@@ -172,7 +173,7 @@ public class UserHistoryDAO
String deviceOs = rs.getString("device_os");
String deviceType = rs.getString("device_type");
String deviceMake = rs.getString("device_make");
userPasswdHis.put("PASS_CHG_SEQ", Integer.toString(i));
userPasswdHis.put("PASS_CHG_DATE", passChgDate);
userPasswdHis.put("DEVICE_ID", deviceId);
......@@ -180,9 +181,9 @@ public class UserHistoryDAO
userPasswdHis.put("DEVICE_OS", deviceOs);
userPasswdHis.put("DEVICE_TYPE", deviceType);
userPasswdHis.put("DEVICE_MAKE", deviceMake);
userPasswdHisArr.put(userPasswdHis);
System.out.println("getAllLoginHistory==>["+userPasswdHis+"]");
System.out.println("getAllLoginHistory==>[" + userPasswdHis + "]");
}
if( pstmt != null )
......@@ -232,13 +233,13 @@ public class UserHistoryDAO
return userPasswdHisArr;
}
public JSONArray getAllLoginHistory(String loginUser, String transDB) throws Exception {
System.out.println("indside get all ogin history");
java.sql.PreparedStatement pstmt = null;
ResultSet rs = null;
Connection conn =null;
Connection conn = null;
JSONArray loginHistoryArr = new JSONArray();
try
{
......@@ -286,7 +287,7 @@ public class UserHistoryDAO
pstmt.setDate(2, (java.sql.Date) cal1.getTime());*/
Timestamp ts = new Timestamp(cal.getTimeInMillis());
System.out.println(" ts timeStamp ["+ts+"]");
System.out.println(" ts timeStamp [" + ts + "]");
Timestamp ts2 = new Timestamp(cal1.getTimeInMillis());
System.out.println(" ts2 timeStamp ["+ts2+"]");
......@@ -295,14 +296,15 @@ public class UserHistoryDAO
pstmt.setTimestamp(1, ts);
pstmt.setTimestamp(2, ts2);
rs = pstmt.executeQuery();
System.out.println("rs"+rs);
while(rs.next())
{
System.out.println(" inside rs");
JSONObject loginHistory = new JSONObject();
String userId = rs.getString("userid");
String loginTime = rs.getString("logintime");
String logoutTime = rs.getString("logouttime");
......@@ -314,7 +316,7 @@ public class UserHistoryDAO
String osVersion = rs.getString("os_version");
String clientAPP = rs.getString("client_app");
String clientAppVer = rs.getString("client_app_ver");
loginHistory.put("USER_ID", userId);
loginHistory.put("LOGIN_TIME", loginTime);
loginHistory.put("LOG_OUT", logoutTime);
......@@ -326,7 +328,7 @@ public class UserHistoryDAO
loginHistory.put("OS_VERSION", osVersion);
loginHistory.put("CLIENTA_APP", clientAPP);
loginHistory.put("CLIENT_APP_VER", clientAppVer);
loginHistoryArr.put(loginHistory);
}
}
......@@ -367,7 +369,7 @@ public class UserHistoryDAO
return loginHistoryArr;
}
public JSONObject getUserActivitySummary(String loginUser, String userName, String transDB)
public JSONObject getUserActivitySummary(String loginUser, String userName, String transDB,String enterprise)
{
JSONObject userHisObj = new JSONObject();
System.out.println("inside getUserActivitySummary");
......@@ -381,83 +383,94 @@ public class UserHistoryDAO
Date lastLoginDate = getDateTimeObject(last_login_date);
Date lastPasswrdChangeDate = getDateTimeObject(last_passwrd_change_date);
System.out.println("lastLoginDate ==>"+lastLoginDate + " lastPasswrdChangeDate ==> " + lastPasswrdChangeDate );
userHisObj.put("LAST_LOGIN", getDifference(new Date(), lastLoginDate) );
System.out.println(
"lastLoginDate ==>" + lastLoginDate + " lastPasswrdChangeDate ==> " + lastPasswrdChangeDate);
userHisObj.put("LAST_LOGIN", getDifference(new Date(), lastLoginDate));
userHisObj.put("LAST_PWD_CHG", getDifference(new Date(), lastPasswrdChangeDate));
userHisObj.put("LAST_LOGIN_DATE", last_login_date != null ? last_login_date : new Date() );
userHisObj.put("LAST_LOGIN_DATE", last_login_date != null ? last_login_date : new Date());
userHisObj.put("LAST_PWD_CHG_DATE", last_passwrd_change_date);
String no_of_doc_content = getSQLResult(" user_doc_contents ", " count(doc_id) ",
" user_id = '" + loginUser + "' and doc_stat <> 'D'", transDB);
System.out.println("No Of Contents ==>" + no_of_doc_content);
String no_of_places = getSQLResult(" place_time_ent ", " count(pte_id) ", " user_id = '" + loginUser + "'",
transDB);
System.out.println("No Of Places ==>" + no_of_places);
String no_of_tags = getTagsCount(loginUser,transDB);
System.out.println("No Of Tags ==>" + no_of_tags);
String no_of_bkjobs = "0";//getBkJobsCount(loginUser,transDB)
System.out.println("No Of Backgroundjobs ==>" + no_of_bkjobs);
String no_of_doc_content = getSQLResult(" user_doc_contents ", " count(doc_id) ", " user_id = '" + loginUser + "' and doc_stat <> 'D'", transDB);
System.out.println("No Of Contents ==>"+no_of_doc_content);
String no_of_places = getSQLResult(" place_time_ent ", " count(pte_id) ", " user_id = '" + loginUser + "'", transDB);
System.out.println("No Of Places ==>"+no_of_places);
userHisObj.put("NO_OF_CONTENTS", no_of_doc_content != null ? no_of_doc_content : "0");
userHisObj.put("NO_OF_PLACES", no_of_places != null ? no_of_places : "0");
userHisObj.put("USER_NAME", userName );
}
catch (JSONException e)
{
System.out.println("JSONException in getUserActivitySummary :: "+ e.getMessage());
userHisObj.put("NO_OF_TAGS", no_of_tags != null ? no_of_tags : "0");
userHisObj.put("NO_OF_TAGS", no_of_tags);
/*userHisObj.put("NO_OF_JOBS", no_of_bkjobs != null ? no_of_bkjobs : "0");*/
userHisObj.put("USER_NAME", userName);
System.out.println("USER_NAME "+ userName);
System.out.println("userActSummrry:::: "+userHisObj);
} catch (JSONException e) {
System.out.println("JSONException in getUserActivitySummary :: " + e.getMessage());
e.printStackTrace();
}
catch (Exception e )
{
System.out.println("Exception in getUserActivitySummary :: "+ e.getMessage());
} catch (Exception e) {
System.out.println("Exception in getUserActivitySummary :: " + e.getMessage());
e.printStackTrace();
}
return userHisObj;
}
public void changeDeviceStatus(String loginUser, String deviceId, String active, String transDB) throws Exception
{
private PrintStream append(String string) {
// TODO Auto-generated method stub
return null;
}
public void changeDeviceStatus(String loginUser, String deviceId, String active, String transDB) throws Exception {
Connection con = null;
PreparedStatement pstmt = null;
try
{
try {
String transDb = "";
transDb= transDB;
System.out.println("transdb ::::::::::"+transDb);
transDb = transDB;
System.out.println("transdb ::::::::::" + transDb);
ConnDriver connDriver = new ConnDriver();
con = connDriver.getConnectDB( transDb );
StringBuffer sql=new StringBuffer();
if("true".equalsIgnoreCase(active))
{
con = connDriver.getConnectDB(transDb);
StringBuffer sql = new StringBuffer();
if ("true".equalsIgnoreCase(active)) {
sql.append(" UPDATE user_device SET active = 'Y' ");
}
else
{
} else {
sql.append(" UPDATE user_device SET active = 'N' ");
}
sql.append(" WHERE user_id ='"+loginUser+"' AND device_id__push ='"+deviceId+"' ");
sql.append(" WHERE user_id ='" + loginUser + "' AND device_id__push ='" + deviceId + "' ");
pstmt = con.prepareStatement(sql.toString());
pstmt.setString(1, loginUser);
pstmt.executeQuery();
pstmt.close();
}
catch ( Exception e )
{
throw new Exception(e) ;
}
finally
{
if (con != null )
{
try
{
} catch (Exception e) {
throw new Exception(e);
} finally {
if (con != null) {
try {
con.commit();
con.close();
con = null;
}
catch (SQLException e)
{
} catch (SQLException e) {
}
}
}
}
......@@ -521,4 +534,155 @@ public class UserHistoryDAO
}
return daysRemaining;
}
private String checkNull(String str) {
if (str == null) {
return "NA";
} else {
return str;
}
}
// getTagsCount Created By Yogesh Mohite 16/09/2019
public String getTagsCount(String loginUser, String transDB)throws Exception {
System.out.println("indside getTagscountt");
java.sql.PreparedStatement pstmt = null;
ResultSet rs = null;
Connection conn = null;
String transDb = "";
transDb = transDB;
System.out.println("transdb ::::::::::" + transDb);
ConnDriver connDriver = new ConnDriver();
try {
conn = connDriver.getConnectDB(transDb);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
StringBuffer sql = new StringBuffer();
sql.append ("SELECT count(DISTINCT tag_trans.REF_ID) as COUNT ")
.append (" FROM tag_trans ")
.append (" INNER JOIN ")
.append (" (SELECT tag_trans.ref_id,")
.append (" tag_trans.tag_id," )
.append (" tag_trans.user_id ")
.append (" FROM tag_trans " )
.append (" INNER JOIN ")
.append (" (SELECT REF_ID," )
.append (" MAX(CHG_DATE)a_dt ," )
.append (" user_id" )
.append (" FROM tag_trans" )
.append (" WHERE user_id= '"+ loginUser +"' ")
.append (" GROUP BY REF_ID ," )
.append (" user_id " )
.append (" )tag_trans_a")
.append (" ON tag_trans.REF_ID =tag_trans_a.REF_ID " )
.append (" AND tag_trans.USER_ID =tag_trans_a.USER_ID " )
.append (" AND CHG_DATE =tag_trans_a.a_dt " )
.append (" )a ON tag_trans.REF_ID=A.REF_ID ")
.append (" AND tag_trans.TAG_ID =A.TAG_ID " )
.append (" AND A.USER_ID =tag_trans.USER_ID ")
.append (" AND TAG_TRANS.FEED_DATA is not null ");
System.out.println(" Tag .toString()+++ " + sql.toString());
pstmt = conn.prepareStatement(sql.toString());
rs = pstmt.executeQuery();
System.out.println(" Tag rs" + rs);
String TagsCount = " ";
while (rs.next())
{
String Tags = rs.getString("COUNT");
TagsCount = Tags;
System.out.println("TagsCount ::::: "+ TagsCount);
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (rs != null) {
rs.close();
rs = null;
}
if (conn != null) {
conn.close();
conn = null;
}
return TagsCount;
}
// getBkJobsCount Created By Yogesh Mohite 16/09/2019
public String getBkJobsCount(String loginUser, String transDB)throws Exception {
System.out.println("indside getTagscountt");
java.sql.PreparedStatement pstmt = null;
ResultSet rs = null;
Connection conn = null;
String transDb = "";
transDb = transDB;
System.out.println("transdb ::::::::::" + transDb);
ConnDriver connDriver = new ConnDriver();
JSONArray BKCountarr = new JSONArray ();
try {
conn = connDriver.getConnectDB(transDb);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
StringBuffer sql = new StringBuffer();
sql.append("SELECT COUNT(*)")
.append ("FROM")
.append (" (SELECT 'Excel' AS title,")
.append(" win_name,")
.append(" batch_id AS job_id")
.append(" FROM batchload")
.append(" WHERE load_stat IN ('N','E','Y')")
.append(" AND chg_user = '" + loginUser +"'")
.append(" AND load_date > ' '")
.append(" AND load_date < ' '")
.append(" GROUP BY WIN_NAME,")
.append(" BATCH_ID")
.append(" UNION ALL")
.append(" SELECT (")
.append(" CASE")
.append(" WHEN obj_type = 'P'")
.append(" THEN 'Process'" )
.append(" WHEN obj_type = 'R'")
.append(" THEN 'Report'" )
.append(" ELSE 'Other'")
.append(" END) AS title,")
.append(" obj_name AS win_name,")
.append(" job_id")
.append(" FROM background_job")
.append(" WHERE job_stat IN ('I','E','X','P','C')")
.append(" AND user_id = '"+loginUser +"'")
.append(" AND created_date > ' '")
.append(" AND created_date < ' '")
.append(" )" );
System.out.println("BKJobs sql.toString()+++" + sql.toString());
pstmt = conn.prepareStatement(sql.toString());
rs = pstmt.executeQuery();
System.out.println("rs" + rs);
while (rs.next())
{
String BKCount = rs.getString("COUNT");
JSONObject BkCountobj = new JSONObject();
BkCountobj.put("BkCount", BKCount);
System.out.println("Object of tags:::: "+BkCountobj );
BKCountarr.put(BkCountobj);
System.out.println("Array of tags:::: "+ BKCountarr );
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (rs != null) {
rs.close();
rs = null;
}
if (conn != null) {
conn.close();
conn = null;
}
return BKCountarr.toString() ;
}
}
......@@ -22,7 +22,7 @@
"title" : "My Places",
"count" : " getUserActSummary('PTE_COUNT') ",
"summary" : " getUserActSummary('PTE_MSG') ",
"execFunction" :"openTransactionGWT('place_time_entity','place-time-entity','A','Place Time Entity');"
"execFunction" :"openTransactionGWT('place_time_entity','place-time-entity','A','My Places');"
},
{
"bgImage":"linear-gradient(-45deg, #7053cc, #c3b3f7)",
......@@ -30,7 +30,7 @@
"title" : "My Contents",
"count" : "getUserActSummary('CLM_COUNT')",
"summary" : "getUserActSummary('CLM_MSG')",
"execFunction" : "openTransactionGWT('content_library','dashboard_contentLibrary','A','Content Library');"
"execFunction" : "openTransactionGWT('content_library','dashboard_contentLibrary','A','My Contents');"
},
{
"bgImage":"linear-gradient(-45deg, #01a27f, #00e1af)",
......@@ -38,7 +38,7 @@
"title" : "Jobs In Progress",
"count" : " getUserActSummary('JOBS_COUNT') ",
"summary" : "getUserActSummary('JOBS_MSG')",
"execFunction" : "openTransactionGWT('background_job_status','dashboard_backgroundJobStatus','A','Background Job');"
"execFunction" : "openTransactionGWT('background_job_status','dashboard_backgroundJobStatus','A','Jobs In Progress');"
},
{
"bgImage":"linear-gradient(-45deg, #e47842, #ffac83)",
......@@ -55,6 +55,7 @@
"image" : "wallet.svg",
"title" : "My Wallet",
"subtitle1" : " 'My Wallet' ",
"execFunction" : "openTransactionGWT('myexpensedata','dashboard_myexpensedata','A','My Wallet');",
"obj_name_rights" : "my_expense"
},
{
......@@ -84,7 +85,9 @@
"preloadDashboardData({'url' : '/ibase/rest/dashboard/userActSummary', 'value' : 'UserActSummary', 'type' : 'servlet'});"
]
}]]></datasource>
<view id='1' name='Default' type='flatonly'>
<component datasource='1' id='1' type='FEED'>
<component_icon><![CDATA[]]>
</component_icon>
......@@ -142,12 +145,12 @@
.quicklink {
display: block;
position: relative;
margin: 4px;
margin: 5px;
border-radius: 4px;
cursor: pointer;
height: 200px;
padding: 0px !important;
box-shadow: 0px 0px 4px -1px rgba(0,0,0,.1);
box-shadow: 0px 0px 4px 1px rgba(0,0,0,.1);
}
.quicklink-dashboard .quicklink-icon img {
......@@ -233,8 +236,6 @@
display: block;
}
.quick-row,
.kpi-row {
margin: auto;
......@@ -244,9 +245,9 @@
.kpi-box {
height: 114px;
max-height: 114px;
box-shadow: 0px 0px 4px -1px rgba(0,0,0,.1);
box-shadow: 0px 0px 4px 1px rgba(0,0,0,.1);
position: relative;
margin: 4px;
margin: 5px;
border-radius: 4px;
cursor: pointer;
display: flex;
......@@ -340,48 +341,47 @@
@media (min-width:320px) {
.kpi-card {
width: calc(100% - 8px) ;
width: calc(100% - 10px) ;
}
.quick-card {
width: calc(100% - 8px) ;
width: calc(100% - 10px) ;
}
}
@media (min-width:576px) {
.kpi-card {
width: calc(50% - 8px) ;
width: calc(50% - 10px) ;
}
.quick-card {
width: calc(50% - 8px) ;
width: calc(50% - 10px) ;
}
}
@media (min-width:768px) {
.kpi-card {
width: calc(25% - 8px) ;
width: calc(25% - 10px) ;
}
.quick-card {
width: calc(33.33333% - 8px) ;
width: calc(33.33333% - 10px) ;
}
}
@media (min-width:992px) {
.kpi-card {
width: calc(25% - 8px) ;
width: calc(25% - 10px) ;
}
.quick-card {
width: calc(33.33333% - 8px) ;
width: calc(33.33333% - 10px) ;
}
}
@media (min-width:1200px) {
.kpi-card {
width: calc(25% - 8px);
width: calc(25% - 10px);
}
.quick-card {
width: calc(33.33333% - 8px) ;
width: calc(33.33333% - 10px) ;
}
}
</style>
<div class="quicklink-dashboard">
<div class="quicklink-dashboard">
<div class="qd-header">
<div class="qd-header-content">
<span class="icon-circle"><img src='angplugin/assets/images/{{context.image}}' /></span>
......@@ -434,7 +434,7 @@
<img src='angplugin/assets/images/svg/{{quicklink.image}}' [ngClass]="evalFunction(quicklink.imageFunction)" />
</div>
<div *ngIf="quicklink.image.indexOf('/') != -1 " class="kpi-icon">
<img src='{{quicklink.image}}' [ngClass]="evalFunction(quicklink.imageFunction)" />
<img src='{{quicklink.image}}' [ngClass]="evalFunction(quicklink.imageFunction)"/>
</div>
<div class="kpi-title">{{quicklink.title}}</div>
</div>
......@@ -444,6 +444,7 @@
</div>
</div>
</ng-template>
]]></html>
</layout>
</component>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment