use of com.itrus.portal.db.EditBillExample in project portal by ixinportal.
the class BillWebController method billList.
/**
* 订单列表
*
* @param billStatus
* 0未完成订单,1已完成订单
* @param request
* @param uiModel
* @return
*/
@RequestMapping(produces = "text/html")
public String billList(@RequestParam(value = "billStatus", required = false) Integer billStatus, @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, HttpServletRequest request, Model uiModel) {
HttpSession session = request.getSession();
Boolean verifyCodeStatus = (Boolean) session.getAttribute("webverifyCodeStatus");
Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
if (null == verifyCodeStatus || !verifyCodeStatus || null == userInfo) {
// 登录状态失效,跳转到登录页面
return "redirect:/userInfoWeb/denglu.html";
}
if (userInfo != null && enterprise == null) {
// 登录未获取到企业信息,跳转到选择企业页面
return "redirect:/userInfoWeb/choiceEnterprise";
}
uiModel.addAttribute("billStatus", billStatus);
if (page == null || page < 1) {
page = 1;
}
if (size == null || size < 1) {
size = 5;
}
BillExample billExampl = new BillExample();
BillExample.Criteria criteria = billExampl.or();
// web页面不显示解锁的订单产品
List<Long> keyUnlockProductIds = productService.getKeyUnlockProductIds();
if (null != keyUnlockProductIds && !keyUnlockProductIds.isEmpty()) {
criteria.andProductNotIn(keyUnlockProductIds);
}
// 查询当前用户当前企业的订单
// 当前用户
criteria.andUniqueIdEqualTo(userInfo.getId());
// 当前企业 v 76
criteria.andEnterpriseEqualTo(enterprise.getId());
if (null == billStatus || 0 == billStatus) {
// 未完成订单:订单状态不为8
criteria.andBillStatusNotEqualTo(ComNames.BILL_STATUS_8);
criteria.andIsDeleteEqualTo(false);
} else if (1 == billStatus) {
// 订单状态为已完成
criteria.andBillStatusEqualTo(ComNames.BILL_STATUS_8);
}
Integer count = sqlSession.selectOne("com.itrus.portal.db.BillMapper.countByExample", billExampl);
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);
Integer offset = size * (page - 1);
billExampl.setOffset(offset);
billExampl.setLimit(size);
billExampl.setOrderByClause("create_time desc");
List<Bill> billList = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", billExampl);
uiModel.addAttribute("billList", billList);
uiModel.addAttribute("itemcount", billList.size());
Map<Long, Delivery> deliveryMap = sqlSession.selectMap("com.itrus.portal.db.DeliveryMapper.selectByExample", null, "id");
uiModel.addAttribute("deliveryMap", deliveryMap);
// 填写中订单
if (page2 == null || page2 < 1) {
page2 = 1;
}
if (size2 == null || size2 < 1) {
size2 = 5;
}
EditBillExample ebEx = new EditBillExample();
EditBillExample.Criteria criteria2 = ebEx.or();
// 查询当前用户当前企业的订单
// 当前用户
criteria2.andUserInfoIdEqualTo(userInfo.getId());
//
criteria2.andEnterpriseIdEqualTo(enterprise.getId());
Integer count2 = sqlSession.selectOne("com.itrus.portal.db.EditBillMapper.countByExample", ebEx);
if (page2 > 1 && size2 * (page2 - 1) >= count2) {
page2 = (count2 + size2 - 1) / size2;
}
uiModel.addAttribute("count2", count2);
uiModel.addAttribute("pages2", (count2 + size2 - 1) / size2);
uiModel.addAttribute("page2", page2);
uiModel.addAttribute("size2", size2);
Integer offset2 = size2 * (page2 - 1);
// 产品信息:
/*Map<Long, Product> productMap = billService
.getProductMapByUserInfoId(userInfo.getId());*/
// if ((null == billStatus || billStatus.equals(2)) && count2 != 0) {
Map<Long, Product> productMap = sqlSession.selectMap("com.itrus.portal.db.ProductMapper.selectByExample", "id");
// }
uiModel.addAttribute("productMap", productMap);
// 获取产品关联的数字证书id
Set<Long> certIds = productService.getDigitalCertIds(productMap);
// 产品关联的数字证书:
Map<Long, DigitalCert> digitalCertMap = digitalCertService.getDigitalCertByProductMap(certIds);
uiModel.addAttribute("digitalCertMap", digitalCertMap);
// 获取订单对应的产品规格
Map<Long, ProductSpec> productSpecMap = productSpecService.getProductSpec(billList);
uiModel.addAttribute("productSpecMap", productSpecMap);
ebEx.setOffset(offset2);
ebEx.setLimit(size2);
ebEx.setOrderByClause("create_time desc");
List<EditBill> editBillList = sqlSession.selectList("com.itrus.portal.db.EditBillMapper.selectByExample", ebEx);
// 获取填写中订单对应的产品规格
Map<Long, ProductSpec> editBill_productSpecMap = productSpecService.getEditBillProductSpec(editBillList);
uiModel.addAttribute("editBill_productSpecMap", editBill_productSpecMap);
uiModel.addAttribute("editBillList", editBillList);
uiModel.addAttribute("itemcount2", editBillList.size());
// 订单是否对应的pfx的用户下载证书.
Map<Long, Long> pfxMap = billWebService.getPfxCertBufByBills(billList);
uiModel.addAttribute("pfxmap", pfxMap);
session.removeAttribute("sessionPlist");
session.removeAttribute("enterpriseqqE");
System.out.println(enterprise.getId());
Map param = new HashMap();
param.put("id", enterprise.getId());
if (userInfo.getmPhone() != null) {
param.put("phone", userInfo.getmPhone());
}
List<Map<String, Object>> plist = sqlSession.selectList("com.itrus.portal.db.ProjectMapper.selectProjectId", param);
Map<Long, EnterpriseQq> qqMap = new HashMap<Long, EnterpriseQq>();
for (int i = 0; i < plist.size(); i++) {
EnterpriseQqExample enterpriseQ = new EnterpriseQqExample();
EnterpriseQqExample.Criteria qqEx = enterpriseQ.createCriteria();
// System.out.println(plist.get(i));
Long pid = Long.parseLong(plist.get(i).get("id").toString());
// System.out.println(pid);
qqEx.andProjectIdEqualTo(pid);
EnterpriseQq enterpriseqq = sqlSession.selectOne("com.itrus.portal.db.EnterpriseQqMapper.selectByExample", enterpriseQ);
if (enterpriseqq != null) {
// uiModel.addAttribute("eid", enterpriseqq.getId());
qqMap.put(pid, enterpriseqq);
// session.setAttribute("enterpriseqqE", enterpriseqq.getEnterpriseQqLinks());
}
}
session.setAttribute("sessionqqMap", qqMap);
session.setAttribute("sessionPlist", plist);
return "ixinweb/zhanghuguanli_dingdanxinxi";
}
Aggregations