秒杀系统java实现

时间:2021-07-09 07:48:59
【文件属性】:
文件名称:秒杀系统java实现
文件大小:27.19MB
文件格式:RAR
更新时间:2021-07-09 07:48:59
java java实现秒杀系统@Controller @RequestMapping("seckill")//url:/模块/资源/{id}/细分 /seckill/list public class SeckillController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private SeckillService seckillService; @RequestMapping(value="/list",method = RequestMethod.GET) public String list(Model model){ //获取列表页 List list=seckillService.getSeckillList(); model.addAttribute("list",list); //list.jsp+model = ModelAndView return "list";//WEB-INF/jsp/"list".jsp } @RequestMapping(value = "/{seckillId}/detail",method = RequestMethod.GET) public String detail(@PathVariable("seckillId") Long seckillId, Model model){ if (seckillId == null){ return "redirect:/seckill/list"; } Seckill seckill = seckillService.getById(seckillId); if (seckill == null){ return "forward:/seckill/list"; } model.addAttribute("seckill",seckill); return "detail"; } //ajax json @RequestMapping(value = "/{seckillId}/exposer", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) @ResponseBody public SeckillResult exposer(@PathVariable("seckillId") Long seckillId){ SeckillResult result; try { Exposer exposer =seckillService.exportSeckillUrl(seckillId); result = new SeckillResult(true,exposer); } catch (Exception e) { logger.error(e.getMessage(),e); result = new SeckillResult(false,e.getMessage()); } return result; } @RequestMapping(value = "/{seckillId}/{md5}/execution", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"} ) @ResponseBody public SeckillResult execute(@PathVariable("seckillId")Long seckillId, @PathVariable("md5")String md5, @CookieValue(value = "killPhone",required = false) Long phone){ if (phone == null){ return new SeckillResult(false,"未注册"); } SeckillResult result; try { SeckillExecution execution =seckillService.executeSeckill(seckillId,phone,md5); return new SeckillResult(true,execution); } catch (RepeatKillException e) { SeckillExecution execution =new SeckillExecution(seckillId,SeckillStatEnum.REPEAT_KILL); return new SeckillResult(true,execution); }catch (SeckillCloseException e) { SeckillExecution execution =new SeckillExecution(seckillId,SeckillStatEnum.END);
【文件预览】:
WEB-INF
----web.xml(1KB)
----jsp()
--------ddd.jsp(687B)
--------list.jsp(2KB)
--------common()
--------detail.jsp(710B)
----lib()
--------standard-1.1.2.jar(384KB)
--------mybatis-3.4.6.jar(1.55MB)
--------c3p0-0.9.5.2.jar(486KB)
--------logback-core-1.2.3.jar(461KB)
--------spring-beans-5.0.6.RELEASE.jar(645KB)
--------jstl-1.2.jar(405KB)
--------spring-web-5.0.6.RELEASE.jar(1.2MB)
--------spring-core-5.0.6.RELEASE.jar(1.17MB)
--------spring-tx-5.0.6.RELEASE.jar(249KB)
--------jackson-databind-2.9.5.jar(1.28MB)
--------spring-expression-5.0.6.RELEASE.jar(273KB)
--------protobuf-java-2.6.0.jar(582KB)
--------spring-aop-5.0.6.RELEASE.jar(358KB)
--------spring-context-5.0.6.RELEASE.jar(1.04MB)
--------spring-jcl-5.0.6.RELEASE.jar(21KB)
--------mysql-connector-java-8.0.11.jar(1.94MB)
--------logback-classic-1.2.3.jar(284KB)
--------jackson-annotations-2.9.0.jar(65KB)
--------spring-webmvc-5.0.6.RELEASE.jar(771KB)
--------jackson-core-2.9.5.jar(314KB)
--------mchange-commons-java-0.2.11.jar(592KB)
--------mybatis-spring-1.3.2.jar(52KB)
--------slf4j-api-1.7.25.jar(40KB)
--------spring-test-5.0.6.RELEASE.jar(591KB)
--------spring-jdbc-5.0.6.RELEASE.jar(392KB)
--------javax.servlet-api-4.0.1.jar(93KB)
----classes()
--------org()
--------mybatis-config.xml(625B)
--------jdbc.properties(243B)
--------logback.xml(512B)
--------spring()
--------mapper()
index.jsp
META-INF
----MANIFEST.MF(95B)

网友评论