package cn.luxin.托尔斯泰;
import java.util.List;
/**
* @ClassName: ChildrenInfo
* @Description:
* @Author
* @Date 2019/5/16 15:37
* @Version V1.0
**/
public class ChildrenInfo {
//人或公司id
private String id;
//名称
private String name;
//H 人 C公司
private String type;
//金额
private String amount;
//占比
private String percent;
//股东类型
private String sh_type;
//子节点
private List <ChildrenInfo> children;
//
private String regCapital;
//父节点名称
private String parentName;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
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 getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getPercent() {
return percent;
}
public void setPercent(String percent) {
this.percent = percent;
}
public String getSh_type() {
return sh_type;
}
public void setSh_type(String sh_type) {
this.sh_type = sh_type;
}
public List <ChildrenInfo> getChildren() {
return children;
}
public void setChildren(List <ChildrenInfo> children) {
this.children = children;
}
public String getRegCapital() {
return regCapital;
}
public void setRegCapital(String regCapital) {
this.regCapital = regCapital;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
}
package cn.luxin.托尔斯泰;
import java.util.List;
/**
* 结构体信息
* @ClassName: StructureInfo
* @Description:
* @Author
* @Date 2019/5/16 15:24
* @Version V1.0
**/
public class StructureInfo {
//公司id
private String id;
//公司名
private String name;
//H 人 C公司
private String type;
//金额
private String amount;
//占比
private String percent;
//股东类型
private String sh_type;
//子节点
private List <ChildrenInfo> children;
//X轴
private int X;
//X轴
private int Y;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
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 getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getPercent() {
return percent;
}
public void setPercent(String percent) {
this.percent = percent;
}
public String getSh_type() {
return sh_type;
}
public void setSh_type(String sh_type) {
this.sh_type = sh_type;
}
public List <ChildrenInfo> getChildren() {
return children;
}
public void setChildren(List <ChildrenInfo> children) {
this.children = children;
}
public int getX() {
return X;
}
public void setX(int x) {
X = x;
}
public int getY() {
return Y;
}
public void setY(int y) {
Y = y;
}
}
package cn.luxin;
import club.newepoch.utils.JsonUtils;
import cn.luxin.托尔斯泰.StructureInfo;
import com.alibaba.fastjson.JSONObject;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 数据转换图片
*
* @ClassName: PictureGeneration
* @Description:
* @Author
* @Date 2019/5/16 21:01
* @Version V1.0
**/
public class PictureGeneration {
//用于接受最大的Y轴数值
int YTotal = 0;
/**
* 生成图片
*
* @param cellsValue 表格里面的值
*/
public String myGraphicsGeneration(String cellsValue) {
//初始化
List <StructureInfo> allChildNodes = new ArrayList <>();
// 字体大小
int fontTitileSize = 15;
// 图片宽度
int imageWidth = 900;
// 图片高度
int imageHeight = cellsValue.length() / 15 + 300;
//生成空图片
BufferedImage image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
//初始化绘画工具到空图片上
Graphics graphics = image.getGraphics();
//绘制背景颜色
graphics.setColor(Color.WHITE);
//填充矩形
graphics.fillRect(0, 0, imageWidth, imageHeight);
graphics.setColor(new Color(0, 0, 0));
//设置字体
Font font = new Font("微软雅黑", Font.BOLD, fontTitileSize);
graphics.setFont(font);
//写入内容
int x = 30;
int y = 60;
List <Object> object = null;
List <String> structureList = new ArrayList <>();
List <String> pathLst = new ArrayList <>();
//获取整个json数据并且将json数据转为Map类型
Map <String, Object> stringObjectMap = JsonUtils.parseJson2Map(cellsValue);
for (String key : stringObjectMap.keySet()) {
//获取key为result的所有Data
if ("result".equals(key)) {
//将result的数据全部转为Map类型
Map <String, Object> stringObjectMap1 = JsonUtils.parseJson2Map(JsonUtils.toJSONString(stringObjectMap.get(key)));
for (String key1 : stringObjectMap1.keySet()) {
//获取主要控股的公司或者人
if ("path".equals(key1)) {
//获取path的所有子节点
List <Object> pathAllChildNodes = JsonUtils.parseJson2List(JsonUtils.toJSONString(stringObjectMap1.get(key1)));
for (Object pathAllChildNodesInfo : pathAllChildNodes) {
//将path的子节点转换成JSONObject
JSONObject str1 = (JSONObject) pathAllChildNodesInfo;
Object cellsValueinfo111 = str1.get("value");
font = new Font("微软雅黑", Font.PLAIN, fontTitileSize);
pathLst.add(cellsValueinfo111.toString());
graphics.setFont(font);
graphics.setColor(Color.blue);
}
graphics.drawString(pathLst.toString(), x, y);
}
//获取股权结构
if ("structure".equals(key1)) {
//将股权结构的数据全部转为Map类型
Map <String, Object> equityStructure = JsonUtils.parseJson2Map(JsonUtils.toJSONString(stringObjectMap1.get(key1)));
//公司名
structureList.add(equityStructure.get("name").toString());
//金额
structureList.add(equityStructure.get("amount").toString());
//占比
structureList.add(equityStructure.get("percent").toString());
//设置字体以及颜色
graphics.setFont(font);
graphics.setColor(Color.MAGENTA);
//将X和Y轴增加30
x = 30 + x;
y = 30 + y;
graphics.drawString(structureList.toString(), x, y);
//若股权结构子节点不为空时
if (!equityStructure.get("children").toString().equals("[]")) {
//获取全部children子节点
object = JsonUtils.parseJson2List(JsonUtils.toJSONString(equityStructure.get("children")));
//将当前的Y轴数值赋值给最大的Y轴变量
YTotal = y;
//将全部股权结构子节点和XY轴数据传到递归方法
// 这里是提前x 方向 偏移30 ,然后在递归方法里面如果有子节点,在往 y 方向偏移 30 ,这里的偏移 的只是距离 ,没有正负轴之说。
Recursive(allChildNodes, object, x + 30, y );
// int r = 0;
for (StructureInfo i : allChildNodes) {
List <String> asdaASDsd = new ArrayList <>();
String naem = i.getName();
String amount = i.getAmount();
String percent = i.getPercent();
int X = i.getX();
int Y = i.getY();
asdaASDsd.add(naem);
asdaASDsd.add(amount);
asdaASDsd.add(percent);
font = new Font("微软雅黑", Font.PLAIN, fontTitileSize);
graphics.setFont(font);
graphics.setColor(Color.red);
graphics.drawString(asdaASDsd.toString(), X, Y);
// r++;
}
}
}
}
}
}
String savePath = "D:\\uploadTest" ;
String companyName = structureList.get(0);
//写标题
String title = companyName + "股权结构图";
graphics.drawString(title, 30, 30);
// 保存图片
String savePicture = createImage(image, savePath + "\\" + companyName + ".jpg", companyName);
return savePicture;
}
/**
* 将图片保存到指定位置
*
* @param image 缓冲文件类
* @param fileLocation 文件位置
* @param fileName 文件名称
*/
public String createImage(BufferedImage image, String fileLocation, String fileName) {
// try {
// FileOutputStream fos = new FileOutputStream(fileLocation);
// BufferedOutputStream bos = new BufferedOutputStream(fos);
// JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bos);
// encoder.encode(image);
// bos.close();
// // 保存文件信息到文件表
// String fileUuid = StringUtils.randomUuid();
// File file = new File(fileLocation);
// FileInfo fileInfo = new FileInfo();
// fileInfo.setFile(file);
//
// fileInfo.setOriginalFileName(fileName);
// SysFile saveFile = SysFileUtils.fileInfo2SysFile(fileInfo, null);
// saveFile.set("uuid", fileUuid);
// boolean isTrue = saveFile.save();
// if (isTrue) {
// // 保存成功
// // 文件上传云端
// FileInfo UpFileInfo = this.getFileInfoByUuid(fileUuid);
// this.upload2cloud(UpFileInfo, false);
// }
// return fileUuid;
// } catch (Exception e) {
// e.printStackTrace();
// }
// return null;
try {
FileOutputStream fos = new FileOutputStream(fileLocation);
BufferedOutputStream bos = new BufferedOutputStream(fos);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bos);
encoder.encode(image);
bos.close();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 判断当前children节点是否有子节点
* 主要目的是获取 所有的 children 的个数
*
* @param list 空的List对象
* @param Structure List对象
* @param x X轴
* @param y Y轴
*/
/**
* 总的思路:提前把: x的偏移量 30 ,偏移, 然后在 获取 “children” 的子节点的时候,在偏移 y 30
* 如果有“ children” 有子节点 ,就设置当前的children 的x,y 到list 中去 ,在去找 “children” 的字节点的个数,也就是 调用自己本身的方法
* 如果“children” 没有字节点 ,就设置当前 children 的x,y 到list 中去
* @param list
* @param Structure
* @param x
* @param y
*/
public void Recursive(List <StructureInfo> list, List <Object> Structure, int x, int y) {
for (Object Structure1 : Structure) {
//获取当前子节点的数据
JSONObject str = (JSONObject) Structure1;
//初始化结构体信息
StructureInfo structureInfo = new StructureInfo();
//公司名字
structureInfo.setName(str.get("name").toString());
//金额
structureInfo.setAmount(str.get("amount").toString());
//占比
structureInfo.setPercent(str.get("percent").toString());
//获取当前节点的子节点
List <Object> list1 = JsonUtils.parseJson2List(str.get("children").toString());
//将Y轴加30
y = YTotal + 30;
//将最大的Y轴数值也增加30
YTotal = YTotal + 30;
//当前股权结构是否有子节点
if (list1.size() != 0) {
structureInfo.setX(x);
structureInfo.setY(y);
list.add(structureInfo);
//如果当前循环的子节点中,“children”的不为空的话 ,就再次调用自己,并且在调用的同时,还是要提前把 ,x偏移 30
Recursive(list, list1, x + 30, y);
} else {
structureInfo.setX(x);
structureInfo.setY(y);
list.add(structureInfo);
}
}
}
}
package cn.luxin;
import club.newepoch.persistent.db.exception.ActiveRecordException;
import org.eclipse.jdt.internal.compiler.batch.Main;
import java.io.IOException;
public class TYCInterfaceController {
public static void main(String[] args) {
try {
new TYCInterfaceService().enterpriseInformationFile();
} catch (IOException e) {
e.printStackTrace();
} catch (ActiveRecordException e) {
e.printStackTrace();
}
}
}
package cn.luxin;
import club.newepoch.persistent.db.exception.ActiveRecordException;
import club.newepoch.utils.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.xssf.usermodel.*;
import java.awt.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
/**
* 天眼查接口Service
*
* @ClassName: TYCInterfaceService
* @Description:
* @Author 李宏凯
* @Date 2019/5/15 14:15
* @Version V1.0
**/
public class TYCInterfaceService {
/**
* 获取企业基本信息并且生成文件
*
* @param ctl
* @return
*/
// public boolean getBusinessInfo(QhyfController ctl) throws IOException {
// String result = "";
// boolean basicFileInfo = false;
// try {
// List <NameValuePair> params = new ArrayList <NameValuePair>();
// String id = ctl.getPara("id");
// if (StringUtils.notBlank(id)) {
// params.add(new BasicNameValuePair("id", id));
// }
// String name = ctl.getPara("name");
// if (StringUtils.notBlank(name)) {
// params.add(new BasicNameValuePair("name", name));
// }
// Date startTime = new Date();
// String str = EntityUtils.toString(new UrlEncodedFormEntity(params, Consts.UTF_8));
// String token = "21416d43-62b5-4522-9d6b-1072ff89bc54";
// String url = "http://open.api.tianyancha.com/services/v4/open/";
// String interfaceName = "baseinfo";
// // 根据地址获取请求
// HttpGet request = new HttpGet(url + interfaceName + "?" + str);//这里发送get请求
// // 获取当前客户端对象
// request.setHeader("Authorization", token);
// HttpClient httpClient = new DefaultHttpClient();
// // 通过请求对象获取响应对象
// HttpResponse response = httpClient.execute(request);
// // 判断网络连接状态码是否正常(0--200都数正常)
// if (response.getStatusLine().getStatusCode() >= 0 && response.getStatusLine().getStatusCode() <= HttpStatus.SC_OK) {
// result = EntityUtils.toString(response.getEntity(), "utf-8");
// }
// updateTycHistory(response, startTime, interfaceName, url);
// JSONObject results = JSONObject.fromObject(result);
// if (!results.get("error_code").equals("0")) {
// //AssertUtils.isTrue(false, results.get("reason").toString());
// }
// // 企业基本信息文件生成
// //basicFileInfo = enterpriseInformationFile(ctl, results, id, token);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return basicFileInfo;
// }
/**
* 企业基本信息文件生成
*/
public void enterpriseInformationFile(/*, JSONObject flieInfo, String id, String token*/) throws IOException, ActiveRecordException {
/*//公司名称
Object name = flieInfo.getJSONObject("result").get("name");
//统一社会信用代码
Object creditCode = flieInfo.getJSONObject("result").get("creditCode");
//核准日期
Object approvedTime = flieInfo.getJSONObject("result").get("approvedTime");*/
Object name = "某某供应商";
Object creditCode = "TYSHXYDM";
Object approvedTime = "2019-05-05";
//数据抓取时间
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dataCaptureTime = sdf.format(date);
//股权结构图
//String structureChartJosnInfo = getMessageByUrlToken(ctl, id, token);
String jsonStr = "{\"error_code\":0, " +
"\"reason\":\"ok\"," +
"\"result\":{" +
" \"path\":[" +
" {" +
" \"type\":\"name\"," +
" \"value\":\"李彦宏\"," +
" \"id\":\"1984012283\"," +
" \"cid\":\"22822\" " +
" }," +
" {" +
" \"type\":\"percent\"," +
" \"value\":\"99.50%\"" +
" }," +
" {" +
" \"type\":\"name\"," +
" \"value\":\"北京百度网讯科技有限公司\"" +
" }" +
" ]," +
" \"structure\":{" +
" \"id\":\"22822\"," +
" \"name\":\"北京百度网讯科技有限公司\"," +
" \"type\":\"C\"," +
" \"amount\":\"216042.36\"," +
" \"percent\":\"99.50%\"," +
" \"sh_type\":null," +
" \"children\":[" +
" {" +
" \"id\":\"1984012283\"," +
" \"name\":\"李彦宏1\"," +
" \"type\":\"H\"," +
" \"amount\":\"216042.36\"," +
" \"percent\":\"99.50%\"," +
" \"sh_type\":\"工商股东\"," +
" \"children\":[ " +
" {" +
" \"id\":\"1984012283\"," +
" \"name\":\"李彦宏2\"," +
" \"type\":\"H\"," +
" \"amount\":\"216042.36\"," +
" \"percent\":\"99.50%\"," +
" \"sh_type\":\"工商股东\"," +
" \"children\":["+
" {" +
" \"id\":\"1984012283\"," +
" \"name\":\"李彦宏3\"," +
" \"type\":\"H\"," +
" \"amount\":\"216042.36\"," +
" \"percent\":\"99.50%\"," +
" \"sh_type\":\"工商股东\"," +
" \"children\":[ ]," +
" \"regCapital\":null," +
" \"parentName\":\"children\"," +
" \"actualHolding\":true" +
" }," +
" {" +
" \"id\":\"1839080315\"," +
" \"name\":\"向海龙1\"," +
" \"type\":\"H\"," +
" \"amount\":\"1085.64\"," +
" \"percent\":\"0.50%\"," +
" \"sh_type\":\"工商股东\"," +
" \"children\":[" +
" {" +
" \"id\":\"1839080315\"," +
" \"name\":\"向海龙1\"," +
" \"type\":\"H\"," +
" \"amount\":\"1085.64\"," +
" \"percent\":\"0.50%\"," +
" \"sh_type\":\"工商股东\"," +
" \"children\":[]," +
" \"regCapital\":null," +
" \"parentName\":\"children\"," +
" \"actualHolding\":false" +
" }" +
" ]," +
" \"regCapital\":null," +
" \"parentName\":\"children\"," +
" \"actualHolding\":false" +
" }," +
" {" +
" \"id\":\"1984012283\"," +
" \"name\":\"李彦宏4\"," +
" \"type\":\"H\"," +
" \"amount\":\"216042.36\"," +
" \"percent\":\"99.50%\"," +
" \"sh_type\":\"工商股东\"," +
" \"children\":[ ]," +
" \"regCapital\":null," +
" \"parentName\":\"children\"," +
" \"actualHolding\":true" +
" }" +
" ]," +
" \"regCapital\":null," +
" \"parentName\":\"children\"," +
" \"actualHolding\":true" +
" }" +
" ]," +
" \"regCapital\":null," +
" \"parentName\":\"children\"," +
" \"actualHolding\":true" +
" }," +
" {" +
" \"id\":\"1984012283\"," +
" \"name\":\"李彦宏5\"," +
" \"type\":\"H\"," +
" \"amount\":\"216042.36\"," +
" \"percent\":\"99.50%\"," +
" \"sh_type\":\"工商股东\"," +
" \"children\":[ ]," +
" \"regCapital\":null," +
" \"parentName\":\"children\"," +
" \"actualHolding\":true" +
" }," +
" ]," +
" \"regCapital\":\"217128\"," +
" \"parentName\":\"structure\"," +
" \"actualHolding\":true" +
" }"+
" }" +
"}";
//图片生成
PictureGeneration pictureGeneration = new PictureGeneration();
pictureGeneration.myGraphicsGeneration(jsonStr);
// 设置导出时间
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String exportTime = sd.format(new Date());
// 创建表头
XSSFWorkbook workbook = new XSSFWorkbook();
String savePath = "D:\\uploadTest\\";
File save = new File(savePath);
if (!save.exists() && !save.isDirectory()) {
save.mkdirs();
}
String fileName = "某某供应商信息.xlsx";
savePath = savePath + File.separator + fileName;
FileOutputStream fout = new FileOutputStream(savePath);
// 创建检测结果sheet
XSSFSheet sheetPay = workbook.createSheet("供应商信息");
sheetPay.createFreezePane(0, 1, 0, 1);
// 设置付款单信息筛选
// CellRangeAddress payChoose = CellRangeAddress.valueOf("B1:V1");
// sheetPay.setAutoFilter(payChoose);
XSSFRow headPayRow = sheetPay.createRow(0);
// 设置付款单sheet行高
sheetPay.setDefaultRowHeightInPoints(3 * 10);
// 定义付款单sheet表头
String[] headPayArr = {"公司名称", "统一社会信用代码", "核准日期", "数据抓取时间", "股权结构图"};
// 单元格
XSSFCell headPayCell = null;
XSSFCellStyle style = workbook.createCellStyle();
// 表头样式设置
style.setBorderBottom(XSSFCellStyle.BORDER_THIN);
style.setBorderLeft(XSSFCellStyle.BORDER_THIN);
style.setBorderTop(XSSFCellStyle.BORDER_THIN);
style.setBorderRight(XSSFCellStyle.BORDER_THIN);
// 设置背景色
style.setFillForegroundColor(new XSSFColor(new Color(216, 216, 216)));
style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 水平居中
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);//垂直居中
style.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND);
// 设置表头字体
XSSFFont headFont = workbook.createFont();
// 字体样式
headFont.setFontName("宋体");
// 字体大小
headFont.setFontHeightInPoints((short) 9);
// 加粗
headFont.setBold(true);
style.setFont(headFont);
// 列宽设置
sheetPay.setColumnWidth(0, 2 * 256);// 公司名称
sheetPay.setColumnWidth(1, 10 * 256);// 统一社会信用代码
sheetPay.setColumnWidth(2, 15 * 256);// 核准日期
sheetPay.setColumnWidth(3, 10 * 256);// 数据抓取时间
sheetPay.setColumnWidth(4, 40 * 256);// 股权结构图
// 写入付款通知书表头
for (int i = 0; i < headPayArr.length; i++) {
sheetPay.autoSizeColumn(i + 1);
headPayCell = headPayRow.createCell(i + 1);
headPayCell.setCellValue(headPayArr[i]);
headPayCell.setCellStyle(style);
}
// 设置单元格样式
XSSFCellStyle cellStyle = workbook.createCellStyle();
// 边框
cellStyle.setBorderBottom(XSSFCellStyle.BORDER_THIN);
cellStyle.setBorderLeft(XSSFCellStyle.BORDER_THIN);
cellStyle.setBorderTop(XSSFCellStyle.BORDER_THIN);
cellStyle.setBorderRight(XSSFCellStyle.BORDER_THIN);
// 内容换行
cellStyle.setWrapText(true);
// 垂直居中
cellStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);
// 设置单元格字体
XSSFFont font = workbook.createFont();
// 字体样式
font.setFontName("微软雅黑");
// 字体大小
font.setFontHeightInPoints((short) 9);
cellStyle.setFont(font);
// 加粗
XSSFCell cellPay = null;
XSSFRow rowPay = null;
// 对各元素设值
rowPay = sheetPay.createRow( 1);
cellPay = rowPay.createCell(1);
cellPay.setCellValue(name.toString());
cellPay.setCellStyle(cellStyle);
cellPay = rowPay.createCell(2);
cellPay.setCellValue(creditCode.toString());
cellPay.setCellStyle(cellStyle);
cellPay = rowPay.createCell(3);
cellPay.setCellValue(approvedTime.toString());
cellPay.setCellStyle(cellStyle);
cellPay = rowPay.createCell(4);
cellPay.setCellValue(dataCaptureTime);
cellPay.setCellStyle(cellStyle);
cellPay = rowPay.createCell(5);
cellPay.setCellStyle(cellStyle);
// 保存到文件
workbook.write(fout);
fout.close();
// 保存文件信息到文件表
String fileUuid = StringUtils.randomUuid();
File file = new File(savePath);
// FileInfo UpFileInfo = this.getFileInfoByUuid(fileUuid);
// this.upload2cloud(UpFileInfo, true);
// FileInfo fileInfo = new FileInfo();
// fileInfo.setFile(file);
// fileInfo.setOriginalFileName(fileName);
// SysFile saveFile = SysFileUtils.fileInfo2SysFile(fileInfo, null);
// saveFile.set("uuid", fileUuid);
// boolean isTrue = saveFile.save();
// if (isTrue) {
// // 保存成功
// // 文件上传云端
// FileInfo UpFileInfo = this.getFileInfoByUuid(fileUuid);
// this.upload2cloud(UpFileInfo, true);
// // 更新绿城付款单数据表对应导出状态为已导出
// return fileUuid;
// } else {
// return null;
// }
}
/**
* 获取股权结构图数据
*
* @param
* @return
*/
// public String getMessageByUrlToken( String id, String token) {
// String result = "";
// JSONObject results = null;
// try {
// List <NameValuePair> params = new ArrayList <NameValuePair>();
// if (StringUtils.notBlank(id)) {
// params.add(new BasicNameValuePair("id", id));
// }
// Date startTime = new Date();
// String str = EntityUtils.toString(new UrlEncodedFormEntity(params, Consts.UTF_8));
// String url = "http://open.api.tianyancha.com/services/v4/open/";
// String interfaceName = "equityRatio";
// // 根据地址获取请求
// HttpGet request = new HttpGet(url + interfaceName + "?" + str);
// // 获取当前客户端对象
// request.setHeader("Authorization", token);
// HttpClient httpClient = new DefaultHttpClient();
// // 通过请求对象获取响应对象
// HttpResponse response = httpClient.execute(request);
// // 判断网络连接状态码是否正常(0--200都数正常)
// if (response.getStatusLine().getStatusCode() >= 0 && response.getStatusLine().getStatusCode() <= HttpStatus.SC_OK) {
// result = EntityUtils.toString(response.getEntity(), "utf-8");
// }
// updateTycHistory(response, startTime, interfaceName, url);
//
// if (!results.get("error_code").equals("0")) {
// //AssertUtils.isTrue(false, results.get("reason").toString());
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// return result;
// }
/**
* 保存天眼查接口履历
*
* @throws Exception
*/
// public void updateTycHistory(HttpResponse response, Date startTime, String interfaceName, String url) throws Exception {
// // 设置接口信息
// ApiCallInfo apiCallInfo = new ApiCallInfo(Thread.currentThread().getStackTrace()[2].getMethodName());
// if (response.getStatusLine().getStatusCode() >= 0 && response.getStatusLine().getStatusCode() <= HttpStatus.SC_OK) {
// // 是否调用成功
// apiCallInfo.setCalled(true);
// apiCallInfo.setResult(response);
// } else {
// // 是否调用成功
// apiCallInfo.setCalled(false);
// // 设置返回信息
// apiCallInfo.setError(response.toString());
// }
// // 接口名称
// apiCallInfo.setApi(interfaceName);
// // 接口名称
// apiCallInfo.setSendApi(url + interfaceName);
// // 履历接口调用类名
// apiCallInfo.setLocation(Thread.currentThread().getStackTrace()[2].getClassName());
// // 调用开始时间
//
// apiCallInfo.setStartTime(startTime);
// // 调用结束时间
// apiCallInfo.setEndTime(new Date());
// // 调用者
// apiCallInfo.setCallUser(BlConstant.FIELD_DB_CURRENT_SYSTEM_USER_ID);
// // 保存风报接口调用履历
// IApiCallResultHandle callResult = new ApiCallResult2DbHandleImpl();
// callResult.handle(apiCallInfo, "biz_tyc_api_history");
// }
}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.qhyf</groupId>
<artifactId>qhyf</artifactId>
<version>1.0.80-beta</version>
<name>Qhyf-WEB</name>
<url>http://ISCWX.newepoch.club</url>
<properties>
<slf4j.version>1.7.7</slf4j.version>
<logback.version>1.1.3</logback.version>
<nebase.version>1.5.13-release</nebase.version>
<nedb.version>1.0.63-qhyf</nedb.version>
<ijfinal-version>1.3.46-release</ijfinal-version>
<!-- <jf-wx.version>1.5.3-SNAPSHOT</jf-wx.version> -->
<iwx.version>1.2.41-release</iwx.version>
<!-- <jf-ext.version>3.1.4</jf-ext.version> -->
<iweb.version>1.0.71</iweb.version>
<codeGenerator.version>0.0.3</codeGenerator.version>
<druid.version>1.0.19</druid.version>
<nenio.version>0.0.122</nenio.version>
<cordysclient.version>0.0.70-SNAPSHOT</cordysclient.version>
<aliyun-version>2.2.1</aliyun-version>
</properties>
<developers>
<developer>
<email>tommylee@leebing.com</email>
<name>leebing</name>
<organization>NewEpoch@intasect</organization>
<organizationUrl>newepoch@intasect.com.cn</organizationUrl>
</developer>
</developers>
<dependencies>
<!-- http://mvnrepository.com/artifact/org.apache.xmlgraphics/fop -->
<!-- <dependency> -->
<!-- <groupId>org.apache.xmlgraphics</groupId> -->
<!-- <artifactId>fop</artifactId> -->
<!-- <version>2.1</version> -->
<!-- </dependency> -->
<dependency>
<groupId>com.github.junrar</groupId>
<artifactId>junrar</artifactId>
<version>0.7</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.7.2</version>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>${aliyun-version}</version>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j</artifactId>
<version>3.2.2</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- http://mvnrepository.com/artifact/com.hynnet/jacob -->
<dependency>
<groupId>com.hynnet</groupId>
<artifactId>jacob</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.9</version>
</dependency>
<dependency>
<groupId>club.newepoch</groupId>
<artifactId>BaseProject</artifactId>
<version>${nebase.version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j</artifactId>
<version>3.2.2</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>club.newepoch</groupId>
<artifactId>iwx</artifactId>
<version>${iwx.version}</version>
</dependency>
<dependency>
<groupId>club.newepoch</groupId>
<artifactId>iweb</artifactId>
<version>${iweb.version}</version>
</dependency>
<dependency>
<groupId>club.newepoch.cordys</groupId>
<artifactId>CordysClient</artifactId>
<version>${cordysclient.version}</version>
</dependency>
<dependency>
<groupId>club.newepoch</groupId>
<artifactId>NeNio</artifactId>
<version>${nenio.version}</version>
</dependency>
<dependency>
<groupId>com.jfinal</groupId>
<artifactId>jetty-server</artifactId>
<version>8.1.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jsp</artifactId>
<version>8.1.8.v20121106</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.jknack</groupId>
<artifactId>handlebars</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.jfinal</groupId>
<artifactId>cos</artifactId>
<version>26Dec2008</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!--SpringAmqpImpl间接依赖-->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>
<!--NewEpoch通用MQ框架依赖-->
<dependency>
<groupId>club.newepoch</groupId>
<artifactId>NewEpochMQ</artifactId>
<version>1.0.9-release</version>
</dependency>
<!--基于NEMQ的消息通知框架-->
<dependency>
<groupId>club.newepoch.Notify</groupId>
<artifactId>Notify-impl-nemq</artifactId>
<version>0.0.3</version>
</dependency>
<!--NEMQ的SpringAmpq实现→针对Rabbitmq-->
<dependency>
<groupId>club.newepoch</groupId>
<artifactId>SpringAmqpImpl</artifactId>
<version>1.0.4-release</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>com.jfinal</groupId> -->
<!-- <artifactId>jfinal-ext</artifactId> -->
<!-- <version>${jf-ext.version}</version> -->
<!-- <exclusions> -->
<!-- 不依赖官方jfinal框架,而通过IJfinal替代 -->
<!-- <exclusion> -->
<!-- <groupId>com.jfinal</groupId> -->
<!-- <artifactId>jfinal</artifactId> -->
<!-- </exclusion> -->
<!-- </exclusions> -->
<!-- </dependency> -->
<dependency>
<groupId>club.newepoch</groupId>
<artifactId>IJfinal</artifactId>
<version>${ijfinal-version}</version>
<exclusions>
<!-- 不再从IJfinal中继承依赖NEDB,避免每次NEDB升级都必须对IJfinal进行升级 -->
<exclusion>
<groupId>club.newepoch</groupId>
<artifactId>NewEpochDB</artifactId>
</exclusion>
<exclusion>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>club.newepoch</groupId>
<artifactId>NewEpochDB</artifactId>
<version>${nedb.version}</version>
<exclusions>
<exclusion>
<groupId>club.newepoch</groupId>
<artifactId>NeNio</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency> <groupId>club.newepoch</groupId> <artifactId>NewEpochCodeGenerator</artifactId>
<version>${necg.version}</version> </dependency> -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.0.14</version>
</dependency>
<dependency>
<groupId>org.beetl</groupId>
<artifactId>beetl-core</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
<!-- Logging with SLF4J & LogBack -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<!-- <scope>test</scope> -->
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
<!-- <scope>test</scope> -->
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.36</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.6.6</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.9.6</version>
</dependency>
<dependency>
<groupId>com.sun.media</groupId>
<artifactId>jai_codec</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>javax.media</groupId>
<artifactId>jai_core</artifactId>
<version>1.1.3</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>commons-logging</groupId> -->
<!-- <artifactId>commons-logging</artifactId> -->
<!-- <version>1.2</version> -->
<!-- </dependency> -->
<dependency>
<groupId>club.newepoch</groupId>
<artifactId>NewEpochCodeGenerator</artifactId>
<version>${codeGenerator.version}</version>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>${aliyun-version}</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.6</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>3.2.8</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>club.newepoch</groupId>
<artifactId>ijfinal-ext</artifactId>
<version>0.0.3</version>
</dependency>
<!-- pdf解析支持 -->
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.13</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>javax.xml.rpc</groupId>
<artifactId>javax.xml.rpc-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>javax.xml.soap</groupId>
<artifactId>saaj-api</artifactId>
<version>1.3</version>
<exclusions>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 电子发票三方依赖 -->
<dependency>
<groupId>com.qhyf</groupId>
<artifactId>axis</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>com.qhyf</groupId>
<artifactId>myencrypt</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>com.qhyf</groupId>
<artifactId>xfire</artifactId>
<version>0.0.1</version>
</dependency>
<!-- 电子发票三方依赖 -->
<!-- 百望 -->
<dependency>
<groupId>club.newepoch.finance</groupId>
<artifactId>FinanceHttpApi</artifactId>
<version>2.6-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<testResources>
<testResource>
<directory>${project.basedir}/src/test/java</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
<directory>${project.basedir}/target</directory>
<!-- <directory>${project.basedir}/src/main/webapp/WEB-INF/target</directory>vi -->
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webappDirectory>${basedir}/src/main/webapp</webappDirectory>
<warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- 生成javadoc -->
<!-- <plugin> -->
<!-- <groupId>org.apache.maven.plugins</groupId> -->
<!-- <artifactId>maven-javadoc-plugin</artifactId> -->
<!-- <version>2.10.3</version> -->
<!-- <inherited>true</inherited> -->
<!-- <executions> -->
<!-- <execution> -->
<!-- <id>attach-javadocs</id> -->
<!-- <goals> -->
<!-- <goal>jar</goal> -->
<!-- </goals> -->
<!-- </execution> -->
<!-- </executions> -->
<!-- <configuration> -->
<!-- <aggregate>true</aggregate> -->
<!-- <show>private</show> -->
<!-- <nohelp>true</nohelp> -->
<!-- <docencoding>UTF8</docencoding> -->
<!-- <charset>UTF8</charset> -->
<!-- <excludes>**/test/*.java</excludes> -->
<!-- <outputDirectory>${project.basedir}/doc/</outputDirectory> -->
<!-- <reportOutputDirectory>${project.basedir}/doc-report/</reportOutputDirectory> -->
<!-- <destDir>doc</destDir> -->
<!-- <doctitle>${project.artifactId}(${project.version})API文档</doctitle> -->
<!-- <windowtitle>${project.artifactId}(${project.version})API文档</windowtitle> -->
<!-- <tags> -->
<!-- <tag> -->
<!-- <name>todo</name> -->
<!-- <placement>a</placement> -->
<!-- <head>待完成:</head> -->
<!-- </tag> -->
<!-- <tag> -->
<!-- <name>urlpara</name> -->
<!-- <placement>m</placement> -->
<!-- <head>url参数格式:</head> -->
<!-- </tag> -->
<!-- </tags> -->
<!-- </configuration> -->
<!-- </plugin> -->
<!-- <plugin> -->
<!-- <groupId>org.apache.maven.plugins</groupId> -->
<!-- <artifactId>maven-gpg-plugin</artifactId> -->
<!-- <version>1.1</version> -->
<!-- <executions> -->
<!-- <execution> -->
<!-- <id>sign-artifacts</id> -->
<!-- <phase>verify</phase> -->
<!-- <goals> -->
<!-- <goal>sign</goal> -->
<!-- </goals> -->
<!-- </execution> -->
<!-- </executions> -->
<!-- <configuration> -->
<!-- <skip>false</skip> -->
<!-- </configuration> -->
<!-- </plugin> -->
</plugins>
</build>
<repositories>
<repository>
<id>intasect</id>
<name>intasect</name>
<url>http://nemq.newepoch.club:7001/content/groups/intasect/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>intasect</id>
<name>intasect</name>
<url>http://nemq.newepoch.club:7001/content/groups/intasect/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>