xhxu 5 лет назад
Родитель
Сommit
576a80305f
5 измененных файлов: 34 добавлений и 28 удалений
  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 Просмотреть файл

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


+ 1
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java Просмотреть файл

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


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


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


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxGameService.java Просмотреть файл

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




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


ResultData cridetLuckDraw(Long gameIdL, Long memberId); ResultData cridetLuckDraw(Long gameIdL, Long memberId);
} }

+ 30
- 24
mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java Просмотреть файл

@@ -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);
} }


+ 1
- 1
mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml Просмотреть файл

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


</mapper> </mapper>

Загрузка…
Отмена
Сохранить