|
@@ -42,16 +42,23 @@ public class CjhsServiceImpl implements CjhsService {
|
|
@Override
|
|
@Override
|
|
public CjhsEntity findCjhsByGksbbh(Long gksbbh) {
|
|
public CjhsEntity findCjhsByGksbbh(Long gksbbh) {
|
|
CjhsEntity cjhs = null;
|
|
CjhsEntity cjhs = null;
|
|
- ZysqbpEntity vo = zysqbpService.findOne(gksbbh);
|
|
|
|
|
|
+ //yjpt 危货申报单 用于获取船名
|
|
|
|
+ ZysqbpEntity zysqbpEntity = zysqbpService.findOne(gksbbh);
|
|
// 获取比对数据
|
|
// 获取比对数据
|
|
try {
|
|
try {
|
|
|
|
+ //根据危货申报ID获得危货申报和海事比对的信息 此比对表位于yjpt库中
|
|
List<CjhsDbEntity> cjhsdbList = cjhsDbService.findByGksbbh(gksbbh);
|
|
List<CjhsDbEntity> cjhsdbList = cjhsDbService.findByGksbbh(gksbbh);
|
|
|
|
+
|
|
if (cjhsdbList == null || cjhsdbList.size() <= 0) {
|
|
if (cjhsdbList == null || cjhsdbList.size() <= 0) {
|
|
- List<DtywCbsbEntity> dtywCbsbEntityList = dtywCbsbService.findByZwcm(vo.getCm());
|
|
|
|
|
|
+ /***************比对库中根据危货申报ID没有找到匹配数据*****************/
|
|
|
|
+ List<DtywCbsbEntity> dtywCbsbEntityList = dtywCbsbService.findByZwcm(zysqbpEntity.getCm());//根据船名获得“更新时间”最新的一条数据
|
|
if (dtywCbsbEntityList != null && dtywCbsbEntityList.size() > 0) {
|
|
if (dtywCbsbEntityList != null && dtywCbsbEntityList.size() > 0) {
|
|
|
|
+ //yjpt比对库中没有匹配数据,从前置库海事申报table中根据船名拿到一个申报数据
|
|
DtywCbsbEntity dtywCbsbEntity = dtywCbsbEntityList.get(0);
|
|
DtywCbsbEntity dtywCbsbEntity = dtywCbsbEntityList.get(0);
|
|
cjhs = changeFromDtywCbsb(dtywCbsbEntity);
|
|
cjhs = changeFromDtywCbsb(dtywCbsbEntity);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //讲匹配到的第一条输入存入yjpt库比对表,不管匹配是否准确(匹配规则:根据船名获得“更新时间”最新的一条数据)
|
|
if (cjhs != null && cjhs.getHshwList() != null) {
|
|
if (cjhs != null && cjhs.getHshwList() != null) {
|
|
CjhsHwEntity cjhsHw = cjhs.getHshwList().get(0);
|
|
CjhsHwEntity cjhsHw = cjhs.getHshwList().get(0);
|
|
CjhsDbEntity db = new CjhsDbEntity();
|
|
CjhsDbEntity db = new CjhsDbEntity();
|
|
@@ -60,27 +67,32 @@ public class CjhsServiceImpl implements CjhsService {
|
|
db.setXh(cjhsHw.getXh());
|
|
db.setXh(cjhsHw.getXh());
|
|
db.setBsxh(cjhsHw.getBsxh());
|
|
db.setBsxh(cjhsHw.getBsxh());
|
|
cjhsDbService.save(db);
|
|
cjhsDbService.save(db);
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- CjhsDbEntity cjhsdbEntity = cjhsdbList.get(0);
|
|
|
|
|
|
+ }//end if not null , save into yjpt.T_CJHS_GKBD
|
|
|
|
+ }//end if
|
|
|
|
+ else {
|
|
|
|
+ CjhsDbEntity cjhsdbEntity = cjhsdbList.get(0);//比对库中根据危货申报ID找到匹配数据(不管几条,拿第一条,理论上也只有一条)
|
|
|
|
+ //用比对库中拿到的海事申报编号到前置库:危险品申报信息表(DTYW_CBSB)拿到海事申报的详细信息
|
|
DtywCbsbEntity dtywCbsbEntity = dtywCbsbService.findBySbdbh(cjhsdbEntity.getHssbbh());
|
|
DtywCbsbEntity dtywCbsbEntity = dtywCbsbService.findBySbdbh(cjhsdbEntity.getHssbbh());
|
|
|
|
+ //将拿到的海事申报的entity转化处理下,映射成CjhsEntity
|
|
cjhs = changeFromDtywCbsb(dtywCbsbEntity);
|
|
cjhs = changeFromDtywCbsb(dtywCbsbEntity);
|
|
- }
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
|
+ }//end if else
|
|
|
|
+ }//end try
|
|
|
|
+ catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
- }
|
|
|
|
|
|
+ }//end catch
|
|
return cjhs;
|
|
return cjhs;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 从海事实体转成本地实体
|
|
* 从海事实体转成本地实体
|
|
- *
|
|
|
|
|
|
+ * DtywCbsbEntity --》 CjhsEntity
|
|
* @param entity
|
|
* @param entity
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public CjhsEntity changeFromDtywCbsb(DtywCbsbEntity entity) {
|
|
public CjhsEntity changeFromDtywCbsb(DtywCbsbEntity entity) {
|
|
- // 转换船舶申报
|
|
|
|
|
|
+ // 转换船舶申报 不含货物
|
|
CjhsEntity cjhs = changeFromDtywCbsbNoHw(entity);
|
|
CjhsEntity cjhs = changeFromDtywCbsbNoHw(entity);
|
|
|
|
+ //处理货物
|
|
List<CjhsHwEntity> cjhsHwList = findCjhsHwListByCbsb(entity);
|
|
List<CjhsHwEntity> cjhsHwList = findCjhsHwListByCbsb(entity);
|
|
if (cjhsHwList != null && cjhsHwList.size() > 0) {
|
|
if (cjhsHwList != null && cjhsHwList.size() > 0) {
|
|
cjhs.setHshwList(cjhsHwList);
|
|
cjhs.setHshwList(cjhsHwList);
|
|
@@ -98,17 +110,20 @@ public class CjhsServiceImpl implements CjhsService {
|
|
public List<CjhsHwEntity> findCjhsHwListByCbsb(DtywCbsbEntity entity) {
|
|
public List<CjhsHwEntity> findCjhsHwListByCbsb(DtywCbsbEntity entity) {
|
|
List<CjhsHwEntity> cjhsHwList = null;
|
|
List<CjhsHwEntity> cjhsHwList = null;
|
|
if (entity.getSbdlb().trim().equals("CS")) {
|
|
if (entity.getSbdlb().trim().equals("CS")) {
|
|
|
|
+ /********船舶申报“散装”货物*********/
|
|
List<DtywCbsbszHwEntity> cbsbszList = dtywCbsbService.findCbsbszHwBySbdbh(entity.getId());
|
|
List<DtywCbsbszHwEntity> cbsbszList = dtywCbsbService.findCbsbszHwBySbdbh(entity.getId());
|
|
cjhsHwList = changeFromCbsbszHw(cbsbszList);
|
|
cjhsHwList = changeFromCbsbszHw(cbsbszList);
|
|
- } else if (entity.getSbdlb().trim().equals("CB")) {
|
|
|
|
- List<DtywCbsbgtHwEntity> cbsbgtList = dtywCbsbService
|
|
|
|
- .findCbsbgtHwBySbdbh(entity.getId());
|
|
|
|
|
|
+ }//end if
|
|
|
|
+ else if (entity.getSbdlb().trim().equals("CB")) {
|
|
|
|
+ /********船舶申报“固体”货物*********/
|
|
|
|
+ List<DtywCbsbgtHwEntity> cbsbgtList = dtywCbsbService.findCbsbgtHwBySbdbh(entity.getId());
|
|
cjhsHwList = changeFromCbsbgtHw(cbsbgtList);
|
|
cjhsHwList = changeFromCbsbgtHw(cbsbgtList);
|
|
- } else if (entity.getSbdlb().trim().equals("CY")) {
|
|
|
|
- List<DtywCbsbytHwEntity> cbsbytList = dtywCbsbService
|
|
|
|
- .findCbsbytHwBySbdbh(entity.getId());
|
|
|
|
|
|
+ } //end else if
|
|
|
|
+ else if (entity.getSbdlb().trim().equals("CY")) {
|
|
|
|
+ /********船舶申报“液体”货物*********/
|
|
|
|
+ List<DtywCbsbytHwEntity> cbsbytList = dtywCbsbService.findCbsbytHwBySbdbh(entity.getId());
|
|
cjhsHwList = changeFromCbsbytHw(cbsbytList);
|
|
cjhsHwList = changeFromCbsbytHw(cbsbytList);
|
|
- }
|
|
|
|
|
|
+ }//end
|
|
return cjhsHwList;
|
|
return cjhsHwList;
|
|
}
|
|
}
|
|
|
|
|