Commit 520654bc7c34b8998721abd6589e1e26a63d510c
1 parent
cc05efba
增加朋友圈内容
Showing
1 changed file
with
73 additions
and
3 deletions
src/main/java/com/cnlive/shenhe/api/ContentControllerApi.java
| ... | ... | @@ -39,12 +39,13 @@ public class ContentControllerApi { |
| 39 | 39 | */ |
| 40 | 40 | @PostMapping("/import") |
| 41 | 41 | @ResponseBody |
| 42 | - public ResponseBean impotComment(String param) { | |
| 42 | + public ResponseBean impotContent(String param) { | |
| 43 | 43 | logger.info("图文入库,param=====" + param); |
| 44 | 44 | JSONObject json = JSONObject.parseObject(param); |
| 45 | 45 | //判断是否存在 |
| 46 | 46 | ShyContent shyContent=new ShyContent(); |
| 47 | 47 | shyContent.setContent_id(json.getString("contentId")); |
| 48 | + shyContent.setContent_tag("content");//图文标签 | |
| 48 | 49 | List<ShyContent> contentList = contentService.findshyContent(shyContent); |
| 49 | 50 | //存在则更新 |
| 50 | 51 | if (contentList.size() > 0) { |
| ... | ... | @@ -65,7 +66,7 @@ public class ContentControllerApi { |
| 65 | 66 | shyContent1.setCallback(json.getString("callback"));//回调地址 |
| 66 | 67 | shyContent1.setContent_url(json.getString("contentUrl"));//图文发布的url |
| 67 | 68 | shyContent1.setSp_id(json.getInteger("spId"));//spid |
| 68 | - shyContent1.setContent_tag(json.getString("contentTag"));//图文标签 | |
| 69 | + shyContent1.setContent_tag("content");//图文标签 | |
| 69 | 70 | shyContent1.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 |
| 70 | 71 | shyContent1.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 |
| 71 | 72 | |
| ... | ... | @@ -95,7 +96,6 @@ public class ContentControllerApi { |
| 95 | 96 | shyContent.setCallback(json.getString("callback"));//回调地址 |
| 96 | 97 | shyContent.setContent_url(json.getString("contentUrl"));//图文发布的url |
| 97 | 98 | shyContent.setSp_id(json.getInteger("spId"));//spid |
| 98 | - shyContent.setContent_tag(json.getString("contentTag"));//图文标签 | |
| 99 | 99 | shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 |
| 100 | 100 | shyContent.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 |
| 101 | 101 | boolean YorN = contentService.impotContent(shyContent); |
| ... | ... | @@ -105,5 +105,75 @@ public class ContentControllerApi { |
| 105 | 105 | return new ResponseBean(ErrorEnum.ERROR); |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | + | |
| 109 | + | |
| 110 | + /** | |
| 111 | + * @author liwei | |
| 112 | + * @Date: 2019/05/15 11:17 | |
| 113 | + * @Description: 朋友圈送审接口 | |
| 114 | + */ | |
| 115 | + @PostMapping("/importMoment") | |
| 116 | + @ResponseBody | |
| 117 | + public ResponseBean impotMoment(String param) { | |
| 118 | + logger.info("朋友圈入库,param=====" + param); | |
| 119 | + JSONObject json = JSONObject.parseObject(param); | |
| 120 | + //判断是否存在 | |
| 121 | + ShyContent shyContent=new ShyContent(); | |
| 122 | + shyContent.setContent_id(json.getString("momentId"));//朋友圈id | |
| 123 | + shyContent.setContent_tag("moment");//朋友圈标签 | |
| 124 | + List<ShyContent> contentList = contentService.findshyContent(shyContent); | |
| 125 | + //存在则更新 | |
| 126 | + if (contentList.size() > 0) { | |
| 127 | + ShyContent shyContent1 = contentList.get(0); | |
| 128 | + shyContent1.setTitle(json.getString("title"));//标题 | |
| 129 | + shyContent1.setTitle_image(json.getString("image"));//用户头像 | |
| 130 | + shyContent1.setShenhe_type(CommonConst.AUDIT_TYPE_USER);//审核类型是人工 | |
| 131 | + String contentTime = json.getString("createTime");//朋友圈内容创建时间 | |
| 132 | + if (CommonUtils.isNotEmpty(contentTime)) { | |
| 133 | + Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); | |
| 134 | + shyContent1.setContent_time(timestamp); | |
| 135 | + | |
| 136 | + } | |
| 137 | + shyContent1.setCreate_date(CommonUtils.getCurrentTime()); | |
| 138 | + shyContent1.setCallback(json.getString("callbackUrl"));//回调地址 | |
| 139 | + shyContent1.setContent_url(json.getString("pageUrl"));//朋友圈分享的url | |
| 140 | + shyContent1.setSp_id(json.getInteger("spId"));//spid | |
| 141 | + shyContent1.setContent_tag("moment");//图文标签 | |
| 142 | + shyContent1.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 | |
| 143 | + shyContent1.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + boolean YorN = contentService.updateshyContent(shyContent1); | |
| 148 | + if (YorN == true) { | |
| 149 | + return new ResponseBean(ErrorEnum.SUCCESS); | |
| 150 | + } else { | |
| 151 | + return new ResponseBean(ErrorEnum.ERROR); | |
| 152 | + } | |
| 153 | + } | |
| 154 | + //如果不存在直接插入 | |
| 155 | + shyContent.setTitle(json.getString("title"));//标题 | |
| 156 | + shyContent.setTitle_image(json.getString("image"));//用户头像 | |
| 157 | + shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_USER);//审核类型是人工 | |
| 158 | + shyContent.setContent_status(0);//当前朋友圈内容的审核状态 | |
| 159 | + String contentTime = json.getString("createTime");//创建时间 | |
| 160 | + if (CommonUtils.isNotEmpty(contentTime)) { | |
| 161 | + Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); | |
| 162 | + shyContent.setContent_time(timestamp); | |
| 163 | + | |
| 164 | + } | |
| 165 | + shyContent.setCreate_date(CommonUtils.getCurrentTime()); | |
| 166 | + shyContent.setCallback(json.getString("callbackUrl"));//回调地址 | |
| 167 | + shyContent.setContent_url(json.getString("pageUrl"));//朋友圈分享的url | |
| 168 | + shyContent.setSp_id(json.getInteger("spId"));//spid | |
| 169 | + shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 | |
| 170 | + shyContent.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 | |
| 171 | + boolean YorN = contentService.impotContent(shyContent); | |
| 172 | + if (YorN == true) { | |
| 173 | + return new ResponseBean(ErrorEnum.SUCCESS); | |
| 174 | + } else { | |
| 175 | + return new ResponseBean(ErrorEnum.ERROR); | |
| 176 | + } | |
| 177 | + } | |
| 108 | 178 | |
| 109 | 179 | } | ... | ... |