|
@@ -9,6 +9,7 @@ import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.ServletOutputStream;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
@@ -16,11 +17,18 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
+import org.jeecg.common.system.vo.DictModel;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
import org.jeecg.modules.documents.letterDeposit.entity.SyRmb;
|
|
|
import org.jeecg.modules.documents.letterDeposit.entity.SyUsd;
|
|
|
+import org.jeecg.modules.documents.seclarationElements.entity.SyDeclarationElements;
|
|
|
+import org.jeecg.modules.documents.seclarationElements.entity.SyDeclarationElementsItem;
|
|
|
+import org.jeecg.modules.documents.seclarationElements.service.impl.SyDeclarationElementsItemServiceImpl;
|
|
|
+import org.jeecg.modules.documents.seclarationElements.service.impl.SyDeclarationElementsServiceImpl;
|
|
|
+import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetailsItem;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrder;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem;
|
|
|
+import org.jeecg.modules.documents.syShippingOrder.entity.VO.ElmentReady;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.entity.VO.SyPackingList;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.mapper.SyShippingOrderMapper;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.service.ISyShippingOrderService;
|
|
@@ -30,7 +38,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.service.impl.SyShippingOrderItemServiceImpl;
|
|
|
+import org.jeecg.modules.documents.syShippingOrder.tool.TopinYin;
|
|
|
import org.jeecg.modules.splt.mapper.SyPackingListTailoringItemMapper;
|
|
|
+import org.jeecg.modules.system.entity.SysDict;
|
|
|
+import org.jeecg.modules.system.service.impl.SysDictServiceImpl;
|
|
|
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
|
|
import org.jeecgframework.poi.excel.entity.TemplateExportParams;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -53,11 +64,15 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
@Autowired
|
|
|
private ISyShippingOrderService syShippingOrderService;
|
|
|
@Autowired
|
|
|
- private SyPackingListTailoringItemMapper syPackingListTailoringItemMapper;
|
|
|
+ private SyDeclarationElementsServiceImpl syDeclarationElementsService;
|
|
|
+ @Autowired
|
|
|
+ private SyDeclarationElementsItemServiceImpl syDeclarationElementsItemService;
|
|
|
@Autowired
|
|
|
private SyShippingOrderItemServiceImpl syShippingOrderItemService;
|
|
|
@Resource
|
|
|
private SyShippingOrderMapper syShippingOrderMapper;
|
|
|
+ @Autowired
|
|
|
+ private SysDictServiceImpl sysDictService;
|
|
|
|
|
|
|
|
|
|
|
@@ -452,25 +467,34 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
|
|
|
try {
|
|
|
|
|
|
- if(org.jeecg.modules.system.util.oConvertUtils.isEmpty(syShippingOrder.getId())){
|
|
|
+ if(syShippingOrder.getIds().size()==0){
|
|
|
result.setMessage("未拿到ID");
|
|
|
result.setSuccess(false);
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
- SyShippingOrder entity = syShippingOrderService.getById(syShippingOrder.getId());
|
|
|
- if(org.jeecg.modules.system.util.oConvertUtils.isEmpty(entity)){
|
|
|
- result.setMessage("未找到该数据!");
|
|
|
- result.setSuccess(false);
|
|
|
- return result;
|
|
|
+
|
|
|
+ QueryWrapper<SyShippingOrder> queryWrapper = new QueryWrapper<SyShippingOrder>();
|
|
|
+ queryWrapper.in("id",syShippingOrder.getIds());
|
|
|
+ List<SyShippingOrder> entityList = syShippingOrderService.list(queryWrapper);
|
|
|
+ if(syShippingOrder.getType().equals("1")){
|
|
|
+ for (SyShippingOrder li : entityList) {
|
|
|
+ if(li.getTheDocumentsState().equals("1")){
|
|
|
+ result.setSuccess(false);
|
|
|
+ result.setMessage("部分单据已提交,请勿重复提交!");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ for (SyShippingOrder li : entityList) {
|
|
|
+ if(li.getTheDocumentsState().equals("0")){
|
|
|
+ result.setSuccess(false);
|
|
|
+ result.setMessage("部分单据已取消提交,请勿重复取消提交!");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- int i = syShippingOrderService.syShippingOrderSubmit(syShippingOrder.getId(),syShippingOrder.getType());
|
|
|
+
|
|
|
+ int i = syShippingOrderService.syShippingOrderSubmit(syShippingOrder.getIds(),syShippingOrder.getType());
|
|
|
if(i>0){
|
|
|
if(syShippingOrder.getType().equals("1")){
|
|
|
result.setSuccess(true);
|
|
@@ -501,14 +525,12 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
@AutoLog(value = "发票打印")
|
|
|
@ApiOperation(value = "发票打印")
|
|
|
@RequestMapping(value = "/syShippingOrderPrint")
|
|
|
- public Result<SyShippingOrder> syShippingOrderPrint(String id,String testName) throws ParseException {
|
|
|
+ public void syShippingOrderPrint(String id,String testName,HttpServletResponse response) throws ParseException {
|
|
|
|
|
|
Result<SyShippingOrder> result= new Result<SyShippingOrder>();
|
|
|
|
|
|
|
|
|
List<SyShippingOrderItem> list = new ArrayList<>();
|
|
|
-
|
|
|
- List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
|
|
|
|
|
|
BigDecimal totalGrossWeight = BigDecimal.ZERO;
|
|
|
|
|
@@ -518,9 +540,10 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
|
|
|
BigDecimal tatolMoney = BigDecimal.ZERO;
|
|
|
|
|
|
+
|
|
|
+ SyShippingOrder entity = syShippingOrderService.getById(id);
|
|
|
+
|
|
|
try {
|
|
|
-
|
|
|
- SyShippingOrder entity = syShippingOrderService.getById(id);
|
|
|
|
|
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
Date date = sf.parse(entity.getLatestDateOfShipment());
|
|
@@ -559,8 +582,13 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
|
|
|
|
|
|
if(testName.equals("报关信息-报关单")){
|
|
|
- TemplateExportParams params = new TemplateExportParams("D:\\"+testName+".xlsx");
|
|
|
+
|
|
|
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");
|
|
|
+
|
|
|
|
|
|
Field[] fields = entity.getClass().getDeclaredFields();
|
|
|
for (Field field : fields) {
|
|
@@ -580,13 +608,155 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
map.put("item", listMap);
|
|
|
|
|
|
Workbook workbook = ExcelExportUtil.exportExcel(params,map);
|
|
|
- File savefile = new File("C:\\Users\\Mr_zeng\\Desktop\\");
|
|
|
- if (!savefile.exists()) {
|
|
|
- savefile.mkdirs();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 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>>();
|
|
|
+ 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);
|
|
|
+
|
|
|
+ for(SyShippingOrderItem li:itemList){
|
|
|
+ map.put("name","zzzz"+li.getReadyFabric());
|
|
|
+
|
|
|
+ Map<String, Object> map1 = 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);
|
|
|
+
|
|
|
+ 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));
|
|
|
+ }
|
|
|
+ listMap1.add(map2);
|
|
|
+ }
|
|
|
+
|
|
|
+ map1.put("name","商品编码 "+elementEntity.getInventoryCode());
|
|
|
+ map1.put("value","商品描述: ");
|
|
|
+ map1.put("item",listMap1);
|
|
|
+
|
|
|
+ listMap.add(map1);
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("list", listMap);
|
|
|
+
|
|
|
+ Workbook workbook = ExcelExportUtil.exportExcel(params,map);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }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));
|
|
|
+
|
|
|
+ TopinYin py = new TopinYin();
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ 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");
|
|
|
+
|
|
|
+
|
|
|
+ Field[] fields = entity.getClass().getDeclaredFields();
|
|
|
+ for (Field field : fields) {
|
|
|
+ field.setAccessible(true);
|
|
|
+ map.put(field.getName(), field.get(entity));
|
|
|
+ }
|
|
|
+
|
|
|
+ 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);
|
|
|
}
|
|
|
- FileOutputStream fos = new FileOutputStream("C:\\Users\\Mr_zeng\\Desktop\\"+testName+"1.xlsx");
|
|
|
- workbook.write(fos);
|
|
|
- fos.close();
|
|
|
+
|
|
|
+ map.put("item", listMap);
|
|
|
+
|
|
|
+ Workbook workbook = ExcelExportUtil.exportExcel(params,map);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ServletOutputStream outputStream = response.getOutputStream();
|
|
|
+
|
|
|
+
|
|
|
+ workbook.write(outputStream);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
result.setSuccess(true);
|
|
@@ -599,7 +769,8 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
|
|
|
log.error("生成失败:" + ex.getMessage());
|
|
|
|
|
|
}
|
|
|
- return result;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|