|
|
|
@ -7,7 +7,9 @@ import com.hfkj.common.exception.SysCode; |
|
|
|
|
import com.hfkj.entity.*; |
|
|
|
|
import com.hfkj.model.GasPayPriceModel; |
|
|
|
|
import com.hfkj.model.order.OrderChildModel; |
|
|
|
|
import com.hfkj.service.agent.BsAgentApiParamService; |
|
|
|
|
import com.hfkj.service.agent.BsAgentMerAccountService; |
|
|
|
|
import com.hfkj.service.agent.BsAgentService; |
|
|
|
|
import com.hfkj.service.discount.BsDiscountUseMerService; |
|
|
|
|
import com.hfkj.service.gas.*; |
|
|
|
|
import com.hfkj.service.merchant.BsMerchantPayConfigService; |
|
|
|
@ -15,6 +17,7 @@ import com.hfkj.service.merchant.BsMerchantService; |
|
|
|
|
import com.hfkj.service.agent.BsAgentMerService; |
|
|
|
|
import com.hfkj.service.sec.SecDictionaryService; |
|
|
|
|
import com.hfkj.service.spread.BsUserSpreadRelService; |
|
|
|
|
import com.hfkj.sysenum.agent.AgentStatusEnum; |
|
|
|
|
import com.hfkj.sysenum.gas.GasOrderCreateType; |
|
|
|
|
import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum; |
|
|
|
|
import com.hfkj.sysenum.merchant.MerchantStatusEnum; |
|
|
|
@ -63,6 +66,10 @@ public class OrderCreateService { |
|
|
|
|
private BsGasChannelConfigService gasChannelConfigService; |
|
|
|
|
@Resource |
|
|
|
|
private BsGasOrderSpreadService gasOrderSpreadService; |
|
|
|
|
@Resource |
|
|
|
|
private BsAgentApiParamService agentApiParamService; |
|
|
|
|
@Resource |
|
|
|
|
private BsAgentService agentService; |
|
|
|
|
/** |
|
|
|
|
* 加油业务 |
|
|
|
|
* @param order 订单 |
|
|
|
@ -151,6 +158,28 @@ public class OrderCreateService { |
|
|
|
|
); |
|
|
|
|
gasOrder.setGasSettlePrice(gasSettlePrice); |
|
|
|
|
|
|
|
|
|
// 代理商appid
|
|
|
|
|
if (orderChild.getAgentAppId() != null) { |
|
|
|
|
// 代理商参数
|
|
|
|
|
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(orderChild.getAgentAppId()); |
|
|
|
|
if (apiParam == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "代理参数接入错误"); |
|
|
|
|
} |
|
|
|
|
if (!apiParam.getStatus().equals(1)) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "代理参数接入错误"); |
|
|
|
|
} |
|
|
|
|
// 代理商
|
|
|
|
|
BsAgent agent = agentService.getAgentById(apiParam.getAgentId()); |
|
|
|
|
if (agent == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "代理参数接入错误"); |
|
|
|
|
} |
|
|
|
|
if (!agent.getStatus().equals(AgentStatusEnum.status1.getCode())) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "代理处于异常状态"); |
|
|
|
|
} |
|
|
|
|
gasOrder.setAgentId(agent.getId()); |
|
|
|
|
gasOrder.setAgentName(agent.getName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 代理、业务员
|
|
|
|
|
if (orderChild.getAgentMerId() != null) { |
|
|
|
|
// 查询代理
|
|
|
|
|