Commit 42eb255a authored by skumbhar's avatar skumbhar

changes made for escalation.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97884 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a4194802
......@@ -10,7 +10,8 @@ import java.sql.SQLException;
public class PayAprvActivityStatus
{
public String confirm(String tranId, String empCodeAprv, String xmlDataAll, String processId, String keyFlag) throws RemoteException, ITMException
public String confirm(String tranId, String empCodeAprv, String xmlDataAll, String processId, String keyFlag) throws RemoteException, ITMException
{
System.out.println("Activity Check JB");
System.out.println("Parameters ::: tranId[" + tranId + "], empCodeAprv[" + empCodeAprv + "], xmlDataAll[" + xmlDataAll + "],processId["+processId+"],keyFlag["+keyFlag+"]");
......@@ -26,11 +27,10 @@ public class PayAprvActivityStatus
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
conn.setAutoCommit(false);
long counter= 0;
String role_code__sign = "";
empCodeAprv = empCodeAprv == null ? "" : empCodeAprv.trim();
String signStatus1 = "", signStatus2 = "";
String activityId1 = "", roleCode1 = "";
String activityId2 = "", roleCode2 = "";
if("CHKUSRCOND".equalsIgnoreCase(keyFlag))
{
......@@ -56,63 +56,174 @@ public class PayAprvActivityStatus
pstmt.close();
pstmt = null;
}
else if ("BOTHAPPROVAL".equalsIgnoreCase(keyFlag))
{
sql = "select count(s.ref_id) counter,s3.role_code__sign from obj_sign_trans s join " +
"(select s1.ref_id,s1.role_code__sign from obj_sign_trans s1 " +
"where ltrim(rtrim(s1.REF_SER)) = 'M-PAY' AND ltrim(rtrim(s1.REF_ID)) = ? and s1.sign_status = 'S' " +
"and s1.sign_date = (select max(s2.sign_date) from obj_sign_trans s2 " +
"where s2.ref_id = s1.ref_id and s2.sign_status = s1.sign_status)) s3 on s3.ref_id = s.ref_id " +
"where ltrim(rtrim(s.REF_SER)) = 'M-PAY' AND ltrim(rtrim(s.REF_ID)) = ? and " +
"s.sign_status = 'S' group by s3.role_code__sign";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
pstmt.setString(2, tranId);
rs = pstmt.executeQuery();
if (rs.next())
{
counter = rs.getLong("counter");
role_code__sign = rs.getString("role_code__sign");
}
System.out.println("counter = " + counter + "role_code__sign = " + role_code__sign );
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(counter == 2)
{
retString = role_code__sign;
}
else
{
if("First".equalsIgnoreCase(keyFlag))
retString = "NA";
}
}
else
{
int resultCnt = 0;
String signStatus = "", userCode = "", processInfo[] = null, activityId = "", roleCode = "";
if("J2".equalsIgnoreCase(keyFlag))
{
activityId = "J2_SIGN"; roleCode = "RLCDJ2F";
}
else if("J2L5K".equalsIgnoreCase(keyFlag))
{
activityId = "J2L5K_SIGN"; roleCode = "RLCDJ2L5KF";
}
else if("J2L1".equalsIgnoreCase(keyFlag))
{
activityId = "J2L1_SIGN"; roleCode = "RLCDJ2L1F";
}
else if("J2L2".equalsIgnoreCase(keyFlag))
{
activityId = "J2L2_SIGN"; roleCode = "RLCDJ2L2F";
}
else if("J2L5".equalsIgnoreCase(keyFlag))
{
activityId = "J2L5_SIGN"; roleCode = "RLCDJ2L5F";
}
if("J21".equalsIgnoreCase(keyFlag))
{
activityId = "J21_SIGN"; roleCode = "RLCDJ2S";
}
else if("J2L5K1".equalsIgnoreCase(keyFlag))
{
activityId = "J2L5K1_SIGN"; roleCode = "RLCDJ2L5KS";
}
else if("J2L11".equalsIgnoreCase(keyFlag))
{
activityId1 = "J2_SIGN"; roleCode1 = "RLCDJ2F";
activityId2 = "J21_SIGN"; roleCode2 = "RLCDJ2S";
activityId = "J2L11_SIGN"; roleCode = "RLCDJ2L1S";
}
else if("Second".equalsIgnoreCase(keyFlag))
else if("J2L21".equalsIgnoreCase(keyFlag))
{
activityId1 = "J2L5K_SIGN"; roleCode1 = "RLCDJ2L5KF";
activityId2 = "J2L5K1_SIGN"; roleCode2 = "RLCDJ2L5KS";
activityId = "J2L21_SIGN"; roleCode = "RLCDJ2L2S";
}
else if("Third".equalsIgnoreCase(keyFlag))
else if("J2L51".equalsIgnoreCase(keyFlag))
{
activityId1 = "J2L1_SIGN"; roleCode1 = "RLCDJ2L1F";
activityId2 = "J2L11_SIGN"; roleCode2 = "RLCDJ2L1S";
activityId = "J2L51_SIGN"; roleCode = "RLCDJ2L5S";
}
else if("Fourth".equalsIgnoreCase(keyFlag))
else if("HOD".equalsIgnoreCase(keyFlag))
{
activityId1 = "J2L2_SIGN"; roleCode1 = "RLCDJ2L2F";
activityId2 = "J2L21_SIGN"; roleCode2 = "RLCDJ2L2S";
activityId = "HOD_SIGN"; roleCode = "ESCHOD";
}
else if("Fifth".equalsIgnoreCase(keyFlag))
else
{
activityId1 = "J2L5_SIGN"; roleCode1 = "RLCDJ2L5F";
activityId2 = "J2L51_SIGN"; roleCode2 = "RLCDJ2L5S";
activityId = "HODS_SIGN"; roleCode = "ESCHODHODS";
}
System.out.println("activityId["+activityId+"], roleCode["+roleCode+"]");
sql = "select SIGN_STATUS from OBJ_SIGN_TRANS "
+ "WHERE ltrim(rtrim(REF_SER)) = 'M-PAY' AND ltrim(rtrim(REF_ID)) = ? AND ltrim(rtrim(ROLE_CODE__SIGN)) IN(?,?)";
+ "WHERE ltrim(rtrim(REF_SER)) = 'M-PAY' AND ltrim(rtrim(REF_ID)) = ? AND ltrim(rtrim(ROLE_CODE__SIGN)) = ? "
+ "AND SIGN_STATUS = 'U'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
pstmt.setString(2, roleCode1);
pstmt.setString(3, roleCode2);
pstmt.setString(2, roleCode);
rs = pstmt.executeQuery();
if (rs.next())
{
signStatus1 = rs.getString("SIGN_STATUS");
if (rs.next())
{
signStatus2 = rs.getString("SIGN_STATUS");
if (rs.next()) {
signStatus = rs.getString("SIGN_STATUS");
}
System.out.println("signStatus = " + signStatus);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if("U".equalsIgnoreCase(signStatus)){
sql = "select code from users where emp_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCodeAprv);
rs = pstmt.executeQuery();
if (rs.next()) {
userCode = rs.getString("code");
}
System.out.println("signStatus1 = " + signStatus1 + "signStatus1 = " + signStatus2 );
System.out.println("userCode = " + userCode);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(("S".equalsIgnoreCase(signStatus1)) && ("S".equalsIgnoreCase(signStatus2)))
{
retString = "1";
sql = "UPDATE OBJ_SIGN_TRANS "
+ "SET SIGN_DATE = sysdate, USER_ID__SIGN = ?, SIGN_REMARKS = 'HR_SPAN is over', SIGN_STATUS = 'V', EMP_CODE = ? "
+ "WHERE ltrim(rtrim(REF_SER)) = 'M-PAY' AND ltrim(rtrim(REF_ID)) = ? AND ltrim(rtrim(ROLE_CODE__SIGN)) = ? "
+ "AND SIGN_STATUS = 'U'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, userCode);
pstmt.setString(2, empCodeAprv);
pstmt.setString(3, tranId);
pstmt.setString(4, roleCode);
resultCnt += pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Update Successfully:"+resultCnt);
processInfo = processId.split(":");
sql = "UPDATE WF_PRC_STATUS "
+ "SET STATUS_DATE = sysdate, PROCESS_STATUS = 4, ERR_STATUS = '0', "
+ "STATUS_REMARKS='Escalated -> Completing :"+processId+" Invoked :"+processId+"' "
+ "WHERE ltrim(rtrim(REF_SER)) = 'M-PAY' AND REF_ID = ? AND PROCESS_ID = ? AND INSTANCE_ID = ? AND ACTIVITY_ID = ? AND PROCESS_STATUS != 3";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
pstmt.setString(2, processInfo[0]);
pstmt.setString(3, processInfo[1]);
pstmt.setString(4, activityId);
resultCnt += pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Update Successfully:"+resultCnt);
if(resultCnt > 1) {
conn.commit();
retString = "Y";
} else {
conn.rollback();
}
else
{
retString = "0";
} else {
retString = "N";
}
}
}
catch (Exception e)
......
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