Commit 878bf98e by jiang'yun

修改

parent fd0d5dba
......@@ -134,7 +134,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**", "/**/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**", "/comsj/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated();
})
......@@ -146,48 +146,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class)
.addFilterBefore(corsFilter, LogoutFilter.class);
}
// if (casProperties.isCasEnable()) {
// httpSecurity
// // CSRF禁用,因为不使用session
// .csrf().disable()
// // 基于token,所以不需要session
// .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// // 过滤请求
// .authorizeRequests()
// .antMatchers(
// HttpMethod.GET,
// "/*.html",
// "/**/*.html",
// "/**/*.css",
// "/**/*.js",
// "/"
// ).permitAll()
// .antMatchers("/profile/**").anonymous()
// .antMatchers("/**/**").anonymous()
// .antMatchers("/").anonymous()
// // 除上面外的所有请求全部需要鉴权认证
// .anyRequest().authenticated()
// .and()
// .headers().frameOptions().disable();
//
// //单点登录登出
// httpSecurity.logout().permitAll().logoutSuccessHandler(logoutSuccessHandler);
// // Custom JWT based security filter
// httpSecurity.addFilter(casAuthenticationFilter())
// .addFilterBefore(authenticationTokenFilter, CasAuthenticationFilter.class)
// //.addFilterBefore(casLogoutFilter(), LogoutFilter.class)
// .addFilterBefore(singleSignOutFilter(), CasAuthenticationFilter.class).exceptionHandling()
// //认证失败
// .authenticationEntryPoint(casAuthenticationEntryPoint());
//
// // 添加CORS filter
// httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class);
// httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class);
// // disable page caching
// httpSecurity.headers().cacheControl();
// }
//开启cas
if (casProperties.isCasEnable()) {
httpSecurity
......@@ -216,6 +174,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.antMatchers("/druid/**").anonymous()
.antMatchers("/websocket/**").anonymous()
.antMatchers("/magic/web/**").anonymous()
.antMatchers( "/comsj/**").anonymous()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
.and()
......
package com.zjsgfa.project.zjsgfa.controller;
import com.zjsgfa.framework.web.controller.BaseController;
import com.zjsgfa.framework.web.page.TableDataInfo;
import com.zjsgfa.project.zjsgfa.domain.*;
import com.zjsgfa.project.zjsgfa.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/comsj")
public class CommonApiController extends BaseController {
@Autowired
private ISjDjjcService sjDjjcService;
@GetMapping("/sjDjjcList")
public TableDataInfo list(SjDjjc sjDjjc)
{
List<SjDjjc> list = sjDjjcService.selectSjDjjcList(sjDjjc);
return getDataTable(list);
}
@Autowired
private ISjDzfcService sjDzfcService;
@GetMapping("/sjDzfcList")
public TableDataInfo sjDzfcList(SjDzfc sjDzfc)
{
List<SjDzfc> list = sjDzfcService.selectSjDzfcList(sjDzfc);
return getDataTable(list);
}
@Autowired
private ISjJsjgService sjJsjgService;
@GetMapping("/sjJsjgList")
public TableDataInfo sjJsjgList(SjJsjg sjJsjg)
{
List<SjJsjg> list = sjJsjgService.selectSjJsjgList(sjJsjg);
return getDataTable(list);
}
@Autowired
private ISjJygjInfoService sjJygjInfoService;
@GetMapping("/sjJygjInfoList")
public TableDataInfo sjJygjInfoList(SjJygjInfo sjJygjInfo)
{
List<SjJygjInfo> list = sjJygjInfoService.selectSjJygjInfoList(sjJygjInfo);
return getDataTable(list);
}
@Autowired
private ISjJygjGdfdcsService sjJygjGdfdcsService;
@GetMapping("/sjJygjGdfdcsList")
public TableDataInfo sjJygjGdfdcsList(SjJygjGdfdcs sjJygjGdfdcs)
{
List<SjJygjGdfdcs> list = sjJygjGdfdcsService.selectSjJygjGdfdcsList(sjJygjGdfdcs);
return getDataTable(list);
}
@Autowired
private ISjJygjGdsjgdcsService sjJygjGdsjgdcsService;
@GetMapping("/sjJygjGdsjgdcsList")
public TableDataInfo sjJygjGdsjgdcsList(SjJygjGdsjgdcs sjJygjGdsjgdcs)
{
List<SjJygjGdsjgdcs> list = sjJygjGdsjgdcsService.selectSjJygjGdsjgdcsList(sjJygjGdsjgdcs);
return getDataTable(list);
}
@Autowired
private ISjJygjgdsjService sjJygjgdsjService;
@GetMapping("/sjJygjgdsjList")
public TableDataInfo sjJygjgdsjList(SjJygjgdsj sjJygjgdsj)
{
List<SjJygjgdsj> list = sjJygjgdsjService.selectSjJygjgdsjList(sjJygjgdsj);
return getDataTable(list);
}
@Autowired
private ISjZjyFdsjService sjZjyFdsjService;
@GetMapping("/sjZjyFdsjList")
public TableDataInfo sjZjyFdsjList(SjZjyFdsj sjZjyFdsj)
{
List<SjZjyFdsj> list = sjZjyFdsjService.selectSjZjyFdsjList(sjZjyFdsj);
return getDataTable(list);
}
@Autowired
private ISjZjyCljlService sjZjyCljlService;
@GetMapping("/sjZjyCljlList")
public TableDataInfo sjZjyCljlList(SjZjyCljl sjZjyCljl)
{
List<SjZjyCljl> list = sjZjyCljlService.selectSjZjyCljlList(sjZjyCljl);
return getDataTable(list);
}
@Autowired
private ISjZjyFdxnbService sjZjyFdxnbService;
@GetMapping("/sjZjyFdxnbList")
public Map sjZjyFdxnbList(SjZjyFdxnb sjZjyFdxnb)
{
return sjZjyFdxnbService.selectSjZjyFdxnbList(sjZjyFdxnb);
}
@Autowired
private ISjTgTgzService sjTgTgzService;
@GetMapping("/sjTgTgzList")
public TableDataInfo sjTgTgzList(SjTgTgz sjTgTgz) {
List<SjTgTgz> list = sjTgTgzService.selectSjTgTgzList(sjTgTgz);
return getDataTable(list);
}
@Autowired
private ISjTgTgxnsjService sjTgTgxnsjService;
@GetMapping("/sjTgTgxnsjList")
public TableDataInfo sjTgTgxnsjList(SjTgTgxnsj sjTgTgxnsj) {
List<SjTgTgxnsj> list = sjTgTgxnsjService.selectSjTgTgxnsjList(sjTgTgxnsj);
return getDataTable(list);
}
@Autowired
private ISjTgTgqdjhService sjTgTgqdjhService;
@GetMapping("/sjTgTgqdjhList")
public TableDataInfo sjTgTgqdjhList(SjTgTgqdjh sjTgTgqdjh) {
List<SjTgTgqdjh> list = sjTgTgqdjhService.selectSjTgTgqdjhList(sjTgTgqdjh);
return getDataTable(list);
}
@Autowired
private ISjZlyqService sjZlyqService;
@GetMapping("/sjZlyqList")
public TableDataInfo sjZlyqList(SjZlyq sjZlyq) {
List<SjZlyq> list = sjZlyqService.selectSjZlyqList(sjZlyq);
return getDataTable(list);
}
@Autowired
private ISjZlyqZbyqService sjZlyqZbyqService;
@GetMapping("/sjZlyqZbyqList")
public TableDataInfo sjZlyqZbyqList(SjZlyqZbyq sjZlyqZbyq) {
List<SjZlyqZbyq> list = sjZlyqZbyqService.selectSjZlyqZbyqList(sjZlyqZbyq);
return getDataTable(list);
}
@Autowired
private ISjZlyqXxService sjZlyqXxService;
@GetMapping("/sjZlyqXxList")
public TableDataInfo sjZlyqXxList(SjZlyqXx sjZlyqXx) {
List<SjZlyqXx> list = sjZlyqXxService.selectSjZlyqXxList(sjZlyqXx);
return getDataTable(list);
}
@Autowired
private ISjGztzService sjGztzService;
@GetMapping("/sjGztzList")
public TableDataInfo sjGztzList(SjGztz sjGztz) {
List<SjGztz> list = sjGztzService.selectSjGztzList(sjGztz);
return getDataTable(list);
}
@Autowired
private ISjLjsmService sjLjsmService;
@GetMapping("/sjLjsmList")
public TableDataInfo sjLjsmList(SjLjsm sjLjsm) {
List<SjLjsm> list = sjLjsmService.selectSjLjsmList(sjLjsm);
return getDataTable(list);
}
@Autowired
private ISjZysxService sjZysxService;
@GetMapping("/sjZysxList")
public TableDataInfo sjZysxList(SjZysx sjZysx) {
List<SjZysx> list = sjZysxService.selectSjZysxList(sjZysx);
return getDataTable(list);
}
@Autowired
private ISjH2sService sjH2sService;
@GetMapping("/sjH2sList")
public TableDataInfo sjH2sList(SjH2s sjH2s) {
List<SjH2s> list = sjH2sService.selectSjH2sList(sjH2s);
return getDataTable(list);
}
}
......@@ -554,9 +554,9 @@ public class DjdcController {
* @return
*/
@PostMapping("/zqfxccdy")
public void zqfxccdy(@RequestBody DjZqsjfx djZqsjfx,HttpServletResponse response) throws IOException {
public AjaxResult zqfxccdy(@RequestBody DjZqsjfx djZqsjfx,HttpServletResponse response) throws IOException {
Map<String, Object> map = new HashMap<>();
map.put("stream", true);
map.put("stream", false);
Map<String, Object> map2 = new HashMap<>();
map2.put("field_name", "data");
map2.put("type", "input");
......@@ -739,7 +739,9 @@ public class DjdcController {
map.put("content", listMap);
String url = "https://agent.ai.sinopec.com/aicoapi/gateway/v2/workflow/api_run/0093ad2f62d34b7e9510a860b78508ab";
String key = "lpzt1Oxvja1zWOEnzdD5WK4iVBXbgcYg";
dymxcom(map, url, key, response);
String nr=dymxcom(map,url,key);
return AjaxResult.success(nr);
}
......@@ -751,9 +753,9 @@ public class DjdcController {
* @return
*/
@PostMapping("/zjzhccdy")
public void zjzhccdy(@RequestBody DjZjzhfx djZjzhfx,HttpServletResponse response) throws IOException {
public AjaxResult zjzhccdy(@RequestBody DjZjzhfx djZjzhfx,HttpServletResponse response) throws IOException {
Map<String, Object> map = new HashMap<>();
map.put("stream", true);
map.put("stream", false);
Map<String, Object> map2 = new HashMap<>();
map2.put("field_name","data");
map2.put("type","input");
......@@ -802,7 +804,9 @@ public class DjdcController {
map.put("content",listMap);
String url = "https://agent.ai.sinopec.com/aicoapi/gateway/v2/workflow/api_run/41204ba1e1544e639ac842bc432651fb";
String key="g7qoMEhICC8F3uKkLum0J5kJcrmYnp8O";
dymxcom(map,url,key,response);
String nr=dymxcom(map,url,key);
return AjaxResult.success(nr);
}
......@@ -813,9 +817,9 @@ public class DjdcController {
* @return
*/
@PostMapping("/fdcsccdy")
public void fdcsccdy(@RequestBody Jsha jsha,HttpServletResponse response) throws IOException {
public AjaxResult fdcsccdy(@RequestBody Jsha jsha,HttpServletResponse response) throws IOException {
Map<String, Object> map = new HashMap<>();
map.put("stream", true);
map.put("stream", false);
Map<String, Object> map2 = new HashMap<>();
map2.put("field_name","data");
map2.put("type","input");
......@@ -886,7 +890,9 @@ public class DjdcController {
map.put("content",listMap);
String url = "https://agent.ai.sinopec.com/aicoapi/gateway/v2/workflow/api_run/e08c44442d9f48c58bf01ed893c65e12";
String key="g7qoMEhICC8F3uKkLum0J5kJcrmYnp8O";
dymxcom(map,url,key,response);
String nr=dymxcom(map,url,key);
return AjaxResult.success(nr);
}
......@@ -896,9 +902,9 @@ public class DjdcController {
* @return
*/
@PostMapping("/gzbjccdy")
public void gzbjccdy(@RequestBody LjGzbj ljGzbj,HttpServletResponse response) throws IOException {
public AjaxResult gzbjccdy(@RequestBody LjGzbj ljGzbj,HttpServletResponse response) throws IOException {
Map<String, Object> map = new HashMap<>();
map.put("stream", true);
map.put("stream", false);
Map<String, Object> map2 = new HashMap<>();
map2.put("field_name","data");
map2.put("type","input");
......@@ -911,7 +917,9 @@ public class DjdcController {
map.put("content",listMap);
String url = "https://agent.ai.sinopec.com/aicoapi/gateway/v2/workflow/api_run/0985ddac64974702829c1d37b4acac05";
String key="g7qoMEhICC8F3uKkLum0J5kJcrmYnp8O";
dymxcom(map,url,key,response);
String nr=dymxcom(map,url,key);
return AjaxResult.success(nr);
}
......@@ -922,9 +930,9 @@ public class DjdcController {
* @return
*/
@PostMapping("/dxyxcsccdy")
public void dxyxcsccdy(@RequestBody ClYxsj clYxsj, HttpServletResponse response) throws IOException {
public AjaxResult dxyxcsccdy(@RequestBody ClYxsj clYxsj, HttpServletResponse response) throws IOException {
Map<String, Object> map = new HashMap<>();
map.put("stream", true);
map.put("stream", false);
Map<String, Object> map2 = new HashMap<>();
map2.put("field_name","data");
map2.put("type","input");
......@@ -937,7 +945,9 @@ public class DjdcController {
map.put("content",listMap);
String url = "https://agent.ai.sinopec.com/aicoapi/gateway/v2/workflow/api_run/56b56b6f0e224f8184b18309dab9c58c";
String key="g7qoMEhICC8F3uKkLum0J5kJcrmYnp8O";
dymxcom(map,url,key,response);
String nr=dymxcom(map,url,key);
return AjaxResult.success(nr);
}
......@@ -950,9 +960,9 @@ public class DjdcController {
* @return
*/
@PostMapping("/zjyzbccdy")
public void zjyzbccdy(@RequestBody JsgaVo jsgaVo, HttpServletResponse response) throws IOException {
public AjaxResult zjyzbccdy(@RequestBody JsgaVo jsgaVo, HttpServletResponse response) throws IOException {
Map<String, Object> map = new HashMap<>();
map.put("stream", true);
map.put("stream", false);
Map<String, Object> map2 = new HashMap<>();
map2.put("field_name","data");
map2.put("type","input");
......@@ -990,7 +1000,9 @@ public class DjdcController {
map.put("content",listMap);
String url = "https://agent.ai.sinopec.com/aicoapi/gateway/v2/workflow/api_run/d309947b9bee461692b286a4f898e4a6";
String key="g7qoMEhICC8F3uKkLum0J5kJcrmYnp8O";
dymxcom(map,url,key,response);
String nr=dymxcom(map,url,key);
return AjaxResult.success(nr);
}
......@@ -1002,9 +1014,9 @@ public class DjdcController {
* @return
*/
@PostMapping("/cxsjccdy")
public void cxsjccdy(@RequestBody Jskd jskd, HttpServletResponse response) throws IOException {
public AjaxResult cxsjccdy(@RequestBody Jskd jskd, HttpServletResponse response) throws IOException {
Map<String, Object> map = new HashMap<>();
map.put("stream", true);
map.put("stream", false);
Map<String, Object> map2 = new HashMap<>();
map2.put("field_name","data");
map2.put("type","input");
......@@ -1043,7 +1055,9 @@ public class DjdcController {
map.put("content",listMap);
String url = "https://agent.ai.sinopec.com/aicoapi/gateway/v2/workflow/api_run/c49e9b4c7f5a4b55863841dedf0be739";
String key="g7qoMEhICC8F3uKkLum0J5kJcrmYnp8O";
dymxcom(map,url,key,response);
String nr=dymxcom(map,url,key);
return AjaxResult.success(nr);
}
......@@ -1071,7 +1085,29 @@ public class DjdcController {
}
public void dymxcom( Map<String, Object> map,String url,String key,HttpServletResponse response) throws IOException {
public String dymxcom( Map<String, Object> map,String url,String key) throws IOException {
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String json = gson.toJson(map);
String result2 = HttpRequest.post(url).header("Authorization","Bearer "+key).body(json).execute().body();
System.out.println(result2);String textPresentation ="";
// 解析为顶层JsonObject
JsonObject root = gson.fromJson(result2, JsonObject.class);
// 逐层获取"文本呈现"内容
// 1. 获取外层data节点
JsonObject outerData = root.getAsJsonObject("data");
// 2. 获取内层data节点
JsonObject innerData = outerData.getAsJsonObject("data");
// 3. 获取"文本呈现"字段的值
textPresentation = innerData.get("文本呈现").getAsString();
// 打印结果
System.out.println("文本呈现内容:\n" + textPresentation);
return textPresentation;
}
public void dymxcom2( Map<String, Object> map,String url,String key,HttpServletResponse response) throws IOException {
// 设置响应头,支持SSE
response.setContentType(MediaType.TEXT_EVENT_STREAM_VALUE);
......@@ -1114,7 +1150,6 @@ public class DjdcController {
writer.close();
}
}
public void exportZqshfx(HttpServletResponse response,List<DjZqsjfx> list)throws IOException {
Workbook exl = null;
OutputStream out = null;
......
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