|
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.zanxiang.erp.security.util.SecurityUtil;
|
|
|
+import com.zanxiang.game.module.base.pojo.enums.GameAuthEnum;
|
|
|
import com.zanxiang.game.module.base.pojo.enums.GameCategoryEnum;
|
|
|
import com.zanxiang.game.module.base.pojo.enums.PayDeviceEnum;
|
|
|
import com.zanxiang.game.module.base.pojo.enums.PayWayEnum;
|
|
@@ -73,6 +74,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
@Autowired
|
|
|
private IGameServerService gameServerService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IGameAuthService gameAuthService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<UserOrderListVO> orderList(UserOrderListParam param) {
|
|
|
//执行查询
|
|
@@ -106,10 +110,16 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
@Override
|
|
|
public OrderListVO orderList(OrderParam param) {
|
|
|
+ //游戏获取
|
|
|
+ Tuple2<String, List<Long>> gameTuple = gameAuthService.getUserGameList(param.getPitcherId());
|
|
|
+ if (CollectionUtils.isEmpty(gameTuple.getT2())) {
|
|
|
+ return new OrderListVO(param.toPage().getSize());
|
|
|
+ }
|
|
|
//渠道获取
|
|
|
Tuple2<List<Long>, List<AgentDTO>> tuple2 = agentService.getUserAgent(param.getAccountId(), param.getPitcherId(), param.getChannelId());
|
|
|
List<Long> agentIds = tuple2.getT1();
|
|
|
- if (CollectionUtils.isEmpty(agentIds)) {
|
|
|
+ //投手没有渠道, 看不见数据
|
|
|
+ if (Objects.equals(gameTuple.getT1(), GameAuthEnum.OPERATE.getValue()) && CollectionUtils.isEmpty(agentIds)) {
|
|
|
return new OrderListVO(param.toPage().getSize());
|
|
|
}
|
|
|
//查询用户id和名字条件
|
|
@@ -122,12 +132,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//区服筛选
|
|
|
List<String> serverIdList = gameServerService.listServerId(param.getGameId(), param.getServerName());
|
|
|
//查询订单列表
|
|
|
- IPage<OrderVO> page = page(param.toPage(), getListWrapper(param, agentIds, userIds, serverIdList, "*")).convert(this::toVO);
|
|
|
+ IPage<OrderVO> page = page(param.toPage(), getListWrapper(param, gameTuple, agentIds, userIds, serverIdList, "*")).convert(this::toVO);
|
|
|
if (page.getTotal() == 0) {
|
|
|
return new OrderListVO(param.toPage().getSize());
|
|
|
}
|
|
|
//统计:订单金额与实付金额
|
|
|
- Order total = super.getOne(getListWrapper(param, agentIds, userIds, serverIdList, "IFNULL(SUM(amount),0) amount, IFNULL(SUM(real_amount),0) realAmount"));
|
|
|
+ Order total = super.getOne(getListWrapper(param, gameTuple, agentIds, userIds, serverIdList, "IFNULL(SUM(amount),0) amount, IFNULL(SUM(real_amount),0) realAmount"));
|
|
|
HashMap<String, BigDecimal> totalData = new HashMap<>(2);
|
|
|
if (total == null) {
|
|
|
totalData.put("totalOrderAmount", new BigDecimal("0.00"));
|
|
@@ -223,9 +233,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private LambdaQueryWrapper<Order> getListWrapper(OrderParam param, List<Long> agentIdList, List<Long> userIdList,
|
|
|
- List<String> serverIdList, String select) {
|
|
|
+ private LambdaQueryWrapper<Order> getListWrapper(OrderParam param, Tuple2<String, List<Long>> gameTuple, List<Long> agentIdList,
|
|
|
+ List<Long> userIdList, List<String> serverIdList, String select) {
|
|
|
return new QueryWrapper<Order>().select(select).lambda()
|
|
|
+ .in(!SecurityUtil.isAdmin(), Order::getGameId, gameTuple.getT2())
|
|
|
.eq(Strings.isNotBlank(param.getOrderId()), Order::getOrderId, param.getOrderId())
|
|
|
.eq(Strings.isNotBlank(param.getCpOrderId()), Order::getCpOrderId, param.getCpOrderId())
|
|
|
.eq(Strings.isNotBlank(param.getMerchantOrderNo()), Order::getMerchantOrderNo, param.getMerchantOrderNo())
|
|
@@ -236,7 +247,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
.like(Strings.isNotBlank(param.getRoleName()), Order::getRoleName, param.getRoleName())
|
|
|
.eq(param.getCpId() != null, Order::getCpId, param.getCpId())
|
|
|
.eq(param.getGameId() != null, Order::getGameId, param.getGameId())
|
|
|
- .in(CollectionUtils.isNotEmpty(agentIdList), Order::getAgentId, agentIdList)
|
|
|
+ .in(Objects.equals(gameTuple.getT1(), GameAuthEnum.OPERATE.getValue()), Order::getAgentId, agentIdList)
|
|
|
.eq(Strings.isNotBlank(param.getDeviceSystem()), Order::getDeviceSystem, param.getDeviceSystem())
|
|
|
.eq(param.getIsSwitch() != null, Order::getIsSwitch, param.getIsSwitch())
|
|
|
.eq(Strings.isNotBlank(param.getProductName()), Order::getProductName, param.getProductName())
|
|
@@ -262,6 +273,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
if (!SecurityUtil.isAdmin()) {
|
|
|
throw new BaseException("没有下载权限");
|
|
|
}
|
|
|
+ //游戏获取
|
|
|
+ Tuple2<String, List<Long>> gameTuple = gameAuthService.getUserGameList(param.getPitcherId());
|
|
|
+ List<Long> gameIdList = gameTuple.getT2();
|
|
|
+ if (CollectionUtils.isEmpty(gameIdList)) {
|
|
|
+ throw new BaseException("参数错误, 未配置游戏权限");
|
|
|
+ }
|
|
|
//渠道获取
|
|
|
Tuple2<List<Long>, List<AgentDTO>> tuple2 = agentService.getUserAgent(param.getAccountId(), param.getPitcherId(), param.getChannelId());
|
|
|
List<Long> agentIds = tuple2.getT1();
|
|
@@ -277,8 +294,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
//excel下载
|
|
|
WebExcelUtil.httpExport(response, "游戏订单", OrderExcelVO.class, ((pageNumber, pageSize) -> {
|
|
|
//查询订单
|
|
|
- List<OrderVO> orderVOList = page(new Page<>(pageNumber, pageSize), this.getListWrapper(param, agentIds, userIds, serverIdList, "*"))
|
|
|
- .convert(this::toVO).getRecords();
|
|
|
+ List<OrderVO> orderVOList = page(new Page<>(pageNumber, pageSize), this.getListWrapper(param, gameTuple,
|
|
|
+ agentIds, userIds, serverIdList, "*")).convert(this::toVO).getRecords();
|
|
|
//商户列表
|
|
|
Map<String, PayMerchantDTO> payMerchantMap = payMerchantService.payMerchantMap();
|
|
|
//cp信息
|