|
|
package com.agent.controller.system;
|
|
|
|
|
|
import com.agent.controller.BasicController;
|
|
|
import com.agent.entity.Constant;
|
|
|
import com.agent.entity.system.UserEntity;
|
|
|
import com.agent.service.system.RoleService;
|
|
|
import com.agent.service.system.UserService;
|
|
|
import com.agent.util.HttpJsonMsg;
|
|
|
import com.agent.vo.ResponseModel;
|
|
|
import com.agent.vo.agent.CommodityVo;
|
|
|
import com.agent.vo.agent.ManifestVo;
|
|
|
import com.agent.xml.XmlBuildTask;
|
|
|
import com.agent.xml.common.XmlHead;
|
|
|
import com.agent.xml.common.XmlUtil;
|
|
|
import com.agent.xml.fhlsli.FSXmlKit;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.framework.core.Servlets;
|
|
|
import com.framework.shiro.SessionUtil;
|
|
|
import com.framework.util.MessageKit;
|
|
|
import com.framework.util.MessageType;
|
|
|
import com.plugin.easyui.DataGrid;
|
|
|
import com.plugin.easyui.EasyPage;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.Model;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import tools.DBConnection;
|
|
|
import tools.NumKit;
|
|
|
import tools.Tools;
|
|
|
import tools.oclass.FemyList;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.sql.Connection;
|
|
|
import java.sql.ResultSet;
|
|
|
import java.sql.SQLException;
|
|
|
import java.sql.Statement;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
import com.agent.entity.agent.BasicAgentEntity;
|
|
|
import com.agent.entity.agent.ManifestBillEntity;
|
|
|
import com.agent.entity.agent.ManifestEntity;
|
|
|
import com.agent.entity.agent.PackageTypeEntity;
|
|
|
import com.agent.entity.agent.PreparesecondaryEntity;
|
|
|
import com.agent.entity.agent.PubDgEntity;
|
|
|
import com.agent.entity.agent.TBasCarrierEntity;
|
|
|
import com.agent.entity.agent.WaybillReceiptEntity;
|
|
|
import com.agent.entity.agent.WaybillReceiptType;
|
|
|
import com.agent.service.agent.BasicAgentService;
|
|
|
import com.agent.service.agent.ConsigneeService;
|
|
|
import com.agent.service.agent.ConsignorService;
|
|
|
import com.agent.service.agent.ManifestBillService;
|
|
|
import com.agent.service.agent.ManifestCommodityService;
|
|
|
import com.agent.service.agent.ManifestContainerService;
|
|
|
import com.agent.service.agent.ManifestService;
|
|
|
import com.agent.service.agent.PackageTypeService;
|
|
|
import com.agent.service.agent.PreparesecondaryService;
|
|
|
import com.agent.service.agent.PubDgService;
|
|
|
import com.agent.service.agent.TBasCarrierService;
|
|
|
import com.agent.service.agent.WaybillReceiptService;
|
|
|
import com.agent.xml.manifestdeclare.DeclarePreparemasterXmlBody;
|
|
|
import com.agent.xml.manifestdeclare.ManifestBorderTransportMeansXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestCarrierXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestConsignmentItemXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestConsignmentPackagingXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestConsignmentXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestConsignorXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestDeclarationXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestDeclareMetaXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestDeclareMsgXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestDesXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestFreightPaymentXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestLoadingLocationXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestOrgXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestTransportContractDocumentXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestUnloadingLocationXml;
|
|
|
import com.agent.xml.manifestdeclare.ManifestsAddressXml;
|
|
|
/**
|
|
|
* @Auther: shenhl
|
|
|
* @Date: 2019/3/15 09:52
|
|
|
*/
|
|
|
@Controller
|
|
|
@RequestMapping(value = "/wbm")
|
|
|
public class WaybillnomasterController extends BasicController {
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(com.agent.controller.agent.ManifestController.class);
|
|
|
|
|
|
public static boolean isSuccess = false;
|
|
|
|
|
|
@Resource
|
|
|
private ManifestService manifestService;
|
|
|
|
|
|
@Resource
|
|
|
private PreparesecondaryService preparesecondaryServer;
|
|
|
|
|
|
@Resource
|
|
|
private BasicAgentService agentService;
|
|
|
|
|
|
@Resource
|
|
|
private UserService userService;
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/list")
|
|
|
public String list() {
|
|
|
return "system/user/wbm";
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询分页数据
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/grid.json")
|
|
|
@ResponseBody
|
|
|
public DataGrid<ManifestVo> grid(HttpServletRequest request, EasyPage<ManifestEntity> pageForm) {
|
|
|
Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_");
|
|
|
// searchParams.put("EQ_isdelete", 0);
|
|
|
pageForm.setSearchParams(searchParams);
|
|
|
// UserEntity ue =
|
|
|
// (UserEntity)SecurityUtils.getSubject().getSession().getAttribute("user");
|
|
|
UserEntity ue = (UserEntity) SecurityUtils.getSubject().getSession().getAttribute("user");
|
|
|
if (ue != null) {
|
|
|
Long u = ue.getId();
|
|
|
Set<String> sk = pageForm.getSearchParams().keySet();
|
|
|
|
|
|
if (Tools.getUserId() != null && Tools.getUserId() != 1) {
|
|
|
// 不是管理员,添加用户id的条件
|
|
|
pageForm.getSearchParams().put("EQ_USER_ID", u);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
pageForm.parseData(manifestService.getPage(pageForm));
|
|
|
//
|
|
|
DataGrid<ManifestEntity> manis = pageForm.getData();
|
|
|
List<ManifestVo> manifestVos = new ArrayList<>();
|
|
|
for (ManifestEntity mani : manis.getRows()){
|
|
|
ManifestVo manifestVo = new ManifestVo();
|
|
|
manifestVo.setId(mani.getId());
|
|
|
manifestVo.setUnlodingcode(mani.getUnlodingcode());
|
|
|
manifestVo.setCnecusid(mani.getCnecusid());
|
|
|
manifestVo.setShpcusid(mani.getShpcusid());
|
|
|
manifestVo.setShpaeo(mani.getShpaeo());
|
|
|
manifestVo.setCneaeo(mani.getCneaeo());
|
|
|
manifestVo.setFlightno(mani.getFlightno());
|
|
|
manifestVo.setFlightdate(mani.getFlightdate());
|
|
|
manifestVo.setOriginatingstation(mani.getOriginatingstation());
|
|
|
manifestVo.setDestinationstation(mani.getDestinationstation());
|
|
|
manifestVo.setWaybillnomaster(mani.getWaybillnomaster());
|
|
|
manifestVo.setTotalweight(mani.getTotalweight());
|
|
|
manifestVo.setTotalpiece(mani.getTotalpiece());
|
|
|
manifestVo.setPreparetotalpiece(mani.getPreparetotalpiece());
|
|
|
manifestVo.setPreparetotalweight(mani.getPreparetotalweight());
|
|
|
manifestVo.setAgentcompanycode(mani.getAgentcompanycode());
|
|
|
manifestVo.setStowagedate(mani.getStowagedate());
|
|
|
manifestVo.setStatus(mani.getStatus());
|
|
|
manifestVo.setCarrier(mani.getCarrier());
|
|
|
manifestVo.setCustomsstatus(mani.getCustomsstatus());
|
|
|
manifestVo.setPaymode(mani.getPaymode());
|
|
|
manifestVo.setSpecialgoodscode(mani.getSpecialgoodscode());
|
|
|
manifestVo.setCustomscode(mani.getCustomscode());
|
|
|
manifestVo.setAgentman(mani.getAgentman());
|
|
|
manifestVo.setAgentcompany(mani.getAgentcompany());
|
|
|
manifestVo.setReceiptinformation(mani.getReceiptinformation());
|
|
|
manifestVo.setCreatedate(mani.getCreatedate());
|
|
|
manifestVo.setProductname(mani.getProductname());
|
|
|
manifestVo.setUnnumber(mani.getUnnumber());
|
|
|
manifestVo.setCategory(mani.getCategory());
|
|
|
manifestVo.setSh_company(mani.getSh_company());
|
|
|
manifestVo.setSh_address(mani.getSh_address());
|
|
|
manifestVo.setSh_zipcode(mani.getSh_zipcode());
|
|
|
manifestVo.setSh_city(mani.getSh_city());
|
|
|
manifestVo.setSh_deltaname(mani.getSh_deltaname());
|
|
|
manifestVo.setSh_country(mani.getSh_country());
|
|
|
manifestVo.setSh_telephone(mani.getSh_telephone());
|
|
|
manifestVo.setSh_fax(mani.getSh_fax());
|
|
|
manifestVo.setSh_name(mani.getSh_name());
|
|
|
manifestVo.setCo_company(mani.getCo_company());
|
|
|
manifestVo.setCo_address(mani.getCo_address());
|
|
|
manifestVo.setCo_zipcode(mani.getCo_zipcode());
|
|
|
manifestVo.setCo_city(mani.getCo_city());
|
|
|
manifestVo.setCo_deltaname(mani.getCo_deltaname());
|
|
|
manifestVo.setCo_country(mani.getCo_country());
|
|
|
manifestVo.setCo_telephone(mani.getCo_telephone());
|
|
|
manifestVo.setCo_fax(mani.getCo_fax());
|
|
|
manifestVo.setCo_name(mani.getCo_name());
|
|
|
manifestVo.setReach_station(mani.getReach_station());
|
|
|
manifestVo.setCarrier1(mani.getCarrier1());
|
|
|
manifestVo.setReach_station1(mani.getReach_station1());
|
|
|
manifestVo.setCarrier2(mani.getCarrier2());
|
|
|
manifestVo.setReach_station2(mani.getReach_station2());
|
|
|
manifestVo.setName_ofgoods(mani.getName_ofgoods());
|
|
|
manifestVo.setDelivery_station(mani.getDelivery_station());
|
|
|
manifestVo.setSh_provincecode(mani.getSh_provincecode());
|
|
|
manifestVo.setSh_provincename(mani.getSh_provincename());
|
|
|
manifestVo.setDe_number(mani.getDe_number());
|
|
|
manifestVo.setDe_weight(mani.getDe_weight());
|
|
|
manifestVo.setDe_chweight(mani.getDe_chweight());
|
|
|
manifestVo.setDe_size(mani.getDe_size());
|
|
|
manifestVo.setDe_volume(mani.getDe_volume());
|
|
|
manifestVo.setDe_type(mani.getDe_type());
|
|
|
manifestVo.setDe_trstation(mani.getDe_trstation());
|
|
|
manifestVo.setDe_packing(mani.getDe_packing());
|
|
|
manifestVo.setDe_remarks(mani.getDe_remarks());
|
|
|
manifestVo.setDe_ids(mani.getDe_ids());
|
|
|
manifestVo.setResponse_code(mani.getResponse_code());
|
|
|
manifestVo.setResponse_text(mani.getResponse_text());
|
|
|
manifestVo.setSave_time(mani.getSave_time());
|
|
|
manifestVo.setUSER_ID(mani.getUSER_ID());
|
|
|
|
|
|
if(mani.getUSER_ID() != null){
|
|
|
UserEntity one = userService.findOne(mani.getUSER_ID());
|
|
|
manifestVo.setLoginaccount(one.getLoginaccount());
|
|
|
BasicAgentEntity one1 = agentService.findOne(one.getAgent());
|
|
|
manifestVo.setAgentCode(one1.getThreeCode());
|
|
|
}
|
|
|
manifestVos.add(manifestVo);
|
|
|
}
|
|
|
DataGrid<ManifestVo> vo = new DataGrid<>();
|
|
|
vo.setRows(manifestVos);
|
|
|
vo.setTotal(manis.getTotal());
|
|
|
// return pageForm.getData();
|
|
|
return vo;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 模糊查询匹配信息
|
|
|
* @param id
|
|
|
* @param model
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/infor")
|
|
|
@ResponseBody
|
|
|
public List<ManifestEntity> infor(String id, Model model) {
|
|
|
List<ManifestEntity> li = null;
|
|
|
if (Tools.getUserId() != null && Tools.getUserId().longValue() == 1) {
|
|
|
li = manifestService.queryAll();
|
|
|
} else {
|
|
|
li = manifestService.queryByUserId(Tools.getUserId());
|
|
|
}
|
|
|
|
|
|
List<ManifestEntity> result = new FemyList();
|
|
|
for (ManifestEntity me : li) {
|
|
|
if (result.contains(me)) {
|
|
|
} else {
|
|
|
result.add(me);
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* * 模糊查询匹配信息
|
|
|
*
|
|
|
* @param manifest
|
|
|
* @return
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/inforPre")
|
|
|
@ResponseBody
|
|
|
public List<PreparesecondaryEntity> inforPre(String id, Model model) {
|
|
|
List<PreparesecondaryEntity> li = preparesecondaryServer.queryByUserId(Tools.getUserId());
|
|
|
List<PreparesecondaryEntity> result = new FemyList();
|
|
|
for (PreparesecondaryEntity pe : li) {
|
|
|
if (result.contains(pe)) {
|
|
|
|
|
|
} else {
|
|
|
result.add(pe);
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询分制单分页数据
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/sub/grid.json")
|
|
|
@ResponseBody
|
|
|
public DataGrid<PreparesecondaryEntity> gridSub(Long mawbId, HttpServletRequest request) {
|
|
|
DataGrid<PreparesecondaryEntity> dg = new DataGrid<>();
|
|
|
dg.setRows(preparesecondaryServer.findByMawbId(mawbId));
|
|
|
return dg;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 删除
|
|
|
*
|
|
|
* @param ids
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/delete", method = { RequestMethod.POST })
|
|
|
@ResponseBody
|
|
|
public ResponseModel delete(String ids) {
|
|
|
ResponseModel model = new ResponseModel();
|
|
|
try {
|
|
|
manifestService.trueDeleteAll(ids);
|
|
|
model.setStatus(200);
|
|
|
model.setMsg(HttpJsonMsg.SUCCESS);
|
|
|
} catch (Exception e) {
|
|
|
model.setStatus(500);
|
|
|
model.setMsg(HttpJsonMsg.ERROR);
|
|
|
logger.error("系统异常 >>", e);
|
|
|
}
|
|
|
return model;
|
|
|
}
|
|
|
|
|
|
|
|
|
//编辑
|
|
|
@RequestMapping(value = "/edit/{id}")
|
|
|
public String edit(Model model, @PathVariable("id") Long id){
|
|
|
ManifestEntity manifest = null;
|
|
|
UserEntity user = SessionUtil.getUser();
|
|
|
// 判断是否是便捷
|
|
|
if (id != null) {
|
|
|
manifest = manifestService.findOne(id);
|
|
|
user = userService.findOne(manifest.getUSER_ID());
|
|
|
}
|
|
|
List<UserEntity> laList = userService.findAll();
|
|
|
//全部用户账户号
|
|
|
model.addAttribute("userList", laList);
|
|
|
//主单号id
|
|
|
model.addAttribute("manifest",manifest);
|
|
|
model.addAttribute("wbm", user);
|
|
|
return "system/user/wbm_edit";
|
|
|
}
|
|
|
|
|
|
//修改
|
|
|
@RequestMapping(value = "/userUpdate")
|
|
|
@ResponseBody
|
|
|
public ResponseModel userUpdate(@RequestParam("ids") Long ids,
|
|
|
@RequestParam("userId") Long userId,
|
|
|
@RequestParam("loginaccount") String loginaccount){
|
|
|
ResponseModel rm = new ResponseModel(200,"",null);
|
|
|
|
|
|
try {
|
|
|
UserEntity user = userService.findLoginaccount(loginaccount);
|
|
|
if (user.getId() != null){
|
|
|
manifestService.userUpdate(user.getId(), ids);
|
|
|
rm.setStatus(200);
|
|
|
}else {
|
|
|
rm.setStatus(500);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
rm.setStatus(500);
|
|
|
}
|
|
|
|
|
|
return rm;
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|