...
|
...
|
@@ -12,7 +12,6 @@ import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO; |
|
|
import com.yoho.service.model.union.response.PageResponseBO;
|
|
|
import com.yoho.service.model.union.response.PageUnionShareOrderRspBO;
|
|
|
import com.yoho.service.model.union.response.UnionShareOrderRspBO;
|
|
|
import com.yoho.unions.common.enums.OrderStatusEnum;
|
|
|
import com.yoho.unions.common.enums.ShareOrdersKeyEnum;
|
|
|
import com.yoho.unions.common.enums.ShareOrdersStatusEnum;
|
|
|
import com.yoho.unions.common.redis.RedisHashCache;
|
...
|
...
|
@@ -127,8 +126,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
if (count < 1) {
|
|
|
return null;
|
|
|
}
|
|
|
Map<String,UnionShareOrders> ordersDOMap=this.unionShareOrdersMapper.selectListBySearchCodition(bo.getBeginTime(), bo.getEndTime(), uid,bo.getOrderCode(), reqBO.getStart(), reqBO.getSize());
|
|
|
List<UnionShareOrderRspBO> unionOrderRspBOList = queryUnionShareOrderRsp(ordersDOMap);
|
|
|
List<UnionShareOrders> ordersDOList=this.unionShareOrdersMapper.selectListBySearchCodition(bo.getBeginTime(), bo.getEndTime(), uid,bo.getOrderCode(), reqBO.getStart(), reqBO.getSize());
|
|
|
List<UnionShareOrderRspBO> unionOrderRspBOList = queryUnionShareOrderRspBO(ordersDOList);
|
|
|
PageUnionShareOrderRspBO pageUnionOrderRspBO = new PageUnionShareOrderRspBO();
|
|
|
pageUnionOrderRspBO.setList(unionOrderRspBOList);
|
|
|
pageUnionOrderRspBO.setTotal(count);
|
...
|
...
|
@@ -138,13 +137,11 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
}
|
|
|
|
|
|
private Integer queryUid(UnionShareOrderSearchBo bo){
|
|
|
Integer uid=null;
|
|
|
Long unionType=mktMarketingUrlDAO.selectUnionTypeByNameAndUnionType(bo.getUnionName(),bo.getUnionType());
|
|
|
Long unionType=null==bo.getUnionName()?bo.getUnionType():mktMarketingUrlDAO.selectUnionTypeByNameAndUnionType(bo.getUnionName(),bo.getUnionType());
|
|
|
if(null==unionType){
|
|
|
return null;
|
|
|
}
|
|
|
uid=this.unionShareUserMapper.selectUidByUnionType(unionType);
|
|
|
return uid;
|
|
|
return this.unionShareUserMapper.selectUidByUnionType(unionType);
|
|
|
}
|
|
|
private UnionShareOrderSearchBo initUnionShareOrderSearchBo(UnionShareOrderSearchReqBO reqBO){
|
|
|
UnionShareOrderSearchBo bo=new UnionShareOrderSearchBo();
|
...
|
...
|
@@ -157,17 +154,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
return bo;
|
|
|
}
|
|
|
|
|
|
private List<UnionShareOrderRspBO> queryUnionShareOrderRsp(Map<String,UnionShareOrders> ordersDOMap){
|
|
|
List<UnionShareOrderRspBO> unionOrderRspBOList = new ArrayList<>(ordersDOMap.size());
|
|
|
Map<String, ShareUserOrderDatailBO> userOrderDatailBOMap = initUserShareOrderDatails(ordersDOMap);
|
|
|
for (UnionShareOrders orders : ordersDOMap.values()) {
|
|
|
UnionShareOrderRspBO bo=initShareUnionOrderRspBO(orders,userOrderDatailBOMap);
|
|
|
unionOrderRspBOList.add(bo);
|
|
|
}
|
|
|
return unionOrderRspBOList;
|
|
|
}
|
|
|
|
|
|
private UnionShareOrderRspBO initShareUnionOrderRspBO(UnionShareOrders orders,Map<String, ShareUserOrderDatailBO> userOrderDatailBOMap){
|
|
|
private UnionShareOrderRspBO initShareUnionOrderRspBO(String unionType,MktMarketingUrl mktMarketingUrl,UnionShareOrders orders){
|
|
|
UnionShareOrderRspBO orderRspBO=new UnionShareOrderRspBO();
|
|
|
orderRspBO.setOrderAmount(orders.getLastOrderAmount());
|
|
|
orderRspBO.setOrderStatus(ShareOrdersStatusEnum.getDescByCode(orders.getStatus()));
|
...
|
...
|
@@ -176,48 +163,38 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
orderRspBO.setOrderCode(orders.getOrderCode());
|
|
|
orderRspBO.setId(orders.getId());
|
|
|
orderRspBO.setOrderTime(DateUtil.long2DateStr(Long.valueOf(orders.getCreateTime()) * Long.valueOf(1000), "yyyy-MM-dd HH:mm:ss"));
|
|
|
ShareUserOrderDatailBO userOrderDatailBO = userOrderDatailBOMap.get(orders.getOrderCode());
|
|
|
orderRspBO.setUnionId(userOrderDatailBO.getUnionType());
|
|
|
orderRspBO.setUnionType(userOrderDatailBO.getUnionName());
|
|
|
orderRspBO.setChannelType(userOrderDatailBO.getChannelType());
|
|
|
orderRspBO.setUnionId(unionType);
|
|
|
if(null!=mktMarketingUrl){
|
|
|
orderRspBO.setUnionType(mktMarketingUrl.getName());
|
|
|
orderRspBO.setChannelType(mktMarketingUrl.getChannelType());
|
|
|
}
|
|
|
return orderRspBO;
|
|
|
}
|
|
|
|
|
|
private List<Integer> getUids(Map<String,UnionShareOrders> ordersDOMap){
|
|
|
List<Integer> uids=new ArrayList<>(ordersDOMap.size());
|
|
|
for(UnionShareOrders order:ordersDOMap.values()){
|
|
|
private Set<Integer> getUids(List<UnionShareOrders> ordersDOList){
|
|
|
Set<Integer> uids=new HashSet<>(ordersDOList.size());
|
|
|
for(UnionShareOrders order:ordersDOList){
|
|
|
uids.add(order.getPromoteUid());
|
|
|
}
|
|
|
return uids;
|
|
|
}
|
|
|
private Map<String, ShareUserOrderDatailBO> initUserShareOrderDatails( Map<String,UnionShareOrders> ordersDOMap){
|
|
|
Map<String, ShareUserOrderDatailBO> userOrderDatailBOMap = new HashMap<>(ordersDOMap.size());
|
|
|
Map<Integer,UnionShareUser> userMap=unionShareUserMapper.selectByUids(getUids(ordersDOMap));
|
|
|
Map<Long,MktMarketingUrl> mktMarketMap=listMktMarketingUrls(ordersDOMap,userMap);
|
|
|
for (UnionShareOrders userOrders : ordersDOMap.values()) {
|
|
|
|
|
|
private List<UnionShareOrderRspBO> queryUnionShareOrderRspBO(List<UnionShareOrders> ordersDOList){
|
|
|
List<UnionShareOrderRspBO> unionOrderRspBOList = new ArrayList<>(ordersDOList.size());
|
|
|
Map<Integer,UnionShareUser> userMap=unionShareUserMapper.selectByUids(getUids(ordersDOList));
|
|
|
Map<Long,MktMarketingUrl> mktMarketMap=listMktMarketingUrls(ordersDOList,userMap);
|
|
|
for (UnionShareOrders userOrders : ordersDOList) {
|
|
|
String unionType=userMap.get(userOrders.getPromoteUid()).getUnionType();
|
|
|
ShareUserOrderDatailBO userOrderDatailBO = new ShareUserOrderDatailBO();
|
|
|
userOrderDatailBO.setUnionType(unionType);
|
|
|
MktMarketingUrl mktMarketingUrl = redisValueCache.get("yh:union:uniontype:" + unionType, MktMarketingUrl.class);
|
|
|
if (mktMarketingUrl == null && isLong(unionType)) {
|
|
|
mktMarketingUrl = mktMarketMap.get(Long.valueOf(unionType));
|
|
|
if(null!=mktMarketingUrl){
|
|
|
redisValueCache.set("yh:union:uniontype:" + unionType, mktMarketingUrl, 1, TimeUnit.HOURS);
|
|
|
}
|
|
|
}
|
|
|
if (mktMarketingUrl != null) {
|
|
|
userOrderDatailBO.setUnionName(mktMarketingUrl.getName());
|
|
|
userOrderDatailBO.setChannelType(mktMarketingUrl.getChannelType());
|
|
|
}
|
|
|
userOrderDatailBO.setOrderCode(userOrders.getOrderCode());
|
|
|
userOrderDatailBOMap.put(userOrderDatailBO.getOrderCode(),userOrderDatailBO);
|
|
|
MktMarketingUrl mktMarketingUrl = isLong(unionType)?mktMarketMap.get(Long.valueOf(unionType)):null;
|
|
|
UnionShareOrderRspBO bo=initShareUnionOrderRspBO(unionType,mktMarketingUrl,userOrders);
|
|
|
unionOrderRspBOList.add(bo);
|
|
|
}
|
|
|
return userOrderDatailBOMap;
|
|
|
return unionOrderRspBOList;
|
|
|
}
|
|
|
|
|
|
private Map<Long,MktMarketingUrl> listMktMarketingUrls(Map<String,UnionShareOrders> ordersDOMap, Map<Integer,UnionShareUser> userMap){
|
|
|
private Map<Long,MktMarketingUrl> listMktMarketingUrls(List<UnionShareOrders> ordersDOList, Map<Integer,UnionShareUser> userMap){
|
|
|
List<String> unionTypes=new ArrayList<>();
|
|
|
for (UnionShareOrders userOrders : ordersDOMap.values()) {
|
|
|
for (UnionShareOrders userOrders : ordersDOList) {
|
|
|
String unionType=userMap.get(userOrders.getPromoteUid()).getUnionType();
|
|
|
if(StringUtils.isNotBlank(unionType)){
|
|
|
unionTypes.add(unionType);
|
...
|
...
|
@@ -815,9 +792,9 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
}
|
|
|
private List<UnionShareOrderRspBO> queryUnionShareOrderRspBOForExport(UnionShareOrderSearchReqBO reqBO){
|
|
|
UnionShareOrderSearchBo bo=initUnionShareOrderSearchBo(reqBO);
|
|
|
Map<String,UnionShareOrders> ordersDOMap=null;
|
|
|
List<UnionShareOrders> ordersDOList=null;
|
|
|
if(bo.getIdList()!=null&&!bo.getIdList().isEmpty()){
|
|
|
ordersDOMap= this.unionShareOrdersMapper.selectListByIds(bo.getIdList());
|
|
|
ordersDOList= this.unionShareOrdersMapper.selectListByIds(bo.getIdList());
|
|
|
}else{
|
|
|
Integer uid=null;
|
|
|
if(bo.getUnionType()!=null || bo.getUnionName()!=null){
|
...
|
...
|
@@ -826,8 +803,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
ordersDOMap=this.unionShareOrdersMapper.selectAllListByUids(bo.getBeginTime(), bo.getEndTime(), uid, bo.getOrderCode());
|
|
|
ordersDOList=this.unionShareOrdersMapper.selectAllListByUids(bo.getBeginTime(), bo.getEndTime(), uid, bo.getOrderCode());
|
|
|
}
|
|
|
return ordersDOMap.isEmpty()?null:queryUnionShareOrderRsp(ordersDOMap);
|
|
|
return ordersDOList.isEmpty()?null: queryUnionShareOrderRspBO(ordersDOList);
|
|
|
}
|
|
|
} |
...
|
...
|
|