Browse Source

youxi

release_toaliyun_real
xhxu 5 years ago
parent
commit
576a80305f
5 changed files with 34 additions and 28 deletions
  1. +1
    -1
      mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java
  2. +1
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxGameService.java
  4. +30
    -24
      mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java
  5. +1
    -1
      mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml

+ 1
- 1
mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java View File

@@ -117,7 +117,7 @@ public class WxGameController extends BaseController {
if((playLimit > 0 && playCount >= playLimit) || playLimit < 0){
return new ResultData(ErrorCode.GAME_NOT_HAVE_COUNT);
}
ResultData resultData = wxGameService.luckDraw(gameIdL, getMemberId());
ResultData resultData = wxGameService.luckDraw(gameIdL, getMemberId(),0);
removeCacheCUser();
return resultData;
} catch (Exception e){


+ 1
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java View File

@@ -33,7 +33,7 @@ public class WxGameActionLog extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="",name="createTime")
private Date createTime;

@io.swagger.annotations.ApiModelProperty(value = "", name = "type")
@io.swagger.annotations.ApiModelProperty(value = "0:免费玩1:积分玩", name = "type")
private Integer type;

@io.swagger.annotations.ApiModelProperty(value = "", name = "usedCredit")


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxGameService.java View File

@@ -59,7 +59,7 @@ public interface WxGameService {
void deleteById(Long id);


ResultData luckDraw(Long gameId, Long userId);
ResultData luckDraw(Long gameId, Long userId,Integer userCredit);

ResultData cridetLuckDraw(Long gameIdL, Long memberId);
}

+ 30
- 24
mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java View File

@@ -239,6 +239,7 @@ public class WxGameServiceImpl implements WxGameService {
map.put("prizeType",0);
map.put("gameWeight",couponChanObj.getInteger("weight"));
map.put("credit",couponChanObj.getInteger("credit"));
map.put("couponId",couponChanObj.getLong("couponId"));
couponIdsList.add(map);
}else{
Long couponId = couponChanObj.getLong("couponId");
@@ -412,7 +413,7 @@ public class WxGameServiceImpl implements WxGameService {

@Transactional(rollbackFor = Exception.class)
@Override
public ResultData luckDraw(Long gameId,Long userId){
public ResultData luckDraw(Long gameId,Long userId,Integer userCredit){
ResultData resultData = new ResultData();
WxGame wxGame = this.getById(gameId);
List<Object> couponIdsList = wxGame.getCouponIdsList();
@@ -436,31 +437,29 @@ public class WxGameServiceImpl implements WxGameService {
}
}
Object data = resultData.data;
Long orderId = 0L;
Integer addCredit = 0;
if(data != null){
if(data instanceof Map){
Map dataMap = (Map) data;
// Integer prizeType = (Integer) dataMap.get("prizeType");
// if(prizeType != null && prizeType == 0){
Integer credit = (Integer) dataMap.get("credit");
if(credit > 0){
WxCreditHistory wxCreditHistory = new WxCreditHistory();
wxCreditHistory.setTenantId(wxGame.getFinalTenantId());
wxCreditHistory.setCUserId(userId);
wxCreditHistory.setOperatorId(userId);
wxCreditHistory.setOperatorType(EnumUserType.CUSER.getCode());
wxCreditHistory.setCreditNum((Integer) dataMap.get("credit"));
wxCreditHistory.setCreditNum(credit);
wxCreditHistory.setCreditType(EnumScoreType.GAME_ADD_CREDIT.getCode());
wxCreditHistory.setChangePurpose(EnumScoreType.GAME_ADD_CREDIT.getMessage());
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){
@@ -469,25 +468,32 @@ public class WxGameServiceImpl implements WxGameService {
orderSaveDto.setCouponChannelId(vo.getId());
orderSaveDto.setCouponId(vo.getCouponId());
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){
WxOrder order = (WxOrder)resultData1.data;
orderId = order.getId();
}else{
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;

}
@@ -508,7 +514,7 @@ public class WxGameServiceImpl implements WxGameService {
wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),wxGame) ;
WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory);

return this.luckDraw(gameId,userId);
return this.luckDraw(gameId,userId,wxGame.getPlayCredit());
}else{
return new ResultData(ErrorCode.GAME_NOT_C_COUNT);
}


+ 1
- 1
mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml View File

@@ -148,7 +148,7 @@
<select id="getAwardCount" resultType="java.lang.Integer" parameterType="com.iformall.domain.po.WxGameActionLog">
select COUNT(*) FROM wx_game_action_log a
<include refid="dynamicCountWhereConditions" />
and coupon_order_id != 0 and add_credit != 0
and coupon_order_id != 0
</select>

</mapper>

Loading…
Cancel
Save