文件名称:cpmgr运营平台初步demo
文件大小:76.27MB
文件格式:RAR
更新时间:2021-08-07 11:28:14
vue
@RequestMapping(value = "/insertActivitDiscount", produces = "text/plain;charset=utf-8", method = RequestMethod.POST) @ResponseBody public String insertActivitDiscount(@RequestBody String param,HttpServletRequest request,HttpSession session) { logger.info("enter insert activitDiscount ....."); ResponseVo resVo = new ResponseVo(); resVo.setCmd("insertActivitDiscount"); ActivitDiscount activitDiscount = handle(param, resVo); UserLog userLog = userLogService.initUserLog(request, session, "添加优惠活动(优惠活动名称 :"+activitDiscount.getName()+")"); userLog.setKeyWord("添加优惠活动"); userLog.setLoginNameType(1); userLogService.insert(userLog); if (resVo.getResult() != 0) { return JSONObject.toJSON(resVo).toString(); } if (activitDiscount.getName() == null) { resVo.setResult(1); resVo.setStatu(1); resVo.setResultNote("activitDiscount name is null"); logger.error("activitDiscount name is null"); return JSONObject.toJSON(resVo).toString(); } if (activitDiscount.getType() == null) { resVo.setResult(1); resVo.setStatu(1); resVo.setResultNote("type is null"); logger.error("type is null"); return JSONObject.toJSON(resVo).toString(); } // 优惠类型0价格优惠,1时间优惠,2折扣百分比 if (activitDiscount.getType() == 0) { if (activitDiscount.getPrice() == null) { resVo.setResult(1); resVo.setStatu(1); resVo.setResultNote("price is null"); logger.error("price is null"); return JSONObject.toJSON(resVo).toString(); } } else if (activitDiscount.getType() == 1) { if (activitDiscount.getBeginTime() == null || activitDiscount.getEndTime() == null) { resVo.setResult(1); resVo.setStatu(1); resVo.setResultNote("beginTime or endTime is null"); logger.error("beginTime or endTime is null"); return JSONObject.toJSON(resVo).toString(); } } else if (activitDiscount.getType() == 2) { if (activitDiscount.getPercentage() == null) { resVo.setResult(1); resVo.setStatu(1); resVo.setResultNote("percentage is null"); logger.error("percentage is null"); return JSONObject.toJSON(resVo).toString(); } } activitDiscount.setIsDelete(0);// 添加数据,默认不删除 Integer result = iActivitDiscountService.insertSelective(activitDiscount); if (result < 0) {// 处理失败 resVo.setStatu(1); resVo.setResult(1); resVo.setResultNote("SQL execution failure"); logger.error("SQL execution failure"); return JSONObject.toJSON(resVo).toString(); } userLog.setLevel(userLogService.SUCCESS_LEVEL); userLog.setDetail("添加优惠活动(优惠活动名称 :"+activitDiscount.getName()+")"); userLogService.updateByPrimaryKeySelective(userLog); logger.info(" insert activitDiscount ended ....."); return JSONObject.toJSON(resVo).toString(); }