|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.zanxiang.game.module.base.pojo.enums.CpStatusEnum;
|
|
import com.zanxiang.game.module.base.pojo.enums.CpStatusEnum;
|
|
import com.zanxiang.game.module.mybatis.entity.*;
|
|
import com.zanxiang.game.module.mybatis.entity.*;
|
|
import com.zanxiang.game.module.sdk.enums.OrderStateEnum;
|
|
import com.zanxiang.game.module.sdk.enums.OrderStateEnum;
|
|
|
|
+import com.zanxiang.game.module.sdk.pojo.dto.GameAppletDTO;
|
|
import com.zanxiang.game.module.sdk.pojo.dto.PayMerchantDTO;
|
|
import com.zanxiang.game.module.sdk.pojo.dto.PayMerchantDTO;
|
|
import com.zanxiang.game.module.sdk.pojo.dto.PlatformOrderDTO;
|
|
import com.zanxiang.game.module.sdk.pojo.dto.PlatformOrderDTO;
|
|
import com.zanxiang.game.module.sdk.pojo.result.PushCpResult;
|
|
import com.zanxiang.game.module.sdk.pojo.result.PushCpResult;
|
|
@@ -62,6 +63,12 @@ public class PerformOrderServiceImpl implements IPerformOrderService {
|
|
@Autowired
|
|
@Autowired
|
|
private IGameExtService gameExtService;
|
|
private IGameExtService gameExtService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IMiPaySumService miPaySumService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IGameAppletService gameAppletService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = {RuntimeException.class, Exception.class})
|
|
@Transactional(rollbackFor = {RuntimeException.class, Exception.class})
|
|
public Boolean pushCp(PlatformOrderDTO orderInfo) {
|
|
public Boolean pushCp(PlatformOrderDTO orderInfo) {
|
|
@@ -158,6 +165,7 @@ public class PerformOrderServiceImpl implements IPerformOrderService {
|
|
log.info("订单:{} 验证订单是否为首充成功", platformOrderDTO.getOrderId());
|
|
log.info("订单:{} 验证订单是否为首充成功", platformOrderDTO.getOrderId());
|
|
return Boolean.TRUE;
|
|
return Boolean.TRUE;
|
|
}
|
|
}
|
|
|
|
+ log.info("订单:{} 检查更新用户是否为首充 ----------end---------", platformOrderDTO.getOrderId());
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("订单:{} 验证订单是否为首充失败 e:{}", platformOrderDTO.getOrderId(), e);
|
|
log.error("订单:{} 验证订单是否为首充失败 e:{}", platformOrderDTO.getOrderId(), e);
|
|
}
|
|
}
|
|
@@ -166,55 +174,56 @@ public class PerformOrderServiceImpl implements IPerformOrderService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = {RuntimeException.class, Exception.class})
|
|
@Transactional(rollbackFor = {RuntimeException.class, Exception.class})
|
|
- public Boolean userRechargeTotal(PlatformOrderDTO orderInfo) {
|
|
|
|
- log.info("订单:{} 更新用户充值统计 ----------start---------", orderInfo.getOrderId());
|
|
|
|
|
|
+ public Boolean userRechargeTotal(PlatformOrderDTO platformOrderDTO) {
|
|
|
|
+ log.info("订单:{} 更新用户充值统计 ----------start---------", platformOrderDTO.getOrderId());
|
|
try {
|
|
try {
|
|
//订单取消情况 做减法
|
|
//订单取消情况 做减法
|
|
- float amount = orderInfo.getAmount().floatValue();
|
|
|
|
|
|
+ float amount = platformOrderDTO.getAmount().floatValue();
|
|
int num = 1;
|
|
int num = 1;
|
|
//游戏用户角色统计更新
|
|
//游戏用户角色统计更新
|
|
- if (Strings.isNotBlank(orderInfo.getRoleId()) && !"0".equals(orderInfo.getRoleId())) {
|
|
|
|
|
|
+ if (Strings.isNotBlank(platformOrderDTO.getRoleId()) && !"0".equals(platformOrderDTO.getRoleId())) {
|
|
GameUserRole gameUserRole = new GameUserRole();
|
|
GameUserRole gameUserRole = new GameUserRole();
|
|
- gameUserRole.setRoleId(orderInfo.getRoleId());
|
|
|
|
|
|
+ gameUserRole.setRoleId(platformOrderDTO.getRoleId());
|
|
gameUserRoleService.update(gameUserRole, new UpdateWrapper<GameUserRole>().lambda()
|
|
gameUserRoleService.update(gameUserRole, new UpdateWrapper<GameUserRole>().lambda()
|
|
- .set(GameUserRole::getLastRechargeTime, orderInfo.getPayTime())
|
|
|
|
|
|
+ .set(GameUserRole::getLastRechargeTime, platformOrderDTO.getPayTime())
|
|
.setSql("recharge_count=recharge_count+" + num)
|
|
.setSql("recharge_count=recharge_count+" + num)
|
|
.setSql("recharge_money=recharge_money+" + amount)
|
|
.setSql("recharge_money=recharge_money+" + amount)
|
|
.setEntity(gameUserRole));
|
|
.setEntity(gameUserRole));
|
|
} else {
|
|
} else {
|
|
- log.info("订单:{} 用户玩家角色RoleId为空,不进行gameUserRole充值统计汇总", orderInfo.getOrderId());
|
|
|
|
|
|
+ log.info("订单:{} 用户玩家角色RoleId为空,不进行gameUserRole充值统计汇总", platformOrderDTO.getOrderId());
|
|
}
|
|
}
|
|
//游戏用户统计更新
|
|
//游戏用户统计更新
|
|
- if (orderInfo.getMgUserId() != null) {
|
|
|
|
|
|
+ if (platformOrderDTO.getMgUserId() != null) {
|
|
GameUser gameUser = new GameUser();
|
|
GameUser gameUser = new GameUser();
|
|
- gameUser.setId(orderInfo.getMgUserId());
|
|
|
|
|
|
+ gameUser.setId(platformOrderDTO.getMgUserId());
|
|
gameUserService.update(gameUser, new UpdateWrapper<GameUser>().lambda()
|
|
gameUserService.update(gameUser, new UpdateWrapper<GameUser>().lambda()
|
|
- .set(GameUser::getLastRechargeTime, orderInfo.getPayTime())
|
|
|
|
|
|
+ .set(GameUser::getLastRechargeTime, platformOrderDTO.getPayTime())
|
|
.setSql("recharge_count=recharge_count+" + num)
|
|
.setSql("recharge_count=recharge_count+" + num)
|
|
.setSql("recharge_money=recharge_money+" + amount)
|
|
.setSql("recharge_money=recharge_money+" + amount)
|
|
.setEntity(gameUser)
|
|
.setEntity(gameUser)
|
|
);
|
|
);
|
|
} else {
|
|
} else {
|
|
- log.info("订单:{} 用户玩家MgUserId为空,不进行gameUser充值统计汇总", orderInfo.getOrderId());
|
|
|
|
|
|
+ log.info("订单:{} 用户玩家MgUserId为空,不进行gameUser充值统计汇总", platformOrderDTO.getOrderId());
|
|
}
|
|
}
|
|
//用户统计更新
|
|
//用户统计更新
|
|
- if (orderInfo.getUserId() != null) {
|
|
|
|
|
|
+ if (platformOrderDTO.getUserId() != null) {
|
|
User user = new User();
|
|
User user = new User();
|
|
- user.setId(orderInfo.getUserId());
|
|
|
|
|
|
+ user.setId(platformOrderDTO.getUserId());
|
|
userService.update(user, new UpdateWrapper<User>().lambda()
|
|
userService.update(user, new UpdateWrapper<User>().lambda()
|
|
- .set(User::getLastRechargeTime, orderInfo.getPayTime())
|
|
|
|
|
|
+ .set(User::getLastRechargeTime, platformOrderDTO.getPayTime())
|
|
.setSql("recharge_count=recharge_count+" + num)
|
|
.setSql("recharge_count=recharge_count+" + num)
|
|
.setSql("recharge_money=recharge_money+" + amount)
|
|
.setSql("recharge_money=recharge_money+" + amount)
|
|
.setEntity(user)
|
|
.setEntity(user)
|
|
);
|
|
);
|
|
} else {
|
|
} else {
|
|
- log.info("订单:{} 用户UserId为空,不进行User充值统计汇总", orderInfo.getOrderId());
|
|
|
|
|
|
+ log.info("订单:{} 用户UserId为空,不进行User充值统计汇总", platformOrderDTO.getOrderId());
|
|
}
|
|
}
|
|
- return true;
|
|
|
|
|
|
+ log.info("订单:{} 更新用户充值统计 ----------end---------", platformOrderDTO.getOrderId());
|
|
|
|
+ return Boolean.TRUE;
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- log.error("订单:{} 用户充值统计逻辑操作失败 e:{}", orderInfo.getOrderId(), e);
|
|
|
|
|
|
+ log.error("订单:{} 用户充值统计逻辑操作失败 e:{}", platformOrderDTO.getOrderId(), e);
|
|
}
|
|
}
|
|
- return false;
|
|
|
|
|
|
+ return Boolean.FALSE;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -264,4 +273,62 @@ public class PerformOrderServiceImpl implements IPerformOrderService {
|
|
}
|
|
}
|
|
return Boolean.FALSE;
|
|
return Boolean.FALSE;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
|
|
|
|
+ public Boolean miPayTotal(PlatformOrderDTO platformOrderDTO) {
|
|
|
|
+ log.info("订单:{} 更新米大师统计 ----------start---------", platformOrderDTO.getOrderId());
|
|
|
|
+ try {
|
|
|
|
+ //获取米大师统计信息
|
|
|
|
+ GameAppletDTO gameAppletDTO = gameAppletService.getByGameId(platformOrderDTO.getGameId());
|
|
|
|
+ GameAppletDTO.MiPayConfigBean miPayConfigBean = gameAppletDTO.getMiPayConfigBean();
|
|
|
|
+ if (miPayConfigBean == null) {
|
|
|
|
+ log.error("米大师支付统计失败, 米大师配置信息不存在");
|
|
|
|
+ return Boolean.FALSE;
|
|
|
|
+ }
|
|
|
|
+ MiPaySum miPaySum = miPaySumService.getOne(new LambdaQueryWrapper<MiPaySum>()
|
|
|
|
+ .eq(MiPaySum::getGameId, gameAppletDTO.getGameId())
|
|
|
|
+ .eq(MiPaySum::getAppId, gameAppletDTO.getAppId())
|
|
|
|
+ .eq(MiPaySum::getMiPayAppId, miPayConfigBean.getAppId()));
|
|
|
|
+ //商户额度数据统计
|
|
|
|
+ BigDecimal amount = platformOrderDTO.getAmount();
|
|
|
|
+ LocalDateTime updateTime = miPaySum.getDayUpdateDate();
|
|
|
|
+ LocalDateTime dateTime = LocalDateTime.now();
|
|
|
|
+ String totalPayAmount, mouthPayAmount, weakerPayAmount, dayPayAmount;
|
|
|
|
+ //累计
|
|
|
|
+ totalPayAmount = " total_pay_amount = total_pay_amount + " + amount;
|
|
|
|
+ dayPayAmount = " day_pay_amount = day_pay_amount + " + amount;
|
|
|
|
+ weakerPayAmount = " weaker_pay_amount = weaker_pay_amount + " + amount;
|
|
|
|
+ mouthPayAmount = " mouth_pay_amount = mouth_pay_amount + " + amount;
|
|
|
|
+ //统计过期限, 重新赋值
|
|
|
|
+ if (updateTime != null) {
|
|
|
|
+ if (!DateUtils.isToday(miPaySum.getDayUpdateDate())) {
|
|
|
|
+ dayPayAmount = " day_pay_amount = " + amount;
|
|
|
|
+ }
|
|
|
|
+ if (!DateUtils.isThisWeek(miPaySum.getWeakerUpdateDate())) {
|
|
|
|
+ weakerPayAmount = " weaker_pay_amount = " + amount;
|
|
|
|
+ }
|
|
|
|
+ if (!DateUtils.isThisMonth(miPaySum.getMouthUpdateDate())) {
|
|
|
|
+ mouthPayAmount = " mouth_pay_amount = " + amount;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //更新商户表
|
|
|
|
+ miPaySumService.update(new LambdaUpdateWrapper<MiPaySum>()
|
|
|
|
+ .set(MiPaySum::getMouthUpdateDate, dateTime)
|
|
|
|
+ .set(MiPaySum::getWeakerUpdateDate, dateTime)
|
|
|
|
+ .set(MiPaySum::getDayUpdateDate, dateTime)
|
|
|
|
+ .setSql(totalPayAmount)
|
|
|
|
+ .setSql(mouthPayAmount)
|
|
|
|
+ .setSql(weakerPayAmount)
|
|
|
|
+ .setSql(dayPayAmount)
|
|
|
|
+ .eq(MiPaySum::getGameId, gameAppletDTO.getGameId())
|
|
|
|
+ .eq(MiPaySum::getAppId, gameAppletDTO.getAppId())
|
|
|
|
+ .eq(MiPaySum::getMiPayAppId, miPayConfigBean.getAppId()));
|
|
|
|
+ log.info("订单:{} 更新米大师统计 ----------end---------", platformOrderDTO.getOrderId());
|
|
|
|
+ return Boolean.TRUE;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("订单:{} 更新米大师统计异常 e:{}", platformOrderDTO.getOrderId(), e);
|
|
|
|
+ }
|
|
|
|
+ return Boolean.FALSE;
|
|
|
|
+ }
|
|
}
|
|
}
|