package com.changhong.epc.count.service.system.performer.impl;
|
|
import com.changhong.epc.bean.count.MasterInfo;
|
import com.changhong.epc.bean.count.func.FunNameKey;
|
import com.changhong.epc.bean.tenant.bill.BillData;
|
import com.changhong.epc.bean.tenant.bill.IOCRBill;
|
import com.changhong.epc.bean.tenant.bill.OCRBillHeaderEntity;
|
import com.changhong.epc.bean.tenant.bill.RuleMsg;
|
import com.changhong.epc.bean.tenant.system.ErrSystemMsg;
|
import com.changhong.epc.count.service.count.data.paramiter.IParamIter;
|
import com.changhong.epc.count.service.count.data.paramiter.impl.ParamIter;
|
import com.changhong.epc.count.service.count.model.CountParamMax;
|
import com.changhong.epc.count.service.count.model.UnitInfo;
|
import com.iemsoft.framework.cloud.core.tools.JSONTool;
|
|
import java.lang.reflect.Field;
|
import java.util.*;
|
|
public class FormulaTest implements FunNameKey {
|
|
public static void main(String... args) throws NoSuchFieldException, IllegalAccessException {
|
// FunctionParam functionParam = new FunctionParam(true);
|
// functionParam.initData(getIParamIter());
|
// functionParam.setExpression("false <> true ");
|
//// functionParam.setExpression("getDate('FromDate', 'yyyy-MM-dd') != getDate('ToDate', 'yyyy-MM-dd')");
|
// Map<String, Object> env = functionParam.getOriginalEnv();
|
//
|
// {
|
// env.put("a1", new MeInfo("F149", "010402", ""));
|
// env.put("a2", new MeInfo("F149", "010404", ""));
|
// env.put("a3", new MeInfo("F005", "0001", ""));
|
// }
|
//
|
// functionParam.setEnv(env);
|
// new FormulaHandle().execute(functionParam);
|
List<OCRBillHeaderEntity> bills = JSONTool.toList("[\n" +
|
" {\n" +
|
" \"allotTenant\":true,\n" +
|
" \"billBodyEntityList\":[\n" +
|
" {\n" +
|
" \"billCode\":\"074a31ca4f3e43edb85e96ab500eff90\",\n" +
|
" \"billKeyCode\":{\n" +
|
" \"Amount\":\"182.00\"\n" +
|
" },\n" +
|
" \"billKeyName\":{\n" +
|
" \"Amount\":\"182.00\"\n" +
|
" },\n" +
|
" \"billMasterCode\":{\n" +
|
"\n" +
|
" },\n" +
|
" \"billMasterName\":{\n" +
|
"\n" +
|
" },\n" +
|
" \"billMoney\":0,\n" +
|
" \"bodyDataMap\":{\n" +
|
" \"500030\":\"日办公用品\",\n" +
|
" \"560054\":\"182.00\"\n" +
|
" },\n" +
|
" \"ignore\":false\n" +
|
" }\n" +
|
" ],\n" +
|
" \"billCode\":\"1018500180900073-002-01\",\n" +
|
" \"billHeadMap\":{\n" +
|
" \"520040\":\"四川成都市\",\n" +
|
" \"540040\":\"\",\n" +
|
" \"550025\":\"30170237\",\n" +
|
" \"550031\":\"\",\n" +
|
" \"550044\":\"\",\n" +
|
" \"550055\":\"91510700205412308D\",\n" +
|
" \"550099\":\"151011776003\",\n" +
|
" \"560133\":\"182.00\",\n" +
|
" \"560134\":\"182.0\",\n" +
|
" \"570001\":\"发票联\",\n" +
|
" \"580008\":\"\",\n" +
|
" \"590006\":\"四川省成都市国家税务局通用机打发票\",\n" +
|
" \"590010\":\"\",\n" +
|
" \"590012\":\"四怅虹电器股份有限公司\",\n" +
|
" \"590014\":\"\",\n" +
|
" \"590024\":\"成都京东世纪贸易有限公司\",\n" +
|
" \"600008\":\"\",\n" +
|
" \"610014\":\"\",\n" +
|
" \"620024\":\"20171111\",\n" +
|
" \"640003\":\"国家税务局监制\"\n" +
|
" },\n" +
|
" \"billKeyCode\":{\n" +
|
" \"Amount\":\"182.00\"\n" +
|
" },\n" +
|
" \"billKeyName\":{\n" +
|
" \"Amount\":\"182.00\"\n" +
|
" },\n" +
|
" \"billMasterCode\":{\n" +
|
"\n" +
|
" },\n" +
|
" \"billMasterName\":{\n" +
|
"\n" +
|
" },\n" +
|
" \"billModelCode\":\"B00000060000\",\n" +
|
" \"ignore\":false,\n" +
|
" \"ruleMsg\":[\n" +
|
"\n" +
|
" ]\n" +
|
" },\n" +
|
" {\n" +
|
" \"allotTenant\":true,\n" +
|
" \"billBodyEntityList\":[\n" +
|
" {\n" +
|
" \"billCode\":\"4f0a4048f6534c2e9d459caef3de932e\",\n" +
|
" \"billKeyCode\":{\n" +
|
" \"Amount\":\"39.90\"\n" +
|
" },\n" +
|
" \"billKeyName\":{\n" +
|
" \"Amount\":\"39.90\"\n" +
|
" },\n" +
|
" \"billMasterCode\":{\n" +
|
"\n" +
|
" },\n" +
|
" \"billMasterName\":{\n" +
|
"\n" +
|
" },\n" +
|
" \"billMoney\":0,\n" +
|
" \"bodyDataMap\":{\n" +
|
" \"500030\":\"办公用品\",\n" +
|
" \"560054\":\"39.90\"\n" +
|
" },\n" +
|
" \"ignore\":false\n" +
|
" }\n" +
|
" ],\n" +
|
" \"billCode\":\"1018500180900073-001-01\",\n" +
|
" \"billHeadMap\":{\n" +
|
" \"520040\":\"四川\",\n" +
|
" \"540040\":\"\",\n" +
|
" \"550025\":\"41888406\",\n" +
|
" \"550031\":\"\",\n" +
|
" \"550044\":\"\",\n" +
|
" \"550055\":\"91610139081030649M\",\n" +
|
" \"550099\":\"161011640110\",\n" +
|
" \"560133\":\"39.90\",\n" +
|
" \"560134\":\"39.9\",\n" +
|
" \"570001\":\"发票联\",\n" +
|
" \"580008\":\"\",\n" +
|
" \"590006\":\"四川西安国家税务局通用机打发票\",\n" +
|
" \"590010\":\"\",\n" +
|
" \"590012\":\"(个四川长虹电股份有限公司税\",\n" +
|
" \"590014\":\"\",\n" +
|
" \"590024\":\"西安华讯得贸易有限公司\",\n" +
|
" \"600008\":\"\",\n" +
|
" \"610014\":\"\",\n" +
|
" \"620024\":\"20171206\",\n" +
|
" \"640003\":\"国家税务局监制\"\n" +
|
" },\n" +
|
" \"billKeyCode\":{\n" +
|
" \"Amount\":\"39.90\"\n" +
|
" },\n" +
|
" \"billKeyName\":{\n" +
|
" \"Amount\":\"39.90\"\n" +
|
" },\n" +
|
" \"billMasterCode\":{\n" +
|
"\n" +
|
" },\n" +
|
" \"billMasterName\":{\n" +
|
"\n" +
|
" },\n" +
|
" \"billModelCode\":\"B00000060000\",\n" +
|
" \"ignore\":false,\n" +
|
" \"ruleMsg\":[\n" +
|
"\n" +
|
" ]\n" +
|
" }\n" +
|
"]", OCRBillHeaderEntity.class);
|
ParamIter paramIter = new ParamIter();
|
Field field =paramIter.getClass().getDeclaredField("billList");
|
field.setAccessible(true);
|
List<OCRBillHeaderEntity> bill = (List<OCRBillHeaderEntity>) field.get(paramIter);
|
bill.addAll(bills);
|
System.out.println(JSONTool.toJson(paramIter.getAllBillList()));
|
}
|
|
public static IParamIter<UnitInfo> getIParamIter(){
|
final List<UnitInfo> unitInfos = new ArrayList<>();
|
{
|
UnitInfo unitInfo = new UnitInfo();
|
unitInfo.setUnitInfoMdJoinAll(new HashSet<>(Arrays.asList(
|
new MasterInfo("F001","0001","1"),
|
new MasterInfo("F149","0001","2018-02-25", "FromDate"),
|
new MasterInfo("F006","0001","2018-02-25", "ToDate"),
|
new MasterInfo("F003","0001","300.4"),
|
new MasterInfo("F004","0001","-4"),
|
new MasterInfo("F005","0001","17741117360")
|
)));
|
unitInfo.setUnitInfo(unitInfo.getUnitInfoMdJoinAll());
|
unitInfos.add(unitInfo);
|
}
|
{
|
UnitInfo unitInfo = new UnitInfo();
|
unitInfo.setUnitInfoMdJoinAll(new HashSet<>(Arrays.asList(
|
new MasterInfo("F001","0001","2"),
|
new MasterInfo("F002","0001","2018-03-24"),
|
new MasterInfo("F003","0001","250"),
|
new MasterInfo("F004","0001","F01803"),
|
new MasterInfo("F005","0001","F00902")
|
)));
|
unitInfo.setUnitInfo(unitInfo.getUnitInfoMdJoinAll());
|
unitInfos.add(unitInfo);
|
}
|
{
|
UnitInfo unitInfo = new UnitInfo();
|
unitInfo.setUnitInfoMdJoinAll(new HashSet<>(Arrays.asList(
|
new MasterInfo("F001","0001","3"),
|
new MasterInfo("F002","0001","2018-04-24"),
|
new MasterInfo("F003","0001","500"),
|
new MasterInfo("F004","0001","F01804"),
|
new MasterInfo("F005","0001","F00903")
|
)));
|
unitInfo.setUnitInfo(unitInfo.getUnitInfoMdJoinAll());
|
unitInfos.add(unitInfo);
|
}
|
|
final UnitInfo unitInfo = unitInfos.get(0);
|
|
return new IParamIter<UnitInfo>() {
|
|
@Override
|
public IParamIter<UnitInfo> setDataSource(CountParamMax param, List<BillData> billList) {
|
return null;
|
}
|
|
@Override
|
public UnitInfo next() {
|
return null;
|
}
|
|
@Override
|
public Boolean hasNext() {
|
return null;
|
}
|
|
@Override
|
public UnitInfo current() {
|
return null;
|
}
|
|
@Override
|
public Set<IOCRBill> getNoJoinAllBillInfo() {
|
return null;
|
}
|
|
@Override
|
public Double getNoJoinAllBillTotalMoney() {
|
return null;
|
}
|
|
@Override
|
public List<UnitInfo> getOldUnitInfos() {
|
return unitInfos;
|
}
|
|
@Override
|
public UnitInfo getEachOldUnitInfo() {
|
return unitInfo;
|
}
|
|
@Override
|
public Map<Integer, List<IOCRBill>> getBillList() {
|
return new HashMap<>();
|
}
|
|
@Override
|
public List<RuleMsg> getRuleMsg() {
|
return new ArrayList<>();
|
}
|
|
@Override
|
public List<ErrSystemMsg> getErrSystemMsgs() {
|
return new ArrayList<>();
|
}
|
|
@Override
|
public List<IOCRBill> getAllBillList() {
|
return new ArrayList<>();
|
}
|
|
@Override
|
public String getBillType() {
|
return null;
|
}
|
|
};
|
}
|
}
|