1、新增城市案件上报接口,还没有与正式环境联调

This commit is contained in:
yitonglei 2022-05-18 10:34:44 +08:00
parent 256e989288
commit 6ed97dd850
2 changed files with 39 additions and 5 deletions

View File

@ -1,15 +1,15 @@
package com.hisense.monitormanage.controller; package com.hisense.monitormanage.controller;
import com.alibaba.fastjson.JSONObject;
import com.hisense.monitormanage.entity.CaseCityLaw; import com.hisense.monitormanage.entity.CaseCityLaw;
import com.hisense.monitormanage.entity.Result;
import com.hisense.monitormanage.service.SJZTService; import com.hisense.monitormanage.service.SJZTService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -44,4 +44,11 @@ public class SJZTController {
){ ){
return sjztService.listSJZTByDt(ajjlsj); return sjztService.listSJZTByDt(ajjlsj);
} }
@PostMapping("upStream")
@ApiOperation("案件上报,调用接口上报")
public Result upStream(@ApiParam(value="data,直接以json字符串的形式传递",required = true) @RequestBody String data){
System.out.println("案件上报,调用接口上报");
return sjztService.upStream(JSONObject.parseObject(data));
}
} }

View File

@ -6,8 +6,10 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator; import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.baomidou.mybatisplus.extension.api.R;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hisense.monitormanage.entity.CaseCityLaw; import com.hisense.monitormanage.entity.CaseCityLaw;
import com.hisense.monitormanage.entity.Result;
import com.hisense.monitormanage.mapper.CaseCityLawMapper; import com.hisense.monitormanage.mapper.CaseCityLawMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -34,7 +36,7 @@ import java.util.Map;
* @author admin * @author admin
* @version 1.0.0 * @version 1.0.0
* @ClassName SJZTService.java * @ClassName SJZTService.java
* @Description 数交中台service * @Description 数交中台service,城市执法
* @createTime 2022年05月12日 18:00:00 * @createTime 2022年05月12日 18:00:00
*/ */
@Service @Service
@ -177,6 +179,31 @@ public class SJZTService {
return caseCityLawMapper.selectList(wrapper); return caseCityLawMapper.selectList(wrapper);
} }
public Result upStream(JSONObject data){
String url = "?actionType={1}&senderCode={2}&data={3}";
String senderCode = "";//发送方标识
String actionType = "UP_REC_REPORT";//调用方法固定值
boolean result = false;
ResponseEntity<JSONObject> responseEntity;
try{
responseEntity = restTemplate.postForEntity(url, null, JSONObject.class,senderCode,actionType,data);
JSONObject responseJSON = responseEntity.getBody();
if(responseEntity.getStatusCodeValue() == 200){
if(responseJSON.getBooleanValue("success") && responseJSON.getIntValue("code") == 0){
return Result.success(responseJSON.get("data"));
}else{
return Result.error(responseJSON.getString("data"));
}
}else{
return Result.error(String.valueOf(responseEntity.getStatusCodeValue()));
}
}catch (Exception e){
e.printStackTrace();
log.error("[SJZTService upStream] Exception:"+e.getMessage());
return Result.error(e.getMessage());
}
}
//获取当前日期的时间串2022-05-08 00:00:00 //获取当前日期的时间串2022-05-08 00:00:00
private String dateTimeStr(){ private String dateTimeStr(){