From 082c722321c5e665ea3e69bdd320b23134f1d3f9 Mon Sep 17 00:00:00 2001 From: "kuang.yife" Date: Wed, 19 Jun 2024 12:00:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E6=96=87=E7=AB=A0=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/PublicDetailCommentAppController.java | 3 + .../system/PlayletPublicDetailController.java | 5 ++ .../PlayletPublicDetailAppServiceImpl.java | 64 +++++++++++++++ .../templates/system/playlet/detail/add.html | 81 ++++++++++++++++--- .../system/domain/PlayletPublicDetail.java | 58 +++++++++++++ .../system/domain/PublicDetailComment.java | 3 + .../system/PlayletPublicDetailMapper.xml | 50 +++++++++++- .../system/PublicDetailCommentMapper.xml | 3 +- 8 files changed, 252 insertions(+), 15 deletions(-) diff --git a/playlet-admin/src/main/java/com/playlet/web/controller/app/PublicDetailCommentAppController.java b/playlet-admin/src/main/java/com/playlet/web/controller/app/PublicDetailCommentAppController.java index 1c6ac2a..ba98d53 100644 --- a/playlet-admin/src/main/java/com/playlet/web/controller/app/PublicDetailCommentAppController.java +++ b/playlet-admin/src/main/java/com/playlet/web/controller/app/PublicDetailCommentAppController.java @@ -11,6 +11,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.Date; + @Slf4j @Api(tags = "公众号*用户评论接口") @RestController @@ -24,6 +26,7 @@ public class PublicDetailCommentAppController { @PostMapping("/add") @ApiOperation(value = "新增用户评论") public Result add(@RequestBody PublicDetailComment detailComment) { + detailComment.setCreateTime(new Date()); detailCommentAppService.add(detailComment); return Result.success(); } diff --git a/playlet-admin/src/main/java/com/playlet/web/controller/system/PlayletPublicDetailController.java b/playlet-admin/src/main/java/com/playlet/web/controller/system/PlayletPublicDetailController.java index ec546e6..aeebf1f 100644 --- a/playlet-admin/src/main/java/com/playlet/web/controller/system/PlayletPublicDetailController.java +++ b/playlet-admin/src/main/java/com/playlet/web/controller/system/PlayletPublicDetailController.java @@ -3,6 +3,7 @@ package com.playlet.web.controller.system; import java.util.List; import com.playlet.system.domain.PlayletPublicAccount; +import com.playlet.system.service.IPlayletItemService; import com.playlet.system.service.IPlayletPublicAccountService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -36,6 +37,9 @@ public class PlayletPublicDetailController extends BaseController @Autowired private IPlayletPublicAccountService playletPublicAccountService; + @Autowired + private IPlayletItemService playletItemService; + @GetMapping("/wxQrcode/{id}") public String wxQrcode(@PathVariable("id") String id, ModelMap mmap) { @@ -94,6 +98,7 @@ public class PlayletPublicDetailController extends BaseController @GetMapping("/add") public String add(ModelMap modelMap) { + modelMap.put("playletItems", playletItemService.lambdaQuery().list()); modelMap.put("publicAccounts", playletPublicAccountService.selectPlayletPublicAccountList(new PlayletPublicAccount())); return prefix + "/add"; } diff --git a/playlet-admin/src/main/java/com/playlet/web/service/app/impl/PlayletPublicDetailAppServiceImpl.java b/playlet-admin/src/main/java/com/playlet/web/service/app/impl/PlayletPublicDetailAppServiceImpl.java index 16ec5fe..d5a745f 100644 --- a/playlet-admin/src/main/java/com/playlet/web/service/app/impl/PlayletPublicDetailAppServiceImpl.java +++ b/playlet-admin/src/main/java/com/playlet/web/service/app/impl/PlayletPublicDetailAppServiceImpl.java @@ -1,9 +1,15 @@ package com.playlet.web.service.app.impl; +import cn.hutool.crypto.digest.MD5; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.playlet.system.domain.PlayletItem; import com.playlet.system.domain.PlayletPublicAccount; import com.playlet.system.domain.PlayletPublicDetail; +import com.playlet.system.service.IPlayletItemService; import com.playlet.system.service.IPlayletPublicAccountService; import com.playlet.system.service.IPlayletPublicDetailService; import com.playlet.web.service.app.PlayletPublicDetailAppService; @@ -12,7 +18,9 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.HashMap; import java.util.List; +import java.util.Map; @Slf4j @Service @@ -23,6 +31,8 @@ public class PlayletPublicDetailAppServiceImpl implements PlayletPublicDetailApp private final IPlayletPublicAccountService iPlayletPublicAccountService; + private final IPlayletItemService iPlayletItemService; + @Override public PageInfo getList(PlayletPublicDetail playletPublicDetail, Integer pageNum, Integer pageSize) { PageHelper.startPage(pageNum, pageSize); @@ -37,7 +47,61 @@ public class PlayletPublicDetailAppServiceImpl implements PlayletPublicDetailApp public PlayletPublicDetail getById(Long id) { PlayletPublicDetail model = iPlayletPublicDetailService.getById(id); model.setPlayletPublicAccount(iPlayletPublicAccountService.selectPlayletPublicAccountById(model.getPublicId())); + // 调用接口查询二维码信息 -- 富文本格式 + if("01".equals(model.getType())){ + PlayletItem item = iPlayletItemService.getById(model.getItemId()); + fillQrcode(item.getItemId(), model); + } return model; } + protected void fillQrcode(String itemNum, PlayletPublicDetail detail){ + if(detail.getItemOne() != null){ + detail.setItemOneUrl(getQrcode(itemNum, detail.getItemOne().toString())); + } + if(detail.getItemTwo() != null){ + detail.setItemTwoUrl(getQrcode(itemNum, detail.getItemTwo().toString())); + } + if(detail.getItemThree() != null){ + detail.setItemThreeUrl(getQrcode(itemNum, detail.getItemThree().toString())); + } + if(detail.getItemFour() != null){ + detail.setItemFourUrl(getQrcode(itemNum, detail.getItemFour().toString())); + } + if(detail.getItemFive() != null){ + detail.setItemFiveUrl(getQrcode(itemNum, detail.getItemFive().toString())); + } + + } + + private String getQrcode(String itemId, String itemNum){ + String token = "zlwaiSrEM9KEbilu5f"; + String timestamp = String.valueOf((int)(System.currentTimeMillis()/1000)); + String clientId = "10005693"; + String channelId = "34662"; + String signKey = MD5.create().digestHex(clientId + token + timestamp); + JSONObject body = new JSONObject(); + body.put("clientId", clientId); + body.put("channelId", channelId); + body.put("bookId", itemId); + body.put("chapterId",itemNum); + body.put("signKey", signKey); + body.put("timestamp", timestamp); + body.put("fromDrId", "69104793291"); + body.put("referralId", "69104793291"); + // 调用推广api返回链接 + String url = "https://video.wqxsw.com/api/v1/channelapi/getminiqrcode"; + Map headerMap = new HashMap<>(); + headerMap.put("Content-Type", "application/json"); + HttpResponse result = HttpUtil.createPost(url).addHeaders(headerMap).body(JSONObject.toJSONString(body)).execute(); +// String result = HttpUtil.post("https://video.wqxsw.com/api/v1/channelapi/getminiqrcode", body); + log.info("请求入参:{}, 地址:{}, 返回:{}", body, url, result.body()); + JSONObject json = JSONObject.parseObject(result.body()); + if("1".equals(json.getString("code"))){ + return json.getString("data"); + }else { + return null; + } + } + } diff --git a/playlet-admin/src/main/resources/templates/system/playlet/detail/add.html b/playlet-admin/src/main/resources/templates/system/playlet/detail/add.html index c69a805..efc549d 100644 --- a/playlet-admin/src/main/resources/templates/system/playlet/detail/add.html +++ b/playlet-admin/src/main/resources/templates/system/playlet/detail/add.html @@ -22,12 +22,14 @@ - - - - - - +
+ +
+ +
+
@@ -50,13 +52,66 @@
- - - - - - - +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
diff --git a/playlet-system/src/main/java/com/playlet/system/domain/PlayletPublicDetail.java b/playlet-system/src/main/java/com/playlet/system/domain/PlayletPublicDetail.java index 4df4924..586d7db 100644 --- a/playlet-system/src/main/java/com/playlet/system/domain/PlayletPublicDetail.java +++ b/playlet-system/src/main/java/com/playlet/system/domain/PlayletPublicDetail.java @@ -38,6 +38,11 @@ public class PlayletPublicDetail extends BaseEntity @ApiModelProperty(value = "公众号id") private Long publicId; + /** 公众号id */ + @Excel(name = "短剧id") + @ApiModelProperty(value = "短剧id") + private Long itemId; + /** 阅读人数 */ @Excel(name = "阅读人数") @ApiModelProperty(value = "阅读人数") @@ -57,6 +62,59 @@ public class PlayletPublicDetail extends BaseEntity @ApiModelProperty(value = "点赞数") private String starCount; + @ApiModelProperty(value = "剧集1") + private Integer itemOne; + + @ApiModelProperty(value = "剧集2") + private Integer itemTwo; + + @ApiModelProperty(value = "剧集3") + private Integer itemThree; + + @ApiModelProperty(value = "剧集4") + private Integer itemFour; + + @ApiModelProperty(value = "剧集5") + private Integer itemFive; + + @ApiModelProperty(value = "剧集6") + private Integer itemSix; + + @ApiModelProperty(value = "剧集7") + private Integer itemSeven; + + @ApiModelProperty(value = "剧集8") + private Integer itemEight; + + @ApiModelProperty(value = "剧集9") + private Integer itemNine; + + @ApiModelProperty(value = "剧集10") + private Integer itemTen; + + @TableField(exist = false) + private String itemOneUrl; + @TableField(exist = false) + private String itemTwoUrl; + @TableField(exist = false) + private String itemThreeUrl; + @TableField(exist = false) + private String itemFourUrl; + @TableField(exist = false) + private String itemFiveUrl; + @TableField(exist = false) + private String itemSixUrl; + @TableField(exist = false) + private String itemSevenUrl; + @TableField(exist = false) + private String itemEightUrl; + @TableField(exist = false) + private String itemNineUrl; + @TableField(exist = false) + private String itemTenUrl; + + + @TableField(exist = false) @ApiModelProperty(value = "归属公众号信息") private PlayletPublicAccount playletPublicAccount; diff --git a/playlet-system/src/main/java/com/playlet/system/domain/PublicDetailComment.java b/playlet-system/src/main/java/com/playlet/system/domain/PublicDetailComment.java index 30cd1ee..ae38f9e 100644 --- a/playlet-system/src/main/java/com/playlet/system/domain/PublicDetailComment.java +++ b/playlet-system/src/main/java/com/playlet/system/domain/PublicDetailComment.java @@ -40,6 +40,9 @@ public class PublicDetailComment extends BaseEntity @ApiModelProperty(value = "用户昵称") private String userName; + @ApiModelProperty(value = "用户头像") + private String imgUrl; + /** 评论内容 */ @Excel(name = "评论内容") @ApiModelProperty(value = "评论内容") diff --git a/playlet-system/src/main/resources/mapper/system/PlayletPublicDetailMapper.xml b/playlet-system/src/main/resources/mapper/system/PlayletPublicDetailMapper.xml index 4b92fa2..f9ada3d 100644 --- a/playlet-system/src/main/resources/mapper/system/PlayletPublicDetailMapper.xml +++ b/playlet-system/src/main/resources/mapper/system/PlayletPublicDetailMapper.xml @@ -7,9 +7,20 @@ + + + + + + + + + + + @@ -20,7 +31,11 @@ - select id, public_id, read_count,star_count, title,img_url, content, create_by, create_time, update_by, update_time, remark from playlet_public_detail + select id, public_id, item_id, read_count,star_count, + item_one,item_two,item_three,item_four,item_five, + item_six,item_seven,item_eight,item_nine,item_ten, + title,img_url, content, create_by, create_time, + update_by, update_time, remark from playlet_public_detail