|
|
package com.tianbo.controller.fendan;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import com.tianbo.model.ManifestLoad;
|
|
|
import com.tianbo.model.Originmanifestmaster;
|
|
|
import com.tianbo.model.Originmanifestsecondary;
|
|
|
import com.tianbo.service.FenDanService;
|
|
|
import com.tianbo.service.LostService;
|
|
|
import com.tianbo.util.DateUtils;
|
|
|
import com.tianbo.util.json.AjaxJson;
|
|
|
import com.tianbo.util.json.JsonConversion;
|
|
|
|
|
|
@Controller
|
|
|
public class FenDanController {
|
|
|
|
|
|
@Autowired
|
|
|
private FenDanService fendanService;
|
|
|
|
|
|
@RequestMapping("/fendan")
|
|
|
public String fendao(ModelMap model, HttpServletRequest request) {
|
|
|
return "fendan/fendanlist";
|
|
|
}
|
|
|
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "fendanList")
|
|
|
public String getList(HttpServletRequest request, int page, int limit) {
|
|
|
int start = (page - 1) * limit + 1;
|
|
|
int end = page * limit;
|
|
|
List<Originmanifestmaster> lost = fendanService.getList(start, end);
|
|
|
System.out.println(lost.size());
|
|
|
Originmanifestmaster ft = new Originmanifestmaster();
|
|
|
int count = fendanService.FendanCount(ft);
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
if (!lost.isEmpty()) {
|
|
|
map.put("code", 0);
|
|
|
map.put("count", count);
|
|
|
map.put("msg", "success");
|
|
|
map.put("data", lost);
|
|
|
} else {
|
|
|
map.put("code", -1);
|
|
|
map.put("msg", "请检查网络连接或重试");
|
|
|
map.put("data", "");
|
|
|
}
|
|
|
return JsonConversion.writeMapJSON(map);
|
|
|
}
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "fendanList2")
|
|
|
public String getList2(HttpServletRequest request, int page, int limit) {
|
|
|
int start = (page - 1) * limit + 1;
|
|
|
int end = page * limit;
|
|
|
List<Originmanifestmaster> lost = fendanService.getListfd(start, end);
|
|
|
System.out.println(lost.size());
|
|
|
Originmanifestmaster ft = new Originmanifestmaster();
|
|
|
int count = fendanService.FendanCount1(ft);
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
if (!lost.isEmpty()) {
|
|
|
map.put("code", 0);
|
|
|
map.put("count", count);
|
|
|
map.put("msg", "success");
|
|
|
map.put("data", lost);
|
|
|
} else {
|
|
|
map.put("code", -1);
|
|
|
map.put("msg", "请检查网络连接或重试");
|
|
|
map.put("data", "");
|
|
|
}
|
|
|
return JsonConversion.writeMapJSON(map);
|
|
|
}
|
|
|
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "fendanselectByParam")
|
|
|
public String selectByParam(HttpServletRequest request,int page,int limit,String waybillnomaster,String flightno,String flightdate){
|
|
|
int start = (page-1)*limit+1;
|
|
|
int end = page*limit;
|
|
|
System.out.println(flightdate);
|
|
|
List<Originmanifestmaster> lost = fendanService.fdselectByParam(start,end,waybillnomaster,flightno,flightdate);
|
|
|
Originmanifestmaster fs = new Originmanifestmaster();
|
|
|
fs.setWaybillnomaster(waybillnomaster);
|
|
|
fs.setFlightno(flightno);
|
|
|
int count = fendanService.FendanCount1(fs);
|
|
|
System.out.println(count);
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
if(!lost.isEmpty()){
|
|
|
map.put("code", 0);
|
|
|
map.put("count", count);
|
|
|
map.put("msg", "success");
|
|
|
map.put("data", lost);
|
|
|
}else {
|
|
|
map.put("code", -1);
|
|
|
map.put("msg", "无此条件信息");
|
|
|
map.put("data", "");
|
|
|
}
|
|
|
return JsonConversion.writeMapJSON(map);
|
|
|
}
|
|
|
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "fendanselectByParam2")
|
|
|
public String selectByParam2(HttpServletRequest request,int page,int limit,String waybillnomaster,String flightno,String flightdate){
|
|
|
int start = (page-1)*limit+1;
|
|
|
int end = page*limit;
|
|
|
System.out.println(flightdate);
|
|
|
List<Originmanifestmaster> lost = fendanService.fdselectByParam1(start,end,flightno,flightdate);
|
|
|
Originmanifestmaster fs = new Originmanifestmaster();
|
|
|
fs.setFlightno(flightno);
|
|
|
System.out.println(flightdate);
|
|
|
fs.setFlightDate(flightdate);
|
|
|
int count = fendanService.FendanCount(fs);
|
|
|
System.out.println(count);
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
if(!lost.isEmpty()){
|
|
|
map.put("code", 0);
|
|
|
map.put("count", count);
|
|
|
map.put("msg", "success");
|
|
|
map.put("data", lost);
|
|
|
}else {
|
|
|
map.put("code", -1);
|
|
|
map.put("msg", "无此条件信息");
|
|
|
map.put("data", "");
|
|
|
}
|
|
|
return JsonConversion.writeMapJSON(map);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 挂分担
|
|
|
* @param fendanupdate
|
|
|
* @param list
|
|
|
* @return
|
|
|
*/
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "fendanupdate", method = RequestMethod.POST)
|
|
|
public AjaxJson fendanupdate(HttpServletRequest request,@RequestBody List<Originmanifestmaster> list) {
|
|
|
String message = null;
|
|
|
AjaxJson j = new AjaxJson();
|
|
|
|
|
|
try {
|
|
|
//循环json数组
|
|
|
List<Originmanifestmaster> listone=list; for (Originmanifestmaster
|
|
|
originmanifestmaster : listone) {
|
|
|
String autoid=originmanifestmaster.getAutoid();
|
|
|
String waybillnomaster=originmanifestmaster.getWaybillnomaster();
|
|
|
Originmanifestsecondary oy=new Originmanifestsecondary();
|
|
|
oy.setOriginmanifestmasterautoid(autoid);
|
|
|
oy.setWaybillnomaster(waybillnomaster);
|
|
|
fendanService.updatefendan(oy);
|
|
|
System.out.println(originmanifestmaster.getAutoid());
|
|
|
}
|
|
|
j.setSuccess(true);
|
|
|
message = "修改状态成功";
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
j.setSuccess(false);
|
|
|
message = "修改状态失败";
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
j.setMsg(message);
|
|
|
return j;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 删除
|
|
|
* @param fendanupdate
|
|
|
* @param list
|
|
|
* @return
|
|
|
*/
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "felfd", method = RequestMethod.POST)
|
|
|
public AjaxJson delfd(HttpServletRequest request,@RequestBody List<Originmanifestmaster> list) {
|
|
|
String message = null;
|
|
|
System.out.println("---------"+list);
|
|
|
AjaxJson j = new AjaxJson();
|
|
|
|
|
|
try {
|
|
|
//循环json数组
|
|
|
|
|
|
List<Originmanifestmaster> listone=list; for (Originmanifestmaster
|
|
|
originmanifestmaster : listone) {
|
|
|
String autoid=originmanifestmaster.getAutoid();
|
|
|
String waybillnomaster=originmanifestmaster.getWaybillnomaster();
|
|
|
String param=originmanifestmaster.getParam();
|
|
|
Originmanifestsecondary oy=new Originmanifestsecondary();
|
|
|
oy.setOriginmanifestmasterautoid(autoid);
|
|
|
oy.setWaybillnomaster(waybillnomaster);
|
|
|
oy.setWaybillnosecondary(param);
|
|
|
fendanService.delfd(oy);
|
|
|
System.out.println(originmanifestmaster.getAutoid());
|
|
|
}
|
|
|
j.setSuccess(true);
|
|
|
message = "删除状态成功";
|
|
|
|
|
|
}catch (Exception e) {
|
|
|
j.setSuccess(false);
|
|
|
message = "删除状态失败";
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
j.setMsg(message);
|
|
|
return j;
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value ="edit")
|
|
|
public String edit(ModelMap model,HttpServletRequest request) {
|
|
|
model.put("ftId", request.getParameter("id"));
|
|
|
return "fendan/edit";
|
|
|
}
|
|
|
/**
|
|
|
* 编辑或新增
|
|
|
* @param lost
|
|
|
* @param redirectAttributes
|
|
|
* @return
|
|
|
*/
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "upeditForm")
|
|
|
public AjaxJson upeditForm(ModelMap model,HttpServletRequest request) {
|
|
|
|
|
|
String flightdate = request.getParameter("flightdate");
|
|
|
String oldflightdate = request.getParameter("id");
|
|
|
String flightno = request.getParameter("flyno");
|
|
|
System.out.println(oldflightdate);
|
|
|
String message = null;
|
|
|
AjaxJson j = new AjaxJson();
|
|
|
|
|
|
try {
|
|
|
Originmanifestmaster or=new Originmanifestmaster();
|
|
|
or.setFlightDate(flightdate);
|
|
|
or.setParam(oldflightdate);
|
|
|
or.setFlightno(flightno);
|
|
|
System.out.println("++++++++++++++"+or.getFlightDate());
|
|
|
/* lostService.saveorupdate(manifest); */
|
|
|
fendanService.updateriqi(or);
|
|
|
System.out.println(flightdate);
|
|
|
j.setSuccess(true);
|
|
|
message = "修改成功";
|
|
|
} catch (Exception e) {
|
|
|
j.setSuccess(false);
|
|
|
message = "修改失败";
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
j.setMsg(message);
|
|
|
return j;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|