|
|
@ -16,7 +16,6 @@ import com.hfkj.entity.BsOrderExample; |
|
|
|
import com.hfkj.entity.BsUser; |
|
|
|
import com.hfkj.entity.BsUser; |
|
|
|
import com.hfkj.model.BsOrderModel; |
|
|
|
import com.hfkj.model.BsOrderModel; |
|
|
|
import com.hfkj.model.UserTeamModel; |
|
|
|
import com.hfkj.model.UserTeamModel; |
|
|
|
import com.hfkj.service.elm.ElmService; |
|
|
|
|
|
|
|
import com.hfkj.service.meituan.MeiTuanService; |
|
|
|
import com.hfkj.service.meituan.MeiTuanService; |
|
|
|
import com.hfkj.service.order.BsOrderService; |
|
|
|
import com.hfkj.service.order.BsOrderService; |
|
|
|
import com.hfkj.service.order.OrderBusinessService; |
|
|
|
import com.hfkj.service.order.OrderBusinessService; |
|
|
@ -30,7 +29,6 @@ import com.hfkj.service.user.BsUserService; |
|
|
|
import com.hfkj.sysenum.partner.PartnerEnum; |
|
|
|
import com.hfkj.sysenum.partner.PartnerEnum; |
|
|
|
import com.hfkj.sysenum.user.UserAccountRecordSourceTypeEnum; |
|
|
|
import com.hfkj.sysenum.user.UserAccountRecordSourceTypeEnum; |
|
|
|
import com.pdd.pop.sdk.http.api.pop.response.PddDdkOrderListRangeGetResponse; |
|
|
|
import com.pdd.pop.sdk.http.api.pop.response.PddDdkOrderListRangeGetResponse; |
|
|
|
import com.taobao.api.response.AlibabaAlscUnionKbcpxPositiveOrderGetResponse; |
|
|
|
|
|
|
|
import com.taobao.top.ability414.domain.TaobaoTbkOrderDetailsGetPublisherOrderDto; |
|
|
|
import com.taobao.top.ability414.domain.TaobaoTbkOrderDetailsGetPublisherOrderDto; |
|
|
|
import com.taobao.top.ability414.response.TaobaoTbkOrderDetailsGetResponse; |
|
|
|
import com.taobao.top.ability414.response.TaobaoTbkOrderDetailsGetResponse; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
@ -186,7 +184,7 @@ public class BsOrderServiceImpl implements BsOrderService { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void getOrderElmList(String startTime, String endTime) { |
|
|
|
public void getOrderElmList(String startTime, String endTime) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
elmOrder(startTime , endTime); |
|
|
|
meiTuanOrder(startTime , endTime); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
System.out.println(e.getMessage()); |
|
|
|
System.out.println(e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
@ -597,106 +595,18 @@ public class BsOrderServiceImpl implements BsOrderService { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// 否则,调用editData方法,更新订单信息
|
|
|
|
// 否则,调用editData方法,更新订单信息
|
|
|
|
editData(bsOrder); |
|
|
|
editData(bsOrder); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void elmOrder(String startTime , String endTime) throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AlibabaAlscUnionKbcpxPositiveOrderGetResponse elmOrderList = ElmService.elmOrderList(startTime ,endTime); |
|
|
|
|
|
|
|
List<AlibabaAlscUnionKbcpxPositiveOrderGetResponse.OrderDetailReportDTO> elmOrderListResult = elmOrderList.getResult(); |
|
|
|
|
|
|
|
List<BsOrder> list = getOrderList(new HashMap<>()); |
|
|
|
|
|
|
|
List<BsUser> userList = userService.getList(new HashMap<>()); |
|
|
|
|
|
|
|
userList = userList.stream().filter(s->s.getElmPid() != null).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (elmOrderListResult != null && !elmOrderListResult.isEmpty()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (AlibabaAlscUnionKbcpxPositiveOrderGetResponse.OrderDetailReportDTO elmOrder : elmOrderListResult) { |
|
|
|
|
|
|
|
// 根据订单号,从本地订单列表中查找订单
|
|
|
|
|
|
|
|
BsOrder bsOrder = list.stream().filter(s->s.getOrderNo().equals(elmOrder.getBizOrderId().toString())).findFirst().orElse(null); |
|
|
|
|
|
|
|
// 根据relationId,从用户列表中查找用户
|
|
|
|
|
|
|
|
BsUser bsUser = userList.stream().filter(s->s.getElmPid().equals(elmOrder.getPid())).findFirst().orElse(null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果本地订单列表中没有该订单,则创建一个新的订单
|
|
|
|
|
|
|
|
if (bsOrder == null) { |
|
|
|
|
|
|
|
bsOrder = new BsOrder(); |
|
|
|
|
|
|
|
bsOrder.setOrderNo(elmOrder.getBizOrderId().toString()); |
|
|
|
|
|
|
|
if (bsUser != null) { |
|
|
|
|
|
|
|
bsOrder.setUserId(bsUser.getId()); |
|
|
|
|
|
|
|
bsOrder.setUserPhone(bsUser.getPhone() == null ? "" : bsUser.getPhone()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bsOrder.setCreateTime(new Date()); |
|
|
|
|
|
|
|
bsOrder.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
bsOrder.setStatus(elmStatus(elmOrder.getOrderState())); |
|
|
|
|
|
|
|
bsOrder.setType(4); |
|
|
|
|
|
|
|
bsOrder.setGoodsName(elmOrder.getTitle()); |
|
|
|
|
|
|
|
bsOrder.setGoodsCount(1); |
|
|
|
|
|
|
|
bsOrder.setTotalPrice(new BigDecimal(elmOrder.getPayAmount())); |
|
|
|
|
|
|
|
bsOrder.setPromotionAmount(new BigDecimal(elmOrder.getSettleAmount())); |
|
|
|
|
|
|
|
if (elmOrder.getTkCreateTime() != null) { |
|
|
|
|
|
|
|
bsOrder.setCreateTime(DateUtil.format(elmOrder.getTkCreateTime() , DateUtil.Y_M_D_HMS)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (elmOrder.getPayTime() != null) { |
|
|
|
|
|
|
|
bsOrder.setPayTime(DateUtil.format(elmOrder.getPayTime() , DateUtil.Y_M_D_HMS)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (elmOrder.getSettleTime() != null) { |
|
|
|
|
|
|
|
bsOrder.setFinishTime(DateUtil.format(elmOrder.getSettleTime() , DateUtil.Y_M_D_HMS)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 调用create方法,将新订单保存到本地订单列表中
|
|
|
|
|
|
|
|
create(bsOrder); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 如果本地订单列表中已有该订单,则更新订单信息
|
|
|
|
|
|
|
|
if (bsOrder.getStatus() == 2) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bsOrder.setOrderNo(elmOrder.getBizOrderId().toString()); |
|
|
|
|
|
|
|
if (bsUser != null) { |
|
|
|
|
|
|
|
bsOrder.setUserId(bsUser.getId()); |
|
|
|
|
|
|
|
bsOrder.setUserPhone(bsUser.getPhone() == null ? "" : bsUser.getPhone()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bsOrder.setCreateTime(new Date()); |
|
|
|
|
|
|
|
bsOrder.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
bsOrder.setStatus(elmStatus(elmOrder.getOrderState())); |
|
|
|
|
|
|
|
bsOrder.setType(4); |
|
|
|
|
|
|
|
bsOrder.setGoodsName(elmOrder.getTitle()); |
|
|
|
|
|
|
|
bsOrder.setGoodsCount(1); |
|
|
|
|
|
|
|
bsOrder.setTotalPrice(new BigDecimal(elmOrder.getPayAmount())); |
|
|
|
|
|
|
|
bsOrder.setPromotionAmount(new BigDecimal(elmOrder.getSettleAmount())); |
|
|
|
|
|
|
|
if (elmOrder.getTkCreateTime() != null) { |
|
|
|
|
|
|
|
bsOrder.setCreateTime(DateUtil.format(elmOrder.getTkCreateTime() , DateUtil.Y_M_D_HMS)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (elmOrder.getPayTime() != null) { |
|
|
|
|
|
|
|
bsOrder.setPayTime(DateUtil.format(elmOrder.getPayTime() , DateUtil.Y_M_D_HMS)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (elmOrder.getSettleTime() != null) { |
|
|
|
|
|
|
|
bsOrder.setFinishTime(DateUtil.format(elmOrder.getSettleTime() , DateUtil.Y_M_D_HMS)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果订单状态为5,则调用orderRebate方法
|
|
|
|
|
|
|
|
if (bsOrder.getStatus() == 2 && elmOrder.getOrderState() == 4){ |
|
|
|
|
|
|
|
orderRebate(bsOrder); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 否则,调用editData方法,更新订单信息
|
|
|
|
|
|
|
|
editData(bsOrder); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Integer pddStatus(Long status) { |
|
|
|
private Integer pddStatus(Long status) { |
|
|
|
int result = 4; |
|
|
|
int result = 4; |
|
|
|
if (status == 0) { |
|
|
|
if (status == 0) { |
|
|
@ -742,18 +652,4 @@ public class BsOrderServiceImpl implements BsOrderService { |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Integer elmStatus(Long status) { |
|
|
|
|
|
|
|
int result = 4; |
|
|
|
|
|
|
|
if (status == 1) { |
|
|
|
|
|
|
|
result = 1; |
|
|
|
|
|
|
|
} else if (status == 0) { |
|
|
|
|
|
|
|
result = 4; |
|
|
|
|
|
|
|
} else if (status == 2) { |
|
|
|
|
|
|
|
result = 2; |
|
|
|
|
|
|
|
} else if (status == 4) { |
|
|
|
|
|
|
|
result = 2; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|