当前位置: 首页 > news >正文

如何注册网站域名专业的企业网站建设公司

如何注册网站域名,专业的企业网站建设公司,公司网站备案流程,网站用微信登录 要怎么做写在前面 在上篇文章 中我们介绍了项目的整体内容以及架构#xff0c;本文就开始实现一个单体的版本#xff0c;在之后的文章中#xff0c;在使用springcloud相关组件将这个单体的版本一步步的拆分为微服务的版本#xff0c;在开始之前再贴下组件图#xff1a; 本文我们分…写在前面 在上篇文章 中我们介绍了项目的整体内容以及架构本文就开始实现一个单体的版本在之后的文章中在使用springcloud相关组件将这个单体的版本一步步的拆分为微服务的版本在开始之前再贴下组件图 本文我们分别来实现这四个组件。 源码 。 1优惠券模板服务 完成后结构如下图 1.1api 定义服务请求和相应需要用到的公共的beans单独定义的好处是如果需要用到的话单独引用即可不需要引入其他不需要的类。 首先来定义优惠券类型的枚举: Getter AllArgsConstructor public enum CouponType {UNKNOWN(unknown, 0),MONEY_OFF(满减券, 1),DISCOUNT(打折, 2),RANDOM_DISCOUNT(随机减, 3),LONELY_NIGHT_MONEY_OFF(晚间双倍优惠券, 4);private String description;// 存在数据库里的最终codeprivate String code;public static CouponType convert(String code) {// .orElse(UNKNOWN) 避免有人使坏return Stream.of(values()).filter(bean - bean.code.equalsIgnoreCase(code)).findFirst().orElse(UNKNOWN);} }然后定义优惠券模板类 Data NoArgsConstructor AllArgsConstructor Builder public class CouponTemplateInfo {private Long id;NotNullprivate String name;// 优惠券描述NotNullprivate String desc;// 优惠券类型NotNullprivate String type;// 适用门店 - 若无则为全店通用券private Long shopId;/** 优惠券规则 */NotNullprivate TemplateRule rule;private Boolean available;}优惠券类 Data NoArgsConstructor AllArgsConstructor Builder public class CouponInfo {private Long id;private Long templateId;private Long userId;private Long shopId;private Integer status;private CouponTemplateInfo template;}具体的参考源码。 1.2dao 采用spring data jpa 约定由于配置提高生产力。dao继承JpaRepositry拥有基础的增删改查功能 /*** coupon_template 表的spring data jpa构建在hibernate之上的db操作框架接口* https://blog.csdn.net/wang0907/article/details/131550318*/ public interface CouponTemplateDaoextends JpaRepositoryCouponTemplate, Long {// 根据Shop ID查询出所有券模板ListCouponTemplate findAllByShopId(Long shopId);// IN查询 分页支持的语法PageCouponTemplate findAllByIdIn(ListLong Id, Pageable page);// 根据shop ID 可用状态查询店铺有多少券模板Integer countByShopIdAndAvailable(Long shopId, Boolean available);// 将优惠券设置为不可用ModifyingQuery(update CouponTemplate c set c.available 0 where c.id :id)int makeCouponUnavailable(Param(id) Long id); }1.3controller 定义模板模块对外的接口 Slf4j RestController RequestMapping(/template) public class CouponTemplateController {Autowiredprivate CouponTemplateService couponTemplateService;// 创建优惠券PostMapping(/addTemplate)public CouponTemplateInfo addTemplate(Valid RequestBody CouponTemplateInfo request) {log.info(Create coupon template: data{}, request);return couponTemplateService.createTemplate(request);}... }测试如下则为成功 2优惠券计算模块 2.1api 定义其他模块可能用到的pojo具体参考源码。 2.2calculator 具体计算模块定义各种优惠券的计算服务主要的技术点是采用了模板方法设计模式 ,类图如下 具体参考源码。 测试如下则为成功 json: {products:[{price:3000,count:2,shopId:3},{price:1000,count:4,shopId:1}],couponId:10,couponInfos:[{id:10,templateId:2,userId:null,shopId:null,template:{name:单店满减,desc:满40减5,type:1,available:true,shopId:1,rule:{limitation:10,discount:{quota:500,threshold:4000}}}}],userId:1}3用户服务 在pom中需要引入template和calculator这样我们就有了一个三合一的单体应用了后面我们来一起改造它。 3.1api 定义用到的pojo,具体看源码。 3.2dao 具体看源码。 3.2impl 定义接口服务层代码定义用户领券删除券等操作如下用户领券代码 PostMapping(requestCoupon) public Coupon requestCoupon(Valid RequestBody RequestCoupon request) {return customerService.requestCoupon(request); }启动后测试领券: {userId: 1,couponTemplateId: 2 }优惠券试算 {products: [{price: 3000,count: 2,shopId: 3},{price: 1000,count: 10,shopId: 1}],couponIDs: [1],userId: 1 }这样我们的一个单体应用就完成了掌声 4平台组建 写在后面 参考文章列表
http://www.hkea.cn/news/14367937/

相关文章:

  • 做一个搜索引擎网站要多少钱马鞍山 做网站
  • 高度重视部门网站建设龙岩上杭
  • 工行网站跟建设网站区别网页版qq农场
  • 域名主机网站导航有没有做网站的公司
  • 做名片赞机器人电脑网站是多少网络建设股票有哪些
  • 网站收录多少才有排名wordpress微信管理系统
  • 网站的盈利方式网络营销推广三板斧
  • 织梦网站底部黑链wordpress ap
  • 怎么提交百度收录关闭站长工具seo综合查询
  • vs网站制作教程百度手机版网址
  • 杭州建站网站建设搜索引擎推广特点
  • 电脑端网站和手机网站区别商标图案大全大图 logo
  • 网站建设硬件方案做包装找灵感看什么网站
  • 东莞市微客巴巴做网站怎么将自己做的网站发到网上去
  • 建设网站一般需要多少钱成都网站建设快速服务
  • 网站建设需要的技术手段网页登录界面制作
  • 网站seo优化有哪些搜索引擎大全入口
  • 网站推广策划报告航空航天网站建设建设公司资质要求
  • 高端的网站设计公司现在网站开发的前端语言
  • 天津模板建站代理怎么设计一个网站
  • 网站怎么样制作视频wordpress文章头部
  • 做网站为什么不要源代码网站页尾的作用
  • wap网站和internet网站百度拍照搜题
  • 做网站 站内搜索引擎做钻石资讯网站
  • 网站设计步骤图片重庆建设摩托车网站
  • 河北公司网站开发报价网站建设
  • 买网站名称网络设计方案的重要性
  • 市场营销专业网站怎么做百度推广平台
  • 网站开发合同审核要点免费微商城小程序模板
  • 上海网站建设建议工商银行与建设银行网站对比