Browse Source

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

# Conflicts:
#	epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java
#	epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java
master
jianjun 4 years ago
parent
commit
4441505ddc
  1. 2
      epmet-cloud-generator/src/main/resources/application.yml
  2. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  3. 18
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  4. 94
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
  5. 1
      epmet-gateway/src/main/resources/bootstrap.yml
  6. 21
      epmet-module/epmet-third/epmet-third-client/pom.xml
  7. 11
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ApiServiceActions.java
  8. 22
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdPlatformActions.java
  9. 107
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectApplyAssistFormDTO.java
  10. 87
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectDetailDTO.java
  11. 19
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SaveOrUpdateCustSelPlatformFormDTO.java
  12. 20
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/TPFDemoFormDTO.java
  13. 53
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java
  14. 32
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadFileFormDTO.java
  15. 13
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ProjectAssistResult.java
  16. 15
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java
  17. 16
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/UploadFileResultDTO.java
  18. 64
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdOpenFeignClient.java
  19. 37
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java
  20. 52
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdOpenFeignClientFallback.java
  21. 25
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java
  22. 261
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/ApiService.java
  23. 36
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/DemoApiService.java
  24. 137
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/LuzhouGridPlatformApiService.java
  25. 11
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformBaseResult.java
  26. 13
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformProjectAssistResult.java
  27. 75
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ProjectController.java
  28. 92
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java
  29. 41
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformActionDao.java
  30. 38
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java
  31. 38
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java
  32. 46
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java
  33. 52
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformActionEntity.java
  34. 56
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerActionEntity.java
  35. 55
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerRegisterEntity.java
  36. 71
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java
  37. 46
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ApiServiceSelector.java
  38. 33
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ProjectService.java
  39. 25
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java
  40. 60
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  41. 108
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java
  42. 61
      epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.13__addPlatformDDLS.sql
  43. 36
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformActionDao.xml
  44. 45
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml
  45. 38
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml
  46. 90
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml
  47. 3
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java
  48. 5
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java
  49. 5
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectProcessDTO.java
  50. 126
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubAttachmentDTO.java
  51. 136
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubProcessDTO.java
  52. 7
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ParameterFormDTO.java
  53. 39
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/PlatformCallBackFormDTO.java
  54. 5
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectDetailFromDTO.java
  55. 55
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/SendToFormDTO.java
  56. 35
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java
  57. 24
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/PlatformFileDTO.java
  58. 11
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProcessListV2ResultDTO.java
  59. 15
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java
  60. 42
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java
  61. 21
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java
  62. 11
      epmet-module/gov-project/gov-project-server/pom.xml
  63. 6
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ParameterKeyConstant.java
  64. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java
  65. 41
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java
  66. 5
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectController.java
  67. 85
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubAttachmentController.java
  68. 85
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubProcessController.java
  69. 16
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java
  70. 10
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/CustomerProjectParameterDao.java
  71. 8
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectProcessDao.java
  72. 33
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubAttachmentDao.java
  73. 63
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java
  74. 5
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectProcessEntity.java
  75. 96
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubAttachmentEntity.java
  76. 106
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubProcessEntity.java
  77. 10
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java
  78. 8
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectProcessService.java
  79. 19
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java
  80. 95
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubAttachmentService.java
  81. 122
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java
  82. 10
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTraceService.java
  83. 102
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java
  84. 13
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java
  85. 551
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  86. 100
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubAttachmentServiceImpl.java
  87. 145
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java
  88. 39
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java
  89. 50
      epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.10__platform.sql
  90. 13
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectProcessDao.xml
  91. 28
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubAttachmentDao.xml
  92. 111
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubProcessDao.xml
  93. 10
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerThirdplatApiserviceDao.java
  94. 2
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerThirdplatApiServiceService.java
  95. 3
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerThirdplatApiServiceServiceImpl.java
  96. 14
      epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerThirdplatApiserviceDao.xml
  97. 18
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java
  98. 26
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java

2
epmet-cloud-generator/src/main/resources/application.yml

@ -9,7 +9,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
#MySQL配置
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.1.130:3306/epmet_gov_project?useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://192.168.1.130:3306/epmet_third?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: epmet_dba
password: EpmEt-dbA-UsEr
#oracle配置

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java

@ -63,6 +63,10 @@ public interface NumConstant {
String THREE_STR = "3";
String FOUR_STR = "4";
String FIVE_STR = "5";
String SIX_STR = "6";
String SEVEN_STR = "7";
String EIGHT_STR = "8";
String NINE_STR = "9";
String POSITIVE_EIGHT_STR = "+8";
String EMPTY_STR = "";
String ONE_NEG_STR = "-1";

18
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -391,4 +391,22 @@ public class RedisKeys {
public static String getOssFileKey(String path) {
return rootPrefix.concat("oss:temp:").concat(path);
}
/**
* 一个客户对应多个第三方平台多个ApiService的key
* @param customerId
* @return
*/
public static String listCustomerApiServiceListKey(String customerId) {
return rootPrefix.concat("customer:thirdplat:apiservicelist:").concat(customerId);
}
/**
* 查询第三方平台access token
* @param platformId
* @return
*/
public static String getThirdPlatformAccessTokenKey(String platformId) {
return rootPrefix.concat("thirdplatform:accesstoken:").concat(platformId);
}
}

94
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java

@ -6,6 +6,9 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
@ -23,6 +26,7 @@ import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
@ -32,16 +36,15 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.*;
import java.net.URLEncoder;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
@ -62,7 +65,7 @@ public class HttpClientManager {
// 连接超时时间,毫秒
private static int connectionTimeout = 5000;
// 读取数据超时时间,毫秒
private static int soTimeout = 20000;
private static int soTimeout = 45000;
private static String HEADER_CONTENT_TYPE = "Content-Type";
private static String HEADER_APPLICATION_JSON = "application/json;charset=utf-8";
private static String UTF8 = "utf-8";
@ -239,6 +242,32 @@ public class HttpClientManager {
}
}
public Result<String> uploadFile(String url, boolean isHttps, File file, String fileName, Map<String, Object> headerMap) {
try {
HttpPost httppost = new HttpPost(url);
httppost.setConfig(requestConfig);
if (null != headerMap) {
headerMap.forEach((k, v) -> {
if (v != null) {
httppost.addHeader(k, v.toString());
}
});
}
if (file != null) {
HttpEntity entity = MultipartEntityBuilder
.create()
.addBinaryBody("file", file, ContentType.MULTIPART_FORM_DATA, fileName)
.setMode(HttpMultipartMode.RFC6532)
.build();
httppost.setEntity(entity);
}
return execute(httppost,isHttps);
} catch (Exception e) {
log.error("send exception", e);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
/**
* desc: https发送json post 请求
* param: url,jsonStrParam
@ -436,6 +465,61 @@ public class HttpClientManager {
}
}
public Result<MultipartFile> getFileItem(String url, String fileName) {
try {
URIBuilder builder = new URIBuilder(url);
HttpGet httpGet = new HttpGet(builder.build());
httpGet.setConfig(requestConfig);
return executeToFile(httpGet, fileName);
} catch (Exception e) {
log.error("sendGet exception", e);
return new Result<MultipartFile >().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
private Result<MultipartFile> executeToFile(HttpRequestBase httpMethod, String fileName) {
CloseableHttpResponse response = null;
FileItem item = null;
try {
response = httpclient.execute(httpMethod);
log.debug("http send response:{}", JSON.toJSONString(response));
if (response != null && response.getStatusLine() != null) {
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
InputStream is = response.getEntity().getContent();
FileItemFactory factory = new DiskFileItemFactory(16, null);
String textFieldName = "file";
item = factory.createItem(textFieldName, ContentType.APPLICATION_OCTET_STREAM.toString(), false, fileName);
OutputStream os = item.getOutputStream();
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = is.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
os.close();
is.close();
return new Result<MultipartFile>().ok(new CommonsMultipartFile(item));
} else {
log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode());
}
}
} catch (Exception e) {
log.error("execute exception", e);
return new Result<MultipartFile>().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
} finally {
httpMethod.releaseConnection();
try {
if (response != null) {
response.close();
}
} catch (IOException e) {
}
}
return new Result<MultipartFile>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
public Result<byte[]> getMediaByteArray(String url, String json) {
try {

1
epmet-gateway/src/main/resources/bootstrap.yml

@ -466,6 +466,7 @@ epmet:
# 内部认证url白名单(在白名单中的,就不会再校验登录了)
internalAuthUrlsWhiteList:
- /epmetuser/customerstaff/customerlist
- /gov/project/project/platformcallback
# 外部应用认证,使用AccessToken等头进行认证
externalOpenUrls:

21
epmet-module/epmet-third/epmet-third-client/pom.xml

@ -19,6 +19,12 @@
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId>
<version>2.0.0</version>
<exclusions>
<exclusion>
<artifactId>feign-form-spring</artifactId>
<groupId>io.github.openfeign.form</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
@ -32,6 +38,21 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.github.openfeign.form</groupId>
<artifactId>feign-form</artifactId>
<version>3.8.0</version>
</dependency>
<dependency>
<groupId>io.github.openfeign.form</groupId>
<artifactId>feign-form-spring</artifactId>
<version>3.8.0</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.3</version>
</dependency>
</dependencies>
<build>

11
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ApiServiceActions.java

@ -0,0 +1,11 @@
package com.epmet.constant;
/**
* api service 常量列表
*/
public interface ApiServiceActions {
// 测试动作
String DEMO_ACTION = "demoAction";
}

22
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdPlatformActions.java

@ -0,0 +1,22 @@
package com.epmet.constant;
/**
* 第三方平台动作常量
* @author kamui
*/
public interface ThirdPlatformActions {
/**
* 获取accessToken
*/
String GET_ACCESS_TOKEN = "GET_ACCESS_TOKEN";
/**
* 项目协助
*/
String PROJECT_ASSIST = "PROJECT_ASSIST";
/**
* 上传文件
*/
String UPLOAD_FILE = "UPLOAD_FILE";
}

107
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectApplyAssistFormDTO.java

@ -0,0 +1,107 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author kamui
*/
@Data
public class ProjectApplyAssistFormDTO implements Serializable {
private static final long serialVersionUID = 2052722763454170462L;
private String customerId;
@NotBlank(message = "平台ID不能为空")
private String platformId;
/**
* 标题
*/
private String title;
/**
* 详细内容
*/
@NotBlank(message = "详细内容不能为空")
private String detail;
/**
* 期望结束时间
*/
private String expectEndTime;
/**
* 图片链接英文逗号分割的字符串
*/
private String imageLink;
/**
* 音频链接英文逗号分割的字符串
*/
private String voiceLink;
/**
* 视频链接英文逗号分割的字符串
*/
private String videoLink;
/**
* 当事人姓名
*/
private String personName;
/**
* 当事人手机
*/
private String mobile;
/**
* 详细地址
*/
@NotBlank(message = "详细地址不能为空")
private String detailAddress;
/**
* 来源需根据调用方传对应的值
* 封面新闻需传群众爆料
* 党建引领传党建引领
*/
@NotBlank(message = "来源不能为空")
private String source;
/**
* 经度
*/
@NotBlank(message = "经度不能为空")
private String longitude;
/**
* 纬度
*/
@NotBlank(message = "纬度不能为空")
private String latitude;
/**
*
*/
private String province;
/**
*
*/
private String city;
/**
* 区县
*/
private String area;
/**
* 街道
*/
private String street;
/**
* 社区
*/
private String houseEstate;
/**
* 外部事件id
*/
private String outEventId;
/**
* 外部用户id
*/
private String outUserId;
/**
* 通知接口的地址
*/
private String notifyUrl;
}

87
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectDetailDTO.java

@ -0,0 +1,87 @@
package com.epmet.dto.form;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/3/18 17:12
*/
@Data
public class ProjectDetailDTO implements Serializable {
private static final long serialVersionUID = -2172640364021337846L;
/**
* 议题标题
*/
private String issueTitle;
/**
* 议题状态(voting 已转项目shift_project 已关闭closed)
*/
private String issueStatus;
/**
* 议题发起人电话
* */
private String issuePublisherMobile;
/**
* 议题建议处理方式
*/
private String issueSuggestion;
/**
* 所属网格(网格所属机关单位名称-网格名称)
*/
private String belongsGridName;
/**
* 议题发起人山东路168-尹女士
*/
private String issueInitiator;
/**
* 话题内容
*/
private String topicContent;
/**
* 图片列表
*/
private List<String> photoList;
/**
* 话题发表人山东路168-尹女士
*/
private String topicPublisher;
/**
* 话题发表时间 (时间戳 毫秒级)
*/
private Long topicPublishTime;
/**
* 话题发表人电话
*/
private String topicPublisherMobile;
/**
* 公开答复
*/
private String publicReply;
/**
* 内部备注
*/
private String internalRemark;
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE);
}
}

19
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SaveOrUpdateCustSelPlatformFormDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.util.List;
@Data
public class SaveOrUpdateCustSelPlatformFormDTO {
@NotBlank(message = "客户id不能为空")
private String customerId;
@NotBlank(message = "actionKey不能为空")
private String actionKey;
private List<ThirdPlatformFormDTO> platforms;
}

20
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/TPFDemoFormDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 第三方平台-demo form dto
*/
@Data
public class TPFDemoFormDTO {
private String demoString;
@NotBlank(message = "客户ID不能为空")
private String customerId;
@NotBlank(message = "平台ID不能为空")
private String platformId;
}

53
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java

@ -0,0 +1,53 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class ThirdPlatformFormDTO {
// 根据客户和动作查询分组
public interface ListAvailableByCustomerAndActionGroup {}
// 根据动作查询分组
public interface ListSelectableByCustomerAndActionGroup {}
// 保存客户选中的平台列表
public interface SaveCustomerSelectedPlatformGroup {}
// 列出客户选中的平台列表
public interface ListSelectedPlatforms {}
// 更新客户自定义的平台信息
public interface UpdateCustomizePlatformInfo {}
public interface SaveOrUpdateSelectedPlatformInfo {}
@NotBlank(message = "客户ID不能为空", groups = { ListAvailableByCustomerAndActionGroup.class,
ListSelectableByCustomerAndActionGroup.class,
SaveCustomerSelectedPlatformGroup.class,
ListSelectedPlatforms.class,
UpdateCustomizePlatformInfo.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String customerId;
@NotBlank(message = "动作不能为空", groups = { ListAvailableByCustomerAndActionGroup.class,
ListSelectableByCustomerAndActionGroup.class,
SaveCustomerSelectedPlatformGroup.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String actionKey;
@NotBlank(message = "平台ID不能为空", groups = { SaveCustomerSelectedPlatformGroup.class,
UpdateCustomizePlatformInfo.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String platformId;
@NotBlank(message = "平台名称不能为空", groups = { UpdateCustomizePlatformInfo.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String platformName;
@NotBlank(message = "平台图标不能为空", groups = { UpdateCustomizePlatformInfo.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String icon;
}

32
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadFileFormDTO.java

@ -0,0 +1,32 @@
package com.epmet.dto.form;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/3/25 9:57
*/
@Data
public class UploadFileFormDTO implements Serializable {
private static final long serialVersionUID = 2911010733366812636L;
/**
* 客户ID
*/
private String customerId;
/**
* 平台ID
*/
@NotBlank(message = "平台ID不能为空")
private String platformId;
/**
* 文件
*/
private MultipartFile file;
}

13
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ProjectAssistResult.java

@ -0,0 +1,13 @@
package com.epmet.dto.result;
import lombok.Data;
@Data
public class ProjectAssistResult {
/**
* 任务id
*/
private String taskId;
}

15
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java

@ -0,0 +1,15 @@
package com.epmet.dto.result;
import lombok.Data;
@Data
public class ThirdplatformResultDTO {
/**
*
*/
private String platformId;
private String platformName;
private String icon;
}

16
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/UploadFileResultDTO.java

@ -0,0 +1,16 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/3/25 10:09
*/
@Data
public class UploadFileResultDTO implements Serializable {
private static final long serialVersionUID = -4986665750488963082L;
private String url;
}

64
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdOpenFeignClient.java

@ -0,0 +1,64 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.ProjectDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.feign.fallback.EpmetThirdOpenFeignClientFallback;
import com.epmet.feign.fallback.GovProjectOpenFeignClientFallback;
import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO;
import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* 本服务对外开放的API,其他服务通过引用此client调用该服务
*
* @author zhaoqifeng
* @date 2021/3/18 14:18
*/
// @FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = EpmetThirdOpenFeignClientFallback.class,configuration =
// EpmetThirdOpenFeignClient.MultipartSupportConfig.class,url = "localhost:8110")
@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = EpmetThirdOpenFeignClientFallback.class, configuration =
EpmetThirdOpenFeignClient.MultipartSupportConfig.class)
public interface EpmetThirdOpenFeignClient {
/**
* 请求项目协助
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author zhaoqifeng
* @date 2021/3/18 11:08
*/
@PostMapping("third/project/apply-assist")
Result<ProjectAssistResult> applyAssist(@RequestBody ProjectApplyAssistFormDTO formDTO);
/**
* 上传文件
* @author zhaoqifeng
* @date 2021/3/25 18:36
* @param file
* @param customerId
* @param platformId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.UploadFileResultDTO>
*/
@PostMapping(value= "third/project/uploadfile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
Result<UploadFileResultDTO> uploadFile(@RequestPart("file") MultipartFile file, @RequestParam("customerId") String customerId, @RequestParam(
"platformId") String platformId);
class MultipartSupportConfig {
@Bean
public Encoder feignFormEncoder() {
return new SpringFormEncoder();
}
}
}

37
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java

@ -0,0 +1,37 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.SaveOrUpdateCustSelPlatformFormDTO;
import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.feign.fallback.ThirdOpenFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = ThirdOpenFeignClientFallback.class)
//@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = ThirdOpenFeignClientFallback.class, url = "http://localhost:8110")
public interface ThirdOpenFeignClient {
/**
* @Description 保存或修改客户选中的第三方平台信息
* @return
* @author wxz
* @date 2021.03.19 15:25
*/
@PostMapping("/third/thirdplatform/customer/saveorupdate-selected-platforms")
Result saveOrUpdateSelectedPlatformsInfo(@RequestBody SaveOrUpdateCustSelPlatformFormDTO input);
/**
* 根据客户id和动作列出客户在指定动作下可用的第三方平台
* 用途工作端运营端配置界面
*
* @param input
* @return
*/
@PostMapping("/third/thirdplatform/customer/list-available-platforms-by-action")
Result<List<ThirdplatformResultDTO>> listAvailablePlatformsByCustomerAndAction(@RequestBody ThirdPlatformFormDTO input);
}

52
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdOpenFeignClientFallback.java

@ -0,0 +1,52 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.ProjectDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.feign.EpmetThirdOpenFeignClient;
import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
*
* @author zhaoqifeng
* @date 2021/3/18 14:17
*/
@Component
public class EpmetThirdOpenFeignClientFallback implements EpmetThirdOpenFeignClient {
/**
* 请求项目协助
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author zhaoqifeng
* @date 2021/3/18 11:08
*/
@Override
public Result<ProjectAssistResult> applyAssist(ProjectApplyAssistFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "applyAssist", formDTO);
}
/**
* 上传文件
*
* @param file
* @param customerId
* @param platformId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.UploadFileResultDTO>
* @author zhaoqifeng
* @date 2021/3/25 18:36
*/
@Override
public Result<UploadFileResultDTO> uploadFile(MultipartFile file, String customerId, String platformId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "uploadFile", customerId);
}
}

25
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java

@ -0,0 +1,25 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.SaveOrUpdateCustSelPlatformFormDTO;
import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.feign.ThirdOpenFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class ThirdOpenFeignClientFallback implements ThirdOpenFeignClient {
@Override
public Result saveOrUpdateSelectedPlatformsInfo(SaveOrUpdateCustSelPlatformFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "saveOrUpdateSelectedPlatformsInfo", input);
}
@Override
public Result<List<ThirdplatformResultDTO>> listAvailablePlatformsByCustomerAndAction(ThirdPlatformFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "listAvailablePlatformsByCustomerAndAction", input);
}
}

261
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/ApiService.java

@ -0,0 +1,261 @@
package com.epmet.apiservice;
import com.alibaba.fastjson.JSON;
import com.epmet.apiservice.result.LZGridPlatformBaseResult;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.dao.ThirdplatformActionDao;
import com.epmet.dao.ThirdplatformCustomerRegisterDao;
import com.epmet.dao.ThirdplatformDao;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.dto.form.TPFDemoFormDTO;
import com.epmet.dto.form.UploadFileFormDTO;
import com.epmet.dto.result.ProjectAssistResult;
import com.epmet.dto.result.UploadFileResultDTO;
import com.epmet.entity.ThirdplatformActionEntity;
import com.epmet.entity.ThirdplatformCustomerRegisterEntity;
import com.epmet.entity.ThirdplatformEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* ApiService对接第三方平台的抽象类每一个子类都对应一个第三方平台每个第三方平台都实现唯一一个子类
* 每一个具体平台的ApiService都是该抽象类的子类选择性实现抽象类中的某些需要实现方法提供具体业务逻辑
* 此抽象类中定义方法的具体返回类型所有子类都要统一使用在具体实现中做转换若是不需要返回返回null即可
*/
@Slf4j
public abstract class ApiService {
/**
* 重试次数
*/
protected final int RETRY_TIME = 3;
/**
* @Description 判断该客户是否注册了该平台
* @return true:已注册该平台可以使用false:未注册无法使用
* @author wxz
* @date 2021.03.15 11:09
*/
public boolean isRegistered(String customerId, String platformId) {
ThirdplatformCustomerRegisterDao tpcRegDao = SpringContextUtils.getBean(ThirdplatformCustomerRegisterDao.class);
ThirdplatformCustomerRegisterEntity tpcReg = tpcRegDao.getByCustomerIdAndPlatformId(customerId, platformId);
if (tpcReg == null) {
return false;
}
return true;
}
/**
* 发送get请求目前仅支持GET/POST
* @param platformId
* @param action
* @param params
* @param headers
* @return
*/
public String sendGetRequest(String platformId, String action, Map<String, Object> params, Map<String, Object> headers) {
// 1.获取token
String accessToken = getAccessToken(platformId);
//2.获取url
ThirdplatformEntity thirdplatform = SpringContextUtils.getBean(ThirdplatformDao.class).selectById(platformId);
ThirdplatformActionEntity actionEntity = SpringContextUtils.getBean(ThirdplatformActionDao.class)
.getByPlatformIdAndActionKey(platformId, action);
if (headers == null) {
headers = new HashMap<>();
}
// 填充access token到头当中
headers.put("X-Access-Token", accessToken);
log.info("apiService sendGetRequest param:{},headers:{}",params,headers);
Result<String> result = HttpClientManager.getInstance().sendGet(thirdplatform.getBaseUrl().concat(actionEntity.getApiUrl()),
thirdplatform.getBaseUrl().startsWith("https://"),
params,
headers);
log.info("apiService sendGetRequest result:{}",JSON.toJSONString(result));
if (result == null) {
throw new RenException("请求第三方平台,获取AccessToken失败。result为null");
}
if (result.success()) {
throw new RenException("请求第三方平台,获取AccessToken失败。");
}
LZGridPlatformBaseResult platformResult = JSON.parseObject(result.getData(), LZGridPlatformBaseResult.class);
judgeResultSuccess(platformResult);
return result.getData();
}
/**
* 发送post请求
* @param platformId
* @param action
* @param jsonString
* @param headers
* @return
*/
public String sendPostRequest(String platformId, String action, String jsonString, Map<String, Object> headers) {
// 1.获取token
String accessToken = getAccessToken(platformId);
//2.获取url
ThirdplatformEntity thirdplatform = SpringContextUtils.getBean(ThirdplatformDao.class).selectById(platformId);
ThirdplatformActionEntity actionEntity = SpringContextUtils.getBean(ThirdplatformActionDao.class)
.getByPlatformIdAndActionKey(platformId, action);
if (headers == null) {
headers = new HashMap<>();
}
// 填充access token到头当中
headers.put("X-Access-Token", accessToken);
log.info("apiService sendPostRequest param:{},headers:{}",jsonString,headers);
Result<String> result = HttpClientManager.getInstance().sendPost(thirdplatform.getBaseUrl().concat(actionEntity.getApiUrl()),
thirdplatform.getBaseUrl().startsWith("https://"),
jsonString,
headers);
log.info("apiService sendPostRequest result:{}",JSON.toJSONString(result));
if (result == null) {
throw new RenException("请求第三方平台,发送Post请求失败。result为null");
}
if (!result.success()) {
throw new RenException("请求第三方平台,发送Post请求失败。错误信息:" + result.getMsg());
}
LZGridPlatformBaseResult platformResult = JSON.parseObject(result.getData(), LZGridPlatformBaseResult.class);
judgeResultSuccess(platformResult);
return result.getData();
}
public String sendPostRequestToUploadFile(String platformId, String action, File file, String fileName) {
// 1.获取token
String accessToken = getAccessToken(platformId);
//2.获取url
ThirdplatformEntity thirdplatform = SpringContextUtils.getBean(ThirdplatformDao.class).selectById(platformId);
ThirdplatformActionEntity actionEntity = SpringContextUtils.getBean(ThirdplatformActionDao.class)
.getByPlatformIdAndActionKey(platformId, action);
Map<String, Object> headers = new HashMap<>();
// 填充access token到头当中
headers.put("X-Access-Token", accessToken);
log.info("apiService sendPostRequestToUploadFile fileName:{}",headers);
Result<String> result = HttpClientManager.getInstance().uploadFile(thirdplatform.getBaseUrl().concat(actionEntity.getApiUrl()),
thirdplatform.getBaseUrl().startsWith("https://"),
file,
fileName,
headers);
log.info("apiService sendPostRequestToUploadFile result:{}",JSON.toJSONString(result));
if (result == null) {
throw new RenException("请求第三方平台,发送Post请求失败。result为null");
}
if (!result.success()) {
throw new RenException("请求第三方平台,发送Post请求失败。错误信息:" + result.getMsg());
}
LZGridPlatformBaseResult platformResult = JSON.parseObject(result.getData(), LZGridPlatformBaseResult.class);
// token过期重试逻辑,先不加
//if ("402".equals(platformResult.getCode())) {
// // 如果token过期
// deleteAccessTokenFromCache(platformId);
// getAccessToken(platformId);
// return sendPostRequest(platformId, action, jsonString, headers);
//}
judgeResultSuccess(platformResult);
return result.getData();
}
/**
* @Description 获取accessToken由子类具体实现
* @return
* @author wxz
* @date 2021.03.16 13:45
*/
public abstract String getAccessToken(String platformId);
/**
* @Description 从缓存中删除AccessToken
* @return
* @author wxz
* @date 2021.03.24 15:35
*/
protected void deleteAccessTokenFromCache(String platformId) {
RedisTemplate<String, String> stringRedisTemplate = SpringContextUtils.getBean("redisTemplate", RedisTemplate.class);
stringRedisTemplate.delete(RedisKeys.getThirdPlatformAccessTokenKey(platformId));
}
/**
* @Description 添加AccessToken到缓存
* @return
* @author wxz
* @date 2021.03.24 15:32
*/
protected void addAccessTokenToCache(String platformId, String accessToken, long expire, TimeUnit timeUnit) {
RedisTemplate<String, String> stringRedisTemplate = SpringContextUtils.getBean("redisTemplate", RedisTemplate.class);
stringRedisTemplate.opsForValue().set(RedisKeys.getThirdPlatformAccessTokenKey(platformId), accessToken, expire, timeUnit);
}
/**
* @Description 从缓存中取token
* @return
* @author wxz
* @date 2021.03.24 15:40
*/
protected String getAccessTokenFromCache(String platformId) {
RedisTemplate<String, String> stringRedisTemplate = SpringContextUtils.getBean("redisTemplate", RedisTemplate.class);
return stringRedisTemplate.opsForValue().get(platformId);
}
/**
* @Description 判断客户是否注册了指定的平台如果没有注册则抛出异常
* @return
* @author wxz
* @date 2021.03.15 21:39
*/
public void judgeRegistered(String customerId, String platformId) {
if (!isRegistered(customerId, platformId)) {
throw new RenException(String.format("客户:%s没有配置第三方平台:%s", customerId, platformId));
}
}
/**
* @Description demo示例方法
* @return
* @author wxz
* @date 2021.03.15 10:46
*/
public String demoAction(TPFDemoFormDTO tpfDemoFormDTO) {
return "do success !!";
}
/**
* @Description 项目协同处理
* @return 项目协同处理的Result具体的平台返回的结果最终都要转化为这个ProjectAssistResult返回
* @author wxz
* @date 2021.03.16 09:28
*/
public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO formDTO) {
return null;
}
/**
* @Description 判断第三方平台返回结果成功失败如果失败则抛出异常
* @return
* @author wxz
* @date 2021.03.22 10:32
*/
public abstract void judgeResultSuccess(LZGridPlatformBaseResult result);
public UploadFileResultDTO uploadFile(UploadFileFormDTO formDTO) {
return null;
}
}

36
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/DemoApiService.java

@ -0,0 +1,36 @@
package com.epmet.apiservice.impl;
import com.epmet.apiservice.ApiService;
import com.epmet.apiservice.result.LZGridPlatformBaseResult;
import com.epmet.dto.result.ProjectAssistResult;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.feign.OperCrmOpenFeignClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* demo api service
*/
@Component(value = "demoApiService")
public class DemoApiService extends ApiService {
Logger logger = LoggerFactory.getLogger(DemoApiService.class);
@Override
public String getAccessToken(String platformId) {
return null;
}
@Override
public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO formDTO) {
logger.info("DemoApiService发送项目协助到第三方平台成功");
return null;
}
@Override
public void judgeResultSuccess(LZGridPlatformBaseResult result) {
}
}

137
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/LuzhouGridPlatformApiService.java

@ -0,0 +1,137 @@
package com.epmet.apiservice.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.apiservice.ApiService;
import com.epmet.apiservice.result.LZGridPlatformBaseResult;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.constant.ThirdPlatformActions;
import com.epmet.dao.ThirdplatformActionDao;
import com.epmet.dao.ThirdplatformDao;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.dto.form.UploadFileFormDTO;
import com.epmet.dto.result.ProjectAssistResult;
import com.epmet.dto.result.UploadFileResultDTO;
import com.epmet.entity.ThirdplatformActionEntity;
import com.epmet.entity.ThirdplatformEntity;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import java.io.File;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
/**
* 泸州网格化平台ApiService
*/
@Slf4j
@Component("luzhouGridPlatformApiService")
public class LuzhouGridPlatformApiService extends ApiService {
@Override
public String getAccessToken(String platformId) {
String token = getAccessTokenFromCache(platformId);
if (StringUtils.isBlank(token)) {
ThirdplatformEntity thirdplatform = SpringContextUtils.getBean(ThirdplatformDao.class).selectById(platformId);
ThirdplatformActionEntity actionEntity = SpringContextUtils.getBean(ThirdplatformActionDao.class)
.getByPlatformIdAndActionKey(platformId, ThirdPlatformActions.GET_ACCESS_TOKEN);
String baseUrl = thirdplatform.getBaseUrl();
String platformKey = thirdplatform.getPlatformKey();
String platformSecret = thirdplatform.getPlatformSecret();
HashMap<String, Object> params = new HashMap<>();
params.put("appKey", platformKey);
params.put("appSecret", platformSecret);
Result<String> result = null;
int tryTime = 0;
do {
result = HttpClientManager.getInstance().sendGet(baseUrl.concat(actionEntity.getApiUrl()), params);
} while ((result == null || !result.success()) && super.RETRY_TIME<tryTime++);
if (result == null || !result.success()) {
throw new RenException("请求第三方平台,获取AccessToken失败。");
}
LZGridPlatformBaseResult<String> platformResult = JSON.parseObject(result.getData(), LZGridPlatformBaseResult.class);
judgeResultSuccess(platformResult);
token = platformResult.getResult();
addAccessTokenToCache(platformId, token, (long)(3600*1.8*1000), TimeUnit.MILLISECONDS);
}
return token;
}
@Override
public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO formDTO) {
String platformId = formDTO.getPlatformId();
//开发环境由测试环境转发 所以 开发和本地 都使用测试环境地址
//todo 项目回调地址 仍需要从参数中获取
EnvEnum currentEnv = EnvEnum.getCurrentEnv();
if (EnvEnum.PROD.getCode().equals(currentEnv.getCode())) {
formDTO.setNotifyUrl(EnvEnum.PROD.getUrl().concat("gov/project/project/platformcallback"));
} else {
formDTO.setNotifyUrl(EnvEnum.TEST.getUrl().concat("gov/project/project/platformcallback"));
}
// 正式调用第三方平台
String argsStr = JSON.toJSONString(formDTO);
String result = sendPostRequest(platformId, ThirdPlatformActions.PROJECT_ASSIST, argsStr, null);
// 开发阶段临时写死
//String result = "{\"eventId\":\"test-task-id\"}";
ProjectAssistResult projectAssistResult = new ProjectAssistResult();
if (!StringUtils.isBlank(result)) {
// 此处要经过一系列业务处理,将第三方平台返回的数据进行解析,等处理最后转换成ProjectAssistResult类型,返回。ProjectAssistResult这个类型是
// 所有apiService的projectAssist方法返回值的统一类型,是我们的epmet-cloud所需要的数据的实体,
// 所有apiService都要想办法转化成这个类型。
LZGridPlatformBaseResult<String> lzResult = JSON.parseObject(result, LZGridPlatformBaseResult.class);
// 此处设置为第三方系统返回的唯一id
projectAssistResult.setTaskId(lzResult.getResult());
}
log.info("projectAssist 泸州网格化平台项目协助发送成功");
return projectAssistResult;
}
@Override
public void judgeResultSuccess(LZGridPlatformBaseResult result) {
//LZGridPlatformBaseResult;
if (!"200".equalsIgnoreCase(result.getCode())) {
throw new RenException("泸州网格化平台:返回失败结果,错误码:" + result.getCode());
}
}
@Override
public UploadFileResultDTO uploadFile(UploadFileFormDTO formDTO) {
UploadFileResultDTO resultDTO = new UploadFileResultDTO();
String platformId = formDTO.getPlatformId();
try {
String fileName = formDTO.getFile().getOriginalFilename();
// 正式调用第三方平台
File file = new File(formDTO.getFile().getOriginalFilename());
FileUtils.copyInputStreamToFile(formDTO.getFile().getInputStream(), file);
String result = sendPostRequestToUploadFile(platformId, ThirdPlatformActions.UPLOAD_FILE, file, fileName);
if (!StringUtils.isBlank(result)) {
// 此处要经过一系列业务处理,将第三方平台返回的数据进行解析,等处理最后转换成ProjectAssistResult类型,返回。ProjectAssistResult这个类型是
// 所有apiService的projectAssist方法返回值的统一类型,是我们的epmet-cloud所需要的数据的实体,
// 所有apiService都要想办法转化成这个类型。
LZGridPlatformBaseResult lzResult = JSON.parseObject(result, LZGridPlatformBaseResult.class);
// 此处设置为第三方系统返回的唯一id
resultDTO.setUrl((String) lzResult.getResult());
}
System.out.println("泸州网格化平台项目文件上传成功");
} catch (Exception e) {
throw new RenException("上传失败");
}
return resultDTO;
}
}

11
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformBaseResult.java

@ -0,0 +1,11 @@
package com.epmet.apiservice.result;
import lombok.Data;
@Data
public class LZGridPlatformBaseResult<R> {
private Boolean success;
private String code;
private R result;
// 有其他内容可直接写上
}

13
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformProjectAssistResult.java

@ -0,0 +1,13 @@
package com.epmet.apiservice.result;
import lombok.Data;
@Data
public class LZGridPlatformProjectAssistResult {
/**
* 事件id
*/
private String eventId;
}

75
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ProjectController.java

@ -0,0 +1,75 @@
package com.epmet.controller;
import com.epmet.dto.form.UploadFileFormDTO;
import com.epmet.dto.result.ProjectAssistResult;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.dto.form.TPFDemoFormDTO;
import com.epmet.dto.result.UploadFileResultDTO;
import com.epmet.service.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
* 对接第三方平台业务Project相关的controller
* 我们系统当中每一个需要发送到第三方平台的操作只对应这里的一个方法根据参数传入platformId内部根据配置获取指定的APiService进行具体平台的调用
* 每一个平台都有自己的ApiSerivce
*/
@RestController
@RequestMapping("project")
public class ProjectController {
@Autowired
private ProjectService projectService;
/**
* @Description demo方法
* @return
* @author wxz
* @date 2021.03.15 21:11
*/
@PostMapping("demo-action")
public Result demoAction(@RequestBody TPFDemoFormDTO tpfDemoFormDTO) {
ValidatorUtils.validateEntity(tpfDemoFormDTO);
String r = projectService.demoAction(tpfDemoFormDTO);
return new Result().ok(r);
}
/**
* @Description 请求项目协助
* @return
* @author wxz
* @date 2021.03.15 21:13
*/
@PostMapping("apply-assist")
public Result<ProjectAssistResult> applyAssist(@RequestBody ProjectApplyAssistFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
ProjectAssistResult projectAssistResult = projectService.applyAssist(formDTO);
return new Result<ProjectAssistResult>().ok(projectAssistResult);
}
/**
* 上传文件
* @author zhaoqifeng
* @date 2021/3/25 11:13
* @param file
* @param customerId
* @param platformId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.UploadFileResultDTO>
*/
@PostMapping(value= "uploadfile" , consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public Result<UploadFileResultDTO> uploadFile(@RequestPart("file") MultipartFile file, @RequestParam("customerId") String customerId, @RequestParam("platformId") String platformId) {
UploadFileFormDTO formDTO = new UploadFileFormDTO();
formDTO.setFile(file);
formDTO.setPlatformId(platformId);
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO);
UploadFileResultDTO result = projectService.uploadFile(formDTO);
return new Result<UploadFileResultDTO>().ok(result);
}
}

92
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java

@ -0,0 +1,92 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.SaveOrUpdateCustSelPlatformFormDTO;
import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.service.ThirdPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 第三方平台维护相关api
*/
@RestController
@RequestMapping("thirdplatform")
public class ThirdPlatformController {
@Autowired
private ThirdPlatformService thirdPlatformService;
/**
* 根据客户id和动作列出客户登记可用的第三方平台
* 用途工作端运营端配置界面
*
* @param input
* @return
*/
@PostMapping("customer/list-available-platforms-by-action")
public Result<List<ThirdplatformResultDTO>> listAvailablePlatformsByCustomerAndAction(@RequestBody ThirdPlatformFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListAvailableByCustomerAndActionGroup.class);
List<ThirdplatformResultDTO> platformRegs = thirdPlatformService.listAvailablePlatformsByCustomerAndAction(input.getCustomerId(), input.getActionKey());
return new Result<List<ThirdplatformResultDTO>>().ok(platformRegs);
}
/**
* @return
* @Description 根据客户id和动作列出客户可选的第三方系统
* @author wxz
* @date 2021.03.18 10:54
*/
@PostMapping("customer/list-selectable-platforms-by-action")
public Result<List<ThirdplatformResultDTO>> listSelectablePlatformsByAction(@RequestBody ThirdPlatformFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListSelectableByCustomerAndActionGroup.class);
List<ThirdplatformResultDTO> platformRegs = thirdPlatformService.listSelectableByCustomerAndActionGroup(input.getCustomerId(), input.getActionKey());
return new Result<List<ThirdplatformResultDTO>>().ok(platformRegs);
}
/**
* @Description 保存客户选中的平台列表
* @return
* @author wxz
* @date 2021.03.18 18:04
*/
@PostMapping("customer/save-selected-platforms")
public Result saveSelectedPlatforms(@RequestBody List<ThirdPlatformFormDTO> input) {
input.stream().forEach(c -> ValidatorUtils.validateEntity(c, ThirdPlatformFormDTO.SaveCustomerSelectedPlatformGroup.class));
thirdPlatformService.saveSelectedPlatforms(input);
return new Result();
}
/**
* @Description 更新客户自定义的平台信息
* @return
* @author wxz
* @date 2021.03.18 23:45
*/
@PostMapping("customer/update-customize-platform-info")
public Result updateCustomizePlatformInfo(@RequestBody ThirdPlatformFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.UpdateCustomizePlatformInfo.class);
thirdPlatformService.updateCustomizePlatformInfo(input);
return new Result();
}
/**
* @Description 保存或修改客户选中的第三方平台信息
* @return
* @author wxz
* @date 2021.03.19 15:25
*/
@PostMapping("customer/saveorupdate-selected-platforms")
public Result saveOrUpdateSelectedPlatformsInfo(@RequestBody SaveOrUpdateCustSelPlatformFormDTO input) {
ValidatorUtils.validateEntity(input);
thirdPlatformService.saveOrUpdateSelectedPlatformInfo(input.getCustomerId(), input.getActionKey(), input.getPlatforms());
return new Result();
}
}

41
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformActionDao.java

@ -0,0 +1,41 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.ThirdplatformActionEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-15
*/
@Mapper
public interface ThirdplatformActionDao extends BaseDao<ThirdplatformActionEntity> {
/**
* @Description 根据平台id和action操作查询
* @return
* @author wxz
* @date 2021.03.16 13:35
*/
ThirdplatformActionEntity getByPlatformIdAndActionKey(@Param("platformId") String platformId, @Param("action") String action);
}

38
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java

@ -0,0 +1,38 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.ThirdplatformCustomerActionEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 客户针对指定操作所选用的第三方平台列表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-18
*/
@Mapper
public interface ThirdplatformCustomerActionDao extends BaseDao<ThirdplatformCustomerActionEntity> {
ThirdplatformCustomerActionEntity selectOneEntity(@Param("customerId") String customerId,
@Param("platformId") String platformId,
@Param("actionKey") String actionKey);
int deleteByCustomerIdAndActionKey(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
}

38
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java

@ -0,0 +1,38 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.entity.ThirdplatformCustomerRegisterEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-15
*/
@Mapper
public interface ThirdplatformCustomerRegisterDao extends BaseDao<ThirdplatformCustomerRegisterEntity> {
ThirdplatformCustomerRegisterEntity getByCustomerIdAndPlatformId(@Param("customerId") String customerId, @Param("platformId") String platformId);
}

46
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java

@ -0,0 +1,46 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.entity.ThirdplatformEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-15
*/
@Mapper
public interface ThirdplatformDao extends BaseDao<ThirdplatformEntity> {
/**
* 动态sql查询
* @param customerId
* @return
*/
List<ThirdplatformResultDTO> listDTOS(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
List<ThirdplatformResultDTO> listAvailablePlatformsByCustomerAndAction(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
List<ThirdplatformResultDTO> listSelectableByCustomerAndActionGroup(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
}

52
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformActionEntity.java

@ -0,0 +1,52 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 2021-03-15
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("thirdplatform_action")
public class ThirdplatformActionEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private String platformId;
/**
*
*/
private String actionKey;
private String apiUrl;
}

56
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerActionEntity.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 2021-03-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("thirdplatform_customer_action")
public class ThirdplatformCustomerActionEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 平台ID
*/
private String platformId;
/**
* 动作key
*/
private String actionKey;
}

55
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerRegisterEntity.java

@ -0,0 +1,55 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 2021-03-15
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("thirdplatform_customer_register")
public class ThirdplatformCustomerRegisterEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private String customerId;
/**
*
*/
private String platformId;
private String customizedPlatformName;
private String customizedPlatformIcon;
}

71
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java

@ -0,0 +1,71 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 2021-03-15
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("thirdplatform")
public class ThirdplatformEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 平台名称
*/
private String platformName;
/**
* 平台唯一KEY
*/
private String platformKey;
/**
*
*/
private String platformSecret;
/**
* apiservice
*/
private String apiService;
/**
* 基础url
*/
private String baseUrl;
/**
* icon
*/
private String icon;
}

46
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ApiServiceSelector.java

@ -0,0 +1,46 @@
package com.epmet.service;
import com.epmet.apiservice.ApiService;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.dao.ThirdplatformDao;
import com.epmet.entity.ThirdplatformEntity;
/**
* ApiService选择器
*/
public interface ApiServiceSelector {
/**
* @Description 根据platformId查找platform对应的ApiService如果找不到对应的api service则返回null
* @return ApiService
* @author wxz
* @date 2021.03.15 20:59
*/
default ApiService trySelectApiService(String platformId) {
ThirdplatformDao thirdplatformDao = SpringContextUtils.getBean(ThirdplatformDao.class);
ThirdplatformEntity thirdplatform = thirdplatformDao.selectById(platformId);
if (thirdplatform == null) {
return null;
}
return (ApiService)SpringContextUtils.getBean(thirdplatform.getApiService());
}
/**
* @Description 根据platformId查找platform对应的ApiService如果找不到对应的api service则抛出RenException异常
* @return ApiService
* @author wxz
* @date 2021.03.15 21:08
*/
default ApiService selectApiService(String platformId) {
ThirdplatformDao thirdplatformDao = SpringContextUtils.getBean(ThirdplatformDao.class);
ThirdplatformEntity thirdplatform = thirdplatformDao.selectById(platformId);
if (thirdplatform == null) {
throw new RenException(String.format("ID为%s的第三方平台不存在", platformId));
}
return (ApiService)SpringContextUtils.getBean(thirdplatform.getApiService());
}
}

33
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ProjectService.java

@ -0,0 +1,33 @@
package com.epmet.service;
import com.epmet.dto.form.UploadFileFormDTO;
import com.epmet.dto.result.ProjectAssistResult;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.dto.form.TPFDemoFormDTO;
import com.epmet.dto.result.UploadFileResultDTO;
/**
* 该service用于封装project相关的代码
*/
public interface ProjectService {
String demoAction(TPFDemoFormDTO formDTO);
/**
* 项目协同处理
* @author wangxz
* @date 2021/3/25 10:59
* @param formDTO
* @return com.epmet.dto.result.ProjectAssistResult
*/
ProjectAssistResult applyAssist(ProjectApplyAssistFormDTO formDTO);
/**
* 文件上传
* @author zhaoqifeng
* @date 2021/3/25 10:59
* @param formDTO
* @return com.epmet.dto.result.UploadFileResultDTO
*/
UploadFileResultDTO uploadFile(UploadFileFormDTO formDTO);
}

25
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java

@ -0,0 +1,25 @@
package com.epmet.service;
import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import java.util.List;
public interface ThirdPlatformService {
List<ThirdplatformResultDTO> listAvailablePlatformsByCustomerAndAction(String customerId, String actionKey);
List<ThirdplatformResultDTO> listSelectableByCustomerAndActionGroup(String customerId, String actionKey);
/**
* @Description 保存客户选择的平台列表
* @return
* @author wxz
* @date 2021.03.18 22:06
*/
void saveSelectedPlatforms(List<ThirdPlatformFormDTO> platforms);
void updateCustomizePlatformInfo(ThirdPlatformFormDTO input);
void saveOrUpdateSelectedPlatformInfo(String customerId, String actionKey, List<ThirdPlatformFormDTO> platforms);
}

60
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java

@ -0,0 +1,60 @@
package com.epmet.service.impl;
import com.epmet.apiservice.ApiService;
import com.epmet.dto.form.UploadFileFormDTO;
import com.epmet.dto.result.ProjectAssistResult;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.dto.form.TPFDemoFormDTO;
import com.epmet.dto.result.UploadFileResultDTO;
import com.epmet.service.ApiServiceSelector;
import com.epmet.service.ProjectService;
import org.springframework.stereotype.Service;
@Service
public class ProjectServiceImpl implements ProjectService, ApiServiceSelector {
@Override
public String demoAction(TPFDemoFormDTO formDTO) {
String customerId = formDTO.getCustomerId();
String platformId = formDTO.getPlatformId();
// 注意,此处会如果找不到对应的ApiService会抛出异常
ApiService apiService = selectApiService(platformId);
apiService.judgeRegistered(customerId, platformId);
return apiService.demoAction(formDTO);
}
@Override
public ProjectAssistResult applyAssist(ProjectApplyAssistFormDTO formDTO) {
String customerId = formDTO.getCustomerId();
String platformId = formDTO.getPlatformId();
// 根据平台ID找到注意,此处会如果找不到对应的ApiService会抛出异常
ApiService apiService = selectApiService(platformId);
// 判断该客户是否注册了该平台,如果没有的话,抛出异常
apiService.judgeRegistered(customerId, platformId);
return apiService.projectAssist(formDTO);
}
/**
* 文件上传
*
* @param formDTO
* @return com.epmet.dto.result.UploadFileResultDTO
* @author zhaoqifeng
* @date 2021/3/25 10:59
*/
@Override
public UploadFileResultDTO uploadFile(UploadFileFormDTO formDTO) {
String customerId = formDTO.getCustomerId();
String platformId = formDTO.getPlatformId();
// 根据平台ID找到注意,此处会如果找不到对应的ApiService会抛出异常
ApiService apiService = selectApiService(platformId);
// 判断该客户是否注册了该平台,如果没有的话,抛出异常
apiService.judgeRegistered(customerId, platformId);
return apiService.uploadFile(formDTO);
}
}

108
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java

@ -0,0 +1,108 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.dao.ThirdplatformCustomerActionDao;
import com.epmet.dao.ThirdplatformCustomerRegisterDao;
import com.epmet.dao.ThirdplatformDao;
import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.entity.ThirdplatformActionEntity;
import com.epmet.entity.ThirdplatformCustomerActionEntity;
import com.epmet.entity.ThirdplatformCustomerRegisterEntity;
import com.epmet.service.ThirdPlatformService;
import jodd.util.CollectionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class ThirdPlatformServiceImpl implements ThirdPlatformService {
@Autowired
private ThirdplatformDao thirdplatformDao;
@Autowired
private ThirdplatformCustomerActionDao thirdplatformCustomerActionDao;
@Autowired
private ThirdplatformCustomerRegisterDao thirdplatformCustomerRegisterDao;
@Override
public List<ThirdplatformResultDTO> listAvailablePlatformsByCustomerAndAction(String customerId, String actionKey) {
return thirdplatformDao.listAvailablePlatformsByCustomerAndAction(customerId, actionKey);
}
@Override
public List<ThirdplatformResultDTO> listSelectableByCustomerAndActionGroup(String customerId, String actionKey) {
return thirdplatformDao.listSelectableByCustomerAndActionGroup(customerId, actionKey);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveSelectedPlatforms(List<ThirdPlatformFormDTO> platforms) {
platforms.forEach(p -> {
ThirdplatformCustomerActionEntity thirdplatformCustomerActionEntity = thirdplatformCustomerActionDao.selectOneEntity(p.getCustomerId(), p.getPlatformId(), p.getActionKey());
if (thirdplatformCustomerActionEntity == null) {
ThirdplatformCustomerActionEntity insert = new ThirdplatformCustomerActionEntity();
insert.setActionKey(p.getActionKey());
insert.setCustomerId(p.getCustomerId());
insert.setPlatformId(p.getPlatformId());
thirdplatformCustomerActionDao.insert(insert);
}
});
}
@Override
public void updateCustomizePlatformInfo(ThirdPlatformFormDTO input) {
ThirdplatformCustomerRegisterEntity exist = thirdplatformCustomerRegisterDao.getByCustomerIdAndPlatformId(input.getCustomerId(), input.getPlatformId());
if (exist != null) {
exist.setCustomizedPlatformName(input.getPlatformName());
exist.setCustomizedPlatformIcon(input.getIcon());
thirdplatformCustomerRegisterDao.updateById(exist);
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateSelectedPlatformInfo(String customerId, String actionKey, List<ThirdPlatformFormDTO> platforms) {
// 1.物理删除客户-action所有对应关系
thirdplatformCustomerActionDao.deleteByCustomerIdAndActionKey(customerId, actionKey);
platforms.stream().forEach(pt -> {
// 2.更新用户自定义的平台信息
updateThirdPlatformCustomerRegInfo(customerId, pt);
// 3.重新建立customer-platform-action对应关系
ThirdplatformCustomerActionEntity tpcaEntity = new ThirdplatformCustomerActionEntity();
tpcaEntity.setPlatformId(pt.getPlatformId());
tpcaEntity.setCustomerId(customerId);
tpcaEntity.setActionKey(actionKey);
thirdplatformCustomerActionDao.insert(tpcaEntity);
});
}
/**
* @Description 更新第三方品台客户对应关系
* @return
* @author wxz
* @date 2021.03.19 15:22
*/
private void updateThirdPlatformCustomerRegInfo(String customerId, ThirdPlatformFormDTO platformFormDTO) {
LambdaQueryWrapper<ThirdplatformCustomerRegisterEntity> conditions = new QueryWrapper<ThirdplatformCustomerRegisterEntity>()
.lambda()
.eq(ThirdplatformCustomerRegisterEntity::getCustomerId, customerId)
.eq(ThirdplatformCustomerRegisterEntity::getPlatformId, platformFormDTO.getPlatformId());
ThirdplatformCustomerRegisterEntity entity = new ThirdplatformCustomerRegisterEntity();
entity.setCustomizedPlatformName(platformFormDTO.getPlatformName());
entity.setCustomizedPlatformIcon(platformFormDTO.getIcon());
thirdplatformCustomerRegisterDao.update(entity, conditions);
}
}

61
epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.13__addPlatformDDLS.sql

@ -0,0 +1,61 @@
CREATE TABLE `thirdplatform` (
`ID` varchar(64) NOT NULL,
`PLATFORM_NAME` varchar(32) NOT NULL COMMENT '平台名称',
`PLATFORM_KEY` varchar(32) NOT NULL COMMENT '平台唯一KEY',
`PLATFORM_SECRET` varchar(64) DEFAULT NULL,
`ICON` varchar(255) DEFAULT NULL,
`API_SERVICE` varchar(32) NOT NULL COMMENT 'api service实例名称',
`BASE_URL` varchar(128) NOT NULL COMMENT '平台基础url',
`DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识',
`REVISION` int(10) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `thirdplatform_customer_action` (
`ID` varchar(64) NOT NULL,
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
`PLATFORM_ID` varchar(64) NOT NULL COMMENT '平台ID',
`ACTION_KEY` varchar(64) NOT NULL COMMENT '动作key',
`DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识',
`REVISION` int(10) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`),
UNIQUE KEY `plat_custm_act` (`PLATFORM_ID`,`CUSTOMER_ID`,`ACTION_KEY`,`DEL_FLAG`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户针对指定操作所选用的第三方平台列表';
CREATE TABLE `thirdplatform_customer_register` (
`ID` varchar(64) NOT NULL,
`CUSTOMER_ID` varchar(64) DEFAULT NULL,
`PLATFORM_ID` varchar(64) DEFAULT NULL,
`CUSTOMIZED_PLATFORM_NAME` varchar(32) DEFAULT NULL,
`CUSTOMIZED_PLATFORM_ICON` varchar(255) DEFAULT NULL,
`DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识',
`REVISION` int(10) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `thirdplatform_action` (
`ID` varchar(64) NOT NULL,
`PLATFORM_ID` varchar(64) DEFAULT NULL,
`ACTION_KEY` varchar(32) DEFAULT NULL,
`API_URL` varchar(64) NOT NULL COMMENT '动作对应的api的路径',
`DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识',
`REVISION` int(10) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

36
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformActionDao.xml

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.ThirdplatformActionDao">
<resultMap type="com.epmet.entity.ThirdplatformActionEntity" id="thirdplatformActionMap">
<result property="id" column="ID"/>
<result property="platformId" column="PLATFORM_ID"/>
<result property="actionKey" column="ACTION_KEY"/>
<result property="apiUrl" column="API_URL"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="getByPlatformIdAndActionKey" resultType="com.epmet.entity.ThirdplatformActionEntity">
select id,
platform_id,
action_key,
api_url,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from thirdplatform_action ta
where ta.PLATFORM_ID = #{platformId}
and ACTION_KEY = #{action}
</select>
</mapper>

45
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.ThirdplatformCustomerActionDao">
<resultMap type="com.epmet.entity.ThirdplatformCustomerActionEntity" id="thirdplatformCustomerActionMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="platformId" column="PLATFORM_ID"/>
<result property="actionKey" column="ACTION_KEY"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="deleteByCustomerIdAndActionKey">
delete
from thirdplatform_customer_action
where CUSTOMER_ID = #{customerId}
and ACTION_KEY = #{actionKey}
</delete>
<select id="selectOneEntity" resultType="com.epmet.entity.ThirdplatformCustomerActionEntity">
select tca.id,
tca.customer_id,
tca.platform_id,
tca.action_key,
tca.del_flag,
tca.revision,
tca.created_by,
tca.created_time,
tca.updated_by,
tca.updated_time
from thirdplatform_customer_action tca
where tca.CUSTOMER_ID = #{customerId}
and tca.PLATFORM_ID = #{platformId}
and tca.ACTION_KEY = #{actionKey}
and tca.DEL_FLAG = 0
</select>
</mapper>

38
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.ThirdplatformCustomerRegisterDao">
<resultMap type="com.epmet.entity.ThirdplatformCustomerRegisterEntity" id="thirdplatformCustomerRegisterMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="platformId" column="PLATFORM_ID"/>
<result property="customizedPlatformName" column="CUSTOMIZED_PLATFORM_NAME"/>
<result property="customizedPlatformIcon" column="CUSTOMIZED_PLATFORM_ICON"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="getByCustomerIdAndPlatformId"
resultType="com.epmet.entity.ThirdplatformCustomerRegisterEntity">
select tcr.id,
customer_id,
platform_id,
customized_platform_name,
customized_platform_icon,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from thirdplatform_customer_register tcr
where CUSTOMER_ID = #{customerId}
and PLATFORM_ID = #{platformId}
and DEL_FLAG = 0
</select>
</mapper>

90
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.ThirdplatformDao">
<resultMap type="com.epmet.entity.ThirdplatformEntity" id="thirdplatformMap">
<result property="id" column="ID"/>
<result property="platformName" column="PLATFORM_NAME"/>
<result property="platformKey" column="PLATFORM_KEY"/>
<result property="platformSecret" column="PLATFORM_SECRET"/>
<result property="apiService" column="API_SERVICE"/>
<result property="icon" column="ICON"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="listDTOS" resultType="com.epmet.dto.result.ThirdplatformResultDTO">
select tcr.id,
tcr.customer_id,
tcr.platform_id,
tpf.PLATFORM_NAME,
tpf.ICON,
tcr.del_flag,
tcr.revision,
tcr.created_by,
tcr.created_time,
tcr.updated_by,
tcr.updated_time
from thirdplatform_customer_register tcr
inner join thirdplatform tpf on (tcr.PLATFORM_ID = tpf.ID)
inner join thirdplatform_action ta on (tpf.ID = ta.PLATFORM_ID)
<where>
<if test="customerId != null and customerId != ''">
tcr.CUSTOMER_ID = #{customerId}
</if>
<if test="actionKey != null and actionKey != ''">
and ta.ACTION_KEY = #{actionKey}
</if>
and tcr.DEL_FLAG = 0
and tpf.DEL_FLAG = 0
</where>
</select>
<select id="listAvailablePlatformsByCustomerAndAction"
resultType="com.epmet.dto.result.ThirdplatformResultDTO">
select tca.id,
tca.customer_id,
tca.platform_id,
tca.action_key,
tca.del_flag,
tca.revision,
tca.created_by,
tca.created_time,
tca.updated_by,
tca.updated_time,
tcr.CUSTOMIZED_PLATFORM_NAME platformName,
tcr.CUSTOMIZED_PLATFORM_ICON icon
from thirdplatform_customer_action tca
inner join thirdplatform_customer_register tcr
on (tca.CUSTOMER_ID = tcr.CUSTOMER_ID and tca.PLATFORM_ID = tcr.PLATFORM_ID)
where tca.CUSTOMER_ID = #{customerId}
and tca.ACTION_KEY = #{actionKey}
and tca.DEL_FLAG = 0
and tcr.DEL_FLAG = 0
</select>
<select id="listSelectableByCustomerAndActionGroup"
resultType="com.epmet.dto.result.ThirdplatformResultDTO">
select tcr.id,
tcr.customer_id,
tcr.platform_id,
tcr.customized_platform_name platformName,
tcr.customized_platform_icon icon,
tcr.del_flag,
tcr.revision,
tcr.created_by,
tcr.created_time,
tcr.updated_by,
tcr.updated_time
from thirdplatform_customer_register tcr
inner join thirdplatform_action ta on (tcr.PLATFORM_ID = ta.PLATFORM_ID)
where tcr.CUSTOMER_ID = #{customerId}
and ta.ACTION_KEY = #{actionKey}
and tcr.DEL_FLAG = 0
</select>
</mapper>

3
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java

@ -290,4 +290,7 @@ public interface GovIssueOpenFeignClient {
*/
@PostMapping("/gov/issue/issueapplication/notissuetotopicids")
Result<List<String>> notIssueToTopicIds(@RequestBody List<String> topicIdList);
@PostMapping(value = "/gov/issue/manage/votingissuedetail")
Result<GovIssueDetailResultDTO> votingissuedetail(@RequestBody IssueDetailFormDTO issueDetail);
}

5
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java

@ -246,4 +246,9 @@ public class GovIssueOpenFeignClientFallBack implements GovIssueOpenFeignClient
public Result<List<String>> notIssueToTopicIds(List<String> topicIdList) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "notIssueToTopicIds", topicIdList);
}
@Override
public Result<GovIssueDetailResultDTO> votingissuedetail(IssueDetailFormDTO issueDetail) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "votingissuedetail", issueDetail);
}
}

5
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectProcessDTO.java

@ -134,4 +134,9 @@ public class ProjectProcessDTO implements Serializable {
*/
private String orgIdPath;
/**
* 是否发送到外部系统
*/
private Integer isSend;
}

126
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubAttachmentDTO.java

@ -0,0 +1,126 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 外部系统事件附件
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-17
*/
@Data
public class ProjectSubAttachmentDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 项目ID
*/
private String projectId;
/**
* 子节点ID
*/
private String subId;
/**
* 事件ID
*/
private String taskId;
/**
* 附件名
*/
private String attachmentName;
/**
* 文件大小 单位b
*/
private Integer attachmentSize;
/**
* 文件格式
*/
private String attachmentFormat;
/**
* 类型
*/
private String attachmentType;
/**
* 附件地址
*/
private String attachmentUrl;
/**
* 语音或视频时长
*/
private Integer duration;
/**
* 排序
*/
private Integer sort;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

136
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubProcessDTO.java

@ -0,0 +1,136 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 节点事件关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-17
*/
@Data
public class ProjectSubProcessDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 项目ID
*/
private String projectId;
/**
* 节点ID
*/
private String processId;
/**
* 项目人员关联表ID
*/
private String projectStaffId;
/**
* 系统ID
*/
private String platformId;
/**
* 系统名
*/
private String platformName;
/**
* 第三方平台返回的项目关联ID事件Id
*/
private String taskId;
/**
* 事件处理详细内容
*/
private String result;
/**
* 外部状态:1待处理,2待核实,3已上报,4已完结,5处理中,6待分发,7归档,8催办,9超时
*/
private String externalStatus;
/**
* 外部状态描述
*/
private String externalStatusDesc;
/**
* 内部状态:待处理 pending结案closed
*/
private String internalStatus;
/**
* 处理日期
*/
private Date handleDate;
/**
* 处理人姓名
*/
private String handleUserName;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

7
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ParameterFormDTO.java

@ -18,6 +18,10 @@ import java.io.Serializable;
public class ParameterFormDTO implements Serializable {
private static final long serialVersionUID = 6943367994919967821L;
// 保存第三方平台发送项目协助开关
public interface SaveThirdPlatformSendProjectSwitchGroup {}
/**
* 客户ID
*/
@ -53,4 +57,7 @@ public class ParameterFormDTO implements Serializable {
*/
@NotBlank(message = "设定核算单位天结束时间不能为空", groups = AddGroup.class)
private String endTime;
@NotBlank(message = "客户发送第三方平台协助请求开关不能为空", groups = SaveThirdPlatformSendProjectSwitchGroup.class)
private String sendProjectSwitch;
}

39
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/PlatformCallBackFormDTO.java

@ -0,0 +1,39 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/3/19 15:08
*/
@Data
public class PlatformCallBackFormDTO implements Serializable {
private static final long serialVersionUID = 6350776148129116395L;
/**
* 事件id
*/
private String eventId;
/**
* 事件新的状态
*/
private String status;
/**
* 事件处理详细内容
*/
private String note;
/**
* 事件处理日期, 时区GMT+8 格式YYYY-MM-dd HH:mm:ss
*/
private String handleDate;
/**
* 事件处理人姓名
*/
private String handleUserName;
/**
* 参数签名签名算法
*/
private String sign;
}

5
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectDetailFromDTO.java

@ -22,4 +22,9 @@ public class ProjectDetailFromDTO implements Serializable {
* 用户ID
*/
private String userId;
/**
* 客户ID
*/
private String customerId;
}

55
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/SendToFormDTO.java

@ -0,0 +1,55 @@
package com.epmet.dto.form;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/3/17 14:31
*/
@Data
public class SendToFormDTO implements Serializable {
private static final long serialVersionUID = -2556534032778491105L;
@NotBlank(message = "项目Id不能为空")
private String projectId;
@NotBlank(message = "项目人员关联Id不能为空")
private String projectStaffId;
@Length(max=1000,message = "公开答复内容不能超过1000位")
private String publicReply;
@NotBlank(message = "内部备注不能为空")
@Length(max=1000,message = "内部备注不能超过1000位")
private String internalRemark;
@NotBlank(message = "外部系统ID不能为空")
private String platformId;
@NotBlank(message = "外部系统名不能为空")
private String platformName;
/**
* 部门名
*/
private String departmentName;
private String userId;
@Valid
private List<TickStaffFormDTO> staffList;
/**
* 公开答复对应文件集合
*/
private List<FileDTO> publicFile;
/**
* 内部备注对应文件集合
*/
private List<FileDTO> internalFile;
}

35
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java

@ -0,0 +1,35 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.List;
@Data
public class ThirdPlatformConfigFormDTO {
public interface SaveThirdplatformConfig {
}
public interface LoadThirdplatformConfig { }
@NotBlank(message = "客户ID不能为空", groups = {
SaveThirdplatformConfig.class,
LoadThirdplatformConfig.class})
private String customerId;
@NotBlank(message = "项目协助发送开关状态不能为空", groups = {
SaveThirdplatformConfig.class})
private String sendProjectSwitch;
private List<CustomerSelectedPlatform> customerSelectedPlatformList;
@Data
public static class CustomerSelectedPlatform {
private String customerId;
private String platformId;
private String platformName;
private String icon;
}
}

24
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/PlatformFileDTO.java

@ -0,0 +1,24 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/3/25 16:47
*/
@Data
public class PlatformFileDTO implements Serializable {
private static final long serialVersionUID = 1090878172073142780L;
String projectImages;
String projectVoices;
String projectVideos;
String projectDocs;
String topicImages;
String topicVoices;
String topicVideos;
String topicDocs;
}

11
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProcessListV2ResultDTO.java

@ -13,6 +13,7 @@ import java.util.List;
@Data
public class ProcessListV2ResultDTO implements Serializable {
private static final long serialVersionUID = 5762152044573235897L;
/**
* 项目ID
*/
@ -43,10 +44,19 @@ public class ProcessListV2ResultDTO implements Serializable {
*/
private String publicReply;
/**
* 是否发送到外部系统 0否 1是
*/
private Integer isSend;
/**
* 内部备注
*/
private String internalRemark;
/**
* 子节点
*/
private List<SubProcessDTO> subProcess;
/**
*
@ -68,5 +78,6 @@ public class ProcessListV2ResultDTO implements Serializable {
this.internalRemark = "";
this.publicFile = new ArrayList<>();
this.internalFile = new ArrayList<>();
this.subProcess = new ArrayList<>();
}
}

15
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java

@ -11,7 +11,6 @@ import java.util.List;
* @dscription
* @date 2020/5/11 15:33
*/
@NoArgsConstructor
@Data
public class ProjectDetailResultDTO implements Serializable {
@ -60,6 +59,20 @@ public class ProjectDetailResultDTO implements Serializable {
* 当前跟进部门
*/
private List<DepartmentNameListBean> departmentList;
/**
* 是否能发送到外部系统
*/
private Boolean isSend;
/**
* 当前流转到外部系统的ID
*/
private List<String> platformIds;
public ProjectDetailResultDTO() {
this.processable = false;
this.isSend = false;
}
@NoArgsConstructor
@Data

42
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java

@ -0,0 +1,42 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/3/17 14:45
*/
@Data
public class SubProcessDTO implements Serializable {
private static final long serialVersionUID = -3292921180067385861L;
/**
* 外部平台名
*/
private String platformName;
/**
* 处理状态
*/
private String externalStatus;
/**
* 处理时间
*/
private String processTime;
/**
* 处理人
*/
private String handleUserName;
private String subId;
private String processId;
/**
* 处理内容
*/
private String result;
private List<PublicAndInternalFileResultDTO> subFile;
}

21
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.result;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class ThirdPlatformConfigResultDTO {
private String sendProjectSwitch;
private List<CustomerSelectedPlatform> customerSelectedPlatformList = new ArrayList<CustomerSelectedPlatform>();
@Data
public static class CustomerSelectedPlatform {
private String customerId;
private String platformId;
private String platformName;
private String icon;
}
}

11
epmet-module/gov-project/gov-project-server/pom.xml

@ -19,6 +19,11 @@
<artifactId>gov-project-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-third-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId>
@ -102,6 +107,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-third-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

6
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ParameterKeyConstant.java

@ -53,4 +53,10 @@ public interface ParameterKeyConstant {
*/
String END_TIME = "end_time";
String END_TIME_NAME = "设定核算单位天结束时间";
/**
* 发送项目协助到第三方平台开关
*/
String THIRD_PLATFORM_PROJECT_SEND = "third_platform_project_send";
String THIRD_PLATFORM_PROJECT_SEND_NAME = "发送外部系统项目协助开关";
}

2
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java

@ -158,4 +158,6 @@ public interface ProjectConstant {
String INTERNAL = "internal";
String NOT_EXIST_PROJECT = "未查询带此项目信息......";
String EXTERNAL_SYSTEM = "third_platform_project_send";
}

41
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java

@ -25,15 +25,19 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.constant.ParameterKeyConstant;
import com.epmet.dto.CustomerProjectParameterDTO;
import com.epmet.dto.form.ParameterFormDTO;
import com.epmet.dto.form.ThirdPlatformConfigFormDTO;
import com.epmet.dto.result.ParameterResultDTO;
import com.epmet.dto.result.ThirdPlatformConfigResultDTO;
import com.epmet.excel.CustomerProjectParameterExcel;
import com.epmet.service.CustomerProjectParameterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;
@ -135,4 +139,41 @@ public class CustomerProjectParameterController {
return new Result();
}
/**
* @Description 保存"发送项目协助到第三方平台"开关参数
* @return
* @author wxz
* @date 2021.03.19 13:50
*/
@PostMapping("save-thirdplatform-send-switch")
public Result saveThirdPlatformSendProjectSwitch(@RequestBody ParameterFormDTO input) {
ValidatorUtils.validateEntity(input, ParameterFormDTO.SaveThirdPlatformSendProjectSwitchGroup.class);
String customerId = input.getCustomerId();
String sendProjectSwitch = input.getSendProjectSwitch();
customerProjectParameterService.saveThirdPlatformSendProjectSwitch(customerId, sendProjectSwitch);
return new Result();
}
@PostMapping("save-thirdplatform-config")
public Result saveThirdplatformConfig(@RequestBody ThirdPlatformConfigFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformConfigFormDTO.SaveThirdplatformConfig.class);
String customerId = input.getCustomerId();
String sendProjectSwitch = input.getSendProjectSwitch();
List<ThirdPlatformConfigFormDTO.CustomerSelectedPlatform> platformList = input.getCustomerSelectedPlatformList();
customerProjectParameterService.saveThirdplatformConfig(customerId, sendProjectSwitch, platformList);
return new Result();
}
/**
* @Description 保存项目第三方平台的配置
* @return
* @author wxz
* @date 2021.03.19 17:10
*/
@PostMapping("load-thirdplatform-config")
public Result<ThirdPlatformConfigResultDTO> loadThirdplatformConfig(@RequestBody ThirdPlatformConfigFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformConfigFormDTO.LoadThirdplatformConfig.class);
ThirdPlatformConfigResultDTO resultDTO = customerProjectParameterService.loadThirdplatformConfig(input.getCustomerId(), ParameterKeyConstant.THIRD_PLATFORM_PROJECT_SEND);
return new Result<ThirdPlatformConfigResultDTO>().ok(resultDTO);
}
}

5
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectController.java

@ -217,4 +217,9 @@ public class ProjectController {
}
return new Result<>();
}
@PostMapping("platformcallback")
public Result platformCallBack(@RequestBody PlatformCallBackFormDTO formDTO) {
projectService.platformCallBack(formDTO);
return new Result();
}
}

85
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubAttachmentController.java

@ -0,0 +1,85 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.ProjectSubAttachmentDTO;
import com.epmet.service.ProjectSubAttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 外部系统事件附件
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-17
*/
@RestController
@RequestMapping("projectsubattachment")
public class ProjectSubAttachmentController {
@Autowired
private ProjectSubAttachmentService projectSubAttachmentService;
@GetMapping("page")
public Result<PageData<ProjectSubAttachmentDTO>> page(@RequestParam Map<String, Object> params){
PageData<ProjectSubAttachmentDTO> page = projectSubAttachmentService.page(params);
return new Result<PageData<ProjectSubAttachmentDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ProjectSubAttachmentDTO> get(@PathVariable("id") String id){
ProjectSubAttachmentDTO data = projectSubAttachmentService.get(id);
return new Result<ProjectSubAttachmentDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ProjectSubAttachmentDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
projectSubAttachmentService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ProjectSubAttachmentDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
projectSubAttachmentService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
projectSubAttachmentService.delete(ids);
return new Result();
}
}

85
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubProcessController.java

@ -0,0 +1,85 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.ProjectSubProcessDTO;
import com.epmet.service.ProjectSubProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 节点事件关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-17
*/
@RestController
@RequestMapping("projectsubprocess")
public class ProjectSubProcessController {
@Autowired
private ProjectSubProcessService projectSubProcessService;
@GetMapping("page")
public Result<PageData<ProjectSubProcessDTO>> page(@RequestParam Map<String, Object> params){
PageData<ProjectSubProcessDTO> page = projectSubProcessService.page(params);
return new Result<PageData<ProjectSubProcessDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ProjectSubProcessDTO> get(@PathVariable("id") String id){
ProjectSubProcessDTO data = projectSubProcessService.get(id);
return new Result<ProjectSubProcessDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ProjectSubProcessDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
projectSubProcessService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ProjectSubProcessDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
projectSubProcessService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
projectSubProcessService.delete(ids);
return new Result();
}
}

16
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java

@ -319,5 +319,21 @@ public class ProjectTraceController {
return new Result();
}
/**
* 发送到外部平台
* @author zhaoqifeng
* @date 2021/3/17 14:34
* @param tokenDTO
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("sendto")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_TRANSFER)
public Result sendTo(@LoginUser TokenDto tokenDTO, @RequestBody SendToFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
projectTraceService.sendTo(tokenDTO, formDTO);
return new Result();
}
}

10
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/CustomerProjectParameterDao.java

@ -79,4 +79,14 @@ public interface CustomerProjectParameterDao extends BaseDao<CustomerProjectPara
* @return int
*/
int deleteByCustomer(@Param("customerId") String customerId);
/**
* 根据key获取value
* @author zhaoqifeng
* @date 2021/3/17 16:51
* @param customerId
* @param key
* @return java.lang.String
*/
String selectValueByKey(@Param("customerId") String customerId, @Param("key") String key);
}

8
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectProcessDao.java

@ -86,4 +86,12 @@ public interface ProjectProcessDao extends BaseDao<ProjectProcessEntity> {
* @date 2020/12/21 下午4:18
*/
List<ProcessListV2ResultDTO> selectProcessList(@Param("projectId")String projectId);
/**
* @Description 查询当前流转到外部系统的ID
* @Param projectId
* @author zxc
* @date 2021/3/19 上午10:18
*/
List<String> selectPlatFormIds(@Param("projectId") String projectId);
}

33
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubAttachmentDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.ProjectSubAttachmentEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 外部系统事件附件
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-17
*/
@Mapper
public interface ProjectSubAttachmentDao extends BaseDao<ProjectSubAttachmentEntity> {
}

63
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java

@ -0,0 +1,63 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ProjectSubProcessDTO;
import com.epmet.dto.result.SubProcessDTO;
import com.epmet.entity.ProjectSubProcessEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 节点事件关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-17
*/
@Mapper
public interface ProjectSubProcessDao extends BaseDao<ProjectSubProcessEntity> {
/**
* @Description 查询最新记录
* @Param projectStaffIds
* @author zxc
* @date 2021/3/18 上午11:17
*/
ProjectSubProcessDTO selectSubProcess(@Param("projectStaffIds") List<String> projectStaffIds);
/**
* @Description 查询进展和附件
* @Param processIds
* @author zxc
* @date 2021/3/18 下午2:57
*/
List<SubProcessDTO> selectSubProcessAndAttachment(@Param("processIds")List<String> processIds);
/**
* 根据taskId查找最新的记录
* @author zhaoqifeng
* @date 2021/3/19 15:26
* @param taskId
* @return com.epmet.dto.ProjectSubProcessDTO
*/
ProjectSubProcessDTO selectSubProcessByTaskId(@Param("taskId") String taskId);
}

5
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectProcessEntity.java

@ -108,4 +108,9 @@ public class ProjectProcessEntity extends BaseEpmetEntity {
*/
private String orgIdPath;
/**
* 是否发送到外部系统
*/
private Integer isSend;
}

96
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubAttachmentEntity.java

@ -0,0 +1,96 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 2021-03-17
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("project_sub_attachment")
public class ProjectSubAttachmentEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 项目ID
*/
private String projectId;
/**
* 子节点ID
*/
private String subId;
/**
* 事件ID
*/
private String taskId;
/**
* 附件名
*/
private String attachmentName;
/**
* 文件大小 单位b
*/
private Integer attachmentSize;
/**
* 文件格式
*/
private String attachmentFormat;
/**
* 类型
*/
private String attachmentType;
/**
* 附件地址
*/
private String attachmentUrl;
/**
* 语音或视频时长
*/
private Integer duration;
/**
* 排序
*/
private Integer sort;
}

106
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubProcessEntity.java

@ -0,0 +1,106 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 2021-03-17
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("project_sub_process")
public class ProjectSubProcessEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 项目ID
*/
private String projectId;
/**
* 节点ID
*/
private String processId;
/**
* 项目人员关联表ID
*/
private String projectStaffId;
/**
* 系统ID
*/
private String platformId;
/**
* 系统名
*/
private String platformName;
/**
* 第三方平台返回的项目关联ID事件Id
*/
private String taskId;
/**
* 事件处理详细内容
*/
private String result;
/**
* 外部状态:1待处理,2待核实,3已上报,4已完结,5处理中,6待分发,7归档,8催办,9超时
*/
private String externalStatus;
/**
* 外部状态描述
*/
private String externalStatusDesc;
/**
* 内部状态:待处理 pending结案closed
*/
private String internalStatus;
/**
* 处理日期
*/
private Date handleDate;
/**
* 处理人姓名
*/
private String handleUserName;
}

10
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java

@ -21,7 +21,9 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.CustomerProjectParameterDTO;
import com.epmet.dto.form.ParameterFormDTO;
import com.epmet.dto.form.ThirdPlatformConfigFormDTO;
import com.epmet.dto.result.ParameterResultDTO;
import com.epmet.dto.result.ThirdPlatformConfigResultDTO;
import com.epmet.entity.CustomerProjectParameterEntity;
import java.util.List;
@ -166,4 +168,12 @@ public interface CustomerProjectParameterService extends BaseService<CustomerPro
* @return void
*/
void remindDefault(ParameterFormDTO formDTO);
void saveThirdPlatformSendProjectSwitch(String customerId, String sendProjectSwitch);
void saveThirdplatformConfig(String customerId,
String sendProjectSwitch,
List<ThirdPlatformConfigFormDTO.CustomerSelectedPlatform> platformList);
ThirdPlatformConfigResultDTO loadThirdplatformConfig(String customerId, String parameterKey);
}

8
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectProcessService.java

@ -159,4 +159,12 @@ public interface ProjectProcessService extends BaseService<ProjectProcessEntity>
**/
void transferV2(TransferFormDTO formDTO);
/**
* @Description 查询当前流转到外部系统的ID
* @Param projectId
* @author zxc
* @date 2021/3/19 上午10:18
*/
List<String> selectPlatFormIds(String projectId);
}

19
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java

@ -19,6 +19,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.ProjectDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
@ -276,4 +277,22 @@ public interface ProjectService extends BaseService<ProjectEntity> {
* @Date 2021/2/24 17:07
**/
ProjectInfoDTO queryProjectInfoByProjectId(String projectId);
/**
* 发送到外部平台
* @author zhaoqifeng
* @date 2021/3/17 14:33
* @param formDTO
* @return void
*/
void sendTo(SendToFormDTO formDTO);
/**
* 第三方平台回调
* @author zhaoqifeng
* @date 2021/3/19 15:12
* @param formDTO
* @return void
*/
void platformCallBack(PlatformCallBackFormDTO formDTO);
}

95
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubAttachmentService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.ProjectSubAttachmentDTO;
import com.epmet.entity.ProjectSubAttachmentEntity;
import java.util.List;
import java.util.Map;
/**
* 外部系统事件附件
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-17
*/
public interface ProjectSubAttachmentService extends BaseService<ProjectSubAttachmentEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ProjectSubAttachmentDTO>
* @author generator
* @date 2021-03-17
*/
PageData<ProjectSubAttachmentDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ProjectSubAttachmentDTO>
* @author generator
* @date 2021-03-17
*/
List<ProjectSubAttachmentDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return ProjectSubAttachmentDTO
* @author generator
* @date 2021-03-17
*/
ProjectSubAttachmentDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-03-17
*/
void save(ProjectSubAttachmentDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-03-17
*/
void update(ProjectSubAttachmentDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-03-17
*/
void delete(String[] ids);
}

122
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java

@ -0,0 +1,122 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.ProjectSubProcessDTO;
import com.epmet.dto.result.SubProcessDTO;
import com.epmet.entity.ProjectSubProcessEntity;
import java.util.List;
import java.util.Map;
/**
* 节点事件关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-17
*/
public interface ProjectSubProcessService extends BaseService<ProjectSubProcessEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ProjectSubProcessDTO>
* @author generator
* @date 2021-03-17
*/
PageData<ProjectSubProcessDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ProjectSubProcessDTO>
* @author generator
* @date 2021-03-17
*/
List<ProjectSubProcessDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return ProjectSubProcessDTO
* @author generator
* @date 2021-03-17
*/
ProjectSubProcessDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-03-17
*/
void save(ProjectSubProcessDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-03-17
*/
void update(ProjectSubProcessDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-03-17
*/
void delete(String[] ids);
/**
* @Description 查询最新记录
* @Param projectStaffIds
* @author zxc
* @date 2021/3/18 上午11:14
*/
ProjectSubProcessDTO selectSubProcess(List<String> projectStaffIds);
/**
* @Description 查询进展和附件
* @Param processIds
* @author zxc
* @date 2021/3/18 下午2:57
*/
List<SubProcessDTO> selectSubProcessAndAttachment(List<String> processIds);
/**
* 根据platformId查找最新的记录
*
* @author zhaoqifeng
* @date 2021/3/19 15:24
* @param taskId
* @return com.epmet.dto.ProjectSubProcessDTO
*/
ProjectSubProcessDTO getSubProcessByTaskId(String taskId);
}

10
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTraceService.java

@ -149,4 +149,14 @@ public interface ProjectTraceService {
* @author sun
*/
void responseV2(TokenDto tokenDto, ProjectResponseFormDTO formDTO);
/**
* 发送到外部平台
* @author zhaoqifeng
* @date 2021/3/17 14:33
* @param tokenDto
* @param formDTO
* @return void
*/
void sendTo(TokenDto tokenDto, SendToFormDTO formDTO);
}

102
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java

@ -17,22 +17,28 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.ParameterKeyConstant;
import com.epmet.constant.ThirdPlatformActions;
import com.epmet.dao.CustomerProjectParameterDao;
import com.epmet.dto.CustomerProjectParameterDTO;
import com.epmet.dto.form.ParameterFormDTO;
import com.epmet.dto.form.SaveOrUpdateCustSelPlatformFormDTO;
import com.epmet.dto.form.ThirdPlatformConfigFormDTO;
import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ParameterResultDTO;
import com.epmet.dto.result.ThirdPlatformConfigResultDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.entity.CustomerProjectParameterEntity;
import com.epmet.feign.ThirdOpenFeignClient;
import com.epmet.redis.CustomerProjectParameterRedis;
import com.epmet.service.CustomerProjectParameterService;
import org.apache.commons.collections4.CollectionUtils;
@ -40,13 +46,12 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 项目客户参数订制表
@ -60,6 +65,9 @@ public class CustomerProjectParameterServiceImpl extends BaseServiceImpl<Custome
@Autowired
private CustomerProjectParameterRedis customerProjectParameterRedis;
@Autowired
private ThirdOpenFeignClient thirdOpenFeignClient;
@Override
public PageData<CustomerProjectParameterDTO> page(Map<String, Object> params) {
IPage<CustomerProjectParameterEntity> page = baseDao.selectPage(
@ -290,4 +298,88 @@ public class CustomerProjectParameterServiceImpl extends BaseServiceImpl<Custome
baseDao.deleteByCustomer(formDTO.getCustomerId());
}
@Override
public void saveThirdPlatformSendProjectSwitch(String customerId, String sendProjectSwitch) {
// 构造条件
LambdaQueryWrapper<CustomerProjectParameterEntity> queryWrapper = new QueryWrapper<CustomerProjectParameterEntity>()
.lambda()
.eq(CustomerProjectParameterEntity::getCustomerId, customerId)
.eq(CustomerProjectParameterEntity::getParameterKey, ParameterKeyConstant.THIRD_PLATFORM_PROJECT_SEND);
CustomerProjectParameterEntity configExists = baseDao.selectOne(queryWrapper);
if (configExists == null) {
CustomerProjectParameterEntity entity = new CustomerProjectParameterEntity();
entity.setDescription("0:关,1:开");
entity.setParameterName(ParameterKeyConstant.THIRD_PLATFORM_PROJECT_SEND_NAME);
entity.setParameterValue(sendProjectSwitch);
entity.setCustomerId(customerId);
entity.setParameterKey(ParameterKeyConstant.THIRD_PLATFORM_PROJECT_SEND);
baseDao.insert(entity);
} else {
configExists.setParameterValue(sendProjectSwitch);
baseDao.updateById(configExists);
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveThirdplatformConfig(String customerId, String sendProjectSwitch, List<ThirdPlatformConfigFormDTO.CustomerSelectedPlatform> platformList) {
// 1.本地执行配置更新
saveThirdPlatformSendProjectSwitch(customerId, sendProjectSwitch);
// 2.调用远程third服务,更新或新增客户-平台-等信息 ThirdPlatformFormDTO thirdPlatformFormDTO = new ThirdPlatformFormDTO();
List<ThirdPlatformFormDTO> platforms = platformList.stream().map(p -> {
ThirdPlatformFormDTO thirdPlatformFormDTO = new ThirdPlatformFormDTO();
thirdPlatformFormDTO.setActionKey(ThirdPlatformActions.PROJECT_ASSIST);
thirdPlatformFormDTO.setCustomerId(customerId);
thirdPlatformFormDTO.setIcon(p.getIcon());
thirdPlatformFormDTO.setPlatformId(p.getPlatformId());
thirdPlatformFormDTO.setPlatformName(p.getPlatformName());
return thirdPlatformFormDTO;
}).collect(Collectors.toList());
SaveOrUpdateCustSelPlatformFormDTO form = new SaveOrUpdateCustSelPlatformFormDTO();
form.setPlatforms(platforms);
form.setCustomerId(customerId);
form.setActionKey(ThirdPlatformActions.PROJECT_ASSIST);
Result result = thirdOpenFeignClient.saveOrUpdateSelectedPlatformsInfo(form);
if (result == null || !result.success()) {
throw new RenException("调用Third服务,保存第三方平台列表失败");
}
}
@Override
public ThirdPlatformConfigResultDTO loadThirdplatformConfig(String customerId, String parameterKey) {
//1.去third取第三方平台列表
ThirdPlatformFormDTO form = new ThirdPlatformFormDTO();
form.setCustomerId(customerId);
form.setActionKey(ThirdPlatformActions.PROJECT_ASSIST);
Result<List<ThirdplatformResultDTO>> listResult = thirdOpenFeignClient.listAvailablePlatformsByCustomerAndAction(form);
if (listResult == null || !listResult.success()) {
throw new RenException("调用Third服务,获取第三方平台列表失败");
}
List<ThirdplatformResultDTO> platforms = listResult.getData();
// 2.本地查询
CustomerProjectParameterEntity params = new CustomerProjectParameterEntity();
params.setCustomerId(customerId);
params.setParameterKey(parameterKey);
String value = baseDao.selectParameterValueByKey(params);
value = StringUtils.isBlank(value) ? "0" : value;
ThirdPlatformConfigResultDTO result = new ThirdPlatformConfigResultDTO();
result.setSendProjectSwitch(value);
platforms.forEach(p -> {
ThirdPlatformConfigResultDTO.CustomerSelectedPlatform platform = new ThirdPlatformConfigResultDTO.CustomerSelectedPlatform();
platform.setCustomerId(customerId);
platform.setIcon(p.getIcon());
platform.setPlatformId(p.getPlatformId());
platform.setPlatformName(p.getPlatformName());
result.getCustomerSelectedPlatformList().add(platform);
});
return result;
}
}

13
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java

@ -730,4 +730,17 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl<ProjectProcessDao
}
}
/**
* @Description 查询当前流转到外部系统的ID
* @Param projectId
* @author zxc
* @date 2021/3/19 上午10:18
*/
@Override
public List<String> selectPlatFormIds(String projectId) {
List<String> platFormIds = baseDao.selectPlatFormIds(projectId);
if (CollectionUtils.isEmpty(platFormIds))return new ArrayList<>();
return platFormIds;
}
}

551
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java

@ -28,9 +28,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.commons.tools.utils.*;
import com.epmet.constant.ParameterKeyConstant;
import com.epmet.constant.ProjectConstant;
import com.epmet.constant.SmsTemplateConstant;
@ -43,12 +41,22 @@ import com.epmet.dto.result.*;
import com.epmet.entity.*;
import com.epmet.feign.*;
import com.epmet.redis.ProjectRedis;
import com.epmet.resi.group.constant.TopicConstant;
import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.form.TopicAttachmentFormDTO;
import com.epmet.resi.group.dto.topic.result.TopicAttachmentResultDTO;
import com.epmet.resi.group.dto.topic.result.TopicFileResultDTO;
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO;
import com.epmet.service.*;
import com.github.pagehelper.PageHelper;
import com.google.common.base.Joiner;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.apache.commons.collections4.CollectionUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -56,6 +64,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.text.SimpleDateFormat;
@ -111,6 +120,17 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
private ProjectProcessAttachmentService projectProcessAttachmentService;
@Autowired
private GovIssueOpenFeignClient govIssueOpenFeignClient;
@Autowired
private ProjectSubProcessService projectSubProcessService;
@Autowired
private EpmetThirdOpenFeignClient epmetThirdOpenFeignClient;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private ProjectTraceService projectTraceService;
@Autowired
private ResiGroupOpenFeignClient resiGroupOpenFeignClient;
private final static String ONE_DAY = "<1";
@ -284,7 +304,14 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
@Override
public ProjectDetailResultDTO getProjectDetail(ProjectDetailFromDTO fromDTO) {
//TODO 获取 customer_project_parameter表key值external_system的value,如果为0,isSend为false,值为1则跟processable的值一样
CustomerProjectParameterDTO customerProjectParameterDTO = new CustomerProjectParameterDTO();
customerProjectParameterDTO.setCustomerId(fromDTO.getCustomerId());
customerProjectParameterDTO.setParameterKey(ProjectConstant.EXTERNAL_SYSTEM);
String parameterValue = parameterService.getParameterValueByKey(customerProjectParameterDTO);
ProjectDetailResultDTO resultDTO = baseDao.selectProjectDetail(fromDTO.getProjectId());
// 查询当前流转到外部系统的ID
resultDTO.setPlatformIds(projectProcessService.selectPlatFormIds(fromDTO.getProjectId()));
if (ProjectConstant.CLOSED.equals(resultDTO.getProjectStatus())) {
resultDTO.setProcessable(false);
resultDTO.setReturnable(false);
@ -295,9 +322,31 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
projectStaffDTO.setStaffId(fromDTO.getUserId());
List<DepartmentResultDTO> departmentList = projectStaffService.getDepartmentNameList(projectStaffDTO);
if (null != departmentList && departmentList.size() > NumConstant.ZERO) {
resultDTO.setProcessable(true);
//TODO external_system值为1时,根据departmentList里的projectStaffId在project_sub_process表找最新的一条记录,
// 如果没有记录或者INTERNAL_STATUS是closed,processable的值为true
if (StringUtils.isNotEmpty(parameterValue)){
if (parameterValue.equals(NumConstant.ONE_STR)) {
List<String> projectStaffIds = departmentList.stream().map(m -> m.getProjectStaffId()).distinct().collect(Collectors.toList());
// 根据departmentList里的projectStaffId在project_sub_process表找最新的一条记录
ProjectSubProcessDTO projectSubProcessDTO = projectSubProcessService.selectSubProcess(projectStaffIds);
if (null == projectSubProcessDTO || projectSubProcessDTO.getInternalStatus().equals(ProjectConstant.CLOSED)) {
resultDTO.setProcessable(true);
resultDTO.setIsSend(true);
} else {
resultDTO.setProcessable(false);
resultDTO.setIsSend(false);
}
} else {
resultDTO.setProcessable(true);
resultDTO.setIsSend(false);
}
} else {
resultDTO.setProcessable(true);
resultDTO.setIsSend(false);
}
} else {
resultDTO.setProcessable(false);
resultDTO.setIsSend(false);
}
ReturnListFromDTO returnListFromDTO = new ReturnListFromDTO();
returnListFromDTO.setProjectId(fromDTO.getProjectId());
@ -1299,7 +1348,9 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
@Transactional(rollbackFor = Exception.class)
public void projectProcessCostTimeDataCompensation() {
List<String> customers = baseDao.selectAllCustomerIds();
if(CollectionUtils.isEmpty(customers))return;
if(CollectionUtils.isEmpty(customers)) {
return;
}
List<ProjectOrgRelationDTO> totalContainer = new LinkedList<>();
customers.forEach(customerId -> {
List<ProjectOrgPeriodResultDTO> projectNodePeriodPerOrgList = projectStaffService.selectProjectOrgPeriod(customerId);
@ -1383,8 +1434,11 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
dataMap.forEach((k,v) -> {
if(null != v){
v.setTotalPeriod(batchDelta_T.get(k));
if(v.getHandledDate() == v.getFirstDealtDate())v.setFirstReplyPeriod(batchDelta_T.get(k));
else v.setFirstReplyPeriod(batchDelta_TResponse.get(k));
if(v.getHandledDate() == v.getFirstDealtDate()) {
v.setFirstReplyPeriod(batchDelta_T.get(k));
} else {
v.setFirstReplyPeriod(batchDelta_TResponse.get(k));
}
}
});
List<List<ProjectOrgRelationDTO>> partition = ListUtils.partition(totalContainer, NumConstant.ONE_HUNDRED);
@ -1576,17 +1630,25 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
int seq = NumConstant.ZERO;
a:
for (int index = NumConstant.ZERO; index < staffResponseTraceUnit.size(); index++) {
if(StringUtils.isNotBlank(staffResponseTraceUnit.get(index).getOperation()) && staffResponseTraceUnit.get(index).getOperation().contains("create")) continue;
if(StringUtils.isNotBlank(staffResponseTraceUnit.get(index).getOperation()) && staffResponseTraceUnit.get(index).getOperation().contains("create")) {
continue;
}
if (StringUtils.equals("response", staffResponseTraceUnit.get(index).getOperation())) {
replaceFirstResponseDate(incompleteBodyUnit,staffResponseTraceUnit.get(index),seq);
seq++;
int cursor = index;
if (cursor == staffResponseTraceUnit.size() - NumConstant.ZERO) break;
if (cursor == staffResponseTraceUnit.size() - NumConstant.ZERO) {
break;
}
while (StringUtils.equals("response", staffResponseTraceUnit.get(cursor++).getOperation())) {
if (cursor == staffResponseTraceUnit.size() - NumConstant.ZERO) break a;
if (cursor == staffResponseTraceUnit.size() - NumConstant.ZERO) {
break a;
}
}
if (cursor == staffResponseTraceUnit.size() - NumConstant.ZERO) {
break;
}
if (cursor == staffResponseTraceUnit.size() - NumConstant.ZERO) break;
index = cursor;
} else {
replaceFirstResponseDate(incompleteBodyUnit,staffResponseTraceUnit.get(index),seq);
@ -1608,7 +1670,9 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
// 传递过来的dest是已经按照projectId分好组之后再按照staff分组的集合
// dest key->staff
ProjectOrgPeriodResultDTO target = dest.get(seq);
if(null != target) target.setPeriodTillReplyFirstly(staffResponseTraceUnit.getCreatedTime());
if(null != target) {
target.setPeriodTillReplyFirstly(staffResponseTraceUnit.getCreatedTime());
}
}
/**
@ -1987,4 +2051,467 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
return projectInfoDTO;
}
/**
* 发送到外部平台
*
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2021/3/17 14:33
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void sendTo(SendToFormDTO formDTO) {
//公开回复内容审核
if (StringUtils.isNotBlank(formDTO.getPublicReply())) {
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
taskDTO.setContent(formDTO.getPublicReply());
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
}
}
}
//获取项目相关信息
ProjectEntity projectEntity = baseDao.selectById(formDTO.getProjectId());
if (ProjectConstant.CLOSED.equals(projectEntity.getStatus())) {
throw new RenException(EpmetErrorCode.PROJECT_IS_CLOSED.getCode());
}
if(StringUtils.isBlank(formDTO.getProjectStaffId())){
ProjectStaffDTO projectStaff = projectStaffService.getLatestIdByProjectIdAndStaffId(formDTO.getProjectId(),formDTO.getUserId());
if(null == projectStaff){
log.error("com.epmet.service.impl.ProjectServiceImpl.response,project_staff表中没有与之对应的数据,传参:{}", JSON.toJSONString(formDTO));
throw new RenException("未找到项目相关人员记录");
}
formDTO.setProjectStaffId(projectStaff.getId());
}
ProjectStaffDTO projectStaff = projectStaffService.get(formDTO.getProjectStaffId());
//处理响应记录加入项目进展表
ProjectProcessEntity projectProcessEntity = new ProjectProcessEntity();
projectProcessEntity.setProjectId(formDTO.getProjectId());
projectProcessEntity.setCustomerId(projectStaff.getCustomerId());
projectProcessEntity.setDepartmentName(formDTO.getDepartmentName());
projectProcessEntity.setOrgIdPath(projectStaff.getOrgIdPath());
projectProcessEntity.setGridId(projectStaff.getGridId());
projectProcessEntity.setDepartmentId(projectStaff.getDepartmentId());
projectProcessEntity.setAgencyId(projectStaff.getOrgId());
projectProcessEntity.setOperation(ProjectConstant.OPERATION_RESPONSES);
projectProcessEntity.setOperationName(ProjectConstant.OPERATION_RESPONSES_NAME);
projectProcessEntity.setPublicReply(formDTO.getPublicReply());
projectProcessEntity.setInternalRemark(formDTO.getInternalRemark());
projectProcessEntity.setStaffId(formDTO.getUserId());
projectProcessEntity.setIsSend(NumConstant.ONE);
projectProcessService.insert(projectProcessEntity);
//项目附件表新增数据 sun 2020.12.22
if (CollectionUtils.isNotEmpty(formDTO.getPublicFile()) || CollectionUtils.isNotEmpty(formDTO.getInternalFile())) {
saveFile(formDTO.getPublicFile(), formDTO.getInternalFile(), projectStaff.getCustomerId(), formDTO.getProjectId(), projectProcessEntity.getId());
}//end
//TODO 发送到外部系统 start
ProjectApplyAssistFormDTO applyAssistFormDTO = new ProjectApplyAssistFormDTO();
applyAssistFormDTO.setCustomerId(projectStaff.getCustomerId());
applyAssistFormDTO.setPlatformId(formDTO.getPlatformId());
applyAssistFormDTO.setTitle(projectEntity.getTitle());
UploadFileFormDTO uploadFileFormDTO = new UploadFileFormDTO();
uploadFileFormDTO.setCustomerId(projectStaff.getCustomerId());
uploadFileFormDTO.setPlatformId(formDTO.getPlatformId());
//存放项目和话题的附件
PlatformFileDTO platformFileDTO = new PlatformFileDTO();
if (CollectionUtils.isNotEmpty(formDTO.getInternalFile())) {
//附件上传到第三方平台,获取返回的链接
List<FileDTO> imageList =
formDTO.getInternalFile().stream().filter(fileDTO -> TopicConstant.IMAGE.equals(fileDTO.getType())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(imageList)) {
List<String> images = new ArrayList<>();
for (FileDTO file : imageList) {
Result<MultipartFile> multipartFileResult = HttpClientManager.getInstance().getFileItem(file.getUrl(), file.getName());
if (!multipartFileResult.success()) {
throw new RenException(multipartFileResult.getCode(), multipartFileResult.getMsg());
}
uploadFileFormDTO.setFile(multipartFileResult.getData());
Result<UploadFileResultDTO> uploadResult = epmetThirdOpenFeignClient.uploadFile(multipartFileResult.getData(),projectStaff.getCustomerId(), formDTO.getPlatformId());
if (!uploadResult.success()) {
throw new RenException(uploadResult.getCode(), uploadResult.getMsg());
}
images.add(uploadResult.getData().getUrl());
}
if (CollectionUtils.isNotEmpty(images)) {
String all = String.join(StrConstant.COMMA, images);
applyAssistFormDTO.setImageLink(all);
platformFileDTO.setProjectImages(all);
}
}
List<FileDTO> voiceList =
formDTO.getInternalFile().stream().filter(fileDTO -> TopicConstant.VOICE.equals(fileDTO.getType())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(voiceList)) {
List<String> voices = new ArrayList<>();
for (FileDTO file : voiceList) {
Result<MultipartFile> multipartFileResult = HttpClientManager.getInstance().getFileItem(file.getUrl(), file.getName());
if (!multipartFileResult.success()) {
throw new RenException(multipartFileResult.getCode(), multipartFileResult.getMsg());
}
Result<UploadFileResultDTO> uploadResult = epmetThirdOpenFeignClient.uploadFile(multipartFileResult.getData(),projectStaff.getCustomerId(), formDTO.getPlatformId());
if (!uploadResult.success()) {
throw new RenException(uploadResult.getCode(), uploadResult.getMsg());
}
voices.add(uploadResult.getData().getUrl());
}
if (CollectionUtils.isNotEmpty(voices)) {
String all = String.join(StrConstant.COMMA, voices);
applyAssistFormDTO.setVoiceLink(all);
platformFileDTO.setProjectVoices(all);
}
}
List<FileDTO> videoList =
formDTO.getInternalFile().stream().filter(fileDTO -> TopicConstant.VIDEO.equals(fileDTO.getType())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(videoList)) {
List<String> videos = new ArrayList<>();
for (FileDTO file : videoList) {
Result<MultipartFile> multipartFileResult = HttpClientManager.getInstance().getFileItem(file.getUrl(), file.getName());
if (!multipartFileResult.success()) {
throw new RenException(multipartFileResult.getCode(), multipartFileResult.getMsg());
}
Result<UploadFileResultDTO> uploadResult = epmetThirdOpenFeignClient.uploadFile(multipartFileResult.getData(),projectStaff.getCustomerId(), formDTO.getPlatformId());
if (!uploadResult.success()) {
throw new RenException(uploadResult.getCode(), uploadResult.getMsg());
}
videos.add(uploadResult.getData().getUrl());
}
if (CollectionUtils.isNotEmpty(videos)) {
String all = String.join(StrConstant.COMMA, videos);
applyAssistFormDTO.setVideoLink(all);
platformFileDTO.setProjectVideos(all);
}
}
if (CollectionUtils.isNotEmpty(formDTO.getInternalFile())) {
List<String> docs = new ArrayList<>();
for (FileDTO file : formDTO.getInternalFile()) {
Result<MultipartFile> multipartFileResult = HttpClientManager.getInstance().getFileItem(file.getUrl(), file.getName());
if (!multipartFileResult.success()) {
throw new RenException(multipartFileResult.getCode(), multipartFileResult.getMsg());
}
Result<UploadFileResultDTO> uploadResult = epmetThirdOpenFeignClient.uploadFile(multipartFileResult.getData(),projectStaff.getCustomerId(), formDTO.getPlatformId());
if (!uploadResult.success()) {
throw new RenException(uploadResult.getCode(), uploadResult.getMsg());
}
docs.add(uploadResult.getData().getUrl());
}
if (CollectionUtils.isNotEmpty(docs)) {
String all = String.join(StrConstant.COMMA, docs);
platformFileDTO.setProjectDocs(all);
}
}
}
//获取工作人员信息
Result<CustomerStaffDTO> staffInfo = epmetUserOpenFeignClient.getCustomerStaff(formDTO.getUserId());
if (!staffInfo.success()) {
throw new RenException(staffInfo.getCode(), staffInfo.getMsg());
}
applyAssistFormDTO.setPersonName(staffInfo.getData().getRealName());
applyAssistFormDTO.setMobile(staffInfo.getData().getMobile());
//获取网格信息
List<ProjectRelatedPersonnelDTO> relatedPersonnel = projectRelatedPersonnelService.getPersonnelListByProjectId(formDTO.getProjectId());
CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO();
customerGridFormDTO.setGridId(relatedPersonnel.get(0).getGridId());
//获取议题详情
IssueDetailFormDTO issueDetailFormDTO = new IssueDetailFormDTO();
issueDetailFormDTO.setIssueId(projectEntity.getOriginId());
Result<GovIssueDetailResultDTO> issueDetail = govIssueOpenFeignClient.votingissuedetail(issueDetailFormDTO);
if (!issueDetail.success() || null == issueDetail.getData()) {
throw new RenException(issueDetail.getCode(), issueDetail.getMsg());
}
//获取话题详情
Result<ResiTopicDTO> topic = resiGroupOpenFeignClient.getTopicById(issueDetail.getData().getTopicInfo().getTopicId());
if (!topic.success() || null == topic.getData()) {
throw new RenException(topic.getCode(), topic.getMsg());
}
applyAssistFormDTO.setLatitude(topic.getData().getDimension());
applyAssistFormDTO.setLongitude(topic.getData().getLongitude());
applyAssistFormDTO.setProvince(topic.getData().getProvince());
applyAssistFormDTO.setCity(topic.getData().getCity());
applyAssistFormDTO.setArea(topic.getData().getArea());
//获取话题附件
TopicAttachmentFormDTO topicAttachmentFormDTO = new TopicAttachmentFormDTO();
topicAttachmentFormDTO.setTopicId(issueDetail.getData().getTopicInfo().getTopicId());
Result<TopicAttachmentResultDTO> topicAttachment = resiGroupOpenFeignClient.topicAttachmentList(topicAttachmentFormDTO);
if (!topicAttachment.success() || null == topicAttachment.getData()) {
throw new RenException(topicAttachment.getCode(), topicAttachment.getMsg());
}
if (CollectionUtils.isNotEmpty(issueDetail.getData().getTopicInfo().getPhotoList())) {
List<String> files = new ArrayList<>();
for (String url : issueDetail.getData().getTopicInfo().getPhotoList()) {
Result<MultipartFile> multipartFileResult =
HttpClientManager.getInstance().getFileItem(url, "image." + FilenameUtils.getExtension(url));
if (!multipartFileResult.success()) {
throw new RenException(multipartFileResult.getCode(), multipartFileResult.getMsg());
}
Result<UploadFileResultDTO> uploadResult = epmetThirdOpenFeignClient.uploadFile(multipartFileResult.getData(),
projectStaff.getCustomerId(), formDTO.getPlatformId());
if (!uploadResult.success()) {
throw new RenException(uploadResult.getCode(), uploadResult.getMsg());
}
files.add(uploadResult.getData().getUrl());
}
if (CollectionUtils.isNotEmpty(files)) {
String all = String.join(StrConstant.COMMA, files);
platformFileDTO.setTopicImages(all);
applyAssistFormDTO.setImageLink(all);
}
}
if (CollectionUtils.isNotEmpty(topicAttachment.getData().getVoiceList())) {
List<String> files = new ArrayList<>();
for (TopicFileResultDTO item : topicAttachment.getData().getVoiceList()) {
Result<MultipartFile> multipartFileResult =
HttpClientManager.getInstance().getFileItem(item.getUrl(), "voice." + FilenameUtils.getExtension(item.getUrl()));
if (!multipartFileResult.success()) {
throw new RenException(multipartFileResult.getCode(), multipartFileResult.getMsg());
}
Result<UploadFileResultDTO> uploadResult = epmetThirdOpenFeignClient.uploadFile(multipartFileResult.getData(),projectStaff.getCustomerId(), formDTO.getPlatformId());
if (!uploadResult.success()) {
throw new RenException(uploadResult.getCode(), uploadResult.getMsg());
}
files.add(uploadResult.getData().getUrl());
}
if (CollectionUtils.isNotEmpty(files)) {
String all = String.join(StrConstant.COMMA, files);
platformFileDTO.setTopicVoices(all);
applyAssistFormDTO.setVoiceLink(all);
}
}
if (CollectionUtils.isNotEmpty(topicAttachment.getData().getVideoList())) {
List<String> files = new ArrayList<>();
for (TopicFileResultDTO item : topicAttachment.getData().getVideoList()) {
Result<MultipartFile> multipartFileResult =
HttpClientManager.getInstance().getFileItem(item.getUrl(), "video." + FilenameUtils.getExtension(item.getUrl()));
if (!multipartFileResult.success()) {
throw new RenException(multipartFileResult.getCode(), multipartFileResult.getMsg());
}
Result<UploadFileResultDTO> uploadResult = epmetThirdOpenFeignClient.uploadFile(multipartFileResult.getData(),projectStaff.getCustomerId(), formDTO.getPlatformId());
if (!uploadResult.success()) {
throw new RenException(uploadResult.getCode(), uploadResult.getMsg());
}
files.add(uploadResult.getData().getUrl());
}
if (CollectionUtils.isNotEmpty(files)) {
String all = String.join(StrConstant.COMMA, files);
platformFileDTO.setTopicVideos(all);
applyAssistFormDTO.setVideoLink(all);
}
}
if (CollectionUtils.isNotEmpty(topicAttachment.getData().getDocList())) {
List<String> files = new ArrayList<>();
for (TopicFileResultDTO item : topicAttachment.getData().getDocList()) {
Result<MultipartFile> multipartFileResult =
HttpClientManager.getInstance().getFileItem(item.getUrl(), "doc." + FilenameUtils.getExtension(item.getUrl()));
if (!multipartFileResult.success()) {
throw new RenException(multipartFileResult.getCode(), multipartFileResult.getMsg());
}
Result<UploadFileResultDTO> uploadResult = epmetThirdOpenFeignClient.uploadFile(multipartFileResult.getData(),projectStaff.getCustomerId(), formDTO.getPlatformId());
if (!uploadResult.success()) {
throw new RenException(uploadResult.getCode(), uploadResult.getMsg());
}
files.add(uploadResult.getData().getUrl());
}
if (CollectionUtils.isNotEmpty(files)) {
String all = String.join(StrConstant.COMMA, files);
platformFileDTO.setTopicDocs(all);
}
}
ProjectDetailDTO projectDetailDTO = ConvertUtils.sourceToTarget(issueDetail.getData(), ProjectDetailDTO.class);
projectDetailDTO.setTopicContent(issueDetail.getData().getTopicInfo().getTopicContent());
projectDetailDTO.setTopicPublisher(issueDetail.getData().getTopicInfo().getTopicPublisher());
projectDetailDTO.setTopicPublisherMobile(issueDetail.getData().getTopicInfo().getTopicPublisherMobile());
projectDetailDTO.setTopicPublishTime(issueDetail.getData().getTopicInfo().getTopicPublishTime());
projectDetailDTO.setPhotoList(issueDetail.getData().getTopicInfo().getPhotoList());
projectDetailDTO.setPublicReply(formDTO.getPublicReply());
projectDetailDTO.setInternalRemark(formDTO.getInternalRemark());
//项目详情
ProjectDetailFromDTO projectDetailFromDTO = new ProjectDetailFromDTO();
projectDetailFromDTO.setUserId(formDTO.getUserId());
projectDetailFromDTO.setProjectId(formDTO.getProjectId());
projectDetailFromDTO.setCustomerId(projectStaff.getCustomerId());
ProjectDetailResultDTO projectDetailResultDTO = getProjectDetail(projectDetailFromDTO);
//项目进展
ProcessListV2FormDTO processListV2FormDTO = new ProcessListV2FormDTO();
processListV2FormDTO.setProjectId(formDTO.getProjectId());
List<ProcessListV2ResultDTO> processList = projectTraceService.processListV2(processListV2FormDTO);
applyAssistFormDTO.setDetail(getDetail(projectDetailDTO, projectDetailResultDTO, processList, platformFileDTO));
applyAssistFormDTO.setDetailAddress(projectDetailDTO.getBelongsGridName());
applyAssistFormDTO.setSource("党建引领");
applyAssistFormDTO.setNotifyUrl("/gov/project/project/platformcallback");
Result<ProjectAssistResult> result = epmetThirdOpenFeignClient.applyAssist(applyAssistFormDTO);
if (!result.success()) {
throw new RenException(result.getCode(), result.getMsg());
}
ProjectAssistResult assistResult = result.getData();
//发送到外部系统 end
//结果存入project_sub_process表
ProjectSubProcessDTO projectSubProcess = new ProjectSubProcessDTO();
projectSubProcess.setCustomerId(projectStaff.getCustomerId());
projectSubProcess.setProjectId(formDTO.getProjectId());
projectSubProcess.setProcessId(projectProcessEntity.getId());
projectSubProcess.setProjectStaffId(formDTO.getProjectStaffId());
projectSubProcess.setPlatformId(formDTO.getPlatformId());
projectSubProcess.setPlatformName(formDTO.getPlatformName());
projectSubProcess.setTaskId(assistResult.getTaskId());
projectSubProcess.setExternalStatus(NumConstant.ONE_STR);
projectSubProcess.setExternalStatusDesc("待处理");
projectSubProcess.setInternalStatus(ProjectConstant.PENDING);
projectSubProcessService.save(projectSubProcess);
//项目节点历时
ProjectOrgRelationEntity relationEntity = relationDao.selectByProjectStaffId(formDTO.getProjectStaffId());
if(null != relationEntity){
ProjectOrgRelationEntity relationDto = new ProjectOrgRelationEntity();
relationDto.setProjectStaffId(relationEntity.getProjectStaffId());
if(null == relationEntity.getFirstDealtDate()){
Date current = new Date();
relationDto.setFirstDealtDate(current);
relationDto.setFirstReplyPeriod(calculateDelta_T(ProjectConstant.IMPRECISE_CALCULATION,
ProjectConstant.CALCULATION_TYPE_DEFAULT,projectStaff.getId(),
relationEntity.getInformedDate(),current));
relationDto.setOperation(ProjectConstant.OPERATION_RESPONSES);
relationDao.maintainTimePropertyConsistency(relationDto);
}
}else{
log.error("com.epmet.service.impl.ProjectServiceImpl#response,没有找到相关的节点耗时记录,参数:{}",JSON.toJSONString(formDTO));
throw new RenException("没有找到相关的节点耗时记录");
}
}
/**
* 第三方平台回调
*
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2021/3/19 15:12
*/
@Override
public void platformCallBack(PlatformCallBackFormDTO formDTO) {
ProjectSubProcessDTO projectSubProcessDTO = projectSubProcessService.getSubProcessByTaskId(formDTO.getEventId());
projectSubProcessDTO.setExternalStatus(formDTO.getStatus());
projectSubProcessDTO.setResult(formDTO.getNote());
projectSubProcessDTO.setHandleDate(DateUtils.stringToDate(formDTO.getHandleDate(), DateUtils.DATE_TIME_PATTERN));
projectSubProcessDTO.setHandleUserName(formDTO.getHandleUserName());
switch (formDTO.getStatus()) {
case NumConstant.ONE_STR:
projectSubProcessDTO.setExternalStatusDesc("待处理");
projectSubProcessDTO.setInternalStatus(ProjectConstant.PENDING);
break;
case NumConstant.TWO_STR:
projectSubProcessDTO.setExternalStatusDesc("待核实");
projectSubProcessDTO.setInternalStatus(ProjectConstant.PENDING);
break;
case NumConstant.THREE_STR:
projectSubProcessDTO.setExternalStatusDesc("已上报");
projectSubProcessDTO.setInternalStatus(ProjectConstant.PENDING);
break;
case NumConstant.FOUR_STR:
projectSubProcessDTO.setExternalStatusDesc("已完结");
projectSubProcessDTO.setInternalStatus(ProjectConstant.CLOSED);
break;
case NumConstant.FIVE_STR:
projectSubProcessDTO.setExternalStatusDesc("处理中");
projectSubProcessDTO.setInternalStatus(ProjectConstant.PENDING);
break;
case NumConstant.SIX_STR:
projectSubProcessDTO.setExternalStatusDesc("待分发");
projectSubProcessDTO.setInternalStatus(ProjectConstant.PENDING);
break;
case NumConstant.SEVEN_STR:
projectSubProcessDTO.setExternalStatusDesc("归档");
projectSubProcessDTO.setInternalStatus(ProjectConstant.PENDING);
break;
case NumConstant.EIGHT_STR:
projectSubProcessDTO.setExternalStatusDesc("催办");
projectSubProcessDTO.setInternalStatus(ProjectConstant.PENDING);
break;
case NumConstant.NINE_STR:
projectSubProcessDTO.setExternalStatusDesc("超时");
projectSubProcessDTO.setInternalStatus(ProjectConstant.PENDING);
break;
default:
break;
}
projectSubProcessService.save(projectSubProcessDTO);
//TODO 保存附件
}
private String getDetail(ProjectDetailDTO sourceDTO, ProjectDetailResultDTO projectDetail, List<ProcessListV2ResultDTO> processList, PlatformFileDTO platformFileDTO) {
String detail = "";
detail = detail.concat("项目来源\n");
if (null == sourceDTO.getTopicContent()) {
sourceDTO.setTopicContent("");
}
if (CollectionUtils.isEmpty(sourceDTO.getPhotoList())) {
sourceDTO.setPhotoList(new ArrayList<>());
}
String source = "议题标题:" + sourceDTO.getIssueTitle() + "\n" +
"针对话题\n" + (null == sourceDTO.getTopicContent()?"":sourceDTO.getTopicContent()) + "\n";
// if (StringUtils.isNotEmpty(platformFileDTO.getTopicImages())) {
// source = source + "话题图片:" + platformFileDTO.getTopicImages() + "\n";
// }
// if (StringUtils.isNotEmpty(platformFileDTO.getTopicVoices())) {
// source = source + "话题语音:" + platformFileDTO.getTopicVoices() + "\n";
// }
// if (StringUtils.isNotEmpty(platformFileDTO.getTopicVideos())) {
// source = source + "话题视频:" + platformFileDTO.getTopicVideos() + "\n";
// }
// if (StringUtils.isNotEmpty(platformFileDTO.getTopicDocs())) {
// source = source + "话题文档:" + platformFileDTO.getTopicDocs() + "\n";
// }
source = source + "建议采用如下处理方式\n" + sourceDTO.getIssueSuggestion() + "\n" +
"所属网格:" + sourceDTO.getBelongsGridName() + "\n" +
"话题发表人:" + sourceDTO.getTopicPublisher() + sourceDTO.getTopicPublisherMobile() + "\n" +
"议题发表人:" + sourceDTO.getIssueInitiator() + sourceDTO.getIssuePublisherMobile() + "\n" +
"话题发表时间:" + DateUtils.formatTimestamp(sourceDTO.getTopicPublishTime(), DateUtils.DATE_TIME_PATTERN);
detail = detail.concat(source);
detail = detail.concat("\n项目详情\n");
detail = detail + "项目标题:" +projectDetail.getProjectTitle() + "\n" +
"项目方案::\n" + projectDetail.getPublicReply() + "\n" +
"内部备注:\n" + projectDetail.getInternalRemark() + "\n" +
"当前处理部门:\n";
for (ProjectDetailResultDTO.DepartmentNameListBean item : projectDetail.getDepartmentList()) {
String department = item.getDepartmentName() + "(" + Joiner.on(StrConstant.COMMA).join(item.getStaffList()) + ")\n";
detail = detail + department;
}
detail = detail.concat("\n处理进展\n");
for (ProcessListV2ResultDTO item : processList) {
String process = "【" + item.getProcessName() + "】\n" +
DateUtils.formatTimestamp(item.getProcessTime(), DateUtils.DATE_TIME_PATTERN) + "\n" +
"处理部门:" + item.getDepartmentName() + "\n" +
"说明:" + item.getPublicReply() + "\n";
detail = detail + process;
}
System.out.println(detail);
log.debug(detail);
return detail;
}
private String toJson(Object object) {
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.setPrettyPrinting();
Gson gson = gsonBuilder.create();
return gson.toJson(object);
}
private String getFileName(String url) {
return UUID.randomUUID().toString().replace("-", "") + "." + FilenameUtils.getExtension(url);
}
}

100
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubAttachmentServiceImpl.java

@ -0,0 +1,100 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.ProjectSubAttachmentDao;
import com.epmet.dto.ProjectSubAttachmentDTO;
import com.epmet.entity.ProjectSubAttachmentEntity;
import com.epmet.service.ProjectSubAttachmentService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 外部系统事件附件
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-17
*/
@Service
public class ProjectSubAttachmentServiceImpl extends BaseServiceImpl<ProjectSubAttachmentDao, ProjectSubAttachmentEntity> implements ProjectSubAttachmentService {
@Override
public PageData<ProjectSubAttachmentDTO> page(Map<String, Object> params) {
IPage<ProjectSubAttachmentEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ProjectSubAttachmentDTO.class);
}
@Override
public List<ProjectSubAttachmentDTO> list(Map<String, Object> params) {
List<ProjectSubAttachmentEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ProjectSubAttachmentDTO.class);
}
private QueryWrapper<ProjectSubAttachmentEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ProjectSubAttachmentEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public ProjectSubAttachmentDTO get(String id) {
ProjectSubAttachmentEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ProjectSubAttachmentDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ProjectSubAttachmentDTO dto) {
ProjectSubAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, ProjectSubAttachmentEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ProjectSubAttachmentDTO dto) {
ProjectSubAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, ProjectSubAttachmentEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

145
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java

@ -0,0 +1,145 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.ProjectSubProcessDao;
import com.epmet.dto.ProjectSubProcessDTO;
import com.epmet.dto.result.SubProcessDTO;
import com.epmet.entity.ProjectSubProcessEntity;
import com.epmet.service.ProjectSubProcessService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 节点事件关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-17
*/
@Service
public class ProjectSubProcessServiceImpl extends BaseServiceImpl<ProjectSubProcessDao, ProjectSubProcessEntity> implements ProjectSubProcessService {
@Override
public PageData<ProjectSubProcessDTO> page(Map<String, Object> params) {
IPage<ProjectSubProcessEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ProjectSubProcessDTO.class);
}
@Override
public List<ProjectSubProcessDTO> list(Map<String, Object> params) {
List<ProjectSubProcessEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ProjectSubProcessDTO.class);
}
private QueryWrapper<ProjectSubProcessEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ProjectSubProcessEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public ProjectSubProcessDTO get(String id) {
ProjectSubProcessEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ProjectSubProcessDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ProjectSubProcessDTO dto) {
ProjectSubProcessEntity entity = ConvertUtils.sourceToTarget(dto, ProjectSubProcessEntity.class);
insert(entity);
dto = ConvertUtils.sourceToTarget(entity, ProjectSubProcessDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ProjectSubProcessDTO dto) {
ProjectSubProcessEntity entity = ConvertUtils.sourceToTarget(dto, ProjectSubProcessEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @Description 查询最新记录
* @Param projectStaffIds
* @author zxc
* @date 2021/3/18 上午11:16
*/
@Override
public ProjectSubProcessDTO selectSubProcess(List<String> projectStaffIds) {
if (CollectionUtils.isEmpty(projectStaffIds)){
return null;
}
return baseDao.selectSubProcess(projectStaffIds);
}
/**
* @Description 查询进展和附件
* @Param processIds
* @author zxc
* @date 2021/3/18 下午2:57
*/
@Override
public List<SubProcessDTO> selectSubProcessAndAttachment(List<String> processIds) {
if (CollectionUtils.isEmpty(processIds)){
return new ArrayList<>();
}
return baseDao.selectSubProcessAndAttachment(processIds);
}
/**
* 根据platformId查找最新的记录
*
* @param taskId
* @return com.epmet.dto.ProjectSubProcessDTO
* @author zhaoqifeng
* @date 2021/3/19 15:24
*/
@Override
public ProjectSubProcessDTO getSubProcessByTaskId(String taskId) {
return baseDao.selectSubProcessByTaskId(taskId);
}
}

39
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
@ -11,10 +12,7 @@ import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.ProjectStaffEntity;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.service.ProjectProcessService;
import com.epmet.service.ProjectService;
import com.epmet.service.ProjectStaffService;
import com.epmet.service.ProjectTraceService;
import com.epmet.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -45,6 +43,8 @@ public class ProjectTraceServiceImpl implements ProjectTraceService {
private ProjectProcessDao projectProcessDao;
@Autowired
private ProjectProcessAttachmentDao attachmentDao;
@Autowired
private ProjectSubProcessService projectSubProcessService;
@Override
public List<PendProjectListResultDTO> getPendProjectList(TokenDto tokenDto, ProjectListFromDTO fromDTO) {
@ -67,6 +67,7 @@ public class ProjectTraceServiceImpl implements ProjectTraceService {
@Override
public ProjectDetailResultDTO getProjectDetail(TokenDto tokenDto, ProjectDetailFromDTO fromDTO) {
fromDTO.setUserId(tokenDto.getUserId());
fromDTO.setCustomerId(tokenDto.getCustomerId());
return projectService.getProjectDetail(fromDTO);
}
@ -143,6 +144,21 @@ public class ProjectTraceServiceImpl implements ProjectTraceService {
log.warn(ProjectConstant.NOT_EXIST_PROJECT);
return new ArrayList<>();
}
List<String> processIds = processList.stream().filter(f -> f.getIsSend().equals(NumConstant.ONE)).map(m -> m.getProcessId()).collect(Collectors.toList());
List<SubProcessDTO> subProcess = projectSubProcessService.selectSubProcessAndAttachment(processIds);
// 是否发送到外部系统 0否 1是
if (!CollectionUtils.isEmpty(subProcess)){
processList.forEach(p -> {
List<SubProcessDTO> process = new ArrayList<>();
subProcess.forEach(s -> {
if (p.getProcessId().equals(s.getProcessId())){
process.add(s);
p.setSubProcess(process);
}
});
});
}
// 查询进展附件列表
List<PublicAndInternalFileResultDTO> files = attachmentDao.selectAttachByProjectId(formDTO.getProjectId());
if (!CollectionUtils.isEmpty(files)){
@ -182,4 +198,19 @@ public class ProjectTraceServiceImpl implements ProjectTraceService {
projectService.responseV2(formDTO);
}
/**
* 发送到外部平台
*
* @param tokenDto
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2021/3/17 14:33
*/
@Override
public void sendTo(TokenDto tokenDto, SendToFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
projectService.sendTo(formDTO);
}
}

50
epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.10__platform.sql

@ -0,0 +1,50 @@
CREATE TABLE `project_sub_process` (
`ID` varchar(64) NOT NULL COMMENT '唯一标识',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
`PROJECT_ID` varchar(64) NOT NULL COMMENT '项目ID',
`PROCESS_ID` varchar(64) NOT NULL COMMENT '节点ID',
`PROJECT_STAFF_ID` varchar(64) NOT NULL COMMENT '项目人员关联表ID:project_staff.id',
`PLATFORM_ID` varchar(64) NOT NULL COMMENT '系统ID',
`PLATFORM_NAME` varchar(32) NOT NULL COMMENT '系统名',
`TASK_ID` varchar(32) NOT NULL COMMENT '第三方平台返回的项目关联ID(事件Id)',
`RESULT` varchar(1024) DEFAULT NULL COMMENT '事件处理详细内容',
`EXTERNAL_STATUS` varchar(16) DEFAULT NULL COMMENT '外部状态:1待处理,2待核实,3已上报,4已完结,5处理中,6待分发,7归档,8催办,9超时',
`EXTERNAL_STATUS_DESC` varchar(32) DEFAULT NULL COMMENT '外部状态描述',
`INTERNAL_STATUS` varchar(16) DEFAULT NULL COMMENT '内部状态:待处理 pending,结案closed',
`HANDLE_DATE` datetime DEFAULT NULL COMMENT '处理日期',
`HANDLE_USER_NAME` varchar(32) DEFAULT NULL COMMENT '处理人姓名',
`DEL_FLAG` int(1) NOT NULL COMMENT '删除标识 0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='节点事件关联表 ';
CREATE TABLE `project_sub_attachment` (
`ID` varchar(64) NOT NULL COMMENT '唯一标识',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
`PROJECT_ID` varchar(64) NOT NULL COMMENT '项目ID',
`SUB_ID` varchar(64) NOT NULL COMMENT '子节点ID,project_sub_process.id',
`TASK_ID` varchar(64) NOT NULL COMMENT '第三方平台返回的项目关联ID(事件Id)',
`ATTACHMENT_NAME` varchar(128) DEFAULT NULL COMMENT '附件名',
`ATTACHMENT_SIZE` int(11) DEFAULT NULL COMMENT '文件大小 单位b',
`ATTACHMENT_FORMAT` varchar(32) DEFAULT NULL COMMENT '文件格式',
`ATTACHMENT_TYPE` varchar(32) DEFAULT NULL COMMENT '类型',
`ATTACHMENT_URL` varchar(256) DEFAULT NULL COMMENT '附件地址',
`DURATION` int(11) DEFAULT NULL COMMENT '语音或视频时长,秒',
`SORT` int(11) NOT NULL COMMENT '排序',
`DEL_FLAG` int(1) NOT NULL COMMENT '删除标识 0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='外部系统事件附件 ';
ALTER TABLE `project_process`
ADD COLUMN `IS_SEND` int(1) NOT NULL DEFAULT 0 COMMENT '是否发送到外部系统 0否 1是' AFTER `END_TIME`;
INSERT INTO `customer_project_parameter`(`ID`, `CUSTOMER_ID`, `PARAMETER_KEY`, `PARAMETER_NAME`, `PARAMETER_VALUE`, `DESCRIPTION`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1006', 'default', 'third_platform_project_send', '发送外部系统项目协助开关', '0', '0:关(默认) 1:开 ', '0', 1, '1', '2020-10-26 10:57:41', '1', '2020-10-26 10:57:45');

13
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectProcessDao.xml

@ -94,10 +94,21 @@
UNIX_TIMESTAMP(created_time) AS processTime,
DEPARTMENT_NAME,
PUBLIC_REPLY,
INTERNAL_REMARK
INTERNAL_REMARK,
IS_SEND
FROM project_process
WHERE DEL_FLAG = '0'
AND PROJECT_ID = #{projectId}
order by created_time desc
</select>
<!-- 查询当前流转到外部系统的ID -->
<select id="selectPlatFormIds" resultType="java.lang.String">
SELECT
DISTINCT psp.PLATFORM_ID
FROM project_process pp
LEFT JOIN project_sub_process psp ON psp.PROCESS_ID = pp.ID
WHERE psp.DEL_FLAG = 0
AND pp.PROJECT_ID = #{projectId}
</select>
</mapper>

28
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubAttachmentDao.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.ProjectSubAttachmentDao">
<resultMap type="com.epmet.entity.ProjectSubAttachmentEntity" id="projectSubAttachmentMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="projectId" column="PROJECT_ID"/>
<result property="subId" column="SUB_ID"/>
<result property="taskId" column="TASK_ID"/>
<result property="attachmentName" column="ATTACHMENT_NAME"/>
<result property="attachmentSize" column="ATTACHMENT_SIZE"/>
<result property="attachmentFormat" column="ATTACHMENT_FORMAT"/>
<result property="attachmentType" column="ATTACHMENT_TYPE"/>
<result property="attachmentUrl" column="ATTACHMENT_URL"/>
<result property="duration" column="DURATION"/>
<result property="sort" column="SORT"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>

111
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubProcessDao.xml

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.ProjectSubProcessDao">
<resultMap type="com.epmet.entity.ProjectSubProcessEntity" id="projectSubProcessMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="projectId" column="PROJECT_ID"/>
<result property="processId" column="PROCESS_ID"/>
<result property="staffId" column="STAFF_ID"/>
<result property="platformId" column="PLATFORM_ID"/>
<result property="platformName" column="PLATFORM_NAME"/>
<result property="taskId" column="TASK_ID"/>
<result property="result" column="RESULT"/>
<result property="externalStatus" column="EXTERNAL_STATUS"/>
<result property="externalStatusDesc" column="EXTERNAL_STATUS_DESC"/>
<result property="internalStatus" column="INTERNAL_STATUS"/>
<result property="handleDate" column="HANDLE_DATE"/>
<result property="handleUserName" column="HANDLE_USER_NAME"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 查询最新记录 -->
<select id="selectSubProcess" resultType="com.epmet.dto.ProjectSubProcessDTO">
SELECT
*
FROM
project_sub_process
WHERE
DEL_FLAG = '0'
AND (
<foreach collection="projectStaffIds" item="id" separator=" or ">
PROJECT_STAFF_ID = #{id}
</foreach>
)
ORDER BY CREATED_TIME DESC
LIMIT 1
</select>
<resultMap id="subProcess" type="com.epmet.dto.result.SubProcessDTO">
<result property="platformName" column="platformName"/>
<result property="externalStatus" column="externalStatus"/>
<result property="processTime" column="processTime"/>
<result property="handleUserName" column="handleUserName"/>
<result property="result" column="result"/>
<result property="subId" column="subId"/>
<result property="processId" column="processId"/>
<collection property="subFile" column="subId" select="selectAtt" ofType="com.epmet.dto.result.PublicAndInternalFileResultDTO"/>
</resultMap>
<!-- 查询进展和附件 -->
<select id="selectSubProcessAndAttachment" resultMap="subProcess">
SELECT psp.id as subId,
psp.PLATFORM_NAME as platformName,
psp.EXTERNAL_STATUS as externalStatus,
psp.CREATED_TIME AS processTime,
IFNULL(psp.HANDLE_USER_NAME,'') as handleUserName,
IFNULL(psp.RESULT,'') as result,
psp.process_id as processId
FROM project_sub_process psp
WHERE psp.DEL_FLAG = 0
AND (
<foreach collection="processIds" item="processId" separator=" OR ">
psp.PROCESS_ID = #{processId}
</foreach>
)
</select>
<select id="selectAtt" resultType="com.epmet.dto.result.PublicAndInternalFileResultDTO">
SELECT
psa.ATTACHMENT_NAME AS name,
psa.ATTACHMENT_URL AS url,
psa.ATTACHMENT_TYPE AS type,
psa.ATTACHMENT_FORMAT AS format,
IFNULL(psa.ATTACHMENT_SIZE,0) AS size,
IFNULL(psa.DURATION,0) AS duration
FROM project_sub_attachment psa
WHERE psa.DEL_FLAG = '0'
AND psa.SUB_ID = #{subId}
order by psa.sort
</select>
<select id="selectSubProcessByTaskId" resultType="com.epmet.dto.ProjectSubProcessDTO">
select
CUSTOMER_ID,
PROJECT_ID,
PROCESS_ID,
PROJECT_STAFF_ID,
PLATFORM_ID,
PLATFORM_NAME,
TASK_ID,
RESULT,
EXTERNAL_STATUS,
EXTERNAL_STATUS_DESC,
INTERNAL_STATUS,
HANDLE_DATE,
HANDLE_USER_NAME
from project_sub_process
where
DEL_FLAG = '0'
AND TASK_ID = #{taskId}
order by CREATED_TIME DESC limit 1
</select>
</mapper>

10
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerThirdplatApiserviceDao.java

@ -23,6 +23,8 @@ import com.epmet.entity.CustomerThirdplatApiserviceEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 客户所属的第三方平台的apiService列表
*
@ -33,4 +35,12 @@ import org.apache.ibatis.annotations.Param;
public interface CustomerThirdplatApiserviceDao extends BaseDao<CustomerThirdplatApiserviceEntity> {
ThirdplatApiserviceResultDTO getByCustomerId(@Param("customerId") String customerId);
/**
* @Description 列出该客户所有的ApiService
* @return
* @author wxz
* @date 2021.03.15 15:07
*/
List<ThirdplatApiserviceResultDTO> listByCustomerId(String customerId);
}

2
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerThirdplatApiServiceService.java

@ -3,6 +3,8 @@ package com.epmet.service;
import com.epmet.dto.result.ThirdplatApiserviceResultDTO;
import com.epmet.entity.CustomerThirdplatApiserviceEntity;
import java.util.List;
public interface CustomerThirdplatApiServiceService {
/**

3
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerThirdplatApiServiceServiceImpl.java

@ -8,9 +8,12 @@ import com.epmet.dao.CustomerThirdplatApiserviceDao;
import com.epmet.dto.result.ThirdplatApiserviceResultDTO;
import com.epmet.service.CustomerThirdplatApiServiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service

14
epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerThirdplatApiserviceDao.xml

@ -29,5 +29,19 @@
where cta.CUSTOMER_ID = #{customerId}
</select>
<select id="listByCustomerId" resultType="com.epmet.dto.result.ThirdplatApiserviceResultDTO">
select id,
customer_id,
api_service_name,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from customer_thirdplat_apiservice cta
where cta.CUSTOMER_ID = #{customerId}
</select>
</mapper>

18
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java

@ -198,4 +198,22 @@ public interface ResiGroupOpenFeignClient {
@GetMapping("resi/group/topic/querytopicinfobyissueid/{issueId}")
Result<ResiTopicDTO> queryTopicInfoByIssueId(@PathVariable("issueId")String issueId);
/**
* @param
* @return
* @Author sun
* @Description 根据话题Id查询话题信息
**/
@PostMapping("/resi/group/topic/gettopicbyid/{topicId}")
Result<ResiTopicDTO> getTopicById(@PathVariable("topicId") String topicId);
/**
* @param formDTO
* @return
* @Author sun
* @Description 获取话题附件信息
**/
@PostMapping(value = "/resi/group/topic/topicattachmentlist")
Result<TopicAttachmentResultDTO> topicAttachmentList(@RequestBody TopicAttachmentFormDTO formDTO);
}

26
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java

@ -12,10 +12,7 @@ import com.epmet.resi.group.dto.group.result.GroupInfoResultDTO;
import com.epmet.resi.group.dto.topic.MyCreateTopicsFormDTO;
import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.form.*;
import com.epmet.resi.group.dto.topic.result.IssueGridResultDTO;
import com.epmet.resi.group.dto.topic.result.MyPartIssueResultDTO;
import com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO;
import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO;
import com.epmet.resi.group.dto.topic.result.*;
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO;
import org.springframework.stereotype.Component;
@ -139,4 +136,25 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien
public Result<ResiTopicDTO> queryTopicInfoByIssueId(String issueId) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "queryTopicInfoByIssueId", issueId);
}
/**
* @param topicId@return
* @Author sun
* @Description 根据话题Id查询话题信息
**/
@Override
public Result<ResiTopicDTO> getTopicById(String topicId) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getTopicById", topicId);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 获取话题附件信息
**/
@Override
public Result<TopicAttachmentResultDTO> topicAttachmentList(TopicAttachmentFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "topicAttachmentList", formDTO);
}
}

Loading…
Cancel
Save