Пример #1
0
  @SuppressWarnings("rawtypes")
  public String updateFeedbackStatus() {
    String returnResult = ERROR;
    boolean sessionFlag = ValidateSession.checkSession();
    if (sessionFlag) {
      try {
        HelpdeskUniversalHelper HUH = new HelpdeskUniversalHelper();
        new HelpdeskUniversalAction();
        MsgMailCommunication MMC = new MsgMailCommunication();
        FeedbackPojo fbp = new FeedbackPojo();
        String duration = "NA";
        Map<String, Object> wherClause = new HashMap<String, Object>();
        Map<String, Object> condtnBlock = new HashMap<String, Object>();

        String snDate = "", snTime = "", snUpToDate = "", snUpToTime = "", snDuration = "";
        List ticketData =
            new HelpdeskUniversalAction()
                .getMultipleColumns(
                    "complaint_status",
                    "sn_on_date",
                    "sn_on_time",
                    "sn_upto_date",
                    "sn_upto_time",
                    "sn_duration",
                    "id",
                    getFeedid(),
                    "",
                    "",
                    connectionSpace);
        if (ticketData != null && ticketData.size() > 0) {
          for (Iterator iterator = ticketData.iterator(); iterator.hasNext(); ) {
            Object[] object = (Object[]) iterator.next();
            if (object[0] != null && !object[0].toString().equals("")) {
              snDate = object[0].toString();
            } else {
              snDate = "NA";
            }
            if (object[1] != null && !object[1].toString().equals("")) {
              snTime = object[1].toString();
            } else {
              snTime = "NA";
            }
            if (object[2] != null && !object[2].toString().equals("")) {
              snUpToDate = object[2].toString();
            } else {
              snUpToDate = "NA";
            }
            if (object[3] != null && !object[3].toString().equals("")) {
              snUpToTime = object[3].toString();
            } else {
              snUpToTime = "NA";
            }
            if (object[4] != null && !object[4].toString().equals("")) {
              snDuration = object[4].toString();
            } else {
              snDuration = "NA";
            }
          }
        }

        if (getStatus().equalsIgnoreCase("Resolved")) {
          String cal_duration = "";
          if (open_date != null
              && !open_date.equals("")
              && open_time != null
              && !open_time.equals("")) {
            duration =
                DateUtil.time_difference(
                    DateUtil.convertDateToUSFormat(open_date),
                    open_time,
                    DateUtil.getCurrentDateUSFormat(),
                    DateUtil.getCurrentTime());
          }
          if (!snDuration.equals("") && !snDuration.equals("NA")) {
            boolean flag = DateUtil.time_update(snUpToDate, snUpToTime);
            if (flag) {
              cal_duration = DateUtil.getTimeDifference(duration, snDuration);
              if (cal_duration != null && !cal_duration.equals("") && !cal_duration.contains("-")) {
                duration = cal_duration;
              }
            } else {
              String newduration =
                  DateUtil.time_difference(
                      snDate, snTime, DateUtil.getCurrentDateUSFormat(), DateUtil.getCurrentTime());
              if (newduration != null && !newduration.equals("") && !newduration.equals("NA")) {
                String new_cal_duration = DateUtil.getTimeDifference(duration, newduration);
                if (new_cal_duration != null
                    && !new_cal_duration.equals("")
                    && !new_cal_duration.contains("-")) {
                  duration = new_cal_duration;
                }
              }
            }
          }
          wherClause.put("status", getStatus());
          wherClause.put("action_by", userName);
          wherClause.put("resolve_date", DateUtil.getCurrentDateUSFormat());
          wherClause.put("resolve_time", DateUtil.getCurrentTime());
          wherClause.put("resolve_duration", duration);
          wherClause.put("resolve_remark", DateUtil.makeTitle(getRemark()));
          wherClause.put("resolve_by", getResolver());
          wherClause.put("spare_used", getSpareused());
          wherClause.put("resolve_rca", getRca());
          wherClause.put("resolve_capa", getCapa());
          condtnBlock.put("id", getFeedid());
        } else if (getStatus().equalsIgnoreCase("Snooze")) {
          if (snDate.equals("NA") || snTime.equals("NA")) {
            if (snoozeDate != null
                && !snoozeDate.equals("")
                && snoozeTime != null
                && !snoozeTime.equals("")) {
              duration =
                  DateUtil.time_difference(
                      DateUtil.getCurrentDateUSFormat(),
                      DateUtil.getCurrentTime(),
                      DateUtil.convertDateToUSFormat(snoozeDate),
                      snoozeTime);
            }
          } else {
            if (snoozeDate != null
                && !snoozeDate.equals("")
                && snoozeTime != null
                && !snoozeTime.equals("")) {
              duration =
                  DateUtil.time_difference(
                      snDate, snTime, DateUtil.convertDateToUSFormat(snoozeDate), snoozeTime);
            }
          }

          wherClause.put("status", getStatus());
          wherClause.put("sn_reason", DateUtil.makeTitle(getSnoozecomment()));
          if (snDate.equals("NA") || snTime.equals("NA")) {
            wherClause.put("sn_on_date", DateUtil.getCurrentDateUSFormat());
            wherClause.put("sn_on_time", DateUtil.getCurrentTime());
          }
          wherClause.put("sn_upto_date", DateUtil.convertDateToUSFormat(snoozeDate));
          wherClause.put("sn_upto_time", snoozeTime);
          wherClause.put("sn_duration", duration);
          wherClause.put("action_by", userName);
          condtnBlock.put("id", getFeedid());
        } else if (getStatus().equalsIgnoreCase("High Priority")) {
          wherClause.put("status", getStatus());
          wherClause.put("hp_date", DateUtil.getCurrentDateUSFormat());
          wherClause.put("hp_time", DateUtil.getCurrentTime());
          wherClause.put("hp_reason", DateUtil.makeTitle(getHpcomment()));
          wherClause.put("action_by", userName);
          condtnBlock.put("id", getFeedid());
        } else if (getStatus().equalsIgnoreCase("Ignore")) {
          wherClause.put("status", getStatus());
          wherClause.put("ig_date", DateUtil.getCurrentDateUSFormat());
          wherClause.put("ig_time", DateUtil.getCurrentTime());
          wherClause.put("ig_reason", DateUtil.makeTitle(getIgnorecomment()));
          wherClause.put("action_by", userName);
          condtnBlock.put("id", getFeedid());
        }
        /*else if (getStatus().equalsIgnoreCase("Re-Assign"))
        {
        	String feedBy="NA",mobNo="NA",emailId="NA",bysubdept="NA",feedBrief="NA",location="NA";
        	List existTicketData = new HelpdeskUniversalHelper().getTransferTicketData(getFeedid(), connectionSpace);
        	if (existTicketData!=null && existTicketData.size()>0) {
        		for (Iterator iterator = existTicketData.iterator(); iterator
        				.hasNext();) {
        			Object[] object = (Object[]) iterator.next();
        			if (object[0]!=null && !object[0].toString().equals("")) {
        				feedBy=object[0].toString();
        			}
        			if (object[1]!=null && !object[1].toString().equals("")) {
        				mobNo=object[1].toString();
        			}
        			if (object[2]!=null && !object[2].toString().equals("")) {
        				emailId=object[2].toString();
        			}
        			if (object[3]!=null && !object[3].toString().equals("")) {
        				bysubdept=object[3].toString();
        			}
        			if (object[4]!=null && !object[4].toString().equals("")) {
        				feedBrief=object[4].toString();
        			}
        			if (object[5]!=null && !object[5].toString().equals("")) {
        				location=object[5].toString();
        			}
        		}
        		boolean flag = transferComplaint(feedBy,mobNo,emailId,bysubdept,feedBrief,location,getFeedid());
        		if (flag) {
        			wherClause.put("status", "Transfer");
        			wherClause.put("transfer_date", DateUtil.getCurrentDateUSFormat());
        			wherClause.put("transfer_time", DateUtil.getCurrentTime());
        			wherClause.put("transfer_reason", DateUtil.makeTitle(getReAssignRemark()));
        			wherClause.put("action_by", userName);
        			condtnBlock.put("id", getFeedid());
        		}
        	}

        }*/
        boolean updateFeed =
            HUH.updateTableColomn("complaint_status", wherClause, condtnBlock, connectionSpace);
        if (updateFeed) {
          ComplaintLodgeHelper CLH = new ComplaintLodgeHelper();

          String levelMsg = "",
              complainatMsg = "",
              mailText = "",
              mailSubject = "",
              mailheading = "";
          List data = CLH.getFeedbackDetail(getFeedid(), getStatus(), connectionSpace);
          if (data != null && data.size() > 0) {
            fbp = CLH.setFeedbackDataValues(data, getStatus(), connectionSpace);
          }
          if (getStatus().equalsIgnoreCase("Resolved")) {
            // levelMsg = "Close Feedback Alert: Ticket No: " + fbp.getTicket_no() + ", Reg. By: " +
            // DateUtil.makeTitle(fbp.getFeed_registerby().trim()) + ", Location: " +
            // fbp.getLocation() + ", Brief: " + remark + " is Closed.";
            // complainatMsg = "Dear " + DateUtil.makeTitle(fbp.getFeed_registerby().trim()) + ",
            // Ticket No: " + fbp.getTicket_no() + ", Location: " + fbp.getLocation() + ", Brief: "
            // + remark + " is Closed.";
            mailSubject = "Close Ticket Alert: " + fbp.getTicket_no();
            mailheading = "Close Ticket Alert: " + fbp.getTicket_no();
          } else if (getStatus().equalsIgnoreCase("High Priority")) {
            // levelMsg = "High Priority Alert: Ticket No: " + fbp.getTicket_no() + ", Reg. By : " +
            // DateUtil.makeTitle(fbp.getFeed_registerby().trim()) + ", Location: " +
            // fbp.getLocation() + ", Brief: " + fbp.getFeed_brief() + ",Reason: " +
            // fbp.getHp_reason() + ".";
            // complainatMsg = "Dear " + DateUtil.makeTitle(fbp.getFeed_registerby().trim()) + ",
            // Ticket No: " + fbp.getTicket_no() + ", Location: " + fbp.getLocation() + ", Brief: "
            // + fbp.getFeed_brief() + ",Reason: " + fbp.getHp_reason() + " is on High Priority.";
            mailSubject = "High Priority Feedback Alert: " + fbp.getTicket_no();
            mailheading = "High Priority Case Ticket Alert";
          } else if (getStatus().equalsIgnoreCase("Snooze")) {
            // levelMsg = "Snooze Alert: Ticket No: " + fbp.getTicket_no() + ", Reg. By: " +
            // DateUtil.makeTitle(fbp.getFeed_registerby().trim()) + ", Location: " +
            // fbp.getLocation() + ", Brief: " + fbp.getFeed_brief() + " will be Snoozed till " +
            // fbp.getSn_duration() + ",Reason: " + fbp.getSn_reason() + ".";
            // complainatMsg = "Dear " + DateUtil.makeTitle(fbp.getFeed_registerby().trim()) + ",
            // Ticket No: " + fbp.getTicket_no() + ", Location: " + fbp.getLocation() + ", Brief: "
            // + fbp.getFeed_brief() + ",Status: Snoozed to " + fbp.getSn_on_date() + " " +
            // fbp.getSn_on_time() + " Hrs, Reason:" + fbp.getSn_reason() + ".";
            mailSubject = "Snooze Feedback Alert: " + fbp.getTicket_no();
            mailheading = "Snooze Case Ticket Alert";
          } else if (getStatus().equalsIgnoreCase("Ignore")) {
            // levelMsg = "Ignore Feedback Alert: Ticket No: " + fbp.getTicket_no() + ", Reg. By: "
            // + DateUtil.makeTitle(fbp.getFeed_registerby()) + ", Location: " + fbp.getLocation() +
            // ", Brief: " + fbp.getFeed_brief() + ",Reason: " + fbp.getIg_reason() + " should be
            // Ignored.";
            // complainatMsg = "Dear " + DateUtil.makeTitle(fbp.getFeed_registerby()) + ", Ticket
            // No: " + fbp.getTicket_no() + ", Location: " + fbp.getLocation() + ", Brief: " +
            // fbp.getFeed_brief() + ",Reason: " + fbp.getIg_reason() + " is Ignored.";
            mailSubject = "Ignore Feedback Alert: " + fbp.getTicket_no();
            mailheading = "Ignore Case Ticket Alert";
          }

          if (getStatus().equalsIgnoreCase("Resolved")) {
            /*if (fbp.getFeedback_by_mobno() != null && fbp.getFeedback_by_mobno() != "" && fbp.getFeedback_by_mobno().trim().length() == 10 && (fbp.getFeedback_by_mobno().startsWith("9") || fbp.getFeedback_by_mobno().startsWith("8") || fbp.getFeedback_by_mobno().startsWith("7")))
            {
            	MMC.addMessage(fbp.getFeed_registerby(), fbp.getFeedback_by_dept(), fbp.getFeedback_by_mobno(), complainatMsg, ticket_no, getStatus(), "0", "HDM");
            }*/
            if (fbp.getFeedback_by_emailid() != null && !fbp.getFeedback_by_emailid().equals("")) {
              mailText =
                  CLH.getConfigMessage(
                      fbp,
                      mailheading,
                      getStatus(),
                      false,
                      fbp.getClientFor(),
                      fbp.getClientName(),
                      fbp.getOfferingName());
              MMC.addMail(
                  fbp.getFeed_registerby(),
                  fbp.getFeedback_by_dept(),
                  fbp.getFeedback_by_emailid(),
                  mailSubject,
                  mailText,
                  ticket_no,
                  getStatus(),
                  "0",
                  "",
                  "DREAM_HDM");
            }
            /*if (fbp.getResolve_by_mobno() != null && fbp.getResolve_by_mobno() != "" && fbp.getResolve_by_mobno().trim().length() == 10 && (fbp.getResolve_by_mobno().startsWith("9") || fbp.getResolve_by_mobno().startsWith("8") || fbp.getResolve_by_mobno().startsWith("7")))
            {
            	MMC.addMessage(fbp.getResolve_by(), fbp.getFeedback_to_dept(), fbp.getResolve_by_mobno(), levelMsg, ticket_no, getStatus(), "0", "HDM");
            }*/
            if (fbp.getResolve_by_emailid() != null && !fbp.getResolve_by_emailid().equals("")) {
              mailText =
                  CLH.getConfigMessage(
                      fbp,
                      mailheading,
                      getStatus(),
                      true,
                      fbp.getClientFor(),
                      fbp.getClientName(),
                      fbp.getOfferingName());
              MMC.addMail(
                  fbp.getResolve_by(),
                  fbp.getFeedback_to_dept(),
                  fbp.getResolve_by_emailid(),
                  mailSubject,
                  mailText,
                  fbp.getTicket_no(),
                  "Pending",
                  "0",
                  "",
                  "DREAM_HDM");
            }
          } else if (getStatus().equalsIgnoreCase("High Priority")
              || getStatus().equalsIgnoreCase("Snooze")
              || getStatus().equalsIgnoreCase("Ignore")) {

            /*	if (fbp.getFeedback_by_mobno() != null && fbp.getFeedback_by_mobno() != "" && fbp.getFeedback_by_mobno().trim().length() == 10 && (fbp.getFeedback_by_mobno().startsWith("9") || fbp.getFeedback_by_mobno().startsWith("8") || fbp.getFeedback_by_mobno().startsWith("7")))
            {
            	MMC.addMessage(fbp.getFeed_registerby(), fbp.getFeedback_by_dept(), fbp.getFeedback_by_mobno(), complainatMsg, ticket_no, getStatus(), "0", "HDM");
            }
            	*/
            if (fbp.getFeedback_by_emailid() != null && !fbp.getFeedback_by_emailid().equals("")) {
              mailText =
                  CLH.getConfigMessage(
                      fbp,
                      mailheading,
                      getStatus(),
                      false,
                      fbp.getClientFor(),
                      fbp.getClientName(),
                      fbp.getOfferingName());
              MMC.addMail(
                  fbp.getFeed_registerby(),
                  fbp.getFeedback_by_dept(),
                  fbp.getFeedback_by_emailid(),
                  mailSubject,
                  mailText,
                  ticket_no,
                  getStatus(),
                  "0",
                  "",
                  "DREAM_HDM");
            }
            /*if (fbp.getMobOne() != null && fbp.getMobOne() != "" && fbp.getMobOne().trim().length() == 10 && (fbp.getMobOne().startsWith("9") || fbp.getMobOne().startsWith("8") || fbp.getMobOne().startsWith("7")))
            {
            	MMC.addMessage(fbp.getFeedback_allot_to(), fbp.getFeedback_to_dept(), fbp.getMobOne(), levelMsg, ticket_no, getStatus(), "0", "HDM");
            }*/

            if (fbp.getEmailIdOne() != null && !fbp.getEmailIdOne().equals("")) {
              mailText =
                  CLH.getConfigMessage(
                      fbp,
                      mailheading,
                      getStatus(),
                      true,
                      fbp.getClientFor(),
                      fbp.getClientName(),
                      fbp.getOfferingName());
              MMC.addMail(
                  fbp.getFeedback_allot_to(),
                  fbp.getFeedback_to_dept(),
                  fbp.getEmailIdOne(),
                  mailSubject,
                  mailText,
                  fbp.getTicket_no(),
                  "Pending",
                  "0",
                  "",
                  "DREAM_HDM");
            }
          }
          addActionMessage("Feedback Updated in " + getStatus() + " Successfully !!!");
          returnResult = SUCCESS;
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    } else {
      returnResult = LOGIN;
    }
    return returnResult;
  }
Пример #2
0
  @SuppressWarnings({"rawtypes", "unchecked"})
  public String viewDARReportData() {
    if (ValidateSession.checkSession()) {
      try {
        SessionFactory connectionSpace = (SessionFactory) session.get("connectionSpace");
        CommonOperInterface cbt = new CommonConFactory().createInterface();
        String accountID = (String) session.get("accountid");
        String userName = (String) session.get("uName");
        DARReportHelper DRH = new DARReportHelper();
        TaskRegistrationHelper TRH = new TaskRegistrationHelper();
        StringBuilder query = new StringBuilder("");
        query.append("select count(*) from task_registration");
        List dataCount = cbt.executeAllSelectQuery(query.toString(), connectionSpace);
        if (dataCount != null) {
          BigInteger count = new BigInteger("3");
          Object obdata = null;
          for (Iterator it = dataCount.iterator(); it.hasNext(); ) {
            obdata = (Object) it.next();
            count = (BigInteger) obdata;
          }
          setRecords(count.intValue());
          int to = (getRows() * getPage());
          if (to > getRecords()) to = getRecords();
          String userEmpID = null;
          String alltedTo = null;
          String empIdofuser = (String) session.get("empIdofuser");
          if (empIdofuser == null || empIdofuser.split("-")[1].trim().equals("")) return ERROR;
          userEmpID = empIdofuser.split("-")[1].trim();
          String userContID = null;
          userContID = TRH.getEmpDetailsByUserName("DAR", userName, connectionSpace)[0];
          alltedTo = TRH.getContactListForReports(userEmpID, userContID, connectionSpace);

          // System.out.println(">>>>>> FINAL CONTACT LIST IS AS ::::  "+alltedTo);
          query.setLength(0);
          query.append("SELECT  ");
          List fieldNames =
              Configuration.getColomnList(
                  "mapped_dar_configuration", accountID, connectionSpace, "dar_configuration");
          List<Object> Listhb = new ArrayList<Object>();
          int i = 0;
          for (Iterator it = fieldNames.iterator(); it.hasNext(); ) {
            obdata = (Object) it.next();
            if (obdata != null) {
              if (!obdata.toString().equalsIgnoreCase("userName")
                  && !obdata.toString().equalsIgnoreCase("date")
                  && !obdata.toString().equalsIgnoreCase("time")) {
                if (obdata.toString().equalsIgnoreCase("tasktype")) {
                  query.append("ty.tasktype" + ",");
                } else if (obdata.toString().equalsIgnoreCase("allotedto")) {
                  query.append("emp1.empName as allotedto,");
                } else if (obdata.toString().equalsIgnoreCase("allotedby")) {
                  query.append("emp2.empName as allotedby,");
                } else if (obdata.toString().equalsIgnoreCase("validate_By_2")) {
                  query.append("emp3.empName as val2,");
                } else if (obdata.toString().equalsIgnoreCase("validate_By_1")) {
                  query.append("emp4.empName as val1,");
                } else if (obdata.toString().equalsIgnoreCase("guidance")) {
                  query.append("emp5.empName as guidance,");
                } else {
                  query.append("tr." + obdata.toString() + ",");
                }
              }
            }
            i++;
          }
          fieldNames.remove("userName");
          fieldNames.remove("date");
          fieldNames.remove("time");

          i = 0;
          List gridFields = new ArrayList();
          List fieldNames1 =
              Configuration.getColomnList(
                  "mapped_dar_configuration",
                  accountID,
                  connectionSpace,
                  "dar_submission_configuration");
          for (Iterator it = fieldNames1.iterator(); it.hasNext(); ) {
            obdata = (Object) it.next();
            if (obdata != null) {
              if (!obdata.toString().equalsIgnoreCase("taskname")
                  && !obdata.toString().equalsIgnoreCase("id")
                  && !obdata.toString().equalsIgnoreCase("userName")) {
                gridFields.add(obdata.toString());
                if (i < fieldNames1.size() - 1) query.append("ds." + obdata.toString() + ",");
                else query.append("ds." + obdata.toString());
              }
            }
            i++;
          }
          query.append(" FROM task_registration AS tr ");
          query.append(" LEFT JOIN dar_submission AS ds ON ds.taskname=tr.id ");
          query.append("LEFT JOIN compliance_contacts AS cc1 ON tr.allotedto=cc1.id ");
          query.append("LEFT JOIN compliance_contacts AS cc2 ON tr.allotedby=cc2.id ");
          query.append("LEFT JOIN compliance_contacts AS cc3 ON tr.validate_By_2=cc3.id ");
          query.append("LEFT JOIN compliance_contacts AS cc4 ON tr.validate_By_1=cc4.id ");
          query.append("LEFT JOIN compliance_contacts AS cc5 ON tr.guidance=cc5.id  ");
          query.append("LEFT JOIN employee_basic emp1 ON cc1.emp_id= emp1.id  ");
          query.append("LEFT JOIN employee_basic emp2 ON cc2.emp_id= emp2.id  ");
          query.append("LEFT JOIN employee_basic emp3 ON cc3.emp_id= emp3.id ");
          query.append("LEFT JOIN employee_basic emp4 ON cc4.emp_id= emp4.id ");
          query.append("LEFT JOIN employee_basic emp5 ON cc5.emp_id= emp5.id ");
          query.append("LEFT JOIN task_type ty ON tr.tasktype= ty.id   ");
          if (fdate.split("-")[0].length() < 3) {
            fdate = DateUtil.convertDateToUSFormat(fdate);
            tdate = DateUtil.convertDateToUSFormat(tdate);
          }
          query.append(" WHERE  ds.date BETWEEN '" + fdate + "' AND '" + tdate + "'  ");
          if (allotTo != null && !allotTo.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.allotedTo='" + allotTo + "' ");
          }
          if (clientFor != null && !clientFor.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.clientfor='" + clientFor + "' ");
          }
          if (taskTyp != null && !taskTyp.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.tasktype='" + taskTyp + "' ");
          }
          if (taskPriority != null && !taskPriority.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.priority='" + taskPriority + "' ");
          }
          if (statusWork != null && !statusWork.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.status='" + statusWork + "' ");
          }
          if (alltedTo != null && alltedTo.length() > 0) {
            query.append(" AND  tr.allotedTo IN (" + alltedTo + ") ");
          }
          if (getSearchField() != null
              && getSearchString() != null
              && !getSearchField().equalsIgnoreCase("")
              && !getSearchString().equalsIgnoreCase("")) {
            query.append(" and ");
            if (getSearchOper().equalsIgnoreCase("eq")) {
              query.append(" " + getSearchField() + " = '" + getSearchString() + "'");
            } else if (getSearchOper().equalsIgnoreCase("cn")) {
              query.append(" " + getSearchField() + " like '%" + getSearchString() + "%'");
            } else if (getSearchOper().equalsIgnoreCase("bw")) {
              query.append(" " + getSearchField() + " like '" + getSearchString() + "%'");
            } else if (getSearchOper().equalsIgnoreCase("ne")) {
              query.append(" " + getSearchField() + " <> '" + getSearchString() + "'");
            } else if (getSearchOper().equalsIgnoreCase("ew")) {
              query.append(" " + getSearchField() + " like '%" + getSearchString() + "'");
            }
          }
          System.out.println("QUERY OF REPORT IS AS ::::  " + query.toString());
          List data = cbt.executeAllSelectQuery(query.toString(), connectionSpace);
          for (int k = 0; k < gridFields.size(); k++) {
            fieldNames.add(gridFields.get(k).toString());
          }
          if (data != null && data.size() > 0) {

            String clientData = null;
            String clientVal = null;
            Object[] obdata11 = null;
            for (Iterator it = data.iterator(); it.hasNext(); ) {
              obdata11 = (Object[]) it.next();
              Map<String, Object> one = new HashMap<String, Object>();
              for (int k = 0; k < fieldNames.size(); k++) {
                if (fieldNames.get(k) != null
                    && obdata11[k] != null
                    && !obdata11[k].toString().equalsIgnoreCase("")) {
                  if (obdata11[k].toString().matches("\\d{4}-[01]\\d-[0-3]\\d")) {
                    one.put(
                        fieldNames.get(k).toString(),
                        DateUtil.convertDateToIndianFormat(obdata11[k].toString()));
                  }
                  /*else if(fieldNames.get(k).toString().equalsIgnoreCase("attachment")||  fieldNames.get(k).toString().equalsIgnoreCase("attachmentt")||fieldNames.get(k).toString().equalsIgnoreCase("reviewDoc")  )
                  {
                  	String str=obdata11[k].toString().substring(obdata11[k].toString().indexOf("//"), obdata11[k].toString().length());
                  	String docName=str.substring(14,str.length());
                  	one.put(fieldNames.get(k).toString(),docName);
                  }*/
                  else if (fieldNames.get(k).toString().equalsIgnoreCase("clientfor")) {
                    clientVal = obdata11[k].toString();
                    if (obdata11[k].toString().equalsIgnoreCase("PA")) {
                      one.put(fieldNames.get(k).toString(), "Prospect Associate");
                    } else if (obdata11[k].toString().equalsIgnoreCase("PC")) {
                      one.put(fieldNames.get(k).toString(), "Prospect Client");
                    } else if (obdata11[k].toString().equalsIgnoreCase("N")) {
                      one.put(fieldNames.get(k).toString(), "Other");
                    } else if (obdata11[k].toString().equalsIgnoreCase("EC")) {
                      one.put(fieldNames.get(k).toString(), "Existing Client");
                    } else if (obdata11[k].toString().equalsIgnoreCase("EA")) {
                      one.put(fieldNames.get(k).toString(), "Existing Associate");
                    } else if (obdata11[k].toString().equalsIgnoreCase("IN")) {
                      one.put(fieldNames.get(k).toString(), "Internal");
                    }
                  } else if (fieldNames.get(k).toString().equalsIgnoreCase("cName")) {
                    clientData = obdata11[k].toString();
                    one.put(
                        fieldNames.get(k).toString(),
                        DRH.clientName(clientVal, obdata11[k].toString(), connectionSpace));
                  } else if (fieldNames.get(k).toString().equalsIgnoreCase("offering")) {
                    one.put(
                        fieldNames.get(k).toString(),
                        DRH.offeringName(
                            clientVal, clientData, obdata11[k].toString(), connectionSpace));
                  } else {
                    one.put(fieldNames.get(k).toString(), obdata11[k].toString());
                  }
                } else {
                  one.put(fieldNames.get(k).toString(), "NA");
                }
              }
              Listhb.add(one);
            }
            setViewList(Listhb);
            setTotal((int) Math.ceil((double) getRecords() / (double) getRows()));
          }
        }
        return SUCCESS;
      } catch (Exception exp) {
        exp.printStackTrace();
        return ERROR;
      }
    } else {
      return ERROR;
    }
  }
Пример #3
0
  @SuppressWarnings("rawtypes")
  public String getFeedbackDetail() {
    String returnResult = ERROR;
    boolean sessionFlag = ValidateSession.checkSession();
    if (sessionFlag) {
      try {
        String userName = (String) session.get("uName");
        SessionFactory connectionSpace = (SessionFactory) session.get("connectionSpace");
        ComplaintLodgeHelper CLH = new ComplaintLodgeHelper();
        feedbackList = new ArrayList<FeedbackPojo>();
        List data = null;
        String dept_subdept_id = "";
        String contactLoggedId = null;

        String[] empData =
            CLH.getEmpDetailsByUserName(
                "DREAM_HDM", Cryptography.encrypt(userName, DES_ENCRYPTION_KEY), connectionSpace);
        if (empData != null && empData.length > 0) {
          dept_subdept_id = empData[4];
          contactLoggedId = empData[0];
        }

        if (dept_subdept_id != null && !dept_subdept_id.equals("")) {
          if (dataFlag != null && dataFlag.equals("M")) {
            toDate = DateUtil.convertDateToUSFormat(toDate);
            fromDate = DateUtil.convertDateToUSFormat(fromDate);
          } else {
            toDate = toDate;
            fromDate = fromDate;
          }
          data =
              CLH.getFeedbackDetail(
                  "complaint_status",
                  getFeedStatus(),
                  fromDate,
                  toDate,
                  dept_subdept_id,
                  contactLoggedId,
                  "feedback.id",
                  "ASC",
                  "DREAM_HDM",
                  searchField,
                  searchString,
                  searchOper,
                  connectionSpace);
        }
        if (data != null && data.size() > 0) {
          setRecords(data.size());
          int to = (getRows() * getPage());
          @SuppressWarnings("unused")
          int from = to - getRows();
          if (to > getRecords()) to = getRecords();

          feedbackList = CLH.setFeedbackValues(data, getFeedStatus(), connectionSpace);

          setTotal((int) Math.ceil((double) getRecords() / (double) getRows()));
        }
        returnResult = SUCCESS;
      } catch (Exception e) {
        addActionError("Ooops!!! There is some problem in getting Feedback Data");
        e.printStackTrace();
      }
    } else {
      returnResult = LOGIN;
    }
    return returnResult;
  }
  @SuppressWarnings("rawtypes")
  public String viewAuditReport() {
    System.out.println("viewAuditReport");
    boolean sessionFlag = ValidateSession.checkSession();
    if (sessionFlag) {
      try {
        masterViewList = new ArrayList<Object>();
        List<Object> Listhb = new ArrayList<Object>();
        List dataList = null;
        StringBuilder query = new StringBuilder();
        query.append(
            "SELECT far.id,feed.clientId,feed.patientId,feed.clientName,far.feedDataId,action_type,far.comments,action_by FROM feedback_audit_report AS far ");
        query.append(" INNER JOIN feedbackdata AS feed ON feed.id=far.feedDataId ");
        query.append(" WHERE far.id!=0 ");
        if (getFromDate() != null
            && getToDate() != null
            && !getFromDate().equalsIgnoreCase("")
            && !getToDate().equalsIgnoreCase("")) {
          String str[] = getFromDate().split("-");
          if (str[0] != null && str[0].length() > 3) {
            query.append(
                " AND far.insert_date BETWEEN '"
                    + ((getFromDate()))
                    + "' AND '"
                    + ((getToDate()))
                    + "'");
          } else {
            query.append(
                " AND far.insert_date BETWEEN '"
                    + (DateUtil.convertDateToUSFormat(getFromDate()))
                    + "' AND '"
                    + (DateUtil.convertDateToUSFormat(getToDate()))
                    + "'");
          }
        }
        query.append(" ORDER BY far.id DESC ");
        System.out.println("query data:::::" + query);
        dataList = cbt.executeAllSelectQuery(query.toString(), connectionSpace);
        if (dataList != null && dataList.size() > 0) {
          for (Iterator iterator = dataList.iterator(); iterator.hasNext(); ) {
            Object[] object = (Object[]) iterator.next();
            Map<String, Object> one = new HashMap<String, Object>();
            one.put("id", (object[0]));
            if (object[1] != null) {
              one.put("clientId", (object[1]));
            }

            if (object[2] != null && !object[2].equals("-1")) {
              one.put("patientId", (object[2]));
            } else {
              one.put("patientId", "NA");
            }
            if (object[3] != null && !object[3].equals("-1")) {
              one.put("clientName", (object[3]));
            } else {
              one.put("clientName", "NA");
            }
            if (object[4] != null && !object[4].equals("-1")) {
              one.put("feedDataId", (object[4]));
            } else {
              one.put("feedDataId", "NA");
            }
            if (object[5] != null && !object[5].equals("-1")) {
              one.put("action_type", (object[5]));
            } else {
              one.put("action_type", "NA");
            }
            if (object[6] != null && !object[6].equals("-1")) {
              one.put("comments", (object[6]));
            } else {
              one.put("comments", "NA");
            }
            if (object[7] != null && !object[7].equals("-1")) {
              one.put("action_by", (object[7]));
            } else {
              one.put("action_by", "NA");
            }
            Listhb.add(one);
          }
        }
        setMasterViewList(Listhb);
        if (masterViewList != null && masterViewList.size() > 0) {
          setRecords(masterViewList.size());
          int to = (getRows() * getPage());
          @SuppressWarnings("unused")
          int from = to - getRows();
          if (to > getRecords()) to = getRecords();

          setTotal((int) Math.ceil((double) getRecords() / (double) getRows()));
        }
        return SUCCESS;
      } catch (Exception e) {
        e.printStackTrace();
        return ERROR;
      }
    } else {
      return LOGIN;
    }
  }