package com.mandi.fendan.controller;
|
|
import java.util.List;
|
import java.util.Map;
|
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import com.mandi.common.Jacksonmethod;
|
import com.mandi.common.RequestParam;
|
import com.mandi.common.SessionMethod;
|
import com.mandi.dao.common.ObjectResult;
|
import com.mandi.dao.common.PageRequest;
|
import com.mandi.dao.common.PageResult;
|
import com.mandi.fendan.mapper.Fd_fhdqMapper;
|
import com.mandi.fendan.persist.Fd_Company;
|
import com.mandi.fendan.service.IAreaService;
|
import com.mandi.fendan.service.IFd_fhdqService;
|
|
/**
|
* 发货地区controller
|
*
|
*/
|
@Controller("fd_areacontroller")
|
@RequestMapping(value="/area",method={RequestMethod.POST})
|
public class Fd_AreaController {
|
|
@Resource
|
private IAreaService arser;
|
@Resource
|
private IFd_fhdqService fhdqser;
|
@Resource
|
private Fd_fhdqMapper dqper;
|
|
/**
|
* 获取发货地址列表
|
* @param r
|
* @param re
|
* @return
|
*/
|
@RequestMapping(value = "/getList.htm", method = {RequestMethod.POST })
|
@ResponseBody
|
public String getList(HttpServletRequest r,HttpServletResponse re){
|
String search=RequestParam.getSqlString(r, "search");
|
int state=RequestParam.getInt(r, "state");
|
int page=RequestParam.getInt(r, "page");
|
int pagesize=RequestParam.getInt(r, "pagesize");
|
int pages=RequestParam.getInt(r, "pages");
|
PageRequest pr=new PageRequest(page, pagesize, null);
|
pr.setNeedPages(pages>0?true:false);
|
PageResult<Map<String, Object>> prr=fhdqser.getList(pr, search, state);
|
String str=Jacksonmethod.tojson(prr, false);
|
SessionMethod.writeresp(re, str);
|
return null;
|
}
|
|
/**
|
* 获得所有的物流公司
|
* @param r
|
* @param re
|
* @return
|
*/
|
@RequestMapping(value = "/getallCMlist.htm", method = {RequestMethod.POST })
|
@ResponseBody
|
public String getallcmList(HttpServletRequest r,HttpServletResponse re){
|
PageResult<Fd_Company> prr=arser.getallcmList();
|
String str=Jacksonmethod.tojson(prr, false);
|
SessionMethod.writeresp(re, str);
|
return null;
|
}
|
|
/**
|
* 保存配货地址及物流公司关系表
|
* @param r
|
* @param re
|
* @return
|
*/
|
@RequestMapping(value = "/saveItem.htm", method = {RequestMethod.POST })
|
@ResponseBody
|
public String saveItem(HttpServletRequest r,HttpServletResponse re){
|
//GLXJ //是否修改下级
|
//物流公司编号 companyNos
|
// code 地区编号
|
String fhdqNo =RequestParam.getSqlString(r, "code");//发货地区编号
|
String wlgsNos =RequestParam.getSqlString(r, "companyNos");//物流公司编号 物流公司1,物流公司2
|
String ywdyNo =RequestParam.getSqlString(r, "ywdyNo");//物流公司编号 物流公司1,物流公司2
|
boolean xgxj=RequestParam.getBool(r, "GLXJ");
|
ObjectResult<Boolean> or=new ObjectResult<Boolean>();
|
try {
|
or=this.fhdqser.savewlgs_fhdq(fhdqNo, wlgsNos,ywdyNo,xgxj);
|
} catch (Exception e) {
|
e.printStackTrace();
|
or.setCode(1);
|
or.setErrmsg(e.getMessage());
|
}
|
String str=Jacksonmethod.tojson(or, false);
|
SessionMethod.writeresp(re, str);
|
return null;
|
}
|
|
|
// /**
|
// * 保存配货地址及物流公司关系表
|
// * @param r
|
// * @param re
|
// * @return
|
// */
|
// @RequestMapping(value = "/saveItem.htm", method = {RequestMethod.POST })
|
// @ResponseBody
|
// public String saveItem(HttpServletRequest r,HttpServletResponse re){
|
// String name =RequestParam.getSqlString(r, "name");//名字
|
// String bianhao =RequestParam.getSqlString(r, "bianhao");//编号
|
// int jishu =RequestParam.getInt(r, "jishu");//级数
|
// String companyNos =RequestParam.getSqlString(r, "companyNos");//物流公司
|
// boolean GLXJ=RequestParam.getBool(r, "GLXJ");//关联操作下级地区
|
// ObjectResult<Boolean> or=new ObjectResult<Boolean>();
|
// try {
|
// or=arser.saveItem(name, bianhao, jishu, companyNos,GLXJ);
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// or.setCode(1);
|
// or.setErrmsg(e.getMessage());
|
// }
|
// String str=Jacksonmethod.tojson(or, false);
|
// SessionMethod.writeresp(re, str);
|
// return null;
|
// }
|
|
|
// /**
|
// * 删除配货地址及物流公司关系表
|
// * @param r
|
// * @param re
|
// * @return
|
// */
|
// @RequestMapping(value = "/delItem.htm", method = {RequestMethod.POST })
|
// @ResponseBody
|
// public String delItem(HttpServletRequest r,HttpServletResponse re){
|
// String bianhao =RequestParam.getSqlString(r, "bianhao");//编号
|
// ObjectResult<Boolean> or=new ObjectResult<Boolean>();
|
// try {
|
// or=arser.delItem(bianhao);
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// or.setCode(1);
|
// or.setErrmsg(e.getMessage());
|
// }
|
// String str=Jacksonmethod.tojson(or, false);
|
// SessionMethod.writeresp(re, str);
|
// return null;
|
// }
|
|
/**
|
* 获得配货地址及物流公司
|
* @param r
|
* @param re
|
* @return
|
*/
|
@RequestMapping(value = "/getcmList.htm", method = {RequestMethod.POST })
|
@ResponseBody
|
public String getcmList(HttpServletRequest r,HttpServletResponse re){
|
String bianhao =RequestParam.getSqlString(r, "bianhao");//编号
|
String ywdyNo =RequestParam.getSqlString(r, "ywdyNo");//业务单元
|
List<Fd_Company> cl=this.dqper.getCbyNo(bianhao,ywdyNo);
|
ObjectResult<String> or=new ObjectResult<String>();
|
String resl="";
|
if(cl!=null){
|
for (Fd_Company fd_Company : cl) {
|
if(StringUtils.isNotBlank(resl)){
|
resl+=","+fd_Company.getCompanyNo();
|
}else{
|
resl+=fd_Company.getCompanyNo();
|
}
|
}
|
}
|
or.setCode(0);
|
or.setItem(resl);
|
String str=Jacksonmethod.tojson(or, false);
|
SessionMethod.writeresp(re, str);
|
return null;
|
}
|
}
|