|
|
|
@@ -61,6 +61,9 @@ import java.util.*; |
|
|
|
public class WxOrderController extends BaseController { |
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxMallService mallService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxCouponChannelService wxCouponChannelService; |
|
|
|
|
|
|
|
@@ -207,9 +210,10 @@ public class WxOrderController extends BaseController { |
|
|
|
map.put("err_tips","透传字段格式不正确"); |
|
|
|
return map; |
|
|
|
} |
|
|
|
WxMall mall = mallService.getByTenantId(tenantId); |
|
|
|
|
|
|
|
//验证app |
|
|
|
WxAppinfo appinfo = wxAppinfoService.getByAppIdFromRedis(app_id,tenantId); |
|
|
|
//验证app todo 想想集团版多小程序和单小程序怎么处理 |
|
|
|
WxAppinfo appinfo = wxAppinfoService.getByAppIdFromRedis(app_id,mall.getFinalTenantId()); |
|
|
|
if(appinfo == null || !EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat()) |
|
|
|
|| !EnumAppType.C.getCode().equals(appinfo.getType())){ |
|
|
|
map.put("err_no",ErrorCode.APP_ID_NOT_FOUND.getCode()); |
|
|
|
@@ -223,10 +227,10 @@ public class WxOrderController extends BaseController { |
|
|
|
return map; |
|
|
|
} |
|
|
|
TenantEntity tenantEntity = new TenantEntity(); |
|
|
|
tenantEntity.updateTenantInfo(appinfo); |
|
|
|
tenantEntity.updateTenantInfo(mall); |
|
|
|
//验证用户 |
|
|
|
Long memberId = null; |
|
|
|
TtCUser cuser = (TtCUser) cuserFactory.getCUserService(EnumAppPlat.TOUTIAO).getByOpenId(open_id, tenantEntity.getTenantId()); |
|
|
|
TtCUser cuser = (TtCUser) cuserFactory.getCUserService(EnumAppPlat.TOUTIAO).getByOpenId(open_id, appinfo.getTenantId()); |
|
|
|
if(cuser != null && cuser.getUserId() != null){ |
|
|
|
memberId = cuser.getUserId(); |
|
|
|
} |
|
|
|
@@ -253,7 +257,7 @@ public class WxOrderController extends BaseController { |
|
|
|
Map<String, Object> data = new HashMap<>(); |
|
|
|
data.put("out_order_no",order.getMainOrderId().toString()); |
|
|
|
data.put("pay_expire_seconds",14*60); |
|
|
|
data.put("order_entry_schema",wxOrderService.getOrderEntrySchema(order.getMainOrderId())); |
|
|
|
data.put("order_entry_schema",wxOrderService.getOrderEntrySchema(mall.getTenantId(),order.getMainOrderId())); |
|
|
|
if(order.getExtParam() != null && !order.getExtParam().isEmpty()){ |
|
|
|
data.put("order_goods_info",order.getExtParam()); |
|
|
|
} |
|
|
|
@@ -756,9 +760,10 @@ public class WxOrderController extends BaseController { |
|
|
|
String app_id = msgObject.getString("app_id"); |
|
|
|
String open_id = msgObject.getString("open_id"); |
|
|
|
String cp_extra = msgObject.getString("cp_extra"); |
|
|
|
|
|
|
|
String tenantId = getTenantId(cp_extra); |
|
|
|
WxMall mall = mallService.getByTenantId(tenantId); |
|
|
|
//验证app |
|
|
|
WxAppinfo appinfo = wxAppinfoService.getByAppId(app_id,getTenantId(cp_extra)); |
|
|
|
WxAppinfo appinfo = wxAppinfoService.getByAppId(app_id); |
|
|
|
if(appinfo == null || !EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat()) |
|
|
|
|| !EnumAppType.C.getCode().equals(appinfo.getType())){ |
|
|
|
map.put("err_no",ErrorCode.APP_ID_NOT_FOUND.getCode()); |
|
|
|
@@ -772,10 +777,10 @@ public class WxOrderController extends BaseController { |
|
|
|
return map; |
|
|
|
} |
|
|
|
TenantEntity tenantEntity = new TenantEntity(); |
|
|
|
tenantEntity.updateTenantInfo(appinfo); |
|
|
|
tenantEntity.updateTenantInfo(mall); |
|
|
|
//验证用户 |
|
|
|
Long memberId = null; |
|
|
|
TtCUser cuser = (TtCUser) cuserFactory.getCUserService(EnumAppPlat.TOUTIAO).getByOpenId(open_id, tenantEntity.getTenantId()); |
|
|
|
TtCUser cuser = (TtCUser) cuserFactory.getCUserService(EnumAppPlat.TOUTIAO).getByOpenId(open_id, appinfo.getTenantId()); |
|
|
|
if(cuser != null && cuser.getUserId() != null){ |
|
|
|
memberId = cuser.getUserId(); |
|
|
|
} |
|
|
|
@@ -794,7 +799,7 @@ public class WxOrderController extends BaseController { |
|
|
|
WxRefundOrder refundOrder = (WxRefundOrder) resultData.data; |
|
|
|
Map<String, Object> data = new HashMap<>(); |
|
|
|
data.put("out_refund_no",refundOrder.getId().toString()); |
|
|
|
data.put("order_entry_schema",wxOrderService.getOrderEntrySchema(Long.parseLong(refundOrder.getPayOrderNo()))); |
|
|
|
data.put("order_entry_schema",wxOrderService.getOrderEntrySchema(mall.getTenantId(),Long.parseLong(refundOrder.getPayOrderNo()))); |
|
|
|
map.put("data",data); |
|
|
|
map.put("err_no",0); |
|
|
|
map.put("err_tips",resultData.message); |
|
|
|
|