微信后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
3.6 KiB

package com.ynxbd.common.dao.lis;
import com.alibaba.fastjson.JSONObject;
import com.ynxbd.common.helper.common.Base64Helper;
import com.ynxbd.common.helper.common.JsonHelper;
import com.ynxbd.common.helper.lis.RMLisHelper;
import com.ynxbd.common.result.JsonResult;
import com.ynxbd.common.result.Result;
import com.ynxbd.common.result.ResultEnum;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
@Slf4j
public class RMLisDao {
public static Result downLisReport(String queryType, String queryCode) {
if (ObjectUtils.isEmpty(queryCode)) {
return Result.error(ResultEnum.PARAM_IS_DEFECT);
}
JsonResult jsonResult = RMLisHelper.getJsonResult("GetReportFile", params -> {
params.put("QueryType", (queryType == null || "".equals(queryType)) ? "1" : queryType);
params.put("QueryCode", queryCode);
});
if (!jsonResult.success()) {
return Result.error(jsonResult.getMessage());
}
List<String> files = jsonResult.getDataMapList(String.class, "Files", "File");
List<String> filePdfList = new ArrayList<>();
JSONObject jsonObj;
String file;
for (String fileJson : files) {
jsonObj = JsonHelper.parseObject(fileJson);
if (jsonObj != null) {
file = Base64Helper.pdfBaseToImgBase(jsonObj.getString("FileContent"), 150);
if (file != null) {
filePdfList.add(file);
}
}
}
return Result.success(filePdfList);
}
public static void main(String[] args) throws Exception {
// System.out.println(new JSONArray().toJSONString());
String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" +
"\t<soap:Body>\n" +
"\t\t<UnifiedEntranceResponse xmlns=\"http://www.ruimei.com.cn\">\n" +
"\t\t\t<UnifiedEntranceResult>&lt;Response&gt; &lt;ResultCode&gt;1&lt;/ResultCode&gt; &lt;ResultMessage&gt;调用打印成功!&lt;/ResultMessage&gt; &lt;Files&gt; &lt;File&gt; &lt;FileContent&gt;JVBERi0xLjQNCiWio4&lt;/FileContent&gt; &lt;/File&gt; &lt;/Files&gt;&lt;/Response&gt;</UnifiedEntranceResult>\n" +
"\t\t</UnifiedEntranceResponse>\n" +
"\t</soap:Body>\n" +
"</soap:Envelope>\n";
try {
//解析响应消息,使用SAXReader对象
// unifiedEntranceResponse.element();
// String text = unifiedEntranceResult.getText();
// System.out.println(text);
// element.element("DATA").element("RECORD").element("CODE").getText();
// Element root = document.getRootElement();
// Element element = root.element("soap:Envelope");
// Element envelope = root.element("Envelope");
// Element element = root.element("soap:Envelope");
// Element element1 = root.element("soap:Body");
// System.out.println(element1.getText());
//// System.out.println(document.getText());
//// System.out.println(document.getName());
//// Element root = document.getRootElement(); // 获取根节点元素对象
// System.out.println(root.getText());
} catch (Exception e) {
e.printStackTrace();
}
}
}