Package com.sogou.qadev.service.login.bean

Examples of com.sogou.qadev.service.login.bean.Key


public class QuitBugMoveController extends BaseController{
 
  @ResponseBody
  @RequestMapping("/getUserTemplate.do")
  public String getUserTemplate(HttpSession httpSession) throws Exception {
    Key key   = ((Key)httpSession.getAttribute("key"));
    Long keyId = (Long)httpSession.getAttribute("kid");
    das = DataAccessFactory.getInstance().createDataAccessSession(key.getUsername(), keyId);
   
    Template[] allTemplates = DataManager.getInstance().queryUserTemplates(das);
   
    JSONArray json = JSONArray.fromObject(allTemplates);
    return json.toString();
View Full Code Here


   * @throws Exception
   */
  @ResponseBody
  @RequestMapping("/quitUserTaskMove.do")
  public String getUserNoCloseData(HttpSession httpSession , @RequestParam("templateId") String templateIdStr, @RequestParam("quitUserName") String quitUserName , @RequestParam("newUserName") String newUserName ,@RequestParam("actionComment") String actionComment, @RequestParam("roleId") String roleIdStr) throws Exception {
    Key key   = ((Key)httpSession.getAttribute("key"));
    Long keyId = (Long)httpSession.getAttribute("kid");
    das = DataAccessFactory.getInstance().createDataAccessSession(key.getUsername(), keyId);
   
    UUID roleId = DataAccessFactory.getInstance().createUUID(roleIdStr);
    if (roleId == null) {
      return "请选择角色";
    }
   
    if (templateIdStr == null || templateIdStr.length() == 0 ) {
      return "表单不能为空";
    }
    UUID templateId = DataAccessFactory.getInstance().createUUID(templateIdStr);
   
   
    Template template = das.queryTemplate(templateId);
    if (template == null) {
      return "无法找到该表单";
    }
    Flow flow = das.queryFlow(template.getFlowId());
    if (flow == null) {
      return "无法找到该流程";
    }
   
    List<String> allQuitUser = new ArrayList<String>();
    if (quitUserName != null && quitUserName.equals("all")) {
      List<UserInfo> allQuitUserList =  getAllQuitUser(template, flow, roleId);
      for (UserInfo userInfo : allQuitUserList) {
        allQuitUser.add(userInfo.getUserName());
      }
    }else {
      allQuitUser.add(quitUserName);
    }
   
    List<Data> allNeedMoveDataList = new ArrayList<Data>();
    for (String user : allQuitUser) {
      allNeedMoveDataList.addAll(getTemplateUserNoCloseData(template, flow, user));
    }
   
    StringBuffer errorDataBuffer = new StringBuffer();
   
    for (Data tempData : allNeedMoveDataList) {
      Data data = das.queryData(tempData.getId(), templateId);
      if (data != null) {
        try {
          Map<String, Pair<Object, Object>> baseValueMap = new HashMap<String, Pair<Object,Object>>();
          Map<UUID, Pair<Object, Object>> extValueMap =  new HashMap<UUID, Pair<Object,Object>>();
         
          if(data.getAssignUsername() == null && newUserName != null || data.getAssignUsername() != null && newUserName == null
            || data.getAssignUsername() != null && newUserName != null && !data.getAssignUsername().equals(newUserName)){
            baseValueMap.put("assignUser", new Pair<Object, Object>(data.getAssignUsername(), newUserName));
          }
         
          data.setAssignUsername(newUserName);
         
          data.setObject("logCreateUser", key.getUsername());
         
          data.setObject("logActionId", null);
         
          if(actionComment != null && actionComment.length() > 0){
            data.setObject("logActionComment", actionComment);
View Full Code Here

   * @throws Exception
   */
  @ResponseBody
  @RequestMapping("/getStatisticField.do")
  public String getStatisticField(@RequestParam("templateId") String templateIdStr, HttpSession httpSession) throws Exception {
    Key key   = ((Key)httpSession.getAttribute("key"));
    Long keyId = (Long)httpSession.getAttribute("kid");
   
    das = DataAccessFactory.getInstance().createDataAccessSession(key.getUsername(), keyId);
   
    List<StatisticField> allFieldList = new ArrayList<BugStatisticController.StatisticField>();
     Template template = das.queryTemplate(DataAccessFactory.getInstance().createUUID(templateIdStr));
   
     allFieldList.add(new StatisticField("statusId", "状态"));
View Full Code Here

   * @throws Exception
   */
  @ResponseBody
  @RequestMapping("/getFieldOption.do")
  public String getFieldOption(@RequestParam("templateId") String templateIdStr, @RequestParam("fieldId") String fieldIdStr, HttpSession httpSession) throws Exception {
    Key key   = ((Key)httpSession.getAttribute("key"));
    Long keyId = (Long)httpSession.getAttribute("kid");
   
    das = DataAccessFactory.getInstance().createDataAccessSession(key.getUsername(), keyId);
   
    Set<StatisticField> allFieldSet = new HashSet<BugStatisticController.StatisticField>();
   
     Template template = das.queryTemplate(DataAccessFactory.getInstance().createUUID(templateIdStr));
   
View Full Code Here

   * @throws Exception
   */
  @ResponseBody
  @RequestMapping("/getBugData.do")
  public String getBugData(HttpServletRequest request, HttpServletResponse response, HttpSession httpSession) throws Exception {
    Key key   = ((Key)httpSession.getAttribute("key"));
    Long keyId = (Long)httpSession.getAttribute("kid");
   
    das = DataAccessFactory.getInstance().createDataAccessSession(key.getUsername(), keyId);
   
    String templateIdStr = request.getParameter("templateId");
    String fieldIdStr = request.getParameter("fieldId");
    String startTime = request.getParameter("startTime");
    String endTime = request.getParameter("endTime");
View Full Code Here

   * @throws Exception
   */
  @RequestMapping("/getStatisticInfo.do")
  @ResponseBody
  public String getStatisticInfo(HttpServletRequest request, HttpServletResponse response ,HttpSession session) throws Exception {
    Key key = (Key)session.getAttribute("key");
    String statisticId = request.getParameter("statisticId");
    return JSONArray.toJSONString(StatisticerManager.
        getStatisticResultById(DataAccessFactory.getInstance().createUUID(statisticId), key.getUsername()));
  }
View Full Code Here

   * @throws Exception
   */
  @ResponseBody
  @RequestMapping("/getUserTemplate.do")
  public String getUserTemplate(HttpServletRequest request , HttpSession httpSession) throws Exception {
    Key key   = ((Key)httpSession.getAttribute("key"));
    Long keyId = (Long)httpSession.getAttribute("kid");
    String templateTypeId = request.getParameter("templateTypeId");
    UUID templateTypeUUID = null;
    if (templateTypeId != null && !templateTypeId.equals("")) {
      templateTypeUUID = DataAccessFactory.getInstance().createUUID(templateTypeId);
    }
   
    das = DataAccessFactory.getInstance().createDataAccessSession(key.getUsername(), keyId);
    Template[] allTemplates = DataManager.getInstance().queryUserTemplates(das);
   
    Set<Pair<String, String>> allTemplateSet = new HashSet<Pair<String, String>>();
     
    for (Template template : allTemplates) {
View Full Code Here

   * @throws Exception
   */
  @ResponseBody
  @RequestMapping("/getUserReadableTemplate.do")
  public String getUserReadableTemplate(HttpServletRequest request , HttpSession httpSession) throws Exception {
    Key key   = ((Key)httpSession.getAttribute("key"));
    Long keyId = (Long)httpSession.getAttribute("kid");
    String templateTypeId = request.getParameter("templateTypeId");
    UUID templateTypeUUID = null;
    if (templateTypeId != null && !templateTypeId.equals("")) {
      templateTypeUUID = DataAccessFactory.getInstance().createUUID(templateTypeId);
    }
   
    das = DataAccessFactory.getInstance().createDataAccessSession(key.getUsername(), keyId);
    Template[] allTemplates = DataManager.getInstance().queryUserReadableTemplates(templateTypeUUID,das);
   
    Set<Pair<String, String>> allTemplateSet = new HashSet<Pair<String, String>>();
     
    for (Template template : allTemplates) {
View Full Code Here

  @RequestMapping("/update.do")
  @ResponseBody
  public String update(HttpServletRequest request, HttpServletResponse response ,HttpSession session) throws Exception {
   

    Key key = (Key)session.getAttribute("key");
    String statId = request.getParameter("statId");
    String statName = request.getParameter("statName");
    String params = request.getParameter("params");
    params = CynthiaUtil.getXMLStr(params);
    String isSendMail = request.getParameter("isSendMail");
    String[] month = request.getParameterValues("month[]");
    String[] date = request.getParameterValues("date[]");
    String[] week = request.getParameterValues("week[]");
    String hour = request.getParameter("hour[]");
    String minute = request.getParameter("minute[]");
    String recievers = request.getParameter("recievers");

    params = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + params;
    TimerAction timerAction = null;
    Timer timer = null;
    if (statId == null || statId.equals("")) {
      //新创建
      timerAction = das.createTimerAction();
      timerAction.setClassName("com.sogou.qadev.service.cynthia.service.StatisticerManager");
      timerAction.setMethod("execute");
      timerAction.setName(statName);
      timerAction.setCreateUser(key.getUsername());
      timerAction.setParam(params);
      if (isSendMail != null && isSendMail.equals("true") && recievers != null && !recievers.equals("")) {
        timer = das.createTimer(key.getUsername());
        timer.setActionId(timerAction.getId());
        timer.setActionParam(timerAction.getParam());
        timer.setName(timerAction.getName());
        timer.setRetry(true);
        timer.setRetryAccount(5);
        timer.setRetryDelay(50000);
        timer.setSendNull(true);
        timer.setStart(true);
        timer.setMonth(CommonUtil.arrayToStr(month));
        timer.setWeek(CommonUtil.arrayToStr(week));
        timer.setDay(CommonUtil.arrayToStr(date));
        timer.setHour(hour);
        timer.setMinute(minute);
        das.addTimer(timer);
      }

      return String.valueOf(das.addTimerAction(timerAction).equals(ErrorCode.success));
    }else {
      timerAction = das.queryTimerAction(DataAccessFactory.getInstance().createUUID(statId));
      //更新统计
      timerAction.setName(statName);
      timerAction.setParam(params);

      Timer[] timerArray = das.queryTimersByActionId(timerAction.getId());

      if (timerArray.length > 0) {
        //己存在定时器更新定时器
        for(int i = 0; i < timerArray.length; i++){
          if(timerArray[i].getActionId().toString().equals(timerAction.getId().toString())){
            timer = timerArray[i];
            timer.setActionParam(timerAction.getParam());
            timer.setName(timerAction.getName());

            if (isSendMail != null && isSendMail.equals("false")) {
              //时间为空则直接删除timer
              das.removeTimer(timer.getId());
            }else {
              //否则更新timer时间
              timer.setMonth(CommonUtil.arrayToStr(month));
              timer.setWeek(CommonUtil.arrayToStr(week));
              timer.setDay(CommonUtil.arrayToStr(date));
              timer.setHour(hour);
              timer.setMinute(minute);
              das.modifyTimer(timer);
            }
            break;
          }
        }
      }else {
        //不存在,创建定时器
        if (isSendMail != null && isSendMail.equals("true") && recievers != null && !recievers.equals("")) {
          timer = das.createTimer(key.getUsername());
          timer.setActionId(timerAction.getId());
          timer.setActionParam(timerAction.getParam());
          timer.setName(timerAction.getName());
          timer.setRetry(true);
          timer.setRetryAccount(5);
View Full Code Here

      if (requestURI.contains(magicUrl)) {
        nextFilter.doFilter(request, response);
        return;
      }
    }
    Key key = (Key) session.getAttribute("key");
    // //线上环境结束
    String userName = (String) session.getAttribute("userName");
    if (key != null) {
      userName = key.getUsername();
    } else if (key == null && userName != null) {
      Key tempKey = new Key();
      tempKey.setUsername(userName);
      session.setAttribute("key", tempKey);
    } else if (key == null && userName == null) {
      Cookie userNameCookie = CookieManager.getCookieByName(httpRequest,"login_username");
      if (userNameCookie != null) {
          userName = trimSafe(userNameCookie.getValue());
          Key tempKey = new Key();
          tempKey.setUsername(userName);
          session.setAttribute("userName", userName);
          session.setAttribute("key", tempKey);
      }
     
      UserInfo userInfo = das.queryUserInfoByUserName(userName);
View Full Code Here

TOP

Related Classes of com.sogou.qadev.service.login.bean.Key

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.