Commit 39beb8d2 by 雷紫添

添加内蒙测试按钮

parent f1c4ae9b
package com.founder.controller;
import com.alibaba.fastjson.JSONObject;
import com.founder.common.CodeMsg;
import com.founder.model.Face;
import com.founder.model.Jccj;
import com.founder.service.AutoSeqService;
import com.founder.service.FaceService;
import com.founder.service.impl.JccjServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Base64;
import java.util.List;
import java.util.Map;
@Controller
@RestController
public class FaceController {
@Autowired
private FaceService faceService;
@Autowired
private AutoSeqService autoSeqService;
@Autowired
private CodeMsg codeMsg;
@ResponseBody
@RequestMapping("/query")
public String query() {
List<Face> face = faceService.query();
/* List<Face> face = faceService.query();
for (Map<String, String> item : codeMsg.getStatus()) {
if (item.get("code").equals("001"))
System.out.println( item.get("name"));
......@@ -31,9 +35,39 @@ public class FaceController {
if("001".equals(item.get("code"))){
System.out.println(item.get("name"));
}
});
String noo= autoSeqService.xxzjbhFnVal("TB_ST_ASJ","1400000000000");
return noo;
});*/
final Base64.Decoder decoder = Base64.getDecoder();
final Base64.Encoder encoder = Base64.getEncoder();
Jccj jccj =new Jccj();
try {
URL url = new URL("http://47.92.129.99/neimeng/FZXZ/201909/JCXX-R1100000500002014070008.zip");
InputStream inStream = null;
inStream = url.openStream();
ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
byte[] buff = new byte[100]; //buff用于存放循环读取的临时数据
int rc = 0;
while ((rc = inStream.read(buff, 0, 100)) > 0) {
swapStream.write(buff, 0, rc);
}
byte[] in_b = swapStream.toByteArray(); //in_b为转换之后的结果
final String encodedText = encoder.encodeToString(in_b);
//编码
jccj.setXxsb_zip(encodedText);
jccj.setTaskid("JCXX-R1100000500002014070008");
jccj.setUser_id("142728188997588823");
jccj.setUser_dept("1400000000");
jccj.setVersion("1.00");
//发送,httpclient 包含zip包
JSONObject jsonResult= JccjServiceImpl.requestByPost("http://www.xzxt.nm:9061/jccj/xxbs",jccj);
System.out.println("返回的参数为::"+jsonResult.toJSONString());
} catch (IOException e) {
e.printStackTrace();
}
return "已执行";
}
}
......@@ -7,8 +7,11 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;
import java.util.Base64;
@Component
public class test {
......@@ -17,7 +20,16 @@ public class test {
try {
final Base64.Decoder decoder = Base64.getDecoder();
final Base64.Encoder encoder = Base64.getEncoder();
/*直接从服务器获取zip包并转成base64 URL url = new URL("http://47.92.129.99/neimeng/FZXZ/201909/JCXX-R1100000500002014070008.zip");
InputStream inStream = url.openStream();
ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
byte[] buff = new byte[100]; //buff用于存放循环读取的临时数据
int rc = 0;
while ((rc = inStream.read(buff, 0, 100)) > 0) {
swapStream.write(buff, 0, rc);
}
byte[] in_b = swapStream.toByteArray(); //in_b为转换之后的结果
final String encodedText = encoder.encodeToString(in_b);*/
Jccj jccj =new Jccj();
File file = new File("D:/JCXX-R1100000500002014070008.zip");
FileInputStream inputFile = new FileInputStream(file);
......@@ -26,6 +38,7 @@ public class test {
inputFile.close();
//编码
final String encodedText = encoder.encodeToString(buffer);
jccj.setXxsb_zip(encodedText);
jccj.setTaskid("JCXX-R1100000500002014070008");
jccj.setUser_id("142728188997588823");
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
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