From 5b2deea85c27aebabd04060cb162a8bf47f0972c Mon Sep 17 00:00:00 2001 From: hupeng Date: Tue, 16 Oct 2018 21:51:18 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=B8=B8=E6=88=8F][=E4=BF=AE=E6=94=B9]:?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=E6=B8=B8=E6=88=8F=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/controller/WxGameController.java | 10 +- .../java/com/iformall/domain/po/WxGame.java | 122 ++++++++++++++++++ .../iformall/domain/po/WxGameTemplate.java | 66 ++++++++++ .../service/impl/WxGameServiceImpl.java | 12 +- 4 files changed, 202 insertions(+), 8 deletions(-) diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java index 214125e0e..4de8a7314 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java @@ -41,12 +41,8 @@ public class WxGameController extends BaseController { if (wxGame1 != null) { WxGameTemplate gameTemplate = wxGameTemplateService.getById(wxGame1.getGameId()); if (gameTemplate != null) { - Map map = new HashMap(); - map.put("id", wxGame1.getId()); - map.put("gameId", wxGame1.getGameId()); - map.put("imgUrl", gameTemplate.getImgUrl()); - map.put("url", gameTemplate.getUrl()); - return new ResultData(map); + wxGame1.setGameTemplate(gameTemplate); + return new ResultData(wxGame1); } } @@ -55,7 +51,7 @@ public class WxGameController extends BaseController { @ApiOperation("获取游戏参数(id,gameId必填)") @GetMapping("getParams") - public ResultData getOne(@ModelAttribute WxGame wxGame) { + public ResultData getParams(@ModelAttribute WxGame wxGame) { if (null == wxGame) wxGame = new WxGame(); wxGame.setTenantId(getTenantId()); wxGame.setStatus(EnumGameStatus.STATUS_THROW_IN.getCode()); diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxGame.java b/mallinkService/src/main/java/com/iformall/domain/po/WxGame.java index 7ec655c0d..17758c938 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxGame.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxGame.java @@ -62,6 +62,128 @@ public class WxGame implements Serializable { @io.swagger.annotations.ApiModelProperty(value = "已投放券信息") protected List couponIdsList; // couponChannel + + /**游戏名称*/ + @Transient + @io.swagger.annotations.ApiModelProperty(value="游戏名称",name="name") + private String name; + /**游戏链接*/ + @Transient + @io.swagger.annotations.ApiModelProperty(value="游戏链接",name="url") + private String url; + /**游戏logo,c端游戏入口使用*/ + @Transient + @io.swagger.annotations.ApiModelProperty(value="游戏logo,c端游戏入口使用",name="imgUrl") + private String imgUrl; + /**选项限制(-1:不做限制)*/ + @Transient + @io.swagger.annotations.ApiModelProperty(value="选项限制(-1:不做限制)",name="optionLimit") + private Integer optionLimit; + /**游戏规则说明*/ + @Transient + @io.swagger.annotations.ApiModelProperty(value="游戏规则说明",name="rules") + private String rules; + /**游戏类型(1:卡牌),目前无用*/ + @Transient + @io.swagger.annotations.ApiModelProperty(value="游戏类型(1:卡牌),目前无用",name="type") + private Integer type; + + + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + + public String getSortColumns() { + return sortColumns; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public Long getGameId() { + return gameId; + } + + public void setGameId(Long gameId) { + this.gameId = gameId; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getCouponIds() { + return couponIds; + } + + public void setCouponIds(String couponIds) { + this.couponIds = couponIds; + } + + public Date getValidStartDate() { + return validStartDate; + } + + public void setValidStartDate(Date validStartDate) { + this.validStartDate = validStartDate; + } + + public Date getValidEndDate() { + return validEndDate; + } + + public void setValidEndDate(Date validEndDate) { + this.validEndDate = validEndDate; + } + + public Integer getTriggleAction() { + return triggleAction; + } + + public void setTriggleAction(Integer triggleAction) { + this.triggleAction = triggleAction; + } + + public List getCouponIdsList() { + return couponIdsList; + } + + public void setCouponIdsList(List couponIdsList) { + this.couponIdsList = couponIdsList; + } + + public void setGameTemplate(WxGameTemplate gameTemplate) { + this.imgUrl = gameTemplate.getImgUrl(); + this.url = gameTemplate.getUrl(); + this.name = gameTemplate.getName(); + this.optionLimit = gameTemplate.getOptionLimit(); + this.rules = gameTemplate.getRules(); + this.type = gameTemplate.getType(); + } + public static enum Field { Id_ASC("`id` ASC"), Id_DESC("`id` DESC") , TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxGameTemplate.java b/mallinkService/src/main/java/com/iformall/domain/po/WxGameTemplate.java index fba59d1ca..60dcc5811 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxGameTemplate.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxGameTemplate.java @@ -39,7 +39,73 @@ public class WxGameTemplate implements Serializable { @io.swagger.annotations.ApiModelProperty(value="游戏类型(1:卡牌),目前无用",name="type") private Integer type; + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + + public String getSortColumns() { + return sortColumns; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getImgUrl() { + return imgUrl; + } + + public void setImgUrl(String imgUrl) { + this.imgUrl = imgUrl; + } + + public Integer getOptionLimit() { + return optionLimit; + } + + public void setOptionLimit(Integer optionLimit) { + this.optionLimit = optionLimit; + } + + public String getRules() { + return rules; + } + + public void setRules(String rules) { + this.rules = rules; + } + + public Integer getType() { + return type; + } + public void setType(Integer type) { + this.type = type; + } public static enum Field { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java index 48f40e9c4..71f99d892 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java @@ -15,6 +15,7 @@ import com.iformall.exception.MallinkException; import com.iformall.mapper.WxCouponChannelMapper; import com.iformall.service.WxCouponChannelService; import com.iformall.service.WxCouponService; +import com.iformall.service.WxGameTemplateService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.*; @@ -43,9 +44,18 @@ public class WxGameServiceImpl implements WxGameService { @Autowired WxCouponChannelService wxCouponChannelService; + @Autowired + WxGameTemplateService wxGameTemplateService; + @Override public PageInfo listAsPage(WxGame record, Integer pageIndex, Integer pageSize) { - return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxGameMapper.findList(record)); + PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxGameMapper.findList(record)); + if (page.getSize() > 0) { + for (WxGame game : page.getList()) { + game.setGameTemplate(wxGameTemplateService.getById(game.getGameId())); + } + } + return page; } @Override