文章目录
一、项目介绍
今天为大家带来的是
weiit-saas这款Java开源项目
,属于weiit团队自研产品,该系统意在通过技术封装,让企业无需代码开发,帮助企业一键生成小程序、公众号,让企业拥有独立品牌的自营商城
,weiit-saas是完全开源电商SaaS系统,属于weiit开源的社区版
,旧版已不在维护和更新,仅供学习和参考,新版saas从底层架构到前后端UI设计已经全面优化和升级
🎃2023华为OD机试真题目录,使用C语言进行解答,提供思路参考,代码解析,持续更新中
二、技术栈以及项目特点
⭐新版saas技术栈使用⭐
SpringCloud + Oauth2.0 + ShiroRedis + JWT + Gateway + Nacos + Nginx + Vue
⭐项目特点⭐
- 项目采用
Spring+SpringMVC+Mybatis主流开源框架
,遵循MVC架构,设计轻巧,使用简单,开发人员接手与二次开发简单易懂;- 项目完成了对
阿里云、腾讯云、微信生态的快速接入与代码示例
,并成功运用到了商业中,方便大家学习对OSS/COS/短信服务/快递服务/公众号/小程序/微信开放平台/微信支付的技术点与应用场景的学习
;- 小程序与公众号第三方授权集成,让开发者与企业省去繁琐的配置,
对AppId/AppSecret集成彻底告别
;微信支付第三方授权集成
,让开发者与企业省去繁琐的配置,让企业服务成本大大降低;小程序代码自动push与升级,公众号基本常规功能(自定义菜单、图文、素材,群发)全部接管,让企业无需登录微信官方入口,统一化管理企业信息与数据
;- 微信消息通知与模板自动同步与管理,让企业场景融合无障碍;
自定义装修功能
,实现企业电商场景多元化,解决不同行业不同模板,让企业需求得到真正解决;- 丰富的营销工具,解决企业微营销需求,并集中化管理。拼团活动、积分活动、砍价,优惠券,卡券,礼品卡,邀请有礼等营销活动,方便二次开发;
不同企业数据隔离,真正实现SAAS数据隔离模型,让企业数据互不干扰
- 不同企业不同域名自动分配,让企业小程序、公众号前端隔离,避免因为公众号或者小程序推广时导致域名被检测导致的封号问题出现,即不同企业不同域,意在防止saas平台中的企业受到其他企业的影响
三、系统设计
SAAS微信小程序电商系统系统的主要功能模块包括
概况模块,店铺管理模块,商品模块,订单管理模块,客户管理模块,数据模块,营销模块,设置模块
(1)概况模块: 可以看到具体各个功能的具体信息
(2)商品模块: 该模块包含微页面,全店风格,底部菜单,底部导航
(3)店铺模块: 该模块包含出售中的商品、库存紧张商品、仓库商品、商品标签、商品分组、商品导入
(4)订单管理模块: 该模块包含所有订单、维权订单、加星订单、订单设置
(5)客户模块: 该模块包含会员管理、会员卡管理、标签组管理、会员提现、会员设置
(6)数据模块: 该模块包含综合统计、店铺的概况、订单的概况、客户的分析
(7)营销模块: 该模块包含常规营销、人口设置
(8)设置模块: 该模块包含店铺设置、服务协议、支付交易、物流配送、修改密码
(9)系统架构图
四、系统功能演示
🚩店铺功能演示图
🚩商品功能演示图
🚩订单功能演示图
🚩客户功能演示图
🚩数据功能演示图
🚩营销功能演示图
🚩设置功能演示图
五、系统源代码
@Controller@RequestMapping(value = "/ump/bargainhttps://blog.csdn.net/m0_47384542/article/details/")public class BargainController extends AdminController { public static Logger logger = Logger.getLogger(BargainController.class); @Resource private BargainService bargainService; @Resource ProductService productService; @RequestMapping("/bargainListhttps://blog.csdn.net/m0_47384542/article/details/") public UIview bargainList() throws Exception { logger.info("进入 bargainController-list,砍价活动列表https://blog.csdn.net/m0_47384542/article/details/"); //获取请求参数 FormMap formMap = getFormMap(); //开启分页 PageHelper.startPage(formMap.getPage(), formMap.getRows()); //查询展示数量 List<E> list = bargainService.selectList(formMap); //返回到list页面 UIview result = UIView("/center/ump/bargain/bargainListhttps://blog.csdn.net/m0_47384542/article/details/", false); //绑定分页返回 result.addObject("pageInfohttps://blog.csdn.net/m0_47384542/article/details/", new PageInfo<E>(list)); //绑定上一次参数 result.addObject("queryParamhttps://blog.csdn.net/m0_47384542/article/details/", formMap); return result; } @RequestMapping("/addhttps://blog.csdn.net/m0_47384542/article/details/") public UIview add() throws Exception { UIview result = UIView("/center/ump/bargain/bargainCreatehttps://blog.csdn.net/m0_47384542/article/details/", false); this.getRequest().setAttribute("titlehttps://blog.csdn.net/m0_47384542/article/details/", "砍价活动新增https://blog.csdn.net/m0_47384542/article/details/"); return result; } @RequestMapping("/edithttps://blog.csdn.net/m0_47384542/article/details/") public UIview edit() throws Exception { FormMap formMap = getFormMap(); E infoMap = bargainService.selectOne(formMap); formMap.put("item_idhttps://blog.csdn.net/m0_47384542/article/details/",infoMap.get("item_idhttps://blog.csdn.net/m0_47384542/article/details/")); E itemInfo = productService.getItemById(formMap); String specString ="https://blog.csdn.net/m0_47384542/article/details/"; if (itemInfo!=null && itemInfo.get("spec_customhttps://blog.csdn.net/m0_47384542/article/details/")!=null){ formMap.put("specIdshttps://blog.csdn.net/m0_47384542/article/details/", itemInfo.getStr("spec_customhttps://blog.csdn.net/m0_47384542/article/details/").split(";https://blog.csdn.net/m0_47384542/article/details/")); List<E> specList = productService.getSpecCustomByIds(formMap); for(E spec :specList){ specString+=spec.getStr("key_namehttps://blog.csdn.net/m0_47384542/article/details/")+";https://blog.csdn.net/m0_47384542/article/details/"; } } specString=specString=="https://blog.csdn.net/m0_47384542/article/details/"?infoMap.getStr("product_namehttps://blog.csdn.net/m0_47384542/article/details/"):specString; infoMap.put("skuNamehttps://blog.csdn.net/m0_47384542/article/details/",specString); UIview result = UIView("/center/ump/bargain/bargainCreatehttps://blog.csdn.net/m0_47384542/article/details/", false); this.getRequest().setAttribute("infoMaphttps://blog.csdn.net/m0_47384542/article/details/", infoMap); this.getRequest().setAttribute("titlehttps://blog.csdn.net/m0_47384542/article/details/", "砍价活动编辑https://blog.csdn.net/m0_47384542/article/details/"); return result; } @RequestMapping("/savehttps://blog.csdn.net/m0_47384542/article/details/") public UIview save() throws Exception { FormMap param = getFormMap(); if (param.get("validate_idhttps://blog.csdn.net/m0_47384542/article/details/") == null || param.get("validate_idhttps://blog.csdn.net/m0_47384542/article/details/").equals("https://blog.csdn.net/m0_47384542/article/details/")) { //根据生效时间判断是否现在生效 if (System.currentTimeMillis()> DateUtil.getTimeByString(param.getStr("start_timehttps://blog.csdn.net/m0_47384542/article/details/"),"yyyy/MM/dd HH:mm:sshttps://blog.csdn.net/m0_47384542/article/details/")){ param.put("statehttps://blog.csdn.net/m0_47384542/article/details/", 0); }else { //未开始状态 param.put("statehttps://blog.csdn.net/m0_47384542/article/details/", -2); } bargainService.insert(param); } else { param.set("eivthttps://blog.csdn.net/m0_47384542/article/details/", null); //失效后再编辑 if (System.currentTimeMillis()> DateUtil.getTimeByString(param.getStr("start_timehttps://blog.csdn.net/m0_47384542/article/details/"),"yyyy/MM/dd HH:mm:sshttps://blog.csdn.net/m0_47384542/article/details/") && System.currentTimeMillis()<DateUtil.getTimeByString(param.getStr("end_timehttps://blog.csdn.net/m0_47384542/article/details/"),"yyyy/MM/dd HH:mm:sshttps://blog.csdn.net/m0_47384542/article/details/")){ param.put("statehttps://blog.csdn.net/m0_47384542/article/details/", 0); }else if (System.currentTimeMillis()<DateUtil.getTimeByString(param.getStr("start_timehttps://blog.csdn.net/m0_47384542/article/details/"),"yyyy/MM/dd HH:mm:sshttps://blog.csdn.net/m0_47384542/article/details/")){ param.put("statehttps://blog.csdn.net/m0_47384542/article/details/", -2); } bargainService.edit(param); } UIview result = UIView("redirect:bargainListhttps://blog.csdn.net/m0_47384542/article/details/", false); return result; } @RequestMapping("/statushttps://blog.csdn.net/m0_47384542/article/details/") public UIview status() throws Exception { FormMap formMap = getFormMap(); formMap.set("eivthttps://blog.csdn.net/m0_47384542/article/details/", "statehttps://blog.csdn.net/m0_47384542/article/details/"); bargainService.edit(formMap); UIview result = UIView("redirect:bargainListhttps://blog.csdn.net/m0_47384542/article/details/", false); return result; } @RequestMapping("/removehttps://blog.csdn.net/m0_47384542/article/details/") public UIview remove() throws Exception { FormMap map = getFormMap(); bargainService.remove(map); UIview result = UIView("redirect:bargainListhttps://blog.csdn.net/m0_47384542/article/details/", false); return result; } @RequestMapping("/bargainDetailListhttps://blog.csdn.net/m0_47384542/article/details/") public UIview bargainOrderList() throws Exception { logger.info("进入 bargainController-bargainOrderList,满减送活动列表https://blog.csdn.net/m0_47384542/article/details/"); //获取请求参数 FormMap formMap = getFormMap(); //开启分页 PageHelper.startPage(formMap.getPage(), formMap.getRows()); //查询展示数量 List<E> list = bargainService.selectBargainDetailList(formMap); //返回到list页面 UIview result = UIView("/center/ump/bargain/bargainDetailListhttps://blog.csdn.net/m0_47384542/article/details/", false); //绑定分页返回 result.addObject("pageInfohttps://blog.csdn.net/m0_47384542/article/details/", new PageInfo<E>(list)); //绑定上一次参数 result.addObject("queryParamhttps://blog.csdn.net/m0_47384542/article/details/", formMap); return result; } @RequestMapping("/bargainNancyListhttps://blog.csdn.net/m0_47384542/article/details/") public UIview bargainNancyList() throws Exception { logger.info("进入 bargainController-bargainOrderList,砍价活动列表https://blog.csdn.net/m0_47384542/article/details/"); //获取请求参数 FormMap formMap = getFormMap(); //开启分页 PageHelper.startPage(formMap.getPage(), formMap.getRows()); //查询展示数量 List<E> list = bargainService.selectBargainNancyList(formMap); //返回到list页面 UIview result = UIView("/center/ump/bargain/bargainNancyListhttps://blog.csdn.net/m0_47384542/article/details/", false); //绑定分页返回 result.addObject("pageInfohttps://blog.csdn.net/m0_47384542/article/details/", new PageInfo<E>(list)); //绑定上一次参数 result.addObject("queryParamhttps://blog.csdn.net/m0_47384542/article/details/", formMap); return result; } @ResponseBody @RequestMapping("/productList.jsonhttps://blog.csdn.net/m0_47384542/article/details/") public String productList() throws Exception { logger.info("进入seckillController-productList,查询商品https://blog.csdn.net/m0_47384542/article/details/"); try { FormMap formMap = getFormMap(); formMap.set("product_namehttps://blog.csdn.net/m0_47384542/article/details/", new String(formMap.getStr("product_namehttps://blog.csdn.net/m0_47384542/article/details/").getBytes("ISO-8859-1https://blog.csdn.net/m0_47384542/article/details/"))); List<E> productList = bargainService.selectProductList(formMap); List<E> productJson = new ArrayList<E>(); for (E e : productList) { E productinfo = new E(); productinfo.set("product_namehttps://blog.csdn.net/m0_47384542/article/details/", "https://blog.csdn.net/m0_47384542/article/details/" + e.getStr("product_namehttps://blog.csdn.net/m0_47384542/article/details/")); productinfo.set("sale_pricehttps://blog.csdn.net/m0_47384542/article/details/", e.getStr("sale_pricehttps://blog.csdn.net/m0_47384542/article/details/")); productinfo.set("stockhttps://blog.csdn.net/m0_47384542/article/details/", e.getStr("stockhttps://blog.csdn.net/m0_47384542/article/details/")); if (StringUtils.isEmpty(e.getStr("statehttps://blog.csdn.net/m0_47384542/article/details/"))) { productinfo.set("optionhttps://blog.csdn.net/m0_47384542/article/details/", " + e.getStr("product_idhttps://blog.csdn.net/m0_47384542/article/details/") + ")' price='https://blog.csdn.net/m0_47384542/article/details/" + e.getStr("sale_pricehttps://blog.csdn.net/m0_47384542/article/details/") + "'spec_config='https://blog.csdn.net/m0_47384542/article/details/" + e.getStr("spec_confighttps://blog.csdn.net/m0_47384542/article/details/") + "'>选取https://blog.csdn.net/m0_47384542/article/details/"); } else { productinfo.set("optionhttps://blog.csdn.net/m0_47384542/article/details/", "已参加https://blog.csdn.net/m0_47384542/article/details/"); } productJson.add(productinfo); } return toJsonAPI(productJson); } catch (Exception e) { e.printStackTrace(); throw new Exception("出错啦...https://blog.csdn.net/m0_47384542/article/details/"); } } @ResponseBody @RequestMapping("/skuList.jsonhttps://blog.csdn.net/m0_47384542/article/details/") public String skuList() throws Exception { logger.info("BargainController-skuList,选择多规格商品https://blog.csdn.net/m0_47384542/article/details/"); FormMap formMap = getFormMap(); formMap.put("is_deletedhttps://blog.csdn.net/m0_47384542/article/details/", 0); formMap.put("is_disabledhttps://blog.csdn.net/m0_47384542/article/details/", 0); List<E> list = productService.selectItemList(formMap); E productInfo = productService.selectById(formMap); List<E> productJson = new ArrayList<E>(); for (E e : list) { E productinfo = new E(); formMap.put("specIdshttps://blog.csdn.net/m0_47384542/article/details/", e.getStr("spec_customhttps://blog.csdn.net/m0_47384542/article/details/").split(";https://blog.csdn.net/m0_47384542/article/details/")); List<E> specList = productService.getSpecCustomByIds(formMap); String specString ="https://blog.csdn.net/m0_47384542/article/details/"; for(E spec :specList){ specString+=spec.getStr("key_namehttps://blog.csdn.net/m0_47384542/article/details/")+";https://blog.csdn.net/m0_47384542/article/details/"; } specString=specString=="https://blog.csdn.net/m0_47384542/article/details/"?productInfo.getStr("product_namehttps://blog.csdn.net/m0_47384542/article/details/"):specString; productinfo.set("specDeschttps://blog.csdn.net/m0_47384542/article/details/",specString); productinfo.set("sale_pricehttps://blog.csdn.net/m0_47384542/article/details/", e.getStr("sale_pricehttps://blog.csdn.net/m0_47384542/article/details/")); productinfo.set("stockhttps://blog.csdn.net/m0_47384542/article/details/", e.getStr("stockhttps://blog.csdn.net/m0_47384542/article/details/")); productinfo.set("optionhttps://blog.csdn.net/m0_47384542/article/details/", " + e.getStr("item_idhttps://blog.csdn.net/m0_47384542/article/details/") + ")' specDesc='https://blog.csdn.net/m0_47384542/article/details/" + specString + "' product_id='https://blog.csdn.net/m0_47384542/article/details/" + e.getStr("product_idhttps://blog.csdn.net/m0_47384542/article/details/") + "' product_img='https://blog.csdn.net/m0_47384542/article/details/" + WeiitUtil.getFileDomain()+productInfo.getStr("product_imghttps://blog.csdn.net/m0_47384542/article/details/") + "' stock='https://blog.csdn.net/m0_47384542/article/details/" + e.getStr("stockhttps://blog.csdn.net/m0_47384542/article/details/") + "' price='https://blog.csdn.net/m0_47384542/article/details/" + e.getStr("sale_pricehttps://blog.csdn.net/m0_47384542/article/details/") + "'>选取https://blog.csdn.net/m0_47384542/article/details/"); productJson.add(productinfo); } return toJsonAPI(productJson); } @ResponseBody @RequestMapping("/getProductByBargainIdshttps://blog.csdn.net/m0_47384542/article/details/") public String getProductByBargainIds(@RequestParam String token,String bargain_ids,Integer bargainGetType) throws Exception { logger.info("进入 bargainController-getProductByBargainIds,微页面根据bargain_ids 获取砍价商品活动列表https://blog.csdn.net/m0_47384542/article/details/"); FormMap formMap = new FormMap(); try { formMap.put("shop_idhttps://blog.csdn.net/m0_47384542/article/details/", DesUtil.decrypt(token)); } catch (Exception e) { e.printStackTrace(); logger.error("token 解密失败https://blog.csdn.net/m0_47384542/article/details/"); return "https://blog.csdn.net/m0_47384542/article/details/"; } if (!StringUtils.isEmpty(bargain_ids)&& bargainGetType==0) { formMap.put("bargain_idshttps://blog.csdn.net/m0_47384542/article/details/", StringUtils.strip(bargain_ids, "[]https://blog.csdn.net/m0_47384542/article/details/").split(",https://blog.csdn.net/m0_47384542/article/details/")); }formMap.put("end_timehttps://blog.csdn.net/m0_47384542/article/details/",new Date()); List<E> BargainList = bargainService.getProductByBargainIds(formMap); return toJsonAPI(BargainList); }}
@Controller@RequestMapping(value = "/ump/couponshttps://blog.csdn.net/m0_47384542/article/details/")public class CouponsController extends AdminController {public static Logger logger= Logger.getLogger(CouponsController.class);@Resourceprivate CouponService couponService;@ResourceParameterService parameterService;@ResourceWeixinOpenService weixinOpenService; @RequestMapping("/couponsListhttps://blog.csdn.net/m0_47384542/article/details/")public UIview couponsList(){logger.info("进入CouponsController-couponsList,优惠券列表展示https://blog.csdn.net/m0_47384542/article/details/");UIview view = UIView("/center/ump/coupons/couponsListhttps://blog.csdn.net/m0_47384542/article/details/",false); FormMap formMap=getFormMap(); PageHelper.startPage(formMap.getPage(), formMap.getRows()); List<E> list=couponService.selectList(formMap); view.addObject("pageInfohttps://blog.csdn.net/m0_47384542/article/details/", new PageInfo<E>(list)); view.addObject("queryParamhttps://blog.csdn.net/m0_47384542/article/details/", formMap);return view;} @RequestMapping("/createhttps://blog.csdn.net/m0_47384542/article/details/")public UIview create(){UIview view=UIView("/center/ump/coupons/couponsCreatehttps://blog.csdn.net/m0_47384542/article/details/", false);return view;} @RequestMapping("/edithttps://blog.csdn.net/m0_47384542/article/details/")public UIview edit(){logger.info("进入CouponsController-edit,优惠券编辑https://blog.csdn.net/m0_47384542/article/details/");UIview view=UIView("/center/ump/coupons/couponsCreatehttps://blog.csdn.net/m0_47384542/article/details/", false);FormMap formMap=getFormMap();E coupon=couponService.selectCoupon(formMap);view.addObject("couponhttps://blog.csdn.net/m0_47384542/article/details/", coupon);return view;} @RequestMapping("/savehttps://blog.csdn.net/m0_47384542/article/details/")public ModelAndView save(){logger.info("进入CouponsController-save,优惠券新增保存https://blog.csdn.net/m0_47384542/article/details/");UIview view=UIView("couponsListhttps://blog.csdn.net/m0_47384542/article/details/", true); FormMap formMap=getFormMap(); //判断优惠形式type=1,2,3 if(formMap.getInt("typehttps://blog.csdn.net/m0_47384542/article/details/")==1){//优惠形式表示“指定金额” formMap.set("coupon_discounthttps://blog.csdn.net/m0_47384542/article/details/", null); formMap.set("random_min_pricehttps://blog.csdn.net/m0_47384542/article/details/", null); formMap.set("random_max_pricehttps://blog.csdn.net/m0_47384542/article/details/", null); }else if(formMap.getInt("typehttps://blog.csdn.net/m0_47384542/article/details/")==2){//优惠形式表示“打折” formMap.set("coupon_pricehttps://blog.csdn.net/m0_47384542/article/details/", null); formMap.set("random_min_pricehttps://blog.csdn.net/m0_47384542/article/details/", null); formMap.set("random_max_pricehttps://blog.csdn.net/m0_47384542/article/details/", null); }else{//优惠形式表示“指定金额(随机)” formMap.set("coupon_discounthttps://blog.csdn.net/m0_47384542/article/details/", null); formMap.set("coupon_pricehttps://blog.csdn.net/m0_47384542/article/details/", null); } //判断生效条件is_condition=-1,1//生效条件表示“无条件” if(formMap.getInt("is_conditionhttps://blog.csdn.net/m0_47384542/article/details/")==-1){ formMap.set("condition_pricehttps://blog.csdn.net/m0_47384542/article/details/", null); }formMap.put("statehttps://blog.csdn.net/m0_47384542/article/details/",1); //判断使用有效期方式use_type=1 固定范围 ,2 指定时间范围//使用有效期表示“固定范围” if(formMap.getInt("use_typehttps://blog.csdn.net/m0_47384542/article/details/")==1){ formMap.set("from_dayhttps://blog.csdn.net/m0_47384542/article/details/", null); formMap.set("to_dayhttps://blog.csdn.net/m0_47384542/article/details/", null); //如果开始时间小于当前时间 则优惠券处于未生效状态 ,其他情况都是生效状态if (System.currentTimeMillis()< DateUtil.getTimeByString(formMap.getStr("start_timehttps://blog.csdn.net/m0_47384542/article/details/"),"yyyy/MM/dd HH:mm:sshttps://blog.csdn.net/m0_47384542/article/details/")){formMap.put("statehttps://blog.csdn.net/m0_47384542/article/details/",-2);} }else{ formMap.set("start_timehttps://blog.csdn.net/m0_47384542/article/details/", null); formMap.set("end_timehttps://blog.csdn.net/m0_47384542/article/details/", null); } //判断没人领取限制//使用有效期表示“不限制领取熟量” if(formMap.getInt("maxLimitTypehttps://blog.csdn.net/m0_47384542/article/details/")==1){ formMap.set("max_limithttps://blog.csdn.net/m0_47384542/article/details/", 0); } //判断可使用商品//使用有效期表示“全网商品通用” if(formMap.getInt("product_range_typehttps://blog.csdn.net/m0_47384542/article/details/")==1){ formMap.set("product_idshttps://blog.csdn.net/m0_47384542/article/details/", null); }else{ formMap.set("product_idshttps://blog.csdn.net/m0_47384542/article/details/", formMap.getStr("selectProductValueshttps://blog.csdn.net/m0_47384542/article/details/")); } //判断是新增还是修改//新增优惠券判断if(StringUtils.isEmpty(formMap.getStr("validate_idhttps://blog.csdn.net/m0_47384542/article/details/"))){couponService.insert(formMap);}else{//修改优惠券couponService.edit(formMap);}return view;}@RequestMapping("/statehttps://blog.csdn.net/m0_47384542/article/details/")public UIview state(){logger.info("进入CouponsController-state,优惠券生效&不生效操作https://blog.csdn.net/m0_47384542/article/details/");UIview view=UIView("couponsListhttps://blog.csdn.net/m0_47384542/article/details/", true);FormMap formMap=getFormMap();formMap.set("onlyUpdateStatehttps://blog.csdn.net/m0_47384542/article/details/", "statehttps://blog.csdn.net/m0_47384542/article/details/");couponService.edit(formMap);return view;}@RequestMapping("/removehttps://blog.csdn.net/m0_47384542/article/details/")public UIview remove(){logger.info("进入CouponsController-remove,优惠券删除https://blog.csdn.net/m0_47384542/article/details/");UIview view=UIView("couponsListhttps://blog.csdn.net/m0_47384542/article/details/", true);FormMap formMap=getFormMap();formMap.set("statehttps://blog.csdn.net/m0_47384542/article/details/", "0https://blog.csdn.net/m0_47384542/article/details/");List<E> list=couponService.selectCouponUserList(formMap);if(list.size() > 0){//该优惠券还有未使用的用户view.addErrorMessage("删除失败,该优惠券还有未使用的用户!https://blog.csdn.net/m0_47384542/article/details/");}else{couponService.remove(formMap);view.addPNotifyMessage("优惠券删除成功!https://blog.csdn.net/m0_47384542/article/details/");} return view;} @RequestMapping("/couponsGivehttps://blog.csdn.net/m0_47384542/article/details/")public UIview couponsGive(){logger.info("进入CouponsController-couponsGive,优惠券推广与派发https://blog.csdn.net/m0_47384542/article/details/");UIview view = UIView("/center/ump/coupons/couponsGivehttps://blog.csdn.net/m0_47384542/article/details/",false); FormMap formMap=getFormMap(); PageHelper.startPage(formMap.getPage(), formMap.getRows()); //查询没有领取该优惠券的用户列表与领取了但是没有超过优惠券最大设置限购数的用户列表 List<E> list=couponService.selectNoCouponUserList(formMap); view.addObject("pageInfohttps://blog.csdn.net/m0_47384542/article/details/", new PageInfo<E>(list)); view.addObject("queryParamhttps://blog.csdn.net/m0_47384542/article/details/", formMap);E publicInfo=(E)this.getSession().getAttribute("publicInfohttps://blog.csdn.net/m0_47384542/article/details/");if (publicInfo!=null){//获取公众号优惠券地址 和 链接formMap.put("item_namehttps://blog.csdn.net/m0_47384542/article/details/","COUPONSMPQRCODEhttps://blog.csdn.net/m0_47384542/article/details/");E paramInfo = parameterService.selectShopParamByName(formMap);this.getSession().setAttribute("couponMpQrCodeUrlhttps://blog.csdn.net/m0_47384542/article/details/",String.format(Constants.COUPON_QR_CODE,publicInfo.getStr("authorizer_app_idhttps://blog.csdn.net/m0_47384542/article/details/")));if (paramInfo!=null){this.getSession().setAttribute("couponMpQrcodehttps://blog.csdn.net/m0_47384542/article/details/",paramInfo.getStr("item_valuehttps://blog.csdn.net/m0_47384542/article/details/"));}else {WeiitQrCodeUtil qrCodeUtil = new WeiitQrCodeUtil();String qrCodePath = qrCodeUtil.createQRCodeAndUploadQcloud(String.format(Constants.COUPON_QR_CODE,publicInfo.getStr("authorizer_app_idhttps://blog.csdn.net/m0_47384542/article/details/")));//入库FormMap insertParam = new FormMap();insertParam.put("item_codehttps://blog.csdn.net/m0_47384542/article/details/","COUPONQRCODEhttps://blog.csdn.net/m0_47384542/article/details/");insertParam.put("item_namehttps://blog.csdn.net/m0_47384542/article/details/","COUPONSMPQRCODEhttps://blog.csdn.net/m0_47384542/article/details/");insertParam.put("item_valuehttps://blog.csdn.net/m0_47384542/article/details/",WeiitUtil.getFileDomain()+qrCodePath);insertParam.put("item_deschttps://blog.csdn.net/m0_47384542/article/details/","公众号优惠券领取二维码https://blog.csdn.net/m0_47384542/article/details/");insertParam.put("statehttps://blog.csdn.net/m0_47384542/article/details/",0);insertParam.put("shop_idhttps://blog.csdn.net/m0_47384542/article/details/",formMap.get("shop_idhttps://blog.csdn.net/m0_47384542/article/details/"));parameterService.insert(insertParam);this.getSession().setAttribute("couponMpQrcodehttps://blog.csdn.net/m0_47384542/article/details/",WeiitUtil.getFileDomain()+qrCodePath);}}E miniPublicInfo = (E) this.getSession().getAttribute("miniPublicInfohttps://blog.csdn.net/m0_47384542/article/details/");if (miniPublicInfo!=null){//获取公众号优惠券地址 和 链接formMap.put("item_namehttps://blog.csdn.net/m0_47384542/article/details/","COUPONSMAQRCODEhttps://blog.csdn.net/m0_47384542/article/details/");E paramInfo = parameterService.selectShopParamByName(formMap);if (paramInfo!=null){this.getSession().setAttribute("couponMaQrcodehttps://blog.csdn.net/m0_47384542/article/details/",paramInfo.getStr("item_valuehttps://blog.csdn.net/m0_47384542/article/details/"));}else {try {formMap.put("appidhttps://blog.csdn.net/m0_47384542/article/details/",miniPublicInfo.getStr("authorizer_app_idhttps://blog.csdn.net/m0_47384542/article/details/"));File file = weixinOpenService.getInstance(formMap).getWxOpenComponentService().getWxMaServiceByAppid(miniPublicInfo.getStr("authorizer_app_idhttps://blog.csdn.net/m0_47384542/article/details/")).getQrcodeService().createWxaCode("pages/Receive_coupons/Receive_couponshttps://blog.csdn.net/m0_47384542/article/details/",225);String qrCodePath = WeiitUtil.uploadFile(FileUtils.readFileToByteArray(file),"pnghttps://blog.csdn.net/m0_47384542/article/details/");FormMap insertParam = new FormMap();insertParam.put("item_codehttps://blog.csdn.net/m0_47384542/article/details/","COUPONQRCODEhttps://blog.csdn.net/m0_47384542/article/details/");insertParam.put("item_namehttps://blog.csdn.net/m0_47384542/article/details/","COUPONSMAQRCODEhttps://blog.csdn.net/m0_47384542/article/details/");insertParam.put("item_valuehttps://blog.csdn.net/m0_47384542/article/details/",WeiitUtil.getFileDomain()+qrCodePath);insertParam.put("item_deschttps://blog.csdn.net/m0_47384542/article/details/","小程序优惠券领取二维码https://blog.csdn.net/m0_47384542/article/details/");insertParam.put("statehttps://blog.csdn.net/m0_47384542/article/details/",0);insertParam.put("shop_idhttps://blog.csdn.net/m0_47384542/article/details/",formMap.get("shop_idhttps://blog.csdn.net/m0_47384542/article/details/"));parameterService.insert(insertParam);this.getSession().setAttribute("couponMaQrcodehttps://blog.csdn.net/m0_47384542/article/details/",WeiitUtil.getFileDomain()+qrCodePath);} catch (Exception e) {e.printStackTrace();}}}return view;}@RequestMapping("/couponsGiveSavehttps://blog.csdn.net/m0_47384542/article/details/")public UIview couponsGiveSave(){logger.info("进入CouponsController-couponsGiveSave,优惠券推广提交https://blog.csdn.net/m0_47384542/article/details/");FormMap formMap=getFormMap();String message=couponService.insertCouponUserTrans(formMap);UIview view = UIView("couponsGive?validate_id=https://blog.csdn.net/m0_47384542/article/details/"+formMap.getStr("validate_idhttps://blog.csdn.net/m0_47384542/article/details/")+"&validate_id_token=https://blog.csdn.net/m0_47384542/article/details/"+formMap.getStr("validate_id_tokenhttps://blog.csdn.net/m0_47384542/article/details/"),true);if(message==null){view.addPNotifyMessage("会员优惠券派送成功!https://blog.csdn.net/m0_47384542/article/details/");}else{view.addErrorMessage(message);}return view;}@RequestMapping("/couponsUserListhttps://blog.csdn.net/m0_47384542/article/details/")public UIview couponsUserList(){logger.info("进入CouponsController-couponsUserList,发优惠券记录https://blog.csdn.net/m0_47384542/article/details/");UIview view = UIView("/center/ump/coupons/couponsUserListhttps://blog.csdn.net/m0_47384542/article/details/",false); FormMap formMap=getFormMap(); E coupon = couponService.selectOne(formMap); PageHelper.startPage(formMap.getPage(), formMap.getRows()); //查询该优惠券已经派发过的用户 List<E> list=couponService.selectCouponUserList(formMap); view.addObject("pageInfohttps://blog.csdn.net/m0_47384542/article/details/", new PageInfo<E>(list)); view.addObject("queryParamhttps://blog.csdn.net/m0_47384542/article/details/", formMap); view.addObject("couponhttps://blog.csdn.net/m0_47384542/article/details/", coupon);return view; }@RequestMapping("/couponsUserRemovehttps://blog.csdn.net/m0_47384542/article/details/")public UIview couponsUserRemove(){logger.info("进入CouponsController-couponsUserRemove,派发优惠券 回收https://blog.csdn.net/m0_47384542/article/details/");FormMap formMap=getFormMap();String message=couponService.removeCouponUserTrans(formMap);UIview view = UIView("couponsUserList?validate_id=https://blog.csdn.net/m0_47384542/article/details/"+formMap.getStr("validate_idhttps://blog.csdn.net/m0_47384542/article/details/")+"&validate_id_token=https://blog.csdn.net/m0_47384542/article/details/"+formMap.getStr("validate_id_tokenhttps://blog.csdn.net/m0_47384542/article/details/"),true);if(message==null){view.addPNotifyMessage("优惠券回收成功!https://blog.csdn.net/m0_47384542/article/details/");}else{view.addErrorMessage(message);}return view;}@RequestMapping(value = "/getCouponListhttps://blog.csdn.net/m0_47384542/article/details/",method = RequestMethod.GET)@ResponseBodypublic E getCouponList(@RequestParam String token,String coupon_name) {logger.info("进入CouponsController-getCouponList,获取优惠券列表https://blog.csdn.net/m0_47384542/article/details/");FormMap formMap=new FormMap();E result = new E();try {formMap.put("shop_idhttps://blog.csdn.net/m0_47384542/article/details/", DesUtil.decrypt(token));} catch (Exception e) {e.printStackTrace();logger.error("token 解密失败https://blog.csdn.net/m0_47384542/article/details/");result.put("couponListhttps://blog.csdn.net/m0_47384542/article/details/",null);return result;}formMap.put("coupon_namehttps://blog.csdn.net/m0_47384542/article/details/",coupon_name);List<E> list = couponService.selectList(formMap);result.put("couponListhttps://blog.csdn.net/m0_47384542/article/details/",list);//绑定上一次参数return result;}@RequestMapping(value = "/couponListByIdshttps://blog.csdn.net/m0_47384542/article/details/",method = RequestMethod.GET)@ResponseBodypublic String couponListByIds(@RequestParam String token,String coupon_ids,Integer couponType){logger.info("ActivityController-couponListByIds,微页面 优惠券展示https://blog.csdn.net/m0_47384542/article/details/");FormMap formMap = new FormMap();try {formMap.put("shop_idhttps://blog.csdn.net/m0_47384542/article/details/", DesUtil.decrypt(token));} catch (Exception e) {e.printStackTrace();logger.error("token 解密失败https://blog.csdn.net/m0_47384542/article/details/");return "https://blog.csdn.net/m0_47384542/article/details/";}formMap.put("couponTypehttps://blog.csdn.net/m0_47384542/article/details/",couponType);if (!StringUtils.isEmpty(coupon_ids) && couponType==0){formMap.put("coupon_idshttps://blog.csdn.net/m0_47384542/article/details/", StringUtils.strip(coupon_ids, "[]https://blog.csdn.net/m0_47384542/article/details/").split(",https://blog.csdn.net/m0_47384542/article/details/"));}formMap.put("end_timehttps://blog.csdn.net/m0_47384542/article/details/",new Date());List<E> list = couponService.couponListByIds(formMap);return toJsonAPI(list);}}
作者:KJ.JK
文章对你有所帮助的话,欢迎给个赞或者 star,你的支持是对作者最大的鼓励,不足之处可以在评论区多多指正,交流学习
来源地址:https://blog.csdn.net/m0_47384542/article/details/126085194