|  | @@ -15,10 +15,12 @@ import com.zanxiang.game.back.serve.dao.mapper.GameOceanengineOrderLogMapper;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.back.serve.oceanengine.MiniGameCallback;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.back.serve.oceanengine.OceanengineCallbackException;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.back.serve.pojo.dto.GameOceanengineOrderLogDTO;
 | 
	
		
			
				|  |  | +import com.zanxiang.game.back.serve.pojo.dto.OrderReportDTO;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.back.serve.pojo.entity.*;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.back.serve.pojo.enums.BackStatusEnum;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.back.serve.pojo.enums.BackUnitEnum;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.back.serve.pojo.vo.GameOceanengineOrderLogVO;
 | 
	
		
			
				|  |  | +import com.zanxiang.game.back.serve.pojo.vo.GameOceanengineOrderSplitLogVO;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.back.serve.service.IGameBackPolicyService;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.back.serve.service.IGameOceanengineBackLogService;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.back.serve.service.IGameOceanengineOrderLogService;
 | 
	
	
		
			
				|  | @@ -29,15 +31,19 @@ import com.zanxiang.game.back.serve.utils.OrderUtil;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.module.base.ServerInfo;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.module.base.pojo.vo.AgentRpcVO;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.module.base.rpc.IAgentRpc;
 | 
	
		
			
				|  |  | +import com.zanxiang.module.util.JsonUtil;
 | 
	
		
			
				|  |  | +import com.zanxiang.module.util.NumberUtil;
 | 
	
		
			
				|  |  |  import com.zanxiang.module.util.bean.BeanUtil;
 | 
	
		
			
				|  |  |  import lombok.extern.slf4j.Slf4j;
 | 
	
		
			
				|  |  |  import org.apache.commons.collections4.CollectionUtils;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang3.RandomUtils;
 | 
	
		
			
				|  |  |  import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.apache.dubbo.config.annotation.DubboReference;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import java.math.BigDecimal;
 | 
	
		
			
				|  |  |  import java.time.LocalDateTime;
 | 
	
		
			
				|  |  |  import java.time.LocalTime;
 | 
	
		
			
				|  |  |  import java.util.ArrayList;
 | 
	
	
		
			
				|  | @@ -177,23 +183,54 @@ public class GameOceanengineOrderLogServiceImpl extends ServiceImpl<GameOceaneng
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public boolean oceanengineOrderReport(List<Long> ids, Long backMoney) {
 | 
	
		
			
				|  |  | -        listByIds(ids).stream()
 | 
	
		
			
				|  |  | +    public boolean oceanengineOrderReport(OrderReportDTO dto) {
 | 
	
		
			
				|  |  | +        listByIds(dto.getOrderIds()).stream()
 | 
	
		
			
				|  |  |                  .filter(order -> !Objects.equals(order.getBackStatus(), BackStatusEnum.SUCCESS.getBackStatus()))
 | 
	
		
			
				|  |  |                  .forEach(orderLog -> {
 | 
	
		
			
				|  |  | -                    log.error("手动回传:{}-{}", orderLog.getId(), backMoney);
 | 
	
		
			
				|  |  | -                    orderLog.setBackMoney(backMoney);
 | 
	
		
			
				|  |  | -                    Tuple2<BackStatusEnum, String> backResult = doCallback(orderLog, backMoney);
 | 
	
		
			
				|  |  | -                    String backMsg = "手动触发回传";
 | 
	
		
			
				|  |  | -                    if (StringUtils.isNotBlank(backResult.second)) {
 | 
	
		
			
				|  |  | -                        backMsg += ("回传失败:" + backResult.second);
 | 
	
		
			
				|  |  | +                    if (dto.getSplitOrder()) {
 | 
	
		
			
				|  |  | +                        log.error("手动拆单回传:{}-{}", orderLog.getId(), StringUtils.join(dto.getSplitMoney(), ","));
 | 
	
		
			
				|  |  | +                        List<GameOceanengineOrderSplitLog> splitOrderLogList = new ArrayList<>(dto.getSplitMoney().size());
 | 
	
		
			
				|  |  | +                        LocalDateTime beginTime = LocalDateTime.now();
 | 
	
		
			
				|  |  | +                        long backMoneyTotal = 0L;
 | 
	
		
			
				|  |  | +                        for (int i = 0; i < dto.getSplitMoney().size(); i++) {
 | 
	
		
			
				|  |  | +                            long backMoney = NumberUtil.multiply100(dto.getSplitMoney().get(i)).longValue();
 | 
	
		
			
				|  |  | +                            backMoneyTotal += backMoney;
 | 
	
		
			
				|  |  | +                            LocalDateTime backTime = beginTime;
 | 
	
		
			
				|  |  | +                            splitOrderLogList.add(GameOceanengineOrderSplitLog.builder()
 | 
	
		
			
				|  |  | +                                    .backDay(backTime.toLocalDate())
 | 
	
		
			
				|  |  | +                                    .orderNo(orderLog.getOrderNo())
 | 
	
		
			
				|  |  | +                                    .backIndex(i + 1)
 | 
	
		
			
				|  |  | +                                    .backCount(dto.getSplitMoney().size())
 | 
	
		
			
				|  |  | +                                    .splitMoney(backMoney)
 | 
	
		
			
				|  |  | +                                    .backTime(backTime)
 | 
	
		
			
				|  |  | +                                    .backStatus(BackStatusEnum.NO.getBackStatus())
 | 
	
		
			
				|  |  | +                                    .createTime(LocalDateTime.now())
 | 
	
		
			
				|  |  | +                                    .build()
 | 
	
		
			
				|  |  | +                            );
 | 
	
		
			
				|  |  | +                            beginTime = beginTime.plusMinutes(RandomUtils.nextInt(3, 10));
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        gameOceanengineOrderSplitLogService.saveBatch(splitOrderLogList);
 | 
	
		
			
				|  |  | +                        update(new LambdaUpdateWrapper<GameOceanengineOrderLog>()
 | 
	
		
			
				|  |  | +                                .set(GameOceanengineOrderLog::getBackStatus, BackStatusEnum.NO.getBackStatus())
 | 
	
		
			
				|  |  | +                                .set(GameOceanengineOrderLog::getBackMoney, backMoneyTotal)
 | 
	
		
			
				|  |  | +                                .set(GameOceanengineOrderLog::getBackMsg, "手动触发回传(拆单回传)")
 | 
	
		
			
				|  |  | +                                .eq(GameOceanengineOrderLog::getId, orderLog.getId())
 | 
	
		
			
				|  |  | +                        );
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        log.error("手动直接回传:{}-{}", orderLog.getId(), dto.getBackMoney());
 | 
	
		
			
				|  |  | +                        long backMoney = NumberUtil.multiply100(dto.getBackMoney()).longValue();
 | 
	
		
			
				|  |  | +                        Tuple2<BackStatusEnum, String> backResult = doCallback(orderLog, backMoney);
 | 
	
		
			
				|  |  | +                        String backMsg = "手动触发回传";
 | 
	
		
			
				|  |  | +                        if (StringUtils.isNotBlank(backResult.second)) {
 | 
	
		
			
				|  |  | +                            backMsg += ("回传失败:" + backResult.second);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        update(new LambdaUpdateWrapper<GameOceanengineOrderLog>()
 | 
	
		
			
				|  |  | +                                .set(GameOceanengineOrderLog::getBackStatus, backResult.first.getBackStatus())
 | 
	
		
			
				|  |  | +                                .set(GameOceanengineOrderLog::getBackMoney, backMoney)
 | 
	
		
			
				|  |  | +                                .set(GameOceanengineOrderLog::getBackMsg, backMsg)
 | 
	
		
			
				|  |  | +                                .eq(GameOceanengineOrderLog::getId, orderLog.getId())
 | 
	
		
			
				|  |  | +                        );
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | -                    update(new LambdaUpdateWrapper<GameOceanengineOrderLog>()
 | 
	
		
			
				|  |  | -                            .set(GameOceanengineOrderLog::getBackStatus, backResult.first.getBackStatus())
 | 
	
		
			
				|  |  | -                            .set(GameOceanengineOrderLog::getBackMoney, backMoney)
 | 
	
		
			
				|  |  | -                            .set(GameOceanengineOrderLog::getBackMsg, backMsg)
 | 
	
		
			
				|  |  | -                            .eq(GameOceanengineOrderLog::getId, orderLog.getId())
 | 
	
		
			
				|  |  | -                    );
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  |          return true;
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -261,6 +298,7 @@ public class GameOceanengineOrderLogServiceImpl extends ServiceImpl<GameOceaneng
 | 
	
		
			
				|  |  |          if (CollectionUtils.isEmpty(logList)) {
 | 
	
		
			
				|  |  |              return Collections.emptyList();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        List<GameOceanengineOrderSplitLogVO> orderSplitList = gameOceanengineOrderSplitLogService.listByOrderNo(logList.stream().map(GameOceanengineOrderLog::getOrderNo).collect(Collectors.toSet()));
 | 
	
		
			
				|  |  |          Set<String> agentKeys = logList.stream().map(GameOceanengineOrderLog::getAgentKey).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
 | 
	
		
			
				|  |  |          Map<String, AgentRpcVO> agentMap = CollectionUtils.isEmpty(agentKeys) ? Collections.emptyMap() : agentRpc.getByAgentKeys(new ArrayList<>(agentKeys))
 | 
	
		
			
				|  |  |                  .getData().stream().collect(Collectors.toMap(AgentRpcVO::getAgentKey, Function.identity()));
 | 
	
	
		
			
				|  | @@ -271,7 +309,10 @@ public class GameOceanengineOrderLogServiceImpl extends ServiceImpl<GameOceaneng
 | 
	
		
			
				|  |  |                  if (agent != null) {
 | 
	
		
			
				|  |  |                      vo.setAgentName(agent.getAgentName());
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            List<GameOceanengineOrderSplitLogVO> splitList = orderSplitList.stream().filter(obj -> obj.getOrderNo().equals(log.getOrderNo())).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +            vo.setSplitOrderList(splitList);
 | 
	
		
			
				|  |  |              return vo;
 | 
	
		
			
				|  |  |          }).collect(Collectors.toList());
 | 
	
		
			
				|  |  |  
 |