hjg
2023-11-18 bb48edb3d9faaaeab0088151c86fc24137acdb08
提交 | 用户 | 时间
58d006 1 package com.mandi.fendan.test;
A 2
3 import java.util.ArrayList;
4 import java.util.HashMap;
5 import java.util.List;
6 import java.util.Map;
7
8 import net.sf.json.JSONArray;
9
10 import org.apache.log4j.Logger;
11 import org.junit.Test;
12 import org.springframework.context.ApplicationContext;
13 import org.springframework.context.support.ClassPathXmlApplicationContext;
14
15 import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor;
16 import com.google.gson.JsonArray;
17 import com.google.gson.JsonObject;
18 import com.google.gson.JsonParser;
19 import com.mandi.basicconfig.persist.Ncfhdq;
20 import com.mandi.common.JSONobj;
21 import com.mandi.common.Jacksonmethod;
22 import com.mandi.common.ListSortUtil;
23 import com.mandi.common.Wxhtmethod;
24 import com.mandi.common.ParamFileter.RegexCheck;
25 import com.mandi.dao.common.ObjectResult;
26 import com.mandi.fendan.mapper.BusinessMapper;
27 import com.mandi.fendan.mapper.Fd_VehicleMapper;
28 import com.mandi.fendan.mapper.Fd_XSTDMXMapper;
29 import com.mandi.fendan.mapper.Fd_fhdqMapper;
30 import com.mandi.fendan.mapper.VehicleXSTDMapper;
31 import com.mandi.fendan.persist.Fd_Vehicle;
32 import com.mandi.fendan.persist.Fd_XSTDMX;
33 import com.mandi.fendan.persist.Vehicle_XSTD;
34 import com.mandi.fendan.service.impl.ErpService;
35 import com.mandi.fendan.service.impl.Fd_CompanyService;
36 import com.mandi.fendan.util.Contants;
37 import com.mandi.fendan.util.Runtest;
38 import com.mandi.fendan.util.SqlTxt;
39 import com.mandi.fendan.util.persist.Scxt_zcInfo;
40 import com.mandi.fendan.util.persist.Serviceenum;
41 import com.mandi.system.persist.Login;
42
43 public class Test12 {
44     private Logger log=Logger.getLogger(Test12.class);
45     ApplicationContext c=new ClassPathXmlApplicationContext("applicationcontext.xml");
46     BusinessMapper bnper=c.getBean(BusinessMapper.class);
47     Fd_VehicleMapper Fd_Vcper=c.getBean(Fd_VehicleMapper.class);
48     ErpService erpser=c.getBean(ErpService.class);
49     VehicleXSTDMapper vx=c.getBean(VehicleXSTDMapper.class);
50     Fd_XSTDMXMapper mxpers=c.getBean(Fd_XSTDMXMapper.class);
51     Fd_fhdqMapper dqper=c.getBean(Fd_fhdqMapper.class);
52     
53     
54     @Test
55     public void test_ccr(){
56         List<Ncfhdq> l=this.dqper.getLikebydqNo("11");
57         log.info(":::::::::::;;"+Jacksonmethod.tojson(l, false));
58     }
59     @Test
60     public void test_qx(){
61 //        log.info(RegexCheck.checkphone("13007607720"));
62         Login lg=new Login();
63         lg.setWorkerno("worker");
64         lg.setDepartno("016");
65         try {
66             erpser.delFdsheet(lg, "XS201904050005");
67         } catch (Exception e) {
68             // TODO Auto-generated catch block
69             e.printStackTrace();
70         }
71         
72     }
73     
74     
75     
76     @Test
77     public void test_arg(){
78         List<Fd_XSTDMX> l=this.mxpers.getlistA();
79         for (Fd_XSTDMX mx : l) {
80             String gg=mx.getTdmx_ggxh();
81             mx.setTdmx_ggxh(gg.split("\\*")[2]+"*"+gg.split("\\*")[1]+"*"+gg.split("\\*")[0]);
82             
83             this.mxpers.updateMXGG(mx);
84         }
85 //        List<String> ll=vx.getlistbyVehicleIdGp("豫J30829");
86 //        System.err.println("ll::::"+Jacksonmethod.tojson(ll, false));
87 //        List<Vehicle_XSTD> vxl=vx.getlistbyVehandcompanyNo("豫J30829", "011");
88 //        System.err.println("ll::::"+Jacksonmethod.tojson(vxl, false));
89 //        try {
90 //            erpser.testsave(null);
91 //        } catch (Exception e) {
92 //            try {
93 //                throw new Exception(e.getMessage());
94 //            } catch (Exception e1) {
95 //                e1.printStackTrace();
96 //            }
97 //        }
98     }
99     
100     
101     @Test
102     public void test_dg(){
103 //        log.info(RegexCheck.checkphone("13007607720"));
104         String bianhao="0102";
105         log.info(bianhao.substring(0, bianhao.length()-2));
106         
107     }
108     
109     
110     @Test
111     public void test_eo(){
112 //        Runtest tty=new Runtest("你好");
113 //        tty.run();
114 //        String zclist="";
115 //        try {
116 //            erpser.batchSaveZcInfo(zclist);
117 //        } catch (Exception e) {
118 //            // TODO Auto-generated catch block
119 //            e.printStackTrace();
120 //        }
121     }
122     
123     
124     
125     @Test
126     public void test_del(){
127         Map<String, Object> map=new HashMap<String, Object>();
128         map.put("companyNo", "001");
129         Fd_Vcper.getCompanyVehicle(map);
130     }
131     
132     
133     @Test
134     public void test_cg(){
135         Scxt_zcInfo zc=new Scxt_zcInfo();
136         zc.setCph("豫ATEST1");
137         zc.setCzy("管理员");
138         zc.setYktkh("6666555555");
139         
140         zc.setGgxh("0.02*450*10000");
141         zc.setJz(494.0);
142         zc.setMz(561.0);
143         zc.setPch("KJC1710X80303-2");
144         zc.setPz(561.0-494.0);
145         zc.setTdbh("KJTD-18010108");
146         zc.setTmh("123456");
147         
148         Scxt_zcInfo zc1=new Scxt_zcInfo();
149         zc1.setCph("豫ATEST1");
150         zc1.setCzy("管理员");
151         zc1.setYktkh("6666555555");
152         zc1.setTdbh("KJTD-18010108");
153         
154         zc1.setGgxh("0.02*450*8000");
155         zc1.setJz(797.0);
156         zc1.setMz(886.0);
157         zc1.setPch("KJC1710X80303-30");
158         zc1.setPz(886.0-797.0);
159         zc1.setTmh("345678");
160         
161         Scxt_zcInfo zc2=new Scxt_zcInfo();
162         zc2.setCph("豫ATEST1");
163         zc2.setCzy("管理员");
164         zc2.setYktkh("6666555555");
165         zc2.setTdbh("KJTD-18010108");
166         
167         zc2.setGgxh("0.02*450*8000");
168         zc2.setJz(803.0);
169         zc2.setMz(891.0);
170         zc2.setPch("KJC1712X80186-60");
171         zc2.setPz(891.0-803.0);
172         zc2.setTmh("234567");
173         List<Scxt_zcInfo> l=new ArrayList<Scxt_zcInfo>();
174         l.add(zc);
175         l.add(zc1);
176         l.add(zc2);
177         String str=Jacksonmethod.tojson(l, false);
178         log.info(str);
179         
180     }
181     
182     @Test
183     public void  test_sendmsg(){
184         JsonObject jo=new JsonObject();
185         jo.addProperty("name", "郭来权");
186         jo.addProperty("chehao", "豫ATest1");
187         jo.addProperty("number", "123456");
188 //        ObjectResult<String> orc=dyser.sendCode("13007607720" , jo);
189 //        log.info(Jacksonmethod.tojson(orc, false));
190     }
191     
192     
193     @Test
194     public void test_cc(){
195         Map<String, String> mm=new HashMap<String, String>();
196         String url="http://192.168.4.248/testc.htm";
197         List<Map<String, Object>> ll=new ArrayList<Map<String,Object>>();
198         Map<String, Object> m1=new HashMap<String, Object>();
199         m1.put("name", "1");
200         Map<String, Object> m2=new HashMap<String, Object>();
201         m2.put("name", "2");
202         Map<String, Object> m3=new HashMap<String, Object>();
203         m3.put("name", "3");
204         ll.add(m1);
205         ll.add(m2);
206         ll.add(m3);
207 //        JSONArray ja=JSONArray.fromObject(ll);
208         String str=Jacksonmethod.tojson(ll, false);
209         log.info(str);
210         mm.put("cc",str);
211         log.info(mm);
212         Wxhtmethod.postJson(url, mm);
213     }
214     
215     
216     @Test
217     public void test_bsmaper(){
218         Map<String, Object> mm=bnper.getbsbyBt("豫C555555", Contants.cpxsBtNo, Serviceenum.在办, "04");
219         log.info(Jacksonmethod.tojson(mm, false));
220     }
221     @Test
222     public void test(){
223         ApplicationContext c=new ClassPathXmlApplicationContext("applicationcontext.xml");
224         Fd_CompanyService msdao=c.getBean(Fd_CompanyService.class);
225 //        msdao.open("jdbc:jtds:sqlserver://125.46.81.106:1433;databaseName=goblin_test", "goblin", "goblin_2017");
226         try {
227             log.info(Jacksonmethod.tojson(msdao.get("54665"), true));
228         } catch (Exception e) {
229             // TODO Auto-generated catch block
230             e.printStackTrace();
231         }
232
233     }
234     
235     
236     @Test
237     public void testlist(){
238 //        ApplicationContext c=new ClassPathXmlApplicationContext("applicationcontext.xml");
239 //        MSSQLDao mdao=c.getBean(MSSQLDao.class);
240 //        String sql=SqlTxt.countGYErpXSTDsql;
241 //        String url="jdbc:jtds:sqlserver://125.46.81.106:1433;databaseName=cwbase5";
242 //        String username="lc0059999";
243 //        String pwd="aaaaaa";
244 //        mdao.open(url, username, pwd);
245 //        List<List<Object>> m_l=new ArrayList<List<Object>>();
246 //        List<Object> m_l_l1=new ArrayList<Object>();
247 //        m_l_l1.add("豫ABcdef");
248 //        m_l_l1.add("GFC1706N80075-1");
249 //        List<Object> m_l_l2=new ArrayList<Object>();
250 //        m_l_l2.add("豫ABcdef");
251 //        m_l_l2.add("GFC1706N80075-2");
252 //        m_l.add(m_l_l1);
253 //        m_l.add(m_l_l2);
254 //        try {
255 ////            mdao.saveMapsnoclose(sql, m_l);
256 //        } catch (Exception e) {
257 //            // TODO Auto-generated catch block
258 //            e.printStackTrace();
259 //        }
260 //        mdao.close();
261         
262         JsonParser jp=new JsonParser();
263         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\"}";
264         JsonObject vjo=jp.parse(vehicleInfo).getAsJsonObject();
265         Fd_Vehicle fdv=new Fd_Vehicle();
266         fdv=JSONobj.getobj(vjo, fdv);
267     }
268 }