use of com.ikoori.vip.common.exception.BussinessException in project vip by guangdada.
the class UserMgrController method add.
/**
* 添加管理员
*/
@RequestMapping("/add")
@BussinessLog(value = "添加管理员", key = "account", dict = Dict.UserDict)
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Tip add(@Valid UserDto user, BindingResult result) {
if (result.hasErrors()) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
}
// 判断账号是否重复
User theUser = managerDao.getByAccount(user.getAccount());
if (theUser != null) {
throw new BussinessException(BizExceptionEnum.USER_ALREADY_REG);
}
// 完善账号信息
user.setSalt(ShiroKit.getRandomSalt(5));
user.setPassword(ShiroKit.md5(user.getPassword(), user.getSalt()));
user.setStatus(ManagerStatus.OK.getCode());
user.setCreatetime(new Date());
this.userMapper.insert(UserFactory.createUser(user));
return SUCCESS_TIP;
}
use of com.ikoori.vip.common.exception.BussinessException in project vip by guangdada.
the class UserMgrController method userEdit.
/**
* 跳转到编辑管理员页面
*/
@Permission
@RequestMapping("/user_edit/{userId}")
public String userEdit(@PathVariable Integer userId, Model model) {
if (ToolUtil.isEmpty(userId)) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
}
User user = this.userMapper.selectById(userId);
model.addAttribute(user);
model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleid()));
model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptid()));
LogObjectHolder.me().set(user);
return PREFIX + "user_edit.html";
}
use of com.ikoori.vip.common.exception.BussinessException in project vip by guangdada.
the class WebOrderController method pay.
@ApiOperation("会员优惠券、积分结算接口")
@RequestMapping(value = "pay", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> pay(@ApiParam(value = "店铺编号", required = true) @RequestParam(required = true) String storeNo, @ApiParam(value = "手机号", required = true) @RequestParam(required = true) String mobile, @ApiParam(value = "订单号", required = true) @RequestParam(required = true) String orderNo, @ApiParam(value = "订单总额", required = true) @RequestParam(required = true) String balanceDue, @ApiParam(value = "支付金额", required = true) @RequestParam(required = true) String payment, @ApiParam(value = "使用积分", required = true) @RequestParam(required = true) String point, @ApiParam(value = "优惠金额", required = true) @RequestParam(required = true) String discount, @ApiParam(value = "优惠券明细", required = true) @RequestParam(required = true) String coupons, @ApiParam(value = "订单明细", required = true) @RequestParam(required = true) String orderItems, @ApiParam(value = "签名", required = true) @RequestParam(required = true) String sign) {
Map<String, Object> result = new HashMap<String, Object>();
result.put("code", "200");
result.put("msg", "请求成功");
try {
log.info(">>>>>>>>>>>>>>>>>>>>>>>会员优惠券、积分结算接口>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
boolean isSign = true;
if (gunsProperties.isCheckSign()) {
Map<String, String> data = new HashMap<String, String>();
data.put("storeNo", storeNo);
data.put("mobile", mobile);
data.put("mobile", orderNo);
data.put("balanceDue", balanceDue);
data.put("payment", payment);
data.put("point", point);
data.put("discount", discount);
data.put("coupons", coupons);
data.put("orderItems", orderItems);
data.put("sign", sign);
log.info("请求参数:" + data.toString());
isSign = WXPayUtil.isSignatureValid(data, gunsProperties.getSignKey());
if (!isSign) {
log.info("签名失败");
result.put("code", "500");
result.put("msg", "签名失败");
}
}
if (isSign) {
OrderPayDo orderPayDo = new OrderPayDo();
orderPayDo.setStoreNo(storeNo);
orderPayDo.setMobile(mobile);
orderPayDo.setOrderNo(orderNo);
orderPayDo.setBalanceDue(Integer.valueOf(balanceDue));
orderPayDo.setPayment(Integer.valueOf(payment));
orderPayDo.setDiscount(Integer.valueOf(discount));
orderPayDo.setPoint(Integer.valueOf(point));
orderPayDo.setCoupons(JSONArray.parseArray(coupons, CouponPayDo.class));
orderPayDo.setOrderItems(JSONArray.parseArray(orderItems, OrderItemPayDo.class));
orderPayDo.setOrderSource(OrderSource.offline.getCode());
orderService.saveOrder(orderPayDo);
}
} catch (BussinessException e) {
log.error("", e);
result.put("code", e.getCode());
result.put("msg", e.getMessage());
} catch (Exception e) {
log.error("", e);
result.put("code", "500");
result.put("msg", "请求失败");
}
log.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<会员优惠券、积分结算接口<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
return result;
}
use of com.ikoori.vip.common.exception.BussinessException in project vip by guangdada.
the class NoticeController method update.
/**
* 修改通知
*/
@RequestMapping(value = "/update")
@ResponseBody
@BussinessLog(value = "修改通知", key = "title", dict = Dict.NoticeMap)
public Object update(Notice notice) {
if (ToolUtil.isOneEmpty(notice, notice.getId(), notice.getTitle(), notice.getContent())) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
}
Notice old = this.noticeMapper.selectById(notice.getId());
old.setTitle(notice.getTitle());
old.setContent(notice.getContent());
old.updateById();
return super.SUCCESS_TIP;
}
use of com.ikoori.vip.common.exception.BussinessException in project vip by guangdada.
the class NoticeController method add.
/**
* 新增通知
*/
@RequestMapping(value = "/add")
@ResponseBody
@BussinessLog(value = "新增通知", key = "title", dict = Dict.NoticeMap)
public Object add(Notice notice) {
if (ToolUtil.isOneEmpty(notice, notice.getTitle(), notice.getContent())) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
}
notice.setCreater(ShiroKit.getUser().getId());
notice.setCreatetime(new Date());
notice.insert();
return super.SUCCESS_TIP;
}
Aggregations