| | |
| | | <version>3.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-staticdocs</artifactId> |
| | | <version>2.6.1</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | @Bean |
| | | fun runner() = ApplicationRunner { |
| | | webSocketServer.start() |
| | | taskController.run() |
| | | // taskController.run() |
| | | } |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.common.api2word; |
| | | |
| | | import org.apache.http.conn.ssl.SSLConnectionSocketFactory; |
| | | import org.apache.http.conn.ssl.TrustStrategy; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; |
| | | import org.springframework.http.converter.StringHttpMessageConverter; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.net.ssl.SSLContext; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.KeyManagementException; |
| | | import java.security.KeyStoreException; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.cert.X509Certificate; |
| | | |
| | | /** |
| | | * Created by XiuYin.Cui on 2018/6/21. |
| | | */ |
| | | @Configuration |
| | | public class JavaConfig { |
| | | |
| | | @Bean |
| | | public RestTemplate restTemplate() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException { |
| | | TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; |
| | | SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom() |
| | | .loadTrustMaterial(null, acceptingTrustStrategy) |
| | | .build(); |
| | | SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext); |
| | | CloseableHttpClient httpClient = HttpClients.custom() |
| | | .setSSLSocketFactory(csf) |
| | | .build(); |
| | | HttpComponentsClientHttpRequestFactory requestFactory = |
| | | new HttpComponentsClientHttpRequestFactory(); |
| | | requestFactory.setHttpClient(httpClient); |
| | | |
| | | //60s |
| | | requestFactory.setConnectTimeout(60 * 1000); |
| | | requestFactory.setReadTimeout(60 * 1000); |
| | | RestTemplate restTemplate = new RestTemplate(requestFactory); |
| | | restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); |
| | | return restTemplate; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.common.api2word.model; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è¿å屿§ |
| | | * |
| | | * @author kevin |
| | | */ |
| | | public class ModelAttr implements Serializable { |
| | | |
| | | public String getClassName() { |
| | | return className; |
| | | } |
| | | |
| | | public void setClassName(String className) { |
| | | this.className = className; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Boolean getRequire() { |
| | | return require; |
| | | } |
| | | |
| | | public void setRequire(Boolean require) { |
| | | this.require = require; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public List<ModelAttr> getProperties() { |
| | | return properties; |
| | | } |
| | | |
| | | public void setProperties(List<ModelAttr> properties) { |
| | | this.properties = properties; |
| | | } |
| | | |
| | | public boolean isCompleted() { |
| | | return isCompleted; |
| | | } |
| | | |
| | | public void setCompleted(boolean isCompleted) { |
| | | this.isCompleted = isCompleted; |
| | | } |
| | | |
| | | public static long getSerialversionuid() { |
| | | return serialVersionUID; |
| | | } |
| | | |
| | | private static final long serialVersionUID = -4074067438450613643L; |
| | | |
| | | /** |
| | | * ç±»å |
| | | */ |
| | | private String className = StringUtils.EMPTY; |
| | | /** |
| | | * 屿§å |
| | | */ |
| | | private String name = StringUtils.EMPTY; |
| | | /** |
| | | * ç±»å |
| | | */ |
| | | private String type = StringUtils.EMPTY; |
| | | /** |
| | | * æ¯å¦å¿
å¡« |
| | | */ |
| | | private Boolean require = false; |
| | | /** |
| | | * 屿§æè¿° |
| | | */ |
| | | private String description; |
| | | /** |
| | | * åµå¥å±æ§å表 |
| | | */ |
| | | private List<ModelAttr> properties = new ArrayList<>(); |
| | | |
| | | /** |
| | | * æ¯å¦å è½½å®æï¼é¿å
循ç¯å¼ç¨ |
| | | */ |
| | | private boolean isCompleted = false; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.common.api2word.model; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * Created by XiuYin.Cui on 2018/1/11. |
| | | */ |
| | | public class Request implements Serializable{ |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getParamType() { |
| | | return paramType; |
| | | } |
| | | |
| | | public void setParamType(String paramType) { |
| | | this.paramType = paramType; |
| | | } |
| | | |
| | | public Boolean getRequire() { |
| | | return require; |
| | | } |
| | | |
| | | public void setRequire(Boolean require) { |
| | | this.require = require; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public ModelAttr getModelAttr() { |
| | | return modelAttr; |
| | | } |
| | | |
| | | public void setModelAttr(ModelAttr modelAttr) { |
| | | this.modelAttr = modelAttr; |
| | | } |
| | | |
| | | /** |
| | | * åæ°å |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * æ°æ®ç±»å |
| | | */ |
| | | private String type; |
| | | |
| | | /** |
| | | * åæ°ç±»å |
| | | */ |
| | | private String paramType; |
| | | |
| | | /** |
| | | * æ¯å¦å¿
å¡« |
| | | */ |
| | | private Boolean require; |
| | | |
| | | /** |
| | | * 说æ |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * å¤æå¯¹è±¡å¼ç¨ |
| | | */ |
| | | private ModelAttr modelAttr; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.common.api2word.model; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * Created by XiuYin.Cui on 2018/1/11. |
| | | */ |
| | | public class Response implements Serializable{ |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | /** |
| | | * è¿ååæ° |
| | | */ |
| | | private String description; |
| | | |
| | | /** |
| | | * åæ°å |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.common.api2word.model; |
| | | |
| | | |
| | | import cn.flightfeather.supervision.common.api2word.model.ModelAttr; |
| | | import cn.flightfeather.supervision.common.api2word.model.Request; |
| | | import cn.flightfeather.supervision.common.api2word.model.Response; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by XiuYin.Cui on 2018/1/11. |
| | | */ |
| | | public class Table { |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public String getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setTag(String tag) { |
| | | this.tag = tag; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public String getRequestForm() { |
| | | return requestForm; |
| | | } |
| | | |
| | | public void setRequestForm(String requestForm) { |
| | | this.requestForm = requestForm; |
| | | } |
| | | |
| | | public String getResponseForm() { |
| | | return responseForm; |
| | | } |
| | | |
| | | public void setResponseForm(String responseForm) { |
| | | this.responseForm = responseForm; |
| | | } |
| | | |
| | | public String getRequestType() { |
| | | return requestType; |
| | | } |
| | | |
| | | public void setRequestType(String requestType) { |
| | | this.requestType = requestType; |
| | | } |
| | | |
| | | public List<Request> getRequestList() { |
| | | return requestList; |
| | | } |
| | | |
| | | public void setRequestList(List<Request> requestList) { |
| | | this.requestList = requestList; |
| | | } |
| | | |
| | | public List<Response> getResponseList() { |
| | | return responseList; |
| | | } |
| | | |
| | | public void setResponseList(List<Response> responseList) { |
| | | this.responseList = responseList; |
| | | } |
| | | |
| | | public String getRequestParam() { |
| | | return requestParam; |
| | | } |
| | | |
| | | public void setRequestParam(String requestParam) { |
| | | this.requestParam = requestParam; |
| | | } |
| | | |
| | | public String getResponseParam() { |
| | | return responseParam; |
| | | } |
| | | |
| | | public void setResponseParam(String responseParam) { |
| | | this.responseParam = responseParam; |
| | | } |
| | | |
| | | public ModelAttr getModelAttr() { |
| | | return modelAttr; |
| | | } |
| | | |
| | | public void setModelAttr(ModelAttr modelAttr) { |
| | | this.modelAttr = modelAttr; |
| | | } |
| | | |
| | | /** |
| | | * 大æ é¢ |
| | | */ |
| | | private String title; |
| | | /** |
| | | * å°æ é¢ |
| | | */ |
| | | private String tag; |
| | | /** |
| | | * url |
| | | */ |
| | | private String url; |
| | | |
| | | /** |
| | | * æè¿° |
| | | */ |
| | | private String description; |
| | | |
| | | /** |
| | | * 请æ±åæ°æ ¼å¼ |
| | | */ |
| | | private String requestForm; |
| | | |
| | | /** |
| | | * ååºåæ°æ ¼å¼ |
| | | */ |
| | | private String responseForm; |
| | | |
| | | /** |
| | | * è¯·æ±æ¹å¼ |
| | | */ |
| | | private String requestType; |
| | | |
| | | /** |
| | | * 请æ±ä½ |
| | | */ |
| | | private List<Request> requestList; |
| | | |
| | | /** |
| | | * è¿åä½ |
| | | */ |
| | | private List<Response> responseList; |
| | | |
| | | /** |
| | | * 请æ±åæ° |
| | | */ |
| | | private String requestParam; |
| | | |
| | | /** |
| | | * è¿ååæ° |
| | | */ |
| | | private String responseParam; |
| | | |
| | | /** |
| | | * è¿å屿§å表 |
| | | */ |
| | | private ModelAttr modelAttr = new ModelAttr(); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.common.api2word.utils; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.fasterxml.jackson.core.JsonParser; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.DeserializationFeature; |
| | | import com.fasterxml.jackson.databind.JavaType; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.node.ArrayNode; |
| | | import com.fasterxml.jackson.databind.node.ObjectNode; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author cuixiuyin |
| | | * @Date: 2018/11/05 |
| | | */ |
| | | |
| | | public class JsonUtils { |
| | | |
| | | private static ObjectMapper objectMapper = new ObjectMapper(); |
| | | |
| | | static { |
| | | objectMapper.setSerializationInclusion(JsonInclude.Include.ALWAYS); |
| | | objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
| | | objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); |
| | | objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true); |
| | | objectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); |
| | | } |
| | | |
| | | public static <T> T readValue(String jsonStr, Class<T> clazz) throws IOException { |
| | | return objectMapper.readValue(jsonStr, clazz); |
| | | } |
| | | |
| | | public static <T> List<T> readListValue(String jsonStr, Class<T> clazz) throws IOException { |
| | | JavaType javaType = objectMapper.getTypeFactory().constructParametricType(List.class, clazz); |
| | | return objectMapper.readValue(jsonStr, javaType); |
| | | } |
| | | |
| | | public static ArrayNode readArray(String jsonStr) throws IOException { |
| | | JsonNode node = objectMapper.readTree(jsonStr); |
| | | if (node.isArray()) { |
| | | return (ArrayNode) node; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static JsonNode readNode(String jsonStr) throws IOException { |
| | | return objectMapper.readTree(jsonStr); |
| | | } |
| | | |
| | | public static String writeJsonStr(Object obj) throws JsonProcessingException { |
| | | return objectMapper.writeValueAsString(obj); |
| | | } |
| | | |
| | | public static ObjectNode createObjectNode() { |
| | | return objectMapper.createObjectNode(); |
| | | } |
| | | |
| | | public static ArrayNode createArrayNode() { |
| | | return objectMapper.createArrayNode(); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.common.api2word.utils; |
| | | |
| | | /** |
| | | * @author : cuixiuyin |
| | | * @date : 2019/8/31 |
| | | */ |
| | | public class MenuUtils { |
| | | |
| | | public static Integer count = 0; |
| | | public static String menuStr = "null"; |
| | | |
| | | public static boolean isMenu(String tags) { |
| | | if (menuStr.equals(tags)) { |
| | | count++; |
| | | } else { |
| | | menuStr = tags; |
| | | count = 0; |
| | | } |
| | | if (count == 0) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.common.api2word.utils; |
| | | |
| | | import cn.flightfeather.supervision.common.api2word.model.ModelAttr; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Map.Entry; |
| | | |
| | | /** |
| | | * @author ivenhan |
| | | * @Date: 2020/10/15 |
| | | */ |
| | | |
| | | public class ModelAttrUtils { |
| | | |
| | | // å°è£
schema - propertiesä¸æä¸ªå
·ä½property对象 |
| | | public static ModelAttr propertyModelAttr(Map<String, Map<String, Object>> property) { |
| | | ModelAttr modeAttr = new ModelAttr(); |
| | | |
| | | Map<String, Object> modeProperties = (Map<String, Object>) property.get("properties"); |
| | | ArrayList modeRequired = (ArrayList) property.get("required"); |
| | | List<ModelAttr> attrList = new ArrayList<>(); |
| | | |
| | | if (modeProperties != null) { |
| | | Iterator<Entry<String, Object>> mIt = modeProperties.entrySet().iterator(); |
| | | |
| | | //è§£æå±æ§ |
| | | while (mIt.hasNext()) { |
| | | Entry<String, Object> mEntry = mIt.next(); |
| | | Map<String, Object> attrInfoMap = (Map<String, Object>) mEntry.getValue(); |
| | | ModelAttr child = new ModelAttr(); |
| | | child.setName(mEntry.getKey()); |
| | | child.setType((String) attrInfoMap.get("type")); |
| | | if (attrInfoMap.get("format") != null) { |
| | | child.setType(child.getType() + "(" + attrInfoMap.get("format") + ")"); |
| | | } |
| | | child.setType(StringUtils.defaultIfBlank(child.getType(), "object")); |
| | | |
| | | Object ref = attrInfoMap.get("$ref"); |
| | | Object items = attrInfoMap.get("items"); |
| | | |
| | | if (items != null && ((Map) items).get("$ref") == null) { |
| | | ModelAttr refModel = propertyModelAttr((Map<String, Map<String, Object>>)items); |
| | | if (refModel != null) { |
| | | child.setProperties(refModel.getProperties()); |
| | | } |
| | | child.setType(child.getType()); |
| | | } |
| | | |
| | | child.setDescription((String) attrInfoMap.get("description")); |
| | | |
| | | child.setRequire(false); |
| | | if (modeRequired != null && modeRequired.contains(mEntry.getKey())) { |
| | | child.setRequire(true); |
| | | } |
| | | |
| | | attrList.add(child); |
| | | } |
| | | } |
| | | |
| | | Object title = property.get("title"); |
| | | Object description = property.get("description"); |
| | | modeAttr.setClassName(title == null ? "" : title.toString()); |
| | | modeAttr.setDescription(description == null ? "" : description.toString()); |
| | | modeAttr.setProperties(attrList); |
| | | return modeAttr; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.common.api2word.utils; |
| | | |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * @author : ivenhan |
| | | * @date : 2020/10/16 |
| | | */ |
| | | public class RequestUtils { |
| | | |
| | | public static void validateRequestKey(Map<String, Map> content) throws JsonProcessingException { |
| | | Map<String, Map> applicationJSON = content.get("application/json"); |
| | | if (applicationJSON == null) { |
| | | throw new JsonProcessingException("contentåæ®µ ç¼ºå° application/json åæ®µ") {}; |
| | | } |
| | | |
| | | Map<String, Map> schema = applicationJSON.get("schema"); |
| | | if (schema == null) { |
| | | throw new JsonProcessingException("contentåæ®µ application/json ç¼ºå° schema åæ®µ") {}; |
| | | } |
| | | |
| | | if (schema.get("type") == null) { |
| | | throw new JsonProcessingException("contentåæ®µ application/json åæ®µ schema åæ®µ ç¼ºå° typeåæ®µ") {}; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.common.api2word.utils; |
| | | |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | |
| | | import java.util.Map; |
| | | import java.util.Map.Entry; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author : ivenhan |
| | | * @date : 2020/10/16 |
| | | */ |
| | | public class ResponseUtils { |
| | | |
| | | public static void validateResponseKey(Map<String, Map> content) throws JsonProcessingException { |
| | | Map<String, Map> applicationJSON = content.get("application/json"); |
| | | if (applicationJSON == null) { |
| | | throw new JsonProcessingException("content åæ®µç¼ºå° application/json åæ®µ") {}; |
| | | } |
| | | |
| | | Map<String, Map> schema = applicationJSON.get("schema"); |
| | | if (schema == null) { |
| | | throw new JsonProcessingException("content åæ®µ application/json åæ®µ ç¼ºå° schema åæ®µ") {}; |
| | | } |
| | | |
| | | if (schema.get("type") == null) { |
| | | throw new JsonProcessingException("content åæ®µ application/json åæ®µ schema åæ®µ ç¼ºå° typeåæ®µ") {}; |
| | | } |
| | | |
| | | Map items = schema.get("items"); |
| | | Map properties = schema.get("properties"); |
| | | if (items == null && properties == null) { |
| | | throw new JsonProcessingException("content åæ®µ application/json åæ®µ schema åæ®µ ç¼ºå° properties æè
items åæ®µ") {}; |
| | | } |
| | | |
| | | |
| | | Set<Entry<String, Map>> contentValues = content.entrySet(); |
| | | |
| | | int size = contentValues.size(); |
| | | if ((applicationJSON.get("examples") != null && size > 2) || (applicationJSON.get("examples") == null && size > 1) ) { |
| | | throw new JsonProcessingException("content åæ®µåå¨é¤ application/json æè
examples åæ®µä¹å¤çå
¶ä»å段") {}; |
| | | } |
| | | } |
| | | } |
| | |
| | | // FIXME: 2021/4/28 åºæ¯ç±»å |
| | | // 汽修类å |
| | | .andEqualTo("extension2", SCENE_TYPE.value.toString()) |
| | | .andEqualTo("isenable", true) |
| | | // é¤é¥®ç±»å |
| | | // .andEqualTo("extension2", SCENE_TYPE.value.toString()) |
| | | // orderBy("workno") |
| | |
| | | it.realname, |
| | | SCENE_TYPE, |
| | | year, |
| | | month |
| | | month, |
| | | now |
| | | ) |
| | | |
| | | var score = 0 |
| | |
| | | package cn.flightfeather.supervision.common.score |
| | | |
| | | import cn.flightfeather.supervision.domain.enumeration.SceneType |
| | | import java.time.LocalDate |
| | | |
| | | class Info( |
| | | val userId: String?, |
| | |
| | | val userName: String?, |
| | | var sceneType: SceneType, |
| | | var year: Int, |
| | | val month: Int |
| | | val month: Int, |
| | | val now:LocalDate |
| | | ) |
| | |
| | | true |
| | | } else { |
| | | val latestTime = LocalDateTime.ofInstant(c[0].cmCreateTime.toInstant(), ZoneId.systemDefault()) |
| | | val now = LocalDateTime.of(info.year, eMonth + 1, 1, 0, 0, 0) |
| | | val now = LocalDateTime.of(info.year, eMonth, 1, 0, 0, 0).plusMonths(1) |
| | | now.minusYears(1).isAfter(latestTime) |
| | | } |
| | | } |
| | |
| | | import org.springframework.stereotype.Component |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.time.LocalDate |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | | import java.util.* |
| | | import javax.annotation.PostConstruct |
| | |
| | | |
| | | override fun calScore(): Pair<Int, Int> { |
| | | val startTime = LocalDate.of(info.year, sMonth, 1).atStartOfDay(ZoneId.systemDefault()) |
| | | val lastTime = LocalDate.of(info.year, eMonth + 1, 1).atStartOfDay(ZoneId.systemDefault()) |
| | | val lastTime = LocalDate.of(info.year, eMonth, 1).plusMonths(1).atStartOfDay(ZoneId.systemDefault()) |
| | | LocalDateTime.now() |
| | | val s = Date.from(startTime.toInstant()) |
| | | val e = Date.from(lastTime.toInstant()) |
| | | |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired |
| | | import org.springframework.stereotype.Component |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.time.LocalDate |
| | | import java.time.ZoneId |
| | | import javax.annotation.PostConstruct |
| | | |
| | | @Component |
| | |
| | | override var maxScore: Int = 10 |
| | | |
| | | override fun calScore(): Pair<Int, Int> { |
| | | val startTime = LocalDate.of(info.year, sMonth, 1).atStartOfDay(ZoneId.systemDefault()) |
| | | val lastTime = LocalDate.of(info.year, eMonth, 1).plusMonths(1).atStartOfDay(ZoneId.systemDefault()) |
| | | // FIXME: 2021/4/26 æ¶æ§æ³æè§ãè´£ä»¤æ´æ¹æè¡æ¿å¤ç½,æ£é¤å
¨é¨åæ° |
| | | val r5 = scoreItem5.execute(info) |
| | | if (r5.first != 0) { |
| | |
| | | |
| | | val complaints = complaintMapper.selectByExample(Example(Complaint::class.java).apply { |
| | | createCriteria().andEqualTo("cpSceneid", info.userId) |
| | | .andGreaterThanOrEqualTo("cpTime", startTime) |
| | | .andLessThan("cpTime", lastTime) |
| | | }) |
| | | |
| | | return if (condition1(complaints)) { |
| | |
| | | } |
| | | |
| | | val startTime = LocalDate.of(info.year, sMonth, 1).atStartOfDay(ZoneId.systemDefault()) |
| | | val lastTime = LocalDate.of(info.year, eMonth + 1, 1).atStartOfDay(ZoneId.systemDefault()) |
| | | val lastTime = LocalDate.of(info.year, eMonth, 1).plusMonths(1).atStartOfDay(ZoneId.systemDefault()) |
| | | val s = Date.from(startTime.toInstant()) |
| | | val e = Date.from(lastTime.toInstant()) |
| | | |
| | |
| | | |
| | | override fun calScore(): Pair<Int, Int> { |
| | | val startTime = LocalDate.of(info.year, sMonth, 1).atStartOfDay(ZoneId.systemDefault()) |
| | | val lastTime = LocalDate.of(info.year, eMonth + 1, 1).atStartOfDay(ZoneId.systemDefault()) |
| | | val lastTime = LocalDate.of(info.year, eMonth, 1).plusMonths(1).atStartOfDay(ZoneId.systemDefault()) |
| | | val s = Date.from(startTime.toInstant()) |
| | | val e = Date.from(lastTime.toInstant()) |
| | | |
| | |
| | | import org.springframework.beans.factory.annotation.Value |
| | | import org.springframework.context.annotation.Bean |
| | | import org.springframework.context.annotation.Configuration |
| | | import org.springframework.http.HttpMethod |
| | | import springfox.documentation.builders.ApiInfoBuilder |
| | | import springfox.documentation.builders.PathSelectors |
| | | import springfox.documentation.builders.RequestHandlerSelectors |
| | | import springfox.documentation.oas.annotations.EnableOpenApi |
| | | import springfox.documentation.schema.ModelReference |
| | | import springfox.documentation.service.Header |
| | | import springfox.documentation.service.Response |
| | | import springfox.documentation.spi.DocumentationType |
| | | import springfox.documentation.spring.web.plugins.Docket |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2 |
| | |
| | | * Date: 2020/8/28 |
| | | */ |
| | | @Configuration |
| | | @EnableSwagger2 |
| | | @EnableOpenApi |
| | | class Swagger2Configuration { |
| | | |
| | | companion object { |
| | |
| | | |
| | | @Bean |
| | | fun createRestApi(): Docket = |
| | | Docket(DocumentationType.SWAGGER_2) |
| | | .enable(swagger2Enable) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | .apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE)) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | Docket(DocumentationType.OAS_30) |
| | | .enable(swagger2Enable) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | .apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE)) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | |
| | | |
| | | private fun apiInfo() = |
| | | ApiInfoBuilder() |
| | | .title("é£ç¾½æºè½ç¯å¢æå¡") |
| | | .description("é£ç¾½æºè½ç¯å¢æå¡ API æ¥å£ææ¡£") |
| | | .version(VERSION) |
| | | .build() |
| | | ApiInfoBuilder() |
| | | .title("é£ç¾½æºè½ç¯å¢æå¡") |
| | | .description("é£ç¾½æºè½ç¯å¢æå¡ API æ¥å£ææ¡£") |
| | | .version(VERSION) |
| | | .build() |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.lightshare.service.Impl; |
| | | |
| | | import cn.flightfeather.supervision.common.api2word.model.Table; |
| | | import cn.flightfeather.supervision.common.api2word.model.ModelAttr; |
| | | import cn.flightfeather.supervision.common.api2word.model.Request; |
| | | import cn.flightfeather.supervision.common.api2word.model.Response; |
| | | import cn.flightfeather.supervision.common.api2word.utils.JsonUtils; |
| | | import cn.flightfeather.supervision.common.api2word.utils.RequestUtils; |
| | | import cn.flightfeather.supervision.common.api2word.utils.ResponseUtils; |
| | | import cn.flightfeather.supervision.lightshare.service.OpenApiWordService; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.client.RestTemplate; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.io.StringWriter; |
| | | import java.util.*; |
| | | import java.util.Map.Entry; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Author XiuYin.Cui |
| | | * @Date 2018/1/12 |
| | | **/ |
| | | @SuppressWarnings({"unchecked", "rawtypes"}) |
| | | @Service |
| | | public class OpenApiWordServiceImpl implements OpenApiWordService { |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | @Override |
| | | public Map<String, Object> tableList(String swaggerUrl) { |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | try { |
| | | String jsonStr = restTemplate.getForObject(swaggerUrl, String.class); |
| | | resultMap = tableListFromString(jsonStr); |
| | | // log.debug(JsonUtils.writeJsonStr(resultMap)); |
| | | } catch (Exception e) { |
| | | } |
| | | return resultMap; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> tableListFromString(String jsonStr) throws IOException { |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | List<Table> result = new ArrayList<>(); |
| | | try { |
| | | Map<String, Object> map = getResultFromString(result, jsonStr); |
| | | Map<String, List<Table>> tableMap = result.stream().parallel().collect(Collectors.groupingBy(Table::getTitle)); |
| | | resultMap.put("tableMap", new TreeMap<>(tableMap)); |
| | | resultMap.put("info", map.get("info")); |
| | | |
| | | // log.debug(JsonUtils.writeJsonStr(resultMap)); |
| | | } catch (Exception e) { |
| | | throw e; |
| | | } |
| | | return resultMap; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> tableList(MultipartFile jsonFile) throws IOException { |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | try { |
| | | String jsonStr = new String(jsonFile.getBytes()); |
| | | resultMap = tableListFromString(jsonStr); |
| | | // log.debug(JsonUtils.writeJsonStr(resultMap)); |
| | | } catch (Exception e) { |
| | | throw e; |
| | | } |
| | | return resultMap; |
| | | } |
| | | |
| | | private Map<String, Object> getResultFromString(List<Table> result, String jsonStr) throws IOException { |
| | | // convert JSON string to Map |
| | | Map<String, Object> map = JsonUtils.readValue(jsonStr, HashMap.class); |
| | | |
| | | //è§£æmodel |
| | | Map<String, ModelAttr> definitinMap = parseComponents(map); |
| | | |
| | | //è§£æpaths |
| | | Map<String, Map<String, Object>> paths = (Map<String, Map<String, Object>>) map.get("paths"); |
| | | |
| | | //è·åå
¨å±è¯·æ±åæ°æ ¼å¼ä½ä¸ºé»è®¤è¯·æ±åæ°æ ¼å¼ |
| | | List<String> defaultConsumes = (List) map.get("consumes"); |
| | | |
| | | //è·åå
¨å±ååºåæ°æ ¼å¼ä½ä¸ºé»è®¤ååºåæ°æ ¼å¼ |
| | | List<String> defaultProduces = (List) map.get("produces"); |
| | | |
| | | if (paths != null) { |
| | | |
| | | Iterator<Entry<String, Map<String, Object>>> it = paths.entrySet().iterator(); |
| | | while (it.hasNext()) { |
| | | Entry<String, Map<String, Object>> path = it.next(); |
| | | |
| | | // 0. è·å该路ç±ä¸ææè¯·æ±æ¹å¼çå
Œ
±åæ° |
| | | Map<String, Object> methods = (Map<String, Object>) path.getValue(); |
| | | List<LinkedHashMap> commonParameters = (ArrayList) methods.get("parameters"); |
| | | |
| | | Iterator<Entry<String, Object>> it2 = path.getValue().entrySet().iterator(); |
| | | // 1.请æ±è·¯å¾ |
| | | String url = path.getKey(); |
| | | String requestType = null; |
| | | while (it2.hasNext()) { |
| | | try { |
| | | Entry<String, Object> request = it2.next(); |
| | | |
| | | // 2.è¯·æ±æ¹å¼ï¼ç±»ä¼¼ä¸º get,post,delete,put è¿æ · |
| | | requestType = request.getKey(); |
| | | |
| | | if ("parameters".equals(requestType)) { |
| | | continue; |
| | | } |
| | | |
| | | Map<String, Object> content = (Map<String, Object>) request.getValue(); |
| | | |
| | | // 4. 大æ é¢ï¼ç±»è¯´æï¼ |
| | | String title = String.valueOf(((List) content.get("tags")).get(0)); |
| | | |
| | | // 5.å°æ é¢ ï¼æ¹æ³è¯´æï¼ |
| | | String tag = String.valueOf(content.get("summary")); |
| | | |
| | | // 6.æ¥å£æè¿° |
| | | Object descObj = content.get("description"); |
| | | String description = descObj == null ? tag : descObj.toString(); |
| | | |
| | | // 7. 请æ±ä½ |
| | | List<LinkedHashMap> parameters = (ArrayList) content.get("parameters"); |
| | | |
| | | if (!CollectionUtils.isEmpty(parameters)) { |
| | | if (commonParameters != null) { |
| | | parameters.addAll(commonParameters); |
| | | } |
| | | } else { |
| | | if (commonParameters != null) { |
| | | parameters = commonParameters; |
| | | } |
| | | } |
| | | |
| | | // 8.è¿åä½ |
| | | Map<String, Object> responses = (LinkedHashMap) content.get("responses"); |
| | | |
| | | // 9.请æ±åæ°æ ¼å¼ï¼ç±»ä¼¼äº multipart/form-data |
| | | List<String> requestParamsFormates = getRequestParamsFormate(content); |
| | | String requestForm = StringUtils.join(requestParamsFormates, ","); |
| | | |
| | | // ååºæ¥ç¶ææ¯200æ¶çè¿åå¼ |
| | | Map<String, Object> obj = (Map<String, Object>) responses.get("200"); |
| | | Map<String, Object> requestBody = (Map<String, Object>) content.get("requestBody"); |
| | | |
| | | // 10.è¿ååæ°æ ¼å¼ï¼ç±»ä¼¼äº application/json |
| | | List<String> responseParamsFormates = getResponseParamsFormate(obj); |
| | | String responseForm = StringUtils.join(responseParamsFormates, ","); |
| | | |
| | | //å°è£
Table |
| | | Table table = new Table(); |
| | | |
| | | table.setTitle(title); |
| | | table.setUrl(url); |
| | | table.setTag(tag); |
| | | table.setDescription(description); |
| | | table.setRequestForm(requestForm); |
| | | table.setResponseForm(responseForm); |
| | | table.setRequestType(requestType); |
| | | table.setRequestList(processRequestList(parameters, requestBody, definitinMap)); |
| | | |
| | | table.setResponseList(processResponseCodeList(responses, definitinMap)); |
| | | if (obj != null && obj.get("content") != null) { |
| | | table.setModelAttr(processResponseModelAttrs(obj, definitinMap)); |
| | | } |
| | | |
| | | //ç¤ºä¾ |
| | | table.setRequestParam(processRequestParam(table.getRequestList())); |
| | | table.setResponseParam(processResponseParam1(obj, definitinMap)); |
| | | |
| | | result.add(table); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | // StringWriter sw = new StringWriter(); |
| | | // PrintWriter pw = new PrintWriter(sw); |
| | | // e.printStackTrace(pw); |
| | | // throw new JsonProcessingException(url + "æ¥å£æ ¼å¼ä¸æ£ç¡®: " + requestType + "è¯·æ± " + e.getMessage()) {}; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 请æ±åæ°æ ¼å¼ï¼ ç±»ä¼¼äº multipart/form-data |
| | | */ |
| | | private List<String> getRequestParamsFormate(Map<String, Object> obj) { |
| | | Map<String, Object> requestBody = (LinkedHashMap) obj.get("requestBody"); |
| | | List<String> requestTypes = new ArrayList(); |
| | | if (requestBody != null) { |
| | | Map<String, Map> content = (LinkedHashMap) requestBody.get("content"); |
| | | Set keys = content.keySet(); |
| | | return new ArrayList<String>(keys); |
| | | } |
| | | return requestTypes; |
| | | } |
| | | |
| | | /** |
| | | * è¿ååæ°æ ¼å¼ï¼ç±»ä¼¼äº application/json |
| | | * @throws Exception |
| | | */ |
| | | private List<String> getResponseParamsFormate(Map<String, Object> responseObj) { |
| | | Map<String, Map> content = (LinkedHashMap) responseObj.get("content"); |
| | | List<String> responseTypes = new ArrayList(); |
| | | if (content != null) { |
| | | Set keys = content.keySet(); |
| | | return new ArrayList<String>(keys); |
| | | } |
| | | return responseTypes; |
| | | } |
| | | |
| | | /** |
| | | * å¤ç请æ±åæ°å表 |
| | | * |
| | | * @param parameters |
| | | * @param definitinMap |
| | | * @return |
| | | * @throws JsonProcessingException |
| | | */ |
| | | private List<Request> processRequestList(List<LinkedHashMap> parameters, Map<String, Object> requestBody, Map<String, ModelAttr> definitinMap) { |
| | | List<Request> requestList = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(parameters)) { |
| | | for (Map<String, Object> param : parameters) { |
| | | Object in = param.get("in"); |
| | | Request request = new Request(); |
| | | request.setName(String.valueOf(param.get("name"))); |
| | | |
| | | Map<String, String> schema1 = (Map) param.get("schema"); |
| | | |
| | | request.setType(schema1 == null ? " " : schema1.get("type").toString()); |
| | | // request.setType(param.get("type") == null ? "object" : param.get("type").toString()); |
| | | if (param.get("format") != null) { |
| | | request.setType(request.getType() + "(" + param.get("format") + ")"); |
| | | } |
| | | request.setParamType(String.valueOf(in)); |
| | | // èèå¯¹è±¡åæ°ç±»å |
| | | if (in != null && "body".equals(in)) { |
| | | Map<String, Object> schema = (Map) param.get("schema"); |
| | | Object ref = schema.get("$ref"); |
| | | // æ°ç»æ
åµå¦å¤å¤ç |
| | | if (schema.get("type") != null && "array".equals(schema.get("type"))) { |
| | | ref = ((Map) schema.get("items")).get("$ref"); |
| | | request.setType("array"); |
| | | } |
| | | if (ref != null) { |
| | | request.setType(request.getType() + ":" + ref.toString().replaceAll("#/definitions/", "")); |
| | | request.setModelAttr(definitinMap.get(ref)); |
| | | } |
| | | } |
| | | // æ¯å¦å¿
å¡« |
| | | request.setRequire(false); |
| | | if (param.get("required") != null) { |
| | | request.setRequire((Boolean) param.get("required")); |
| | | } |
| | | // åæ°è¯´æ |
| | | request.setRemark(String.valueOf(param.get("description"))); |
| | | requestList.add(request); |
| | | } |
| | | } |
| | | |
| | | if (requestBody != null) { |
| | | Map<String, Map> content = (LinkedHashMap) requestBody.get("content"); |
| | | |
| | | // try { |
| | | // RequestUtils.validateRequestKey(content); |
| | | // } catch(Exception e) { |
| | | // throw new JsonProcessingException("requestybody åæ®µ " + e.getMessage()) {}; |
| | | // } |
| | | |
| | | Iterator<Entry<String, Map>> applications = content.entrySet().iterator(); |
| | | while (applications.hasNext()) { |
| | | Entry<String, Map> application = applications.next(); |
| | | |
| | | if (application.getValue() != null) { |
| | | Request request = new Request(); |
| | | |
| | | Map<String, Object> schema = (Map<String, Object>) application.getValue().get("schema"); |
| | | request.setName(" "); |
| | | request.setType(schema == null ? " " : (schema.get("type") == null ? " " : schema.get("type").toString())); |
| | | request.setParamType("body"); |
| | | |
| | | Object ref = schema.get("$ref"); |
| | | |
| | | if (schema.get("type") != null && "array".equals(schema.get("type"))) { |
| | | ref = ((Map) schema.get("items")).get("$ref"); |
| | | request.setType("array"); |
| | | } |
| | | if (ref != null) { |
| | | // request.setType(request.getType() + ":" + ref.toString().replaceAll("#/definitions/", "")); |
| | | request.setType("object"); |
| | | request.setModelAttr(definitinMap.get(ref)); |
| | | } |
| | | if (schema.get("properties") != null) { |
| | | ArrayList<String> requiredArr = new ArrayList<String>(); |
| | | if (schema.get("required") != null) { |
| | | requiredArr = (ArrayList<String>) schema.get("required"); |
| | | } |
| | | request.setModelAttr(getRequestSchemaModelAttr(schema, requiredArr)); |
| | | } |
| | | |
| | | // æ¯å¦å¿
å¡« |
| | | request.setRequire(true); |
| | | |
| | | // åæ°è¯´æ |
| | | requestList.add(request); |
| | | } |
| | | } |
| | | } |
| | | return requestList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å¤çè¿åç å表 |
| | | * |
| | | * @param responses å
¨é¨ç¶æç è¿å对象 |
| | | * @return |
| | | */ |
| | | private List<Response> processResponseCodeList(Map<String, Object> responses, Map<String, ModelAttr> definitinMap ) { |
| | | List<Response> responseList = new ArrayList<>(); |
| | | Iterator<Entry<String, Object>> resIt = responses.entrySet().iterator(); |
| | | while (resIt.hasNext()) { |
| | | Entry<String, Object> entry = resIt.next(); |
| | | Response response = new Response(); |
| | | // ç¶æç 200 201 401 403 404 è¿æ · |
| | | response.setName(entry.getKey()); |
| | | LinkedHashMap<String, Object> statusCodeInfo = (LinkedHashMap) entry.getValue(); |
| | | response.setDescription(String.valueOf(statusCodeInfo.get("description"))); |
| | | |
| | | Map<String, Map> content = (Map) statusCodeInfo.get("content"); |
| | | |
| | | if (content != null) { |
| | | // try { |
| | | // ResponseUtils.validateResponseKey(content); |
| | | // } catch(Exception e) { |
| | | // throw new JsonProcessingException("responseåæ®µ " + entry.getKey() + "åæ®µ " + e.getMessage()) {}; |
| | | // } |
| | | // responseså
容applicationå¤ä¸ªéåå¤ç |
| | | Iterator<Entry<String, Map>> applications = content.entrySet().iterator(); |
| | | |
| | | while (applications.hasNext()) { |
| | | Entry<String, Map> application = applications.next(); |
| | | |
| | | if (application.getValue() != null) { |
| | | Object schema = application.getValue().get("schema"); |
| | | if (schema != null) { |
| | | Object originalRef = ((LinkedHashMap) schema).get("originalRef"); |
| | | response.setRemark(originalRef == null ? "" : originalRef.toString()); |
| | | } |
| | | responseList.add(response); |
| | | } |
| | | } |
| | | } else { |
| | | String ref = String.valueOf(statusCodeInfo.get("$ref")); |
| | | |
| | | if (ref != "null" && ref != "") { |
| | | ModelAttr modelAttr = definitinMap.get(ref); |
| | | response.setDescription(modelAttr.getDescription()); |
| | | } |
| | | |
| | | responseList.add(response); |
| | | } |
| | | } |
| | | return responseList; |
| | | } |
| | | |
| | | /** |
| | | * å¤çè¿å屿§å表 |
| | | * |
| | | * @param responseObj |
| | | * @param definitinMap |
| | | * @return |
| | | */ |
| | | private ModelAttr processResponseModelAttrs(Map<String, Object> responseObj, Map<String, ModelAttr> definitinMap) { |
| | | Map<String, Map> content = (Map) responseObj.get("content"); |
| | | //å
¶ä»ç±»å |
| | | ModelAttr modelAttr = new ModelAttr(); |
| | | |
| | | Iterator<Entry<String, Map>> applications = content.entrySet().iterator(); |
| | | |
| | | while (applications.hasNext()) { |
| | | Entry<String, Map> application = applications.next(); |
| | | |
| | | if (application.getValue() != null) { |
| | | |
| | | Map<String, Object> schema = (Map<String, Object>) application.getValue().get("schema"); |
| | | String type = (String) schema.get("type"); |
| | | String ref = null; |
| | | //æ°ç» |
| | | if ("array".equals(type)) { |
| | | Map<String, Object> items = (Map<String, Object>) schema.get("items"); |
| | | if (items != null && items.get("$ref") != null) { |
| | | ref = (String) items.get("$ref"); |
| | | } |
| | | } |
| | | //对象 |
| | | if (schema.get("$ref") != null) { |
| | | ref = (String) schema.get("$ref"); |
| | | } |
| | | |
| | | //å
¶ä»ç±»å |
| | | modelAttr.setType(StringUtils.defaultIfBlank(type, StringUtils.EMPTY)); |
| | | |
| | | if (StringUtils.isNotBlank(ref) && definitinMap.get(ref) != null) { |
| | | modelAttr = definitinMap.get(ref); |
| | | } |
| | | |
| | | // æªä½¿ç¨refæ¹å¼ 使ç¨propertiesæ¹å¼ |
| | | if (schema.get("properties") != null) { |
| | | modelAttr = getSchemaModelAttr(schema); |
| | | } |
| | | } |
| | | } |
| | | return modelAttr; |
| | | } |
| | | |
| | | /** |
| | | * è§£æcomponents |
| | | * |
| | | * @param map |
| | | * @return |
| | | */ |
| | | private Map<String, ModelAttr> parseComponents(Map<String, Object> map) { |
| | | Map<String, Object> definitions = (Map<String, Object>) map.get("components"); |
| | | Map<String, ModelAttr> definitinMap = new HashMap<>(256); |
| | | if (definitions != null) { |
| | | Iterator<String> modelNameIt = definitions.keySet().iterator(); |
| | | /** |
| | | "components": { |
| | | "requestBodies": {}, |
| | | "schemas": {} |
| | | } |
| | | */ |
| | | while (modelNameIt.hasNext()) { |
| | | String modeName = modelNameIt.next(); |
| | | /** |
| | | "schemas": { |
| | | "cat":{}, |
| | | "dog":{}, |
| | | } |
| | | */ |
| | | Map<String, Map<String, Object>> modeContent = (Map<String, Map<String, Object>>) definitions.get(modeName); |
| | | |
| | | if (modeContent != null) { |
| | | Iterator<String> modeContentIt = modeContent.keySet().iterator(); |
| | | |
| | | while (modeContentIt.hasNext()) { |
| | | String componentsGrandChildName = modeContentIt.next(); |
| | | |
| | | getAndPutModelAttr(modeContent, definitinMap, modeName, componentsGrandChildName); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return definitinMap; |
| | | } |
| | | |
| | | /** |
| | | * éå½çæModelAttr |
| | | * 对$refç±»å设置å
·ä½å±æ§ |
| | | */ |
| | | private ModelAttr getAndPutModelAttr(Map<String, Map<String, Object>> swaggerMap, Map<String, ModelAttr> resMap, String parentName, String modeName) { |
| | | ModelAttr modeAttr; |
| | | if ((modeAttr = resMap.get("#/components/" + parentName + "/" + modeName)) == null) { |
| | | modeAttr = new ModelAttr(); |
| | | resMap.put("#/components/" + parentName + "/" + modeName, modeAttr); |
| | | } else if (resMap.get("#/components/" + parentName + "/" + modeName) != null) { |
| | | return resMap.get("#/components/" + parentName + "/" + modeName); |
| | | } |
| | | Map<String, Object> modeProperties = (Map<String, Object>) swaggerMap.get(modeName).get("properties"); |
| | | List<ModelAttr> attrList = new ArrayList<>(); |
| | | // è·årequiredåæ®µï¼éåpropertiesæ·»å æ¯å¦å¿
填屿§ |
| | | ArrayList modeRequired = (ArrayList) swaggerMap.get(modeName).get("required"); |
| | | |
| | | if (modeProperties != null) { |
| | | Iterator<Entry<String, Object>> mIt = modeProperties.entrySet().iterator(); |
| | | |
| | | //è§£æå±æ§ |
| | | while (mIt.hasNext()) { |
| | | Entry<String, Object> mEntry = mIt.next(); |
| | | Map<String, Object> attrInfoMap = (Map<String, Object>) mEntry.getValue(); |
| | | ModelAttr child = new ModelAttr(); |
| | | child.setName(mEntry.getKey()); |
| | | child.setType((String) attrInfoMap.get("type")); |
| | | if (attrInfoMap.get("format") != null) { |
| | | child.setType(child.getType() + "(" + attrInfoMap.get("format") + ")"); |
| | | } |
| | | child.setType(StringUtils.defaultIfBlank(child.getType(), "object")); |
| | | |
| | | Object ref = attrInfoMap.get("$ref"); |
| | | Object items = attrInfoMap.get("items"); |
| | | if (ref != null || (items != null && (ref = ((Map) items).get("$ref")) != null)) { |
| | | String refName = ref.toString(); |
| | | //æªå #/components/ åé¢ç |
| | | String clsName = refName.substring(21); |
| | | ModelAttr refModel = getAndPutModelAttr(swaggerMap, resMap, parentName, clsName); |
| | | if (refModel != null) { |
| | | child.setProperties(refModel.getProperties()); |
| | | } |
| | | child.setType(child.getType() + ":" + clsName); |
| | | } |
| | | child.setDescription((String) attrInfoMap.get("description")); |
| | | |
| | | child.setRequire(false); |
| | | if (modeRequired != null && modeRequired.contains(mEntry.getKey())) { |
| | | child.setRequire(true); |
| | | } |
| | | |
| | | attrList.add(child); |
| | | } |
| | | } |
| | | |
| | | Object title = swaggerMap.get(modeName).get("title"); |
| | | Object description = swaggerMap.get(modeName).get("description"); |
| | | modeAttr.setClassName(title == null ? "" : title.toString()); |
| | | modeAttr.setDescription(description == null ? "" : description.toString()); |
| | | modeAttr.setProperties(attrList); |
| | | return modeAttr; |
| | | } |
| | | |
| | | /** |
| | | * éå½çæModelAttr |
| | | * å¤çschema对象 |
| | | * å¤çrequestBodyç´æ¥è¿å屿§å¼æ
åµ |
| | | */ |
| | | private ModelAttr getRequestSchemaModelAttr(Map<String, Object> schemaMap, ArrayList requiredArr) { |
| | | ModelAttr modeAttr = new ModelAttr(); |
| | | Map<String, Object> modeProperties = (Map<String, Object>) schemaMap.get("properties"); |
| | | |
| | | if ("array".equals(schemaMap.get("type"))) { |
| | | Map items = (Map<String, Object>) schemaMap.get("items"); |
| | | |
| | | if (items != null) { |
| | | modeProperties = (Map<String, Object>) items.get("properties"); |
| | | } |
| | | } |
| | | |
| | | if (modeProperties == null) { |
| | | return null; |
| | | } |
| | | Iterator<Entry<String, Object>> mIt = modeProperties.entrySet().iterator(); |
| | | |
| | | List<ModelAttr> attrList = new ArrayList<>(); |
| | | //è§£æå±æ§ |
| | | while (mIt.hasNext()) { |
| | | Entry<String, Object> mEntry = mIt.next(); |
| | | Map<String, Object> attrInfoMap = (Map<String, Object>) mEntry.getValue(); |
| | | ModelAttr child = new ModelAttr(); |
| | | child.setName(mEntry.getKey()); |
| | | child.setType((String) attrInfoMap.get("type")); |
| | | if (attrInfoMap.get("format") != null) { |
| | | child.setType(child.getType() + "(" + attrInfoMap.get("format") + ")"); |
| | | } |
| | | child.setType(StringUtils.defaultIfBlank(child.getType(), "object")); |
| | | |
| | | Object properties = attrInfoMap.get("properties"); |
| | | Object ref = attrInfoMap.get("$ref"); |
| | | Object items = attrInfoMap.get("items"); |
| | | if (properties != null || (items != null)) { |
| | | ArrayList<String> childRequiredArr = new ArrayList<String>(); |
| | | if (attrInfoMap.get("required") != null) { |
| | | childRequiredArr = (ArrayList<String>) attrInfoMap.get("required"); |
| | | } |
| | | ModelAttr refModel = getRequestSchemaModelAttr(attrInfoMap, childRequiredArr); |
| | | if (refModel != null) { |
| | | child.setProperties(refModel.getProperties()); |
| | | } |
| | | child.setType((String) attrInfoMap.get("type")); |
| | | } |
| | | child.setRequire(true); |
| | | if (!requiredArr.contains(mEntry.getKey())) { |
| | | child.setRequire(false); |
| | | } |
| | | child.setDescription((String) attrInfoMap.get("description")); |
| | | attrList.add(child); |
| | | } |
| | | modeAttr.setClassName(""); |
| | | modeAttr.setDescription(""); |
| | | modeAttr.setProperties(attrList); |
| | | return modeAttr; |
| | | } |
| | | |
| | | /** |
| | | * éå½çæModelAttr |
| | | * å¤çschema对象 |
| | | * å¤çresponseDataç´æ¥è¿å屿§å¼æ
åµ |
| | | */ |
| | | private ModelAttr getSchemaModelAttr(Map<String, Object> schemaMap) { |
| | | ModelAttr modeAttr = new ModelAttr(); |
| | | Map<String, Object> modeProperties = (Map<String, Object>) schemaMap.get("properties"); |
| | | |
| | | if ("array".equals(schemaMap.get("type"))) { |
| | | Map items = (Map<String, Object>) schemaMap.get("items"); |
| | | |
| | | if (items != null) { |
| | | modeProperties = (Map<String, Object>) items.get("properties"); |
| | | } |
| | | } |
| | | |
| | | if (modeProperties == null) { |
| | | return null; |
| | | } |
| | | Iterator<Entry<String, Object>> mIt = modeProperties.entrySet().iterator(); |
| | | |
| | | List<ModelAttr> attrList = new ArrayList<>(); |
| | | //è§£æå±æ§ |
| | | while (mIt.hasNext()) { |
| | | Entry<String, Object> mEntry = mIt.next(); |
| | | Map<String, Object> attrInfoMap = (Map<String, Object>) mEntry.getValue(); |
| | | ModelAttr child = new ModelAttr(); |
| | | child.setName(mEntry.getKey()); |
| | | |
| | | child.setType((String) attrInfoMap.get("type")); |
| | | if (attrInfoMap.get("format") != null) { |
| | | child.setType(child.getType() + "(" + attrInfoMap.get("format") + ")"); |
| | | } |
| | | child.setType(StringUtils.defaultIfBlank(child.getType(), "object")); |
| | | |
| | | Object properties = attrInfoMap.get("properties"); |
| | | Object ref = attrInfoMap.get("$ref"); |
| | | Object items = attrInfoMap.get("items"); |
| | | if (properties != null || (items != null)) { |
| | | ModelAttr refModel = getSchemaModelAttr(attrInfoMap); |
| | | if (refModel != null) { |
| | | child.setProperties(refModel.getProperties()); |
| | | } |
| | | child.setType((String) attrInfoMap.get("type")); |
| | | } |
| | | child.setDescription((String) attrInfoMap.get("description")); |
| | | attrList.add(child); |
| | | } |
| | | modeAttr.setClassName(""); |
| | | modeAttr.setDescription(""); |
| | | modeAttr.setProperties(attrList); |
| | | return modeAttr; |
| | | } |
| | | |
| | | /** |
| | | * å¤çè¿åå¼ |
| | | * |
| | | * @param responseObj |
| | | * @return |
| | | */ |
| | | private String processResponseParam(Map<String, Object> responseObj, Map<String, ModelAttr> definitinMap) throws JsonProcessingException { |
| | | Map<String, Map> content = (Map) responseObj.get("content"); |
| | | if (content != null) { |
| | | Iterator<Entry<String, Map>> applications = content.entrySet().iterator(); |
| | | while (applications.hasNext()) { |
| | | Entry<String, Map> application = applications.next(); |
| | | |
| | | if (application.getValue() != null) { |
| | | Map<String, Object> applicationContent = (Map<String, Object>) application.getValue(); |
| | | if (applicationContent != null) { |
| | | Map<String, Object> schema = (Map<String, Object>) applicationContent.get("schema"); |
| | | String type = (String) schema.get("type"); |
| | | String ref = null; |
| | | // æ°ç» |
| | | if ("array".equals(type)) { |
| | | Map<String, Object> items = (Map<String, Object>) schema.get("items"); |
| | | if (items != null && items.get("$ref") != null) { |
| | | ref = (String) items.get("$ref"); |
| | | } |
| | | } |
| | | // 对象ref |
| | | if (schema.get("$ref") != null) { |
| | | ref = (String) schema.get("$ref"); |
| | | } |
| | | if (StringUtils.isNotEmpty(ref)) { |
| | | ModelAttr modelAttr = definitinMap.get(ref); |
| | | if (modelAttr != null && !CollectionUtils.isEmpty(modelAttr.getProperties())) { |
| | | Map<String, Object> responseMap = new HashMap<>(8); |
| | | for (ModelAttr subModelAttr : modelAttr.getProperties()) { |
| | | responseMap.put(subModelAttr.getName(), getValue(subModelAttr.getType(), subModelAttr)); |
| | | } |
| | | return JsonUtils.writeJsonStr(responseMap); |
| | | } |
| | | } |
| | | if (schema.get("properties") != null) { |
| | | ModelAttr modelAttr = getSchemaModelAttr(schema); |
| | | if (modelAttr != null) { |
| | | Map<String, Object> responseMap = new HashMap<>(8); |
| | | for (ModelAttr subModelAttr : modelAttr.getProperties()) { |
| | | responseMap.put(subModelAttr.getName(), getValue(subModelAttr.getType(), subModelAttr)); |
| | | } |
| | | return JsonUtils.writeJsonStr(responseMap); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return StringUtils.EMPTY; |
| | | } |
| | | |
| | | private String processResponseParam1(Map<String, Object> responseObj, Map<String, ModelAttr> definitinMap) { |
| | | Map<String, Map> content = (Map) responseObj.get("content"); |
| | | // if (responseObj != null && content.get("application/json") != null) { |
| | | if (content != null) { |
| | | Iterator<Entry<String, Map>> applications = content.entrySet().iterator(); |
| | | while (applications.hasNext()) { |
| | | Entry<String, Map> application = applications.next(); |
| | | |
| | | if (application.getValue() != null) { |
| | | Map<String, Map<String, Map>> applicationContent = (Map<String, Map<String, Map>>) application.getValue(); |
| | | if (applicationContent != null) { |
| | | Map<String, Map> examples = (Map<String, Map>) applicationContent.get("examples"); |
| | | |
| | | if (examples != null) { |
| | | Map<String, Object> responseData = examples.get("response"); |
| | | |
| | | if (responseData != null) { |
| | | Object value = responseData.get("value"); |
| | | try { |
| | | return JsonUtils.writeJsonStr(value); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } else { |
| | | return ""; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return StringUtils.EMPTY; |
| | | } |
| | | |
| | | /** |
| | | * å°è£
请æ±ä½ |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | private String processRequestParam(List<Request> list) { |
| | | Map<String, Object> headerMap = new LinkedHashMap<>(); |
| | | Map<String, Object> queryMap = new LinkedHashMap<>(); |
| | | Map<String, Object> jsonMap = new LinkedHashMap<>(); |
| | | if (list != null && list.size() > 0) { |
| | | for (Request request : list) { |
| | | String name = request.getName(); |
| | | String paramType = request.getParamType(); |
| | | Object value = getValue(request.getType(), request.getModelAttr()); |
| | | switch (paramType) { |
| | | case "header": |
| | | headerMap.put(name, value); |
| | | break; |
| | | case "query": |
| | | queryMap.put(name, value); |
| | | break; |
| | | case "path": |
| | | queryMap.put(name, value); |
| | | break; |
| | | case "body": |
| | | //TODO æ ¹æ®content-typeåºååæä¸åæ ¼å¼ï¼ç®ååªç¨äºjson |
| | | jsonMap.put(name, value); |
| | | break; |
| | | default: |
| | | break; |
| | | |
| | | } |
| | | } |
| | | } |
| | | String res = ""; |
| | | if (!queryMap.isEmpty()) { |
| | | res += getUrlParamsByMap(queryMap); |
| | | } |
| | | if (!headerMap.isEmpty()) { |
| | | res += " " + getHeaderByMap(headerMap); |
| | | } |
| | | if (!jsonMap.isEmpty()) { |
| | | if (jsonMap.size() == 1) { |
| | | for (Entry<String, Object> entry : jsonMap.entrySet()) { |
| | | try { |
| | | res += " '" + JsonUtils.writeJsonStr(entry.getValue()) + "'"; |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } else { |
| | | try { |
| | | res += " '" + JsonUtils.writeJsonStr(jsonMap) + "'"; |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * ä¾åä¸ï¼å段çé»è®¤å¼ |
| | | * |
| | | * @param type ç±»å |
| | | * @param modelAttr å¼ç¨çç±»å |
| | | * @return |
| | | */ |
| | | private Object getValue(String type, ModelAttr modelAttr) { |
| | | int pos; |
| | | if ((pos = type.indexOf(":")) != -1) { |
| | | type = type.substring(0, pos); |
| | | } |
| | | switch (type) { |
| | | case "string": |
| | | return "string"; |
| | | case "string(date-time)": |
| | | return "2020/01/01 00:00:00"; |
| | | case "integer": |
| | | case "integer(int64)": |
| | | case "integer(int32)": |
| | | return 0; |
| | | case "number": |
| | | return 0.0; |
| | | case "boolean": |
| | | return true; |
| | | case "file": |
| | | return "(binary)"; |
| | | case "array": |
| | | List list = new ArrayList(); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | if (modelAttr != null && !CollectionUtils.isEmpty(modelAttr.getProperties())) { |
| | | for (ModelAttr subModelAttr : modelAttr.getProperties()) { |
| | | map.put(subModelAttr.getName(), getValue(subModelAttr.getType(), subModelAttr)); |
| | | } |
| | | } |
| | | list.add(map); |
| | | return list; |
| | | case "object": |
| | | map = new LinkedHashMap<>(); |
| | | if (modelAttr != null && !CollectionUtils.isEmpty(modelAttr.getProperties())) { |
| | | for (ModelAttr subModelAttr : modelAttr.getProperties()) { |
| | | map.put(subModelAttr.getName(), getValue(subModelAttr.getType(), subModelAttr)); |
| | | } |
| | | } |
| | | return map; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å°mapè½¬æ¢æurl |
| | | */ |
| | | public static String getUrlParamsByMap(Map<String, Object> map) { |
| | | if (map == null || map.isEmpty()) { |
| | | return ""; |
| | | } |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (Entry<String, Object> entry : map.entrySet()) { |
| | | sb.append(entry.getKey() + "=" + entry.getValue()); |
| | | sb.append("&"); |
| | | } |
| | | String s = sb.toString(); |
| | | if (s.endsWith("&")) { |
| | | s = StringUtils.substringBeforeLast(s, "&"); |
| | | } |
| | | return s; |
| | | } |
| | | |
| | | /** |
| | | * å°mapè½¬æ¢æheader |
| | | */ |
| | | public static String getHeaderByMap(Map<String, Object> map) { |
| | | if (map == null || map.isEmpty()) { |
| | | return ""; |
| | | } |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (Entry<String, Object> entry : map.entrySet()) { |
| | | sb.append("--header '"); |
| | | sb.append(entry.getKey() + ":" + entry.getValue()); |
| | | sb.append("'"); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.lightshare.service; |
| | | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by XiuYin.Cui on 2018/1/12. |
| | | */ |
| | | public interface OpenApiWordService { |
| | | |
| | | Map<String,Object> tableList(String swaggerUrl); |
| | | |
| | | Map<String, Object> tableListFromString(String jsonStr) throws IOException; |
| | | |
| | | Map<String, Object> tableList(MultipartFile jsonFile) throws IOException; |
| | | } |
| | |
| | | import cn.flightfeather.supervision.lightshare.service.CommitmentService |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import io.swagger.annotations.ApiResponse |
| | | import org.springframework.web.bind.annotation.* |
| | | import org.springframework.web.multipart.MultipartFile |
| | | import javax.servlet.http.HttpServletResponse |
| | |
| | | @ApiOperation(value = "è·åç¨æ·æ¿è¯ºä¹¦") |
| | | @GetMapping("/letter") |
| | | fun getLetterOfCommitment( |
| | | @RequestParam("userId") userId: String, |
| | | @RequestParam("page") page: Int, |
| | | @RequestParam("per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String, |
| | | @ApiParam(value = "页ç ") @RequestParam("page") page: Int, |
| | | @ApiParam(value = "åé¡µæ°æ®é") @RequestParam("per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | ) = commitmentService.getLetterOfCommitment(userId, page, perPage, response) |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ æ¿è¯ºä¹¦") |
| | | @PostMapping("/letter/upload") |
| | | fun uploadLetterOfCommitment( |
| | | @RequestParam userId: String, |
| | | @RequestParam("params") commitmentVoList: String, |
| | | @RequestPart("images") files: Array<MultipartFile> |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam userId: String, |
| | | @ApiParam(value = "æ¿è¯ºä¹¦ä¿¡æ¯json") @RequestParam("params") commitmentVoList: String, |
| | | @ApiParam(value = "æ¿è¯ºä¹¦å¾ç") @RequestPart("images") files: Array<MultipartFile> |
| | | ) = commitmentService.uploadLetterOfCommitment(userId, commitmentVoList, files) |
| | | } |
| | |
| | | import cn.flightfeather.supervision.lightshare.service.ComplaintService |
| | | import cn.flightfeather.supervision.lightshare.service.ProblemService |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.GetMapping |
| | | import org.springframework.web.bind.annotation.RequestMapping |
| | | import org.springframework.web.bind.annotation.RequestParam |
| | |
| | | @RequestMapping("/complaint") |
| | | class ComplaintController(val complaintService: ComplaintService) { |
| | | |
| | | @ApiOperation(value = "è·å信访æè¯ä¿¡æ¯") |
| | | @GetMapping("") |
| | | fun getComplaints( |
| | | @RequestParam("userId") userId: String |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String |
| | | ) = complaintService.getComplaints(userId) |
| | | |
| | | @ApiOperation(value = "è·åè¡æ¿å¤ç½ä¿¡æ¯") |
| | | @GetMapping("/punishment") |
| | | fun getPunishment( |
| | | @RequestParam("userId") userId: String |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String |
| | | ) = complaintService.getPunishment(userId) |
| | | } |
| | |
| | | import cn.flightfeather.supervision.domain.entity.OnLineQuestion |
| | | import cn.flightfeather.supervision.lightshare.service.OnLineQuestionService |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | |
| | | @Api(tags = ["å¨çº¿å¨è¯¢APIæ¥å£"]) |
| | |
| | | @RequestMapping("/consultation") |
| | | class ConsultationController(val onLineQuestionService: OnLineQuestionService) { |
| | | |
| | | @ApiOperation(value = "æåºå¨è¯¢é®é¢") |
| | | @PostMapping("/add/{userId}") |
| | | fun add( |
| | | @PathVariable userId: String, |
| | | @RequestBody questions: List<OnLineQuestion> |
| | | @ApiParam(value = "ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam(value = "å¨è¯¢é®é¢") @RequestBody questions: List<OnLineQuestion> |
| | | ) = onLineQuestionService.addQuestions(userId, questions) |
| | | } |
| | |
| | | @ApiOperation(value = "è·ååå设å¤ä¿¡æ¯") |
| | | @GetMapping("/purify/info") |
| | | fun getPurifyDeviceInfo( |
| | | @RequestParam("userId") userId: String |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String |
| | | ) = deviceService.getPurifyDeviceInfo(userId) |
| | | |
| | | @ApiOperation(value = "è·åçæµè®¾å¤ä¿¡æ¯") |
| | | @GetMapping("/monitor/info") |
| | | fun getMonitorDeviceInfo( |
| | | @RequestParam("userId") userId: String |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String |
| | | ) = deviceService.getMonitorDeviceInfo(userId) |
| | | |
| | | @ApiOperation(value = "è·åç¨æ·çæµè®¾å¤çåéæ°æ®", notes = "ç®åé»è®¤è¿åææ°ç15æ¡æ°æ®ï¼ææ¶é´ååºæå") |
| | | @GetMapping("/min/value") |
| | | fun getLatestMinuteValue( |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String |
| | | ) = deviceService.getLatestMinuteValue(userId) |
| | | |
| | | @ApiOperation(value = "è·åç¨æ·çæµè®¾å¤çå°æ¶æ°æ®", notes = "é»è®¤è¿åææ°ç15å°æ¶æ°æ®, ææ¶é´ååºæå") |
| | | @GetMapping("/hour/value") |
| | | fun getLatestHourValue( |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String |
| | | ) = deviceService.getLatestHourValue(userId) |
| | | |
| | | @ApiOperation(value = "è·åæåº¦å弿°æ®") |
| | | @PostMapping("/avg/mon/value") |
| | | fun getMonAvgData( |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String, |
| | | @ApiParam(value = "æ¶é´") @RequestBody timeList: List<DateVo> |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String, |
| | | @ApiParam(value = "æ¶é´") @RequestBody timeList: List<DateVo> |
| | | ) = deviceService.getMonAvgData(userId, timeList) |
| | | |
| | | @ApiOperation(value = "è·åç¨æ·çæµè®¾å¤çå岿°æ®", notes = "") |
| | | @GetMapping("/history/value") |
| | | fun getHistoryValue( |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String, |
| | | @ApiParam(value = "å¼å§æ¶é´", example = "yyyy-MM-dd HH:mm") @RequestParam("startTime") startTime: String, |
| | | @ApiParam(value = "ç»ææ¶é´", example = "yyyy-MM-dd HH:mm") @RequestParam("endTime") endTime: String, |
| | | @ApiParam(value = "éæ ·å¨æ, 0ï¼åéåå¼;1ï¼å°æ¶åå¼;(ç®ååªæ¯æåéåå¼)", allowableValues = "0") @RequestParam("period") period: Byte |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String, |
| | | @ApiParam(value = "å¼å§æ¶é´", example = "yyyy-MM-dd HH:mm") @RequestParam("startTime") startTime: String, |
| | | @ApiParam(value = "ç»ææ¶é´", example = "yyyy-MM-dd HH:mm") @RequestParam("endTime") endTime: String, |
| | | @ApiParam(value = "éæ ·å¨æ", example = "0ï¼åéåå¼ï¼1ï¼å°æ¶åå¼;(ç®ååªæ¯æåéåå¼)") @RequestParam("period") period: Byte |
| | | ) = deviceService.getHistoryValue(userId, startTime, endTime, period) |
| | | |
| | | @ApiOperation(value = "è·åæ¯ä¸ªçæµè®¾å¤çææ°åéæ°æ®", notes = "") |
| | | @GetMapping("/min/value/real_time") |
| | | fun getRealTimeData( |
| | | @ApiParam(value = "页æ°") @RequestParam("page") page: Int, |
| | | @ApiParam(value = "æ¯é¡µæ°æ®é") @RequestParam("per_page") perPage: Int |
| | | @ApiParam(value = "页æ°") @RequestParam("page") page: Int, |
| | | @ApiParam(value = "æ¯é¡µæ°æ®é") @RequestParam("per_page") perPage: Int |
| | | ) = deviceService.getRealTimeData(page, perPage) |
| | | } |
| | |
| | | import cn.flightfeather.supervision.lightshare.service.EvaluationService |
| | | import cn.flightfeather.supervision.lightshare.vo.AssessmentSearchCondition |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | import javax.servlet.http.HttpServletResponse |
| | | |
| | |
| | | @RestController |
| | | @RequestMapping("/evaluation") |
| | | class EvaluationController(val evaluationService: EvaluationService) { |
| | | @ApiOperation(value = "è·åææè¯ä¼°æ»å") |
| | | @GetMapping |
| | | fun getAll() = evaluationService.findAll() |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ 䏿¡è¯ä¼°æ»åè®°å½") |
| | | @PutMapping |
| | | fun add(@RequestBody evaluation: Evaluation) = evaluationService.save(evaluation) |
| | | fun add( |
| | | @ApiParam(value = "è¯ä¼°æ°æ®") @RequestBody evaluation: Evaluation |
| | | ) = evaluationService.save(evaluation) |
| | | |
| | | @ApiOperation(value = "æ´æ°ä¸æ¡è¯ä¼°æ»åè®°å½") |
| | | @PostMapping |
| | | fun update(@RequestBody evaluation: Evaluation) = evaluationService.update(evaluation) |
| | | fun update(@ApiParam(value = "è¯ä¼°æ°æ®") @RequestBody evaluation: Evaluation) = evaluationService.update(evaluation) |
| | | |
| | | @ApiOperation(value = "æ¥æ¾ä¸æ¡è¯ä¼°æ»åè®°å½") |
| | | @GetMapping("/{id}") |
| | | fun getById(@PathVariable id: String) = evaluationService.findOne(id) |
| | | fun getById(@ApiParam(value = "è¯ä¼°ä¿¡æ¯ä¸»é®id") @PathVariable id: String) = evaluationService.findOne(id) |
| | | |
| | | @ApiOperation(value = "å é¤ä¸æ¡è¯ä¼°æ»åè®°å½") |
| | | @DeleteMapping("/{id}") |
| | | fun delete(@PathVariable id: String) = evaluationService.delete(id) |
| | | fun delete(@ApiParam(value = "è¯ä¼°ä¿¡æ¯ä¸»é®id") @PathVariable id: String) = evaluationService.delete(id) |
| | | |
| | | @ApiOperation(value = "æ ¹æ®æ¡ä»¶æ¥è¯¢è¯ä¼°æ»å") |
| | | @GetMapping("/totalPoint/{userId}") |
| | | fun getT( |
| | | @PathVariable("userId") userId: String, |
| | | @RequestParam("evaluatorType") evaluatorType: Int, |
| | | @RequestParam("startTime") startTime: String, |
| | | @RequestParam("endTime") endTime: String, |
| | | @RequestParam("sceneTypeId", required = false) sceneTypeId: Int?, |
| | | @RequestParam("erGuid", required = false) erGuid: String?, |
| | | @RequestParam("eId", required = false) eId: String? |
| | | @ApiParam(value = "ç¨æ·id") @PathVariable("userId") userId: String, |
| | | @ApiParam(value = "è¯ä¼°ç±»å") @RequestParam("evaluatorType") evaluatorType: Int, |
| | | @ApiParam(value = "å¼å§æ¶é´") @RequestParam("startTime") startTime: String, |
| | | @ApiParam(value = "ç»ææ¶é´") @RequestParam("endTime") endTime: String, |
| | | @ApiParam(value = "åºæ¯ç±»åid") @RequestParam("sceneTypeId", required = false) sceneTypeId: Int?, |
| | | @ApiParam(value = "åä»»å¡id") @RequestParam("erGuid", required = false) erGuid: String?, |
| | | @ApiParam(value = "è¯ä¼°ä¿¡æ¯ä¸»é®id") @RequestParam("eId", required = false) eId: String? |
| | | ) = evaluationService.getTotalPoints(userId, evaluatorType, startTime, endTime, sceneTypeId, erGuid, eId) |
| | | |
| | | @ApiOperation(value = "è·åç¨æ·è¯ä¼°æ»å") |
| | | @GetMapping("/historyPoint/{userId}") |
| | | fun getHistoryPoint( |
| | | @PathVariable("userId") userId: String, |
| | | @RequestParam(value = "page") page: Int, |
| | | @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | @ApiParam(value = "ç¨æ·id") @PathVariable("userId") userId: String, |
| | | @ApiParam(value = "页ç ") @RequestParam(value = "page") page: Int, |
| | | @ApiParam(value = "åé¡µæ°æ®é") @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | ) = evaluationService.getHistoryPoint(userId, page, perPage, response) |
| | | |
| | | @ApiOperation(value = "è·åä¿¡ç¨è¯ä¼°ç»æ") |
| | | @GetMapping("/creditInfo") |
| | | fun getCreditInfo( |
| | | @RequestParam("userId") userId: String |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String |
| | | ) = evaluationService.getCreditInfo(userId) |
| | | |
| | | @ApiOperation(value = "è·åæä¸ªç¨æ·çä¿¡ç¨è¯ä¼°ç»æ") |
| | | @PostMapping("/search/{userId}") |
| | | fun getAssessments( |
| | | @PathVariable("userId") userId: String, |
| | | @RequestBody condition: AssessmentSearchCondition, |
| | | @RequestParam(value = "page") page: Int, |
| | | @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | @ApiParam(value = "ç¨æ·id") @PathVariable("userId") userId: String, |
| | | @ApiParam(value = "æ¥è¯¢æ¡ä»¶") @RequestBody condition: AssessmentSearchCondition, |
| | | @ApiParam(value = "页ç ") @RequestParam(value = "page") page: Int, |
| | | @ApiParam(value = "åé¡µæ°æ®é") @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | ) = evaluationService.getAssessments(userId, condition, page, perPage, response) |
| | | |
| | | fun autoScore( |
| | |
| | | import cn.flightfeather.supervision.domain.entity.Evaluationrule |
| | | import cn.flightfeather.supervision.lightshare.service.EvaluationruleService |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | import springfox.documentation.annotations.ApiIgnore |
| | | |
| | | @Api(tags = ["è¯åæ»è§åAPIæ¥å£"]) |
| | | @RestController |
| | | @RequestMapping("/evaluationrule") |
| | | class EvaluationruleController (val evaluationruleService: EvaluationruleService){ |
| | | |
| | | @ApiOperation(value = "è·åè¯åè§å表") |
| | | @GetMapping("/rule") |
| | | fun getRules( |
| | | @RequestParam(value = "erGuid", required = false) erGuid: String?, |
| | | @RequestParam(value = "sceneTypeId", required = true) sceneTypeId: Int, |
| | | @ApiParam(value = "è¯å表类å", allowableValues = "null/0: æå¨è¯åï¼1ï¼èªå¨è¯å") @RequestParam(value = "erType", required = false) erType: Int?) |
| | | = evaluationruleService.getRule(erGuid, sceneTypeId, erType) |
| | | @ApiParam(value = "è§å主é®id") @RequestParam(value = "erGuid", required = false) erGuid: String?, |
| | | @ApiParam(value = "åºæ¯ç±»åid") @RequestParam(value = "sceneTypeId", required = true) sceneTypeId: Int, |
| | | @ApiParam(value = "è¯å表类å", allowableValues = "null, 0, 1") @RequestParam(value = "erType", required = false) erType: Int?) |
| | | = evaluationruleService.getRule(erGuid, sceneTypeId, erType) |
| | | |
| | | @ApiOperation(value = "è·åææè¯åè§å表") |
| | | @GetMapping |
| | | fun getAll() = evaluationruleService.findAll() |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ è¯åè§å表") |
| | | @PutMapping |
| | | fun add(@RequestBody evaluationrule: Evaluationrule) = evaluationruleService.save(evaluationrule) |
| | | fun add(@ApiParam(value = "è¯åè§å") @RequestBody evaluationrule: Evaluationrule) = evaluationruleService.save(evaluationrule) |
| | | |
| | | @ApiOperation(value = "æ´æ°è¯åè§å表") |
| | | @PostMapping |
| | | fun update(@RequestBody evaluationrule: Evaluationrule) = evaluationruleService.update(evaluationrule) |
| | | fun update(@ApiParam(value = "è¯åè§å") @RequestBody evaluationrule: Evaluationrule) = evaluationruleService.update(evaluationrule) |
| | | |
| | | @ApiOperation(value = "æ¥æ¾è¯åè§å表") |
| | | @GetMapping("/{id}") |
| | | fun getById(@PathVariable id:String) = evaluationruleService.findOne(id) |
| | | fun getById(@ApiParam(value = "è¯åè§å表id") @PathVariable id:String) = evaluationruleService.findOne(id) |
| | | |
| | | @ApiIgnore |
| | | @ApiOperation(value = "å é¤è¯åè§å表") |
| | | @DeleteMapping("/{id}") |
| | | fun delete (@PathVariable id: String) = evaluationruleService.delete(id) |
| | | } |
| | |
| | | import cn.flightfeather.supervision.domain.entity.Evaluationsubrule |
| | | import cn.flightfeather.supervision.lightshare.service.EvaluationsubruleService |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | import springfox.documentation.annotations.ApiIgnore |
| | | |
| | | @Api(tags = ["è¯ååè§åAPIæ¥å£"]) |
| | | @RestController |
| | | @RequestMapping("/evaluationsubrule") |
| | | class EvaluationsubruleController (val evaluationsubruleService: EvaluationsubruleService) { |
| | | @ApiOperation(value = "è·åææè¯åè§åå项表") |
| | | @GetMapping |
| | | fun getAll() = evaluationsubruleService.findAll() |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ è¯åè§åå项表") |
| | | @PutMapping |
| | | fun add(@RequestBody evaluationsubrule: Evaluationsubrule) = evaluationsubruleService.save(evaluationsubrule) |
| | | fun add(@ApiParam(value = "è¯åè§åå项表") @RequestBody evaluationsubrule: Evaluationsubrule) = evaluationsubruleService.save(evaluationsubrule) |
| | | |
| | | @ApiOperation(value = "æ´æ°è¯åè§åå项表") |
| | | @PostMapping |
| | | fun update(@RequestBody evaluationsubrule: Evaluationsubrule) = evaluationsubruleService.update(evaluationsubrule) |
| | | fun update(@ApiParam(value = "è¯åè§åå项表") @RequestBody evaluationsubrule: Evaluationsubrule) = evaluationsubruleService.update(evaluationsubrule) |
| | | |
| | | @ApiOperation(value = "æ¥æ¾è¯åè§åå项表") |
| | | @GetMapping("/{ruleId}") |
| | | fun getById(@PathVariable ruleId:String) = evaluationsubruleService.findByRuleId(ruleId) |
| | | fun getById(@ApiParam(value = "è¯åè§åå项表id") @PathVariable ruleId:String) = evaluationsubruleService.findByRuleId(ruleId) |
| | | |
| | | @ApiIgnore |
| | | @ApiOperation(value = "å é¤è¯åè§åå项表") |
| | | @DeleteMapping("/{id}") |
| | | fun delete (@PathVariable id: String) = evaluationsubruleService.delete(id) |
| | | |
| | |
| | | import cn.flightfeather.supervision.lightshare.service.HazardousWasteService |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.GetMapping |
| | | import org.springframework.web.bind.annotation.RequestMapping |
| | | import org.springframework.web.bind.annotation.RequestParam |
| | |
| | | |
| | | @ApiOperation(value = "è·åç¨æ·æå±ä¼ä¸çå±åºå¤æ¡ä¿¡æ¯") |
| | | @GetMapping("/file") |
| | | fun getFile(@RequestParam("userId") userId: String) = hazardousWasteService.getFile(userId) |
| | | fun getFile(@ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String) = hazardousWasteService.getFile(userId) |
| | | |
| | | @ApiOperation(value = "è·åç¨æ·æå±ä¼ä¸çå±åºå¤ç½®è®°å½") |
| | | @GetMapping("/record") |
| | | fun getRecord( |
| | | @RequestParam("userId") userId: String, |
| | | @RequestParam(value = "year", required = false) year: String? |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String, |
| | | @ApiParam(value = "年份") @RequestParam(value = "year", required = false) year: String? |
| | | ) = hazardousWasteService.getRecord(userId, year) |
| | | } |
| | |
| | | import cn.flightfeather.supervision.domain.entity.Itemevaluation |
| | | import cn.flightfeather.supervision.lightshare.service.ItemevaluationService |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | import springfox.documentation.annotations.ApiIgnore |
| | | |
| | | @Api(tags = ["è¯åå项å¾åAPIæ¥å£"]) |
| | | @RestController |
| | | @RequestMapping("/itemevaluation") |
| | | class ItemevaluationController (val itemevaluationService: ItemevaluationService){ |
| | | @ApiOperation(value = "è·åææè¯åå项å¾åè®°å½") |
| | | @GetMapping |
| | | fun getAll() = itemevaluationService.findAll() |
| | | |
| | | @ApiOperation(value = "æ ¹æ®åä»»å¡idè·åè¯åå项å¾åè®°å½") |
| | | @GetMapping("/subtask/{id}") |
| | | fun getBySubtaskId(@PathVariable id:String) = itemevaluationService.findBySubTaskID(id) |
| | | fun getBySubtaskId(@ApiParam(value = "åä»»å¡id") @PathVariable id:String) = itemevaluationService.findBySubTaskID(id) |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ ä¸ä¸ªè¯åå项å¾åè®°å½") |
| | | @PutMapping |
| | | fun add(@RequestBody itemevaluation: Itemevaluation) = itemevaluationService.save(itemevaluation) |
| | | fun add(@ApiParam(value = "è¯åå项å¾åè®°å½") @RequestBody itemevaluation: Itemevaluation) = itemevaluationService.save(itemevaluation) |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ ä¸ç»è¯åå项å¾åè®°å½") |
| | | @PutMapping("/addlist") |
| | | fun addList(@RequestBody itemevaluationlist: List<Itemevaluation>) = itemevaluationService.savelist(itemevaluationlist) |
| | | fun addList(@ApiParam(value = "è¯åå项å¾åè®°å½æ°ç»") @RequestBody itemevaluationlist: List<Itemevaluation>) = itemevaluationService.savelist(itemevaluationlist) |
| | | |
| | | @ApiOperation(value = "æ´æ°ä¸æ¡è¯åå项å¾åè®°å½") |
| | | @PostMapping |
| | | fun update(@RequestBody itemevaluation: Itemevaluation) = itemevaluationService.update(itemevaluation) |
| | | fun update(@ApiParam(value = "è¯åå项å¾åè®°å½") @RequestBody itemevaluation: Itemevaluation) = itemevaluationService.update(itemevaluation) |
| | | |
| | | @ApiOperation(value = "æ´æ°ä¸ç»è¯åå项å¾åè®°å½") |
| | | @PostMapping("/uplist") |
| | | fun updatelist(@RequestBody itemevaluationlist: List<Itemevaluation>) = itemevaluationService.updatelist(itemevaluationlist) |
| | | fun updatelist(@ApiParam(value = "è¯åå项å¾åè®°å½æ°ç»") @RequestBody itemevaluationlist: List<Itemevaluation>) = itemevaluationService.updatelist(itemevaluationlist) |
| | | |
| | | @ApiOperation(value = "æ¥æ¾è¯åå项å¾åè®°å½") |
| | | @GetMapping("/{id}") |
| | | fun getById(@PathVariable id:String) = itemevaluationService.findOne(id) |
| | | fun getById(@ApiParam(value = "è¯åå项å¾åè®°å½id") @PathVariable id:String) = itemevaluationService.findOne(id) |
| | | |
| | | @ApiIgnore |
| | | @ApiOperation(value = "å é¤è¯åå项å¾åè®°å½") |
| | | @DeleteMapping("/{id}") |
| | | fun delete (@PathVariable id: String) = itemevaluationService.delete(id) |
| | | fun delete (@ApiParam(value = "è¯åå项å¾åè®°å½id") @PathVariable id: String) = itemevaluationService.delete(id) |
| | | |
| | | @ApiOperation(value = "æ ¹æ®æ»åidè·å对åºè¯åå项å¾åè®°å½") |
| | | @GetMapping("/pointId/{evaluationId}") |
| | | fun getItemEvaluationList(@PathVariable evaluationId: String) = itemevaluationService.getItemEvaluationList(evaluationId) |
| | | fun getItemEvaluationList(@ApiParam(value = "æ»åè®°å½id") @PathVariable evaluationId: String) = itemevaluationService.getItemEvaluationList(evaluationId) |
| | | } |
| | |
| | | import cn.flightfeather.supervision.lightshare.service.LawService |
| | | import cn.flightfeather.supervision.lightshare.vo.LawsRegulationsCondition |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | import javax.servlet.http.HttpServletResponse |
| | | |
| | |
| | | @RequestMapping("/laws") |
| | | class LawController(val lawService: LawService) { |
| | | |
| | | @ApiOperation(value = "è·åæææ³å¾æ³è§") |
| | | @GetMapping |
| | | fun getLaws( |
| | | @RequestParam(value = "page") page: Int, |
| | | @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | @ApiParam(value = "页ç ") @RequestParam(value = "page") page: Int, |
| | | @ApiParam(value = "åé¡µæ°æ®é") @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | ) = lawService.getLaws(page, perPage, response) |
| | | |
| | | @ApiOperation(value = "æ ¹æ®idæ¥æ¾æ³å¾æ³è§") |
| | | @GetMapping("/text") |
| | | fun getLawText( |
| | | @RequestParam(value = "id") lawId: String |
| | | @ApiParam(value = "æ³å¾æ³è§è®°å½id") @RequestParam(value = "id") lawId: String |
| | | ) = lawService.getLawText(lawId) |
| | | |
| | | @ApiOperation(value = "æ¥æ¾æ³å¾æ³è§") |
| | | @PostMapping("/condition/{userId}") |
| | | fun getLawsRegulations( |
| | | @PathVariable userId: String, |
| | | @RequestBody condition: LawsRegulationsCondition, |
| | | @RequestParam(value = "page") page: Int, |
| | | @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | @ApiParam(value = "ç¨æ·çid") @PathVariable userId: String, |
| | | @ApiParam(value = "æ¥æ¾æ¡ä»¶") @RequestBody condition: LawsRegulationsCondition, |
| | | @ApiParam(value = "页ç ") @RequestParam(value = "page") page: Int, |
| | | @ApiParam(value = "åé¡µæ°æ®é") @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | ) = lawService.getLawsRegulations(condition, page, perPage, response) |
| | | |
| | | @ApiOperation(value = "æ ¹æ®è¡ä¸ç±»åæ¥æ¾ç¸å
³æ³å¾æ³è§") |
| | | @PostMapping("/eachType/{userId}") |
| | | fun getLawsRegulationsWithEachType( |
| | | @PathVariable userId: String, |
| | | @RequestBody condition: LawsRegulationsCondition |
| | | @ApiParam(value = "ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam(value = "æ¥æ¾æ¡ä»¶") @RequestBody condition: LawsRegulationsCondition |
| | | ) = lawService.getLawsRegulationsWithEachType(condition) |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.* |
| | | import org.springframework.web.multipart.MultipartFile |
| | | import org.synchronoss.cloud.nio.multipart.Multipart |
| | | import springfox.documentation.annotations.ApiIgnore |
| | | import javax.servlet.http.HttpServletResponse |
| | | |
| | | @Api(tags = ["å°è´¦APIæ¥å£"]) |
| | |
| | | @RequestMapping("/ledger") |
| | | class LedgerController(val ledgerService: LedgerService) { |
| | | |
| | | @ApiOperation(value = "è·åå°è´¦ç±»å") |
| | | @GetMapping("/type") |
| | | fun getLedgerType( |
| | | @RequestParam(value = "sceneType") sceneType: Int |
| | | @ApiParam("åºæ¯ç±»åid") @RequestParam(value = "sceneType") sceneType: Int |
| | | ) = ledgerService.getLedgerType(sceneType) |
| | | |
| | | @ApiOperation(value = "è·åç¨æ·æä¸ªæ¶é´ç¹ä¸åºè¯¥æäº¤çææå°è´¦å对åºçæäº¤ç¶æãå®¡æ ¸ç¶æçä¿¡æ¯") |
| | | @GetMapping("/{userId}/summary") |
| | | fun getUserLedgerSummary( |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("åºæ¯ç±»åid") @RequestParam(value = "sceneType") sceneType: Int, |
| | | @ApiParam(value = "æ¶é´", example = "yyyy-MM-dd") @RequestParam(value = "time")time: String |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("åºæ¯ç±»åid") @RequestParam(value = "sceneType") sceneType: Int, |
| | | @ApiParam(value = "æ¶é´", example = "yyyy-MM-dd") @RequestParam(value = "time")time: String |
| | | ) = ledgerService.getUserLedgerSummary(userId, sceneType, time) |
| | | |
| | | @ApiOperation(value = "è·åå°è´¦è¯¦æ
") |
| | | @GetMapping("/{userId}/detail") |
| | | fun getLedgerDetail( |
| | | @PathVariable userId: String, |
| | | @RequestParam(value = "ledgerSubTypeId", required = false) ledgerSubTypeId: Int?, |
| | | @RequestParam(value = "sceneType") sceneType: Int, |
| | | @RequestParam(value = "startTime") startTime: String, |
| | | @RequestParam(value = "endTime") endTime: String, |
| | | @RequestParam(value = "page", required = false) page: Int?, |
| | | @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("å°è´¦ç±»åid") @RequestParam(value = "ledgerSubTypeId", required = false) ledgerSubTypeId: Int?, |
| | | @ApiParam("åºæ¯ç±»åid") @RequestParam(value = "sceneType") sceneType: Int, |
| | | @ApiParam("ä¸ä¼ å¼å§æ¶é´") @RequestParam(value = "startTime") startTime: String, |
| | | @ApiParam("ä¸ä¼ ç»ææ¶é´") @RequestParam(value = "endTime") endTime: String, |
| | | @ApiParam("页ç ") @RequestParam(value = "page", required = false) page: Int?, |
| | | @ApiParam("åé¡µæ°æ®é") @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | ) = ledgerService.getLedgerDetail(userId, ledgerSubTypeId, sceneType, startTime, endTime, page, perPage, response) |
| | | |
| | | @ApiOperation(value = "è·åç¨æ·æç±»å°è´¦è¯¦æ
æè
ææå°è´¦ç详æ
") |
| | | @GetMapping("/{userId}/detail2") |
| | | fun getLedgerDetail2( |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam(value = "å°è´¦åç±»åidï¼ å¦æä¸ä¼ ï¼åé»è®¤æ ¹æ®åºæ¯ç±»åè·åææå°è´¦", required = false) @RequestParam(value = "ledgerSubTypeId", required = false) ledgerSubTypeId: Int?, |
| | | @ApiParam("åºæ¯ç±»åid") @RequestParam(value = "sceneType") sceneType: Int, |
| | | @ApiParam(value = "æ¶é´", example = "yyyy-MM-dd") @RequestParam(value = "time") time: String |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam(value = "å°è´¦åç±»åidï¼ å¦æä¸ä¼ ï¼åé»è®¤æ ¹æ®åºæ¯ç±»åè·åææå°è´¦", required = false) @RequestParam(value = "ledgerSubTypeId", required = false) ledgerSubTypeId: Int?, |
| | | @ApiParam("åºæ¯ç±»åid") @RequestParam(value = "sceneType") sceneType: Int, |
| | | @ApiParam(value = "æ¶é´", example = "yyyy-MM-dd") @RequestParam(value = "time") time: String |
| | | ) = ledgerService.getLedgerDetail2(userId, ledgerSubTypeId, sceneType, time) |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ å°è´¦ä¿¡æ¯") |
| | | @PostMapping("/{userId}/upload") |
| | | fun uploadLedger( |
| | | @PathVariable userId: String, |
| | | @RequestParam("params") ledgerVoList: String, |
| | | @RequestPart("images") files:Array<MultipartFile> |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("å°è´¦ä¿¡æ¯json") @RequestParam("params") ledgerVoList: String, |
| | | @ApiParam("å°è´¦å¾ç") @RequestPart("images") files:Array<MultipartFile> |
| | | ) = ledgerService.uploadLedger(userId, ledgerVoList, files) |
| | | |
| | | @ApiOperation(value = "è·åæä¸ªå°è´¦æ¾ç¤ºå¾æ url") |
| | | @GetMapping("/{userId}/img") |
| | | fun getLedgerImg( |
| | | @PathVariable userId: String, |
| | | @RequestParam("ledgerType") ledgerType: Int |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("å°è´¦ç±»åid") @RequestParam("ledgerType") ledgerType: Int |
| | | ) = ledgerService.getLedgerImg(userId, ledgerType) |
| | | |
| | | @ApiIgnore("该æ¥å£æªä½¿ç¨ï¼èèåç»å é¤") |
| | | @ApiOperation(value = "è·åå¤ä¸ªå°è´¦å¾æ ä¿¡æ¯") |
| | | @GetMapping("/{userId}/imgs") |
| | | fun getLedgerImgs( |
| | | @PathVariable userId: String, |
| | | @RequestParam("ledgerTypes") ledgerTypes: List<Int> |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("å°è´¦ç±»åidæ°ç»") @RequestParam("ledgerTypes") ledgerTypes: List<Int> |
| | | ) = ledgerService.getLedgerImgs(userId, ledgerTypes) |
| | | } |
| | |
| | | |
| | | import cn.flightfeather.supervision.domain.entity.Mediafile |
| | | import cn.flightfeather.supervision.lightshare.service.MediafileService |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | import org.springframework.web.multipart.MultipartFile |
| | | import springfox.documentation.annotations.ApiIgnore |
| | | |
| | | @Api(tags = ["å¤åªä½æä»¶APIæ¥å£"]) |
| | | @RestController |
| | | @RequestMapping("/mediafile") |
| | | class MediafileController (val mediafileService: MediafileService){ |
| | | @ApiOperation(value = "è·åææå¤åªä½æä»¶ä¿¡æ¯") |
| | | @GetMapping |
| | | fun getAll() = mediafileService.findAll() |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ ä¸ä¸ªå¤åªä½æä»¶ä¿¡æ¯") |
| | | @PutMapping |
| | | fun add(@RequestBody mediafile: Mediafile) = mediafileService.save(mediafile) |
| | | fun add( |
| | | @ApiParam("å¤åªä½æä»¶ä¿¡æ¯") @RequestBody mediafile: Mediafile) |
| | | = mediafileService.save(mediafile) |
| | | |
| | | @ApiOperation(value = "æ´æ°ä¸ä¸ªå¤åªä½æä»¶ä¿¡æ¯") |
| | | @PostMapping |
| | | fun update(@RequestBody mediafile: Mediafile) = mediafileService.update(mediafile) |
| | | fun update( |
| | | @ApiParam("å¤åªä½æä»¶ä¿¡æ¯") @RequestBody mediafile: Mediafile) |
| | | = mediafileService.update(mediafile) |
| | | |
| | | @ApiOperation(value = "æ¥æ¾ä¸ä¸ªå¤åªä½æä»¶ä¿¡æ¯") |
| | | @GetMapping("/{id}") |
| | | fun getById(@PathVariable id:String) = mediafileService.findOne(id) |
| | | fun getById( |
| | | @ApiParam("å¤åªä½æä»¶ä¿¡æ¯id") @PathVariable id:String) |
| | | = mediafileService.findOne(id) |
| | | |
| | | @ApiIgnore("é£ç¾½ç管åå°ç§»æ¤çapiï¼èèåç»å é¤") |
| | | @ApiOperation(value = "æ ¹æ®åä»»å¡idåä¸å¡ç±»åIDæ¥è¯¢") |
| | | @GetMapping("/{id}/{btid}") |
| | | fun getBySubtaskId(@PathVariable id:String,@PathVariable btid:String) = mediafileService.findBysubtaskbtid(id,btid) |
| | | fun getBySubtaskId( |
| | | @ApiParam("åä»»å¡id") @PathVariable id:String, |
| | | @ApiParam("ä¸å¡ç±»åID") @PathVariable btid:String) |
| | | = mediafileService.findBysubtaskbtid(id,btid) |
| | | |
| | | @ApiIgnore |
| | | @ApiOperation(value = "å é¤ä¸ä¸ªå¤åªä½æä»¶ä¿¡æ¯") |
| | | @DeleteMapping("/{id}") |
| | | fun delete (@PathVariable id: String) = mediafileService.delete(id) |
| | | fun delete ( |
| | | @ApiParam("å¤åªä½æä»¶ä¿¡æ¯id") @PathVariable id: String) |
| | | = mediafileService.delete(id) |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ å¤åªä½æä»¶ä¿¡æ¯") |
| | | @PostMapping("/add") |
| | | fun addProblem(@RequestParam("mediafileVoList") mediafileVoList: String, @RequestPart("Photos") files: Array<MultipartFile>) { |
| | | mediafileService.addMedifile(mediafileVoList,files) |
| | | } |
| | | fun addProblem( |
| | | @ApiParam("å¤åªä½æä»¶ä¿¡æ¯json") @RequestParam("mediafileVoList") mediafileVoList: String, |
| | | @ApiParam("å¤åªä½æä»¶") @RequestPart("Photos") files: Array<MultipartFile> |
| | | ) = mediafileService.addMedifile(mediafileVoList, files) |
| | | } |
| | |
| | | import cn.flightfeather.supervision.lightshare.vo.UserStatusVo |
| | | import cn.flightfeather.supervision.websocket.Processor |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | import org.springframework.web.multipart.MultipartFile |
| | | import javax.servlet.http.HttpServletResponse |
| | |
| | | class MeetingInfoController(val meetingInfoService: MeetingInfoService) { |
| | | |
| | | /*****************************ä¼è®®********************************************/ |
| | | @ApiOperation(value = "è·åç¨æ·çä¼è®®ä¿¡æ¯") |
| | | @GetMapping("/info/{userId}") |
| | | fun getMeetingInfo( |
| | | @PathVariable userId: String, |
| | | @RequestParam(value = "status") status: Int, |
| | | @RequestParam(value = "page") page: Int, |
| | | @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam(value = "æ¥è¯¢ç±»å", allowableValues = "1,2,3,4,5") @RequestParam(value = "status") status: Int, |
| | | @ApiParam("页ç ") @RequestParam(value = "page") page: Int, |
| | | @ApiParam("åé¡µæ°æ®é") @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | ) = meetingInfoService.getMeetingInfo(userId, status, page, perPage, response) |
| | | |
| | | @ApiOperation(value = "æ ¹æ®idæ¥æ¾ä¼è®®ä¿¡æ¯") |
| | | @GetMapping("/info/meetingId/{userId}") |
| | | fun getMeetingInfoById( |
| | | @PathVariable userId: String, |
| | | @RequestParam(value = "meetingId") meetingId: String |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam(value = "meetingId") meetingId: String |
| | | ) = meetingInfoService.getMeetingInfoById(userId, meetingId) |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ ä¼è®®ä¿¡æ¯") |
| | | @PostMapping("/info/{userId}") |
| | | fun addMeetingInfo( |
| | | @PathVariable userId: String, |
| | | @RequestBody meetingInfo: MeetingInfo |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®ä¿¡æ¯") @RequestBody meetingInfo: MeetingInfo |
| | | ) = meetingInfoService.addMeetingInfo(userId, meetingInfo) |
| | | |
| | | @ApiOperation(value = "æ´æ°ä¼è®®ä¿¡æ¯") |
| | | @PutMapping("/info/{userId}") |
| | | fun updateMeeting( |
| | | @PathVariable userId: String, |
| | | @RequestBody meetingInfo: MeetingInfo |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®ä¿¡æ¯") @RequestBody meetingInfo: MeetingInfo |
| | | ) = meetingInfoService.updateMeetingInfo(userId, meetingInfo) |
| | | |
| | | @ApiOperation(value = "å é¤ä¼è®®") |
| | | @PostMapping("/delete/{userId}") |
| | | fun deleteMeeting( |
| | | @PathVariable userId: String, |
| | | @RequestParam(value = "meetingId") meetingId: String |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam(value = "meetingId") meetingId: String |
| | | ) = meetingInfoService.deleteMeetingInfo(userId, meetingId) |
| | | |
| | | @ApiOperation(value = "è·åç¨æ·ä¼è®®ç¾å°ç¶æ") |
| | | @GetMapping("/registerStatus/{userId}") |
| | | fun getMeetingRegisterStatus( |
| | | @PathVariable userId: String, |
| | | @RequestParam("meetingId") meetingId: String, |
| | | @RequestParam("roomId") roomId: String? |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam("meetingId") meetingId: String, |
| | | @ApiParam(value = "ä¼è®®å®¤id", required = false) @RequestParam("roomId") roomId: String? |
| | | ) = meetingInfoService.getMeetingRegisterStatus(userId, meetingId, roomId) |
| | | |
| | | @ApiOperation(value = "è·åä¼è®®ç¾å°è®°å½") |
| | | @GetMapping("/registerRecord/{userId}") |
| | | fun getMeetingRegisterRecord( |
| | | @PathVariable userId: String, |
| | | @RequestParam("meetingId") meetingId: String, |
| | | @RequestParam("roomId") roomId: String? |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam("meetingId") meetingId: String, |
| | | @ApiParam(value = "ä¼è®®å®¤id", required = false) @RequestParam("roomId") roomId: String? |
| | | ) = meetingInfoService.getMeetingRegisterRecord(userId, meetingId, roomId) |
| | | |
| | | @ApiOperation(value = "ä¼è®®ç¾å°") |
| | | @PostMapping("/register/{userId}") |
| | | fun meetingRegister( |
| | | @PathVariable userId: String, |
| | | @RequestParam("meetingId") meetingId: String, |
| | | @RequestParam("roomId") roomId: String? |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam("meetingId") meetingId: String, |
| | | @ApiParam(value = "ä¼è®®å®¤id", required = false) @RequestParam("roomId") roomId: String? |
| | | ) = meetingInfoService.meetingRegister(userId, meetingId, roomId) |
| | | |
| | | @ApiOperation(value = "è·åä¼è®®çä¼è®®å®¤") |
| | | @GetMapping("/room/{userId}") |
| | | fun getMeetingRoom( |
| | | @PathVariable userId: String, |
| | | @RequestParam("meetingId") meetingId: String |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam("meetingId") meetingId: String |
| | | ) = meetingInfoService.getMeetingRoom(userId, meetingId) |
| | | |
| | | /*****************************åä¼äººå********************************************/ |
| | | @ApiOperation(value = "æ·»å ä¼è®®åä¼äººå") |
| | | @PostMapping("/participant/{userId}") |
| | | fun addParticipant( |
| | | @PathVariable userId: String, |
| | | @RequestBody participantList: List<Participant> |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("åä¼äººåå表") @RequestBody participantList: List<Participant> |
| | | ) = meetingInfoService.addParticipant(userId, participantList) |
| | | |
| | | @ApiOperation(value = "å é¤ä¼è®®åä¼äººå") |
| | | @PostMapping("/participant/{userId}/delete") |
| | | fun deleteParticipant( |
| | | @PathVariable userId: String, |
| | | @RequestParam(value = "meetingId") meetingId: String, |
| | | @RequestBody participantList: List<Participant> |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam(value = "meetingId") meetingId: String, |
| | | @ApiParam("å¾
å é¤åä¼äººåå表") @RequestBody participantList: List<Participant> |
| | | ) = meetingInfoService.deleteParticipant(userId, meetingId, participantList) |
| | | |
| | | @ApiOperation(value = "è·åä¼è®®çåä¼äººå") |
| | | @GetMapping("/participant/{userId}") |
| | | fun getParticipant( |
| | | @PathVariable userId: String, |
| | | @RequestParam("meetingId") meetingId: String, |
| | | @RequestParam("roomId") roomId: String?, |
| | | @RequestParam("participantType") participantType: Int |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam("meetingId") meetingId: String, |
| | | @ApiParam("ä¼è®®å®¤id") @RequestParam("roomId") roomId: String?, |
| | | @ApiParam(value = "åä¼äººåç±»å", name = "0:主æäºº,1:ä¼è®®å宾,2:ä¼ä¸ä»£è¡¨,3:ä¸è¬ä¸ä¼äºº,99:å
¶ä»,-1:å
¨é¨", allowableValues = "0,1,2,3,99,-1") @RequestParam("participantType") participantType: Int |
| | | ) = meetingInfoService.getParticipant(userId, meetingId, roomId, participantType) |
| | | |
| | | @ApiOperation(value = "è·åä¼è®®å¨çº¿äººå") |
| | | @GetMapping("/participant/{userId}/onlineCount") |
| | | fun getOnlineUsers( |
| | | @PathVariable userId: String, |
| | | @RequestParam("meetingId") meetingId: String, |
| | | @RequestParam("roomId") roomId: String |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam("meetingId") meetingId: String, |
| | | @ApiParam("ä¼è®®å®¤id") @RequestParam("roomId") roomId: String |
| | | ) = meetingInfoService.getOnlineUsers(userId, meetingId, roomId) |
| | | |
| | | @ApiOperation(value = "è®¾ç½®ç¨æ·çç¦è¨ç¶æ") |
| | | @PostMapping("/participant/{userId}/setMute") |
| | | fun setMuteStatus( |
| | | @PathVariable userId: String, |
| | | @RequestParam("meetingId") meetingId: String, |
| | | @RequestParam("roomId") roomId: String, |
| | | @RequestBody userStatusList: List<UserStatusVo> |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam("meetingId") meetingId: String, |
| | | @ApiParam("ä¼è®®å®¤id") @RequestParam("roomId") roomId: String, |
| | | @ApiParam("ç¨æ·ç¶æ") @RequestBody userStatusList: List<UserStatusVo> |
| | | ) = meetingInfoService.setMuteStatus(userId, meetingId, roomId, userStatusList) |
| | | |
| | | /*****************************ä¼è®®æä»¶********************************************/ |
| | | @ApiOperation(value = "ä¸ä¼ ä¼è®®æä»¶") |
| | | @PostMapping("/uploadFile/{userId}") |
| | | fun uploadFiles( |
| | | @PathVariable userId: String, |
| | | @RequestParam("meetingId") meetingId: String, |
| | | @RequestParam("roomId") roomId: String, |
| | | @RequestParam("documentType") documentType: Int, |
| | | @RequestParam("params") msgVo: String, |
| | | @RequestPart("files") files: Array<MultipartFile> |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam("meetingId") meetingId: String, |
| | | @ApiParam("ä¼è®®å®¤id") @RequestParam("roomId") roomId: String, |
| | | @ApiParam("æä»¶ç±»å") @RequestParam("documentType") documentType: Int, |
| | | @ApiParam("æä»¶ä¿¡æ¯") @RequestParam("params") msgVo: String, |
| | | @ApiParam("æä»¶") @RequestPart("files") files: Array<MultipartFile> |
| | | ) = meetingInfoService.uploadFile(userId, meetingId, roomId, msgVo, files, documentType) |
| | | |
| | | @ApiOperation(value = "è·åä¼è®®å®¤æä»¶") |
| | | @GetMapping("/material/{userId}") |
| | | fun getMeetingMaterials( |
| | | @PathVariable userId: String, |
| | | @RequestParam("meetingId") meetingId: String, |
| | | @RequestParam("mediaType") mediaType: Int, |
| | | @RequestParam(value = "page") page: Int, |
| | | @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam("meetingId") meetingId: String, |
| | | @ApiParam("ä¼è®®å®¤id") @RequestParam("mediaType") mediaType: Int, |
| | | @ApiParam("页ç ") @RequestParam(value = "page") page: Int, |
| | | @ApiParam("åé¡µæ°æ®é") @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | ) = meetingInfoService.getMeetingMaterials(userId, meetingId, mediaType, page, perPage, response) |
| | | |
| | | @ApiOperation(value = "æ´æ°ä¼è®®æä»¶ç¾æ¶ç¶æ") |
| | | @PostMapping("/material/sign/{userId}") |
| | | fun updateSignState( |
| | | @PathVariable userId: String, |
| | | @RequestBody signStateList: List<MeetingMaterialVo> |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®æä»¶ç¾æ¶ç¶æ") @RequestBody signStateList: List<MeetingMaterialVo> |
| | | ) = meetingInfoService.updateSignState(userId, signStateList) |
| | | |
| | | @ApiOperation(value = "è·åä¼è®®æä»¶æ°é") |
| | | @GetMapping("/count/material/{userId}") |
| | | fun getMaterialCount( |
| | | @PathVariable userId: String, |
| | | @RequestParam("meetingId") meetingId: String, |
| | | @RequestParam("mediaType") mediaType: Int, |
| | | @RequestParam("meetingFileType") meetingFileType: Int |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam("meetingId") meetingId: String, |
| | | @ApiParam("å¤åªä½æä»¶ç±»å") @RequestParam("mediaType") mediaType: Int, |
| | | @ApiParam("ä¼è®®æä»¶ç±»å") @RequestParam("meetingFileType") meetingFileType: Int |
| | | ) = meetingInfoService.getMaterialCount(userId, meetingId, mediaType, meetingFileType) |
| | | |
| | | @ApiOperation(value = "å é¤ä¼è®®æä»¶") |
| | | @PostMapping("/material/delete/{userId}") |
| | | fun deleteFiles( |
| | | @PathVariable userId: String, |
| | | @RequestParam("meetingId") meetingId: String, |
| | | @RequestBody fileList: List<MeetingMaterialVo> |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam("meetingId") meetingId: String, |
| | | @ApiParam("å¾
å é¤ä¼è®®æä»¶") @RequestBody fileList: List<MeetingMaterialVo> |
| | | ) = meetingInfoService.deleteFiles(userId, meetingId, fileList) |
| | | |
| | | @ApiOperation(value = "è·åä¼è®®æææä»¶ç¾æ¶ç¶æ") |
| | | @GetMapping("/count/all/material/{userId}") |
| | | fun getAllMaterialSignStatus( |
| | | @PathVariable userId: String, |
| | | @RequestParam("meetingId") meetingId: String |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam("meetingId") meetingId: String |
| | | ) = meetingInfoService.getAllMaterialSignStatus(userId, meetingId) |
| | | |
| | | /*****************************ä¼è®®è天记å½********************************************/ |
| | | @ApiOperation(value = "è·åä¼è®®è天记å½") |
| | | @GetMapping("/comment/{userId}") |
| | | fun getMeetingRecords( |
| | | @PathVariable userId: String, |
| | | @RequestParam("meetingId") meetingId: String, |
| | | @RequestParam("roomId") roomId: String, |
| | | @RequestParam(value = "page") page: Int, |
| | | @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam("meetingId") meetingId: String, |
| | | @ApiParam("ä¼è®®å®¤id") @RequestParam("roomId") roomId: String, |
| | | @ApiParam("页ç ") @RequestParam(value = "page") page: Int, |
| | | @ApiParam("åé¡µæ°æ®é") @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | ) = meetingInfoService.getMeetingRecords(userId, meetingId, roomId, page, perPage, response) |
| | | |
| | | /*****************************ä¼è®®æ¨ééç¥********************************************/ |
| | | @ApiOperation(value = "æ¨éä¼è®®éç¥") |
| | | @PostMapping("/push/{userId}") |
| | | fun pushMeetingInfo( |
| | | @PathVariable userId: String, |
| | | @RequestParam("meetingId") meetingId: String, |
| | | @RequestParam("roomId") roomId: String?, |
| | | @RequestParam("title") title: String, |
| | | @RequestParam("body") body: String |
| | | @ApiParam("ç¨æ·id") @PathVariable userId: String, |
| | | @ApiParam("ä¼è®®id") @RequestParam("meetingId") meetingId: String, |
| | | @ApiParam("ä¼è®®å®¤id") @RequestParam("roomId") roomId: String?, |
| | | @ApiParam("éç¥æ é¢") @RequestParam("title") title: String, |
| | | @ApiParam("éç¥å
容") @RequestParam("body") body: String |
| | | ) = meetingInfoService.pushMeetingInfo(userId, meetingId, roomId, title, body) |
| | | } |
| | |
| | | import cn.flightfeather.supervision.lightshare.vo.NotificationVo |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | import javax.servlet.http.HttpServletResponse |
| | | |
| | |
| | | @ApiOperation(value = "è·åç¨æ·æªè¯»éç¥") |
| | | @GetMapping |
| | | fun getNotificationUnRead( |
| | | @RequestParam(value = "userId") userId: String, |
| | | @RequestParam(value = "page") page: Int, |
| | | @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | @ApiParam("ç¨æ·id") @RequestParam(value = "userId") userId: String, |
| | | @ApiParam("页ç ") @RequestParam(value = "page") page: Int, |
| | | @ApiParam("åé¡µæ°æ®é") @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | ) = notificationService.getNotificationUnRead(userId, page, perPage, response) |
| | | |
| | | @ApiOperation(value = "æ´æ°éç¥è¯»åç¶æ") |
| | | @PostMapping("/{userId}/readState") |
| | | fun updateReadState( |
| | | @PathVariable("userId") userId: String, |
| | | @RequestBody readStates: List<NoticeReadStateVo> |
| | | @ApiParam("ç¨æ·id") @PathVariable("userId") userId: String, |
| | | @ApiParam("éç¥è¯»åç¶æ") @RequestBody readStates: List<NoticeReadStateVo> |
| | | ) = notificationService.updateReadState(userId, readStates) |
| | | |
| | | @ApiOperation(value = "è·åéç¥é¿ææ¬å
容") |
| | | @GetMapping("/text") |
| | | fun getNotificationText( |
| | | @RequestParam(value = "id") notificationId: String |
| | | @ApiParam("éç¥id") @RequestParam(value = "id") notificationId: String |
| | | ) = notificationService.getNotificationText(notificationId) |
| | | |
| | | @ApiOperation(value = "è·åæ»æªè¯»éç¥æ°é") |
| | | @GetMapping("/{userId}/unread") |
| | | fun getUnReadNoticeNum( |
| | | @PathVariable("userId") userId: String |
| | | @ApiParam("ç¨æ·id") @PathVariable("userId") userId: String |
| | | ) = notificationService.getUnReadNoticeNum(userId) |
| | | |
| | | @ApiOperation(value = "åå¸éç¥") |
| | | @PostMapping("{userId}/release") |
| | | fun releaseNotice( |
| | | @PathVariable("userId") userId: String, |
| | | @RequestBody notice: NotificationVo |
| | | @ApiParam("ç¨æ·id") @PathVariable("userId") userId: String, |
| | | @ApiParam("éç¥") @RequestBody notice: NotificationVo |
| | | ) = notificationService.releaseNotice(userId, notice) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.lightshare.web; |
| | | |
| | | import cn.flightfeather.supervision.lightshare.service.OpenApiWordService; |
| | | import io.swagger.annotations.*; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RequestPart; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.thymeleaf.context.Context; |
| | | import org.thymeleaf.spring5.SpringTemplateEngine; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.BufferedOutputStream; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.Map; |
| | | |
| | | @Controller |
| | | @Api(tags = "OpenAPI") |
| | | public class OpenApiWordController { |
| | | |
| | | @Value("${swagger.url}") |
| | | private String swaggerUrl; |
| | | |
| | | @Autowired |
| | | private OpenApiWordService openApiWordService; |
| | | @Autowired |
| | | private SpringTemplateEngine springTemplateEngine; |
| | | |
| | | private String fileName; |
| | | |
| | | /** |
| | | * å° swagger jsonæä»¶è½¬æ¢æ wordææ¡£å¹¶ä¸è½½ |
| | | * |
| | | * @param model |
| | | * @param jsonFile éè¦è½¬æ¢æ word ææ¡£çswagger jsonæä»¶ |
| | | * @param response |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @ApiOperation(value = "å° swagger jsonæä»¶è½¬æ¢æ wordææ¡£å¹¶ä¸è½½", notes = "") |
| | | @ApiResponses(value = {@ApiResponse(code = 200, message = "è¯·æ±æåã")}) |
| | | @RequestMapping(value = "/OpenApiFileToWord", method = {RequestMethod.POST}) |
| | | public void getWord(Model model, @ApiParam("swagger json file") @Valid @RequestPart("jsonFile") MultipartFile jsonFile, HttpServletResponse response) throws Exception { |
| | | generateModelData(model, jsonFile); |
| | | writeContentToResponse(model, response); |
| | | } |
| | | |
| | | private void generateModelData(Model model, MultipartFile jsonFile) throws IOException { |
| | | Map<String, Object> result = openApiWordService.tableList(jsonFile); |
| | | fileName = jsonFile.getOriginalFilename(); |
| | | |
| | | if (fileName != null) { |
| | | fileName = fileName.replaceAll(".json", ""); |
| | | } else { |
| | | fileName = "toWord"; |
| | | } |
| | | |
| | | model.addAttribute("url", "http://"); |
| | | model.addAttribute("download", 0); |
| | | model.addAllAttributes(result); |
| | | } |
| | | |
| | | private void generateModelData(Model model, String url, Integer download) { |
| | | url = StringUtils.defaultIfBlank(url, swaggerUrl); |
| | | Map<String, Object> result = openApiWordService.tableList(url); |
| | | model.addAttribute("url", url); |
| | | model.addAttribute("download", download); |
| | | model.addAllAttributes(result); |
| | | } |
| | | |
| | | private void writeContentToResponse(Model model, HttpServletResponse response) { |
| | | Context context = new Context(); |
| | | context.setVariables(model.asMap()); |
| | | String content = springTemplateEngine.process("word", context); |
| | | response.setContentType("application/octet-stream;charset=utf-8"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | try (BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream())) { |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".doc", "utf-8")); |
| | | byte[] bytes = content.getBytes(); |
| | | bos.write(bytes, 0, bytes.length); |
| | | bos.flush(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | import cn.flightfeather.supervision.lightshare.service.ProblemService |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.GetMapping |
| | | import org.springframework.web.bind.annotation.RequestMapping |
| | | import org.springframework.web.bind.annotation.RequestParam |
| | |
| | | @ApiOperation(value = "æ ¹æ®å¹´æè·åç¨æ·çé®é¢") |
| | | @GetMapping("/list") |
| | | fun getProblemsByPeriod( |
| | | @RequestParam("userId") userId: String, |
| | | @RequestParam("year") year: Int, |
| | | @RequestParam("month") month: Int |
| | | @ApiParam("ç¨æ·id") @RequestParam("userId") userId: String, |
| | | @ApiParam("年份") @RequestParam("year") year: Int, |
| | | @ApiParam("æä»½") @RequestParam("month") month: Int |
| | | ) = problemService.getProblemsByPeriod(userId, year, month) |
| | | } |
| | |
| | | // @GetMapping("") |
| | | // fun getAll() = userinfoService.findAll() |
| | | |
| | | @ApiOperation(value = "æ ¹æ®ç¨æ·idè·åç¨æ·ä¿¡æ¯") |
| | | @GetMapping("/{id}") |
| | | fun getById(@PathVariable id: String) = userinfoService.findOne(id) |
| | | fun getById( |
| | | @ApiParam("ç¨æ·id") @PathVariable id: String |
| | | ) = userinfoService.findOne(id) |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ ç¨æ·ä¿¡æ¯") |
| | | @PutMapping("") |
| | | fun add(@RequestBody userinfo: Userinfo) = userinfoService.save(userinfo) |
| | | fun add( |
| | | @ApiParam("ç¨æ·ä¿¡æ¯") @RequestBody userinfo: Userinfo |
| | | ) = userinfoService.save(userinfo) |
| | | |
| | | @ApiOperation(value = "æ´æ°ç¨æ·ä¿¡æ¯") |
| | | @PostMapping("") |
| | | fun update(@RequestBody userinfo: Userinfo) = userinfoService.update(userinfo) |
| | | fun update( |
| | | @ApiParam("ç¨æ·ä¿¡æ¯") @RequestBody userinfo: Userinfo |
| | | ) = userinfoService.update(userinfo) |
| | | |
| | | // @DeleteMapping("/{id}") |
| | | // fun delete(@PathVariable id: String) = userinfoService.delete(id) |
| | | |
| | | @ApiOperation(value = "ç»å½") |
| | | @PostMapping("/login") |
| | | fun login(@RequestBody loginRequestVo: LoginRequestVo) = userinfoService.login(loginRequestVo) |
| | | fun login( |
| | | @ApiParam("ç»å½ä¿¡æ¯") @RequestBody loginRequestVo: LoginRequestVo |
| | | ) = userinfoService.login(loginRequestVo) |
| | | |
| | | @ApiOperation(value = "注å") |
| | | @PostMapping("/register") |
| | | fun register(@RequestBody loginRequestVo: LoginRequestVo) = userinfoService.register(loginRequestVo) |
| | | fun register( |
| | | @ApiParam("注åä¿¡æ¯") @RequestBody loginRequestVo: LoginRequestVo |
| | | ) = userinfoService.register(loginRequestVo) |
| | | |
| | | @ApiOperation(value = "è·åç¨æ·é讯å½") |
| | | @GetMapping("/addressBook") |
| | | fun getAddressBook(@RequestParam("userId") userId: String) = userinfoService.getAddressBook(userId) |
| | | fun getAddressBook( |
| | | @ApiParam("ç¨æ·id") @RequestParam("userId") userId: String |
| | | ) = userinfoService.getAddressBook(userId) |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ ç¨æ·å¤´å") |
| | | @PostMapping("/accountPic/upLoad") |
| | | fun upLoadUserAccountPic( |
| | | @RequestParam("userId") userId: String, |
| | | @RequestPart("images") files: Array<MultipartFile> |
| | | @ApiParam("ç¨æ·id") @RequestParam("userId") userId: String, |
| | | @ApiParam("å¾ç") @RequestPart("images") files: Array<MultipartFile> |
| | | ) = userinfoService.upLoadAccountPic(userId, files) |
| | | |
| | | @ApiOperation(value = "ä¿®æ¹å¯ç ") |
| | | @PostMapping("/password/change/{userId}") |
| | | fun changePassword( |
| | | @RequestParam("userId") userId: String, |
| | | @RequestParam("oldPassword") oldPassword: String, |
| | | @RequestParam("newPassword") newPassword: String |
| | | @ApiParam("ç¨æ·id") @RequestParam("userId") userId: String, |
| | | @ApiParam("æ§å¯ç ") @RequestParam("oldPassword") oldPassword: String, |
| | | @ApiParam("æ°å¯ç ") @RequestParam("newPassword") newPassword: String |
| | | ) = userinfoService.changePassword(userId, oldPassword, newPassword) |
| | | |
| | | @ApiOperation(value = "æ ¹æ®æ¥è¯¢è
ï¼æ¾å°ååºå¿çç¨æ·") |
| | | @PostMapping("/searchUser/{userId}") |
| | | fun searchUser( |
| | | @PathVariable("userId") userId: String, |
| | | @RequestBody condition: UserSearchCondition, |
| | | @RequestParam(value = "page") page: Int, |
| | | @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | @ApiParam("ç¨æ·id") @PathVariable("userId") userId: String, |
| | | @ApiParam("æ¥è¯¢æ¡ä»¶") @RequestBody condition: UserSearchCondition, |
| | | @ApiParam("页ç ") @RequestParam(value = "page") page: Int, |
| | | @ApiParam("åé¡µæ°æ®é") @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | ) = userinfoService.searchUser(userId, condition, page, perPage, response) |
| | | |
| | | @ApiOperation(value = "è·åç¨æ·åºæ¬ä¿¡æ¯") |
| | | @GetMapping("/baseInfo") |
| | | fun getBaseInfo( |
| | | @RequestParam("userId") userId: String |
| | | @ApiParam("ç¨æ·id") @RequestParam("userId") userId: String |
| | | ) = userinfoService.getBaseInfo(userId) |
| | | |
| | | @ApiOperation(value = "æ ¹æ®ç»å®æ¡ä»¶ï¼æç´¢ç¨æ·") |
| | |
| | | @ApiParam("åºå¿", example = "徿±åº") @RequestParam("district", required = false) district: String, |
| | | @ApiParam("åºæ¯ç±»å", example = "1", allowableValues = "0,1,2,3,4,5,6,7") @RequestParam("sceneType", required = false) sceneType: Int, |
| | | @ApiParam("ç¨æ·ç±»å", example = "0", allowableValues = "0,1,2,3") @RequestParam("userType", required = false) userType: Int, |
| | | @RequestParam(value = "page") page: Int, |
| | | @RequestParam(value = "per_page") perPage: Int, |
| | | @ApiParam("页ç ") @RequestParam(value = "page") page: Int, |
| | | @ApiParam("åé¡µæ°æ®é") @RequestParam(value = "per_page") perPage: Int, |
| | | ) = userinfoService.search(district, sceneType, userType, page, perPage) |
| | | } |
| | |
| | | import cn.flightfeather.supervision.domain.entity.Version |
| | | import cn.flightfeather.supervision.lightshare.service.VersionService |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | import org.springframework.web.multipart.MultipartFile |
| | | import springfox.documentation.annotations.ApiIgnore |
| | | |
| | | @Api(tags = ["ç³»ç»ç¸å
³APIæ¥å£"]) |
| | | @RestController |
| | | @RequestMapping("/version") |
| | | class VersionController(val versionService: VersionService) { |
| | | |
| | | @ApiIgnore |
| | | @PutMapping("") |
| | | fun add(@RequestBody version: Version) = versionService.save(version) |
| | | |
| | | @ApiIgnore |
| | | @PostMapping("") |
| | | fun update(@RequestBody version: Version) = versionService.update(version) |
| | | |
| | | @ApiIgnore |
| | | @DeleteMapping("/{id}") |
| | | fun delete(@PathVariable id: String) = versionService.delete(id) |
| | | |
| | | @ApiOperation(value = "è·åææ°appçæ¬ä¿¡æ¯") |
| | | @GetMapping("/latest") |
| | | fun getLatestVersion() = versionService.getLatestVersion() |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ é误æ¥å¿") |
| | | @PostMapping("/crashInfo/upLoad") |
| | | fun upLoadCrashInfo( |
| | | @RequestParam("userId") userId: String, |
| | | @RequestPart("files") files: Array<MultipartFile> |
| | | @ApiParam("ç¨æ·id") @RequestParam("userId") userId: String, |
| | | @ApiParam("é误æ¥å¿") @RequestPart("files") files: Array<MultipartFile> |
| | | ) = versionService.upLoadCrashInfo(userId, files) |
| | | |
| | | } |
| | |
| | | swagger: |
| | | v2: |
| | | enabled: true |
| | | |
| | | |
| | |
| | | documentation: |
| | | swagger: |
| | | v2: |
| | | enabled: false |
| | | enabled: true |
| | | # Swagger json url address |
| | | # etc. https://petstore.swagger.io/ |
| | | swagger.url: http://localhost:8080/v3/swagger.json |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <!DOCTYPE html> |
| | | <html xmlns:th="http://www.thymeleaf.org"> |
| | | <head> |
| | | <meta http-equiv="Content-Type" content="application/msword; charset=utf-8"/> |
| | | <title>toWord</title> |
| | | <style type="text/css"> |
| | | .bg { |
| | | font-size: 14.5px; |
| | | font-weight: bold; |
| | | color: #000; |
| | | background-color: #D7D7D7; |
| | | } |
| | | |
| | | table { |
| | | border-width: 1px; |
| | | border-style: solid; |
| | | border-color: black; |
| | | table-layout: fixed; |
| | | } |
| | | |
| | | tr { |
| | | height: 32px; |
| | | font-size: 12px; |
| | | } |
| | | |
| | | td { |
| | | padding-left: 10px; |
| | | border-width: 1px; |
| | | border-style: solid; |
| | | border-color: black; |
| | | height: 32px; |
| | | overflow: hidden; |
| | | word-break: break-all; |
| | | word-wrap: break-word; |
| | | font-size: 14.5px; |
| | | } |
| | | |
| | | .bg td { |
| | | font-size: 14.5px; |
| | | } |
| | | |
| | | tr td { |
| | | font-size: 14.5px; |
| | | } |
| | | |
| | | .specialHeight { |
| | | height: 40px; |
| | | } |
| | | |
| | | .first_title { |
| | | height: 60px; |
| | | line-height: 60px; |
| | | margin: 0; |
| | | font-weight: bold; |
| | | font-size: 21px; |
| | | } |
| | | |
| | | .second_title { |
| | | height: 40px; |
| | | line-height: 40px; |
| | | margin: 0; |
| | | font-size: 18.5px; |
| | | } |
| | | |
| | | .doc_title { |
| | | font-size: 42.5px; |
| | | text-align: center; |
| | | } |
| | | |
| | | .download_btn { |
| | | float: right; |
| | | } |
| | | |
| | | body { |
| | | font-family: ææºé»ä½ Normal; |
| | | } |
| | | </style> |
| | | </head> |
| | | |
| | | <body> |
| | | <div style="width:800px; margin: 0 auto"> |
| | | <div> |
| | | <p class="doc_title" th:text="${info.title +'ï¼'+ info.version +'ï¼'}"></p> |
| | | <a class="download_btn" th:if="${download == 1}" th:href="${'/downloadWord?url='+ url}">ä¸è½½ææ¡£</a> |
| | | <br> |
| | | </div> |
| | | <div th:each="tableMap:${tableMap}" style="margin-bottom:20px;"> |
| | | <!--è¿ä¸ªæ¯ç±»ç说æ--> |
| | | <h4 class="first_title" th:text="${tableMap.count} + '. ' + ${tableMap.key}"></h4> |
| | | <div th:each="table,tableStat:${tableMap.value}"> |
| | | |
| | | <!--è¿ä¸ªæ¯æ¯ä¸ªè¯·æ±ç说æï¼æ¹ä¾¿çæææ¡£åè¿è¡æ´ç--> |
| | | <h5 class="second_title" th:text="${tableStat.count} + 'ï¼' + ${table.tag}"></h5> |
| | | |
| | | <table border="1" cellspacing="0" cellpadding="0" width="100%"> |
| | | <tr class="bg"> |
| | | <td colspan="5" th:text="${table.tag}"></td> |
| | | </tr> |
| | | <tr> |
| | | <td width="25%">æ¥å£æè¿°</td> |
| | | <td colspan="4" th:text="${table.description}"></td> |
| | | </tr> |
| | | <tr> |
| | | <td>URL</td> |
| | | <td colspan="4" th:text="${table.url}"></td> |
| | | </tr> |
| | | <tr> |
| | | <td>è¯·æ±æ¹å¼</td> |
| | | <td colspan="4" th:text="${#strings.toUpperCase(table.requestType)}"></td> |
| | | </tr> |
| | | <tr> |
| | | <td>请æ±ç±»å</td> |
| | | <td colspan="4" th:text="${table.requestForm}"></td> |
| | | </tr> |
| | | <tr> |
| | | <td>è¿åç±»å</td> |
| | | <td colspan="4" th:text="${table.responseForm}"></td> |
| | | </tr> |
| | | |
| | | <tr class="bg"> |
| | | <td>åæ°å</td> |
| | | <td width="15%">æ°æ®ç±»å</td> |
| | | <td width="15%">åæ°ç±»å</td> |
| | | <td width="15%">æ¯å¦å¿
å¡«</td> |
| | | <td width="29%">说æ</td> |
| | | </tr> |
| | | |
| | | <th:block th:each="request, c:${table.requestList}"> |
| | | <tr> |
| | | <td align="left" th:text="${c.count} + '.' + ${request.name}"></td> |
| | | <td th:text="${request.type}"></td> |
| | | <td th:text="${request.paramType}"></td> |
| | | <td th:if="${request.require}" th:text="Y"></td> |
| | | <td th:if="${!request.require}" th:text="N"></td> |
| | | <td th:text="${request.remark}"></td> |
| | | <!-- <td th:if="${request.modelAttr}" th:text="asdfagadfg"></td>--> |
| | | </tr> |
| | | <th:block th:if="${request.modelAttr}"> |
| | | <tbody th:include="this::request(${request.modelAttr.properties},${c.count} + '.', 1)"/> |
| | | </th:block> |
| | | |
| | | |
| | | </th:block> |
| | | |
| | | <tr class="bg"> |
| | | <td>ç¶æç </td> |
| | | <td colspan="2">æè¿°</td> |
| | | <td colspan="2">说æ</td> |
| | | </tr> |
| | | |
| | | <tr th:each="response:${table.responseList}"> |
| | | <td th:text="${response.name}"></td> |
| | | <td colspan="2" th:text="${response.description}"></td> |
| | | <td colspan="2" th:text="${response.remark}"></td> |
| | | </tr> |
| | | |
| | | <tr class="bg"> |
| | | <td>è¿å屿§å</td> |
| | | <td colspan="2">ç±»å</td> |
| | | <td colspan="2">说æ</td> |
| | | </tr> |
| | | |
| | | <!-- 对è¿ååæ° éå½çæè¡--> |
| | | <tbody th:include="this::response(${table.modelAttr.properties},'', 1)"/> |
| | | |
| | | <!-- <tr class="bg">--> |
| | | <!-- <td colspan="5">示ä¾</td>--> |
| | | <!-- </tr>--> |
| | | <!-- <tr class="specialHeight">--> |
| | | <!-- <td class="bg">请æ±åæ°</td>--> |
| | | <!-- <td colspan="4" th:text="${table.requestParam}"></td>--> |
| | | <!-- </tr>--> |
| | | <!-- <tr class="specialHeight">--> |
| | | <!-- <td class="bg">è¿åå¼</td>--> |
| | | <!-- <td colspan="4" th:text="${table.responseParam}"></td>--> |
| | | <!-- </tr>--> |
| | | |
| | | </table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <th:block th:fragment="request(properties,count, lv)"> |
| | | <th:block th:each="p,c : ${properties}"> |
| | | <tr> |
| | | <td align="left" th:text="${count} + '' + ${c.count} + '.' + ${p.name}" |
| | | th:style="|padding-left:${10*lv}px|"></td> |
| | | <td th:text="${p.type}"></td> |
| | | <td></td> |
| | | <td th:if="${p.require}" th:text="Y"></td> |
| | | <td th:if="${!p.require}" th:text="N"></td> |
| | | <td th:text="${p.description}"></td> |
| | | </tr> |
| | | <th:block th:unless="${#lists.isEmpty(p.properties)}" |
| | | th:include="this::request(${p.properties},${count} + '' + ${c.count} + '.',${lv+1})"/> |
| | | </th:block> |
| | | </th:block> |
| | | |
| | | <th:block th:fragment="response(properties,count, lv)"> |
| | | <th:block th:each="p,c : ${properties}"> |
| | | <tr> |
| | | <td align="left" th:text="${count} + '' + ${c.count} + '.' + ${p.name}" |
| | | th:style="|padding-left:${10*lv}px|"></td> |
| | | <td colspan="2" th:text="${p.type}"></td> |
| | | <td colspan="2" th:text="${p.description}"></td> |
| | | </tr> |
| | | <th:block th:unless="${#lists.isEmpty(p.properties)}" |
| | | th:include="this::response(${p.properties},${count} + '' + ${c.count} + '.',${lv+1})"/> |
| | | </th:block> |
| | | </th:block> |
| | | </body> |
| | | </html> |
| | |
| | | |
| | | @Test |
| | | fun go() { |
| | | autoScore.go(2021, 10) |
| | | autoScore.go(2022, 1) |
| | | } |
| | | } |