作者 申海龙

excel 导入 模板下载 主 分单 先后顺序

@@ -30,6 +30,7 @@ import org.apache.commons.lang.StringUtils; @@ -30,6 +30,7 @@ import org.apache.commons.lang.StringUtils;
30 import org.apache.shiro.SecurityUtils; 30 import org.apache.shiro.SecurityUtils;
31 import org.slf4j.Logger; 31 import org.slf4j.Logger;
32 import org.slf4j.LoggerFactory; 32 import org.slf4j.LoggerFactory;
  33 +import org.springframework.beans.factory.annotation.Autowired;
33 import org.springframework.stereotype.Controller; 34 import org.springframework.stereotype.Controller;
34 import org.springframework.ui.Model; 35 import org.springframework.ui.Model;
35 import org.springframework.web.bind.annotation.RequestMapping; 36 import org.springframework.web.bind.annotation.RequestMapping;
@@ -43,6 +44,7 @@ import tools.Tools; @@ -43,6 +44,7 @@ import tools.Tools;
43 import tools.oclass.FemyList; 44 import tools.oclass.FemyList;
44 45
45 import javax.annotation.Resource; 46 import javax.annotation.Resource;
  47 +import javax.jnlp.PersistenceService;
46 import javax.servlet.http.HttpServletRequest; 48 import javax.servlet.http.HttpServletRequest;
47 import javax.servlet.http.HttpServletResponse; 49 import javax.servlet.http.HttpServletResponse;
48 import javax.servlet.http.HttpSession; 50 import javax.servlet.http.HttpSession;
@@ -51,6 +53,7 @@ import java.sql.Connection; @@ -51,6 +53,7 @@ import java.sql.Connection;
51 import java.sql.ResultSet; 53 import java.sql.ResultSet;
52 import java.sql.SQLException; 54 import java.sql.SQLException;
53 import java.sql.Statement; 55 import java.sql.Statement;
  56 +import java.text.ParseException;
54 import java.text.SimpleDateFormat; 57 import java.text.SimpleDateFormat;
55 import java.util.*; 58 import java.util.*;
56 59
@@ -118,7 +121,7 @@ public class ManifestController extends BasicController { @@ -118,7 +121,7 @@ public class ManifestController extends BasicController {
118 @Resource 121 @Resource
119 private SDCargoNameService sdCargoNameService; 122 private SDCargoNameService sdCargoNameService;
120 123
121 - @Resource 124 + @Resource
122 private SDCargoTypeService sdCargoTypeService; 125 private SDCargoTypeService sdCargoTypeService;
123 126
124 private BasicAgentEntity getAgent() { 127 private BasicAgentEntity getAgent() {
@@ -2224,7 +2227,10 @@ public class ManifestController extends BasicController { @@ -2224,7 +2227,10 @@ public class ManifestController extends BasicController {
2224 return model; 2227 return model;
2225 } 2228 }
2226 2229
2227 - 2230 + /**
  2231 + * excel 导入
  2232 + * @return
  2233 + */
2228 @RequestMapping(value = "/excelView") 2234 @RequestMapping(value = "/excelView")
2229 public String excelView(){ 2235 public String excelView(){
2230 return "manifest/excel_upload"; 2236 return "manifest/excel_upload";
@@ -2275,156 +2281,234 @@ public class ManifestController extends BasicController { @@ -2275,156 +2281,234 @@ public class ManifestController extends BasicController {
2275 2281
2276 for (ArrayList<String> arr: readResult) { 2282 for (ArrayList<String> arr: readResult) {
2277 String wbm = ""; 2283 String wbm = "";
2278 - if (!StringUtils.isBlank(arr.get(1))){  
2279 - if(arr.get(1).contains("-")){  
2280 -  
2281 - wbm = arr.get(1);  
2282 - }else {  
2283 - String s1 = arr.get(1);  
2284 - String substring = s1.substring(0, 3);  
2285 - String substring1 = s1.substring(3);  
2286 - wbm = substring+"-"+substring1;  
2287 - }  
2288 -  
2289 -  
2290 - //查询主单号时候存在  
2291 - ManifestEntity wbm1 = manifestService.findWbm(wbm);  
2292 - if (wbm1==null){  
2293 - ManifestEntity manifestEntity = new ManifestEntity();  
2294 - manifestEntity.setUSER_ID(userId);  
2295 - //主单号  
2296 - manifestEntity.setWaybillnomaster(wbm);  
2297 - //分单号  
2298 -  
2299 - //航班号  
2300 - manifestEntity.setFlightno(arr.get(3));  
2301 - //航班日期  
2302 - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");  
2303 - String s = arr.get(4);  
2304 - Date parse = simpleDateFormat.parse(s);  
2305 - manifestEntity.setFlightdate(parse);  
2306 - //承运人代码  
2307 - manifestEntity.setCarrier(arr.get(5));  
2308 - //运费支付方式  
2309 - manifestEntity.setPaymode(arr.get(6));  
2310 - //装货地代码  
2311 - manifestEntity.setOriginatingstation(arr.get(7));  
2312 - //卸货地代码  
2313 - manifestEntity.setDestinationstation(arr.get(8));  
2314 - //货物装载运输时间  
2315 - SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyyMMddHHmmss");  
2316 - manifestEntity.setStowagedate(simpleDateFormat1.parse(arr.get(9)));  
2317 - //海关关区代码  
2318 - manifestEntity.setCustomscode(arr.get(10));  
2319 -  
2320 - //中转启运地代码  
2321 -  
2322 - //中转目的地代码  
2323 -  
2324 - //货物件数  
2325 - manifestEntity.setTotalpiece(arr.get(13));  
2326 - //货物毛重  
2327 - manifestEntity.setTotalweight(arr.get(14));  
2328 - //货物简要描述  
2329 - manifestEntity.setProductname(arr.get(15));  
2330 - //发货人代码  
2331 - manifestEntity.setShpcusid(arr.get(16));  
2332 - //发货人名称  
2333 - manifestEntity.setCo_name(arr.get(17));  
2334 - //发货人地址  
2335 - manifestEntity.setCo_address(arr.get(18));  
2336 - //发货人国家代码  
2337 - manifestEntity.setSh_country(arr.get(19));  
2338 - //发货人传真  
2339 - manifestEntity.setSh_fax(arr.get(20));  
2340 - //发货人联系号码  
2341 - manifestEntity.setCo_telephone(arr.get(21));  
2342 - //收货人代码  
2343 - manifestEntity.setCnecusid(arr.get(22));  
2344 - //收货人名称  
2345 - manifestEntity.setSh_name(arr.get(23));  
2346 - //收货人地址  
2347 - manifestEntity.setSh_address(arr.get(24));  
2348 - //收货人城市  
2349 - manifestEntity.setSh_city(arr.get(25));  
2350 - //收货人国家代码  
2351 - manifestEntity.setSh_country(arr.get(26));  
2352 - //收货人传真  
2353 - manifestEntity.setSh_fax(arr.get(27));  
2354 - //收货人联系号码  
2355 - manifestEntity.setSh_telephone(arr.get(28));  
2356 - //危险品编号  
2357 -  
2358 - //危险品联系人姓名  
2359 -  
2360 - //危险品通讯方式类别代码  
2361 -  
2362 - //危险品联系人联系号码  
2363 -  
2364 - //货物海关状态代码  
2365 - manifestEntity.setCustomsstatus(arr.get(33));  
2366 -  
2367 - // 安检申报  
2368 - SecurityDeclarationEntity sd = new SecurityDeclarationEntity();  
2369 - sd.setSd_waybill(wbm);  
2370 - // 航空货物托运人名称  
2371 - sd.setSd_cargo_shipper_name(arr.get(34));  
2372 - // 航空货物销售代理人名称  
2373 - sd.setSd_cargo_agent_name(arr.get(35));  
2374 - // 航协资质编号  
2375 - if (!StringUtils.isBlank(arr.get(36))){  
2376 - sd.setSd_iata_number(arr.get(36));  
2377 - }  
2378 -  
2379 - sd.setSd_static("1");  
2380 - // 发布时间  
2381 - SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
2382 - String format = simpleDateFormat2.format(new Date());  
2383 - sd.setOperation_time(format);  
2384 - // 运输条件鉴定书  
2385 - if (!StringUtils.isBlank(arr.get(37))){  
2386 -  
2387 - String certificate = arr.get(37);  
2388 - if (certificate != null){  
2389 - String s2 = certificate.replaceAll(",", ",");  
2390 - sd.setSd_transportation_prove(s2);  
2391 - }  
2392 - }  
2393 -  
2394 - // 航空公司同意运输证明  
2395 - if (!StringUtils.isBlank(arr.get(38))){ 2284 + if (!StringUtils.isBlank(arr.get(1))) {
  2285 +
  2286 + if (arr.get(1).contains("-")) {
  2287 + wbm = arr.get(1);
  2288 + } else {
  2289 + String s1 = arr.get(1);
  2290 + String substring = s1.substring(0, 3);
  2291 + String substring1 = s1.substring(3);
  2292 + wbm = substring + "-" + substring1;
  2293 + }
  2294 + //如果分单不给
  2295 + if (StringUtils.isBlank(arr.get(2))) {
  2296 + // 查询主单号是否存在
  2297 + ManifestEntity wbm1 = manifestService.findWbm(wbm);
  2298 + if (wbm1 == null) {
  2299 + ManifestEntity manifestEntity = new ManifestEntity();
  2300 + manifestEntity.setUSER_ID(userId);
  2301 + // 主单号
  2302 + manifestEntity.setWaybillnomaster(wbm);
  2303 + // 航班号
  2304 + manifestEntity.setFlightno(arr.get(3));
  2305 + // 航班日期
  2306 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
  2307 + String s = arr.get(4);
  2308 + Date parse = simpleDateFormat.parse(s);
  2309 + manifestEntity.setFlightdate(parse);
  2310 + // 承运人代码
  2311 + manifestEntity.setCarrier(arr.get(5));
  2312 + // 运费支付方式
  2313 + manifestEntity.setPaymode(arr.get(6));
  2314 + // 装货地代码
  2315 + manifestEntity.setOriginatingstation(arr.get(7));
  2316 + // 卸货地代码
  2317 + manifestEntity.setDestinationstation(arr.get(8));
  2318 + // 货物装载运输时间
  2319 + SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyyMMddHHmmss");
  2320 + manifestEntity.setStowagedate(simpleDateFormat1.parse(arr.get(9)));
  2321 + // 海关关区代码
  2322 + manifestEntity.setCustomscode(arr.get(10));
  2323 + // 货物件数
  2324 +// String s3 = arr.get(11);
  2325 + manifestEntity.setTotalpiece(arr.get(11));
  2326 + // 货物毛重
  2327 +// String s1 = arr.get(12);
  2328 + manifestEntity.setTotalweight(arr.get(12));
  2329 + // 货物简要描述
  2330 + manifestEntity.setProductname(arr.get(13));
  2331 + // 发货人代码
  2332 + manifestEntity.setShpcusid(arr.get(14));
  2333 + // 发货人名称
  2334 + manifestEntity.setCo_name(arr.get(15));
  2335 + // 发货人地址
  2336 + manifestEntity.setCo_address(arr.get(16));
  2337 + // 发货人国家代码
  2338 + manifestEntity.setSh_country(arr.get(17));
  2339 + // 发货人传真
  2340 + manifestEntity.setSh_fax(arr.get(18));
  2341 + // 发货人联系号码
  2342 + manifestEntity.setCo_telephone(arr.get(19));
  2343 + // 收货人代码
  2344 + manifestEntity.setCnecusid(arr.get(20));
  2345 + // 收货人名称
  2346 + manifestEntity.setSh_name(arr.get(21));
  2347 + // 收货人地址
  2348 + manifestEntity.setSh_address(arr.get(22));
  2349 + // 收货人城市
  2350 + manifestEntity.setSh_city(arr.get(23));
  2351 + // 收货人国家代码
  2352 + manifestEntity.setSh_country(arr.get(24));
  2353 + // 收货人传真
  2354 + manifestEntity.setSh_fax(arr.get(25));
  2355 + // 收货人联系号码
  2356 + manifestEntity.setSh_telephone(arr.get(26));
  2357 +
  2358 + // 货物海关状态代码
  2359 + manifestEntity.setCustomsstatus(arr.get(27));
  2360 +
  2361 + // 安检申报
  2362 + SecurityDeclarationEntity sd = new SecurityDeclarationEntity();
  2363 + sd.setSd_waybill(wbm);
  2364 + // 航空货物托运人名称
  2365 + sd.setSd_cargo_shipper_name(arr.get(28));
  2366 + // 航空货物销售代理人名称
  2367 + sd.setSd_cargo_agent_name(arr.get(29));
  2368 + // 航协资质编号
  2369 + if (!StringUtils.isBlank(arr.get(30))) {
  2370 + sd.setSd_iata_number(arr.get(30));
  2371 + }
  2372 +
  2373 + sd.setSd_static("1");
  2374 + // 发布时间
  2375 + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  2376 + String format = simpleDateFormat2.format(new Date());
  2377 + sd.setOperation_time(format);
  2378 + // 运输条件鉴定书
  2379 + if (!StringUtils.isBlank(arr.get(31))) {
  2380 +
  2381 + String certificate = arr.get(31);
  2382 + if (certificate != null) {
  2383 + String s2 = certificate.replaceAll(",", ",");
  2384 + sd.setSd_transportation_prove(s2);
  2385 + }
  2386 + }
  2387 +
  2388 + // 航空公司同意运输证明
  2389 + if (!StringUtils.isBlank(arr.get(32))) {
  2390 +
  2391 + String prove = arr.get(32);
  2392 + if (prove != null) {
  2393 + String s2 = prove.replaceAll(",", ",");
  2394 + sd.setSd_transportation_prove(s2);
  2395 + }
  2396 + }
  2397 + // 用户ID
  2398 + sd.setUSER_ID(userId);
  2399 +
  2400 + // 航空货物性质
  2401 + SDCargoTypeEntity sdCargoTypeEntity = new SDCargoTypeEntity();
  2402 + sdCargoTypeEntity.setSd_waybill(wbm);
  2403 + sdCargoTypeEntity.setSd_cargo_type(arr.get(33));
  2404 + sdCargoTypeService.save(sdCargoTypeEntity);
  2405 +
  2406 + // 航空货物品名
  2407 + String replace = arr.get(34).replace(",", ",");
  2408 +
  2409 + String[] cargoName = replace.split(",");
  2410 + for (int i = 0; i < cargoName.length; i++) {
  2411 + SDCargoNameEntity sdCargoNameEntity = new SDCargoNameEntity();
  2412 + sdCargoNameEntity.setSd_waybill(wbm);
  2413 + sdCargoNameEntity.setSd_cargo_name(cargoName[i]);
  2414 + sdCargoNameService.save(sdCargoNameEntity);
  2415 + }
  2416 + securityDeclarationService.save(sd);
  2417 +
  2418 + manifestService.save(manifestEntity);
  2419 +
  2420 + model.setStatus(200);
  2421 + return model;
  2422 +
  2423 + }else {
  2424 + model.setStatus(201);
  2425 + model.setMsg(wbm1.getWaybillnomaster() + "单号已存在");
  2426 + break;
  2427 + }
  2428 + }else {
2396 2429
2397 - String prove = arr.get(38);  
2398 - if (prove != null){  
2399 - String s2 = prove.replaceAll(",", ",");  
2400 - sd.setSd_transportation_prove(s2); 2430 + ManifestEntity wbm1 = manifestService.findWbm(wbm);
  2431 + if(wbm1 == null){
  2432 +
  2433 + model.setStatus(202);
  2434 + model.setMsg("请先添加主单号");
  2435 + break;
  2436 + }else {
  2437 + String waybill = preparesecondaryServer.findWaybill(arr.get(2));
  2438 +
  2439 + if (waybill != arr.get(2)) {
  2440 +
  2441 + PreparesecondaryEntity seconday = new PreparesecondaryEntity();
  2442 + seconday.setPreparemasterid(wbm1.getId());
  2443 + // 主单
  2444 + seconday.setWaybillnomaster(wbm);
  2445 + // 分单
  2446 + seconday.setWaybillnosecondary(arr.get(2));
  2447 + // 航班号
  2448 + seconday.setFlightno(arr.get(3));
  2449 + // 航班日期
  2450 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
  2451 + String s = arr.get(4);
  2452 + Date parse = simpleDateFormat.parse(s);
  2453 + seconday.setFlightdate(parse);
  2454 + // 承运人代码
  2455 + seconday.setCarrier(arr.get(5));
  2456 + // 运费支付方式
  2457 + seconday.setPaymode(arr.get(6));
  2458 + // 装货地代码
  2459 + seconday.setOriginatingstation(arr.get(7));
  2460 + // 卸货地代码
  2461 + seconday.setDestinationstation(arr.get(8));
  2462 + // 货物装载运输时间
  2463 + SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyyMMddHHmmss");
  2464 + seconday.setStowagedate(simpleDateFormat1.parse(arr.get(9)));
  2465 + // 海关关区代码
  2466 + seconday.setCustomscode(arr.get(10));
  2467 + // 货物件数
  2468 + seconday.setTotalpiece(arr.get(11));
  2469 + // 货物毛重
  2470 + seconday.setTotalweight(arr.get(12));
  2471 + // 货物简要描述
  2472 + seconday.setProductname(arr.get(13));
  2473 + // 发货人代码
  2474 + seconday.setShpcusid(arr.get(14));
  2475 + // 发货人名称
  2476 + seconday.setCo_name(arr.get(15));
  2477 + // 发货人地址
  2478 + seconday.setCo_address(arr.get(16));
  2479 + // 发货人国家代码
  2480 + seconday.setSh_country(arr.get(17));
  2481 + // 发货人传真
  2482 + seconday.setSh_fax(arr.get(18));
  2483 + // 发货人联系号码
  2484 + seconday.setCo_telephone(arr.get(19));
  2485 + // 收货人代码
  2486 + seconday.setCnecusid(arr.get(20));
  2487 + // 收货人名称
  2488 + seconday.setSh_name(arr.get(21));
  2489 + // 收货人地址
  2490 + seconday.setSh_address(arr.get(22));
  2491 + // 收货人城市
  2492 + seconday.setSh_city(arr.get(23));
  2493 + // 收货人国家代码
  2494 + seconday.setSh_country(arr.get(24));
  2495 + // 收货人传真
  2496 + seconday.setSh_fax(arr.get(25));
  2497 + // 收货人联系号码
  2498 + seconday.setSh_telephone(arr.get(26));
  2499 +
  2500 + // 货物海关状态代码
  2501 + seconday.setCustomsstatus(arr.get(27));
  2502 + seconday.setCreateDate(new Date());
  2503 + preparesecondaryServer.save(seconday);
  2504 + model.setStatus(200);
  2505 + return model;
  2506 + } else {
  2507 + model.setStatus(201);
  2508 + model.setMsg(waybill + "分单号已存在");
  2509 + break;
2401 } 2510 }
2402 } 2511 }
2403 - // 用户ID  
2404 - sd.setUSER_ID(userId);  
2405 -  
2406 - // 航空货物性质  
2407 - SDCargoTypeEntity sdCargoTypeEntity = new SDCargoTypeEntity();  
2408 - sdCargoTypeEntity.setSd_waybill(wbm);  
2409 - sdCargoTypeEntity.setSd_cargo_type(arr.get(39));  
2410 - sdCargoTypeService.save(sdCargoTypeEntity);  
2411 -  
2412 - // 航空货物品名  
2413 - String[] cargoName = arr.get(40).replace(",",",").split(",");  
2414 - for (int i = 0; i < cargoName.length; i++){  
2415 - SDCargoNameEntity sdCargoNameEntity = new SDCargoNameEntity();  
2416 - sdCargoNameEntity.setSd_waybill(wbm);  
2417 - sdCargoNameEntity.setSd_cargo_name(cargoName[i]);  
2418 - sdCargoNameService.save(sdCargoNameEntity);  
2419 - }  
2420 - securityDeclarationService.save(sd);  
2421 -  
2422 - manifestService.save(manifestEntity);  
2423 - model.setStatus(200);  
2424 - }else {  
2425 - model.setStatus(201);  
2426 - model.setMsg(wbm1.getWaybillnomaster()+"单号已存在");  
2427 - break;  
2428 } 2512 }
2429 }else { 2513 }else {
2430 break; 2514 break;
@@ -2439,4 +2523,5 @@ public class ManifestController extends BasicController { @@ -2439,4 +2523,5 @@ public class ManifestController extends BasicController {
2439 return model; 2523 return model;
2440 } 2524 }
2441 2525
  2526 +
2442 } 2527 }
@@ -11,7 +11,7 @@ import javax.persistence.Table; @@ -11,7 +11,7 @@ import javax.persistence.Table;
11 */ 11 */
12 @Entity 12 @Entity
13 @Table(name = "SD_CARGO_TYPE") 13 @Table(name = "SD_CARGO_TYPE")
14 -public class SDCargoTypeEntity extends IdEntity { 14 +public class SDCargoTypeEntity extends IdEntity{
15 15
16 /** 16 /**
17 * 运单号 17 * 运单号
@@ -43,4 +43,7 @@ JpaSpecificationExecutor<PreparesecondaryEntity>{ @@ -43,4 +43,7 @@ JpaSpecificationExecutor<PreparesecondaryEntity>{
43 @Modifying 43 @Modifying
44 @Query(value = "DELETE FROM PREPARESECONDARY WHERE PREPAREMASTERID = ?1", nativeQuery = true) 44 @Query(value = "DELETE FROM PREPARESECONDARY WHERE PREPAREMASTERID = ?1", nativeQuery = true)
45 void deleteSub(Long id); 45 void deleteSub(Long id);
  46 +
  47 + @Query(value = "SELECT WAYBILLNOSECONDARY FROM PREPARESECONDARY WHERE WAYBILLNOMASTER = ?1", nativeQuery = true)
  48 + String findWaybill(String wbm);
46 } 49 }
@@ -94,4 +94,9 @@ public class PreparesecondaryService extends BasicService<PreparesecondaryEntity @@ -94,4 +94,9 @@ public class PreparesecondaryService extends BasicService<PreparesecondaryEntity
94 return preparesecondaryRepository.queryByUserId(user_id); 94 return preparesecondaryRepository.queryByUserId(user_id);
95 } 95 }
96 96
  97 + public String findWaybill(String wbm){
  98 +
  99 + return preparesecondaryRepository.findWaybill(wbm);
  100 + }
  101 +
97 } 102 }
@@ -19,6 +19,7 @@ public class SDCargoNameService extends BasicService<SDCargoNameEntity> { @@ -19,6 +19,7 @@ public class SDCargoNameService extends BasicService<SDCargoNameEntity> {
19 @Autowired 19 @Autowired
20 private SDCargoNameRepository sdCargoNameRepository; 20 private SDCargoNameRepository sdCargoNameRepository;
21 21
  22 + @Transactional
22 public SDCargoNameEntity save(SDCargoNameEntity sdCargoNameEntity){ 23 public SDCargoNameEntity save(SDCargoNameEntity sdCargoNameEntity){
23 return sdCargoNameRepository.save(sdCargoNameEntity); 24 return sdCargoNameRepository.save(sdCargoNameEntity);
24 } 25 }
@@ -19,7 +19,7 @@ public class SDCargoTypeService extends BasicService<SDCargoTypeEntity> { @@ -19,7 +19,7 @@ public class SDCargoTypeService extends BasicService<SDCargoTypeEntity> {
19 @Autowired 19 @Autowired
20 private SDCargoTypeRepository sdCargoTypeRepository; 20 private SDCargoTypeRepository sdCargoTypeRepository;
21 21
22 - 22 + @Transactional
23 public SDCargoTypeEntity save(SDCargoTypeEntity sdCargoTypeEntity){ 23 public SDCargoTypeEntity save(SDCargoTypeEntity sdCargoTypeEntity){
24 return sdCargoTypeRepository.save(sdCargoTypeEntity); 24 return sdCargoTypeRepository.save(sdCargoTypeEntity);
25 } 25 }
@@ -16,6 +16,7 @@ import org.springframework.data.domain.Page; @@ -16,6 +16,7 @@ import org.springframework.data.domain.Page;
16 import org.springframework.data.domain.PageRequest; 16 import org.springframework.data.domain.PageRequest;
17 import org.springframework.data.jpa.domain.Specification; 17 import org.springframework.data.jpa.domain.Specification;
18 import org.springframework.stereotype.Service; 18 import org.springframework.stereotype.Service;
  19 +import org.springframework.transaction.annotation.Transactional;
19 20
20 import java.util.Date; 21 import java.util.Date;
21 22
@@ -50,7 +51,7 @@ public class SecurityDeclarationService extends BasicService<SecurityManifestEnt @@ -50,7 +51,7 @@ public class SecurityDeclarationService extends BasicService<SecurityManifestEnt
50 return securityDeclarationRepository.findWaybill(waybill); 51 return securityDeclarationRepository.findWaybill(waybill);
51 } 52 }
52 53
53 - 54 + @Transactional
54 public SecurityDeclarationEntity save(SecurityDeclarationEntity securityDeclarationEntity){ 55 public SecurityDeclarationEntity save(SecurityDeclarationEntity securityDeclarationEntity){
55 return securityDeclarationRepository.save(securityDeclarationEntity); 56 return securityDeclarationRepository.save(securityDeclarationEntity);
56 } 57 }
@@ -84,8 +84,10 @@ @@ -84,8 +84,10 @@
84 parent.layer.close(index); 84 parent.layer.close(index);
85 }else if (data.status == 201){ 85 }else if (data.status == 201){
86 alert(data.msg); 86 alert(data.msg);
  87 + }else if(data.status == 202){
  88 + alert(data.msg);
87 }else { 89 }else {
88 - alert("网络异常") 90 + alert("网络异常");
89 } 91 }
90 } 92 }
91 }); 93 });