作者 蔺文领

过滤不可见字符,添加主单号实时重复校验,修改其它bug。

... ... @@ -7,14 +7,9 @@
<url>http://maven.apache.org</url>
<packaging>war</packaging>
<!-- 设定除中央仓库 (repo1.maven.org/maven2/)外的其他仓库,按设定顺序进行查询,如有Nexus私服, 取消注释并指向正确的服务器地址 -->
<!-- <repositories>
<repository>
<id>public</id>
<name>Public Repositories</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</repository>
</repositories> -->
<!-- <repositories> <repository> <id>public</id> <name>Public Repositories</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url> </repository>
</repositories> -->
<!-- 主要依赖库版本定义 -->
<properties>
... ... @@ -381,11 +376,8 @@
</dependency>
<!-- velocity 模板 -->
<!-- <dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>${velocity.version}</version>
</dependency> -->
<!-- <dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity</artifactId>
<version>${velocity.version}</version> </dependency> -->
<dependency>
<groupId>org.apache.velocity</groupId>
... ... @@ -411,6 +403,27 @@
<version>1.9.7</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<!-- 配置文件 -->
... ...
... ... @@ -142,8 +142,8 @@ public class ManifestController extends BasicController {
private BasicAgentEntity getAgent() {
UserEntity user = Tools.getUserEntity();
long agent_id = user.getAgent();
System.err.println("agent_id-->"+agent_id);
System.err.println("agent_id-->" + agent_id);
BasicAgentEntity agent = agentService.findOne(agent_id);
if (agent == null) {
agent = new BasicAgentEntity();
... ... @@ -158,9 +158,10 @@ public class ManifestController extends BasicController {
return agent;
}
/**
* 测试用,查看当前账号对应的代理人信息
*
* @param reuqest
* @param response
* @return
... ... @@ -170,10 +171,32 @@ public class ManifestController extends BasicController {
public ResponseModel getAgentInfo(HttpServletRequest reuqest, HttpServletResponse response) {
ResponseModel model = new ResponseModel();
response.setHeader("Access-Control-Allow-Origin", "*");
BasicAgentEntity agent = getAgent();
model.setData(agent);
return model;
}
@RequestMapping(value = "/checkRepeat", method = { RequestMethod.GET })
@ResponseBody
public ResponseModel checkRepeat(HttpServletRequest reuqest, HttpServletResponse response, int manifestId,
String manifest_no) {
ResponseModel model = new ResponseModel();
response.setHeader("Access-Control-Allow-Origin", "*");
List<ManifestEntity> list = manifestService.findByManifestNo(manifest_no);
if (list == null || list.size() == 0) {
model.setStatus(200);
} else {
ManifestEntity firt = list.get(0);
if (firt.getId() != manifestId) {
model.setStatus(500);
model.setMsg("主单号不能重复");
} else {
model.setStatus(200);
}
}
return model;
}
... ... @@ -1004,6 +1027,10 @@ public class ManifestController extends BasicController {
String dlcPath = MessageKit.getMessagePath(MessageType.DLCF);
String sliPath = MessageKit.getMessagePath(MessageType.SLI);
manifest.setAgentcompany(getAgent().getNameCn());
manifest.setAgentman(getAgent().getNameCn());
manifest.setAgentcompanycode(getAgent().getThreeCode());
new XmlBuildTask(manifestService.sendNDLRXml(manifest), ndlrPath).perform();
new XmlBuildTask(manifestService.sendDLCFXml(manifest), dlcPath).perform();
new XmlBuildTask(FSXmlKit.sliXml(manifest, getAgent()), sliPath).perform();
... ... @@ -1243,6 +1270,10 @@ public class ManifestController extends BasicController {
String dlcPath = MessageKit.getMessagePath(MessageType.DLCF);
String fhlPath = MessageKit.getMessagePath(MessageType.FHL);
preparesecondary.setAgentcompany(getAgent().getNameCn());
preparesecondary.setAgentman(getAgent().getNameCn());
preparesecondary.setAgentcompanycode(getAgent().getThreeCode());
new XmlBuildTask(manifestService.presenddlcfNdlrXml(preparesecondary), ndlrPath).perform();
new XmlBuildTask(manifestService.presenddlcfdlcfXml(preparesecondary), dlcPath).perform();
new XmlBuildTask(FSXmlKit.fhlXml(preparesecondary, getAgent()), fhlPath).perform();
... ...
... ... @@ -29,6 +29,7 @@ class XmlSendTask extends Thread {
public void run() {
long flag = -1;
if (!StringUtils.isEmpty(xml)) {
xml = xml.replaceAll("[\\u0000-\\u001f]", "");
flag = jedis.lpush("task-queue", xml);
}
... ...
... ... @@ -129,8 +129,8 @@ public class FSXmlKit {
sliMasterConsignment.setConsigneeParty(consigneeParty);
FreightForwarderParty freightForwarderParty = new FreightForwarderParty();
freightForwarderParty.setPrimaryID(agent.getThreeCode());//代理人代码
freightForwarderParty.setName(agent.getThreeCode());//代理人名称
freightForwarderParty.setPrimaryID("");
freightForwarderParty.setName(agent.getThreeCode());//代理人简称
PostalStructuredAddress agentdAddress = new PostalStructuredAddress();
agentdAddress.setCityName("");
agentdAddress.setCountryID("");
... ... @@ -138,14 +138,20 @@ public class FSXmlKit {
sliMasterConsignment.setFreightForwarderParty(freightForwarderParty);
AssociatedParty associatedParty = new AssociatedParty();
associatedParty.setPrimaryID(agent.getThreeCode());//代理人代码
associatedParty.setName(agent.getThreeCode());//代理人名称
associatedParty.setPrimaryID("");
associatedParty.setName(agent.getThreeCode());//代理人简称
associatedParty.setAccountID("INFOSKY:NULL");
associatedParty.setRoleCode("AGT");
associatedParty.setRole("Agent");
associatedParty.setPostalStructuredAddress(agentdAddress);
sliMasterConsignment.setAssociatedParty(associatedParty);
AssociatedParty associatedParty_ = new AssociatedParty();
associatedParty_.setName("CGOHA");
associatedParty_.setAccountID("INFOSKY:NULL");
associatedParty_.setRoleCode("GHA");
associatedParty_.setRole("Ground Handling Agent");
sliMasterConsignment.setAssociatedParty_(associatedParty_);
OriginLocation originLocation = new OriginLocation();
originLocation.setID(me.getOriginatingstation());
... ... @@ -353,8 +359,8 @@ public class FSXmlKit {
includedHouseConsignment.setConsigneeParty(consigneeParty);
FreightForwarderParty freightForwarderParty = new FreightForwarderParty();
freightForwarderParty.setPrimaryID(agent.getThreeCode());//代理人代码
freightForwarderParty.setName(agent.getThreeCode());//代理人名称
freightForwarderParty.setPrimaryID("");
freightForwarderParty.setName(agent.getThreeCode());//代理人简称
PostalStructuredAddress agentdAddress = new PostalStructuredAddress();
agentdAddress.setCityName("");
... ... @@ -363,13 +369,20 @@ public class FSXmlKit {
includedHouseConsignment.setFreightForwarderParty(freightForwarderParty);
AssociatedParty associatedParty = new AssociatedParty();
associatedParty.setPrimaryID(agent.getThreeCode());//代理人代码
associatedParty.setName(agent.getThreeCode());//代理人名称
associatedParty.setPrimaryID("");
associatedParty.setName(agent.getThreeCode());//代理人简称
associatedParty.setAccountID("INFOSKY:NULL");
associatedParty.setRoleCode("AGT");
associatedParty.setRole("Agent");
associatedParty.setPostalStructuredAddress(agentdAddress);
includedHouseConsignment.setAssociatedParty(associatedParty);
AssociatedParty associatedParty_ = new AssociatedParty();
associatedParty_.setName("CGOHA");
associatedParty_.setAccountID("INFOSKY:NULL");
associatedParty_.setRoleCode("GHA");
associatedParty_.setRole("Ground Handling Agent");
includedHouseConsignment.setAssociatedParty_(associatedParty_);
OriginLocation includeOriginLocation = new OriginLocation();
includeOriginLocation.setID(pe.getOriginatingstation());
... ...
... ... @@ -2,11 +2,9 @@ package com.agent.xml.fhlsli;
import java.util.Date;
import com.agent.entity.Constant;
import com.agent.entity.agent.BasicAgentEntity;
import com.agent.entity.agent.ManifestEntity;
import com.agent.xml.common.XmlUtil;
import com.agent.xml.fhlsli.fhl.HouseWaybill;
import tools.NumKit;
/**
* Depiction:
... ... @@ -24,22 +22,15 @@ public class Test {
}
public static void main(String[] args) {
String no = "784-28567862";
String[] array = no.split("-");
String end = array[1];
int number = NumKit.parseInt(end);
int remainder = number / 10 % 7;
int last = number % 10;
System.err.println("===================================");
System.err.println("remainder-->"+remainder);
System.err.println("last-->"+last);
if (remainder == last) {
System.err.println(true);
} else {
System.err.println(false);
}
ManifestEntity me = new ManifestEntity();
me.setStowagedate(new Date());
me.setFlightdate(new Date());
BasicAgentEntity agent = new BasicAgentEntity();
agent.setThreeCode("TXT");
agent.setNameCn("测试代理人");
SliCcs sli = FSXmlKit.sliXml(me, agent);
String xml = XmlUtil.convertToXml(sli);
System.err.println(xml);
}
}
... ...
... ... @@ -26,9 +26,9 @@ public class AssociatedParty {
private String Name;
@XmlElement(name = "LegalID",required = false)
private String LegalID;
@XmlElement(name = "RoleCode",required = false)
private String AccountID;
@XmlElement(name = "AccountID",required = false)
private String AccountID;
@XmlElement(name = "RoleCode",required = false)
private String RoleCode;
@XmlElement(name = "Role",required = false)
private String Role;
... ...
... ... @@ -86,6 +86,8 @@ public class IncludedHouseConsignment {
private FreightForwarderParty FreightForwarderParty;
@XmlElement(name = "AssociatedParty",required = false)
private AssociatedParty AssociatedParty;
@XmlElement(name = "AssociatedParty",required = false)
private AssociatedParty AssociatedParty_;
@XmlElement(name = "ApplicableTransportCargoInsurance",required = false)
private ApplicableTransportCargoInsurance ApplicableTransportCargoInsurance;
@XmlElement(name = "OriginLocation",required = false)
... ... @@ -114,6 +116,15 @@ public class IncludedHouseConsignment {
private ApplicableLogisticsAllowanceCharge ApplicableLogisticsAllowanceCharge;
@XmlElement(name = "IncludedHouseConsignmentItem",required = false)
private IncludedHouseConsignmentItem IncludedHouseConsignmentItem;
public AssociatedParty getAssociatedParty_() {
return AssociatedParty_;
}
public void setAssociatedParty_(AssociatedParty associatedParty_) {
AssociatedParty_ = associatedParty_;
}
public void setTransportContractDocument(TransportContractDocument TransportContractDocument) {
this.TransportContractDocument = TransportContractDocument;
... ...
... ... @@ -69,6 +69,8 @@ public class SliMasterConsignment {
private FreightForwarderParty FreightForwarderParty;
@XmlElement(name = "AssociatedParty",required = false)
private AssociatedParty AssociatedParty;
@XmlElement(name = "AssociatedParty",required = false)
private AssociatedParty AssociatedParty_;
@XmlElement(name = "OriginLocation",required = false)
private OriginLocation OriginLocation;
@XmlElement(name = "FinalDestinationLocation",required = false)
... ... @@ -85,6 +87,14 @@ public class SliMasterConsignment {
private IncludedMasterConsignmentItem IncludedMasterConsignmentItem;
@XmlElement(name = "ReportedStatus",required = false)
private ReportedStatus ReportedStatus;
public AssociatedParty getAssociatedParty_() {
return AssociatedParty_;
}
public void setAssociatedParty_(AssociatedParty associatedParty_) {
AssociatedParty_ = associatedParty_;
}
public void setID(String ID) {
this.ID = ID;
... ...
... ... @@ -1054,12 +1054,43 @@ $(function(){
parent.layer.alert('主单号不符合模七校验,请修改~!', {icon: 6});
$("#waybill").focus();
});
}
}else{
//模七校验通过,校验是否有重复
checkRepeatNo(content);
}
}
}
}
}
function checkRepeatNo(manifest_no){
var manifestId = $("#id").val();
if(!manifestId){
manifestId = 0
}
console.log("manifestId-->"+manifestId);
if(manifest_no){
$.ajax({
url:"<%=basePath%>/manifest/checkRepeat?manifest_no="+manifest_no+"&manifestId="+manifestId,
success:function(data){
if(data.status != 200){
$("#waybill").val("");
$("#waybill").focus();
$("#waybillnomaster").val("")
layui.use('layer', function(){
var layer = layui.layer;
parent.layer.alert('主单号不能重复,请重新输入', {icon: 6});
});
}
}
});
}
}
</script>
</body>
</html>
\ No newline at end of file
... ...