Search in sources :

Example 11 with PersonInfo

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

the class PersonInfoController method detail.

/**
 * 查看个人用户详情
 * @param id
 * 				个人用户id
 * @param item
 * 				个人用户关联的项(0认证、1订单)
 * @param page
 * @param size
 * @param uiModel
 * @return
 */
@RequestMapping("/detail")
public String detail(@RequestParam(value = "id", required = true) Long id, @RequestParam(value = "item", required = false) Integer item, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
    PersonInfo personinfo = personInfoService.getSelectById(id);
    uiModel.addAttribute("personinfo", personinfo);
    // 得到属于个人的认证等级
    Map prama = new HashMap();
    prama.put("type", 1);
    List certificationList = certificationService.getCertificationList(prama);
    uiModel.addAttribute("certificationList", certificationList);
    // page,size
    if (page == null || page < 1) {
        page = 1;
    }
    if (size == null || size < 1) {
        size = 10;
    }
    Integer offset = size * (page - 1);
    // 总记录数
    Integer count = 0;
    // 当前页记录数
    Integer itemcount = 0;
    if (null == item || 0 == item) {
        // 得到用户关联的银行卡信息
        BankcardInfoExample bankcardInfoExample = new BankcardInfoExample();
        BankcardInfoExample.Criteria be = bankcardInfoExample.createCriteria();
        be.andUniqueIdEqualTo(id);
        bankcardInfoExample.setOrderByClause("create_time desc");
        bankcardInfoExample.setOffset(offset);
        bankcardInfoExample.setLimit(size);
        List bankcardInfoList = bankcardInfoService.getSelectByExample(bankcardInfoExample);
        count = bankcardInfoService.getSelectCountByExample(bankcardInfoExample);
        uiModel.addAttribute("bankcardInfoList", bankcardInfoList);
    } else if (1 == item) {
        // 得到用户关联的订单
        PersonalBillExample personalBillExample = new PersonalBillExample();
        PersonalBillExample.Criteria pe = personalBillExample.createCriteria();
        pe.andUniqueIdEqualTo(id);
        personalBillExample.setOrderByClause("create_time desc");
        personalBillExample.setOffset(offset);
        personalBillExample.setLimit(size);
        List personalBillList = personalBillBillService.getSelectByExample(personalBillExample);
        count = personalBillBillService.getSelectCountByExample(personalBillExample);
        uiModel.addAttribute("personalBillList", personalBillList);
        Map<Long, List<Product>> productMap = productService.getProductByMap();
        Map<Long, List<Project>> projectMap = projectService.getProjectByMap();
        uiModel.addAttribute("productMap", productMap);
        uiModel.addAttribute("projectMap", projectMap);
    }
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    uiModel.addAttribute("item", item);
    return "personinfo/detail";
}
Also used : Project(com.itrus.portal.db.Project) PersonInfo(com.itrus.portal.db.PersonInfo) BankcardInfoExample(com.itrus.portal.db.BankcardInfoExample) PersonalBillExample(com.itrus.portal.db.PersonalBillExample) HashMap(java.util.HashMap) Product(com.itrus.portal.db.Product) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

PersonInfo (com.itrus.portal.db.PersonInfo)11 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)11 Product (com.itrus.portal.db.Product)6 File (java.io.File)6 IOException (java.io.IOException)6 FileInputStream (java.io.FileInputStream)5 OutputStream (java.io.OutputStream)5 HttpSession (javax.servlet.http.HttpSession)5 HashMap (java.util.HashMap)4 List (java.util.List)4 Map (java.util.Map)4 JSONObject (com.alibaba.fastjson.JSONObject)3 PersonalBill (com.itrus.portal.db.PersonalBill)3 Date (java.util.Date)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 BankcardInfo (com.itrus.portal.db.BankcardInfo)2 Certification (com.itrus.portal.db.Certification)2 ArrayList (java.util.ArrayList)2 BankcardInfoExample (com.itrus.portal.db.BankcardInfoExample)1 PersonalBillExample (com.itrus.portal.db.PersonalBillExample)1