Administrator
2023-04-19 eeb08a586132f489c10e12551c6479b13c9def5e
提交 | 用户 | 时间
58d006 1 package com.mandi.fendan.util;
A 2
3 import java.util.ArrayList;
4 import java.util.Date;
5 import java.util.HashMap;
6 import java.util.List;
7 import java.util.Map;
8
9 import javax.annotation.Resource;
10
11 import org.apache.commons.lang3.StringUtils;
12 import org.springframework.stereotype.Service;
13
14 import com.mandi.basicconfig.mapper.NczsjMapper;
15 import com.mandi.basicconfig.persist.Nccrklx;
16 import com.mandi.common.BasicMethod;
17 import com.mandi.common.Jacksonmethod;
18 import com.mandi.fendan.persist.Fd_XSTD;
19 import com.mandi.fendan.persist.Fd_XSTDMX;
20
21 /**
22  * 分单回传Nc数据
23  *
24  */
25 @Service
26 public class FdtoNc {
27     
28     @Resource
29     private NczsjMapper zsjper;
30     
31     public String getNcdata(List<Fd_XSTD> tdl,Map<String, List<Fd_XSTDMX>> mxMp){
32         List<Map<String, Object>> ncrlist=new ArrayList<Map<String,Object>>();
33         Map<String, Object> ccr=new HashMap<String, Object>();
34         
35         Map<String, Object> ncmm=new HashMap<String, Object>();
36         ncmm.put("syscode", "sc");
37         ncmm.put("async", "false");
38         ncmm.put("datasource", Contants.NCds_name);
39         ncmm.put("usercode", Contants.NCuser_code);
40         ncmm.put("groupcode", Contants.Ncgroup_code);
41         ncmm.put("methodname", Contants.NCmethod_name);
42         ncmm.put("ts", BasicMethod.getNow(null, null));
43         
44         List<Map<String, Object>> datalist=new ArrayList<Map<String,Object>>();
45         for (Fd_XSTD tdf : tdl) {
46             Map<String, Object> mm1=new HashMap<String, Object>();
47             Map<String, Object> headmp=new HashMap<String, Object>();
48             headmp.put("hid", tdf.getTd_tdls());
49             Nccrklx crklx=this.zsjper.getNcjylxbycode(tdf.getTd_jylx());
50             if(crklx!=null)
51                 headmp.put("pk_billtypeid", crklx.getPkid());
52             headmp.put("vdef4", tdf.getTd_wfdsl());
53             headmp.put("vdef5", tdf.getTd_wfdzl());
54             mm1.put("head", headmp);
55             List<Map<String, Object>> bodylist=new ArrayList<Map<String,Object>>();
56             List<Fd_XSTDMX> mxrll=mxMp.get(tdf.getTd_tdbh());
57             for (Fd_XSTDMX mx : mxrll) {
58                 Map<String, Object> bodymm=new HashMap<String, Object>();
59                 bodymm.put("hid", mx.getTdmx_tdls());
60                 bodymm.put("bid", mx.getTdmx_tdfl());
61                 bodymm.put("vbdef5",StringUtils.isBlank(mx.getTdmx_fdcph())?"N":"Y");
62                 bodymm.put("vbdef7",mx.getTdmx_fdcph());
63 //                bodymm.put("vbdef8",null);
64 //                bodymm.put("vbdef8", fdv.getDriver()+"/"+fdv.getPhone());
65                 bodylist.add(bodymm);
66             }
67             mm1.put("body", bodylist);
68             if(bodylist!=null&&bodylist.size()>0){
69                 datalist.add(mm1);
70             }
71         }
72         ncmm.put("data", datalist);
73         ccr.put("json", ncmm);
74         ncrlist.add(ccr);
75         return Jacksonmethod.tojson(ncrlist, false);
76     }
77 }