提交 | 用户 | age
|
a6a76f
|
1 |
package com.yc.sdk.shopping.action.api; |
F |
2 |
|
|
3 |
import java.text.SimpleDateFormat; |
|
4 |
import java.util.ArrayList; |
|
5 |
import java.util.Comparator; |
|
6 |
import java.util.List; |
|
7 |
import java.util.TreeSet; |
|
8 |
import java.util.stream.Collectors; |
|
9 |
|
|
10 |
import javax.servlet.http.HttpServletRequest; |
|
11 |
import javax.servlet.http.HttpServletResponse; |
|
12 |
import javax.servlet.http.HttpSession; |
|
13 |
|
|
14 |
import org.springframework.beans.factory.annotation.Autowired; |
|
15 |
import org.springframework.dao.DataAccessException; |
|
16 |
import org.springframework.stereotype.Controller; |
|
17 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
18 |
|
|
19 |
import com.google.gson.JsonArray; |
|
20 |
import com.google.gson.JsonObject; |
|
21 |
import com.yc.action.BaseAction; |
|
22 |
import com.yc.entity.DataSourceEntity; |
|
23 |
import com.yc.multiData.MultiDataSource; |
|
24 |
import com.yc.multiData.SpObserver; |
|
25 |
import com.yc.sdk.shopping.entity.CouponEntity; |
|
26 |
import com.yc.sdk.shopping.entity.CurrencyEntity; |
|
27 |
import com.yc.sdk.shopping.entity.GroupBuyingEntity; |
|
28 |
import com.yc.sdk.shopping.entity.MatAttrEntity; |
|
29 |
import com.yc.sdk.shopping.entity.MatAttrGroupEntity; |
|
30 |
import com.yc.sdk.shopping.entity.MatCodeEntity; |
|
31 |
import com.yc.sdk.shopping.entity.MatDiscountEntity; |
|
32 |
//import com.yc.sdk.shopping.entity.MatPriceEntity; |
|
33 |
import com.yc.sdk.shopping.entity.PrepaidDepositDetailEntity; |
|
34 |
import com.yc.sdk.shopping.entity.ProductListSetting; |
|
35 |
import com.yc.sdk.shopping.entity.SettingEntity; |
|
36 |
import com.yc.sdk.shopping.entity.ShopCcCodeEntity; |
|
37 |
import com.yc.sdk.shopping.entity.ShowGroupNameEntity; |
|
38 |
import com.yc.sdk.shopping.entity.SkuMatCodeEntity; |
|
39 |
import com.yc.sdk.shopping.entity.SkuParameterEntity; |
|
40 |
import com.yc.sdk.shopping.service.CartIfc; |
|
41 |
import com.yc.sdk.shopping.service.CouponIfc; |
|
42 |
import com.yc.sdk.shopping.service.CurrencyIfc; |
|
43 |
import com.yc.sdk.shopping.service.MatAttrIfc; |
|
44 |
import com.yc.sdk.shopping.service.MatCodeIfc; |
|
45 |
import com.yc.sdk.shopping.service.MatCodeImageIfc; |
|
46 |
import com.yc.sdk.shopping.service.MatComponentIfc; |
|
47 |
import com.yc.sdk.shopping.service.MatDiscountIfc; |
|
48 |
import com.yc.sdk.shopping.service.MatOptionIfc; |
|
49 |
import com.yc.sdk.shopping.service.MatPointsIfc; |
|
50 |
import com.yc.sdk.shopping.service.MatPriceIfc; |
|
51 |
import com.yc.sdk.shopping.service.SettingIfc; |
|
52 |
import com.yc.sdk.shopping.service.PrepaidDeposit.PrepaidDepositIfc; |
|
53 |
import com.yc.sdk.shopping.service.imagedata.ShoppingImageDataIfc; |
|
54 |
import com.yc.sdk.shopping.service.order.OrderIfc; |
|
55 |
import com.yc.sdk.shopping.service.share.ShareIfc; |
|
56 |
import com.yc.sdk.shopping.util.HtmlUtil; |
|
57 |
import com.yc.sdk.shopping.util.SettingKey; |
|
58 |
import com.yc.utils.SessionKey; |
|
59 |
|
|
60 |
@Controller |
22907b
|
61 |
//@Scope("prototype") |
a6a76f
|
62 |
public class MatCode extends BaseAction { |
F |
63 |
@Autowired |
|
64 |
ShoppingImageDataIfc imgData; |
|
65 |
@Autowired |
|
66 |
SettingIfc settingIfc; |
|
67 |
|
|
68 |
// 价格 |
|
69 |
@Autowired |
|
70 |
MatPriceIfc matPriceIfc; |
|
71 |
|
|
72 |
// 货币 |
|
73 |
@Autowired |
|
74 |
CurrencyIfc currencyIfc; |
|
75 |
|
|
76 |
// 商品资料 |
|
77 |
@Autowired |
|
78 |
MatCodeIfc matCodeIfc; |
|
79 |
|
|
80 |
// 商品附加图片信息 |
|
81 |
@Autowired |
|
82 |
MatCodeImageIfc matCodeImageIfc; |
|
83 |
|
|
84 |
// 商品选项 |
|
85 |
@Autowired |
|
86 |
MatOptionIfc matOptionIfc; |
|
87 |
|
|
88 |
// 购物车 |
|
89 |
@Autowired |
|
90 |
CartIfc cartIfc; |
|
91 |
|
|
92 |
// 消费积份 |
|
93 |
@Autowired |
|
94 |
MatPointsIfc matPointsIfc; |
|
95 |
|
|
96 |
// 商品促销活动关联表 |
|
97 |
@Autowired |
|
98 |
MatDiscountIfc matDiscountIfc; |
|
99 |
|
|
100 |
// 选项 |
|
101 |
@Autowired |
|
102 |
MatComponentIfc matComponentIfc; |
|
103 |
|
|
104 |
// 显示分享信息 |
|
105 |
@Autowired |
|
106 |
ShareIfc shareIfc; |
|
107 |
|
|
108 |
// 选项属性 |
|
109 |
@Autowired |
|
110 |
MatAttrIfc matAttrIfc; |
|
111 |
//优惠劵 |
|
112 |
@Autowired |
|
113 |
CouponIfc couponIfc; |
|
114 |
|
|
115 |
//预付订金分组 |
|
116 |
@Autowired |
|
117 |
PrepaidDepositIfc prepaidDepositIfc; |
|
118 |
|
|
119 |
//获取团购订单信息 |
|
120 |
@Autowired |
|
121 |
OrderIfc orderIfc; |
|
122 |
|
|
123 |
@RequestMapping("/shopping/getMatCodeList.do") |
|
124 |
public void getMatCodeList(HttpServletRequest request, HttpServletResponse response) { |
|
125 |
HttpSession session = request.getSession(); |
22907b
|
126 |
//String hostUrl = SettingKey.getHostUrl(request); |
J |
127 |
String hostUrlForImage = SettingKey.getHostUrlForImage(request); |
a6a76f
|
128 |
// int sequence = (request.getAttribute("sequence") != null ? |
F |
129 |
// (Integer)request.getAttribute("sequence"):0); |
|
130 |
// 处理排序 |
|
131 |
String sort = (request.getParameter("sort") == null ? "" : request.getParameter("sort")); |
|
132 |
String order = (request.getParameter("order") == null ? "" : request.getParameter("order")); |
|
133 |
String orderBy = " a.SortOrder asc,a.MatCode asc "; |
|
134 |
if (sort != null && !"".equals(sort)) { |
|
135 |
orderBy = sort + " " + (order == null || "".equals(order) ? " asc " : order); |
|
136 |
} |
|
137 |
// search |
|
138 |
String search = (request.getParameter("search") == null ? "" : request.getParameter("search")); |
|
139 |
String matGroup = (request.getParameter("matgroup") == null ? "" : request.getParameter("matgroup")); |
|
140 |
String isDescription = (request.getParameter("isdescription") == null ? "" |
|
141 |
: request.getParameter("isdescription")); |
|
142 |
String isSearchSubMatGroup = (request.getParameter("issubmatgroup") == null ? "" |
|
143 |
: request.getParameter("issubmatgroup")); |
|
144 |
String couponCode = (request.getParameter("couponcode") == null ? "" : request.getParameter("couponcode")); |
|
145 |
String isShowSubMatGroup = request.getParameter("isShowSubMatGroup") ; |
|
146 |
String path = (request.getParameter(SettingKey.NAVKEY) == null ? "" : request.getParameter(SettingKey.NAVKEY)); |
da486f
|
147 |
String cltCode = (session.getAttribute(SettingKey.CLTCODE)==null?"":(String)session.getAttribute(SettingKey.CLTCODE)); |
a6a76f
|
148 |
String fromUserId = request.getParameter(SettingKey.FROMUSERID) ; |
F |
149 |
// boolean isMoblieBrowser = SettingKey.isMoblieBrowser(request); |
|
150 |
// String openId = |
|
151 |
// (session.getAttribute(SessionKey.WEIXIN_OPENID)==null?"":(String)session.getAttribute(SessionKey.WEIXIN_OPENID)); |
|
152 |
//String hostUrl = SettingKey.getHostUrl(request); |
abc52b
|
153 |
String openId = (session.getAttribute(SessionKey.WEIXIN_OPENID) == null ? "" |
J |
154 |
: (String) session.getAttribute(SessionKey.WEIXIN_OPENID)); |
a6a76f
|
155 |
SettingEntity settingEntity = null; |
F |
156 |
|
|
157 |
|
|
158 |
JsonObject json = new JsonObject(); |
|
159 |
JsonObject errJson = new JsonObject(); |
|
160 |
try { |
|
161 |
DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; |
|
162 |
SpObserver.setDBtoInstance("_" +dataSourceEntity.getDbId());// 切换数据源 |
22907b
|
163 |
settingEntity = settingIfc.getSettingEntity(request); |
a6a76f
|
164 |
|
F |
165 |
// 取网店 shopcccode |
|
166 |
ShopCcCodeEntity shopCcCodeEntity = ShopCcCode.getShopCcCode(settingEntity,request); |
|
167 |
|
|
168 |
ProductListSetting set = (ProductListSetting) request.getAttribute(SettingKey.PRODLISTSETTING); |
|
169 |
if (set == null) { |
|
170 |
String fromData = request.getParameter("fromdata"); // 从 url 取值 |
|
171 |
set = new ProductListSetting(); |
|
172 |
set.setFrom(fromData); |
|
173 |
set.setPath(path); |
|
174 |
set.setShowSubMatGroup(isShowSubMatGroup!=null&&"true".equals(isShowSubMatGroup)?true:false); |
|
175 |
} |
|
176 |
|
|
177 |
// 处理显示第几页,limit : 页面使用无限加载(dropload)才启用这个条件判断,目的是使页面加载出来更好看,不会留出空白 |
|
178 |
String limit = (request.getParameter("limit") == null ? settingEntity.getProductLimit().toString() |
|
179 |
: request.getParameter("limit")); |
|
180 |
String curPage = (request.getParameter("page") == null ? "1" : request.getParameter("page")); |
|
181 |
|
|
182 |
|
|
183 |
List<MatCodeEntity> matCodeList = null; |
|
184 |
matCodeIfc.setOrderBy(null); |
|
185 |
matCodeIfc.setShowSubMatGroup(false); |
|
186 |
matCodeIfc.setWhereOthers(null); |
|
187 |
|
|
188 |
// 1 显示推荐商品 |
|
189 |
if (set.getFrom() != null && "1".equals(set.getFrom())) { |
abc52b
|
190 |
matCodeList = matCodeIfc.getMatCodesByBestSeller(shopCcCodeEntity.getShopCcCode(),cltCode,openId); |
a6a76f
|
191 |
} |
F |
192 |
|
|
193 |
//long currentTime = System.currentTimeMillis() ; |
|
194 |
//System.out.println(getClass()+" 开始..." + currentTime); |
|
195 |
// 2 按商品分类显示商品 |
|
196 |
if (set.getFrom() != null && "2".equals(set.getFrom())) { |
|
197 |
//System.out.println(getClass()+" 2..." +(System.currentTimeMillis() - currentTime)); |
|
198 |
String myMatGroupsProd[] = set.getPath().split(SettingKey.NAVSPLIT); |
|
199 |
// String firstMatGroupProd = myMatGroupsProd[0]; |
|
200 |
String lastMatGroupProd = myMatGroupsProd[myMatGroupsProd.length - 1]; |
|
201 |
matCodeIfc.setOrderBy(orderBy); // 设置排序显示 |
|
202 |
matCodeIfc.setShowSubMatGroup(set.isShowSubMatGroup()); |
|
203 |
matCodeList = matCodeIfc.getMatCodesByMatGroup(lastMatGroupProd, Integer.parseInt(limit), |
abc52b
|
204 |
Integer.parseInt(curPage), shopCcCodeEntity.getShopCcCode(),cltCode,openId); |
a6a76f
|
205 |
//System.out.println(getClass()+" 3..." +(System.currentTimeMillis() - currentTime)); |
F |
206 |
} |
|
207 |
// 3 按商品显示关联商品 |
|
208 |
if (set.getFrom() != null && "3".equals(set.getFrom())) { |
|
209 |
String matCodeProd = (request.getParameter(SettingKey.MATCODE) == null ? "" |
|
210 |
: request.getParameter(SettingKey.MATCODE)); |
|
211 |
if (matCodeProd == null) |
|
212 |
matCodeProd = (request.getAttribute(SettingKey.MATCODE) == null ? "" |
|
213 |
: (String) request.getAttribute(SettingKey.MATCODE)); |
abc52b
|
214 |
matCodeList = matCodeIfc.getMatCodesByRelMat(matCodeProd, shopCcCodeEntity.getShopCcCode(),cltCode,openId); |
a6a76f
|
215 |
} |
F |
216 |
|
|
217 |
// 4 按品牌显示商品 |
|
218 |
if (set.getFrom() != null && "4".equals(set.getFrom())) { |
|
219 |
String myBrands[] = set.getPath().split(SettingKey.NAVSPLIT); |
|
220 |
// String firstBrand = myBrands[0]; |
|
221 |
String lastBrand = myBrands[myBrands.length - 1]; |
|
222 |
matCodeIfc.setOrderBy(orderBy); // 设置排序显示 |
|
223 |
matCodeList = matCodeIfc.getMatCodesByBrand(lastBrand, Integer.parseInt(limit), |
abc52b
|
224 |
Integer.parseInt(curPage), shopCcCodeEntity.getShopCcCode(),cltCode,openId); |
a6a76f
|
225 |
} |
F |
226 |
// 5 按搜索显示结果 |
|
227 |
if (set.getFrom() != null && "5".equals(set.getFrom())) { |
|
228 |
matCodeIfc.setOrderBy(orderBy); // 设置排序显示 |
|
229 |
matCodeList = matCodeIfc.getMatCodesBySearch(search, matGroup, isSearchSubMatGroup, isDescription, |
abc52b
|
230 |
Integer.parseInt(limit), Integer.parseInt(curPage), couponCode, shopCcCodeEntity.getShopCcCode(), false,cltCode,openId); |
a6a76f
|
231 |
if (matCodeList == null || matCodeList.size() == 0) { |
F |
232 |
if (curPage != null && curPage.equals("1")) { |
|
233 |
errJson.addProperty("warning", "没有搜索到符合条件的商品。"); |
|
234 |
json.add("error", errJson); |
|
235 |
} |
|
236 |
this.printJson(response, json.toString()); |
|
237 |
return; |
|
238 |
} |
|
239 |
} |
|
240 |
|
|
241 |
// 6 按特价优惠显示结果 |
|
242 |
if (set.getFrom() != null && "6".equals(set.getFrom())) { |
|
243 |
matCodeIfc.setOrderBy(orderBy); // 设置排序显示 |
|
244 |
matCodeList = matCodeIfc.getMatCodesBySpecialOffer(Integer.parseInt(limit), Integer.parseInt(curPage), |
abc52b
|
245 |
shopCcCodeEntity.getShopCcCode(),cltCode,openId); |
a6a76f
|
246 |
} |
F |
247 |
|
|
248 |
// 7 按维护商品分组显示 710126 (只取第一个分组的内容) |
|
249 |
if (set.getFrom() != null && "7".equals(set.getFrom())) { |
|
250 |
if (set.getShowGroupDocCode()==null||"".equals(set.getShowGroupDocCode())) { |
|
251 |
List<ShowGroupNameEntity> showGroupNameList = matCodeIfc.getShowGroupNames(shopCcCodeEntity.getShopCcCode()) ; |
|
252 |
if (showGroupNameList!=null) { |
|
253 |
set.setShowGroupDocCode(showGroupNameList.get(0).getDocCode()); |
|
254 |
} |
|
255 |
} |
|
256 |
|
|
257 |
matCodeIfc.setOrderBy(" f.SortOrder asc,e.DocItem asc "); // 设置排序显示 |
abc52b
|
258 |
matCodeList = matCodeIfc.getMatCodesByShowGroup(set.getShowGroupDocCode(), shopCcCodeEntity.getShopCcCode(),cltCode,openId); |
a6a76f
|
259 |
} |
F |
260 |
|
|
261 |
// 8 按维护商品分组显示 710126 (显示所有分组及其内容) |
|
262 |
if (set.getFrom() != null && "8".equals(set.getFrom())) { |
|
263 |
matCodeIfc.setOrderBy(" cast(isnull(f.SortOrder,0) as varchar(10)) +'.'+ f.DocCode asc,e.DocItem asc "); // 设置排序显示 |
abc52b
|
264 |
List<MatCodeEntity> matCodeListByShowGroupName = matCodeIfc.getMatCodesByShowGroup(null, shopCcCodeEntity.getShopCcCode(),cltCode,openId); |
a6a76f
|
265 |
|
F |
266 |
JsonArray matGroupNameJsonArray = new JsonArray(); |
|
267 |
|
|
268 |
// 根据GroupName去重 |
|
269 |
List<MatCodeEntity> groupList = matCodeListByShowGroupName.stream().collect( |
|
270 |
Collectors.collectingAndThen( |
|
271 |
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(MatCodeEntity::getGroupSortOrder))), ArrayList::new) |
|
272 |
); |
|
273 |
for (int i = 0 ;groupList != null && i < groupList.size();i++) { |
|
274 |
String groupDocCode = groupList.get(i).getGroupDocCode() ; |
|
275 |
//根据条件重新取集合 |
|
276 |
List<MatCodeEntity> matList = matCodeListByShowGroupName.stream().filter(s->s.getGroupDocCode().equals(groupDocCode) ).collect(Collectors.toList()); |
|
277 |
JsonArray itemJsonArray = getJsonArrayByMatCodeList(matList, request, settingEntity,dataSourceEntity.getDbId()); |
|
278 |
|
|
279 |
JsonObject groupJsonObject = new JsonObject() ; |
|
280 |
groupJsonObject.addProperty("ShowGroupName", groupList.get(i).getGroupName()); |
|
281 |
groupJsonObject.addProperty("isHorizontalScrolling", groupList.get(i).isHorizontalScrolling()); |
|
282 |
groupJsonObject.addProperty("ImageWidthWhenScrolling",groupList.get(i).getImageWidthWhenScrolling()); |
|
283 |
|
22907b
|
284 |
groupJsonObject.addProperty("Photo", SettingKey.getUrl(hostUrlForImage, groupList.get(i).getGroupPhotoUrl(), dataSourceEntity.getDbId()+"",null)) ; |
a6a76f
|
285 |
//groupJsonObject.addProperty("Photo", |
F |
286 |
// imgData.getImageUrl(groupList.get(i).getGroupPhoto(), settingEntity.getImageProductWidth(), |
|
287 |
// settingEntity.getImageProductHeight(), settingEntity.isShowProductOrgImage(), |
|
288 |
// settingEntity.isFromCached(), request) |
|
289 |
// ); |
|
290 |
groupJsonObject.add("list", itemJsonArray); |
|
291 |
matGroupNameJsonArray.add(groupJsonObject); |
|
292 |
} |
|
293 |
|
|
294 |
/* |
|
295 |
List<ShowGroupNameEntity> showGroupNameList = matCodeIfc.getShowGroupNames(shopCcCodeEntity.getShopCcCode()) ; |
|
296 |
|
|
297 |
for (int i = 0 ;showGroupNameList != null && i < showGroupNameList.size();i++) { |
|
298 |
List<MatCodeEntity> matCodeListByShowGroupName = matCodeIfc.getMatCodesByShowGroup( |
|
299 |
showGroupNameList.get(i).getDocCode(), shopCcCodeEntity.getShopCcCode(),cltCode); |
|
300 |
JsonArray itemJsonArray = getJsonObjectByMatCodeList(matCodeListByShowGroupName, request, settingEntity,dataSourceEntity.getDbId()); |
|
301 |
|
|
302 |
JsonObject groupJsonObject = new JsonObject() ; |
|
303 |
groupJsonObject.addProperty("ShowGroupName", showGroupNameList.get(i).getGroupName()); |
|
304 |
groupJsonObject.addProperty("isHorizontalScrolling", showGroupNameList.get(i).isHorizontalScrolling()); |
|
305 |
groupJsonObject.addProperty("ImageWidthWhenScrolling",showGroupNameList.get(i).getImageWidthWhenScrolling()); |
|
306 |
groupJsonObject.addProperty("Photo", |
|
307 |
imgData.getImageUrl(showGroupNameList.get(i).getPhoto(), settingEntity.getImageProductWidth(), |
|
308 |
settingEntity.getImageProductHeight(), settingEntity.isShowProductOrgImage(), |
|
309 |
settingEntity.isFromCached(), request) |
|
310 |
); |
|
311 |
groupJsonObject.add("list", itemJsonArray); |
|
312 |
matGroupNameJsonArray.add(groupJsonObject); |
|
313 |
} */ |
|
314 |
json.add("ShowGroup", matGroupNameJsonArray); |
|
315 |
this.printJson(response, json.toString()); |
|
316 |
return; |
|
317 |
} |
|
318 |
|
|
319 |
//9.抢购订金分组 710170 (显示所有分组及其内容) |
|
320 |
if (set.getFrom() != null && "9".equals(set.getFrom())) { |
|
321 |
matCodeIfc.setOrderBy(" cast(isnull(f.SortOrder,0) as varchar(10)) +'.'+ f.DocCode asc,e.DocItem asc "); // 设置排序显示 |
|
322 |
JsonArray matGroupNameJsonArray = new JsonArray(); |
|
323 |
List<MatCodeEntity> matCodeListByShowGroupName = matCodeIfc.getMatCodesByPrepaidDepositGroup( |
abc52b
|
324 |
null, shopCcCodeEntity.getShopCcCode(),cltCode,openId); |
a6a76f
|
325 |
|
F |
326 |
// 根据GroupName去重 |
|
327 |
List<MatCodeEntity> groupList = matCodeListByShowGroupName.stream().collect( |
|
328 |
Collectors.collectingAndThen( |
|
329 |
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(MatCodeEntity::getGroupSortOrder))), ArrayList::new) |
|
330 |
); |
|
331 |
for (int i = 0 ;groupList != null && i < groupList.size();i++) { |
|
332 |
String groupDocCode = groupList.get(i).getGroupDocCode() ; |
|
333 |
//根据条件重新取集合 |
|
334 |
List<MatCodeEntity> matList = matCodeListByShowGroupName.stream().filter(s->s.getGroupDocCode().equals(groupDocCode) ).collect(Collectors.toList()); |
|
335 |
JsonArray itemJsonArray = getJsonArrayByMatCodeList(matList, request, settingEntity,dataSourceEntity.getDbId()); |
|
336 |
|
|
337 |
JsonObject groupJsonObject = new JsonObject() ; |
|
338 |
groupJsonObject.addProperty("ShowGroupName", groupList.get(i).getGroupName()); |
|
339 |
groupJsonObject.addProperty("isHorizontalScrolling", groupList.get(i).isHorizontalScrolling()); |
|
340 |
groupJsonObject.addProperty("ImageWidthWhenScrolling",groupList.get(i).getImageWidthWhenScrolling()); |
22907b
|
341 |
groupJsonObject.addProperty("Photo",SettingKey.getUrl(hostUrlForImage, groupList.get(i).getGroupPhotoUrl(), dataSourceEntity.getDbId()+"",null)) ; |
a6a76f
|
342 |
//groupJsonObject.addProperty("Photo", |
F |
343 |
// imgData.getImageUrl(groupList.get(i).getGroupPhoto(), settingEntity.getImageProductWidth(), |
|
344 |
// settingEntity.getImageProductHeight(), settingEntity.isShowProductOrgImage(), |
|
345 |
// settingEntity.isFromCached(), request) |
|
346 |
// ); |
|
347 |
groupJsonObject.add("list", itemJsonArray); |
|
348 |
matGroupNameJsonArray.add(groupJsonObject); |
|
349 |
} |
|
350 |
|
|
351 |
/* |
|
352 |
List<PrepaidDepositEntity> prepaidDepositList = prepaidDepositIfc.getPrepaidDepositList(shopCcCodeEntity.getShopCcCode()) ; |
|
353 |
for (int i = 0 ;prepaidDepositList != null && i < prepaidDepositList.size();i++) { |
|
354 |
List<MatCodeEntity> matCodeListByShowGroupName = matCodeIfc.getMatCodesByPrepaidDepositGroup( |
|
355 |
prepaidDepositList.get(i).getDocCode(), shopCcCodeEntity.getShopCcCode(),cltCode); |
|
356 |
JsonArray itemJsonArray = getJsonObjectByMatCodeList(matCodeListByShowGroupName, request, settingEntity,dataSourceEntity.getDbId()); |
|
357 |
|
|
358 |
JsonObject groupJsonObject = new JsonObject() ; |
|
359 |
groupJsonObject.addProperty("ShowGroupName", prepaidDepositList.get(i).getName()); |
|
360 |
groupJsonObject.addProperty("isHorizontalScrolling", prepaidDepositList.get(i).isHorizontalScrolling()); |
|
361 |
groupJsonObject.addProperty("ImageWidthWhenScrolling",prepaidDepositList.get(i).getImageWidthWhenScrolling()); |
|
362 |
groupJsonObject.addProperty("Photo", |
|
363 |
imgData.getImageUrl(prepaidDepositList.get(i).getPhoto(), settingEntity.getImageProductWidth(), |
|
364 |
settingEntity.getImageProductHeight(), settingEntity.isShowProductOrgImage(), |
|
365 |
settingEntity.isFromCached(), request) |
|
366 |
); |
|
367 |
groupJsonObject.add("list", itemJsonArray); |
|
368 |
matGroupNameJsonArray.add(groupJsonObject); |
|
369 |
} */ |
|
370 |
json.add("ShowGroup", matGroupNameJsonArray); |
|
371 |
this.printJson(response, json.toString()); |
|
372 |
return; |
|
373 |
} |
|
374 |
|
|
375 |
//10.取所有物料列表,用于制作海报时可选择任何商品 作为海报的二维码链接 |
|
376 |
if (set.getFrom() != null && "10".equals(set.getFrom())) { |
abc52b
|
377 |
matCodeList = matCodeIfc.getMatCodes(null,null,shopCcCodeEntity.getShopCcCode(),null,cltCode,openId) ; |
a6a76f
|
378 |
} |
F |
379 |
|
|
380 |
//11.取名片用户推荐的商品列表 |
|
381 |
if (set.getFrom() != null && "11".equals(set.getFrom())) { |
abc52b
|
382 |
matCodeList = matCodeIfc.getMatCodesByFromUserId(fromUserId,shopCcCodeEntity.getShopCcCode(),cltCode,openId) ; |
a6a76f
|
383 |
} |
F |
384 |
//System.out.println(getClass()+" 准备输出:" +(System.currentTimeMillis() - currentTime)); |
|
385 |
json.add("list", getJsonArrayByMatCodeList(matCodeList, request, settingEntity,dataSourceEntity.getDbId())); |
|
386 |
//System.out.println(getClass()+" 输出结束:" +(System.currentTimeMillis() - currentTime)); |
|
387 |
this.printJson(response, json.toString()); |
|
388 |
return; |
|
389 |
|
|
390 |
} catch (DataAccessException e) { |
|
391 |
e.printStackTrace(); |
|
392 |
errJson.addProperty("warning",(e.getCause()!=null? e.getCause().getMessage():e.getMessage())); |
|
393 |
json.add("error", errJson); |
|
394 |
this.printJson(response, json.toString()); |
|
395 |
return; |
|
396 |
} catch (Exception e) { |
|
397 |
e.printStackTrace(); |
|
398 |
errJson.addProperty("warning", (e.getCause()!=null? e.getCause().getMessage():e.getMessage())); |
|
399 |
json.add("error", errJson); |
|
400 |
this.printJson(response, json.toString()); |
|
401 |
return; |
|
402 |
} finally { |
|
403 |
SpObserver.setDBtoInstance(); |
|
404 |
} |
|
405 |
} |
|
406 |
|
|
407 |
|
|
408 |
/** |
|
409 |
* 按物料主数据list 返回 json 对象 |
|
410 |
* @param matCodeList |
|
411 |
* @param request |
|
412 |
* @param settingEntity |
|
413 |
* @return |
|
414 |
*/ |
|
415 |
public static JsonArray getJsonArrayByMatCodeList(List<MatCodeEntity> matCodeList,HttpServletRequest request,SettingEntity settingEntity,int dbId) { |
|
416 |
JsonArray matCodeJsonArray = new JsonArray(); |
|
417 |
for (int i = 0; matCodeList != null && i < matCodeList.size(); i++) { |
|
418 |
MatCodeEntity matCodeEntity = matCodeList.get(i); |
|
419 |
JsonObject jsonObject = getJsonObjectByMatCodeList( matCodeEntity, request, settingEntity, dbId); |
|
420 |
matCodeJsonArray.add(jsonObject); |
|
421 |
} |
|
422 |
return matCodeJsonArray ; |
|
423 |
} |
|
424 |
|
|
425 |
public static JsonObject getJsonObjectByMatCodeList(MatCodeEntity matCodeEntity,HttpServletRequest request,SettingEntity settingEntity,int dbId) { |
22907b
|
426 |
//HttpSession session = request.getSession(); |
J |
427 |
// String userCode = (session.getAttribute(SessionKey.USERCODE) == null ? "" |
|
428 |
// : (String) session.getAttribute(SessionKey.USERCODE)); |
a6a76f
|
429 |
|
F |
430 |
String wxQueryString = SettingKey.getQueryStringByWx(request); |
|
431 |
boolean isMoblieBrowser = SettingKey.isMoblieBrowser(request); |
|
432 |
String hostUrl = SettingKey.getHostUrl(request); |
a8a784
|
433 |
String hostUrlForImage = SettingKey.getHostUrlForImage(request); |
a6a76f
|
434 |
//String cltCode = (String) session.getAttribute(SettingKey.CLTCODE) ; |
F |
435 |
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
22907b
|
436 |
//CurrencyIfc currencyIfc = (CurrencyIfc)FactoryBean.getBean("CurrencyImpl"); |
J |
437 |
CurrencyEntity currencyEntity = new CurrencyEntity(request); |
a6a76f
|
438 |
|
F |
439 |
JsonObject jsonObject = new JsonObject(); |
|
440 |
jsonObject.addProperty("MatCode", matCodeEntity.getMatCode()); |
|
441 |
String url = "",externalURL = ""; |
|
442 |
if (matCodeEntity.getExternalURL() != null && !"".equals(matCodeEntity.getExternalURL())) { |
|
443 |
externalURL = matCodeEntity.getExternalURL(); |
|
444 |
if (!externalURL.startsWith("http")) externalURL = hostUrl + externalURL ; |
|
445 |
String separator = "?" ; |
|
446 |
int pos = externalURL.indexOf("?") ; |
|
447 |
if (pos > 0) separator = "&"; |
|
448 |
externalURL = externalURL + (wxQueryString == null || "".equals(wxQueryString) ? "" : separator + wxQueryString); |
|
449 |
} else { |
|
450 |
url = hostUrl + SettingKey.getMatCodeUrl("", matCodeEntity.getMatCode(), isMoblieBrowser) |
|
451 |
+ (wxQueryString == null || "".equals(wxQueryString) ? "" : "&" + wxQueryString); |
|
452 |
} |
|
453 |
jsonObject.addProperty("ExternalUrl", externalURL ); |
|
454 |
jsonObject.addProperty("MatCodeUrl", url); |
|
455 |
|
|
456 |
//主图片 |
|
457 |
if (matCodeEntity.getPhotoPathUrl() != null && !matCodeEntity.getPhotoPathUrl().equals("")) { |
a8a784
|
458 |
jsonObject.addProperty("PhotoPath",SettingKey.getUrl(hostUrlForImage, matCodeEntity.getPhotoPathUrl(), dbId+"",null)) ; |
5b4901
|
459 |
jsonObject.addProperty("PhotoPathUrl",SettingKey.getUrl(hostUrlForImage, matCodeEntity.getPhotoPathUrl(), dbId+"",null)) ; |
a6a76f
|
460 |
//imgData.getImageUrl(matCodeEntity.getPhotoPath(), |
F |
461 |
// settingEntity.getImageProductWidth(), |
|
462 |
// settingEntity.getImageProductHeight(), settingEntity.isShowProductOrgImage(), |
|
463 |
// settingEntity.isFromCached(), request) |
|
464 |
// + (wxQueryString == null || "".equals(wxQueryString) ? "" : "?" + wxQueryString) |
|
465 |
// ); |
|
466 |
} |
|
467 |
|
|
468 |
// 主图片与多图片合并 |
|
469 |
JsonArray subImageListArray = new JsonArray(); |
|
470 |
if (matCodeEntity.getPhotoPathUrl() != null && !matCodeEntity.getPhotoPathUrl().equals("")) { |
a8a784
|
471 |
subImageListArray.add(SettingKey.getUrl(hostUrlForImage, matCodeEntity.getPhotoPathUrl(), dbId+"",null)); |
a6a76f
|
472 |
//imgData.getImageUrl(matCodeEntity.getPhotoPath(), settingEntity.getImageProductWidth(), |
F |
473 |
//settingEntity.getImageProductHeight(), settingEntity.isShowProductOrgImage(), |
|
474 |
//settingEntity.isFromCached(), request) |
|
475 |
//+ (wxQueryString == null || "".equals(wxQueryString) ? "" : "?" + wxQueryString) |
|
476 |
// ); |
|
477 |
} |
|
478 |
|
|
479 |
// 主图片与多图片合并 |
|
480 |
if (settingEntity.isShowImageAdditional()) { |
|
481 |
/* |
|
482 |
List<MatCodeImageEntity> matImageList = matCodeImageIfc.getMatCodeImage(matCodeEntity.getMatCode()); |
|
483 |
for (int k = 0; matImageList != null && k < matImageList.size(); k++) { |
|
484 |
MatCodeImageEntity matImage = matImageList.get(k); |
|
485 |
subImageListArray.add(imgData.getImageUrl(matImage.getImage(), settingEntity.getImagePopupWidth(), |
|
486 |
settingEntity.getImagePopupHeight(), settingEntity.isShowPopupOrgImage(), |
|
487 |
settingEntity.isFromCached(), request) |
|
488 |
//+ (wxQueryString == null || "".equals(wxQueryString) ? "" : "?" + wxQueryString) |
|
489 |
); |
|
490 |
} |
|
491 |
*/ |
|
492 |
if (matCodeEntity.getImagesUrl()!=null && !matCodeEntity.getImagesUrl().equals("")) { |
|
493 |
String images[] = matCodeEntity.getImagesUrl().split(";") ; |
|
494 |
for (int j = 0; j < images.length; j++) { |
a8a784
|
495 |
subImageListArray.add(SettingKey.getUrl(hostUrlForImage, images[j], dbId+"",null) ); |
a6a76f
|
496 |
} |
F |
497 |
} |
|
498 |
} |
|
499 |
jsonObject.add("images", subImageListArray); |
|
500 |
|
|
501 |
jsonObject.addProperty("isShowMatCode", settingEntity.isShowMatCode()); |
|
502 |
jsonObject.addProperty("isShowMatName", settingEntity.isShowMatName()); |
|
503 |
jsonObject.addProperty("isShowSpecial", settingEntity.isShowSpecial()); |
|
504 |
jsonObject.addProperty("isShowPrice", settingEntity.isShowPrice()); |
|
505 |
jsonObject.addProperty("ShopMatCode", matCodeEntity.getShopMatCode()); |
|
506 |
jsonObject.addProperty("isShowPoints", settingEntity.isShowPoints()); |
|
507 |
jsonObject.addProperty("isShowBrand", settingEntity.isShowBrand()); |
|
508 |
jsonObject.addProperty("StockDisplay", settingEntity.getStockDisplay()); |
|
509 |
|
|
510 |
//销售单位 |
|
511 |
jsonObject.addProperty("Uom", matCodeEntity.getSalesUOM()); |
|
512 |
//最小起订数量 |
|
513 |
jsonObject.addProperty("Mininum", matCodeEntity.getMininum()); |
|
514 |
|
|
515 |
//是否限量销售 |
419647
|
516 |
jsonObject.addProperty("isRestrictQuantity", matCodeEntity.getIsRestrictQuantity()); |
J |
517 |
Double quantity = matCodeEntity.getQuantity(); |
|
518 |
if (matCodeEntity.getIsRestrictQuantity()==2) { |
|
519 |
quantity = matCodeEntity.getStockDigitForShoppingSaleable(); |
|
520 |
} |
|
521 |
//销售数量限量 |
|
522 |
jsonObject.addProperty("Quantity",quantity); //小程序页面前端用于控制加入购物车是否置灰 |
|
523 |
//可用库存限量 |
|
524 |
jsonObject.addProperty("StockDigitForShoppingSaleable", matCodeEntity.getStockDigitForShoppingSaleable()); |
a6a76f
|
525 |
//同一ID购买限量 |
F |
526 |
jsonObject.addProperty("RestrictBuyingQuantity", matCodeEntity.getRestrictBuyingQuantity()); |
|
527 |
//是否启用秒杀 |
|
528 |
jsonObject.addProperty("isStartupPanicBuying", matCodeEntity.isStartupPanicBuying()); |
|
529 |
//秒杀开始时间 |
|
530 |
jsonObject.addProperty("PanicBuyingStartTime", matCodeEntity.getPanicBuyingStartTime()!= null?sdf2.format(matCodeEntity.getPanicBuyingStartTime()):""); |
|
531 |
//秒杀结束时间 |
|
532 |
jsonObject.addProperty("PanicBuyingEndTime", matCodeEntity.getPanicBuyingEndTime()!= null?sdf2.format(matCodeEntity.getPanicBuyingEndTime()):""); |
|
533 |
//秒杀开始剩余秒数 |
|
534 |
jsonObject.addProperty("PanicBuyingStartTimeBalance", matCodeEntity.getPanicBuyingStartTimeBalance()== null||matCodeEntity.getPanicBuyingStartTimeBalance().longValue()<0L?0:matCodeEntity.getPanicBuyingStartTimeBalance()); |
|
535 |
//秒杀结束剩余秒数 |
|
536 |
jsonObject.addProperty("PanicBuyingEndTimeBalance", matCodeEntity.getPanicBuyingEndTimeBalance()== null||matCodeEntity.getPanicBuyingEndTimeBalance().longValue()<0L?0:matCodeEntity.getPanicBuyingEndTimeBalance()); |
|
537 |
|
|
538 |
//是否启用团购 |
|
539 |
jsonObject.addProperty("isStartupGroupBuying", matCodeEntity.isStartupGroupBuying()); |
|
540 |
//成团人数 |
|
541 |
jsonObject.addProperty("GroupBuyingMembers", matCodeEntity.getGroupBuyingMembers()); |
|
542 |
//团购价格 |
|
543 |
jsonObject.addProperty("GroupBuyingPrice", matCodeEntity.getGroupBuyingPrice()); |
|
544 |
//团购开始时间 |
|
545 |
jsonObject.addProperty("GroupBuyingStartTime", matCodeEntity.getGroupBuyingStartTime()!= null?sdf2.format(matCodeEntity.getGroupBuyingStartTime()):""); |
|
546 |
//团购结束时间 |
|
547 |
jsonObject.addProperty("GroupBuyingEndTime", matCodeEntity.getGroupBuyingEndTime()!= null?sdf2.format(matCodeEntity.getGroupBuyingEndTime()):""); |
|
548 |
//团购开始剩余秒数 |
|
549 |
jsonObject.addProperty("GroupBuyingStartTimeBalance", matCodeEntity.getGroupBuyingStartTimeBalance()== null||matCodeEntity.getGroupBuyingStartTimeBalance().longValue()<0L?0:matCodeEntity.getGroupBuyingStartTimeBalance()); |
|
550 |
//团购结束剩余秒数 |
|
551 |
jsonObject.addProperty("GroupBuyingEndTimeBalance", matCodeEntity.getGroupBuyingEndTimeBalance()== null||matCodeEntity.getGroupBuyingEndTimeBalance().longValue()<0L?0:matCodeEntity.getGroupBuyingEndTimeBalance()); |
|
552 |
//团购失败原路退款 |
|
553 |
jsonObject.addProperty("isGroupBuyingFailedToBacktrack", matCodeEntity.isGroupBuyingFailedToBacktrack()); |
|
554 |
|
|
555 |
|
|
556 |
jsonObject.addProperty("PreSendMinutes", matCodeEntity.getPreSendMinutes()); //多少分钟交货 |
|
557 |
jsonObject.addProperty("PreSendMinutesDesc", matCodeEntity.getPreSendMinutesDesc()); //多少分钟交货描述 |
|
558 |
|
|
559 |
if (settingEntity.isShowMatName()) { |
|
560 |
jsonObject.addProperty("MatName", matCodeEntity.getMatName()); |
|
561 |
} |
|
562 |
if (settingEntity.isShowDescription()) { |
|
563 |
jsonObject.addProperty("Description", HtmlUtil.getShortDescription( |
|
564 |
settingEntity.getProductDescriptionLength(), matCodeEntity.getDescription())); |
|
565 |
} |
|
566 |
if (settingEntity.isShowRatingOnHomePage()) { |
|
567 |
jsonObject.addProperty("RatingAvg", matCodeEntity.getRatingAvg() + ""); |
|
568 |
} |
|
569 |
if (settingEntity.isShowPrice()) { |
|
570 |
|
|
571 |
//MatPriceEntity matPriceEntity = matPriceIfc.getMatPrice(matCodeEntity.getMatCode(), cltCode, null); |
|
572 |
Double price = matCodeEntity.getPrice(); // matPriceEntity.getPrice(); |
|
573 |
if (price!=null) { |
|
574 |
jsonObject.addProperty("Price", price ); // 实际价格,此价格可能低于“标价” |
|
575 |
jsonObject.addProperty("SalesPrice", matCodeEntity.getSalesPrice() ); // 标价 |
|
576 |
|
|
577 |
jsonObject.addProperty("Currency", currencyEntity.getCurrency()); |
|
578 |
jsonObject.addProperty("CurrencySign", currencyEntity.getCurrencySign()); |
|
579 |
} |
|
580 |
} |
|
581 |
|
|
582 |
//-------开始: 抢购订金分组 , 功能号 710170 ---------------// |
|
583 |
jsonObject.addProperty("DepositAmount", matCodeEntity.getDepositAmount()); //抢购订金分组 里的 订金 ,功能号 710170 |
|
584 |
jsonObject.addProperty("ItemMemo", matCodeEntity.getItemMemo()); //抢购订金分组 里的 抢购/兑换规则描述 ,功能号 710170 |
|
585 |
jsonObject.addProperty("DepositDocCode", matCodeEntity.getDepositDocCode()); //抢购订金分组 里的 单号 doccode ,功能号 710170 |
|
586 |
jsonObject.addProperty("DepositRowId", matCodeEntity.getDepositRowId()); //抢购订金分组 里的 rowid ,功能号 710170 |
|
587 |
jsonObject.addProperty("isPaidDeposit", matCodeEntity.isPaidDeposit()); //抢购订金分组 里的 rowid ,功能号 710170 |
|
588 |
//-------结束: 抢购订金分组 , 功能号 710170 ---------------// |
|
589 |
jsonObject.addProperty("TotalRowCount", matCodeEntity.getTotalRowCount()); //总行数 |
|
590 |
jsonObject.addProperty("TotalPages", matCodeEntity.getTotalPages()); //总页数 |
abc52b
|
591 |
|
J |
592 |
jsonObject.addProperty("CartQuantity", matCodeEntity.getCartQuantity()); //购物车数量 |
8c9089
|
593 |
jsonObject.addProperty("isStartupSkuParameters", matCodeEntity.isStartupSkuParameters()); //启用SKU参数 |
a6a76f
|
594 |
|
F |
595 |
return jsonObject ; |
|
596 |
} |
|
597 |
|
|
598 |
|
|
599 |
/** |
|
600 |
* 按属性(如:颜色、几人坐。。。)获取商品编号 |
|
601 |
* @param request |
|
602 |
* @param response |
|
603 |
*/ |
|
604 |
@RequestMapping("/shopping/getSkuParameterByMatCode.do") |
|
605 |
public void getSkuParameterByMatCode(HttpServletRequest request, HttpServletResponse response) { |
329b51
|
606 |
HttpSession session = request.getSession(); |
J |
607 |
String openId = (session.getAttribute(SessionKey.WEIXIN_OPENID)==null?"":(String)session.getAttribute(SessionKey.WEIXIN_OPENID)) ; |
|
608 |
|
a6a76f
|
609 |
JsonObject json = new JsonObject(); |
F |
610 |
JsonObject errJson = new JsonObject(); |
|
611 |
SettingEntity settingEntity = null; |
|
612 |
String skuId1 = request.getParameter("skuId1") ; |
|
613 |
String skuId2 = request.getParameter("skuId2") ; |
|
614 |
String skuId3 = request.getParameter("skuId3") ; |
|
615 |
String skuId4 = request.getParameter("skuId4") ; |
|
616 |
String skuId5 = request.getParameter("skuId5") ; |
|
617 |
String skuId6 = request.getParameter("skuId6") ; |
|
618 |
String skuId7 = request.getParameter("skuId7") ; |
|
619 |
String skuId8 = request.getParameter("skuId8") ; |
|
620 |
String skuId9 = request.getParameter("skuId9") ; |
|
621 |
String skuId10 = request.getParameter("skuId10") ; |
|
622 |
String matCode = request.getParameter(SettingKey.MATCODE); |
|
623 |
try { |
|
624 |
DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; |
|
625 |
SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());// 切换数据源 |
22907b
|
626 |
settingEntity = settingIfc.getSettingEntity(request); |
J |
627 |
//long currentTime = System.currentTimeMillis(); //测试 |
a6a76f
|
628 |
// 取网店 shopcccode |
F |
629 |
ShopCcCodeEntity shopCcCodeEntity = ShopCcCode.getShopCcCode(settingEntity,request); |
22907b
|
630 |
//System.out.println(getClass() + " 1 " + (System.currentTimeMillis() - currentTime)); |
J |
631 |
|
a6a76f
|
632 |
SkuMatCodeEntity skuMatCodeEntity = null; |
F |
633 |
//JsonArray skuMatCodeJsonArray = new JsonArray(); |
|
634 |
if (matCode==null||"".equals(matCode)) { //如果 matcode 不为空值,表示按页面只选择了前面几个属性(如只选了颜色,而几人坐还没选的时候) |
|
635 |
//使用 skuId 参数查找商品编号,Added by Johns Wang,2021-01-30 |
|
636 |
skuMatCodeEntity = matCodeIfc.getSkuMatCodeBySkuId( |
|
637 |
skuId1==null||"".equals(skuId1)?null:Integer.parseInt(skuId1), |
|
638 |
skuId2==null||"".equals(skuId2)?null:Integer.parseInt(skuId2), |
|
639 |
skuId3==null||"".equals(skuId3)?null:Integer.parseInt(skuId3), |
|
640 |
skuId4==null||"".equals(skuId4)?null:Integer.parseInt(skuId4), |
|
641 |
skuId5==null||"".equals(skuId5)?null:Integer.parseInt(skuId5), |
|
642 |
skuId6==null||"".equals(skuId6)?null:Integer.parseInt(skuId6), |
|
643 |
skuId7==null||"".equals(skuId7)?null:Integer.parseInt(skuId7), |
|
644 |
skuId8==null||"".equals(skuId8)?null:Integer.parseInt(skuId8), |
|
645 |
skuId9==null||"".equals(skuId9)?null:Integer.parseInt(skuId9), |
d82cd6
|
646 |
skuId10==null||"".equals(skuId10)?null:Integer.parseInt(skuId10),openId); |
22907b
|
647 |
//System.out.println(getClass() + " 2 " + (System.currentTimeMillis() - currentTime)); |
a6a76f
|
648 |
if (skuMatCodeEntity == null) { |
F |
649 |
errJson.addProperty("warning", "没找到商品编号"); |
|
650 |
json.add("error", errJson); |
|
651 |
this.printJson(response, json.toString()); |
|
652 |
return; |
|
653 |
} |
d82cd6
|
654 |
|
J |
655 |
}else { |
|
656 |
if ((skuId1==null||"".equals(skuId1))&&(skuId2==null||"".equals(skuId2)) |
|
657 |
&&(skuId3==null||"".equals(skuId3))&&(skuId4==null||"".equals(skuId4)) |
|
658 |
&&(skuId5==null||"".equals(skuId5))&&(skuId6==null||"".equals(skuId6)) |
|
659 |
&&(skuId7==null||"".equals(skuId7))&&(skuId8==null||"".equals(skuId8)) |
|
660 |
&&(skuId9==null||"".equals(skuId9))&&(skuId10==null||"".equals(skuId10))) { |
|
661 |
skuMatCodeEntity = matCodeIfc.getSkuMatCodeByMatCode( matCode,openId); |
22907b
|
662 |
//System.out.println(getClass() + " 3 " + (System.currentTimeMillis() - currentTime)); |
d82cd6
|
663 |
if (skuMatCodeEntity == null) { |
J |
664 |
errJson.addProperty("warning", "没找到商品编号"); |
|
665 |
json.add("error", errJson); |
|
666 |
this.printJson(response, json.toString()); |
|
667 |
return; |
|
668 |
} |
|
669 |
} |
a6a76f
|
670 |
} |
22907b
|
671 |
//System.out.println(getClass() + " 4 " + (System.currentTimeMillis() - currentTime)); |
a6a76f
|
672 |
|
F |
673 |
//获取 sku 参数,用于“加入购物车” 或“立即购买” 时弹出选择,Added by Johns Wang,2021-01-30 |
|
674 |
//JsonArray skuParameterJsonArray = new JsonArray(); |
|
675 |
List<SkuParameterEntity> skuParameterList = matCodeIfc.getSkuParameter(skuMatCodeEntity!=null?skuMatCodeEntity.getMatCode():matCode,shopCcCodeEntity.getShopCcCode(), |
|
676 |
skuId1==null||"".equals(skuId1)?null:Integer.parseInt(skuId1), |
|
677 |
skuId2==null||"".equals(skuId2)?null:Integer.parseInt(skuId2), |
|
678 |
skuId3==null||"".equals(skuId3)?null:Integer.parseInt(skuId3), |
|
679 |
skuId4==null||"".equals(skuId4)?null:Integer.parseInt(skuId4), |
|
680 |
skuId5==null||"".equals(skuId5)?null:Integer.parseInt(skuId5), |
|
681 |
skuId6==null||"".equals(skuId6)?null:Integer.parseInt(skuId6), |
|
682 |
skuId7==null||"".equals(skuId7)?null:Integer.parseInt(skuId7), |
|
683 |
skuId8==null||"".equals(skuId8)?null:Integer.parseInt(skuId8), |
|
684 |
skuId9==null||"".equals(skuId9)?null:Integer.parseInt(skuId9), |
|
685 |
skuId10==null||"".equals(skuId10)?null:Integer.parseInt(skuId10)); |
22907b
|
686 |
//System.out.println(getClass() + " 5 " + (System.currentTimeMillis() - currentTime)); |
J |
687 |
|
a6a76f
|
688 |
// 商品编号信息 |
F |
689 |
MatCodeEntity matCodeEntity = matCodeIfc.getMatCode(skuMatCodeEntity!=null?skuMatCodeEntity.getMatCode():matCode, shopCcCodeEntity.getShopCcCode()); |
|
690 |
if (matCodeEntity == null) { |
|
691 |
errJson.addProperty("warning", "商品编号["+skuMatCodeEntity.getMatCode()+"]没启用!" ); |
|
692 |
json.add("error", errJson); |
|
693 |
this.printJson(response, json.toString()); |
|
694 |
return; |
|
695 |
} |
22907b
|
696 |
//System.out.println(getClass() + " 6 " + (System.currentTimeMillis() - currentTime)); |
a6a76f
|
697 |
JsonObject jsonObject = getJsonObjectByMatCodeDetail( matCodeEntity, request, settingEntity, dataSourceEntity.getDbId(), shopCcCodeEntity,skuParameterList,skuMatCodeEntity,matCode!=null&&!"".equals(matCode)?true:false); |
F |
698 |
//json.add("list", jsonObject); |
22907b
|
699 |
|
J |
700 |
//System.out.println(getClass() + " 7 " + (System.currentTimeMillis() - currentTime)); |
a6a76f
|
701 |
this.printJson(response, jsonObject.toString()); |
F |
702 |
return; |
|
703 |
} catch (DataAccessException e) { |
|
704 |
e.printStackTrace(); |
|
705 |
errJson.addProperty("warning", (e.getCause()!=null? e.getCause().getMessage():e.getMessage())); |
|
706 |
json.add("error", errJson); |
|
707 |
this.printJson(response, json.toString()); |
|
708 |
return; |
|
709 |
} catch (Exception e) { |
|
710 |
e.printStackTrace(); |
|
711 |
errJson.addProperty("warning", (e.getCause()!=null? e.getCause().getMessage():e.getMessage())); |
|
712 |
json.add("error", errJson); |
|
713 |
this.printJson(response, json.toString()); |
|
714 |
return; |
|
715 |
} finally { |
|
716 |
SpObserver.setDBtoInstance(); |
|
717 |
} |
|
718 |
|
|
719 |
} |
|
720 |
|
|
721 |
|
|
722 |
@RequestMapping("/shopping/getMatCode.do") |
|
723 |
public void getMatCode(HttpServletRequest request, HttpServletResponse response) { |
329b51
|
724 |
HttpSession session = request.getSession(); |
J |
725 |
String openId = (session.getAttribute(SessionKey.WEIXIN_OPENID)==null?"":(String)session.getAttribute(SessionKey.WEIXIN_OPENID)) ; |
a6a76f
|
726 |
SettingEntity settingEntity = null; |
F |
727 |
String matCode = (request.getParameter(SettingKey.MATCODE) == null ? "" |
|
728 |
: request.getParameter(SettingKey.MATCODE)); |
|
729 |
|
|
730 |
JsonObject json = new JsonObject(); |
|
731 |
JsonObject errJson = new JsonObject(); |
|
732 |
|
|
733 |
try { |
|
734 |
DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; |
|
735 |
SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());// 切换数据源 |
22907b
|
736 |
settingEntity = settingIfc.getSettingEntity(request); |
a6a76f
|
737 |
|
F |
738 |
// 取网店 shopcccode |
|
739 |
ShopCcCodeEntity shopCcCodeEntity = ShopCcCode.getShopCcCode(settingEntity,request); |
|
740 |
// 商品编号信息 |
|
741 |
MatCodeEntity matCodeEntity = matCodeIfc.getMatCode(matCode, shopCcCodeEntity.getShopCcCode()); |
|
742 |
if (matCodeEntity == null) { |
|
743 |
errJson.addProperty("warning", "商品编号【" + matCode + "】不存在"); |
|
744 |
json.add("error", errJson); |
|
745 |
this.printJson(response, json.toString()); |
|
746 |
return; |
|
747 |
} |
a8a784
|
748 |
List<SkuParameterEntity> skuParameterList = null; |
J |
749 |
SkuMatCodeEntity skuMatCodeEntity = null; |
|
750 |
if (matCodeEntity.isStartupSkuParameters()) { |
|
751 |
skuParameterList = matCodeIfc.getSkuParameter(matCodeEntity.getMatCode(),shopCcCodeEntity.getShopCcCode(), |
a6a76f
|
752 |
null,null,null,null,null,null,null,null,null,null); |
a8a784
|
753 |
skuMatCodeEntity = matCodeIfc.getSkuMatCodeByMatCode( matCodeEntity.getMatCode(),openId); |
J |
754 |
} |
a6a76f
|
755 |
json = getJsonObjectByMatCodeDetail( matCodeEntity, request, settingEntity, dataSourceEntity.getDbId(), shopCcCodeEntity,skuParameterList,skuMatCodeEntity,false); |
F |
756 |
//json.add("list", jsonObject); |
|
757 |
this.printJson(response, json.toString()); |
|
758 |
return; |
|
759 |
|
|
760 |
} catch (DataAccessException e) { |
|
761 |
e.printStackTrace(); |
|
762 |
errJson.addProperty("warning", (e.getCause()!=null? e.getCause().getMessage():e.getMessage())); |
|
763 |
json.add("error", errJson); |
|
764 |
this.printJson(response, json.toString()); |
|
765 |
return; |
|
766 |
} catch (Exception e) { |
|
767 |
e.printStackTrace(); |
|
768 |
errJson.addProperty("warning", (e.getCause()!=null? e.getCause().getMessage():e.getMessage())); |
|
769 |
json.add("error", errJson); |
|
770 |
this.printJson(response, json.toString()); |
|
771 |
return; |
|
772 |
} finally { |
|
773 |
SpObserver.setDBtoInstance(); |
|
774 |
} |
|
775 |
} |
|
776 |
|
|
777 |
public JsonObject getJsonObjectByMatCodeDetail(MatCodeEntity matCodeEntity,HttpServletRequest request,SettingEntity settingEntity,int dbId, |
|
778 |
ShopCcCodeEntity shopCcCodeEntity,List<SkuParameterEntity> skuParameterList,SkuMatCodeEntity skuMatCodeEntity,boolean isSearchingBySkuId) throws Exception{ |
|
779 |
HttpSession session = request.getSession(); |
22907b
|
780 |
// String userCode = (session.getAttribute(SessionKey.USERCODE) == null ? "" |
J |
781 |
// : (String) session.getAttribute(SessionKey.USERCODE)); |
a6a76f
|
782 |
|
F |
783 |
String wxQueryString = SettingKey.getQueryStringByWx(request); |
|
784 |
boolean isMoblieBrowser = SettingKey.isMoblieBrowser(request); |
|
785 |
String hostUrl = SettingKey.getHostUrl(request); |
5b4901
|
786 |
String hostUrlForImage = SettingKey.getHostUrlForImage(request); |
a6a76f
|
787 |
|
F |
788 |
String openId = (session.getAttribute(SessionKey.WEIXIN_OPENID)==null?"":(String)session.getAttribute(SessionKey.WEIXIN_OPENID)) ; |
|
789 |
String wx = (session.getAttribute(SessionKey.WEIXIN_FROM)==null?"":(String)session.getAttribute(SessionKey.WEIXIN_FROM)) ; |
|
790 |
|
|
791 |
String depositDocCode = request.getParameter("DepositDocCode") ; |
|
792 |
String depositRowId = request.getParameter("DepositRowId") ; |
|
793 |
|
|
794 |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
795 |
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
796 |
//CurrencyIfc currencyIfc = (CurrencyIfc)FactoryBean.getBean("CurrencyImpl"); |
22907b
|
797 |
CurrencyEntity currencyEntity = new CurrencyEntity(request); |
a6a76f
|
798 |
|
F |
799 |
JsonObject json = new JsonObject(); |
|
800 |
JsonObject jsonObject = new JsonObject(); |
|
801 |
//获取 sku 参数,用于“加入购物车” 或“立即购买” 时弹出选择,Added by Johns Wang,2021-01-30 |
|
802 |
JsonArray skuParameterJsonArray = new JsonArray(); |
|
803 |
//List<SkuParameterEntity> skuParameterList = matCodeIfc.getSkuParameter(matCodeEntity.getMatCode(),shopCcCodeEntity.getShopCcCode(),false, |
|
804 |
// null,null,null,null,null,null,null,null,null,null); |
|
805 |
// 根据skuSetId去重,并按 SkuSetSort 排序输出 |
a8a784
|
806 |
if (skuParameterList!=null&&skuParameterList.size()>0) { |
J |
807 |
List<SkuParameterEntity> skuSetList = skuParameterList.stream().collect( |
|
808 |
Collectors.collectingAndThen( |
|
809 |
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(SkuParameterEntity::getSkuSetId))), ArrayList::new) |
|
810 |
); |
|
811 |
for (int i = 0; skuSetList!=null && i < skuSetList.size(); i++) { |
|
812 |
JsonObject skuSetEntityJsonObject = new JsonObject(); |
|
813 |
Integer skuSetId = skuSetList.get(i).getSkuSetId(); |
|
814 |
skuSetEntityJsonObject.addProperty("skuSetSort", skuSetList.get(i).getSkuSetSort()); |
|
815 |
skuSetEntityJsonObject.addProperty("skuSetId", skuSetId); |
|
816 |
skuSetEntityJsonObject.addProperty("skuSetName", skuSetList.get(i).getSkuSetName()); |
|
817 |
List<SkuParameterEntity> skuList = skuParameterList.stream().filter(s->s.getSkuSetId().intValue()==skuSetId.intValue()) .collect(Collectors.toList()); |
|
818 |
JsonArray skuListJsonArray = new JsonArray(); |
|
819 |
for (int j = 0; skuList!=null&& j < skuList.size(); j++) { |
|
820 |
JsonObject skuEntityJsonObject = new JsonObject(); |
|
821 |
//skuEntityJsonObject.addProperty("skuSetId", skuList.get(j).getSkuSetId()); |
|
822 |
skuEntityJsonObject.addProperty("skuSort", skuList.get(j).getSkuSort()); |
|
823 |
skuEntityJsonObject.addProperty("skuId", skuList.get(j).getSkuId()); |
|
824 |
skuEntityJsonObject.addProperty("skuName", skuList.get(j).getSkuName()); |
|
825 |
skuEntityJsonObject.addProperty("isEnableSelection", skuList.get(j).isEnableSelection()); |
|
826 |
skuListJsonArray.add(skuEntityJsonObject); |
|
827 |
} |
|
828 |
skuSetEntityJsonObject.add("skuList", skuListJsonArray); |
|
829 |
skuParameterJsonArray.add(skuSetEntityJsonObject); |
a6a76f
|
830 |
} |
F |
831 |
} |
|
832 |
json.add("SkuParameterList", skuParameterJsonArray); |
|
833 |
|
|
834 |
//SkuMatCodeEntity skuMatCodeEntity = matCodeIfc.getSkuMatCodeByMatCode( matCodeEntity.getMatCode()); |
|
835 |
JsonArray skuMatCodeJsonArray = new JsonArray(); |
|
836 |
if (skuMatCodeEntity != null) { |
|
837 |
JsonObject skuEntityJsonObject = new JsonObject(); |
|
838 |
skuEntityJsonObject.addProperty("skuId1", skuMatCodeEntity.getSkuId1()); |
|
839 |
skuEntityJsonObject.addProperty("skuName1", skuMatCodeEntity.getSkuName1()); |
|
840 |
skuEntityJsonObject.addProperty("skuId2", skuMatCodeEntity.getSkuId2()); |
|
841 |
skuEntityJsonObject.addProperty("skuName2", skuMatCodeEntity.getSkuName2()); |
|
842 |
skuEntityJsonObject.addProperty("skuId3", skuMatCodeEntity.getSkuId3()); |
|
843 |
skuEntityJsonObject.addProperty("skuName3", skuMatCodeEntity.getSkuName3()); |
|
844 |
skuEntityJsonObject.addProperty("skuId4", skuMatCodeEntity.getSkuId4()); |
|
845 |
skuEntityJsonObject.addProperty("skuName4", skuMatCodeEntity.getSkuName4()); |
|
846 |
skuEntityJsonObject.addProperty("skuId5", skuMatCodeEntity.getSkuId5()); |
|
847 |
skuEntityJsonObject.addProperty("skuName5", skuMatCodeEntity.getSkuName5()); |
|
848 |
skuEntityJsonObject.addProperty("skuId6", skuMatCodeEntity.getSkuId6()); |
|
849 |
skuEntityJsonObject.addProperty("skuName6", skuMatCodeEntity.getSkuName6()); |
|
850 |
skuEntityJsonObject.addProperty("skuId7", skuMatCodeEntity.getSkuId7()); |
|
851 |
skuEntityJsonObject.addProperty("skuName7", skuMatCodeEntity.getSkuName7()); |
|
852 |
skuEntityJsonObject.addProperty("skuId8", skuMatCodeEntity.getSkuId8()); |
|
853 |
skuEntityJsonObject.addProperty("skuName8", skuMatCodeEntity.getSkuName8()); |
|
854 |
skuEntityJsonObject.addProperty("skuId9", skuMatCodeEntity.getSkuId9()); |
|
855 |
skuEntityJsonObject.addProperty("skuName9", skuMatCodeEntity.getSkuName9()); |
|
856 |
skuEntityJsonObject.addProperty("skuId10", skuMatCodeEntity.getSkuId10()); |
|
857 |
skuEntityJsonObject.addProperty("skuName10", skuMatCodeEntity.getSkuName10()); |
|
858 |
skuEntityJsonObject.addProperty("MatCode", skuMatCodeEntity.getMatCode()); |
|
859 |
skuEntityJsonObject.addProperty("MatName", skuMatCodeEntity.getMatName()); |
|
860 |
skuEntityJsonObject.addProperty("Special", skuMatCodeEntity.getSpecial()); |
5b4901
|
861 |
skuEntityJsonObject.addProperty("PhotoPath",SettingKey.getUrl(hostUrlForImage, skuMatCodeEntity.getPhotoPathUrl(), dbId+"",null)); |
J |
862 |
skuEntityJsonObject.addProperty("PhotoPathUrl",SettingKey.getUrl(hostUrlForImage, skuMatCodeEntity.getPhotoPathUrl(), dbId+"",null)); |
329b51
|
863 |
skuEntityJsonObject.addProperty("cartId", skuMatCodeEntity.getCartId()); |
J |
864 |
skuEntityJsonObject.addProperty("cartQuantity", skuMatCodeEntity.getCartQuantity()); |
a6a76f
|
865 |
skuMatCodeJsonArray.add(skuEntityJsonObject); |
F |
866 |
} |
|
867 |
json.add("SkuMatCodeList", skuMatCodeJsonArray); |
|
868 |
if (isSearchingBySkuId) { //如果是 正在使用 skuId 搜索商品,则立即返回 |
|
869 |
json.add("list", jsonObject); |
|
870 |
return json; |
|
871 |
} |
|
872 |
|
|
873 |
|
|
874 |
|
|
875 |
// 商品评价条数 |
|
876 |
Integer matReviewCount = 0; |
|
877 |
if (matCodeEntity != null) { |
|
878 |
matReviewCount = matCodeEntity.getRatingCount(); |
|
879 |
} |
|
880 |
|
|
881 |
// 货币 |
|
882 |
// String currencyProd = settingEntity.getCurrency(); |
22907b
|
883 |
// CurrencyEntity currencyEntity = new CurrencyEntity(request); |
a6a76f
|
884 |
|
F |
885 |
// 消费积份 |
|
886 |
Integer points = matPointsIfc.getMatPoints(matCodeEntity.getMatCode(), null); |
|
887 |
|
|
888 |
// 商品促销活动关联表 |
|
889 |
List<MatDiscountEntity> matDisList = matDiscountIfc.getMatDiscount(matCodeEntity.getMatCode(), null); |
|
890 |
|
|
891 |
// 取处理过的商品描述 |
|
892 |
request.setAttribute(SettingKey.FROMOPENID, openId); |
|
893 |
String matDmatDescription = imgData.getDescriptionByNewImgLink(matCodeEntity.getDescription(), request); |
|
894 |
|
|
895 |
// 购物车 |
|
896 |
// cartList = cartIfc.getCarts(userCode, sessionId,openId,cltCode); |
|
897 |
|
|
898 |
// 关注商品资料 |
|
899 |
// matCodeList = |
|
900 |
// matCodeIfc.getMatCodesByWishList(userCode,sessionId,openId,cltCode,shopCcCode); |
|
901 |
// List<MatCodeEntity> matCodeCompareList = |
|
902 |
// matCodeIfc.getMatCodesByCompare(userCode,sessionId,openId,cltCode,shopCcCode); |
|
903 |
|
|
904 |
// 显示分享信息 |
|
905 |
// ShareEntity shareEntity=shareIfc.getShareEntity(); |
|
906 |
|
|
907 |
// 是否有选项要显示 |
|
908 |
boolean hasMatAttr = matAttrIfc.hasMatAttr(matCodeEntity.getMatCode()); |
|
909 |
|
|
910 |
|
|
911 |
|
|
912 |
String url = "",externalURL = ""; |
|
913 |
if (matCodeEntity.getExternalURL() != null && !"".equals(matCodeEntity.getExternalURL())) { |
|
914 |
externalURL = matCodeEntity.getExternalURL(); |
|
915 |
if (!externalURL.startsWith("http")) externalURL = hostUrl + externalURL ; |
|
916 |
String separator = "?" ; |
|
917 |
int pos = externalURL.indexOf("?") ; |
|
918 |
if (pos > 0) separator = "&"; |
|
919 |
externalURL = externalURL + (wxQueryString == null || "".equals(wxQueryString) ? "" : separator + wxQueryString); |
|
920 |
} else { |
|
921 |
url = hostUrl + SettingKey.getMatCodeUrl("", matCodeEntity.getMatCode(), isMoblieBrowser) |
|
922 |
+ (wxQueryString == null || "".equals(wxQueryString) ? "" : "&" + wxQueryString); |
|
923 |
} |
|
924 |
|
|
925 |
jsonObject.addProperty("ExternalUrl", externalURL); |
|
926 |
//jsonObject.addProperty("url", url); |
|
927 |
jsonObject.addProperty("MatCodeUrl", url); |
|
928 |
//主图片 |
5b4901
|
929 |
jsonObject.addProperty("PhotoPath",SettingKey.getUrl(hostUrlForImage, matCodeEntity.getPhotoPathUrl(), dbId+"",null)); |
J |
930 |
jsonObject.addProperty("PhotoPathUrl",SettingKey.getUrl(hostUrlForImage, matCodeEntity.getPhotoPathUrl(), dbId+"",null)); |
b3acab
|
931 |
/* imgData.getImageUrl(matCodeEntity.getPhotoPath(), settingEntity.getImageProductWidth(), |
a6a76f
|
932 |
settingEntity.getImageProductHeight(), settingEntity.isShowProductOrgImage(), |
F |
933 |
settingEntity.isFromCached(), request) |
|
934 |
//+ (wxQueryString == null || "".equals(wxQueryString) ? "" : "?" + wxQueryString) |
b3acab
|
935 |
);*/ |
a6a76f
|
936 |
|
F |
937 |
// 主图片与多图片合并 |
|
938 |
JsonArray subImageListArray = new JsonArray(); |
|
939 |
/*if (matCodeEntity.getPhotoPath() != null && !matCodeEntity.getPhotoPath().equals("")) { |
|
940 |
subImageListArray.add(imgData.getImageUrl(matCodeEntity.getPhotoPath(), settingEntity.getImageProductWidth(), |
|
941 |
settingEntity.getImageProductHeight(), settingEntity.isShowProductOrgImage(), |
|
942 |
settingEntity.isFromCached(), request) |
|
943 |
//+ (wxQueryString == null || "".equals(wxQueryString) ? "" : "?" + wxQueryString) |
|
944 |
); |
|
945 |
}*/ |
|
946 |
if (matCodeEntity.getPhotoPathUrl() != null && !matCodeEntity.getPhotoPathUrl().equals("")) { |
5b4901
|
947 |
subImageListArray.add(SettingKey.getUrl(hostUrlForImage, matCodeEntity.getPhotoPathUrl(), dbId+"",null) ); |
a6a76f
|
948 |
//imgData.getImageUrl(matCodeEntity.getPhotoPath(), settingEntity.getImageProductWidth(), |
F |
949 |
//settingEntity.getImageProductHeight(), settingEntity.isShowProductOrgImage(), |
|
950 |
//settingEntity.isFromCached(), request) |
|
951 |
//+ (wxQueryString == null || "".equals(wxQueryString) ? "" : "?" + wxQueryString) |
|
952 |
//); |
|
953 |
} |
|
954 |
//主图片与多图片合并 |
|
955 |
/* |
|
956 |
for (int k = 0; matImageList != null && k < matImageList.size(); k++) { |
|
957 |
MatCodeImageEntity matImage = matImageList.get(k); |
|
958 |
subImageListArray.add(imgData.getImageUrl(matImage.getImage(), settingEntity.getImagePopupWidth(), |
|
959 |
settingEntity.getImagePopupHeight(), settingEntity.isShowPopupOrgImage(), |
|
960 |
settingEntity.isFromCached(), request) |
|
961 |
//+ (wxQueryString == null || "".equals(wxQueryString) ? "" : "?" + wxQueryString) |
|
962 |
); |
|
963 |
}*/ |
|
964 |
// 主图片与多图片合并 |
|
965 |
if (matCodeEntity.getImagesUrl()!=null && !matCodeEntity.getImagesUrl().equals("")) { |
|
966 |
String images[] = matCodeEntity.getImagesUrl().split(";") ; |
|
967 |
for (int j = 0; j < images.length; j++) { |
5b4901
|
968 |
subImageListArray.add(SettingKey.getUrl(hostUrlForImage, images[j], dbId+"",null) ); |
a6a76f
|
969 |
} |
F |
970 |
} |
|
971 |
|
|
972 |
|
|
973 |
jsonObject.add("images", subImageListArray); |
|
974 |
String cltCode = (String) session.getAttribute(SettingKey.CLTCODE) ; |
|
975 |
|
|
976 |
//是否显示评价 |
|
977 |
jsonObject.addProperty("isShowReviewStatus", settingEntity.getReviewStatus()); |
|
978 |
// 商品评价 |
|
979 |
if (settingEntity.getReviewStatus()) { |
|
980 |
|
|
981 |
} |
|
982 |
|
|
983 |
if (settingEntity.isShowBrand()) { |
|
984 |
jsonObject.addProperty("Brand", matCodeEntity.getBrand()); |
|
985 |
} |
|
986 |
|
|
987 |
if (settingEntity.isShowMatName()) { |
|
988 |
jsonObject.addProperty("MatName", matCodeEntity.getMatName()); |
|
989 |
} |
|
990 |
|
|
991 |
jsonObject.addProperty("MatCode", matCodeEntity.getMatCode()); |
|
992 |
jsonObject.addProperty("isShowMatCode", settingEntity.isShowMatCode()); |
|
993 |
jsonObject.addProperty("isShowMatName", settingEntity.isShowMatName()); |
|
994 |
jsonObject.addProperty("isShowSpecial", settingEntity.isShowSpecial()); |
|
995 |
jsonObject.addProperty("isShowPrice", settingEntity.isShowPrice()); |
|
996 |
jsonObject.addProperty("isShowPoints", settingEntity.isShowPoints()); |
|
997 |
jsonObject.addProperty("isShowBrand", settingEntity.isShowBrand()); |
|
998 |
jsonObject.addProperty("StockDisplay", settingEntity.getStockDisplay()); |
|
999 |
|
|
1000 |
jsonObject.addProperty("isStartupMatName2", settingEntity.isStartupMatName2()); |
|
1001 |
jsonObject.addProperty("isStartupMatName3", settingEntity.isStartupMatName3()); |
|
1002 |
jsonObject.addProperty("isStartupMatName4", settingEntity.isStartupMatName4()); |
|
1003 |
|
|
1004 |
jsonObject.addProperty("ShopMatCode", matCodeEntity.getShopMatCode()); |
|
1005 |
if (settingEntity.isShowSpecial()) { |
|
1006 |
jsonObject.addProperty("Special", matCodeEntity.getSpecial()); |
|
1007 |
} |
|
1008 |
|
|
1009 |
if (settingEntity.isStartupMatName2()) { |
|
1010 |
jsonObject.addProperty("MatName2Label", settingEntity.getMatName2Label()); |
|
1011 |
jsonObject.addProperty("MatName2", matCodeEntity.getMatName2()); |
|
1012 |
} |
|
1013 |
|
|
1014 |
if (settingEntity.isStartupMatName3()) { |
|
1015 |
jsonObject.addProperty("MatName3Label", settingEntity.getMatName3Label()); |
|
1016 |
jsonObject.addProperty("MatName3", matCodeEntity.getMatName3()); |
|
1017 |
} |
|
1018 |
|
|
1019 |
if (settingEntity.isStartupMatName4()) { |
|
1020 |
jsonObject.addProperty("MatName4Label", settingEntity.getMatName4Label()); |
|
1021 |
jsonObject.addProperty("MatName4", matCodeEntity.getMatName4()); |
|
1022 |
} |
|
1023 |
|
|
1024 |
if (settingEntity.isShowPoints()) { |
|
1025 |
jsonObject.addProperty("Points", matCodeEntity.getPoints() ); // 奖励积分 |
|
1026 |
jsonObject.addProperty("SalesPoints", points + ""); // 消费积分 |
|
1027 |
} |
|
1028 |
|
|
1029 |
if (matCodeEntity.getStockStatusName() != null && !"".equals(matCodeEntity.getStockStatusName())) { |
|
1030 |
jsonObject.addProperty("StockStatusName", matCodeEntity.getStockStatusName()); |
|
1031 |
} |
|
1032 |
|
|
1033 |
if (settingEntity.isShowPrice()) { |
|
1034 |
|
|
1035 |
//MatPriceEntity matPriceEntity = matPriceIfc.getMatPrice(matCodeEntity.getMatCode(), cltCode, null); |
|
1036 |
Double price = matCodeEntity.getPrice(); // matPriceEntity.getPrice(); |
|
1037 |
if (price!=null) { |
|
1038 |
jsonObject.addProperty("Price", price ); // 实际价格,此价格可能低于“标价” |
|
1039 |
jsonObject.addProperty("SalesPrice", matCodeEntity.getSalesPrice() ); // 标价 |
|
1040 |
jsonObject.addProperty("Currency", currencyEntity.getCurrency()); |
|
1041 |
jsonObject.addProperty("CurrencySign", currencyEntity.getCurrencySign()); |
|
1042 |
} |
|
1043 |
} |
|
1044 |
|
|
1045 |
JsonArray matDisListJsonArray = new JsonArray(); |
|
1046 |
// 商品促销活动关联表 |
|
1047 |
for (int i = 0; matDisList != null && i < matDisList.size(); i++) { |
|
1048 |
JsonObject subJsonObject = new JsonObject(); |
|
1049 |
subJsonObject.addProperty("digit", matDisList.get(i).getDigit() ); |
|
1050 |
if (matDisList.get(i).getPrice()!=null) { |
|
1051 |
subJsonObject.addProperty("price", matDisList.get(i).getPrice() ); |
|
1052 |
} |
|
1053 |
matDisListJsonArray.add(subJsonObject); |
|
1054 |
} |
|
1055 |
|
|
1056 |
jsonObject.add("matdiscount", matDisListJsonArray); |
|
1057 |
|
|
1058 |
// 获取商品选项(如:数量,日期。。。) |
|
1059 |
// matComponentIfc.getMatComponent(matCodeEntity, matCode, |
|
1060 |
// currencyEntityProd.getMemo(),isMoblieBrowser,false) ; |
|
1061 |
|
|
1062 |
// 评星级分 |
|
1063 |
if (settingEntity.isShowRatingOnHomePage()) { |
|
1064 |
jsonObject.addProperty("RatingAvg", matCodeEntity.getRatingAvg() + ""); |
|
1065 |
} |
|
1066 |
|
|
1067 |
// 评价条数 |
|
1068 |
if (settingEntity.getReviewStatus()) { |
|
1069 |
jsonObject.addProperty("ReviewCount", (matReviewCount == null ? 0 : matReviewCount) + ""); |
|
1070 |
} |
|
1071 |
//销售单位 |
|
1072 |
jsonObject.addProperty("Uom", matCodeEntity.getSalesUOM()); |
|
1073 |
// 商品描述 |
|
1074 |
jsonObject.addProperty("Description", matDmatDescription); |
|
1075 |
//是否显示属性 |
|
1076 |
jsonObject.addProperty("isShowMatAttr", hasMatAttr); |
|
1077 |
//最小起订数量 |
|
1078 |
jsonObject.addProperty("Mininum", matCodeEntity.getMininum()); |
|
1079 |
|
|
1080 |
//是否限量销售 |
419647
|
1081 |
jsonObject.addProperty("isRestrictQuantity", matCodeEntity.getIsRestrictQuantity()); |
J |
1082 |
Double quantity = matCodeEntity.getQuantity(); |
|
1083 |
if (matCodeEntity.getIsRestrictQuantity()==2) { |
|
1084 |
quantity = matCodeEntity.getStockDigitForShoppingSaleable(); |
|
1085 |
} |
|
1086 |
//销售数量限量 |
|
1087 |
jsonObject.addProperty("Quantity",quantity); //小程序页面前端用于控制加入购物车是否置灰 |
|
1088 |
//可用库存限量 |
|
1089 |
jsonObject.addProperty("StockDigitForShoppingSaleable", matCodeEntity.getStockDigitForShoppingSaleable()); |
a6a76f
|
1090 |
//同一ID购买限量 |
F |
1091 |
jsonObject.addProperty("RestrictBuyingQuantity", matCodeEntity.getRestrictBuyingQuantity()); |
|
1092 |
//是否启用秒杀 |
|
1093 |
jsonObject.addProperty("isStartupPanicBuying", matCodeEntity.isStartupPanicBuying()); |
|
1094 |
//秒杀开始时间 |
|
1095 |
jsonObject.addProperty("PanicBuyingStartTime", matCodeEntity.getPanicBuyingStartTime()!= null?sdf2.format(matCodeEntity.getPanicBuyingStartTime()):""); |
|
1096 |
//秒杀结束时间 |
|
1097 |
jsonObject.addProperty("PanicBuyingEndTime", matCodeEntity.getPanicBuyingEndTime()!= null?sdf2.format(matCodeEntity.getPanicBuyingEndTime()):""); |
|
1098 |
//秒杀开始剩余秒数 |
|
1099 |
jsonObject.addProperty("PanicBuyingStartTimeBalance", matCodeEntity.getPanicBuyingStartTimeBalance()== null||matCodeEntity.getPanicBuyingStartTimeBalance().longValue()<0L?0:matCodeEntity.getPanicBuyingStartTimeBalance()); |
|
1100 |
//秒杀结束剩余秒数 |
|
1101 |
jsonObject.addProperty("PanicBuyingEndTimeBalance", matCodeEntity.getPanicBuyingEndTimeBalance()== null||matCodeEntity.getPanicBuyingEndTimeBalance().longValue()<0L?0:matCodeEntity.getPanicBuyingEndTimeBalance()); |
|
1102 |
|
|
1103 |
//是否启用团购 |
|
1104 |
jsonObject.addProperty("isStartupGroupBuying", matCodeEntity.isStartupGroupBuying()); |
|
1105 |
//成团人数 |
|
1106 |
jsonObject.addProperty("GroupBuyingMembers", matCodeEntity.getGroupBuyingMembers()); |
|
1107 |
//团购价格 |
|
1108 |
jsonObject.addProperty("GroupBuyingPrice", matCodeEntity.getGroupBuyingPrice()); |
|
1109 |
//团购开始时间 |
|
1110 |
jsonObject.addProperty("GroupBuyingStartTime", matCodeEntity.getGroupBuyingStartTime()!= null?sdf2.format(matCodeEntity.getGroupBuyingStartTime()):""); |
|
1111 |
//团购结束时间 |
|
1112 |
jsonObject.addProperty("GroupBuyingEndTime", matCodeEntity.getGroupBuyingEndTime()!= null?sdf2.format(matCodeEntity.getGroupBuyingEndTime()):""); |
|
1113 |
//团购开始剩余秒数 |
|
1114 |
jsonObject.addProperty("GroupBuyingStartTimeBalance", matCodeEntity.getGroupBuyingStartTimeBalance()== null||matCodeEntity.getGroupBuyingStartTimeBalance().longValue()<0L?0:matCodeEntity.getGroupBuyingStartTimeBalance()); |
|
1115 |
//团购结束剩余秒数 |
|
1116 |
jsonObject.addProperty("GroupBuyingEndTimeBalance", matCodeEntity.getGroupBuyingEndTimeBalance()== null||matCodeEntity.getGroupBuyingEndTimeBalance().longValue()<0L?0:matCodeEntity.getGroupBuyingEndTimeBalance()); |
|
1117 |
//团购失败原路退款 |
|
1118 |
jsonObject.addProperty("isGroupBuyingFailedToBacktrack", matCodeEntity.isGroupBuyingFailedToBacktrack()); |
|
1119 |
|
|
1120 |
|
|
1121 |
jsonObject.addProperty("PreSendMinutes", matCodeEntity.getPreSendMinutes()); //多少分钟交货 |
|
1122 |
jsonObject.addProperty("PreSendMinutesDesc", matCodeEntity.getPreSendMinutesDesc()); //多少分钟交货描述 |
|
1123 |
|
|
1124 |
//商品属性 |
|
1125 |
JsonArray matAttrGroupJsonArray = new JsonArray(); |
|
1126 |
if (hasMatAttr) { |
|
1127 |
List<MatAttrGroupEntity> matAttrGroupList = matAttrIfc.getMatAttrGroupByMatCode(matCodeEntity.getMatCode()); |
|
1128 |
for (int j = 0;matAttrGroupList != null && j < matAttrGroupList.size();j++ ) { |
|
1129 |
MatAttrGroupEntity matAttrGroupEntity = matAttrGroupList.get(j) ; |
|
1130 |
JsonObject matAttrGroupJsonObject = new JsonObject(); |
|
1131 |
matAttrGroupJsonObject.addProperty("AttrGroupName", matAttrGroupEntity.getAttrGroupName()); |
|
1132 |
|
|
1133 |
JsonArray matAttrJsonArray = new JsonArray(); |
|
1134 |
List<MatAttrEntity> matAttrList = matAttrIfc.getMatAttr(matCodeEntity.getMatCode(),matAttrGroupEntity.getAttrGroupId()); |
|
1135 |
for (int i = 0; matAttrList != null && i < matAttrList.size(); i++) { |
|
1136 |
MatAttrEntity matAttr = matAttrList.get(i); |
|
1137 |
JsonObject matAttrJsonObject = new JsonObject(); |
|
1138 |
matAttrJsonObject.addProperty("AttrName", matAttr.getAttrName()); |
|
1139 |
matAttrJsonObject.addProperty("Text", matAttr.getText()); |
|
1140 |
|
|
1141 |
matAttrJsonArray.add(matAttrJsonObject); |
|
1142 |
} |
|
1143 |
matAttrGroupJsonObject.add("Attrs", matAttrJsonArray); |
|
1144 |
matAttrGroupJsonArray.add(matAttrGroupJsonObject); |
|
1145 |
} |
|
1146 |
|
|
1147 |
} |
|
1148 |
jsonObject.add("matattr", matAttrGroupJsonArray); |
|
1149 |
// 相关商品资料集合 调用也可实现,只是要多发一次请求: |
|
1150 |
// http://mp.onbus.cn/shopping/getMatCodeList.do?matcode=xxx&fromdata=3 |
|
1151 |
// 获取相关商品资料集合 |
abc52b
|
1152 |
List<MatCodeEntity> matRelList = matCodeIfc.getMatCodesByRelMat(matCodeEntity.getMatCode(), shopCcCodeEntity.getShopCcCode(),cltCode,openId); |
a6a76f
|
1153 |
JsonArray relMatJsonArray = new JsonArray(); |
F |
1154 |
for (int i = 0; matRelList != null && i < matRelList.size(); i++) { |
|
1155 |
MatCodeEntity relMatCodeEntity = matRelList.get(i); |
|
1156 |
JsonObject subJsonObject = new JsonObject(); |
|
1157 |
String relMatCodeUrl = ""; |
|
1158 |
if (relMatCodeEntity.getExternalURL() != null && !"".equals(relMatCodeEntity.getExternalURL())) { |
|
1159 |
relMatCodeUrl = relMatCodeEntity.getExternalURL(); |
|
1160 |
} else { |
|
1161 |
relMatCodeUrl = hostUrl |
|
1162 |
+ SettingKey.getMatCodeUrl("", relMatCodeEntity.getMatCode(), isMoblieBrowser) |
|
1163 |
+ (wxQueryString == null || "".equals(wxQueryString) ? "" : "&" + wxQueryString); |
|
1164 |
} |
|
1165 |
subJsonObject.addProperty("url", relMatCodeUrl); |
5b4901
|
1166 |
subJsonObject.addProperty("PhotoPath",SettingKey.getUrl(hostUrlForImage, relMatCodeEntity.getPhotoPathUrl(), dbId+"",null)); |
J |
1167 |
subJsonObject.addProperty("PhotoPathUrl",SettingKey.getUrl(hostUrlForImage, relMatCodeEntity.getPhotoPathUrl(), dbId+"",null)); |
|
1168 |
// subJsonObject.addProperty("PhotoPath", |
|
1169 |
// imgData.getImageUrl(relMatCodeEntity.getPhotoPath(), settingEntity.getImageProductWidth(), |
|
1170 |
// settingEntity.getImageProductHeight(), settingEntity.isShowProductOrgImage(), |
|
1171 |
// settingEntity.isFromCached(), request) |
|
1172 |
// // + (wxQueryString == null || "".equals(wxQueryString) ? "" : "?" + wxQueryString) |
|
1173 |
// ); |
a6a76f
|
1174 |
|
F |
1175 |
subJsonObject.addProperty("MatCode", relMatCodeEntity.getMatCode()); |
|
1176 |
subJsonObject.addProperty("isShowMatCode", settingEntity.isShowMatCode()); |
|
1177 |
subJsonObject.addProperty("isShowMatName", settingEntity.isShowMatName()); |
|
1178 |
subJsonObject.addProperty("isShowSpecial", settingEntity.isShowSpecial()); |
|
1179 |
subJsonObject.addProperty("isShowPrice", settingEntity.isShowPrice()); |
|
1180 |
subJsonObject.addProperty("isShowPoints", settingEntity.isShowPoints()); |
|
1181 |
subJsonObject.addProperty("isShowBrand", settingEntity.isShowBrand()); |
|
1182 |
subJsonObject.addProperty("StockDisplay", settingEntity.getStockDisplay()); |
|
1183 |
|
|
1184 |
if (settingEntity.isShowMatName()) { |
|
1185 |
subJsonObject.addProperty("MatName", relMatCodeEntity.getMatName()); |
|
1186 |
} |
|
1187 |
if (settingEntity.isShowDescription()) { |
|
1188 |
subJsonObject.addProperty("Description", HtmlUtil.getShortDescription( |
|
1189 |
settingEntity.getProductDescriptionLength(), relMatCodeEntity.getDescription())); |
|
1190 |
} |
|
1191 |
if (settingEntity.isShowRatingOnHomePage()) { |
|
1192 |
subJsonObject.addProperty("RatingAvg", matCodeEntity.getRatingAvg() + ""); |
|
1193 |
} |
|
1194 |
if (settingEntity.isShowPrice()) { |
|
1195 |
|
|
1196 |
//MatPriceEntity matPriceEntity = matPriceIfc.getMatPrice(relMatCodeEntity.getMatCode(), cltCode, null); |
|
1197 |
Double price = relMatCodeEntity.getPrice(); // matPriceEntity.getPrice(); |
|
1198 |
if (price!=null) { |
|
1199 |
subJsonObject.addProperty("Price", price ); // 实际价格,此价格可能低于“标价” |
|
1200 |
subJsonObject.addProperty("SalesPrice", relMatCodeEntity.getSalesPrice() ); // 标价 |
|
1201 |
|
|
1202 |
subJsonObject.addProperty("Currency", currencyEntity.getCurrency()); |
|
1203 |
subJsonObject.addProperty("CurrencySign", currencyEntity.getCurrencySign()); |
|
1204 |
} |
|
1205 |
} |
|
1206 |
relMatJsonArray.add(subJsonObject); |
|
1207 |
} |
|
1208 |
jsonObject.add("relmatcode", relMatJsonArray); |
|
1209 |
|
|
1210 |
//取 维护抢购订金分组 明细 |
|
1211 |
if (depositDocCode != null && !"".equals(depositDocCode) && depositRowId != null && !"".equals(depositRowId)) { |
|
1212 |
PrepaidDepositDetailEntity prepaidDepositDetailEntity = prepaidDepositIfc.getPrepaidDepositDetail(depositDocCode, depositRowId,cltCode); |
|
1213 |
jsonObject.addProperty("DepositAmount", prepaidDepositDetailEntity!=null?prepaidDepositDetailEntity.getDepositAmount():0); |
|
1214 |
jsonObject.addProperty("ItemMemo", prepaidDepositDetailEntity!=null?prepaidDepositDetailEntity.getItemMemo():""); |
|
1215 |
jsonObject.addProperty("DepositDescription", imgData.getImageUrl(prepaidDepositDetailEntity!=null?prepaidDepositDetailEntity.getDepositDescription():"", settingEntity.getImageProductWidth(), |
|
1216 |
settingEntity.getImageProductHeight(), settingEntity.isShowProductOrgImage(), |
|
1217 |
settingEntity.isFromCached(), request) |
|
1218 |
); |
|
1219 |
jsonObject.addProperty("isPaidDeposit", prepaidDepositDetailEntity.isPaidDeposit()); //抢购订金分组 里的 rowid ,功能号 710170 |
|
1220 |
} |
|
1221 |
|
|
1222 |
//未使用的优惠卷 |
|
1223 |
List<CouponEntity> couponList = couponIfc.getCouponList( cltCode,openId,matCodeEntity.getMatCode(),false,wx,shopCcCodeEntity.getShopCcCode()) ; |
|
1224 |
JsonArray couponListJsonArray = new JsonArray(); |
|
1225 |
for (int i = 0 ; couponList!= null && i < couponList.size();i++) { |
|
1226 |
CouponEntity couponEntity = couponList.get(i) ; |
|
1227 |
JsonObject couponEntityJsonObject = new JsonObject(); |
|
1228 |
couponEntityJsonObject.addProperty("CouponName",couponEntity.getCouponName()); //使用范围 |
|
1229 |
couponEntityJsonObject.addProperty("CouponDocCode", couponEntity.getCouponDocCode()); //优惠券单号 |
|
1230 |
couponEntityJsonObject.addProperty("CouponCode", couponEntity.getCouponCode()); //优惠券代码 |
|
1231 |
couponEntityJsonObject.addProperty("Type", couponEntity.getType()); //优惠劵类型: 1 折扣(%) , 2 固定金额 |
|
1232 |
couponEntityJsonObject.addProperty("Discount", couponEntity.getDiscount()); //优惠折扣(%) |
|
1233 |
couponEntityJsonObject.addProperty("SufficeAmount", couponEntity.getSufficeAmount()); //满多少金额可用 |
|
1234 |
couponEntityJsonObject.addProperty("Total", couponEntity.getTotal()); //优惠金额 |
|
1235 |
//couponStatus : //0 正常:可以抢 ; 1 已经抢完 ; 2 未开抢 ; 3 已经抢过了,不能重复抢 ; 4 已经提醒(微信模板消息提醒) |
|
1236 |
couponEntityJsonObject.addProperty("Status", couponEntity.getCouponStatus()); |
|
1237 |
couponEntityJsonObject.addProperty("UsesTotal",couponEntity.getUsesTotal()) ; //本优惠卷总张数 |
|
1238 |
couponEntityJsonObject.addProperty("UsedTimes",couponEntity.getUsedTimes()) ; //本优惠卷已抢的数量 |
|
1239 |
|
|
1240 |
couponEntityJsonObject.addProperty("BalanceSecond",couponEntity.getBalanceSecond()) ; //抢券开始时间余下的秒数,负数表示倒计时早已结束 |
|
1241 |
couponEntityJsonObject.addProperty("DateStart",couponEntity.getDateStart()==null?"":sdf2.format(couponEntity.getDateStart())) ; //抢券开始时间 |
|
1242 |
couponEntityJsonObject.addProperty("DateEnd",couponEntity.getDateEnd()==null?"":sdf2.format(couponEntity.getDateEnd())) ; //抢券结束时间 |
|
1243 |
|
|
1244 |
couponEntityJsonObject.addProperty("EffectiveDateStart",couponEntity.getEffectiveDateStart()==null?"":sdf.format(couponEntity.getEffectiveDateStart())) ; //有效使用开始期 |
|
1245 |
couponEntityJsonObject.addProperty("EffectiveDateEnd",couponEntity.getEffectiveDateEnd()==null?"":sdf.format(couponEntity.getEffectiveDateEnd())) ; //有效使用结束期 |
|
1246 |
couponEntityJsonObject.addProperty("Photo",imgData.getImageUrl(couponEntity.getPhoto(),120,120,settingEntity.isShowPopupOrgImage(),settingEntity.isFromCached(),request) ) ; |
|
1247 |
couponEntityJsonObject.addProperty("BannerImage",imgData.getImageUrl(couponEntity.getBannerImage(),settingEntity.getImageBannerWidth(),settingEntity.getImageBannerHeight(),settingEntity.isShowBannerOrgImage(),settingEntity.isFromCached(),request) ) ; |
|
1248 |
|
|
1249 |
//已抢% |
|
1250 |
int progressRate = (couponEntity.getUsesTotal()==0?0:couponEntity.getUsedTimes()*100 / couponEntity.getUsesTotal()); |
|
1251 |
couponEntityJsonObject.addProperty("ProgressRate",progressRate) ; //已抢进度% |
|
1252 |
couponListJsonArray.add(couponEntityJsonObject); |
|
1253 |
} |
|
1254 |
json.add("CouponList", couponListJsonArray); |
|
1255 |
|
|
1256 |
List<GroupBuyingEntity> groupBuyingList = orderIfc.getGroupBuyingOrderSummarry(matCodeEntity.getMatCode()) ; |
|
1257 |
JsonArray groupBuyingJsonArray = new JsonArray(); |
|
1258 |
for (int j = 0;groupBuyingList!=null&& j < groupBuyingList.size(); j++) { |
|
1259 |
GroupBuyingEntity groupBuyingEntity = groupBuyingList.get(j); |
|
1260 |
JsonObject groupBuyingJsonObject = new JsonObject(); |
|
1261 |
groupBuyingJsonObject.addProperty("GroupBuyingDocCode", groupBuyingEntity.getGroupBuyingDocCode()); //原团主单号,提交团购单时引用它 |
|
1262 |
groupBuyingJsonObject.addProperty("OpenId", groupBuyingEntity.getOpenId()); //原团主 openid |
|
1263 |
groupBuyingJsonObject.addProperty("NickName", groupBuyingEntity.getNickName()); //原团主 昵称 |
|
1264 |
groupBuyingJsonObject.addProperty("Headimgurl", groupBuyingEntity.getHeadimgurl()); //原团主 头像 |
|
1265 |
groupBuyingJsonObject.addProperty("WeiXinAvatarUnid", groupBuyingEntity.getWeiXinAvatarUnid()); //原团主头像 UNID |
|
1266 |
groupBuyingJsonObject.addProperty("GroupBuyingMembers", groupBuyingEntity.getGroupBuyingMembers()); //成团人数 |
|
1267 |
groupBuyingJsonObject.addProperty("GroupBuyingMembersBalance", groupBuyingEntity.getGroupBuyingMembersBalance()); //还差多少人成团 |
|
1268 |
groupBuyingJsonArray.add(groupBuyingJsonObject); |
|
1269 |
} |
|
1270 |
json.add("groupBuyingList", groupBuyingJsonArray); |
|
1271 |
|
|
1272 |
|
|
1273 |
json.add("list", jsonObject); |
|
1274 |
return json; |
|
1275 |
} |
|
1276 |
|
|
1277 |
} |