package com.mandi.fendan.test;
|
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
import net.sf.json.JSONArray;
|
|
import org.apache.log4j.Logger;
|
import org.junit.Test;
|
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor;
|
import com.google.gson.JsonArray;
|
import com.google.gson.JsonObject;
|
import com.google.gson.JsonParser;
|
import com.mandi.basicconfig.persist.Ncfhdq;
|
import com.mandi.common.JSONobj;
|
import com.mandi.common.Jacksonmethod;
|
import com.mandi.common.ListSortUtil;
|
import com.mandi.common.Wxhtmethod;
|
import com.mandi.common.ParamFileter.RegexCheck;
|
import com.mandi.dao.common.ObjectResult;
|
import com.mandi.fendan.mapper.BusinessMapper;
|
import com.mandi.fendan.mapper.Fd_VehicleMapper;
|
import com.mandi.fendan.mapper.Fd_XSTDMXMapper;
|
import com.mandi.fendan.mapper.Fd_fhdqMapper;
|
import com.mandi.fendan.mapper.VehicleXSTDMapper;
|
import com.mandi.fendan.persist.Fd_Vehicle;
|
import com.mandi.fendan.persist.Fd_XSTDMX;
|
import com.mandi.fendan.persist.Vehicle_XSTD;
|
import com.mandi.fendan.service.impl.ErpService;
|
import com.mandi.fendan.service.impl.Fd_CompanyService;
|
import com.mandi.fendan.util.Contants;
|
import com.mandi.fendan.util.Runtest;
|
import com.mandi.fendan.util.SqlTxt;
|
import com.mandi.fendan.util.persist.Scxt_zcInfo;
|
import com.mandi.fendan.util.persist.Serviceenum;
|
import com.mandi.system.persist.Login;
|
|
public class Test12 {
|
private Logger log=Logger.getLogger(Test12.class);
|
ApplicationContext c=new ClassPathXmlApplicationContext("applicationcontext.xml");
|
BusinessMapper bnper=c.getBean(BusinessMapper.class);
|
Fd_VehicleMapper Fd_Vcper=c.getBean(Fd_VehicleMapper.class);
|
ErpService erpser=c.getBean(ErpService.class);
|
VehicleXSTDMapper vx=c.getBean(VehicleXSTDMapper.class);
|
Fd_XSTDMXMapper mxpers=c.getBean(Fd_XSTDMXMapper.class);
|
Fd_fhdqMapper dqper=c.getBean(Fd_fhdqMapper.class);
|
|
|
@Test
|
public void test_ccr(){
|
List<Ncfhdq> l=this.dqper.getLikebydqNo("11");
|
log.info(":::::::::::;;"+Jacksonmethod.tojson(l, false));
|
}
|
@Test
|
public void test_qx(){
|
// log.info(RegexCheck.checkphone("13007607720"));
|
Login lg=new Login();
|
lg.setWorkerno("worker");
|
lg.setDepartno("016");
|
try {
|
erpser.delFdsheet(lg, "XS201904050005");
|
} catch (Exception e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
|
}
|
|
|
|
@Test
|
public void test_arg(){
|
List<Fd_XSTDMX> l=this.mxpers.getlistA();
|
for (Fd_XSTDMX mx : l) {
|
String gg=mx.getTdmx_ggxh();
|
mx.setTdmx_ggxh(gg.split("\\*")[2]+"*"+gg.split("\\*")[1]+"*"+gg.split("\\*")[0]);
|
|
this.mxpers.updateMXGG(mx);
|
}
|
// List<String> ll=vx.getlistbyVehicleIdGp("豫J30829");
|
// System.err.println("ll::::"+Jacksonmethod.tojson(ll, false));
|
// List<Vehicle_XSTD> vxl=vx.getlistbyVehandcompanyNo("豫J30829", "011");
|
// System.err.println("ll::::"+Jacksonmethod.tojson(vxl, false));
|
// try {
|
// erpser.testsave(null);
|
// } catch (Exception e) {
|
// try {
|
// throw new Exception(e.getMessage());
|
// } catch (Exception e1) {
|
// e1.printStackTrace();
|
// }
|
// }
|
}
|
|
|
@Test
|
public void test_dg(){
|
// log.info(RegexCheck.checkphone("13007607720"));
|
String bianhao="0102";
|
log.info(bianhao.substring(0, bianhao.length()-2));
|
|
}
|
|
|
@Test
|
public void test_eo(){
|
// Runtest tty=new Runtest("你好");
|
// tty.run();
|
// String zclist="";
|
// try {
|
// erpser.batchSaveZcInfo(zclist);
|
// } catch (Exception e) {
|
// // TODO Auto-generated catch block
|
// e.printStackTrace();
|
// }
|
}
|
|
|
|
@Test
|
public void test_del(){
|
Map<String, Object> map=new HashMap<String, Object>();
|
map.put("companyNo", "001");
|
Fd_Vcper.getCompanyVehicle(map);
|
}
|
|
|
@Test
|
public void test_cg(){
|
Scxt_zcInfo zc=new Scxt_zcInfo();
|
zc.setCph("豫ATEST1");
|
zc.setCzy("管理员");
|
zc.setYktkh("6666555555");
|
|
zc.setGgxh("0.02*450*10000");
|
zc.setJz(494.0);
|
zc.setMz(561.0);
|
zc.setPch("KJC1710X80303-2");
|
zc.setPz(561.0-494.0);
|
zc.setTdbh("KJTD-18010108");
|
zc.setTmh("123456");
|
|
Scxt_zcInfo zc1=new Scxt_zcInfo();
|
zc1.setCph("豫ATEST1");
|
zc1.setCzy("管理员");
|
zc1.setYktkh("6666555555");
|
zc1.setTdbh("KJTD-18010108");
|
|
zc1.setGgxh("0.02*450*8000");
|
zc1.setJz(797.0);
|
zc1.setMz(886.0);
|
zc1.setPch("KJC1710X80303-30");
|
zc1.setPz(886.0-797.0);
|
zc1.setTmh("345678");
|
|
Scxt_zcInfo zc2=new Scxt_zcInfo();
|
zc2.setCph("豫ATEST1");
|
zc2.setCzy("管理员");
|
zc2.setYktkh("6666555555");
|
zc2.setTdbh("KJTD-18010108");
|
|
zc2.setGgxh("0.02*450*8000");
|
zc2.setJz(803.0);
|
zc2.setMz(891.0);
|
zc2.setPch("KJC1712X80186-60");
|
zc2.setPz(891.0-803.0);
|
zc2.setTmh("234567");
|
List<Scxt_zcInfo> l=new ArrayList<Scxt_zcInfo>();
|
l.add(zc);
|
l.add(zc1);
|
l.add(zc2);
|
String str=Jacksonmethod.tojson(l, false);
|
log.info(str);
|
|
}
|
|
@Test
|
public void test_sendmsg(){
|
JsonObject jo=new JsonObject();
|
jo.addProperty("name", "郭来权");
|
jo.addProperty("chehao", "豫ATest1");
|
jo.addProperty("number", "123456");
|
// ObjectResult<String> orc=dyser.sendCode("13007607720" , jo);
|
// log.info(Jacksonmethod.tojson(orc, false));
|
}
|
|
|
@Test
|
public void test_cc(){
|
Map<String, String> mm=new HashMap<String, String>();
|
String url="http://192.168.4.248/testc.htm";
|
List<Map<String, Object>> ll=new ArrayList<Map<String,Object>>();
|
Map<String, Object> m1=new HashMap<String, Object>();
|
m1.put("name", "1");
|
Map<String, Object> m2=new HashMap<String, Object>();
|
m2.put("name", "2");
|
Map<String, Object> m3=new HashMap<String, Object>();
|
m3.put("name", "3");
|
ll.add(m1);
|
ll.add(m2);
|
ll.add(m3);
|
// JSONArray ja=JSONArray.fromObject(ll);
|
String str=Jacksonmethod.tojson(ll, false);
|
log.info(str);
|
mm.put("cc",str);
|
log.info(mm);
|
Wxhtmethod.postJson(url, mm);
|
}
|
|
|
@Test
|
public void test_bsmaper(){
|
Map<String, Object> mm=bnper.getbsbyBt("豫C555555", Contants.cpxsBtNo, Serviceenum.在办, "04");
|
log.info(Jacksonmethod.tojson(mm, false));
|
}
|
@Test
|
public void test(){
|
ApplicationContext c=new ClassPathXmlApplicationContext("applicationcontext.xml");
|
Fd_CompanyService msdao=c.getBean(Fd_CompanyService.class);
|
// msdao.open("jdbc:jtds:sqlserver://125.46.81.106:1433;databaseName=goblin_test", "goblin", "goblin_2017");
|
try {
|
log.info(Jacksonmethod.tojson(msdao.get("54665"), true));
|
} catch (Exception e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
|
}
|
|
|
@Test
|
public void testlist(){
|
// ApplicationContext c=new ClassPathXmlApplicationContext("applicationcontext.xml");
|
// MSSQLDao mdao=c.getBean(MSSQLDao.class);
|
// String sql=SqlTxt.countGYErpXSTDsql;
|
// String url="jdbc:jtds:sqlserver://125.46.81.106:1433;databaseName=cwbase5";
|
// String username="lc0059999";
|
// String pwd="aaaaaa";
|
// mdao.open(url, username, pwd);
|
// List<List<Object>> m_l=new ArrayList<List<Object>>();
|
// List<Object> m_l_l1=new ArrayList<Object>();
|
// m_l_l1.add("豫ABcdef");
|
// m_l_l1.add("GFC1706N80075-1");
|
// List<Object> m_l_l2=new ArrayList<Object>();
|
// m_l_l2.add("豫ABcdef");
|
// m_l_l2.add("GFC1706N80075-2");
|
// m_l.add(m_l_l1);
|
// m_l.add(m_l_l2);
|
// try {
|
//// mdao.saveMapsnoclose(sql, m_l);
|
// } catch (Exception e) {
|
// // TODO Auto-generated catch block
|
// e.printStackTrace();
|
// }
|
// mdao.close();
|
|
JsonParser jp=new JsonParser();
|
String vehicleInfo= "{\"phone\":\"13007607720\",\"fdCnum\":18,\"vehicleId\":\"豫NTEST4\",\"status\":\"未配车\",\"IDNum\":\"41140319901225655\",\"state\":true,\"companyNo\":\"008\",\"type\":\"公司车\",\"loadweight\":0,\"id\":\"66195228-92ac-4d8d-a3b2-db58fc6139d5\",\"vehicleweight\":0,\"fdCweight\":0,\"driver\":\"测试\",\"feature\":null,\"fdweight\":0,\"note\":null,\"fdnum\":0,\"indx\":\"0\",\"lastweight\":\"0.000\"}";
|
JsonObject vjo=jp.parse(vehicleInfo).getAsJsonObject();
|
Fd_Vehicle fdv=new Fd_Vehicle();
|
fdv=JSONobj.getobj(vjo, fdv);
|
}
|
}
|