Browse Source

Merge branch 'dev_thirdplatform' into dev_temp

dev
wxz 5 years ago
parent
commit
b51e5da15a
  1. 2
      epmet-cloud-generator/src/main/resources/application.yml
  2. 18
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  3. 11
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ApiServiceActions.java
  4. 13
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdPlatformActions.java
  5. 15
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectApplyAssistFormDTO.java
  6. 20
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/TPFDemoFormDTO.java
  7. 46
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java
  8. 15
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java
  9. 185
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/ApiService.java
  10. 28
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/DemoApiService.java
  11. 40
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/LuzhouGridPlatformApiService.java
  12. 13
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformProjectAssistResult.java
  13. 13
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/ProjectAssistResult.java
  14. 53
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ProjectController.java
  15. 79
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java
  16. 41
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformActionDao.java
  17. 36
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java
  18. 38
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java
  19. 46
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java
  20. 52
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformActionEntity.java
  21. 56
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerActionEntity.java
  22. 55
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerRegisterEntity.java
  23. 71
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java
  24. 46
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ApiServiceSelector.java
  25. 19
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ProjectService.java
  26. 23
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java
  27. 38
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  28. 63
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java
  29. 36
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformActionDao.xml
  30. 38
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml
  31. 38
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml
  32. 90
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml
  33. 5
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectProcessDTO.java
  34. 126
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubAttachmentDTO.java
  35. 136
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubProcessDTO.java
  36. 5
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectDetailFromDTO.java
  37. 49
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/SendToFormDTO.java
  38. 11
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProcessListV2ResultDTO.java
  39. 4
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java
  40. 42
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java
  41. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java
  42. 85
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubAttachmentController.java
  43. 85
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubProcessController.java
  44. 16
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java
  45. 33
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubAttachmentDao.java
  46. 54
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java
  47. 5
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectProcessEntity.java
  48. 96
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubAttachmentEntity.java
  49. 106
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubProcessEntity.java
  50. 95
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubAttachmentService.java
  51. 112
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java
  52. 10
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTraceService.java
  53. 26
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  54. 100
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubAttachmentServiceImpl.java
  55. 131
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java
  56. 38
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java
  57. 3
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectProcessDao.xml
  58. 28
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubAttachmentDao.xml
  59. 89
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubProcessDao.xml
  60. 9
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java
  61. 5
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java
  62. 13
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
  63. 10
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerThirdplatApiserviceDao.java
  64. 9
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerThirdplatApiServiceService.java
  65. 19
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerThirdplatApiServiceServiceImpl.java
  66. 14
      epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerThirdplatApiserviceDao.xml

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配置

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

@ -371,4 +371,22 @@ public class RedisKeys {
public static String getCustomerApiServiceKey(String customerId) {
return rootPrefix.concat("customer:thirdplat:apiservice:").concat(customerId);
}
/**
* 一个客户对应多个第三方平台多个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);
}
}

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";
}

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

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

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

@ -0,0 +1,15 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class ProjectApplyAssistFormDTO {
private String customerId;
@NotBlank(message = "平台ID不能为空")
private String platformId;
}

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;
}

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

@ -0,0 +1,46 @@
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 {}
@NotBlank(message = "客户ID不能为空", groups = { ListAvailableByCustomerAndActionGroup.class,
ListSelectableByCustomerAndActionGroup.class,
SaveCustomerSelectedPlatformGroup.class,
ListSelectedPlatforms.class,
UpdateCustomizePlatformInfo.class })
private String customerId;
@NotBlank(message = "动作不能为空", groups = { ListAvailableByCustomerAndActionGroup.class,
ListSelectableByCustomerAndActionGroup.class,
SaveCustomerSelectedPlatformGroup.class })
private String actionKey;
@NotBlank(message = "平台ID不能为空", groups = { SaveCustomerSelectedPlatformGroup.class,
UpdateCustomizePlatformInfo.class })
private String platformId;
@NotBlank(message = "平台名称不能为空", groups = { UpdateCustomizePlatformInfo.class })
private String platformName;
@NotBlank(message = "平台图标不能为空", groups = { UpdateCustomizePlatformInfo.class })
private String icon;
}

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;
}

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

@ -0,0 +1,185 @@
package com.epmet.apiservice;
import com.epmet.apiservice.result.ProjectAssistResult;
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.constant.ThirdPlatformActions;
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.entity.ThirdplatformActionEntity;
import com.epmet.entity.ThirdplatformCustomerRegisterEntity;
import com.epmet.entity.ThirdplatformEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.redis.core.RedisTemplate;
import java.util.HashMap;
import java.util.Map;
/**
* ApiService对接第三方平台的抽象类每一个子类都对应一个第三方平台每个第三方平台都实现唯一一个子类
* 每一个具体平台的ApiService都是该抽象类的子类选择性实现抽象类中的某些需要实现方法提供具体业务逻辑
* 此抽象类中定义方法的具体返回类型所有子类都要统一使用在具体实现中做转换若是不需要返回返回null即可
*/
public abstract class ApiService {
/**
* @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);
Result<String> result = HttpClientManager.getInstance().sendGet(thirdplatform.getBaseUrl().concat(actionEntity.getApiUrl()),
thirdplatform.getBaseUrl().startsWith("https://"),
params,
headers);
if (result == null) {
throw new RenException("请求第三方平台,获取AccessToken失败。result为null");
}
if (result.success()) {
throw new RenException("请求第三方平台,获取AccessToken失败。");
}
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);
Result<String> result = HttpClientManager.getInstance().sendPost(thirdplatform.getBaseUrl().concat(actionEntity.getApiUrl()),
thirdplatform.getBaseUrl().startsWith("https://"),
jsonString,
headers);
if (result == null) {
throw new RenException("请求第三方平台,获取AccessToken失败。result为null");
}
if (result.success()) {
throw new RenException("请求第三方平台,获取AccessToken失败。");
}
return result.getData();
}
/**
* @Description 获取accessToken
* @return
* @author wxz
* @date 2021.03.16 13:45
*/
private String getAccessToken(String platformId) {
RedisTemplate<String, String> rt = SpringContextUtils.getBean("redisTemplate", RedisTemplate.class);
String token = rt.opsForValue().get(RedisKeys.getThirdPlatformAccessTokenKey(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 = HttpClientManager.getInstance().sendGet(baseUrl.concat(actionEntity.getApiUrl()), params);
if (result == null) {
throw new RenException("请求第三方平台,获取AccessToken失败。result为null");
}
if (result.success()) {
throw new RenException("请求第三方平台,获取AccessToken失败。");
}
token = result.getData();
rt.opsForValue().set(RedisKeys.getThirdPlatformAccessTokenKey(platformId), token);
}
return token;
}
/**
* @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;
}
}

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

@ -0,0 +1,28 @@
package com.epmet.apiservice.impl;
import com.epmet.apiservice.ApiService;
import com.epmet.apiservice.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);
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Override
public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO formDTO) {
logger.info("DemoApiService发送项目协助到第三方平台成功");
return null;
}
}

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

@ -0,0 +1,40 @@
package com.epmet.apiservice.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.apiservice.ApiService;
import com.epmet.apiservice.result.LZGridPlatformProjectAssistResult;
import com.epmet.apiservice.result.ProjectAssistResult;
import com.epmet.constant.ThirdPlatformActions;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
/**
* 泸州网格化平台ApiService
*/
@Component("luzhouGridPlatformApiService")
public class LuzhouGridPlatformApiService extends ApiService {
@Override
public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO formDTO) {
String platformId = formDTO.getPlatformId();
// 正式调用第三方平台
//String result = sendPostRequest(platformId, ThirdPlatformActions.PROJECT_ASSIST, "{}", null);
// 开发阶段临时写死
String result = "{\"eventId\":\"test-task-id\"}";
ProjectAssistResult projectAssistResult = new ProjectAssistResult();
if (!StringUtils.isBlank(result)) {
// 此处要经过一系列业务处理,将第三方平台返回的数据进行解析,等处理最后转换成ProjectAssistResult类型,返回。ProjectAssistResult这个类型是
// 所有apiService的projectAssist方法返回值的统一类型,是我们的epmet-cloud所需要的数据的实体,
// 所有apiService都要想办法转化成这个类型。
LZGridPlatformProjectAssistResult lzResult = JSON.parseObject(result, LZGridPlatformProjectAssistResult.class);
// 此处设置为第三方系统返回的唯一id
projectAssistResult.setTaskId(lzResult.getEventId());
}
System.out.println("泸州网格化平台项目协助发送成功");
return projectAssistResult;
}
}

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;
}

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

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

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

@ -0,0 +1,53 @@
package com.epmet.controller;
import com.epmet.apiservice.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.service.ProjectService;
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;
/**
* 对接第三方平台业务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 applyAssist(@RequestBody ProjectApplyAssistFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
ProjectAssistResult projectAssistResult = projectService.applyAssist(formDTO);
return new Result().ok(projectAssistResult);
}
}

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

@ -0,0 +1,79 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
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();
}
}

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);
}

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

@ -0,0 +1,36 @@
/**
* 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);
}

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());
}
}

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

@ -0,0 +1,19 @@
package com.epmet.service;
import com.epmet.apiservice.result.ProjectAssistResult;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.dto.form.TPFDemoFormDTO;
/**
* 该service用于封装project相关的代码
*/
public interface ProjectService {
String demoAction(TPFDemoFormDTO formDTO);
/**
*
* @param formDTO
*/
ProjectAssistResult applyAssist(ProjectApplyAssistFormDTO formDTO);
}

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

@ -0,0 +1,23 @@
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);
}

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

@ -0,0 +1,38 @@
package com.epmet.service.impl;
import com.epmet.apiservice.ApiService;
import com.epmet.apiservice.result.ProjectAssistResult;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.dto.form.TPFDemoFormDTO;
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);
}
}

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

@ -0,0 +1,63 @@
package com.epmet.service.impl;
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.ThirdplatformCustomerActionEntity;
import com.epmet.entity.ThirdplatformCustomerRegisterEntity;
import com.epmet.service.ThirdPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@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);
}
}
}

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>

38
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.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.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>
<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>

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 staffId;
/**
* 系统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;
}

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;
}

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

@ -0,0 +1,49 @@
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;
@Valid
private List<TickStaffFormDTO> staffList;
/**
* 公开答复对应文件集合
*/
private List<FileDTO> publicFile;
/**
* 内部备注对应文件集合
*/
private List<FileDTO> internalFile;
}

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<>();
}
}

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

@ -60,6 +60,10 @@ public class ProjectDetailResultDTO implements Serializable {
* 当前跟进部门
*/
private List<DepartmentNameListBean> departmentList;
/**
* 是否能发送到外部系统
*/
private Boolean isSend;
@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;
}

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 = "external_system";
}

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();
}
}

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> {
}

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

@ -0,0 +1,54 @@
/**
* 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);
}

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 staffId;
/**
* 系统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;
}

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);
}

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

@ -0,0 +1,112 @@
/**
* 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);
}

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);
}

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

@ -111,6 +111,8 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
private ProjectProcessAttachmentService projectProcessAttachmentService;
@Autowired
private GovIssueOpenFeignClient govIssueOpenFeignClient;
@Autowired
private ProjectSubProcessService projectSubProcessService;
private final static String ONE_DAY = "<1";
@ -284,7 +286,13 @@ 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());
resultDTO.setIsSend((StringUtils.isEmpty(parameterValue) || parameterValue.equals(NumConstant.ZERO_STR)) ? false : resultDTO.getProcessable());
if (ProjectConstant.CLOSED.equals(resultDTO.getProjectStatus())) {
resultDTO.setProcessable(false);
resultDTO.setReturnable(false);
@ -295,7 +303,23 @@ 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 (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(false);
}

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));
}
}

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

@ -0,0 +1,131 @@
/**
* 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);
}
@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);
}
}

38
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 -> {
subProcess.forEach(s -> {
if (p.getProcessId().equals(s.getProcessId())){
List<SubProcessDTO> process = new ArrayList<>();
process.add(s);
p.setSubProcess(process);
}
});
});
}
// 查询进展附件列表
List<PublicAndInternalFileResultDTO> files = attachmentDao.selectAttachByProjectId(formDTO.getProjectId());
if (!CollectionUtils.isEmpty(files)){
@ -182,4 +198,18 @@ 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) {
}
}

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

@ -94,7 +94,8 @@
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}

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>

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

@ -0,0 +1,89 @@
<?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,
psp.HANDLE_USER_NAME as handleUserName,
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>
</mapper>

9
epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java

@ -122,4 +122,13 @@ public interface OperCrmOpenFeignClient {
**/
@GetMapping("/oper/crm/customer/getallsubcustomerids/{customerId}")
Result<List<String>> getAllSubCustomerIds(@PathVariable("customerId") String customerId);
/**
* @Description 根据客户id列出该客户所有的apiService
* @return
* @author wxz
* @date 2021.03.15 15:13
*/
@PostMapping("list-apiservice-by-customerid")
Result<List<ThirdplatApiserviceResultDTO>> listApiServiceByCustomerId(@RequestBody ApiServiceFormDTO form);
}

5
epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java

@ -95,4 +95,9 @@ public class OperCrmOpenFeignClientFallback implements OperCrmOpenFeignClient {
public Result<List<String>> getAllSubCustomerIds(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getAllSubCustomerIds", customerId);
}
@Override
public Result<List<ThirdplatApiserviceResultDTO>> listApiServiceByCustomerId(ApiServiceFormDTO form) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "listApiServiceByCustomerId", form);
}
}

13
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java

@ -376,4 +376,17 @@ public class CustomerController {
}
return new Result<>();
}
/**
* @Description 根据客户id列出该客户所有的apiService
* @return
* @author wxz
* @date 2021.03.15 15:13
*/
@PostMapping("list-apiservice-by-customerid")
public Result<List<ThirdplatApiserviceResultDTO>> listApiServiceByCustomerId(@RequestBody ApiServiceFormDTO form) {
ValidatorUtils.validateEntity(form, ApiServiceFormDTO.GetByCustomerId.class);
String customerId = form.getCustomerId();
return new Result<List<ThirdplatApiserviceResultDTO>>().ok(customerThirdplatApiServiceService.listByCustomerId(customerId));
}
}

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);
}

9
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 {
/**
@ -13,4 +15,11 @@ public interface CustomerThirdplatApiServiceService {
*/
ThirdplatApiserviceResultDTO getByCustomerId(String customerId);
/**
* 根据客户id列出第三方平台列表
* @param customerId
* @return
*/
List<ThirdplatApiserviceResultDTO> listByCustomerId(String customerId);
}

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

@ -8,9 +8,12 @@ import com.epmet.dto.result.ThirdplatApiserviceResultDTO;
import com.epmet.entity.CustomerThirdplatApiserviceEntity;
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
@ -22,6 +25,10 @@ public class CustomerThirdplatApiServiceServiceImpl implements CustomerThirdplat
@Autowired
private CustomerThirdplatApiserviceDao thirdplatApiserviceDao;
@Autowired
private RedisTemplate<String, ThirdplatApiserviceResultDTO> tpasRedisTemplate;
@Override
public ThirdplatApiserviceResultDTO getByCustomerId(String customerId) {
ThirdplatApiserviceResultDTO apiService = null;
@ -39,4 +46,16 @@ public class CustomerThirdplatApiServiceServiceImpl implements CustomerThirdplat
return apiService;
}
@Override
public List<ThirdplatApiserviceResultDTO> listByCustomerId(String customerId) {
List<ThirdplatApiserviceResultDTO> apiServices = tpasRedisTemplate.opsForList().range(RedisKeys.listCustomerApiServiceListKey(customerId), 0, -1);
if (!CollectionUtils.isEmpty(apiServices)) {
return apiServices;
}
apiServices = thirdplatApiserviceDao.listByCustomerId(customerId);
tpasRedisTemplate.opsForList().rightPushAll(RedisKeys.listCustomerApiServiceListKey(customerId), apiServices);
return apiServices;
}
}

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>
Loading…
Cancel
Save