|
|
|
@@ -73,20 +73,13 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
|
} |
|
|
|
|
|
|
|
if (wxGame != null) { |
|
|
|
wxGame.setCouponIdsList(getParams(wxGame)); |
|
|
|
return wxGame; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public WxGame getParams(WxGame record) { |
|
|
|
WxGame wxGame = null; |
|
|
|
try { |
|
|
|
wxGame = wxGameMapper.selectOne(record); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
return null; |
|
|
|
} |
|
|
|
private List<Object> getParams(WxGame record) { |
|
|
|
// 获取已上架的CouponChannel |
|
|
|
WxCouponChannel couponChannelQ = new WxCouponChannel(); |
|
|
|
couponChannelQ.setTenantId(record.getTenantId()); |
|
|
|
@@ -101,7 +94,7 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
|
|
|
|
|
// get game's coupon |
|
|
|
List couponIdsList = new ArrayList(); |
|
|
|
JSONArray couponChannelIds = JSON.parseArray(wxGame.getCouponIds()); |
|
|
|
JSONArray couponChannelIds = JSON.parseArray(record.getCouponIds()); |
|
|
|
for(int i=0; i<couponChannelIds.size();i++) { |
|
|
|
JSONObject couponChanObj = (JSONObject) couponChannelIds.get(i); |
|
|
|
Long couponId = couponChanObj.getLong("couponId"); |
|
|
|
@@ -114,17 +107,18 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
|
couponIdsList.add(couponChanObj); |
|
|
|
} |
|
|
|
} |
|
|
|
if (couponIdsList.size() > 0) { |
|
|
|
wxGame.setCouponIdsList(couponIdsList); |
|
|
|
return wxGame; |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
return couponIdsList; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public WxGame getById(Long id) { |
|
|
|
return wxGameMapper.selectByPrimaryKey(id); |
|
|
|
WxGame game = wxGameMapper.selectByPrimaryKey(id); |
|
|
|
if (game != null) { |
|
|
|
game.setGameTemplate(wxGameTemplateService.getById(game.getGameId())); |
|
|
|
game.setCouponIdsList(getParams(game)); |
|
|
|
} |
|
|
|
return game; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|