Commit 7ef2cddd authored by pbhosale's avatar pbhosale

Updated on [19/11/2019] changes done as suggested By Piyush Sir

AdmCommon.java
AllowDednSalComp.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@212440 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 750c1c3f
...@@ -3541,7 +3541,7 @@ public class AdmCommon ...@@ -3541,7 +3541,7 @@ public class AdmCommon
return rndAmt; return rndAmt;
} }
//Added by Azhar K. on[08-07-2019][End] //Added by Azhar K. on[08-07-2019][End]
*/ */
//Modified by Azhar on [27-July-2019][To resolve the issue of job_id][Start] //Modified by Azhar on [27-July-2019][To resolve the issue of job_id][Start]
public HashMap gfGetHrBackgroundJobid(HashMap hrBackGrndJobId,Connection logConn) throws ITMException public HashMap gfGetHrBackgroundJobid(HashMap hrBackGrndJobId,Connection logConn) throws ITMException
...@@ -4719,7 +4719,8 @@ public class AdmCommon ...@@ -4719,7 +4719,8 @@ public class AdmCommon
pstmt.setTimestamp(2, frDateTm); pstmt.setTimestamp(2, frDateTm);
pstmt.setTimestamp(3, toDateTm); pstmt.setTimestamp(3, toDateTm);
resultSet = pstmt.executeQuery(); resultSet = pstmt.executeQuery();
while(resultSet.next()) { while(resultSet.next())
{
holData = new HashMap(); holData = new HashMap();
holDate = resultSet.getTimestamp("hol_date"); holDate = resultSet.getTimestamp("hol_date");
holDateStr = sdf.format(holDate); holDateStr = sdf.format(holDate);
...@@ -5056,20 +5057,101 @@ public class AdmCommon ...@@ -5056,20 +5057,101 @@ public class AdmCommon
{ {
pstmt = conn.prepareStatement(sqlstr); pstmt = conn.prepareStatement(sqlstr);
sqlInput = msqlinput.split(","); sqlInput = msqlinput.split(",");
if(sqlInput.length == 0) //Modified By Poonam B[19/11/2019][START]
{ //if(sqlInput.length == 0)
errorCode = "CONFERR"; if(sqlInput.length > 0)
}
else
{ {
/*errorCode = "CONFERR";
}*/
/*else
{*/
//Modified By Poonam B[19/11/2019][END]
for(int ctr = 0; ctr < sqlInput.length; ctr++) for(int ctr = 0; ctr < sqlInput.length; ctr++)
{ {
counter++; counter++;
input = sqlInput[ctr]; input = sqlInput[ctr];
if(input != null && input.trim().length() > 0) if(input != null && input.trim().length() > 0)
{ {
Object obj = dwobject.get(input); Object obj = dwobject.get(input);
inputType = getHashMapValType(obj); inputType = getHashMapValType(obj);
//Added By Poonam B[19/11/2019][START]
System.out.println("input::::"+input);
System.out.println("inputType::::"+inputType);
System.out.println("msqlinput::::"+msqlinput);
System.out.println("sqlstr::::"+sqlstr);
if(inputType == null || inputType.trim().length() == 0)
{
if((input != null &&input.trim().length() >= 3) && (input.startsWith(":S") || input.startsWith(":N") || input.startsWith(":D")))
{
if(input.startsWith(":S"))
{
String value = input.substring(2);
try
{
int pos1 = Integer.parseInt(value)-1;
String data = (String) envVarStr.get(pos1);
pstmt.setString(counter, data);
}
catch(Exception e)
{
e.printStackTrace();
errorCode = "CONFIGUREERR\t"+e.getMessage();
returnMap.put("errorcode", errorCode);
returnMap.put("value", 0.0d);
}
}
else if(input.startsWith(":N"))
{
String value = input.substring(2);
try
{
int pos1 = Integer.parseInt(value)-1;
double data = (double) envVarNum.get(pos1);
pstmt.setDouble(counter, data);
}
catch(Exception e)
{
e.printStackTrace();
errorCode = "CONFIGUREERR\t"+e.getMessage();
returnMap.put("errorcode", errorCode);
returnMap.put("value", 0.0d);
}
}
else if(input.startsWith(":D"))
{
String dateStr = input.substring(2);
try
{
int pos1 = Integer.parseInt(dateStr)-1;
Timestamp date1 = (Timestamp) envVarDate.get(pos1);
Timestamp date = Timestamp.valueOf(genericUtility.getValidDateString(date1.toString(), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())+" 00:00:00.0");
pstmt.setTimestamp(counter,date);
}
catch(Exception e)
{
e.printStackTrace();
errorCode = "CONFIGUREERR\t"+e.getMessage();
returnMap.put("errorcode", errorCode);
returnMap.put("value", 0.0d);
}
}
else
{
errorCode = "CONFIGUREERR";
break;
}
}
else
{
pstmt.setString(counter, input);
}
}
else
{
//Added By Poonam B[18/11/2019][END]
if(inputType.contains("String")) if(inputType.contains("String"))
{ {
pstmt.setString(counter, obj.toString()); pstmt.setString(counter, obj.toString());
...@@ -5090,9 +5172,21 @@ public class AdmCommon ...@@ -5090,9 +5172,21 @@ public class AdmCommon
else else
{ {
errorCode = "CONFIGUREERR"; errorCode = "CONFIGUREERR";
break; //Added By Poonam B on[19/11/2019]
} }
} }
} }
//Added By Poonam B on[19/11/2019][START]
if(errorCode != null && errorCode.trim().length() > 0)
{
break;
}
//Added By Poonam B on[19/11/2019][END]
}
}
//Modified By Poonam B on[19/11/2019][START]
if(errorCode == null || errorCode.trim().length() == 0)
{
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
String resultType = rs.getMetaData().getColumnTypeName(1); String resultType = rs.getMetaData().getColumnTypeName(1);
if(resultType.equalsIgnoreCase("NUMBER")) if(resultType.equalsIgnoreCase("NUMBER"))
...@@ -5117,13 +5211,29 @@ public class AdmCommon ...@@ -5117,13 +5211,29 @@ public class AdmCommon
pstmt = null; pstmt = null;
} }
} }
//Modified By Poonam B on[19/11/2019][END]
returnMap.put("errorcode", errorCode); returnMap.put("errorcode", errorCode);
returnMap.put("value", outputSql); returnMap.put("value", outputSql);
} }
//Added By Poonam B on[19/11/2019][START]
catch(SQLException e)
{
e.printStackTrace();
errorCode = "SQLERR\t"+e.getMessage();
returnMap.put("errorcode", errorCode);
returnMap.put("value", 0.0d);
}
//Added By Poonam B on[19/11/2019][END]
catch(Exception e) catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); //Modified By Poonam B[18/11/2019][START]
//throw new ITMException(e);
errorCode = "CONFIGUREERR\t"+e.getMessage();
returnMap.put("errorcode", errorCode);
returnMap.put("value", 0.0d);
//Modified By Poonam B[18/11/2019][END]
} }
finally finally
{ {
...@@ -5139,7 +5249,14 @@ public class AdmCommon ...@@ -5139,7 +5249,14 @@ public class AdmCommon
} }
} }
System.out.println("returnMap in gfGetResSqlNvo:: "+returnMap); System.out.println("returnMap in gfGetResSqlNvo:: "+returnMap);
//Added By Poonam B on[19/11/2019][START][To fetch sql Error]
if(errorCode != null && errorCode.trim().length() > 0)
{
String errStr = (String) returnMap.get("errorcode");
errStr = errStr +"[SQL : " +sqlstr+ "]" + "[SQL INPUT : " +msqlinput+ "]";
returnMap.put("errorcode", errStr);
}
//Added By Poonam B on[19/11/2019][END][To fetch sql Error]
return returnMap; return returnMap;
} }
......
...@@ -1113,6 +1113,15 @@ public class AllowDednSalComp ...@@ -1113,6 +1113,15 @@ public class AllowDednSalComp
retMap = null; retMap = null;
// Modified by Piyush on 07/09/2019 [to create all ad code maps for select in formula].Start // Modified by Piyush on 07/09/2019 [to create all ad code maps for select in formula].Start
// retMap = admCommon.gfGetResSqlNvo(strResFormula, adMap.get("SQL_INPUT").toString(), argEmpDataMap, "w_payroll_splitgen_acc", argStrVars, argStrDate, argDblVars, argConn); // retMap = admCommon.gfGetResSqlNvo(strResFormula, adMap.get("SQL_INPUT").toString(), argEmpDataMap, "w_payroll_splitgen_acc", argStrVars, argStrDate, argDblVars, argConn);
//Added By Poonam B[18/11/2019][START]
System.out.println("strResFormula::::" +strResFormula);
System.out.println("SQL_INPUT::::" +adMap.get("SQL_INPUT").toString());
System.out.println("allInputMap::::" +allInputMap);
System.out.println("argStrVars::::" +argStrVars);
System.out.println("argStrDate::::" +argStrDate);
System.out.println("argDblVars::::" +argDblVars);
System.out.println("argConn:::::" +argConn);
//Added By Poonam B[18/11/2019][END]
retMap = admCommon.gfGetResSqlNvo(strResFormula, adMap.get("SQL_INPUT").toString(), allInputMap, "w_payroll_splitgen_acc", argStrVars, argStrDate, argDblVars, argConn); retMap = admCommon.gfGetResSqlNvo(strResFormula, adMap.get("SQL_INPUT").toString(), allInputMap, "w_payroll_splitgen_acc", argStrVars, argStrDate, argDblVars, argConn);
if(retMap.containsKey("errorcode")) if(retMap.containsKey("errorcode"))
{ {
......
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