Commit 6e9eca2a by 宋珺琪

服务概述接口、api返回结果修改

parent 290245f0
package com.founder.commonutils.model.newPublicEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@TableName("sk_Interface")
@ApiModel(value="服务概述接口表", description="")
public class PortEntity {
@TableId(type = IdType.INPUT)
@TableField("id")
private String id ;
@TableField("first_module")
private String firstModule ;
@TableField("second_module")
private String secondModule;
@TableField("api_name")
private String apiName;
@TableField("url")
private String url;
@TableField("method")
private String method;
@TableField("headers")
private String headers;
@TableField("default_params")
private String defaultParams;
@TableField("call_time")
private String callTime;
@TableField("return_param")
private String returnParam;
@TableField("state")
private String state; // 0未成功 1成功
@TableField("is_delete")
private String isDelete;//0未删除 1删除
}
package com.founder.commonutils.util;
import org.apache.cxf.helpers.IOUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.params.ClientPNames;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.entity.StringEntity;
......@@ -23,6 +26,11 @@ import org.apache.http.params.HttpParams;
import org.apache.http.util.EntityUtils;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Map.Entry;
......@@ -281,7 +289,7 @@ public class HttpUtil {
return resultString;
}
/*
public static void main(String[] args) {
try {
Date date1=new Date();
......@@ -305,7 +313,7 @@ public class HttpUtil {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}*/
// 全国常口请求得到XML
public static String doGetQg(String uri) {
HttpClient httpclient = new DefaultHttpClient();
......@@ -397,4 +405,108 @@ public class HttpUtil {
public static boolean ckeckEmpty(String string) {
return (null == string) || ("".equals(string));
}
public static String fwdoPost(String url, Map<String, String> map,String token) throws Exception {
String result = "";
CloseableHttpClient client = null;
CloseableHttpResponse response = null;
RequestConfig defaultRequestConfig = RequestConfig.custom().setSocketTimeout(550000).setConnectTimeout(550000)
.setConnectionRequestTimeout(550000).setStaleConnectionCheckEnabled(true).build();
client = HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig).build();
// client = HttpClients.createDefault();
URIBuilder uriBuilder = new URIBuilder(url);
HttpPost httpPost = new HttpPost(uriBuilder.build());
httpPost.setHeader("Connection", "Keep-Alive");
httpPost.setHeader("Charset", "UTF-8");
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
httpPost.setHeader("Authorization",token);
Iterator<Entry<String, String>> it = map.entrySet().iterator();
List<NameValuePair> params = new ArrayList<NameValuePair>();
while (it.hasNext()) {
Map.Entry<String, String> entry = it.next();
NameValuePair pair = new BasicNameValuePair(entry.getKey(), entry.getValue());
params.add(pair);
}
httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
try {
response = client.execute(httpPost);
if (response != null) {
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
result = EntityUtils.toString(resEntity, "UTF-8");
}
}
} catch (ClientProtocolException e) {
throw new RuntimeException("创建连接失败" + e);
} catch (IOException e) {
throw new RuntimeException("创建连接失败" + e);
}
return result;
}
public static String fwdoPostJson(String url, String json,String token) {
// 创建Httpclient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = null;
String resultString = "";
try {
// 创建Http Post请求
HttpPost httpPost = new HttpPost(url);
// 创建请求内容
StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
httpPost.setHeader("Authorization", token);
// 执行http请求
response = httpClient.execute(httpPost);
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
response.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return resultString;
}
public static String fwdoGet(String url, Map<String, String> params,String token) {
String apiUrl = url;
StringBuffer param = new StringBuffer();
int i = 0;
for (String key : params.keySet()) {
if (i == 0)
param.append("?");
else
param.append("&");
param.append(key).append("=").append(params.get(key));
i++;
}
apiUrl += param;
String result = null;
HttpClient httpClient = null;
httpClient = HttpClients.createDefault();
try {
HttpGet httpGet = new HttpGet(apiUrl);
httpGet.setHeader("Authorization", token);
HttpResponse response = httpClient.execute(httpGet);
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
result = IOUtils.toString(instream, "UTF-8");
}
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
}
......@@ -116,7 +116,7 @@ public class SysUserController extends ApiController {
queryWrapper.eq("SCBZ", 0);
SysUser one = sysUserService.getOne(queryWrapper);
if (one == null) {
return MapRestResult.build(500, "该用户不存在", null);
return MapRestResult.build(200, "该用户不存在", null);
}
// 拿到真实ip
one.setIp(NetworkUtil.getIpAddr(request));
......
......@@ -7,6 +7,7 @@ import com.founder.commonutils.model.vo.param.SkServiceApplyParam;
import com.founder.commonutils.model.vo.response.SkServiceApplyVO;
import com.founder.servicebase.logs.mapper.mysqlMapper.SkServiceApplyMapper;
import com.founder.servicebase.service.SkServiceApplyService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
......@@ -31,8 +32,15 @@ public class SkServiceApplyServiceImpl extends ServiceImpl<SkServiceApplyMapper,
int count=baseMapper.count(skRegionalsDetailParam);
skRegionalsDetailParam.setPage((skRegionalsDetailParam.getPage()-1)*skRegionalsDetailParam.getPageSize());
List<SkServiceApplyVO> list=baseMapper.findAll(skRegionalsDetailParam);
if (list==null){
map.put("count",0);
map.put("list","");
return map;
}
//把数据为空的去掉
List<SkServiceApplyVO> collect = list.stream().filter(s -> StringUtils.isNotBlank(s.getFlag()) && StringUtils.isNotBlank(s.getServiceDeleted())).collect(Collectors.toList());
// 拿出展示状态(服务申请),flag0代表不展示;服务删除标志serviceDeleted,将申请表Status置为3失效状态
List<SkServiceApplyVO> listFilter = list.stream().filter(p->p.getFlag().equals("0")||p.getServiceDeleted().equals("1")).collect(Collectors.toList());
List<SkServiceApplyVO> listFilter = collect.stream().filter(p->p.getFlag().equals("0")||p.getServiceDeleted().equals("1")).collect(Collectors.toList());
listFilter.stream().forEach(p->{
SkServiceApply skServiceApply = new SkServiceApply();
p.setStatus("3");
......
......@@ -179,7 +179,7 @@ public class UserController {
Map<String,Object> result = new HashMap<>();
List<User> list = userService.getAllowAgentUsers(loginUserPoliceId,agentUserPoliceId,agentUserXm);
result.put("msg","success");
result.put("status","200");
result.put("status",200);
result.put("data",list);
result.put("count",list.size());
return result;
......
......@@ -133,6 +133,9 @@ public class SkServiceSqController {
@OperLog(message = "更新服务列表展示状态", operation = OperationType.UPDATE)
public MapRestResult queryApply(String xxzjbh,String flag) {
SkService skService=skServiceService.getById(xxzjbh);
if (skService==null) {
return new MapRestResult(200,"此xxzjbh不存在",null);
}
skService.setFlag(flag);
boolean updateById = skServiceService.updateById(skService);
if (updateById) {
......
package com.founder.publicapi.controller.SkModelService;
import com.founder.commonutils.model.newPublicEntity.MapRestResult;
import com.founder.commonutils.model.newPublicEntity.SkTrail;
import com.founder.commonutils.model.newPublicEntity.TogetherEntity;
import com.founder.servicebase.logs.OperLog;
......@@ -33,14 +34,15 @@ public class SkbsController {
@PostMapping("getSkbs")
@OperLog(message = "轨迹分析_伴随分析",operation = OperationType.QUERY)
@ApiOperation(value = "轨迹分析_伴随分析")
public List getSkbs(@RequestBody SkbsParam skbsParam){
public MapRestResult getSkbs(@RequestBody SkbsParam skbsParam){
//获取需要伴随的轨迹
// List<SkTrail> list=getYToGjInfo(requestParams);
//转换轨迹
List gjlist=getYToGjInfo(skbsParam.getRequestParams(),skbsParam.getList());
//进行伴随分析
List resultList=getSkbsfx(skbsParam.getRequestParams(),gjlist);
return resultList;
return new MapRestResult(200,"ok",resultList);
// return resultList;
}
/**
......
......@@ -535,7 +535,7 @@ public class HnTbStRygxController {
public Result delFileByExcelId(String excelId) {
HnTbStRygxRw excelInfo = hnKshRwService.getOne(new QueryWrapper<HnTbStRygxRw>().eq("excel_id", excelId));
if (excelInfo == null) {
return Result.error().message("不存在该文件");
return Result.ok().message("不存在该文件");
}
String taskId = excelInfo.getParentId();
String createName = excelInfo.getCreateName();
......@@ -565,7 +565,7 @@ public class HnTbStRygxController {
public Result delFileByTaskId(String taskId) {
List<HnTbStRygxRw> rwList = hnKshRwService.list(new QueryWrapper<HnTbStRygxRw>().eq("RWID", taskId));
if (rwList.isEmpty()) {
return Result.error().message("不存在该任务");
return Result.ok().message("不存在该任务");
}
//删除 ksh_st_rygx_rw表的Excel信息
//1.删除任务
......
package com.founder.publicapi.mapper.mysqlMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.model.newPublicEntity.PortEntity;
public interface PortMapper extends BaseMapper<PortEntity> {
}
......@@ -480,7 +480,7 @@ public class SpxxServiceImpl implements SpxxService {
//柱状图 申请状态
//柱状图 统计结果
jsonObject.put("data","");
jsonObject.put("status","success");
jsonObject.put("status",200);
jsonObject.put("code","200");
return jsonObject;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment