|
@@ -524,7 +524,7 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
@AutoLog(value = "发票打印")
|
|
|
@ApiOperation(value = "发票打印")
|
|
|
@RequestMapping(value = "/syShippingOrderPrint")
|
|
|
- public void syShippingOrderPrint(String id,String testName,HttpServletResponse response) throws ParseException {
|
|
|
+ public Result<SyShippingOrder> syShippingOrderPrint(String id,String testName,HttpServletResponse response) throws ParseException {
|
|
|
|
|
|
Result<SyShippingOrder> result= new Result<SyShippingOrder>();
|
|
|
|
|
@@ -538,15 +538,25 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
BigDecimal tatolNumber = BigDecimal.ZERO;
|
|
|
//总金额
|
|
|
BigDecimal tatolMoney = BigDecimal.ZERO;
|
|
|
+ //总体积
|
|
|
+ BigDecimal tatolVolume = BigDecimal.ZERO;
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+
|
|
|
+ List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
|
|
|
+ //获取当前时间
|
|
|
+ Date date = new Date();
|
|
|
+ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+
|
|
|
+ TopinYin py = new TopinYin();
|
|
|
|
|
|
//查询主表数据
|
|
|
SyShippingOrder entity = syShippingOrderService.getById(id);
|
|
|
|
|
|
try {
|
|
|
|
|
|
- SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date date = sf.parse(entity.getLatestDateOfShipment());
|
|
|
- String lasttime = sf.format(date);
|
|
|
+ Date date1 = sf.parse(entity.getLatestDateOfShipment());
|
|
|
+ String lasttime = sf.format(date1);
|
|
|
entity.setLatestDateOfShipment(lasttime);
|
|
|
|
|
|
// 只要不是成品,需要做汇总操作,汇总条件为报关品名+HSCODE
|
|
@@ -557,6 +567,7 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
totalNetweight = totalNetweight.add(li.getNetWeight());
|
|
|
tatolNumber = tatolNumber.add(li.getNumber());
|
|
|
tatolMoney = tatolMoney.add(li.getTotalPrice());
|
|
|
+ tatolVolume = tatolVolume.add(li.getVolume());
|
|
|
li.setDestination(entity.getArriveInCountry());
|
|
|
}
|
|
|
}else{
|
|
@@ -566,6 +577,7 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
totalNetweight = totalNetweight.add(li.getNetWeight());
|
|
|
tatolNumber = tatolNumber.add(li.getNumber());
|
|
|
tatolMoney = tatolMoney.add(li.getTotalPrice());
|
|
|
+ tatolVolume = tatolVolume.add(li.getVolume());
|
|
|
li.setDestination(entity.getArriveInCountry());
|
|
|
}
|
|
|
}
|
|
@@ -577,15 +589,13 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
entity.setTatolNumber(tatolNumber);
|
|
|
//总金额
|
|
|
entity.setTatolMoney(tatolMoney);
|
|
|
+ //总体积
|
|
|
+ entity.setTotalVolume(tatolVolume);
|
|
|
|
|
|
//String[] nameList = new String[]{"报关信息-报关单","报关信息-申报要素-成衣","报关信息-发票","报关信息-合同","报关信息-申报要素-面料","报关信息-装箱单"};
|
|
|
|
|
|
if(testName.equals("报关信息-报关单")){
|
|
|
|
|
|
- Map<String, Object> map = new HashMap<String, Object>();
|
|
|
-
|
|
|
- List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
|
|
|
-
|
|
|
TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\"+testName+".xlsx");
|
|
|
|
|
|
//转map
|
|
@@ -614,10 +624,7 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
|
|
|
}
|
|
|
else if(testName.equals("报关信息-申报要素-成衣")){
|
|
|
- //传出的Map
|
|
|
- Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
|
- List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
|
|
|
List<Map<String, Object>> listMap1 = new ArrayList<Map<String, Object>>();
|
|
|
|
|
|
TemplateExportParams params = new TemplateExportParams("D:\\"+testName+".xlsx");
|
|
@@ -626,10 +633,14 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
queryWrapper.eq("sy_shipping_order_item_id",entity.getId()).eq("del_flag",0).groupBy("elements_Id");
|
|
|
List<SyShippingOrderItem> itemList = syShippingOrderItemService.list(queryWrapper);
|
|
|
|
|
|
+ int i = 1;
|
|
|
for(SyShippingOrderItem li:itemList){
|
|
|
- map.put("name","zzzz"+li.getReadyFabric());
|
|
|
+ map.put("name","没用"+li.getReadyFabric());
|
|
|
|
|
|
Map<String, Object> map1 = new HashMap<String, Object>();
|
|
|
+ Map<String, Object> map3 = new HashMap<String, Object>();
|
|
|
+ Map<String, Object> map4 = new HashMap<String, Object>();
|
|
|
+ Map<String, Object> map5 = new HashMap<String, Object>();
|
|
|
|
|
|
//查询主表
|
|
|
SyDeclarationElements elementEntity = syDeclarationElementsService.getById(li.getElementsId());
|
|
@@ -638,46 +649,117 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
itemQueryWrapper.eq("sy_declaration_elements_id",li.getElementsId()).eq("del_flag",0);
|
|
|
List<SyDeclarationElementsItem> itemList1 = syDeclarationElementsItemService.list(itemQueryWrapper);
|
|
|
|
|
|
+ map1.put("name",i+"、商品编码:");
|
|
|
+ map1.put("value",elementEntity.getInventoryCode());
|
|
|
+ listMap.add(map1);
|
|
|
+
|
|
|
+ map3.put("name","商品描述:");
|
|
|
+ map3.put("value","");
|
|
|
+ listMap.add(map3);
|
|
|
+
|
|
|
+ map4.put("name","申报要素:");
|
|
|
+ map4.put("value","");
|
|
|
+ listMap.add(map4);
|
|
|
+
|
|
|
+ int m = 1;
|
|
|
for(SyDeclarationElementsItem li1:itemList1){
|
|
|
- Field[] fieldsList = li1.getClass().getDeclaredFields();
|
|
|
Map<String, Object> map2 = new HashMap<String, Object>();
|
|
|
- for (Field field : fieldsList) {
|
|
|
- field.setAccessible(true);
|
|
|
- map2.put(field.getName(), field.get(li1));
|
|
|
+ if(li1.getTypeValue().equals("品名")){
|
|
|
+ li1.setDescribeText(elementEntity.getDeclarationName());
|
|
|
}
|
|
|
- listMap1.add(map2);
|
|
|
+ map2.put("name", m+"、"+li1.getTypeValue()+":");
|
|
|
+ map2.put("value",li1.getDescribeText());
|
|
|
+ listMap.add(map2);
|
|
|
+ m++;
|
|
|
}
|
|
|
+ i++;
|
|
|
|
|
|
- map1.put("name","商品编码 "+elementEntity.getInventoryCode());
|
|
|
- map1.put("value","商品描述: ");
|
|
|
- map1.put("item",listMap1);
|
|
|
-
|
|
|
- listMap.add(map1);
|
|
|
+ map5.put("name","");
|
|
|
+ map5.put("value","");
|
|
|
+ listMap.add(map5);
|
|
|
}
|
|
|
+ map.put("list", listMap);
|
|
|
+
|
|
|
+ Workbook workbook = ExcelExportUtil.exportExcel(params,map);
|
|
|
+ ServletOutputStream outputStream = response.getOutputStream();
|
|
|
+ workbook.write(outputStream);
|
|
|
|
|
|
+ } else if(testName.equals("报关信息-申报要素-面料")){
|
|
|
+
|
|
|
+ List<Map<String, Object>> listMap1 = new ArrayList<Map<String, Object>>();
|
|
|
+
|
|
|
+ TemplateExportParams params = new TemplateExportParams("D:\\"+testName+".xlsx");
|
|
|
+
|
|
|
+ QueryWrapper<SyShippingOrderItem> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("sy_shipping_order_item_id",entity.getId()).eq("del_flag",0).groupBy("elements_Id");
|
|
|
+ List<SyShippingOrderItem> itemList = syShippingOrderItemService.list(queryWrapper);
|
|
|
+
|
|
|
+ int i = 1;
|
|
|
+ for(SyShippingOrderItem li:itemList){
|
|
|
+ map.put("name","没用"+li.getReadyFabric());
|
|
|
+
|
|
|
+ Map<String, Object> map1 = new HashMap<String, Object>();
|
|
|
+ Map<String, Object> map3 = new HashMap<String, Object>();
|
|
|
+ Map<String, Object> map4 = new HashMap<String, Object>();
|
|
|
+ Map<String, Object> map5 = new HashMap<String, Object>();
|
|
|
+
|
|
|
+ //查询主表
|
|
|
+ SyDeclarationElements elementEntity = syDeclarationElementsService.getById(li.getElementsId());
|
|
|
+ //查询子表
|
|
|
+ QueryWrapper<SyDeclarationElementsItem> itemQueryWrapper = new QueryWrapper<>();
|
|
|
+ itemQueryWrapper.eq("sy_declaration_elements_id",li.getElementsId()).eq("del_flag",0);
|
|
|
+ List<SyDeclarationElementsItem> itemList1 = syDeclarationElementsItemService.list(itemQueryWrapper);
|
|
|
+
|
|
|
+ map1.put("name",i+"、商品税号:");
|
|
|
+ map1.put("value",elementEntity.getHsCode());
|
|
|
+ map1.put("text","");
|
|
|
+ listMap.add(map1);
|
|
|
+
|
|
|
+ map3.put("name","商品名称:");
|
|
|
+ map3.put("value",elementEntity.getInventoryName());
|
|
|
+ map3.put("text","");
|
|
|
+ listMap.add(map3);
|
|
|
+
|
|
|
+ map4.put("name","申报要素项数");
|
|
|
+ map4.put("value","申报要素内容");
|
|
|
+ map4.put("text","");
|
|
|
+ listMap.add(map4);
|
|
|
+
|
|
|
+ int m = 0;
|
|
|
+ for(SyDeclarationElementsItem li1:itemList1){
|
|
|
+ Map<String, Object> map2 = new HashMap<String, Object>();
|
|
|
+ if(li1.getTypeValue().equals("品名")){
|
|
|
+ li1.setDescribeText(elementEntity.getDeclarationName());
|
|
|
+ map2.put("name","");
|
|
|
+ map2.put("value",li1.getTypeValue());
|
|
|
+ map2.put("text",li1.getDescribeText());
|
|
|
+ listMap.add(map2);
|
|
|
+ }else {
|
|
|
+ map2.put("name", m);
|
|
|
+ map2.put("value", li1.getTypeValue());
|
|
|
+ map2.put("text", li1.getDescribeText());
|
|
|
+ listMap.add(map2);
|
|
|
+ m++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ i++;
|
|
|
+
|
|
|
+ map5.put("name","");
|
|
|
+ map5.put("value","");
|
|
|
+ listMap.add(map5);
|
|
|
+ }
|
|
|
map.put("list", listMap);
|
|
|
|
|
|
Workbook workbook = ExcelExportUtil.exportExcel(params,map);
|
|
|
-// File savefile = new File("C:\\Users\\Mr_zeng\\Desktop\\");
|
|
|
-// if (!savefile.exists()) {
|
|
|
-// savefile.mkdirs();
|
|
|
-// }
|
|
|
-// FileOutputStream fos = new FileOutputStream("C:\\Users\\Mr_zeng\\Desktop\\"+testName+"1.xlsx");
|
|
|
-// workbook.write(fos);
|
|
|
-// fos.close();
|
|
|
+ ServletOutputStream outputStream = response.getOutputStream();
|
|
|
+ workbook.write(outputStream);
|
|
|
|
|
|
}
|
|
|
else if(testName.equals("报关信息-发票")){
|
|
|
|
|
|
- Map<String, Object> map = new HashMap<String, Object>();
|
|
|
-
|
|
|
- List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
|
|
|
-
|
|
|
//重新赋值
|
|
|
- Date date1 = new Date();
|
|
|
- entity.setLatestDateOfShipment(sf.format(date1));
|
|
|
+ entity.setLatestDateOfShipment(sf.format(date));
|
|
|
//出口口岸转大写拼音
|
|
|
- TopinYin py = new TopinYin();
|
|
|
String exportPort = py.toPinYin(entity.getExportPort());
|
|
|
entity.setExportPort(exportPort);
|
|
|
//目的港+,+运抵国别转英文
|
|
@@ -704,6 +786,7 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
result.setSuccess(false);
|
|
|
result.setMessage("数据字典-唛头信息维护不正确!");
|
|
|
result.setResult(entity);
|
|
|
+ return result;
|
|
|
}
|
|
|
entity.setPrimark(split[0]);
|
|
|
entity.setKimballNo(split[1]);
|
|
@@ -749,14 +832,127 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
|
|
|
}else if(testName.equals("报关信息-合同")){
|
|
|
|
|
|
+ //获取当前日期减去60天
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(date);
|
|
|
+ calendar.add(Calendar.DAY_OF_MONTH,-60);
|
|
|
+ String dateTime = sf.format(calendar.getTime());
|
|
|
+ Date locale = sf.parse(dateTime);
|
|
|
+ SimpleDateFormat sdf1 = new SimpleDateFormat("MMM'.'dd'th,' yyyy", Locale.UK); // 月日年
|
|
|
+ entity.setDateTime(sdf1.format(locale));
|
|
|
+
|
|
|
+ //出口口岸转大写拼音
|
|
|
+ String exportPort = py.toPinYin(entity.getExportPort());
|
|
|
+ entity.setExportPort(exportPort);
|
|
|
+
|
|
|
+ //目的港+,+运抵国别转英文
|
|
|
+ //查询数据字典获取英文
|
|
|
+ List<DictModel> sysDicts = sysDictService.queryDictItemsByCode("port_of_destination");
|
|
|
+ for(DictModel di:sysDicts){
|
|
|
+ if(di.getText().equals(entity.getDestinationPort())){
|
|
|
+ entity.setDestinationPort(di.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<DictModel> sysDicts1 = sysDictService.queryDictItemsByCode("country_of_arrival");
|
|
|
+ for(DictModel di:sysDicts1){
|
|
|
+ if(di.getText().equals(entity.getArriveInCountry())){
|
|
|
+ entity.setArriveInCountry(di.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ TemplateExportParams params = new TemplateExportParams("D:\\"+testName+".xlsx");
|
|
|
+
|
|
|
+ //转map
|
|
|
+ Field[] fields = entity.getClass().getDeclaredFields();
|
|
|
+ for (Field field : fields) {
|
|
|
+ field.setAccessible(true);
|
|
|
+ map.put(field.getName(), field.get(entity));
|
|
|
+ }
|
|
|
+ //集合转map
|
|
|
+ for(SyShippingOrderItem li:list){
|
|
|
+ Field[] fieldsList = li.getClass().getDeclaredFields();
|
|
|
+ Map<String, Object> mapList = new HashMap<String, Object>();
|
|
|
+ for (Field field : fieldsList) {
|
|
|
+ field.setAccessible(true);
|
|
|
+ mapList.put(field.getName(), field.get(li));
|
|
|
+ }
|
|
|
+ listMap.add(mapList);
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("item", listMap);
|
|
|
+
|
|
|
+ Workbook workbook = ExcelExportUtil.exportExcel(params,map);
|
|
|
+ ServletOutputStream outputStream = response.getOutputStream();
|
|
|
+ workbook.write(outputStream);
|
|
|
+
|
|
|
+
|
|
|
+ }else if(testName.equals("报关信息-装箱单")){
|
|
|
+
|
|
|
+ entity.setDateTime(sf.format(date));
|
|
|
|
|
|
+ //出口口岸中文
|
|
|
+ entity.setExportPortName(entity.getExportPort());
|
|
|
+ //出口口岸转大写拼音
|
|
|
+ String exportPort = py.toPinYin(entity.getExportPort());
|
|
|
+ entity.setExportPort(exportPort);
|
|
|
|
|
|
+ //查询数据字典唛头
|
|
|
+ List<DictModel> test = sysDictService.queryDictItemsByCode("test0902002");
|
|
|
+ for(DictModel di:test){
|
|
|
+ if(di.getText().equals(list.get(0).getClientAbbreviation())){
|
|
|
+ String split[] = di.getValue().split("\\+");
|
|
|
+ if(split.length != 12){
|
|
|
+ result.setSuccess(false);
|
|
|
+ result.setMessage("数据字典-唛头信息维护不正确!");
|
|
|
+ result.setResult(entity);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ entity.setPrimark(split[0]);
|
|
|
+ entity.setKimballNo(split[1]);
|
|
|
+ entity.setOrderNo(split[2]);
|
|
|
+ entity.setCartonGrossWeight(split[3]);
|
|
|
+ entity.setCartonDimensions(split[4]);
|
|
|
+ entity.setCartonNumber(split[5]);
|
|
|
+ entity.setCartonQuantity(split[6]);
|
|
|
+ entity.setSubSectionDescription(split[7]);
|
|
|
+ entity.setAssortedSizeCodes(split[8]);
|
|
|
+ entity.setColour(split[9]);
|
|
|
+ entity.setMadeInChina(split[10]);
|
|
|
+ entity.setSizeBreakdown(split[11]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ TemplateExportParams params = new TemplateExportParams("D:\\"+testName+".xlsx");
|
|
|
+
|
|
|
+ //转map
|
|
|
+ Field[] fields = entity.getClass().getDeclaredFields();
|
|
|
+ for (Field field : fields) {
|
|
|
+ field.setAccessible(true);
|
|
|
+ map.put(field.getName(), field.get(entity));
|
|
|
+ }
|
|
|
+ //集合转map
|
|
|
+ for(SyShippingOrderItem li:list){
|
|
|
+ Field[] fieldsList = li.getClass().getDeclaredFields();
|
|
|
+ Map<String, Object> mapList = new HashMap<String, Object>();
|
|
|
+ for (Field field : fieldsList) {
|
|
|
+ field.setAccessible(true);
|
|
|
+ mapList.put(field.getName(), field.get(li));
|
|
|
+ }
|
|
|
+ listMap.add(mapList);
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("item", listMap);
|
|
|
+
|
|
|
+ Workbook workbook = ExcelExportUtil.exportExcel(params,map);
|
|
|
+ ServletOutputStream outputStream = response.getOutputStream();
|
|
|
+ workbook.write(outputStream);
|
|
|
}
|
|
|
|
|
|
result.setSuccess(true);
|
|
|
result.setMessage("导出成功,请往桌面查看!");
|
|
|
result.setResult(entity);
|
|
|
|
|
|
+
|
|
|
}catch (Exception ex){
|
|
|
|
|
|
ex.printStackTrace();
|
|
@@ -764,6 +960,7 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
|
|
|
}
|
|
|
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
|