|
@@ -75,7 +75,7 @@ public class ProductInfoHandler {
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "/productIndex",method = RequestMethod.POST)
|
|
|
public ResultMsg productIndex(HttpServletRequest request,
|
|
|
- @RequestParam(value= "pageSize",defaultValue= "6" ,required=false) Integer pageSize,
|
|
|
+ @RequestParam(value= "pageSize",defaultValue= "6" ,required=false) Integer pageSize,
|
|
|
@RequestParam(value = "pageNO", defaultValue = "1") Integer pageNO,
|
|
|
@RequestParam(value = "productName", defaultValue = "")String productName,
|
|
|
@RequestParam(value = "productType", defaultValue = "1") Integer productType,
|
|
@@ -96,61 +96,61 @@ public class ProductInfoHandler {
|
|
|
product.getPage().initRecordBegin();
|
|
|
List<Product> productList = productInfoService.selectPageProduct(product);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
//根据openid查询该用户是否购买过订单
|
|
|
- ShopSalesOrderDto shopSalesOrderDto = new ShopSalesOrderDto();
|
|
|
- shopSalesOrderDto.setSalesOpenid(member.getUserOpenid());
|
|
|
- shopSalesOrderDto.setSalesStatus("2");
|
|
|
-
|
|
|
- //判断是否为金牌会员下线,如果是,则以优惠价显示,如果不是则按原价显示
|
|
|
- //查询金牌会员模板id
|
|
|
- int templateId = systemService.selectOneShopRuleById(114).getRuleNum().intValue();
|
|
|
- //查询用户信息
|
|
|
- Member user= memberService.getMemberByUserOpenId(member.getUserOpenid());
|
|
|
- if (user == null) {
|
|
|
- remsg.setMessage(ResultInfo.loginOutError);
|
|
|
- remsg.setStatus(false);
|
|
|
- remsg.setMessage(ResultInfo.loginOutError);
|
|
|
- return remsg;
|
|
|
- }
|
|
|
- //如果模板id等于金牌会模板id,则该用户为金牌会员下线
|
|
|
- if (user.getUserDealers() != null && user.getTemplateId() != null &&
|
|
|
- templateId == user.getTemplateId().intValue() && user.getUserResType().intValue() == 3) {
|
|
|
- //若果是金牌会员下线,产品的价格就以优惠价显示
|
|
|
- if (productList != null && productList.size() >= 1) {
|
|
|
- for (Product productInfo : productList) {
|
|
|
- UserGiftDto userGiftDto = new UserGiftDto();
|
|
|
- userGiftDto.setUserLevel(2);
|
|
|
- userGiftDto.setUserProductId(productInfo.getProductId());
|
|
|
- userGiftDto.setUserColorId(productInfo.getColorId());
|
|
|
- //根据商品id和会员等级查询礼品信息
|
|
|
- userGiftDto = productInfoService.selectUserGift(userGiftDto);
|
|
|
- if (userGiftDto != null) {
|
|
|
- productInfo.setProductDiscount(userGiftDto.getUserDiscount());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- int orderNum = cartService.selectOrderCount(shopSalesOrderDto);
|
|
|
- //如果购买过订单,则滤芯的价格可按折扣价购买
|
|
|
- if (orderNum > 0) {
|
|
|
- if (productList != null && productList.size() >= 1) {
|
|
|
- for (Product productInfo : productList) {
|
|
|
- if (productInfo.getProductType().getTypeId().intValue() == 2) {
|
|
|
- UserGiftDto userGiftDto = new UserGiftDto();
|
|
|
- userGiftDto.setUserLevel(3);
|
|
|
- userGiftDto.setUserProductId(productInfo.getProductId());
|
|
|
- userGiftDto.setUserColorId(productInfo.getColorId());
|
|
|
- //根据商品id和会员等级查询礼品信息
|
|
|
- userGiftDto = productInfoService.selectUserGift(userGiftDto);
|
|
|
- if (userGiftDto != null) {
|
|
|
- productInfo.setProductDiscount(userGiftDto.getUserDiscount());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// ShopSalesOrderDto shopSalesOrderDto = new ShopSalesOrderDto();
|
|
|
+// shopSalesOrderDto.setSalesOpenid(member.getUserOpenid());
|
|
|
+// shopSalesOrderDto.setSalesStatus("2");
|
|
|
+//
|
|
|
+// //判断是否为金牌会员下线,如果是,则以优惠价显示,如果不是则按原价显示
|
|
|
+// //查询金牌会员模板id
|
|
|
+// int templateId = systemService.selectOneShopRuleById(114).getRuleNum().intValue();
|
|
|
+// //查询用户信息
|
|
|
+// Member user= memberService.getMemberByUserOpenId(member.getUserOpenid());
|
|
|
+// if (user == null) {
|
|
|
+// remsg.setMessage(ResultInfo.loginOutError);
|
|
|
+// remsg.setStatus(false);
|
|
|
+// remsg.setMessage(ResultInfo.loginOutError);
|
|
|
+// return remsg;
|
|
|
+// }
|
|
|
+// //如果模板id等于金牌会模板id,则该用户为金牌会员下线
|
|
|
+// if (user.getUserDealers() != null && user.getTemplateId() != null &&
|
|
|
+// templateId == user.getTemplateId().intValue() && user.getUserResType().intValue() == 3) {
|
|
|
+// //若果是金牌会员下线,产品的价格就以优惠价显示
|
|
|
+// if (productList != null && productList.size() >= 1) {
|
|
|
+// for (Product productInfo : productList) {
|
|
|
+// UserGiftDto userGiftDto = new UserGiftDto();
|
|
|
+// userGiftDto.setUserLevel(2);
|
|
|
+// userGiftDto.setUserProductId(productInfo.getProductId());
|
|
|
+// userGiftDto.setUserColorId(productInfo.getColorId());
|
|
|
+// //根据商品id和会员等级查询礼品信息
|
|
|
+// userGiftDto = productInfoService.selectUserGift(userGiftDto);
|
|
|
+// if (userGiftDto != null) {
|
|
|
+// productInfo.setProductDiscount(userGiftDto.getUserDiscount());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// int orderNum = cartService.selectOrderCount(shopSalesOrderDto);
|
|
|
+// //如果购买过订单,则滤芯的价格可按折扣价购买
|
|
|
+// if (orderNum > 0) {
|
|
|
+// if (productList != null && productList.size() >= 1) {
|
|
|
+// for (Product productInfo : productList) {
|
|
|
+// if (productInfo.getProductType().getTypeId().intValue() == 2) {
|
|
|
+// UserGiftDto userGiftDto = new UserGiftDto();
|
|
|
+// userGiftDto.setUserLevel(3);
|
|
|
+// userGiftDto.setUserProductId(productInfo.getProductId());
|
|
|
+// userGiftDto.setUserColorId(productInfo.getColorId());
|
|
|
+// //根据商品id和会员等级查询礼品信息
|
|
|
+// userGiftDto = productInfoService.selectUserGift(userGiftDto);
|
|
|
+// if (userGiftDto != null) {
|
|
|
+// productInfo.setProductDiscount(userGiftDto.getUserDiscount());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
int num = this.productInfoService.selectProductCount(product);
|
|
|
int count = num % pageSize == 0? num/pageSize:(num/pageSize)+1;
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
@@ -174,15 +174,24 @@ public class ProductInfoHandler {
|
|
|
@RequestMapping(value = "/productIndexSellWell",method = RequestMethod.POST)
|
|
|
public ResultMsg productIndexSellWell(HttpServletRequest request) throws Exception {
|
|
|
ResultMsg remsg= new ResultMsg();
|
|
|
+ Member member = WechatUtils.getUserBySession(request);
|
|
|
|
|
|
- IndexProduct indexProduct = new IndexProduct();
|
|
|
- indexProduct.setIndeProdStatus(1);
|
|
|
- List<IndexProduct> indexProductList = indexProductService.getIndexProductList(indexProduct);
|
|
|
+ IndexProduct firColuProduct = new IndexProduct();
|
|
|
+ firColuProduct.setIndeProdType(1);
|
|
|
+ List<IndexProduct> firColuProductList = indexProductService.getIndexProductList(firColuProduct);
|
|
|
|
|
|
+ IndexProduct SecColuProduct = new IndexProduct();
|
|
|
+ SecColuProduct.setIndeProdType(2);
|
|
|
+ List<IndexProduct> SecColuProductList = indexProductService.getIndexProductList(SecColuProduct);
|
|
|
+
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ map.put("firColuProductList", firColuProductList);
|
|
|
+ map.put("SecColuProductList", SecColuProductList);
|
|
|
remsg.setMessage(NameUtils.getConfig("SUCCESSINFO"));
|
|
|
remsg.setResultCode(ResultInfo.SUCCESSCODE);
|
|
|
remsg.setStatus(true);
|
|
|
- remsg.setData(indexProductList);
|
|
|
+ remsg.setData(map);
|
|
|
return remsg;
|
|
|
}
|
|
|
|
|
@@ -225,52 +234,51 @@ public class ProductInfoHandler {
|
|
|
if (StaticInfo.pattern.matcher(productId).find()) {
|
|
|
Product product = this.productInfoService.getProductByProductId(Integer.parseInt(productId),colorId);
|
|
|
|
|
|
- //判断是否为金牌会员下线,如果是,则以优惠价显示,如果不是则按原价显示
|
|
|
- //查询金牌会员模板id
|
|
|
- int templateId = systemService.selectOneShopRuleById(114).getRuleNum().intValue();
|
|
|
- //查询用户信息
|
|
|
- Member user= memberService.getMemberByUserOpenId(member.getUserOpenid());
|
|
|
- if (user == null) {
|
|
|
- remsg.setMessage(ResultInfo.loginOutError);
|
|
|
- remsg.setStatus(false);
|
|
|
- remsg.setMessage(ResultInfo.loginOutError);
|
|
|
- return remsg;
|
|
|
- }
|
|
|
+// //判断是否为金牌会员下线,如果是,则以优惠价显示,如果不是则按原价显示
|
|
|
+// //查询金牌会员模板id
|
|
|
+// int templateId = systemService.selectOneShopRuleById(114).getRuleNum().intValue();
|
|
|
+// //查询用户信息
|
|
|
+// Member user= memberService.getMemberByUserOpenId(member.getUserOpenid());
|
|
|
+// if (user == null) {
|
|
|
+// remsg.setMessage(ResultInfo.loginOutError);
|
|
|
+// remsg.setStatus(false);
|
|
|
+// remsg.setMessage(ResultInfo.loginOutError);
|
|
|
+// return remsg;
|
|
|
+// }
|
|
|
//如果模板id等于金牌会模板id,则该用户为金牌会员下线
|
|
|
- if (user.getUserDealers() != null && user.getTemplateId() != null
|
|
|
- && templateId == user.getTemplateId().intValue() && user.getUserResType().intValue() == 3) {
|
|
|
- //若果是金牌会员下线,产品的价格就以优惠价显示
|
|
|
- UserGiftDto userGiftDto = new UserGiftDto();
|
|
|
- userGiftDto.setUserLevel(2);
|
|
|
- userGiftDto.setUserProductId(product.getProductId());
|
|
|
- userGiftDto.setUserColorId(product.getColorId());
|
|
|
- //根据商品id和会员等级查询礼品信息
|
|
|
- userGiftDto = productInfoService.selectUserGift(userGiftDto);
|
|
|
- if (userGiftDto != null) {
|
|
|
- product.setProductDiscount(userGiftDto.getUserDiscount());
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+// if (user.getUserDealers() != null && user.getTemplateId() != null
|
|
|
+// && templateId == user.getTemplateId().intValue() && user.getUserResType().intValue() == 3) {
|
|
|
+// //若果是金牌会员下线,产品的价格就以优惠价显示
|
|
|
+// UserGiftDto userGiftDto = new UserGiftDto();
|
|
|
+// userGiftDto.setUserLevel(2);
|
|
|
+// userGiftDto.setUserProductId(product.getProductId());
|
|
|
+// userGiftDto.setUserColorId(product.getColorId());
|
|
|
+// //根据商品id和会员等级查询礼品信息
|
|
|
+// userGiftDto = productInfoService.selectUserGift(userGiftDto);
|
|
|
+// if (userGiftDto != null) {
|
|
|
+// product.setProductDiscount(userGiftDto.getUserDiscount());
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
//根据openid查询该用户是否购买过订单
|
|
|
ShopSalesOrderDto shopSalesOrderDto = new ShopSalesOrderDto();
|
|
|
shopSalesOrderDto.setSalesOpenid(member.getUserOpenid());
|
|
|
shopSalesOrderDto.setSalesStatus("2");
|
|
|
//如果购买过订单,则滤芯的价格可按折扣价购买
|
|
|
- if (product != null) {
|
|
|
- if (product.getProductType().getTypeId().intValue() == 2) {
|
|
|
- //若果是金牌会员下线,产品的价格就以优惠价显示
|
|
|
- UserGiftDto userGiftDto = new UserGiftDto();
|
|
|
- userGiftDto.setUserLevel(3);
|
|
|
- userGiftDto.setUserProductId(product.getProductId());
|
|
|
- userGiftDto.setUserColorId(product.getColorId());
|
|
|
- //根据商品id和会员等级查询礼品信息
|
|
|
- userGiftDto = productInfoService.selectUserGift(userGiftDto);
|
|
|
- if (userGiftDto != null) {
|
|
|
- product.setProductDiscount(userGiftDto.getUserDiscount());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// if (product != null) {
|
|
|
+// if (product.getProductType().getTypeId().intValue() == 2) {
|
|
|
+// //若果是金牌会员下线,产品的价格就以优惠价显示
|
|
|
+// UserGiftDto userGiftDto = new UserGiftDto();
|
|
|
+// userGiftDto.setUserLevel(3);
|
|
|
+// userGiftDto.setUserProductId(product.getProductId());
|
|
|
+// userGiftDto.setUserColorId(product.getColorId());
|
|
|
+// //根据商品id和会员等级查询礼品信息
|
|
|
+// userGiftDto = productInfoService.selectUserGift(userGiftDto);
|
|
|
+// if (userGiftDto != null) {
|
|
|
+// product.setProductDiscount(userGiftDto.getUserDiscount());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
List<ProductPicture> pictureList = productPictureService.getProductPictureByproductId(Integer.parseInt(productId));
|
|
|
product.setPictureList(pictureList);
|
|
|
|
|
@@ -283,9 +291,9 @@ public class ProductInfoHandler {
|
|
|
* 组装数据
|
|
|
*/
|
|
|
map = new HashMap<String, Object>();
|
|
|
- map.put("isShow", ResultInfo.ISSHOW);
|
|
|
- map.put("cartDesc", ResultInfo.CARTDESC);
|
|
|
- map.put("cart_url", ResultInfo.CART_URL);
|
|
|
+// map.put("isShow", ResultInfo.ISSHOW);
|
|
|
+// map.put("cartDesc", ResultInfo.CARTDESC);
|
|
|
+// map.put("cart_url", ResultInfo.CART_URL);
|
|
|
map.put("product", product);
|
|
|
map.put("shareOpenid", member.getUserOpenid());
|
|
|
map.put("colorList", colorList);
|
|
@@ -305,9 +313,9 @@ public class ProductInfoHandler {
|
|
|
* 组装数据
|
|
|
*/
|
|
|
map = new HashMap<String, Object>();
|
|
|
- map.put("isShow", ResultInfo.ISSHOW);
|
|
|
- map.put("cartDesc", ResultInfo.CARTDESC);
|
|
|
- map.put("cart_url", ResultInfo.CART_URL);
|
|
|
+// map.put("isShow", ResultInfo.ISSHOW);
|
|
|
+// map.put("cartDesc", ResultInfo.CARTDESC);
|
|
|
+// map.put("cart_url", ResultInfo.CART_URL);
|
|
|
map.put("product", product);
|
|
|
map.put("shareOpenid", member.getUserOpenid());
|
|
|
remsg.setData(map);
|