作者 shenhailong

远程调用 预配录入 添加 货主信息与主单号 绑定关系

... ... @@ -1268,7 +1268,7 @@ public class ManifestController extends BasicController {
|| StringUtils.isBlank(manifest.getDestinationstation()) || StringUtils.isBlank(manifest.getTotalpiece())
|| StringUtils.isBlank(manifest.getTotalweight()) || StringUtils.isBlank(manifest.getPaymode())
|| StringUtils.isBlank(manifest.getCustomsstatus()) || StringUtils.isBlank(manifest.getCustomscode())
|| StringUtils.isBlank(manifest.getName_ofgoods()) || StringUtils.isBlank(manifest.getCo_company())
|| StringUtils.isBlank(manifest.getProductname()) || StringUtils.isBlank(manifest.getCo_company())
|| StringUtils.isBlank(manifest.getCo_address()) || StringUtils.isBlank(manifest.getShpcusid())
|| StringUtils.isBlank(manifest.getCo_country()) || StringUtils.isBlank(manifest.getSh_company())
|| StringUtils.isBlank(manifest.getSh_address()) || StringUtils.isBlank(manifest.getCnecusid())
... ... @@ -1304,6 +1304,95 @@ public class ManifestController extends BasicController {
manifest.setCarrier(carrier);
manifest.setFlightno(flightno);
// 发货人 简称 跟类型 用,隔开
String de_trstation = manifest.getDe_trstation();
// 订舱代理 。。。。。。。。。
String de_packing = manifest.getDe_packing();
// 操作代理 。。。。。。。。。
String de_remarks = manifest.getDe_remarks();
// 货主信息
if(StringUtils.isBlank(de_trstation) && StringUtils.isBlank(de_packing) && StringUtils.isBlank(de_remarks)){
model.setStatus(205);
model.setMsg("货主信息三选一,不能为空");
return model;
}else {
if (StringUtils.isNotBlank(de_trstation)){
String s = de_trstation.replace(",", ",");
String[] split = s.split(",");
Long id = hzInfoService.selectForShortType(split[0], split[1]);
if (id != null){
HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
hzwaybllinfoEntity.setHzinfor_id(String.valueOf(id));
hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
if (hzWaybillService.awbHzid(hzwaybllinfoEntity) != 0){
model.setStatus(209);
model.setMsg("发货人不能重复录入");
return model;
}else {
hzWaybillService.save(hzwaybllinfoEntity);
}
}else {
model.setStatus(206);
model.setMsg("发货人,简称和类型有误!");
hzWaybillService.deleteAlls(manifest.getWaybillnomaster());
return model;
}
}
if (StringUtils.isNotBlank(de_packing)){
String s = de_packing.replace(",", ",");
String[] split = s.split(",");
Long id = hzInfoService.selectForShortType(split[0], split[1]);
if (id != null){
HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
hzwaybllinfoEntity.setHzinfor_id(String.valueOf(id));
hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
if (hzWaybillService.awbHzid(hzwaybllinfoEntity) != 0 ){
model.setStatus(210);
model.setMsg("订舱代理不能重复录入");
hzWaybillService.deleteAlls(manifest.getWaybillnomaster());
return model;
}else {
hzWaybillService.save(hzwaybllinfoEntity);
}
}else {
model.setStatus(207);
model.setMsg("订舱代理,简称和类型有误!");
hzWaybillService.deleteAlls(manifest.getWaybillnomaster());
return model;
}
}
if (StringUtils.isNotBlank(de_remarks)){
String s = de_remarks.replace(",", ",");
String[] split = s.split(",");
Long id = hzInfoService.selectForShortType(split[0], split[1]);
if (id != null){
HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
hzwaybllinfoEntity.setHzinfor_id(String.valueOf(id));
hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
if (hzWaybillService.awbHzid(hzwaybllinfoEntity) != 0){
model.setStatus(211);
model.setMsg("操作代理不能重复录入");
return model;
}else {
hzWaybillService.save(hzwaybllinfoEntity);
}
}else {
model.setStatus(208);
model.setMsg("操作代理,简称和类型有误!");
return model;
}
}
}
// 判断主单是否存在
ManifestEntity wbm = manifestService.findWbm(manifest.getWaybillnomaster());
... ... @@ -1321,6 +1410,9 @@ public class ManifestController extends BasicController {
manifest.setResponse_text(type.getName());
manifest.setSave_time(System.currentTimeMillis());
manifest.setDe_trstation("");
manifest.setDe_packing("");
manifest.setDe_remarks("");
manifestService.save(manifest);
model.setData(manifest);
... ... @@ -1363,7 +1455,7 @@ public class ManifestController extends BasicController {
pe.setPaymode(manifest.getPaymode());
pe.setCustomsstatus(manifest.getCustomsstatus());
pe.setCustomscode(manifest.getCustomscode());
pe.setName_ofgoods(manifest.getName_ofgoods());
pe.setProductname(manifest.getProductname());
pe.setCo_company(manifest.getCo_company());
pe.setCo_address(manifest.getCo_address());
pe.setShpcusid(manifest.getShpcusid());
... ...
... ... @@ -44,4 +44,7 @@ public interface HzInfoRepository extends PagingAndSortingRepository<HZSHIPPERIN
@Query(value = "select * from HZ_SHIPPER_INFORMATION where id=?1 and delete_flag = 1", nativeQuery = true)
HZSHIPPERINFORMATIONEntity findOnes(Long id);
@Query(value = "select id from HZ_SHIPPER_INFORMATION where for_short=?1 and the_shipper_type=?2 and delete_flag=1", nativeQuery = true)
Long selectForShortType(String forshort, String type);
}
... ...
... ... @@ -24,6 +24,8 @@ public interface HzWaybillRepository extends PagingAndSortingRepository<HZWAYBLL
@Query(value = "select * from HZ_WAYBILL_INFO where waybill_id = ?1", nativeQuery = true)
List<HZWAYBLLINFOEntity> findHzId(String wabyill);
@Query(value = "select count(*) from HZ_WAYBILL_INFO where waybill_id=?1 and hzinfor_id=?2", nativeQuery = true)
int awbHzId(String awb, String hzId);
}
... ...
... ... @@ -87,4 +87,11 @@ public class HzInfoService extends BasicService<HZSHIPPERINFORMATIONEntity> {
return hzInfoRepository.findOperaion();
}
// 通过简称类型查看是否存在
public Long selectForShortType(String forshort, String type){
return hzInfoRepository.selectForShortType(forshort, type);
}
}
... ...
... ... @@ -5,8 +5,10 @@ import com.agent.entity.agent.HZWAYBLLINFOEntity;
import com.agent.repository.system.HzWaybillRepository;
import com.agent.service.BasicService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.beans.Transient;
import java.util.List;
/**
... ... @@ -19,8 +21,12 @@ public class HzWaybillService extends BasicService<HZSHIPPERINFORMATIONEntity> {
@Resource
private HzWaybillRepository hzWaybillRepository;
public HZWAYBLLINFOEntity save(HZWAYBLLINFOEntity hzwaybllinfoEntity){
return hzWaybillRepository.save(hzwaybllinfoEntity);
return hzWaybillRepository.save(hzwaybllinfoEntity);
}
public List<HZWAYBLLINFOEntity> findHzId(String waybill){
... ... @@ -31,4 +37,11 @@ public class HzWaybillService extends BasicService<HZSHIPPERINFORMATIONEntity> {
return hzWaybillRepository.deleteAlls(waybill);
}
public int awbHzid(HZWAYBLLINFOEntity hzwaybllinfoEntity){
return hzWaybillRepository.awbHzId(hzwaybllinfoEntity.getWaybill_id(), hzwaybllinfoEntity.getHzinfor_id());
}
}
... ...