|
|
@@ -239,6 +239,7 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
map.put("prizeType",0); |
|
|
map.put("prizeType",0); |
|
|
map.put("gameWeight",couponChanObj.getInteger("weight")); |
|
|
map.put("gameWeight",couponChanObj.getInteger("weight")); |
|
|
map.put("credit",couponChanObj.getInteger("credit")); |
|
|
map.put("credit",couponChanObj.getInteger("credit")); |
|
|
|
|
|
map.put("couponId",couponChanObj.getLong("couponId")); |
|
|
couponIdsList.add(map); |
|
|
couponIdsList.add(map); |
|
|
}else{ |
|
|
}else{ |
|
|
Long couponId = couponChanObj.getLong("couponId"); |
|
|
Long couponId = couponChanObj.getLong("couponId"); |
|
|
@@ -412,7 +413,7 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Override |
|
|
@Override |
|
|
public ResultData luckDraw(Long gameId,Long userId){ |
|
|
|
|
|
|
|
|
public ResultData luckDraw(Long gameId,Long userId,Integer userCredit){ |
|
|
ResultData resultData = new ResultData(); |
|
|
ResultData resultData = new ResultData(); |
|
|
WxGame wxGame = this.getById(gameId); |
|
|
WxGame wxGame = this.getById(gameId); |
|
|
List<Object> couponIdsList = wxGame.getCouponIdsList(); |
|
|
List<Object> couponIdsList = wxGame.getCouponIdsList(); |
|
|
@@ -436,31 +437,29 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
Object data = resultData.data; |
|
|
Object data = resultData.data; |
|
|
|
|
|
Long orderId = 0L; |
|
|
|
|
|
Integer addCredit = 0; |
|
|
if(data != null){ |
|
|
if(data != null){ |
|
|
if(data instanceof Map){ |
|
|
if(data instanceof Map){ |
|
|
Map dataMap = (Map) data; |
|
|
Map dataMap = (Map) data; |
|
|
// Integer prizeType = (Integer) dataMap.get("prizeType"); |
|
|
// Integer prizeType = (Integer) dataMap.get("prizeType"); |
|
|
// if(prizeType != null && prizeType == 0){ |
|
|
// if(prizeType != null && prizeType == 0){ |
|
|
|
|
|
Integer credit = (Integer) dataMap.get("credit"); |
|
|
|
|
|
if(credit > 0){ |
|
|
WxCreditHistory wxCreditHistory = new WxCreditHistory(); |
|
|
WxCreditHistory wxCreditHistory = new WxCreditHistory(); |
|
|
wxCreditHistory.setTenantId(wxGame.getFinalTenantId()); |
|
|
wxCreditHistory.setTenantId(wxGame.getFinalTenantId()); |
|
|
wxCreditHistory.setCUserId(userId); |
|
|
wxCreditHistory.setCUserId(userId); |
|
|
wxCreditHistory.setOperatorId(userId); |
|
|
wxCreditHistory.setOperatorId(userId); |
|
|
wxCreditHistory.setOperatorType(EnumUserType.CUSER.getCode()); |
|
|
wxCreditHistory.setOperatorType(EnumUserType.CUSER.getCode()); |
|
|
wxCreditHistory.setCreditNum((Integer) dataMap.get("credit")); |
|
|
|
|
|
|
|
|
wxCreditHistory.setCreditNum(credit); |
|
|
wxCreditHistory.setCreditType(EnumScoreType.GAME_ADD_CREDIT.getCode()); |
|
|
wxCreditHistory.setCreditType(EnumScoreType.GAME_ADD_CREDIT.getCode()); |
|
|
wxCreditHistory.setChangePurpose(EnumScoreType.GAME_ADD_CREDIT.getMessage()); |
|
|
wxCreditHistory.setChangePurpose(EnumScoreType.GAME_ADD_CREDIT.getMessage()); |
|
|
wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),wxGame) ; |
|
|
wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),wxGame) ; |
|
|
WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory); |
|
|
|
|
|
|
|
|
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
|
|
WxGameActionLog wxGameActionLog = new WxGameActionLog(); |
|
|
|
|
|
wxGameActionLog.setId(idWorker.nextId()); |
|
|
|
|
|
wxGameActionLog.setUserId(userId); |
|
|
|
|
|
wxGameActionLog.updateTenantInfo(wxGame); |
|
|
|
|
|
wxGameActionLog.setGameId(gameId); |
|
|
|
|
|
wxGameActionLog.setCreateTime(new Date()); |
|
|
|
|
|
wxGameActionLog.setAddCredit(wxCreditHistory.getCreditNum()); |
|
|
|
|
|
wxGameActionLogMapper.insert(wxGameActionLog); |
|
|
|
|
|
|
|
|
wxCreditHistoryService.saveOrUpdate(wxCreditHistory); |
|
|
|
|
|
addCredit = credit; |
|
|
|
|
|
orderId = -1L; |
|
|
|
|
|
} |
|
|
|
|
|
resultData.data = null; |
|
|
// } |
|
|
// } |
|
|
|
|
|
|
|
|
}else if(data instanceof WxCouponChannelVo){ |
|
|
}else if(data instanceof WxCouponChannelVo){ |
|
|
@@ -469,25 +468,32 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
orderSaveDto.setCouponChannelId(vo.getId()); |
|
|
orderSaveDto.setCouponChannelId(vo.getId()); |
|
|
orderSaveDto.setCouponId(vo.getCouponId()); |
|
|
orderSaveDto.setCouponId(vo.getCouponId()); |
|
|
ResultData resultData1 = wxOrderService.saveOrder(orderSaveDto, userId, EnumPayWay.PAY_WAY_WECHAT, wxGame); |
|
|
ResultData resultData1 = wxOrderService.saveOrder(orderSaveDto, userId, EnumPayWay.PAY_WAY_WECHAT, wxGame); |
|
|
Long orderId = null; |
|
|
|
|
|
|
|
|
|
|
|
if(resultData1.code == Result.SUCCESS && resultData1.data != null && resultData1.data instanceof WxOrder){ |
|
|
if(resultData1.code == Result.SUCCESS && resultData1.data != null && resultData1.data instanceof WxOrder){ |
|
|
WxOrder order = (WxOrder)resultData1.data; |
|
|
WxOrder order = (WxOrder)resultData1.data; |
|
|
orderId = order.getId(); |
|
|
orderId = order.getId(); |
|
|
}else{ |
|
|
}else{ |
|
|
resultData.data = null; |
|
|
resultData.data = null; |
|
|
} |
|
|
} |
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
|
|
WxGameActionLog wxGameActionLog = new WxGameActionLog(); |
|
|
|
|
|
wxGameActionLog.setId(idWorker.nextId()); |
|
|
|
|
|
wxGameActionLog.setUserId(userId); |
|
|
|
|
|
wxGameActionLog.updateTenantInfo(wxGame); |
|
|
|
|
|
wxGameActionLog.setGameId(gameId); |
|
|
|
|
|
wxGameActionLog.setCreateTime(new Date()); |
|
|
|
|
|
wxGameActionLog.setCouponOrderId(orderId); |
|
|
|
|
|
wxGameActionLogMapper.insert(wxGameActionLog); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
|
|
WxGameActionLog wxGameActionLog = new WxGameActionLog(); |
|
|
|
|
|
wxGameActionLog.setId(idWorker.nextId()); |
|
|
|
|
|
wxGameActionLog.setUserId(userId); |
|
|
|
|
|
wxGameActionLog.updateTenantInfo(wxGame); |
|
|
|
|
|
wxGameActionLog.setGameId(gameId); |
|
|
|
|
|
wxGameActionLog.setCreateTime(new Date()); |
|
|
|
|
|
wxGameActionLog.setUsedCredit(userCredit); |
|
|
|
|
|
if(userCredit > 0){ |
|
|
|
|
|
wxGameActionLog.setType(1); |
|
|
|
|
|
} |
|
|
|
|
|
wxGameActionLog.setCouponOrderId(orderId); |
|
|
|
|
|
wxGameActionLog.setAddCredit(addCredit); |
|
|
|
|
|
|
|
|
|
|
|
wxGameActionLogMapper.insert(wxGameActionLog); |
|
|
|
|
|
|
|
|
return resultData; |
|
|
return resultData; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
@@ -508,7 +514,7 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),wxGame) ; |
|
|
wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),wxGame) ; |
|
|
WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory); |
|
|
WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory); |
|
|
|
|
|
|
|
|
return this.luckDraw(gameId,userId); |
|
|
|
|
|
|
|
|
return this.luckDraw(gameId,userId,wxGame.getPlayCredit()); |
|
|
}else{ |
|
|
}else{ |
|
|
return new ResultData(ErrorCode.GAME_NOT_C_COUNT); |
|
|
return new ResultData(ErrorCode.GAME_NOT_C_COUNT); |
|
|
} |
|
|
} |
|
|
|