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; }
public String editLock() throws IOException { Map session = getSession(); Operator oper = (Operator) session.get(KeyEnum.OPERATOR); Map jsondata = new HashMap(); StatusEnum status = StatusEnum.success; String reason = null; if (!lockService.txUpdate(oper, lock, id)) { status = StatusEnum.failed; reason = "修改失敗"; } jsondata.put(KeyEnum.STATUS, status); jsondata.put(KeyEnum.REASON, reason); jsonViewIE(jsondata); Utils.senchaview(jsondata); return null; }