|
@@ -54,7 +54,7 @@ public class PlatformDeYangService extends PlatformBaseService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public boolean syncOrderByAccount(GamePlatform gamePlatform, GamePlatformAccount account, LocalDateTime startDate, LocalDateTime endDate) {
|
|
|
|
|
|
+ public void syncOrderByAccount(GamePlatform gamePlatform, GamePlatformAccount account, LocalDateTime startDate, LocalDateTime endDate) {
|
|
Map<String, String> platformParam = JsonUtil.toMap(gamePlatform.getConfigParam(), Map.class, String.class);
|
|
Map<String, String> platformParam = JsonUtil.toMap(gamePlatform.getConfigParam(), Map.class, String.class);
|
|
Map<String, String> accountParam = JsonUtil.toMap(account.getConfigParam(), Map.class, String.class);
|
|
Map<String, String> accountParam = JsonUtil.toMap(account.getConfigParam(), Map.class, String.class);
|
|
startDate = startDate == null ? LocalDateTime.of(gamePlatform.getBeginTime(), LocalTime.MIDNIGHT) : startDate;
|
|
startDate = startDate == null ? LocalDateTime.of(gamePlatform.getBeginTime(), LocalTime.MIDNIGHT) : startDate;
|
|
@@ -80,33 +80,34 @@ public class PlatformDeYangService extends PlatformBaseService {
|
|
url = URIUtil.fillUrlParams(url, params, true);
|
|
url = URIUtil.fillUrlParams(url, params, true);
|
|
PlatformDeYangOrderRes res;
|
|
PlatformDeYangOrderRes res;
|
|
try {
|
|
try {
|
|
- res = restTemplate.getForObject(url, PlatformDeYangOrderRes.class);
|
|
|
|
|
|
+ String result = restTemplate.getForObject(url, String.class);
|
|
|
|
+ res = JsonUtil.toObj(result, PlatformDeYangOrderRes.class);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("同步德扬订单信息异常, accountId: {}, message: {}", account.getId(), e.getMessage());
|
|
log.error("同步德扬订单信息异常, accountId: {}, message: {}", account.getId(), e.getMessage());
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
if (res == null || CollectionUtils.isEmpty(res.getList())) {
|
|
if (res == null || CollectionUtils.isEmpty(res.getList())) {
|
|
- log.error("同步德扬订单信息,返回结果为空, accountId: {}, res : {}", account.getId(), JsonUtil.toString(res));
|
|
|
|
|
|
+ log.error("同步德扬订单信息,返回结果为空, accountId: {}, searchDate : {}, res : {}", account.getId(),
|
|
|
|
+ searchDate, JsonUtil.toString(res));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
//总页数赋值
|
|
//总页数赋值
|
|
- if (res.getTotalPage() != null) {
|
|
|
|
- totalPage = res.getTotalPage();
|
|
|
|
|
|
+ if (res.getAllpage() != null) {
|
|
|
|
+ totalPage = res.getAllpage();
|
|
}
|
|
}
|
|
//数据处理
|
|
//数据处理
|
|
- platformDeYangOrderService.saveOrUpdate(this.transformOrder(gamePlatform.getPlatformKey(), agentId, res.getList()));
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(res.getList())) {
|
|
|
|
+ platformDeYangOrderService.saveOrUpdate(this.transformOrder(gamePlatform.getPlatformKey(), res.getList()));
|
|
|
|
+ }
|
|
} while (page++ <= totalPage);
|
|
} while (page++ <= totalPage);
|
|
//日期递增
|
|
//日期递增
|
|
searchDate = searchDate.plusDays(1);
|
|
searchDate = searchDate.plusDays(1);
|
|
} while (!searchDate.isAfter(endDate.toLocalDate()));
|
|
} while (!searchDate.isAfter(endDate.toLocalDate()));
|
|
-
|
|
|
|
-
|
|
|
|
- return true;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public boolean syncUserByAccount(GamePlatform gamePlatform, GamePlatformAccount account, LocalDateTime startDate, LocalDateTime endDate) {
|
|
|
|
|
|
+ public void syncUserByAccount(GamePlatform gamePlatform, GamePlatformAccount account, LocalDateTime startDate, LocalDateTime endDate) {
|
|
startDate = startDate == null ? LocalDateTime.of(gamePlatform.getBeginTime(), LocalTime.MIDNIGHT) : startDate;
|
|
startDate = startDate == null ? LocalDateTime.of(gamePlatform.getBeginTime(), LocalTime.MIDNIGHT) : startDate;
|
|
endDate = endDate == null ? LocalDateTime.now() : endDate;
|
|
endDate = endDate == null ? LocalDateTime.now() : endDate;
|
|
Map<String, String> accountParam = JsonUtil.toMap(account.getConfigParam(), Map.class, String.class);
|
|
Map<String, String> accountParam = JsonUtil.toMap(account.getConfigParam(), Map.class, String.class);
|
|
@@ -132,26 +133,28 @@ public class PlatformDeYangService extends PlatformBaseService {
|
|
url = URIUtil.fillUrlParams(url, params, true);
|
|
url = URIUtil.fillUrlParams(url, params, true);
|
|
PlatformDeYangUserRes res;
|
|
PlatformDeYangUserRes res;
|
|
try {
|
|
try {
|
|
- res = restTemplate.getForObject(url, PlatformDeYangUserRes.class);
|
|
|
|
|
|
+ String result = restTemplate.getForObject(url, String.class);
|
|
|
|
+ res = JsonUtil.toObj(result, PlatformDeYangUserRes.class);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("同步德扬订单信息异常, accountId: {}, message: {}", account.getId(), e.getMessage());
|
|
log.error("同步德扬订单信息异常, accountId: {}, message: {}", account.getId(), e.getMessage());
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- if (res == null) {
|
|
|
|
|
|
+ if (res == null || CollectionUtils.isEmpty(res.getList())) {
|
|
log.error("同步德扬用户信息,返回结果为空, accountId: {}, res : {}", account.getId(), JsonUtil.toString(res));
|
|
log.error("同步德扬用户信息,返回结果为空, accountId: {}, res : {}", account.getId(), JsonUtil.toString(res));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
//总页数赋值
|
|
//总页数赋值
|
|
- if (res.getTotalPage() != null) {
|
|
|
|
- totalPage = res.getTotalPage();
|
|
|
|
|
|
+ if (res.getAllpage() != null) {
|
|
|
|
+ totalPage = res.getAllpage();
|
|
}
|
|
}
|
|
//数据处理
|
|
//数据处理
|
|
- platformDeYangUserService.saveOrUpdate(this.transformUser(gamePlatform.getPlatformKey(), agentId, res.getList()));
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(res.getList())) {
|
|
|
|
+ platformDeYangUserService.saveOrUpdate(this.transformUser(gamePlatform.getPlatformKey(), res.getList()));
|
|
|
|
+ }
|
|
} while (page++ <= totalPage);
|
|
} while (page++ <= totalPage);
|
|
//日期递增
|
|
//日期递增
|
|
searchDate = searchDate.plusDays(1);
|
|
searchDate = searchDate.plusDays(1);
|
|
} while (!searchDate.isAfter(endDate.toLocalDate()));
|
|
} while (!searchDate.isAfter(endDate.toLocalDate()));
|
|
- return true;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private String sign(String secret, Map<String, String> params) {
|
|
private String sign(String secret, Map<String, String> params) {
|
|
@@ -164,11 +167,10 @@ public class PlatformDeYangService extends PlatformBaseService {
|
|
}
|
|
}
|
|
temp.append(paramKey).append("=").append(params.get(paramKey)).append("&");
|
|
temp.append(paramKey).append("=").append(params.get(paramKey)).append("&");
|
|
}
|
|
}
|
|
- String res = temp.substring(0, temp.length() - 1) + secret;
|
|
|
|
- return Md5Util.encrypt32(res);
|
|
|
|
|
|
+ return Md5Util.encrypt32(temp.substring(0, temp.length() - 1) + secret);
|
|
}
|
|
}
|
|
|
|
|
|
- private List<PlatformDeYangOrder> transformOrder(String platformKey, String agentId, List<PlatformDeYangOrderDTO> orderList) {
|
|
|
|
|
|
+ private List<PlatformDeYangOrder> transformOrder(String platformKey, List<PlatformDeYangOrderDTO> orderList) {
|
|
if (CollectionUtils.isEmpty(orderList)) {
|
|
if (CollectionUtils.isEmpty(orderList)) {
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
}
|
|
}
|
|
@@ -188,11 +190,12 @@ public class PlatformDeYangService extends PlatformBaseService {
|
|
.tunnelId(order.getTunnel_id())
|
|
.tunnelId(order.getTunnel_id())
|
|
.productName(order.getProduct_name())
|
|
.productName(order.getProduct_name())
|
|
.touFangBack(order.getToufang_back())
|
|
.touFangBack(order.getToufang_back())
|
|
- .agentId(agentId)
|
|
|
|
|
|
+ .agentId(order.getAgent_id2())
|
|
|
|
+ .bankOrderNo(order.getBankOrderNo())
|
|
.build()).collect(Collectors.toList());
|
|
.build()).collect(Collectors.toList());
|
|
}
|
|
}
|
|
|
|
|
|
- private List<PlatformDeYangUser> transformUser(String platformKey, String agentId, List<PlatformDeYangUserDTO> userList) {
|
|
|
|
|
|
+ private List<PlatformDeYangUser> transformUser(String platformKey, List<PlatformDeYangUserDTO> userList) {
|
|
if (CollectionUtils.isEmpty(userList)) {
|
|
if (CollectionUtils.isEmpty(userList)) {
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
}
|
|
}
|
|
@@ -216,7 +219,7 @@ public class PlatformDeYangService extends PlatformBaseService {
|
|
.appId(user.getAppid())
|
|
.appId(user.getAppid())
|
|
.appName(user.getAppname())
|
|
.appName(user.getAppname())
|
|
.userAgent(user.getUser_agent())
|
|
.userAgent(user.getUser_agent())
|
|
- .agentId(agentId)
|
|
|
|
|
|
+ .agentId(user.getAgent_id2())
|
|
.build()).collect(Collectors.toList());
|
|
.build()).collect(Collectors.toList());
|
|
}
|
|
}
|
|
}
|
|
}
|