Commit d20c507b716d0d42caad77a89321a12b52188bbe
1 parent
f27a09d9
update
Showing
3 changed files
with
191 additions
and
161 deletions
src/main/java/com/cnlive/shenhe/api/ContentControllerApi.java
| @@ -4,11 +4,8 @@ import com.alibaba.fastjson.JSONArray; | @@ -4,11 +4,8 @@ import com.alibaba.fastjson.JSONArray; | ||
| 4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | import com.cnlive.shenhe.bean.ErrorEnum; | 5 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 6 | import com.cnlive.shenhe.bean.ResponseBean; | 6 | import com.cnlive.shenhe.bean.ResponseBean; |
| 7 | -import com.cnlive.shenhe.entity.ShyComments; | ||
| 8 | import com.cnlive.shenhe.entity.ShyContent; | 7 | import com.cnlive.shenhe.entity.ShyContent; |
| 9 | -import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; | ||
| 10 | import com.cnlive.shenhe.serviceImpl.ContentServiceImpl; | 8 | import com.cnlive.shenhe.serviceImpl.ContentServiceImpl; |
| 11 | -import com.cnlive.shenhe.utils.AuditPass; | ||
| 12 | import com.cnlive.shenhe.utils.CommonConst; | 9 | import com.cnlive.shenhe.utils.CommonConst; |
| 13 | import com.cnlive.shenhe.utils.CommonUtils; | 10 | import com.cnlive.shenhe.utils.CommonUtils; |
| 14 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
| @@ -16,27 +13,21 @@ import org.slf4j.LoggerFactory; | @@ -16,27 +13,21 @@ import org.slf4j.LoggerFactory; | ||
| 16 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | import org.springframework.stereotype.Controller; | 14 | import org.springframework.stereotype.Controller; |
| 18 | import org.springframework.ui.Model; | 15 | import org.springframework.ui.Model; |
| 19 | -import org.springframework.web.bind.annotation.GetMapping; | ||
| 20 | -import org.springframework.web.bind.annotation.PathVariable; | ||
| 21 | -import org.springframework.web.bind.annotation.PostMapping; | ||
| 22 | -import org.springframework.web.bind.annotation.RequestBody; | ||
| 23 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 24 | -import org.springframework.web.bind.annotation.ResponseBody; | 16 | +import org.springframework.web.bind.annotation.*; |
| 25 | 17 | ||
| 26 | import java.util.Date; | 18 | import java.util.Date; |
| 27 | import java.util.List; | 19 | import java.util.List; |
| 28 | -import java.util.Map; | ||
| 29 | - | ||
| 30 | -import javax.servlet.http.HttpSession; | ||
| 31 | 20 | ||
| 21 | +/** | ||
| 22 | + * 图文审核 | ||
| 23 | + * | ||
| 24 | + * @author | ||
| 25 | + */ | ||
| 32 | @Controller | 26 | @Controller |
| 33 | @RequestMapping("/api/content") | 27 | @RequestMapping("/api/content") |
| 34 | public class ContentControllerApi { | 28 | public class ContentControllerApi { |
| 35 | private static Logger logger = LoggerFactory.getLogger(ContentControllerApi.class); | 29 | private static Logger logger = LoggerFactory.getLogger(ContentControllerApi.class); |
| 36 | - @Autowired | ||
| 37 | - AuditPass Pass; | ||
| 38 | - @Autowired | ||
| 39 | - CommentsServiceImpl commentsService; | 30 | + |
| 40 | @Autowired | 31 | @Autowired |
| 41 | ContentServiceImpl contentService; | 32 | ContentServiceImpl contentService; |
| 42 | 33 | ||
| @@ -47,44 +38,57 @@ public class ContentControllerApi { | @@ -47,44 +38,57 @@ public class ContentControllerApi { | ||
| 47 | */ | 38 | */ |
| 48 | @PostMapping("/import") | 39 | @PostMapping("/import") |
| 49 | @ResponseBody | 40 | @ResponseBody |
| 50 | - public ResponseBean impotContent(String param) { | 41 | + public ResponseBean importContent(String param) { |
| 51 | logger.info("图文入库,param=====" + param); | 42 | logger.info("图文入库,param=====" + param); |
| 52 | JSONObject json = JSONObject.parseObject(param); | 43 | JSONObject json = JSONObject.parseObject(param); |
| 53 | //判断是否存在 | 44 | //判断是否存在 |
| 54 | - ShyContent shyContent=new ShyContent(); | 45 | + ShyContent shyContent = new ShyContent(); |
| 55 | shyContent.setContent_id(json.getString("contentId")); | 46 | shyContent.setContent_id(json.getString("contentId")); |
| 56 | - shyContent.setContent_tag("content");//图文标签 | ||
| 57 | - List<ShyContent> contentList = contentService.findshyContent(shyContent); | ||
| 58 | - | 47 | + //图文标签 |
| 48 | + shyContent.setContent_tag("content"); | ||
| 49 | + | ||
| 59 | //获取审核类型 | 50 | //获取审核类型 |
| 60 | - Integer shenheType = contentService.getShenheType(json.getInteger("spId"),"content"); | 51 | + Integer shenheType = contentService.getShenheType(json.getInteger("spId"), "content"); |
| 52 | + List<ShyContent> contentList = contentService.findshyContent(shyContent); | ||
| 61 | //存在则更新 | 53 | //存在则更新 |
| 62 | if (contentList.size() > 0) { | 54 | if (contentList.size() > 0) { |
| 63 | ShyContent shyContent1 = contentList.get(0); | 55 | ShyContent shyContent1 = contentList.get(0); |
| 64 | - shyContent1.setTitle(json.getString("title"));//标题 | ||
| 65 | - shyContent1.setTitle_image(json.getString("titleImage"));//标题图片 | ||
| 66 | - shyContent1.setShenhe_type(shenheType);//审核类型 | ||
| 67 | - shyContent1.setContent_status(json.getInteger("contentStatus"));//当前图文的审核状态 | ||
| 68 | - shyContent1.setSource(json.getString("source"));//来源 | ||
| 69 | - shyContent1.setAuthor(json.getString("author"));//作者 | ||
| 70 | - shyContent1.setContent_text(json.getString("content_text"));//图文内容 | ||
| 71 | - String contentTime = json.getString("contentTime");//图文创建时间 | 56 | + //标题 |
| 57 | + shyContent1.setTitle(json.getString("title")); | ||
| 58 | + //标题图片 | ||
| 59 | + shyContent1.setTitle_image(json.getString("titleImage")); | ||
| 60 | + //审核类型 | ||
| 61 | + shyContent1.setShenhe_type(shenheType); | ||
| 62 | + //当前图文的审核状态 | ||
| 63 | + shyContent1.setContent_status(json.getInteger("contentStatus")); | ||
| 64 | + //来源 | ||
| 65 | + shyContent1.setSource(json.getString("source")); | ||
| 66 | + //作者 | ||
| 67 | + shyContent1.setAuthor(json.getString("author")); | ||
| 68 | + //图文内容 | ||
| 69 | + shyContent1.setContent_text(json.getString("content_text")); | ||
| 70 | + //图文创建时间 | ||
| 71 | + String contentTime = json.getString("contentTime"); | ||
| 72 | if (CommonUtils.isNotEmpty(contentTime)) { | 72 | if (CommonUtils.isNotEmpty(contentTime)) { |
| 73 | Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); | 73 | Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); |
| 74 | shyContent1.setContent_time(timestamp); | 74 | shyContent1.setContent_time(timestamp); |
| 75 | 75 | ||
| 76 | } | 76 | } |
| 77 | shyContent1.setCreate_date(CommonUtils.getCurrentTime()); | 77 | shyContent1.setCreate_date(CommonUtils.getCurrentTime()); |
| 78 | - shyContent1.setCallback(json.getString("callback"));//回调地址 | ||
| 79 | - shyContent1.setContent_url(json.getString("contentUrl"));//图文发布h5的url | ||
| 80 | - shyContent1.setContent_pc_url(json.getString("contentPCUrl"));//图文发布pc的url | ||
| 81 | - shyContent1.setSp_id(json.getInteger("spId"));//spid | ||
| 82 | - shyContent1.setContent_tag("content");//图文标签 | ||
| 83 | - shyContent1.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 | ||
| 84 | - shyContent1.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 | ||
| 85 | - | ||
| 86 | - | ||
| 87 | - | 78 | + //回调地址 |
| 79 | + shyContent1.setCallback(json.getString("callback")); | ||
| 80 | + //图文发布h5的url | ||
| 81 | + shyContent1.setContent_url(json.getString("contentUrl")); | ||
| 82 | + //图文发布pc的url | ||
| 83 | + shyContent1.setContent_pc_url(json.getString("contentPCUrl")); | ||
| 84 | + //spid | ||
| 85 | + shyContent1.setSp_id(json.getInteger("spId")); | ||
| 86 | + //图文标签 | ||
| 87 | + shyContent1.setContent_tag("content"); | ||
| 88 | + //领取状态 | ||
| 89 | + shyContent1.setReceive_status(CommonConst.RECEIVE_BEFORE); | ||
| 90 | + //最后一次更新时间 | ||
| 91 | + shyContent1.setLast_update(CommonUtils.getCurrentTime()); | ||
| 88 | boolean YorN = contentService.updateshyContent(shyContent1); | 92 | boolean YorN = contentService.updateshyContent(shyContent1); |
| 89 | if (YorN == true) { | 93 | if (YorN == true) { |
| 90 | return new ResponseBean(ErrorEnum.SUCCESS); | 94 | return new ResponseBean(ErrorEnum.SUCCESS); |
| @@ -92,27 +96,53 @@ public class ContentControllerApi { | @@ -92,27 +96,53 @@ public class ContentControllerApi { | ||
| 92 | return new ResponseBean(ErrorEnum.ERROR); | 96 | return new ResponseBean(ErrorEnum.ERROR); |
| 93 | } | 97 | } |
| 94 | } | 98 | } |
| 99 | + return saveContent(json, shyContent, shenheType); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * 保存操作 | ||
| 104 | + * | ||
| 105 | + * @param json | ||
| 106 | + * @param shyContent | ||
| 107 | + * @param shenheType | ||
| 108 | + * @return | ||
| 109 | + */ | ||
| 110 | + private ResponseBean saveContent(JSONObject json, ShyContent shyContent, Integer shenheType) { | ||
| 95 | //如果不存在直接插入 | 111 | //如果不存在直接插入 |
| 96 | - shyContent.setTitle(json.getString("title"));//标题 | ||
| 97 | - shyContent.setTitle_image(json.getString("titleImage"));//标题图片 | ||
| 98 | - shyContent.setShenhe_type(shenheType);//审核类型 | ||
| 99 | - shyContent.setContent_status(json.getInteger("contentStatus"));//当前图文的审核状态 | ||
| 100 | - shyContent.setSource(json.getString("source"));//来源 | ||
| 101 | - shyContent.setAuthor(json.getString("author"));//作者 | ||
| 102 | - shyContent.setContent_text(json.getString("content_text"));//图文内容 | ||
| 103 | - String contentTime = json.getString("contentTime");//创建时间 | 112 | + //标题 |
| 113 | + shyContent.setTitle(json.getString("title")); | ||
| 114 | + //标题图片 | ||
| 115 | + shyContent.setTitle_image(json.getString("titleImage")); | ||
| 116 | + //审核类型 | ||
| 117 | + shyContent.setShenhe_type(shenheType); | ||
| 118 | + //当前图文的审核状态 | ||
| 119 | + shyContent.setContent_status(json.getInteger("contentStatus")); | ||
| 120 | + //来源 | ||
| 121 | + shyContent.setSource(json.getString("source")); | ||
| 122 | + //作者 | ||
| 123 | + shyContent.setAuthor(json.getString("author")); | ||
| 124 | + //图文内容 | ||
| 125 | + shyContent.setContent_text(json.getString("content_text")); | ||
| 126 | + //创建时间 | ||
| 127 | + String contentTime = json.getString("contentTime"); | ||
| 104 | if (CommonUtils.isNotEmpty(contentTime)) { | 128 | if (CommonUtils.isNotEmpty(contentTime)) { |
| 105 | Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); | 129 | Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); |
| 106 | shyContent.setContent_time(timestamp); | 130 | shyContent.setContent_time(timestamp); |
| 107 | 131 | ||
| 108 | } | 132 | } |
| 109 | shyContent.setCreate_date(CommonUtils.getCurrentTime()); | 133 | shyContent.setCreate_date(CommonUtils.getCurrentTime()); |
| 110 | - shyContent.setCallback(json.getString("callback"));//回调地址 | ||
| 111 | - shyContent.setContent_url(json.getString("contentUrl"));//图文发布h5的url | ||
| 112 | - shyContent.setContent_pc_url(json.getString("contentPCUrl"));//图文发布pc的url | ||
| 113 | - shyContent.setSp_id(json.getInteger("spId"));//spid | ||
| 114 | - shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 | ||
| 115 | - shyContent.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 | 134 | + //回调地址 |
| 135 | + shyContent.setCallback(json.getString("callback")); | ||
| 136 | + //图文发布h5的url | ||
| 137 | + shyContent.setContent_url(json.getString("contentUrl")); | ||
| 138 | + //图文发布pc的url | ||
| 139 | + shyContent.setContent_pc_url(json.getString("contentPCUrl")); | ||
| 140 | + //spid | ||
| 141 | + shyContent.setSp_id(json.getInteger("spId")); | ||
| 142 | + //领取状态 | ||
| 143 | + shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE); | ||
| 144 | + //最后一次更新时间 | ||
| 145 | + shyContent.setLast_update(CommonUtils.getCurrentTime()); | ||
| 116 | boolean YorN = contentService.impotContent(shyContent); | 146 | boolean YorN = contentService.impotContent(shyContent); |
| 117 | if (YorN == true) { | 147 | if (YorN == true) { |
| 118 | return new ResponseBean(ErrorEnum.SUCCESS); | 148 | return new ResponseBean(ErrorEnum.SUCCESS); |
| @@ -120,8 +150,8 @@ public class ContentControllerApi { | @@ -120,8 +150,8 @@ public class ContentControllerApi { | ||
| 120 | return new ResponseBean(ErrorEnum.ERROR); | 150 | return new ResponseBean(ErrorEnum.ERROR); |
| 121 | } | 151 | } |
| 122 | } | 152 | } |
| 123 | - | ||
| 124 | - | 153 | + |
| 154 | + | ||
| 125 | /** | 155 | /** |
| 126 | * @author liwei | 156 | * @author liwei |
| 127 | * @Date: 2019/05/15 11:17 | 157 | * @Date: 2019/05/15 11:17 |
| @@ -130,100 +160,99 @@ public class ContentControllerApi { | @@ -130,100 +160,99 @@ public class ContentControllerApi { | ||
| 130 | @PostMapping("/importMoment") | 160 | @PostMapping("/importMoment") |
| 131 | @ResponseBody | 161 | @ResponseBody |
| 132 | public ResponseBean impotMoment(@RequestBody String param) { | 162 | public ResponseBean impotMoment(@RequestBody String param) { |
| 133 | - logger.info("朋友圈入库,param=====" + param); | ||
| 134 | - JSONObject json = JSONObject.parseObject(param); | ||
| 135 | - //判断是否存在 | ||
| 136 | - ShyContent shyContent=new ShyContent(); | ||
| 137 | - shyContent.setContent_id(json.getString("momentId"));//朋友圈id | ||
| 138 | - shyContent.setContent_tag("moment");//朋友圈标签 | ||
| 139 | - List<ShyContent> contentList = contentService.findshyContent(shyContent); | ||
| 140 | - //获取审核类型 | ||
| 141 | - Integer shenheType = contentService.getShenheType(json.getInteger("spId"),"moment"); | ||
| 142 | - | 163 | + logger.info("朋友圈入库,param=====" + param); |
| 164 | + JSONObject json = JSONObject.parseObject(param); | ||
| 165 | + //判断是否存在 | ||
| 166 | + ShyContent shyContent = new ShyContent(); | ||
| 167 | + shyContent.setContent_id(json.getString("momentId"));//朋友圈id | ||
| 168 | + shyContent.setContent_tag("moment");//朋友圈标签 | ||
| 169 | + List<ShyContent> contentList = contentService.findshyContent(shyContent); | ||
| 170 | + //获取审核类型 | ||
| 171 | + Integer shenheType = contentService.getShenheType(json.getInteger("spId"), "moment"); | ||
| 172 | + | ||
| 143 | //获取生活圈内容的类型 1:图片 2:视频 3:分享 | 173 | //获取生活圈内容的类型 1:图片 2:视频 3:分享 |
| 144 | Integer contentType = json.getInteger("contentType"); | 174 | Integer contentType = json.getInteger("contentType"); |
| 145 | - String contentImageUrl="";//内容图片地址 | ||
| 146 | - if(contentType!=null&&contentType==1){ | ||
| 147 | - JSONArray contentImageUrlList = JSONObject.parseArray(json.getString("contentImageUrl"));//朋友圈分享的内容的url | ||
| 148 | - for(int i=0;i<contentImageUrlList.size();i++){ | ||
| 149 | - JSONObject contentImageUrlMap = contentImageUrlList.getJSONObject(i); | ||
| 150 | - contentImageUrl+=contentImageUrlMap.getString("imageUrl")+","; | ||
| 151 | - } | ||
| 152 | - contentImageUrl=contentImageUrl.substring(0, contentImageUrl.length()-1);//去掉最后一个逗号 | ||
| 153 | - }else{ | ||
| 154 | - contentImageUrl=json.getString("contentImageUrl"); | 175 | + String contentImageUrl = "";//内容图片地址 |
| 176 | + if (contentType != null && contentType == 1) { | ||
| 177 | + JSONArray contentImageUrlList = JSONObject.parseArray(json.getString("contentImageUrl"));//朋友圈分享的内容的url | ||
| 178 | + for (int i = 0; i < contentImageUrlList.size(); i++) { | ||
| 179 | + JSONObject contentImageUrlMap = contentImageUrlList.getJSONObject(i); | ||
| 180 | + contentImageUrl += contentImageUrlMap.getString("imageUrl") + ","; | ||
| 181 | + } | ||
| 182 | + contentImageUrl = contentImageUrl.substring(0, contentImageUrl.length() - 1);//去掉最后一个逗号 | ||
| 183 | + } else { | ||
| 184 | + contentImageUrl = json.getString("contentImageUrl"); | ||
| 155 | } | 185 | } |
| 156 | - | ||
| 157 | - //存在则更新 | ||
| 158 | - if (contentList.size() > 0) { | ||
| 159 | - ShyContent shyContent1 = contentList.get(0); | ||
| 160 | - shyContent1.setTitle(json.getString("title"));//标题 | ||
| 161 | - shyContent1.setTitle_image(json.getString("image"));//用户头像 | ||
| 162 | - shyContent1.setShenhe_type(shenheType);//审核类型 | ||
| 163 | - String contentTime = json.getString("createTime");//朋友圈内容创建时间 | ||
| 164 | - if (CommonUtils.isNotEmpty(contentTime)) { | 186 | + |
| 187 | + //存在则更新 | ||
| 188 | + if (contentList.size() > 0) { | ||
| 189 | + ShyContent shyContent1 = contentList.get(0); | ||
| 190 | + shyContent1.setTitle(json.getString("title"));//标题 | ||
| 191 | + shyContent1.setTitle_image(json.getString("image"));//用户头像 | ||
| 192 | + shyContent1.setShenhe_type(shenheType);//审核类型 | ||
| 193 | + String contentTime = json.getString("createTime");//朋友圈内容创建时间 | ||
| 194 | + if (CommonUtils.isNotEmpty(contentTime)) { | ||
| 165 | // Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); | 195 | // Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); |
| 166 | - shyContent1.setContent_time(new Date(Long.valueOf(contentTime))); | ||
| 167 | - | ||
| 168 | - } | ||
| 169 | - shyContent1.setCreate_date(CommonUtils.getCurrentTime()); | ||
| 170 | - shyContent1.setCallback(json.getString("callbackUrl"));//回调地址 | ||
| 171 | - shyContent1.setContent_url(json.getString("pageUrl"));//朋友圈分享的url | ||
| 172 | - shyContent1.setContent_pc_url(contentImageUrl);//朋友圈分享的内容的url,以逗号分隔 | ||
| 173 | - shyContent1.setSp_id(json.getInteger("spId"));//spid | ||
| 174 | - shyContent1.setAuthor(json.getString("userId"));//用户id | ||
| 175 | - shyContent1.setSource(json.getString("nickName"));//用户昵称 | ||
| 176 | - shyContent1.setVideo_id(json.getString("videoId"));//关联videoId | ||
| 177 | - shyContent1.setContent_tag("moment");//图文标签 | ||
| 178 | - shyContent1.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 | ||
| 179 | - shyContent1.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 | ||
| 180 | - | ||
| 181 | - | ||
| 182 | - | ||
| 183 | - boolean YorN = contentService.updateshyContent(shyContent1); | ||
| 184 | - if (YorN == true) { | ||
| 185 | - return new ResponseBean(ErrorEnum.SUCCESS); | ||
| 186 | - } else { | ||
| 187 | - return new ResponseBean(ErrorEnum.ERROR); | ||
| 188 | - } | ||
| 189 | - } | ||
| 190 | - //如果不存在直接插入 | ||
| 191 | - shyContent.setTitle(json.getString("title"));//标题 | ||
| 192 | - shyContent.setTitle_image(json.getString("image"));//用户头像 | ||
| 193 | - shyContent.setShenhe_type(shenheType);//审核类型 | ||
| 194 | - shyContent.setContent_status(1);//当前朋友圈内容的审核状态,先发后审 | ||
| 195 | - String contentTime = json.getString("createTime");//创建时间 | ||
| 196 | - if (CommonUtils.isNotEmpty(contentTime)) { | 196 | + shyContent1.setContent_time(new Date(Long.valueOf(contentTime))); |
| 197 | + | ||
| 198 | + } | ||
| 199 | + shyContent1.setCreate_date(CommonUtils.getCurrentTime()); | ||
| 200 | + shyContent1.setCallback(json.getString("callbackUrl"));//回调地址 | ||
| 201 | + shyContent1.setContent_url(json.getString("pageUrl"));//朋友圈分享的url | ||
| 202 | + shyContent1.setContent_pc_url(contentImageUrl);//朋友圈分享的内容的url,以逗号分隔 | ||
| 203 | + shyContent1.setSp_id(json.getInteger("spId"));//spid | ||
| 204 | + shyContent1.setAuthor(json.getString("userId"));//用户id | ||
| 205 | + shyContent1.setSource(json.getString("nickName"));//用户昵称 | ||
| 206 | + shyContent1.setVideo_id(json.getString("videoId"));//关联videoId | ||
| 207 | + shyContent1.setContent_tag("moment");//图文标签 | ||
| 208 | + shyContent1.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 | ||
| 209 | + shyContent1.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 | ||
| 210 | + | ||
| 211 | + | ||
| 212 | + boolean YorN = contentService.updateshyContent(shyContent1); | ||
| 213 | + if (YorN == true) { | ||
| 214 | + return new ResponseBean(ErrorEnum.SUCCESS); | ||
| 215 | + } else { | ||
| 216 | + return new ResponseBean(ErrorEnum.ERROR); | ||
| 217 | + } | ||
| 218 | + } | ||
| 219 | + //如果不存在直接插入 | ||
| 220 | + shyContent.setTitle(json.getString("title"));//标题 | ||
| 221 | + shyContent.setTitle_image(json.getString("image"));//用户头像 | ||
| 222 | + shyContent.setShenhe_type(shenheType);//审核类型 | ||
| 223 | + shyContent.setContent_status(1);//当前朋友圈内容的审核状态,先发后审 | ||
| 224 | + String contentTime = json.getString("createTime");//创建时间 | ||
| 225 | + if (CommonUtils.isNotEmpty(contentTime)) { | ||
| 197 | // Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); | 226 | // Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); |
| 198 | - shyContent.setContent_time(new Date(Long.valueOf(contentTime))); | ||
| 199 | - | ||
| 200 | - } | ||
| 201 | - shyContent.setCreate_date(CommonUtils.getCurrentTime()); | ||
| 202 | - shyContent.setCallback(json.getString("callbackUrl"));//回调地址 | ||
| 203 | - shyContent.setContent_url(json.getString("pageUrl"));//朋友圈分享的url | ||
| 204 | - shyContent.setContent_pc_url(contentImageUrl);//朋友圈分享的内容的url,以逗号分隔 | ||
| 205 | - shyContent.setSp_id(json.getInteger("spId"));//spid | ||
| 206 | - shyContent.setAuthor(json.getString("userId"));//用户id | ||
| 207 | - shyContent.setSource(json.getString("nickName"));//用户昵称 | ||
| 208 | - shyContent.setVideo_id(json.getString("videoId"));//关联videoId | ||
| 209 | - shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 | ||
| 210 | - shyContent.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 | ||
| 211 | - boolean YorN = contentService.impotContent(shyContent); | ||
| 212 | - if (YorN == true) { | ||
| 213 | - return new ResponseBean(ErrorEnum.SUCCESS); | ||
| 214 | - } else { | ||
| 215 | - return new ResponseBean(ErrorEnum.ERROR); | ||
| 216 | - } | 227 | + shyContent.setContent_time(new Date(Long.valueOf(contentTime))); |
| 228 | + | ||
| 229 | + } | ||
| 230 | + shyContent.setCreate_date(CommonUtils.getCurrentTime()); | ||
| 231 | + shyContent.setCallback(json.getString("callbackUrl"));//回调地址 | ||
| 232 | + shyContent.setContent_url(json.getString("pageUrl"));//朋友圈分享的url | ||
| 233 | + shyContent.setContent_pc_url(contentImageUrl);//朋友圈分享的内容的url,以逗号分隔 | ||
| 234 | + shyContent.setSp_id(json.getInteger("spId"));//spid | ||
| 235 | + shyContent.setAuthor(json.getString("userId"));//用户id | ||
| 236 | + shyContent.setSource(json.getString("nickName"));//用户昵称 | ||
| 237 | + shyContent.setVideo_id(json.getString("videoId"));//关联videoId | ||
| 238 | + shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 | ||
| 239 | + shyContent.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 | ||
| 240 | + boolean YorN = contentService.impotContent(shyContent); | ||
| 241 | + if (YorN == true) { | ||
| 242 | + return new ResponseBean(ErrorEnum.SUCCESS); | ||
| 243 | + } else { | ||
| 244 | + return new ResponseBean(ErrorEnum.ERROR); | ||
| 245 | + } | ||
| 217 | } | 246 | } |
| 218 | - | 247 | + |
| 219 | @GetMapping("/detail/{id}.html") | 248 | @GetMapping("/detail/{id}.html") |
| 220 | - public Object getContentDetail(Model model, @PathVariable Integer id) { | ||
| 221 | - System.out.println("数美送审页面开始进入"); | ||
| 222 | - ShyContent content = contentService.selectByPrimaryKey(id); | ||
| 223 | - model.addAttribute("contentText", content.getContent_text()); | ||
| 224 | - model.addAttribute("contentTitle", content.getTitle()); | ||
| 225 | - return "html/contentPage.html"; | ||
| 226 | - } | ||
| 227 | - | 249 | + public Object getContentDetail(Model model, @PathVariable Integer id) { |
| 250 | + System.out.println("数美送审页面开始进入"); | ||
| 251 | + ShyContent content = contentService.selectByPrimaryKey(id); | ||
| 252 | + model.addAttribute("contentText", content.getContent_text()); | ||
| 253 | + model.addAttribute("contentTitle", content.getTitle()); | ||
| 254 | + return "html/contentPage.html"; | ||
| 255 | + } | ||
| 256 | + | ||
| 228 | 257 | ||
| 229 | } | 258 | } |
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
| 1 | package com.cnlive.shenhe.serviceImpl; | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | ||
| 3 | -import com.alibaba.fastjson.JSON; | ||
| 4 | import com.alibaba.fastjson.JSONArray; | 3 | import com.alibaba.fastjson.JSONArray; |
| 5 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 6 | import com.cnlive.shenhe.bean.ErrorEnum; | 5 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 7 | import com.cnlive.shenhe.bean.ResponseBean; | 6 | import com.cnlive.shenhe.bean.ResponseBean; |
| 8 | -import com.cnlive.shenhe.entity.*; | ||
| 9 | -import com.cnlive.shenhe.job.VideosJob; | 7 | +import com.cnlive.shenhe.entity.ShyUsers; |
| 8 | +import com.cnlive.shenhe.entity.ShyUsersfree; | ||
| 9 | +import com.cnlive.shenhe.entity.ShyVideos; | ||
| 10 | +import com.cnlive.shenhe.entity.ShyYidun; | ||
| 10 | import com.cnlive.shenhe.mapper.ShySitesMapper; | 11 | import com.cnlive.shenhe.mapper.ShySitesMapper; |
| 11 | import com.cnlive.shenhe.mapper.ShyUsersMapper; | 12 | import com.cnlive.shenhe.mapper.ShyUsersMapper; |
| 12 | import com.cnlive.shenhe.mapper.ShyVideosMapper; | 13 | import com.cnlive.shenhe.mapper.ShyVideosMapper; |
| 13 | -import com.cnlive.shenhe.utils.*; | 14 | +import com.cnlive.shenhe.utils.AuditPass; |
| 15 | +import com.cnlive.shenhe.utils.CommonConst; | ||
| 16 | +import com.cnlive.shenhe.utils.CommonUtils; | ||
| 17 | +import com.cnlive.shenhe.utils.YiDunAntiFraudUtil; | ||
| 14 | import com.github.pagehelper.PageHelper; | 18 | import com.github.pagehelper.PageHelper; |
| 15 | import com.github.pagehelper.PageInfo; | 19 | import com.github.pagehelper.PageInfo; |
| 16 | - | ||
| 17 | - | ||
| 18 | import org.apache.ibatis.session.RowBounds; | 20 | import org.apache.ibatis.session.RowBounds; |
| 19 | import org.slf4j.Logger; | 21 | import org.slf4j.Logger; |
| 20 | import org.slf4j.LoggerFactory; | 22 | import org.slf4j.LoggerFactory; |
| @@ -25,7 +27,9 @@ import tk.mybatis.mapper.entity.Example; | @@ -25,7 +27,9 @@ import tk.mybatis.mapper.entity.Example; | ||
| 25 | 27 | ||
| 26 | import java.sql.Timestamp; | 28 | import java.sql.Timestamp; |
| 27 | import java.text.ParseException; | 29 | import java.text.ParseException; |
| 28 | -import java.util.*; | 30 | +import java.util.Date; |
| 31 | +import java.util.List; | ||
| 32 | +import java.util.UUID; | ||
| 29 | 33 | ||
| 30 | /** | 34 | /** |
| 31 | * @Auther: chenhao | 35 | * @Auther: chenhao |
| @@ -369,13 +373,12 @@ public class VideosServiceImpl { | @@ -369,13 +373,12 @@ public class VideosServiceImpl { | ||
| 369 | url = url + "(" + uuid + ")"; | 373 | url = url + "(" + uuid + ")"; |
| 370 | } | 374 | } |
| 371 | //易盾返回结果的类型 | 375 | //易盾返回结果的类型 |
| 372 | - String type = ""; | ||
| 373 | - //易盾失败结果的详情 | ||
| 374 | - String desc = ""; | ||
| 375 | //调用易盾智能图片审核接口 | 376 | //调用易盾智能图片审核接口 |
| 376 | JSONObject imagesFilter = YiDunAntiFraudUtil.getImagesFilter(jsonArray.toJSONString()); | 377 | JSONObject imagesFilter = YiDunAntiFraudUtil.getImagesFilter(jsonArray.toJSONString()); |
| 377 | - type = imagesFilter.getString("type"); | ||
| 378 | - desc = imagesFilter.getString("desc"); | 378 | + //易盾返回结果的类型 |
| 379 | + String type = imagesFilter.getString("type"); | ||
| 380 | + //易盾失败结果的详情 | ||
| 381 | + String desc = imagesFilter.getString("desc"); | ||
| 379 | if (type.toLowerCase().equals(CommonConst.PASS)) { | 382 | if (type.toLowerCase().equals(CommonConst.PASS)) { |
| 380 | shyVideos.setMsg(desc); | 383 | shyVideos.setMsg(desc); |
| 381 | //修改点播云视频状态 | 384 | //修改点播云视频状态 |
| @@ -470,7 +473,7 @@ public class VideosServiceImpl { | @@ -470,7 +473,7 @@ public class VideosServiceImpl { | ||
| 470 | //审核类型,1:免审,2:机审,3:人工审 | 473 | //审核类型,1:免审,2:机审,3:人工审 |
| 471 | Integer shenheType = 3; | 474 | Integer shenheType = 3; |
| 472 | //如果当前sp是免审sp | 475 | //如果当前sp是免审sp |
| 473 | - if (sites.contains(shyVideo.getSpid()) || shyActivities.contains(shyVideo.getSource())){ | 476 | + if (sites.contains(shyVideo.getSpid()) || shyActivities.contains(shyVideo.getSource())) { |
| 474 | //免审 | 477 | //免审 |
| 475 | shenheType = 1; | 478 | shenheType = 1; |
| 476 | } else { | 479 | } else { |
src/main/java/com/cnlive/shenhe/utils/YiDunAntiFraudUtil.java
| @@ -2,8 +2,6 @@ package com.cnlive.shenhe.utils; | @@ -2,8 +2,6 @@ package com.cnlive.shenhe.utils; | ||
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONArray; | 3 | import com.alibaba.fastjson.JSONArray; |
| 4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | -import com.cnlive.shenhe.api.AvsampleCallBackControllerApi; | ||
| 6 | -import com.cnlive.shenhe.entity.ShyYidun; | ||
| 7 | import com.cnlive.shenhe.enums.ImageLabels; | 5 | import com.cnlive.shenhe.enums.ImageLabels; |
| 8 | import com.cnlive.shenhe.enums.TextLabels; | 6 | import com.cnlive.shenhe.enums.TextLabels; |
| 9 | import com.cnlive.shenhe.serviceImpl.YiDunServiceImpl; | 7 | import com.cnlive.shenhe.serviceImpl.YiDunServiceImpl; |
| @@ -141,7 +139,7 @@ public class YiDunAntiFraudUtil { | @@ -141,7 +139,7 @@ public class YiDunAntiFraudUtil { | ||
| 141 | * @param url | 139 | * @param url |
| 142 | * @return | 140 | * @return |
| 143 | */ | 141 | */ |
| 144 | - public static JSONObject submitAudioOnDemandUrl(String url,String callbackUrl) { | 142 | + public static JSONObject submitAudioOnDemandUrl(String url, String callbackUrl) { |
| 145 | try { | 143 | try { |
| 146 | Map<String, String> params = new HashMap<>(); | 144 | Map<String, String> params = new HashMap<>(); |
| 147 | // 1.设置公共参数 | 145 | // 1.设置公共参数 |
| @@ -265,7 +263,7 @@ public class YiDunAntiFraudUtil { | @@ -265,7 +263,7 @@ public class YiDunAntiFraudUtil { | ||
| 265 | public static JSONObject getImagesFilter(String jsonImg) { | 263 | public static JSONObject getImagesFilter(String jsonImg) { |
| 266 | JSONObject jsonObj = new JSONObject(); | 264 | JSONObject jsonObj = new JSONObject(); |
| 267 | try { | 265 | try { |
| 268 | - Map<String, String> params = new HashMap<String, String>(); | 266 | + Map<String, String> params = new HashMap<>(7); |
| 269 | // 1.设置公共参数 | 267 | // 1.设置公共参数 |
| 270 | params.put("secretId", TEXTANDIMAGESECRETID); | 268 | params.put("secretId", TEXTANDIMAGESECRETID); |
| 271 | params.put("businessId", IMAGEBUSINESSID); | 269 | params.put("businessId", IMAGEBUSINESSID); |