Commit da910740 by 叶立庆

svn to git

0 parents
Showing 56 changed files with 3440 additions and 0 deletions
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
\ No newline at end of file \ No newline at end of file
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MavenRunner">
<option name="environmentProperties">
<map>
<entry key="-DarchetypeCatalog" value="local" />
</map>
</option>
</component>
</project>
\ No newline at end of file \ No newline at end of file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.com.glsx.framework</groupId>
<artifactId>framework-rop</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>
<groupId>cn.com.glsx.clue</groupId>
<artifactId>rop-scrm-clue</artifactId>
<version>1.0-SNAPSHOT</version>
<name>rop-scrm-clue</name>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
</dependency>
<dependency>
<groupId>cn.com.glsx.scrm</groupId>
<artifactId>rpc-scrm-clue-api</artifactId>
<version>4.55.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel-core</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>cn.com.glsx</groupId>
<artifactId>rpc-scrm-system-api</artifactId>
<version>0.0.2-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.clue;
import org.oreframework.boot.main.AbsOreBootStarter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
/**
* @Title: Main.java
* @Description:
* @author deployer name
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2015
*/
@SpringBootApplication
@ServletComponentScan
@EnableAspectJAutoProxy
public class Main extends AbsOreBootStarter {
@Override
public void run(String[] args)
{
SpringApplication.run(Main.class, args);
}
public static void main(String[] args)
{
Main main = new Main();
main.run(args);
}
}
package cn.com.glsx.clue.config;
import cn.com.glsx.scrm.clue.remote.BurialPointRecordRemote;
import cn.com.glsx.scrm.clue.remote.CollisionInfoRemote;
import org.oreframework.boot.autoconfigure.dubbo.reference.ReferenceBuilderFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Title: DubboConfig.java
* @Description: Dubbo服务注册配置
* @author deployer name
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2018
*/
@Configuration
public class DubboConfig {
@Autowired
private ReferenceBuilderFactory factory;
/**
* 注册远程服务(示例)
* RpcRemote为需要调用的远程服务
* @return
*/
/*@Bean
public RpcRemote rpcApiMethodRemote(){
return factory.builder(RpcRemote.class).check(false).timeout(30000).build();
}*/
@Bean
public CollisionInfoRemote collisionInfoRemote(){
return factory.builder(CollisionInfoRemote.class).check(false).version("1.0.0")
//.url("dubbo://localhost:8945")
.timeout(30000).build();
}
@Bean
public BurialPointRecordRemote burialPointRecordRemote(){
return factory.builder(BurialPointRecordRemote.class).check(false).version("1.0.0")
//.url("dubbo://localhost:8945")
.timeout(30000).build();
}
}
package cn.com.glsx.clue.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* @Title: SystemProperty.java
* @Description:
* @author deployer name
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017
*/
@Configuration
@ConfigurationProperties("system")
public class SystemProperty {
// 对应配置项:system.name
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package cn.com.glsx.clue.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@Configuration
@Component
public class ThreadPoolExecutorConfig {
@Autowired
private Environment env;
@Bean
public ThreadPoolExecutor templateExecutor() {
Integer corePoolSize = env.getProperty("executor.template.corePoolSize", Integer.class, 4);
Integer maxPoolSize = env.getProperty("executor.template.maxPoolSize", Integer.class, 20);
Integer keepAliveTime = env.getProperty("executor.template.keepAliveTime", Integer.class, 60);
Integer queueSize = env.getProperty("executor.template.queueSize", Integer.class, 20);
ThreadPoolExecutor executor = new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime,
TimeUnit.SECONDS, new LinkedBlockingQueue(queueSize),
new ThreadPoolExecutor.CallerRunsPolicy());
return executor;
}
}
package cn.com.glsx.clue.config;
import cn.com.glsx.clue.request.DefaultRequest;
import cn.com.glsx.clue.util.IpUtils;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.scrm.system.dto.LoginUserDTO;
import cn.com.glsx.scrm.system.model.UserInfoDO;
import cn.com.glsx.scrm.system.model.wechatapplets.LoginUserInfoResponse;
import com.rop.AbstractRopRequest;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.oreframework.boot.autoconfigure.rop.util.RopThreadLocal;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;
/**
* @author zhouhaibao
* @version 1.0
* @description: 用户信息统一处理
* @date 2021/7/30 10:00
*/
@Slf4j
@Aspect
@Component
public class UserAspect {
public void logPointCut() {
}
@Before("execution(* cn.com.glsx.clue.service..*(..))")
public void webpre(JoinPoint joinPoint) {
// 处理用户信息
try {
setUser(joinPoint);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 保存用户信息
*
* @param joinPoint
*/
public void setUser(JoinPoint joinPoint) throws Exception {
Object[] args = joinPoint.getArgs();
if (args != null && args.length != 0) {
Object object = args[0];
try {
if (object instanceof DefaultRequest) {
AbstractRopRequest accessToken = (AbstractRopRequest) object;
LoginUserDTO user = getUser();
if (user == null) return;
HttpServletRequest httpServletRequest = (HttpServletRequest) accessToken.getRopRequestContext().getRawRequestObject();
String ip = IpUtils.getIpAddr(httpServletRequest);
log.info("当前登录的ip{}", ip);
log.info("商户号{}", user.getMerchantId());
log.info("createdBy{}", user.getId());
log.info("用户id{}", user.getUuid());
log.info("用户类型{}", user.getUserType());
Class userCla = (Class) object.getClass();
Class superclass = userCla.getSuperclass();
Field field = superclass.getDeclaredField("createdBy");
Field field1 = superclass.getDeclaredField("createdAccount");
Field field5 = superclass.getDeclaredField("ip");
Field field7 = superclass.getDeclaredField("merchantId");
Field field6 = superclass.getDeclaredField("datalist");
Field field8 = superclass.getDeclaredField("entmicroId");
Field field9 = superclass.getDeclaredField("uuid");
Field field10 = superclass.getDeclaredField("userType");
field.setAccessible(true);
field.set(object, user.getId());
field1.setAccessible(true);
field1.set(object, user.getAccountName());
field5.setAccessible(true);
field5.set(object, ip);
field6.setAccessible(true);
field6.set(object, user.getPermissionMerchantIds());
field7.setAccessible(true);
field7.set(object, user.getMerchantId());
field8.setAccessible(true);
field8.set(object, user.getEntmicroId());
field9.setAccessible(true);
field9.set(object, user.getUuid());
field10.setAccessible(true);
field10.set(object, user.getUserType());
}
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR);
}
}
}
/**
* 获取用户信息
*
* @return
*/
public LoginUserDTO getUser() {
LoginUserDTO loginUser = null;
try {
loginUser = RopThreadLocal.getLoginUser(LoginUserDTO.class);
} catch (Exception e) {
}
if (loginUser != null)
return loginUser;
LoginUserInfoResponse loginUser1 = null;
try {
loginUser1 = RopThreadLocal.getLoginUser(LoginUserInfoResponse.class);
} catch (Exception e) {
}
if (loginUser1!=null){
loginUser = new LoginUserDTO();
loginUser.setMerchantId(loginUser1.getMerchantId());
loginUser.setId(loginUser1.getBussinessId());
loginUser.setUserType(loginUser1.getUserType());
loginUser.setAccountName(loginUser1.getAccountName());
loginUser.setMerchantName(loginUser1.getMerchantName());
loginUser.setPermissionMerchantIds(loginUser1.getPermissionMerchantIds());
loginUser.setUuid(loginUser1.getUuid());
loginUser.setAccountLevel(loginUser1.getAccountLevel());
return loginUser;
}
return loginUser;
}
}
package cn.com.glsx.clue.controller;
import cn.com.glsx.clue.request.BurialPointRecordInsertRequest;
import cn.com.glsx.clue.request.collision.CollisionSnInfoSearchRopRequest;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.scrm.clue.remote.BurialPointRecordRemote;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.concurrent.ThreadPoolExecutor;
@Slf4j
@Api("埋点记录模块接口")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
public class BurialPointRecordController {
@Autowired
private BurialPointRecordRemote burialPointRecordRemote;
@Autowired
private ThreadPoolExecutor templateExecutor;
@ServiceMethod(method = "clue.api.burial.point.record.batch.insert")
@ApiOperation("批量上报埋点记录")
public RopResponse<Boolean> batchInsert(BurialPointRecordInsertRequest request) {
try {
templateExecutor.execute(() -> {
burialPointRecordRemote.batchInsert(request.getRecordList());
});
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info(e.getMessage(), e);
return RopResponse.success(true);
} catch (Exception e) {
log.info(e.getMessage(), e);
return RopResponse.success(true);
}
}
}
package cn.com.glsx.clue.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.io.File;
import java.io.IOException;
import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.FileCopyUtils;
import cn.com.glsx.clue.request.example.ExampleRequest;
import cn.com.glsx.clue.request.example.LoginRequest;
import cn.com.glsx.clue.request.example.ExampleComplexRequest;
import cn.com.glsx.clue.request.example.UploadFileRequest;
import cn.com.glsx.clue.response.LoginResponse;
import cn.com.glsx.clue.response.ExampleResponse;
import cn.com.glsx.clue.response.UploadFileResponse;
import cn.com.glsx.framework.rop.response.RopResponse;
import com.rop.AbstractRopRequest;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import com.rop.session.SimpleSession;
/**
* @Title: ExampleController.java
* @Description:
* @author Alvin
* @date 2019年9月2日 下午3:27:41
* @version V2.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
@Api("示例接口")
public class ExampleController
{
/**
* logger
*/
protected final Logger logger = LoggerFactory.getLogger(getClass());
/**
* 接口例子
*
* @param req ExampleRequest
* @return Object
* @throws Exception 异常
*/
@ServiceMethod(method = "org.ore.api.example", needInSession = NeedInSessionType.NO)
@ApiOperation("get接口示例")
public RopResponse<ExampleResponse> getExample(ExampleRequest req)
throws Exception
{
ExampleResponse response = new ExampleResponse();
response.setField1("Ni Hao");
response.setField2(req.getName());
return RopResponse.success(response);
}
/**
* 复杂参数示例
* @param request
* @return
* @author Alvin
*/
@ServiceMethod(method = "org.ore.api.example.complex", needInSession = NeedInSessionType.NO)
@ApiOperation("复杂参数示例")
public RopResponse<ExampleResponse> complexExample(ExampleComplexRequest request){
ExampleResponse response = new ExampleResponse();
response.setField1(request.getName());
response.setField2(request.toString());
return RopResponse.success(response);
}
/**
* 文件上传示例
* @param request
* @return
* @author Alvin
* @throws IOException
*/
@ServiceMethod(method = "org.ore.api.example.upload", needInSession = NeedInSessionType.NO)
@ApiOperation("文件上传示例")
public RopResponse<UploadFileResponse> upload(UploadFileRequest request) throws IOException{
ClassPathResource outFile = new ClassPathResource("/");
File file = new File(outFile.getFile().getParent() + "/test." + request.getFile().getFileType());
FileCopyUtils.copy(request.getFile().getContent(), file);
UploadFileResponse response = new UploadFileResponse();
response.setFilePath(file.getPath());
return RopResponse.success(response);
}
/**
* 会话示例
* @param request
* @return
* @throws Exception
* @author Alvin
*/
@ServiceMethod(method = "org.ore.api.example.insession", needInSession = NeedInSessionType.YES)
@ApiOperation("会话示例")
public RopResponse<ExampleResponse> getExampleInSession(ExampleRequest request) throws Exception{
return getExample(request);
}
/**
* 登录示例
* @param request
* @return
* @author Alvin
*/
@ServiceMethod(method = "org.ore.api.example.login", needInSession = NeedInSessionType.NO)
@ApiOperation("登录示例")
public RopResponse<LoginResponse> login(LoginRequest request){
// 创建会话
SimpleSession session = new SimpleSession();
session.setAttribute("userName", request.getUserName());
String sessionId = UUID.randomUUID().toString();
request.getRopRequestContext().addSession(sessionId, session);
LoginResponse response = new LoginResponse();
response.setSessionId(sessionId);
return RopResponse.success(response);
}
/**
* 登出示例
* @param request
* @return
* @author Alvin
*/
@ServiceMethod(method = "org.ore.api.example.logout", needInSession = NeedInSessionType.YES)
@ApiOperation("登出示例")
public RopResponse<Boolean> logout(AbstractRopRequest request){
// 删除会话
request.getRopRequestContext().removeSession();
return RopResponse.success(true);
}
}
package cn.com.glsx.clue.controller.collision;
import cn.com.glsx.clue.request.collision.*;
import cn.com.glsx.clue.response.collision.*;
import cn.com.glsx.clue.service.collision.CollisionInfoService;
import cn.com.glsx.clue.util.Pagination;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* 碰撞线索
*/
@Slf4j
@Api("碰撞线模块接口")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
public class CollisionInfoController {
@Autowired
private CollisionInfoService collisionInfoService;
@ServiceMethod(method = "clue.api.collision.customer.device.list.export")
@ApiOperation("设备管理-列表查询导出")
public RopResponse<String> exportCustomerDeviceList(CollisionSnInfoSearchRopRequest request) {
try {
return RopResponse.success(collisionInfoService.exportCustomerDeviceList(request));
} catch (RpcServiceException e) {
log.info("=======CollisionInfoController__invoke__exportCustomerDeviceList__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
} catch (Exception e) {
log.info(e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ServiceMethod(method = "clue.api.collision.customer.device.list")
@ApiOperation("设备管理-列表查询")
public RopResponse<Pagination<CollisionSnInfoRopResponse>> getCustomerDeviceList(CollisionSnInfoSearchRopRequest request) {
try {
return RopResponse.success(collisionInfoService.getCustomerDeviceList(request));
} catch (RpcServiceException e) {
log.info("=======CollisionInfoController__invoke__getCustomerDeviceList__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
} catch (Exception e) {
log.info(e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ServiceMethod(method = "clue.api.collision.customer.device.edit")
@ApiOperation("设备管理-编辑")
public RopResponse<Boolean> customerDeviceEdit(CollisionSnInfoEditRopRequest request) {
try {
return RopResponse.success(collisionInfoService.customerDeviceEdit(request));
} catch (RpcServiceException e) {
log.info("=======CollisionInfoController__invoke__customerDeviceDetail__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
} catch (Exception e) {
log.info(e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ServiceMethod(method = "clue.api.collision.customer.device.detail")
@ApiOperation("设备管理-查询详情")
public RopResponse<CollisionSnInfoRopResponse> getCustomerDeviceDetail(CollisionSnInfoSearchRopRequest request) {
try {
return RopResponse.success(collisionInfoService.getCustomerDeviceDetail(request));
} catch (RpcServiceException e) {
log.info("=======CollisionInfoController__invoke__getCustomerDeviceDetail__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
} catch (Exception e) {
log.info(e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ServiceMethod(method = "clue.api.collision.device.import")
@ApiOperation("设备管理-设备信息导入")
public RopResponse<CustomerDeviceImportRopResponse> customerDeviceImport(CustomerDeviceImportRopRequest request) {
try {
return RopResponse.success(collisionInfoService.customerDeviceImport(request));
} catch (RpcServiceException e) {
log.info("=======CollisionInfoController__invoke__customerDeviceImport__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
} catch (Exception e) {
log.info(e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ServiceMethod(method = "clue.api.collision.info.listCollisionInfoByPage")
@ApiOperation("碰撞线索-分页查询")
public RopResponse<Pagination<CollisionInfoRopResponse>> listCollisionInfoByPage(CollisionInfoSearchRopRequest request) {
try {
return RopResponse.success(collisionInfoService.listCollisionInfoByPage(request));
} catch (RpcServiceException e) {
log.info("=======CollisionInfoController__invoke__listCollisionInfoByPage__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
} catch (Exception e) {
log.info(e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ServiceMethod(method = "clue.api.collision.info.exportCollisionInfo")
@ApiOperation("碰撞线索-列表导出")
public RopResponse<String> exportCollisionInfo(CollisionInfoSearchRopRequest request) {
try {
return RopResponse.success(collisionInfoService.exportCollisionInfo(request));
} catch (RpcServiceException e) {
log.info("=======CollisionInfoController__invoke__exportCollisionInfo__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
} catch (Exception e) {
log.info(e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ServiceMethod(method = "clue.api.collision.info.getDetail")
@ApiOperation("碰撞线索-查询详情")
public RopResponse<CollisionDetailInfoRopResponse> getCollisionDetail(CollisionInfoSearchRopRequest request) {
try {
return RopResponse.success(collisionInfoService.getCollisionDetail(request));
} catch (RpcServiceException e) {
log.info("=======CollisionInfoController__invoke__getCollisionDetail__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
} catch (Exception e) {
log.info(e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ServiceMethod(method = "clue.api.collision.info.follow")
@ApiOperation("碰撞线索-门店回访")
public RopResponse<FollowInfoRopResponse> followCollisionInfo(FollowInfoRopRequest request) {
try {
return RopResponse.success(collisionInfoService.followCollisionInfo(request));
} catch (RpcServiceException e) {
log.info("=======CollisionInfoController__invoke__followCollisionInfo__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
} catch (Exception e) {
log.info(e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ApiOperation("碰撞线索-员工回访")
@ServiceMethod(method = "clue.api.collision.followByStaff", needInSession = NeedInSessionType.YES)
public RopResponse<FollowInfoRopResponse> followCollisionInfoByStaff(FollowInfoRopRequest request){
try {
return RopResponse.success(collisionInfoService.followCollisionInfoByStaff(request));
} catch (RpcServiceException e) {
log.info("=======CollisionController__invoke__followCollisionInfoByStaff__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
} catch (Exception e) {
log.info(e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ServiceMethod(method = "clue.api.collision.config.addOrUpdatePushConfig")
@ApiOperation("碰撞线索-推送配置添加/修改")
public RopResponse<CollisionPushConfigRopResponse> addOrUpdatePushConfig(CollisionPushConfigRopRequest request) {
try {
return RopResponse.success(collisionInfoService.addOrUpdatePushConfig(request));
} catch (RpcServiceException e) {
log.info("=======CollisionInfoController__invoke__addOrUpdatePushConfig__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
} catch (Exception e) {
log.info(e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ServiceMethod(method = "clue.api.collision.config.getDetail")
@ApiOperation("碰撞线索-查询推送配置详情")
public RopResponse<List<CollisionPushConfigRopResponse>> getPushConfigDetail(CollisionPushConfigRopRequest request) {
try {
return RopResponse.success(collisionInfoService.getPushConfigDetail(request));
} catch (RpcServiceException e) {
log.info("=======CollisionInfoController__invoke__getPushConfigDetail__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
} catch (Exception e) {
log.info(e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
}
package cn.com.glsx.clue.convert;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhouhaibao
* @version 1.0
* @description: 请求体转化
* @date 2021/7/9 11:38
*/
public class ConvertRequest {
/**
* 转化请求参数
*
* @param re 原入参
* @param newObj 转后后的参数
* @param <T> 泛型
* @return
*/
public static <T> T convertRequest(Object re, T newObj) {
BeanUtils.copyProperties(re, newObj);
return newObj;
}
/**
* 转化请求参数List
*
* @param list 原入参
* @param clazz 转后后的参数
* @param <T> 泛型
* @return
*/
public static <E, T> List<T> convertListRequest(List<E> list, Class<T> clazz) {
List<T> tList = new ArrayList<>();
list.forEach(index -> {
T target = BeanUtils.instantiateClass(clazz);
BeanUtils.copyProperties(index, target);
tList.add(target);
});
return tList;
}
/**
* 分页对象转化参数
*
* @param old 原入参
* @param t 转化后的参数
* @param <T> 泛型
* @return
*/
public static <T> RpcPagination<T> convertPage(Object old, T t) {
RpcPagination rpcPagination = new RpcPagination();
BeanUtils.copyProperties(old, rpcPagination);
BeanUtils.copyProperties(old, t);
rpcPagination.setCondition(t);
return rpcPagination;
}
}
package cn.com.glsx.clue.convert;
import cn.com.glsx.clue.util.Pagination;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.BeanUtils;
import java.util.List;
/**
* @author zhouhaibao
* @version 1.0
* @description: 返回体转化参数
* @date 2021/7/9 11:21
*/
@Data
public class ConvertResponse {
/**
* 转化集合
*
* @param input 原集合
* @param clazz 新集合类
* @param <T> 泛型
* @return
*/
public static <E, T> List<T> convertList(List<E> input, Class<T> clazz) {
List<T> output = Lists.newArrayList();
if (CollectionUtils.isNotEmpty(input)) {
for (E source : input) {
T target = BeanUtils.instantiateClass(clazz);
BeanUtils.copyProperties(source, target);
output.add(target);
}
}
return output;
}
/**
* 分页转换
*
* @param clazz 新集合类
* @param list 原集合
* @return 新分页参数
*/
public static <E, T> Pagination<T> convertPage(RpcPagination<E> list, Class<T> clazz) {
Pagination pagination = new Pagination();
pagination.setPageNum(list.getPageNum());
List<T> newList = convertList(list.getList(), clazz);
pagination.setData(newList);
pagination.setCount((int) list.getTotal());
pagination.setPageSize(list.getPageSize());
return pagination;
}
/**
* 转化类型
*
* @param object 原类
* @param clazz 新类
* @return
*/
public static <T> T convertObject(Object object, Class<T> clazz) {
T target = BeanUtils.instantiateClass(clazz);
BeanUtils.copyProperties(object, target);
return target;
}
}
package cn.com.glsx.clue.request;
import cn.com.glsx.scrm.clue.dto.BurialPointRecordDTO;
import com.rop.AbstractRopRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class BurialPointRecordInsertRequest extends AbstractRopRequest {
@ApiModelProperty(name = "recordList", notes = "埋点记录列表")
private List<BurialPointRecordDTO> recordList;
}
package cn.com.glsx.clue.request;
import com.rop.AbstractRopRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zhouhaibao
* @version 1.0
* @description: 登录信息
* @date 2021/7/16 16:50
*/
@Data
public class DefaultRequest extends AbstractRopRequest {
/**
* 创建者
*/
@ApiModelProperty("创建者")
private Integer createdBy;
/**
* 创建人
*/
@ApiModelProperty("创建人")
private String createdAccount;
/**
* 当前账号数据权限
*/
@ApiModelProperty("当前账号数据权限")
private List<Integer> datalist;
/**
* 系统来源
*/
@ApiModelProperty("系统来源")
private String source;
/**
* 商户号
*/
@ApiModelProperty("商户号")
private Integer merchantId;
/**
* ip
*/
@ApiModelProperty("ip")
private String ip;
@ApiModelProperty("")
private String entmicroId;
/**
* 登录唯一id
*/
@ApiModelProperty("登录唯一id")
private String uuid;
/**
* 登录用户类型
*/
@ApiModelProperty("登录用户类型")
private Integer userType;
}
package cn.com.glsx.clue.request.collision;
import cn.com.glsx.clue.request.DefaultRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
public class CollisionInfoSearchRopRequest extends DefaultRequest {
@ApiModelProperty(notes = "运营版调用:true,非运营版: false", name = "operate")
private boolean operate;
@ApiModelProperty(notes = "分页数", name = "pageSize", required = true)
private Integer pageSize;
@ApiModelProperty(notes = "当前页", name = "pageNum", required = true)
private Integer pageNum;
@ApiModelProperty(notes = "碰撞线索id,详情专用",name = "id")
private Integer id;
@ApiModelProperty(notes = "设备号",name = "sn")
private String sn;
@ApiModelProperty(notes = "商户名称",name = "merchantName")
private String merchantName;
@ApiModelProperty(notes = "商户号",name = "merchantNo")
private Integer merchantNo;
@ApiModelProperty(notes = "设备类型,1:OBD\n" +
",2: DVD,\n" +
"3: 电子狗\n" +
",5 :TBOX(2G),\n" +
"6 行车记录仪\n" +
",7 :BBOX\n" +
",8: 追踪器\n" +
",9 :车载wifi\n" +
",12134 : 智能云镜\n" +
", 12499: AIBox\n" +
",12500: 小镜SOS记录仪,\n" +
"12501 : 智能定位车充\n" +
",12503: 数字车钥匙\n" +
",12514 :后视镜B300",name = "snType")
private Integer snType;
@ApiModelProperty(notes = "回访状态,0-未回访,1-已回访",name = "followStatus")
private Integer followStatus;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(notes = "跟进开始时间",name = "beginFollowTime")
private Date beginFollowTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(notes = "跟进结束时间",name = "endFollowTime")
private Date endFollowTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(notes = "碰撞开始时间",name = "beginFollowTime")
private Date beginCollisionTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(notes = "碰撞结束时间",name = "endFollowTime")
private Date endCollisionTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(notes = "碰撞精确时间",name = "collisionTime")
private Date collisionTime;
@ApiModelProperty(notes = "跟进结果,0-真实事故,1-非真实事故,2-无法处理",name = "followResult")
private Integer followResult;
@ApiModelProperty(notes = "客户手机号",name = "customerPhone")
private String customerPhone;
@ApiModelProperty(notes = "客户名称",name = "customerName")
private String customerName;
@ApiModelProperty(notes = "车牌号",name = "licensePlate")
private String licensePlate;
@ApiModelProperty(notes = "车架号",name = "standNo")
private String standNo;
}
package cn.com.glsx.clue.request.collision;
import cn.com.glsx.clue.request.DefaultRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class CollisionPushConfigRopRequest extends DefaultRequest {
@ApiModelProperty(notes = "推送开关,0-关,1-开", name = "pushFlag", required = true)
private Integer pushFlag;
@ApiModelProperty(notes = "推送开始时间,格式:HH:mm", name = "startTime", required = true)
private String startTime;
@ApiModelProperty(notes = "推送结束时间, 格式:HH:mm", name = "endTime", required = true)
private String endTime;
@ApiModelProperty(notes = " 配置类型,0-门店提醒,1-车主提醒", name = "configType", required = true)
private Integer configType;
@ApiModelProperty(notes = "顾问电话,多个用逗号分割", name = "pushPhones", required = true)
private String pushPhones;
@ApiModelProperty(notes = "营销卖点", name = "pushContent")
private String pushContent;
}
package cn.com.glsx.clue.request.collision;
import cn.com.glsx.clue.request.DefaultRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
public class CollisionSnInfoEditRopRequest extends DefaultRequest {
@ApiModelProperty(notes = "id")
private Integer id;
// /**
// * 设备号
// */
// @ApiModelProperty(notes = "设备号")
// private String sn;
//
// /**
// * 批次id
// */
// @ApiModelProperty(notes = "批次id")
// private Integer batchId;
//
// /**
// * 商户号
// */
// @ApiModelProperty(notes = "商户号")
// private Integer merchantId;
//
// /**
// * 商户名称
// */
// @ApiModelProperty(notes = "商户名称")
// private String merchantName;
//
// /**
// * 设备类型
// * @see DeviceTypeEnum
// */
// @ApiModelProperty(notes = "设备类型",example = "1:OBD\n" +
// ",2: DVD,\n" +
// "3: 电子狗\n" +
// ",5 :TBOX(2G),\n" +
// "6 行车记录仪\n" +
// ",7 :BBOX\n" +
// ",8: 追踪器\n" +
// ",9 :车载wifi\n" +
// ",12134 : 智能云镜\n" +
// ", 12499: AIBox\n" +
// ",12500: 小镜SOS记录仪,\n" +
// "12501 : 智能定位车充\n" +
// ",12503: 数字车钥匙\n" +
// ",12514 :后视镜B300")
// private Integer snType;
//
// /**
// * iccid
// */
// @ApiModelProperty(notes = "iccid")
// private String iccid;
/**
* 客户名称
*/
@ApiModelProperty(notes = "客户名称")
private String customerName;
/**
* 客户手机号
*/
@ApiModelProperty(notes = "客户手机号")
private String customerPhone;
/**
* 客户性别,0-男,1-女
*/
@ApiModelProperty(notes = "客户性别,0-男,1-女")
private Integer customerSex;
/**
* 车牌号
*/
@ApiModelProperty(notes = "车牌号")
private String licensePlate;
/**
* 车架号
*/
@ApiModelProperty(notes = "车架号")
private String standNo;
/**
* 设备安装时的初始里程
*/
// @ApiModelProperty(notes = "设备安装时的初始里程")
// private Long initialMileage;
//
// /**
// * 上次保养里程
// */
// @ApiModelProperty(notes = "上次保养里程")
// private Long lastMileage;
//
// /**
// * 上次保养时间
// */
// @ApiModelProperty(notes = "上次保养时间")
// private Date lastTime;
//
// /**
// * 下次保养里程
// */
// @ApiModelProperty(notes = "下次保养里程")
// private Long lowerMileage;
//
// /**
// * 下次保养时间
// */
// @ApiModelProperty(notes = "下次保养时间")
// private Date lowerTime;
/**
* 是否更换设备,0-保修更换-免费,1-维修更换,2-购买
* @see cn.com.glsx.scrm.clue.enums.collision.DeviceReplaceEnum
*/
@ApiModelProperty(notes = "是否更换设备,0-保修更换-免费,1-维修更换,2-购买")
private Integer replaceFlag;
/**
* 汽车品牌ID
*/
@ApiModelProperty(notes = "汽车品牌ID")
private Integer vehicleBrandId;
/**
* 汽车品牌
*/
@ApiModelProperty(notes = "汽车品牌")
private String vehicleBrandName;
/**
* 子品牌ID
*/
@ApiModelProperty(notes = "子品牌ID")
private Integer vehicleSubBrandId;
/**
* 子品牌名称
*/
@ApiModelProperty(notes = "子品牌名称")
private String vehicleSubBrandName;
/**
* 车系ID
*/
@ApiModelProperty(notes = "车系ID")
private Integer vehicleSeriesId;
/**
* 车系名称
*/
@ApiModelProperty(notes = "车系名称")
private String vehicleSeriesName;
/**
* 车型ID
*/
@ApiModelProperty(notes = "车型ID")
private Integer vehicleShapeId;
/**
* 车型名称
*/
@ApiModelProperty(notes = "车型名称")
private String vehicleShapeName;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.clue.request.collision;
import cn.com.glsx.clue.request.DefaultRequest;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
public class CollisionSnInfoSearchRopRequest extends DefaultRequest {
@ApiModelProperty(notes = "运营版调用:true",name = "operate")
private boolean operate;
@ApiModelProperty(notes = "分页数", name = "pageSize", required = true)
private Integer pageSize;
@ApiModelProperty(notes = "当前页", name = "pageNum", required = true)
private Integer pageNum;
@ApiModelProperty(notes = "id,详情专用",name = "id")
private Integer id;
@ApiModelProperty(notes = "设备号",name = "sn")
private String sn;
@ApiModelProperty(notes = "商户名称",name = "merchantName")
private String merchantName;
@ApiModelProperty(notes = "商户号",name = "merchantNo")
private Integer merchantNo;
@ApiModelProperty(notes = "设备类型,1:OBD\n" +
",2: DVD,\n" +
"3: 电子狗\n" +
",5 :TBOX(2G),\n" +
"6 行车记录仪\n" +
",7 :BBOX\n" +
",8: 追踪器\n" +
",9 :车载wifi\n" +
",12134 : 智能云镜\n" +
", 12499: AIBox\n" +
",12500: 小镜SOS记录仪,\n" +
"12501 : 智能定位车充\n" +
",12503: 数字车钥匙\n" +
",12514 :后视镜B300",name = "snType")
private Integer snType;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(notes = "起始时间",name = "beginTime")
private Date beginTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(notes = "结束时间",name = "endTime")
private Date endTime;
@ApiModelProperty(notes = "操作人",name = "account")
private String account;
@ApiModelProperty(notes = "客户手机号")
private String customerPhone;
@ApiModelProperty(notes = "客户名称")
private String customerName;
@ApiModelProperty(notes = "车牌号")
private String licensePlate;
@ApiModelProperty(notes = "车架号")
private String standNo;
/**
* 是否更换设备,0-保修更换-免费,1-维修更换,2-购买
* @see cn.com.glsx.scrm.clue.enums.collision.DeviceReplaceEnum
*/
@ApiModelProperty(notes = "是否更换设备,0-保修更换-免费,1-维修更换,2-购买")
private Integer replaceFlag;
}
package cn.com.glsx.clue.request.collision;
import cn.com.glsx.clue.request.DefaultRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
/**
* @Author yelq
* @Version 1.0
* @Description: 客户设备导入
* @Date 2023/10/11 17:32
*/
@Data
public class CustomerDeviceImportRopRequest extends DefaultRequest {
@ApiModelProperty(notes = "客户设备excel表url(xls/xlsx格式)")
private String url;
}
package cn.com.glsx.clue.request.collision;
import cn.com.glsx.clue.request.DefaultRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class FollowInfoRopRequest extends DefaultRequest {
@ApiModelProperty(notes = "碰撞线索id", name = "id", required = true)
private Integer id;
@ApiModelProperty(notes = "跟进结果,0-真实事故,1-非真实事故,2-无法处理", name = "followResult", required = true)
private Integer followResult;
@ApiModelProperty(notes = "跟进备注", name = "followRemark")
private String followRemark;
}
package cn.com.glsx.clue.request.example;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
import javax.validation.constraints.NotEmpty;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.commons.lang.builder.ToStringBuilder;
/**
* @Title: Address.java
* @Description: 地址信息参数示例
* @author Alvin
* @date 2020年11月12日 下午3:08:28
* @version V2.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
@ApiModel("地址信息")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "address")
public class Address {
@ApiModelProperty("省份")
@NotEmpty(message = "省份不能为空")
private String province;
@ApiModelProperty("城市")
private String city;
@ApiModelProperty("区域")
private String area;
@XmlElementWrapper(name = "streets")
@XmlElement(name = "street")
private List<Street> streets;
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public List<Street> getStreets() {
return streets;
}
public void setStreets(List<Street> streets) {
this.streets = streets;
}
public String toString()
{
return ToStringBuilder.reflectionToString(this);
}
}
package cn.com.glsx.clue.request.example;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
import javax.validation.Valid;
import org.apache.commons.lang.builder.ToStringBuilder;
import com.rop.AbstractRopRequest;
/**
* @Title: ExampleComplexRequest.java
* @Description: 复杂参数示例请求
* @author Alvin
* @date 2020年11月12日 下午2:06:55
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class ExampleComplexRequest extends AbstractRopRequest{
@ApiModelProperty("姓名")
private String name;
@ApiModelProperty("年龄")
private Integer age;
@ApiModelProperty("兴趣爱好")
private List<String> hobby;
@ApiModelProperty("家庭住址")
@Valid
private Address address;
@ApiModelProperty("工作经历")
@Valid
private List<WorkExperience> workExperiences;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public List<String> getHobby() {
return hobby;
}
public void setHobby(List<String> hobby) {
this.hobby = hobby;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public List<WorkExperience> getWorkExperiences() {
return workExperiences;
}
public void setWorkExperiences(List<WorkExperience> workExperiences) {
this.workExperiences = workExperiences;
}
public String toString()
{
return ToStringBuilder.reflectionToString(this);
}
}
package cn.com.glsx.clue.request.example;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang.builder.ToStringBuilder;
import com.rop.AbstractRopRequest;
/**
* 例子参数实体类
*
* @author alvin.zengqi
* @version [版本号, 2019-09-02]
* @see [相关类/方法]
* @since [产品/模块版本]
*/
public class ExampleRequest extends AbstractRopRequest
{
@ApiModelProperty("姓名")
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/**
* 得到属性字符串
* @return String 属性字符串
*/
public String toString()
{
return ToStringBuilder.reflectionToString(this);
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.clue.request.example;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang.builder.ToStringBuilder;
import com.rop.AbstractRopRequest;
/**
* @Title: LoginRequest.java
* @Description: 登录请求参数示例
* @author Alvin
* @date 2019年9月22日 下午3:47:04
* @version V2.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class LoginRequest extends AbstractRopRequest {
/**
* 用户名
*/
@ApiModelProperty(notes = "账号", required = true)
@NotNull
private String userName;
/**
* 密码
*/
@ApiModelProperty(notes = "密码", required = true)
@NotNull
private String password;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String toString()
{
return ToStringBuilder.reflectionToString(this);
}
}
package cn.com.glsx.clue.request.example;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.commons.lang.builder.ToStringBuilder;
/**
* @Title: Street.java
* @Description: 街道信息参数示例
* @author Alvin
* @date 2020年11月12日 下午3:08:28
* @version V2.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "street")
public class Street {
@XmlAttribute
private String no;
@XmlAttribute
private String name;
public String getNo() {
return no;
}
public void setNo(String no) {
this.no = no;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String toString()
{
return ToStringBuilder.reflectionToString(this);
}
}
package cn.com.glsx.clue.request.example;
import io.swagger.annotations.ApiModelProperty;
import com.rop.AbstractRopRequest;
import com.rop.request.UploadFile;
/**
* @Title: UploadFileRequest.java
* @Description: 上传文件请求参数示例
* @author Alvin
* @date 2020年11月11日 下午2:55:22
* @version V2.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class UploadFileRequest extends AbstractRopRequest {
@ApiModelProperty("上传文件")
private UploadFile file;
public UploadFile getFile() {
return file;
}
public void setFile(UploadFile file) {
this.file = file;
}
}
package cn.com.glsx.clue.request.example;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Title: WorkExperience.java
* @Description: 工作经历请求参数示例
* @author Alvin
* @date 2020年11月12日 下午3:09:00
* @version V2.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
@ApiModel("工作经历")
public class WorkExperience {
@ApiModelProperty("公司名")
private String company;
@ApiModelProperty("公司地址")
@Valid
private Address address;
@ApiModelProperty("开始时间")
@NotNull
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@ApiModelProperty("截止时间")
@NotNull
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public String toString()
{
return ToStringBuilder.reflectionToString(this);
}
}
package cn.com.glsx.clue.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang.builder.ToStringBuilder;
/**
* ExampleResponse
* @author alvin.zengqi
* @version [版本号, 2019-09-02]
* @see [相关类/方法]
* @since [产品/模块版本]
*/
@ApiModel(description = "响应值示例")
public class ExampleResponse
{
@ApiModelProperty(name = "field1", notes = "字段1", dataType = "string", required = true, example = "aaaaa")
private String field1 = "1";
@ApiModelProperty(name = "field2", notes = "字段2", dataType = "string", required = true, example = "bbbbb", value = "字段2")
private String field2 = "2";
public void setField1(String field1) {
this.field1 = field1;
}
public String getField2() {
return field2;
}
public void setField2(String field2) {
this.field2 = field2;
}
/**
* 得到属性字符串
*
* @return String 属性字符串
*/
public String toString()
{
return ToStringBuilder.reflectionToString(this);
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.clue.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang.builder.ToStringBuilder;
/**
* @Title: LoginResponse.java
* @Description:
* @author Alvin
* @date 2019年9月22日 下午3:48:18
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2018
*/
@ApiModel(description = "响应值示例")
public class LoginResponse {
/**
* 会话ID
*/
@ApiModelProperty(name = "sessionId", notes = "会话ID", dataType = "string", required = true, example = "asdfasdf23423432432")
private String sessionId;
public String getSessionId() {
return sessionId;
}
public void setSessionId(String sessionId) {
this.sessionId = sessionId;
}
public String toString()
{
return ToStringBuilder.reflectionToString(this);
}
}
package cn.com.glsx.clue.response;
import io.swagger.annotations.ApiModelProperty;
/**
* @Title: UploadFileResponse.java
* @Description: 上传文件响应结果
* @author Alvin
* @date 2020年11月11日 下午2:55:51
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class UploadFileResponse {
@ApiModelProperty("文件存储路径")
private String filePath;
@ApiModelProperty("文件访问链接")
private String fileUrl;
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
}
package cn.com.glsx.clue.response.collision;
import cn.com.glsx.scrm.clue.dto.collision.CollisionAddressDTO;
import cn.com.glsx.scrm.clue.enums.collision.DeviceTypeEnum;
import cn.com.glsx.scrm.clue.model.response.collision.CollisionMediaDetail;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 碰撞详情信息查询返回
*/
@Data
public class CollisionDetailInfoRopResponse implements Serializable {
@ApiModelProperty(notes = "id",name = "id")
private Integer id;
/**
* 设备号
*/
@ApiModelProperty(notes = "设备号",name = "sn")
private String sn;
/**
* 商户号
*/
@ApiModelProperty(notes = "商户号",name = "merchantId")
private Integer merchantId;
/**
* 商户名称
*/
@ApiModelProperty(notes = "商户名称",name = "merchantName")
private String merchantName;
/**
* 设备类型,1:OBD
,2: DVD,
3: 电子狗
,5 :TBOX(2G),
6 行车记录仪
,7 :BBOX
,8: 追踪器
,9 :车载wifi
,12134 : 智能云镜
, 12499: AIBox
,12500: 小镜SOS记录仪,
12501 : 智能定位车充
,12503: 数字车钥匙
,12514 :后视镜B300
*/
/**
* @see DeviceTypeEnum
*/
@ApiModelProperty(notes = "设备类型,1:OBD\n" +
",2: DVD,\n" +
"3: 电子狗\n" +
",5 :TBOX(2G),\n" +
"6 行车记录仪\n" +
",7 :BBOX\n" +
",8: 追踪器\n" +
",9 :车载wifi\n" +
",12134 : 智能云镜\n" +
", 12499: AIBox\n" +
",12500: 小镜SOS记录仪,\n" +
"12501 : 智能定位车充\n" +
",12503: 数字车钥匙\n" +
",12514 :后视镜B300",name = "snType")
private Integer snType;
/**
* 客户名称
*/
@ApiModelProperty(notes = "客户名称",name = "customerName")
private String customerName;
/**
* 客户手机号
*/
@ApiModelProperty(notes = "客户手机号",name = "customerPhone")
private String customerPhone;
/**
* 车牌号
*/
@ApiModelProperty(notes = "车牌号",name = "licensePlate")
private String licensePlate;
@ApiModelProperty(notes = "车型",name = "vehicleShapeName")
private String vehicleShapeName;
/**
* 车架号
*/
@ApiModelProperty(notes = "车架号",name = "standNo")
private String standNo;
@ApiModelProperty(notes = "子品牌名称",name = "vehicleSubBrandName")
private String vehicleSubBrandName;
@ApiModelProperty(notes = "车系名称",name = "vehicleSeriesName")
private String vehicleSeriesName;
/**
* 碰撞时间
*/
@ApiModelProperty(notes = "碰撞时间",name = "collisionTime")
private Date collisionTime;
@ApiModelProperty(notes = "经度",name = "longitude")
private String longitude;
@ApiModelProperty(notes = "纬度",name = "latitude")
private String latitude;
/**
* 碰撞地点
*/
@ApiModelProperty(notes = "碰撞地点",name = "address")
private String address;
@ApiModelProperty(notes = "回访状态,0-未回访,1-已回访",name = "followStatus")
private Integer followStatus;
/**
* 跟进结果,0-真实事故,1-非真实事故,2-无法处理
*/
@ApiModelProperty(notes = "跟进结果,0-真实事故,1-非真实事故,2-无法处理",name = "followResult")
private Integer followResult;
/**
* 回访时间
*/
@ApiModelProperty(notes = "回访时间",name = "followTime")
private Date followTime;
@ApiModelProperty(notes = "回访备注",name = "followRemark")
private String followRemark;
@ApiModelProperty(notes = "回访人员",name = "updatedBy")
private String updatedBy;
@ApiModelProperty(notes = "媒体信息列表",name = "mediaDetailList")
private List<CollisionMediaDetail> mediaDetailList;
@ApiModelProperty(notes = "碰撞时间是否超过3分钟,0-否,1-是",name = "collisionTimeOutFlag")
private int collisionTimeOutFlag;
@ApiModelProperty(notes = "车辆行车轨迹列表",name = "carAddressList")
List<CollisionAddressDTO> carAddressList;
}
package cn.com.glsx.clue.response.collision;
import cn.com.glsx.scrm.clue.enums.collision.DeviceTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 碰撞信息查询返回
*/
@Data
public class CollisionInfoRopResponse implements Serializable {
@ApiModelProperty(notes = "id",name = "id")
private Integer id;
/**
* 设备号
*/
@ApiModelProperty(notes = "设备号",name = "sn")
private String sn;
/**
* 商户号
*/
@ApiModelProperty(notes = "商户号",name = "merchantId")
private Integer merchantId;
/**
* 商户名称
*/
@ApiModelProperty(notes = "商户名称",name = "merchantName")
private String merchantName;
/**
* 设备类型,1:OBD
,2: DVD,
3: 电子狗
,5 :TBOX(2G),
6 行车记录仪
,7 :BBOX
,8: 追踪器
,9 :车载wifi
,12134 : 智能云镜
, 12499: AIBox
,12500: 小镜SOS记录仪,
12501 : 智能定位车充
,12503: 数字车钥匙
,12514 :后视镜B300
*/
/**
* @see DeviceTypeEnum
*/
@ApiModelProperty(notes = "设备类型,1:OBD\n" +
",2: DVD,\n" +
"3: 电子狗\n" +
",5 :TBOX(2G),\n" +
"6 行车记录仪\n" +
",7 :BBOX\n" +
",8: 追踪器\n" +
",9 :车载wifi\n" +
",12134 : 智能云镜\n" +
", 12499: AIBox\n" +
",12500: 小镜SOS记录仪,\n" +
"12501 : 智能定位车充\n" +
",12503: 数字车钥匙\n" +
",12514 :后视镜B300",name = "snType")
private Integer snType;
/**
* 客户名称
*/
@ApiModelProperty(notes = "客户名称",name = "customerName")
private String customerName;
/**
* 客户手机号
*/
@ApiModelProperty(notes = "客户手机号",name = "customerPhone")
private String customerPhone;
/**
* 车牌号
*/
@ApiModelProperty(notes = "车牌号",name = "licensePlate")
private String licensePlate;
/**
* 车架号
*/
@ApiModelProperty(notes = "车架号",name = "standNo")
private String standNo;
@ApiModelProperty(notes = "车型",name = "vehicleShapeName")
private String vehicleShapeName;
/**
* 碰撞时间
*/
@ApiModelProperty(notes = "碰撞时间",name = "collisionTime")
private Date collisionTime;
/**
* 碰撞地点
*/
@ApiModelProperty(notes = "碰撞地点",name = "address")
private String address;
@ApiModelProperty(notes = "回访状态,0-未回访,1-已回访",name = "followStatus")
private Integer followStatus;
/**
* 跟进结果,0-真实事故,1-非真实事故,2-无法处理
*/
@ApiModelProperty(notes = "跟进结果,0-真实事故,1-非真实事故,2-无法处理",name = "followResult")
private Integer followResult;
/**
* 回访时间
*/
@ApiModelProperty(notes = "回访时间",name = "followTime")
private Date followTime;
@ApiModelProperty(notes = "回访人员",name = "updatedBy")
private String updatedBy;
@ApiModelProperty(notes = "回访备注",name = "followRemark")
private String followRemark;
}
package cn.com.glsx.clue.response.collision;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class CollisionPushConfigRopResponse implements Serializable {
private Integer id;
private Integer merchantId;
@ApiModelProperty(notes = "推送开关,0-关,1-开", name = "pushFlag")
private Integer pushFlag;
@ApiModelProperty(notes = "推送开始时间,格式:HH:mm", name = "startTime")
private String startTime;
@ApiModelProperty(notes = "推送结束时间, 格式:HH:mm", name = "endTime")
private String endTime;
@ApiModelProperty(notes = " 配置类型,0-门店提醒,1-车主提醒", name = "configType")
private Integer configType;
@ApiModelProperty(notes = "顾问电话,多个用逗号分割", name = "pushPhones")
private String pushPhones;
}
package cn.com.glsx.clue.response.collision;
import cn.com.glsx.scrm.clue.enums.collision.DeviceTypeEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.io.Serializable;
import java.util.Date;
@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class CollisionSnInfoRopResponse implements Serializable {
@ApiModelProperty(notes = "id")
private Integer id;
/**
* 设备号
*/
@ApiModelProperty(notes = "设备号")
private String sn;
/**
* 批次id
*/
@ApiModelProperty(notes = "批次id")
private Integer batchId;
/**
* 商户号
*/
@ApiModelProperty(notes = "商户号")
private Integer merchantId;
/**
* 商户名称
*/
@ApiModelProperty(notes = "商户名称")
private String merchantName;
/**
* 设备类型
* @see DeviceTypeEnum
*/
@ApiModelProperty(notes = "设备类型",example = "1:OBD\n" +
",2: DVD,\n" +
"3: 电子狗\n" +
",5 :TBOX(2G),\n" +
"6 行车记录仪\n" +
",7 :BBOX\n" +
",8: 追踪器\n" +
",9 :车载wifi\n" +
",12134 : 智能云镜\n" +
", 12499: AIBox\n" +
",12500: 小镜SOS记录仪,\n" +
"12501 : 智能定位车充\n" +
",12503: 数字车钥匙\n" +
",12514 :后视镜B300")
private Integer snType;
/**
* iccid
*/
@ApiModelProperty(notes = "iccid")
private String iccid;
/**
* 客户名称
*/
@ApiModelProperty(notes = "客户名称")
private String customerName;
/**
* 客户手机号
*/
@ApiModelProperty(notes = "客户手机号")
private String customerPhone;
/**
* 客户性别,0-男,1-女
*/
@ApiModelProperty(notes = "客户性别,0-男,1-女")
private Integer customerSex;
/**
* 车牌号
*/
@ApiModelProperty(notes = "车牌号")
private String licensePlate;
/**
* 车架号
*/
@ApiModelProperty(notes = "车架号")
private String standNo;
/**
* 设备安装时的初始里程
*/
@ApiModelProperty(notes = "设备安装时的初始里程")
private Long initialMileage;
/**
* 上次保养里程
*/
@ApiModelProperty(notes = "上次保养里程")
private Long lastMileage;
/**
* 上次保养时间
*/
@JsonFormat(pattern = "yyyy/MM/dd")
@ApiModelProperty(notes = "上次保养时间")
private Date lastTime;
/**
* 下次保养里程
*/
@ApiModelProperty(notes = "下次保养里程")
private Long lowerMileage;
/**
* 下次保养时间
*/
@JsonFormat(pattern = "yyyy/MM/dd")
@ApiModelProperty(notes = "下次保养时间")
private Date lowerTime;
/**
* 是否更换设备,0-保修更换-免费,1-维修更换,2-购买
* @see cn.com.glsx.scrm.clue.enums.collision.DeviceReplaceEnum
*/
@ApiModelProperty(notes = "是否更换设备,0-保修更换-免费,1-维修更换,2-购买")
private Integer replaceFlag;
/**
* 汽车品牌ID
*/
@ApiModelProperty(notes = "汽车品牌ID")
private Integer vehicleBrandId;
/**
* 汽车品牌
*/
@ApiModelProperty(notes = "汽车品牌")
private String vehicleBrandName;
/**
* 子品牌ID
*/
@ApiModelProperty(notes = "子品牌ID")
private Integer vehicleSubBrandId;
/**
* 子品牌名称
*/
@ApiModelProperty(notes = "子品牌名称")
private String vehicleSubBrandName;
/**
* 车系ID
*/
@ApiModelProperty(notes = "车系ID")
private Integer vehicleSeriesId;
/**
* 车系名称
*/
@ApiModelProperty(notes = "车系名称")
private String vehicleSeriesName;
/**
* 车型ID
*/
@ApiModelProperty(notes = "车型ID")
private Integer vehicleShapeId;
/**
* 车型名称
*/
@ApiModelProperty(notes = "车型名称")
private String vehicleShapeName;
/**
* 是否删除(0=正常,-1=删除)
*/
@ApiModelProperty(notes = "是否删除(0=正常,-1=删除)")
private Integer delFlag;
/**
* 创建人
*/
@ApiModelProperty(notes = "创建人")
private String createdBy;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy/MM/dd")
@ApiModelProperty(notes = "创建时间")
private Date createdTime;
/**
* 更新人
*/
@ApiModelProperty(notes = "更新人")
private String updatedBy;
/**
* 更新时间
*/
@JsonFormat(pattern = "yyyy/MM/dd")
@ApiModelProperty(notes = "更新时间")
private Date updatedTime;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.clue.response.collision;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 客户设备信息导入返回
*/
@Data
public class CustomerDeviceImportRopResponse implements Serializable {
@ApiModelProperty(notes = "校验标记,通过:true,不通过:false")
private Boolean checkFlag;
@ApiModelProperty(notes = "导入总数量")
private Integer count;
@ApiModelProperty(notes = "校验通过数量")
private Integer success;
@ApiModelProperty(notes = "校验不通过数量")
private Integer error;
@ApiModelProperty(notes = "校验不通过手机号excel表url地址")
private String errUrl;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.clue.response.collision;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class FollowInfoRopResponse implements Serializable {
@ApiModelProperty(notes = "碰撞线索id", name = "id")
private Integer id;
@ApiModelProperty(notes = "跟进结果,0-真实事故,1-非真实事故,2-无法处理", name = "followResult", required = true)
private Integer followResult;
@ApiModelProperty(notes = "跟进备注", name = "followRemark")
private String followRemark;
@ApiModelProperty(notes = "跟进时间", name = "followTime")
private Date followTime;
}
package cn.com.glsx.clue.util;/**
* @author zhouhaibao
* @date 2021/8/20
*/
import javax.servlet.http.HttpServletRequest;
/**
* @author zhouhaibao
* @version 1.0
* @description: TODO
* @date 2021/8/20 10:09
*/
public class IpUtils {
public static String getIpAddr(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("X-Forwarded-For");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("X-Real-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
if (ip != null) {
String[] ss = ip.split(",");
if (ss.length > 0) {
return ss[0];
}
}
return ip;
}
}
package cn.com.glsx.clue.util;
import cn.com.glsx.scrm.system.dto.LoginUserDTO;
import cn.com.glsx.scrm.system.model.UserInfoDO;
import cn.com.glsx.scrm.system.model.wechatapplets.LoginUserInfoResponse;
import org.oreframework.boot.autoconfigure.rop.util.RopThreadLocal;
/**
* @Description todo
* @Author yelq
* @Date 2023/10/24-16:30
* @Version 1.0
*/
public class LoginUserInfoUtils {
/**
* pc
* @return
*/
public static LoginUserDTO getLoginUser() {
return RopThreadLocal.getLoginUser(LoginUserDTO.class);
}
/**
* c 端
* @return
*/
public static UserInfoDO getUserInfo() {
return RopThreadLocal.getLoginUser(UserInfoDO.class);
}
/**
* b端小程序
* @return
*/
public static LoginUserInfoResponse getLoginUserInfoResponse() {
return RopThreadLocal.getLoginUser(LoginUserInfoResponse.class);
}
}
package cn.com.glsx.clue.util;
import lombok.Data;
import java.util.List;
/**
* 分页对象
*/
@Data
public class Pagination<T> {
private Integer pageSize;
private Integer pageNum;
private Integer count;
private List<T> data;
}
# framework-archetype-rop
开放平台项目骨架
一、项目结构说明:
└─src
├─main
├─java
├─cn.com.glsx.clue.config 配置层
├─cn.com.glsx.clue.controller 控制层
├─cn.com.glsx.clue.converter 数据转换层
├─cn.com.glsx.clue.request 请求实体
├─cn.com.glsx.clue.response 响应实体
├─cn.com.glsx.clue.service 业务层
├─cn.com.glsx.clue.util 工具集
└─cn.com.glsx.clue.Main.java 程序入口
├─resources 资源文件目录
├─config
└─application.properties 应用配置文件
└─logback.xml 日志配置文件
└─webapp web前端文件目录
└─WEB-INF
└─bin shell脚本文件(包含启动、停止、重启等)
└─test 测试目录
├─java
└─cn.com.glsx.clue 测试代码
└─resources 测试资源目录
└─pom.xml pom文件
二、使用说明:
1、运行项目前需在配置中心创建配置信息,配置内容参考三配置说明:
1.1> dataId : application.properties --> ore.diamond.dataId + ore.diamond.env
1.2> group : application.properties --> ore.diamond.group
1.3> content : 参考三配置说明
2、响应值日期格式化:
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.oreframework.util.json.JsonDateTimeFormat;
import org.oreframework.util.json.JsonDateFormat;
Date属性上添加注解 :
2.1> @JsonSerialize(using = JsonDateFormat.class),日期格式:yyyy-MM-dd
2.2> @JsonSerialize(using = JsonDateTimeFormat.class),日期格式:yyyy-MM-dd HH:mm:ss
2.3> @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8"),日期格式灵活配置【推荐】
三、配置说明:
#----------------------------------------------------------------------------------------------------------
# dubbo配置(调用dubbo服务需配置)
# dubbo应用名称
ore.dubbo.application.name=rop-scrm-clue
# dubbo应用所有者
ore.dubbo.application.owner=deployer name
# dubbo服务注册地址
ore.dubbo.registry.address=zookeeper://192.168.3.206:2181
# dubbo服务注册超时时间
ore.dubbo.registry.timeout=30000
# 默认协议:dubbo
ore.dubbo.protocol.name=dubbo
# dubbo服务扫描包路径
ore.dubbo.scan=cn.com.glsx.clue
# dubbo服务监控
ore.dubbo.monitor.protocol=registry
# dubbo服务统计
ore.dubbo.consumer.filter=metrics
#----------------------------------------------------------------------------------------------------------
# rop 注解驱动配置
ore.rop.annotation-driven.thread-ferry-class=
ore.rop.annotation-driven.sign-enable=true
ore.rop.annotation-driven.ext-error-base-name=i18n/rop/sampleRopError
ore.rop.annotation-driven.core-pool-size=200
ore.rop.annotation-driven.max-pool-size=500
ore.rop.annotation-driven.keep-alive-seconds=300
ore.rop.annotation-driven.queue-capacity=50
ore.rop.annotation-driven.service-timeout-seconds=120
# 文件上传大小限制
ore.rop.annotation-driven.upload-file-max-size=9999999
# 文件上传支持的文件格式
ore.rop.annotation-driven.upload-file-types=png,gif,jpg
ore.rop.annotation-driven.formatting-conversion-service=
# 默认本地Map缓存会话,只支持单节点
ore.rop.annotation-driven.session-manager=
# 配置为ropSessionManager,则采用Redis缓存会话,支持集群(另外需要增加redis配置)
#ore.rop.annotation-driven.session-manager=ropSessionManager
ore.rop.annotation-driven.app-secret-manager=
ore.rop.annotation-driven.service-access-controller=
ore.rop.annotation-driven.invoke-times-controller=
# rop 系统参数配置
ore.rop.sysparams.appkey-param-name=appKey
ore.rop.sysparams.sessionid-param-name=sessionId
ore.rop.sysparams.method-param-name=method
ore.rop.sysparams.version-param-name=v
ore.rop.sysparams.format-param-name=format
ore.rop.sysparams.locale-param-name=locale
ore.rop.sysparams.sign-param-name=sign
ore.rop.sysparams.jsonp-param-name=jsonp
# 会话过期时间,默认1800秒
#rop.session.timeout=1800
# 开启跨域
ore.adapter.cross-domain=true
# 允许跨域域名,多个以英文逗号分隔
ore.adapter.allowed-origins=http://ip:port
# rop 秘钥对(appKey=secret)
48e5e13229b82c1b4e6e8c96151f0637=c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b
#----------------------------------------------------------------------------------------------------------
# CAS服务器地址
ore.rop.cas.server-url=http://cas.dev.glsx.net/cas
┌------------------------------------------------------------┐
使用说明:
1、前端调用rop接口需要在请求头Header中传递TGT参数(TGT为cas登陆后返回的ticketId)
2、rop接口中获取运营平台登陆用户信息:RopThreadLocal.getUser();
└------------------------------------------------------------┘
#----------------------------------------------------------------------------------------------------------
# redis缓存
ore.redis.hostName=192.168.0.100
ore.redis.port=6379
ore.redis.password=
ore.redis.pool.maxActive=600
ore.redis.pool.maxWait=10000
ore.redis.pool.maxTotal=300
ore.redis.pool.maxIdle=300
ore.redis.pool.minIdle=0
ore.redis.timeout=30000
# 逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认-1
ore.redis.betweenEvictionRunsMillis=30000
#----------------------------------------------------------------------------------------------------------
# rop swagger配置
# 是否启用swagger-rop,默认为true(生产环境不开启)
swagger.rop.enable=true
# rop 接口 appKey,默认48e5e13229b82c1b4e6e8c96151f0637
swagger.rop.appKey=48e5e13229b82c1b4e6e8c96151f0637
# rop 接口 secret,默认c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b
swagger.rop.secret=c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b
┌------------------------------------------------------------┐
使用说明:
1、接口方法上添加Swagger注解@ApiOperation(value = "查询**", notes = "根据**查询**", httpMethod="GET")[非必须]
2、接口参数属性添加Swagger注解@ApiModelProperty(value = "参数名称", required=true)[非必须]
└------------------------------------------------------------┘
# rop swagger api访问地址(v2版本界面)
http://localhost:rop server port/rop-scrm-clue/swagger-ui/v2/index.html
# rop swagger api访问地址(v3版本界面)
http://localhost:rop server port/rop-scrm-clue/swagger-ui/v3/index.html
#----------------------------------------------------------------------------------------------------------
# 分布式文件系统FastDFS配置
# tracker服务地址列表(格式ip1:host1,ip2:host2......)
ore.fastdfs.tracker-servers=common.fdfs.glsx.com:22122
# 文件访问域名
ore.fastdfs.server-url=http://qcimg01.glsx.net:7060/
┌------------------------------------------------------------┐
使用说明:
1、在pom中添加如下依赖
<dependency>
<groupId>org.oreframework.boot</groupId>
<artifactId>ore-boot-starter-fastdfs</artifactId>
</dependency>
2、注入调用客户端
@Autowired
private DefaultFastDFSClient fastDFSClient;
3、调用上传
String fastDFSClient.uploadFile(byte[] fileContent, String extName)
└------------------------------------------------------------┘
\ No newline at end of file \ No newline at end of file
server.port=8080
server.display-name=rop-scrm-clue
server.servlet.context-path=/rop-scrm-clue
server.servlet.application-display-name=rop-scrm-clue
logging.config=classpath:logback.xml
logging.path=/data/java_log/jetty/rop-scrm-clue/rop-scrm-clue.log
logging.level.root=INFO
ore.starter.class-name=Main
# diamond config
ore.diamond.group=scrm
ore.diamond.dataId=rop-scrm-clue
ore.diamond.env=test
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<property resource="config/application.properties" />
<property name="APP_NAME" value="${server.display-name}" />
<property name="LOG_PATH" value="${logging.path}" />
<property name="LOG_LEVEL" value="${logging.level}" />
<contextName>${APP_NAME}</contextName>
<turboFilter class="org.oreframework.boot.logging.logback.OreBootTurboFilter">
<Marker>oreframework</Marker>
</turboFilter>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="org.oreframework.commons.log.OrePatternLayout">
<pattern>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [${APP_NAME}] [%traceid] [%thread] %-5level [%logger{36}.%method %line] - %msg%n</pattern>
</pattern>
</layout>
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- <Encoding> Label Old version of this label can not be used -->
<!-- <Encoding>UTF-8</Encoding> -->
<File>${LOG_PATH}</File>
<!-- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<FileNamePattern>${LOG_PATH}.%d{yyyy-MM-dd}.%i</FileNamePattern>
<MaxHistory>15</MaxHistory>
<maxFileSize>200MB</maxFileSize>
</rollingPolicy>
<layout class="org.oreframework.commons.log.OrePatternLayout">
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [${APP_NAME}] [%traceid] [%thread] %-5level [%logger{36}.%method %line] - %msg%n</pattern>
</layout>
<!-- 根据文件大小滚动,不支持 SizeBasedTriggeringPolicy 这种配置-->
<!-- <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>200MB</MaxFileSize>
</triggeringPolicy> -->
</appender>
<root level="${LOG_LEVEL}">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
</configuration>
\ No newline at end of file \ No newline at end of file
#!/bin/bash
cd `dirname $0`
BIN_DIR=`pwd`
cd ..
DEPLOY_DIR=`pwd`
CONF_DIR=$DEPLOY_DIR/classes
SERVER_NAME=`sed '/application.name/!d;s/.*=//' classes/config/application.properties | tr -d '\r'`
#LOGS_FILE=`sed '/log4j.appender.logToFile.File/!d;s/.*=//' classes/log4j.properties | tr -d '\r'`
LOGS_FILE=`sed '/name="LOG_PATH"/!d;s/.*value="\(.*\)".*/\1/g' classes/logback.xml`
if [ -z "$SERVER_NAME" ]; then
SERVER_NAME=`hostname`
fi
PIDS=`ps --no-heading -C java -f --width 1000 | grep "$CONF_DIR" |awk '{print $2}'`
if [ -z "$PIDS" ]; then
echo "ERROR: The $SERVER_NAME does not started!"
exit 1
fi
LOGS_DIR=""
if [ -n "$LOGS_FILE" ]; then
LOGS_DIR=`dirname $LOGS_FILE`
else
LOGS_DIR=$DEPLOY_DIR/logs
fi
if [ ! -d $LOGS_DIR ]; then
mkdir $LOGS_DIR
fi
DUMP_DIR=$LOGS_DIR/dump
if [ ! -d $DUMP_DIR ]; then
mkdir $DUMP_DIR
fi
DUMP_DATE=`date +%Y%m%d%H%M%S`
DATE_DIR=$DUMP_DIR/$DUMP_DATE
if [ ! -d $DATE_DIR ]; then
mkdir $DATE_DIR
fi
echo -e "Dumping the $SERVER_NAME ...\c"
for PID in $PIDS ; do
jstack $PID > $DATE_DIR/jstack-$PID.dump 2>&1
echo -e ".\c"
jinfo $PID > $DATE_DIR/jinfo-$PID.dump 2>&1
echo -e ".\c"
jstat -gcutil $PID > $DATE_DIR/jstat-gcutil-$PID.dump 2>&1
echo -e ".\c"
jstat -gccapacity $PID > $DATE_DIR/jstat-gccapacity-$PID.dump 2>&1
echo -e ".\c"
jmap $PID > $DATE_DIR/jmap-$PID.dump 2>&1
echo -e ".\c"
jmap -heap $PID > $DATE_DIR/jmap-heap-$PID.dump 2>&1
echo -e ".\c"
jmap -histo $PID > $DATE_DIR/jmap-histo-$PID.dump 2>&1
echo -e ".\c"
if [ -r /usr/sbin/lsof ]; then
/usr/sbin/lsof -p $PID > $DATE_DIR/lsof-$PID.dump
echo -e ".\c"
fi
done
if [ -r /bin/netstat ]; then
/bin/netstat -an > $DATE_DIR/netstat.dump 2>&1
echo -e ".\c"
fi
if [ -r /usr/bin/iostat ]; then
/usr/bin/iostat > $DATE_DIR/iostat.dump 2>&1
echo -e ".\c"
fi
if [ -r /usr/bin/mpstat ]; then
/usr/bin/mpstat > $DATE_DIR/mpstat.dump 2>&1
echo -e ".\c"
fi
if [ -r /usr/bin/vmstat ]; then
/usr/bin/vmstat > $DATE_DIR/vmstat.dump 2>&1
echo -e ".\c"
fi
if [ -r /usr/bin/free ]; then
/usr/bin/free -t > $DATE_DIR/free.dump 2>&1
echo -e ".\c"
fi
if [ -r /usr/bin/sar ]; then
/usr/bin/sar > $DATE_DIR/sar.dump 2>&1
echo -e ".\c"
fi
if [ -r /usr/bin/uptime ]; then
/usr/bin/uptime > $DATE_DIR/uptime.dump 2>&1
echo -e ".\c"
fi
echo "OK!"
echo "DUMP: $DATE_DIR"
#!/bin/bash
ENV=$1
if [ -z "$ENV" ]; then
echo "ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo "app exit"
exit 1
fi
cd `dirname $0`
./stop.sh
./start.sh $ENV
\ No newline at end of file \ No newline at end of file
#!/bin/bash
cd `dirname $0`
if [ "$1" = "start" ]; then
ENV=$2
if [ -z "$ENV" ]; then
echo "ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo "app exit"
exit 1
fi
./start.sh $ENV
else
if [ "$1" = "stop" ]; then
./stop.sh
else
if [ "$1" = "debug" ]; then
ENV=$2
if [ -z "$ENV" ]; then
echo "ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo "app exit"
exit 1
fi
./start.sh $ENV debug
else
if [ "$1" = "restart" ]; then
ENV=$2
if [ -z "$ENV" ]; then
echo "ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo "app exit"
exit 1
fi
./restart.sh $ENV
else
if [ "$1" = "dump" ]; then
./dump.sh
else
echo "ERROR: Please input argument: start or stop or debug or restart or dump"
exit 1
fi
fi
fi
fi
fi
#!/bin/bash
JAVA_HOME="/app/soft/jdk1.8.0_20"
ENV=$1
if [ -z "$ENV" ]; then
echo "ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo "app exit"
exit 1
fi
cd `dirname $0`
BIN_DIR=`pwd`
cd ..
DEPLOY_DIR=`pwd`
CONF_DIR=$DEPLOY_DIR/classes
SERVER_NAME=`sed '/server.display-name/!d;s/.*=//' classes/config/application.properties | tr -d '\r'`
SERVER_PORT=`sed '/server.port/!d;s/.*=//' classes/config/application.properties | tr -d '\r'`
LOGS_FILE=`sed '/logging.path/!d;s/.*=//' classes/config/application.properties | tr -d '\r'`
if [ -z "$SERVER_NAME" ]; then
SERVER_NAME=`hostname`
fi
echo "server name is $SERVER_NAME"
echo "server port is $SERVER_PORT"
PIDS=`ps --no-heading -C java -f --width 1000 | grep "$CONF_DIR" |awk '{print $2}'`
if [ -n "$PIDS" ]; then
echo "ERROR: The $SERVER_NAME already started!"
echo "PID: $PIDS"
exit 1
fi
if [ -n "$SERVER_PORT" ]; then
SERVER_PORT_COUNT=`netstat -tln | grep $SERVER_PORT | wc -l`
if [ $SERVER_PORT_COUNT -gt 0 ]; then
echo "ERROR: The $SERVER_NAME port $SERVER_PORT already used!"
exit 1
fi
fi
LOGS_DIR=""
if [ -n "$LOGS_FILE" ]; then
LOGS_DIR=`dirname $LOGS_FILE`
else
LOGS_DIR=$DEPLOY_DIR/logs
fi
if [ ! -d $LOGS_DIR ]; then
mkdir $LOGS_DIR
fi
STDOUT_FILE=$LOGS_DIR/stdout.log
LIB_DIR=$DEPLOY_DIR/lib
LIB_JARS=`ls $LIB_DIR|grep .jar|awk '{print "'$LIB_DIR'/"$0}'|tr "\n" ":"`
JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true "
JAVA_DEBUG_OPTS=""
if [ "$2" = "debug" ]; then
JAVA_DEBUG_OPTS=" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n "
fi
JAVA_JMX_OPTS=""
if [ "$2" = "jmx" ]; then
JAVA_JMX_OPTS=" -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "
fi
JAVA_MEM_OPTS=""
BITS=`file $JAVA_HOME/bin/java | grep 64-bit`
if [ -n "$BITS" ]; then
JAVA_MEM_OPTS=" -server -Xmx1g -Xms1g -Xmn256m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
else
JAVA_MEM_OPTS=" -server -Xms1024m -Xmx1024m -XX:PermSize=128m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
fi
echo -e "Starting the $SERVER_NAME ...\c"
nohup $JAVA_HOME/bin/java $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS -classpath $CONF_DIR:$LIB_JARS org.oreframework.boot.bootstrap.OreBootApplication env=$ENV > $STDOUT_FILE 2>&1 &
COUNT=0
while [ $COUNT -lt 1 ]; do
echo -e ".\c"
sleep 1
if [ -n "$SERVER_PORT" ]; then
COUNT=`netstat -an | grep $SERVER_PORT | wc -l`
else
COUNT=`ps --no-heading -C java -f --width 1000 | grep "$DEPLOY_DIR" | awk '{print $2}' | wc -l`
fi
if [ $COUNT -gt 0 ]; then
break
fi
done
echo "OK!"
PIDS=`ps --no-heading -C java -f --width 1000 | grep "$DEPLOY_DIR" | awk '{print $2}'`
echo "PID: $PIDS"
echo "STDOUT: $STDOUT_FILE"
#!/bin/bash
cd `dirname $0`
BIN_DIR=`pwd`
cd ..
DEPLOY_DIR=`pwd`
CONF_DIR=$DEPLOY_DIR/classes
SERVER_NAME=`sed '/application.name/!d;s/.*=//' classes/config/application.properties | tr -d '\r'`
if [ -z "$SERVER_NAME" ]; then
SERVER_NAME=`hostname`
fi
PIDS=`ps --no-heading -C java -f --width 1000 | grep "$CONF_DIR" |awk '{print $2}'`
if [ -z "$PIDS" ]; then
echo "ERROR: The $SERVER_NAME does not started!"
exit 1
fi
#if [ "$1" != "skip" ]; then
#$BIN_DIR/dump.sh
#fi
echo -e "Stopping the $SERVER_NAME ...\c"
for PID in $PIDS ; do
kill $PID > /dev/null 2>&1
done
COUNT=0
while [ $COUNT -lt 1 ]; do
echo -e ".\c"
sleep 1
COUNT=1
for PID in $PIDS ; do
PID_EXIST=`ps --no-heading -p $PID`
if [ -n "$PID_EXIST" ]; then
COUNT=0
break
fi
done
done
echo "OK!"
echo "PID: $PIDS"
package cn.com.glsx.clue;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
/**
* @Title: IpConfiguration.java
* @Description:
* @author Alvin
* @date 2019年9月3日 上午11:05:17
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2018
*/
@Component
public class IpConfiguration implements ApplicationListener<WebServerInitializedEvent> {
private int serverPort;
@Override
public void onApplicationEvent(WebServerInitializedEvent event) {
serverPort = event.getWebServer().getPort();
}
public int getPort(){
return serverPort;
}
}
package cn.com.glsx.clue.controller;
import java.net.URI;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang.StringUtils;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.DefaultUriBuilderFactory;
import org.springframework.web.util.UriBuilder;
import cn.com.glsx.clue.IpConfiguration;
import com.rop.utils.RopUtils;
/**
* @Title: BaseControllerTest.java
* @Description:
* @author Alvin
* @date 2019年9月3日 上午9:32:12
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2018
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class BaseControllerTest{
String url = "http://localhost:";
@Value("${server.servlet.context-path}")
String contextPath;
@Autowired
private IpConfiguration ip;
final String appKey = "48e5e13229b82c1b4e6e8c96151f0637";
final String secret = "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b";
@Before
public void setUp() {
url = url.concat(String.valueOf(ip.getPort())).concat(contextPath).concat("/router");
}
public String get(MultiValueMap<String, String> paramsMap) throws Exception{
return get(paramsMap, String.class);
}
public <T> T get(MultiValueMap<String, String> paramsMap, Class<T> responseType) throws Exception{
MultiValueMap<String, String> params = getSysParams();
params.putAll(paramsMap);
for(Entry<String, String> entry:params.toSingleValueMap().entrySet()){
if(StringUtils.isEmpty(entry.getValue())){
params.remove(entry.getKey());
}
}
String sign = RopUtils.sign(params.toSingleValueMap(), secret);
params.add("sign", sign);
RestTemplate rest = new RestTemplate();
RopUriTemplateHandler uriTemplateHandler = new RopUriTemplateHandler(url);
uriTemplateHandler.setDefaultUriVariables(params.toSingleValueMap());
rest.setUriTemplateHandler(uriTemplateHandler);
return rest.getForObject(url, responseType, params.toSingleValueMap());
}
public String post(MultiValueMap<String, String> paramsMap) throws Exception{
return post(paramsMap, String.class);
}
public <T> T post(MultiValueMap<String, String> paramsMap, Class<T> responseType) throws Exception{
MultiValueMap<String, String> params = getSysParams();
params.putAll(paramsMap);
for(Entry<String, String> entry:params.toSingleValueMap().entrySet()){
if(StringUtils.isEmpty(entry.getValue())){
params.remove(entry.getKey());
}
}
String sign = RopUtils.sign(params.toSingleValueMap(), secret);
params.add("sign", sign);
return new RestTemplate().postForObject(url, params, responseType);
}
public String upload(MultiValueMap<String, String> paramsMap, MultiValueMap<String, String> fileParamsMap) throws Exception{
return upload(paramsMap, fileParamsMap, String.class);
}
public <T> T upload(MultiValueMap<String, String> paramsMap, MultiValueMap<String, String> fileParamsMap, Class<T> responseType) throws Exception{
MultiValueMap<String, String> params = getSysParams();
params.putAll(paramsMap);
for(Entry<String, String> entry:params.toSingleValueMap().entrySet()){
if(StringUtils.isEmpty(entry.getValue())){
params.remove(entry.getKey());
}
}
String sign = RopUtils.sign(params.toSingleValueMap(), secret);
params.add("sign", sign);
params.putAll(fileParamsMap);
return new RestTemplate().postForObject(url, params, responseType);
}
public MultiValueMap<String, String> getSysParams(){
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(16);
params.add("appKey", appKey);
params.add("format", "json");
params.add("locale", "zh_CN");
return params;
}
class RopUriTemplateHandler extends DefaultUriBuilderFactory{
public RopUriTemplateHandler(String baseUriTemplate) {
super(baseUriTemplate);
}
@Override
public URI expand(String uriTemplate, Map<String, ?> uriVars) {
UriBuilder builder = uriString(uriTemplate);
if(uriVars != null && !uriVars.isEmpty()){
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
for(Entry<String, ?> entry:uriVars.entrySet()){
params.add(entry.getKey(), entry.getValue().toString());
}
builder.queryParams(params);
}
return builder.build(uriVars);
}
}
}
package cn.com.glsx.clue.controller;
import org.junit.Test;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
public class BurialPointRecordControllerTest extends BaseControllerTest {
@Test
public void testBatchInsert() throws Exception{
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(4);
params.add("v", "1.0.0");
params.add("method", "clue.api.burial.point.record.batch.insert");
params.add("sessionId", "scrm-base-f795ecc2-5efa-4d11-96fc-256190e40393-rop");
params.add("recordList[0].loginAccount", "xiaohu");
params.add("recordList[0].userType", "1");
params.add("recordList[0].uuid", "333333333323");
params.add("recordList[0].systemSource", "0");
params.add("recordList[0].eventTime", "2025-02-27 14:00:15");
params.add("recordList[0].eventType", "2");
params.add("recordList[0].pagePath", "/cjsl/sd");
params.add("recordList[0].eventCode", "staff_reception_search");
params.add("recordList[0].prePagePath", "/");
params.add("recordList[0].batchId", "9999923");
params.add("recordList[0].scene", "1");
System.out.println(get(params));
}
}
package cn.com.glsx.clue.controller;
import org.junit.Test;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
public class CollisionControllerTest extends BaseControllerTest{
@Test
public void testGetExample() throws Exception{
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(4);
params.add("v", "1.0.0");
params.add("method", "clue.api.collision.info.getDetail");
params.add("id", "1");
params.add("sessionId", "scrm-base-f795ecc2-5efa-4d11-96fc-256190e40393-rop");
System.out.println(get(params));
}
}
package cn.com.glsx.clue.controller;
import java.util.Base64;
import org.junit.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import com.rop.request.UploadFile;
/**
* @Title: ExampleControllerTest.java
* @Description:
* @author Alvin
* @date 2019年9月3日 上午9:33:00
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2018
*/
public class ExampleControllerTest extends BaseControllerTest {
@Test
public void testGetExample() throws Exception{
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(4);
params.add("v", "1.0.0");
params.add("method", "org.ore.api.example");
params.add("name", "alvin");
System.out.println(get(params));
}
@Test
public void testPostExample() throws Exception{
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(4);
params.add("v", "1.0.0");
params.add("method", "org.ore.api.example");
params.add("name", "alvin");
System.out.println(post(params));
}
@Test
public void testComplexRequest() throws Exception{
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(4);
params.add("v", "1.0.0");
params.add("method", "org.ore.api.example.complex");
params.add("name", "alvin");
params.add("age", "18");
params.add("hobby[0]", "编程");
params.add("hobby[1]", "打球");
params.add("address.province", "广东省");
params.add("address.city", "深圳市");
params.add("address.area", "南山区");
params.add("workExperiences[0].company", "深圳广联赛讯股份有限公司");
params.add("workExperiences[0].address.province", "广东省");
params.add("workExperiences[0].address.city", "深圳市");
params.add("workExperiences[0].address.streets[0].no", "3370号");
params.add("workExperiences[0].address.streets[0].name", "留仙大道");
params.add("workExperiences[0].startTime", "2010-11-11 00:00:00");
params.add("workExperiences[0].endTime", "2020-11-11 00:00:00");
System.out.println(post(params));
}
@Test
public void testUpload() throws Exception{
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(4);
params.add("v", "1.0.0");
params.add("method", "org.ore.api.example.upload");
ClassPathResource resource = new ClassPathResource("logo.png");
UploadFile uploadFile = new UploadFile(resource.getFile());
MultiValueMap<String, String> fileParams = new LinkedMultiValueMap<String, String>(4);
fileParams.add("file", "png@" + Base64.getEncoder().encodeToString(uploadFile.getContent()));
System.out.println(upload(params, fileParams));
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!