public String addLock() throws IOException { Map session = getSession(); Operator oper = (Operator) session.get(KeyEnum.OPERATOR); Map jsondata = new HashMap(); /* * 商户分三个等级(rating): 普通(0),优先(1),特级(2). 刚刚通过审核的商户为普通 * 按照谭的要求,普通商户不能上传商品 */ List<Business> businessList = businessService.find(" from Business where userId=? ", new Object[] {oper.getId()}); if (businessList.size() != 0 && businessList != null) { int rating = businessList.get(0).getRating(); if (rating != 0) { // rating != 0 : 该商户优先级不是0 -> 不是普通用户 lock.setBusinessId(businessService.findBusinessIdByUserId(oper.getId())); lock.setStatus(1); lockService.txAddLockInfo(oper, lock); jsondata.put(KeyEnum.STATUS, StatusEnum.success); jsonViewIE(jsondata); } else { jsondata.put(KeyEnum.STATUS, StatusEnum.failed); jsondata.put(KeyEnum.REASON, "普通商户不能上传商品,请联系管理员修改权限后再次操作!"); } } else { jsondata.put(KeyEnum.STATUS, StatusEnum.failed); jsondata.put(KeyEnum.REASON, "您还不是商户不能上传商品"); } jsonViewIE(jsondata); Utils.senchaview(jsondata); return null; }
@SuppressWarnings("rawtypes") public String getLockByPage() throws IOException { Map session = this.getSession(); Operator operator = (Operator) session.get(KeyEnum.OPERATOR); Map jsondata = new HashMap(); if (operator.getRoleName().equals("管理员")) { lockService.getLocksByPage(jsondata, page, rows, name, type, origin, businessId, order, sort); } else { lockService.getLocksByPage( jsondata, page, rows, name, type, origin, businessService.findBusinessIdByUserId(operator.getId()), order, sort); jsondata.put(KeyEnum.STATUS, StatusEnum.success); } jsonViewIE(jsondata); return null; }