|
@@ -244,6 +244,7 @@ public class WxController extends BaseController {
|
|
|
@ApiOperation("微信小程序支付下单")
|
|
|
public Response<JSONObject> xcxPrepareOrder(@RequestBody WxOrderDTO wxOrderDTO) throws Exception {
|
|
|
UserInfo userInfo = SecurityUtils.getLoginUser().getStudent();
|
|
|
+ String profitSharing = configService.selectConfigByKey("profit_sharing");
|
|
|
if (wxOrderDTO.getGoodsType() == 1) {
|
|
|
int count = vipUserExamService.getUserExamByUnionIdAndGoodsId(userInfo.getUnionId(), wxOrderDTO.getGoodsId());
|
|
|
if (count > 0) {
|
|
@@ -264,10 +265,11 @@ public class WxController extends BaseController {
|
|
|
order.setUnionId(userInfo.getUnionId());
|
|
|
order.setPhoneType(wxOrderDTO.getPhoneType()); //手机类型 1:苹果 2:安卓
|
|
|
order.setForeType(wxOrderDTO.getForeType()); //前端类型 1:app 2:小程序 3:公众号
|
|
|
-// if(wxOrderDTO.getForeType()==2) {
|
|
|
-// order.setProfitSharing(1); //待分账
|
|
|
-// }
|
|
|
- order.setProfitSharing(0); //待分账
|
|
|
+ if("1".equals(profitSharing)) {
|
|
|
+ order.setProfitSharing(1); //待分账
|
|
|
+ } else {
|
|
|
+ order.setProfitSharing(0); //待分账
|
|
|
+ }
|
|
|
order.setTotal(examInfo.getPrice());
|
|
|
order.setOrderStatus(OrderStatusEnum.PROCESSING.getCode());
|
|
|
wxOrderService.save(order);
|
|
@@ -295,9 +297,11 @@ public class WxController extends BaseController {
|
|
|
order.setPhoneType(wxOrderDTO.getPhoneType()); //手机类型 1:苹果 2:安卓
|
|
|
order.setForeType(wxOrderDTO.getForeType()); //前端类型 1:app 2:小程序 3:公众号
|
|
|
order.setTotal(Integer.parseInt(baziPriceStr));
|
|
|
-// if(wxOrderDTO.getForeType()==2) {
|
|
|
-// order.setProfitSharing(1); //待分账
|
|
|
-// }
|
|
|
+ if("1".equals(profitSharing)) {
|
|
|
+ order.setProfitSharing(1); //待分账
|
|
|
+ } else {
|
|
|
+ order.setProfitSharing(0); //待分账
|
|
|
+ }
|
|
|
order.setProfitSharing(0); //待分账
|
|
|
order.setOrderStatus(OrderStatusEnum.PROCESSING.getCode());
|
|
|
wxOrderService.save(order);
|
|
@@ -316,6 +320,8 @@ public class WxController extends BaseController {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
private JSONObject placeXcxWxOrder(WxOrder order, String goodsName) throws Exception {
|
|
|
+ String profitSharing = configService.selectConfigByKey("profit_sharing");
|
|
|
+
|
|
|
HttpPost httpPost = initHttpPost(wxpayConfig.getV3JsUrl());
|
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
@@ -327,9 +333,9 @@ public class WxController extends BaseController {
|
|
|
.put("out_trade_no", order.getOutTradeNo());
|
|
|
rootNode.putObject("amount").put("total", order.getTotal());
|
|
|
rootNode.putObject("payer").put("openid", order.getXcxOpenid());
|
|
|
-// if("人生报告".equals(goodsName)) {
|
|
|
-// rootNode.putObject("settle_info").put("profit_sharing", true);
|
|
|
-// }
|
|
|
+ if("1".equals(profitSharing)) {
|
|
|
+ rootNode.putObject("settle_info").put("profit_sharing", true);
|
|
|
+ }
|
|
|
objectMapper.writeValue(bos, rootNode);
|
|
|
httpPost.setEntity(new StringEntity(rootNode.toString(), "utf-8"));
|
|
|
HttpResponse response = httpClient.execute(httpPost);
|