Authored by mali

Merge branch 'dev' into test6.10.2_favorite

@@ -35,7 +35,7 @@ public class WeixinPayConstants { @@ -35,7 +35,7 @@ public class WeixinPayConstants {
35 * 支付主体是殴印 35 * 支付主体是殴印
36 */ 36 */
37 public interface Miniapp{ 37 public interface Miniapp{
38 - String APP_PARTNER_CERT = "/.cert/wechatpay/apiclient_cert_ufo.p12"; 38 +// String APP_PARTNER_CERT = "/.cert/wechatpay/apiclient_cert_ufo.p12";
39 String APPID = "wxc677c88385762287"; 39 String APPID = "wxc677c88385762287";
40 String MALL_ID = UFO_PARTNER_ID; 40 String MALL_ID = UFO_PARTNER_ID;
41 } 41 }
@@ -2,7 +2,7 @@ package com.yohoufo.order.service.pay.weixin; @@ -2,7 +2,7 @@ package com.yohoufo.order.service.pay.weixin;
2 2
3 import com.yohoufo.order.config.WeixinPayConstants; 3 import com.yohoufo.order.config.WeixinPayConstants;
4 import com.yohoufo.order.service.pay.weixin.config.AbstractWeixinPayConfig; 4 import com.yohoufo.order.service.pay.weixin.config.AbstractWeixinPayConfig;
5 -import com.yohoufo.order.service.pay.weixin.config.UfoWeixinPayConfig; 5 +import com.yohoufo.order.service.pay.weixin.config.UfoMiniPayConfig;
6 import com.yohoufo.order.service.pay.weixin.ssl.AbstractHttpSslClient; 6 import com.yohoufo.order.service.pay.weixin.ssl.AbstractHttpSslClient;
7 import com.yohoufo.order.service.pay.weixin.ssl.WxUfoHttpSslClient; 7 import com.yohoufo.order.service.pay.weixin.ssl.WxUfoHttpSslClient;
8 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,7 +15,7 @@ import org.springframework.stereotype.Service; @@ -15,7 +15,7 @@ import org.springframework.stereotype.Service;
15 public class MiniappWeixinPayService extends AbstractWeixinPayService { 15 public class MiniappWeixinPayService extends AbstractWeixinPayService {
16 16
17 @Autowired 17 @Autowired
18 - UfoWeixinPayConfig ufoWeixinConfig; 18 + UfoMiniPayConfig ufoMiniPayConfig;
19 19
20 @Autowired 20 @Autowired
21 WxUfoHttpSslClient wxUfoHttpSslClient; 21 WxUfoHttpSslClient wxUfoHttpSslClient;
@@ -27,7 +27,7 @@ public class MiniappWeixinPayService extends AbstractWeixinPayService { @@ -27,7 +27,7 @@ public class MiniappWeixinPayService extends AbstractWeixinPayService {
27 27
28 @Override 28 @Override
29 protected AbstractWeixinPayConfig abstractWeixinConfig() { 29 protected AbstractWeixinPayConfig abstractWeixinConfig() {
30 - return ufoWeixinConfig; 30 + return ufoMiniPayConfig;
31 } 31 }
32 32
33 @Override 33 @Override
@@ -2,6 +2,7 @@ package com.yohoufo.order.service.pay.weixin; @@ -2,6 +2,7 @@ package com.yohoufo.order.service.pay.weixin;
2 2
3 import com.yohoufo.order.config.WeixinPayConstants; 3 import com.yohoufo.order.config.WeixinPayConstants;
4 import com.yohoufo.order.service.pay.weixin.config.AbstractWeixinPayConfig; 4 import com.yohoufo.order.service.pay.weixin.config.AbstractWeixinPayConfig;
  5 +import com.yohoufo.order.service.pay.weixin.config.YoufuMniniPayConfig;
5 import com.yohoufo.order.service.pay.weixin.config.YoufuWeixinPayConfig; 6 import com.yohoufo.order.service.pay.weixin.config.YoufuWeixinPayConfig;
6 import com.yohoufo.order.service.pay.weixin.ssl.AbstractHttpSslClient; 7 import com.yohoufo.order.service.pay.weixin.ssl.AbstractHttpSslClient;
7 import com.yohoufo.order.service.pay.weixin.ssl.YoufuWxHttpSslClient; 8 import com.yohoufo.order.service.pay.weixin.ssl.YoufuWxHttpSslClient;
@@ -2,6 +2,7 @@ package com.yohoufo.order.service.pay.weixin; @@ -2,6 +2,7 @@ package com.yohoufo.order.service.pay.weixin;
2 2
3 import com.yohoufo.order.config.WeixinPayConstants; 3 import com.yohoufo.order.config.WeixinPayConstants;
4 import com.yohoufo.order.service.pay.weixin.config.AbstractWeixinPayConfig; 4 import com.yohoufo.order.service.pay.weixin.config.AbstractWeixinPayConfig;
  5 +import com.yohoufo.order.service.pay.weixin.config.YoufuMniniPayConfig;
5 import com.yohoufo.order.service.pay.weixin.config.YoufuWeixinPayConfig; 6 import com.yohoufo.order.service.pay.weixin.config.YoufuWeixinPayConfig;
6 import com.yohoufo.order.service.pay.weixin.ssl.AbstractHttpSslClient; 7 import com.yohoufo.order.service.pay.weixin.ssl.AbstractHttpSslClient;
7 import com.yohoufo.order.service.pay.weixin.ssl.YoufuWxHttpSslClient; 8 import com.yohoufo.order.service.pay.weixin.ssl.YoufuWxHttpSslClient;
@@ -16,7 +17,7 @@ public class YoufuMiniappWeixinPayService extends AbstractWeixinPayService { @@ -16,7 +17,7 @@ public class YoufuMiniappWeixinPayService extends AbstractWeixinPayService {
16 17
17 18
18 @Autowired 19 @Autowired
19 - YoufuWeixinPayConfig youfuWeixinConfig; 20 + YoufuMniniPayConfig youfuMniniPayConfig;
20 21
21 @Autowired 22 @Autowired
22 YoufuWxHttpSslClient youfuWxHttpSslClient; 23 YoufuWxHttpSslClient youfuWxHttpSslClient;
@@ -28,7 +29,7 @@ public class YoufuMiniappWeixinPayService extends AbstractWeixinPayService { @@ -28,7 +29,7 @@ public class YoufuMiniappWeixinPayService extends AbstractWeixinPayService {
28 29
29 @Override 30 @Override
30 protected AbstractWeixinPayConfig abstractWeixinConfig() { 31 protected AbstractWeixinPayConfig abstractWeixinConfig() {
31 - return youfuWeixinConfig; 32 + return youfuMniniPayConfig;
32 } 33 }
33 34
34 @Override 35 @Override
  1 +package com.yohoufo.order.service.pay.weixin.config;
  2 +
  3 +import com.yohoufo.order.config.WeixinPayConstants;
  4 +import org.springframework.stereotype.Component;
  5 +
  6 +@Component
  7 +public class UfoMiniPayConfig extends AbstractWeixinPayConfig {
  8 +
  9 + @Override
  10 + public String appId() {
  11 + return WeixinPayConstants.Miniapp.APPID;
  12 + }
  13 +
  14 + @Override
  15 + public String partnerId() {
  16 + return WeixinPayConstants.Miniapp.MALL_ID;
  17 + }
  18 +
  19 + @Override
  20 + public String mchCertPath() {
  21 + return WeixinPayConstants.UFO_PARTNER_CERT;
  22 + }
  23 +}
  1 +package com.yohoufo.order.service.pay.weixin.config;
  2 +
  3 +import com.yohoufo.order.config.WeixinPayConstants;
  4 +import org.springframework.stereotype.Component;
  5 +
  6 +@Component
  7 +public class YoufuMniniPayConfig extends AbstractWeixinPayConfig {
  8 +
  9 + @Override
  10 + public String appId() {
  11 + return WeixinPayConstants.YoufuMiniapp.APPID;
  12 + }
  13 +
  14 + @Override
  15 + public String partnerId() {
  16 + return WeixinPayConstants.YoufuMiniapp.MALL_ID;
  17 + }
  18 +
  19 + @Override
  20 + public String mchCertPath() {
  21 + return WeixinPayConstants.YOUFU_UFO_PARTNER_CERT;
  22 + }
  23 +}
@@ -165,7 +165,8 @@ public class ProductSearchController { @@ -165,7 +165,8 @@ public class ProductSearchController {
165 @IgnoreSession 165 @IgnoreSession
166 public ApiResponse searchSaleCalendar(@RequestParam(value = "uid", required = false)Integer uid, 166 public ApiResponse searchSaleCalendar(@RequestParam(value = "uid", required = false)Integer uid,
167 @RequestParam(value = "start_time", required = false)String startTime, 167 @RequestParam(value = "start_time", required = false)String startTime,
168 - @RequestParam(value = "end_time", required = false)String endTime) { 168 + @RequestParam(value = "end_time", required = false)String endTime,
  169 + @RequestParam(value = "app_version", required = false)String appVersion) {
169 if (StringUtils.isBlank(startTime) || StringUtils.isBlank(endTime)) { 170 if (StringUtils.isBlank(startTime) || StringUtils.isBlank(endTime)) {
170 return new ApiResponse.ApiResponseBuilder().code(400).message("参数错误!").data(null).build(); 171 return new ApiResponse.ApiResponseBuilder().code(400).message("参数错误!").data(null).build();
171 } 172 }
@@ -176,7 +177,7 @@ public class ProductSearchController { @@ -176,7 +177,7 @@ public class ProductSearchController {
176 return new ApiResponse.ApiResponseBuilder().code(400).message("参数错误!").data(null).build(); 177 return new ApiResponse.ApiResponseBuilder().code(400).message("参数错误!").data(null).build();
177 } 178 }
178 JSONObject productJson = productSearchService.searchSaleCalendar(start, end); 179 JSONObject productJson = productSearchService.searchSaleCalendar(start, end);
179 - productSearchService.processUserFavoriteProductList(productJson, uid); 180 + productSearchService.processUserFavoriteProductList(productJson, uid, appVersion);
180 return new ApiResponse.ApiResponseBuilder().code(200).message("product.search.saleCalendar").data(productJson).build(); 181 return new ApiResponse.ApiResponseBuilder().code(200).message("product.search.saleCalendar").data(productJson).build();
181 } 182 }
182 183
@@ -196,7 +197,8 @@ public class ProductSearchController { @@ -196,7 +197,8 @@ public class ProductSearchController {
196 public ApiResponse searchNewSaleCalendar(@RequestParam(value = "uid", required = false)Integer uid, 197 public ApiResponse searchNewSaleCalendar(@RequestParam(value = "uid", required = false)Integer uid,
197 @RequestParam(value = "start_time", required = false)String startTime, 198 @RequestParam(value = "start_time", required = false)String startTime,
198 @RequestParam(value = "end_time", required = false)String endTime, 199 @RequestParam(value = "end_time", required = false)String endTime,
199 - @RequestParam(value = "type", required = false)String type) { 200 + @RequestParam(value = "type", required = false)String type,
  201 + @RequestParam(value = "app_version", required = false)String appVersion) {
200 if (StringUtils.isBlank(startTime) || StringUtils.isBlank(endTime)) { 202 if (StringUtils.isBlank(startTime) || StringUtils.isBlank(endTime)) {
201 return new ApiResponse.ApiResponseBuilder().code(400).message("参数错误!").data(null).build(); 203 return new ApiResponse.ApiResponseBuilder().code(400).message("参数错误!").data(null).build();
202 } 204 }
@@ -207,7 +209,7 @@ public class ProductSearchController { @@ -207,7 +209,7 @@ public class ProductSearchController {
207 return new ApiResponse.ApiResponseBuilder().code(400).message("参数错误!").data(null).build(); 209 return new ApiResponse.ApiResponseBuilder().code(400).message("参数错误!").data(null).build();
208 } 210 }
209 JSONObject productJson = productSearchService.searchNewSaleCalendar(start, end, type); 211 JSONObject productJson = productSearchService.searchNewSaleCalendar(start, end, type);
210 - productSearchService.processUserFavoriteProductList(productJson, uid); 212 + productSearchService.processUserFavoriteProductList(productJson, uid, appVersion);
211 return new ApiResponse.ApiResponseBuilder().code(200).message("product.search.newSaleCalendar").data(productJson).build(); 213 return new ApiResponse.ApiResponseBuilder().code(200).message("product.search.newSaleCalendar").data(productJson).build();
212 } 214 }
213 215
@@ -31,7 +31,7 @@ public interface ProductSearchService { @@ -31,7 +31,7 @@ public interface ProductSearchService {
31 31
32 JSONObject searchHotSale(Integer page, Integer limit, String businessClient); 32 JSONObject searchHotSale(Integer page, Integer limit, String businessClient);
33 33
34 - void processUserFavoriteProductList(JSONObject productJSON, Integer uid); 34 + void processUserFavoriteProductList(JSONObject productJSON, Integer uid, String appVersion);
35 35
36 JSONObject getSaleCalendarCountData(); 36 JSONObject getSaleCalendarCountData();
37 JSONObject getNewSaleCalendarCountData(String type); 37 JSONObject getNewSaleCalendarCountData(String type);
@@ -142,7 +142,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -142,7 +142,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
142 142
143 @SuppressWarnings("unchecked") 143 @SuppressWarnings("unchecked")
144 @Override 144 @Override
145 - public void processUserFavoriteProductList(JSONObject productJSON, Integer uid) { 145 + public void processUserFavoriteProductList(JSONObject productJSON, Integer uid, String appVersion) {
146 JSONArray productList = productJSON.getJSONArray("product_list"); 146 JSONArray productList = productJSON.getJSONArray("product_list");
147 if (CollectionUtils.isEmpty(productList) || uid == null || uid < 1) { 147 if (CollectionUtils.isEmpty(productList) || uid == null || uid < 1) {
148 return; 148 return;
@@ -162,13 +162,11 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -162,13 +162,11 @@ public class ProductSearchServiceImpl implements ProductSearchService {
162 if(org.apache.commons.collections.CollectionUtils.isEmpty(favorite)) { 162 if(org.apache.commons.collections.CollectionUtils.isEmpty(favorite)) {
163 return; 163 return;
164 } 164 }
165 - // 遍历商品列表  
166 for (int i = 0; i < productList.size(); i++) { 165 for (int i = 0; i < productList.size(); i++) {
167 JSONObject product = productList.getJSONObject(i); 166 JSONObject product = productList.getJSONObject(i);
168 if (null == product) { 167 if (null == product) {
169 continue; 168 continue;
170 } 169 }
171 - // 处理图片,封面图设置  
172 Integer productId = MapUtils.getInteger(product, "id", 0); 170 Integer productId = MapUtils.getInteger(product, "id", 0);
173 if (productId != 0 && favorite.contains(productId)) { 171 if (productId != 0 && favorite.contains(productId)) {
174 product.put("isFavorite", 1); 172 product.put("isFavorite", 1);