...
|
...
|
@@ -15,6 +15,8 @@ import javax.servlet.http.HttpSession; |
|
|
import javax.servlet.http.Part;
|
|
|
|
|
|
import com.agent.entity.agent.*;
|
|
|
import com.agent.service.system.HzInfoService;
|
|
|
import com.agent.service.system.HzWaybillService;
|
|
|
import com.agent.service.system.UserService;
|
|
|
import com.agent.util.ExcelUtil;
|
|
|
import com.agent.vo.agent.ManifestVo;
|
...
|
...
|
@@ -22,9 +24,14 @@ import com.framework.util.DateFormat; |
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.hibernate.SessionFactory;
|
|
|
import org.hibernate.StaleObjectStateException;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.orm.ObjectOptimisticLockingFailureException;
|
|
|
import org.springframework.orm.jpa.vendor.HibernateJpaSessionFactoryBean;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.transaction.TransactionSystemException;
|
|
|
import org.springframework.ui.Model;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
...
|
...
|
@@ -136,6 +143,12 @@ public class ManifestController extends BasicController { |
|
|
@Resource
|
|
|
private UserService userService;
|
|
|
|
|
|
@Resource
|
|
|
private HzInfoService hzInfoService;
|
|
|
|
|
|
@Resource
|
|
|
private HzWaybillService hzWaybillService;
|
|
|
|
|
|
private BasicAgentEntity getAgent() {
|
|
|
UserEntity user = Tools.getUserEntity();
|
|
|
long agent_id = user.getAgent();
|
...
|
...
|
@@ -642,13 +655,12 @@ public class ManifestController extends BasicController { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* * 模糊查询匹配信息
|
|
|
*
|
|
|
* @param manifest
|
|
|
* @return
|
|
|
* @return
|
|
|
*/
|
|
|
/**
|
|
|
* 模糊查询匹配信息
|
|
|
* @param id
|
|
|
* @param model
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/inforPre")
|
|
|
@ResponseBody
|
|
|
public List<PreparesecondaryEntity> inforPre(String id, Model model) {
|
...
|
...
|
@@ -673,10 +685,13 @@ public class ManifestController extends BasicController { |
|
|
@RequestMapping(value = "/edit")
|
|
|
public String edit(HttpServletRequest request, Long id, Model model) {
|
|
|
request.setAttribute("version", System.currentTimeMillis());
|
|
|
//运单号
|
|
|
String waybill = "";
|
|
|
ManifestEntity manifest = null;
|
|
|
// 判断是否是便捷
|
|
|
if (id != null) {
|
|
|
manifest = manifestService.findOne(id);
|
|
|
waybill = manifest.getWaybillnomaster();
|
|
|
}
|
|
|
|
|
|
UserEntity user = SessionUtil.getUser();
|
...
|
...
|
@@ -690,7 +705,22 @@ public class ManifestController extends BasicController { |
|
|
manifest.setAgentman(""); // 设置代理人名称为null
|
|
|
}
|
|
|
}
|
|
|
model.addAttribute("manifest", manifest);
|
|
|
|
|
|
|
|
|
//发货人类型
|
|
|
List<HZSHIPPERINFORMATIONEntity> shipeer = hzInfoService.findShipeer();
|
|
|
//订舱代理
|
|
|
List<HZSHIPPERINFORMATIONEntity> booking = hzInfoService.findBooking();
|
|
|
//操作代理
|
|
|
List<HZSHIPPERINFORMATIONEntity> operaion = hzInfoService.findOperaion();
|
|
|
|
|
|
model.addAttribute("shipper", shipeer);
|
|
|
|
|
|
model.addAttribute("booking", booking);
|
|
|
|
|
|
model.addAttribute("operation", operaion);
|
|
|
|
|
|
model.addAttribute("manifest", manifest);
|
|
|
// 海关关区
|
|
|
List<String> Customs = getCustomsCode();
|
|
|
model.addAttribute("CusToms", Customs);
|
...
|
...
|
@@ -715,6 +745,13 @@ public class ManifestController extends BasicController { |
|
|
WaybillReceiptEntity receipt = receiptService.findMain(waybill_no);
|
|
|
request.setAttribute("receipt", receipt);
|
|
|
|
|
|
|
|
|
//货主与运单绑定关系
|
|
|
if (!StringUtils.isEmpty(waybill)){
|
|
|
//查询关系表 得到货主id
|
|
|
List<HZWAYBLLINFOEntity> infoList = hzWaybillService.findHzId(waybill);
|
|
|
model.addAttribute("hzId", infoList);
|
|
|
}
|
|
|
return "manifest/edit";
|
|
|
}
|
|
|
|
...
|
...
|
@@ -929,14 +966,13 @@ public class ManifestController extends BasicController { |
|
|
return list;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 编辑
|
|
|
*
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
/**
|
|
|
* 编辑
|
|
|
* @param waybill
|
|
|
* @return
|
|
|
*/
|
|
|
// @RequestMapping(value = "/bill/edit")
|
|
|
// public String editBill(Long id,Long manifestId,Model model){
|
|
|
// public String editBill(LongEntity4 id,LongEntity4 manifestId,Model model){
|
|
|
// ManifestBillEntity bill = null;
|
|
|
// if(id==null){
|
|
|
// bill = new ManifestBillEntity();
|
...
|
...
|
@@ -973,7 +1009,7 @@ public class ManifestController extends BasicController { |
|
|
@RequestMapping(value = "/save", method = { RequestMethod.POST })
|
|
|
@ResponseBody
|
|
|
public ResponseModel save(ManifestEntity manifest, HttpServletRequest reuqest) {
|
|
|
String flightno = manifest.getFlightno();
|
|
|
String flightno = manifest.getFlightno();
|
|
|
String carrier = "";
|
|
|
if (StringUtils.isNotBlank(flightno) && flightno.length() > 2) {
|
|
|
carrier = flightno.substring(0, 2);
|
...
|
...
|
@@ -1089,7 +1125,26 @@ public class ManifestController extends BasicController { |
|
|
@RequestMapping(value = "/savesend", method = { RequestMethod.POST })
|
|
|
@ResponseBody
|
|
|
public ResponseModel savesend(ManifestEntity manifest, HttpServletRequest request, HttpServletResponse response) {
|
|
|
String flightno = manifest.getFlightno();
|
|
|
//发货人
|
|
|
String forShortShipper = request.getParameter("for_short_shipper");
|
|
|
//订舱代理
|
|
|
String forShortBooking = request.getParameter("for_short_booking");
|
|
|
//操作代理
|
|
|
String forShortOperation = request.getParameter("for_short_operation");
|
|
|
|
|
|
List<String> list = new ArrayList<>();
|
|
|
if (!StringUtils.isEmpty(forShortShipper)){
|
|
|
list.add(forShortShipper);
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(forShortBooking)){
|
|
|
list.add(forShortBooking);
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(forShortOperation)){
|
|
|
list.add(forShortOperation);
|
|
|
}
|
|
|
|
|
|
|
|
|
String flightno = manifest.getFlightno();
|
|
|
String carrier = "";
|
|
|
if (StringUtils.isNotBlank(flightno) && flightno.length() > 2) {
|
|
|
carrier = flightno.substring(0, 2);
|
...
|
...
|
@@ -1122,9 +1177,28 @@ public class ManifestController extends BasicController { |
|
|
manifest.setResponse_code(String.valueOf(type.getValue()));
|
|
|
manifest.setResponse_text(type.getName());
|
|
|
manifest.setSave_time(System.currentTimeMillis());
|
|
|
|
|
|
//查询数据库是否存在 如果不存在直接添加 存在就删除 再进行添加
|
|
|
if (hzWaybillService.findHzId(manifest.getWaybillnomaster()).size()>0){
|
|
|
if (hzWaybillService.deleteAlls(manifest.getWaybillnomaster())>0){
|
|
|
for (String sId : list){
|
|
|
HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
|
|
|
hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
|
|
|
hzwaybllinfoEntity.setHzinfor_id(sId);
|
|
|
hzWaybillService.save(hzwaybllinfoEntity);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}else {
|
|
|
for (String sId : list){
|
|
|
HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
|
|
|
hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
|
|
|
hzwaybllinfoEntity.setHzinfor_id(sId);
|
|
|
hzWaybillService.save(hzwaybllinfoEntity);
|
|
|
}
|
|
|
}
|
|
|
manifestService.save(manifest);
|
|
|
receiptService.saveFromManifest(manifest, type);
|
|
|
|
|
|
// 生成报文并且发送
|
|
|
String ndlrPath = MessageKit.getMessagePath(MessageType.NDLR);
|
|
|
String dlcPath = MessageKit.getMessagePath(MessageType.DLCF);
|
...
|
...
|
@@ -1239,12 +1313,11 @@ public class ManifestController extends BasicController { |
|
|
return model;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存
|
|
|
*
|
|
|
* @param manifest
|
|
|
* @return
|
|
|
*/
|
|
|
/**
|
|
|
* 保存
|
|
|
* @param preparesecondary
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/sub_save", method = { RequestMethod.POST })
|
|
|
@ResponseBody
|
|
|
public ResponseModel sub_save(PreparesecondaryEntity preparesecondary) {
|
...
|
...
|
@@ -1424,12 +1497,12 @@ public class ManifestController extends BasicController { |
|
|
return model;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存并且发送
|
|
|
*
|
|
|
* @param manifest
|
|
|
* @return
|
|
|
*/
|
|
|
/**
|
|
|
* 保存并且发送
|
|
|
* @param Preparesecondary
|
|
|
* @param request
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/presendDelivery", method = { RequestMethod.POST })
|
|
|
@ResponseBody
|
|
|
public ResponseModel presendDelivery(PreparesecondaryEntity Preparesecondary, HttpServletRequest request) {
|
...
|
...
|
@@ -1696,7 +1769,7 @@ public class ManifestController extends BasicController { |
|
|
return xml;
|
|
|
}
|
|
|
|
|
|
// private String beanToXml(String path,Long id){
|
|
|
// private String beanToXml(String path,LongEntity4 id){
|
|
|
// ManifestEntity manifestEntity = manifestService.findOne(id);
|
|
|
//
|
|
|
// if(manifestEntity==null){
|
...
|
...
|
@@ -2086,12 +2159,11 @@ public class ManifestController extends BasicController { |
|
|
return model;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除
|
|
|
*
|
|
|
* @param ids
|
|
|
* @return
|
|
|
*/
|
|
|
/**
|
|
|
* 删除
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/subdelete", method = { RequestMethod.POST })
|
|
|
@ResponseBody
|
|
|
public ResponseModel subdelete(Long id) {
|
...
|
...
|
@@ -2101,6 +2173,7 @@ public class ManifestController extends BasicController { |
|
|
model.setStatus(200);
|
|
|
model.setMsg(HttpJsonMsg.SUCCESS);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
model.setStatus(500);
|
|
|
model.setMsg(HttpJsonMsg.ERROR);
|
|
|
logger.error("系统异常 >>", e);
|
...
|
...
|
|