|
@@ -1,13 +1,19 @@
|
|
package com.sxtvs.open.api.clue.service.impl;
|
|
package com.sxtvs.open.api.clue.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
+import cn.hutool.http.HttpRequest;
|
|
|
|
+import cn.hutool.http.HttpResponse;
|
|
|
|
+import cn.hutool.http.HttpUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.sxtvs.open.api.clue.dto.ClueDTO;
|
|
import com.sxtvs.open.api.clue.dto.ClueDTO;
|
|
import com.sxtvs.open.api.clue.dto.VerifyDTO;
|
|
import com.sxtvs.open.api.clue.dto.VerifyDTO;
|
|
|
|
+import com.sxtvs.open.api.clue.dto.WxReply;
|
|
import com.sxtvs.open.api.clue.entity.*;
|
|
import com.sxtvs.open.api.clue.entity.*;
|
|
import com.sxtvs.open.api.clue.mapper.ClueMapper;
|
|
import com.sxtvs.open.api.clue.mapper.ClueMapper;
|
|
import com.sxtvs.open.api.clue.service.IClueService;
|
|
import com.sxtvs.open.api.clue.service.IClueService;
|
|
@@ -45,6 +51,9 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements IC
|
|
@Resource
|
|
@Resource
|
|
private ClueInfoServiceImpl clueInfoService;
|
|
private ClueInfoServiceImpl clueInfoService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private ObjectMapper objectMapper;
|
|
|
|
+
|
|
public IPage<Clue> cluePage(ClueDTO clueDTO){
|
|
public IPage<Clue> cluePage(ClueDTO clueDTO){
|
|
|
|
|
|
LambdaQueryWrapper<Clue> wrapper = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<Clue> wrapper = Wrappers.lambdaQuery();
|
|
@@ -98,6 +107,25 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements IC
|
|
clueReply.setId(null);
|
|
clueReply.setId(null);
|
|
clueReply.setReplyTime(LocalDateTime.now());
|
|
clueReply.setReplyTime(LocalDateTime.now());
|
|
clueReply.setModifyTime(LocalDateTime.now());
|
|
clueReply.setModifyTime(LocalDateTime.now());
|
|
|
|
+
|
|
|
|
+ //公众号
|
|
|
|
+ if (clue.getSource() == 2){
|
|
|
|
+ WxReply wxReply = new WxReply();
|
|
|
|
+ wxReply.setMsgtype("text");
|
|
|
|
+ WxReply.TextDTO textDTO = new WxReply.TextDTO();
|
|
|
|
+ textDTO.setContent(clueReply.getContent());
|
|
|
|
+ wxReply.setText(textDTO);
|
|
|
|
+ wxReply.setTouser(clue.getAuthor());
|
|
|
|
+ try {
|
|
|
|
+ HttpResponse resp = HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" + WxTokenCache.getInstance().getAccessToken())
|
|
|
|
+ .body(objectMapper.writeValueAsString(wxReply)).contentType("application/json;charset=UTF-8").execute();
|
|
|
|
+ System.out.println(resp.body());
|
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
clueReplyService.save(clueReply);
|
|
clueReplyService.save(clueReply);
|
|
}
|
|
}
|
|
|
|
|