Search in sources :

Example 11 with ProjectExample

use of com.itrus.portal.db.ProjectExample in project portal by ixinportal.

the class OnlineServiceController method updateshow.

/**
 * 跳转修改页面
 *
 * @param id
 * @return
 */
@RequestMapping(value = "/updateshow/{id}", produces = "text/html")
public String updateshow(@PathVariable("id") Long id, Model uiModel) {
    EnterpriseQq enterprise = onlineService.selectEnterprise(id);
    // Long qq_state=enterprise.getQqState();
    // Long custerm_service_state=enterprise.getCustermServiceState();
    // Map<Long, List<CustomerService>> listmain = new HashMap<Long,
    // List<CustomerService>>();
    CustomerServiceExample customerE = new CustomerServiceExample();
    CustomerServiceExample.Criteria serviceE = customerE.createCriteria();
    int cid = Integer.parseInt(enterprise.getId().toString());
    serviceE.andEnterpriseIdEqualTo(cid);
    List<CustomerService> listcustomer = onlineService.selectServiceList(customerE);
    // CustomerServiceExample customerE = new CustomerServiceExample();
    // List<CustomerService> customerService =
    // onlineService.selectServiceList(customerE);
    Map<Long, Object> map = new HashMap<>();
    String json = "";
    for (CustomerService c : listcustomer) {
        String str = null;
        try {
            str = jsonTool.writeValueAsString(c);
            ObjectMapper mapper = new ObjectMapper();
            json = mapper.writeValueAsString(map);
        } catch (Exception e) {
            e.printStackTrace();
        }
        map.put(c.getId(), str);
    }
    try {
        uiModel.addAttribute("json", jsonTool.writeValueAsString(json));
        uiModel.addAttribute("json1", jsonTool.writeValueAsString(listcustomer));
    } catch (Exception e) {
        e.printStackTrace();
    }
    ProjectExample projectE = new ProjectExample();
    List<Project> project = projectService.getProjectByExample(projectE);
    // 查询默认客服的数据
    EnterpriseQqExample enterpriseE = new EnterpriseQqExample();
    EnterpriseQqExample.Criteria qqEx = enterpriseE.createCriteria();
    qqEx.andEnterpriseQqStateEqualTo(0L);
    EnterpriseQq enterpriseqq = onlineService.selectQq(enterpriseE);
    // 查询默认客服的数据
    CustomerServiceExample customerEX = new CustomerServiceExample();
    CustomerServiceExample.Criteria serviceEX = customerEX.createCriteria();
    serviceEX.andServiceStateEqualTo(0);
    CustomerService customerService = onlineService.selectService(customerEX);
    if (customerService == null) {
        uiModel.addAttribute("customerstatus", 1);
    }
    if (enterpriseqq == null) {
        uiModel.addAttribute("qqstatus", 1);
    }
    uiModel.addAttribute("enterprise", enterprise);
    uiModel.addAttribute("listcustomer", listcustomer);
    uiModel.addAttribute("projectList", project);
    return "onlineservices/update";
}
Also used : CustomerService(com.itrus.portal.db.CustomerService) CustomerServiceExample(com.itrus.portal.db.CustomerServiceExample) HashMap(java.util.HashMap) ProjectExample(com.itrus.portal.db.ProjectExample) Project(com.itrus.portal.db.Project) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) JSONObject(com.alibaba.fastjson.JSONObject) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) ObjectMapper(org.codehaus.jackson.map.ObjectMapper) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 12 with ProjectExample

use of com.itrus.portal.db.ProjectExample in project portal by ixinportal.

the class DownloadConfigController method createForm.

// 返回新建页面
@RequestMapping(params = "form", produces = "text/html")
public String createForm(@RequestParam(value = "status", required = false) Integer status, Model uiModel) {
    if (status == 2) {
        // 管理员项目权限
        Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
        // param.put("hasProjects", Arrays.asList(projectsOfAdmin));
        List<Map<String, Object>> projectIds = configServiceImpl.getProjects();
        List<Long> pids = new ArrayList<>();
        for (Map<String, Object> p : projectIds) {
            pids.add((Long) p.get("project"));
        }
        uiModel.addAttribute("pids", pids);
        // 获取所有项目信息
        ProjectExample projectExample = new ProjectExample();
        ProjectExample.Criteria pec = projectExample.createCriteria();
        pec.andIdIn(Arrays.asList(projectsOfAdmin));
        List<Project> projects = projectServiceImpl.getProjectByExample(projectExample);
        uiModel.addAttribute("projects", projects);
        // 获取所有文件信息
        List<FileConfig> fileConfigs = configServiceImpl.getList(new FileConfigExample());
        uiModel.addAttribute("fileConfigs", fileConfigs);
        try {
            uiModel.addAttribute("jsonFile", jsonTool.writeValueAsString(fileConfigs));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return "downloadconfig/create2";
    } else {
        if (status == 3) {
            uiModel.addAttribute("message", "创建文件信息失败!");
        }
        return "downloadconfig/create1";
    }
}
Also used : FileConfig(com.itrus.portal.db.FileConfig) ProjectExample(com.itrus.portal.db.ProjectExample) ArrayList(java.util.ArrayList) Project(com.itrus.portal.db.Project) FileConfigExample(com.itrus.portal.db.FileConfigExample) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 13 with ProjectExample

use of com.itrus.portal.db.ProjectExample in project portal by ixinportal.

the class DownloadConfigController method list.

// 列表所有信息
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "status", required = false) Integer status, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "page2", required = false) Integer page2, @RequestParam(value = "size2", required = false) Integer size2, @RequestParam(value = "name", required = false) String name, @RequestParam(value = "description", required = false) String description, @RequestParam(value = "queryDate1", required = false) Date queryDate1, @RequestParam(value = "queryDate2", required = false) Date queryDate2, @RequestParam(value = "projectId1", required = false) Long projectId1, @RequestParam(value = "name1", required = false) String name1, @RequestParam(value = "description1", required = false) String description1, @RequestParam(value = "queryDate3", required = false) Date queryDate3, @RequestParam(value = "queryDate4", required = false) Date queryDate4, Model uiModel) {
    if (queryDate1 == null && queryDate2 == null) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        calendar.add(Calendar.MILLISECOND, -1);
        queryDate2 = calendar.getTime();
        calendar.add(Calendar.MILLISECOND, 1);
        calendar.add(Calendar.MONTH, -1);
        queryDate1 = calendar.getTime();
    }
    if (queryDate3 == null && queryDate4 == null) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        calendar.add(Calendar.MILLISECOND, -1);
        queryDate4 = calendar.getTime();
        calendar.add(Calendar.MILLISECOND, 1);
        calendar.add(Calendar.MONTH, -1);
        queryDate3 = calendar.getTime();
    }
    // page,size
    if (page == null || page < 1)
        page = 1;
    if (size == null || size < 1)
        size = 10;
    Integer offset = size * (page - 1);
    // 筛选对应 fileConfig 表的信息
    FileConfigExample fileConfigExample = new FileConfigExample();
    FileConfigExample.Criteria cec = fileConfigExample.createCriteria();
    if (StringUtils.isNotEmpty(name))
        cec.andNameLike("%" + name + "%");
    if (StringUtils.isNotEmpty(description))
        cec.andDescriptionLike("%" + description + "%");
    if (queryDate1 != null && queryDate2 != null)
        cec.andCreateTimeBetween(queryDate1, queryDate2);
    else if (queryDate1 != null && queryDate2 == null)
        cec.andCreateTimeGreaterThanOrEqualTo(queryDate1);
    else if (queryDate1 == null && queryDate2 != null)
        cec.andCreateTimeLessThan(queryDate2);
    fileConfigExample.setOffset(offset);
    fileConfigExample.setLimit(size);
    fileConfigExample.setOrderByClause("create_time desc");
    List<FileConfig> fileConfigs = configServiceImpl.getList(fileConfigExample);
    uiModel.addAttribute("fileConfigs", fileConfigs);
    // count,pages
    Integer count = configServiceImpl.getCount(fileConfigExample);
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    // page,size
    if (page2 == null || page2 < 1)
        page2 = 1;
    if (size2 == null || size2 < 1)
        size2 = 10;
    Integer offset2 = size2 * (page2 - 1);
    // 筛选对应 FileIssue 表的信息
    Map<String, Object> param = new HashMap<>();
    // 管理员项目权限
    Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
    param.put("hasProjects", Arrays.asList(projectsOfAdmin));
    param.put("offset", offset2);
    param.put("limit", size2);
    param.put("queryDate3", queryDate3);
    param.put("queryDate4", queryDate4);
    if (StringUtils.isNotEmpty(name1)) {
        param.put("name1", "%" + name1 + "%");
    }
    if (StringUtils.isNotEmpty(description1)) {
        param.put("description1", "%" + description1 + "%");
    }
    if (projectId1 != null && projectId1 != 0) {
        param.put("projectId1", projectId1);
    }
    List<Map<String, Object>> fileIssues = configServiceImpl.getList(param);
    uiModel.addAttribute("fileIssues", fileIssues);
    Integer count2 = configServiceImpl.getCount(param);
    uiModel.addAttribute("count2", count2);
    // 获取所有项目信息
    ProjectExample projectExample = new ProjectExample();
    ProjectExample.Criteria pec = projectExample.createCriteria();
    pec.andIdIn(Arrays.asList(projectsOfAdmin));
    List<Project> projects = projectServiceImpl.getProjectByExample(projectExample);
    uiModel.addAttribute("pages2", (count2 + size2 - 1) / size2);
    if (page2 > 1 && size2 * (page2 - 1) >= count2) {
        page2 = (count2 + size2 - 1) / size2;
    }
    uiModel.addAttribute("page2", page2);
    uiModel.addAttribute("size2", size2);
    // 返回搜索条件参数
    uiModel.addAttribute("status", status);
    uiModel.addAttribute("projects", projects);
    uiModel.addAttribute("name", name);
    uiModel.addAttribute("name1", name1);
    uiModel.addAttribute("description", description);
    uiModel.addAttribute("description1", description1);
    uiModel.addAttribute("projectId1", projectId1);
    uiModel.addAttribute("queryDate1", queryDate1);
    uiModel.addAttribute("queryDate2", queryDate2);
    uiModel.addAttribute("queryDate3", queryDate3);
    uiModel.addAttribute("queryDate4", queryDate4);
    return "downloadconfig/list";
}
Also used : FileConfig(com.itrus.portal.db.FileConfig) HashMap(java.util.HashMap) ProjectExample(com.itrus.portal.db.ProjectExample) Calendar(java.util.Calendar) Project(com.itrus.portal.db.Project) FileConfigExample(com.itrus.portal.db.FileConfigExample) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 14 with ProjectExample

use of com.itrus.portal.db.ProjectExample in project portal by ixinportal.

the class AbstractController method getProjectMapOfAdmin.

/**
 * 获取管理员管理的项目Map
 *
 * @return
 */
public Map<Long, Project> getProjectMapOfAdmin() {
    Map<Long, Project> projectMap = new HashMap<Long, Project>();
    ProjectExample projectExample = new ProjectExample();
    ProjectExample.Criteria criteria = projectExample.or();
    criteria.andIdIn(Arrays.asList(getProjectLongIdsOfAdmin()));
    projectMap = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", projectExample, "id");
    return projectMap;
}
Also used : Project(com.itrus.portal.db.Project) HashMap(java.util.HashMap) ProjectExample(com.itrus.portal.db.ProjectExample)

Example 15 with ProjectExample

use of com.itrus.portal.db.ProjectExample in project portal by ixinportal.

the class AdminController method updateForm.

// 返回修改页面
@RequestMapping(value = "/{id}", params = "form", produces = "text/html")
public String updateForm(@PathVariable("id") Long id, Model uiModel) {
    Admin admin = sqlSession.selectOne("com.itrus.portal.db.AdminMapper.selectByPrimaryKey", id);
    admin.setPassword("");
    uiModel.addAttribute("admin", admin);
    ProjectExample projectex = new ProjectExample();
    Map<Long, Project> projects = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", projectex, "id");
    // 所有项目
    uiModel.addAttribute("projects", projects);
    List<Long> projectList = new ArrayList<Long>();
    uiModel.addAttribute("hasAllProject", 0);
    if (admin.getProjects().contains(",")) {
        String[] strs = admin.getProjects().split(",");
        for (String s : strs) {
            if (s.equals("0")) {
                // 包含所有项目
                uiModel.addAttribute("hasAllProject", 1);
                break;
            }
        }
    }
    for (Project project : adminService.getProjectByAdminId(id)) {
        projectList.add(project.getId());
    }
    // 管理员管理的项目id
    uiModel.addAttribute("projectList", projectList);
    List adminroles = sqlSession.selectList("com.itrus.portal.db.AdminRoleMapper.selectByExample");
    uiModel.addAttribute("adminroles", adminroles);
    return "admins/update";
}
Also used : Project(com.itrus.portal.db.Project) ProjectExample(com.itrus.portal.db.ProjectExample) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Admin(com.itrus.portal.db.Admin) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ProjectExample (com.itrus.portal.db.ProjectExample)24 Project (com.itrus.portal.db.Project)16 HashMap (java.util.HashMap)13 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)13 ArrayList (java.util.ArrayList)11 List (java.util.List)8 Map (java.util.Map)7 Admin (com.itrus.portal.db.Admin)4 CustomerService (com.itrus.portal.db.CustomerService)3 CustomerServiceExample (com.itrus.portal.db.CustomerServiceExample)3 EnterpriseQq (com.itrus.portal.db.EnterpriseQq)3 EnterpriseQqExample (com.itrus.portal.db.EnterpriseQqExample)3 JSONObject (com.alibaba.fastjson.JSONObject)2 AdminExample (com.itrus.portal.db.AdminExample)2 FileConfig (com.itrus.portal.db.FileConfig)2 FileConfigExample (com.itrus.portal.db.FileConfigExample)2 Calendar (java.util.Calendar)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 Bill (com.itrus.portal.db.Bill)1 ProjectKeyInfo (com.itrus.portal.db.ProjectKeyInfo)1