<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="com.yc.factory.FactoryBean"%> <%@page import="com.yc.sdk.shopping.service.SettingIfc"%> <%@page import="com.yc.sdk.shopping.entity.SettingEntity"%> <%@page import="com.yc.sdk.shopping.service.MatCodeIfc"%> <%@page import="com.yc.sdk.shopping.entity.MatCodeEntity"%> <%@page import="com.yc.sdk.shopping.service.MatCodeImageIfc"%> <%@page import="com.yc.sdk.shopping.entity.MatCodeImageEntity"%> <%@page import="com.yc.sdk.shopping.service.MatPriceIfc"%> <%@page import="com.yc.sdk.shopping.service.CurrencyIfc"%> <%@page import="com.yc.sdk.shopping.entity.CurrencyEntity"%> <%@page import="com.yc.sdk.shopping.service.MatPointsIfc"%> <%@page import="com.yc.sdk.shopping.service.MatDiscountIfc"%> <%@page import="com.yc.sdk.shopping.entity.MatDiscountEntity"%> <%@page import="com.yc.sdk.shopping.service.MatComponentIfc"%> <%@page import="com.yc.sdk.shopping.entity.MatPriceEntity"%> <%@page import="java.util.List"%> <%@page import="com.yc.sdk.shopping.util.SettingKey"%> <%@page import="com.yc.utils.SessionKey"%> <%@page import="com.yc.sdk.shopping.service.NavigatorIfc"%> <%@page import="com.yc.sdk.shopping.entity.NavigatorEntity"%> <%@page import="com.yc.sdk.shopping.entity.NavigatorBar"%> <%@page import="com.yc.sdk.shopping.entity.NavigatorBars"%> <%@page import="com.yc.sdk.shopping.entity.ProductListSetting"%> <%@page import="com.yc.sdk.shopping.service.imagedata.ShoppingImageDataIfc"%> <%@page import="com.yc.multiData.SpObserver"%> <%@page import="org.springframework.dao.DataAccessException"%> <%@page import="com.yc.sdk.shopping.service.CartIfc"%> <%@page import="com.yc.sdk.shopping.entity.CartEntity"%> <%@page import="com.yc.sdk.shopping.service.MatCodeIfc"%> <%@page import="com.yc.sdk.shopping.entity.MatCodeEntity"%> <%@page import="java.io.File"%> <%@page import="com.yc.sdk.shopping.service.ShoppingImageIfc"%> <%@page import="com.yc.sdk.weixinmp.service.jssdk.JssdkIfc" %> <%@page import="com.yc.sdk.shopping.entity.ShareEntity"%> <%@page import="com.yc.sdk.shopping.service.share.ShareIfc"%> <%@page import="com.yc.sdk.shopping.entity.WxConfig"%> <%@page import="com.yc.sdk.shopping.service.MatAttrIfc"%> <%@page import="com.yc.sdk.shopping.entity.ShopCcCodeEntity"%> <%@page import="com.yc.sdk.shopping.action.api.ShopCcCode"%> <% String dbId = (String) session.getAttribute(SessionKey.SHOPPING_DBID); String userCode = (session.getAttribute(SessionKey.USERCODE) == null ? "" : (String)session.getAttribute(SessionKey.USERCODE)); String openId = (session.getAttribute(SessionKey.WEIXIN_OPENID) == null ? "" : (String) session.getAttribute(SessionKey.WEIXIN_OPENID) ) ; String sessionId = session.getId(); String cltCode = (session.getAttribute(SettingKey.CLTCODE) == null ? "" : (String)session.getAttribute(SettingKey.CLTCODE)); String cltName = (session.getAttribute(SettingKey.CLTNAME) == null ? "" : (String)session.getAttribute(SettingKey.CLTNAME)) ; boolean isMoblieBrowser = SettingKey.isMoblieBrowser(request); String corpId = request.getParameter(SessionKey.WEIXIN_CORPID) ; String wx = request.getParameter(SessionKey.WEIXIN_FROM) ; if (corpId == null || "".equals(corpId)) { corpId = request.getParameter(SessionKey.WEIXIN_APPID) ; } SettingIfc settingIfc = (SettingIfc)FactoryBean.getBean("SettingImpl"); SettingEntity settingEntity = null ; String matCode = (request.getParameter(SettingKey.MATCODE) == null ? "" : request.getParameter(SettingKey.MATCODE)) ; //购物车 List cartList = null; CartIfc cartIfc = (CartIfc)FactoryBean.getBean("CartImpl"); //附件图片 ShoppingImageIfc shoppingImageIfc = (ShoppingImageIfc)FactoryBean.getBean("ShoppingImageImpl"); //关注的商品 List matCodeList = null; try { SpObserver.setDBtoInstance("_"+dbId);//切换数据源 settingEntity = settingIfc.getSettingEntity() ; //取网店 shopcccode ShopCcCodeEntity shopCcCodeEntity = ShopCcCode.getShopCcCode(settingEntity,request); String hostUrl = SettingKey.getHostUrl(request) ; //将微信corpid组装成url String wxQueryString = SettingKey.getQueryStringByWx(request); String cssFile =""; if (settingEntity.getProductDetailStyle() == 0) { cssFile += "" ; }else if (settingEntity.getProductDetailStyle() == 1) { cssFile += "" ; } if (settingEntity.getProductListStyle() == 0) { cssFile += "" ; } else if (settingEntity.getProductListStyle() == 1) { cssFile += "" ; } else if (settingEntity.getProductListStyle() == 2) { cssFile += "" ; } else if (settingEntity.getProductListStyle() == 3) { cssFile += "" ; } request.setAttribute("cssfile", cssFile); request.setAttribute("isJsViewPort", "true") ; Integer cssCaptionHeight = (settingEntity.getCssCaptionHeight() == null ||settingEntity.getCssCaptionHeight().equals(0) ? 180: settingEntity.getCssCaptionHeight()) ; //商品编号信息 MatCodeIfc matCodeIfc = (MatCodeIfc)FactoryBean.getBean("MatCodeImpl"); MatCodeEntity matCodeEntity = matCodeIfc.getMatCode(matCode,shopCcCodeEntity.getShopCcCode()); if (matCodeEntity==null) { out.println("未找到编号为【"+matCode+"】商品资料"); return ; } //商品附加图片信息 MatCodeImageIfc matCodeImageIfc = (MatCodeImageIfc)FactoryBean.getBean("MatCodeImageImpl"); List matImageList = matCodeImageIfc.getMatCodeImage(matCode); //商品评价条数 Integer matReviewCount = 0 ; if (matCodeEntity != null) { matReviewCount = matCodeEntity.getRatingCount(); } //获取相关商品资料集合 List matRelList = matCodeIfc.getMatCodesByRelMat(matCode,shopCcCodeEntity.getShopCcCode(),cltCode,openId) ; //价格 MatPriceIfc matPriceIfcProd = (MatPriceIfc)FactoryBean.getBean("MatPriceImpl"); MatPriceEntity matPriceEntity = matPriceIfcProd.getMatPrice(matCode, cltCode, null) ; Double price = matPriceEntity.getPrice() ; //货币 CurrencyIfc currencyIfcProd = (CurrencyIfc)FactoryBean.getBean("CurrencyImpl"); String currencyProd = settingEntity.getCurrency(); CurrencyEntity currencyEntityProd = currencyIfcProd.getUserCurrency(userCode); //消费积份 MatPointsIfc matPointsIfc = (MatPointsIfc)FactoryBean.getBean("MatPointsImpl"); Integer points = matPointsIfc.getMatPoints(matCode, null ); //商品促销活动关联表 MatDiscountIfc matDiscountIfc = (MatDiscountIfc)FactoryBean.getBean("MatDiscountImpl"); List matDisList = matDiscountIfc.getMatDiscount(matCode, null ); //选项 MatComponentIfc matComponentIfc = (MatComponentIfc)FactoryBean.getBean("MatComponentImpl"); //显示页面图形(data) ShoppingImageDataIfc imgData = (ShoppingImageDataIfc)FactoryBean.getBean("ShoppingImageDataImpl"); //取处理过的商品描述 request.setAttribute(SettingKey.FROMOPENID, openId); String matDmatDescription = imgData.getDescriptionByNewImgLink(matCodeEntity.getDescription(), request) ; //购物车 cartList = cartIfc.getCartList(userCode, sessionId,openId,cltCode,shopCcCodeEntity.getShopCcCode()); //关注商品资料 matCodeList = matCodeIfc.getMatCodesByWishList(userCode,sessionId,openId,cltCode,shopCcCodeEntity.getShopCcCode()); List matCodeCompareList = matCodeIfc.getMatCodesByCompare(userCode,sessionId,openId,cltCode,shopCcCodeEntity.getShopCcCode()); ShareIfc shareIfc = (ShareIfc)FactoryBean.getBean("ShareImpl"); ShareEntity shareEntity=shareIfc.getShareEntity(shopCcCodeEntity.getShopCcCode()); MatAttrIfc matAttrIfc = (MatAttrIfc)FactoryBean.getBean("MatAttrImpl"); boolean hasMatAttr = matAttrIfc.hasMatAttr(matCode); request.setAttribute(SettingKey.TITLE, (matCodeEntity !=null?matCodeEntity.getMatName():"商品详情")); %> <% JssdkIfc jssdkIfc = (JssdkIfc)FactoryBean.getBean("JssdkImpl"); if (!jssdkIfc.isWeiXinBrowse(request)) { %> <% } %> <% if (settingEntity.getProductDetailStyle() == 0) { %> <% if (!isMoblieBrowser) { %>
<% } %>
<% if (!isMoblieBrowser) { %>
<% } %>
    <% if (settingEntity.isShowBrand()) { %>
  • 品 牌: "><%=matCodeEntity.getShopBrand() %>
  • <% } %> <% if (settingEntity.isShowMatName()){ %>
  • 名 称: <%=matCodeEntity.getMatName() %>
  • <% } %> <% if (settingEntity.isShowMatCode()){ %>
  • 编 号: <%=matCodeEntity.getShopMatCode() %>
  • <% } %> <% if (settingEntity.isShowSpecial()){ %>
  • 规 格: <%=matCodeEntity.getSpecial() %>
  • <% } %> <% if (settingEntity.isStartupMatName2()) { %>
  • <%=settingEntity.getMatName2Label() %>: <%=matCodeEntity.getMatName2() %>
  • <% } %> <% if (settingEntity.isStartupMatName3()) { %>
  • <%=settingEntity.getMatName3Label() %>: <%=matCodeEntity.getMatName3() %>
  • <% } %> <% if (settingEntity.isStartupMatName4()) { %>
  • <%=settingEntity.getMatName4Label() %>: <%=matCodeEntity.getMatName4() %>
  • <% } %> <% if (settingEntity.isShowPoints()){ %>
  • 奖励积分:<%= matCodeEntity.getPoints() %>
  • <% } %> <% if (matCodeEntity.getStockStatusName() != null && ! "".equals(matCodeEntity.getStockStatusName())) { %>
  • 库存状态:<%= matCodeEntity.getStockStatusName() %>
  • <% } %>
    <% if (settingEntity.isShowPrice()) { //价格 if (price!=null && matCodeEntity.getSalesPrice() != null&& price != 0.00 && price < matCodeEntity.getSalesPrice() ) { %>
  • <%=currencyEntityProd.getCurrencySign()%><%=matCodeEntity.getSalesPrice()%>
  • <% } %>
  • <%=currencyEntityProd.getCurrencySign()%><%=price!=null?price:""%>

  • <% } %> <% //消费积分 if (settingEntity.isShowPoints() && points != null && ! points.equals(0)) { %>
  • 消费积分:<%=points%>
  • <% } %> <% //商品促销活动关联表 if (matDisList != null && matDisList.size() > 0 ) { %>

  • <% for (int i = 0; matDisList != null && i
  • 数量<%=matDisList.get(i).getDigit()%>或更多,优惠价<%=currencyEntityProd.getCurrencySign()%><%=(matDisList.get(i).getPrice()!=null?matDisList.get(i).getPrice():"")%>
  • <% } } %>
<%=matComponentIfc.getMatComponent(matCodeEntity, matCode, currencyEntityProd.getCurrencySign(),isMoblieBrowser,false)%> <% if (settingEntity.isShowRatingOnHomePage()) { Integer rating = matCodeEntity.getRatingAvg(); if (rating != null && ! rating.equals(0)) { %>

<% for (int k = 0 ; rating != null && k < rating ; k ++) { %> <% } %> <% for (int k = 0 ; k < 5 - (rating==null?0:rating) ; k++) { %> <% } } } %> <% if (settingEntity.getReviewStatus()) { %> <%=(matReviewCount == null?0: matReviewCount)%> 评价 / 如果您对本商品有什么问题或经验,请在此留下您的意见和建议!


<% } %>
<%=matDmatDescription%>
<% if (hasMatAttr) { %>
<% } %> <% if (settingEntity.getReviewStatus()) { %>
<% } %>
<% } else if (settingEntity.getProductDetailStyle() == 1) { %>
    <% if (settingEntity.isShowBrand()) { %>
  • 品 牌: "><%=matCodeEntity.getBrand()%>
  • <% } %> <% if (settingEntity.isShowMatName()){ %>
  • 名 称: <%=matCodeEntity.getMatName()%>
  • <% } %> <% if (settingEntity.isShowMatCode()){ %>
  • 编 号: <%=matCodeEntity.getShopMatCode()%>
  • <% } %> <% if (settingEntity.isShowSpecial()){ %>
  • 规 格: <%=matCodeEntity.getSpecial()%>
  • <% } %> <% if (settingEntity.isStartupMatName2()) { %>
  • <%=settingEntity.getMatName2Label()%>: <%=matCodeEntity.getMatName2()%>
  • <% } %> <% if (settingEntity.isStartupMatName3()) { %>
  • <%=settingEntity.getMatName3Label()%>: <%=matCodeEntity.getMatName3()%>
  • <% } %> <% if (settingEntity.isStartupMatName4()) { %>
  • <%=settingEntity.getMatName4Label()%>: <%=matCodeEntity.getMatName4()%>
  • <% } %> <% if (settingEntity.isShowPoints()){ %>
  • 奖励积分:<%=matCodeEntity.getPoints()%>
  • <% } %> <% if (matCodeEntity.getStockStatusName() != null && ! "".equals(matCodeEntity.getStockStatusName())) { %>
  • 库存状态:<%=matCodeEntity.getStockStatusName()%>
  • <% } %>
    <% if (settingEntity.isShowPrice()) { //价格 if (price!=null&&matCodeEntity.getSalesPrice() !=null&&price != 0.00 && price < matCodeEntity.getSalesPrice() ) { %>
  • <%=currencyEntityProd.getCurrencySign()%><%=matCodeEntity.getSalesPrice()%>
  • <% } %>
  • <%=currencyEntityProd.getCurrencySign()%><%= price!=null? price:""%>

  • <% } %> <% //消费积分 if (settingEntity.isShowPoints() && points != null && ! points.equals(0)) { %>
  • 消费积分:<%=points%>
  • <% } %> <% //商品促销活动关联表 if (matDisList != null && matDisList.size() > 0 ) { %>

  • <% for (int i = 0; matDisList != null && i
  • 数量<%=matDisList.get(i).getDigit()%>或更多,优惠价<%=currencyEntityProd.getCurrencySign()%><%=matDisList.get(i).getPrice()!=null?matDisList.get(i).getPrice():""%>
  • <% } } %>
<%=matComponentIfc.getMatComponent(matCodeEntity, matCode, currencyEntityProd.getCurrencySign(),isMoblieBrowser,false)%> <% if (settingEntity.isShowRatingOnHomePage()) { Integer rating = matCodeEntity.getRatingAvg(); if (rating != null && ! rating.equals(0)) { %>

<% for (int k = 0 ; rating != null && k < rating ; k ++) { %> <% } %> <% for (int k = 0 ; k < 5 - (rating==null?0:rating) ; k++) { %> <% } } } %> <% if (settingEntity.getReviewStatus()) { %> <%= (matReviewCount == null?0: matReviewCount) %> 评价 / 如果您对本商品有什么问题或经验,请在此留下您的意见和建议!


<% } %>
<%= matDmatDescription %>

<% if (settingEntity.getReviewStatus()) { %>
<%} %>
<% } %>
<% if (matRelList != null && matRelList.size() > 0) { ProductListSetting set = new ProductListSetting() ; set.setDisplay("grid"); set.setProductThumbCss("transition") ; set.setFrom("3"); set.setShowCompareBlock(true); set.setShowPageBarBlock(false) ; set.setShowSortBlock(false) ; set.setTitle("

相关商品

") ; request.setAttribute(SettingKey.PRODLISTSETTING, set); if (settingEntity.getProductListStyle() == 0||settingEntity.getProductListStyle() == 1 ||settingEntity.getProductListStyle() == 2 ) { %> <% } else { %> <% } } %>
<% //设置微信分享 //微信js api 列表 request.setAttribute(SettingKey.JSAPILIST,new String[]{"onMenuShareTimeline","onMenuShareAppMessage","onMenuShareQQ","onMenuShareQZone","previewImage"}); //图片缩放 //request.setAttribute(SettingKey.WXPREVIEWIMAGES,new String[]{"#slideshow img",".tab-content img",".tab-pane img"}) ; request.setAttribute(SettingKey.WXPREVIEWIMAGES,new String[]{"img"}) ; %> <% }catch(DataAccessException e ) { e.printStackTrace(); }catch(Exception e ) { e.printStackTrace(); }finally { SpObserver.setDBtoInstance(); } %>