|
@@ -12,13 +12,11 @@ import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
-import java.util.TreeMap;
|
|
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -28,10 +26,10 @@ import com.zskk.shop.controller.bean.UserBean;
|
|
import com.zskk.shop.dao.entry.BuyOrder;
|
|
import com.zskk.shop.dao.entry.BuyOrder;
|
|
import com.zskk.shop.dao.entry.BuyOrderItem;
|
|
import com.zskk.shop.dao.entry.BuyOrderItem;
|
|
import com.zskk.shop.dao.entry.GoodBase;
|
|
import com.zskk.shop.dao.entry.GoodBase;
|
|
|
|
+import com.zskk.shop.dao.entry.GoodPrice;
|
|
import com.zskk.shop.exception.ErrorConstant;
|
|
import com.zskk.shop.exception.ErrorConstant;
|
|
import com.zskk.shop.utils.HttpClient;
|
|
import com.zskk.shop.utils.HttpClient;
|
|
import com.zskk.shop.utils.LogUtil;
|
|
import com.zskk.shop.utils.LogUtil;
|
|
-import com.zskk.shop.utils.ToolsUtil;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
public class UserCenterService {
|
|
public class UserCenterService {
|
|
@@ -118,7 +116,39 @@ public class UserCenterService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public ControllerResult createH5Pay(BuyOrder order, GoodBase goods, GoodPrice price){
|
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
|
+ params.put("companyid", companyid);
|
|
|
|
+ params.put("apporderid", order.getOrderid());
|
|
|
|
+ params.put("name", goods.getName());
|
|
|
|
+ params.put("describe", goods.getDescribe());
|
|
|
|
+ params.put("money", price.getDiscountPrice().toString());
|
|
|
|
+ params.put("callback", myhost + "payed");
|
|
|
|
+ params.put("redirect", myhost + "h5/paySuccess");
|
|
|
|
+ params.put("extend", "");
|
|
|
|
+ params.put("sign", this.sign(params));
|
|
|
|
+
|
|
|
|
+ try{
|
|
|
|
+ String content = HttpClient.doPost(uccenter + "pay/createH5PayQrcode", params);
|
|
|
|
+ return JSON.parseObject(content, ControllerResult.class);
|
|
|
|
+ }catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ LogUtil.sysError(e.getMessage(), e);
|
|
|
|
+ return new ControllerResult(ErrorConstant.SERVER_ERROR);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String getWXPayUrl(BuyOrder order){
|
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
|
+ params.put("companyid", this.companyid);
|
|
|
|
+ params.put("apporderid", order.getOrderid());
|
|
|
|
+ String sign = this.sign(params);
|
|
|
|
+
|
|
|
|
+ return uccenter + "callback/h5Pay?companyid=" + companyid + "&apporderid=" + order.getOrderid() + "&sign=" + sign;
|
|
|
|
+ }
|
|
|
|
+
|
|
public String sign(Map<String, String> params){
|
|
public String sign(Map<String, String> params){
|
|
return signService.sign(params, secret);
|
|
return signService.sign(params, secret);
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|