29 changed files with 755 additions and 0 deletions
@ -0,0 +1,11 @@ |
|||||
|
package com.epmet.constant; |
||||
|
|
||||
|
/** |
||||
|
* api service 常量列表 |
||||
|
*/ |
||||
|
public interface ApiServiceActions { |
||||
|
|
||||
|
// 测试动作
|
||||
|
String DEMO_ACTION = "demoAction"; |
||||
|
|
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
@Data |
||||
|
public class ProjectAssistFormDTO { |
||||
|
|
||||
|
private String customerId; |
||||
|
|
||||
|
@NotBlank(message = "平台ID不能为空") |
||||
|
private String platformId; |
||||
|
|
||||
|
} |
@ -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; |
||||
|
} |
@ -0,0 +1,63 @@ |
|||||
|
package com.epmet.apiservice; |
||||
|
|
||||
|
import com.epmet.apiservice.result.ProjectAssistResult; |
||||
|
import com.epmet.commons.tools.exception.RenException; |
||||
|
import com.epmet.commons.tools.utils.SpringContextUtils; |
||||
|
import com.epmet.dao.ThirdplatformCustomerRegisterDao; |
||||
|
import com.epmet.dto.form.ProjectAssistFormDTO; |
||||
|
import com.epmet.dto.form.TPFDemoFormDTO; |
||||
|
import com.epmet.entity.ThirdplatformCustomerRegisterEntity; |
||||
|
|
||||
|
/** |
||||
|
* ApiService,对接第三方平台的抽象类 |
||||
|
* 每一个具体平台的ApiService都是该抽象类的子类,选择性实现抽象类中的某些方法,提供具体业务逻辑 |
||||
|
*/ |
||||
|
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; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @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(ProjectAssistFormDTO formDTO) { |
||||
|
return null; |
||||
|
} |
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package com.epmet.apiservice.impl; |
||||
|
|
||||
|
import com.epmet.apiservice.ApiService; |
||||
|
import com.epmet.apiservice.result.ProjectAssistResult; |
||||
|
import com.epmet.commons.tools.exception.RenException; |
||||
|
import com.epmet.constant.ApiServiceActions; |
||||
|
import com.epmet.dto.form.ProjectAssistFormDTO; |
||||
|
import com.epmet.dto.form.TPFDemoFormDTO; |
||||
|
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(ProjectAssistFormDTO formDTO) { |
||||
|
logger.info("DemoApiService发送项目协助到第三方平台成功"); |
||||
|
return null; |
||||
|
} |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
package com.epmet.apiservice.impl; |
||||
|
|
||||
|
import com.epmet.apiservice.ApiService; |
||||
|
import com.epmet.apiservice.result.ProjectAssistResult; |
||||
|
import com.epmet.dto.form.ProjectAssistFormDTO; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* 泸州网格化平台ApiService |
||||
|
*/ |
||||
|
@Component("luzhouGridPlatformApiService") |
||||
|
public class LuzhouGridPlatformApiService extends ApiService { |
||||
|
|
||||
|
@Override |
||||
|
public ProjectAssistResult projectAssist(ProjectAssistFormDTO formDTO) { |
||||
|
System.out.println("泸州网格化平台项目协助发送成功"); |
||||
|
return null; |
||||
|
} |
||||
|
} |
@ -0,0 +1,4 @@ |
|||||
|
package com.epmet.apiservice.result; |
||||
|
|
||||
|
public class LZGridPlatformProjectAssistResult { |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
package com.epmet.apiservice.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class ProjectAssistResult { |
||||
|
|
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.dto.form.ProjectAssistFormDTO; |
||||
|
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; |
||||
|
|
||||
|
import java.lang.management.MemoryManagerMXBean; |
||||
|
|
||||
|
/** |
||||
|
* 对接第三方平台业务相关的controller |
||||
|
* 我们系统当中每一个需要发送到第三方平台的操作,只对应这里的一个方法,根据参数传入platformId,内部根据配置获取指定的APiService进行具体平台的调用 |
||||
|
* 每一个平台都有自己的ApiSerivce |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("biz") |
||||
|
public class BizController { |
||||
|
|
||||
|
@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("project-assist") |
||||
|
public Result projectAssist(@RequestBody ProjectAssistFormDTO formDTO) { |
||||
|
ValidatorUtils.validateEntity(formDTO); |
||||
|
projectService.projectAssist(formDTO); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -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.ThirdplatformActionEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-03-15 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface ThirdplatformActionDao extends BaseDao<ThirdplatformActionEntity> { |
||||
|
|
||||
|
} |
@ -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.constant.ThirdPlatformConstant; |
||||
|
import com.epmet.entity.ThirdplatformCustomerRegisterEntity; |
||||
|
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 ThirdplatformCustomerRegisterDao extends BaseDao<ThirdplatformCustomerRegisterEntity> { |
||||
|
|
||||
|
ThirdplatformCustomerRegisterEntity getByCustomerIdAndPlatformId(@Param("customerId") String customerId, @Param("platformId") String platformId); |
||||
|
} |
@ -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.ThirdplatformEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-03-15 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface ThirdplatformDao extends BaseDao<ThirdplatformEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
/** |
||||
|
* 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; |
||||
|
|
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
/** |
||||
|
* 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; |
||||
|
|
||||
|
} |
@ -0,0 +1,61 @@ |
|||||
|
/** |
||||
|
* 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; |
||||
|
|
||||
|
} |
@ -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()); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.dto.form.ProjectAssistFormDTO; |
||||
|
import com.epmet.dto.form.TPFDemoFormDTO; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* 该service用于封装project相关的代码 |
||||
|
*/ |
||||
|
public interface ProjectService { |
||||
|
|
||||
|
String demoAction(TPFDemoFormDTO formDTO); |
||||
|
|
||||
|
void projectAssist(ProjectAssistFormDTO formDTO); |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.epmet.apiservice.ApiService; |
||||
|
import com.epmet.apiservice.result.ProjectAssistResult; |
||||
|
import com.epmet.commons.tools.exception.RenException; |
||||
|
import com.epmet.dto.form.ProjectAssistFormDTO; |
||||
|
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 void projectAssist(ProjectAssistFormDTO formDTO) { |
||||
|
String customerId = formDTO.getCustomerId(); |
||||
|
String platformId = formDTO.getPlatformId(); |
||||
|
|
||||
|
// 注意,此处会如果找不到对应的ApiService会抛出异常
|
||||
|
ApiService apiService = selectApiService(platformId); |
||||
|
apiService.judgeRegistered(customerId, platformId); |
||||
|
|
||||
|
System.out.println(apiService); |
||||
|
|
||||
|
ProjectAssistResult projectAssistResult = apiService.projectAssist(formDTO); |
||||
|
} |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
<?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="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> |
@ -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.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="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, |
||||
|
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> |
@ -0,0 +1,21 @@ |
|||||
|
<?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="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> |
Loading…
Reference in new issue