diff --git a/.idea/misc.xml b/.idea/misc.xml index 461b7f8..79c1d4d 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -11,5 +11,5 @@ - + \ No newline at end of file diff --git a/src/main/java/me/mofun/config/MySiteMeshFilter.java b/src/main/java/me/mofun/config/MySiteMeshFilter.java index 9977955..a77db94 100644 --- a/src/main/java/me/mofun/config/MySiteMeshFilter.java +++ b/src/main/java/me/mofun/config/MySiteMeshFilter.java @@ -18,7 +18,7 @@ public class MySiteMeshFilter extends ConfigurableSiteMeshFilter { builder.addExcludedPath("/editor/*"); // 添加装饰器映射 - builder.addDecoratorPath("*/WEB-INF/template/*", "/my/template_footer.jsp") + builder.addDecoratorPath("*/WEB-INF/template/**", "/my/template_footer.jsp") .addDecoratorPath("*/WEB-INF/template/**", "/root/index_template.jsp") .addDecoratorPath("*/WEB-INF/admin/*", "/admin_main.jsp") .addDecoratorPath("*/WEB-INF/admin/*", "/admin_template.jsp") diff --git a/src/main/java/me/mofun/config/MybatisPlusAutoFillConfig.java b/src/main/java/me/mofun/config/MybatisPlusAutoFillConfig.java index 4a849e4..097bfa6 100644 --- a/src/main/java/me/mofun/config/MybatisPlusAutoFillConfig.java +++ b/src/main/java/me/mofun/config/MybatisPlusAutoFillConfig.java @@ -13,11 +13,11 @@ public class MybatisPlusAutoFillConfig implements MetaObjectHandler { */ @Override public void insertFill(MetaObject metaObject) { - log.info("start insert fill ...."); + // log.info("start insert fill ...."); // 起始版本 3.3.0(推荐使用) - this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now()); - this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); - this.strictInsertFill(metaObject, "isDelete", Integer.class, 0); + // this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now()); + // this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); + // this.strictInsertFill(metaObject, "isDelete", Integer.class, 0); // // 或者 // this.strictInsertFill(metaObject, "createTime", () -> LocalDateTime.now(), LocalDateTime.class); // 起始版本 3.3.3(推荐) // // 或者 @@ -26,9 +26,9 @@ public class MybatisPlusAutoFillConfig implements MetaObjectHandler { @Override public void updateFill(MetaObject metaObject) { - log.info("start update fill ...."); + // log.info("start update fill ...."); // 起始版本 3.3.0(推荐) - this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); + // this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); // // 或者 // this.strictUpdateFill(metaObject, "updateTime", () -> LocalDateTime.now(), LocalDateTime.class); // 起始版本 3.3.3(推荐) // // 或者 diff --git a/src/main/java/me/mofun/config/QueryResult.java b/src/main/java/me/mofun/config/QueryResult.java index 144e748..462c7e4 100644 --- a/src/main/java/me/mofun/config/QueryResult.java +++ b/src/main/java/me/mofun/config/QueryResult.java @@ -1,5 +1,10 @@ package me.mofun.config; +import lombok.Getter; +import lombok.Setter; + +@Setter +@Getter public class QueryResult { private String r0_Cmd; //业务类型 @@ -14,77 +19,5 @@ public class QueryResult { private String rc_RefundCount; //已退款次数 private String rd_RefundAmt; //已退款金额 private String hmac; //密钥 - - public String getHmac() { - return hmac; - } - public void setHmac(String hmac) { - this.hmac = hmac; - } - public String getR0_Cmd() { - return r0_Cmd; - } - public void setR0_Cmd(String cmd) { - r0_Cmd = cmd; - } - public String getR1_Code() { - return r1_Code; - } - public void setR1_Code(String code) { - r1_Code = code; - } - public String getR2_TrxId() { - return r2_TrxId; - } - public void setR2_TrxId(String trxId) { - r2_TrxId = trxId; - } - public String getR3_Amt() { - return r3_Amt; - } - public void setR3_Amt(String amt) { - r3_Amt = amt; - } - public String getR4_Cur() { - return r4_Cur; - } - public void setR4_Cur(String cur) { - r4_Cur = cur; - } - public String getR5_Pid() { - return r5_Pid; - } - public void setR5_Pid(String pid) { - r5_Pid = pid; - } - public String getR6_Order() { - return r6_Order; - } - public void setR6_Order(String order) { - r6_Order = order; - } - public String getR8_MP() { - return r8_MP; - } - public void setR8_MP(String r8_mp) { - r8_MP = r8_mp; - } - public String getRb_PayStatus() { - return rb_PayStatus; - } - public void setRb_PayStatus(String rb_PayStatus) { - this.rb_PayStatus = rb_PayStatus; - } - public String getRc_RefundCount() { - return rc_RefundCount; - } - public void setRc_RefundCount(String rc_RefundCount) { - this.rc_RefundCount = rc_RefundCount; - } - public String getRd_RefundAmt() { - return rd_RefundAmt; - } - public void setRd_RefundAmt(String rd_RefundAmt) { - this.rd_RefundAmt = rd_RefundAmt; - } + } diff --git a/src/main/java/me/mofun/config/RefundResult.java b/src/main/java/me/mofun/config/RefundResult.java index 39844dd..6e5428c 100644 --- a/src/main/java/me/mofun/config/RefundResult.java +++ b/src/main/java/me/mofun/config/RefundResult.java @@ -1,5 +1,10 @@ package me.mofun.config; +import lombok.Getter; +import lombok.Setter; + +@Setter +@Getter public class RefundResult { private String r0_Cmd; // 请求命令 private String r1_Code; // 请求结果 @@ -8,51 +13,4 @@ public class RefundResult { private String r4_Cur; // 交易币种 private String hmac; // 签名校验 - public String getR0_Cmd() { - return r0_Cmd; - } - - public void setR0_Cmd(String cmd) { - r0_Cmd = cmd; - } - - public String getR1_Code() { - return r1_Code; - } - - public void setR1_Code(String code) { - r1_Code = code; - } - - public String getR2_TrxId() { - return r2_TrxId; - } - - public void setR2_TrxId(String trxId) { - r2_TrxId = trxId; - } - - public String getR3_Amt() { - return r3_Amt; - } - - public void setR3_Amt(String amt) { - r3_Amt = amt; - } - - public String getR4_Cur() { - return r4_Cur; - } - - public void setR4_Cur(String cur) { - r4_Cur = cur; - } - - public String getHmac() { - return hmac; - } - - public void setHmac(String hmac) { - this.hmac = hmac; - } } diff --git a/src/main/java/me/mofun/controller/IndexController.java b/src/main/java/me/mofun/controller/IndexController.java index dafcfe8..292f6ef 100644 --- a/src/main/java/me/mofun/controller/IndexController.java +++ b/src/main/java/me/mofun/controller/IndexController.java @@ -14,7 +14,6 @@ import me.mofun.util.UserNameUtil; import net.sf.json.JSONArray; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -119,7 +118,7 @@ public class IndexController { /** * 热门推荐商品 */ - @GetMapping("/getIndexHotProductList") + @GetMapping("/getIndexHotProductList.action") @ResponseBody public List getIndexHotProductList() { Pagination hotPage = spellbuyrecordService.findHotProductList(1, PAGE_SIZE_LARGE); @@ -137,9 +136,9 @@ public class IndexController { /** * 首页新品展示 */ - @GetMapping("/getIndexNewProductList") + @GetMapping("/getIndexNewProductList.action") @ResponseBody - public List getIndexNewProductList(@RequestParam(defaultValue = "0") int pageNo) { + public List getIndexNewProductList(@RequestParam(defaultValue = "0") int pageNo,@RequestParam String json) { Pagination newPage = spellbuyrecordService.indexNewProductList(pageNo, PAGE_SIZE_XLARGE); if (newPage == null) { return new ArrayList<>(); @@ -159,7 +158,7 @@ public class IndexController { /** * 人气排行商品 */ - @GetMapping("/getIndexPopProductList") + @GetMapping("/getIndexPopProductList.action") @ResponseBody public List getIndexPopProductList(@RequestParam(defaultValue = "0") int pageNo) { Pagination popPage = spellbuyrecordService.indexHotProductList(pageNo, PAGE_SIZE_MEDIUM); diff --git a/src/main/java/me/mofun/controller/NewsController.java b/src/main/java/me/mofun/controller/NewsController.java index 4617279..f499874 100644 --- a/src/main/java/me/mofun/controller/NewsController.java +++ b/src/main/java/me/mofun/controller/NewsController.java @@ -36,9 +36,8 @@ public class NewsController { ModelAndView mav = new ModelAndView("index"); // 视图名称对应原struts配置的结果 news = newsService.getById(id); newsTypeTopList = newstypeService.indexNewsTypeByParentId(0); - // 注意:这里原代码可能有问题,用news的id去查NewsType?建议确认业务逻辑 parentId = newstypeService.getById(id).getParentId(); - + mav.addObject("news", news); mav.addObject("newsTypeTopList", newsTypeTopList); mav.addObject("parentId", parentId); diff --git a/src/main/java/me/mofun/controller/ProductsController.java b/src/main/java/me/mofun/controller/ProductsController.java new file mode 100644 index 0000000..4aae6dd --- /dev/null +++ b/src/main/java/me/mofun/controller/ProductsController.java @@ -0,0 +1,372 @@ +package me.mofun.controller; + +import me.mofun.entity.*; +import me.mofun.entity.pojo.ParticipateJSON; +import me.mofun.entity.pojo.ProductInfo; +import me.mofun.entity.pojo.UserLimitBuy; +import me.mofun.entity.vo.Pagination; +import me.mofun.service.*; +import me.mofun.util.DateUtil; +import me.mofun.util.MD5Util; +import me.mofun.util.MemCachedClientHelp; +import me.mofun.util.UserNameUtil; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; + +@Controller +@RequestMapping("/products") +public class ProductsController { + + @Autowired + private ISpellbuyrecordService spellbuyrecordService; + + @Autowired + private ISpellbuyproductService spellbuyproductService; + + @Autowired + private ILatestlotteryService latestlotteryService; + + @Autowired + private IProductimageService productImageService; + + @Autowired + private IUserService userService; + + /** + * 商品详情页 + */ + @RequestMapping("/index/{id}.html") + public ModelAndView index(@PathVariable String id, + @RequestParam(defaultValue = "1") int pageNo, + HttpServletResponse response) throws IOException { + + ModelAndView mav = new ModelAndView(); + + if (pageNo == 0) { + pageNo = 1; + } else { + pageNo += 1; + } + + List participateJSONList = new ArrayList<>(); + + // 获取商品信息 + List proList = spellbuyproductService.findBySpellbuyProductId(Integer.parseInt(id)); + ProductInfo productInfo = new ProductInfo(); + Product product = (Product) proList.get(0)[0]; + Spellbuyproduct spellbuyproduct = (Spellbuyproduct) proList.get(0)[1]; + + // 设置商品信息 + productInfo.setProductPeriod(spellbuyproduct.getProductPeriod()); + productInfo.setProductId(product.getProductId()); + productInfo.setStatus(spellbuyproduct.getSpStatus()); + productInfo.setHeadImage(product.getHeadImage()); + productInfo.setProductDetail(product.getProductDetail()); + productInfo.setProductName(product.getProductName()); + productInfo.setProductPrice(spellbuyproduct.getSpellbuyPrice()); + productInfo.setMarketPrice(spellbuyproduct.getMarketPrice().floatValue()); + productInfo.setActionName(spellbuyproduct.getActionName()); + productInfo.setSinglePrice(spellbuyproduct.getSpSinglePrice()); + productInfo.setProductTitle(product.getProductTitle()); + productInfo.setSpellbuyCount(spellbuyproduct.getSpellbuyCount()); + productInfo.setSpellbuyProductId(spellbuyproduct.getSpellbuyProductId()); + productInfo.setBuyLimited(spellbuyproduct.getSpellbuyLimit()); + + // 获取商品期数列表 + List objectList = spellbuyproductService.productPeriodList(spellbuyproduct.getFkProductId()); + TreeMap productPeriodList = new TreeMap<>(new Comparator() { + public int compare(Integer o1, Integer o2) { + return o2.hashCode() - o1.hashCode(); + } + }); + + for (Object[] objects : objectList) { + Spellbuyproduct sp = (Spellbuyproduct) objects[1]; + productPeriodList.put(sp.getProductPeriod(), sp.getSpellbuyProductId()); + } + + // 获取商品图片 + List productimageList = productImageService.findByProductId(String.valueOf(product.getProductId()), "show"); + + // 获取参与记录 + Pagination pagination = spellbuyrecordService.LatestParticipate(id, pageNo, 6); + List list = (List) pagination.getList(); + + for (Object[] objects : list) { + ParticipateJSON participateJSON = new ParticipateJSON(); + Spellbuyrecord spellbuyrecord = (Spellbuyrecord) objects[0]; + User user = (User) objects[1]; + String userName = UserNameUtil.userName(user); + + participateJSON.setBuyCount(spellbuyrecord.getBuyPrice().toString()); + participateJSON.setBuyDate(DateUtil.getTime(DateUtil.SDateTimeToDate(spellbuyrecord.getBuyDate()))); + participateJSON.setBuyId(spellbuyrecord.getSpellbuyRecordId().toString()); + participateJSON.setIp_address(user.getIpAddress()); + participateJSON.setIp_location(user.getIpLocation()); + participateJSON.setUserName(userName); + participateJSON.setUserId(String.valueOf(user.getUserId())); + participateJSON.setUserFace(user.getFaceImg()); + participateJSONList.add(participateJSON); + } + + int resultCount = spellbuyrecordService.LatestParticipateByCount(id); + + // 将数据添加到Model中 + mav.addObject("productInfo", productInfo); + mav.addObject("productPeriodList", productPeriodList); + mav.addObject("productimageList", productimageList); + mav.addObject("participateJSONList", participateJSONList); + mav.addObject("resultCount", resultCount); + mav.addObject("pageNo", pageNo); + + // 根据状态返回不同页面 + if (productInfo.getStatus() == 2) { + mav.setViewName("/WEB-INF/template/my/products/lottery"); + } else if (productInfo.getStatus() == 1) { + response.sendRedirect("/lotteryDetail/" + productInfo.getSpellbuyProductId() + ".html"); + return null; + } else { + mav.setViewName("/WEB-INF/template/my/products/index"); + } + + return mav; + } + + /** + * 本商品往期拍购列表 + */ + @GetMapping("/getProductNewList") + @ResponseBody + public TreeMap getProductNewList(@RequestParam String id) { + Spellbuyproduct spellbuyproduct = spellbuyproductService.getById(id); + List objectList = spellbuyproductService.productPeriodList(spellbuyproduct.getFkProductId()); + TreeMap productPeriodList = new TreeMap<>(); + + for (Object[] objects : objectList) { + Spellbuyproduct sp = (Spellbuyproduct) objects[1]; + productPeriodList.put(sp.getProductPeriod(), sp.getSpellbuyProductId()); + } + + return productPeriodList; + } + + /** + * 分页加载参与记录 + */ + @GetMapping("/ajaxPage") + @ResponseBody + public List ajaxPage(@RequestParam String id, + @RequestParam(defaultValue = "1") int pageNo, + @RequestParam(defaultValue = "20") int pageSize) { + + if (pageNo == 0) { + pageNo = 1; + } else { + pageNo += 1; + } + + List participateJSONList = new ArrayList<>(); + Pagination pagination = spellbuyrecordService.LatestParticipate(id, pageNo, pageSize); + List list = (List) pagination.getList(); + + for (Object[] objects : list) { + ParticipateJSON participateJSON = new ParticipateJSON(); + Spellbuyrecord spellbuyrecord = (Spellbuyrecord) objects[0]; + User user = (User) objects[1]; + String userName = UserNameUtil.userName(user); + + participateJSON.setBuyCount(spellbuyrecord.getBuyPrice().toString()); + participateJSON.setBuyDate(spellbuyrecord.getBuyDate()); + participateJSON.setBuyId(spellbuyrecord.getSpellbuyRecordId().toString()); + participateJSON.setIp_address(user.getIpAddress()); + participateJSON.setIp_location(user.getIpLocation()); + participateJSON.setUserName(userName); + participateJSON.setUserId(String.valueOf(user.getUserId())); + participateJSON.setUserFace(user.getFaceImg()); + participateJSONList.add(participateJSON); + } + + return participateJSONList; + } + + /** + * 我的购买记录 + */ + @GetMapping("/getUserByHistory") + @ResponseBody + public List getUserByHistory(@RequestParam String id, HttpServletRequest request) { + Cookie[] cookies = request.getCookies(); + if (cookies != null) { + for (Cookie cookie : cookies) { + if (cookie.getName().equals("userId")) { + String userId = cookie.getValue(); + if (StringUtils.isNotBlank(userId)) { + return spellbuyrecordService.getUserByHistory(userId, id); + } + } + } + } + return new ArrayList<>(); + } + + /** + * 从cookie中获取用户ID + */ + private String getUserIdFromCookie(HttpServletRequest request) { + Cookie[] cookies = request.getCookies(); + if (cookies != null) { + for (Cookie cookie : cookies) { + if (cookie.getName().equals("userId")) { + return cookie.getValue(); + } + } + } + return ""; + } + + /** + * 检查限购情况 + */ + @GetMapping("/checkUserLimitBuy") + @ResponseBody + public UserLimitBuy checkUserLimitBuy(@RequestParam String id, + @RequestParam(required = false) String userId, + HttpServletRequest request) { + + String theUserId = StringUtils.isNotBlank(userId) ? userId : getUserIdFromCookie(request); + UserLimitBuy u = new UserLimitBuy(); + u.setCode(0); + + Spellbuyproduct spellbuyproduct = null; + Spellbuyrecord spellbuyrecord = null; + User user = null; + + if (StringUtils.isNotBlank(theUserId)) { + List objectList = spellbuyproductService.checkUserLimitBuy(id, theUserId); + + for (Object[] objects : objectList) { + spellbuyproduct = (Spellbuyproduct) objects[0]; + spellbuyrecord = (Spellbuyrecord) objects[1]; + user = (User) objects[2]; + break; + } + + if (spellbuyrecord == null) { + spellbuyproduct = spellbuyproductService.getById(id); + user = userService.findById(theUserId); + } + } else { + spellbuyproduct = spellbuyproductService.getById(id); + u.setCode(-10); + } + + if (spellbuyproduct != null) { + u.setCode(spellbuyproduct.getFkProductId()); + u.setCodeLimitBuy(spellbuyproduct.getSpellbuyLimit()); + u.setCodeRemainNum(spellbuyproduct.getSpellbuyPrice() - spellbuyproduct.getSpellbuyCount()); + u.setCodeState(spellbuyproduct.getSpStatus()); + + if (u.getCodeRemainNum() <= 0) { + u.setCode(-6); + } + } + + if (user != null) { + u.setUserMoney((float) (user.getBalance() != null ? user.getBalance().floatValue() : 0.0)); + } + + if (user != null && spellbuyrecord != null) { + u.setBuyNum(spellbuyrecord.getBuyPrice()); + } + + return u; + } + + /** + * 检查商品关注情况 + */ + @GetMapping("/checkCollectGoods") + @ResponseBody + public String checkCollectGoods() { + return "10"; + } + + /** + * 添加关注 + */ + @PostMapping("/addCollectGoods") + @ResponseBody + public String addCollectGoods(@RequestParam String id) { + return "10"; + } + + /** + * 是否可以开奖 + */ + @GetMapping("/isLottery") + @ResponseBody + public String isLottery(@RequestParam String id) { + String key = MD5Util.encode(id + "status"); + String isLotteryJSON; + + if (MemCachedClientHelp.getIMemcachedCache().get(key) == null) { + Spellbuyproduct spellbuyproduct = spellbuyproductService.getById(id); + long endDate = DateUtil.SDateTimeToDate(spellbuyproduct.getSpellbuyEndDate()).getTime(); + long nowDate = System.currentTimeMillis(); + + isLotteryJSON = "{\"spStatus\":\"" + spellbuyproduct.getSpStatus() + "\",\"date\":\"" + ((endDate - nowDate) / 1000) + "\"}"; + + try { + MemCachedClientHelp.getIMemcachedCache().put(key, String.valueOf(endDate), new Date(10 * 60 * 1000)); + } catch (Exception ex) { + ex.printStackTrace(); + } + } else { + long endDate = Long.parseLong((String) MemCachedClientHelp.getIMemcachedCache().get(key)); + long nowDate = System.currentTimeMillis(); + isLotteryJSON = "{\"spStatus\":\"2\",\"date\":\"" + ((endDate - nowDate) / 1000) + "\"}"; + } + + return isLotteryJSON; + } + + /** + * 无店铺信息页面 + */ + @RequestMapping("/index_no_shop_info") + public ModelAndView indexNoShopInfo() { + ModelAndView mav = new ModelAndView(); + mav.setViewName("/WEB-INF/template/my/products/index_NoShopInfo"); + return mav; + } + + /** + * 服务逻辑页面 + */ + @RequestMapping("/serviceLogic") + public ModelAndView serviceLogic(@RequestParam String logicURL) { + ModelAndView mav = new ModelAndView(); + mav.setViewName("/WEB-INF/template/my/products/serviceLogic/" + logicURL); + return mav; + } + + /** + * 产品类型菜单列表 + */ + @RequestMapping("/productTypeMenuList") + public ModelAndView productTypeMenuList() { + ModelAndView mav = new ModelAndView(); + mav.setViewName("/root/my/productTypeMenuList"); + return mav; + } +} \ No newline at end of file diff --git a/src/main/java/me/mofun/controller/RegisterController.java b/src/main/java/me/mofun/controller/RegisterController.java index efcd594..c833258 100644 --- a/src/main/java/me/mofun/controller/RegisterController.java +++ b/src/main/java/me/mofun/controller/RegisterController.java @@ -6,13 +6,9 @@ import me.mofun.entity.User; import me.mofun.service.IUserService; import me.mofun.util.*; import org.apache.commons.lang3.StringUtils; -import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.Cookie; @@ -20,6 +16,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; +import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.net.URLEncoder; @@ -28,9 +25,8 @@ import java.util.Random; @Controller @RequestMapping("/register") -public class RegisterController { +public class RegisterController implements Serializable { private static final long serialVersionUID = 5054777863371691520L; - private Logger logger = Logger.getLogger(this.getClass()); @Autowired private IUserService userService; @@ -38,7 +34,7 @@ public class RegisterController { public static IPSeeker seeker = new IPSeeker(); static HTMLFilter htmlFilter = new HTMLFilter(); - @GetMapping("/index") + @GetMapping("/index.html") public ModelAndView index(@RequestParam(required = false) String forward, HttpServletRequest request) { ModelAndView mav = new ModelAndView(); if (StringUtil.isNotBlank(forward)) { @@ -50,15 +46,17 @@ public class RegisterController { if (request.isRequestedSessionIdFromCookie() && cookies != null) { for (Cookie cookie : cookies) { if (cookie.getName().equals("userId") && StringUtils.isNotBlank(cookie.getValue())) { - mav.setViewName("index_index"); + mav.setViewName("/WEB-INF/template/register/index"); return mav; } } } - mav.setViewName("index"); + mav.setViewName("/WEB-INF/template/register/index"); return mav; } + + @PostMapping("/register") public void register(@RequestParam String str, @RequestParam String userPwd, @@ -126,6 +124,7 @@ public class RegisterController { } @GetMapping("/mobilecheck") + @ResponseBody public ModelAndView mobilecheck(@RequestParam String str, HttpServletRequest request, HttpServletResponse response) throws IOException { ModelAndView mav = new ModelAndView(); if (MemCachedClientHelp.getIMemcachedCache().get(str) == null) { @@ -143,6 +142,7 @@ public class RegisterController { } @PostMapping("/regSendMes") + @ResponseBody public void regSendMes(@RequestParam String isVerify, @RequestParam String phone, HttpServletResponse response) throws Exception { @@ -179,6 +179,7 @@ public class RegisterController { } @PostMapping("/checkMobileCode") + @ResponseBody public void checkMobileCode(@RequestParam String isVerify, @RequestParam String key, HttpServletRequest request, diff --git a/src/main/java/me/mofun/entity/pojo/ParticipateJSON.java b/src/main/java/me/mofun/entity/pojo/ParticipateJSON.java new file mode 100644 index 0000000..198b111 --- /dev/null +++ b/src/main/java/me/mofun/entity/pojo/ParticipateJSON.java @@ -0,0 +1,102 @@ +package me.mofun.entity.pojo; + +import java.io.Serializable; + +public class ParticipateJSON implements Serializable { + + private String userId; + private String userName; + private String userFace; + private String ip_address; + private String ip_location; + private String buyCount; + private String buyDate; + private String buyId; + + public ParticipateJSON() { + super(); + } + + public ParticipateJSON(String userId, String userName, String userFace, + String ip_address, String ip_location, String buyCount, + String buyDate, String buyId) { + super(); + this.userId = userId; + this.userName = userName; + this.userFace = userFace; + this.ip_address = ip_address; + this.ip_location = ip_location; + this.buyCount = buyCount; + this.buyDate = buyDate; + this.buyId = buyId; + } + + + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getUserFace() { + return userFace; + } + + public void setUserFace(String userFace) { + this.userFace = userFace; + } + + public String getIp_address() { + return ip_address; + } + + public void setIp_address(String ip_address) { + this.ip_address = ip_address; + } + + public String getIp_location() { + return ip_location; + } + + public void setIp_location(String ip_location) { + this.ip_location = ip_location; + } + + public String getBuyCount() { + return buyCount; + } + + public void setBuyCount(String buyCount) { + this.buyCount = buyCount; + } + + public String getBuyDate() { + return buyDate; + } + + public void setBuyDate(String buyDate) { + this.buyDate = buyDate; + } + + public String getBuyId() { + return buyId; + } + + public void setBuyId(String buyId) { + this.buyId = buyId; + } + + + +} diff --git a/src/main/java/me/mofun/entity/pojo/ProductInfo.java b/src/main/java/me/mofun/entity/pojo/ProductInfo.java new file mode 100644 index 0000000..aefe227 --- /dev/null +++ b/src/main/java/me/mofun/entity/pojo/ProductInfo.java @@ -0,0 +1,192 @@ +package me.mofun.entity.pojo; + +import java.io.Serializable; + +public class ProductInfo implements Serializable { + + private static final long serialVersionUID = 2984681206487401036L; + + private Integer productId; + private String productName; + private String productTitle; + private Integer productPrice; + private Float marketPrice; //电商版新增字段:市场价 + private String actionName; //电商版新增字段:优惠活动名称 + private Integer singlePrice;//单次购买价格 + private String headImage; + private String productDetail; + private Integer spellbuyProductId; + private Integer spellbuyCount; + private Integer productPeriod; //商品期数 + private Integer status; + private Integer buyLimited; //商品是否限购或该商品单人限购次数 + private Integer isVirtual; + private Integer isNeedLogic; + private String logicURL; + private Integer shopId; + + public ProductInfo() { + super(); + } + + public ProductInfo(Integer productId, String productName, String productTitle, + Integer productPrice, Float marketPrice, String actionName, Integer singlePrice, String headImage, + String productDetail, Integer spellbuyProductId, + Integer spellbuyCount, Integer productPeriod, Integer status, Integer buyLimited, Integer isVirtual, Integer isNeedLogic, String logicURL) { + super(); + this.productId = productId; + this.productName = productName; + this.productTitle = productTitle; + this.productPrice = productPrice; + this.marketPrice = marketPrice; + this.actionName = actionName; + this.singlePrice = singlePrice; + this.headImage = headImage; + this.productDetail = productDetail; + this.spellbuyProductId = spellbuyProductId; + this.spellbuyCount = spellbuyCount; + this.productPeriod = productPeriod; + this.status = status; + this.buyLimited = buyLimited; + this.isVirtual = isVirtual; + this.isNeedLogic = isNeedLogic; + this.logicURL = logicURL; + } + + public Integer getProductId() { + return productId; + } + + public void setProductId(Integer productId) { + this.productId = productId; + } + + public Integer getStatus() { + return status; + } + public void setStatus(Integer status) { + this.status = status; + } + + public Integer getBuyLimited() { + return buyLimited; + } + public void setBuyLimited(Integer buyLimited) { + this.buyLimited = buyLimited; + } + + public String getProductName() { + return productName; + } + public void setProductName(String productName) { + this.productName = productName; + } + public String getProductTitle() { + return productTitle; + } + public void setProductTitle(String productTitle) { + this.productTitle = productTitle; + } + public Integer getProductPrice() { + return productPrice; + } + public void setProductPrice(Integer productPrice) { + this.productPrice = productPrice; + } + + public Float getMarketPrice() { + return marketPrice; + } + + public void setMarketPrice(Float marketPrice) { + this.marketPrice = marketPrice; + } + + public String getActionName() { + return actionName; + } + + public void setActionName(String actionName) { + this.actionName = actionName; + } + + + public String getHeadImage() { + return headImage; + } + public void setHeadImage(String headImage) { + this.headImage = headImage; + } + public String getProductDetail() { + return productDetail; + } + public void setProductDetail(String productDetail) { + this.productDetail = productDetail; + } + public Integer getSpellbuyProductId() { + return spellbuyProductId; + } + public void setSpellbuyProductId(Integer spellbuyProductId) { + this.spellbuyProductId = spellbuyProductId; + } + public Integer getSpellbuyCount() { + return spellbuyCount; + } + public void setSpellbuyCount(Integer spellbuyCount) { + this.spellbuyCount = spellbuyCount; + } + + public Integer getProductPeriod() { + return productPeriod; + } + + public void setProductPeriod(Integer productPeriod) { + this.productPeriod = productPeriod; + } + + public static long getSerialVersionUID() { + return serialVersionUID; + } + + public Integer getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(Integer singlePrice) { + this.singlePrice = singlePrice; + } + + public int getIsVirtual() { + return isVirtual; + } + + public void setIsVirtual(int isVirtual) { + this.isVirtual = isVirtual; + } + + public int getIsNeedLogic() { + return isNeedLogic; + } + + public void setIsNeedLogic(int isNeedLogic) { + this.isNeedLogic = isNeedLogic; + } + + public String getLogicURL() { + return logicURL; + } + + public void setLogicURL(String logicURL) { + this.logicURL = logicURL; + } + + public Integer getShopId() { + return shopId; + } + + public void setShopId(Integer shopId) { + this.shopId = shopId; + } + + +} diff --git a/src/main/java/me/mofun/entity/pojo/UserLimitBuy.java b/src/main/java/me/mofun/entity/pojo/UserLimitBuy.java new file mode 100644 index 0000000..baaabe1 --- /dev/null +++ b/src/main/java/me/mofun/entity/pojo/UserLimitBuy.java @@ -0,0 +1,84 @@ +package me.mofun.entity.pojo; + +/** + * 用于用户限购检查时,返回 json 对象 {"code":0,"codeLimitBuy":5,"buyNum":0,"codeState":0,"codeRemainNum":240,"userMoney":0.0} + * @author mofun + * + */ +public class UserLimitBuy { + + + private int code; //代码 + private int codeLimitBuy; //限购次数: 0表示不限购,其他表示限购次数 + private int buyNum; //某登陆用户已经购买的次数 + private int codeState; //产品购买状态 + private int codeRemainNum; //总剩余购买次数 + private float userMoney; //某登陆用户的余额 + + + public UserLimitBuy() { + // TODO Auto-generated constructor stub + } + + public Integer getCode() { + return code; + } + + + public void setCode(Integer code) { + this.code = code; + } + + + public Integer getCodeLimitBuy() { + return codeLimitBuy; + } + + + public void setCodeLimitBuy(Integer codeLimitBuy) { + this.codeLimitBuy = codeLimitBuy; + } + + + public Integer getBuyNum() { + return buyNum; + } + + + public void setBuyNum(Integer buyNum) { + this.buyNum = buyNum; + } + + + public Integer getCodeState() { + return codeState; + } + + + public void setCodeState(Integer codeState) { + this.codeState = codeState; + } + + + public Integer getCodeRemainNum() { + return codeRemainNum; + } + + + public void setCodeRemainNum(Integer codeRemainNum) { + this.codeRemainNum = codeRemainNum; + } + + + public float getUserMoney() { + return userMoney; + } + + + public void setUserMoney(float userMoney) { + this.userMoney = userMoney; + } + + + +}