正在显示
10 个修改的文件
包含
760 行增加
和
0 行删除
1 | +package com.tianbo.analysis.controller; | ||
2 | + | ||
3 | +import com.tianbo.analysis.model.ORIGINMANIFESTMASTER; | ||
4 | +import com.tianbo.analysis.model.Originmanifestsecondary; | ||
5 | +import com.tianbo.analysis.model.ResultJson; | ||
6 | +import com.tianbo.analysis.service.UpfileOrigService; | ||
7 | +import com.tianbo.analysis.service.UpfileSecondaryService; | ||
8 | + | ||
9 | +import com.tianbo.analysis.tools.ExcelUtils; | ||
10 | +import org.apache.commons.lang.StringUtils; | ||
11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
12 | +import org.springframework.stereotype.Controller; | ||
13 | +import org.springframework.transaction.annotation.Transactional; | ||
14 | +import org.springframework.web.bind.annotation.*; | ||
15 | +import org.springframework.web.multipart.MultipartFile; | ||
16 | + | ||
17 | +import javax.servlet.http.HttpServletRequest; | ||
18 | +import java.text.SimpleDateFormat; | ||
19 | +import java.util.*; | ||
20 | +import java.util.regex.Pattern; | ||
21 | + | ||
22 | +@Controller | ||
23 | +@RequestMapping("/upfile") | ||
24 | +public class UpfileJsonController { | ||
25 | + | ||
26 | + @Autowired | ||
27 | + UpfileOrigService upfileService; | ||
28 | + @Autowired | ||
29 | + UpfileSecondaryService upfileSecondaryService; | ||
30 | + @PostMapping("upfile.json") | ||
31 | + @Transactional | ||
32 | + @ResponseBody | ||
33 | + public ResultJson uploadFileExcel(@RequestParam(value = "file") MultipartFile file, HttpServletRequest request){ | ||
34 | + int msg=0; | ||
35 | + Pattern pattern= Pattern.compile("[0-9]*"); | ||
36 | + SimpleDateFormat format=new SimpleDateFormat( "yyyy-MM-dd"); | ||
37 | + List<ArrayList<String>> readResult = null;//总行记录 | ||
38 | + try { | ||
39 | + //判断文件是否为空 | ||
40 | + if (file.isEmpty()) { | ||
41 | + return new ResultJson("400","上传文件为空"); | ||
42 | + } | ||
43 | + //判断文件大小 | ||
44 | + long size = file.getSize(); | ||
45 | + String name = file.getOriginalFilename(); | ||
46 | + if (StringUtils.isBlank(name) || size == 0) { | ||
47 | + return new ResultJson("400","上传文件为空"); | ||
48 | + } | ||
49 | + String postfix = ExcelUtils.getPostfix(name); | ||
50 | + //读取文件内容 | ||
51 | + if (StringUtils.equals("xlsx", postfix)) { | ||
52 | + readResult = ExcelUtils.readXlsx(file); | ||
53 | + } else if (StringUtils.equals("xls", postfix)) { | ||
54 | + readResult = ExcelUtils.readXls(file); | ||
55 | + } else { | ||
56 | + return new ResultJson("400","上传文件类型错误"); | ||
57 | + } | ||
58 | + if (readResult == null || readResult.size() == 0) { | ||
59 | + return new ResultJson("400","上传文件解析失败"); } | ||
60 | + for (ArrayList<String> arr : readResult) { | ||
61 | + ORIGINMANIFESTMASTER or=new ORIGINMANIFESTMASTER(); | ||
62 | + or.setAutoid(UUID.randomUUID().toString()); | ||
63 | + if(pattern.matcher(arr.get(2)).matches()){ | ||
64 | + or.setWaybillnomaster(arr.get(2).substring(0,3)+"-"+arr.get(2).substring(3)); | ||
65 | + }else{ | ||
66 | + or.setWaybillnomaster(arr.get(2)); | ||
67 | + } | ||
68 | + or.setSegment(arr.get(103)+"-"+arr.get(104));//航段 | ||
69 | + or.setOriginatingstation(arr.get(103));//起始站 | ||
70 | + or.setDestinationstation(arr.get(104));//目的站 | ||
71 | + or.setTotalweight(arr.get(8));//总重量 | ||
72 | + or.setTotalpiece(arr.get(6));//总件数 | ||
73 | + or.setManifesttotalpiece(arr.get(6));//舱单件数 | ||
74 | + or.setManifesttotalweight(arr.get(8));//舱单重量 | ||
75 | + or.setFlightno(arr.get(64)+arr.get(65));//航班号 | ||
76 | + if(pattern.matcher(arr.get(10)).matches()){ | ||
77 | + or.setProductname("CONSOLE"); | ||
78 | + }else{ | ||
79 | + if(arr.get(10).length()>150){ | ||
80 | + or.setProductname(arr.get(10).substring(0,100)); | ||
81 | + }else{ | ||
82 | + or.setProductname(arr.get(10));//货物描述 | ||
83 | + } | ||
84 | + } | ||
85 | + or.setCarrier1(arr.get(64));//承运人1 | ||
86 | + or.setOriginatingstationBill(arr.get(103)); | ||
87 | + or.setDestinationstationBill(arr.get(104)); | ||
88 | + or.setArrivalstation1(arr.get(104));//到达城市1 | ||
89 | + or.setPaymode("PP");//付费方式 | ||
90 | + or.setCustomscode("4604");//海关关区代码 | ||
91 | + if(arr.get(89)!=null && arr.get(89)!=""){ | ||
92 | + or.setShippername(arr.get(89));//发货人名称 | ||
93 | + }else{ | ||
94 | + or.setShippername("SHIPPER"); | ||
95 | + } | ||
96 | + or.setShipperaddress(arr.get(105));//发货人地址 | ||
97 | + if(arr.get(50)!=null && arr.get(50)!=""){ | ||
98 | + or.setConsigneename(arr.get(50));//收货人名称 | ||
99 | + }else{ | ||
100 | + or.setConsigneename("CONSIGNEER");//收货人名称 | ||
101 | + } | ||
102 | + or.setConsigneeaddress(arr.get(47));//收货人地址 | ||
103 | + or.setCreatedate(new Date());//创建日期yyyy-MM-dd HH:mm:ss | ||
104 | + or.setFlightDate(format.parse(arr.get(66)));//航班日期yyyy-MM-dd | ||
105 | + or.setStatus("17");//操作状态 | ||
106 | + or.setIsbatch("T");//分批标识 | ||
107 | + or.setShipperCountrycode(arr.get(86));//发货人国家代码 | ||
108 | + or.setShipperPhone(arr.get(106));//发货人联系电话 | ||
109 | + or.setConsigneeCountrycode(arr.get(49));//收货人国家代码 | ||
110 | + or.setSpecificConsigneename(arr.get(50));//具体收货人名称 | ||
111 | + or.setSpecificConsigneePhone(arr.get(51));//具体收货人电话 | ||
112 | + or.setConsigneePhone(arr.get(51));//收货人电话 | ||
113 | + int result=upfileService.insert(or); | ||
114 | + if(result>0){ | ||
115 | + msg=1; | ||
116 | + } | ||
117 | + } | ||
118 | + } catch (Exception e) { | ||
119 | + e.printStackTrace(); | ||
120 | + } | ||
121 | + return msg>0?new ResultJson("200","导入成功"):new ResultJson("500","导入失效"); | ||
122 | + } | ||
123 | + | ||
124 | + @PostMapping("upfileSecondary.json") | ||
125 | + @Transactional | ||
126 | + @ResponseBody | ||
127 | + public ResultJson uploadSecondary(@RequestParam(value = "file") MultipartFile file, HttpServletRequest request){ | ||
128 | + Pattern pattern= Pattern.compile("[0-9]*"); | ||
129 | + String waybill=null; | ||
130 | + int msg=0; | ||
131 | + SimpleDateFormat format=new SimpleDateFormat( "yyyy-MM-dd"); | ||
132 | + List<ArrayList<String>> readResult = null;//总行记录 | ||
133 | + try{ | ||
134 | + //判断文件是否为空 | ||
135 | + if (file.isEmpty()) { | ||
136 | + return new ResultJson("400","上传文件为空"); | ||
137 | + } | ||
138 | + //判断文件大小 | ||
139 | + long size = file.getSize(); | ||
140 | + String name = file.getOriginalFilename(); | ||
141 | + if (StringUtils.isBlank(name) || size == 0) { | ||
142 | + return new ResultJson("400","上传文件为空"); | ||
143 | + } | ||
144 | + String postfix = ExcelUtils.getPostfix(name); | ||
145 | + //读取文件内容 | ||
146 | + if (StringUtils.equals("xlsx", postfix)) { | ||
147 | + readResult = ExcelUtils.readXlsx(file); | ||
148 | + } else if (StringUtils.equals("xls", postfix)) { | ||
149 | + readResult = ExcelUtils.readXls(file); | ||
150 | + } else { | ||
151 | + return new ResultJson("400","上传文件类型错误"); | ||
152 | + } | ||
153 | + if (readResult == null || readResult.size() == 0) { | ||
154 | + return new ResultJson("400","上传文件解析失败"); } | ||
155 | + for (ArrayList<String> arr : readResult) { | ||
156 | + Originmanifestsecondary or =new Originmanifestsecondary(); | ||
157 | + String[] strArr = arr.get(2).split("_"); | ||
158 | + if(pattern.matcher(strArr[0]).matches()){ | ||
159 | + waybill=strArr[0].substring(0,3)+"-"+strArr[0].substring(3); | ||
160 | + }else{ | ||
161 | + waybill=strArr[0]; | ||
162 | + } | ||
163 | + ORIGINMANIFESTMASTER originmanifestmaster=upfileService.selectwaybill(waybill); | ||
164 | + if(originmanifestmaster!=null){ | ||
165 | + or.setAutoid(UUID.randomUUID().toString()); | ||
166 | + or.setWaybillnomaster(waybill); | ||
167 | + or.setWaybillnosecondary(strArr[1]); | ||
168 | + or.setWeight(arr.get(8)); | ||
169 | + or.setPiece(arr.get(6)); | ||
170 | + or.setManifestweight(arr.get(8)); | ||
171 | + or.setManifestpiece(arr.get(6)); | ||
172 | + if(pattern.matcher(arr.get(10)).matches()){ | ||
173 | + or.setProductname("CONSOLE"); | ||
174 | + }else{ | ||
175 | + if(arr.get(10).length()>150){ | ||
176 | + or.setProductname(arr.get(10).substring(0,100)); | ||
177 | + }else{ | ||
178 | + or.setProductname(arr.get(10));//货物描述 | ||
179 | + } | ||
180 | + } | ||
181 | + or.setPaymode("PP");//付费方式 | ||
182 | + or.setCustomscode("4604");//海关关区代码 | ||
183 | + if(arr.get(89)!=null && arr.get(89)!=""){ | ||
184 | + or.setShippername(arr.get(89));//发货人名称 | ||
185 | + }else{ | ||
186 | + or.setShippername("SHIPPER"); | ||
187 | + } | ||
188 | + or.setShipperaddress(arr.get(105));//发货人地址 | ||
189 | + if(arr.get(50)!=null && arr.get(50)!=""){ | ||
190 | + or.setConsigneename(arr.get(50));//收货人名称 | ||
191 | + }else{ | ||
192 | + or.setConsigneename("CONSIGNEER");//收货人名称 | ||
193 | + } | ||
194 | + or.setConsigneeaddress(arr.get(47));//收货人地址 | ||
195 | + or.setCreatedate(new Date());//创建日期yyyy-MM-dd HH:mm:ss | ||
196 | + or.setOriginmanifestmasterautoid(originmanifestmaster.getAutoid()); | ||
197 | + or.setStatus("17");//操作状态 | ||
198 | + or.setShipperCountrycode(arr.get(86));//发货人国家代码 | ||
199 | + or.setShipperPhone(arr.get(106));//发货人联系电话 | ||
200 | + or.setConsigneeCountrycode(arr.get(49));//收货人国家代码 | ||
201 | + or.setSpecificConsigneename(arr.get(50));//具体收货人名称 | ||
202 | + or.setSpecificConsigneePhone(arr.get(51));//具体收货人电话 | ||
203 | + or.setConsigneePhone(arr.get(51));//收货人电话 | ||
204 | + or.setOriginatingstationBill(arr.get(103)); | ||
205 | + or.setDestinationstationBill(arr.get(104)); | ||
206 | + int result=upfileSecondaryService.insert(or); | ||
207 | + if(result>0){ | ||
208 | + msg=1; | ||
209 | + } | ||
210 | + }else{ | ||
211 | + return new ResultJson("200","没有对应主单"); | ||
212 | + } | ||
213 | + | ||
214 | + } | ||
215 | + | ||
216 | + }catch (Exception e) { | ||
217 | + e.printStackTrace(); | ||
218 | + } | ||
219 | + return msg>0?new ResultJson("200","导入成功"):new ResultJson("500","导入失效"); | ||
220 | + } | ||
221 | + @PostMapping("ediOrig") | ||
222 | + public ResultJson ediOrig(@RequestBody ORIGINMANIFESTMASTER originmanifestmaster) throws Exception{ | ||
223 | + int res=upfileService.ediOrig(originmanifestmaster); | ||
224 | + return res>0?new ResultJson("200","更新成功"):new ResultJson("201","更新失败"); | ||
225 | + } | ||
226 | + @PostMapping("ediOrigDary") | ||
227 | + public ResultJson ediOrigDary(@RequestBody Originmanifestsecondary originmanifestsecondary) throws Exception{ | ||
228 | + int res=upfileSecondaryService.ediSecondary(originmanifestsecondary); | ||
229 | + return res>0?new ResultJson("200","更新成功"):new ResultJson("201","更新失败"); | ||
230 | + } | ||
231 | +} |
@@ -24,4 +24,11 @@ public interface ORIGINMANIFESTMASTERMapper { | @@ -24,4 +24,11 @@ public interface ORIGINMANIFESTMASTERMapper { | ||
24 | ); | 24 | ); |
25 | 25 | ||
26 | List<ORIGINMANIFESTMASTER> searchSec(String autoid); | 26 | List<ORIGINMANIFESTMASTER> searchSec(String autoid); |
27 | + | ||
28 | + ORIGINMANIFESTMASTER selectwaybill(@Param("waybillnomaster") String waybillnomaster); | ||
29 | + | ||
30 | + int updateByPrimaryKey(String keywords); | ||
31 | + | ||
32 | + int updateByPrimaryKeySelective(ORIGINMANIFESTMASTER record); | ||
33 | + | ||
27 | } | 34 | } |
@@ -14,4 +14,7 @@ public interface OriginmanifestsecondaryMapper { | @@ -14,4 +14,7 @@ public interface OriginmanifestsecondaryMapper { | ||
14 | List<Originmanifestsecondary> selectAutoIdByawbAawbH(Originmanifestsecondary record); | 14 | List<Originmanifestsecondary> selectAutoIdByawbAawbH(Originmanifestsecondary record); |
15 | 15 | ||
16 | int deleteAwbh(String awbhAutoId); | 16 | int deleteAwbh(String awbhAutoId); |
17 | + | ||
18 | + int updateByPrimaryKeySelective(Originmanifestsecondary record); | ||
19 | + | ||
17 | } | 20 | } |
1 | +package com.tianbo.analysis.service; | ||
2 | + | ||
3 | +import com.tianbo.analysis.model.ORIGINMANIFESTMASTER; | ||
4 | + | ||
5 | +public interface UpfileOrigService { | ||
6 | + int insert(ORIGINMANIFESTMASTER originmanifestmaster)throws Exception; | ||
7 | + ORIGINMANIFESTMASTER selectwaybill(String waybill)throws Exception; | ||
8 | + int updateByPrimaryKey(String autoid)throws Exception; | ||
9 | + int ediOrig(ORIGINMANIFESTMASTER originmanifestmaster)throws Exception; | ||
10 | +} |
1 | +package com.tianbo.analysis.service; | ||
2 | + | ||
3 | +import com.tianbo.analysis.model.Originmanifestsecondary; | ||
4 | + | ||
5 | +public interface UpfileSecondaryService { | ||
6 | + int insert(Originmanifestsecondary originmanifestsecondary)throws Exception; | ||
7 | + int ediSecondary(Originmanifestsecondary originmanifestsecondary)throws Exception; | ||
8 | + | ||
9 | +} |
1 | +package com.tianbo.analysis.service.imp; | ||
2 | + | ||
3 | +import com.tianbo.analysis.dao.ORIGINMANIFESTMASTERMapper; | ||
4 | +import com.tianbo.analysis.model.ORIGINMANIFESTMASTER; | ||
5 | +import com.tianbo.analysis.service.UpfileOrigService; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.stereotype.Service; | ||
8 | + | ||
9 | +@Service | ||
10 | +public class UpfileOrigImpl implements UpfileOrigService { | ||
11 | + @Autowired | ||
12 | + ORIGINMANIFESTMASTERMapper originmanifestmasterMapper; | ||
13 | + @Override | ||
14 | + public int insert(ORIGINMANIFESTMASTER originmanifestmaster) throws Exception { | ||
15 | + return originmanifestmasterMapper.insertSelective(originmanifestmaster); | ||
16 | + } | ||
17 | + | ||
18 | + @Override | ||
19 | + public ORIGINMANIFESTMASTER selectwaybill(String waybill) throws Exception { | ||
20 | + return originmanifestmasterMapper.selectwaybill(waybill); | ||
21 | + } | ||
22 | + | ||
23 | + @Override | ||
24 | + public int updateByPrimaryKey(String autoid) throws Exception { | ||
25 | + return originmanifestmasterMapper.updateByPrimaryKey(autoid); | ||
26 | + } | ||
27 | + | ||
28 | + @Override | ||
29 | + public int ediOrig(ORIGINMANIFESTMASTER originmanifestmaster) throws Exception { | ||
30 | + return originmanifestmasterMapper.updateByPrimaryKeySelective(originmanifestmaster); | ||
31 | + } | ||
32 | +} |
1 | +package com.tianbo.analysis.service.imp; | ||
2 | + | ||
3 | +import com.tianbo.analysis.dao.OriginmanifestsecondaryMapper; | ||
4 | +import com.tianbo.analysis.model.Originmanifestsecondary; | ||
5 | +import com.tianbo.analysis.service.UpfileSecondaryService; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.stereotype.Service; | ||
8 | + | ||
9 | +@Service | ||
10 | +public class UpfileSecondaryImpl implements UpfileSecondaryService { | ||
11 | + @Autowired | ||
12 | + OriginmanifestsecondaryMapper originmanifestsecondaryMapper; | ||
13 | + | ||
14 | + @Override | ||
15 | + public int insert(Originmanifestsecondary originmanifestsecondary) throws Exception { | ||
16 | + return originmanifestsecondaryMapper.insertSelective(originmanifestsecondary); | ||
17 | + } | ||
18 | + | ||
19 | + @Override | ||
20 | + public int ediSecondary(Originmanifestsecondary originmanifestsecondary) throws Exception { | ||
21 | + return originmanifestsecondaryMapper.updateByPrimaryKeySelective(originmanifestsecondary); | ||
22 | + } | ||
23 | +} |
1 | +package com.tianbo.analysis.tools; | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | +import org.apache.commons.lang.StringUtils; | ||
6 | +import org.apache.poi.hssf.usermodel.HSSFCell; | ||
7 | +import org.apache.poi.hssf.usermodel.HSSFRow; | ||
8 | +import org.apache.poi.hssf.usermodel.HSSFSheet; | ||
9 | +import org.apache.poi.hssf.usermodel.HSSFWorkbook; | ||
10 | +import org.apache.poi.ss.usermodel.Cell; | ||
11 | +import org.apache.poi.ss.usermodel.DateUtil; | ||
12 | +import org.apache.poi.xssf.usermodel.XSSFCell; | ||
13 | +import org.apache.poi.xssf.usermodel.XSSFRow; | ||
14 | +import org.apache.poi.xssf.usermodel.XSSFSheet; | ||
15 | +import org.apache.poi.xssf.usermodel.XSSFWorkbook; | ||
16 | +import org.springframework.web.multipart.MultipartFile; | ||
17 | + | ||
18 | +import java.io.InputStream; | ||
19 | +import java.text.DateFormat; | ||
20 | +import java.text.SimpleDateFormat; | ||
21 | +import java.util.ArrayList; | ||
22 | +import java.util.Date; | ||
23 | +import java.util.List; | ||
24 | + | ||
25 | +/** | ||
26 | + * shenhailong | ||
27 | + * 2020/4/27/14:29 | ||
28 | + */ | ||
29 | +public class ExcelUtils { | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + /** | ||
34 | + * 读取.xlsx 内容 | ||
35 | + * @param file | ||
36 | + * @return | ||
37 | + * @throws | ||
38 | + */ | ||
39 | + public static List<ArrayList<String>> readXlsx (MultipartFile file) { | ||
40 | + List<ArrayList<String>> list = new ArrayList<ArrayList<String>>(); | ||
41 | + InputStream input = null; | ||
42 | + XSSFWorkbook wb = null; | ||
43 | + try { | ||
44 | + input = file.getInputStream(); | ||
45 | + //创建文档 | ||
46 | + wb = new XSSFWorkbook(input); | ||
47 | + ArrayList<String> rowList = null; | ||
48 | + int totoalRows = 0;//总行数 | ||
49 | + int totalCells = 0;//总列数 | ||
50 | + //读取sheet(页) | ||
51 | + for (int sheetIndex = 0 ; sheetIndex < wb.getNumberOfSheets(); sheetIndex++) { | ||
52 | + XSSFSheet xssfSheet = wb.getSheetAt(sheetIndex); | ||
53 | + | ||
54 | + if (xssfSheet == null) { | ||
55 | + continue; | ||
56 | + } | ||
57 | + totoalRows = xssfSheet.getLastRowNum(); | ||
58 | + //读取row | ||
59 | + for (int rowIndex = 2; rowIndex <= totoalRows; rowIndex++) { | ||
60 | + XSSFRow xssfRow = xssfSheet.getRow(rowIndex); | ||
61 | + | ||
62 | + if (xssfRow == null) { | ||
63 | + continue; | ||
64 | + } | ||
65 | + rowList = new ArrayList<String>(); | ||
66 | + totalCells = xssfRow.getLastCellNum(); | ||
67 | + | ||
68 | + //读取列 | ||
69 | + for (int cellIndex = 0; cellIndex < totalCells; cellIndex++) { | ||
70 | + XSSFCell xssfCell = xssfRow.getCell(cellIndex); | ||
71 | + if (xssfCell == null) { | ||
72 | + rowList.add(""); | ||
73 | + } else { | ||
74 | +// xssfCell.setCellType(Cell.CELL_TYPE_STRING); | ||
75 | + rowList.add(String.valueOf(xssfCell.getStringCellValue())); | ||
76 | + } | ||
77 | + } | ||
78 | + | ||
79 | + list.add(rowList); | ||
80 | + | ||
81 | + } | ||
82 | + } | ||
83 | + } catch (Exception e) { | ||
84 | + e.printStackTrace(); | ||
85 | + return null; | ||
86 | + } finally { | ||
87 | + try { | ||
88 | + if ( wb != null) { | ||
89 | + wb.close(); | ||
90 | + } | ||
91 | + if (input != null) { | ||
92 | + input.close(); | ||
93 | + } | ||
94 | + } catch (Exception e) { | ||
95 | + } | ||
96 | + } | ||
97 | + | ||
98 | + return list; | ||
99 | + } | ||
100 | + | ||
101 | + | ||
102 | + | ||
103 | + /** | ||
104 | + * 读取 .xls内容 | ||
105 | + * @param file | ||
106 | + * @return | ||
107 | + * @throws | ||
108 | + */ | ||
109 | + public static List<ArrayList<String>> readXls (MultipartFile file) { | ||
110 | + List<ArrayList<String>> list = new ArrayList<ArrayList<String>>(); | ||
111 | + | ||
112 | + //创建输入流 | ||
113 | + InputStream input = null; | ||
114 | + //创建文档 | ||
115 | + HSSFWorkbook wb = null; | ||
116 | + | ||
117 | + try { | ||
118 | + input = file.getInputStream(); | ||
119 | + //创建文档 | ||
120 | + wb = new HSSFWorkbook(input); | ||
121 | + | ||
122 | + ArrayList<String> rowList = null; | ||
123 | + int totoalRows = 0;//总行数 | ||
124 | + int totalCells = 0;//总列数 | ||
125 | + //读取sheet(页) | ||
126 | + for (int sheetIndex = 0 ; sheetIndex < wb.getNumberOfSheets(); sheetIndex++) { | ||
127 | + HSSFSheet hssfSheet = wb.getSheetAt(sheetIndex); | ||
128 | + if (hssfSheet == null) { | ||
129 | + continue; | ||
130 | + } | ||
131 | + totoalRows = hssfSheet.getLastRowNum(); | ||
132 | + //读取row | ||
133 | + for (int rowIndex = 1; rowIndex <= totoalRows; rowIndex++) { | ||
134 | + HSSFRow hssfRow = hssfSheet.getRow(rowIndex); | ||
135 | + | ||
136 | + if (hssfRow == null) { | ||
137 | + continue; | ||
138 | + } | ||
139 | + rowList = new ArrayList<String>(); | ||
140 | + totalCells = hssfRow.getLastCellNum(); | ||
141 | + | ||
142 | + //读取列 | ||
143 | + for (int cellIndex = 0; cellIndex < totalCells; cellIndex++) { | ||
144 | + HSSFCell hssfCell = hssfRow.getCell(cellIndex); | ||
145 | + if (hssfCell == null) { | ||
146 | + rowList.add(""); | ||
147 | + } else { | ||
148 | + // System.out.println(hssfCell.getCellType()); | ||
149 | + | ||
150 | + if(0==hssfCell.getCellType()){ | ||
151 | + if(DateUtil.isCellDateFormatted(hssfCell)){ | ||
152 | + //用于转化为日期格式 | ||
153 | + Date d = hssfCell.getDateCellValue(); | ||
154 | + DateFormat formater = new SimpleDateFormat("yyyy-MM-dd"); | ||
155 | + rowList.add(formater.format(d)); | ||
156 | + } | ||
157 | + } | ||
158 | + hssfCell.setCellType(Cell.CELL_TYPE_STRING); | ||
159 | + rowList.add(String.valueOf(hssfCell.getStringCellValue())); | ||
160 | + } | ||
161 | + } | ||
162 | + | ||
163 | + list.add(rowList); | ||
164 | + | ||
165 | + } | ||
166 | + } | ||
167 | + } catch (Exception e) { | ||
168 | + e.printStackTrace(); | ||
169 | + return null; | ||
170 | + } finally { | ||
171 | + try { | ||
172 | + if ( wb != null) { | ||
173 | +// wb.close(); | ||
174 | + } | ||
175 | + if (input != null) { | ||
176 | + input.close(); | ||
177 | + } | ||
178 | + } catch (Exception e) { | ||
179 | + } | ||
180 | + } | ||
181 | + return list; | ||
182 | + } | ||
183 | + | ||
184 | + | ||
185 | + public static String getPostfix (String path) { | ||
186 | + if (StringUtils.isBlank(path) || !path.contains(".")) { | ||
187 | + return null; | ||
188 | + } | ||
189 | + return path.substring(path.lastIndexOf(".") + 1, path.length()).trim(); | ||
190 | + } | ||
191 | + | ||
192 | +} |
@@ -514,5 +514,158 @@ GROUP BY | @@ -514,5 +514,158 @@ GROUP BY | ||
514 | from tallysecondary | 514 | from tallysecondary |
515 | where tallymasterid= #{autoid} | 515 | where tallymasterid= #{autoid} |
516 | </select> | 516 | </select> |
517 | + <select id="selectwaybill" parameterType="java.lang.String" resultMap="BaseResultMap"> | ||
518 | + select * from ORIGINMANIFESTMASTER where 1=1 | ||
519 | + <if test="waybillnomaster!=null"> | ||
520 | + AND WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} | ||
521 | + </if> | ||
522 | + </select> | ||
523 | + <update id="updateByPrimaryKey" parameterType="java.lang.String"> | ||
524 | + update ORIGINMANIFESTMASTER set STATUS='17' where AUTOID=#{autoid,jdbcType=VARCHAR} | ||
525 | + </update> | ||
526 | + <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.analysis.model.ORIGINMANIFESTMASTER" > | ||
527 | + update CGONMS.ORIGINMANIFESTMASTER | ||
528 | + <set > | ||
529 | + <if test="waybillnomaster != null" > | ||
530 | + WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}, | ||
531 | + </if> | ||
532 | + <if test="segment != null" > | ||
533 | + SEGMENT = #{segment,jdbcType=VARCHAR}, | ||
534 | + </if> | ||
535 | + <if test="originatingstation != null" > | ||
536 | + ORIGINATINGSTATION = #{originatingstation,jdbcType=VARCHAR}, | ||
537 | + </if> | ||
538 | + <if test="destinationstation != null" > | ||
539 | + DESTINATIONSTATION = #{destinationstation,jdbcType=VARCHAR}, | ||
540 | + </if> | ||
541 | + <if test="totalweight != null" > | ||
542 | + TOTALWEIGHT = #{totalweight,jdbcType=VARCHAR}, | ||
543 | + </if> | ||
544 | + <if test="totalpiece != null" > | ||
545 | + TOTALPIECE = #{totalpiece,jdbcType=VARCHAR}, | ||
546 | + </if> | ||
547 | + <if test="manifesttotalpiece != null" > | ||
548 | + MANIFESTTOTALPIECE = #{manifesttotalpiece,jdbcType=VARCHAR}, | ||
549 | + </if> | ||
550 | + <if test="manifesttotalweight != null" > | ||
551 | + MANIFESTTOTALWEIGHT = #{manifesttotalweight,jdbcType=VARCHAR}, | ||
552 | + </if> | ||
553 | + <if test="flightno != null" > | ||
554 | + FLIGHTNO = #{flightno,jdbcType=VARCHAR}, | ||
555 | + </if> | ||
556 | + <if test="productname != null" > | ||
557 | + PRODUCTNAME = #{productname,jdbcType=VARCHAR}, | ||
558 | + </if> | ||
559 | + <if test="customsstatus != null" > | ||
560 | + CUSTOMSSTATUS = #{customsstatus,jdbcType=VARCHAR}, | ||
561 | + </if> | ||
562 | + <if test="carrier1 != null" > | ||
563 | + CARRIER1 = #{carrier1,jdbcType=VARCHAR}, | ||
564 | + </if> | ||
565 | + <if test="arrivalstation1 != null" > | ||
566 | + ARRIVALSTATION1 = #{arrivalstation1,jdbcType=VARCHAR}, | ||
567 | + </if> | ||
568 | + <if test="carrier2 != null" > | ||
569 | + CARRIER2 = #{carrier2,jdbcType=VARCHAR}, | ||
570 | + </if> | ||
571 | + <if test="arrivalstation2 != null" > | ||
572 | + ARRIVALSTATION2 = #{arrivalstation2,jdbcType=VARCHAR}, | ||
573 | + </if> | ||
574 | + <if test="carrier3 != null" > | ||
575 | + CARRIER3 = #{carrier3,jdbcType=VARCHAR}, | ||
576 | + </if> | ||
577 | + <if test="arrivalstation3 != null" > | ||
578 | + ARRIVALSTATION3 = #{arrivalstation3,jdbcType=VARCHAR}, | ||
579 | + </if> | ||
580 | + <if test="paymode != null" > | ||
581 | + PAYMODE = #{paymode,jdbcType=VARCHAR}, | ||
582 | + </if> | ||
583 | + <if test="specialgoodscode != null" > | ||
584 | + SPECIALGOODSCODE = #{specialgoodscode,jdbcType=VARCHAR}, | ||
585 | + </if> | ||
586 | + <if test="customscode != null" > | ||
587 | + CUSTOMSCODE = #{customscode,jdbcType=VARCHAR}, | ||
588 | + </if> | ||
589 | + <if test="shippername != null" > | ||
590 | + SHIPPERNAME = #{shippername,jdbcType=VARCHAR}, | ||
591 | + </if> | ||
592 | + <if test="shipperaddress != null" > | ||
593 | + SHIPPERADDRESS = #{shipperaddress,jdbcType=VARCHAR}, | ||
594 | + </if> | ||
595 | + <if test="consigneename != null" > | ||
596 | + CONSIGNEENAME = #{consigneename,jdbcType=VARCHAR}, | ||
597 | + </if> | ||
598 | + <if test="consigneeaddress != null" > | ||
599 | + CONSIGNEEADDRESS = #{consigneeaddress,jdbcType=VARCHAR}, | ||
600 | + </if> | ||
601 | + <if test="receiptinformation != null" > | ||
602 | + RECEIPTINFORMATION = #{receiptinformation,jdbcType=VARCHAR}, | ||
603 | + </if> | ||
604 | + <if test="createdate != null" > | ||
605 | + CREATEDATE = #{createdate,jdbcType=TIMESTAMP}, | ||
606 | + </if> | ||
607 | + <if test="flightDate != null" > | ||
608 | + FLIGHT_DATE = #{flightDate,jdbcType=TIMESTAMP}, | ||
609 | + </if> | ||
610 | + <if test="status != null" > | ||
611 | + STATUS = #{status,jdbcType=VARCHAR}, | ||
612 | + </if> | ||
613 | + <if test="isbatch != null" > | ||
614 | + ISBATCH = #{isbatch,jdbcType=VARCHAR}, | ||
615 | + </if> | ||
616 | + <if test="originatingstationBill != null" > | ||
617 | + ORIGINATINGSTATION_BILL = #{originatingstationBill,jdbcType=VARCHAR}, | ||
618 | + </if> | ||
619 | + <if test="destinationstationBill != null" > | ||
620 | + DESTINATIONSTATION_BILL = #{destinationstationBill,jdbcType=VARCHAR}, | ||
621 | + </if> | ||
622 | + <if test="reportorder != null" > | ||
623 | + REPORTORDER = #{reportorder,jdbcType=VARCHAR}, | ||
624 | + </if> | ||
625 | + <if test="islast != null" > | ||
626 | + ISLAST = #{islast,jdbcType=VARCHAR}, | ||
627 | + </if> | ||
628 | + <if test="shipperCode != null" > | ||
629 | + SHIPPER_CODE = #{shipperCode,jdbcType=VARCHAR}, | ||
630 | + </if> | ||
631 | + <if test="shipperCountrycode != null" > | ||
632 | + SHIPPER_COUNTRYCODE = #{shipperCountrycode,jdbcType=VARCHAR}, | ||
633 | + </if> | ||
634 | + <if test="shipperPhone != null" > | ||
635 | + SHIPPER_PHONE = #{shipperPhone,jdbcType=VARCHAR}, | ||
636 | + </if> | ||
637 | + <if test="shipperFax != null" > | ||
638 | + SHIPPER_FAX = #{shipperFax,jdbcType=VARCHAR}, | ||
639 | + </if> | ||
640 | + <if test="consigneeCode != null" > | ||
641 | + CONSIGNEE_CODE = #{consigneeCode,jdbcType=VARCHAR}, | ||
642 | + </if> | ||
643 | + <if test="consigneeCountrycode != null" > | ||
644 | + CONSIGNEE_COUNTRYCODE = #{consigneeCountrycode,jdbcType=VARCHAR}, | ||
645 | + </if> | ||
646 | + <if test="consigneeFax != null" > | ||
647 | + CONSIGNEE_FAX = #{consigneeFax,jdbcType=VARCHAR}, | ||
648 | + </if> | ||
649 | + <if test="specificConsigneename != null" > | ||
650 | + SPECIFIC_CONSIGNEENAME = #{specificConsigneename,jdbcType=VARCHAR}, | ||
651 | + </if> | ||
652 | + <if test="specificConsigneePhone != null" > | ||
653 | + SPECIFIC_CONSIGNEE_PHONE = #{specificConsigneePhone,jdbcType=VARCHAR}, | ||
654 | + </if> | ||
655 | + <if test="consigneePhone != null" > | ||
656 | + CONSIGNEE_PHONE = #{consigneePhone,jdbcType=VARCHAR}, | ||
657 | + </if> | ||
658 | + <if test="sgCode != null" > | ||
659 | + SG_CODE = #{sgCode,jdbcType=VARCHAR}, | ||
660 | + </if> | ||
661 | + <if test="sgConnectName != null" > | ||
662 | + SG_CONNECT_NAME = #{sgConnectName,jdbcType=VARCHAR}, | ||
663 | + </if> | ||
664 | + <if test="sgConnctTel != null" > | ||
665 | + SG_CONNCT_TEL = #{sgConnctTel,jdbcType=VARCHAR}, | ||
666 | + </if> | ||
667 | + </set> | ||
668 | + where AUTOID = #{autoid,jdbcType=VARCHAR} | ||
669 | + </update> | ||
517 | 670 | ||
518 | </mapper> | 671 | </mapper> |
@@ -286,4 +286,104 @@ | @@ -286,4 +286,104 @@ | ||
286 | WHERE | 286 | WHERE |
287 | AUTOID = #{awbhAutoId,jdbcType=VARCHAR} | 287 | AUTOID = #{awbhAutoId,jdbcType=VARCHAR} |
288 | </delete> | 288 | </delete> |
289 | + <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.analysis.model.Originmanifestsecondary" > | ||
290 | + update CGONMS.ORIGINMANIFESTSECONDARY | ||
291 | + <set > | ||
292 | + <if test="waybillnomaster != null" > | ||
293 | + WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}, | ||
294 | + </if> | ||
295 | + <if test="waybillnosecondary != null" > | ||
296 | + WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR}, | ||
297 | + </if> | ||
298 | + <if test="weight != null" > | ||
299 | + WEIGHT = #{weight,jdbcType=VARCHAR}, | ||
300 | + </if> | ||
301 | + <if test="piece != null" > | ||
302 | + PIECE = #{piece,jdbcType=VARCHAR}, | ||
303 | + </if> | ||
304 | + <if test="manifestpiece != null" > | ||
305 | + MANIFESTPIECE = #{manifestpiece,jdbcType=VARCHAR}, | ||
306 | + </if> | ||
307 | + <if test="manifestweight != null" > | ||
308 | + MANIFESTWEIGHT = #{manifestweight,jdbcType=VARCHAR}, | ||
309 | + </if> | ||
310 | + <if test="productname != null" > | ||
311 | + PRODUCTNAME = #{productname,jdbcType=VARCHAR}, | ||
312 | + </if> | ||
313 | + <if test="paymode != null" > | ||
314 | + PAYMODE = #{paymode,jdbcType=VARCHAR}, | ||
315 | + </if> | ||
316 | + <if test="specialgoodscode != null" > | ||
317 | + SPECIALGOODSCODE = #{specialgoodscode,jdbcType=VARCHAR}, | ||
318 | + </if> | ||
319 | + <if test="customscode != null" > | ||
320 | + CUSTOMSCODE = #{customscode,jdbcType=VARCHAR}, | ||
321 | + </if> | ||
322 | + <if test="shippername != null" > | ||
323 | + SHIPPERNAME = #{shippername,jdbcType=VARCHAR}, | ||
324 | + </if> | ||
325 | + <if test="shipperaddress != null" > | ||
326 | + SHIPPERADDRESS = #{shipperaddress,jdbcType=VARCHAR}, | ||
327 | + </if> | ||
328 | + <if test="consigneename != null" > | ||
329 | + CONSIGNEENAME = #{consigneename,jdbcType=VARCHAR}, | ||
330 | + </if> | ||
331 | + <if test="consigneeaddress != null" > | ||
332 | + CONSIGNEEADDRESS = #{consigneeaddress,jdbcType=VARCHAR}, | ||
333 | + </if> | ||
334 | + <if test="createdate != null" > | ||
335 | + CREATEDATE = #{createdate,jdbcType=TIMESTAMP}, | ||
336 | + </if> | ||
337 | + <if test="originmanifestmasterautoid != null" > | ||
338 | + ORIGINMANIFESTMASTERAUTOID = #{originmanifestmasterautoid,jdbcType=VARCHAR}, | ||
339 | + </if> | ||
340 | + <if test="customsstatus != null" > | ||
341 | + CUSTOMSSTATUS = #{customsstatus,jdbcType=VARCHAR}, | ||
342 | + </if> | ||
343 | + <if test="status != null" > | ||
344 | + STATUS = #{status,jdbcType=VARCHAR}, | ||
345 | + </if> | ||
346 | + <if test="receiption != null" > | ||
347 | + RECEIPTION = #{receiption,jdbcType=VARCHAR}, | ||
348 | + </if> | ||
349 | + <if test="originatingstationBill != null" > | ||
350 | + ORIGINATINGSTATION_BILL = #{originatingstationBill,jdbcType=VARCHAR}, | ||
351 | + </if> | ||
352 | + <if test="destinationstationBill != null" > | ||
353 | + DESTINATIONSTATION_BILL = #{destinationstationBill,jdbcType=VARCHAR}, | ||
354 | + </if> | ||
355 | + <if test="shipperCode != null" > | ||
356 | + SHIPPER_CODE = #{shipperCode,jdbcType=VARCHAR}, | ||
357 | + </if> | ||
358 | + <if test="shipperCountrycode != null" > | ||
359 | + SHIPPER_COUNTRYCODE = #{shipperCountrycode,jdbcType=VARCHAR}, | ||
360 | + </if> | ||
361 | + <if test="shipperPhone != null" > | ||
362 | + SHIPPER_PHONE = #{shipperPhone,jdbcType=VARCHAR}, | ||
363 | + </if> | ||
364 | + <if test="shipperFax != null" > | ||
365 | + SHIPPER_FAX = #{shipperFax,jdbcType=VARCHAR}, | ||
366 | + </if> | ||
367 | + <if test="consigneeCode != null" > | ||
368 | + CONSIGNEE_CODE = #{consigneeCode,jdbcType=VARCHAR}, | ||
369 | + </if> | ||
370 | + <if test="consigneeCountrycode != null" > | ||
371 | + CONSIGNEE_COUNTRYCODE = #{consigneeCountrycode,jdbcType=VARCHAR}, | ||
372 | + </if> | ||
373 | + <if test="consigneeFax != null" > | ||
374 | + CONSIGNEE_FAX = #{consigneeFax,jdbcType=VARCHAR}, | ||
375 | + </if> | ||
376 | + <if test="specificConsigneename != null" > | ||
377 | + SPECIFIC_CONSIGNEENAME = #{specificConsigneename,jdbcType=VARCHAR}, | ||
378 | + </if> | ||
379 | + <if test="specificConsigneePhone != null" > | ||
380 | + SPECIFIC_CONSIGNEE_PHONE = #{specificConsigneePhone,jdbcType=VARCHAR}, | ||
381 | + </if> | ||
382 | + <if test="consigneePhone != null" > | ||
383 | + CONSIGNEE_PHONE = #{consigneePhone,jdbcType=VARCHAR}, | ||
384 | + </if> | ||
385 | + </set> | ||
386 | + where AUTOID = #{autoid,jdbcType=VARCHAR} | ||
387 | + </update> | ||
388 | + | ||
289 | </mapper> | 389 | </mapper> |
-
请 注册 或 登录 后发表评论