|
|
@@ -9,10 +9,13 @@ import com.zhongshu.card.client.model.payment.CreateOrderParam;
|
|
|
import com.zhongshu.card.server.core.dao.devices.DeviceInfoDao;
|
|
|
import com.zhongshu.card.server.core.domain.devices.DeviceInfo;
|
|
|
import com.zhongshu.card.server.core.domain.devices.DeviceProduct;
|
|
|
+import com.zhongshu.card.server.core.domain.org.Organization;
|
|
|
import com.zhongshu.card.server.core.domain.org.UserAccount;
|
|
|
import com.zhongshu.card.server.core.domain.payment.ExpenseFlow;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
+import com.zhongshu.card.server.core.service.devices.DeviceInfoServiceImpl;
|
|
|
import com.zhongshu.card.server.core.service.devices.deviceProduct.DeviceProductBindDeviceService;
|
|
|
+import com.zhongshu.card.server.core.service.paySetting.ProjectPaySettingServiceImpl;
|
|
|
import com.zhongshu.card.server.core.util.CommonUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
@@ -39,6 +42,12 @@ public class OrderService extends SuperService {
|
|
|
@Autowired
|
|
|
private ExpenseFlowServiceImpl expenseFlowService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DeviceInfoServiceImpl deviceInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProjectPaySettingServiceImpl projectPaySettingService;
|
|
|
+
|
|
|
/**
|
|
|
* 小程序扫 设备码 下单 (微信)
|
|
|
*
|
|
|
@@ -67,6 +76,17 @@ public class OrderService extends SuperService {
|
|
|
return ResultContent.buildFail("消费金额不能为空");
|
|
|
}
|
|
|
|
|
|
+ // 判断设备关联的机构是配置微信支付
|
|
|
+ Organization organization = deviceInfoService.getDeviceReceiveOrganization(deviceInfo);
|
|
|
+ if (ObjectUtils.isEmpty(organization)) {
|
|
|
+ return ResultContent.buildFail("设备未绑定收款机构,下单失败");
|
|
|
+ }
|
|
|
+ // 判断机构是否支持 该支付类型
|
|
|
+ ResultContent resultContent = projectPaySettingService.judgeOrgSupport(deviceInfo.getProjectOid(), organization.getOid(), PaymentType.WeChatPay);
|
|
|
+ if (resultContent.isFailed()) {
|
|
|
+ return ResultContent.buildFail(resultContent.getMsg());
|
|
|
+ }
|
|
|
+
|
|
|
String mqttDataId = CommonUtil.UUID();
|
|
|
ExpenseFlow expenseFlow = expenseFlowService.init(mqttDataId);
|
|
|
if (ObjectUtils.isEmpty(expenseFlow)) {
|