|
@@ -24,6 +24,7 @@ import com.iamberry.wechat.tools.NameUtils;
|
|
import com.iamberry.wechat.tools.QrCodeUtil;
|
|
import com.iamberry.wechat.tools.QrCodeUtil;
|
|
import com.iamberry.wechat.tools.ResultInfo;
|
|
import com.iamberry.wechat.tools.ResultInfo;
|
|
import com.iamberry.wechat.tools.StaticInfo;
|
|
import com.iamberry.wechat.tools.StaticInfo;
|
|
|
|
+import com.iamberry.wechat.utils.Result;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
@@ -68,10 +69,6 @@ public class ProductInfoHandler {
|
|
@Autowired
|
|
@Autowired
|
|
private AccessFlowService accessFlowService;
|
|
private AccessFlowService accessFlowService;
|
|
@Autowired
|
|
@Autowired
|
|
- private MainChannelService mainChannelService;
|
|
|
|
- @Autowired
|
|
|
|
- private ChildChannelService childChannelService;
|
|
|
|
- @Autowired
|
|
|
|
private ChannelPriceService channelPriceService;
|
|
private ChannelPriceService channelPriceService;
|
|
|
|
|
|
|
|
|
|
@@ -203,14 +200,6 @@ public class ProductInfoHandler {
|
|
@RequestParam(value = "channelId",defaultValue = "0") Integer channelId,
|
|
@RequestParam(value = "channelId",defaultValue = "0") Integer channelId,
|
|
@RequestParam("colorId") Integer colorId
|
|
@RequestParam("colorId") Integer colorId
|
|
) throws Exception {
|
|
) throws Exception {
|
|
- if(channelType > 0 && channelId > 0){
|
|
|
|
- ChannelPrice channelPrice = new ChannelPrice();
|
|
|
|
- channelPrice.setChannelId(channelId);
|
|
|
|
- channelPrice.setChannelType(channelType);
|
|
|
|
- channelPrice.setColorId(colorId);
|
|
|
|
- List<ChannelPrice> channelPriceList = channelPriceService.getChannelPriceList(channelPrice);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
ResultMsg remsg = new ResultMsg();
|
|
ResultMsg remsg = new ResultMsg();
|
|
Member member = WechatUtils.getUserBySession(request);
|
|
Member member = WechatUtils.getUserBySession(request);
|
|
Map<String, Object> map=null;
|
|
Map<String, Object> map=null;
|
|
@@ -250,90 +239,24 @@ public class ProductInfoHandler {
|
|
}
|
|
}
|
|
|
|
|
|
//如果用户是扫描二维码进入,则显示优惠价
|
|
//如果用户是扫描二维码进入,则显示优惠价
|
|
- String userQrcodeType = request.getParameter("userQrcodeType");
|
|
|
|
- if (userQrcodeType != null && !"".equals(userQrcodeType) && !"null".equals(userQrcodeType)) {
|
|
|
|
- QrcodeGift gift = new QrcodeGift();
|
|
|
|
- gift.setQrcodeStatus(1);
|
|
|
|
- List<QrcodeGift> giftList = productInfoService.listQrcodeGift(gift);
|
|
|
|
- if (giftList != null && giftList.size() > 0 && product != null) {
|
|
|
|
- for (QrcodeGift qrcodeGift : giftList) {
|
|
|
|
- if (product.getColorId().intValue() == qrcodeGift.getQrcodeColorId()) {
|
|
|
|
- switch (userQrcodeType) {
|
|
|
|
- case "1":
|
|
|
|
- if (qrcodeGift.getQrcodePreDiscount() != null && qrcodeGift.getQrcodePreDiscount() > 0) {
|
|
|
|
- product.setProductDiscount(qrcodeGift.getQrcodePreDiscount());
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
- case "2":
|
|
|
|
- if (qrcodeGift.getQrcodeSalesDiscount() != null && qrcodeGift.getQrcodeSalesDiscount() > 0) {
|
|
|
|
- product.setProductDiscount(qrcodeGift.getQrcodeSalesDiscount());
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ if(channelType > 0 && channelId > 0){
|
|
|
|
+ for (ProductColor productColor:colorList) {
|
|
|
|
+ ChannelPrice channelPrice = channelPriceService.getChannelPriceByChannel(channelId,channelType,productColor.getColorId());
|
|
|
|
+ if(channelPrice != null){
|
|
|
|
+ productColor.setColorPrice(channelPrice.getChannelOriginalPrice());
|
|
|
|
+ productColor.setColorDiscount(channelPrice.getChannelPriceOffer());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //判断是否为金牌会员下线,如果是,则以优惠价显示,如果不是则按原价显示
|
|
|
|
- //查询金牌会员模板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());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //根据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());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ /*banner图*/
|
|
List<ProductPicture> pictureList = productPictureService.getProductPictureByproductId(Integer.parseInt(productId));
|
|
List<ProductPicture> pictureList = productPictureService.getProductPictureByproductId(Integer.parseInt(productId));
|
|
product.setPictureList(pictureList);
|
|
product.setPictureList(pictureList);
|
|
|
|
+ /*查询详情*/
|
|
ProductImageText productImageText=productInfoService.selectProductImagetext(Integer.parseInt(productId));
|
|
ProductImageText productImageText=productInfoService.selectProductImagetext(Integer.parseInt(productId));
|
|
product.setProductImageText(productImageText);
|
|
product.setProductImageText(productImageText);
|
|
- /*
|
|
|
|
- * 组装数据
|
|
|
|
- */
|
|
|
|
|
|
|
|
- /*if ((boolean)qrCodeMap.get("flag")) {
|
|
|
|
- map.put("qrCode", qrCodeMap.get("qrCode"));
|
|
|
|
- map.put("shopQrCode", qrCodeMap.get("shopQrCode"));
|
|
|
|
- }*/map = new HashMap<String, Object>();
|
|
|
|
|
|
+ map = new HashMap<String, Object>();
|
|
|
|
|
|
map.put("flag", false); //判断是否有商户个人二维码
|
|
map.put("flag", false); //判断是否有商户个人二维码
|
|
map.put("isShow", ResultInfo.ISSHOW);
|
|
map.put("isShow", ResultInfo.ISSHOW);
|
|
@@ -348,30 +271,7 @@ public class ProductInfoHandler {
|
|
remsg.setStatus(true);
|
|
remsg.setStatus(true);
|
|
return remsg;
|
|
return remsg;
|
|
}
|
|
}
|
|
-
|
|
|
|
- try {
|
|
|
|
- String productIdString = StaticInfo.md5.decrypt(productId);
|
|
|
|
- Product product = this.productInfoService.getProductByProductId(Integer.parseInt(productIdString),colorId);
|
|
|
|
- List<ProductPicture> pictureList = productPictureService.getProductPictureByproductId(Integer.parseInt(productIdString));
|
|
|
|
- product.setPictureList(pictureList);
|
|
|
|
- /*
|
|
|
|
- * 组装数据
|
|
|
|
- */
|
|
|
|
- map = new HashMap<String, Object>();
|
|
|
|
- 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);
|
|
|
|
- remsg.setMessage(NameUtils.getConfig("SUCCESSINFO"));
|
|
|
|
- remsg.setResultCode(ResultInfo.SUCCESSCODE);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- remsg.setMessage(NameUtils.getConfig("ERRORINFO"));
|
|
|
|
- remsg.setResultCode(ResultInfo.ERRORCODE);
|
|
|
|
- remsg.setStatus(false);
|
|
|
|
- }
|
|
|
|
- return remsg;
|
|
|
|
|
|
+ return ResultMsg.getError();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|