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);
|
}
|
}
|