Browse Source

Merge remote-tracking branch 'origin/dev_thirdplatform' into dev_thirdplatform

dev_shibei_match
zxc 5 years ago
parent
commit
3b41c857b5
  1. 24
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java
  2. 19
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java
  3. 101
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java
  4. 5
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java
  5. 2
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml

24
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java

@ -43,84 +43,100 @@ public class SubmitAuditFormDTO implements Serializable {
/** /**
* 用户生成内容场景UGC信息安全声明 * 用户生成内容场景UGC信息安全声明
*/ */
private List<UgcDeclareBean> ugcDeclare; private UgcDeclareBean ugcDeclare;
@NoArgsConstructor @NoArgsConstructor
@Data @Data
private static class ItemListBean { public static class ItemListBean {
/** /**
* 小程序的页面可通过获取小程序的页面列表接口获得 * 小程序的页面可通过获取小程序的页面列表接口获得
*/ */
@SerializedName("address")
private String address; private String address;
/** /**
* 小程序的标签用空格分隔标签至多 10 标签长度至多 20 * 小程序的标签用空格分隔标签至多 10 标签长度至多 20
*/ */
@SerializedName("tag")
private String tag; private String tag;
/** /**
* 一级类目名称 * 一级类目名称
*/ */
@SerializedName("first_class")
private String firstClass; private String firstClass;
/** /**
* 二级类目名称 * 二级类目名称
*/ */
@SerializedName("second_class")
private String secondClass; private String secondClass;
/** /**
* 三级类目名称 * 三级类目名称
*/ */
@SerializedName("third_class")
private String thirdClass; private String thirdClass;
/** /**
* 一级类目的 ID * 一级类目的 ID
*/ */
@SerializedName("first_id")
private String firstId; private String firstId;
/** /**
* 二级类目的 ID * 二级类目的 ID
*/ */
@SerializedName("second_id")
private String secondId; private String secondId;
/** /**
* 三级类目的 ID * 三级类目的 ID
*/ */
@SerializedName("third_id")
private String thirdId; private String thirdId;
/** /**
* 小程序页面的标题,标题长度至多 32 * 小程序页面的标题,标题长度至多 32
*/ */
@SerializedName("title")
private String title; private String title;
} }
@NoArgsConstructor @NoArgsConstructor
@Data @Data
private static class PreviewInfoBean { public static class PreviewInfoBean {
/** /**
* 录屏mediaid列表可以通过提审素材上传接口获得 * 录屏mediaid列表可以通过提审素材上传接口获得
*/ */
@SerializedName("Video_id_list")
private List<String> videoIdList; private List<String> videoIdList;
/** /**
* 截屏mediaid列表可以通过提审素材上传接口获得 * 截屏mediaid列表可以通过提审素材上传接口获得
*/ */
@SerializedName("pic_id_list")
private List<String> picIdList; private List<String> picIdList;
} }
@NoArgsConstructor @NoArgsConstructor
@Data @Data
private static class UgcDeclareBean { public static class UgcDeclareBean {
/** /**
* UGC场景 0,不涉及用户生成内容, 1.用户资料,2.图片,3.视频,4.文本,5其他, 可多选,当scene填0时无需填写下列字段 * UGC场景 0,不涉及用户生成内容, 1.用户资料,2.图片,3.视频,4.文本,5其他, 可多选,当scene填0时无需填写下列字段
*/ */
@SerializedName("scene")
private List<Integer> scene; private List<Integer> scene;
/** /**
* 当scene选其他时的说明,不超时256字 * 当scene选其他时的说明,不超时256字
*/ */
@SerializedName("other_scene_desc")
private String otherSceneDesc; private String otherSceneDesc;
/** /**
* 内容安全机制 1.使用平台建议的内容安全API,2.使用其他的内容审核产品,3.通过人工审核把关,4.未做内容审核把关 * 内容安全机制 1.使用平台建议的内容安全API,2.使用其他的内容审核产品,3.通过人工审核把关,4.未做内容审核把关
*/ */
@SerializedName("method")
private List<Integer> method; private List<Integer> method;
/** /**
* 是否有审核团队, 0.,1.,默认0 * 是否有审核团队, 0.,1.,默认0
*/ */
@SerializedName("has_audit_team")
private Integer hasAuditTeam; private Integer hasAuditTeam;
/** /**
* 说明当前对UGC内容的审核机制,不超过256字 * 说明当前对UGC内容的审核机制,不超过256字
*/ */
@SerializedName("audit_desc")
private String auditDesc; private String auditDesc;
} }
} }

19
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java

@ -161,11 +161,11 @@ public class CodeServiceImpl implements CodeService {
@Override @Override
public PageData uploadList(UploadListFormDTO formDTO) { public PageData uploadList(UploadListFormDTO formDTO) {
//获取小程序调用令牌 List<CodeCustomerDTO> auditingList = codeCustomerService.getAuditingCodeList();
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); if (null != auditingList && auditingList.size() > NumConstant.ZERO) {
if (null != authInfo) {
List<CodeCustomerDTO> auditingList = codeCustomerService.getAuditingCodeList();
auditingList.forEach(code -> { auditingList.forEach(code -> {
//获取小程序调用令牌
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(code.getCustomerId(), code.getClientType());
//获取审核结果信息 //获取审核结果信息
CodeAuditResultDTO auditResult = codeAuditResultService.getAuditResultByCodeId(code.getId()); CodeAuditResultDTO auditResult = codeAuditResultService.getAuditResultByCodeId(code.getId());
//调用微信API获取最新审核状态 //调用微信API获取最新审核状态
@ -182,10 +182,12 @@ public class CodeServiceImpl implements CodeService {
code.setStatus(CodeConstant.AUDIT_FAILED); code.setStatus(CodeConstant.AUDIT_FAILED);
auditResult.setResult(CodeConstant.AUDIT_FAILED); auditResult.setResult(CodeConstant.AUDIT_FAILED);
auditResult.setReason(result.getReason()); auditResult.setReason(result.getReason());
auditResult.setScreenShot(result.getScreenshot());
codeOperationHistoryService.updateDescribe(code.getId(), result.getReason()); codeOperationHistoryService.updateDescribe(code.getId(), result.getReason());
} else if (result.getStatus() == NumConstant.FOUR) { } else if (result.getStatus() == NumConstant.FOUR) {
code.setStatus(CodeConstant.DELAY); code.setStatus(CodeConstant.DELAY);
auditResult.setResult(CodeConstant.DELAY); auditResult.setResult(CodeConstant.DELAY);
auditResult.setReason(result.getReason());
codeOperationHistoryService.updateDescribe(code.getId(), "审核延后"); codeOperationHistoryService.updateDescribe(code.getId(), "审核延后");
} }
codeCustomerService.update(code); codeCustomerService.update(code);
@ -210,7 +212,13 @@ public class CodeServiceImpl implements CodeService {
throw new RenException("未授权"); throw new RenException("未授权");
} }
//调用微信API上提交审核 //调用微信API上提交审核
WxMaCodeSubmitAuditRequest request = ConvertUtils.sourceToTarget(formDTO, WxMaCodeSubmitAuditRequest.class); WxMaCodeSubmitAuditRequest request = new WxMaCodeSubmitAuditRequest();
request.setVersionDesc(formDTO.getVersionDesc());
request.setFeedbackInfo(formDTO.getFeedbackInfo());
request.setFeedbackStuff(formDTO.getFeedbackStuff());
request.setItemList(formDTO.getItemList());
request.setPreviewInfo(formDTO.getPreviewInfo());
request.setUgcDeclare(formDTO.getUgcDeclare());
WxResult<String> wxResult = wxMaCodeService.submitAudit(authInfo.getAuthorizerAccessToken(), request); WxResult<String> wxResult = wxMaCodeService.submitAudit(authInfo.getAuthorizerAccessToken(), request);
if (!wxResult.success()) { if (!wxResult.success()) {
saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getId(), codeCustomerDTO.getUserVersion(), CodeConstant.OPER_SUBMIT, saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getId(), codeCustomerDTO.getUserVersion(), CodeConstant.OPER_SUBMIT,
@ -374,6 +382,7 @@ public class CodeServiceImpl implements CodeService {
@Override @Override
public String mediaUpload(MediaUploadFormDTO formDTO) { public String mediaUpload(MediaUploadFormDTO formDTO) {
try { try {
// Result<UploadDTO> uploadDTOResult = ossFeignClient.upload(formDTO.getMedia());
File file = MultipartFileToFileUtils.multipartFileToFile(formDTO.getMedia()); File file = MultipartFileToFileUtils.multipartFileToFile(formDTO.getMedia());
//获取上传代码信息 //获取上传代码信息
CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId());

101
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java

@ -1,5 +1,6 @@
package com.epmet.wxapi.param; package com.epmet.wxapi.param;
import com.epmet.dto.form.SubmitAuditFormDTO;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -36,110 +37,16 @@ public class WxMaCodeSubmitAuditRequest implements Serializable {
* 审核项列表选填至多填写 5 * 审核项列表选填至多填写 5
*/ */
@SerializedName("item_list") @SerializedName("item_list")
private List<ItemListBean> itemList; private List<SubmitAuditFormDTO.ItemListBean> itemList;
/** /**
* 预览信息小程序页面截图和操作录屏 * 预览信息小程序页面截图和操作录屏
*/ */
@SerializedName("preview_info") @SerializedName("preview_info")
private List<PreviewInfoBean> previewInfo; private List<SubmitAuditFormDTO.PreviewInfoBean> previewInfo;
/** /**
* 用户生成内容场景UGC信息安全声明 * 用户生成内容场景UGC信息安全声明
*/ */
@SerializedName("ugc_declare") @SerializedName("ugc_declare")
private List<UgcDeclareBean> ugcDeclare; private SubmitAuditFormDTO.UgcDeclareBean ugcDeclare;
@NoArgsConstructor
@Data
private static class ItemListBean {
/**
* 小程序的页面可通过获取小程序的页面列表接口获得
*/
@SerializedName("address")
private String address;
/**
* 小程序的标签用空格分隔标签至多 10 标签长度至多 20
*/
@SerializedName("tag")
private String tag;
/**
* 一级类目名称
*/
@SerializedName("first_class")
private String firstClass;
/**
* 二级类目名称
*/
@SerializedName("second_class")
private String secondClass;
/**
* 三级类目名称
*/
@SerializedName("third_class")
private String thirdClass;
/**
* 一级类目的 ID
*/
@SerializedName("first_id")
private String firstId;
/**
* 二级类目的 ID
*/
@SerializedName("second_id")
private String secondId;
/**
* 三级类目的 ID
*/
@SerializedName("third_id")
private String thirdId;
/**
* 小程序页面的标题,标题长度至多 32
*/
@SerializedName("title")
private String title;
}
@NoArgsConstructor
@Data
private static class PreviewInfoBean {
/**
* 录屏mediaid列表可以通过提审素材上传接口获得
*/
@SerializedName("Video_id_list")
private List<String> videoIdList;
/**
* 截屏mediaid列表可以通过提审素材上传接口获得
*/
@SerializedName("pic_id_list")
private List<String> picIdList;
}
@NoArgsConstructor
@Data
private static class UgcDeclareBean {
/**
* UGC场景 0,不涉及用户生成内容, 1.用户资料,2.图片,3.视频,4.文本,5其他, 可多选,当scene填0时无需填写下列字段
*/
@SerializedName("scene")
private List<Integer> scene;
/**
* 当scene选其他时的说明,不超时256字
*/
@SerializedName("other_scene_desc")
private String otherSceneDesc;
/**
* 内容安全机制 1.使用平台建议的内容安全API,2.使用其他的内容审核产品,3.通过人工审核把关,4.未做内容审核把关
*/
@SerializedName("method")
private List<Integer> method;
/**
* 是否有审核团队, 0.,1.,默认0
*/
@SerializedName("has_audit_team")
private Integer hasAuditTeam;
/**
* 说明当前对UGC内容的审核机制,不超过256字
*/
@SerializedName("audit_desc")
private String auditDesc;
}
} }

5
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java

@ -10,12 +10,14 @@ import com.epmet.wxapi.result.*;
import com.epmet.wxapi.service.WxMaCodeService; import com.epmet.wxapi.service.WxMaCodeService;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File; import java.io.File;
import java.io.InputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -149,7 +151,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
@Override @Override
public WxResult<WxMaAuditStatusResult> getAuditStatus(String accessToken, WxMaCodeAuditStatusReq request) { public WxResult<WxMaAuditStatusResult> getAuditStatus(String accessToken, WxMaCodeAuditStatusReq request) {
WxResult<WxMaAuditStatusResult> result = new WxResult<>(); WxResult<WxMaAuditStatusResult> result = new WxResult<>();
String url = WxMaCodeConstant.COMMIT_URL + "?" + "access_token=" + accessToken; String url = WxMaCodeConstant.GET_AUDIT_STATUS_URL + "?" + "access_token=" + accessToken;
Result<String> statusResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); Result<String> statusResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request));
if (!statusResult.success()) { if (!statusResult.success()) {
result.setErrorCode(statusResult.getCode()); result.setErrorCode(statusResult.getCode());
@ -209,6 +211,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
return result; return result;
} }
Gson gson = new Gson(); Gson gson = new Gson();
InputStream inputStream = gson.fromJson(statusResult.getData(), InputStream.class);
WxMaNewsResult newsResult = gson.fromJson(statusResult.getData(), WxMaNewsResult.class); WxMaNewsResult newsResult = gson.fromJson(statusResult.getData(), WxMaNewsResult.class);
result.ok(newsResult); result.ok(newsResult);
return result; return result;

2
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml

@ -19,7 +19,7 @@
</resultMap> </resultMap>
<update id="updateDescribeByCodeId"> <update id="updateDescribeByCodeId">
UPDATE code_operation_history SET UPDATE code_operation_history SET
`DESCRIPTION` = #{description} `DESCRIPTION` = #{describe}
WHERE CODE_ID = #{codeId} WHERE CODE_ID = #{codeId}
AND OPERATION = 'audit' AND OPERATION = 'audit'
</update> </update>

Loading…
Cancel
Save