ecology_maven/customization/test/NewActionTest.java

190 lines
6.3 KiB
Java

package customization.test;
import aiyh.utils.Util;
import aiyh.utils.entity.ApiConfigMainDTO;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.api.aiyh_kafang.dao.InvoiceMapping;
import com.api.aiyh_kafang.entity.UfInvoiceConfigDTO;
import com.api.aiyh_kafang.service.InvoiceService;
import com.api.aiyh_kafang.web.InvoiceController;
import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping;
import com.api.aiyh_pcn.fadada.entity.FaDaDaConfigDTO;
import com.api.aiyh_pcn.fadada.util.FaDDRequestUtils;
import com.cloudstore.dev.api.util.Util_DataCache;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.junit.Test;
import weaver.aiyh_pcn.fadada.UploadFile2FaDDAction;
import weaver.soa.workflow.request.RequestInfo;
import weaver.workflow.request.RequestManager;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
/**
* @author EBU7-dev1-ayh
* @create 2021/10/21 0021 11:48
* ce shi action
*/
/*公司名 = 陕西正天建设有限公司
creditNo = 916100007273444965
企业编号 = e23deb7a29714d0da5b806665ab3e2f8*/
public class NewActionTest extends BaseTest {
@Test
public void testAction() {
UploadFile2FaDDAction uploadFile2FaDDAction = new UploadFile2FaDDAction();
RequestInfo requestInfo = new RequestInfo();
requestInfo.setRequestid("68072");
requestInfo.setWorkflowid("45");
RequestManager requestManager = new RequestManager();
requestManager.setBilltablename("formtable_main_17");
requestInfo.setRequestManager(requestManager);
uploadFile2FaDDAction.setContractField("htwj");
uploadFile2FaDDAction.execute(requestInfo);
// uploadFile2FaDDAction.signedContract();
}
@Test
public void testContractStatus() throws JsonProcessingException {
Map<String, Object> data = new HashMap<>();
data.put("contractNo", "7622cb620bc04e77b4e85950c564493b");
Map<String, Object> stringObjectMap = FaDDRequestUtils.queryDetailContractStatus(data);
System.out.println(stringObjectMap);
}
@Test
public void getCode() throws UnsupportedEncodingException {
Map<String, Object> map = new HashMap<>();
map.put("companyName", "陕西正天建设有限公司");
map.put("creditNo", "916100007273444965");
String s = FaDDRequestUtils.builderBizContent(map);
System.out.println(s);
byte[] decode = Base64.getDecoder().decode(s.getBytes(StandardCharsets.UTF_8));
String decodeStr = new String(decode, "UTF-8");
System.out.println(decodeStr);
String decode1 = URLDecoder.decode(decodeStr, "UTF-8");
System.out.println(decode1);
JSONObject jsonObject = JSON.parseObject(decode1);
System.out.println(jsonObject);
// Map<String, Object> stringObjectMap = FaDDRequestUtils.checkCompanyInfo(map);
// System.out.println(JSON.toJSONString(stringObjectMap));
}
@Test
public void testDown() throws UnsupportedEncodingException {
FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping();
FaDaDaConfigDTO faDaDaConfigDTO = faDDServiceMapping.queryConfig("45", 2);
System.out.println(JSONObject.toJSONString(faDaDaConfigDTO));
ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(faDaDaConfigDTO.getParamsConfig());
// System.out.println(JSONObject.toJSONString(apiConfigMainDTO));
// FaDDController faDDController = new FaDDController();
// faDDController.getAllVersion("45");
// FaDDServiceImpl faDDService = new FaDDServiceImpl();
// faDDService.queryContractStatus("45","68072");
// faDDController.signedContract("45","68072");
// Response response = faDDController.contractDownload("68072");
// Response response1 = faDDController.contractDownload("68072");
// System.out.println(response);
// System.out.println(response1);
// FaDDServiceImpl faDDService = new FaDDServiceImpl();
// StreamingOutput contractZipStream = faDDService.contractDownload("68072");
// Response build = Response.ok(contractZipStream)
// .type("application/zip")
// .header("Content-Disposition", "attachment;filename=contracts.zip").build();
// System.out.println(build);
// String str = "public.docx";
// System.out.println(str.substring(0,str.indexOf(".")));
// FaDDRequestUtils.downContract(ParaMap.create().put("contractNo","bc8485e3ce1343f5bc898325f371d739"));
// FaDDServiceImpl faDDService = new FaDDServiceImpl();
// faDDService.queryContractStatus("45","68072");
// ModeDataIdUpdate modeDataIdUpdate = ModeDataIdUpdate.getInstance();
// ModeRightInfo mr = new ModeRightInfo();
// mr.rebuildModeDataShareByEdit(1, 11, Util.getIntValue("5"));//数据权限重构
}
@Test
public void testCha() throws IOException {
List<String> list = new ArrayList<>();
List<String> list_rm = new ArrayList<>();
List<String> list1 = new ArrayList<>();
List<String> list1_rm = new ArrayList<>();
list.add("1");
list.add("2");
list.add("3");
list.add("4");
list.add("5");
list.add("6");
list.add("7");
list.add("8");
list1.add("2");
list1.add("4");
list1.add("6");
list1.add("8");
list1.add("10");
list1.add("20");
for (String s : list) {
for (String s1 : list1) {
if (s.equals(s1)) {
list_rm.add(s);
list1_rm.add(s1);
}
}
}
list.removeAll(list_rm);
list1.removeAll(list1_rm);
// Util_DataCache.setObjVal("list_123",list,20);
System.out.println(list);
System.out.println(list1);
}
@Test
public void getCache() {
List<String> list = (List<String>) Util_DataCache.getObjVal("list_123");
System.out.println(list);
}
@Test
public void testInvoiceConfig() {
InvoiceMapping invoiceMapping = new InvoiceMapping();
UfInvoiceConfigDTO configInfo = invoiceMapping.getConfigInfo("48");
System.out.println(JSON.toJSONString(configInfo));
}
@Test
public void testIncoiceCheck(){
Map<String, Object> testData = new HashMap<>();
testData.put("requestId","171172");
testData.put("workflowId","48");
InvoiceService invoiceService = new InvoiceService();
Map<String, Object> result = invoiceService.contrastInvoiceInfo(testData);
System.out.println(JSON.toJSONString(result));
}
@Test
public void testIncoiceCheckController(){
Map<String, Object> testData = new HashMap<>();
testData.put("requestId","171172");
testData.put("workflowId","48");
InvoiceController invoiceController = new InvoiceController();
String result = invoiceController.check(null, null, testData);
System.out.println(result);
}
}