...
|
...
|
@@ -11,11 +11,9 @@ import javax.servlet.http.HttpServletRequest; |
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.Model;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import com.agent.controller.BasicController;
|
|
|
import com.agent.entity.agent.BillCheckEntity;
|
|
|
import com.agent.entity.agent.MakeHawbEntity;
|
|
|
import com.agent.entity.agent.MakeMawbEntity;
|
|
|
import com.agent.entity.agent.PubStationEntity;
|
...
|
...
|
@@ -24,7 +22,6 @@ import com.agent.service.agent.BillCheckService; |
|
|
import com.agent.service.agent.MakeHawbService;
|
|
|
import com.agent.service.agent.MakeMawbService;
|
|
|
import com.agent.service.agent.PubStationService;
|
|
|
import com.agent.util.HttpJsonMsg;
|
|
|
import com.agent.vo.ResponseModel;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.framework.util.DateFormat;
|
...
|
...
|
@@ -38,193 +35,117 @@ import tools.DataSerieal; |
|
|
|
|
|
/**
|
|
|
* 账单核审
|
|
|
*
|
|
|
* @author 61004
|
|
|
*
|
|
|
*/
|
|
|
@Controller
|
|
|
@RequestMapping(value = "/billcheck")
|
|
|
public class BillCheckController extends BasicController{
|
|
|
|
|
|
public class BillCheckController extends BasicController {
|
|
|
|
|
|
@Resource
|
|
|
private PubStationService stationService;
|
|
|
|
|
|
@Resource
|
|
|
private BillCheckService billCheckService;
|
|
|
|
|
|
@Resource
|
|
|
private MakeMawbService makeMawbService;
|
|
|
|
|
|
@Resource
|
|
|
private PubStationService stationService;
|
|
|
|
|
|
@Resource
|
|
|
private BillCheckService billCheckService;
|
|
|
|
|
|
@Resource
|
|
|
private MakeMawbService makeMawbService;
|
|
|
|
|
|
@Resource
|
|
|
private MakeHawbService makeHawbService;
|
|
|
|
|
|
@Resource
|
|
|
private BasicAgentService agentService;
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/list")
|
|
|
public String list(Model model) {
|
|
|
//交运货站
|
|
|
List<PubStationEntity> stations = stationService.findAll();
|
|
|
Date date = new Date();
|
|
|
model.addAttribute("stations",stations);
|
|
|
model.addAttribute("dateModel",DateFormat.formatString(date, "yyyy-MM-dd"));
|
|
|
return "billcheck/report";
|
|
|
}
|
|
|
|
|
|
|
|
|
@RequestMapping(value="search")
|
|
|
@ResponseBody
|
|
|
public ResponseModel search(HttpServletRequest request){
|
|
|
ResponseModel model = new ResponseModel(1, "", null);
|
|
|
String deliveryStation = tools.RequestUtils.getQueryParam(request, "deliveryStation");
|
|
|
int start_position = 1, end_position = 99999999;
|
|
|
String total = request.getParameter("total");
|
|
|
String length = request.getParameter("length");
|
|
|
String start_time = request.getParameter("start_time");
|
|
|
String end_time = request.getParameter("end_time");
|
|
|
|
|
|
if(total != null && length != null)
|
|
|
{
|
|
|
int itotal = Integer.parseInt(total);
|
|
|
int ilength = Integer.parseInt(length);
|
|
|
start_position = (itotal-1) * ilength + 1;
|
|
|
end_position = start_position + ilength - 1;
|
|
|
}
|
|
|
|
|
|
//System.out.println("start_position:"+start_position+" end_position:"+end_position);
|
|
|
//System.out.println("deliveryStation:"+deliveryStation+" start:"+start_time+" end:"+end_time);
|
|
|
List<BillCheckReturnData> bcrd = new ArrayList<BillCheckReturnData>();
|
|
|
|
|
|
List<MakeMawbEntity> list1 = makeMawbService.findByDate(deliveryStation,start_time, end_time, start_position, end_position);
|
|
|
model.setCount(makeMawbService.findByDateCount(deliveryStation, start_time, end_time));
|
|
|
//查找分单
|
|
|
for(int i = 0; i < list1.size(); i ++)
|
|
|
{
|
|
|
MakeHawbEntity mhe = makeHawbService.findByMawbNo(list1.get(i).getMawbNo());
|
|
|
BillCheckReturnData rd = new BillCheckReturnData();
|
|
|
rd.setMawblist(list1.get(i));
|
|
|
rd.setHawblist(mhe);
|
|
|
bcrd.add(rd);
|
|
|
}
|
|
|
model.setData(bcrd);
|
|
|
//System.out.println("count:"+model.getCount());
|
|
|
return model;
|
|
|
}
|
|
|
private MakeHawbService makeHawbService;
|
|
|
|
|
|
@Resource
|
|
|
private BasicAgentService agentService;
|
|
|
|
|
|
@RequestMapping(value = "/list")
|
|
|
public String list(Model model) {
|
|
|
// 交运货站
|
|
|
List<PubStationEntity> stations = stationService.findAll();
|
|
|
Date date = new Date();
|
|
|
model.addAttribute("stations", stations);
|
|
|
model.addAttribute("dateModel", DateFormat.formatString(date, "yyyy-MM-dd"));
|
|
|
return "billcheck/list";
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "search")
|
|
|
@ResponseBody
|
|
|
public ResponseModel search(HttpServletRequest request) {
|
|
|
ResponseModel model = new ResponseModel(1, "", null);
|
|
|
String deliveryStation = tools.RequestUtils.getQueryParam(request, "deliveryStation");
|
|
|
int start_position = 1, end_position = 99999999;
|
|
|
String total = request.getParameter("total");
|
|
|
String length = request.getParameter("length");
|
|
|
String start_time = request.getParameter("start_time");
|
|
|
String end_time = request.getParameter("end_time");
|
|
|
|
|
|
if (total != null && length != null) {
|
|
|
int itotal = Integer.parseInt(total);
|
|
|
int ilength = Integer.parseInt(length);
|
|
|
start_position = (itotal - 1) * ilength + 1;
|
|
|
end_position = start_position + ilength - 1;
|
|
|
}
|
|
|
|
|
|
// System.out.println("start_position:"+start_position+"
|
|
|
// end_position:"+end_position);
|
|
|
// System.out.println("deliveryStation:"+deliveryStation+" start:"+start_time+"
|
|
|
// end:"+end_time);
|
|
|
List<BillCheckReturnData> bcrd = new ArrayList<BillCheckReturnData>();
|
|
|
|
|
|
List<MakeMawbEntity> list1 = makeMawbService.findByDate(deliveryStation, start_time, end_time, start_position,
|
|
|
end_position);
|
|
|
model.setCount(makeMawbService.findByDateCount(deliveryStation, start_time, end_time));
|
|
|
// 查找分单
|
|
|
for (int i = 0; i < list1.size(); i++) {
|
|
|
MakeHawbEntity mhe = makeHawbService.findByMawbNo(list1.get(i).getMawbNo());
|
|
|
BillCheckReturnData rd = new BillCheckReturnData();
|
|
|
rd.setMawblist(list1.get(i));
|
|
|
rd.setHawblist(mhe);
|
|
|
bcrd.add(rd);
|
|
|
}
|
|
|
model.setData(bcrd);
|
|
|
// System.out.println("count:"+model.getCount());
|
|
|
return model;
|
|
|
}
|
|
|
|
|
|
@RequestMapping("search2")
|
|
|
@ResponseBody
|
|
|
public ResponseModel search2(HttpServletRequest request){
|
|
|
|
|
|
public ResponseModel search2(HttpServletRequest request) {
|
|
|
|
|
|
ResponseModel model = new ResponseModel(1, "", null);
|
|
|
BillCheckServiceProxy bcsp = new BillCheckServiceProxy();
|
|
|
QueryData qd = new QueryData();
|
|
|
String total = request.getParameter("total");
|
|
|
String length = request.getParameter("length");
|
|
|
DataSerieal.ModelSet(qd, request);
|
|
|
if(qd.getStart_time() == null || qd.getEnd_time() == null)
|
|
|
{
|
|
|
if (qd.getStart_time() == null || qd.getEnd_time() == null) {
|
|
|
model.setStatus(2);
|
|
|
model.setMsg("请输入日期");
|
|
|
return model;
|
|
|
}
|
|
|
if(total != null && length != null)
|
|
|
{
|
|
|
if (total != null && length != null) {
|
|
|
qd.setStart_page(Integer.parseInt(total));
|
|
|
qd.setPage_length(Integer.parseInt(length));
|
|
|
qd.setStart_position((qd.getStart_page()-1)*qd.getPage_length()+1);
|
|
|
qd.setEnd_position(qd.getStart_position()+qd.getPage_length()-1);
|
|
|
qd.setStart_position((qd.getStart_page() - 1) * qd.getPage_length() + 1);
|
|
|
qd.setEnd_position(qd.getStart_position() + qd.getPage_length() - 1);
|
|
|
}
|
|
|
System.out.println(JSONObject.toJSONString(qd));
|
|
|
try {
|
|
|
ReturnData rd = bcsp.getByQuery(qd);
|
|
|
|
|
|
|
|
|
List<ReturnRecode> list = new ArrayList<ReturnRecode>();
|
|
|
ReturnRecode rrs[] = rd.getRecode_list();
|
|
|
for(int i = 0; i < rrs.length; i ++)
|
|
|
{
|
|
|
for (int i = 0; i < rrs.length; i++) {
|
|
|
list.add(rrs[i]);
|
|
|
}
|
|
|
model.setCount(rd.getRecode_all_count());
|
|
|
model.setData(list);
|
|
|
|
|
|
|
|
|
} catch (RemoteException e) {
|
|
|
// TODO Auto-generated catch block
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
|
|
|
return model;
|
|
|
}
|
|
|
/**
|
|
|
* 销售日报
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value="/report")
|
|
|
public String report(/*Model model,Long id,String deliveryStation,String date, */HttpServletRequest request) {
|
|
|
String start_date = request.getParameter("start_date");
|
|
|
String end_date = request.getParameter("end_date");
|
|
|
Date sd = new Date(start_date.replace('-', '/'));
|
|
|
Date ed = new Date(end_date.replace('-', '/'));
|
|
|
// System.out.println("report entry!");
|
|
|
// //交运货站
|
|
|
// List<PubStationEntity> stations = stationService.findAll();
|
|
|
// model.addAttribute("stations",stations);
|
|
|
//
|
|
|
// BillCheckEntity check = null;
|
|
|
// if(id!=null){
|
|
|
// check = billCheckService.findOne(id);
|
|
|
// }else{
|
|
|
// check = billCheckService.findByStationAndDate(deliveryStation,date,SessionUtil.getUser().getId());
|
|
|
// }
|
|
|
// System.out.println("report entry 2!");
|
|
|
// if(check ==null){
|
|
|
// check = new BillCheckEntity();
|
|
|
// BasicAgentEntity agent = agentService.findOne(SessionUtil.getUser().getAgent());
|
|
|
// check.setAgent(agent.getNameCn());
|
|
|
// check.setPayDate(date);
|
|
|
// check.setDeliveryStation(deliveryStation);
|
|
|
// if(StringUtils.isNotEmpty(deliveryStation)){
|
|
|
// //代理人
|
|
|
// BasicAgentEntity baiscAgent = agentService.findOne(SessionUtil.getUser().getAgent());
|
|
|
// Object[] obj = (Object[]) makeMawbService.countCash(deliveryStation,date, baiscAgent.getThreeCode());
|
|
|
// check.setMawbCash(obj[0]==null?0:Double.valueOf(String.valueOf(obj[0])));
|
|
|
// check.setHawbCash(obj[1]==null?0:Double.valueOf(String.valueOf(obj[1])));
|
|
|
// check.setTotalCash((obj[0]==null?0:Double.valueOf(String.valueOf(obj[0]))) + (obj[1]==null?0:Double.valueOf(String.valueOf(obj[1]))));
|
|
|
// }
|
|
|
// }
|
|
|
// System.out.println("report entry 3!");
|
|
|
// if(StringUtils.isNotEmpty(check.getPayDate())){
|
|
|
// check.setPayDate(DateFormat.formatString(check.getPayDate(), "yyyy-MM"));
|
|
|
// }else {
|
|
|
// date=DateFormat.formatString(new Date(), "yyyy-MM");
|
|
|
// check.setPayDate(date);
|
|
|
// }
|
|
|
// model.addAttribute("dateModel",check.getPayDate());
|
|
|
// model.addAttribute("check",check);
|
|
|
//System.out.println("report exit");
|
|
|
return "billcheck/report";
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 保存
|
|
|
* @param check
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value="/save",method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public ResponseModel save(BillCheckEntity check) {
|
|
|
ResponseModel model = new ResponseModel();
|
|
|
try{
|
|
|
check = billCheckService.save(check);
|
|
|
model.setStatus(200);
|
|
|
model.setMsg(HttpJsonMsg.SUCCESS);
|
|
|
model.setData(check.getId());
|
|
|
} catch(Exception e){
|
|
|
model.setStatus(500);
|
|
|
model.setMsg(HttpJsonMsg.ERROR);
|
|
|
}
|
|
|
|
|
|
return model;
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|