Commit d80bc65b authored by suhuiguang's avatar suhuiguang

1.openapi接口开发

1.1.附件上传 1.2.特种设备目录查询(feign调用jyjc) 1.3.检验检测结果回传(feign调用jyjc) 2.jyjc回传数据更新调整为按照设备及单号唯一进行更新
parent 7b9ba3d9
......@@ -41,7 +41,7 @@ public class ControllerAop {
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"};
String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany","/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) {
......
......@@ -5,6 +5,7 @@ import feign.RequestTemplate;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import javax.servlet.http.HttpServletRequest;
......@@ -35,6 +36,12 @@ public class FeignAuthRequestInterceptor implements RequestInterceptor {
if (product == null) {
product = request.getParameter("product");
}
if (appKey == null) {
appKey = RequestContext.getAppKey();
}
if (product == null) {
product = RequestContext.getProduct();
}
template.header("X-Access-Token", authToken);
template.header("token", authToken);
template.header("appKey", appKey);
......
package com.yeejoin.amos.api.openapi.controller;
import com.yeejoin.amos.api.openapi.face.dto.EquipmentCategoryDto;
import com.yeejoin.amos.api.openapi.feign.TzsServiceFeignClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
/**
* 特种设备监管controller
*
* @author Administrator
*/
@RestController
@Api(tags = "设备定义Api")
@RequestMapping(value = "/equipment-category")
public class EquipmentCategoryController {
@Autowired
TzsServiceFeignClient tzsServiceFeignClient;
/**
* 设备定义列表数据查询
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/list")
@ApiOperation(httpMethod = "GET", value = "设备定义列表数据查询", notes = "设备定义列表数据查询")
public ResponseModel<List<EquipmentCategoryDto>> page() {
return tzsServiceFeignClient.getEquipmentCategoryList();
}
}
package com.yeejoin.amos.api.openapi.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.logging.SimpleFormatter;
import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.api.openapi.enums.FileFolderPathEnum;
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;
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.bind.annotation.*;
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;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
@RestController
@RequestMapping(value = "/filestorage")
......@@ -39,26 +31,25 @@ public class FilesController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "气瓶充装审核数据")
@PostMapping(value = "/")
public ResponseModel<String> uploadCylinderFiles (
@RequestBody MultipartFile file) throws Exception
{
public ResponseModel<String> uploadCylinderFiles(
@RequestBody MultipartFile file) throws Exception {
logger.info(file);
JSONObject jsonObj = uploadFile(file,FileFolderPathEnum.CYLINDER.getPath());
JSONObject jsonObj = uploadFile(file, FileFolderPathEnum.CYLINDER.getPath());
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
{
public ResponseModel<String> uploadCseiFiles(
@RequestBody MultipartFile file) throws Exception {
logger.info(file);
JSONObject jsonObj = uploadFile(file, FileFolderPathEnum.JY.getPath());
return ResponseHelper.buildResponse(jsonObj.toString());
}
private JSONObject uploadFile(MultipartFile file,String tag) {
if (ValidationUtil.isEmpty(file)){
private JSONObject uploadFile(MultipartFile file, String tag) {
if (ValidationUtil.isEmpty(file)) {
throw new BadRequest("参数校验失败.");
}
Date today = new Date();
......@@ -70,7 +61,7 @@ public class FilesController {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
String urlString=it.next();
String urlString = it.next();
jsonObj.put("fileUrl", urlString);
jsonObj.put("fileName", map.get(urlString));
}
......@@ -81,17 +72,16 @@ public class FilesController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "上传附件")
@PostMapping("/supma")
public ResponseModel<JSONObject> upload(@RequestBody MultipartFile file){
public ResponseModel<JSONObject> upload(@RequestBody MultipartFile file) {
JSONObject jsonObject = uploadFile(file, FileFolderPathEnum.JG.getPath());
// 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(jsonObject);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "通用上传附件")
@PostMapping("/{module}/upload")
public ResponseModel<JSONObject> upload2(@RequestBody MultipartFile file, @PathVariable String module) {
JSONObject jsonObject = uploadFile(file, FileFolderPathEnum.valueOf(module.toUpperCase()).getPath());
return ResponseHelper.buildResponse(jsonObject);
}
......
package com.yeejoin.amos.api.openapi.controller;
import com.yeejoin.amos.api.openapi.face.dto.JyjcInspectionResultDataModel;
import com.yeejoin.amos.api.openapi.feign.JyjcServiceFeignClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
/**
* 特种设备监管controller
*
* @author Administrator
*/
@RestController
@Api(tags = "检验检测Api")
@RequestMapping(value = "/inspection")
public class JyjcController {
@Autowired
JyjcServiceFeignClient jyjcServiceFeignClient;
/**
* 设备定义列表数据查询
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/result-submit")
@ApiOperation(httpMethod = "POST", value = "检验检测结果回传", notes = "检验检测结果回传")
public ResponseModel<List<JyjcInspectionResultDataModel>> resultSubmit(@RequestBody List<JyjcInspectionResultDataModel> resultDataModels) {
return jyjcServiceFeignClient.saveResultDataBatch(resultDataModels);
}
}
......@@ -38,9 +38,14 @@ public enum FileFolderPathEnum {
/**
* 检验报告
*/
JY("jg","/csei")
;
JY("jg","/csei"),
/**
* 检验检测
*/
JYJC("jyjc", "/jyjc");
private String module;
private String path;
}
package com.yeejoin.amos.api.openapi.face.dto;
import lombok.Data;
import java.util.List;
/**
* @author Administrator
*/
@Data
public class AttachmentData {
/**
* 附件类型
*/
public String attachmentType;
/**
* 附件列表
*/
public List<AttachmentModel> attachmentContent;
}
package com.yeejoin.amos.api.openapi.face.dto;
import lombok.Data;
/**
* @author Administrator
* 附件结构
*/
@Data
public class AttachmentModel {
/**
* 附件名称
*/
String name;
/**
* 附件路径
*/
String url;
/**
* 前端标识
*/
String uid;
/**
* 前端附件状态
*/
String status;
}
package com.yeejoin.amos.api.openapi.face.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 装备分类
*
* @author system_generator
* @date 2021-10-20
*/
@Data
@ApiModel(value="EquipmentCategoryDto", description="装备分类")
public class EquipmentCategoryDto {
private static final long serialVersionUID = 1L;
private Long id;
private String parentId;
@ApiModelProperty(value = "装备分类编码")
private String code;
@ApiModelProperty(value = "装备分类名称")
private String name;
@ApiModelProperty(value = "描述")
private String description;
@ApiModelProperty(value = "备注")
private String remark;
private Date createDate;
@ApiModelProperty(value = "行业编码")
private String industryCode;
}
package com.yeejoin.amos.api.openapi.face.dto;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 业务开通申请表
*
* @author system_generator
* @date 2023-12-14
*/
@Data
@ApiModel(value = "JyjcInspectionResultDataModel", description = "检验检测结果数据接收")
public class JyjcInspectionResultDataModel {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "报检单号")
private String applicationNo;
@ApiModelProperty(value = "监管码")
private String supervisoryCode;
@ApiModelProperty(value = "检验结果状态(已出2、未出1)")
private String resultStatus;
@ApiModelProperty(value = "核准证号/许可证号")
private String licenseNumber;
@ApiModelProperty(value = "检验报告编号")
private String resultNo;
@ApiModelProperty(value = "内部人员代码")
private String innerPersonCode;
@ApiModelProperty(value = "检验结论")
private String inspectionConclusion;
@ApiModelProperty(value = "检验日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date inspectionDate;
@ApiModelProperty(value = "下次检验日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date nextInspectionDate;
@ApiModelProperty(value = "检验开始日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date inspectionStartDate;
@ApiModelProperty(value = "检验结束日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date inspectionEndDate;
@ApiModelProperty(value = "检验结果汇总")
private String inspectionResultSummary;
@ApiModelProperty(value = "不符合项")
private JSONArray nonConformance;
@ApiModelProperty(value = "附件")
private List<AttachmentData> attachments;
@ApiModelProperty(value = "检验结果技术参数")
private JSONObject techParams;
/**
* 校验检验系统唯一流水号,排查问题,跟踪问题使用
*/
private String traceId;
}
package com.yeejoin.amos.api.openapi.feign;
import com.yeejoin.amos.api.openapi.config.FeignConfiguration;
import com.yeejoin.amos.api.openapi.face.dto.JyjcInspectionResultDataModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
@FeignClient(name = "TZS-JYJC", path = "/jyjc", configuration = {FeignConfiguration.class})
public interface JyjcServiceFeignClient {
/**
* 报检结果接收
*
* @param resultDataModels 请求体
* @return 是否成功
*/
@RequestMapping(value = "/jyjc-inspection-result/receive", method = RequestMethod.POST)
ResponseModel<List<JyjcInspectionResultDataModel>> saveResultDataBatch(@RequestBody List<JyjcInspectionResultDataModel> resultDataModels);
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.api.openapi.feign;
import com.yeejoin.amos.api.openapi.config.FeignConfiguration;
import com.yeejoin.amos.api.openapi.face.dto.EquipmentCategoryDto;
import com.yeejoin.amos.api.openapi.face.dto.EquipmentInfoDto;
import com.yeejoin.amos.api.openapi.face.model.InspectionDetectionInfoModel;
import com.yeejoin.amos.api.openapi.face.model.UnitLicenceModel;
......@@ -95,4 +96,11 @@ public interface TzsServiceFeignClient {
@RequestMapping(value = "/equipment-category/deleteByRecord", method = RequestMethod.POST)
ResponseModel<Boolean> deleteEquipmentInfo(@RequestParam String record);
/**
* 设备定义列表数据
* @return <List<EquipmentCategoryDto>>
*/
@RequestMapping(value = "/equipment-category/list", method = RequestMethod.GET)
ResponseModel<List<EquipmentCategoryDto>> getEquipmentCategoryList();
}
......@@ -2,22 +2,12 @@ package com.yeejoin.amos.api.openapi.feign;
import com.yeejoin.amos.api.openapi.config.FeignConfiguration;
import com.yeejoin.amos.api.openapi.config.MultipartSupportConfig;
import com.yeejoin.amos.api.openapi.face.dto.EquipmentInfoDto;
import com.yeejoin.amos.api.openapi.face.model.InspectionDetectionInfoModel;
import com.yeejoin.amos.api.openapi.face.model.UnitLicenceModel;
import com.yeejoin.amos.api.openapi.face.orm.entity.ConstructionInfo;
import com.yeejoin.amos.api.openapi.face.orm.entity.MaintenanceInfo;
import org.springframework.cloud.openfeign.FeignClient;
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.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
@FeignClient(name = "TZS-COMMON", path = "/tcm", configuration =
{FeignConfiguration.class})
public interface TzsTcmServiceFeignClient {
......
spring.application.name=AMOS-API-OPENAPI-JYJC
server.servlet.context-path=/openapijyjc
server.port=11003
# jdbc_config
spring.datasource.url=jdbc:vastbase://172.16.10.243:5432/tzs_amos_tzs_biz_init?currentSchema=amos_openapi_cyl&allowMultiQueries=true
spring.datasource.username=admin
spring.datasource.password=Yeejoin@2023
spring.datasource.driver-class-name=cn.com.vastbase.Driver
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.243
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.243: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.243:2883
emqx.client-user-name=admin
emqx.client-password=public
emqx.keepAliveInterval=1000
##biz custem properties
biz.lxyd.lift.url=http://39.106.181.149:8088/elevatorapi
<?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}/openapicyl.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>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<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>
</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="DEBUG">
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
......@@ -292,8 +292,8 @@ public class JyjcInspectionApplicationController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "报检信息推送测试", notes = "报检信息推送测试")
@GetMapping(value = "/test-push")
@ApiOperation(httpMethod = "GET", value = "报检信息手工推送至kafka", notes = "报检信息手工推送至kafka,预留")
@GetMapping(value = "/data-push")
public void pushTest(
@RequestParam("id") Long id) {
JyjcInspectionApplicationModel model= jyjcInspectionApplicationServiceImpl.queryBySeq(id);
......
......@@ -183,8 +183,8 @@ public class JyjcInspectionResultController extends BaseController {
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "报检结果接收", notes = "对外对接使用,支持单条及批量")
@PostMapping(value = "/receive/data")
public ResponseModel<List<JyjcInspectionResultDataModel>> receivePushResultData(@RequestBody List<JyjcInspectionResultDataModel> resultDataModels){
@PostMapping(value = "/receive")
public ResponseModel<List<JyjcInspectionResultDataModel>> saveResultDataBatch(@RequestBody List<JyjcInspectionResultDataModel> resultDataModels){
return ResponseHelper.buildResponse(jyjcInspectionResultServiceImpl.receivePushResultData(resultDataModels));
}
}
......@@ -381,11 +381,11 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
List<JyjcInspectionResultParam> resultParams = new ArrayList<>();
resultDataModels.forEach(r -> {
// 填充主表数据
this.fillResultData(r, resultListMap.get(r.getApplicationNo()));
this.fillResultData(r, resultListMap.get(r.getApplicationNo() + ":" + r.getSupervisoryCode()));
// 填充附件数据
this.fillResultAttachmentData(r, resultListMap.get(r.getApplicationNo()), resultAttachments);
this.fillResultAttachmentData(r, resultListMap.get(r.getApplicationNo() + ":" + r.getSupervisoryCode()), resultAttachments);
// 填充技术参数数据
this.fillResultParamData(r, resultListMap.get(r.getApplicationNo()), resultParams);
this.fillResultParamData(r, resultListMap.get(r.getApplicationNo() + ":" + r.getSupervisoryCode()), resultParams);
});
// 2.批量保存主表数据
this.updateBatchById(resultListMap.values());
......@@ -472,8 +472,11 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
private Map<String, JyjcInspectionResult> queryWaitUpdateResultList(List<JyjcInspectionResultDataModel> resultDataModels) {
List<String> applicationNos = resultDataModels.stream().map(JyjcInspectionResultDataModel::getApplicationNo).collect(Collectors.toList());
LambdaQueryWrapper<JyjcInspectionResult> wrapper = new LambdaQueryWrapper<JyjcInspectionResult>().in(JyjcInspectionResult::getApplicationNo, applicationNos);
List<String> supervisoryCodes = resultDataModels.stream().map(JyjcInspectionResultDataModel::getSupervisoryCode).collect(Collectors.toList());
LambdaQueryWrapper<JyjcInspectionResult> wrapper = new LambdaQueryWrapper<>();
wrapper.in(JyjcInspectionResult::getApplicationNo, applicationNos);
wrapper.in(JyjcInspectionResult::getSupervisoryCode, supervisoryCodes);
List<JyjcInspectionResult> resultList = this.list(wrapper);
return resultList.stream().collect(Collectors.toMap(JyjcInspectionResult::getApplicationNo, Function.identity()));
return resultList.stream().collect(Collectors.toMap((c)-> c.getApplicationNo() + ":" + c.getSupervisoryCode(), Function.identity()));
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionApplicationHandlerService;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationPushLogServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 16:12
*/
@Component
public class AbstractJyjcInspectionApplicationHandlerServiceImpl implements IJyjcInspectionApplicationHandlerService {
@Autowired
private JyjcInspectionApplicationPushLogServiceImpl applicationPushLogService;
@Override
public String type() {
return "default";
}
@Override
public boolean notifyInspectionUnit(Map<String, Object> params) {
// push日志
applicationPushLogService.saveInspectionApplicationPushLog(params);
return true;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 检测
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 16:32
*/
@Component
public class DetectionInspectionApplicationHandlerServiceImpl extends AbstractJyjcInspectionApplicationHandlerServiceImpl {
@Override
public String type() {
return BizTypeEnum.DETECTION.getCode();
}
@Override
public boolean notifyInspectionUnit(Map<String, Object> params) {
super.notifyInspectionUnit(params);
// todo
return true;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 定检
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 16:32
*/
@Component
public class FirstInspectionApplicationHandlerServiceImpl extends AbstractJyjcInspectionApplicationHandlerServiceImpl {
@Override
public String type() {
return BizTypeEnum.FIRST_INSPECTION.getCode();
}
@Override
public boolean notifyInspectionUnit(Map<String, Object> params) {
super.notifyInspectionUnit(params);
// todo
return true;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionApplicationHandlerService;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* @author yangyang
* @version v1.0
* @date 2023/11/8 15:10
*/
@Service
public class JyjcInspectionApplicationHandlerFactory implements ApplicationContextAware {
private static final Map<String, IJyjcInspectionApplicationHandlerService> SERVICE_POOL = new HashMap<>(12);
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
applicationContext.getBeansOfType(IJyjcInspectionApplicationHandlerService.class).forEach((beanName, bean) -> SERVICE_POOL.put(bean.type(), bean));
}
public static IJyjcInspectionApplicationHandlerService apply(String type) {
IJyjcInspectionApplicationHandlerService objectSceneService = SERVICE_POOL.get(type);
if (Objects.isNull(objectSceneService)) {
throw new IllegalArgumentException("SERVICE_POOL type: " + type + " is not found !");
}
return objectSceneService;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 监督检验
*
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 16:32
*/
@Component
public class SuperviseInspectionApplicationHandlerServiceImpl extends AbstractJyjcInspectionApplicationHandlerServiceImpl {
@Override
public String type() {
return BizTypeEnum.SUPERVISE.getCode();
}
@Override
public boolean notifyInspectionUnit(Map<String, Object> params) {
super.notifyInspectionUnit(params);
// todo
return true;
}
}
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