Commit 05f04ac9 authored by ManishKumar C's avatar ManishKumar C

Replace UserInvitationDAO.java

parent 411b782f
......@@ -654,7 +654,8 @@ public class UserInvitationDAO
String entityCode = "DEPT:"+checkNull(inviteUser.getDeptCode())+"$GRADE:"+checkNull(inviteUser.getGrade())+"$ITMSER:"+ checkNull(inviteUser.getItemSer());
BaseLogger.log("3",null,null,"entityCode in addInviteUser::["+entityCode+"]");
//Changes added to get values for designation,reportTo,headquarter on 27-MAR-24[START]
String ediAddr = "DESIGNCODE:"+checkNull(inviteUser.getDesignCode())+"$REPORTTO:"+checkNull(inviteUser.getReportTo()+"$HQ:"+checkNull(inviteUser.getStanCodeHq()));
String stanCodeHQ = checkNull(inviteUser.getStanCodeHq()).trim();
String ediAddr = "DESIGNCODE:"+checkNull(inviteUser.getDesignCode())+"$REPORTTO:"+checkNull(inviteUser.getReportTo()+"$HQ:"+stanCodeHQ);
BaseLogger.log("3",null,null,"ediAddr in addInviteUser::["+ediAddr+"]");
//Changes added to get values for designation,reportTo,headquarter on 27-MAR-24[END]
// To get registered Invitee User's Information
......@@ -736,6 +737,15 @@ public class UserInvitationDAO
pstmt = null;
rs = null;
// Added by Rahul P. on 12-Mar-24 [To set HQ value to City] :: START
BaseLogger.log("3",null,null,"addInviteUser >> stanCodeHQ :: " +stanCodeHQ);
if(!stanCodeHQ.isEmpty())
{
city = stanCodeHQ;
BaseLogger.log("3",null,null,"addInviteUser >> city :: " +city);
}
// Added by Rahul P. on 12-Mar-24 [To set HQ value to City] :: END
BaseLogger.log("3",null,null,"----updated---" +lob);
userSql = "INSERT INTO USER_REGISTRATION (USER_NAME,EMAIL_ID,CONTACT_NO,LAST_NAME,PASS_WD_SHA,USER_ID,SITE_CODE, ADDR1, ADDR2, ADDR3, CITY, STATE_CODE, PIN, TELE1, TELE2, TELE3, LINE_OF_BUSINESS)"
+ " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
......@@ -2773,7 +2783,6 @@ public class UserInvitationDAO
String grade = "";
String itemSer = "";
String entityToggle = "";
String city = "";
String userType = "";
JSONArray createProfIdArray = new JSONArray();
try
......@@ -2782,7 +2791,7 @@ public class UserInvitationDAO
BaseLogger.log("1",null,null,"userInfo in userInvitation dao getDefaultData == >" +userInfo);
con = mConnDriver.getConnectDB(userInfo.getTransDB());
String sql = "SELECT P.USER_TYPE AS USER_TYPE, P.DEPT_CODE__DEF AS DEPT_CODE, P.GRADE_CODE__DEF AS GRADE_CODE, " +
" P.CREATE_ENTITY_NEW AS ENTITY_TOGGLE, D.ITEM_SER AS ITEM_SER, U.CITY AS STAN_CODE__HQ FROM PROFILE P, " +
" P.CREATE_ENTITY_NEW AS ENTITY_TOGGLE, D.ITEM_SER AS ITEM_SER FROM PROFILE P, " +
" USER_REGISTRATION U, DEPARTMENT D WHERE P.APPLICATION_PACK = U.APPLICATION_PACK AND D.DEPT_CODE = P.DEPT_CODE__DEF AND P.PROFILE_ID = ?";
stmt = con.prepareStatement(sql);
stmt.setString(1, profileId);
......@@ -2796,14 +2805,12 @@ public class UserInvitationDAO
grade = mResultSet.getString("GRADE_CODE");
entityToggle = mResultSet.getString("ENTITY_TOGGLE");
itemSer = mResultSet.getString("ITEM_SER");
city = mResultSet.getString("STAN_CODE__HQ");
createUserJsonObj.put("USER_TYPE",userType);
createUserJsonObj.put("DEPT_CODE",deptCode);
createUserJsonObj.put("GRADE_CODE",grade);
createUserJsonObj.put("ENTITY_TOGGLE",entityToggle);
createUserJsonObj.put("ITEM_SER",itemSer);
createUserJsonObj.put("STAN_CODE__HQ",city);
BaseLogger.log("3", null,null, "print createUserJsonObj" + createUserJsonObj);
createProfIdArray.put(createUserJsonObj);
......@@ -2853,4 +2860,78 @@ public class UserInvitationDAO
}
//Added by ManishK to set department,grade by default when profile is set on 03-APR-24[END]
//Added by ManishK to set department,grade by default when profile is set on 12-APR-24[START]
public String getDefaultStationCode(String loginCode,UserInfoBean userInfo) throws Exception
{
BaseLogger.log("1",null,null,"userInfo in getDefaultStationCode method == >" +userInfo);
Connection con = null;
PreparedStatement stmt = null;
ResultSet mResultSet = null;
String stanCodeHq = "";
JSONArray createProfIdArray = new JSONArray();
try
{
ConnDriver mConnDriver = new ConnDriver();
BaseLogger.log("1",null,null,"userInfo in userInvitation dao getDefaultStationCode == >" +userInfo);
con = mConnDriver.getConnectDB(userInfo.getTransDB());
String sql = "SELECT CITY AS STAN_CODE__HQ FROM USER_REGISTRATION WHERE EMAIL_ID = (SELECT EMAIL_ID FROM USERS WHERE CODE = ?)";
stmt = con.prepareStatement(sql);
stmt.setString(1, loginCode);
mResultSet = stmt.executeQuery();
while (mResultSet.next())
{
JSONObject createUserJsonObj = new JSONObject();
stanCodeHq = mResultSet.getString("STAN_CODE__HQ");
createUserJsonObj.put("STAN_CODE__HQ",stanCodeHq);
BaseLogger.log("3", null,null, "print createUserJsonObj" + createUserJsonObj);
createProfIdArray.put(createUserJsonObj);
}
mResultSet.close();
mResultSet = null;
stmt.close();
stmt = null;
con.close();
con = null;
}
catch (Exception e)
{
try {
if (con != null) {
con.rollback();
con.close();
con = null;
}
}
catch (Exception catche) {
e.printStackTrace();
BaseLogger.log("0", null, (String)null, (Object)("Exception inside updateLoginTrace[" + catche.getMessage() + "]"));
}
throw new Exception( e );
}
finally {
if (con != null) {
if (stmt != null)
{
stmt.close();
stmt = null;
}
if (mResultSet != null) {
mResultSet.close();
mResultSet = null;
}
if (con != null) {
con.close();
con = null;
}
}
}
BaseLogger.log("0", null, (String)null, (Object)("Print createProfIdArray::::::::::" + createProfIdArray));
return createProfIdArray.toString();
}
//Added by ManishK to set department,grade by default when profile is set on 12-APR-24[END]
}
\ No newline at end of file
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