Commit 099c7950 authored by wujiang's avatar wujiang

删除多余业务代码

parent 25adc451

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
...@@ -36,23 +30,18 @@ ...@@ -36,23 +30,18 @@
<attribute name="m2e-apt" value="true"/> <attribute name="m2e-apt" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations"> <classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".apt_generated">
<attributes>
<attribute name="optional" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" output="target/test-classes" path=".apt_generated_tests"> <classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/> <attribute name="test" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
......
This diff is collapsed.
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
<factorypathentry kind="VARJAR" id="M2_REPO/io/springfox/springfox-bean-validators/2.10.5/springfox-bean-validators-2.10.5.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/io/springfox/springfox-bean-validators/2.10.5/springfox-bean-validators-2.10.5.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/springfox/springfox-spring-webmvc/2.10.5/springfox-spring-webmvc-2.10.5.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/io/springfox/springfox-spring-webmvc/2.10.5/springfox-spring-webmvc-2.10.5.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/xiaoymin/knife4j-spring-ui/2.0.7/knife4j-spring-ui-2.0.7.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/com/github/xiaoymin/knife4j-spring-ui/2.0.7/knife4j-spring-ui-2.0.7.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/yeejoin/amos-feign-systemctl/1.7.12-SNAPSHOT/amos-feign-systemctl-1.7.12-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/com/yeejoin/amos-feign-systemctl/1.7.10-SNAPSHOT/amos-feign-systemctl-1.7.10-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/typroject/tyboot-core-foundation/1.1.23-SNAPSHOT/tyboot-core-foundation-1.1.23-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/org/typroject/tyboot-core-foundation/1.1.23-SNAPSHOT/tyboot-core-foundation-1.1.23-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/belerweb/pinyin4j/2.5.0/pinyin4j-2.5.0.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/com/belerweb/pinyin4j/2.5.0/pinyin4j-2.5.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar" enabled="true" runInBatchMode="false"/>
...@@ -188,7 +188,7 @@ ...@@ -188,7 +188,7 @@
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-to-slf4j/2.13.3/log4j-to-slf4j-2.13.3.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-to-slf4j/2.13.3/log4j-to-slf4j-2.13.3.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-api/2.17.0/log4j-api-2.17.0.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-api/2.17.0/log4j-api-2.17.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/yeejoin/amos-component-feign/1.7.12-SNAPSHOT/amos-component-feign-1.7.12-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/com/yeejoin/amos-component-feign/1.7.10-SNAPSHOT/amos-component-feign-1.7.10-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/cloud/spring-cloud-starter-openfeign/2.2.5.RELEASE/spring-cloud-starter-openfeign-2.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/cloud/spring-cloud-starter-openfeign/2.2.5.RELEASE/spring-cloud-starter-openfeign-2.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/cloud/spring-cloud-openfeign-core/2.2.5.RELEASE/spring-cloud-openfeign-core-2.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/cloud/spring-cloud-openfeign-core/2.2.5.RELEASE/spring-cloud-openfeign-core-2.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/github/openfeign/form/feign-form-spring/3.8.0/feign-form-spring-3.8.0.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/io/github/openfeign/form/feign-form-spring/3.8.0/feign-form-spring-3.8.0.jar" enabled="true" runInBatchMode="false"/>
...@@ -212,5 +212,5 @@ ...@@ -212,5 +212,5 @@
<factorypathentry kind="VARJAR" id="M2_REPO/io/zipkin/reporter2/zipkin-reporter/2.15.0/zipkin-reporter-2.15.0.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/io/zipkin/reporter2/zipkin-reporter/2.15.0/zipkin-reporter-2.15.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/zipkin/zipkin2/zipkin/2.21.1/zipkin-2.21.1.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/io/zipkin/zipkin2/zipkin/2.21.1/zipkin-2.21.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/swagger/swagger-annotations/1.5.13/swagger-annotations-1.5.13.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/io/swagger/swagger-annotations/1.5.13/swagger-annotations-1.5.13.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/yeejoin/amos-feign-privilege/1.7.12-SNAPSHOT/amos-feign-privilege-1.7.12-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/> <factorypathentry kind="VARJAR" id="M2_REPO/com/yeejoin/amos-feign-privilege/1.7.10-SNAPSHOT/amos-feign-privilege-1.7.10-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
</factorypath> </factorypath>
This diff is collapsed.
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-data</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>amos-boot-data-accessapi</artifactId>
<name>amos-boot-data-accessapi</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-foundation</artifactId>
<version>${tyboot-version}</version>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-restful</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-auth</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-emq</artifactId>
<version>${tyboot-version}</version>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-event</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-opendata</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-systemctl</artifactId>
<version>${amos.version}</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-config</artifactId>
<version>${amos.version}</version>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-rdbms</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-cache</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
<version>1.4.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>19.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>1.3.7</version>
</dependency>
<dependency>
<groupId>fakepath</groupId>
<artifactId>license-sdk</artifactId>
<version>1.0.0</version>
</dependency>
<!-- druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- Vastbase G100 -->
<dependency>
<groupId>cn.com.vastdata</groupId>
<artifactId>vastbase</artifactId>
<version>1.0.0.1</version>
</dependency>
<!-- LOG4J -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-influxdb</artifactId>
<version>1.8.5-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.yeejoin.amos;
import java.net.InetAddress;
import com.yeejoin.amos.component.utils.ClassPathUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import com.yeejoin.amos.api.openapi.face.service.TaAccessConfigServiceImpl;
/**
*
* <pre>
*
* </pre>
*
* @author gwb
* @version $Id: OpenapiApplication.java, v 0.1 2021年9月27日 下午3:29:30 gwb Exp $
*/
@SpringBootApplication
@EnableTransactionManagement
@EnableConfigurationProperties
@ServletComponentScan
@EnableDiscoveryClient
@EnableFeignClients
@EnableAsync
@EnableEurekaClient
@EnableScheduling
@MapperScan(value = { "org.typroject.tyboot.*.*.face.orm.dao", "com.yeejoin.amos.api.*.face.orm.dao",
"org.typroject.tyboot.face.*.orm.dao*", "com.yeejoin.amos.boot.biz.common.dao.mapper" })
@ComponentScan({ "org.typroject", "com.yeejoin.amos" })
public class AccessapiApplication {
@Autowired
private TaAccessConfigServiceImpl taAccessConfigServiceImpl;
private static final Logger logger = LogManager.getLogger(AccessapiApplication.class);
public static void main(String[] args) throws Exception {
//license授权验证
// System.setProperty("root.path", ClassPathUtil.getPath()+"/config");
// log.info("(license.bat)url:" + ClassPathUtil.getPath()+"/config");
// A.v();
// 服务启动
ConfigurableApplicationContext context = SpringApplication.run(AccessapiApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------");
}
@Bean
public void initAccessConfig() {
taAccessConfigServiceImpl.refreshConfig();
taAccessConfigServiceImpl.startTask();
}
}
package com.yeejoin.amos.api.common.restful.utils;
import org.springframework.http.HttpStatus;
public class ResponseHelper
{
public static <T> ResponseModel<T> buildResponse(T t) {
ResponseModel<T> response = new ResponseModel<>();
response.setResult(t);
response.setMessage("ok");
response.setStatus(HttpStatus.OK.value());
return response;
}
}
package com.yeejoin.amos.api.common.restful.utils;
import java.io.Serializable;
/**
*
* <pre>
* 返回封装对象
* </pre>
*
* @author gwb
* @version $Id: CommonResponse.java, v 0.1 2021年9月28日 下午4:37:40 gwb Exp $
*/
public class ResponseModel<T> implements Serializable {
/**
* <pre>
*
* </pre>
*/
private static final long serialVersionUID = 2969089929549147825L;
/**
* 响应数据
*/
private T result ;
/**
* 状态码
*/
private int status;
/**
* 提示信息
*/
private String message = "";
public ResponseModel(){
}
public T getResult()
{
return result;
}
public void setResult(T result)
{
this.result = result;
}
public int getStatus()
{
return status;
}
public void setStatus(int status)
{
this.status = status;
}
public String getMessage()
{
return message;
}
public void setMessage(String message)
{
this.message = message;
}
@Override
public String toString()
{
return "CommonResponse [status=" + status + ", result=" + result + ", message=" + message + "]";
}
}
package com.yeejoin.amos.api.openapi.aop;
import com.yeejoin.amos.component.feign.config.TokenOperation;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.core.auth.exception.AuthException;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import com.yeejoin.amos.api.openapi.constant.Constant;
import com.yeejoin.amos.api.openapi.face.model.BizTokenModel;
import javax.servlet.http.HttpServletRequest;
@Aspect
@Component
@Order(value = 0)
public class ControllerAop {
@Autowired
private RedisTemplate redisTemplate;
@Pointcut("(execution(public * com.yeejoin.amos.api.openapi.controller..*(..))) ")
public void userCache() {
}
@Before("userCache()")
public void doBefore(JoinPoint joinPoint) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
// 不需要添加请求头的接口
String[] url = new String[]{"/api/user/selectInfo",
"/api/user/save/curCompany","/openapi/bizToken/applyToken",
"/openapi/bizToken/getAppId","/lift/upload","/lift/status",
"/lift/run","/lift/fault","/lift/video/preview","/cylinderPage/serviceProvider",
"/cylinderPage/getTableInfo","/cylinderPage/initCylinderNum"
,"/license/saveLinceseBaseInfo","/license/saveLinceseDetailInfo","refreshConfig"};
// 获取请求路径
for(String uri : url) {
if(request.getRequestURI().indexOf(uri) != -1) {
return;
}
}
//TODO tyboot 框架拦截器已缓存数据
String token = RequestContext.getToken();
// if (ValidationUtil.isEmpty(token)) {
// token = request.getParameterMap().get("access_token")[0];
// }
// if (token != null) {
// fillRequestContext(token);
// }
// boolean validToken = TokenOperation.refresh(token);
// if(!validToken) {
// throw new AuthException("请求未包含认证信息.");
// }
}
private void fillRequestContext(String token) {
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,token);
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
if(null == bizTokenModel) {
throw new AuthException("请求未包含认证信息.");
}
String product = bizTokenModel.getProduct();
String appKey = bizTokenModel.getAppKey();
RequestContext.setToken(token);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
}
}
package com.yeejoin.amos.api.openapi.constant;
public class Constant {
public static final String TOKEN_PREFIX = "OPENAPI_";
public static final String SECRETKEY = "tzs";
}
package com.yeejoin.amos.api.openapi.controller;
import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaAccessConfig;
import com.yeejoin.amos.api.openapi.face.service.TaAccessConfigServiceImpl;
import com.yeejoin.amos.api.openapi.face.service.TaBusinessServiceImpl;
import com.yeejoin.amos.api.openapi.face.service.TaLicenseBaseInfoServiceImpl;
import com.yeejoin.amos.api.openapi.face.service.TaLicenseDetailInfoServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = "/business")
@Api(tags = "许可数据对接")
public class BusinessController {
@Autowired
private TaAccessConfigServiceImpl taAccessConfigService;
@Autowired
private TaBusinessServiceImpl taBusinessService;
@Autowired
private TaLicenseDetailInfoServiceImpl taLicenseDetailInfoService;
@Autowired
private TaLicenseBaseInfoServiceImpl taLicenseBaseInfoService;
/**
* 新增许可信息-接入配置表
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/saveAccessConfig", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增许可信息-接入配置表", notes = "新增许可信息-接入配置表")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> saveTaAccessConfig (@RequestBody List<TaAccessConfig> produceInfo) throws Exception
{
return ResponseHelper.buildResponse(taAccessConfigService.saveAccessConfig(produceInfo));
}
/**
* 新增许可信息-许可基本信息表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/saveLinceseBaseInfo", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "新增许可信息-许可基本信息表", notes = "新增许可信息-许可基本信息表")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> saveTaLicenseBaseInfo() throws Exception {
taLicenseBaseInfoService.syncLicenseData();
return ResponseHelper.buildResponse("");
}
/**
* 新增许可信息-许可详细信息表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/saveLinceseDetailInfo", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "新增许可信息-许可详细信息表", notes = "新增许可信息-许可详细信息表")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> saveTaLicenseDetailInfo()
throws Exception {
taLicenseDetailInfoService.syncLicenseData();
return ResponseHelper.buildResponse("");
}
/**
* 新增许可信息-许可详细信息表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/refreshConfig", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "更新配置", notes = "更新配置")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> refreshConfig()
throws Exception {
taAccessConfigService.refreshConfig();
return ResponseHelper.buildResponse("");
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getData", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取map", notes = "获取map")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<Map<String, Object>> getData(String code) throws Exception {
return ResponseHelper.buildResponse(taBusinessService.getData(code));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/updateSyncCompanyState", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "更新许可企业同步状态", notes = "更新许可企业同步状态")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> updateSyncCompanyState(String sequenceNbr){
return ResponseHelper.buildResponse(taLicenseBaseInfoService.updateSyncCompanyState(sequenceNbr));
}
}
package com.yeejoin.amos.api.openapi.controller;
import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaAccessConfig;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaLicenseBaseInfo;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaLicenseDetailInfo;
import com.yeejoin.amos.api.openapi.face.service.TaAccessConfigServiceImpl;
import com.yeejoin.amos.api.openapi.face.service.TaLicenseBaseInfoServiceImpl;
import com.yeejoin.amos.api.openapi.face.service.TaLicenseDetailInfoServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.List;
@RestController
@RequestMapping(value = "/license")
@Api(tags = "许可数据对接")
public class LicenseController {
@Autowired
private TaAccessConfigServiceImpl taAccessConfigService;
@Autowired
private TaLicenseDetailInfoServiceImpl taLicenseDetailInfoService;
@Autowired
private TaLicenseBaseInfoServiceImpl taLicenseBaseInfoService;
// /**
// * 新增许可信息-接入配置表
// * @return
// */
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @RequestMapping(value = "/saveAccessConfig", method = RequestMethod.POST)
// @ApiOperation(httpMethod = "POST", value = "新增许可信息-接入配置表", notes = "新增许可信息-接入配置表")
// @RestEventTrigger(value = "openapiLogEventHandler")
// public ResponseModel<String> saveTaAccessConfig (@RequestBody List<TaAccessConfig> produceInfo) throws Exception
// {
// return ResponseHelper.buildResponse(taAccessConfigService.saveAccessConfig(produceInfo));
// }
/**
* 新增许可信息-许可基本信息表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/saveLinceseBaseInfo", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "新增许可信息-许可基本信息表", notes = "新增许可信息-许可基本信息表")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> saveTaLicenseBaseInfo() throws Exception {
taLicenseBaseInfoService.syncLicenseData();
return ResponseHelper.buildResponse("");
}
/**
* 新增许可信息-许可详细信息表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/saveLinceseDetailInfo", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "新增许可信息-许可详细信息表", notes = "新增许可信息-许可详细信息表")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> saveTaLicenseDetailInfo()
throws Exception {
taLicenseDetailInfoService.syncLicenseData();
return ResponseHelper.buildResponse("");
}
/**
* 新增许可信息-许可详细信息表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/refreshConfig", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "更新配置", notes = "更新配置")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> refreshConfig()
throws Exception {
taAccessConfigService.refreshConfig();
return ResponseHelper.buildResponse("");
}
}
package com.yeejoin.amos.api.openapi.controller.event;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.api.openapi.constant.Constant;
import com.yeejoin.amos.api.openapi.face.model.BizTokenModel;
import com.yeejoin.amos.api.openapi.face.model.OpenapiLogModel;
import com.yeejoin.amos.api.openapi.face.service.OpenapiLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.component.event.RestEvent;
import org.typroject.tyboot.component.event.RestEventHandler;
/**
*
* <pre>
* 第三方API对接日志处理
* </pre>
*
* @author gwb
* @version $Id: OpenapiLogEventHandler.java, v 0.1 2021年11月10日 下午5:38:32 gwb Exp $
*/
@Component("openapiLogEventHandler")
public class OpenapiLogEventHandler extends RestEventHandler {
static ObjectMapper objectMapper = new ObjectMapper();
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private OpenapiLogService openapiLogService;
@Override
protected void handleEvent(RestEvent restEvent) throws Exception {
OpenapiLogModel openapiLogModel = new OpenapiLogModel();
openapiLogModel.setMethodLabel(restEvent.getMethodLabel());
openapiLogModel.setMethodName(restEvent.getMethodName());
openapiLogModel.setParams(objectMapper.writeValueAsString(restEvent.getParams()));
openapiLogModel.setResult(objectMapper.writeValueAsString(restEvent.getSource()));
openapiLogModel.setRemoteIp(restEvent.getRequestContextModel().getRequestIP());
String token = restEvent.getRequestContextModel().getToken();
openapiLogModel.setToken(token);
openapiLogModel.setTraceId(restEvent.getRequestContextModel().getTraceId());
openapiLogModel.setAgencyCode(restEvent.getRequestContextModel().getAgencyCode());
openapiLogModel.setAppCode(restEvent.getRequestContextModel().getAppKey());
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,token);
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
openapiLogModel.setAppId(bizTokenModel.getAppId());
openapiLogService.createWithModel(openapiLogModel);
}
}
package com.yeejoin.amos.api.openapi.face.model;
import lombok.Data;
import java.io.Serializable;
@Data
public class BizTokenModel implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* 登录令牌
*/
private String token;
/**
* 应用编号
*/
private String appKey;
/**
* 客户端标识
*/
private String product;
/**
* 所属机构
*/
private String agencyCode;
/**
* 应用用户票据,唯一标识
*/
private String appId;
/**
* 对接公司编码
*/
private String apiCompanyCode;
}
package com.yeejoin.amos.api.openapi.face.model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
/**
*
* <pre>
*
* </pre>
*
* @author gwb
* @version $Id: OpenapiLogModel.java, v 0.1 2021年11月10日 下午5:53:46 gwb Exp $
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class OpenapiLogModel extends BaseModel {
private static final long serialVersionUID = 1L;
private String remoteIp;
private String result;
private String methodName;
private String methodLabel;
private String params;
private String traceId;
private String token;
private String resultStatus;//操作结果状态
private String userRealName;// 操作人真实姓名
private String userName;// 操作人用户名
/**
* 所属项目编号
*/
private String agencyCode;
private String appCode;
/**
* 应用用户票据,唯一标识
*/
private String appId;
}
package com.yeejoin.amos.api.openapi.face.model;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
/**
* 接入信息表Model
*
* @author duanwei
* @date 2022-08-17
*/
@Data
public class TaAccessConfigModel extends BaseModel {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
/**
* id
*/
private Long sequenceNbr;
@ApiModelProperty(value = "业务类型")
/**
* 业务类型
*/
private String bizType;
@ApiModelProperty(value = "键")
/**
* 键
*/
private String key;
@ApiModelProperty(value = "值")
/**
* 值
*/
private String value;
@ApiModelProperty(value = "描述")
/**
* 描述
*/
private String description;
@ApiModelProperty(value = "创建时间")
/**
* 创建时间
*/
private Date recDate;
}
package com.yeejoin.amos.api.openapi.face.model;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
/**
* 许可基本信息表Model
*
* @author duanwei
* @date 2022-08-17
*/
@Data
public class TaLicenseBaseInfoModel extends BaseModel {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
/**
* id
*/
private Long id;
@ApiModelProperty(value = "国家")
/**
* 国家
*/
private String country;
@ApiModelProperty(value = "省")
/**
* 省
*/
private String province;
@ApiModelProperty(value = "市")
/**
* 市
*/
private String city;
@ApiModelProperty(value = "区")
/**
* 区
*/
private String district;
@ApiModelProperty(value = "单位名称")
/**
* 单位名称
*/
private String unitName;
@ApiModelProperty(value = "单位代码")
/**
* 单位代码
*/
private String unitCode;
@ApiModelProperty(value = "注册地址")
/**
* 注册地址
*/
private String regAddress;
@ApiModelProperty(value = "证件地址")
/**
* 证件地址
*/
private String licAddress;
@ApiModelProperty(value = "证件类型")
/**
* 证件类型
*/
private String certType;
@ApiModelProperty(value = "证件许可项目")
/**
* 证件许可项目
*/
private String certItem;
@ApiModelProperty(value = "证件编号")
/**
* 证件编号
*/
private String certNo;
@ApiModelProperty(value = "有效截止日期")
/**
* 有效截止日期
*/
private Date expiryDate;
@ApiModelProperty(value = "发证日期")
/**
* 发证日期
*/
private Date issueDate;
@ApiModelProperty(value = "发证机关")
/**
* 发证机关
*/
private String approvedOrga;
@ApiModelProperty(value = "变更日期")
/**
* 变更日期
*/
private Date changeDate;
@ApiModelProperty(value = "许可方式")
/**
* 许可方式
*/
private String applyType;
@ApiModelProperty(value = "许可评审方式")
/**
* 许可评审方式
*/
private String appraisalType;
@ApiModelProperty(value = "备注")
/**
* 备注
*/
private String remark;
@ApiModelProperty(value = "数据入库时间")
/**
* 数据入库时间
*/
private Date recordDate;
@ApiModelProperty(value = "同步时间")
/**
* 同步时间
*/
private Date syncDate;
@ApiModelProperty(value = "同步状态(0-新增 1-更新 2-删除)")
/**
* 同步状态(0-新增 1-更新 2-删除)
*/
private Integer syncState;
/**
* 企业同步状态(0-新增 1-更新 2-删除 3-已同步)
*/
private Integer syncCompanyState;
}
package com.yeejoin.amos.api.openapi.face.model;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
/**
* 许可详细信息表Model
*
* @author duanwei
* @date 2022-08-17
*/
@Data
public class TaLicenseDetailInfoModel extends BaseModel {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
/**
* id
*/
private Long id;
@ApiModelProperty(value = "base_info表id")
/**
* base_info表id
*/
private String basicInfoSequenceNbr;
@ApiModelProperty(value = "单位统一社会信用代码")
/**
* 单位统一社会信用代码
*/
private String unitCode;
@ApiModelProperty(value = "证书编号")
/**
* 证书编号
*/
private String certNo;
@ApiModelProperty(value = "许可项目")
/**
* 许可项目
*/
private String itemName;
@ApiModelProperty(value = "许可子项目")
/**
* 许可子项目
*/
private String subItem;
@ApiModelProperty(value = "许可参数")
/**
* 许可参数
*/
private String parameter;
@ApiModelProperty(value = "备注")
/**
* 备注
*/
private String remark;
@ApiModelProperty(value = "固定检验地址")
/**
* 固定检验地址
*/
private String itemAddress;
@ApiModelProperty(value = "数据入库时间")
/**
* 数据入库时间
*/
private Date recordDate;
@ApiModelProperty(value = "同步时间")
/**
* 同步时间
*/
private Date syncDate;
@ApiModelProperty(value = "同步状态(0-新增 1-更新 2-删除)")
/**
* 同步状态(0-新增 1-更新 2-删除)
*/
private Integer syncState;
}
package com.yeejoin.amos.api.openapi.face.orm.dao;
public interface DataDictionaryMapper {
String getData(String code);
}
package com.yeejoin.amos.api.openapi.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.openapi.face.orm.entity.OpenapiLog;
/**
*
* <pre>
* Mapper 接口
* </pre>
*
* @author gwb
* @version $Id: OpenapiLogMapper.java, v 0.1 2021年11月10日 下午5:54:19 gwb Exp $
*/
public interface OpenapiLogMapper extends BaseMapper<OpenapiLog> {
}
\ No newline at end of file
package com.yeejoin.amos.api.openapi.face.orm.dao;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaAccessConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 附件表 Mapper 接口
*
* @author duanwei
* @date 2022-08-17
*/
public interface TaAccessConfigMapper extends BaseMapper<TaAccessConfig> {
}
package com.yeejoin.amos.api.openapi.face.orm.dao;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaLicenseBaseInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 附件表 Mapper 接口
*
* @author duanwei
* @date 2022-08-17
*/
public interface TaLicenseBaseInfoMapper extends BaseMapper<TaLicenseBaseInfo> {
public void updateSyncCompanyState(String sequenceNbr);
}
package com.yeejoin.amos.api.openapi.face.orm.dao;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaLicenseDetailInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 附件表 Mapper 接口
*
* @author duanwei
* @date 2022-08-17
*/
public interface TaLicenseDetailInfoMapper extends BaseMapper<TaLicenseDetailInfo> {
}
package com.yeejoin.amos.api.openapi.face.orm.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
/**
*
* <pre>
*
* </pre>
*
* @author gwb
* @version $Id: OpenapiLog.java, v 0.1 2021年11月10日 下午5:53:15 gwb Exp $
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("iot_openapi_log")
public class OpenapiLog extends BaseEntity {
private static final long serialVersionUID = 7799473276203462503L;
@TableField("REMOTE_IP")
private String remoteIp;
@TableField("RESULT")
private String result;
@TableField("METHOD_NAME")
private String methodName;
@TableField("METHOD_LABEL")
private String methodLabel;
@TableField("PARAMS")
private String params;
@TableField("TRACE_ID")
private String traceId;
@TableField("TOKEN")
private String token;
@TableField("AGENCY_CODE")
private String agencyCode;
@TableField("APP_CODE")
private String appCode;
/**
* 应用用户票据,唯一标识
*/
@TableField("APP_ID")
private String appId;
}
package com.yeejoin.amos.api.openapi.face.orm.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
/**
* 接入信息表
*
* @author duanwei
* @date 2022-08-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ta_access_config")
@ApiModel(value="TaAccessConfig对象", description="接入信息表")
public class TaAccessConfig extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "业务类型")
private String bizType;
@ApiModelProperty(value = "键")
private String bizKey;
@ApiModelProperty(value = "值")
private String bizValue;
@ApiModelProperty(value = "描述")
private String description;
}
package com.yeejoin.amos.api.openapi.face.orm.entity;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
/**
* 许可基本信息表
*
* @author duanwei
* @date 2022-08-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="TaLicenseBaseInfo对象", description="许可基本信息表")
public class TaLicenseBaseInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "国家")
private String country;
@ApiModelProperty(value = "省")
private String province;
@ApiModelProperty(value = "市")
private String city;
@ApiModelProperty(value = "区")
private String district;
@ApiModelProperty(value = "单位名称")
private String unitName;
@ApiModelProperty(value = "单位代码")
private String unitCode;
@ApiModelProperty(value = "注册地址")
private String regAddress;
@ApiModelProperty(value = "证件地址")
private String licAddress;
@ApiModelProperty(value = "证件类型")
private String certType;
@ApiModelProperty(value = "证件许可项目")
private String certItem;
@ApiModelProperty(value = "证件编号")
private String certNo;
@ApiModelProperty(value = "有效截止日期")
private Date expiryDate;
@ApiModelProperty(value = "发证日期")
private Date issueDate;
@ApiModelProperty(value = "发证机关")
private String approvedOrgan;
@ApiModelProperty(value = "变更日期")
private Date changeDate;
@ApiModelProperty(value = "许可方式")
private String applyType;
@ApiModelProperty(value = "许可评审方式")
private String appraisalType;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "数据入库时间")
private Date recordDate;
@ApiModelProperty(value = "同步时间")
private Date syncDate;
@ApiModelProperty(value = "同步状态(0-新增 1-更新 2-删除)")
private Integer syncState;
@ApiModelProperty(value = "企业同步状态(0-新增 1-更新 2-删除 3-已同步)")
private Integer syncCompanyState;
}
package com.yeejoin.amos.api.openapi.face.orm.entity;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
/**
* 许可详细信息表
*
* @author duanwei
* @date 2022-08-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="TaLicenseDetailInfo对象", description="许可详细信息表")
public class TaLicenseDetailInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "base_info表id")
private String basicInfoId;
@ApiModelProperty(value = "单位统一社会信用代码")
private String unitCode;
@ApiModelProperty(value = "证书编号")
private String certNo;
@ApiModelProperty(value = "许可项目")
private String itemName;
@ApiModelProperty(value = "许可子项目")
private String subItem;
@ApiModelProperty(value = "许可参数")
private String parameter;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "固定检验地址")
private String itemAddress;
@ApiModelProperty(value = "数据入库时间")
private Date recordDate;
@ApiModelProperty(value = "同步时间")
private Date syncDate;
@ApiModelProperty(value = "同步状态(0-新增 1-更新 2-删除)")
private Integer syncState;
}
package com.yeejoin.amos.api.openapi.face.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.api.openapi.face.model.OpenapiLogModel;
import com.yeejoin.amos.api.openapi.face.orm.dao.OpenapiLogMapper;
import com.yeejoin.amos.api.openapi.face.orm.entity.OpenapiLog;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* <pre>
* 服务类
* </pre>
*
* @author gwb
* @version $Id: OpenapiLogService.java, v 0.1 2021年11月10日 下午5:55:31 gwb Exp $
*/
@Component
public class OpenapiLogService extends BaseService<OpenapiLogModel, OpenapiLog, OpenapiLogMapper> {
private ObjectMapper objectMapper = new ObjectMapper();
/**
* 分页查询
*/
@SuppressWarnings("unchecked")
public Page<OpenapiLogModel> queryForOpenserviceOperateLogPage(Page page, String agencyCode, @Condition(Operator.like) String methodLabel) throws Exception {
Page<OpenapiLogModel> openserviceOperateLogModelPage = this.queryForPage(page, "CREATE_TIME", false,agencyCode, methodLabel);
List<OpenapiLogModel> openserviceOperateLogModelList = openserviceOperateLogModelPage.getRecords();
Map<String, AgencyUserModel> userMap = new HashMap<String, AgencyUserModel>();
for (OpenapiLogModel openserviceOperateLogModel : openserviceOperateLogModelList)
{
//填充操作人信息
AgencyUserModel agencyUserModel = userMap.get(openserviceOperateLogModel.getRecUserId());
if (ValidationUtil.isEmpty(agencyUserModel))
{
openserviceOperateLogModel.setUserName(openserviceOperateLogModel.getRecUserId());
openserviceOperateLogModel.setUserRealName(openserviceOperateLogModel.getRecUserId());
FeignClientResult<AgencyUserModel> responseModel = Privilege.agencyUserClient.queryByUserId(openserviceOperateLogModel.getRecUserId());
AgencyUserModel userModel = responseModel.getResult();
if (!ValidationUtil.isEmpty(userModel))
{
userMap.put(openserviceOperateLogModel.getRecUserId(), userModel);
openserviceOperateLogModel.setUserName(userModel.getUserName());
openserviceOperateLogModel.setUserRealName(userModel.getRealName());
}
}else
{
openserviceOperateLogModel.setUserName(agencyUserModel.getUserName());
openserviceOperateLogModel.setUserRealName(agencyUserModel.getRealName());
}
//填充操作状态
String result = openserviceOperateLogModel.getResult();
Map<String, Object> mapJson = objectMapper.readValue(result,Map.class);
String status = mapJson.get("status").toString();
if (status.equals("200"))
{
openserviceOperateLogModel.setResultStatus("成功");
}else
{
openserviceOperateLogModel.setResultStatus("失败");
}
}
openserviceOperateLogModelPage.setRecords(openserviceOperateLogModelList);
return openserviceOperateLogModelPage;
}
/**
* 列表查询 示例
*/
public List<OpenapiLogModel> queryForOpenserviceOperateLogList(String agencyCode) throws Exception {
return this.queryForList("", false, agencyCode);
}
}
package com.yeejoin.amos.api.openapi.face.service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.api.openapi.face.model.TaAccessConfigModel;
import com.yeejoin.amos.api.openapi.face.orm.dao.TaAccessConfigMapper;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaAccessConfig;
import com.yeejoin.amos.openapi.enums.TaAccessConfigBizeEnum;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
/**
* 附件表 服务实现类
*
* @author duanwei
* @date 2022-08-17
*/
@Service
public class TaAccessConfigServiceImpl extends BaseService<TaAccessConfigModel, TaAccessConfig, TaAccessConfigMapper> {
static Map<String, String> licenseConfig = new HashMap<String, String>();
@Autowired
private TaLicenseDetailInfoServiceImpl taLicenseDetailInfoService;
@Autowired
private TaLicenseBaseInfoServiceImpl taLicenseBaseInfoService;
/**
*
* 新增许可信息-接入配置表
*
* @param model 接入配置实体类集合
* @return 成功返回“OK”
*/
@Transactional(rollbackFor = { Exception.class })
public String saveAccessConfig(List<TaAccessConfig> model) {
// TODO Auto-generated method stub
if (ValidationUtil.isEmpty(model)) {
throw new BadRequest("接入配置表信息为空.");
}
for (TaAccessConfig models : model) {
// checkModel(models);
models.setRecDate(new Date());
// models.setAppId(getAppId());
}
this.saveBatch(model);
return "OK";
}
public void refreshConfig() {
licenseConfig.clear();
List<TaAccessConfig> list = this.list(new LambdaQueryWrapper<TaAccessConfig>().eq(TaAccessConfig::getBizType,
TaAccessConfigBizeEnum.LICENSE.getAttribute()));
for (TaAccessConfig ta : list) {
licenseConfig.put(ta.getBizKey(), ta.getBizValue());
}
}
public void startTask() {
String cron = licenseConfig.get("cron");
// 创建带线程池的调度器
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
// 手动初始化
taskScheduler.initialize();
// 设置线程池
taskScheduler.setPoolSize(30);
System.out.println(taskScheduler);
taskScheduler.schedule(new Runnable() {
@Override
public void run() {
try {
taLicenseDetailInfoService.syncLicenseData();
taLicenseBaseInfoService.syncLicenseData();
} catch (Exception e) {
e.printStackTrace();
}
}
}, new CronTrigger(cron));// 这串字符串是cron表达式 代表每隔5秒执行一次
}
}
package com.yeejoin.amos.api.openapi.face.service;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.csoft.sdk.domain.CsoftDataApiXixianGetzhutiinfoParam;
import com.csoft.sdk.domain.request.CsoftDataApiXixianGetzhutiinfoRequest ;
import com.csoft.sdk.domain.response.CsoftDataApiXixianGetzhutiinfoResponse;
import com.yeejoin.amos.api.openapi.face.orm.dao.DataDictionaryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.csoft.sdk.client.CsoftDefaultSdkClient;
import com.csoft.sdk.domain.App;
import com.csoft.sdk.domain.CsoftDataTzsbJbxxListParam;
import com.yeejoin.amos.api.openapi.face.model.TaAccessConfigModel;
import com.yeejoin.amos.api.openapi.face.orm.dao.TaAccessConfigMapper;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaAccessConfig;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaLicenseBaseInfo;
/**
* 附件表 服务实现类
*
* @author duanwei
* @date 2022-08-17
*/
@Service
public class TaBusinessServiceImpl extends BaseService<TaAccessConfigModel, TaAccessConfig, TaAccessConfigMapper> {
@Autowired
private DataDictionaryMapper dataDictionaryMapper;
public Map<String, Object> getData(String code) throws Exception {
Map<String, String> map = TaAccessConfigServiceImpl.licenseConfig;
String appId = map.get("appId");
String appKey = map.get("appKey");
String appSecret = map.get("appSecret");
String server = map.get("server");
App app = App.of(appId, appKey, appSecret, server);
CsoftDefaultSdkClient client = CsoftDefaultSdkClient.of(app);
// 3.设置参数,发送请求,并处理结果
CsoftDataApiXixianGetzhutiinfoParam csoftDataApiXixianParam = new CsoftDataApiXixianGetzhutiinfoParam();
csoftDataApiXixianParam.setUniscid(code);
CsoftDataApiXixianGetzhutiinfoRequest request = new CsoftDataApiXixianGetzhutiinfoRequest(csoftDataApiXixianParam);
CsoftDataApiXixianGetzhutiinfoResponse response = client.execute(request);
Map<String, Object> result = new HashMap<>();
// 4.返回校验
if (response.isSuccess()) {
System.out.println("成功:" + response.getData());
System.out.println(response.getResult());
JSONObject jsonObject = JSONObject.parseObject(response.getData());
JSONObject data = jsonObject.getJSONObject("data");
//如果不存在该企业 则直接返回null
if(ValidationUtil.isEmpty(data)){
return result;
}
//分割字符串 根据详细地址分割出 省/市/区、街道地址、小区地址
String address = data.getString("dom");
String area = address.substring(0,address.indexOf("区")+1);
String street = address.substring(area.length()).substring(0,address.substring(area.length()).indexOf("号")+1);
String community = address.substring(area.length()+street.length());
String industry = "";
if(!ValidationUtil.isEmpty(data.get("hydm"))){
if(data.getString("hydm").length() > 2){
industry = getIndustry(data.getString("hydm"));
}
}
//所属行业
result.put("industry", industry);
//注册地址 省/市/区
result.put("area", area);
//注册地址 街道地址
result.put("street", street);
//注册地址 小区地址
result.put("community", community);
//注册地址 详细地址
result.put("address", data.get("dom"));
//登记机关
result.put("registration_authority", data.get("regorg"));
//核准时间
result.put("approval_time", data.get("hzrq"));
//经营状态
result.put("operating_status", data.get("opstate"));
//统一社会信用代码
result.put("creditCode",data.get("uniscid"));
//企业名称
result.put("unitName",data.get("entname"));
//经营范围
result.put("businessScope",data.get("opscope"));
//注册资金(数字,万元)
result.put("regcap",data.get("regcap"));
//成立日期
result.put("estdate",data.get("estdate"));
//营业期限(yyyy-mm-dd)
result.put("operatingPeriod",data.get("yyqx"));
//生产经营地址
result.put("oploc",data.get("oploc"));
//登记注册类型中文描述
result.put("enttype",data.get("enttype"));
//法定代表人姓名
result.put("legalPeople",data.get("lerep"));
//行业小类编码
result.put("industryCode",data.get("hydm"));
} else {
System.out.println("失败:" + response.getErrorMsg());
System.out.println("失败:" + response.getErrorCode());
throw new Exception(response.getErrorMsg());
}
return result;
}
public String getIndustry(String code){
return dataDictionaryMapper.getData(code.substring(0,2));
}
}
package com.yeejoin.amos.api.openapi.face.service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.csoft.sdk.client.CsoftDefaultSdkClient;
import com.csoft.sdk.domain.App;
import com.csoft.sdk.domain.CsoftDataTzsbJbxxListParam;
import com.csoft.sdk.domain.request.CsoftDataTzsbJbxxListRequest;
import com.csoft.sdk.domain.response.CsoftDataTzsbJbxxListResponse;
import com.yeejoin.amos.api.openapi.face.model.TaLicenseBaseInfoModel;
import com.yeejoin.amos.api.openapi.face.orm.dao.TaLicenseBaseInfoMapper;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaAccessConfig;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaLicenseBaseInfo;
/**
* 附件表 服务实现类
*
* @author duanwei
* @date 2022-08-17
*/
@Service
public class TaLicenseBaseInfoServiceImpl
extends BaseService<TaLicenseBaseInfoModel, TaLicenseBaseInfo, TaLicenseBaseInfoMapper> {
@Autowired
TaAccessConfigServiceImpl taAccessConfigServiceImpl;
@Autowired
TaLicenseBaseInfoMapper licenseBaseInfoMapper;
public String updateSyncCompanyState(String sequenceNbr){
licenseBaseInfoMapper.updateSyncCompanyState(sequenceNbr);
return "ok";
}
/**
*
* 新增许可信息-许可基本信息表
*
* @param model 许可基本信息实体类集合
* @return 成功返回“OK”
*/
@Transactional(rollbackFor = { Exception.class })
public String saveLicenseBaseInfo(List<TaLicenseBaseInfo> model) {
// TODO Auto-generated method stub
if (ValidationUtil.isEmpty(model)) {
throw new BadRequest("接入配置表信息为空.");
}
for (TaLicenseBaseInfo models : model) {
// checkModel(models);
models.setRecDate(new Date());
// models.setAppId(getAppId());
}
this.saveBatch(model);
return "OK";
}
public void syncLicenseData() throws Exception {
Map<String, String> map = TaAccessConfigServiceImpl.licenseConfig;
String appId = map.get("appId");
String appKey = map.get("appKey");
String appSecret = map.get("appSecret");
String server = map.get("server");
String startTime = map.get("startTime");
int isAll = Integer.valueOf(map.get("isAllBase"));
// String endTime = map.get("endTime");
App app = App.of(appId, appKey, appSecret, server);
int current = 1;
int size = Integer.valueOf(map.get("pageSize"));
// 2.初始化请求客户端
CsoftDefaultSdkClient client = CsoftDefaultSdkClient.of(app);
// 3.设置参数,发送请求,并处理结果
CsoftDataTzsbJbxxListParam csoftDataTzsbJbxxListParam = new CsoftDataTzsbJbxxListParam();
if (isAll == 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 开始日期
csoftDataTzsbJbxxListParam.setStaTime(startTime);
// 结束日期
csoftDataTzsbJbxxListParam.setEndTime(sdf.format(new Date()));
} else {
SimpleDateFormat sdfsta = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
SimpleDateFormat sdfend = new SimpleDateFormat("yyyy-MM-dd 23:59:59");
// 开始日期
csoftDataTzsbJbxxListParam.setStaTime(sdfsta.format(new Date()));
// 结束日期
csoftDataTzsbJbxxListParam.setEndTime(sdfend.format(new Date()));
}
csoftDataTzsbJbxxListParam.setPageSize(size); // 每 页记录数
csoftDataTzsbJbxxListParam.setCurrentPage(current); // 当前页码
CsoftDataTzsbJbxxListRequest request = new CsoftDataTzsbJbxxListRequest(csoftDataTzsbJbxxListParam);
CsoftDataTzsbJbxxListResponse response = client.execute(request);
// 4.返回校验
if (response.isSuccess()) {
System.out.println("成功:" + response.getData());
System.out.println(response.getResult());
JSONObject jsonObject = JSONObject.parseObject(response.getData());
JSONObject data = jsonObject.getJSONObject("data");
JSONArray jsonArray = data.getJSONArray("objList");
List<TaLicenseBaseInfo> list = new ArrayList<TaLicenseBaseInfo>();
for (Object obj : jsonArray) {
String jsonString = JSONObject.toJSONString(obj);
TaLicenseBaseInfo taLicenseBaseInfo = JSONObject.parseObject(jsonString, TaLicenseBaseInfo.class);
taLicenseBaseInfo.setSyncDate(new Date());
taLicenseBaseInfo.setSyncState(0);
TaLicenseBaseInfo oldTaLicenseBaseInfo = this.getOne(new LambdaQueryWrapper<TaLicenseBaseInfo>()
.eq(TaLicenseBaseInfo::getId, taLicenseBaseInfo.getId()));
if (oldTaLicenseBaseInfo != null) {
taLicenseBaseInfo.setSequenceNbr(oldTaLicenseBaseInfo.getSequenceNbr());
}
list.add(taLicenseBaseInfo);
}
this.saveOrUpdateBatch(list);
while (data.getInteger("totalNum") > current * size) {
csoftDataTzsbJbxxListParam.setCurrentPage(++current);
saveData(client, csoftDataTzsbJbxxListParam);
}
if (isAll == 0) {
taAccessConfigServiceImpl
.update(new LambdaUpdateWrapper<TaAccessConfig>().eq(TaAccessConfig::getBizType, "license")
.eq(TaAccessConfig::getBizKey, "isAllBase").set(TaAccessConfig::getBizValue, 1));
}
} else {
System.out.println("失败:" + response.getErrorMsg());
System.out.println("失败:" + response.getErrorCode());
throw new Exception(response.getErrorMsg());
}
}
private void saveData(CsoftDefaultSdkClient client, CsoftDataTzsbJbxxListParam csoftDataTzsbJbxxListParam)
throws Exception {
// 2.初始化请求客户端
CsoftDataTzsbJbxxListRequest request = new CsoftDataTzsbJbxxListRequest(csoftDataTzsbJbxxListParam);
CsoftDataTzsbJbxxListResponse response = client.execute(request);
// 4.返回校验
if (response.isSuccess()) {
System.out.println("成功:" + response.getData());
System.out.println(response.getResult());
JSONObject jsonObject = JSONObject.parseObject(response.getData());
JSONObject data = jsonObject.getJSONObject("data");
JSONArray jsonArray = data.getJSONArray("objList");
List<TaLicenseBaseInfo> list = new ArrayList<TaLicenseBaseInfo>();
for (Object obj : jsonArray) {
String jsonString = JSONObject.toJSONString(obj);
TaLicenseBaseInfo taLicenseBaseInfo = JSONObject.parseObject(jsonString, TaLicenseBaseInfo.class);
taLicenseBaseInfo.setSyncDate(new Date());
taLicenseBaseInfo.setSyncState(0);
taLicenseBaseInfo.setSyncCompanyState(0);
TaLicenseBaseInfo oldTaLicenseBaseInfo = this.getOne(new LambdaQueryWrapper<TaLicenseBaseInfo>()
.eq(TaLicenseBaseInfo::getId, taLicenseBaseInfo.getId()));
if (oldTaLicenseBaseInfo != null) {
taLicenseBaseInfo.setSequenceNbr(oldTaLicenseBaseInfo.getSequenceNbr());
}
list.add(taLicenseBaseInfo);
}
this.saveOrUpdateBatch(list);
} else {
System.out.println("失败:current:" + csoftDataTzsbJbxxListParam.getCurrentPage());
System.out.println("失败:" + response.getErrorMsg());
System.out.println("失败:" + response.getErrorCode());
throw new Exception(response.getErrorMsg());
}
}
}
package com.yeejoin.amos.api.openapi.face.service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.csoft.sdk.client.CsoftDefaultSdkClient;
import com.csoft.sdk.domain.App;
import com.csoft.sdk.domain.CsoftDataTzsbXkxxListParam;
import com.csoft.sdk.domain.request.CsoftDataTzsbXkxxListRequest;
import com.csoft.sdk.domain.response.CsoftDataTzsbXkxxListResponse;
import com.yeejoin.amos.api.openapi.face.model.TaLicenseDetailInfoModel;
import com.yeejoin.amos.api.openapi.face.orm.dao.TaLicenseDetailInfoMapper;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaAccessConfig;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaLicenseDetailInfo;
/**
* 附件表 服务实现类
*
* @author duanwei
* @date 2022-08-17
*/
@Service
public class TaLicenseDetailInfoServiceImpl extends BaseService<TaLicenseDetailInfoModel, TaLicenseDetailInfo, TaLicenseDetailInfoMapper> {
@Autowired
TaAccessConfigServiceImpl taAccessConfigServiceImpl;
/**
*
* 新增许可信息-许可详细信息表
*
* @param model 许可详细信息实体类集合
* @return 成功返回“OK”
*/
@Transactional(rollbackFor= {Exception.class})
public String saveLicenseDetailInfo(List<TaLicenseDetailInfo> model) {
//TODO Auto-generated method stub
if (ValidationUtil.isEmpty(model)) {
throw new BadRequest("接入配置表信息为空.");
}
for (TaLicenseDetailInfo models : model) {
// checkModel(models);
models.setRecDate(new Date());
// models.setAppId(getAppId());
}
this.saveBatch(model);
return "OK";
}
public void syncLicenseData() throws Exception {
Map<String, String> map = TaAccessConfigServiceImpl.licenseConfig;
String appId = map.get("appId");
String appKey = map.get("appKey");
String appSecret = map.get("appSecret");
String server = map.get("server");
String startTime = map.get("startTime");
//String endTime = map.get("endTime");
int isAll = Integer.valueOf(map.get("isAllDetail"));
App app = App.of(appId, appKey, appSecret, server);
int current = 1;
int size = Integer.valueOf(map.get("pageSize"));
// 2.初始化请求客户端
CsoftDefaultSdkClient client = CsoftDefaultSdkClient.of(app);
// 3.设置参数,发送请求,并处理结果
CsoftDataTzsbXkxxListParam csoftDataTzsbXKxxListParam = new CsoftDataTzsbXkxxListParam();
if (isAll == 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 开始日期
csoftDataTzsbXKxxListParam.setStaTime(startTime);
// 结束日期
csoftDataTzsbXKxxListParam.setEndTime(sdf.format(new Date()));
} else {
SimpleDateFormat sdfsta = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
SimpleDateFormat sdfend = new SimpleDateFormat("yyyy-MM-dd 23:59:59");
// 开始日期
csoftDataTzsbXKxxListParam.setStaTime(sdfsta.format(new Date()));
// 结束日期
csoftDataTzsbXKxxListParam.setEndTime(sdfend.format(new Date()));
}
csoftDataTzsbXKxxListParam.setPageSize(size); // 每 页记录数
csoftDataTzsbXKxxListParam.setCurrentPage(current); // 当前页码
CsoftDataTzsbXkxxListRequest request = new CsoftDataTzsbXkxxListRequest(csoftDataTzsbXKxxListParam);
CsoftDataTzsbXkxxListResponse response = client.execute(request);
// 4.返回校验
if (response.isSuccess()) {
System.out.println("成功:" + response.getData());
System.out.println(response.getResult());
JSONObject jsonObject = JSONObject.parseObject(response.getData());
JSONObject data = jsonObject.getJSONObject("data");
JSONArray jsonArray = data.getJSONArray("objList");
List<TaLicenseDetailInfo> list = new ArrayList<TaLicenseDetailInfo>();
for (Object obj : jsonArray) {
String jsonString = JSONObject.toJSONString(obj);
TaLicenseDetailInfo taLicenseDetailInfo = JSONObject.parseObject(jsonString, TaLicenseDetailInfo.class);
taLicenseDetailInfo.setSyncDate(new Date());
taLicenseDetailInfo.setSyncState(0);
TaLicenseDetailInfo oldTaLicenseDetailInfo = this.getOne(new LambdaQueryWrapper<TaLicenseDetailInfo>()
.eq(TaLicenseDetailInfo::getId, taLicenseDetailInfo.getId()));
if (oldTaLicenseDetailInfo != null) {
taLicenseDetailInfo.setSequenceNbr(oldTaLicenseDetailInfo.getSequenceNbr());
}
list.add(taLicenseDetailInfo);
}
this.saveOrUpdateBatch(list);
while (data.getInteger("totalNum") > current * size) {
csoftDataTzsbXKxxListParam.setCurrentPage(++current);
saveData(client, csoftDataTzsbXKxxListParam);
}
if (isAll == 0) {
taAccessConfigServiceImpl
.update(new LambdaUpdateWrapper<TaAccessConfig>().eq(TaAccessConfig::getBizType, "license")
.eq(TaAccessConfig::getBizKey, "isAllDetail").set(TaAccessConfig::getBizValue, 1));
}
} else {
System.out.println("失败:" + response.getErrorMsg());
System.out.println("失败:" + response.getErrorCode());
throw new Exception(response.getErrorMsg());
}
}
private void saveData(CsoftDefaultSdkClient client, CsoftDataTzsbXkxxListParam csoftDataTzsbXKxxListParam) throws Exception {
// 2.初始化请求客户端
CsoftDataTzsbXkxxListRequest request = new CsoftDataTzsbXkxxListRequest(csoftDataTzsbXKxxListParam);
CsoftDataTzsbXkxxListResponse response = client.execute(request);
// 4.返回校验
if (response.isSuccess()) {
System.out.println("成功:" + response.getData());
System.out.println(response.getResult());
JSONObject jsonObject = JSONObject.parseObject(response.getData());
JSONObject data = jsonObject.getJSONObject("data");
JSONArray jsonArray = data.getJSONArray("objList");
List<TaLicenseDetailInfo> list = new ArrayList<TaLicenseDetailInfo>();
for (Object obj : jsonArray) {
String jsonString = JSONObject.toJSONString(obj);
TaLicenseDetailInfo taLicenseDetailInfo = JSONObject.parseObject(jsonString, TaLicenseDetailInfo.class);
taLicenseDetailInfo.setSyncDate(new Date());
taLicenseDetailInfo.setSyncState(0);
TaLicenseDetailInfo oldTaLicenseDetailInfo = this.getOne(new LambdaQueryWrapper<TaLicenseDetailInfo>()
.eq(TaLicenseDetailInfo::getId, taLicenseDetailInfo.getId()));
if (oldTaLicenseDetailInfo != null) {
taLicenseDetailInfo.setSequenceNbr(oldTaLicenseDetailInfo.getSequenceNbr());
}
list.add(taLicenseDetailInfo);
}
this.saveOrUpdateBatch(list);
} else {
System.out.println("失败:current:" + csoftDataTzsbXKxxListParam.getCurrentPage());
System.out.println("失败:" + response.getErrorMsg());
System.out.println("失败:" + response.getErrorCode());
throw new Exception(response.getErrorMsg());
}
}
}
package com.yeejoin.amos.openapi.enums;
/**
* <pre>
* 监管附件对象属性枚举
* </pre>
*
* @author Zhang Yingbin
*/
public enum TaAccessConfigBizeEnum {
LICENSE("license", "许可信息");
/**
* 属性
*/
private String attribute;
/**
* 对象
*/
private String object;
TaAccessConfigBizeEnum(String attribute, String object) {
this.attribute = attribute;
this.object = object;
}
public String getAttribute() {
return attribute;
}
public void setAttribute(String attribute) {
this.attribute = attribute;
}
public String getObject() {
return object;
}
public void setObject(String object) {
this.object = object;
}
}
spring.application.name=AMOS-API-ACCESSAPI
server.servlet.context-path=/accessapi
server.port=11005
# jdbc_config
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.10.220:3306/amos_openapi?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=15
spring.datasource.hikari.auto-commit=true
spring.datasource.hikari.idle-timeout=30000
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
# REDIS (RedisProperties)
spring.redis.database=1
spring.redis.host=172.16.10.220
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
#注册中心地址
eureka.client.service-url.defaultZone =http://172.16.10.220:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
eureka.instance.ip-address=localhost
eureka.instance.instance-id=${eureka.instance.ip-address}:${server.port}
##emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.220:1883
emqx.client-user-name=admin
emqx.client-password=public
##biz custem properties
biz.lxyd.lift.url=http://39.106.181.149:8088/elevatorapi
# influxDB
spring.influx.url=http://139.9.173.44:8086
spring.influx.password=Yeejoin@2020
spring.influx.user=root
spring.influx.database=station_platform
spring.influx.retention_policy=default
spring.influx.retention_policy_time=30d
spring.influx.actions=10000
spring.influx.bufferLimit=20000
\ No newline at end of file
spring.application.name=AMOS-API-ACCESSAPI
server.servlet.context-path=/accessapi
server.port=11005
# jdbc_config
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://172.16.10.213:5432/per_tzs_amos_tzs_biz?currentSchema=per_tzs_amos_data_accessapi
spring.datasource.username=vbadmin
spring.datasource.password=Yeejoin@2023
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=15
spring.datasource.hikari.auto-commit=true
spring.datasource.hikari.idle-timeout=30000
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
# REDIS (RedisProperties)
spring.redis.database=1
spring.redis.host=172.16.10.210
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
#注册中心地址
eureka.client.service-url.defaultZone =http://172.16.10.210:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
eureka.instance.ip-address=localhost
eureka.instance.instance-id=${eureka.instance.ip-address}:${server.port}
##emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.210:1883
emqx.client-user-name=admin
emqx.client-password=public
##biz custem properties
biz.lxyd.lift.url=http://39.106.181.149:8088/elevatorapi
\ No newline at end of file
spring.application.name=AMOS-API-ACCESSAPI
server.servlet.context-path=/accessapi
server.port=11005
# jdbc_config
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.10.90:53306/tzs_amos_openapi?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=15
spring.datasource.hikari.auto-commit=true
spring.datasource.hikari.idle-timeout=30000
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
# REDIS (RedisProperties)
spring.redis.database=1
spring.redis.host=172.16.10.90
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
#注册中心地址
eureka.client.service-url.defaultZone =http://172.16.3.99:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
##emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.90:1883
emqx.user-name=admin
emqx.password=public
##biz custem properties
biz.lxyd.lift.url=http://39.106.181.149:8088/elevatorapi
\ No newline at end of file
spring.profiles.active=dev
server.compression.enabled=true
spring.jackson.dateFormat=yyyy-MM-dd HH:mm:ss
logging.config=classpath:logback-${spring.profiles.active}.xml
#设置文件上传的大小限制
spring.servlet.multipart.maxFileSize=3MB
spring.servlet.multipart.maxRequestSize=3MB
## redis失效时间
redis.cache.failure.time=10800
# mybatis-plus
mybatis-plus.mapper-locations=classpath:mapper/*Mapper.xml
mybatis-plus.type-aliases-super-type=org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity
mybatis-plus.global-config.db-config.id-type=ID_WORKER
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="/opt/log/qa" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/tzs.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>7</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>10mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/>
<logger name="org.mybatis" level="INFO" />
<logger name="java.sql.Connection" level="INFO"/>
<logger name="java.sql.Statement" level="INFO"/>
<logger name="java.sql.PreparedStatement" level="INFO"/>
<logger name="org.springframework" level="INFO"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="INFO"/>
<logger name="com.yeejoin" level="INFO"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="/opt/log/qa" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/tzs.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>7</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>10mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/>
<logger name="org.mybatis" level="INFO" />
<logger name="java.sql.Connection" level="INFO"/>
<logger name="java.sql.Statement" level="INFO"/>
<logger name="java.sql.PreparedStatement" level="INFO"/>
<logger name="org.springframework" level="INFO"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="INFO"/>
<logger name="com.yeejoin" level="INFO"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="/opt/log/qa" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/accessqa.log.%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>7</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
<!--日志文件最大的大小-->
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>20mb</MaxFileSize>
</triggeringPolicy>
</appender>
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="ERROR"/>
<logger name="org.mybatis" level="ERROR" />
<logger name="java.sql.Connection" level="ERROR"/>
<logger name="java.sql.Statement" level="ERROR"/>
<logger name="java.sql.PreparedStatement" level="ERROR"/>
<logger name="com.baomidou.mybatisplus" level="ERROR"/>
<logger name="org.typroject" level="ERROR"/>
<logger name="com.yeejoin" level="ERROR"/>
<logger name="org.springframework" level="INFO"/>
<!-- 日志输出级别 -->
<root level="ERROR">
<appender-ref ref="FILE" />
</root>
</configuration>
\ No newline at end of file
<?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.yeejoin.amos.api.openapi.face.orm.dao.DataDictionaryMapper">
<select id="getData" resultType="java.lang.String">
select cb_data_dictionary.name FROM cb_data_dictionary WHERE code=#{code} and type='IndustryCode'
</select>
</mapper>
<?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.yeejoin.amos.api.openapi.face.orm.dao.TaLicenseBaseInfoMapper">
<update id="updateSyncCompanyState">
UPDATE ta_license_base_info set sync_company_state = 3 WHERE sequence_nbr = #{sequenceNbr}
</update>
</mapper>
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<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>
<artifactId>amos-boot-data</artifactId>
<groupId>com.amosframework.boot</groupId>
<version>1.0.0</version>
</parent>
<artifactId>amos-boot-data-common</artifactId>
<name>amos-boot-data-common</name>
<dependencies>
</dependencies>
</project>
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<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>
<artifactId>amos-boot-data</artifactId>
<groupId>com.amosframework.boot</groupId>
<version>1.0.0</version>
</parent>
<artifactId>amos-boot-data-openapi</artifactId>
<name>amos-boot-data-openapi</name>
<dependencies>
<!-- druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- Vastbase G100 -->
<dependency>
<groupId>cn.com.vastdata</groupId>
<artifactId>vastbase</artifactId>
<version>1.0.0.2</version>
</dependency>
<!-- LOG4J -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-foundation</artifactId>
<version>${tyboot-version}</version>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-restful</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-auth</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-emq</artifactId>
<version>${tyboot-version}</version>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-event</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-opendata</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-systemctl</artifactId>
<version>${amos.version}</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-config</artifactId>
<version>${amos.version}</version>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-rdbms</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-cache</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
<version>1.4.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>19.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>1.3.7</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
##气瓶对接配置
spring.application.name=AMOS-API-OPENAPI-CYL
server.port=11001
数据库:amos_openapi_cylinder
##检验对接配置
spring.application.name=AMOS-API-OPENAPI-SPE
server.port=11002
数据库:amos_openapi_spe
##电梯对接配置
spring.application.name=AMOS-API-OPENAPI-LIFT
server.port=11003
数据库:xiy_amos_tzs_biz
##数据中心
spring.application.name=AMOS-API-OPENAPI-CYL-BIZ
server.port=11004
数据库:(XXXX自己补全)
\ No newline at end of file
package com.yeejoin.amos;
import java.net.InetAddress;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
/**
*
* <pre>
*
* </pre>
*
* @author gwb
* @version $Id: OpenapiApplication.java, v 0.1 2021年9月27日 下午3:29:30 gwb Exp $
*/
@SpringBootApplication
@EnableTransactionManagement
@EnableConfigurationProperties
@ServletComponentScan
@EnableDiscoveryClient
@EnableFeignClients
@EnableAsync
@EnableEurekaClient
@EnableScheduling
@MapperScan(value = { "org.typroject.tyboot.*.*.face.orm.dao", "com.yeejoin.amos.api.*.face.orm.dao", "org.typroject.tyboot.face.*.orm.dao*",
"com.yeejoin.amos.boot.biz.common.dao.mapper" })
@ComponentScan({ "org.typroject", "com.yeejoin.amos" })
public class OpenapiApplication {
private static final Logger logger = LogManager.getLogger(OpenapiApplication.class);
public static void main(String[] args) throws Exception {
// //license授权验证
// System.setProperty("root.path",ClassPathUtil.getPath()+"/config");
// log.info("(license.bat)url:" + ClassPathUtil.getPath()+"/config");
// A.v();
// 服务启动
ConfigurableApplicationContext context = SpringApplication.run(OpenapiApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------");
}
}
package com.yeejoin.amos.api.common.restful.utils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* 手动注入bean
* @author andrew
*
*/
@Component
public class ApplicationContextUtils implements ApplicationContextAware {
@Autowired
private static ApplicationContext context;
//方式一:传Class对象
//新建对象实例并注入其他springbean
public static <T> T newAutoWiredInstance(Class<T> beanClass){
return (T)context.getAutowireCapableBeanFactory()
.autowire(beanClass, AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT, true);
}
//方式二:传bean对象
//已经new出来的对象进行注入
public static <T> T autowire(T bean){
context.getAutowireCapableBeanFactory()
.autowireBeanProperties(bean, AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT, true);
return bean;
}
/**
* 插入ApplicationContext
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
context = applicationContext;
}
/**
* 获取ApplicationContext
*/
public static ApplicationContext getApplicationContext() {
return context;
}
/**
* 通过name获取 Bean
*/
public static Object getBean(String name) {
return getApplicationContext().getBean(name);
}
/**
* 通过class获取Bean.
*/
public static <T> T getBean(Class<T> clazz) {
return getApplicationContext().getBean(clazz);
}
/**
*通过name,以及Clazz返回指定的Bean
*/
public static <T> T getBean(String name, Class<T> clazz) {
return getApplicationContext().getBean(name, clazz);
}
}
package com.yeejoin.amos.api.common.restful.utils;
import org.springframework.http.HttpStatus;
public class ResponseHelper
{
public static <T> ResponseModel<T> buildResponse(T t) {
ResponseModel<T> response = new ResponseModel<>();
response.setResult(t);
response.setMessage("ok");
response.setStatus(HttpStatus.OK.value());
return response;
}
}
package com.yeejoin.amos.api.common.restful.utils;
import java.io.Serializable;
/**
*
* <pre>
* 返回封装对象
* </pre>
*
* @author gwb
* @version $Id: CommonResponse.java, v 0.1 2021年9月28日 下午4:37:40 gwb Exp $
*/
public class ResponseModel<T> implements Serializable {
/**
* <pre>
*
* </pre>
*/
private static final long serialVersionUID = 2969089929549147825L;
/**
* 响应数据
*/
private T result ;
/**
* 状态码
*/
private int status;
/**
* 提示信息
*/
private String message = "";
public ResponseModel(){
}
public T getResult()
{
return result;
}
public void setResult(T result)
{
this.result = result;
}
public int getStatus()
{
return status;
}
public void setStatus(int status)
{
this.status = status;
}
public String getMessage()
{
return message;
}
public void setMessage(String message)
{
this.message = message;
}
@Override
public String toString()
{
return "CommonResponse [status=" + status + ", result=" + result + ", message=" + message + "]";
}
}
package com.yeejoin.amos.api.openapi.aop;
import com.yeejoin.amos.api.openapi.constant.Constant;
import com.yeejoin.amos.api.openapi.face.model.BizTokenModel;
import com.yeejoin.amos.component.feign.config.TokenOperation;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.core.auth.exception.AuthException;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.servlet.http.HttpServletRequest;
@Aspect
@Component
@Order(value = 0)
public class ControllerAop {
private static final Logger logger = LogManager.getLogger(ControllerAop.class);
@Autowired
private RedisTemplate redisTemplate;
@Pointcut("(execution(public * com.yeejoin.amos.api.openapi.controller..*(..))) ")
public void userCache() {
}
@Before("userCache()")
public void doBefore(JoinPoint joinPoint) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
logger.info("request>>>",request);
// 不需要添加请求头的接口
String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany","/openapi/bizToken/applyToken","/openapi/bizToken/getAppId","/lift/upload","/lift/status","/lift/run","/lift/fault","/lift/video/preview","/cylinderPage/serviceProvider","/cylinderPage/getTableInfo","/cylinderPage/initCylinderNum","/openapi/appId/setAppId"};
// 获取请求路径
for(String uri : url) {
if(request.getRequestURI().indexOf(uri) != -1) {
logger.info("uri>>>",uri);
return;
}
}
//TODO tyboot 框架拦截器已缓存数据
String token = RequestContext.getToken();
if (ValidationUtil.isEmpty(token)) {
token = request.getParameterMap().get("access_token")[0];
}
if (token != null) {
fillRequestContext(token);
}
boolean validToken = TokenOperation.refresh(token);
if(!validToken) {
throw new AuthException("请求未包含认证信息.");
}
}
private void fillRequestContext(String token) {
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,token);
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
if(null == bizTokenModel) {
throw new AuthException("请求未包含认证信息.");
}
String product = bizTokenModel.getProduct();
String appKey = bizTokenModel.getAppKey();
RequestContext.setToken(token);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
}
}
package com.yeejoin.amos.api.openapi.config;
import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringEncoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextListener;
/**
* @Author: xl
* @Description:
* @Date: 2020/3/30 16:26
*/
@Configuration
public class MultipartSupportConfig {
@Autowired
private ObjectFactory<HttpMessageConverters> messageConverters;
@Bean
public Encoder feignFormEncoder() {
return new SpringFormEncoder(new SpringEncoder(messageConverters));
}
/**
* 创建Feign请求拦截器,在发送请求前设置认证的token,各个微服务将token设置到环境变量中来达到通用
* @return
*/
@Bean
public RequestContextListener requestInterceptor() {
return new RequestContextListener();
}
}
package com.yeejoin.amos.api.openapi.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration(value="MybatisPlusConfig")
public class MybatisPlusConfig {
@Bean
public PaginationInterceptor paginationInterceptor()
{
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
paginationInterceptor.setLimit(50000);
paginationInterceptor.setDialectType(DbType.POSTGRE_SQL.getDb());
return paginationInterceptor;
}
// @Bean
// public MybatisPlusInterceptor mybatisPlusInterceptor() {
// MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2));
// return interceptor;
// }
}
package com.yeejoin.amos.api.openapi.constant;
public class Constant {
public static final String TOKEN_PREFIX = "OPENAPI_";
public static final String SECRETKEY = "tzs";
}
package com.yeejoin.amos.api.openapi.controller;
import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.api.openapi.constant.Constant;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
@RestController
@RequestMapping(value = "/appId")
@Api(tags = "appid-生成appid类")
public class AppIdMain {
private static final Logger logger = LogManager.getLogger(AppIdMain.class);
// public static void main(String[] args) {
// String appId = DesUtil.encode("000010", Constant.SECRETKEY);
// logger.info("appId信息:", appId);
// System.out.println("appId信息:" + appId);
// }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "生成AppId")
@GetMapping(value = "/setAppId")
public ResponseModel<String> applyAppId (
@RequestParam String apiCompanyCode) throws Exception
{
logger.info("appId信息:",apiCompanyCode);
String appId = DesUtil.encode(apiCompanyCode, Constant.SECRETKEY);
logger.info("appToken信息:",appId);
return ResponseHelper.buildResponse(appId);
}
}
package com.yeejoin.amos.api.openapi.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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 org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.doc.TycloudResource;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderFillingCheckModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderFillingExamineModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderFillingExamineModelList;
import com.yeejoin.amos.api.openapi.face.model.CylinderFillingModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderFillingModelList;
import com.yeejoin.amos.api.openapi.face.model.CylinderFillingRecordModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderInfoModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderInfoModelList;
import com.yeejoin.amos.api.openapi.face.model.CylinderInspectionModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderInspectionModelList;
import com.yeejoin.amos.api.openapi.face.model.CylinderTagsModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderTagsModelList;
import com.yeejoin.amos.api.openapi.face.model.CylinderUnitModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderUnitModelList;
import com.yeejoin.amos.api.openapi.face.service.CylinderFillingCheckService;
import com.yeejoin.amos.api.openapi.face.service.CylinderFillingExamineService;
import com.yeejoin.amos.api.openapi.face.service.CylinderFillingRecordService;
import com.yeejoin.amos.api.openapi.face.service.CylinderFillingService;
import com.yeejoin.amos.api.openapi.face.service.CylinderInfoService;
import com.yeejoin.amos.api.openapi.face.service.CylinderInspectionService;
import com.yeejoin.amos.api.openapi.face.service.CylinderTagsService;
import com.yeejoin.amos.api.openapi.face.service.CylinderUnitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
@RestController
@RequestMapping(value = "/cylinder")
@Api(tags = "cylinder-气瓶数据对接")
public class CylinderController {
private static final Logger logger = LogManager.getLogger(CylinderController.class);
@Autowired
private CylinderUnitService cylinderUnitService;
@Autowired
private CylinderFillingCheckService cylinderFillingCheckService;
@Autowired
private CylinderFillingExamineService cylinderFillingExamineService;
@Autowired
private CylinderFillingRecordService cylinderFillingRecordService;
@Autowired
private CylinderFillingService cylinderFillingService;
@Autowired
private CylinderInfoService cylinderInfoService;
@Autowired
private CylinderInspectionService cylinderInspectionService;
@Autowired
private CylinderTagsService cylinderTagsService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "气瓶企业信息")
@PostMapping(value = "/unit")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> cylinderUnit(@RequestBody List<CylinderUnitModel> unitData) throws Exception {
return ResponseHelper.buildResponse(cylinderUnitService.createCylinderUnit(unitData));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "气瓶基础数据")
@PostMapping(value = "/info")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> cylinderInfo(@RequestBody List<CylinderInfoModel> infoData) throws Exception {
return ResponseHelper.buildResponse(cylinderInfoService.createCylinderInfo(infoData));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "气瓶标签数据")
@PostMapping(value = "/tag")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> cylinderTagInfo(@RequestBody List<CylinderTagsModel> tagData) throws Exception {
return ResponseHelper.buildResponse(cylinderTagsService.createCylinderTag(tagData));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "气瓶检验数据")
@PostMapping(value = "/inspection")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> cylinderInspectionInfo(@RequestBody List<CylinderInspectionModel> inspectionData) throws Exception {
return ResponseHelper.buildResponse(cylinderInspectionService.createCylinderInspection(inspectionData));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "气瓶充装数据")
@PostMapping(value = "/filling")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> cylinderFillingInfo(@RequestBody String fillingData) throws Exception {
logger.info("气瓶充装数据"+fillingData);
JSONObject jsonobject = JSONObject.fromObject(fillingData);
Map<String, Class> classMap = new HashMap<String, Class>();
classMap.put("fillingBefore", CylinderFillingModel.class);
classMap.put("filling", CylinderFillingRecordModel.class);
classMap.put("fillingAfter", CylinderFillingCheckModel.class);
CylinderFillingModelList cylinderFillingModelList = (CylinderFillingModelList) JSONObject.toBean(jsonobject,
CylinderFillingModelList.class, classMap);
List<CylinderFillingModel> fillingBefores = cylinderFillingModelList.getFillingBefore();
List<CylinderFillingRecordModel> fillings = cylinderFillingModelList.getFilling();
List<CylinderFillingCheckModel> fillingAfters = cylinderFillingModelList.getFillingAfter();
if (ValidationUtil.isEmpty(fillingBefores) && ValidationUtil.isEmpty(fillings) && ValidationUtil.isEmpty(fillingAfters)) {
throw new BadRequest("液化气体气瓶充装信息-充装前检查信息、液化气体气瓶充装信息-充装记录信息、液化气体气瓶充装信息-充装后复查信息为空.");
}
cylinderFillingService.createCylinderFillingBefore(fillingBefores);
cylinderFillingRecordService.createCylinderFilling(fillings);
cylinderFillingCheckService.createCylinderFillingAfter(fillingAfters);
// if (ValidationUtil.isEmpty(fillings)) {
// throw new BadRequest("液化气体气瓶充装信息-充装记录信息为空.");
// }else {
// }
// if (ValidationUtil.isEmpty(fillingAfters)) {
// throw new BadRequest("液化气体气瓶充装信息-充装后复查信息为空.");
// }else {
// }
return ResponseHelper.buildResponse("");
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "气瓶充装审核数据")
@PostMapping(value = "/fillingAudit")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> cylinderFillingAudit(@RequestBody List<CylinderFillingExamineModel> fillingAuditData) throws Exception {
return ResponseHelper.buildResponse(cylinderFillingExamineService.createCylinderFillingExamine(fillingAuditData));
}
}
package com.yeejoin.amos.api.openapi.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderTableModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderUnitTree;
import com.yeejoin.amos.api.openapi.face.orm.entity.OpenapiBizToken;
import com.yeejoin.amos.api.openapi.face.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping(value = "/cylinderPage")
@Api(tags = "气瓶首页controller")
public class CylinderPageController {
private static final Logger logger = LogManager.getLogger(CylinderPageController.class);
@Autowired
private CylinderUnitService cylinderUnitService;
@Autowired
private CylinderFillingCheckService cylinderFillingCheckService;
@Autowired
private CylinderFillingExamineService cylinderFillingExamineService;
@Autowired
private CylinderFillingRecordService cylinderFillingRecordService;
@Autowired
private CylinderFillingService cylinderFillingService;
@Autowired
private CylinderInfoService cylinderInfoService;
@Autowired
private CylinderInspectionService cylinderInspectionService;
@Autowired
private CylinderTagsService cylinderTagsService;
@Autowired
private OpenapiBizTokenService openapiBizTokenService;
@Autowired
private CylinderDateInfoService cylinderDateInfoService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "服务商树")
@GetMapping(value = "/serviceProvider")
public ResponseModel<List<CylinderUnitTree>> cylinderUnit() throws Exception {
List<CylinderUnitTree> result = new ArrayList<>();
List<String> serviceList = openapiBizTokenService.getServiceList();
serviceList.stream().forEach(s -> {
CylinderUnitTree temp = new CylinderUnitTree();
List<OpenapiBizToken> children = openapiBizTokenService.list(new LambdaQueryWrapper<OpenapiBizToken>().eq(OpenapiBizToken::getDeveloperAgency,s)
.eq(OpenapiBizToken::getDataType,"cyl"));
List<CylinderUnitTree> childrenList = new ArrayList<>();
children.stream().forEach(c ->{
CylinderUnitTree tt = new CylinderUnitTree();
tt.setUnitName(c.getApiCompanyName());
tt.setAppId(c.getAppId());
childrenList.add(tt);
});
temp.setUnitName(s);
temp.setChildren(childrenList);
result.add(temp);
});
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "根据搜索信息获取表格数据")
@GetMapping(value = "/getTableInfo")
public ResponseModel<List<CylinderTableModel>> cylinderTableInfo(@RequestParam(value = "serviceName",required = false) String serviceName,
@RequestParam(value = "appId",required = false) String appId,
@RequestParam(value = "startTime",required = false) String startTime,
@RequestParam(value = "endTime",required = false) String endTime) {
// 先同步或者更新今日数据
// cylinderDateInfoService.updateTodayDate();
// 查询数据
List<CylinderTableModel> result = cylinderDateInfoService.selectTodayDate(serviceName, appId, startTime, endTime);
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "同步气瓶数据")
@GetMapping(value = "/initCylinderNum")
public ResponseModel<Boolean> initCylinderNum() {
Boolean result = cylinderDateInfoService.initCylinderNum();
return ResponseHelper.buildResponse(result);
};
}
package com.yeejoin.amos.api.openapi.controller;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.api.openapi.face.model.EquipmentModel;
import com.yeejoin.amos.api.openapi.face.orm.entity.PageParam;
import com.yeejoin.amos.api.openapi.face.service.EquipmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 特种设备监管controller
*/
@RestController
@Api(tags = "设备Api")
@RequestMapping(value = "/equipment")
public class EquipmentController {
@Autowired
EquipmentService iEquipmentService;
/**
* 查询监管设备列表
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = true)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "查询监管设备列表", notes = "查询监管设备列表")
public ResponseModel<IPage<EquipmentModel>> page(PageParam pageParam,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) {
return ResponseHelper.buildResponse(iEquipmentService.page(pageParam, startTime, endTime));
}
}
package com.yeejoin.amos.api.openapi.controller;
import java.util.Iterator;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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 org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.doc.TycloudResource;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
@RestController
@RequestMapping(value = "/filestorage")
@Api(tags = "filestorage-上传附件数据对接")
public class FilesController {
private static final Logger logger = LogManager.getLogger(FilesController.class);
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "气瓶充装审核数据")
@PostMapping(value = "/")
public ResponseModel<String> uploadCylinderFiles (
@RequestBody MultipartFile file) throws Exception
{
logger.info(file);
JSONObject jsonObj = uploadFile(file,"cylinder");
return ResponseHelper.buildResponse(jsonObj.toString());
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "检验报告数据")
@PostMapping(value = "/csei")
public ResponseModel<String> uploadCseiFiles (
@RequestBody MultipartFile file) throws Exception
{
logger.info(file);
JSONObject jsonObj = uploadFile(file,"csei");
return ResponseHelper.buildResponse(jsonObj.toString());
}
private JSONObject uploadFile(MultipartFile file,String tag) {
if (ValidationUtil.isEmpty(file)){
throw new BadRequest("参数校验失败.");
}
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file, "tzs/"+tag);
JSONObject jsonObj = new JSONObject();
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
String urlString=it.next();
jsonObj.put("fileUrl", urlString);
jsonObj.put("fileName", map.get(urlString));
}
}
return jsonObj;
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "上传附件")
@PostMapping("/supma")
public ResponseModel<JSONObject> upload(@RequestBody MultipartFile file){
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file);
JSONObject jsonObj = new JSONObject();
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
String urlString=it.next();
jsonObj.put("fileUrl", urlString);
jsonObj.put("fileName", map.get(urlString));
}
return ResponseHelper.buildResponse(jsonObj);
}
}
package com.yeejoin.amos.api.openapi.controller;
import java.util.HashMap;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.doc.TycloudResource;
import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.api.openapi.face.model.InspectionModel;
import com.yeejoin.amos.api.openapi.face.model.InspectionModelList;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
/**
*
* <pre>
* 特种设备检验对接
* </pre>
*
* @author gwb
* @version $Id: InspectionController.java, v 0.1 2021年11月8日 下午6:47:54 gwb Exp $
*/
@RestController
@RequestMapping(value = "/v1/inspection")
@Api(tags = "inspection-特种设备检验对接")
public class InspectionController
{
private static final Logger logger = LogManager.getLogger(InspectionController.class);
@SuppressWarnings("rawtypes")
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "设备检验数据上传")
@RequestMapping(value = "sendData", method = RequestMethod.POST)
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> multUploadInspectionData (
@RequestBody String inspectionModelData) throws Exception
{
logger.info(inspectionModelData);
JSONObject jsonobject = JSONObject.fromObject(inspectionModelData);
Map<String, Class> classMap = new HashMap<String, Class>();
classMap.put("data", InspectionModel.class);
InspectionModelList inspectionModelList = (InspectionModelList)JSONObject.toBean(jsonobject,InspectionModelList.class,classMap);
return ResponseHelper.buildResponse("");
}
}
package com.yeejoin.amos.api.openapi.controller;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.doc.TycloudResource;
import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.api.openapi.face.model.ElevatorAlarmModel;
import com.yeejoin.amos.api.openapi.face.model.ElevatorAlarmModelList;
import com.yeejoin.amos.api.openapi.face.model.ElevatorStatusModel;
import com.yeejoin.amos.api.openapi.face.model.ElevatorStatusModelList;
import com.yeejoin.amos.api.openapi.face.model.ElevatorVideoModel;
import com.yeejoin.amos.api.openapi.face.service.ElevatorAlarmService;
import com.yeejoin.amos.api.openapi.face.service.ElevatorStatusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
/**
*
* <pre>
* 电梯物联对接
* </pre>
*
* @author gwb
* @version $Id: ElevatorStatusController.java, v 0.1 2021年9月28日 上午9:11:38 gwb Exp $
*/
@RestController
@RequestMapping(value = "/lift")
@Api(tags = "lift-电梯物联对接")
public class LiftController
{
@Autowired
private ElevatorStatusService elevatorStatusService;
@Autowired
private ElevatorAlarmService elevatorAlarmService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "电梯运行状态数据高频上传请求")
@RequestMapping(value = "upload/{registerCode}", method = RequestMethod.GET)
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> highUpload (
@PathVariable(value = "registerCode") String registerCode) throws Exception
{
elevatorStatusService.highUpload(registerCode);
return ResponseHelper.buildResponse("");
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "获取最近一次电梯运行状态数据")
@RequestMapping(value = "status/{registerCode}", method = RequestMethod.GET)
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<ElevatorStatusModel> getLatelyStatus (
@PathVariable(value = "registerCode") String registerCode,
@RequestParam(value = "highUpload", required = false) Boolean highUpload) throws Exception
{
//默认状态数据不进行高频上传
if (ValidationUtil.isEmpty(highUpload))
{
highUpload = false;
}
return ResponseHelper.buildResponse(elevatorStatusService.getLatelyStatus(registerCode, highUpload));
}
@SuppressWarnings("rawtypes")
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "电梯运行状态数据上传")
@RequestMapping(value = "run", method = RequestMethod.POST)
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> multUploadRunData (
@RequestParam(value = "access_token", required = false) String access_token,
@RequestBody String runStatusData) throws Exception
{
JSONObject jsonobject = JSONObject.fromObject(runStatusData);
Map<String, Class> classMap = new HashMap<String, Class>();
classMap.put("lift", ElevatorStatusModel.class);
ElevatorStatusModelList elevatorStatusModelList = (ElevatorStatusModelList)JSONObject.toBean(jsonobject,ElevatorStatusModelList.class,classMap);
elevatorStatusService.multCreateElevatorStatus(elevatorStatusModelList.getLift());
return ResponseHelper.buildResponse("");
}
@SuppressWarnings("rawtypes")
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "电梯故障数据上传")
@RequestMapping(value = "fault", method = RequestMethod.POST)
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> multUploadAlarmData (
@RequestParam(value = "access_token", required = false) String access_token,
@RequestBody String faultData) throws Exception
{
JSONObject jsonobject = JSONObject.fromObject(faultData);
Map<String, Class> classMap = new HashMap<String, Class>();
classMap.put("lift", ElevatorAlarmModel.class);
ElevatorAlarmModelList elevatorAlarmModelList = (ElevatorAlarmModelList)JSONObject.toBean(jsonobject,ElevatorAlarmModelList.class,classMap);
elevatorAlarmService.multCreateElevatorAlarm(elevatorAlarmModelList.getLift());
return ResponseHelper.buildResponse("");
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "获取电梯视频预览地址")
@RequestMapping(value = "video/preview/{registerCode}", method = RequestMethod.GET)
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<ElevatorVideoModel> videoPreview (
@PathVariable(value = "registerCode") String registerCode) throws Exception
{
ElevatorVideoModel elevatorVideoModel = elevatorStatusService.videoPreview(registerCode);
return ResponseHelper.buildResponse(elevatorVideoModel);
}
}
package com.yeejoin.amos.api.openapi.controller;
import java.util.HashMap;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
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.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.doc.TycloudResource;
import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.api.openapi.constant.Constant;
import com.yeejoin.amos.api.openapi.face.model.InspectionModel;
import com.yeejoin.amos.api.openapi.face.model.InspectionModelList;
import com.yeejoin.amos.api.openapi.face.service.ElevatorStatusService;
import com.yeejoin.amos.api.openapi.face.service.OpenapiBizTokenService;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
/**
*
* <pre>
* 企业数据对接票据管理
* </pre>
*
* @author gwb
* @version $Id: InspectionController.java, v 0.1 2021年11月8日 下午6:47:54 gwb Exp $
*/
@RestController
@RequestMapping(value = "/bizToken")
@Api(tags = "bizToken-企业数据对接票据管理")
public class OpenapiBizTokenController
{
private static final Logger logger = LogManager.getLogger(OpenapiBizTokenController.class);
@Autowired
private OpenapiBizTokenService openapiBizTokenService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "申请登录令牌")
@GetMapping(value = "/applyToken")
public ResponseModel<String> applyToken (
@RequestParam String appId) throws Exception
{
logger.info("appId信息:",appId);
String appToken = openapiBizTokenService.getByAppId(appId);
logger.info("appToken信息:",appToken);
return ResponseHelper.buildResponse(appToken);
}
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @ApiOperation(value = "获取APPID")
// @GetMapping(value = "/getAppId")
// public ResponseModel<String> getAppId (
// @RequestParam String companyCode) throws Exception
// {
// String appId = DesUtil.encode(companyCode, Constant.SECRETKEY);
// logger.info("appId信息:",appId);
// return ResponseHelper.buildResponse(appId);
// }
//
}
package com.yeejoin.amos.api.openapi.controller.event;
import java.util.Date;
import java.util.HashMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.component.event.RestEvent;
import org.typroject.tyboot.component.event.RestEventHandler;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.api.openapi.constant.Constant;
import com.yeejoin.amos.api.openapi.face.model.BizTokenModel;
import com.yeejoin.amos.api.openapi.face.model.OpenapiLogModel;
import com.yeejoin.amos.api.openapi.face.service.OpenapiLogService;
/**
*
* <pre>
* 第三方API对接日志处理
* </pre>
*
* @author gwb
* @version $Id: OpenapiLogEventHandler.java, v 0.1 2021年11月10日 下午5:38:32 gwb Exp $
*/
@Component("openapiLogEventHandler")
public class OpenapiLogEventHandler extends RestEventHandler {
static ObjectMapper objectMapper = new ObjectMapper();
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private OpenapiLogService openapiLogService;
@Override
protected void handleEvent(RestEvent restEvent) throws Exception {
OpenapiLogModel openapiLogModel = new OpenapiLogModel();
openapiLogModel.setMethodLabel(restEvent.getMethodLabel());
openapiLogModel.setMethodName(restEvent.getMethodName());
openapiLogModel.setParams(objectMapper.writeValueAsString(restEvent.getParams()));
openapiLogModel.setResult(objectMapper.writeValueAsString(restEvent.getSource()));
openapiLogModel.setRemoteIp(restEvent.getRequestContextModel().getRequestIP());
String token = restEvent.getRequestContextModel().getToken();
openapiLogModel.setToken(token);
openapiLogModel.setTraceId(restEvent.getRequestContextModel().getTraceId());
openapiLogModel.setAgencyCode(restEvent.getRequestContextModel().getAgencyCode());
openapiLogModel.setAppCode(restEvent.getRequestContextModel().getAppKey());
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,token);
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
openapiLogModel.setAppId(bizTokenModel.getAppId());
openapiLogService.createWithModel(openapiLogModel);
}
}
package com.yeejoin.amos.api.openapi.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@AllArgsConstructor
@Getter
public enum EightCategorySubformEnum {
//起重机械
SAFETYPROTECTIONDEVICE("safetyProtectionDevice", "mid_equip_protection_devices","com.yeejoin.amos.api.openapi.face.orm.entity.ProtectionDevices","com.yeejoin.amos.api.openapi.face.service.ProtectionDevicesServiceImpl"),
MAINPART("mainPart", "mid_equip_main_parts","com.yeejoin.amos.api.openapi.face.orm.entity.MainParts","com.yeejoin.amos.api.openapi.face.service.MainPartsServiceImpl"),
//厂车
MAINPARTS("mainParts", "mid_equip_main_parts","com.yeejoin.amos.api.openapi.face.orm.entity.MainParts","com.yeejoin.amos.api.openapi.face.service.MainPartsServiceImpl"),
//索道
MAINCOMPONENTS("mainComponents", "mid_equip_main_parts","com.yeejoin.amos.api.openapi.face.orm.entity.MainParts","com.yeejoin.amos.api.openapi.face.service.MainPartsServiceImpl"),
//锅炉
SAFETYACCESSORIESANDRELATEDDEVICES("safetyAccessoriesAndRelatedDevices", "mid_equip_protection_devices","com.yeejoin.amos.api.openapi.face.orm.entity.ProtectionDevices","com.yeejoin.amos.api.openapi.face.service.ProtectionDevicesServiceImpl"),
//压力容器
FIXEDSAFETYACCESSORY("fixedSafetyAccessory", "mid_equip_protection_devices","com.yeejoin.amos.api.openapi.face.orm.entity.ProtectionDevices","com.yeejoin.amos.api.openapi.face.service.ProtectionDevicesServiceImpl"),
GASCYLINDER("gasCylinder", "mid_equip_main_parts","com.yeejoin.amos.api.openapi.face.orm.entity.MainParts","com.yeejoin.amos.api.openapi.face.service.MainPartsServiceImpl"),
GASCYLINDERACCESSORIES("gasCylinderAccessories", "mid_equip_protection_devices","com.yeejoin.amos.api.openapi.face.orm.entity.ProtectionDevices","com.yeejoin.amos.api.openapi.face.service.ProtectionDevicesServiceImpl"),
//压力管道
PIPEINFO("pipeInfo", "mid_equip_main_parts","com.yeejoin.amos.api.openapi.face.orm.entity.MainParts","com.yeejoin.amos.api.openapi.face.service.MainPartsServiceImpl");
String code;
String value;
String classPath;
String servicePath;
public static Map<String,String> classPathmap = new HashMap<>();
public static Map<String,String> servicePathmap = new HashMap<>();
static {
for(EightCategorySubformEnum e: EightCategorySubformEnum.values()){
classPathmap.put(e.code, e.classPath);
servicePathmap.put(e.code, e.servicePath);
}
}
}
package com.yeejoin.amos.api.openapi.enums;
import com.yeejoin.amos.api.openapi.face.orm.entity.EquipTechParamBoiler;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@AllArgsConstructor
@Getter
public enum EquipTypeEnum {
elevator("elevator","","com.yeejoin.amos.api.openapi.face.orm.entity.EquipTechParamElevator","com.yeejoin.amos.api.openapi.face.service.EquipTechParamElevatorService"),
lifting("lifting","safetyProtectionDevice,mainPart","com.yeejoin.amos.api.openapi.face.orm.entity.EquipTechParamLifting","com.yeejoin.amos.api.openapi.face.service.EquipTechParamLiftingService"),
vehicle("vehicle","mainParts","com.yeejoin.amos.api.openapi.face.orm.entity.EquipTechParamVehicle","com.yeejoin.amos.api.openapi.face.service.EquipTechParamVehicleService"),
ropeway("ropeway","mainComponents","com.yeejoin.amos.api.openapi.face.orm.entity.EquipTechParamRopeway","com.yeejoin.amos.api.openapi.face.service.EquipTechParamRopewayService"),
rides("rides","","com.yeejoin.amos.api.openapi.face.orm.entity.EquipTechParamRides","com.yeejoin.amos.api.openapi.face.service.EquipTechParamRidesService"),
boiler("boiler","safetyAccessoriesAndRelatedDevices","com.yeejoin.amos.api.openapi.face.orm.entity.EquipTechParamBoiler","com.yeejoin.amos.api.openapi.face.service.EquipTechParamBoilerService"),
vessel("vessel","fixedSafetyAccessory,gasCylinder,gasCylinderAccessories","com.yeejoin.amos.api.openapi.face.orm.entity.EquipTechParamVessel","com.yeejoin.amos.api.openapi.face.service.EquipTechParamVesselService"),
pipeline("pipeline","pipeInfo","com.yeejoin.amos.api.openapi.face.orm.entity.EquipTechParamPipeline","com.yeejoin.amos.api.openapi.face.service.EquipTechParamPipelineService");
String type;
String fileNames;
String classPath;
String servicePath;
public static Map<String,String> classPathmap = new HashMap<>();
public static Map<String,String> servicePathmap = new HashMap<>();
public static Map<String,String> serviceFileListmap = new HashMap<>();
static {
for(EquipTypeEnum e: EquipTypeEnum.values()){
classPathmap.put(e.type, e.classPath);
servicePathmap.put(e.type, e.servicePath);
serviceFileListmap.put(e.type,e.fileNames);
}
}
}
package com.yeejoin.amos.api.openapi.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.*;
@AllArgsConstructor
@Getter
public enum InspectionEnum {
HG("6040", "合格"),
BHG("6041", "不合格"),
FJHG("6042", "复检合格"),
FJBHG("6043", "复检不合格"),
QT("6044", "其他"),
JDJC("6038", "监督检查"),
DQJC("6039", "定期检查"),
ZXJC("6206", "自行检测(电梯)");
String code;
String value;
public static Map<String,String> codeValue = new HashMap<>();
static {
for(InspectionEnum e: InspectionEnum.values()){
codeValue.put(e.code, e.value);
}
}
}
package com.yeejoin.amos.api.openapi.enums;
/**
* <pre>
* 监管附件对象属性枚举
* </pre>
*
* @author Zhang Yingbin
*/
public enum JgFileAttributeEnum {
DESIGN_FILE("designFile",JgFileObjectEnum.DESIGN_INFO.getObject()),
DESIGN_CODE("designCode",JgFileObjectEnum.DESIGN_INFO.getObject()),
PRODUCE_STANDARD("produceStandard",JgFileObjectEnum.PRODUCE_INFO.getObject()),
PRODUCT_CERTIFICATE("productCertificate",JgFileObjectEnum.PRODUCE_INFO.getObject()),
IUM_INSTRUCTIONS("iumInstructions",JgFileObjectEnum.PRODUCE_INFO.getObject()),
SUPERVISION_CERT("supervisionCert",JgFileObjectEnum.PRODUCE_INFO.getObject()),
CE_CERT("ceCert",JgFileObjectEnum.PRODUCE_INFO.getObject()),
USE_REGIST_CERTIFICATE("useRegistCertificate",JgFileObjectEnum.REGISTRATION_INFO.getObject()),
REPAIR_INFORM("repairInform",JgFileObjectEnum.MAINTENANCE_INFO.getObject()),
INSPECTION_REPORT("inspectionReport",JgFileObjectEnum.INSPECTION_INFO.getObject()),
BUSINESS_LICENSE("businessLicense",JgFileObjectEnum.ENTERPRISE_INFO.getObject()),
QUALIFICATION_CERT("qualificationCert",JgFileObjectEnum.STAFF_QUALIF_INFO.getObject()),
GOVERNOR_EFFI_REPORT("governorEffiReport",JgFileObjectEnum.ELEVATOR_TECH_INFO.getObject());
/**
* 属性
*/
private String attribute;
/**
* 对象
*/
private String object;
JgFileAttributeEnum(String attribute, String object) {
this.attribute = attribute;
this.object = object;
}
public String getAttribute() {
return attribute;
}
public void setAttribute(String attribute) {
this.attribute = attribute;
}
public String getObject() {
return object;
}
public void setObject(String object) {
this.object = object;
}
}
package com.yeejoin.amos.api.openapi.enums;
/**
* <pre>
* 监管附件对象枚举
* </pre>
*
* @author Zhang Yingbin
*/
public enum JgFileObjectEnum {
DESIGN_INFO("designInf"),
PRODUCE_INFO("produceInfo"),
REGISTRATION_INFO("registrationInfo"),
MAINTENANCE_INFO("maintenanceInfo"),
INSPECTION_INFO("inspectionInfo"),
ENTERPRISE_INFO("enterpriseInfo"),
STAFF_QUALIF_INFO("staffQualifInfo"),
ELEVATOR_TECH_INFO("elevatorTechInfo");
/**
* 对象
*/
private String object;
public String getObject() {
return object;
}
public void setObject(String object) {
this.object = object;
}
JgFileObjectEnum(String object) {
this.object = object;
}
}
package com.yeejoin.amos.api.openapi.enums;
/**
*
* <pre>
* 电梯故障处置状态枚举
* </pre>
*
* @author gwb
* @version $Id: LiftServiceModelEnum.java, v 0.1 2021年9月29日 上午9:24:15 gwb Exp $
*/
public enum LiftAlarmDealStatusEnum{
DISPOSAL_COMPLETED(0,"处置完成"),
FAULT_OCCURRENCE(1,"故障发生"),
GIVE_NOTICE(2,"发出通知"),
DISPOSAL_RESPONSE(3,"处置响应"),
DISPOSAL_SITE(4,"处置到场"),
FALSE_ALARM(5,"误报");
/**
* 编码
*/
private Integer code;
/**
* 名称
*/
private String name;
// 构造方法
private LiftAlarmDealStatusEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName()
{
return name;
}
public static LiftAlarmDealStatusEnum getEnum(Integer code)
{
for (LiftAlarmDealStatusEnum liftAlarmDealStatusEnum : LiftAlarmDealStatusEnum.values())
{
if (liftAlarmDealStatusEnum.getCode().equals(code))
{
return liftAlarmDealStatusEnum;
}
}
return null;
}
}
package com.yeejoin.amos.api.openapi.enums;
/**
*
* <pre>
* 电梯安全回路状态枚举
* </pre>
*
* @author gwb
* @version $Id: LiftCircuitStatusEnum.java, v 0.1 2021年9月29日 上午9:23:00 gwb Exp $
*/
public enum LiftCircuitStatusEnum{
NORMAL(0,"正常"),
BREAK (1,"断开");
/**
* 编码
*/
private Integer code;
/**
* 名称
*/
private String name;
// 构造方法
private LiftCircuitStatusEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName()
{
return name;
}
public static LiftCircuitStatusEnum getEnum(Integer code)
{
for (LiftCircuitStatusEnum liftCircuitStatusEnum : LiftCircuitStatusEnum.values())
{
if (liftCircuitStatusEnum.getCode().equals(code))
{
return liftCircuitStatusEnum;
}
}
return null;
}
}
package com.yeejoin.amos.api.openapi.enums;
/**
*
* <pre>
* 电梯接触器状态枚举
* </pre>
*
* @author gwb
* @version $Id: LiftContactorStatusEnum.java, v 0.1 2021年9月29日 上午9:08:16 gwb Exp $
*/
public enum LiftContactorStatusEnum{
PULL(0,"吸合"),
BREAK (1,"断开");
/**
* 编码
*/
private Integer code;
/**
* 名称
*/
private String name;
// 构造方法
private LiftContactorStatusEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName()
{
return name;
}
public static LiftContactorStatusEnum getEnum(Integer code)
{
for (LiftContactorStatusEnum liftContactorStatusEnum : LiftContactorStatusEnum.values())
{
if (liftContactorStatusEnum.getCode().equals(code))
{
return liftContactorStatusEnum;
}
}
return null;
}
}
package com.yeejoin.amos.api.openapi.enums;
/**
*
* <pre>
* 电梯轿厢运行方向枚举
* </pre>
*
* @author gwb
* @version $Id: LiftDirectionEnum.java, v 0.1 2021年9月29日 上午9:33:40 gwb Exp $
*/
public enum LiftDirectionEnum{
No (1,"无方向"),
Up (2,"上行"),
Down (3,"下行");
/**
* 编码
*/
private Integer code;
/**
* 名称
*/
private String name;
// 构造方法
private LiftDirectionEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName()
{
return name;
}
public static LiftDirectionEnum getEnum(Integer code)
{
for (LiftDirectionEnum liftDirectionEnum : LiftDirectionEnum.values())
{
if (liftDirectionEnum.getCode().equals(code))
{
return liftDirectionEnum;
}
}
return null;
}
}
package com.yeejoin.amos.api.openapi.enums;
/**
*
* <pre>
* 电梯关门到位枚举
* </pre>
*
* @author gwb
* @version $Id: LiftDoorStatusEnum.java, v 0.1 2021年9月29日 上午9:39:52 gwb Exp $
*/
public enum LiftDoorStatusEnum{
NOT_CLOSED (0,"无关门到位信号"),
CLOSE (1,"关门到位");
/**
* 编码
*/
private Integer code;
/**
* 名称
*/
private String name;
// 构造方法
private LiftDoorStatusEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName()
{
return name;
}
public static LiftDoorStatusEnum getEnum(Integer code)
{
for (LiftDoorStatusEnum liftDoorStatusEnum : LiftDoorStatusEnum.values())
{
if (liftDoorStatusEnum.getCode().equals(code))
{
return liftDoorStatusEnum;
}
}
return null;
}
}
package com.yeejoin.amos.api.openapi.enums;
/**
*
* <pre>
* 轿厢内是否有人状态枚举
* </pre>
*
* @author gwb
* @version $Id: LiftPersonFlagEnum.java, v 0.1 2021年9月29日 上午9:23:00 gwb Exp $
*/
public enum LiftPersonFlagEnum{
NO(0,"无"),
YES (1,"有");
/**
* 编码
*/
private Integer code;
/**
* 名称
*/
private String name;
// 构造方法
private LiftPersonFlagEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName()
{
return name;
}
public static LiftPersonFlagEnum getEnum(Integer code)
{
for (LiftPersonFlagEnum liftPersonFlagEnum : LiftPersonFlagEnum.values())
{
if (liftPersonFlagEnum.getCode().equals(code))
{
return liftPersonFlagEnum;
}
}
return null;
}
}
package com.yeejoin.amos.api.openapi.enums;
/**
*
* <pre>
* 电梯运行模式枚举
* </pre>
*
* @author gwb
* @version $Id: LiftServiceModelEnum.java, v 0.1 2021年9月29日 上午9:24:15 gwb Exp $
*/
public enum LiftServiceModelEnum{
STOP_SERVICE(1,"停止服务"),
NORMAL_OPERATION(2,"正常运行"),
OVERHAUL(3,"检修"),
FIRE_RETURN(4,"消防返回"),
FIREFIGHTER_OPERATION(5,"消防员运行"),
EMERGENCY_POWER_OPERATION(6,"应急电源运行"),
SEISMIC_MODEL(7,"地震模式"),
UNKNOWN (8,"未知");
/**
* 编码
*/
private Integer code;
/**
* 名称
*/
private String name;
// 构造方法
private LiftServiceModelEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName()
{
return name;
}
public static LiftServiceModelEnum getEnum(Integer code)
{
for (LiftServiceModelEnum liftCircuitStatusEnum : LiftServiceModelEnum.values())
{
if (liftCircuitStatusEnum.getCode().equals(code))
{
return liftCircuitStatusEnum;
}
}
return null;
}
}
package com.yeejoin.amos.api.openapi.enums;
/**
*
* <pre>
* 电梯运行状态枚举
* </pre>
*
* @author gwb
* @version $Id: LiftStatusEnum.java, v 0.1 2021年9月29日 上午9:32:16 gwb Exp $
*/
public enum LiftStatusEnum{
STOP (1,"停止"),
RUN (2,"运行");
/**
* 编码
*/
private Integer code;
/**
* 名称
*/
private String name;
// 构造方法
private LiftStatusEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName()
{
return name;
}
public static LiftStatusEnum getEnum(Integer code)
{
for (LiftStatusEnum liftStatusEnum : LiftStatusEnum.values())
{
if (liftStatusEnum.getCode().equals(code))
{
return liftStatusEnum;
}
}
return null;
}
}
package com.yeejoin.amos.api.openapi.face.model;
import java.util.Date;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public abstract class AbstractBaseModel extends BaseModel{
/**
*
*/
private static final long serialVersionUID = 1L;
protected Date SyncDate;//同步时间 yyyy-MM-dd HH24:mi:ss
protected int SyncState;//同步状态(0-新增 1-更新 2-删除)
/**
* 对接公司编码
*/
protected String appId;
}
package com.yeejoin.amos.api.openapi.face.model;
import java.io.Serializable;
import lombok.Data;
@Data
public class BizTokenModel implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* 登录令牌
*/
private String token;
/**
* 应用编号
*/
private String appKey;
/**
* 客户端标识
*/
private String product;
/**
* 所属机构
*/
private String agencyCode;
/**
* 应用用户票据,唯一标识
*/
private String appId;
/**
* 对接公司编码
*/
private String apiCompanyCode;
}
package com.yeejoin.amos.api.openapi.face.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import com.yeejoin.amos.api.openapi.face.model.AbstractBaseModel;
/**
* 施工信息表
*
* @author cpp
* @date 2023-04-06 15:21:22
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="MidConstructionInfoDto", description="施工信息表Dto")
public class ConstructionInfoModel extends AbstractBaseModel {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "监管码")
private String supervisoryCode;
@ApiModelProperty(value = "$column.comments")
private String instanceId;
@ApiModelProperty(value = "$column.comments")
private String status;
@ApiModelProperty(value = "施工类型")
private String constructionType;
@ApiModelProperty(value = "施工单位统一社会信用代码")
private String uscUnitCreditCode;
@ApiModelProperty(value = "施工单位名称")
private String uscUnitName;
@ApiModelProperty(value = "施工时间")
private Date uscDate;
@ApiModelProperty(value = "安装/改造/移装告知ID")
private String uscInformId;
}
package com.yeejoin.amos.api.openapi.face.model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
@EqualsAndHashCode(callSuper = true)
@Data
public class CylinderDateInfoModel extends AbstractBaseModel{
/**
*
*/
private static final long serialVersionUID = 1L;
private Date SyncDate;//同步时间 yyyy-MM-dd HH24:mi:ss
private String developerAgency;
protected String appId;
private String unitName;
private Integer cylinderInfo;
private Integer cylinderTagInfo;
private Integer cylinderInspectionInfo;
private Integer cylinderFillingInfo;
private Integer cylinderFillingRecordInfo;
private Integer cylinderFillingCheckInfo;
private Integer cylinderExamineInfo;
private Integer cylinderUnit;
private Integer cylinderTotal;
}
package com.yeejoin.amos.api.openapi.face.model;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class CylinderFillingCheckModel extends AbstractBaseModel{
/**
*
*/
private static final long serialVersionUID = 1L;
private String fillingCheckId; //充装后复查ID
private int withinScope; //充装量在规定范围内*
private int sealedState; //瓶阀及其与瓶口连接的密封良好*
private int defective; //瓶体未出现鼓包变形或泄露等严重缺陷*
private int abnormalTemperature; //瓶体温度没有异常升高的迹象*
private int warningSign; //气瓶粘贴警示标签和充装标签*
private String compliance; //液化气瓶充装量符合有关规定,充装后逐瓶称重
private String inspector; //检查人员姓名*
private String inspectionDate; //检查时间*
private String checkResults;
private String nonconformances;
/**
* 对接文档已发布字段,需要将此字段赋值给系统数据库中的字段:abnormalTemperature
*/
private int abnormaLTemperature;
public int getAbnormaLTemperature() {
return abnormalTemperature;
}
public void setAbnormaLTemperature(int abnormaLTemperature) {
this.abnormalTemperature = abnormaLTemperature;
}
public int getAbnormalTemperature() {
return abnormalTemperature;
}
public void setAbnormalTemperature(int abnormalTemperature) {
this.abnormalTemperature = abnormalTemperature;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment