| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * 合作商工具类 |
| | |
| | | private UserResourcesClient userResourcesClient; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 推送新的订单给合作商 |
| | | * @param officialPartnerId |
| | | * @return |
| | | */ |
| | | public R<?> pusNewOrder(Integer officialPartnerId, XpOrder xpOrder) { |
| | | public R<?> pushNewOrder(Integer officialPartnerId, XpOrder xpOrder) { |
| | | XpOfficialPartner xpOfficialPartner = xpOfficialPartnerService.getById(officialPartnerId); |
| | | String createOrderUrl = xpOfficialPartner.getCreateOrderUrl(); |
| | | PushNewOrderVo pushNewOrderVo = buildNewOrder(xpOrder); |
| | |
| | | post.body(JSON.toJSONString(pushNewOrderVo)); |
| | | HttpResponse execute = post.execute(); |
| | | if(!execute.isOk()){ |
| | | throw new ServiceException("调用合作商接口失败-通知新订单接口"); |
| | | throw new ServiceException("[" + xpOfficialPartner.getName() + "]调用合作商接口失败-通知新订单接口"); |
| | | } |
| | | OfficialPartnerResult officialPartnerResult = JSON.parseObject(execute.body(), OfficialPartnerResult.class); |
| | | if(0 == officialPartnerResult.getCode()){ |
| | | return R.ok(); |
| | | } |
| | | return R.fail(officialPartnerResult.getMsg()); |
| | | throw new ServiceException("[" + xpOfficialPartner.getName() + "]" + officialPartnerResult.getMsg()); |
| | | } |
| | | |
| | | |
| | |
| | | if(ucUserInfo != null){ |
| | | vo.setUserPhone(ucUserInfo.getMobile()); |
| | | } |
| | | vo.setCreateTime(xpOrder.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | return vo; |
| | | |
| | | } |
| | | |
| | | |
| | | public R<?> pushCancelOrder(Integer officialPartnerId, XpOrder xpOrder) { |
| | | |
| | | } |
| | | } |