diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MessagePushTextFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MessagePushTextFormDTO.java
new file mode 100644
index 0000000000..e30ff760e5
--- /dev/null
+++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MessagePushTextFormDTO.java
@@ -0,0 +1,27 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Author zxc
+ * @CreateTime 2020/7/28 14:35
+ */
+@Data
+public class MessagePushTextFormDTO implements Serializable {
+
+ private static final long serialVersionUID = 2156552140364818299L;
+
+ private String ToUserName;
+ private String FromUserName;
+ private Date weChatCreateTime;
+ private String MsgType;
+ private String Content;
+ private String MsgId;
+ private Integer delFlag = 0;
+ private Integer revision = 0;
+ private String createdBy = "APP_USER";
+ private String updatedBy = "APP_USER";
+}
diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/CodeConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/CodeConstant.java
index e3735ec240..58da54fe8f 100644
--- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/CodeConstant.java
+++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/CodeConstant.java
@@ -49,6 +49,9 @@ public interface CodeConstant {
String OPER_UPLOAD = "上传代码";
String OPER_SUBMIT = "提交审核";
+ String OPER_SUCCESS = "审核成功";
+ String OPER_FAILED = "审核被拒绝";
+ String OPER_DELAY = "审核延后";
String OPER_UNDO = "审核撤回";
String OPER_RELEASE = "发布";
}
diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MessagePushTextDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MessagePushTextDao.java
new file mode 100644
index 0000000000..6c5857c303
--- /dev/null
+++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MessagePushTextDao.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.form.MessagePushTextFormDTO;
+import com.epmet.entity.MessagePushTextEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ *
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-07-28
+ */
+@Mapper
+public interface MessagePushTextDao extends BaseDao {
+
+ int insertMessageText(MessagePushTextFormDTO entity);
+}
\ No newline at end of file
diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MessagePushTextEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MessagePushTextEntity.java
new file mode 100644
index 0000000000..2c22ad097d
--- /dev/null
+++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MessagePushTextEntity.java
@@ -0,0 +1,71 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ *
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-07-28
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("message_push_text")
+public class MessagePushTextEntity extends BaseEpmetEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 开发者微信号
+ */
+ private String toUserName;
+
+ /**
+ * 发送方帐号(一个OpenID)
+ */
+ private String fromUserName;
+
+ /**
+ * 消息创建时间
+ */
+ private Date wechatCreateTime;
+
+ /**
+ * 消息类型,文本为text
+ */
+ private String msgType;
+
+ /**
+ * 文本消息内容
+ */
+ private String content;
+
+ /**
+ * 消息id,64位整型
+ */
+ private String msgId;
+
+}
diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java
index 85979d119d..df3c720e97 100644
--- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java
+++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java
@@ -178,18 +178,18 @@ public class CodeServiceImpl implements CodeService {
if (result.getStatus() == NumConstant.ZERO) {
code.setStatus(CodeConstant.AUDIT_SUCCESS);
auditResult.setResult(CodeConstant.AUDIT_SUCCESS);
- codeOperationHistoryService.updateDescribe(code.getId(), "审核成功");
+ saveOperation(formDTO.getCustomerId(), code.getId(), code.getUserVersion(), CodeConstant.OPER_SUCCESS, "审核成功");
} else if (result.getStatus() == NumConstant.ONE) {
code.setStatus(CodeConstant.AUDIT_FAILED);
auditResult.setResult(CodeConstant.AUDIT_FAILED);
auditResult.setReason(result.getReason());
auditResult.setScreenShot(result.getScreenshot());
- codeOperationHistoryService.updateDescribe(code.getId(), result.getReason());
+ saveOperation(formDTO.getCustomerId(), code.getId(), code.getUserVersion(), CodeConstant.OPER_FAILED, result.getReason());
} else if (result.getStatus() == NumConstant.FOUR) {
code.setStatus(CodeConstant.DELAY);
auditResult.setResult(CodeConstant.DELAY);
auditResult.setReason(result.getReason());
- codeOperationHistoryService.updateDescribe(code.getId(), "审核延后");
+ saveOperation(formDTO.getCustomerId(), code.getId(), code.getUserVersion(), CodeConstant.OPER_DELAY, result.getReason());
}
codeCustomerService.update(code);
codeAuditResultService.update(auditResult);
@@ -238,6 +238,7 @@ public class CodeServiceImpl implements CodeService {
codeAuditResultDTO.setResult(CodeConstant.AUDITING);
codeAuditResultService.save(codeAuditResultDTO);
} else {
+ codeAuditResultDTO.setAuditId(wxResult.getData());
codeAuditResultDTO.setResult(CodeConstant.AUDITING);
codeAuditResultService.update(codeAuditResultDTO);
}
@@ -349,10 +350,10 @@ public class CodeServiceImpl implements CodeService {
request.setAuditId(codeAuditResultDTO.getAuditId());
WxMaNewsReq wxMaNewsReq = new WxMaNewsReq();
wxMaNewsReq.setMediaId(mediaId);
- WxResult wxAuditResult = wxMaCodeService.getMaterial(authInfo.getAuthorizerAccessToken(), wxMaNewsReq);
- wxAuditResult.getData().getNewsItem().forEach(news -> {
- urlList.add(news.getUrl());
- });
+ WxResult wxAuditResult = wxMaCodeService.getMaterial(authInfo.getAuthorizerAccessToken(), wxMaNewsReq);
+ MultipartFile file = new MockMultipartFile("file", "QRCode.jpg", "image/jpeg", wxAuditResult.getData());
+ Result uploadResult = ossFeignClient.uploadQrCode(file);
+ urlList.add(uploadResult.getData().getUrl());
});
result.setScreenshotUrl(urlList);
return result;
diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java
index c55f647789..71dbf9c3d4 100644
--- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java
+++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java
@@ -3,11 +3,9 @@ package com.epmet.service.impl;
import com.alibaba.nacos.client.config.utils.IOUtils;
import com.epmet.constant.ModuleConstant;
import com.epmet.constant.ThirdRunTimeInfoConstant;
-import com.epmet.dao.CodeAuditRecordDao;
-import com.epmet.dao.CodeAuditResultDao;
-import com.epmet.dao.CodeCustomerDao;
-import com.epmet.dao.MiniInfoDao;
+import com.epmet.dao.*;
import com.epmet.dto.form.CodeAuditRecordFormDTO;
+import com.epmet.dto.form.MessagePushTextFormDTO;
import com.epmet.dto.result.CustomerIdAndClientResultDTO;
import com.epmet.dto.result.TemplateAndAppIdResultDTO;
import com.epmet.mpaes.AesException;
@@ -55,6 +53,10 @@ public class WarrantServiceImpl implements WarrantService {
private CodeCustomerDao codeCustomerDao;
@Autowired
private CodeAuditResultDao codeAuditResultDao;
+ @Autowired
+ private ComponentVerifyTicketServiceImpl componentVerifyTicketServiceImpl;
+ @Autowired
+ private MessagePushTextDao messagePushTextDao;
/**
* @Description 1.保存代码审核结果 2.更新代码上传结果
@@ -91,9 +93,10 @@ public class WarrantServiceImpl implements WarrantService {
Map result = WXXmlToMapUtil.multilayerXmlToMap(msg);
Map xml = (Map) result.get(ModuleConstant.XML);
if (xml.get(ModuleConstant.MSG_TYPE).equals(ModuleConstant.EVENT_LOW)) {
+ // TODO 目前来看,msgType = ‘event’ 的是代码审核结果
Long createTime = Long.valueOf(xml.get(ModuleConstant.CREATE_TIME).toString());
CodeAuditRecordFormDTO codeAuditRecord = componentVerifyTicketService.mapToEntity(xml, CodeAuditRecordFormDTO.class);
- codeAuditRecord.setWechatCreateTime(new Date(createTime));
+ codeAuditRecord.setWechatCreateTime(componentVerifyTicketServiceImpl.sToDate(createTime.toString()));
String toUserName = codeAuditRecord.getToUserName();//小程序原始ID
CustomerIdAndClientResultDTO customerIdAndClientResultDTO = miniInfoDao.selectCustomerIdAndClientByToUserName(toUserName);
String clientType = customerIdAndClientResultDTO.getClientType();
@@ -113,15 +116,23 @@ public class WarrantServiceImpl implements WarrantService {
switch (event) {
case ModuleConstant.WEAPP_AUDIT_SUCCESS:
codeResult = ModuleConstant.AUDIT_SUCCESS;
+ break;
case ModuleConstant.WEAPP_AUDIT_FAIL:
codeResult = ModuleConstant.AUDIT_FAILED;
+ break;
case ModuleConstant.WEAPP_AUDIT_DELAY:
codeResult = ModuleConstant.DELAY;
+ break;
}
String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord);
codeAuditResultDao.updateAuditResult(customerId, codeCustomerId, codeResult);
}else if (xml.get(ModuleConstant.MSG_TYPE).equals(ModuleConstant.TEXT)){
-
+ // TODO 公众号回复消息
+ MessagePushTextFormDTO messagePushTextFormDTO = componentVerifyTicketService.mapToEntity(xml, MessagePushTextFormDTO.class);
+ Object createTime = xml.get(ModuleConstant.CREATE_TIME);
+ Date date = componentVerifyTicketServiceImpl.sToDate(createTime.toString());
+ messagePushTextFormDTO.setWeChatCreateTime(date);
+ messagePushTextDao.insertMessageText(messagePushTextFormDTO);
}
return ModuleConstant.SUCCESS;
}
diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java
index dca678a55e..b22c03e451 100644
--- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java
+++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java
@@ -110,7 +110,7 @@ public interface WxMaCodeService {
* @author zhaoqifeng
* @date 2020/7/16 14:52
*/
- WxResult getMaterial(String accessToken, WxMaNewsReq request);
+ WxResult getMaterial(String accessToken, WxMaNewsReq request);
/**
* 设置服务器郁闷
diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java
index e6fcafb53f..3c9917d9e8 100644
--- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java
+++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java
@@ -10,6 +10,7 @@ import com.epmet.wxapi.result.*;
import com.epmet.wxapi.service.WxMaCodeService;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import com.google.gson.reflect.TypeToken;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -19,7 +20,9 @@ import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
+import java.util.Collections;
import java.util.List;
+import java.util.Map;
/**
* 描述一下
@@ -198,19 +201,16 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
}
@Override
- public WxResult getMaterial(String accessToken, WxMaNewsReq request) {
- WxResult result = new WxResult<>();
+ public WxResult getMaterial(String accessToken, WxMaNewsReq request) {
+ WxResult result = new WxResult<>();
String url = WxMaCodeConstant.GET_MATERIAL_URL + "?" + "access_token=" + accessToken;
- Result statusResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request));
+ Result statusResult = HttpClientManager.getInstance().getByteArray(url, toMap(request));
if (!statusResult.success()) {
result.setErrorCode(statusResult.getCode());
result.setErrorMsg(statusResult.getMsg());
return result;
}
- Gson gson = new Gson();
- InputStream inputStream = gson.fromJson(statusResult.getData(), InputStream.class);
- WxMaNewsResult newsResult = gson.fromJson(statusResult.getData(), WxMaNewsResult.class);
- result.ok(newsResult);
+ result.ok(statusResult.getData());
return result;
}
@@ -279,4 +279,12 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
Gson gson = gsonBuilder.create();
return gson.toJson(object);
}
+
+ private Map toMap(Object object) {
+ Gson gson = new Gson();
+ if(object == null){
+ return Collections.emptyMap();
+ }
+ return gson.fromJson(toJson(object), new TypeToken