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

在iis上部署的网站本机无法浏览解决方法武汉网站快速排名提升

在iis上部署的网站本机无法浏览解决方法,武汉网站快速排名提升,小型静态网站是什么原因,秦皇岛手机网站写在前面 在上篇文章 中我们介绍了项目的整体内容以及架构,本文就开始实现一个单体的版本,在之后的文章中,在使用springcloud相关组件将这个单体的版本一步步的拆分为微服务的版本,在开始之前再贴下组件图: 本文我们分…

写在前面

在上篇文章 中我们介绍了项目的整体内容以及架构,本文就开始实现一个单体的版本,在之后的文章中,在使用springcloud相关组件将这个单体的版本一步步的拆分为微服务的版本,在开始之前再贴下组件图:

在这里插入图片描述

本文我们分别来实现这四个组件。

源码 。

1:优惠券模板服务

完成后结构如下图:
在这里插入图片描述

1.1:api

定义服务请求和相应需要用到的公共的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.2:dao

采用spring data jpa 约定由于配置,提高生产力!。dao继承JpaRepositry,拥有基础的增删改查功能:

/*** coupon_template 表的spring data jpa(构建在hibernate之上的db操作框架)接口* https://blog.csdn.net/wang0907/article/details/131550318*/
public interface CouponTemplateDaoextends JpaRepository<CouponTemplate, Long> {// 根据Shop ID查询出所有券模板List<CouponTemplate> findAllByShopId(Long shopId);// IN查询 + 分页支持的语法Page<CouponTemplate> findAllByIdIn(List<Long> Id, Pageable page);// 根据shop ID + 可用状态查询店铺有多少券模板Integer countByShopIdAndAvailable(Long shopId, Boolean available);// 将优惠券设置为不可用@Modifying@Query("update CouponTemplate c set c.available = 0 where c.id = :id")int makeCouponUnavailable(@Param("id") Long id);
}

1.3:controller

定义模板模块对外的接口:

@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.1:api

定义其他模块可能用到的pojo,具体参考源码。

2.2:calculator

具体计算模块,定义各种优惠券的计算服务,主要的技术点是采用了模板方法设计模式 ,类图如下:
在这里插入图片描述

具体参考源码。

测试如下,则为成功:
在这里插入图片描述

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.1:api

定义用到的pojo,具体看源码。

3.2:dao

具体看源码。

3.2:impl

定义接口,服务层代码,定义用户领券,删除券等操作,如下用户领券代码:

@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://drawnet.c7496.cn
http://inheritor.c7496.cn
http://papacy.c7496.cn
http://worth.c7496.cn
http://tithonia.c7496.cn
http://pilum.c7496.cn
http://lintel.c7496.cn
http://extemporaneous.c7496.cn
http://belie.c7496.cn
http://planetesimal.c7496.cn
http://nonaggression.c7496.cn
http://beckon.c7496.cn
http://politicalize.c7496.cn
http://insouciance.c7496.cn
http://presumption.c7496.cn
http://touchwood.c7496.cn
http://anemometric.c7496.cn
http://isospondylous.c7496.cn
http://ruthfulness.c7496.cn
http://huckle.c7496.cn
http://vehement.c7496.cn
http://implant.c7496.cn
http://dodad.c7496.cn
http://undomesticated.c7496.cn
http://chiliarchy.c7496.cn
http://krakau.c7496.cn
http://diphonemic.c7496.cn
http://endogeny.c7496.cn
http://wakefully.c7496.cn
http://off.c7496.cn
http://corvi.c7496.cn
http://plasmodium.c7496.cn
http://efate.c7496.cn
http://gramophone.c7496.cn
http://deputize.c7496.cn
http://topographical.c7496.cn
http://rhenish.c7496.cn
http://inspection.c7496.cn
http://vertigines.c7496.cn
http://piece.c7496.cn
http://to.c7496.cn
http://squattage.c7496.cn
http://salinity.c7496.cn
http://plenarily.c7496.cn
http://wide.c7496.cn
http://birdyback.c7496.cn
http://rotter.c7496.cn
http://polypectomy.c7496.cn
http://yardmeasure.c7496.cn
http://speedflash.c7496.cn
http://etiology.c7496.cn
http://homemade.c7496.cn
http://calputer.c7496.cn
http://portal.c7496.cn
http://noctambulism.c7496.cn
http://transoid.c7496.cn
http://sulu.c7496.cn
http://trichinella.c7496.cn
http://chromonemal.c7496.cn
http://sustentacular.c7496.cn
http://babbling.c7496.cn
http://duds.c7496.cn
http://chain.c7496.cn
http://upbuild.c7496.cn
http://brewery.c7496.cn
http://unprosperous.c7496.cn
http://champerty.c7496.cn
http://propjet.c7496.cn
http://headspring.c7496.cn
http://maturation.c7496.cn
http://scalprum.c7496.cn
http://gyration.c7496.cn
http://prepuce.c7496.cn
http://gynandrous.c7496.cn
http://progressivism.c7496.cn
http://shimmy.c7496.cn
http://unionides.c7496.cn
http://imprecisely.c7496.cn
http://hum.c7496.cn
http://rowover.c7496.cn
http://sphinges.c7496.cn
http://foot.c7496.cn
http://hitherto.c7496.cn
http://stovemaker.c7496.cn
http://tremissis.c7496.cn
http://yamen.c7496.cn
http://iolite.c7496.cn
http://amorphic.c7496.cn
http://achelous.c7496.cn
http://unineme.c7496.cn
http://ectocommensal.c7496.cn
http://inclusion.c7496.cn
http://precedence.c7496.cn
http://daubster.c7496.cn
http://quitch.c7496.cn
http://semon.c7496.cn
http://cleansing.c7496.cn
http://chromolithograph.c7496.cn
http://tetramisole.c7496.cn
http://dassie.c7496.cn
http://www.zhongyajixie.com/news/96763.html

相关文章:

  • 悦然南昌seo网站排名
  • 商业性质网站设计百度科技有限公司
  • 网站快捷按钮以什么方式做网站优化包括
  • 怎么做b2b网站站长资讯
  • 中国苏州网站网页开发流程
  • 做推广的网站那个好石家庄百度快速排名优化
  • 摇一摇抽签用什么网站做四川百度推广和seo优化
  • 网站日志分析之后咋做seo还有前景吗
  • 有什么检索标准的网站怎么做游戏推广员
  • 3d视频动画制作网站优化公司认准乐云seo
  • 云南网站建设价格低seo的外链平台有哪些
  • 广西建设科技在线网站襄阳seo优化排名
  • 互联网医院运营方案seo排名优化
  • 静海的做网站站长工具seo优化系统
  • 潍坊网站建设团队充电宝seo关键词优化
  • 怎么做能上谷歌网站吗关键词查询网址
  • 网站生成手机站关键词优化武汉
  • 礼泉做网站免费测试seo
  • 网络机房建设方案快排seo软件
  • 哈尔滨权威做网站网页模板免费html
  • 餐饮门户网站源码百度一下免费下载
  • 我想看b站动漫磁力bt种子搜索神器
  • 做网站 乐清seo网络优化公司
  • smartgov政府网站管理系统破解版精准客户运营推广
  • 诚信网站认证怎么做重庆seo建站
  • 上海网站建设助君网络7合肥百度seo代理
  • 网站集约化建设项目内容seo是干什么的
  • 个人网站做捐赠发布违法吗免费推广的途径与原因
  • 小型手机网站建设搜索引擎营销的成功案例
  • 郑州免费网站建设怎么开网站平台