This commit is contained in:
linfso 2024-05-09 12:57:11 +08:00
parent b16778e546
commit 6cdc22a1be
3 changed files with 96 additions and 39 deletions

View File

@ -13,16 +13,15 @@ package com.xdadan.erp.web.emis;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.ArrayList; import java.util.*;
import java.util.Base64;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.xdadan.erp.common.annotation.filter.jackson.JacksonFilter; import com.xdadan.erp.common.annotation.filter.jackson.JacksonFilter;
import com.xdadan.erp.common.utils.DateUtils;
import com.xdadan.erp.emis.domain.EmisBrand; import com.xdadan.erp.emis.domain.EmisBrand;
import com.xdadan.erp.emis.domain.exception.EmisBizError; import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.domain.vo.*; import com.xdadan.erp.emis.domain.vo.*;
@ -278,20 +277,30 @@ public class EmisWaybillController extends BaseController
"billCode":"T123213", "billCode":"T123213",
"pdfInfo":"1231232112", "pdfInfo":"1231232112",
"billDetail":"1231232", "billDetail":"1231232",
"isEncrpt":"false" "isEncrpt":"false",
"printCount":"1",
"printDate":"",
"result":"success",
"message":"",
} }
] ]
*/ */
if(!StringUtils.isEmpty(billCode)){ if(!StringUtils.isEmpty(billCode)){
Map<String,Object> order=emisBaseService.getWaybillPrintOrder(billCode,billCodeRange,lang,printType);
try { try {
// response.setCharacterEncoding("UTF-8"); JSONArray jArr = new JSONArray();
// response.setContentType("application/pdf"); String[] billCodeArr = billCode.split(",");
// response.setHeader("Content-Disposition", "filename=" + billCode + ".pdf");
// OutputStream os = response.getOutputStream();
for(String billCodeItem:billCodeArr) {
Map<String, Object> order = emisBaseService.getWaybillPrintOrder(billCode, billCodeRange, lang, printType);
JSONObject printItem = new JSONObject();
printItem.put("billCode",billCodeItem);
printItem.put("billDetail",order);
printItem.put("isEncrpt",false);
printItem.put("printCount",1);
printItem.put("printDate", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,new Date()));
if(order!=null) {
ByteArrayOutputStream os = new ByteArrayOutputStream(); ByteArrayOutputStream os = new ByteArrayOutputStream();
IXddTplPrint tplPrint = new TanexTplPrintImpl(); IXddTplPrint tplPrint = new TanexTplPrintImpl();
tplPrint.genPDF(order, os); tplPrint.genPDF(order, os);
@ -299,8 +308,16 @@ public class EmisWaybillController extends BaseController
byte[] pdfBytes = os.toByteArray(); byte[] pdfBytes = os.toByteArray();
String pdfBase64Str = Base64.getEncoder().encodeToString(pdfBytes); String pdfBase64Str = Base64.getEncoder().encodeToString(pdfBytes);
System.out.println(pdfBase64Str); System.out.println(pdfBase64Str);
printItem.put("pdfInfo",pdfBase64Str);
printItem.put("result","success");
printItem.put("message","success");
}else{
printItem.put("result","fail");
printItem.put("message","未获取到数据");
}
}
return AjaxResult.success("获取成功",pdfBase64Str); return AjaxResult.success("获取成功",jArr);
}catch (Exception ex){ }catch (Exception ex){
ex.printStackTrace(); ex.printStackTrace();
return AjaxResult.error("获取失败"); return AjaxResult.error("获取失败");

View File

@ -93,6 +93,9 @@ public class EmisBaseService {
@Autowired @Autowired
private EmisRegionMapper emisRegionMapper; private EmisRegionMapper emisRegionMapper;
@Autowired
private EmisDestinationMapper emisDestinationMapper;
/** /**
* 获取当前登录用户 * 获取当前登录用户
* @return * @return
@ -127,6 +130,28 @@ public class EmisBaseService {
return emisWaybillMapper.selectCommissionStatDataByEmp(empNo); return emisWaybillMapper.selectCommissionStatDataByEmp(empNo);
} }
/**
* 获取目的地信息
* @param destCode
* @return
*/
public EmisDestination getDestinationByCode(String destCode){
if(StringUtils.isEmpty(destCode)){
return null;
}
EmisDestination queryEmisDestination = new EmisDestination();
queryEmisDestination.setDestCode(destCode);
List<EmisDestination> list=emisDestinationMapper.selectEmisDestinationList(queryEmisDestination);
if(list!=null){
return list.get(0);
}
return null;
}
public EmisWaybill getWaybillByBillCode(String billCode){ public EmisWaybill getWaybillByBillCode(String billCode){
@ -143,25 +168,29 @@ public class EmisBaseService {
} }
EmisWaybill waybill = emisWaybillMapper.selectEmisWaybillByBillCode(billCode); EmisWaybill waybill = emisWaybillMapper.selectEmisWaybillByBillCode(billCode);
if(waybill==null){
return null;
}
Map<String,Object> order = new HashMap<>(); Map<String,Object> order = new HashMap<>();
// Map<String,Object> order=new HashMap<>(); order.put("order_sn", waybill.getOrderSn());
order.put("order_sn", "DT20210901001"); order.put("yd_sn", waybill.getBillCode());
order.put("yd_sn", "SF1374689807723");
order.put("kdgs", "TANEX"); order.put("kdgs", "TANEX");
order.put("pdf_info", "[山东淄博-胡志明][越南DN]");
// order.put("packageWJC", "."); // order.put("pdf_info", "[山东淄博-胡志明][越南DN]");
// order.put("address", Convert.address("上海市黄浦区河南南路1009弄3号902室上海市黄浦区河南南路1009弄3号902室上海市黄浦区河南南路1009弄3号902室")); order.put("pdf_info", waybill.getThirdCode());
order.put("address", "上海市黄浦区河南南路1009弄3号902室上海市黄浦区河南南路1009弄3号902室上海市黄浦区河南南路1009弄3号902室");
order.put("company", "SDSDS"); // order.put("address", "上海市黄浦区河南南路1009弄3号902室上海市黄浦区河南南路1009弄3号902室上海市黄浦区河南南路1009弄3号902室");
order.put("mobile", Convert.mobile("13818228246")); order.put("address", waybill.getReceiveAddress());
order.put("consignee", Convert.chineseNameFirst("张三")); order.put("company", waybill.getReceiveCompany());
order.put("mobile", waybill.getReceiveMobile());
order.put("consignee", waybill.getReceiveName());
// order.put("consigneeAndMobile", Convert.chineseNameFirst("张三"+" "+"13818228246")); // order.put("consigneeAndMobile", Convert.chineseNameFirst("张三"+" "+"13818228246"));
order.put("send_address", "Vancouver"); order.put("send_address", waybill.getSendAddress());
order.put("send_company", "2324"); order.put("send_company", waybill.getSendCompany());
order.put("send_mobile", "1604-683-1088"); order.put("send_mobile", waybill.getSendMobile());
order.put("send_person", "Vancouver"); order.put("send_person", waybill.getSendName());
order.put("ext_data", "{\"k1\":\"阿尔巴尼亚\",\"k2\":\"阿尔巴尼亚快递\",\"k3\":\"阿尔巴尼亚国际特快\",\"k4\":\"1-10工作日\",\"k5\":\"阿尔AL\",\"k6\":\"山东淄博-阿尔巴尼亚地拉那\"}"); order.put("ext_data", "{\"k1\":\"阿尔巴尼亚\",\"k2\":\"阿尔巴尼亚快递\",\"k3\":\"阿尔巴尼亚国际特快\",\"k4\":\"1-10工作日\",\"k5\":\"阿尔AL\",\"k6\":\"山东淄博-阿尔巴尼亚地拉那\"}");
// order.put("sendPersonAndMobile", "Vancouver"+" "+"1604-683-1088"); // order.put("sendPersonAndMobile", "Vancouver"+" "+"1604-683-1088");
order.put("goods_info", "日常用品"); order.put("goods_info", "日常用品");

View File

@ -53,11 +53,6 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
@Autowired @Autowired
private EmisWaybillMapper emisWaybillMapper; private EmisWaybillMapper emisWaybillMapper;
@Autowired @Autowired
private IEmisWaybillFeeitemService emisWaybillFeeitemMapper; private IEmisWaybillFeeitemService emisWaybillFeeitemMapper;
@ -296,11 +291,27 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
// 派件网点 // 派件网点
emisWaybillSave.setDispatchSiteCode(emisWaybillSave.getDispatchUnderlingSiteCode()); emisWaybillSave.setDispatchSiteCode(emisWaybillSave.getDispatchUnderlingSiteCode());
// 订单运单初始状态 // 订单运单初始状态
emisWaybillSave.setOrderStatus("0"); emisWaybillSave.setOrderStatus("0");
emisWaybillSave.setWaybillStatus("0"); emisWaybillSave.setWaybillStatus("0");
// 目的网点3段码
String destSite3Code = "";
EmisSite destSite=getSiteByCode(emisWaybillSave.getDispatchUnderlingSiteCode());
if(destSite!=null){
destSite3Code=destSite.getSizeCode2();
}
// 三段码
EmisDestination destination=getDestinationByCode(emisWaybillSave.getDestinationCode());
String destName="";
if(destination!=null){
destName=destination.getDestName();
}
String thirdCode="["+getCurrentUser().getOwnerSiteName()+'-'+destName+"]["+destSite3Code+"]";
emisWaybillSave.setThirdCode(thirdCode);
// 下单时间 // 下单时间
emisWaybillSave.setOrderDate(new Date()); emisWaybillSave.setOrderDate(new Date());