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